@rpamis/comet 0.4.0-beta.16 → 0.4.0-beta.18

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 (761) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +85 -56
  3. package/assets/eval-reports/comet-native-vs-beta16-beta17-20260810/native-benchmark-report.html +8 -0
  4. package/assets/eval-reports/comet-native-vs-beta16-beta17-20260810/native-benchmark-report.json +286 -0
  5. package/assets/manifest.json +26 -17
  6. package/assets/skills/comet/SKILL.md +1 -1
  7. package/assets/skills/comet/agents/openai.yaml +3 -0
  8. package/assets/skills/comet/rules/comet-phase-guard.en.md +1 -1
  9. package/assets/skills/comet/rules/comet-phase-guard.md +1 -1
  10. package/assets/skills/comet/rules/comet-workflow-guard.en.md +2 -2
  11. package/assets/skills/comet/rules/comet-workflow-guard.md +2 -2
  12. package/assets/skills/comet/scripts/comet-archive.mjs +128 -128
  13. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +77 -77
  14. package/assets/skills/comet/scripts/comet-guard.mjs +144 -144
  15. package/assets/skills/comet/scripts/comet-handoff.mjs +107 -107
  16. package/assets/skills/comet/scripts/comet-hook-guard.mjs +128 -128
  17. package/assets/skills/comet/scripts/comet-hook-router.mjs +143 -141
  18. package/assets/skills/comet/scripts/comet-resume-probe.mjs +100 -100
  19. package/assets/skills/comet/scripts/comet-runtime.mjs +194 -193
  20. package/assets/skills/comet/scripts/comet-state.mjs +118 -118
  21. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +95 -95
  22. package/assets/skills/comet-any/SKILL.md +2 -1
  23. package/assets/skills/comet-any/agents/openai.yaml +5 -0
  24. package/assets/skills/comet-archive/SKILL.md +7 -6
  25. package/assets/skills/comet-archive/agents/openai.yaml +5 -0
  26. package/assets/skills/comet-build/SKILL.md +28 -68
  27. package/assets/skills/comet-build/agents/openai.yaml +5 -0
  28. package/assets/skills/comet-classic/SKILL.md +28 -22
  29. package/assets/skills/comet-classic/agents/openai.yaml +3 -0
  30. package/assets/skills/{comet → comet-classic}/reference/auto-transition.md +1 -1
  31. package/assets/skills/{comet → comet-classic}/reference/comet-yaml-fields.md +3 -3
  32. package/assets/skills/{comet → comet-classic}/reference/context-recovery.md +5 -5
  33. package/assets/skills/{comet → comet-classic}/reference/debug-gate.md +2 -2
  34. package/assets/skills/{comet → comet-classic}/reference/decision-point.md +1 -1
  35. package/assets/skills/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
  36. package/assets/skills/{comet → comet-classic}/reference/file-structure.md +1 -1
  37. package/assets/skills/{comet → comet-classic}/reference/intent-frame.md +1 -1
  38. package/assets/skills/{comet → comet-classic}/reference/scripts.md +4 -2
  39. package/assets/skills/{comet → comet-classic}/reference/subagent-dispatch.md +1 -1
  40. package/assets/skills/comet-classic/reference/workspace.md +23 -0
  41. package/assets/skills/comet-design/SKILL.md +7 -6
  42. package/assets/skills/comet-design/agents/openai.yaml +5 -0
  43. package/assets/skills/comet-hotfix/SKILL.md +10 -9
  44. package/assets/skills/comet-hotfix/agents/openai.yaml +5 -0
  45. package/assets/skills/comet-native/SKILL.md +60 -171
  46. package/assets/skills/comet-native/agents/openai.yaml +3 -0
  47. package/assets/skills/comet-native/reference/artifacts.md +24 -89
  48. package/assets/skills/comet-native/reference/clarification.md +54 -29
  49. package/assets/skills/comet-native/reference/commands.md +30 -173
  50. package/assets/skills/comet-native/reference/recovery.md +38 -88
  51. package/assets/skills/comet-native/reference/workspace.md +23 -0
  52. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +184 -152
  53. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +214 -158
  54. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +132 -123
  55. package/assets/skills/comet-native/scripts/comet-native-init.mjs +134 -124
  56. package/assets/skills/comet-native/scripts/comet-native-new.mjs +165 -158
  57. package/assets/skills/comet-native/scripts/comet-native-next.mjs +183 -152
  58. package/assets/skills/comet-native/scripts/comet-native-root.mjs +152 -147
  59. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +247 -202
  60. package/assets/skills/comet-native/scripts/comet-native-select.mjs +150 -143
  61. package/assets/skills/comet-native/scripts/comet-native-show.mjs +128 -121
  62. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +133 -151
  63. package/assets/skills/comet-native/scripts/comet-native-status.mjs +147 -140
  64. package/assets/skills/comet-open/SKILL.md +31 -11
  65. package/assets/skills/comet-open/agents/openai.yaml +5 -0
  66. package/assets/skills/comet-tweak/SKILL.md +11 -10
  67. package/assets/skills/comet-tweak/agents/openai.yaml +5 -0
  68. package/assets/skills/comet-verify/SKILL.md +9 -8
  69. package/assets/skills/comet-verify/agents/openai.yaml +5 -0
  70. package/assets/skills-zh/comet/SKILL.md +1 -1
  71. package/assets/skills-zh/comet/agents/openai.yaml +3 -0
  72. package/assets/skills-zh/comet-any/SKILL.md +2 -1
  73. package/assets/skills-zh/comet-any/agents/openai.yaml +5 -0
  74. package/assets/skills-zh/comet-archive/SKILL.md +7 -6
  75. package/assets/skills-zh/comet-archive/agents/openai.yaml +5 -0
  76. package/assets/skills-zh/comet-build/SKILL.md +28 -68
  77. package/assets/skills-zh/comet-build/agents/openai.yaml +5 -0
  78. package/assets/skills-zh/comet-classic/SKILL.md +29 -23
  79. package/assets/skills-zh/comet-classic/agents/openai.yaml +3 -0
  80. package/assets/skills-zh/{comet → comet-classic}/reference/auto-transition.md +1 -1
  81. package/assets/skills-zh/{comet → comet-classic}/reference/comet-yaml-fields.md +3 -3
  82. package/assets/skills-zh/{comet → comet-classic}/reference/context-recovery.md +5 -5
  83. package/assets/skills-zh/{comet → comet-classic}/reference/debug-gate.md +2 -2
  84. package/assets/skills-zh/{comet → comet-classic}/reference/decision-point.md +1 -1
  85. package/assets/skills-zh/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
  86. package/assets/skills-zh/{comet → comet-classic}/reference/file-structure.md +1 -1
  87. package/assets/skills-zh/{comet → comet-classic}/reference/intent-frame.md +1 -1
  88. package/assets/skills-zh/{comet → comet-classic}/reference/scripts.md +4 -2
  89. package/assets/skills-zh/{comet → comet-classic}/reference/subagent-dispatch.md +1 -1
  90. package/assets/skills-zh/comet-classic/reference/workspace.md +23 -0
  91. package/assets/skills-zh/comet-design/SKILL.md +7 -6
  92. package/assets/skills-zh/comet-design/agents/openai.yaml +5 -0
  93. package/assets/skills-zh/comet-hotfix/SKILL.md +10 -9
  94. package/assets/skills-zh/comet-hotfix/agents/openai.yaml +5 -0
  95. package/assets/skills-zh/comet-native/SKILL.md +60 -171
  96. package/assets/skills-zh/comet-native/agents/openai.yaml +3 -0
  97. package/assets/skills-zh/comet-native/reference/artifacts.md +24 -89
  98. package/assets/skills-zh/comet-native/reference/clarification.md +40 -15
  99. package/assets/skills-zh/comet-native/reference/commands.md +30 -173
  100. package/assets/skills-zh/comet-native/reference/recovery.md +36 -86
  101. package/assets/skills-zh/comet-native/reference/workspace.md +23 -0
  102. package/assets/skills-zh/comet-open/SKILL.md +31 -11
  103. package/assets/skills-zh/comet-open/agents/openai.yaml +5 -0
  104. package/assets/skills-zh/comet-tweak/SKILL.md +11 -10
  105. package/assets/skills-zh/comet-tweak/agents/openai.yaml +5 -0
  106. package/assets/skills-zh/comet-verify/SKILL.md +9 -8
  107. package/assets/skills-zh/comet-verify/agents/openai.yaml +5 -0
  108. package/bin/fast-runtime-router.js +0 -4
  109. package/dist/app/cli/index.js +20 -1
  110. package/dist/app/cli/index.js.map +1 -1
  111. package/dist/app/commands/classic.d.ts.map +1 -1
  112. package/dist/app/commands/classic.js +2 -0
  113. package/dist/app/commands/classic.js.map +1 -1
  114. package/dist/app/commands/doctor.d.ts.map +1 -1
  115. package/dist/app/commands/doctor.js +8 -0
  116. package/dist/app/commands/doctor.js.map +1 -1
  117. package/dist/app/commands/eval.d.ts +9 -2
  118. package/dist/app/commands/eval.d.ts.map +1 -1
  119. package/dist/app/commands/eval.js +293 -48
  120. package/dist/app/commands/eval.js.map +1 -1
  121. package/dist/app/commands/init.d.ts.map +1 -1
  122. package/dist/app/commands/init.js +11 -2
  123. package/dist/app/commands/init.js.map +1 -1
  124. package/dist/app/commands/update.d.ts.map +1 -1
  125. package/dist/app/commands/update.js +13 -3
  126. package/dist/app/commands/update.js.map +1 -1
  127. package/dist/config/repository-layout.json +0 -8
  128. package/dist/domains/bundle/bundle-platform.d.ts.map +1 -1
  129. package/dist/domains/bundle/bundle-platform.js +8 -0
  130. package/dist/domains/bundle/bundle-platform.js.map +1 -1
  131. package/dist/domains/bundle/types.d.ts +1 -1
  132. package/dist/domains/bundle/types.d.ts.map +1 -1
  133. package/dist/domains/comet-classic/classic-cli.d.ts +1 -1
  134. package/dist/domains/comet-classic/classic-cli.d.ts.map +1 -1
  135. package/dist/domains/comet-classic/classic-cli.js +3 -0
  136. package/dist/domains/comet-classic/classic-cli.js.map +1 -1
  137. package/dist/domains/comet-classic/classic-current-change.d.ts.map +1 -1
  138. package/dist/domains/comet-classic/classic-current-change.js +29 -3
  139. package/dist/domains/comet-classic/classic-current-change.js.map +1 -1
  140. package/dist/domains/comet-classic/classic-guard.js +2 -2
  141. package/dist/domains/comet-classic/classic-guard.js.map +1 -1
  142. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  143. package/dist/domains/comet-classic/classic-hook-guard.js +14 -1
  144. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  145. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  146. package/dist/domains/comet-classic/classic-state-command.js +31 -8
  147. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  148. package/dist/domains/comet-classic/classic-workspace-command.d.ts +3 -0
  149. package/dist/domains/comet-classic/classic-workspace-command.d.ts.map +1 -0
  150. package/dist/domains/comet-classic/classic-workspace-command.js +45 -0
  151. package/dist/domains/comet-classic/classic-workspace-command.js.map +1 -0
  152. package/dist/domains/comet-classic/classic-workspace.d.ts +38 -0
  153. package/dist/domains/comet-classic/classic-workspace.d.ts.map +1 -0
  154. package/dist/domains/comet-classic/classic-workspace.js +315 -0
  155. package/dist/domains/comet-classic/classic-workspace.js.map +1 -0
  156. package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
  157. package/dist/domains/comet-entry/hook-adapter.js +3 -0
  158. package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
  159. package/dist/domains/comet-entry/hook-router-entry.d.ts +2 -0
  160. package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
  161. package/dist/domains/comet-entry/hook-router-entry.js +32 -3
  162. package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
  163. package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
  164. package/dist/domains/comet-entry/init-workflow.js +13 -5
  165. package/dist/domains/comet-entry/init-workflow.js.map +1 -1
  166. package/dist/domains/comet-entry/project-activation.d.ts.map +1 -1
  167. package/dist/domains/comet-entry/project-activation.js +2 -1
  168. package/dist/domains/comet-entry/project-activation.js.map +1 -1
  169. package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
  170. package/dist/domains/comet-entry/resume-probe.js +48 -4
  171. package/dist/domains/comet-entry/resume-probe.js.map +1 -1
  172. package/dist/domains/comet-native/index.d.ts +1 -0
  173. package/dist/domains/comet-native/index.d.ts.map +1 -1
  174. package/dist/domains/comet-native/index.js +1 -0
  175. package/dist/domains/comet-native/index.js.map +1 -1
  176. package/dist/domains/comet-native/native-acceptance.d.ts +4 -3
  177. package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
  178. package/dist/domains/comet-native/native-acceptance.js +23 -18
  179. package/dist/domains/comet-native/native-acceptance.js.map +1 -1
  180. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
  181. package/dist/domains/comet-native/native-archive-command.js +204 -61
  182. package/dist/domains/comet-native/native-archive-command.js.map +1 -1
  183. package/dist/domains/comet-native/native-archive-transaction.d.ts.map +1 -1
  184. package/dist/domains/comet-native/native-archive-transaction.js +28 -23
  185. package/dist/domains/comet-native/native-archive-transaction.js.map +1 -1
  186. package/dist/domains/comet-native/native-archive.d.ts +1 -0
  187. package/dist/domains/comet-native/native-archive.d.ts.map +1 -1
  188. package/dist/domains/comet-native/native-archive.js +56 -12
  189. package/dist/domains/comet-native/native-archive.js.map +1 -1
  190. package/dist/domains/comet-native/native-bounded-file.d.ts +32 -2
  191. package/dist/domains/comet-native/native-bounded-file.d.ts.map +1 -1
  192. package/dist/domains/comet-native/native-bounded-file.js +87 -6
  193. package/dist/domains/comet-native/native-bounded-file.js.map +1 -1
  194. package/dist/domains/comet-native/native-build-evidence.d.ts.map +1 -1
  195. package/dist/domains/comet-native/native-build-evidence.js +23 -1
  196. package/dist/domains/comet-native/native-build-evidence.js.map +1 -1
  197. package/dist/domains/comet-native/native-change.d.ts +1 -0
  198. package/dist/domains/comet-native/native-change.d.ts.map +1 -1
  199. package/dist/domains/comet-native/native-change.js +96 -8
  200. package/dist/domains/comet-native/native-change.js.map +1 -1
  201. package/dist/domains/comet-native/native-check-executor.d.ts +36 -0
  202. package/dist/domains/comet-native/native-check-executor.d.ts.map +1 -0
  203. package/dist/domains/comet-native/native-check-executor.js +132 -0
  204. package/dist/domains/comet-native/native-check-executor.js.map +1 -0
  205. package/dist/domains/comet-native/native-check-receipt-model.d.ts +9 -0
  206. package/dist/domains/comet-native/native-check-receipt-model.d.ts.map +1 -1
  207. package/dist/domains/comet-native/native-check-receipt-model.js +70 -8
  208. package/dist/domains/comet-native/native-check-receipt-model.js.map +1 -1
  209. package/dist/domains/comet-native/native-check-receipt-storage.d.ts.map +1 -1
  210. package/dist/domains/comet-native/native-check-receipt-storage.js +9 -8
  211. package/dist/domains/comet-native/native-check-receipt-storage.js.map +1 -1
  212. package/dist/domains/comet-native/native-check-receipt.d.ts.map +1 -1
  213. package/dist/domains/comet-native/native-check-receipt.js +123 -60
  214. package/dist/domains/comet-native/native-check-receipt.js.map +1 -1
  215. package/dist/domains/comet-native/native-checkpoint-command.d.ts.map +1 -1
  216. package/dist/domains/comet-native/native-checkpoint-command.js +0 -6
  217. package/dist/domains/comet-native/native-checkpoint-command.js.map +1 -1
  218. package/dist/domains/comet-native/native-checkpoint-storage.d.ts.map +1 -1
  219. package/dist/domains/comet-native/native-checkpoint-storage.js +27 -19
  220. package/dist/domains/comet-native/native-checkpoint-storage.js.map +1 -1
  221. package/dist/domains/comet-native/native-children.d.ts +49 -0
  222. package/dist/domains/comet-native/native-children.d.ts.map +1 -0
  223. package/dist/domains/comet-native/native-children.js +388 -0
  224. package/dist/domains/comet-native/native-children.js.map +1 -0
  225. package/dist/domains/comet-native/native-cli-help.d.ts +6 -0
  226. package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -0
  227. package/dist/domains/comet-native/native-cli-help.js +192 -0
  228. package/dist/domains/comet-native/native-cli-help.js.map +1 -0
  229. package/dist/domains/comet-native/native-cli-shared.d.ts +2 -2
  230. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  231. package/dist/domains/comet-native/native-cli-shared.js +46 -24
  232. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  233. package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
  234. package/dist/domains/comet-native/native-cli.js +18 -11
  235. package/dist/domains/comet-native/native-cli.js.map +1 -1
  236. package/dist/domains/comet-native/native-config.d.ts +2 -1
  237. package/dist/domains/comet-native/native-config.d.ts.map +1 -1
  238. package/dist/domains/comet-native/native-config.js +2 -1
  239. package/dist/domains/comet-native/native-config.js.map +1 -1
  240. package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
  241. package/dist/domains/comet-native/native-continuation.js +175 -147
  242. package/dist/domains/comet-native/native-continuation.js.map +1 -1
  243. package/dist/domains/comet-native/native-diagnostics.d.ts.map +1 -1
  244. package/dist/domains/comet-native/native-diagnostics.js +96 -13
  245. package/dist/domains/comet-native/native-diagnostics.js.map +1 -1
  246. package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -1
  247. package/dist/domains/comet-native/native-doctor-command.js +332 -0
  248. package/dist/domains/comet-native/native-doctor-command.js.map +1 -1
  249. package/dist/domains/comet-native/native-doctor.d.ts +1 -0
  250. package/dist/domains/comet-native/native-doctor.d.ts.map +1 -1
  251. package/dist/domains/comet-native/native-doctor.js +116 -22
  252. package/dist/domains/comet-native/native-doctor.js.map +1 -1
  253. package/dist/domains/comet-native/native-evidence-projection.d.ts +50 -0
  254. package/dist/domains/comet-native/native-evidence-projection.d.ts.map +1 -0
  255. package/dist/domains/comet-native/native-evidence-projection.js +284 -0
  256. package/dist/domains/comet-native/native-evidence-projection.js.map +1 -0
  257. package/dist/domains/comet-native/native-evidence-retention.d.ts.map +1 -1
  258. package/dist/domains/comet-native/native-evidence-retention.js +14 -12
  259. package/dist/domains/comet-native/native-evidence-retention.js.map +1 -1
  260. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  261. package/dist/domains/comet-native/native-evidence-storage.js +14 -11
  262. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  263. package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
  264. package/dist/domains/comet-native/native-findings.js +18 -0
  265. package/dist/domains/comet-native/native-findings.js.map +1 -1
  266. package/dist/domains/comet-native/native-git-provenance.d.ts +16 -0
  267. package/dist/domains/comet-native/native-git-provenance.d.ts.map +1 -0
  268. package/dist/domains/comet-native/native-git-provenance.js +171 -0
  269. package/dist/domains/comet-native/native-git-provenance.js.map +1 -0
  270. package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
  271. package/dist/domains/comet-native/native-hook-guard.js +199 -19
  272. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  273. package/dist/domains/comet-native/native-init-command.d.ts.map +1 -1
  274. package/dist/domains/comet-native/native-init-command.js +14 -2
  275. package/dist/domains/comet-native/native-init-command.js.map +1 -1
  276. package/dist/domains/comet-native/native-local-execution.d.ts +25 -0
  277. package/dist/domains/comet-native/native-local-execution.d.ts.map +1 -0
  278. package/dist/domains/comet-native/native-local-execution.js +241 -0
  279. package/dist/domains/comet-native/native-local-execution.js.map +1 -0
  280. package/dist/domains/comet-native/native-lock.d.ts +1 -1
  281. package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
  282. package/dist/domains/comet-native/native-lock.js +9 -9
  283. package/dist/domains/comet-native/native-lock.js.map +1 -1
  284. package/dist/domains/comet-native/native-loop-runtime.d.ts +63 -0
  285. package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -0
  286. package/dist/domains/comet-native/native-loop-runtime.js +580 -0
  287. package/dist/domains/comet-native/native-loop-runtime.js.map +1 -0
  288. package/dist/domains/comet-native/native-mutation-lock.d.ts +2 -0
  289. package/dist/domains/comet-native/native-mutation-lock.d.ts.map +1 -1
  290. package/dist/domains/comet-native/native-mutation-lock.js +23 -2
  291. package/dist/domains/comet-native/native-mutation-lock.js.map +1 -1
  292. package/dist/domains/comet-native/native-new-command.d.ts.map +1 -1
  293. package/dist/domains/comet-native/native-new-command.js +27 -20
  294. package/dist/domains/comet-native/native-new-command.js.map +1 -1
  295. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
  296. package/dist/domains/comet-native/native-next-command.js +193 -62
  297. package/dist/domains/comet-native/native-next-command.js.map +1 -1
  298. package/dist/domains/comet-native/native-paths.d.ts +18 -0
  299. package/dist/domains/comet-native/native-paths.d.ts.map +1 -1
  300. package/dist/domains/comet-native/native-paths.js +125 -13
  301. package/dist/domains/comet-native/native-paths.js.map +1 -1
  302. package/dist/domains/comet-native/native-portable-acceptance.d.ts +28 -0
  303. package/dist/domains/comet-native/native-portable-acceptance.d.ts.map +1 -0
  304. package/dist/domains/comet-native/native-portable-acceptance.js +73 -0
  305. package/dist/domains/comet-native/native-portable-acceptance.js.map +1 -0
  306. package/dist/domains/comet-native/native-portable-archive.d.ts +37 -0
  307. package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -0
  308. package/dist/domains/comet-native/native-portable-archive.js +492 -0
  309. package/dist/domains/comet-native/native-portable-archive.js.map +1 -0
  310. package/dist/domains/comet-native/native-portable-continuation.d.ts +30 -0
  311. package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -0
  312. package/dist/domains/comet-native/native-portable-continuation.js +403 -0
  313. package/dist/domains/comet-native/native-portable-continuation.js.map +1 -0
  314. package/dist/domains/comet-native/native-portable-migration-runtime.d.ts +9 -0
  315. package/dist/domains/comet-native/native-portable-migration-runtime.d.ts.map +1 -0
  316. package/dist/domains/comet-native/native-portable-migration-runtime.js +213 -0
  317. package/dist/domains/comet-native/native-portable-migration-runtime.js.map +1 -0
  318. package/dist/domains/comet-native/native-portable-migration.d.ts +42 -0
  319. package/dist/domains/comet-native/native-portable-migration.d.ts.map +1 -0
  320. package/dist/domains/comet-native/native-portable-migration.js +212 -0
  321. package/dist/domains/comet-native/native-portable-migration.js.map +1 -0
  322. package/dist/domains/comet-native/native-portable-recovery.d.ts +15 -0
  323. package/dist/domains/comet-native/native-portable-recovery.d.ts.map +1 -0
  324. package/dist/domains/comet-native/native-portable-recovery.js +203 -0
  325. package/dist/domains/comet-native/native-portable-recovery.js.map +1 -0
  326. package/dist/domains/comet-native/native-portable-runtime.d.ts +155 -0
  327. package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -0
  328. package/dist/domains/comet-native/native-portable-runtime.js +1550 -0
  329. package/dist/domains/comet-native/native-portable-runtime.js.map +1 -0
  330. package/dist/domains/comet-native/native-portable-state.d.ts +30 -0
  331. package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -0
  332. package/dist/domains/comet-native/native-portable-state.js +701 -0
  333. package/dist/domains/comet-native/native-portable-state.js.map +1 -0
  334. package/dist/domains/comet-native/native-portable-status.d.ts +65 -0
  335. package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -0
  336. package/dist/domains/comet-native/native-portable-status.js +133 -0
  337. package/dist/domains/comet-native/native-portable-status.js.map +1 -0
  338. package/dist/domains/comet-native/native-portable-text.d.ts +8 -0
  339. package/dist/domains/comet-native/native-portable-text.d.ts.map +1 -0
  340. package/dist/domains/comet-native/native-portable-text.js +28 -0
  341. package/dist/domains/comet-native/native-portable-text.js.map +1 -0
  342. package/dist/domains/comet-native/native-portable-transactions.d.ts +41 -0
  343. package/dist/domains/comet-native/native-portable-transactions.d.ts.map +1 -0
  344. package/dist/domains/comet-native/native-portable-transactions.js +204 -0
  345. package/dist/domains/comet-native/native-portable-transactions.js.map +1 -0
  346. package/dist/domains/comet-native/native-portable-types.d.ts +166 -0
  347. package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -0
  348. package/dist/domains/comet-native/native-portable-types.js +18 -0
  349. package/dist/domains/comet-native/native-portable-types.js.map +1 -0
  350. package/dist/domains/comet-native/native-repair-integration.js +5 -5
  351. package/dist/domains/comet-native/native-repair-integration.js.map +1 -1
  352. package/dist/domains/comet-native/native-resume-view.d.ts.map +1 -1
  353. package/dist/domains/comet-native/native-resume-view.js +1 -5
  354. package/dist/domains/comet-native/native-resume-view.js.map +1 -1
  355. package/dist/domains/comet-native/native-root-move.d.ts.map +1 -1
  356. package/dist/domains/comet-native/native-root-move.js +4 -20
  357. package/dist/domains/comet-native/native-root-move.js.map +1 -1
  358. package/dist/domains/comet-native/native-run-consistency.d.ts.map +1 -1
  359. package/dist/domains/comet-native/native-run-consistency.js +8 -12
  360. package/dist/domains/comet-native/native-run-consistency.js.map +1 -1
  361. package/dist/domains/comet-native/native-run-store.js +4 -4
  362. package/dist/domains/comet-native/native-run-store.js.map +1 -1
  363. package/dist/domains/comet-native/native-runner-input.d.ts +160 -0
  364. package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -0
  365. package/dist/domains/comet-native/native-runner-input.js +347 -0
  366. package/dist/domains/comet-native/native-runner-input.js.map +1 -0
  367. package/dist/domains/comet-native/native-runner-protocol.d.ts +40 -0
  368. package/dist/domains/comet-native/native-runner-protocol.d.ts.map +1 -0
  369. package/dist/domains/comet-native/native-runner-protocol.js +55 -0
  370. package/dist/domains/comet-native/native-runner-protocol.js.map +1 -0
  371. package/dist/domains/comet-native/native-runtime-package.d.ts +3 -0
  372. package/dist/domains/comet-native/native-runtime-package.d.ts.map +1 -1
  373. package/dist/domains/comet-native/native-runtime-package.js +5 -1
  374. package/dist/domains/comet-native/native-runtime-package.js.map +1 -1
  375. package/dist/domains/comet-native/native-schema-migration.d.ts.map +1 -1
  376. package/dist/domains/comet-native/native-schema-migration.js +30 -27
  377. package/dist/domains/comet-native/native-schema-migration.js.map +1 -1
  378. package/dist/domains/comet-native/native-select-command.d.ts.map +1 -1
  379. package/dist/domains/comet-native/native-select-command.js +8 -4
  380. package/dist/domains/comet-native/native-select-command.js.map +1 -1
  381. package/dist/domains/comet-native/native-selection.d.ts.map +1 -1
  382. package/dist/domains/comet-native/native-selection.js +11 -2
  383. package/dist/domains/comet-native/native-selection.js.map +1 -1
  384. package/dist/domains/comet-native/native-show-command.d.ts.map +1 -1
  385. package/dist/domains/comet-native/native-show-command.js +37 -0
  386. package/dist/domains/comet-native/native-show-command.js.map +1 -1
  387. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  388. package/dist/domains/comet-native/native-snapshot.js +13 -10
  389. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  390. package/dist/domains/comet-native/native-spec-command.d.ts.map +1 -1
  391. package/dist/domains/comet-native/native-spec-command.js +14 -28
  392. package/dist/domains/comet-native/native-spec-command.js.map +1 -1
  393. package/dist/domains/comet-native/native-specs.js +3 -3
  394. package/dist/domains/comet-native/native-specs.js.map +1 -1
  395. package/dist/domains/comet-native/native-status-command.d.ts.map +1 -1
  396. package/dist/domains/comet-native/native-status-command.js +7 -17
  397. package/dist/domains/comet-native/native-status-command.js.map +1 -1
  398. package/dist/domains/comet-native/native-status-discovery.d.ts +51 -0
  399. package/dist/domains/comet-native/native-status-discovery.d.ts.map +1 -0
  400. package/dist/domains/comet-native/native-status-discovery.js +299 -0
  401. package/dist/domains/comet-native/native-status-discovery.js.map +1 -0
  402. package/dist/domains/comet-native/native-trajectory-recovery.d.ts.map +1 -1
  403. package/dist/domains/comet-native/native-trajectory-recovery.js +6 -9
  404. package/dist/domains/comet-native/native-trajectory-recovery.js.map +1 -1
  405. package/dist/domains/comet-native/native-transaction.d.ts.map +1 -1
  406. package/dist/domains/comet-native/native-transaction.js +31 -20
  407. package/dist/domains/comet-native/native-transaction.js.map +1 -1
  408. package/dist/domains/comet-native/native-transition-evidence.d.ts.map +1 -1
  409. package/dist/domains/comet-native/native-transition-evidence.js +1 -0
  410. package/dist/domains/comet-native/native-transition-evidence.js.map +1 -1
  411. package/dist/domains/comet-native/native-transition-journal.d.ts.map +1 -1
  412. package/dist/domains/comet-native/native-transition-journal.js +71 -22
  413. package/dist/domains/comet-native/native-transition-journal.js.map +1 -1
  414. package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
  415. package/dist/domains/comet-native/native-transitions.js +167 -15
  416. package/dist/domains/comet-native/native-transitions.js.map +1 -1
  417. package/dist/domains/comet-native/native-types.d.ts +36 -1
  418. package/dist/domains/comet-native/native-types.d.ts.map +1 -1
  419. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  420. package/dist/domains/comet-native/native-verification-receipt-runtime.js +18 -100
  421. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  422. package/dist/domains/comet-native/native-verification-report-v2.d.ts +12 -0
  423. package/dist/domains/comet-native/native-verification-report-v2.d.ts.map +1 -0
  424. package/dist/domains/comet-native/native-verification-report-v2.js +141 -0
  425. package/dist/domains/comet-native/native-verification-report-v2.js.map +1 -0
  426. package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
  427. package/dist/domains/comet-native/native-verification-runtime.js +7 -2
  428. package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
  429. package/dist/domains/comet-native/native-verification-scope.d.ts +23 -0
  430. package/dist/domains/comet-native/native-verification-scope.d.ts.map +1 -1
  431. package/dist/domains/comet-native/native-verification-scope.js +106 -19
  432. package/dist/domains/comet-native/native-verification-scope.js.map +1 -1
  433. package/dist/domains/comet-native/native-verifier-protocol.d.ts +49 -0
  434. package/dist/domains/comet-native/native-verifier-protocol.d.ts.map +1 -0
  435. package/dist/domains/comet-native/native-verifier-protocol.js +157 -0
  436. package/dist/domains/comet-native/native-verifier-protocol.js.map +1 -0
  437. package/dist/domains/comet-native/native-workspace-finish.d.ts +61 -0
  438. package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -0
  439. package/dist/domains/comet-native/native-workspace-finish.js +332 -0
  440. package/dist/domains/comet-native/native-workspace-finish.js.map +1 -0
  441. package/dist/domains/comet-native/native-workspace-preparation.d.ts +32 -0
  442. package/dist/domains/comet-native/native-workspace-preparation.d.ts.map +1 -0
  443. package/dist/domains/comet-native/native-workspace-preparation.js +324 -0
  444. package/dist/domains/comet-native/native-workspace-preparation.js.map +1 -0
  445. package/dist/domains/comet-native/native-workspace.d.ts +9 -1
  446. package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
  447. package/dist/domains/comet-native/native-workspace.js +109 -11
  448. package/dist/domains/comet-native/native-workspace.js.map +1 -1
  449. package/dist/domains/dashboard/collector.d.ts +1 -1
  450. package/dist/domains/dashboard/collector.d.ts.map +1 -1
  451. package/dist/domains/dashboard/collector.js +102 -87
  452. package/dist/domains/dashboard/collector.js.map +1 -1
  453. package/dist/domains/dashboard/native-adapter.d.ts +155 -126
  454. package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
  455. package/dist/domains/dashboard/native-adapter.js +165 -268
  456. package/dist/domains/dashboard/native-adapter.js.map +1 -1
  457. package/dist/domains/dashboard/native-collector.d.ts +5 -4
  458. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  459. package/dist/domains/dashboard/native-collector.js +506 -439
  460. package/dist/domains/dashboard/native-collector.js.map +1 -1
  461. package/dist/domains/dashboard/native-legacy-adapter.d.ts +37 -0
  462. package/dist/domains/dashboard/native-legacy-adapter.d.ts.map +1 -0
  463. package/dist/domains/dashboard/native-legacy-adapter.js +127 -0
  464. package/dist/domains/dashboard/native-legacy-adapter.js.map +1 -0
  465. package/dist/domains/dashboard/server.d.ts.map +1 -1
  466. package/dist/domains/dashboard/server.js +5 -3
  467. package/dist/domains/dashboard/server.js.map +1 -1
  468. package/dist/domains/dashboard/types.d.ts +5 -0
  469. package/dist/domains/dashboard/types.d.ts.map +1 -1
  470. package/dist/domains/dashboard/web/assets/abnfDiagram-N423BO3Z-B5cFR6hS.js +1 -0
  471. package/dist/domains/dashboard/web/assets/arc-CVQDtMsu.js +1 -0
  472. package/dist/domains/dashboard/web/assets/architectureDiagram-T3A2C74G-C0v0kULK.js +36 -0
  473. package/dist/domains/dashboard/web/assets/blockDiagram-VBNYF7ZC-DpHLuxu4.js +132 -0
  474. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-Ca5zba3N.js → c4Diagram-5PPSVZJV-BHnFxUs1.js} +1 -1
  475. package/dist/domains/dashboard/web/assets/channel-eM0x3m1G.js +1 -0
  476. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-Bj6HWRwi.js → chunk-2GRJ4B5K-CGC9gh5n.js} +1 -1
  477. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-B1kXfg5N.js → chunk-2Q5K7J3B-l4puLU_O.js} +1 -1
  478. package/dist/domains/dashboard/web/assets/chunk-5RXB4S5H-ls9jQHZc.js +231 -0
  479. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-BAJLB5V6.js → chunk-5VM5RSS4-BVavmTEq.js} +1 -1
  480. package/dist/domains/dashboard/web/assets/chunk-6Q2QTUOP-Dungt2g9.js +88 -0
  481. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-CwghIMO9.js → chunk-GF5L2VYU-BidXO_ZP.js} +5 -5
  482. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-JYluRsP-.js → chunk-JWPE2WC7-57L5Up5X.js} +1 -1
  483. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-CCVPBm0J.js → chunk-KBJHAD2P-C5u5vbwr.js} +1 -1
  484. package/dist/domains/dashboard/web/assets/chunk-RYQCIY6F-CvLz21I2.js +1 -0
  485. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-DfYm7pN7.js → chunk-XXDRQBXY-D5nJpckG.js} +1 -1
  486. package/dist/domains/dashboard/web/assets/classDiagram-JCYQIIEL-CEFhao2K.js +1 -0
  487. package/dist/domains/dashboard/web/assets/classDiagram-v2-OCEON4UE-CEFhao2K.js +1 -0
  488. package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-BBrkuiAU.js → cose-bilkent-JH36ORCC-Dp0JAGyE.js} +1 -1
  489. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-DlFhgQHt.js → cynefin-VYW2F7L2-EjC54l1g.js} +2 -2
  490. package/dist/domains/dashboard/web/assets/cynefinDiagram-MW4NZA55-CpYrW3w3.js +62 -0
  491. package/dist/domains/dashboard/web/assets/dagre-VZM6K2ZE-h5K39rCk.js +4 -0
  492. package/dist/domains/dashboard/web/assets/demo-BfLsKrIL.js +45 -0
  493. package/dist/domains/dashboard/web/assets/diagram-7IWD3JNH-CKQj9O4H.js +30 -0
  494. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-BQahyP-C.js → diagram-B4RE2ZJO-DXRIYcnW.js} +3 -3
  495. package/dist/domains/dashboard/web/assets/diagram-LBJQPF4R-wWutQYmv.js +24 -0
  496. package/dist/domains/dashboard/web/assets/diagram-Q27KOJAE-EgXLJQYi.js +24 -0
  497. package/dist/domains/dashboard/web/assets/diagram-UB23O5K3-CsQRXDQZ.js +41 -0
  498. package/dist/domains/dashboard/web/assets/ebnfDiagram-BXEA7PRR-gm328Eho.js +1 -0
  499. package/dist/domains/dashboard/web/assets/erDiagram-JOGREHBK-BbbMVUx_.js +85 -0
  500. package/dist/domains/dashboard/web/assets/flowDiagram-UKHOOZJN-1Y7scCns.js +156 -0
  501. package/dist/domains/dashboard/web/assets/ganttDiagram-PKOTCBZU-BAoBqczv.js +292 -0
  502. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-DCxvMAUJ.js → gitGraphDiagram-DS77QQ5N-CMUAyEzl.js} +3 -3
  503. package/dist/domains/dashboard/web/assets/{graph--OzhPTMs.js → graph-DOmOIIwC.js} +1 -1
  504. package/dist/domains/dashboard/web/assets/{index-Blit0P5Z.js → index-CCApJ0Yr.js} +1 -1
  505. package/dist/domains/dashboard/web/assets/index-DWdm_XBi.js +257 -0
  506. package/dist/domains/dashboard/web/assets/index-DhhbseFJ.css +1 -0
  507. package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-9qXEkzDe.js → infoDiagram-6WML65LV-BaCdtYYC.js} +1 -1
  508. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-Dkf5othW.js → ishikawaDiagram-WSZJBQD7-DQQlNnjU.js} +4 -4
  509. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-C2_IkO4s.js → journeyDiagram-NVQOT4AX-DW9wUMqn.js} +1 -1
  510. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-BxWgu4DL.js → kanban-definition-27J2QSJJ-C_ITaZ0q.js} +7 -7
  511. package/dist/domains/dashboard/web/assets/layout-D-LzfAck.js +1 -0
  512. package/dist/domains/dashboard/web/assets/{linear-Dkr6p-Ro.js → linear-DXOo6ZRT.js} +1 -1
  513. package/dist/domains/dashboard/web/assets/map-DxJ2ADlA.js +1 -0
  514. package/dist/domains/dashboard/web/assets/mermaid.core-ol-0NI97.js +306 -0
  515. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-C9xyxGfa.js → mindmap-definition-FAOFIHXS-CHF_HOLV.js} +1 -1
  516. package/dist/domains/dashboard/web/assets/pegDiagram-VL7TDLO6-wQEvkNF8.js +1 -0
  517. package/dist/domains/dashboard/web/assets/pieDiagram-7S7Q4E2Y-C3H3kiIP.js +39 -0
  518. package/dist/domains/dashboard/web/assets/purify.es-Cz4mVeUR.js +3 -0
  519. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-Cy6iOcxc.js → quadrantDiagram-CIZ2JOQS-S0FdVzJb.js} +4 -4
  520. package/dist/domains/dashboard/web/assets/railroadDiagram-AXF67PYL-DCDXDaVg.js +1 -0
  521. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-B_gZONhx.js → requirementDiagram-LRYGKXZP-BW8J4gO_.js} +1 -1
  522. package/dist/domains/dashboard/web/assets/sankeyDiagram-W5VNT64P-DQQBmLoy.js +40 -0
  523. package/dist/domains/dashboard/web/assets/sequenceDiagram-SI44F4Z6-2tDcli0Y.js +162 -0
  524. package/dist/domains/dashboard/web/assets/sizeCapture-X5ZJPWSS-4sEZLBKb.js +1 -0
  525. package/dist/domains/dashboard/web/assets/stateDiagram-OKZ733FA-OgPb8pyR.js +1 -0
  526. package/dist/domains/dashboard/web/assets/stateDiagram-v2-UEYNNEHI-CiDNPr4P.js +1 -0
  527. package/dist/domains/dashboard/web/assets/swimlanes-SLNWSIFB-DR7lwtxd.js +2 -0
  528. package/dist/domains/dashboard/web/assets/swimlanesDiagram-ULZ7WXOC-DggHFP9q.js +8 -0
  529. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-DvONX2YQ.js → timeline-definition-Z64GVDOM-DNIJVlQV.js} +4 -4
  530. package/dist/domains/dashboard/web/assets/vennDiagram-T6HMQDX7-CClhw4QZ.js +34 -0
  531. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-cf39WX2o.js → wardleyDiagram-T6FBY63Y-DzR3aFPS.js} +3 -3
  532. package/dist/domains/dashboard/web/assets/xychartDiagram-ELKLHX3M-DZhq0ZRj.js +7 -0
  533. package/dist/domains/dashboard/web/index.html +16 -16
  534. package/dist/domains/dashboard/workspace.d.ts +24 -0
  535. package/dist/domains/dashboard/workspace.d.ts.map +1 -0
  536. package/dist/domains/dashboard/workspace.js +87 -0
  537. package/dist/domains/dashboard/workspace.js.map +1 -0
  538. package/dist/domains/eval/index.d.ts +3 -0
  539. package/dist/domains/eval/index.d.ts.map +1 -1
  540. package/dist/domains/eval/index.js +3 -0
  541. package/dist/domains/eval/index.js.map +1 -1
  542. package/dist/domains/eval/standalone-context.d.ts +19 -0
  543. package/dist/domains/eval/standalone-context.d.ts.map +1 -0
  544. package/dist/domains/eval/standalone-context.js +107 -0
  545. package/dist/domains/eval/standalone-context.js.map +1 -0
  546. package/dist/domains/eval/standalone-static-collect.d.ts +22 -0
  547. package/dist/domains/eval/standalone-static-collect.d.ts.map +1 -0
  548. package/dist/domains/eval/standalone-static-collect.js +779 -0
  549. package/dist/domains/eval/standalone-static-collect.js.map +1 -0
  550. package/dist/domains/eval/user-environment.d.ts +6 -0
  551. package/dist/domains/eval/user-environment.d.ts.map +1 -0
  552. package/dist/domains/eval/user-environment.js +73 -0
  553. package/dist/domains/eval/user-environment.js.map +1 -0
  554. package/dist/domains/integrations/openspec.d.ts +1 -1
  555. package/dist/domains/integrations/openspec.d.ts.map +1 -1
  556. package/dist/domains/integrations/openspec.js +110 -26
  557. package/dist/domains/integrations/openspec.js.map +1 -1
  558. package/dist/domains/integrations/superpowers.d.ts +5 -1
  559. package/dist/domains/integrations/superpowers.d.ts.map +1 -1
  560. package/dist/domains/integrations/superpowers.js +21 -2
  561. package/dist/domains/integrations/superpowers.js.map +1 -1
  562. package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
  563. package/dist/domains/skill/platform-inspect.js +11 -3
  564. package/dist/domains/skill/platform-inspect.js.map +1 -1
  565. package/dist/domains/skill/platform-install.d.ts +8 -2
  566. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  567. package/dist/domains/skill/platform-install.js +115 -34
  568. package/dist/domains/skill/platform-install.js.map +1 -1
  569. package/dist/domains/skill/project-instructions.d.ts.map +1 -1
  570. package/dist/domains/skill/project-instructions.js +5 -3
  571. package/dist/domains/skill/project-instructions.js.map +1 -1
  572. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  573. package/dist/domains/skill/uninstall.js +69 -15
  574. package/dist/domains/skill/uninstall.js.map +1 -1
  575. package/dist/domains/workflow-contract/hook-write-policy.d.ts +9 -0
  576. package/dist/domains/workflow-contract/hook-write-policy.d.ts.map +1 -0
  577. package/dist/domains/workflow-contract/hook-write-policy.js +52 -0
  578. package/dist/domains/workflow-contract/hook-write-policy.js.map +1 -0
  579. package/dist/domains/workflow-contract/index.d.ts +3 -0
  580. package/dist/domains/workflow-contract/index.d.ts.map +1 -1
  581. package/dist/domains/workflow-contract/index.js +2 -0
  582. package/dist/domains/workflow-contract/index.js.map +1 -1
  583. package/dist/domains/workflow-contract/project-config.d.ts +3 -1
  584. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  585. package/dist/domains/workflow-contract/project-config.js +119 -19
  586. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  587. package/dist/domains/workflow-contract/project-gitignore.d.ts +9 -0
  588. package/dist/domains/workflow-contract/project-gitignore.d.ts.map +1 -0
  589. package/dist/domains/workflow-contract/project-gitignore.js +108 -0
  590. package/dist/domains/workflow-contract/project-gitignore.js.map +1 -0
  591. package/dist/domains/workflow-contract/protected-project-path.d.ts +13 -0
  592. package/dist/domains/workflow-contract/protected-project-path.d.ts.map +1 -1
  593. package/dist/domains/workflow-contract/protected-project-path.js +83 -0
  594. package/dist/domains/workflow-contract/protected-project-path.js.map +1 -1
  595. package/dist/domains/workflow-contract/types.d.ts +4 -0
  596. package/dist/domains/workflow-contract/types.d.ts.map +1 -1
  597. package/dist/platform/install/platforms.d.ts +3 -1
  598. package/dist/platform/install/platforms.d.ts.map +1 -1
  599. package/dist/platform/install/platforms.js +22 -2
  600. package/dist/platform/install/platforms.js.map +1 -1
  601. package/dist/platform/paths/git-worktree.d.ts +8 -1
  602. package/dist/platform/paths/git-worktree.d.ts.map +1 -1
  603. package/dist/platform/paths/git-worktree.js +41 -7
  604. package/dist/platform/paths/git-worktree.js.map +1 -1
  605. package/dist/platform/process/external-command.d.ts +13 -0
  606. package/dist/platform/process/external-command.d.ts.map +1 -0
  607. package/dist/platform/process/external-command.js +45 -0
  608. package/dist/platform/process/external-command.js.map +1 -0
  609. package/dist/platform/process/git.d.ts +12 -0
  610. package/dist/platform/process/git.d.ts.map +1 -0
  611. package/dist/platform/process/git.js +86 -0
  612. package/dist/platform/process/git.js.map +1 -0
  613. package/dist/platform/process/spawn-command.d.ts +8 -0
  614. package/dist/platform/process/spawn-command.d.ts.map +1 -0
  615. package/dist/platform/process/spawn-command.js +113 -0
  616. package/dist/platform/process/spawn-command.js.map +1 -0
  617. package/eval/.env.example +115 -0
  618. package/eval/README.md +237 -14
  619. package/eval/langfuse/.env.example +9 -0
  620. package/eval/langfuse/tests/conftest.py +146 -0
  621. package/eval/langfuse/tests/tasks/test_tasks.py +109 -0
  622. package/eval/langfuse/tests/test_adapter.py +272 -0
  623. package/eval/langsmith/.env.example +16 -0
  624. package/eval/langsmith/tests/conftest.py +10 -1
  625. package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +4 -2
  626. package/eval/local/tasks/comet-native-clarification/validation/test_native_clarification.py +9 -21
  627. package/eval/local/tasks/comet-native-clarification-depth/validation/test_native_clarification_depth.py +4 -7
  628. package/eval/local/tasks/comet-native-clarification-modes/validation/test_native_clarification_modes.py +4 -10
  629. package/eval/local/tasks/comet-native-interrupted-transition/instruction.md +1 -1
  630. package/eval/local/tasks/comet-native-interrupted-transition/validation/test_native_interrupted_transition.py +15 -16
  631. package/eval/local/tasks/comet-native-repository-fact/instruction.md +2 -2
  632. package/eval/local/tasks/comet-native-repository-fact/validation/test_native_repository_fact.py +8 -2
  633. package/eval/local/tasks/comet-native-wave-b-decision-resume/instruction.md +8 -4
  634. package/eval/local/tasks/comet-native-wave-b-decision-resume/task.toml +6 -6
  635. package/eval/local/tasks/comet-native-wave-b-decision-resume/validation/test_native_wave_b_decision_resume.py +126 -135
  636. package/eval/local/tasks/comet-native-wave-c-verification-integrity/instruction.md +6 -6
  637. package/eval/local/tasks/comet-native-wave-c-verification-integrity/task.toml +8 -8
  638. package/eval/local/tasks/comet-native-wave-c-verification-integrity/validation/test_native_wave_c_verification_integrity.py +97 -317
  639. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/instruction.md +7 -7
  640. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/task.toml +4 -4
  641. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/validation/test_native_wave_d_stagnation_stop.py +130 -199
  642. package/eval/local/tasks/comet-native-wave-e-parallel-safety/instruction.md +5 -5
  643. package/eval/local/tasks/comet-native-wave-e-parallel-safety/task.toml +8 -8
  644. package/eval/local/tasks/comet-native-wave-e-parallel-safety/validation/test_native_wave_e_parallel_safety.py +135 -239
  645. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +2 -2
  646. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/instruction.md +3 -3
  647. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/task.toml +6 -6
  648. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/validation/test_native_wave_f_dashboard_readonly.py +81 -439
  649. package/eval/local/tasks/comet-native-workflow/instruction.md +5 -4
  650. package/eval/local/tasks/comet-native-workflow/validation/test_native_workflow.py +145 -502
  651. package/eval/local/tasks/index.yaml +5 -5
  652. package/eval/local/tests/conftest.py +701 -80
  653. package/eval/local/tests/scaffold/fixtures/custom-agent/adapter.yaml +19 -0
  654. package/eval/local/tests/scaffold/test_agents.py +76 -0
  655. package/eval/local/tests/scaffold/test_aligned_comparison.py +70 -0
  656. package/eval/local/tests/scaffold/test_auto_tasks.py +350 -0
  657. package/eval/local/tests/scaffold/test_conftest_helpers.py +267 -18
  658. package/eval/local/tests/scaffold/test_custom_agents.py +174 -0
  659. package/eval/local/tests/scaffold/test_eval_context.py +217 -0
  660. package/eval/local/tests/scaffold/test_execution.py +364 -0
  661. package/eval/local/tests/scaffold/test_inline_tasks.py +56 -0
  662. package/eval/local/tests/scaffold/test_langfuse_trajectory.py +263 -0
  663. package/eval/local/tests/scaffold/test_langsmith_conftest.py +63 -0
  664. package/eval/local/tests/scaffold/test_logging.py +162 -0
  665. package/eval/local/tests/scaffold/test_manifest_tasks.py +76 -0
  666. package/eval/local/tests/scaffold/test_manifests.py +396 -0
  667. package/eval/local/tests/scaffold/test_native_aligned_eval.py +163 -35
  668. package/eval/local/tests/scaffold/test_native_wave_evaluations.py +75 -2054
  669. package/eval/local/tests/scaffold/test_profiles.py +64 -6
  670. package/eval/local/tests/scaffold/test_task_resolution.py +212 -0
  671. package/eval/local/tests/scaffold/test_tasks.py +38 -52
  672. package/eval/local/tests/scaffold/test_utils.py +480 -4
  673. package/eval/local/tests/tasks/test_tasks.py +219 -17
  674. package/eval/local/treatments/comet/comet_native_phase1.yaml +7 -4
  675. package/eval/pyproject.toml +9 -4
  676. package/eval/scaffold/__init__.py +6 -0
  677. package/eval/scaffold/docker/agent-overlay.Dockerfile +41 -0
  678. package/eval/scaffold/python/__init__.py +128 -20
  679. package/eval/scaffold/python/agents.py +239 -0
  680. package/eval/scaffold/python/aligned_comparison.py +156 -27
  681. package/eval/scaffold/python/auto_tasks.py +700 -0
  682. package/eval/scaffold/python/custom_agents.py +172 -0
  683. package/eval/scaffold/python/eval_context.py +236 -0
  684. package/eval/scaffold/python/eval_schema.py +135 -0
  685. package/eval/scaffold/python/execution.py +544 -0
  686. package/eval/scaffold/python/generated_task_cache.py +230 -0
  687. package/eval/scaffold/python/generic_llm_judge.py +41 -14
  688. package/eval/scaffold/python/inline_tasks.py +118 -0
  689. package/eval/scaffold/python/judge_config.py +158 -37
  690. package/eval/scaffold/python/langfuse_adapter.py +1023 -0
  691. package/eval/scaffold/python/llm_judge.py +68 -11
  692. package/eval/scaffold/python/logging.py +157 -17
  693. package/eval/scaffold/python/manifest_tasks.py +69 -0
  694. package/eval/scaffold/python/manifests.py +443 -22
  695. package/eval/scaffold/python/native_eval.py +10 -5
  696. package/eval/scaffold/python/paths.py +11 -1
  697. package/eval/scaffold/python/task_resolution.py +176 -0
  698. package/eval/scaffold/python/tasks.py +17 -4
  699. package/eval/scaffold/python/utils.py +167 -11
  700. package/eval/scaffold/python/validation/core.py +48 -2
  701. package/eval/scaffold/python/validation/generic_rubric.py +9 -0
  702. package/eval/scaffold/python/validation/native_v4.py +249 -0
  703. package/eval/scaffold/python/validation/native_wave.py +4 -5
  704. package/eval/scaffold/python/validation/native_workflow.py +199 -98
  705. package/eval/scaffold/python/validation/rubric.py +130 -2
  706. package/eval/scaffold/shell/agent-runtime-config.sh +88 -0
  707. package/eval/scaffold/shell/docker.sh +534 -33
  708. package/eval/scaffold/shell/run-agent-runtime.sh +49 -0
  709. package/eval/scaffold/shell/run-claude-loop.sh +153 -14
  710. package/eval/schemas/comet.eval/v1alpha1.schema.json +244 -0
  711. package/package.json +9 -3
  712. package/assets/skills/comet-native/scripts/comet-native-check.mjs +0 -179
  713. package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +0 -179
  714. package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +0 -151
  715. package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +0 -187
  716. package/dist/domains/comet-native/native-check-entry.d.ts +0 -2
  717. package/dist/domains/comet-native/native-check-entry.d.ts.map +0 -1
  718. package/dist/domains/comet-native/native-check-entry.js +0 -4
  719. package/dist/domains/comet-native/native-check-entry.js.map +0 -1
  720. package/dist/domains/comet-native/native-checkpoint-entry.d.ts +0 -2
  721. package/dist/domains/comet-native/native-checkpoint-entry.d.ts.map +0 -1
  722. package/dist/domains/comet-native/native-checkpoint-entry.js +0 -4
  723. package/dist/domains/comet-native/native-checkpoint-entry.js.map +0 -1
  724. package/dist/domains/comet-native/native-evidence-entry.d.ts +0 -2
  725. package/dist/domains/comet-native/native-evidence-entry.d.ts.map +0 -1
  726. package/dist/domains/comet-native/native-evidence-entry.js +0 -4
  727. package/dist/domains/comet-native/native-evidence-entry.js.map +0 -1
  728. package/dist/domains/comet-native/native-receipt-entry.d.ts +0 -2
  729. package/dist/domains/comet-native/native-receipt-entry.d.ts.map +0 -1
  730. package/dist/domains/comet-native/native-receipt-entry.js +0 -4
  731. package/dist/domains/comet-native/native-receipt-entry.js.map +0 -1
  732. package/dist/domains/dashboard/web/assets/arc-ClrSujVb.js +0 -1
  733. package/dist/domains/dashboard/web/assets/architectureDiagram-3BPJPVTR-B4A_t84A.js +0 -36
  734. package/dist/domains/dashboard/web/assets/blockDiagram-GPEHLZMM-D72u2953.js +0 -132
  735. package/dist/domains/dashboard/web/assets/channel-B_u-_i2t.js +0 -1
  736. package/dist/domains/dashboard/web/assets/chunk-AQP2D5EJ-BA_zgMXZ.js +0 -231
  737. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BpA7BPgX.js +0 -1
  738. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BpA7BPgX.js +0 -1
  739. package/dist/domains/dashboard/web/assets/dagre-BM42HDAG-B0Bk5oiP.js +0 -4
  740. package/dist/domains/dashboard/web/assets/demo-DZYPLZpF.js +0 -25
  741. package/dist/domains/dashboard/web/assets/diagram-2AECGRRQ-tvTUiBA2.js +0 -43
  742. package/dist/domains/dashboard/web/assets/diagram-5GNKFQAL-BZfcK29q.js +0 -10
  743. package/dist/domains/dashboard/web/assets/diagram-LMA3HP47-D5bJnW2C.js +0 -24
  744. package/dist/domains/dashboard/web/assets/diagram-OG6HWLK6-DTwWdzWJ.js +0 -24
  745. package/dist/domains/dashboard/web/assets/erDiagram-TEJ5UH35-BbvrdCp9.js +0 -85
  746. package/dist/domains/dashboard/web/assets/flowDiagram-I6XJVG4X-DgbR7Tcc.js +0 -162
  747. package/dist/domains/dashboard/web/assets/ganttDiagram-6RSMTGT7-wWMOA7F4.js +0 -292
  748. package/dist/domains/dashboard/web/assets/index-Bk1o-4VO.css +0 -1
  749. package/dist/domains/dashboard/web/assets/index-g8vyW0R_.js +0 -257
  750. package/dist/domains/dashboard/web/assets/layout-SsrduOYp.js +0 -1
  751. package/dist/domains/dashboard/web/assets/mermaid.core-DZUcsoG4.js +0 -301
  752. package/dist/domains/dashboard/web/assets/pieDiagram-4H26LBE5-Dn67tdOF.js +0 -30
  753. package/dist/domains/dashboard/web/assets/purify.es-VaSPOPhr.js +0 -3
  754. package/dist/domains/dashboard/web/assets/sankeyDiagram-5OEKKPKP-C3u-4dOk.js +0 -40
  755. package/dist/domains/dashboard/web/assets/sequenceDiagram-3UESZ5HK-Xd3ByTVF.js +0 -162
  756. package/dist/domains/dashboard/web/assets/stateDiagram-AJRCARHV-CJGHL7Up.js +0 -1
  757. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-rKvBgr6I.js +0 -1
  758. package/dist/domains/dashboard/web/assets/vennDiagram-CIIHVFJN-B-L4qWy4.js +0 -34
  759. package/dist/domains/dashboard/web/assets/xychartDiagram-2RQKCTM6-Dk1vcm3u.js +0 -7
  760. /package/assets/skills/{comet → comet-classic}/reference/classic-layout.md +0 -0
  761. /package/assets/skills-zh/{comet → comet-classic}/reference/classic-layout.md +0 -0
@@ -1,158 +1,167 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var Ql=Object.create;var Ka=Object.defineProperty;var Zl=Object.getOwnPropertyDescriptor;var eu=Object.getOwnPropertyNames;var tu=Object.getPrototypeOf,iu=Object.prototype.hasOwnProperty;var Qt=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}};var nu=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of eu(e))!iu.call(t,r)&&r!==i&&Ka(t,r,{get:()=>e[r],enumerable:!(n=Zl(e,r))||n.enumerable});return t};var On=(t,e,i)=>(i=t!=null?Ql(tu(t)):{},nu(e||!t||!t.__esModule?Ka(i,"default",{value:t,enumerable:!0}):i,t));var C=w(j=>{"use strict";var $n=Symbol.for("yaml.alias"),io=Symbol.for("yaml.document"),Zt=Symbol.for("yaml.map"),no=Symbol.for("yaml.pair"),Ln=Symbol.for("yaml.scalar"),ei=Symbol.for("yaml.seq"),ae=Symbol.for("yaml.node.type"),mu=t=>!!t&&typeof t=="object"&&t[ae]===$n,vu=t=>!!t&&typeof t=="object"&&t[ae]===io,gu=t=>!!t&&typeof t=="object"&&t[ae]===Zt,wu=t=>!!t&&typeof t=="object"&&t[ae]===no,ro=t=>!!t&&typeof t=="object"&&t[ae]===Ln,yu=t=>!!t&&typeof t=="object"&&t[ae]===ei;function ao(t){if(t&&typeof t=="object")switch(t[ae]){case Zt:case ei:return!0}return!1}function Nu(t){if(t&&typeof t=="object")switch(t[ae]){case $n:case Zt:case Ln:case ei:return!0}return!1}var bu=t=>(ro(t)||ao(t))&&!!t.anchor;j.ALIAS=$n;j.DOC=io;j.MAP=Zt;j.NODE_TYPE=ae;j.PAIR=no;j.SCALAR=Ln;j.SEQ=ei;j.hasAnchor=bu;j.isAlias=mu;j.isCollection=ao;j.isDocument=vu;j.isMap=gu;j.isNode=Nu;j.isPair=wu;j.isScalar=ro;j.isSeq=yu});var lt=w(Fn=>{"use strict";var O=C(),$=Symbol("break visit"),oo=Symbol("skip children"),Z=Symbol("remove node");function ti(t,e){let i=so(e);O.isDocument(t)?Ve(null,t.contents,i,Object.freeze([t]))===Z&&(t.contents=null):Ve(null,t,i,Object.freeze([]))}ti.BREAK=$;ti.SKIP=oo;ti.REMOVE=Z;function Ve(t,e,i,n){let r=co(t,e,i,n);if(O.isNode(r)||O.isPair(r))return lo(t,n,r),Ve(t,r,i,n);if(typeof r!="symbol"){if(O.isCollection(e)){n=Object.freeze(n.concat(e));for(let a=0;a<e.items.length;++a){let o=Ve(a,e.items[a],i,n);if(typeof o=="number")a=o-1;else{if(o===$)return $;o===Z&&(e.items.splice(a,1),a-=1)}}}else if(O.isPair(e)){n=Object.freeze(n.concat(e));let a=Ve("key",e.key,i,n);if(a===$)return $;a===Z&&(e.key=null);let o=Ve("value",e.value,i,n);if(o===$)return $;o===Z&&(e.value=null)}}return r}async function ii(t,e){let i=so(e);O.isDocument(t)?await We(null,t.contents,i,Object.freeze([t]))===Z&&(t.contents=null):await We(null,t,i,Object.freeze([]))}ii.BREAK=$;ii.SKIP=oo;ii.REMOVE=Z;async function We(t,e,i,n){let r=await co(t,e,i,n);if(O.isNode(r)||O.isPair(r))return lo(t,n,r),We(t,r,i,n);if(typeof r!="symbol"){if(O.isCollection(e)){n=Object.freeze(n.concat(e));for(let a=0;a<e.items.length;++a){let o=await We(a,e.items[a],i,n);if(typeof o=="number")a=o-1;else{if(o===$)return $;o===Z&&(e.items.splice(a,1),a-=1)}}}else if(O.isPair(e)){n=Object.freeze(n.concat(e));let a=await We("key",e.key,i,n);if(a===$)return $;a===Z&&(e.key=null);let o=await We("value",e.value,i,n);if(o===$)return $;o===Z&&(e.value=null)}}return r}function so(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 co(t,e,i,n){if(typeof i=="function")return i(t,e,n);if(O.isMap(e))return i.Map?.(t,e,n);if(O.isSeq(e))return i.Seq?.(t,e,n);if(O.isPair(e))return i.Pair?.(t,e,n);if(O.isScalar(e))return i.Scalar?.(t,e,n);if(O.isAlias(e))return i.Alias?.(t,e,n)}function lo(t,e,i){let n=e[e.length-1];if(O.isCollection(n))n.items[t]=i;else if(O.isPair(n))t==="key"?n.key=i:n.value=i;else if(O.isDocument(n))n.contents=i;else{let r=O.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}Fn.visit=ti;Fn.visitAsync=ii});var Mn=w(fo=>{"use strict";var uo=C(),ku=lt(),Su={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Eu=t=>t.replace(/[!,[\]{}]/g,e=>Su[e]),ut=class t{constructor(e,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,i)}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,i){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case"%TAG":{if(n.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[a,o]=n;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[a]=n;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return i(6,`Unsupported YAML version ${a}`,o),!1}}default:return i(0,`Unknown directive ${r}`,!0),!1}}tagName(e,i){if(e==="!")return"!";if(e[0]!=="!")return i(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||i(`The ${e} tag has no suffix`);let a=this.tags[n];if(a)try{return a+decodeURIComponent(r)}catch(o){return i(String(o)),null}return n==="!"?e:(i(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[i,n]of Object.entries(this.tags))if(e.startsWith(n))return i+Eu(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&uo.isNode(e.contents)){let a={};ku.visit(e.contents,(o,s)=>{uo.isNode(s)&&s.tag&&(a[s.tag]=!0)}),r=Object.keys(a)}else r=[];for(let[a,o]of n)a==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
5
- `)}};ut.defaultYaml={explicit:!1,version:"1.2"};ut.defaultTags={"!!":"tag:yaml.org,2002:"};fo.Directives=ut});var ni=w(ft=>{"use strict";var ho=C(),Cu=lt();function Ru(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(i)}return!0}function po(t){let e=new Set;return Cu.visit(t,{Value(i,n){n.anchor&&e.add(n.anchor)}}),e}function mo(t,e){for(let i=1;;++i){let n=`${t}${i}`;if(!e.has(n))return n}}function Pu(t,e){let i=[],n=new Map,r=null;return{onAnchor:a=>{i.push(a),r??(r=po(t));let o=mo(e,r);return r.add(o),o},setAnchors:()=>{for(let a of i){let o=n.get(a);if(typeof o=="object"&&o.anchor&&(ho.isScalar(o.node)||ho.isCollection(o.node)))o.node.anchor=o.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=a,s}}},sourceObjects:n}}ft.anchorIsValid=Ru;ft.anchorNames=po;ft.createNodeAnchors=Pu;ft.findNewAnchor=mo});var Bn=w(vo=>{"use strict";function dt(t,e,i,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let r=0,a=n.length;r<a;++r){let o=n[r],s=dt(t,n,String(r),o);s===void 0?delete n[r]:s!==o&&(n[r]=s)}else if(n instanceof Map)for(let r of Array.from(n.keys())){let a=n.get(r),o=dt(t,n,r,a);o===void 0?n.delete(r):o!==a&&n.set(r,o)}else if(n instanceof Set)for(let r of Array.from(n)){let a=dt(t,n,r,r);a===void 0?n.delete(r):a!==r&&(n.delete(r),n.add(a))}else for(let[r,a]of Object.entries(n)){let o=dt(t,n,r,a);o===void 0?delete n[r]:o!==a&&(n[r]=o)}return t.call(e,i,n)}vo.applyReviver=dt});var le=w(wo=>{"use strict";var Au=C();function go(t,e,i){if(Array.isArray(t))return t.map((n,r)=>go(n,String(r),i));if(t&&typeof t.toJSON=="function"){if(!i||!Au.hasAnchor(t))return t.toJSON(e,i);let n={aliasCount:0,count:1,res:void 0};i.anchors.set(t,n),i.onCreate=a=>{n.res=a,delete i.onCreate};let r=t.toJSON(e,i);return i.onCreate&&i.onCreate(r),r}return typeof t=="bigint"&&!i?.keep?Number(t):t}wo.toJS=go});var ri=w(No=>{"use strict";var xu=Bn(),yo=C(),Tu=le(),Dn=class{constructor(e){Object.defineProperty(this,yo.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:i,maxAliasCount:n,onAnchor:r,reviver:a}={}){if(!yo.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},s=Tu.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof a=="function"?xu.applyReviver(a,{"":s},"",s):s}};No.NodeBase=Dn});var ht=w(bo=>{"use strict";var Iu=ni(),_u=lt(),ze=C(),Ou=ri(),ju=le(),qn=class extends Ou.NodeBase{constructor(e){super(ze.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;i?.aliasResolveCache?n=i.aliasResolveCache:(n=[],_u.visit(e,{Node:(a,o)=>{(ze.isAlias(o)||ze.hasAnchor(o))&&n.push(o)}}),i&&(i.aliasResolveCache=n));let r;for(let a of n){if(a===this)break;a.anchor===this.source&&(r=a)}return r}toJSON(e,i){if(!i)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:a}=i,o=this.resolve(r,i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=n.get(o);if(s||(ju.toJS(o,null,i),s=n.get(o)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=ai(r,o,n)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(e,i,n){let r=`*${this.source}`;if(e){if(Iu.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(e.implicitKey)return`${r} `}return r}};function ai(t,e,i){if(ze.isAlias(e)){let n=e.resolve(t),r=i&&n&&i.get(n);return r?r.count*r.aliasCount:0}else if(ze.isCollection(e)){let n=0;for(let r of e.items){let a=ai(t,r,i);a>n&&(n=a)}return n}else if(ze.isPair(e)){let n=ai(t,e.key,i),r=ai(t,e.value,i);return Math.max(n,r)}return 1}bo.Alias=qn});var T=w(Vn=>{"use strict";var Hu=C(),$u=ri(),Lu=le(),Fu=t=>!t||typeof t!="function"&&typeof t!="object",ue=class extends $u.NodeBase{constructor(e){super(Hu.SCALAR),this.value=e}toJSON(e,i){return i?.keep?this.value:Lu.toJS(this.value,e,i)}toString(){return String(this.value)}};ue.BLOCK_FOLDED="BLOCK_FOLDED";ue.BLOCK_LITERAL="BLOCK_LITERAL";ue.PLAIN="PLAIN";ue.QUOTE_DOUBLE="QUOTE_DOUBLE";ue.QUOTE_SINGLE="QUOTE_SINGLE";Vn.Scalar=ue;Vn.isScalarValue=Fu});var pt=w(So=>{"use strict";var Mu=ht(),Ce=C(),ko=T(),Bu="tag:yaml.org,2002:";function Du(t,e,i){if(e){let n=i.filter(a=>a.tag===e),r=n.find(a=>!a.format)??n[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return i.find(n=>n.identify?.(t)&&!n.format)}function qu(t,e,i){if(Ce.isDocument(t)&&(t=t.contents),Ce.isNode(t))return t;if(Ce.isPair(t)){let u=i.schema[Ce.MAP].createNode?.(i.schema,null,i);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:n,onAnchor:r,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(n&&t&&typeof t=="object"){if(c=s.get(t),c)return c.anchor??(c.anchor=r(t)),new Mu.Alias(c.anchor);c={anchor:null,node:null},s.set(t,c)}e?.startsWith("!!")&&(e=Bu+e.slice(2));let l=Du(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new ko.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?o[Ce.MAP]:Symbol.iterator in Object(t)?o[Ce.SEQ]:o[Ce.MAP]}a&&(a(l),delete i.onTagObj);let d=l?.createNode?l.createNode(i.schema,t,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,t,i):new ko.Scalar(t);return e?d.tag=e:l.default||(d.tag=l.tag),c&&(c.node=d),d}So.createNode=qu});var si=w(oi=>{"use strict";var Vu=pt(),ee=C(),Wu=ri();function Wn(t,e,i){let n=i;for(let r=e.length-1;r>=0;--r){let a=e[r];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=n,n=o}else n=new Map([[a,n]])}return Vu.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Eo=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,zn=class extends Wu.NodeBase{constructor(e,i){super(e),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(e){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(i.schema=e),i.items=i.items.map(n=>ee.isNode(n)||ee.isPair(n)?n.clone(e):n),this.range&&(i.range=this.range.slice()),i}addIn(e,i){if(Eo(e))this.add(i);else{let[n,...r]=e,a=this.get(n,!0);if(ee.isCollection(a))a.addIn(r,i);else if(a===void 0&&this.schema)this.set(n,Wn(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[i,...n]=e;if(n.length===0)return this.delete(i);let r=this.get(i,!0);if(ee.isCollection(r))return r.deleteIn(n);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}getIn(e,i){let[n,...r]=e,a=this.get(n,!0);return r.length===0?!i&&ee.isScalar(a)?a.value:a:ee.isCollection(a)?a.getIn(r,i):void 0}hasAllNullValues(e){return this.items.every(i=>{if(!ee.isPair(i))return!1;let n=i.value;return n==null||e&&ee.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[i,...n]=e;if(n.length===0)return this.has(i);let r=this.get(i,!0);return ee.isCollection(r)?r.hasIn(n):!1}setIn(e,i){let[n,...r]=e;if(r.length===0)this.set(n,i);else{let a=this.get(n,!0);if(ee.isCollection(a))a.setIn(r,i);else if(a===void 0&&this.schema)this.set(n,Wn(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};oi.Collection=zn;oi.collectionFromPath=Wn;oi.isEmptyPath=Eo});var mt=w(ci=>{"use strict";var zu=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Jn(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Ju=(t,e,i)=>t.endsWith(`
6
- `)?Jn(i,e):i.includes(`
4
+ var lf=Object.create;var gs=Object.defineProperty;var uf=Object.getOwnPropertyDescriptor;var df=Object.getOwnPropertyNames;var ff=Object.getPrototypeOf,hf=Object.prototype.hasOwnProperty;var Hi=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}};var pf=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of df(e))!hf.call(t,n)&&n!==i&&gs(t,n,{get:()=>e[n],enumerable:!(r=uf(e,n))||r.enumerable});return t};var Lt=(t,e,i)=>(i=t!=null?lf(ff(t)):{},pf(e||!t||!t.__esModule?gs(i,"default",{value:t,enumerable:!0}):i,t));var P=w(H=>{"use strict";var Mn=Symbol.for("yaml.alias"),Es=Symbol.for("yaml.document"),Bi=Symbol.for("yaml.map"),Ps=Symbol.for("yaml.pair"),Fn=Symbol.for("yaml.scalar"),Li=Symbol.for("yaml.seq"),Ce=Symbol.for("yaml.node.type"),xf=t=>!!t&&typeof t=="object"&&t[Ce]===Mn,Cf=t=>!!t&&typeof t=="object"&&t[Ce]===Es,Rf=t=>!!t&&typeof t=="object"&&t[Ce]===Bi,Af=t=>!!t&&typeof t=="object"&&t[Ce]===Ps,xs=t=>!!t&&typeof t=="object"&&t[Ce]===Fn,_f=t=>!!t&&typeof t=="object"&&t[Ce]===Li;function Cs(t){if(t&&typeof t=="object")switch(t[Ce]){case Bi:case Li:return!0}return!1}function Tf(t){if(t&&typeof t=="object")switch(t[Ce]){case Mn:case Bi:case Fn:case Li:return!0}return!1}var If=t=>(xs(t)||Cs(t))&&!!t.anchor;H.ALIAS=Mn;H.DOC=Es;H.MAP=Bi;H.NODE_TYPE=Ce;H.PAIR=Ps;H.SCALAR=Fn;H.SEQ=Li;H.hasAnchor=If;H.isAlias=xf;H.isCollection=Cs;H.isDocument=Cf;H.isMap=Rf;H.isNode=Tf;H.isPair=Af;H.isScalar=xs;H.isSeq=_f});var Ft=w(Vn=>{"use strict";var O=P(),q=Symbol("break visit"),Rs=Symbol("skip children"),ve=Symbol("remove node");function Mi(t,e){let i=As(e);O.isDocument(t)?gt(null,t.contents,i,Object.freeze([t]))===ve&&(t.contents=null):gt(null,t,i,Object.freeze([]))}Mi.BREAK=q;Mi.SKIP=Rs;Mi.REMOVE=ve;function gt(t,e,i,r){let n=_s(t,e,i,r);if(O.isNode(n)||O.isPair(n))return Ts(t,r,n),gt(t,n,i,r);if(typeof n!="symbol"){if(O.isCollection(e)){r=Object.freeze(r.concat(e));for(let a=0;a<e.items.length;++a){let o=gt(a,e.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===q)return q;o===ve&&(e.items.splice(a,1),a-=1)}}}else if(O.isPair(e)){r=Object.freeze(r.concat(e));let a=gt("key",e.key,i,r);if(a===q)return q;a===ve&&(e.key=null);let o=gt("value",e.value,i,r);if(o===q)return q;o===ve&&(e.value=null)}}return n}async function Fi(t,e){let i=As(e);O.isDocument(t)?await wt(null,t.contents,i,Object.freeze([t]))===ve&&(t.contents=null):await wt(null,t,i,Object.freeze([]))}Fi.BREAK=q;Fi.SKIP=Rs;Fi.REMOVE=ve;async function wt(t,e,i,r){let n=await _s(t,e,i,r);if(O.isNode(n)||O.isPair(n))return Ts(t,r,n),wt(t,n,i,r);if(typeof n!="symbol"){if(O.isCollection(e)){r=Object.freeze(r.concat(e));for(let a=0;a<e.items.length;++a){let o=await wt(a,e.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===q)return q;o===ve&&(e.items.splice(a,1),a-=1)}}}else if(O.isPair(e)){r=Object.freeze(r.concat(e));let a=await wt("key",e.key,i,r);if(a===q)return q;a===ve&&(e.key=null);let o=await wt("value",e.value,i,r);if(o===q)return q;o===ve&&(e.value=null)}}return n}function As(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 _s(t,e,i,r){if(typeof i=="function")return i(t,e,r);if(O.isMap(e))return i.Map?.(t,e,r);if(O.isSeq(e))return i.Seq?.(t,e,r);if(O.isPair(e))return i.Pair?.(t,e,r);if(O.isScalar(e))return i.Scalar?.(t,e,r);if(O.isAlias(e))return i.Alias?.(t,e,r)}function Ts(t,e,i){let r=e[e.length-1];if(O.isCollection(r))r.items[t]=i;else if(O.isPair(r))t==="key"?r.key=i:r.value=i;else if(O.isDocument(r))r.contents=i;else{let n=O.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}Vn.visit=Mi;Vn.visitAsync=Fi});var qn=w(js=>{"use strict";var Is=P(),jf=Ft(),$f={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Of=t=>t.replace(/[!,[\]{}]/g,e=>$f[e]),Vt=class t{constructor(e,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,i)}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,i){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[a,o]=r;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[a]=r;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return i(6,`Unsupported YAML version ${a}`,o),!1}}default:return i(0,`Unknown directive ${n}`,!0),!1}}tagName(e,i){if(e==="!")return"!";if(e[0]!=="!")return i(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,r,n]=e.match(/^(.*!)([^!]*)$/s);n||i(`The ${e} tag has no suffix`);let a=this.tags[r];if(a)try{return a+decodeURIComponent(n)}catch(o){return i(String(o)),null}return r==="!"?e:(i(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[i,r]of Object.entries(this.tags))if(e.startsWith(r))return i+Of(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(e&&r.length>0&&Is.isNode(e.contents)){let a={};jf.visit(e.contents,(o,s)=>{Is.isNode(s)&&s.tag&&(a[s.tag]=!0)}),n=Object.keys(a)}else n=[];for(let[a,o]of r)a==="!!"&&o==="tag:yaml.org,2002:"||(!e||n.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
5
+ `)}};Vt.defaultYaml={explicit:!1,version:"1.2"};Vt.defaultTags={"!!":"tag:yaml.org,2002:"};js.Directives=Vt});var Vi=w(qt=>{"use strict";var $s=P(),Hf=Ft();function Df(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(i)}return!0}function Os(t){let e=new Set;return Hf.visit(t,{Value(i,r){r.anchor&&e.add(r.anchor)}}),e}function Hs(t,e){for(let i=1;;++i){let r=`${t}${i}`;if(!e.has(r))return r}}function Bf(t,e){let i=[],r=new Map,n=null;return{onAnchor:a=>{i.push(a),n??(n=Os(t));let o=Hs(e,n);return n.add(o),o},setAnchors:()=>{for(let a of i){let o=r.get(a);if(typeof o=="object"&&o.anchor&&($s.isScalar(o.node)||$s.isCollection(o.node)))o.node.anchor=o.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=a,s}}},sourceObjects:r}}qt.anchorIsValid=Df;qt.anchorNames=Os;qt.createNodeAnchors=Bf;qt.findNewAnchor=Hs});var Wn=w(Ds=>{"use strict";function Wt(t,e,i,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let n=0,a=r.length;n<a;++n){let o=r[n],s=Wt(t,r,String(n),o);s===void 0?delete r[n]:s!==o&&(r[n]=s)}else if(r instanceof Map)for(let n of Array.from(r.keys())){let a=r.get(n),o=Wt(t,r,n,a);o===void 0?r.delete(n):o!==a&&r.set(n,o)}else if(r instanceof Set)for(let n of Array.from(r)){let a=Wt(t,r,n,n);a===void 0?r.delete(n):a!==n&&(r.delete(n),r.add(a))}else for(let[n,a]of Object.entries(r)){let o=Wt(t,r,n,a);o===void 0?delete r[n]:o!==a&&(r[n]=o)}return t.call(e,i,r)}Ds.applyReviver=Wt});var He=w(Ls=>{"use strict";var Lf=P();function Bs(t,e,i){if(Array.isArray(t))return t.map((r,n)=>Bs(r,String(n),i));if(t&&typeof t.toJSON=="function"){if(!i||!Lf.hasAnchor(t))return t.toJSON(e,i);let r={aliasCount:0,count:1,res:void 0};i.anchors.set(t,r),i.onCreate=a=>{r.res=a,delete i.onCreate};let n=t.toJSON(e,i);return i.onCreate&&i.onCreate(n),n}return typeof t=="bigint"&&!i?.keep?Number(t):t}Ls.toJS=Bs});var qi=w(Fs=>{"use strict";var Mf=Wn(),Ms=P(),Ff=He(),zn=class{constructor(e){Object.defineProperty(this,Ms.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:i,maxAliasCount:r,onAnchor:n,reviver:a}={}){if(!Ms.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},s=Ff.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:l}of o.anchors.values())n(l,c);return typeof a=="function"?Mf.applyReviver(a,{"":s},"",s):s}};Fs.NodeBase=zn});var zt=w(Vs=>{"use strict";var Vf=Vi(),qf=Ft(),yt=P(),Wf=qi(),zf=He(),Jn=class extends Wf.NodeBase{constructor(e){super(yt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;i?.aliasResolveCache?r=i.aliasResolveCache:(r=[],qf.visit(e,{Node:(a,o)=>{(yt.isAlias(o)||yt.hasAnchor(o))&&r.push(o)}}),i&&(i.aliasResolveCache=r));let n;for(let a of r){if(a===this)break;a.anchor===this.source&&(n=a)}return n}toJSON(e,i){if(!i)return{source:this.source};let{anchors:r,doc:n,maxAliasCount:a}=i,o=this.resolve(n,i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=r.get(o);if(s||(zf.toJS(o,null,i),s=r.get(o)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=Wi(n,o,r)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(e,i,r){let n=`*${this.source}`;if(e){if(Vf.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(e.implicitKey)return`${n} `}return n}};function Wi(t,e,i){if(yt.isAlias(e)){let r=e.resolve(t),n=i&&r&&i.get(r);return n?n.count*n.aliasCount:0}else if(yt.isCollection(e)){let r=0;for(let n of e.items){let a=Wi(t,n,i);a>r&&(r=a)}return r}else if(yt.isPair(e)){let r=Wi(t,e.key,i),n=Wi(t,e.value,i);return Math.max(r,n)}return 1}Vs.Alias=Jn});var j=w(Gn=>{"use strict";var Jf=P(),Gf=qi(),Uf=He(),Kf=t=>!t||typeof t!="function"&&typeof t!="object",De=class extends Gf.NodeBase{constructor(e){super(Jf.SCALAR),this.value=e}toJSON(e,i){return i?.keep?this.value:Uf.toJS(this.value,e,i)}toString(){return String(this.value)}};De.BLOCK_FOLDED="BLOCK_FOLDED";De.BLOCK_LITERAL="BLOCK_LITERAL";De.PLAIN="PLAIN";De.QUOTE_DOUBLE="QUOTE_DOUBLE";De.QUOTE_SINGLE="QUOTE_SINGLE";Gn.Scalar=De;Gn.isScalarValue=Kf});var Jt=w(Ws=>{"use strict";var Yf=zt(),Qe=P(),qs=j(),Xf="tag:yaml.org,2002:";function Qf(t,e,i){if(e){let r=i.filter(a=>a.tag===e),n=r.find(a=>!a.format)??r[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return i.find(r=>r.identify?.(t)&&!r.format)}function Zf(t,e,i){if(Qe.isDocument(t)&&(t=t.contents),Qe.isNode(t))return t;if(Qe.isPair(t)){let d=i.schema[Qe.MAP].createNode?.(i.schema,null,i);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:n,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(r&&t&&typeof t=="object"){if(c=s.get(t),c)return c.anchor??(c.anchor=n(t)),new Yf.Alias(c.anchor);c={anchor:null,node:null},s.set(t,c)}e?.startsWith("!!")&&(e=Xf+e.slice(2));let l=Qf(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new qs.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?o[Qe.MAP]:Symbol.iterator in Object(t)?o[Qe.SEQ]:o[Qe.MAP]}a&&(a(l),delete i.onTagObj);let u=l?.createNode?l.createNode(i.schema,t,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,t,i):new qs.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Ws.createNode=Zf});var Ji=w(zi=>{"use strict";var eh=Jt(),ge=P(),th=qi();function Un(t,e,i){let r=i;for(let n=e.length-1;n>=0;--n){let a=e[n];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=r,r=o}else r=new Map([[a,r]])}return eh.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var zs=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Kn=class extends th.NodeBase{constructor(e,i){super(e),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(e){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(i.schema=e),i.items=i.items.map(r=>ge.isNode(r)||ge.isPair(r)?r.clone(e):r),this.range&&(i.range=this.range.slice()),i}addIn(e,i){if(zs(e))this.add(i);else{let[r,...n]=e,a=this.get(r,!0);if(ge.isCollection(a))a.addIn(n,i);else if(a===void 0&&this.schema)this.set(r,Un(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(e){let[i,...r]=e;if(r.length===0)return this.delete(i);let n=this.get(i,!0);if(ge.isCollection(n))return n.deleteIn(r);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}getIn(e,i){let[r,...n]=e,a=this.get(r,!0);return n.length===0?!i&&ge.isScalar(a)?a.value:a:ge.isCollection(a)?a.getIn(n,i):void 0}hasAllNullValues(e){return this.items.every(i=>{if(!ge.isPair(i))return!1;let r=i.value;return r==null||e&&ge.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[i,...r]=e;if(r.length===0)return this.has(i);let n=this.get(i,!0);return ge.isCollection(n)?n.hasIn(r):!1}setIn(e,i){let[r,...n]=e;if(n.length===0)this.set(r,i);else{let a=this.get(r,!0);if(ge.isCollection(a))a.setIn(n,i);else if(a===void 0&&this.schema)this.set(r,Un(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}};zi.Collection=Kn;zi.collectionFromPath=Un;zi.isEmptyPath=zs});var Gt=w(Gi=>{"use strict";var ih=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Yn(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var rh=(t,e,i)=>t.endsWith(`
6
+ `)?Yn(i,e):i.includes(`
7
7
  `)?`
8
- `+Jn(i,e):(t.endsWith(" ")?"":" ")+i;ci.indentComment=Jn;ci.lineComment=Ju;ci.stringifyComment=zu});var Ro=w(vt=>{"use strict";var Gu="flow",Gn="block",li="quoted";function Ku(t,e,i="flow",{indentAtStart:n,lineWidth:r=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!r||r<0)return t;r<a&&(a=0);let c=Math.max(1+a,1+r-e.length);if(t.length<=c)return t;let l=[],d={},u=r-e.length;typeof n=="number"&&(n>r-Math.max(2,a)?l.push(0):u=r-n);let f,m,g=!1,h=-1,p=-1,y=-1;i===Gn&&(h=Co(t,h,e.length),h!==-1&&(u=h+c));for(let k;k=t[h+=1];){if(i===li&&k==="\\"){switch(p=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}y=h}if(k===`
9
- `)i===Gn&&(h=Co(t,h,e.length)),u=h+e.length+c,f=void 0;else{if(k===" "&&m&&m!==" "&&m!==`
10
- `&&m!==" "){let S=t[h+1];S&&S!==" "&&S!==`
11
- `&&S!==" "&&(f=h)}if(h>=u)if(f)l.push(f),u=f+c,f=void 0;else if(i===li){for(;m===" "||m===" ";)m=k,k=t[h+=1],g=!0;let S=h>y+1?h-2:p-1;if(d[S])return t;l.push(S),d[S]=!0,u=S+c,f=void 0}else g=!0}m=k}if(g&&s&&s(),l.length===0)return t;o&&o();let N=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let S=l[k],E=l[k+1]||t.length;S===0?N=`
12
- ${e}${t.slice(0,E)}`:(i===li&&d[S]&&(N+=`${t[S]}\\`),N+=`
13
- ${e}${t.slice(S+1,E)}`)}return N}function Co(t,e,i){let n=e,r=e+1,a=t[r];for(;a===" "||a===" ";)if(e<r+i)a=t[++e];else{do a=t[++e];while(a&&a!==`
14
- `);n=e,r=e+1,a=t[r]}return n}vt.FOLD_BLOCK=Gn;vt.FOLD_FLOW=Gu;vt.FOLD_QUOTED=li;vt.foldFlowLines=Ku});var wt=w(Po=>{"use strict";var W=T(),fe=Ro(),fi=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),di=t=>/^(%|---|\.\.\.)/m.test(t);function Uu(t,e,i){if(!e||e<0)return!1;let n=e-i,r=t.length;if(r<=n)return!1;for(let a=0,o=0;a<r;++a)if(t[a]===`
15
- `){if(a-o>n)return!0;if(o=a+1,r-o<=n)return!1}return!0}function gt(t,e){let i=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return i;let{implicitKey:n}=e,r=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(di(t)?" ":""),o="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(o+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{o+=i.slice(s,c);let d=i.substr(c+2,4);switch(d){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:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=i.substr(c,6)}c+=5,s=c+1}break;case"n":if(n||i[c+2]==='"'||i.length<r)c+=1;else{for(o+=i.slice(s,c)+`
8
+ `+Yn(i,e):(t.endsWith(" ")?"":" ")+i;Gi.indentComment=Yn;Gi.lineComment=rh;Gi.stringifyComment=ih});var Gs=w(Ut=>{"use strict";var nh="flow",Xn="block",Ui="quoted";function ah(t,e,i="flow",{indentAtStart:r,lineWidth:n=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!n||n<0)return t;n<a&&(a=0);let c=Math.max(1+a,1+n-e.length);if(t.length<=c)return t;let l=[],u={},d=n-e.length;typeof r=="number"&&(r>n-Math.max(2,a)?l.push(0):d=n-r);let f,p,g=!1,h=-1,m=-1,y=-1;i===Xn&&(h=Js(t,h,e.length),h!==-1&&(d=h+c));for(let k;k=t[h+=1];){if(i===Ui&&k==="\\"){switch(m=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}y=h}if(k===`
9
+ `)i===Xn&&(h=Js(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(k===" "&&p&&p!==" "&&p!==`
10
+ `&&p!==" "){let S=t[h+1];S&&S!==" "&&S!==`
11
+ `&&S!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(i===Ui){for(;p===" "||p===" ";)p=k,k=t[h+=1],g=!0;let S=h>y+1?h-2:m-1;if(u[S])return t;l.push(S),u[S]=!0,d=S+c,f=void 0}else g=!0}p=k}if(g&&s&&s(),l.length===0)return t;o&&o();let N=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let S=l[k],E=l[k+1]||t.length;S===0?N=`
12
+ ${e}${t.slice(0,E)}`:(i===Ui&&u[S]&&(N+=`${t[S]}\\`),N+=`
13
+ ${e}${t.slice(S+1,E)}`)}return N}function Js(t,e,i){let r=e,n=e+1,a=t[n];for(;a===" "||a===" ";)if(e<n+i)a=t[++e];else{do a=t[++e];while(a&&a!==`
14
+ `);r=e,n=e+1,a=t[n]}return r}Ut.FOLD_BLOCK=Xn;Ut.FOLD_FLOW=nh;Ut.FOLD_QUOTED=Ui;Ut.foldFlowLines=ah});var Yt=w(Us=>{"use strict";var ne=j(),Be=Gs(),Yi=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Xi=t=>/^(%|---|\.\.\.)/m.test(t);function oh(t,e,i){if(!e||e<0)return!1;let r=e-i,n=t.length;if(n<=r)return!1;for(let a=0,o=0;a<n;++a)if(t[a]===`
15
+ `){if(a-o>r)return!0;if(o=a+1,n-o<=r)return!1}return!0}function Kt(t,e){let i=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return i;let{implicitKey:r}=e,n=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(Xi(t)?" ":""),o="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(o+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{o+=i.slice(s,c);let u=i.substr(c+2,4);switch(u){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:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=i.substr(c,6)}c+=5,s=c+1}break;case"n":if(r||i[c+2]==='"'||i.length<n)c+=1;else{for(o+=i.slice(s,c)+`
16
16
 
17
17
  `;i[c+2]==="\\"&&i[c+3]==="n"&&i[c+4]!=='"';)o+=`
18
- `,c+=2;o+=a,i[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+i.slice(s):i,n?o:fe.foldFlowLines(o,a,fe.FOLD_QUOTED,fi(e,!1))}function Kn(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(t))return gt(t,e);let i=e.indent||(di(t)?" ":""),n="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${i}`)+"'";return e.implicitKey?n:fe.foldFlowLines(n,i,fe.FOLD_FLOW,fi(e,!1))}function Je(t,e){let{singleQuote:i}=e.options,n;if(i===!1)n=gt;else{let r=t.includes('"'),a=t.includes("'");r&&!a?n=Kn:a&&!r?n=gt:n=i?Kn:gt}return n(t,e)}var Un;try{Un=new RegExp(`(^|(?<!
18
+ `,c+=2;o+=a,i[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+i.slice(s):i,r?o:Be.foldFlowLines(o,a,Be.FOLD_QUOTED,Yi(e,!1))}function Qn(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(t))return Kt(t,e);let i=e.indent||(Xi(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${i}`)+"'";return e.implicitKey?r:Be.foldFlowLines(r,i,Be.FOLD_FLOW,Yi(e,!1))}function Nt(t,e){let{singleQuote:i}=e.options,r;if(i===!1)r=Kt;else{let n=t.includes('"'),a=t.includes("'");n&&!a?r=Qn:a&&!n?r=Kt:r=i?Qn:Kt}return r(t,e)}var Zn;try{Zn=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{Un=/\n+(?!\n|$)/g}function ui({comment:t,type:e,value:i},n,r,a){let{blockQuote:o,commentString:s,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(i))return Je(i,n);let l=n.indent||(n.forceBlockIndent||di(i)?" ":""),d=o==="literal"?!0:o==="folded"||e===W.Scalar.BLOCK_FOLDED?!1:e===W.Scalar.BLOCK_LITERAL?!0:!Uu(i,c,l.length);if(!i)return d?`|
23
+ |$)`,"g")}catch{Zn=/\n+(?!\n|$)/g}function Ki({comment:t,type:e,value:i},r,n,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(i))return Nt(i,r);let l=r.indent||(r.forceBlockIndent||Xi(i)?" ":""),u=o==="literal"?!0:o==="folded"||e===ne.Scalar.BLOCK_FOLDED?!1:e===ne.Scalar.BLOCK_LITERAL?!0:!oh(i,c,l.length);if(!i)return u?`|
24
24
  `:`>
25
- `;let u,f;for(f=i.length;f>0;--f){let E=i[f-1];if(E!==`
26
- `&&E!==" "&&E!==" ")break}let m=i.substring(f),g=m.indexOf(`
27
- `);g===-1?u="-":i===m||g!==m.length-1?(u="+",a&&a()):u="",m&&(i=i.slice(0,-m.length),m[m.length-1]===`
28
- `&&(m=m.slice(0,-1)),m=m.replace(Un,`$&${l}`));let h=!1,p,y=-1;for(p=0;p<i.length;++p){let E=i[p];if(E===" ")h=!0;else if(E===`
29
- `)y=p;else break}let N=i.substring(0,y<p?y+1:p);N&&(i=i.substring(N.length),N=N.replace(/\n+/g,`$&${l}`));let S=(h?l?"2":"1":"")+u;if(t&&(S+=" "+s(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!d){let E=i.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),v=!1,R=fi(n,!0);o!=="folded"&&e!==W.Scalar.BLOCK_FOLDED&&(R.onOverflow=()=>{v=!0});let b=fe.foldFlowLines(`${N}${E}${m}`,l,fe.FOLD_BLOCK,R);if(!v)return`>${S}
25
+ `;let d,f;for(f=i.length;f>0;--f){let E=i[f-1];if(E!==`
26
+ `&&E!==" "&&E!==" ")break}let p=i.substring(f),g=p.indexOf(`
27
+ `);g===-1?d="-":i===p||g!==p.length-1?(d="+",a&&a()):d="",p&&(i=i.slice(0,-p.length),p[p.length-1]===`
28
+ `&&(p=p.slice(0,-1)),p=p.replace(Zn,`$&${l}`));let h=!1,m,y=-1;for(m=0;m<i.length;++m){let E=i[m];if(E===" ")h=!0;else if(E===`
29
+ `)y=m;else break}let N=i.substring(0,y<m?y+1:m);N&&(i=i.substring(N.length),N=N.replace(/\n+/g,`$&${l}`));let S=(h?l?"2":"1":"")+d;if(t&&(S+=" "+s(t.replace(/ ?[\r\n]+/g," ")),n&&n()),!u){let E=i.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),v=!1,x=Yi(r,!0);o!=="folded"&&e!==ne.Scalar.BLOCK_FOLDED&&(x.onOverflow=()=>{v=!0});let b=Be.foldFlowLines(`${N}${E}${p}`,l,Be.FOLD_BLOCK,x);if(!v)return`>${S}
31
31
  ${l}${b}`}return i=i.replace(/\n+/g,`$&${l}`),`|${S}
32
- ${l}${N}${i}${m}`}function Yu(t,e,i,n){let{type:r,value:a}=t,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:d}=e;if(s&&a.includes(`
33
- `)||d&&/[[\]{},]/.test(a))return Je(a,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||d||!a.includes(`
34
- `)?Je(a,e):ui(t,e,i,n);if(!s&&!d&&r!==W.Scalar.PLAIN&&a.includes(`
35
- `))return ui(t,e,i,n);if(di(a)){if(c==="")return e.forceBlockIndent=!0,ui(t,e,i,n);if(s&&c===l)return Je(a,e)}let u=a.replace(/\n+/g,`$&
36
- ${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:m,tags:g}=e.doc.schema;if(g.some(f)||m?.some(f))return Je(a,e)}return s?u:fe.foldFlowLines(u,c,fe.FOLD_FLOW,fi(e,!1))}function Xu(t,e,i,n){let{implicitKey:r,inFlow:a}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:s}=t;s!==W.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=W.Scalar.QUOTE_DOUBLE);let c=d=>{switch(d){case W.Scalar.BLOCK_FOLDED:case W.Scalar.BLOCK_LITERAL:return r||a?Je(o.value,e):ui(o,e,i,n);case W.Scalar.QUOTE_DOUBLE:return gt(o.value,e);case W.Scalar.QUOTE_SINGLE:return Kn(o.value,e);case W.Scalar.PLAIN:return Yu(o,e,i,n);default:return null}},l=c(s);if(l===null){let{defaultKeyType:d,defaultStringType:u}=e.options,f=r&&d||u;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}Po.stringifyString=Xu});var yt=w(Yn=>{"use strict";var Qu=ni(),de=C(),Zu=mt(),ef=wt();function tf(t,e){let i=Object.assign({blockQuote:!0,commentString:Zu.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),n;switch(i.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:n,options:i}}function nf(t,e){if(e.tag){let r=t.filter(a=>a.tag===e.tag);if(r.length>0)return r.find(a=>a.format===e.format)??r[0]}let i,n;if(de.isScalar(e)){n=e.value;let r=t.filter(a=>a.identify?.(n));if(r.length>1){let a=r.filter(o=>o.test);a.length>0&&(r=a)}i=r.find(a=>a.format===e.format)??r.find(a=>!a.format)}else n=e,i=t.find(r=>r.nodeClass&&n instanceof r.nodeClass);if(!i){let r=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${r} value`)}return i}function rf(t,e,{anchors:i,doc:n}){if(!n.directives)return"";let r=[],a=(de.isScalar(t)||de.isCollection(t))&&t.anchor;a&&Qu.anchorIsValid(a)&&(i.add(a),r.push(`&${a}`));let o=t.tag??(e.default?null:e.tag);return o&&r.push(n.directives.tagString(o)),r.join(" ")}function af(t,e,i,n){if(de.isPair(t))return t.toString(e,i,n);if(de.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,a=de.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=nf(e.doc.schema.tags,a));let o=rf(a,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let s=typeof r.stringify=="function"?r.stringify(a,e,i,n):de.isScalar(a)?ef.stringifyString(a,e,i,n):a.toString(e,i,n);return o?de.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
- ${e.indent}${s}`:s}Yn.createStringifyContext=tf;Yn.stringify=af});var Io=w(To=>{"use strict";var oe=C(),Ao=T(),xo=yt(),Nt=mt();function of({key:t,value:e},i,n,r){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:d,simpleKeys:u}}=i,f=oe.isNode(t)&&t.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(oe.isCollection(t)||!oe.isNode(t)&&typeof t=="object"){let R="With simple keys, collection cannot be used as a key value";throw new Error(R)}}let m=!u&&(!t||f&&e==null&&!i.inFlow||oe.isCollection(t)||(oe.isScalar(t)?t.type===Ao.Scalar.BLOCK_FOLDED||t.type===Ao.Scalar.BLOCK_LITERAL:typeof t=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!m&&(u||!a),indent:s+c});let g=!1,h=!1,p=xo.stringify(t,i,()=>g=!0,()=>h=!0);if(!m&&!i.inFlow&&p.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(i.inFlow){if(a||e==null)return g&&n&&n(),p===""?"?":m?`? ${p}`:p}else if(a&&!u||e==null&&m)return p=`? ${p}`,f&&!g?p+=Nt.lineComment(p,i.indent,l(f)):h&&r&&r(),p;g&&(f=null),m?(f&&(p+=Nt.lineComment(p,i.indent,l(f))),p=`? ${p}
38
- ${s}:`):(p=`${p}:`,f&&(p+=Nt.lineComment(p,i.indent,l(f))));let y,N,k;oe.isNode(e)?(y=!!e.spaceBefore,N=e.commentBefore,k=e.comment):(y=!1,N=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),i.implicitKey=!1,!m&&!f&&oe.isScalar(e)&&(i.indentAtStart=p.length+1),h=!1,!d&&c.length>=2&&!i.inFlow&&!m&&oe.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(i.indent=i.indent.substring(2));let S=!1,E=xo.stringify(e,i,()=>S=!0,()=>h=!0),v=" ";if(f||y||N){if(v=y?`
39
- `:"",N){let R=l(N);v+=`
40
- ${Nt.indentComment(R,i.indent)}`}E===""&&!i.inFlow?v===`
32
+ ${l}${N}${i}${p}`}function sh(t,e,i,r){let{type:n,value:a}=t,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=e;if(s&&a.includes(`
33
+ `)||u&&/[[\]{},]/.test(a))return Nt(a,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
34
+ `)?Nt(a,e):Ki(t,e,i,r);if(!s&&!u&&n!==ne.Scalar.PLAIN&&a.includes(`
35
+ `))return Ki(t,e,i,r);if(Xi(a)){if(c==="")return e.forceBlockIndent=!0,Ki(t,e,i,r);if(s&&c===l)return Nt(a,e)}let d=a.replace(/\n+/g,`$&
36
+ ${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:g}=e.doc.schema;if(g.some(f)||p?.some(f))return Nt(a,e)}return s?d:Be.foldFlowLines(d,c,Be.FOLD_FLOW,Yi(e,!1))}function ch(t,e,i,r){let{implicitKey:n,inFlow:a}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:s}=t;s!==ne.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=ne.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ne.Scalar.BLOCK_FOLDED:case ne.Scalar.BLOCK_LITERAL:return n||a?Nt(o.value,e):Ki(o,e,i,r);case ne.Scalar.QUOTE_DOUBLE:return Kt(o.value,e);case ne.Scalar.QUOTE_SINGLE:return Qn(o.value,e);case ne.Scalar.PLAIN:return sh(o,e,i,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=n&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}Us.stringifyString=ch});var Xt=w(ea=>{"use strict";var lh=Vi(),Le=P(),uh=Gt(),dh=Yt();function fh(t,e){let i=Object.assign({blockQuote:!0,commentString:uh.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(i.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:r,options:i}}function hh(t,e){if(e.tag){let n=t.filter(a=>a.tag===e.tag);if(n.length>0)return n.find(a=>a.format===e.format)??n[0]}let i,r;if(Le.isScalar(e)){r=e.value;let n=t.filter(a=>a.identify?.(r));if(n.length>1){let a=n.filter(o=>o.test);a.length>0&&(n=a)}i=n.find(a=>a.format===e.format)??n.find(a=>!a.format)}else r=e,i=t.find(n=>n.nodeClass&&r instanceof n.nodeClass);if(!i){let n=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${n} value`)}return i}function ph(t,e,{anchors:i,doc:r}){if(!r.directives)return"";let n=[],a=(Le.isScalar(t)||Le.isCollection(t))&&t.anchor;a&&lh.anchorIsValid(a)&&(i.add(a),n.push(`&${a}`));let o=t.tag??(e.default?null:e.tag);return o&&n.push(r.directives.tagString(o)),n.join(" ")}function mh(t,e,i,r){if(Le.isPair(t))return t.toString(e,i,r);if(Le.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 n,a=Le.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>n=c});n??(n=hh(e.doc.schema.tags,a));let o=ph(a,n,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let s=typeof n.stringify=="function"?n.stringify(a,e,i,r):Le.isScalar(a)?dh.stringifyString(a,e,i,r):a.toString(e,i,r);return o?Le.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
+ ${e.indent}${s}`:s}ea.createStringifyContext=fh;ea.stringify=mh});var Qs=w(Xs=>{"use strict";var Re=P(),Ks=j(),Ys=Xt(),Qt=Gt();function vh({key:t,value:e},i,r,n){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=i,f=Re.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Re.isCollection(t)||!Re.isNode(t)&&typeof t=="object"){let x="With simple keys, collection cannot be used as a key value";throw new Error(x)}}let p=!d&&(!t||f&&e==null&&!i.inFlow||Re.isCollection(t)||(Re.isScalar(t)?t.type===Ks.Scalar.BLOCK_FOLDED||t.type===Ks.Scalar.BLOCK_LITERAL:typeof t=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let g=!1,h=!1,m=Ys.stringify(t,i,()=>g=!0,()=>h=!0);if(!p&&!i.inFlow&&m.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(i.inFlow){if(a||e==null)return g&&r&&r(),m===""?"?":p?`? ${m}`:m}else if(a&&!d||e==null&&p)return m=`? ${m}`,f&&!g?m+=Qt.lineComment(m,i.indent,l(f)):h&&n&&n(),m;g&&(f=null),p?(f&&(m+=Qt.lineComment(m,i.indent,l(f))),m=`? ${m}
38
+ ${s}:`):(m=`${m}:`,f&&(m+=Qt.lineComment(m,i.indent,l(f))));let y,N,k;Re.isNode(e)?(y=!!e.spaceBefore,N=e.commentBefore,k=e.comment):(y=!1,N=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),i.implicitKey=!1,!p&&!f&&Re.isScalar(e)&&(i.indentAtStart=m.length+1),h=!1,!u&&c.length>=2&&!i.inFlow&&!p&&Re.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(i.indent=i.indent.substring(2));let S=!1,E=Ys.stringify(e,i,()=>S=!0,()=>h=!0),v=" ";if(f||y||N){if(v=y?`
39
+ `:"",N){let x=l(N);v+=`
40
+ ${Qt.indentComment(x,i.indent)}`}E===""&&!i.inFlow?v===`
41
41
  `&&k&&(v=`
42
42
 
43
43
  `):v+=`
44
- ${i.indent}`}else if(!m&&oe.isCollection(e)){let R=E[0],b=E.indexOf(`
45
- `),x=b!==-1,F=i.inFlow??e.flow??e.items.length===0;if(x||!F){let qe=!1;if(x&&(R==="&"||R==="!")){let _=E.indexOf(" ");R==="&"&&_!==-1&&_<b&&E[_+1]==="!"&&(_=E.indexOf(" ",_+1)),(_===-1||b<_)&&(qe=!0)}qe||(v=`
44
+ ${i.indent}`}else if(!p&&Re.isCollection(e)){let x=E[0],b=E.indexOf(`
45
+ `),A=b!==-1,G=i.inFlow??e.flow??e.items.length===0;if(A||!G){let vt=!1;if(A&&(x==="&"||x==="!")){let $=E.indexOf(" ");x==="&"&&$!==-1&&$<b&&E[$+1]==="!"&&($=E.indexOf(" ",$+1)),($===-1||b<$)&&(vt=!0)}vt||(v=`
46
46
  ${i.indent}`)}}else(E===""||E[0]===`
47
- `)&&(v="");return p+=v+E,i.inFlow?S&&n&&n():k&&!S?p+=Nt.lineComment(p,i.indent,l(k)):h&&r&&r(),p}To.stringifyPair=of});var Qn=w(Xn=>{"use strict";var _o=Qt("process");function sf(t,...e){t==="debug"&&console.log(...e)}function cf(t,e){(t==="debug"||t==="warn")&&(typeof _o.emitWarning=="function"?_o.emitWarning(e):console.warn(e))}Xn.debug=sf;Xn.warn=cf});var gi=w(vi=>{"use strict";var mi=C(),Oo=T(),hi="<<",pi={identify:t=>t===hi||typeof t=="symbol"&&t.description===hi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Oo.Scalar(Symbol(hi)),{addToJSMap:jo}),stringify:()=>hi},lf=(t,e)=>(pi.identify(e)||mi.isScalar(e)&&(!e.type||e.type===Oo.Scalar.PLAIN)&&pi.identify(e.value))&&t?.doc.schema.tags.some(i=>i.tag===pi.tag&&i.default);function jo(t,e,i){let n=Ho(t,i);if(mi.isSeq(n))for(let r of n.items)Zn(t,e,r);else if(Array.isArray(n))for(let r of n)Zn(t,e,r);else Zn(t,e,n)}function Zn(t,e,i){let n=Ho(t,i);if(!mi.isMap(n))throw new Error("Merge sources must be maps or map aliases");let r=n.toJSON(null,t,Map);for(let[a,o]of r)e instanceof Map?e.has(a)||e.set(a,o):e instanceof Set?e.add(a):Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Ho(t,e){return t&&mi.isAlias(e)?e.resolve(t.doc,t):e}vi.addMergeToJSMap=jo;vi.isMergeKey=lf;vi.merge=pi});var tr=w(Fo=>{"use strict";var uf=Qn(),$o=gi(),ff=yt(),Lo=C(),er=le();function df(t,e,{key:i,value:n}){if(Lo.isNode(i)&&i.addToJSMap)i.addToJSMap(t,e,n);else if($o.isMergeKey(t,i))$o.addMergeToJSMap(t,e,n);else{let r=er.toJS(i,"",t);if(e instanceof Map)e.set(r,er.toJS(n,r,t));else if(e instanceof Set)e.add(r);else{let a=hf(i,r,t),o=er.toJS(n,a,t);a in e?Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[a]=o}}return e}function hf(t,e,i){if(e===null)return"";if(typeof e!="object")return String(e);if(Lo.isNode(t)&&i?.doc){let n=ff.createStringifyContext(i.doc,{});n.anchors=new Set;for(let a of i.anchors.keys())n.anchors.add(a.anchor);n.inFlow=!0,n.inStringifyKey=!0;let r=t.toString(n);if(!i.mapKeyWarned){let a=JSON.stringify(r);a.length>40&&(a=a.substring(0,36)+'..."'),uf.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return r}return JSON.stringify(e)}Fo.addPairToJSMap=df});var he=w(ir=>{"use strict";var Mo=pt(),pf=Io(),mf=tr(),wi=C();function vf(t,e,i){let n=Mo.createNode(t,void 0,i),r=Mo.createNode(e,void 0,i);return new yi(n,r)}var yi=class t{constructor(e,i=null){Object.defineProperty(this,wi.NODE_TYPE,{value:wi.PAIR}),this.key=e,this.value=i}clone(e){let{key:i,value:n}=this;return wi.isNode(i)&&(i=i.clone(e)),wi.isNode(n)&&(n=n.clone(e)),new t(i,n)}toJSON(e,i){let n=i?.mapAsMap?new Map:{};return mf.addPairToJSMap(i,n,this)}toString(e,i,n){return e?.doc?pf.stringifyPair(this,e,i,n):JSON.stringify(this)}};ir.Pair=yi;ir.createPair=vf});var nr=w(Do=>{"use strict";var Re=C(),Bo=yt(),Ni=mt();function gf(t,e,i){return(e.inFlow??t.flow?yf:wf)(t,e,i)}function wf({comment:t,items:e},i,{blockItemPrefix:n,flowChars:r,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=i,d=Object.assign({},i,{indent:a,type:null}),u=!1,f=[];for(let g=0;g<e.length;++g){let h=e[g],p=null;if(Re.isNode(h))!u&&h.spaceBefore&&f.push(""),bi(i,f,h.commentBefore,u),h.comment&&(p=h.comment);else if(Re.isPair(h)){let N=Re.isNode(h.key)?h.key:null;N&&(!u&&N.spaceBefore&&f.push(""),bi(i,f,N.commentBefore,u))}u=!1;let y=Bo.stringify(h,d,()=>p=null,()=>u=!0);p&&(y+=Ni.lineComment(y,a,l(p))),u&&p&&(u=!1),f.push(n+y)}let m;if(f.length===0)m=r.start+r.end;else{m=f[0];for(let g=1;g<f.length;++g){let h=f[g];m+=h?`
47
+ `)&&(v="");return m+=v+E,i.inFlow?S&&r&&r():k&&!S?m+=Qt.lineComment(m,i.indent,l(k)):h&&n&&n(),m}Xs.stringifyPair=vh});var ia=w(ta=>{"use strict";var Zs=Hi("process");function gh(t,...e){t==="debug"&&console.log(...e)}function wh(t,e){(t==="debug"||t==="warn")&&(typeof Zs.emitWarning=="function"?Zs.emitWarning(e):console.warn(e))}ta.debug=gh;ta.warn=wh});var ir=w(tr=>{"use strict";var er=P(),ec=j(),Qi="<<",Zi={identify:t=>t===Qi||typeof t=="symbol"&&t.description===Qi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ec.Scalar(Symbol(Qi)),{addToJSMap:tc}),stringify:()=>Qi},yh=(t,e)=>(Zi.identify(e)||er.isScalar(e)&&(!e.type||e.type===ec.Scalar.PLAIN)&&Zi.identify(e.value))&&t?.doc.schema.tags.some(i=>i.tag===Zi.tag&&i.default);function tc(t,e,i){let r=ic(t,i);if(er.isSeq(r))for(let n of r.items)ra(t,e,n);else if(Array.isArray(r))for(let n of r)ra(t,e,n);else ra(t,e,r)}function ra(t,e,i){let r=ic(t,i);if(!er.isMap(r))throw new Error("Merge sources must be maps or map aliases");let n=r.toJSON(null,t,Map);for(let[a,o]of n)e instanceof Map?e.has(a)||e.set(a,o):e instanceof Set?e.add(a):Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function ic(t,e){return t&&er.isAlias(e)?e.resolve(t.doc,t):e}tr.addMergeToJSMap=tc;tr.isMergeKey=yh;tr.merge=Zi});var aa=w(ac=>{"use strict";var Nh=ia(),rc=ir(),bh=Xt(),nc=P(),na=He();function kh(t,e,{key:i,value:r}){if(nc.isNode(i)&&i.addToJSMap)i.addToJSMap(t,e,r);else if(rc.isMergeKey(t,i))rc.addMergeToJSMap(t,e,r);else{let n=na.toJS(i,"",t);if(e instanceof Map)e.set(n,na.toJS(r,n,t));else if(e instanceof Set)e.add(n);else{let a=Sh(i,n,t),o=na.toJS(r,a,t);a in e?Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[a]=o}}return e}function Sh(t,e,i){if(e===null)return"";if(typeof e!="object")return String(e);if(nc.isNode(t)&&i?.doc){let r=bh.createStringifyContext(i.doc,{});r.anchors=new Set;for(let a of i.anchors.keys())r.anchors.add(a.anchor);r.inFlow=!0,r.inStringifyKey=!0;let n=t.toString(r);if(!i.mapKeyWarned){let a=JSON.stringify(n);a.length>40&&(a=a.substring(0,36)+'..."'),Nh.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return n}return JSON.stringify(e)}ac.addPairToJSMap=kh});var Me=w(oa=>{"use strict";var oc=Jt(),Eh=Qs(),Ph=aa(),rr=P();function xh(t,e,i){let r=oc.createNode(t,void 0,i),n=oc.createNode(e,void 0,i);return new nr(r,n)}var nr=class t{constructor(e,i=null){Object.defineProperty(this,rr.NODE_TYPE,{value:rr.PAIR}),this.key=e,this.value=i}clone(e){let{key:i,value:r}=this;return rr.isNode(i)&&(i=i.clone(e)),rr.isNode(r)&&(r=r.clone(e)),new t(i,r)}toJSON(e,i){let r=i?.mapAsMap?new Map:{};return Ph.addPairToJSMap(i,r,this)}toString(e,i,r){return e?.doc?Eh.stringifyPair(this,e,i,r):JSON.stringify(this)}};oa.Pair=nr;oa.createPair=xh});var sa=w(cc=>{"use strict";var Ze=P(),sc=Xt(),ar=Gt();function Ch(t,e,i){return(e.inFlow??t.flow?Ah:Rh)(t,e,i)}function Rh({comment:t,items:e},i,{blockItemPrefix:r,flowChars:n,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=i,u=Object.assign({},i,{indent:a,type:null}),d=!1,f=[];for(let g=0;g<e.length;++g){let h=e[g],m=null;if(Ze.isNode(h))!d&&h.spaceBefore&&f.push(""),or(i,f,h.commentBefore,d),h.comment&&(m=h.comment);else if(Ze.isPair(h)){let N=Ze.isNode(h.key)?h.key:null;N&&(!d&&N.spaceBefore&&f.push(""),or(i,f,N.commentBefore,d))}d=!1;let y=sc.stringify(h,u,()=>m=null,()=>d=!0);m&&(y+=ar.lineComment(y,a,l(m))),d&&m&&(d=!1),f.push(r+y)}let p;if(f.length===0)p=n.start+n.end;else{p=f[0];for(let g=1;g<f.length;++g){let h=f[g];p+=h?`
48
48
  ${c}${h}`:`
49
- `}}return t?(m+=`
50
- `+Ni.indentComment(l(t),c),s&&s()):u&&o&&o(),m}function yf({items:t},e,{flowChars:i,itemIndent:n}){let{indent:r,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=e;n+=a;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,d=0,u=[];for(let g=0;g<t.length;++g){let h=t[g],p=null;if(Re.isNode(h))h.spaceBefore&&u.push(""),bi(e,u,h.commentBefore,!1),h.comment&&(p=h.comment);else if(Re.isPair(h)){let N=Re.isNode(h.key)?h.key:null;N&&(N.spaceBefore&&u.push(""),bi(e,u,N.commentBefore,!1),N.comment&&(l=!0));let k=Re.isNode(h.value)?h.value:null;k?(k.comment&&(p=k.comment),k.commentBefore&&(l=!0)):h.value==null&&N?.comment&&(p=N.comment)}p&&(l=!0);let y=Bo.stringify(h,c,()=>p=null);l||(l=u.length>d||y.includes(`
51
- `)),g<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((N,k)=>N+k.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),p&&(y+=Ni.lineComment(y,n,s(p))),u.push(y),d=u.length}let{start:f,end:m}=i;if(u.length===0)return f+m;if(!l){let g=u.reduce((h,p)=>h+p.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=f;for(let h of u)g+=h?`
52
- ${a}${r}${h}`:`
49
+ `}}return t?(p+=`
50
+ `+ar.indentComment(l(t),c),s&&s()):d&&o&&o(),p}function Ah({items:t},e,{flowChars:i,itemIndent:r}){let{indent:n,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=e;r+=a;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let g=0;g<t.length;++g){let h=t[g],m=null;if(Ze.isNode(h))h.spaceBefore&&d.push(""),or(e,d,h.commentBefore,!1),h.comment&&(m=h.comment);else if(Ze.isPair(h)){let N=Ze.isNode(h.key)?h.key:null;N&&(N.spaceBefore&&d.push(""),or(e,d,N.commentBefore,!1),N.comment&&(l=!0));let k=Ze.isNode(h.value)?h.value:null;k?(k.comment&&(m=k.comment),k.commentBefore&&(l=!0)):h.value==null&&N?.comment&&(m=N.comment)}m&&(l=!0);let y=sc.stringify(h,c,()=>m=null);l||(l=d.length>u||y.includes(`
51
+ `)),g<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=d.reduce((N,k)=>N+k.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),m&&(y+=ar.lineComment(y,r,s(m))),d.push(y),u=d.length}let{start:f,end:p}=i;if(d.length===0)return f+p;if(!l){let g=d.reduce((h,m)=>h+m.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=f;for(let h of d)g+=h?`
52
+ ${a}${n}${h}`:`
53
53
  `;return`${g}
54
- ${r}${m}`}else return`${f}${o}${u.join(" ")}${o}${m}`}function bi({indent:t,options:{commentString:e}},i,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){let a=Ni.indentComment(e(n),t);i.push(a.trimStart())}}Do.stringifyCollection=gf});var me=w(ar=>{"use strict";var Nf=nr(),bf=tr(),kf=si(),pe=C(),ki=he(),Sf=T();function bt(t,e){let i=pe.isScalar(e)?e.value:e;for(let n of t)if(pe.isPair(n)&&(n.key===e||n.key===i||pe.isScalar(n.key)&&n.key.value===i))return n}var rr=class extends kf.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(pe.MAP,e),this.items=[]}static from(e,i,n){let{keepUndefined:r,replacer:a}=n,o=new this(e),s=(c,l)=>{if(typeof a=="function")l=a.call(i,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||r)&&o.items.push(ki.createPair(c,l,n))};if(i instanceof Map)for(let[c,l]of i)s(c,l);else if(i&&typeof i=="object")for(let c of Object.keys(i))s(c,i[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,i){let n;pe.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new ki.Pair(e,e?.value):n=new ki.Pair(e.key,e.value);let r=bt(this.items,n.key),a=this.schema?.sortMapEntries;if(r){if(!i)throw new Error(`Key ${n.key} already set`);pe.isScalar(r.value)&&Sf.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(a){let o=this.items.findIndex(s=>a(n,s)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let i=bt(this.items,e);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(e,i){let r=bt(this.items,e)?.value;return(!i&&pe.isScalar(r)?r.value:r)??void 0}has(e){return!!bt(this.items,e)}set(e,i){this.add(new ki.Pair(e,i),!0)}toJSON(e,i,n){let r=n?new n:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(r);for(let a of this.items)bf.addPairToJSMap(i,r,a);return r}toString(e,i,n){if(!e)return JSON.stringify(this);for(let r of this.items)if(!pe.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Nf.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:i})}};ar.YAMLMap=rr;ar.findPair=bt});var Ge=w(Vo=>{"use strict";var Ef=C(),qo=me(),Cf={collection:"map",default:!0,nodeClass:qo.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Ef.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,i)=>qo.YAMLMap.from(t,e,i)};Vo.map=Cf});var ve=w(Wo=>{"use strict";var Rf=pt(),Pf=nr(),Af=si(),Ei=C(),xf=T(),Tf=le(),or=class extends Af.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Ei.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let i=Si(e);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(e,i){let n=Si(e);if(typeof n!="number")return;let r=this.items[n];return!i&&Ei.isScalar(r)?r.value:r}has(e){let i=Si(e);return typeof i=="number"&&i<this.items.length}set(e,i){let n=Si(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Ei.isScalar(r)&&xf.isScalarValue(i)?r.value=i:this.items[n]=i}toJSON(e,i){let n=[];i?.onCreate&&i.onCreate(n);let r=0;for(let a of this.items)n.push(Tf.toJS(a,String(r++),i));return n}toString(e,i,n){return e?Pf.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:i}):JSON.stringify(this)}static from(e,i,n){let{replacer:r}=n,a=new this(e);if(i&&Symbol.iterator in Object(i)){let o=0;for(let s of i){if(typeof r=="function"){let c=i instanceof Set?s:String(o++);s=r.call(i,c,s)}a.items.push(Rf.createNode(s,void 0,n))}}return a}};function Si(t){let e=Ei.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Wo.YAMLSeq=or});var Ke=w(Jo=>{"use strict";var If=C(),zo=ve(),_f={collection:"seq",default:!0,nodeClass:zo.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return If.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,i)=>zo.YAMLSeq.from(t,e,i)};Jo.seq=_f});var kt=w(Go=>{"use strict";var Of=wt(),jf={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,i,n){return e=Object.assign({actualString:!0},e),Of.stringifyString(t,e,i,n)}};Go.string=jf});var Ci=w(Yo=>{"use strict";var Ko=T(),Uo={identify:t=>t==null,createNode:()=>new Ko.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ko.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Uo.test.test(t)?t:e.options.nullStr};Yo.nullTag=Uo});var sr=w(Qo=>{"use strict";var Hf=T(),Xo={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Hf.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},i){if(t&&Xo.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?i.options.trueStr:i.options.falseStr}};Qo.boolTag=Xo});var Ue=w(Zo=>{"use strict";function $f({format:t,minFractionDigits:e,tag:i,value:n}){if(typeof n=="bigint")return String(n);let r=typeof n=="number"?n:Number(n);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let a=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=e-(a.length-o-1);for(;s-- >0;)a+="0"}return a}Zo.stringifyNumber=$f});var lr=w(Ri=>{"use strict";var Lf=T(),cr=Ue(),Ff={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:cr.stringifyNumber},Mf={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():cr.stringifyNumber(t)}},Bf={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 Lf.Scalar(parseFloat(t)),i=t.indexOf(".");return i!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-i-1),e},stringify:cr.stringifyNumber};Ri.float=Bf;Ri.floatExp=Mf;Ri.floatNaN=Ff});var fr=w(Ai=>{"use strict";var es=Ue(),Pi=t=>typeof t=="bigint"||Number.isInteger(t),ur=(t,e,i,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),i);function ts(t,e,i){let{value:n}=t;return Pi(n)&&n>=0?i+n.toString(e):es.stringifyNumber(t)}var Df={identify:t=>Pi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,i)=>ur(t,2,8,i),stringify:t=>ts(t,8,"0o")},qf={identify:Pi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,i)=>ur(t,0,10,i),stringify:es.stringifyNumber},Vf={identify:t=>Pi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,i)=>ur(t,2,16,i),stringify:t=>ts(t,16,"0x")};Ai.int=qf;Ai.intHex=Vf;Ai.intOct=Df});var ns=w(is=>{"use strict";var Wf=Ge(),zf=Ci(),Jf=Ke(),Gf=kt(),Kf=sr(),dr=lr(),hr=fr(),Uf=[Wf.map,Jf.seq,Gf.string,zf.nullTag,Kf.boolTag,hr.intOct,hr.int,hr.intHex,dr.floatNaN,dr.floatExp,dr.float];is.schema=Uf});var os=w(as=>{"use strict";var Yf=T(),Xf=Ge(),Qf=Ke();function rs(t){return typeof t=="bigint"||Number.isInteger(t)}var xi=({value:t})=>JSON.stringify(t),Zf=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:xi},{identify:t=>t==null,createNode:()=>new Yf.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:xi},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:xi},{identify:rs,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:i})=>i?BigInt(t):parseInt(t,10),stringify:({value:t})=>rs(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:xi}],ed={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},td=[Xf.map,Qf.seq].concat(Zf,ed);as.schema=td});var mr=w(ss=>{"use strict";var St=Qt("buffer"),pr=T(),id=wt(),nd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof St.Buffer=="function")return St.Buffer.from(t,"base64");if(typeof atob=="function"){let i=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(i.length);for(let r=0;r<i.length;++r)n[r]=i.charCodeAt(r);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:i},n,r,a){if(!i)return"";let o=i,s;if(typeof St.Buffer=="function")s=o instanceof St.Buffer?o.toString("base64"):St.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]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=pr.Scalar.BLOCK_LITERAL),e!==pr.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(s.length/c),d=new Array(l);for(let u=0,f=0;u<l;++u,f+=c)d[u]=s.substr(f,c);s=d.join(e===pr.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return id.stringifyString({comment:t,type:e,value:s},n,r,a)}};ss.binary=nd});var _i=w(Ii=>{"use strict";var Ti=C(),vr=he(),rd=T(),ad=ve();function cs(t,e){if(Ti.isSeq(t))for(let i=0;i<t.items.length;++i){let n=t.items[i];if(!Ti.isPair(n)){if(Ti.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let r=n.items[0]||new vr.Pair(new rd.Scalar(null));if(n.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${n.commentBefore}
56
- ${r.key.commentBefore}`:n.commentBefore),n.comment){let a=r.value??r.key;a.comment=a.comment?`${n.comment}
57
- ${a.comment}`:n.comment}n=r}t.items[i]=Ti.isPair(n)?n:new vr.Pair(n)}}else e("Expected a sequence for this tag");return t}function ls(t,e,i){let{replacer:n}=i,r=new ad.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=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)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;r.items.push(vr.createPair(s,c,i))}return r}var od={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:cs,createNode:ls};Ii.createPairs=ls;Ii.pairs=od;Ii.resolvePairs=cs});var yr=w(wr=>{"use strict";var us=C(),gr=le(),Et=me(),sd=ve(),fs=_i(),Pe=class t extends sd.YAMLSeq{constructor(){super(),this.add=Et.YAMLMap.prototype.add.bind(this),this.delete=Et.YAMLMap.prototype.delete.bind(this),this.get=Et.YAMLMap.prototype.get.bind(this),this.has=Et.YAMLMap.prototype.has.bind(this),this.set=Et.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,i){if(!i)return super.toJSON(e);let n=new Map;i?.onCreate&&i.onCreate(n);for(let r of this.items){let a,o;if(us.isPair(r)?(a=gr.toJS(r.key,"",i),o=gr.toJS(r.value,a,i)):a=gr.toJS(r,"",i),n.has(a))throw new Error("Ordered maps must not include duplicate keys");n.set(a,o)}return n}static from(e,i,n){let r=fs.createPairs(e,i,n),a=new this;return a.items=r.items,a}};Pe.tag="tag:yaml.org,2002:omap";var cd={collection:"seq",identify:t=>t instanceof Map,nodeClass:Pe,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let i=fs.resolvePairs(t,e),n=[];for(let{key:r}of i.items)us.isScalar(r)&&(n.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new Pe,i)},createNode:(t,e,i)=>Pe.from(t,e,i)};wr.YAMLOMap=Pe;wr.omap=cd});var vs=w(Nr=>{"use strict";var ds=T();function hs({value:t,source:e},i){return e&&(t?ps:ms).test.test(e)?e:t?i.options.trueStr:i.options.falseStr}var ps={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 ds.Scalar(!0),stringify:hs},ms={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 ds.Scalar(!1),stringify:hs};Nr.falseTag=ms;Nr.trueTag=ps});var gs=w(Oi=>{"use strict";var ld=T(),br=Ue(),ud={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},fd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():br.stringifyNumber(t)}},dd={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 ld.Scalar(parseFloat(t.replace(/_/g,""))),i=t.indexOf(".");if(i!==-1){let n=t.substring(i+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:br.stringifyNumber};Oi.float=dd;Oi.floatExp=fd;Oi.floatNaN=ud});var ys=w(Rt=>{"use strict";var ws=Ue(),Ct=t=>typeof t=="bigint"||Number.isInteger(t);function ji(t,e,i,{intAsBigInt:n}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(i){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 a=parseInt(t,i);return r==="-"?-1*a:a}function kr(t,e,i){let{value:n}=t;if(Ct(n)){let r=n.toString(e);return n<0?"-"+i+r.substr(1):i+r}return ws.stringifyNumber(t)}var hd={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,i)=>ji(t,2,2,i),stringify:t=>kr(t,2,"0b")},pd={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,i)=>ji(t,1,8,i),stringify:t=>kr(t,8,"0")},md={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,i)=>ji(t,0,10,i),stringify:ws.stringifyNumber},vd={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,i)=>ji(t,2,16,i),stringify:t=>kr(t,16,"0x")};Rt.int=md;Rt.intBin=hd;Rt.intHex=vd;Rt.intOct=pd});var Er=w(Sr=>{"use strict";var Li=C(),Hi=he(),$i=me(),Ae=class t extends $i.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let i;Li.isPair(e)?i=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?i=new Hi.Pair(e.key,null):i=new Hi.Pair(e,null),$i.findPair(this.items,i.key)||this.items.push(i)}get(e,i){let n=$i.findPair(this.items,e);return!i&&Li.isPair(n)?Li.isScalar(n.key)?n.key.value:n.key:n}set(e,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let n=$i.findPair(this.items,e);n&&!i?this.items.splice(this.items.indexOf(n),1):!n&&i&&this.items.push(new Hi.Pair(e))}toJSON(e,i){return super.toJSON(e,i,Set)}toString(e,i,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),i,n);throw new Error("Set items must all have null values")}static from(e,i,n){let{replacer:r}=n,a=new this(e);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof r=="function"&&(o=r.call(i,o,o)),a.items.push(Hi.createPair(o,null,n));return a}};Ae.tag="tag:yaml.org,2002:set";var gd={collection:"map",identify:t=>t instanceof Set,nodeClass:Ae,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,i)=>Ae.from(t,e,i),resolve(t,e){if(Li.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ae,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Sr.YAMLSet=Ae;Sr.set=gd});var Rr=w(Fi=>{"use strict";var wd=Ue();function Cr(t,e){let i=t[0],n=i==="-"||i==="+"?t.substring(1):t,r=o=>e?BigInt(o):Number(o),a=n.replace(/_/g,"").split(":").reduce((o,s)=>o*r(60)+r(s),r(0));return i==="-"?r(-1)*a:a}function Ns(t){let{value:e}=t,i=o=>o;if(typeof e=="bigint")i=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return wd.stringifyNumber(t);let n="";e<0&&(n="-",e*=i(-1));let r=i(60),a=[e%r];return e<60?a.unshift(0):(e=(e-a[0])/r,a.unshift(e%r),e>=60&&(e=(e-a[0])/r,a.unshift(e))),n+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var yd={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:i})=>Cr(t,i),stringify:Ns},Nd={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=>Cr(t,!1),stringify:Ns},bs={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(bs.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,n,r,a,o,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(i,n-1,r,a||0,o||0,s||0,c),d=e[8];if(d&&d!=="Z"){let u=Cr(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Fi.floatTime=Nd;Fi.intTime=yd;Fi.timestamp=bs});var Es=w(Ss=>{"use strict";var bd=Ge(),kd=Ci(),Sd=Ke(),Ed=kt(),Cd=mr(),ks=vs(),Pr=gs(),Mi=ys(),Rd=gi(),Pd=yr(),Ad=_i(),xd=Er(),Ar=Rr(),Td=[bd.map,Sd.seq,Ed.string,kd.nullTag,ks.trueTag,ks.falseTag,Mi.intBin,Mi.intOct,Mi.int,Mi.intHex,Pr.floatNaN,Pr.floatExp,Pr.float,Cd.binary,Rd.merge,Pd.omap,Ad.pairs,xd.set,Ar.intTime,Ar.floatTime,Ar.timestamp];Ss.schema=Td});var js=w(Ir=>{"use strict";var As=Ge(),Id=Ci(),xs=Ke(),_d=kt(),Od=sr(),xr=lr(),Tr=fr(),jd=ns(),Hd=os(),Ts=mr(),Pt=gi(),Is=yr(),_s=_i(),Cs=Es(),Os=Er(),Bi=Rr(),Rs=new Map([["core",jd.schema],["failsafe",[As.map,xs.seq,_d.string]],["json",Hd.schema],["yaml11",Cs.schema],["yaml-1.1",Cs.schema]]),Ps={binary:Ts.binary,bool:Od.boolTag,float:xr.float,floatExp:xr.floatExp,floatNaN:xr.floatNaN,floatTime:Bi.floatTime,int:Tr.int,intHex:Tr.intHex,intOct:Tr.intOct,intTime:Bi.intTime,map:As.map,merge:Pt.merge,null:Id.nullTag,omap:Is.omap,pairs:_s.pairs,seq:xs.seq,set:Os.set,timestamp:Bi.timestamp},$d={"tag:yaml.org,2002:binary":Ts.binary,"tag:yaml.org,2002:merge":Pt.merge,"tag:yaml.org,2002:omap":Is.omap,"tag:yaml.org,2002:pairs":_s.pairs,"tag:yaml.org,2002:set":Os.set,"tag:yaml.org,2002:timestamp":Bi.timestamp};function Ld(t,e,i){let n=Rs.get(e);if(n&&!t)return i&&!n.includes(Pt.merge)?n.concat(Pt.merge):n.slice();let r=n;if(!r)if(Array.isArray(t))r=[];else{let a=Array.from(Rs.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(t))for(let a of t)r=r.concat(a);else typeof t=="function"&&(r=t(r.slice()));return i&&(r=r.concat(Pt.merge)),r.reduce((a,o)=>{let s=typeof o=="string"?Ps[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(Ps).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}Ir.coreKnownTags=$d;Ir.getTags=Ld});var jr=w(Hs=>{"use strict";var _r=C(),Fd=Ge(),Md=Ke(),Bd=kt(),Di=js(),Dd=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Or=class t{constructor({compat:e,customTags:i,merge:n,resolveKnownTags:r,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?Di.getTags(e,"compat"):e?Di.getTags(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=r?Di.coreKnownTags:{},this.tags=Di.getTags(i,this.name,n),this.toStringOptions=s??null,Object.defineProperty(this,_r.MAP,{value:Fd.map}),Object.defineProperty(this,_r.SCALAR,{value:Bd.string}),Object.defineProperty(this,_r.SEQ,{value:Md.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Dd:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Hs.Schema=Or});var Ls=w($s=>{"use strict";var qd=C(),Hr=yt(),At=mt();function Vd(t,e){let i=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(i.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&i.push("---");let r=Hr.createStringifyContext(t,e),{commentString:a}=r.options;if(t.commentBefore){i.length!==1&&i.unshift("");let c=a(t.commentBefore);i.unshift(At.indentComment(c,""))}let o=!1,s=null;if(t.contents){if(qd.isNode(t.contents)){if(t.contents.spaceBefore&&n&&i.push(""),t.contents.commentBefore){let d=a(t.contents.commentBefore);i.push(At.indentComment(d,""))}r.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>o=!0,l=Hr.stringify(t.contents,r,()=>s=null,c);s&&(l+=At.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(Hr.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=a(t.comment);c.includes(`
58
- `)?(i.push("..."),i.push(At.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(At.indentComment(a(c),"")))}return i.join(`
54
+ ${n}${p}`}else return`${f}${o}${d.join(" ")}${o}${p}`}function or({indent:t,options:{commentString:e}},i,r,n){if(r&&n&&(r=r.replace(/^\n+/,"")),r){let a=ar.indentComment(e(r),t);i.push(a.trimStart())}}cc.stringifyCollection=Ch});var Ve=w(la=>{"use strict";var _h=sa(),Th=aa(),Ih=Ji(),Fe=P(),sr=Me(),jh=j();function Zt(t,e){let i=Fe.isScalar(e)?e.value:e;for(let r of t)if(Fe.isPair(r)&&(r.key===e||r.key===i||Fe.isScalar(r.key)&&r.key.value===i))return r}var ca=class extends Ih.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Fe.MAP,e),this.items=[]}static from(e,i,r){let{keepUndefined:n,replacer:a}=r,o=new this(e),s=(c,l)=>{if(typeof a=="function")l=a.call(i,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||n)&&o.items.push(sr.createPair(c,l,r))};if(i instanceof Map)for(let[c,l]of i)s(c,l);else if(i&&typeof i=="object")for(let c of Object.keys(i))s(c,i[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,i){let r;Fe.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new sr.Pair(e,e?.value):r=new sr.Pair(e.key,e.value);let n=Zt(this.items,r.key),a=this.schema?.sortMapEntries;if(n){if(!i)throw new Error(`Key ${r.key} already set`);Fe.isScalar(n.value)&&jh.isScalarValue(r.value)?n.value.value=r.value:n.value=r.value}else if(a){let o=this.items.findIndex(s=>a(r,s)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(e){let i=Zt(this.items,e);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(e,i){let n=Zt(this.items,e)?.value;return(!i&&Fe.isScalar(n)?n.value:n)??void 0}has(e){return!!Zt(this.items,e)}set(e,i){this.add(new sr.Pair(e,i),!0)}toJSON(e,i,r){let n=r?new r:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(n);for(let a of this.items)Th.addPairToJSMap(i,n,a);return n}toString(e,i,r){if(!e)return JSON.stringify(this);for(let n of this.items)if(!Fe.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),_h.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:i})}};la.YAMLMap=ca;la.findPair=Zt});var bt=w(uc=>{"use strict";var $h=P(),lc=Ve(),Oh={collection:"map",default:!0,nodeClass:lc.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return $h.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,i)=>lc.YAMLMap.from(t,e,i)};uc.map=Oh});var qe=w(dc=>{"use strict";var Hh=Jt(),Dh=sa(),Bh=Ji(),lr=P(),Lh=j(),Mh=He(),ua=class extends Bh.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(lr.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let i=cr(e);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(e,i){let r=cr(e);if(typeof r!="number")return;let n=this.items[r];return!i&&lr.isScalar(n)?n.value:n}has(e){let i=cr(e);return typeof i=="number"&&i<this.items.length}set(e,i){let r=cr(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let n=this.items[r];lr.isScalar(n)&&Lh.isScalarValue(i)?n.value=i:this.items[r]=i}toJSON(e,i){let r=[];i?.onCreate&&i.onCreate(r);let n=0;for(let a of this.items)r.push(Mh.toJS(a,String(n++),i));return r}toString(e,i,r){return e?Dh.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:i}):JSON.stringify(this)}static from(e,i,r){let{replacer:n}=r,a=new this(e);if(i&&Symbol.iterator in Object(i)){let o=0;for(let s of i){if(typeof n=="function"){let c=i instanceof Set?s:String(o++);s=n.call(i,c,s)}a.items.push(Hh.createNode(s,void 0,r))}}return a}};function cr(t){let e=lr.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}dc.YAMLSeq=ua});var kt=w(hc=>{"use strict";var Fh=P(),fc=qe(),Vh={collection:"seq",default:!0,nodeClass:fc.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Fh.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,i)=>fc.YAMLSeq.from(t,e,i)};hc.seq=Vh});var ei=w(pc=>{"use strict";var qh=Yt(),Wh={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,i,r){return e=Object.assign({actualString:!0},e),qh.stringifyString(t,e,i,r)}};pc.string=Wh});var ur=w(gc=>{"use strict";var mc=j(),vc={identify:t=>t==null,createNode:()=>new mc.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new mc.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&vc.test.test(t)?t:e.options.nullStr};gc.nullTag=vc});var da=w(yc=>{"use strict";var zh=j(),wc={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new zh.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},i){if(t&&wc.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?i.options.trueStr:i.options.falseStr}};yc.boolTag=wc});var St=w(Nc=>{"use strict";function Jh({format:t,minFractionDigits:e,tag:i,value:r}){if(typeof r=="bigint")return String(r);let n=typeof r=="number"?r:Number(r);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let a=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=e-(a.length-o-1);for(;s-- >0;)a+="0"}return a}Nc.stringifyNumber=Jh});var ha=w(dr=>{"use strict";var Gh=j(),fa=St(),Uh={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:fa.stringifyNumber},Kh={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():fa.stringifyNumber(t)}},Yh={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 Gh.Scalar(parseFloat(t)),i=t.indexOf(".");return i!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-i-1),e},stringify:fa.stringifyNumber};dr.float=Yh;dr.floatExp=Kh;dr.floatNaN=Uh});var ma=w(hr=>{"use strict";var bc=St(),fr=t=>typeof t=="bigint"||Number.isInteger(t),pa=(t,e,i,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),i);function kc(t,e,i){let{value:r}=t;return fr(r)&&r>=0?i+r.toString(e):bc.stringifyNumber(t)}var Xh={identify:t=>fr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,i)=>pa(t,2,8,i),stringify:t=>kc(t,8,"0o")},Qh={identify:fr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,i)=>pa(t,0,10,i),stringify:bc.stringifyNumber},Zh={identify:t=>fr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,i)=>pa(t,2,16,i),stringify:t=>kc(t,16,"0x")};hr.int=Qh;hr.intHex=Zh;hr.intOct=Xh});var Ec=w(Sc=>{"use strict";var ep=bt(),tp=ur(),ip=kt(),rp=ei(),np=da(),va=ha(),ga=ma(),ap=[ep.map,ip.seq,rp.string,tp.nullTag,np.boolTag,ga.intOct,ga.int,ga.intHex,va.floatNaN,va.floatExp,va.float];Sc.schema=ap});var Cc=w(xc=>{"use strict";var op=j(),sp=bt(),cp=kt();function Pc(t){return typeof t=="bigint"||Number.isInteger(t)}var pr=({value:t})=>JSON.stringify(t),lp=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:pr},{identify:t=>t==null,createNode:()=>new op.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:pr},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:pr},{identify:Pc,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:i})=>i?BigInt(t):parseInt(t,10),stringify:({value:t})=>Pc(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:pr}],up={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},dp=[sp.map,cp.seq].concat(lp,up);xc.schema=dp});var ya=w(Rc=>{"use strict";var ti=Hi("buffer"),wa=j(),fp=Yt(),hp={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof ti.Buffer=="function")return ti.Buffer.from(t,"base64");if(typeof atob=="function"){let i=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(i.length);for(let n=0;n<i.length;++n)r[n]=i.charCodeAt(n);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:i},r,n,a){if(!i)return"";let o=i,s;if(typeof ti.Buffer=="function")s=o instanceof ti.Buffer?o.toString("base64"):ti.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]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=wa.Scalar.BLOCK_LITERAL),e!==wa.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(s.length/c),u=new Array(l);for(let d=0,f=0;d<l;++d,f+=c)u[d]=s.substr(f,c);s=u.join(e===wa.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return fp.stringifyString({comment:t,type:e,value:s},r,n,a)}};Rc.binary=hp});var gr=w(vr=>{"use strict";var mr=P(),Na=Me(),pp=j(),mp=qe();function Ac(t,e){if(mr.isSeq(t))for(let i=0;i<t.items.length;++i){let r=t.items[i];if(!mr.isPair(r)){if(mr.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let n=r.items[0]||new Na.Pair(new pp.Scalar(null));if(r.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${r.commentBefore}
56
+ ${n.key.commentBefore}`:r.commentBefore),r.comment){let a=n.value??n.key;a.comment=a.comment?`${r.comment}
57
+ ${a.comment}`:r.comment}r=n}t.items[i]=mr.isPair(r)?r:new Na.Pair(r)}}else e("Expected a sequence for this tag");return t}function _c(t,e,i){let{replacer:r}=i,n=new mp.YAMLSeq(t);n.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof r=="function"&&(o=r.call(e,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=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)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;n.items.push(Na.createPair(s,c,i))}return n}var vp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ac,createNode:_c};vr.createPairs=_c;vr.pairs=vp;vr.resolvePairs=Ac});var Sa=w(ka=>{"use strict";var Tc=P(),ba=He(),ii=Ve(),gp=qe(),Ic=gr(),et=class t extends gp.YAMLSeq{constructor(){super(),this.add=ii.YAMLMap.prototype.add.bind(this),this.delete=ii.YAMLMap.prototype.delete.bind(this),this.get=ii.YAMLMap.prototype.get.bind(this),this.has=ii.YAMLMap.prototype.has.bind(this),this.set=ii.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,i){if(!i)return super.toJSON(e);let r=new Map;i?.onCreate&&i.onCreate(r);for(let n of this.items){let a,o;if(Tc.isPair(n)?(a=ba.toJS(n.key,"",i),o=ba.toJS(n.value,a,i)):a=ba.toJS(n,"",i),r.has(a))throw new Error("Ordered maps must not include duplicate keys");r.set(a,o)}return r}static from(e,i,r){let n=Ic.createPairs(e,i,r),a=new this;return a.items=n.items,a}};et.tag="tag:yaml.org,2002:omap";var wp={collection:"seq",identify:t=>t instanceof Map,nodeClass:et,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let i=Ic.resolvePairs(t,e),r=[];for(let{key:n}of i.items)Tc.isScalar(n)&&(r.includes(n.value)?e(`Ordered maps must not include duplicate keys: ${n.value}`):r.push(n.value));return Object.assign(new et,i)},createNode:(t,e,i)=>et.from(t,e,i)};ka.YAMLOMap=et;ka.omap=wp});var Dc=w(Ea=>{"use strict";var jc=j();function $c({value:t,source:e},i){return e&&(t?Oc:Hc).test.test(e)?e:t?i.options.trueStr:i.options.falseStr}var Oc={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 jc.Scalar(!0),stringify:$c},Hc={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 jc.Scalar(!1),stringify:$c};Ea.falseTag=Hc;Ea.trueTag=Oc});var Bc=w(wr=>{"use strict";var yp=j(),Pa=St(),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:Pa.stringifyNumber},bp={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():Pa.stringifyNumber(t)}},kp={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 yp.Scalar(parseFloat(t.replace(/_/g,""))),i=t.indexOf(".");if(i!==-1){let r=t.substring(i+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:Pa.stringifyNumber};wr.float=kp;wr.floatExp=bp;wr.floatNaN=Np});var Mc=w(ni=>{"use strict";var Lc=St(),ri=t=>typeof t=="bigint"||Number.isInteger(t);function yr(t,e,i,{intAsBigInt:r}){let n=t[0];if((n==="-"||n==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(i){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return n==="-"?BigInt(-1)*o:o}let a=parseInt(t,i);return n==="-"?-1*a:a}function xa(t,e,i){let{value:r}=t;if(ri(r)){let n=r.toString(e);return r<0?"-"+i+n.substr(1):i+n}return Lc.stringifyNumber(t)}var Sp={identify:ri,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,i)=>yr(t,2,2,i),stringify:t=>xa(t,2,"0b")},Ep={identify:ri,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,i)=>yr(t,1,8,i),stringify:t=>xa(t,8,"0")},Pp={identify:ri,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,i)=>yr(t,0,10,i),stringify:Lc.stringifyNumber},xp={identify:ri,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,i)=>yr(t,2,16,i),stringify:t=>xa(t,16,"0x")};ni.int=Pp;ni.intBin=Sp;ni.intHex=xp;ni.intOct=Ep});var Ra=w(Ca=>{"use strict";var kr=P(),Nr=Me(),br=Ve(),tt=class t extends br.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let i;kr.isPair(e)?i=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?i=new Nr.Pair(e.key,null):i=new Nr.Pair(e,null),br.findPair(this.items,i.key)||this.items.push(i)}get(e,i){let r=br.findPair(this.items,e);return!i&&kr.isPair(r)?kr.isScalar(r.key)?r.key.value:r.key:r}set(e,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let r=br.findPair(this.items,e);r&&!i?this.items.splice(this.items.indexOf(r),1):!r&&i&&this.items.push(new Nr.Pair(e))}toJSON(e,i){return super.toJSON(e,i,Set)}toString(e,i,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),i,r);throw new Error("Set items must all have null values")}static from(e,i,r){let{replacer:n}=r,a=new this(e);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof n=="function"&&(o=n.call(i,o,o)),a.items.push(Nr.createPair(o,null,r));return a}};tt.tag="tag:yaml.org,2002:set";var Cp={collection:"map",identify:t=>t instanceof Set,nodeClass:tt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,i)=>tt.from(t,e,i),resolve(t,e){if(kr.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new tt,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Ca.YAMLSet=tt;Ca.set=Cp});var _a=w(Sr=>{"use strict";var Rp=St();function Aa(t,e){let i=t[0],r=i==="-"||i==="+"?t.substring(1):t,n=o=>e?BigInt(o):Number(o),a=r.replace(/_/g,"").split(":").reduce((o,s)=>o*n(60)+n(s),n(0));return i==="-"?n(-1)*a:a}function Fc(t){let{value:e}=t,i=o=>o;if(typeof e=="bigint")i=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Rp.stringifyNumber(t);let r="";e<0&&(r="-",e*=i(-1));let n=i(60),a=[e%n];return e<60?a.unshift(0):(e=(e-a[0])/n,a.unshift(e%n),e>=60&&(e=(e-a[0])/n,a.unshift(e))),r+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Ap={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:i})=>Aa(t,i),stringify:Fc},_p={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=>Aa(t,!1),stringify:Fc},Vc={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(Vc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,r,n,a,o,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(i,r-1,n,a||0,o||0,s||0,c),u=e[8];if(u&&u!=="Z"){let d=Aa(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Sr.floatTime=_p;Sr.intTime=Ap;Sr.timestamp=Vc});var zc=w(Wc=>{"use strict";var Tp=bt(),Ip=ur(),jp=kt(),$p=ei(),Op=ya(),qc=Dc(),Ta=Bc(),Er=Mc(),Hp=ir(),Dp=Sa(),Bp=gr(),Lp=Ra(),Ia=_a(),Mp=[Tp.map,jp.seq,$p.string,Ip.nullTag,qc.trueTag,qc.falseTag,Er.intBin,Er.intOct,Er.int,Er.intHex,Ta.floatNaN,Ta.floatExp,Ta.float,Op.binary,Hp.merge,Dp.omap,Bp.pairs,Lp.set,Ia.intTime,Ia.floatTime,Ia.timestamp];Wc.schema=Mp});var tl=w(Oa=>{"use strict";var Kc=bt(),Fp=ur(),Yc=kt(),Vp=ei(),qp=da(),ja=ha(),$a=ma(),Wp=Ec(),zp=Cc(),Xc=ya(),ai=ir(),Qc=Sa(),Zc=gr(),Jc=zc(),el=Ra(),Pr=_a(),Gc=new Map([["core",Wp.schema],["failsafe",[Kc.map,Yc.seq,Vp.string]],["json",zp.schema],["yaml11",Jc.schema],["yaml-1.1",Jc.schema]]),Uc={binary:Xc.binary,bool:qp.boolTag,float:ja.float,floatExp:ja.floatExp,floatNaN:ja.floatNaN,floatTime:Pr.floatTime,int:$a.int,intHex:$a.intHex,intOct:$a.intOct,intTime:Pr.intTime,map:Kc.map,merge:ai.merge,null:Fp.nullTag,omap:Qc.omap,pairs:Zc.pairs,seq:Yc.seq,set:el.set,timestamp:Pr.timestamp},Jp={"tag:yaml.org,2002:binary":Xc.binary,"tag:yaml.org,2002:merge":ai.merge,"tag:yaml.org,2002:omap":Qc.omap,"tag:yaml.org,2002:pairs":Zc.pairs,"tag:yaml.org,2002:set":el.set,"tag:yaml.org,2002:timestamp":Pr.timestamp};function Gp(t,e,i){let r=Gc.get(e);if(r&&!t)return i&&!r.includes(ai.merge)?r.concat(ai.merge):r.slice();let n=r;if(!n)if(Array.isArray(t))n=[];else{let a=Array.from(Gc.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(t))for(let a of t)n=n.concat(a);else typeof t=="function"&&(n=t(n.slice()));return i&&(n=n.concat(ai.merge)),n.reduce((a,o)=>{let s=typeof o=="string"?Uc[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(Uc).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}Oa.coreKnownTags=Jp;Oa.getTags=Gp});var Ba=w(il=>{"use strict";var Ha=P(),Up=bt(),Kp=kt(),Yp=ei(),xr=tl(),Xp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Da=class t{constructor({compat:e,customTags:i,merge:r,resolveKnownTags:n,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?xr.getTags(e,"compat"):e?xr.getTags(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=n?xr.coreKnownTags:{},this.tags=xr.getTags(i,this.name,r),this.toStringOptions=s??null,Object.defineProperty(this,Ha.MAP,{value:Up.map}),Object.defineProperty(this,Ha.SCALAR,{value:Yp.string}),Object.defineProperty(this,Ha.SEQ,{value:Kp.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Xp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};il.Schema=Da});var nl=w(rl=>{"use strict";var Qp=P(),La=Xt(),oi=Gt();function Zp(t,e){let i=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(i.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&i.push("---");let n=La.createStringifyContext(t,e),{commentString:a}=n.options;if(t.commentBefore){i.length!==1&&i.unshift("");let c=a(t.commentBefore);i.unshift(oi.indentComment(c,""))}let o=!1,s=null;if(t.contents){if(Qp.isNode(t.contents)){if(t.contents.spaceBefore&&r&&i.push(""),t.contents.commentBefore){let u=a(t.contents.commentBefore);i.push(oi.indentComment(u,""))}n.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>o=!0,l=La.stringify(t.contents,n,()=>s=null,c);s&&(l+=oi.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(La.stringify(t.contents,n));if(t.directives?.docEnd)if(t.comment){let c=a(t.comment);c.includes(`
58
+ `)?(i.push("..."),i.push(oi.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(oi.indentComment(a(c),"")))}return i.join(`
59
59
  `)+`
60
- `}$s.stringifyDocument=Vd});var xt=w(Fs=>{"use strict";var Wd=ht(),Ye=si(),M=C(),zd=he(),Jd=le(),Gd=jr(),Kd=Ls(),$r=ni(),Ud=Bn(),Yd=pt(),Lr=Mn(),Fr=class t{constructor(e,i,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,M.NODE_TYPE,{value:M.DOC});let r=null;typeof i=="function"||Array.isArray(i)?r=i:n===void 0&&i&&(n=i,i=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Lr.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let e=Object.create(t.prototype,{[M.NODE_TYPE]:{value:M.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=M.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Xe(this.contents)&&this.contents.add(e)}addIn(e,i){Xe(this.contents)&&this.contents.addIn(e,i)}createAlias(e,i){if(!e.anchor){let n=$r.anchorNames(this);e.anchor=!i||n.has(i)?$r.findNewAnchor(i||"a",n):i}return new Wd.Alias(e.anchor)}createNode(e,i,n){let r;if(typeof i=="function")e=i.call({"":e},"",e),r=i;else if(Array.isArray(i)){let p=N=>typeof N=="number"||N instanceof String||N instanceof Number,y=i.filter(p).map(String);y.length>0&&(i=i.concat(y)),r=i}else n===void 0&&i&&(n=i,i=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:d}=n??{},{onAnchor:u,setAnchors:f,sourceObjects:m}=$r.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:m},h=Yd.createNode(e,d,g);return s&&M.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,i,n={}){let r=this.createNode(e,null,n),a=this.createNode(i,null,n);return new zd.Pair(r,a)}delete(e){return Xe(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ye.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Xe(this.contents)?this.contents.deleteIn(e):!1}get(e,i){return M.isCollection(this.contents)?this.contents.get(e,i):void 0}getIn(e,i){return Ye.isEmptyPath(e)?!i&&M.isScalar(this.contents)?this.contents.value:this.contents:M.isCollection(this.contents)?this.contents.getIn(e,i):void 0}has(e){return M.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Ye.isEmptyPath(e)?this.contents!==void 0:M.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,i){this.contents==null?this.contents=Ye.collectionFromPath(this.schema,[e],i):Xe(this.contents)&&this.contents.set(e,i)}setIn(e,i){Ye.isEmptyPath(e)?this.contents=i:this.contents==null?this.contents=Ye.collectionFromPath(this.schema,Array.from(e),i):Xe(this.contents)&&this.contents.setIn(e,i)}setSchema(e,i={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Lr.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Lr.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=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(i.schema instanceof Object)this.schema=i.schema;else if(n)this.schema=new Gd.Schema(Object.assign(n,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:i,mapAsMap:n,maxAliasCount:r,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=Jd.toJS(this.contents,i??"",s);if(typeof a=="function")for(let{count:l,res:d}of s.anchors.values())a(d,l);return typeof o=="function"?Ud.applyReviver(o,{"":c},"",c):c}toJSON(e,i){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:i})}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 i=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return Kd.stringifyDocument(this,e)}};function Xe(t){if(M.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Fs.Document=Fr});var _t=w(It=>{"use strict";var Tt=class extends Error{constructor(e,i,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=i}},Mr=class extends Tt{constructor(e,i,n){super("YAMLParseError",e,i,n)}},Br=class extends Tt{constructor(e,i,n){super("YAMLWarning",e,i,n)}},Xd=(t,e)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>e.linePos(s));let{line:n,col:r}=i.linePos[0];i.message+=` at line ${n}, column ${r}`;let a=r-1,o=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),n>1&&/^ *$/.test(o.substring(0,a))){let s=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);s.length>80&&(s=s.substring(0,79)+`…
61
- `),o=s+o}if(/[^ ]/.test(o)){let s=1,c=i.linePos[1];c?.line===n&&c.col>r&&(s=Math.max(1,Math.min(c.col-r,80-a)));let l=" ".repeat(a)+"^".repeat(s);i.message+=`:
60
+ `}rl.stringifyDocument=Zp});var si=w(al=>{"use strict";var em=zt(),Et=Ji(),Y=P(),tm=Me(),im=He(),rm=Ba(),nm=nl(),Ma=Vi(),am=Wn(),om=Jt(),Fa=qn(),Va=class t{constructor(e,i,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Y.NODE_TYPE,{value:Y.DOC});let n=null;typeof i=="function"||Array.isArray(i)?n=i:r===void 0&&i&&(r=i,i=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=a;let{version:o}=a;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Fa.Directives({version:o}),this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,n,r)}clone(){let e=Object.create(t.prototype,{[Y.NODE_TYPE]:{value:Y.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=Y.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Pt(this.contents)&&this.contents.add(e)}addIn(e,i){Pt(this.contents)&&this.contents.addIn(e,i)}createAlias(e,i){if(!e.anchor){let r=Ma.anchorNames(this);e.anchor=!i||r.has(i)?Ma.findNewAnchor(i||"a",r):i}return new em.Alias(e.anchor)}createNode(e,i,r){let n;if(typeof i=="function")e=i.call({"":e},"",e),n=i;else if(Array.isArray(i)){let m=N=>typeof N=="number"||N instanceof String||N instanceof Number,y=i.filter(m).map(String);y.length>0&&(i=i.concat(y)),n=i}else r===void 0&&i&&(r=i,i=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:u}=r??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=Ma.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:p},h=om.createNode(e,u,g);return s&&Y.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,i,r={}){let n=this.createNode(e,null,r),a=this.createNode(i,null,r);return new tm.Pair(n,a)}delete(e){return Pt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Et.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Pt(this.contents)?this.contents.deleteIn(e):!1}get(e,i){return Y.isCollection(this.contents)?this.contents.get(e,i):void 0}getIn(e,i){return Et.isEmptyPath(e)?!i&&Y.isScalar(this.contents)?this.contents.value:this.contents:Y.isCollection(this.contents)?this.contents.getIn(e,i):void 0}has(e){return Y.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Et.isEmptyPath(e)?this.contents!==void 0:Y.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,i){this.contents==null?this.contents=Et.collectionFromPath(this.schema,[e],i):Pt(this.contents)&&this.contents.set(e,i)}setIn(e,i){Et.isEmptyPath(e)?this.contents=i:this.contents==null?this.contents=Et.collectionFromPath(this.schema,Array.from(e),i):Pt(this.contents)&&this.contents.setIn(e,i)}setSchema(e,i={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Fa.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Fa.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let n=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(r)this.schema=new rm.Schema(Object.assign(r,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:i,mapAsMap:r,maxAliasCount:n,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=im.toJS(this.contents,i??"",s);if(typeof a=="function")for(let{count:l,res:u}of s.anchors.values())a(u,l);return typeof o=="function"?am.applyReviver(o,{"":c},"",c):c}toJSON(e,i){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:i})}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 i=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return nm.stringifyDocument(this,e)}};function Pt(t){if(Y.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}al.Document=Va});var ui=w(li=>{"use strict";var ci=class extends Error{constructor(e,i,r,n){super(),this.name=e,this.code=r,this.message=n,this.pos=i}},qa=class extends ci{constructor(e,i,r){super("YAMLParseError",e,i,r)}},Wa=class extends ci{constructor(e,i,r){super("YAMLWarning",e,i,r)}},sm=(t,e)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>e.linePos(s));let{line:r,col:n}=i.linePos[0];i.message+=` at line ${r}, column ${n}`;let a=n-1,o=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),r>1&&/^ *$/.test(o.substring(0,a))){let s=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);s.length>80&&(s=s.substring(0,79)+`…
61
+ `),o=s+o}if(/[^ ]/.test(o)){let s=1,c=i.linePos[1];c?.line===r&&c.col>n&&(s=Math.max(1,Math.min(c.col-n,80-a)));let l=" ".repeat(a)+"^".repeat(s);i.message+=`:
62
62
 
63
63
  ${o}
64
64
  ${l}
65
- `}};It.YAMLError=Tt;It.YAMLParseError=Mr;It.YAMLWarning=Br;It.prettifyError=Xd});var Ot=w(Ms=>{"use strict";function Qd(t,{flow:e,indicator:i,next:n,offset:r,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,d=s,u="",f="",m=!1,g=!1,h=null,p=null,y=null,N=null,k=null,S=null,E=null;for(let b of t)switch(g&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&a(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(l&&b.type!=="comment"&&b.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),b.type){case"space":!e&&(i!=="doc-start"||n?.type!=="flow-collection")&&b.source.includes(" ")&&(h=b),d=!0;break;case"comment":{d||a(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let x=b.source.substring(1)||" ";u?u+=f+x:u=x,f="",l=!1;break}case"newline":l?u?u+=b.source:(!S||i!=="seq-item-ind")&&(c=!0):f+=b.source,l=!0,m=!0,(p||y)&&(N=b),d=!0;break;case"anchor":p&&a(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&a(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=b,E??(E=b.offset),l=!1,d=!1,g=!0;break;case"tag":{y&&a(b,"MULTIPLE_TAGS","A node can have at most one tag"),y=b,E??(E=b.offset),l=!1,d=!1,g=!0;break}case i:(p||y)&&a(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),S&&a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),S=b,l=i==="seq-item-ind"||i==="explicit-key-ind",d=!1;break;case"comma":if(e){k&&a(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=b,l=!1,d=!1;break}default:a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,d=!1}let v=t[t.length-1],R=v?v.offset+v.source.length:r;return g&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&a(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:S,spaceBefore:c,comment:u,hasNewline:m,anchor:p,tag:y,newlineAfterProp:N,end:R,start:E??R}}Ms.resolveProps=Qd});var qi=w(Bs=>{"use strict";function Dr(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 i of e.start)if(i.type==="newline")return!0;if(e.sep){for(let i of e.sep)if(i.type==="newline")return!0}if(Dr(e.key)||Dr(e.value))return!0}return!1;default:return!0}}Bs.containsNewline=Dr});var qr=w(Ds=>{"use strict";var Zd=qi();function eh(t,e,i){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Zd.containsNewline(e)&&i(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Ds.flowIndentCheck=eh});var Vr=w(Vs=>{"use strict";var qs=C();function th(t,e,i){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let r=typeof n=="function"?n:(a,o)=>a===o||qs.isScalar(a)&&qs.isScalar(o)&&a.value===o.value;return e.some(a=>r(a.key,i))}Vs.mapIncludes=th});var Us=w(Ks=>{"use strict";var Ws=he(),ih=me(),zs=Ot(),nh=qi(),Js=qr(),rh=Vr(),Gs="All mapping items must start at the same column";function ah({composeNode:t,composeEmptyNode:e},i,n,r,a){let o=a?.nodeClass??ih.YAMLMap,s=new o(i.schema);i.atRoot&&(i.atRoot=!1);let c=n.offset,l=null;for(let d of n.items){let{start:u,key:f,sep:m,value:g}=d,h=zs.resolveProps(u,{indicator:"explicit-key-ind",next:f??m?.[0],offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0}),p=!h.found;if(p){if(f&&(f.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&r(c,"BAD_INDENT",Gs)),!h.anchor&&!h.tag&&!m){l=h.end,h.comment&&(s.comment?s.comment+=`
67
- `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||nh.containsNewline(f))&&r(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&r(c,"BAD_INDENT",Gs);i.atKey=!0;let y=h.end,N=f?t(i,f,h,r):e(i,y,u,null,h,r);i.schema.compat&&Js.flowIndentCheck(n.indent,f,r),i.atKey=!1,rh.mapIncludes(i,s.items,N)&&r(y,"DUPLICATE_KEY","Map keys must be unique");let k=zs.resolveProps(m??[],{indicator:"map-value-ind",next:g,offset:N.range[2],onError:r,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=k.end,k.found){p&&(g?.type==="block-map"&&!k.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<k.found.offset-1024&&r(N.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let S=g?t(i,g,k,r):e(i,c,m,null,k,r);i.schema.compat&&Js.flowIndentCheck(n.indent,g,r),c=S.range[2];let E=new Ws.Pair(N,S);i.options.keepSourceTokens&&(E.srcToken=d),s.items.push(E)}else{p&&r(N.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(N.comment?N.comment+=`
68
- `+k.comment:N.comment=k.comment);let S=new Ws.Pair(N);i.options.keepSourceTokens&&(S.srcToken=d),s.items.push(S)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[n.offset,c,l??c],s}Ks.resolveBlockMap=ah});var Xs=w(Ys=>{"use strict";var oh=ve(),sh=Ot(),ch=qr();function lh({composeNode:t,composeEmptyNode:e},i,n,r,a){let o=a?.nodeClass??oh.YAMLSeq,s=new o(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let c=n.offset,l=null;for(let{start:d,value:u}of n.items){let f=sh.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?r(f.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(s.comment=f.comment);continue}let m=u?t(i,u,f,r):e(i,f.end,d,null,f,r);i.schema.compat&&ch.flowIndentCheck(n.indent,u,r),c=m.range[2],s.items.push(m)}return s.range=[n.offset,c,l??c],s}Ys.resolveBlockSeq=lh});var Qe=w(Qs=>{"use strict";function uh(t,e,i,n){let r="";if(t){let a=!1,o="";for(let s of t){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{i&&!a&&n(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=c.substring(1)||" ";r?r+=o+d:r=d,o="";break}case"newline":r&&(o+=c),a=!0;break;default:n(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:r,offset:e}}Qs.resolveEnd=uh});var ic=w(tc=>{"use strict";var fh=C(),dh=he(),Zs=me(),hh=ve(),ph=Qe(),ec=Ot(),mh=qi(),vh=Vr(),Wr="Block collections are not allowed within flow collections",zr=t=>t&&(t.type==="block-map"||t.type==="block-seq");function gh({composeNode:t,composeEmptyNode:e},i,n,r,a){let o=n.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?Zs.YAMLMap:hh.YAMLSeq),l=new c(i.schema);l.flow=!0;let d=i.atRoot;d&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let u=n.offset+n.start.source.length;for(let p=0;p<n.items.length;++p){let y=n.items[p],{start:N,key:k,sep:S,value:E}=y,v=ec.resolveProps(N,{flow:s,indicator:"explicit-key-ind",next:k??S?.[0],offset:u,onError:r,parentIndent:n.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!S&&!E){p===0&&v.comma?r(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):p<n.items.length-1&&r(v.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),v.comment&&(l.comment?l.comment+=`
69
- `+v.comment:l.comment=v.comment),u=v.end;continue}!o&&i.options.strict&&mh.containsNewline(k)&&r(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(p===0)v.comma&&r(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(v.comma||r(v.start,"MISSING_CHAR",`Missing , between ${s} items`),v.comment){let R="";e:for(let b of N)switch(b.type){case"comma":case"space":break;case"comment":R=b.source.substring(1);break e;default:break e}if(R){let b=l.items[l.items.length-1];fh.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
- `+R:b.comment=R,v.comment=v.comment.substring(R.length+1)}}if(!o&&!S&&!v.found){let R=E?t(i,E,v,r):e(i,v.end,S,null,v,r);l.items.push(R),u=R.range[2],zr(E)&&r(R.range,"BLOCK_IN_FLOW",Wr)}else{i.atKey=!0;let R=v.end,b=k?t(i,k,v,r):e(i,R,N,null,v,r);zr(k)&&r(b.range,"BLOCK_IN_FLOW",Wr),i.atKey=!1;let x=ec.resolveProps(S??[],{flow:s,indicator:"map-value-ind",next:E,offset:b.range[2],onError:r,parentIndent:n.indent,startOnNewline:!1});if(x.found){if(!o&&!v.found&&i.options.strict){if(S)for(let _ of S){if(_===x.found)break;if(_.type==="newline"){r(_,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.start<x.found.offset-1024&&r(x.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?r(E,"MISSING_CHAR",`Missing space after : in ${s}`):r(x.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let F=E?t(i,E,x,r):x.found?e(i,x.end,S,null,x,r):null;F?zr(E)&&r(F.range,"BLOCK_IN_FLOW",Wr):x.comment&&(b.comment?b.comment+=`
71
- `+x.comment:b.comment=x.comment);let qe=new dh.Pair(b,F);if(i.options.keepSourceTokens&&(qe.srcToken=y),o){let _=l;vh.mapIncludes(i,_.items,b)&&r(R,"DUPLICATE_KEY","Map keys must be unique"),_.items.push(qe)}else{let _=new Zs.YAMLMap(i.schema);_.flow=!0,_.items.push(qe);let Ga=(F??b).range;_.range=[b.range[0],Ga[1],Ga[2]],l.items.push(_)}u=F?F.range[2]:x.end}}let f=o?"}":"]",[m,...g]=n.end,h=u;if(m?.source===f)h=m.offset+m.source.length;else{let p=s[0].toUpperCase()+s.substring(1),y=d?`${p} must end with a ${f}`:`${p} in block collection must be sufficiently indented and end with a ${f}`;r(u,d?"MISSING_CHAR":"BAD_INDENT",y),m&&m.source.length!==1&&g.unshift(m)}if(g.length>0){let p=ph.resolveEnd(g,h,i.options.strict,r);p.comment&&(l.comment?l.comment+=`
72
- `+p.comment:l.comment=p.comment),l.range=[n.offset,h,p.offset]}else l.range=[n.offset,h,h];return l}tc.resolveFlowCollection=gh});var rc=w(nc=>{"use strict";var wh=C(),yh=T(),Nh=me(),bh=ve(),kh=Us(),Sh=Xs(),Eh=ic();function Jr(t,e,i,n,r,a){let o=i.type==="block-map"?kh.resolveBlockMap(t,e,i,n,a):i.type==="block-seq"?Sh.resolveBlockSeq(t,e,i,n,a):Eh.resolveFlowCollection(t,e,i,n,a),s=o.constructor;return r==="!"||r===s.tagName?(o.tag=s.tagName,o):(r&&(o.tag=r),o)}function Ch(t,e,i,n,r){let a=n.tag,o=a?e.directives.tagName(a.source,f=>r(a,"TAG_RESOLVE_FAILED",f)):null;if(i.type==="block-seq"){let{anchor:f,newlineAfterProp:m}=n,g=f&&a?f.offset>a.offset?f:a:f??a;g&&(!m||m.offset<g.offset)&&r(g,"MISSING_CHAR","Missing newline after block sequence props")}let s=i.type==="block-map"?"map":i.type==="block-seq"?"seq":i.start.source==="{"?"map":"seq";if(!a||!o||o==="!"||o===Nh.YAMLMap.tagName&&s==="map"||o===bh.YAMLSeq.tagName&&s==="seq")return Jr(t,e,i,r,o);let c=e.schema.tags.find(f=>f.tag===o&&f.collection===s);if(!c){let f=e.schema.knownTags[o];if(f?.collection===s)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?r(a,"BAD_COLLECTION_TYPE",`${f.tag} used for ${s} collection, but expects ${f.collection??"scalar"}`,!0):r(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Jr(t,e,i,r,o)}let l=Jr(t,e,i,r,o,c),d=c.resolve?.(l,f=>r(a,"TAG_RESOLVE_FAILED",f),e.options)??l,u=wh.isNode(d)?d:new yh.Scalar(d);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}nc.composeCollection=Ch});var Kr=w(ac=>{"use strict";var Gr=T();function Rh(t,e,i){let n=e.offset,r=Ph(e,t.options.strict,i);if(!r)return{value:"",type:null,comment:"",range:[n,n,n]};let a=r.mode===">"?Gr.Scalar.BLOCK_FOLDED:Gr.Scalar.BLOCK_LITERAL,o=e.source?Ah(e.source):[],s=o.length;for(let h=o.length-1;h>=0;--h){let p=o[h][1];if(p===""||p==="\r")s=h;else break}if(s===0){let h=r.chomp==="+"&&o.length>0?`
73
- `.repeat(Math.max(1,o.length-1)):"",p=n+r.length;return e.source&&(p+=e.source.length),{value:h,type:a,comment:r.comment,range:[n,p,p]}}let c=e.indent+r.indent,l=e.offset+r.length,d=0;for(let h=0;h<s;++h){let[p,y]=o[h];if(y===""||y==="\r")r.indent===0&&p.length>c&&(c=p.length);else{p.length<c&&i(l+p.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=p.length),d=h,c===0&&!t.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=p.length+y.length+1}for(let h=o.length-1;h>=s;--h)o[h][0].length>c&&(s=h+1);let u="",f="",m=!1;for(let h=0;h<d;++h)u+=o[h][0].slice(c)+`
74
- `;for(let h=d;h<s;++h){let[p,y]=o[h];l+=p.length+y.length+1;let N=y[y.length-1]==="\r";if(N&&(y=y.slice(0,-1)),y&&p.length<c){let S=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;i(l-y.length-(N?2:1),"BAD_INDENT",S),p=""}a===Gr.Scalar.BLOCK_LITERAL?(u+=f+p.slice(c)+y,f=`
75
- `):p.length>c||y[0]===" "?(f===" "?f=`
76
- `:!m&&f===`
65
+ `}};li.YAMLError=ci;li.YAMLParseError=qa;li.YAMLWarning=Wa;li.prettifyError=sm});var di=w(ol=>{"use strict";function cm(t,{flow:e,indicator:i,next:r,offset:n,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d="",f="",p=!1,g=!1,h=null,m=null,y=null,N=null,k=null,S=null,E=null;for(let b of t)switch(g&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&a(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(l&&b.type!=="comment"&&b.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),b.type){case"space":!e&&(i!=="doc-start"||r?.type!=="flow-collection")&&b.source.includes(" ")&&(h=b),u=!0;break;case"comment":{u||a(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let A=b.source.substring(1)||" ";d?d+=f+A:d=A,f="",l=!1;break}case"newline":l?d?d+=b.source:(!S||i!=="seq-item-ind")&&(c=!0):f+=b.source,l=!0,p=!0,(m||y)&&(N=b),u=!0;break;case"anchor":m&&a(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&a(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=b,E??(E=b.offset),l=!1,u=!1,g=!0;break;case"tag":{y&&a(b,"MULTIPLE_TAGS","A node can have at most one tag"),y=b,E??(E=b.offset),l=!1,u=!1,g=!0;break}case i:(m||y)&&a(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),S&&a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),S=b,l=i==="seq-item-ind"||i==="explicit-key-ind",u=!1;break;case"comma":if(e){k&&a(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=b,l=!1,u=!1;break}default:a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,u=!1}let v=t[t.length-1],x=v?v.offset+v.source.length:n;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&a(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:S,spaceBefore:c,comment:d,hasNewline:p,anchor:m,tag:y,newlineAfterProp:N,end:x,start:E??x}}ol.resolveProps=cm});var Cr=w(sl=>{"use strict";function za(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 i of e.start)if(i.type==="newline")return!0;if(e.sep){for(let i of e.sep)if(i.type==="newline")return!0}if(za(e.key)||za(e.value))return!0}return!1;default:return!0}}sl.containsNewline=za});var Ja=w(cl=>{"use strict";var lm=Cr();function um(t,e,i){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&lm.containsNewline(e)&&i(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}cl.flowIndentCheck=um});var Ga=w(ul=>{"use strict";var ll=P();function dm(t,e,i){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let n=typeof r=="function"?r:(a,o)=>a===o||ll.isScalar(a)&&ll.isScalar(o)&&a.value===o.value;return e.some(a=>n(a.key,i))}ul.mapIncludes=dm});var vl=w(ml=>{"use strict";var dl=Me(),fm=Ve(),fl=di(),hm=Cr(),hl=Ja(),pm=Ga(),pl="All mapping items must start at the same column";function mm({composeNode:t,composeEmptyNode:e},i,r,n,a){let o=a?.nodeClass??fm.YAMLMap,s=new o(i.schema);i.atRoot&&(i.atRoot=!1);let c=r.offset,l=null;for(let u of r.items){let{start:d,key:f,sep:p,value:g}=u,h=fl.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0}),m=!h.found;if(m){if(f&&(f.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==r.indent&&n(c,"BAD_INDENT",pl)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(s.comment?s.comment+=`
67
+ `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||hm.containsNewline(f))&&n(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&n(c,"BAD_INDENT",pl);i.atKey=!0;let y=h.end,N=f?t(i,f,h,n):e(i,y,d,null,h,n);i.schema.compat&&hl.flowIndentCheck(r.indent,f,n),i.atKey=!1,pm.mapIncludes(i,s.items,N)&&n(y,"DUPLICATE_KEY","Map keys must be unique");let k=fl.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:N.range[2],onError:n,parentIndent:r.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=k.end,k.found){m&&(g?.type==="block-map"&&!k.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<k.found.offset-1024&&n(N.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let S=g?t(i,g,k,n):e(i,c,p,null,k,n);i.schema.compat&&hl.flowIndentCheck(r.indent,g,n),c=S.range[2];let E=new dl.Pair(N,S);i.options.keepSourceTokens&&(E.srcToken=u),s.items.push(E)}else{m&&n(N.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(N.comment?N.comment+=`
68
+ `+k.comment:N.comment=k.comment);let S=new dl.Pair(N);i.options.keepSourceTokens&&(S.srcToken=u),s.items.push(S)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[r.offset,c,l??c],s}ml.resolveBlockMap=mm});var wl=w(gl=>{"use strict";var vm=qe(),gm=di(),wm=Ja();function ym({composeNode:t,composeEmptyNode:e},i,r,n,a){let o=a?.nodeClass??vm.YAMLSeq,s=new o(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let c=r.offset,l=null;for(let{start:u,value:d}of r.items){let f=gm.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?n(f.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(s.comment=f.comment);continue}let p=d?t(i,d,f,n):e(i,f.end,u,null,f,n);i.schema.compat&&wm.flowIndentCheck(r.indent,d,n),c=p.range[2],s.items.push(p)}return s.range=[r.offset,c,l??c],s}gl.resolveBlockSeq=ym});var xt=w(yl=>{"use strict";function Nm(t,e,i,r){let n="";if(t){let a=!1,o="";for(let s of t){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{i&&!a&&r(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";n?n+=o+u:n=u,o="";break}case"newline":n&&(o+=c),a=!0;break;default:r(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:n,offset:e}}yl.resolveEnd=Nm});var Sl=w(kl=>{"use strict";var bm=P(),km=Me(),Nl=Ve(),Sm=qe(),Em=xt(),bl=di(),Pm=Cr(),xm=Ga(),Ua="Block collections are not allowed within flow collections",Ka=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Cm({composeNode:t,composeEmptyNode:e},i,r,n,a){let o=r.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?Nl.YAMLMap:Sm.YAMLSeq),l=new c(i.schema);l.flow=!0;let u=i.atRoot;u&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let d=r.offset+r.start.source.length;for(let m=0;m<r.items.length;++m){let y=r.items[m],{start:N,key:k,sep:S,value:E}=y,v=bl.resolveProps(N,{flow:s,indicator:"explicit-key-ind",next:k??S?.[0],offset:d,onError:n,parentIndent:r.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!S&&!E){m===0&&v.comma?n(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):m<r.items.length-1&&n(v.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),v.comment&&(l.comment?l.comment+=`
69
+ `+v.comment:l.comment=v.comment),d=v.end;continue}!o&&i.options.strict&&Pm.containsNewline(k)&&n(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)v.comma&&n(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(v.comma||n(v.start,"MISSING_CHAR",`Missing , between ${s} items`),v.comment){let x="";e:for(let b of N)switch(b.type){case"comma":case"space":break;case"comment":x=b.source.substring(1);break e;default:break e}if(x){let b=l.items[l.items.length-1];bm.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
+ `+x:b.comment=x,v.comment=v.comment.substring(x.length+1)}}if(!o&&!S&&!v.found){let x=E?t(i,E,v,n):e(i,v.end,S,null,v,n);l.items.push(x),d=x.range[2],Ka(E)&&n(x.range,"BLOCK_IN_FLOW",Ua)}else{i.atKey=!0;let x=v.end,b=k?t(i,k,v,n):e(i,x,N,null,v,n);Ka(k)&&n(b.range,"BLOCK_IN_FLOW",Ua),i.atKey=!1;let A=bl.resolveProps(S??[],{flow:s,indicator:"map-value-ind",next:E,offset:b.range[2],onError:n,parentIndent:r.indent,startOnNewline:!1});if(A.found){if(!o&&!v.found&&i.options.strict){if(S)for(let $ of S){if($===A.found)break;if($.type==="newline"){n($,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.start<A.found.offset-1024&&n(A.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?n(E,"MISSING_CHAR",`Missing space after : in ${s}`):n(A.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let G=E?t(i,E,A,n):A.found?e(i,A.end,S,null,A,n):null;G?Ka(E)&&n(G.range,"BLOCK_IN_FLOW",Ua):A.comment&&(b.comment?b.comment+=`
71
+ `+A.comment:b.comment=A.comment);let vt=new km.Pair(b,G);if(i.options.keepSourceTokens&&(vt.srcToken=y),o){let $=l;xm.mapIncludes(i,$.items,b)&&n(x,"DUPLICATE_KEY","Map keys must be unique"),$.items.push(vt)}else{let $=new Nl.YAMLMap(i.schema);$.flow=!0,$.items.push(vt);let vs=(G??b).range;$.range=[b.range[0],vs[1],vs[2]],l.items.push($)}d=G?G.range[2]:A.end}}let f=o?"}":"]",[p,...g]=r.end,h=d;if(p?.source===f)h=p.offset+p.source.length;else{let m=s[0].toUpperCase()+s.substring(1),y=u?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;n(d,u?"MISSING_CHAR":"BAD_INDENT",y),p&&p.source.length!==1&&g.unshift(p)}if(g.length>0){let m=Em.resolveEnd(g,h,i.options.strict,n);m.comment&&(l.comment?l.comment+=`
72
+ `+m.comment:l.comment=m.comment),l.range=[r.offset,h,m.offset]}else l.range=[r.offset,h,h];return l}kl.resolveFlowCollection=Cm});var Pl=w(El=>{"use strict";var Rm=P(),Am=j(),_m=Ve(),Tm=qe(),Im=vl(),jm=wl(),$m=Sl();function Ya(t,e,i,r,n,a){let o=i.type==="block-map"?Im.resolveBlockMap(t,e,i,r,a):i.type==="block-seq"?jm.resolveBlockSeq(t,e,i,r,a):$m.resolveFlowCollection(t,e,i,r,a),s=o.constructor;return n==="!"||n===s.tagName?(o.tag=s.tagName,o):(n&&(o.tag=n),o)}function Om(t,e,i,r,n){let a=r.tag,o=a?e.directives.tagName(a.source,f=>n(a,"TAG_RESOLVE_FAILED",f)):null;if(i.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=r,g=f&&a?f.offset>a.offset?f:a:f??a;g&&(!p||p.offset<g.offset)&&n(g,"MISSING_CHAR","Missing newline after block sequence props")}let s=i.type==="block-map"?"map":i.type==="block-seq"?"seq":i.start.source==="{"?"map":"seq";if(!a||!o||o==="!"||o===_m.YAMLMap.tagName&&s==="map"||o===Tm.YAMLSeq.tagName&&s==="seq")return Ya(t,e,i,n,o);let c=e.schema.tags.find(f=>f.tag===o&&f.collection===s);if(!c){let f=e.schema.knownTags[o];if(f?.collection===s)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?n(a,"BAD_COLLECTION_TYPE",`${f.tag} used for ${s} collection, but expects ${f.collection??"scalar"}`,!0):n(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Ya(t,e,i,n,o)}let l=Ya(t,e,i,n,o,c),u=c.resolve?.(l,f=>n(a,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Rm.isNode(u)?u:new Am.Scalar(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}El.composeCollection=Om});var Qa=w(xl=>{"use strict";var Xa=j();function Hm(t,e,i){let r=e.offset,n=Dm(e,t.options.strict,i);if(!n)return{value:"",type:null,comment:"",range:[r,r,r]};let a=n.mode===">"?Xa.Scalar.BLOCK_FOLDED:Xa.Scalar.BLOCK_LITERAL,o=e.source?Bm(e.source):[],s=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===""||m==="\r")s=h;else break}if(s===0){let h=n.chomp==="+"&&o.length>0?`
73
+ `.repeat(Math.max(1,o.length-1)):"",m=r+n.length;return e.source&&(m+=e.source.length),{value:h,type:a,comment:n.comment,range:[r,m,m]}}let c=e.indent+n.indent,l=e.offset+n.length,u=0;for(let h=0;h<s;++h){let[m,y]=o[h];if(y===""||y==="\r")n.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&i(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(c=m.length),u=h,c===0&&!t.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+y.length+1}for(let h=o.length-1;h>=s;--h)o[h][0].length>c&&(s=h+1);let d="",f="",p=!1;for(let h=0;h<u;++h)d+=o[h][0].slice(c)+`
74
+ `;for(let h=u;h<s;++h){let[m,y]=o[h];l+=m.length+y.length+1;let N=y[y.length-1]==="\r";if(N&&(y=y.slice(0,-1)),y&&m.length<c){let S=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;i(l-y.length-(N?2:1),"BAD_INDENT",S),m=""}a===Xa.Scalar.BLOCK_LITERAL?(d+=f+m.slice(c)+y,f=`
75
+ `):m.length>c||y[0]===" "?(f===" "?f=`
76
+ `:!p&&f===`
77
77
  `&&(f=`
78
78
 
79
- `),u+=f+p.slice(c)+y,f=`
80
- `,m=!0):y===""?f===`
81
- `?u+=`
79
+ `),d+=f+m.slice(c)+y,f=`
80
+ `,p=!0):y===""?f===`
81
+ `?d+=`
82
82
  `:f=`
83
- `:(u+=f+y,f=" ",m=!1)}switch(r.chomp){case"-":break;case"+":for(let h=s;h<o.length;++h)u+=`
84
- `+o[h][0].slice(c);u[u.length-1]!==`
85
- `&&(u+=`
86
- `);break;default:u+=`
87
- `}let g=n+r.length+e.source.length;return{value:u,type:a,comment:r.comment,range:[n,g,g]}}function Ph({offset:t,props:e},i,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],a=r[0],o=0,s="",c=-1;for(let f=1;f<r.length;++f){let m=r[f];if(!s&&(m==="-"||m==="+"))s=m;else{let g=Number(m);!o&&g?o=g:c===-1&&(c=t+f)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,d="",u=r.length;for(let f=1;f<e.length;++f){let m=e[f];switch(m.type){case"space":l=!0;case"newline":u+=m.source.length;break;case"comment":i&&!l&&n(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=m.source.length,d=m.source.substring(1);break;case"error":n(m,"UNEXPECTED_TOKEN",m.message),u+=m.source.length;break;default:{let g=`Unexpected token in block scalar header: ${m.type}`;n(m,"UNEXPECTED_TOKEN",g);let h=m.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:d,length:u}}function Ah(t){let e=t.split(/\n( *)/),i=e[0],n=i.match(/^( *)/),a=[n?.[1]?[n[1],i.slice(n[1].length)]:["",i]];for(let o=1;o<e.length;o+=2)a.push([e[o],e[o+1]]);return a}ac.resolveBlockScalar=Rh});var Yr=w(sc=>{"use strict";var Ur=T(),xh=Qe();function Th(t,e,i){let{offset:n,type:r,source:a,end:o}=t,s,c,l=(f,m,g)=>i(n+f,m,g);switch(r){case"scalar":s=Ur.Scalar.PLAIN,c=Ih(a,l);break;case"single-quoted-scalar":s=Ur.Scalar.QUOTE_SINGLE,c=_h(a,l);break;case"double-quoted-scalar":s=Ur.Scalar.QUOTE_DOUBLE,c=Oh(a,l);break;default:return i(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[n,n+a.length,n+a.length]}}let d=n+a.length,u=xh.resolveEnd(o,d,e,i);return{value:c,type:s,comment:u.comment,range:[n,d,u.offset]}}function Ih(t,e){let i="";switch(t[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${t[0]}`;break}case"@":case"`":{i=`reserved character ${t[0]}`;break}}return i&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),oc(t)}function _h(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),oc(t.slice(1,-1)).replace(/''/g,"'")}function oc(t){let e,i;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
83
+ `:(d+=f+y,f=" ",p=!1)}switch(n.chomp){case"-":break;case"+":for(let h=s;h<o.length;++h)d+=`
84
+ `+o[h][0].slice(c);d[d.length-1]!==`
85
+ `&&(d+=`
86
+ `);break;default:d+=`
87
+ `}let g=r+n.length+e.source.length;return{value:d,type:a,comment:n.comment,range:[r,g,g]}}function Dm({offset:t,props:e},i,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=e[0],a=n[0],o=0,s="",c=-1;for(let f=1;f<n.length;++f){let p=n[f];if(!s&&(p==="-"||p==="+"))s=p;else{let g=Number(p);!o&&g?o=g:c===-1&&(c=t+f)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,u="",d=n.length;for(let f=1;f<e.length;++f){let p=e[f];switch(p.type){case"space":l=!0;case"newline":d+=p.source.length;break;case"comment":i&&!l&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=p.source.length,u=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),d+=p.source.length;break;default:{let g=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",g);let h=p.source;h&&typeof h=="string"&&(d+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function Bm(t){let e=t.split(/\n( *)/),i=e[0],r=i.match(/^( *)/),a=[r?.[1]?[r[1],i.slice(r[1].length)]:["",i]];for(let o=1;o<e.length;o+=2)a.push([e[o],e[o+1]]);return a}xl.resolveBlockScalar=Hm});var eo=w(Rl=>{"use strict";var Za=j(),Lm=xt();function Mm(t,e,i){let{offset:r,type:n,source:a,end:o}=t,s,c,l=(f,p,g)=>i(r+f,p,g);switch(n){case"scalar":s=Za.Scalar.PLAIN,c=Fm(a,l);break;case"single-quoted-scalar":s=Za.Scalar.QUOTE_SINGLE,c=Vm(a,l);break;case"double-quoted-scalar":s=Za.Scalar.QUOTE_DOUBLE,c=qm(a,l);break;default:return i(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=Lm.resolveEnd(o,u,e,i);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Fm(t,e){let i="";switch(t[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${t[0]}`;break}case"@":case"`":{i=`reserved character ${t[0]}`;break}}return i&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Cl(t)}function Vm(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Cl(t.slice(1,-1)).replace(/''/g,"'")}function Cl(t){let e,i;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
88
  `,"sy"),i=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
- `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let r=n[1],a=" ",o=e.lastIndex;for(i.lastIndex=o;n=i.exec(t);)n[1]===""?a===`
90
- `?r+=a:a=`
91
- `:(r+=a+n[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,n=s.exec(t),r+a+(n?.[1]??"")}function Oh(t,e){let i="";for(let n=1;n<t.length-1;++n){let r=t[n];if(!(r==="\r"&&t[n+1]===`
92
- `))if(r===`
93
- `){let{fold:a,offset:o}=jh(t,n);i+=a,n=o}else if(r==="\\"){let a=t[++n],o=Hh[a];if(o)i+=o;else if(a===`
94
- `)for(a=t[n+1];a===" "||a===" ";)a=t[++n+1];else if(a==="\r"&&t[n+1]===`
95
- `)for(a=t[++n+1];a===" "||a===" ";)a=t[++n+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=$h(t,n+1,s,e),n+=s}else{let s=t.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(r===" "||r===" "){let a=n,o=t[n+1];for(;o===" "||o===" ";)o=t[++n+1];o!==`
96
- `&&!(o==="\r"&&t[n+2]===`
97
- `)&&(i+=n>a?t.slice(a,n+1):r)}else i+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),i}function jh(t,e){let i="",n=t[e+1];for(;(n===" "||n===" "||n===`
98
- `||n==="\r")&&!(n==="\r"&&t[e+2]!==`
99
- `);)n===`
89
+ `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let n=r[1],a=" ",o=e.lastIndex;for(i.lastIndex=o;r=i.exec(t);)r[1]===""?a===`
90
+ `?n+=a:a=`
91
+ `:(n+=a+r[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(t),n+a+(r?.[1]??"")}function qm(t,e){let i="";for(let r=1;r<t.length-1;++r){let n=t[r];if(!(n==="\r"&&t[r+1]===`
92
+ `))if(n===`
93
+ `){let{fold:a,offset:o}=Wm(t,r);i+=a,r=o}else if(n==="\\"){let a=t[++r],o=zm[a];if(o)i+=o;else if(a===`
94
+ `)for(a=t[r+1];a===" "||a===" ";)a=t[++r+1];else if(a==="\r"&&t[r+1]===`
95
+ `)for(a=t[++r+1];a===" "||a===" ";)a=t[++r+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=Jm(t,r+1,s,e),r+=s}else{let s=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(n===" "||n===" "){let a=r,o=t[r+1];for(;o===" "||o===" ";)o=t[++r+1];o!==`
96
+ `&&!(o==="\r"&&t[r+2]===`
97
+ `)&&(i+=r>a?t.slice(a,r+1):n)}else i+=n}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),i}function Wm(t,e){let i="",r=t[e+1];for(;(r===" "||r===" "||r===`
98
+ `||r==="\r")&&!(r==="\r"&&t[e+2]!==`
99
+ `);)r===`
100
100
  `&&(i+=`
101
- `),e+=1,n=t[e+1];return i||(i=" "),{fold:i,offset:e}}var Hh={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function $h(t,e,i,n){let r=t.substr(e,i),o=r.length===i&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let s=t.substr(e-2,i+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}sc.resolveFlowScalar=Th});var uc=w(lc=>{"use strict";var xe=C(),cc=T(),Lh=Kr(),Fh=Yr();function Mh(t,e,i,n){let{value:r,type:a,comment:o,range:s}=e.type==="block-scalar"?Lh.resolveBlockScalar(t,e,n):Fh.resolveFlowScalar(e,t.options.strict,n),c=i?t.directives.tagName(i.source,u=>n(i,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[xe.SCALAR]:c?l=Bh(t.schema,r,c,i,n):e.type==="scalar"?l=Dh(t,r,e,n):l=t.schema[xe.SCALAR];let d;try{let u=l.resolve(r,f=>n(i??e,"TAG_RESOLVE_FAILED",f),t.options);d=xe.isScalar(u)?u:new cc.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);n(i??e,"TAG_RESOLVE_FAILED",f),d=new cc.Scalar(r)}return d.range=s,d.source=r,a&&(d.type=a),c&&(d.tag=c),l.format&&(d.format=l.format),o&&(d.comment=o),d}function Bh(t,e,i,n,r){if(i==="!")return t[xe.SCALAR];let a=[];for(let s of t.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(e))return s;let o=t.knownTags[i];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),t[xe.SCALAR])}function Dh({atKey:t,directives:e,schema:i},n,r,a){let o=i.tags.find(s=>(s.default===!0||t&&s.default==="key")&&s.test?.test(n))||i[xe.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(n))??i[xe.SCALAR];if(o.tag!==s.tag){let c=e.tagString(o.tag),l=e.tagString(s.tag),d=`Value may be parsed as either ${c} or ${l}`;a(r,"TAG_RESOLVE_FAILED",d,!0)}}return o}lc.composeScalar=Mh});var dc=w(fc=>{"use strict";function qh(t,e,i){if(e){i??(i=e.length);for(let n=i-1;n>=0;--n){let r=e[n];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++n];r?.type==="space";)t+=r.source.length,r=e[++n];break}}return t}fc.emptyScalarPosition=qh});var mc=w(Qr=>{"use strict";var Vh=ht(),Wh=C(),zh=rc(),hc=uc(),Jh=Qe(),Gh=dc(),Kh={composeNode:pc,composeEmptyNode:Xr};function pc(t,e,i,n){let r=t.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,d=!0;switch(e.type){case"alias":l=Uh(t,e,n),(s||c)&&n(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=hc.composeScalar(t,e,c,n),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=zh.composeCollection(Kh,t,e,i,n),s&&(l.anchor=s.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",u),d=!1}}return l??(l=Xr(t,e.offset,void 0,null,i,n)),s&&l.anchor===""&&n(s,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!Wh.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&d&&(l.srcToken=e),l}function Xr(t,e,i,n,{spaceBefore:r,comment:a,anchor:o,tag:s,end:c},l){let d={type:"scalar",offset:Gh.emptyScalarPosition(e,i,n),indent:-1,source:""},u=hc.composeScalar(t,d,s,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),a&&(u.comment=a,u.range[2]=c),u}function Uh({options:t},{offset:e,source:i,end:n},r){let a=new Vh.Alias(i.substring(1));a.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&r(e+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+i.length,s=Jh.resolveEnd(n,o,t.strict,r);return a.range=[e,o,s.offset],s.comment&&(a.comment=s.comment),a}Qr.composeEmptyNode=Xr;Qr.composeNode=pc});var wc=w(gc=>{"use strict";var Yh=xt(),vc=mc(),Xh=Qe(),Qh=Ot();function Zh(t,e,{offset:i,start:n,value:r,end:a},o){let s=Object.assign({_directives:e},t),c=new Yh.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Qh.resolveProps(n,{indicator:"doc-start",next:r??a?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?vc.composeNode(l,r,d,o):vc.composeEmptyNode(l,d.end,n,null,d,o);let u=c.contents.range[2],f=Xh.resolveEnd(a,u,!1,o);return f.comment&&(c.comment=f.comment),c.range=[i,u,f.offset],c}gc.composeDoc=Zh});var ea=w(bc=>{"use strict";var ep=Qt("process"),tp=Mn(),ip=xt(),jt=_t(),yc=C(),np=wc(),rp=Qe();function Ht(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:i}=t;return[e,e+(typeof i=="string"?i.length:1)]}function Nc(t){let e="",i=!1,n=!1;for(let r=0;r<t.length;++r){let a=t[r];switch(a[0]){case"#":e+=(e===""?"":n?`
101
+ `),e+=1,r=t[e+1];return i||(i=" "),{fold:i,offset:e}}var zm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Jm(t,e,i,r){let n=t.substr(e,i),o=n.length===i&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(o)}catch{let s=t.substr(e-2,i+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Rl.resolveFlowScalar=Mm});var Tl=w(_l=>{"use strict";var it=P(),Al=j(),Gm=Qa(),Um=eo();function Km(t,e,i,r){let{value:n,type:a,comment:o,range:s}=e.type==="block-scalar"?Gm.resolveBlockScalar(t,e,r):Um.resolveFlowScalar(e,t.options.strict,r),c=i?t.directives.tagName(i.source,d=>r(i,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[it.SCALAR]:c?l=Ym(t.schema,n,c,i,r):e.type==="scalar"?l=Xm(t,n,e,r):l=t.schema[it.SCALAR];let u;try{let d=l.resolve(n,f=>r(i??e,"TAG_RESOLVE_FAILED",f),t.options);u=it.isScalar(d)?d:new Al.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);r(i??e,"TAG_RESOLVE_FAILED",f),u=new Al.Scalar(n)}return u.range=s,u.source=n,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Ym(t,e,i,r,n){if(i==="!")return t[it.SCALAR];let a=[];for(let s of t.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(e))return s;let o=t.knownTags[i];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),t[it.SCALAR])}function Xm({atKey:t,directives:e,schema:i},r,n,a){let o=i.tags.find(s=>(s.default===!0||t&&s.default==="key")&&s.test?.test(r))||i[it.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(r))??i[it.SCALAR];if(o.tag!==s.tag){let c=e.tagString(o.tag),l=e.tagString(s.tag),u=`Value may be parsed as either ${c} or ${l}`;a(n,"TAG_RESOLVE_FAILED",u,!0)}}return o}_l.composeScalar=Km});var jl=w(Il=>{"use strict";function Qm(t,e,i){if(e){i??(i=e.length);for(let r=i-1;r>=0;--r){let n=e[r];switch(n.type){case"space":case"comment":case"newline":t-=n.source.length;continue}for(n=e[++r];n?.type==="space";)t+=n.source.length,n=e[++r];break}}return t}Il.emptyScalarPosition=Qm});var Hl=w(io=>{"use strict";var Zm=zt(),ev=P(),tv=Pl(),$l=Tl(),iv=xt(),rv=jl(),nv={composeNode:Ol,composeEmptyNode:to};function Ol(t,e,i,r){let n=t.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,u=!0;switch(e.type){case"alias":l=av(t,e,r),(s||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=$l.composeScalar(t,e,c,r),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=tv.composeCollection(nv,t,e,i,r),s&&(l.anchor=s.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);r(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=to(t,e.offset,void 0,null,i,r)),s&&l.anchor===""&&r(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&t.options.stringKeys&&(!ev.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function to(t,e,i,r,{spaceBefore:n,comment:a,anchor:o,tag:s,end:c},l){let u={type:"scalar",offset:rv.emptyScalarPosition(e,i,r),indent:-1,source:""},d=$l.composeScalar(t,u,s,l);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(d.spaceBefore=!0),a&&(d.comment=a,d.range[2]=c),d}function av({options:t},{offset:e,source:i,end:r},n){let a=new Zm.Alias(i.substring(1));a.source===""&&n(e,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&n(e+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+i.length,s=iv.resolveEnd(r,o,t.strict,n);return a.range=[e,o,s.offset],s.comment&&(a.comment=s.comment),a}io.composeEmptyNode=to;io.composeNode=Ol});var Ll=w(Bl=>{"use strict";var ov=si(),Dl=Hl(),sv=xt(),cv=di();function lv(t,e,{offset:i,start:r,value:n,end:a},o){let s=Object.assign({_directives:e},t),c=new ov.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=cv.resolveProps(r,{indicator:"doc-start",next:n??a?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?Dl.composeNode(l,n,u,o):Dl.composeEmptyNode(l,u.end,r,null,u,o);let d=c.contents.range[2],f=sv.resolveEnd(a,d,!1,o);return f.comment&&(c.comment=f.comment),c.range=[i,d,f.offset],c}Bl.composeDoc=lv});var no=w(Vl=>{"use strict";var uv=Hi("process"),dv=qn(),fv=si(),fi=ui(),Ml=P(),hv=Ll(),pv=xt();function hi(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:i}=t;return[e,e+(typeof i=="string"?i.length:1)]}function Fl(t){let e="",i=!1,r=!1;for(let n=0;n<t.length;++n){let a=t[n];switch(a[0]){case"#":e+=(e===""?"":r?`
103
103
 
104
104
  `:`
105
- `)+(a.substring(1)||" "),i=!0,n=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),i=!1;break;default:i||(n=!0),i=!1}}return{comment:e,afterEmptyLine:n}}var Zr=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,n,r,a)=>{let o=Ht(i);a?this.warnings.push(new jt.YAMLWarning(o,n,r)):this.errors.push(new jt.YAMLParseError(o,n,r))},this.directives=new tp.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,i){let{comment:n,afterEmptyLine:r}=Nc(this.prelude);if(n){let a=e.contents;if(i)e.comment=e.comment?`${e.comment}
106
- ${n}`:n;else if(r||e.directives.docStart||!a)e.commentBefore=n;else if(yc.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];yc.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${n}
107
- ${s}`:n}else{let o=a.commentBefore;a.commentBefore=o?`${n}
108
- ${o}`:n}}if(i){for(let a=0;a<this.errors.length;++a)e.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)e.warnings.push(this.warnings[a])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Nc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,i=!1,n=-1){for(let r of e)yield*this.next(r);yield*this.end(i,n)}*next(e){switch(ep.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(i,n,r)=>{let a=Ht(e);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let i=np.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let i=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new jt.YAMLParseError(Ht(e),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new jt.YAMLParseError(Ht(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let i=rp.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
109
- ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new jt.YAMLParseError(Ht(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),r=new ip.Document(void 0,n);this.atDirectives&&this.onError(i,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,i,i],this.decorate(r,!1),yield r}}};bc.Composer=Zr});var Ec=w(Vi=>{"use strict";var ap=Kr(),op=Yr(),sp=_t(),kc=wt();function cp(t,e=!0,i){if(t){let n=(r,a,o)=>{let s=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(i)i(s,a,o);else throw new sp.YAMLParseError([s,s+1],a,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return op.resolveFlowScalar(t,e,n);case"block-scalar":return ap.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function lp(t,e){let{implicitKey:i=!1,indent:n,inFlow:r=!1,offset:a=-1,type:o="PLAIN"}=e,s=kc.stringifyString({type:o,value:t},{implicitKey:i,indent:n>0?" ".repeat(n):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:`
105
+ `)+(a.substring(1)||" "),i=!0,r=!1;break;case"%":t[n+1]?.[0]!=="#"&&(n+=1),i=!1;break;default:i||(r=!0),i=!1}}return{comment:e,afterEmptyLine:r}}var ro=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,r,n,a)=>{let o=hi(i);a?this.warnings.push(new fi.YAMLWarning(o,r,n)):this.errors.push(new fi.YAMLParseError(o,r,n))},this.directives=new dv.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,i){let{comment:r,afterEmptyLine:n}=Fl(this.prelude);if(r){let a=e.contents;if(i)e.comment=e.comment?`${e.comment}
106
+ ${r}`:r;else if(n||e.directives.docStart||!a)e.commentBefore=r;else if(Ml.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];Ml.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${r}
107
+ ${s}`:r}else{let o=a.commentBefore;a.commentBefore=o?`${r}
108
+ ${o}`:r}}if(i){for(let a=0;a<this.errors.length;++a)e.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)e.warnings.push(this.warnings[a])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Fl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,i=!1,r=-1){for(let n of e)yield*this.next(n);yield*this.end(i,r)}*next(e){switch(uv.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(i,r,n)=>{let a=hi(e);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",r,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let i=hv.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let i=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new fi.YAMLParseError(hi(e),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new fi.YAMLParseError(hi(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let i=pv.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
109
+ ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new fi.YAMLParseError(hi(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),n=new fv.Document(void 0,r);this.atDirectives&&this.onError(i,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,i,i],this.decorate(n,!1),yield n}}};Vl.Composer=ro});var zl=w(Rr=>{"use strict";var mv=Qa(),vv=eo(),gv=ui(),ql=Yt();function wv(t,e=!0,i){if(t){let r=(n,a,o)=>{let s=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(i)i(s,a,o);else throw new gv.YAMLParseError([s,s+1],a,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return vv.resolveFlowScalar(t,e,r);case"block-scalar":return mv.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function yv(t,e){let{implicitKey:i=!1,indent:r,inFlow:n=!1,offset:a=-1,type:o="PLAIN"}=e,s=ql.stringifyString({type:o,value:t},{implicitKey:i,indent:r>0?" ".repeat(r):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
110
110
  `}];switch(s[0]){case"|":case">":{let l=s.indexOf(`
111
- `),d=s.substring(0,l),u=s.substring(l+1)+`
112
- `,f=[{type:"block-scalar-header",offset:a,indent:n,source:d}];return Sc(f,c)||f.push({type:"newline",offset:-1,indent:n,source:`
113
- `}),{type:"block-scalar",offset:a,indent:n,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:a,indent:n,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:n,source:s,end:c};default:return{type:"scalar",offset:a,indent:n,source:s,end:c}}}function up(t,e,i={}){let{afterKey:n=!1,implicitKey:r=!1,inFlow:a=!1,type:o}=i,s="indent"in t?t.indent:null;if(n&&typeof s=="number"&&(s+=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=kc.stringifyString({type:o,value:e},{implicitKey:r||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":fp(t,c);break;case'"':ta(t,c,"double-quoted-scalar");break;case"'":ta(t,c,"single-quoted-scalar");break;default:ta(t,c,"scalar")}}function fp(t,e){let i=e.indexOf(`
114
- `),n=e.substring(0,i),r=e.substring(i+1)+`
115
- `;if(t.type==="block-scalar"){let a=t.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=n,t.source=r}else{let{offset:a}=t,o="indent"in t?t.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:n}];Sc(s,"end"in t?t.end:void 0)||s.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:s,source:r})}}function Sc(t,e){if(e)for(let i of e)switch(i.type){case"space":case"comment":t.push(i);break;case"newline":return t.push(i),!0}return!1}function ta(t,e,i){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=i,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let a of n)a.offset+=r;delete t.props,Object.assign(t,{type:i,source:e,end:n});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:i,source:e,end:[r]});break}default:{let n="indent"in t?t.indent:-1,r="end"in t&&Array.isArray(t.end)?t.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(t))a!=="type"&&a!=="offset"&&delete t[a];Object.assign(t,{type:i,indent:n,source:e,end:r})}}}Vi.createScalarToken=lp;Vi.resolveAsScalar=cp;Vi.setScalarValue=up});var Rc=w(Cc=>{"use strict";var dp=t=>"type"in t?zi(t):Wi(t);function zi(t){switch(t.type){case"block-scalar":{let e="";for(let i of t.props)e+=zi(i);return e+t.source}case"block-map":case"block-seq":{let e="";for(let i of t.items)e+=Wi(i);return e}case"flow-collection":{let e=t.start.source;for(let i of t.items)e+=Wi(i);for(let i of t.end)e+=i.source;return e}case"document":{let e=Wi(t);if(t.end)for(let i of t.end)e+=i.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let i of t.end)e+=i.source;return e}}}function Wi({start:t,key:e,sep:i,value:n}){let r="";for(let a of t)r+=a.source;if(e&&(r+=zi(e)),i)for(let a of i)r+=a.source;return n&&(r+=zi(n)),r}Cc.stringify=dp});var Tc=w(xc=>{"use strict";var ia=Symbol("break visit"),hp=Symbol("skip children"),Pc=Symbol("remove item");function Te(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Ac(Object.freeze([]),t,e)}Te.BREAK=ia;Te.SKIP=hp;Te.REMOVE=Pc;Te.itemAtPath=(t,e)=>{let i=t;for(let[n,r]of e){let a=i?.[n];if(a&&"items"in a)i=a.items[r];else return}return i};Te.parentCollection=(t,e)=>{let i=Te.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],r=i?.[n];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function Ac(t,e,i){let n=i(e,t);if(typeof n=="symbol")return n;for(let r of["key","value"]){let a=e[r];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=Ac(Object.freeze(t.concat([[r,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===ia)return ia;s===Pc&&(a.items.splice(o,1),o-=1)}}typeof n=="function"&&r==="key"&&(n=n(e,t))}}return typeof n=="function"?n(e,t):n}xc.visit=Te});var Ji=w(L=>{"use strict";var na=Ec(),pp=Rc(),mp=Tc(),ra="\uFEFF",aa="",oa="",sa="",vp=t=>!!t&&"items"in t,gp=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function wp(t){switch(t){case ra:return"<BOM>";case aa:return"<DOC>";case oa:return"<FLOW_END>";case sa:return"<SCALAR>";default:return JSON.stringify(t)}}function yp(t){switch(t){case ra:return"byte-order-mark";case aa:return"doc-mode";case oa:return"flow-error-end";case sa:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
111
+ `),u=s.substring(0,l),d=s.substring(l+1)+`
112
+ `,f=[{type:"block-scalar-header",offset:a,indent:r,source:u}];return Wl(f,c)||f.push({type:"newline",offset:-1,indent:r,source:`
113
+ `}),{type:"block-scalar",offset:a,indent:r,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:a,indent:r,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:r,source:s,end:c};default:return{type:"scalar",offset:a,indent:r,source:s,end:c}}}function Nv(t,e,i={}){let{afterKey:r=!1,implicitKey:n=!1,inFlow:a=!1,type:o}=i,s="indent"in t?t.indent:null;if(r&&typeof s=="number"&&(s+=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=ql.stringifyString({type:o,value:e},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":bv(t,c);break;case'"':ao(t,c,"double-quoted-scalar");break;case"'":ao(t,c,"single-quoted-scalar");break;default:ao(t,c,"scalar")}}function bv(t,e){let i=e.indexOf(`
114
+ `),r=e.substring(0,i),n=e.substring(i+1)+`
115
+ `;if(t.type==="block-scalar"){let a=t.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=r,t.source=n}else{let{offset:a}=t,o="indent"in t?t.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:r}];Wl(s,"end"in t?t.end:void 0)||s.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:s,source:n})}}function Wl(t,e){if(e)for(let i of e)switch(i.type){case"space":case"comment":t.push(i);break;case"newline":return t.push(i),!0}return!1}function ao(t,e,i){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=i,t.source=e;break;case"block-scalar":{let r=t.props.slice(1),n=e.length;t.props[0].type==="block-scalar-header"&&(n-=t.props[0].source.length);for(let a of r)a.offset+=n;delete t.props,Object.assign(t,{type:i,source:e,end:r});break}case"block-map":case"block-seq":{let n={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
+ `};delete t.items,Object.assign(t,{type:i,source:e,end:[n]});break}default:{let r="indent"in t?t.indent:-1,n="end"in t&&Array.isArray(t.end)?t.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(t))a!=="type"&&a!=="offset"&&delete t[a];Object.assign(t,{type:i,indent:r,source:e,end:n})}}}Rr.createScalarToken=yv;Rr.resolveAsScalar=wv;Rr.setScalarValue=Nv});var Gl=w(Jl=>{"use strict";var kv=t=>"type"in t?_r(t):Ar(t);function _r(t){switch(t.type){case"block-scalar":{let e="";for(let i of t.props)e+=_r(i);return e+t.source}case"block-map":case"block-seq":{let e="";for(let i of t.items)e+=Ar(i);return e}case"flow-collection":{let e=t.start.source;for(let i of t.items)e+=Ar(i);for(let i of t.end)e+=i.source;return e}case"document":{let e=Ar(t);if(t.end)for(let i of t.end)e+=i.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let i of t.end)e+=i.source;return e}}}function Ar({start:t,key:e,sep:i,value:r}){let n="";for(let a of t)n+=a.source;if(e&&(n+=_r(e)),i)for(let a of i)n+=a.source;return r&&(n+=_r(r)),n}Jl.stringify=kv});var Xl=w(Yl=>{"use strict";var oo=Symbol("break visit"),Sv=Symbol("skip children"),Ul=Symbol("remove item");function rt(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Kl(Object.freeze([]),t,e)}rt.BREAK=oo;rt.SKIP=Sv;rt.REMOVE=Ul;rt.itemAtPath=(t,e)=>{let i=t;for(let[r,n]of e){let a=i?.[r];if(a&&"items"in a)i=a.items[n];else return}return i};rt.parentCollection=(t,e)=>{let i=rt.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],n=i?.[r];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function Kl(t,e,i){let r=i(e,t);if(typeof r=="symbol")return r;for(let n of["key","value"]){let a=e[n];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=Kl(Object.freeze(t.concat([[n,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===oo)return oo;s===Ul&&(a.items.splice(o,1),o-=1)}}typeof r=="function"&&n==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}Yl.visit=rt});var Tr=w(W=>{"use strict";var so=zl(),Ev=Gl(),Pv=Xl(),co="\uFEFF",lo="",uo="",fo="",xv=t=>!!t&&"items"in t,Cv=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Rv(t){switch(t){case co:return"<BOM>";case lo:return"<DOC>";case uo:return"<FLOW_END>";case fo:return"<SCALAR>";default:return JSON.stringify(t)}}function Av(t){switch(t){case co:return"byte-order-mark";case lo:return"doc-mode";case uo:return"flow-error-end";case fo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
118
118
  `:case`\r
119
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}L.createScalarToken=na.createScalarToken;L.resolveAsScalar=na.resolveAsScalar;L.setScalarValue=na.setScalarValue;L.stringify=pp.stringify;L.visit=mp.visit;L.BOM=ra;L.DOCUMENT=aa;L.FLOW_END=oa;L.SCALAR=sa;L.isCollection=vp;L.isScalar=gp;L.prettyToken=wp;L.tokenType=yp});var ua=w(_c=>{"use strict";var $t=Ji();function z(t){switch(t){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var Ic=new Set("0123456789ABCDEFabcdef"),Np=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Gi=new Set(",[]{}"),bp=new Set(` ,[]{}
121
- \r `),ca=t=>!t||bp.has(t),la=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,i=!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=!i;let n=this.next??"stream";for(;n&&(i||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,i=this.buffer[e];for(;i===" "||i===" ";)i=this.buffer[++e];return!i||i==="#"||i===`
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}W.createScalarToken=so.createScalarToken;W.resolveAsScalar=so.resolveAsScalar;W.setScalarValue=so.setScalarValue;W.stringify=Ev.stringify;W.visit=Pv.visit;W.BOM=co;W.DOCUMENT=lo;W.FLOW_END=uo;W.SCALAR=fo;W.isCollection=xv;W.isScalar=Cv;W.prettyToken=Rv;W.tokenType=Av});var mo=w(Zl=>{"use strict";var pi=Tr();function ae(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var Ql=new Set("0123456789ABCDEFabcdef"),_v=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ir=new Set(",[]{}"),Tv=new Set(` ,[]{}
121
+ \r `),ho=t=>!t||Tv.has(t),po=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,i=!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=!i;let r=this.next??"stream";for(;r&&(i||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,i=this.buffer[e];for(;i===" "||i===" ";)i=this.buffer[++e];return!i||i==="#"||i===`
122
122
  `?!0:i==="\r"?this.buffer[e+1]===`
123
- `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let i=this.buffer[e];if(this.indentNext>0){let n=0;for(;i===" ";)i=this.buffer[++n+e];if(i==="\r"){let r=this.buffer[n+e+1];if(r===`
124
- `||!r&&!this.atEnd)return e+n+1}return i===`
125
- `||n>=this.indentNext||!i&&!this.atEnd?e+n:-1}if(i==="-"||i==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&z(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]===$t.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let i=e.length,n=e.indexOf("#");for(;n!==-1;){let a=e[n-1];if(a===" "||a===" "){i=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let a=e[i-1];if(a===" "||a===" ")i-=1;else break}let r=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-i),yield*this.pushNewline(),"stream"}return yield $t.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 i=this.peek(3);if((i==="---"||i==="...")&&z(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,i==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!z(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&z(i)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(e[i]){case"#":yield*this.pushCount(e.length-i);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(ca),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,i,n=-1;do e=yield*this.pushNewline(),e>0?(i=yield*this.pushSpaces(!1),this.indentValue=n=i):i=0,i+=yield*this.pushSpaces(!0);while(e+i>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&r[0]!=="#"||n===0&&(r.startsWith("---")||r.startsWith("..."))&&z(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield $t.FLOW_END,yield*this.parseLineStart();let a=0;for(;r[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),r[a]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-a),"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(ca),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||z(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),i=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let a=0;for(;this.buffer[i-1-a]==="\\";)a+=1;if(a%2===0)break;i=this.buffer.indexOf('"',i+1)}let n=this.buffer.substring(0,i),r=n.indexOf(`
127
- `,this.pos);if(r!==-1){for(;r!==-1;){let a=this.continueScalar(r+1);if(a===-1)break;r=n.indexOf(`
128
- `,a)}r!==-1&&(i=r-(n[r-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let i=this.buffer[++e];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>z(i)||i==="#")}*parseBlockScalar(){let e=this.pos-1,i=0,n;e:for(let a=this.pos;n=this.buffer[a];++a)switch(n){case" ":i+=1;break;case`
123
+ `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let i=this.buffer[e];if(this.indentNext>0){let r=0;for(;i===" ";)i=this.buffer[++r+e];if(i==="\r"){let n=this.buffer[r+e+1];if(n===`
124
+ `||!n&&!this.atEnd)return e+r+1}return i===`
125
+ `||r>=this.indentNext||!i&&!this.atEnd?e+r:-1}if(i==="-"||i==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&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]===pi.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let i=e.length,r=e.indexOf("#");for(;r!==-1;){let a=e[r-1];if(a===" "||a===" "){i=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let a=e[i-1];if(a===" "||a===" ")i-=1;else break}let n=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-i),yield*this.pushNewline(),"stream"}return yield pi.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 i=this.peek(3);if((i==="---"||i==="...")&&ae(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,i==="---"?"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,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ae(i)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(e[i]){case"#":yield*this.pushCount(e.length-i);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(ho),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,i,r=-1;do e=yield*this.pushNewline(),e>0?(i=yield*this.pushSpaces(!1),this.indentValue=r=i):i=0,i+=yield*this.pushSpaces(!0);while(e+i>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&n[0]!=="#"||r===0&&(n.startsWith("---")||n.startsWith("..."))&&ae(n[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield pi.FLOW_END,yield*this.parseLineStart();let a=0;for(;n[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),n[a]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-a),"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(ho),"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),i=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let a=0;for(;this.buffer[i-1-a]==="\\";)a+=1;if(a%2===0)break;i=this.buffer.indexOf('"',i+1)}let r=this.buffer.substring(0,i),n=r.indexOf(`
127
+ `,this.pos);if(n!==-1){for(;n!==-1;){let a=this.continueScalar(n+1);if(a===-1)break;n=r.indexOf(`
128
+ `,a)}n!==-1&&(i=n-(r[n-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let i=this.buffer[++e];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>ae(i)||i==="#")}*parseBlockScalar(){let e=this.pos-1,i=0,r;e:for(let a=this.pos;r=this.buffer[a];++a)switch(r){case" ":i+=1;break;case`
129
129
  `:e=a,i=0;break;case"\r":{let o=this.buffer[a+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
130
- `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(i>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=i:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(e+1);if(a===-1)break;e=this.buffer.indexOf(`
131
- `,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===" ";)n=this.buffer[++r];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
132
- `;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let a=e-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);let s=a;for(;o===" ";)o=this.buffer[--a];if(o===`
133
- `&&a>=this.pos&&a+1+i>s)e=a;else break}while(!0);return yield $t.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,i=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===":"){let a=this.buffer[n+1];if(z(a)||e&&Gi.has(a))break;i=n}else if(z(r)){let a=this.buffer[n+1];if(r==="\r"&&(a===`
134
- `?(n+=1,r=`
135
- `,a=this.buffer[n+1]):i=n),a==="#"||e&&Gi.has(a))break;if(r===`
136
- `){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&Gi.has(r))break;i=n}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield $t.SCALAR,yield*this.pushToIndex(i+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,i){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(i&&(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(ca),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,n=this.charAt(1);if(z(n)||i&&Gi.has(n)){i?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,i=this.buffer[e];for(;!z(i)&&i!==">";)i=this.buffer[++e];return yield*this.pushToIndex(i===">"?e+1:e,!1)}else{let e=this.pos+1,i=this.buffer[e];for(;i;)if(Np.has(i))i=this.buffer[++e];else if(i==="%"&&Ic.has(this.buffer[e+1])&&Ic.has(this.buffer[e+2]))i=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
130
+ `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(i>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=i:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(e+1);if(a===-1)break;e=this.buffer.indexOf(`
131
+ `,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let n=e+1;for(r=this.buffer[n];r===" ";)r=this.buffer[++n];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
132
+ `;)r=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let a=e-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);let s=a;for(;o===" ";)o=this.buffer[--a];if(o===`
133
+ `&&a>=this.pos&&a+1+i>s)e=a;else break}while(!0);return yield pi.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,i=this.pos-1,r=this.pos-1,n;for(;n=this.buffer[++r];)if(n===":"){let a=this.buffer[r+1];if(ae(a)||e&&Ir.has(a))break;i=r}else if(ae(n)){let a=this.buffer[r+1];if(n==="\r"&&(a===`
134
+ `?(r+=1,n=`
135
+ `,a=this.buffer[r+1]):i=r),a==="#"||e&&Ir.has(a))break;if(n===`
136
+ `){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&Ir.has(n))break;i=r}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield pi.SCALAR,yield*this.pushToIndex(i+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,i){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(i&&(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(ho),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,r=this.charAt(1);if(ae(r)||i&&Ir.has(r)){i?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,i=this.buffer[e];for(;!ae(i)&&i!==">";)i=this.buffer[++e];return yield*this.pushToIndex(i===">"?e+1:e,!1)}else{let e=this.pos+1,i=this.buffer[e];for(;i;)if(_v.has(i))i=this.buffer[++e];else if(i==="%"&&Ql.has(this.buffer[e+1])&&Ql.has(this.buffer[e+2]))i=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
137
137
  `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
138
- `?yield*this.pushCount(2):0}*pushSpaces(e){let i=this.pos-1,n;do n=this.buffer[++i];while(n===" "||e&&n===" ");let r=i-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=i),r}*pushUntil(e){let i=this.pos,n=this.buffer[i];for(;!e(n);)n=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};_c.Lexer=la});var da=w(Oc=>{"use strict";var fa=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let i=0,n=this.lineStarts.length;for(;i<n;){let a=i+n>>1;this.lineStarts[a]<e?i=a+1:n=a}if(this.lineStarts[i]===e)return{line:i+1,col:1};if(i===0)return{line:0,col:e};let r=this.lineStarts[i-1];return{line:i,col:e-r+1}}}};Oc.LineCounter=fa});var pa=w(Fc=>{"use strict";var kp=Qt("process"),jc=Ji(),Sp=ua();function ge(t,e){for(let i=0;i<t.length;++i)if(t[i].type===e)return!0;return!1}function Hc(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 Lc(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 Ki(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 Ze(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 Ui(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let i=0;i<e.length;++i)t.push(e[i])}function $c(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!ge(e.start,"explicit-key-ind")&&!ge(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Lc(e.value)?e.value.end?Ui(e.value.end,e.sep):e.value.end=e.sep:Ui(e.start,e.sep),delete e.sep)}var ha=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 Sp.Lexer,this.onNewLine=e}*parse(e,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,i))yield*this.next(n);i||(yield*this.end())}*next(e){if(this.source=e,kp.env.LOG_TOKENS&&console.log("|",jc.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let i=jc.tokenType(e);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){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 n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,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 i=e??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let n=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in n?n.indent:0:i.type==="flow-collection"&&n.type==="document"&&(i.indent=0),i.type==="flow-collection"&&$c(i),n.type){case"document":n.value=i;break;case"block-scalar":n.props.push(i);break;case"block-map":{let r=n.items[n.items.length-1];if(r.value){n.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=i;else{Object.assign(r,{key:i,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=n.items[n.items.length-1];r.value?n.items.push({start:[],value:i}):r.value=i;break}case"flow-collection":{let r=n.items[n.items.length-1];!r||r.value?n.items.push({start:[],key:i,sep:[]}):r.sep?r.value=i:Object.assign(r,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){let r=i.items[i.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&Hc(r.start)===-1&&(i.indent===0||r.start.every(a=>a.type!=="comment"||a.indent<i.indent))&&(n.type==="document"?n.end=r.start:n.items.push({start:r.start}),i.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":{Hc(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 i=this.startBlockValue(e);i?this.stack.push(i):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 i=Ki(this.peek(2)),n=Ze(i),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}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 i=this.source.indexOf(`
138
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let i=this.pos-1,r;do r=this.buffer[++i];while(r===" "||e&&r===" ");let n=i-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=i),n}*pushUntil(e){let i=this.pos,r=this.buffer[i];for(;!e(r);)r=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};Zl.Lexer=po});var go=w(eu=>{"use strict";var vo=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let i=0,r=this.lineStarts.length;for(;i<r;){let a=i+r>>1;this.lineStarts[a]<e?i=a+1:r=a}if(this.lineStarts[i]===e)return{line:i+1,col:1};if(i===0)return{line:0,col:e};let n=this.lineStarts[i-1];return{line:i,col:e-n+1}}}};eu.LineCounter=vo});var yo=w(au=>{"use strict";var Iv=Hi("process"),tu=Tr(),jv=mo();function We(t,e){for(let i=0;i<t.length;++i)if(t[i].type===e)return!0;return!1}function iu(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 nu(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 jr(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 Ct(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 $r(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let i=0;i<e.length;++i)t.push(e[i])}function ru(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!We(e.start,"explicit-key-ind")&&!We(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,nu(e.value)?e.value.end?$r(e.value.end,e.sep):e.value.end=e.sep:$r(e.start,e.sep),delete e.sep)}var wo=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 jv.Lexer,this.onNewLine=e}*parse(e,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,i))yield*this.next(r);i||(yield*this.end())}*next(e){if(this.source=e,Iv.env.LOG_TOKENS&&console.log("|",tu.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let i=tu.tokenType(e);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let i=e??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let r=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in r?r.indent:0:i.type==="flow-collection"&&r.type==="document"&&(i.indent=0),i.type==="flow-collection"&&ru(i),r.type){case"document":r.value=i;break;case"block-scalar":r.props.push(i);break;case"block-map":{let n=r.items[r.items.length-1];if(n.value){r.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=i;else{Object.assign(n,{key:i,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=r.items[r.items.length-1];n.value?r.items.push({start:[],value:i}):n.value=i;break}case"flow-collection":{let n=r.items[r.items.length-1];!n||n.value?r.items.push({start:[],key:i,sep:[]}):n.sep?n.value=i:Object.assign(n,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){let n=i.items[i.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&iu(n.start)===-1&&(i.indent===0||n.start.every(a=>a.type!=="comment"||a.indent<i.indent))&&(r.type==="document"?r.end=n.start:r.items.push({start:n.start}),i.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":{iu(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 i=this.startBlockValue(e);i?this.stack.push(i):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 i=jr(this.peek(2)),r=Ct(i),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}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 i=this.source.indexOf(`
139
139
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
140
- `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let n="end"in i.value?i.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Ui(r,i.start),r.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",a=[];if(r&&i.sep&&!i.value){let o=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||i.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):r||i.value?(a.push(this.sourceToken),e.items.push({start:a,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(i.explicitKey)if(i.sep)if(i.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ge(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(Lc(i.key)&&!ge(i.sep,"newline")){let o=Ze(i.start),s=i.key,c=i.sep;c.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:c}]})}else a.length>0?i.sep=i.sep.concat(a,this.sourceToken):i.sep.push(this.sourceToken);else if(ge(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=Ze(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||r?e.items.push({start:a,key:null,sep:[this.sourceToken]}):ge(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{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||i.value?(e.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!ge(i.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 n&&e.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(i.value){let n="end"in i.value?i.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Ui(r,i.start),r.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=e.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;i.value||ge(i.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let i=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?e.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!i||i.value?e.items.push({start:[],key:r,sep:[]}):i.sep?this.stack.push(r):Object.assign(i,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let r=Ki(n),a=Ze(r);$c(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:a,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let i=this.source.indexOf(`
140
+ `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){$r(n,i.start),n.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,n=r&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",a=[];if(n&&i.sep&&!i.value){let o=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||i.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):n||i.value?(a.push(this.sourceToken),e.items.push({start:a,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(i.explicitKey)if(i.sep)if(i.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(We(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(nu(i.key)&&!We(i.sep,"newline")){let o=Ct(i.start),s=i.key,c=i.sep;c.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:c}]})}else a.length>0?i.sep=i.sep.concat(a,this.sourceToken):i.sep.push(this.sourceToken);else if(We(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=Ct(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||n?e.items.push({start:a,key:null,sep:[this.sourceToken]}):We(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{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);n||i.value?(e.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!We(i.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){$r(n,i.start),n.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=e.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;i.value||We(i.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let i=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?e.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!i||i.value?e.items.push({start:[],key:n,sep:[]}):i.sep?this.stack.push(n):Object.assign(i,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let n=jr(r),a=Ct(n);ru(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:a,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let i=this.source.indexOf(`
141
141
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
142
- `,i)+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 i=Ki(e),n=Ze(i);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=Ki(e),n=Ze(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!1:e.every(n=>n.type==="newline"||n.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())}}};Fc.Parser=ha});var Vc=w(Ft=>{"use strict";var Mc=ea(),Ep=xt(),Lt=_t(),Cp=Qn(),Rp=C(),Pp=da(),Bc=pa();function Dc(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Pp.LineCounter||null,prettyErrors:e}}function Ap(t,e={}){let{lineCounter:i,prettyErrors:n}=Dc(e),r=new Bc.Parser(i?.addNewLine),a=new Mc.Composer(e),o=Array.from(a.compose(r.parse(t)));if(n&&i)for(let s of o)s.errors.forEach(Lt.prettifyError(t,i)),s.warnings.forEach(Lt.prettifyError(t,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function qc(t,e={}){let{lineCounter:i,prettyErrors:n}=Dc(e),r=new Bc.Parser(i?.addNewLine),a=new Mc.Composer(e),o=null;for(let s of a.compose(r.parse(t),!0,t.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new Lt.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&i&&(o.errors.forEach(Lt.prettifyError(t,i)),o.warnings.forEach(Lt.prettifyError(t,i))),o}function xp(t,e,i){let n;typeof e=="function"?n=e:i===void 0&&e&&typeof e=="object"&&(i=e);let r=qc(t,i);if(!r)return null;if(r.warnings.forEach(a=>Cp.warn(r.options.logLevel,a)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:n},i))}function Tp(t,e,i){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){let r=Math.round(i);i=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=i??e??{};if(!r)return}return Rp.isDocument(t)&&!n?t.toString(i):new Ep.Document(t,n,i).toString(i)}Ft.parse=xp;Ft.parseAllDocuments=Ap;Ft.parseDocument=qc;Ft.stringify=Tp});var Xi=w(P=>{"use strict";var Ip=ea(),_p=xt(),Op=jr(),ma=_t(),jp=ht(),we=C(),Hp=he(),$p=T(),Lp=me(),Fp=ve(),Mp=Ji(),Bp=ua(),Dp=da(),qp=pa(),Yi=Vc(),Wc=lt();P.Composer=Ip.Composer;P.Document=_p.Document;P.Schema=Op.Schema;P.YAMLError=ma.YAMLError;P.YAMLParseError=ma.YAMLParseError;P.YAMLWarning=ma.YAMLWarning;P.Alias=jp.Alias;P.isAlias=we.isAlias;P.isCollection=we.isCollection;P.isDocument=we.isDocument;P.isMap=we.isMap;P.isNode=we.isNode;P.isPair=we.isPair;P.isScalar=we.isScalar;P.isSeq=we.isSeq;P.Pair=Hp.Pair;P.Scalar=$p.Scalar;P.YAMLMap=Lp.YAMLMap;P.YAMLSeq=Fp.YAMLSeq;P.CST=Mp;P.Lexer=Bp.Lexer;P.LineCounter=Dp.LineCounter;P.Parser=qp.Parser;P.parse=Yi.parse;P.parseAllDocuments=Yi.parseAllDocuments;P.parseDocument=Yi.parseDocument;P.stringify=Yi.stringify;P.visit=Wc.visit;P.visitAsync=Wc.visitAsync});import{promises as Gv}from"fs";import st from"path";var ru=null;function au(t,e){let i=t;for(let n of e)i+="\0"+(typeof n=="string"?n:JSON.stringify(n));return i}function Ua(t,e){return(...i)=>{let n=ru;if(n===null)return e(...i);let r=au(`async:${t}`,i),a=n.entries.get(r);if(a)return a.value;let o=e(...i).catch(s=>{throw n.entries.delete(r),s});return n.entries.set(r,{value:o}),o}}import{readFileSync as ou}from"fs";import Ya from"path";var su=new Set(["applypatch","create","createfile","deletefile","edit","editfile","patch","strreplaceeditor","write","writefile","writefiletool"]),cu=new Set(["glob","grep","listfiles","read","readfile","search","view"]),Qa=["file_path","filePath","path","target_file","targetFile"],Za=["file_paths","filePaths","paths","files","targets"],eo=["operations","edits"],lu=["patch","diff","patchText","patch_text","changes"];function Hn(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Xa(t){return t.toLowerCase().replace(/[^a-z0-9]+/gu,"")}function uu(t){for(let e of["tool_name","toolName","tool","name"]){let i=t[e];if(typeof i=="string"&&i.trim())return i.trim()}return null}function fu(t){for(let e of["cwd","working_directory","workspaceRoot"]){let i=t[e];if(!(typeof i!="string"||!i.trim()||!Ya.isAbsolute(i.trim())))return Ya.resolve(i.trim())}}function du(t){if(typeof t!="string")return t;let e=t.trim();if(!e.startsWith("{")&&!e.startsWith("["))return t;try{return JSON.parse(e)}catch{return t}}function hu(t){for(let e of["tool_input","toolInput","toolArgs","tool_args","arguments"])if(t[e]!==void 0)return du(t[e]);return t}function jn(t){let e=[],i=[/^\*\*\* (?:Add|Update|Delete) File:\s+(.+?)\s*$/gmu,/^\+\+\+\s+(?:b\/)?(.+?)\s*$/gmu];for(let n of i)for(let r of t.matchAll(n)){let a=r[1]?.trim();a&&a!=="/dev/null"&&e.push(a)}return e}function Ee(t,e){if(typeof e=="string"){let i=e.trim();i&&t.push(i);return}if(Array.isArray(e)){for(let i of e)Ee(t,i);return}if(Hn(e)){for(let i of Qa)Ee(t,e[i]);for(let i of Za)Ee(t,e[i]);for(let i of eo)Ee(t,e[i])}}function pu(t,e){let i=[],n=[e,t].filter(Hn);for(let r of n){for(let a of Qa)Ee(i,r[a]);for(let a of Za)Ee(i,r[a]);for(let a of eo)Ee(i,r[a]);for(let a of lu){let o=r[a];typeof o=="string"&&i.push(...jn(o))}}return typeof e=="string"&&i.push(...jn(e)),[...new Set(i)]}function ct(t,e){if(e?.trim())return{intent:"write",targets:[e.trim()],toolName:null};if(!t.trim())return{intent:"unknown",targets:[],toolName:null};let i;try{i=JSON.parse(t)}catch{let o=jn(t);return o.length>0?{intent:"write",targets:[...new Set(o)],toolName:"apply_patch"}:{intent:"unknown",targets:[],toolName:null}}if(!Hn(i))return{intent:"unknown",targets:[],toolName:null};let n=uu(i),r=pu(i,hu(i)),a=fu(i);return n&&su.has(Xa(n))?{intent:r.length>0?"write":"unknown",targets:r,toolName:n,...a?{cwd:a}:{}}:n&&cu.has(Xa(n))?{intent:"non-write",targets:[],toolName:n,...a?{cwd:a}:{}}:n?{intent:"unknown",targets:r,toolName:n,...a?{cwd:a}:{}}:{intent:r.length>0?"write":"unknown",targets:r,toolName:null,...a?{cwd:a}:{}}}function to(){let t=process.env.FILE_PATH;if(t?.trim()||process.stdin.isTTY)return ct("",t);try{return ct(ou(0,"utf8"),t)}catch{return ct("",t)}}var Fa=On(Xi(),1);import{promises as Ev}from"fs";import Me from"path";import{createHash as Jp}from"node:crypto";import{promises as G}from"node:fs";import B from"node:path";import{TextDecoder as Gp}from"node:util";var Vp=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),Wp=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function zp(t){return t.toLowerCase().startsWith(".env")}function Mt(t){let i=t.replaceAll("\\","/").split("/").filter(Boolean).map(n=>n.toLowerCase());return i.some(n=>zp(n))?"environment-file":i.some(n=>Wp.has(n))?"credential-config":i.includes(".git")?"git-metadata":i.some(n=>Vp.has(n))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}function ye(t){return t!==0&&t!==0n&&t!=="0"}function J(t,e){return ye(t.dev)&&ye(e.dev)&&ye(t.ino)&&ye(e.ino)}function I(t,e){let i=ye(t.dev)&&ye(e.dev);if(i&&t.dev!==e.dev)return!1;let n=ye(t.ino)&&ye(e.ino);return n&&t.ino!==e.ino?!1:i&&n?!0:t.birthtime===e.birthtime}var Zi=1024*1024;function va(t,e){let i=B.relative(t,e);return i===""||!B.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${B.sep}`)}function Kp(t){let e=B.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(r=>{let a=r.codePointAt(0)??0;return a<=31||a===127})||B.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let i=t.toLowerCase(),n=Mt(t);if(n||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${n??"native-runtime"}): ${t}`);return t}function Up(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function Yp(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Qi(t,e){let i={...t,birthtime:t.birthtimeMs},n={...e,birthtime:e.birthtimeMs};return J(i,n)?I(i,n):I(i,n)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function zc(t){let e=await G.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await G.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function Xp(t,e){let i=B.resolve(t),n=B.resolve(e);if(!va(i,n))throw new Error("Native artifact path is outside its root");let r=[await zc(i)],a=i;for(let o of B.relative(i,n).split(B.sep).filter(Boolean)){a=B.join(a,o);let s=await zc(a);if(!va(r[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);r.push(s)}return r}async function Jc(t){for(let e of t){let i=await G.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!Yp(e,i)||await G.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function Ne(t){let e=Kp(t.ref),i=Up(t.maxBytes??Zi),n=B.resolve(t.root,...e.split("/")),r=await Xp(t.root,B.dirname(n));await t.hooks?.afterParentChainCaptured?.();let a=await G.lstat(n);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);let o=await G.realpath(n);if(!va(r[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${e}`);let s=await G.open(n,"r");try{let[c,l,d]=await Promise.all([s.stat(),G.lstat(n),G.realpath(n)]);if(await Jc(r),!c.isFile()||!l.isFile()||l.isSymbolicLink()||d!==o||!Qi(a,c)||!Qi(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let u=[],f=0,m=Buffer.allocUnsafe(Math.min(64*1024,i+1));for(;;){let k=i+1-f,S=await s.read(m,0,Math.min(m.length,k),null);if(S.bytesRead===0)break;if(f+=S.bytesRead,f>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);u.push(Buffer.from(m.subarray(0,S.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([s.stat(),G.lstat(n),G.realpath(n)]);if(await Jc(r),!h.isFile()||h.isSymbolicLink()||p!==o||!Qi(c,g)||!Qi(c,h))throw new Error(`Native artifact changed while reading: ${e}`);let y=Buffer.concat(u,f),N;try{N=new Gp("utf-8",{fatal:!0}).decode(y)}catch(k){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:k})}return{ref:e,size:f,hash:Jp("sha256").update(y).digest("hex"),text:N}}finally{await s.close()}}var wa=On(Xi(),1);import en from"path";var Dt=64*1024,tn=1024,nn=64,Kc=5,Qp=[".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/**"],te={include:["**/*"],exclude:[...Qp],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4};function Zp(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim();if(i.length===0||en.posix.isAbsolute(i)||en.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be a project-relative path`);if(i===".")return[];let n=i.replaceAll("\\","/").split("/");if(n.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(n.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return n}function et(t){let e=Zp(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Uc(t,e="docs"){let i=t??e;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function ya(t,e,i=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim().replaceAll("\\","/");if(n.length===0||en.posix.isAbsolute(n)||en.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be relative to its declared path base`);let r=n.split("/");if(r.some(a=>a===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(a=>a===""||a==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(n))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function Bt(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Yc(t,e,i){let n=t??e;if(n!=="en"&&n!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return n}function rn(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>tn)throw new Error(`${e} exceeds ${tn} characters`);let i=0;for(let n=0;n<t.length;n+=1)t[n]==="?"?i+=1:t[n]==="*"&&(i+=1,t[n+1]==="*"&&(n+=1));if(i>nn)throw new Error(`${e} contains more than ${nn} wildcard tokens`);return t}function Gc(t,e,i){if(t===void 0)return[...i];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(n=>rn(n,e)))].sort((n,r)=>n.localeCompare(r,"en"))}function ga(t,e,i){let n=t??e;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${i} must be a positive integer`);return n}function em(t){if(t===void 0)return{...te,include:[...te.include],exclude:[...te.exclude]};let e=Bt(t,"native.snapshot");return{include:Gc(e.include,"native.snapshot.include",te.include),exclude:Gc(e.exclude,"native.snapshot.exclude",te.exclude),max_files:ga(e.max_files,te.max_files,"native.snapshot.max_files"),max_total_bytes:ga(e.max_total_bytes,te.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:ga(e.max_duration_ms,te.max_duration_ms,"native.snapshot.max_duration_ms")}}function tm(t){if(t===void 0)return;let e=Bt(t,"native.pending_root_move"),i=e.id,n=e.from_artifact_root,r=e.to_artifact_root,a=e.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof n!="string"||typeof r!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let s=Bt(e.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,d=s.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 d!="string"||!/^[a-f0-9]{64}$/u.test(d))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:d}}return{id:i,fromArtifactRoot:et(n),toArtifactRoot:et(r),stage:a,...o?{cleanup:o}:{}}}function im(t,e={}){let i=Bt(t,"native"),n=i.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof n!="string")throw new Error("native.artifact_root must be a string");let r=i.clarification_mode??"sequential";if(r!=="sequential"&&r!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=i.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=i.max_verify_failures??Kc;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=tm(i.pending_root_move);return{artifact_root:et(n),language:Yc(i.language,"en","native.language"),clarification_mode:r,archive_confirmation:a,max_verify_failures:o,snapshot:em(i.snapshot),...s?{pending_root_move:s}:{}}}function nm(t){let e=Bt(t,"classic"),i=e.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let n=e.review_mode??"standard";if(n!=="off"&&n!=="standard"&&n!=="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:Uc(e.artifact_layout),language:Yc(e.language,"zh-CN","classic.language"),context_compression:i,review_mode:n,auto_transition:r}}function rm(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function am(t,e,i,n,r){let a=t.schema!==void 0;if(!(a||t.default_workflow!==void 0||t.workflows!==void 0||!r.allowPartialProject&&t.native!==void 0)||r.allowPartialProject&&!a)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 s=t.workflows??[t.default_workflow];if(!Array.isArray(s)||s.length===0||s.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(s)];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:n,...e?{native:e}:{},...i?{classic:i}:{}}}function qt(t,e={}){let i=(0,wa.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let n=i.toJS();if(n==null)return{value:{},config:null,ambient_resume:!0};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let r=n,a=rm(r.ambient_resume),o=r.native===void 0?void 0:im(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),s=r.classic===void 0?void 0:nm(r.classic),c=am(r,o,s,a,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:a,...o?{native:o}:{},...s?{classic:s}:{}}}import{createHash as sm}from"crypto";import{promises as sn}from"fs";import be from"path";import{constants as an,promises as Ie}from"fs";var ie=class extends Error{reason;constructor(e,i,n){super(i,n),this.name="RaceSafeReadError",this.reason=e}};function Na(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Xc(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function Vt(t){return{dev:t.dev,ino:t.ino,birthtime:Na(t)}}function on(t,e){let i=Vt(t),n=Vt(e);return J(i,n)?I(i,n):I(i,n)&&Na(t)===Na(e)&&Xc(t)===Xc(e)&&t.size===e.size}async function tt(t,e,i={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let n=i.label??"file",r=i.bigint===!0,a=await Ie.lstat(t,{bigint:r});if(!a.isFile()||a.isSymbolicLink())throw new ie("not-regular-file",`${n} must be a regular file`);if(BigInt(a.size)>BigInt(e))throw new ie("too-large",`${n} exceeds ${e} bytes`);let o=await Ie.realpath(t);await i.verify?.("pre-open",{realPath:o,identity:Vt(a)});let s=process.platform==="win32"?an.O_RDONLY:an.O_RDONLY|an.O_NOFOLLOW|an.O_NONBLOCK,c;try{c=await Ie.open(t,s)}catch(l){throw l.code==="ELOOP"?new ie("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,d,u]=await Promise.all([c.stat({bigint:r}),Ie.lstat(t,{bigint:r}),Ie.realpath(t)]);if(!l.isFile()||!d.isFile()||d.isSymbolicLink()||u!==o||!on(a,l)||!on(a,d))throw new ie("changed",`${n} changed while opening`);await i.verify?.("post-open",{realPath:u,identity:Vt(l)}),await i.hooks?.afterOpen?.();let f=[],m=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let N=e+1-m,{bytesRead:k}=await c.read(g,0,Math.min(g.length,N),null);if(k===0)break;if(m+=k,m>e)throw new ie("too-large",`${n} exceeds ${e} bytes`);f.push(Buffer.from(g.subarray(0,k)))}await i.hooks?.beforeFinalCheck?.();let[h,p,y]=await Promise.all([c.stat({bigint:r}),Ie.lstat(t,{bigint:r}),Ie.realpath(t)]);if(!p.isFile()||p.isSymbolicLink()||y!==o||!on(a,h)||!on(a,p))throw new ie("changed",`${n} changed while reading`);return await i.verify?.("post-read",{realPath:y,identity:Vt(h)}),{bytes:Buffer.concat(f,m),stat:h,realPath:y}}finally{await c.close()}}function om(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function ba(t,e){let i=be.relative(t,e);return i===""||!be.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${be.sep}`)}async function Qc(t,e){let i=be.resolve(t),n=await sn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return sn.realpath(i)}async function Zc(t,e,i,n){let r=t;for(let a=0;a<i.length;a++){r=be.join(r,i[a]);let o;try{o=await sn.lstat(r)}catch(d){if(om(d))return{exists:!1,kind:"missing"};throw d}let s=be.relative(t,r).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${n.label} ancestor ${s} must be a real directory`);if(c&&(n.expected==="file"&&!o.isFile()||n.expected==="directory"&&!o.isDirectory()||n.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${n.label} must be a real ${n.expected}`);let l=await sn.realpath(r);if(!ba(e,l))throw new Error(`${n.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 Wt(t,e,i){let n=ya(e,i.label),r=be.resolve(t),a=await Qc(r,i.label),o=n.split("/"),s=be.resolve(r,...o);if(!ba(r,s))throw new Error(`${i.label} must stay inside the project root`);let c=await Zc(r,a,o,i);return{projectRoot:r,target:s,relative:n,exists:c.exists,kind:c.kind}}async function _e(t,e,i,n){let r=await Wt(t,e,{label:n.label,expected:"file"});if(!r.exists){let o=new Error(`${n.label} does not exist`);throw o.code="ENOENT",o}let a=await Qc(r.projectRoot,n.label);return tt(r.target,i,{...n,verify:async(o,s)=>{if(!ba(a,s.realPath))throw new Error(`${n.label} resolves outside the project root`);await Zc(r.projectRoot,a,r.relative.split("/"),{label:n.label,expected:"file"})}})}var zt=".comet/config.yaml";function cm(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ka(t,e={}){return(await cn(t,e)).document}async function lm(t){try{return(await _e(t,zt,Dt,{label:zt})).bytes}catch(e){if(cm(e))return null;throw e}}function um(t){return t?{exists:!0,sha256:sm("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function cn(t,e={}){let i=await lm(t);return{document:i?qt(i.toString("utf8"),e):null,identity:um(i)}}var Hy=16*1024;import{promises as it}from"fs";import A from"path";import mm from"os";var Ra=".comet/config.yaml";async function Ca(t){try{return await it.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function vm(t){try{let e=await it.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function Jt(t,e){let i=A.relative(t,e);return i===""||!A.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${A.sep}`)}async function Gt(t){let e=[],i=t;for(;!await Ca(i);){let r=A.dirname(i);if(r===i)break;e.push(A.basename(i)),i=r}let n=await it.realpath(i);return A.resolve(n,...e.reverse())}async function tl(t){try{return(await it.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Pa(t){let e=A.resolve(t);try{(await it.stat(e)).isDirectory()||(e=A.dirname(e))}catch(r){if(r.code!=="ENOENT")throw r}let i=e,n=A.resolve(mm.homedir());for(;;){if(!(e===n&&i!==n)){let o=A.join(e,...Ra.split("/")),s=e===i||await vm(o);if(await Ca(o)&&s)return e}if(await Ca(A.join(e,".git")))return e;let a=A.dirname(e);if(a===e)return i;e=a}}function Aa(t){return et(t)}async function gm(t,e){let i=Aa(e),n=A.resolve(t,...i.split("/")),r=await it.realpath(t),a=await Gt(n);if(!Jt(r,a))throw new Error("native.artifact_root resolves outside the project root");return n}async function un(t,e){let i=Aa(e),n=await gm(t,i),r=A.join(n,"comet");if(await tl(r))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([Gt(n),Gt(r)]);if(!Jt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");return{projectRoot:A.resolve(t),configFile:A.join(t,...Ra.split("/")),artifactRoot:n,artifactRootRef:i,nativeRoot:r,specsDir:A.join(r,"specs"),changesDir:A.join(r,"changes"),archiveDir:A.join(r,"archive"),runtimeDir:A.join(r,"runtime"),locksDir:A.join(r,"runtime","locks"),transactionsDir:A.join(r,"runtime","transactions")}}function ne(t,e){return Jt(A.resolve(t),A.resolve(e))}async function H(t,e){let i=A.resolve(t),n=A.resolve(e);if(!Jt(i,n))throw new Error(`Path is outside the Native root: ${e}`);if(await tl(i))throw new Error(`Native root must not be a symbolic link: ${t}`);let[r,a]=await Promise.all([Gt(i),Gt(n)]);if(!Jt(r,a))throw new Error(`Path resolves outside the Native root: ${e}`);return n}var fn=rn;async function nt(t){let e=(await ka(t))?.config??null;return e?.native?e:null}import{AsyncLocalStorage as ym}from"async_hooks";var aN=16*1024;var oN=new ym;import{TextDecoder as Am}from"util";import{createHash as Nm}from"node:crypto";import{constants as dn,promises as K}from"node:fs";import U from"node:path";import{TextDecoder as bm}from"node:util";function pn(t,e){let i=U.relative(t,e);return i===""||!U.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${U.sep}`)}function km(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function Sm(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Em(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function hn(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Ta(t,e){let i=await K.lstat(t);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await K.realpath(t),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function Cm(t,e,i){let n=U.resolve(t),r=U.resolve(e);if(!pn(n,r))throw new Error(`${i} is outside its managed root`);let a=[await Ta(n,i)],o=n;for(let s of U.relative(n,r).split(U.sep).filter(Boolean)){await Oe(a,i),o=U.join(o,s);let c=await Ta(o,i);if(!pn(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await Oe(a,i),a}async function Oe(t,e){for(let i of t){let n=await K.lstat(i.path);if(!n.isDirectory()||n.isSymbolicLink()||!Sm(i,n)||await K.realpath(i.path)!==i.realPath)throw new Error(`${e} parent changed during I/O: ${i.path}`)}}async function Rm(t,e,i){let n=[],r=0,a=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let o=e+1-r,{bytesRead:s}=await t.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(r+=s,r>e)throw new Error(`${i} exceeds ${e} bytes`);n.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(n,r)}async function rt(t){let e=km(t.maxBytes),i=U.resolve(t.file),n=await Cm(t.root,U.dirname(i),t.label),r=await Promise.all((t.forbiddenRoots??[]).map(d=>Ta(U.resolve(d),t.label)));await t.hooks?.afterParentChainCaptured?.(),await Oe(n,t.label);let a=await K.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(a.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let o=Em(a),s=await K.realpath(i);if(!pn(n[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(r.some(d=>pn(d.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?dn.O_RDONLY:dn.O_RDONLY|dn.O_NOFOLLOW|dn.O_NONBLOCK,l=await K.open(i,c);try{let d=await l.stat();await t.hooks?.afterOpen?.();let[u,f]=await Promise.all([K.lstat(i),K.realpath(i)]);if(await Oe(n,t.label),await Oe(r,t.label),!d.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!hn(o,d)||!hn(o,u))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let m=await Rm(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([l.stat(),K.lstat(i),K.realpath(i)]);if(await Oe(n,t.label),await Oe(r,t.label),!h.isFile()||h.isSymbolicLink()||p!==s||!hn(o,g)||!hn(o,h))throw new Error(`${t.label} changed while reading`);return{bytes:m,hash:Nm("sha256").update(m).digest("hex"),size:m.length}}finally{await l.close()}}async function nl(t){let e=await rt(t),i;try{i=new bm("utf-8",{fatal:!0}).decode(e.bytes)}catch(n){throw new Error(`${t.label} is not valid UTF-8`,{cause:n})}return{...e,text:i}}var kN=256*1024,SN=1024*1024,EN=16*1024;var CN=64*1024*1024;var RN=new Am("utf-8",{fatal:!0});import vn from"path";import{createHash as Tm}from"crypto";function D(t){return Tm("sha256").update(t).digest("hex")}var WN={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},_m=1e3,Om=8*1024*1024,jm=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Hm=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),$m=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),Lm=new Set(["schema","include","exclude","hash"]),Fm=new Set(["provider","gitSelection","physicalSelection","projection"]),Mm=new Set(["provider","selection"]),Bm=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),Dm=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),qm=new Set(["schema","status","before","after"]),Vm=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),Wm=new Set(["path","hash","size","type","gitObjectId"]),zm=new Set(["path","size","type","reason"]),Jm=new Set(["ref","hash","count"]),Gm=new Set(["change-created","legacy-migration","explicit"]),Km=new Set(["file","directory","other"]),Um=new Set(["file-size","file-count","total-size","manifest-size","changed-during-read","unreadable","gitlink-unavailable","gitlink-dirty","gitlink-changed","legacy-gitlink-boundary","git-enumeration-limit","git-selection-changed","physical-enumeration-limit","physical-selection-changed"]),gn=/^[a-f0-9]{64}$/u,Ym=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var zN=64*1024,JN=64*1024;var GN={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},KN={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function mn(t,e){return t.hash===e.hash&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.stdoutBytes===e.stdoutBytes&&t.overflow===e.overflow}var UN=(1n<<256n)-1n;function Xm(t,e){return t.hash===e.hash&&t.visitedNodeCount===e.visitedNodeCount&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.encodedBytes===e.encodedBytes&&t.overflow===e.overflow&&t.unstable===e.unstable}function Qm(t){return Buffer.byteLength(JSON.stringify(t,null,2)+`
143
- `)}function Zm(t,e){return D(`comet.native.snapshot-policy.v1
144
- ${JSON.stringify({include:t,exclude:e,hash:"sha256"})}`)}function _a(t,e,i){let n=new Set(e),r=[...e];for(;r.length>0;){if(i&&!i())return null;let a=r.pop(),o=t[a];o&&(o.kind==="star"||o.kind==="globstar"||o.kind==="globstar-slash")&&!n.has(a+1)&&(n.add(a+1),r.push(a+1))}return n}function ev(t){let e=0;return()=>e>0?(e-=1,!0):t()?(e=63,!0):!1}function cl(t){let e=fn(t,"Native snapshot pattern"),i=[];for(let n=0;n<e.length;n+=1){let r=e[n];r==="*"&&e[n+1]==="*"?(n+=1,e[n+1]==="/"?(n+=1,i.push({kind:"globstar-slash"})):i.push({kind:"globstar"})):r==="*"?i.push({kind:"star"}):r==="?"?i.push({kind:"question"}):i.push({kind:"literal",value:r})}return(n,r)=>{let a=r?ev(r):void 0;if(a&&!a())return!1;let o=_a(i,new Set([0]),a);if(o===null)return!1;for(let s of n){if(a&&!a())return!1;let c=new Set;for(let l of o){if(a&&!a())return!1;let d=i[l];d&&(d.kind==="literal"&&d.value===s||d.kind==="question"&&s!=="/"?c.add(l+1):d.kind==="star"&&s!=="/"||d.kind==="globstar"?c.add(l):d.kind==="globstar-slash"&&(c.add(l),s==="/"&&c.add(l+1)))}if(o=_a(i,c,a),o===null||o.size===0)return!1}return _a(i,o,a)?.has(i.length)??!1}}function tv(t){if(t===void 0)return;let e=[...new Set(t.include.map(r=>fn(r,"include")))].sort((r,a)=>r.localeCompare(a,"en")),i=[...new Set(t.exclude.map(r=>fn(r,"exclude")))].sort((r,a)=>r.localeCompare(a,"en"));if(e.length===0)throw new Error("Native snapshot policy include must not be empty");let n=Zm(e,i);if("hash"in t&&t.hash!==n)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:e,exclude:i,hash:n},includeMatchers:e.map(cl),excludeMatchers:i.map(cl),excludedDirectoryPrefixes:i.flatMap(r=>{if(!r.endsWith("/**"))return[];let a=r.slice(0,-3);return/[*?]/u.test(a)?[]:[a]}).sort((r,a)=>r.localeCompare(a,"en"))}}function q(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function V(t,e,i){let n=Object.keys(t).find(r=>!e.has(r));if(n)throw new Error(`${i} contains unknown field: ${n}`)}function ot(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function re(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function fl(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0"))throw new Error(`${e} must be a normalized project-relative path`);let i=vn.posix.normalize(t);if(i!==t||vn.posix.isAbsolute(t)||i===".."||i.startsWith("../"))throw new Error(`${e} must stay inside the project root`);return t}function iv(t,e){let i=q(t,`Native snapshot entry ${e}`);V(i,Wm,`Native snapshot entry ${e}`);let n=fl(i.path,`Native snapshot entry ${e} path`);if(typeof i.hash!="string"||!gn.test(i.hash))throw new Error(`Native snapshot entry ${e} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${e} type is invalid`);let r={path:n,hash:i.hash,size:re(i.size,`Native snapshot entry ${e} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!Ym.test(i.gitObjectId))throw new Error(`Native snapshot entry ${e} gitObjectId is invalid`);r.gitObjectId=i.gitObjectId}return r}function nv(t,e){let i=q(t,`Native snapshot omission ${e}`);if(V(i,zm,`Native snapshot omission ${e}`),!Km.has(i.type))throw new Error(`Native snapshot omission ${e} type is invalid`);if(!Um.has(i.reason))throw new Error(`Native snapshot omission ${e} reason is invalid`);return{path:fl(i.path,`Native snapshot omission ${e} path`),size:i.size===null?null:re(i.size,`Native snapshot omission ${e} size`),type:i.type,reason:i.reason}}function rv(t){let e=q(t,"Native snapshot omission overflow");if(V(e,Jm,"Native snapshot omission overflow"),typeof e.hash!="string"||!gn.test(e.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${e.hash}`;if(e.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:e.hash,count:ot(e.count,"Native snapshot omission overflow count")}}function at(t,e){let i=q(t,e);if(V(i,Dm,e),typeof i.hash!="string"||!gn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${e} overflow flag is invalid`);let n=re(i.recordCount,`${e} recordCount`),r=re(i.storedRecordCount,`${e} storedRecordCount`),a=re(i.stdoutBytes,`${e} stdoutBytes`);if(r>n||!i.overflow&&r!==n)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,recordCount:n,storedRecordCount:r,stdoutBytes:a,overflow:i.overflow}}function ll(t){let e=q(t,"Native Git selection evidence");if(V(e,Bm,"Native Git selection evidence"),e.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=at(e.stageBefore,"Native Git selection stageBefore"),n=at(e.combined,"Native Git selection combined"),r=at(e.stageAfter,"Native Git selection stageAfter"),a=at(e.finalStageBefore,"Native Git selection finalStageBefore"),o=at(e.finalCombined,"Native Git selection finalCombined"),s=at(e.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,n,r,a,o,s].some(u=>u.overflow),l=!mn(i,r)||!mn(r,a)||!mn(n,o)||!mn(a,s),d=c&&l?"overflow-and-changed":c?"overflow":"changed";if(!c&&!l)throw new Error("Native Git selection evidence must describe an exceptional selection");if(e.status!==d)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:d,stageBefore:i,combined:n,stageAfter:r,finalStageBefore:a,finalCombined:o,finalStageAfter:s}}function ul(t,e){let i=q(t,e);if(V(i,Vm,e),typeof i.hash!="string"||!gn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${e} flags are invalid`);let n=re(i.visitedNodeCount,`${e} visitedNodeCount`),r=re(i.recordCount,`${e} recordCount`),a=re(i.storedRecordCount,`${e} storedRecordCount`),o=re(i.encodedBytes,`${e} encodedBytes`);if(a>r||!i.overflow&&a!==r)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:n,recordCount:r,storedRecordCount:a,encodedBytes:o,overflow:i.overflow,unstable:i.unstable}}function av(t){let e=q(t,"Native physical selection evidence");if(V(e,qm,"Native physical selection evidence"),e.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=ul(e.before,"Native physical selection before"),n=ul(e.after,"Native physical selection after"),r=i.overflow||n.overflow,a=i.unstable||n.unstable||!Xm(i,n);if(!r&&!a)throw new Error("Native physical selection evidence must describe an exceptional selection");let o=r&&a?"overflow-and-changed":r?"overflow":"changed";if(e.status!==o)throw new Error("Native physical selection evidence status is inconsistent");return{schema:"comet.native.physical-selection.v1",status:o,before:i,after:n}}function dl(t){let e=q(t,"Native content snapshot manifest");if(V(e,Hm,"Native content snapshot manifest"),e.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!Gm.has(e.origin))throw new Error("Native content snapshot origin is invalid");let i;if(e.capture!==void 0){let v=q(e.capture,"Native content snapshot capture");if(V(v,Fm,"Native content snapshot capture"),v.provider!=="git"&&v.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let R=v.gitSelection===void 0?void 0:ll(v.gitSelection),b=v.physicalSelection===void 0?void 0:av(v.physicalSelection),x=null;if(v.projection!==void 0){let F=q(v.projection,"Native content snapshot projection");if(V(F,Mm,"Native content snapshot projection"),F.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");x={provider:"git",...F.selection===void 0?{}:{selection:ll(F.selection)}}}if(v.provider==="git"){if(b||x)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...R?{gitSelection:R}:{}}}else{if(R)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(b&&x)throw new Error("Native physical-tree capture cannot combine selection and projection");i=x?{provider:"physical-tree",projection:x}:{provider:"physical-tree",...b?{physicalSelection:b}:{}}}}if(typeof e.createdAt!="string"||Number.isNaN(Date.parse(e.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof e.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let n=q(e.limits,"Native content snapshot limits");V(n,$m,"Native content snapshot limits");let r={maxFiles:ot(n.maxFiles,"Native snapshot maxFiles"),maxFileBytes:ot(n.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:ot(n.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:ot(n.maxManifestBytes,"Native snapshot maxManifestBytes"),...n.maxDurationMs===void 0?{}:{maxDurationMs:ot(n.maxDurationMs,"Native snapshot maxDurationMs")}},a;if(e.policy!==void 0){let v=q(e.policy,"Native snapshot policy");if(V(v,Lm,"Native snapshot policy"),v.schema!=="comet.native.snapshot-policy.v1")throw new Error("Native snapshot policy schema is invalid");if(!Array.isArray(v.include)||!Array.isArray(v.exclude))throw new Error("Native snapshot policy patterns must be arrays");a=tv({include:v.include,exclude:v.exclude,hash:v.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(e.entries)||!Array.isArray(e.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let o=e.entries.map(iv),s=e.omitted.map(nv),c=re(e.omittedCount,"Native content snapshot omittedCount"),l=e.omissionOverflow===void 0?void 0:rv(e.omissionOverflow);if(o.length>r.maxFiles)throw new Error("Native content snapshot exceeds its file-count limit");if(o.some(v=>v.size>r.maxFileBytes)||o.reduce((v,R)=>v+R.size,0)>r.maxTotalBytes)throw new Error("Native content snapshot exceeds its byte limits");if(new Set(o.map(v=>v.path)).size!==o.length)throw new Error("Native content snapshot contains duplicate paths");if(s.length>_m||c<s.length)throw new Error("Native content snapshot omission count is invalid");let d=c-s.length;if(d===0&&l||d>0&&l?.count!==d)throw new Error("Native content snapshot omission overflow is inconsistent");if(e.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let u=s.filter(v=>v.reason==="git-enumeration-limit"),f=s.filter(v=>v.reason==="git-selection-changed");for(let v of[...u,...f])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native Git selection omission must use the project-root sentinel");if(u.length>1||f.length>1)throw new Error("Native Git selection omissions must not be duplicated");let m=i?.provider==="git"?i.gitSelection:i?.projection?.selection,g=m?.status==="overflow"||m?.status==="overflow-and-changed",h=m?.status==="changed"||m?.status==="overflow-and-changed";if(g!==(u.length===1))throw new Error("Native Git enumeration omission and selection evidence are inconsistent");if(h!==(f.length===1))throw new Error("Native Git selection-change omission and selection evidence are inconsistent");let p=s.filter(v=>v.reason==="physical-enumeration-limit"),y=s.filter(v=>v.reason==="physical-selection-changed");for(let v of[...p,...y])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native physical selection omission must use the project-root sentinel");if(p.length>1||y.length>1)throw new Error("Native physical selection omissions must not be duplicated");let N=i?.physicalSelection,k=N?.status==="overflow"||N?.status==="overflow-and-changed",S=N?.status==="changed"||N?.status==="overflow-and-changed";if(k!==(p.length===1))throw new Error("Native physical enumeration omission and evidence are inconsistent");if(S!==(y.length===1))throw new Error("Native physical selection-change omission and evidence are inconsistent");let E={schema:"comet.native.content-snapshot.v1",origin:e.origin,...i?{capture:i}:{},createdAt:e.createdAt,complete:e.complete,limits:r,...a?{policy:a}:{},entries:o,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(Qm(E)>r.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function ov(t,e){if(!jm.test(e))throw new Error(`Invalid Native change name: ${e}`);let i=vn.join(t.changesDir,e);if(!ne(t.changesDir,i))throw new Error("Native change path escaped");return vn.join(i,"runtime","baseline-manifest.json")}async function hl(t,e){let i=ov(t,e);await H(t.nativeRoot,i);try{let n=await nl({root:t.nativeRoot,file:i,maxBytes:Om,label:"Native baseline snapshot manifest"});return dl(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}var dv=On(Xi(),1);var Qb=256*1024;var fk={runStateBytes:256*1024,trajectoryBytes:8*1024*1024,trajectoryEvents:4096,trajectoryEventBytes:256*1024,checkpointBytes:256*1024,pendingActionBytes:256*1024,contextBytes:1024*1024,artifactsBytes:1024*1024};import{createHash as vv}from"node:crypto";import{promises as yn}from"node:fs";import ke from"node:path";import{execFileSync as pv}from"child_process";import wn from"path";function Oa(t,e){return pv("git",["-C",t,...e],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function mv(t,e){let i=wn.normalize(t),n=wn.normalize(e);return process.platform==="win32"?i.toLowerCase()===n.toLowerCase():i===n}function ml(t){try{let e=wn.resolve(Oa(t,["rev-parse","--show-toplevel"])),n=Oa(t,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),r=n?wn.resolve(n.slice(9)):e,a=null;try{a=Oa(t,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!mv(e,r),currentWorktreeRoot:e,primaryWorktreeRoot:r,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}var Kt=/^[a-f0-9]{64}$/u,gv=16*1024,ja=process.platform;function yl(t,e){let i=ke.relative(t,e);return ke.isAbsolute(i)||i===".."||i.startsWith(`..${ke.sep}`)?null:i.replaceAll("\\","/")||"."}function Nl(t){return Array.from(t).some(e=>{let i=e.codePointAt(0)??0;return i<=31||i===127})}function bl(t,e){if(t.length===0||Nl(t)||t.includes("\\")||ke.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes(".."))throw new Error(`${e} must be a portable project-relative path`);let i=ke.posix.normalize(t);if(i!==t||i===".."||i.startsWith("../"))throw new Error(`${e} must be a normalized project-relative path`);return i}function Ha(t,e){return vv("sha256").update(`${t}
145
- ${e}`).digest("hex")}async function vl(t,e){let i=await yn.realpath(e),n=await yn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let r=ja==="win32"?ke.normalize(i).toLowerCase():i;return Ha(t,`${r}
146
- ${n.dev}
147
- ${n.ino}
148
- ${n.birthtimeMs}`)}async function gl(t,e){let i=await yn.realpath(e),n=await yn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let r=ja==="win32"?ke.normalize(i).toLowerCase():i;return Ha(t,r)}function wv(t){if(typeof t!="string")throw new Error("Native workspace capturedAt is invalid");let e=new Date(t);if(!Number.isFinite(e.getTime())||e.toISOString()!==t)throw new Error("Native workspace capturedAt is invalid");return t}function wl(t,e){if(t===null)return null;if(typeof t!="string"||t.length===0||t.trim()!==t||Nl(t))throw new Error(`${e} must be a non-empty branch name or null`);return t}function kl(t){if(!new Set(["current","branch","worktree"]).has(t.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(wl(t.changeBranch,"Native workspace change branch"),wl(t.targetBranch,"Native workspace target branch"),(t.isolation==="branch"||t.isolation==="worktree")&&(t.changeBranch===null||t.targetBranch===null))throw new Error("Native isolated workspace requires change and target branches")}function Nn(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Native workspace identity must be an object");let e=t,i=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","isolation","changeBranch","targetBranch","finish"]),n=Object.keys(e).filter(o=>!i.has(o));if(n.length>0)throw new Error(`Native workspace identity has unknown field(s): ${n.join(", ")}`);if(e.schema!=="comet.native.workspace.v2"&&e.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(e.capturedRevision)||e.capturedRevision<1||typeof e.nativeRootRef!="string"||!Kt.test(String(e.projectRootId))||!Kt.test(String(e.nativeRootId)))throw new Error("Native workspace identity is invalid");wv(e.capturedAt),bl(e.nativeRootRef,"Native workspace root ref");let r=e.projectRootPathId!==void 0,a=e.nativeRootPathId!==void 0;if(r!==a)throw new Error("Native workspace path identities must be provided together");if(r&&!Kt.test(String(e.projectRootPathId))||a&&!Kt.test(String(e.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(e.sessionHash!==void 0&&!Kt.test(String(e.sessionHash)))throw new Error("Native workspace session hash is invalid");if(e.schema==="comet.native.workspace.v2"){if(e.isolation!==void 0||e.changeBranch!==void 0||e.targetBranch!==void 0||e.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof e.isolation!="string"||e.changeBranch===void 0||e.targetBranch===void 0||e.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(kl(e),e.finish!==null&&!new Set(["merge","push","pull-request","keep"]).has(e.finish))throw new Error("Native workspace finish must be merge, push, pull-request, keep, or null")}function yv(t,e){return ke.join(t.changesDir,e,"runtime","workspace.json")}function Nv(t,e){let i=yl(t.nativeRoot,yv(t,e));if(!i||i===".")throw new Error("Native workspace file escaped its root");return bl(i,"Native workspace file ref")}async function bv(t,e){try{let i=await Ne({root:t.nativeRoot,ref:Nv(t,e),maxBytes:gv});return JSON.parse(i.text)}catch(i){if(i.code==="ENOENT")return null;throw i}}async function kv(t){if(!Number.isSafeInteger(t.revision)||t.revision<1)throw new Error("Native workspace revision must be a positive integer");let e=yl(t.paths.projectRoot,t.paths.nativeRoot);if(!e)throw new Error("Native root is outside the project root");let[i,n,r,a]=await Promise.all([vl("comet.native.workspace-project-root.v2",t.paths.projectRoot),vl("comet.native.workspace-native-root.v2",t.paths.nativeRoot),gl("comet.native.workspace-project-root-path.v2",t.paths.projectRoot),gl("comet.native.workspace-native-root-path.v2",t.paths.nativeRoot)]),o=(t.now??new Date).toISOString();if(t.finish&&!t.binding)throw new Error("Native workspace finish requires a workspace binding");t.binding&&kl(t.binding);let s={capturedAt:o,capturedRevision:t.revision,nativeRootRef:e,projectRootId:i,nativeRootId:n,projectRootPathId:r,nativeRootPathId:a,...t.sessionId?{sessionHash:Ha("comet.native.workspace-session.v2",`${i}
149
- ${n}
150
- ${t.sessionId}`)}:{}},c=t.binding?{schema:"comet.native.workspace.v3",...s,...t.binding,finish:t.finish??null}:{schema:"comet.native.workspace.v2",...s};return Nn(c),c}async function bn(t,e){let i=await bv(t,e);return i===null||i&&typeof i=="object"&&!Array.isArray(i)&&i.schema==="comet.native.workspace.v1"?null:(Nn(i),i)}async function Sl(t){Nn(t.identity);let e=await kv({paths:t.paths,name:"workspace-advisory",revision:t.identity.capturedRevision}),i=[],n=[];return e.nativeRootRef!==t.identity.nativeRootRef&&i.push("native-root-ref"),t.identity.projectRootPathId&&t.identity.nativeRootPathId?(e.projectRootPathId!==t.identity.projectRootPathId&&i.push("project-root-path"),e.nativeRootPathId!==t.identity.nativeRootPathId&&i.push("native-root-path")):(e.projectRootId!==t.identity.projectRootId&&i.push("project-root-legacy-identity"),e.nativeRootId!==t.identity.nativeRootId&&i.push("native-root-legacy-identity")),ja==="win32"&&i.length>0&&i.every(a=>a==="project-root-legacy-identity"||a==="native-root-legacy-identity")?n.push("workspace-inspection-unavailable"):i.length>0&&n.push("workspace-root-changed"),{state:n.length===0?"aligned":n.includes("workspace-root-changed")?"drifted":"unknown",findingCodes:n,driftComponents:i}}async function El(t){if(Nn(t.identity),t.identity.schema==="comet.native.workspace.v2")return{state:"legacy",code:"workspace-binding-legacy",message:"Legacy Native workspace metadata has no isolation binding"};if((await Sl(t)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let i=ml(t.paths.projectRoot);return t.identity.changeBranch===null?i.isGitWorktree?{state:"drifted",code:"workspace-branch-changed",message:"Native change was created outside Git but is now being accessed inside Git"}:{state:"aligned",code:null,message:null}:i.isGitWorktree?i.currentBranch!==t.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${t.identity.changeBranch}, but the current branch is ${i.currentBranch??"detached HEAD"}`}:t.identity.isolation==="worktree"&&!i.isSecondaryWorktree?{state:"drifted",code:"workspace-kind-changed",message:"Native change is bound to a linked Git worktree"}:{state:"aligned",code:null,message:null}:{state:"drifted",code:"workspace-vcs-unavailable",message:"Native change requires its bound Git working directory"}}async function Cl(t,e){let i=await bn(t,e);if(i===null)return null;let n=await El({paths:t,identity:i});if(n.state==="drifted")throw new Error(`${n.code}: ${n.message}`);return i}var $e="comet.native.v3",Le="comet.native.v2",Fe="comet.native.v1";var Rl=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],Cv=new Set(Rl),Pl=new Set([...Rl,"minimum_runtime_version","revision"]),Rv=new Set([...Pl,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),Pv=new Set(["capability","operation","source","base_hash"]),Av=new Set(["shape","build","verify","archive"]),xv=new Set(["implicit","confirmed"]),Tv=new Set(["pending","pass","fail"]),De="comet-state.yaml",La=/^[a-f0-9]{64}$/u,Al=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Iv=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,kn=class extends Error{constructor(i,n){super(`Native change ${i} uses ${n}; run comet native doctor ${i} --repair before mutating it`);this.change=i;this.schema=n;this.name="NativeSchemaMigrationRequiredError"}change;schema;code="native-schema-migration-required"},Be=class extends Error{constructor(i,n){super(i!==$e||n===null?`Unsupported Native change schema ${i} for runtime protocol ${3}`:`Native change ${i} requires runtime protocol ${n}; current protocol is ${3}`);this.schema=i;this.minimumRuntimeVersion=n;this.name="NativeRuntimeCompatibilityError"}schema;minimumRuntimeVersion;code="native-runtime-incompatible"},Sn=class extends Error{constructor(i,n,r){super(`Native change ${i} revision conflict: expected ${n}, actual ${r}`);this.change=i;this.expectedRevision=n;this.actualRevision=r;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},En=class extends Error{constructor(i,n){super(`Native working directory already contains active change${n.length===1?"":"s"} ${n.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=i;this.activeChanges=n;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},Cn=class extends Error{constructor(i,n,r,a,o,s=null,c=null){super(`Native change ${i} baseline is incomplete (${n} omitted entr${n===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=i;this.omittedCount=n;this.omittedByReason=r;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},eS=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
151
- `);function Yt(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function xl(t,e,i){let n=Object.keys(t).filter(r=>!e.has(r));if(n.length>0)throw new Error(`${i} has unknown field(s): ${n.join(", ")}`)}function Rn(t){if(!Al.test(t))throw new Error(`Invalid Native change name: ${t}`)}function _v(t){if(!Al.test(t))throw new Error(`Invalid Native capability id: ${t}`)}function Tl(t,e){if(t.length===0||Me.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native change`)}function Ov(t,e){let i=Yt(t,`spec_changes[${e}]`);if(xl(i,Pv,`spec_changes[${e}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(_v(i.capability),i.operation!=="create"&&i.operation!=="replace"&&i.operation!=="remove")throw new Error(`Invalid spec operation for ${i.capability}`);let n=i.source,r=i.base_hash;if(n!==void 0&&typeof n!="string")throw new Error(`Spec source for ${i.capability} must be a string`);if(typeof n=="string"&&Tl(n,`Spec source for ${i.capability}`),i.operation==="create"){if(!n)throw new Error(`Create spec ${i.capability} requires source`);if(r!==null)throw new Error(`Create spec ${i.capability} requires null base_hash`)}else if(i.operation==="replace"){if(!n)throw new Error(`Replace spec ${i.capability} requires source`);if(typeof r!="string"||!La.test(r))throw new Error(`Replace spec ${i.capability} requires a SHA-256 base_hash`)}else{if(n!==void 0)throw new Error(`Remove spec ${i.capability} forbids source`);if(typeof r!="string"||!La.test(r))throw new Error(`Remove spec ${i.capability} requires a SHA-256 base_hash`)}return{capability:i.capability,operation:i.operation,...typeof n=="string"?{source:n}:{},base_hash:r}}function jv(t){return/^\d{4}-\d{2}-\d{2}$/u.test(t)?new Date(`${t}T00:00:00.000Z`).toISOString().slice(0,10)===t:!1}function Ma(t,e){if(xl(t,e,De),typeof t.name!="string")throw new Error("Native change name is required");if(Rn(t.name),t.language!=="en"&&t.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof t.phase!="string"||!Av.has(t.phase))throw new Error("Native change phase is invalid");if(t.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(t.approval!==null&&!xv.has(t.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(t.spec_changes))throw new Error("Native spec_changes must be an array");let i=t.spec_changes.map(Ov),n=i.map(r=>r.capability).filter((r,a,o)=>o.indexOf(r)!==a);if(n.length>0)throw new Error(`Duplicate Native capability operation: ${[...new Set(n)].join(", ")}`);if(typeof t.verification_result!="string"||!Tv.has(t.verification_result))throw new Error("Native verification_result is invalid");if(t.verification_report!==null&&typeof t.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof t.verification_report=="string"&&Tl(t.verification_report,"Native verification_report"),typeof t.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof t.created_at!="string"||!jv(t.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(t.run_id!==null&&(typeof t.run_id!="string"||t.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:t.name,language:t.language,phase:t.phase,brief:"brief.md",approval:t.approval,spec_changes:i,verification_result:t.verification_result,verification_report:t.verification_report,archived:t.archived,created_at:t.created_at,run_id:t.run_id}}function Ba(t){let e=Yt(t,De);if(e.schema!==Fe)throw new Error(`Expected ${Fe}`);return{schema:Fe,...Ma(e,Cv)}}function Ut(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function $a(t,e,i){if(t===null)return null;let n=typeof t=="string"?Iv.exec(t):null;if(!n||n[1]!==i)throw new Error(`${e} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return t}function Hv(t){if(t==null)return null;if(typeof t!="string"||!La.test(t))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return t}function $v(t){if(t===void 0)return"legacy-v1";if(t!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return t}function Da(t){let e=Yt(t,De);if(e.schema!==Le)throw new Error(`Expected ${Le}`);if(Ut(e.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${Le} minimum_runtime_version must be 2`);return{schema:Le,minimum_runtime_version:2,revision:Ut(e.revision,"Native v2 revision"),...Ma(e,Pl)}}function qa(t){let e=Yt(t,De);if(e.schema!==$e){if(e.schema===Fe||e.schema===Le){let o=e.schema===Fe?Ba(e):Da(e);throw new kn(o.name,o.schema)}throw new Be(typeof e.schema=="string"?e.schema:"(missing)",typeof e.minimum_runtime_version=="number"?e.minimum_runtime_version:null)}let i=Ut(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new Be(e.schema,i);if(i!==3)throw new Error(`Native ${e.schema} minimum_runtime_version must be ${3}`);let n=Ut(e.revision,"Native revision"),r=Ma(e,Rv),a=Hv(e.approved_contract_hash);if(r.approval===null&&a!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:$e,minimum_runtime_version:3,revision:n,verification_protocol:$v(e.verification_protocol),...r,approved_contract_hash:a,implementation_scope:$a(e.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:$a(e.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:$a(e.partial_allowance,"Native partial_allowance","allowances")}}function Lv(t){let e=Yt(t,De);if(e.schema===Fe){let r=Ba(e);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:1,state:r,message:`Native change ${r.name} requires migration to ${$e}`}}if(e.schema===Le){let r=Da(e);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r,message:`Native change ${r.name} requires migration to ${$e}`}}if(e.schema!==$e){let r=typeof e.minimum_runtime_version=="number"&&Number.isSafeInteger(e.minimum_runtime_version)?e.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof e.schema=="string"?e.schema:"(missing)",minimumRuntimeVersion:r,state:null,message:new Be(typeof e.schema=="string"?e.schema:"(missing)",r).message}}let i=Ut(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:e.schema,minimumRuntimeVersion:i,state:null,message:new Be(e.schema,i).message};let n=qa(e);return{status:"current",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n}}function Y(t,e){Rn(e);let i=Me.join(t.changesDir,e);if(!ne(t.changesDir,i))throw new Error("Native change path escaped");return i}async function Va(t,e){let i=Me.join(Y(t,e),"runtime","schema-migration.json");await H(t.nativeRoot,i);try{return await Ev.lstat(i),!0}catch(n){if(n.code==="ENOENT")return!1;throw n}}var Fv=256*1024;async function Mv(t,e=Me.dirname(t)){let i=Me.relative(e,t).split(Me.sep).join("/"),n=await Ne({root:e,ref:i,maxBytes:Fv}),r=(0,Fa.parseDocument)(n.text,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid Native change file ${t}: ${r.errors[0].message}`);return r.toJS()}async function Bv(t,e){let i=Me.join(Y(t,e),De);await H(t.nativeRoot,i);let n=Lv(await Mv(i,t.nativeRoot));if(n.state&&n.state.name!==e)throw new Error(`Native change directory/name mismatch: ${e}`);return await Va(t,e)?{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimumRuntimeVersion,state:n.state,message:`Native schema migration is incomplete for ${e}; run doctor --repair`}:(n.status==="current"&&n.state&&await Dv(t,n.state),n)}async function Dv(t,e){if(await hl(t,e.name)!==null&&e.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${e.verification_protocol}`)}async function se(t,e){let i=await Bv(t,e);if(i.status==="migration-required")throw new kn(e,i.schema);if(i.status==="runtime-incompatible"||!i.state)throw new Be(i.schema,i.minimumRuntimeVersion);return await Cl(t,e),i.state}import qv from"path";var Wa="comet.selection.v2",Vv=16*1024;function _l(t){return qv.join(t,".comet","current-change.json")}function Wv(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Il(t){return t===null||typeof t=="string"}function zv(t){let e;try{e=JSON.parse(t)}catch(i){throw new Error(`current change selection contains invalid JSON: ${i instanceof Error?i.message:String(i)}`,{cause:i})}if(!Wv(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!Il(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:Wa,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==Wa)throw new Error(`current change selection schema must be ${Wa}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!Il(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function Ol(t){let e;try{let n=_l(t),{bytes:r}=await tt(n,Vv,{label:"current change selection"});e=r.toString("utf8")}catch(n){if(n.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${n instanceof Error?n.message:String(n)}`,{cause:n})}return{status:"selected",...zv(e)}}var dS=16*1024;async function Jv(t){let e=await Ol(t.projectRoot);return e.status==="missing"||e.selection.workflow!=="native"?null:(Rn(e.selection.change),e.selection)}async function jl(t){let e=await Jv(t);return e?(await se(t,e.change),e.change):null}function Pn(t,e){let i=st.relative(t,e);return i===""||!i.startsWith("..")&&!st.isAbsolute(i)}function Kv(t,e,i){return i.targets.length>0&&i.targets.every(n=>{let r=st.resolve(t,n);return Pn(t,r)?st.relative(t,r).replaceAll("\\","/")===".comet/config.yaml"||Pn(e,r):!0})}async function Uv(t){let e=await nt(t);if(!e||!(e.workflows??[e.default_workflow]).includes("native"))return null;let i=await un(t,e.native.artifact_root),n;try{n=await Gv.readdir(i.changesDir,{withFileTypes:!0})}catch(a){if(a.code==="ENOENT")return{paths:i,changes:[]};throw a}let r=[];for(let a of n.sort((o,s)=>o.name.localeCompare(s.name))){if(!a.isDirectory()||a.isSymbolicLink())continue;let o=await se(i,a.name);o.archived||r.push(o)}return{paths:i,changes:r}}var Yv=Ua("nativeActiveContext",t=>Uv(t));async function Hl(){let{intent:t,targets:e}=await to();return{intent:t,targets:e}}async function $l(t,e,i){let n=await Yv(t);if(!n)return{allowed:!0,reason:"Native workflow is not enabled"};if(e.intent==="non-write")return{allowed:!0,reason:"Hook event is not a write"};if(n.changes.length===0)return{allowed:!0,reason:Kv(t,n.paths.nativeRoot,e)?"Native control artifact write":"No Native changes exist"};let r;if(i){if(r=n.changes.find(s=>s.name===i),!r)return{allowed:!1,reason:`Selected Native change ${i} is missing or archived; resume /comet-native before retrying`,workflow:"native",change:i}}else if(n.changes.length===1)r=n.changes[0];else{let s=await jl(n.paths);if(r=n.changes.find(c=>c.name===s),!r)return{allowed:!1,reason:"Multiple Native changes are active; select the change to resume before writing code",workflow:"native"}}if(r.phase==="build")return{allowed:!0,reason:"Native change is in Build",workflow:"native",phase:r.phase,change:r.name};if(e.intent==="unknown"||e.targets.length===0)return{allowed:!0,reason:"Hook write target was not attributed to the guarded project",workflow:"native",phase:r.phase,change:r.name};let a=!1,o=!1;for(let s of e.targets){let c=st.resolve(t,s);if(!Pn(t,c)){o=!0;continue}if(st.relative(t,c).replaceAll("\\","/")===".comet/config.yaml"||Pn(n.paths.nativeRoot,c)){a=!0;continue}return{allowed:!1,reason:`Native change ${r.name} is in ${r.phase}; implementation writes are only allowed in build. Resume /comet-native to continue safely`,workflow:"native",phase:r.phase,change:r.name}}return{allowed:!0,reason:a?"Native control artifact write":o?"Write target is outside the guarded project":"No guarded write target was provided",workflow:"native",phase:r.phase,change:r.name}}import _g from"path";var Qv=["Outcome","Scope","Non-goals","Acceptance examples"],$S=[...Qv,"Constraints and invariants","Decisions","Open questions","Verification expectations"];import{createHash as Zv}from"crypto";function X(t){throw new TypeError(`Value is not valid canonical JSON: ${t}`)}function eg(t,e){e.has(t)&&X("cyclic structures are not supported"),e.add(t);try{let i=Object.keys(t);for(let n=0;n<t.length;n+=1)Object.prototype.hasOwnProperty.call(t,n)||X("sparse arrays are not supported");return(i.length!==t.length||i.some((n,r)=>n!==String(r)))&&X("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(t).length>0&&X("symbol properties are not supported"),`[${t.map(n=>za(n,e)).join(",")}]`}finally{e.delete(t)}}function tg(t,e){let i=Object.getPrototypeOf(t);i!==Object.prototype&&i!==null&&X("only plain objects are supported"),e.has(t)&&X("cyclic structures are not supported"),Object.getOwnPropertySymbols(t).length>0&&X("symbol properties are not supported"),e.add(t);try{let n=Object.getOwnPropertyDescriptors(t);return`{${Object.keys(t).sort().map(o=>{let s=n[o];return(!s||!("value"in s))&&X("accessor properties are not supported"),`${JSON.stringify(o)}:${za(s.value,e)}`}).join(",")}}`}finally{e.delete(t)}}function za(t,e){if(t===null)return"null";switch(typeof t){case"boolean":return t?"true":"false";case"string":return JSON.stringify(t);case"number":return Number.isFinite(t)||X("numbers must be finite"),JSON.stringify(Object.is(t,-0)?0:t);case"object":return Array.isArray(t)?eg(t,e):tg(t,e);case"bigint":case"function":case"symbol":case"undefined":return X(`${typeof t} values are not supported`)}return X("unsupported value type")}function Ja(t){return za(t,new Set)}function Q(t,e){if(t.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(t))throw new TypeError("Canonical hash tag must not contain a line break");return Zv("sha256").update(`${t}
152
- ${Ja(e)}`).digest("hex")}var ig=Object.freeze({maxChanges:32,maxSpecsPerChange:64,maxArtifactsPerChange:128,maxTotalSpecs:512,maxTotalArtifacts:1024,maxSignalsPerRelationship:8,maxRelationships:256,maxSerializedBytes:64*1024,maxNameBytes:128,maxCapabilityBytes:128,maxArtifactPathBytes:512});var Ll=1024*1024;var Ml="scoped-text-safety",ng=1,rg=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var ag="comet.native.checker-policy.v1";var eE=Q(ag,{policy:Ml,version:ng,limits:rg,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var og=["contract-before-does-not-match-scope","implementation-before-does-not-match-scope","contract-changed-during-check","implementation-changed-during-check","contract-after-does-not-match-scope","implementation-after-does-not-match-scope"],tE=new Set(og);var cg=Ll,yE=3*cg;var Bl={root:"/comet/native-runtime",packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-native-runtime",version:"3",description:"Comet-owned state runtime for the Native workflow."},goal:{statement:"Advance a Native change only after its current guard passes.",inputs:[],outputs:[],success:["The Native change and Run state agree on the next phase."]},orchestration:{mode:"deterministic",entry:"shape",steps:[{id:"shape",action:{type:"checkpoint"},next:"build"},{id:"build",action:{type:"checkpoint"},next:"verify"},{id:"verify",action:{type:"checkpoint"},next:"archive"},{id:"archive",action:{type:"checkpoint"}}]},skills:[],agents:[],tools:[]},guardrails:{allowedSkills:[],allowedAgents:[],allowedTools:[],maxIterations:Number.MAX_SAFE_INTEGER,maxRetriesPerAction:2,confirmationRequiredFor:[]},evals:[]},lg=D("comet-native-runtime:v3:semantic-repair-budget"),GE=[{skillVersion:"2",skillHash:D("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:D("comet-native-runtime:v1")}];var ql=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],PC=new Set(ql),mg=new Set([...ql,"minimum_runtime_version","revision"]),AC=new Set([...mg,"operation"]),xC=512*1024,vg=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),TC=new Set([...vg,"implementationScopeHash","repairScopeHash","repairStagnation"]);var OC=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),Vl=Object.freeze({maxCriteria:1024});var BC={maxAcceptanceCriteria:Vl.maxCriteria};var zC={maxSpecs:64,maxFileBytes:Zi,maxTotalBytes:4*1024*1024};import{execFile as Cg,spawn as OR}from"node:child_process";import{promisify as Rg}from"node:util";var iR={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var ER=512*1024;var Xt=class extends Error{recovery;constructor(e,i){super(e),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var KR=64*1024;var UR=3600*1e3;var YR=Rg(Cg);var XR=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_NATIVE_COMMAND_PAYLOAD","Remove-Item Env:COMET_NATIVE_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ");var xn=class extends Error{details;constructor(e){let i=e.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${e.length} receipt(s)): ${e.map(n=>`${n.ref}${n.acceptanceId?`[${n.acceptanceId}]`:""} -> ${n.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=e}};var LP={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var UP=16*1024*1024,YP=256*1024,XP=16*1024;var FA=16*1024*1024,Tn=class extends Error{constructor(i,n,r,a){super(`Canonical spec conflict for ${i}: expected ${n??"(missing)"}, actual ${r??"(missing)"}`);this.capability=i;this.expectedHash=n;this.actualHash=r;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},In=class extends Error{constructor(i,n=i.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${i.findingCodes.join(", ")}`){super(n);this.preflight=i;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};var UA=10*1024*1024,ce=class extends Error{};function zl(t,e){let i=t.flatMap((n,r)=>n===e?[r]:[]);if(i.length>1)throw new ce(`${e} may only be provided once`);return i.length===0?!1:(t.splice(i[0],1),!0)}function _n(t,e){let i=t.flatMap((a,o)=>a===e?[o]:[]);if(i.length>1)throw new ce(`${e} may only be provided once`);if(i.length===0)return;let n=i[0],r=t[n+1];if(r===void 0||r.startsWith("--"))throw new ce(`${e} requires a value`);return t.splice(n,2),r}function Jl(t){if(t.length>0)throw new ce(`Unexpected argument: ${t[0]}`)}async function Gl(t){return t?_g.resolve(t):Pa(process.cwd())}function Kl(t,e){if(e instanceof ce)return{command:t,exitCode:64,error:{code:"usage",message:e.message}};if(e instanceof Tn)return{command:t,exitCode:73,data:{capability:e.capability,expectedHash:e.expectedHash,actualHash:e.actualHash,canonicalPath:e.canonicalPath},error:{code:"conflict",message:e.message}};if(e instanceof In)return{command:t,exitCode:73,data:e.preflight,error:{code:"conflict",message:e.message}};if(e instanceof Sn)return{command:t,exitCode:73,data:{change:e.change,expectedRevision:e.expectedRevision,actualRevision:e.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:e.message}};if(e instanceof En)return{command:t,exitCode:73,data:{requestedIsolation:e.requestedIsolation,activeChanges:e.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:e.message}};if(e instanceof Cn)return{command:t,exitCode:65,data:{change:e.change,complete:!1,omittedCount:e.omittedCount,omittedByReason:e.omittedByReason,samplePaths:e.samplePaths,sampleTruncated:e.sampleTruncated,effectiveLimits:e.effectiveLimits,policyHash:e.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:e.message}};if(e instanceof xn)return{command:t,exitCode:65,data:{receiptBindingFailures:e.details},error:{code:"invalid-data",message:e.message}};if(e instanceof Xt)return{command:t,exitCode:65,data:e.recovery,error:{code:"implementation-scope-stale",message:e.message}};if(e instanceof Error){let i=e.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:t,exitCode:70,error:{code:"internal",message:e.message}};let n=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(e.message);return{command:t,exitCode:n?73:65,error:{code:n?"conflict":"invalid-data",message:e.message}}}return{command:t,exitCode:70,error:{code:"internal",message:String(e)}}}function Ul(t,e){return e?{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
153
- `}:t.error?{exitCode:t.exitCode,stderr:t.error.message}:{exitCode:t.exitCode,stdout:t.text}}async function Yl(t,e){let i=_n(t,"--hook-output");if(i!==void 0&&i!=="copilot")throw new ce("--hook-output must be copilot");Jl(t);let n=await $l(e,await Hl());return i==="copilot"?{command:"hook-guard",exitCode:0,data:n,text:n.allowed?`{}
154
- `:`${JSON.stringify({permissionDecision:"deny",permissionDecisionReason:n.reason})}
155
- `}:n.allowed?{command:"hook-guard",exitCode:0,data:n}:{command:"hook-guard",exitCode:2,data:n,error:{code:"blocked",message:n.reason}}}function Og(t){return{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
156
- `}}async function Xl(t,e,i=process.argv.slice(2)){let n=i.indexOf("--"),r=n<0?[...i]:i.slice(0,n),a=n<0?[]:i.slice(n),o=r.includes("--json"),s,c;try{zl(r,"--json"),s=_n(r,"--project-root");let d=[...r,...a],u=await Gl(s);c=await e(d,u)}catch(d){c=Kl(t,d)}let l=o?Og(c):Ul(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
142
+ `,i)+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 i=jr(e),r=Ct(i);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=jr(e),r=Ct(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};au.Parser=wo});var uu=w(vi=>{"use strict";var ou=no(),$v=si(),mi=ui(),Ov=ia(),Hv=P(),Dv=go(),su=yo();function cu(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Dv.LineCounter||null,prettyErrors:e}}function Bv(t,e={}){let{lineCounter:i,prettyErrors:r}=cu(e),n=new su.Parser(i?.addNewLine),a=new ou.Composer(e),o=Array.from(a.compose(n.parse(t)));if(r&&i)for(let s of o)s.errors.forEach(mi.prettifyError(t,i)),s.warnings.forEach(mi.prettifyError(t,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function lu(t,e={}){let{lineCounter:i,prettyErrors:r}=cu(e),n=new su.Parser(i?.addNewLine),a=new ou.Composer(e),o=null;for(let s of a.compose(n.parse(t),!0,t.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new mi.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&i&&(o.errors.forEach(mi.prettifyError(t,i)),o.warnings.forEach(mi.prettifyError(t,i))),o}function Lv(t,e,i){let r;typeof e=="function"?r=e:i===void 0&&e&&typeof e=="object"&&(i=e);let n=lu(t,i);if(!n)return null;if(n.warnings.forEach(a=>Ov.warn(n.options.logLevel,a)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:r},i))}function Mv(t,e,i){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){let n=Math.round(i);i=n<1?void 0:n>8?{indent:8}:{indent:n}}if(t===void 0){let{keepUndefined:n}=i??e??{};if(!n)return}return Hv.isDocument(t)&&!r?t.toString(i):new $v.Document(t,r,i).toString(i)}vi.parse=Lv;vi.parseAllDocuments=Bv;vi.parseDocument=lu;vi.stringify=Mv});var Rt=w(C=>{"use strict";var Fv=no(),Vv=si(),qv=Ba(),No=ui(),Wv=zt(),ze=P(),zv=Me(),Jv=j(),Gv=Ve(),Uv=qe(),Kv=Tr(),Yv=mo(),Xv=go(),Qv=yo(),Or=uu(),du=Ft();C.Composer=Fv.Composer;C.Document=Vv.Document;C.Schema=qv.Schema;C.YAMLError=No.YAMLError;C.YAMLParseError=No.YAMLParseError;C.YAMLWarning=No.YAMLWarning;C.Alias=Wv.Alias;C.isAlias=ze.isAlias;C.isCollection=ze.isCollection;C.isDocument=ze.isDocument;C.isMap=ze.isMap;C.isNode=ze.isNode;C.isPair=ze.isPair;C.isScalar=ze.isScalar;C.isSeq=ze.isSeq;C.Pair=zv.Pair;C.Scalar=Jv.Scalar;C.YAMLMap=Gv.YAMLMap;C.YAMLSeq=Uv.YAMLSeq;C.CST=Kv;C.Lexer=Yv.Lexer;C.LineCounter=Xv.LineCounter;C.Parser=Qv.Parser;C.parse=Or.parse;C.parseAllDocuments=Or.parseAllDocuments;C.parseDocument=Or.parseDocument;C.stringify=Or.stringify;C.visit=du.visit;C.visitAsync=du.visitAsync});import{promises as YN}from"fs";import me from"path";var mf=null;function vf(t,e){let i=t;for(let r of e)i+="\0"+(typeof r=="string"?r:JSON.stringify(r));return i}function Di(t,e){return(...i)=>{let r=mf;if(r===null)return e(...i);let n=vf(`async:${t}`,i),a=r.entries.get(n);if(a)return a.value;let o=e(...i).catch(s=>{throw r.entries.delete(n),s});return r.entries.set(n,{value:o}),o}}import{readFileSync as gf}from"fs";import ws from"path";var wf=new Set(["applypatch","create","createfile","deletefile","edit","editfile","patch","strreplaceeditor","write","writefile","writefiletool"]),yf=new Set(["glob","grep","listfiles","read","readfile","search","view"]),Ns=["file_path","filePath","path","target_file","targetFile"],bs=["file_paths","filePaths","paths","files","targets"],ks=["operations","edits"],Nf=["patch","diff","patchText","patch_text","changes"];function Ln(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function ys(t){return t.toLowerCase().replace(/[^a-z0-9]+/gu,"")}function bf(t){for(let e of["tool_name","toolName","tool","name"]){let i=t[e];if(typeof i=="string"&&i.trim())return i.trim()}return null}function kf(t){for(let e of["cwd","working_directory","workspaceRoot"]){let i=t[e];if(!(typeof i!="string"||!i.trim()||!ws.isAbsolute(i.trim())))return ws.resolve(i.trim())}}function Sf(t){if(typeof t!="string")return t;let e=t.trim();if(!e.startsWith("{")&&!e.startsWith("["))return t;try{return JSON.parse(e)}catch{return t}}function Ef(t){for(let e of["tool_input","toolInput","toolArgs","tool_args","arguments"])if(t[e]!==void 0)return Sf(t[e]);return t}function Bn(t){let e=[],i=[/^\*\*\* (?:Add|Update|Delete) File:\s+(.+?)\s*$/gmu,/^\+\+\+\s+(?:b\/)?(.+?)\s*$/gmu];for(let r of i)for(let n of t.matchAll(r)){let a=n[1]?.trim();a&&a!=="/dev/null"&&e.push(a)}return e}function Xe(t,e){if(typeof e=="string"){let i=e.trim();i&&t.push(i);return}if(Array.isArray(e)){for(let i of e)Xe(t,i);return}if(Ln(e)){for(let i of Ns)Xe(t,e[i]);for(let i of bs)Xe(t,e[i]);for(let i of ks)Xe(t,e[i])}}function Pf(t,e){let i=[],r=[e,t].filter(Ln);for(let n of r){for(let a of Ns)Xe(i,n[a]);for(let a of bs)Xe(i,n[a]);for(let a of ks)Xe(i,n[a]);for(let a of Nf){let o=n[a];typeof o=="string"&&i.push(...Bn(o))}}return typeof e=="string"&&i.push(...Bn(e)),[...new Set(i)]}function Mt(t,e){if(e?.trim())return{intent:"write",targets:[e.trim()],toolName:null};if(!t.trim())return{intent:"unknown",targets:[],toolName:null};let i;try{i=JSON.parse(t)}catch{let o=Bn(t);return o.length>0?{intent:"write",targets:[...new Set(o)],toolName:"apply_patch"}:{intent:"unknown",targets:[],toolName:null}}if(!Ln(i))return{intent:"unknown",targets:[],toolName:null};let r=bf(i),n=Pf(i,Ef(i)),a=kf(i);return r&&wf.has(ys(r))?{intent:n.length>0?"write":"unknown",targets:n,toolName:r,...a?{cwd:a}:{}}:r&&yf.has(ys(r))?{intent:"non-write",targets:[],toolName:r,...a?{cwd:a}:{}}:r?{intent:"unknown",targets:n,toolName:r,...a?{cwd:a}:{}}:{intent:n.length>0?"write":"unknown",targets:n,toolName:null,...a?{cwd:a}:{}}}function Ss(){let t=process.env.FILE_PATH;if(t?.trim()||process.stdin.isTTY)return Mt("",t);try{return Mt(gf(0,"utf8"),t)}catch{return Mt("",t)}}var ns=Lt(Rt(),1);import{promises as uN}from"fs";import dt from"path";import{execFileSync as Zv}from"child_process";import Dr from"path";function Hr(t,e){return Zv("git",["-C",t,...e],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function eg(t,e){let i=Dr.normalize(t),r=Dr.normalize(e);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function Ae(t){try{let e=Dr.resolve(Hr(t,["rev-parse","--show-toplevel"])),r=Hr(t,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),n=r?Dr.resolve(r.slice(9)):e,a=null;try{a=Hr(t,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!eg(e,n),currentWorktreeRoot:e,primaryWorktreeRoot:n,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function bo(t,e){try{let i=Hr(t,["rev-parse","--verify",`${e}^{commit}`]).toLowerCase();return/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(i)?i:null}catch{return null}}import{createHash as ng}from"node:crypto";import{promises as oe}from"node:fs";import X from"node:path";import{TextDecoder as ag}from"node:util";var tg=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),ig=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function rg(t){return t.toLowerCase().startsWith(".env")}function gi(t){let i=t.replaceAll("\\","/").split("/").filter(Boolean).map(r=>r.toLowerCase());return i.some(r=>rg(r))?"environment-file":i.some(r=>ig.has(r))?"credential-config":i.includes(".git")?"git-metadata":i.some(r=>tg.has(r))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}function Je(t){return t!==0&&t!==0n&&t!=="0"}function U(t,e){return Je(t.dev)&&Je(e.dev)&&Je(t.ino)&&Je(e.ino)}function _(t,e){let i=Je(t.dev)&&Je(e.dev);if(i&&t.dev!==e.dev)return!1;let r=Je(t.ino)&&Je(e.ino);return r&&t.ino!==e.ino?!1:i&&r?!0:t.birthtime===e.birthtime}var Lr=1024*1024;function ko(t,e){let i=X.relative(t,e);return i===""||!X.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${X.sep}`)}function og(t){let e=X.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(n=>{let a=n.codePointAt(0)??0;return a<=31||a===127})||X.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let i=t.toLowerCase(),r=gi(t);if(r||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${r??"native-runtime"}): ${t}`);return t}function sg(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function cg(t,e){return _({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Br(t,e){let i={...t,birthtime:t.birthtimeMs},r={...e,birthtime:e.birthtimeMs};return U(i,r)?_(i,r):_(i,r)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function fu(t){let e=await oe.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await oe.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function lg(t,e){let i=X.resolve(t),r=X.resolve(e);if(!ko(i,r))throw new Error("Native artifact path is outside its root");let n=[await fu(i)],a=i;for(let o of X.relative(i,r).split(X.sep).filter(Boolean)){a=X.join(a,o);let s=await fu(a);if(!ko(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);n.push(s)}return n}async function hu(t){for(let e of t){let i=await oe.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!cg(e,i)||await oe.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function Q(t){let e=og(t.ref),i=t.maxBytes===null?null:sg(t.maxBytes??Lr),r=X.resolve(t.root,...e.split("/")),n=await lg(t.root,X.dirname(r));await t.hooks?.afterParentChainCaptured?.();let a=await oe.lstat(r);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(i!==null&&a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);let o=await oe.realpath(r);if(!ko(n[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${e}`);let s=await oe.open(r,"r");try{let[c,l,u]=await Promise.all([s.stat(),oe.lstat(r),oe.realpath(r)]);if(await hu(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||u!==o||!Br(a,c)||!Br(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let d=[],f=0,p=Buffer.allocUnsafe(i===null?64*1024:Math.min(64*1024,i+1));for(;;){let k=i===null?p.length:i+1-f,S=await s.read(p,0,Math.min(p.length,k),null);if(S.bytesRead===0)break;if(f+=S.bytesRead,i!==null&&f>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);d.push(Buffer.from(p.subarray(0,S.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[g,h,m]=await Promise.all([s.stat(),oe.lstat(r),oe.realpath(r)]);if(await hu(n),!h.isFile()||h.isSymbolicLink()||m!==o||!Br(c,g)||!Br(c,h))throw new Error(`Native artifact changed while reading: ${e}`);let y=Buffer.concat(d,f),N;try{N=new ag("utf-8",{fatal:!0}).decode(y)}catch(k){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:k})}return{ref:e,size:f,hash:t.includeHash===!1?null:ng("sha256").update(y).digest("hex"),text:N}}finally{await s.close()}}import{randomUUID as ug}from"crypto";import{promises as L}from"fs";import se from"path";function Eo(t,e){let i=se.relative(t,e);return i===""||!se.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${se.sep}`)}function dg(t,e){return _({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function So(t,e){let i={...t,birthtime:t.birthtimeMs},r={...e,birthtime:e.birthtimeMs};return U(i,r)?_(i,r):_(i,r)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function pu(t){let e=await L.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await L.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function wi(t){for(let e of t){let i=await L.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!dg(e,i)||await L.realpath(e.path)!==e.realPath)throw new Error(`Native atomic write parent changed before commit: ${e.path}`)}}async function fg(t,e){let i=se.resolve(t),r=se.resolve(e);if(!Eo(i,r))throw new Error(`Native atomic write parent is outside its managed root: ${e}`);let n=[await pu(i)],a=se.relative(i,r).split(se.sep).filter(Boolean),o=i;for(let s of a){await wi(n),o=se.join(o,s);try{await L.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await pu(o);if(!Eo(n[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);n.push(c)}return await wi(n),n}async function hg(t){let e;try{e=await L.open(t,"r"),await e.sync()}catch(i){let r=i.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw i}finally{await e?.close()}}async function pg(t,e,i={}){let r=se.dirname(t),n=i.containedRoot?await fg(i.containedRoot,r):null;n||await L.mkdir(r,{recursive:!0});let a=se.join(r,`.${se.basename(t)}.${ug()}.tmp`),o,s;try{if(await i.beforeTemporaryOpen?.(),o=await L.open(a,"wx"),s=await o.stat(),n){let[c,l]=await Promise.all([L.lstat(a),L.realpath(a)]);if(await wi(n),!c.isFile()||c.isSymbolicLink()||!So(s,c)||!Eo(n[0].realPath,l))throw new Error("Native 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(),!So(s,await o.stat()))throw new Error("Native atomic write temporary file changed while writing");if(await o.close(),o=void 0,await i.beforeCommit?.(),n){await wi(n);let c=await L.lstat(a);if(!c.isFile()||c.isSymbolicLink()||!s||!So(c,s))throw new Error("Native atomic write temporary file changed before commit")}i.exclusive?(await L.link(a,t),await L.unlink(a)):await L.rename(a,t),await hg(r)}catch(c){if(await o?.close(),!n)await L.rm(a,{force:!0});else try{await wi(n),await L.rm(a,{force:!0})}catch{}throw c}}async function we(t,e,i={}){await pg(t,e,i)}async function ye(t,e,i={}){await we(t,JSON.stringify(e,null,2)+`
143
+ `,i)}var xo=Lt(Rt(),1);import Mr from"path";var yi=64*1024,Fr=1024,Vr=64,vu=5,mg=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/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/**"],vg=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],gg=[...mg,...vg].sort((t,e)=>t.localeCompare(e,"en"));var Ne={include:["**/*"],exclude:[...gg],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4};function wg(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim();if(i.length===0||Mr.posix.isAbsolute(i)||Mr.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be a project-relative path`);if(i===".")return[];let r=i.replaceAll("\\","/").split("/");if(r.some(n=>n===".."))throw new Error(`${e} must stay inside the project root`);if(r.some(n=>n===""||n==="."))throw new Error(`${e} must not contain empty or dot path segments`);return r}function At(t){let e=wg(t,"native.artifact_root");return e.length===0?".":e.join("/")}function gu(t,e="docs"){let i=t??e;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function qr(t,e,i=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||Mr.posix.isAbsolute(r)||Mr.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let n=r.split("/");if(n.some(a=>a===".."))throw new Error(`${e} must stay inside its declared path base`);if(n.some(a=>a===""||a==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return n.join("/")}function _t(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function wu(t,e,i){let r=t??e;if(r!=="en"&&r!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return r}function Wr(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>Fr)throw new Error(`${e} exceeds ${Fr} characters`);let i=0;for(let r=0;r<t.length;r+=1)t[r]==="?"?i+=1:t[r]==="*"&&(i+=1,t[r+1]==="*"&&(r+=1));if(i>Vr)throw new Error(`${e} contains more than ${Vr} wildcard tokens`);return t}function mu(t,e,i){if(t===void 0)return[...i];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(r=>Wr(r,e)))].sort((r,n)=>r.localeCompare(n,"en"))}function Po(t,e,i){let r=t??e;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${i} must be a positive integer`);return r}function yg(t){if(t===void 0)return{...Ne,include:[...Ne.include],exclude:[...Ne.exclude]};let e=_t(t,"native.snapshot");return{include:mu(e.include,"native.snapshot.include",Ne.include),exclude:mu(e.exclude,"native.snapshot.exclude",Ne.exclude),max_files:Po(e.max_files,Ne.max_files,"native.snapshot.max_files"),max_total_bytes:Po(e.max_total_bytes,Ne.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Po(e.max_duration_ms,Ne.max_duration_ms,"native.snapshot.max_duration_ms")}}function Ng(t){if(t===void 0)return;let e=_t(t,"native.pending_root_move"),i=e.id,r=e.from_artifact_root,n=e.to_artifact_root,a=e.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof r!="string"||typeof n!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let s=_t(e.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,u=s.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 u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:u}}return{id:i,fromArtifactRoot:At(r),toArtifactRoot:At(n),stage:a,...o?{cleanup:o}:{}}}function bg(t,e={}){let i=_t(t,"native"),r=i.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let n=i.clarification_mode??"batch";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=i.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=i.max_verify_failures??vu;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Ng(i.pending_root_move);return{artifact_root:At(r),language:wu(i.language,"en","native.language"),clarification_mode:n,archive_confirmation:a,max_verify_failures:o,snapshot:yg(i.snapshot),...s?{pending_root_move:s}:{}}}function kg(t){let e=_t(t,"classic"),i=e.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let r=e.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=e.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:gu(e.artifact_layout),language:wu(e.language,"zh-CN","classic.language"),context_compression:i,review_mode:r,auto_transition:n}}function Sg(t){let i=_t(t,"hook").allow_paths??[];if(!Array.isArray(i))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(i.map((r,n)=>qr(r,`hook.allow_paths[${n}]`)))]}}function Eg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Pg(t,e,i,r,n,a){let o=t.schema!==void 0;if(!(o||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!o)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 c=t.workflows??[t.default_workflow];if(!Array.isArray(c)||c.length===0||c.some(u=>u!=="native"&&u!=="classic"))throw new Error("workflows must contain native and/or classic");let l=[...new Set(c)];if(!l.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(l.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:l,ambient_resume:n,...e?{hook:e}:{},...i?{native:i}:{},...r?{classic:r}:{}}}function Ni(t,e={}){let i=(0,xo.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let r=i.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let n=r,a=Eg(n.ambient_resume),o=n.hook===void 0?void 0:Sg(n.hook),s=n.native===void 0?void 0:bg(n.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),c=n.classic===void 0?void 0:kg(n.classic),l=Pg(n,o,s,c,a,{allowPartialProject:e.allowPartialProject??!1});return{value:n,config:l,ambient_resume:a,...o?{hook:o}:{},...s?{native:s}:{},...c?{classic:c}:{}}}import{createHash as Cg}from"crypto";import{promises as Gr}from"fs";import Ge from"path";import{constants as zr,promises as nt}from"fs";var ce=class extends Error{reason;constructor(e,i,r){super(i,r),this.name="RaceSafeReadError",this.reason=e}};function Co(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function yu(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function bi(t){return{dev:t.dev,ino:t.ino,birthtime:Co(t)}}function Jr(t,e){let i=bi(t),r=bi(e);return U(i,r)?_(i,r):_(i,r)&&Co(t)===Co(e)&&yu(t)===yu(e)&&t.size===e.size}async function at(t,e,i={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=i.label??"file",n=i.bigint===!0,a=await nt.lstat(t,{bigint:n});if(!a.isFile()||a.isSymbolicLink())throw new ce("not-regular-file",`${r} must be a regular file`);if(BigInt(a.size)>BigInt(e))throw new ce("too-large",`${r} exceeds ${e} bytes`);let o=await nt.realpath(t);await i.verify?.("pre-open",{realPath:o,identity:bi(a)});let s=process.platform==="win32"?zr.O_RDONLY:zr.O_RDONLY|zr.O_NOFOLLOW|zr.O_NONBLOCK,c;try{c=await nt.open(t,s)}catch(l){throw l.code==="ELOOP"?new ce("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,u,d]=await Promise.all([c.stat({bigint:n}),nt.lstat(t,{bigint:n}),nt.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||d!==o||!Jr(a,l)||!Jr(a,u))throw new ce("changed",`${r} changed while opening`);await i.verify?.("post-open",{realPath:d,identity:bi(l)}),await i.hooks?.afterOpen?.();let f=[],p=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let N=e+1-p,{bytesRead:k}=await c.read(g,0,Math.min(g.length,N),null);if(k===0)break;if(p+=k,p>e)throw new ce("too-large",`${r} exceeds ${e} bytes`);f.push(Buffer.from(g.subarray(0,k)))}await i.hooks?.beforeFinalCheck?.();let[h,m,y]=await Promise.all([c.stat({bigint:n}),nt.lstat(t,{bigint:n}),nt.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||y!==o||!Jr(a,h)||!Jr(a,m))throw new ce("changed",`${r} changed while reading`);return await i.verify?.("post-read",{realPath:y,identity:bi(h)}),{bytes:Buffer.concat(f,p),stat:h,realPath:y}}finally{await c.close()}}function xg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Ro(t,e){let i=Ge.relative(t,e);return i===""||!Ge.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Ge.sep}`)}async function Nu(t,e){let i=Ge.resolve(t),r=await Gr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Gr.realpath(i)}async function bu(t,e,i,r){let n=t;for(let a=0;a<i.length;a++){n=Ge.join(n,i[a]);let o;try{o=await Gr.lstat(n)}catch(u){if(xg(u))return{exists:!1,kind:"missing"};throw u}let s=Ge.relative(t,n).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${r.label} ancestor ${s} must be a real directory`);if(c&&(r.expected==="file"&&!o.isFile()||r.expected==="directory"&&!o.isDirectory()||r.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await Gr.realpath(n);if(!Ro(e,l))throw new Error(`${r.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 Tt(t,e,i){let r=qr(e,i.label),n=Ge.resolve(t),a=await Nu(n,i.label),o=r.split("/"),s=Ge.resolve(n,...o);if(!Ro(n,s))throw new Error(`${i.label} must stay inside the project root`);let c=await bu(n,a,o,i);return{projectRoot:n,target:s,relative:r,exists:c.exists,kind:c.kind}}async function Ue(t,e,i,r){let n=await Tt(t,e,{label:r.label,expected:"file"});if(!n.exists){let o=new Error(`${r.label} does not exist`);throw o.code="ENOENT",o}let a=await Nu(n.projectRoot,r.label);return at(n.target,i,{...r,verify:async(o,s)=>{if(!Ro(a,s.realPath))throw new Error(`${r.label} resolves outside the project root`);await bu(n.projectRoot,a,n.relative.split("/"),{label:r.label,expected:"file"})}})}var ki=".comet/config.yaml";function Rg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Ur(t,e={}){return(await Kr(t,e)).document}async function Ag(t){try{return(await Ue(t,ki,yi,{label:ki})).bytes}catch(e){if(Rg(e))return null;throw e}}function _g(t){return t?{exists:!0,sha256:Cg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Kr(t,e={}){let i=await Ag(t);return{document:i?Ni(i.toString("utf8"),e):null,identity:_g(i)}}async function Ao(t){return(await Ur(t))?.config??null}var GS=16*1024;import{existsSync as Su,promises as ot}from"fs";import R from"path";import Og from"os";var $o=".comet/config.yaml",Hg=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;async function Io(t){try{return await ot.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Dg(t){try{let e=await ot.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function jt(t,e){let i=R.relative(t,e);return i===""||!R.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${R.sep}`)}async function It(t){let e=[],i=t;for(;!await Io(i);){let n=R.dirname(i);if(n===i)break;e.push(R.basename(i)),i=n}let r=await ot.realpath(i);return R.resolve(r,...e.reverse())}async function jo(t){try{return(await ot.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Oo(t){let e=R.resolve(t);try{(await ot.stat(e)).isDirectory()||(e=R.dirname(e))}catch(n){if(n.code!=="ENOENT")throw n}let i=e,r=R.resolve(Og.homedir());for(;;){if(!(e===r&&i!==r)){let o=R.join(e,...$o.split("/")),s=e===i||await Dg(o);if(await Io(o)&&s)return e}if(await Io(R.join(e,".git")))return e;let a=R.dirname(e);if(a===e)return i;e=a}}function Ho(t){return At(t)}async function Bg(t,e){let i=Ho(e),r=R.resolve(t,...i.split("/")),n=await ot.realpath(t),a=await It(r);if(!jt(n,a))throw new Error("native.artifact_root resolves outside the project root");return r}async function st(t,e){let i=Ho(e),r=await Bg(t,i),n=R.join(r,"comet");if(await jo(n))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([It(r),It(n)]);if(!jt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");let s=R.resolve(t),c=R.join(s,".comet","runtime","native");if(await jo(c))throw new Error("The Native Runtime root must not be a symbolic link");let[l,u]=await Promise.all([ot.realpath(s),It(c)]);if(!jt(l,u))throw new Error("The Native Runtime root resolves outside the project root");return{projectRoot:s,configFile:R.join(t,...$o.split("/")),artifactRoot:r,artifactRootRef:i,nativeRoot:n,specsDir:R.join(n,"specs"),changesDir:R.join(n,"changes"),archiveDir:R.join(n,"archive"),runtimeDir:c,changesRuntimeDir:R.join(c,"changes"),locksDir:R.join(c,"locks"),transactionsDir:R.join(c,"transactions")}}function Eu(t){if(!Hg.test(t))throw new Error(`Invalid Native change name: ${t}`)}function Ei(t,e){Eu(e);let i=R.join(t.changesRuntimeDir,e);if(!M(t.changesRuntimeDir,i))throw new Error("Native change Runtime path escaped");return i}function Lg(t,e){Eu(e);let i=R.join(t.changesDir,e,"runtime");if(!M(t.changesDir,i))throw new Error("Legacy Native change Runtime path escaped");return i}function Z(t,e){let i=Ei(t,e);if(Su(i))return i;let r=Lg(t,e);return Su(r)?r:i}function le(t,e){let i=R.resolve(e);if(M(t.runtimeDir,i))return t.runtimeDir;if(M(t.nativeRoot,i))return t.nativeRoot;throw new Error(`Path is outside Native document and Runtime roots: ${e}`)}function M(t,e){return jt(R.resolve(t),R.resolve(e))}async function T(t,e){let i=R.resolve(t),r=R.resolve(e);if(!jt(i,r))throw new Error(`Path is outside the Native root: ${e}`);if(await jo(i))throw new Error(`Native root must not be a symbolic link: ${t}`);let[n,a]=await Promise.all([It(i),It(r)]);if(!jt(n,a))throw new Error(`Path resolves outside the Native root: ${e}`);return r}var Yr=Wr;async function be(t){let e=(await Ur(t))?.config??null;return e?.native?e:null}async function Xr(t){let e=await be(t);if(e?.native.pending_root_move)throw new Error(`Native root move ${e.native.pending_root_move.id} is incomplete; use comet native doctor --repair`)}import{promises as uy}from"fs";import dy from"path";import{AsyncLocalStorage as Fg}from"async_hooks";import{randomUUID as Ru}from"crypto";import{promises as ee}from"fs";import Au from"os";import F from"path";var xu=16*1024,_u=".coordinator",Vg=5e3,Cu=new Fg,Qr=new Map;function qg(t){if(!/^[a-z][a-z0-9-]*$/u.test(t))throw new Error(`Invalid Native lock name: ${t}`);return`${t}.lock`}function Wg(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid Native lock metadata: ${e}`);let i=t;if(typeof i.id!="string"||i.id.length===0||typeof i.pid!="number"||!Number.isSafeInteger(i.pid)||i.pid<1||typeof i.hostname!="string"||i.hostname.length===0||typeof i.createdAt!="string"||i.createdAt.length===0||typeof i.operation!="string"||i.operation.length===0)throw new Error(`Invalid Native lock metadata: ${e}`);return i}function Tu(t){return{device:t.dev.toString(),inode:t.ino.toString(),size:t.size.toString(),birthtimeNs:t.birthtimeNs.toString(),ctimeNs:t.ctimeNs.toString(),mtimeNs:t.mtimeNs.toString()}}function Do(t,e){let i={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs},r={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs};return U(i,r)?_(i,r):_(i,r)&&t.size===e.size}function Bo(t,e){return Do(t,e)&&t.size===e.size&&t.birthtimeNs===e.birthtimeNs&&t.ctimeNs===e.ctimeNs&&t.mtimeNs===e.mtimeNs}async function _e(t){let e,i;try{let r=await at(t,xu,{bigint:!0,label:"Native lock"});e=r.bytes,i=r.stat}catch(r){if(r.code==="ENOENT")return null;throw r instanceof ce?r.reason==="too-large"?new Error(`Native lock metadata exceeds ${xu} bytes: ${t}`,{cause:r}):r.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${t}`,{cause:r}):new Error(`Native lock changed while reading: ${t}`,{cause:r}):r}return{file:t,owner:Wg(JSON.parse(e.toString("utf8")),t),identity:Tu(i)}}async function zg(t){return(await _e(t))?.owner??null}function Iu(t){if(!t)return{status:"missing",owner:null,identity:null};if(t.owner.hostname!==Au.hostname())return{status:"unknown",owner:t.owner,identity:t.identity};let e=Xg(t.owner.pid);return{status:e===!0?"active":e===!1?"stale":"unknown",owner:t.owner,identity:t.identity}}async function Jg(t,e){try{await ee.lstat(e);return}catch(i){if(i.code!=="ENOENT")throw i}try{await ee.rename(t,e)}catch(i){if(i.code!=="ENOENT")throw i}}async function Lo(t,e){let i=await _e(t.file);if(!i)return"missing";if(i.owner.id!==t.owner.id)throw new Error(`Native lock ownership changed: ${t.file}`);if(!Bo(i.identity,t.identity))throw new Error(`Native lock identity changed: ${t.file}`);await ee.mkdir(e,{recursive:!0});let r=F.join(e,`${F.basename(t.file)}.${t.owner.id}.${Ru()}.removed`);try{await ee.rename(t.file,r)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let n=await _e(r);if(!n||n.owner.id!==t.owner.id||!Do(n.identity,t.identity))throw await Jg(r,t.file),new Error(`Native lock changed before quarantine: ${t.file}`);return await ee.rm(r,{force:!0}),"removed"}function ju(t){return{id:Ru(),pid:process.pid,hostname:Au.hostname(),createdAt:new Date().toISOString(),operation:t}}async function $u(t,e){let i;try{i=await ee.open(t,"wx")}catch(r){if(r.code==="EEXIST"){let n=await zg(t);throw new Error(`Native lock is already held: ${t}${n?` by pid ${n.pid} for ${n.operation}`:""}`,{cause:r})}throw r}try{return await i.writeFile(JSON.stringify(e,null,2)+`
144
+ `,"utf8"),await i.sync(),Tu(await i.stat({bigint:!0}))}finally{await i.close()}}async function Gg(t,e){let i=await T(t.runtimeDir,t.locksDir);await ee.mkdir(i,{recursive:!0});let r=await T(t.runtimeDir,F.join(i,_u));await ee.mkdir(r,{recursive:!0});let n=ju(e),a=F.join(r,`.${n.id}.tmp`),o=F.join(r,`${n.id}.claim`);try{let s=await $u(a,n);await ee.rename(a,o);let c=await _e(o);if(!c||!Do(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:t.runtimeDir,locksDir:i,owner:n,identity:c.identity}}finally{await ee.rm(a,{force:!0})}}async function Ug(t){let e=F.dirname(t.file),i=!1,r=F.basename(t.file);for(let n of await ee.readdir(e,{withFileTypes:!0})){if(!n.isFile()||n.isSymbolicLink()||!n.name.endsWith(".claim"))continue;let a=F.join(e,n.name);if(F.resolve(a)!==F.resolve(t.file))try{let o=await _e(a),s=Iu(o);if(s.status==="missing")continue;if(s.status==="stale"&&o){await Lo(o,e);continue}n.name<r&&(i=!0)}catch{n.name<r&&(i=!0)}}return i}async function Ou(t){let e=await _e(t.file);if(e){if(e.owner.id!==t.owner.id||!Bo(e.identity,t.identity))throw new Error(`Native lock coordinator ownership changed: ${t.file}`);await Lo(e,F.dirname(t.file))}}async function Kg(t,e){let i=Date.now()+Vg;for(;;){let r=await Gg(t,e);if(!await Ug(r))return r;if(await Ou(r),Date.now()>=i)throw new Error(`Native lock coordinator is busy: ${t.locksDir}`);await new Promise(n=>setTimeout(n,2+Math.floor(Math.random()*7)))}}async function Yg(t){let e=Qr.get(t)??Promise.resolve(),i,r=new Promise(a=>{i=a}),n=e.then(()=>r);return Qr.set(t,n),await e,()=>{i(),Qr.get(t)===n&&Qr.delete(t)}}async function Hu(t,e,i){let r=F.resolve(t.locksDir),n=Cu.getStore();if(n?.has(r))return i();let a=await Yg(r);try{let o=await Kg(t,e),s=new Map(n??[]);return s.set(r,o),await Cu.run(s,async()=>{try{return await i()}finally{await Ou(o)}})}finally{a()}}async function Zr(t,e,i){return Hu(t,`acquire ${e}`,async()=>{let r=await T(t.runtimeDir,t.locksDir);await ee.mkdir(r,{recursive:!0});let n=await T(t.runtimeDir,F.join(r,qg(e))),a=ju(i),o=await $u(n,a);return{file:n,nativeRoot:t.runtimeDir,locksDir:r,owner:a,identity:o}})}async function en(t){await _e(t.file)&&await Hu({runtimeDir:t.nativeRoot,locksDir:t.locksDir},`release ${F.basename(t.file)}`,async()=>{let e=await _e(t.file);if(!e)return;if(e.owner.id!==t.owner.id)throw new Error(`Native lock ownership changed: ${t.file}`);if(!Bo(e.identity,t.identity))throw new Error(`Native lock identity changed: ${t.file}`);let i=F.join(t.locksDir,_u);await Lo(e,i)})}function Xg(t){try{return process.kill(t,0),!0}catch(e){let i=e.code;return i==="ESRCH"?!1:i==="EPERM"?!0:null}}async function Du(t){return Iu(await _e(t))}import Hw from"node:path";import{createHash as Qg}from"crypto";function ue(t){throw new TypeError(`Value is not valid canonical JSON: ${t}`)}function Zg(t,e){e.has(t)&&ue("cyclic structures are not supported"),e.add(t);try{let i=Object.keys(t);for(let r=0;r<t.length;r+=1)Object.prototype.hasOwnProperty.call(t,r)||ue("sparse arrays are not supported");return(i.length!==t.length||i.some((r,n)=>r!==String(n)))&&ue("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(t).length>0&&ue("symbol properties are not supported"),`[${t.map(r=>Mo(r,e)).join(",")}]`}finally{e.delete(t)}}function ew(t,e){let i=Object.getPrototypeOf(t);i!==Object.prototype&&i!==null&&ue("only plain objects are supported"),e.has(t)&&ue("cyclic structures are not supported"),Object.getOwnPropertySymbols(t).length>0&&ue("symbol properties are not supported"),e.add(t);try{let r=Object.getOwnPropertyDescriptors(t);return`{${Object.keys(t).sort().map(o=>{let s=r[o];return(!s||!("value"in s))&&ue("accessor properties are not supported"),`${JSON.stringify(o)}:${Mo(s.value,e)}`}).join(",")}}`}finally{e.delete(t)}}function Mo(t,e){if(t===null)return"null";switch(typeof t){case"boolean":return t?"true":"false";case"string":return JSON.stringify(t);case"number":return Number.isFinite(t)||ue("numbers must be finite"),JSON.stringify(Object.is(t,-0)?0:t);case"object":return Array.isArray(t)?Zg(t,e):ew(t,e);case"bigint":case"function":case"symbol":case"undefined":return ue(`${typeof t} values are not supported`)}return ue("unsupported value type")}function Fo(t){return Mo(t,new Set)}function te(t,e){if(t.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(t))throw new TypeError("Canonical hash tag must not contain a line break");return Qg("sha256").update(`${t}
145
+ ${Fo(e)}`).digest("hex")}var xE=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),Bu=Object.freeze({maxCriteria:1024});var nn=Lt(Rt(),1);import{promises as aw}from"node:fs";var Pi="comet.native.v4",xi="comet.native.local-execution.v4";var ow=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,sw=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,cw=/^A[1-9][0-9]*$/u,lw=/^[a-f0-9]{64}$/u,uw=new Set(["schema","name","language","phase","status","state_version","brief","children_contract_hash","spec_changes","workspace","loop","acceptance","builder_handoff","blockers","verification","history","history_overflow","verification_result","verification_report","archived","created_at"]),rn=class extends Error{constructor(i,r){super(`Native state version conflict: expected ${i}, got ${r}`);this.expectedStateVersion=i;this.actualStateVersion=r;this.name="NativePortableStateVersionConflictError"}expectedStateVersion;actualStateVersion;code="native-state-version-conflict"};function z(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function J(t,e,i){let r=Object.keys(t).filter(n=>!e.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function B(t,e,i){if(typeof t!="string"||!i?.empty&&t.length===0)throw new Error(`${e} must be ${i?.empty?"a string":"a non-empty string"}`);return t}function qo(t,e){return t===null?null:B(t,e)}function dw(t,e){let i=B(t,e);if(!lw.test(i))throw new Error(`${e} must be a SHA-256 hash`);return i}function $t(t,e){if(typeof t!="boolean")throw new Error(`${e} must be a boolean`);return t}function I(t,e,i=0){if(!Number.isSafeInteger(t)||t<i)throw new Error(`${e} must be a safe integer greater than or equal to ${i}`);return t}function fw(t,e){return t===null?null:I(t,e,Number.MIN_SAFE_INTEGER)}function D(t,e,i){if(typeof t!="string"||!e.includes(t))throw new Error(`${i} must be one of: ${e.join(", ")}`);return t}function ke(t,e,i){if(!Array.isArray(t))throw new Error(`${e} must be an array`);return t.map((r,n)=>i(r,n))}function an(t,e){return ke(t,e,(i,r)=>B(i,`${e}[${r}]`))}function ct(t,e){if(new Set(t).size!==t.length)throw new Error(`${e} must be unique`)}function Ot(t,e){let i=B(t,e);if(Number.isNaN(Date.parse(i)))throw new Error(`${e} must be an ISO date or timestamp`);return i}function Wo(t,e,i=!1){let r=B(t,e);if(r.includes("\\")||r.startsWith("/")||/^[A-Za-z]:/u.test(r)||r.split("/").includes("..")||!i&&(r==="."||r.split("/").includes(".")))throw new Error(`${e} must be a portable relative path`);return r}function de(t,e){let i=z(t,e);return J(i,new Set(["text","truncated"]),e),{text:B(i.text,`${e}.text`,{empty:!0}),truncated:$t(i.truncated,`${e}.truncated`)}}function hw(t,e){let i=`Native spec_changes[${e}]`,r=z(t,i);J(r,new Set(["capability","operation","source"]),i);let n=B(r.capability,`${i}.capability`);if(!sw.test(n))throw new Error(`${i}.capability is invalid`);let a=D(r.operation,["create","modify","remove"],`${i}.operation`),o=r.source===null?null:Wo(r.source,`${i}.source`);if(a==="remove"&&o!==null)throw new Error(`${i} remove requires source null`);if(a!=="remove"&&o===null)throw new Error(`${i} ${a} requires a source`);return{capability:n,operation:a,source:o}}function pw(t){let e="Native workspace",i=z(t,e);J(i,new Set(["isolation","change_branch","target_branch","finish"]),e);let r=D(i.isolation,["current","branch","worktree"],`${e}.isolation`),n=qo(i.change_branch,`${e}.change_branch`),a=qo(i.target_branch,`${e}.target_branch`),o=i.finish===null?null:D(i.finish,["merge","push","pull-request","keep"],`${e}.finish`);if(r==="current"&&o!==null)throw new Error("Native current workspace cannot contain a finish action");if(r==="current"&&n===null!=(a===null))throw new Error("Native workspace branch bindings must both be present or both be null");if(r!=="current"&&(n===null||a===null))throw new Error("Native isolated workspace requires change_branch and target_branch");return{isolation:r,change_branch:n,target_branch:a,finish:o}}function mw(t){let e="Native loop",i=z(t,e);J(i,new Set(["stage","goal_cycle","iteration","attempt","retry_epoch","failed_iteration_count","no_progress_count","execution_failure_count","previous_unresolved_ids","next_action"]),e);let r=an(i.previous_unresolved_ids,`${e}.previous_unresolved_ids`);return ct(r,`${e}.previous_unresolved_ids`),{stage:D(i.stage,["shape","building","verify-ready","repairing","archive-ready","await-user","blocked","done"],`${e}.stage`),goal_cycle:I(i.goal_cycle,`${e}.goal_cycle`,1),iteration:I(i.iteration,`${e}.iteration`),attempt:I(i.attempt,`${e}.attempt`),retry_epoch:I(i.retry_epoch,`${e}.retry_epoch`),failed_iteration_count:I(i.failed_iteration_count,`${e}.failed_iteration_count`),no_progress_count:I(i.no_progress_count,`${e}.no_progress_count`),execution_failure_count:I(i.execution_failure_count,`${e}.execution_failure_count`),previous_unresolved_ids:r,next_action:qo(i.next_action,`${e}.next_action`)}}function vw(t,e){let i=`Native acceptance[${e}]`,r=z(t,i);J(r,new Set(["id","source","text","result","reason"]),i);let n=B(r.id,`${i}.id`);if(!cw.test(n))throw new Error(`${i}.id must use A1, A2, ...`);return{id:n,source:Wo(r.source,`${i}.source`),text:B(r.text,`${i}.text`),result:D(r.result,["pending","passed","failed","blocked"],`${i}.result`),reason:r.reason===null?null:de(r.reason,`${i}.reason`)}}function gw(t,e){let i=`Native builder_handoff.checks[${e}]`,r=z(t,i);return J(r,new Set(["name","result","note"]),i),{name:de(r.name,`${i}.name`),result:D(r.result,["passed","failed","not-run"],`${i}.result`),note:r.note===null?null:de(r.note,`${i}.note`)}}function ww(t){let e="Native builder_handoff",i=z(t,e);J(i,new Set(["candidate_id","identity_provider","builder_execution_ref","iteration","summary","addressed_acceptance_ids","checks","checks_truncated","known_limits","known_limits_truncated","submitted_at"]),e);let r=an(i.addressed_acceptance_ids,`${e}.addressed_acceptance_ids`);return ct(r,`${e}.addressed_acceptance_ids`),{candidate_id:B(i.candidate_id,`${e}.candidate_id`),identity_provider:B(i.identity_provider,`${e}.identity_provider`),builder_execution_ref:B(i.builder_execution_ref,`${e}.builder_execution_ref`),iteration:I(i.iteration,`${e}.iteration`,1),summary:de(i.summary,`${e}.summary`),addressed_acceptance_ids:r,checks:ke(i.checks,`${e}.checks`,gw),checks_truncated:$t(i.checks_truncated,`${e}.checks_truncated`),known_limits:ke(i.known_limits,`${e}.known_limits`,(n,a)=>de(n,`${e}.known_limits[${a}]`)),known_limits_truncated:$t(i.known_limits_truncated,`${e}.known_limits_truncated`),submitted_at:Ot(i.submitted_at,`${e}.submitted_at`)}}function yw(t,e){let i=`Native blockers[${e}]`,r=z(t,i);J(r,new Set(["owner","reason","acceptance_ids","resolution_action"]),i);let n=an(r.acceptance_ids,`${i}.acceptance_ids`);return ct(n,`${i}.acceptance_ids`),{owner:D(r.owner,["builder","runtime","verifier","user","external"],`${i}.owner`),reason:de(r.reason,`${i}.reason`),acceptance_ids:n,resolution_action:D(r.resolution_action,["return-build","retry-verifier","resolve-verifier-blocker","confirm-verifier-unavailable","await-user","wait-external"],`${i}.resolution_action`)}}function Nw(t,e){let i=`Native verification.checks[${e}]`,r=z(t,i);return J(r,new Set(["id","name","argv_display","argv_truncated","cwd_ref","status","exit_code","duration_ms"]),i),{id:B(r.id,`${i}.id`),name:de(r.name,`${i}.name`),argv_display:ke(r.argv_display,`${i}.argv_display`,(n,a)=>de(n,`${i}.argv_display[${a}]`)),argv_truncated:$t(r.argv_truncated,`${i}.argv_truncated`),cwd_ref:Wo(r.cwd_ref,`${i}.cwd_ref`,!0),status:D(r.status,["passed","failed","interrupted"],`${i}.status`),exit_code:fw(r.exit_code,`${i}.exit_code`),duration_ms:I(r.duration_ms,`${i}.duration_ms`)}}function bw(t){let e="Native verification",i=z(t,e);J(i,new Set(["candidate_id","identity_provider","verifier_execution_ref","iteration","attempt","assurance","verdict","checks","summary","risks","risks_truncated","completed_at"]),e);let r=ke(i.checks,`${e}.checks`,Nw);ct(r.map(a=>a.id),`${e}.checks IDs`);let n=B(i.identity_provider,`${e}.identity_provider`);return{candidate_id:B(i.candidate_id,`${e}.candidate_id`),identity_provider:n,verifier_execution_ref:B(i.verifier_execution_ref,`${e}.verifier_execution_ref`),iteration:I(i.iteration,`${e}.iteration`,1),attempt:I(i.attempt,`${e}.attempt`,1),assurance:i.assurance===void 0?n==="skill-coordinated"?"skill-coordinated":"host-attested":D(i.assurance,["host-attested","skill-coordinated","semantic-verification-unavailable","user-confirmed-degraded"],`${e}.assurance`),verdict:D(i.verdict,["pass","fail","blocked"],`${e}.verdict`),checks:r,summary:de(i.summary,`${e}.summary`),risks:ke(i.risks,`${e}.risks`,(a,o)=>de(a,`${e}.risks[${o}]`)),risks_truncated:$t(i.risks_truncated,`${e}.risks_truncated`),completed_at:Ot(i.completed_at,`${e}.completed_at`)}}function Lu(t,e){let i=`Native history[${e}]`,r=z(t,i);J(r,new Set(["goal_cycle","iteration","attempt","outcome","unresolved_ids","summary","completed_at"]),i);let n=an(r.unresolved_ids,`${i}.unresolved_ids`);return ct(n,`${i}.unresolved_ids`),{goal_cycle:I(r.goal_cycle,`${i}.goal_cycle`,1),iteration:I(r.iteration,`${i}.iteration`),attempt:I(r.attempt,`${i}.attempt`),outcome:D(r.outcome,["pass","fail","blocked","execution-error","recovery"],`${i}.outcome`),unresolved_ids:n,summary:de(r.summary,`${i}.summary`),completed_at:Ot(r.completed_at,`${i}.completed_at`)}}function kw(t){let e="Native history_overflow.outcome_counts",i=z(t,e),r=["pass","fail","blocked","execution-error","recovery"];return J(i,new Set(r),e),{pass:I(i.pass,`${e}.pass`),fail:I(i.fail,`${e}.fail`),blocked:I(i.blocked,`${e}.blocked`),"execution-error":I(i["execution-error"],`${e}.execution-error`),recovery:I(i.recovery,`${e}.recovery`)}}function Sw(t){let e="Native history_overflow",i=z(t,e);J(i,new Set(["dropped_entries","first_dropped_at","last_dropped_at","outcome_counts"]),e);let r=I(i.dropped_entries,`${e}.dropped_entries`),n=i.first_dropped_at===null?null:Ot(i.first_dropped_at,`${e}.first_dropped_at`),a=i.last_dropped_at===null?null:Ot(i.last_dropped_at,`${e}.last_dropped_at`);if(r===0&&(n!==null||a!==null))throw new Error("Native empty history overflow cannot contain dropped timestamps");if(r>0&&(n===null||a===null))throw new Error("Native non-empty history overflow requires dropped timestamps");let o=kw(i.outcome_counts);if(Object.values(o).reduce((c,l)=>c+l,0)!==r)throw new Error("Native history overflow outcome count must equal dropped_entries");return{dropped_entries:r,first_dropped_at:n,last_dropped_at:a,outcome_counts:o}}function Ew(t){let e=new Set(t.acceptance.map(i=>i.id));for(let i of t.loop.previous_unresolved_ids)if(!e.has(i))throw new Error(`Native loop references unknown acceptance ID ${i}`);for(let i of t.builder_handoff?.addressed_acceptance_ids??[])if(!e.has(i))throw new Error(`Native builder handoff references unknown ID ${i}`);for(let i of t.blockers)for(let r of i.acceptance_ids)if(!e.has(r))throw new Error(`Native blocker references unknown ID ${r}`);if(t.builder_handoff&&!(t.builder_handoff.iteration===t.loop.iteration||t.phase==="build"&&t.loop.stage==="repairing"&&t.builder_handoff.iteration===t.loop.iteration-1))throw new Error("Native builder handoff iteration is not current or the prior repair result");if(t.verification){if(!t.builder_handoff)throw new Error("Native verification requires a builder handoff");if(t.verification.candidate_id!==t.builder_handoff.candidate_id)throw new Error("Native verification candidate must match the builder handoff");if(t.verification.identity_provider!==t.builder_handoff.identity_provider)throw new Error("Native Builder and Verifier identity providers must match");if(["skill-coordinated","semantic-verification-unavailable","user-confirmed-degraded"].includes(t.verification.assurance)!==(t.verification.identity_provider==="skill-coordinated"))throw new Error("Native verification assurance does not match its identity provider");if(t.verification.assurance==="semantic-verification-unavailable"&&t.verification.verdict!=="blocked")throw new Error("Native unavailable semantic verification must remain blocked");if(t.verification.assurance==="user-confirmed-degraded"&&t.verification.verdict!=="pass")throw new Error("Native user-confirmed degraded verification must be passing");if(t.verification.verifier_execution_ref===t.builder_handoff.builder_execution_ref)throw new Error("Native Builder and Verifier execution refs must differ");let r=t.verification.iteration===t.loop.iteration&&t.verification.attempt===t.loop.attempt,n=t.phase==="build"&&t.loop.stage==="repairing"&&t.verification.iteration===t.loop.iteration-1&&t.verification.iteration===t.builder_handoff.iteration;if(!r&&!n)throw new Error("Native verification iteration and attempt do not match a stable loop result")}}function Pw(t){if(!{shape:new Set(["shape","await-user","blocked"]),build:new Set(["building","repairing","await-user","blocked"]),verify:new Set(["verify-ready","await-user","blocked"]),archive:new Set(["archive-ready","await-user","blocked","done"])}[t.phase].has(t.loop.stage))throw new Error(`Native loop stage ${t.loop.stage} is invalid for phase ${t.phase}`);let i=t.status==="await-user"?"await-user":t.status==="blocked"?"blocked":t.status==="done"?"done":null;if(i!==null&&t.loop.stage!==i)throw new Error(`Native status ${t.status} requires loop stage ${i}`);if(t.status==="active"&&["await-user","blocked","done"].includes(t.loop.stage))throw new Error(`Native active status cannot use loop stage ${t.loop.stage}`);if(t.archived!==(t.status==="done"))throw new Error("Native archived must be true exactly when status is done");if(t.archived&&t.phase!=="archive")throw new Error("Native archived state must be in Archive");if(t.verification_result==="pass"){if(t.verification?.verdict!=="pass")throw new Error("Native pass requires a persisted passing verification");if(t.acceptance.some(r=>r.result!=="passed"))throw new Error("Native pass requires every acceptance item to pass");if(t.verification.checks.some(r=>r.status!=="passed"))throw new Error("Native pass requires every persisted check to pass")}if(t.verification?.assurance==="semantic-verification-unavailable"&&(t.phase!=="verify"||t.status!=="await-user"||t.verification_result!=="blocked"||t.loop.next_action!=="confirm-verifier-unavailable"))throw new Error("Native unavailable semantic verification must await explicit user confirmation");if(t.verification_report!==null&&t.verification===null)throw new Error("Native verification report requires persisted verification")}function Se(t){let e=z(t,"Native portable state");if(J(e,uw,"Native portable state"),e.schema!==Pi)throw new Error(`Native portable state schema must be ${Pi}`);let i=B(e.name,"Native state name");if(!ow.test(i))throw new Error("Native state name is invalid");if(e.brief!=="brief.md")throw new Error("Native state brief must be brief.md");let r=ke(e.spec_changes,"Native spec_changes",hw);ct(r.map(s=>s.capability),"Native spec change capabilities");let n=ke(e.acceptance,"Native acceptance",vw);ct(n.map(s=>s.id),"Native acceptance IDs");let a=ke(e.history,"Native history",Lu);if(a.length>50)throw new Error(`Native history cannot exceed ${50} entries`);let o={schema:Pi,name:i,language:D(e.language,["en","zh-CN"],"Native state language"),phase:D(e.phase,["shape","build","verify","archive"],"Native state phase"),status:D(e.status,["active","await-user","blocked","done"],"Native state status"),state_version:I(e.state_version,"Native state_version",1),brief:"brief.md",...e.children_contract_hash===void 0?{}:{children_contract_hash:dw(e.children_contract_hash,"Native children contract hash")},spec_changes:r,workspace:pw(e.workspace),loop:mw(e.loop),acceptance:n,builder_handoff:e.builder_handoff===null?null:ww(e.builder_handoff),blockers:ke(e.blockers,"Native blockers",yw),verification:e.verification===null?null:bw(e.verification),history:a,history_overflow:Sw(e.history_overflow),verification_result:D(e.verification_result,["pending","pass","fail","blocked"],"Native verification_result"),verification_report:e.verification_report===null?null:D(e.verification_report,["verification.md"],"Native verification_report"),archived:$t(e.archived,"Native archived"),created_at:Ot(e.created_at,"Native created_at")};return Ew(o),Pw(o),o}function on(t,e){let i=Se(t),r=Lu(e,i.history.length),n=[...i.history,r],a={...i.history_overflow,outcome_counts:{...i.history_overflow.outcome_counts}};for(;n.length>50;){let o=n.shift();a.dropped_entries+=1,a.first_dropped_at??=o.completed_at,a.last_dropped_at=o.completed_at,a.outcome_counts[o.outcome]+=1}return Se({...i,history:n,history_overflow:a})}function xw(t,e){let i=(0,nn.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`${e} is invalid YAML: ${i.errors[0].message}`);return i.toJS({mapAsMap:!1})}async function Ci(t){let e=await aw.readFile(t,"utf8");return Se(xw(e,"Native portable state"))}async function Mu(t,e,i={}){let r=Se(e);await we(t,(0,nn.stringify)(r),i)}var tn=new Map;async function Cw(t,e){let i=tn.get(t)??Promise.resolve(),r,n=new Promise(o=>{r=o}),a=i.then(()=>n);tn.set(t,a),await i;try{return await e()}finally{r(),tn.get(t)===a&&tn.delete(t)}}async function Fu(t){return Cw(t.file,async()=>{let e=I(t.expectedStateVersion,"Native expected state version",1),i=Se(t.next);if(i.state_version!==e+1)throw new Error("Native CAS next state_version must increment exactly once");let r=await Ci(t.file);if(r.state_version===i.state_version&&JSON.stringify(r)===JSON.stringify(i))return r;if(r.state_version!==e)throw new rn(e,r.state_version);return await Mu(t.file,i,{...t.containedRoot?{containedRoot:t.containedRoot}:{},beforeCommit:async()=>{let n=await Ci(t.file);if(n.state_version!==e)throw new rn(e,n.state_version)}}),i})}function Rw(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("Native portable text byte budget must be a non-negative safe integer")}function Ri(t,e=16384){if(typeof t!="string")throw new Error("Native portable text must be a string");if(Rw(e),Buffer.byteLength(t,"utf8")<=e)return{text:t,truncated:!1};let i="",r=0;for(let n of t){let a=Buffer.byteLength(n,"utf8");if(r+a>e)break;i+=n,r+=a}return{text:i,truncated:!0}}var Te="comet.native.v3",Ie="comet.native.v2",je="comet.native.v1";var Vu="comet.native.portable-migration.v1",Aw=new Set(["schema","id","change","fromSchema","status","createdAt"]),_w=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Tw=/^[a-z0-9][a-z0-9-]{7,127}$/u,Iw=new Set(["prepared","yaml-committed","legacy-cleanup","committed"]),jw=new Set([je,Ie,Te]);function $w(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function Ow(t,e){if(typeof t!="string")throw new Error(`${e} must be an ISO timestamp`);let i=new Date(t);if(Number.isNaN(i.valueOf())||i.toISOString()!==t)throw new Error(`${e} must be a canonical ISO timestamp`);return t}function qu(t){let e=$w(t,"Native portable migration transaction"),i=Object.keys(e).filter(r=>!Aw.has(r));if(i.length>0)throw new Error(`Native portable migration transaction has unknown field(s): ${i.join(", ")}`);if(e.schema!==Vu)throw new Error("Unsupported Native portable migration transaction schema");if(typeof e.id!="string"||!Tw.test(e.id))throw new Error("Native portable migration transaction id is invalid");if(typeof e.change!="string"||!_w.test(e.change))throw new Error("Native portable migration transaction change is invalid");if(typeof e.fromSchema!="string"||!jw.has(e.fromSchema))throw new Error("Native portable migration transaction fromSchema is invalid");if(typeof e.status!="string"||!Iw.has(e.status))throw new Error("Native portable migration transaction status is invalid");return{schema:Vu,id:e.id,change:e.change,fromSchema:e.fromSchema,status:e.status,createdAt:Ow(e.createdAt,"Native portable migration transaction createdAt")}}var Wu="comet.native.archive-transaction.v4",zu="[a-z][a-z0-9]*(?:-[a-z0-9]+)*",Dw=new RegExp(`^portable-archive-(${zu})\\.json$`,"u"),Bw=new RegExp(`^portable-migration-(${zu})\\.json$`,"u"),Lw=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu,Mw=/^\d{4}-\d{2}-\d{2}-[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Fw=new Set(["prepared","specs-applied","state-finalized","report-aligned","moved"]),Vw=new Set(["schema","id","change","start_state_version","archive_ref","status","next_spec_index","spec_changes","created_at"]),qw=new Set(["capability","operation","source","content"]),Ju=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;function Gu(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function Uu(t,e,i){let r=Object.keys(t).filter(n=>!e.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`);if(Object.keys(t).length!==e.size)throw new Error(`${i} fields are invalid`)}function Ww(t,e){let i=`Native portable Archive spec_changes[${e}]`,r=Gu(t,i);if(Uu(r,qw,i),typeof r.capability!="string"||!Ju.test(r.capability))throw new Error(`${i}.capability is invalid`);if(!["create","modify","remove"].includes(String(r.operation)))throw new Error(`${i}.operation is invalid`);let n=r.operation;if(n==="remove"){if(r.source!==null||r.content!==null)throw new Error(`${i} remove requires source and content null`);return{capability:r.capability,operation:n,source:null,content:null}}if(typeof r.source!="string"||r.source.length===0||r.source.includes("\\")||r.source.startsWith("/")||/^[A-Za-z]:/u.test(r.source)||r.source.split("/").some(a=>a==="."||a===".."))throw new Error(`${i}.${n} source is invalid`);if(typeof r.content!="string")throw new Error(`${i}.${n} content is invalid`);return{capability:r.capability,operation:n,source:r.source,content:r.content}}function zw(t){let e=Gu(t,"Native portable Archive transaction");if(Uu(e,Vw,"Native portable Archive transaction"),e.schema!==Wu)throw new Error("Unsupported Native portable Archive transaction schema");if(typeof e.id!="string"||!Lw.test(e.id))throw new Error("Native portable Archive transaction id is invalid");if(typeof e.change!="string"||!Ju.test(e.change))throw new Error("Native portable Archive transaction change is invalid");if(!Number.isSafeInteger(e.start_state_version)||Number(e.start_state_version)<0)throw new Error("Native portable Archive transaction state version is invalid");if(typeof e.archive_ref!="string"||!Mw.test(e.archive_ref)||!e.archive_ref.endsWith(`-${e.change}`))throw new Error("Native portable Archive transaction ref is invalid");if(typeof e.status!="string"||!Fw.has(e.status))throw new Error("Native portable Archive transaction status is invalid");if(!Array.isArray(e.spec_changes))throw new Error("Native portable Archive transaction spec changes are invalid");let i=e.spec_changes.map(Ww);if(new Set(i.map(({capability:n})=>n)).size!==i.length)throw new Error("Native portable Archive transaction capabilities must be unique");if(!Number.isSafeInteger(e.next_spec_index)||Number(e.next_spec_index)<0||Number(e.next_spec_index)>i.length)throw new Error("Native portable Archive transaction spec cursor is invalid");if(typeof e.created_at!="string")throw new Error("Native portable Archive transaction timestamp is invalid");let r=new Date(e.created_at);if(Number.isNaN(r.valueOf())||r.toISOString()!==e.created_at)throw new Error("Native portable Archive transaction timestamp is invalid");return{schema:Wu,id:e.id,change:e.change,start_state_version:Number(e.start_state_version),archive_ref:e.archive_ref,status:e.status,next_spec_index:Number(e.next_spec_index),spec_changes:i,created_at:e.created_at}}function zo(t){let e=Dw.exec(t);if(e)return{kind:"archive",change:e[1]};let i=Bw.exec(t);return i?{kind:"migration",change:i[1]}:null}async function Ku(t,e){let i=zo(e);if(!i)return null;let r=await Q({root:t.transactionsDir,ref:e,maxBytes:null,includeHash:!1}),n=JSON.parse(r.text),a=Hw.join(t.transactionsDir,e);if(i.kind==="archive"){let s=zw(n);if(s.change!==i.change)throw new Error(`Native portable transaction filename does not match ${s.change}`);return{kind:"archive",change:i.change,file:a,journal:s}}let o=qu(n);if(o.change!==i.change)throw new Error(`Native portable transaction filename does not match ${o.change}`);return{kind:"migration",change:i.change,file:a,journal:o}}function Yu(t){return t.kind==="archive"||t.journal.status!=="committed"}import $e from"path";import{TextDecoder as ey}from"util";import{createHash as Jw}from"node:crypto";import{constants as un,promises as fe}from"node:fs";import he from"node:path";import{TextDecoder as Gw}from"node:util";function fn(t,e){let i=he.relative(t,e);return i===""||!he.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${he.sep}`)}function Uw(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function Kw(t,e){return _({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Yw(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function dn(t,e){return _({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Jo(t,e){let i=await fe.lstat(t);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await fe.realpath(t),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function Xw(t,e,i){let r=he.resolve(t),n=he.resolve(e);if(!fn(r,n))throw new Error(`${i} is outside its managed root`);let a=[await Jo(r,i)],o=r;for(let s of he.relative(r,n).split(he.sep).filter(Boolean)){await lt(a,i),o=he.join(o,s);let c=await Jo(o,i);if(!fn(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await lt(a,i),a}async function lt(t,e){for(let i of t){let r=await fe.lstat(i.path);if(!r.isDirectory()||r.isSymbolicLink()||!Kw(i,r)||await fe.realpath(i.path)!==i.realPath)throw new Error(`${e} parent changed during I/O: ${i.path}`)}}async function Qw(t,e,i){let r=[],n=0,a=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let o=e+1-n,{bytesRead:s}=await t.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(n+=s,n>e)throw new Error(`${i} exceeds ${e} bytes`);r.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(r,n)}async function ut(t){let e=Uw(t.maxBytes),i=he.resolve(t.file),r=await Xw(t.root,he.dirname(i),t.label),n=await Promise.all((t.forbiddenRoots??[]).map(u=>Jo(he.resolve(u),t.label)));await t.hooks?.afterParentChainCaptured?.(),await lt(r,t.label);let a=await fe.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(a.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let o=Yw(a),s=await fe.realpath(i);if(!fn(r[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(n.some(u=>fn(u.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?un.O_RDONLY:un.O_RDONLY|un.O_NOFOLLOW|un.O_NONBLOCK,l=await fe.open(i,c);try{let u=await l.stat();await t.hooks?.afterOpen?.();let[d,f]=await Promise.all([fe.lstat(i),fe.realpath(i)]);if(await lt(r,t.label),await lt(n,t.label),!u.isFile()||!d.isFile()||d.isSymbolicLink()||f!==s||!dn(o,u)||!dn(o,d))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let p=await Qw(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[g,h,m]=await Promise.all([l.stat(),fe.lstat(i),fe.realpath(i)]);if(await lt(r,t.label),await lt(n,t.label),!h.isFile()||h.isSymbolicLink()||m!==s||!dn(o,g)||!dn(o,h))throw new Error(`${t.label} changed while reading`);return{bytes:p,hash:Jw("sha256").update(p).digest("hex"),size:p.length}}finally{await l.close()}}async function Xu(t){let e=await ut(t),i;try{i=new Gw("utf-8",{fatal:!0}).decode(e.bytes)}catch(r){throw new Error(`${t.label} is not valid UTF-8`,{cause:r})}return{...e,text:i}}var ty=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),iy=new Set(["id","type","source","target","staged","backup"]),ry=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),ny=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]);var ed=new Set(["prepared","applying","committed","rolling-back","rolled-back"]);var ay=256*1024,dP=1024*1024,fP=16*1024;var hP=64*1024*1024;var oy=new ey("utf-8",{fatal:!0});function pn(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function mn(t,e,i){let r=Object.keys(t).filter(n=>!e.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function td(t){if(typeof t!="string")return!1;let e=new Date(t);return!Number.isNaN(e.valueOf())&&e.toISOString()===t}function Go(t,e){if(typeof t!="string"||t.length===0||$e.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native root`)}function hn(t,e){if(typeof t!="string"||!/^[a-f0-9]{64}$/u.test(t))throw new Error(`${e} must be a SHA-256 hash`)}function Qu(t,e){if(Go(t,e),t.includes("\\")||t!==$e.posix.normalize(t)||t.split("/").includes(".")||t.endsWith("/")||Buffer.byteLength(t,"utf8")>1024)throw new Error(`${e} must be a normalized Native-relative ref`)}function sy(t,e){let i=pn(t,`transaction operations[${e}]`);if(mn(i,iy,`transaction operations[${e}]`),typeof i.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.id))throw new Error(`transaction operations[${e}].id is invalid`);if(i.type!=="write"&&i.type!=="remove"&&i.type!=="move")throw new Error(`transaction operation ${i.id} has an invalid type`);Go(i.target,`transaction operation ${i.id} target`);for(let r of["source","staged","backup"])i[r]!==void 0&&Go(i[r],`transaction operation ${i.id} ${r}`);if(i.type==="write"){if(i.staged===void 0||i.source!==void 0)throw new Error(`write operation ${i.id} requires staged and forbids source`)}else if(i.type==="remove"){if(i.source!==void 0||i.staged!==void 0)throw new Error(`remove operation ${i.id} forbids source and staged`)}else if(i.source===void 0||i.staged!==void 0||i.backup!==void 0)throw new Error(`move operation ${i.id} requires source and forbids staged and backup`);return i}function id(t){let e=pn(t,"Native Archive transaction journal");if(mn(e,ry,"Native Archive transaction journal"),e.schema!=="comet.native.transaction.v2")throw new Error("Unsupported Native Archive transaction schema");if(typeof e.id!="string"||!/^[a-f0-9-]{8,}$/u.test(e.id))throw new Error("Native Archive transaction id is invalid");if(e.kind!=="archive")throw new Error("Native v2 transaction kind must be archive");if(typeof e.status!="string"||!ed.has(e.status))throw new Error("Native Archive transaction status is invalid");if(typeof e.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(e.change))throw new Error("Native Archive transaction change name is invalid");if(!td(e.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(hn(e.preflightHash,"Native Archive transaction preflightHash"),!Array.isArray(e.operations)||e.operations.length>65)throw new Error("Native Archive transaction operations must be an array");let i=e.operations.map((s,c)=>{let l=pn(s,`Archive transaction operations[${c}]`);if(mn(l,ny,`Archive transaction operations[${c}]`),typeof l.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(l.id))throw new Error(`Archive transaction operations[${c}].id is invalid`);if(l.type!=="write"&&l.type!=="remove"&&l.type!=="move")throw new Error(`Archive transaction operation ${l.id} has an invalid type`);Qu(l.target,`Archive transaction operation ${l.id} target`);for(let u of["source","staged","backup"])l[u]!==void 0&&Qu(l[u],`Archive transaction operation ${l.id} ${u}`);if(l.expectedTargetHash!==null&&hn(l.expectedTargetHash,`Archive transaction operation ${l.id} expectedTargetHash`),l.type==="write"){if(l.staged===void 0||l.source!==void 0||l.expectedSourceHash!==void 0)throw new Error(`Archive write operation ${l.id} requires staged and forbids source`);if(hn(l.stagedHash,`Archive write operation ${l.id} stagedHash`),l.expectedTargetHash===null!=(l.backup===void 0))throw new Error(`Archive write operation ${l.id} backup must match target existence`)}else if(l.type==="remove"){if(l.source!==void 0||l.staged!==void 0||l.stagedHash!==void 0||l.expectedSourceHash!==void 0||l.backup===void 0||l.expectedTargetHash===null)throw new Error(`Archive remove operation ${l.id} requires a bound target and backup`)}else{if(l.source===void 0||l.staged!==void 0||l.stagedHash!==void 0||l.backup!==void 0||l.expectedTargetHash!==null)throw new Error(`Archive move operation ${l.id} requires source and an absent target`);hn(l.expectedSourceHash,`Archive move operation ${l.id} expectedSourceHash`)}return l}),r=i.map(s=>s.id);if(new Set(r).size!==r.length)throw new Error("Native Archive transaction operation ids must be unique");let n=`runtime/transactions/${e.id}`,a=i.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${e.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${e.change}$`,"u").test(a[0].target)||i.at(-1)!==a[0])throw new Error("Native Archive transaction must end with its exact change move");let o=new Set;for(let s of i.slice(0,-1)){if(s.type==="move"||!/^specs\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/spec\.md$/u.test(s.target)||o.has(s.target))throw new Error(`Native Archive transaction spec target is invalid: ${s.target}`);if(o.add(s.target),s.staged!==void 0&&!s.staged.startsWith(`${n}/staged/specs/`))throw new Error(`Native Archive transaction staged ref is invalid: ${s.staged}`);if(s.backup!==void 0&&!s.backup.startsWith(`${n}/backups/specs/`))throw new Error(`Native Archive transaction backup ref is invalid: ${s.backup}`)}return{schema:"comet.native.transaction.v2",id:e.id,kind:"archive",status:e.status,change:e.change,createdAt:e.createdAt,preflightHash:e.preflightHash,operations:i}}function cy(t){let e=pn(t,"Native transaction journal");if(e.schema==="comet.native.transaction.v2")return id(e);if(mn(e,ty,"Native transaction journal"),e.schema!=="comet.native.transaction.v1")throw new Error("Unsupported Native transaction schema");if(typeof e.id!="string"||!/^[a-f0-9-]{8,}$/u.test(e.id))throw new Error("Native transaction id is invalid");if(e.kind!=="archive"&&e.kind!=="root-move")throw new Error("Native transaction kind is invalid");if(typeof e.status!="string"||!ed.has(e.status))throw new Error("Native transaction status is invalid");if(typeof e.projectRoot!="string"||!$e.isAbsolute(e.projectRoot)||typeof e.nativeRoot!="string"||!$e.isAbsolute(e.nativeRoot))throw new Error("Native transaction roots must be absolute paths");if(e.change!==void 0&&(typeof e.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(e.change)))throw new Error("Native transaction change name is invalid");if(!td(e.createdAt))throw new Error("Native transaction createdAt is invalid");if(!Array.isArray(e.operations))throw new Error("Native transaction operations must be an array");let i=e.operations.map(sy),r=i.map(n=>n.id);if(new Set(r).size!==r.length)throw new Error("Native transaction operation ids must be unique");return{schema:"comet.native.transaction.v1",id:e.id,kind:e.kind,status:e.status,projectRoot:e.projectRoot,nativeRoot:e.nativeRoot,...typeof e.change=="string"?{change:e.change}:{},createdAt:e.createdAt,operations:i}}function ly(t,e){if(!/^[a-f0-9-]{8,}$/u.test(e))throw new Error(`Invalid Native transaction id: ${e}`);return $e.join(t.transactionsDir,e)}function rd(t,e){let i=ly(t,e);return{directory:i,journal:$e.join(i,"transaction.json"),events:$e.join(i,"events.jsonl"),staged:$e.join(i,"staged"),backups:$e.join(i,"backups")}}async function Ko(t,e){let i=rd(t,e);return await Promise.all(Object.values(i).map(r=>T(t.runtimeDir,r))),i}async function Yo(t,e,i={}){let r=await Ko(t,e),n=await ut({root:t.runtimeDir,file:r.journal,maxBytes:ay,label:`Native transaction journal ${e}`,hooks:i.hooks}),a=JSON.parse(oy.decode(n.bytes)),o=cy(a);if(o.id!==e)throw new Error(`Invalid Native transaction journal: ${e}`);return o}async function fy(t,e,i){let r;try{r=await uy.readdir(t.transactionsDir,{withFileTypes:!0})}catch(n){if(n.code==="ENOENT")return!1;throw n}for(let n of r)if(!(!n.isDirectory()||n.isSymbolicLink()))try{let a=await Yo(t,n.name);if(a.id!==e&&a.status!=="committed"&&a.status!=="rolled-back")return!0}catch{return!0}for(let n of r)if(zo(n.name))try{let a=await Ku(t,n.name);if(!a||i?.kind===a.kind&&i.change===a.change)continue;if(Yu(a))return!0}catch{return!0}return!1}async function hy(t,e){let i=Date.now()+5e3,r=dy.join(t.locksDir,"root-move.lock");for(;;)try{return await Zr(t,"root-move",e)}catch(n){if(n.cause?.code!=="EEXIST")throw n;let o=await Du(r);if(o.status==="missing")continue;if(o.status!=="active"||Date.now()>=i)throw n;await new Promise(s=>setTimeout(s,5+Math.floor(Math.random()*11)))}}async function pe(t,e,i,r){let n=await hy(t,e);try{if(await Xr(t.projectRoot),await fy(t,r?.allowedTransactionId,r?.allowedPortableTransaction))throw new Error("Native transaction recovery is required before another mutation");return await i()}finally{await en(n)}}import Qo from"path";import{createHash as py}from"crypto";function K(t){return py("sha256").update(t).digest("hex")}var jP={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},vy=1e3,gy=8*1024*1024,wy=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,yy=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),Ny=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),by=new Set(["schema","include","exclude","hash"]),ky=new Set(["provider","gitSelection","physicalSelection","projection"]),Sy=new Set(["provider","selection"]),Ey=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),Py=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),xy=new Set(["schema","status","before","after"]),Cy=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),Ry=new Set(["path","hash","size","type","gitObjectId"]),Ay=new Set(["path","size","type","reason"]),_y=new Set(["ref","hash","count"]),Ty=new Set(["change-created","legacy-migration","explicit"]),Iy=new Set(["file","directory","other"]),jy=new Set(["file-size","file-count","total-size","manifest-size","changed-during-read","unreadable","gitlink-unavailable","gitlink-dirty","gitlink-changed","legacy-gitlink-boundary","git-enumeration-limit","git-selection-changed","physical-enumeration-limit","physical-selection-changed"]),gn=/^[a-f0-9]{64}$/u,$y=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var $P=64*1024,OP=64*1024;var HP={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},DP={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function vn(t,e){return t.hash===e.hash&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.stdoutBytes===e.stdoutBytes&&t.overflow===e.overflow}var BP=(1n<<256n)-1n;function Oy(t,e){return t.hash===e.hash&&t.visitedNodeCount===e.visitedNodeCount&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.encodedBytes===e.encodedBytes&&t.overflow===e.overflow&&t.unstable===e.unstable}function Hy(t){return Buffer.byteLength(JSON.stringify(t,null,2)+`
146
+ `)}function Dy(t,e){return K(`comet.native.snapshot-policy.v1
147
+ ${JSON.stringify({include:t,exclude:e,hash:"sha256"})}`)}function Xo(t,e,i){let r=new Set(e),n=[...e];for(;n.length>0;){if(i&&!i())return null;let a=n.pop(),o=t[a];o&&(o.kind==="star"||o.kind==="globstar"||o.kind==="globstar-slash")&&!r.has(a+1)&&(r.add(a+1),n.push(a+1))}return r}function By(t){let e=0;return()=>e>0?(e-=1,!0):t()?(e=63,!0):!1}function nd(t){let e=Yr(t,"Native snapshot pattern"),i=[];for(let r=0;r<e.length;r+=1){let n=e[r];n==="*"&&e[r+1]==="*"?(r+=1,e[r+1]==="/"?(r+=1,i.push({kind:"globstar-slash"})):i.push({kind:"globstar"})):n==="*"?i.push({kind:"star"}):n==="?"?i.push({kind:"question"}):i.push({kind:"literal",value:n})}return(r,n)=>{let a=n?By(n):void 0;if(a&&!a())return!1;let o=Xo(i,new Set([0]),a);if(o===null)return!1;for(let s of r){if(a&&!a())return!1;let c=new Set;for(let l of o){if(a&&!a())return!1;let u=i[l];u&&(u.kind==="literal"&&u.value===s||u.kind==="question"&&s!=="/"?c.add(l+1):u.kind==="star"&&s!=="/"||u.kind==="globstar"?c.add(l):u.kind==="globstar-slash"&&(c.add(l),s==="/"&&c.add(l+1)))}if(o=Xo(i,c,a),o===null||o.size===0)return!1}return Xo(i,o,a)?.has(i.length)??!1}}function Ly(t){if(t===void 0)return;let e=[...new Set(t.include.map(n=>Yr(n,"include")))].sort((n,a)=>n.localeCompare(a,"en")),i=[...new Set(t.exclude.map(n=>Yr(n,"exclude")))].sort((n,a)=>n.localeCompare(a,"en"));if(e.length===0)throw new Error("Native snapshot policy include must not be empty");let r=Dy(e,i);if("hash"in t&&t.hash!==r)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:e,exclude:i,hash:r},includeMatchers:e.map(nd),excludeMatchers:i.map(nd),excludedDirectoryPrefixes:i.flatMap(n=>{if(!n.endsWith("/**"))return[];let a=n.slice(0,-3);return/[*?]/u.test(a)?[]:[a]}).sort((n,a)=>n.localeCompare(a,"en"))}}function ie(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function re(t,e,i){let r=Object.keys(t).find(n=>!e.has(n));if(r)throw new Error(`${i} contains unknown field: ${r}`)}function Dt(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function Ee(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function sd(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0"))throw new Error(`${e} must be a normalized project-relative path`);let i=Qo.posix.normalize(t);if(i!==t||Qo.posix.isAbsolute(t)||i===".."||i.startsWith("../"))throw new Error(`${e} must stay inside the project root`);return t}function My(t,e){let i=ie(t,`Native snapshot entry ${e}`);re(i,Ry,`Native snapshot entry ${e}`);let r=sd(i.path,`Native snapshot entry ${e} path`);if(typeof i.hash!="string"||!gn.test(i.hash))throw new Error(`Native snapshot entry ${e} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${e} type is invalid`);let n={path:r,hash:i.hash,size:Ee(i.size,`Native snapshot entry ${e} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!$y.test(i.gitObjectId))throw new Error(`Native snapshot entry ${e} gitObjectId is invalid`);n.gitObjectId=i.gitObjectId}return n}function Fy(t,e){let i=ie(t,`Native snapshot omission ${e}`);if(re(i,Ay,`Native snapshot omission ${e}`),!Iy.has(i.type))throw new Error(`Native snapshot omission ${e} type is invalid`);if(!jy.has(i.reason))throw new Error(`Native snapshot omission ${e} reason is invalid`);return{path:sd(i.path,`Native snapshot omission ${e} path`),size:i.size===null?null:Ee(i.size,`Native snapshot omission ${e} size`),type:i.type,reason:i.reason}}function Vy(t){let e=ie(t,"Native snapshot omission overflow");if(re(e,_y,"Native snapshot omission overflow"),typeof e.hash!="string"||!gn.test(e.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${e.hash}`;if(e.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:e.hash,count:Dt(e.count,"Native snapshot omission overflow count")}}function Ht(t,e){let i=ie(t,e);if(re(i,Py,e),typeof i.hash!="string"||!gn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${e} overflow flag is invalid`);let r=Ee(i.recordCount,`${e} recordCount`),n=Ee(i.storedRecordCount,`${e} storedRecordCount`),a=Ee(i.stdoutBytes,`${e} stdoutBytes`);if(n>r||!i.overflow&&n!==r)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,recordCount:r,storedRecordCount:n,stdoutBytes:a,overflow:i.overflow}}function ad(t){let e=ie(t,"Native Git selection evidence");if(re(e,Ey,"Native Git selection evidence"),e.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=Ht(e.stageBefore,"Native Git selection stageBefore"),r=Ht(e.combined,"Native Git selection combined"),n=Ht(e.stageAfter,"Native Git selection stageAfter"),a=Ht(e.finalStageBefore,"Native Git selection finalStageBefore"),o=Ht(e.finalCombined,"Native Git selection finalCombined"),s=Ht(e.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,r,n,a,o,s].some(d=>d.overflow),l=!vn(i,n)||!vn(n,a)||!vn(r,o)||!vn(a,s),u=c&&l?"overflow-and-changed":c?"overflow":"changed";if(!c&&!l)throw new Error("Native Git selection evidence must describe an exceptional selection");if(e.status!==u)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:u,stageBefore:i,combined:r,stageAfter:n,finalStageBefore:a,finalCombined:o,finalStageAfter:s}}function od(t,e){let i=ie(t,e);if(re(i,Cy,e),typeof i.hash!="string"||!gn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${e} flags are invalid`);let r=Ee(i.visitedNodeCount,`${e} visitedNodeCount`),n=Ee(i.recordCount,`${e} recordCount`),a=Ee(i.storedRecordCount,`${e} storedRecordCount`),o=Ee(i.encodedBytes,`${e} encodedBytes`);if(a>n||!i.overflow&&a!==n)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:r,recordCount:n,storedRecordCount:a,encodedBytes:o,overflow:i.overflow,unstable:i.unstable}}function qy(t){let e=ie(t,"Native physical selection evidence");if(re(e,xy,"Native physical selection evidence"),e.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=od(e.before,"Native physical selection before"),r=od(e.after,"Native physical selection after"),n=i.overflow||r.overflow,a=i.unstable||r.unstable||!Oy(i,r);if(!n&&!a)throw new Error("Native physical selection evidence must describe an exceptional selection");let o=n&&a?"overflow-and-changed":n?"overflow":"changed";if(e.status!==o)throw new Error("Native physical selection evidence status is inconsistent");return{schema:"comet.native.physical-selection.v1",status:o,before:i,after:r}}function cd(t){let e=ie(t,"Native content snapshot manifest");if(re(e,yy,"Native content snapshot manifest"),e.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!Ty.has(e.origin))throw new Error("Native content snapshot origin is invalid");let i;if(e.capture!==void 0){let v=ie(e.capture,"Native content snapshot capture");if(re(v,ky,"Native content snapshot capture"),v.provider!=="git"&&v.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let x=v.gitSelection===void 0?void 0:ad(v.gitSelection),b=v.physicalSelection===void 0?void 0:qy(v.physicalSelection),A=null;if(v.projection!==void 0){let G=ie(v.projection,"Native content snapshot projection");if(re(G,Sy,"Native content snapshot projection"),G.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");A={provider:"git",...G.selection===void 0?{}:{selection:ad(G.selection)}}}if(v.provider==="git"){if(b||A)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...x?{gitSelection:x}:{}}}else{if(x)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(b&&A)throw new Error("Native physical-tree capture cannot combine selection and projection");i=A?{provider:"physical-tree",projection:A}:{provider:"physical-tree",...b?{physicalSelection:b}:{}}}}if(typeof e.createdAt!="string"||Number.isNaN(Date.parse(e.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof e.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let r=ie(e.limits,"Native content snapshot limits");re(r,Ny,"Native content snapshot limits");let n={maxFiles:Dt(r.maxFiles,"Native snapshot maxFiles"),maxFileBytes:Dt(r.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:Dt(r.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:Dt(r.maxManifestBytes,"Native snapshot maxManifestBytes"),...r.maxDurationMs===void 0?{}:{maxDurationMs:Dt(r.maxDurationMs,"Native snapshot maxDurationMs")}},a;if(e.policy!==void 0){let v=ie(e.policy,"Native snapshot policy");if(re(v,by,"Native snapshot policy"),v.schema!=="comet.native.snapshot-policy.v1")throw new Error("Native snapshot policy schema is invalid");if(!Array.isArray(v.include)||!Array.isArray(v.exclude))throw new Error("Native snapshot policy patterns must be arrays");a=Ly({include:v.include,exclude:v.exclude,hash:v.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(e.entries)||!Array.isArray(e.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let o=e.entries.map(My),s=e.omitted.map(Fy),c=Ee(e.omittedCount,"Native content snapshot omittedCount"),l=e.omissionOverflow===void 0?void 0:Vy(e.omissionOverflow);if(o.length>n.maxFiles)throw new Error("Native content snapshot exceeds its file-count limit");if(o.some(v=>v.size>n.maxFileBytes)||o.reduce((v,x)=>v+x.size,0)>n.maxTotalBytes)throw new Error("Native content snapshot exceeds its byte limits");if(new Set(o.map(v=>v.path)).size!==o.length)throw new Error("Native content snapshot contains duplicate paths");if(s.length>vy||c<s.length)throw new Error("Native content snapshot omission count is invalid");let u=c-s.length;if(u===0&&l||u>0&&l?.count!==u)throw new Error("Native content snapshot omission overflow is inconsistent");if(e.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let d=s.filter(v=>v.reason==="git-enumeration-limit"),f=s.filter(v=>v.reason==="git-selection-changed");for(let v of[...d,...f])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native Git selection omission must use the project-root sentinel");if(d.length>1||f.length>1)throw new Error("Native Git selection omissions must not be duplicated");let p=i?.provider==="git"?i.gitSelection:i?.projection?.selection,g=p?.status==="overflow"||p?.status==="overflow-and-changed",h=p?.status==="changed"||p?.status==="overflow-and-changed";if(g!==(d.length===1))throw new Error("Native Git enumeration omission and selection evidence are inconsistent");if(h!==(f.length===1))throw new Error("Native Git selection-change omission and selection evidence are inconsistent");let m=s.filter(v=>v.reason==="physical-enumeration-limit"),y=s.filter(v=>v.reason==="physical-selection-changed");for(let v of[...m,...y])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native physical selection omission must use the project-root sentinel");if(m.length>1||y.length>1)throw new Error("Native physical selection omissions must not be duplicated");let N=i?.physicalSelection,k=N?.status==="overflow"||N?.status==="overflow-and-changed",S=N?.status==="changed"||N?.status==="overflow-and-changed";if(k!==(m.length===1))throw new Error("Native physical enumeration omission and evidence are inconsistent");if(S!==(y.length===1))throw new Error("Native physical selection-change omission and evidence are inconsistent");let E={schema:"comet.native.content-snapshot.v1",origin:e.origin,...i?{capture:i}:{},createdAt:e.createdAt,complete:e.complete,limits:n,...a?{policy:a}:{},entries:o,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(Hy(E)>n.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function Wy(t,e){if(!wy.test(e))throw new Error(`Invalid Native change name: ${e}`);return Qo.join(Z(t,e),"baseline-manifest.json")}async function ld(t,e){let i=Wy(t,e),r=le(t,i);await T(r,i);try{let n=await Xu({root:r,file:i,maxBytes:gy,label:"Native baseline snapshot manifest"});return cd(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}var Yy=Lt(Rt(),1);var ex=4*1024*1024;import V from"path";var Xy=Di("hookWritePolicy",async t=>(await Ao(t))?.hook??{allow_paths:[]});function ud(t,e){let i=V.relative(t,e);return i===""||!V.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${V.sep}`)}function Qy(t,e){let i=V.isAbsolute(e)?V.resolve(e):V.resolve(t,e),r=V.relative(V.resolve(t),i);return r===""||V.isAbsolute(r)||r===".."||r.startsWith(`..${V.sep}`)?null:r.replaceAll("\\","/")}function dd(t){return process.platform==="win32"?t.toLowerCase():t}async function wn(t,e,i=[]){let r=V.isAbsolute(e)?V.resolve(e):V.resolve(t,e),n=V.resolve(t);if(!ud(n,r)||i.some(c=>ud(V.resolve(c),r)))return null;let a=Qy(t,e);if(!a)return null;let s=(await Xy(t)).allow_paths.find(c=>{let l=dd(a),u=dd(c);return l===u||l.startsWith(`${u}/`)});return s?`${a} (configured Hook allow path: ${s})`:null}var Qx=256*1024;var dC={runStateBytes:256*1024,trajectoryBytes:8*1024*1024,trajectoryEvents:4096,trajectoryEventBytes:256*1024,checkpointBytes:256*1024,pendingActionBytes:256*1024,contextBytes:1024*1024,artifactsBytes:1024*1024};import{createHash as tN}from"node:crypto";import{promises as yn}from"node:fs";import Ke from"node:path";var Ai=/^[a-f0-9]{64}$/u,hd=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u,iN=16*1024,es=process.platform;function vd(t,e){let i=Ke.relative(t,e);return Ke.isAbsolute(i)||i===".."||i.startsWith(`..${Ke.sep}`)?null:i.replaceAll("\\","/")||"."}function gd(t){return Array.from(t).some(e=>{let i=e.codePointAt(0)??0;return i<=31||i===127})}function wd(t,e){if(t.length===0||gd(t)||t.includes("\\")||Ke.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes(".."))throw new Error(`${e} must be a portable project-relative path`);let i=Ke.posix.normalize(t);if(i!==t||i===".."||i.startsWith("../"))throw new Error(`${e} must be a normalized project-relative path`);return i}function ts(t,e){return tN("sha256").update(`${t}
148
+ ${e}`).digest("hex")}async function pd(t,e){let i=await yn.realpath(e),r=await yn.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=es==="win32"?Ke.normalize(i).toLowerCase():i;return ts(t,`${n}
149
+ ${r.dev}
150
+ ${r.ino}
151
+ ${r.birthtimeMs}`)}async function md(t,e){let i=await yn.realpath(e),r=await yn.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=es==="win32"?Ke.normalize(i).toLowerCase():i;return ts(t,n)}function rN(t){if(typeof t!="string")throw new Error("Native workspace capturedAt is invalid");let e=new Date(t);if(!Number.isFinite(e.getTime())||e.toISOString()!==t)throw new Error("Native workspace capturedAt is invalid");return t}function Zo(t,e){if(t===null)return null;if(typeof t!="string"||t.length===0||t.trim()!==t||gd(t))throw new Error(`${e} must be a non-empty branch name or null`);return t}function yd(t){if(!new Set(["current","branch","worktree"]).has(t.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(Zo(t.changeBranch,"Native workspace change branch"),Zo(t.targetBranch,"Native workspace target branch"),(t.isolation==="branch"||t.isolation==="worktree")&&(t.changeBranch===null||t.targetBranch===null))throw new Error("Native isolated workspace requires change and target branches")}function nN(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Native workspace Git provenance must be an object");let e=t,i=new Set(["provider","baseCommit","targetBranch","targetCommit"]),r=Object.keys(e).filter(n=>!i.has(n));if(r.length>0)throw new Error(`Native workspace Git provenance has unknown field(s): ${r.join(", ")}`);if(e.provider!=="git"||typeof e.baseCommit!="string"||!hd.test(e.baseCommit)||typeof e.targetCommit!="string"||!hd.test(e.targetCommit))throw new Error("Native workspace Git provenance is invalid");Zo(e.targetBranch,"Native workspace Git target branch")}function Nn(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Native workspace identity must be an object");let e=t,i=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","git","isolation","changeBranch","targetBranch","finish"]),r=Object.keys(e).filter(o=>!i.has(o));if(r.length>0)throw new Error(`Native workspace identity has unknown field(s): ${r.join(", ")}`);if(e.schema!=="comet.native.workspace.v2"&&e.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(e.capturedRevision)||e.capturedRevision<1||typeof e.nativeRootRef!="string"||!Ai.test(String(e.projectRootId))||!Ai.test(String(e.nativeRootId)))throw new Error("Native workspace identity is invalid");rN(e.capturedAt),wd(e.nativeRootRef,"Native workspace root ref");let n=e.projectRootPathId!==void 0,a=e.nativeRootPathId!==void 0;if(n!==a)throw new Error("Native workspace path identities must be provided together");if(n&&!Ai.test(String(e.projectRootPathId))||a&&!Ai.test(String(e.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(e.sessionHash!==void 0&&!Ai.test(String(e.sessionHash)))throw new Error("Native workspace session hash is invalid");if(e.git!==void 0&&nN(e.git),e.schema==="comet.native.workspace.v2"){if(e.isolation!==void 0||e.changeBranch!==void 0||e.targetBranch!==void 0||e.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof e.isolation!="string"||e.changeBranch===void 0||e.targetBranch===void 0||e.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(yd(e),e.finish!==null&&!new Set(["merge","push","pull-request","keep"]).has(e.finish))throw new Error("Native workspace finish must be merge, push, pull-request, keep, or null")}function aN(t,e){return Ke.join(Z(t,e),"workspace.json")}function oN(t,e){let i=aN(t,e),r=le(t,i),n=vd(r,i);if(!n||n===".")throw new Error("Native workspace file escaped its root");return{root:r,ref:wd(n,"Native workspace file ref")}}async function sN(t,e){try{let i=oN(t,e),r=await Q({root:i.root,ref:i.ref,maxBytes:iN});return JSON.parse(r.text)}catch(i){if(i.code==="ENOENT")return null;throw i}}async function cN(t){if(!Number.isSafeInteger(t.revision)||t.revision<1)throw new Error("Native workspace revision must be a positive integer");let e=vd(t.paths.projectRoot,t.paths.nativeRoot);if(!e)throw new Error("Native root is outside the project root");let i=Ae(t.paths.projectRoot),r=i.isGitWorktree?bo(t.paths.projectRoot,"HEAD"):null,n=t.binding?.targetBranch??i.currentBranch,a=n==null?null:bo(t.paths.projectRoot,n),o=r!==null&&n!==null&&n!==void 0&&a!==null?{provider:"git",baseCommit:r,targetBranch:n,targetCommit:a}:void 0,[s,c,l,u]=await Promise.all([pd("comet.native.workspace-project-root.v2",t.paths.projectRoot),pd("comet.native.workspace-native-root.v2",t.paths.nativeRoot),md("comet.native.workspace-project-root-path.v2",t.paths.projectRoot),md("comet.native.workspace-native-root-path.v2",t.paths.nativeRoot)]),d=(t.now??new Date).toISOString();if(t.finish&&!t.binding)throw new Error("Native workspace finish requires a workspace binding");t.binding&&yd(t.binding);let f={capturedAt:d,capturedRevision:t.revision,nativeRootRef:e,projectRootId:s,nativeRootId:c,projectRootPathId:l,nativeRootPathId:u,...o?{git:o}:{},...t.sessionId?{sessionHash:ts("comet.native.workspace-session.v2",`${s}
152
+ ${c}
153
+ ${t.sessionId}`)}:{}},p=t.binding?{schema:"comet.native.workspace.v3",...f,...t.binding,finish:t.finish??null}:{schema:"comet.native.workspace.v2",...f};return Nn(p),p}async function bn(t,e){let i=await sN(t,e);return i===null||i&&typeof i=="object"&&!Array.isArray(i)&&i.schema==="comet.native.workspace.v1"?null:(Nn(i),i)}async function Nd(t){Nn(t.identity);let e=await cN({paths:t.paths,name:"workspace-advisory",revision:t.identity.capturedRevision}),i=[],r=[];return e.nativeRootRef!==t.identity.nativeRootRef&&i.push("native-root-ref"),t.identity.projectRootPathId&&t.identity.nativeRootPathId?(e.projectRootPathId!==t.identity.projectRootPathId&&i.push("project-root-path"),e.nativeRootPathId!==t.identity.nativeRootPathId&&i.push("native-root-path")):(e.projectRootId!==t.identity.projectRootId&&i.push("project-root-legacy-identity"),e.nativeRootId!==t.identity.nativeRootId&&i.push("native-root-legacy-identity")),es==="win32"&&i.length>0&&i.every(a=>a==="project-root-legacy-identity"||a==="native-root-legacy-identity")?r.push("workspace-inspection-unavailable"):i.length>0&&r.push("workspace-root-changed"),{state:r.length===0?"aligned":r.includes("workspace-root-changed")?"drifted":"unknown",findingCodes:r,driftComponents:i}}async function bd(t){if(Nn(t.identity),t.identity.schema==="comet.native.workspace.v2")return{state:"legacy",code:"workspace-binding-legacy",message:"Legacy Native workspace metadata has no isolation binding"};if((await Nd(t)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let i=Ae(t.paths.projectRoot);return t.identity.changeBranch===null?i.isGitWorktree?{state:"drifted",code:"workspace-branch-changed",message:"Native change was created outside Git but is now being accessed inside Git"}:{state:"aligned",code:null,message:null}:i.isGitWorktree?i.currentBranch!==t.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${t.identity.changeBranch}, but the current branch is ${i.currentBranch??"detached HEAD"}`}:t.identity.isolation==="worktree"&&!i.isSecondaryWorktree?{state:"drifted",code:"workspace-kind-changed",message:"Native change is bound to a linked Git worktree"}:{state:"aligned",code:null,message:null}:{state:"drifted",code:"workspace-vcs-unavailable",message:"Native change requires its bound Git working directory"}}async function kd(t,e){let i=await bn(t,e);if(i===null)return null;let r=await bd({paths:t,identity:i});if(r.state==="drifted")throw new Error(`${r.code}: ${r.message}`);return i}var Pd=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],dN=new Set(Pd),xd=new Set([...Pd,"minimum_runtime_version","revision"]),fN=new Set([...xd,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),hN=new Set(["capability","operation","source","base_hash"]),pN=new Set(["shape","build","verify","archive"]),mN=new Set(["implicit","confirmed"]),vN=new Set(["pending","pass","fail"]),ht="comet-state.yaml",rs=/^[a-f0-9]{64}$/u,Cd=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,gN=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,kn=class extends Error{constructor(i,r){super(`Native change ${i} uses ${r}; run comet native doctor ${i} --repair before mutating it`);this.change=i;this.schema=r;this.name="NativeSchemaMigrationRequiredError"}change;schema;code="native-schema-migration-required"},ft=class extends Error{constructor(i,r){super(i!==Te||r===null?`Unsupported Native change schema ${i} for runtime protocol ${3}`:`Native change ${i} requires runtime protocol ${r}; current protocol is ${3}`);this.schema=i;this.minimumRuntimeVersion=r;this.name="NativeRuntimeCompatibilityError"}schema;minimumRuntimeVersion;code="native-runtime-incompatible"},Sn=class extends Error{constructor(i,r,n){super(`Native change ${i} revision conflict: expected ${r}, actual ${n}`);this.change=i;this.expectedRevision=r;this.actualRevision=n;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},_i=class extends Error{constructor(i,r){super(`Native working directory already contains active change${r.length===1?"":"s"} ${r.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=i;this.activeChanges=r;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},En=class extends Error{constructor(i,r,n,a,o,s=null,c=null){super(`Native change ${i} baseline is incomplete (${r} omitted entr${r===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=i;this.omittedCount=r;this.omittedByReason=n;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},KC=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
154
+ `);function Ii(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Rd(t,e,i){let r=Object.keys(t).filter(n=>!e.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function Pn(t){if(!Cd.test(t))throw new Error(`Invalid Native change name: ${t}`)}function wN(t){if(!Cd.test(t))throw new Error(`Invalid Native capability id: ${t}`)}function Ad(t,e){if(t.length===0||dt.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native change`)}function yN(t,e){let i=Ii(t,`spec_changes[${e}]`);if(Rd(i,hN,`spec_changes[${e}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(wN(i.capability),i.operation!=="create"&&i.operation!=="replace"&&i.operation!=="remove")throw new Error(`Invalid spec operation for ${i.capability}`);let r=i.source,n=i.base_hash;if(r!==void 0&&typeof r!="string")throw new Error(`Spec source for ${i.capability} must be a string`);if(typeof r=="string"&&Ad(r,`Spec source for ${i.capability}`),i.operation==="create"){if(!r)throw new Error(`Create spec ${i.capability} requires source`);if(n!==null)throw new Error(`Create spec ${i.capability} requires null base_hash`)}else if(i.operation==="replace"){if(!r)throw new Error(`Replace spec ${i.capability} requires source`);if(typeof n!="string"||!rs.test(n))throw new Error(`Replace spec ${i.capability} requires a SHA-256 base_hash`)}else{if(r!==void 0)throw new Error(`Remove spec ${i.capability} forbids source`);if(typeof n!="string"||!rs.test(n))throw new Error(`Remove spec ${i.capability} requires a SHA-256 base_hash`)}return{capability:i.capability,operation:i.operation,...typeof r=="string"?{source:r}:{},base_hash:n}}function NN(t){return/^\d{4}-\d{2}-\d{2}$/u.test(t)?new Date(`${t}T00:00:00.000Z`).toISOString().slice(0,10)===t:!1}function as(t,e){if(Rd(t,e,ht),typeof t.name!="string")throw new Error("Native change name is required");if(Pn(t.name),t.language!=="en"&&t.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof t.phase!="string"||!pN.has(t.phase))throw new Error("Native change phase is invalid");if(t.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(t.approval!==null&&!mN.has(t.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(t.spec_changes))throw new Error("Native spec_changes must be an array");let i=t.spec_changes.map(yN),r=i.map(n=>n.capability).filter((n,a,o)=>o.indexOf(n)!==a);if(r.length>0)throw new Error(`Duplicate Native capability operation: ${[...new Set(r)].join(", ")}`);if(typeof t.verification_result!="string"||!vN.has(t.verification_result))throw new Error("Native verification_result is invalid");if(t.verification_report!==null&&typeof t.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof t.verification_report=="string"&&Ad(t.verification_report,"Native verification_report"),typeof t.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof t.created_at!="string"||!NN(t.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(t.run_id!==null&&(typeof t.run_id!="string"||t.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:t.name,language:t.language,phase:t.phase,brief:"brief.md",approval:t.approval,spec_changes:i,verification_result:t.verification_result,verification_report:t.verification_report,archived:t.archived,created_at:t.created_at,run_id:t.run_id}}function sn(t){let e=Ii(t,ht);if(e.schema!==je)throw new Error(`Expected ${je}`);return{schema:je,...as(e,dN)}}function Ti(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function is(t,e,i){if(t===null)return null;let r=typeof t=="string"?gN.exec(t):null;if(!r||r[1]!==i)throw new Error(`${e} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return t}function bN(t){if(t==null)return null;if(typeof t!="string"||!rs.test(t))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return t}function kN(t){if(t===void 0)return"legacy-v1";if(t!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return t}function cn(t){let e=Ii(t,ht);if(e.schema!==Ie)throw new Error(`Expected ${Ie}`);if(Ti(e.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${Ie} minimum_runtime_version must be 2`);return{schema:Ie,minimum_runtime_version:2,revision:Ti(e.revision,"Native v2 revision"),...as(e,xd)}}function ln(t){let e=Ii(t,ht);if(e.schema!==Te){if(e.schema===je||e.schema===Ie){let o=e.schema===je?sn(e):cn(e);throw new kn(o.name,o.schema)}throw new ft(typeof e.schema=="string"?e.schema:"(missing)",typeof e.minimum_runtime_version=="number"?e.minimum_runtime_version:null)}let i=Ti(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new ft(e.schema,i);if(i!==3)throw new Error(`Native ${e.schema} minimum_runtime_version must be ${3}`);let r=Ti(e.revision,"Native revision"),n=as(e,fN),a=bN(e.approved_contract_hash);if(n.approval===null&&a!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:Te,minimum_runtime_version:3,revision:r,verification_protocol:kN(e.verification_protocol),...n,approved_contract_hash:a,implementation_scope:is(e.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:is(e.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:is(e.partial_allowance,"Native partial_allowance","allowances")}}function SN(t){let e=Ii(t,ht);if(e.schema===je){let n=sn(e);return{status:"migration-required",schema:n.schema,minimumRuntimeVersion:1,state:n,message:`Native change ${n.name} requires migration to ${Te}`}}if(e.schema===Ie){let n=cn(e);return{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n,message:`Native change ${n.name} requires migration to ${Te}`}}if(e.schema!==Te){let n=typeof e.minimum_runtime_version=="number"&&Number.isSafeInteger(e.minimum_runtime_version)?e.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof e.schema=="string"?e.schema:"(missing)",minimumRuntimeVersion:n,state:null,message:new ft(typeof e.schema=="string"?e.schema:"(missing)",n).message}}let i=Ti(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:e.schema,minimumRuntimeVersion:i,state:null,message:new ft(e.schema,i).message};let r=ln(e);return{status:"current",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r}}function pt(t,e){Pn(e);let i=dt.join(t.changesDir,e);if(!M(t.changesDir,i))throw new Error("Native change path escaped");return i}async function os(t,e){let i=Z(t,e),r=dt.join(i,"schema-migration.json");await T(M(t.runtimeDir,r)?t.runtimeDir:t.nativeRoot,r);try{return await uN.lstat(r),!0}catch(n){if(n.code==="ENOENT")return!1;throw n}}var EN=256*1024;async function PN(t,e=dt.dirname(t)){let i=dt.relative(e,t).split(dt.sep).join("/"),r=await Q({root:e,ref:i,maxBytes:EN}),n=(0,ns.parseDocument)(r.text,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid Native change file ${t}: ${n.errors[0].message}`);return n.toJS()}async function xN(t,e){let i=dt.join(pt(t,e),ht);await T(t.nativeRoot,i);let r=SN(await PN(i,t.nativeRoot));if(r.state&&r.state.name!==e)throw new Error(`Native change directory/name mismatch: ${e}`);return await os(t,e)?{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimumRuntimeVersion,state:r.state,message:`Native schema migration is incomplete for ${e}; run doctor --repair`}:(r.status==="current"&&r.state&&await CN(t,r.state),r)}async function CN(t,e){if(await ld(t,e.name)!==null&&e.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${e.verification_protocol}`)}async function Pe(t,e){let i=await xN(t,e);if(i.status==="migration-required")throw new kn(e,i.schema);if(i.status==="runtime-incompatible"||!i.state)throw new ft(i.schema,i.minimumRuntimeVersion);return await kd(t,e),i.state}import RN from"path";var ss="comet.selection.v2",AN=16*1024;function Td(t){return RN.join(t,".comet","current-change.json")}function _N(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function _d(t){return t===null||typeof t=="string"}function TN(t){let e;try{e=JSON.parse(t)}catch(i){throw new Error(`current change selection contains invalid JSON: ${i instanceof Error?i.message:String(i)}`,{cause:i})}if(!_N(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!_d(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:ss,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==ss)throw new Error(`current change selection schema must be ${ss}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!_d(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function Id(t){let e;try{let r=Td(t),{bytes:n}=await at(r,AN,{label:"current change selection"});e=n.toString("utf8")}catch(r){if(r.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${r instanceof Error?r.message:String(r)}`,{cause:r})}return{status:"selected",...TN(e)}}import{promises as Hd}from"node:fs";import _n from"node:path";var jN=Lt(Rt(),1);var eR=8*1024*1024;var uR=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_COMMAND_PAYLOAD","Remove-Item Env:COMET_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ");function BN(t){return t.state_version+1}function LN(t){return t.map(e=>({...e,result:"pending",reason:null}))}function MN(t){return{goal_cycle:t.state.loop.goal_cycle,iteration:t.state.loop.iteration,attempt:t.state.loop.attempt,outcome:t.outcome,unresolved_ids:t.unresolvedIds??[],summary:Ri(t.summary),completed_at:t.completedAt}}function jd(t){let e=Se(t.state);if(e.phase!=="verify"&&e.phase!=="archive")throw new Error("Only Verify or Archive can return a candidate to Build");let i=(t.now??new Date).toISOString(),r=on(e,MN({state:e,outcome:"recovery",summary:t.reason,completedAt:i}));return Se({...r,phase:"build",status:"active",state_version:BN(e),verification_result:"pending",verification_report:null,verification:null,builder_handoff:null,blockers:[],acceptance:LN(e.acceptance),loop:{...e.loop,stage:"repairing",iteration:e.loop.iteration+1,attempt:0,execution_failure_count:0,next_action:"submit-builder-candidate"}})}import{promises as FN}from"node:fs";import $i from"node:path";function xn(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function Cn(t,e,i){let r=Object.keys(t).filter(n=>!e.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function xe(t,e,i=!1){if(typeof t!="string"||!i&&t.length===0)throw new Error(`${e} must be ${i?"a string":"a non-empty string"}`);return t}function $d(t,e){return t===null?null:xe(t,e)}function An(t,e,i=0){if(!Number.isSafeInteger(t)||t<i)throw new Error(`${e} must be a safe integer greater than or equal to ${i}`);return t}function VN(t,e){if(t===null)return null;if(!Number.isSafeInteger(t))throw new Error(`${e} must be null or a safe integer`);return t}function qN(t,e){if(typeof t!="boolean")throw new Error(`${e} must be a boolean`);return t}function Rn(t,e,i){if(typeof t!="string"||!e.includes(t))throw new Error(`${i} must be one of: ${e.join(", ")}`);return t}function cs(t,e){if(t===null)return null;let i=xe(t,e);if(Number.isNaN(Date.parse(i)))throw new Error(`${e} must be an ISO timestamp`);return i}function ls(t,e){let i=xe(t,e);if(!$i.isAbsolute(i))throw new Error(`${e} must be absolute`);return $i.resolve(i)}function WN(t,e){let i=`Native local checks[${e}]`,r=xn(t,i);if(Cn(r,new Set(["id","name","operationId","status","repeatable","timeoutMs","executionCount","argv","cwd","exitCode","startedAt","completedAt","log"]),i),!Array.isArray(r.argv)||r.argv.length===0)throw new Error(`${i}.argv must be a non-empty array`);let n=r.argv.map((l,u)=>xe(l,`${i}.argv[${u}]`,!0)),a=Rn(r.status,["planned","running","passed","failed","interrupted"],`${i}.status`),o=cs(r.startedAt,`${i}.startedAt`),s=cs(r.completedAt,`${i}.completedAt`);if(a==="planned"&&(o!==null||s!==null))throw new Error(`${i} planned check cannot contain execution timestamps`);if(a==="running"&&(o===null||s!==null))throw new Error(`${i} running check requires only startedAt`);if((a==="passed"||a==="failed")&&(o===null||s===null))throw new Error(`${i} completed check requires startedAt and completedAt`);let c=An(r.timeoutMs,`${i}.timeoutMs`);if(c<1)throw new Error(`${i}.timeoutMs must be positive`);return{id:xe(r.id,`${i}.id`),name:xe(r.name,`${i}.name`),operationId:xe(r.operationId,`${i}.operationId`),status:a,repeatable:qN(r.repeatable,`${i}.repeatable`),timeoutMs:c,executionCount:An(r.executionCount,`${i}.executionCount`),argv:n,cwd:ls(r.cwd,`${i}.cwd`),exitCode:VN(r.exitCode,`${i}.exitCode`),startedAt:o,completedAt:s,log:xe(r.log,`${i}.log`)}}function Od(t){let e="Native local execution state",i=xn(t,e);if(Cn(i,new Set(["schema","change","basedOnStateVersion","workspace","execution","checks"]),e),i.schema!==xi)throw new Error(`Native local execution schema must be ${xi}`);let r=xn(i.workspace,"Native local workspace");Cn(r,new Set(["projectRoot","worktreeRoot","branch"]),"Native local workspace");let n=null;if(i.execution!==null){let o=xn(i.execution,"Native local execution");Cn(o,new Set(["operationId","stage","actor","executionId","status","startedAt","requestCheckRounds"]),"Native local execution");let s=cs(o.startedAt,"Native local execution.startedAt");if(s===null)throw new Error("Native local execution.startedAt is required");n={operationId:xe(o.operationId,"Native local execution.operationId"),stage:Rn(o.stage,["building","checking","verifying","archiving"],"Native local execution.stage"),actor:o.actor===null?null:Rn(o.actor,["builder","runtime","verifier"],"Native local execution.actor"),executionId:$d(o.executionId,"Native local execution.executionId"),status:Rn(o.status,["running","completed","interrupted"],"Native local execution.status"),startedAt:s,requestCheckRounds:An(o.requestCheckRounds,"Native local execution.requestCheckRounds")}}if(!Array.isArray(i.checks))throw new Error("Native local checks must be an array");let a=i.checks.map(WN);if(new Set(a.map(o=>o.id)).size!==a.length)throw new Error("Native local check IDs must be unique");if(n&&a.some(o=>o.operationId!==n.operationId))throw new Error("Native local checks must belong to the current operation");return{schema:xi,change:xe(i.change,"Native local change"),basedOnStateVersion:An(i.basedOnStateVersion,"Native local basedOnStateVersion",1),workspace:{projectRoot:ls(r.projectRoot,"Native local workspace.projectRoot"),worktreeRoot:ls(r.worktreeRoot,"Native local workspace.worktreeRoot"),branch:$d(r.branch,"Native local workspace.branch")},execution:n,checks:a}}function us(t){return Od({schema:xi,change:t.portableState.name,basedOnStateVersion:t.portableState.state_version,workspace:{projectRoot:$i.resolve(t.projectRoot),worktreeRoot:$i.resolve(t.worktreeRoot??t.projectRoot),branch:t.branch??null},execution:null,checks:[]})}async function ds(t,e,i={}){let r=Od(e);await FN.mkdir($i.dirname(t),{recursive:!0}),await ye(t,r,i)}var zN=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,JN="comet-state.yaml",GN="state.json";function Tn(t,e){if(!zN.test(e))throw new Error(`Invalid Native change name: ${e}`);let i=_n.join(t.changesDir,e);if(!M(t.changesDir,i))throw new Error("Native change path escaped");return i}function fs(t,e){return _n.join(Tn(t,e),JN)}function Dd(t,e){return _n.join(Ei(t,e),GN)}async function In(t,e){try{let i=await Hd.readFile(fs(t,e),"utf8");return/^schema:\s*comet\.native\.v4\s*$/mu.test(i)}catch(i){if(i.code==="ENOENT")return!1;throw i}}function Bd(t){return Ae(t).currentBranch}async function Bt(t,e){return Ci(fs(t,e))}async function Ld(t){let e=await Fu({file:fs(t.paths,t.previous.name),expectedStateVersion:t.previous.state_version,next:t.next,containedRoot:t.paths.nativeRoot});if(e.verification===null&&e.verification_report===null){let i=_n.join(Tn(t.paths,e.name),"verification.md");await T(t.paths.nativeRoot,i),await Hd.rm(i,{force:!0})}return e}async function Md(t){return pe(t.paths,`return portable change ${t.name} to Build`,async()=>{let e=await Bt(t.paths,t.name);if(e.phase==="build")return e;let i=jd({state:e,reason:t.reason}),r=await Ld({paths:t.paths,previous:e,next:i});return await ds(Dd(t.paths,e.name),us({portableState:r,projectRoot:t.paths.projectRoot,branch:Bd(t.paths.projectRoot)}),{containedRoot:t.paths.runtimeDir}),r})}async function Fd(t){return pe(t.paths,`return portable change ${t.name} to Shape`,async()=>{let e=await Bt(t.paths,t.name);return e.phase==="shape"?e:UN({paths:t.paths,state:e,reason:t.reason})})}async function UN(t){let{state:e}=t;if(e.archived)throw new Error(`Native change ${e.name} is already archived`);let r={...on(e,{goal_cycle:e.loop.goal_cycle,iteration:e.loop.iteration,attempt:e.loop.attempt,outcome:"recovery",unresolved_ids:[],summary:Ri(t.reason),completed_at:new Date().toISOString()}),phase:"shape",status:"active",state_version:e.state_version+1,acceptance:[],builder_handoff:null,blockers:[],verification:null,verification_result:"pending",verification_report:null,loop:{stage:"shape",goal_cycle:e.loop.goal_cycle+1,iteration:0,attempt:0,retry_epoch:0,failed_iteration_count:0,no_progress_count:0,execution_failure_count:0,previous_unresolved_ids:[],next_action:"confirm-shape"}};delete r.children_contract_hash;let n=await Ld({paths:t.paths,previous:e,next:r});return await ds(Dd(t.paths,e.name),us({portableState:n,projectRoot:t.paths.projectRoot,branch:Bd(t.paths.projectRoot)}),{containedRoot:t.paths.runtimeDir}),n}var MA=16*1024;async function KN(t){let e=await Id(t.projectRoot);return e.status==="missing"||e.selection.workflow!=="native"?null:(Pn(e.selection.change),e.selection)}async function Vd(t){let e=await KN(t);return e?(await In(t,e.change)?await Bt(t,e.change):await Pe(t,e.change),e.change):null}async function XN(t){let{projectRoot:e,paths:i,state:r,request:n}=t,a=Tn(i,r.name),o=[],s=[],c=!1,l=!1,u=!1;for(let d of n.targets){let f=me.resolve(e,d);if(!mt(e,f)){u=!0;continue}let p=me.relative(e,f).replaceAll("\\","/");if(p===".comet/config.yaml"){l=!0;continue}if(!mt(i.nativeRoot,f)){if(await wn(e,f,[me.join(e,".comet"),i.nativeRoot])){c=!0;continue}s.push(p);continue}if(!mt(a,f))return{allowed:!1,reason:"Portable Native control state is Runtime-owned",workflow:"native",phase:r.phase,change:r.name};let g=me.relative(a,f).replaceAll("\\","/");if(g==="brief.md"||g==="children.yaml"||g.startsWith("specs/")){o.push(g);continue}return{allowed:!1,reason:`${g||"change directory"} is Runtime-owned and cannot be edited by the Agent`,workflow:"native",phase:r.phase,change:r.name}}return o.length>0&&s.length>0?{allowed:!1,reason:"Formal Native requirements and implementation files must be edited in separate actions",workflow:"native",phase:r.phase,change:r.name}:o.length>0?r.phase!=="shape"?{allowed:!0,reason:`Native requirements changed; returned to Shape goal cycle ${(await Fd({paths:i,name:r.name,reason:`Formal requirement write requested for ${o.join(", ")}`})).loop.goal_cycle}`,workflow:"native",phase:"shape",change:r.name}:{allowed:!0,reason:"Native control artifact write",workflow:"native",phase:r.phase,change:r.name}:s.length>0?r.children_contract_hash?{allowed:!1,reason:"Native parent Build advances child changes instead of editing implementation",workflow:"native",phase:r.phase,change:r.name}:r.phase==="build"?{allowed:!0,reason:"Native change is in Build",workflow:"native",phase:r.phase,change:r.name}:r.phase==="verify"||r.phase==="archive"?{allowed:!0,reason:`Native candidate was invalidated and returned to Build iteration ${(await Md({paths:i,name:r.name,reason:`Observed implementation write before ${s.join(", ")}`})).loop.iteration}`,workflow:"native",phase:"build",change:r.name}:{allowed:!1,reason:`Native change ${r.name} is in ${r.phase}; implementation writes are only allowed in Build`,workflow:"native",phase:r.phase,change:r.name}:c?{allowed:!0,reason:"Native configured Hook allow path",workflow:"native",phase:r.phase,change:r.name}:{allowed:!0,reason:l?"Native control artifact write":u?"Write target is outside the guarded project":"No guarded write target was provided",workflow:"native",phase:r.phase,change:r.name}}function mt(t,e){let i=me.relative(t,e);return i===""||!i.startsWith("..")&&!me.isAbsolute(i)}function QN(t,e,i){return i.targets.length>0&&i.targets.every(r=>{let n=me.resolve(t,r);return mt(t,n)?me.relative(t,n).replaceAll("\\","/")===".comet/config.yaml"||mt(e,n):!0})}async function ZN(t){let e=await be(t);if(!e||!(e.workflows??[e.default_workflow]).includes("native"))return null;let i=await st(t,e.native.artifact_root),r;try{r=await YN.readdir(i.changesDir,{withFileTypes:!0})}catch(a){if(a.code==="ENOENT")return{paths:i,changes:[]};throw a}let n=[];for(let a of r.sort((o,s)=>o.name.localeCompare(s.name)))if(!(!a.isDirectory()||a.isSymbolicLink()))if(await In(i,a.name)){let o=await Bt(i,a.name);o.archived||n.push({kind:"portable",state:o})}else{let o=await Pe(i,a.name);o.archived||n.push({kind:"legacy",state:o})}return{paths:i,changes:n}}var eb=Di("nativeActiveContext",t=>ZN(t));async function qd(){let{intent:t,targets:e}=await Ss();return{intent:t,targets:e}}async function Wd(t,e,i){let r=await eb(t);if(!r)return{allowed:!0,reason:"Native workflow is not enabled"};if(e.intent==="non-write")return{allowed:!0,reason:"Hook event is not a write"};if(r.changes.length===0)return{allowed:!0,reason:QN(t,r.paths.nativeRoot,e)?"Native control artifact write":"No Native changes exist"};let n;if(i){if(n=r.changes.find(l=>l.state.name===i),!n)return{allowed:!1,reason:`Selected Native change ${i} is missing or archived; resume /comet-native before retrying`,workflow:"native",change:i}}else if(r.changes.length===1)n=r.changes[0];else{let l=await Vd(r.paths);if(n=r.changes.find(u=>u.state.name===l),!n)return{allowed:!1,reason:"Multiple Native changes are active; select the change to resume before writing code",workflow:"native"}}let a=n.state;if(n.kind==="legacy"&&a.phase==="build")return{allowed:!0,reason:"Native change is in Build",workflow:"native",phase:a.phase,change:a.name};if(e.intent==="unknown"||e.targets.length===0)return{allowed:!0,reason:"Hook write target was not attributed to the guarded project",workflow:"native",phase:a.phase,change:a.name};if(n.kind==="portable")return XN({projectRoot:t,paths:r.paths,state:n.state,request:e});let o=!1,s=!1,c=!1;for(let l of e.targets){let u=me.resolve(t,l);if(!mt(t,u)){s=!0;continue}if(me.relative(t,u).replaceAll("\\","/")===".comet/config.yaml"){o=!0;continue}if(mt(r.paths.nativeRoot,u)){o=!0;continue}if(await wn(t,u,[me.join(t,".comet"),r.paths.nativeRoot])){c=!0;continue}return{allowed:!1,reason:`Native change ${a.name} is in ${a.phase}; implementation writes are only allowed in build. If this belongs to the current change, confirm the scope and run comet native next ${a.name} --summary "<reason>" --return-to-build; otherwise create or select a separate Native change`,workflow:"native",phase:a.phase,change:a.name}}return{allowed:!0,reason:o?"Native control artifact write":s?"Write target is outside the guarded project":c?"Native configured Hook allow path":"No guarded write target was provided",workflow:"native",phase:a.phase,change:a.name}}import ms from"path";var ib=["Outcome","Scope","Non-goals","Acceptance examples"],f_=[...ib,"Constraints and invariants","Decisions","Open questions","Verification expectations"];var rb=Object.freeze({maxChanges:32,maxSpecsPerChange:64,maxArtifactsPerChange:128,maxTotalSpecs:512,maxTotalArtifacts:1024,maxSignalsPerRelationship:8,maxRelationships:256,maxSerializedBytes:64*1024,maxNameBytes:128,maxCapabilityBytes:128,maxArtifactPathBytes:512});var zd=1024*1024;var Gd="scoped-text-safety",nb=1,ab=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var ob="comet.native.checker-policy.v1";var C_=te(ob,{policy:Gd,version:nb,limits:ab,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var sb=["contract-before-does-not-match-scope","implementation-before-does-not-match-scope","contract-changed-during-check","implementation-changed-during-check","contract-after-does-not-match-scope","implementation-after-does-not-match-scope"],R_=new Set(sb);var ub=zd,z_=3*ub;var Ud={root:"/comet/native-runtime",packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-native-runtime",version:"3",description:"Comet-owned state runtime for the Native workflow."},goal:{statement:"Advance a Native change only after its current guard passes.",inputs:[],outputs:[],success:["The Native change and Run state agree on the next phase."]},orchestration:{mode:"deterministic",entry:"shape",steps:[{id:"shape",action:{type:"checkpoint"},next:"build"},{id:"build",action:{type:"checkpoint"},next:"verify"},{id:"verify",action:{type:"checkpoint"},next:"archive"},{id:"archive",action:{type:"checkpoint"}}]},skills:[],agents:[],tools:[]},guardrails:{allowedSkills:[],allowedAgents:[],allowedTools:[],maxIterations:Number.MAX_SAFE_INTEGER,maxRetriesPerAction:2,confirmationRequiredFor:[]},evals:[]},fb=K("comet-native-runtime:v3:scope-reopen"),wT=[{skillVersion:"3",skillHash:K("comet-native-runtime:v3:semantic-repair-budget")},{skillVersion:"2",skillHash:K("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:K("comet-native-runtime:v1")}];var Yd=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],QT=new Set(Yd),wb=new Set([...Yd,"minimum_runtime_version","revision"]),ZT=new Set([...wb,"operation"]),eI=512*1024,yb=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),tI=new Set([...yb,"implementationScopeHash","repairScopeHash","repairStagnation","returnToBuild"]);var aI={maxAcceptanceCriteria:Bu.maxCriteria};var uI={maxSpecs:64,maxFileBytes:Lr,maxTotalBytes:4*1024*1024};import{execFile as Rb}from"node:child_process";import{promisify as Ab}from"node:util";var NI={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var FI=512*1024;var Oi=class extends Error{recovery;constructor(e,i){super(e),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var uj=64*1024;var dj=3600*1e3;var fj=Ab(Rb);var jn=class extends Error{details;constructor(e){let i=e.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${e.length} receipt(s)): ${e.map(r=>`${r.ref}${r.acceptanceId?`[${r.acceptanceId}]`:""} -> ${r.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=e}};var Xj={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var s$=16*1024*1024,c$=256*1024,l$=16*1024;var p$=Object.freeze({maxScopeChanges:128,maxAcceptanceEntries:64,maxUnresolvedReasons:32,maxReceipts:32});var nO=16*1024*1024,$n=class extends Error{constructor(i,r,n,a){super(`Canonical spec conflict for ${i}: expected ${r??"(missing)"}, actual ${n??"(missing)"}`);this.capability=i;this.expectedHash=r;this.actualHash=n;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},On=class extends Error{constructor(i,r=i.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${i.findingCodes.join(", ")}`){super(r);this.preflight=i;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};var Hn=class extends Error{constructor(i,r,n){super(i,n);this.preparation=r;this.name="NativeWorkspacePreparationError"}preparation};var Zd=["--project-root <path> Resolve the Native project from this working directory.","--json Emit the stable JSON command envelope.","--help Show help without requiring an initialized project."],ps=Object.freeze({"":{usage:"comet native <command> [options]",purpose:"Create, inspect, recover, and archive portable Native changes through Runtime-enforced, skill-coordinated steps.",subcommands:["init Initialize Native project configuration.","root show Inspect the configured artifact root.","root move <artifact-root> Move the configured artifact root.","new <change-name> Create a change and prepare its workspace.","spec remove Record a complete capability removal intent.","show <change-name> Read formal artifacts and portable state.","status [<change-name>] Discover stable boundaries and Runner actions.","select <change-name> Select a change in its bound workspace.","next <change-name> Confirm or recover a stable workflow boundary.","archive <change-name> Preview and execute Archive plus workspace finish.","doctor [<change-name>] Diagnose, migrate, or rebuild local execution state."],options:Zd,output:"Human-readable text by default; use --json for a structured command envelope.",examples:["comet native status --json","comet native status my-change --details --json","comet native next --help"]},init:{usage:"comet native init [--root <artifact-root>] [--language en|zh-CN]",purpose:"Create or normalize .comet/config.yaml and the configured Native directories.",options:["--root <artifact-root> Project-relative artifact root; defaults to docs.","--language en|zh-CN Language for newly generated Native artifacts."],output:"The resolved project configuration and Native paths.",examples:["comet native init --root docs --language zh-CN"]},root:{usage:"comet native root <show|move> [arguments]",purpose:"Inspect or transactionally move the configured Native artifact root.",subcommands:["show Print the configured artifact root and resolved paths.","move <artifact-root> Move Native artifacts and update project configuration."],output:"The current root projection or the completed move result.",examples:["comet native root show","comet native root move artifacts/native"]},"root show":{usage:"comet native root show",purpose:"Print the configured Native artifact root and resolved paths.",output:"The configured artifact root and resolved Native paths."},"root move":{usage:"comet native root move <artifact-root>",purpose:"Transactionally move Native artifacts and update project configuration.",output:"The source, destination, and committed root-move transaction result.",examples:["comet native root move artifacts/native"]},new:{usage:"comet native new <change-name> [--language en|zh-CN] [--isolation current|branch|worktree] [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]",purpose:"Create a portable Native change and prepare the requested branch or linked worktree.",options:["--language en|zh-CN Artifact language; defaults to project configuration.","--isolation <kind> current, branch, or worktree; defaults to current.","--change-branch <branch> Change branch; defaults to comet/<change-name>.","--target-branch <branch> Local base branch; defaults to the current branch.","--worktree-path <path> Worktree directory; defaults to .worktrees/<change-name>."],output:"The portable state, workspace preparation result, and continuation with the next Runner action.",examples:["comet native new session-timeout --language zh-CN","comet native new session-timeout --isolation branch --target-branch main","comet native new session-timeout --isolation worktree --target-branch main"]},spec:{usage:"comet native spec remove <change-name> <capability>",purpose:"Record a capability removal; create and modify intents use complete proposed Spec files.",subcommands:["remove <change-name> <capability> Record a capability removal."],output:"The updated portable state and continuation."},"spec remove":{usage:"comet native spec remove <change-name> <capability>",purpose:"Record removal of a capability in the complete target specification.",output:"The updated portable state and continuation with the next Runner action."},show:{usage:"comet native show <change-name>",purpose:"Read formal artifacts and portable state for one Native change.",output:"The portable state, brief, complete proposed Specs, and continuation; legacy state is reported as migration-required."},status:{usage:"comet native status [<change-name>] [--cursor <token>] [--details]",purpose:"Discover portable stable boundaries, parent child readiness, or the exact next Runner action.",options:["--cursor <token> Continue a status-list page.","--details Include acceptance, Spec, workspace, and report details."],output:"A v2 status page or one portable Loop projection with local execution availability and continuation.runnerAction; parent changes also expose children and readyChildren.",examples:["comet native status --json","comet native status session-timeout --details --json"]},select:{usage:"comet native select <change-name>",purpose:"Select one Native change after validating its workspace binding.",output:"The selected change record."},next:{usage:`comet native next <change-name> --summary <text> [--confirmed|--return-to-build|--retry-verifier|--resolve-verifier-blocker]
155
+ comet native next <change-name> --runner-input <json-file>`,purpose:"Confirm or recover an Agent boundary, advance parent child changes, or use one skill-coordinated JSON bridge for Builder handoff, check-plan dispatch, and Verifier response/error.",options:["--summary <text> Required transition or recovery summary.","--confirmed Confirm Shape, a completed skill-coordinated pass, or an explicitly degraded verifier-unavailable fallback before Archive.","--return-to-build Return Verify or Archive to Build after invalidation or user choice.","--retry-verifier Retry a blocked Verifier execution when the continuation allows it.","--resolve-verifier-blocker Resolve a semantic Verifier blocker without changing the candidate, then dispatch a new attempt.","--runner-input <file> Skill-coordinated JSON: builder-handoff, dispatch-verifier, verifier-response, verifier-execution-error, or verifier-unavailable. Identity/provider/execution/candidate fields are rejected."," builder-handoff fields: kind, summary, addressed_acceptance_ids, checks, known_limits."," dispatch-verifier fields: kind, checks (an explicitly resolved plan; [] is allowed)."," verifier-response fields: kind, response (request-checks or final-result)."," verifier-execution-error fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch."," verifier-unavailable fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch; accepted only after the explicit Runtime check plan completed and passed."],output:"The portable state, explicit skill-coordinated label, Runtime-owned check results, complete verifierDispatch, bounded request-check response, continuation.runnerAction, and machine-readable continuation.inputOptions. This generic bridge is not trusted identity attestation: a passing result waits for explicit user confirmation before Archive.",examples:['comet native next session-timeout --summary "Shape confirmed" --confirmed','comet native next session-timeout --summary "Implementation changed" --return-to-build','comet native next session-timeout --summary "Retry verifier infrastructure" --retry-verifier','comet native next session-timeout --summary "Retry semantic verification" --resolve-verifier-blocker',"comet native next session-timeout --runner-input <temporary-json-file>"]},archive:{usage:`comet native archive <change-name> --dry-run [--finish merge|push|pull-request|keep]
156
+ comet native archive <change-name> [--confirmed] [--serial-first <current-change>]`,purpose:"Preview or execute deterministic Archive after the portable state reaches archive-ready.",options:["--dry-run Inspect readiness without rerunning verification.","--finish <action> Persist merge, push, pull-request, or keep for an isolated workspace.","--serial-first <current-change> During execution only, confirm that this change archives before detected capability peers; the value must equal <change-name>.","--confirmed Confirm Archive when project policy requires it."],output:"Readiness plus continuation, or the completed Archive transaction and workspace finish result; Archive does not repeat verification."},doctor:{usage:"comet native doctor [<change-name>] [--repair]",purpose:"Inspect portable state, migrate a legacy active change, or rebuild its local execution overlay.",options:["--repair Apply deterministic migration or rebuild from the portable stable boundary."],output:"Health, migration or recovery details, and the continuation with the next Runner action."}});function hs(t,e){return`${t}:
157
+ ${e.map(i=>` ${i}`).join(`
158
+ `)}`}function Ob(t){let e=t.filter(r=>r!=="--help");if(e.length===0)return"";let i=e.slice(0,2).join(" ");return ps[i]||e.length>1&&ps[e[0]]?.subcommands?i:e[0]}function Hb(t=[]){let e=Ob(t),i=ps[e];if(!i)throw new Error(`Unknown Native help topic: ${e}`);let r=[`Usage: ${i.usage}`,"",i.purpose];i.subcommands&&r.push("",hs("Commands",i.subcommands));let n=e===""?i.options:[...i.options??[],...Zd];return n&&n.length>0&&r.push("",hs("Options",n)),r.push("",`Output:
159
+ ${i.output}`),i.examples&&r.push("",hs("Examples",i.examples)),e===""&&r.push("","Run `comet native <command> --help` for command-specific details."),{topic:e,usage:`${r.join(`
160
+ `)}
161
+ `}}var Db=Hb().usage;var RO=10*1024*1024,Oe=class extends Error{};function tf(t,e){let i=t.flatMap((r,n)=>r===e?[n]:[]);if(i.length>1)throw new Oe(`${e} may only be provided once`);return i.length===0?!1:(t.splice(i[0],1),!0)}function Dn(t,e){let i=t.flatMap((a,o)=>a===e?[o]:[]);if(i.length>1)throw new Oe(`${e} may only be provided once`);if(i.length===0)return;let r=i[0],n=t[r+1];if(n===void 0||n.startsWith("--"))throw new Oe(`${e} requires a value`);return t.splice(r,2),n}function rf(t){if(t.length>0)throw new Oe(`Unexpected argument: ${t[0]}`)}function ef(t,e){let i=ms.normalize(t),r=ms.normalize(e);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function Bb(t){let e=ms.resolve(t),i=Ae(process.cwd());if(!i.isSecondaryWorktree||i.currentWorktreeRoot===null||i.primaryWorktreeRoot===null)return e;let r=Ae(e);return!r.isGitWorktree||r.currentWorktreeRoot===null||r.primaryWorktreeRoot===null||!ef(i.primaryWorktreeRoot,r.primaryWorktreeRoot)||ef(i.currentWorktreeRoot,r.currentWorktreeRoot)?e:i.currentWorktreeRoot}async function nf(t){return t?Bb(t):Oo(process.cwd())}function af(t,e){if(e instanceof Oe)return{command:t,exitCode:64,error:{code:"usage",message:e.message}};if(e instanceof $n)return{command:t,exitCode:73,data:{capability:e.capability,expectedHash:e.expectedHash,actualHash:e.actualHash,canonicalPath:e.canonicalPath},error:{code:"conflict",message:e.message}};if(e instanceof On)return{command:t,exitCode:73,data:e.preflight,error:{code:"conflict",message:e.message}};if(e instanceof Sn)return{command:t,exitCode:73,data:{change:e.change,expectedRevision:e.expectedRevision,actualRevision:e.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:e.message}};if(e instanceof _i)return{command:t,exitCode:73,data:{requestedIsolation:e.requestedIsolation,activeChanges:e.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:e.message}};if(e instanceof Hn)return{command:t,exitCode:73,data:{preparation:e.preparation},error:{code:"workspace-preparation-incomplete",message:e.message}};if(e instanceof En)return{command:t,exitCode:65,data:{change:e.change,complete:!1,omittedCount:e.omittedCount,omittedByReason:e.omittedByReason,samplePaths:e.samplePaths,sampleTruncated:e.sampleTruncated,effectiveLimits:e.effectiveLimits,policyHash:e.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:e.message}};if(e instanceof jn)return{command:t,exitCode:65,data:{receiptBindingFailures:e.details},error:{code:"invalid-data",message:e.message}};if(e instanceof Oi)return{command:t,exitCode:65,data:e.recovery,error:{code:"implementation-scope-stale",message:e.message}};if(e instanceof Error){let i=e.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:t,exitCode:70,error:{code:"internal",message:e.message}};let r=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(e.message);return{command:t,exitCode:r?73:65,error:{code:r?"conflict":"invalid-data",message:e.message}}}return{command:t,exitCode:70,error:{code:"internal",message:String(e)}}}function of(t,e){return e?{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
162
+ `}:t.error?{exitCode:t.exitCode,stderr:t.error.message}:{exitCode:t.exitCode,stdout:t.text}}async function sf(t,e){let i=Dn(t,"--hook-output");if(i!==void 0&&i!=="copilot")throw new Oe("--hook-output must be copilot");rf(t);let r=await Wd(e,await qd());return i==="copilot"?{command:"hook-guard",exitCode:0,data:r,text:r.allowed?`{}
163
+ `:`${JSON.stringify({permissionDecision:"deny",permissionDecisionReason:r.reason})}
164
+ `}:r.allowed?{command:"hook-guard",exitCode:0,data:r}:{command:"hook-guard",exitCode:2,data:r,error:{code:"blocked",message:r.reason}}}function Lb(t){return{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
165
+ `}}async function cf(t,e,i=process.argv.slice(2)){let r=i.indexOf("--"),n=r<0?[...i]:i.slice(0,r),a=r<0?[]:i.slice(r),o=n.includes("--json"),s,c;try{tf(n,"--json"),s=Dn(n,"--project-root");let u=[...n,...a],d=await nf(s);c=await e(u,d)}catch(u){c=af(t,u)}let l=o?Lb(c):of(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
157
166
  `)?"":`
158
- `)),l.exitCode}process.exitCode=await Xl("hook-guard",Yl);
167
+ `)),l.exitCode}process.exitCode=await cf("hook-guard",sf);