@rpamis/comet 0.4.0-beta.12 → 0.4.0-beta.13

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 (428) hide show
  1. package/assets/manifest.json +15 -1
  2. package/assets/skills/comet/SKILL.md +5 -11
  3. package/assets/skills/comet/reference/comet-yaml-fields.md +1 -1
  4. package/assets/skills/comet/reference/context-recovery.md +3 -3
  5. package/assets/skills/comet/reference/decision-point.md +4 -5
  6. package/assets/skills/comet/reference/scripts.md +17 -47
  7. package/assets/skills/comet/reference/subagent-dispatch.md +8 -8
  8. package/assets/skills/comet/rules/comet-phase-guard.en.md +2 -2
  9. package/assets/skills/comet/rules/comet-phase-guard.md +2 -2
  10. package/assets/skills/comet/scripts/comet-archive.mjs +165 -2
  11. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +146 -8071
  12. package/assets/skills/comet/scripts/comet-guard.mjs +207 -2
  13. package/assets/skills/comet/scripts/comet-handoff.mjs +165 -2
  14. package/assets/skills/comet/scripts/comet-hook-guard.mjs +151 -2
  15. package/assets/skills/comet/scripts/comet-hook-router.mjs +155 -12101
  16. package/assets/skills/comet/scripts/comet-intent.mjs +10 -2
  17. package/assets/skills/comet/scripts/comet-resume-probe.mjs +148 -2
  18. package/assets/skills/comet/scripts/comet-runtime.mjs +286 -19170
  19. package/assets/skills/comet/scripts/comet-state.mjs +164 -2
  20. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +149 -2
  21. package/assets/skills/comet-archive/SKILL.md +1 -1
  22. package/assets/skills/comet-build/SKILL.md +13 -14
  23. package/assets/skills/comet-classic/SKILL.md +9 -9
  24. package/assets/skills/comet-design/SKILL.md +4 -4
  25. package/assets/skills/comet-hotfix/SKILL.md +2 -2
  26. package/assets/skills/comet-native/SKILL.md +17 -2
  27. package/assets/skills/comet-native/reference/commands.md +12 -0
  28. package/assets/skills/comet-native/reference/recovery.md +2 -0
  29. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +178 -0
  30. package/assets/skills/comet-native/scripts/comet-native-check.mjs +173 -0
  31. package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +179 -0
  32. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +207 -0
  33. package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +151 -0
  34. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +150 -2
  35. package/assets/skills/comet-native/scripts/comet-native-init.mjs +171 -0
  36. package/assets/skills/comet-native/scripts/comet-native-new.mjs +200 -0
  37. package/assets/skills/comet-native/scripts/comet-native-next.mjs +182 -0
  38. package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +179 -0
  39. package/assets/skills/comet-native/scripts/comet-native-root.mjs +185 -0
  40. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +227 -31299
  41. package/assets/skills/comet-native/scripts/comet-native-select.mjs +178 -0
  42. package/assets/skills/comet-native/scripts/comet-native-show.mjs +151 -0
  43. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +181 -0
  44. package/assets/skills/comet-native/scripts/comet-native-status.mjs +175 -0
  45. package/assets/skills/comet-tweak/SKILL.md +2 -2
  46. package/assets/skills/comet-verify/SKILL.md +3 -3
  47. package/assets/skills-zh/comet/SKILL.md +5 -11
  48. package/assets/skills-zh/comet/reference/comet-yaml-fields.md +1 -1
  49. package/assets/skills-zh/comet/reference/context-recovery.md +3 -3
  50. package/assets/skills-zh/comet/reference/decision-point.md +4 -5
  51. package/assets/skills-zh/comet/reference/scripts.md +9 -39
  52. package/assets/skills-zh/comet/reference/subagent-dispatch.md +8 -8
  53. package/assets/skills-zh/comet-archive/SKILL.md +1 -1
  54. package/assets/skills-zh/comet-build/SKILL.md +13 -14
  55. package/assets/skills-zh/comet-classic/SKILL.md +7 -7
  56. package/assets/skills-zh/comet-design/SKILL.md +5 -5
  57. package/assets/skills-zh/comet-hotfix/SKILL.md +2 -2
  58. package/assets/skills-zh/comet-native/SKILL.md +17 -2
  59. package/assets/skills-zh/comet-native/reference/commands.md +12 -0
  60. package/assets/skills-zh/comet-native/reference/recovery.md +2 -0
  61. package/assets/skills-zh/comet-tweak/SKILL.md +2 -2
  62. package/assets/skills-zh/comet-verify/SKILL.md +3 -3
  63. package/bin/comet.js +5 -1
  64. package/bin/fast-runtime-router.js +82 -0
  65. package/dist/app/cli/index.js +57 -18
  66. package/dist/app/cli/index.js.map +1 -1
  67. package/dist/app/commands/dashboard.js +2 -2
  68. package/dist/app/commands/dashboard.js.map +1 -1
  69. package/dist/app/commands/i18n.d.ts +1 -1
  70. package/dist/app/commands/i18n.d.ts.map +1 -1
  71. package/dist/app/commands/i18n.js +10 -0
  72. package/dist/app/commands/i18n.js.map +1 -1
  73. package/dist/app/commands/init.d.ts.map +1 -1
  74. package/dist/app/commands/init.js +9 -5
  75. package/dist/app/commands/init.js.map +1 -1
  76. package/dist/app/commands/uninstall.d.ts.map +1 -1
  77. package/dist/app/commands/uninstall.js +150 -8
  78. package/dist/app/commands/uninstall.js.map +1 -1
  79. package/dist/app/commands/update.d.ts +1 -0
  80. package/dist/app/commands/update.d.ts.map +1 -1
  81. package/dist/app/commands/update.js +166 -24
  82. package/dist/app/commands/update.js.map +1 -1
  83. package/dist/config/repository-layout.json +33 -3
  84. package/dist/domains/comet-classic/classic-archive-entry.js +1 -1
  85. package/dist/domains/comet-classic/classic-archive-entry.js.map +1 -1
  86. package/dist/domains/comet-classic/classic-branch-binding.d.ts.map +1 -1
  87. package/dist/domains/comet-classic/classic-branch-binding.js +8 -2
  88. package/dist/domains/comet-classic/classic-branch-binding.js.map +1 -1
  89. package/dist/domains/comet-classic/classic-current-change.d.ts.map +1 -1
  90. package/dist/domains/comet-classic/classic-current-change.js +6 -1
  91. package/dist/domains/comet-classic/classic-current-change.js.map +1 -1
  92. package/dist/domains/comet-classic/classic-guard-entry.js +1 -1
  93. package/dist/domains/comet-classic/classic-guard-entry.js.map +1 -1
  94. package/dist/domains/comet-classic/classic-guard.js +1 -1
  95. package/dist/domains/comet-classic/classic-guard.js.map +1 -1
  96. package/dist/domains/comet-classic/classic-handoff-entry.js +1 -1
  97. package/dist/domains/comet-classic/classic-handoff-entry.js.map +1 -1
  98. package/dist/domains/comet-classic/classic-hook-guard-entry.js +1 -1
  99. package/dist/domains/comet-classic/classic-hook-guard-entry.js.map +1 -1
  100. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  101. package/dist/domains/comet-classic/classic-hook-guard.js +7 -4
  102. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  103. package/dist/domains/comet-classic/classic-intent-entry.js +1 -1
  104. package/dist/domains/comet-classic/classic-intent-entry.js.map +1 -1
  105. package/dist/domains/comet-classic/classic-layout-initialization.d.ts.map +1 -1
  106. package/dist/domains/comet-classic/classic-layout-initialization.js +18 -11
  107. package/dist/domains/comet-classic/classic-layout-initialization.js.map +1 -1
  108. package/dist/domains/comet-classic/classic-layout.d.ts +7 -4
  109. package/dist/domains/comet-classic/classic-layout.d.ts.map +1 -1
  110. package/dist/domains/comet-classic/classic-layout.js +9 -9
  111. package/dist/domains/comet-classic/classic-layout.js.map +1 -1
  112. package/dist/domains/comet-classic/classic-resume-probe-entry.js +1 -1
  113. package/dist/domains/comet-classic/classic-resume-probe-entry.js.map +1 -1
  114. package/dist/domains/comet-classic/classic-script-entry.d.ts +2 -2
  115. package/dist/domains/comet-classic/classic-script-entry.d.ts.map +1 -1
  116. package/dist/domains/comet-classic/classic-script-entry.js +4 -3
  117. package/dist/domains/comet-classic/classic-script-entry.js.map +1 -1
  118. package/dist/domains/comet-classic/classic-state-command.js +6 -6
  119. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  120. package/dist/domains/comet-classic/classic-state-entry.js +1 -1
  121. package/dist/domains/comet-classic/classic-state-entry.js.map +1 -1
  122. package/dist/domains/comet-classic/classic-validate-entry.js +1 -1
  123. package/dist/domains/comet-classic/classic-validate-entry.js.map +1 -1
  124. package/dist/domains/comet-entry/entry-reads.d.ts +17 -0
  125. package/dist/domains/comet-entry/entry-reads.d.ts.map +1 -0
  126. package/dist/domains/comet-entry/entry-reads.js +20 -0
  127. package/dist/domains/comet-entry/entry-reads.js.map +1 -0
  128. package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
  129. package/dist/domains/comet-entry/hook-router-entry.js +3 -1
  130. package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
  131. package/dist/domains/comet-entry/hook-router.d.ts.map +1 -1
  132. package/dist/domains/comet-entry/hook-router.js +8 -3
  133. package/dist/domains/comet-entry/hook-router.js.map +1 -1
  134. package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
  135. package/dist/domains/comet-entry/init-workflow.js +7 -8
  136. package/dist/domains/comet-entry/init-workflow.js.map +1 -1
  137. package/dist/domains/comet-entry/resolve-entry.d.ts.map +1 -1
  138. package/dist/domains/comet-entry/resolve-entry.js +3 -4
  139. package/dist/domains/comet-entry/resolve-entry.js.map +1 -1
  140. package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
  141. package/dist/domains/comet-entry/resume-probe.js +16 -5
  142. package/dist/domains/comet-entry/resume-probe.js.map +1 -1
  143. package/dist/domains/comet-native/native-archive-command.d.ts +3 -0
  144. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -0
  145. package/dist/domains/comet-native/native-archive-command.js +49 -0
  146. package/dist/domains/comet-native/native-archive-command.js.map +1 -0
  147. package/dist/domains/comet-native/native-archive-entry.d.ts +2 -0
  148. package/dist/domains/comet-native/native-archive-entry.d.ts.map +1 -0
  149. package/dist/domains/comet-native/native-archive-entry.js +4 -0
  150. package/dist/domains/comet-native/native-archive-entry.js.map +1 -0
  151. package/dist/domains/comet-native/native-check-command.d.ts +3 -0
  152. package/dist/domains/comet-native/native-check-command.d.ts.map +1 -0
  153. package/dist/domains/comet-native/native-check-command.js +30 -0
  154. package/dist/domains/comet-native/native-check-command.js.map +1 -0
  155. package/dist/domains/comet-native/native-check-entry.d.ts +2 -0
  156. package/dist/domains/comet-native/native-check-entry.d.ts.map +1 -0
  157. package/dist/domains/comet-native/native-check-entry.js +4 -0
  158. package/dist/domains/comet-native/native-check-entry.js.map +1 -0
  159. package/dist/domains/comet-native/native-checkpoint-command.d.ts +3 -0
  160. package/dist/domains/comet-native/native-checkpoint-command.d.ts.map +1 -0
  161. package/dist/domains/comet-native/native-checkpoint-command.js +39 -0
  162. package/dist/domains/comet-native/native-checkpoint-command.js.map +1 -0
  163. package/dist/domains/comet-native/native-checkpoint-entry.d.ts +2 -0
  164. package/dist/domains/comet-native/native-checkpoint-entry.d.ts.map +1 -0
  165. package/dist/domains/comet-native/native-checkpoint-entry.js +4 -0
  166. package/dist/domains/comet-native/native-checkpoint-entry.js.map +1 -0
  167. package/dist/domains/comet-native/native-cli-shared.d.ts +40 -0
  168. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -0
  169. package/dist/domains/comet-native/native-cli-shared.js +272 -0
  170. package/dist/domains/comet-native/native-cli-shared.js.map +1 -0
  171. package/dist/domains/comet-native/native-cli.d.ts +2 -5
  172. package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
  173. package/dist/domains/comet-native/native-cli.js +37 -785
  174. package/dist/domains/comet-native/native-cli.js.map +1 -1
  175. package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
  176. package/dist/domains/comet-native/native-continuation.js +16 -0
  177. package/dist/domains/comet-native/native-continuation.js.map +1 -1
  178. package/dist/domains/comet-native/native-doctor-command.d.ts +3 -0
  179. package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -0
  180. package/dist/domains/comet-native/native-doctor-command.js +29 -0
  181. package/dist/domains/comet-native/native-doctor-command.js.map +1 -0
  182. package/dist/domains/comet-native/native-doctor-entry.d.ts +2 -0
  183. package/dist/domains/comet-native/native-doctor-entry.d.ts.map +1 -0
  184. package/dist/domains/comet-native/native-doctor-entry.js +4 -0
  185. package/dist/domains/comet-native/native-doctor-entry.js.map +1 -0
  186. package/dist/domains/comet-native/native-evidence-command.d.ts +3 -0
  187. package/dist/domains/comet-native/native-evidence-command.d.ts.map +1 -0
  188. package/dist/domains/comet-native/native-evidence-command.js +35 -0
  189. package/dist/domains/comet-native/native-evidence-command.js.map +1 -0
  190. package/dist/domains/comet-native/native-evidence-entry.d.ts +2 -0
  191. package/dist/domains/comet-native/native-evidence-entry.d.ts.map +1 -0
  192. package/dist/domains/comet-native/native-evidence-entry.js +4 -0
  193. package/dist/domains/comet-native/native-evidence-entry.js.map +1 -0
  194. package/dist/domains/comet-native/native-evidence-storage.d.ts +17 -6
  195. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  196. package/dist/domains/comet-native/native-evidence-storage.js +89 -23
  197. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  198. package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
  199. package/dist/domains/comet-native/native-findings.js +18 -0
  200. package/dist/domains/comet-native/native-findings.js.map +1 -1
  201. package/dist/domains/comet-native/native-hook-guard-command.d.ts +3 -0
  202. package/dist/domains/comet-native/native-hook-guard-command.d.ts.map +1 -0
  203. package/dist/domains/comet-native/native-hook-guard-command.js +32 -0
  204. package/dist/domains/comet-native/native-hook-guard-command.js.map +1 -0
  205. package/dist/domains/comet-native/native-hook-guard-entry.d.ts +2 -0
  206. package/dist/domains/comet-native/native-hook-guard-entry.d.ts.map +1 -0
  207. package/dist/domains/comet-native/native-hook-guard-entry.js +4 -0
  208. package/dist/domains/comet-native/native-hook-guard-entry.js.map +1 -0
  209. package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
  210. package/dist/domains/comet-native/native-hook-guard.js +7 -1
  211. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  212. package/dist/domains/comet-native/native-init-command.d.ts +3 -0
  213. package/dist/domains/comet-native/native-init-command.d.ts.map +1 -0
  214. package/dist/domains/comet-native/native-init-command.js +29 -0
  215. package/dist/domains/comet-native/native-init-command.js.map +1 -0
  216. package/dist/domains/comet-native/native-init-entry.d.ts +2 -0
  217. package/dist/domains/comet-native/native-init-entry.d.ts.map +1 -0
  218. package/dist/domains/comet-native/native-init-entry.js +4 -0
  219. package/dist/domains/comet-native/native-init-entry.js.map +1 -0
  220. package/dist/domains/comet-native/native-new-command.d.ts +3 -0
  221. package/dist/domains/comet-native/native-new-command.d.ts.map +1 -0
  222. package/dist/domains/comet-native/native-new-command.js +35 -0
  223. package/dist/domains/comet-native/native-new-command.js.map +1 -0
  224. package/dist/domains/comet-native/native-new-entry.d.ts +2 -0
  225. package/dist/domains/comet-native/native-new-entry.d.ts.map +1 -0
  226. package/dist/domains/comet-native/native-new-entry.js +4 -0
  227. package/dist/domains/comet-native/native-new-entry.js.map +1 -0
  228. package/dist/domains/comet-native/native-next-command.d.ts +3 -0
  229. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -0
  230. package/dist/domains/comet-native/native-next-command.js +82 -0
  231. package/dist/domains/comet-native/native-next-command.js.map +1 -0
  232. package/dist/domains/comet-native/native-next-entry.d.ts +2 -0
  233. package/dist/domains/comet-native/native-next-entry.d.ts.map +1 -0
  234. package/dist/domains/comet-native/native-next-entry.js +4 -0
  235. package/dist/domains/comet-native/native-next-entry.js.map +1 -0
  236. package/dist/domains/comet-native/native-receipt-command.d.ts +3 -0
  237. package/dist/domains/comet-native/native-receipt-command.d.ts.map +1 -0
  238. package/dist/domains/comet-native/native-receipt-command.js +107 -0
  239. package/dist/domains/comet-native/native-receipt-command.js.map +1 -0
  240. package/dist/domains/comet-native/native-receipt-entry.d.ts +2 -0
  241. package/dist/domains/comet-native/native-receipt-entry.d.ts.map +1 -0
  242. package/dist/domains/comet-native/native-receipt-entry.js +4 -0
  243. package/dist/domains/comet-native/native-receipt-entry.js.map +1 -0
  244. package/dist/domains/comet-native/native-receipt-refresh.d.ts +86 -0
  245. package/dist/domains/comet-native/native-receipt-refresh.d.ts.map +1 -0
  246. package/dist/domains/comet-native/native-receipt-refresh.js +232 -0
  247. package/dist/domains/comet-native/native-receipt-refresh.js.map +1 -0
  248. package/dist/domains/comet-native/native-root-command.d.ts +3 -0
  249. package/dist/domains/comet-native/native-root-command.d.ts.map +1 -0
  250. package/dist/domains/comet-native/native-root-command.js +29 -0
  251. package/dist/domains/comet-native/native-root-command.js.map +1 -0
  252. package/dist/domains/comet-native/native-root-entry.d.ts +2 -0
  253. package/dist/domains/comet-native/native-root-entry.d.ts.map +1 -0
  254. package/dist/domains/comet-native/native-root-entry.js +4 -0
  255. package/dist/domains/comet-native/native-root-entry.js.map +1 -0
  256. package/dist/domains/comet-native/native-script-entry.d.ts +12 -0
  257. package/dist/domains/comet-native/native-script-entry.d.ts.map +1 -0
  258. package/dist/domains/comet-native/native-script-entry.js +44 -0
  259. package/dist/domains/comet-native/native-script-entry.js.map +1 -0
  260. package/dist/domains/comet-native/native-select-command.d.ts +3 -0
  261. package/dist/domains/comet-native/native-select-command.d.ts.map +1 -0
  262. package/dist/domains/comet-native/native-select-command.js +15 -0
  263. package/dist/domains/comet-native/native-select-command.js.map +1 -0
  264. package/dist/domains/comet-native/native-select-entry.d.ts +2 -0
  265. package/dist/domains/comet-native/native-select-entry.d.ts.map +1 -0
  266. package/dist/domains/comet-native/native-select-entry.js +4 -0
  267. package/dist/domains/comet-native/native-select-entry.js.map +1 -0
  268. package/dist/domains/comet-native/native-show-command.d.ts +3 -0
  269. package/dist/domains/comet-native/native-show-command.d.ts.map +1 -0
  270. package/dist/domains/comet-native/native-show-command.js +41 -0
  271. package/dist/domains/comet-native/native-show-command.js.map +1 -0
  272. package/dist/domains/comet-native/native-show-entry.d.ts +2 -0
  273. package/dist/domains/comet-native/native-show-entry.d.ts.map +1 -0
  274. package/dist/domains/comet-native/native-show-entry.js +4 -0
  275. package/dist/domains/comet-native/native-show-entry.js.map +1 -0
  276. package/dist/domains/comet-native/native-snapshot.d.ts +9 -0
  277. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  278. package/dist/domains/comet-native/native-snapshot.js +141 -5
  279. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  280. package/dist/domains/comet-native/native-spec-command.d.ts +3 -0
  281. package/dist/domains/comet-native/native-spec-command.d.ts.map +1 -0
  282. package/dist/domains/comet-native/native-spec-command.js +34 -0
  283. package/dist/domains/comet-native/native-spec-command.js.map +1 -0
  284. package/dist/domains/comet-native/native-spec-entry.d.ts +2 -0
  285. package/dist/domains/comet-native/native-spec-entry.d.ts.map +1 -0
  286. package/dist/domains/comet-native/native-spec-entry.js +4 -0
  287. package/dist/domains/comet-native/native-spec-entry.js.map +1 -0
  288. package/dist/domains/comet-native/native-status-command.d.ts +3 -0
  289. package/dist/domains/comet-native/native-status-command.d.ts.map +1 -0
  290. package/dist/domains/comet-native/native-status-command.js +36 -0
  291. package/dist/domains/comet-native/native-status-command.js.map +1 -0
  292. package/dist/domains/comet-native/native-status-entry.d.ts +2 -0
  293. package/dist/domains/comet-native/native-status-entry.d.ts.map +1 -0
  294. package/dist/domains/comet-native/native-status-entry.js +4 -0
  295. package/dist/domains/comet-native/native-status-entry.js.map +1 -0
  296. package/dist/domains/comet-native/native-transitions.d.ts +4 -0
  297. package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
  298. package/dist/domains/comet-native/native-transitions.js +28 -4
  299. package/dist/domains/comet-native/native-transitions.js.map +1 -1
  300. package/dist/domains/comet-native/native-types.d.ts +8 -0
  301. package/dist/domains/comet-native/native-types.d.ts.map +1 -1
  302. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts +14 -0
  303. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  304. package/dist/domains/comet-native/native-verification-receipt-runtime.js +29 -1
  305. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  306. package/dist/domains/comet-native/native-verification-runtime.d.ts +28 -1
  307. package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
  308. package/dist/domains/comet-native/native-verification-runtime.js +92 -14
  309. package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
  310. package/dist/domains/dashboard/collector.d.ts.map +1 -1
  311. package/dist/domains/dashboard/collector.js +53 -41
  312. package/dist/domains/dashboard/collector.js.map +1 -1
  313. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  314. package/dist/domains/dashboard/native-collector.js +13 -3
  315. package/dist/domains/dashboard/native-collector.js.map +1 -1
  316. package/dist/domains/dashboard/project-directory.d.ts +20 -0
  317. package/dist/domains/dashboard/project-directory.d.ts.map +1 -0
  318. package/dist/domains/dashboard/project-directory.js +87 -0
  319. package/dist/domains/dashboard/project-directory.js.map +1 -0
  320. package/dist/domains/dashboard/project-root.d.ts +8 -0
  321. package/dist/domains/dashboard/project-root.d.ts.map +1 -0
  322. package/dist/domains/dashboard/project-root.js +68 -0
  323. package/dist/domains/dashboard/project-root.js.map +1 -0
  324. package/dist/domains/dashboard/server.d.ts +1 -0
  325. package/dist/domains/dashboard/server.d.ts.map +1 -1
  326. package/dist/domains/dashboard/server.js +50 -10
  327. package/dist/domains/dashboard/server.js.map +1 -1
  328. package/dist/domains/dashboard/web/assets/{arc-BXDAG6Qx.js → arc-mNt_SS1l.js} +1 -1
  329. package/dist/domains/dashboard/web/assets/architectureDiagram-3BPJPVTR-Bc5akVD6.js +36 -0
  330. package/dist/domains/dashboard/web/assets/{blockDiagram-GPEHLZMM-STNPWdDl.js → blockDiagram-GPEHLZMM-C43zhVBe.js} +2 -2
  331. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-Bh-rUIcJ.js → c4Diagram-AAUBKEIU-dToETarK.js} +2 -2
  332. package/dist/domains/dashboard/web/assets/channel-b2wWDG4F.js +1 -0
  333. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-BRhFNAFH.js → chunk-2J33WTMH-C0oO137R.js} +1 -1
  334. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-CwA3zkFS.js → chunk-4BX2VUAB-CGms1fgI.js} +1 -1
  335. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-C1tqAl_E.js → chunk-55IACEB6-Bugl8v6f.js} +1 -1
  336. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-DDefBoUS.js → chunk-727SXJPM-8ATNMlBG.js} +1 -1
  337. package/dist/domains/dashboard/web/assets/{chunk-AQP2D5EJ-Dq-0Yi9D.js → chunk-AQP2D5EJ-BNYjSSqU.js} +1 -1
  338. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-DC-MVNgk.js → chunk-FMBD7UC4-_nJAqSbe.js} +1 -1
  339. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-BLWZ8zWd.js → chunk-ND2GUHAM-lyxYm5NX.js} +1 -1
  340. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-DaK5rvZu.js → chunk-QZHKN3VN-PUMVeWpd.js} +1 -1
  341. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-B9SWZywo.js +1 -0
  342. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-B9SWZywo.js +1 -0
  343. package/dist/domains/dashboard/web/assets/cose-bilkent-S5V4N54A-DzMqjexn.js +1 -0
  344. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-CBaY4KFj.js → cynefin-VYW2F7L2-B67ET0eq.js} +1 -1
  345. package/dist/domains/dashboard/web/assets/dagre-BM42HDAG-CQPMvRLK.js +4 -0
  346. package/dist/domains/dashboard/web/assets/diagram-2AECGRRQ-BRpLrFHM.js +43 -0
  347. package/dist/domains/dashboard/web/assets/diagram-5GNKFQAL-CPGWuGrE.js +10 -0
  348. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-BZcengGf.js → diagram-KO2AKTUF-D2wpX2iO.js} +2 -2
  349. package/dist/domains/dashboard/web/assets/diagram-LMA3HP47-D54mAbDu.js +24 -0
  350. package/dist/domains/dashboard/web/assets/diagram-OG6HWLK6-ZGQDpSs_.js +24 -0
  351. package/dist/domains/dashboard/web/assets/{erDiagram-TEJ5UH35-BBrwULhs.js → erDiagram-TEJ5UH35-C3qDo7sd.js} +2 -2
  352. package/dist/domains/dashboard/web/assets/{flowDiagram-I6XJVG4X-DiNn0Yzp.js → flowDiagram-I6XJVG4X-B7hStPd9.js} +2 -2
  353. package/dist/domains/dashboard/web/assets/ganttDiagram-6RSMTGT7-IqcLFbTK.js +292 -0
  354. package/dist/domains/dashboard/web/assets/gitGraphDiagram-PVQCEYII-YrMZpzUu.js +106 -0
  355. package/dist/domains/dashboard/web/assets/index-DhtBssCt.js +257 -0
  356. package/dist/domains/dashboard/web/assets/{index-QO0z6F4w.js → index-icxk8_BP.js} +1 -1
  357. package/dist/domains/dashboard/web/assets/index-pr3axVDI.css +1 -0
  358. package/dist/domains/dashboard/web/assets/infoDiagram-5YYISTIA-CcIgGK_7.js +2 -0
  359. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-DCPPspol.js → ishikawaDiagram-YF4QCWOH-1x3rNjGP.js} +2 -2
  360. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-C_v8b1Os.js → journeyDiagram-JHISSGLW-B2XiqMNP.js} +2 -2
  361. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-CgpE9lG7.js → kanban-definition-UN3LZRKU-x46cGuo3.js} +2 -2
  362. package/dist/domains/dashboard/web/assets/{linear-jSddcREx.js → linear-DFLqGZWl.js} +1 -1
  363. package/dist/domains/dashboard/web/assets/{mermaid.core-5Ibr28Ig.js → mermaid.core-g3J6BACc.js} +69 -69
  364. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-XPCohX0x.js → mindmap-definition-RKZ34NQL-CTdeKmcX.js} +2 -2
  365. package/dist/domains/dashboard/web/assets/{pieDiagram-4H26LBE5-DvhxgQWl.js → pieDiagram-4H26LBE5-C_obwjIf.js} +2 -2
  366. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-CCUxdF-S.js → quadrantDiagram-W4KKPZXB-B6Gnfz9M.js} +4 -4
  367. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-FS3TCmdX.js → requirementDiagram-4Y6WPE33-nX4PObnB.js} +2 -2
  368. package/dist/domains/dashboard/web/assets/{sankeyDiagram-5OEKKPKP-r129rscN.js → sankeyDiagram-5OEKKPKP-QjDwwHgl.js} +2 -2
  369. package/dist/domains/dashboard/web/assets/{sequenceDiagram-3UESZ5HK--DCY0bvU.js → sequenceDiagram-3UESZ5HK-BEEe0j6B.js} +2 -2
  370. package/dist/domains/dashboard/web/assets/stateDiagram-AJRCARHV-CXfAaBgM.js +1 -0
  371. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-CD3nS4cC.js +1 -0
  372. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-NlqCuFuo.js → timeline-definition-PNZ67QCA-BOzX2EnD.js} +2 -2
  373. package/dist/domains/dashboard/web/assets/{vennDiagram-CIIHVFJN-B4W_d1Nq.js → vennDiagram-CIIHVFJN-C40vhXRq.js} +2 -2
  374. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-Bex-_jWd.js → wardleyDiagram-YWT4CUSO-B1rm89JH.js} +2 -2
  375. package/dist/domains/dashboard/web/assets/{xychartDiagram-2RQKCTM6-CmxeVM2Z.js → xychartDiagram-2RQKCTM6-BlMr59qK.js} +2 -2
  376. package/dist/domains/dashboard/web/index.html +2 -2
  377. package/dist/domains/integrations/openspec.d.ts +1 -0
  378. package/dist/domains/integrations/openspec.d.ts.map +1 -1
  379. package/dist/domains/integrations/openspec.js +6 -0
  380. package/dist/domains/integrations/openspec.js.map +1 -1
  381. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  382. package/dist/domains/skill/platform-install.js +4 -6
  383. package/dist/domains/skill/platform-install.js.map +1 -1
  384. package/dist/domains/skill/uninstall.d.ts +6 -2
  385. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  386. package/dist/domains/skill/uninstall.js +128 -19
  387. package/dist/domains/skill/uninstall.js.map +1 -1
  388. package/dist/domains/workflow-contract/project-config.d.ts +1 -0
  389. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  390. package/dist/domains/workflow-contract/project-config.js +45 -1
  391. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  392. package/dist/platform/install/detect.d.ts +1 -0
  393. package/dist/platform/install/detect.d.ts.map +1 -1
  394. package/dist/platform/install/detect.js +2 -0
  395. package/dist/platform/install/detect.js.map +1 -1
  396. package/dist/platform/process/hook-read-cache.d.ts +45 -0
  397. package/dist/platform/process/hook-read-cache.d.ts.map +1 -0
  398. package/dist/platform/process/hook-read-cache.js +102 -0
  399. package/dist/platform/process/hook-read-cache.js.map +1 -0
  400. package/dist/platform/version/version.d.ts.map +1 -1
  401. package/dist/platform/version/version.js +9 -2
  402. package/dist/platform/version/version.js.map +1 -1
  403. package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +2 -0
  404. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +2 -0
  405. package/eval/local/tasks/comet-native-workflow/instruction.md +3 -3
  406. package/eval/local/tasks/comet-native-workflow/task.toml +4 -2
  407. package/eval/local/tasks/comet-native-workflow/validation/test_native_workflow.py +212 -75
  408. package/eval/local/tests/scaffold/test_native_wave_evaluations.py +114 -39
  409. package/eval/local/tests/scaffold/test_tasks.py +5 -1
  410. package/package.json +7 -3
  411. package/dist/domains/dashboard/web/assets/_commonjsHelpers-CqkleIqs.js +0 -1
  412. package/dist/domains/dashboard/web/assets/architectureDiagram-3BPJPVTR-R2JyCv0i.js +0 -36
  413. package/dist/domains/dashboard/web/assets/channel-XR_5gd6D.js +0 -1
  414. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-CG_TnucZ.js +0 -1
  415. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-CG_TnucZ.js +0 -1
  416. package/dist/domains/dashboard/web/assets/cose-bilkent-S5V4N54A-DCPgAyMU.js +0 -1
  417. package/dist/domains/dashboard/web/assets/dagre-BM42HDAG-CLKQ6BQM.js +0 -4
  418. package/dist/domains/dashboard/web/assets/diagram-2AECGRRQ-DCup336F.js +0 -43
  419. package/dist/domains/dashboard/web/assets/diagram-5GNKFQAL-DgpDOFTE.js +0 -10
  420. package/dist/domains/dashboard/web/assets/diagram-LMA3HP47-DSECilBo.js +0 -24
  421. package/dist/domains/dashboard/web/assets/diagram-OG6HWLK6-3FuzANXW.js +0 -24
  422. package/dist/domains/dashboard/web/assets/ganttDiagram-6RSMTGT7-DcvbTHnu.js +0 -292
  423. package/dist/domains/dashboard/web/assets/gitGraphDiagram-PVQCEYII-CgCY3MJo.js +0 -106
  424. package/dist/domains/dashboard/web/assets/index-BR3wUr2k.css +0 -1
  425. package/dist/domains/dashboard/web/assets/index-CovQUq5W.js +0 -24
  426. package/dist/domains/dashboard/web/assets/infoDiagram-5YYISTIA-hzBGAEue.js +0 -2
  427. package/dist/domains/dashboard/web/assets/stateDiagram-AJRCARHV-yHkUByrT.js +0 -1
  428. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-XHzDdqcm.js +0 -1
