@rpamis/comet 0.4.0-rc.1 → 0.4.0-rc.3

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 (423) hide show
  1. package/README.md +4 -651
  2. package/assets/manifest.json +1 -1
  3. package/assets/skills/comet/scripts/comet-archive.mjs +80 -80
  4. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +1 -1
  5. package/assets/skills/comet/scripts/comet-guard.mjs +102 -102
  6. package/assets/skills/comet/scripts/comet-handoff.mjs +82 -82
  7. package/assets/skills/comet/scripts/comet-hook-guard.mjs +69 -70
  8. package/assets/skills/comet/scripts/comet-hook-router.mjs +120 -121
  9. package/assets/skills/comet/scripts/comet-intent.mjs +6 -6
  10. package/assets/skills/comet/scripts/comet-resume-probe.mjs +48 -48
  11. package/assets/skills/comet/scripts/comet-runtime.mjs +174 -175
  12. package/assets/skills/comet/scripts/comet-state.mjs +105 -105
  13. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +17 -17
  14. package/assets/skills/comet-native/SKILL.md +6 -5
  15. package/assets/skills/comet-native/reference/commands.md +7 -6
  16. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +124 -118
  17. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +131 -125
  18. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +97 -90
  19. package/assets/skills/comet-native/scripts/comet-native-init.mjs +121 -115
  20. package/assets/skills/comet-native/scripts/comet-native-new.mjs +113 -107
  21. package/assets/skills/comet-native/scripts/comet-native-next.mjs +134 -128
  22. package/assets/skills/comet-native/scripts/comet-native-root.mjs +101 -95
  23. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +166 -159
  24. package/assets/skills/comet-native/scripts/comet-native-select.mjs +114 -108
  25. package/assets/skills/comet-native/scripts/comet-native-show.mjs +98 -92
  26. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +107 -101
  27. package/assets/skills/comet-native/scripts/comet-native-status.mjs +111 -105
  28. package/assets/skills-zh/comet-native/SKILL.md +6 -5
  29. package/assets/skills-zh/comet-native/reference/commands.md +7 -6
  30. package/dist/app/commands/bundle.d.ts.map +1 -1
  31. package/dist/app/commands/bundle.js.map +1 -1
  32. package/dist/app/commands/dashboard.d.ts +1 -1
  33. package/dist/app/commands/dashboard.js +1 -1
  34. package/dist/app/commands/doctor.d.ts.map +1 -1
  35. package/dist/app/commands/doctor.js +1 -1
  36. package/dist/app/commands/doctor.js.map +1 -1
  37. package/dist/app/commands/init.js +2 -2
  38. package/dist/app/commands/init.js.map +1 -1
  39. package/dist/app/commands/platform-select-prompt.d.ts.map +1 -1
  40. package/dist/app/commands/platform-select-prompt.js +1 -0
  41. package/dist/app/commands/platform-select-prompt.js.map +1 -1
  42. package/dist/app/commands/status.d.ts.map +1 -1
  43. package/dist/app/commands/status.js +49 -9
  44. package/dist/app/commands/status.js.map +1 -1
  45. package/dist/app/commands/update.d.ts.map +1 -1
  46. package/dist/app/commands/update.js +13 -49
  47. package/dist/app/commands/update.js.map +1 -1
  48. package/dist/domains/agent-learning/policy-compiler.d.ts.map +1 -1
  49. package/dist/domains/agent-learning/policy-compiler.js.map +1 -1
  50. package/dist/domains/agent-learning/types.d.ts.map +1 -1
  51. package/dist/domains/agent-learning/types.js.map +1 -1
  52. package/dist/domains/bundle/authoring.d.ts.map +1 -1
  53. package/dist/domains/bundle/authoring.js.map +1 -1
  54. package/dist/domains/bundle/next-action.d.ts.map +1 -1
  55. package/dist/domains/bundle/next-action.js.map +1 -1
  56. package/dist/domains/bundle/readiness-user-summary.d.ts.map +1 -1
  57. package/dist/domains/bundle/readiness-user-summary.js.map +1 -1
  58. package/dist/domains/bundle/types.d.ts.map +1 -1
  59. package/dist/domains/comet-classic/classic-archive.d.ts.map +1 -1
  60. package/dist/domains/comet-classic/classic-archive.js +15 -0
  61. package/dist/domains/comet-classic/classic-archive.js.map +1 -1
  62. package/dist/domains/comet-classic/classic-cli.d.ts +8 -0
  63. package/dist/domains/comet-classic/classic-cli.d.ts.map +1 -1
  64. package/dist/domains/comet-classic/classic-cli.js +10 -0
  65. package/dist/domains/comet-classic/classic-cli.js.map +1 -1
  66. package/dist/domains/comet-classic/classic-guard.d.ts.map +1 -1
  67. package/dist/domains/comet-classic/classic-guard.js +20 -0
  68. package/dist/domains/comet-classic/classic-guard.js.map +1 -1
  69. package/dist/domains/comet-classic/classic-handoff.d.ts.map +1 -1
  70. package/dist/domains/comet-classic/classic-handoff.js +13 -0
  71. package/dist/domains/comet-classic/classic-handoff.js.map +1 -1
  72. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  73. package/dist/domains/comet-classic/classic-hook-guard.js +14 -15
  74. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  75. package/dist/domains/comet-classic/classic-layout-initialization.d.ts.map +1 -1
  76. package/dist/domains/comet-classic/classic-layout-initialization.js.map +1 -1
  77. package/dist/domains/comet-classic/classic-output-language.d.ts +73 -0
  78. package/dist/domains/comet-classic/classic-output-language.d.ts.map +1 -0
  79. package/dist/domains/comet-classic/classic-output-language.js +175 -0
  80. package/dist/domains/comet-classic/classic-output-language.js.map +1 -0
  81. package/dist/domains/comet-classic/classic-script-entry.d.ts.map +1 -1
  82. package/dist/domains/comet-classic/classic-script-entry.js +10 -0
  83. package/dist/domains/comet-classic/classic-script-entry.js.map +1 -1
  84. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  85. package/dist/domains/comet-classic/classic-state-command.js +43 -4
  86. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  87. package/dist/domains/comet-entry/current-selection.d.ts.map +1 -1
  88. package/dist/domains/comet-entry/current-selection.js.map +1 -1
  89. package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
  90. package/dist/domains/comet-entry/init-workflow.js.map +1 -1
  91. package/dist/domains/comet-entry/project-status.d.ts.map +1 -1
  92. package/dist/domains/comet-entry/project-status.js +15 -3
  93. package/dist/domains/comet-entry/project-status.js.map +1 -1
  94. package/dist/domains/comet-entry/types.d.ts +5 -1
  95. package/dist/domains/comet-entry/types.d.ts.map +1 -1
  96. package/dist/domains/comet-memory/personal-memory.d.ts.map +1 -1
  97. package/dist/domains/comet-memory/personal-memory.js.map +1 -1
  98. package/dist/domains/comet-memory/types.d.ts.map +1 -1
  99. package/dist/domains/comet-memory/types.js.map +1 -1
  100. package/dist/domains/comet-native/native-atomic-file.d.ts +1 -0
  101. package/dist/domains/comet-native/native-atomic-file.d.ts.map +1 -1
  102. package/dist/domains/comet-native/native-atomic-file.js +19 -0
  103. package/dist/domains/comet-native/native-atomic-file.js.map +1 -1
  104. package/dist/domains/comet-native/native-children.d.ts +17 -0
  105. package/dist/domains/comet-native/native-children.d.ts.map +1 -1
  106. package/dist/domains/comet-native/native-children.js +86 -9
  107. package/dist/domains/comet-native/native-children.js.map +1 -1
  108. package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -1
  109. package/dist/domains/comet-native/native-cli-help.js +3 -2
  110. package/dist/domains/comet-native/native-cli-help.js.map +1 -1
  111. package/dist/domains/comet-native/native-cli-shared.d.ts +7 -1
  112. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  113. package/dist/domains/comet-native/native-cli-shared.js +51 -4
  114. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  115. package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
  116. package/dist/domains/comet-native/native-cli.js +4 -2
  117. package/dist/domains/comet-native/native-cli.js.map +1 -1
  118. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  119. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  120. package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
  121. package/dist/domains/comet-native/native-lock.js +10 -1
  122. package/dist/domains/comet-native/native-lock.js.map +1 -1
  123. package/dist/domains/comet-native/native-loop-runtime.d.ts +4 -1
  124. package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -1
  125. package/dist/domains/comet-native/native-loop-runtime.js +39 -6
  126. package/dist/domains/comet-native/native-loop-runtime.js.map +1 -1
  127. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
  128. package/dist/domains/comet-native/native-next-command.js +36 -2
  129. package/dist/domains/comet-native/native-next-command.js.map +1 -1
  130. package/dist/domains/comet-native/native-output-language.d.ts +69 -0
  131. package/dist/domains/comet-native/native-output-language.d.ts.map +1 -0
  132. package/dist/domains/comet-native/native-output-language.js +369 -0
  133. package/dist/domains/comet-native/native-output-language.js.map +1 -0
  134. package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -1
  135. package/dist/domains/comet-native/native-portable-archive.js +17 -1
  136. package/dist/domains/comet-native/native-portable-archive.js.map +1 -1
  137. package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -1
  138. package/dist/domains/comet-native/native-portable-continuation.js +70 -27
  139. package/dist/domains/comet-native/native-portable-continuation.js.map +1 -1
  140. package/dist/domains/comet-native/native-portable-migration.d.ts.map +1 -1
  141. package/dist/domains/comet-native/native-portable-migration.js.map +1 -1
  142. package/dist/domains/comet-native/native-portable-recovery.d.ts +1 -0
  143. package/dist/domains/comet-native/native-portable-recovery.d.ts.map +1 -1
  144. package/dist/domains/comet-native/native-portable-recovery.js +2 -2
  145. package/dist/domains/comet-native/native-portable-recovery.js.map +1 -1
  146. package/dist/domains/comet-native/native-portable-runtime.d.ts +22 -0
  147. package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -1
  148. package/dist/domains/comet-native/native-portable-runtime.js +114 -4
  149. package/dist/domains/comet-native/native-portable-runtime.js.map +1 -1
  150. package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -1
  151. package/dist/domains/comet-native/native-portable-state.js +5 -0
  152. package/dist/domains/comet-native/native-portable-state.js.map +1 -1
  153. package/dist/domains/comet-native/native-portable-types.d.ts +3 -0
  154. package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -1
  155. package/dist/domains/comet-native/native-portable-types.js.map +1 -1
  156. package/dist/domains/comet-native/native-runner-input.d.ts +30 -28
  157. package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -1
  158. package/dist/domains/comet-native/native-runner-input.js +19 -27
  159. package/dist/domains/comet-native/native-runner-input.js.map +1 -1
  160. package/dist/domains/comet-native/native-schema-migration.d.ts.map +1 -1
  161. package/dist/domains/comet-native/native-schema-migration.js.map +1 -1
  162. package/dist/domains/comet-native/native-script-entry.d.ts +5 -4
  163. package/dist/domains/comet-native/native-script-entry.d.ts.map +1 -1
  164. package/dist/domains/comet-native/native-script-entry.js +8 -16
  165. package/dist/domains/comet-native/native-script-entry.js.map +1 -1
  166. package/dist/domains/comet-native/native-status-discovery.d.ts +31 -1
  167. package/dist/domains/comet-native/native-status-discovery.d.ts.map +1 -1
  168. package/dist/domains/comet-native/native-status-discovery.js +46 -8
  169. package/dist/domains/comet-native/native-status-discovery.js.map +1 -1
  170. package/dist/domains/comet-native/native-supervisor.d.ts +11 -1
  171. package/dist/domains/comet-native/native-supervisor.d.ts.map +1 -1
  172. package/dist/domains/comet-native/native-supervisor.js +61 -0
  173. package/dist/domains/comet-native/native-supervisor.js.map +1 -1
  174. package/dist/domains/comet-native/native-types.d.ts.map +1 -1
  175. package/dist/domains/comet-native/native-verification-receipt.d.ts.map +1 -1
  176. package/dist/domains/comet-native/native-verification-receipt.js.map +1 -1
  177. package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
  178. package/dist/domains/comet-native/native-workspace.js.map +1 -1
  179. package/dist/domains/comet-plugin/integration.d.ts +2 -0
  180. package/dist/domains/comet-plugin/integration.d.ts.map +1 -1
  181. package/dist/domains/comet-plugin/integration.js +10 -6
  182. package/dist/domains/comet-plugin/integration.js.map +1 -1
  183. package/dist/domains/dashboard/collector.js +1 -1
  184. package/dist/domains/dashboard/default-plugin-host.d.ts +3 -0
  185. package/dist/domains/dashboard/default-plugin-host.d.ts.map +1 -1
  186. package/dist/domains/dashboard/default-plugin-host.js +38 -4
  187. package/dist/domains/dashboard/default-plugin-host.js.map +1 -1
  188. package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
  189. package/dist/domains/dashboard/native-adapter.js.map +1 -1
  190. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  191. package/dist/domains/dashboard/native-collector.js +2 -0
  192. package/dist/domains/dashboard/native-collector.js.map +1 -1
  193. package/dist/domains/dashboard/web/assets/abnfDiagram-VCTEODGH-UcCx24DV.js +1 -0
  194. package/dist/domains/dashboard/web/assets/arc-n8qsRq7W.js +1 -0
  195. package/dist/domains/dashboard/web/assets/architecture-7GRP2DOG-B5p4GzJf.js +1 -0
  196. package/dist/domains/dashboard/web/assets/architectureDiagram-5GKGNRK7-D4pJ8CU0.js +36 -0
  197. package/dist/domains/dashboard/web/assets/array-BifhSqXX.js +1 -0
  198. package/dist/domains/dashboard/web/assets/blockDiagram-I7D4REHJ-C7n-qrSQ.js +129 -0
  199. package/dist/domains/dashboard/web/assets/browser-CgwPGwaV.js +107 -0
  200. package/dist/domains/dashboard/web/assets/c4Diagram-7LVT6UL2-cMVrWYOm.js +38 -0
  201. package/dist/domains/dashboard/web/assets/channel-BZeSeXVb.js +1 -0
  202. package/dist/domains/dashboard/web/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  203. package/dist/domains/dashboard/web/assets/chunk-4HAMMTFA-CE5QrCQd.js +62 -0
  204. package/dist/domains/dashboard/web/assets/{chunk-5VM5RSS4-CopXcnFA.js → chunk-5VM5RSS4-ZNzvKenW.js} +2 -2
  205. package/dist/domains/dashboard/web/assets/chunk-75Z2AOVW-BtZqN-pM.js +2 -0
  206. package/dist/domains/dashboard/web/assets/chunk-DU6HZSFF-CChv0huc.js +125 -0
  207. package/dist/domains/dashboard/web/assets/chunk-F27PBJKO-CDT1ttJ8.js +1 -0
  208. package/dist/domains/dashboard/web/assets/chunk-FOHPRMQF-DHwB1DNv.js +161 -0
  209. package/dist/domains/dashboard/web/assets/chunk-GMAD6QVW-y5m6LMR7.js +72 -0
  210. package/dist/domains/dashboard/web/assets/chunk-GVQU2GXP-DkhKkaHd.js +1 -0
  211. package/dist/domains/dashboard/web/assets/chunk-IMKFNOWR-BaDSh7Jp.js +231 -0
  212. package/dist/domains/dashboard/web/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  213. package/dist/domains/dashboard/web/assets/chunk-L3NEJ4N5-B4ztH2fV.js +1 -0
  214. package/dist/domains/dashboard/web/assets/chunk-OSK3NFVY-BhX6NVzA.js +10 -0
  215. package/dist/domains/dashboard/web/assets/chunk-P2QGCYS3-BCNdGJkX.js +1 -0
  216. package/dist/domains/dashboard/web/assets/chunk-POPQ4Y6H-DwYVuiXw.js +1 -0
  217. package/dist/domains/dashboard/web/assets/chunk-PWAF6VOD-Cyg0IO0R.js +1 -0
  218. package/dist/domains/dashboard/web/assets/chunk-SHT3W25Y-BZ6skx8I.js +168 -0
  219. package/dist/domains/dashboard/web/assets/chunk-SVP7TREG-CLIGmSO0.js +88 -0
  220. package/dist/domains/dashboard/web/assets/chunk-TICWLB2K-BAQBbsn9.js +206 -0
  221. package/dist/domains/dashboard/web/assets/chunk-XXDRQBXY-D07UbEpV.js +1 -0
  222. package/dist/domains/dashboard/web/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  223. package/dist/domains/dashboard/web/assets/classDiagram-ZZMXUADV-2fcinal6.js +1 -0
  224. package/dist/domains/dashboard/web/assets/classDiagram-v2-VYDZK3BY-2fcinal6.js +1 -0
  225. package/dist/domains/dashboard/web/assets/cose-bilkent-JH36ORCC-wIi0mUih.js +1 -0
  226. package/dist/domains/dashboard/web/assets/cynefin-OW5HDTMX-DBdxyuTN.js +1 -0
  227. package/dist/domains/dashboard/web/assets/cynefinDiagram-5FMLGOSQ-DzO3jXxV.js +62 -0
  228. package/dist/domains/dashboard/web/assets/cytoscape.esm-CGd-uY3x.js +321 -0
  229. package/dist/domains/dashboard/web/assets/dagre-GXQ25YYZ-CE7H_hZS.js +4 -0
  230. package/dist/domains/dashboard/web/assets/dagre-PrKaheQc.js +1 -0
  231. package/dist/domains/dashboard/web/assets/defaultLocale-BFoDCU3G.js +1 -0
  232. package/dist/domains/dashboard/web/assets/demo-DrJ2uuUL.js +456 -0
  233. package/dist/domains/dashboard/web/assets/diagram-S7CK7UJ4-jUGQk5n-.js +30 -0
  234. package/dist/domains/dashboard/web/assets/diagram-UQ7AKVKN-DaH_zW8T.js +41 -0
  235. package/dist/domains/dashboard/web/assets/diagram-VSXAHHWV-DmG80db0.js +3 -0
  236. package/dist/domains/dashboard/web/assets/diagram-VX7I27RA-ltQ6niKn.js +24 -0
  237. package/dist/domains/dashboard/web/assets/diagram-Z3DM3KII-x92ex4lK.js +24 -0
  238. package/dist/domains/dashboard/web/assets/dist-Cf0h0n6i.js +1 -0
  239. package/dist/domains/dashboard/web/assets/ebnfDiagram-PWID7BFC-CI2u976k.js +1 -0
  240. package/dist/domains/dashboard/web/assets/erDiagram-RLTQ6QDP-DKs90SRd.js +99 -0
  241. package/dist/domains/dashboard/web/assets/es-D7xGlyQk.js +10 -0
  242. package/dist/domains/dashboard/web/assets/eventmodeling-NTZA5JFV-uARcGZPD.js +1 -0
  243. package/dist/domains/dashboard/web/assets/flowDiagram-HODETNUW-DXL1E4Bl.js +1 -0
  244. package/dist/domains/dashboard/web/assets/ganttDiagram-EL5Y4UJY-D3z6G60S.js +292 -0
  245. package/dist/domains/dashboard/web/assets/gitGraph-4MIJSDKK-vT1UnORT.js +1 -0
  246. package/dist/domains/dashboard/web/assets/gitGraphDiagram-WWUBYQGX-BJmJ96jv.js +106 -0
  247. package/dist/domains/dashboard/web/assets/graphlib-DS17s2tU.js +1 -0
  248. package/dist/domains/dashboard/web/assets/index-BG3MF8re.js +261 -0
  249. package/dist/domains/dashboard/web/assets/index-C2Hlo7VZ.css +1 -0
  250. package/dist/domains/dashboard/web/assets/info-A6RAGUB7-DFeLqqen.js +1 -0
  251. package/dist/domains/dashboard/web/assets/infoDiagram-27XIBGKW-DxuY43XD.js +2 -0
  252. package/dist/domains/dashboard/web/assets/init-C-OQMol4.js +1 -0
  253. package/dist/domains/dashboard/web/assets/ishikawaDiagram-5VMMS53U-DxillfWQ.js +70 -0
  254. package/dist/domains/dashboard/web/assets/journeyDiagram-3NMN7TZE-BPngQ3ag.js +139 -0
  255. package/dist/domains/dashboard/web/assets/kanban-definition-UXKFOSKX-DHMLEGD4.js +89 -0
  256. package/dist/domains/dashboard/web/assets/katex-CXMH3UgJ.js +257 -0
  257. package/dist/domains/dashboard/web/assets/line-D31peBjo.js +1 -0
  258. package/dist/domains/dashboard/web/assets/linear-B7X50T2m.js +1 -0
  259. package/dist/domains/dashboard/web/assets/marked.esm-BtJme7Pf.js +65 -0
  260. package/dist/domains/dashboard/web/assets/mermaid-parser.core-CX3Pzygh.js +7 -0
  261. package/dist/domains/dashboard/web/assets/mermaid.core-DlMjBFb6.js +44 -0
  262. package/dist/domains/dashboard/web/assets/mindmap-definition-YA3MSWOX-BKuSGF75.js +96 -0
  263. package/dist/domains/dashboard/web/assets/ordinal-BDEzSJ7C.js +1 -0
  264. package/dist/domains/dashboard/web/assets/packet-AYTQ26CC-B1T8Bds9.js +1 -0
  265. package/dist/domains/dashboard/web/assets/path-fybaL0A-.js +1 -0
  266. package/dist/domains/dashboard/web/assets/pegDiagram-XKGWAZYB-BYgTNxLw.js +1 -0
  267. package/dist/domains/dashboard/web/assets/pie-WAS4IAKB-fqAjmoQw.js +1 -0
  268. package/dist/domains/dashboard/web/assets/pieDiagram-E7YTZNPT-BAO0Ufky.js +39 -0
  269. package/dist/domains/dashboard/web/assets/purify.es-ChwZkWde.js +3 -0
  270. package/dist/domains/dashboard/web/assets/quadrantDiagram-AXDQQJYC-SA_1-7DT.js +7 -0
  271. package/dist/domains/dashboard/web/assets/radar-RG4KPBEZ-Bl_UfUle.js +1 -0
  272. package/dist/domains/dashboard/web/assets/railroad-74A4TZTK-yj6dkiSy.js +1 -0
  273. package/dist/domains/dashboard/web/assets/railroad-abnf-HS5TGJTU-CvouMciM.js +1 -0
  274. package/dist/domains/dashboard/web/assets/railroad-ebnf-LZEXJU2U-CkYQEX72.js +1 -0
  275. package/dist/domains/dashboard/web/assets/railroad-peg-WCYAUIDC-B0uYr48F.js +1 -0
  276. package/dist/domains/dashboard/web/assets/railroadDiagram-O6MQD6OU-DqV18Y46.js +1 -0
  277. package/dist/domains/dashboard/web/assets/requirementDiagram-BXWQKSXE-Ca2K5LuT.js +84 -0
  278. package/dist/domains/dashboard/web/assets/rough.esm-Dy-Kn_BL.js +1 -0
  279. package/dist/domains/dashboard/web/assets/sankeyDiagram-P5KCCOFB-D9MKl-Nr.js +40 -0
  280. package/dist/domains/dashboard/web/assets/sequenceDiagram-WJ2MYXX4-CXfvIzRx.js +162 -0
  281. package/dist/domains/dashboard/web/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
  282. package/dist/domains/dashboard/web/assets/src-CquUPIQx.js +1 -0
  283. package/dist/domains/dashboard/web/assets/stateDiagram-D77RDMKH-B7iaZHW7.js +1 -0
  284. package/dist/domains/dashboard/web/assets/stateDiagram-v2-MP3YSRHH-B6KoHQVe.js +1 -0
  285. package/dist/domains/dashboard/web/assets/swimlanes-42K2YHIH-OK-62yZl.js +1 -0
  286. package/dist/domains/dashboard/web/assets/swimlanesDiagram-VR7AAH4N-CjdOls9K.js +8 -0
  287. package/dist/domains/dashboard/web/assets/timeline-definition-24CTP7MA-D0l01B1h.js +120 -0
  288. package/dist/domains/dashboard/web/assets/treeView-Q6P3EWNA-Bg5u_o3A.js +1 -0
  289. package/dist/domains/dashboard/web/assets/treemap-WGGIJYW6-x89ccozk.js +1 -0
  290. package/dist/domains/dashboard/web/assets/vennDiagram-4TSXK5OY-DV19Cqhv.js +34 -0
  291. package/dist/domains/dashboard/web/assets/wardley-WFR3VGLG-BWoeoVk5.js +1 -0
  292. package/dist/domains/dashboard/web/assets/wardleyDiagram-VM6X3IG4-D4fCpoIP.js +78 -0
  293. package/dist/domains/dashboard/web/assets/xychartDiagram-S5SC5T6Z-DALnOMLb.js +7 -0
  294. package/dist/domains/dashboard/web/index.html +2 -2
  295. package/dist/domains/factory/artifacts.d.ts.map +1 -1
  296. package/dist/domains/factory/artifacts.js.map +1 -1
  297. package/dist/domains/factory/types.d.ts.map +1 -1
  298. package/dist/domains/integrations/codegraph.d.ts.map +1 -1
  299. package/dist/domains/integrations/codegraph.js.map +1 -1
  300. package/dist/domains/project-knowledge/local-store.d.ts +21 -0
  301. package/dist/domains/project-knowledge/local-store.d.ts.map +1 -1
  302. package/dist/domains/project-knowledge/local-store.js +97 -0
  303. package/dist/domains/project-knowledge/local-store.js.map +1 -1
  304. package/dist/domains/project-knowledge/types.d.ts.map +1 -1
  305. package/dist/domains/skill/platform-inspect.d.ts +1 -1
  306. package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
  307. package/dist/domains/skill/platform-inspect.js +50 -10
  308. package/dist/domains/skill/platform-inspect.js.map +1 -1
  309. package/dist/domains/skill/platform-install.d.ts +10 -5
  310. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  311. package/dist/domains/skill/platform-install.js +107 -17
  312. package/dist/domains/skill/platform-install.js.map +1 -1
  313. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  314. package/dist/domains/skill/uninstall.js +38 -61
  315. package/dist/domains/skill/uninstall.js.map +1 -1
  316. package/dist/domains/workflow-contract/contained-atomic-write.d.ts +1 -0
  317. package/dist/domains/workflow-contract/contained-atomic-write.d.ts.map +1 -1
  318. package/dist/domains/workflow-contract/contained-atomic-write.js +19 -0
  319. package/dist/domains/workflow-contract/contained-atomic-write.js.map +1 -1
  320. package/dist/domains/workflow-contract/global-config.d.ts +8 -0
  321. package/dist/domains/workflow-contract/global-config.d.ts.map +1 -1
  322. package/dist/domains/workflow-contract/global-config.js +25 -0
  323. package/dist/domains/workflow-contract/global-config.js.map +1 -1
  324. package/dist/domains/workflow-contract/index.d.ts +1 -1
  325. package/dist/domains/workflow-contract/index.d.ts.map +1 -1
  326. package/dist/domains/workflow-contract/index.js +1 -1
  327. package/dist/domains/workflow-contract/index.js.map +1 -1
  328. package/dist/domains/workflow-contract/output-envelope.d.ts +59 -0
  329. package/dist/domains/workflow-contract/output-envelope.d.ts.map +1 -0
  330. package/dist/domains/workflow-contract/output-envelope.js +108 -0
  331. package/dist/domains/workflow-contract/output-envelope.js.map +1 -0
  332. package/dist/domains/workflow-contract/project-config.d.ts +1 -1
  333. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  334. package/dist/domains/workflow-contract/project-config.js +1 -0
  335. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  336. package/dist/domains/workflow-contract/types.d.ts.map +1 -1
  337. package/dist/platform/install/platforms.d.ts +4 -0
  338. package/dist/platform/install/platforms.d.ts.map +1 -1
  339. package/dist/platform/install/platforms.js +15 -3
  340. package/dist/platform/install/platforms.js.map +1 -1
  341. package/dist/platform/paths/project-knowledge-storage.d.ts +1 -1
  342. package/dist/platform/paths/project-knowledge-storage.d.ts.map +1 -1
  343. package/dist/platform/paths/project-knowledge-storage.js +9 -4
  344. package/dist/platform/paths/project-knowledge-storage.js.map +1 -1
  345. package/dist/platform/version/version.d.ts +8 -0
  346. package/dist/platform/version/version.d.ts.map +1 -1
  347. package/dist/platform/version/version.js +58 -8
  348. package/dist/platform/version/version.js.map +1 -1
  349. package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +13 -13
  350. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/instruction.md +2 -0
  351. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/task.toml +1 -0
  352. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/validation/test_native_wave_d_stagnation_stop.py +37 -0
  353. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +13 -13
  354. package/package.json +24 -24
  355. package/dist/domains/dashboard/web/assets/abnfDiagram-N423BO3Z-BkUJc7LK.js +0 -1
  356. package/dist/domains/dashboard/web/assets/arc-DY4Y9tSO.js +0 -1
  357. package/dist/domains/dashboard/web/assets/architectureDiagram-T3A2C74G-7wC9YZS-.js +0 -36
  358. package/dist/domains/dashboard/web/assets/blockDiagram-VBNYF7ZC-Biqe-SaL.js +0 -132
  359. package/dist/domains/dashboard/web/assets/c4Diagram-5PPSVZJV-CccUFD1S.js +0 -10
  360. package/dist/domains/dashboard/web/assets/channel-DnRvSkOm.js +0 -1
  361. package/dist/domains/dashboard/web/assets/chunk-2GRJ4B5K-BUL4dDxo.js +0 -1
  362. package/dist/domains/dashboard/web/assets/chunk-2Q5K7J3B-BnKtDH9O.js +0 -1
  363. package/dist/domains/dashboard/web/assets/chunk-5RXB4S5H-C9pHQ1n3.js +0 -231
  364. package/dist/domains/dashboard/web/assets/chunk-6Q2QTUOP-CxrbngCi.js +0 -88
  365. package/dist/domains/dashboard/web/assets/chunk-GF5L2VYU-01mzgCUh.js +0 -206
  366. package/dist/domains/dashboard/web/assets/chunk-JWPE2WC7-wTiZVDvw.js +0 -1
  367. package/dist/domains/dashboard/web/assets/chunk-KBJHAD2P-Bxdv5bl-.js +0 -1
  368. package/dist/domains/dashboard/web/assets/chunk-RYQCIY6F-B5vF9l9A.js +0 -1
  369. package/dist/domains/dashboard/web/assets/chunk-XXDRQBXY-Dra3NnDp.js +0 -1
  370. package/dist/domains/dashboard/web/assets/classDiagram-JCYQIIEL-D3E-rgaQ.js +0 -1
  371. package/dist/domains/dashboard/web/assets/classDiagram-v2-OCEON4UE-D3E-rgaQ.js +0 -1
  372. package/dist/domains/dashboard/web/assets/cose-bilkent-JH36ORCC-DC96ge-n.js +0 -1
  373. package/dist/domains/dashboard/web/assets/cynefin-VYW2F7L2-Tt_NiopT.js +0 -166
  374. package/dist/domains/dashboard/web/assets/cynefinDiagram-MW4NZA55-BQ5__1hv.js +0 -62
  375. package/dist/domains/dashboard/web/assets/cytoscape.esm-D3_iZ_3b.js +0 -321
  376. package/dist/domains/dashboard/web/assets/dagre-VZM6K2ZE-Cr2zq3ro.js +0 -4
  377. package/dist/domains/dashboard/web/assets/defaultLocale-DX6XiGOO.js +0 -1
  378. package/dist/domains/dashboard/web/assets/demo-lxXhgJ9-.js +0 -456
  379. package/dist/domains/dashboard/web/assets/diagram-7IWD3JNH-BRpYDwPl.js +0 -30
  380. package/dist/domains/dashboard/web/assets/diagram-B4RE2ZJO-D7u-VBxW.js +0 -3
  381. package/dist/domains/dashboard/web/assets/diagram-LBJQPF4R-CHYuv2JD.js +0 -24
  382. package/dist/domains/dashboard/web/assets/diagram-Q27KOJAE-CV3ZE8Q3.js +0 -24
  383. package/dist/domains/dashboard/web/assets/diagram-UB23O5K3-co_OsTiQ.js +0 -41
  384. package/dist/domains/dashboard/web/assets/ebnfDiagram-BXEA7PRR-CETcWswS.js +0 -1
  385. package/dist/domains/dashboard/web/assets/erDiagram-JOGREHBK-edkItb7Z.js +0 -85
  386. package/dist/domains/dashboard/web/assets/flowDiagram-UKHOOZJN-D_oFJtSf.js +0 -156
  387. package/dist/domains/dashboard/web/assets/ganttDiagram-PKOTCBZU-CFjLVoA1.js +0 -292
  388. package/dist/domains/dashboard/web/assets/gitGraphDiagram-DS77QQ5N-BfD0tiKH.js +0 -106
  389. package/dist/domains/dashboard/web/assets/graph-DOmOIIwC.js +0 -1
  390. package/dist/domains/dashboard/web/assets/index-BzyqCfMb.css +0 -1
  391. package/dist/domains/dashboard/web/assets/index-CCKHH_A9.js +0 -10
  392. package/dist/domains/dashboard/web/assets/index-D8dxsTJY.js +0 -271
  393. package/dist/domains/dashboard/web/assets/index-DlSYK56b.js +0 -139
  394. package/dist/domains/dashboard/web/assets/infoDiagram-6WML65LV-Cx6xa9DS.js +0 -2
  395. package/dist/domains/dashboard/web/assets/init-Gi6I4Gst.js +0 -1
  396. package/dist/domains/dashboard/web/assets/ishikawaDiagram-WSZJBQD7-BjNLyyv_.js +0 -70
  397. package/dist/domains/dashboard/web/assets/journeyDiagram-NVQOT4AX-D2n9vrhx.js +0 -139
  398. package/dist/domains/dashboard/web/assets/kanban-definition-27J2QSJJ-kJL7v018.js +0 -89
  399. package/dist/domains/dashboard/web/assets/katex-HP8lGamR.js +0 -257
  400. package/dist/domains/dashboard/web/assets/layout-D-LzfAck.js +0 -1
  401. package/dist/domains/dashboard/web/assets/linear-CeHtd5-l.js +0 -1
  402. package/dist/domains/dashboard/web/assets/map-DxJ2ADlA.js +0 -1
  403. package/dist/domains/dashboard/web/assets/marked.esm-DECB3bxB.js +0 -64
  404. package/dist/domains/dashboard/web/assets/mermaid.core-B0EPSHs2.js +0 -306
  405. package/dist/domains/dashboard/web/assets/mindmap-definition-FAOFIHXS-bQQWINF4.js +0 -96
  406. package/dist/domains/dashboard/web/assets/ordinal-Cboi1Yqb.js +0 -1
  407. package/dist/domains/dashboard/web/assets/pegDiagram-VL7TDLO6-LxLY1W7W.js +0 -1
  408. package/dist/domains/dashboard/web/assets/pieDiagram-7S7Q4E2Y-BMDQqvuT.js +0 -39
  409. package/dist/domains/dashboard/web/assets/purify.es-Cz4mVeUR.js +0 -3
  410. package/dist/domains/dashboard/web/assets/quadrantDiagram-CIZ2JOQS-XWYjcuZN.js +0 -7
  411. package/dist/domains/dashboard/web/assets/railroadDiagram-AXF67PYL-p-OlQTa7.js +0 -1
  412. package/dist/domains/dashboard/web/assets/requirementDiagram-LRYGKXZP-BL4N8Vsl.js +0 -84
  413. package/dist/domains/dashboard/web/assets/sankeyDiagram-W5VNT64P-Btu-o6LN.js +0 -40
  414. package/dist/domains/dashboard/web/assets/sequenceDiagram-SI44F4Z6-9HpdQQ47.js +0 -162
  415. package/dist/domains/dashboard/web/assets/sizeCapture-X5ZJPWSS-5AnBiBHD.js +0 -1
  416. package/dist/domains/dashboard/web/assets/stateDiagram-OKZ733FA-Dv8IDsai.js +0 -1
  417. package/dist/domains/dashboard/web/assets/stateDiagram-v2-UEYNNEHI-DxOMyFOm.js +0 -1
  418. package/dist/domains/dashboard/web/assets/swimlanes-SLNWSIFB-BfJcN7dK.js +0 -2
  419. package/dist/domains/dashboard/web/assets/swimlanesDiagram-ULZ7WXOC-BnHRSbDk.js +0 -8
  420. package/dist/domains/dashboard/web/assets/timeline-definition-Z64GVDOM-DEOuEHi5.js +0 -120
  421. package/dist/domains/dashboard/web/assets/vennDiagram-T6HMQDX7-BqsGpwgo.js +0 -34
  422. package/dist/domains/dashboard/web/assets/wardleyDiagram-T6FBY63Y-CXlOp9so.js +0 -78
  423. package/dist/domains/dashboard/web/assets/xychartDiagram-ELKLHX3M-DyqqtC9X.js +0 -7
@@ -1,77 +1,77 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var Xu=Object.create;var ai=Object.defineProperty;var Zu=Object.getOwnPropertyDescriptor;var ef=Object.getOwnPropertyNames;var tf=Object.getPrototypeOf,nf=Object.prototype.hasOwnProperty;var Cn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var L=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},rf=(t,e)=>{for(var n in e)ai(t,n,{get:e[n],enumerable:!0})},of=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ef(e))!nf.call(t,i)&&i!==n&&ai(t,i,{get:()=>e[i],enumerable:!(r=Zu(e,i))||r.enumerable});return t};var Ge=(t,e,n)=>(n=t!=null?Xu(tf(t)):{},of(e||!t||!t.__esModule?ai(n,"default",{value:t,enumerable:!0}):n,t));var x=v(M=>{"use strict";var ci=Symbol.for("yaml.alias"),Ns=Symbol.for("yaml.document"),En=Symbol.for("yaml.map"),Ts=Symbol.for("yaml.pair"),li=Symbol.for("yaml.scalar"),_n=Symbol.for("yaml.seq"),he=Symbol.for("yaml.node.type"),lf=t=>!!t&&typeof t=="object"&&t[he]===ci,uf=t=>!!t&&typeof t=="object"&&t[he]===Ns,ff=t=>!!t&&typeof t=="object"&&t[he]===En,df=t=>!!t&&typeof t=="object"&&t[he]===Ts,js=t=>!!t&&typeof t=="object"&&t[he]===li,pf=t=>!!t&&typeof t=="object"&&t[he]===_n;function Is(t){if(t&&typeof t=="object")switch(t[he]){case En:case _n:return!0}return!1}function mf(t){if(t&&typeof t=="object")switch(t[he]){case ci:case En:case li:case _n:return!0}return!1}var hf=t=>(js(t)||Is(t))&&!!t.anchor;M.ALIAS=ci;M.DOC=Ns;M.MAP=En;M.NODE_TYPE=he;M.PAIR=Ts;M.SCALAR=li;M.SEQ=_n;M.hasAnchor=hf;M.isAlias=lf;M.isCollection=Is;M.isDocument=uf;M.isMap=ff;M.isNode=mf;M.isPair=df;M.isScalar=js;M.isSeq=pf});var Pt=v(ui=>{"use strict";var W=x(),H=Symbol("break visit"),$s=Symbol("skip children"),ue=Symbol("remove node");function xn(t,e){let n=qs(e);W.isDocument(t)?ot(null,t.contents,n,Object.freeze([t]))===ue&&(t.contents=null):ot(null,t,n,Object.freeze([]))}xn.BREAK=H;xn.SKIP=$s;xn.REMOVE=ue;function ot(t,e,n,r){let i=Ls(t,e,n,r);if(W.isNode(i)||W.isPair(i))return Ws(t,r,i),ot(t,i,n,r);if(typeof i!="symbol"){if(W.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=ot(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===H)return H;s===ue&&(e.items.splice(o,1),o-=1)}}}else if(W.isPair(e)){r=Object.freeze(r.concat(e));let o=ot("key",e.key,n,r);if(o===H)return H;o===ue&&(e.key=null);let s=ot("value",e.value,n,r);if(s===H)return H;s===ue&&(e.value=null)}}return i}async function Pn(t,e){let n=qs(e);W.isDocument(t)?await st(null,t.contents,n,Object.freeze([t]))===ue&&(t.contents=null):await st(null,t,n,Object.freeze([]))}Pn.BREAK=H;Pn.SKIP=$s;Pn.REMOVE=ue;async function st(t,e,n,r){let i=await Ls(t,e,n,r);if(W.isNode(i)||W.isPair(i))return Ws(t,r,i),st(t,i,n,r);if(typeof i!="symbol"){if(W.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=await st(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===H)return H;s===ue&&(e.items.splice(o,1),o-=1)}}}else if(W.isPair(e)){r=Object.freeze(r.concat(e));let o=await st("key",e.key,n,r);if(o===H)return H;o===ue&&(e.key=null);let s=await st("value",e.value,n,r);if(s===H)return H;s===ue&&(e.value=null)}}return i}function qs(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Ls(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(W.isMap(e))return n.Map?.(t,e,r);if(W.isSeq(e))return n.Seq?.(t,e,r);if(W.isPair(e))return n.Pair?.(t,e,r);if(W.isScalar(e))return n.Scalar?.(t,e,r);if(W.isAlias(e))return n.Alias?.(t,e,r)}function Ws(t,e,n){let r=e[e.length-1];if(W.isCollection(r))r.items[t]=n;else if(W.isPair(r))t==="key"?r.key=n:r.value=n;else if(W.isDocument(r))r.contents=n;else{let i=W.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}ui.visit=xn;ui.visitAsync=Pn});var fi=v(Fs=>{"use strict";var Ds=x(),gf=Pt(),wf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},yf=t=>t.replace(/[!,[\]{}]/g,e=>wf[e]),Rt=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,s]=r;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(s){return n(String(s)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+yf(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&Ds.isNode(e.contents)){let o={};gf.visit(e.contents,(s,a)=>{Ds.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of r)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
5
- `)}};Rt.defaultYaml={explicit:!1,version:"1.2"};Rt.defaultTags={"!!":"tag:yaml.org,2002:"};Fs.Directives=Rt});var Rn=v(At=>{"use strict";var Ms=x(),vf=Pt();function kf(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function Bs(t){let e=new Set;return vf.visit(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function Ks(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function bf(t,e){let n=[],r=new Map,i=null;return{onAnchor:o=>{n.push(o),i??(i=Bs(t));let s=Ks(e,i);return i.add(s),s},setAnchors:()=>{for(let o of n){let s=r.get(o);if(typeof s=="object"&&s.anchor&&(Ms.isScalar(s.node)||Ms.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}At.anchorIsValid=kf;At.anchorNames=Bs;At.createNodeAnchors=bf;At.findNewAnchor=Ks});var di=v(Us=>{"use strict";function Ot(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let s=r[i],a=Ot(t,r,String(i),s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),s=Ot(t,r,i,o);s===void 0?r.delete(i):s!==o&&r.set(i,s)}else if(r instanceof Set)for(let i of Array.from(r)){let o=Ot(t,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let s=Ot(t,r,i,o);s===void 0?delete r[i]:s!==o&&(r[i]=s)}return t.call(e,n,r)}Us.applyReviver=Ot});var _e=v(Hs=>{"use strict";var Sf=x();function Ys(t,e,n){if(Array.isArray(t))return t.map((r,i)=>Ys(r,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!Sf.hasAnchor(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=o=>{r.res=o,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}Hs.toJS=Ys});var An=v(Gs=>{"use strict";var Cf=di(),Js=x(),Ef=_e(),pi=class{constructor(e){Object.defineProperty(this,Js.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){if(!Js.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Ef.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Cf.applyReviver(o,{"":a},"",a):a}};Gs.NodeBase=pi});var Nt=v(Vs=>{"use strict";var _f=Rn(),xf=Pt(),at=x(),Pf=An(),Rf=_e(),mi=class extends Pf.NodeBase{constructor(e){super(at.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],xf.visit(e,{Node:(o,s)=>{(at.isAlias(s)||at.hasAnchor(s))&&r.push(s)}}),n&&(n.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:o}=n,s=this.resolve(i,n);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(s);if(a||(Rf.toJS(s,null,n),a=r.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=On(i,s,r)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(_f.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function On(t,e,n){if(at.isAlias(e)){let r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(at.isCollection(e)){let r=0;for(let i of e.items){let o=On(t,i,n);o>r&&(r=o)}return r}else if(at.isPair(e)){let r=On(t,e.key,n),i=On(t,e.value,n);return Math.max(r,i)}return 1}Vs.Alias=mi});var j=v(hi=>{"use strict";var Af=x(),Of=An(),Nf=_e(),Tf=t=>!t||typeof t!="function"&&typeof t!="object",xe=class extends Of.NodeBase{constructor(e){super(Af.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Nf.toJS(this.value,e,n)}toString(){return String(this.value)}};xe.BLOCK_FOLDED="BLOCK_FOLDED";xe.BLOCK_LITERAL="BLOCK_LITERAL";xe.PLAIN="PLAIN";xe.QUOTE_DOUBLE="QUOTE_DOUBLE";xe.QUOTE_SINGLE="QUOTE_SINGLE";hi.Scalar=xe;hi.isScalarValue=Tf});var Tt=v(Qs=>{"use strict";var jf=Nt(),Ve=x(),zs=j(),If="tag:yaml.org,2002:";function $f(t,e,n){if(e){let r=n.filter(o=>o.tag===e),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return n.find(r=>r.identify?.(t)&&!r.format)}function qf(t,e,n){if(Ve.isDocument(t)&&(t=t.contents),Ve.isNode(t))return t;if(Ve.isPair(t)){let u=n.schema[Ve.MAP].createNode?.(n.schema,null,n);return u.items.push(t),u}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=n,c;if(r&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new jf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=If+e.slice(2));let l=$f(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new zs.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?s[Ve.MAP]:Symbol.iterator in Object(t)?s[Ve.SEQ]:s[Ve.MAP]}o&&(o(l),delete n.onTagObj);let f=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new zs.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}Qs.createNode=qf});var Tn=v(Nn=>{"use strict";var Lf=Tt(),fe=x(),Wf=An();function gi(t,e,n){let r=n;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=r,r=s}else r=new Map([[o,r]])}return Lf.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Xs=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,wi=class extends Wf.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>fe.isNode(r)||fe.isPair(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Xs(e))this.add(n);else{let[r,...i]=e,o=this.get(r,!0);if(fe.isCollection(o))o.addIn(i,n);else if(o===void 0&&this.schema)this.set(r,gi(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(fe.isCollection(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!n&&fe.isScalar(o)?o.value:o:fe.isCollection(o)?o.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!fe.isPair(n))return!1;let r=n.value;return r==null||e&&fe.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let i=this.get(n,!0);return fe.isCollection(i)?i.hasIn(r):!1}setIn(e,n){let[r,...i]=e;if(i.length===0)this.set(r,n);else{let o=this.get(r,!0);if(fe.isCollection(o))o.setIn(i,n);else if(o===void 0&&this.schema)this.set(r,gi(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};Nn.Collection=wi;Nn.collectionFromPath=gi;Nn.isEmptyPath=Xs});var jt=v(jn=>{"use strict";var Df=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function yi(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Ff=(t,e,n)=>t.endsWith(`
6
- `)?yi(n,e):n.includes(`
4
+ var tf=Object.create;var ci=Object.defineProperty;var nf=Object.getOwnPropertyDescriptor;var rf=Object.getOwnPropertyNames;var of=Object.getPrototypeOf,sf=Object.prototype.hasOwnProperty;var Cn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var q=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},af=(t,e)=>{for(var n in e)ci(t,n,{get:e[n],enumerable:!0})},cf=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of rf(e))!sf.call(t,i)&&i!==n&&ci(t,i,{get:()=>e[i],enumerable:!(r=nf(e,i))||r.enumerable});return t};var Je=(t,e,n)=>(n=t!=null?tf(of(t)):{},cf(e||!t||!t.__esModule?ci(n,"default",{value:t,enumerable:!0}):n,t));var x=v(M=>{"use strict";var li=Symbol.for("yaml.alias"),Ts=Symbol.for("yaml.document"),En=Symbol.for("yaml.map"),js=Symbol.for("yaml.pair"),ui=Symbol.for("yaml.scalar"),_n=Symbol.for("yaml.seq"),he=Symbol.for("yaml.node.type"),df=t=>!!t&&typeof t=="object"&&t[he]===li,pf=t=>!!t&&typeof t=="object"&&t[he]===Ts,mf=t=>!!t&&typeof t=="object"&&t[he]===En,hf=t=>!!t&&typeof t=="object"&&t[he]===js,Is=t=>!!t&&typeof t=="object"&&t[he]===ui,gf=t=>!!t&&typeof t=="object"&&t[he]===_n;function $s(t){if(t&&typeof t=="object")switch(t[he]){case En:case _n:return!0}return!1}function wf(t){if(t&&typeof t=="object")switch(t[he]){case li:case En:case ui:case _n:return!0}return!1}var yf=t=>(Is(t)||$s(t))&&!!t.anchor;M.ALIAS=li;M.DOC=Ts;M.MAP=En;M.NODE_TYPE=he;M.PAIR=js;M.SCALAR=ui;M.SEQ=_n;M.hasAnchor=yf;M.isAlias=df;M.isCollection=$s;M.isDocument=pf;M.isMap=mf;M.isNode=wf;M.isPair=hf;M.isScalar=Is;M.isSeq=gf});var Pt=v(fi=>{"use strict";var W=x(),Y=Symbol("break visit"),Ls=Symbol("skip children"),ue=Symbol("remove node");function xn(t,e){let n=qs(e);W.isDocument(t)?st(null,t.contents,n,Object.freeze([t]))===ue&&(t.contents=null):st(null,t,n,Object.freeze([]))}xn.BREAK=Y;xn.SKIP=Ls;xn.REMOVE=ue;function st(t,e,n,r){let i=Ws(t,e,n,r);if(W.isNode(i)||W.isPair(i))return Ds(t,r,i),st(t,i,n,r);if(typeof i!="symbol"){if(W.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=st(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===Y)return Y;s===ue&&(e.items.splice(o,1),o-=1)}}}else if(W.isPair(e)){r=Object.freeze(r.concat(e));let o=st("key",e.key,n,r);if(o===Y)return Y;o===ue&&(e.key=null);let s=st("value",e.value,n,r);if(s===Y)return Y;s===ue&&(e.value=null)}}return i}async function Pn(t,e){let n=qs(e);W.isDocument(t)?await at(null,t.contents,n,Object.freeze([t]))===ue&&(t.contents=null):await at(null,t,n,Object.freeze([]))}Pn.BREAK=Y;Pn.SKIP=Ls;Pn.REMOVE=ue;async function at(t,e,n,r){let i=await Ws(t,e,n,r);if(W.isNode(i)||W.isPair(i))return Ds(t,r,i),at(t,i,n,r);if(typeof i!="symbol"){if(W.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=await at(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===Y)return Y;s===ue&&(e.items.splice(o,1),o-=1)}}}else if(W.isPair(e)){r=Object.freeze(r.concat(e));let o=await at("key",e.key,n,r);if(o===Y)return Y;o===ue&&(e.key=null);let s=await at("value",e.value,n,r);if(s===Y)return Y;s===ue&&(e.value=null)}}return i}function qs(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Ws(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(W.isMap(e))return n.Map?.(t,e,r);if(W.isSeq(e))return n.Seq?.(t,e,r);if(W.isPair(e))return n.Pair?.(t,e,r);if(W.isScalar(e))return n.Scalar?.(t,e,r);if(W.isAlias(e))return n.Alias?.(t,e,r)}function Ds(t,e,n){let r=e[e.length-1];if(W.isCollection(r))r.items[t]=n;else if(W.isPair(r))t==="key"?r.key=n:r.value=n;else if(W.isDocument(r))r.contents=n;else{let i=W.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}fi.visit=xn;fi.visitAsync=Pn});var di=v(Ms=>{"use strict";var Fs=x(),vf=Pt(),kf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},bf=t=>t.replace(/[!,[\]{}]/g,e=>kf[e]),Rt=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,s]=r;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(s){return n(String(s)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+bf(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&Fs.isNode(e.contents)){let o={};vf.visit(e.contents,(s,a)=>{Fs.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of r)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
5
+ `)}};Rt.defaultYaml={explicit:!1,version:"1.2"};Rt.defaultTags={"!!":"tag:yaml.org,2002:"};Ms.Directives=Rt});var Rn=v(Ot=>{"use strict";var Bs=x(),Sf=Pt();function Cf(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function Ks(t){let e=new Set;return Sf.visit(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function Us(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function Ef(t,e){let n=[],r=new Map,i=null;return{onAnchor:o=>{n.push(o),i??(i=Ks(t));let s=Us(e,i);return i.add(s),s},setAnchors:()=>{for(let o of n){let s=r.get(o);if(typeof s=="object"&&s.anchor&&(Bs.isScalar(s.node)||Bs.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}Ot.anchorIsValid=Cf;Ot.anchorNames=Ks;Ot.createNodeAnchors=Ef;Ot.findNewAnchor=Us});var pi=v(Hs=>{"use strict";function At(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let s=r[i],a=At(t,r,String(i),s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),s=At(t,r,i,o);s===void 0?r.delete(i):s!==o&&r.set(i,s)}else if(r instanceof Set)for(let i of Array.from(r)){let o=At(t,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let s=At(t,r,i,o);s===void 0?delete r[i]:s!==o&&(r[i]=s)}return t.call(e,n,r)}Hs.applyReviver=At});var xe=v(Gs=>{"use strict";var _f=x();function Ys(t,e,n){if(Array.isArray(t))return t.map((r,i)=>Ys(r,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!_f.hasAnchor(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=o=>{r.res=o,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}Gs.toJS=Ys});var On=v(Vs=>{"use strict";var xf=pi(),Js=x(),Pf=xe(),mi=class{constructor(e){Object.defineProperty(this,Js.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){if(!Js.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Pf.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?xf.applyReviver(o,{"":a},"",a):a}};Vs.NodeBase=mi});var Nt=v(zs=>{"use strict";var Rf=Rn(),Of=Pt(),ct=x(),Af=On(),Nf=xe(),hi=class extends Af.NodeBase{constructor(e){super(ct.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],Of.visit(e,{Node:(o,s)=>{(ct.isAlias(s)||ct.hasAnchor(s))&&r.push(s)}}),n&&(n.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:o}=n,s=this.resolve(i,n);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(s);if(a||(Nf.toJS(s,null,n),a=r.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=An(i,s,r)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(Rf.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function An(t,e,n){if(ct.isAlias(e)){let r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(ct.isCollection(e)){let r=0;for(let i of e.items){let o=An(t,i,n);o>r&&(r=o)}return r}else if(ct.isPair(e)){let r=An(t,e.key,n),i=An(t,e.value,n);return Math.max(r,i)}return 1}zs.Alias=hi});var I=v(gi=>{"use strict";var Tf=x(),jf=On(),If=xe(),$f=t=>!t||typeof t!="function"&&typeof t!="object",Pe=class extends jf.NodeBase{constructor(e){super(Tf.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:If.toJS(this.value,e,n)}toString(){return String(this.value)}};Pe.BLOCK_FOLDED="BLOCK_FOLDED";Pe.BLOCK_LITERAL="BLOCK_LITERAL";Pe.PLAIN="PLAIN";Pe.QUOTE_DOUBLE="QUOTE_DOUBLE";Pe.QUOTE_SINGLE="QUOTE_SINGLE";gi.Scalar=Pe;gi.isScalarValue=$f});var Tt=v(Xs=>{"use strict";var Lf=Nt(),Ve=x(),Qs=I(),qf="tag:yaml.org,2002:";function Wf(t,e,n){if(e){let r=n.filter(o=>o.tag===e),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return n.find(r=>r.identify?.(t)&&!r.format)}function Df(t,e,n){if(Ve.isDocument(t)&&(t=t.contents),Ve.isNode(t))return t;if(Ve.isPair(t)){let u=n.schema[Ve.MAP].createNode?.(n.schema,null,n);return u.items.push(t),u}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=n,c;if(r&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Lf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=qf+e.slice(2));let l=Wf(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new Qs.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?s[Ve.MAP]:Symbol.iterator in Object(t)?s[Ve.SEQ]:s[Ve.MAP]}o&&(o(l),delete n.onTagObj);let f=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new Qs.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}Xs.createNode=Df});var Tn=v(Nn=>{"use strict";var Ff=Tt(),fe=x(),Mf=On();function wi(t,e,n){let r=n;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=r,r=s}else r=new Map([[o,r]])}return Ff.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Zs=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,yi=class extends Mf.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>fe.isNode(r)||fe.isPair(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Zs(e))this.add(n);else{let[r,...i]=e,o=this.get(r,!0);if(fe.isCollection(o))o.addIn(i,n);else if(o===void 0&&this.schema)this.set(r,wi(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(fe.isCollection(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!n&&fe.isScalar(o)?o.value:o:fe.isCollection(o)?o.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!fe.isPair(n))return!1;let r=n.value;return r==null||e&&fe.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let i=this.get(n,!0);return fe.isCollection(i)?i.hasIn(r):!1}setIn(e,n){let[r,...i]=e;if(i.length===0)this.set(r,n);else{let o=this.get(r,!0);if(fe.isCollection(o))o.setIn(i,n);else if(o===void 0&&this.schema)this.set(r,wi(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};Nn.Collection=yi;Nn.collectionFromPath=wi;Nn.isEmptyPath=Zs});var jt=v(jn=>{"use strict";var Bf=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function vi(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Kf=(t,e,n)=>t.endsWith(`
6
+ `)?vi(n,e):n.includes(`
7
7
  `)?`
8
- `+yi(n,e):(t.endsWith(" ")?"":" ")+n;jn.indentComment=yi;jn.lineComment=Ff;jn.stringifyComment=Df});var ea=v(It=>{"use strict";var Mf="flow",vi="block",In="quoted";function Bf(t,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let c=Math.max(1+o,1+i-e.length);if(t.length<=c)return t;let l=[],f={},u=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?l.push(0):u=i-r);let d,h,g=!1,p=-1,m=-1,w=-1;n===vi&&(p=Zs(t,p,e.length),p!==-1&&(u=p+c));for(let S;S=t[p+=1];){if(n===In&&S==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}w=p}if(S===`
9
- `)n===vi&&(p=Zs(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(S===" "&&h&&h!==" "&&h!==`
8
+ `+vi(n,e):(t.endsWith(" ")?"":" ")+n;jn.indentComment=vi;jn.lineComment=Kf;jn.stringifyComment=Bf});var ta=v(It=>{"use strict";var Uf="flow",ki="block",In="quoted";function Hf(t,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let c=Math.max(1+o,1+i-e.length);if(t.length<=c)return t;let l=[],f={},u=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?l.push(0):u=i-r);let d,h,g=!1,p=-1,m=-1,w=-1;n===ki&&(p=ea(t,p,e.length),p!==-1&&(u=p+c));for(let S;S=t[p+=1];){if(n===In&&S==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}w=p}if(S===`
9
+ `)n===ki&&(p=ea(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(S===" "&&h&&h!==" "&&h!==`
10
10
  `&&h!==" "){let b=t[p+1];b&&b!==" "&&b!==`
11
11
  `&&b!==" "&&(d=p)}if(p>=u)if(d)l.push(d),u=d+c,d=void 0;else if(n===In){for(;h===" "||h===" ";)h=S,S=t[p+=1],g=!0;let b=p>w+1?p-2:m-1;if(f[b])return t;l.push(b),f[b]=!0,u=b+c,d=void 0}else g=!0}h=S}if(g&&a&&a(),l.length===0)return t;s&&s();let y=t.slice(0,l[0]);for(let S=0;S<l.length;++S){let b=l[S],C=l[S+1]||t.length;b===0?y=`
12
12
  ${e}${t.slice(0,C)}`:(n===In&&f[b]&&(y+=`${t[b]}\\`),y+=`
13
- ${e}${t.slice(b+1,C)}`)}return y}function Zs(t,e,n){let r=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+n)o=t[++e];else{do o=t[++e];while(o&&o!==`
14
- `);r=e,i=e+1,o=t[i]}return r}It.FOLD_BLOCK=vi;It.FOLD_FLOW=Mf;It.FOLD_QUOTED=In;It.foldFlowLines=Bf});var qt=v(ta=>{"use strict";var oe=j(),Pe=ea(),qn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ln=t=>/^(%|---|\.\.\.)/m.test(t);function Kf(t,e,n){if(!e||e<0)return!1;let r=e-n,i=t.length;if(i<=r)return!1;for(let o=0,s=0;o<i;++o)if(t[o]===`
15
- `){if(o-s>r)return!0;if(s=o+1,i-s<=r)return!1}return!0}function $t(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Ln(t)?" ":""),s="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(s+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{s+=n.slice(a,c);let f=n.substr(c+2,4);switch(f){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:f.substr(0,2)==="00"?s+="\\x"+f.substr(2):s+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(r||n[c+2]==='"'||n.length<i)c+=1;else{for(s+=n.slice(a,c)+`
13
+ ${e}${t.slice(b+1,C)}`)}return y}function ea(t,e,n){let r=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+n)o=t[++e];else{do o=t[++e];while(o&&o!==`
14
+ `);r=e,i=e+1,o=t[i]}return r}It.FOLD_BLOCK=ki;It.FOLD_FLOW=Uf;It.FOLD_QUOTED=In;It.foldFlowLines=Hf});var Lt=v(na=>{"use strict";var oe=I(),Re=ta(),Ln=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),qn=t=>/^(%|---|\.\.\.)/m.test(t);function Yf(t,e,n){if(!e||e<0)return!1;let r=e-n,i=t.length;if(i<=r)return!1;for(let o=0,s=0;o<i;++o)if(t[o]===`
15
+ `){if(o-s>r)return!0;if(s=o+1,i-s<=r)return!1}return!0}function $t(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(qn(t)?" ":""),s="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(s+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{s+=n.slice(a,c);let f=n.substr(c+2,4);switch(f){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:f.substr(0,2)==="00"?s+="\\x"+f.substr(2):s+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(r||n[c+2]==='"'||n.length<i)c+=1;else{for(s+=n.slice(a,c)+`
16
16
 
17
17
  `;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)s+=`
18
- `,c+=2;s+=o,n[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+n.slice(a):n,r?s:Pe.foldFlowLines(s,o,Pe.FOLD_QUOTED,qn(e,!1))}function ki(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(t))return $t(t,e);let n=e.indent||(Ln(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${n}`)+"'";return e.implicitKey?r:Pe.foldFlowLines(r,n,Pe.FOLD_FLOW,qn(e,!1))}function ct(t,e){let{singleQuote:n}=e.options,r;if(n===!1)r=$t;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=ki:o&&!i?r=$t:r=n?ki:$t}return r(t,e)}var bi;try{bi=new RegExp(`(^|(?<!
18
+ `,c+=2;s+=o,n[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+n.slice(a):n,r?s:Re.foldFlowLines(s,o,Re.FOLD_QUOTED,Ln(e,!1))}function bi(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(t))return $t(t,e);let n=e.indent||(qn(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${n}`)+"'";return e.implicitKey?r:Re.foldFlowLines(r,n,Re.FOLD_FLOW,Ln(e,!1))}function lt(t,e){let{singleQuote:n}=e.options,r;if(n===!1)r=$t;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=bi:o&&!i?r=$t:r=n?bi:$t}return r(t,e)}var Si;try{Si=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{bi=/\n+(?!\n|$)/g}function $n({comment:t,type:e,value:n},r,i,o){let{blockQuote:s,commentString:a,lineWidth:c}=r.options;if(!s||/\n[\t ]+$/.test(n))return ct(n,r);let l=r.indent||(r.forceBlockIndent||Ln(n)?" ":""),f=s==="literal"?!0:s==="folded"||e===oe.Scalar.BLOCK_FOLDED?!1:e===oe.Scalar.BLOCK_LITERAL?!0:!Kf(n,c,l.length);if(!n)return f?`|
23
+ |$)`,"g")}catch{Si=/\n+(?!\n|$)/g}function $n({comment:t,type:e,value:n},r,i,o){let{blockQuote:s,commentString:a,lineWidth:c}=r.options;if(!s||/\n[\t ]+$/.test(n))return lt(n,r);let l=r.indent||(r.forceBlockIndent||qn(n)?" ":""),f=s==="literal"?!0:s==="folded"||e===oe.Scalar.BLOCK_FOLDED?!1:e===oe.Scalar.BLOCK_LITERAL?!0:!Yf(n,c,l.length);if(!n)return f?`|
24
24
  `:`>
25
25
  `;let u,d;for(d=n.length;d>0;--d){let C=n[d-1];if(C!==`
26
26
  `&&C!==" "&&C!==" ")break}let h=n.substring(d),g=h.indexOf(`
27
27
  `);g===-1?u="-":n===h||g!==h.length-1?(u="+",o&&o()):u="",h&&(n=n.slice(0,-h.length),h[h.length-1]===`
28
- `&&(h=h.slice(0,-1)),h=h.replace(bi,`$&${l}`));let p=!1,m,w=-1;for(m=0;m<n.length;++m){let C=n[m];if(C===" ")p=!0;else if(C===`
28
+ `&&(h=h.slice(0,-1)),h=h.replace(Si,`$&${l}`));let p=!1,m,w=-1;for(m=0;m<n.length;++m){let C=n[m];if(C===" ")p=!0;else if(C===`
29
29
  `)w=m;else break}let y=n.substring(0,w<m?w+1:m);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let b=(p?l?"2":"1":"")+u;if(t&&(b+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!f){let C=n.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,R=qn(r,!0);s!=="folded"&&e!==oe.Scalar.BLOCK_FOLDED&&(R.onOverflow=()=>{E=!0});let k=Pe.foldFlowLines(`${y}${C}${h}`,l,Pe.FOLD_BLOCK,R);if(!E)return`>${b}
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,R=Ln(r,!0);s!=="folded"&&e!==oe.Scalar.BLOCK_FOLDED&&(R.onOverflow=()=>{E=!0});let k=Re.foldFlowLines(`${y}${C}${h}`,l,Re.FOLD_BLOCK,R);if(!E)return`>${b}
31
31
  ${l}${k}`}return n=n.replace(/\n+/g,`$&${l}`),`|${b}
32
- ${l}${y}${n}${h}`}function Uf(t,e,n,r){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:f}=e;if(a&&o.includes(`
33
- `)||f&&/[[\]{},]/.test(o))return ct(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||f||!o.includes(`
34
- `)?ct(o,e):$n(t,e,n,r);if(!a&&!f&&i!==oe.Scalar.PLAIN&&o.includes(`
35
- `))return $n(t,e,n,r);if(Ln(o)){if(c==="")return e.forceBlockIndent=!0,$n(t,e,n,r);if(a&&c===l)return ct(o,e)}let u=o.replace(/\n+/g,`$&
36
- ${c}`);if(s){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:g}=e.doc.schema;if(g.some(d)||h?.some(d))return ct(o,e)}return a?u:Pe.foldFlowLines(u,c,Pe.FOLD_FLOW,qn(e,!1))}function Yf(t,e,n,r){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==oe.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=oe.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case oe.Scalar.BLOCK_FOLDED:case oe.Scalar.BLOCK_LITERAL:return i||o?ct(s.value,e):$n(s,e,n,r);case oe.Scalar.QUOTE_DOUBLE:return $t(s.value,e);case oe.Scalar.QUOTE_SINGLE:return ki(s.value,e);case oe.Scalar.PLAIN:return Uf(s,e,n,r);default:return null}},l=c(a);if(l===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=i&&f||u;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}ta.stringifyString=Yf});var Lt=v(Si=>{"use strict";var Hf=Rn(),Re=x(),Jf=jt(),Gf=qt();function Vf(t,e){let n=Object.assign({blockQuote:!0,commentString:Jf.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function zf(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let n,r;if(Re.isScalar(e)){r=e.value;let i=t.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}n=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,n=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function Qf(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],o=(Re.isScalar(t)||Re.isCollection(t))&&t.anchor;o&&Hf.anchorIsValid(o)&&(n.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(r.directives.tagString(s)),i.join(" ")}function Xf(t,e,n,r){if(Re.isPair(t))return t.toString(e,n,r);if(Re.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Re.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=zf(e.doc.schema.tags,o));let s=Qf(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,n,r):Re.isScalar(o)?Gf.stringifyString(o,e,n,r):o.toString(e,n,r);return s?Re.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
37
- ${e.indent}${a}`:a}Si.createStringifyContext=Vf;Si.stringify=Xf});var oa=v(ia=>{"use strict";var ge=x(),na=j(),ra=Lt(),Wt=jt();function Zf({key:t,value:e},n,r,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=n,d=ge.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ge.isCollection(t)||!ge.isNode(t)&&typeof t=="object"){let R="With simple keys, collection cannot be used as a key value";throw new Error(R)}}let h=!u&&(!t||d&&e==null&&!n.inFlow||ge.isCollection(t)||(ge.isScalar(t)?t.type===na.Scalar.BLOCK_FOLDED||t.type===na.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!o),indent:a+c});let g=!1,p=!1,m=ra.stringify(t,n,()=>g=!0,()=>p=!0);if(!h&&!n.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(o||e==null)return g&&r&&r(),m===""?"?":h?`? ${m}`:m}else if(o&&!u||e==null&&h)return m=`? ${m}`,d&&!g?m+=Wt.lineComment(m,n.indent,l(d)):p&&i&&i(),m;g&&(d=null),h?(d&&(m+=Wt.lineComment(m,n.indent,l(d))),m=`? ${m}
38
- ${a}:`):(m=`${m}:`,d&&(m+=Wt.lineComment(m,n.indent,l(d))));let w,y,S;ge.isNode(e)?(w=!!e.spaceBefore,y=e.commentBefore,S=e.comment):(w=!1,y=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),n.implicitKey=!1,!h&&!d&&ge.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!f&&c.length>=2&&!n.inFlow&&!h&&ge.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let b=!1,C=ra.stringify(e,n,()=>b=!0,()=>p=!0),E=" ";if(d||w||y){if(E=w?`
32
+ ${l}${y}${n}${h}`}function Gf(t,e,n,r){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:f}=e;if(a&&o.includes(`
33
+ `)||f&&/[[\]{},]/.test(o))return lt(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||f||!o.includes(`
34
+ `)?lt(o,e):$n(t,e,n,r);if(!a&&!f&&i!==oe.Scalar.PLAIN&&o.includes(`
35
+ `))return $n(t,e,n,r);if(qn(o)){if(c==="")return e.forceBlockIndent=!0,$n(t,e,n,r);if(a&&c===l)return lt(o,e)}let u=o.replace(/\n+/g,`$&
36
+ ${c}`);if(s){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:g}=e.doc.schema;if(g.some(d)||h?.some(d))return lt(o,e)}return a?u:Re.foldFlowLines(u,c,Re.FOLD_FLOW,Ln(e,!1))}function Jf(t,e,n,r){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==oe.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=oe.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case oe.Scalar.BLOCK_FOLDED:case oe.Scalar.BLOCK_LITERAL:return i||o?lt(s.value,e):$n(s,e,n,r);case oe.Scalar.QUOTE_DOUBLE:return $t(s.value,e);case oe.Scalar.QUOTE_SINGLE:return bi(s.value,e);case oe.Scalar.PLAIN:return Gf(s,e,n,r);default:return null}},l=c(a);if(l===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=i&&f||u;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}na.stringifyString=Jf});var qt=v(Ci=>{"use strict";var Vf=Rn(),Oe=x(),zf=jt(),Qf=Lt();function Xf(t,e){let n=Object.assign({blockQuote:!0,commentString:zf.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Zf(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let n,r;if(Oe.isScalar(e)){r=e.value;let i=t.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}n=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,n=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function ed(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],o=(Oe.isScalar(t)||Oe.isCollection(t))&&t.anchor;o&&Vf.anchorIsValid(o)&&(n.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(r.directives.tagString(s)),i.join(" ")}function td(t,e,n,r){if(Oe.isPair(t))return t.toString(e,n,r);if(Oe.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Oe.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Zf(e.doc.schema.tags,o));let s=ed(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,n,r):Oe.isScalar(o)?Qf.stringifyString(o,e,n,r):o.toString(e,n,r);return s?Oe.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
37
+ ${e.indent}${a}`:a}Ci.createStringifyContext=Xf;Ci.stringify=td});var sa=v(oa=>{"use strict";var ge=x(),ra=I(),ia=qt(),Wt=jt();function nd({key:t,value:e},n,r,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=n,d=ge.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ge.isCollection(t)||!ge.isNode(t)&&typeof t=="object"){let R="With simple keys, collection cannot be used as a key value";throw new Error(R)}}let h=!u&&(!t||d&&e==null&&!n.inFlow||ge.isCollection(t)||(ge.isScalar(t)?t.type===ra.Scalar.BLOCK_FOLDED||t.type===ra.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!o),indent:a+c});let g=!1,p=!1,m=ia.stringify(t,n,()=>g=!0,()=>p=!0);if(!h&&!n.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(o||e==null)return g&&r&&r(),m===""?"?":h?`? ${m}`:m}else if(o&&!u||e==null&&h)return m=`? ${m}`,d&&!g?m+=Wt.lineComment(m,n.indent,l(d)):p&&i&&i(),m;g&&(d=null),h?(d&&(m+=Wt.lineComment(m,n.indent,l(d))),m=`? ${m}
38
+ ${a}:`):(m=`${m}:`,d&&(m+=Wt.lineComment(m,n.indent,l(d))));let w,y,S;ge.isNode(e)?(w=!!e.spaceBefore,y=e.commentBefore,S=e.comment):(w=!1,y=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),n.implicitKey=!1,!h&&!d&&ge.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!f&&c.length>=2&&!n.inFlow&&!h&&ge.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let b=!1,C=ia.stringify(e,n,()=>b=!0,()=>p=!0),E=" ";if(d||w||y){if(E=w?`
39
39
  `:"",y){let R=l(y);E+=`
40
40
  ${Wt.indentComment(R,n.indent)}`}C===""&&!n.inFlow?E===`
41
41
  `&&S&&(E=`
42
42
 
43
43
  `):E+=`
44
44
  ${n.indent}`}else if(!h&&ge.isCollection(e)){let R=C[0],k=C.indexOf(`
45
- `),P=k!==-1,re=n.inFlow??e.flow??e.items.length===0;if(P||!re){let z=!1;if(P&&(R==="&"||R==="!")){let O=C.indexOf(" ");R==="&"&&O!==-1&&O<k&&C[O+1]==="!"&&(O=C.indexOf(" ",O+1)),(O===-1||k<O)&&(z=!0)}z||(E=`
45
+ `),P=k!==-1,re=n.inFlow??e.flow??e.items.length===0;if(P||!re){let z=!1;if(P&&(R==="&"||R==="!")){let A=C.indexOf(" ");R==="&"&&A!==-1&&A<k&&C[A+1]==="!"&&(A=C.indexOf(" ",A+1)),(A===-1||k<A)&&(z=!0)}z||(E=`
46
46
  ${n.indent}`)}}else(C===""||C[0]===`
47
- `)&&(E="");return m+=E+C,n.inFlow?b&&r&&r():S&&!b?m+=Wt.lineComment(m,n.indent,l(S)):p&&i&&i(),m}ia.stringifyPair=Zf});var Ei=v(Ci=>{"use strict";var sa=Cn("process");function ed(t,...e){t==="debug"&&console.log(...e)}function td(t,e){(t==="debug"||t==="warn")&&(typeof sa.emitWarning=="function"?sa.emitWarning(e):console.warn(e))}Ci.debug=ed;Ci.warn=td});var Bn=v(Mn=>{"use strict";var Fn=x(),aa=j(),Wn="<<",Dn={identify:t=>t===Wn||typeof t=="symbol"&&t.description===Wn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new aa.Scalar(Symbol(Wn)),{addToJSMap:ca}),stringify:()=>Wn},nd=(t,e)=>(Dn.identify(e)||Fn.isScalar(e)&&(!e.type||e.type===aa.Scalar.PLAIN)&&Dn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Dn.tag&&n.default);function ca(t,e,n){let r=la(t,n);if(Fn.isSeq(r))for(let i of r.items)_i(t,e,i);else if(Array.isArray(r))for(let i of r)_i(t,e,i);else _i(t,e,r)}function _i(t,e,n){let r=la(t,n);if(!Fn.isMap(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function la(t,e){return t&&Fn.isAlias(e)?e.resolve(t.doc,t):e}Mn.addMergeToJSMap=ca;Mn.isMergeKey=nd;Mn.merge=Dn});var Pi=v(da=>{"use strict";var rd=Ei(),ua=Bn(),id=Lt(),fa=x(),xi=_e();function od(t,e,{key:n,value:r}){if(fa.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(ua.isMergeKey(t,n))ua.addMergeToJSMap(t,e,r);else{let i=xi.toJS(n,"",t);if(e instanceof Map)e.set(i,xi.toJS(r,i,t));else if(e instanceof Set)e.add(i);else{let o=sd(n,i,t),s=xi.toJS(r,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function sd(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(fa.isNode(t)&&n?.doc){let r=id.createStringifyContext(n.doc,{});r.anchors=new Set;for(let o of n.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!n.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),rd.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}da.addPairToJSMap=od});var Ae=v(Ri=>{"use strict";var pa=Tt(),ad=oa(),cd=Pi(),Kn=x();function ld(t,e,n){let r=pa.createNode(t,void 0,n),i=pa.createNode(e,void 0,n);return new Un(r,i)}var Un=class t{constructor(e,n=null){Object.defineProperty(this,Kn.NODE_TYPE,{value:Kn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return Kn.isNode(n)&&(n=n.clone(e)),Kn.isNode(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return cd.addPairToJSMap(n,r,this)}toString(e,n,r){return e?.doc?ad.stringifyPair(this,e,n,r):JSON.stringify(this)}};Ri.Pair=Un;Ri.createPair=ld});var Ai=v(ha=>{"use strict";var ze=x(),ma=Lt(),Yn=jt();function ud(t,e,n){return(e.inFlow??t.flow?dd:fd)(t,e,n)}function fd({comment:t,items:e},n,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=n,f=Object.assign({},n,{indent:o,type:null}),u=!1,d=[];for(let g=0;g<e.length;++g){let p=e[g],m=null;if(ze.isNode(p))!u&&p.spaceBefore&&d.push(""),Hn(n,d,p.commentBefore,u),p.comment&&(m=p.comment);else if(ze.isPair(p)){let y=ze.isNode(p.key)?p.key:null;y&&(!u&&y.spaceBefore&&d.push(""),Hn(n,d,y.commentBefore,u))}u=!1;let w=ma.stringify(p,f,()=>m=null,()=>u=!0);m&&(w+=Yn.lineComment(w,o,l(m))),u&&m&&(u=!1),d.push(r+w)}let h;if(d.length===0)h=i.start+i.end;else{h=d[0];for(let g=1;g<d.length;++g){let p=d[g];h+=p?`
47
+ `)&&(E="");return m+=E+C,n.inFlow?b&&r&&r():S&&!b?m+=Wt.lineComment(m,n.indent,l(S)):p&&i&&i(),m}oa.stringifyPair=nd});var _i=v(Ei=>{"use strict";var aa=Cn("process");function rd(t,...e){t==="debug"&&console.log(...e)}function id(t,e){(t==="debug"||t==="warn")&&(typeof aa.emitWarning=="function"?aa.emitWarning(e):console.warn(e))}Ei.debug=rd;Ei.warn=id});var Bn=v(Mn=>{"use strict";var Fn=x(),ca=I(),Wn="<<",Dn={identify:t=>t===Wn||typeof t=="symbol"&&t.description===Wn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ca.Scalar(Symbol(Wn)),{addToJSMap:la}),stringify:()=>Wn},od=(t,e)=>(Dn.identify(e)||Fn.isScalar(e)&&(!e.type||e.type===ca.Scalar.PLAIN)&&Dn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Dn.tag&&n.default);function la(t,e,n){let r=ua(t,n);if(Fn.isSeq(r))for(let i of r.items)xi(t,e,i);else if(Array.isArray(r))for(let i of r)xi(t,e,i);else xi(t,e,r)}function xi(t,e,n){let r=ua(t,n);if(!Fn.isMap(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function ua(t,e){return t&&Fn.isAlias(e)?e.resolve(t.doc,t):e}Mn.addMergeToJSMap=la;Mn.isMergeKey=od;Mn.merge=Dn});var Ri=v(pa=>{"use strict";var sd=_i(),fa=Bn(),ad=qt(),da=x(),Pi=xe();function cd(t,e,{key:n,value:r}){if(da.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(fa.isMergeKey(t,n))fa.addMergeToJSMap(t,e,r);else{let i=Pi.toJS(n,"",t);if(e instanceof Map)e.set(i,Pi.toJS(r,i,t));else if(e instanceof Set)e.add(i);else{let o=ld(n,i,t),s=Pi.toJS(r,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function ld(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(da.isNode(t)&&n?.doc){let r=ad.createStringifyContext(n.doc,{});r.anchors=new Set;for(let o of n.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!n.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),sd.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}pa.addPairToJSMap=cd});var Ae=v(Oi=>{"use strict";var ma=Tt(),ud=sa(),fd=Ri(),Kn=x();function dd(t,e,n){let r=ma.createNode(t,void 0,n),i=ma.createNode(e,void 0,n);return new Un(r,i)}var Un=class t{constructor(e,n=null){Object.defineProperty(this,Kn.NODE_TYPE,{value:Kn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return Kn.isNode(n)&&(n=n.clone(e)),Kn.isNode(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return fd.addPairToJSMap(n,r,this)}toString(e,n,r){return e?.doc?ud.stringifyPair(this,e,n,r):JSON.stringify(this)}};Oi.Pair=Un;Oi.createPair=dd});var Ai=v(ga=>{"use strict";var ze=x(),ha=qt(),Hn=jt();function pd(t,e,n){return(e.inFlow??t.flow?hd:md)(t,e,n)}function md({comment:t,items:e},n,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=n,f=Object.assign({},n,{indent:o,type:null}),u=!1,d=[];for(let g=0;g<e.length;++g){let p=e[g],m=null;if(ze.isNode(p))!u&&p.spaceBefore&&d.push(""),Yn(n,d,p.commentBefore,u),p.comment&&(m=p.comment);else if(ze.isPair(p)){let y=ze.isNode(p.key)?p.key:null;y&&(!u&&y.spaceBefore&&d.push(""),Yn(n,d,y.commentBefore,u))}u=!1;let w=ha.stringify(p,f,()=>m=null,()=>u=!0);m&&(w+=Hn.lineComment(w,o,l(m))),u&&m&&(u=!1),d.push(r+w)}let h;if(d.length===0)h=i.start+i.end;else{h=d[0];for(let g=1;g<d.length;++g){let p=d[g];h+=p?`
48
48
  ${c}${p}`:`
49
49
  `}}return t?(h+=`
50
- `+Yn.indentComment(l(t),c),a&&a()):u&&s&&s(),h}function dd({items:t},e,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;r+=o;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,f=0,u=[];for(let g=0;g<t.length;++g){let p=t[g],m=null;if(ze.isNode(p))p.spaceBefore&&u.push(""),Hn(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(ze.isPair(p)){let y=ze.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&u.push(""),Hn(e,u,y.commentBefore,!1),y.comment&&(l=!0));let S=ze.isNode(p.value)?p.value:null;S?(S.comment&&(m=S.comment),S.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=ma.stringify(p,c,()=>m=null);l||(l=u.length>f||w.includes(`
51
- `)),g<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,S)=>y+S.length+2,2)+(w.length+2)>e.options.lineWidth)),l&&(w+=",")),m&&(w+=Yn.lineComment(w,r,a(m))),u.push(w),f=u.length}let{start:d,end:h}=n;if(u.length===0)return d+h;if(!l){let g=u.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let p of u)g+=p?`
50
+ `+Hn.indentComment(l(t),c),a&&a()):u&&s&&s(),h}function hd({items:t},e,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;r+=o;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,f=0,u=[];for(let g=0;g<t.length;++g){let p=t[g],m=null;if(ze.isNode(p))p.spaceBefore&&u.push(""),Yn(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(ze.isPair(p)){let y=ze.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&u.push(""),Yn(e,u,y.commentBefore,!1),y.comment&&(l=!0));let S=ze.isNode(p.value)?p.value:null;S?(S.comment&&(m=S.comment),S.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=ha.stringify(p,c,()=>m=null);l||(l=u.length>f||w.includes(`
51
+ `)),g<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,S)=>y+S.length+2,2)+(w.length+2)>e.options.lineWidth)),l&&(w+=",")),m&&(w+=Hn.lineComment(w,r,a(m))),u.push(w),f=u.length}let{start:d,end:h}=n;if(u.length===0)return d+h;if(!l){let g=u.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let p of u)g+=p?`
52
52
  ${o}${i}${p}`:`
53
53
  `;return`${g}
54
- ${i}${h}`}else return`${d}${s}${u.join(" ")}${s}${h}`}function Hn({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=Yn.indentComment(e(r),t);n.push(o.trimStart())}}ha.stringifyCollection=ud});var Ne=v(Ni=>{"use strict";var pd=Ai(),md=Pi(),hd=Tn(),Oe=x(),Jn=Ae(),gd=j();function Dt(t,e){let n=Oe.isScalar(e)?e.value:e;for(let r of t)if(Oe.isPair(r)&&(r.key===e||r.key===n||Oe.isScalar(r.key)&&r.key.value===n))return r}var Oi=class extends hd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Oe.MAP,e),this.items=[]}static from(e,n,r){let{keepUndefined:i,replacer:o}=r,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(n,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Jn.createPair(c,l,r))};if(n instanceof Map)for(let[c,l]of n)a(c,l);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,n){let r;Oe.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Jn.Pair(e,e?.value):r=new Jn.Pair(e.key,e.value);let i=Dt(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Oe.isScalar(i.value)&&gd.isScalarValue(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let s=this.items.findIndex(a=>o(r,a)<0);s===-1?this.items.push(r):this.items.splice(s,0,r)}else this.items.push(r)}delete(e){let n=Dt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=Dt(this.items,e)?.value;return(!n&&Oe.isScalar(i)?i.value:i)??void 0}has(e){return!!Dt(this.items,e)}set(e,n){this.add(new Jn.Pair(e,n),!0)}toJSON(e,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let o of this.items)md.addPairToJSMap(n,i,o);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Oe.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),pd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};Ni.YAMLMap=Oi;Ni.findPair=Dt});var lt=v(wa=>{"use strict";var wd=x(),ga=Ne(),yd={collection:"map",default:!0,nodeClass:ga.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return wd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>ga.YAMLMap.from(t,e,n)};wa.map=yd});var Te=v(ya=>{"use strict";var vd=Tt(),kd=Ai(),bd=Tn(),Vn=x(),Sd=j(),Cd=_e(),Ti=class extends bd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Vn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Gn(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=Gn(e);if(typeof r!="number")return;let i=this.items[r];return!n&&Vn.isScalar(i)?i.value:i}has(e){let n=Gn(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=Gn(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];Vn.isScalar(i)&&Sd.isScalarValue(n)?i.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let o of this.items)r.push(Cd.toJS(o,String(i++),n));return r}toString(e,n,r){return e?kd.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof i=="function"){let c=n instanceof Set?a:String(s++);a=i.call(n,c,a)}o.items.push(vd.createNode(a,void 0,r))}}return o}};function Gn(t){let e=Vn.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}ya.YAMLSeq=Ti});var ut=v(ka=>{"use strict";var Ed=x(),va=Te(),_d={collection:"seq",default:!0,nodeClass:va.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Ed.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>va.YAMLSeq.from(t,e,n)};ka.seq=_d});var Ft=v(ba=>{"use strict";var xd=qt(),Pd={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),xd.stringifyString(t,e,n,r)}};ba.string=Pd});var zn=v(Ea=>{"use strict";var Sa=j(),Ca={identify:t=>t==null,createNode:()=>new Sa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Sa.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Ca.test.test(t)?t:e.options.nullStr};Ea.nullTag=Ca});var ji=v(xa=>{"use strict";var Rd=j(),_a={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Rd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&_a.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};xa.boolTag=_a});var ft=v(Pa=>{"use strict";function Ad({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}Pa.stringifyNumber=Ad});var $i=v(Qn=>{"use strict";var Od=j(),Ii=ft(),Nd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ii.stringifyNumber},Td={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Ii.stringifyNumber(t)}},jd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Od.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Ii.stringifyNumber};Qn.float=jd;Qn.floatExp=Td;Qn.floatNaN=Nd});var Li=v(Zn=>{"use strict";var Ra=ft(),Xn=t=>typeof t=="bigint"||Number.isInteger(t),qi=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function Aa(t,e,n){let{value:r}=t;return Xn(r)&&r>=0?n+r.toString(e):Ra.stringifyNumber(t)}var Id={identify:t=>Xn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>qi(t,2,8,n),stringify:t=>Aa(t,8,"0o")},$d={identify:Xn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>qi(t,0,10,n),stringify:Ra.stringifyNumber},qd={identify:t=>Xn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>qi(t,2,16,n),stringify:t=>Aa(t,16,"0x")};Zn.int=$d;Zn.intHex=qd;Zn.intOct=Id});var Na=v(Oa=>{"use strict";var Ld=lt(),Wd=zn(),Dd=ut(),Fd=Ft(),Md=ji(),Wi=$i(),Di=Li(),Bd=[Ld.map,Dd.seq,Fd.string,Wd.nullTag,Md.boolTag,Di.intOct,Di.int,Di.intHex,Wi.floatNaN,Wi.floatExp,Wi.float];Oa.schema=Bd});var Ia=v(ja=>{"use strict";var Kd=j(),Ud=lt(),Yd=ut();function Ta(t){return typeof t=="bigint"||Number.isInteger(t)}var er=({value:t})=>JSON.stringify(t),Hd=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:er},{identify:t=>t==null,createNode:()=>new Kd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:er},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:er},{identify:Ta,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>Ta(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:er}],Jd={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Gd=[Ud.map,Yd.seq].concat(Hd,Jd);ja.schema=Gd});var Mi=v($a=>{"use strict";var Mt=Cn("buffer"),Fi=j(),Vd=qt(),zd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Mt.Buffer=="function")return Mt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},r,i,o){if(!n)return"";let s=n,a;if(typeof Mt.Buffer=="function")a=s instanceof Mt.Buffer?s.toString("base64"):Mt.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<s.length;++l)c+=String.fromCharCode(s[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Fi.Scalar.BLOCK_LITERAL),e!==Fi.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(a.length/c),f=new Array(l);for(let u=0,d=0;u<l;++u,d+=c)f[u]=a.substr(d,c);a=f.join(e===Fi.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return Vd.stringifyString({comment:t,type:e,value:a},r,i,o)}};$a.binary=zd});var rr=v(nr=>{"use strict";var tr=x(),Bi=Ae(),Qd=j(),Xd=Te();function qa(t,e){if(tr.isSeq(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!tr.isPair(r)){if(tr.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new Bi.Pair(new Qd.Scalar(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
54
+ ${i}${h}`}else return`${d}${s}${u.join(" ")}${s}${h}`}function Yn({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=Hn.indentComment(e(r),t);n.push(o.trimStart())}}ga.stringifyCollection=pd});var Te=v(Ti=>{"use strict";var gd=Ai(),wd=Ri(),yd=Tn(),Ne=x(),Gn=Ae(),vd=I();function Dt(t,e){let n=Ne.isScalar(e)?e.value:e;for(let r of t)if(Ne.isPair(r)&&(r.key===e||r.key===n||Ne.isScalar(r.key)&&r.key.value===n))return r}var Ni=class extends yd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ne.MAP,e),this.items=[]}static from(e,n,r){let{keepUndefined:i,replacer:o}=r,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(n,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Gn.createPair(c,l,r))};if(n instanceof Map)for(let[c,l]of n)a(c,l);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,n){let r;Ne.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Gn.Pair(e,e?.value):r=new Gn.Pair(e.key,e.value);let i=Dt(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Ne.isScalar(i.value)&&vd.isScalarValue(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let s=this.items.findIndex(a=>o(r,a)<0);s===-1?this.items.push(r):this.items.splice(s,0,r)}else this.items.push(r)}delete(e){let n=Dt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=Dt(this.items,e)?.value;return(!n&&Ne.isScalar(i)?i.value:i)??void 0}has(e){return!!Dt(this.items,e)}set(e,n){this.add(new Gn.Pair(e,n),!0)}toJSON(e,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let o of this.items)wd.addPairToJSMap(n,i,o);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Ne.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),gd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};Ti.YAMLMap=Ni;Ti.findPair=Dt});var ut=v(ya=>{"use strict";var kd=x(),wa=Te(),bd={collection:"map",default:!0,nodeClass:wa.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return kd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>wa.YAMLMap.from(t,e,n)};ya.map=bd});var je=v(va=>{"use strict";var Sd=Tt(),Cd=Ai(),Ed=Tn(),Vn=x(),_d=I(),xd=xe(),ji=class extends Ed.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Vn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Jn(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=Jn(e);if(typeof r!="number")return;let i=this.items[r];return!n&&Vn.isScalar(i)?i.value:i}has(e){let n=Jn(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=Jn(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];Vn.isScalar(i)&&_d.isScalarValue(n)?i.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let o of this.items)r.push(xd.toJS(o,String(i++),n));return r}toString(e,n,r){return e?Cd.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof i=="function"){let c=n instanceof Set?a:String(s++);a=i.call(n,c,a)}o.items.push(Sd.createNode(a,void 0,r))}}return o}};function Jn(t){let e=Vn.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}va.YAMLSeq=ji});var ft=v(ba=>{"use strict";var Pd=x(),ka=je(),Rd={collection:"seq",default:!0,nodeClass:ka.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Pd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>ka.YAMLSeq.from(t,e,n)};ba.seq=Rd});var Ft=v(Sa=>{"use strict";var Od=Lt(),Ad={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),Od.stringifyString(t,e,n,r)}};Sa.string=Ad});var zn=v(_a=>{"use strict";var Ca=I(),Ea={identify:t=>t==null,createNode:()=>new Ca.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ca.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Ea.test.test(t)?t:e.options.nullStr};_a.nullTag=Ea});var Ii=v(Pa=>{"use strict";var Nd=I(),xa={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Nd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&xa.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};Pa.boolTag=xa});var dt=v(Ra=>{"use strict";function Td({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}Ra.stringifyNumber=Td});var Li=v(Qn=>{"use strict";var jd=I(),$i=dt(),Id={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$i.stringifyNumber},$d={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():$i.stringifyNumber(t)}},Ld={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new jd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:$i.stringifyNumber};Qn.float=Ld;Qn.floatExp=$d;Qn.floatNaN=Id});var Wi=v(Zn=>{"use strict";var Oa=dt(),Xn=t=>typeof t=="bigint"||Number.isInteger(t),qi=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function Aa(t,e,n){let{value:r}=t;return Xn(r)&&r>=0?n+r.toString(e):Oa.stringifyNumber(t)}var qd={identify:t=>Xn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>qi(t,2,8,n),stringify:t=>Aa(t,8,"0o")},Wd={identify:Xn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>qi(t,0,10,n),stringify:Oa.stringifyNumber},Dd={identify:t=>Xn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>qi(t,2,16,n),stringify:t=>Aa(t,16,"0x")};Zn.int=Wd;Zn.intHex=Dd;Zn.intOct=qd});var Ta=v(Na=>{"use strict";var Fd=ut(),Md=zn(),Bd=ft(),Kd=Ft(),Ud=Ii(),Di=Li(),Fi=Wi(),Hd=[Fd.map,Bd.seq,Kd.string,Md.nullTag,Ud.boolTag,Fi.intOct,Fi.int,Fi.intHex,Di.floatNaN,Di.floatExp,Di.float];Na.schema=Hd});var $a=v(Ia=>{"use strict";var Yd=I(),Gd=ut(),Jd=ft();function ja(t){return typeof t=="bigint"||Number.isInteger(t)}var er=({value:t})=>JSON.stringify(t),Vd=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:er},{identify:t=>t==null,createNode:()=>new Yd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:er},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:er},{identify:ja,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>ja(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:er}],zd={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Qd=[Gd.map,Jd.seq].concat(Vd,zd);Ia.schema=Qd});var Bi=v(La=>{"use strict";var Mt=Cn("buffer"),Mi=I(),Xd=Lt(),Zd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Mt.Buffer=="function")return Mt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},r,i,o){if(!n)return"";let s=n,a;if(typeof Mt.Buffer=="function")a=s instanceof Mt.Buffer?s.toString("base64"):Mt.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<s.length;++l)c+=String.fromCharCode(s[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Mi.Scalar.BLOCK_LITERAL),e!==Mi.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(a.length/c),f=new Array(l);for(let u=0,d=0;u<l;++u,d+=c)f[u]=a.substr(d,c);a=f.join(e===Mi.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return Xd.stringifyString({comment:t,type:e,value:a},r,i,o)}};La.binary=Zd});var rr=v(nr=>{"use strict";var tr=x(),Ki=Ae(),ep=I(),tp=je();function qa(t,e){if(tr.isSeq(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!tr.isPair(r)){if(tr.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new Ki.Pair(new ep.Scalar(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
56
56
  ${i.key.commentBefore}`:r.commentBefore),r.comment){let o=i.value??i.key;o.comment=o.comment?`${r.comment}
57
- ${o.comment}`:r.comment}r=i}t.items[n]=tr.isPair(r)?r:new Bi.Pair(r)}}else e("Expected a sequence for this tag");return t}function La(t,e,n){let{replacer:r}=n,i=new Xd.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof r=="function"&&(s=r.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(Bi.createPair(a,c,n))}return i}var Zd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:qa,createNode:La};nr.createPairs=La;nr.pairs=Zd;nr.resolvePairs=qa});var Yi=v(Ui=>{"use strict";var Wa=x(),Ki=_e(),Bt=Ne(),ep=Te(),Da=rr(),Qe=class t extends ep.YAMLSeq{constructor(){super(),this.add=Bt.YAMLMap.prototype.add.bind(this),this.delete=Bt.YAMLMap.prototype.delete.bind(this),this.get=Bt.YAMLMap.prototype.get.bind(this),this.has=Bt.YAMLMap.prototype.has.bind(this),this.set=Bt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let o,s;if(Wa.isPair(i)?(o=Ki.toJS(i.key,"",n),s=Ki.toJS(i.value,o,n)):o=Ki.toJS(i,"",n),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,s)}return r}static from(e,n,r){let i=Da.createPairs(e,n,r),o=new this;return o.items=i.items,o}};Qe.tag="tag:yaml.org,2002:omap";var tp={collection:"seq",identify:t=>t instanceof Map,nodeClass:Qe,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Da.resolvePairs(t,e),r=[];for(let{key:i}of n.items)Wa.isScalar(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new Qe,n)},createNode:(t,e,n)=>Qe.from(t,e,n)};Ui.YAMLOMap=Qe;Ui.omap=tp});var Ua=v(Hi=>{"use strict";var Fa=j();function Ma({value:t,source:e},n){return e&&(t?Ba:Ka).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var Ba={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Fa.Scalar(!0),stringify:Ma},Ka={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Fa.Scalar(!1),stringify:Ma};Hi.falseTag=Ka;Hi.trueTag=Ba});var Ya=v(ir=>{"use strict";var np=j(),Ji=ft(),rp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ji.stringifyNumber},ip={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Ji.stringifyNumber(t)}},op={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new np.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:Ji.stringifyNumber};ir.float=op;ir.floatExp=ip;ir.floatNaN=rp});var Ja=v(Ut=>{"use strict";var Ha=ft(),Kt=t=>typeof t=="bigint"||Number.isInteger(t);function or(t,e,n,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,n);return i==="-"?-1*o:o}function Gi(t,e,n){let{value:r}=t;if(Kt(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return Ha.stringifyNumber(t)}var sp={identify:Kt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>or(t,2,2,n),stringify:t=>Gi(t,2,"0b")},ap={identify:Kt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>or(t,1,8,n),stringify:t=>Gi(t,8,"0")},cp={identify:Kt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>or(t,0,10,n),stringify:Ha.stringifyNumber},lp={identify:Kt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>or(t,2,16,n),stringify:t=>Gi(t,16,"0x")};Ut.int=cp;Ut.intBin=sp;Ut.intHex=lp;Ut.intOct=ap});var zi=v(Vi=>{"use strict";var cr=x(),sr=Ae(),ar=Ne(),Xe=class t extends ar.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;cr.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new sr.Pair(e.key,null):n=new sr.Pair(e,null),ar.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=ar.findPair(this.items,e);return!n&&cr.isPair(r)?cr.isScalar(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=ar.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new sr.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof i=="function"&&(s=i.call(n,s,s)),o.items.push(sr.createPair(s,null,r));return o}};Xe.tag="tag:yaml.org,2002:set";var up={collection:"map",identify:t=>t instanceof Set,nodeClass:Xe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Xe.from(t,e,n),resolve(t,e){if(cr.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Xe,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Vi.YAMLSet=Xe;Vi.set=up});var Xi=v(lr=>{"use strict";var fp=ft();function Qi(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=r.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return n==="-"?i(-1)*o:o}function Ga(t){let{value:e}=t,n=s=>s;if(typeof e=="bigint")n=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return fp.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let i=n(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var dp={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>Qi(t,n),stringify:Ga},pp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Qi(t,!1),stringify:Ga},Va={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Va.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,o||0,s||0,a||0,c),f=e[8];if(f&&f!=="Z"){let u=Qi(f,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};lr.floatTime=pp;lr.intTime=dp;lr.timestamp=Va});var Xa=v(Qa=>{"use strict";var mp=lt(),hp=zn(),gp=ut(),wp=Ft(),yp=Mi(),za=Ua(),Zi=Ya(),ur=Ja(),vp=Bn(),kp=Yi(),bp=rr(),Sp=zi(),eo=Xi(),Cp=[mp.map,gp.seq,wp.string,hp.nullTag,za.trueTag,za.falseTag,ur.intBin,ur.intOct,ur.int,ur.intHex,Zi.floatNaN,Zi.floatExp,Zi.float,yp.binary,vp.merge,kp.omap,bp.pairs,Sp.set,eo.intTime,eo.floatTime,eo.timestamp];Qa.schema=Cp});var cc=v(ro=>{"use strict";var nc=lt(),Ep=zn(),rc=ut(),_p=Ft(),xp=ji(),to=$i(),no=Li(),Pp=Na(),Rp=Ia(),ic=Mi(),Yt=Bn(),oc=Yi(),sc=rr(),Za=Xa(),ac=zi(),fr=Xi(),ec=new Map([["core",Pp.schema],["failsafe",[nc.map,rc.seq,_p.string]],["json",Rp.schema],["yaml11",Za.schema],["yaml-1.1",Za.schema]]),tc={binary:ic.binary,bool:xp.boolTag,float:to.float,floatExp:to.floatExp,floatNaN:to.floatNaN,floatTime:fr.floatTime,int:no.int,intHex:no.intHex,intOct:no.intOct,intTime:fr.intTime,map:nc.map,merge:Yt.merge,null:Ep.nullTag,omap:oc.omap,pairs:sc.pairs,seq:rc.seq,set:ac.set,timestamp:fr.timestamp},Ap={"tag:yaml.org,2002:binary":ic.binary,"tag:yaml.org,2002:merge":Yt.merge,"tag:yaml.org,2002:omap":oc.omap,"tag:yaml.org,2002:pairs":sc.pairs,"tag:yaml.org,2002:set":ac.set,"tag:yaml.org,2002:timestamp":fr.timestamp};function Op(t,e,n){let r=ec.get(e);if(r&&!t)return n&&!r.includes(Yt.merge)?r.concat(Yt.merge):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(ec.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(Yt.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?tc[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(tc).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}ro.coreKnownTags=Ap;ro.getTags=Op});var so=v(lc=>{"use strict";var io=x(),Np=lt(),Tp=ut(),jp=Ft(),dr=cc(),Ip=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,oo=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?dr.getTags(e,"compat"):e?dr.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?dr.coreKnownTags:{},this.tags=dr.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,io.MAP,{value:Np.map}),Object.defineProperty(this,io.SCALAR,{value:jp.string}),Object.defineProperty(this,io.SEQ,{value:Tp.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Ip:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};lc.Schema=oo});var fc=v(uc=>{"use strict";var $p=x(),ao=Lt(),Ht=jt();function qp(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let i=ao.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=o(t.commentBefore);n.unshift(Ht.indentComment(c,""))}let s=!1,a=null;if(t.contents){if($p.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let f=o(t.contents.commentBefore);n.push(Ht.indentComment(f,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=ao.stringify(t.contents,i,()=>a=null,c);a&&(l+=Ht.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(ao.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
58
- `)?(n.push("..."),n.push(Ht.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&n[n.length-1]!==""&&n.push(""),n.push(Ht.indentComment(o(c),"")))}return n.join(`
57
+ ${o.comment}`:r.comment}r=i}t.items[n]=tr.isPair(r)?r:new Ki.Pair(r)}}else e("Expected a sequence for this tag");return t}function Wa(t,e,n){let{replacer:r}=n,i=new tp.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof r=="function"&&(s=r.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(Ki.createPair(a,c,n))}return i}var np={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:qa,createNode:Wa};nr.createPairs=Wa;nr.pairs=np;nr.resolvePairs=qa});var Yi=v(Hi=>{"use strict";var Da=x(),Ui=xe(),Bt=Te(),rp=je(),Fa=rr(),Qe=class t extends rp.YAMLSeq{constructor(){super(),this.add=Bt.YAMLMap.prototype.add.bind(this),this.delete=Bt.YAMLMap.prototype.delete.bind(this),this.get=Bt.YAMLMap.prototype.get.bind(this),this.has=Bt.YAMLMap.prototype.has.bind(this),this.set=Bt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let o,s;if(Da.isPair(i)?(o=Ui.toJS(i.key,"",n),s=Ui.toJS(i.value,o,n)):o=Ui.toJS(i,"",n),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,s)}return r}static from(e,n,r){let i=Fa.createPairs(e,n,r),o=new this;return o.items=i.items,o}};Qe.tag="tag:yaml.org,2002:omap";var ip={collection:"seq",identify:t=>t instanceof Map,nodeClass:Qe,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Fa.resolvePairs(t,e),r=[];for(let{key:i}of n.items)Da.isScalar(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new Qe,n)},createNode:(t,e,n)=>Qe.from(t,e,n)};Hi.YAMLOMap=Qe;Hi.omap=ip});var Ha=v(Gi=>{"use strict";var Ma=I();function Ba({value:t,source:e},n){return e&&(t?Ka:Ua).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var Ka={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ma.Scalar(!0),stringify:Ba},Ua={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ma.Scalar(!1),stringify:Ba};Gi.falseTag=Ua;Gi.trueTag=Ka});var Ya=v(ir=>{"use strict";var op=I(),Ji=dt(),sp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ji.stringifyNumber},ap={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Ji.stringifyNumber(t)}},cp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new op.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:Ji.stringifyNumber};ir.float=cp;ir.floatExp=ap;ir.floatNaN=sp});var Ja=v(Ut=>{"use strict";var Ga=dt(),Kt=t=>typeof t=="bigint"||Number.isInteger(t);function or(t,e,n,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,n);return i==="-"?-1*o:o}function Vi(t,e,n){let{value:r}=t;if(Kt(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return Ga.stringifyNumber(t)}var lp={identify:Kt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>or(t,2,2,n),stringify:t=>Vi(t,2,"0b")},up={identify:Kt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>or(t,1,8,n),stringify:t=>Vi(t,8,"0")},fp={identify:Kt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>or(t,0,10,n),stringify:Ga.stringifyNumber},dp={identify:Kt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>or(t,2,16,n),stringify:t=>Vi(t,16,"0x")};Ut.int=fp;Ut.intBin=lp;Ut.intHex=dp;Ut.intOct=up});var Qi=v(zi=>{"use strict";var cr=x(),sr=Ae(),ar=Te(),Xe=class t extends ar.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;cr.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new sr.Pair(e.key,null):n=new sr.Pair(e,null),ar.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=ar.findPair(this.items,e);return!n&&cr.isPair(r)?cr.isScalar(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=ar.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new sr.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof i=="function"&&(s=i.call(n,s,s)),o.items.push(sr.createPair(s,null,r));return o}};Xe.tag="tag:yaml.org,2002:set";var pp={collection:"map",identify:t=>t instanceof Set,nodeClass:Xe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Xe.from(t,e,n),resolve(t,e){if(cr.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Xe,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};zi.YAMLSet=Xe;zi.set=pp});var Zi=v(lr=>{"use strict";var mp=dt();function Xi(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=r.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return n==="-"?i(-1)*o:o}function Va(t){let{value:e}=t,n=s=>s;if(typeof e=="bigint")n=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return mp.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let i=n(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var hp={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>Xi(t,n),stringify:Va},gp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Xi(t,!1),stringify:Va},za={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(za.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,o||0,s||0,a||0,c),f=e[8];if(f&&f!=="Z"){let u=Xi(f,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};lr.floatTime=gp;lr.intTime=hp;lr.timestamp=za});var Za=v(Xa=>{"use strict";var wp=ut(),yp=zn(),vp=ft(),kp=Ft(),bp=Bi(),Qa=Ha(),eo=Ya(),ur=Ja(),Sp=Bn(),Cp=Yi(),Ep=rr(),_p=Qi(),to=Zi(),xp=[wp.map,vp.seq,kp.string,yp.nullTag,Qa.trueTag,Qa.falseTag,ur.intBin,ur.intOct,ur.int,ur.intHex,eo.floatNaN,eo.floatExp,eo.float,bp.binary,Sp.merge,Cp.omap,Ep.pairs,_p.set,to.intTime,to.floatTime,to.timestamp];Xa.schema=xp});var lc=v(io=>{"use strict";var rc=ut(),Pp=zn(),ic=ft(),Rp=Ft(),Op=Ii(),no=Li(),ro=Wi(),Ap=Ta(),Np=$a(),oc=Bi(),Ht=Bn(),sc=Yi(),ac=rr(),ec=Za(),cc=Qi(),fr=Zi(),tc=new Map([["core",Ap.schema],["failsafe",[rc.map,ic.seq,Rp.string]],["json",Np.schema],["yaml11",ec.schema],["yaml-1.1",ec.schema]]),nc={binary:oc.binary,bool:Op.boolTag,float:no.float,floatExp:no.floatExp,floatNaN:no.floatNaN,floatTime:fr.floatTime,int:ro.int,intHex:ro.intHex,intOct:ro.intOct,intTime:fr.intTime,map:rc.map,merge:Ht.merge,null:Pp.nullTag,omap:sc.omap,pairs:ac.pairs,seq:ic.seq,set:cc.set,timestamp:fr.timestamp},Tp={"tag:yaml.org,2002:binary":oc.binary,"tag:yaml.org,2002:merge":Ht.merge,"tag:yaml.org,2002:omap":sc.omap,"tag:yaml.org,2002:pairs":ac.pairs,"tag:yaml.org,2002:set":cc.set,"tag:yaml.org,2002:timestamp":fr.timestamp};function jp(t,e,n){let r=tc.get(e);if(r&&!t)return n&&!r.includes(Ht.merge)?r.concat(Ht.merge):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(tc.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(Ht.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?nc[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(nc).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}io.coreKnownTags=Tp;io.getTags=jp});var ao=v(uc=>{"use strict";var oo=x(),Ip=ut(),$p=ft(),Lp=Ft(),dr=lc(),qp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,so=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?dr.getTags(e,"compat"):e?dr.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?dr.coreKnownTags:{},this.tags=dr.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,oo.MAP,{value:Ip.map}),Object.defineProperty(this,oo.SCALAR,{value:Lp.string}),Object.defineProperty(this,oo.SEQ,{value:$p.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?qp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};uc.Schema=so});var dc=v(fc=>{"use strict";var Wp=x(),co=qt(),Yt=jt();function Dp(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let i=co.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=o(t.commentBefore);n.unshift(Yt.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Wp.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let f=o(t.contents.commentBefore);n.push(Yt.indentComment(f,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=co.stringify(t.contents,i,()=>a=null,c);a&&(l+=Yt.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(co.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
58
+ `)?(n.push("..."),n.push(Yt.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&n[n.length-1]!==""&&n.push(""),n.push(Yt.indentComment(o(c),"")))}return n.join(`
59
59
  `)+`
60
- `}uc.stringifyDocument=qp});var Jt=v(dc=>{"use strict";var Lp=Nt(),dt=Tn(),Z=x(),Wp=Ae(),Dp=_e(),Fp=so(),Mp=fc(),co=Rn(),Bp=di(),Kp=Tt(),lo=fi(),uo=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Z.NODE_TYPE,{value:Z.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:s}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new lo.Directives({version:s}),this.setSchema(s,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[Z.NODE_TYPE]:{value:Z.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Z.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){pt(this.contents)&&this.contents.add(e)}addIn(e,n){pt(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=co.anchorNames(this);e.anchor=!n||r.has(n)?co.findNewAnchor(n||"a",r):n}return new Lp.Alias(e.anchor)}createNode(e,n,r){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=n.filter(m).map(String);w.length>0&&(n=n.concat(w)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:f}=r??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=co.createNodeAnchors(this,s||"a"),g={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:h},p=Kp.createNode(e,f,g);return a&&Z.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,r={}){let i=this.createNode(e,null,r),o=this.createNode(n,null,r);return new Wp.Pair(i,o)}delete(e){return pt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return dt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):pt(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return Z.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return dt.isEmptyPath(e)?!n&&Z.isScalar(this.contents)?this.contents.value:this.contents:Z.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return Z.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return dt.isEmptyPath(e)?this.contents!==void 0:Z.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=dt.collectionFromPath(this.schema,[e],n):pt(this.contents)&&this.contents.set(e,n)}setIn(e,n){dt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=dt.collectionFromPath(this.schema,Array.from(e),n):pt(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new lo.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new lo.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new Fp.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Dp.toJS(this.contents,n??"",a);if(typeof o=="function")for(let{count:l,res:f}of a.anchors.values())o(f,l);return typeof s=="function"?Bp.applyReviver(s,{"":c},"",c):c}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Mp.stringifyDocument(this,e)}};function pt(t){if(Z.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}dc.Document=uo});var zt=v(Vt=>{"use strict";var Gt=class extends Error{constructor(e,n,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=n}},fo=class extends Gt{constructor(e,n,r){super("YAMLParseError",e,n,r)}},po=class extends Gt{constructor(e,n,r){super("YAMLWarning",e,n,r)}},Up=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="…"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"…"),r>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`…
60
+ `}fc.stringifyDocument=Dp});var Gt=v(pc=>{"use strict";var Fp=Nt(),pt=Tn(),Z=x(),Mp=Ae(),Bp=xe(),Kp=ao(),Up=dc(),lo=Rn(),Hp=pi(),Yp=Tt(),uo=di(),fo=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Z.NODE_TYPE,{value:Z.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:s}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new uo.Directives({version:s}),this.setSchema(s,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[Z.NODE_TYPE]:{value:Z.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Z.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){mt(this.contents)&&this.contents.add(e)}addIn(e,n){mt(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=lo.anchorNames(this);e.anchor=!n||r.has(n)?lo.findNewAnchor(n||"a",r):n}return new Fp.Alias(e.anchor)}createNode(e,n,r){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=n.filter(m).map(String);w.length>0&&(n=n.concat(w)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:f}=r??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=lo.createNodeAnchors(this,s||"a"),g={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:h},p=Yp.createNode(e,f,g);return a&&Z.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,r={}){let i=this.createNode(e,null,r),o=this.createNode(n,null,r);return new Mp.Pair(i,o)}delete(e){return mt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return pt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):mt(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return Z.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return pt.isEmptyPath(e)?!n&&Z.isScalar(this.contents)?this.contents.value:this.contents:Z.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return Z.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return pt.isEmptyPath(e)?this.contents!==void 0:Z.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=pt.collectionFromPath(this.schema,[e],n):mt(this.contents)&&this.contents.set(e,n)}setIn(e,n){pt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=pt.collectionFromPath(this.schema,Array.from(e),n):mt(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new uo.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new uo.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new Kp.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Bp.toJS(this.contents,n??"",a);if(typeof o=="function")for(let{count:l,res:f}of a.anchors.values())o(f,l);return typeof s=="function"?Hp.applyReviver(s,{"":c},"",c):c}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Up.stringifyDocument(this,e)}};function mt(t){if(Z.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}pc.Document=fo});var zt=v(Vt=>{"use strict";var Jt=class extends Error{constructor(e,n,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=n}},po=class extends Jt{constructor(e,n,r){super("YAMLParseError",e,n,r)}},mo=class extends Jt{constructor(e,n,r){super("YAMLWarning",e,n,r)}},Gp=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="…"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"…"),r>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`…
61
61
  `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=n.linePos[1];c?.line===r&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);n.message+=`:
62
62
 
63
63
  ${s}
64
64
  ${l}
65
- `}};Vt.YAMLError=Gt;Vt.YAMLParseError=fo;Vt.YAMLWarning=po;Vt.prettifyError=Up});var Qt=v(pc=>{"use strict";function Yp(t,{flow:e,indicator:n,next:r,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",h=!1,g=!1,p=null,m=null,w=null,y=null,S=null,b=null,C=null;for(let k of t)switch(g&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&o(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),p&&(l&&k.type!=="comment"&&k.type!=="newline"&&o(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),k.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&k.source.includes(" ")&&(p=k),f=!0;break;case"comment":{f||o(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let P=k.source.substring(1)||" ";u?u+=d+P:u=P,d="",l=!1;break}case"newline":l?u?u+=k.source:(!b||n!=="seq-item-ind")&&(c=!0):d+=k.source,l=!0,h=!0,(m||w)&&(y=k),f=!0;break;case"anchor":m&&o(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&o(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=k,C??(C=k.offset),l=!1,f=!1,g=!0;break;case"tag":{w&&o(k,"MULTIPLE_TAGS","A node can have at most one tag"),w=k,C??(C=k.offset),l=!1,f=!1,g=!0;break}case n:(m||w)&&o(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),b&&o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),b=k,l=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){S&&o(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=k,l=!1,f=!1;break}default:o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),l=!1,f=!1}let E=t[t.length-1],R=E?E.offset+E.source.length:i;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=s||r?.type==="block-map"||r?.type==="block-seq")&&o(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:b,spaceBefore:c,comment:u,hasNewline:h,anchor:m,tag:w,newlineAfterProp:y,end:R,start:C??R}}pc.resolveProps=Yp});var pr=v(mc=>{"use strict";function mo(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
66
- `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(mo(e.key)||mo(e.value))return!0}return!1;default:return!0}}mc.containsNewline=mo});var ho=v(hc=>{"use strict";var Hp=pr();function Jp(t,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&Hp.containsNewline(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}hc.flowIndentCheck=Jp});var go=v(wc=>{"use strict";var gc=x();function Gp(t,e,n){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,s)=>o===s||gc.isScalar(o)&&gc.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,n))}wc.mapIncludes=Gp});var Cc=v(Sc=>{"use strict";var yc=Ae(),Vp=Ne(),vc=Qt(),zp=pr(),kc=ho(),Qp=go(),bc="All mapping items must start at the same column";function Xp({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Vp.YAMLMap,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,l=null;for(let f of r.items){let{start:u,key:d,sep:h,value:g}=f,p=vc.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(d&&(d.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&i(c,"BAD_INDENT",bc)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
67
- `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||zp.containsNewline(d))&&i(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==r.indent&&i(c,"BAD_INDENT",bc);n.atKey=!0;let w=p.end,y=d?t(n,d,p,i):e(n,w,u,null,p,i);n.schema.compat&&kc.flowIndentCheck(r.indent,d,i),n.atKey=!1,Qp.mapIncludes(n,a.items,y)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let S=vc.resolveProps(h??[],{indicator:"map-value-ind",next:g,offset:y.range[2],onError:i,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=S.end,S.found){m&&(g?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<S.found.offset-1024&&i(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let b=g?t(n,g,S,i):e(n,c,h,null,S,i);n.schema.compat&&kc.flowIndentCheck(r.indent,g,i),c=b.range[2];let C=new yc.Pair(y,b);n.options.keepSourceTokens&&(C.srcToken=f),a.items.push(C)}else{m&&i(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(y.comment?y.comment+=`
68
- `+S.comment:y.comment=S.comment);let b=new yc.Pair(y);n.options.keepSourceTokens&&(b.srcToken=f),a.items.push(b)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,c,l??c],a}Sc.resolveBlockMap=Xp});var _c=v(Ec=>{"use strict";var Zp=Te(),em=Qt(),tm=ho();function nm({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Zp.YAMLSeq,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=r.offset,l=null;for(let{start:f,value:u}of r.items){let d=em.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(a.comment=d.comment);continue}let h=u?t(n,u,d,i):e(n,d.end,f,null,d,i);n.schema.compat&&tm.flowIndentCheck(r.indent,u,i),c=h.range[2],a.items.push(h)}return a.range=[r.offset,c,l??c],a}Ec.resolveBlockSeq=nm});var mt=v(xc=>{"use strict";function rm(t,e,n,r){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{n&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=c.substring(1)||" ";i?i+=s+f:i=f,s="";break}case"newline":i&&(s+=c),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}xc.resolveEnd=rm});var Oc=v(Ac=>{"use strict";var im=x(),om=Ae(),Pc=Ne(),sm=Te(),am=mt(),Rc=Qt(),cm=pr(),lm=go(),wo="Block collections are not allowed within flow collections",yo=t=>t&&(t.type==="block-map"||t.type==="block-seq");function um({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=r.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Pc.YAMLMap:sm.YAMLSeq),l=new c(n.schema);l.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=r.offset+r.start.source.length;for(let m=0;m<r.items.length;++m){let w=r.items[m],{start:y,key:S,sep:b,value:C}=w,E=Rc.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:S??b?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!b&&!C){m===0&&E.comma?i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<r.items.length-1&&i(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(l.comment?l.comment+=`
69
- `+E.comment:l.comment=E.comment),u=E.end;continue}!s&&n.options.strict&&cm.containsNewline(S)&&i(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||i(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let R="";e:for(let k of y)switch(k.type){case"comma":case"space":break;case"comment":R=k.source.substring(1);break e;default:break e}if(R){let k=l.items[l.items.length-1];im.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
70
- `+R:k.comment=R,E.comment=E.comment.substring(R.length+1)}}if(!s&&!b&&!E.found){let R=C?t(n,C,E,i):e(n,E.end,b,null,E,i);l.items.push(R),u=R.range[2],yo(C)&&i(R.range,"BLOCK_IN_FLOW",wo)}else{n.atKey=!0;let R=E.end,k=S?t(n,S,E,i):e(n,R,y,null,E,i);yo(S)&&i(k.range,"BLOCK_IN_FLOW",wo),n.atKey=!1;let P=Rc.resolveProps(b??[],{flow:a,indicator:"map-value-ind",next:C,offset:k.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(P.found){if(!s&&!E.found&&n.options.strict){if(b)for(let O of b){if(O===P.found)break;if(O.type==="newline"){i(O,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<P.found.offset-1024&&i(P.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else C&&("source"in C&&C.source?.[0]===":"?i(C,"MISSING_CHAR",`Missing space after : in ${a}`):i(P.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let re=C?t(n,C,P,i):P.found?e(n,P.end,b,null,P,i):null;re?yo(C)&&i(re.range,"BLOCK_IN_FLOW",wo):P.comment&&(k.comment?k.comment+=`
71
- `+P.comment:k.comment=P.comment);let z=new om.Pair(k,re);if(n.options.keepSourceTokens&&(z.srcToken=w),s){let O=l;lm.mapIncludes(n,O.items,k)&&i(R,"DUPLICATE_KEY","Map keys must be unique"),O.items.push(z)}else{let O=new Pc.YAMLMap(n.schema);O.flow=!0,O.items.push(z);let ie=(re??k).range;O.range=[k.range[0],ie[1],ie[2]],l.items.push(O)}u=re?re.range[2]:P.end}}let d=s?"}":"]",[h,...g]=r.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),w=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;i(u,f?"MISSING_CHAR":"BAD_INDENT",w),h&&h.source.length!==1&&g.unshift(h)}if(g.length>0){let m=am.resolveEnd(g,p,n.options.strict,i);m.comment&&(l.comment?l.comment+=`
72
- `+m.comment:l.comment=m.comment),l.range=[r.offset,p,m.offset]}else l.range=[r.offset,p,p];return l}Ac.resolveFlowCollection=um});var Tc=v(Nc=>{"use strict";var fm=x(),dm=j(),pm=Ne(),mm=Te(),hm=Cc(),gm=_c(),wm=Oc();function vo(t,e,n,r,i,o){let s=n.type==="block-map"?hm.resolveBlockMap(t,e,n,r,o):n.type==="block-seq"?gm.resolveBlockSeq(t,e,n,r,o):wm.resolveFlowCollection(t,e,n,r,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function ym(t,e,n,r,i){let o=r.tag,s=o?e.directives.tagName(o.source,d=>i(o,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=r,g=d&&o?d.offset>o.offset?d:o:d??o;g&&(!h||h.offset<g.offset)&&i(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===pm.YAMLMap.tagName&&a==="map"||s===mm.YAMLSeq.tagName&&a==="seq")return vo(t,e,n,i,s);let c=e.schema.tags.find(d=>d.tag===s&&d.collection===a);if(!c){let d=e.schema.knownTags[s];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?i(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),vo(t,e,n,i,s)}let l=vo(t,e,n,i,s,c),f=c.resolve?.(l,d=>i(o,"TAG_RESOLVE_FAILED",d),e.options)??l,u=fm.isNode(f)?f:new dm.Scalar(f);return u.range=l.range,u.tag=s,c?.format&&(u.format=c.format),u}Nc.composeCollection=ym});var bo=v(jc=>{"use strict";var ko=j();function vm(t,e,n){let r=e.offset,i=km(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?ko.Scalar.BLOCK_FOLDED:ko.Scalar.BLOCK_LITERAL,s=e.source?bm(e.source):[],a=s.length;for(let p=s.length-1;p>=0;--p){let m=s[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=i.chomp==="+"&&s.length>0?`
65
+ `}};Vt.YAMLError=Jt;Vt.YAMLParseError=po;Vt.YAMLWarning=mo;Vt.prettifyError=Gp});var Qt=v(mc=>{"use strict";function Jp(t,{flow:e,indicator:n,next:r,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",h=!1,g=!1,p=null,m=null,w=null,y=null,S=null,b=null,C=null;for(let k of t)switch(g&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&o(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),p&&(l&&k.type!=="comment"&&k.type!=="newline"&&o(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),k.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&k.source.includes(" ")&&(p=k),f=!0;break;case"comment":{f||o(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let P=k.source.substring(1)||" ";u?u+=d+P:u=P,d="",l=!1;break}case"newline":l?u?u+=k.source:(!b||n!=="seq-item-ind")&&(c=!0):d+=k.source,l=!0,h=!0,(m||w)&&(y=k),f=!0;break;case"anchor":m&&o(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&o(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=k,C??(C=k.offset),l=!1,f=!1,g=!0;break;case"tag":{w&&o(k,"MULTIPLE_TAGS","A node can have at most one tag"),w=k,C??(C=k.offset),l=!1,f=!1,g=!0;break}case n:(m||w)&&o(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),b&&o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),b=k,l=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){S&&o(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=k,l=!1,f=!1;break}default:o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),l=!1,f=!1}let E=t[t.length-1],R=E?E.offset+E.source.length:i;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=s||r?.type==="block-map"||r?.type==="block-seq")&&o(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:b,spaceBefore:c,comment:u,hasNewline:h,anchor:m,tag:w,newlineAfterProp:y,end:R,start:C??R}}mc.resolveProps=Jp});var pr=v(hc=>{"use strict";function ho(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
66
+ `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(ho(e.key)||ho(e.value))return!0}return!1;default:return!0}}hc.containsNewline=ho});var go=v(gc=>{"use strict";var Vp=pr();function zp(t,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&Vp.containsNewline(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}gc.flowIndentCheck=zp});var wo=v(yc=>{"use strict";var wc=x();function Qp(t,e,n){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,s)=>o===s||wc.isScalar(o)&&wc.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,n))}yc.mapIncludes=Qp});var Ec=v(Cc=>{"use strict";var vc=Ae(),Xp=Te(),kc=Qt(),Zp=pr(),bc=go(),em=wo(),Sc="All mapping items must start at the same column";function tm({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Xp.YAMLMap,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,l=null;for(let f of r.items){let{start:u,key:d,sep:h,value:g}=f,p=kc.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(d&&(d.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&i(c,"BAD_INDENT",Sc)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
67
+ `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||Zp.containsNewline(d))&&i(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==r.indent&&i(c,"BAD_INDENT",Sc);n.atKey=!0;let w=p.end,y=d?t(n,d,p,i):e(n,w,u,null,p,i);n.schema.compat&&bc.flowIndentCheck(r.indent,d,i),n.atKey=!1,em.mapIncludes(n,a.items,y)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let S=kc.resolveProps(h??[],{indicator:"map-value-ind",next:g,offset:y.range[2],onError:i,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=S.end,S.found){m&&(g?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<S.found.offset-1024&&i(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let b=g?t(n,g,S,i):e(n,c,h,null,S,i);n.schema.compat&&bc.flowIndentCheck(r.indent,g,i),c=b.range[2];let C=new vc.Pair(y,b);n.options.keepSourceTokens&&(C.srcToken=f),a.items.push(C)}else{m&&i(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(y.comment?y.comment+=`
68
+ `+S.comment:y.comment=S.comment);let b=new vc.Pair(y);n.options.keepSourceTokens&&(b.srcToken=f),a.items.push(b)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,c,l??c],a}Cc.resolveBlockMap=tm});var xc=v(_c=>{"use strict";var nm=je(),rm=Qt(),im=go();function om({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??nm.YAMLSeq,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=r.offset,l=null;for(let{start:f,value:u}of r.items){let d=rm.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(a.comment=d.comment);continue}let h=u?t(n,u,d,i):e(n,d.end,f,null,d,i);n.schema.compat&&im.flowIndentCheck(r.indent,u,i),c=h.range[2],a.items.push(h)}return a.range=[r.offset,c,l??c],a}_c.resolveBlockSeq=om});var ht=v(Pc=>{"use strict";function sm(t,e,n,r){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{n&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=c.substring(1)||" ";i?i+=s+f:i=f,s="";break}case"newline":i&&(s+=c),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}Pc.resolveEnd=sm});var Nc=v(Ac=>{"use strict";var am=x(),cm=Ae(),Rc=Te(),lm=je(),um=ht(),Oc=Qt(),fm=pr(),dm=wo(),yo="Block collections are not allowed within flow collections",vo=t=>t&&(t.type==="block-map"||t.type==="block-seq");function pm({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=r.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Rc.YAMLMap:lm.YAMLSeq),l=new c(n.schema);l.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=r.offset+r.start.source.length;for(let m=0;m<r.items.length;++m){let w=r.items[m],{start:y,key:S,sep:b,value:C}=w,E=Oc.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:S??b?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!b&&!C){m===0&&E.comma?i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<r.items.length-1&&i(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(l.comment?l.comment+=`
69
+ `+E.comment:l.comment=E.comment),u=E.end;continue}!s&&n.options.strict&&fm.containsNewline(S)&&i(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||i(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let R="";e:for(let k of y)switch(k.type){case"comma":case"space":break;case"comment":R=k.source.substring(1);break e;default:break e}if(R){let k=l.items[l.items.length-1];am.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
70
+ `+R:k.comment=R,E.comment=E.comment.substring(R.length+1)}}if(!s&&!b&&!E.found){let R=C?t(n,C,E,i):e(n,E.end,b,null,E,i);l.items.push(R),u=R.range[2],vo(C)&&i(R.range,"BLOCK_IN_FLOW",yo)}else{n.atKey=!0;let R=E.end,k=S?t(n,S,E,i):e(n,R,y,null,E,i);vo(S)&&i(k.range,"BLOCK_IN_FLOW",yo),n.atKey=!1;let P=Oc.resolveProps(b??[],{flow:a,indicator:"map-value-ind",next:C,offset:k.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(P.found){if(!s&&!E.found&&n.options.strict){if(b)for(let A of b){if(A===P.found)break;if(A.type==="newline"){i(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<P.found.offset-1024&&i(P.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else C&&("source"in C&&C.source?.[0]===":"?i(C,"MISSING_CHAR",`Missing space after : in ${a}`):i(P.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let re=C?t(n,C,P,i):P.found?e(n,P.end,b,null,P,i):null;re?vo(C)&&i(re.range,"BLOCK_IN_FLOW",yo):P.comment&&(k.comment?k.comment+=`
71
+ `+P.comment:k.comment=P.comment);let z=new cm.Pair(k,re);if(n.options.keepSourceTokens&&(z.srcToken=w),s){let A=l;dm.mapIncludes(n,A.items,k)&&i(R,"DUPLICATE_KEY","Map keys must be unique"),A.items.push(z)}else{let A=new Rc.YAMLMap(n.schema);A.flow=!0,A.items.push(z);let ie=(re??k).range;A.range=[k.range[0],ie[1],ie[2]],l.items.push(A)}u=re?re.range[2]:P.end}}let d=s?"}":"]",[h,...g]=r.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),w=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;i(u,f?"MISSING_CHAR":"BAD_INDENT",w),h&&h.source.length!==1&&g.unshift(h)}if(g.length>0){let m=um.resolveEnd(g,p,n.options.strict,i);m.comment&&(l.comment?l.comment+=`
72
+ `+m.comment:l.comment=m.comment),l.range=[r.offset,p,m.offset]}else l.range=[r.offset,p,p];return l}Ac.resolveFlowCollection=pm});var jc=v(Tc=>{"use strict";var mm=x(),hm=I(),gm=Te(),wm=je(),ym=Ec(),vm=xc(),km=Nc();function ko(t,e,n,r,i,o){let s=n.type==="block-map"?ym.resolveBlockMap(t,e,n,r,o):n.type==="block-seq"?vm.resolveBlockSeq(t,e,n,r,o):km.resolveFlowCollection(t,e,n,r,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function bm(t,e,n,r,i){let o=r.tag,s=o?e.directives.tagName(o.source,d=>i(o,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=r,g=d&&o?d.offset>o.offset?d:o:d??o;g&&(!h||h.offset<g.offset)&&i(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===gm.YAMLMap.tagName&&a==="map"||s===wm.YAMLSeq.tagName&&a==="seq")return ko(t,e,n,i,s);let c=e.schema.tags.find(d=>d.tag===s&&d.collection===a);if(!c){let d=e.schema.knownTags[s];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?i(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),ko(t,e,n,i,s)}let l=ko(t,e,n,i,s,c),f=c.resolve?.(l,d=>i(o,"TAG_RESOLVE_FAILED",d),e.options)??l,u=mm.isNode(f)?f:new hm.Scalar(f);return u.range=l.range,u.tag=s,c?.format&&(u.format=c.format),u}Tc.composeCollection=bm});var So=v(Ic=>{"use strict";var bo=I();function Sm(t,e,n){let r=e.offset,i=Cm(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?bo.Scalar.BLOCK_FOLDED:bo.Scalar.BLOCK_LITERAL,s=e.source?Em(e.source):[],a=s.length;for(let p=s.length-1;p>=0;--p){let m=s[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=i.chomp==="+"&&s.length>0?`
73
73
  `.repeat(Math.max(1,s.length-1)):"",m=r+i.length;return e.source&&(m+=e.source.length),{value:p,type:o,comment:i.comment,range:[r,m,m]}}let c=e.indent+i.indent,l=e.offset+i.length,f=0;for(let p=0;p<a;++p){let[m,w]=s[p];if(w===""||w==="\r")i.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&n(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=m.length),f=p,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+w.length+1}for(let p=s.length-1;p>=a;--p)s[p][0].length>c&&(a=p+1);let u="",d="",h=!1;for(let p=0;p<f;++p)u+=s[p][0].slice(c)+`
74
- `;for(let p=f;p<a;++p){let[m,w]=s[p];l+=m.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&m.length<c){let b=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(l-w.length-(y?2:1),"BAD_INDENT",b),m=""}o===ko.Scalar.BLOCK_LITERAL?(u+=d+m.slice(c)+w,d=`
74
+ `;for(let p=f;p<a;++p){let[m,w]=s[p];l+=m.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&m.length<c){let b=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(l-w.length-(y?2:1),"BAD_INDENT",b),m=""}o===bo.Scalar.BLOCK_LITERAL?(u+=d+m.slice(c)+w,d=`
75
75
  `):m.length>c||w[0]===" "?(d===" "?d=`
76
76
  `:!h&&d===`
77
77
  `&&(d=`
@@ -84,46 +84,46 @@ ${l}
84
84
  `+s[p][0].slice(c);u[u.length-1]!==`
85
85
  `&&(u+=`
86
86
  `);break;default:u+=`
87
- `}let g=r+i.length+e.source.length;return{value:u,type:o,comment:i.comment,range:[r,g,g]}}function km({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let d=1;d<i.length;++d){let h=i[d];if(!a&&(h==="-"||h==="+"))a=h;else{let g=Number(h);!s&&g?s=g:c===-1&&(c=t+d)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,f="",u=i.length;for(let d=1;d<e.length;++d){let h=e[d];switch(h.type){case"space":l=!0;case"newline":u+=h.source.length;break;case"comment":n&&!l&&r(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,f=h.source.substring(1);break;case"error":r(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let g=`Unexpected token in block scalar header: ${h.type}`;r(h,"UNEXPECTED_TOKEN",g);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:o,indent:s,chomp:a,comment:f,length:u}}function bm(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),o=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}jc.resolveBlockScalar=vm});var Co=v($c=>{"use strict";var So=j(),Sm=mt();function Cm(t,e,n){let{offset:r,type:i,source:o,end:s}=t,a,c,l=(d,h,g)=>n(r+d,h,g);switch(i){case"scalar":a=So.Scalar.PLAIN,c=Em(o,l);break;case"single-quoted-scalar":a=So.Scalar.QUOTE_SINGLE,c=_m(o,l);break;case"double-quoted-scalar":a=So.Scalar.QUOTE_DOUBLE,c=xm(o,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let f=r+o.length,u=Sm.resolveEnd(s,f,e,n);return{value:c,type:a,comment:u.comment,range:[r,f,u.offset]}}function Em(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Ic(t)}function _m(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Ic(t.slice(1,-1)).replace(/''/g,"'")}function Ic(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
87
+ `}let g=r+i.length+e.source.length;return{value:u,type:o,comment:i.comment,range:[r,g,g]}}function Cm({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let d=1;d<i.length;++d){let h=i[d];if(!a&&(h==="-"||h==="+"))a=h;else{let g=Number(h);!s&&g?s=g:c===-1&&(c=t+d)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,f="",u=i.length;for(let d=1;d<e.length;++d){let h=e[d];switch(h.type){case"space":l=!0;case"newline":u+=h.source.length;break;case"comment":n&&!l&&r(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,f=h.source.substring(1);break;case"error":r(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let g=`Unexpected token in block scalar header: ${h.type}`;r(h,"UNEXPECTED_TOKEN",g);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:o,indent:s,chomp:a,comment:f,length:u}}function Em(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),o=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}Ic.resolveBlockScalar=Sm});var Eo=v(Lc=>{"use strict";var Co=I(),_m=ht();function xm(t,e,n){let{offset:r,type:i,source:o,end:s}=t,a,c,l=(d,h,g)=>n(r+d,h,g);switch(i){case"scalar":a=Co.Scalar.PLAIN,c=Pm(o,l);break;case"single-quoted-scalar":a=Co.Scalar.QUOTE_SINGLE,c=Rm(o,l);break;case"double-quoted-scalar":a=Co.Scalar.QUOTE_DOUBLE,c=Om(o,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let f=r+o.length,u=_m.resolveEnd(s,f,e,n);return{value:c,type:a,comment:u.comment,range:[r,f,u.offset]}}function Pm(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),$c(t)}function Rm(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),$c(t.slice(1,-1)).replace(/''/g,"'")}function $c(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
88
  `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
89
  `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let i=r[1],o=" ",s=e.lastIndex;for(n.lastIndex=s;r=n.exec(t);)r[1]===""?o===`
90
90
  `?i+=o:o=`
91
- `:(i+=o+r[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,r=a.exec(t),i+o+(r?.[1]??"")}function xm(t,e){let n="";for(let r=1;r<t.length-1;++r){let i=t[r];if(!(i==="\r"&&t[r+1]===`
91
+ `:(i+=o+r[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,r=a.exec(t),i+o+(r?.[1]??"")}function Om(t,e){let n="";for(let r=1;r<t.length-1;++r){let i=t[r];if(!(i==="\r"&&t[r+1]===`
92
92
  `))if(i===`
93
- `){let{fold:o,offset:s}=Pm(t,r);n+=o,r=s}else if(i==="\\"){let o=t[++r],s=Rm[o];if(s)n+=s;else if(o===`
93
+ `){let{fold:o,offset:s}=Am(t,r);n+=o,r=s}else if(i==="\\"){let o=t[++r],s=Nm[o];if(s)n+=s;else if(o===`
94
94
  `)for(o=t[r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="\r"&&t[r+1]===`
95
- `)for(o=t[++r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=Am(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i===" "){let o=r,s=t[r+1];for(;s===" "||s===" ";)s=t[++r+1];s!==`
95
+ `)for(o=t[++r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=Tm(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i===" "){let o=r,s=t[r+1];for(;s===" "||s===" ";)s=t[++r+1];s!==`
96
96
  `&&!(s==="\r"&&t[r+2]===`
97
- `)&&(n+=r>o?t.slice(o,r+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function Pm(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===`
97
+ `)&&(n+=r>o?t.slice(o,r+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function Am(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===`
98
98
  `||r==="\r")&&!(r==="\r"&&t[e+2]!==`
99
99
  `);)r===`
100
100
  `&&(n+=`
101
- `),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Rm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Am(t,e,n,r){let i=t.substr(e,n),s=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}$c.resolveFlowScalar=Cm});var Wc=v(Lc=>{"use strict";var Ze=x(),qc=j(),Om=bo(),Nm=Co();function Tm(t,e,n,r){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Om.resolveBlockScalar(t,e,r):Nm.resolveFlowScalar(e,t.options.strict,r),c=n?t.directives.tagName(n.source,u=>r(n,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Ze.SCALAR]:c?l=jm(t.schema,i,c,n,r):e.type==="scalar"?l=Im(t,i,e,r):l=t.schema[Ze.SCALAR];let f;try{let u=l.resolve(i,d=>r(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=Ze.isScalar(u)?u:new qc.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);r(n??e,"TAG_RESOLVE_FAILED",d),f=new qc.Scalar(i)}return f.range=a,f.source=i,o&&(f.type=o),c&&(f.tag=c),l.format&&(f.format=l.format),s&&(f.comment=s),f}function jm(t,e,n,r,i){if(n==="!")return t[Ze.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[n];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[Ze.SCALAR])}function Im({atKey:t,directives:e,schema:n},r,i,o){let s=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[Ze.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(r))??n[Ze.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),f=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",f,!0)}}return s}Lc.composeScalar=Tm});var Fc=v(Dc=>{"use strict";function $m(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}Dc.emptyScalarPosition=$m});var Kc=v(_o=>{"use strict";var qm=Nt(),Lm=x(),Wm=Tc(),Mc=Wc(),Dm=mt(),Fm=Fc(),Mm={composeNode:Bc,composeEmptyNode:Eo};function Bc(t,e,n,r){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=n,l,f=!0;switch(e.type){case"alias":l=Bm(t,e,r),(a||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Mc.composeScalar(t,e,c,r),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Wm.composeCollection(Mm,t,e,n,r),a&&(l.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);r(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",u),f=!1}}return l??(l=Eo(t,e.offset,void 0,null,n,r)),a&&l.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Lm.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&f&&(l.srcToken=e),l}function Eo(t,e,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let f={type:"scalar",offset:Fm.emptyScalarPosition(e,n,r),indent:-1,source:""},u=Mc.composeScalar(t,f,a,l);return s&&(u.anchor=s.source.substring(1),u.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=c),u}function Bm({options:t},{offset:e,source:n,end:r},i){let o=new qm.Alias(n.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+n.length,a=Dm.resolveEnd(r,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}_o.composeEmptyNode=Eo;_o.composeNode=Bc});var Hc=v(Yc=>{"use strict";var Km=Jt(),Uc=Kc(),Um=mt(),Ym=Qt();function Hm(t,e,{offset:n,start:r,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Km.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=Ym.resolveProps(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!f.hasNewline&&s(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?Uc.composeNode(l,i,f,s):Uc.composeEmptyNode(l,f.end,r,null,f,s);let u=c.contents.range[2],d=Um.resolveEnd(o,u,!1,s);return d.comment&&(c.comment=d.comment),c.range=[n,u,d.offset],c}Yc.composeDoc=Hm});var Po=v(Vc=>{"use strict";var Jm=Cn("process"),Gm=fi(),Vm=Jt(),Xt=zt(),Jc=x(),zm=Hc(),Qm=mt();function Zt(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function Gc(t){let e="",n=!1,r=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":r?`
101
+ `),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Nm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Tm(t,e,n,r){let i=t.substr(e,n),s=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Lc.resolveFlowScalar=xm});var Dc=v(Wc=>{"use strict";var Ze=x(),qc=I(),jm=So(),Im=Eo();function $m(t,e,n,r){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?jm.resolveBlockScalar(t,e,r):Im.resolveFlowScalar(e,t.options.strict,r),c=n?t.directives.tagName(n.source,u=>r(n,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Ze.SCALAR]:c?l=Lm(t.schema,i,c,n,r):e.type==="scalar"?l=qm(t,i,e,r):l=t.schema[Ze.SCALAR];let f;try{let u=l.resolve(i,d=>r(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=Ze.isScalar(u)?u:new qc.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);r(n??e,"TAG_RESOLVE_FAILED",d),f=new qc.Scalar(i)}return f.range=a,f.source=i,o&&(f.type=o),c&&(f.tag=c),l.format&&(f.format=l.format),s&&(f.comment=s),f}function Lm(t,e,n,r,i){if(n==="!")return t[Ze.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[n];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[Ze.SCALAR])}function qm({atKey:t,directives:e,schema:n},r,i,o){let s=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[Ze.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(r))??n[Ze.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),f=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",f,!0)}}return s}Wc.composeScalar=$m});var Mc=v(Fc=>{"use strict";function Wm(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}Fc.emptyScalarPosition=Wm});var Uc=v(xo=>{"use strict";var Dm=Nt(),Fm=x(),Mm=jc(),Bc=Dc(),Bm=ht(),Km=Mc(),Um={composeNode:Kc,composeEmptyNode:_o};function Kc(t,e,n,r){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=n,l,f=!0;switch(e.type){case"alias":l=Hm(t,e,r),(a||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Bc.composeScalar(t,e,c,r),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Mm.composeCollection(Um,t,e,n,r),a&&(l.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);r(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",u),f=!1}}return l??(l=_o(t,e.offset,void 0,null,n,r)),a&&l.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Fm.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&f&&(l.srcToken=e),l}function _o(t,e,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let f={type:"scalar",offset:Km.emptyScalarPosition(e,n,r),indent:-1,source:""},u=Bc.composeScalar(t,f,a,l);return s&&(u.anchor=s.source.substring(1),u.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=c),u}function Hm({options:t},{offset:e,source:n,end:r},i){let o=new Dm.Alias(n.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+n.length,a=Bm.resolveEnd(r,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}xo.composeEmptyNode=_o;xo.composeNode=Kc});var Gc=v(Yc=>{"use strict";var Ym=Gt(),Hc=Uc(),Gm=ht(),Jm=Qt();function Vm(t,e,{offset:n,start:r,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Ym.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=Jm.resolveProps(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!f.hasNewline&&s(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?Hc.composeNode(l,i,f,s):Hc.composeEmptyNode(l,f.end,r,null,f,s);let u=c.contents.range[2],d=Gm.resolveEnd(o,u,!1,s);return d.comment&&(c.comment=d.comment),c.range=[n,u,d.offset],c}Yc.composeDoc=Vm});var Ro=v(zc=>{"use strict";var zm=Cn("process"),Qm=di(),Xm=Gt(),Xt=zt(),Jc=x(),Zm=Gc(),eh=ht();function Zt(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function Vc(t){let e="",n=!1,r=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":r?`
103
103
 
104
104
  `:`
105
- `)+(o.substring(1)||" "),n=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var xo=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,o)=>{let s=Zt(n);o?this.warnings.push(new Xt.YAMLWarning(s,r,i)):this.errors.push(new Xt.YAMLParseError(s,r,i))},this.directives=new Gm.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:i}=Gc(this.prelude);if(r){let o=e.contents;if(n)e.comment=e.comment?`${e.comment}
105
+ `)+(o.substring(1)||" "),n=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var Po=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,o)=>{let s=Zt(n);o?this.warnings.push(new Xt.YAMLWarning(s,r,i)):this.errors.push(new Xt.YAMLParseError(s,r,i))},this.directives=new Qm.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:i}=Vc(this.prelude);if(r){let o=e.contents;if(n)e.comment=e.comment?`${e.comment}
106
106
  ${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(Jc.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];Jc.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${r}
107
107
  ${a}`:r}else{let s=o.commentBefore;o.commentBefore=s?`${r}
108
- ${s}`:r}}if(n){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Gc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(n,r)}*next(e){switch(Jm.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,r,i)=>{let o=Zt(e);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=zm.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new Xt.YAMLParseError(Zt(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Xt.YAMLParseError(Zt(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=Qm.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
109
- ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Xt.YAMLParseError(Zt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),i=new Vm.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};Vc.Composer=xo});var Xc=v(mr=>{"use strict";var Xm=bo(),Zm=Co(),eh=zt(),zc=qt();function th(t,e=!0,n){if(t){let r=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,o,s);else throw new eh.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Zm.resolveFlowScalar(t,e,r);case"block-scalar":return Xm.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function nh(t,e){let{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=zc.stringifyString({type:s,value:t},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
108
+ ${s}`:r}}if(n){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Vc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(n,r)}*next(e){switch(zm.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,r,i)=>{let o=Zt(e);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Zm.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new Xt.YAMLParseError(Zt(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Xt.YAMLParseError(Zt(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=eh.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
109
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Xt.YAMLParseError(Zt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),i=new Xm.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};zc.Composer=Po});var Zc=v(mr=>{"use strict";var th=So(),nh=Eo(),rh=zt(),Qc=Lt();function ih(t,e=!0,n){if(t){let r=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,o,s);else throw new rh.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return nh.resolveFlowScalar(t,e,r);case"block-scalar":return th.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function oh(t,e){let{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=Qc.stringifyString({type:s,value:t},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
110
110
  `}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
111
111
  `),f=a.substring(0,l),u=a.substring(l+1)+`
112
- `,d=[{type:"block-scalar-header",offset:o,indent:r,source:f}];return Qc(d,c)||d.push({type:"newline",offset:-1,indent:r,source:`
113
- `}),{type:"block-scalar",offset:o,indent:r,props:d,source:u}}case'"':return{type:"double-quoted-scalar",offset:o,indent:r,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:r,source:a,end:c};default:return{type:"scalar",offset:o,indent:r,source:a,end:c}}}function rh(t,e,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=n,a="indent"in t?t.indent:null;if(r&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=zc.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":ih(t,c);break;case'"':Ro(t,c,"double-quoted-scalar");break;case"'":Ro(t,c,"single-quoted-scalar");break;default:Ro(t,c,"scalar")}}function ih(t,e){let n=e.indexOf(`
112
+ `,d=[{type:"block-scalar-header",offset:o,indent:r,source:f}];return Xc(d,c)||d.push({type:"newline",offset:-1,indent:r,source:`
113
+ `}),{type:"block-scalar",offset:o,indent:r,props:d,source:u}}case'"':return{type:"double-quoted-scalar",offset:o,indent:r,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:r,source:a,end:c};default:return{type:"scalar",offset:o,indent:r,source:a,end:c}}}function sh(t,e,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=n,a="indent"in t?t.indent:null;if(r&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=Qc.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":ah(t,c);break;case'"':Oo(t,c,"double-quoted-scalar");break;case"'":Oo(t,c,"single-quoted-scalar");break;default:Oo(t,c,"scalar")}}function ah(t,e){let n=e.indexOf(`
114
114
  `),r=e.substring(0,n),i=e.substring(n+1)+`
115
- `;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=r,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:r}];Qc(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
116
- `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function Qc(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function Ro(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let r=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of r)o.offset+=i;delete t.props,Object.assign(t,{type:n,source:e,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
- `};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let r="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:n,indent:r,source:e,end:i})}}}mr.createScalarToken=nh;mr.resolveAsScalar=th;mr.setScalarValue=rh});var el=v(Zc=>{"use strict";var oh=t=>"type"in t?gr(t):hr(t);function gr(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=gr(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=hr(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=hr(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=hr(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function hr({start:t,key:e,sep:n,value:r}){let i="";for(let o of t)i+=o.source;if(e&&(i+=gr(e)),n)for(let o of n)i+=o.source;return r&&(i+=gr(r)),i}Zc.stringify=oh});var il=v(rl=>{"use strict";var Ao=Symbol("break visit"),sh=Symbol("skip children"),tl=Symbol("remove item");function et(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),nl(Object.freeze([]),t,e)}et.BREAK=Ao;et.SKIP=sh;et.REMOVE=tl;et.itemAtPath=(t,e)=>{let n=t;for(let[r,i]of e){let o=n?.[r];if(o&&"items"in o)n=o.items[i];else return}return n};et.parentCollection=(t,e)=>{let n=et.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function nl(t,e,n){let r=n(e,t);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=nl(Object.freeze(t.concat([[i,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===Ao)return Ao;a===tl&&(o.items.splice(s,1),s-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}rl.visit=et});var wr=v(J=>{"use strict";var Oo=Xc(),ah=el(),ch=il(),No="\uFEFF",To="",jo="",Io="",lh=t=>!!t&&"items"in t,uh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function fh(t){switch(t){case No:return"<BOM>";case To:return"<DOC>";case jo:return"<FLOW_END>";case Io:return"<SCALAR>";default:return JSON.stringify(t)}}function dh(t){switch(t){case No:return"byte-order-mark";case To:return"doc-mode";case jo:return"flow-error-end";case Io:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
115
+ `;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=r,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:r}];Xc(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
116
+ `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function Xc(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function Oo(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let r=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of r)o.offset+=i;delete t.props,Object.assign(t,{type:n,source:e,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
+ `};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let r="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:n,indent:r,source:e,end:i})}}}mr.createScalarToken=oh;mr.resolveAsScalar=ih;mr.setScalarValue=sh});var tl=v(el=>{"use strict";var ch=t=>"type"in t?gr(t):hr(t);function gr(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=gr(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=hr(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=hr(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=hr(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function hr({start:t,key:e,sep:n,value:r}){let i="";for(let o of t)i+=o.source;if(e&&(i+=gr(e)),n)for(let o of n)i+=o.source;return r&&(i+=gr(r)),i}el.stringify=ch});var ol=v(il=>{"use strict";var Ao=Symbol("break visit"),lh=Symbol("skip children"),nl=Symbol("remove item");function et(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),rl(Object.freeze([]),t,e)}et.BREAK=Ao;et.SKIP=lh;et.REMOVE=nl;et.itemAtPath=(t,e)=>{let n=t;for(let[r,i]of e){let o=n?.[r];if(o&&"items"in o)n=o.items[i];else return}return n};et.parentCollection=(t,e)=>{let n=et.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function rl(t,e,n){let r=n(e,t);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=rl(Object.freeze(t.concat([[i,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===Ao)return Ao;a===nl&&(o.items.splice(s,1),s-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}il.visit=et});var wr=v(G=>{"use strict";var No=Zc(),uh=tl(),fh=ol(),To="\uFEFF",jo="",Io="",$o="",dh=t=>!!t&&"items"in t,ph=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function mh(t){switch(t){case To:return"<BOM>";case jo:return"<DOC>";case Io:return"<FLOW_END>";case $o:return"<SCALAR>";default:return JSON.stringify(t)}}function hh(t){switch(t){case To:return"byte-order-mark";case jo:return"doc-mode";case Io:return"flow-error-end";case $o:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
118
118
  `:case`\r
119
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}J.createScalarToken=Oo.createScalarToken;J.resolveAsScalar=Oo.resolveAsScalar;J.setScalarValue=Oo.setScalarValue;J.stringify=ah.stringify;J.visit=ch.visit;J.BOM=No;J.DOCUMENT=To;J.FLOW_END=jo;J.SCALAR=Io;J.isCollection=lh;J.isScalar=uh;J.prettyToken=fh;J.tokenType=dh});var Lo=v(sl=>{"use strict";var en=wr();function se(t){switch(t){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var ol=new Set("0123456789ABCDEFabcdef"),ph=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),yr=new Set(",[]{}"),mh=new Set(` ,[]{}
121
- \r `),$o=t=>!t||mh.has(t),qo=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
119
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}G.createScalarToken=No.createScalarToken;G.resolveAsScalar=No.resolveAsScalar;G.setScalarValue=No.setScalarValue;G.stringify=uh.stringify;G.visit=fh.visit;G.BOM=To;G.DOCUMENT=jo;G.FLOW_END=Io;G.SCALAR=$o;G.isCollection=dh;G.isScalar=ph;G.prettyToken=mh;G.tokenType=hh});var Wo=v(al=>{"use strict";var en=wr();function se(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var sl=new Set("0123456789ABCDEFabcdef"),gh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),yr=new Set(",[]{}"),wh=new Set(` ,[]{}
121
+ \r `),Lo=t=>!t||wh.has(t),qo=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
122
122
  `?!0:n==="\r"?this.buffer[e+1]===`
123
123
  `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){let i=this.buffer[r+e+1];if(i===`
124
124
  `||!i&&!this.atEnd)return e+r+1}return n===`
125
125
  `||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&se(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
126
- `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===en.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield en.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&se(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!se(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&se(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil($o),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&se(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield en.FLOW_END,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil($o),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||se(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
126
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===en.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield en.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&se(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!se(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&se(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Lo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&se(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield en.FLOW_END,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Lo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||se(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
127
127
  `,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=r.indexOf(`
128
128
  `,o)}i!==-1&&(n=i-(r[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>se(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":n+=1;break;case`
129
129
  `:e=o,n=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
@@ -133,34 +133,34 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
133
133
  `&&o>=this.pos&&o+1+n>a)e=o;else break}while(!0);return yield en.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(se(o)||e&&yr.has(o))break;n=r}else if(se(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
134
134
  `?(r+=1,i=`
135
135
  `,o=this.buffer[r+1]):n=r),o==="#"||e&&yr.has(o))break;if(i===`
136
- `){let s=this.continueScalar(r+1);if(s===-1)break;r=Math.max(r,s-2)}}else{if(e&&yr.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield en.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil($o),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(se(r)||n&&yr.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!se(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(ph.has(n))n=this.buffer[++e];else if(n==="%"&&ol.has(this.buffer[e+1])&&ol.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
136
+ `){let s=this.continueScalar(r+1);if(s===-1)break;r=Math.max(r,s-2)}}else{if(e&&yr.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield en.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Lo),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(se(r)||n&&yr.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!se(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(gh.has(n))n=this.buffer[++e];else if(n==="%"&&sl.has(this.buffer[e+1])&&sl.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
137
137
  `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
138
- `?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};sl.Lexer=qo});var Do=v(al=>{"use strict";var Wo=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let o=n+r>>1;this.lineStarts[o]<e?n=o+1:r=o}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}};al.LineCounter=Wo});var Mo=v(dl=>{"use strict";var hh=Cn("process"),cl=wr(),gh=Lo();function je(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function ll(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function fl(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function vr(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function ht(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function kr(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function ul(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!je(e.start,"explicit-key-ind")&&!je(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,fl(e.value)?e.value.end?kr(e.value.end,e.sep):e.value.end=e.sep:kr(e.start,e.sep),delete e.sep)}var Fo=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new gh.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,hh.env.LOG_TOKENS&&console.log("|",cl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=cl.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&ul(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&ll(i.start)===-1&&(n.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{ll(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=vr(this.peek(2)),r=ht(n),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
138
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};al.Lexer=qo});var Fo=v(cl=>{"use strict";var Do=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let o=n+r>>1;this.lineStarts[o]<e?n=o+1:r=o}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}};cl.LineCounter=Do});var Bo=v(pl=>{"use strict";var yh=Cn("process"),ll=wr(),vh=Wo();function Ie(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function ul(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function dl(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function vr(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function gt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function kr(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function fl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ie(e.start,"explicit-key-ind")&&!Ie(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,dl(e.value)?e.value.end?kr(e.value.end,e.sep):e.value.end=e.sep:kr(e.start,e.sep),delete e.sep)}var Mo=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new vh.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,yh.env.LOG_TOKENS&&console.log("|",ll.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=ll.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&fl(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&ul(i.start)===-1&&(n.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{ul(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=vr(this.peek(2)),r=gt(n),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
139
139
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
140
- `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){kr(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&n.sep&&!n.value){let s=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":s.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=n.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(je(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(fl(n.key)&&!je(n.sep,"newline")){let s=ht(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(je(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=ht(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):je(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||n.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(s):(Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!n.explicitKey&&n.sep&&!je(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){kr(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||je(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=vr(r),o=ht(i);ul(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
140
+ `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){kr(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&n.sep&&!n.value){let s=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":s.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=n.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ie(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(dl(n.key)&&!Ie(n.sep,"newline")){let s=gt(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(Ie(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=gt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Ie(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||n.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(s):(Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Ie(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){kr(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||Ie(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=vr(r),o=gt(i);fl(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
141
141
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
142
- `,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=vr(e),r=ht(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=vr(e),r=ht(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};dl.Parser=Fo});var wl=v(nn=>{"use strict";var pl=Po(),wh=Jt(),tn=zt(),yh=Ei(),vh=x(),kh=Do(),ml=Mo();function hl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new kh.LineCounter||null,prettyErrors:e}}function bh(t,e={}){let{lineCounter:n,prettyErrors:r}=hl(e),i=new ml.Parser(n?.addNewLine),o=new pl.Composer(e),s=Array.from(o.compose(i.parse(t)));if(r&&n)for(let a of s)a.errors.forEach(tn.prettifyError(t,n)),a.warnings.forEach(tn.prettifyError(t,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function gl(t,e={}){let{lineCounter:n,prettyErrors:r}=hl(e),i=new ml.Parser(n?.addNewLine),o=new pl.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new tn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach(tn.prettifyError(t,n)),s.warnings.forEach(tn.prettifyError(t,n))),s}function Sh(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=gl(t,n);if(!i)return null;if(i.warnings.forEach(o=>yh.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function Ch(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return vh.isDocument(t)&&!r?t.toString(n):new wh.Document(t,r,n).toString(n)}nn.parse=Sh;nn.parseAllDocuments=bh;nn.parseDocument=gl;nn.stringify=Ch});var $e=v(A=>{"use strict";var Eh=Po(),_h=Jt(),xh=so(),Bo=zt(),Ph=Nt(),Ie=x(),Rh=Ae(),Ah=j(),Oh=Ne(),Nh=Te(),Th=wr(),jh=Lo(),Ih=Do(),$h=Mo(),br=wl(),yl=Pt();A.Composer=Eh.Composer;A.Document=_h.Document;A.Schema=xh.Schema;A.YAMLError=Bo.YAMLError;A.YAMLParseError=Bo.YAMLParseError;A.YAMLWarning=Bo.YAMLWarning;A.Alias=Ph.Alias;A.isAlias=Ie.isAlias;A.isCollection=Ie.isCollection;A.isDocument=Ie.isDocument;A.isMap=Ie.isMap;A.isNode=Ie.isNode;A.isPair=Ie.isPair;A.isScalar=Ie.isScalar;A.isSeq=Ie.isSeq;A.Pair=Rh.Pair;A.Scalar=Ah.Scalar;A.YAMLMap=Oh.YAMLMap;A.YAMLSeq=Nh.YAMLSeq;A.CST=Th;A.Lexer=jh.Lexer;A.LineCounter=Ih.LineCounter;A.Parser=$h.Parser;A.parse=br.parse;A.parseAllDocuments=br.parseAllDocuments;A.parseDocument=br.parseDocument;A.stringify=br.stringify;A.visit=yl.visit;A.visitAsync=yl.visitAsync});import qe from"path";function Bh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||qe.posix.isAbsolute(n)||qe.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let r=n.replaceAll("\\","/").split("/");if(r.some(i=>i===".."))throw new Error(`${e} must stay inside the project root`);if(r.some(i=>i===""||i==="."))throw new Error(`${e} must not contain empty or dot path segments`);return r}function Sr(t){let e=Bh(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Cl(t,e="docs"){let n=t??e;if(n!=="legacy"&&n!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return n}function ve(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||qe.posix.isAbsolute(r)||qe.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let i=r.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}function ye(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function El(t,e,n){let r=t??e;if(r!=="en"&&r!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return r}function _l(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>Yo)throw new Error(`${e} exceeds ${Yo} characters`);let n=0;for(let r=0;r<t.length;r+=1)t[r]==="?"?n+=1:t[r]==="*"&&(n+=1,t[r+1]==="*"&&(r+=1));if(n>Ho)throw new Error(`${e} contains more than ${Ho} wildcard tokens`);return t}function Sl(t,e,n){if(t===void 0)return[...n];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(r=>_l(r,e)))].sort((r,i)=>r.localeCompare(i,"en"))}function Uo(t,e,n){let r=t??e;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${n} must be a positive integer`);return r}function Kh(t){if(t===void 0)return{...we,include:[...we.include],exclude:[...we.exclude]};let e=ye(t,"native.snapshot");return{include:Sl(e.include,"native.snapshot.include",we.include),exclude:Sl(e.exclude,"native.snapshot.exclude",we.exclude),max_files:Uo(e.max_files,we.max_files,"native.snapshot.max_files"),max_total_bytes:Uo(e.max_total_bytes,we.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Uo(e.max_duration_ms,we.max_duration_ms,"native.snapshot.max_duration_ms")}}function Uh(t){if(t===void 0)return;let e=ye(t,"native.pending_root_move"),n=e.id,r=e.from_artifact_root,i=e.to_artifact_root,o=e.stage;if(typeof n!="string"||!/^[a-f0-9-]{8,}$/u.test(n))throw new Error("native.pending_root_move.id is invalid");if(typeof r!="string"||typeof i!="string")throw new Error("native.pending_root_move roots must be strings");if(o!=="copying"&&o!=="ready"&&o!=="switched")throw new Error("native.pending_root_move.stage is invalid");let s;if(e.cleanup!==void 0){let a=ye(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,f=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof f!="string"||!/^[a-f0-9]{64}$/u.test(f))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");s={kind:c,state:l,manifestHash:f}}return{id:n,fromArtifactRoot:Sr(r),toArtifactRoot:Sr(i),stage:o,...s?{cleanup:s}:{}}}function Yh(t){if(t===void 0)return;let e=ye(t,"native.finish");if(e.pull_request===void 0)return{};let n=ye(e.pull_request,"native.finish.pull_request");if(n.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(n.command)||n.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(n.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let r=n.command.map((o,s)=>{if(typeof o!="string"||o.trim().length===0||o.length>4096||/[\0\r\n]/u.test(o))throw new Error(`native.finish.pull_request.command[${s}] must be a non-empty single-line string of at most 4096 characters`);return o});if(qe.posix.isAbsolute(r[0])||qe.win32.isAbsolute(r[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let i=n.timeout_ms??Wh;if(!Number.isSafeInteger(i)||i<1||i>bl)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${bl}`);return{pull_request:{provider:"repository-command",command:r,timeout_ms:i}}}function Hh(t,e={}){let n=ye(t,"native"),r=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let i=n.clarification_mode??"batch";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=n.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let s=n.max_verify_failures??qh;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=Uh(n.pending_root_move),c=Yh(n.finish);return{artifact_root:Sr(r),language:El(n.language,"en","native.language"),clarification_mode:i,archive_confirmation:o,max_verify_failures:s,snapshot:Kh(n.snapshot),...c?{finish:c}:{},...a?{pending_root_move:a}:{}}}function Jh(t){let e=ye(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let r=e.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let i=e.auto_transition??!0;if(typeof i!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Cl(e.artifact_layout),language:El(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:r,auto_transition:i}}function Gh(t){let n=ye(t,"hook").allow_paths??[];if(!Array.isArray(n))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(n.map((r,i)=>ve(r,`hook.allow_paths[${i}]`)))]}}function Vh(t){if(t===void 0)return{...Ko};let e=ye(t,"memory"),n=e.learning??Ko.learning,r=e.retrieval??Ko.retrieval;if(typeof n!="boolean")throw new Error("memory.learning must be true or false");if(typeof r!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:n,retrieval:r}}function Go(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function zh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||n.includes("\\")||n.includes("\0")||qe.posix.isAbsolute(n)||qe.win32.isAbsolute(n)||n.startsWith("~")||n.split("/").some(i=>i===""||i==="."||i===".."))throw new Error(`${e} must be a safe project-relative glob`);if(!n.toLowerCase().endsWith(".md"))throw new Error(`${e} must target a Markdown file ending in .md`);if(n.length>vl)throw new Error(`${e} exceeds ${vl} characters`);let r=0;for(let i=0;i<n.length;i+=1)n[i]==="?"?r+=1:n[i]==="*"&&(r+=1,n[i+1]==="*"&&(i+=1));if(r>kl)throw new Error(`${e} contains more than ${kl} wildcard tokens`);return n}function Qh(t){let n=Go(t,"knowledge.local").include??[];if(!Array.isArray(n))throw new Error("knowledge.local.include must be an array");return{include:[...new Set(n.map((r,i)=>zh(r,`knowledge.local.include[${i}]`)))]}}function Xh(t){if(typeof t!="string"||t.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let e;try{e=new URL(t)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let n=e.hostname.toLowerCase().replace(/^\[|\]$/gu,""),r=n==="localhost"||n==="127.0.0.1"||n==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&r))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function Zh(t){let e=Go(t,"knowledge.remote"),n=Xh(e.endpoint),r=e.token_env;if(r!==void 0&&(typeof r!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(r)))throw new Error("knowledge.remote.token_env must be an environment variable name");let i=e.scope;if(i!==void 0&&(typeof i!="string"||i.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let o=e.timeout_ms??5e3;if(typeof o!="number"||!Number.isSafeInteger(o)||o<100||o>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:n,...r===void 0?{}:{token_env:r},...i===void 0?{}:{scope:i},timeout_ms:o}}function eg(t){if(t===void 0)return{...Lh};let e=Go(t,"knowledge"),n=e.provider??"local";if(n!=="local"&&n!=="remote")throw new Error("knowledge.provider must be local or remote");let r=e.local===void 0?void 0:Qh(e.local);if(n==="local")return{provider:n,...r?{local:r}:{}};let i=e.remote===void 0?void 0:Zh(e.remote);if(i===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:n,...r?{local:r}:{},remote:i}}function tg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function ng(t,e,n,r,i,o,s,a){let c=t.schema!==void 0;if(!(c||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!c)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let f=t.workflows??[t.default_workflow];if(!Array.isArray(f)||f.length===0||f.some(d=>d!=="native"&&d!=="classic"))throw new Error("workflows must contain native and/or classic");let u=[...new Set(f)];if(!u.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(u.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:u,ambient_resume:s,...e?{hook:e}:{},memory:n,knowledge:r,...i?{native:i}:{},...o?{classic:o}:{}}}function gt(t,e={}){let n=(0,Jo.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let r=n.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let i=r,o=tg(i.ambient_resume),s=i.hook===void 0?void 0:Gh(i.hook),a=Vh(i.memory),c=eg(i.knowledge),l=i.native===void 0?void 0:Hh(i.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),f=i.classic===void 0?void 0:Jh(i.classic),u=ng(i,s,a,c,l,f,o,{allowPartialProject:e.allowPartialProject??!1});return{value:i,config:u,ambient_resume:o,memory:a,knowledge:c,...s?{hook:s}:{},...l?{native:l}:{},...f?{classic:f}:{}}}var Jo,rn,Yo,Ho,vl,kl,qh,Ko,Lh,Wh,bl,Dh,Fh,Mh,we,ke=L(()=>{"use strict";Jo=Ge($e(),1),rn=64*1024,Yo=1024,Ho=64,vl=1024,kl=64,qh=5,Ko={learning:!0,retrieval:!0},Lh={provider:"local"},Wh=12e4,bl=6e5,Dh=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Fh=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],Mh=[...Dh,...Fh].sort((t,e)=>t.localeCompare(e,"en")),we={include:["**/*"],exclude:[...Mh],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});function Le(t){return t!==0&&t!==0n&&t!=="0"}function xl(t,e){return Le(t.dev)&&Le(e.dev)&&Le(t.ino)&&Le(e.ino)}function We(t,e){let n=Le(t.dev)&&Le(e.dev);if(n&&t.dev!==e.dev)return!1;let r=Le(t.ino)&&Le(e.ino);return r&&t.ino!==e.ino?!1:n&&r?!0:t.birthtime===e.birthtime}var Cr=L(()=>{"use strict"});import{constants as Er,promises as tt}from"fs";function Vo(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Pl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function on(t){return{dev:t.dev,ino:t.ino,birthtime:Vo(t)}}function _r(t,e){let n=on(t),r=on(e);return xl(n,r)?We(n,r):We(n,r)&&Vo(t)===Vo(e)&&Pl(t)===Pl(e)&&t.size===e.size}async function xr(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=n.label??"file",i=n.bigint===!0,o=await tt.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new De("not-regular-file",`${r} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new De("too-large",`${r} exceeds ${e} bytes`);let s=await tt.realpath(t);await n.verify?.("pre-open",{realPath:s,identity:on(o)});let a=process.platform==="win32"?Er.O_RDONLY:Er.O_RDONLY|Er.O_NOFOLLOW|Er.O_NONBLOCK,c;try{c=await tt.open(t,a)}catch(l){throw l.code==="ELOOP"?new De("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,f,u]=await Promise.all([c.stat({bigint:i}),tt.lstat(t,{bigint:i}),tt.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==s||!_r(o,l)||!_r(o,f))throw new De("changed",`${r} changed while opening`);await n.verify?.("post-open",{realPath:u,identity:on(l)}),await n.hooks?.afterOpen?.();let d=[],h=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-h,{bytesRead:S}=await c.read(g,0,Math.min(g.length,y),null);if(S===0)break;if(h+=S,h>e)throw new De("too-large",`${r} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,S)))}await n.hooks?.beforeFinalCheck?.();let[p,m,w]=await Promise.all([c.stat({bigint:i}),tt.lstat(t,{bigint:i}),tt.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||w!==s||!_r(o,p)||!_r(o,m))throw new De("changed",`${r} changed while reading`);return await n.verify?.("post-read",{realPath:w,identity:on(p)}),{bytes:Buffer.concat(d,h),stat:p,realPath:w}}finally{await c.close()}}var De,zo=L(()=>{"use strict";Cr();De=class extends Error{reason;constructor(e,n,r){super(n,r),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Fe}from"fs";import ae from"path";function Rl(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Pr(t,e){let n=ae.relative(t,e);return n===""||!ae.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${ae.sep}`)}async function Qo(t,e){let n=ae.resolve(t),r=await Fe.lstat(n);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Fe.realpath(n)}async function Xo(t,e,n,r){let i=t;for(let o=0;o<n.length;o++){i=ae.join(i,n[o]);let s;try{s=await Fe.lstat(i)}catch(f){if(Rl(f))return{exists:!1,kind:"missing"};throw f}let a=ae.relative(t,i).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${a}`);let c=o===n.length-1;if(!c&&!s.isDirectory())throw new Error(`${r.label} ancestor ${a} must be a real directory`);if(c&&(r.expected==="file"&&!s.isFile()||r.expected==="directory"&&!s.isDirectory()||r.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await Fe.realpath(i);if(!Pr(e,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function N(t,e,n){let r=ve(e,n.label),i=ae.resolve(t),o=await Qo(i,n.label),s=r.split("/"),a=ae.resolve(i,...s);if(!Pr(i,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Xo(i,o,s,n);return{projectRoot:i,target:a,relative:r,exists:c.exists,kind:c.kind}}async function Zo(t,e,n){let r=ve(e,n.label),i=ae.resolve(t),o=await Qo(i,n.label),s=r.split("/"),a=i;for(let c of s){a=ae.join(a,c);let l;try{l=await Fe.lstat(a)}catch(d){if(!Rl(d))throw d;try{await Fe.mkdir(a)}catch(h){if(h.code!=="EEXIST")throw h}l=await Fe.lstat(a)}let f=ae.relative(i,a).replaceAll("\\","/");if(l.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${f}`);if(!l.isDirectory())throw new Error(`${n.label} directory ${f} must be a real directory`);let u=await Fe.realpath(a);if(!Pr(o,u))throw new Error(`${n.label} resolves outside the project root`)}return await Xo(i,o,s,{label:n.label,expected:"directory"}),a}async function Rr(t,e,n){return(await N(t,e,{...n,expected:"file"})).exists}async function D(t,e,n,r){let i=await N(t,e,{label:r.label,expected:"file"});if(!i.exists){let s=new Error(`${r.label} does not exist`);throw s.code="ENOENT",s}let o=await Qo(i.projectRoot,r.label);return xr(i.target,n,{...r,verify:async(s,a)=>{if(!Pr(o,a.realPath))throw new Error(`${r.label} resolves outside the project root`);await Xo(i.projectRoot,o,i.relative.split("/"),{label:r.label,expected:"file"})}})}var Q=L(()=>{"use strict";zo();ke()});import{createHash as rg}from"crypto";function ig(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function an(t,e={}){return(await Ar(t,e)).document}async function og(t){try{return(await D(t,sn,rn,{label:sn})).bytes}catch(e){if(ig(e))return null;throw e}}function sg(t){return t?{exists:!0,sha256:rg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Ar(t,e={}){let n=await og(t);return{document:n?gt(n.toString("utf8"),e):null,identity:sg(n)}}async function es(t){return(await an(t))?.config??null}var sn,wt=L(()=>{"use strict";ke();Q();sn=".comet/config.yaml"});import{randomUUID as ag}from"crypto";import{constants as cg,promises as I}from"fs";import B from"path";async function ns(t,e){try{return await I.link(t,e),{linked:!0}}catch(n){let r=n.code;if(r!=="ENOTSUP"&&r!=="EOPNOTSUPP")throw n}return await I.copyFile(t,e,cg.COPYFILE_EXCL),{linked:!1}}function yt(t,e){let n=B.relative(t,e);return n===""||!B.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${B.sep}`)}function Or(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function lg(t,e){return We(t,Or(e))}function ts(t,e){return We(Or(t),Or(e))}function Al(t,e){return ts(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Nr(t){let e=await I.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await I.realpath(t),...Or(e)}}async function Me(t){for(let e of t){let n=await I.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!lg(e,n)||await I.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function ug(t,e){let n=B.resolve(t),r=B.resolve(e);if(!yt(n,r))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let i=[await Nr(n)],o=B.relative(n,r).split(B.sep).filter(Boolean),s=n;for(let a of o){await Me(i),s=B.join(s,a);try{await I.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Nr(s);if(!yt(i[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);i.push(c)}return await Me(i),i}async function fg(t,e){let n=B.resolve(t),r=B.resolve(e);if(!yt(n,r))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await Nr(n)],o=B.relative(n,r).split(B.sep).filter(Boolean),s=n;for(let a of o){s=B.join(s,a);try{let c=await Nr(s);if(!yt(i[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await Me(i),i}async function Ol(t){let e;try{e=await I.open(t,"r"),await e.sync()}catch(n){let r=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw n}finally{await e?.close()}}async function dg(t,e,n){let r=B.dirname(t),i=await ug(n.containedRoot,r),o=B.join(r,`.${B.basename(t)}.${ag()}.tmp`),s,a,c;try{await n.beforeTemporaryOpen?.(),s=await I.open(o,"wx"),a=await s.stat();let[l,f]=await Promise.all([I.lstat(o),I.realpath(o)]);if(await Me(i),!l.isFile()||l.isSymbolicLink()||!ts(a,l)||!yt(i[0].realPath,f))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),c=await s.stat(),!ts(a,c))throw new Error("Contained atomic write temporary file changed while writing");await s.close(),s=void 0,await n.beforeCommit?.(),await Me(i);let u=await I.lstat(o);if(!u.isFile()||u.isSymbolicLink()||!c||!Al(u,c))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await ns(o,t),await I.unlink(o)):await I.rename(o,t),await Ol(r)}catch(l){await s?.close();try{await Me(i),await I.rm(o,{force:!0})}catch{}throw l}}async function ee(t,e,n){await dg(t,e,n)}async function rs(t,e){let n=B.dirname(t),r=await fg(e.containedRoot,n);if(!r)return!1;let i,o;try{i=await I.lstat(t),o=await I.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!i.isFile()||i.isSymbolicLink()||!yt(r[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await Me(r);let[s,a]=await Promise.all([I.lstat(t),I.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!Al(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await I.unlink(t),await Me(r),await Ol(n),!0}var Be=L(()=>{"use strict";Cr()});var Ek,is=L(()=>{"use strict";Be();wt();Q();Ek=16*1024});var ss=L(()=>{"use strict";Be();ke();wt();Q();is()});var Dr=L(()=>{"use strict"});var Ul=L(()=>{"use strict"});var ls=L(()=>{"use strict";Dr()});var Yl=L(()=>{"use strict";Dr();ls()});var Gg,Hl=L(()=>{"use strict";Gg=Ge($e(),1);Be();ke();Q()});var jb,Jl=L(()=>{"use strict";Be();Q();jb=4*1024*1024});function Vl(t,e){let n=t;for(let r of e)n+="\0"+(typeof r=="string"?r:JSON.stringify(r));return n}function Fr(t,e){return(...n)=>{let r=Gl;if(r===null)return e(...n);let i=Vl(`async:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n).catch(a=>{throw r.entries.delete(i),a});return r.entries.set(i,{value:s}),s}}function us(t,e){return(...n)=>{let r=Gl;if(r===null)return e(...n);let i=Vl(`sync:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n);return r.entries.set(i,{value:s}),s}}var Gl,Mr=L(()=>{"use strict";Gl=null});var Wb,zl=L(()=>{"use strict";Mr();wt();Wb=Fr("hookWritePolicy",async t=>(await es(t))?.hook??{allow_paths:[]})});var Ql=L(()=>{"use strict";Dr();Be();Ul();Yl();ke();Hl();Q();wt();ss();Jl();zl();is();ls()});import{TextDecoder as Vg}from"util";function Xl(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function zg(t,e){try{return new Vg("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function fs(t,e,n,r,i={}){try{let o=await D(t,e,n,{label:r,hooks:i.hooks});return{result:o,text:zg(o,r)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function Ue(t,e,n,r,i={}){return(await fs(t,e,n,r,i))?.text??null}async function Ye(t,e,n,r,i,o={}){if(Buffer.byteLength(n,"utf8")>r)throw new Error(`${i} exceeds ${r} bytes`);let s=await fs(t,e,r,i),a=await N(t,e,{label:i,expected:"file"});await ee(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await fs(t,e,r,i);if(!(!s&&!c)){if(!s||!c)throw new Error(`${i} changed before commit`);if(s.result.realPath!==c.result.realPath||!We(Xl(s.result.stat),Xl(c.result.stat))||s.text!==c.text)throw new Error(`${i} changed before commit`)}}})}async function Br(t,e,n,r,i,o={}){let s=await Ue(t,e,r,i);await Ye(t,e,`${s??""}${n}`,r,i,o)}async function Kr(t,e,n,r={}){let i=await N(t,e,{label:n,expected:"file"});return i.exists?rs(i.target,{containedRoot:i.projectRoot,beforeRemove:r.beforeRemove}):!1}var Ur=L(()=>{"use strict";Ql();Cr()});var tu={};rf(tu,{RUN_STATE_FILE:()=>Hr,applyRunStateToDocument:()=>ds,readRunState:()=>ps,removeRunState:()=>ms,runStateFromDocument:()=>Yr,writeRunState:()=>Jr});import Qg from"path";function yn(t,e){let n=t[e];if(typeof n!="string"||n.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return n}function wn(t,e){let n=yn(t,e);if(Qg.isAbsolute(n)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return n}function Xg(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(r){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:r})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let r of Object.values(n))if(!Number.isInteger(r)||Number(r)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function Yr(t){if(!t.run_id)return null;let e=yn(t,"run_id"),n=yn(t,"skill"),r=yn(t,"skill_version"),i=yn(t,"skill_hash"),o=wn(t,"pending_ref"),s=wn(t,"trajectory_ref"),a=wn(t,"context_ref"),c=wn(t,"artifacts_ref"),l=wn(t,"checkpoint_ref"),f=Number(t.iteration);if(!Number.isInteger(f)||f<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:n,skillVersion:r,skillHash:i,orchestration:t.orchestration,currentStep:Zl(t,"current_step"),iteration:f,pending:Zl(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Xg(t)}}function ds(t,e){e?t.run_id=e.runId:delete t.run_id}function Zg(t){return{runId:t.runId,skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash,orchestration:t.orchestration,currentStep:t.currentStep,iteration:t.iteration,pending:t.pending,pendingRef:t.pendingRef,trajectoryRef:t.trajectoryRef,contextRef:t.contextRef,artifactsRef:t.artifactsRef,checkpointRef:t.checkpointRef,status:t.status,retries:t.retries}}function ew(t){let e={run_id:t.runId,skill:t.skill,skill_version:t.skillVersion,skill_hash:t.skillHash,orchestration:t.orchestration,current_step:t.currentStep,iteration:t.iteration,pending:t.pending,pending_ref:t.pendingRef,trajectory_ref:t.trajectoryRef,context_ref:t.contextRef,artifacts_ref:t.artifactsRef,checkpoint_ref:t.checkpointRef,run_status:t.status,run_retries:JSON.stringify(t.retries)};return Yr(e)}async function ps(t,e={}){let n=await Ue(t,Hr,eu,"Run state",e);if(n===null)return null;let r=JSON.parse(n);return ew(r)}async function Jr(t,e,n={}){await Ye(t,Hr,JSON.stringify(Zg(e),null,2),eu,"Run state",n)}async function ms(t,e={}){await Kr(t,Hr,"Run state",e)}var Zl,Hr,eu,Gr=L(()=>{"use strict";Ur();Zl=(t,e)=>{let n=t[e];return n==null?null:String(n)};Hr=".comet/run-state.json",eu=256*1024});import{createHash as vy}from"crypto";import{promises as ky}from"fs";import me from"path";import{spawnSync as Eg}from"child_process";function sf(t){return t.length>0&&/^[A-Za-z0-9@+=:,./\\_-]+$/.test(t)?t:`"${t.replace(/"/g,'""')}"`}function Os(t){return t.map(e=>sf(e))}import{promises as Il}from"fs";import T from"path";import{promises as af}from"fs";async function xt(t){try{return await af.access(t),!0}catch(e){if(cf(e))return!1;throw e}}function cf(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ke();wt();ss();Q();var vt=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},jl=".comet/config.yaml";function $l(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ql(t){await N(t,jl,{label:jl,expected:"file"})}function Tr(t,e){let n=T.resolve(t),r=e==="docs"?T.join(n,"docs"):n,i=T.join(r,"openspec"),o=T.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:r,openSpecRoot:i,changesDir:T.join(i,"changes"),archiveDir:T.join(i,"changes","archive"),specsDir:T.join(i,"specs"),superpowersRoot:o,superpowersSpecsDir:T.join(o,"specs"),superpowersPlansDir:T.join(o,"plans"),superpowersReportsDir:T.join(o,"reports")}}async function wg(t){await ql(t);let e=await an(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new vt;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new vt("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function yg(t,e){return Tr(t,e??await wg(t))}async function vg(t){try{return await Il.lstat(t),!0}catch(e){if($l(e))return!1;throw e}}async function kg(t,e){let n=await yg(t,e),r=n.artifactLayout==="legacy"?"docs":"legacy",i=Tr(t,r).openSpecRoot,[o,s]=await Promise.all([N(n.projectRoot,$(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),vg(i)]),a=o.exists;return{paths:n,configuredRootExists:a,alternateRoot:i,alternateRootExists:s,dualRoots:a&&s}}async function bg(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let n of e){let r=$(t.projectRoot,n);await N(t.projectRoot,r,{label:`Classic managed physical path ${r}`,expected:"directory"})}}async function ce(t,e){let n=await kg(t,e);if(await bg(n.paths),!n.configuredRootExists){let r=$(n.paths.projectRoot,n.paths.openSpecRoot),i=$(n.paths.projectRoot,n.alternateRoot);throw new vt(`Configured Classic OpenSpec root is missing: ${r} (alternate ${i} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function cn(t,e){let n=T.join(T.resolve(t),".comet","classic-root-move.json");if(await xt(n))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let r=await ce(t,e);if(!await xt(r.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${$(r.projectRoot,r.openSpecRoot)}`);return r}async function be(t){let e=T.resolve(t),n=null;try{(await Il.lstat(e)).isDirectory()||(e=T.dirname(e))}catch(r){if(!$l(r))throw r}for(;;){T.basename(e)==="openspec"&&(n=T.dirname(e));let r=T.join(e,".comet","config.yaml"),i=!1;if(await xt(r))try{await ql(e);let s=(await an(e))?.value;i=!!s&&typeof s=="object"&&!Array.isArray(s)&&(s.schema==="comet.project.v1"||s.default_workflow!==void 0||s.native!==void 0)}catch{}if(i||await xt(T.join(e,".git")))return e;let o=T.dirname(e);if(o===e)return n??T.resolve(t);e=o}}function $(t,e){return T.relative(T.resolve(t),e).replaceAll("\\","/")}var Ll=Ge($e(),1);Q();import Sg from"path";var Cg=1024*1024;async function Wl(t,e){let n=e??await ce(t),r=Sg.join(n.openSpecRoot,"config.yaml"),i=$(n.projectRoot,r),o;try{o=(await D(n.projectRoot,i,Cg,{label:"Classic OpenSpec project config",bigint:!0})).bytes.toString("utf8")}catch(l){throw l.code==="ENOENT"?new Error(`Classic OpenSpec root is unhealthy: ${i} is missing; rerun OpenSpec initialization for the configured Classic layout`,{cause:l}):new Error(`Classic OpenSpec root is unhealthy: ${l instanceof Error?l.message:String(l)}`,{cause:l})}let s=(0,Ll.parseDocument)(o,{uniqueKeys:!0});if(s.errors.length>0)throw new Error(`Classic OpenSpec root is unhealthy: ${i} is invalid YAML (${s.errors[0].message})`);let a=s.toJS();if(!a||typeof a!="object"||Array.isArray(a))throw new Error(`Classic OpenSpec root is unhealthy: ${i} must contain a mapping`);let c=a.schema;if(typeof c!="string"||c.trim()==="")throw new Error(`Classic OpenSpec root is unhealthy: ${i} must declare a non-empty schema`);return{layout:n,configPath:i,schema:c}}function _g(t){return t[0]==="--"?t.slice(1):[...t]}async function Dl(t,e=process.cwd()){let n=_g(t);if(n.length===0)return{exitCode:64,stderr:"Usage: comet classic openspec -- <openspec-args...>"};let r=await be(e),i=await cn(r);await Wl(r,i);let o=process.env.COMET_OPENSPEC||"openspec",s=process.platform==="win32",a=Eg(o,s?Os(n):n,{cwd:i.openSpecBase,encoding:"utf8",shell:s,windowsHide:!0});if(a.error){let c=a.error.code;return{exitCode:c==="ENOENT"?127:70,stdout:a.stdout||void 0,stderr:a.stderr||(c==="ENOENT"?`OpenSpec CLI not found: ${o}`:a.error.message)}}return{exitCode:a.status??1,stdout:a.stdout||void 0,stderr:a.stderr||void 0}}import{promises as Rg}from"fs";import dn from"path";Be();ke();Q();import ln from"path";var xg=2*1024*1024;function jr(t,e,n){let r=ln.resolve(t),i=ln.isAbsolute(e)?ln.resolve(e):ln.resolve(r,e),o=ln.relative(r,i).replaceAll("\\","/");return{root:r,relative:ve(o,n),target:i}}async function Ke(t,e,n){let r=jr(t,e,n.label);return N(r.root,r.relative,n)}async function un(t,e,n){return(await Ke(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function fn(t,e,n){return(await Pg(t,e,n)).toString("utf8")}async function Pg(t,e,n){let r=jr(t,e,n.label);return(await D(r.root,r.relative,n.maxBytes??xg,{label:n.label,hooks:n.hooks})).bytes}async function as(t,e,n){let r=jr(t,e,n);return Zo(r.root,r.relative,{label:n})}async function Fl(t,e,n,r){let i=jr(t,e,r.label);await N(i.root,i.relative,{label:r.label,expected:"file"}),await ee(i.target,n,{containedRoot:i.root,beforeTemporaryOpen:r.beforeTemporaryOpen,beforeCommit:r.beforeCommit,exclusive:r.exclusive})}function cs(t){return t?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t)?t.includes("..")?"Change name cannot contain '..' (path traversal not allowed)":null:`Invalid change name: '${t}'
143
- Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function kt(t){let e=cs(t);if(e)throw new Error(e)}function Ag(t,e){return{label:$(t,e),directory:e}}async function Ir(t,e,n){let r=Ag(t,e);if(!(await Ke(t,e,{label:n,expected:"directory"})).exists)return{change:r,exists:!1,stateExists:!1};let o=await Ke(t,dn.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:r,exists:!0,stateExists:o.exists}}function Ml(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function Og(t,e,n,r={}){if(!r.skipExactCompatibility){let s=await Ir(t,dn.join(e,n),`Classic archived change ${n}`);if(s.exists)return s.change}if(!(await Ke(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let o=[];for(let s of await Rg.readdir(e,{withFileTypes:!0})){if(!Ml(s.name,n))continue;let a=await Ir(t,dn.join(e,s.name),`Classic archived change ${s.name}`);a.exists&&a.stateExists&&o.push(a.change)}return o.sort((s,a)=>a.directory.localeCompare(s.directory))[0]??null}async function $r(t,e=process.cwd()){kt(t);let n=await ce(e),r=await Ir(n.projectRoot,dn.join(n.changesDir,t),`Classic active change ${t}`);return{...r.change,exists:r.exists,stateExists:r.stateExists}}async function qr(t,e=process.cwd(),n={}){kt(t);let r=await ce(e);if(n.preferredArchiveName!==void 0){let i=n.preferredArchiveName;if(i!==t&&!Ml(i,t))throw new Error(`Classic preferred archive name '${i}' does not belong to change '${t}'`);let o=await Ir(r.projectRoot,dn.join(r.archiveDir,i),`Classic preferred archived change ${i}`);return o.exists&&o.stateExists?o.change:null}return Og(r.projectRoot,r.archiveDir,t,n)}import{promises as $u}from"fs";import X from"path";import{fileURLToPath as qu}from"url";import{promises as Tg}from"fs";import Se from"path";Q();ke();import pn from"path";function Ng(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Bl(t,e,n,r){let i=ve(n,"Classic handoff artifact pointer");if((await N(t,i,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let s=await ce(t),a=`${$(t,s.changesDir)}/`,l=(s.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(y=>i.startsWith(y));if(!l)return null;let f=i.slice(l.length).split("/");if(f.length<4||f[1]!==".comet"||f.slice(2).some(y=>y.length===0))return null;let u=f[0];kt(u);let d=f.slice(2),h=pn.resolve(e);if(pn.dirname(h)!==pn.resolve(s.archiveDir))return null;let g=pn.basename(h),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(g);if(g!==u&&p?.[1]!==u)return null;await N(t,$(t,h),{label:"Classic archived change directory",expected:"directory"});let m=pn.join(h,".comet",...d),w=$(t,m);try{return await D(t,w,r,{label:"Historical Classic archived handoff artifact"}),w}catch(y){if(Ng(y))return null;throw y}}Q();var Kl=2*1024*1024;function mn(t,e){return Se.relative(t,e).split(Se.sep).join("/")}async function hn(t,e,n,r,i){if(!n)return{code:e,satisfied:!1};let o=n.replaceAll("\\","/");if(i)return{code:e,satisfied:!1,source:o,detail:`Classic layout is unsafe or unavailable: ${i instanceof Error?i.message:String(i)}`};try{if(r){let a=r.artifactLayout==="legacy"?"docs":"legacy",c=$(t,Tr(t,a).openSpecRoot);if((o===c||o.startsWith(`${c}/`))&&(await N(t,o,{label:`${e} artifact`,expected:"file"})).exists)return{code:e,satisfied:!1,source:o,detail:"standalone OpenSpec root is not a Comet artifact root"}}let s=await Rr(t,o,{label:`${e} artifact`});return{code:e,satisfied:s,source:o,...s?{resolvedSource:o}:{}}}catch(s){return{code:e,satisfied:!1,source:o,detail:`unsafe artifact pointer outside the project or through a special path: ${s instanceof Error?s.message:String(s)}`}}}async function jg(t,e,n,r){try{r??=await ce(t)}catch(o){return{code:"design.handoff",satisfied:!1,...n?{source:n.replaceAll("\\","/")}:{},detail:`Classic layout is unsafe or unavailable for handoff evidence: ${o instanceof Error?o.message:String(o)}`}}let i=await hn(t,"design.handoff",n,r);if(!n||i.satisfied||i.detail)return i;try{let o=await Bl(t,e,n,Kl);return o?{...i,satisfied:!0,resolvedSource:o,detail:`resolved historical legacy pointer from archived change: ${o}`}:i}catch(o){return{...i,satisfied:!1,detail:`unsafe archived handoff fallback: ${o instanceof Error?o.message:String(o)}`}}}async function Lr(t,e,n){return hn(t,e,mn(t,n))}async function Ig(t,e){let n=Se.join(e,"specs"),r;try{let s=mn(t,n);if(!(await N(t,s,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};r=await Tg.readdir(n)}catch(s){return s.code==="ENOENT"?{code:"openspec.delta-spec",satisfied:!1}:{code:"openspec.delta-spec",satisfied:!1,detail:`unsafe delta-spec path: ${s instanceof Error?s.message:String(s)}`}}let i=r.map(s=>Se.join(n,s,"spec.md")),o=(await Promise.all(i.map(async s=>{try{return await Rr(t,mn(t,s),{label:"OpenSpec delta spec"})?s:null}catch{return null}}))).filter(s=>s!==null);return{code:"openspec.delta-spec",satisfied:o.length>0,source:o[0]?mn(t,o[0]):void 0,detail:`${o.length} delta spec${o.length===1?"":"s"}`}}async function $g(t,e){let n,r=mn(t,e);try{n=(await D(t,r,Kl,{label:"Classic tasks artifact"})).bytes.toString("utf8")}catch(s){return s.code==="ENOENT"?{code:"build.tasks-complete",satisfied:!1}:{code:"build.tasks-complete",satisfied:!1,source:r,detail:`unsafe tasks artifact: ${s instanceof Error?s.message:String(s)}`}}let i=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],o=i.filter(s=>s[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:i.length>0&&o===i.length,source:r,detail:`${o} of ${i.length} tasks complete`}}function gn(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function bt(t,e){let n=await be(t),r=e.classic,i=Se.join(t,"proposal.md"),o=Se.join(t,"design.md"),s=Se.join(t,"tasks.md"),a=e.run?Se.resolve(t,e.run.checkpointRef):Se.join(t,".comet","checkpoint.json"),c,l;try{c=await ce(n)}catch(d){l=d}let f=await Promise.all([Lr(n,"openspec.proposal",i),Lr(n,"openspec.design",o),Lr(n,"openspec.tasks",s),Ig(n,t),hn(n,"design.document",r?.designDoc??null,c,l),hn(n,"build.plan",r?.plan??null,c,l),$g(n,s),hn(n,"verification.report",r?.verificationReport??null,c,l),jg(n,t,r?.handoffContext??null,c),Lr(n,"run.checkpoint",a)]),u=f.find(d=>d.code==="design.handoff");return u&&!r?.handoffHash&&(u.satisfied=!1,u.detail="handoff hash is missing"),f.push({code:"archive.confirmed",satisfied:r?.archiveConfirmation==="confirmed"}),f}import{createHash as Jw,randomUUID as Gw}from"crypto";import{promises as Ss}from"fs";import Ee from"path";function qg(t){return t.classicProfile??t.workflow}function Lg(t){return!t.buildMode||!t.tddMode||!t.isolation||!t.verifyMode?!1:t.buildMode==="subagent-driven-development"?t.subagentDispatch==="confirmed":t.buildMode==="direct"?t.directOverride===!0:!0}function Wg(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function Dg(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!gn(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!Lg(e))return"full.build.configure"}else if(!Wg(e))throw new Error(`${t} build configuration is incomplete`);return gn(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function Fg(t,e,n){return e.verifyResult!=="pass"||!gn(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Mg(t,e){if(e.verifyResult!=="pass")throw new Error("archive requires verify_result=pass");return e.archiveConfirmation==="confirmed"?`${t}.archive.execute`:`${t}.archive.confirm`}function Wr(t,e){let n=qg(t);if(t.archived&&t.phase!=="archive")throw new Error("archived=true requires phase=archive");if(t.archived)return"completed";if(n!=="full"&&t.phase==="design")throw new Error(`${n} workflow cannot enter design`);switch(t.phase){case"open":return`${n}.open`;case"design":return gn(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return Dg(n,t,e);case"verify":return Fg(n,t,e);case"archive":return Mg(n,t)}}var Xr=Ge($e(),1);Be();Q();import Qr from"path";Gr();var nu=["full","hotfix","tweak"],nt=1,tw=["open","design","build","verify","archive"],nw=["en","zh-CN"],rw=["off","beta"],iw=["subagent-driven-development","executing-plans","direct"],ow=["plan-ready"],sw=["confirmed"],aw=["tdd","direct"],cw=["off","standard","thorough"],lw=["current","branch","worktree"],uw=["light","full"],fw=["pending","pass","fail"],dw=["pending","handled"],pw=["pending","confirmed"],zr=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],mw=["run_id"],hw=new Set([...zr,...mw]),gw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function ru(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function St(t,e){let n=t[e];if(n==null||n==="")return null;if(typeof n!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return n}function U(t,e,n,r=!0){let i=t[e];if(i==null||i===""){if(r)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="string"||!n.includes(i))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${r?" or null":""}`);return i}function hs(t,e,n=!0){let r=t[e];if(r==null||r===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return r}function ww(t,e,n=0){let r=t[e];if(r==null||r==="")return n;if(typeof r!="number"||!Number.isInteger(r)||r<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return r}function Vr(t,e){let n=St(t,e);if(n===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return n}function yw(t,e){let n=St(t,e);if(n!==null&&!/^[a-f0-9]{64}$/u.test(n))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return n}function vw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==nt)throw new Error(`Invalid Classic state: classic_migration must be ${nt}`);return e}function kw(t){if(!zr.some(n=>ru(t,n)))return null;for(let n of gw)if(!ru(t,n))return null;return{workflow:U(t,"workflow",nu,!1),language:U(t,"language",nw),phase:U(t,"phase",tw,!1),contextCompression:U(t,"context_compression",rw),buildMode:U(t,"build_mode",iw),buildPause:U(t,"build_pause",ow),subagentDispatch:U(t,"subagent_dispatch",sw),tddMode:U(t,"tdd_mode",aw),reviewMode:U(t,"review_mode",cw),isolation:U(t,"isolation",lw),boundBranch:St(t,"bound_branch"),verifyMode:U(t,"verify_mode",uw),autoTransition:hs(t,"auto_transition"),baseRef:St(t,"base_ref"),designDoc:Vr(t,"design_doc"),plan:Vr(t,"plan"),verifyResult:U(t,"verify_result",fw,!1),verifyFailures:ww(t,"verify_failures"),verificationReport:Vr(t,"verification_report"),branchStatus:U(t,"branch_status",dw),createdAt:St(t,"created_at"),verifiedAt:St(t,"verified_at"),archiveConfirmation:U(t,"archive_confirmation",pw),archived:hs(t,"archived",!1),directOverride:hs(t,"direct_override"),handoffContext:Vr(t,"handoff_context"),handoffHash:yw(t,"handoff_hash"),classicProfile:U(t,"classic_profile",nu),classicMigration:vw(t)}}function gs(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=Yr(t)}catch(r){let i=r instanceof Error?r.message:String(r);throw new Error(i.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:r})}return{classic:kw(t),run:n,unknownKeys:Object.keys(t).filter(r=>!hw.has(r))}}function iu(t){return{workflow:t.workflow,language:t.language,phase:t.phase,context_compression:t.contextCompression,build_mode:t.buildMode,build_pause:t.buildPause,subagent_dispatch:t.subagentDispatch,tdd_mode:t.tddMode,review_mode:t.reviewMode,isolation:t.isolation,bound_branch:t.boundBranch,verify_mode:t.verifyMode,auto_transition:t.autoTransition,base_ref:t.baseRef,design_doc:t.designDoc,plan:t.plan,verify_result:t.verifyResult,verify_failures:t.verifyFailures,verification_report:t.verificationReport,branch_status:t.branchStatus,created_at:t.createdAt,verified_at:t.verifiedAt,archive_confirmation:t.archiveConfirmation,archived:t.archived,direct_override:t.directOverride,handoff_context:t.handoffContext,handoff_hash:t.handoffHash,classic_profile:t.classicProfile,classic_migration:t.classicMigration}}Gr();var bw=2*1024*1024;function vn(t){let e=t.toJS();if(e===null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("Invalid Classic state document: root must be a mapping");return e}function ou(t,e,n){t.get(e)!==n&&t.set(e,n)}function Sw(t,e){if(e.classic)for(let[n,r]of Object.entries(iu(e.classic)))ou(t,n,r);else for(let n of zr)t.delete(n);ds(t.toJS(),e.run),e.run?ou(t,"run_id",e.run.runId):t.delete("run_id")}function Cw(t){let e=["skill","skill_version","skill_hash","orchestration","current_step","iteration","pending","pending_ref","trajectory_ref","context_ref","artifacts_ref","checkpoint_ref","run_status","run_retries"];for(let n of e)t.delete(n)}function Ew(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function su(t){let e;try{e=(await D(Qr.dirname(t),Qr.basename(t),bw,{label:"Classic state document"})).bytes.toString("utf8")}catch(r){if(r.code!=="ENOENT")throw r;return new Xr.Document({})}let n=(0,Xr.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return vn(n),n}async function de(t,e={}){let n=e.migrate!==!1,r=Qr.join(t,".comet.yaml"),i=await su(r),o=vn(i),s=Ew(i);s&&(o=vn(i));let a=await ps(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Gr(),tu));a=c(o),a&&n&&(await Jr(t,a),Cw(i),s=!0)}return s&&n&&await ee(r,i.toString(),{containedRoot:t}),gs(vn(i),a)}async function rt(t,e,n={}){let r=Qr.join(t,".comet.yaml"),i=await su(r);Sw(i,{...e,unknownKeys:e.unknownKeys??[]}),gs(vn(i),e.run??null),await ee(r,i.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await Jr(t,e.run):await ms(t)}function au(t,e,n){return{runId:e,skill:t.definition.metadata.name,skillVersion:t.definition.metadata.version,skillHash:n,orchestration:t.definition.orchestration.mode,currentStep:t.definition.orchestration.entry??null,iteration:0,pending:null,pendingRef:".comet/pending-action.json",trajectoryRef:".comet/trajectory.jsonl",contextRef:".comet/context.md",artifactsRef:".comet/artifacts.json",checkpointRef:".comet/checkpoint.json",status:"running",retries:{}}}Ur();import Zr from"path";var Ce={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function pe(t,e){if(Zr.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Zr.resolve(t),r=Zr.resolve(n,e);if(r!==n&&!r.startsWith(n+Zr.sep))throw new Error("Run path must stay inside the change directory")}async function Ct(t,e,n,r={}){pe(t,e),await Br(t,e,`${JSON.stringify(n)}
144
- `,Ce.trajectory,"Run trajectory",r)}async function kn(t,e,n={}){pe(t,e);let r=await Ue(t,e,Ce.trajectory,"Run trajectory",n);return r===null?[]:r.split(/\r?\n/).map((i,o)=>({line:i,number:o+1})).filter(({line:i})=>i.length>0).map(({line:i,number:o})=>{try{return JSON.parse(i)}catch(s){throw new Error(`Invalid Trajectory event at line ${o}`,{cause:s})}})}async function ws(t,e,n={}){pe(t,e);let r=await Ue(t,e,Ce.artifacts,"Run artifacts",n);return r===null?{}:JSON.parse(r)}async function ei(t,e,n,r={}){pe(t,e),await Ye(t,e,JSON.stringify(n,null,2)+`
145
- `,Ce.artifacts,"Run artifacts",r)}async function cu(t,e,n,r={}){pe(t,e),await Ye(t,e,n,Ce.context,"Run context",r)}async function lu(t,e,n={}){return pe(t,e),Ue(t,e,Ce.context,"Run context",n)}async function uu(t,e,n,r={}){pe(t,e),await Ye(t,e,JSON.stringify(n,null,2)+`
146
- `,Ce.pendingAction,"Run pending action",r)}async function fu(t,e,n={}){pe(t,e);let r=await Ue(t,e,Ce.pendingAction,"Run pending action",n);return r===null?null:JSON.parse(r)}async function du(t,e,n={}){pe(t,e),await Kr(t,e,"Run pending action",n)}async function ti(t,e,n,r={}){pe(t,e),await Ye(t,e,JSON.stringify(n,null,2)+`
147
- `,Ce.checkpoint,"Run checkpoint",r)}import{createHash as xu,randomUUID as Bw}from"crypto";import{promises as F}from"fs";import q from"path";var hu=Ge($e(),1);import{promises as ys}from"fs";import te from"path";var _w=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],xw=["deterministic","adaptive"],Pw=["function","mcp","script","agent"],Rw=["none","read","write","external"],Aw=["progress","step","completion"],Ow=["artifact_exists","state_equals"];function it(t,e,n){return new Error(`${t}: ${e} ${n}`)}function G(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw it(e,n,"must be an object")}function He(t,e,n){if(!Array.isArray(t))throw it(e,n,"must be an array")}function Y(t,e,n){if(typeof t!="string")throw it(e,n,"must be a string")}function le(t,e,n,r){e in t&&Y(t[e],n,`${r}.${e}`)}function gu(t,e,n,r){if(e in t&&typeof t[e]!="boolean")throw it(n,`${r}.${e}`,"must be a boolean")}function Je(t,e,n,r){if(typeof t!="string"||!e.includes(t))throw it(n,r,`must be one of ${e.join(", ")}`)}function ni(t,e,n){He(t,e,n),t.forEach((r,i)=>{Y(r,e,`${n}[${i}]`)})}function pu(t,e,n){G(t,e,n),Y(t.name,e,`${n}.name`),Y(t.description,e,`${n}.description`),gu(t,"required",e,n)}function Nw(t,e,n){G(t,e,n),Y(t.id,e,`${n}.id`),le(t,"source",e,n),le(t,"version",e,n)}function Tw(t,e,n){G(t,e,n),Y(t.id,e,`${n}.id`),Y(t.role,e,`${n}.role`),le(t,"instructions",e,n)}function jw(t,e,n){G(t,e,n),Y(t.id,e,`${n}.id`),Je(t.kind,Pw,e,`${n}.kind`),Y(t.source,e,`${n}.source`),Je(t.sideEffect,Rw,e,`${n}.sideEffect`),gu(t,"requiresConfirmation",e,n)}function Iw(t,e,n){G(t,e,n),Je(t.type,_w,e,`${n}.type`),le(t,"ref",e,n),le(t,"prompt",e,n),le(t,"question",e,n),"options"in t&&ni(t.options,e,`${n}.options`)}function $w(t,e,n){G(t,e,n),Y(t.id,e,`${n}.id`),Iw(t.action,e,`${n}.action`),le(t,"next",e,n),"completionEvals"in t&&ni(t.completionEvals,e,`${n}.completionEvals`)}function qw(t,e){let n="goal";G(t,e,n),Y(t.statement,e,`${n}.statement`),He(t.inputs,e,`${n}.inputs`),t.inputs.forEach((r,i)=>{pu(r,e,`${n}.inputs[${i}]`)}),He(t.outputs,e,`${n}.outputs`),t.outputs.forEach((r,i)=>{pu(r,e,`${n}.outputs[${i}]`)}),ni(t.success,e,`${n}.success`)}function Lw(t,e){let n="orchestration";G(t,e,n),Je(t.mode,xw,e,`${n}.mode`),le(t,"entry",e,n),"steps"in t&&(He(t.steps,e,`${n}.steps`),t.steps.forEach((r,i)=>{$w(r,e,`${n}.steps[${i}]`)}))}function wu(t,e){return G(t,e),Je(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Je(t.kind,["Skill"],e,"kind"),G(t.metadata,e,"metadata"),Y(t.metadata.name,e,"metadata.name"),Y(t.metadata.version,e,"metadata.version"),Y(t.metadata.description,e,"metadata.description"),qw(t.goal,e),Lw(t.orchestration,e),He(t.skills,e,"skills"),t.skills.forEach((n,r)=>{Nw(n,e,`skills[${r}]`)}),He(t.agents,e,"agents"),t.agents.forEach((n,r)=>{Tw(n,e,`agents[${r}]`)}),He(t.tools,e,"tools"),t.tools.forEach((n,r)=>{jw(n,e,`tools[${r}]`)}),t}function yu(t,e){G(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&ni(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw it(e,n,"must be a finite number");return t}function Ww(t,e){return G(t,e),"runtime"in t&&vu(t.runtime,e,"runtime"),t}function vu(t,e,n){return He(t,e,n),t.forEach((r,i)=>{let o=`${n}[${i}]`;G(r,e,o),Y(r.id,e,`${o}.id`),Je(r.scope,Aw,e,`${o}.scope`),Je(r.type,Ow,e,`${o}.type`),le(r,"artifact",e,o),le(r,"field",e,o),le(r,"equals",e,o)}),t}async function vs(t){let e=await ys.readFile(t,"utf8");try{return(0,hu.parse)(e)}catch(n){let r=n instanceof Error?n.message:String(n);throw it(t,"document",r)}}async function Dw(t){try{return await vs(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function mu(t){try{return await ys.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Fw(t){let e=te.join(t,"checks.yaml"),n=te.join(t,"evals.yaml"),[r,i]=await Promise.all([mu(e),mu(n)]);if(i)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return r?{document:Ww(await vs(e),e)}:{document:null}}async function ku(t){let e=te.resolve(t.root),n=te.resolve(t.controlRoot);t.requireSkillMarkdown&&await ys.access(te.join(e,"SKILL.md"));let r=te.join(n,"skill.yaml"),i=te.join(n,"guardrails.yaml"),o=wu(await vs(r),r),s=await Dw(i),a=s===null?null:yu(s,i),c=await Fw(n),l={allowedSkills:o.skills.map(f=>f.id),allowedAgents:o.agents.map(f=>f.id),allowedTools:o.tools.map(f=>f.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:o.tools.filter(f=>f.requiresConfirmation).map(f=>f.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:o,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function bu(t){let e=te.resolve(t);return ku({root:e,controlRoot:te.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function Su(t){let e=te.resolve(t);return ku({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function Cu(t,e,n=te.join(e,"package.json")){G(t,n);let r=t.packageKind==="runtime"?"runtime":void 0,i=wu(t.definition,n),o=yu(t.guardrails,n),s=vu(t.evals,n,"evals"),a={allowedSkills:i.skills.map(c=>c.id),allowedAgents:i.agents.map(c=>c.id),allowedTools:i.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:i.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:te.resolve(e),packageKind:r,definition:i,guardrails:{...a,...o},evals:s}}import Eu from"path";function Mw(t,e,n,r){t.type==="invoke_skill"&&!e.definition.skills.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&n.push(`step ${r} ask_user action requires question`)}function _u(t){let e=[],{definition:n,guardrails:r,evals:i}=t;n.apiVersion!=="comet/v1alpha1"&&e.push("unsupported apiVersion"),n.kind!=="Skill"&&e.push("kind must be Skill"),n.metadata.name||e.push("metadata.name is required"),n.goal.statement||e.push("goal.statement is required"),r.maxIterations<1&&e.push("maxIterations must be at least 1"),r.maxRetriesPerAction<0&&e.push("maxRetriesPerAction must not be negative");let o=n.orchestration.steps??[];if(n.orchestration.mode==="adaptive")(n.orchestration.entry||o.length>0)&&e.push("adaptive orchestration must not define entry or steps");else{let s=new Set;for(let a of o)s.has(a.id)&&e.push(`duplicate step id: ${a.id}`),s.add(a.id),Mw(a.action,t,e,a.id);(!n.orchestration.entry||!s.has(n.orchestration.entry))&&e.push(`orchestration.entry references unknown step: ${n.orchestration.entry??"(missing)"}`);for(let a of o){a.next&&!s.has(a.next)&&e.push(`step ${a.id} has unknown next step: ${a.next}`);for(let c of a.completionEvals??[])i.some(l=>l.id===c)||e.push(`step ${a.id} references unknown eval: ${c}`)}}for(let s of n.tools){if(s.kind!=="script")continue;let a=Eu.posix.normalize(s.source.replaceAll("\\","/"));(Eu.isAbsolute(s.source)||a===".."||a.startsWith("../"))&&e.push(`script tool ${s.id} must reference a relative path inside the Skill package`)}for(let s of r.allowedSkills)n.skills.some(a=>a.id===s)||e.push(`guardrails allow undeclared skill: ${s}`);for(let s of r.allowedAgents)n.agents.some(a=>a.id===s)||e.push(`guardrails allow undeclared agent: ${s}`);for(let s of r.allowedTools)n.tools.some(a=>a.id===s)||e.push(`guardrails allow undeclared tool: ${s}`);return e}function ri(t){return Array.isArray(t)?t.map(ri):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,ri(n)])):t}function Kw(t){return ri({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function Uw(t){return q.posix.normalize(t.replaceAll("\\","/"))}function Et(t,e,n){let r=q.relative(t,e);if(!(r===""||!q.isAbsolute(r)&&!r.startsWith(`..${q.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function Pu(t,e,n){let r=Uw(e);if(q.posix.isAbsolute(r)||r===".."||r.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let i=q.resolve(t,...r.split("/"));Et(t,i,n);let o;try{o=await F.realpath(i)}catch(s){throw s.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:s}):s}if(Et(t,o,n),!(await F.stat(o)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:r,content:await F.readFile(o)}}async function Yw(t){let e=await F.realpath(t.root),n=t.packageKind==="runtime"?[]:[await Pu(e,"SKILL.md","SKILL.md")];for(let r of t.definition.tools)r.kind==="script"&&n.push(await Pu(e,r.source,`Script tool ${r.id}`));return n.sort((r,i)=>r.path.localeCompare(i.path))}function Hw(t,e){let n=e.map(r=>({path:r.path,sha256:xu("sha256").update(r.content).digest("hex")}));return xu("sha256").update(JSON.stringify(ri({package:t,files:n}))).digest("hex")}function Ou(t){return JSON.stringify(t,null,2)+`
148
- `}async function Nu(t){let e=Kw(t),n=await Yw(t);return{document:e,files:n,hash:Hw(e,n)}}async function ii(t){return(await Nu(t)).hash}async function Ru(t){try{return await F.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Au(t,e){try{if((await F.readFile(q.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await F.readFile(q.join(t,"package.json"),"utf8")!==Ou(e.document))throw new Error("package mismatch");for(let i of e.files)if(!(await F.readFile(q.join(t,...i.path.split("/")))).equals(i.content))throw new Error(`file mismatch: ${i.path}`)}catch(n){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:n})}}async function ks(t,e){let n=await Nu(t),r=q.resolve(e,".comet","skill-snapshots"),i=q.join(r,n.hash);if(await F.mkdir(r,{recursive:!0}),await Ru(i))return await Au(i,n),{hash:n.hash,snapshotDir:i};let o=q.join(r,`.tmp-${Bw()}`);Et(r,o,"Temporary snapshot"),Et(r,i,"Published snapshot");try{await F.mkdir(o);for(let s of n.files){let a=q.join(o,...s.path.split("/"));Et(o,a,`Snapshot file ${s.path}`),await F.mkdir(q.dirname(a),{recursive:!0}),await F.writeFile(a,s.content)}await F.writeFile(q.join(o,"package.json"),Ou(n.document)),await F.writeFile(q.join(o,"sha256"),n.hash+`
149
- `),await F.rename(o,i)}catch(s){if(await Ru(i)){try{await Au(i,n)}finally{await F.rm(o,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:i}}throw await F.rm(o,{recursive:!0,force:!0}),s}return{hash:n.hash,snapshotDir:i}}async function bs(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=q.resolve(t,".comet","skill-snapshots"),r=q.join(n,e);Et(n,r,"Skill snapshot");try{let i=(await F.readFile(q.join(r,"sha256"),"utf8")).trim();if(i!==e)throw new Error(`stored hash is ${i||"(empty)"}`);let o=q.join(r,"package.json"),s=JSON.parse(await F.readFile(o,"utf8")),a=Cu(s,r,o),c=_u(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
150
- `));let l=await ii(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(i){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:i})}}async function Tu(t){try{return await Ss.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function ju(t){return Jw("sha256").update(t).digest("hex")}function Vw(t){return ju(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function zw(t){return t.replaceAll(".","_").replaceAll("-","_")}async function Qw(t,e){let n=await be(t),r=Object.fromEntries(e.filter(s=>s.satisfied&&s.source).map(s=>[zw(s.code),s.source])),i=Ee.join(t,"subagent-progress.md");await Tu(i)&&(r.subagent_progress=Ee.relative(n,i).split(Ee.sep).join("/"));let o=e.find(s=>s.code==="design.handoff"&&s.satisfied);return o?.source&&(r.handoff_context=o.source),r}function Xw(t,e,n){return[{sequence:1,timestamp:n,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:n,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:nt,profile:e,source:"pre-migration"}}]}async function Zw(t){await Promise.all(t.map(e=>Ss.rm(e,{recursive:!0,force:!0})))}async function Iu(t,e){let n=await de(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let r=n.classic,i=r.classicProfile??r.workflow;if(n.run){if(r.classicMigration!==nt)throw new Error("Classic Run exists without a supported classic_migration marker");if(n.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${n.run.skill}`);if(await ii(e.skillPackage)!==n.run.skillHash)return await bs(t,n.run.skillHash),{classic:r,run:n.run,evidence:await bt(t,n),migrated:!1,snapshotDir:Ee.join(t,".comet","skill-snapshots",n.run.skillHash)};let d=await ks(e.skillPackage,t);return{classic:r,run:n.run,evidence:await bt(t,n),migrated:!1,snapshotDir:d.snapshotDir}}let o=await bt(t,n),s=Wr(r,o);if(!e.skillPackage.definition.orchestration.steps?.some(u=>u.id===s))throw new Error(`Classic Skill package does not define resolved step: ${s}`);let a=await ii(e.skillPackage),c=Ee.join(t,".comet","skill-snapshots",a),l=await Tu(c),f=[];try{let u=await ks(e.skillPackage,t),d=au(e.skillPackage,e.runId?.()??Gw(),u.hash);d.currentStep=s,s==="completed"&&(d.status="completed");let h={...r,classicProfile:i,classicMigration:nt},g=await Qw(t,o),p=await be(t),m=o.find(b=>b.code==="design.handoff"&&b.satisfied),w=null;m?.source&&(w=await fn(p,m.resolvedSource??m.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await cu(t,d.contextRef,w),f.push(Ee.resolve(t,d.contextRef))),await ei(t,d.artifactsRef,g),f.push(Ee.resolve(t,d.artifactsRef));let y=(e.now?.()??new Date).toISOString(),S={runId:d.runId,stateVersion:1,trajectoryOffset:2,contextHash:w===null?null:ju(w),artifactsHash:Vw(g),createdAt:y};await ti(t,d.checkpointRef,S),f.push(Ee.resolve(t,d.checkpointRef)),f.push(Ee.resolve(t,d.trajectoryRef));for(let b of Xw(d,i,y))await Ct(t,d.trajectoryRef,b);return await rt(t,{classic:h,run:d,unknownKeys:n.unknownKeys}),{classic:h,run:d,evidence:o,migrated:!0,snapshotDir:u.snapshotDir}}catch(u){throw await Zw(f),l||await Ss.rm(c,{recursive:!0,force:!0}),u}}async function ey(t){try{return(await $u.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function oi(t){try{return(await $u.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ty(t){return await ey(t)?await oi(X.join(t,"skill.yaml"))?!0:await oi(X.join(t,"SKILL.md"))&&await oi(X.join(t,"comet","skill.yaml")):!1}function ny(t){return{root:t,packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-classic",version:"1",description:"Internal compatibility orchestration for classic Comet full, hotfix, and tweak workflows"},goal:{statement:"Advance or restore a classic Comet Run without changing the user command surface",inputs:[{name:"classic-state",description:"Validated ClassicState consistent with the Run projection",required:!0},{name:"evidence",description:"Structured evidence produced by the Classic Evidence collector",required:!0}],outputs:[{name:"run-state",description:"Atomically synchronized Classic and Run state",required:!0}],success:["Legacy fields and Run fields remain consistent","Every step invokes only a declared public Comet Skill","The completed state passes its completion eval"]},orchestration:{mode:"deterministic",entry:"full.open",steps:[{id:"full.open",action:{type:"invoke_skill",ref:"comet-open"},next:"full.design.handoff"},{id:"full.design.handoff",action:{type:"invoke_skill",ref:"comet-design"},next:"full.design.document"},{id:"full.design.document",action:{type:"invoke_skill",ref:"comet-design"},next:"full.build.plan"},{id:"full.build.plan",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.plan-ready"},{id:"full.build.plan-ready",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.configure"},{id:"full.build.configure",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.complete"},{id:"full.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"full.verify.run"},{id:"full.build.fix",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.verify.branch"},{id:"full.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.archive.confirm"},{id:"full.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"full.archive.execute"},{id:"full.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"hotfix.open",action:{type:"invoke_skill",ref:"comet-hotfix"},next:"hotfix.build.execute"},{id:"hotfix.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.build.complete"},{id:"hotfix.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.verify.run"},{id:"hotfix.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.verify.branch"},{id:"hotfix.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.archive.confirm"},{id:"hotfix.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"hotfix.archive.execute"},{id:"hotfix.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"tweak.open",action:{type:"invoke_skill",ref:"comet-tweak"},next:"tweak.build.execute"},{id:"tweak.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.build.complete"},{id:"tweak.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.verify.run"},{id:"tweak.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.verify.branch"},{id:"tweak.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.archive.confirm"},{id:"tweak.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"tweak.archive.execute"},{id:"tweak.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"completed",action:{type:"checkpoint"},completionEvals:["classic-completed"]}]},skills:[{id:"comet-open"},{id:"comet-design"},{id:"comet-build"},{id:"comet-verify"},{id:"comet-archive"},{id:"comet-hotfix"},{id:"comet-tweak"}],agents:[],tools:[]},guardrails:{allowedSkills:["comet-open","comet-design","comet-build","comet-verify","comet-archive","comet-hotfix","comet-tweak"],allowedAgents:[],allowedTools:[],maxIterations:500,maxRetriesPerAction:3,confirmationRequiredFor:[]},evals:[{id:"classic-completed",scope:"completion",type:"state_equals",field:"status",equals:"completed"}]}}async function ry(){let t=X.dirname(qu(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,X.resolve(t,"..","runtime","classic"),X.resolve(t,"..","..","comet","runtime","classic"),X.resolve(t,"..","..","assets","skills","comet","runtime","classic"),X.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,X.resolve(t,"..","..","comet-classic"),X.resolve(t,"..","..","assets","skills","comet-classic"),X.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await ty(n))return n;return null}async function iy(t){return await oi(X.join(t,"skill.yaml"))?Su(t):bu(t)}async function Lu(t){let e=await ry();return Iu(t,{skillPackage:e?await iy(e):ny(X.dirname(qu(import.meta.url)))})}async function Wu(t,e,n,r){let i=await de(t);if(!i.classic||!i.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let o=await bt(t,{classic:e,run:n,unknownKeys:i.unknownKeys}),s=Wr(e,o),a={...n,currentStep:s,iteration:n.iteration+1,status:s==="completed"?"completed":"running"};await rt(t,{classic:e,run:a,unknownKeys:i.unknownKeys});let c=await kn(t,a.trajectoryRef);return await Ct(t,a.trajectoryRef,{sequence:c.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:a.runId,data:{kind:"classic",fromStep:n.currentStep,toStep:s,...r}}),a}Ur();import oy from"path";var sy=oy.join(".comet","state-events.jsonl"),ay=8*1024*1024;async function Du(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Br(t,sy,`${JSON.stringify(n)}
151
- `,ay,"Classic state event log"),n}var cy={"open-complete":{event:"open-complete",from:"open",guardRefs:["open-artifacts-present"]},"design-complete":{event:"design-complete",from:"design",guardRefs:["design-evidence-present"]},"build-complete":{event:"build-complete",from:"build",guardRefs:["build-decisions-selected"]},"verify-pass":{event:"verify-pass",from:"verify",guardRefs:["verification-report-present"]},"verify-fail":{event:"verify-fail",from:"verify",guardRefs:["verification-failed"]},"archive-confirm":{event:"archive-confirm",from:"archive",guardRefs:["archive-final-confirmation"]},"archive-reopen":{event:"archive-reopen",from:"archive",guardRefs:["archive-not-finalized"]},archived:{event:"archived",from:"archive",guardRefs:["verify-result-pass","archive-confirmed"]},"preset-escalate":{event:"preset-escalate",from:"build",guardRefs:["preset-workflow"]}};function ly(t){return t.toISOString().slice(0,10)}function _(t,e,n,r){let i=t[n];t[n]=r,i!==r&&e.push({field:n,from:i,to:r})}function Fu(t,e,n={}){let r=cy[e];if(t.phase!==r.from)throw new Error(`Cannot apply ${e}: phase is '${t.phase}', expected '${r.from}'`);let i={...t},o=[],s=n.now??new Date;if(e==="open-complete")_(i,o,"phase",i.workflow==="full"?"design":"build");else if(e==="design-complete")_(i,o,"phase","build");else if(e==="build-complete"){let a=i.verifyResult==="fail";_(i,o,"phase","verify"),_(i,o,"verifyResult","pending"),_(i,o,"branchStatus","pending"),a||_(i,o,"verificationReport",null)}else if(e==="verify-pass")_(i,o,"verifyResult","pass"),_(i,o,"verifyFailures",0),_(i,o,"phase","archive"),_(i,o,"verifiedAt",ly(s)),_(i,o,"archiveConfirmation","pending"),_(i,o,"branchStatus","pending");else if(e==="verify-fail")_(i,o,"verifyResult","fail"),_(i,o,"verifyFailures",i.verifyFailures+1),_(i,o,"phase","build"),_(i,o,"branchStatus","pending");else if(e==="preset-escalate"){if(i.workflow!=="hotfix"&&i.workflow!=="tweak")throw new Error(`Cannot apply ${e}: workflow must be hotfix or tweak, got '${i.workflow}'`);_(i,o,"workflow","full"),_(i,o,"classicProfile","full"),_(i,o,"phase","design"),_(i,o,"designDoc",null),_(i,o,"buildPause",null),_(i,o,"buildMode",null),_(i,o,"subagentDispatch",null),_(i,o,"tddMode",null),_(i,o,"reviewMode",null),_(i,o,"isolation",null),_(i,o,"boundBranch",null),_(i,o,"verifyMode",null),_(i,o,"directOverride",null)}else if(e==="archive-confirm"){if(i.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(i.archived)throw new Error(`Cannot apply ${e}: already archived`);_(i,o,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(i.archived)throw new Error(`Cannot apply ${e}: already archived`);_(i,o,"verifyResult","pending"),_(i,o,"verifyFailures",0),_(i,o,"phase","verify"),_(i,o,"verifiedAt",null),_(i,o,"archiveConfirmation",null),_(i,o,"branchStatus","pending")}else{if(i.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(i.archiveConfirmation!=="confirmed")throw new Error(`Cannot apply ${e}: archiveConfirmation must be confirmed`);_(i,o,"archived",!0)}return{classic:i,effects:o,definition:r}}zo();import{promises as uy}from"fs";import fy from"path";var Cs="comet.selection.v2",dy=16*1024;function Es(t){return fy.join(t,".comet","current-change.json")}function py(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Mu(t){return t===null||typeof t=="string"}function my(t){let e;try{e=JSON.parse(t)}catch(n){throw new Error(`current change selection contains invalid JSON: ${n instanceof Error?n.message:String(n)}`,{cause:n})}if(!py(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!Mu(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:Cs,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==Cs)throw new Error(`current change selection schema must be ${Cs}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!Mu(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function _s(t){let e;try{let r=Es(t),{bytes:i}=await xr(r,dy,{label:"current change selection"});e=i.toString("utf8")}catch(r){if(r.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${r instanceof Error?r.message:String(r)}`,{cause:r})}return{status:"selected",...my(e)}}async function Bu(t){await uy.rm(Es(t),{force:!0})}async function Ku(t,e,n){let r=await _s(t);return r.status!=="selected"||r.selection.workflow!==e||r.selection.change!==n?!1:(await Bu(t),!0)}Mr();import{execFileSync as Uu}from"child_process";var hy=Ge($e(),1);Mr();function gy(t){try{let e=Uu("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],windowsHide:!0}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}var KC=us("liveGitBranch",t=>gy(t));function wy(t){try{return Uu("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],windowsHide:!0}).trim()==="true"}catch{return!1}}var UC=us("isGitWorkTree",t=>wy(t));var yy=Ge($e(),1);var HC=8*1024*1024;var wE=Fr("readCometCurrentSelection",t=>_s(t));async function Yu(t,e){return Ku(t,"classic",e)}var by="\x1B[32m",Sy="\x1B[31m",Cy="\x1B[33m",Ps="\x1B[0m";function ne(t){return`${by}${t}${Ps}`}function V(t){return`${Sy}${t}${Ps}`}function bn(t){return`${Cy}${t}${Ps}`}var K=class extends Error{constructor(n,r=1){super(n);this.exitCode=r}exitCode},xs=class{stderr=[];openSpecStdout=[];openSpecStderr=[];stepsOk=0;stepsTotal=0;captureOpenSpec(e){e.stdout&&this.openSpecStdout.push(e.stdout),e.stderr&&this.openSpecStderr.push(e.stderr)}toResult(e=0){let n=this.stderr.length>0?this.stderr.join(`
142
+ `,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=vr(e),r=gt(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=vr(e),r=gt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};pl.Parser=Mo});var yl=v(nn=>{"use strict";var ml=Ro(),kh=Gt(),tn=zt(),bh=_i(),Sh=x(),Ch=Fo(),hl=Bo();function gl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Ch.LineCounter||null,prettyErrors:e}}function Eh(t,e={}){let{lineCounter:n,prettyErrors:r}=gl(e),i=new hl.Parser(n?.addNewLine),o=new ml.Composer(e),s=Array.from(o.compose(i.parse(t)));if(r&&n)for(let a of s)a.errors.forEach(tn.prettifyError(t,n)),a.warnings.forEach(tn.prettifyError(t,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function wl(t,e={}){let{lineCounter:n,prettyErrors:r}=gl(e),i=new hl.Parser(n?.addNewLine),o=new ml.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new tn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach(tn.prettifyError(t,n)),s.warnings.forEach(tn.prettifyError(t,n))),s}function _h(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=wl(t,n);if(!i)return null;if(i.warnings.forEach(o=>bh.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function xh(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return Sh.isDocument(t)&&!r?t.toString(n):new kh.Document(t,r,n).toString(n)}nn.parse=_h;nn.parseAllDocuments=Eh;nn.parseDocument=wl;nn.stringify=xh});var Le=v(O=>{"use strict";var Ph=Ro(),Rh=Gt(),Oh=ao(),Ko=zt(),Ah=Nt(),$e=x(),Nh=Ae(),Th=I(),jh=Te(),Ih=je(),$h=wr(),Lh=Wo(),qh=Fo(),Wh=Bo(),br=yl(),vl=Pt();O.Composer=Ph.Composer;O.Document=Rh.Document;O.Schema=Oh.Schema;O.YAMLError=Ko.YAMLError;O.YAMLParseError=Ko.YAMLParseError;O.YAMLWarning=Ko.YAMLWarning;O.Alias=Ah.Alias;O.isAlias=$e.isAlias;O.isCollection=$e.isCollection;O.isDocument=$e.isDocument;O.isMap=$e.isMap;O.isNode=$e.isNode;O.isPair=$e.isPair;O.isScalar=$e.isScalar;O.isSeq=$e.isSeq;O.Pair=Nh.Pair;O.Scalar=Th.Scalar;O.YAMLMap=jh.YAMLMap;O.YAMLSeq=Ih.YAMLSeq;O.CST=$h;O.Lexer=Lh.Lexer;O.LineCounter=qh.LineCounter;O.Parser=Wh.Parser;O.parse=br.parse;O.parseAllDocuments=br.parseAllDocuments;O.parseDocument=br.parseDocument;O.stringify=br.stringify;O.visit=vl.visit;O.visitAsync=vl.visitAsync});import qe from"path";function Hh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||qe.posix.isAbsolute(n)||qe.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let r=n.replaceAll("\\","/").split("/");if(r.some(i=>i===".."))throw new Error(`${e} must stay inside the project root`);if(r.some(i=>i===""||i==="."))throw new Error(`${e} must not contain empty or dot path segments`);return r}function Sr(t){let e=Hh(t,"native.artifact_root");return e.length===0?".":e.join("/")}function El(t,e="docs"){let n=t??e;if(n!=="legacy"&&n!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return n}function ve(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||qe.posix.isAbsolute(r)||qe.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let i=r.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}function ye(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function _l(t,e,n){let r=t??e;if(r!=="en"&&r!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return r}function xl(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>Yo)throw new Error(`${e} exceeds ${Yo} characters`);let n=0;for(let r=0;r<t.length;r+=1)t[r]==="?"?n+=1:t[r]==="*"&&(n+=1,t[r+1]==="*"&&(r+=1));if(n>Go)throw new Error(`${e} contains more than ${Go} wildcard tokens`);return t}function Cl(t,e,n){if(t===void 0)return[...n];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(r=>xl(r,e)))].sort((r,i)=>r.localeCompare(i,"en"))}function Ho(t,e,n){let r=t??e;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${n} must be a positive integer`);return r}function Yh(t){if(t===void 0)return{...we,include:[...we.include],exclude:[...we.exclude]};let e=ye(t,"native.snapshot");return{include:Cl(e.include,"native.snapshot.include",we.include),exclude:Cl(e.exclude,"native.snapshot.exclude",we.exclude),max_files:Ho(e.max_files,we.max_files,"native.snapshot.max_files"),max_total_bytes:Ho(e.max_total_bytes,we.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Ho(e.max_duration_ms,we.max_duration_ms,"native.snapshot.max_duration_ms")}}function Gh(t){if(t===void 0)return;let e=ye(t,"native.pending_root_move"),n=e.id,r=e.from_artifact_root,i=e.to_artifact_root,o=e.stage;if(typeof n!="string"||!/^[a-f0-9-]{8,}$/u.test(n))throw new Error("native.pending_root_move.id is invalid");if(typeof r!="string"||typeof i!="string")throw new Error("native.pending_root_move roots must be strings");if(o!=="copying"&&o!=="ready"&&o!=="switched")throw new Error("native.pending_root_move.stage is invalid");let s;if(e.cleanup!==void 0){let a=ye(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,f=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof f!="string"||!/^[a-f0-9]{64}$/u.test(f))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");s={kind:c,state:l,manifestHash:f}}return{id:n,fromArtifactRoot:Sr(r),toArtifactRoot:Sr(i),stage:o,...s?{cleanup:s}:{}}}function Jh(t){if(t===void 0)return;let e=ye(t,"native.finish");if(e.pull_request===void 0)return{};let n=ye(e.pull_request,"native.finish.pull_request");if(n.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(n.command)||n.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(n.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let r=n.command.map((o,s)=>{if(typeof o!="string"||o.trim().length===0||o.length>4096||/[\0\r\n]/u.test(o))throw new Error(`native.finish.pull_request.command[${s}] must be a non-empty single-line string of at most 4096 characters`);return o});if(qe.posix.isAbsolute(r[0])||qe.win32.isAbsolute(r[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let i=n.timeout_ms??Mh;if(!Number.isSafeInteger(i)||i<1||i>Sl)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${Sl}`);return{pull_request:{provider:"repository-command",command:r,timeout_ms:i}}}function Vh(t,e={}){let n=ye(t,"native"),r=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let i=n.clarification_mode??"batch";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=n.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let s=n.max_verify_failures??Dh;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=Gh(n.pending_root_move),c=Jh(n.finish);return{artifact_root:Sr(r),language:_l(n.language,"en","native.language"),clarification_mode:i,archive_confirmation:o,max_verify_failures:s,snapshot:Yh(n.snapshot),...c?{finish:c}:{},...a?{pending_root_move:a}:{}}}function zh(t){let e=ye(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let r=e.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let i=e.auto_transition??!0;if(typeof i!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:El(e.artifact_layout),language:_l(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:r,auto_transition:i}}function Qh(t){let n=ye(t,"hook").allow_paths??[];if(!Array.isArray(n))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(n.map((r,i)=>ve(r,`hook.allow_paths[${i}]`)))]}}function Xh(t){if(t===void 0)return{...Uo};let e=ye(t,"memory"),n=e.learning??Uo.learning,r=e.retrieval??Uo.retrieval;if(typeof n!="boolean")throw new Error("memory.learning must be true or false");if(typeof r!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:n,retrieval:r}}function Vo(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Zh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||n.includes("\\")||n.includes("\0")||qe.posix.isAbsolute(n)||qe.win32.isAbsolute(n)||n.startsWith("~")||n.split("/").some(i=>i===""||i==="."||i===".."))throw new Error(`${e} must be a safe project-relative glob`);if(!n.toLowerCase().endsWith(".md"))throw new Error(`${e} must target a Markdown file ending in .md`);if(n.length>kl)throw new Error(`${e} exceeds ${kl} characters`);let r=0;for(let i=0;i<n.length;i+=1)n[i]==="?"?r+=1:n[i]==="*"&&(r+=1,n[i+1]==="*"&&(i+=1));if(r>bl)throw new Error(`${e} contains more than ${bl} wildcard tokens`);return n}function eg(t){let n=Vo(t,"knowledge.local").include??[];if(!Array.isArray(n))throw new Error("knowledge.local.include must be an array");return{include:[...new Set(n.map((r,i)=>Zh(r,`knowledge.local.include[${i}]`)))]}}function tg(t){if(typeof t!="string"||t.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let e;try{e=new URL(t)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let n=e.hostname.toLowerCase().replace(/^\[|\]$/gu,""),r=n==="localhost"||n==="127.0.0.1"||n==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&r))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function ng(t){let e=Vo(t,"knowledge.remote"),n=tg(e.endpoint),r=e.token_env;if(r!==void 0&&(typeof r!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(r)))throw new Error("knowledge.remote.token_env must be an environment variable name");let i=e.scope;if(i!==void 0&&(typeof i!="string"||i.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let o=e.timeout_ms??5e3;if(typeof o!="number"||!Number.isSafeInteger(o)||o<100||o>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:n,...r===void 0?{}:{token_env:r},...i===void 0?{}:{scope:i},timeout_ms:o}}function rg(t){if(t===void 0)return{...Fh};let e=Vo(t,"knowledge"),n=e.provider??"local";if(n!=="local"&&n!=="remote")throw new Error("knowledge.provider must be local or remote");let r=e.local===void 0?void 0:eg(e.local);if(n==="local")return{provider:n,...r?{local:r}:{}};let i=e.remote===void 0?void 0:ng(e.remote);if(i===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:n,...r?{local:r}:{},remote:i}}function ig(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function og(t,e,n,r,i,o,s,a){let c=t.schema!==void 0;if(!(c||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!c)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let f=t.workflows??[t.default_workflow];if(!Array.isArray(f)||f.length===0||f.some(d=>d!=="native"&&d!=="classic"))throw new Error("workflows must contain native and/or classic");let u=[...new Set(f)];if(!u.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(u.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:u,ambient_resume:s,...e?{hook:e}:{},memory:n,knowledge:r,...i?{native:i}:{},...o?{classic:o}:{}}}function wt(t,e={}){let n=(0,Jo.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let r=n.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let i=r,o=ig(i.ambient_resume),s=i.hook===void 0?void 0:Qh(i.hook),a=Xh(i.memory),c=rg(i.knowledge),l=i.native===void 0?void 0:Vh(i.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),f=i.classic===void 0?void 0:zh(i.classic),u=og(i,s,a,c,l,f,o,{allowPartialProject:e.allowPartialProject??!1});return{value:i,config:u,ambient_resume:o,memory:a,knowledge:c,...s?{hook:s}:{},...l?{native:l}:{},...f?{classic:f}:{}}}var Jo,rn,Yo,Go,kl,bl,Dh,Uo,Fh,Mh,Sl,Bh,Kh,Uh,we,ke=q(()=>{"use strict";Jo=Je(Le(),1),rn=64*1024,Yo=1024,Go=64,kl=1024,bl=64,Dh=5,Uo={learning:!0,retrieval:!0},Fh={provider:"local"},Mh=12e4,Sl=6e5,Bh=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".devin/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Kh=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],Uh=[...Bh,...Kh].sort((t,e)=>t.localeCompare(e,"en")),we={include:["**/*"],exclude:[...Uh],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});function We(t){return t!==0&&t!==0n&&t!=="0"}function Pl(t,e){return We(t.dev)&&We(e.dev)&&We(t.ino)&&We(e.ino)}function De(t,e){let n=We(t.dev)&&We(e.dev);if(n&&t.dev!==e.dev)return!1;let r=We(t.ino)&&We(e.ino);return r&&t.ino!==e.ino?!1:n&&r?!0:t.birthtime===e.birthtime}var Cr=q(()=>{"use strict"});import{constants as Er,promises as tt}from"fs";function zo(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Rl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function on(t){return{dev:t.dev,ino:t.ino,birthtime:zo(t)}}function _r(t,e){let n=on(t),r=on(e);return Pl(n,r)?De(n,r):De(n,r)&&zo(t)===zo(e)&&Rl(t)===Rl(e)&&t.size===e.size}async function xr(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=n.label??"file",i=n.bigint===!0,o=await tt.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new Fe("not-regular-file",`${r} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new Fe("too-large",`${r} exceeds ${e} bytes`);let s=await tt.realpath(t);await n.verify?.("pre-open",{realPath:s,identity:on(o)});let a=process.platform==="win32"?Er.O_RDONLY:Er.O_RDONLY|Er.O_NOFOLLOW|Er.O_NONBLOCK,c;try{c=await tt.open(t,a)}catch(l){throw l.code==="ELOOP"?new Fe("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,f,u]=await Promise.all([c.stat({bigint:i}),tt.lstat(t,{bigint:i}),tt.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==s||!_r(o,l)||!_r(o,f))throw new Fe("changed",`${r} changed while opening`);await n.verify?.("post-open",{realPath:u,identity:on(l)}),await n.hooks?.afterOpen?.();let d=[],h=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-h,{bytesRead:S}=await c.read(g,0,Math.min(g.length,y),null);if(S===0)break;if(h+=S,h>e)throw new Fe("too-large",`${r} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,S)))}await n.hooks?.beforeFinalCheck?.();let[p,m,w]=await Promise.all([c.stat({bigint:i}),tt.lstat(t,{bigint:i}),tt.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||w!==s||!_r(o,p)||!_r(o,m))throw new Fe("changed",`${r} changed while reading`);return await n.verify?.("post-read",{realPath:w,identity:on(p)}),{bytes:Buffer.concat(d,h),stat:p,realPath:w}}finally{await c.close()}}var Fe,Qo=q(()=>{"use strict";Cr();Fe=class extends Error{reason;constructor(e,n,r){super(n,r),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Me}from"fs";import ae from"path";function Ol(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Pr(t,e){let n=ae.relative(t,e);return n===""||!ae.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${ae.sep}`)}async function Xo(t,e){let n=ae.resolve(t),r=await Me.lstat(n);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Me.realpath(n)}async function Zo(t,e,n,r){let i=t;for(let o=0;o<n.length;o++){i=ae.join(i,n[o]);let s;try{s=await Me.lstat(i)}catch(f){if(Ol(f))return{exists:!1,kind:"missing"};throw f}let a=ae.relative(t,i).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${a}`);let c=o===n.length-1;if(!c&&!s.isDirectory())throw new Error(`${r.label} ancestor ${a} must be a real directory`);if(c&&(r.expected==="file"&&!s.isFile()||r.expected==="directory"&&!s.isDirectory()||r.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await Me.realpath(i);if(!Pr(e,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function N(t,e,n){let r=ve(e,n.label),i=ae.resolve(t),o=await Xo(i,n.label),s=r.split("/"),a=ae.resolve(i,...s);if(!Pr(i,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Zo(i,o,s,n);return{projectRoot:i,target:a,relative:r,exists:c.exists,kind:c.kind}}async function es(t,e,n){let r=ve(e,n.label),i=ae.resolve(t),o=await Xo(i,n.label),s=r.split("/"),a=i;for(let c of s){a=ae.join(a,c);let l;try{l=await Me.lstat(a)}catch(d){if(!Ol(d))throw d;try{await Me.mkdir(a)}catch(h){if(h.code!=="EEXIST")throw h}l=await Me.lstat(a)}let f=ae.relative(i,a).replaceAll("\\","/");if(l.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${f}`);if(!l.isDirectory())throw new Error(`${n.label} directory ${f} must be a real directory`);let u=await Me.realpath(a);if(!Pr(o,u))throw new Error(`${n.label} resolves outside the project root`)}return await Zo(i,o,s,{label:n.label,expected:"directory"}),a}async function Rr(t,e,n){return(await N(t,e,{...n,expected:"file"})).exists}async function D(t,e,n,r){let i=await N(t,e,{label:r.label,expected:"file"});if(!i.exists){let s=new Error(`${r.label} does not exist`);throw s.code="ENOENT",s}let o=await Xo(i.projectRoot,r.label);return xr(i.target,n,{...r,verify:async(s,a)=>{if(!Pr(o,a.realPath))throw new Error(`${r.label} resolves outside the project root`);await Zo(i.projectRoot,o,i.relative.split("/"),{label:r.label,expected:"file"})}})}var Q=q(()=>{"use strict";Qo();ke()});import{createHash as sg}from"crypto";function ag(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function an(t,e={}){return(await Or(t,e)).document}async function cg(t){try{return(await D(t,sn,rn,{label:sn})).bytes}catch(e){if(ag(e))return null;throw e}}function lg(t){return t?{exists:!0,sha256:sg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Or(t,e={}){let n=await cg(t);return{document:n?wt(n.toString("utf8"),e):null,identity:lg(n)}}async function ts(t){return(await an(t))?.config??null}var sn,yt=q(()=>{"use strict";ke();Q();sn=".comet/config.yaml"});import{randomUUID as ug}from"crypto";import{constants as fg,promises as T}from"fs";import B from"path";async function ns(t,e){try{return await T.link(t,e),{linked:!0}}catch(n){let r=n.code;if(r!=="ENOTSUP"&&r!=="EOPNOTSUPP")throw n}return await T.copyFile(t,e,fg.COPYFILE_EXCL),{linked:!1}}function nt(t,e){let n=B.relative(t,e);return n===""||!B.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${B.sep}`)}function Ar(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function dg(t,e){return De(t,Ar(e))}function Nr(t,e){return De(Ar(t),Ar(e))}function Al(t,e){return Nr(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Tr(t){let e=await T.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await T.realpath(t),...Ar(e)}}async function be(t){for(let e of t){let n=await T.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!dg(e,n)||await T.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function pg(t,e,n){let[r,i]=await Promise.all([T.lstat(t),T.realpath(t),be(n)]);if(!r.isFile()||r.isSymbolicLink()||!Nr(r,e)||!nt(n[0].realPath,i))throw new Error("Contained atomic write temporary file changed after close");return r}async function mg(t,e){let n=B.resolve(t),r=B.resolve(e);if(!nt(n,r))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let i=[await Tr(n)],o=B.relative(n,r).split(B.sep).filter(Boolean),s=n;for(let a of o){await be(i),s=B.join(s,a);try{await T.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Tr(s);if(!nt(i[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);i.push(c)}return await be(i),i}async function hg(t,e){let n=B.resolve(t),r=B.resolve(e);if(!nt(n,r))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await Tr(n)],o=B.relative(n,r).split(B.sep).filter(Boolean),s=n;for(let a of o){s=B.join(s,a);try{let c=await Tr(s);if(!nt(i[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await be(i),i}async function Nl(t){let e;try{e=await T.open(t,"r"),await e.sync()}catch(n){let r=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw n}finally{await e?.close()}}async function gg(t,e,n){let r=B.dirname(t),i=await mg(n.containedRoot,r),o=B.join(r,`.${B.basename(t)}.${ug()}.tmp`),s,a,c;try{await n.beforeTemporaryOpen?.(),s=await T.open(o,"wx"),a=await s.stat();let[l,f]=await Promise.all([T.lstat(o),T.realpath(o)]);if(await be(i),!l.isFile()||l.isSymbolicLink()||!Nr(a,l)||!nt(i[0].realPath,f))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),c=await s.stat(),!Nr(a,c))throw new Error("Contained atomic write temporary file changed while writing");if(await s.close(),s=void 0,await n.afterTemporaryClose?.(),!c)throw new Error("Contained atomic write temporary file was not written");c=await pg(o,c,i),await n.beforeCommit?.(),await be(i);let u=await T.lstat(o);if(!u.isFile()||u.isSymbolicLink()||!c||!Al(u,c))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await ns(o,t),await T.unlink(o)):await T.rename(o,t),await Nl(r)}catch(l){await s?.close();try{await be(i),await T.rm(o,{force:!0})}catch{}throw l}}async function ee(t,e,n){await gg(t,e,n)}async function rs(t,e){let n=B.dirname(t),r=await hg(e.containedRoot,n);if(!r)return!1;let i,o;try{i=await T.lstat(t),o=await T.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!i.isFile()||i.isSymbolicLink()||!nt(r[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await be(r);let[s,a]=await Promise.all([T.lstat(t),T.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!Al(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await T.unlink(t),await be(r),await Nl(n),!0}var Be=q(()=>{"use strict";Cr()});var Rk,is=q(()=>{"use strict";Be();yt();Q();Rk=16*1024});var ss=q(()=>{"use strict";Be();ke();yt();Q();is()});var Fr=q(()=>{"use strict"});var Gl=q(()=>{"use strict"});var us=q(()=>{"use strict";Fr()});var Jl=q(()=>{"use strict";Fr();us()});var Xg,Vl=q(()=>{"use strict";Xg=Je(Le(),1);Be();ke();Q()});var Wb,zl=q(()=>{"use strict";Be();Q();Wb=4*1024*1024});function Xl(t,e){let n=t;for(let r of e)n+="\0"+(typeof r=="string"?r:JSON.stringify(r));return n}function Mr(t,e){return(...n)=>{let r=Ql;if(r===null)return e(...n);let i=Xl(`async:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n).catch(a=>{throw r.entries.delete(i),a});return r.entries.set(i,{value:s}),s}}function fs(t,e){return(...n)=>{let r=Ql;if(r===null)return e(...n);let i=Xl(`sync:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n);return r.entries.set(i,{value:s}),s}}var Ql,Br=q(()=>{"use strict";Ql=null});var Kb,Zl=q(()=>{"use strict";Br();yt();Kb=Mr("hookWritePolicy",async t=>(await ts(t))?.hook??{allow_paths:[]})});var eu=q(()=>{"use strict";Fr();Be();Gl();Jl();ke();Vl();Q();yt();ss();zl();Zl();is();us()});import{TextDecoder as Zg}from"util";function tu(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function ew(t,e){try{return new Zg("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function ds(t,e,n,r,i={}){try{let o=await D(t,e,n,{label:r,hooks:i.hooks});return{result:o,text:ew(o,r)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function Ue(t,e,n,r,i={}){return(await ds(t,e,n,r,i))?.text??null}async function He(t,e,n,r,i,o={}){if(Buffer.byteLength(n,"utf8")>r)throw new Error(`${i} exceeds ${r} bytes`);let s=await ds(t,e,r,i),a=await N(t,e,{label:i,expected:"file"});await ee(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await ds(t,e,r,i);if(!(!s&&!c)){if(!s||!c)throw new Error(`${i} changed before commit`);if(s.result.realPath!==c.result.realPath||!De(tu(s.result.stat),tu(c.result.stat))||s.text!==c.text)throw new Error(`${i} changed before commit`)}}})}async function Kr(t,e,n,r,i,o={}){let s=await Ue(t,e,r,i);await He(t,e,`${s??""}${n}`,r,i,o)}async function Ur(t,e,n,r={}){let i=await N(t,e,{label:n,expected:"file"});return i.exists?rs(i.target,{containedRoot:i.projectRoot,beforeRemove:r.beforeRemove}):!1}var Hr=q(()=>{"use strict";eu();Cr()});var iu={};af(iu,{RUN_STATE_FILE:()=>Gr,applyRunStateToDocument:()=>ps,readRunState:()=>ms,removeRunState:()=>hs,runStateFromDocument:()=>Yr,writeRunState:()=>Jr});import tw from"path";function yn(t,e){let n=t[e];if(typeof n!="string"||n.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return n}function wn(t,e){let n=yn(t,e);if(tw.isAbsolute(n)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return n}function nw(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(r){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:r})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let r of Object.values(n))if(!Number.isInteger(r)||Number(r)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function Yr(t){if(!t.run_id)return null;let e=yn(t,"run_id"),n=yn(t,"skill"),r=yn(t,"skill_version"),i=yn(t,"skill_hash"),o=wn(t,"pending_ref"),s=wn(t,"trajectory_ref"),a=wn(t,"context_ref"),c=wn(t,"artifacts_ref"),l=wn(t,"checkpoint_ref"),f=Number(t.iteration);if(!Number.isInteger(f)||f<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:n,skillVersion:r,skillHash:i,orchestration:t.orchestration,currentStep:nu(t,"current_step"),iteration:f,pending:nu(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:nw(t)}}function ps(t,e){e?t.run_id=e.runId:delete t.run_id}function rw(t){return{runId:t.runId,skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash,orchestration:t.orchestration,currentStep:t.currentStep,iteration:t.iteration,pending:t.pending,pendingRef:t.pendingRef,trajectoryRef:t.trajectoryRef,contextRef:t.contextRef,artifactsRef:t.artifactsRef,checkpointRef:t.checkpointRef,status:t.status,retries:t.retries}}function iw(t){let e={run_id:t.runId,skill:t.skill,skill_version:t.skillVersion,skill_hash:t.skillHash,orchestration:t.orchestration,current_step:t.currentStep,iteration:t.iteration,pending:t.pending,pending_ref:t.pendingRef,trajectory_ref:t.trajectoryRef,context_ref:t.contextRef,artifacts_ref:t.artifactsRef,checkpoint_ref:t.checkpointRef,run_status:t.status,run_retries:JSON.stringify(t.retries)};return Yr(e)}async function ms(t,e={}){let n=await Ue(t,Gr,ru,"Run state",e);if(n===null)return null;let r=JSON.parse(n);return iw(r)}async function Jr(t,e,n={}){await He(t,Gr,JSON.stringify(rw(e),null,2),ru,"Run state",n)}async function hs(t,e={}){await Ur(t,Gr,"Run state",e)}var nu,Gr,ru,Vr=q(()=>{"use strict";Hr();nu=(t,e)=>{let n=t[e];return n==null?null:String(n)};Gr=".comet/run-state.json",ru=256*1024});import{createHash as Cy}from"crypto";import{promises as Ey}from"fs";import me from"path";import{spawnSync as Rg}from"child_process";function lf(t){return t.length>0&&/^[A-Za-z0-9@+=:,./\\_-]+$/.test(t)?t:`"${t.replace(/"/g,'""')}"`}function Ns(t){return t.map(e=>lf(e))}import{promises as $l}from"fs";import j from"path";import{promises as uf}from"fs";async function xt(t){try{return await uf.access(t),!0}catch(e){if(ff(e))return!1;throw e}}function ff(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ke();yt();ss();Q();var vt=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},Il=".comet/config.yaml";function Ll(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ql(t){await N(t,Il,{label:Il,expected:"file"})}function jr(t,e){let n=j.resolve(t),r=e==="docs"?j.join(n,"docs"):n,i=j.join(r,"openspec"),o=j.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:r,openSpecRoot:i,changesDir:j.join(i,"changes"),archiveDir:j.join(i,"changes","archive"),specsDir:j.join(i,"specs"),superpowersRoot:o,superpowersSpecsDir:j.join(o,"specs"),superpowersPlansDir:j.join(o,"plans"),superpowersReportsDir:j.join(o,"reports")}}async function bg(t){await ql(t);let e=await an(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new vt;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new vt("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function Sg(t,e){return jr(t,e??await bg(t))}async function Cg(t){try{return await $l.lstat(t),!0}catch(e){if(Ll(e))return!1;throw e}}async function Eg(t,e){let n=await Sg(t,e),r=n.artifactLayout==="legacy"?"docs":"legacy",i=jr(t,r).openSpecRoot,[o,s]=await Promise.all([N(n.projectRoot,$(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),Cg(i)]),a=o.exists;return{paths:n,configuredRootExists:a,alternateRoot:i,alternateRootExists:s,dualRoots:a&&s}}async function _g(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let n of e){let r=$(t.projectRoot,n);await N(t.projectRoot,r,{label:`Classic managed physical path ${r}`,expected:"directory"})}}async function ce(t,e){let n=await Eg(t,e);if(await _g(n.paths),!n.configuredRootExists){let r=$(n.paths.projectRoot,n.paths.openSpecRoot),i=$(n.paths.projectRoot,n.alternateRoot);throw new vt(`Configured Classic OpenSpec root is missing: ${r} (alternate ${i} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function cn(t,e){let n=j.join(j.resolve(t),".comet","classic-root-move.json");if(await xt(n))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let r=await ce(t,e);if(!await xt(r.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${$(r.projectRoot,r.openSpecRoot)}`);return r}async function Se(t){let e=j.resolve(t),n=null;try{(await $l.lstat(e)).isDirectory()||(e=j.dirname(e))}catch(r){if(!Ll(r))throw r}for(;;){j.basename(e)==="openspec"&&(n=j.dirname(e));let r=j.join(e,".comet","config.yaml"),i=!1;if(await xt(r))try{await ql(e);let s=(await an(e))?.value;i=!!s&&typeof s=="object"&&!Array.isArray(s)&&(s.schema==="comet.project.v1"||s.default_workflow!==void 0||s.native!==void 0)}catch{}if(i||await xt(j.join(e,".git")))return e;let o=j.dirname(e);if(o===e)return n??j.resolve(t);e=o}}function $(t,e){return j.relative(j.resolve(t),e).replaceAll("\\","/")}var Wl=Je(Le(),1);Q();import xg from"path";var Pg=1024*1024;async function Dl(t,e){let n=e??await ce(t),r=xg.join(n.openSpecRoot,"config.yaml"),i=$(n.projectRoot,r),o;try{o=(await D(n.projectRoot,i,Pg,{label:"Classic OpenSpec project config",bigint:!0})).bytes.toString("utf8")}catch(l){throw l.code==="ENOENT"?new Error(`Classic OpenSpec root is unhealthy: ${i} is missing; rerun OpenSpec initialization for the configured Classic layout`,{cause:l}):new Error(`Classic OpenSpec root is unhealthy: ${l instanceof Error?l.message:String(l)}`,{cause:l})}let s=(0,Wl.parseDocument)(o,{uniqueKeys:!0});if(s.errors.length>0)throw new Error(`Classic OpenSpec root is unhealthy: ${i} is invalid YAML (${s.errors[0].message})`);let a=s.toJS();if(!a||typeof a!="object"||Array.isArray(a))throw new Error(`Classic OpenSpec root is unhealthy: ${i} must contain a mapping`);let c=a.schema;if(typeof c!="string"||c.trim()==="")throw new Error(`Classic OpenSpec root is unhealthy: ${i} must declare a non-empty schema`);return{layout:n,configPath:i,schema:c}}function Og(t){return t[0]==="--"?t.slice(1):[...t]}async function Fl(t,e=process.cwd()){let n=Og(t);if(n.length===0)return{exitCode:64,stderr:"Usage: comet classic openspec -- <openspec-args...>"};let r=await Se(e),i=await cn(r);await Dl(r,i);let o=process.env.COMET_OPENSPEC||"openspec",s=process.platform==="win32",a=Rg(o,s?Ns(n):n,{cwd:i.openSpecBase,encoding:"utf8",shell:s,windowsHide:!0});if(a.error){let c=a.error.code;return{exitCode:c==="ENOENT"?127:70,stdout:a.stdout||void 0,stderr:a.stderr||(c==="ENOENT"?`OpenSpec CLI not found: ${o}`:a.error.message)}}return{exitCode:a.status??1,stdout:a.stdout||void 0,stderr:a.stderr||void 0}}function as(t){return t==="zh-CN"?"zh-CN":"en"}function Ml(t,e,n){return t==="zh-CN"?n:e}function Bl(t){let{name:e,stepsOk:n,stepsTotal:r,dryRun:i,locale:o}=t,s=n===r;return i?{summary:Ml(o,`Archive dry run for ${e}: ${s?`all ${r} steps would succeed`:`${r-n} of ${r} steps would fail`}.`,`需求 ${e} 归档预演:${s?`全部 ${r} 步均可成功`:`${r-n}/${r} 步会失败`}。`)}:{summary:Ml(o,s?`Change ${e} was archived successfully (${n}/${r} steps).`:`Archive for ${e} stopped: ${r-n} of ${r} steps failed.`,s?`需求 ${e} 归档成功(${n}/${r} 步)。`:`需求 ${e} 归档中止:${r-n}/${r} 步失败。`)}}import{promises as Tg}from"fs";import dn from"path";Be();ke();Q();import ln from"path";var Ag=2*1024*1024;function Ir(t,e,n){let r=ln.resolve(t),i=ln.isAbsolute(e)?ln.resolve(e):ln.resolve(r,e),o=ln.relative(r,i).replaceAll("\\","/");return{root:r,relative:ve(o,n),target:i}}async function Ke(t,e,n){let r=Ir(t,e,n.label);return N(r.root,r.relative,n)}async function un(t,e,n){return(await Ke(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function fn(t,e,n){return(await Ng(t,e,n)).toString("utf8")}async function Ng(t,e,n){let r=Ir(t,e,n.label);return(await D(r.root,r.relative,n.maxBytes??Ag,{label:n.label,hooks:n.hooks})).bytes}async function cs(t,e,n){let r=Ir(t,e,n);return es(r.root,r.relative,{label:n})}async function Kl(t,e,n,r){let i=Ir(t,e,r.label);await N(i.root,i.relative,{label:r.label,expected:"file"}),await ee(i.target,n,{containedRoot:i.root,beforeTemporaryOpen:r.beforeTemporaryOpen,beforeCommit:r.beforeCommit,exclusive:r.exclusive})}function ls(t){return t?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t)?t.includes("..")?"Change name cannot contain '..' (path traversal not allowed)":null:`Invalid change name: '${t}'
143
+ Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function kt(t){let e=ls(t);if(e)throw new Error(e)}function jg(t,e){return{label:$(t,e),directory:e}}async function $r(t,e,n){let r=jg(t,e);if(!(await Ke(t,e,{label:n,expected:"directory"})).exists)return{change:r,exists:!1,stateExists:!1};let o=await Ke(t,dn.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:r,exists:!0,stateExists:o.exists}}function Ul(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function Ig(t,e,n,r={}){if(!r.skipExactCompatibility){let s=await $r(t,dn.join(e,n),`Classic archived change ${n}`);if(s.exists)return s.change}if(!(await Ke(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let o=[];for(let s of await Tg.readdir(e,{withFileTypes:!0})){if(!Ul(s.name,n))continue;let a=await $r(t,dn.join(e,s.name),`Classic archived change ${s.name}`);a.exists&&a.stateExists&&o.push(a.change)}return o.sort((s,a)=>a.directory.localeCompare(s.directory))[0]??null}async function Lr(t,e=process.cwd()){kt(t);let n=await ce(e),r=await $r(n.projectRoot,dn.join(n.changesDir,t),`Classic active change ${t}`);return{...r.change,exists:r.exists,stateExists:r.stateExists}}async function qr(t,e=process.cwd(),n={}){kt(t);let r=await ce(e);if(n.preferredArchiveName!==void 0){let i=n.preferredArchiveName;if(i!==t&&!Ul(i,t))throw new Error(`Classic preferred archive name '${i}' does not belong to change '${t}'`);let o=await $r(r.projectRoot,dn.join(r.archiveDir,i),`Classic preferred archived change ${i}`);return o.exists&&o.stateExists?o.change:null}return Ig(r.projectRoot,r.archiveDir,t,n)}import{promises as Wu}from"fs";import X from"path";import{fileURLToPath as Du}from"url";import{promises as Lg}from"fs";import Ce from"path";Q();ke();import pn from"path";function $g(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Hl(t,e,n,r){let i=ve(n,"Classic handoff artifact pointer");if((await N(t,i,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let s=await ce(t),a=`${$(t,s.changesDir)}/`,l=(s.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(y=>i.startsWith(y));if(!l)return null;let f=i.slice(l.length).split("/");if(f.length<4||f[1]!==".comet"||f.slice(2).some(y=>y.length===0))return null;let u=f[0];kt(u);let d=f.slice(2),h=pn.resolve(e);if(pn.dirname(h)!==pn.resolve(s.archiveDir))return null;let g=pn.basename(h),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(g);if(g!==u&&p?.[1]!==u)return null;await N(t,$(t,h),{label:"Classic archived change directory",expected:"directory"});let m=pn.join(h,".comet",...d),w=$(t,m);try{return await D(t,w,r,{label:"Historical Classic archived handoff artifact"}),w}catch(y){if($g(y))return null;throw y}}Q();var Yl=2*1024*1024;function mn(t,e){return Ce.relative(t,e).split(Ce.sep).join("/")}async function hn(t,e,n,r,i){if(!n)return{code:e,satisfied:!1};let o=n.replaceAll("\\","/");if(i)return{code:e,satisfied:!1,source:o,detail:`Classic layout is unsafe or unavailable: ${i instanceof Error?i.message:String(i)}`};try{if(r){let a=r.artifactLayout==="legacy"?"docs":"legacy",c=$(t,jr(t,a).openSpecRoot);if((o===c||o.startsWith(`${c}/`))&&(await N(t,o,{label:`${e} artifact`,expected:"file"})).exists)return{code:e,satisfied:!1,source:o,detail:"standalone OpenSpec root is not a Comet artifact root"}}let s=await Rr(t,o,{label:`${e} artifact`});return{code:e,satisfied:s,source:o,...s?{resolvedSource:o}:{}}}catch(s){return{code:e,satisfied:!1,source:o,detail:`unsafe artifact pointer outside the project or through a special path: ${s instanceof Error?s.message:String(s)}`}}}async function qg(t,e,n,r){try{r??=await ce(t)}catch(o){return{code:"design.handoff",satisfied:!1,...n?{source:n.replaceAll("\\","/")}:{},detail:`Classic layout is unsafe or unavailable for handoff evidence: ${o instanceof Error?o.message:String(o)}`}}let i=await hn(t,"design.handoff",n,r);if(!n||i.satisfied||i.detail)return i;try{let o=await Hl(t,e,n,Yl);return o?{...i,satisfied:!0,resolvedSource:o,detail:`resolved historical legacy pointer from archived change: ${o}`}:i}catch(o){return{...i,satisfied:!1,detail:`unsafe archived handoff fallback: ${o instanceof Error?o.message:String(o)}`}}}async function Wr(t,e,n){return hn(t,e,mn(t,n))}async function Wg(t,e){let n=Ce.join(e,"specs"),r;try{let s=mn(t,n);if(!(await N(t,s,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};r=await Lg.readdir(n)}catch(s){return s.code==="ENOENT"?{code:"openspec.delta-spec",satisfied:!1}:{code:"openspec.delta-spec",satisfied:!1,detail:`unsafe delta-spec path: ${s instanceof Error?s.message:String(s)}`}}let i=r.map(s=>Ce.join(n,s,"spec.md")),o=(await Promise.all(i.map(async s=>{try{return await Rr(t,mn(t,s),{label:"OpenSpec delta spec"})?s:null}catch{return null}}))).filter(s=>s!==null);return{code:"openspec.delta-spec",satisfied:o.length>0,source:o[0]?mn(t,o[0]):void 0,detail:`${o.length} delta spec${o.length===1?"":"s"}`}}async function Dg(t,e){let n,r=mn(t,e);try{n=(await D(t,r,Yl,{label:"Classic tasks artifact"})).bytes.toString("utf8")}catch(s){return s.code==="ENOENT"?{code:"build.tasks-complete",satisfied:!1}:{code:"build.tasks-complete",satisfied:!1,source:r,detail:`unsafe tasks artifact: ${s instanceof Error?s.message:String(s)}`}}let i=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],o=i.filter(s=>s[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:i.length>0&&o===i.length,source:r,detail:`${o} of ${i.length} tasks complete`}}function gn(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function bt(t,e){let n=await Se(t),r=e.classic,i=Ce.join(t,"proposal.md"),o=Ce.join(t,"design.md"),s=Ce.join(t,"tasks.md"),a=e.run?Ce.resolve(t,e.run.checkpointRef):Ce.join(t,".comet","checkpoint.json"),c,l;try{c=await ce(n)}catch(d){l=d}let f=await Promise.all([Wr(n,"openspec.proposal",i),Wr(n,"openspec.design",o),Wr(n,"openspec.tasks",s),Wg(n,t),hn(n,"design.document",r?.designDoc??null,c,l),hn(n,"build.plan",r?.plan??null,c,l),Dg(n,s),hn(n,"verification.report",r?.verificationReport??null,c,l),qg(n,t,r?.handoffContext??null,c),Wr(n,"run.checkpoint",a)]),u=f.find(d=>d.code==="design.handoff");return u&&!r?.handoffHash&&(u.satisfied=!1,u.detail="handoff hash is missing"),f.push({code:"archive.confirmed",satisfied:r?.archiveConfirmation==="confirmed"}),f}import{createHash as Qw,randomUUID as Xw}from"crypto";import{promises as Cs}from"fs";import _e from"path";function Fg(t){return t.classicProfile??t.workflow}function Mg(t){return!t.buildMode||!t.tddMode||!t.isolation||!t.verifyMode?!1:t.buildMode==="subagent-driven-development"?t.subagentDispatch==="confirmed":t.buildMode==="direct"?t.directOverride===!0:!0}function Bg(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function Kg(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!gn(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!Mg(e))return"full.build.configure"}else if(!Bg(e))throw new Error(`${t} build configuration is incomplete`);return gn(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function Ug(t,e,n){return e.verifyResult!=="pass"||!gn(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Hg(t,e){if(e.verifyResult!=="pass")throw new Error("archive requires verify_result=pass");return e.archiveConfirmation==="confirmed"?`${t}.archive.execute`:`${t}.archive.confirm`}function Dr(t,e){let n=Fg(t);if(t.archived&&t.phase!=="archive")throw new Error("archived=true requires phase=archive");if(t.archived)return"completed";if(n!=="full"&&t.phase==="design")throw new Error(`${n} workflow cannot enter design`);switch(t.phase){case"open":return`${n}.open`;case"design":return gn(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return Kg(n,t,e);case"verify":return Ug(n,t,e);case"archive":return Hg(n,t)}}var Zr=Je(Le(),1);Be();Q();import Xr from"path";Vr();var ou=["full","hotfix","tweak"],rt=1,ow=["open","design","build","verify","archive"],sw=["en","zh-CN"],aw=["off","beta"],cw=["subagent-driven-development","executing-plans","direct"],lw=["plan-ready"],uw=["confirmed"],fw=["tdd","direct"],dw=["off","standard","thorough"],pw=["current","branch","worktree"],mw=["light","full"],hw=["pending","pass","fail"],gw=["pending","handled"],ww=["pending","confirmed"],Qr=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],yw=["run_id"],vw=new Set([...Qr,...yw]),kw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function su(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function St(t,e){let n=t[e];if(n==null||n==="")return null;if(typeof n!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return n}function U(t,e,n,r=!0){let i=t[e];if(i==null||i===""){if(r)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="string"||!n.includes(i))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${r?" or null":""}`);return i}function gs(t,e,n=!0){let r=t[e];if(r==null||r===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return r}function bw(t,e,n=0){let r=t[e];if(r==null||r==="")return n;if(typeof r!="number"||!Number.isInteger(r)||r<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return r}function zr(t,e){let n=St(t,e);if(n===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return n}function Sw(t,e){let n=St(t,e);if(n!==null&&!/^[a-f0-9]{64}$/u.test(n))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return n}function Cw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==rt)throw new Error(`Invalid Classic state: classic_migration must be ${rt}`);return e}function Ew(t){if(!Qr.some(n=>su(t,n)))return null;for(let n of kw)if(!su(t,n))return null;return{workflow:U(t,"workflow",ou,!1),language:U(t,"language",sw),phase:U(t,"phase",ow,!1),contextCompression:U(t,"context_compression",aw),buildMode:U(t,"build_mode",cw),buildPause:U(t,"build_pause",lw),subagentDispatch:U(t,"subagent_dispatch",uw),tddMode:U(t,"tdd_mode",fw),reviewMode:U(t,"review_mode",dw),isolation:U(t,"isolation",pw),boundBranch:St(t,"bound_branch"),verifyMode:U(t,"verify_mode",mw),autoTransition:gs(t,"auto_transition"),baseRef:St(t,"base_ref"),designDoc:zr(t,"design_doc"),plan:zr(t,"plan"),verifyResult:U(t,"verify_result",hw,!1),verifyFailures:bw(t,"verify_failures"),verificationReport:zr(t,"verification_report"),branchStatus:U(t,"branch_status",gw),createdAt:St(t,"created_at"),verifiedAt:St(t,"verified_at"),archiveConfirmation:U(t,"archive_confirmation",ww),archived:gs(t,"archived",!1),directOverride:gs(t,"direct_override"),handoffContext:zr(t,"handoff_context"),handoffHash:Sw(t,"handoff_hash"),classicProfile:U(t,"classic_profile",ou),classicMigration:Cw(t)}}function ws(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=Yr(t)}catch(r){let i=r instanceof Error?r.message:String(r);throw new Error(i.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:r})}return{classic:Ew(t),run:n,unknownKeys:Object.keys(t).filter(r=>!vw.has(r))}}function au(t){return{workflow:t.workflow,language:t.language,phase:t.phase,context_compression:t.contextCompression,build_mode:t.buildMode,build_pause:t.buildPause,subagent_dispatch:t.subagentDispatch,tdd_mode:t.tddMode,review_mode:t.reviewMode,isolation:t.isolation,bound_branch:t.boundBranch,verify_mode:t.verifyMode,auto_transition:t.autoTransition,base_ref:t.baseRef,design_doc:t.designDoc,plan:t.plan,verify_result:t.verifyResult,verify_failures:t.verifyFailures,verification_report:t.verificationReport,branch_status:t.branchStatus,created_at:t.createdAt,verified_at:t.verifiedAt,archive_confirmation:t.archiveConfirmation,archived:t.archived,direct_override:t.directOverride,handoff_context:t.handoffContext,handoff_hash:t.handoffHash,classic_profile:t.classicProfile,classic_migration:t.classicMigration}}Vr();var _w=2*1024*1024;function vn(t){let e=t.toJS();if(e===null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("Invalid Classic state document: root must be a mapping");return e}function cu(t,e,n){t.get(e)!==n&&t.set(e,n)}function xw(t,e){if(e.classic)for(let[n,r]of Object.entries(au(e.classic)))cu(t,n,r);else for(let n of Qr)t.delete(n);ps(t.toJS(),e.run),e.run?cu(t,"run_id",e.run.runId):t.delete("run_id")}function Pw(t){let e=["skill","skill_version","skill_hash","orchestration","current_step","iteration","pending","pending_ref","trajectory_ref","context_ref","artifacts_ref","checkpoint_ref","run_status","run_retries"];for(let n of e)t.delete(n)}function Rw(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function lu(t){let e;try{e=(await D(Xr.dirname(t),Xr.basename(t),_w,{label:"Classic state document"})).bytes.toString("utf8")}catch(r){if(r.code!=="ENOENT")throw r;return new Zr.Document({})}let n=(0,Zr.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return vn(n),n}async function de(t,e={}){let n=e.migrate!==!1,r=Xr.join(t,".comet.yaml"),i=await lu(r),o=vn(i),s=Rw(i);s&&(o=vn(i));let a=await ms(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Vr(),iu));a=c(o),a&&n&&(await Jr(t,a),Pw(i),s=!0)}return s&&n&&await ee(r,i.toString(),{containedRoot:t}),ws(vn(i),a)}async function it(t,e,n={}){let r=Xr.join(t,".comet.yaml"),i=await lu(r);xw(i,{...e,unknownKeys:e.unknownKeys??[]}),ws(vn(i),e.run??null),await ee(r,i.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await Jr(t,e.run):await hs(t)}function uu(t,e,n){return{runId:e,skill:t.definition.metadata.name,skillVersion:t.definition.metadata.version,skillHash:n,orchestration:t.definition.orchestration.mode,currentStep:t.definition.orchestration.entry??null,iteration:0,pending:null,pendingRef:".comet/pending-action.json",trajectoryRef:".comet/trajectory.jsonl",contextRef:".comet/context.md",artifactsRef:".comet/artifacts.json",checkpointRef:".comet/checkpoint.json",status:"running",retries:{}}}Hr();import ei from"path";var Ee={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function pe(t,e){if(ei.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=ei.resolve(t),r=ei.resolve(n,e);if(r!==n&&!r.startsWith(n+ei.sep))throw new Error("Run path must stay inside the change directory")}async function Ct(t,e,n,r={}){pe(t,e),await Kr(t,e,`${JSON.stringify(n)}
144
+ `,Ee.trajectory,"Run trajectory",r)}async function kn(t,e,n={}){pe(t,e);let r=await Ue(t,e,Ee.trajectory,"Run trajectory",n);return r===null?[]:r.split(/\r?\n/).map((i,o)=>({line:i,number:o+1})).filter(({line:i})=>i.length>0).map(({line:i,number:o})=>{try{return JSON.parse(i)}catch(s){throw new Error(`Invalid Trajectory event at line ${o}`,{cause:s})}})}async function ys(t,e,n={}){pe(t,e);let r=await Ue(t,e,Ee.artifacts,"Run artifacts",n);return r===null?{}:JSON.parse(r)}async function ti(t,e,n,r={}){pe(t,e),await He(t,e,JSON.stringify(n,null,2)+`
145
+ `,Ee.artifacts,"Run artifacts",r)}async function fu(t,e,n,r={}){pe(t,e),await He(t,e,n,Ee.context,"Run context",r)}async function du(t,e,n={}){return pe(t,e),Ue(t,e,Ee.context,"Run context",n)}async function pu(t,e,n,r={}){pe(t,e),await He(t,e,JSON.stringify(n,null,2)+`
146
+ `,Ee.pendingAction,"Run pending action",r)}async function mu(t,e,n={}){pe(t,e);let r=await Ue(t,e,Ee.pendingAction,"Run pending action",n);return r===null?null:JSON.parse(r)}async function hu(t,e,n={}){pe(t,e),await Ur(t,e,"Run pending action",n)}async function ni(t,e,n,r={}){pe(t,e),await He(t,e,JSON.stringify(n,null,2)+`
147
+ `,Ee.checkpoint,"Run checkpoint",r)}import{createHash as Ou,randomUUID as Yw}from"crypto";import{promises as F}from"fs";import L from"path";var yu=Je(Le(),1);import{promises as vs}from"fs";import te from"path";var Ow=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],Aw=["deterministic","adaptive"],Nw=["function","mcp","script","agent"],Tw=["none","read","write","external"],jw=["progress","step","completion"],Iw=["artifact_exists","state_equals"];function ot(t,e,n){return new Error(`${t}: ${e} ${n}`)}function J(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw ot(e,n,"must be an object")}function Ye(t,e,n){if(!Array.isArray(t))throw ot(e,n,"must be an array")}function H(t,e,n){if(typeof t!="string")throw ot(e,n,"must be a string")}function le(t,e,n,r){e in t&&H(t[e],n,`${r}.${e}`)}function vu(t,e,n,r){if(e in t&&typeof t[e]!="boolean")throw ot(n,`${r}.${e}`,"must be a boolean")}function Ge(t,e,n,r){if(typeof t!="string"||!e.includes(t))throw ot(n,r,`must be one of ${e.join(", ")}`)}function ri(t,e,n){Ye(t,e,n),t.forEach((r,i)=>{H(r,e,`${n}[${i}]`)})}function gu(t,e,n){J(t,e,n),H(t.name,e,`${n}.name`),H(t.description,e,`${n}.description`),vu(t,"required",e,n)}function $w(t,e,n){J(t,e,n),H(t.id,e,`${n}.id`),le(t,"source",e,n),le(t,"version",e,n)}function Lw(t,e,n){J(t,e,n),H(t.id,e,`${n}.id`),H(t.role,e,`${n}.role`),le(t,"instructions",e,n)}function qw(t,e,n){J(t,e,n),H(t.id,e,`${n}.id`),Ge(t.kind,Nw,e,`${n}.kind`),H(t.source,e,`${n}.source`),Ge(t.sideEffect,Tw,e,`${n}.sideEffect`),vu(t,"requiresConfirmation",e,n)}function Ww(t,e,n){J(t,e,n),Ge(t.type,Ow,e,`${n}.type`),le(t,"ref",e,n),le(t,"prompt",e,n),le(t,"question",e,n),"options"in t&&ri(t.options,e,`${n}.options`)}function Dw(t,e,n){J(t,e,n),H(t.id,e,`${n}.id`),Ww(t.action,e,`${n}.action`),le(t,"next",e,n),"completionEvals"in t&&ri(t.completionEvals,e,`${n}.completionEvals`)}function Fw(t,e){let n="goal";J(t,e,n),H(t.statement,e,`${n}.statement`),Ye(t.inputs,e,`${n}.inputs`),t.inputs.forEach((r,i)=>{gu(r,e,`${n}.inputs[${i}]`)}),Ye(t.outputs,e,`${n}.outputs`),t.outputs.forEach((r,i)=>{gu(r,e,`${n}.outputs[${i}]`)}),ri(t.success,e,`${n}.success`)}function Mw(t,e){let n="orchestration";J(t,e,n),Ge(t.mode,Aw,e,`${n}.mode`),le(t,"entry",e,n),"steps"in t&&(Ye(t.steps,e,`${n}.steps`),t.steps.forEach((r,i)=>{Dw(r,e,`${n}.steps[${i}]`)}))}function ku(t,e){return J(t,e),Ge(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ge(t.kind,["Skill"],e,"kind"),J(t.metadata,e,"metadata"),H(t.metadata.name,e,"metadata.name"),H(t.metadata.version,e,"metadata.version"),H(t.metadata.description,e,"metadata.description"),Fw(t.goal,e),Mw(t.orchestration,e),Ye(t.skills,e,"skills"),t.skills.forEach((n,r)=>{$w(n,e,`skills[${r}]`)}),Ye(t.agents,e,"agents"),t.agents.forEach((n,r)=>{Lw(n,e,`agents[${r}]`)}),Ye(t.tools,e,"tools"),t.tools.forEach((n,r)=>{qw(n,e,`tools[${r}]`)}),t}function bu(t,e){J(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&ri(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw ot(e,n,"must be a finite number");return t}function Bw(t,e){return J(t,e),"runtime"in t&&Su(t.runtime,e,"runtime"),t}function Su(t,e,n){return Ye(t,e,n),t.forEach((r,i)=>{let o=`${n}[${i}]`;J(r,e,o),H(r.id,e,`${o}.id`),Ge(r.scope,jw,e,`${o}.scope`),Ge(r.type,Iw,e,`${o}.type`),le(r,"artifact",e,o),le(r,"field",e,o),le(r,"equals",e,o)}),t}async function ks(t){let e=await vs.readFile(t,"utf8");try{return(0,yu.parse)(e)}catch(n){let r=n instanceof Error?n.message:String(n);throw ot(t,"document",r)}}async function Kw(t){try{return await ks(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function wu(t){try{return await vs.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Uw(t){let e=te.join(t,"checks.yaml"),n=te.join(t,"evals.yaml"),[r,i]=await Promise.all([wu(e),wu(n)]);if(i)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return r?{document:Bw(await ks(e),e)}:{document:null}}async function Cu(t){let e=te.resolve(t.root),n=te.resolve(t.controlRoot);t.requireSkillMarkdown&&await vs.access(te.join(e,"SKILL.md"));let r=te.join(n,"skill.yaml"),i=te.join(n,"guardrails.yaml"),o=ku(await ks(r),r),s=await Kw(i),a=s===null?null:bu(s,i),c=await Uw(n),l={allowedSkills:o.skills.map(f=>f.id),allowedAgents:o.agents.map(f=>f.id),allowedTools:o.tools.map(f=>f.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:o.tools.filter(f=>f.requiresConfirmation).map(f=>f.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:o,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function Eu(t){let e=te.resolve(t);return Cu({root:e,controlRoot:te.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function _u(t){let e=te.resolve(t);return Cu({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function xu(t,e,n=te.join(e,"package.json")){J(t,n);let r=t.packageKind==="runtime"?"runtime":void 0,i=ku(t.definition,n),o=bu(t.guardrails,n),s=Su(t.evals,n,"evals"),a={allowedSkills:i.skills.map(c=>c.id),allowedAgents:i.agents.map(c=>c.id),allowedTools:i.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:i.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:te.resolve(e),packageKind:r,definition:i,guardrails:{...a,...o},evals:s}}import Pu from"path";function Hw(t,e,n,r){t.type==="invoke_skill"&&!e.definition.skills.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&n.push(`step ${r} ask_user action requires question`)}function Ru(t){let e=[],{definition:n,guardrails:r,evals:i}=t;n.apiVersion!=="comet/v1alpha1"&&e.push("unsupported apiVersion"),n.kind!=="Skill"&&e.push("kind must be Skill"),n.metadata.name||e.push("metadata.name is required"),n.goal.statement||e.push("goal.statement is required"),r.maxIterations<1&&e.push("maxIterations must be at least 1"),r.maxRetriesPerAction<0&&e.push("maxRetriesPerAction must not be negative");let o=n.orchestration.steps??[];if(n.orchestration.mode==="adaptive")(n.orchestration.entry||o.length>0)&&e.push("adaptive orchestration must not define entry or steps");else{let s=new Set;for(let a of o)s.has(a.id)&&e.push(`duplicate step id: ${a.id}`),s.add(a.id),Hw(a.action,t,e,a.id);(!n.orchestration.entry||!s.has(n.orchestration.entry))&&e.push(`orchestration.entry references unknown step: ${n.orchestration.entry??"(missing)"}`);for(let a of o){a.next&&!s.has(a.next)&&e.push(`step ${a.id} has unknown next step: ${a.next}`);for(let c of a.completionEvals??[])i.some(l=>l.id===c)||e.push(`step ${a.id} references unknown eval: ${c}`)}}for(let s of n.tools){if(s.kind!=="script")continue;let a=Pu.posix.normalize(s.source.replaceAll("\\","/"));(Pu.isAbsolute(s.source)||a===".."||a.startsWith("../"))&&e.push(`script tool ${s.id} must reference a relative path inside the Skill package`)}for(let s of r.allowedSkills)n.skills.some(a=>a.id===s)||e.push(`guardrails allow undeclared skill: ${s}`);for(let s of r.allowedAgents)n.agents.some(a=>a.id===s)||e.push(`guardrails allow undeclared agent: ${s}`);for(let s of r.allowedTools)n.tools.some(a=>a.id===s)||e.push(`guardrails allow undeclared tool: ${s}`);return e}function ii(t){return Array.isArray(t)?t.map(ii):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,ii(n)])):t}function Gw(t){return ii({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function Jw(t){return L.posix.normalize(t.replaceAll("\\","/"))}function Et(t,e,n){let r=L.relative(t,e);if(!(r===""||!L.isAbsolute(r)&&!r.startsWith(`..${L.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function Au(t,e,n){let r=Jw(e);if(L.posix.isAbsolute(r)||r===".."||r.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let i=L.resolve(t,...r.split("/"));Et(t,i,n);let o;try{o=await F.realpath(i)}catch(s){throw s.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:s}):s}if(Et(t,o,n),!(await F.stat(o)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:r,content:await F.readFile(o)}}async function Vw(t){let e=await F.realpath(t.root),n=t.packageKind==="runtime"?[]:[await Au(e,"SKILL.md","SKILL.md")];for(let r of t.definition.tools)r.kind==="script"&&n.push(await Au(e,r.source,`Script tool ${r.id}`));return n.sort((r,i)=>r.path.localeCompare(i.path))}function zw(t,e){let n=e.map(r=>({path:r.path,sha256:Ou("sha256").update(r.content).digest("hex")}));return Ou("sha256").update(JSON.stringify(ii({package:t,files:n}))).digest("hex")}function ju(t){return JSON.stringify(t,null,2)+`
148
+ `}async function Iu(t){let e=Gw(t),n=await Vw(t);return{document:e,files:n,hash:zw(e,n)}}async function oi(t){return(await Iu(t)).hash}async function Nu(t){try{return await F.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Tu(t,e){try{if((await F.readFile(L.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await F.readFile(L.join(t,"package.json"),"utf8")!==ju(e.document))throw new Error("package mismatch");for(let i of e.files)if(!(await F.readFile(L.join(t,...i.path.split("/")))).equals(i.content))throw new Error(`file mismatch: ${i.path}`)}catch(n){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:n})}}async function bs(t,e){let n=await Iu(t),r=L.resolve(e,".comet","skill-snapshots"),i=L.join(r,n.hash);if(await F.mkdir(r,{recursive:!0}),await Nu(i))return await Tu(i,n),{hash:n.hash,snapshotDir:i};let o=L.join(r,`.tmp-${Yw()}`);Et(r,o,"Temporary snapshot"),Et(r,i,"Published snapshot");try{await F.mkdir(o);for(let s of n.files){let a=L.join(o,...s.path.split("/"));Et(o,a,`Snapshot file ${s.path}`),await F.mkdir(L.dirname(a),{recursive:!0}),await F.writeFile(a,s.content)}await F.writeFile(L.join(o,"package.json"),ju(n.document)),await F.writeFile(L.join(o,"sha256"),n.hash+`
149
+ `),await F.rename(o,i)}catch(s){if(await Nu(i)){try{await Tu(i,n)}finally{await F.rm(o,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:i}}throw await F.rm(o,{recursive:!0,force:!0}),s}return{hash:n.hash,snapshotDir:i}}async function Ss(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=L.resolve(t,".comet","skill-snapshots"),r=L.join(n,e);Et(n,r,"Skill snapshot");try{let i=(await F.readFile(L.join(r,"sha256"),"utf8")).trim();if(i!==e)throw new Error(`stored hash is ${i||"(empty)"}`);let o=L.join(r,"package.json"),s=JSON.parse(await F.readFile(o,"utf8")),a=xu(s,r,o),c=Ru(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
150
+ `));let l=await oi(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(i){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:i})}}async function $u(t){try{return await Cs.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function Lu(t){return Qw("sha256").update(t).digest("hex")}function Zw(t){return Lu(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function ey(t){return t.replaceAll(".","_").replaceAll("-","_")}async function ty(t,e){let n=await Se(t),r=Object.fromEntries(e.filter(s=>s.satisfied&&s.source).map(s=>[ey(s.code),s.source])),i=_e.join(t,"subagent-progress.md");await $u(i)&&(r.subagent_progress=_e.relative(n,i).split(_e.sep).join("/"));let o=e.find(s=>s.code==="design.handoff"&&s.satisfied);return o?.source&&(r.handoff_context=o.source),r}function ny(t,e,n){return[{sequence:1,timestamp:n,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:n,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:rt,profile:e,source:"pre-migration"}}]}async function ry(t){await Promise.all(t.map(e=>Cs.rm(e,{recursive:!0,force:!0})))}async function qu(t,e){let n=await de(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let r=n.classic,i=r.classicProfile??r.workflow;if(n.run){if(r.classicMigration!==rt)throw new Error("Classic Run exists without a supported classic_migration marker");if(n.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${n.run.skill}`);if(await oi(e.skillPackage)!==n.run.skillHash)return await Ss(t,n.run.skillHash),{classic:r,run:n.run,evidence:await bt(t,n),migrated:!1,snapshotDir:_e.join(t,".comet","skill-snapshots",n.run.skillHash)};let d=await bs(e.skillPackage,t);return{classic:r,run:n.run,evidence:await bt(t,n),migrated:!1,snapshotDir:d.snapshotDir}}let o=await bt(t,n),s=Dr(r,o);if(!e.skillPackage.definition.orchestration.steps?.some(u=>u.id===s))throw new Error(`Classic Skill package does not define resolved step: ${s}`);let a=await oi(e.skillPackage),c=_e.join(t,".comet","skill-snapshots",a),l=await $u(c),f=[];try{let u=await bs(e.skillPackage,t),d=uu(e.skillPackage,e.runId?.()??Xw(),u.hash);d.currentStep=s,s==="completed"&&(d.status="completed");let h={...r,classicProfile:i,classicMigration:rt},g=await ty(t,o),p=await Se(t),m=o.find(b=>b.code==="design.handoff"&&b.satisfied),w=null;m?.source&&(w=await fn(p,m.resolvedSource??m.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await fu(t,d.contextRef,w),f.push(_e.resolve(t,d.contextRef))),await ti(t,d.artifactsRef,g),f.push(_e.resolve(t,d.artifactsRef));let y=(e.now?.()??new Date).toISOString(),S={runId:d.runId,stateVersion:1,trajectoryOffset:2,contextHash:w===null?null:Lu(w),artifactsHash:Zw(g),createdAt:y};await ni(t,d.checkpointRef,S),f.push(_e.resolve(t,d.checkpointRef)),f.push(_e.resolve(t,d.trajectoryRef));for(let b of ny(d,i,y))await Ct(t,d.trajectoryRef,b);return await it(t,{classic:h,run:d,unknownKeys:n.unknownKeys}),{classic:h,run:d,evidence:o,migrated:!0,snapshotDir:u.snapshotDir}}catch(u){throw await ry(f),l||await Cs.rm(c,{recursive:!0,force:!0}),u}}async function iy(t){try{return(await Wu.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function si(t){try{return(await Wu.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function oy(t){return await iy(t)?await si(X.join(t,"skill.yaml"))?!0:await si(X.join(t,"SKILL.md"))&&await si(X.join(t,"comet","skill.yaml")):!1}function sy(t){return{root:t,packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-classic",version:"1",description:"Internal compatibility orchestration for classic Comet full, hotfix, and tweak workflows"},goal:{statement:"Advance or restore a classic Comet Run without changing the user command surface",inputs:[{name:"classic-state",description:"Validated ClassicState consistent with the Run projection",required:!0},{name:"evidence",description:"Structured evidence produced by the Classic Evidence collector",required:!0}],outputs:[{name:"run-state",description:"Atomically synchronized Classic and Run state",required:!0}],success:["Legacy fields and Run fields remain consistent","Every step invokes only a declared public Comet Skill","The completed state passes its completion eval"]},orchestration:{mode:"deterministic",entry:"full.open",steps:[{id:"full.open",action:{type:"invoke_skill",ref:"comet-open"},next:"full.design.handoff"},{id:"full.design.handoff",action:{type:"invoke_skill",ref:"comet-design"},next:"full.design.document"},{id:"full.design.document",action:{type:"invoke_skill",ref:"comet-design"},next:"full.build.plan"},{id:"full.build.plan",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.plan-ready"},{id:"full.build.plan-ready",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.configure"},{id:"full.build.configure",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.complete"},{id:"full.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"full.verify.run"},{id:"full.build.fix",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.verify.branch"},{id:"full.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.archive.confirm"},{id:"full.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"full.archive.execute"},{id:"full.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"hotfix.open",action:{type:"invoke_skill",ref:"comet-hotfix"},next:"hotfix.build.execute"},{id:"hotfix.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.build.complete"},{id:"hotfix.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.verify.run"},{id:"hotfix.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.verify.branch"},{id:"hotfix.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.archive.confirm"},{id:"hotfix.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"hotfix.archive.execute"},{id:"hotfix.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"tweak.open",action:{type:"invoke_skill",ref:"comet-tweak"},next:"tweak.build.execute"},{id:"tweak.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.build.complete"},{id:"tweak.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.verify.run"},{id:"tweak.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.verify.branch"},{id:"tweak.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.archive.confirm"},{id:"tweak.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"tweak.archive.execute"},{id:"tweak.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"completed",action:{type:"checkpoint"},completionEvals:["classic-completed"]}]},skills:[{id:"comet-open"},{id:"comet-design"},{id:"comet-build"},{id:"comet-verify"},{id:"comet-archive"},{id:"comet-hotfix"},{id:"comet-tweak"}],agents:[],tools:[]},guardrails:{allowedSkills:["comet-open","comet-design","comet-build","comet-verify","comet-archive","comet-hotfix","comet-tweak"],allowedAgents:[],allowedTools:[],maxIterations:500,maxRetriesPerAction:3,confirmationRequiredFor:[]},evals:[{id:"classic-completed",scope:"completion",type:"state_equals",field:"status",equals:"completed"}]}}async function ay(){let t=X.dirname(Du(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,X.resolve(t,"..","runtime","classic"),X.resolve(t,"..","..","comet","runtime","classic"),X.resolve(t,"..","..","assets","skills","comet","runtime","classic"),X.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,X.resolve(t,"..","..","comet-classic"),X.resolve(t,"..","..","assets","skills","comet-classic"),X.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await oy(n))return n;return null}async function cy(t){return await si(X.join(t,"skill.yaml"))?_u(t):Eu(t)}async function Fu(t){let e=await ay();return qu(t,{skillPackage:e?await cy(e):sy(X.dirname(Du(import.meta.url)))})}async function Mu(t,e,n,r){let i=await de(t);if(!i.classic||!i.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let o=await bt(t,{classic:e,run:n,unknownKeys:i.unknownKeys}),s=Dr(e,o),a={...n,currentStep:s,iteration:n.iteration+1,status:s==="completed"?"completed":"running"};await it(t,{classic:e,run:a,unknownKeys:i.unknownKeys});let c=await kn(t,a.trajectoryRef);return await Ct(t,a.trajectoryRef,{sequence:c.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:a.runId,data:{kind:"classic",fromStep:n.currentStep,toStep:s,...r}}),a}Hr();import ly from"path";var uy=ly.join(".comet","state-events.jsonl"),fy=8*1024*1024;async function Bu(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Kr(t,uy,`${JSON.stringify(n)}
151
+ `,fy,"Classic state event log"),n}var dy={"open-complete":{event:"open-complete",from:"open",guardRefs:["open-artifacts-present"]},"design-complete":{event:"design-complete",from:"design",guardRefs:["design-evidence-present"]},"build-complete":{event:"build-complete",from:"build",guardRefs:["build-decisions-selected"]},"verify-pass":{event:"verify-pass",from:"verify",guardRefs:["verification-report-present"]},"verify-fail":{event:"verify-fail",from:"verify",guardRefs:["verification-failed"]},"archive-confirm":{event:"archive-confirm",from:"archive",guardRefs:["archive-final-confirmation"]},"archive-reopen":{event:"archive-reopen",from:"archive",guardRefs:["archive-not-finalized"]},archived:{event:"archived",from:"archive",guardRefs:["verify-result-pass","archive-confirmed"]},"preset-escalate":{event:"preset-escalate",from:"build",guardRefs:["preset-workflow"]}};function py(t){return t.toISOString().slice(0,10)}function _(t,e,n,r){let i=t[n];t[n]=r,i!==r&&e.push({field:n,from:i,to:r})}function Ku(t,e,n={}){let r=dy[e];if(t.phase!==r.from)throw new Error(`Cannot apply ${e}: phase is '${t.phase}', expected '${r.from}'`);let i={...t},o=[],s=n.now??new Date;if(e==="open-complete")_(i,o,"phase",i.workflow==="full"?"design":"build");else if(e==="design-complete")_(i,o,"phase","build");else if(e==="build-complete"){let a=i.verifyResult==="fail";_(i,o,"phase","verify"),_(i,o,"verifyResult","pending"),_(i,o,"branchStatus","pending"),a||_(i,o,"verificationReport",null)}else if(e==="verify-pass")_(i,o,"verifyResult","pass"),_(i,o,"verifyFailures",0),_(i,o,"phase","archive"),_(i,o,"verifiedAt",py(s)),_(i,o,"archiveConfirmation","pending"),_(i,o,"branchStatus","pending");else if(e==="verify-fail")_(i,o,"verifyResult","fail"),_(i,o,"verifyFailures",i.verifyFailures+1),_(i,o,"phase","build"),_(i,o,"branchStatus","pending");else if(e==="preset-escalate"){if(i.workflow!=="hotfix"&&i.workflow!=="tweak")throw new Error(`Cannot apply ${e}: workflow must be hotfix or tweak, got '${i.workflow}'`);_(i,o,"workflow","full"),_(i,o,"classicProfile","full"),_(i,o,"phase","design"),_(i,o,"designDoc",null),_(i,o,"buildPause",null),_(i,o,"buildMode",null),_(i,o,"subagentDispatch",null),_(i,o,"tddMode",null),_(i,o,"reviewMode",null),_(i,o,"isolation",null),_(i,o,"boundBranch",null),_(i,o,"verifyMode",null),_(i,o,"directOverride",null)}else if(e==="archive-confirm"){if(i.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(i.archived)throw new Error(`Cannot apply ${e}: already archived`);_(i,o,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(i.archived)throw new Error(`Cannot apply ${e}: already archived`);_(i,o,"verifyResult","pending"),_(i,o,"verifyFailures",0),_(i,o,"phase","verify"),_(i,o,"verifiedAt",null),_(i,o,"archiveConfirmation",null),_(i,o,"branchStatus","pending")}else{if(i.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(i.archiveConfirmation!=="confirmed")throw new Error(`Cannot apply ${e}: archiveConfirmation must be confirmed`);_(i,o,"archived",!0)}return{classic:i,effects:o,definition:r}}Qo();import{promises as my}from"fs";import hy from"path";var Es="comet.selection.v2",gy=16*1024;function _s(t){return hy.join(t,".comet","current-change.json")}function wy(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Uu(t){return t===null||typeof t=="string"}function yy(t){let e;try{e=JSON.parse(t)}catch(n){throw new Error(`current change selection contains invalid JSON: ${n instanceof Error?n.message:String(n)}`,{cause:n})}if(!wy(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!Uu(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:Es,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==Es)throw new Error(`current change selection schema must be ${Es}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!Uu(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function xs(t){let e;try{let r=_s(t),{bytes:i}=await xr(r,gy,{label:"current change selection"});e=i.toString("utf8")}catch(r){if(r.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${r instanceof Error?r.message:String(r)}`,{cause:r})}return{status:"selected",...yy(e)}}async function Hu(t){await my.rm(_s(t),{force:!0})}async function Yu(t,e,n){let r=await xs(t);return r.status!=="selected"||r.selection.workflow!==e||r.selection.change!==n?!1:(await Hu(t),!0)}Br();import{execFileSync as Gu}from"child_process";var vy=Je(Le(),1);Br();function ky(t){try{let e=Gu("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],windowsHide:!0}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}var zC=fs("liveGitBranch",t=>ky(t));function by(t){try{return Gu("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],windowsHide:!0}).trim()==="true"}catch{return!1}}var QC=fs("isGitWorkTree",t=>by(t));var Sy=Je(Le(),1);var ZC=8*1024*1024;var EE=Mr("readCometCurrentSelection",t=>xs(t));async function Ju(t,e){return Yu(t,"classic",e)}var _y="\x1B[32m",xy="\x1B[31m",Py="\x1B[33m",Rs="\x1B[0m";function ne(t){return`${_y}${t}${Rs}`}function V(t){return`${xy}${t}${Rs}`}function bn(t){return`${Py}${t}${Rs}`}var K=class extends Error{constructor(n,r=1){super(n);this.exitCode=r}exitCode},Ps=class{stderr=[];openSpecStdout=[];openSpecStderr=[];stepsOk=0;stepsTotal=0;envelope;captureOpenSpec(e){e.stdout&&this.openSpecStdout.push(e.stdout),e.stderr&&this.openSpecStderr.push(e.stderr)}finishEnvelope(e){this.envelope=Bl({name:e.name,stepsOk:this.stepsOk,stepsTotal:this.stepsTotal,dryRun:e.dryRun,locale:e.locale}),this.stderr.push(this.envelope.summary)}toResult(e=0){let n=this.stderr.length>0?this.stderr.join(`
152
152
  `)+`
153
153
  `:"",r=this.openSpecStderr.join(""),i=r&&n&&!r.endsWith(`
154
154
  `)?`
155
- `:"";return{exitCode:e,...this.openSpecStdout.length>0?{stdout:this.openSpecStdout.join("")}:{},...r||n?{stderr:`${r}${i}${n}`}:{}}}};function Ey(t){let e=cs(t);if(e)throw new K(V(`FATAL: ${e}`))}function Ju(t){return vy("sha256").update(t).digest("hex")}function _y(t){return Ju(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function xy(t,e){let n=me.relative(t,e);return n!==""&&!me.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${me.sep}`)}function Sn(t,e,n,r){if(!r)return r;let i=me.resolve(t,r);return xy(e,i)?$(t,me.join(n,me.relative(e,i))):r}function Py(t,e,n,r){let i={...r};for(let o of["handoff_context","handoff_markdown"]){let s=i[o];s&&(i[o]=Sn(t,e,n,s)??s)}return i}async function Ry(t,e){let n=await de(e);if(!n.classic||!n.run||!n.classic.archived)throw new K(V(" [FAIL] Final archived state is incomplete"));let r=[["design_doc",n.classic.designDoc],["plan",n.classic.plan],["verification_report",n.classic.verificationReport],["handoff_context",n.classic.handoffContext]],i=await ws(e,n.run.artifactsRef),o=[["artifacts.handoff_context",i.handoff_context],["artifacts.handoff_markdown",i.handoff_markdown]];for(let[s,a]of[...r,...o])if(a&&!await un(t,me.resolve(t,a),{label:`Classic archived ${s}`,expected:"file"}))throw new K(V(` [FAIL] Final archived ${s} does not exist: ${a}`))}function Hu(t){return`${t.replace(/\n+$/u,"")}
156
- `}function Ay(t,e,n){let r=t.replace(/\r\n/gu,`
155
+ `:"";return{exitCode:e,...this.openSpecStdout.length>0?{stdout:this.openSpecStdout.join("")}:{},...r||n?{stderr:`${r}${i}${n}`}:{},...this.envelope===void 0?{}:{envelope:this.envelope}}}};function Ry(t){let e=ls(t);if(e)throw new K(V(`FATAL: ${e}`))}function zu(t){return Cy("sha256").update(t).digest("hex")}function Oy(t){return zu(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function Ay(t,e){let n=me.relative(t,e);return n!==""&&!me.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${me.sep}`)}function Sn(t,e,n,r){if(!r)return r;let i=me.resolve(t,r);return Ay(e,i)?$(t,me.join(n,me.relative(e,i))):r}function Ny(t,e,n,r){let i={...r};for(let o of["handoff_context","handoff_markdown"]){let s=i[o];s&&(i[o]=Sn(t,e,n,s)??s)}return i}async function Ty(t,e){let n=await de(e);if(!n.classic||!n.run||!n.classic.archived)throw new K(V(" [FAIL] Final archived state is incomplete"));let r=[["design_doc",n.classic.designDoc],["plan",n.classic.plan],["verification_report",n.classic.verificationReport],["handoff_context",n.classic.handoffContext]],i=await ys(e,n.run.artifactsRef),o=[["artifacts.handoff_context",i.handoff_context],["artifacts.handoff_markdown",i.handoff_markdown]];for(let[s,a]of[...r,...o])if(a&&!await un(t,me.resolve(t,a),{label:`Classic archived ${s}`,expected:"file"}))throw new K(V(` [FAIL] Final archived ${s} does not exist: ${a}`))}function Vu(t){return`${t.replace(/\n+$/u,"")}
156
+ `}function jy(t,e,n){let r=t.replace(/\r\n/gu,`
157
157
  `),i=r.split(`
158
- `),o=i[0]==="---"?i.indexOf("---",1):-1,s=n.match(/^([^:\n]+):/u)?.[1]?.trim();if(o!==-1){let c=i.slice(1,o).filter(l=>{let f=l.match(/^([^:\n]+):/u)?.[1]?.trim();return f===void 0?!0:f!=="archived-with"&&f!==s});return c.push(`archived-with: ${e}`),n&&c.push(n),Hu(["---",...c,"---",...i.slice(o+1)].join(`
159
- `))}let a=["---",`archived-with: ${e}`];return n&&a.push(n),s!=="status"&&a.push("status: final"),a.push("---"),Hu([...a,r].join(`
160
- `))}async function Oy(t,e,n){let r=await kn(t,e.trajectoryRef);r.some(i=>i.type==="recovery_reconciled"&&i.data.kind==="classic-archive"&&i.data.actionId===n)||await Ct(t,e.trajectoryRef,{sequence:r.length+1,timestamp:new Date().toISOString(),type:"recovery_reconciled",runId:e.runId,data:{kind:"classic-archive",actionId:n}})}async function si(t,e,n,r,i,o){if(!await un(e,n,{label:"Classic archive annotation target",expected:"file"}))return;if(o){t.stderr.push(bn(` [DRY-RUN] Would annotate: ${n}`)),t.stepsOk+=1,t.stepsTotal+=1;return}let s=await fn(e,n,{label:"Classic archive annotation target"}),a=Ay(s,r,i);await Fl(e,n,a,{label:"Classic archive annotation target"}),t.stderr.push(ne(` [OK] Annotated: ${n}`)),t.stepsOk+=1,t.stepsTotal+=1}async function Ny(t,e){if(!(await Ke(t,e,{label:"Classic main specs directory",expected:"directory"})).exists)return;let r=!1,i=await ky.readdir(e,{withFileTypes:!0});for(let o of i){if(!o.isDirectory()&&!o.isSymbolicLink())continue;let s=`${e}/${o.name}/spec.md`,a=await(async()=>await un(t,s,{label:`Classic main spec ${o.name}`,expected:"file"})?fn(t,s,{label:`Classic main spec ${o.name}`}):null)();if(a===null)continue;let c=a.split(/\r?\n/u).map((l,f)=>({line:l,number:f+1})).filter(l=>/^## (ADDED|MODIFIED|REMOVED|RENAMED) Requirements$/u.test(l.line));if(c.length>0){r=!0,process.stderr.write(V(`FATAL: delta-only section heading leaked into main spec: ${s}`)+`
158
+ `),o=i[0]==="---"?i.indexOf("---",1):-1,s=n.match(/^([^:\n]+):/u)?.[1]?.trim();if(o!==-1){let c=i.slice(1,o).filter(l=>{let f=l.match(/^([^:\n]+):/u)?.[1]?.trim();return f===void 0?!0:f!=="archived-with"&&f!==s});return c.push(`archived-with: ${e}`),n&&c.push(n),Vu(["---",...c,"---",...i.slice(o+1)].join(`
159
+ `))}let a=["---",`archived-with: ${e}`];return n&&a.push(n),s!=="status"&&a.push("status: final"),a.push("---"),Vu([...a,r].join(`
160
+ `))}async function Iy(t,e,n){let r=await kn(t,e.trajectoryRef);r.some(i=>i.type==="recovery_reconciled"&&i.data.kind==="classic-archive"&&i.data.actionId===n)||await Ct(t,e.trajectoryRef,{sequence:r.length+1,timestamp:new Date().toISOString(),type:"recovery_reconciled",runId:e.runId,data:{kind:"classic-archive",actionId:n}})}async function ai(t,e,n,r,i,o){if(!await un(e,n,{label:"Classic archive annotation target",expected:"file"}))return;if(o){t.stderr.push(bn(` [DRY-RUN] Would annotate: ${n}`)),t.stepsOk+=1,t.stepsTotal+=1;return}let s=await fn(e,n,{label:"Classic archive annotation target"}),a=jy(s,r,i);await Kl(e,n,a,{label:"Classic archive annotation target"}),t.stderr.push(ne(` [OK] Annotated: ${n}`)),t.stepsOk+=1,t.stepsTotal+=1}async function $y(t,e){if(!(await Ke(t,e,{label:"Classic main specs directory",expected:"directory"})).exists)return;let r=!1,i=await Ey.readdir(e,{withFileTypes:!0});for(let o of i){if(!o.isDirectory()&&!o.isSymbolicLink())continue;let s=`${e}/${o.name}/spec.md`,a=await(async()=>await un(t,s,{label:`Classic main spec ${o.name}`,expected:"file"})?fn(t,s,{label:`Classic main spec ${o.name}`}):null)();if(a===null)continue;let c=a.split(/\r?\n/u).map((l,f)=>({line:l,number:f+1})).filter(l=>/^## (ADDED|MODIFIED|REMOVED|RENAMED) Requirements$/u.test(l.line));if(c.length>0){r=!0,process.stderr.write(V(`FATAL: delta-only section heading leaked into main spec: ${s}`)+`
161
161
  `);for(let l of c)process.stderr.write(`${l.number}:${l.line}
162
- `)}}if(r)throw new K("")}var Gu=async t=>{let e=new xs,n=t[0],r=t[1]==="--dry-run";try{Ey(n);let i=await be(process.cwd()),o=await cn(i),s=await $r(n,o.projectRoot),a=s.directory,c=$(o.projectRoot,a),f=`${new Date().toISOString().slice(0,10)}-${n}`,u=me.join(o.archiveDir,f);e.stderr.push(`=== Comet Archive: ${n} ===`);let d=s.stateExists,h=d?null:await qr(n,o.projectRoot),g=d?a:h?.directory;if(!g||!await un(o.projectRoot,`${g}/.comet.yaml`,{label:`Classic change ${n} state`,expected:"file"}))throw new K(V(`FATAL: .comet.yaml not found in ${c}/`));h&&(u=h.directory,f=me.basename(h.directory));let p=await de(g);if(!p.classic)throw new K(V("FATAL: archive requires Classic state"));let m=p.classic,w=m.designDoc,y=m.plan;if(m.phase!=="archive")throw new K(V(`FATAL: phase is '${m.phase}', expected 'archive'`));if(m.verifyResult!=="pass")throw new K(V(`FATAL: verify_result is '${m.verifyResult}', expected 'pass'. Run comet-verify first.`));e.stderr.push(ne(" [OK] Entry state verified")),e.stepsOk+=1,e.stepsTotal+=1;let S=await Ke(o.projectRoot,u,{label:`Classic archive target ${f}`,expected:"directory"});if(d&&S.exists)throw new K(V(`FATAL: archive target already exists: ${u}`));if(e.stderr.push(ne(" [OK] Archive target available")),e.stepsOk+=1,e.stepsTotal+=1,r)e.stderr.push(bn(` [DRY-RUN] Would run OpenSpec archive: ${n}`)),e.stepsOk+=1,e.stepsTotal+=1;else if(!m.archived||p.run?.pending){await as(o.projectRoot,`${g}/.comet`,"Classic change runtime directory");let b=await Lu(g),C=`classic-archive:${n}`,E=await fu(g,b.run.pendingRef),R=!!h||E?.id===C&&E.type==="checkpoint"&&E.ref===n;if(b.run.pending&&b.run.pending!==C)throw new K(V(`FATAL: another action is pending: ${b.run.pending}`));if(!R&&!m.archived&&m.archiveConfirmation!=="confirmed")throw new K(V(`FATAL: archive_confirmation is '${m.archiveConfirmation??"null"}', expected 'confirmed'. Run final archive confirmation first.`));if(!R){let _t={id:C,stepId:b.run.currentStep,type:"checkpoint",ref:n};await uu(g,b.run.pendingRef,_t),await rt(g,{classic:b.classic,run:{...b.run,pending:C,status:"waiting"},unknownKeys:(await de(g)).unknownKeys})}if(!h){let _t=await Dl(["archive",n,"--yes"],o.projectRoot);if(e.captureOpenSpec(_t),_t.exitCode!==0)throw new K("",_t.exitCode)}let k=await qr(n,o.projectRoot,{preferredArchiveName:f});if(!k&&!h&&(k=await qr(n,o.projectRoot,{skipExactCompatibility:!0})),!k)return e.stderr.push(V(" [FAIL] OpenSpec archive output not found")),e.stepsTotal+=1,e.stderr.push(""),e.stderr.push(ne(`Archive complete. ${e.stepsOk}/${e.stepsTotal} steps succeeded.`)),e.toResult(1);u=k.directory,f=me.basename(k.directory),e.stderr.push(ne(` [OK] OpenSpec archive completed: ${u}`)),e.stepsOk+=1,e.stepsTotal+=1,await Ny(o.projectRoot,o.specsDir),e.stderr.push(ne(" [OK] Main specs verified clean")),e.stepsOk+=1,e.stepsTotal+=1,w&&await si(e,o.projectRoot,w,f,"status: final",!1),y&&await si(e,o.projectRoot,y,f,"",!1);let P=await de(u);if(!P.classic||!P.run)throw new K(V(" [FAIL] archived state projection is incomplete"));let re={...Py(o.projectRoot,a,u,await ws(u,P.run.artifactsRef)),archive_directory:$(o.projectRoot,u)};await ei(u,P.run.artifactsRef,re);let z=Fu(R&&P.classic.archiveConfirmation!=="confirmed"?{...P.classic,archiveConfirmation:"confirmed"}:P.classic,"archived"),O={...z.classic,designDoc:Sn(o.projectRoot,a,u,z.classic.designDoc),plan:Sn(o.projectRoot,a,u,z.classic.plan),verificationReport:Sn(o.projectRoot,a,u,z.classic.verificationReport),handoffContext:Sn(o.projectRoot,a,u,z.classic.handoffContext)},ie=P.run;(P.run.currentStep!=="completed"||P.run.status!=="completed")&&(ie=await Wu(u,O,P.run,{actionId:C,archiveDirectory:$(o.projectRoot,u),event:"archived",source:"comet-archive"})),R&&await Oy(u,ie,C);let zu=await kn(u,ie.trajectoryRef),Rs=await lu(u,ie.contextRef),Qu={runId:ie.runId,stateVersion:ie.iteration,trajectoryOffset:zu.length,contextHash:Rs===null?null:Ju(Rs),artifactsHash:_y(re),createdAt:new Date().toISOString()};await ti(u,ie.checkpointRef,Qu);let As={...ie,pending:null,status:"completed"};await rt(u,{classic:O,run:As,unknownKeys:P.unknownKeys}),await Du(u,{change:f,event:"archived",source:"comet-archive",from:P.classic,to:O,effects:z.effects}),await du(u,As.pendingRef),e.stderr.push(ne(" [OK] archived: true")),e.stepsOk+=1,e.stepsTotal+=1}else{if(!p.run)throw new K(V("FATAL: archived Classic state is missing its Run projection"));e.stderr.push(ne(` [OK] OpenSpec archive completed: ${u}`)),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(ne(" [OK] Main specs verified clean")),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(ne(" [OK] archived: true")),e.stepsOk+=1,e.stepsTotal+=1}return r?(w&&await si(e,o.projectRoot,w,f,"status: final",!0),y&&await si(e,o.projectRoot,y,f,"",!0),e.stderr.push(bn(` [DRY-RUN] Would set archived: true in ${u}/.comet.yaml`)),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(bn(" [DRY-RUN] Would verify final archive integrity")),e.stepsOk+=1,e.stepsTotal+=1):(await Ry(o.projectRoot,u),e.stderr.push(ne(" [OK] Final archive integrity verified")),e.stepsOk+=1,e.stepsTotal+=1),r||await Yu(o.projectRoot,n),e.stderr.push(""),e.stderr.push(r?bn(`Dry run complete. ${e.stepsOk}/${e.stepsTotal} steps would succeed.`):ne(`Archive complete. ${e.stepsOk}/${e.stepsTotal} steps succeeded.`)),e.toResult(e.stepsOk<e.stepsTotal?1:0)}catch(i){if(i instanceof K){if(i.message)for(let o of i.message.split(`
163
- `))e.stderr.push(o);return e.toResult(i.exitCode)}throw i}};function Ty(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
164
- `}}async function Vu(t,e,n=process.argv.slice(2)){let r=n.includes("--json"),i=n.filter(a=>a!=="--json"),o;try{o=await e(i,{json:r})}catch(a){o={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let s=r?Ty(t,o):o;return s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr+(s.stderr.endsWith(`
162
+ `)}}if(r)throw new K("")}var Qu=async t=>{let e=new Ps,n=t[0],r=t[1]==="--dry-run";try{Ry(n);let i=await Se(process.cwd()),o=await cn(i),s=await Lr(n,o.projectRoot),a=s.directory,c=$(o.projectRoot,a),f=`${new Date().toISOString().slice(0,10)}-${n}`,u=me.join(o.archiveDir,f);e.stderr.push(`=== Comet Archive: ${n} ===`);let d=s.stateExists,h=d?null:await qr(n,o.projectRoot),g=d?a:h?.directory;if(!g||!await un(o.projectRoot,`${g}/.comet.yaml`,{label:`Classic change ${n} state`,expected:"file"}))throw new K(V(`FATAL: .comet.yaml not found in ${c}/`));h&&(u=h.directory,f=me.basename(h.directory));let p=await de(g);if(!p.classic)throw new K(V("FATAL: archive requires Classic state"));let m=p.classic,w=m.designDoc,y=m.plan;if(m.phase!=="archive")throw new K(V(`FATAL: phase is '${m.phase}', expected 'archive'`));if(m.verifyResult!=="pass")throw new K(V(`FATAL: verify_result is '${m.verifyResult}', expected 'pass'. Run comet-verify first.`));e.stderr.push(ne(" [OK] Entry state verified")),e.stepsOk+=1,e.stepsTotal+=1;let S=await Ke(o.projectRoot,u,{label:`Classic archive target ${f}`,expected:"directory"});if(d&&S.exists)throw new K(V(`FATAL: archive target already exists: ${u}`));if(e.stderr.push(ne(" [OK] Archive target available")),e.stepsOk+=1,e.stepsTotal+=1,r)e.stderr.push(bn(` [DRY-RUN] Would run OpenSpec archive: ${n}`)),e.stepsOk+=1,e.stepsTotal+=1;else if(!m.archived||p.run?.pending){await cs(o.projectRoot,`${g}/.comet`,"Classic change runtime directory");let b=await Fu(g),C=`classic-archive:${n}`,E=await mu(g,b.run.pendingRef),R=!!h||E?.id===C&&E.type==="checkpoint"&&E.ref===n;if(b.run.pending&&b.run.pending!==C)throw new K(V(`FATAL: another action is pending: ${b.run.pending}`));if(!R&&!m.archived&&m.archiveConfirmation!=="confirmed")throw new K(V(`FATAL: archive_confirmation is '${m.archiveConfirmation??"null"}', expected 'confirmed'. Run final archive confirmation first.`));if(!R){let _t={id:C,stepId:b.run.currentStep,type:"checkpoint",ref:n};await pu(g,b.run.pendingRef,_t),await it(g,{classic:b.classic,run:{...b.run,pending:C,status:"waiting"},unknownKeys:(await de(g)).unknownKeys})}if(!h){let _t=await Fl(["archive",n,"--yes"],o.projectRoot);if(e.captureOpenSpec(_t),_t.exitCode!==0)throw new K("",_t.exitCode)}let k=await qr(n,o.projectRoot,{preferredArchiveName:f});if(!k&&!h&&(k=await qr(n,o.projectRoot,{skipExactCompatibility:!0})),!k)return e.stderr.push(V(" [FAIL] OpenSpec archive output not found")),e.stepsTotal+=1,e.stderr.push(""),e.finishEnvelope({name:n,dryRun:r,locale:as(m.language)}),e.stderr.push(ne(`Archive complete. ${e.stepsOk}/${e.stepsTotal} steps succeeded.`)),e.toResult(1);u=k.directory,f=me.basename(k.directory),e.stderr.push(ne(` [OK] OpenSpec archive completed: ${u}`)),e.stepsOk+=1,e.stepsTotal+=1,await $y(o.projectRoot,o.specsDir),e.stderr.push(ne(" [OK] Main specs verified clean")),e.stepsOk+=1,e.stepsTotal+=1,w&&await ai(e,o.projectRoot,w,f,"status: final",!1),y&&await ai(e,o.projectRoot,y,f,"",!1);let P=await de(u);if(!P.classic||!P.run)throw new K(V(" [FAIL] archived state projection is incomplete"));let re={...Ny(o.projectRoot,a,u,await ys(u,P.run.artifactsRef)),archive_directory:$(o.projectRoot,u)};await ti(u,P.run.artifactsRef,re);let z=Ku(R&&P.classic.archiveConfirmation!=="confirmed"?{...P.classic,archiveConfirmation:"confirmed"}:P.classic,"archived"),A={...z.classic,designDoc:Sn(o.projectRoot,a,u,z.classic.designDoc),plan:Sn(o.projectRoot,a,u,z.classic.plan),verificationReport:Sn(o.projectRoot,a,u,z.classic.verificationReport),handoffContext:Sn(o.projectRoot,a,u,z.classic.handoffContext)},ie=P.run;(P.run.currentStep!=="completed"||P.run.status!=="completed")&&(ie=await Mu(u,A,P.run,{actionId:C,archiveDirectory:$(o.projectRoot,u),event:"archived",source:"comet-archive"})),R&&await Iy(u,ie,C);let Zu=await kn(u,ie.trajectoryRef),Os=await du(u,ie.contextRef),ef={runId:ie.runId,stateVersion:ie.iteration,trajectoryOffset:Zu.length,contextHash:Os===null?null:zu(Os),artifactsHash:Oy(re),createdAt:new Date().toISOString()};await ni(u,ie.checkpointRef,ef);let As={...ie,pending:null,status:"completed"};await it(u,{classic:A,run:As,unknownKeys:P.unknownKeys}),await Bu(u,{change:f,event:"archived",source:"comet-archive",from:P.classic,to:A,effects:z.effects}),await hu(u,As.pendingRef),e.stderr.push(ne(" [OK] archived: true")),e.stepsOk+=1,e.stepsTotal+=1}else{if(!p.run)throw new K(V("FATAL: archived Classic state is missing its Run projection"));e.stderr.push(ne(` [OK] OpenSpec archive completed: ${u}`)),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(ne(" [OK] Main specs verified clean")),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(ne(" [OK] archived: true")),e.stepsOk+=1,e.stepsTotal+=1}return r?(w&&await ai(e,o.projectRoot,w,f,"status: final",!0),y&&await ai(e,o.projectRoot,y,f,"",!0),e.stderr.push(bn(` [DRY-RUN] Would set archived: true in ${u}/.comet.yaml`)),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(bn(" [DRY-RUN] Would verify final archive integrity")),e.stepsOk+=1,e.stepsTotal+=1):(await Ty(o.projectRoot,u),e.stderr.push(ne(" [OK] Final archive integrity verified")),e.stepsOk+=1,e.stepsTotal+=1),r||await Ju(o.projectRoot,n),e.stderr.push(""),e.finishEnvelope({name:n,dryRun:r,locale:as(m.language)}),e.stderr.push(r?bn(`Dry run complete. ${e.stepsOk}/${e.stepsTotal} steps would succeed.`):ne(`Archive complete. ${e.stepsOk}/${e.stepsTotal} steps succeeded.`)),e.toResult(e.stepsOk<e.stepsTotal?1:0)}catch(i){if(i instanceof K){if(i.message)for(let o of i.message.split(`
163
+ `))e.stderr.push(o);return e.toResult(i.exitCode)}throw i}};function Ly(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,...e.envelope===void 0?{}:{summary:e.envelope.summary,...e.envelope.next===void 0?{}:{next:e.envelope.next},...e.envelope.user_message===void 0?{}:{user_message:e.envelope.user_message}},...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
164
+ `,...e.envelope===void 0?{}:{envelope:e.envelope}}}async function Xu(t,e,n=process.argv.slice(2)){let r=n.includes("--json"),i=n.filter(a=>a!=="--json"),o;try{o=await e(i,{json:r})}catch(a){o={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let s=r?Ly(t,o):o;return s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr+(s.stderr.endsWith(`
165
165
  `)?"":`
166
- `)),s.exitCode}process.exitCode=await Vu("archive",Gu);
166
+ `)),s.exitCode}process.exitCode=await Xu("archive",Qu);