@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 Vu=Object.create;var er=Object.defineProperty;var Gu=Object.getOwnPropertyDescriptor;var zu=Object.getOwnPropertyNames;var Qu=Object.getPrototypeOf,Xu=Object.prototype.hasOwnProperty;var bn=(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(i){throw n=[i],i}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},Zu=(t,e)=>{for(var n in e)er(t,n,{get:e[n],enumerable:!0})},ef=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of zu(e))!Xu.call(t,r)&&r!==n&&er(t,r,{get:()=>e[r],enumerable:!(i=Gu(e,r))||i.enumerable});return t};var Pt=(t,e,n)=>(n=t!=null?Vu(Qu(t)):{},ef(e||!t||!t.__esModule?er(n,"default",{value:t,enumerable:!0}):n,t));var x=v(D=>{"use strict";var tr=Symbol.for("yaml.alias"),Ss=Symbol.for("yaml.document"),Sn=Symbol.for("yaml.map"),Cs=Symbol.for("yaml.pair"),nr=Symbol.for("yaml.scalar"),Cn=Symbol.for("yaml.seq"),pe=Symbol.for("yaml.node.type"),tf=t=>!!t&&typeof t=="object"&&t[pe]===tr,nf=t=>!!t&&typeof t=="object"&&t[pe]===Ss,rf=t=>!!t&&typeof t=="object"&&t[pe]===Sn,of=t=>!!t&&typeof t=="object"&&t[pe]===Cs,Es=t=>!!t&&typeof t=="object"&&t[pe]===nr,sf=t=>!!t&&typeof t=="object"&&t[pe]===Cn;function _s(t){if(t&&typeof t=="object")switch(t[pe]){case Sn:case Cn:return!0}return!1}function af(t){if(t&&typeof t=="object")switch(t[pe]){case tr:case Sn:case nr:case Cn:return!0}return!1}var cf=t=>(Es(t)||_s(t))&&!!t.anchor;D.ALIAS=tr;D.DOC=Ss;D.MAP=Sn;D.NODE_TYPE=pe;D.PAIR=Cs;D.SCALAR=nr;D.SEQ=Cn;D.hasAnchor=cf;D.isAlias=tf;D.isCollection=_s;D.isDocument=nf;D.isMap=rf;D.isNode=af;D.isPair=of;D.isScalar=Es;D.isSeq=sf});var Rt=v(ir=>{"use strict";var $=x(),Y=Symbol("break visit"),xs=Symbol("skip children"),ae=Symbol("remove node");function En(t,e){let n=Ps(e);$.isDocument(t)?rt(null,t.contents,n,Object.freeze([t]))===ae&&(t.contents=null):rt(null,t,n,Object.freeze([]))}En.BREAK=Y;En.SKIP=xs;En.REMOVE=ae;function rt(t,e,n,i){let r=Rs(t,e,n,i);if($.isNode(r)||$.isPair(r))return As(t,i,r),rt(t,r,n,i);if(typeof r!="symbol"){if($.isCollection(e)){i=Object.freeze(i.concat(e));for(let o=0;o<e.items.length;++o){let s=rt(o,e.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===Y)return Y;s===ae&&(e.items.splice(o,1),o-=1)}}}else if($.isPair(e)){i=Object.freeze(i.concat(e));let o=rt("key",e.key,n,i);if(o===Y)return Y;o===ae&&(e.key=null);let s=rt("value",e.value,n,i);if(s===Y)return Y;s===ae&&(e.value=null)}}return r}async function _n(t,e){let n=Ps(e);$.isDocument(t)?await ot(null,t.contents,n,Object.freeze([t]))===ae&&(t.contents=null):await ot(null,t,n,Object.freeze([]))}_n.BREAK=Y;_n.SKIP=xs;_n.REMOVE=ae;async function ot(t,e,n,i){let r=await Rs(t,e,n,i);if($.isNode(r)||$.isPair(r))return As(t,i,r),ot(t,r,n,i);if(typeof r!="symbol"){if($.isCollection(e)){i=Object.freeze(i.concat(e));for(let o=0;o<e.items.length;++o){let s=await ot(o,e.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===Y)return Y;s===ae&&(e.items.splice(o,1),o-=1)}}}else if($.isPair(e)){i=Object.freeze(i.concat(e));let o=await ot("key",e.key,n,i);if(o===Y)return Y;o===ae&&(e.key=null);let s=await ot("value",e.value,n,i);if(s===Y)return Y;s===ae&&(e.value=null)}}return r}function Ps(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 Rs(t,e,n,i){if(typeof n=="function")return n(t,e,i);if($.isMap(e))return n.Map?.(t,e,i);if($.isSeq(e))return n.Seq?.(t,e,i);if($.isPair(e))return n.Pair?.(t,e,i);if($.isScalar(e))return n.Scalar?.(t,e,i);if($.isAlias(e))return n.Alias?.(t,e,i)}function As(t,e,n){let i=e[e.length-1];if($.isCollection(i))i.items[t]=n;else if($.isPair(i))t==="key"?i.key=n:i.value=n;else if($.isDocument(i))i.contents=n;else{let r=$.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}ir.visit=En;ir.visitAsync=_n});var rr=v(Ns=>{"use strict";var Os=x(),lf=Rt(),uf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ff=t=>t.replace(/[!,[\]{}]/g,e=>uf[e]),At=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 i=e.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[o,s]=i;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=i;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 ${r}`,!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[,i,r]=e.match(/^(.*!)([^!]*)$/s);r||n(`The ${e} tag has no suffix`);let o=this.tags[i];if(o)try{return o+decodeURIComponent(r)}catch(s){return n(String(s)),null}return i==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,i]of Object.entries(this.tags))if(e.startsWith(i))return n+ff(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(e&&i.length>0&&Os.isNode(e.contents)){let o={};lf.visit(e.contents,(s,a)=>{Os.isNode(a)&&a.tag&&(o[a.tag]=!0)}),r=Object.keys(o)}else r=[];for(let[o,s]of i)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
5
- `)}};At.defaultYaml={explicit:!1,version:"1.2"};At.defaultTags={"!!":"tag:yaml.org,2002:"};Ns.Directives=At});var xn=v(Ot=>{"use strict";var js=x(),df=Rt();function pf(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 Ts(t){let e=new Set;return df.visit(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function Is(t,e){for(let n=1;;++n){let i=`${t}${n}`;if(!e.has(i))return i}}function mf(t,e){let n=[],i=new Map,r=null;return{onAnchor:o=>{n.push(o),r??(r=Ts(t));let s=Is(e,r);return r.add(s),s},setAnchors:()=>{for(let o of n){let s=i.get(o);if(typeof s=="object"&&s.anchor&&(js.isScalar(s.node)||js.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:i}}Ot.anchorIsValid=pf;Ot.anchorNames=Ts;Ot.createNodeAnchors=mf;Ot.findNewAnchor=Is});var or=v(qs=>{"use strict";function Nt(t,e,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,o=i.length;r<o;++r){let s=i[r],a=Nt(t,i,String(r),s);a===void 0?delete i[r]:a!==s&&(i[r]=a)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let o=i.get(r),s=Nt(t,i,r,o);s===void 0?i.delete(r):s!==o&&i.set(r,s)}else if(i instanceof Set)for(let r of Array.from(i)){let o=Nt(t,i,r,r);o===void 0?i.delete(r):o!==r&&(i.delete(r),i.add(o))}else for(let[r,o]of Object.entries(i)){let s=Nt(t,i,r,o);s===void 0?delete i[r]:s!==o&&(i[r]=s)}return t.call(e,n,i)}qs.applyReviver=Nt});var Se=v(Ls=>{"use strict";var hf=x();function $s(t,e,n){if(Array.isArray(t))return t.map((i,r)=>$s(i,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!hf.hasAnchor(t))return t.toJSON(e,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(t,i),n.onCreate=o=>{i.res=o,delete n.onCreate};let r=t.toJSON(e,n);return n.onCreate&&n.onCreate(r),r}return typeof t=="bigint"&&!n?.keep?Number(t):t}Ls.toJS=$s});var Pn=v(Ws=>{"use strict";var gf=or(),Ds=x(),wf=Se(),sr=class{constructor(e){Object.defineProperty(this,Ds.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:i,onAnchor:r,reviver:o}={}){if(!Ds.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 i=="number"?i:100},a=wf.toJS(this,"",s);if(typeof r=="function")for(let{count:c,res:l}of s.anchors.values())r(l,c);return typeof o=="function"?gf.applyReviver(o,{"":a},"",a):a}};Ws.NodeBase=sr});var jt=v(Fs=>{"use strict";var yf=xn(),vf=Rt(),st=x(),kf=Pn(),bf=Se(),ar=class extends kf.NodeBase{constructor(e){super(st.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 i;n?.aliasResolveCache?i=n.aliasResolveCache:(i=[],vf.visit(e,{Node:(o,s)=>{(st.isAlias(s)||st.hasAnchor(s))&&i.push(s)}}),n&&(n.aliasResolveCache=i));let r;for(let o of i){if(o===this)break;o.anchor===this.source&&(r=o)}return r}toJSON(e,n){if(!n)return{source:this.source};let{anchors:i,doc:r,maxAliasCount:o}=n,s=this.resolve(r,n);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=i.get(s);if(a||(bf.toJS(s,null,n),a=i.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=Rn(r,s,i)),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,i){let r=`*${this.source}`;if(e){if(yf.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`${r} `}return r}};function Rn(t,e,n){if(st.isAlias(e)){let i=e.resolve(t),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(st.isCollection(e)){let i=0;for(let r of e.items){let o=Rn(t,r,n);o>i&&(i=o)}return i}else if(st.isPair(e)){let i=Rn(t,e.key,n),r=Rn(t,e.value,n);return Math.max(i,r)}return 1}Fs.Alias=ar});var j=v(cr=>{"use strict";var Sf=x(),Cf=Pn(),Ef=Se(),_f=t=>!t||typeof t!="function"&&typeof t!="object",Ce=class extends Cf.NodeBase{constructor(e){super(Sf.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Ef.toJS(this.value,e,n)}toString(){return String(this.value)}};Ce.BLOCK_FOLDED="BLOCK_FOLDED";Ce.BLOCK_LITERAL="BLOCK_LITERAL";Ce.PLAIN="PLAIN";Ce.QUOTE_DOUBLE="QUOTE_DOUBLE";Ce.QUOTE_SINGLE="QUOTE_SINGLE";cr.Scalar=Ce;cr.isScalarValue=_f});var Tt=v(Bs=>{"use strict";var xf=jt(),Je=x(),Ms=j(),Pf="tag:yaml.org,2002:";function Rf(t,e,n){if(e){let i=n.filter(o=>o.tag===e),r=i.find(o=>!o.format)??i[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return n.find(i=>i.identify?.(t)&&!i.format)}function Af(t,e,n){if(Je.isDocument(t)&&(t=t.contents),Je.isNode(t))return t;if(Je.isPair(t)){let u=n.schema[Je.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:i,onAnchor:r,onTagObj:o,schema:s,sourceObjects:a}=n,c;if(i&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=r(t)),new xf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Pf+e.slice(2));let l=Rf(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new Ms.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?s[Je.MAP]:Symbol.iterator in Object(t)?s[Je.SEQ]:s[Je.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 Ms.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}Bs.createNode=Af});var On=v(An=>{"use strict";var Of=Tt(),ce=x(),Nf=Pn();function lr(t,e,n){let i=n;for(let r=e.length-1;r>=0;--r){let o=e[r];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=i,i=s}else i=new Map([[o,i]])}return Of.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Ks=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,ur=class extends Nf.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(i=>ce.isNode(i)||ce.isPair(i)?i.clone(e):i),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Ks(e))this.add(n);else{let[i,...r]=e,o=this.get(i,!0);if(ce.isCollection(o))o.addIn(r,n);else if(o===void 0&&this.schema)this.set(i,lr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(e){let[n,...i]=e;if(i.length===0)return this.delete(n);let r=this.get(n,!0);if(ce.isCollection(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(e,n){let[i,...r]=e,o=this.get(i,!0);return r.length===0?!n&&ce.isScalar(o)?o.value:o:ce.isCollection(o)?o.getIn(r,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!ce.isPair(n))return!1;let i=n.value;return i==null||e&&ce.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[n,...i]=e;if(i.length===0)return this.has(n);let r=this.get(n,!0);return ce.isCollection(r)?r.hasIn(i):!1}setIn(e,n){let[i,...r]=e;if(r.length===0)this.set(i,n);else{let o=this.get(i,!0);if(ce.isCollection(o))o.setIn(r,n);else if(o===void 0&&this.schema)this.set(i,lr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};An.Collection=ur;An.collectionFromPath=lr;An.isEmptyPath=Ks});var It=v(Nn=>{"use strict";var jf=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function fr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Tf=(t,e,n)=>t.endsWith(`
6
- `)?fr(n,e):n.includes(`
4
+ var zu=Object.create;var nr=Object.defineProperty;var Qu=Object.getOwnPropertyDescriptor;var Xu=Object.getOwnPropertyNames;var Zu=Object.getPrototypeOf,ef=Object.prototype.hasOwnProperty;var bn=(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 $=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(i){throw n=[i],i}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},tf=(t,e)=>{for(var n in e)nr(t,n,{get:e[n],enumerable:!0})},nf=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Xu(e))!ef.call(t,r)&&r!==n&&nr(t,r,{get:()=>e[r],enumerable:!(i=Qu(e,r))||i.enumerable});return t};var Pt=(t,e,n)=>(n=t!=null?zu(Zu(t)):{},nf(e||!t||!t.__esModule?nr(n,"default",{value:t,enumerable:!0}):n,t));var x=v(W=>{"use strict";var ir=Symbol.for("yaml.alias"),Es=Symbol.for("yaml.document"),Sn=Symbol.for("yaml.map"),_s=Symbol.for("yaml.pair"),rr=Symbol.for("yaml.scalar"),Cn=Symbol.for("yaml.seq"),pe=Symbol.for("yaml.node.type"),rf=t=>!!t&&typeof t=="object"&&t[pe]===ir,of=t=>!!t&&typeof t=="object"&&t[pe]===Es,sf=t=>!!t&&typeof t=="object"&&t[pe]===Sn,af=t=>!!t&&typeof t=="object"&&t[pe]===_s,xs=t=>!!t&&typeof t=="object"&&t[pe]===rr,cf=t=>!!t&&typeof t=="object"&&t[pe]===Cn;function Ps(t){if(t&&typeof t=="object")switch(t[pe]){case Sn:case Cn:return!0}return!1}function lf(t){if(t&&typeof t=="object")switch(t[pe]){case ir:case Sn:case rr:case Cn:return!0}return!1}var uf=t=>(xs(t)||Ps(t))&&!!t.anchor;W.ALIAS=ir;W.DOC=Es;W.MAP=Sn;W.NODE_TYPE=pe;W.PAIR=_s;W.SCALAR=rr;W.SEQ=Cn;W.hasAnchor=uf;W.isAlias=rf;W.isCollection=Ps;W.isDocument=of;W.isMap=sf;W.isNode=lf;W.isPair=af;W.isScalar=xs;W.isSeq=cf});var Rt=v(or=>{"use strict";var q=x(),Y=Symbol("break visit"),Rs=Symbol("skip children"),ae=Symbol("remove node");function En(t,e){let n=Os(e);q.isDocument(t)?ot(null,t.contents,n,Object.freeze([t]))===ae&&(t.contents=null):ot(null,t,n,Object.freeze([]))}En.BREAK=Y;En.SKIP=Rs;En.REMOVE=ae;function ot(t,e,n,i){let r=As(t,e,n,i);if(q.isNode(r)||q.isPair(r))return Ns(t,i,r),ot(t,r,n,i);if(typeof r!="symbol"){if(q.isCollection(e)){i=Object.freeze(i.concat(e));for(let o=0;o<e.items.length;++o){let s=ot(o,e.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===Y)return Y;s===ae&&(e.items.splice(o,1),o-=1)}}}else if(q.isPair(e)){i=Object.freeze(i.concat(e));let o=ot("key",e.key,n,i);if(o===Y)return Y;o===ae&&(e.key=null);let s=ot("value",e.value,n,i);if(s===Y)return Y;s===ae&&(e.value=null)}}return r}async function _n(t,e){let n=Os(e);q.isDocument(t)?await st(null,t.contents,n,Object.freeze([t]))===ae&&(t.contents=null):await st(null,t,n,Object.freeze([]))}_n.BREAK=Y;_n.SKIP=Rs;_n.REMOVE=ae;async function st(t,e,n,i){let r=await As(t,e,n,i);if(q.isNode(r)||q.isPair(r))return Ns(t,i,r),st(t,r,n,i);if(typeof r!="symbol"){if(q.isCollection(e)){i=Object.freeze(i.concat(e));for(let o=0;o<e.items.length;++o){let s=await st(o,e.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===Y)return Y;s===ae&&(e.items.splice(o,1),o-=1)}}}else if(q.isPair(e)){i=Object.freeze(i.concat(e));let o=await st("key",e.key,n,i);if(o===Y)return Y;o===ae&&(e.key=null);let s=await st("value",e.value,n,i);if(s===Y)return Y;s===ae&&(e.value=null)}}return r}function Os(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 As(t,e,n,i){if(typeof n=="function")return n(t,e,i);if(q.isMap(e))return n.Map?.(t,e,i);if(q.isSeq(e))return n.Seq?.(t,e,i);if(q.isPair(e))return n.Pair?.(t,e,i);if(q.isScalar(e))return n.Scalar?.(t,e,i);if(q.isAlias(e))return n.Alias?.(t,e,i)}function Ns(t,e,n){let i=e[e.length-1];if(q.isCollection(i))i.items[t]=n;else if(q.isPair(i))t==="key"?i.key=n:i.value=n;else if(q.isDocument(i))i.contents=n;else{let r=q.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}or.visit=En;or.visitAsync=_n});var sr=v(Ts=>{"use strict";var js=x(),ff=Rt(),df={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},pf=t=>t.replace(/[!,[\]{}]/g,e=>df[e]),Ot=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 i=e.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[o,s]=i;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=i;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 ${r}`,!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[,i,r]=e.match(/^(.*!)([^!]*)$/s);r||n(`The ${e} tag has no suffix`);let o=this.tags[i];if(o)try{return o+decodeURIComponent(r)}catch(s){return n(String(s)),null}return i==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,i]of Object.entries(this.tags))if(e.startsWith(i))return n+pf(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(e&&i.length>0&&js.isNode(e.contents)){let o={};ff.visit(e.contents,(s,a)=>{js.isNode(a)&&a.tag&&(o[a.tag]=!0)}),r=Object.keys(o)}else r=[];for(let[o,s]of i)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
5
+ `)}};Ot.defaultYaml={explicit:!1,version:"1.2"};Ot.defaultTags={"!!":"tag:yaml.org,2002:"};Ts.Directives=Ot});var xn=v(At=>{"use strict";var Is=x(),mf=Rt();function hf(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 $s(t){let e=new Set;return mf.visit(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function qs(t,e){for(let n=1;;++n){let i=`${t}${n}`;if(!e.has(i))return i}}function gf(t,e){let n=[],i=new Map,r=null;return{onAnchor:o=>{n.push(o),r??(r=$s(t));let s=qs(e,r);return r.add(s),s},setAnchors:()=>{for(let o of n){let s=i.get(o);if(typeof s=="object"&&s.anchor&&(Is.isScalar(s.node)||Is.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:i}}At.anchorIsValid=hf;At.anchorNames=$s;At.createNodeAnchors=gf;At.findNewAnchor=qs});var ar=v(Ls=>{"use strict";function Nt(t,e,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,o=i.length;r<o;++r){let s=i[r],a=Nt(t,i,String(r),s);a===void 0?delete i[r]:a!==s&&(i[r]=a)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let o=i.get(r),s=Nt(t,i,r,o);s===void 0?i.delete(r):s!==o&&i.set(r,s)}else if(i instanceof Set)for(let r of Array.from(i)){let o=Nt(t,i,r,r);o===void 0?i.delete(r):o!==r&&(i.delete(r),i.add(o))}else for(let[r,o]of Object.entries(i)){let s=Nt(t,i,r,o);s===void 0?delete i[r]:s!==o&&(i[r]=s)}return t.call(e,n,i)}Ls.applyReviver=Nt});var Ce=v(Ds=>{"use strict";var wf=x();function Ws(t,e,n){if(Array.isArray(t))return t.map((i,r)=>Ws(i,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!wf.hasAnchor(t))return t.toJSON(e,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(t,i),n.onCreate=o=>{i.res=o,delete n.onCreate};let r=t.toJSON(e,n);return n.onCreate&&n.onCreate(r),r}return typeof t=="bigint"&&!n?.keep?Number(t):t}Ds.toJS=Ws});var Pn=v(Ms=>{"use strict";var yf=ar(),Fs=x(),vf=Ce(),cr=class{constructor(e){Object.defineProperty(this,Fs.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:i,onAnchor:r,reviver:o}={}){if(!Fs.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 i=="number"?i:100},a=vf.toJS(this,"",s);if(typeof r=="function")for(let{count:c,res:l}of s.anchors.values())r(l,c);return typeof o=="function"?yf.applyReviver(o,{"":a},"",a):a}};Ms.NodeBase=cr});var jt=v(Bs=>{"use strict";var kf=xn(),bf=Rt(),at=x(),Sf=Pn(),Cf=Ce(),lr=class extends Sf.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 i;n?.aliasResolveCache?i=n.aliasResolveCache:(i=[],bf.visit(e,{Node:(o,s)=>{(at.isAlias(s)||at.hasAnchor(s))&&i.push(s)}}),n&&(n.aliasResolveCache=i));let r;for(let o of i){if(o===this)break;o.anchor===this.source&&(r=o)}return r}toJSON(e,n){if(!n)return{source:this.source};let{anchors:i,doc:r,maxAliasCount:o}=n,s=this.resolve(r,n);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=i.get(s);if(a||(Cf.toJS(s,null,n),a=i.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=Rn(r,s,i)),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,i){let r=`*${this.source}`;if(e){if(kf.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`${r} `}return r}};function Rn(t,e,n){if(at.isAlias(e)){let i=e.resolve(t),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(at.isCollection(e)){let i=0;for(let r of e.items){let o=Rn(t,r,n);o>i&&(i=o)}return i}else if(at.isPair(e)){let i=Rn(t,e.key,n),r=Rn(t,e.value,n);return Math.max(i,r)}return 1}Bs.Alias=lr});var T=v(ur=>{"use strict";var Ef=x(),_f=Pn(),xf=Ce(),Pf=t=>!t||typeof t!="function"&&typeof t!="object",Ee=class extends _f.NodeBase{constructor(e){super(Ef.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:xf.toJS(this.value,e,n)}toString(){return String(this.value)}};Ee.BLOCK_FOLDED="BLOCK_FOLDED";Ee.BLOCK_LITERAL="BLOCK_LITERAL";Ee.PLAIN="PLAIN";Ee.QUOTE_DOUBLE="QUOTE_DOUBLE";Ee.QUOTE_SINGLE="QUOTE_SINGLE";ur.Scalar=Ee;ur.isScalarValue=Pf});var Tt=v(Us=>{"use strict";var Rf=jt(),Je=x(),Ks=T(),Of="tag:yaml.org,2002:";function Af(t,e,n){if(e){let i=n.filter(o=>o.tag===e),r=i.find(o=>!o.format)??i[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return n.find(i=>i.identify?.(t)&&!i.format)}function Nf(t,e,n){if(Je.isDocument(t)&&(t=t.contents),Je.isNode(t))return t;if(Je.isPair(t)){let u=n.schema[Je.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:i,onAnchor:r,onTagObj:o,schema:s,sourceObjects:a}=n,c;if(i&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=r(t)),new Rf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Of+e.slice(2));let l=Af(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new Ks.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?s[Je.MAP]:Symbol.iterator in Object(t)?s[Je.SEQ]:s[Je.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 Ks.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}Us.createNode=Nf});var An=v(On=>{"use strict";var jf=Tt(),ce=x(),Tf=Pn();function fr(t,e,n){let i=n;for(let r=e.length-1;r>=0;--r){let o=e[r];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=i,i=s}else i=new Map([[o,i]])}return jf.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Hs=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,dr=class extends Tf.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(i=>ce.isNode(i)||ce.isPair(i)?i.clone(e):i),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Hs(e))this.add(n);else{let[i,...r]=e,o=this.get(i,!0);if(ce.isCollection(o))o.addIn(r,n);else if(o===void 0&&this.schema)this.set(i,fr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(e){let[n,...i]=e;if(i.length===0)return this.delete(n);let r=this.get(n,!0);if(ce.isCollection(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(e,n){let[i,...r]=e,o=this.get(i,!0);return r.length===0?!n&&ce.isScalar(o)?o.value:o:ce.isCollection(o)?o.getIn(r,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!ce.isPair(n))return!1;let i=n.value;return i==null||e&&ce.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[n,...i]=e;if(i.length===0)return this.has(n);let r=this.get(n,!0);return ce.isCollection(r)?r.hasIn(i):!1}setIn(e,n){let[i,...r]=e;if(r.length===0)this.set(i,n);else{let o=this.get(i,!0);if(ce.isCollection(o))o.setIn(r,n);else if(o===void 0&&this.schema)this.set(i,fr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};On.Collection=dr;On.collectionFromPath=fr;On.isEmptyPath=Hs});var It=v(Nn=>{"use strict";var If=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function pr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var $f=(t,e,n)=>t.endsWith(`
6
+ `)?pr(n,e):n.includes(`
7
7
  `)?`
8
- `+fr(n,e):(t.endsWith(" ")?"":" ")+n;Nn.indentComment=fr;Nn.lineComment=Tf;Nn.stringifyComment=jf});var Hs=v(qt=>{"use strict";var If="flow",dr="block",jn="quoted";function qf(t,e,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!r||r<0)return t;r<o&&(o=0);let c=Math.max(1+o,1+r-e.length);if(t.length<=c)return t;let l=[],f={},u=r-e.length;typeof i=="number"&&(i>r-Math.max(2,o)?l.push(0):u=r-i);let d,h,w=!1,p=-1,m=-1,y=-1;n===dr&&(p=Us(t,p,e.length),p!==-1&&(u=p+c));for(let b;b=t[p+=1];){if(n===jn&&b==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}y=p}if(b===`
9
- `)n===dr&&(p=Us(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(b===" "&&h&&h!==" "&&h!==`
8
+ `+pr(n,e):(t.endsWith(" ")?"":" ")+n;Nn.indentComment=pr;Nn.lineComment=$f;Nn.stringifyComment=If});var Js=v($t=>{"use strict";var qf="flow",mr="block",jn="quoted";function Lf(t,e,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!r||r<0)return t;r<o&&(o=0);let c=Math.max(1+o,1+r-e.length);if(t.length<=c)return t;let l=[],f={},u=r-e.length;typeof i=="number"&&(i>r-Math.max(2,o)?l.push(0):u=r-i);let d,h,w=!1,p=-1,m=-1,y=-1;n===mr&&(p=Ys(t,p,e.length),p!==-1&&(u=p+c));for(let b;b=t[p+=1];){if(n===jn&&b==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}y=p}if(b===`
9
+ `)n===mr&&(p=Ys(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(b===" "&&h&&h!==" "&&h!==`
10
10
  `&&h!==" "){let S=t[p+1];S&&S!==" "&&S!==`
11
11
  `&&S!==" "&&(d=p)}if(p>=u)if(d)l.push(d),u=d+c,d=void 0;else if(n===jn){for(;h===" "||h===" ";)h=b,b=t[p+=1],w=!0;let S=p>y+1?p-2:m-1;if(f[S])return t;l.push(S),f[S]=!0,u=S+c,d=void 0}else w=!0}h=b}if(w&&a&&a(),l.length===0)return t;s&&s();let g=t.slice(0,l[0]);for(let b=0;b<l.length;++b){let S=l[b],C=l[b+1]||t.length;S===0?g=`
12
12
  ${e}${t.slice(0,C)}`:(n===jn&&f[S]&&(g+=`${t[S]}\\`),g+=`
13
- ${e}${t.slice(S+1,C)}`)}return g}function Us(t,e,n){let i=e,r=e+1,o=t[r];for(;o===" "||o===" ";)if(e<r+n)o=t[++e];else{do o=t[++e];while(o&&o!==`
14
- `);i=e,r=e+1,o=t[r]}return i}qt.FOLD_BLOCK=dr;qt.FOLD_FLOW=If;qt.FOLD_QUOTED=jn;qt.foldFlowLines=qf});var Lt=v(Ys=>{"use strict";var te=j(),Ee=Hs(),In=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),qn=t=>/^(%|---|\.\.\.)/m.test(t);function $f(t,e,n){if(!e||e<0)return!1;let i=e-n,r=t.length;if(r<=i)return!1;for(let o=0,s=0;o<r;++o)if(t[o]===`
15
- `){if(o-s>i)return!0;if(s=o+1,r-s<=i)return!1}return!0}function $t(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=e,r=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(i||n[c+2]==='"'||n.length<r)c+=1;else{for(s+=n.slice(a,c)+`
13
+ ${e}${t.slice(S+1,C)}`)}return g}function Ys(t,e,n){let i=e,r=e+1,o=t[r];for(;o===" "||o===" ";)if(e<r+n)o=t[++e];else{do o=t[++e];while(o&&o!==`
14
+ `);i=e,r=e+1,o=t[r]}return i}$t.FOLD_BLOCK=mr;$t.FOLD_FLOW=qf;$t.FOLD_QUOTED=jn;$t.foldFlowLines=Lf});var Lt=v(Vs=>{"use strict";var te=T(),_e=Js(),In=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),$n=t=>/^(%|---|\.\.\.)/m.test(t);function Wf(t,e,n){if(!e||e<0)return!1;let i=e-n,r=t.length;if(r<=i)return!1;for(let o=0,s=0;o<r;++o)if(t[o]===`
15
+ `){if(o-s>i)return!0;if(s=o+1,r-s<=i)return!1}return!0}function qt(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=e,r=e.options.doubleQuotedMinMultiLineLength,o=e.indent||($n(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(i||n[c+2]==='"'||n.length<r)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,i?s:Ee.foldFlowLines(s,o,Ee.FOLD_QUOTED,In(e,!1))}function pr(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)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${n}`)+"'";return e.implicitKey?i:Ee.foldFlowLines(i,n,Ee.FOLD_FLOW,In(e,!1))}function at(t,e){let{singleQuote:n}=e.options,i;if(n===!1)i=$t;else{let r=t.includes('"'),o=t.includes("'");r&&!o?i=pr:o&&!r?i=$t:i=n?pr:$t}return i(t,e)}var mr;try{mr=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,i?s:_e.foldFlowLines(s,o,_e.FOLD_QUOTED,In(e,!1))}function hr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(t))return qt(t,e);let n=e.indent||($n(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${n}`)+"'";return e.implicitKey?i:_e.foldFlowLines(i,n,_e.FOLD_FLOW,In(e,!1))}function ct(t,e){let{singleQuote:n}=e.options,i;if(n===!1)i=qt;else{let r=t.includes('"'),o=t.includes("'");r&&!o?i=hr:o&&!r?i=qt:i=n?hr:qt}return i(t,e)}var gr;try{gr=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{mr=/\n+(?!\n|$)/g}function Tn({comment:t,type:e,value:n},i,r,o){let{blockQuote:s,commentString:a,lineWidth:c}=i.options;if(!s||/\n[\t ]+$/.test(n))return at(n,i);let l=i.indent||(i.forceBlockIndent||qn(n)?" ":""),f=s==="literal"?!0:s==="folded"||e===te.Scalar.BLOCK_FOLDED?!1:e===te.Scalar.BLOCK_LITERAL?!0:!$f(n,c,l.length);if(!n)return f?`|
23
+ |$)`,"g")}catch{gr=/\n+(?!\n|$)/g}function Tn({comment:t,type:e,value:n},i,r,o){let{blockQuote:s,commentString:a,lineWidth:c}=i.options;if(!s||/\n[\t ]+$/.test(n))return ct(n,i);let l=i.indent||(i.forceBlockIndent||$n(n)?" ":""),f=s==="literal"?!0:s==="folded"||e===te.Scalar.BLOCK_FOLDED?!1:e===te.Scalar.BLOCK_LITERAL?!0:!Wf(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),w=h.indexOf(`
27
27
  `);w===-1?u="-":n===h||w!==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(mr,`$&${l}`));let p=!1,m,y=-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(gr,`$&${l}`));let p=!1,m,y=-1;for(m=0;m<n.length;++m){let C=n[m];if(C===" ")p=!0;else if(C===`
29
29
  `)y=m;else break}let g=n.substring(0,y<m?y+1:m);g&&(n=n.substring(g.length),g=g.replace(/\n+/g,`$&${l}`));let S=(p?l?"2":"1":"")+u;if(t&&(S+=" "+a(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!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,_=In(i,!0);s!=="folded"&&e!==te.Scalar.BLOCK_FOLDED&&(_.onOverflow=()=>{E=!0});let k=Ee.foldFlowLines(`${g}${C}${h}`,l,Ee.FOLD_BLOCK,_);if(!E)return`>${S}
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,_=In(i,!0);s!=="folded"&&e!==te.Scalar.BLOCK_FOLDED&&(_.onOverflow=()=>{E=!0});let k=_e.foldFlowLines(`${g}${C}${h}`,l,_e.FOLD_BLOCK,_);if(!E)return`>${S}
31
31
  ${l}${k}`}return n=n.replace(/\n+/g,`$&${l}`),`|${S}
32
- ${l}${g}${n}${h}`}function Lf(t,e,n,i){let{type:r,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:f}=e;if(a&&o.includes(`
33
- `)||f&&/[[\]{},]/.test(o))return at(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||f||!o.includes(`
34
- `)?at(o,e):Tn(t,e,n,i);if(!a&&!f&&r!==te.Scalar.PLAIN&&o.includes(`
35
- `))return Tn(t,e,n,i);if(qn(o)){if(c==="")return e.forceBlockIndent=!0,Tn(t,e,n,i);if(a&&c===l)return at(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:w}=e.doc.schema;if(w.some(d)||h?.some(d))return at(o,e)}return a?u:Ee.foldFlowLines(u,c,Ee.FOLD_FLOW,In(e,!1))}function Df(t,e,n,i){let{implicitKey:r,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==te.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=te.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case te.Scalar.BLOCK_FOLDED:case te.Scalar.BLOCK_LITERAL:return r||o?at(s.value,e):Tn(s,e,n,i);case te.Scalar.QUOTE_DOUBLE:return $t(s.value,e);case te.Scalar.QUOTE_SINGLE:return pr(s.value,e);case te.Scalar.PLAIN:return Lf(s,e,n,i);default:return null}},l=c(a);if(l===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=r&&f||u;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}Ys.stringifyString=Df});var Dt=v(hr=>{"use strict";var Wf=xn(),_e=x(),Ff=It(),Mf=Lt();function Bf(t,e){let n=Object.assign({blockQuote:!0,commentString:Ff.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),i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function Kf(t,e){if(e.tag){let r=t.filter(o=>o.tag===e.tag);if(r.length>0)return r.find(o=>o.format===e.format)??r[0]}let n,i;if(_e.isScalar(e)){i=e.value;let r=t.filter(o=>o.identify?.(i));if(r.length>1){let o=r.filter(s=>s.test);o.length>0&&(r=o)}n=r.find(o=>o.format===e.format)??r.find(o=>!o.format)}else i=e,n=t.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){let r=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function Uf(t,e,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],o=(_e.isScalar(t)||_e.isCollection(t))&&t.anchor;o&&Wf.anchorIsValid(o)&&(n.add(o),r.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&r.push(i.directives.tagString(s)),r.join(" ")}function Hf(t,e,n,i){if(_e.isPair(t))return t.toString(e,n,i);if(_e.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 r,o=_e.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=Kf(e.doc.schema.tags,o));let s=Uf(o,r,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof r.stringify=="function"?r.stringify(o,e,n,i):_e.isScalar(o)?Mf.stringifyString(o,e,n,i):o.toString(e,n,i);return s?_e.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
37
- ${e.indent}${a}`:a}hr.createStringifyContext=Bf;hr.stringify=Hf});var zs=v(Gs=>{"use strict";var me=x(),Js=j(),Vs=Dt(),Wt=It();function Yf({key:t,value:e},n,i,r){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=n,d=me.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(me.isCollection(t)||!me.isNode(t)&&typeof t=="object"){let _="With simple keys, collection cannot be used as a key value";throw new Error(_)}}let h=!u&&(!t||d&&e==null&&!n.inFlow||me.isCollection(t)||(me.isScalar(t)?t.type===Js.Scalar.BLOCK_FOLDED||t.type===Js.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!o),indent:a+c});let w=!1,p=!1,m=Vs.stringify(t,n,()=>w=!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 w&&i&&i(),m===""?"?":h?`? ${m}`:m}else if(o&&!u||e==null&&h)return m=`? ${m}`,d&&!w?m+=Wt.lineComment(m,n.indent,l(d)):p&&r&&r(),m;w&&(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 y,g,b;me.isNode(e)?(y=!!e.spaceBefore,g=e.commentBefore,b=e.comment):(y=!1,g=null,b=null,e&&typeof e=="object"&&(e=s.createNode(e))),n.implicitKey=!1,!h&&!d&&me.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!f&&c.length>=2&&!n.inFlow&&!h&&me.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let S=!1,C=Vs.stringify(e,n,()=>S=!0,()=>p=!0),E=" ";if(d||y||g){if(E=y?`
32
+ ${l}${g}${n}${h}`}function Df(t,e,n,i){let{type:r,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):Tn(t,e,n,i);if(!a&&!f&&r!==te.Scalar.PLAIN&&o.includes(`
35
+ `))return Tn(t,e,n,i);if($n(o)){if(c==="")return e.forceBlockIndent=!0,Tn(t,e,n,i);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:w}=e.doc.schema;if(w.some(d)||h?.some(d))return ct(o,e)}return a?u:_e.foldFlowLines(u,c,_e.FOLD_FLOW,In(e,!1))}function Ff(t,e,n,i){let{implicitKey:r,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==te.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=te.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case te.Scalar.BLOCK_FOLDED:case te.Scalar.BLOCK_LITERAL:return r||o?ct(s.value,e):Tn(s,e,n,i);case te.Scalar.QUOTE_DOUBLE:return qt(s.value,e);case te.Scalar.QUOTE_SINGLE:return hr(s.value,e);case te.Scalar.PLAIN:return Df(s,e,n,i);default:return null}},l=c(a);if(l===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=r&&f||u;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}Vs.stringifyString=Ff});var Wt=v(wr=>{"use strict";var Mf=xn(),xe=x(),Bf=It(),Kf=Lt();function Uf(t,e){let n=Object.assign({blockQuote:!0,commentString:Bf.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),i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function Hf(t,e){if(e.tag){let r=t.filter(o=>o.tag===e.tag);if(r.length>0)return r.find(o=>o.format===e.format)??r[0]}let n,i;if(xe.isScalar(e)){i=e.value;let r=t.filter(o=>o.identify?.(i));if(r.length>1){let o=r.filter(s=>s.test);o.length>0&&(r=o)}n=r.find(o=>o.format===e.format)??r.find(o=>!o.format)}else i=e,n=t.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){let r=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function Yf(t,e,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],o=(xe.isScalar(t)||xe.isCollection(t))&&t.anchor;o&&Mf.anchorIsValid(o)&&(n.add(o),r.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&r.push(i.directives.tagString(s)),r.join(" ")}function Jf(t,e,n,i){if(xe.isPair(t))return t.toString(e,n,i);if(xe.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 r,o=xe.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=Hf(e.doc.schema.tags,o));let s=Yf(o,r,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof r.stringify=="function"?r.stringify(o,e,n,i):xe.isScalar(o)?Kf.stringifyString(o,e,n,i):o.toString(e,n,i);return s?xe.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
37
+ ${e.indent}${a}`:a}wr.createStringifyContext=Uf;wr.stringify=Jf});var Xs=v(Qs=>{"use strict";var me=x(),Gs=T(),zs=Wt(),Dt=It();function Vf({key:t,value:e},n,i,r){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=n,d=me.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(me.isCollection(t)||!me.isNode(t)&&typeof t=="object"){let _="With simple keys, collection cannot be used as a key value";throw new Error(_)}}let h=!u&&(!t||d&&e==null&&!n.inFlow||me.isCollection(t)||(me.isScalar(t)?t.type===Gs.Scalar.BLOCK_FOLDED||t.type===Gs.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!o),indent:a+c});let w=!1,p=!1,m=zs.stringify(t,n,()=>w=!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 w&&i&&i(),m===""?"?":h?`? ${m}`:m}else if(o&&!u||e==null&&h)return m=`? ${m}`,d&&!w?m+=Dt.lineComment(m,n.indent,l(d)):p&&r&&r(),m;w&&(d=null),h?(d&&(m+=Dt.lineComment(m,n.indent,l(d))),m=`? ${m}
38
+ ${a}:`):(m=`${m}:`,d&&(m+=Dt.lineComment(m,n.indent,l(d))));let y,g,b;me.isNode(e)?(y=!!e.spaceBefore,g=e.commentBefore,b=e.comment):(y=!1,g=null,b=null,e&&typeof e=="object"&&(e=s.createNode(e))),n.implicitKey=!1,!h&&!d&&me.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!f&&c.length>=2&&!n.inFlow&&!h&&me.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let S=!1,C=zs.stringify(e,n,()=>S=!0,()=>p=!0),E=" ";if(d||y||g){if(E=y?`
39
39
  `:"",g){let _=l(g);E+=`
40
- ${Wt.indentComment(_,n.indent)}`}C===""&&!n.inFlow?E===`
40
+ ${Dt.indentComment(_,n.indent)}`}C===""&&!n.inFlow?E===`
41
41
  `&&b&&(E=`
42
42
 
43
43
  `):E+=`
44
44
  ${n.indent}`}else if(!h&&me.isCollection(e)){let _=C[0],k=C.indexOf(`
45
- `),N=k!==-1,se=n.inFlow??e.flow??e.items.length===0;if(N||!se){let H=!1;if(N&&(_==="&"||_==="!")){let R=C.indexOf(" ");_==="&"&&R!==-1&&R<k&&C[R+1]==="!"&&(R=C.indexOf(" ",R+1)),(R===-1||k<R)&&(H=!0)}H||(E=`
45
+ `),j=k!==-1,se=n.inFlow??e.flow??e.items.length===0;if(j||!se){let H=!1;if(j&&(_==="&"||_==="!")){let R=C.indexOf(" ");_==="&"&&R!==-1&&R<k&&C[R+1]==="!"&&(R=C.indexOf(" ",R+1)),(R===-1||k<R)&&(H=!0)}H||(E=`
46
46
  ${n.indent}`)}}else(C===""||C[0]===`
47
- `)&&(E="");return m+=E+C,n.inFlow?S&&i&&i():b&&!S?m+=Wt.lineComment(m,n.indent,l(b)):p&&r&&r(),m}Gs.stringifyPair=Yf});var wr=v(gr=>{"use strict";var Qs=bn("process");function Jf(t,...e){t==="debug"&&console.log(...e)}function Vf(t,e){(t==="debug"||t==="warn")&&(typeof Qs.emitWarning=="function"?Qs.emitWarning(e):console.warn(e))}gr.debug=Jf;gr.warn=Vf});var Fn=v(Wn=>{"use strict";var Dn=x(),Xs=j(),$n="<<",Ln={identify:t=>t===$n||typeof t=="symbol"&&t.description===$n,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Xs.Scalar(Symbol($n)),{addToJSMap:Zs}),stringify:()=>$n},Gf=(t,e)=>(Ln.identify(e)||Dn.isScalar(e)&&(!e.type||e.type===Xs.Scalar.PLAIN)&&Ln.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Ln.tag&&n.default);function Zs(t,e,n){let i=ea(t,n);if(Dn.isSeq(i))for(let r of i.items)yr(t,e,r);else if(Array.isArray(i))for(let r of i)yr(t,e,r);else yr(t,e,i)}function yr(t,e,n){let i=ea(t,n);if(!Dn.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,t,Map);for(let[o,s]of r)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 ea(t,e){return t&&Dn.isAlias(e)?e.resolve(t.doc,t):e}Wn.addMergeToJSMap=Zs;Wn.isMergeKey=Gf;Wn.merge=Ln});var kr=v(ia=>{"use strict";var zf=wr(),ta=Fn(),Qf=Dt(),na=x(),vr=Se();function Xf(t,e,{key:n,value:i}){if(na.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,i);else if(ta.isMergeKey(t,n))ta.addMergeToJSMap(t,e,i);else{let r=vr.toJS(n,"",t);if(e instanceof Map)e.set(r,vr.toJS(i,r,t));else if(e instanceof Set)e.add(r);else{let o=Zf(n,r,t),s=vr.toJS(i,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function Zf(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(na.isNode(t)&&n?.doc){let i=Qf.createStringifyContext(n.doc,{});i.anchors=new Set;for(let o of n.anchors.keys())i.anchors.add(o.anchor);i.inFlow=!0,i.inStringifyKey=!0;let r=t.toString(i);if(!n.mapKeyWarned){let o=JSON.stringify(r);o.length>40&&(o=o.substring(0,36)+'..."'),zf.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 r}return JSON.stringify(e)}ia.addPairToJSMap=Xf});var xe=v(br=>{"use strict";var ra=Tt(),ed=zs(),td=kr(),Mn=x();function nd(t,e,n){let i=ra.createNode(t,void 0,n),r=ra.createNode(e,void 0,n);return new Bn(i,r)}var Bn=class t{constructor(e,n=null){Object.defineProperty(this,Mn.NODE_TYPE,{value:Mn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return Mn.isNode(n)&&(n=n.clone(e)),Mn.isNode(i)&&(i=i.clone(e)),new t(n,i)}toJSON(e,n){let i=n?.mapAsMap?new Map:{};return td.addPairToJSMap(n,i,this)}toString(e,n,i){return e?.doc?ed.stringifyPair(this,e,n,i):JSON.stringify(this)}};br.Pair=Bn;br.createPair=nd});var Sr=v(sa=>{"use strict";var Ve=x(),oa=Dt(),Kn=It();function id(t,e,n){return(e.inFlow??t.flow?od:rd)(t,e,n)}function rd({comment:t,items:e},n,{blockItemPrefix:i,flowChars:r,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 w=0;w<e.length;++w){let p=e[w],m=null;if(Ve.isNode(p))!u&&p.spaceBefore&&d.push(""),Un(n,d,p.commentBefore,u),p.comment&&(m=p.comment);else if(Ve.isPair(p)){let g=Ve.isNode(p.key)?p.key:null;g&&(!u&&g.spaceBefore&&d.push(""),Un(n,d,g.commentBefore,u))}u=!1;let y=oa.stringify(p,f,()=>m=null,()=>u=!0);m&&(y+=Kn.lineComment(y,o,l(m))),u&&m&&(u=!1),d.push(i+y)}let h;if(d.length===0)h=r.start+r.end;else{h=d[0];for(let w=1;w<d.length;++w){let p=d[w];h+=p?`
47
+ `)&&(E="");return m+=E+C,n.inFlow?S&&i&&i():b&&!S?m+=Dt.lineComment(m,n.indent,l(b)):p&&r&&r(),m}Qs.stringifyPair=Vf});var vr=v(yr=>{"use strict";var Zs=bn("process");function Gf(t,...e){t==="debug"&&console.log(...e)}function zf(t,e){(t==="debug"||t==="warn")&&(typeof Zs.emitWarning=="function"?Zs.emitWarning(e):console.warn(e))}yr.debug=Gf;yr.warn=zf});var Fn=v(Dn=>{"use strict";var Wn=x(),ea=T(),qn="<<",Ln={identify:t=>t===qn||typeof t=="symbol"&&t.description===qn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ea.Scalar(Symbol(qn)),{addToJSMap:ta}),stringify:()=>qn},Qf=(t,e)=>(Ln.identify(e)||Wn.isScalar(e)&&(!e.type||e.type===ea.Scalar.PLAIN)&&Ln.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Ln.tag&&n.default);function ta(t,e,n){let i=na(t,n);if(Wn.isSeq(i))for(let r of i.items)kr(t,e,r);else if(Array.isArray(i))for(let r of i)kr(t,e,r);else kr(t,e,i)}function kr(t,e,n){let i=na(t,n);if(!Wn.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,t,Map);for(let[o,s]of r)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 na(t,e){return t&&Wn.isAlias(e)?e.resolve(t.doc,t):e}Dn.addMergeToJSMap=ta;Dn.isMergeKey=Qf;Dn.merge=Ln});var Sr=v(oa=>{"use strict";var Xf=vr(),ia=Fn(),Zf=Wt(),ra=x(),br=Ce();function ed(t,e,{key:n,value:i}){if(ra.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,i);else if(ia.isMergeKey(t,n))ia.addMergeToJSMap(t,e,i);else{let r=br.toJS(n,"",t);if(e instanceof Map)e.set(r,br.toJS(i,r,t));else if(e instanceof Set)e.add(r);else{let o=td(n,r,t),s=br.toJS(i,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function td(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(ra.isNode(t)&&n?.doc){let i=Zf.createStringifyContext(n.doc,{});i.anchors=new Set;for(let o of n.anchors.keys())i.anchors.add(o.anchor);i.inFlow=!0,i.inStringifyKey=!0;let r=t.toString(i);if(!n.mapKeyWarned){let o=JSON.stringify(r);o.length>40&&(o=o.substring(0,36)+'..."'),Xf.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 r}return JSON.stringify(e)}oa.addPairToJSMap=ed});var Pe=v(Cr=>{"use strict";var sa=Tt(),nd=Xs(),id=Sr(),Mn=x();function rd(t,e,n){let i=sa.createNode(t,void 0,n),r=sa.createNode(e,void 0,n);return new Bn(i,r)}var Bn=class t{constructor(e,n=null){Object.defineProperty(this,Mn.NODE_TYPE,{value:Mn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return Mn.isNode(n)&&(n=n.clone(e)),Mn.isNode(i)&&(i=i.clone(e)),new t(n,i)}toJSON(e,n){let i=n?.mapAsMap?new Map:{};return id.addPairToJSMap(n,i,this)}toString(e,n,i){return e?.doc?nd.stringifyPair(this,e,n,i):JSON.stringify(this)}};Cr.Pair=Bn;Cr.createPair=rd});var Er=v(ca=>{"use strict";var Ve=x(),aa=Wt(),Kn=It();function od(t,e,n){return(e.inFlow??t.flow?ad:sd)(t,e,n)}function sd({comment:t,items:e},n,{blockItemPrefix:i,flowChars:r,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 w=0;w<e.length;++w){let p=e[w],m=null;if(Ve.isNode(p))!u&&p.spaceBefore&&d.push(""),Un(n,d,p.commentBefore,u),p.comment&&(m=p.comment);else if(Ve.isPair(p)){let g=Ve.isNode(p.key)?p.key:null;g&&(!u&&g.spaceBefore&&d.push(""),Un(n,d,g.commentBefore,u))}u=!1;let y=aa.stringify(p,f,()=>m=null,()=>u=!0);m&&(y+=Kn.lineComment(y,o,l(m))),u&&m&&(u=!1),d.push(i+y)}let h;if(d.length===0)h=r.start+r.end;else{h=d[0];for(let w=1;w<d.length;++w){let p=d[w];h+=p?`
48
48
  ${c}${p}`:`
49
49
  `}}return t?(h+=`
50
- `+Kn.indentComment(l(t),c),a&&a()):u&&s&&s(),h}function od({items:t},e,{flowChars:n,itemIndent:i}){let{indent:r,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;i+=o;let c=Object.assign({},e,{indent:i,inFlow:!0,type:null}),l=!1,f=0,u=[];for(let w=0;w<t.length;++w){let p=t[w],m=null;if(Ve.isNode(p))p.spaceBefore&&u.push(""),Un(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(Ve.isPair(p)){let g=Ve.isNode(p.key)?p.key:null;g&&(g.spaceBefore&&u.push(""),Un(e,u,g.commentBefore,!1),g.comment&&(l=!0));let b=Ve.isNode(p.value)?p.value:null;b?(b.comment&&(m=b.comment),b.commentBefore&&(l=!0)):p.value==null&&g?.comment&&(m=g.comment)}m&&(l=!0);let y=oa.stringify(p,c,()=>m=null);l||(l=u.length>f||y.includes(`
50
+ `+Kn.indentComment(l(t),c),a&&a()):u&&s&&s(),h}function ad({items:t},e,{flowChars:n,itemIndent:i}){let{indent:r,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;i+=o;let c=Object.assign({},e,{indent:i,inFlow:!0,type:null}),l=!1,f=0,u=[];for(let w=0;w<t.length;++w){let p=t[w],m=null;if(Ve.isNode(p))p.spaceBefore&&u.push(""),Un(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(Ve.isPair(p)){let g=Ve.isNode(p.key)?p.key:null;g&&(g.spaceBefore&&u.push(""),Un(e,u,g.commentBefore,!1),g.comment&&(l=!0));let b=Ve.isNode(p.value)?p.value:null;b?(b.comment&&(m=b.comment),b.commentBefore&&(l=!0)):p.value==null&&g?.comment&&(m=g.comment)}m&&(l=!0);let y=aa.stringify(p,c,()=>m=null);l||(l=u.length>f||y.includes(`
51
51
  `)),w<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((g,b)=>g+b.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),m&&(y+=Kn.lineComment(y,i,a(m))),u.push(y),f=u.length}let{start:d,end:h}=n;if(u.length===0)return d+h;if(!l){let w=u.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&w>e.options.lineWidth}if(l){let w=d;for(let p of u)w+=p?`
52
52
  ${o}${r}${p}`:`
53
53
  `;return`${w}
54
- ${r}${h}`}else return`${d}${s}${u.join(" ")}${s}${h}`}function Un({indent:t,options:{commentString:e}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let o=Kn.indentComment(e(i),t);n.push(o.trimStart())}}sa.stringifyCollection=id});var Re=v(Er=>{"use strict";var sd=Sr(),ad=kr(),cd=On(),Pe=x(),Hn=xe(),ld=j();function Ft(t,e){let n=Pe.isScalar(e)?e.value:e;for(let i of t)if(Pe.isPair(i)&&(i.key===e||i.key===n||Pe.isScalar(i.key)&&i.key.value===n))return i}var Cr=class extends cd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Pe.MAP,e),this.items=[]}static from(e,n,i){let{keepUndefined:r,replacer:o}=i,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||r)&&s.items.push(Hn.createPair(c,l,i))};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 i;Pe.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new Hn.Pair(e,e?.value):i=new Hn.Pair(e.key,e.value);let r=Ft(this.items,i.key),o=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);Pe.isScalar(r.value)&&ld.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(o){let s=this.items.findIndex(a=>o(i,a)<0);s===-1?this.items.push(i):this.items.splice(s,0,i)}else this.items.push(i)}delete(e){let n=Ft(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let r=Ft(this.items,e)?.value;return(!n&&Pe.isScalar(r)?r.value:r)??void 0}has(e){return!!Ft(this.items,e)}set(e,n){this.add(new Hn.Pair(e,n),!0)}toJSON(e,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let o of this.items)ad.addPairToJSMap(n,r,o);return r}toString(e,n,i){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Pe.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),sd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}};Er.YAMLMap=Cr;Er.findPair=Ft});var ct=v(ca=>{"use strict";var ud=x(),aa=Re(),fd={collection:"map",default:!0,nodeClass:aa.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ud.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>aa.YAMLMap.from(t,e,n)};ca.map=fd});var Ae=v(la=>{"use strict";var dd=Tt(),pd=Sr(),md=On(),Jn=x(),hd=j(),gd=Se(),_r=class extends md.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Jn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Yn(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let i=Yn(e);if(typeof i!="number")return;let r=this.items[i];return!n&&Jn.isScalar(r)?r.value:r}has(e){let n=Yn(e);return typeof n=="number"&&n<this.items.length}set(e,n){let i=Yn(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[i];Jn.isScalar(r)&&hd.isScalarValue(n)?r.value=n:this.items[i]=n}toJSON(e,n){let i=[];n?.onCreate&&n.onCreate(i);let r=0;for(let o of this.items)i.push(gd.toJS(o,String(r++),n));return i}toString(e,n,i){return e?pd.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:n}):JSON.stringify(this)}static from(e,n,i){let{replacer:r}=i,o=new this(e);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof r=="function"){let c=n instanceof Set?a:String(s++);a=r.call(n,c,a)}o.items.push(dd.createNode(a,void 0,i))}}return o}};function Yn(t){let e=Jn.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}la.YAMLSeq=_r});var lt=v(fa=>{"use strict";var wd=x(),ua=Ae(),yd={collection:"seq",default:!0,nodeClass:ua.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return wd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>ua.YAMLSeq.from(t,e,n)};fa.seq=yd});var Mt=v(da=>{"use strict";var vd=Lt(),kd={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,i){return e=Object.assign({actualString:!0},e),vd.stringifyString(t,e,n,i)}};da.string=kd});var Vn=v(ha=>{"use strict";var pa=j(),ma={identify:t=>t==null,createNode:()=>new pa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new pa.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&ma.test.test(t)?t:e.options.nullStr};ha.nullTag=ma});var xr=v(wa=>{"use strict";var bd=j(),ga={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new bd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&ga.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};wa.boolTag=ga});var ut=v(ya=>{"use strict";function Sd({format:t,minFractionDigits:e,tag:n,value:i}){if(typeof i=="bigint")return String(i);let r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let o=Object.is(i,-0)?"-0":JSON.stringify(i);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}ya.stringifyNumber=Sd});var Rr=v(Gn=>{"use strict";var Cd=j(),Pr=ut(),Ed={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:Pr.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():Pr.stringifyNumber(t)}},xd={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 Cd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Pr.stringifyNumber};Gn.float=xd;Gn.floatExp=_d;Gn.floatNaN=Ed});var Or=v(Qn=>{"use strict";var va=ut(),zn=t=>typeof t=="bigint"||Number.isInteger(t),Ar=(t,e,n,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),n);function ka(t,e,n){let{value:i}=t;return zn(i)&&i>=0?n+i.toString(e):va.stringifyNumber(t)}var Pd={identify:t=>zn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Ar(t,2,8,n),stringify:t=>ka(t,8,"0o")},Rd={identify:zn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Ar(t,0,10,n),stringify:va.stringifyNumber},Ad={identify:t=>zn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Ar(t,2,16,n),stringify:t=>ka(t,16,"0x")};Qn.int=Rd;Qn.intHex=Ad;Qn.intOct=Pd});var Sa=v(ba=>{"use strict";var Od=ct(),Nd=Vn(),jd=lt(),Td=Mt(),Id=xr(),Nr=Rr(),jr=Or(),qd=[Od.map,jd.seq,Td.string,Nd.nullTag,Id.boolTag,jr.intOct,jr.int,jr.intHex,Nr.floatNaN,Nr.floatExp,Nr.float];ba.schema=qd});var _a=v(Ea=>{"use strict";var $d=j(),Ld=ct(),Dd=lt();function Ca(t){return typeof t=="bigint"||Number.isInteger(t)}var Xn=({value:t})=>JSON.stringify(t),Wd=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Xn},{identify:t=>t==null,createNode:()=>new $d.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Xn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Xn},{identify:Ca,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})=>Ca(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:Xn}],Fd={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Md=[Ld.map,Dd.seq].concat(Wd,Fd);Ea.schema=Md});var Ir=v(xa=>{"use strict";var Bt=bn("buffer"),Tr=j(),Bd=Lt(),Kd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Bt.Buffer=="function")return Bt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}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},i,r,o){if(!n)return"";let s=n,a;if(typeof Bt.Buffer=="function")a=s instanceof Bt.Buffer?s.toString("base64"):Bt.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=Tr.Scalar.BLOCK_LITERAL),e!==Tr.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.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===Tr.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return Bd.stringifyString({comment:t,type:e,value:a},i,r,o)}};xa.binary=Kd});var ti=v(ei=>{"use strict";var Zn=x(),qr=xe(),Ud=j(),Hd=Ae();function Pa(t,e){if(Zn.isSeq(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!Zn.isPair(i)){if(Zn.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new qr.Pair(new Ud.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
54
+ ${r}${h}`}else return`${d}${s}${u.join(" ")}${s}${h}`}function Un({indent:t,options:{commentString:e}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let o=Kn.indentComment(e(i),t);n.push(o.trimStart())}}ca.stringifyCollection=od});var Oe=v(xr=>{"use strict";var cd=Er(),ld=Sr(),ud=An(),Re=x(),Hn=Pe(),fd=T();function Ft(t,e){let n=Re.isScalar(e)?e.value:e;for(let i of t)if(Re.isPair(i)&&(i.key===e||i.key===n||Re.isScalar(i.key)&&i.key.value===n))return i}var _r=class extends ud.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Re.MAP,e),this.items=[]}static from(e,n,i){let{keepUndefined:r,replacer:o}=i,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||r)&&s.items.push(Hn.createPair(c,l,i))};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 i;Re.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new Hn.Pair(e,e?.value):i=new Hn.Pair(e.key,e.value);let r=Ft(this.items,i.key),o=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);Re.isScalar(r.value)&&fd.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(o){let s=this.items.findIndex(a=>o(i,a)<0);s===-1?this.items.push(i):this.items.splice(s,0,i)}else this.items.push(i)}delete(e){let n=Ft(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let r=Ft(this.items,e)?.value;return(!n&&Re.isScalar(r)?r.value:r)??void 0}has(e){return!!Ft(this.items,e)}set(e,n){this.add(new Hn.Pair(e,n),!0)}toJSON(e,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let o of this.items)ld.addPairToJSMap(n,r,o);return r}toString(e,n,i){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Re.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),cd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}};xr.YAMLMap=_r;xr.findPair=Ft});var lt=v(ua=>{"use strict";var dd=x(),la=Oe(),pd={collection:"map",default:!0,nodeClass:la.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return dd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>la.YAMLMap.from(t,e,n)};ua.map=pd});var Ae=v(fa=>{"use strict";var md=Tt(),hd=Er(),gd=An(),Jn=x(),wd=T(),yd=Ce(),Pr=class extends gd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Jn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Yn(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let i=Yn(e);if(typeof i!="number")return;let r=this.items[i];return!n&&Jn.isScalar(r)?r.value:r}has(e){let n=Yn(e);return typeof n=="number"&&n<this.items.length}set(e,n){let i=Yn(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[i];Jn.isScalar(r)&&wd.isScalarValue(n)?r.value=n:this.items[i]=n}toJSON(e,n){let i=[];n?.onCreate&&n.onCreate(i);let r=0;for(let o of this.items)i.push(yd.toJS(o,String(r++),n));return i}toString(e,n,i){return e?hd.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:n}):JSON.stringify(this)}static from(e,n,i){let{replacer:r}=i,o=new this(e);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof r=="function"){let c=n instanceof Set?a:String(s++);a=r.call(n,c,a)}o.items.push(md.createNode(a,void 0,i))}}return o}};function Yn(t){let e=Jn.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}fa.YAMLSeq=Pr});var ut=v(pa=>{"use strict";var vd=x(),da=Ae(),kd={collection:"seq",default:!0,nodeClass:da.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return vd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>da.YAMLSeq.from(t,e,n)};pa.seq=kd});var Mt=v(ma=>{"use strict";var bd=Lt(),Sd={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,i){return e=Object.assign({actualString:!0},e),bd.stringifyString(t,e,n,i)}};ma.string=Sd});var Vn=v(wa=>{"use strict";var ha=T(),ga={identify:t=>t==null,createNode:()=>new ha.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ha.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&ga.test.test(t)?t:e.options.nullStr};wa.nullTag=ga});var Rr=v(va=>{"use strict";var Cd=T(),ya={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Cd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&ya.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};va.boolTag=ya});var ft=v(ka=>{"use strict";function Ed({format:t,minFractionDigits:e,tag:n,value:i}){if(typeof i=="bigint")return String(i);let r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let o=Object.is(i,-0)?"-0":JSON.stringify(i);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}ka.stringifyNumber=Ed});var Ar=v(Gn=>{"use strict";var _d=T(),Or=ft(),xd={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:Or.stringifyNumber},Pd={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():Or.stringifyNumber(t)}},Rd={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 _d.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Or.stringifyNumber};Gn.float=Rd;Gn.floatExp=Pd;Gn.floatNaN=xd});var jr=v(Qn=>{"use strict";var ba=ft(),zn=t=>typeof t=="bigint"||Number.isInteger(t),Nr=(t,e,n,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),n);function Sa(t,e,n){let{value:i}=t;return zn(i)&&i>=0?n+i.toString(e):ba.stringifyNumber(t)}var Od={identify:t=>zn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Nr(t,2,8,n),stringify:t=>Sa(t,8,"0o")},Ad={identify:zn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Nr(t,0,10,n),stringify:ba.stringifyNumber},Nd={identify:t=>zn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Nr(t,2,16,n),stringify:t=>Sa(t,16,"0x")};Qn.int=Ad;Qn.intHex=Nd;Qn.intOct=Od});var Ea=v(Ca=>{"use strict";var jd=lt(),Td=Vn(),Id=ut(),$d=Mt(),qd=Rr(),Tr=Ar(),Ir=jr(),Ld=[jd.map,Id.seq,$d.string,Td.nullTag,qd.boolTag,Ir.intOct,Ir.int,Ir.intHex,Tr.floatNaN,Tr.floatExp,Tr.float];Ca.schema=Ld});var Pa=v(xa=>{"use strict";var Wd=T(),Dd=lt(),Fd=ut();function _a(t){return typeof t=="bigint"||Number.isInteger(t)}var Xn=({value:t})=>JSON.stringify(t),Md=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Xn},{identify:t=>t==null,createNode:()=>new Wd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Xn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Xn},{identify:_a,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})=>_a(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:Xn}],Bd={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Kd=[Dd.map,Fd.seq].concat(Md,Bd);xa.schema=Kd});var qr=v(Ra=>{"use strict";var Bt=bn("buffer"),$r=T(),Ud=Lt(),Hd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Bt.Buffer=="function")return Bt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}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},i,r,o){if(!n)return"";let s=n,a;if(typeof Bt.Buffer=="function")a=s instanceof Bt.Buffer?s.toString("base64"):Bt.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=$r.Scalar.BLOCK_LITERAL),e!==$r.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.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===$r.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return Ud.stringifyString({comment:t,type:e,value:a},i,r,o)}};Ra.binary=Hd});var ti=v(ei=>{"use strict";var Zn=x(),Lr=Pe(),Yd=T(),Jd=Ae();function Oa(t,e){if(Zn.isSeq(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!Zn.isPair(i)){if(Zn.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new Lr.Pair(new Yd.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
56
56
  ${r.key.commentBefore}`:i.commentBefore),i.comment){let o=r.value??r.key;o.comment=o.comment?`${i.comment}
57
- ${o.comment}`:i.comment}i=r}t.items[n]=Zn.isPair(i)?i:new qr.Pair(i)}}else e("Expected a sequence for this tag");return t}function Ra(t,e,n){let{replacer:i}=n,r=new Hd.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof i=="function"&&(s=i.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;r.items.push(qr.createPair(a,c,n))}return r}var Yd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Pa,createNode:Ra};ei.createPairs=Ra;ei.pairs=Yd;ei.resolvePairs=Pa});var Dr=v(Lr=>{"use strict";var Aa=x(),$r=Se(),Kt=Re(),Jd=Ae(),Oa=ti(),Ge=class t extends Jd.YAMLSeq{constructor(){super(),this.add=Kt.YAMLMap.prototype.add.bind(this),this.delete=Kt.YAMLMap.prototype.delete.bind(this),this.get=Kt.YAMLMap.prototype.get.bind(this),this.has=Kt.YAMLMap.prototype.has.bind(this),this.set=Kt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let o,s;if(Aa.isPair(r)?(o=$r.toJS(r.key,"",n),s=$r.toJS(r.value,o,n)):o=$r.toJS(r,"",n),i.has(o))throw new Error("Ordered maps must not include duplicate keys");i.set(o,s)}return i}static from(e,n,i){let r=Oa.createPairs(e,n,i),o=new this;return o.items=r.items,o}};Ge.tag="tag:yaml.org,2002:omap";var Vd={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ge,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Oa.resolvePairs(t,e),i=[];for(let{key:r}of n.items)Aa.isScalar(r)&&(i.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new Ge,n)},createNode:(t,e,n)=>Ge.from(t,e,n)};Lr.YAMLOMap=Ge;Lr.omap=Vd});var qa=v(Wr=>{"use strict";var Na=j();function ja({value:t,source:e},n){return e&&(t?Ta:Ia).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var Ta={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 Na.Scalar(!0),stringify:ja},Ia={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 Na.Scalar(!1),stringify:ja};Wr.falseTag=Ia;Wr.trueTag=Ta});var $a=v(ni=>{"use strict";var Gd=j(),Fr=ut(),zd={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:Fr.stringifyNumber},Qd={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():Fr.stringifyNumber(t)}},Xd={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 Gd.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let i=t.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(e.minFractionDigits=i.length)}return e},stringify:Fr.stringifyNumber};ni.float=Xd;ni.floatExp=Qd;ni.floatNaN=zd});var Da=v(Ht=>{"use strict";var La=ut(),Ut=t=>typeof t=="bigint"||Number.isInteger(t);function ii(t,e,n,{intAsBigInt:i}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),i){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 r==="-"?BigInt(-1)*s:s}let o=parseInt(t,n);return r==="-"?-1*o:o}function Mr(t,e,n){let{value:i}=t;if(Ut(i)){let r=i.toString(e);return i<0?"-"+n+r.substr(1):n+r}return La.stringifyNumber(t)}var Zd={identify:Ut,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>ii(t,2,2,n),stringify:t=>Mr(t,2,"0b")},ep={identify:Ut,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>ii(t,1,8,n),stringify:t=>Mr(t,8,"0")},tp={identify:Ut,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>ii(t,0,10,n),stringify:La.stringifyNumber},np={identify:Ut,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>ii(t,2,16,n),stringify:t=>Mr(t,16,"0x")};Ht.int=tp;Ht.intBin=Zd;Ht.intHex=np;Ht.intOct=ep});var Kr=v(Br=>{"use strict";var si=x(),ri=xe(),oi=Re(),ze=class t extends oi.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;si.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new ri.Pair(e.key,null):n=new ri.Pair(e,null),oi.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let i=oi.findPair(this.items,e);return!n&&si.isPair(i)?si.isScalar(i.key)?i.key.value:i.key:i}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 i=oi.findPair(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new ri.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(e,n,i){let{replacer:r}=i,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof r=="function"&&(s=r.call(n,s,s)),o.items.push(ri.createPair(s,null,i));return o}};ze.tag="tag:yaml.org,2002:set";var ip={collection:"map",identify:t=>t instanceof Set,nodeClass:ze,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>ze.from(t,e,n),resolve(t,e){if(si.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ze,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Br.YAMLSet=ze;Br.set=ip});var Hr=v(ai=>{"use strict";var rp=ut();function Ur(t,e){let n=t[0],i=n==="-"||n==="+"?t.substring(1):t,r=s=>e?BigInt(s):Number(s),o=i.replace(/_/g,"").split(":").reduce((s,a)=>s*r(60)+r(a),r(0));return n==="-"?r(-1)*o:o}function Wa(t){let{value:e}=t,n=s=>s;if(typeof e=="bigint")n=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return rp.stringifyNumber(t);let i="";e<0&&(i="-",e*=n(-1));let r=n(60),o=[e%r];return e<60?o.unshift(0):(e=(e-o[0])/r,o.unshift(e%r),e>=60&&(e=(e-o[0])/r,o.unshift(e))),i+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var op={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})=>Ur(t,n),stringify:Wa},sp={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=>Ur(t,!1),stringify:Wa},Fa={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(Fa.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,i-1,r,o||0,s||0,a||0,c),f=e[8];if(f&&f!=="Z"){let u=Ur(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$/,"")??""};ai.floatTime=sp;ai.intTime=op;ai.timestamp=Fa});var Ka=v(Ba=>{"use strict";var ap=ct(),cp=Vn(),lp=lt(),up=Mt(),fp=Ir(),Ma=qa(),Yr=$a(),ci=Da(),dp=Fn(),pp=Dr(),mp=ti(),hp=Kr(),Jr=Hr(),gp=[ap.map,lp.seq,up.string,cp.nullTag,Ma.trueTag,Ma.falseTag,ci.intBin,ci.intOct,ci.int,ci.intHex,Yr.floatNaN,Yr.floatExp,Yr.float,fp.binary,dp.merge,pp.omap,mp.pairs,hp.set,Jr.intTime,Jr.floatTime,Jr.timestamp];Ba.schema=gp});var Za=v(zr=>{"use strict";var Ja=ct(),wp=Vn(),Va=lt(),yp=Mt(),vp=xr(),Vr=Rr(),Gr=Or(),kp=Sa(),bp=_a(),Ga=Ir(),Yt=Fn(),za=Dr(),Qa=ti(),Ua=Ka(),Xa=Kr(),li=Hr(),Ha=new Map([["core",kp.schema],["failsafe",[Ja.map,Va.seq,yp.string]],["json",bp.schema],["yaml11",Ua.schema],["yaml-1.1",Ua.schema]]),Ya={binary:Ga.binary,bool:vp.boolTag,float:Vr.float,floatExp:Vr.floatExp,floatNaN:Vr.floatNaN,floatTime:li.floatTime,int:Gr.int,intHex:Gr.intHex,intOct:Gr.intOct,intTime:li.intTime,map:Ja.map,merge:Yt.merge,null:wp.nullTag,omap:za.omap,pairs:Qa.pairs,seq:Va.seq,set:Xa.set,timestamp:li.timestamp},Sp={"tag:yaml.org,2002:binary":Ga.binary,"tag:yaml.org,2002:merge":Yt.merge,"tag:yaml.org,2002:omap":za.omap,"tag:yaml.org,2002:pairs":Qa.pairs,"tag:yaml.org,2002:set":Xa.set,"tag:yaml.org,2002:timestamp":li.timestamp};function Cp(t,e,n){let i=Ha.get(e);if(i&&!t)return n&&!i.includes(Yt.merge)?i.concat(Yt.merge):i.slice();let r=i;if(!r)if(Array.isArray(t))r=[];else{let o=Array.from(Ha.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)r=r.concat(o);else typeof t=="function"&&(r=t(r.slice()));return n&&(r=r.concat(Yt.merge)),r.reduce((o,s)=>{let a=typeof s=="string"?Ya[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(Ya).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},[])}zr.coreKnownTags=Sp;zr.getTags=Cp});var Zr=v(ec=>{"use strict";var Qr=x(),Ep=ct(),_p=lt(),xp=Mt(),ui=Za(),Pp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Xr=class t{constructor({compat:e,customTags:n,merge:i,resolveKnownTags:r,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?ui.getTags(e,"compat"):e?ui.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=r?ui.coreKnownTags:{},this.tags=ui.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,Qr.MAP,{value:Ep.map}),Object.defineProperty(this,Qr.SCALAR,{value:xp.string}),Object.defineProperty(this,Qr.SEQ,{value:_p.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Pp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};ec.Schema=Xr});var nc=v(tc=>{"use strict";var Rp=x(),eo=Dt(),Jt=It();function Ap(t,e){let n=[],i=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),i=!0):t.directives.docStart&&(i=!0)}i&&n.push("---");let r=eo.createStringifyContext(t,e),{commentString:o}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=o(t.commentBefore);n.unshift(Jt.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Rp.isNode(t.contents)){if(t.contents.spaceBefore&&i&&n.push(""),t.contents.commentBefore){let f=o(t.contents.commentBefore);n.push(Jt.indentComment(f,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=eo.stringify(t.contents,r,()=>a=null,c);a&&(l+=Jt.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(eo.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
57
+ ${o.comment}`:i.comment}i=r}t.items[n]=Zn.isPair(i)?i:new Lr.Pair(i)}}else e("Expected a sequence for this tag");return t}function Aa(t,e,n){let{replacer:i}=n,r=new Jd.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof i=="function"&&(s=i.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;r.items.push(Lr.createPair(a,c,n))}return r}var Vd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Oa,createNode:Aa};ei.createPairs=Aa;ei.pairs=Vd;ei.resolvePairs=Oa});var Fr=v(Dr=>{"use strict";var Na=x(),Wr=Ce(),Kt=Oe(),Gd=Ae(),ja=ti(),Ge=class t extends Gd.YAMLSeq{constructor(){super(),this.add=Kt.YAMLMap.prototype.add.bind(this),this.delete=Kt.YAMLMap.prototype.delete.bind(this),this.get=Kt.YAMLMap.prototype.get.bind(this),this.has=Kt.YAMLMap.prototype.has.bind(this),this.set=Kt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let o,s;if(Na.isPair(r)?(o=Wr.toJS(r.key,"",n),s=Wr.toJS(r.value,o,n)):o=Wr.toJS(r,"",n),i.has(o))throw new Error("Ordered maps must not include duplicate keys");i.set(o,s)}return i}static from(e,n,i){let r=ja.createPairs(e,n,i),o=new this;return o.items=r.items,o}};Ge.tag="tag:yaml.org,2002:omap";var zd={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ge,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=ja.resolvePairs(t,e),i=[];for(let{key:r}of n.items)Na.isScalar(r)&&(i.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new Ge,n)},createNode:(t,e,n)=>Ge.from(t,e,n)};Dr.YAMLOMap=Ge;Dr.omap=zd});var La=v(Mr=>{"use strict";var Ta=T();function Ia({value:t,source:e},n){return e&&(t?$a:qa).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var $a={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 Ta.Scalar(!0),stringify:Ia},qa={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 Ta.Scalar(!1),stringify:Ia};Mr.falseTag=qa;Mr.trueTag=$a});var Wa=v(ni=>{"use strict";var Qd=T(),Br=ft(),Xd={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:Br.stringifyNumber},Zd={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():Br.stringifyNumber(t)}},ep={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 Qd.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let i=t.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(e.minFractionDigits=i.length)}return e},stringify:Br.stringifyNumber};ni.float=ep;ni.floatExp=Zd;ni.floatNaN=Xd});var Fa=v(Ht=>{"use strict";var Da=ft(),Ut=t=>typeof t=="bigint"||Number.isInteger(t);function ii(t,e,n,{intAsBigInt:i}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),i){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 r==="-"?BigInt(-1)*s:s}let o=parseInt(t,n);return r==="-"?-1*o:o}function Kr(t,e,n){let{value:i}=t;if(Ut(i)){let r=i.toString(e);return i<0?"-"+n+r.substr(1):n+r}return Da.stringifyNumber(t)}var tp={identify:Ut,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>ii(t,2,2,n),stringify:t=>Kr(t,2,"0b")},np={identify:Ut,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>ii(t,1,8,n),stringify:t=>Kr(t,8,"0")},ip={identify:Ut,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>ii(t,0,10,n),stringify:Da.stringifyNumber},rp={identify:Ut,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>ii(t,2,16,n),stringify:t=>Kr(t,16,"0x")};Ht.int=ip;Ht.intBin=tp;Ht.intHex=rp;Ht.intOct=np});var Hr=v(Ur=>{"use strict";var si=x(),ri=Pe(),oi=Oe(),ze=class t extends oi.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;si.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new ri.Pair(e.key,null):n=new ri.Pair(e,null),oi.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let i=oi.findPair(this.items,e);return!n&&si.isPair(i)?si.isScalar(i.key)?i.key.value:i.key:i}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 i=oi.findPair(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new ri.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(e,n,i){let{replacer:r}=i,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof r=="function"&&(s=r.call(n,s,s)),o.items.push(ri.createPair(s,null,i));return o}};ze.tag="tag:yaml.org,2002:set";var op={collection:"map",identify:t=>t instanceof Set,nodeClass:ze,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>ze.from(t,e,n),resolve(t,e){if(si.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ze,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Ur.YAMLSet=ze;Ur.set=op});var Jr=v(ai=>{"use strict";var sp=ft();function Yr(t,e){let n=t[0],i=n==="-"||n==="+"?t.substring(1):t,r=s=>e?BigInt(s):Number(s),o=i.replace(/_/g,"").split(":").reduce((s,a)=>s*r(60)+r(a),r(0));return n==="-"?r(-1)*o:o}function Ma(t){let{value:e}=t,n=s=>s;if(typeof e=="bigint")n=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return sp.stringifyNumber(t);let i="";e<0&&(i="-",e*=n(-1));let r=n(60),o=[e%r];return e<60?o.unshift(0):(e=(e-o[0])/r,o.unshift(e%r),e>=60&&(e=(e-o[0])/r,o.unshift(e))),i+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var ap={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})=>Yr(t,n),stringify:Ma},cp={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=>Yr(t,!1),stringify:Ma},Ba={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(Ba.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,i-1,r,o||0,s||0,a||0,c),f=e[8];if(f&&f!=="Z"){let u=Yr(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$/,"")??""};ai.floatTime=cp;ai.intTime=ap;ai.timestamp=Ba});var Ha=v(Ua=>{"use strict";var lp=lt(),up=Vn(),fp=ut(),dp=Mt(),pp=qr(),Ka=La(),Vr=Wa(),ci=Fa(),mp=Fn(),hp=Fr(),gp=ti(),wp=Hr(),Gr=Jr(),yp=[lp.map,fp.seq,dp.string,up.nullTag,Ka.trueTag,Ka.falseTag,ci.intBin,ci.intOct,ci.int,ci.intHex,Vr.floatNaN,Vr.floatExp,Vr.float,pp.binary,mp.merge,hp.omap,gp.pairs,wp.set,Gr.intTime,Gr.floatTime,Gr.timestamp];Ua.schema=yp});var tc=v(Xr=>{"use strict";var Ga=lt(),vp=Vn(),za=ut(),kp=Mt(),bp=Rr(),zr=Ar(),Qr=jr(),Sp=Ea(),Cp=Pa(),Qa=qr(),Yt=Fn(),Xa=Fr(),Za=ti(),Ya=Ha(),ec=Hr(),li=Jr(),Ja=new Map([["core",Sp.schema],["failsafe",[Ga.map,za.seq,kp.string]],["json",Cp.schema],["yaml11",Ya.schema],["yaml-1.1",Ya.schema]]),Va={binary:Qa.binary,bool:bp.boolTag,float:zr.float,floatExp:zr.floatExp,floatNaN:zr.floatNaN,floatTime:li.floatTime,int:Qr.int,intHex:Qr.intHex,intOct:Qr.intOct,intTime:li.intTime,map:Ga.map,merge:Yt.merge,null:vp.nullTag,omap:Xa.omap,pairs:Za.pairs,seq:za.seq,set:ec.set,timestamp:li.timestamp},Ep={"tag:yaml.org,2002:binary":Qa.binary,"tag:yaml.org,2002:merge":Yt.merge,"tag:yaml.org,2002:omap":Xa.omap,"tag:yaml.org,2002:pairs":Za.pairs,"tag:yaml.org,2002:set":ec.set,"tag:yaml.org,2002:timestamp":li.timestamp};function _p(t,e,n){let i=Ja.get(e);if(i&&!t)return n&&!i.includes(Yt.merge)?i.concat(Yt.merge):i.slice();let r=i;if(!r)if(Array.isArray(t))r=[];else{let o=Array.from(Ja.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)r=r.concat(o);else typeof t=="function"&&(r=t(r.slice()));return n&&(r=r.concat(Yt.merge)),r.reduce((o,s)=>{let a=typeof s=="string"?Va[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(Va).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},[])}Xr.coreKnownTags=Ep;Xr.getTags=_p});var to=v(nc=>{"use strict";var Zr=x(),xp=lt(),Pp=ut(),Rp=Mt(),ui=tc(),Op=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,eo=class t{constructor({compat:e,customTags:n,merge:i,resolveKnownTags:r,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?ui.getTags(e,"compat"):e?ui.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=r?ui.coreKnownTags:{},this.tags=ui.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,Zr.MAP,{value:xp.map}),Object.defineProperty(this,Zr.SCALAR,{value:Rp.string}),Object.defineProperty(this,Zr.SEQ,{value:Pp.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Op:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};nc.Schema=eo});var rc=v(ic=>{"use strict";var Ap=x(),no=Wt(),Jt=It();function Np(t,e){let n=[],i=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),i=!0):t.directives.docStart&&(i=!0)}i&&n.push("---");let r=no.createStringifyContext(t,e),{commentString:o}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=o(t.commentBefore);n.unshift(Jt.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Ap.isNode(t.contents)){if(t.contents.spaceBefore&&i&&n.push(""),t.contents.commentBefore){let f=o(t.contents.commentBefore);n.push(Jt.indentComment(f,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=no.stringify(t.contents,r,()=>a=null,c);a&&(l+=Jt.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(no.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
58
58
  `)?(n.push("..."),n.push(Jt.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(Jt.indentComment(o(c),"")))}return n.join(`
59
59
  `)+`
60
- `}tc.stringifyDocument=Ap});var Vt=v(ic=>{"use strict";var Op=jt(),ft=On(),Q=x(),Np=xe(),jp=Se(),Tp=Zr(),Ip=nc(),to=xn(),qp=or(),$p=Tt(),no=rr(),io=class t{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Q.NODE_TYPE,{value:Q.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=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"},i);this.options=o;let{version:s}=o;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new no.Directives({version:s}),this.setSchema(s,i),this.contents=e===void 0?null:this.createNode(e,r,i)}clone(){let e=Object.create(t.prototype,{[Q.NODE_TYPE]:{value:Q.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=Q.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){dt(this.contents)&&this.contents.add(e)}addIn(e,n){dt(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let i=to.anchorNames(this);e.anchor=!n||i.has(n)?to.findNewAnchor(n||"a",i):n}return new Op.Alias(e.anchor)}createNode(e,n,i){let r;if(typeof n=="function")e=n.call({"":e},"",e),r=n;else if(Array.isArray(n)){let m=g=>typeof g=="number"||g instanceof String||g instanceof Number,y=n.filter(m).map(String);y.length>0&&(n=n.concat(y)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:f}=i??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=to.createNodeAnchors(this,s||"a"),w={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:h},p=$p.createNode(e,f,w);return a&&Q.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,i={}){let r=this.createNode(e,null,i),o=this.createNode(n,null,i);return new Np.Pair(r,o)}delete(e){return dt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return ft.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):dt(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return Q.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return ft.isEmptyPath(e)?!n&&Q.isScalar(this.contents)?this.contents.value:this.contents:Q.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return Q.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return ft.isEmptyPath(e)?this.contents!==void 0:Q.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=ft.collectionFromPath(this.schema,[e],n):dt(this.contents)&&this.contents.set(e,n)}setIn(e,n){ft.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=ft.collectionFromPath(this.schema,Array.from(e),n):dt(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new no.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new no.Directives({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new Tp.Schema(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:i,maxAliasCount:r,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=jp.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"?qp.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 Ip.stringifyDocument(this,e)}};function dt(t){if(Q.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}ic.Document=io});var Qt=v(zt=>{"use strict";var Gt=class extends Error{constructor(e,n,i,r){super(),this.name=e,this.code=i,this.message=r,this.pos=n}},ro=class extends Gt{constructor(e,n,i){super("YAMLParseError",e,n,i)}},oo=class extends Gt{constructor(e,n,i){super("YAMLWarning",e,n,i)}},Lp=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:i,col:r}=n.linePos[0];n.message+=` at line ${i}, column ${r}`;let o=r-1,s=t.substring(e.lineStarts[i-1],e.lineStarts[i]).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)+"…"),i>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[i-2],e.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`…
60
+ `}ic.stringifyDocument=Np});var Vt=v(oc=>{"use strict";var jp=jt(),dt=An(),Q=x(),Tp=Pe(),Ip=Ce(),$p=to(),qp=rc(),io=xn(),Lp=ar(),Wp=Tt(),ro=sr(),oo=class t{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Q.NODE_TYPE,{value:Q.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=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"},i);this.options=o;let{version:s}=o;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new ro.Directives({version:s}),this.setSchema(s,i),this.contents=e===void 0?null:this.createNode(e,r,i)}clone(){let e=Object.create(t.prototype,{[Q.NODE_TYPE]:{value:Q.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=Q.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 i=io.anchorNames(this);e.anchor=!n||i.has(n)?io.findNewAnchor(n||"a",i):n}return new jp.Alias(e.anchor)}createNode(e,n,i){let r;if(typeof n=="function")e=n.call({"":e},"",e),r=n;else if(Array.isArray(n)){let m=g=>typeof g=="number"||g instanceof String||g instanceof Number,y=n.filter(m).map(String);y.length>0&&(n=n.concat(y)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:f}=i??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=io.createNodeAnchors(this,s||"a"),w={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:h},p=Wp.createNode(e,f,w);return a&&Q.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,i={}){let r=this.createNode(e,null,i),o=this.createNode(n,null,i);return new Tp.Pair(r,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 Q.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return dt.isEmptyPath(e)?!n&&Q.isScalar(this.contents)?this.contents.value:this.contents:Q.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return Q.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return dt.isEmptyPath(e)?this.contents!==void 0:Q.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 i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ro.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new ro.Directives({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new $p.Schema(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:i,maxAliasCount:r,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=Ip.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"?Lp.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 qp.stringifyDocument(this,e)}};function pt(t){if(Q.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}oc.Document=oo});var Qt=v(zt=>{"use strict";var Gt=class extends Error{constructor(e,n,i,r){super(),this.name=e,this.code=i,this.message=r,this.pos=n}},so=class extends Gt{constructor(e,n,i){super("YAMLParseError",e,n,i)}},ao=class extends Gt{constructor(e,n,i){super("YAMLWarning",e,n,i)}},Dp=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:i,col:r}=n.linePos[0];n.message+=` at line ${i}, column ${r}`;let o=r-1,s=t.substring(e.lineStarts[i-1],e.lineStarts[i]).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)+"…"),i>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[i-2],e.lineStarts[i-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===i&&c.col>r&&(a=Math.max(1,Math.min(c.col-r,80-o)));let l=" ".repeat(o)+"^".repeat(a);n.message+=`:
62
62
 
63
63
  ${s}
64
64
  ${l}
65
- `}};zt.YAMLError=Gt;zt.YAMLParseError=ro;zt.YAMLWarning=oo;zt.prettifyError=Lp});var Xt=v(rc=>{"use strict";function Dp(t,{flow:e,indicator:n,next:i,offset:r,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",h=!1,w=!1,p=null,m=null,y=null,g=null,b=null,S=null,C=null;for(let k of t)switch(w&&(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"),w=!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"||i?.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 N=k.source.substring(1)||" ";u?u+=d+N:u=N,d="",l=!1;break}case"newline":l?u?u+=k.source:(!S||n!=="seq-item-ind")&&(c=!0):d+=k.source,l=!0,h=!0,(m||y)&&(g=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,w=!0;break;case"tag":{y&&o(k,"MULTIPLE_TAGS","A node can have at most one tag"),y=k,C??(C=k.offset),l=!1,f=!1,w=!0;break}case n:(m||y)&&o(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),S&&o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),S=k,l=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){b&&o(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=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],_=E?E.offset+E.source.length:r;return w&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&o(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=s||i?.type==="block-map"||i?.type==="block-seq")&&o(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:S,spaceBefore:c,comment:u,hasNewline:h,anchor:m,tag:y,newlineAfterProp:g,end:_,start:C??_}}rc.resolveProps=Dp});var fi=v(oc=>{"use strict";function so(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(so(e.key)||so(e.value))return!0}return!1;default:return!0}}oc.containsNewline=so});var ao=v(sc=>{"use strict";var Wp=fi();function Fp(t,e,n){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&Wp.containsNewline(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}sc.flowIndentCheck=Fp});var co=v(cc=>{"use strict";var ac=x();function Mp(t,e,n){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let r=typeof i=="function"?i:(o,s)=>o===s||ac.isScalar(o)&&ac.isScalar(s)&&o.value===s.value;return e.some(o=>r(o.key,n))}cc.mapIncludes=Mp});var mc=v(pc=>{"use strict";var lc=xe(),Bp=Re(),uc=Xt(),Kp=fi(),fc=ao(),Up=co(),dc="All mapping items must start at the same column";function Hp({composeNode:t,composeEmptyNode:e},n,i,r,o){let s=o?.nodeClass??Bp.YAMLMap,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,l=null;for(let f of i.items){let{start:u,key:d,sep:h,value:w}=f,p=uc.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),m=!p.found;if(m){if(d&&(d.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==i.indent&&r(c,"BAD_INDENT",dc)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
67
- `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||Kp.containsNewline(d))&&r(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==i.indent&&r(c,"BAD_INDENT",dc);n.atKey=!0;let y=p.end,g=d?t(n,d,p,r):e(n,y,u,null,p,r);n.schema.compat&&fc.flowIndentCheck(i.indent,d,r),n.atKey=!1,Up.mapIncludes(n,a.items,g)&&r(y,"DUPLICATE_KEY","Map keys must be unique");let b=uc.resolveProps(h??[],{indicator:"map-value-ind",next:w,offset:g.range[2],onError:r,parentIndent:i.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=b.end,b.found){m&&(w?.type==="block-map"&&!b.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<b.found.offset-1024&&r(g.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let S=w?t(n,w,b,r):e(n,c,h,null,b,r);n.schema.compat&&fc.flowIndentCheck(i.indent,w,r),c=S.range[2];let C=new lc.Pair(g,S);n.options.keepSourceTokens&&(C.srcToken=f),a.items.push(C)}else{m&&r(g.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(g.comment?g.comment+=`
68
- `+b.comment:g.comment=b.comment);let S=new lc.Pair(g);n.options.keepSourceTokens&&(S.srcToken=f),a.items.push(S)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}pc.resolveBlockMap=Hp});var gc=v(hc=>{"use strict";var Yp=Ae(),Jp=Xt(),Vp=ao();function Gp({composeNode:t,composeEmptyNode:e},n,i,r,o){let s=o?.nodeClass??Yp.YAMLSeq,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=i.offset,l=null;for(let{start:f,value:u}of i.items){let d=Jp.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?r(d.end,"BAD_INDENT","All sequence items must start at the same column"):r(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,r):e(n,d.end,f,null,d,r);n.schema.compat&&Vp.flowIndentCheck(i.indent,u,r),c=h.range[2],a.items.push(h)}return a.range=[i.offset,c,l??c],a}hc.resolveBlockSeq=Gp});var pt=v(wc=>{"use strict";function zp(t,e,n,i){let r="";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&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=c.substring(1)||" ";r?r+=s+f:r=f,s="";break}case"newline":r&&(s+=c),o=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:r,offset:e}}wc.resolveEnd=zp});var bc=v(kc=>{"use strict";var Qp=x(),Xp=xe(),yc=Re(),Zp=Ae(),em=pt(),vc=Xt(),tm=fi(),nm=co(),lo="Block collections are not allowed within flow collections",uo=t=>t&&(t.type==="block-map"||t.type==="block-seq");function im({composeNode:t,composeEmptyNode:e},n,i,r,o){let s=i.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?yc.YAMLMap:Zp.YAMLSeq),l=new c(n.schema);l.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let y=i.items[m],{start:g,key:b,sep:S,value:C}=y,E=vc.resolveProps(g,{flow:a,indicator:"explicit-key-ind",next:b??S?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!S&&!C){m===0&&E.comma?r(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<i.items.length-1&&r(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&&tm.containsNewline(b)&&r(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&r(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||r(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let _="";e:for(let k of g)switch(k.type){case"comma":case"space":break;case"comment":_=k.source.substring(1);break e;default:break e}if(_){let k=l.items[l.items.length-1];Qp.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
70
- `+_:k.comment=_,E.comment=E.comment.substring(_.length+1)}}if(!s&&!S&&!E.found){let _=C?t(n,C,E,r):e(n,E.end,S,null,E,r);l.items.push(_),u=_.range[2],uo(C)&&r(_.range,"BLOCK_IN_FLOW",lo)}else{n.atKey=!0;let _=E.end,k=b?t(n,b,E,r):e(n,_,g,null,E,r);uo(b)&&r(k.range,"BLOCK_IN_FLOW",lo),n.atKey=!1;let N=vc.resolveProps(S??[],{flow:a,indicator:"map-value-ind",next:C,offset:k.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(N.found){if(!s&&!E.found&&n.options.strict){if(S)for(let R of S){if(R===N.found)break;if(R.type==="newline"){r(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<N.found.offset-1024&&r(N.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]===":"?r(C,"MISSING_CHAR",`Missing space after : in ${a}`):r(N.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let se=C?t(n,C,N,r):N.found?e(n,N.end,S,null,N,r):null;se?uo(C)&&r(se.range,"BLOCK_IN_FLOW",lo):N.comment&&(k.comment?k.comment+=`
71
- `+N.comment:k.comment=N.comment);let H=new Xp.Pair(k,se);if(n.options.keepSourceTokens&&(H.srcToken=y),s){let R=l;nm.mapIncludes(n,R.items,k)&&r(_,"DUPLICATE_KEY","Map keys must be unique"),R.items.push(H)}else{let R=new yc.YAMLMap(n.schema);R.flow=!0,R.items.push(H);let xt=(se??k).range;R.range=[k.range[0],xt[1],xt[2]],l.items.push(R)}u=se?se.range[2]:N.end}}let d=s?"}":"]",[h,...w]=i.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),y=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;r(u,f?"MISSING_CHAR":"BAD_INDENT",y),h&&h.source.length!==1&&w.unshift(h)}if(w.length>0){let m=em.resolveEnd(w,p,n.options.strict,r);m.comment&&(l.comment?l.comment+=`
72
- `+m.comment:l.comment=m.comment),l.range=[i.offset,p,m.offset]}else l.range=[i.offset,p,p];return l}kc.resolveFlowCollection=im});var Cc=v(Sc=>{"use strict";var rm=x(),om=j(),sm=Re(),am=Ae(),cm=mc(),lm=gc(),um=bc();function fo(t,e,n,i,r,o){let s=n.type==="block-map"?cm.resolveBlockMap(t,e,n,i,o):n.type==="block-seq"?lm.resolveBlockSeq(t,e,n,i,o):um.resolveFlowCollection(t,e,n,i,o),a=s.constructor;return r==="!"||r===a.tagName?(s.tag=a.tagName,s):(r&&(s.tag=r),s)}function fm(t,e,n,i,r){let o=i.tag,s=o?e.directives.tagName(o.source,d=>r(o,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=i,w=d&&o?d.offset>o.offset?d:o:d??o;w&&(!h||h.offset<w.offset)&&r(w,"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===sm.YAMLMap.tagName&&a==="map"||s===am.YAMLSeq.tagName&&a==="seq")return fo(t,e,n,r,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?r(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):r(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),fo(t,e,n,r,s)}let l=fo(t,e,n,r,s,c),f=c.resolve?.(l,d=>r(o,"TAG_RESOLVE_FAILED",d),e.options)??l,u=rm.isNode(f)?f:new om.Scalar(f);return u.range=l.range,u.tag=s,c?.format&&(u.format=c.format),u}Sc.composeCollection=fm});var mo=v(Ec=>{"use strict";var po=j();function dm(t,e,n){let i=e.offset,r=pm(e,t.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let o=r.mode===">"?po.Scalar.BLOCK_FOLDED:po.Scalar.BLOCK_LITERAL,s=e.source?mm(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=r.chomp==="+"&&s.length>0?`
65
+ `}};zt.YAMLError=Gt;zt.YAMLParseError=so;zt.YAMLWarning=ao;zt.prettifyError=Dp});var Xt=v(sc=>{"use strict";function Fp(t,{flow:e,indicator:n,next:i,offset:r,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",h=!1,w=!1,p=null,m=null,y=null,g=null,b=null,S=null,C=null;for(let k of t)switch(w&&(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"),w=!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"||i?.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 j=k.source.substring(1)||" ";u?u+=d+j:u=j,d="",l=!1;break}case"newline":l?u?u+=k.source:(!S||n!=="seq-item-ind")&&(c=!0):d+=k.source,l=!0,h=!0,(m||y)&&(g=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,w=!0;break;case"tag":{y&&o(k,"MULTIPLE_TAGS","A node can have at most one tag"),y=k,C??(C=k.offset),l=!1,f=!1,w=!0;break}case n:(m||y)&&o(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),S&&o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),S=k,l=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){b&&o(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=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],_=E?E.offset+E.source.length:r;return w&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&o(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=s||i?.type==="block-map"||i?.type==="block-seq")&&o(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:S,spaceBefore:c,comment:u,hasNewline:h,anchor:m,tag:y,newlineAfterProp:g,end:_,start:C??_}}sc.resolveProps=Fp});var fi=v(ac=>{"use strict";function co(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(co(e.key)||co(e.value))return!0}return!1;default:return!0}}ac.containsNewline=co});var lo=v(cc=>{"use strict";var Mp=fi();function Bp(t,e,n){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&Mp.containsNewline(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}cc.flowIndentCheck=Bp});var uo=v(uc=>{"use strict";var lc=x();function Kp(t,e,n){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let r=typeof i=="function"?i:(o,s)=>o===s||lc.isScalar(o)&&lc.isScalar(s)&&o.value===s.value;return e.some(o=>r(o.key,n))}uc.mapIncludes=Kp});var gc=v(hc=>{"use strict";var fc=Pe(),Up=Oe(),dc=Xt(),Hp=fi(),pc=lo(),Yp=uo(),mc="All mapping items must start at the same column";function Jp({composeNode:t,composeEmptyNode:e},n,i,r,o){let s=o?.nodeClass??Up.YAMLMap,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,l=null;for(let f of i.items){let{start:u,key:d,sep:h,value:w}=f,p=dc.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),m=!p.found;if(m){if(d&&(d.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==i.indent&&r(c,"BAD_INDENT",mc)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
67
+ `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||Hp.containsNewline(d))&&r(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==i.indent&&r(c,"BAD_INDENT",mc);n.atKey=!0;let y=p.end,g=d?t(n,d,p,r):e(n,y,u,null,p,r);n.schema.compat&&pc.flowIndentCheck(i.indent,d,r),n.atKey=!1,Yp.mapIncludes(n,a.items,g)&&r(y,"DUPLICATE_KEY","Map keys must be unique");let b=dc.resolveProps(h??[],{indicator:"map-value-ind",next:w,offset:g.range[2],onError:r,parentIndent:i.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=b.end,b.found){m&&(w?.type==="block-map"&&!b.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<b.found.offset-1024&&r(g.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let S=w?t(n,w,b,r):e(n,c,h,null,b,r);n.schema.compat&&pc.flowIndentCheck(i.indent,w,r),c=S.range[2];let C=new fc.Pair(g,S);n.options.keepSourceTokens&&(C.srcToken=f),a.items.push(C)}else{m&&r(g.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(g.comment?g.comment+=`
68
+ `+b.comment:g.comment=b.comment);let S=new fc.Pair(g);n.options.keepSourceTokens&&(S.srcToken=f),a.items.push(S)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}hc.resolveBlockMap=Jp});var yc=v(wc=>{"use strict";var Vp=Ae(),Gp=Xt(),zp=lo();function Qp({composeNode:t,composeEmptyNode:e},n,i,r,o){let s=o?.nodeClass??Vp.YAMLSeq,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=i.offset,l=null;for(let{start:f,value:u}of i.items){let d=Gp.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?r(d.end,"BAD_INDENT","All sequence items must start at the same column"):r(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,r):e(n,d.end,f,null,d,r);n.schema.compat&&zp.flowIndentCheck(i.indent,u,r),c=h.range[2],a.items.push(h)}return a.range=[i.offset,c,l??c],a}wc.resolveBlockSeq=Qp});var mt=v(vc=>{"use strict";function Xp(t,e,n,i){let r="";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&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=c.substring(1)||" ";r?r+=s+f:r=f,s="";break}case"newline":r&&(s+=c),o=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:r,offset:e}}vc.resolveEnd=Xp});var Cc=v(Sc=>{"use strict";var Zp=x(),em=Pe(),kc=Oe(),tm=Ae(),nm=mt(),bc=Xt(),im=fi(),rm=uo(),fo="Block collections are not allowed within flow collections",po=t=>t&&(t.type==="block-map"||t.type==="block-seq");function om({composeNode:t,composeEmptyNode:e},n,i,r,o){let s=i.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?kc.YAMLMap:tm.YAMLSeq),l=new c(n.schema);l.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let y=i.items[m],{start:g,key:b,sep:S,value:C}=y,E=bc.resolveProps(g,{flow:a,indicator:"explicit-key-ind",next:b??S?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!S&&!C){m===0&&E.comma?r(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<i.items.length-1&&r(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&&im.containsNewline(b)&&r(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&r(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||r(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let _="";e:for(let k of g)switch(k.type){case"comma":case"space":break;case"comment":_=k.source.substring(1);break e;default:break e}if(_){let k=l.items[l.items.length-1];Zp.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
70
+ `+_:k.comment=_,E.comment=E.comment.substring(_.length+1)}}if(!s&&!S&&!E.found){let _=C?t(n,C,E,r):e(n,E.end,S,null,E,r);l.items.push(_),u=_.range[2],po(C)&&r(_.range,"BLOCK_IN_FLOW",fo)}else{n.atKey=!0;let _=E.end,k=b?t(n,b,E,r):e(n,_,g,null,E,r);po(b)&&r(k.range,"BLOCK_IN_FLOW",fo),n.atKey=!1;let j=bc.resolveProps(S??[],{flow:a,indicator:"map-value-ind",next:C,offset:k.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(j.found){if(!s&&!E.found&&n.options.strict){if(S)for(let R of S){if(R===j.found)break;if(R.type==="newline"){r(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<j.found.offset-1024&&r(j.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]===":"?r(C,"MISSING_CHAR",`Missing space after : in ${a}`):r(j.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let se=C?t(n,C,j,r):j.found?e(n,j.end,S,null,j,r):null;se?po(C)&&r(se.range,"BLOCK_IN_FLOW",fo):j.comment&&(k.comment?k.comment+=`
71
+ `+j.comment:k.comment=j.comment);let H=new em.Pair(k,se);if(n.options.keepSourceTokens&&(H.srcToken=y),s){let R=l;rm.mapIncludes(n,R.items,k)&&r(_,"DUPLICATE_KEY","Map keys must be unique"),R.items.push(H)}else{let R=new kc.YAMLMap(n.schema);R.flow=!0,R.items.push(H);let xt=(se??k).range;R.range=[k.range[0],xt[1],xt[2]],l.items.push(R)}u=se?se.range[2]:j.end}}let d=s?"}":"]",[h,...w]=i.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),y=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;r(u,f?"MISSING_CHAR":"BAD_INDENT",y),h&&h.source.length!==1&&w.unshift(h)}if(w.length>0){let m=nm.resolveEnd(w,p,n.options.strict,r);m.comment&&(l.comment?l.comment+=`
72
+ `+m.comment:l.comment=m.comment),l.range=[i.offset,p,m.offset]}else l.range=[i.offset,p,p];return l}Sc.resolveFlowCollection=om});var _c=v(Ec=>{"use strict";var sm=x(),am=T(),cm=Oe(),lm=Ae(),um=gc(),fm=yc(),dm=Cc();function mo(t,e,n,i,r,o){let s=n.type==="block-map"?um.resolveBlockMap(t,e,n,i,o):n.type==="block-seq"?fm.resolveBlockSeq(t,e,n,i,o):dm.resolveFlowCollection(t,e,n,i,o),a=s.constructor;return r==="!"||r===a.tagName?(s.tag=a.tagName,s):(r&&(s.tag=r),s)}function pm(t,e,n,i,r){let o=i.tag,s=o?e.directives.tagName(o.source,d=>r(o,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=i,w=d&&o?d.offset>o.offset?d:o:d??o;w&&(!h||h.offset<w.offset)&&r(w,"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===cm.YAMLMap.tagName&&a==="map"||s===lm.YAMLSeq.tagName&&a==="seq")return mo(t,e,n,r,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?r(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):r(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),mo(t,e,n,r,s)}let l=mo(t,e,n,r,s,c),f=c.resolve?.(l,d=>r(o,"TAG_RESOLVE_FAILED",d),e.options)??l,u=sm.isNode(f)?f:new am.Scalar(f);return u.range=l.range,u.tag=s,c?.format&&(u.format=c.format),u}Ec.composeCollection=pm});var go=v(xc=>{"use strict";var ho=T();function mm(t,e,n){let i=e.offset,r=hm(e,t.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let o=r.mode===">"?ho.Scalar.BLOCK_FOLDED:ho.Scalar.BLOCK_LITERAL,s=e.source?gm(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=r.chomp==="+"&&s.length>0?`
73
73
  `.repeat(Math.max(1,s.length-1)):"",m=i+r.length;return e.source&&(m+=e.source.length),{value:p,type:o,comment:r.comment,range:[i,m,m]}}let c=e.indent+r.indent,l=e.offset+r.length,f=0;for(let p=0;p<a;++p){let[m,y]=s[p];if(y===""||y==="\r")r.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"),r.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+y.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,y]=s[p];l+=m.length+y.length+1;let g=y[y.length-1]==="\r";if(g&&(y=y.slice(0,-1)),y&&m.length<c){let S=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(l-y.length-(g?2:1),"BAD_INDENT",S),m=""}o===po.Scalar.BLOCK_LITERAL?(u+=d+m.slice(c)+y,d=`
74
+ `;for(let p=f;p<a;++p){let[m,y]=s[p];l+=m.length+y.length+1;let g=y[y.length-1]==="\r";if(g&&(y=y.slice(0,-1)),y&&m.length<c){let S=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(l-y.length-(g?2:1),"BAD_INDENT",S),m=""}o===ho.Scalar.BLOCK_LITERAL?(u+=d+m.slice(c)+y,d=`
75
75
  `):m.length>c||y[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 w=i+r.length+e.source.length;return{value:u,type:o,comment:r.comment,range:[i,w,w]}}function pm({offset:t,props:e},n,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],o=r[0],s=0,a="",c=-1;for(let d=1;d<r.length;++d){let h=r[d];if(!a&&(h==="-"||h==="+"))a=h;else{let w=Number(h);!s&&w?s=w:c===-1&&(c=t+d)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,f="",u=r.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&&i(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":i(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let w=`Unexpected token in block scalar header: ${h.type}`;i(h,"UNEXPECTED_TOKEN",w);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:o,indent:s,chomp:a,comment:f,length:u}}function mm(t){let e=t.split(/\n( *)/),n=e[0],i=n.match(/^( *)/),o=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}Ec.resolveBlockScalar=dm});var go=v(xc=>{"use strict";var ho=j(),hm=pt();function gm(t,e,n){let{offset:i,type:r,source:o,end:s}=t,a,c,l=(d,h,w)=>n(i+d,h,w);switch(r){case"scalar":a=ho.Scalar.PLAIN,c=wm(o,l);break;case"single-quoted-scalar":a=ho.Scalar.QUOTE_SINGLE,c=ym(o,l);break;case"double-quoted-scalar":a=ho.Scalar.QUOTE_DOUBLE,c=vm(o,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+o.length,i+o.length]}}let f=i+o.length,u=hm.resolveEnd(s,f,e,n);return{value:c,type:a,comment:u.comment,range:[i,f,u.offset]}}function wm(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 ym(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?
87
+ `}let w=i+r.length+e.source.length;return{value:u,type:o,comment:r.comment,range:[i,w,w]}}function hm({offset:t,props:e},n,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],o=r[0],s=0,a="",c=-1;for(let d=1;d<r.length;++d){let h=r[d];if(!a&&(h==="-"||h==="+"))a=h;else{let w=Number(h);!s&&w?s=w:c===-1&&(c=t+d)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,f="",u=r.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&&i(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":i(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let w=`Unexpected token in block scalar header: ${h.type}`;i(h,"UNEXPECTED_TOKEN",w);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:o,indent:s,chomp:a,comment:f,length:u}}function gm(t){let e=t.split(/\n( *)/),n=e[0],i=n.match(/^( *)/),o=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}xc.resolveBlockScalar=mm});var yo=v(Rc=>{"use strict";var wo=T(),wm=mt();function ym(t,e,n){let{offset:i,type:r,source:o,end:s}=t,a,c,l=(d,h,w)=>n(i+d,h,w);switch(r){case"scalar":a=wo.Scalar.PLAIN,c=vm(o,l);break;case"single-quoted-scalar":a=wo.Scalar.QUOTE_SINGLE,c=km(o,l);break;case"double-quoted-scalar":a=wo.Scalar.QUOTE_DOUBLE,c=bm(o,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+o.length,i+o.length]}}let f=i+o.length,u=wm.resolveEnd(s,f,e,n);return{value:c,type:a,comment:u.comment,range:[i,f,u.offset]}}function vm(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}`),Pc(t)}function km(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Pc(t.slice(1,-1)).replace(/''/g,"'")}function Pc(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 i=e.exec(t);if(!i)return t;let r=i[1],o=" ",s=e.lastIndex;for(n.lastIndex=s;i=n.exec(t);)i[1]===""?o===`
90
90
  `?r+=o:o=`
91
- `:(r+=o+i[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,i=a.exec(t),r+o+(i?.[1]??"")}function vm(t,e){let n="";for(let i=1;i<t.length-1;++i){let r=t[i];if(!(r==="\r"&&t[i+1]===`
91
+ `:(r+=o+i[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,i=a.exec(t),r+o+(i?.[1]??"")}function bm(t,e){let n="";for(let i=1;i<t.length-1;++i){let r=t[i];if(!(r==="\r"&&t[i+1]===`
92
92
  `))if(r===`
93
- `){let{fold:o,offset:s}=km(t,i);n+=o,i=s}else if(r==="\\"){let o=t[++i],s=bm[o];if(s)n+=s;else if(o===`
93
+ `){let{fold:o,offset:s}=Sm(t,i);n+=o,i=s}else if(r==="\\"){let o=t[++i],s=Cm[o];if(s)n+=s;else if(o===`
94
94
  `)for(o=t[i+1];o===" "||o===" ";)o=t[++i+1];else if(o==="\r"&&t[i+1]===`
95
- `)for(o=t[++i+1];o===" "||o===" ";)o=t[++i+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=Sm(t,i+1,a,e),i+=a}else{let a=t.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(r===" "||r===" "){let o=i,s=t[i+1];for(;s===" "||s===" ";)s=t[++i+1];s!==`
95
+ `)for(o=t[++i+1];o===" "||o===" ";)o=t[++i+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=Em(t,i+1,a,e),i+=a}else{let a=t.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(r===" "||r===" "){let o=i,s=t[i+1];for(;s===" "||s===" ";)s=t[++i+1];s!==`
96
96
  `&&!(s==="\r"&&t[i+2]===`
97
- `)&&(n+=i>o?t.slice(o,i+1):r)}else n+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function km(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
97
+ `)&&(n+=i>o?t.slice(o,i+1):r)}else n+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function Sm(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
98
98
  `||i==="\r")&&!(i==="\r"&&t[e+2]!==`
99
99
  `);)i===`
100
100
  `&&(n+=`
101
- `),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}var bm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Sm(t,e,n,i){let r=t.substr(e,n),s=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,n+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}xc.resolveFlowScalar=gm});var Ac=v(Rc=>{"use strict";var Qe=x(),Pc=j(),Cm=mo(),Em=go();function _m(t,e,n,i){let{value:r,type:o,comment:s,range:a}=e.type==="block-scalar"?Cm.resolveBlockScalar(t,e,i):Em.resolveFlowScalar(e,t.options.strict,i),c=n?t.directives.tagName(n.source,u=>i(n,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Qe.SCALAR]:c?l=xm(t.schema,r,c,n,i):e.type==="scalar"?l=Pm(t,r,e,i):l=t.schema[Qe.SCALAR];let f;try{let u=l.resolve(r,d=>i(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=Qe.isScalar(u)?u:new Pc.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);i(n??e,"TAG_RESOLVE_FAILED",d),f=new Pc.Scalar(r)}return f.range=a,f.source=r,o&&(f.type=o),c&&(f.tag=c),l.format&&(f.format=l.format),s&&(f.comment=s),f}function xm(t,e,n,i,r){if(n==="!")return t[Qe.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):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[Qe.SCALAR])}function Pm({atKey:t,directives:e,schema:n},i,r,o){let s=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(i))||n[Qe.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(i))??n[Qe.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(r,"TAG_RESOLVE_FAILED",f,!0)}}return s}Rc.composeScalar=_m});var Nc=v(Oc=>{"use strict";function Rm(t,e,n){if(e){n??(n=e.length);for(let i=n-1;i>=0;--i){let r=e[i];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++i];r?.type==="space";)t+=r.source.length,r=e[++i];break}}return t}Oc.emptyScalarPosition=Rm});var Ic=v(yo=>{"use strict";var Am=jt(),Om=x(),Nm=Cc(),jc=Ac(),jm=pt(),Tm=Nc(),Im={composeNode:Tc,composeEmptyNode:wo};function Tc(t,e,n,i){let r=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=n,l,f=!0;switch(e.type){case"alias":l=qm(t,e,i),(a||c)&&i(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=jc.composeScalar(t,e,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Nm.composeCollection(Im,t,e,n,i),a&&(l.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);i(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",u),f=!1}}return l??(l=wo(t,e.offset,void 0,null,n,i)),a&&l.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!Om.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&i(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 wo(t,e,n,i,{spaceBefore:r,comment:o,anchor:s,tag:a,end:c},l){let f={type:"scalar",offset:Tm.emptyScalarPosition(e,n,i),indent:-1,source:""},u=jc.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")),r&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=c),u}function qm({options:t},{offset:e,source:n,end:i},r){let o=new Am.Alias(n.substring(1));o.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&r(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+n.length,a=jm.resolveEnd(i,s,t.strict,r);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}yo.composeEmptyNode=wo;yo.composeNode=Tc});var Lc=v($c=>{"use strict";var $m=Vt(),qc=Ic(),Lm=pt(),Dm=Xt();function Wm(t,e,{offset:n,start:i,value:r,end:o},s){let a=Object.assign({_directives:e},t),c=new $m.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=Dm.resolveProps(i,{indicator:"doc-start",next:r??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!f.hasNewline&&s(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?qc.composeNode(l,r,f,s):qc.composeEmptyNode(l,f.end,i,null,f,s);let u=c.contents.range[2],d=Lm.resolveEnd(o,u,!1,s);return d.comment&&(c.comment=d.comment),c.range=[n,u,d.offset],c}$c.composeDoc=Wm});var ko=v(Fc=>{"use strict";var Fm=bn("process"),Mm=rr(),Bm=Vt(),Zt=Qt(),Dc=x(),Km=Lc(),Um=pt();function en(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 Wc(t){let e="",n=!1,i=!1;for(let r=0;r<t.length;++r){let o=t[r];switch(o[0]){case"#":e+=(e===""?"":i?`
101
+ `),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Cm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Em(t,e,n,i){let r=t.substr(e,n),s=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,n+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Rc.resolveFlowScalar=ym});var Nc=v(Ac=>{"use strict";var Qe=x(),Oc=T(),_m=go(),xm=yo();function Pm(t,e,n,i){let{value:r,type:o,comment:s,range:a}=e.type==="block-scalar"?_m.resolveBlockScalar(t,e,i):xm.resolveFlowScalar(e,t.options.strict,i),c=n?t.directives.tagName(n.source,u=>i(n,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Qe.SCALAR]:c?l=Rm(t.schema,r,c,n,i):e.type==="scalar"?l=Om(t,r,e,i):l=t.schema[Qe.SCALAR];let f;try{let u=l.resolve(r,d=>i(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=Qe.isScalar(u)?u:new Oc.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);i(n??e,"TAG_RESOLVE_FAILED",d),f=new Oc.Scalar(r)}return f.range=a,f.source=r,o&&(f.type=o),c&&(f.tag=c),l.format&&(f.format=l.format),s&&(f.comment=s),f}function Rm(t,e,n,i,r){if(n==="!")return t[Qe.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):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[Qe.SCALAR])}function Om({atKey:t,directives:e,schema:n},i,r,o){let s=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(i))||n[Qe.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(i))??n[Qe.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(r,"TAG_RESOLVE_FAILED",f,!0)}}return s}Ac.composeScalar=Pm});var Tc=v(jc=>{"use strict";function Am(t,e,n){if(e){n??(n=e.length);for(let i=n-1;i>=0;--i){let r=e[i];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++i];r?.type==="space";)t+=r.source.length,r=e[++i];break}}return t}jc.emptyScalarPosition=Am});var qc=v(ko=>{"use strict";var Nm=jt(),jm=x(),Tm=_c(),Ic=Nc(),Im=mt(),$m=Tc(),qm={composeNode:$c,composeEmptyNode:vo};function $c(t,e,n,i){let r=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=n,l,f=!0;switch(e.type){case"alias":l=Lm(t,e,i),(a||c)&&i(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=Ic.composeScalar(t,e,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Tm.composeCollection(qm,t,e,n,i),a&&(l.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);i(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",u),f=!1}}return l??(l=vo(t,e.offset,void 0,null,n,i)),a&&l.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!jm.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&i(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 vo(t,e,n,i,{spaceBefore:r,comment:o,anchor:s,tag:a,end:c},l){let f={type:"scalar",offset:$m.emptyScalarPosition(e,n,i),indent:-1,source:""},u=Ic.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")),r&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=c),u}function Lm({options:t},{offset:e,source:n,end:i},r){let o=new Nm.Alias(n.substring(1));o.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&r(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+n.length,a=Im.resolveEnd(i,s,t.strict,r);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ko.composeEmptyNode=vo;ko.composeNode=$c});var Dc=v(Wc=>{"use strict";var Wm=Vt(),Lc=qc(),Dm=mt(),Fm=Xt();function Mm(t,e,{offset:n,start:i,value:r,end:o},s){let a=Object.assign({_directives:e},t),c=new Wm.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=Fm.resolveProps(i,{indicator:"doc-start",next:r??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!f.hasNewline&&s(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?Lc.composeNode(l,r,f,s):Lc.composeEmptyNode(l,f.end,i,null,f,s);let u=c.contents.range[2],d=Dm.resolveEnd(o,u,!1,s);return d.comment&&(c.comment=d.comment),c.range=[n,u,d.offset],c}Wc.composeDoc=Mm});var So=v(Bc=>{"use strict";var Bm=bn("process"),Km=sr(),Um=Vt(),Zt=Qt(),Fc=x(),Hm=Dc(),Ym=mt();function en(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 Mc(t){let e="",n=!1,i=!1;for(let r=0;r<t.length;++r){let o=t[r];switch(o[0]){case"#":e+=(e===""?"":i?`
103
103
 
104
104
  `:`
105
- `)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:e,afterEmptyLine:i}}var vo=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,o)=>{let s=en(n);o?this.warnings.push(new Zt.YAMLWarning(s,i,r)):this.errors.push(new Zt.YAMLParseError(s,i,r))},this.directives=new Mm.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:i,afterEmptyLine:r}=Wc(this.prelude);if(i){let o=e.contents;if(n)e.comment=e.comment?`${e.comment}
106
- ${i}`:i;else if(r||e.directives.docStart||!o)e.commentBefore=i;else if(Dc.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];Dc.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${i}
105
+ `)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:e,afterEmptyLine:i}}var bo=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,o)=>{let s=en(n);o?this.warnings.push(new Zt.YAMLWarning(s,i,r)):this.errors.push(new Zt.YAMLParseError(s,i,r))},this.directives=new Km.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:i,afterEmptyLine:r}=Mc(this.prelude);if(i){let o=e.contents;if(n)e.comment=e.comment?`${e.comment}
106
+ ${i}`:i;else if(r||e.directives.docStart||!o)e.commentBefore=i;else if(Fc.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];Fc.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${i}
107
107
  ${a}`:i}else{let s=o.commentBefore;o.commentBefore=s?`${i}
108
- ${s}`:i}}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:Wc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,i=-1){for(let r of e)yield*this.next(r);yield*this.end(n,i)}*next(e){switch(Fm.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,i,r)=>{let o=en(e);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",i,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Km.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,i=new Zt.YAMLParseError(en(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new Zt.YAMLParseError(en(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=Um.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
109
- ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Zt.YAMLParseError(en(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 i=Object.assign({_directives:this.directives},this.options),r=new Bm.Document(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};Fc.Composer=vo});var Kc=v(di=>{"use strict";var Hm=mo(),Ym=go(),Jm=Qt(),Mc=Lt();function Vm(t,e=!0,n){if(t){let i=(r,o,s)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(a,o,s);else throw new Jm.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ym.resolveFlowScalar(t,e,i);case"block-scalar":return Hm.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function Gm(t,e){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:o=-1,type:s="PLAIN"}=e,a=Mc.stringifyString({type:s,value:t},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:i,source:`
108
+ ${s}`:i}}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:Mc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,i=-1){for(let r of e)yield*this.next(r);yield*this.end(n,i)}*next(e){switch(Bm.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,i,r)=>{let o=en(e);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",i,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Hm.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,i=new Zt.YAMLParseError(en(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new Zt.YAMLParseError(en(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=Ym.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
109
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Zt.YAMLParseError(en(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 i=Object.assign({_directives:this.directives},this.options),r=new Um.Document(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};Bc.Composer=bo});var Hc=v(di=>{"use strict";var Jm=go(),Vm=yo(),Gm=Qt(),Kc=Lt();function zm(t,e=!0,n){if(t){let i=(r,o,s)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(a,o,s);else throw new Gm.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Vm.resolveFlowScalar(t,e,i);case"block-scalar":return Jm.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function Qm(t,e){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:o=-1,type:s="PLAIN"}=e,a=Kc.stringifyString({type:s,value:t},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:i,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:i,source:f}];return Bc(d,c)||d.push({type:"newline",offset:-1,indent:i,source:`
113
- `}),{type:"block-scalar",offset:o,indent:i,props:d,source:u}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:a,end:c};default:return{type:"scalar",offset:o,indent:i,source:a,end:c}}}function zm(t,e,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:o=!1,type:s}=n,a="indent"in t?t.indent:null;if(i&&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=Mc.stringifyString({type:s,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Qm(t,c);break;case'"':bo(t,c,"double-quoted-scalar");break;case"'":bo(t,c,"single-quoted-scalar");break;default:bo(t,c,"scalar")}}function Qm(t,e){let n=e.indexOf(`
112
+ `,d=[{type:"block-scalar-header",offset:o,indent:i,source:f}];return Uc(d,c)||d.push({type:"newline",offset:-1,indent:i,source:`
113
+ `}),{type:"block-scalar",offset:o,indent:i,props:d,source:u}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:a,end:c};default:return{type:"scalar",offset:o,indent:i,source:a,end:c}}}function Xm(t,e,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:o=!1,type:s}=n,a="indent"in t?t.indent:null;if(i&&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=Kc.stringifyString({type:s,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Zm(t,c);break;case'"':Co(t,c,"double-quoted-scalar");break;case"'":Co(t,c,"single-quoted-scalar");break;default:Co(t,c,"scalar")}}function Zm(t,e){let n=e.indexOf(`
114
114
  `),i=e.substring(0,n),r=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=i,t.source=r}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:i}];Bc(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:r})}}function Bc(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 bo(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 i=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let o of i)o.offset+=r;delete t.props,Object.assign(t,{type:n,source:e,end:i});break}case"block-map":case"block-seq":{let r={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
- `};delete t.items,Object.assign(t,{type:n,source:e,end:[r]});break}default:{let i="indent"in t?t.indent:-1,r="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:i,source:e,end:r})}}}di.createScalarToken=Gm;di.resolveAsScalar=Vm;di.setScalarValue=zm});var Hc=v(Uc=>{"use strict";var Xm=t=>"type"in t?mi(t):pi(t);function mi(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=mi(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=pi(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=pi(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=pi(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 pi({start:t,key:e,sep:n,value:i}){let r="";for(let o of t)r+=o.source;if(e&&(r+=mi(e)),n)for(let o of n)r+=o.source;return i&&(r+=mi(i)),r}Uc.stringify=Xm});var Gc=v(Vc=>{"use strict";var So=Symbol("break visit"),Zm=Symbol("skip children"),Yc=Symbol("remove item");function Xe(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Jc(Object.freeze([]),t,e)}Xe.BREAK=So;Xe.SKIP=Zm;Xe.REMOVE=Yc;Xe.itemAtPath=(t,e)=>{let n=t;for(let[i,r]of e){let o=n?.[i];if(o&&"items"in o)n=o.items[r];else return}return n};Xe.parentCollection=(t,e)=>{let n=Xe.itemAtPath(t,e.slice(0,-1)),i=e[e.length-1][0],r=n?.[i];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function Jc(t,e,n){let i=n(e,t);if(typeof i=="symbol")return i;for(let r of["key","value"]){let o=e[r];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=Jc(Object.freeze(t.concat([[r,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===So)return So;a===Yc&&(o.items.splice(s,1),s-=1)}}typeof i=="function"&&r==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}Vc.visit=Xe});var hi=v(J=>{"use strict";var Co=Kc(),eh=Hc(),th=Gc(),Eo="\uFEFF",_o="",xo="",Po="",nh=t=>!!t&&"items"in t,ih=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function rh(t){switch(t){case Eo:return"<BOM>";case _o:return"<DOC>";case xo:return"<FLOW_END>";case Po:return"<SCALAR>";default:return JSON.stringify(t)}}function oh(t){switch(t){case Eo:return"byte-order-mark";case _o:return"doc-mode";case xo:return"flow-error-end";case Po: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=i,t.source=r}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:i}];Uc(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:r})}}function Uc(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 Co(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 i=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let o of i)o.offset+=r;delete t.props,Object.assign(t,{type:n,source:e,end:i});break}case"block-map":case"block-seq":{let r={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
+ `};delete t.items,Object.assign(t,{type:n,source:e,end:[r]});break}default:{let i="indent"in t?t.indent:-1,r="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:i,source:e,end:r})}}}di.createScalarToken=Qm;di.resolveAsScalar=zm;di.setScalarValue=Xm});var Jc=v(Yc=>{"use strict";var eh=t=>"type"in t?mi(t):pi(t);function mi(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=mi(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=pi(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=pi(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=pi(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 pi({start:t,key:e,sep:n,value:i}){let r="";for(let o of t)r+=o.source;if(e&&(r+=mi(e)),n)for(let o of n)r+=o.source;return i&&(r+=mi(i)),r}Yc.stringify=eh});var Qc=v(zc=>{"use strict";var Eo=Symbol("break visit"),th=Symbol("skip children"),Vc=Symbol("remove item");function Xe(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Gc(Object.freeze([]),t,e)}Xe.BREAK=Eo;Xe.SKIP=th;Xe.REMOVE=Vc;Xe.itemAtPath=(t,e)=>{let n=t;for(let[i,r]of e){let o=n?.[i];if(o&&"items"in o)n=o.items[r];else return}return n};Xe.parentCollection=(t,e)=>{let n=Xe.itemAtPath(t,e.slice(0,-1)),i=e[e.length-1][0],r=n?.[i];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function Gc(t,e,n){let i=n(e,t);if(typeof i=="symbol")return i;for(let r of["key","value"]){let o=e[r];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=Gc(Object.freeze(t.concat([[r,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===Eo)return Eo;a===Vc&&(o.items.splice(s,1),s-=1)}}typeof i=="function"&&r==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}zc.visit=Xe});var hi=v(J=>{"use strict";var _o=Hc(),nh=Jc(),ih=Qc(),xo="\uFEFF",Po="",Ro="",Oo="",rh=t=>!!t&&"items"in t,oh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function sh(t){switch(t){case xo:return"<BOM>";case Po:return"<DOC>";case Ro:return"<FLOW_END>";case Oo:return"<SCALAR>";default:return JSON.stringify(t)}}function ah(t){switch(t){case xo:return"byte-order-mark";case Po:return"doc-mode";case Ro:return"flow-error-end";case Oo: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=Co.createScalarToken;J.resolveAsScalar=Co.resolveAsScalar;J.setScalarValue=Co.setScalarValue;J.stringify=eh.stringify;J.visit=th.visit;J.BOM=Eo;J.DOCUMENT=_o;J.FLOW_END=xo;J.SCALAR=Po;J.isCollection=nh;J.isScalar=ih;J.prettyToken=rh;J.tokenType=oh});var Oo=v(Qc=>{"use strict";var tn=hi();function ne(t){switch(t){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var zc=new Set("0123456789ABCDEFabcdef"),sh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),gi=new Set(",[]{}"),ah=new Set(` ,[]{}
121
- \r `),Ro=t=>!t||ah.has(t),Ao=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 i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}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}J.createScalarToken=_o.createScalarToken;J.resolveAsScalar=_o.resolveAsScalar;J.setScalarValue=_o.setScalarValue;J.stringify=nh.stringify;J.visit=ih.visit;J.BOM=xo;J.DOCUMENT=Po;J.FLOW_END=Ro;J.SCALAR=Oo;J.isCollection=rh;J.isScalar=oh;J.prettyToken=sh;J.tokenType=ah});var jo=v(Zc=>{"use strict";var tn=hi();function ne(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var Xc=new Set("0123456789ABCDEFabcdef"),ch=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),gi=new Set(",[]{}"),lh=new Set(` ,[]{}
121
+ \r `),Ao=t=>!t||lh.has(t),No=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 i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}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 i=0;for(;n===" ";)n=this.buffer[++i+e];if(n==="\r"){let r=this.buffer[i+e+1];if(r===`
124
124
  `||!r&&!this.atEnd)return e+i+1}return n===`
125
125
  `||i>=this.indentNext||!n&&!this.atEnd?e+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&ne(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]===tn.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,i=e.indexOf("#");for(;i!==-1;){let o=e[i-1];if(o===" "||o===" "){n=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),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 tn.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==="...")&&ne(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&&!ne(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===":")&&ne(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"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(Ro),"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,i=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&r[0]!=="#"||i===0&&(r.startsWith("---")||r.startsWith("..."))&&ne(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield tn.FLOW_END,yield*this.parseLineStart();let o=0;for(;r[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),r[o]){case void 0:return"flow";case"#":return yield*this.pushCount(r.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(Ro),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||ne(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 i=this.buffer.substring(0,n),r=i.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]===tn.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,i=e.indexOf("#");for(;i!==-1;){let o=e[i-1];if(o===" "||o===" "){n=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),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 tn.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==="...")&&ne(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&&!ne(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===":")&&ne(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"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(Ao),"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,i=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&r[0]!=="#"||i===0&&(r.startsWith("---")||r.startsWith("..."))&&ne(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield tn.FLOW_END,yield*this.parseLineStart();let o=0;for(;r[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),r[o]){case void 0:return"flow";case"#":return yield*this.pushCount(r.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(Ao),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||ne(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 i=this.buffer.substring(0,n),r=i.indexOf(`
127
127
  `,this.pos);if(r!==-1){for(;r!==-1;){let o=this.continueScalar(r+1);if(o===-1)break;r=i.indexOf(`
128
128
  `,o)}r!==-1&&(n=r-(i[r-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=>ne(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,i;e:for(let o=this.pos;i=this.buffer[o];++o)switch(i){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 tn.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){let o=this.buffer[i+1];if(ne(o)||e&&gi.has(o))break;n=i}else if(ne(r)){let o=this.buffer[i+1];if(r==="\r"&&(o===`
134
134
  `?(i+=1,r=`
135
135
  `,o=this.buffer[i+1]):n=i),o==="#"||e&&gi.has(o))break;if(r===`
136
- `){let s=this.continueScalar(i+1);if(s===-1)break;i=Math.max(i,s-2)}}else{if(e&&gi.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield tn.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 i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.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(Ro),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(ne(i)||n&&gi.has(i)){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(;!ne(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(sh.has(n))n=this.buffer[++e];else if(n==="%"&&zc.has(this.buffer[e+1])&&zc.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(i+1);if(s===-1)break;i=Math.max(i,s-2)}}else{if(e&&gi.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield tn.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 i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.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(Ao),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(ne(i)||n&&gi.has(i)){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(;!ne(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(ch.has(n))n=this.buffer[++e];else if(n==="%"&&Xc.has(this.buffer[e+1])&&Xc.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,i;do i=this.buffer[++n];while(i===" "||e&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(e){let n=this.pos,i=this.buffer[n];for(;!e(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};Qc.Lexer=Ao});var jo=v(Xc=>{"use strict";var No=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,i=this.lineStarts.length;for(;n<i;){let o=n+i>>1;this.lineStarts[o]<e?n=o+1:i=o}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let r=this.lineStarts[n-1];return{line:n,col:e-r+1}}}};Xc.LineCounter=No});var Io=v(il=>{"use strict";var ch=bn("process"),Zc=hi(),lh=Oo();function Oe(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function el(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 nl(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 wi(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 mt(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 yi(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 tl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Oe(e.start,"explicit-key-ind")&&!Oe(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,nl(e.value)?e.value.end?yi(e.value.end,e.sep):e.value.end=e.sep:yi(e.start,e.sep),delete e.sep)}var To=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 lh.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(e,n))yield*this.next(i);n||(yield*this.end())}*next(e){if(this.source=e,ch.env.LOG_TOKENS&&console.log("|",Zc.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=Zc.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 i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,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 i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&tl(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{let r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&el(r.start)===-1&&(n.indent===0||r.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(i.type==="document"?i.end=r.start:i.items.push({start:r.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":{el(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=wi(this.peek(2)),i=mt(n),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:r}]};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,i;do i=this.buffer[++n];while(i===" "||e&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(e){let n=this.pos,i=this.buffer[n];for(;!e(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};Zc.Lexer=No});var Io=v(el=>{"use strict";var To=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,i=this.lineStarts.length;for(;n<i;){let o=n+i>>1;this.lineStarts[o]<e?n=o+1:i=o}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let r=this.lineStarts[n-1];return{line:n,col:e-r+1}}}};el.LineCounter=To});var qo=v(ol=>{"use strict";var uh=bn("process"),tl=hi(),fh=jo();function Ne(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function nl(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 rl(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 wi(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 yi(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 il(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ne(e.start,"explicit-key-ind")&&!Ne(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,rl(e.value)?e.value.end?yi(e.value.end,e.sep):e.value.end=e.sep:yi(e.start,e.sep),delete e.sep)}var $o=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 fh.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(e,n))yield*this.next(i);n||(yield*this.end())}*next(e){if(this.source=e,uh.env.LOG_TOKENS&&console.log("|",tl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=tl.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 i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,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 i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&il(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{let r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&nl(r.start)===-1&&(n.indent===0||r.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(i.type==="document"?i.end=r.start:i.items.push({start:r.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":{nl(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=wi(this.peek(2)),i=ht(n),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:r}]};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 i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.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 r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){yi(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(r&&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":r||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):r||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(Oe(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(nl(n.key)&&!Oe(n.sep,"newline")){let s=mt(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(Oe(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=mt(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||r?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Oe(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);r||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&&!Oe(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 i&&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 i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.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 r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){yi(r,n.start),r.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||Oe(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.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 r=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let r=wi(i),o=mt(r);tl(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 i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.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 r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){yi(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(r&&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":r||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):r||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(Ne(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(rl(n.key)&&!Ne(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(Ne(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||r?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Ne(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);r||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&&!Ne(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 i&&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 i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.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 r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){yi(r,n.start),r.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||Ne(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.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 r=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let r=wi(i),o=ht(r);il(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=wi(e),i=mt(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=wi(e),i=mt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(i=>i.type==="newline"||i.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())}}};il.Parser=To});var cl=v(rn=>{"use strict";var rl=ko(),uh=Vt(),nn=Qt(),fh=wr(),dh=x(),ph=jo(),ol=Io();function sl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new ph.LineCounter||null,prettyErrors:e}}function mh(t,e={}){let{lineCounter:n,prettyErrors:i}=sl(e),r=new ol.Parser(n?.addNewLine),o=new rl.Composer(e),s=Array.from(o.compose(r.parse(t)));if(i&&n)for(let a of s)a.errors.forEach(nn.prettifyError(t,n)),a.warnings.forEach(nn.prettifyError(t,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function al(t,e={}){let{lineCounter:n,prettyErrors:i}=sl(e),r=new ol.Parser(n?.addNewLine),o=new rl.Composer(e),s=null;for(let a of o.compose(r.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new nn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(s.errors.forEach(nn.prettifyError(t,n)),s.warnings.forEach(nn.prettifyError(t,n))),s}function hh(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=al(t,n);if(!r)return null;if(r.warnings.forEach(o=>fh.warn(r.options.logLevel,o)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function gh(t,e,n){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=n??e??{};if(!r)return}return dh.isDocument(t)&&!i?t.toString(n):new uh.Document(t,i,n).toString(n)}rn.parse=hh;rn.parseAllDocuments=mh;rn.parseDocument=al;rn.stringify=gh});var ht=v(P=>{"use strict";var wh=ko(),yh=Vt(),vh=Zr(),qo=Qt(),kh=jt(),Ne=x(),bh=xe(),Sh=j(),Ch=Re(),Eh=Ae(),_h=hi(),xh=Oo(),Ph=jo(),Rh=Io(),vi=cl(),ll=Rt();P.Composer=wh.Composer;P.Document=yh.Document;P.Schema=vh.Schema;P.YAMLError=qo.YAMLError;P.YAMLParseError=qo.YAMLParseError;P.YAMLWarning=qo.YAMLWarning;P.Alias=kh.Alias;P.isAlias=Ne.isAlias;P.isCollection=Ne.isCollection;P.isDocument=Ne.isDocument;P.isMap=Ne.isMap;P.isNode=Ne.isNode;P.isPair=Ne.isPair;P.isScalar=Ne.isScalar;P.isSeq=Ne.isSeq;P.Pair=bh.Pair;P.Scalar=Sh.Scalar;P.YAMLMap=Ch.YAMLMap;P.YAMLSeq=Eh.YAMLSeq;P.CST=_h;P.Lexer=xh.Lexer;P.LineCounter=Ph.LineCounter;P.Parser=Rh.Parser;P.parse=vi.parse;P.parseAllDocuments=vi.parseAllDocuments;P.parseDocument=vi.parseDocument;P.stringify=vi.stringify;P.visit=ll.visit;P.visitAsync=ll.visitAsync});import je from"path";function Lh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||je.posix.isAbsolute(n)||je.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let i=n.replaceAll("\\","/").split("/");if(i.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(i.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return i}function ki(t){let e=Lh(t,"native.artifact_root");return e.length===0?".":e.join("/")}function ml(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 we(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim().replaceAll("\\","/");if(i.length===0||je.posix.isAbsolute(i)||je.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be relative to its declared path base`);let r=i.split("/");if(r.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(i))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function ge(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function hl(t,e,n){let i=t??e;if(i!=="en"&&i!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return i}function gl(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>Do)throw new Error(`${e} exceeds ${Do} characters`);let n=0;for(let i=0;i<t.length;i+=1)t[i]==="?"?n+=1:t[i]==="*"&&(n+=1,t[i+1]==="*"&&(i+=1));if(n>Wo)throw new Error(`${e} contains more than ${Wo} wildcard tokens`);return t}function pl(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(i=>gl(i,e)))].sort((i,r)=>i.localeCompare(r,"en"))}function Lo(t,e,n){let i=t??e;if(!Number.isSafeInteger(i)||i<1)throw new Error(`${n} must be a positive integer`);return i}function Dh(t){if(t===void 0)return{...he,include:[...he.include],exclude:[...he.exclude]};let e=ge(t,"native.snapshot");return{include:pl(e.include,"native.snapshot.include",he.include),exclude:pl(e.exclude,"native.snapshot.exclude",he.exclude),max_files:Lo(e.max_files,he.max_files,"native.snapshot.max_files"),max_total_bytes:Lo(e.max_total_bytes,he.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Lo(e.max_duration_ms,he.max_duration_ms,"native.snapshot.max_duration_ms")}}function Wh(t){if(t===void 0)return;let e=ge(t,"native.pending_root_move"),n=e.id,i=e.from_artifact_root,r=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 i!="string"||typeof r!="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=ge(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:ki(i),toArtifactRoot:ki(r),stage:o,...s?{cleanup:s}:{}}}function Fh(t){if(t===void 0)return;let e=ge(t,"native.finish");if(e.pull_request===void 0)return{};let n=ge(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 i=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(je.posix.isAbsolute(i[0])||je.win32.isAbsolute(i[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let r=n.timeout_ms??Th;if(!Number.isSafeInteger(r)||r<1||r>dl)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${dl}`);return{pull_request:{provider:"repository-command",command:i,timeout_ms:r}}}function Mh(t,e={}){let n=ge(t,"native"),i=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let r=n.clarification_mode??"batch";if(r!=="sequential"&&r!=="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??Nh;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=Wh(n.pending_root_move),c=Fh(n.finish);return{artifact_root:ki(i),language:hl(n.language,"en","native.language"),clarification_mode:r,archive_confirmation:o,max_verify_failures:s,snapshot:Dh(n.snapshot),...c?{finish:c}:{},...a?{pending_root_move:a}:{}}}function Bh(t){let e=ge(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let i=e.review_mode??"standard";if(i!=="off"&&i!=="standard"&&i!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:ml(e.artifact_layout),language:hl(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:i,auto_transition:r}}function Kh(t){let n=ge(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((i,r)=>we(i,`hook.allow_paths[${r}]`)))]}}function Uh(t){if(t===void 0)return{...$o};let e=ge(t,"memory"),n=e.learning??$o.learning,i=e.retrieval??$o.retrieval;if(typeof n!="boolean")throw new Error("memory.learning must be true or false");if(typeof i!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:n,retrieval:i}}function Mo(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Hh(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")||je.posix.isAbsolute(n)||je.win32.isAbsolute(n)||n.startsWith("~")||n.split("/").some(r=>r===""||r==="."||r===".."))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>ul)throw new Error(`${e} exceeds ${ul} characters`);let i=0;for(let r=0;r<n.length;r+=1)n[r]==="?"?i+=1:n[r]==="*"&&(i+=1,n[r+1]==="*"&&(r+=1));if(i>fl)throw new Error(`${e} contains more than ${fl} wildcard tokens`);return n}function Yh(t){let n=Mo(t,"knowledge.local").include??[];if(!Array.isArray(n))throw new Error("knowledge.local.include must be an array");return{include:[...new Set(n.map((i,r)=>Hh(i,`knowledge.local.include[${r}]`)))]}}function Jh(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,""),i=n==="localhost"||n==="127.0.0.1"||n==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&i))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function Vh(t){let e=Mo(t,"knowledge.remote"),n=Jh(e.endpoint),i=e.token_env;if(i!==void 0&&(typeof i!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(i)))throw new Error("knowledge.remote.token_env must be an environment variable name");let r=e.scope;if(r!==void 0&&(typeof r!="string"||r.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,...i===void 0?{}:{token_env:i},...r===void 0?{}:{scope:r},timeout_ms:o}}function Gh(t){if(t===void 0)return{...jh};let e=Mo(t,"knowledge"),n=e.provider??"local";if(n!=="local"&&n!=="remote")throw new Error("knowledge.provider must be local or remote");let i=e.local===void 0?void 0:Yh(e.local);if(n==="local")return{provider:n,...i?{local:i}:{}};let r=e.remote===void 0?void 0:Vh(e.remote);if(r===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:n,...i?{local:i}:{},remote:r}}function zh(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Qh(t,e,n,i,r,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")&&!r)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:i,...r?{native:r}:{},...o?{classic:o}:{}}}function gt(t,e={}){let n=(0,Fo.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let i=n.toJS();if(i==null)return{value:{},config:null,ambient_resume:!0};if(typeof i!="object"||Array.isArray(i))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let r=i,o=zh(r.ambient_resume),s=r.hook===void 0?void 0:Kh(r.hook),a=Uh(r.memory),c=Gh(r.knowledge),l=r.native===void 0?void 0:Mh(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),f=r.classic===void 0?void 0:Bh(r.classic),u=Qh(r,s,a,c,l,f,o,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:u,ambient_resume:o,memory:a,knowledge:c,...s?{hook:s}:{},...l?{native:l}:{},...f?{classic:f}:{}}}var Fo,sn,Do,Wo,ul,fl,Nh,$o,jh,Th,dl,Ih,qh,$h,he,ye=q(()=>{"use strict";Fo=Pt(ht(),1),sn=64*1024,Do=1024,Wo=64,ul=1024,fl=64,Nh=5,$o={learning:!0,retrieval:!0},jh={provider:"local"},Th=12e4,dl=6e5,Ih=[".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/**"],qh=["**/.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"],$h=[...Ih,...qh].sort((t,e)=>t.localeCompare(e,"en")),he={include:["**/*"],exclude:[...$h],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});function Te(t){return t!==0&&t!==0n&&t!=="0"}function wl(t,e){return Te(t.dev)&&Te(e.dev)&&Te(t.ino)&&Te(e.ino)}function Ie(t,e){let n=Te(t.dev)&&Te(e.dev);if(n&&t.dev!==e.dev)return!1;let i=Te(t.ino)&&Te(e.ino);return i&&t.ino!==e.ino?!1:n&&i?!0:t.birthtime===e.birthtime}var bi=q(()=>{"use strict"});import{constants as Si,promises as Ze}from"fs";function Bo(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function yl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function an(t){return{dev:t.dev,ino:t.ino,birthtime:Bo(t)}}function Ci(t,e){let n=an(t),i=an(e);return wl(n,i)?Ie(n,i):Ie(n,i)&&Bo(t)===Bo(e)&&yl(t)===yl(e)&&t.size===e.size}async function vl(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let i=n.label??"file",r=n.bigint===!0,o=await Ze.lstat(t,{bigint:r});if(!o.isFile()||o.isSymbolicLink())throw new qe("not-regular-file",`${i} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new qe("too-large",`${i} exceeds ${e} bytes`);let s=await Ze.realpath(t);await n.verify?.("pre-open",{realPath:s,identity:an(o)});let a=process.platform==="win32"?Si.O_RDONLY:Si.O_RDONLY|Si.O_NOFOLLOW|Si.O_NONBLOCK,c;try{c=await Ze.open(t,a)}catch(l){throw l.code==="ELOOP"?new qe("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,f,u]=await Promise.all([c.stat({bigint:r}),Ze.lstat(t,{bigint:r}),Ze.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==s||!Ci(o,l)||!Ci(o,f))throw new qe("changed",`${i} changed while opening`);await n.verify?.("post-open",{realPath:u,identity:an(l)}),await n.hooks?.afterOpen?.();let d=[],h=0,w=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let g=e+1-h,{bytesRead:b}=await c.read(w,0,Math.min(w.length,g),null);if(b===0)break;if(h+=b,h>e)throw new qe("too-large",`${i} exceeds ${e} bytes`);d.push(Buffer.from(w.subarray(0,b)))}await n.hooks?.beforeFinalCheck?.();let[p,m,y]=await Promise.all([c.stat({bigint:r}),Ze.lstat(t,{bigint:r}),Ze.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||y!==s||!Ci(o,p)||!Ci(o,m))throw new qe("changed",`${i} changed while reading`);return await n.verify?.("post-read",{realPath:y,identity:an(p)}),{bytes:Buffer.concat(d,h),stat:p,realPath:y}}finally{await c.close()}}var qe,kl=q(()=>{"use strict";bi();qe=class extends Error{reason;constructor(e,n,i){super(n,i),this.name="RaceSafeReadError",this.reason=e}}});import{promises as $e}from"fs";import ie from"path";function bl(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Ei(t,e){let n=ie.relative(t,e);return n===""||!ie.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${ie.sep}`)}async function Ko(t,e){let n=ie.resolve(t),i=await $e.lstat(n);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return $e.realpath(n)}async function Uo(t,e,n,i){let r=t;for(let o=0;o<n.length;o++){r=ie.join(r,n[o]);let s;try{s=await $e.lstat(r)}catch(f){if(bl(f))return{exists:!1,kind:"missing"};throw f}let a=ie.relative(t,r).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${a}`);let c=o===n.length-1;if(!c&&!s.isDirectory())throw new Error(`${i.label} ancestor ${a} must be a real directory`);if(c&&(i.expected==="file"&&!s.isFile()||i.expected==="directory"&&!s.isDirectory()||i.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${i.label} must be a real ${i.expected}`);let l=await $e.realpath(r);if(!Ei(e,l))throw new Error(`${i.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 A(t,e,n){let i=we(e,n.label),r=ie.resolve(t),o=await Ko(r,n.label),s=i.split("/"),a=ie.resolve(r,...s);if(!Ei(r,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Uo(r,o,s,n);return{projectRoot:r,target:a,relative:i,exists:c.exists,kind:c.kind}}async function Ho(t,e,n){let i=we(e,n.label),r=ie.resolve(t),o=await Ko(r,n.label),s=i.split("/"),a=r;for(let c of s){a=ie.join(a,c);let l;try{l=await $e.lstat(a)}catch(d){if(!bl(d))throw d;try{await $e.mkdir(a)}catch(h){if(h.code!=="EEXIST")throw h}l=await $e.lstat(a)}let f=ie.relative(r,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 $e.realpath(a);if(!Ei(o,u))throw new Error(`${n.label} resolves outside the project root`)}return await Uo(r,o,s,{label:n.label,expected:"directory"}),a}async function _i(t,e,n){return(await A(t,e,{...n,expected:"file"})).exists}async function W(t,e,n,i){let r=await A(t,e,{label:i.label,expected:"file"});if(!r.exists){let s=new Error(`${i.label} does not exist`);throw s.code="ENOENT",s}let o=await Ko(r.projectRoot,i.label);return vl(r.target,n,{...i,verify:async(s,a)=>{if(!Ei(o,a.realPath))throw new Error(`${i.label} resolves outside the project root`);await Uo(r.projectRoot,o,r.relative.split("/"),{label:i.label,expected:"file"})}})}var X=q(()=>{"use strict";kl();ye()});import{createHash as Xh}from"crypto";function Zh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ln(t,e={}){return(await xi(t,e)).document}async function eg(t){try{return(await W(t,cn,sn,{label:cn})).bytes}catch(e){if(Zh(e))return null;throw e}}function tg(t){return t?{exists:!0,sha256:Xh("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function xi(t,e={}){let n=await eg(t);return{document:n?gt(n.toString("utf8"),e):null,identity:tg(n)}}async function Yo(t){return(await ln(t))?.config??null}var cn,wt=q(()=>{"use strict";ye();X();cn=".comet/config.yaml"});import{randomUUID as ng}from"crypto";import{constants as ig,promises as T}from"fs";import F from"path";async function Vo(t,e){try{return await T.link(t,e),{linked:!0}}catch(n){let i=n.code;if(i!=="ENOTSUP"&&i!=="EOPNOTSUPP")throw n}return await T.copyFile(t,e,ig.COPYFILE_EXCL),{linked:!1}}function yt(t,e){let n=F.relative(t,e);return n===""||!F.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${F.sep}`)}function Pi(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function rg(t,e){return Ie(t,Pi(e))}function Jo(t,e){return Ie(Pi(t),Pi(e))}function Sl(t,e){return Jo(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Ri(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),...Pi(e)}}async function Le(t){for(let e of t){let n=await T.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!rg(e,n)||await T.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function og(t,e){let n=F.resolve(t),i=F.resolve(e);if(!yt(n,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await Ri(n)],o=F.relative(n,i).split(F.sep).filter(Boolean),s=n;for(let a of o){await Le(r),s=F.join(s,a);try{await T.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Ri(s);if(!yt(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);r.push(c)}return await Le(r),r}async function sg(t,e){let n=F.resolve(t),i=F.resolve(e);if(!yt(n,i))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await Ri(n)],o=F.relative(n,i).split(F.sep).filter(Boolean),s=n;for(let a of o){s=F.join(s,a);try{let c=await Ri(s);if(!yt(r[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);r.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await Le(r),r}async function Cl(t){let e;try{e=await T.open(t,"r"),await e.sync()}catch(n){let i=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(i??""))throw n}finally{await e?.close()}}async function ag(t,e,n){let i=F.dirname(t),r=await og(n.containedRoot,i),o=F.join(i,`.${F.basename(t)}.${ng()}.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 Le(r),!l.isFile()||l.isSymbolicLink()||!Jo(a,l)||!yt(r[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(),!Jo(a,c))throw new Error("Contained atomic write temporary file changed while writing");await s.close(),s=void 0,await n.beforeCommit?.(),await Le(r);let u=await T.lstat(o);if(!u.isFile()||u.isSymbolicLink()||!c||!Sl(u,c))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await Vo(o,t),await T.unlink(o)):await T.rename(o,t),await Cl(i)}catch(l){await s?.close();try{await Le(r),await T.rm(o,{force:!0})}catch{}throw l}}async function Z(t,e,n){await ag(t,e,n)}async function Go(t,e){let n=F.dirname(t),i=await sg(e.containedRoot,n);if(!i)return!1;let r,o;try{r=await T.lstat(t),o=await T.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!yt(i[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await Le(i);let[s,a]=await Promise.all([T.lstat(t),T.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!Sl(r,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await T.unlink(t),await Le(i),await Cl(n),!0}var De=q(()=>{"use strict";bi()});var ok,zo=q(()=>{"use strict";De();wt();X();ok=16*1024});var Xo=q(()=>{"use strict";De();ye();wt();X();zo()});var qi=q(()=>{"use strict"});var $l=q(()=>{"use strict"});var is=q(()=>{"use strict";qi()});var Ll=q(()=>{"use strict";qi();is()});var Lg,Dl=q(()=>{"use strict";Lg=Pt(ht(),1);De();ye();X()});var rb,Wl=q(()=>{"use strict";De();X();rb=4*1024*1024});function Wg(t,e){let n=t;for(let i of e)n+="\0"+(typeof i=="string"?i:JSON.stringify(i));return n}function Fl(t,e){return(...n)=>{let i=Dg;if(i===null)return e(...n);let r=Wg(`async:${t}`,n),o=i.entries.get(r);if(o)return o.value;let s=e(...n).catch(a=>{throw i.entries.delete(r),a});return i.entries.set(r,{value:s}),s}}var Dg,Ml=q(()=>{"use strict";Dg=null});var lb,Bl=q(()=>{"use strict";Ml();wt();lb=Fl("hookWritePolicy",async t=>(await Yo(t))?.hook??{allow_paths:[]})});var Kl=q(()=>{"use strict";qi();De();$l();Ll();ye();Dl();X();wt();Xo();Wl();Bl();zo();is()});import{TextDecoder as Fg}from"util";function Ul(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Mg(t,e){try{return new Fg("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function rs(t,e,n,i,r={}){try{let o=await W(t,e,n,{label:i,hooks:r.hooks});return{result:o,text:Mg(o,i)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function ke(t,e,n,i,r={}){return(await rs(t,e,n,i,r))?.text??null}async function Fe(t,e,n,i,r,o={}){if(Buffer.byteLength(n,"utf8")>i)throw new Error(`${r} exceeds ${i} bytes`);let s=await rs(t,e,i,r),a=await A(t,e,{label:r,expected:"file"});await Z(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await rs(t,e,i,r);if(!(!s&&!c)){if(!s||!c)throw new Error(`${r} changed before commit`);if(s.result.realPath!==c.result.realPath||!Ie(Ul(s.result.stat),Ul(c.result.stat))||s.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function Hl(t,e,n,i,r,o={}){let s=await ke(t,e,i,r);await Fe(t,e,`${s??""}${n}`,i,r,o)}async function $i(t,e,n,i={}){let r=await A(t,e,{label:n,expected:"file"});return r.exists?Go(r.target,{containedRoot:r.projectRoot,beforeRemove:i.beforeRemove}):!1}var os=q(()=>{"use strict";Kl();bi()});var Vl={};Zu(Vl,{RUN_STATE_FILE:()=>Di,applyRunStateToDocument:()=>ss,readRunState:()=>as,removeRunState:()=>cs,runStateFromDocument:()=>Li,writeRunState:()=>Wi});import Bg from"path";function wn(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 gn(t,e){let n=wn(t,e);if(Bg.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 Kg(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(i){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:i})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let i of Object.values(n))if(!Number.isInteger(i)||Number(i)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function Li(t){if(!t.run_id)return null;let e=wn(t,"run_id"),n=wn(t,"skill"),i=wn(t,"skill_version"),r=wn(t,"skill_hash"),o=gn(t,"pending_ref"),s=gn(t,"trajectory_ref"),a=gn(t,"context_ref"),c=gn(t,"artifacts_ref"),l=gn(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:i,skillHash:r,orchestration:t.orchestration,currentStep:Yl(t,"current_step"),iteration:f,pending:Yl(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Kg(t)}}function ss(t,e){e?t.run_id=e.runId:delete t.run_id}function Ug(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 Hg(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 Li(e)}async function as(t,e={}){let n=await ke(t,Di,Jl,"Run state",e);if(n===null)return null;let i=JSON.parse(n);return Hg(i)}async function Wi(t,e,n={}){await Fe(t,Di,JSON.stringify(Ug(e),null,2),Jl,"Run state",n)}async function cs(t,e={}){await $i(t,Di,"Run state",e)}var Yl,Di,Jl,Fi=q(()=>{"use strict";os();Yl=(t,e)=>{let n=t[e];return n==null?null:String(n)};Di=".comet/run-state.json",Jl=256*1024});var Mu=Pt(ht(),1);import{createHash as Du}from"crypto";import{promises as Wu}from"fs";import Fu from"path";import jl from"path";import{promises as Pl}from"fs";import O from"path";import{promises as Ah}from"fs";async function on(t){try{return await Ah.access(t),!0}catch(e){if(Oh(e))return!1;throw e}}function Oh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ye();wt();Xo();X();var un=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},xl=".comet/config.yaml";function Rl(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Al(t){await A(t,xl,{label:xl,expected:"file"})}function Ai(t,e){let n=O.resolve(t),i=e==="docs"?O.join(n,"docs"):n,r=O.join(i,"openspec"),o=O.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:i,openSpecRoot:r,changesDir:O.join(r,"changes"),archiveDir:O.join(r,"changes","archive"),specsDir:O.join(r,"specs"),superpowersRoot:o,superpowersSpecsDir:O.join(o,"specs"),superpowersPlansDir:O.join(o,"plans"),superpowersReportsDir:O.join(o,"reports")}}async function dg(t){await Al(t);let e=await ln(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new un;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new un("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function pg(t,e){return Ai(t,e??await dg(t))}async function mg(t){try{return await Pl.lstat(t),!0}catch(e){if(Rl(e))return!1;throw e}}async function hg(t,e){let n=await pg(t,e),i=n.artifactLayout==="legacy"?"docs":"legacy",r=Ai(t,i).openSpecRoot,[o,s]=await Promise.all([A(n.projectRoot,M(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),mg(r)]),a=o.exists;return{paths:n,configuredRootExists:a,alternateRoot:r,alternateRootExists:s,dualRoots:a&&s}}async function gg(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 i=M(t.projectRoot,n);await A(t.projectRoot,i,{label:`Classic managed physical path ${i}`,expected:"directory"})}}async function We(t,e){let n=await hg(t,e);if(await gg(n.paths),!n.configuredRootExists){let i=M(n.paths.projectRoot,n.paths.openSpecRoot),r=M(n.paths.projectRoot,n.alternateRoot);throw new un(`Configured Classic OpenSpec root is missing: ${i} (alternate ${r} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function Zo(t,e){let n=O.join(O.resolve(t),".comet","classic-root-move.json");if(await on(n))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let i=await We(t,e);if(!await on(i.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${M(i.projectRoot,i.openSpecRoot)}`);return i}async function et(t){let e=O.resolve(t),n=null;try{(await Pl.lstat(e)).isDirectory()||(e=O.dirname(e))}catch(i){if(!Rl(i))throw i}for(;;){O.basename(e)==="openspec"&&(n=O.dirname(e));let i=O.join(e,".comet","config.yaml"),r=!1;if(await on(i))try{await Al(e);let s=(await ln(e))?.value;r=!!s&&typeof s=="object"&&!Array.isArray(s)&&(s.schema==="comet.project.v1"||s.default_workflow!==void 0||s.native!==void 0)}catch{}if(r||await on(O.join(e,".git")))return e;let o=O.dirname(e);if(o===e)return n??O.resolve(t);e=o}}function M(t,e){return O.relative(O.resolve(t),e).replaceAll("\\","/")}De();ye();X();import fn from"path";var wg=2*1024*1024;function Oi(t,e,n){let i=fn.resolve(t),r=fn.isAbsolute(e)?fn.resolve(e):fn.resolve(i,e),o=fn.relative(i,r).replaceAll("\\","/");return{root:i,relative:we(o,n),target:r}}async function le(t,e,n){let i=Oi(t,e,n.label);return A(i.root,i.relative,n)}async function Ni(t,e,n){return(await le(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function es(t,e,n,i){return await Ni(t,e,{label:n,expected:"file"})?(await Ol(t,e,{label:n,hooks:i})).byteLength>0:!1}async function vt(t,e,n){return(await Ol(t,e,n)).toString("utf8")}async function Ol(t,e,n){let i=Oi(t,e,n.label);return(await W(i.root,i.relative,n.maxBytes??wg,{label:n.label,hooks:n.hooks})).bytes}async function ji(t,e,n){let i=Oi(t,e,n);return Ho(i.root,i.relative,{label:n})}async function Nl(t,e,n,i){let r=Oi(t,e,i.label);await A(r.root,r.relative,{label:i.label,expected:"file"}),await Z(r.target,n,{containedRoot:r.root,beforeTemporaryOpen:i.beforeTemporaryOpen,beforeCommit:i.beforeCommit,exclusive:i.exclusive})}function ts(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 ns(t){let e=ts(t);if(e)throw new Error(e)}function yg(t,e){return{label:M(t,e),directory:e}}async function vg(t,e,n){let i=yg(t,e);if(!(await le(t,e,{label:n,expected:"directory"})).exists)return{change:i,exists:!1,stateExists:!1};let o=await le(t,jl.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:i,exists:!0,stateExists:o.exists}}async function Tl(t,e=process.cwd()){ns(t);let n=await We(e),i=await vg(n.projectRoot,jl.join(n.changesDir,t),`Classic active change ${t}`);return{...i.change,exists:i.exists,stateExists:i.stateExists}}import{promises as Pu}from"fs";import G from"path";import{fileURLToPath as Ru}from"url";import{promises as bg}from"fs";import ve from"path";X();ye();import dn from"path";function kg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Il(t,e,n,i){let r=we(n,"Classic handoff artifact pointer");if((await A(t,r,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let s=await We(t),a=`${M(t,s.changesDir)}/`,l=(s.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(g=>r.startsWith(g));if(!l)return null;let f=r.slice(l.length).split("/");if(f.length<4||f[1]!==".comet"||f.slice(2).some(g=>g.length===0))return null;let u=f[0];ns(u);let d=f.slice(2),h=dn.resolve(e);if(dn.dirname(h)!==dn.resolve(s.archiveDir))return null;let w=dn.basename(h),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(w);if(w!==u&&p?.[1]!==u)return null;await A(t,M(t,h),{label:"Classic archived change directory",expected:"directory"});let m=dn.join(h,".comet",...d),y=M(t,m);try{return await W(t,y,i,{label:"Historical Classic archived handoff artifact"}),y}catch(g){if(kg(g))return null;throw g}}X();var ql=2*1024*1024;function pn(t,e){return ve.relative(t,e).split(ve.sep).join("/")}async function mn(t,e,n,i,r){if(!n)return{code:e,satisfied:!1};let o=n.replaceAll("\\","/");if(r)return{code:e,satisfied:!1,source:o,detail:`Classic layout is unsafe or unavailable: ${r instanceof Error?r.message:String(r)}`};try{if(i){let a=i.artifactLayout==="legacy"?"docs":"legacy",c=M(t,Ai(t,a).openSpecRoot);if((o===c||o.startsWith(`${c}/`))&&(await A(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 _i(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 Sg(t,e,n,i){try{i??=await We(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 r=await mn(t,"design.handoff",n,i);if(!n||r.satisfied||r.detail)return r;try{let o=await Il(t,e,n,ql);return o?{...r,satisfied:!0,resolvedSource:o,detail:`resolved historical legacy pointer from archived change: ${o}`}:r}catch(o){return{...r,satisfied:!1,detail:`unsafe archived handoff fallback: ${o instanceof Error?o.message:String(o)}`}}}async function Ti(t,e,n){return mn(t,e,pn(t,n))}async function Cg(t,e){let n=ve.join(e,"specs"),i;try{let s=pn(t,n);if(!(await A(t,s,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};i=await bg.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 r=i.map(s=>ve.join(n,s,"spec.md")),o=(await Promise.all(r.map(async s=>{try{return await _i(t,pn(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]?pn(t,o[0]):void 0,detail:`${o.length} delta spec${o.length===1?"":"s"}`}}async function Eg(t,e){let n,i=pn(t,e);try{n=(await W(t,i,ql,{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:i,detail:`unsafe tasks artifact: ${s instanceof Error?s.message:String(s)}`}}let r=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],o=r.filter(s=>s[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:r.length>0&&o===r.length,source:i,detail:`${o} of ${r.length} tasks complete`}}function hn(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function kt(t,e){let n=await et(t),i=e.classic,r=ve.join(t,"proposal.md"),o=ve.join(t,"design.md"),s=ve.join(t,"tasks.md"),a=e.run?ve.resolve(t,e.run.checkpointRef):ve.join(t,".comet","checkpoint.json"),c,l;try{c=await We(n)}catch(d){l=d}let f=await Promise.all([Ti(n,"openspec.proposal",r),Ti(n,"openspec.design",o),Ti(n,"openspec.tasks",s),Cg(n,t),mn(n,"design.document",i?.designDoc??null,c,l),mn(n,"build.plan",i?.plan??null,c,l),Eg(n,s),mn(n,"verification.report",i?.verificationReport??null,c,l),Sg(n,t,i?.handoffContext??null,c),Ti(n,"run.checkpoint",a)]),u=f.find(d=>d.code==="design.handoff");return u&&!i?.handoffHash&&(u.satisfied=!1,u.detail="handoff hash is missing"),f.push({code:"archive.confirmed",satisfied:i?.archiveConfirmation==="confirmed"}),f}import{createHash as Dw,randomUUID as Ww}from"crypto";import{promises as ws}from"fs";import be from"path";function _g(t){return t.classicProfile??t.workflow}function xg(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 Pg(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function Rg(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!hn(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!xg(e))return"full.build.configure"}else if(!Pg(e))throw new Error(`${t} build configuration is incomplete`);return hn(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function Ag(t,e,n){return e.verifyResult!=="pass"||!hn(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Og(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 Ii(t,e){let n=_g(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 hn(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return Rg(n,t,e);case"verify":return Ag(n,t,e);case"archive":return Og(n,t)}}var Ui=Pt(ht(),1);De();X();import Ki from"path";Fi();var Gl=["full","hotfix","tweak"],tt=1,Yg=["open","design","build","verify","archive"],Jg=["en","zh-CN"],Vg=["off","beta"],Gg=["subagent-driven-development","executing-plans","direct"],zg=["plan-ready"],Qg=["confirmed"],Xg=["tdd","direct"],Zg=["off","standard","thorough"],ew=["current","branch","worktree"],tw=["light","full"],nw=["pending","pass","fail"],iw=["pending","handled"],rw=["pending","confirmed"],Bi=["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"],ow=["run_id"],sw=new Set([...Bi,...ow]),aw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function zl(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function bt(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 K(t,e,n,i=!0){let r=t[e];if(r==null||r===""){if(i)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="string"||!n.includes(r))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${i?" or null":""}`);return r}function ls(t,e,n=!0){let i=t[e];if(i==null||i===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return i}function cw(t,e,n=0){let i=t[e];if(i==null||i==="")return n;if(typeof i!="number"||!Number.isInteger(i)||i<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return i}function Mi(t,e){let n=bt(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 lw(t,e){let n=bt(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 uw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==tt)throw new Error(`Invalid Classic state: classic_migration must be ${tt}`);return e}function fw(t){if(!Bi.some(n=>zl(t,n)))return null;for(let n of aw)if(!zl(t,n))return null;return{workflow:K(t,"workflow",Gl,!1),language:K(t,"language",Jg),phase:K(t,"phase",Yg,!1),contextCompression:K(t,"context_compression",Vg),buildMode:K(t,"build_mode",Gg),buildPause:K(t,"build_pause",zg),subagentDispatch:K(t,"subagent_dispatch",Qg),tddMode:K(t,"tdd_mode",Xg),reviewMode:K(t,"review_mode",Zg),isolation:K(t,"isolation",ew),boundBranch:bt(t,"bound_branch"),verifyMode:K(t,"verify_mode",tw),autoTransition:ls(t,"auto_transition"),baseRef:bt(t,"base_ref"),designDoc:Mi(t,"design_doc"),plan:Mi(t,"plan"),verifyResult:K(t,"verify_result",nw,!1),verifyFailures:cw(t,"verify_failures"),verificationReport:Mi(t,"verification_report"),branchStatus:K(t,"branch_status",iw),createdAt:bt(t,"created_at"),verifiedAt:bt(t,"verified_at"),archiveConfirmation:K(t,"archive_confirmation",rw),archived:ls(t,"archived",!1),directOverride:ls(t,"direct_override"),handoffContext:Mi(t,"handoff_context"),handoffHash:lw(t,"handoff_hash"),classicProfile:K(t,"classic_profile",Gl),classicMigration:uw(t)}}function us(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=Li(t)}catch(i){let r=i instanceof Error?i.message:String(i);throw new Error(r.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:i})}return{classic:fw(t),run:n,unknownKeys:Object.keys(t).filter(i=>!sw.has(i))}}function Ql(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}}Fi();var dw=2*1024*1024;function yn(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 Xl(t,e,n){t.get(e)!==n&&t.set(e,n)}function pw(t,e){if(e.classic)for(let[n,i]of Object.entries(Ql(e.classic)))Xl(t,n,i);else for(let n of Bi)t.delete(n);ss(t.toJS(),e.run),e.run?Xl(t,"run_id",e.run.runId):t.delete("run_id")}function mw(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 hw(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function Zl(t){let e;try{e=(await W(Ki.dirname(t),Ki.basename(t),dw,{label:"Classic state document"})).bytes.toString("utf8")}catch(i){if(i.code!=="ENOENT")throw i;return new Ui.Document({})}let n=(0,Ui.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return yn(n),n}async function Me(t,e={}){let n=e.migrate!==!1,i=Ki.join(t,".comet.yaml"),r=await Zl(i),o=yn(r),s=hw(r);s&&(o=yn(r));let a=await as(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Fi(),Vl));a=c(o),a&&n&&(await Wi(t,a),mw(r),s=!0)}return s&&n&&await Z(i,r.toString(),{containedRoot:t}),us(yn(r),a)}async function nt(t,e,n={}){let i=Ki.join(t,".comet.yaml"),r=await Zl(i);pw(r,{...e,unknownKeys:e.unknownKeys??[]}),us(yn(r),e.run??null),await Z(i,r.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await Wi(t,e.run):await cs(t)}function eu(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:{}}}os();import Hi from"path";var ue={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function re(t,e){if(Hi.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Hi.resolve(t),i=Hi.resolve(n,e);if(i!==n&&!i.startsWith(n+Hi.sep))throw new Error("Run path must stay inside the change directory")}async function St(t,e,n,i={}){re(t,e),await Hl(t,e,`${JSON.stringify(n)}
144
- `,ue.trajectory,"Run trajectory",i)}async function vn(t,e,n={}){re(t,e);let i=await ke(t,e,ue.trajectory,"Run trajectory",n);return i===null?[]:i.split(/\r?\n/).map((r,o)=>({line:r,number:o+1})).filter(({line:r})=>r.length>0).map(({line:r,number:o})=>{try{return JSON.parse(r)}catch(s){throw new Error(`Invalid Trajectory event at line ${o}`,{cause:s})}})}async function fs(t,e,n={}){re(t,e);let i=await ke(t,e,ue.artifacts,"Run artifacts",n);return i===null?{}:JSON.parse(i)}async function Yi(t,e,n,i={}){re(t,e),await Fe(t,e,JSON.stringify(n,null,2)+`
145
- `,ue.artifacts,"Run artifacts",i)}async function Ji(t,e,n,i={}){re(t,e),await Fe(t,e,n,ue.context,"Run context",i)}async function tu(t,e,n={}){return re(t,e),ke(t,e,ue.context,"Run context",n)}async function nu(t,e,n,i={}){re(t,e),await Fe(t,e,JSON.stringify(n,null,2)+`
146
- `,ue.pendingAction,"Run pending action",i)}async function ds(t,e,n={}){re(t,e);let i=await ke(t,e,ue.pendingAction,"Run pending action",n);return i===null?null:JSON.parse(i)}async function iu(t,e,n={}){re(t,e),await $i(t,e,"Run pending action",n)}async function Vi(t,e,n,i={}){re(t,e),await Fe(t,e,JSON.stringify(n,null,2)+`
147
- `,ue.checkpoint,"Run checkpoint",i)}async function ru(t,e,n={}){re(t,e);let i=await ke(t,e,ue.checkpoint,"Run checkpoint",n);return i===null?null:JSON.parse(i)}import{createHash as yu,randomUUID as Tw}from"crypto";import{promises as L}from"fs";import I from"path";var au=Pt(ht(),1);import{promises as ps}from"fs";import ee from"path";var gw=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],ww=["deterministic","adaptive"],yw=["function","mcp","script","agent"],vw=["none","read","write","external"],kw=["progress","step","completion"],bw=["artifact_exists","state_equals"];function it(t,e,n){return new Error(`${t}: ${e} ${n}`)}function V(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw it(e,n,"must be an object")}function Be(t,e,n){if(!Array.isArray(t))throw it(e,n,"must be an array")}function U(t,e,n){if(typeof t!="string")throw it(e,n,"must be a string")}function oe(t,e,n,i){e in t&&U(t[e],n,`${i}.${e}`)}function cu(t,e,n,i){if(e in t&&typeof t[e]!="boolean")throw it(n,`${i}.${e}`,"must be a boolean")}function Ke(t,e,n,i){if(typeof t!="string"||!e.includes(t))throw it(n,i,`must be one of ${e.join(", ")}`)}function Gi(t,e,n){Be(t,e,n),t.forEach((i,r)=>{U(i,e,`${n}[${r}]`)})}function ou(t,e,n){V(t,e,n),U(t.name,e,`${n}.name`),U(t.description,e,`${n}.description`),cu(t,"required",e,n)}function Sw(t,e,n){V(t,e,n),U(t.id,e,`${n}.id`),oe(t,"source",e,n),oe(t,"version",e,n)}function Cw(t,e,n){V(t,e,n),U(t.id,e,`${n}.id`),U(t.role,e,`${n}.role`),oe(t,"instructions",e,n)}function Ew(t,e,n){V(t,e,n),U(t.id,e,`${n}.id`),Ke(t.kind,yw,e,`${n}.kind`),U(t.source,e,`${n}.source`),Ke(t.sideEffect,vw,e,`${n}.sideEffect`),cu(t,"requiresConfirmation",e,n)}function _w(t,e,n){V(t,e,n),Ke(t.type,gw,e,`${n}.type`),oe(t,"ref",e,n),oe(t,"prompt",e,n),oe(t,"question",e,n),"options"in t&&Gi(t.options,e,`${n}.options`)}function xw(t,e,n){V(t,e,n),U(t.id,e,`${n}.id`),_w(t.action,e,`${n}.action`),oe(t,"next",e,n),"completionEvals"in t&&Gi(t.completionEvals,e,`${n}.completionEvals`)}function Pw(t,e){let n="goal";V(t,e,n),U(t.statement,e,`${n}.statement`),Be(t.inputs,e,`${n}.inputs`),t.inputs.forEach((i,r)=>{ou(i,e,`${n}.inputs[${r}]`)}),Be(t.outputs,e,`${n}.outputs`),t.outputs.forEach((i,r)=>{ou(i,e,`${n}.outputs[${r}]`)}),Gi(t.success,e,`${n}.success`)}function Rw(t,e){let n="orchestration";V(t,e,n),Ke(t.mode,ww,e,`${n}.mode`),oe(t,"entry",e,n),"steps"in t&&(Be(t.steps,e,`${n}.steps`),t.steps.forEach((i,r)=>{xw(i,e,`${n}.steps[${r}]`)}))}function lu(t,e){return V(t,e),Ke(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ke(t.kind,["Skill"],e,"kind"),V(t.metadata,e,"metadata"),U(t.metadata.name,e,"metadata.name"),U(t.metadata.version,e,"metadata.version"),U(t.metadata.description,e,"metadata.description"),Pw(t.goal,e),Rw(t.orchestration,e),Be(t.skills,e,"skills"),t.skills.forEach((n,i)=>{Sw(n,e,`skills[${i}]`)}),Be(t.agents,e,"agents"),t.agents.forEach((n,i)=>{Cw(n,e,`agents[${i}]`)}),Be(t.tools,e,"tools"),t.tools.forEach((n,i)=>{Ew(n,e,`tools[${i}]`)}),t}function uu(t,e){V(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&Gi(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 Aw(t,e){return V(t,e),"runtime"in t&&fu(t.runtime,e,"runtime"),t}function fu(t,e,n){return Be(t,e,n),t.forEach((i,r)=>{let o=`${n}[${r}]`;V(i,e,o),U(i.id,e,`${o}.id`),Ke(i.scope,kw,e,`${o}.scope`),Ke(i.type,bw,e,`${o}.type`),oe(i,"artifact",e,o),oe(i,"field",e,o),oe(i,"equals",e,o)}),t}async function ms(t){let e=await ps.readFile(t,"utf8");try{return(0,au.parse)(e)}catch(n){let i=n instanceof Error?n.message:String(n);throw it(t,"document",i)}}async function Ow(t){try{return await ms(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function su(t){try{return await ps.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Nw(t){let e=ee.join(t,"checks.yaml"),n=ee.join(t,"evals.yaml"),[i,r]=await Promise.all([su(e),su(n)]);if(r)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return i?{document:Aw(await ms(e),e)}:{document:null}}async function du(t){let e=ee.resolve(t.root),n=ee.resolve(t.controlRoot);t.requireSkillMarkdown&&await ps.access(ee.join(e,"SKILL.md"));let i=ee.join(n,"skill.yaml"),r=ee.join(n,"guardrails.yaml"),o=lu(await ms(i),i),s=await Ow(r),a=s===null?null:uu(s,r),c=await Nw(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 pu(t){let e=ee.resolve(t);return du({root:e,controlRoot:ee.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function mu(t){let e=ee.resolve(t);return du({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function hu(t,e,n=ee.join(e,"package.json")){V(t,n);let i=t.packageKind==="runtime"?"runtime":void 0,r=lu(t.definition,n),o=uu(t.guardrails,n),s=fu(t.evals,n,"evals"),a={allowedSkills:r.skills.map(c=>c.id),allowedAgents:r.agents.map(c=>c.id),allowedTools:r.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:r.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:ee.resolve(e),packageKind:i,definition:r,guardrails:{...a,...o},evals:s}}import gu from"path";function jw(t,e,n,i){t.type==="invoke_skill"&&!e.definition.skills.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&n.push(`step ${i} ask_user action requires question`)}function wu(t){let e=[],{definition:n,guardrails:i,evals:r}=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"),i.maxIterations<1&&e.push("maxIterations must be at least 1"),i.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),jw(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??[])r.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=gu.posix.normalize(s.source.replaceAll("\\","/"));(gu.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 i.allowedSkills)n.skills.some(a=>a.id===s)||e.push(`guardrails allow undeclared skill: ${s}`);for(let s of i.allowedAgents)n.agents.some(a=>a.id===s)||e.push(`guardrails allow undeclared agent: ${s}`);for(let s of i.allowedTools)n.tools.some(a=>a.id===s)||e.push(`guardrails allow undeclared tool: ${s}`);return e}function zi(t){return Array.isArray(t)?t.map(zi):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,zi(n)])):t}function Iw(t){return zi({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function qw(t){return I.posix.normalize(t.replaceAll("\\","/"))}function Ct(t,e,n){let i=I.relative(t,e);if(!(i===""||!I.isAbsolute(i)&&!i.startsWith(`..${I.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function vu(t,e,n){let i=qw(e);if(I.posix.isAbsolute(i)||i===".."||i.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let r=I.resolve(t,...i.split("/"));Ct(t,r,n);let o;try{o=await L.realpath(r)}catch(s){throw s.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:s}):s}if(Ct(t,o,n),!(await L.stat(o)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:i,content:await L.readFile(o)}}async function $w(t){let e=await L.realpath(t.root),n=t.packageKind==="runtime"?[]:[await vu(e,"SKILL.md","SKILL.md")];for(let i of t.definition.tools)i.kind==="script"&&n.push(await vu(e,i.source,`Script tool ${i.id}`));return n.sort((i,r)=>i.path.localeCompare(r.path))}function Lw(t,e){let n=e.map(i=>({path:i.path,sha256:yu("sha256").update(i.content).digest("hex")}));return yu("sha256").update(JSON.stringify(zi({package:t,files:n}))).digest("hex")}function Su(t){return JSON.stringify(t,null,2)+`
148
- `}async function Cu(t){let e=Iw(t),n=await $w(t);return{document:e,files:n,hash:Lw(e,n)}}async function Qi(t){return(await Cu(t)).hash}async function ku(t){try{return await L.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function bu(t,e){try{if((await L.readFile(I.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await L.readFile(I.join(t,"package.json"),"utf8")!==Su(e.document))throw new Error("package mismatch");for(let r of e.files)if(!(await L.readFile(I.join(t,...r.path.split("/")))).equals(r.content))throw new Error(`file mismatch: ${r.path}`)}catch(n){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:n})}}async function hs(t,e){let n=await Cu(t),i=I.resolve(e,".comet","skill-snapshots"),r=I.join(i,n.hash);if(await L.mkdir(i,{recursive:!0}),await ku(r))return await bu(r,n),{hash:n.hash,snapshotDir:r};let o=I.join(i,`.tmp-${Tw()}`);Ct(i,o,"Temporary snapshot"),Ct(i,r,"Published snapshot");try{await L.mkdir(o);for(let s of n.files){let a=I.join(o,...s.path.split("/"));Ct(o,a,`Snapshot file ${s.path}`),await L.mkdir(I.dirname(a),{recursive:!0}),await L.writeFile(a,s.content)}await L.writeFile(I.join(o,"package.json"),Su(n.document)),await L.writeFile(I.join(o,"sha256"),n.hash+`
149
- `),await L.rename(o,r)}catch(s){if(await ku(r)){try{await bu(r,n)}finally{await L.rm(o,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:r}}throw await L.rm(o,{recursive:!0,force:!0}),s}return{hash:n.hash,snapshotDir:r}}async function gs(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=I.resolve(t,".comet","skill-snapshots"),i=I.join(n,e);Ct(n,i,"Skill snapshot");try{let r=(await L.readFile(I.join(i,"sha256"),"utf8")).trim();if(r!==e)throw new Error(`stored hash is ${r||"(empty)"}`);let o=I.join(i,"package.json"),s=JSON.parse(await L.readFile(o,"utf8")),a=hu(s,i,o),c=wu(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
150
- `));let l=await Qi(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(r){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:r})}}async function Eu(t){try{return await ws.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function _u(t){return Dw("sha256").update(t).digest("hex")}function Fw(t){return _u(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function Mw(t){return t.replaceAll(".","_").replaceAll("-","_")}async function Bw(t,e){let n=await et(t),i=Object.fromEntries(e.filter(s=>s.satisfied&&s.source).map(s=>[Mw(s.code),s.source])),r=be.join(t,"subagent-progress.md");await Eu(r)&&(i.subagent_progress=be.relative(n,r).split(be.sep).join("/"));let o=e.find(s=>s.code==="design.handoff"&&s.satisfied);return o?.source&&(i.handoff_context=o.source),i}function Kw(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:tt,profile:e,source:"pre-migration"}}]}async function Uw(t){await Promise.all(t.map(e=>ws.rm(e,{recursive:!0,force:!0})))}async function xu(t,e){let n=await Me(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let i=n.classic,r=i.classicProfile??i.workflow;if(n.run){if(i.classicMigration!==tt)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 Qi(e.skillPackage)!==n.run.skillHash)return await gs(t,n.run.skillHash),{classic:i,run:n.run,evidence:await kt(t,n),migrated:!1,snapshotDir:be.join(t,".comet","skill-snapshots",n.run.skillHash)};let d=await hs(e.skillPackage,t);return{classic:i,run:n.run,evidence:await kt(t,n),migrated:!1,snapshotDir:d.snapshotDir}}let o=await kt(t,n),s=Ii(i,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 Qi(e.skillPackage),c=be.join(t,".comet","skill-snapshots",a),l=await Eu(c),f=[];try{let u=await hs(e.skillPackage,t),d=eu(e.skillPackage,e.runId?.()??Ww(),u.hash);d.currentStep=s,s==="completed"&&(d.status="completed");let h={...i,classicProfile:r,classicMigration:tt},w=await Bw(t,o),p=await et(t),m=o.find(S=>S.code==="design.handoff"&&S.satisfied),y=null;m?.source&&(y=await vt(p,m.resolvedSource??m.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await Ji(t,d.contextRef,y),f.push(be.resolve(t,d.contextRef))),await Yi(t,d.artifactsRef,w),f.push(be.resolve(t,d.artifactsRef));let g=(e.now?.()??new Date).toISOString(),b={runId:d.runId,stateVersion:1,trajectoryOffset:2,contextHash:y===null?null:_u(y),artifactsHash:Fw(w),createdAt:g};await Vi(t,d.checkpointRef,b),f.push(be.resolve(t,d.checkpointRef)),f.push(be.resolve(t,d.trajectoryRef));for(let S of Kw(d,r,g))await St(t,d.trajectoryRef,S);return await nt(t,{classic:h,run:d,unknownKeys:n.unknownKeys}),{classic:h,run:d,evidence:o,migrated:!0,snapshotDir:u.snapshotDir}}catch(u){throw await Uw(f),l||await ws.rm(c,{recursive:!0,force:!0}),u}}async function Hw(t){try{return(await Pu.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Xi(t){try{return(await Pu.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Yw(t){return await Hw(t)?await Xi(G.join(t,"skill.yaml"))?!0:await Xi(G.join(t,"SKILL.md"))&&await Xi(G.join(t,"comet","skill.yaml")):!1}function Jw(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 Vw(){let t=G.dirname(Ru(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,G.resolve(t,"..","runtime","classic"),G.resolve(t,"..","..","comet","runtime","classic"),G.resolve(t,"..","..","assets","skills","comet","runtime","classic"),G.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,G.resolve(t,"..","..","comet-classic"),G.resolve(t,"..","..","assets","skills","comet-classic"),G.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await Yw(n))return n;return null}async function Gw(t){return await Xi(G.join(t,"skill.yaml"))?mu(t):pu(t)}async function Au(t){let e=await Vw();return xu(t,{skillPackage:e?await Gw(e):Jw(G.dirname(Ru(import.meta.url)))})}async function Ou(t,e,n,i){let r=await Me(t);if(!r.classic||!r.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let o=await kt(t,{classic:e,run:n,unknownKeys:r.unknownKeys}),s=Ii(e,o),a={...n,currentStep:s,iteration:n.iteration+1,status:s==="completed"?"completed":"running"};await nt(t,{classic:e,run:a,unknownKeys:r.unknownKeys});let c=await vn(t,a.trajectoryRef);return await St(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,...i}}),a}import{AsyncLocalStorage as zw}from"async_hooks";import{promises as Nu}from"fs";import kn from"path";var ys=new zw;function Qw(t,e){let n=kn.relative(t,e);return n===""||!kn.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${kn.sep}`)}async function Xw(t){let e=kn.resolve(t.invocationCwd??process.cwd()),n=kn.resolve(t.projectRoot??await et(e)),[i,r]=await Promise.all([Nu.realpath(e),Nu.realpath(n)]);if(!Qw(r,i))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n}}async function Zw(t,e){let n=ys.getStore();if(n)return e(n);let i=await Xw(t);return ys.run(i,()=>e(i))}function ju(){let t=ys.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function Tu(t){return(e,n)=>Zw(n,()=>t(e,n))}var ey="\x1B[32m",ty="\x1B[31m",ny="\x1B[33m",ks="\x1B[0m";function Ue(t){return`${ey}${t}${ks}`}function z(t){return`${ty}${t}${ks}`}function Iu(t){return`${ny}${t}${ks}`}var B=class extends Error{constructor(n,i=1){super(n);this.exitCode=i}exitCode},vs=class{stdout=[];stderr=[];toResult(e=0){return{exitCode:e,...this.stdout.length>0?{stdout:this.stdout.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=wi(e),i=ht(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=wi(e),i=ht(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(i=>i.type==="newline"||i.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())}}};ol.Parser=$o});var ul=v(rn=>{"use strict";var sl=So(),dh=Vt(),nn=Qt(),ph=vr(),mh=x(),hh=Io(),al=qo();function cl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new hh.LineCounter||null,prettyErrors:e}}function gh(t,e={}){let{lineCounter:n,prettyErrors:i}=cl(e),r=new al.Parser(n?.addNewLine),o=new sl.Composer(e),s=Array.from(o.compose(r.parse(t)));if(i&&n)for(let a of s)a.errors.forEach(nn.prettifyError(t,n)),a.warnings.forEach(nn.prettifyError(t,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function ll(t,e={}){let{lineCounter:n,prettyErrors:i}=cl(e),r=new al.Parser(n?.addNewLine),o=new sl.Composer(e),s=null;for(let a of o.compose(r.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new nn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(s.errors.forEach(nn.prettifyError(t,n)),s.warnings.forEach(nn.prettifyError(t,n))),s}function wh(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=ll(t,n);if(!r)return null;if(r.warnings.forEach(o=>ph.warn(r.options.logLevel,o)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function yh(t,e,n){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=n??e??{};if(!r)return}return mh.isDocument(t)&&!i?t.toString(n):new dh.Document(t,i,n).toString(n)}rn.parse=wh;rn.parseAllDocuments=gh;rn.parseDocument=ll;rn.stringify=yh});var gt=v(P=>{"use strict";var vh=So(),kh=Vt(),bh=to(),Lo=Qt(),Sh=jt(),je=x(),Ch=Pe(),Eh=T(),_h=Oe(),xh=Ae(),Ph=hi(),Rh=jo(),Oh=Io(),Ah=qo(),vi=ul(),fl=Rt();P.Composer=vh.Composer;P.Document=kh.Document;P.Schema=bh.Schema;P.YAMLError=Lo.YAMLError;P.YAMLParseError=Lo.YAMLParseError;P.YAMLWarning=Lo.YAMLWarning;P.Alias=Sh.Alias;P.isAlias=je.isAlias;P.isCollection=je.isCollection;P.isDocument=je.isDocument;P.isMap=je.isMap;P.isNode=je.isNode;P.isPair=je.isPair;P.isScalar=je.isScalar;P.isSeq=je.isSeq;P.Pair=Ch.Pair;P.Scalar=Eh.Scalar;P.YAMLMap=_h.YAMLMap;P.YAMLSeq=xh.YAMLSeq;P.CST=Ph;P.Lexer=Rh.Lexer;P.LineCounter=Oh.LineCounter;P.Parser=Ah.Parser;P.parse=vi.parse;P.parseAllDocuments=vi.parseAllDocuments;P.parseDocument=vi.parseDocument;P.stringify=vi.stringify;P.visit=fl.visit;P.visitAsync=fl.visitAsync});import Te from"path";function Dh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||Te.posix.isAbsolute(n)||Te.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let i=n.replaceAll("\\","/").split("/");if(i.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(i.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return i}function ki(t){let e=Dh(t,"native.artifact_root");return e.length===0?".":e.join("/")}function gl(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 we(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim().replaceAll("\\","/");if(i.length===0||Te.posix.isAbsolute(i)||Te.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be relative to its declared path base`);let r=i.split("/");if(r.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(i))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function ge(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function wl(t,e,n){let i=t??e;if(i!=="en"&&i!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return i}function yl(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>Fo)throw new Error(`${e} exceeds ${Fo} characters`);let n=0;for(let i=0;i<t.length;i+=1)t[i]==="?"?n+=1:t[i]==="*"&&(n+=1,t[i+1]==="*"&&(i+=1));if(n>Mo)throw new Error(`${e} contains more than ${Mo} wildcard tokens`);return t}function hl(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(i=>yl(i,e)))].sort((i,r)=>i.localeCompare(r,"en"))}function Do(t,e,n){let i=t??e;if(!Number.isSafeInteger(i)||i<1)throw new Error(`${n} must be a positive integer`);return i}function Fh(t){if(t===void 0)return{...he,include:[...he.include],exclude:[...he.exclude]};let e=ge(t,"native.snapshot");return{include:hl(e.include,"native.snapshot.include",he.include),exclude:hl(e.exclude,"native.snapshot.exclude",he.exclude),max_files:Do(e.max_files,he.max_files,"native.snapshot.max_files"),max_total_bytes:Do(e.max_total_bytes,he.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Do(e.max_duration_ms,he.max_duration_ms,"native.snapshot.max_duration_ms")}}function Mh(t){if(t===void 0)return;let e=ge(t,"native.pending_root_move"),n=e.id,i=e.from_artifact_root,r=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 i!="string"||typeof r!="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=ge(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:ki(i),toArtifactRoot:ki(r),stage:o,...s?{cleanup:s}:{}}}function Bh(t){if(t===void 0)return;let e=ge(t,"native.finish");if(e.pull_request===void 0)return{};let n=ge(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 i=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(Te.posix.isAbsolute(i[0])||Te.win32.isAbsolute(i[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let r=n.timeout_ms??$h;if(!Number.isSafeInteger(r)||r<1||r>ml)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${ml}`);return{pull_request:{provider:"repository-command",command:i,timeout_ms:r}}}function Kh(t,e={}){let n=ge(t,"native"),i=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let r=n.clarification_mode??"batch";if(r!=="sequential"&&r!=="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??Th;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=Mh(n.pending_root_move),c=Bh(n.finish);return{artifact_root:ki(i),language:wl(n.language,"en","native.language"),clarification_mode:r,archive_confirmation:o,max_verify_failures:s,snapshot:Fh(n.snapshot),...c?{finish:c}:{},...a?{pending_root_move:a}:{}}}function Uh(t){let e=ge(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let i=e.review_mode??"standard";if(i!=="off"&&i!=="standard"&&i!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:gl(e.artifact_layout),language:wl(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:i,auto_transition:r}}function Hh(t){let n=ge(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((i,r)=>we(i,`hook.allow_paths[${r}]`)))]}}function Yh(t){if(t===void 0)return{...Wo};let e=ge(t,"memory"),n=e.learning??Wo.learning,i=e.retrieval??Wo.retrieval;if(typeof n!="boolean")throw new Error("memory.learning must be true or false");if(typeof i!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:n,retrieval:i}}function Ko(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Jh(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")||Te.posix.isAbsolute(n)||Te.win32.isAbsolute(n)||n.startsWith("~")||n.split("/").some(r=>r===""||r==="."||r===".."))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>dl)throw new Error(`${e} exceeds ${dl} characters`);let i=0;for(let r=0;r<n.length;r+=1)n[r]==="?"?i+=1:n[r]==="*"&&(i+=1,n[r+1]==="*"&&(r+=1));if(i>pl)throw new Error(`${e} contains more than ${pl} wildcard tokens`);return n}function Vh(t){let n=Ko(t,"knowledge.local").include??[];if(!Array.isArray(n))throw new Error("knowledge.local.include must be an array");return{include:[...new Set(n.map((i,r)=>Jh(i,`knowledge.local.include[${r}]`)))]}}function Gh(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,""),i=n==="localhost"||n==="127.0.0.1"||n==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&i))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function zh(t){let e=Ko(t,"knowledge.remote"),n=Gh(e.endpoint),i=e.token_env;if(i!==void 0&&(typeof i!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(i)))throw new Error("knowledge.remote.token_env must be an environment variable name");let r=e.scope;if(r!==void 0&&(typeof r!="string"||r.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,...i===void 0?{}:{token_env:i},...r===void 0?{}:{scope:r},timeout_ms:o}}function Qh(t){if(t===void 0)return{...Ih};let e=Ko(t,"knowledge"),n=e.provider??"local";if(n!=="local"&&n!=="remote")throw new Error("knowledge.provider must be local or remote");let i=e.local===void 0?void 0:Vh(e.local);if(n==="local")return{provider:n,...i?{local:i}:{}};let r=e.remote===void 0?void 0:zh(e.remote);if(r===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:n,...i?{local:i}:{},remote:r}}function Xh(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Zh(t,e,n,i,r,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")&&!r)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:i,...r?{native:r}:{},...o?{classic:o}:{}}}function wt(t,e={}){let n=(0,Bo.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let i=n.toJS();if(i==null)return{value:{},config:null,ambient_resume:!0};if(typeof i!="object"||Array.isArray(i))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let r=i,o=Xh(r.ambient_resume),s=r.hook===void 0?void 0:Hh(r.hook),a=Yh(r.memory),c=Qh(r.knowledge),l=r.native===void 0?void 0:Kh(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),f=r.classic===void 0?void 0:Uh(r.classic),u=Zh(r,s,a,c,l,f,o,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:u,ambient_resume:o,memory:a,knowledge:c,...s?{hook:s}:{},...l?{native:l}:{},...f?{classic:f}:{}}}var Bo,sn,Fo,Mo,dl,pl,Th,Wo,Ih,$h,ml,qh,Lh,Wh,he,ye=$(()=>{"use strict";Bo=Pt(gt(),1),sn=64*1024,Fo=1024,Mo=64,dl=1024,pl=64,Th=5,Wo={learning:!0,retrieval:!0},Ih={provider:"local"},$h=12e4,ml=6e5,qh=[".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/**"],Lh=["**/.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"],Wh=[...qh,...Lh].sort((t,e)=>t.localeCompare(e,"en")),he={include:["**/*"],exclude:[...Wh],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});function Ie(t){return t!==0&&t!==0n&&t!=="0"}function vl(t,e){return Ie(t.dev)&&Ie(e.dev)&&Ie(t.ino)&&Ie(e.ino)}function $e(t,e){let n=Ie(t.dev)&&Ie(e.dev);if(n&&t.dev!==e.dev)return!1;let i=Ie(t.ino)&&Ie(e.ino);return i&&t.ino!==e.ino?!1:n&&i?!0:t.birthtime===e.birthtime}var bi=$(()=>{"use strict"});import{constants as Si,promises as Ze}from"fs";function Uo(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function kl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function an(t){return{dev:t.dev,ino:t.ino,birthtime:Uo(t)}}function Ci(t,e){let n=an(t),i=an(e);return vl(n,i)?$e(n,i):$e(n,i)&&Uo(t)===Uo(e)&&kl(t)===kl(e)&&t.size===e.size}async function bl(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let i=n.label??"file",r=n.bigint===!0,o=await Ze.lstat(t,{bigint:r});if(!o.isFile()||o.isSymbolicLink())throw new qe("not-regular-file",`${i} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new qe("too-large",`${i} exceeds ${e} bytes`);let s=await Ze.realpath(t);await n.verify?.("pre-open",{realPath:s,identity:an(o)});let a=process.platform==="win32"?Si.O_RDONLY:Si.O_RDONLY|Si.O_NOFOLLOW|Si.O_NONBLOCK,c;try{c=await Ze.open(t,a)}catch(l){throw l.code==="ELOOP"?new qe("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,f,u]=await Promise.all([c.stat({bigint:r}),Ze.lstat(t,{bigint:r}),Ze.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==s||!Ci(o,l)||!Ci(o,f))throw new qe("changed",`${i} changed while opening`);await n.verify?.("post-open",{realPath:u,identity:an(l)}),await n.hooks?.afterOpen?.();let d=[],h=0,w=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let g=e+1-h,{bytesRead:b}=await c.read(w,0,Math.min(w.length,g),null);if(b===0)break;if(h+=b,h>e)throw new qe("too-large",`${i} exceeds ${e} bytes`);d.push(Buffer.from(w.subarray(0,b)))}await n.hooks?.beforeFinalCheck?.();let[p,m,y]=await Promise.all([c.stat({bigint:r}),Ze.lstat(t,{bigint:r}),Ze.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||y!==s||!Ci(o,p)||!Ci(o,m))throw new qe("changed",`${i} changed while reading`);return await n.verify?.("post-read",{realPath:y,identity:an(p)}),{bytes:Buffer.concat(d,h),stat:p,realPath:y}}finally{await c.close()}}var qe,Sl=$(()=>{"use strict";bi();qe=class extends Error{reason;constructor(e,n,i){super(n,i),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Le}from"fs";import ie from"path";function Cl(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Ei(t,e){let n=ie.relative(t,e);return n===""||!ie.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${ie.sep}`)}async function Ho(t,e){let n=ie.resolve(t),i=await Le.lstat(n);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Le.realpath(n)}async function Yo(t,e,n,i){let r=t;for(let o=0;o<n.length;o++){r=ie.join(r,n[o]);let s;try{s=await Le.lstat(r)}catch(f){if(Cl(f))return{exists:!1,kind:"missing"};throw f}let a=ie.relative(t,r).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${a}`);let c=o===n.length-1;if(!c&&!s.isDirectory())throw new Error(`${i.label} ancestor ${a} must be a real directory`);if(c&&(i.expected==="file"&&!s.isFile()||i.expected==="directory"&&!s.isDirectory()||i.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${i.label} must be a real ${i.expected}`);let l=await Le.realpath(r);if(!Ei(e,l))throw new Error(`${i.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 O(t,e,n){let i=we(e,n.label),r=ie.resolve(t),o=await Ho(r,n.label),s=i.split("/"),a=ie.resolve(r,...s);if(!Ei(r,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Yo(r,o,s,n);return{projectRoot:r,target:a,relative:i,exists:c.exists,kind:c.kind}}async function Jo(t,e,n){let i=we(e,n.label),r=ie.resolve(t),o=await Ho(r,n.label),s=i.split("/"),a=r;for(let c of s){a=ie.join(a,c);let l;try{l=await Le.lstat(a)}catch(d){if(!Cl(d))throw d;try{await Le.mkdir(a)}catch(h){if(h.code!=="EEXIST")throw h}l=await Le.lstat(a)}let f=ie.relative(r,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 Le.realpath(a);if(!Ei(o,u))throw new Error(`${n.label} resolves outside the project root`)}return await Yo(r,o,s,{label:n.label,expected:"directory"}),a}async function _i(t,e,n){return(await O(t,e,{...n,expected:"file"})).exists}async function D(t,e,n,i){let r=await O(t,e,{label:i.label,expected:"file"});if(!r.exists){let s=new Error(`${i.label} does not exist`);throw s.code="ENOENT",s}let o=await Ho(r.projectRoot,i.label);return bl(r.target,n,{...i,verify:async(s,a)=>{if(!Ei(o,a.realPath))throw new Error(`${i.label} resolves outside the project root`);await Yo(r.projectRoot,o,r.relative.split("/"),{label:i.label,expected:"file"})}})}var X=$(()=>{"use strict";Sl();ye()});import{createHash as eg}from"crypto";function tg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ln(t,e={}){return(await xi(t,e)).document}async function ng(t){try{return(await D(t,cn,sn,{label:cn})).bytes}catch(e){if(tg(e))return null;throw e}}function ig(t){return t?{exists:!0,sha256:eg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function xi(t,e={}){let n=await ng(t);return{document:n?wt(n.toString("utf8"),e):null,identity:ig(n)}}async function Vo(t){return(await ln(t))?.config??null}var cn,yt=$(()=>{"use strict";ye();X();cn=".comet/config.yaml"});import{randomUUID as rg}from"crypto";import{constants as og,promises as A}from"fs";import F from"path";async function Go(t,e){try{return await A.link(t,e),{linked:!0}}catch(n){let i=n.code;if(i!=="ENOTSUP"&&i!=="EOPNOTSUPP")throw n}return await A.copyFile(t,e,og.COPYFILE_EXCL),{linked:!1}}function et(t,e){let n=F.relative(t,e);return n===""||!F.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${F.sep}`)}function Pi(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function sg(t,e){return $e(t,Pi(e))}function Ri(t,e){return $e(Pi(t),Pi(e))}function El(t,e){return Ri(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Oi(t){let e=await A.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 A.realpath(t),...Pi(e)}}async function ve(t){for(let e of t){let n=await A.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!sg(e,n)||await A.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function ag(t,e,n){let[i,r]=await Promise.all([A.lstat(t),A.realpath(t),ve(n)]);if(!i.isFile()||i.isSymbolicLink()||!Ri(i,e)||!et(n[0].realPath,r))throw new Error("Contained atomic write temporary file changed after close");return i}async function cg(t,e){let n=F.resolve(t),i=F.resolve(e);if(!et(n,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await Oi(n)],o=F.relative(n,i).split(F.sep).filter(Boolean),s=n;for(let a of o){await ve(r),s=F.join(s,a);try{await A.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Oi(s);if(!et(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);r.push(c)}return await ve(r),r}async function lg(t,e){let n=F.resolve(t),i=F.resolve(e);if(!et(n,i))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await Oi(n)],o=F.relative(n,i).split(F.sep).filter(Boolean),s=n;for(let a of o){s=F.join(s,a);try{let c=await Oi(s);if(!et(r[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);r.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await ve(r),r}async function _l(t){let e;try{e=await A.open(t,"r"),await e.sync()}catch(n){let i=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(i??""))throw n}finally{await e?.close()}}async function ug(t,e,n){let i=F.dirname(t),r=await cg(n.containedRoot,i),o=F.join(i,`.${F.basename(t)}.${rg()}.tmp`),s,a,c;try{await n.beforeTemporaryOpen?.(),s=await A.open(o,"wx"),a=await s.stat();let[l,f]=await Promise.all([A.lstat(o),A.realpath(o)]);if(await ve(r),!l.isFile()||l.isSymbolicLink()||!Ri(a,l)||!et(r[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(),!Ri(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 ag(o,c,r),await n.beforeCommit?.(),await ve(r);let u=await A.lstat(o);if(!u.isFile()||u.isSymbolicLink()||!c||!El(u,c))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await Go(o,t),await A.unlink(o)):await A.rename(o,t),await _l(i)}catch(l){await s?.close();try{await ve(r),await A.rm(o,{force:!0})}catch{}throw l}}async function Z(t,e,n){await ug(t,e,n)}async function zo(t,e){let n=F.dirname(t),i=await lg(e.containedRoot,n);if(!i)return!1;let r,o;try{r=await A.lstat(t),o=await A.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!et(i[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await ve(i);let[s,a]=await Promise.all([A.lstat(t),A.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!El(r,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await A.unlink(t),await ve(i),await _l(n),!0}var We=$(()=>{"use strict";bi()});var lk,Qo=$(()=>{"use strict";We();yt();X();lk=16*1024});var Zo=$(()=>{"use strict";We();ye();yt();X();Qo()});var qi=$(()=>{"use strict"});var Wl=$(()=>{"use strict"});var rs=$(()=>{"use strict";qi()});var Dl=$(()=>{"use strict";qi();rs()});var Fg,Fl=$(()=>{"use strict";Fg=Pt(gt(),1);We();ye();X()});var cb,Ml=$(()=>{"use strict";We();X();cb=4*1024*1024});function Bg(t,e){let n=t;for(let i of e)n+="\0"+(typeof i=="string"?i:JSON.stringify(i));return n}function Bl(t,e){return(...n)=>{let i=Mg;if(i===null)return e(...n);let r=Bg(`async:${t}`,n),o=i.entries.get(r);if(o)return o.value;let s=e(...n).catch(a=>{throw i.entries.delete(r),a});return i.entries.set(r,{value:s}),s}}var Mg,Kl=$(()=>{"use strict";Mg=null});var pb,Ul=$(()=>{"use strict";Kl();yt();pb=Bl("hookWritePolicy",async t=>(await Vo(t))?.hook??{allow_paths:[]})});var Hl=$(()=>{"use strict";qi();We();Wl();Dl();ye();Fl();X();yt();Zo();Ml();Ul();Qo();rs()});import{TextDecoder as Kg}from"util";function Yl(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Ug(t,e){try{return new Kg("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function os(t,e,n,i,r={}){try{let o=await D(t,e,n,{label:i,hooks:r.hooks});return{result:o,text:Ug(o,i)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function be(t,e,n,i,r={}){return(await os(t,e,n,i,r))?.text??null}async function Fe(t,e,n,i,r,o={}){if(Buffer.byteLength(n,"utf8")>i)throw new Error(`${r} exceeds ${i} bytes`);let s=await os(t,e,i,r),a=await O(t,e,{label:r,expected:"file"});await Z(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await os(t,e,i,r);if(!(!s&&!c)){if(!s||!c)throw new Error(`${r} changed before commit`);if(s.result.realPath!==c.result.realPath||!$e(Yl(s.result.stat),Yl(c.result.stat))||s.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function Jl(t,e,n,i,r,o={}){let s=await be(t,e,i,r);await Fe(t,e,`${s??""}${n}`,i,r,o)}async function Li(t,e,n,i={}){let r=await O(t,e,{label:n,expected:"file"});return r.exists?zo(r.target,{containedRoot:r.projectRoot,beforeRemove:i.beforeRemove}):!1}var ss=$(()=>{"use strict";Hl();bi()});var zl={};tf(zl,{RUN_STATE_FILE:()=>Di,applyRunStateToDocument:()=>as,readRunState:()=>cs,removeRunState:()=>ls,runStateFromDocument:()=>Wi,writeRunState:()=>Fi});import Hg from"path";function wn(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 gn(t,e){let n=wn(t,e);if(Hg.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 Yg(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(i){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:i})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let i of Object.values(n))if(!Number.isInteger(i)||Number(i)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function Wi(t){if(!t.run_id)return null;let e=wn(t,"run_id"),n=wn(t,"skill"),i=wn(t,"skill_version"),r=wn(t,"skill_hash"),o=gn(t,"pending_ref"),s=gn(t,"trajectory_ref"),a=gn(t,"context_ref"),c=gn(t,"artifacts_ref"),l=gn(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:i,skillHash:r,orchestration:t.orchestration,currentStep:Vl(t,"current_step"),iteration:f,pending:Vl(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Yg(t)}}function as(t,e){e?t.run_id=e.runId:delete t.run_id}function Jg(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 Vg(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 Wi(e)}async function cs(t,e={}){let n=await be(t,Di,Gl,"Run state",e);if(n===null)return null;let i=JSON.parse(n);return Vg(i)}async function Fi(t,e,n={}){await Fe(t,Di,JSON.stringify(Jg(e),null,2),Gl,"Run state",n)}async function ls(t,e={}){await Li(t,Di,"Run state",e)}var Vl,Di,Gl,Mi=$(()=>{"use strict";ss();Vl=(t,e)=>{let n=t[e];return n==null?null:String(n)};Di=".comet/run-state.json",Gl=256*1024});var Ku=Pt(gt(),1);import{createHash as Fu}from"crypto";import{promises as Mu}from"fs";import Bu from"path";import Il from"path";import{promises as Ol}from"fs";import N from"path";import{promises as Nh}from"fs";async function on(t){try{return await Nh.access(t),!0}catch(e){if(jh(e))return!1;throw e}}function jh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ye();yt();Zo();X();var un=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},Rl=".comet/config.yaml";function Al(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Nl(t){await O(t,Rl,{label:Rl,expected:"file"})}function Ai(t,e){let n=N.resolve(t),i=e==="docs"?N.join(n,"docs"):n,r=N.join(i,"openspec"),o=N.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:i,openSpecRoot:r,changesDir:N.join(r,"changes"),archiveDir:N.join(r,"changes","archive"),specsDir:N.join(r,"specs"),superpowersRoot:o,superpowersSpecsDir:N.join(o,"specs"),superpowersPlansDir:N.join(o,"plans"),superpowersReportsDir:N.join(o,"reports")}}async function hg(t){await Nl(t);let e=await ln(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new un;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new un("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function gg(t,e){return Ai(t,e??await hg(t))}async function wg(t){try{return await Ol.lstat(t),!0}catch(e){if(Al(e))return!1;throw e}}async function yg(t,e){let n=await gg(t,e),i=n.artifactLayout==="legacy"?"docs":"legacy",r=Ai(t,i).openSpecRoot,[o,s]=await Promise.all([O(n.projectRoot,M(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),wg(r)]),a=o.exists;return{paths:n,configuredRootExists:a,alternateRoot:r,alternateRootExists:s,dualRoots:a&&s}}async function vg(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 i=M(t.projectRoot,n);await O(t.projectRoot,i,{label:`Classic managed physical path ${i}`,expected:"directory"})}}async function De(t,e){let n=await yg(t,e);if(await vg(n.paths),!n.configuredRootExists){let i=M(n.paths.projectRoot,n.paths.openSpecRoot),r=M(n.paths.projectRoot,n.alternateRoot);throw new un(`Configured Classic OpenSpec root is missing: ${i} (alternate ${r} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function es(t,e){let n=N.join(N.resolve(t),".comet","classic-root-move.json");if(await on(n))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let i=await De(t,e);if(!await on(i.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${M(i.projectRoot,i.openSpecRoot)}`);return i}async function tt(t){let e=N.resolve(t),n=null;try{(await Ol.lstat(e)).isDirectory()||(e=N.dirname(e))}catch(i){if(!Al(i))throw i}for(;;){N.basename(e)==="openspec"&&(n=N.dirname(e));let i=N.join(e,".comet","config.yaml"),r=!1;if(await on(i))try{await Nl(e);let s=(await ln(e))?.value;r=!!s&&typeof s=="object"&&!Array.isArray(s)&&(s.schema==="comet.project.v1"||s.default_workflow!==void 0||s.native!==void 0)}catch{}if(r||await on(N.join(e,".git")))return e;let o=N.dirname(e);if(o===e)return n??N.resolve(t);e=o}}function M(t,e){return N.relative(N.resolve(t),e).replaceAll("\\","/")}We();ye();X();import fn from"path";var kg=2*1024*1024;function Ni(t,e,n){let i=fn.resolve(t),r=fn.isAbsolute(e)?fn.resolve(e):fn.resolve(i,e),o=fn.relative(i,r).replaceAll("\\","/");return{root:i,relative:we(o,n),target:r}}async function le(t,e,n){let i=Ni(t,e,n.label);return O(i.root,i.relative,n)}async function ji(t,e,n){return(await le(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function ts(t,e,n,i){return await ji(t,e,{label:n,expected:"file"})?(await jl(t,e,{label:n,hooks:i})).byteLength>0:!1}async function vt(t,e,n){return(await jl(t,e,n)).toString("utf8")}async function jl(t,e,n){let i=Ni(t,e,n.label);return(await D(i.root,i.relative,n.maxBytes??kg,{label:n.label,hooks:n.hooks})).bytes}async function Ti(t,e,n){let i=Ni(t,e,n);return Jo(i.root,i.relative,{label:n})}async function Tl(t,e,n,i){let r=Ni(t,e,i.label);await O(r.root,r.relative,{label:i.label,expected:"file"}),await Z(r.target,n,{containedRoot:r.root,beforeTemporaryOpen:i.beforeTemporaryOpen,beforeCommit:i.beforeCommit,exclusive:i.exclusive})}function ns(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 is(t){let e=ns(t);if(e)throw new Error(e)}function bg(t,e){return{label:M(t,e),directory:e}}async function Sg(t,e,n){let i=bg(t,e);if(!(await le(t,e,{label:n,expected:"directory"})).exists)return{change:i,exists:!1,stateExists:!1};let o=await le(t,Il.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:i,exists:!0,stateExists:o.exists}}async function $l(t,e=process.cwd()){is(t);let n=await De(e),i=await Sg(n.projectRoot,Il.join(n.changesDir,t),`Classic active change ${t}`);return{...i.change,exists:i.exists,stateExists:i.stateExists}}import{promises as Ou}from"fs";import G from"path";import{fileURLToPath as Au}from"url";import{promises as Eg}from"fs";import ke from"path";X();ye();import dn from"path";function Cg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ql(t,e,n,i){let r=we(n,"Classic handoff artifact pointer");if((await O(t,r,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let s=await De(t),a=`${M(t,s.changesDir)}/`,l=(s.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(g=>r.startsWith(g));if(!l)return null;let f=r.slice(l.length).split("/");if(f.length<4||f[1]!==".comet"||f.slice(2).some(g=>g.length===0))return null;let u=f[0];is(u);let d=f.slice(2),h=dn.resolve(e);if(dn.dirname(h)!==dn.resolve(s.archiveDir))return null;let w=dn.basename(h),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(w);if(w!==u&&p?.[1]!==u)return null;await O(t,M(t,h),{label:"Classic archived change directory",expected:"directory"});let m=dn.join(h,".comet",...d),y=M(t,m);try{return await D(t,y,i,{label:"Historical Classic archived handoff artifact"}),y}catch(g){if(Cg(g))return null;throw g}}X();var Ll=2*1024*1024;function pn(t,e){return ke.relative(t,e).split(ke.sep).join("/")}async function mn(t,e,n,i,r){if(!n)return{code:e,satisfied:!1};let o=n.replaceAll("\\","/");if(r)return{code:e,satisfied:!1,source:o,detail:`Classic layout is unsafe or unavailable: ${r instanceof Error?r.message:String(r)}`};try{if(i){let a=i.artifactLayout==="legacy"?"docs":"legacy",c=M(t,Ai(t,a).openSpecRoot);if((o===c||o.startsWith(`${c}/`))&&(await O(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 _i(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 _g(t,e,n,i){try{i??=await De(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 r=await mn(t,"design.handoff",n,i);if(!n||r.satisfied||r.detail)return r;try{let o=await ql(t,e,n,Ll);return o?{...r,satisfied:!0,resolvedSource:o,detail:`resolved historical legacy pointer from archived change: ${o}`}:r}catch(o){return{...r,satisfied:!1,detail:`unsafe archived handoff fallback: ${o instanceof Error?o.message:String(o)}`}}}async function Ii(t,e,n){return mn(t,e,pn(t,n))}async function xg(t,e){let n=ke.join(e,"specs"),i;try{let s=pn(t,n);if(!(await O(t,s,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};i=await Eg.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 r=i.map(s=>ke.join(n,s,"spec.md")),o=(await Promise.all(r.map(async s=>{try{return await _i(t,pn(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]?pn(t,o[0]):void 0,detail:`${o.length} delta spec${o.length===1?"":"s"}`}}async function Pg(t,e){let n,i=pn(t,e);try{n=(await D(t,i,Ll,{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:i,detail:`unsafe tasks artifact: ${s instanceof Error?s.message:String(s)}`}}let r=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],o=r.filter(s=>s[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:r.length>0&&o===r.length,source:i,detail:`${o} of ${r.length} tasks complete`}}function hn(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function kt(t,e){let n=await tt(t),i=e.classic,r=ke.join(t,"proposal.md"),o=ke.join(t,"design.md"),s=ke.join(t,"tasks.md"),a=e.run?ke.resolve(t,e.run.checkpointRef):ke.join(t,".comet","checkpoint.json"),c,l;try{c=await De(n)}catch(d){l=d}let f=await Promise.all([Ii(n,"openspec.proposal",r),Ii(n,"openspec.design",o),Ii(n,"openspec.tasks",s),xg(n,t),mn(n,"design.document",i?.designDoc??null,c,l),mn(n,"build.plan",i?.plan??null,c,l),Pg(n,s),mn(n,"verification.report",i?.verificationReport??null,c,l),_g(n,t,i?.handoffContext??null,c),Ii(n,"run.checkpoint",a)]),u=f.find(d=>d.code==="design.handoff");return u&&!i?.handoffHash&&(u.satisfied=!1,u.detail="handoff hash is missing"),f.push({code:"archive.confirmed",satisfied:i?.archiveConfirmation==="confirmed"}),f}import{createHash as Mw,randomUUID as Bw}from"crypto";import{promises as ys}from"fs";import Se from"path";function Rg(t){return t.classicProfile??t.workflow}function Og(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 Ag(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function Ng(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!hn(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!Og(e))return"full.build.configure"}else if(!Ag(e))throw new Error(`${t} build configuration is incomplete`);return hn(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function jg(t,e,n){return e.verifyResult!=="pass"||!hn(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Tg(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 $i(t,e){let n=Rg(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 hn(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return Ng(n,t,e);case"verify":return jg(n,t,e);case"archive":return Tg(n,t)}}var Hi=Pt(gt(),1);We();X();import Ui from"path";Mi();var Ql=["full","hotfix","tweak"],nt=1,Gg=["open","design","build","verify","archive"],zg=["en","zh-CN"],Qg=["off","beta"],Xg=["subagent-driven-development","executing-plans","direct"],Zg=["plan-ready"],ew=["confirmed"],tw=["tdd","direct"],nw=["off","standard","thorough"],iw=["current","branch","worktree"],rw=["light","full"],ow=["pending","pass","fail"],sw=["pending","handled"],aw=["pending","confirmed"],Ki=["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"],cw=["run_id"],lw=new Set([...Ki,...cw]),uw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Xl(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function bt(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 K(t,e,n,i=!0){let r=t[e];if(r==null||r===""){if(i)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="string"||!n.includes(r))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${i?" or null":""}`);return r}function us(t,e,n=!0){let i=t[e];if(i==null||i===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return i}function fw(t,e,n=0){let i=t[e];if(i==null||i==="")return n;if(typeof i!="number"||!Number.isInteger(i)||i<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return i}function Bi(t,e){let n=bt(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 dw(t,e){let n=bt(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 pw(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 mw(t){if(!Ki.some(n=>Xl(t,n)))return null;for(let n of uw)if(!Xl(t,n))return null;return{workflow:K(t,"workflow",Ql,!1),language:K(t,"language",zg),phase:K(t,"phase",Gg,!1),contextCompression:K(t,"context_compression",Qg),buildMode:K(t,"build_mode",Xg),buildPause:K(t,"build_pause",Zg),subagentDispatch:K(t,"subagent_dispatch",ew),tddMode:K(t,"tdd_mode",tw),reviewMode:K(t,"review_mode",nw),isolation:K(t,"isolation",iw),boundBranch:bt(t,"bound_branch"),verifyMode:K(t,"verify_mode",rw),autoTransition:us(t,"auto_transition"),baseRef:bt(t,"base_ref"),designDoc:Bi(t,"design_doc"),plan:Bi(t,"plan"),verifyResult:K(t,"verify_result",ow,!1),verifyFailures:fw(t,"verify_failures"),verificationReport:Bi(t,"verification_report"),branchStatus:K(t,"branch_status",sw),createdAt:bt(t,"created_at"),verifiedAt:bt(t,"verified_at"),archiveConfirmation:K(t,"archive_confirmation",aw),archived:us(t,"archived",!1),directOverride:us(t,"direct_override"),handoffContext:Bi(t,"handoff_context"),handoffHash:dw(t,"handoff_hash"),classicProfile:K(t,"classic_profile",Ql),classicMigration:pw(t)}}function fs(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=Wi(t)}catch(i){let r=i instanceof Error?i.message:String(i);throw new Error(r.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:i})}return{classic:mw(t),run:n,unknownKeys:Object.keys(t).filter(i=>!lw.has(i))}}function Zl(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}}Mi();var hw=2*1024*1024;function yn(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 eu(t,e,n){t.get(e)!==n&&t.set(e,n)}function gw(t,e){if(e.classic)for(let[n,i]of Object.entries(Zl(e.classic)))eu(t,n,i);else for(let n of Ki)t.delete(n);as(t.toJS(),e.run),e.run?eu(t,"run_id",e.run.runId):t.delete("run_id")}function ww(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 yw(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function tu(t){let e;try{e=(await D(Ui.dirname(t),Ui.basename(t),hw,{label:"Classic state document"})).bytes.toString("utf8")}catch(i){if(i.code!=="ENOENT")throw i;return new Hi.Document({})}let n=(0,Hi.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return yn(n),n}async function Me(t,e={}){let n=e.migrate!==!1,i=Ui.join(t,".comet.yaml"),r=await tu(i),o=yn(r),s=yw(r);s&&(o=yn(r));let a=await cs(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Mi(),zl));a=c(o),a&&n&&(await Fi(t,a),ww(r),s=!0)}return s&&n&&await Z(i,r.toString(),{containedRoot:t}),fs(yn(r),a)}async function it(t,e,n={}){let i=Ui.join(t,".comet.yaml"),r=await tu(i);gw(r,{...e,unknownKeys:e.unknownKeys??[]}),fs(yn(r),e.run??null),await Z(i,r.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await Fi(t,e.run):await ls(t)}function nu(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:{}}}ss();import Yi from"path";var ue={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function re(t,e){if(Yi.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Yi.resolve(t),i=Yi.resolve(n,e);if(i!==n&&!i.startsWith(n+Yi.sep))throw new Error("Run path must stay inside the change directory")}async function St(t,e,n,i={}){re(t,e),await Jl(t,e,`${JSON.stringify(n)}
144
+ `,ue.trajectory,"Run trajectory",i)}async function vn(t,e,n={}){re(t,e);let i=await be(t,e,ue.trajectory,"Run trajectory",n);return i===null?[]:i.split(/\r?\n/).map((r,o)=>({line:r,number:o+1})).filter(({line:r})=>r.length>0).map(({line:r,number:o})=>{try{return JSON.parse(r)}catch(s){throw new Error(`Invalid Trajectory event at line ${o}`,{cause:s})}})}async function ds(t,e,n={}){re(t,e);let i=await be(t,e,ue.artifacts,"Run artifacts",n);return i===null?{}:JSON.parse(i)}async function Ji(t,e,n,i={}){re(t,e),await Fe(t,e,JSON.stringify(n,null,2)+`
145
+ `,ue.artifacts,"Run artifacts",i)}async function Vi(t,e,n,i={}){re(t,e),await Fe(t,e,n,ue.context,"Run context",i)}async function iu(t,e,n={}){return re(t,e),be(t,e,ue.context,"Run context",n)}async function ru(t,e,n,i={}){re(t,e),await Fe(t,e,JSON.stringify(n,null,2)+`
146
+ `,ue.pendingAction,"Run pending action",i)}async function ps(t,e,n={}){re(t,e);let i=await be(t,e,ue.pendingAction,"Run pending action",n);return i===null?null:JSON.parse(i)}async function ou(t,e,n={}){re(t,e),await Li(t,e,"Run pending action",n)}async function Gi(t,e,n,i={}){re(t,e),await Fe(t,e,JSON.stringify(n,null,2)+`
147
+ `,ue.checkpoint,"Run checkpoint",i)}async function su(t,e,n={}){re(t,e);let i=await be(t,e,ue.checkpoint,"Run checkpoint",n);return i===null?null:JSON.parse(i)}import{createHash as ku,randomUUID as qw}from"crypto";import{promises as L}from"fs";import I from"path";var lu=Pt(gt(),1);import{promises as ms}from"fs";import ee from"path";var vw=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],kw=["deterministic","adaptive"],bw=["function","mcp","script","agent"],Sw=["none","read","write","external"],Cw=["progress","step","completion"],Ew=["artifact_exists","state_equals"];function rt(t,e,n){return new Error(`${t}: ${e} ${n}`)}function V(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw rt(e,n,"must be an object")}function Be(t,e,n){if(!Array.isArray(t))throw rt(e,n,"must be an array")}function U(t,e,n){if(typeof t!="string")throw rt(e,n,"must be a string")}function oe(t,e,n,i){e in t&&U(t[e],n,`${i}.${e}`)}function uu(t,e,n,i){if(e in t&&typeof t[e]!="boolean")throw rt(n,`${i}.${e}`,"must be a boolean")}function Ke(t,e,n,i){if(typeof t!="string"||!e.includes(t))throw rt(n,i,`must be one of ${e.join(", ")}`)}function zi(t,e,n){Be(t,e,n),t.forEach((i,r)=>{U(i,e,`${n}[${r}]`)})}function au(t,e,n){V(t,e,n),U(t.name,e,`${n}.name`),U(t.description,e,`${n}.description`),uu(t,"required",e,n)}function _w(t,e,n){V(t,e,n),U(t.id,e,`${n}.id`),oe(t,"source",e,n),oe(t,"version",e,n)}function xw(t,e,n){V(t,e,n),U(t.id,e,`${n}.id`),U(t.role,e,`${n}.role`),oe(t,"instructions",e,n)}function Pw(t,e,n){V(t,e,n),U(t.id,e,`${n}.id`),Ke(t.kind,bw,e,`${n}.kind`),U(t.source,e,`${n}.source`),Ke(t.sideEffect,Sw,e,`${n}.sideEffect`),uu(t,"requiresConfirmation",e,n)}function Rw(t,e,n){V(t,e,n),Ke(t.type,vw,e,`${n}.type`),oe(t,"ref",e,n),oe(t,"prompt",e,n),oe(t,"question",e,n),"options"in t&&zi(t.options,e,`${n}.options`)}function Ow(t,e,n){V(t,e,n),U(t.id,e,`${n}.id`),Rw(t.action,e,`${n}.action`),oe(t,"next",e,n),"completionEvals"in t&&zi(t.completionEvals,e,`${n}.completionEvals`)}function Aw(t,e){let n="goal";V(t,e,n),U(t.statement,e,`${n}.statement`),Be(t.inputs,e,`${n}.inputs`),t.inputs.forEach((i,r)=>{au(i,e,`${n}.inputs[${r}]`)}),Be(t.outputs,e,`${n}.outputs`),t.outputs.forEach((i,r)=>{au(i,e,`${n}.outputs[${r}]`)}),zi(t.success,e,`${n}.success`)}function Nw(t,e){let n="orchestration";V(t,e,n),Ke(t.mode,kw,e,`${n}.mode`),oe(t,"entry",e,n),"steps"in t&&(Be(t.steps,e,`${n}.steps`),t.steps.forEach((i,r)=>{Ow(i,e,`${n}.steps[${r}]`)}))}function fu(t,e){return V(t,e),Ke(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ke(t.kind,["Skill"],e,"kind"),V(t.metadata,e,"metadata"),U(t.metadata.name,e,"metadata.name"),U(t.metadata.version,e,"metadata.version"),U(t.metadata.description,e,"metadata.description"),Aw(t.goal,e),Nw(t.orchestration,e),Be(t.skills,e,"skills"),t.skills.forEach((n,i)=>{_w(n,e,`skills[${i}]`)}),Be(t.agents,e,"agents"),t.agents.forEach((n,i)=>{xw(n,e,`agents[${i}]`)}),Be(t.tools,e,"tools"),t.tools.forEach((n,i)=>{Pw(n,e,`tools[${i}]`)}),t}function du(t,e){V(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&zi(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw rt(e,n,"must be a finite number");return t}function jw(t,e){return V(t,e),"runtime"in t&&pu(t.runtime,e,"runtime"),t}function pu(t,e,n){return Be(t,e,n),t.forEach((i,r)=>{let o=`${n}[${r}]`;V(i,e,o),U(i.id,e,`${o}.id`),Ke(i.scope,Cw,e,`${o}.scope`),Ke(i.type,Ew,e,`${o}.type`),oe(i,"artifact",e,o),oe(i,"field",e,o),oe(i,"equals",e,o)}),t}async function hs(t){let e=await ms.readFile(t,"utf8");try{return(0,lu.parse)(e)}catch(n){let i=n instanceof Error?n.message:String(n);throw rt(t,"document",i)}}async function Tw(t){try{return await hs(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function cu(t){try{return await ms.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Iw(t){let e=ee.join(t,"checks.yaml"),n=ee.join(t,"evals.yaml"),[i,r]=await Promise.all([cu(e),cu(n)]);if(r)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return i?{document:jw(await hs(e),e)}:{document:null}}async function mu(t){let e=ee.resolve(t.root),n=ee.resolve(t.controlRoot);t.requireSkillMarkdown&&await ms.access(ee.join(e,"SKILL.md"));let i=ee.join(n,"skill.yaml"),r=ee.join(n,"guardrails.yaml"),o=fu(await hs(i),i),s=await Tw(r),a=s===null?null:du(s,r),c=await Iw(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 hu(t){let e=ee.resolve(t);return mu({root:e,controlRoot:ee.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function gu(t){let e=ee.resolve(t);return mu({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function wu(t,e,n=ee.join(e,"package.json")){V(t,n);let i=t.packageKind==="runtime"?"runtime":void 0,r=fu(t.definition,n),o=du(t.guardrails,n),s=pu(t.evals,n,"evals"),a={allowedSkills:r.skills.map(c=>c.id),allowedAgents:r.agents.map(c=>c.id),allowedTools:r.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:r.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:ee.resolve(e),packageKind:i,definition:r,guardrails:{...a,...o},evals:s}}import yu from"path";function $w(t,e,n,i){t.type==="invoke_skill"&&!e.definition.skills.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&n.push(`step ${i} ask_user action requires question`)}function vu(t){let e=[],{definition:n,guardrails:i,evals:r}=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"),i.maxIterations<1&&e.push("maxIterations must be at least 1"),i.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),$w(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??[])r.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=yu.posix.normalize(s.source.replaceAll("\\","/"));(yu.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 i.allowedSkills)n.skills.some(a=>a.id===s)||e.push(`guardrails allow undeclared skill: ${s}`);for(let s of i.allowedAgents)n.agents.some(a=>a.id===s)||e.push(`guardrails allow undeclared agent: ${s}`);for(let s of i.allowedTools)n.tools.some(a=>a.id===s)||e.push(`guardrails allow undeclared tool: ${s}`);return e}function Qi(t){return Array.isArray(t)?t.map(Qi):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,Qi(n)])):t}function Lw(t){return Qi({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function Ww(t){return I.posix.normalize(t.replaceAll("\\","/"))}function Ct(t,e,n){let i=I.relative(t,e);if(!(i===""||!I.isAbsolute(i)&&!i.startsWith(`..${I.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function bu(t,e,n){let i=Ww(e);if(I.posix.isAbsolute(i)||i===".."||i.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let r=I.resolve(t,...i.split("/"));Ct(t,r,n);let o;try{o=await L.realpath(r)}catch(s){throw s.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:s}):s}if(Ct(t,o,n),!(await L.stat(o)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:i,content:await L.readFile(o)}}async function Dw(t){let e=await L.realpath(t.root),n=t.packageKind==="runtime"?[]:[await bu(e,"SKILL.md","SKILL.md")];for(let i of t.definition.tools)i.kind==="script"&&n.push(await bu(e,i.source,`Script tool ${i.id}`));return n.sort((i,r)=>i.path.localeCompare(r.path))}function Fw(t,e){let n=e.map(i=>({path:i.path,sha256:ku("sha256").update(i.content).digest("hex")}));return ku("sha256").update(JSON.stringify(Qi({package:t,files:n}))).digest("hex")}function Eu(t){return JSON.stringify(t,null,2)+`
148
+ `}async function _u(t){let e=Lw(t),n=await Dw(t);return{document:e,files:n,hash:Fw(e,n)}}async function Xi(t){return(await _u(t)).hash}async function Su(t){try{return await L.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Cu(t,e){try{if((await L.readFile(I.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await L.readFile(I.join(t,"package.json"),"utf8")!==Eu(e.document))throw new Error("package mismatch");for(let r of e.files)if(!(await L.readFile(I.join(t,...r.path.split("/")))).equals(r.content))throw new Error(`file mismatch: ${r.path}`)}catch(n){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:n})}}async function gs(t,e){let n=await _u(t),i=I.resolve(e,".comet","skill-snapshots"),r=I.join(i,n.hash);if(await L.mkdir(i,{recursive:!0}),await Su(r))return await Cu(r,n),{hash:n.hash,snapshotDir:r};let o=I.join(i,`.tmp-${qw()}`);Ct(i,o,"Temporary snapshot"),Ct(i,r,"Published snapshot");try{await L.mkdir(o);for(let s of n.files){let a=I.join(o,...s.path.split("/"));Ct(o,a,`Snapshot file ${s.path}`),await L.mkdir(I.dirname(a),{recursive:!0}),await L.writeFile(a,s.content)}await L.writeFile(I.join(o,"package.json"),Eu(n.document)),await L.writeFile(I.join(o,"sha256"),n.hash+`
149
+ `),await L.rename(o,r)}catch(s){if(await Su(r)){try{await Cu(r,n)}finally{await L.rm(o,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:r}}throw await L.rm(o,{recursive:!0,force:!0}),s}return{hash:n.hash,snapshotDir:r}}async function ws(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=I.resolve(t,".comet","skill-snapshots"),i=I.join(n,e);Ct(n,i,"Skill snapshot");try{let r=(await L.readFile(I.join(i,"sha256"),"utf8")).trim();if(r!==e)throw new Error(`stored hash is ${r||"(empty)"}`);let o=I.join(i,"package.json"),s=JSON.parse(await L.readFile(o,"utf8")),a=wu(s,i,o),c=vu(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
150
+ `));let l=await Xi(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(r){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:r})}}async function xu(t){try{return await ys.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function Pu(t){return Mw("sha256").update(t).digest("hex")}function Kw(t){return Pu(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function Uw(t){return t.replaceAll(".","_").replaceAll("-","_")}async function Hw(t,e){let n=await tt(t),i=Object.fromEntries(e.filter(s=>s.satisfied&&s.source).map(s=>[Uw(s.code),s.source])),r=Se.join(t,"subagent-progress.md");await xu(r)&&(i.subagent_progress=Se.relative(n,r).split(Se.sep).join("/"));let o=e.find(s=>s.code==="design.handoff"&&s.satisfied);return o?.source&&(i.handoff_context=o.source),i}function Yw(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 Jw(t){await Promise.all(t.map(e=>ys.rm(e,{recursive:!0,force:!0})))}async function Ru(t,e){let n=await Me(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let i=n.classic,r=i.classicProfile??i.workflow;if(n.run){if(i.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 Xi(e.skillPackage)!==n.run.skillHash)return await ws(t,n.run.skillHash),{classic:i,run:n.run,evidence:await kt(t,n),migrated:!1,snapshotDir:Se.join(t,".comet","skill-snapshots",n.run.skillHash)};let d=await gs(e.skillPackage,t);return{classic:i,run:n.run,evidence:await kt(t,n),migrated:!1,snapshotDir:d.snapshotDir}}let o=await kt(t,n),s=$i(i,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 Xi(e.skillPackage),c=Se.join(t,".comet","skill-snapshots",a),l=await xu(c),f=[];try{let u=await gs(e.skillPackage,t),d=nu(e.skillPackage,e.runId?.()??Bw(),u.hash);d.currentStep=s,s==="completed"&&(d.status="completed");let h={...i,classicProfile:r,classicMigration:nt},w=await Hw(t,o),p=await tt(t),m=o.find(S=>S.code==="design.handoff"&&S.satisfied),y=null;m?.source&&(y=await vt(p,m.resolvedSource??m.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await Vi(t,d.contextRef,y),f.push(Se.resolve(t,d.contextRef))),await Ji(t,d.artifactsRef,w),f.push(Se.resolve(t,d.artifactsRef));let g=(e.now?.()??new Date).toISOString(),b={runId:d.runId,stateVersion:1,trajectoryOffset:2,contextHash:y===null?null:Pu(y),artifactsHash:Kw(w),createdAt:g};await Gi(t,d.checkpointRef,b),f.push(Se.resolve(t,d.checkpointRef)),f.push(Se.resolve(t,d.trajectoryRef));for(let S of Yw(d,r,g))await St(t,d.trajectoryRef,S);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 Jw(f),l||await ys.rm(c,{recursive:!0,force:!0}),u}}async function Vw(t){try{return(await Ou.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Zi(t){try{return(await Ou.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Gw(t){return await Vw(t)?await Zi(G.join(t,"skill.yaml"))?!0:await Zi(G.join(t,"SKILL.md"))&&await Zi(G.join(t,"comet","skill.yaml")):!1}function zw(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 Qw(){let t=G.dirname(Au(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,G.resolve(t,"..","runtime","classic"),G.resolve(t,"..","..","comet","runtime","classic"),G.resolve(t,"..","..","assets","skills","comet","runtime","classic"),G.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,G.resolve(t,"..","..","comet-classic"),G.resolve(t,"..","..","assets","skills","comet-classic"),G.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await Gw(n))return n;return null}async function Xw(t){return await Zi(G.join(t,"skill.yaml"))?gu(t):hu(t)}async function Nu(t){let e=await Qw();return Ru(t,{skillPackage:e?await Xw(e):zw(G.dirname(Au(import.meta.url)))})}async function ju(t,e,n,i){let r=await Me(t);if(!r.classic||!r.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let o=await kt(t,{classic:e,run:n,unknownKeys:r.unknownKeys}),s=$i(e,o),a={...n,currentStep:s,iteration:n.iteration+1,status:s==="completed"?"completed":"running"};await it(t,{classic:e,run:a,unknownKeys:r.unknownKeys});let c=await vn(t,a.trajectoryRef);return await St(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,...i}}),a}import{AsyncLocalStorage as Zw}from"async_hooks";import{promises as Tu}from"fs";import kn from"path";var vs=new Zw;function ey(t,e){let n=kn.relative(t,e);return n===""||!kn.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${kn.sep}`)}async function ty(t){let e=kn.resolve(t.invocationCwd??process.cwd()),n=kn.resolve(t.projectRoot??await tt(e)),[i,r]=await Promise.all([Tu.realpath(e),Tu.realpath(n)]);if(!ey(r,i))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n}}async function ny(t,e){let n=vs.getStore();if(n)return e(n);let i=await ty(t);return vs.run(i,()=>e(i))}function Iu(){let t=vs.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function $u(t){return(e,n)=>ny(n,()=>t(e,n))}function ks(t){return t==="zh-CN"?"zh-CN":"en"}function iy(t,e,n){return t==="zh-CN"?n:e}function bs(t){let{name:e,locale:n}=t;return{summary:iy(n,`Handoff context for ${e} was written and recorded; the Build phase can resume from it.`,`需求 ${e} 的交接上下文已写入并记录,Build 阶段可据此继续。`)}}var ry="\x1B[32m",oy="\x1B[31m",sy="\x1B[33m",Cs="\x1B[0m";function Ue(t){return`${ry}${t}${Cs}`}function z(t){return`${oy}${t}${Cs}`}function qu(t){return`${sy}${t}${Cs}`}var B=class extends Error{constructor(n,i=1){super(n);this.exitCode=i}exitCode},Ss=class{stdout=[];stderr=[];envelope;toResult(e=0){return{exitCode:e,...this.stdout.length>0?{stdout:this.stdout.join(`
151
151
  `)+`
152
152
  `}:{},...this.stderr.length>0?{stderr:this.stderr.join(`
153
153
  `)+`
154
- `}:{}}}};async function fe(t,e,n){return await Ni(t,e,{label:n,expected:"file"})?vt(t,e,{label:n}):null}async function Zi(t,e,n,i){await Nl(t,e,n,{label:i})}function iy(t){let e=ts(t);if(e)throw new B(z(`ERROR: ${e}`))}function de(t){return Du("sha256").update(t).digest("hex")}function Bu(t){return de(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}async function _t(t,e){let n=[`${e}/proposal.md`,`${e}/design.md`,`${e}/tasks.md`],i=`${e}/specs`;if((await le(t,i,{label:"Classic handoff specs directory",expected:"directory"})).exists){let o=(await Wu.readdir(i,{withFileTypes:!0})).sort((s,a)=>s.name.localeCompare(a.name));for(let s of o){if(!s.isDirectory()&&!s.isSymbolicLink())continue;let a=`${i}/${s.name}/spec.md`;(await le(t,`${i}/${s.name}`,{label:`Classic handoff spec directory ${s.name}`,expected:"directory"})).exists&&await Ni(t,a,{label:`Classic handoff spec ${s.name}`,expected:"file"})&&n.push(a)}}return n}function Et(t,e,n){let i=Fu.relative(t,n).replaceAll("\\","/");return`${e}/${i}`}async function qu(t,e,n){let i=[];for(let r of await _t(t,e)){let o=Et(e,n,r),s=await fe(t,r,`Classic handoff source ${o}`);s!==null&&i.push(`path:${o}`,`sha256:${de(s)}`)}return Du("sha256").update(i.join(`
155
- `)).digest("hex")}function $u(t){return t.replace(/\\/gu,"\\\\").replace(/"/gu,'\\"')}function Ku(t){return(t.match(/\n/gu)??[]).length}function ry(t,e){let n=0;for(let i=0;i<t.length;i+=1)if(t[i]===`
156
- `&&(n+=1,n===e))return t.slice(0,i+1);return t}async function oy(t,e,n,i,r,o,s){let a=["# Comet Design Handoff","",`- Change: ${i}`,"- Phase: design",`- Mode: ${r}`,`- Context hash: ${o}`,"","Generated-by: comet-handoff.sh","","OpenSpec remains the canonical capability spec. This handoff is a deterministic, source-traceable context pack, not an agent-authored summary.",""];for(let c of await _t(t,e)){let l=Et(e,n,c),f=await fe(t,c,`Classic handoff source ${l}`);if(f===null)continue;let u=Ku(f);a.push(`## ${l}`,"",`- Source: ${l}`,`- Lines: 1-${u}`,`- SHA256: ${de(f)}`,""),r==="full"||u<=80?a.push("```md",f,"```"):a.push("[TRUNCATED]","","```md",ry(f,80),"```","",`Full source: ${l}`),a.push("")}await Zi(t,s,a.join(`
157
- `),"Classic handoff markdown output")}async function sy(t,e,n,i,r,o,s){let a=[];for(let f of await _t(t,e)){let u=Et(e,n,f),d=await fe(t,f,`Classic handoff source ${u}`);d!==null&&a.push(` { "path": "${$u(u)}", "sha256": "${de(d)}" }`)}let c=a.join(`,
158
- `),l=["{",` "change": "${$u(i)}",`,' "phase": "design",',` "mode": "${r}",`,' "canonical_spec": "openspec",',' "generated_by": "comet-handoff.sh",',` "context_hash": "${o}",`,' "files": [',c," ]","}",""].join(`
159
- `);await Zi(t,s,l,"Classic handoff JSON output")}async function ay(t,e){return[`## ${t}`,"",`- Source: ${t}`,`- Lines: 1-${Ku(e)}`,`- SHA256: ${de(e)}`,"","```md",e,"```",""]}async function cy(t,e,n,i,r,o){let s=["# Comet Spec Context","",`- Change: ${i}`,"- Phase: design","- Mode: beta",`- Context hash: ${r}`,"","Generated-by: comet-handoff.sh","","OpenSpec remains the canonical capability spec. This beta context pack verbatim-projects spec files and references supporting artifacts by hash, not an agent-authored summary.","","## Source References",""];for(let f of await _t(t,e)){let u=Et(e,n,f),d=await fe(t,f,`Classic handoff source ${u}`);d!==null&&s.push(`- Source: ${u}`,`- SHA256: ${de(d)}`)}s.push("","## Acceptance Projection","");let a=`${e}/specs`,c=!1;if((await le(t,a,{label:"Classic handoff specs directory",expected:"directory"})).exists){let f=(await Wu.readdir(a,{withFileTypes:!0})).sort((u,d)=>u.name.localeCompare(d.name));for(let u of f){if(!u.isDirectory()&&!u.isSymbolicLink())continue;let d=`${a}/${u.name}/spec.md`,h=await fe(t,d,`Classic handoff spec ${u.name}`);h!==null&&(c=!0,s.push(...await ay(Et(e,n,d),h)))}}c||s.push("No delta spec files found.",""),s.push("Full source files remain canonical. If a required heading or scenario is missing here, regenerate the handoff or read the source spec directly. Supporting files (proposal, design, tasks) are referenced by hash only."),await Zi(t,o,s.join(`
160
- `),"Classic handoff spec markdown output")}async function ly(t,e,n,i,r,o){let s=[];for(let a of await _t(t,e)){let c=Et(e,n,a),l=await fe(t,a,`Classic handoff source ${c}`);if(l===null)continue;let f=/\/specs\/[^/]+\/spec\.md$/u.test(c)?"spec":"supporting";s.push({path:c,sha256:de(l),role:f})}await Zi(t,o,`${JSON.stringify({change:i,phase:"design",mode:"beta",canonical_spec:"openspec",generated_by:"comet-handoff.sh",context_hash:r,files:s},null,2)}
161
- `,"Classic handoff spec JSON output")}async function Lu(t,e,n){let i=Fu.join(e,".comet.yaml"),r=(0,Mu.parseDocument)(await vt(t,i,{label:"Classic change state"}),{uniqueKeys:!1});if(r.errors.length>0)throw new B(`ERROR: Invalid .comet.yaml: ${r.errors[0].message}`);let s=r.toJS()[n];return s==null?"":typeof s=="object"?JSON.stringify(s):String(s)}async function uy(t,e,n){let i=await vn(t,e.trajectoryRef);i.some(o=>o.type==="recovery_reconciled"&&o.data.kind==="classic-handoff"&&o.data.actionId===n)||await St(t,e.trajectoryRef,{sequence:i.length+1,timestamp:new Date().toISOString(),type:"recovery_reconciled",runId:e.runId,data:{kind:"classic-handoff",actionId:n}})}async function fy(t,e,n,i){let r=await fe(t,n,"Classic handoff markdown output");if(r===null)return!1;let o=new Set(r.split(/\r?\n/u));if(!o.has(`- Context hash: ${i}`))return!1;for(let s of await _t(t,e)){let a=await fe(t,s,`Classic handoff source ${s}`);if(a!==null&&!o.has(`- SHA256: ${de(a)}`))return!1}return!0}async function dy(t,e,n,i,r,o,s,a){let[c,l,f]=await Promise.all([tu(e,n.contextRef),fs(e,n.artifactsRef),ru(e,n.checkpointRef)]),[u,d]=await Promise.all([fe(t,r,"Classic handoff JSON output"),fe(t,o,"Classic handoff markdown output")]);return u===null||d===null||c!==d||l.handoff_context!==s||l.handoff_markdown!==a?!1:f?.runId===n.runId&&f.contextHash===(c===null?null:de(c))&&f.artifactsHash===Bu(l)&&i.length===64}var Uu=Tu(async t=>{let e=new vs,[n,i,r,o]=t;try{iy(n);let s=await Zo(ju()),a=await Tl(n,s.projectRoot),c=a.directory,l=M(s.projectRoot,c);if(i==="--hash-only"){if(!a.exists)throw new B(z(`ERROR: change directory not found: ${l}`));for(let Ye of["proposal.md","design.md","tasks.md"])if(!await es(s.projectRoot,`${c}/${Ye}`,`Classic handoff source ${Ye}`))throw new B(z(`ERROR: required file missing or empty: ${l}/${Ye}`));return e.stdout.push(await qu(s.projectRoot,c,l)),e.toResult(0)}if(i!=="design"||r!=="--write")throw new B(z("Usage: comet-handoff.mjs <change-name> design --write [--full]"));let f;if(o===void 0||o==="")f="compact";else if(o==="--full")f="full";else throw new B(z("Usage: comet-handoff.mjs <change-name> design --write [--full]"));if(!a.exists)throw new B(z(`ERROR: change directory not found: ${l}`));if(!a.stateExists)throw new B(z(`ERROR: .comet.yaml not found at ${l}/.comet.yaml`));let u=await Lu(s.projectRoot,c,"phase");if(u!=="design"&&u!=="build")throw new B(z("ERROR: design handoff requires phase: design or build"));for(let Ye of["proposal.md","design.md","tasks.md"])if(!await es(s.projectRoot,`${c}/${Ye}`,`Classic handoff source ${Ye}`))throw new B(z(`ERROR: required OpenSpec artifact missing or empty: ${l}/${Ye}`));let d=`${c}/.comet/handoff`;await le(s.projectRoot,`${c}/.comet`,{label:"Classic change runtime directory",expected:"directory"}),await le(s.projectRoot,d,{label:"Classic handoff directory",expected:"directory"});let h=await Lu(s.projectRoot,c,"context_compression")||"off",w,p;if(h==="off")w=`${d}/design-context.json`,p=`${d}/design-context.md`;else if(h==="beta")f==="full"&&e.stderr.push(Iu("[HANDOFF] --full is ignored in beta mode; spec files are projected verbatim")),f="beta",w=`${d}/spec-context.json`,p=`${d}/spec-context.md`;else throw new B([z(`ERROR: invalid context_compression: ${h}`),z("Valid values: off, beta")].join(`
162
- `));let m=M(s.projectRoot,w),y=M(s.projectRoot,p),g=await qu(s.projectRoot,c,l),b=`classic-handoff:${g}`,S=await Me(c);if(!S.classic)throw new B(z("ERROR: design handoff requires Classic state"));let C=S.run?await ds(c,S.run.pendingRef):null,E=C?.id===b&&C.type==="handoff"&&C.ref===g;S.classic.handoffHash&&S.classic.handoffHash!==g&&!E&&e.stderr.push(Iu(`[HANDOFF] refreshing stale design handoff: previous hash ${S.classic.handoffHash}`)),await ji(s.projectRoot,`${c}/.comet`,"Classic change runtime directory"),await ji(s.projectRoot,d,"Classic handoff directory");let _=await Au(c),k=await ds(c,_.run.pendingRef),N=k?.id===b&&k.type==="handoff"&&k.ref===g;if(_.run.pending&&_.run.pending!==b)throw new B(z(`ERROR: another action is pending: ${_.run.pending}`));if(_.classic.handoffHash===g&&_.classic.handoffContext===m&&!_.run.pending&&!k&&await dy(s.projectRoot,c,_.run,g,w,p,m,y)&&await fy(s.projectRoot,c,p,g))return e.stderr.push(Ue(`[HANDOFF] wrote ${m}`)),e.stderr.push(Ue(`[HANDOFF] wrote ${y}`)),e.stderr.push(Ue(`[HANDOFF] handoff_hash=${g}`)),e.toResult(0);let se={id:b,stepId:_.run.currentStep,type:"handoff",ref:g};await nu(c,_.run.pendingRef,se);let H={..._.run,pending:b,status:"waiting"};await nt(c,{classic:_.classic,run:H,unknownKeys:(await Me(c)).unknownKeys}),f==="beta"?(await cy(s.projectRoot,c,l,n,g,p),await ly(s.projectRoot,c,l,n,g,w)):(await oy(s.projectRoot,c,l,n,f,g,p),await sy(s.projectRoot,c,l,n,f,g,w));let R=await vt(s.projectRoot,p,{label:"Classic handoff markdown output"});await Ji(c,H.contextRef,R);let xt={...await fs(c,H.artifactsRef),handoff_context:m,handoff_markdown:y};await Yi(c,H.artifactsRef,xt);let bs={..._.classic,handoffContext:m,handoffHash:g},He={...H.currentStep==="full.design.handoff"?await Ou(c,bs,H,{actionId:b,kind:"classic-handoff"}):H,pending:null,status:"running"};(E||N)&&await uy(c,He,b);let Yu=await vn(c,He.trajectoryRef),Ju={runId:He.runId,stateVersion:He.iteration,trajectoryOffset:Yu.length,contextHash:de(R),artifactsHash:Bu(xt),createdAt:new Date().toISOString()};return await Vi(c,He.checkpointRef,Ju),await nt(c,{classic:bs,run:He,unknownKeys:(await Me(c)).unknownKeys}),await iu(c,He.pendingRef),e.stderr.push(Ue(`[SET] handoff_context=${w}`)),e.stderr.push(Ue(`[SET] handoff_hash=${g}`)),e.stderr.push(Ue(`[HANDOFF] wrote ${m}`)),e.stderr.push(Ue(`[HANDOFF] wrote ${y}`)),e.stderr.push(Ue(`[HANDOFF] handoff_hash=${g}`)),e.toResult(0)}catch(s){if(s instanceof B){for(let a of s.message.split(`
163
- `))e.stderr.push(a);return e.toResult(s.exitCode)}throw s}});function py(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 Hu(t,e,n=process.argv.slice(2)){let i=n.includes("--json"),r=n.filter(a=>a!=="--json"),o;try{o=await e(r,{json:i})}catch(a){o={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let s=i?py(t,o):o;return s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr+(s.stderr.endsWith(`
154
+ `}:{},...this.envelope===void 0?{}:{envelope:this.envelope}}}};async function fe(t,e,n){return await ji(t,e,{label:n,expected:"file"})?vt(t,e,{label:n}):null}async function er(t,e,n,i){await Tl(t,e,n,{label:i})}function ay(t){let e=ns(t);if(e)throw new B(z(`ERROR: ${e}`))}function de(t){return Fu("sha256").update(t).digest("hex")}function Uu(t){return de(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}async function _t(t,e){let n=[`${e}/proposal.md`,`${e}/design.md`,`${e}/tasks.md`],i=`${e}/specs`;if((await le(t,i,{label:"Classic handoff specs directory",expected:"directory"})).exists){let o=(await Mu.readdir(i,{withFileTypes:!0})).sort((s,a)=>s.name.localeCompare(a.name));for(let s of o){if(!s.isDirectory()&&!s.isSymbolicLink())continue;let a=`${i}/${s.name}/spec.md`;(await le(t,`${i}/${s.name}`,{label:`Classic handoff spec directory ${s.name}`,expected:"directory"})).exists&&await ji(t,a,{label:`Classic handoff spec ${s.name}`,expected:"file"})&&n.push(a)}}return n}function Et(t,e,n){let i=Bu.relative(t,n).replaceAll("\\","/");return`${e}/${i}`}async function Lu(t,e,n){let i=[];for(let r of await _t(t,e)){let o=Et(e,n,r),s=await fe(t,r,`Classic handoff source ${o}`);s!==null&&i.push(`path:${o}`,`sha256:${de(s)}`)}return Fu("sha256").update(i.join(`
155
+ `)).digest("hex")}function Wu(t){return t.replace(/\\/gu,"\\\\").replace(/"/gu,'\\"')}function Hu(t){return(t.match(/\n/gu)??[]).length}function cy(t,e){let n=0;for(let i=0;i<t.length;i+=1)if(t[i]===`
156
+ `&&(n+=1,n===e))return t.slice(0,i+1);return t}async function ly(t,e,n,i,r,o,s){let a=["# Comet Design Handoff","",`- Change: ${i}`,"- Phase: design",`- Mode: ${r}`,`- Context hash: ${o}`,"","Generated-by: comet-handoff.sh","","OpenSpec remains the canonical capability spec. This handoff is a deterministic, source-traceable context pack, not an agent-authored summary.",""];for(let c of await _t(t,e)){let l=Et(e,n,c),f=await fe(t,c,`Classic handoff source ${l}`);if(f===null)continue;let u=Hu(f);a.push(`## ${l}`,"",`- Source: ${l}`,`- Lines: 1-${u}`,`- SHA256: ${de(f)}`,""),r==="full"||u<=80?a.push("```md",f,"```"):a.push("[TRUNCATED]","","```md",cy(f,80),"```","",`Full source: ${l}`),a.push("")}await er(t,s,a.join(`
157
+ `),"Classic handoff markdown output")}async function uy(t,e,n,i,r,o,s){let a=[];for(let f of await _t(t,e)){let u=Et(e,n,f),d=await fe(t,f,`Classic handoff source ${u}`);d!==null&&a.push(` { "path": "${Wu(u)}", "sha256": "${de(d)}" }`)}let c=a.join(`,
158
+ `),l=["{",` "change": "${Wu(i)}",`,' "phase": "design",',` "mode": "${r}",`,' "canonical_spec": "openspec",',' "generated_by": "comet-handoff.sh",',` "context_hash": "${o}",`,' "files": [',c," ]","}",""].join(`
159
+ `);await er(t,s,l,"Classic handoff JSON output")}async function fy(t,e){return[`## ${t}`,"",`- Source: ${t}`,`- Lines: 1-${Hu(e)}`,`- SHA256: ${de(e)}`,"","```md",e,"```",""]}async function dy(t,e,n,i,r,o){let s=["# Comet Spec Context","",`- Change: ${i}`,"- Phase: design","- Mode: beta",`- Context hash: ${r}`,"","Generated-by: comet-handoff.sh","","OpenSpec remains the canonical capability spec. This beta context pack verbatim-projects spec files and references supporting artifacts by hash, not an agent-authored summary.","","## Source References",""];for(let f of await _t(t,e)){let u=Et(e,n,f),d=await fe(t,f,`Classic handoff source ${u}`);d!==null&&s.push(`- Source: ${u}`,`- SHA256: ${de(d)}`)}s.push("","## Acceptance Projection","");let a=`${e}/specs`,c=!1;if((await le(t,a,{label:"Classic handoff specs directory",expected:"directory"})).exists){let f=(await Mu.readdir(a,{withFileTypes:!0})).sort((u,d)=>u.name.localeCompare(d.name));for(let u of f){if(!u.isDirectory()&&!u.isSymbolicLink())continue;let d=`${a}/${u.name}/spec.md`,h=await fe(t,d,`Classic handoff spec ${u.name}`);h!==null&&(c=!0,s.push(...await fy(Et(e,n,d),h)))}}c||s.push("No delta spec files found.",""),s.push("Full source files remain canonical. If a required heading or scenario is missing here, regenerate the handoff or read the source spec directly. Supporting files (proposal, design, tasks) are referenced by hash only."),await er(t,o,s.join(`
160
+ `),"Classic handoff spec markdown output")}async function py(t,e,n,i,r,o){let s=[];for(let a of await _t(t,e)){let c=Et(e,n,a),l=await fe(t,a,`Classic handoff source ${c}`);if(l===null)continue;let f=/\/specs\/[^/]+\/spec\.md$/u.test(c)?"spec":"supporting";s.push({path:c,sha256:de(l),role:f})}await er(t,o,`${JSON.stringify({change:i,phase:"design",mode:"beta",canonical_spec:"openspec",generated_by:"comet-handoff.sh",context_hash:r,files:s},null,2)}
161
+ `,"Classic handoff spec JSON output")}async function Du(t,e,n){let i=Bu.join(e,".comet.yaml"),r=(0,Ku.parseDocument)(await vt(t,i,{label:"Classic change state"}),{uniqueKeys:!1});if(r.errors.length>0)throw new B(`ERROR: Invalid .comet.yaml: ${r.errors[0].message}`);let s=r.toJS()[n];return s==null?"":typeof s=="object"?JSON.stringify(s):String(s)}async function my(t,e,n){let i=await vn(t,e.trajectoryRef);i.some(o=>o.type==="recovery_reconciled"&&o.data.kind==="classic-handoff"&&o.data.actionId===n)||await St(t,e.trajectoryRef,{sequence:i.length+1,timestamp:new Date().toISOString(),type:"recovery_reconciled",runId:e.runId,data:{kind:"classic-handoff",actionId:n}})}async function hy(t,e,n,i){let r=await fe(t,n,"Classic handoff markdown output");if(r===null)return!1;let o=new Set(r.split(/\r?\n/u));if(!o.has(`- Context hash: ${i}`))return!1;for(let s of await _t(t,e)){let a=await fe(t,s,`Classic handoff source ${s}`);if(a!==null&&!o.has(`- SHA256: ${de(a)}`))return!1}return!0}async function gy(t,e,n,i,r,o,s,a){let[c,l,f]=await Promise.all([iu(e,n.contextRef),ds(e,n.artifactsRef),su(e,n.checkpointRef)]),[u,d]=await Promise.all([fe(t,r,"Classic handoff JSON output"),fe(t,o,"Classic handoff markdown output")]);return u===null||d===null||c!==d||l.handoff_context!==s||l.handoff_markdown!==a?!1:f?.runId===n.runId&&f.contextHash===(c===null?null:de(c))&&f.artifactsHash===Uu(l)&&i.length===64}var Yu=$u(async t=>{let e=new Ss,[n,i,r,o]=t;try{ay(n);let s=await es(Iu()),a=await $l(n,s.projectRoot),c=a.directory,l=M(s.projectRoot,c);if(i==="--hash-only"){if(!a.exists)throw new B(z(`ERROR: change directory not found: ${l}`));for(let Ye of["proposal.md","design.md","tasks.md"])if(!await ts(s.projectRoot,`${c}/${Ye}`,`Classic handoff source ${Ye}`))throw new B(z(`ERROR: required file missing or empty: ${l}/${Ye}`));return e.stdout.push(await Lu(s.projectRoot,c,l)),e.toResult(0)}if(i!=="design"||r!=="--write")throw new B(z("Usage: comet-handoff.mjs <change-name> design --write [--full]"));let f;if(o===void 0||o==="")f="compact";else if(o==="--full")f="full";else throw new B(z("Usage: comet-handoff.mjs <change-name> design --write [--full]"));if(!a.exists)throw new B(z(`ERROR: change directory not found: ${l}`));if(!a.stateExists)throw new B(z(`ERROR: .comet.yaml not found at ${l}/.comet.yaml`));let u=await Du(s.projectRoot,c,"phase");if(u!=="design"&&u!=="build")throw new B(z("ERROR: design handoff requires phase: design or build"));for(let Ye of["proposal.md","design.md","tasks.md"])if(!await ts(s.projectRoot,`${c}/${Ye}`,`Classic handoff source ${Ye}`))throw new B(z(`ERROR: required OpenSpec artifact missing or empty: ${l}/${Ye}`));let d=`${c}/.comet/handoff`;await le(s.projectRoot,`${c}/.comet`,{label:"Classic change runtime directory",expected:"directory"}),await le(s.projectRoot,d,{label:"Classic handoff directory",expected:"directory"});let h=await Du(s.projectRoot,c,"context_compression")||"off",w,p;if(h==="off")w=`${d}/design-context.json`,p=`${d}/design-context.md`;else if(h==="beta")f==="full"&&e.stderr.push(qu("[HANDOFF] --full is ignored in beta mode; spec files are projected verbatim")),f="beta",w=`${d}/spec-context.json`,p=`${d}/spec-context.md`;else throw new B([z(`ERROR: invalid context_compression: ${h}`),z("Valid values: off, beta")].join(`
162
+ `));let m=M(s.projectRoot,w),y=M(s.projectRoot,p),g=await Lu(s.projectRoot,c,l),b=`classic-handoff:${g}`,S=await Me(c);if(!S.classic)throw new B(z("ERROR: design handoff requires Classic state"));let C=S.run?await ps(c,S.run.pendingRef):null,E=C?.id===b&&C.type==="handoff"&&C.ref===g;S.classic.handoffHash&&S.classic.handoffHash!==g&&!E&&e.stderr.push(qu(`[HANDOFF] refreshing stale design handoff: previous hash ${S.classic.handoffHash}`)),await Ti(s.projectRoot,`${c}/.comet`,"Classic change runtime directory"),await Ti(s.projectRoot,d,"Classic handoff directory");let _=await Nu(c),k=await ps(c,_.run.pendingRef),j=k?.id===b&&k.type==="handoff"&&k.ref===g;if(_.run.pending&&_.run.pending!==b)throw new B(z(`ERROR: another action is pending: ${_.run.pending}`));if(_.classic.handoffHash===g&&_.classic.handoffContext===m&&!_.run.pending&&!k&&await gy(s.projectRoot,c,_.run,g,w,p,m,y)&&await hy(s.projectRoot,c,p,g))return e.envelope=bs({name:n,locale:ks(_.classic.language)}),e.stderr.push(e.envelope.summary),e.stderr.push(Ue(`[HANDOFF] wrote ${m}`)),e.stderr.push(Ue(`[HANDOFF] wrote ${y}`)),e.stderr.push(Ue(`[HANDOFF] handoff_hash=${g}`)),e.toResult(0);let se={id:b,stepId:_.run.currentStep,type:"handoff",ref:g};await ru(c,_.run.pendingRef,se);let H={..._.run,pending:b,status:"waiting"};await it(c,{classic:_.classic,run:H,unknownKeys:(await Me(c)).unknownKeys}),f==="beta"?(await dy(s.projectRoot,c,l,n,g,p),await py(s.projectRoot,c,l,n,g,w)):(await ly(s.projectRoot,c,l,n,f,g,p),await uy(s.projectRoot,c,l,n,f,g,w));let R=await vt(s.projectRoot,p,{label:"Classic handoff markdown output"});await Vi(c,H.contextRef,R);let xt={...await ds(c,H.artifactsRef),handoff_context:m,handoff_markdown:y};await Ji(c,H.artifactsRef,xt);let tr={..._.classic,handoffContext:m,handoffHash:g},He={...H.currentStep==="full.design.handoff"?await ju(c,tr,H,{actionId:b,kind:"classic-handoff"}):H,pending:null,status:"running"};(E||j)&&await my(c,He,b);let Vu=await vn(c,He.trajectoryRef),Gu={runId:He.runId,stateVersion:He.iteration,trajectoryOffset:Vu.length,contextHash:de(R),artifactsHash:Uu(xt),createdAt:new Date().toISOString()};return await Gi(c,He.checkpointRef,Gu),await it(c,{classic:tr,run:He,unknownKeys:(await Me(c)).unknownKeys}),await ou(c,He.pendingRef),e.envelope=bs({name:n,locale:ks(tr.language)}),e.stderr.push(e.envelope.summary),e.stderr.push(Ue(`[SET] handoff_context=${w}`)),e.stderr.push(Ue(`[SET] handoff_hash=${g}`)),e.stderr.push(Ue(`[HANDOFF] wrote ${m}`)),e.stderr.push(Ue(`[HANDOFF] wrote ${y}`)),e.stderr.push(Ue(`[HANDOFF] handoff_hash=${g}`)),e.toResult(0)}catch(s){if(s instanceof B){for(let a of s.message.split(`
163
+ `))e.stderr.push(a);return e.toResult(s.exitCode)}throw s}});function wy(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 Ju(t,e,n=process.argv.slice(2)){let i=n.includes("--json"),r=n.filter(a=>a!=="--json"),o;try{o=await e(r,{json:i})}catch(a){o={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let s=i?wy(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 Hu("handoff",Uu);
166
+ `)),s.exitCode}process.exitCode=await Ju("handoff",Yu);