@@ -1,3 +1,208 @@
1
1
  #!/usr/bin/env node
2
- import { main } from './comet-runtime.mjs';
3
- process.exitCode = await main(["guard", ...process.argv.slice(2)]);
2
+ import { createRequire as __cometCreateRequire } from 'module';
3
+ const require = __cometCreateRequire(import.meta.url);
4
+ var ef=Object.create;var hr=Object.defineProperty;var tf=Object.getOwnPropertyDescriptor;var nf=Object.getOwnPropertyNames;var rf=Object.getPrototypeOf,sf=Object.prototype.hasOwnProperty;var An=(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 G=(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}},of=(t,e)=>{for(var n in e)hr(t,n,{get:e[n],enumerable:!0})},af=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of nf(e))!sf.call(t,r)&&r!==n&&hr(t,r,{get:()=>e[r],enumerable:!(i=tf(e,r))||i.enumerable});return t};var ct=(t,e,n)=>(n=t!=null?ef(rf(t)):{},af(e||!t||!t.__esModule?hr(n,"default",{value:t,enumerable:!0}):n,t));var N=v(U=>{"use strict";var gr=Symbol.for("yaml.alias"),Io=Symbol.for("yaml.document"),On=Symbol.for("yaml.map"),$o=Symbol.for("yaml.pair"),wr=Symbol.for("yaml.scalar"),jn=Symbol.for("yaml.seq"),me=Symbol.for("yaml.node.type"),cf=t=>!!t&&typeof t=="object"&&t[me]===gr,lf=t=>!!t&&typeof t=="object"&&t[me]===Io,uf=t=>!!t&&typeof t=="object"&&t[me]===On,ff=t=>!!t&&typeof t=="object"&&t[me]===$o,qo=t=>!!t&&typeof t=="object"&&t[me]===wr,df=t=>!!t&&typeof t=="object"&&t[me]===jn;function Lo(t){if(t&&typeof t=="object")switch(t[me]){case On:case jn:return!0}return!1}function pf(t){if(t&&typeof t=="object")switch(t[me]){case gr:case On:case wr:case jn:return!0}return!1}var mf=t=>(qo(t)||Lo(t))&&!!t.anchor;U.ALIAS=gr;U.DOC=Io;U.MAP=On;U.NODE_TYPE=me;U.PAIR=$o;U.SCALAR=wr;U.SEQ=jn;U.hasAnchor=mf;U.isAlias=cf;U.isCollection=Lo;U.isDocument=lf;U.isMap=uf;U.isNode=pf;U.isPair=ff;U.isScalar=qo;U.isSeq=df});var Rt=v(yr=>{"use strict";var W=N(),Z=Symbol("break visit"),Do=Symbol("skip children"),ue=Symbol("remove node");function Tn(t,e){let n=Mo(e);W.isDocument(t)?lt(null,t.contents,n,Object.freeze([t]))===ue&&(t.contents=null):lt(null,t,n,Object.freeze([]))}Tn.BREAK=Z;Tn.SKIP=Do;Tn.REMOVE=ue;function lt(t,e,n,i){let r=Fo(t,e,n,i);if(W.isNode(r)||W.isPair(r))return Wo(t,i,r),lt(t,r,n,i);if(typeof r!="symbol"){if(W.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=lt(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===Z)return Z;o===ue&&(e.items.splice(s,1),s-=1)}}}else if(W.isPair(e)){i=Object.freeze(i.concat(e));let s=lt("key",e.key,n,i);if(s===Z)return Z;s===ue&&(e.key=null);let o=lt("value",e.value,n,i);if(o===Z)return Z;o===ue&&(e.value=null)}}return r}async function In(t,e){let n=Mo(e);W.isDocument(t)?await ut(null,t.contents,n,Object.freeze([t]))===ue&&(t.contents=null):await ut(null,t,n,Object.freeze([]))}In.BREAK=Z;In.SKIP=Do;In.REMOVE=ue;async function ut(t,e,n,i){let r=await Fo(t,e,n,i);if(W.isNode(r)||W.isPair(r))return Wo(t,i,r),ut(t,r,n,i);if(typeof r!="symbol"){if(W.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=await ut(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===Z)return Z;o===ue&&(e.items.splice(s,1),s-=1)}}}else if(W.isPair(e)){i=Object.freeze(i.concat(e));let s=await ut("key",e.key,n,i);if(s===Z)return Z;s===ue&&(e.key=null);let o=await ut("value",e.value,n,i);if(o===Z)return Z;o===ue&&(e.value=null)}}return r}function Mo(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 Fo(t,e,n,i){if(typeof n=="function")return n(t,e,i);if(W.isMap(e))return n.Map?.(t,e,i);if(W.isSeq(e))return n.Seq?.(t,e,i);if(W.isPair(e))return n.Pair?.(t,e,i);if(W.isScalar(e))return n.Scalar?.(t,e,i);if(W.isAlias(e))return n.Alias?.(t,e,i)}function Wo(t,e,n){let i=e[e.length-1];if(W.isCollection(i))i.items[t]=n;else if(W.isPair(i))t==="key"?i.key=n:i.value=n;else if(W.isDocument(i))i.contents=n;else{let r=W.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}yr.visit=Tn;yr.visitAsync=In});var vr=v(Ko=>{"use strict";var Bo=N(),hf=Rt(),gf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},wf=t=>t.replace(/[!,[\]{}]/g,e=>gf[e]),Nt=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[s,o]=i;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=i;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,o),!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 o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,i,r]=e.match(/^(.*!)([^!]*)$/s);r||n(`The ${e} tag has no suffix`);let s=this.tags[i];if(s)try{return s+decodeURIComponent(r)}catch(o){return n(String(o)),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+wf(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&&Bo.isNode(e.contents)){let s={};hf.visit(e.contents,(o,a)=>{Bo.isNode(a)&&a.tag&&(s[a.tag]=!0)}),r=Object.keys(s)}else r=[];for(let[s,o]of i)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(o)))&&n.push(`%TAG ${s} ${o}`);return n.join(`
5
+ `)}};Nt.defaultYaml={explicit:!1,version:"1.2"};Nt.defaultTags={"!!":"tag:yaml.org,2002:"};Ko.Directives=Nt});var $n=v(At=>{"use strict";var Yo=N(),yf=Rt();function vf(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 Uo(t){let e=new Set;return yf.visit(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function Vo(t,e){for(let n=1;;++n){let i=`${t}${n}`;if(!e.has(i))return i}}function bf(t,e){let n=[],i=new Map,r=null;return{onAnchor:s=>{n.push(s),r??(r=Uo(t));let o=Vo(e,r);return r.add(o),o},setAnchors:()=>{for(let s of n){let o=i.get(s);if(typeof o=="object"&&o.anchor&&(Yo.isScalar(o.node)||Yo.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:i}}At.anchorIsValid=vf;At.anchorNames=Uo;At.createNodeAnchors=bf;At.findNewAnchor=Vo});var br=v(Jo=>{"use strict";function Ot(t,e,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,s=i.length;r<s;++r){let o=i[r],a=Ot(t,i,String(r),o);a===void 0?delete i[r]:a!==o&&(i[r]=a)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let s=i.get(r),o=Ot(t,i,r,s);o===void 0?i.delete(r):o!==s&&i.set(r,o)}else if(i instanceof Set)for(let r of Array.from(i)){let s=Ot(t,i,r,r);s===void 0?i.delete(r):s!==r&&(i.delete(r),i.add(s))}else for(let[r,s]of Object.entries(i)){let o=Ot(t,i,r,s);o===void 0?delete i[r]:o!==s&&(i[r]=o)}return t.call(e,n,i)}Jo.applyReviver=Ot});var Ce=v(Go=>{"use strict";var kf=N();function Ho(t,e,n){if(Array.isArray(t))return t.map((i,r)=>Ho(i,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!kf.hasAnchor(t))return t.toJSON(e,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(t,i),n.onCreate=s=>{i.res=s,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}Go.toJS=Ho});var qn=v(Qo=>{"use strict";var Sf=br(),zo=N(),Cf=Ce(),kr=class{constructor(e){Object.defineProperty(this,zo.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:s}={}){if(!zo.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=Cf.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof s=="function"?Sf.applyReviver(s,{"":a},"",a):a}};Qo.NodeBase=kr});var jt=v(Xo=>{"use strict";var Ef=$n(),xf=Rt(),ft=N(),_f=qn(),Pf=Ce(),Sr=class extends _f.NodeBase{constructor(e){super(ft.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=[],xf.visit(e,{Node:(s,o)=>{(ft.isAlias(o)||ft.hasAnchor(o))&&i.push(o)}}),n&&(n.aliasResolveCache=i));let r;for(let s of i){if(s===this)break;s.anchor===this.source&&(r=s)}return r}toJSON(e,n){if(!n)return{source:this.source};let{anchors:i,doc:r,maxAliasCount:s}=n,o=this.resolve(r,n);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=i.get(o);if(a||(Pf.toJS(o,null,n),a=i.get(o)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Ln(r,o,i)),a.count*a.aliasCount>s)){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(Ef.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${r} `}return r}};function Ln(t,e,n){if(ft.isAlias(e)){let i=e.resolve(t),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(ft.isCollection(e)){let i=0;for(let r of e.items){let s=Ln(t,r,n);s>i&&(i=s)}return i}else if(ft.isPair(e)){let i=Ln(t,e.key,n),r=Ln(t,e.value,n);return Math.max(i,r)}return 1}Xo.Alias=Sr});var q=v(Cr=>{"use strict";var Rf=N(),Nf=qn(),Af=Ce(),Of=t=>!t||typeof t!="function"&&typeof t!="object",Ee=class extends Nf.NodeBase{constructor(e){super(Rf.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Af.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";Cr.Scalar=Ee;Cr.isScalarValue=Of});var Tt=v(ea=>{"use strict";var jf=jt(),Ye=N(),Zo=q(),Tf="tag:yaml.org,2002:";function If(t,e,n){if(e){let i=n.filter(s=>s.tag===e),r=i.find(s=>!s.format)??i[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return n.find(i=>i.identify?.(t)&&!i.format)}function $f(t,e,n){if(Ye.isDocument(t)&&(t=t.contents),Ye.isNode(t))return t;if(Ye.isPair(t)){let u=n.schema[Ye.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:s,schema:o,sourceObjects:a}=n,c;if(i&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=r(t)),new jf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Tf+e.slice(2));let l=If(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new Zo.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?o[Ye.MAP]:Symbol.iterator in Object(t)?o[Ye.SEQ]:o[Ye.MAP]}s&&(s(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 Zo.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}ea.createNode=$f});var Mn=v(Dn=>{"use strict";var qf=Tt(),fe=N(),Lf=qn();function Er(t,e,n){let i=n;for(let r=e.length-1;r>=0;--r){let s=e[r];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let o=[];o[s]=i,i=o}else i=new Map([[s,i]])}return qf.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 ta=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,xr=class extends Lf.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=>fe.isNode(i)||fe.isPair(i)?i.clone(e):i),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(ta(e))this.add(n);else{let[i,...r]=e,s=this.get(i,!0);if(fe.isCollection(s))s.addIn(r,n);else if(s===void 0&&this.schema)this.set(i,Er(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(fe.isCollection(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(e,n){let[i,...r]=e,s=this.get(i,!0);return r.length===0?!n&&fe.isScalar(s)?s.value:s:fe.isCollection(s)?s.getIn(r,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!fe.isPair(n))return!1;let i=n.value;return i==null||e&&fe.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 fe.isCollection(r)?r.hasIn(i):!1}setIn(e,n){let[i,...r]=e;if(r.length===0)this.set(i,n);else{let s=this.get(i,!0);if(fe.isCollection(s))s.setIn(r,n);else if(s===void 0&&this.schema)this.set(i,Er(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};Dn.Collection=xr;Dn.collectionFromPath=Er;Dn.isEmptyPath=ta});var It=v(Fn=>{"use strict";var Df=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function _r(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Mf=(t,e,n)=>t.endsWith(`
6
+ `)?_r(n,e):n.includes(`
7
+ `)?`
8
+ `+_r(n,e):(t.endsWith(" ")?"":" ")+n;Fn.indentComment=_r;Fn.lineComment=Mf;Fn.stringifyComment=Df});var ia=v($t=>{"use strict";var Ff="flow",Pr="block",Wn="quoted";function Wf(t,e,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:s=20,onFold:o,onOverflow:a}={}){if(!r||r<0)return t;r<s&&(s=0);let c=Math.max(1+s,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,s)?l.push(0):u=r-i);let d,h,w=!1,p=-1,m=-1,g=-1;n===Pr&&(p=na(t,p,e.length),p!==-1&&(u=p+c));for(let k;k=t[p+=1];){if(n===Wn&&k==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}g=p}if(k===`
9
+ `)n===Pr&&(p=na(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(k===" "&&h&&h!==" "&&h!==`
10
+ `&&h!==" "){let C=t[p+1];C&&C!==" "&&C!==`
11
+ `&&C!==" "&&(d=p)}if(p>=u)if(d)l.push(d),u=d+c,d=void 0;else if(n===Wn){for(;h===" "||h===" ";)h=k,k=t[p+=1],w=!0;let C=p>g+1?p-2:m-1;if(f[C])return t;l.push(C),f[C]=!0,u=C+c,d=void 0}else w=!0}h=k}if(w&&a&&a(),l.length===0)return t;o&&o();let y=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let C=l[k],x=l[k+1]||t.length;C===0?y=`
12
+ ${e}${t.slice(0,x)}`:(n===Wn&&f[C]&&(y+=`${t[C]}\\`),y+=`
13
+ ${e}${t.slice(C+1,x)}`)}return y}function na(t,e,n){let i=e,r=e+1,s=t[r];for(;s===" "||s===" ";)if(e<r+n)s=t[++e];else{do s=t[++e];while(s&&s!==`
14
+ `);i=e,r=e+1,s=t[r]}return i}$t.FOLD_BLOCK=Pr;$t.FOLD_FLOW=Ff;$t.FOLD_QUOTED=Wn;$t.foldFlowLines=Wf});var Lt=v(ra=>{"use strict";var oe=q(),xe=ia(),Kn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Yn=t=>/^(%|---|\.\.\.)/m.test(t);function Bf(t,e,n){if(!e||e<0)return!1;let i=e-n,r=t.length;if(r<=i)return!1;for(let s=0,o=0;s<r;++s)if(t[s]===`
15
+ `){if(s-o>i)return!0;if(o=s+1,r-o<=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,s=e.indent||(Yn(t)?" ":""),o="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(o+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{o+=n.slice(a,c);let f=n.substr(c+2,4);switch(f){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:f.substr(0,2)==="00"?o+="\\x"+f.substr(2):o+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(i||n[c+2]==='"'||n.length<r)c+=1;else{for(o+=n.slice(a,c)+`
16
+
17
+ `;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)o+=`
18
+ `,c+=2;o+=s,n[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+n.slice(a):n,i?o:xe.foldFlowLines(o,s,xe.FOLD_QUOTED,Kn(e,!1))}function Rr(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||(Yn(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${n}`)+"'";return e.implicitKey?i:xe.foldFlowLines(i,n,xe.FOLD_FLOW,Kn(e,!1))}function dt(t,e){let{singleQuote:n}=e.options,i;if(n===!1)i=qt;else{let r=t.includes('"'),s=t.includes("'");r&&!s?i=Rr:s&&!r?i=qt:i=n?Rr:qt}return i(t,e)}var Nr;try{Nr=new RegExp(`(^|(?<!
21
+ ))
22
+ +(?!
23
+ |$)`,"g")}catch{Nr=/\n+(?!\n|$)/g}function Bn({comment:t,type:e,value:n},i,r,s){let{blockQuote:o,commentString:a,lineWidth:c}=i.options;if(!o||/\n[\t ]+$/.test(n))return dt(n,i);let l=i.indent||(i.forceBlockIndent||Yn(n)?" ":""),f=o==="literal"?!0:o==="folded"||e===oe.Scalar.BLOCK_FOLDED?!1:e===oe.Scalar.BLOCK_LITERAL?!0:!Bf(n,c,l.length);if(!n)return f?`|
24
+ `:`>
25
+ `;let u,d;for(d=n.length;d>0;--d){let x=n[d-1];if(x!==`
26
+ `&&x!==" "&&x!==" ")break}let h=n.substring(d),w=h.indexOf(`
27
+ `);w===-1?u="-":n===h||w!==h.length-1?(u="+",s&&s()):u="",h&&(n=n.slice(0,-h.length),h[h.length-1]===`
28
+ `&&(h=h.slice(0,-1)),h=h.replace(Nr,`$&${l}`));let p=!1,m,g=-1;for(m=0;m<n.length;++m){let x=n[m];if(x===" ")p=!0;else if(x===`
29
+ `)g=m;else break}let y=n.substring(0,g<m?g+1:m);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let C=(p?l?"2":"1":"")+u;if(t&&(C+=" "+a(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!f){let x=n.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),P=!1,j=Kn(i,!0);o!=="folded"&&e!==oe.Scalar.BLOCK_FOLDED&&(j.onOverflow=()=>{P=!0});let b=xe.foldFlowLines(`${y}${x}${h}`,l,xe.FOLD_BLOCK,j);if(!P)return`>${C}
31
+ ${l}${b}`}return n=n.replace(/\n+/g,`$&${l}`),`|${C}
32
+ ${l}${y}${n}${h}`}function Kf(t,e,n,i){let{type:r,value:s}=t,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:f}=e;if(a&&s.includes(`
33
+ `)||f&&/[[\]{},]/.test(s))return dt(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||f||!s.includes(`
34
+ `)?dt(s,e):Bn(t,e,n,i);if(!a&&!f&&r!==oe.Scalar.PLAIN&&s.includes(`
35
+ `))return Bn(t,e,n,i);if(Yn(s)){if(c==="")return e.forceBlockIndent=!0,Bn(t,e,n,i);if(a&&c===l)return dt(s,e)}let u=s.replace(/\n+/g,`$&
36
+ ${c}`);if(o){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 dt(s,e)}return a?u:xe.foldFlowLines(u,c,xe.FOLD_FLOW,Kn(e,!1))}function Yf(t,e,n,i){let{implicitKey:r,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==oe.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=oe.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case oe.Scalar.BLOCK_FOLDED:case oe.Scalar.BLOCK_LITERAL:return r||s?dt(o.value,e):Bn(o,e,n,i);case oe.Scalar.QUOTE_DOUBLE:return qt(o.value,e);case oe.Scalar.QUOTE_SINGLE:return Rr(o.value,e);case oe.Scalar.PLAIN:return Kf(o,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}ra.stringifyString=Yf});var Dt=v(Ar=>{"use strict";var Uf=$n(),_e=N(),Vf=It(),Jf=Lt();function Hf(t,e){let n=Object.assign({blockQuote:!0,commentString:Vf.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 Gf(t,e){if(e.tag){let r=t.filter(s=>s.tag===e.tag);if(r.length>0)return r.find(s=>s.format===e.format)??r[0]}let n,i;if(_e.isScalar(e)){i=e.value;let r=t.filter(s=>s.identify?.(i));if(r.length>1){let s=r.filter(o=>o.test);s.length>0&&(r=s)}n=r.find(s=>s.format===e.format)??r.find(s=>!s.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 zf(t,e,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],s=(_e.isScalar(t)||_e.isCollection(t))&&t.anchor;s&&Uf.anchorIsValid(s)&&(n.add(s),r.push(`&${s}`));let o=t.tag??(e.default?null:e.tag);return o&&r.push(i.directives.tagString(o)),r.join(" ")}function Qf(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,s=_e.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=Gf(e.doc.schema.tags,s));let o=zf(s,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof r.stringify=="function"?r.stringify(s,e,n,i):_e.isScalar(s)?Jf.stringifyString(s,e,n,i):s.toString(e,n,i);return o?_e.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
37
+ ${e.indent}${a}`:a}Ar.createStringifyContext=Hf;Ar.stringify=Qf});var ca=v(aa=>{"use strict";var he=N(),sa=q(),oa=Dt(),Mt=It();function Xf({key:t,value:e},n,i,r){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=n,d=he.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(he.isCollection(t)||!he.isNode(t)&&typeof t=="object"){let j="With simple keys, collection cannot be used as a key value";throw new Error(j)}}let h=!u&&(!t||d&&e==null&&!n.inFlow||he.isCollection(t)||(he.isScalar(t)?t.type===sa.Scalar.BLOCK_FOLDED||t.type===sa.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!s),indent:a+c});let w=!1,p=!1,m=oa.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(s||e==null)return w&&i&&i(),m===""?"?":h?`? ${m}`:m}else if(s&&!u||e==null&&h)return m=`? ${m}`,d&&!w?m+=Mt.lineComment(m,n.indent,l(d)):p&&r&&r(),m;w&&(d=null),h?(d&&(m+=Mt.lineComment(m,n.indent,l(d))),m=`? ${m}
38
+ ${a}:`):(m=`${m}:`,d&&(m+=Mt.lineComment(m,n.indent,l(d))));let g,y,k;he.isNode(e)?(g=!!e.spaceBefore,y=e.commentBefore,k=e.comment):(g=!1,y=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!h&&!d&&he.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!f&&c.length>=2&&!n.inFlow&&!h&&he.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let C=!1,x=oa.stringify(e,n,()=>C=!0,()=>p=!0),P=" ";if(d||g||y){if(P=g?`
39
+ `:"",y){let j=l(y);P+=`
40
+ ${Mt.indentComment(j,n.indent)}`}x===""&&!n.inFlow?P===`
41
+ `&&k&&(P=`
42
+
43
+ `):P+=`
44
+ ${n.indent}`}else if(!h&&he.isCollection(e)){let j=x[0],b=x.indexOf(`
45
+ `),M=b!==-1,Se=n.inFlow??e.flow??e.items.length===0;if(M||!Se){let at=!1;if(M&&(j==="&"||j==="!")){let F=x.indexOf(" ");j==="&"&&F!==-1&&F<b&&x[F+1]==="!"&&(F=x.indexOf(" ",F+1)),(F===-1||b<F)&&(at=!0)}at||(P=`
46
+ ${n.indent}`)}}else(x===""||x[0]===`
47
+ `)&&(P="");return m+=P+x,n.inFlow?C&&i&&i():k&&!C?m+=Mt.lineComment(m,n.indent,l(k)):p&&r&&r(),m}aa.stringifyPair=Xf});var jr=v(Or=>{"use strict";var la=An("process");function Zf(t,...e){t==="debug"&&console.log(...e)}function ed(t,e){(t==="debug"||t==="warn")&&(typeof la.emitWarning=="function"?la.emitWarning(e):console.warn(e))}Or.debug=Zf;Or.warn=ed});var Gn=v(Hn=>{"use strict";var Jn=N(),ua=q(),Un="<<",Vn={identify:t=>t===Un||typeof t=="symbol"&&t.description===Un,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ua.Scalar(Symbol(Un)),{addToJSMap:fa}),stringify:()=>Un},td=(t,e)=>(Vn.identify(e)||Jn.isScalar(e)&&(!e.type||e.type===ua.Scalar.PLAIN)&&Vn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Vn.tag&&n.default);function fa(t,e,n){let i=da(t,n);if(Jn.isSeq(i))for(let r of i.items)Tr(t,e,r);else if(Array.isArray(i))for(let r of i)Tr(t,e,r);else Tr(t,e,i)}function Tr(t,e,n){let i=da(t,n);if(!Jn.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,t,Map);for(let[s,o]of r)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function da(t,e){return t&&Jn.isAlias(e)?e.resolve(t.doc,t):e}Hn.addMergeToJSMap=fa;Hn.isMergeKey=td;Hn.merge=Vn});var $r=v(ha=>{"use strict";var nd=jr(),pa=Gn(),id=Dt(),ma=N(),Ir=Ce();function rd(t,e,{key:n,value:i}){if(ma.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,i);else if(pa.isMergeKey(t,n))pa.addMergeToJSMap(t,e,i);else{let r=Ir.toJS(n,"",t);if(e instanceof Map)e.set(r,Ir.toJS(i,r,t));else if(e instanceof Set)e.add(r);else{let s=sd(n,r,t),o=Ir.toJS(i,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function sd(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(ma.isNode(t)&&n?.doc){let i=id.createStringifyContext(n.doc,{});i.anchors=new Set;for(let s of n.anchors.keys())i.anchors.add(s.anchor);i.inFlow=!0,i.inStringifyKey=!0;let r=t.toString(i);if(!n.mapKeyWarned){let s=JSON.stringify(r);s.length>40&&(s=s.substring(0,36)+'..."'),nd.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(e)}ha.addPairToJSMap=rd});var Pe=v(qr=>{"use strict";var ga=Tt(),od=ca(),ad=$r(),zn=N();function cd(t,e,n){let i=ga.createNode(t,void 0,n),r=ga.createNode(e,void 0,n);return new Qn(i,r)}var Qn=class t{constructor(e,n=null){Object.defineProperty(this,zn.NODE_TYPE,{value:zn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return zn.isNode(n)&&(n=n.clone(e)),zn.isNode(i)&&(i=i.clone(e)),new t(n,i)}toJSON(e,n){let i=n?.mapAsMap?new Map:{};return ad.addPairToJSMap(n,i,this)}toString(e,n,i){return e?.doc?od.stringifyPair(this,e,n,i):JSON.stringify(this)}};qr.Pair=Qn;qr.createPair=cd});var Lr=v(ya=>{"use strict";var Ue=N(),wa=Dt(),Xn=It();function ld(t,e,n){return(e.inFlow??t.flow?fd:ud)(t,e,n)}function ud({comment:t,items:e},n,{blockItemPrefix:i,flowChars:r,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=n,f=Object.assign({},n,{indent:s,type:null}),u=!1,d=[];for(let w=0;w<e.length;++w){let p=e[w],m=null;if(Ue.isNode(p))!u&&p.spaceBefore&&d.push(""),Zn(n,d,p.commentBefore,u),p.comment&&(m=p.comment);else if(Ue.isPair(p)){let y=Ue.isNode(p.key)?p.key:null;y&&(!u&&y.spaceBefore&&d.push(""),Zn(n,d,y.commentBefore,u))}u=!1;let g=wa.stringify(p,f,()=>m=null,()=>u=!0);m&&(g+=Xn.lineComment(g,s,l(m))),u&&m&&(u=!1),d.push(i+g)}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
+ ${c}${p}`:`
49
+ `}}return t?(h+=`
50
+ `+Xn.indentComment(l(t),c),a&&a()):u&&o&&o(),h}function fd({items:t},e,{flowChars:n,itemIndent:i}){let{indent:r,indentStep:s,flowCollectionPadding:o,options:{commentString:a}}=e;i+=s;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(Ue.isNode(p))p.spaceBefore&&u.push(""),Zn(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(Ue.isPair(p)){let y=Ue.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&u.push(""),Zn(e,u,y.commentBefore,!1),y.comment&&(l=!0));let k=Ue.isNode(p.value)?p.value:null;k?(k.comment&&(m=k.comment),k.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let g=wa.stringify(p,c,()=>m=null);l||(l=u.length>f||g.includes(`
51
+ `)),w<t.length-1?g+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,k)=>y+k.length+2,2)+(g.length+2)>e.options.lineWidth)),l&&(g+=",")),m&&(g+=Xn.lineComment(g,i,a(m))),u.push(g),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
+ ${s}${r}${p}`:`
53
+ `;return`${w}
54
+ ${r}${h}`}else return`${d}${o}${u.join(" ")}${o}${h}`}function Zn({indent:t,options:{commentString:e}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let s=Xn.indentComment(e(i),t);n.push(s.trimStart())}}ya.stringifyCollection=ld});var Ne=v(Mr=>{"use strict";var dd=Lr(),pd=$r(),md=Mn(),Re=N(),ei=Pe(),hd=q();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 Dr=class extends md.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:s}=i,o=new this(e),a=(c,l)=>{if(typeof s=="function")l=s.call(n,c,l);else if(Array.isArray(s)&&!s.includes(c))return;(l!==void 0||r)&&o.items.push(ei.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"&&o.items.sort(e.sortMapEntries),o}add(e,n){let i;Re.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new ei.Pair(e,e?.value):i=new ei.Pair(e.key,e.value);let r=Ft(this.items,i.key),s=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);Re.isScalar(r.value)&&hd.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(s){let o=this.items.findIndex(a=>s(i,a)<0);o===-1?this.items.push(i):this.items.splice(o,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 ei.Pair(e,n),!0)}toJSON(e,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let s of this.items)pd.addPairToJSMap(n,r,s);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})),dd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}};Mr.YAMLMap=Dr;Mr.findPair=Ft});var pt=v(ba=>{"use strict";var gd=N(),va=Ne(),wd={collection:"map",default:!0,nodeClass:va.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return gd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>va.YAMLMap.from(t,e,n)};ba.map=wd});var Ae=v(ka=>{"use strict";var yd=Tt(),vd=Lr(),bd=Mn(),ni=N(),kd=q(),Sd=Ce(),Fr=class extends bd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ni.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=ti(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let i=ti(e);if(typeof i!="number")return;let r=this.items[i];return!n&&ni.isScalar(r)?r.value:r}has(e){let n=ti(e);return typeof n=="number"&&n<this.items.length}set(e,n){let i=ti(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[i];ni.isScalar(r)&&kd.isScalarValue(n)?r.value=n:this.items[i]=n}toJSON(e,n){let i=[];n?.onCreate&&n.onCreate(i);let r=0;for(let s of this.items)i.push(Sd.toJS(s,String(r++),n));return i}toString(e,n,i){return e?vd.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,s=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof r=="function"){let c=n instanceof Set?a:String(o++);a=r.call(n,c,a)}s.items.push(yd.createNode(a,void 0,i))}}return s}};function ti(t){let e=ni.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}ka.YAMLSeq=Fr});var mt=v(Ca=>{"use strict";var Cd=N(),Sa=Ae(),Ed={collection:"seq",default:!0,nodeClass:Sa.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Cd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Sa.YAMLSeq.from(t,e,n)};Ca.seq=Ed});var Wt=v(Ea=>{"use strict";var xd=Lt(),_d={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),xd.stringifyString(t,e,n,i)}};Ea.string=_d});var ii=v(Pa=>{"use strict";var xa=q(),_a={identify:t=>t==null,createNode:()=>new xa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new xa.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&_a.test.test(t)?t:e.options.nullStr};Pa.nullTag=_a});var Wr=v(Na=>{"use strict";var Pd=q(),Ra={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Pd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Ra.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};Na.boolTag=Ra});var ht=v(Aa=>{"use strict";function Rd({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 s=Object.is(i,-0)?"-0":JSON.stringify(i);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=e-(s.length-o-1);for(;a-- >0;)s+="0"}return s}Aa.stringifyNumber=Rd});var Kr=v(ri=>{"use strict";var Nd=q(),Br=ht(),Ad={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},Od={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():Br.stringifyNumber(t)}},jd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Nd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Br.stringifyNumber};ri.float=jd;ri.floatExp=Od;ri.floatNaN=Ad});var Ur=v(oi=>{"use strict";var Oa=ht(),si=t=>typeof t=="bigint"||Number.isInteger(t),Yr=(t,e,n,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),n);function ja(t,e,n){let{value:i}=t;return si(i)&&i>=0?n+i.toString(e):Oa.stringifyNumber(t)}var Td={identify:t=>si(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Yr(t,2,8,n),stringify:t=>ja(t,8,"0o")},Id={identify:si,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Yr(t,0,10,n),stringify:Oa.stringifyNumber},$d={identify:t=>si(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Yr(t,2,16,n),stringify:t=>ja(t,16,"0x")};oi.int=Id;oi.intHex=$d;oi.intOct=Td});var Ia=v(Ta=>{"use strict";var qd=pt(),Ld=ii(),Dd=mt(),Md=Wt(),Fd=Wr(),Vr=Kr(),Jr=Ur(),Wd=[qd.map,Dd.seq,Md.string,Ld.nullTag,Fd.boolTag,Jr.intOct,Jr.int,Jr.intHex,Vr.floatNaN,Vr.floatExp,Vr.float];Ta.schema=Wd});var La=v(qa=>{"use strict";var Bd=q(),Kd=pt(),Yd=mt();function $a(t){return typeof t=="bigint"||Number.isInteger(t)}var ai=({value:t})=>JSON.stringify(t),Ud=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:ai},{identify:t=>t==null,createNode:()=>new Bd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:ai},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:ai},{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:ai}],Vd={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Jd=[Kd.map,Yd.seq].concat(Ud,Vd);qa.schema=Jd});var Gr=v(Da=>{"use strict";var Bt=An("buffer"),Hr=q(),Hd=Lt(),Gd={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,s){if(!n)return"";let o=n,a;if(typeof Bt.Buffer=="function")a=o instanceof Bt.Buffer?o.toString("base64"):Bt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[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=Hr.Scalar.BLOCK_LITERAL),e!==Hr.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===Hr.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return Hd.stringifyString({comment:t,type:e,value:a},i,r,s)}};Da.binary=Gd});var ui=v(li=>{"use strict";var ci=N(),zr=Pe(),zd=q(),Qd=Ae();function Ma(t,e){if(ci.isSeq(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!ci.isPair(i)){if(ci.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new zr.Pair(new zd.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
56
+ ${r.key.commentBefore}`:i.commentBefore),i.comment){let s=r.value??r.key;s.comment=s.comment?`${i.comment}
57
+ ${s.comment}`:i.comment}i=r}t.items[n]=ci.isPair(i)?i:new zr.Pair(i)}}else e("Expected a sequence for this tag");return t}function Fa(t,e,n){let{replacer:i}=n,r=new Qd.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof i=="function"&&(o=i.call(e,String(s++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;r.items.push(zr.createPair(a,c,n))}return r}var Xd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ma,createNode:Fa};li.createPairs=Fa;li.pairs=Xd;li.resolvePairs=Ma});var Zr=v(Xr=>{"use strict";var Wa=N(),Qr=Ce(),Kt=Ne(),Zd=Ae(),Ba=ui(),Ve=class t extends Zd.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 s,o;if(Wa.isPair(r)?(s=Qr.toJS(r.key,"",n),o=Qr.toJS(r.value,s,n)):s=Qr.toJS(r,"",n),i.has(s))throw new Error("Ordered maps must not include duplicate keys");i.set(s,o)}return i}static from(e,n,i){let r=Ba.createPairs(e,n,i),s=new this;return s.items=r.items,s}};Ve.tag="tag:yaml.org,2002:omap";var ep={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ve,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Ba.resolvePairs(t,e),i=[];for(let{key:r}of n.items)Wa.isScalar(r)&&(i.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new Ve,n)},createNode:(t,e,n)=>Ve.from(t,e,n)};Xr.YAMLOMap=Ve;Xr.omap=ep});var Ja=v(es=>{"use strict";var Ka=q();function Ya({value:t,source:e},n){return e&&(t?Ua:Va).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var Ua={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 Ka.Scalar(!0),stringify:Ya},Va={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 Ka.Scalar(!1),stringify:Ya};es.falseTag=Va;es.trueTag=Ua});var Ha=v(fi=>{"use strict";var tp=q(),ts=ht(),np={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:ts.stringifyNumber},ip={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():ts.stringifyNumber(t)}},rp={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 tp.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:ts.stringifyNumber};fi.float=rp;fi.floatExp=ip;fi.floatNaN=np});var za=v(Ut=>{"use strict";var Ga=ht(),Yt=t=>typeof t=="bigint"||Number.isInteger(t);function di(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 o=BigInt(t);return r==="-"?BigInt(-1)*o:o}let s=parseInt(t,n);return r==="-"?-1*s:s}function ns(t,e,n){let{value:i}=t;if(Yt(i)){let r=i.toString(e);return i<0?"-"+n+r.substr(1):n+r}return Ga.stringifyNumber(t)}var sp={identify:Yt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>di(t,2,2,n),stringify:t=>ns(t,2,"0b")},op={identify:Yt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>di(t,1,8,n),stringify:t=>ns(t,8,"0")},ap={identify:Yt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>di(t,0,10,n),stringify:Ga.stringifyNumber},cp={identify:Yt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>di(t,2,16,n),stringify:t=>ns(t,16,"0x")};Ut.int=ap;Ut.intBin=sp;Ut.intHex=cp;Ut.intOct=op});var rs=v(is=>{"use strict";var hi=N(),pi=Pe(),mi=Ne(),Je=class t extends mi.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;hi.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new pi.Pair(e.key,null):n=new pi.Pair(e,null),mi.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let i=mi.findPair(this.items,e);return!n&&hi.isPair(i)?hi.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=mi.findPair(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new pi.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,s=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof r=="function"&&(o=r.call(n,o,o)),s.items.push(pi.createPair(o,null,i));return s}};Je.tag="tag:yaml.org,2002:set";var lp={collection:"map",identify:t=>t instanceof Set,nodeClass:Je,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Je.from(t,e,n),resolve(t,e){if(hi.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Je,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};is.YAMLSet=Je;is.set=lp});var os=v(gi=>{"use strict";var up=ht();function ss(t,e){let n=t[0],i=n==="-"||n==="+"?t.substring(1):t,r=o=>e?BigInt(o):Number(o),s=i.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return n==="-"?r(-1)*s:s}function Qa(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return up.stringifyNumber(t);let i="";e<0&&(i="-",e*=n(-1));let r=n(60),s=[e%r];return e<60?s.unshift(0):(e=(e-s[0])/r,s.unshift(e%r),e>=60&&(e=(e-s[0])/r,s.unshift(e))),i+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var fp={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})=>ss(t,n),stringify:Qa},dp={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=>ss(t,!1),stringify:Qa},Xa={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(Xa.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,s,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,i-1,r,s||0,o||0,a||0,c),f=e[8];if(f&&f!=="Z"){let u=ss(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$/,"")??""};gi.floatTime=dp;gi.intTime=fp;gi.timestamp=Xa});var tc=v(ec=>{"use strict";var pp=pt(),mp=ii(),hp=mt(),gp=Wt(),wp=Gr(),Za=Ja(),as=Ha(),wi=za(),yp=Gn(),vp=Zr(),bp=ui(),kp=rs(),cs=os(),Sp=[pp.map,hp.seq,gp.string,mp.nullTag,Za.trueTag,Za.falseTag,wi.intBin,wi.intOct,wi.int,wi.intHex,as.floatNaN,as.floatExp,as.float,wp.binary,yp.merge,vp.omap,bp.pairs,kp.set,cs.intTime,cs.floatTime,cs.timestamp];ec.schema=Sp});var fc=v(fs=>{"use strict";var sc=pt(),Cp=ii(),oc=mt(),Ep=Wt(),xp=Wr(),ls=Kr(),us=Ur(),_p=Ia(),Pp=La(),ac=Gr(),Vt=Gn(),cc=Zr(),lc=ui(),nc=tc(),uc=rs(),yi=os(),ic=new Map([["core",_p.schema],["failsafe",[sc.map,oc.seq,Ep.string]],["json",Pp.schema],["yaml11",nc.schema],["yaml-1.1",nc.schema]]),rc={binary:ac.binary,bool:xp.boolTag,float:ls.float,floatExp:ls.floatExp,floatNaN:ls.floatNaN,floatTime:yi.floatTime,int:us.int,intHex:us.intHex,intOct:us.intOct,intTime:yi.intTime,map:sc.map,merge:Vt.merge,null:Cp.nullTag,omap:cc.omap,pairs:lc.pairs,seq:oc.seq,set:uc.set,timestamp:yi.timestamp},Rp={"tag:yaml.org,2002:binary":ac.binary,"tag:yaml.org,2002:merge":Vt.merge,"tag:yaml.org,2002:omap":cc.omap,"tag:yaml.org,2002:pairs":lc.pairs,"tag:yaml.org,2002:set":uc.set,"tag:yaml.org,2002:timestamp":yi.timestamp};function Np(t,e,n){let i=ic.get(e);if(i&&!t)return n&&!i.includes(Vt.merge)?i.concat(Vt.merge):i.slice();let r=i;if(!r)if(Array.isArray(t))r=[];else{let s=Array.from(ic.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)r=r.concat(s);else typeof t=="function"&&(r=t(r.slice()));return n&&(r=r.concat(Vt.merge)),r.reduce((s,o)=>{let a=typeof o=="string"?rc[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(rc).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}fs.coreKnownTags=Rp;fs.getTags=Np});var ms=v(dc=>{"use strict";var ds=N(),Ap=pt(),Op=mt(),jp=Wt(),vi=fc(),Tp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,ps=class t{constructor({compat:e,customTags:n,merge:i,resolveKnownTags:r,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?vi.getTags(e,"compat"):e?vi.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=r?vi.coreKnownTags:{},this.tags=vi.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,ds.MAP,{value:Ap.map}),Object.defineProperty(this,ds.SCALAR,{value:jp.string}),Object.defineProperty(this,ds.SEQ,{value:Op.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Tp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};dc.Schema=ps});var mc=v(pc=>{"use strict";var Ip=N(),hs=Dt(),Jt=It();function $p(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=hs.createStringifyContext(t,e),{commentString:s}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(Jt.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(Ip.isNode(t.contents)){if(t.contents.spaceBefore&&i&&n.push(""),t.contents.commentBefore){let f=s(t.contents.commentBefore);n.push(Jt.indentComment(f,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=hs.stringify(t.contents,r,()=>a=null,c);a&&(l+=Jt.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(hs.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
58
+ `)?(n.push("..."),n.push(Jt.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(Jt.indentComment(s(c),"")))}return n.join(`
59
+ `)+`
60
+ `}pc.stringifyDocument=$p});var Ht=v(hc=>{"use strict";var qp=jt(),gt=Mn(),re=N(),Lp=Pe(),Dp=Ce(),Mp=ms(),Fp=mc(),gs=$n(),Wp=br(),Bp=Tt(),ws=vr(),ys=class t{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,re.NODE_TYPE,{value:re.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=s;let{version:o}=s;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ws.Directives({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,r,i)}clone(){let e=Object.create(t.prototype,{[re.NODE_TYPE]:{value:re.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=re.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){wt(this.contents)&&this.contents.add(e)}addIn(e,n){wt(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let i=gs.anchorNames(this);e.anchor=!n||i.has(n)?gs.findNewAnchor(n||"a",i):n}return new qp.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=y=>typeof y=="number"||y instanceof String||y instanceof Number,g=n.filter(m).map(String);g.length>0&&(n=n.concat(g)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:f}=i??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=gs.createNodeAnchors(this,o||"a"),w={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:h},p=Bp.createNode(e,f,w);return a&&re.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,i={}){let r=this.createNode(e,null,i),s=this.createNode(n,null,i);return new Lp.Pair(r,s)}delete(e){return wt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return gt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):wt(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return re.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return gt.isEmptyPath(e)?!n&&re.isScalar(this.contents)?this.contents.value:this.contents:re.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return re.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return gt.isEmptyPath(e)?this.contents!==void 0:re.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=gt.collectionFromPath(this.schema,[e],n):wt(this.contents)&&this.contents.set(e,n)}setIn(e,n){gt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=gt.collectionFromPath(this.schema,Array.from(e),n):wt(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 ws.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 ws.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 Mp.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:s,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=Dp.toJS(this.contents,n??"",a);if(typeof s=="function")for(let{count:l,res:f}of a.anchors.values())s(f,l);return typeof o=="function"?Wp.applyReviver(o,{"":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 Fp.stringifyDocument(this,e)}};function wt(t){if(re.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}hc.Document=ys});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}},vs=class extends Gt{constructor(e,n,i){super("YAMLParseError",e,n,i)}},bs=class extends Gt{constructor(e,n,i){super("YAMLWarning",e,n,i)}},Kp=(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 s=r-1,o=t.substring(e.lineStarts[i-1],e.lineStarts[i]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){let a=Math.min(s-39,o.length-79);o="…"+o.substring(a),s-=a-1}if(o.length>80&&(o=o.substring(0,79)+"…"),i>1&&/^ *$/.test(o.substring(0,s))){let a=t.substring(e.lineStarts[i-2],e.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`…
61
+ `),o=a+o}if(/[^ ]/.test(o)){let a=1,c=n.linePos[1];c?.line===i&&c.col>r&&(a=Math.max(1,Math.min(c.col-r,80-s)));let l=" ".repeat(s)+"^".repeat(a);n.message+=`:
62
+
63
+ ${o}
64
+ ${l}
65
+ `}};zt.YAMLError=Gt;zt.YAMLParseError=vs;zt.YAMLWarning=bs;zt.prettifyError=Kp});var Xt=v(gc=>{"use strict";function Yp(t,{flow:e,indicator:n,next:i,offset:r,onError:s,parentIndent:o,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",h=!1,w=!1,p=null,m=null,g=null,y=null,k=null,C=null,x=null;for(let b of t)switch(w&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&s(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),w=!1),p&&(l&&b.type!=="comment"&&b.type!=="newline"&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),b.type){case"space":!e&&(n!=="doc-start"||i?.type!=="flow-collection")&&b.source.includes(" ")&&(p=b),f=!0;break;case"comment":{f||s(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let M=b.source.substring(1)||" ";u?u+=d+M:u=M,d="",l=!1;break}case"newline":l?u?u+=b.source:(!C||n!=="seq-item-ind")&&(c=!0):d+=b.source,l=!0,h=!0,(m||g)&&(y=b),f=!0;break;case"anchor":m&&s(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&s(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=b,x??(x=b.offset),l=!1,f=!1,w=!0;break;case"tag":{g&&s(b,"MULTIPLE_TAGS","A node can have at most one tag"),g=b,x??(x=b.offset),l=!1,f=!1,w=!0;break}case n:(m||g)&&s(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),C&&s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),C=b,l=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){k&&s(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=b,l=!1,f=!1;break}default:s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,f=!1}let P=t[t.length-1],j=P?P.offset+P.source.length:r;return w&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&s(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:C,spaceBefore:c,comment:u,hasNewline:h,anchor:m,tag:g,newlineAfterProp:y,end:j,start:x??j}}gc.resolveProps=Yp});var bi=v(wc=>{"use strict";function ks(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(ks(e.key)||ks(e.value))return!0}return!1;default:return!0}}wc.containsNewline=ks});var Ss=v(yc=>{"use strict";var Up=bi();function Vp(t,e,n){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&Up.containsNewline(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}yc.flowIndentCheck=Vp});var Cs=v(bc=>{"use strict";var vc=N();function Jp(t,e,n){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let r=typeof i=="function"?i:(s,o)=>s===o||vc.isScalar(s)&&vc.isScalar(o)&&s.value===o.value;return e.some(s=>r(s.key,n))}bc.mapIncludes=Jp});var _c=v(xc=>{"use strict";var kc=Pe(),Hp=Ne(),Sc=Xt(),Gp=bi(),Cc=Ss(),zp=Cs(),Ec="All mapping items must start at the same column";function Qp({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??Hp.YAMLMap,a=new o(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=Sc.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",Ec)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
67
+ `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||Gp.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",Ec);n.atKey=!0;let g=p.end,y=d?t(n,d,p,r):e(n,g,u,null,p,r);n.schema.compat&&Cc.flowIndentCheck(i.indent,d,r),n.atKey=!1,zp.mapIncludes(n,a.items,y)&&r(g,"DUPLICATE_KEY","Map keys must be unique");let k=Sc.resolveProps(h??[],{indicator:"map-value-ind",next:w,offset:y.range[2],onError:r,parentIndent:i.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=k.end,k.found){m&&(w?.type==="block-map"&&!k.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<k.found.offset-1024&&r(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=w?t(n,w,k,r):e(n,c,h,null,k,r);n.schema.compat&&Cc.flowIndentCheck(i.indent,w,r),c=C.range[2];let x=new kc.Pair(y,C);n.options.keepSourceTokens&&(x.srcToken=f),a.items.push(x)}else{m&&r(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(y.comment?y.comment+=`
68
+ `+k.comment:y.comment=k.comment);let C=new kc.Pair(y);n.options.keepSourceTokens&&(C.srcToken=f),a.items.push(C)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}xc.resolveBlockMap=Qp});var Rc=v(Pc=>{"use strict";var Xp=Ae(),Zp=Xt(),em=Ss();function tm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??Xp.YAMLSeq,a=new o(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=Zp.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&&em.flowIndentCheck(i.indent,u,r),c=h.range[2],a.items.push(h)}return a.range=[i.offset,c,l??c],a}Pc.resolveBlockSeq=tm});var yt=v(Nc=>{"use strict";function nm(t,e,n,i){let r="";if(t){let s=!1,o="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":s=!0;break;case"comment":{n&&!s&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=c.substring(1)||" ";r?r+=o+f:r=f,o="";break}case"newline":r&&(o+=c),s=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:r,offset:e}}Nc.resolveEnd=nm});var Tc=v(jc=>{"use strict";var im=N(),rm=Pe(),Ac=Ne(),sm=Ae(),om=yt(),Oc=Xt(),am=bi(),cm=Cs(),Es="Block collections are not allowed within flow collections",xs=t=>t&&(t.type==="block-map"||t.type==="block-seq");function lm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=i.start.source==="{",a=o?"flow map":"flow sequence",c=s?.nodeClass??(o?Ac.YAMLMap:sm.YAMLSeq),l=new c(n.schema);l.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let g=i.items[m],{start:y,key:k,sep:C,value:x}=g,P=Oc.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:k??C?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!P.found){if(!P.anchor&&!P.tag&&!C&&!x){m===0&&P.comma?r(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<i.items.length-1&&r(P.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),P.comment&&(l.comment?l.comment+=`
69
+ `+P.comment:l.comment=P.comment),u=P.end;continue}!o&&n.options.strict&&am.containsNewline(k)&&r(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)P.comma&&r(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(P.comma||r(P.start,"MISSING_CHAR",`Missing , between ${a} items`),P.comment){let j="";e:for(let b of y)switch(b.type){case"comma":case"space":break;case"comment":j=b.source.substring(1);break e;default:break e}if(j){let b=l.items[l.items.length-1];im.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
+ `+j:b.comment=j,P.comment=P.comment.substring(j.length+1)}}if(!o&&!C&&!P.found){let j=x?t(n,x,P,r):e(n,P.end,C,null,P,r);l.items.push(j),u=j.range[2],xs(x)&&r(j.range,"BLOCK_IN_FLOW",Es)}else{n.atKey=!0;let j=P.end,b=k?t(n,k,P,r):e(n,j,y,null,P,r);xs(k)&&r(b.range,"BLOCK_IN_FLOW",Es),n.atKey=!1;let M=Oc.resolveProps(C??[],{flow:a,indicator:"map-value-ind",next:x,offset:b.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(M.found){if(!o&&!P.found&&n.options.strict){if(C)for(let F of C){if(F===M.found)break;if(F.type==="newline"){r(F,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}P.start<M.found.offset-1024&&r(M.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else x&&("source"in x&&x.source?.[0]===":"?r(x,"MISSING_CHAR",`Missing space after : in ${a}`):r(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let Se=x?t(n,x,M,r):M.found?e(n,M.end,C,null,M,r):null;Se?xs(x)&&r(Se.range,"BLOCK_IN_FLOW",Es):M.comment&&(b.comment?b.comment+=`
71
+ `+M.comment:b.comment=M.comment);let at=new rm.Pair(b,Se);if(n.options.keepSourceTokens&&(at.srcToken=g),o){let F=l;cm.mapIncludes(n,F.items,b)&&r(j,"DUPLICATE_KEY","Map keys must be unique"),F.items.push(at)}else{let F=new Ac.YAMLMap(n.schema);F.flow=!0,F.items.push(at);let To=(Se??b).range;F.range=[b.range[0],To[1],To[2]],l.items.push(F)}u=Se?Se.range[2]:M.end}}let d=o?"}":"]",[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),g=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",g),h&&h.source.length!==1&&w.unshift(h)}if(w.length>0){let m=om.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}jc.resolveFlowCollection=lm});var $c=v(Ic=>{"use strict";var um=N(),fm=q(),dm=Ne(),pm=Ae(),mm=_c(),hm=Rc(),gm=Tc();function _s(t,e,n,i,r,s){let o=n.type==="block-map"?mm.resolveBlockMap(t,e,n,i,s):n.type==="block-seq"?hm.resolveBlockSeq(t,e,n,i,s):gm.resolveFlowCollection(t,e,n,i,s),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function wm(t,e,n,i,r){let s=i.tag,o=s?e.directives.tagName(s.source,d=>r(s,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=i,w=d&&s?d.offset>s.offset?d:s:d??s;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(!s||!o||o==="!"||o===dm.YAMLMap.tagName&&a==="map"||o===pm.YAMLSeq.tagName&&a==="seq")return _s(t,e,n,r,o);let c=e.schema.tags.find(d=>d.tag===o&&d.collection===a);if(!c){let d=e.schema.knownTags[o];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?r(s,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),_s(t,e,n,r,o)}let l=_s(t,e,n,r,o,c),f=c.resolve?.(l,d=>r(s,"TAG_RESOLVE_FAILED",d),e.options)??l,u=um.isNode(f)?f:new fm.Scalar(f);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}Ic.composeCollection=wm});var Rs=v(qc=>{"use strict";var Ps=q();function ym(t,e,n){let i=e.offset,r=vm(e,t.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let s=r.mode===">"?Ps.Scalar.BLOCK_FOLDED:Ps.Scalar.BLOCK_LITERAL,o=e.source?bm(e.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=r.chomp==="+"&&o.length>0?`
73
+ `.repeat(Math.max(1,o.length-1)):"",m=i+r.length;return e.source&&(m+=e.source.length),{value:p,type:s,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,g]=o[p];if(g===""||g==="\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+g.length+1}for(let p=o.length-1;p>=a;--p)o[p][0].length>c&&(a=p+1);let u="",d="",h=!1;for(let p=0;p<f;++p)u+=o[p][0].slice(c)+`
74
+ `;for(let p=f;p<a;++p){let[m,g]=o[p];l+=m.length+g.length+1;let y=g[g.length-1]==="\r";if(y&&(g=g.slice(0,-1)),g&&m.length<c){let C=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(l-g.length-(y?2:1),"BAD_INDENT",C),m=""}s===Ps.Scalar.BLOCK_LITERAL?(u+=d+m.slice(c)+g,d=`
75
+ `):m.length>c||g[0]===" "?(d===" "?d=`
76
+ `:!h&&d===`
77
+ `&&(d=`
78
+
79
+ `),u+=d+m.slice(c)+g,d=`
80
+ `,h=!0):g===""?d===`
81
+ `?u+=`
82
+ `:d=`
83
+ `:(u+=d+g,d=" ",h=!1)}switch(r.chomp){case"-":break;case"+":for(let p=a;p<o.length;++p)u+=`
84
+ `+o[p][0].slice(c);u[u.length-1]!==`
85
+ `&&(u+=`
86
+ `);break;default:u+=`
87
+ `}let w=i+r.length+e.source.length;return{value:u,type:s,comment:r.comment,range:[i,w,w]}}function vm({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],s=r[0],o=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);!o&&w?o=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:s,indent:o,chomp:a,comment:f,length:u}}function bm(t){let e=t.split(/\n( *)/),n=e[0],i=n.match(/^( *)/),s=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)s.push([e[o],e[o+1]]);return s}qc.resolveBlockScalar=ym});var As=v(Dc=>{"use strict";var Ns=q(),km=yt();function Sm(t,e,n){let{offset:i,type:r,source:s,end:o}=t,a,c,l=(d,h,w)=>n(i+d,h,w);switch(r){case"scalar":a=Ns.Scalar.PLAIN,c=Cm(s,l);break;case"single-quoted-scalar":a=Ns.Scalar.QUOTE_SINGLE,c=Em(s,l);break;case"double-quoted-scalar":a=Ns.Scalar.QUOTE_DOUBLE,c=xm(s,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+s.length,i+s.length]}}let f=i+s.length,u=km.resolveEnd(o,f,e,n);return{value:c,type:a,comment:u.comment,range:[i,f,u.offset]}}function Cm(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}`),Lc(t)}function Em(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Lc(t.slice(1,-1)).replace(/''/g,"'")}function Lc(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
+ `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
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],s=" ",o=e.lastIndex;for(n.lastIndex=o;i=n.exec(t);)i[1]===""?s===`
90
+ `?r+=s:s=`
91
+ `:(r+=s+i[1],s=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,i=a.exec(t),r+s+(i?.[1]??"")}function xm(t,e){let n="";for(let i=1;i<t.length-1;++i){let r=t[i];if(!(r==="\r"&&t[i+1]===`
92
+ `))if(r===`
93
+ `){let{fold:s,offset:o}=_m(t,i);n+=s,i=o}else if(r==="\\"){let s=t[++i],o=Pm[s];if(o)n+=o;else if(s===`
94
+ `)for(s=t[i+1];s===" "||s===" ";)s=t[++i+1];else if(s==="\r"&&t[i+1]===`
95
+ `)for(s=t[++i+1];s===" "||s===" ";)s=t[++i+1];else if(s==="x"||s==="u"||s==="U"){let a=s==="x"?2:s==="u"?4:8;n+=Rm(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 s=i,o=t[i+1];for(;o===" "||o===" ";)o=t[++i+1];o!==`
96
+ `&&!(o==="\r"&&t[i+2]===`
97
+ `)&&(n+=i>s?t.slice(s,i+1):r)}else n+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function _m(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
98
+ `||i==="\r")&&!(i==="\r"&&t[e+2]!==`
99
+ `);)i===`
100
+ `&&(n+=`
101
+ `),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Pm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Rm(t,e,n,i){let r=t.substr(e,n),o=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let a=t.substr(e-2,n+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Dc.resolveFlowScalar=Sm});var Wc=v(Fc=>{"use strict";var He=N(),Mc=q(),Nm=Rs(),Am=As();function Om(t,e,n,i){let{value:r,type:s,comment:o,range:a}=e.type==="block-scalar"?Nm.resolveBlockScalar(t,e,i):Am.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[He.SCALAR]:c?l=jm(t.schema,r,c,n,i):e.type==="scalar"?l=Tm(t,r,e,i):l=t.schema[He.SCALAR];let f;try{let u=l.resolve(r,d=>i(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=He.isScalar(u)?u:new Mc.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);i(n??e,"TAG_RESOLVE_FAILED",d),f=new Mc.Scalar(r)}return f.range=a,f.source=r,s&&(f.type=s),c&&(f.tag=c),l.format&&(f.format=l.format),o&&(f.comment=o),f}function jm(t,e,n,i,r){if(n==="!")return t[He.SCALAR];let s=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(e))return a;let o=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[He.SCALAR])}function Tm({atKey:t,directives:e,schema:n},i,r,s){let o=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(i))||n[He.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(i))??n[He.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),f=`Value may be parsed as either ${c} or ${l}`;s(r,"TAG_RESOLVE_FAILED",f,!0)}}return o}Fc.composeScalar=Om});var Kc=v(Bc=>{"use strict";function Im(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}Bc.emptyScalarPosition=Im});var Vc=v(js=>{"use strict";var $m=jt(),qm=N(),Lm=$c(),Yc=Wc(),Dm=yt(),Mm=Kc(),Fm={composeNode:Uc,composeEmptyNode:Os};function Uc(t,e,n,i){let r=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:c}=n,l,f=!0;switch(e.type){case"alias":l=Wm(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=Yc.composeScalar(t,e,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Lm.composeCollection(Fm,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=Os(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&&(!qm.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"),s&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&f&&(l.srcToken=e),l}function Os(t,e,n,i,{spaceBefore:r,comment:s,anchor:o,tag:a,end:c},l){let f={type:"scalar",offset:Mm.emptyScalarPosition(e,n,i),indent:-1,source:""},u=Yc.composeScalar(t,f,a,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),s&&(u.comment=s,u.range[2]=c),u}function Wm({options:t},{offset:e,source:n,end:i},r){let s=new $m.Alias(n.substring(1));s.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&r(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+n.length,a=Dm.resolveEnd(i,o,t.strict,r);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}js.composeEmptyNode=Os;js.composeNode=Uc});var Gc=v(Hc=>{"use strict";var Bm=Ht(),Jc=Vc(),Km=yt(),Ym=Xt();function Um(t,e,{offset:n,start:i,value:r,end:s},o){let a=Object.assign({_directives:e},t),c=new Bm.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=Ym.resolveProps(i,{indicator:"doc-start",next:r??s?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?Jc.composeNode(l,r,f,o):Jc.composeEmptyNode(l,f.end,i,null,f,o);let u=c.contents.range[2],d=Km.resolveEnd(s,u,!1,o);return d.comment&&(c.comment=d.comment),c.range=[n,u,d.offset],c}Hc.composeDoc=Um});var Is=v(Xc=>{"use strict";var Vm=An("process"),Jm=vr(),Hm=Ht(),Zt=Qt(),zc=N(),Gm=Gc(),zm=yt();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 Qc(t){let e="",n=!1,i=!1;for(let r=0;r<t.length;++r){let s=t[r];switch(s[0]){case"#":e+=(e===""?"":i?`
103
+
104
+ `:`
105
+ `)+(s.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 Ts=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,s)=>{let o=en(n);s?this.warnings.push(new Zt.YAMLWarning(o,i,r)):this.errors.push(new Zt.YAMLParseError(o,i,r))},this.directives=new Jm.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:i,afterEmptyLine:r}=Qc(this.prelude);if(i){let s=e.contents;if(n)e.comment=e.comment?`${e.comment}
106
+ ${i}`:i;else if(r||e.directives.docStart||!s)e.commentBefore=i;else if(zc.isCollection(s)&&!s.flow&&s.items.length>0){let o=s.items[0];zc.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i}
107
+ ${a}`:i}else{let o=s.commentBefore;s.commentBefore=o?`${i}
108
+ ${o}`:i}}if(n){for(let s=0;s<this.errors.length;++s)e.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)e.warnings.push(this.warnings[s])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Qc(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(Vm.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,i,r)=>{let s=en(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",i,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Gm.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=zm.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 Hm.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}}};Xc.Composer=Ts});var tl=v(ki=>{"use strict";var Qm=Rs(),Xm=As(),Zm=Qt(),Zc=Lt();function eh(t,e=!0,n){if(t){let i=(r,s,o)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(a,s,o);else throw new Zm.YAMLParseError([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Xm.resolveFlowScalar(t,e,i);case"block-scalar":return Qm.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function th(t,e){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:s=-1,type:o="PLAIN"}=e,a=Zc.stringifyString({type:o,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
+ `}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
111
+ `),f=a.substring(0,l),u=a.substring(l+1)+`
112
+ `,d=[{type:"block-scalar-header",offset:s,indent:i,source:f}];return el(d,c)||d.push({type:"newline",offset:-1,indent:i,source:`
113
+ `}),{type:"block-scalar",offset:s,indent:i,props:d,source:u}}case'"':return{type:"double-quoted-scalar",offset:s,indent:i,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:s,indent:i,source:a,end:c};default:return{type:"scalar",offset:s,indent:i,source:a,end:c}}}function nh(t,e,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:s=!1,type:o}=n,a="indent"in t?t.indent:null;if(i&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=Zc.stringifyString({type:o,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":ih(t,c);break;case'"':$s(t,c,"double-quoted-scalar");break;case"'":$s(t,c,"single-quoted-scalar");break;default:$s(t,c,"scalar")}}function ih(t,e){let n=e.indexOf(`
114
+ `),i=e.substring(0,n),r=e.substring(n+1)+`
115
+ `;if(t.type==="block-scalar"){let s=t.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=i,t.source=r}else{let{offset:s}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:o,source:i}];el(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
116
+ `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:r})}}function el(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 $s(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 s of i)s.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(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:n,indent:i,source:e,end:r})}}}ki.createScalarToken=th;ki.resolveAsScalar=eh;ki.setScalarValue=nh});var il=v(nl=>{"use strict";var rh=t=>"type"in t?Ci(t):Si(t);function Ci(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=Ci(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Si(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Si(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Si(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 Si({start:t,key:e,sep:n,value:i}){let r="";for(let s of t)r+=s.source;if(e&&(r+=Ci(e)),n)for(let s of n)r+=s.source;return i&&(r+=Ci(i)),r}nl.stringify=rh});var al=v(ol=>{"use strict";var qs=Symbol("break visit"),sh=Symbol("skip children"),rl=Symbol("remove item");function Ge(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),sl(Object.freeze([]),t,e)}Ge.BREAK=qs;Ge.SKIP=sh;Ge.REMOVE=rl;Ge.itemAtPath=(t,e)=>{let n=t;for(let[i,r]of e){let s=n?.[i];if(s&&"items"in s)n=s.items[r];else return}return n};Ge.parentCollection=(t,e)=>{let n=Ge.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 sl(t,e,n){let i=n(e,t);if(typeof i=="symbol")return i;for(let r of["key","value"]){let s=e[r];if(s&&"items"in s){for(let o=0;o<s.items.length;++o){let a=sl(Object.freeze(t.concat([[r,o]])),s.items[o],n);if(typeof a=="number")o=a-1;else{if(a===qs)return qs;a===rl&&(s.items.splice(o,1),o-=1)}}typeof i=="function"&&r==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}ol.visit=Ge});var Ei=v(ee=>{"use strict";var Ls=tl(),oh=il(),ah=al(),Ds="\uFEFF",Ms="",Fs="",Ws="",ch=t=>!!t&&"items"in t,lh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function uh(t){switch(t){case Ds:return"<BOM>";case Ms:return"<DOC>";case Fs:return"<FLOW_END>";case Ws:return"<SCALAR>";default:return JSON.stringify(t)}}function fh(t){switch(t){case Ds:return"byte-order-mark";case Ms:return"doc-mode";case Fs:return"flow-error-end";case Ws:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
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}ee.createScalarToken=Ls.createScalarToken;ee.resolveAsScalar=Ls.resolveAsScalar;ee.setScalarValue=Ls.setScalarValue;ee.stringify=oh.stringify;ee.visit=ah.visit;ee.BOM=Ds;ee.DOCUMENT=Ms;ee.FLOW_END=Fs;ee.SCALAR=Ws;ee.isCollection=ch;ee.isScalar=lh;ee.prettyToken=uh;ee.tokenType=fh});var Ys=v(ll=>{"use strict";var tn=Ei();function ae(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var cl=new Set("0123456789ABCDEFabcdef"),dh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),xi=new Set(",[]{}"),ph=new Set(` ,[]{}
121
+ \r `),Bs=t=>!t||ph.has(t),Ks=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
+ `?!0:n==="\r"?this.buffer[e+1]===`
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
+ `||!r&&!this.atEnd)return e+i+1}return n===`
125
+ `||i>=this.indentNext||!n&&!this.atEnd?e+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&ae(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 s=e[i-1];if(s===" "||s===" "){n=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let s=e[n-1];if(s===" "||s===" ")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==="...")&&ae(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&&!ae(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===":")&&ae(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(Bs),"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("..."))&&ae(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 s=0;for(;r[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),r[s]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-s),"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(Bs),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ae(o)||o===",")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 s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let i=this.buffer.substring(0,n),r=i.indexOf(`
127
+ `,this.pos);if(r!==-1){for(;r!==-1;){let s=this.continueScalar(r+1);if(s===-1)break;r=i.indexOf(`
128
+ `,s)}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=>ae(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,i;e:for(let s=this.pos;i=this.buffer[s];++s)switch(i){case" ":n+=1;break;case`
129
+ `:e=s,n=0;break;case"\r":{let o=this.buffer[s+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
130
+ `)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(`
131
+ `,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(i=this.buffer[r];i===" ";)i=this.buffer[++r];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
132
+ `;)i=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let s=e-1,o=this.buffer[s];o==="\r"&&(o=this.buffer[--s]);let a=s;for(;o===" ";)o=this.buffer[--s];if(o===`
133
+ `&&s>=this.pos&&s+1+n>a)e=s;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 s=this.buffer[i+1];if(ae(s)||e&&xi.has(s))break;n=i}else if(ae(r)){let s=this.buffer[i+1];if(r==="\r"&&(s===`
134
+ `?(i+=1,r=`
135
+ `,s=this.buffer[i+1]):n=i),s==="#"||e&&xi.has(s))break;if(r===`
136
+ `){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&xi.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(Bs),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(ae(i)||n&&xi.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(;!ae(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(dh.has(n))n=this.buffer[++e];else if(n==="%"&&cl.has(this.buffer[e+1])&&cl.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
+ `?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)}};ll.Lexer=Ks});var Vs=v(ul=>{"use strict";var Us=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 s=n+i>>1;this.lineStarts[s]<e?n=s+1:i=s}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}}}};ul.LineCounter=Us});var Hs=v(hl=>{"use strict";var mh=An("process"),fl=Ei(),hh=Ys();function Oe(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function dl(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 ml(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 _i(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 vt(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 Pi(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 pl(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,ml(e.value)?e.value.end?Pi(e.value.end,e.sep):e.value.end=e.sep:Pi(e.start,e.sep),delete e.sep)}var Js=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 hh.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,mh.env.LOG_TOKENS&&console.log("|",fl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=fl.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"&&pl(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&&dl(r.start)===-1&&(n.indent===0||r.start.every(s=>s.type!=="comment"||s.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":{dl(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=_i(this.peek(2)),i=vt(n),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let s={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]=s}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
+ `)+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)){Pi(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",s=[];if(r&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(s.push(this.sourceToken),e.items.push({start:s}),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?(s.push(this.sourceToken),e.items.push({start:s,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:s,key:null,sep:[this.sourceToken]}]});else if(ml(n.key)&&!Oe(n.sep,"newline")){let o=vt(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:o,key:a,sep:c}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(Oe(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=vt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?e.items.push({start:s,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 o=this.flowScalar(this.type);r||n.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.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:s});this.stack.push(o);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)){Pi(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=_i(i),s=vt(r);pl(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};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
+ `)+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=_i(e),i=vt(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=_i(e),i=vt(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())}}};hl.Parser=Js});var bl=v(rn=>{"use strict";var gl=Is(),gh=Ht(),nn=Qt(),wh=jr(),yh=N(),vh=Vs(),wl=Hs();function yl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new vh.LineCounter||null,prettyErrors:e}}function bh(t,e={}){let{lineCounter:n,prettyErrors:i}=yl(e),r=new wl.Parser(n?.addNewLine),s=new gl.Composer(e),o=Array.from(s.compose(r.parse(t)));if(i&&n)for(let a of o)a.errors.forEach(nn.prettifyError(t,n)),a.warnings.forEach(nn.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function vl(t,e={}){let{lineCounter:n,prettyErrors:i}=yl(e),r=new wl.Parser(n?.addNewLine),s=new gl.Composer(e),o=null;for(let a of s.compose(r.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new nn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(nn.prettifyError(t,n)),o.warnings.forEach(nn.prettifyError(t,n))),o}function kh(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=vl(t,n);if(!r)return null;if(r.warnings.forEach(s=>wh.warn(r.options.logLevel,s)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function Sh(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 yh.isDocument(t)&&!i?t.toString(n):new gh.Document(t,i,n).toString(n)}rn.parse=kh;rn.parseAllDocuments=bh;rn.parseDocument=vl;rn.stringify=Sh});var ze=v(A=>{"use strict";var Ch=Is(),Eh=Ht(),xh=ms(),Gs=Qt(),_h=jt(),je=N(),Ph=Pe(),Rh=q(),Nh=Ne(),Ah=Ae(),Oh=Ei(),jh=Ys(),Th=Vs(),Ih=Hs(),Ri=bl(),kl=Rt();A.Composer=Ch.Composer;A.Document=Eh.Document;A.Schema=xh.Schema;A.YAMLError=Gs.YAMLError;A.YAMLParseError=Gs.YAMLParseError;A.YAMLWarning=Gs.YAMLWarning;A.Alias=_h.Alias;A.isAlias=je.isAlias;A.isCollection=je.isCollection;A.isDocument=je.isDocument;A.isMap=je.isMap;A.isNode=je.isNode;A.isPair=je.isPair;A.isScalar=je.isScalar;A.isSeq=je.isSeq;A.Pair=Ph.Pair;A.Scalar=Rh.Scalar;A.YAMLMap=Nh.YAMLMap;A.YAMLSeq=Ah.YAMLSeq;A.CST=Oh;A.Lexer=jh.Lexer;A.LineCounter=Th.LineCounter;A.Parser=Ih.Parser;A.parse=Ri.parse;A.parseAllDocuments=Ri.parseAllDocuments;A.parseDocument=Ri.parseDocument;A.stringify=Ri.stringify;A.visit=kl.visit;A.visitAsync=kl.visitAsync});var Ni=G(()=>{"use strict"});function Te(t){return t!==0&&t!==0n&&t!=="0"}function Ai(t,e){return Te(t.dev)&&Te(e.dev)&&Te(t.ino)&&Te(e.ino)}function ge(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 Oi=G(()=>{"use strict"});import{randomUUID as $h}from"crypto";import{promises as B}from"fs";import V from"path";function bt(t,e){let n=V.relative(t,e);return n===""||!V.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${V.sep}`)}function Ti(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function qh(t,e){return ge(t,Ti(e))}function ji(t,e){let n=Ti(t),i=Ti(e);return Ai(n,i)?ge(n,i):ge(n,i)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Ii(t){let e=await B.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 B.realpath(t),...Ti(e)}}async function Ie(t){for(let e of t){let n=await B.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!qh(e,n)||await B.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function Lh(t,e){let n=V.resolve(t),i=V.resolve(e);if(!bt(n,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await Ii(n)],s=V.relative(n,i).split(V.sep).filter(Boolean),o=n;for(let a of s){await Ie(r),o=V.join(o,a);try{await B.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Ii(o);if(!bt(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await Ie(r),r}async function Dh(t,e){let n=V.resolve(t),i=V.resolve(e);if(!bt(n,i))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await Ii(n)],s=V.relative(n,i).split(V.sep).filter(Boolean),o=n;for(let a of s){o=V.join(o,a);try{let c=await Ii(o);if(!bt(r[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${o}`);r.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await Ie(r),r}async function Sl(t){let e;try{e=await B.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 Mh(t,e,n){let i=V.dirname(t),r=await Lh(n.containedRoot,i),s=V.join(i,`.${V.basename(t)}.${$h()}.tmp`),o,a;try{await n.beforeTemporaryOpen?.(),o=await B.open(s,"wx"),a=await o.stat();let[c,l]=await Promise.all([B.lstat(s),B.realpath(s)]);if(await Ie(r),!c.isFile()||c.isSymbolicLink()||!ji(a,c)||!bt(r[0].realPath,l))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await o.writeFile(e,"utf8"):await o.writeFile(e),await o.sync(),!ji(a,await o.stat()))throw new Error("Contained atomic write temporary file changed while writing");await o.close(),o=void 0,await n.beforeCommit?.(),await Ie(r);let f=await B.lstat(s);if(!f.isFile()||f.isSymbolicLink()||!ji(f,a))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await B.link(s,t),await B.unlink(s)):await B.rename(s,t),await Sl(i)}catch(c){await o?.close();try{await Ie(r),await B.rm(s,{force:!0})}catch{}throw c}}async function we(t,e,n){await Mh(t,e,n)}async function zs(t,e){let n=V.dirname(t),i=await Dh(e.containedRoot,n);if(!i)return!1;let r,s;try{r=await B.lstat(t),s=await B.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!bt(i[0].realPath,s))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await Ie(i);let[o,a]=await Promise.all([B.lstat(t),B.realpath(t)]);if(!o.isFile()||o.isSymbolicLink()||!ji(r,o)||a!==s)throw new Error("Contained file removal target changed before removal");return await B.unlink(t),await Ie(i),await Sl(n),!0}var kt=G(()=>{"use strict";Oi()});var Cl=G(()=>{"use strict"});var Qs=G(()=>{"use strict";Ni()});var El=G(()=>{"use strict";Ni();Qs()});import $i from"path";function Jh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||$i.posix.isAbsolute(n)||$i.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 qi(t){let e=Jh(t,"native.artifact_root");return e.length===0?".":e.join("/")}function _l(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 Qe(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||$i.posix.isAbsolute(i)||$i.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(s=>s===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(s=>s===""||s==="."))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 sn(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Pl(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 Rl(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>Zs)throw new Error(`${e} exceeds ${Zs} 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>eo)throw new Error(`${e} contains more than ${eo} wildcard tokens`);return t}function xl(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=>Rl(i,e)))].sort((i,r)=>i.localeCompare(r,"en"))}function Xs(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 Hh(t){if(t===void 0)return{...ye,include:[...ye.include],exclude:[...ye.exclude]};let e=sn(t,"native.snapshot");return{include:xl(e.include,"native.snapshot.include",ye.include),exclude:xl(e.exclude,"native.snapshot.exclude",ye.exclude),max_files:Xs(e.max_files,ye.max_files,"native.snapshot.max_files"),max_total_bytes:Xs(e.max_total_bytes,ye.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Xs(e.max_duration_ms,ye.max_duration_ms,"native.snapshot.max_duration_ms")}}function Gh(t){if(t===void 0)return;let e=sn(t,"native.pending_root_move"),n=e.id,i=e.from_artifact_root,r=e.to_artifact_root,s=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(s!=="copying"&&s!=="ready"&&s!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let a=sn(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");o={kind:c,state:l,manifestHash:f}}return{id:n,fromArtifactRoot:qi(i),toArtifactRoot:qi(r),stage:s,...o?{cleanup:o}:{}}}function zh(t){let e=sn(t,"native");if(typeof e.artifact_root!="string")throw new Error("native.artifact_root must be a string");let n=e.clarification_mode??"sequential";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let i=e.archive_confirmation??"automatic";if(i!=="automatic"&&i!=="required")throw new Error("native.archive_confirmation must be automatic or required");let r=e.max_verify_failures??Uh;if(!Number.isSafeInteger(r)||r<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Gh(e.pending_root_move);return{artifact_root:qi(e.artifact_root),language:Pl(e.language,"en","native.language"),clarification_mode:n,archive_confirmation:i,max_verify_failures:r,snapshot:Hh(e.snapshot),...s?{pending_root_move:s}:{}}}function Qh(t){let e=sn(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:_l(e.artifact_layout),language:Pl(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:i,auto_transition: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){let s=t.schema!==void 0;if(!(s||t.default_workflow!==void 0||t.workflows!==void 0||!r.allowPartialProject&&t.native!==void 0)||r.allowPartialProject&&!s)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 a=t.workflows??[t.default_workflow];if(!Array.isArray(a)||a.length===0||a.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(a)];if(!c.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!e)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:c,ambient_resume:i,...e?{native:e}:{},...n?{classic:n}:{}}}function on(t,e={}){let n=(0,to.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,s=Xh(r.ambient_resume),o=r.native===void 0?void 0:zh(r.native),a=r.classic===void 0?void 0:Qh(r.classic),c=Zh(r,o,a,s,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:s,...o?{native:o}:{},...a?{classic:a}:{}}}var to,Li,Zs,eo,Uh,Vh,ye,$e=G(()=>{"use strict";to=ct(ze(),1),Li=64*1024,Zs=1024,eo=64,Uh=5,Vh=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],ye={include:["**/*"],exclude:[...Vh],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});import{constants as Di,promises as Xe}from"fs";function no(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Nl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function an(t){return{dev:t.dev,ino:t.ino,birthtime:no(t)}}function Mi(t,e){let n=an(t),i=an(e);return Ai(n,i)?ge(n,i):ge(n,i)&&no(t)===no(e)&&Nl(t)===Nl(e)&&t.size===e.size}async function Al(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,s=await Xe.lstat(t,{bigint:r});if(!s.isFile()||s.isSymbolicLink())throw new qe("not-regular-file",`${i} must be a regular file`);if(BigInt(s.size)>BigInt(e))throw new qe("too-large",`${i} exceeds ${e} bytes`);let o=await Xe.realpath(t);await n.verify?.("pre-open",{realPath:o,identity:an(s)});let a=process.platform==="win32"?Di.O_RDONLY:Di.O_RDONLY|Di.O_NOFOLLOW|Di.O_NONBLOCK,c;try{c=await Xe.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}),Xe.lstat(t,{bigint:r}),Xe.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==o||!Mi(s,l)||!Mi(s,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 y=e+1-h,{bytesRead:k}=await c.read(w,0,Math.min(w.length,y),null);if(k===0)break;if(h+=k,h>e)throw new qe("too-large",`${i} exceeds ${e} bytes`);d.push(Buffer.from(w.subarray(0,k)))}await n.hooks?.beforeFinalCheck?.();let[p,m,g]=await Promise.all([c.stat({bigint:r}),Xe.lstat(t,{bigint:r}),Xe.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||g!==o||!Mi(s,p)||!Mi(s,m))throw new qe("changed",`${i} changed while reading`);return await n.verify?.("post-read",{realPath:g,identity:an(p)}),{bytes:Buffer.concat(d,h),stat:p,realPath:g}}finally{await c.close()}}var qe,Ol=G(()=>{"use strict";Oi();qe=class extends Error{reason;constructor(e,n,i){super(n,i),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Fi}from"fs";import Le from"path";function eg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function io(t,e){let n=Le.relative(t,e);return n===""||!Le.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${Le.sep}`)}async function jl(t,e){let n=Le.resolve(t),i=await Fi.lstat(n);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Fi.realpath(n)}async function Tl(t,e,n,i){let r=t;for(let s=0;s<n.length;s++){r=Le.join(r,n[s]);let o;try{o=await Fi.lstat(r)}catch(f){if(eg(f))return{exists:!1,kind:"missing"};throw f}let a=Le.relative(t,r).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${a}`);let c=s===n.length-1;if(!c&&!o.isDirectory())throw new Error(`${i.label} ancestor ${a} must be a real directory`);if(c&&(i.expected==="file"&&!o.isFile()||i.expected==="directory"&&!o.isDirectory()||i.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${i.label} must be a real ${i.expected}`);let l=await Fi.realpath(r);if(!io(e,l))throw new Error(`${i.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function L(t,e,n){let i=Qe(e,n.label),r=Le.resolve(t),s=await jl(r,n.label),o=i.split("/"),a=Le.resolve(r,...o);if(!io(r,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Tl(r,s,o,n);return{projectRoot:r,target:a,relative:i,exists:c.exists,kind:c.kind}}async function Wi(t,e,n){return(await L(t,e,{...n,expected:"file"})).exists}async function z(t,e,n,i){let r=await L(t,e,{label:i.label,expected:"file"});if(!r.exists){let o=new Error(`${i.label} does not exist`);throw o.code="ENOENT",o}let s=await jl(r.projectRoot,i.label);return Al(r.target,n,{...i,verify:async(o,a)=>{if(!io(s,a.realPath))throw new Error(`${i.label} resolves outside the project root`);await Tl(r.projectRoot,s,r.relative.split("/"),{label:i.label,expected:"file"})}})}var de=G(()=>{"use strict";Ol();$e()});import{createHash as tg}from"crypto";function ng(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function De(t,e={}){return(await Bi(t,e)).document}async function ig(t){try{return(await z(t,cn,Li,{label:cn})).bytes}catch(e){if(ng(e))return null;throw e}}function rg(t){return t?{exists:!0,sha256:tg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Bi(t,e={}){let n=await ig(t);return{document:n?on(n.toString("utf8"),e):null,identity:rg(n)}}var cn,Ze=G(()=>{"use strict";$e();de();cn=".comet/config.yaml"});var dk,ro=G(()=>{"use strict";kt();Ze();de();dk=16*1024});var so=G(()=>{"use strict";kt();$e();Ze();de();ro()});var ql=G(()=>{"use strict";Ni();kt();Cl();El();$e();de();Ze();so();ro();Qs()});import{TextDecoder as fg}from"util";function Ll(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function dg(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 oo(t,e,n,i,r={}){try{let s=await z(t,e,n,{label:i,hooks:r.hooks});return{result:s,text:dg(s,i)}}catch(s){let o=s.code;if(o==="ENOENT"||o==="ENOTDIR")return null;throw s}}async function ln(t,e,n,i,r={}){return(await oo(t,e,n,i,r))?.text??null}async function et(t,e,n,i,r,s={}){if(Buffer.byteLength(n,"utf8")>i)throw new Error(`${r} exceeds ${i} bytes`);let o=await oo(t,e,i,r),a=await L(t,e,{label:r,expected:"file"});await we(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await s.beforeCommit?.();let c=await oo(t,e,i,r);if(!(!o&&!c)){if(!o||!c)throw new Error(`${r} changed before commit`);if(o.result.realPath!==c.result.realPath||!ge(Ll(o.result.stat),Ll(c.result.stat))||o.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function Ki(t,e,n,i,r,s={}){let o=await ln(t,e,i,r);await et(t,e,`${o??""}${n}`,i,r,s)}async function ao(t,e,n,i={}){let r=await L(t,e,{label:n,expected:"file"});return r.exists?zs(r.target,{containedRoot:r.projectRoot,beforeRemove:i.beforeRemove}):!1}var Yi=G(()=>{"use strict";ql();Oi()});var Ql={};of(Ql,{RUN_STATE_FILE:()=>Zi,applyRunStateToDocument:()=>po,readRunState:()=>mo,removeRunState:()=>ho,runStateFromDocument:()=>Xi,writeRunState:()=>er});import Fg from"path";function Sn(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 kn(t,e){let n=Sn(t,e);if(Fg.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 Wg(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 Xi(t){if(!t.run_id)return null;let e=Sn(t,"run_id"),n=Sn(t,"skill"),i=Sn(t,"skill_version"),r=Sn(t,"skill_hash"),s=kn(t,"pending_ref"),o=kn(t,"trajectory_ref"),a=kn(t,"context_ref"),c=kn(t,"artifacts_ref"),l=kn(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:Gl(t,"current_step"),iteration:f,pending:Gl(t,"pending"),pendingRef:s,trajectoryRef:o,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Wg(t)}}function po(t,e){e?t.run_id=e.runId:delete t.run_id}function Bg(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 Kg(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 Xi(e)}async function mo(t,e={}){let n=await ln(t,Zi,zl,"Run state",e);if(n===null)return null;let i=JSON.parse(n);return Kg(i)}async function er(t,e,n={}){await et(t,Zi,JSON.stringify(Bg(e),null,2),zl,"Run state",n)}async function ho(t,e={}){await ao(t,Zi,"Run state",e)}var Gl,Zi,zl,tr=G(()=>{"use strict";Yi();Gl=(t,e)=>{let n=t[e];return n==null?null:String(n)};Zi=".comet/run-state.json",zl=256*1024});var Hu=ct(ze(),1);import{spawnSync as Sy}from"child_process";import{createHash as Ju}from"crypto";import{promises as Cy}from"fs";import T from"path";import Ji from"path";Yi();import Ui from"path";var un={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function fn(t,e){if(Ui.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Ui.resolve(t),i=Ui.resolve(n,e);if(i!==n&&!i.startsWith(n+Ui.sep))throw new Error("Run path must stay inside the change directory")}async function dn(t,e,n,i={}){fn(t,e),await Ki(t,e,`${JSON.stringify(n)}
143
+ `,un.trajectory,"Run trajectory",i)}async function Vi(t,e,n={}){fn(t,e);let i=await ln(t,e,un.trajectory,"Run trajectory",n);return i===null?[]:i.split(/\r?\n/).map((r,s)=>({line:r,number:s+1})).filter(({line:r})=>r.length>0).map(({line:r,number:s})=>{try{return JSON.parse(r)}catch(o){throw new Error(`Invalid Trajectory event at line ${s}`,{cause:o})}})}async function Dl(t,e,n,i={}){fn(t,e),await et(t,e,JSON.stringify(n,null,2)+`
144
+ `,un.artifacts,"Run artifacts",i)}async function Ml(t,e,n,i={}){fn(t,e),await et(t,e,n,un.context,"Run context",i)}async function Fl(t,e,n,i={}){fn(t,e),await et(t,e,JSON.stringify(n,null,2)+`
145
+ `,un.checkpoint,"Run checkpoint",i)}function pg(t){if(t!=="build"&&t!=="verify")throw new Error(`Invalid command check scope: '${String(t)}'`)}function mg(t,e="."){if(e.trim().length===0)throw new Error("Command check cwd cannot be blank");let n=Ji.resolve(t),i=Ji.resolve(n,e);if(i!==n&&!i.startsWith(n+Ji.sep))throw new Error(`Command check cwd must resolve within the project root: '${e}'`);return Ji.relative(n,i).replaceAll("\\","/")||"."}function hg(t,e){if(e.type!=="command_check_recorded")return null;let n=e.data;if(typeof n!="object"||n===null||Array.isArray(n))return null;let{scope:i,command:r,exitCode:s,cwd:o}=n;if(i!=="build"&&i!=="verify"||typeof r!="string"||r.trim().length===0||!Number.isInteger(s)||typeof o!="string")return null;let a;try{a=mg(t,o)}catch{return null}return{sequence:e.sequence,timestamp:e.timestamp,runId:e.runId,scope:i,command:r,exitCode:s,cwd:a}}async function Wl(t,e,n,i){pg(i);let r=await Vi(e,n.trajectoryRef);for(let s=r.length-1;s>=0;s-=1){let o=r[s];if(o.runId!==n.runId)continue;let a=hg(t,o);if(a?.scope===i)return a}return null}import{promises as Ag}from"fs";import ve from"path";import{promises as yg}from"fs";import $ from"path";import{promises as gg}from"fs";async function pn(t){try{return await gg.access(t),!0}catch(e){if(wg(e))return!1;throw e}}function wg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}$e();Ze();so();de();var mn=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},co=class extends Error{constructor(n,i,r){let s=H(r,n),o=H(r,i);super(`Classic layout conflict: both ${s}/ and ${o}/ exist; run comet doctor and resolve the conflict before writing`);this.configuredRoot=n;this.alternateRoot=i;this.name="ClassicLayoutConflictError"}configuredRoot;alternateRoot;code="classic-layout-conflict"},Bl=".comet/config.yaml";function vg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Kl(t){await L(t,Bl,{label:Bl,expected:"file"})}function Yl(t,e){let n=$.resolve(t),i=e==="docs"?$.join(n,"docs"):n,r=$.join(i,"openspec"),s=$.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:i,openSpecRoot:r,changesDir:$.join(r,"changes"),archiveDir:$.join(r,"changes","archive"),specsDir:$.join(r,"specs"),superpowersRoot:s,superpowersSpecsDir:$.join(s,"specs"),superpowersPlansDir:$.join(s,"plans"),superpowersReportsDir:$.join(s,"reports")}}async function bg(t){await Kl(t);let e=await De(t,{allowPartialProject:!0});if(!e?.config)throw new mn;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new mn("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function kg(t,e){return Yl(t,e??await bg(t))}async function Sg(t,e){let n=await kg(t,e),i=n.artifactLayout==="legacy"?"docs":"legacy",r=Yl(t,i).openSpecRoot,[s,o]=await Promise.all([L(n.projectRoot,H(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),L(n.projectRoot,H(n.projectRoot,r),{label:"Alternate Classic OpenSpec root",expected:"directory"})]),a=s.exists,c=o.exists;return{paths:n,configuredRootExists:a,alternateRoot:r,alternateRootExists:c,dualRoots:a&&c}}async function Cg(t,e){let n=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,e,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let i of n){let r=H(t.projectRoot,i);await L(t.projectRoot,r,{label:`Classic managed physical path ${r}`,expected:"directory"})}}async function tt(t,e,n={}){let i=await Sg(t,e);if(await Cg(i.paths,i.alternateRoot),i.dualRoots&&!n.allowAlternateRoot)throw new co(i.paths.openSpecRoot,i.alternateRoot,i.paths.projectRoot);if(!i.configuredRootExists){let r=H(i.paths.projectRoot,i.paths.openSpecRoot),s=H(i.paths.projectRoot,i.alternateRoot);throw new mn(`Configured Classic OpenSpec root is missing: ${r} (alternate ${s} is ${i.alternateRootExists?"present":"missing"})`)}return i.paths}async function lo(t,e,n={}){let i=$.join($.resolve(t),".comet","classic-root-move.json");if(await pn(i))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let r=await tt(t,e,n);if(!await pn(r.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${H(r.projectRoot,r.openSpecRoot)}`);return r}async function nt(t){let e=$.resolve(t),n=null;try{(await yg.lstat(e)).isDirectory()||(e=$.dirname(e))}catch(i){if(!vg(i))throw i}for(;;){$.basename(e)==="openspec"&&(n=$.dirname(e));let i=$.join(e,".comet","config.yaml"),r=!1;if(await pn(i))try{await Kl(e);let o=(await De(e))?.value;r=!!o&&typeof o=="object"&&!Array.isArray(o)&&(o.schema==="comet.project.v1"||o.default_workflow!==void 0||o.native!==void 0)}catch{}if(r||await pn($.join(e,".git")))return e;let s=$.dirname(e);if(s===e)return n??$.resolve(t);e=s}}function H(t,e){return $.relative($.resolve(t),e).replaceAll("\\","/")}de();$e();import yn from"path";import{promises as xg}from"fs";import Gi from"path";kt();$e();de();import hn from"path";var Eg=2*1024*1024;function Ul(t,e,n){let i=hn.resolve(t),r=hn.isAbsolute(e)?hn.resolve(e):hn.resolve(i,e),s=hn.relative(i,r).replaceAll("\\","/");return{root:i,relative:Qe(s,n),target:r}}async function Me(t,e,n){let i=Ul(t,e,n.label);return L(i.root,i.relative,n)}async function gn(t,e,n){return(await Me(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function Vl(t,e,n,i){return await gn(t,e,{label:n,expected:"file"})?(await Hi(t,e,{label:n,hooks:i})).byteLength>0:!1}async function te(t,e,n){return(await Hi(t,e,n)).toString("utf8")}async function Hi(t,e,n){let i=Ul(t,e,n.label);return(await z(i.root,i.relative,n.maxBytes??Eg,{label:n.label,hooks:n.hooks})).bytes}function wn(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}'
146
+ Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function fo(t){let e=wn(t);if(e)throw new Error(e)}function _g(t,e){return{label:H(t,e),directory:e}}async function uo(t,e,n){let i=_g(t,e);if(!(await Me(t,e,{label:n,expected:"directory"})).exists)return{change:i,exists:!1,stateExists:!1};let s=await Me(t,Gi.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:i,exists:!0,stateExists:s.exists}}function Pg(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function Rg(t,e,n,i={}){if(!i.skipExactCompatibility){let o=await uo(t,Gi.join(e,n),`Classic archived change ${n}`);if(o.exists)return o.change}if(!(await Me(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let s=[];for(let o of await xg.readdir(e,{withFileTypes:!0})){if(!Pg(o.name,n))continue;let a=await uo(t,Gi.join(e,o.name),`Classic archived change ${o.name}`);a.exists&&a.stateExists&&s.push(a.change)}return s.sort((o,a)=>a.directory.localeCompare(o.directory))[0]??null}async function zi(t,e=process.cwd()){fo(t);let n=await tt(e),i=await uo(n.projectRoot,Gi.join(n.changesDir,t),`Classic active change ${t}`);if(i.exists)return i.change;let r=await Rg(n.projectRoot,n.archiveDir,t);return r||i.change}function Ng(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Jl(t,e,n,i){let r=Qe(n,"Classic handoff artifact pointer");if((await L(t,r,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let o=await tt(t),a=`${H(t,o.changesDir)}/`,l=(o.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(y=>r.startsWith(y));if(!l)return null;let f=r.slice(l.length).split("/");if(f.length<4||f[1]!==".comet"||f.slice(2).some(y=>y.length===0))return null;let u=f[0];fo(u);let d=f.slice(2),h=yn.resolve(e);if(yn.dirname(h)!==yn.resolve(o.archiveDir))return null;let w=yn.basename(h),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(w);if(w!==u&&p?.[1]!==u)return null;await L(t,H(t,h),{label:"Classic archived change directory",expected:"directory"});let m=yn.join(h,".comet",...d),g=H(t,m);try{return await z(t,g,i,{label:"Historical Classic archived handoff artifact"}),g}catch(y){if(Ng(y))return null;throw y}}de();var Hl=2*1024*1024;function vn(t,e){return ve.relative(t,e).split(ve.sep).join("/")}async function bn(t,e,n){if(!n)return{code:e,satisfied:!1};let i=n.replaceAll("\\","/");try{let r=await Wi(t,i,{label:`${e} artifact`});return{code:e,satisfied:r,source:i,...r?{resolvedSource:i}:{}}}catch(r){return{code:e,satisfied:!1,source:i,detail:`unsafe artifact pointer outside the project or through a special path: ${r instanceof Error?r.message:String(r)}`}}}async function Og(t,e,n){try{await tt(t)}catch(r){return{code:"design.handoff",satisfied:!1,...n?{source:n.replaceAll("\\","/")}:{},detail:`Classic layout is unsafe or unavailable for handoff evidence: ${r instanceof Error?r.message:String(r)}`}}let i=await bn(t,"design.handoff",n);if(!n||i.satisfied||i.detail)return i;try{let r=await Jl(t,e,n,Hl);return r?{...i,satisfied:!0,resolvedSource:r,detail:`resolved historical legacy pointer from archived change: ${r}`}:i}catch(r){return{...i,satisfied:!1,detail:`unsafe archived handoff fallback: ${r instanceof Error?r.message:String(r)}`}}}async function Qi(t,e,n){return bn(t,e,vn(t,n))}async function jg(t,e){let n=ve.join(e,"specs"),i;try{let o=vn(t,n);if(!(await L(t,o,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};i=await Ag.readdir(n)}catch(o){return o.code==="ENOENT"?{code:"openspec.delta-spec",satisfied:!1}:{code:"openspec.delta-spec",satisfied:!1,detail:`unsafe delta-spec path: ${o instanceof Error?o.message:String(o)}`}}let r=i.map(o=>ve.join(n,o,"spec.md")),s=(await Promise.all(r.map(async o=>{try{return await Wi(t,vn(t,o),{label:"OpenSpec delta spec"})?o:null}catch{return null}}))).filter(o=>o!==null);return{code:"openspec.delta-spec",satisfied:s.length>0,source:s[0]?vn(t,s[0]):void 0,detail:`${s.length} delta spec${s.length===1?"":"s"}`}}async function Tg(t,e){let n,i=vn(t,e);try{n=(await z(t,i,Hl,{label:"Classic tasks artifact"})).bytes.toString("utf8")}catch(o){return o.code==="ENOENT"?{code:"build.tasks-complete",satisfied:!1}:{code:"build.tasks-complete",satisfied:!1,source:i,detail:`unsafe tasks artifact: ${o instanceof Error?o.message:String(o)}`}}let r=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],s=r.filter(o=>o[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:r.length>0&&s===r.length,source:i,detail:`${s} of ${r.length} tasks complete`}}function it(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function Fe(t,e){let n=await nt(t),i=e.classic,r=ve.join(t,"proposal.md"),s=ve.join(t,"design.md"),o=ve.join(t,"tasks.md"),a=e.run?ve.resolve(t,e.run.checkpointRef):ve.join(t,".comet","checkpoint.json"),c=await Promise.all([Qi(n,"openspec.proposal",r),Qi(n,"openspec.design",s),Qi(n,"openspec.tasks",o),jg(n,t),bn(n,"design.document",i?.designDoc??null),bn(n,"build.plan",i?.plan??null),Tg(n,o),bn(n,"verification.report",i?.verificationReport??null),Og(n,t,i?.handoffContext??null),Qi(n,"run.checkpoint",a)]),l=c.find(f=>f.code==="design.handoff");return l&&!i?.handoffHash&&(l.satisfied=!1,l.detail="handoff hash is missing"),c.push({code:"archive.confirmed",satisfied:i?.archiveConfirmation==="confirmed"}),c}import{promises as _u}from"fs";import ie from"path";import{fileURLToPath as Pu}from"url";import{createHash as $w,randomUUID as qw}from"crypto";import{promises as Co}from"fs";import be from"path";function Ig(t){return t.classicProfile??t.workflow}function $g(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 qg(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function Lg(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!it(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!$g(e))return"full.build.configure"}else if(!qg(e))throw new Error(`${t} build configuration is incomplete`);return it(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function Dg(t,e,n){return e.verifyResult!=="pass"||!it(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Mg(t,e){if(e.verifyResult!=="pass")throw new Error("archive requires verify_result=pass");return e.archiveConfirmation==="confirmed"?`${t}.archive.execute`:`${t}.archive.confirm`}function St(t,e){let n=Ig(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 it(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return Lg(n,t,e);case"verify":return Dg(n,t,e);case"archive":return Mg(n,t)}}var rr=ct(ze(),1);kt();de();import ir from"path";tr();var Xl=["full","hotfix","tweak"],rt=1,Yg=["open","design","build","verify","archive"],Ug=["en","zh-CN"],Vg=["off","beta"],Jg=["subagent-driven-development","executing-plans","direct"],Hg=["plan-ready"],Gg=["confirmed"],zg=["tdd","direct"],Qg=["off","standard","thorough"],Xg=["current","branch","worktree"],Zg=["light","full"],ew=["pending","pass","fail"],tw=["pending","handled"],nw=["pending","confirmed"],Et=["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"],wo=["run_id"],iw=new Set([...Et,...wo]),rw=["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 Ct(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 Q(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 go(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 sw(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 nr(t,e){let n=Ct(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 ow(t,e){let n=Ct(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 aw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==rt)throw new Error(`Invalid Classic state: classic_migration must be ${rt}`);return e}function cw(t){if(!Et.some(n=>Zl(t,n)))return null;for(let n of rw)if(!Zl(t,n))return null;return{workflow:Q(t,"workflow",Xl,!1),language:Q(t,"language",Ug),phase:Q(t,"phase",Yg,!1),contextCompression:Q(t,"context_compression",Vg),buildMode:Q(t,"build_mode",Jg),buildPause:Q(t,"build_pause",Hg),subagentDispatch:Q(t,"subagent_dispatch",Gg),tddMode:Q(t,"tdd_mode",zg),reviewMode:Q(t,"review_mode",Qg),isolation:Q(t,"isolation",Xg),boundBranch:Ct(t,"bound_branch"),verifyMode:Q(t,"verify_mode",Zg),autoTransition:go(t,"auto_transition"),baseRef:Ct(t,"base_ref"),designDoc:nr(t,"design_doc"),plan:nr(t,"plan"),verifyResult:Q(t,"verify_result",ew,!1),verifyFailures:sw(t,"verify_failures"),verificationReport:nr(t,"verification_report"),branchStatus:Q(t,"branch_status",tw),createdAt:Ct(t,"created_at"),verifiedAt:Ct(t,"verified_at"),archiveConfirmation:Q(t,"archive_confirmation",nw),archived:go(t,"archived",!1),directOverride:go(t,"direct_override"),handoffContext:nr(t,"handoff_context"),handoffHash:ow(t,"handoff_hash"),classicProfile:Q(t,"classic_profile",Xl),classicMigration:aw(t)}}function yo(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=Xi(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:cw(t),run:n,unknownKeys:Object.keys(t).filter(i=>!iw.has(i))}}function eu(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}}tr();var lw=2*1024*1024;function Cn(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 tu(t,e,n){t.get(e)!==n&&t.set(e,n)}function uw(t,e){if(e.classic)for(let[n,i]of Object.entries(eu(e.classic)))tu(t,n,i);else for(let n of Et)t.delete(n);po(t.toJS(),e.run),e.run?tu(t,"run_id",e.run.runId):t.delete("run_id")}function fw(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 dw(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function nu(t){let e;try{e=(await z(ir.dirname(t),ir.basename(t),lw,{label:"Classic state document"})).bytes.toString("utf8")}catch(i){if(i.code!=="ENOENT")throw i;return new rr.Document({})}let n=(0,rr.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return Cn(n),n}async function We(t,e={}){let n=e.migrate!==!1,i=ir.join(t,".comet.yaml"),r=await nu(i),s=Cn(r),o=dw(r);o&&(s=Cn(r));let a=await mo(t);if(!a&&s.run_id&&s.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(tr(),Ql));a=c(s),a&&n&&(await er(t,a),fw(r),o=!0)}return o&&n&&await we(i,r.toString(),{containedRoot:t}),yo(Cn(r),a)}async function sr(t,e,n={}){let i=ir.join(t,".comet.yaml"),r=await nu(i);uw(r,{...e,unknownKeys:e.unknownKeys??[]}),yo(Cn(r),e.run??null),await we(i,r.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await er(t,e.run):await ho(t)}function iu(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:{}}}import{createHash as wu,randomUUID as Aw}from"crypto";import{promises as K}from"fs";import D from"path";var ou=ct(ze(),1);import{promises as vo}from"fs";import se from"path";var pw=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],mw=["deterministic","adaptive"],hw=["function","mcp","script","agent"],gw=["none","read","write","external"],ww=["progress","step","completion"],yw=["artifact_exists","state_equals"];function st(t,e,n){return new Error(`${t}: ${e} ${n}`)}function ne(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw st(e,n,"must be an object")}function Be(t,e,n){if(!Array.isArray(t))throw st(e,n,"must be an array")}function X(t,e,n){if(typeof t!="string")throw st(e,n,"must be a string")}function ce(t,e,n,i){e in t&&X(t[e],n,`${i}.${e}`)}function au(t,e,n,i){if(e in t&&typeof t[e]!="boolean")throw st(n,`${i}.${e}`,"must be a boolean")}function Ke(t,e,n,i){if(typeof t!="string"||!e.includes(t))throw st(n,i,`must be one of ${e.join(", ")}`)}function or(t,e,n){Be(t,e,n),t.forEach((i,r)=>{X(i,e,`${n}[${r}]`)})}function ru(t,e,n){ne(t,e,n),X(t.name,e,`${n}.name`),X(t.description,e,`${n}.description`),au(t,"required",e,n)}function vw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),ce(t,"source",e,n),ce(t,"version",e,n)}function bw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),X(t.role,e,`${n}.role`),ce(t,"instructions",e,n)}function kw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),Ke(t.kind,hw,e,`${n}.kind`),X(t.source,e,`${n}.source`),Ke(t.sideEffect,gw,e,`${n}.sideEffect`),au(t,"requiresConfirmation",e,n)}function Sw(t,e,n){ne(t,e,n),Ke(t.type,pw,e,`${n}.type`),ce(t,"ref",e,n),ce(t,"prompt",e,n),ce(t,"question",e,n),"options"in t&&or(t.options,e,`${n}.options`)}function Cw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),Sw(t.action,e,`${n}.action`),ce(t,"next",e,n),"completionEvals"in t&&or(t.completionEvals,e,`${n}.completionEvals`)}function Ew(t,e){let n="goal";ne(t,e,n),X(t.statement,e,`${n}.statement`),Be(t.inputs,e,`${n}.inputs`),t.inputs.forEach((i,r)=>{ru(i,e,`${n}.inputs[${r}]`)}),Be(t.outputs,e,`${n}.outputs`),t.outputs.forEach((i,r)=>{ru(i,e,`${n}.outputs[${r}]`)}),or(t.success,e,`${n}.success`)}function xw(t,e){let n="orchestration";ne(t,e,n),Ke(t.mode,mw,e,`${n}.mode`),ce(t,"entry",e,n),"steps"in t&&(Be(t.steps,e,`${n}.steps`),t.steps.forEach((i,r)=>{Cw(i,e,`${n}.steps[${r}]`)}))}function cu(t,e){return ne(t,e),Ke(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ke(t.kind,["Skill"],e,"kind"),ne(t.metadata,e,"metadata"),X(t.metadata.name,e,"metadata.name"),X(t.metadata.version,e,"metadata.version"),X(t.metadata.description,e,"metadata.description"),Ew(t.goal,e),xw(t.orchestration,e),Be(t.skills,e,"skills"),t.skills.forEach((n,i)=>{vw(n,e,`skills[${i}]`)}),Be(t.agents,e,"agents"),t.agents.forEach((n,i)=>{bw(n,e,`agents[${i}]`)}),Be(t.tools,e,"tools"),t.tools.forEach((n,i)=>{kw(n,e,`tools[${i}]`)}),t}function lu(t,e){ne(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&or(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw st(e,n,"must be a finite number");return t}function _w(t,e){return ne(t,e),"runtime"in t&&uu(t.runtime,e,"runtime"),t}function uu(t,e,n){return Be(t,e,n),t.forEach((i,r)=>{let s=`${n}[${r}]`;ne(i,e,s),X(i.id,e,`${s}.id`),Ke(i.scope,ww,e,`${s}.scope`),Ke(i.type,yw,e,`${s}.type`),ce(i,"artifact",e,s),ce(i,"field",e,s),ce(i,"equals",e,s)}),t}async function bo(t){let e=await vo.readFile(t,"utf8");try{return(0,ou.parse)(e)}catch(n){let i=n instanceof Error?n.message:String(n);throw st(t,"document",i)}}async function Pw(t){try{return await bo(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function su(t){try{return await vo.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Rw(t){let e=se.join(t,"checks.yaml"),n=se.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:_w(await bo(e),e)}:{document:null}}async function fu(t){let e=se.resolve(t.root),n=se.resolve(t.controlRoot);t.requireSkillMarkdown&&await vo.access(se.join(e,"SKILL.md"));let i=se.join(n,"skill.yaml"),r=se.join(n,"guardrails.yaml"),s=cu(await bo(i),i),o=await Pw(r),a=o===null?null:lu(o,r),c=await Rw(n),l={allowedSkills:s.skills.map(f=>f.id),allowedAgents:s.agents.map(f=>f.id),allowedTools:s.tools.map(f=>f.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:s.tools.filter(f=>f.requiresConfirmation).map(f=>f.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:s,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function du(t){let e=se.resolve(t);return fu({root:e,controlRoot:se.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function pu(t){let e=se.resolve(t);return fu({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function mu(t,e,n=se.join(e,"package.json")){ne(t,n);let i=t.packageKind==="runtime"?"runtime":void 0,r=cu(t.definition,n),s=lu(t.guardrails,n),o=uu(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:se.resolve(e),packageKind:i,definition:r,guardrails:{...a,...s},evals:o}}import hu from"path";function Nw(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 gu(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 s=n.orchestration.steps??[];if(n.orchestration.mode==="adaptive")(n.orchestration.entry||s.length>0)&&e.push("adaptive orchestration must not define entry or steps");else{let o=new Set;for(let a of s)o.has(a.id)&&e.push(`duplicate step id: ${a.id}`),o.add(a.id),Nw(a.action,t,e,a.id);(!n.orchestration.entry||!o.has(n.orchestration.entry))&&e.push(`orchestration.entry references unknown step: ${n.orchestration.entry??"(missing)"}`);for(let a of s){a.next&&!o.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 o of n.tools){if(o.kind!=="script")continue;let a=hu.posix.normalize(o.source.replaceAll("\\","/"));(hu.isAbsolute(o.source)||a===".."||a.startsWith("../"))&&e.push(`script tool ${o.id} must reference a relative path inside the Skill package`)}for(let o of i.allowedSkills)n.skills.some(a=>a.id===o)||e.push(`guardrails allow undeclared skill: ${o}`);for(let o of i.allowedAgents)n.agents.some(a=>a.id===o)||e.push(`guardrails allow undeclared agent: ${o}`);for(let o of i.allowedTools)n.tools.some(a=>a.id===o)||e.push(`guardrails allow undeclared tool: ${o}`);return e}function ar(t){return Array.isArray(t)?t.map(ar):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,ar(n)])):t}function Ow(t){return ar({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function jw(t){return D.posix.normalize(t.replaceAll("\\","/"))}function xt(t,e,n){let i=D.relative(t,e);if(!(i===""||!D.isAbsolute(i)&&!i.startsWith(`..${D.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function yu(t,e,n){let i=jw(e);if(D.posix.isAbsolute(i)||i===".."||i.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let r=D.resolve(t,...i.split("/"));xt(t,r,n);let s;try{s=await K.realpath(r)}catch(o){throw o.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:o}):o}if(xt(t,s,n),!(await K.stat(s)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:i,content:await K.readFile(s)}}async function Tw(t){let e=await K.realpath(t.root),n=t.packageKind==="runtime"?[]:[await yu(e,"SKILL.md","SKILL.md")];for(let i of t.definition.tools)i.kind==="script"&&n.push(await yu(e,i.source,`Script tool ${i.id}`));return n.sort((i,r)=>i.path.localeCompare(r.path))}function Iw(t,e){let n=e.map(i=>({path:i.path,sha256:wu("sha256").update(i.content).digest("hex")}));return wu("sha256").update(JSON.stringify(ar({package:t,files:n}))).digest("hex")}function ku(t){return JSON.stringify(t,null,2)+`
147
+ `}async function Su(t){let e=Ow(t),n=await Tw(t);return{document:e,files:n,hash:Iw(e,n)}}async function cr(t){return(await Su(t)).hash}async function vu(t){try{return await K.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function bu(t,e){try{if((await K.readFile(D.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await K.readFile(D.join(t,"package.json"),"utf8")!==ku(e.document))throw new Error("package mismatch");for(let r of e.files)if(!(await K.readFile(D.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 ko(t,e){let n=await Su(t),i=D.resolve(e,".comet","skill-snapshots"),r=D.join(i,n.hash);if(await K.mkdir(i,{recursive:!0}),await vu(r))return await bu(r,n),{hash:n.hash,snapshotDir:r};let s=D.join(i,`.tmp-${Aw()}`);xt(i,s,"Temporary snapshot"),xt(i,r,"Published snapshot");try{await K.mkdir(s);for(let o of n.files){let a=D.join(s,...o.path.split("/"));xt(s,a,`Snapshot file ${o.path}`),await K.mkdir(D.dirname(a),{recursive:!0}),await K.writeFile(a,o.content)}await K.writeFile(D.join(s,"package.json"),ku(n.document)),await K.writeFile(D.join(s,"sha256"),n.hash+`
148
+ `),await K.rename(s,r)}catch(o){if(await vu(r)){try{await bu(r,n)}finally{await K.rm(s,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:r}}throw await K.rm(s,{recursive:!0,force:!0}),o}return{hash:n.hash,snapshotDir:r}}async function So(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=D.resolve(t,".comet","skill-snapshots"),i=D.join(n,e);xt(n,i,"Skill snapshot");try{let r=(await K.readFile(D.join(i,"sha256"),"utf8")).trim();if(r!==e)throw new Error(`stored hash is ${r||"(empty)"}`);let s=D.join(i,"package.json"),o=JSON.parse(await K.readFile(s,"utf8")),a=mu(o,i,s),c=gu(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
149
+ `));let l=await cr(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 Cu(t){try{return await Co.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function Eu(t){return $w("sha256").update(t).digest("hex")}function Lw(t){return Eu(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function Dw(t){return t.replaceAll(".","_").replaceAll("-","_")}async function Mw(t,e){let n=await nt(t),i=Object.fromEntries(e.filter(o=>o.satisfied&&o.source).map(o=>[Dw(o.code),o.source])),r=be.join(t,"subagent-progress.md");await Cu(r)&&(i.subagent_progress=be.relative(n,r).split(be.sep).join("/"));let s=e.find(o=>o.code==="design.handoff"&&o.satisfied);return s?.source&&(i.handoff_context=s.source),i}function Fw(t,e,n){return[{sequence:1,timestamp:n,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:n,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:rt,profile:e,source:"pre-migration"}}]}async function Ww(t){await Promise.all(t.map(e=>Co.rm(e,{recursive:!0,force:!0})))}async function xu(t,e){let n=await We(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!==rt)throw new Error("Classic Run exists without a supported classic_migration marker");if(n.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${n.run.skill}`);if(await cr(e.skillPackage)!==n.run.skillHash)return await So(t,n.run.skillHash),{classic:i,run:n.run,evidence:await Fe(t,n),migrated:!1,snapshotDir:be.join(t,".comet","skill-snapshots",n.run.skillHash)};let d=await ko(e.skillPackage,t);return{classic:i,run:n.run,evidence:await Fe(t,n),migrated:!1,snapshotDir:d.snapshotDir}}let s=await Fe(t,n),o=St(i,s);if(!e.skillPackage.definition.orchestration.steps?.some(u=>u.id===o))throw new Error(`Classic Skill package does not define resolved step: ${o}`);let a=await cr(e.skillPackage),c=be.join(t,".comet","skill-snapshots",a),l=await Cu(c),f=[];try{let u=await ko(e.skillPackage,t),d=iu(e.skillPackage,e.runId?.()??qw(),u.hash);d.currentStep=o,o==="completed"&&(d.status="completed");let h={...i,classicProfile:r,classicMigration:rt},w=await Mw(t,s),p=await nt(t),m=s.find(C=>C.code==="design.handoff"&&C.satisfied),g=null;m?.source&&(g=await te(p,m.resolvedSource??m.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await Ml(t,d.contextRef,g),f.push(be.resolve(t,d.contextRef))),await Dl(t,d.artifactsRef,w),f.push(be.resolve(t,d.artifactsRef));let y=(e.now?.()??new Date).toISOString(),k={runId:d.runId,stateVersion:1,trajectoryOffset:2,contextHash:g===null?null:Eu(g),artifactsHash:Lw(w),createdAt:y};await Fl(t,d.checkpointRef,k),f.push(be.resolve(t,d.checkpointRef)),f.push(be.resolve(t,d.trajectoryRef));for(let C of Fw(d,r,y))await dn(t,d.trajectoryRef,C);return await sr(t,{classic:h,run:d,unknownKeys:n.unknownKeys}),{classic:h,run:d,evidence:s,migrated:!0,snapshotDir:u.snapshotDir}}catch(u){throw await Ww(f),l||await Co.rm(c,{recursive:!0,force:!0}),u}}async function Bw(t){try{return(await _u.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function lr(t){try{return(await _u.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Kw(t){return await Bw(t)?await lr(ie.join(t,"skill.yaml"))?!0:await lr(ie.join(t,"SKILL.md"))&&await lr(ie.join(t,"comet","skill.yaml")):!1}function Yw(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 Uw(){let t=ie.dirname(Pu(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,ie.resolve(t,"..","runtime","classic"),ie.resolve(t,"..","..","comet","runtime","classic"),ie.resolve(t,"..","..","assets","skills","comet","runtime","classic"),ie.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,ie.resolve(t,"..","..","comet-classic"),ie.resolve(t,"..","..","assets","skills","comet-classic"),ie.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await Kw(n))return n;return null}async function Vw(t){return await lr(ie.join(t,"skill.yaml"))?pu(t):du(t)}async function ur(t){let e=await Uw();return xu(t,{skillPackage:e?await Vw(e):Yw(ie.dirname(Pu(import.meta.url)))})}async function Ru(t){let e=await We(t),n=Array.from(new Set(e.unknownKeys)).sort();if(n.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${n.join(", ")}`);return ur(t)}async function Nu(t,e,n,i){let r=await We(t);if(!r.classic||!r.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let s=await Fe(t,{classic:e,run:n,unknownKeys:r.unknownKeys}),o=St(e,s),a={...n,currentStep:o,iteration:n.iteration+1,status:o==="completed"?"completed":"running"};await sr(t,{classic:e,run:a,unknownKeys:r.unknownKeys});let c=await Vi(t,a.trajectoryRef);return await dn(t,a.trajectoryRef,{sequence:c.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:a.runId,data:{kind:"classic",fromStep:n.currentStep,toStep:o,...i}}),a}var Au={"full.open":["openspec.proposal","openspec.tasks"],"full.design.handoff":["openspec.proposal","openspec.design","openspec.tasks"],"full.design.document":["design.handoff"],"full.build.plan":["openspec.tasks"],"full.build.plan-ready":["build.plan"],"full.build.configure":["build.plan"],"full.build.execute":["build.plan"],"full.build.complete":["build.tasks-complete"],"full.verify.run":["build.tasks-complete"],"full.verify.branch":["verification.report"],"full.archive.confirm":["verification.report"],"full.archive.execute":["archive.confirmed"]};function Jw(t){return Au[t]?Au[t]:t.endsWith(".open")?["openspec.proposal","openspec.tasks"]:t.endsWith(".build.execute")?[]:t.endsWith(".build.complete")?["build.tasks-complete"]:t.endsWith(".verify.run")?["build.tasks-complete"]:t.endsWith(".verify.branch")?["verification.report"]:t.endsWith(".archive.confirm")?["verification.report"]:t.endsWith(".archive.execute")?["archive.confirmed"]:[]}function Ou(t,e){let n=Jw(t),i=n.filter(r=>!it(e,r));return{stepId:t,passed:i.length===0,requiredEvidence:n,missingEvidence:i}}function Hw(t){switch(t){case"open":return"/comet-open";case"design":return"/comet-design";case"build":return"/comet-build";case"verify":return"/comet-verify";case"archive":return"/comet-archive";default:return null}}async function ju(t,e){try{let n=await Ru(t),i=await Fe(t,{classic:n.classic,run:n.run,unknownKeys:[]}),r=St(n.classic,i);return{name:e,valid:!0,workflow:n.classic.workflow,phase:n.classic.phase,currentStep:r,nextCommand:Hw(n.classic.phase),runtimeMode:"engine-projection",runtimeEval:Ou(r,i),evidence:i}}catch(n){return{name:e,valid:!1,workflow:"unknown",phase:"invalid",currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:n instanceof Error?n.message:String(n)}}}Yi();import Gw from"path";var zw=Gw.join(".comet","state-events.jsonl"),Qw=8*1024*1024;async function Tu(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Ki(t,zw,`${JSON.stringify(n)}
150
+ `,Qw,"Classic state event log"),n}var Xw={"open-complete":{event:"open-complete",from:"open",guardRefs:["open-artifacts-present"]},"design-complete":{event:"design-complete",from:"design",guardRefs:["design-evidence-present"]},"build-complete":{event:"build-complete",from:"build",guardRefs:["build-decisions-selected"]},"verify-pass":{event:"verify-pass",from:"verify",guardRefs:["verification-report-present"]},"verify-fail":{event:"verify-fail",from:"verify",guardRefs:["verification-failed"]},"archive-confirm":{event:"archive-confirm",from:"archive",guardRefs:["archive-final-confirmation"]},"archive-reopen":{event:"archive-reopen",from:"archive",guardRefs:["archive-not-finalized"]},archived:{event:"archived",from:"archive",guardRefs:["verify-result-pass","archive-confirmed"]},"preset-escalate":{event:"preset-escalate",from:"build",guardRefs:["preset-workflow"]}},Iu={open:"open-complete",design:"design-complete",build:"build-complete",verify:"verify-pass"};function Zw(t){return t.toISOString().slice(0,10)}function R(t,e,n,i){let r=t[n];t[n]=i,r!==i&&e.push({field:n,from:r,to:i})}function $u(t,e,n={}){let i=Xw[e];if(t.phase!==i.from)throw new Error(`Cannot apply ${e}: phase is '${t.phase}', expected '${i.from}'`);let r={...t},s=[],o=n.now??new Date;if(e==="open-complete")R(r,s,"phase",r.workflow==="full"?"design":"build");else if(e==="design-complete")R(r,s,"phase","build");else if(e==="build-complete"){let a=r.verifyResult==="fail";R(r,s,"phase","verify"),R(r,s,"verifyResult","pending"),R(r,s,"branchStatus","pending"),a||R(r,s,"verificationReport",null)}else if(e==="verify-pass")R(r,s,"verifyResult","pass"),R(r,s,"verifyFailures",0),R(r,s,"phase","archive"),R(r,s,"verifiedAt",Zw(o)),R(r,s,"archiveConfirmation","pending"),R(r,s,"branchStatus","pending");else if(e==="verify-fail")R(r,s,"verifyResult","fail"),R(r,s,"verifyFailures",r.verifyFailures+1),R(r,s,"phase","build"),R(r,s,"branchStatus","pending");else if(e==="preset-escalate"){if(r.workflow!=="hotfix"&&r.workflow!=="tweak")throw new Error(`Cannot apply ${e}: workflow must be hotfix or tweak, got '${r.workflow}'`);R(r,s,"workflow","full"),R(r,s,"classicProfile","full"),R(r,s,"phase","design"),R(r,s,"designDoc",null),R(r,s,"buildPause",null),R(r,s,"buildMode",null),R(r,s,"subagentDispatch",null),R(r,s,"tddMode",null),R(r,s,"reviewMode",null),R(r,s,"isolation",null),R(r,s,"boundBranch",null),R(r,s,"verifyMode",null),R(r,s,"directOverride",null)}else if(e==="archive-confirm"){if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);R(r,s,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);R(r,s,"verifyResult","pending"),R(r,s,"verifyFailures",0),R(r,s,"phase","verify"),R(r,s,"verifiedAt",null),R(r,s,"archiveConfirmation",null),R(r,s,"branchStatus","pending")}else{if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archiveConfirmation!=="confirmed")throw new Error(`Cannot apply ${e}: archiveConfirmation must be confirmed`);R(r,s,"archived",!0)}return{classic:r,effects:s,definition:i}}var Pn=ct(ze(),1);import Lu from"path";import{AsyncLocalStorage as ey}from"async_hooks";import{promises as qu}from"fs";import En from"path";var fr=new ey;function ty(t,e){let n=En.relative(t,e);return n===""||!En.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${En.sep}`)}async function ny(t){let e=En.resolve(t.invocationCwd??process.cwd()),n=En.resolve(t.projectRoot??await nt(e)),[i,r]=await Promise.all([qu.realpath(e),qu.realpath(n)]);if(!ty(r,i))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n}}async function dr(t,e){let n=fr.getStore();if(n)return e(n);let i=await ny(t);return fr.run(i,()=>e(i))}function I(){let t=fr.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function pr(){let t=fr.getStore();if(!t)throw new Error("Classic command invocation context is unavailable");return t.invocationCwd}var iy="\x1B[32m",xn="\x1B[31m",ry="\x1B[33m",sy="\x1B[0m",oy=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"],ay={workflow:["full","hotfix","tweak"],language:["en","zh-CN"],phase:["open","design","build","verify","archive"],context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct"],build_pause:["plan-ready"],subagent_dispatch:["confirmed"],tdd_mode:["tdd","direct"],review_mode:["off","standard","thorough"],isolation:["current","branch","worktree"],verify_mode:["light","full"],auto_transition:["true","false"],verify_result:["pending","pass","fail"],branch_status:["pending","handled"],archive_confirmation:["pending","confirmed"],archived:["true","false"],direct_override:["true","false"],classic_profile:["full","hotfix","tweak"],classic_migration:["1"]},cy=new Set([...Et,...wo,"classic_profile","classic_migration"]);function ot(t,e){return`${t}${e}${sy}`}function _n(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}var Du=async(t,e)=>dr(e,async()=>{let n=t[0],i=wn(n);if(i)return{exitCode:1,stderr:ot(xn,`ERROR: ${i}`)};let r=I(),{directory:s,label:o}=await zi(n,r),a=Lu.join(s,".comet.yaml"),c=[`[VALIDATE] ${o}/.comet.yaml`],l=0,f=0,u=m=>{l+=1,c.push(ot(xn,` FAIL: ${m}`))},d=m=>{f+=1,c.push(ot(ry,` WARN: ${m}`))},h;try{h=await te(r,a,{label:`Classic state ${o}/.comet.yaml`})}catch(m){if(m.code==="ENOENT")return u(".comet.yaml does not exist"),c.push("",ot(xn,`${l} error(s), ${f} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
151
+ `)};throw m}let w=(0,Pn.parseDocument)(h);if(w.errors.length>0||!(0,Pn.isMap)(w.contents)){for(let m of w.errors)u(m.message);return(0,Pn.isMap)(w.contents)||u("document root must be a mapping"),c.push("",ot(xn,`${l} error(s), ${f} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
152
+ `)}}let p=w.toJS();for(let m of oy)Object.prototype.hasOwnProperty.call(p,m)||u(`missing required field '${m}'`);for(let[m,g]of Object.entries(ay)){if(!Object.prototype.hasOwnProperty.call(p,m))continue;let y=_n(p[m]);if(!y){m==="auto_transition"&&u(`${m}='' is not valid. Expected: ${g.join(" ")}`);continue}g.includes(y)||u(`${m}='${y}' is not valid. Expected: ${g.join(" ")}`)}if(Object.prototype.hasOwnProperty.call(p,"bound_branch")){let m=p.bound_branch;m!==null&&typeof m!="string"&&u(`bound_branch='${_n(m)}' is not a string or null`)}if(Object.prototype.hasOwnProperty.call(p,"verify_failures")){let m=p.verify_failures;(typeof m!="number"||!Number.isInteger(m)||m<0)&&u(`verify_failures='${_n(m)}' is not a non-negative integer`)}for(let m of["design_doc","plan","handoff_context","verification_report"]){let g=_n(p[m]);if(g){if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(g)||g.split(/[\\/]/u).includes("..")){u(`${m}='${g}' must be a relative repository path`);continue}try{await gn(r,Lu.resolve(r,g),{label:`${m} artifact pointer`,expected:"file"})||u(`${m}='${g}' does not exist on disk`)}catch(y){u(`${m}='${g}' is unsafe: ${y instanceof Error?y.message:String(y)}`)}}}for(let m of["handoff_hash"]){let g=_n(p[m]);g&&!/^[a-f0-9]{64}$/u.test(g)&&u(`${m}='${g}' is not a sha256 hex digest`)}for(let m of Object.keys(p))cy.has(m)||d(`unknown field '${m}' found`);return c.push(""),l>0?(c.push(ot(xn,`${l} error(s), ${f} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
153
+ `)}):(c.push(ot(iy,`0 errors, ${f} warning(s) — validation PASSED`)),{exitCode:0,stderr:c.join(`
154
+ `)})});Ze();import ly from"os";import mr from"path";function uy(t={}){let e=t.cwd??process.cwd(),n=t.homeDir??ly.homedir(),i=[{file:mr.resolve(e,".comet","config.yaml"),source:".comet/config.yaml"},{file:mr.resolve(n,".comet","config.yaml"),source:"~/.comet/config.yaml"}];return i.filter((r,s)=>i.findIndex(o=>o.file===r.file)===s)}async function Mu(t,e={}){for(let n of uy(e)){let i=await De(mr.dirname(mr.dirname(n.file)),{allowPartialProject:!0});if(!i)continue;let r=i.value.classic;if(!r||typeof r!="object"||Array.isArray(r))continue;let s=r[t];if(s!=null)return{value:String(s),source:n.source}}return null}Ze();var xo=ct(ze(),1);import{execFileSync as Fu}from"child_process";import{randomUUID as py}from"crypto";import{promises as Rn}from"fs";import Wu from"path";var fy=null;function dy(t,e){let n=t;for(let i of e)n+="\0"+(typeof i=="string"?i:JSON.stringify(i));return n}function Eo(t,e){return(...n)=>{let i=fy;if(i===null)return e(...n);let r=dy(`sync:${t}`,n),s=i.entries.get(r);if(s)return s.value;let o=e(...n);return i.entries.set(r,{value:o}),o}}function my(t){try{let e=Fu("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}var hy=Eo("liveGitBranch",t=>my(t));function gy(t){try{return Fu("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var wy=Eo("isGitWorkTree",t=>gy(t)),yy=["current","branch","worktree"];function Bu(t){return yy.includes(t)}function vy(t){return Bu(t.isolation)?t.boundBranch===null&&t.currentBranch===null&&t.gitWorkTree===!1?{status:"not-applicable"}:t.boundBranch===null?t.currentBranch===null?{status:"unbound-detached"}:{status:"needs-heal",branch:t.currentBranch}:t.currentBranch===t.boundBranch?{status:"ok"}:{status:"drift",boundBranch:t.boundBranch,currentBranch:t.currentBranch}:{status:"not-applicable"}}async function Ku(t,e){let n=Wu.join(t,".comet.yaml"),i=(0,xo.parseDocument)(await Rn.readFile(n,"utf8"),{uniqueKeys:!1});if(i.errors.length>0)throw new Error(`Invalid .comet.yaml: ${i.errors[0].message}`);let r=i.toJS()??{},s=typeof r.isolation=="string"?r.isolation:null,o=typeof r.bound_branch=="string"&&r.bound_branch!==""?r.bound_branch:null,a=Bu(s),c=hy(e.cwd),l=a&&o===null&&c===null?wy(e.cwd):!0,f=vy({isolation:s,boundBranch:o,currentBranch:c,gitWorkTree:l});return f.status==="needs-heal"&&e.heal?(await by(t,f.branch),{status:"healed",branch:f.branch,bindingRequired:a,currentBranch:c}):{...f,bindingRequired:a,currentBranch:c}}async function by(t,e){let n=Wu.join(t,".comet.yaml"),i=(0,xo.parseDocument)(await Rn.readFile(n,"utf8"),{uniqueKeys:!1});i.set("bound_branch",e);let r=`${n}.${py()}.tmp`;try{await Rn.writeFile(r,i.toString(),"utf8"),await Rn.rename(r,n)}catch(s){throw await Rn.rm(r,{force:!0}),s}}function ky(t){return t??"detached HEAD"}function Yu(t,e,n){return`change '${t}' is bound to branch '${e}', but current branch is '${ky(n)}'.
155
+ Next: ask the user to confirm — switch back to '${e}', or run \`comet state rebind ${t}\` after explicit confirmation.`}function Uu(t){return`change '${t}' uses a branch-bound workspace mode but has no bound branch and HEAD is detached; checkout a branch first before continuing.`}var Ey="\x1B[32m",xy="\x1B[31m",_y="\x1B[33m",No="\x1B[0m",Py=["open","design","build","verify","archive"],Ry={open:"=== Guard: open → next ===",design:"=== Guard: design → build ===",build:"=== Guard: build → verify ===",verify:"=== Guard: verify → archive ===",archive:"=== Guard: archive completeness ==="},Ny={open:" [APPLY] .comet.yaml updated: phase=PLACEHOLDER",design:" [APPLY] .comet.yaml updated: phase=build",build:" [APPLY] .comet.yaml updated: phase=verify, verify_result=pending",verify:" [APPLY] .comet.yaml updated: phase=archive, verify_result=pass"},Ay={branchStatus:"branch_status",phase:"phase",verificationReport:"verification_report",verifiedAt:"verified_at",verifyResult:"verify_result"};function _t(t){return`${Ey}${t}${No}`}function ke(t){return`${xy}${t}${No}`}function Oy(t){return`${_y}${t}${No}`}function jy(t){return Ay[t]??String(t)}function Ty(t){return t===null?"null":t===void 0?"":typeof t=="object"?JSON.stringify(t):String(t)}var le=class extends Error{constructor(n,i=1){super(n);this.exitCode=i}exitCode},Ro=class{stderr=[];diagnostics;toResult(e=0){return{exitCode:e,...this.diagnostics?{stdout:JSON.stringify({diagnostics:this.diagnostics})+`
156
+ `}:{},...this.stderr.length>0?{stderr:this.stderr.join(`
157
+ `)+`
158
+ `}:{}}}};async function Y(t){let e=I();return gn(e,t,{label:`Classic guard path ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`})}async function J(t){let e=I();return Vl(e,t,`Classic guard file ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`)}function Iy(t){let e=wn(t);if(e)throw new le(ke(`ERROR: ${e}`))}async function $y(t){return(await zi(t,I())).directory}async function O(t,e){let n=T.join(t,".comet.yaml"),i=(0,Hu.parseDocument)(await te(I(),n,{label:`Classic state ${t}/.comet.yaml`}),{uniqueKeys:!1});if(i.errors.length>0)throw new le(`ERROR: Invalid .comet.yaml: ${i.errors[0].message}`);let s=i.toJS()[e];return s==null?"":typeof s=="object"?JSON.stringify(s):String(s)}async function qy(t,e){let n=await O(e,t);return n&&n!=="null"?n:(await Mu(t,{cwd:I()}))?.value??""}async function Ly(t){let e=await qy("language",t);if(!e)return"en";if(e==="en"||e==="zh-CN")return e;throw new Error(`configured language '${e}' is invalid; expected en or zh-CN.`)}function Dy(t){let e=[],n=!1;for(let i of t.split(/\r?\n/u)){if(/^\s*```/u.test(i)){n=!n;continue}n||e.push(i)}return e.join(`
159
+ `)}function My(t){return t.match(/[\u4e00-\u9fff]/gu)?.length??0}function Fy(t){return t.match(/[A-Za-z][A-Za-z0-9_-]{2,}/gu)?.length??0}async function pe(t,e){let n=await Ly(t),i=Dy(await te(I(),e,{label:`Classic language-check artifact ${e}`})),r=My(i),s=Fy(i);return n==="zh-CN"&&r<20&&s>=20?S(`configured language is zh-CN, but ${e} appears to be English-dominant (cjk_chars=${r}, english_words=${s}).
160
+ Next: regenerate or rewrite this artifact in Chinese while preserving necessary technical terms.`):n==="en"&&r>20&&r>s?S(`configured language is en, but ${e} appears to be Chinese-dominant (cjk_chars=${r}, english_words=${s}).
161
+ Next: regenerate or rewrite this artifact in English while preserving necessary technical terms.`):_()}async function Gu(t){return Ju("sha256").update(await Hi(I(),t,{label:`Classic handoff source ${t}`})).digest("hex")}async function Ao(t){let e=H(I(),t),n=[`${e}/proposal.md`,`${e}/design.md`,`${e}/tasks.md`],i=`${e}/specs`;if(await Y(i)){await Me(I(),i,{label:`Classic delta-spec directory ${i}`,expected:"directory"});for(let r of(await Cy.readdir(i)).sort()){let s=`${i}/${r}/spec.md`;await Y(s)&&n.push(s)}}return n}async function Wy(t){let e=[];for(let n of await Ao(t))await Y(n)&&e.push(`path:${n}`,`sha256:${await Gu(n)}`);return Ju("sha256").update(e.join(`
162
+ `)).digest("hex")}async function By(t,e){if(!await Y(t))throw new le(ke(`FATAL: change directory not found: ${t}`));if(!await Y(T.join(t,".comet.yaml")))throw new le(ke(`FATAL: .comet.yaml not found in ${t}`));await Me(I(),T.join(t,".comet"),{label:`Classic runtime directory for ${e}`,expected:"directory"});let n=await Du([e],{json:!1});if(n.exitCode!==0)throw n.stderr&&process.stderr.write(n.stderr.endsWith(`
163
+ `)?n.stderr:`${n.stderr}
164
+ `),new le(ke("FATAL: .comet.yaml schema validation failed"));let i=await We(t),r=Array.from(new Set(i.unknownKeys)).sort();if(r.length>0)throw new le(ke(`FATAL: .comet.yaml has unknown field(s): ${r.join(", ")}`))}function Ky(t,e){if(e.passed){if(t.stderr.push(_t(` [PASS] ${e.description}`)),e.detail)for(let n of e.detail.split(`
165
+ `))t.stderr.push(_t(` ${n}`))}else if(t.stderr.push(ke(` [FAIL] ${e.description}`)),e.detail)for(let n of e.detail.split(`
166
+ `))t.stderr.push(ke(` ${n}`))}function E(t,e){return async()=>{try{let n=await e();return{description:t,passed:n.passed,detail:("detail"in n?n.detail:"")??""}}catch(n){return{description:t,passed:!1,detail:n instanceof Error?n.message:String(n)}}}}function _(t){return{passed:!0,...t?{detail:t}:{}}}function S(t){return{passed:!1,detail:t}}async function Pt(t,e){let n=!1;for(let i of e){let r=await i();Ky(t,r),r.passed||(n=!0)}return n}var Yy=["package.json with a build script","pom.xml","Cargo.toml"];async function Uy(t){try{let e=await De(I(),{allowPartialProject:!0});return e?Object.prototype.hasOwnProperty.call(e.value,t):!1}catch(e){throw new Error(`.comet/config.yaml is invalid YAML (${e instanceof Error?e.message:String(e)}); cannot check for removed "${t}" field. Fix the config and retry.`,{cause:e})}}function Vy(t){return{status:1,output:`${t} has been removed from .comet/config.yaml. Delete this field and run any required ${t==="build_command"?"build":"verification"} command manually before retrying.`}}function Jy(t){let e=Sy(t,{shell:!0,cwd:pr(),encoding:"utf8",timeout:3e5});return{status:e.status??1,output:`${e.stdout??""}${e.stderr??""}`.replace(/\n+$/u,"")}}function Nn(t){return T.resolve(pr(),t)}async function Hy(){let t=Nn("package.json");return await Y(t)&&typeof JSON.parse(await te(I(),t,{label:"package.json"})).scripts?.build=="string"?"npm run build":await Y(Nn("pom.xml"))?process.platform==="win32"?await Y(Nn("mvnw.cmd"))?"mvnw.cmd compile -q":"mvn.cmd compile -q":await Y(Nn("mvnw"))?"./mvnw compile -q":"mvn compile -q":await Y(Nn("Cargo.toml"))?"cargo build":null}function Vu(t){return`Evidence: recorded command-check at ${t.timestamp}; command: ${t.command}; cwd: ${t.cwd}`}function _o(t,e,n){return`comet state record-check ${t} ${e} --command "${n}" --exit-code 0`}async function zu(t,e,n,i){if(process.env.COMET_SKIP_BUILD==="1")return{status:0,output:"SKIPPED via COMET_SKIP_BUILD=1"};let r=i==="build"?["build_command"]:["verify_command","build_command"];for(let a of r)if(await Uy(a))return Vy(a);let s=i==="build"?await Hy():null;if(s)return Jy(s);let o=await Wl(I(),t,n,i);return o?o.exitCode!==0?{status:o.exitCode,output:`Latest recorded ${i} check failed with exit code ${o.exitCode}.
167
+ ${Vu(o)}
168
+ Next: rerun the command successfully, then record it with:
169
+ ${_o(e,i,o.command)}`}:{status:0,output:Vu(o)}:{status:1,output:i==="build"?`No inferred build command or recorded build check. Detection searched: ${Yy.join(", ")}.
170
+ Next: run the required command, then record it with:
171
+ ${_o(e,i,"<command>")}`:`No recorded verify check.
172
+ Next: run the required verification command, then record it with:
173
+ ${_o(e,i,"<command>")}`}}async function Oo(t){let e=T.join(t,"tasks.md");if(!await Y(e))return S(`tasks.md is missing at ${e}
174
+ Next: restore or create tasks.md for this change before leaving build.`);let n=await te(I(),e,{label:`Classic tasks ${e}`});if(!/- \[x\]/u.test(n))return S(`tasks.md has no completed tasks.
175
+ Next: complete implementation tasks and mark them with '- [x]'.`);let i=n.split(/\r?\n/u).map((r,s)=>({line:r,number:s+1})).filter(r=>/^- \[ \]/u.test(r.line));return i.length>0?S(`Unfinished tasks:
176
+ ${i.map(r=>`${r.number}:${r.line}`).join(`
177
+ `)}
178
+ Next: complete or explicitly remove unfinished tasks, then mark tasks.md with '- [x]'.`):_()}async function Gy(t){let e=T.join(t,"tasks.md");return await Y(e)?/- \[/u.test(await te(I(),e,{label:`Classic tasks ${e}`})):!1}async function zy(t){let e=await O(t,"plan");if(!e||e==="null")return _();if(!await Y(e))return S(`plan file is missing at ${e}
179
+ Next: restore the Superpowers plan file or update .comet.yaml plan before leaving build.`);let i=(await te(I(),e,{label:`Classic plan ${e}`})).split(/\r?\n/u).map((r,s)=>({line:r,number:s+1})).filter(r=>/^\s*- \[ \]/u.test(r.line));return i.length>0?S(`Unfinished Superpowers plan tasks:
180
+ ${i.map(r=>`${r.number}:${r.line}`).join(`
181
+ `)}
182
+ Next: check off corresponding completed plan tasks, then commit the plan update.`):_()}async function jo(t,e){let n;try{n=await Ku(t,{heal:!0,cwd:pr()})}catch(i){throw new le(`ERROR: ${i instanceof Error?i.message:String(i)}`)}switch(n.status){case"drift":return S(Yu(e,n.boundBranch,n.currentBranch));case"unbound-detached":return S(Uu(e));case"healed":return _(`bound_branch lazily set to ${n.branch}`);case"needs-heal":case"ok":case"not-applicable":return _();default:{let i=n;throw new Error(`unhandled branch binding status: ${JSON.stringify(i)}`)}}}async function Qy(t,e){let n=await O(t,"isolation");return n==="current"||n==="branch"||n==="worktree"?_():S(`isolation must be current, branch, or worktree, got '${n||"null"}'
183
+ Next: choose a valid workspace mode, prepare it when needed, then run:
184
+ comet state set ${e} isolation <current|branch|worktree>`)}async function Xy(t,e){let n=await O(t,"build_mode");return["subagent-driven-development","executing-plans","direct"].includes(n)?_():S(`build_mode must be selected before leaving build, got '${n||"null"}'
185
+ Next: ask the user to choose an execution mode, then run:
186
+ comet state set ${e} build_mode <subagent-driven-development|executing-plans>`)}async function Zy(t){let e=await O(t,"workflow"),n=await O(t,"build_mode"),i=await O(t,"direct_override");return n!=="direct"||e==="hotfix"||e==="tweak"||i==="true"?_():S(`build_mode=direct is only allowed for hotfix/tweak unless direct_override: true is recorded
187
+ Next: choose executing-plans or subagent-driven-development, or stop and ask the user for an explicit direct override.`)}async function ev(t,e){let n=await O(t,"build_mode"),i=await O(t,"subagent_dispatch");return n!=="subagent-driven-development"||i==="confirmed"?_():S(`subagent_dispatch must be confirmed before using build_mode=subagent-driven-development
188
+ Next: record the selected subagent-driven execution, then run:
189
+ comet state set ${e} subagent_dispatch confirmed`)}async function tv(t,e){let n=await O(t,"workflow");if(n==="hotfix"||n==="tweak")return _();let i=await O(t,"tdd_mode");return i==="tdd"||i==="direct"?_():S(`tdd_mode must be tdd or direct for full workflow, got '${i||"null"}'
190
+ Next: ask the user to choose TDD enforcement level, then run:
191
+ comet state set ${e} tdd_mode <tdd|direct>`)}async function nv(t,e){let n=await O(t,"workflow");if(n==="hotfix"||n==="tweak")return _();let i=await O(t,"review_mode");return i==="off"||i==="standard"||i==="thorough"?_():S(`review_mode must be off, standard, or thorough before leaving build, got '${i||"null"}'
192
+ Next: ask the user to choose review strength, then run:
193
+ comet state set ${e} review_mode <off|standard|thorough>`)}async function iv(t){let e=await O(t,"verification_report");return!!e&&e!=="null"&&await Y(e)}async function rv(t){return await O(t,"branch_status")==="handled"}async function sv(t){return await O(t,"archived")==="true"}async function Po(t,e,n){let i=(await te(I(),t,{label:`Classic Design Doc ${t}`})).replace(/^\uFEFF/u,""),r=!1;for(let s of i.split(/\r?\n/u)){if(!r){s==="---"&&(r=!0);continue}if(s==="---")break;if(new RegExp(`^${e}: ['"]?${n}['"]?\\s*$`,"u").test(s))return!0}return!1}async function ov(t,e){let n=await O(t,"design_doc");return n&&n!=="null"&&await Y(n)?_():S(`design_doc must point to an existing Superpowers Design Doc for full workflow before leaving design.
194
+ Next: create the Design Doc and run: comet state set ${e} design_doc <path>`)}async function av(t,e){let n=await O(t,"handoff_context"),i=await O(t,"handoff_hash");if(!n||n==="null")return S(`handoff_context is missing from .comet.yaml
195
+ Next: run node "$COMET_HANDOFF" ${e} design --write before invoking Superpowers.`);if(!await J(n))return S(`handoff_context does not point to a non-empty file: ${n}
196
+ Next: regenerate the design handoff with comet handoff ${e} design --write.`);if(!/^[a-f0-9]{64}$/u.test(i))return S(`handoff_hash is missing or invalid: ${i||"null"}
197
+ Next: regenerate the design handoff with comet handoff ${e} design --write.`);let r=await Wy(t);if(r!==i)return S(`OpenSpec artifacts changed after handoff was generated.
198
+ Expected handoff_hash: ${i}
199
+ Actual handoff_hash: ${r}
200
+ Next: run comet handoff ${e} design --write so Superpowers receives the current OpenSpec context.`);let s=`${n.replace(/\.json$/u,"")}.md`;return await J(s)?_():S(`design handoff markdown is missing or empty: ${s}
201
+ Next: regenerate the design handoff with comet handoff ${e} design --write.`)}async function cv(t){let e=await O(t,"handoff_context");if(!e||e==="null")return S("handoff_context is missing from .comet.yaml");let n=`${e.replace(/\.json$/u,"")}.md`;if(!await J(n))return S(`design handoff markdown is missing or empty: ${n}`);let i=await te(I(),n,{label:`Classic handoff markdown ${n}`}),r=new Set(i.split(/\r?\n/u)),s=[];/^Generated-by: comet-handoff\.sh$/mu.test(i)||s.push("handoff markdown is missing Generated-by marker"),/^- Mode: (compact|full|beta)$/mu.test(i)||s.push("handoff markdown is missing Mode marker");for(let o of await Ao(t))await Y(o)&&(r.has(`- Source: ${o}`)||s.push(`handoff markdown is missing source reference: ${o}`),r.has(`- SHA256: ${await Gu(o)}`)||s.push(`handoff markdown is missing current sha256 for: ${o}`));return s.length===0?_():S(s.join(`
202
+ `))}async function Qu(t){return await O(t,"context_compression")||"off"}async function lv(t){if(await Qu(t)!=="beta")return _();let e=await O(t,"handoff_context");if(!e||e==="null")return S("handoff_context is missing from .comet.yaml");if(!await J(e))return S(`spec-context.json is missing or empty: ${e}`);let n=await te(I(),e,{label:`Classic handoff context ${e}`}),i=[],r;try{r=JSON.parse(n)}catch(a){return S(`spec-context.json invalid JSON: ${a instanceof Error?a.message:String(a)}`)}if(!r||typeof r!="object"||Array.isArray(r))return S("spec-context.json root must be an object");let s=r;typeof s.change!="string"&&i.push("spec-context.json missing 'change' field"),typeof s.phase!="string"&&i.push("spec-context.json missing 'phase' field"),s.mode!=="beta"&&i.push("spec-context.json mode is not beta"),typeof s.context_hash!="string"&&i.push("spec-context.json missing 'context_hash' field"),Array.isArray(s.files)||i.push("spec-context.json missing 'files' field");let o=Array.isArray(s.files)?s.files.filter(a=>!!a&&typeof a=="object"&&!Array.isArray(a)):[];for(let a of await Ao(t))await Y(a)&&(o.some(c=>c.path===a&&typeof c.sha256=="string")||i.push(`spec-context.json missing source file reference: ${a}`));return i.length===0?_():S(i.join(`
203
+ `))}async function uv(t,e){let n=await O(e,"workflow"),i=[E("proposal.md exists and non-empty",async()=>await J(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>pe(e,T.join(e,"proposal.md"))),E("tasks.md exists and non-empty",async()=>await J(T.join(e,"tasks.md"))?_():S("")),E("tasks.md matches configured language",()=>pe(e,T.join(e,"tasks.md"))),E("tasks.md has at least one task",async()=>await Gy(e)?_():S(""))];return n==="full"&&i.splice(1,0,E("design.md exists and non-empty",async()=>await J(T.join(e,"design.md"))?_():S("")),E("design.md matches configured language",()=>pe(e,T.join(e,"design.md")))),Pt(t,i)}async function fv(t,e,n){let i=await O(e,"design_doc"),r=await O(e,"workflow"),s=[E("proposal.md exists",async()=>await J(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>pe(e,T.join(e,"proposal.md"))),E("design.md exists",async()=>await J(T.join(e,"design.md"))?_():S("")),E("design.md matches configured language",()=>pe(e,T.join(e,"design.md"))),E("tasks.md exists",async()=>await J(T.join(e,"tasks.md"))?_():S("")),E("tasks.md matches configured language",()=>pe(e,T.join(e,"tasks.md"))),E("design handoff context exists",()=>av(e,n)),E("design handoff markdown is traceable",()=>cv(e))];await Qu(e)==="beta"&&s.push(E("beta spec-context.json is structurally valid",()=>lv(e))),r==="full"&&s.push(E("design_doc is recorded for full workflow",()=>ov(e,n)));let o=await Pt(t,s);return i&&i!=="null"?o=await Pt(t,[E(`Design Doc (${i}) exists`,async()=>await J(i)?_():S("")),E("Design Doc matches configured language",()=>pe(e,i)),E("Design Doc frontmatter links current change",async()=>await J(i)&&await Po(i,"comet_change",n)?_():S("")),E("Design Doc declares technical design role",async()=>await J(i)&&await Po(i,"role","technical-design")?_():S("")),E("Design Doc declares OpenSpec as canonical spec",async()=>await J(i)&&await Po(i,"canonical_spec","openspec")?_():S(""))])||o:r!=="full"&&t.stderr.push(Oy(" [WARN] No design_doc recorded in .comet.yaml (optional for hotfix/tweak)")),o}async function dv(t,e,n,i){return Pt(t,[E("bound branch matches workspace mode",()=>jo(e,n)),E("isolation selected",()=>Qy(e,n)),E("build_mode selected",()=>Xy(e,n)),E("build_mode allowed for workflow",()=>Zy(e)),E("subagent dispatch confirmed",()=>ev(e,n)),E("tdd_mode selected",()=>tv(e,n)),E("review_mode selected",()=>nv(e,n)),E("tasks.md all tasks checked",()=>Oo(e)),E("Superpowers plan all tasks checked",()=>zy(e)),E("proposal.md exists",async()=>await J(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>pe(e,T.join(e,"proposal.md"))),E("Superpowers plan matches configured language",async()=>{let r=await O(e,"plan");return!r||r==="null"||!await Y(r)?_():pe(e,r)}),E("Build passes",async()=>{let r=await zu(e,n,i,"build");return r.status===0?_(r.output):S(r.output)})])}async function pv(t,e,n,i){return Pt(t,[E("bound branch matches workspace mode",()=>jo(e,n)),E("tasks.md all tasks checked",()=>Oo(e)),E("Verification passes",async()=>{let r=await zu(e,n,i,"verify");return r.status===0?_(r.output):S(r.output)}),E("verification_report exists",async()=>await iv(e)?_():S("")),E("verification_report matches configured language",async()=>{let r=await O(e,"verification_report");return!r||r==="null"||!await Y(r)?_():pe(e,r)})])}async function mv(t,e,n){return Pt(t,[E("bound branch matches workspace mode",()=>jo(e,n)),E("archived is true",async()=>await sv(e)?_():S("")),E("proposal.md exists",async()=>await J(T.join(e,"proposal.md"))?_():S("")),E("design.md exists",async()=>await J(T.join(e,"design.md"))?_():S("")),E("tasks.md all tasks checked",()=>Oo(e)),E("branch_status=handled",async()=>await rv(e)?_():S(""))])}async function hv(t,e,n,i){let r=Iu[i];if(!r)return;let s=await ur(n),o=$u(s.classic,r);await Nu(n,o.classic,s.run,{event:r,phase:i,source:"comet-guard"}),await Tu(n,{change:e,event:r,source:"comet-guard",from:s.classic,to:o.classic,effects:o.effects});for(let l of o.effects)t.stderr.push(_t(`[SET] ${jy(l.field)}=${Ty(l.to)}`));t.stderr.push(_t(`[TRANSITION] ${r}`));let a=Ny[i],c=i==="open"?a.replace("PLACEHOLDER",o.classic.phase):a;t.stderr.push(_t(c))}var Xu=async(t,e)=>dr(e,async()=>{let n=new Ro,[i,r,s]=t;try{if(Iy(i),!r||!Py.includes(r))throw new le(`${ke(`Unknown phase: ${r??""}`)}
204
+ Valid phases: open, design, build, verify, archive`);await lo(I());let o=await $y(i);await By(o,i);let a=await ur(o),c=await ju(o,i);e.json&&(n.diagnostics={change:i,phase:r,currentStep:c.currentStep,runtimeEval:c.runtimeEval}),n.stderr.push(Ry[r]);let l;return r==="open"?l=await uv(n,o):r==="design"?l=await fv(n,o,i):r==="build"?l=await dv(n,o,i,a.run):r==="verify"?l=await pv(n,o,i,a.run):l=await mv(n,o,i),l?(n.stderr.push(""),n.stderr.push(ke("BLOCKED — fix failing checks before proceeding to next phase")),n.toResult(1)):(n.stderr.push(""),n.stderr.push(_t("ALL CHECKS PASSED — ready for next phase")),s==="--apply"&&await hv(n,i,o,r),n.toResult(0))}catch(o){if(o instanceof le){for(let a of o.message.split(`
205
+ `))n.stderr.push(a);return n.toResult(o.exitCode)}throw o}});function gv(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}})+`
206
+ `}}async function Zu(t,e,n=process.argv.slice(2)){let i=n.includes("--json"),r=n.filter(a=>a!=="--json"),s;try{s=await e(r,{json:i})}catch(a){s={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let o=i?gv(t,s):s;return o.stdout&&process.stdout.write(o.stdout),o.stderr&&process.stderr.write(o.stderr+(o.stderr.endsWith(`
207
+ `)?"":`
208
+ `)),o.exitCode}process.exitCode=await Zu("guard",Xu);