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

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 (572) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +37 -33
  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 +25 -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 +65 -65
  13. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +47 -47
  14. package/assets/skills/comet/scripts/comet-guard.mjs +105 -105
  15. package/assets/skills/comet/scripts/comet-handoff.mjs +74 -74
  16. package/assets/skills/comet/scripts/comet-hook-guard.mjs +75 -75
  17. package/assets/skills/comet/scripts/comet-hook-router.mjs +142 -140
  18. package/assets/skills/comet/scripts/comet-resume-probe.mjs +87 -87
  19. package/assets/skills/comet/scripts/comet-runtime.mjs +145 -145
  20. package/assets/skills/comet/scripts/comet-state.mjs +69 -69
  21. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +89 -89
  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 +14 -13
  27. package/assets/skills/comet-build/agents/openai.yaml +5 -0
  28. package/assets/skills/comet-classic/SKILL.md +14 -14
  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 +2 -2
  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 +1 -1
  39. package/assets/skills/{comet → comet-classic}/reference/subagent-dispatch.md +1 -1
  40. package/assets/skills/comet-design/SKILL.md +7 -6
  41. package/assets/skills/comet-design/agents/openai.yaml +5 -0
  42. package/assets/skills/comet-hotfix/SKILL.md +10 -9
  43. package/assets/skills/comet-hotfix/agents/openai.yaml +5 -0
  44. package/assets/skills/comet-native/SKILL.md +54 -168
  45. package/assets/skills/comet-native/agents/openai.yaml +3 -0
  46. package/assets/skills/comet-native/reference/artifacts.md +23 -89
  47. package/assets/skills/comet-native/reference/clarification.md +54 -29
  48. package/assets/skills/comet-native/reference/commands.md +30 -173
  49. package/assets/skills/comet-native/reference/recovery.md +38 -88
  50. package/assets/skills/comet-native/reference/workspace.md +23 -0
  51. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +184 -152
  52. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +219 -163
  53. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +126 -117
  54. package/assets/skills/comet-native/scripts/comet-native-init.mjs +134 -124
  55. package/assets/skills/comet-native/scripts/comet-native-new.mjs +170 -163
  56. package/assets/skills/comet-native/scripts/comet-native-next.mjs +179 -148
  57. package/assets/skills/comet-native/scripts/comet-native-root.mjs +152 -147
  58. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +247 -202
  59. package/assets/skills/comet-native/scripts/comet-native-select.mjs +153 -146
  60. package/assets/skills/comet-native/scripts/comet-native-show.mjs +117 -110
  61. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +133 -151
  62. package/assets/skills/comet-native/scripts/comet-native-status.mjs +146 -139
  63. package/assets/skills/comet-open/SKILL.md +7 -6
  64. package/assets/skills/comet-open/agents/openai.yaml +5 -0
  65. package/assets/skills/comet-tweak/SKILL.md +11 -10
  66. package/assets/skills/comet-tweak/agents/openai.yaml +5 -0
  67. package/assets/skills/comet-verify/SKILL.md +9 -8
  68. package/assets/skills/comet-verify/agents/openai.yaml +5 -0
  69. package/assets/skills-zh/comet/SKILL.md +1 -1
  70. package/assets/skills-zh/comet/agents/openai.yaml +3 -0
  71. package/assets/skills-zh/comet-any/SKILL.md +2 -1
  72. package/assets/skills-zh/comet-any/agents/openai.yaml +5 -0
  73. package/assets/skills-zh/comet-archive/SKILL.md +7 -6
  74. package/assets/skills-zh/comet-archive/agents/openai.yaml +5 -0
  75. package/assets/skills-zh/comet-build/SKILL.md +14 -13
  76. package/assets/skills-zh/comet-build/agents/openai.yaml +5 -0
  77. package/assets/skills-zh/comet-classic/SKILL.md +15 -15
  78. package/assets/skills-zh/comet-classic/agents/openai.yaml +3 -0
  79. package/assets/skills-zh/{comet → comet-classic}/reference/auto-transition.md +1 -1
  80. package/assets/skills-zh/{comet → comet-classic}/reference/comet-yaml-fields.md +2 -2
  81. package/assets/skills-zh/{comet → comet-classic}/reference/context-recovery.md +5 -5
  82. package/assets/skills-zh/{comet → comet-classic}/reference/debug-gate.md +2 -2
  83. package/assets/skills-zh/{comet → comet-classic}/reference/decision-point.md +1 -1
  84. package/assets/skills-zh/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
  85. package/assets/skills-zh/{comet → comet-classic}/reference/file-structure.md +1 -1
  86. package/assets/skills-zh/{comet → comet-classic}/reference/intent-frame.md +1 -1
  87. package/assets/skills-zh/{comet → comet-classic}/reference/scripts.md +1 -1
  88. package/assets/skills-zh/{comet → comet-classic}/reference/subagent-dispatch.md +1 -1
  89. package/assets/skills-zh/comet-design/SKILL.md +7 -6
  90. package/assets/skills-zh/comet-design/agents/openai.yaml +5 -0
  91. package/assets/skills-zh/comet-hotfix/SKILL.md +10 -9
  92. package/assets/skills-zh/comet-hotfix/agents/openai.yaml +5 -0
  93. package/assets/skills-zh/comet-native/SKILL.md +54 -168
  94. package/assets/skills-zh/comet-native/agents/openai.yaml +3 -0
  95. package/assets/skills-zh/comet-native/reference/artifacts.md +23 -89
  96. package/assets/skills-zh/comet-native/reference/clarification.md +40 -15
  97. package/assets/skills-zh/comet-native/reference/commands.md +30 -173
  98. package/assets/skills-zh/comet-native/reference/recovery.md +36 -86
  99. package/assets/skills-zh/comet-native/reference/workspace.md +23 -0
  100. package/assets/skills-zh/comet-open/SKILL.md +7 -6
  101. package/assets/skills-zh/comet-open/agents/openai.yaml +5 -0
  102. package/assets/skills-zh/comet-tweak/SKILL.md +11 -10
  103. package/assets/skills-zh/comet-tweak/agents/openai.yaml +5 -0
  104. package/assets/skills-zh/comet-verify/SKILL.md +9 -8
  105. package/assets/skills-zh/comet-verify/agents/openai.yaml +5 -0
  106. package/bin/fast-runtime-router.js +0 -4
  107. package/dist/app/commands/doctor.d.ts.map +1 -1
  108. package/dist/app/commands/doctor.js +8 -0
  109. package/dist/app/commands/doctor.js.map +1 -1
  110. package/dist/app/commands/init.d.ts.map +1 -1
  111. package/dist/app/commands/init.js +9 -1
  112. package/dist/app/commands/init.js.map +1 -1
  113. package/dist/app/commands/update.d.ts.map +1 -1
  114. package/dist/app/commands/update.js +9 -2
  115. package/dist/app/commands/update.js.map +1 -1
  116. package/dist/config/repository-layout.json +0 -8
  117. package/dist/domains/bundle/bundle-platform.d.ts.map +1 -1
  118. package/dist/domains/bundle/bundle-platform.js +8 -0
  119. package/dist/domains/bundle/bundle-platform.js.map +1 -1
  120. package/dist/domains/bundle/types.d.ts +1 -1
  121. package/dist/domains/bundle/types.d.ts.map +1 -1
  122. package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
  123. package/dist/domains/comet-entry/hook-adapter.js +2 -0
  124. package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
  125. package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
  126. package/dist/domains/comet-entry/hook-router-entry.js +11 -2
  127. package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
  128. package/dist/domains/comet-entry/project-activation.d.ts.map +1 -1
  129. package/dist/domains/comet-entry/project-activation.js +2 -1
  130. package/dist/domains/comet-entry/project-activation.js.map +1 -1
  131. package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
  132. package/dist/domains/comet-entry/resume-probe.js +48 -4
  133. package/dist/domains/comet-entry/resume-probe.js.map +1 -1
  134. package/dist/domains/comet-native/native-acceptance.d.ts +4 -3
  135. package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
  136. package/dist/domains/comet-native/native-acceptance.js +23 -18
  137. package/dist/domains/comet-native/native-acceptance.js.map +1 -1
  138. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
  139. package/dist/domains/comet-native/native-archive-command.js +204 -61
  140. package/dist/domains/comet-native/native-archive-command.js.map +1 -1
  141. package/dist/domains/comet-native/native-archive-transaction.d.ts.map +1 -1
  142. package/dist/domains/comet-native/native-archive-transaction.js +28 -23
  143. package/dist/domains/comet-native/native-archive-transaction.js.map +1 -1
  144. package/dist/domains/comet-native/native-archive.d.ts +1 -0
  145. package/dist/domains/comet-native/native-archive.d.ts.map +1 -1
  146. package/dist/domains/comet-native/native-archive.js +56 -12
  147. package/dist/domains/comet-native/native-archive.js.map +1 -1
  148. package/dist/domains/comet-native/native-bounded-file.d.ts +32 -2
  149. package/dist/domains/comet-native/native-bounded-file.d.ts.map +1 -1
  150. package/dist/domains/comet-native/native-bounded-file.js +87 -6
  151. package/dist/domains/comet-native/native-bounded-file.js.map +1 -1
  152. package/dist/domains/comet-native/native-build-evidence.d.ts.map +1 -1
  153. package/dist/domains/comet-native/native-build-evidence.js +23 -1
  154. package/dist/domains/comet-native/native-build-evidence.js.map +1 -1
  155. package/dist/domains/comet-native/native-change.d.ts +1 -0
  156. package/dist/domains/comet-native/native-change.d.ts.map +1 -1
  157. package/dist/domains/comet-native/native-change.js +96 -8
  158. package/dist/domains/comet-native/native-change.js.map +1 -1
  159. package/dist/domains/comet-native/native-check-executor.d.ts +36 -0
  160. package/dist/domains/comet-native/native-check-executor.d.ts.map +1 -0
  161. package/dist/domains/comet-native/native-check-executor.js +132 -0
  162. package/dist/domains/comet-native/native-check-executor.js.map +1 -0
  163. package/dist/domains/comet-native/native-check-receipt-model.d.ts +9 -0
  164. package/dist/domains/comet-native/native-check-receipt-model.d.ts.map +1 -1
  165. package/dist/domains/comet-native/native-check-receipt-model.js +70 -8
  166. package/dist/domains/comet-native/native-check-receipt-model.js.map +1 -1
  167. package/dist/domains/comet-native/native-check-receipt-storage.d.ts.map +1 -1
  168. package/dist/domains/comet-native/native-check-receipt-storage.js +9 -8
  169. package/dist/domains/comet-native/native-check-receipt-storage.js.map +1 -1
  170. package/dist/domains/comet-native/native-check-receipt.d.ts.map +1 -1
  171. package/dist/domains/comet-native/native-check-receipt.js +123 -60
  172. package/dist/domains/comet-native/native-check-receipt.js.map +1 -1
  173. package/dist/domains/comet-native/native-checkpoint-command.d.ts.map +1 -1
  174. package/dist/domains/comet-native/native-checkpoint-command.js +0 -6
  175. package/dist/domains/comet-native/native-checkpoint-command.js.map +1 -1
  176. package/dist/domains/comet-native/native-checkpoint-storage.d.ts.map +1 -1
  177. package/dist/domains/comet-native/native-checkpoint-storage.js +27 -19
  178. package/dist/domains/comet-native/native-checkpoint-storage.js.map +1 -1
  179. package/dist/domains/comet-native/native-cli-help.d.ts +6 -0
  180. package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -0
  181. package/dist/domains/comet-native/native-cli-help.js +192 -0
  182. package/dist/domains/comet-native/native-cli-help.js.map +1 -0
  183. package/dist/domains/comet-native/native-cli-shared.d.ts +2 -2
  184. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  185. package/dist/domains/comet-native/native-cli-shared.js +46 -24
  186. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  187. package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
  188. package/dist/domains/comet-native/native-cli.js +18 -11
  189. package/dist/domains/comet-native/native-cli.js.map +1 -1
  190. package/dist/domains/comet-native/native-config.d.ts +2 -1
  191. package/dist/domains/comet-native/native-config.d.ts.map +1 -1
  192. package/dist/domains/comet-native/native-config.js +2 -1
  193. package/dist/domains/comet-native/native-config.js.map +1 -1
  194. package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
  195. package/dist/domains/comet-native/native-continuation.js +175 -147
  196. package/dist/domains/comet-native/native-continuation.js.map +1 -1
  197. package/dist/domains/comet-native/native-diagnostics.d.ts.map +1 -1
  198. package/dist/domains/comet-native/native-diagnostics.js +96 -13
  199. package/dist/domains/comet-native/native-diagnostics.js.map +1 -1
  200. package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -1
  201. package/dist/domains/comet-native/native-doctor-command.js +327 -0
  202. package/dist/domains/comet-native/native-doctor-command.js.map +1 -1
  203. package/dist/domains/comet-native/native-doctor.d.ts +1 -0
  204. package/dist/domains/comet-native/native-doctor.d.ts.map +1 -1
  205. package/dist/domains/comet-native/native-doctor.js +116 -22
  206. package/dist/domains/comet-native/native-doctor.js.map +1 -1
  207. package/dist/domains/comet-native/native-evidence-projection.d.ts +50 -0
  208. package/dist/domains/comet-native/native-evidence-projection.d.ts.map +1 -0
  209. package/dist/domains/comet-native/native-evidence-projection.js +284 -0
  210. package/dist/domains/comet-native/native-evidence-projection.js.map +1 -0
  211. package/dist/domains/comet-native/native-evidence-retention.d.ts.map +1 -1
  212. package/dist/domains/comet-native/native-evidence-retention.js +14 -12
  213. package/dist/domains/comet-native/native-evidence-retention.js.map +1 -1
  214. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  215. package/dist/domains/comet-native/native-evidence-storage.js +14 -11
  216. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  217. package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
  218. package/dist/domains/comet-native/native-findings.js +18 -0
  219. package/dist/domains/comet-native/native-findings.js.map +1 -1
  220. package/dist/domains/comet-native/native-git-provenance.d.ts +16 -0
  221. package/dist/domains/comet-native/native-git-provenance.d.ts.map +1 -0
  222. package/dist/domains/comet-native/native-git-provenance.js +171 -0
  223. package/dist/domains/comet-native/native-git-provenance.js.map +1 -0
  224. package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
  225. package/dist/domains/comet-native/native-hook-guard.js +159 -18
  226. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  227. package/dist/domains/comet-native/native-init-command.d.ts.map +1 -1
  228. package/dist/domains/comet-native/native-init-command.js +14 -2
  229. package/dist/domains/comet-native/native-init-command.js.map +1 -1
  230. package/dist/domains/comet-native/native-local-execution.d.ts +25 -0
  231. package/dist/domains/comet-native/native-local-execution.d.ts.map +1 -0
  232. package/dist/domains/comet-native/native-local-execution.js +241 -0
  233. package/dist/domains/comet-native/native-local-execution.js.map +1 -0
  234. package/dist/domains/comet-native/native-lock.d.ts +1 -1
  235. package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
  236. package/dist/domains/comet-native/native-lock.js +9 -9
  237. package/dist/domains/comet-native/native-lock.js.map +1 -1
  238. package/dist/domains/comet-native/native-loop-runtime.d.ts +63 -0
  239. package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -0
  240. package/dist/domains/comet-native/native-loop-runtime.js +580 -0
  241. package/dist/domains/comet-native/native-loop-runtime.js.map +1 -0
  242. package/dist/domains/comet-native/native-mutation-lock.d.ts +2 -0
  243. package/dist/domains/comet-native/native-mutation-lock.d.ts.map +1 -1
  244. package/dist/domains/comet-native/native-mutation-lock.js +23 -2
  245. package/dist/domains/comet-native/native-mutation-lock.js.map +1 -1
  246. package/dist/domains/comet-native/native-new-command.d.ts.map +1 -1
  247. package/dist/domains/comet-native/native-new-command.js +27 -20
  248. package/dist/domains/comet-native/native-new-command.js.map +1 -1
  249. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
  250. package/dist/domains/comet-native/native-next-command.js +114 -63
  251. package/dist/domains/comet-native/native-next-command.js.map +1 -1
  252. package/dist/domains/comet-native/native-paths.d.ts +18 -0
  253. package/dist/domains/comet-native/native-paths.d.ts.map +1 -1
  254. package/dist/domains/comet-native/native-paths.js +125 -13
  255. package/dist/domains/comet-native/native-paths.js.map +1 -1
  256. package/dist/domains/comet-native/native-portable-acceptance.d.ts +28 -0
  257. package/dist/domains/comet-native/native-portable-acceptance.d.ts.map +1 -0
  258. package/dist/domains/comet-native/native-portable-acceptance.js +73 -0
  259. package/dist/domains/comet-native/native-portable-acceptance.js.map +1 -0
  260. package/dist/domains/comet-native/native-portable-archive.d.ts +37 -0
  261. package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -0
  262. package/dist/domains/comet-native/native-portable-archive.js +492 -0
  263. package/dist/domains/comet-native/native-portable-archive.js.map +1 -0
  264. package/dist/domains/comet-native/native-portable-continuation.d.ts +29 -0
  265. package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -0
  266. package/dist/domains/comet-native/native-portable-continuation.js +341 -0
  267. package/dist/domains/comet-native/native-portable-continuation.js.map +1 -0
  268. package/dist/domains/comet-native/native-portable-migration-runtime.d.ts +9 -0
  269. package/dist/domains/comet-native/native-portable-migration-runtime.d.ts.map +1 -0
  270. package/dist/domains/comet-native/native-portable-migration-runtime.js +213 -0
  271. package/dist/domains/comet-native/native-portable-migration-runtime.js.map +1 -0
  272. package/dist/domains/comet-native/native-portable-migration.d.ts +42 -0
  273. package/dist/domains/comet-native/native-portable-migration.d.ts.map +1 -0
  274. package/dist/domains/comet-native/native-portable-migration.js +212 -0
  275. package/dist/domains/comet-native/native-portable-migration.js.map +1 -0
  276. package/dist/domains/comet-native/native-portable-recovery.d.ts +15 -0
  277. package/dist/domains/comet-native/native-portable-recovery.d.ts.map +1 -0
  278. package/dist/domains/comet-native/native-portable-recovery.js +203 -0
  279. package/dist/domains/comet-native/native-portable-recovery.js.map +1 -0
  280. package/dist/domains/comet-native/native-portable-runtime.d.ts +150 -0
  281. package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -0
  282. package/dist/domains/comet-native/native-portable-runtime.js +1444 -0
  283. package/dist/domains/comet-native/native-portable-runtime.js.map +1 -0
  284. package/dist/domains/comet-native/native-portable-state.d.ts +30 -0
  285. package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -0
  286. package/dist/domains/comet-native/native-portable-state.js +688 -0
  287. package/dist/domains/comet-native/native-portable-state.js.map +1 -0
  288. package/dist/domains/comet-native/native-portable-status.d.ts +62 -0
  289. package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -0
  290. package/dist/domains/comet-native/native-portable-status.js +125 -0
  291. package/dist/domains/comet-native/native-portable-status.js.map +1 -0
  292. package/dist/domains/comet-native/native-portable-text.d.ts +8 -0
  293. package/dist/domains/comet-native/native-portable-text.d.ts.map +1 -0
  294. package/dist/domains/comet-native/native-portable-text.js +28 -0
  295. package/dist/domains/comet-native/native-portable-text.js.map +1 -0
  296. package/dist/domains/comet-native/native-portable-transactions.d.ts +41 -0
  297. package/dist/domains/comet-native/native-portable-transactions.d.ts.map +1 -0
  298. package/dist/domains/comet-native/native-portable-transactions.js +204 -0
  299. package/dist/domains/comet-native/native-portable-transactions.js.map +1 -0
  300. package/dist/domains/comet-native/native-portable-types.d.ts +165 -0
  301. package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -0
  302. package/dist/domains/comet-native/native-portable-types.js +18 -0
  303. package/dist/domains/comet-native/native-portable-types.js.map +1 -0
  304. package/dist/domains/comet-native/native-repair-integration.js +5 -5
  305. package/dist/domains/comet-native/native-repair-integration.js.map +1 -1
  306. package/dist/domains/comet-native/native-resume-view.d.ts.map +1 -1
  307. package/dist/domains/comet-native/native-resume-view.js +1 -5
  308. package/dist/domains/comet-native/native-resume-view.js.map +1 -1
  309. package/dist/domains/comet-native/native-root-move.d.ts.map +1 -1
  310. package/dist/domains/comet-native/native-root-move.js +4 -20
  311. package/dist/domains/comet-native/native-root-move.js.map +1 -1
  312. package/dist/domains/comet-native/native-run-consistency.d.ts.map +1 -1
  313. package/dist/domains/comet-native/native-run-consistency.js +8 -12
  314. package/dist/domains/comet-native/native-run-consistency.js.map +1 -1
  315. package/dist/domains/comet-native/native-run-store.js +4 -4
  316. package/dist/domains/comet-native/native-run-store.js.map +1 -1
  317. package/dist/domains/comet-native/native-runner-input.d.ts +160 -0
  318. package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -0
  319. package/dist/domains/comet-native/native-runner-input.js +347 -0
  320. package/dist/domains/comet-native/native-runner-input.js.map +1 -0
  321. package/dist/domains/comet-native/native-runner-protocol.d.ts +40 -0
  322. package/dist/domains/comet-native/native-runner-protocol.d.ts.map +1 -0
  323. package/dist/domains/comet-native/native-runner-protocol.js +55 -0
  324. package/dist/domains/comet-native/native-runner-protocol.js.map +1 -0
  325. package/dist/domains/comet-native/native-runtime-package.d.ts +3 -0
  326. package/dist/domains/comet-native/native-runtime-package.d.ts.map +1 -1
  327. package/dist/domains/comet-native/native-runtime-package.js +5 -1
  328. package/dist/domains/comet-native/native-runtime-package.js.map +1 -1
  329. package/dist/domains/comet-native/native-schema-migration.d.ts.map +1 -1
  330. package/dist/domains/comet-native/native-schema-migration.js +30 -27
  331. package/dist/domains/comet-native/native-schema-migration.js.map +1 -1
  332. package/dist/domains/comet-native/native-select-command.d.ts.map +1 -1
  333. package/dist/domains/comet-native/native-select-command.js +8 -4
  334. package/dist/domains/comet-native/native-select-command.js.map +1 -1
  335. package/dist/domains/comet-native/native-selection.d.ts.map +1 -1
  336. package/dist/domains/comet-native/native-selection.js +11 -2
  337. package/dist/domains/comet-native/native-selection.js.map +1 -1
  338. package/dist/domains/comet-native/native-show-command.d.ts.map +1 -1
  339. package/dist/domains/comet-native/native-show-command.js +36 -0
  340. package/dist/domains/comet-native/native-show-command.js.map +1 -1
  341. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  342. package/dist/domains/comet-native/native-snapshot.js +13 -10
  343. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  344. package/dist/domains/comet-native/native-spec-command.d.ts.map +1 -1
  345. package/dist/domains/comet-native/native-spec-command.js +14 -28
  346. package/dist/domains/comet-native/native-spec-command.js.map +1 -1
  347. package/dist/domains/comet-native/native-specs.js +3 -3
  348. package/dist/domains/comet-native/native-specs.js.map +1 -1
  349. package/dist/domains/comet-native/native-status-command.d.ts.map +1 -1
  350. package/dist/domains/comet-native/native-status-command.js +7 -17
  351. package/dist/domains/comet-native/native-status-command.js.map +1 -1
  352. package/dist/domains/comet-native/native-status-discovery.d.ts +51 -0
  353. package/dist/domains/comet-native/native-status-discovery.d.ts.map +1 -0
  354. package/dist/domains/comet-native/native-status-discovery.js +299 -0
  355. package/dist/domains/comet-native/native-status-discovery.js.map +1 -0
  356. package/dist/domains/comet-native/native-trajectory-recovery.d.ts.map +1 -1
  357. package/dist/domains/comet-native/native-trajectory-recovery.js +6 -9
  358. package/dist/domains/comet-native/native-trajectory-recovery.js.map +1 -1
  359. package/dist/domains/comet-native/native-transaction.d.ts.map +1 -1
  360. package/dist/domains/comet-native/native-transaction.js +31 -20
  361. package/dist/domains/comet-native/native-transaction.js.map +1 -1
  362. package/dist/domains/comet-native/native-transition-evidence.d.ts.map +1 -1
  363. package/dist/domains/comet-native/native-transition-evidence.js +1 -0
  364. package/dist/domains/comet-native/native-transition-evidence.js.map +1 -1
  365. package/dist/domains/comet-native/native-transition-journal.d.ts.map +1 -1
  366. package/dist/domains/comet-native/native-transition-journal.js +71 -22
  367. package/dist/domains/comet-native/native-transition-journal.js.map +1 -1
  368. package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
  369. package/dist/domains/comet-native/native-transitions.js +167 -15
  370. package/dist/domains/comet-native/native-transitions.js.map +1 -1
  371. package/dist/domains/comet-native/native-types.d.ts +36 -1
  372. package/dist/domains/comet-native/native-types.d.ts.map +1 -1
  373. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  374. package/dist/domains/comet-native/native-verification-receipt-runtime.js +18 -100
  375. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  376. package/dist/domains/comet-native/native-verification-report-v2.d.ts +12 -0
  377. package/dist/domains/comet-native/native-verification-report-v2.d.ts.map +1 -0
  378. package/dist/domains/comet-native/native-verification-report-v2.js +141 -0
  379. package/dist/domains/comet-native/native-verification-report-v2.js.map +1 -0
  380. package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
  381. package/dist/domains/comet-native/native-verification-runtime.js +7 -2
  382. package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
  383. package/dist/domains/comet-native/native-verification-scope.d.ts +23 -0
  384. package/dist/domains/comet-native/native-verification-scope.d.ts.map +1 -1
  385. package/dist/domains/comet-native/native-verification-scope.js +106 -19
  386. package/dist/domains/comet-native/native-verification-scope.js.map +1 -1
  387. package/dist/domains/comet-native/native-verifier-protocol.d.ts +49 -0
  388. package/dist/domains/comet-native/native-verifier-protocol.d.ts.map +1 -0
  389. package/dist/domains/comet-native/native-verifier-protocol.js +157 -0
  390. package/dist/domains/comet-native/native-verifier-protocol.js.map +1 -0
  391. package/dist/domains/comet-native/native-workspace-finish.d.ts +61 -0
  392. package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -0
  393. package/dist/domains/comet-native/native-workspace-finish.js +332 -0
  394. package/dist/domains/comet-native/native-workspace-finish.js.map +1 -0
  395. package/dist/domains/comet-native/native-workspace-preparation.d.ts +32 -0
  396. package/dist/domains/comet-native/native-workspace-preparation.d.ts.map +1 -0
  397. package/dist/domains/comet-native/native-workspace-preparation.js +265 -0
  398. package/dist/domains/comet-native/native-workspace-preparation.js.map +1 -0
  399. package/dist/domains/comet-native/native-workspace.d.ts +9 -1
  400. package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
  401. package/dist/domains/comet-native/native-workspace.js +109 -11
  402. package/dist/domains/comet-native/native-workspace.js.map +1 -1
  403. package/dist/domains/dashboard/native-adapter.d.ts +136 -127
  404. package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
  405. package/dist/domains/dashboard/native-adapter.js +157 -271
  406. package/dist/domains/dashboard/native-adapter.js.map +1 -1
  407. package/dist/domains/dashboard/native-collector.d.ts +4 -4
  408. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  409. package/dist/domains/dashboard/native-collector.js +230 -412
  410. package/dist/domains/dashboard/native-collector.js.map +1 -1
  411. package/dist/domains/dashboard/native-legacy-adapter.d.ts +30 -0
  412. package/dist/domains/dashboard/native-legacy-adapter.d.ts.map +1 -0
  413. package/dist/domains/dashboard/native-legacy-adapter.js +115 -0
  414. package/dist/domains/dashboard/native-legacy-adapter.js.map +1 -0
  415. package/dist/domains/dashboard/web/assets/{arc-ClrSujVb.js → arc-CkuYweSh.js} +1 -1
  416. package/dist/domains/dashboard/web/assets/{architectureDiagram-3BPJPVTR-B4A_t84A.js → architectureDiagram-3BPJPVTR--tTGrKam.js} +1 -1
  417. package/dist/domains/dashboard/web/assets/{blockDiagram-GPEHLZMM-D72u2953.js → blockDiagram-GPEHLZMM-DLKYOixs.js} +1 -1
  418. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-Ca5zba3N.js → c4Diagram-AAUBKEIU-BL17BIb8.js} +1 -1
  419. package/dist/domains/dashboard/web/assets/channel-Cg__FSMr.js +1 -0
  420. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-CCVPBm0J.js → chunk-2J33WTMH-B_DDS2IK.js} +1 -1
  421. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-JYluRsP-.js → chunk-4BX2VUAB-vQyyh3eG.js} +1 -1
  422. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-DfYm7pN7.js → chunk-55IACEB6-Cug8J1Qa.js} +1 -1
  423. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-CwghIMO9.js → chunk-727SXJPM-pMreYMW7.js} +1 -1
  424. package/dist/domains/dashboard/web/assets/{chunk-AQP2D5EJ-BA_zgMXZ.js → chunk-AQP2D5EJ-BUkV_rb7.js} +1 -1
  425. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-BAJLB5V6.js → chunk-FMBD7UC4-CQXqBSqQ.js} +1 -1
  426. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-Bj6HWRwi.js → chunk-ND2GUHAM-XWLMOyd4.js} +1 -1
  427. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-B1kXfg5N.js → chunk-QZHKN3VN-4drjXzHQ.js} +1 -1
  428. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-CsC-pvu9.js +1 -0
  429. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-CsC-pvu9.js +1 -0
  430. package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-BBrkuiAU.js → cose-bilkent-S5V4N54A-IQKP-hgj.js} +1 -1
  431. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-DlFhgQHt.js → cynefin-VYW2F7L2-CvvRO4J2.js} +1 -1
  432. package/dist/domains/dashboard/web/assets/{dagre-BM42HDAG-B0Bk5oiP.js → dagre-BM42HDAG-DeOQo7bP.js} +1 -1
  433. package/dist/domains/dashboard/web/assets/demo-CeIDHUFJ.js +24 -0
  434. package/dist/domains/dashboard/web/assets/{diagram-2AECGRRQ-tvTUiBA2.js → diagram-2AECGRRQ-IQd_jQwB.js} +1 -1
  435. package/dist/domains/dashboard/web/assets/{diagram-5GNKFQAL-BZfcK29q.js → diagram-5GNKFQAL-Dllkdt0m.js} +1 -1
  436. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-BQahyP-C.js → diagram-KO2AKTUF-CN_LYqvT.js} +1 -1
  437. package/dist/domains/dashboard/web/assets/{diagram-LMA3HP47-D5bJnW2C.js → diagram-LMA3HP47-DK36WkNN.js} +1 -1
  438. package/dist/domains/dashboard/web/assets/{diagram-OG6HWLK6-DTwWdzWJ.js → diagram-OG6HWLK6-iqUnMYEh.js} +1 -1
  439. package/dist/domains/dashboard/web/assets/{erDiagram-TEJ5UH35-BbvrdCp9.js → erDiagram-TEJ5UH35-Bc64lzy8.js} +1 -1
  440. package/dist/domains/dashboard/web/assets/{flowDiagram-I6XJVG4X-DgbR7Tcc.js → flowDiagram-I6XJVG4X-UfOqef9j.js} +1 -1
  441. package/dist/domains/dashboard/web/assets/{ganttDiagram-6RSMTGT7-wWMOA7F4.js → ganttDiagram-6RSMTGT7-D-u6Aauc.js} +1 -1
  442. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-DCxvMAUJ.js → gitGraphDiagram-PVQCEYII-CaWEk3PM.js} +1 -1
  443. package/dist/domains/dashboard/web/assets/index-BFwKBVTJ.css +1 -0
  444. package/dist/domains/dashboard/web/assets/{index-Blit0P5Z.js → index-BNyOfAhu.js} +1 -1
  445. package/dist/domains/dashboard/web/assets/index-COZ_03uK.js +257 -0
  446. package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-9qXEkzDe.js → infoDiagram-5YYISTIA-BK07mNG0.js} +1 -1
  447. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-Dkf5othW.js → ishikawaDiagram-YF4QCWOH-mWnmaWfZ.js} +1 -1
  448. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-C2_IkO4s.js → journeyDiagram-JHISSGLW-BPy-P7xx.js} +1 -1
  449. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-BxWgu4DL.js → kanban-definition-UN3LZRKU-3Jq9c_lo.js} +1 -1
  450. package/dist/domains/dashboard/web/assets/{linear-Dkr6p-Ro.js → linear-kQyEW-4G.js} +1 -1
  451. package/dist/domains/dashboard/web/assets/{mermaid.core-DZUcsoG4.js → mermaid.core-COBBjtVH.js} +4 -4
  452. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-C9xyxGfa.js → mindmap-definition-RKZ34NQL-CyyurUpv.js} +1 -1
  453. package/dist/domains/dashboard/web/assets/{pieDiagram-4H26LBE5-Dn67tdOF.js → pieDiagram-4H26LBE5-CJro_XKk.js} +1 -1
  454. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-Cy6iOcxc.js → quadrantDiagram-W4KKPZXB-CpayUMjH.js} +1 -1
  455. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-B_gZONhx.js → requirementDiagram-4Y6WPE33-Bi8YpfnA.js} +1 -1
  456. package/dist/domains/dashboard/web/assets/{sankeyDiagram-5OEKKPKP-C3u-4dOk.js → sankeyDiagram-5OEKKPKP-Wx60WwHe.js} +1 -1
  457. package/dist/domains/dashboard/web/assets/{sequenceDiagram-3UESZ5HK-Xd3ByTVF.js → sequenceDiagram-3UESZ5HK-BiMsRFbc.js} +1 -1
  458. package/dist/domains/dashboard/web/assets/{stateDiagram-AJRCARHV-CJGHL7Up.js → stateDiagram-AJRCARHV-BrURMY0R.js} +1 -1
  459. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-BpEE-yEg.js +1 -0
  460. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-DvONX2YQ.js → timeline-definition-PNZ67QCA-aHrrtV-b.js} +1 -1
  461. package/dist/domains/dashboard/web/assets/{vennDiagram-CIIHVFJN-B-L4qWy4.js → vennDiagram-CIIHVFJN-DGB16bvR.js} +1 -1
  462. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-cf39WX2o.js → wardleyDiagram-YWT4CUSO-RVQbcySh.js} +1 -1
  463. package/dist/domains/dashboard/web/assets/{xychartDiagram-2RQKCTM6-Dk1vcm3u.js → xychartDiagram-2RQKCTM6-DMzzwDVX.js} +1 -1
  464. package/dist/domains/dashboard/web/index.html +16 -16
  465. package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
  466. package/dist/domains/skill/platform-inspect.js +11 -3
  467. package/dist/domains/skill/platform-inspect.js.map +1 -1
  468. package/dist/domains/skill/platform-install.d.ts +7 -1
  469. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  470. package/dist/domains/skill/platform-install.js +114 -33
  471. package/dist/domains/skill/platform-install.js.map +1 -1
  472. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  473. package/dist/domains/skill/uninstall.js +69 -15
  474. package/dist/domains/skill/uninstall.js.map +1 -1
  475. package/dist/domains/workflow-contract/index.d.ts +1 -0
  476. package/dist/domains/workflow-contract/index.d.ts.map +1 -1
  477. package/dist/domains/workflow-contract/index.js +1 -0
  478. package/dist/domains/workflow-contract/index.js.map +1 -1
  479. package/dist/domains/workflow-contract/project-config.d.ts +2 -0
  480. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  481. package/dist/domains/workflow-contract/project-config.js +77 -17
  482. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  483. package/dist/domains/workflow-contract/project-gitignore.d.ts +9 -0
  484. package/dist/domains/workflow-contract/project-gitignore.d.ts.map +1 -0
  485. package/dist/domains/workflow-contract/project-gitignore.js +108 -0
  486. package/dist/domains/workflow-contract/project-gitignore.js.map +1 -0
  487. package/dist/platform/install/platforms.d.ts +3 -1
  488. package/dist/platform/install/platforms.d.ts.map +1 -1
  489. package/dist/platform/install/platforms.js +9 -0
  490. package/dist/platform/install/platforms.js.map +1 -1
  491. package/dist/platform/paths/git-worktree.d.ts +2 -1
  492. package/dist/platform/paths/git-worktree.d.ts.map +1 -1
  493. package/dist/platform/paths/git-worktree.js +14 -1
  494. package/dist/platform/paths/git-worktree.js.map +1 -1
  495. package/dist/platform/process/external-command.d.ts +13 -0
  496. package/dist/platform/process/external-command.d.ts.map +1 -0
  497. package/dist/platform/process/external-command.js +45 -0
  498. package/dist/platform/process/external-command.js.map +1 -0
  499. package/dist/platform/process/git.d.ts +12 -0
  500. package/dist/platform/process/git.d.ts.map +1 -0
  501. package/dist/platform/process/git.js +86 -0
  502. package/dist/platform/process/git.js.map +1 -0
  503. package/dist/platform/process/spawn-command.d.ts +8 -0
  504. package/dist/platform/process/spawn-command.d.ts.map +1 -0
  505. package/dist/platform/process/spawn-command.js +113 -0
  506. package/dist/platform/process/spawn-command.js.map +1 -0
  507. package/eval/local/tasks/comet-native-clarification/validation/test_native_clarification.py +9 -21
  508. package/eval/local/tasks/comet-native-clarification-depth/validation/test_native_clarification_depth.py +4 -7
  509. package/eval/local/tasks/comet-native-clarification-modes/validation/test_native_clarification_modes.py +4 -10
  510. package/eval/local/tasks/comet-native-interrupted-transition/instruction.md +1 -1
  511. package/eval/local/tasks/comet-native-interrupted-transition/validation/test_native_interrupted_transition.py +15 -16
  512. package/eval/local/tasks/comet-native-repository-fact/instruction.md +2 -2
  513. package/eval/local/tasks/comet-native-repository-fact/validation/test_native_repository_fact.py +8 -2
  514. package/eval/local/tasks/comet-native-wave-b-decision-resume/instruction.md +8 -4
  515. package/eval/local/tasks/comet-native-wave-b-decision-resume/task.toml +6 -6
  516. package/eval/local/tasks/comet-native-wave-b-decision-resume/validation/test_native_wave_b_decision_resume.py +126 -135
  517. package/eval/local/tasks/comet-native-wave-c-verification-integrity/instruction.md +6 -6
  518. package/eval/local/tasks/comet-native-wave-c-verification-integrity/task.toml +8 -8
  519. package/eval/local/tasks/comet-native-wave-c-verification-integrity/validation/test_native_wave_c_verification_integrity.py +97 -317
  520. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/instruction.md +7 -7
  521. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/task.toml +4 -4
  522. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/validation/test_native_wave_d_stagnation_stop.py +130 -199
  523. package/eval/local/tasks/comet-native-wave-e-parallel-safety/instruction.md +5 -5
  524. package/eval/local/tasks/comet-native-wave-e-parallel-safety/task.toml +8 -8
  525. package/eval/local/tasks/comet-native-wave-e-parallel-safety/validation/test_native_wave_e_parallel_safety.py +135 -239
  526. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/instruction.md +3 -3
  527. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/task.toml +6 -6
  528. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/validation/test_native_wave_f_dashboard_readonly.py +81 -439
  529. package/eval/local/tasks/comet-native-workflow/instruction.md +5 -4
  530. package/eval/local/tasks/comet-native-workflow/validation/test_native_workflow.py +145 -502
  531. package/eval/local/tasks/index.yaml +5 -5
  532. package/eval/local/tests/scaffold/test_native_aligned_eval.py +146 -35
  533. package/eval/local/tests/scaffold/test_native_wave_evaluations.py +75 -2054
  534. package/eval/local/tests/scaffold/test_tasks.py +38 -52
  535. package/eval/local/tests/tasks/test_tasks.py +3 -3
  536. package/eval/local/treatments/comet/comet_native_phase1.yaml +7 -4
  537. package/eval/pyproject.toml +4 -4
  538. package/eval/scaffold/python/native_eval.py +10 -5
  539. package/eval/scaffold/python/validation/native_v4.py +249 -0
  540. package/eval/scaffold/python/validation/native_wave.py +4 -5
  541. package/eval/scaffold/python/validation/native_workflow.py +193 -97
  542. package/eval/scaffold/python/validation/rubric.py +114 -1
  543. package/package.json +2 -1
  544. package/assets/skills/comet-native/scripts/comet-native-check.mjs +0 -179
  545. package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +0 -179
  546. package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +0 -151
  547. package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +0 -187
  548. package/dist/domains/comet-native/native-check-entry.d.ts +0 -2
  549. package/dist/domains/comet-native/native-check-entry.d.ts.map +0 -1
  550. package/dist/domains/comet-native/native-check-entry.js +0 -4
  551. package/dist/domains/comet-native/native-check-entry.js.map +0 -1
  552. package/dist/domains/comet-native/native-checkpoint-entry.d.ts +0 -2
  553. package/dist/domains/comet-native/native-checkpoint-entry.d.ts.map +0 -1
  554. package/dist/domains/comet-native/native-checkpoint-entry.js +0 -4
  555. package/dist/domains/comet-native/native-checkpoint-entry.js.map +0 -1
  556. package/dist/domains/comet-native/native-evidence-entry.d.ts +0 -2
  557. package/dist/domains/comet-native/native-evidence-entry.d.ts.map +0 -1
  558. package/dist/domains/comet-native/native-evidence-entry.js +0 -4
  559. package/dist/domains/comet-native/native-evidence-entry.js.map +0 -1
  560. package/dist/domains/comet-native/native-receipt-entry.d.ts +0 -2
  561. package/dist/domains/comet-native/native-receipt-entry.d.ts.map +0 -1
  562. package/dist/domains/comet-native/native-receipt-entry.js +0 -4
  563. package/dist/domains/comet-native/native-receipt-entry.js.map +0 -1
  564. package/dist/domains/dashboard/web/assets/channel-B_u-_i2t.js +0 -1
  565. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BpA7BPgX.js +0 -1
  566. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BpA7BPgX.js +0 -1
  567. package/dist/domains/dashboard/web/assets/demo-DZYPLZpF.js +0 -25
  568. package/dist/domains/dashboard/web/assets/index-Bk1o-4VO.css +0 -1
  569. package/dist/domains/dashboard/web/assets/index-g8vyW0R_.js +0 -257
  570. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-rKvBgr6I.js +0 -1
  571. /package/assets/skills/{comet → comet-classic}/reference/classic-layout.md +0 -0
  572. /package/assets/skills-zh/{comet → comet-classic}/reference/classic-layout.md +0 -0
@@ -1,185 +1,190 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var mf=Object.create;var zo=Object.defineProperty;var vf=Object.getOwnPropertyDescriptor;var gf=Object.getOwnPropertyNames;var wf=Object.getPrototypeOf,yf=Object.prototype.hasOwnProperty;var Ii=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,i)=>(typeof require<"u"?require:t)[i]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var w=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}};var Nf=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of gf(t))!yf.call(e,r)&&r!==i&&zo(e,r,{get:()=>t[r],enumerable:!(n=vf(t,r))||n.enumerable});return e};var wr=(e,t,i)=>(i=e!=null?mf(wf(e)):{},Nf(t||!e||!e.__esModule?zo(i,"default",{value:e,enumerable:!0}):i,e));var R=w(F=>{"use strict";var yr=Symbol.for("yaml.alias"),Jo=Symbol.for("yaml.document"),ji=Symbol.for("yaml.map"),Go=Symbol.for("yaml.pair"),Nr=Symbol.for("yaml.scalar"),Oi=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),bf=e=>!!e&&typeof e=="object"&&e[ge]===yr,kf=e=>!!e&&typeof e=="object"&&e[ge]===Jo,Sf=e=>!!e&&typeof e=="object"&&e[ge]===ji,Ef=e=>!!e&&typeof e=="object"&&e[ge]===Go,Ko=e=>!!e&&typeof e=="object"&&e[ge]===Nr,Rf=e=>!!e&&typeof e=="object"&&e[ge]===Oi;function Uo(e){if(e&&typeof e=="object")switch(e[ge]){case ji:case Oi:return!0}return!1}function Cf(e){if(e&&typeof e=="object")switch(e[ge]){case yr:case ji:case Nr:case Oi:return!0}return!1}var Pf=e=>(Ko(e)||Uo(e))&&!!e.anchor;F.ALIAS=yr;F.DOC=Jo;F.MAP=ji;F.NODE_TYPE=ge;F.PAIR=Go;F.SCALAR=Nr;F.SEQ=Oi;F.hasAnchor=Pf;F.isAlias=bf;F.isCollection=Uo;F.isDocument=kf;F.isMap=Sf;F.isNode=Cf;F.isPair=Ef;F.isScalar=Ko;F.isSeq=Rf});var Pt=w(br=>{"use strict";var M=R(),V=Symbol("break visit"),Yo=Symbol("skip children"),fe=Symbol("remove node");function $i(e,t){let i=Xo(t);M.isDocument(e)?rt(null,e.contents,i,Object.freeze([e]))===fe&&(e.contents=null):rt(null,e,i,Object.freeze([]))}$i.BREAK=V;$i.SKIP=Yo;$i.REMOVE=fe;function rt(e,t,i,n){let r=Qo(e,t,i,n);if(M.isNode(r)||M.isPair(r))return Zo(e,n,r),rt(e,r,i,n);if(typeof r!="symbol"){if(M.isCollection(t)){n=Object.freeze(n.concat(t));for(let a=0;a<t.items.length;++a){let o=rt(a,t.items[a],i,n);if(typeof o=="number")a=o-1;else{if(o===V)return V;o===fe&&(t.items.splice(a,1),a-=1)}}}else if(M.isPair(t)){n=Object.freeze(n.concat(t));let a=rt("key",t.key,i,n);if(a===V)return V;a===fe&&(t.key=null);let o=rt("value",t.value,i,n);if(o===V)return V;o===fe&&(t.value=null)}}return r}async function Hi(e,t){let i=Xo(t);M.isDocument(e)?await at(null,e.contents,i,Object.freeze([e]))===fe&&(e.contents=null):await at(null,e,i,Object.freeze([]))}Hi.BREAK=V;Hi.SKIP=Yo;Hi.REMOVE=fe;async function at(e,t,i,n){let r=await Qo(e,t,i,n);if(M.isNode(r)||M.isPair(r))return Zo(e,n,r),at(e,r,i,n);if(typeof r!="symbol"){if(M.isCollection(t)){n=Object.freeze(n.concat(t));for(let a=0;a<t.items.length;++a){let o=await at(a,t.items[a],i,n);if(typeof o=="number")a=o-1;else{if(o===V)return V;o===fe&&(t.items.splice(a,1),a-=1)}}}else if(M.isPair(t)){n=Object.freeze(n.concat(t));let a=await at("key",t.key,i,n);if(a===V)return V;a===fe&&(t.key=null);let o=await at("value",t.value,i,n);if(o===V)return V;o===fe&&(t.value=null)}}return r}function Xo(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Qo(e,t,i,n){if(typeof i=="function")return i(e,t,n);if(M.isMap(t))return i.Map?.(e,t,n);if(M.isSeq(t))return i.Seq?.(e,t,n);if(M.isPair(t))return i.Pair?.(e,t,n);if(M.isScalar(t))return i.Scalar?.(e,t,n);if(M.isAlias(t))return i.Alias?.(e,t,n)}function Zo(e,t,i){let n=t[t.length-1];if(M.isCollection(n))n.items[e]=i;else if(M.isPair(n))e==="key"?n.key=i:n.value=i;else if(M.isDocument(n))n.contents=i;else{let r=M.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}br.visit=$i;br.visitAsync=Hi});var kr=w(ts=>{"use strict";var es=R(),Af=Pt(),xf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Tf=e=>e.replace(/[!,[\]{}]/g,t=>xf[t]),At=class e{constructor(t,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,i)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,i){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let n=t.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(t,i){if(t==="!")return"!";if(t[0]!=="!")return i(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,n,r]=t.match(/^(.*!)([^!]*)$/s);r||i(`The ${t} 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==="!"?t:(i(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[i,n]of Object.entries(this.tags))if(t.startsWith(n))return i+Tf(t.substring(n.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),r;if(t&&n.length>0&&es.isNode(t.contents)){let a={};Af.visit(t.contents,(o,s)=>{es.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:"||(!t||r.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
5
- `)}};At.defaultYaml={explicit:!1,version:"1.2"};At.defaultTags={"!!":"tag:yaml.org,2002:"};ts.Directives=At});var Mi=w(xt=>{"use strict";var is=R(),_f=Pt();function If(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(i)}return!0}function ns(e){let t=new Set;return _f.visit(e,{Value(i,n){n.anchor&&t.add(n.anchor)}}),t}function rs(e,t){for(let i=1;;++i){let n=`${e}${i}`;if(!t.has(n))return n}}function jf(e,t){let i=[],n=new Map,r=null;return{onAnchor:a=>{i.push(a),r??(r=ns(e));let o=rs(t,r);return r.add(o),o},setAnchors:()=>{for(let a of i){let o=n.get(a);if(typeof o=="object"&&o.anchor&&(is.isScalar(o.node)||is.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}}xt.anchorIsValid=If;xt.anchorNames=ns;xt.createNodeAnchors=jf;xt.findNewAnchor=rs});var Sr=w(as=>{"use strict";function Tt(e,t,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=Tt(e,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=Tt(e,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=Tt(e,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=Tt(e,n,r,a);o===void 0?delete n[r]:o!==a&&(n[r]=o)}return e.call(t,i,n)}as.applyReviver=Tt});var Ne=w(ss=>{"use strict";var Of=R();function os(e,t,i){if(Array.isArray(e))return e.map((n,r)=>os(n,String(r),i));if(e&&typeof e.toJSON=="function"){if(!i||!Of.hasAnchor(e))return e.toJSON(t,i);let n={aliasCount:0,count:1,res:void 0};i.anchors.set(e,n),i.onCreate=a=>{n.res=a,delete i.onCreate};let r=e.toJSON(t,i);return i.onCreate&&i.onCreate(r),r}return typeof e=="bigint"&&!i?.keep?Number(e):e}ss.toJS=os});var Fi=w(ls=>{"use strict";var $f=Sr(),cs=R(),Hf=Ne(),Er=class{constructor(t){Object.defineProperty(this,cs.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:i,maxAliasCount:n,onAnchor:r,reviver:a}={}){if(!cs.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},s=Hf.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof a=="function"?$f.applyReviver(a,{"":s},"",s):s}};ls.NodeBase=Er});var _t=w(us=>{"use strict";var Mf=Mi(),Ff=Pt(),ot=R(),Lf=Fi(),Df=Ne(),Rr=class extends Lf.NodeBase{constructor(t){super(ot.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;i?.aliasResolveCache?n=i.aliasResolveCache:(n=[],Ff.visit(t,{Node:(a,o)=>{(ot.isAlias(o)||ot.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(t,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||(Df.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=Li(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(t,i,n){let r=`*${this.source}`;if(t){if(Mf.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${r} `}return r}};function Li(e,t,i){if(ot.isAlias(t)){let n=t.resolve(e),r=i&&n&&i.get(n);return r?r.count*r.aliasCount:0}else if(ot.isCollection(t)){let n=0;for(let r of t.items){let a=Li(e,r,i);a>n&&(n=a)}return n}else if(ot.isPair(t)){let n=Li(e,t.key,i),r=Li(e,t.value,i);return Math.max(n,r)}return 1}us.Alias=Rr});var $=w(Cr=>{"use strict";var Bf=R(),qf=Fi(),Vf=Ne(),Wf=e=>!e||typeof e!="function"&&typeof e!="object",be=class extends qf.NodeBase{constructor(t){super(Bf.SCALAR),this.value=t}toJSON(t,i){return i?.keep?this.value:Vf.toJS(this.value,t,i)}toString(){return String(this.value)}};be.BLOCK_FOLDED="BLOCK_FOLDED";be.BLOCK_LITERAL="BLOCK_LITERAL";be.PLAIN="PLAIN";be.QUOTE_DOUBLE="QUOTE_DOUBLE";be.QUOTE_SINGLE="QUOTE_SINGLE";Cr.Scalar=be;Cr.isScalarValue=Wf});var It=w(ds=>{"use strict";var zf=_t(),Fe=R(),fs=$(),Jf="tag:yaml.org,2002:";function Gf(e,t,i){if(t){let n=i.filter(a=>a.tag===t),r=n.find(a=>!a.format)??n[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return i.find(n=>n.identify?.(e)&&!n.format)}function Kf(e,t,i){if(Fe.isDocument(e)&&(e=e.contents),Fe.isNode(e))return e;if(Fe.isPair(e)){let f=i.schema[Fe.MAP].createNode?.(i.schema,null,i);return f.items.push(e),f}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:n,onAnchor:r,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(n&&e&&typeof e=="object"){if(c=s.get(e),c)return c.anchor??(c.anchor=r(e)),new zf.Alias(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith("!!")&&(t=Jf+t.slice(2));let l=Gf(e,t,o.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let f=new fs.Scalar(e);return c&&(c.node=f),f}l=e instanceof Map?o[Fe.MAP]:Symbol.iterator in Object(e)?o[Fe.SEQ]:o[Fe.MAP]}a&&(a(l),delete i.onTagObj);let u=l?.createNode?l.createNode(i.schema,e,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,e,i):new fs.Scalar(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}ds.createNode=Kf});var Bi=w(Di=>{"use strict";var Uf=It(),de=R(),Yf=Fi();function Pr(e,t,i){let n=i;for(let r=t.length-1;r>=0;--r){let a=t[r];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=n,n=o}else n=new Map([[a,n]])}return Uf.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var hs=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Ar=class extends Yf.NodeBase{constructor(t,i){super(t),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(t){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(i.schema=t),i.items=i.items.map(n=>de.isNode(n)||de.isPair(n)?n.clone(t):n),this.range&&(i.range=this.range.slice()),i}addIn(t,i){if(hs(t))this.add(i);else{let[n,...r]=t,a=this.get(n,!0);if(de.isCollection(a))a.addIn(r,i);else if(a===void 0&&this.schema)this.set(n,Pr(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(t){let[i,...n]=t;if(n.length===0)return this.delete(i);let r=this.get(i,!0);if(de.isCollection(r))return r.deleteIn(n);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}getIn(t,i){let[n,...r]=t,a=this.get(n,!0);return r.length===0?!i&&de.isScalar(a)?a.value:a:de.isCollection(a)?a.getIn(r,i):void 0}hasAllNullValues(t){return this.items.every(i=>{if(!de.isPair(i))return!1;let n=i.value;return n==null||t&&de.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(t){let[i,...n]=t;if(n.length===0)return this.has(i);let r=this.get(i,!0);return de.isCollection(r)?r.hasIn(n):!1}setIn(t,i){let[n,...r]=t;if(r.length===0)this.set(n,i);else{let a=this.get(n,!0);if(de.isCollection(a))a.setIn(r,i);else if(a===void 0&&this.schema)this.set(n,Pr(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};Di.Collection=Ar;Di.collectionFromPath=Pr;Di.isEmptyPath=hs});var jt=w(qi=>{"use strict";var Xf=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function xr(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Qf=(e,t,i)=>e.endsWith(`
6
- `)?xr(i,t):i.includes(`
4
+ var Ju=Object.create;var xo=Object.defineProperty;var Gu=Object.getOwnPropertyDescriptor;var Uu=Object.getOwnPropertyNames;var Ku=Object.getPrototypeOf,Yu=Object.prototype.hasOwnProperty;var Pi=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,i)=>(typeof require<"u"?require:t)[i]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var g=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}};var Xu=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Uu(t))!Yu.call(e,n)&&n!==i&&xo(e,n,{get:()=>t[n],enumerable:!(r=Gu(t,n))||r.enumerable});return e};var Ri=(e,t,i)=>(i=e!=null?Ju(Ku(e)):{},Xu(t||!e||!e.__esModule?xo(i,"default",{value:e,enumerable:!0}):i,e));var P=g(B=>{"use strict";var an=Symbol.for("yaml.alias"),Co=Symbol.for("yaml.document"),xi=Symbol.for("yaml.map"),Ao=Symbol.for("yaml.pair"),on=Symbol.for("yaml.scalar"),Ci=Symbol.for("yaml.seq"),me=Symbol.for("yaml.node.type"),Qu=e=>!!e&&typeof e=="object"&&e[me]===an,Zu=e=>!!e&&typeof e=="object"&&e[me]===Co,ed=e=>!!e&&typeof e=="object"&&e[me]===xi,td=e=>!!e&&typeof e=="object"&&e[me]===Ao,_o=e=>!!e&&typeof e=="object"&&e[me]===on,id=e=>!!e&&typeof e=="object"&&e[me]===Ci;function To(e){if(e&&typeof e=="object")switch(e[me]){case xi:case Ci:return!0}return!1}function rd(e){if(e&&typeof e=="object")switch(e[me]){case an:case xi:case on:case Ci:return!0}return!1}var nd=e=>(_o(e)||To(e))&&!!e.anchor;B.ALIAS=an;B.DOC=Co;B.MAP=xi;B.NODE_TYPE=me;B.PAIR=Ao;B.SCALAR=on;B.SEQ=Ci;B.hasAnchor=nd;B.isAlias=Qu;B.isCollection=To;B.isDocument=Zu;B.isMap=ed;B.isNode=rd;B.isPair=td;B.isScalar=_o;B.isSeq=id});var Nt=g(sn=>{"use strict";var D=P(),q=Symbol("break visit"),Io=Symbol("skip children"),le=Symbol("remove node");function Ai(e,t){let i=jo(t);D.isDocument(e)?Ze(null,e.contents,i,Object.freeze([e]))===le&&(e.contents=null):Ze(null,e,i,Object.freeze([]))}Ai.BREAK=q;Ai.SKIP=Io;Ai.REMOVE=le;function Ze(e,t,i,r){let n=$o(e,t,i,r);if(D.isNode(n)||D.isPair(n))return Oo(e,r,n),Ze(e,n,i,r);if(typeof n!="symbol"){if(D.isCollection(t)){r=Object.freeze(r.concat(t));for(let a=0;a<t.items.length;++a){let o=Ze(a,t.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===q)return q;o===le&&(t.items.splice(a,1),a-=1)}}}else if(D.isPair(t)){r=Object.freeze(r.concat(t));let a=Ze("key",t.key,i,r);if(a===q)return q;a===le&&(t.key=null);let o=Ze("value",t.value,i,r);if(o===q)return q;o===le&&(t.value=null)}}return n}async function _i(e,t){let i=jo(t);D.isDocument(e)?await et(null,e.contents,i,Object.freeze([e]))===le&&(e.contents=null):await et(null,e,i,Object.freeze([]))}_i.BREAK=q;_i.SKIP=Io;_i.REMOVE=le;async function et(e,t,i,r){let n=await $o(e,t,i,r);if(D.isNode(n)||D.isPair(n))return Oo(e,r,n),et(e,n,i,r);if(typeof n!="symbol"){if(D.isCollection(t)){r=Object.freeze(r.concat(t));for(let a=0;a<t.items.length;++a){let o=await et(a,t.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===q)return q;o===le&&(t.items.splice(a,1),a-=1)}}}else if(D.isPair(t)){r=Object.freeze(r.concat(t));let a=await et("key",t.key,i,r);if(a===q)return q;a===le&&(t.key=null);let o=await et("value",t.value,i,r);if(o===q)return q;o===le&&(t.value=null)}}return n}function jo(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function $o(e,t,i,r){if(typeof i=="function")return i(e,t,r);if(D.isMap(t))return i.Map?.(e,t,r);if(D.isSeq(t))return i.Seq?.(e,t,r);if(D.isPair(t))return i.Pair?.(e,t,r);if(D.isScalar(t))return i.Scalar?.(e,t,r);if(D.isAlias(t))return i.Alias?.(e,t,r)}function Oo(e,t,i){let r=t[t.length-1];if(D.isCollection(r))r.items[e]=i;else if(D.isPair(r))e==="key"?r.key=i:r.value=i;else if(D.isDocument(r))r.contents=i;else{let n=D.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}sn.visit=Ai;sn.visitAsync=_i});var cn=g(Do=>{"use strict";var Ho=P(),ad=Nt(),od={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},sd=e=>e.replace(/[!,[\]{}]/g,t=>od[t]),bt=class e{constructor(t,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,i)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,i){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let r=t.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(t,i){if(t==="!")return"!";if(t[0]!=="!")return i(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,r,n]=t.match(/^(.*!)([^!]*)$/s);n||i(`The ${t} 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==="!"?t:(i(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[i,r]of Object.entries(this.tags))if(t.startsWith(r))return i+sd(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(t&&r.length>0&&Ho.isNode(t.contents)){let a={};ad.visit(t.contents,(o,s)=>{Ho.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:"||(!t||n.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
5
+ `)}};bt.defaultYaml={explicit:!1,version:"1.2"};bt.defaultTags={"!!":"tag:yaml.org,2002:"};Do.Directives=bt});var Ti=g(kt=>{"use strict";var Bo=P(),cd=Nt();function ld(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(i)}return!0}function Lo(e){let t=new Set;return cd.visit(e,{Value(i,r){r.anchor&&t.add(r.anchor)}}),t}function Mo(e,t){for(let i=1;;++i){let r=`${e}${i}`;if(!t.has(r))return r}}function ud(e,t){let i=[],r=new Map,n=null;return{onAnchor:a=>{i.push(a),n??(n=Lo(e));let o=Mo(t,n);return n.add(o),o},setAnchors:()=>{for(let a of i){let o=r.get(a);if(typeof o=="object"&&o.anchor&&(Bo.isScalar(o.node)||Bo.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}}kt.anchorIsValid=ld;kt.anchorNames=Lo;kt.createNodeAnchors=ud;kt.findNewAnchor=Mo});var ln=g(Fo=>{"use strict";function St(e,t,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=St(e,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=St(e,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=St(e,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=St(e,r,n,a);o===void 0?delete r[n]:o!==a&&(r[n]=o)}return e.call(t,i,r)}Fo.applyReviver=St});var Ne=g(qo=>{"use strict";var dd=P();function Vo(e,t,i){if(Array.isArray(e))return e.map((r,n)=>Vo(r,String(n),i));if(e&&typeof e.toJSON=="function"){if(!i||!dd.hasAnchor(e))return e.toJSON(t,i);let r={aliasCount:0,count:1,res:void 0};i.anchors.set(e,r),i.onCreate=a=>{r.res=a,delete i.onCreate};let n=e.toJSON(t,i);return i.onCreate&&i.onCreate(n),n}return typeof e=="bigint"&&!i?.keep?Number(e):e}qo.toJS=Vo});var Ii=g(zo=>{"use strict";var fd=ln(),Wo=P(),hd=Ne(),un=class{constructor(t){Object.defineProperty(this,Wo.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:i,maxAliasCount:r,onAnchor:n,reviver:a}={}){if(!Wo.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},s=hd.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:l}of o.anchors.values())n(l,c);return typeof a=="function"?fd.applyReviver(a,{"":s},"",s):s}};zo.NodeBase=un});var Et=g(Jo=>{"use strict";var pd=Ti(),md=Nt(),tt=P(),vd=Ii(),gd=Ne(),dn=class extends vd.NodeBase{constructor(t){super(tt.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;i?.aliasResolveCache?r=i.aliasResolveCache:(r=[],md.visit(t,{Node:(a,o)=>{(tt.isAlias(o)||tt.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(t,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||(gd.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=ji(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(t,i,r){let n=`*${this.source}`;if(t){if(pd.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${n} `}return n}};function ji(e,t,i){if(tt.isAlias(t)){let r=t.resolve(e),n=i&&r&&i.get(r);return n?n.count*n.aliasCount:0}else if(tt.isCollection(t)){let r=0;for(let n of t.items){let a=ji(e,n,i);a>r&&(r=a)}return r}else if(tt.isPair(t)){let r=ji(e,t.key,i),n=ji(e,t.value,i);return Math.max(r,n)}return 1}Jo.Alias=dn});var j=g(fn=>{"use strict";var wd=P(),yd=Ii(),Nd=Ne(),bd=e=>!e||typeof e!="function"&&typeof e!="object",be=class extends yd.NodeBase{constructor(t){super(wd.SCALAR),this.value=t}toJSON(t,i){return i?.keep?this.value:Nd.toJS(this.value,t,i)}toString(){return String(this.value)}};be.BLOCK_FOLDED="BLOCK_FOLDED";be.BLOCK_LITERAL="BLOCK_LITERAL";be.PLAIN="PLAIN";be.QUOTE_DOUBLE="QUOTE_DOUBLE";be.QUOTE_SINGLE="QUOTE_SINGLE";fn.Scalar=be;fn.isScalarValue=bd});var Pt=g(Uo=>{"use strict";var kd=Et(),Me=P(),Go=j(),Sd="tag:yaml.org,2002:";function Ed(e,t,i){if(t){let r=i.filter(a=>a.tag===t),n=r.find(a=>!a.format)??r[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return i.find(r=>r.identify?.(e)&&!r.format)}function Pd(e,t,i){if(Me.isDocument(e)&&(e=e.contents),Me.isNode(e))return e;if(Me.isPair(e)){let u=i.schema[Me.MAP].createNode?.(i.schema,null,i);return u.items.push(e),u}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:n,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(r&&e&&typeof e=="object"){if(c=s.get(e),c)return c.anchor??(c.anchor=n(e)),new kd.Alias(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith("!!")&&(t=Sd+t.slice(2));let l=Ed(e,t,o.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let u=new Go.Scalar(e);return c&&(c.node=u),u}l=e instanceof Map?o[Me.MAP]:Symbol.iterator in Object(e)?o[Me.SEQ]:o[Me.MAP]}a&&(a(l),delete i.onTagObj);let d=l?.createNode?l.createNode(i.schema,e,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,e,i):new Go.Scalar(e);return t?d.tag=t:l.default||(d.tag=l.tag),c&&(c.node=d),d}Uo.createNode=Pd});var Oi=g($i=>{"use strict";var Rd=Pt(),ue=P(),xd=Ii();function hn(e,t,i){let r=i;for(let n=t.length-1;n>=0;--n){let a=t[n];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=r,r=o}else r=new Map([[a,r]])}return Rd.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Ko=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,pn=class extends xd.NodeBase{constructor(t,i){super(t),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(t){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(i.schema=t),i.items=i.items.map(r=>ue.isNode(r)||ue.isPair(r)?r.clone(t):r),this.range&&(i.range=this.range.slice()),i}addIn(t,i){if(Ko(t))this.add(i);else{let[r,...n]=t,a=this.get(r,!0);if(ue.isCollection(a))a.addIn(n,i);else if(a===void 0&&this.schema)this.set(r,hn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(t){let[i,...r]=t;if(r.length===0)return this.delete(i);let n=this.get(i,!0);if(ue.isCollection(n))return n.deleteIn(r);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}getIn(t,i){let[r,...n]=t,a=this.get(r,!0);return n.length===0?!i&&ue.isScalar(a)?a.value:a:ue.isCollection(a)?a.getIn(n,i):void 0}hasAllNullValues(t){return this.items.every(i=>{if(!ue.isPair(i))return!1;let r=i.value;return r==null||t&&ue.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){let[i,...r]=t;if(r.length===0)return this.has(i);let n=this.get(i,!0);return ue.isCollection(n)?n.hasIn(r):!1}setIn(t,i){let[r,...n]=t;if(n.length===0)this.set(r,i);else{let a=this.get(r,!0);if(ue.isCollection(a))a.setIn(n,i);else if(a===void 0&&this.schema)this.set(r,hn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}};$i.Collection=pn;$i.collectionFromPath=hn;$i.isEmptyPath=Ko});var Rt=g(Hi=>{"use strict";var Cd=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function mn(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Ad=(e,t,i)=>e.endsWith(`
6
+ `)?mn(i,t):i.includes(`
7
7
  `)?`
8
- `+xr(i,t):(e.endsWith(" ")?"":" ")+i;qi.indentComment=xr;qi.lineComment=Qf;qi.stringifyComment=Xf});var ms=w(Ot=>{"use strict";var Zf="flow",Tr="block",Vi="quoted";function ed(e,t,i="flow",{indentAtStart:n,lineWidth:r=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!r||r<0)return e;r<a&&(a=0);let c=Math.max(1+a,1+r-t.length);if(e.length<=c)return e;let l=[],u={},f=r-t.length;typeof n=="number"&&(n>r-Math.max(2,a)?l.push(0):f=r-n);let d,m,g=!1,h=-1,p=-1,y=-1;i===Tr&&(h=ps(e,h,t.length),h!==-1&&(f=h+c));for(let k;k=e[h+=1];){if(i===Vi&&k==="\\"){switch(p=h,e[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===Tr&&(h=ps(e,h,t.length)),f=h+t.length+c,d=void 0;else{if(k===" "&&m&&m!==" "&&m!==`
10
- `&&m!==" "){let S=e[h+1];S&&S!==" "&&S!==`
11
- `&&S!==" "&&(d=h)}if(h>=f)if(d)l.push(d),f=d+c,d=void 0;else if(i===Vi){for(;m===" "||m===" ";)m=k,k=e[h+=1],g=!0;let S=h>y+1?h-2:p-1;if(u[S])return e;l.push(S),u[S]=!0,f=S+c,d=void 0}else g=!0}m=k}if(g&&s&&s(),l.length===0)return e;o&&o();let N=e.slice(0,l[0]);for(let k=0;k<l.length;++k){let S=l[k],E=l[k+1]||e.length;S===0?N=`
12
- ${t}${e.slice(0,E)}`:(i===Vi&&u[S]&&(N+=`${e[S]}\\`),N+=`
13
- ${t}${e.slice(S+1,E)}`)}return N}function ps(e,t,i){let n=t,r=t+1,a=e[r];for(;a===" "||a===" ";)if(t<r+i)a=e[++t];else{do a=e[++t];while(a&&a!==`
14
- `);n=t,r=t+1,a=e[r]}return n}Ot.FOLD_BLOCK=Tr;Ot.FOLD_FLOW=Zf;Ot.FOLD_QUOTED=Vi;Ot.foldFlowLines=ed});var Ht=w(vs=>{"use strict";var ie=$(),ke=ms(),zi=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ji=e=>/^(%|---|\.\.\.)/m.test(e);function td(e,t,i){if(!t||t<0)return!1;let n=t-i,r=e.length;if(r<=n)return!1;for(let a=0,o=0;a<r;++a)if(e[a]===`
15
- `){if(a-o>n)return!0;if(o=a+1,r-o<=n)return!1}return!0}function $t(e,t){let i=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return i;let{implicitKey:n}=t,r=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Ji(e)?" ":""),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(n||i[c+2]==='"'||i.length<r)c+=1;else{for(o+=i.slice(s,c)+`
8
+ `+mn(i,t):(e.endsWith(" ")?"":" ")+i;Hi.indentComment=mn;Hi.lineComment=Ad;Hi.stringifyComment=Cd});var Xo=g(xt=>{"use strict";var _d="flow",vn="block",Di="quoted";function Td(e,t,i="flow",{indentAtStart:r,lineWidth:n=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!n||n<0)return e;n<a&&(a=0);let c=Math.max(1+a,1+n-t.length);if(e.length<=c)return e;let l=[],d={},u=n-t.length;typeof r=="number"&&(r>n-Math.max(2,a)?l.push(0):u=n-r);let f,p,v=!1,h=-1,m=-1,w=-1;i===vn&&(h=Yo(e,h,t.length),h!==-1&&(u=h+c));for(let b;b=e[h+=1];){if(i===Di&&b==="\\"){switch(m=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(b===`
9
+ `)i===vn&&(h=Yo(e,h,t.length)),u=h+t.length+c,f=void 0;else{if(b===" "&&p&&p!==" "&&p!==`
10
+ `&&p!==" "){let k=e[h+1];k&&k!==" "&&k!==`
11
+ `&&k!==" "&&(f=h)}if(h>=u)if(f)l.push(f),u=f+c,f=void 0;else if(i===Di){for(;p===" "||p===" ";)p=b,b=e[h+=1],v=!0;let k=h>w+1?h-2:m-1;if(d[k])return e;l.push(k),d[k]=!0,u=k+c,f=void 0}else v=!0}p=b}if(v&&s&&s(),l.length===0)return e;o&&o();let y=e.slice(0,l[0]);for(let b=0;b<l.length;++b){let k=l[b],S=l[b+1]||e.length;k===0?y=`
12
+ ${t}${e.slice(0,S)}`:(i===Di&&d[k]&&(y+=`${e[k]}\\`),y+=`
13
+ ${t}${e.slice(k+1,S)}`)}return y}function Yo(e,t,i){let r=t,n=t+1,a=e[n];for(;a===" "||a===" ";)if(t<n+i)a=e[++t];else{do a=e[++t];while(a&&a!==`
14
+ `);r=t,n=t+1,a=e[n]}return r}xt.FOLD_BLOCK=vn;xt.FOLD_FLOW=_d;xt.FOLD_QUOTED=Di;xt.foldFlowLines=Td});var At=g(Qo=>{"use strict";var te=j(),ke=Xo(),Li=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Mi=e=>/^(%|---|\.\.\.)/m.test(e);function Id(e,t,i){if(!t||t<0)return!1;let r=t-i,n=e.length;if(n<=r)return!1;for(let a=0,o=0;a<n;++a)if(e[a]===`
15
+ `){if(a-o>r)return!0;if(o=a+1,n-o<=r)return!1}return!0}function Ct(e,t){let i=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return i;let{implicitKey:r}=t,n=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Mi(e)?" ":""),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(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:ke.foldFlowLines(o,a,ke.FOLD_QUOTED,zi(t,!1))}function _r(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(e))return $t(e,t);let i=t.indent||(Ji(e)?" ":""),n="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${i}`)+"'";return t.implicitKey?n:ke.foldFlowLines(n,i,ke.FOLD_FLOW,zi(t,!1))}function st(e,t){let{singleQuote:i}=t.options,n;if(i===!1)n=$t;else{let r=e.includes('"'),a=e.includes("'");r&&!a?n=_r:a&&!r?n=$t:n=i?_r:$t}return n(e,t)}var Ir;try{Ir=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:ke.foldFlowLines(o,a,ke.FOLD_QUOTED,Li(t,!1))}function gn(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(e))return Ct(e,t);let i=t.indent||(Mi(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${i}`)+"'";return t.implicitKey?r:ke.foldFlowLines(r,i,ke.FOLD_FLOW,Li(t,!1))}function it(e,t){let{singleQuote:i}=t.options,r;if(i===!1)r=Ct;else{let n=e.includes('"'),a=e.includes("'");n&&!a?r=gn:a&&!n?r=Ct:r=i?gn:Ct}return r(e,t)}var wn;try{wn=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{Ir=/\n+(?!\n|$)/g}function Wi({comment:e,type:t,value:i},n,r,a){let{blockQuote:o,commentString:s,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(i))return st(i,n);let l=n.indent||(n.forceBlockIndent||Ji(i)?" ":""),u=o==="literal"?!0:o==="folded"||t===ie.Scalar.BLOCK_FOLDED?!1:t===ie.Scalar.BLOCK_LITERAL?!0:!td(i,c,l.length);if(!i)return u?`|
23
+ |$)`,"g")}catch{wn=/\n+(?!\n|$)/g}function Bi({comment:e,type:t,value:i},r,n,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(i))return it(i,r);let l=r.indent||(r.forceBlockIndent||Mi(i)?" ":""),d=o==="literal"?!0:o==="folded"||t===te.Scalar.BLOCK_FOLDED?!1:t===te.Scalar.BLOCK_LITERAL?!0:!Id(i,c,l.length);if(!i)return d?`|
24
24
  `:`>
25
- `;let f,d;for(d=i.length;d>0;--d){let E=i[d-1];if(E!==`
26
- `&&E!==" "&&E!==" ")break}let m=i.substring(d),g=m.indexOf(`
27
- `);g===-1?f="-":i===m||g!==m.length-1?(f="+",a&&a()):f="",m&&(i=i.slice(0,-m.length),m[m.length-1]===`
28
- `&&(m=m.slice(0,-1)),m=m.replace(Ir,`$&${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":"")+f;if(e&&(S+=" "+s(e.replace(/ ?[\r\n]+/g," ")),r&&r()),!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,C=zi(n,!0);o!=="folded"&&t!==ie.Scalar.BLOCK_FOLDED&&(C.onOverflow=()=>{v=!0});let b=ke.foldFlowLines(`${N}${E}${m}`,l,ke.FOLD_BLOCK,C);if(!v)return`>${S}
31
- ${l}${b}`}return i=i.replace(/\n+/g,`$&${l}`),`|${S}
32
- ${l}${N}${i}${m}`}function id(e,t,i,n){let{type:r,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
33
- `)||u&&/[[\]{},]/.test(a))return st(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
34
- `)?st(a,t):Wi(e,t,i,n);if(!s&&!u&&r!==ie.Scalar.PLAIN&&a.includes(`
35
- `))return Wi(e,t,i,n);if(Ji(a)){if(c==="")return t.forceBlockIndent=!0,Wi(e,t,i,n);if(s&&c===l)return st(a,t)}let f=a.replace(/\n+/g,`$&
36
- ${c}`);if(o){let d=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(f),{compat:m,tags:g}=t.doc.schema;if(g.some(d)||m?.some(d))return st(a,t)}return s?f:ke.foldFlowLines(f,c,ke.FOLD_FLOW,zi(t,!1))}function nd(e,t,i,n){let{implicitKey:r,inFlow:a}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==ie.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=ie.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ie.Scalar.BLOCK_FOLDED:case ie.Scalar.BLOCK_LITERAL:return r||a?st(o.value,t):Wi(o,t,i,n);case ie.Scalar.QUOTE_DOUBLE:return $t(o.value,t);case ie.Scalar.QUOTE_SINGLE:return _r(o.value,t);case ie.Scalar.PLAIN:return id(o,t,i,n);default:return null}},l=c(s);if(l===null){let{defaultKeyType:u,defaultStringType:f}=t.options,d=r&&u||f;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}vs.stringifyString=nd});var Mt=w(jr=>{"use strict";var rd=Mi(),Se=R(),ad=jt(),od=Ht();function sd(e,t){let i=Object.assign({blockQuote:!0,commentString:ad.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},e.schema.toStringOptions,t),n;switch(i.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:e,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:n,options:i}}function cd(e,t){if(t.tag){let r=e.filter(a=>a.tag===t.tag);if(r.length>0)return r.find(a=>a.format===t.format)??r[0]}let i,n;if(Se.isScalar(t)){n=t.value;let r=e.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===t.format)??r.find(a=>!a.format)}else n=t,i=e.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 ld(e,t,{anchors:i,doc:n}){if(!n.directives)return"";let r=[],a=(Se.isScalar(e)||Se.isCollection(e))&&e.anchor;a&&rd.anchorIsValid(a)&&(i.add(a),r.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&r.push(n.directives.tagString(o)),r.join(" ")}function ud(e,t,i,n){if(Se.isPair(e))return e.toString(t,i,n);if(Se.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let r,a=Se.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>r=c});r??(r=cd(t.doc.schema.tags,a));let o=ld(a,r,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof r.stringify=="function"?r.stringify(a,t,i,n):Se.isScalar(a)?od.stringifyString(a,t,i,n):a.toString(t,i,n);return o?Se.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
- ${t.indent}${s}`:s}jr.createStringifyContext=sd;jr.stringify=ud});var Ns=w(ys=>{"use strict";var we=R(),gs=$(),ws=Mt(),Ft=jt();function fd({key:e,value:t},i,n,r){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=i,d=we.isNode(e)&&e.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(e)||!we.isNode(e)&&typeof e=="object"){let C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let m=!f&&(!e||d&&t==null&&!i.inFlow||we.isCollection(e)||(we.isScalar(e)?e.type===gs.Scalar.BLOCK_FOLDED||e.type===gs.Scalar.BLOCK_LITERAL:typeof e=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!m&&(f||!a),indent:s+c});let g=!1,h=!1,p=ws.stringify(e,i,()=>g=!0,()=>h=!0);if(!m&&!i.inFlow&&p.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(i.inFlow){if(a||t==null)return g&&n&&n(),p===""?"?":m?`? ${p}`:p}else if(a&&!f||t==null&&m)return p=`? ${p}`,d&&!g?p+=Ft.lineComment(p,i.indent,l(d)):h&&r&&r(),p;g&&(d=null),m?(d&&(p+=Ft.lineComment(p,i.indent,l(d))),p=`? ${p}
38
- ${s}:`):(p=`${p}:`,d&&(p+=Ft.lineComment(p,i.indent,l(d))));let y,N,k;we.isNode(t)?(y=!!t.spaceBefore,N=t.commentBefore,k=t.comment):(y=!1,N=null,k=null,t&&typeof t=="object"&&(t=o.createNode(t))),i.implicitKey=!1,!m&&!d&&we.isScalar(t)&&(i.indentAtStart=p.length+1),h=!1,!u&&c.length>=2&&!i.inFlow&&!m&&we.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(i.indent=i.indent.substring(2));let S=!1,E=ws.stringify(t,i,()=>S=!0,()=>h=!0),v=" ";if(d||y||N){if(v=y?`
39
- `:"",N){let C=l(N);v+=`
40
- ${Ft.indentComment(C,i.indent)}`}E===""&&!i.inFlow?v===`
41
- `&&k&&(v=`
25
+ `;let u,f;for(f=i.length;f>0;--f){let S=i[f-1];if(S!==`
26
+ `&&S!==" "&&S!==" ")break}let p=i.substring(f),v=p.indexOf(`
27
+ `);v===-1?u="-":i===p||v!==p.length-1?(u="+",a&&a()):u="",p&&(i=i.slice(0,-p.length),p[p.length-1]===`
28
+ `&&(p=p.slice(0,-1)),p=p.replace(wn,`$&${l}`));let h=!1,m,w=-1;for(m=0;m<i.length;++m){let S=i[m];if(S===" ")h=!0;else if(S===`
29
+ `)w=m;else break}let y=i.substring(0,w<m?w+1:m);y&&(i=i.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let k=(h?l?"2":"1":"")+u;if(e&&(k+=" "+s(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!d){let S=i.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,A=Li(r,!0);o!=="folded"&&t!==te.Scalar.BLOCK_FOLDED&&(A.onOverflow=()=>{E=!0});let N=ke.foldFlowLines(`${y}${S}${p}`,l,ke.FOLD_BLOCK,A);if(!E)return`>${k}
31
+ ${l}${N}`}return i=i.replace(/\n+/g,`$&${l}`),`|${k}
32
+ ${l}${y}${i}${p}`}function jd(e,t,i,r){let{type:n,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:d}=t;if(s&&a.includes(`
33
+ `)||d&&/[[\]{},]/.test(a))return it(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||d||!a.includes(`
34
+ `)?it(a,t):Bi(e,t,i,r);if(!s&&!d&&n!==te.Scalar.PLAIN&&a.includes(`
35
+ `))return Bi(e,t,i,r);if(Mi(a)){if(c==="")return t.forceBlockIndent=!0,Bi(e,t,i,r);if(s&&c===l)return it(a,t)}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:p,tags:v}=t.doc.schema;if(v.some(f)||p?.some(f))return it(a,t)}return s?u:ke.foldFlowLines(u,c,ke.FOLD_FLOW,Li(t,!1))}function $d(e,t,i,r){let{implicitKey:n,inFlow:a}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==te.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=te.Scalar.QUOTE_DOUBLE);let c=d=>{switch(d){case te.Scalar.BLOCK_FOLDED:case te.Scalar.BLOCK_LITERAL:return n||a?it(o.value,t):Bi(o,t,i,r);case te.Scalar.QUOTE_DOUBLE:return Ct(o.value,t);case te.Scalar.QUOTE_SINGLE:return gn(o.value,t);case te.Scalar.PLAIN:return jd(o,t,i,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:d,defaultStringType:u}=t.options,f=n&&d||u;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}Qo.stringifyString=$d});var _t=g(yn=>{"use strict";var Od=Ti(),Se=P(),Hd=Rt(),Dd=At();function Bd(e,t){let i=Object.assign({blockQuote:!0,commentString:Hd.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},e.schema.toStringOptions,t),r;switch(i.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:r,options:i}}function Ld(e,t){if(t.tag){let n=e.filter(a=>a.tag===t.tag);if(n.length>0)return n.find(a=>a.format===t.format)??n[0]}let i,r;if(Se.isScalar(t)){r=t.value;let n=e.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===t.format)??n.find(a=>!a.format)}else r=t,i=e.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 Md(e,t,{anchors:i,doc:r}){if(!r.directives)return"";let n=[],a=(Se.isScalar(e)||Se.isCollection(e))&&e.anchor;a&&Od.anchorIsValid(a)&&(i.add(a),n.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&n.push(r.directives.tagString(o)),n.join(" ")}function Fd(e,t,i,r){if(Se.isPair(e))return e.toString(t,i,r);if(Se.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let n,a=Se.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>n=c});n??(n=Ld(t.doc.schema.tags,a));let o=Md(a,n,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof n.stringify=="function"?n.stringify(a,t,i,r):Se.isScalar(a)?Dd.stringifyString(a,t,i,r):a.toString(t,i,r);return o?Se.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
+ ${t.indent}${s}`:s}yn.createStringifyContext=Bd;yn.stringify=Fd});var is=g(ts=>{"use strict";var ve=P(),Zo=j(),es=_t(),Tt=Rt();function Vd({key:e,value:t},i,r,n){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:d,simpleKeys:u}}=i,f=ve.isNode(e)&&e.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(ve.isCollection(e)||!ve.isNode(e)&&typeof e=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!u&&(!e||f&&t==null&&!i.inFlow||ve.isCollection(e)||(ve.isScalar(e)?e.type===Zo.Scalar.BLOCK_FOLDED||e.type===Zo.Scalar.BLOCK_LITERAL:typeof e=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!p&&(u||!a),indent:s+c});let v=!1,h=!1,m=es.stringify(e,i,()=>v=!0,()=>h=!0);if(!p&&!i.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(i.inFlow){if(a||t==null)return v&&r&&r(),m===""?"?":p?`? ${m}`:m}else if(a&&!u||t==null&&p)return m=`? ${m}`,f&&!v?m+=Tt.lineComment(m,i.indent,l(f)):h&&n&&n(),m;v&&(f=null),p?(f&&(m+=Tt.lineComment(m,i.indent,l(f))),m=`? ${m}
38
+ ${s}:`):(m=`${m}:`,f&&(m+=Tt.lineComment(m,i.indent,l(f))));let w,y,b;ve.isNode(t)?(w=!!t.spaceBefore,y=t.commentBefore,b=t.comment):(w=!1,y=null,b=null,t&&typeof t=="object"&&(t=o.createNode(t))),i.implicitKey=!1,!p&&!f&&ve.isScalar(t)&&(i.indentAtStart=m.length+1),h=!1,!d&&c.length>=2&&!i.inFlow&&!p&&ve.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(i.indent=i.indent.substring(2));let k=!1,S=es.stringify(t,i,()=>k=!0,()=>h=!0),E=" ";if(f||w||y){if(E=w?`
39
+ `:"",y){let A=l(y);E+=`
40
+ ${Tt.indentComment(A,i.indent)}`}S===""&&!i.inFlow?E===`
41
+ `&&b&&(E=`
42
42
 
43
- `):v+=`
44
- ${i.indent}`}else if(!m&&we.isCollection(t)){let C=E[0],b=E.indexOf(`
45
- `),_=b!==-1,z=i.inFlow??t.flow??t.items.length===0;if(_||!z){let nt=!1;if(_&&(C==="&"||C==="!")){let H=E.indexOf(" ");C==="&"&&H!==-1&&H<b&&E[H+1]==="!"&&(H=E.indexOf(" ",H+1)),(H===-1||b<H)&&(nt=!0)}nt||(v=`
46
- ${i.indent}`)}}else(E===""||E[0]===`
47
- `)&&(v="");return p+=v+E,i.inFlow?S&&n&&n():k&&!S?p+=Ft.lineComment(p,i.indent,l(k)):h&&r&&r(),p}ys.stringifyPair=fd});var $r=w(Or=>{"use strict";var bs=Ii("process");function dd(e,...t){e==="debug"&&console.log(...t)}function hd(e,t){(e==="debug"||e==="warn")&&(typeof bs.emitWarning=="function"?bs.emitWarning(t):console.warn(t))}Or.debug=dd;Or.warn=hd});var Xi=w(Yi=>{"use strict";var Ui=R(),ks=$(),Gi="<<",Ki={identify:e=>e===Gi||typeof e=="symbol"&&e.description===Gi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ks.Scalar(Symbol(Gi)),{addToJSMap:Ss}),stringify:()=>Gi},pd=(e,t)=>(Ki.identify(t)||Ui.isScalar(t)&&(!t.type||t.type===ks.Scalar.PLAIN)&&Ki.identify(t.value))&&e?.doc.schema.tags.some(i=>i.tag===Ki.tag&&i.default);function Ss(e,t,i){let n=Es(e,i);if(Ui.isSeq(n))for(let r of n.items)Hr(e,t,r);else if(Array.isArray(n))for(let r of n)Hr(e,t,r);else Hr(e,t,n)}function Hr(e,t,i){let n=Es(e,i);if(!Ui.isMap(n))throw new Error("Merge sources must be maps or map aliases");let r=n.toJSON(null,e,Map);for(let[a,o]of r)t instanceof Map?t.has(a)||t.set(a,o):t instanceof Set?t.add(a):Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function Es(e,t){return e&&Ui.isAlias(t)?t.resolve(e.doc,e):t}Yi.addMergeToJSMap=Ss;Yi.isMergeKey=pd;Yi.merge=Ki});var Fr=w(Ps=>{"use strict";var md=$r(),Rs=Xi(),vd=Mt(),Cs=R(),Mr=Ne();function gd(e,t,{key:i,value:n}){if(Cs.isNode(i)&&i.addToJSMap)i.addToJSMap(e,t,n);else if(Rs.isMergeKey(e,i))Rs.addMergeToJSMap(e,t,n);else{let r=Mr.toJS(i,"",e);if(t instanceof Map)t.set(r,Mr.toJS(n,r,e));else if(t instanceof Set)t.add(r);else{let a=wd(i,r,e),o=Mr.toJS(n,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function wd(e,t,i){if(t===null)return"";if(typeof t!="object")return String(t);if(Cs.isNode(e)&&i?.doc){let n=vd.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=e.toString(n);if(!i.mapKeyWarned){let a=JSON.stringify(r);a.length>40&&(a=a.substring(0,36)+'..."'),md.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(t)}Ps.addPairToJSMap=gd});var Ee=w(Lr=>{"use strict";var As=It(),yd=Ns(),Nd=Fr(),Qi=R();function bd(e,t,i){let n=As.createNode(e,void 0,i),r=As.createNode(t,void 0,i);return new Zi(n,r)}var Zi=class e{constructor(t,i=null){Object.defineProperty(this,Qi.NODE_TYPE,{value:Qi.PAIR}),this.key=t,this.value=i}clone(t){let{key:i,value:n}=this;return Qi.isNode(i)&&(i=i.clone(t)),Qi.isNode(n)&&(n=n.clone(t)),new e(i,n)}toJSON(t,i){let n=i?.mapAsMap?new Map:{};return Nd.addPairToJSMap(i,n,this)}toString(t,i,n){return t?.doc?yd.stringifyPair(this,t,i,n):JSON.stringify(this)}};Lr.Pair=Zi;Lr.createPair=bd});var Dr=w(Ts=>{"use strict";var Le=R(),xs=Mt(),en=jt();function kd(e,t,i){return(t.inFlow??e.flow?Ed:Sd)(e,t,i)}function Sd({comment:e,items:t},i,{blockItemPrefix:n,flowChars:r,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=i,u=Object.assign({},i,{indent:a,type:null}),f=!1,d=[];for(let g=0;g<t.length;++g){let h=t[g],p=null;if(Le.isNode(h))!f&&h.spaceBefore&&d.push(""),tn(i,d,h.commentBefore,f),h.comment&&(p=h.comment);else if(Le.isPair(h)){let N=Le.isNode(h.key)?h.key:null;N&&(!f&&N.spaceBefore&&d.push(""),tn(i,d,N.commentBefore,f))}f=!1;let y=xs.stringify(h,u,()=>p=null,()=>f=!0);p&&(y+=en.lineComment(y,a,l(p))),f&&p&&(f=!1),d.push(n+y)}let m;if(d.length===0)m=r.start+r.end;else{m=d[0];for(let g=1;g<d.length;++g){let h=d[g];m+=h?`
43
+ `):E+=`
44
+ ${i.indent}`}else if(!p&&ve.isCollection(t)){let A=S[0],N=S.indexOf(`
45
+ `),O=N!==-1,ye=i.inFlow??t.flow??t.items.length===0;if(O||!ye){let Qe=!1;if(O&&(A==="&"||A==="!")){let H=S.indexOf(" ");A==="&"&&H!==-1&&H<N&&S[H+1]==="!"&&(H=S.indexOf(" ",H+1)),(H===-1||N<H)&&(Qe=!0)}Qe||(E=`
46
+ ${i.indent}`)}}else(S===""||S[0]===`
47
+ `)&&(E="");return m+=E+S,i.inFlow?k&&r&&r():b&&!k?m+=Tt.lineComment(m,i.indent,l(b)):h&&n&&n(),m}ts.stringifyPair=Vd});var bn=g(Nn=>{"use strict";var rs=Pi("process");function qd(e,...t){e==="debug"&&console.log(...t)}function Wd(e,t){(e==="debug"||e==="warn")&&(typeof rs.emitWarning=="function"?rs.emitWarning(t):console.warn(t))}Nn.debug=qd;Nn.warn=Wd});var zi=g(Wi=>{"use strict";var qi=P(),ns=j(),Fi="<<",Vi={identify:e=>e===Fi||typeof e=="symbol"&&e.description===Fi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ns.Scalar(Symbol(Fi)),{addToJSMap:as}),stringify:()=>Fi},zd=(e,t)=>(Vi.identify(t)||qi.isScalar(t)&&(!t.type||t.type===ns.Scalar.PLAIN)&&Vi.identify(t.value))&&e?.doc.schema.tags.some(i=>i.tag===Vi.tag&&i.default);function as(e,t,i){let r=os(e,i);if(qi.isSeq(r))for(let n of r.items)kn(e,t,n);else if(Array.isArray(r))for(let n of r)kn(e,t,n);else kn(e,t,r)}function kn(e,t,i){let r=os(e,i);if(!qi.isMap(r))throw new Error("Merge sources must be maps or map aliases");let n=r.toJSON(null,e,Map);for(let[a,o]of n)t instanceof Map?t.has(a)||t.set(a,o):t instanceof Set?t.add(a):Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function os(e,t){return e&&qi.isAlias(t)?t.resolve(e.doc,e):t}Wi.addMergeToJSMap=as;Wi.isMergeKey=zd;Wi.merge=Vi});var En=g(ls=>{"use strict";var Jd=bn(),ss=zi(),Gd=_t(),cs=P(),Sn=Ne();function Ud(e,t,{key:i,value:r}){if(cs.isNode(i)&&i.addToJSMap)i.addToJSMap(e,t,r);else if(ss.isMergeKey(e,i))ss.addMergeToJSMap(e,t,r);else{let n=Sn.toJS(i,"",e);if(t instanceof Map)t.set(n,Sn.toJS(r,n,e));else if(t instanceof Set)t.add(n);else{let a=Kd(i,n,e),o=Sn.toJS(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Kd(e,t,i){if(t===null)return"";if(typeof t!="object")return String(t);if(cs.isNode(e)&&i?.doc){let r=Gd.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=e.toString(r);if(!i.mapKeyWarned){let a=JSON.stringify(n);a.length>40&&(a=a.substring(0,36)+'..."'),Jd.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(t)}ls.addPairToJSMap=Ud});var Ee=g(Pn=>{"use strict";var us=Pt(),Yd=is(),Xd=En(),Ji=P();function Qd(e,t,i){let r=us.createNode(e,void 0,i),n=us.createNode(t,void 0,i);return new Gi(r,n)}var Gi=class e{constructor(t,i=null){Object.defineProperty(this,Ji.NODE_TYPE,{value:Ji.PAIR}),this.key=t,this.value=i}clone(t){let{key:i,value:r}=this;return Ji.isNode(i)&&(i=i.clone(t)),Ji.isNode(r)&&(r=r.clone(t)),new e(i,r)}toJSON(t,i){let r=i?.mapAsMap?new Map:{};return Xd.addPairToJSMap(i,r,this)}toString(t,i,r){return t?.doc?Yd.stringifyPair(this,t,i,r):JSON.stringify(this)}};Pn.Pair=Gi;Pn.createPair=Qd});var Rn=g(fs=>{"use strict";var Fe=P(),ds=_t(),Ui=Rt();function Zd(e,t,i){return(t.inFlow??e.flow?tf:ef)(e,t,i)}function ef({comment:e,items:t},i,{blockItemPrefix:r,flowChars:n,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 v=0;v<t.length;++v){let h=t[v],m=null;if(Fe.isNode(h))!u&&h.spaceBefore&&f.push(""),Ki(i,f,h.commentBefore,u),h.comment&&(m=h.comment);else if(Fe.isPair(h)){let y=Fe.isNode(h.key)?h.key:null;y&&(!u&&y.spaceBefore&&f.push(""),Ki(i,f,y.commentBefore,u))}u=!1;let w=ds.stringify(h,d,()=>m=null,()=>u=!0);m&&(w+=Ui.lineComment(w,a,l(m))),u&&m&&(u=!1),f.push(r+w)}let p;if(f.length===0)p=n.start+n.end;else{p=f[0];for(let v=1;v<f.length;++v){let h=f[v];p+=h?`
48
48
  ${c}${h}`:`
49
- `}}return e?(m+=`
50
- `+en.indentComment(l(e),c),s&&s()):f&&o&&o(),m}function Ed({items:e},t,{flowChars:i,itemIndent:n}){let{indent:r,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;n+=a;let c=Object.assign({},t,{indent:n,inFlow:!0,type:null}),l=!1,u=0,f=[];for(let g=0;g<e.length;++g){let h=e[g],p=null;if(Le.isNode(h))h.spaceBefore&&f.push(""),tn(t,f,h.commentBefore,!1),h.comment&&(p=h.comment);else if(Le.isPair(h)){let N=Le.isNode(h.key)?h.key:null;N&&(N.spaceBefore&&f.push(""),tn(t,f,N.commentBefore,!1),N.comment&&(l=!0));let k=Le.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=xs.stringify(h,c,()=>p=null);l||(l=f.length>u||y.includes(`
51
- `)),g<e.length-1?y+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=f.reduce((N,k)=>N+k.length+2,2)+(y.length+2)>t.options.lineWidth)),l&&(y+=",")),p&&(y+=en.lineComment(y,n,s(p))),f.push(y),u=f.length}let{start:d,end:m}=i;if(f.length===0)return d+m;if(!l){let g=f.reduce((h,p)=>h+p.length+2,2);l=t.options.lineWidth>0&&g>t.options.lineWidth}if(l){let g=d;for(let h of f)g+=h?`
52
- ${a}${r}${h}`:`
53
- `;return`${g}
54
- ${r}${m}`}else return`${d}${o}${f.join(" ")}${o}${m}`}function tn({indent:e,options:{commentString:t}},i,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){let a=en.indentComment(t(n),e);i.push(a.trimStart())}}Ts.stringifyCollection=kd});var Ce=w(qr=>{"use strict";var Rd=Dr(),Cd=Fr(),Pd=Bi(),Re=R(),nn=Ee(),Ad=$();function Lt(e,t){let i=Re.isScalar(t)?t.value:t;for(let n of e)if(Re.isPair(n)&&(n.key===t||n.key===i||Re.isScalar(n.key)&&n.key.value===i))return n}var Br=class extends Pd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Re.MAP,t),this.items=[]}static from(t,i,n){let{keepUndefined:r,replacer:a}=n,o=new this(t),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(nn.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 t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,i){let n;Re.isPair(t)?n=t:!t||typeof t!="object"||!("key"in t)?n=new nn.Pair(t,t?.value):n=new nn.Pair(t.key,t.value);let r=Lt(this.items,n.key),a=this.schema?.sortMapEntries;if(r){if(!i)throw new Error(`Key ${n.key} already set`);Re.isScalar(r.value)&&Ad.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(t){let i=Lt(this.items,t);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(t,i){let r=Lt(this.items,t)?.value;return(!i&&Re.isScalar(r)?r.value:r)??void 0}has(t){return!!Lt(this.items,t)}set(t,i){this.add(new nn.Pair(t,i),!0)}toJSON(t,i,n){let r=n?new n:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(r);for(let a of this.items)Cd.addPairToJSMap(i,r,a);return r}toString(t,i,n){if(!t)return JSON.stringify(this);for(let r of this.items)if(!Re.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),Rd.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:n,onComment:i})}};qr.YAMLMap=Br;qr.findPair=Lt});var ct=w(Is=>{"use strict";var xd=R(),_s=Ce(),Td={collection:"map",default:!0,nodeClass:_s.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return xd.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,i)=>_s.YAMLMap.from(e,t,i)};Is.map=Td});var Pe=w(js=>{"use strict";var _d=It(),Id=Dr(),jd=Bi(),an=R(),Od=$(),$d=Ne(),Vr=class extends jd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(an.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let i=rn(t);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(t,i){let n=rn(t);if(typeof n!="number")return;let r=this.items[n];return!i&&an.isScalar(r)?r.value:r}has(t){let i=rn(t);return typeof i=="number"&&i<this.items.length}set(t,i){let n=rn(t);if(typeof n!="number")throw new Error(`Expected a valid index, not ${t}.`);let r=this.items[n];an.isScalar(r)&&Od.isScalarValue(i)?r.value=i:this.items[n]=i}toJSON(t,i){let n=[];i?.onCreate&&i.onCreate(n);let r=0;for(let a of this.items)n.push($d.toJS(a,String(r++),i));return n}toString(t,i,n){return t?Id.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:n,onComment:i}):JSON.stringify(this)}static from(t,i,n){let{replacer:r}=n,a=new this(t);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(_d.createNode(s,void 0,n))}}return a}};function rn(e){let t=an.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}js.YAMLSeq=Vr});var lt=w($s=>{"use strict";var Hd=R(),Os=Pe(),Md={collection:"seq",default:!0,nodeClass:Os.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Hd.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,i)=>Os.YAMLSeq.from(e,t,i)};$s.seq=Md});var Dt=w(Hs=>{"use strict";var Fd=Ht(),Ld={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,i,n){return t=Object.assign({actualString:!0},t),Fd.stringifyString(e,t,i,n)}};Hs.string=Ld});var on=w(Ls=>{"use strict";var Ms=$(),Fs={identify:e=>e==null,createNode:()=>new Ms.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ms.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&Fs.test.test(e)?e:t.options.nullStr};Ls.nullTag=Fs});var Wr=w(Bs=>{"use strict";var Dd=$(),Ds={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Dd.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},i){if(e&&Ds.test.test(e)){let n=e[0]==="t"||e[0]==="T";if(t===n)return e}return t?i.options.trueStr:i.options.falseStr}};Bs.boolTag=Ds});var ut=w(qs=>{"use strict";function Bd({format:e,minFractionDigits:t,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(!e&&t&&(!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=t-(a.length-o-1);for(;s-- >0;)a+="0"}return a}qs.stringifyNumber=Bd});var Jr=w(sn=>{"use strict";var qd=$(),zr=ut(),Vd={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:zr.stringifyNumber},Wd={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():zr.stringifyNumber(e)}},zd={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new qd.Scalar(parseFloat(e)),i=e.indexOf(".");return i!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-i-1),t},stringify:zr.stringifyNumber};sn.float=zd;sn.floatExp=Wd;sn.floatNaN=Vd});var Kr=w(ln=>{"use strict";var Vs=ut(),cn=e=>typeof e=="bigint"||Number.isInteger(e),Gr=(e,t,i,{intAsBigInt:n})=>n?BigInt(e):parseInt(e.substring(t),i);function Ws(e,t,i){let{value:n}=e;return cn(n)&&n>=0?i+n.toString(t):Vs.stringifyNumber(e)}var Jd={identify:e=>cn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,i)=>Gr(e,2,8,i),stringify:e=>Ws(e,8,"0o")},Gd={identify:cn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,i)=>Gr(e,0,10,i),stringify:Vs.stringifyNumber},Kd={identify:e=>cn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,i)=>Gr(e,2,16,i),stringify:e=>Ws(e,16,"0x")};ln.int=Gd;ln.intHex=Kd;ln.intOct=Jd});var Js=w(zs=>{"use strict";var Ud=ct(),Yd=on(),Xd=lt(),Qd=Dt(),Zd=Wr(),Ur=Jr(),Yr=Kr(),eh=[Ud.map,Xd.seq,Qd.string,Yd.nullTag,Zd.boolTag,Yr.intOct,Yr.int,Yr.intHex,Ur.floatNaN,Ur.floatExp,Ur.float];zs.schema=eh});var Us=w(Ks=>{"use strict";var th=$(),ih=ct(),nh=lt();function Gs(e){return typeof e=="bigint"||Number.isInteger(e)}var un=({value:e})=>JSON.stringify(e),rh=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:un},{identify:e=>e==null,createNode:()=>new th.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:un},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:un},{identify:Gs,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:i})=>i?BigInt(e):parseInt(e,10),stringify:({value:e})=>Gs(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:un}],ah={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},oh=[ih.map,nh.seq].concat(rh,ah);Ks.schema=oh});var Qr=w(Ys=>{"use strict";var Bt=Ii("buffer"),Xr=$(),sh=Ht(),ch={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Bt.Buffer=="function")return Bt.Buffer.from(e,"base64");if(typeof atob=="function"){let i=atob(e.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 t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:i},n,r,a){if(!i)return"";let o=i,s;if(typeof Bt.Buffer=="function")s=o instanceof Bt.Buffer?o.toString("base64"):Bt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Xr.Scalar.BLOCK_LITERAL),t!==Xr.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(s.length/c),u=new Array(l);for(let f=0,d=0;f<l;++f,d+=c)u[f]=s.substr(d,c);s=u.join(t===Xr.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return sh.stringifyString({comment:e,type:t,value:s},n,r,a)}};Ys.binary=ch});var hn=w(dn=>{"use strict";var fn=R(),Zr=Ee(),lh=$(),uh=Pe();function Xs(e,t){if(fn.isSeq(e))for(let i=0;i<e.items.length;++i){let n=e.items[i];if(!fn.isPair(n)){if(fn.isMap(n)){n.items.length>1&&t("Each pair must have its own sequence indicator");let r=n.items[0]||new Zr.Pair(new lh.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}e.items[i]=fn.isPair(n)?n:new Zr.Pair(n)}}else t("Expected a sequence for this tag");return e}function Qs(e,t,i){let{replacer:n}=i,r=new uh.YAMLSeq(e);r.tag="tag:yaml.org,2002:pairs";let a=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof n=="function"&&(o=n.call(t,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(Zr.createPair(s,c,i))}return r}var fh={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Xs,createNode:Qs};dn.createPairs=Qs;dn.pairs=fh;dn.resolvePairs=Xs});var ia=w(ta=>{"use strict";var Zs=R(),ea=Ne(),qt=Ce(),dh=Pe(),ec=hn(),De=class e extends dh.YAMLSeq{constructor(){super(),this.add=qt.YAMLMap.prototype.add.bind(this),this.delete=qt.YAMLMap.prototype.delete.bind(this),this.get=qt.YAMLMap.prototype.get.bind(this),this.has=qt.YAMLMap.prototype.has.bind(this),this.set=qt.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,i){if(!i)return super.toJSON(t);let n=new Map;i?.onCreate&&i.onCreate(n);for(let r of this.items){let a,o;if(Zs.isPair(r)?(a=ea.toJS(r.key,"",i),o=ea.toJS(r.value,a,i)):a=ea.toJS(r,"",i),n.has(a))throw new Error("Ordered maps must not include duplicate keys");n.set(a,o)}return n}static from(t,i,n){let r=ec.createPairs(t,i,n),a=new this;return a.items=r.items,a}};De.tag="tag:yaml.org,2002:omap";var hh={collection:"seq",identify:e=>e instanceof Map,nodeClass:De,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let i=ec.resolvePairs(e,t),n=[];for(let{key:r}of i.items)Zs.isScalar(r)&&(n.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new De,i)},createNode:(e,t,i)=>De.from(e,t,i)};ta.YAMLOMap=De;ta.omap=hh});var ac=w(na=>{"use strict";var tc=$();function ic({value:e,source:t},i){return t&&(e?nc:rc).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}var nc={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new tc.Scalar(!0),stringify:ic},rc={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new tc.Scalar(!1),stringify:ic};na.falseTag=rc;na.trueTag=nc});var oc=w(pn=>{"use strict";var ph=$(),ra=ut(),mh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ra.stringifyNumber},vh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():ra.stringifyNumber(e)}},gh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new ph.Scalar(parseFloat(e.replace(/_/g,""))),i=e.indexOf(".");if(i!==-1){let n=e.substring(i+1).replace(/_/g,"");n[n.length-1]==="0"&&(t.minFractionDigits=n.length)}return t},stringify:ra.stringifyNumber};pn.float=gh;pn.floatExp=vh;pn.floatNaN=mh});var cc=w(Wt=>{"use strict";var sc=ut(),Vt=e=>typeof e=="bigint"||Number.isInteger(e);function mn(e,t,i,{intAsBigInt:n}){let r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),n){switch(i){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return r==="-"?BigInt(-1)*o:o}let a=parseInt(e,i);return r==="-"?-1*a:a}function aa(e,t,i){let{value:n}=e;if(Vt(n)){let r=n.toString(t);return n<0?"-"+i+r.substr(1):i+r}return sc.stringifyNumber(e)}var wh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,i)=>mn(e,2,2,i),stringify:e=>aa(e,2,"0b")},yh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,i)=>mn(e,1,8,i),stringify:e=>aa(e,8,"0")},Nh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,i)=>mn(e,0,10,i),stringify:sc.stringifyNumber},bh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,i)=>mn(e,2,16,i),stringify:e=>aa(e,16,"0x")};Wt.int=Nh;Wt.intBin=wh;Wt.intHex=bh;Wt.intOct=yh});var sa=w(oa=>{"use strict";var wn=R(),vn=Ee(),gn=Ce(),Be=class e extends gn.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let i;wn.isPair(t)?i=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?i=new vn.Pair(t.key,null):i=new vn.Pair(t,null),gn.findPair(this.items,i.key)||this.items.push(i)}get(t,i){let n=gn.findPair(this.items,t);return!i&&wn.isPair(n)?wn.isScalar(n.key)?n.key.value:n.key:n}set(t,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let n=gn.findPair(this.items,t);n&&!i?this.items.splice(this.items.indexOf(n),1):!n&&i&&this.items.push(new vn.Pair(t))}toJSON(t,i){return super.toJSON(t,i,Set)}toString(t,i,n){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),i,n);throw new Error("Set items must all have null values")}static from(t,i,n){let{replacer:r}=n,a=new this(t);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof r=="function"&&(o=r.call(i,o,o)),a.items.push(vn.createPair(o,null,n));return a}};Be.tag="tag:yaml.org,2002:set";var kh={collection:"map",identify:e=>e instanceof Set,nodeClass:Be,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,i)=>Be.from(e,t,i),resolve(e,t){if(wn.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Be,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};oa.YAMLSet=Be;oa.set=kh});var la=w(yn=>{"use strict";var Sh=ut();function ca(e,t){let i=e[0],n=i==="-"||i==="+"?e.substring(1):e,r=o=>t?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 lc(e){let{value:t}=e,i=o=>o;if(typeof t=="bigint")i=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Sh.stringifyNumber(e);let n="";t<0&&(n="-",t*=i(-1));let r=i(60),a=[t%r];return t<60?a.unshift(0):(t=(t-a[0])/r,a.unshift(t%r),t>=60&&(t=(t-a[0])/r,a.unshift(t))),n+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Eh={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:i})=>ca(e,i),stringify:lc},Rh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>ca(e,!1),stringify:lc},uc={identify:e=>e 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(e){let t=e.match(uc.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,n,r,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(i,n-1,r,a||0,o||0,s||0,c),u=t[8];if(u&&u!=="Z"){let f=ca(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};yn.floatTime=Rh;yn.intTime=Eh;yn.timestamp=uc});var hc=w(dc=>{"use strict";var Ch=ct(),Ph=on(),Ah=lt(),xh=Dt(),Th=Qr(),fc=ac(),ua=oc(),Nn=cc(),_h=Xi(),Ih=ia(),jh=hn(),Oh=sa(),fa=la(),$h=[Ch.map,Ah.seq,xh.string,Ph.nullTag,fc.trueTag,fc.falseTag,Nn.intBin,Nn.intOct,Nn.int,Nn.intHex,ua.floatNaN,ua.floatExp,ua.float,Th.binary,_h.merge,Ih.omap,jh.pairs,Oh.set,fa.intTime,fa.floatTime,fa.timestamp];dc.schema=$h});var Sc=w(pa=>{"use strict";var gc=ct(),Hh=on(),wc=lt(),Mh=Dt(),Fh=Wr(),da=Jr(),ha=Kr(),Lh=Js(),Dh=Us(),yc=Qr(),zt=Xi(),Nc=ia(),bc=hn(),pc=hc(),kc=sa(),bn=la(),mc=new Map([["core",Lh.schema],["failsafe",[gc.map,wc.seq,Mh.string]],["json",Dh.schema],["yaml11",pc.schema],["yaml-1.1",pc.schema]]),vc={binary:yc.binary,bool:Fh.boolTag,float:da.float,floatExp:da.floatExp,floatNaN:da.floatNaN,floatTime:bn.floatTime,int:ha.int,intHex:ha.intHex,intOct:ha.intOct,intTime:bn.intTime,map:gc.map,merge:zt.merge,null:Hh.nullTag,omap:Nc.omap,pairs:bc.pairs,seq:wc.seq,set:kc.set,timestamp:bn.timestamp},Bh={"tag:yaml.org,2002:binary":yc.binary,"tag:yaml.org,2002:merge":zt.merge,"tag:yaml.org,2002:omap":Nc.omap,"tag:yaml.org,2002:pairs":bc.pairs,"tag:yaml.org,2002:set":kc.set,"tag:yaml.org,2002:timestamp":bn.timestamp};function qh(e,t,i){let n=mc.get(t);if(n&&!e)return i&&!n.includes(zt.merge)?n.concat(zt.merge):n.slice();let r=n;if(!r)if(Array.isArray(e))r=[];else{let a=Array.from(mc.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${a} or define customTags array`)}if(Array.isArray(e))for(let a of e)r=r.concat(a);else typeof e=="function"&&(r=e(r.slice()));return i&&(r=r.concat(zt.merge)),r.reduce((a,o)=>{let s=typeof o=="string"?vc[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(vc).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},[])}pa.coreKnownTags=Bh;pa.getTags=qh});var ga=w(Ec=>{"use strict";var ma=R(),Vh=ct(),Wh=lt(),zh=Dt(),kn=Sc(),Jh=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,va=class e{constructor({compat:t,customTags:i,merge:n,resolveKnownTags:r,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(t)?kn.getTags(t,"compat"):t?kn.getTags(null,t):null,this.name=typeof a=="string"&&a||"core",this.knownTags=r?kn.coreKnownTags:{},this.tags=kn.getTags(i,this.name,n),this.toStringOptions=s??null,Object.defineProperty(this,ma.MAP,{value:Vh.map}),Object.defineProperty(this,ma.SCALAR,{value:zh.string}),Object.defineProperty(this,ma.SEQ,{value:Wh.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Jh:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Ec.Schema=va});var Cc=w(Rc=>{"use strict";var Gh=R(),wa=Mt(),Jt=jt();function Kh(e,t){let i=[],n=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(i.push(c),n=!0):e.directives.docStart&&(n=!0)}n&&i.push("---");let r=wa.createStringifyContext(e,t),{commentString:a}=r.options;if(e.commentBefore){i.length!==1&&i.unshift("");let c=a(e.commentBefore);i.unshift(Jt.indentComment(c,""))}let o=!1,s=null;if(e.contents){if(Gh.isNode(e.contents)){if(e.contents.spaceBefore&&n&&i.push(""),e.contents.commentBefore){let u=a(e.contents.commentBefore);i.push(Jt.indentComment(u,""))}r.forceBlockIndent=!!e.comment,s=e.contents.comment}let c=s?void 0:()=>o=!0,l=wa.stringify(e.contents,r,()=>s=null,c);s&&(l+=Jt.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(wa.stringify(e.contents,r));if(e.directives?.docEnd)if(e.comment){let c=a(e.comment);c.includes(`
58
- `)?(i.push("..."),i.push(Jt.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=e.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(Jt.indentComment(a(c),"")))}return i.join(`
49
+ `}}return e?(p+=`
50
+ `+Ui.indentComment(l(e),c),s&&s()):u&&o&&o(),p}function tf({items:e},t,{flowChars:i,itemIndent:r}){let{indent:n,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,d=0,u=[];for(let v=0;v<e.length;++v){let h=e[v],m=null;if(Fe.isNode(h))h.spaceBefore&&u.push(""),Ki(t,u,h.commentBefore,!1),h.comment&&(m=h.comment);else if(Fe.isPair(h)){let y=Fe.isNode(h.key)?h.key:null;y&&(y.spaceBefore&&u.push(""),Ki(t,u,y.commentBefore,!1),y.comment&&(l=!0));let b=Fe.isNode(h.value)?h.value:null;b?(b.comment&&(m=b.comment),b.commentBefore&&(l=!0)):h.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=ds.stringify(h,c,()=>m=null);l||(l=u.length>d||w.includes(`
51
+ `)),v<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=u.reduce((y,b)=>y+b.length+2,2)+(w.length+2)>t.options.lineWidth)),l&&(w+=",")),m&&(w+=Ui.lineComment(w,r,s(m))),u.push(w),d=u.length}let{start:f,end:p}=i;if(u.length===0)return f+p;if(!l){let v=u.reduce((h,m)=>h+m.length+2,2);l=t.options.lineWidth>0&&v>t.options.lineWidth}if(l){let v=f;for(let h of u)v+=h?`
52
+ ${a}${n}${h}`:`
53
+ `;return`${v}
54
+ ${n}${p}`}else return`${f}${o}${u.join(" ")}${o}${p}`}function Ki({indent:e,options:{commentString:t}},i,r,n){if(r&&n&&(r=r.replace(/^\n+/,"")),r){let a=Ui.indentComment(t(r),e);i.push(a.trimStart())}}fs.stringifyCollection=Zd});var Re=g(Cn=>{"use strict";var rf=Rn(),nf=En(),af=Oi(),Pe=P(),Yi=Ee(),of=j();function It(e,t){let i=Pe.isScalar(t)?t.value:t;for(let r of e)if(Pe.isPair(r)&&(r.key===t||r.key===i||Pe.isScalar(r.key)&&r.key.value===i))return r}var xn=class extends af.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Pe.MAP,t),this.items=[]}static from(t,i,r){let{keepUndefined:n,replacer:a}=r,o=new this(t),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(Yi.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 t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,i){let r;Pe.isPair(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Yi.Pair(t,t?.value):r=new Yi.Pair(t.key,t.value);let n=It(this.items,r.key),a=this.schema?.sortMapEntries;if(n){if(!i)throw new Error(`Key ${r.key} already set`);Pe.isScalar(n.value)&&of.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(t){let i=It(this.items,t);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(t,i){let n=It(this.items,t)?.value;return(!i&&Pe.isScalar(n)?n.value:n)??void 0}has(t){return!!It(this.items,t)}set(t,i){this.add(new Yi.Pair(t,i),!0)}toJSON(t,i,r){let n=r?new r:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(n);for(let a of this.items)nf.addPairToJSMap(i,n,a);return n}toString(t,i,r){if(!t)return JSON.stringify(this);for(let n of this.items)if(!Pe.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),rf.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:i})}};Cn.YAMLMap=xn;Cn.findPair=It});var rt=g(ps=>{"use strict";var sf=P(),hs=Re(),cf={collection:"map",default:!0,nodeClass:hs.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return sf.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,i)=>hs.YAMLMap.from(e,t,i)};ps.map=cf});var xe=g(ms=>{"use strict";var lf=Pt(),uf=Rn(),df=Oi(),Qi=P(),ff=j(),hf=Ne(),An=class extends df.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Qi.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let i=Xi(t);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(t,i){let r=Xi(t);if(typeof r!="number")return;let n=this.items[r];return!i&&Qi.isScalar(n)?n.value:n}has(t){let i=Xi(t);return typeof i=="number"&&i<this.items.length}set(t,i){let r=Xi(t);if(typeof r!="number")throw new Error(`Expected a valid index, not ${t}.`);let n=this.items[r];Qi.isScalar(n)&&ff.isScalarValue(i)?n.value=i:this.items[r]=i}toJSON(t,i){let r=[];i?.onCreate&&i.onCreate(r);let n=0;for(let a of this.items)r.push(hf.toJS(a,String(n++),i));return r}toString(t,i,r){return t?uf.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:r,onComment:i}):JSON.stringify(this)}static from(t,i,r){let{replacer:n}=r,a=new this(t);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(lf.createNode(s,void 0,r))}}return a}};function Xi(e){let t=Qi.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}ms.YAMLSeq=An});var nt=g(gs=>{"use strict";var pf=P(),vs=xe(),mf={collection:"seq",default:!0,nodeClass:vs.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return pf.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,i)=>vs.YAMLSeq.from(e,t,i)};gs.seq=mf});var jt=g(ws=>{"use strict";var vf=At(),gf={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,i,r){return t=Object.assign({actualString:!0},t),vf.stringifyString(e,t,i,r)}};ws.string=gf});var Zi=g(bs=>{"use strict";var ys=j(),Ns={identify:e=>e==null,createNode:()=>new ys.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ys.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&Ns.test.test(e)?e:t.options.nullStr};bs.nullTag=Ns});var _n=g(Ss=>{"use strict";var wf=j(),ks={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new wf.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},i){if(e&&ks.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?i.options.trueStr:i.options.falseStr}};Ss.boolTag=ks});var at=g(Es=>{"use strict";function yf({format:e,minFractionDigits:t,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(!e&&t&&(!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=t-(a.length-o-1);for(;s-- >0;)a+="0"}return a}Es.stringifyNumber=yf});var In=g(er=>{"use strict";var Nf=j(),Tn=at(),bf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Tn.stringifyNumber},kf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Tn.stringifyNumber(e)}},Sf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Nf.Scalar(parseFloat(e)),i=e.indexOf(".");return i!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-i-1),t},stringify:Tn.stringifyNumber};er.float=Sf;er.floatExp=kf;er.floatNaN=bf});var $n=g(ir=>{"use strict";var Ps=at(),tr=e=>typeof e=="bigint"||Number.isInteger(e),jn=(e,t,i,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),i);function Rs(e,t,i){let{value:r}=e;return tr(r)&&r>=0?i+r.toString(t):Ps.stringifyNumber(e)}var Ef={identify:e=>tr(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,i)=>jn(e,2,8,i),stringify:e=>Rs(e,8,"0o")},Pf={identify:tr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,i)=>jn(e,0,10,i),stringify:Ps.stringifyNumber},Rf={identify:e=>tr(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,i)=>jn(e,2,16,i),stringify:e=>Rs(e,16,"0x")};ir.int=Pf;ir.intHex=Rf;ir.intOct=Ef});var Cs=g(xs=>{"use strict";var xf=rt(),Cf=Zi(),Af=nt(),_f=jt(),Tf=_n(),On=In(),Hn=$n(),If=[xf.map,Af.seq,_f.string,Cf.nullTag,Tf.boolTag,Hn.intOct,Hn.int,Hn.intHex,On.floatNaN,On.floatExp,On.float];xs.schema=If});var Ts=g(_s=>{"use strict";var jf=j(),$f=rt(),Of=nt();function As(e){return typeof e=="bigint"||Number.isInteger(e)}var rr=({value:e})=>JSON.stringify(e),Hf=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:rr},{identify:e=>e==null,createNode:()=>new jf.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:rr},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:rr},{identify:As,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:i})=>i?BigInt(e):parseInt(e,10),stringify:({value:e})=>As(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:rr}],Df={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Bf=[$f.map,Of.seq].concat(Hf,Df);_s.schema=Bf});var Bn=g(Is=>{"use strict";var $t=Pi("buffer"),Dn=j(),Lf=At(),Mf={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof $t.Buffer=="function")return $t.Buffer.from(e,"base64");if(typeof atob=="function"){let i=atob(e.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 t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:i},r,n,a){if(!i)return"";let o=i,s;if(typeof $t.Buffer=="function")s=o instanceof $t.Buffer?o.toString("base64"):$t.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(t??(t=Dn.Scalar.BLOCK_LITERAL),t!==Dn.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.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(t===Dn.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return Lf.stringifyString({comment:e,type:t,value:s},r,n,a)}};Is.binary=Mf});var or=g(ar=>{"use strict";var nr=P(),Ln=Ee(),Ff=j(),Vf=xe();function js(e,t){if(nr.isSeq(e))for(let i=0;i<e.items.length;++i){let r=e.items[i];if(!nr.isPair(r)){if(nr.isMap(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let n=r.items[0]||new Ln.Pair(new Ff.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}e.items[i]=nr.isPair(r)?r:new Ln.Pair(r)}}else t("Expected a sequence for this tag");return e}function $s(e,t,i){let{replacer:r}=i,n=new Vf.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let a=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof r=="function"&&(o=r.call(t,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(Ln.createPair(s,c,i))}return n}var qf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:js,createNode:$s};ar.createPairs=$s;ar.pairs=qf;ar.resolvePairs=js});var Vn=g(Fn=>{"use strict";var Os=P(),Mn=Ne(),Ot=Re(),Wf=xe(),Hs=or(),Ve=class e extends Wf.YAMLSeq{constructor(){super(),this.add=Ot.YAMLMap.prototype.add.bind(this),this.delete=Ot.YAMLMap.prototype.delete.bind(this),this.get=Ot.YAMLMap.prototype.get.bind(this),this.has=Ot.YAMLMap.prototype.has.bind(this),this.set=Ot.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,i){if(!i)return super.toJSON(t);let r=new Map;i?.onCreate&&i.onCreate(r);for(let n of this.items){let a,o;if(Os.isPair(n)?(a=Mn.toJS(n.key,"",i),o=Mn.toJS(n.value,a,i)):a=Mn.toJS(n,"",i),r.has(a))throw new Error("Ordered maps must not include duplicate keys");r.set(a,o)}return r}static from(t,i,r){let n=Hs.createPairs(t,i,r),a=new this;return a.items=n.items,a}};Ve.tag="tag:yaml.org,2002:omap";var zf={collection:"seq",identify:e=>e instanceof Map,nodeClass:Ve,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let i=Hs.resolvePairs(e,t),r=[];for(let{key:n}of i.items)Os.isScalar(n)&&(r.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):r.push(n.value));return Object.assign(new Ve,i)},createNode:(e,t,i)=>Ve.from(e,t,i)};Fn.YAMLOMap=Ve;Fn.omap=zf});var Fs=g(qn=>{"use strict";var Ds=j();function Bs({value:e,source:t},i){return t&&(e?Ls:Ms).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}var Ls={identify:e=>e===!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:Bs},Ms={identify:e=>e===!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:Bs};qn.falseTag=Ms;qn.trueTag=Ls});var Vs=g(sr=>{"use strict";var Jf=j(),Wn=at(),Gf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Wn.stringifyNumber},Uf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Wn.stringifyNumber(e)}},Kf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Jf.Scalar(parseFloat(e.replace(/_/g,""))),i=e.indexOf(".");if(i!==-1){let r=e.substring(i+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:Wn.stringifyNumber};sr.float=Kf;sr.floatExp=Uf;sr.floatNaN=Gf});var Ws=g(Dt=>{"use strict";var qs=at(),Ht=e=>typeof e=="bigint"||Number.isInteger(e);function cr(e,t,i,{intAsBigInt:r}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(i){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return n==="-"?BigInt(-1)*o:o}let a=parseInt(e,i);return n==="-"?-1*a:a}function zn(e,t,i){let{value:r}=e;if(Ht(r)){let n=r.toString(t);return r<0?"-"+i+n.substr(1):i+n}return qs.stringifyNumber(e)}var Yf={identify:Ht,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,i)=>cr(e,2,2,i),stringify:e=>zn(e,2,"0b")},Xf={identify:Ht,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,i)=>cr(e,1,8,i),stringify:e=>zn(e,8,"0")},Qf={identify:Ht,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,i)=>cr(e,0,10,i),stringify:qs.stringifyNumber},Zf={identify:Ht,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,i)=>cr(e,2,16,i),stringify:e=>zn(e,16,"0x")};Dt.int=Qf;Dt.intBin=Yf;Dt.intHex=Zf;Dt.intOct=Xf});var Gn=g(Jn=>{"use strict";var dr=P(),lr=Ee(),ur=Re(),qe=class e extends ur.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let i;dr.isPair(t)?i=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?i=new lr.Pair(t.key,null):i=new lr.Pair(t,null),ur.findPair(this.items,i.key)||this.items.push(i)}get(t,i){let r=ur.findPair(this.items,t);return!i&&dr.isPair(r)?dr.isScalar(r.key)?r.key.value:r.key:r}set(t,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let r=ur.findPair(this.items,t);r&&!i?this.items.splice(this.items.indexOf(r),1):!r&&i&&this.items.push(new lr.Pair(t))}toJSON(t,i){return super.toJSON(t,i,Set)}toString(t,i,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),i,r);throw new Error("Set items must all have null values")}static from(t,i,r){let{replacer:n}=r,a=new this(t);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof n=="function"&&(o=n.call(i,o,o)),a.items.push(lr.createPair(o,null,r));return a}};qe.tag="tag:yaml.org,2002:set";var eh={collection:"map",identify:e=>e instanceof Set,nodeClass:qe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,i)=>qe.from(e,t,i),resolve(e,t){if(dr.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new qe,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Jn.YAMLSet=qe;Jn.set=eh});var Kn=g(fr=>{"use strict";var th=at();function Un(e,t){let i=e[0],r=i==="-"||i==="+"?e.substring(1):e,n=o=>t?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 zs(e){let{value:t}=e,i=o=>o;if(typeof t=="bigint")i=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return th.stringifyNumber(e);let r="";t<0&&(r="-",t*=i(-1));let n=i(60),a=[t%n];return t<60?a.unshift(0):(t=(t-a[0])/n,a.unshift(t%n),t>=60&&(t=(t-a[0])/n,a.unshift(t))),r+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var ih={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:i})=>Un(e,i),stringify:zs},rh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Un(e,!1),stringify:zs},Js={identify:e=>e 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(e){let t=e.match(Js.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,r,n,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(i,r-1,n,a||0,o||0,s||0,c),d=t[8];if(d&&d!=="Z"){let u=Un(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};fr.floatTime=rh;fr.intTime=ih;fr.timestamp=Js});var Ks=g(Us=>{"use strict";var nh=rt(),ah=Zi(),oh=nt(),sh=jt(),ch=Bn(),Gs=Fs(),Yn=Vs(),hr=Ws(),lh=zi(),uh=Vn(),dh=or(),fh=Gn(),Xn=Kn(),hh=[nh.map,oh.seq,sh.string,ah.nullTag,Gs.trueTag,Gs.falseTag,hr.intBin,hr.intOct,hr.int,hr.intHex,Yn.floatNaN,Yn.floatExp,Yn.float,ch.binary,lh.merge,uh.omap,dh.pairs,fh.set,Xn.intTime,Xn.floatTime,Xn.timestamp];Us.schema=hh});var ac=g(ea=>{"use strict";var Zs=rt(),ph=Zi(),ec=nt(),mh=jt(),vh=_n(),Qn=In(),Zn=$n(),gh=Cs(),wh=Ts(),tc=Bn(),Bt=zi(),ic=Vn(),rc=or(),Ys=Ks(),nc=Gn(),pr=Kn(),Xs=new Map([["core",gh.schema],["failsafe",[Zs.map,ec.seq,mh.string]],["json",wh.schema],["yaml11",Ys.schema],["yaml-1.1",Ys.schema]]),Qs={binary:tc.binary,bool:vh.boolTag,float:Qn.float,floatExp:Qn.floatExp,floatNaN:Qn.floatNaN,floatTime:pr.floatTime,int:Zn.int,intHex:Zn.intHex,intOct:Zn.intOct,intTime:pr.intTime,map:Zs.map,merge:Bt.merge,null:ph.nullTag,omap:ic.omap,pairs:rc.pairs,seq:ec.seq,set:nc.set,timestamp:pr.timestamp},yh={"tag:yaml.org,2002:binary":tc.binary,"tag:yaml.org,2002:merge":Bt.merge,"tag:yaml.org,2002:omap":ic.omap,"tag:yaml.org,2002:pairs":rc.pairs,"tag:yaml.org,2002:set":nc.set,"tag:yaml.org,2002:timestamp":pr.timestamp};function Nh(e,t,i){let r=Xs.get(t);if(r&&!e)return i&&!r.includes(Bt.merge)?r.concat(Bt.merge):r.slice();let n=r;if(!n)if(Array.isArray(e))n=[];else{let a=Array.from(Xs.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${a} or define customTags array`)}if(Array.isArray(e))for(let a of e)n=n.concat(a);else typeof e=="function"&&(n=e(n.slice()));return i&&(n=n.concat(Bt.merge)),n.reduce((a,o)=>{let s=typeof o=="string"?Qs[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(Qs).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},[])}ea.coreKnownTags=yh;ea.getTags=Nh});var ra=g(oc=>{"use strict";var ta=P(),bh=rt(),kh=nt(),Sh=jt(),mr=ac(),Eh=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,ia=class e{constructor({compat:t,customTags:i,merge:r,resolveKnownTags:n,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(t)?mr.getTags(t,"compat"):t?mr.getTags(null,t):null,this.name=typeof a=="string"&&a||"core",this.knownTags=n?mr.coreKnownTags:{},this.tags=mr.getTags(i,this.name,r),this.toStringOptions=s??null,Object.defineProperty(this,ta.MAP,{value:bh.map}),Object.defineProperty(this,ta.SCALAR,{value:Sh.string}),Object.defineProperty(this,ta.SEQ,{value:kh.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Eh:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};oc.Schema=ia});var cc=g(sc=>{"use strict";var Ph=P(),na=_t(),Lt=Rt();function Rh(e,t){let i=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(i.push(c),r=!0):e.directives.docStart&&(r=!0)}r&&i.push("---");let n=na.createStringifyContext(e,t),{commentString:a}=n.options;if(e.commentBefore){i.length!==1&&i.unshift("");let c=a(e.commentBefore);i.unshift(Lt.indentComment(c,""))}let o=!1,s=null;if(e.contents){if(Ph.isNode(e.contents)){if(e.contents.spaceBefore&&r&&i.push(""),e.contents.commentBefore){let d=a(e.contents.commentBefore);i.push(Lt.indentComment(d,""))}n.forceBlockIndent=!!e.comment,s=e.contents.comment}let c=s?void 0:()=>o=!0,l=na.stringify(e.contents,n,()=>s=null,c);s&&(l+=Lt.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(na.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let c=a(e.comment);c.includes(`
58
+ `)?(i.push("..."),i.push(Lt.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=e.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(Lt.indentComment(a(c),"")))}return i.join(`
59
59
  `)+`
60
- `}Rc.stringifyDocument=Kh});var Gt=w(Pc=>{"use strict";var Uh=_t(),ft=Bi(),Y=R(),Yh=Ee(),Xh=Ne(),Qh=ga(),Zh=Cc(),ya=Mi(),ep=Sr(),tp=It(),Na=kr(),ba=class e{constructor(t,i,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Y.NODE_TYPE,{value:Y.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 Na.Directives({version:o}),this.setSchema(o,n),this.contents=t===void 0?null:this.createNode(t,r,n)}clone(){let t=Object.create(e.prototype,{[Y.NODE_TYPE]:{value:Y.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Y.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){dt(this.contents)&&this.contents.add(t)}addIn(t,i){dt(this.contents)&&this.contents.addIn(t,i)}createAlias(t,i){if(!t.anchor){let n=ya.anchorNames(this);t.anchor=!i||n.has(i)?ya.findNewAnchor(i||"a",n):i}return new Uh.Alias(t.anchor)}createNode(t,i,n){let r;if(typeof i=="function")t=i.call({"":t},"",t),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:u}=n??{},{onAnchor:f,setAnchors:d,sourceObjects:m}=ya.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:m},h=tp.createNode(t,u,g);return s&&Y.isCollection(h)&&(h.flow=!0),d(),h}createPair(t,i,n={}){let r=this.createNode(t,null,n),a=this.createNode(i,null,n);return new Yh.Pair(r,a)}delete(t){return dt(this.contents)?this.contents.delete(t):!1}deleteIn(t){return ft.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):dt(this.contents)?this.contents.deleteIn(t):!1}get(t,i){return Y.isCollection(this.contents)?this.contents.get(t,i):void 0}getIn(t,i){return ft.isEmptyPath(t)?!i&&Y.isScalar(this.contents)?this.contents.value:this.contents:Y.isCollection(this.contents)?this.contents.getIn(t,i):void 0}has(t){return Y.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return ft.isEmptyPath(t)?this.contents!==void 0:Y.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,i){this.contents==null?this.contents=ft.collectionFromPath(this.schema,[t],i):dt(this.contents)&&this.contents.set(t,i)}setIn(t,i){ft.isEmptyPath(t)?this.contents=i:this.contents==null?this.contents=ft.collectionFromPath(this.schema,Array.from(t),i):dt(this.contents)&&this.contents.setIn(t,i)}setSchema(t,i={}){typeof t=="number"&&(t=String(t));let n;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Na.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Na.Directives({version:t}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let r=JSON.stringify(t);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 Qh.Schema(Object.assign(n,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:i,mapAsMap:n,maxAliasCount:r,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!t,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=Xh.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"?ep.applyReviver(o,{"":c},"",c):c}toJSON(t,i){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:i})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let i=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return Zh.stringifyDocument(this,t)}};function dt(e){if(Y.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}Pc.Document=ba});var Yt=w(Ut=>{"use strict";var Kt=class extends Error{constructor(t,i,n,r){super(),this.name=t,this.code=n,this.message=r,this.pos=i}},ka=class extends Kt{constructor(t,i,n){super("YAMLParseError",t,i,n)}},Sa=class extends Kt{constructor(t,i,n){super("YAMLWarning",t,i,n)}},ip=(e,t)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>t.linePos(s));let{line:n,col:r}=i.linePos[0];i.message+=` at line ${n}, column ${r}`;let a=r-1,o=e.substring(t.lineStarts[n-1],t.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=e.substring(t.lineStarts[n-2],t.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
+ `}sc.stringifyDocument=Rh});var Mt=g(lc=>{"use strict";var xh=Et(),ot=Oi(),Y=P(),Ch=Ee(),Ah=Ne(),_h=ra(),Th=cc(),aa=Ti(),Ih=ln(),jh=Pt(),oa=cn(),sa=class e{constructor(t,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 oa.Directives({version:o}),this.setSchema(o,r),this.contents=t===void 0?null:this.createNode(t,n,r)}clone(){let t=Object.create(e.prototype,{[Y.NODE_TYPE]:{value:Y.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Y.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){st(this.contents)&&this.contents.add(t)}addIn(t,i){st(this.contents)&&this.contents.addIn(t,i)}createAlias(t,i){if(!t.anchor){let r=aa.anchorNames(this);t.anchor=!i||r.has(i)?aa.findNewAnchor(i||"a",r):i}return new xh.Alias(t.anchor)}createNode(t,i,r){let n;if(typeof i=="function")t=i.call({"":t},"",t),n=i;else if(Array.isArray(i)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=i.filter(m).map(String);w.length>0&&(i=i.concat(w)),n=i}else r===void 0&&i&&(r=i,i=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:d}=r??{},{onAnchor:u,setAnchors:f,sourceObjects:p}=aa.createNodeAnchors(this,o||"a"),v={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:p},h=jh.createNode(t,d,v);return s&&Y.isCollection(h)&&(h.flow=!0),f(),h}createPair(t,i,r={}){let n=this.createNode(t,null,r),a=this.createNode(i,null,r);return new Ch.Pair(n,a)}delete(t){return st(this.contents)?this.contents.delete(t):!1}deleteIn(t){return ot.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):st(this.contents)?this.contents.deleteIn(t):!1}get(t,i){return Y.isCollection(this.contents)?this.contents.get(t,i):void 0}getIn(t,i){return ot.isEmptyPath(t)?!i&&Y.isScalar(this.contents)?this.contents.value:this.contents:Y.isCollection(this.contents)?this.contents.getIn(t,i):void 0}has(t){return Y.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return ot.isEmptyPath(t)?this.contents!==void 0:Y.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,i){this.contents==null?this.contents=ot.collectionFromPath(this.schema,[t],i):st(this.contents)&&this.contents.set(t,i)}setIn(t,i){ot.isEmptyPath(t)?this.contents=i:this.contents==null?this.contents=ot.collectionFromPath(this.schema,Array.from(t),i):st(this.contents)&&this.contents.setIn(t,i)}setSchema(t,i={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new oa.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new oa.Directives({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let n=JSON.stringify(t);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 _h.Schema(Object.assign(r,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:i,mapAsMap:r,maxAliasCount:n,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=Ah.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"?Ih.applyReviver(o,{"":c},"",c):c}toJSON(t,i){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:i})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let i=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return Th.stringifyDocument(this,t)}};function st(e){if(Y.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}lc.Document=sa});var qt=g(Vt=>{"use strict";var Ft=class extends Error{constructor(t,i,r,n){super(),this.name=t,this.code=r,this.message=n,this.pos=i}},ca=class extends Ft{constructor(t,i,r){super("YAMLParseError",t,i,r)}},la=class extends Ft{constructor(t,i,r){super("YAMLWarning",t,i,r)}},$h=(e,t)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>t.linePos(s));let{line:r,col:n}=i.linePos[0];i.message+=` at line ${r}, column ${n}`;let a=n-1,o=e.substring(t.lineStarts[r-1],t.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=e.substring(t.lineStarts[r-2],t.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
- `}};Ut.YAMLError=Kt;Ut.YAMLParseError=ka;Ut.YAMLWarning=Sa;Ut.prettifyError=ip});var Xt=w(Ac=>{"use strict";function np(e,{flow:t,indicator:i,next:n,offset:r,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,f="",d="",m=!1,g=!1,h=null,p=null,y=null,N=null,k=null,S=null,E=null;for(let b of e)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":!t&&(i!=="doc-start"||n?.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 _=b.source.substring(1)||" ";f?f+=d+_:f=_,d="",l=!1;break}case"newline":l?f?f+=b.source:(!S||i!=="seq-item-ind")&&(c=!0):d+=b.source,l=!0,m=!0,(p||y)&&(N=b),u=!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,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:(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 ${t??"collection"}`),S=b,l=i==="seq-item-ind"||i==="explicit-key-ind",u=!1;break;case"comma":if(t){k&&a(b,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),k=b,l=!1,u=!1;break}default:a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,u=!1}let v=e[e.length-1],C=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:f,hasNewline:m,anchor:p,tag:y,newlineAfterProp:N,end:C,start:E??C}}Ac.resolveProps=np});var Sn=w(xc=>{"use strict";function Ea(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
66
- `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let i of t.start)if(i.type==="newline")return!0;if(t.sep){for(let i of t.sep)if(i.type==="newline")return!0}if(Ea(t.key)||Ea(t.value))return!0}return!1;default:return!0}}xc.containsNewline=Ea});var Ra=w(Tc=>{"use strict";var rp=Sn();function ap(e,t,i){if(t?.type==="flow-collection"){let n=t.end[0];n.indent===e&&(n.source==="]"||n.source==="}")&&rp.containsNewline(t)&&i(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Tc.flowIndentCheck=ap});var Ca=w(Ic=>{"use strict";var _c=R();function op(e,t,i){let{uniqueKeys:n}=e.options;if(n===!1)return!1;let r=typeof n=="function"?n:(a,o)=>a===o||_c.isScalar(a)&&_c.isScalar(o)&&a.value===o.value;return t.some(a=>r(a.key,i))}Ic.mapIncludes=op});var Fc=w(Mc=>{"use strict";var jc=Ee(),sp=Ce(),Oc=Xt(),cp=Sn(),$c=Ra(),lp=Ca(),Hc="All mapping items must start at the same column";function up({composeNode:e,composeEmptyNode:t},i,n,r,a){let o=a?.nodeClass??sp.YAMLMap,s=new o(i.schema);i.atRoot&&(i.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:f,key:d,sep:m,value:g}=u,h=Oc.resolveProps(f,{indicator:"explicit-key-ind",next:d??m?.[0],offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0}),p=!h.found;if(p){if(d&&(d.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==n.indent&&r(c,"BAD_INDENT",Hc)),!h.anchor&&!h.tag&&!m){l=h.end,h.comment&&(s.comment?s.comment+=`
67
- `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||cp.containsNewline(d))&&r(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&r(c,"BAD_INDENT",Hc);i.atKey=!0;let y=h.end,N=d?e(i,d,h,r):t(i,y,f,null,h,r);i.schema.compat&&$c.flowIndentCheck(n.indent,d,r),i.atKey=!1,lp.mapIncludes(i,s.items,N)&&r(y,"DUPLICATE_KEY","Map keys must be unique");let k=Oc.resolveProps(m??[],{indicator:"map-value-ind",next:g,offset:N.range[2],onError:r,parentIndent:n.indent,startOnNewline:!d||d.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?e(i,g,k,r):t(i,c,m,null,k,r);i.schema.compat&&$c.flowIndentCheck(n.indent,g,r),c=S.range[2];let E=new jc.Pair(N,S);i.options.keepSourceTokens&&(E.srcToken=u),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 jc.Pair(N);i.options.keepSourceTokens&&(S.srcToken=u),s.items.push(S)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[n.offset,c,l??c],s}Mc.resolveBlockMap=up});var Dc=w(Lc=>{"use strict";var fp=Pe(),dp=Xt(),hp=Ra();function pp({composeNode:e,composeEmptyNode:t},i,n,r,a){let o=a?.nodeClass??fp.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:u,value:f}of n.items){let d=dp.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?r(d.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(s.comment=d.comment);continue}let m=f?e(i,f,d,r):t(i,d.end,u,null,d,r);i.schema.compat&&hp.flowIndentCheck(n.indent,f,r),c=m.range[2],s.items.push(m)}return s.range=[n.offset,c,l??c],s}Lc.resolveBlockSeq=pp});var ht=w(Bc=>{"use strict";function mp(e,t,i,n){let r="";if(e){let a=!1,o="";for(let s of e){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 u=c.substring(1)||" ";r?r+=o+u:r=u,o="";break}case"newline":r&&(o+=c),a=!0;break;default:n(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:r,offset:t}}Bc.resolveEnd=mp});var zc=w(Wc=>{"use strict";var vp=R(),gp=Ee(),qc=Ce(),wp=Pe(),yp=ht(),Vc=Xt(),Np=Sn(),bp=Ca(),Pa="Block collections are not allowed within flow collections",Aa=e=>e&&(e.type==="block-map"||e.type==="block-seq");function kp({composeNode:e,composeEmptyNode:t},i,n,r,a){let o=n.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?qc.YAMLMap:wp.YAMLSeq),l=new c(i.schema);l.flow=!0;let u=i.atRoot;u&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let f=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=Vc.resolveProps(N,{flow:s,indicator:"explicit-key-ind",next:k??S?.[0],offset:f,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),f=v.end;continue}!o&&i.options.strict&&Np.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 C="";e:for(let b of N)switch(b.type){case"comma":case"space":break;case"comment":C=b.source.substring(1);break e;default:break e}if(C){let b=l.items[l.items.length-1];vp.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
- `+C:b.comment=C,v.comment=v.comment.substring(C.length+1)}}if(!o&&!S&&!v.found){let C=E?e(i,E,v,r):t(i,v.end,S,null,v,r);l.items.push(C),f=C.range[2],Aa(E)&&r(C.range,"BLOCK_IN_FLOW",Pa)}else{i.atKey=!0;let C=v.end,b=k?e(i,k,v,r):t(i,C,N,null,v,r);Aa(k)&&r(b.range,"BLOCK_IN_FLOW",Pa),i.atKey=!1;let _=Vc.resolveProps(S??[],{flow:s,indicator:"map-value-ind",next:E,offset:b.range[2],onError:r,parentIndent:n.indent,startOnNewline:!1});if(_.found){if(!o&&!v.found&&i.options.strict){if(S)for(let H of S){if(H===_.found)break;if(H.type==="newline"){r(H,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.start<_.found.offset-1024&&r(_.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(_.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let z=E?e(i,E,_,r):_.found?t(i,_.end,S,null,_,r):null;z?Aa(E)&&r(z.range,"BLOCK_IN_FLOW",Pa):_.comment&&(b.comment?b.comment+=`
71
- `+_.comment:b.comment=_.comment);let nt=new gp.Pair(b,z);if(i.options.keepSourceTokens&&(nt.srcToken=y),o){let H=l;bp.mapIncludes(i,H.items,b)&&r(C,"DUPLICATE_KEY","Map keys must be unique"),H.items.push(nt)}else{let H=new qc.YAMLMap(i.schema);H.flow=!0,H.items.push(nt);let Wo=(z??b).range;H.range=[b.range[0],Wo[1],Wo[2]],l.items.push(H)}f=z?z.range[2]:_.end}}let d=o?"}":"]",[m,...g]=n.end,h=f;if(m?.source===d)h=m.offset+m.source.length;else{let p=s[0].toUpperCase()+s.substring(1),y=u?`${p} must end with a ${d}`:`${p} in block collection must be sufficiently indented and end with a ${d}`;r(f,u?"MISSING_CHAR":"BAD_INDENT",y),m&&m.source.length!==1&&g.unshift(m)}if(g.length>0){let p=yp.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}Wc.resolveFlowCollection=kp});var Gc=w(Jc=>{"use strict";var Sp=R(),Ep=$(),Rp=Ce(),Cp=Pe(),Pp=Fc(),Ap=Dc(),xp=zc();function xa(e,t,i,n,r,a){let o=i.type==="block-map"?Pp.resolveBlockMap(e,t,i,n,a):i.type==="block-seq"?Ap.resolveBlockSeq(e,t,i,n,a):xp.resolveFlowCollection(e,t,i,n,a),s=o.constructor;return r==="!"||r===s.tagName?(o.tag=s.tagName,o):(r&&(o.tag=r),o)}function Tp(e,t,i,n,r){let a=n.tag,o=a?t.directives.tagName(a.source,d=>r(a,"TAG_RESOLVE_FAILED",d)):null;if(i.type==="block-seq"){let{anchor:d,newlineAfterProp:m}=n,g=d&&a?d.offset>a.offset?d:a:d??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===Rp.YAMLMap.tagName&&s==="map"||o===Cp.YAMLSeq.tagName&&s==="seq")return xa(e,t,i,r,o);let c=t.schema.tags.find(d=>d.tag===o&&d.collection===s);if(!c){let d=t.schema.knownTags[o];if(d?.collection===s)t.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?r(a,"BAD_COLLECTION_TYPE",`${d.tag} used for ${s} collection, but expects ${d.collection??"scalar"}`,!0):r(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),xa(e,t,i,r,o)}let l=xa(e,t,i,r,o,c),u=c.resolve?.(l,d=>r(a,"TAG_RESOLVE_FAILED",d),t.options)??l,f=Sp.isNode(u)?u:new Ep.Scalar(u);return f.range=l.range,f.tag=o,c?.format&&(f.format=c.format),f}Jc.composeCollection=Tp});var _a=w(Kc=>{"use strict";var Ta=$();function _p(e,t,i){let n=t.offset,r=Ip(t,e.options.strict,i);if(!r)return{value:"",type:null,comment:"",range:[n,n,n]};let a=r.mode===">"?Ta.Scalar.BLOCK_FOLDED:Ta.Scalar.BLOCK_LITERAL,o=t.source?jp(t.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 t.source&&(p+=t.source.length),{value:h,type:a,comment:r.comment,range:[n,p,p]}}let c=t.indent+r.indent,l=t.offset+r.length,u=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),u=h,c===0&&!e.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 f="",d="",m=!1;for(let h=0;h<u;++h)f+=o[h][0].slice(c)+`
74
- `;for(let h=u;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===Ta.Scalar.BLOCK_LITERAL?(f+=d+p.slice(c)+y,d=`
75
- `):p.length>c||y[0]===" "?(d===" "?d=`
76
- `:!m&&d===`
77
- `&&(d=`
65
+ `}};Vt.YAMLError=Ft;Vt.YAMLParseError=ca;Vt.YAMLWarning=la;Vt.prettifyError=$h});var Wt=g(uc=>{"use strict";function Oh(e,{flow:t,indicator:i,next:r,offset:n,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,d=s,u="",f="",p=!1,v=!1,h=null,m=null,w=null,y=null,b=null,k=null,S=null;for(let N of e)switch(v&&(N.type!=="space"&&N.type!=="newline"&&N.type!=="comma"&&a(N.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),h&&(l&&N.type!=="comment"&&N.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),N.type){case"space":!t&&(i!=="doc-start"||r?.type!=="flow-collection")&&N.source.includes(" ")&&(h=N),d=!0;break;case"comment":{d||a(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let O=N.source.substring(1)||" ";u?u+=f+O:u=O,f="",l=!1;break}case"newline":l?u?u+=N.source:(!k||i!=="seq-item-ind")&&(c=!0):f+=N.source,l=!0,p=!0,(m||w)&&(y=N),d=!0;break;case"anchor":m&&a(N,"MULTIPLE_ANCHORS","A node can have at most one anchor"),N.source.endsWith(":")&&a(N.offset+N.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=N,S??(S=N.offset),l=!1,d=!1,v=!0;break;case"tag":{w&&a(N,"MULTIPLE_TAGS","A node can have at most one tag"),w=N,S??(S=N.offset),l=!1,d=!1,v=!0;break}case i:(m||w)&&a(N,"BAD_PROP_ORDER",`Anchors and tags must be after the ${N.source} indicator`),k&&a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.source} in ${t??"collection"}`),k=N,l=i==="seq-item-ind"||i==="explicit-key-ind",d=!1;break;case"comma":if(t){b&&a(N,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=N,l=!1,d=!1;break}default:a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.type} token`),l=!1,d=!1}let E=e[e.length-1],A=E?E.offset+E.source.length:n;return v&&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:b,found:k,spaceBefore:c,comment:u,hasNewline:p,anchor:m,tag:w,newlineAfterProp:y,end:A,start:S??A}}uc.resolveProps=Oh});var vr=g(dc=>{"use strict";function ua(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
66
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let i of t.start)if(i.type==="newline")return!0;if(t.sep){for(let i of t.sep)if(i.type==="newline")return!0}if(ua(t.key)||ua(t.value))return!0}return!1;default:return!0}}dc.containsNewline=ua});var da=g(fc=>{"use strict";var Hh=vr();function Dh(e,t,i){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Hh.containsNewline(t)&&i(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}fc.flowIndentCheck=Dh});var fa=g(pc=>{"use strict";var hc=P();function Bh(e,t,i){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let n=typeof r=="function"?r:(a,o)=>a===o||hc.isScalar(a)&&hc.isScalar(o)&&a.value===o.value;return t.some(a=>n(a.key,i))}pc.mapIncludes=Bh});var Nc=g(yc=>{"use strict";var mc=Ee(),Lh=Re(),vc=Wt(),Mh=vr(),gc=da(),Fh=fa(),wc="All mapping items must start at the same column";function Vh({composeNode:e,composeEmptyNode:t},i,r,n,a){let o=a?.nodeClass??Lh.YAMLMap,s=new o(i.schema);i.atRoot&&(i.atRoot=!1);let c=r.offset,l=null;for(let d of r.items){let{start:u,key:f,sep:p,value:v}=d,h=vc.resolveProps(u,{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",wc)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(s.comment?s.comment+=`
67
+ `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||Mh.containsNewline(f))&&n(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&n(c,"BAD_INDENT",wc);i.atKey=!0;let w=h.end,y=f?e(i,f,h,n):t(i,w,u,null,h,n);i.schema.compat&&gc.flowIndentCheck(r.indent,f,n),i.atKey=!1,Fh.mapIncludes(i,s.items,y)&&n(w,"DUPLICATE_KEY","Map keys must be unique");let b=vc.resolveProps(p??[],{indicator:"map-value-ind",next:v,offset:y.range[2],onError:n,parentIndent:r.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=b.end,b.found){m&&(v?.type==="block-map"&&!b.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<b.found.offset-1024&&n(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=v?e(i,v,b,n):t(i,c,p,null,b,n);i.schema.compat&&gc.flowIndentCheck(r.indent,v,n),c=k.range[2];let S=new mc.Pair(y,k);i.options.keepSourceTokens&&(S.srcToken=d),s.items.push(S)}else{m&&n(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(y.comment?y.comment+=`
68
+ `+b.comment:y.comment=b.comment);let k=new mc.Pair(y);i.options.keepSourceTokens&&(k.srcToken=d),s.items.push(k)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[r.offset,c,l??c],s}yc.resolveBlockMap=Vh});var kc=g(bc=>{"use strict";var qh=xe(),Wh=Wt(),zh=da();function Jh({composeNode:e,composeEmptyNode:t},i,r,n,a){let o=a?.nodeClass??qh.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:d,value:u}of r.items){let f=Wh.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.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=u?e(i,u,f,n):t(i,f.end,d,null,f,n);i.schema.compat&&zh.flowIndentCheck(r.indent,u,n),c=p.range[2],s.items.push(p)}return s.range=[r.offset,c,l??c],s}bc.resolveBlockSeq=Jh});var ct=g(Sc=>{"use strict";function Gh(e,t,i,r){let n="";if(e){let a=!1,o="";for(let s of e){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 d=c.substring(1)||" ";n?n+=o+d:n=d,o="";break}case"newline":n&&(o+=c),a=!0;break;default:r(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:n,offset:t}}Sc.resolveEnd=Gh});var xc=g(Rc=>{"use strict";var Uh=P(),Kh=Ee(),Ec=Re(),Yh=xe(),Xh=ct(),Pc=Wt(),Qh=vr(),Zh=fa(),ha="Block collections are not allowed within flow collections",pa=e=>e&&(e.type==="block-map"||e.type==="block-seq");function ep({composeNode:e,composeEmptyNode:t},i,r,n,a){let o=r.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?Ec.YAMLMap:Yh.YAMLSeq),l=new c(i.schema);l.flow=!0;let d=i.atRoot;d&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let u=r.offset+r.start.source.length;for(let m=0;m<r.items.length;++m){let w=r.items[m],{start:y,key:b,sep:k,value:S}=w,E=Pc.resolveProps(y,{flow:s,indicator:"explicit-key-ind",next:b??k?.[0],offset:u,onError:n,parentIndent:r.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!k&&!S){m===0&&E.comma?n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):m<r.items.length-1&&n(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),E.comment&&(l.comment?l.comment+=`
69
+ `+E.comment:l.comment=E.comment),u=E.end;continue}!o&&i.options.strict&&Qh.containsNewline(b)&&n(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(E.comma||n(E.start,"MISSING_CHAR",`Missing , between ${s} items`),E.comment){let A="";e:for(let N of y)switch(N.type){case"comma":case"space":break;case"comment":A=N.source.substring(1);break e;default:break e}if(A){let N=l.items[l.items.length-1];Uh.isPair(N)&&(N=N.value??N.key),N.comment?N.comment+=`
70
+ `+A:N.comment=A,E.comment=E.comment.substring(A.length+1)}}if(!o&&!k&&!E.found){let A=S?e(i,S,E,n):t(i,E.end,k,null,E,n);l.items.push(A),u=A.range[2],pa(S)&&n(A.range,"BLOCK_IN_FLOW",ha)}else{i.atKey=!0;let A=E.end,N=b?e(i,b,E,n):t(i,A,y,null,E,n);pa(b)&&n(N.range,"BLOCK_IN_FLOW",ha),i.atKey=!1;let O=Pc.resolveProps(k??[],{flow:s,indicator:"map-value-ind",next:S,offset:N.range[2],onError:n,parentIndent:r.indent,startOnNewline:!1});if(O.found){if(!o&&!E.found&&i.options.strict){if(k)for(let H of k){if(H===O.found)break;if(H.type==="newline"){n(H,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<O.found.offset-1024&&n(O.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else S&&("source"in S&&S.source?.[0]===":"?n(S,"MISSING_CHAR",`Missing space after : in ${s}`):n(O.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let ye=S?e(i,S,O,n):O.found?t(i,O.end,k,null,O,n):null;ye?pa(S)&&n(ye.range,"BLOCK_IN_FLOW",ha):O.comment&&(N.comment?N.comment+=`
71
+ `+O.comment:N.comment=O.comment);let Qe=new Kh.Pair(N,ye);if(i.options.keepSourceTokens&&(Qe.srcToken=w),o){let H=l;Zh.mapIncludes(i,H.items,N)&&n(A,"DUPLICATE_KEY","Map keys must be unique"),H.items.push(Qe)}else{let H=new Ec.YAMLMap(i.schema);H.flow=!0,H.items.push(Qe);let Ro=(ye??N).range;H.range=[N.range[0],Ro[1],Ro[2]],l.items.push(H)}u=ye?ye.range[2]:O.end}}let f=o?"}":"]",[p,...v]=r.end,h=u;if(p?.source===f)h=p.offset+p.source.length;else{let m=s[0].toUpperCase()+s.substring(1),w=d?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;n(u,d?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&v.unshift(p)}if(v.length>0){let m=Xh.resolveEnd(v,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}Rc.resolveFlowCollection=ep});var Ac=g(Cc=>{"use strict";var tp=P(),ip=j(),rp=Re(),np=xe(),ap=Nc(),op=kc(),sp=xc();function ma(e,t,i,r,n,a){let o=i.type==="block-map"?ap.resolveBlockMap(e,t,i,r,a):i.type==="block-seq"?op.resolveBlockSeq(e,t,i,r,a):sp.resolveFlowCollection(e,t,i,r,a),s=o.constructor;return n==="!"||n===s.tagName?(o.tag=s.tagName,o):(n&&(o.tag=n),o)}function cp(e,t,i,r,n){let a=r.tag,o=a?t.directives.tagName(a.source,f=>n(a,"TAG_RESOLVE_FAILED",f)):null;if(i.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=r,v=f&&a?f.offset>a.offset?f:a:f??a;v&&(!p||p.offset<v.offset)&&n(v,"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===rp.YAMLMap.tagName&&s==="map"||o===np.YAMLSeq.tagName&&s==="seq")return ma(e,t,i,n,o);let c=t.schema.tags.find(f=>f.tag===o&&f.collection===s);if(!c){let f=t.schema.knownTags[o];if(f?.collection===s)t.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),ma(e,t,i,n,o)}let l=ma(e,t,i,n,o,c),d=c.resolve?.(l,f=>n(a,"TAG_RESOLVE_FAILED",f),t.options)??l,u=tp.isNode(d)?d:new ip.Scalar(d);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}Cc.composeCollection=cp});var ga=g(_c=>{"use strict";var va=j();function lp(e,t,i){let r=t.offset,n=up(t,e.options.strict,i);if(!n)return{value:"",type:null,comment:"",range:[r,r,r]};let a=n.mode===">"?va.Scalar.BLOCK_FOLDED:va.Scalar.BLOCK_LITERAL,o=t.source?dp(t.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 t.source&&(m+=t.source.length),{value:h,type:a,comment:n.comment,range:[r,m,m]}}let c=t.indent+n.indent,l=t.offset+n.length,d=0;for(let h=0;h<s;++h){let[m,w]=o[h];if(w===""||w==="\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),d=h,c===0&&!e.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+w.length+1}for(let h=o.length-1;h>=s;--h)o[h][0].length>c&&(s=h+1);let u="",f="",p=!1;for(let h=0;h<d;++h)u+=o[h][0].slice(c)+`
74
+ `;for(let h=d;h<s;++h){let[m,w]=o[h];l+=m.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&m.length<c){let k=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;i(l-w.length-(y?2:1),"BAD_INDENT",k),m=""}a===va.Scalar.BLOCK_LITERAL?(u+=f+m.slice(c)+w,f=`
75
+ `):m.length>c||w[0]===" "?(f===" "?f=`
76
+ `:!p&&f===`
77
+ `&&(f=`
78
78
 
79
- `),f+=d+p.slice(c)+y,d=`
80
- `,m=!0):y===""?d===`
81
- `?f+=`
82
- `:d=`
83
- `:(f+=d+y,d=" ",m=!1)}switch(r.chomp){case"-":break;case"+":for(let h=s;h<o.length;++h)f+=`
84
- `+o[h][0].slice(c);f[f.length-1]!==`
85
- `&&(f+=`
86
- `);break;default:f+=`
87
- `}let g=n+r.length+t.source.length;return{value:f,type:a,comment:r.comment,range:[n,g,g]}}function Ip({offset:e,props:t},i,n){if(t[0].type!=="block-scalar-header")return n(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=t[0],a=r[0],o=0,s="",c=-1;for(let d=1;d<r.length;++d){let m=r[d];if(!s&&(m==="-"||m==="+"))s=m;else{let g=Number(m);!o&&g?o=g:c===-1&&(c=e+d)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,u="",f=r.length;for(let d=1;d<t.length;++d){let m=t[d];switch(m.type){case"space":l=!0;case"newline":f+=m.source.length;break;case"comment":i&&!l&&n(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=m.source.length,u=m.source.substring(1);break;case"error":n(m,"UNEXPECTED_TOKEN",m.message),f+=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"&&(f+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:f}}function jp(e){let t=e.split(/\n( *)/),i=t[0],n=i.match(/^( *)/),a=[n?.[1]?[n[1],i.slice(n[1].length)]:["",i]];for(let o=1;o<t.length;o+=2)a.push([t[o],t[o+1]]);return a}Kc.resolveBlockScalar=_p});var ja=w(Yc=>{"use strict";var Ia=$(),Op=ht();function $p(e,t,i){let{offset:n,type:r,source:a,end:o}=e,s,c,l=(d,m,g)=>i(n+d,m,g);switch(r){case"scalar":s=Ia.Scalar.PLAIN,c=Hp(a,l);break;case"single-quoted-scalar":s=Ia.Scalar.QUOTE_SINGLE,c=Mp(a,l);break;case"double-quoted-scalar":s=Ia.Scalar.QUOTE_DOUBLE,c=Fp(a,l);break;default:return i(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[n,n+a.length,n+a.length]}}let u=n+a.length,f=Op.resolveEnd(o,u,t,i);return{value:c,type:s,comment:f.comment,range:[n,u,f.offset]}}function Hp(e,t){let i="";switch(e[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 ${e[0]}`;break}case"@":case"`":{i=`reserved character ${e[0]}`;break}}return i&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Uc(e)}function Mp(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Uc(e.slice(1,-1)).replace(/''/g,"'")}function Uc(e){let t,i;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
79
+ `),u+=f+m.slice(c)+w,f=`
80
+ `,p=!0):w===""?f===`
81
+ `?u+=`
82
+ `:f=`
83
+ `:(u+=f+w,f=" ",p=!1)}switch(n.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 v=r+n.length+t.source.length;return{value:u,type:a,comment:n.comment,range:[r,v,v]}}function up({offset:e,props:t},i,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=t[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 v=Number(p);!o&&v?o=v:c===-1&&(c=e+f)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,d="",u=n.length;for(let f=1;f<t.length;++f){let p=t[f];switch(p.type){case"space":l=!0;case"newline":u+=p.source.length;break;case"comment":i&&!l&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,d=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let v=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",v);let h=p.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:d,length:u}}function dp(e){let t=e.split(/\n( *)/),i=t[0],r=i.match(/^( *)/),a=[r?.[1]?[r[1],i.slice(r[1].length)]:["",i]];for(let o=1;o<t.length;o+=2)a.push([t[o],t[o+1]]);return a}_c.resolveBlockScalar=lp});var ya=g(Ic=>{"use strict";var wa=j(),fp=ct();function hp(e,t,i){let{offset:r,type:n,source:a,end:o}=e,s,c,l=(f,p,v)=>i(r+f,p,v);switch(n){case"scalar":s=wa.Scalar.PLAIN,c=pp(a,l);break;case"single-quoted-scalar":s=wa.Scalar.QUOTE_SINGLE,c=mp(a,l);break;case"double-quoted-scalar":s=wa.Scalar.QUOTE_DOUBLE,c=vp(a,l);break;default:return i(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[r,r+a.length,r+a.length]}}let d=r+a.length,u=fp.resolveEnd(o,d,t,i);return{value:c,type:s,comment:u.comment,range:[r,d,u.offset]}}function pp(e,t){let i="";switch(e[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 ${e[0]}`;break}case"@":case"`":{i=`reserved character ${e[0]}`;break}}return i&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Tc(e)}function mp(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Tc(e.slice(1,-1)).replace(/''/g,"'")}function Tc(e){let t,i;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
88
  `,"sy"),i=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
- `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=t.exec(e);if(!n)return e;let r=n[1],a=" ",o=t.lastIndex;for(i.lastIndex=o;n=i.exec(e);)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(e),r+a+(n?.[1]??"")}function Fp(e,t){let i="";for(let n=1;n<e.length-1;++n){let r=e[n];if(!(r==="\r"&&e[n+1]===`
92
- `))if(r===`
93
- `){let{fold:a,offset:o}=Lp(e,n);i+=a,n=o}else if(r==="\\"){let a=e[++n],o=Dp[a];if(o)i+=o;else if(a===`
94
- `)for(a=e[n+1];a===" "||a===" ";)a=e[++n+1];else if(a==="\r"&&e[n+1]===`
95
- `)for(a=e[++n+1];a===" "||a===" ";)a=e[++n+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=Bp(e,n+1,s,t),n+=s}else{let s=e.substr(n-1,2);t(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(r===" "||r===" "){let a=n,o=e[n+1];for(;o===" "||o===" ";)o=e[++n+1];o!==`
96
- `&&!(o==="\r"&&e[n+2]===`
97
- `)&&(i+=n>a?e.slice(a,n+1):r)}else i+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),i}function Lp(e,t){let i="",n=e[t+1];for(;(n===" "||n===" "||n===`
98
- `||n==="\r")&&!(n==="\r"&&e[t+2]!==`
99
- `);)n===`
89
+ `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let n=r[1],a=" ",o=t.lastIndex;for(i.lastIndex=o;r=i.exec(e);)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(e),n+a+(r?.[1]??"")}function vp(e,t){let i="";for(let r=1;r<e.length-1;++r){let n=e[r];if(!(n==="\r"&&e[r+1]===`
92
+ `))if(n===`
93
+ `){let{fold:a,offset:o}=gp(e,r);i+=a,r=o}else if(n==="\\"){let a=e[++r],o=wp[a];if(o)i+=o;else if(a===`
94
+ `)for(a=e[r+1];a===" "||a===" ";)a=e[++r+1];else if(a==="\r"&&e[r+1]===`
95
+ `)for(a=e[++r+1];a===" "||a===" ";)a=e[++r+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=yp(e,r+1,s,t),r+=s}else{let s=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(n===" "||n===" "){let a=r,o=e[r+1];for(;o===" "||o===" ";)o=e[++r+1];o!==`
96
+ `&&!(o==="\r"&&e[r+2]===`
97
+ `)&&(i+=r>a?e.slice(a,r+1):n)}else i+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),i}function gp(e,t){let i="",r=e[t+1];for(;(r===" "||r===" "||r===`
98
+ `||r==="\r")&&!(r==="\r"&&e[t+2]!==`
99
+ `);)r===`
100
100
  `&&(i+=`
101
- `),t+=1,n=e[t+1];return i||(i=" "),{fold:i,offset:t}}var Dp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Bp(e,t,i,n){let r=e.substr(t,i),o=r.length===i&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let s=e.substr(t-2,i+2);return n(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Yc.resolveFlowScalar=$p});var Zc=w(Qc=>{"use strict";var qe=R(),Xc=$(),qp=_a(),Vp=ja();function Wp(e,t,i,n){let{value:r,type:a,comment:o,range:s}=t.type==="block-scalar"?qp.resolveBlockScalar(e,t,n):Vp.resolveFlowScalar(t,e.options.strict,n),c=i?e.directives.tagName(i.source,f=>n(i,"TAG_RESOLVE_FAILED",f)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[qe.SCALAR]:c?l=zp(e.schema,r,c,i,n):t.type==="scalar"?l=Jp(e,r,t,n):l=e.schema[qe.SCALAR];let u;try{let f=l.resolve(r,d=>n(i??t,"TAG_RESOLVE_FAILED",d),e.options);u=qe.isScalar(f)?f:new Xc.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);n(i??t,"TAG_RESOLVE_FAILED",d),u=new Xc.Scalar(r)}return u.range=s,u.source=r,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function zp(e,t,i,n,r){if(i==="!")return e[qe.SCALAR];let a=[];for(let s of e.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(t))return s;let o=e.knownTags[i];return o&&!o.collection?(e.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"),e[qe.SCALAR])}function Jp({atKey:e,directives:t,schema:i},n,r,a){let o=i.tags.find(s=>(s.default===!0||e&&s.default==="key")&&s.test?.test(n))||i[qe.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(n))??i[qe.SCALAR];if(o.tag!==s.tag){let c=t.tagString(o.tag),l=t.tagString(s.tag),u=`Value may be parsed as either ${c} or ${l}`;a(r,"TAG_RESOLVE_FAILED",u,!0)}}return o}Qc.composeScalar=Wp});var tl=w(el=>{"use strict";function Gp(e,t,i){if(t){i??(i=t.length);for(let n=i-1;n>=0;--n){let r=t[n];switch(r.type){case"space":case"comment":case"newline":e-=r.source.length;continue}for(r=t[++n];r?.type==="space";)e+=r.source.length,r=t[++n];break}}return e}el.emptyScalarPosition=Gp});var rl=w($a=>{"use strict";var Kp=_t(),Up=R(),Yp=Gc(),il=Zc(),Xp=ht(),Qp=tl(),Zp={composeNode:nl,composeEmptyNode:Oa};function nl(e,t,i,n){let r=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,u=!0;switch(t.type){case"alias":l=em(e,t,n),(s||c)&&n(t,"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=il.composeScalar(e,t,c,n),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Yp.composeCollection(Zp,e,t,i,n),s&&(l.anchor=s.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);n(t,"RESOURCE_EXHAUSTION",d)}break;default:{let f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;n(t,"UNEXPECTED_TOKEN",f),u=!1}}return l??(l=Oa(e,t.offset,void 0,null,i,n)),s&&l.anchor===""&&n(s,"BAD_ALIAS","Anchor cannot be an empty string"),r&&e.options.stringKeys&&(!Up.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Oa(e,t,i,n,{spaceBefore:r,comment:a,anchor:o,tag:s,end:c},l){let u={type:"scalar",offset:Qp.emptyScalarPosition(t,i,n),indent:-1,source:""},f=il.composeScalar(e,u,s,l);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(f.spaceBefore=!0),a&&(f.comment=a,f.range[2]=c),f}function em({options:e},{offset:t,source:i,end:n},r){let a=new Kp.Alias(i.substring(1));a.source===""&&r(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&r(t+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+i.length,s=Xp.resolveEnd(n,o,e.strict,r);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}$a.composeEmptyNode=Oa;$a.composeNode=nl});var sl=w(ol=>{"use strict";var tm=Gt(),al=rl(),im=ht(),nm=Xt();function rm(e,t,{offset:i,start:n,value:r,end:a},o){let s=Object.assign({_directives:t},e),c=new tm.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=nm.resolveProps(n,{indicator:"doc-start",next:r??a?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?al.composeNode(l,r,u,o):al.composeEmptyNode(l,u.end,n,null,u,o);let f=c.contents.range[2],d=im.resolveEnd(a,f,!1,o);return d.comment&&(c.comment=d.comment),c.range=[i,f,d.offset],c}ol.composeDoc=rm});var Ma=w(ul=>{"use strict";var am=Ii("process"),om=kr(),sm=Gt(),Qt=Yt(),cl=R(),cm=sl(),lm=ht();function Zt(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:i}=e;return[t,t+(typeof i=="string"?i.length:1)]}function ll(e){let t="",i=!1,n=!1;for(let r=0;r<e.length;++r){let a=e[r];switch(a[0]){case"#":t+=(t===""?"":n?`
101
+ `),t+=1,r=e[t+1];return i||(i=" "),{fold:i,offset:t}}var wp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function yp(e,t,i,r){let n=e.substr(t,i),o=n.length===i&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(o)}catch{let s=e.substr(t-2,i+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Ic.resolveFlowScalar=hp});var Oc=g($c=>{"use strict";var We=P(),jc=j(),Np=ga(),bp=ya();function kp(e,t,i,r){let{value:n,type:a,comment:o,range:s}=t.type==="block-scalar"?Np.resolveBlockScalar(e,t,r):bp.resolveFlowScalar(t,e.options.strict,r),c=i?e.directives.tagName(i.source,u=>r(i,"TAG_RESOLVE_FAILED",u)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[We.SCALAR]:c?l=Sp(e.schema,n,c,i,r):t.type==="scalar"?l=Ep(e,n,t,r):l=e.schema[We.SCALAR];let d;try{let u=l.resolve(n,f=>r(i??t,"TAG_RESOLVE_FAILED",f),e.options);d=We.isScalar(u)?u:new jc.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);r(i??t,"TAG_RESOLVE_FAILED",f),d=new jc.Scalar(n)}return d.range=s,d.source=n,a&&(d.type=a),c&&(d.tag=c),l.format&&(d.format=l.format),o&&(d.comment=o),d}function Sp(e,t,i,r,n){if(i==="!")return e[We.SCALAR];let a=[];for(let s of e.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(t))return s;let o=e.knownTags[i];return o&&!o.collection?(e.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"),e[We.SCALAR])}function Ep({atKey:e,directives:t,schema:i},r,n,a){let o=i.tags.find(s=>(s.default===!0||e&&s.default==="key")&&s.test?.test(r))||i[We.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(r))??i[We.SCALAR];if(o.tag!==s.tag){let c=t.tagString(o.tag),l=t.tagString(s.tag),d=`Value may be parsed as either ${c} or ${l}`;a(n,"TAG_RESOLVE_FAILED",d,!0)}}return o}$c.composeScalar=kp});var Dc=g(Hc=>{"use strict";function Pp(e,t,i){if(t){i??(i=t.length);for(let r=i-1;r>=0;--r){let n=t[r];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++r];n?.type==="space";)e+=n.source.length,n=t[++r];break}}return e}Hc.emptyScalarPosition=Pp});var Mc=g(ba=>{"use strict";var Rp=Et(),xp=P(),Cp=Ac(),Bc=Oc(),Ap=ct(),_p=Dc(),Tp={composeNode:Lc,composeEmptyNode:Na};function Lc(e,t,i,r){let n=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,d=!0;switch(t.type){case"alias":l=Ip(e,t,r),(s||c)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Bc.composeScalar(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Cp.composeCollection(Tp,e,t,i,r),s&&(l.anchor=s.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);r(t,"RESOURCE_EXHAUSTION",f)}break;default:{let u=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",u),d=!1}}return l??(l=Na(e,t.offset,void 0,null,i,r)),s&&l.anchor===""&&r(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!xp.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&d&&(l.srcToken=t),l}function Na(e,t,i,r,{spaceBefore:n,comment:a,anchor:o,tag:s,end:c},l){let d={type:"scalar",offset:_p.emptyScalarPosition(t,i,r),indent:-1,source:""},u=Bc.composeScalar(e,d,s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Ip({options:e},{offset:t,source:i,end:r},n){let a=new Rp.Alias(i.substring(1));a.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&n(t+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+i.length,s=Ap.resolveEnd(r,o,e.strict,n);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}ba.composeEmptyNode=Na;ba.composeNode=Lc});var qc=g(Vc=>{"use strict";var jp=Mt(),Fc=Mc(),$p=ct(),Op=Wt();function Hp(e,t,{offset:i,start:r,value:n,end:a},o){let s=Object.assign({_directives:t},e),c=new jp.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Op.resolveProps(r,{indicator:"doc-start",next:n??a?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?Fc.composeNode(l,n,d,o):Fc.composeEmptyNode(l,d.end,r,null,d,o);let u=c.contents.range[2],f=$p.resolveEnd(a,u,!1,o);return f.comment&&(c.comment=f.comment),c.range=[i,u,f.offset],c}Vc.composeDoc=Hp});var Sa=g(Jc=>{"use strict";var Dp=Pi("process"),Bp=cn(),Lp=Mt(),zt=qt(),Wc=P(),Mp=qc(),Fp=ct();function Jt(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:i}=e;return[t,t+(typeof i=="string"?i.length:1)]}function zc(e){let t="",i=!1,r=!1;for(let n=0;n<e.length;++n){let a=e[n];switch(a[0]){case"#":t+=(t===""?"":r?`
103
103
 
104
104
  `:`
105
- `)+(a.substring(1)||" "),i=!0,n=!1;break;case"%":e[r+1]?.[0]!=="#"&&(r+=1),i=!1;break;default:i||(n=!0),i=!1}}return{comment:t,afterEmptyLine:n}}var Ha=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,n,r,a)=>{let o=Zt(i);a?this.warnings.push(new Qt.YAMLWarning(o,n,r)):this.errors.push(new Qt.YAMLParseError(o,n,r))},this.directives=new om.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,i){let{comment:n,afterEmptyLine:r}=ll(this.prelude);if(n){let a=t.contents;if(i)t.comment=t.comment?`${t.comment}
106
- ${n}`:n;else if(r||t.directives.docStart||!a)t.commentBefore=n;else if(cl.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];cl.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)t.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)t.warnings.push(this.warnings[a])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ll(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,i=!1,n=-1){for(let r of t)yield*this.next(r);yield*this.end(i,n)}*next(t){switch(am.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(i,n,r)=>{let a=Zt(t);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",n,r)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let i=cm.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(t,"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(t.source);break;case"error":{let i=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,n=new Qt.YAMLParseError(Zt(t),"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 Qt.YAMLParseError(Zt(t),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let i=lm.resolveEnd(t.end,t.offset+t.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 Qt.YAMLParseError(Zt(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let n=Object.assign({_directives:this.directives},this.options),r=new sm.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}}};ul.Composer=Ha});var hl=w(En=>{"use strict";var um=_a(),fm=ja(),dm=Yt(),fl=Ht();function hm(e,t=!0,i){if(e){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 dm.YAMLParseError([s,s+1],a,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return fm.resolveFlowScalar(e,t,n);case"block-scalar":return um.resolveBlockScalar({options:{strict:t}},e,n)}}return null}function pm(e,t){let{implicitKey:i=!1,indent:n,inFlow:r=!1,offset:a=-1,type:o="PLAIN"}=t,s=fl.stringifyString({type:o,value:e},{implicitKey:i,indent:n>0?" ".repeat(n):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:n,source:`
105
+ `)+(a.substring(1)||" "),i=!0,r=!1;break;case"%":e[n+1]?.[0]!=="#"&&(n+=1),i=!1;break;default:i||(r=!0),i=!1}}return{comment:t,afterEmptyLine:r}}var ka=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,r,n,a)=>{let o=Jt(i);a?this.warnings.push(new zt.YAMLWarning(o,r,n)):this.errors.push(new zt.YAMLParseError(o,r,n))},this.directives=new Bp.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,i){let{comment:r,afterEmptyLine:n}=zc(this.prelude);if(r){let a=t.contents;if(i)t.comment=t.comment?`${t.comment}
106
+ ${r}`:r;else if(n||t.directives.docStart||!a)t.commentBefore=r;else if(Wc.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];Wc.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)t.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)t.warnings.push(this.warnings[a])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:zc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,i=!1,r=-1){for(let n of t)yield*this.next(n);yield*this.end(i,r)}*next(t){switch(Dp.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(i,r,n)=>{let a=Jt(t);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",r,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let i=Mp.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(t,"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(t.source);break;case"error":{let i=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new zt.YAMLParseError(Jt(t),"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 zt.YAMLParseError(Jt(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let i=Fp.resolveEnd(t.end,t.offset+t.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 zt.YAMLParseError(Jt(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let r=Object.assign({_directives:this.directives},this.options),n=new Lp.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}}};Jc.Composer=ka});var Kc=g(gr=>{"use strict";var Vp=ga(),qp=ya(),Wp=qt(),Gc=At();function zp(e,t=!0,i){if(e){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 Wp.YAMLParseError([s,s+1],a,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return qp.resolveFlowScalar(e,t,r);case"block-scalar":return Vp.resolveBlockScalar({options:{strict:t}},e,r)}}return null}function Jp(e,t){let{implicitKey:i=!1,indent:r,inFlow:n=!1,offset:a=-1,type:o="PLAIN"}=t,s=Gc.stringifyString({type:o,value:e},{implicitKey:i,indent:r>0?" ".repeat(r):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:r,source:`
110
110
  `}];switch(s[0]){case"|":case">":{let l=s.indexOf(`
111
- `),u=s.substring(0,l),f=s.substring(l+1)+`
112
- `,d=[{type:"block-scalar-header",offset:a,indent:n,source:u}];return dl(d,c)||d.push({type:"newline",offset:-1,indent:n,source:`
113
- `}),{type:"block-scalar",offset:a,indent:n,props:d,source:f}}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 mm(e,t,i={}){let{afterKey:n=!1,implicitKey:r=!1,inFlow:a=!1,type:o}=i,s="indent"in e?e.indent:null;if(n&&typeof s=="number"&&(s+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.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=fl.stringifyString({type:o,value:t},{implicitKey:r||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":vm(e,c);break;case'"':Fa(e,c,"double-quoted-scalar");break;case"'":Fa(e,c,"single-quoted-scalar");break;default:Fa(e,c,"scalar")}}function vm(e,t){let i=t.indexOf(`
114
- `),n=t.substring(0,i),r=t.substring(i+1)+`
115
- `;if(e.type==="block-scalar"){let a=e.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=n,e.source=r}else{let{offset:a}=e,o="indent"in e?e.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:n}];dl(s,"end"in e?e.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
- `});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:s,source:r})}}function dl(e,t){if(t)for(let i of t)switch(i.type){case"space":case"comment":e.push(i);break;case"newline":return e.push(i),!0}return!1}function Fa(e,t,i){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=i,e.source=t;break;case"block-scalar":{let n=e.props.slice(1),r=t.length;e.props[0].type==="block-scalar-header"&&(r-=e.props[0].source.length);for(let a of n)a.offset+=r;delete e.props,Object.assign(e,{type:i,source:t,end:n});break}case"block-map":case"block-seq":{let r={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
117
- `};delete e.items,Object.assign(e,{type:i,source:t,end:[r]});break}default:{let n="indent"in e?e.indent:-1,r="end"in e&&Array.isArray(e.end)?e.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(e))a!=="type"&&a!=="offset"&&delete e[a];Object.assign(e,{type:i,indent:n,source:t,end:r})}}}En.createScalarToken=pm;En.resolveAsScalar=hm;En.setScalarValue=mm});var ml=w(pl=>{"use strict";var gm=e=>"type"in e?Cn(e):Rn(e);function Cn(e){switch(e.type){case"block-scalar":{let t="";for(let i of e.props)t+=Cn(i);return t+e.source}case"block-map":case"block-seq":{let t="";for(let i of e.items)t+=Rn(i);return t}case"flow-collection":{let t=e.start.source;for(let i of e.items)t+=Rn(i);for(let i of e.end)t+=i.source;return t}case"document":{let t=Rn(e);if(e.end)for(let i of e.end)t+=i.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let i of e.end)t+=i.source;return t}}}function Rn({start:e,key:t,sep:i,value:n}){let r="";for(let a of e)r+=a.source;if(t&&(r+=Cn(t)),i)for(let a of i)r+=a.source;return n&&(r+=Cn(n)),r}pl.stringify=gm});var yl=w(wl=>{"use strict";var La=Symbol("break visit"),wm=Symbol("skip children"),vl=Symbol("remove item");function Ve(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),gl(Object.freeze([]),e,t)}Ve.BREAK=La;Ve.SKIP=wm;Ve.REMOVE=vl;Ve.itemAtPath=(e,t)=>{let i=e;for(let[n,r]of t){let a=i?.[n];if(a&&"items"in a)i=a.items[r];else return}return i};Ve.parentCollection=(e,t)=>{let i=Ve.itemAtPath(e,t.slice(0,-1)),n=t[t.length-1][0],r=i?.[n];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function gl(e,t,i){let n=i(t,e);if(typeof n=="symbol")return n;for(let r of["key","value"]){let a=t[r];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=gl(Object.freeze(e.concat([[r,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===La)return La;s===vl&&(a.items.splice(o,1),o-=1)}}typeof n=="function"&&r==="key"&&(n=n(t,e))}}return typeof n=="function"?n(t,e):n}wl.visit=Ve});var Pn=w(W=>{"use strict";var Da=hl(),ym=ml(),Nm=yl(),Ba="\uFEFF",qa="",Va="",Wa="",bm=e=>!!e&&"items"in e,km=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function Sm(e){switch(e){case Ba:return"<BOM>";case qa:return"<DOC>";case Va:return"<FLOW_END>";case Wa:return"<SCALAR>";default:return JSON.stringify(e)}}function Em(e){switch(e){case Ba:return"byte-order-mark";case qa:return"doc-mode";case Va:return"flow-error-end";case Wa:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
111
+ `),d=s.substring(0,l),u=s.substring(l+1)+`
112
+ `,f=[{type:"block-scalar-header",offset:a,indent:r,source:d}];return Uc(f,c)||f.push({type:"newline",offset:-1,indent:r,source:`
113
+ `}),{type:"block-scalar",offset:a,indent:r,props:f,source:u}}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 Gp(e,t,i={}){let{afterKey:r=!1,implicitKey:n=!1,inFlow:a=!1,type:o}=i,s="indent"in e?e.indent:null;if(r&&typeof s=="number"&&(s+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.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=Gc.stringifyString({type:o,value:t},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Up(e,c);break;case'"':Ea(e,c,"double-quoted-scalar");break;case"'":Ea(e,c,"single-quoted-scalar");break;default:Ea(e,c,"scalar")}}function Up(e,t){let i=t.indexOf(`
114
+ `),r=t.substring(0,i),n=t.substring(i+1)+`
115
+ `;if(e.type==="block-scalar"){let a=e.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=r,e.source=n}else{let{offset:a}=e,o="indent"in e?e.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:r}];Uc(s,"end"in e?e.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
+ `});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:s,source:n})}}function Uc(e,t){if(t)for(let i of t)switch(i.type){case"space":case"comment":e.push(i);break;case"newline":return e.push(i),!0}return!1}function Ea(e,t,i){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=i,e.source=t;break;case"block-scalar":{let r=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let a of r)a.offset+=n;delete e.props,Object.assign(e,{type:i,source:t,end:r});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
117
+ `};delete e.items,Object.assign(e,{type:i,source:t,end:[n]});break}default:{let r="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(e))a!=="type"&&a!=="offset"&&delete e[a];Object.assign(e,{type:i,indent:r,source:t,end:n})}}}gr.createScalarToken=Jp;gr.resolveAsScalar=zp;gr.setScalarValue=Gp});var Xc=g(Yc=>{"use strict";var Kp=e=>"type"in e?yr(e):wr(e);function yr(e){switch(e.type){case"block-scalar":{let t="";for(let i of e.props)t+=yr(i);return t+e.source}case"block-map":case"block-seq":{let t="";for(let i of e.items)t+=wr(i);return t}case"flow-collection":{let t=e.start.source;for(let i of e.items)t+=wr(i);for(let i of e.end)t+=i.source;return t}case"document":{let t=wr(e);if(e.end)for(let i of e.end)t+=i.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let i of e.end)t+=i.source;return t}}}function wr({start:e,key:t,sep:i,value:r}){let n="";for(let a of e)n+=a.source;if(t&&(n+=yr(t)),i)for(let a of i)n+=a.source;return r&&(n+=yr(r)),n}Yc.stringify=Kp});var tl=g(el=>{"use strict";var Pa=Symbol("break visit"),Yp=Symbol("skip children"),Qc=Symbol("remove item");function ze(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),Zc(Object.freeze([]),e,t)}ze.BREAK=Pa;ze.SKIP=Yp;ze.REMOVE=Qc;ze.itemAtPath=(e,t)=>{let i=e;for(let[r,n]of t){let a=i?.[r];if(a&&"items"in a)i=a.items[n];else return}return i};ze.parentCollection=(e,t)=>{let i=ze.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],n=i?.[r];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function Zc(e,t,i){let r=i(t,e);if(typeof r=="symbol")return r;for(let n of["key","value"]){let a=t[n];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=Zc(Object.freeze(e.concat([[n,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===Pa)return Pa;s===Qc&&(a.items.splice(o,1),o-=1)}}typeof r=="function"&&n==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}el.visit=ze});var Nr=g(W=>{"use strict";var Ra=Kc(),Xp=Xc(),Qp=tl(),xa="\uFEFF",Ca="",Aa="",_a="",Zp=e=>!!e&&"items"in e,em=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function tm(e){switch(e){case xa:return"<BOM>";case Ca:return"<DOC>";case Aa:return"<FLOW_END>";case _a:return"<SCALAR>";default:return JSON.stringify(e)}}function im(e){switch(e){case xa:return"byte-order-mark";case Ca:return"doc-mode";case Aa:return"flow-error-end";case _a: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(e[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=Da.createScalarToken;W.resolveAsScalar=Da.resolveAsScalar;W.setScalarValue=Da.setScalarValue;W.stringify=ym.stringify;W.visit=Nm.visit;W.BOM=Ba;W.DOCUMENT=qa;W.FLOW_END=Va;W.SCALAR=Wa;W.isCollection=bm;W.isScalar=km;W.prettyToken=Sm;W.tokenType=Em});var Ga=w(bl=>{"use strict";var ei=Pn();function ne(e){switch(e){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var Nl=new Set("0123456789ABCDEFabcdef"),Rm=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),An=new Set(",[]{}"),Cm=new Set(` ,[]{}
121
- \r `),za=e=>!e||Cm.has(e),Ja=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(t,i=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!i;let n=this.next??"stream";for(;n&&(i||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let t=this.pos,i=this.buffer[t];for(;i===" "||i===" ";)i=this.buffer[++t];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(e[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=Ra.createScalarToken;W.resolveAsScalar=Ra.resolveAsScalar;W.setScalarValue=Ra.setScalarValue;W.stringify=Xp.stringify;W.visit=Qp.visit;W.BOM=xa;W.DOCUMENT=Ca;W.FLOW_END=Aa;W.SCALAR=_a;W.isCollection=Zp;W.isScalar=em;W.prettyToken=tm;W.tokenType=im});var ja=g(rl=>{"use strict";var Gt=Nr();function ie(e){switch(e){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var il=new Set("0123456789ABCDEFabcdef"),rm=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),br=new Set(",[]{}"),nm=new Set(` ,[]{}
121
+ \r `),Ta=e=>!e||nm.has(e),Ia=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(t,i=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!i;let r=this.next??"stream";for(;r&&(i||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,i=this.buffer[t];for(;i===" "||i===" ";)i=this.buffer[++t];return!i||i==="#"||i===`
122
122
  `?!0:i==="\r"?this.buffer[t+1]===`
123
- `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let i=this.buffer[t];if(this.indentNext>0){let n=0;for(;i===" ";)i=this.buffer[++n+t];if(i==="\r"){let r=this.buffer[n+t+1];if(r===`
124
- `||!r&&!this.atEnd)return t+n+1}return i===`
125
- `||n>=this.indentNext||!i&&!this.atEnd?t+n:-1}if(i==="-"||i==="."){let n=this.buffer.substr(t,3);if((n==="---"||n==="...")&&ne(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
126
- `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){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 t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===ei.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let i=t.length,n=t.indexOf("#");for(;n!==-1;){let a=t[n-1];if(a===" "||a===" "){i=n-1;break}else n=t.indexOf("#",n+1)}for(;;){let a=t[i-1];if(a===" "||a===" ")i-=1;else break}let r=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-i),yield*this.pushNewline(),"stream"}return yield ei.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&ne(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&&!ne(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&ne(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 t=this.getLine();if(t===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(t[i]){case"#":yield*this.pushCount(t.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(za),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,i,n=-1;do t=yield*this.pushNewline(),t>0?(i=yield*this.pushSpaces(!1),this.indentValue=n=i):i=0,i+=yield*this.pushSpaces(!0);while(t+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("..."))&&ne(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield ei.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(za),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ne(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 t=this.charAt(0),i=this.buffer.indexOf(t,this.pos+1);if(t==="'")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 t=this.pos;for(;;){let i=this.buffer[++t];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=>ne(i)||i==="#")}*parseBlockScalar(){let t=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(t){return this.buffer[this.pos+t]}continueScalar(t){let i=this.buffer[t];if(this.indentNext>0){let r=0;for(;i===" ";)i=this.buffer[++r+t];if(i==="\r"){let n=this.buffer[r+t+1];if(n===`
124
+ `||!n&&!this.atEnd)return t+r+1}return i===`
125
+ `||r>=this.indentNext||!i&&!this.atEnd?t+r:-1}if(i==="-"||i==="."){let r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&ie(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
126
+ `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){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 t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===Gt.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let i=t.length,r=t.indexOf("#");for(;r!==-1;){let a=t[r-1];if(a===" "||a===" "){i=r-1;break}else r=t.indexOf("#",r+1)}for(;;){let a=t[i-1];if(a===" "||a===" ")i-=1;else break}let n=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-i),yield*this.pushNewline(),"stream"}return yield Gt.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&ie(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&&!ie(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&ie(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 t=this.getLine();if(t===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(t[i]){case"#":yield*this.pushCount(t.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(Ta),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,i,r=-1;do t=yield*this.pushNewline(),t>0?(i=yield*this.pushSpaces(!1),this.indentValue=r=i):i=0,i+=yield*this.pushSpaces(!0);while(t+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("..."))&&ie(n[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield Gt.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(Ta),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ie(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 t=this.charAt(0),i=this.buffer.indexOf(t,this.pos+1);if(t==="'")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 t=this.pos;for(;;){let i=this.buffer[++t];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=>ie(i)||i==="#")}*parseBlockScalar(){let t=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
  `:t=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(t+1);if(a===-1)break;t=this.buffer.indexOf(`
131
- `,a)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let r=t+1;for(n=this.buffer[r];n===" ";)n=this.buffer[++r];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
132
- `;)n=this.buffer[++r];t=r-1}else if(!this.blockScalarKeep)do{let a=t-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)t=a;else break}while(!0);return yield ei.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=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(ne(a)||t&&An.has(a))break;i=n}else if(ne(r)){let a=this.buffer[n+1];if(r==="\r"&&(a===`
134
- `?(n+=1,r=`
135
- `,a=this.buffer[n+1]):i=n),a==="#"||t&&An.has(a))break;if(r===`
136
- `){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(t&&An.has(r))break;i=n}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield ei.SCALAR,yield*this.pushToIndex(i+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,i){let n=this.buffer.slice(this.pos,t);return n?(yield n,this.pos+=n.length,n.length):(i&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(za),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,n=this.charAt(1);if(ne(n)||i&&An.has(n)){i?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,i=this.buffer[t];for(;!ne(i)&&i!==">";)i=this.buffer[++t];return yield*this.pushToIndex(i===">"?t+1:t,!1)}else{let t=this.pos+1,i=this.buffer[t];for(;i;)if(Rm.has(i))i=this.buffer[++t];else if(i==="%"&&Nl.has(this.buffer[t+1])&&Nl.has(this.buffer[t+2]))i=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
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(t+1);if(a===-1)break;t=this.buffer.indexOf(`
131
+ `,a)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let n=t+1;for(r=this.buffer[n];r===" ";)r=this.buffer[++n];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
132
+ `;)r=this.buffer[++n];t=n-1}else if(!this.blockScalarKeep)do{let a=t-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)t=a;else break}while(!0);return yield Gt.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=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(ie(a)||t&&br.has(a))break;i=r}else if(ie(n)){let a=this.buffer[r+1];if(n==="\r"&&(a===`
134
+ `?(r+=1,n=`
135
+ `,a=this.buffer[r+1]):i=r),a==="#"||t&&br.has(a))break;if(n===`
136
+ `){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(t&&br.has(n))break;i=r}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield Gt.SCALAR,yield*this.pushToIndex(i+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,i){let r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(i&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Ta),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,r=this.charAt(1);if(ie(r)||i&&br.has(r)){i?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,i=this.buffer[t];for(;!ie(i)&&i!==">";)i=this.buffer[++t];return yield*this.pushToIndex(i===">"?t+1:t,!1)}else{let t=this.pos+1,i=this.buffer[t];for(;i;)if(rm.has(i))i=this.buffer[++t];else if(i==="%"&&il.has(this.buffer[t+1])&&il.has(this.buffer[t+2]))i=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
137
137
  `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
138
- `?yield*this.pushCount(2):0}*pushSpaces(t){let i=this.pos-1,n;do n=this.buffer[++i];while(n===" "||t&&n===" ");let r=i-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=i),r}*pushUntil(t){let i=this.pos,n=this.buffer[i];for(;!t(n);)n=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};bl.Lexer=Ja});var Ua=w(kl=>{"use strict";var Ka=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let i=0,n=this.lineStarts.length;for(;i<n;){let a=i+n>>1;this.lineStarts[a]<t?i=a+1:n=a}if(this.lineStarts[i]===t)return{line:i+1,col:1};if(i===0)return{line:0,col:t};let r=this.lineStarts[i-1];return{line:i,col:t-r+1}}}};kl.LineCounter=Ka});var Xa=w(Pl=>{"use strict";var Pm=Ii("process"),Sl=Pn(),Am=Ga();function Ae(e,t){for(let i=0;i<e.length;++i)if(e[i].type===t)return!0;return!1}function El(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function Cl(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function xn(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function pt(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Tn(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let i=0;i<t.length;++i)e.push(t[i])}function Rl(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Ae(t.start,"explicit-key-ind")&&!Ae(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,Cl(t.value)?t.value.end?Tn(t.value.end,t.sep):t.value.end=t.sep:Tn(t.start,t.sep),delete t.sep)}var Ya=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Am.Lexer,this.onNewLine=t}*parse(t,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(t,i))yield*this.next(n);i||(yield*this.end())}*next(t){if(this.source=t,Pm.env.LOG_TOKENS&&console.log("|",Sl.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let i=Sl.tokenType(t);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+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let n=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:t}),this.offset+=t.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 t=this.peek(1);if(this.type==="doc-end"&&t?.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(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let i=t??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"&&Rl(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&&El(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 t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{El(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let i=xn(this.peek(2)),n=pt(i),r;t.end?(r=t.end,r.push(this.sourceToken),delete t.end):r=[this.sourceToken];let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:n,key:t,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let i=this.source.indexOf(`
138
+ `?yield*this.pushCount(2):0}*pushSpaces(t){let i=this.pos-1,r;do r=this.buffer[++i];while(r===" "||t&&r===" ");let n=i-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=i),n}*pushUntil(t){let i=this.pos,r=this.buffer[i];for(;!t(r);)r=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};rl.Lexer=Ia});var Oa=g(nl=>{"use strict";var $a=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let i=0,r=this.lineStarts.length;for(;i<r;){let a=i+r>>1;this.lineStarts[a]<t?i=a+1:r=a}if(this.lineStarts[i]===t)return{line:i+1,col:1};if(i===0)return{line:0,col:t};let n=this.lineStarts[i-1];return{line:i,col:t-n+1}}}};nl.LineCounter=$a});var Da=g(ll=>{"use strict";var am=Pi("process"),al=Nr(),om=ja();function Ce(e,t){for(let i=0;i<e.length;++i)if(e[i].type===t)return!0;return!1}function ol(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function cl(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function kr(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function lt(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Sr(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let i=0;i<t.length;++i)e.push(t[i])}function sl(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Ce(t.start,"explicit-key-ind")&&!Ce(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,cl(t.value)?t.value.end?Sr(t.value.end,t.sep):t.value.end=t.sep:Sr(t.start,t.sep),delete t.sep)}var Ha=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new om.Lexer,this.onNewLine=t}*parse(t,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(t,i))yield*this.next(r);i||(yield*this.end())}*next(t){if(this.source=t,am.env.LOG_TOKENS&&console.log("|",al.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let i=al.tokenType(t);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+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:t}),this.offset+=t.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 t=this.peek(1);if(this.type==="doc-end"&&t?.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(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let i=t??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"&&sl(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&&ol(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 t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{ol(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let i=kr(this.peek(2)),r=lt(i),n;t.end?(n=t.end,n.push(this.sourceToken),delete t.end):n=[this.sourceToken];let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.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(t){let i=t.items[t.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):t.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)t.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){Tn(r,i.start),r.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let n=!this.onKeyLine&&this.indent===t.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>t.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),t.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),t.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)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ae(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(Cl(i.key)&&!Ae(i.sep,"newline")){let o=pt(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(Ae(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=pt(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?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Ae(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?(t.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(t);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!Ae(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&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let i=t.items[t.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):t.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){Tn(r,i.start),r.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=t.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;i.value||Ae(i.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>t.indent){let n=this.startBlockValue(t);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let i=t.items[t.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(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?t.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?t.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?t.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":t.end.push(this.sourceToken);return}let n=this.startBlockValue(t);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===t.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=xn(n),a=pt(r);Rl(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let i=this.source.indexOf(`
140
+ `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let i=t.items[t.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):t.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)t.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Sr(n,i.start),n.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.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>t.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),t.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),t.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)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ce(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(cl(i.key)&&!Ce(i.sep,"newline")){let o=lt(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(Ce(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=lt(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?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Ce(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?(t.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(t);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!Ce(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&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let i=t.items[t.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):t.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Sr(n,i.start),n.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=t.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;i.value||Ce(i.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let i=t.items[t.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(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?t.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?t.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?t.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":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);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===t.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=kr(r),a=lt(n);sl(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){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:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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=xn(t),n=pt(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=xn(t),n=pt(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,i){return this.type!=="comment"||this.indent<=i?!1:t.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){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:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Pl.Parser=Ya});var Il=w(ii=>{"use strict";var Al=Ma(),xm=Gt(),ti=Yt(),Tm=$r(),_m=R(),Im=Ua(),xl=Xa();function Tl(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Im.LineCounter||null,prettyErrors:t}}function jm(e,t={}){let{lineCounter:i,prettyErrors:n}=Tl(t),r=new xl.Parser(i?.addNewLine),a=new Al.Composer(t),o=Array.from(a.compose(r.parse(e)));if(n&&i)for(let s of o)s.errors.forEach(ti.prettifyError(e,i)),s.warnings.forEach(ti.prettifyError(e,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function _l(e,t={}){let{lineCounter:i,prettyErrors:n}=Tl(t),r=new xl.Parser(i?.addNewLine),a=new Al.Composer(t),o=null;for(let s of a.compose(r.parse(e),!0,e.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new ti.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&i&&(o.errors.forEach(ti.prettifyError(e,i)),o.warnings.forEach(ti.prettifyError(e,i))),o}function Om(e,t,i){let n;typeof t=="function"?n=t:i===void 0&&t&&typeof t=="object"&&(i=t);let r=_l(e,i);if(!r)return null;if(r.warnings.forEach(a=>Tm.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 $m(e,t,i){let n=null;if(typeof t=="function"||Array.isArray(t)?n=t:i===void 0&&t&&(i=t),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(e===void 0){let{keepUndefined:r}=i??t??{};if(!r)return}return _m.isDocument(e)&&!n?e.toString(i):new xm.Document(e,n,i).toString(i)}ii.parse=Om;ii.parseAllDocuments=jm;ii.parseDocument=_l;ii.stringify=$m});var In=w(A=>{"use strict";var Hm=Ma(),Mm=Gt(),Fm=ga(),Qa=Yt(),Lm=_t(),xe=R(),Dm=Ee(),Bm=$(),qm=Ce(),Vm=Pe(),Wm=Pn(),zm=Ga(),Jm=Ua(),Gm=Xa(),_n=Il(),jl=Pt();A.Composer=Hm.Composer;A.Document=Mm.Document;A.Schema=Fm.Schema;A.YAMLError=Qa.YAMLError;A.YAMLParseError=Qa.YAMLParseError;A.YAMLWarning=Qa.YAMLWarning;A.Alias=Lm.Alias;A.isAlias=xe.isAlias;A.isCollection=xe.isCollection;A.isDocument=xe.isDocument;A.isMap=xe.isMap;A.isNode=xe.isNode;A.isPair=xe.isPair;A.isScalar=xe.isScalar;A.isSeq=xe.isSeq;A.Pair=Dm.Pair;A.Scalar=Bm.Scalar;A.YAMLMap=qm.YAMLMap;A.YAMLSeq=Vm.YAMLSeq;A.CST=Wm;A.Lexer=zm.Lexer;A.LineCounter=Jm.LineCounter;A.Parser=Gm.Parser;A.parse=_n.parse;A.parseAllDocuments=_n.parseAllDocuments;A.parseDocument=_n.parseDocument;A.stringify=_n.stringify;A.visit=jl.visit;A.visitAsync=jl.visitAsync});import vv from"path";var ri=wr(In(),1);import On from"path";var ai=64*1024,$n=1024,Hn=64,eo=5,Km=[".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/**"],J={include:["**/*"],exclude:[...Km],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4},jn={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
143
- # ambient_resume: true | false`,native:"# Native workflow settings. They do not change Classic state or behavior.","native.artifact_root":"# Root directory where Native stores Comet specs, changes, and runtime data.","native.language":`# Artifact language used by Native workflow documents.
144
- # language: en | zh-CN`,"native.clarification_mode":`# Controls whether Native asks one clarification at a time or every currently answerable question in a round.
145
- # clarification_mode: sequential | batch`,"native.archive_confirmation":`# Controls whether Native archives automatically after a successful preview or waits for explicit user confirmation.
146
- # archive_confirmation: automatic | required`,"native.max_verify_failures":"# Maximum failed Verify outcomes allowed for one confirmed contract before Native stops the completion loop.","native.snapshot":"# Controls the auditable project scope and bounded work used by Native content snapshots.","native.snapshot.include":"# Selects the project-relative paths included in Native snapshots. Patterns use / and support *, **, and ?.","native.snapshot.exclude":"# Removes paths from the included scope. Exclusions are bound into each new change baseline.","native.snapshot.max_files":"# Bounds the number of files captured by one snapshot. Increase it for large monorepos.","native.snapshot.max_total_bytes":"# Bounds the total file content hashed by one snapshot. Content is streamed and does not depend on Git hashes.","native.snapshot.max_duration_ms":"# Bounds snapshot capture time in milliseconds. Increase it together with the byte budget on slower or larger repositories.",classic:"# Classic workflow settings. They do not change Native state or behavior.","classic.artifact_layout":`# Selects the Classic artifact layout. The default is docs; update preserves detected root-level legacy artifacts.
142
+ `,i)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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=kr(t),r=lt(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=kr(t),r=lt(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,i){return this.type!=="comment"||this.indent<=i?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){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:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};ll.Parser=Ha});var pl=g(Kt=>{"use strict";var ul=Sa(),sm=Mt(),Ut=qt(),cm=bn(),lm=P(),um=Oa(),dl=Da();function fl(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new um.LineCounter||null,prettyErrors:t}}function dm(e,t={}){let{lineCounter:i,prettyErrors:r}=fl(t),n=new dl.Parser(i?.addNewLine),a=new ul.Composer(t),o=Array.from(a.compose(n.parse(e)));if(r&&i)for(let s of o)s.errors.forEach(Ut.prettifyError(e,i)),s.warnings.forEach(Ut.prettifyError(e,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function hl(e,t={}){let{lineCounter:i,prettyErrors:r}=fl(t),n=new dl.Parser(i?.addNewLine),a=new ul.Composer(t),o=null;for(let s of a.compose(n.parse(e),!0,e.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new Ut.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&i&&(o.errors.forEach(Ut.prettifyError(e,i)),o.warnings.forEach(Ut.prettifyError(e,i))),o}function fm(e,t,i){let r;typeof t=="function"?r=t:i===void 0&&t&&typeof t=="object"&&(i=t);let n=hl(e,i);if(!n)return null;if(n.warnings.forEach(a=>cm.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 hm(e,t,i){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:i===void 0&&t&&(i=t),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(e===void 0){let{keepUndefined:n}=i??t??{};if(!n)return}return lm.isDocument(e)&&!r?e.toString(i):new sm.Document(e,r,i).toString(i)}Kt.parse=fm;Kt.parseAllDocuments=dm;Kt.parseDocument=hl;Kt.stringify=hm});var Yt=g(x=>{"use strict";var pm=Sa(),mm=Mt(),vm=ra(),Ba=qt(),gm=Et(),Ae=P(),wm=Ee(),ym=j(),Nm=Re(),bm=xe(),km=Nr(),Sm=ja(),Em=Oa(),Pm=Da(),Er=pl(),ml=Nt();x.Composer=pm.Composer;x.Document=mm.Document;x.Schema=vm.Schema;x.YAMLError=Ba.YAMLError;x.YAMLParseError=Ba.YAMLParseError;x.YAMLWarning=Ba.YAMLWarning;x.Alias=gm.Alias;x.isAlias=Ae.isAlias;x.isCollection=Ae.isCollection;x.isDocument=Ae.isDocument;x.isMap=Ae.isMap;x.isNode=Ae.isNode;x.isPair=Ae.isPair;x.isScalar=Ae.isScalar;x.isSeq=Ae.isSeq;x.Pair=wm.Pair;x.Scalar=ym.Scalar;x.YAMLMap=Nm.YAMLMap;x.YAMLSeq=bm.YAMLSeq;x.CST=km;x.Lexer=Sm.Lexer;x.LineCounter=Em.LineCounter;x.Parser=Pm.Parser;x.parse=Er.parse;x.parseAllDocuments=Er.parseAllDocuments;x.parseDocument=Er.parseDocument;x.stringify=Er.stringify;x.visit=ml.visit;x.visitAsync=ml.visitAsync});import Qm from"path";var Zt=Ri(Yt(),1);import Rr from"path";var ei=64*1024,xr=1024,Cr=64,Ma=5,Rm=[".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/**"],xm=["**/.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"],Cm=[...Rm,...xm].sort((e,t)=>e.localeCompare(t,"en"));var G={include:["**/*"],exclude:[...Cm],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4},Pr={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
143
+ # ambient_resume: true | false`,native:"# Native workflow settings. They do not change Classic state or behavior.","native.artifact_root":"# Root directory where Native stores Comet specs and changes. Runtime data stays under .comet.","native.language":`# Artifact language used by Native workflow documents.
144
+ # language: en | zh-CN`,"native.clarification_mode":`# Controls how Native asks clarifying questions: batch asks every currently answerable question per round (default), sequential asks one at a time.
145
+ # clarification_mode: batch | sequential`,"native.archive_confirmation":`# Controls whether Native archives automatically after a successful preview or waits for explicit user confirmation.
146
+ # archive_confirmation: automatic | required`,"native.max_verify_failures":"# Maximum failed Verify outcomes allowed for one confirmed acceptance target before Native stops the completion loop.","native.snapshot":"# Controls the auditable project scope and bounded work used by Native content snapshots.","native.snapshot.include":"# Selects the project-relative paths included in Native snapshots. Patterns use / and support *, **, and ?.","native.snapshot.exclude":"# Removes paths from the included scope. Exclusions are bound into each new change baseline.","native.snapshot.max_files":"# Bounds the number of files captured by one snapshot. Increase it for large monorepos.","native.snapshot.max_total_bytes":"# Bounds the total file content hashed by one snapshot. Content is streamed and does not depend on Git hashes.","native.snapshot.max_duration_ms":"# Bounds snapshot capture time in milliseconds. Increase it together with the byte budget on slower or larger repositories.",classic:"# Classic workflow settings. They do not change Native state or behavior.","classic.artifact_layout":`# Selects the Classic artifact layout. The default is docs; update preserves detected root-level legacy artifacts.
147
147
  # artifact_layout: legacy | docs`,"classic.language":`# Artifact language used by Classic workflow documents.
148
148
  # language: en | zh-CN`,"classic.context_compression":`# Controls beta context compression for new Classic changes.
149
149
  # context_compression: off | beta`,"classic.review_mode":`# Sets the default review depth for new Classic changes.
150
150
  # review_mode: off | standard | thorough`,"classic.auto_transition":`# Automatically enters the next Classic phase after a phase passes.
151
151
  # auto_transition: true | false`},"zh-CN":{schema:"# Comet 使用的配置格式版本,请勿修改此值。",default_workflow:"# `/comet` 默认进入的工作流;该值也必须出现在 workflows 中。",workflows:"# 此项目启用的工作流,可填写 native、classic 或同时启用两者。",ambient_resume:`# 是否启用只读的环境感知恢复探针,同时作用于 Native 和 Classic;设为 false 可关闭自动工作流恢复。
152
- # ambient_resume: true | false`,native:"# Native 工作流配置,不会改变 Classic 的状态或行为。","native.artifact_root":"# Native 产物的存放根目录,包括规格、change 和运行时数据。","native.language":`# Native 工作流文档使用的产物语言。
153
- # 可选值:en | zh-CN`,"native.clarification_mode":`# Native 每轮询问一个问题,或一次提出当前所有可回答的问题。
154
- # 可选值:sequential | batch`,"native.archive_confirmation":`# Native 归档预演成功后自动归档,或等待用户明确确认。
155
- # 可选值:automatic | required`,"native.max_verify_failures":"# 同一份已确认 contract 最多允许的 Verify 失败次数;达到上限后停止完成循环。","native.snapshot":"# Native 内容快照使用的可审计项目范围与有界工作预算。","native.snapshot.include":"# Native 快照纳入的项目相对路径;模式使用 /,支持 *、** 和 ?。","native.snapshot.exclude":"# 从纳入范围中排除路径;新 change 会把排除策略绑定到 baseline。","native.snapshot.max_files":"# 单次快照最多捕获的文件数;大型 monorepo 可按需提高。","native.snapshot.max_total_bytes":"# 单次快照最多哈希的文件内容总字节数;内容采用流式读取,不依赖 Git hash。","native.snapshot.max_duration_ms":"# 单次快照的最长执行时间(毫秒);较慢或更大的仓库应与字节预算一并提高。",classic:"# Classic 工作流配置,不会改变 Native 的状态或行为。","classic.artifact_layout":`# Classic 产物布局;默认使用 docs,update 检测到根目录 legacy 产物时予以保留。
152
+ # ambient_resume: true | false`,native:"# Native 工作流配置,不会改变 Classic 的状态或行为。","native.artifact_root":"# Native 规格和 change 的存放根目录;运行时数据始终位于 .comet。","native.language":`# Native 工作流文档使用的产物语言。
153
+ # 可选值:en | zh-CN`,"native.clarification_mode":`# Native 提问澄清问题的方式:batch 每轮一次提出当前所有可回答的问题(默认),sequential 每轮只问一个。
154
+ # 可选值:batch | sequential`,"native.archive_confirmation":`# Native 归档检查成功后自动归档,或等待用户明确确认。
155
+ # 可选值:automatic | required`,"native.max_verify_failures":"# 同一个已确认验收目标最多允许的 Verify 失败次数;达到上限后停止完成循环。","native.snapshot":"# Native 内容快照使用的可审计项目范围与有界工作预算。","native.snapshot.include":"# Native 快照纳入的项目相对路径;模式使用 /,支持 *、** 和 ?。","native.snapshot.exclude":"# 从纳入范围中排除路径;新 change 会把排除策略绑定到 baseline。","native.snapshot.max_files":"# 单次快照最多捕获的文件数;大型 monorepo 可按需提高。","native.snapshot.max_total_bytes":"# 单次快照最多哈希的文件内容总字节数;内容采用流式读取,不依赖 Git hash。","native.snapshot.max_duration_ms":"# 单次快照的最长执行时间(毫秒);较慢或更大的仓库应与字节预算一并提高。",classic:"# Classic 工作流配置,不会改变 Native 的状态或行为。","classic.artifact_layout":`# Classic 产物布局;默认使用 docs,update 检测到根目录 legacy 产物时予以保留。
156
156
  # 可选值:legacy | docs`,"classic.language":`# Classic 工作流文档使用的产物语言。
157
157
  # 可选值:en | zh-CN`,"classic.context_compression":`# 新建 Classic change 是否启用 beta 上下文压缩。
158
158
  # 可选值:off | beta`,"classic.review_mode":`# 新建 Classic change 默认使用的审查深度。
159
159
  # 可选值:off | standard | thorough`,"classic.auto_transition":`# Classic 阶段通过后是否自动进入下一阶段。
160
- # 可选值:true | false`}};function $l(e,t){return jn[t][e]}function Um(e,t,i){let n=/^(\s*)([a-z_]+):/u.exec(e);if(!n)return null;let r=n[1].length,a=n[2];if(r===0&&a in jn.en)return a;if(r===2&&t){let o=`${t}.${a}`;if(o in jn.en)return o}if(r===4&&t==="native"&&i==="snapshot"){let o=`native.snapshot.${a}`;if(o in jn.en)return o}return null}function oi(e,t){let i=[],n=null,r=null;for(let a of(0,ri.stringify)(e).trimEnd().split(`
161
- `)){let o=Um(a,n,r);if(o){let s=a.match(/^\s*/u)?.[0]??"";for(let c of $l(o,t).split(`
162
- `))i.push(`${s}${c}`)}i.push(a),/^[a-z_]+:/u.test(a)?(a.startsWith("native:")?n="native":a.startsWith("classic:")?n="classic":n=null,r=null):/^ {2}[a-z_]+:/u.test(a)&&n==="native"&&(r=a.startsWith(" snapshot:")?"snapshot":null)}return i.push(""),i.join(`
163
- `)}function Ym(e,t){if(typeof e!="string")throw new Error(`${t} must be a string`);let i=e.trim();if(i.length===0||On.posix.isAbsolute(i)||On.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${t} must be a project-relative path`);if(i===".")return[];let n=i.replaceAll("\\","/").split("/");if(n.some(r=>r===".."))throw new Error(`${t} must stay inside the project root`);if(n.some(r=>r===""||r==="."))throw new Error(`${t} must not contain empty or dot path segments`);return n}function We(e){let t=Ym(e,"native.artifact_root");return t.length===0?".":t.join("/")}function Hl(e,t="docs"){let i=e??t;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function to(e,t,i=!1){if(typeof e!="string")throw new Error(`${t} must be a string`);let n=e.trim().replaceAll("\\","/");if(n.length===0||On.posix.isAbsolute(n)||On.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${t} must be relative to its declared path base`);let r=n.split("/");if(r.some(a=>a===".."))throw new Error(`${t} must stay inside its declared path base`);if(r.some(a=>a===""||a==="."))throw new Error(`${t} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(n))throw new Error(`${t} cannot contain wildcards`);return r.join("/")}function ni(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function Ml(e,t,i){let n=e??t;if(n!=="en"&&n!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return n}function Mn(e,t){if(typeof e!="string"||e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.split("/").includes(".."))throw new Error(`${t} contains an unsafe pattern`);if(e.length>$n)throw new Error(`${t} exceeds ${$n} characters`);let i=0;for(let n=0;n<e.length;n+=1)e[n]==="?"?i+=1:e[n]==="*"&&(i+=1,e[n+1]==="*"&&(n+=1));if(i>Hn)throw new Error(`${t} contains more than ${Hn} wildcard tokens`);return e}function Ol(e,t,i){if(e===void 0)return[...i];if(!Array.isArray(e))throw new Error(`${t} contains an unsafe pattern`);return[...new Set(e.map(n=>Mn(n,t)))].sort((n,r)=>n.localeCompare(r,"en"))}function Za(e,t,i){let n=e??t;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${i} must be a positive integer`);return n}function Xm(e){if(e===void 0)return{...J,include:[...J.include],exclude:[...J.exclude]};let t=ni(e,"native.snapshot");return{include:Ol(t.include,"native.snapshot.include",J.include),exclude:Ol(t.exclude,"native.snapshot.exclude",J.exclude),max_files:Za(t.max_files,J.max_files,"native.snapshot.max_files"),max_total_bytes:Za(t.max_total_bytes,J.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Za(t.max_duration_ms,J.max_duration_ms,"native.snapshot.max_duration_ms")}}function Qm(e){if(e===void 0)return;let t=ni(e,"native.pending_root_move"),i=t.id,n=t.from_artifact_root,r=t.to_artifact_root,a=t.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(t.cleanup!==void 0){let s=ni(t.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:We(n),toArtifactRoot:We(r),stage:a,...o?{cleanup:o}:{}}}function Zm(e,t={}){let i=ni(e,"native"),n=i.artifact_root??(t.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??eo;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Qm(i.pending_root_move);return{artifact_root:We(n),language:Ml(i.language,"en","native.language"),clarification_mode:r,archive_confirmation:a,max_verify_failures:o,snapshot:Xm(i.snapshot),...s?{pending_root_move:s}:{}}}function ev(e){let t=ni(e,"classic"),i=t.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let n=t.review_mode??"standard";if(n!=="off"&&n!=="standard"&&n!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=t.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Hl(t.artifact_layout),language:Ml(t.language,"zh-CN","classic.language"),context_compression:i,review_mode:n,auto_transition:r}}function tv(e){let t=e??!0;if(typeof t!="boolean")throw new Error("ambient_resume must be true or false");return t}function iv(e,t,i,n,r){let a=e.schema!==void 0;if(!(a||e.default_workflow!==void 0||e.workflows!==void 0||!r.allowPartialProject&&e.native!==void 0)||r.allowPartialProject&&!a)return null;if(e.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(e.default_workflow!=="native"&&e.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let s=e.workflows??[e.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(e.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!t)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:e.default_workflow,workflows:c,ambient_resume:n,...t?{native:t}:{},...i?{classic:i}:{}}}function vt(e,t={}){let i=(0,ri.parseDocument)(e,{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=tv(r.ambient_resume),o=r.native===void 0?void 0:Zm(r.native,{allowMissingArtifactRoot:t.allowMissingNativeFields}),s=r.classic===void 0?void 0:ev(r.classic),c=iv(r,o,s,a,{allowPartialProject:t.allowPartialProject??!1});return{value:r,config:c,ambient_resume:a,...o?{native:o}:{},...s?{classic:s}:{}}}function Fl(e){return{id:e.id,from_artifact_root:e.fromArtifactRoot,to_artifact_root:e.toArtifactRoot,stage:e.stage,...e.cleanup?{cleanup:{kind:e.cleanup.kind,state:e.cleanup.state,manifest_hash:e.cleanup.manifestHash}}:{}}}function Ll(e){return{schema:e.schema,default_workflow:e.default_workflow,workflows:e.workflows??[e.default_workflow],ambient_resume:e.ambient_resume,...e.native?{native:{artifact_root:e.native.artifact_root,language:e.native.language,clarification_mode:e.native.clarification_mode,archive_confirmation:e.native.archive_confirmation,max_verify_failures:e.native.max_verify_failures,snapshot:e.native.snapshot,...e.native.pending_root_move?{pending_root_move:Fl(e.native.pending_root_move)}:{}}}:{},...e.classic?{classic:{artifact_layout:e.classic.artifact_layout,language:e.classic.language,context_compression:e.classic.context_compression,review_mode:e.classic.review_mode,auto_transition:e.classic.auto_transition}}:{}}}function mt(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function si(e,t){let i=Ll(t),n=vt((0,ri.stringify)(i)).config;if(!n)throw new Error("Unsupported Comet project schema");let r={...e,schema:n.schema,default_workflow:n.default_workflow,workflows:n.workflows,ambient_resume:n.ambient_resume};if(n.native){let a=mt(e.native),o=mt(a.snapshot),s={...a,artifact_root:n.native.artifact_root,language:n.native.language,clarification_mode:n.native.clarification_mode,archive_confirmation:n.native.archive_confirmation,max_verify_failures:n.native.max_verify_failures,snapshot:{...o,...n.native.snapshot}};if(n.native.pending_root_move){let c=mt(a.pending_root_move),l=Fl(n.native.pending_root_move),u=mt(c.cleanup),f=mt(l.cleanup);s.pending_root_move={...c,...l,...l.cleanup?{cleanup:{...u,...f}}:{}}}else delete s.pending_root_move;r.native=s}return n.classic&&(r.classic={...mt(e.classic),artifact_layout:n.classic.artifact_layout,language:n.classic.language,context_compression:n.classic.context_compression,review_mode:n.classic.review_mode,auto_transition:n.classic.auto_transition}),r}function Fn(e="docs",t="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:We(e),language:t,clarification_mode:"sequential",archive_confirmation:"automatic",max_verify_failures:eo,snapshot:{...J,include:[...J.include],exclude:[...J.exclude]}}}}import{createHash as rv}from"crypto";import{promises as Bn}from"fs";import _e from"path";import{constants as Ln,promises as ze}from"fs";function Te(e){return e!==0&&e!==0n&&e!=="0"}function G(e,t){return Te(e.dev)&&Te(t.dev)&&Te(e.ino)&&Te(t.ino)}function I(e,t){let i=Te(e.dev)&&Te(t.dev);if(i&&e.dev!==t.dev)return!1;let n=Te(e.ino)&&Te(t.ino);return n&&e.ino!==t.ino?!1:i&&n?!0:e.birthtime===t.birthtime}var re=class extends Error{reason;constructor(t,i,n){super(i,n),this.name="RaceSafeReadError",this.reason=t}};function io(e){return"birthtimeNs"in e&&typeof e.birthtimeNs=="bigint"?e.birthtimeNs:e.birthtimeMs}function Dl(e){return"ctimeNs"in e&&typeof e.ctimeNs=="bigint"?e.ctimeNs:e.ctimeMs}function ci(e){return{dev:e.dev,ino:e.ino,birthtime:io(e)}}function Dn(e,t){let i=ci(e),n=ci(t);return G(i,n)?I(i,n):I(i,n)&&io(e)===io(t)&&Dl(e)===Dl(t)&&e.size===t.size}async function gt(e,t,i={}){if(!Number.isSafeInteger(t)||t<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 ze.lstat(e,{bigint:r});if(!a.isFile()||a.isSymbolicLink())throw new re("not-regular-file",`${n} must be a regular file`);if(BigInt(a.size)>BigInt(t))throw new re("too-large",`${n} exceeds ${t} bytes`);let o=await ze.realpath(e);await i.verify?.("pre-open",{realPath:o,identity:ci(a)});let s=process.platform==="win32"?Ln.O_RDONLY:Ln.O_RDONLY|Ln.O_NOFOLLOW|Ln.O_NONBLOCK,c;try{c=await ze.open(e,s)}catch(l){throw l.code==="ELOOP"?new re("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,u,f]=await Promise.all([c.stat({bigint:r}),ze.lstat(e,{bigint:r}),ze.realpath(e)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||f!==o||!Dn(a,l)||!Dn(a,u))throw new re("changed",`${n} changed while opening`);await i.verify?.("post-open",{realPath:f,identity:ci(l)}),await i.hooks?.afterOpen?.();let d=[],m=0,g=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let N=t+1-m,{bytesRead:k}=await c.read(g,0,Math.min(g.length,N),null);if(k===0)break;if(m+=k,m>t)throw new re("too-large",`${n} exceeds ${t} bytes`);d.push(Buffer.from(g.subarray(0,k)))}await i.hooks?.beforeFinalCheck?.();let[h,p,y]=await Promise.all([c.stat({bigint:r}),ze.lstat(e,{bigint:r}),ze.realpath(e)]);if(!p.isFile()||p.isSymbolicLink()||y!==o||!Dn(a,h)||!Dn(a,p))throw new re("changed",`${n} changed while reading`);return await i.verify?.("post-read",{realPath:y,identity:ci(h)}),{bytes:Buffer.concat(d,m),stat:h,realPath:y}}finally{await c.close()}}function nv(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function no(e,t){let i=_e.relative(e,t);return i===""||!_e.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${_e.sep}`)}async function Bl(e,t){let i=_e.resolve(e),n=await Bn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${t} project root must be a real directory`);return Bn.realpath(i)}async function ql(e,t,i,n){let r=e;for(let a=0;a<i.length;a++){r=_e.join(r,i[a]);let o;try{o=await Bn.lstat(r)}catch(u){if(nv(u))return{exists:!1,kind:"missing"};throw u}let s=_e.relative(e,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 Bn.realpath(r);if(!no(t,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 li(e,t,i){let n=to(t,i.label),r=_e.resolve(e),a=await Bl(r,i.label),o=n.split("/"),s=_e.resolve(r,...o);if(!no(r,s))throw new Error(`${i.label} must stay inside the project root`);let c=await ql(r,a,o,i);return{projectRoot:r,target:s,relative:n,exists:c.exists,kind:c.kind}}async function Je(e,t,i,n){let r=await li(e,t,{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 Bl(r.projectRoot,n.label);return gt(r.target,i,{...n,verify:async(o,s)=>{if(!no(a,s.realPath))throw new Error(`${n.label} resolves outside the project root`);await ql(r.projectRoot,a,r.relative.split("/"),{label:n.label,expected:"file"})}})}var ui=".comet/config.yaml";function ro(e,t){return e.exists===t.exists&&e.sha256===t.sha256}function av(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}async function ao(e,t={}){return(await fi(e,t)).document}async function Vl(e){try{return(await Je(e,ui,ai,{label:ui})).bytes}catch(t){if(av(t))return null;throw t}}function Wl(e){return e?{exists:!0,sha256:rv("sha256").update(e).digest("hex")}:{exists:!1,sha256:null}}async function qn(e){return Wl(await Vl(e))}async function fi(e,t={}){let i=await Vl(e);return{document:i?vt(i.toString("utf8"),t):null,identity:Wl(i)}}var eb=16*1024;async function oo(e,t){if(!t)return;let i=await qn(e);if(!ro(i,t))throw new Error("Project config changed before commit; rerun the operation")}import{randomUUID as lv}from"crypto";import{promises as D}from"fs";import ae from"path";function co(e,t){let i=ae.relative(e,t);return i===""||!ae.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ae.sep}`)}function uv(e,t){return I({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function so(e,t){let i={...e,birthtime:e.birthtimeMs},n={...t,birthtime:t.birthtimeMs};return G(i,n)?I(i,n):I(i,n)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function zl(e){let t=await D.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${e}`);return{path:e,realPath:await D.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function di(e){for(let t of e){let i=await D.lstat(t.path);if(!i.isDirectory()||i.isSymbolicLink()||!uv(t,i)||await D.realpath(t.path)!==t.realPath)throw new Error(`Native atomic write parent changed before commit: ${t.path}`)}}async function fv(e,t){let i=ae.resolve(e),n=ae.resolve(t);if(!co(i,n))throw new Error(`Native atomic write parent is outside its managed root: ${t}`);let r=[await zl(i)],a=ae.relative(i,n).split(ae.sep).filter(Boolean),o=i;for(let s of a){await di(r),o=ae.join(o,s);try{await D.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await zl(o);if(!co(r[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await di(r),r}async function dv(e){let t;try{t=await D.open(e,"r"),await t.sync()}catch(i){let n=i.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(n??""))throw i}finally{await t?.close()}}async function Jl(e,t,i={}){let n=ae.dirname(e),r=i.containedRoot?await fv(i.containedRoot,n):null;r||await D.mkdir(n,{recursive:!0});let a=ae.join(n,`.${ae.basename(e)}.${lv()}.tmp`),o,s;try{if(await i.beforeTemporaryOpen?.(),o=await D.open(a,"wx"),s=await o.stat(),r){let[c,l]=await Promise.all([D.lstat(a),D.realpath(a)]);if(await di(r),!c.isFile()||c.isSymbolicLink()||!so(s,c)||!co(r[0].realPath,l))throw new Error("Native atomic write temporary file opened outside its managed parent")}if(typeof t=="string"?await o.writeFile(t,"utf8"):await o.writeFile(t),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?.(),r){await di(r);let c=await D.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 D.link(a,e),await D.unlink(a)):await D.rename(a,e),await dv(n)}catch(c){if(await o?.close(),!r)await D.rm(a,{force:!0});else try{await di(r),await D.rm(a,{force:!0})}catch{}throw c}}async function he(e,t,i={}){await Jl(e,t,i)}async function Gl(e,t,i={}){await Jl(e,t,i)}async function oe(e,t,i={}){await he(e,JSON.stringify(t,null,2)+`
164
- `,i)}import{promises as wt}from"fs";import x from"path";import hv from"os";var Wn=".comet/config.yaml";async function lo(e){try{return await wt.lstat(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function pv(e){try{let t=await wt.readFile(e,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(t)}catch(t){if(t.code==="ENOENT")return!1;throw t}}function hi(e,t){let i=x.relative(e,t);return i===""||!x.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${x.sep}`)}async function pi(e){let t=[],i=e;for(;!await lo(i);){let r=x.dirname(i);if(r===i)break;t.push(x.basename(i)),i=r}let n=await wt.realpath(i);return x.resolve(n,...t.reverse())}async function Kl(e){try{return(await wt.lstat(e)).isSymbolicLink()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function uo(e){let t=x.resolve(e);try{(await wt.stat(t)).isDirectory()||(t=x.dirname(t))}catch(r){if(r.code!=="ENOENT")throw r}let i=t,n=x.resolve(hv.homedir());for(;;){if(!(t===n&&i!==n)){let o=x.join(t,...Wn.split("/")),s=t===i||await pv(o);if(await lo(o)&&s)return t}if(await lo(x.join(t,".git")))return t;let a=x.dirname(t);if(a===t)return i;t=a}}function mi(e){return We(e)}async function mv(e,t){let i=mi(t),n=x.resolve(e,...i.split("/")),r=await wt.realpath(e),a=await pi(n);if(!hi(r,a))throw new Error("native.artifact_root resolves outside the project root");return n}async function Ge(e,t){let i=mi(t),n=await mv(e,i),r=x.join(n,"comet");if(await Kl(r))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([pi(n),pi(r)]);if(!hi(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");return{projectRoot:x.resolve(e),configFile:x.join(e,...Wn.split("/")),artifactRoot:n,artifactRootRef:i,nativeRoot:r,specsDir:x.join(r,"specs"),changesDir:x.join(r,"changes"),archiveDir:x.join(r,"archive"),runtimeDir:x.join(r,"runtime"),locksDir:x.join(r,"runtime","locks"),transactionsDir:x.join(r,"runtime","transactions")}}function K(e,t){return hi(x.resolve(e),x.resolve(t))}async function O(e,t){let i=x.resolve(e),n=x.resolve(t);if(!hi(i,n))throw new Error(`Path is outside the Native root: ${t}`);if(await Kl(i))throw new Error(`Native root must not be a symbolic link: ${e}`);let[r,a]=await Promise.all([pi(i),pi(n)]);if(!hi(r,a))throw new Error(`Path resolves outside the Native root: ${t}`);return n}var zn=Mn;function Ul(e="docs",t="en"){return Fn(e,t)}async function Ie(e){let t=(await ao(e))?.config??null;return t?.native?t:null}async function yt(e,t,i={}){let n=await fi(e,{allowPartialProject:!0}),r=si(n.document?.value??{},t),a=vv.join(e,...Wn.split("/"));await he(a,oi(r,t.native.language==="zh-CN"?"zh-CN":"en"),{containedRoot:e,beforeCommit:async()=>{await i.beforeCommit?.(),await oo(e,n.identity)}})}import{createHash as pw,randomUUID as mw}from"crypto";import{promises as Me}from"fs";import j from"path";var To=wr(In(),1);import{promises as Yg}from"fs";import tt from"path";import{createHash as Nv}from"node:crypto";import{promises as se}from"node:fs";import X from"node:path";import{TextDecoder as bv}from"node:util";var gv=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),wv=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function yv(e){return e.toLowerCase().startsWith(".env")}function vi(e){let i=e.replaceAll("\\","/").split("/").filter(Boolean).map(n=>n.toLowerCase());return i.some(n=>yv(n))?"environment-file":i.some(n=>wv.has(n))?"credential-config":i.includes(".git")?"git-metadata":i.some(n=>gv.has(n))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}var Gn=1024*1024;function fo(e,t){let i=X.relative(e,t);return i===""||!X.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${X.sep}`)}function kv(e){let t=X.posix.normalize(e);if(e.length===0||e!==e.trim()||e.includes("\\")||Array.from(e).some(r=>{let a=r.codePointAt(0)??0;return a<=31||a===127})||X.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes("..")||t!==e||t==="."||e.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${e}`);let i=e.toLowerCase(),n=vi(e);if(n||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${n??"native-runtime"}): ${e}`);return e}function Sv(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native artifact byte limit must be a positive integer");return e}function Ev(e,t){return I({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Jn(e,t){let i={...e,birthtime:e.birthtimeMs},n={...t,birthtime:t.birthtimeMs};return G(i,n)?I(i,n):I(i,n)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function Yl(e){let t=await se.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${e}`);return{path:e,realPath:await se.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function Rv(e,t){let i=X.resolve(e),n=X.resolve(t);if(!fo(i,n))throw new Error("Native artifact path is outside its root");let r=[await Yl(i)],a=i;for(let o of X.relative(i,n).split(X.sep).filter(Boolean)){a=X.join(a,o);let s=await Yl(a);if(!fo(r[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);r.push(s)}return r}async function Xl(e){for(let t of e){let i=await se.lstat(t.path);if(!i.isDirectory()||i.isSymbolicLink()||!Ev(t,i)||await se.realpath(t.path)!==t.realPath)throw new Error(`Native artifact parent changed while reading: ${t.path}`)}}async function je(e){let t=kv(e.ref),i=Sv(e.maxBytes??Gn),n=X.resolve(e.root,...t.split("/")),r=await Rv(e.root,X.dirname(n));await e.hooks?.afterParentChainCaptured?.();let a=await se.lstat(n);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${t}`);if(a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${t}`);let o=await se.realpath(n);if(!fo(r[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${t}`);let s=await se.open(n,"r");try{let[c,l,u]=await Promise.all([s.stat(),se.lstat(n),se.realpath(n)]);if(await Xl(r),!c.isFile()||!l.isFile()||l.isSymbolicLink()||u!==o||!Jn(a,c)||!Jn(c,l))throw new Error(`Native artifact changed while opening: ${t}`);await e.hooks?.afterOpen?.();let f=[],d=0,m=Buffer.allocUnsafe(Math.min(64*1024,i+1));for(;;){let k=i+1-d,S=await s.read(m,0,Math.min(m.length,k),null);if(S.bytesRead===0)break;if(d+=S.bytesRead,d>i)throw new Error(`Native artifact exceeds ${i} bytes: ${t}`);f.push(Buffer.from(m.subarray(0,S.bytesRead)))}await e.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([s.stat(),se.lstat(n),se.realpath(n)]);if(await Xl(r),!h.isFile()||h.isSymbolicLink()||p!==o||!Jn(c,g)||!Jn(c,h))throw new Error(`Native artifact changed while reading: ${t}`);let y=Buffer.concat(f,d),N;try{N=new bv("utf-8",{fatal:!0}).decode(y)}catch(k){throw new Error(`Native artifact is not valid UTF-8: ${t}`,{cause:k})}return{ref:t,size:d,hash:Nv("sha256").update(y).digest("hex"),text:N}}finally{await s.close()}}import{AsyncLocalStorage as Cv}from"async_hooks";import{randomUUID as eu}from"crypto";import{promises as Q}from"fs";import tu from"os";import B from"path";var Ql=16*1024,iu=".coordinator",Pv=5e3,Zl=new Cv,Kn=new Map;function Av(e){if(!/^[a-z][a-z0-9-]*$/u.test(e))throw new Error(`Invalid Native lock name: ${e}`);return`${e}.lock`}function xv(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Invalid Native lock metadata: ${t}`);let i=e;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: ${t}`);return i}function nu(e){return{device:e.dev.toString(),inode:e.ino.toString(),size:e.size.toString(),birthtimeNs:e.birthtimeNs.toString(),ctimeNs:e.ctimeNs.toString(),mtimeNs:e.mtimeNs.toString()}}function ho(e,t){let i={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs},n={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs};return G(i,n)?I(i,n):I(i,n)&&e.size===t.size}function po(e,t){return ho(e,t)&&e.size===t.size&&e.birthtimeNs===t.birthtimeNs&&e.ctimeNs===t.ctimeNs&&e.mtimeNs===t.mtimeNs}async function Oe(e){let t,i;try{let n=await gt(e,Ql,{bigint:!0,label:"Native lock"});t=n.bytes,i=n.stat}catch(n){if(n.code==="ENOENT")return null;throw n instanceof re?n.reason==="too-large"?new Error(`Native lock metadata exceeds ${Ql} bytes: ${e}`,{cause:n}):n.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${e}`,{cause:n}):new Error(`Native lock changed while reading: ${e}`,{cause:n}):n}return{file:e,owner:xv(JSON.parse(t.toString("utf8")),e),identity:nu(i)}}async function Tv(e){return(await Oe(e))?.owner??null}function _v(e){if(!e)return{status:"missing",owner:null,identity:null};if(e.owner.hostname!==tu.hostname())return{status:"unknown",owner:e.owner,identity:e.identity};let t=Mv(e.owner.pid);return{status:t===!0?"active":t===!1?"stale":"unknown",owner:e.owner,identity:e.identity}}async function Iv(e,t){try{await Q.lstat(t);return}catch(i){if(i.code!=="ENOENT")throw i}try{await Q.rename(e,t)}catch(i){if(i.code!=="ENOENT")throw i}}async function mo(e,t){let i=await Oe(e.file);if(!i)return"missing";if(i.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!po(i.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);await Q.mkdir(t,{recursive:!0});let n=B.join(t,`${B.basename(e.file)}.${e.owner.id}.${eu()}.removed`);try{await Q.rename(e.file,n)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let r=await Oe(n);if(!r||r.owner.id!==e.owner.id||!ho(r.identity,e.identity))throw await Iv(n,e.file),new Error(`Native lock changed before quarantine: ${e.file}`);return await Q.rm(n,{force:!0}),"removed"}function ru(e){return{id:eu(),pid:process.pid,hostname:tu.hostname(),createdAt:new Date().toISOString(),operation:e}}async function au(e,t){let i;try{i=await Q.open(e,"wx")}catch(n){if(n.code==="EEXIST"){let r=await Tv(e);throw new Error(`Native lock is already held: ${e}${r?` by pid ${r.pid} for ${r.operation}`:""}`,{cause:n})}throw n}try{return await i.writeFile(JSON.stringify(t,null,2)+`
165
- `,"utf8"),await i.sync(),nu(await i.stat({bigint:!0}))}finally{await i.close()}}async function jv(e,t){let i=await O(e.nativeRoot,e.locksDir);await Q.mkdir(i,{recursive:!0});let n=await O(e.nativeRoot,B.join(i,iu));await Q.mkdir(n,{recursive:!0});let r=ru(t),a=B.join(n,`.${r.id}.tmp`),o=B.join(n,`${r.id}.claim`);try{let s=await au(a,r);await Q.rename(a,o);let c=await Oe(o);if(!c||!ho(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:e.nativeRoot,locksDir:i,owner:r,identity:c.identity}}finally{await Q.rm(a,{force:!0})}}async function Ov(e){let t=B.dirname(e.file),i=!1,n=B.basename(e.file);for(let r of await Q.readdir(t,{withFileTypes:!0})){if(!r.isFile()||r.isSymbolicLink()||!r.name.endsWith(".claim"))continue;let a=B.join(t,r.name);if(B.resolve(a)!==B.resolve(e.file))try{let o=await Oe(a),s=_v(o);if(s.status==="missing")continue;if(s.status==="stale"&&o){await mo(o,t);continue}r.name<n&&(i=!0)}catch{r.name<n&&(i=!0)}}return i}async function ou(e){let t=await Oe(e.file);if(t){if(t.owner.id!==e.owner.id||!po(t.identity,e.identity))throw new Error(`Native lock coordinator ownership changed: ${e.file}`);await mo(t,B.dirname(e.file))}}async function $v(e,t){let i=Date.now()+Pv;for(;;){let n=await jv(e,t);if(!await Ov(n))return n;if(await ou(n),Date.now()>=i)throw new Error(`Native lock coordinator is busy: ${e.locksDir}`);await new Promise(r=>setTimeout(r,2+Math.floor(Math.random()*7)))}}async function Hv(e){let t=Kn.get(e)??Promise.resolve(),i,n=new Promise(a=>{i=a}),r=t.then(()=>n);return Kn.set(e,r),await t,()=>{i(),Kn.get(e)===r&&Kn.delete(e)}}async function su(e,t,i){let n=B.resolve(e.locksDir),r=Zl.getStore();if(r?.has(n))return i();let a=await Hv(n);try{let o=await $v(e,t),s=new Map(r??[]);return s.set(n,o),await Zl.run(s,async()=>{try{return await i()}finally{await ou(o)}})}finally{a()}}async function gi(e,t,i){return su(e,`acquire ${t}`,async()=>{let n=await O(e.nativeRoot,e.locksDir);await Q.mkdir(n,{recursive:!0});let r=await O(e.nativeRoot,B.join(n,Av(t))),a=ru(i),o=await au(r,a);return{file:r,nativeRoot:e.nativeRoot,locksDir:n,owner:a,identity:o}})}async function wi(e){await Oe(e.file)&&await su(e,`release ${B.basename(e.file)}`,async()=>{let t=await Oe(e.file);if(!t)return;if(t.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!po(t.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);let i=B.join(e.locksDir,iu);await mo(t,i)})}function Mv(e){try{return process.kill(e,0),!0}catch(t){let i=t.code;return i==="ESRCH"?!1:i==="EPERM"?!0:null}}import{promises as Qn}from"fs";import ye from"path";import{TextDecoder as qv}from"util";import{createHash as Fv}from"node:crypto";import{constants as Un,promises as P}from"node:fs";import T from"node:path";import{TextDecoder as Lv}from"node:util";function pe(e,t){let i=T.relative(e,t);return i===""||!T.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${T.sep}`)}function cu(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native protected file byte limit must be a positive integer");return e}function Yn(e,t){return I({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function lu(e){return{dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs,ctimeMs:e.ctimeMs,mtimeMs:e.mtimeMs,size:e.size}}function Nt(e,t){return I({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function Ke(e,t){let i=await P.lstat(e);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${t} parent must be a real directory: ${e}`);return{path:e,realPath:await P.realpath(e),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function yi(e,t,i){let n=T.resolve(e),r=T.resolve(t);if(!pe(n,r))throw new Error(`${i} is outside its managed root`);let a=[await Ke(n,i)],o=n;for(let s of T.relative(n,r).split(T.sep).filter(Boolean)){await L(a,i),o=T.join(o,s);let c=await Ke(o,i);if(!pe(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await L(a,i),a}async function L(e,t){for(let i of e){let n=await P.lstat(i.path);if(!n.isDirectory()||n.isSymbolicLink()||!Yn(i,n)||await P.realpath(i.path)!==i.realPath)throw new Error(`${t} parent changed during I/O: ${i.path}`)}}async function Dv(e,t,i){let n=[],r=0,a=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let o=t+1-r,{bytesRead:s}=await e.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(r+=s,r>t)throw new Error(`${i} exceeds ${t} bytes`);n.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(n,r)}async function q(e){let t=cu(e.maxBytes),i=T.resolve(e.file),n=await yi(e.root,T.dirname(i),e.label),r=await Promise.all((e.forbiddenRoots??[]).map(u=>Ke(T.resolve(u),e.label)));await e.hooks?.afterParentChainCaptured?.(),await L(n,e.label);let a=await P.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);if(a.size>t)throw new Error(`${e.label} exceeds ${t} bytes`);let o=lu(a),s=await P.realpath(i);if(!pe(n[0].realPath,s))throw new Error(`${e.label} resolves outside its managed root`);if(r.some(u=>pe(u.realPath,s)))throw new Error(`${e.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 P.open(i,c);try{let u=await l.stat();await e.hooks?.afterOpen?.();let[f,d]=await Promise.all([P.lstat(i),P.realpath(i)]);if(await L(n,e.label),await L(r,e.label),!u.isFile()||!f.isFile()||f.isSymbolicLink()||d!==s||!Nt(o,u)||!Nt(o,f))throw new Error(`${e.label} changed while opening`);await e.hooks?.beforeRead?.();let m=await Dv(l,t,e.label);await e.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([l.stat(),P.lstat(i),P.realpath(i)]);if(await L(n,e.label),await L(r,e.label),!h.isFile()||h.isSymbolicLink()||p!==s||!Nt(o,g)||!Nt(o,h))throw new Error(`${e.label} changed while reading`);return{bytes:m,hash:Fv("sha256").update(m).digest("hex"),size:m.length}}finally{await l.close()}}async function uu(e){let t=await q(e),i;try{i=new Lv("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e.label} is not valid UTF-8`,{cause:n})}return{...t,text:i}}async function Ue(e){let t=await yi(e.root,e.directory,e.label),i;if(e.maxEntries===void 0)i=await P.readdir(e.directory,{withFileTypes:!0});else{let n=cu(e.maxEntries);i=[];let r=await P.opendir(e.directory);try{for await(let a of r)if(i.push(a),i.length>n)throw new Error(`${e.label} exceeds ${n} entries`)}finally{await r.close().catch(a=>{if(a.code!=="ERR_DIR_CLOSED")throw a})}}return await L(t,e.label),{entries:i,verify:()=>L(t,e.label)}}async function Bv(e){let t=T.resolve(e.directory),i=T.resolve(e.quarantine);if(T.dirname(i)!==T.dirname(t)||!pe(T.resolve(e.root),i)||i===t)throw new Error(`${e.label} quarantine must be a distinct sibling inside its root`);let n=await yi(e.root,T.dirname(t),e.label),r=await Ke(t,e.label);if(!pe(n[0].realPath,r.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeQuarantine?.(),await L(n,e.label);let a=await P.lstat(t);if(!a.isDirectory()||a.isSymbolicLink()||!Yn(r,a)||await P.realpath(t)!==r.realPath)throw new Error(`${e.label} changed before quarantine`);try{throw await P.lstat(i),new Error(`${e.label} quarantine path is occupied`)}catch(s){if(s.code!=="ENOENT")throw s}await P.rename(t,i),await L(n,e.label);let o=await P.lstat(i);if(!o.isDirectory()||o.isSymbolicLink()||!Yn(r,o))throw new Error(`${e.label} changed while quarantining`);await e.afterQuarantine?.(i);try{throw await P.lstat(t),new Error(`${e.label} path was recreated while quarantining`)}catch(s){if(s.code!=="ENOENT")throw s}return{quarantine:i,parentChain:n,identity:r}}async function fu(e){await Bv(e)}async function vo(e){let t=T.resolve(e.file),i=await yi(e.root,T.dirname(t),e.label),n=await P.lstat(t);if(!n.isFile()||n.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);let r=lu(n),a=await P.realpath(t);if(!pe(i[0].realPath,a))throw new Error(`${e.label} resolves outside its managed root`);let o=await q({root:e.root,file:t,maxBytes:e.maxBytes,label:e.label});if(o.hash!==e.expectedHash||o.size!==e.expectedSize)throw new Error(`${e.label} changed before removal`);let[s,c]=await Promise.all([P.lstat(t),P.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!Nt(r,s)||c!==a)throw new Error(`${e.label} changed while verifying removal`);await e.beforeRemove?.(),await L(i,e.label);let[l,u]=await Promise.all([P.lstat(t),P.realpath(t)]);if(!l.isFile()||l.isSymbolicLink()||!Nt(r,l)||u!==a)throw new Error(`${e.label} changed before removal`);await P.rm(t),await L(i,e.label)}async function go(e){let t=T.resolve(e.directory),i=await yi(e.root,T.dirname(t),e.label),n=await Ke(t,e.label);if(!pe(i[0].realPath,n.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeRemove?.(),await L(i,e.label);let r=await P.lstat(t);if(!r.isDirectory()||r.isSymbolicLink()||!Yn(n,r)||await P.realpath(t)!==n.realPath)throw new Error(`${e.label} changed before removal`);await P.rmdir(t),await L(i,e.label)}async function Ni(e){let t=T.resolve(e.root),i=T.resolve(e.directory);if(!pe(t,i))throw new Error(`${e.label} is outside its managed root`);let n=[await Ke(t,e.label)],r=t;for(let a of T.relative(t,i).split(T.sep).filter(Boolean)){await L(n,e.label),r=T.join(r,a);try{await P.mkdir(r)}catch(s){if(s.code!=="EEXIST")throw s}let o=await Ke(r,e.label);if(!pe(n[0].realPath,o.realPath))throw new Error(`${e.label} resolves outside its managed root: ${r}`);n.push(o)}await L(n,e.label)}async function bi(e){let t=await q({root:e.sourceRoot,file:e.source,maxBytes:e.maxBytes,label:e.label,hooks:e.hooks,forbiddenRoots:e.forbiddenRoots});if(e.expectedHash!==void 0&&t.hash!==e.expectedHash)throw new Error(`${e.label} content changed before copy`);await Gl(e.target,t.bytes,{containedRoot:e.targetRoot,exclusive:e.exclusive,beforeCommit:async()=>{if(await e.hooks?.beforeTargetCommit?.(),e.expectedTargetHash===void 0)return;if(e.expectedTargetHash===null){try{await P.lstat(e.target)}catch(r){if(r.code==="ENOENT")return;throw r}throw new Error(`${e.label} target changed before commit`)}if((await q({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} existing target`})).hash!==e.expectedTargetHash)throw new Error(`${e.label} target changed before commit`)}});let i=await q({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} target`});if(i.hash!==t.hash||i.size!==t.size)throw new Error(`${e.label} target could not be verified`);return i}var Vv=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),Wv=new Set(["id","type","source","target","staged","backup"]),zv=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),Jv=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]),Gv=new Set(["sequence","timestamp","type","operationId"]),pu=new Set(["prepared","applying","committed","rolling-back","rolled-back"]),mu=new Set(["prepared","operation-started","operation-completed","archive-finalization-started","archive-finalized","commit","rollback-started","rollback-completed"]),Kv=256*1024,Uv=1024*1024,vu=16*1024,Zn=1024,ak=64*1024*1024;var gu=new qv("utf-8",{fatal:!0});function ki(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function Si(e,t,i){let n=Object.keys(e).filter(r=>!t.has(r));if(n.length>0)throw new Error(`${i} has unknown field(s): ${n.join(", ")}`)}function kt(e){if(typeof e!="string")return!1;let t=new Date(e);return!Number.isNaN(t.valueOf())&&t.toISOString()===e}function wo(e,t){if(typeof e!="string"||e.length===0||ye.isAbsolute(e)||/^(?:[A-Za-z]:|~|[\\/])/u.test(e)||e.split(/[\\/]/u).includes(".."))throw new Error(`${t} must stay inside the Native root`)}function Xn(e,t){if(typeof e!="string"||!/^[a-f0-9]{64}$/u.test(e))throw new Error(`${t} must be a SHA-256 hash`)}function du(e,t){if(wo(e,t),e.includes("\\")||e!==ye.posix.normalize(e)||e.split("/").includes(".")||e.endsWith("/")||Buffer.byteLength(e,"utf8")>1024)throw new Error(`${t} must be a normalized Native-relative ref`)}function Yv(e,t){let i=ki(e,`transaction operations[${t}]`);if(Si(i,Wv,`transaction operations[${t}]`),typeof i.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.id))throw new Error(`transaction operations[${t}].id is invalid`);if(i.type!=="write"&&i.type!=="remove"&&i.type!=="move")throw new Error(`transaction operation ${i.id} has an invalid type`);wo(i.target,`transaction operation ${i.id} target`);for(let n of["source","staged","backup"])i[n]!==void 0&&wo(i[n],`transaction operation ${i.id} ${n}`);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 wu(e){let t=ki(e,"Native Archive transaction journal");if(Si(t,zv,"Native Archive transaction journal"),t.schema!=="comet.native.transaction.v2")throw new Error("Unsupported Native Archive transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native Archive transaction id is invalid");if(t.kind!=="archive")throw new Error("Native v2 transaction kind must be archive");if(typeof t.status!="string"||!pu.has(t.status))throw new Error("Native Archive transaction status is invalid");if(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change))throw new Error("Native Archive transaction change name is invalid");if(!kt(t.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(Xn(t.preflightHash,"Native Archive transaction preflightHash"),!Array.isArray(t.operations)||t.operations.length>65)throw new Error("Native Archive transaction operations must be an array");let i=t.operations.map((s,c)=>{let l=ki(s,`Archive transaction operations[${c}]`);if(Si(l,Jv,`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`);du(l.target,`Archive transaction operation ${l.id} target`);for(let u of["source","staged","backup"])l[u]!==void 0&&du(l[u],`Archive transaction operation ${l.id} ${u}`);if(l.expectedTargetHash!==null&&Xn(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(Xn(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`);Xn(l.expectedSourceHash,`Archive move operation ${l.id} expectedSourceHash`)}return l}),n=i.map(s=>s.id);if(new Set(n).size!==n.length)throw new Error("Native Archive transaction operation ids must be unique");let r=`runtime/transactions/${t.id}`,a=i.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${t.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${t.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(`${r}/staged/specs/`))throw new Error(`Native Archive transaction staged ref is invalid: ${s.staged}`);if(s.backup!==void 0&&!s.backup.startsWith(`${r}/backups/specs/`))throw new Error(`Native Archive transaction backup ref is invalid: ${s.backup}`)}return{schema:"comet.native.transaction.v2",id:t.id,kind:"archive",status:t.status,change:t.change,createdAt:t.createdAt,preflightHash:t.preflightHash,operations:i}}function yo(e){let t=ki(e,"Native transaction journal");if(t.schema==="comet.native.transaction.v2")return wu(t);if(Si(t,Vv,"Native transaction journal"),t.schema!=="comet.native.transaction.v1")throw new Error("Unsupported Native transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native transaction id is invalid");if(t.kind!=="archive"&&t.kind!=="root-move")throw new Error("Native transaction kind is invalid");if(typeof t.status!="string"||!pu.has(t.status))throw new Error("Native transaction status is invalid");if(typeof t.projectRoot!="string"||!ye.isAbsolute(t.projectRoot)||typeof t.nativeRoot!="string"||!ye.isAbsolute(t.nativeRoot))throw new Error("Native transaction roots must be absolute paths");if(t.change!==void 0&&(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change)))throw new Error("Native transaction change name is invalid");if(!kt(t.createdAt))throw new Error("Native transaction createdAt is invalid");if(!Array.isArray(t.operations))throw new Error("Native transaction operations must be an array");let i=t.operations.map(Yv),n=i.map(r=>r.id);if(new Set(n).size!==n.length)throw new Error("Native transaction operation ids must be unique");return{schema:"comet.native.transaction.v1",id:t.id,kind:t.kind,status:t.status,projectRoot:t.projectRoot,nativeRoot:t.nativeRoot,...typeof t.change=="string"?{change:t.change}:{},createdAt:t.createdAt,operations:i}}function yu(e,t){let i=ki(e,`Native transaction event at line ${t}`);if(Si(i,Gv,`Native transaction event at line ${t}`),i.sequence!==t)throw new Error(`Native transaction event sequence at line ${t} must be ${t}`);if(!kt(i.timestamp))throw new Error(`Native transaction event timestamp at line ${t} is invalid`);if(typeof i.type!="string"||!mu.has(i.type))throw new Error(`Native transaction event type at line ${t} is invalid`);let n=i.type==="operation-started"||i.type==="operation-completed";if(n&&(typeof i.operationId!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.operationId)||Buffer.byteLength(i.operationId,"utf8")>256)||!n&&i.operationId!==void 0)throw new Error(`Native transaction event operationId at line ${t} is invalid`);return{sequence:i.sequence,timestamp:i.timestamp,type:i.type,...typeof i.operationId=="string"?{operationId:i.operationId}:{}}}function Xv(e){if(e.length>24)return!1;let t="0000-00-00T00:00:00.000Z";for(let n=0;n<e.length;n+=1){let r=t[n],a=e[n];if(r==="0"){if(!/[0-9]/u.test(a))return!1}else if(a!==r)return!1}let i=[[5,2,1,12],[8,2,1,31],[11,2,0,23],[14,2,0,59],[17,2,0,59],[20,3,0,999]];for(let[n,r,a,o]of i){if(e.length<=n)continue;let s=e.slice(n,Math.min(n+r,e.length));if(!Array.from({length:o-a+1},(l,u)=>String(a+u).padStart(r,"0")).some(l=>l.startsWith(s)))return!1}return e.length>=10&&!kt(`${e.slice(0,10)}T00:00:00.000Z`)?!1:e.length<24||kt(e)}function bt(e,t){return e.length<t.length&&t.startsWith(e)}function Qv(e){let t='","operationId":"';if(bt(e,t))return!0;if(!e.startsWith(t))return!1;let i=e.slice(t.length),n=i.indexOf('"');if(n===-1)return i.length===0||/^[a-z0-9][a-z0-9-]*$/u.test(i);let r=i.slice(0,n);return/^[a-z0-9][a-z0-9-]*$/u.test(r)?bt(i.slice(n),'"}'):!1}function Zv(e,t){if(e.length===0||Buffer.byteLength(e,"utf8")>vu)return!1;let i=`{"sequence":${t},"timestamp":"`;if(bt(e,i))return!0;if(!e.startsWith(i))return!1;let n=e.slice(i.length),r=n.slice(0,Math.min(24,n.length));if(!Xv(r))return!1;if(n.length<24)return!0;if(!kt(r))return!1;let a='","type":"',o=n.slice(24);if(bt(o,a))return!0;if(!o.startsWith(a))return!1;let s=o.slice(a.length);for(let c of mu){if(bt(s,c))return!0;if(!s.startsWith(c))continue;let l=s.slice(c.length);if(c==="operation-started"||c==="operation-completed"){if(Qv(l))return!0}else if(bt(l,'"}'))return!0}return!1}function eg(e,t){if(e.length===0)throw new Error("Blank transaction event line");if(Buffer.byteLength(e,"utf8")>vu)throw new Error(`Native transaction event at line ${t} is too large`);return yu(JSON.parse(e),t)}function tg(e){let t=e.split(`
166
- `),i=t.at(-1)==="";if(i&&t.pop(),t.length>Zn)throw new Error(`Native transaction event log exceeds ${Zn} events`);let n=[];for(let r=0;r<t.length;r+=1){let a=r+1,o=t[r],s=o.endsWith("\r")?o.slice(0,-1):o,c=!i&&r===t.length-1;try{n.push(eg(s,a))}catch(l){if(c){let u=!1;try{JSON.parse(s),u=!0}catch{}if(!u&&Zv(s,a))break}throw new Error(`Invalid Native transaction event at line ${a}`,{cause:l})}}return n}function Nu(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
160
+ # 可选值:true | false`}};function gl(e,t){return Pr[t][e]}function Am(e,t,i){let r=/^(\s*)([a-z_]+):/u.exec(e);if(!r)return null;let n=r[1].length,a=r[2];if(n===0&&a in Pr.en)return a;if(n===2&&t){let o=`${t}.${a}`;if(o in Pr.en)return o}if(n===4&&t==="native"&&i==="snapshot"){let o=`native.snapshot.${a}`;if(o in Pr.en)return o}return null}function ti(e,t){let i=[],r=null,n=null;for(let a of(0,Zt.stringify)(e).trimEnd().split(`
161
+ `)){let o=Am(a,r,n);if(o){let s=a.match(/^\s*/u)?.[0]??"";for(let c of gl(o,t).split(`
162
+ `))i.push(`${s}${c}`)}i.push(a),/^[a-z_]+:/u.test(a)?(a.startsWith("native:")?r="native":a.startsWith("classic:")?r="classic":r=null,n=null):/^ {2}[a-z_]+:/u.test(a)&&r==="native"&&(n=a.startsWith(" snapshot:")?"snapshot":null)}return i.push(""),i.join(`
163
+ `)}function _m(e,t){if(typeof e!="string")throw new Error(`${t} must be a string`);let i=e.trim();if(i.length===0||Rr.posix.isAbsolute(i)||Rr.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${t} must be a project-relative path`);if(i===".")return[];let r=i.replaceAll("\\","/").split("/");if(r.some(n=>n===".."))throw new Error(`${t} must stay inside the project root`);if(r.some(n=>n===""||n==="."))throw new Error(`${t} must not contain empty or dot path segments`);return r}function Je(e){let t=_m(e,"native.artifact_root");return t.length===0?".":t.join("/")}function wl(e,t="docs"){let i=e??t;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function Fa(e,t,i=!1){if(typeof e!="string")throw new Error(`${t} must be a string`);let r=e.trim().replaceAll("\\","/");if(r.length===0||Rr.posix.isAbsolute(r)||Rr.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${t} must be relative to its declared path base`);let n=r.split("/");if(n.some(a=>a===".."))throw new Error(`${t} must stay inside its declared path base`);if(n.some(a=>a===""||a==="."))throw new Error(`${t} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(r))throw new Error(`${t} cannot contain wildcards`);return n.join("/")}function Qt(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function yl(e,t,i){let r=e??t;if(r!=="en"&&r!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return r}function Va(e,t){if(typeof e!="string"||e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.split("/").includes(".."))throw new Error(`${t} contains an unsafe pattern`);if(e.length>xr)throw new Error(`${t} exceeds ${xr} characters`);let i=0;for(let r=0;r<e.length;r+=1)e[r]==="?"?i+=1:e[r]==="*"&&(i+=1,e[r+1]==="*"&&(r+=1));if(i>Cr)throw new Error(`${t} contains more than ${Cr} wildcard tokens`);return e}function vl(e,t,i){if(e===void 0)return[...i];if(!Array.isArray(e))throw new Error(`${t} contains an unsafe pattern`);return[...new Set(e.map(r=>Va(r,t)))].sort((r,n)=>r.localeCompare(n,"en"))}function La(e,t,i){let r=e??t;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${i} must be a positive integer`);return r}function Tm(e){if(e===void 0)return{...G,include:[...G.include],exclude:[...G.exclude]};let t=Qt(e,"native.snapshot");return{include:vl(t.include,"native.snapshot.include",G.include),exclude:vl(t.exclude,"native.snapshot.exclude",G.exclude),max_files:La(t.max_files,G.max_files,"native.snapshot.max_files"),max_total_bytes:La(t.max_total_bytes,G.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:La(t.max_duration_ms,G.max_duration_ms,"native.snapshot.max_duration_ms")}}function Im(e){if(e===void 0)return;let t=Qt(e,"native.pending_root_move"),i=t.id,r=t.from_artifact_root,n=t.to_artifact_root,a=t.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(t.cleanup!==void 0){let s=Qt(t.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:Je(r),toArtifactRoot:Je(n),stage:a,...o?{cleanup:o}:{}}}function jm(e,t={}){let i=Qt(e,"native"),r=i.artifact_root??(t.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??Ma;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Im(i.pending_root_move);return{artifact_root:Je(r),language:yl(i.language,"en","native.language"),clarification_mode:n,archive_confirmation:a,max_verify_failures:o,snapshot:Tm(i.snapshot),...s?{pending_root_move:s}:{}}}function $m(e){let t=Qt(e,"classic"),i=t.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let r=t.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=t.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:wl(t.artifact_layout),language:yl(t.language,"zh-CN","classic.language"),context_compression:i,review_mode:r,auto_transition:n}}function Om(e){let t=e??!0;if(typeof t!="boolean")throw new Error("ambient_resume must be true or false");return t}function Hm(e,t,i,r,n){let a=e.schema!==void 0;if(!(a||e.default_workflow!==void 0||e.workflows!==void 0||!n.allowPartialProject&&e.native!==void 0)||n.allowPartialProject&&!a)return null;if(e.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(e.default_workflow!=="native"&&e.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let s=e.workflows??[e.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(e.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!t)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:e.default_workflow,workflows:c,ambient_resume:r,...t?{native:t}:{},...i?{classic:i}:{}}}function ut(e,t={}){let i=(0,Zt.parseDocument)(e,{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=Om(n.ambient_resume),o=n.native===void 0?void 0:jm(n.native,{allowMissingArtifactRoot:t.allowMissingNativeFields}),s=n.classic===void 0?void 0:$m(n.classic),c=Hm(n,o,s,a,{allowPartialProject:t.allowPartialProject??!1});return{value:n,config:c,ambient_resume:a,...o?{native:o}:{},...s?{classic:s}:{}}}function Nl(e){return{id:e.id,from_artifact_root:e.fromArtifactRoot,to_artifact_root:e.toArtifactRoot,stage:e.stage,...e.cleanup?{cleanup:{kind:e.cleanup.kind,state:e.cleanup.state,manifest_hash:e.cleanup.manifestHash}}:{}}}function bl(e){return{schema:e.schema,default_workflow:e.default_workflow,workflows:e.workflows??[e.default_workflow],ambient_resume:e.ambient_resume,...e.native?{native:{artifact_root:e.native.artifact_root,language:e.native.language,clarification_mode:e.native.clarification_mode,archive_confirmation:e.native.archive_confirmation,max_verify_failures:e.native.max_verify_failures,...e.native.pending_root_move?{pending_root_move:Nl(e.native.pending_root_move)}:{}}}:{},...e.classic?{classic:{artifact_layout:e.classic.artifact_layout,language:e.classic.language,context_compression:e.classic.context_compression,review_mode:e.classic.review_mode,auto_transition:e.classic.auto_transition}}:{}}}function Xt(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function ii(e,t){let i=bl(t),r=ut((0,Zt.stringify)(i)).config;if(!r)throw new Error("Unsupported Comet project schema");let n={...e,schema:r.schema,default_workflow:r.default_workflow,workflows:r.workflows,ambient_resume:r.ambient_resume};if(r.native){let a=Xt(e.native),o={...a,artifact_root:r.native.artifact_root,language:r.native.language,clarification_mode:r.native.clarification_mode,archive_confirmation:r.native.archive_confirmation,max_verify_failures:r.native.max_verify_failures};if(delete o.snapshot,r.native.pending_root_move){let s=Xt(a.pending_root_move),c=Nl(r.native.pending_root_move),l=Xt(s.cleanup),d=Xt(c.cleanup);o.pending_root_move={...s,...c,...c.cleanup?{cleanup:{...l,...d}}:{}}}else delete o.pending_root_move;n.native=o}return r.classic&&(n.classic={...Xt(e.classic),artifact_layout:r.classic.artifact_layout,language:r.classic.language,context_compression:r.classic.context_compression,review_mode:r.classic.review_mode,auto_transition:r.classic.auto_transition}),n}function Ar(e="docs",t="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:Je(e),language:t,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Ma,snapshot:{...G,include:[...G.include],exclude:[...G.exclude]}}}}import{createHash as Bm}from"crypto";import{promises as Ir}from"fs";import Te from"path";import{constants as _r,promises as Ge}from"fs";function _e(e){return e!==0&&e!==0n&&e!=="0"}function U(e,t){return _e(e.dev)&&_e(t.dev)&&_e(e.ino)&&_e(t.ino)}function T(e,t){let i=_e(e.dev)&&_e(t.dev);if(i&&e.dev!==t.dev)return!1;let r=_e(e.ino)&&_e(t.ino);return r&&e.ino!==t.ino?!1:i&&r?!0:e.birthtime===t.birthtime}var re=class extends Error{reason;constructor(t,i,r){super(i,r),this.name="RaceSafeReadError",this.reason=t}};function qa(e){return"birthtimeNs"in e&&typeof e.birthtimeNs=="bigint"?e.birthtimeNs:e.birthtimeMs}function kl(e){return"ctimeNs"in e&&typeof e.ctimeNs=="bigint"?e.ctimeNs:e.ctimeMs}function ri(e){return{dev:e.dev,ino:e.ino,birthtime:qa(e)}}function Tr(e,t){let i=ri(e),r=ri(t);return U(i,r)?T(i,r):T(i,r)&&qa(e)===qa(t)&&kl(e)===kl(t)&&e.size===t.size}async function dt(e,t,i={}){if(!Number.isSafeInteger(t)||t<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 Ge.lstat(e,{bigint:n});if(!a.isFile()||a.isSymbolicLink())throw new re("not-regular-file",`${r} must be a regular file`);if(BigInt(a.size)>BigInt(t))throw new re("too-large",`${r} exceeds ${t} bytes`);let o=await Ge.realpath(e);await i.verify?.("pre-open",{realPath:o,identity:ri(a)});let s=process.platform==="win32"?_r.O_RDONLY:_r.O_RDONLY|_r.O_NOFOLLOW|_r.O_NONBLOCK,c;try{c=await Ge.open(e,s)}catch(l){throw l.code==="ELOOP"?new re("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,d,u]=await Promise.all([c.stat({bigint:n}),Ge.lstat(e,{bigint:n}),Ge.realpath(e)]);if(!l.isFile()||!d.isFile()||d.isSymbolicLink()||u!==o||!Tr(a,l)||!Tr(a,d))throw new re("changed",`${r} changed while opening`);await i.verify?.("post-open",{realPath:u,identity:ri(l)}),await i.hooks?.afterOpen?.();let f=[],p=0,v=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let y=t+1-p,{bytesRead:b}=await c.read(v,0,Math.min(v.length,y),null);if(b===0)break;if(p+=b,p>t)throw new re("too-large",`${r} exceeds ${t} bytes`);f.push(Buffer.from(v.subarray(0,b)))}await i.hooks?.beforeFinalCheck?.();let[h,m,w]=await Promise.all([c.stat({bigint:n}),Ge.lstat(e,{bigint:n}),Ge.realpath(e)]);if(!m.isFile()||m.isSymbolicLink()||w!==o||!Tr(a,h)||!Tr(a,m))throw new re("changed",`${r} changed while reading`);return await i.verify?.("post-read",{realPath:w,identity:ri(h)}),{bytes:Buffer.concat(f,p),stat:h,realPath:w}}finally{await c.close()}}function Dm(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function Wa(e,t){let i=Te.relative(e,t);return i===""||!Te.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Te.sep}`)}async function Sl(e,t){let i=Te.resolve(e),r=await Ir.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${t} project root must be a real directory`);return Ir.realpath(i)}async function El(e,t,i,r){let n=e;for(let a=0;a<i.length;a++){n=Te.join(n,i[a]);let o;try{o=await Ir.lstat(n)}catch(d){if(Dm(d))return{exists:!1,kind:"missing"};throw d}let s=Te.relative(e,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 Ir.realpath(n);if(!Wa(t,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 ft(e,t,i){let r=Fa(t,i.label),n=Te.resolve(e),a=await Sl(n,i.label),o=r.split("/"),s=Te.resolve(n,...o);if(!Wa(n,s))throw new Error(`${i.label} must stay inside the project root`);let c=await El(n,a,o,i);return{projectRoot:n,target:s,relative:r,exists:c.exists,kind:c.kind}}async function Ie(e,t,i,r){let n=await ft(e,t,{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 Sl(n.projectRoot,r.label);return dt(n.target,i,{...r,verify:async(o,s)=>{if(!Wa(a,s.realPath))throw new Error(`${r.label} resolves outside the project root`);await El(n.projectRoot,a,n.relative.split("/"),{label:r.label,expected:"file"})}})}var ni=".comet/config.yaml";function za(e,t){return e.exists===t.exists&&e.sha256===t.sha256}function Lm(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}async function Ja(e,t={}){return(await ai(e,t)).document}async function Pl(e){try{return(await Ie(e,ni,ei,{label:ni})).bytes}catch(t){if(Lm(t))return null;throw t}}function Rl(e){return e?{exists:!0,sha256:Bm("sha256").update(e).digest("hex")}:{exists:!1,sha256:null}}async function jr(e){return Rl(await Pl(e))}async function ai(e,t={}){let i=await Pl(e);return{document:i?ut(i.toString("utf8"),t):null,identity:Rl(i)}}var gN=16*1024;async function Ga(e,t){if(!t)return;let i=await jr(e);if(!za(i,t))throw new Error("Project config changed before commit; rerun the operation")}import{randomUUID as qm}from"crypto";import{promises as M}from"fs";import ne from"path";function Ka(e,t){let i=ne.relative(e,t);return i===""||!ne.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ne.sep}`)}function Wm(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Ua(e,t){let i={...e,birthtime:e.birthtimeMs},r={...t,birthtime:t.birthtimeMs};return U(i,r)?T(i,r):T(i,r)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function xl(e){let t=await M.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${e}`);return{path:e,realPath:await M.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function si(e){for(let t of e){let i=await M.lstat(t.path);if(!i.isDirectory()||i.isSymbolicLink()||!Wm(t,i)||await M.realpath(t.path)!==t.realPath)throw new Error(`Native atomic write parent changed before commit: ${t.path}`)}}async function zm(e,t){let i=ne.resolve(e),r=ne.resolve(t);if(!Ka(i,r))throw new Error(`Native atomic write parent is outside its managed root: ${t}`);let n=[await xl(i)],a=ne.relative(i,r).split(ne.sep).filter(Boolean),o=i;for(let s of a){await si(n),o=ne.join(o,s);try{await M.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await xl(o);if(!Ka(n[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);n.push(c)}return await si(n),n}async function Jm(e){let t;try{t=await M.open(e,"r"),await t.sync()}catch(i){let r=i.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw i}finally{await t?.close()}}async function Cl(e,t,i={}){let r=ne.dirname(e),n=i.containedRoot?await zm(i.containedRoot,r):null;n||await M.mkdir(r,{recursive:!0});let a=ne.join(r,`.${ne.basename(e)}.${qm()}.tmp`),o,s;try{if(await i.beforeTemporaryOpen?.(),o=await M.open(a,"wx"),s=await o.stat(),n){let[c,l]=await Promise.all([M.lstat(a),M.realpath(a)]);if(await si(n),!c.isFile()||c.isSymbolicLink()||!Ua(s,c)||!Ka(n[0].realPath,l))throw new Error("Native atomic write temporary file opened outside its managed parent")}if(typeof t=="string"?await o.writeFile(t,"utf8"):await o.writeFile(t),await o.sync(),!Ua(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 si(n);let c=await M.lstat(a);if(!c.isFile()||c.isSymbolicLink()||!s||!Ua(c,s))throw new Error("Native atomic write temporary file changed before commit")}i.exclusive?(await M.link(a,e),await M.unlink(a)):await M.rename(a,e),await Jm(r)}catch(c){if(await o?.close(),!n)await M.rm(a,{force:!0});else try{await si(n),await M.rm(a,{force:!0})}catch{}throw c}}async function z(e,t,i={}){await Cl(e,t,i)}async function Al(e,t,i={}){await Cl(e,t,i)}async function X(e,t,i={}){await z(e,JSON.stringify(t,null,2)+`
164
+ `,i)}import{existsSync as _l,promises as Ue}from"fs";import C from"path";import Gm from"os";var $r=".comet/config.yaml",Um=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;async function Ya(e){try{return await Ue.lstat(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Km(e){try{let t=await Ue.readFile(e,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(t)}catch(t){if(t.code==="ENOENT")return!1;throw t}}function pt(e,t){let i=C.relative(e,t);return i===""||!C.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${C.sep}`)}async function ht(e){let t=[],i=e;for(;!await Ya(i);){let n=C.dirname(i);if(n===i)break;t.push(C.basename(i)),i=n}let r=await Ue.realpath(i);return C.resolve(r,...t.reverse())}async function Xa(e){try{return(await Ue.lstat(e)).isSymbolicLink()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Qa(e){let t=C.resolve(e);try{(await Ue.stat(t)).isDirectory()||(t=C.dirname(t))}catch(n){if(n.code!=="ENOENT")throw n}let i=t,r=C.resolve(Gm.homedir());for(;;){if(!(t===r&&i!==r)){let o=C.join(t,...$r.split("/")),s=t===i||await Km(o);if(await Ya(o)&&s)return t}if(await Ya(C.join(t,".git")))return t;let a=C.dirname(t);if(a===t)return i;t=a}}function ci(e){return Je(e)}async function Ym(e,t){let i=ci(t),r=C.resolve(e,...i.split("/")),n=await Ue.realpath(e),a=await ht(r);if(!pt(n,a))throw new Error("native.artifact_root resolves outside the project root");return r}async function je(e,t){let i=ci(t),r=await Ym(e,i),n=C.join(r,"comet");if(await Xa(n))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([ht(r),ht(n)]);if(!pt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");let s=C.resolve(e),c=C.join(s,".comet","runtime","native");if(await Xa(c))throw new Error("The Native Runtime root must not be a symbolic link");let[l,d]=await Promise.all([Ue.realpath(s),ht(c)]);if(!pt(l,d))throw new Error("The Native Runtime root resolves outside the project root");return{projectRoot:s,configFile:C.join(e,...$r.split("/")),artifactRoot:r,artifactRootRef:i,nativeRoot:n,specsDir:C.join(n,"specs"),changesDir:C.join(n,"changes"),archiveDir:C.join(n,"archive"),runtimeDir:c,changesRuntimeDir:C.join(c,"changes"),locksDir:C.join(c,"locks"),transactionsDir:C.join(c,"transactions")}}function Tl(e){if(!Um.test(e))throw new Error(`Invalid Native change name: ${e}`)}function Or(e,t){Tl(t);let i=C.join(e.changesRuntimeDir,t);if(!F(e.changesRuntimeDir,i))throw new Error("Native change Runtime path escaped");return i}function Xm(e,t){Tl(t);let i=C.join(e.changesDir,t,"runtime");if(!F(e.changesDir,i))throw new Error("Legacy Native change Runtime path escaped");return i}function de(e,t){let i=Or(e,t);if(_l(i))return i;let r=Xm(e,t);return _l(r)?r:i}function ae(e,t){let i=C.resolve(t);if(F(e.runtimeDir,i))return e.runtimeDir;if(F(e.nativeRoot,i))return e.nativeRoot;throw new Error(`Path is outside Native document and Runtime roots: ${t}`)}function F(e,t){return pt(C.resolve(e),C.resolve(t))}async function $(e,t){let i=C.resolve(e),r=C.resolve(t);if(!pt(i,r))throw new Error(`Path is outside the Native root: ${t}`);if(await Xa(i))throw new Error(`Native root must not be a symbolic link: ${e}`);let[n,a]=await Promise.all([ht(i),ht(r)]);if(!pt(n,a))throw new Error(`Path resolves outside the Native root: ${t}`);return r}function Il(e="docs",t="en"){return Ar(e,t)}async function fe(e){let t=(await Ja(e))?.config??null;return t?.native?t:null}async function $e(e,t,i={}){let r=await ai(e,{allowPartialProject:!0}),n=ii(r.document?.value??{},t),a=Qm.join(e,...$r.split("/"));await z(a,ti(n,t.native.language==="zh-CN"?"zh-CN":"en"),{containedRoot:e,beforeCommit:async()=>{await i.beforeCommit?.(),await Ga(e,r.identity)}})}import{createHash as kg,randomUUID as Sg}from"crypto";import{promises as Le}from"fs";import I from"path";import{AsyncLocalStorage as Zm}from"async_hooks";import{randomUUID as Ol}from"crypto";import{promises as Q}from"fs";import Hl from"os";import V from"path";var jl=16*1024,Dl=".coordinator",ev=5e3,$l=new Zm,Hr=new Map;function tv(e){if(!/^[a-z][a-z0-9-]*$/u.test(e))throw new Error(`Invalid Native lock name: ${e}`);return`${e}.lock`}function iv(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Invalid Native lock metadata: ${t}`);let i=e;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: ${t}`);return i}function Bl(e){return{device:e.dev.toString(),inode:e.ino.toString(),size:e.size.toString(),birthtimeNs:e.birthtimeNs.toString(),ctimeNs:e.ctimeNs.toString(),mtimeNs:e.mtimeNs.toString()}}function Za(e,t){let i={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs},r={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs};return U(i,r)?T(i,r):T(i,r)&&e.size===t.size}function eo(e,t){return Za(e,t)&&e.size===t.size&&e.birthtimeNs===t.birthtimeNs&&e.ctimeNs===t.ctimeNs&&e.mtimeNs===t.mtimeNs}async function Oe(e){let t,i;try{let r=await dt(e,jl,{bigint:!0,label:"Native lock"});t=r.bytes,i=r.stat}catch(r){if(r.code==="ENOENT")return null;throw r instanceof re?r.reason==="too-large"?new Error(`Native lock metadata exceeds ${jl} bytes: ${e}`,{cause:r}):r.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${e}`,{cause:r}):new Error(`Native lock changed while reading: ${e}`,{cause:r}):r}return{file:e,owner:iv(JSON.parse(t.toString("utf8")),e),identity:Bl(i)}}async function rv(e){return(await Oe(e))?.owner??null}function nv(e){if(!e)return{status:"missing",owner:null,identity:null};if(e.owner.hostname!==Hl.hostname())return{status:"unknown",owner:e.owner,identity:e.identity};let t=uv(e.owner.pid);return{status:t===!0?"active":t===!1?"stale":"unknown",owner:e.owner,identity:e.identity}}async function av(e,t){try{await Q.lstat(t);return}catch(i){if(i.code!=="ENOENT")throw i}try{await Q.rename(e,t)}catch(i){if(i.code!=="ENOENT")throw i}}async function to(e,t){let i=await Oe(e.file);if(!i)return"missing";if(i.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!eo(i.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);await Q.mkdir(t,{recursive:!0});let r=V.join(t,`${V.basename(e.file)}.${e.owner.id}.${Ol()}.removed`);try{await Q.rename(e.file,r)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let n=await Oe(r);if(!n||n.owner.id!==e.owner.id||!Za(n.identity,e.identity))throw await av(r,e.file),new Error(`Native lock changed before quarantine: ${e.file}`);return await Q.rm(r,{force:!0}),"removed"}function Ll(e){return{id:Ol(),pid:process.pid,hostname:Hl.hostname(),createdAt:new Date().toISOString(),operation:e}}async function Ml(e,t){let i;try{i=await Q.open(e,"wx")}catch(r){if(r.code==="EEXIST"){let n=await rv(e);throw new Error(`Native lock is already held: ${e}${n?` by pid ${n.pid} for ${n.operation}`:""}`,{cause:r})}throw r}try{return await i.writeFile(JSON.stringify(t,null,2)+`
165
+ `,"utf8"),await i.sync(),Bl(await i.stat({bigint:!0}))}finally{await i.close()}}async function ov(e,t){let i=await $(e.runtimeDir,e.locksDir);await Q.mkdir(i,{recursive:!0});let r=await $(e.runtimeDir,V.join(i,Dl));await Q.mkdir(r,{recursive:!0});let n=Ll(t),a=V.join(r,`.${n.id}.tmp`),o=V.join(r,`${n.id}.claim`);try{let s=await Ml(a,n);await Q.rename(a,o);let c=await Oe(o);if(!c||!Za(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:e.runtimeDir,locksDir:i,owner:n,identity:c.identity}}finally{await Q.rm(a,{force:!0})}}async function sv(e){let t=V.dirname(e.file),i=!1,r=V.basename(e.file);for(let n of await Q.readdir(t,{withFileTypes:!0})){if(!n.isFile()||n.isSymbolicLink()||!n.name.endsWith(".claim"))continue;let a=V.join(t,n.name);if(V.resolve(a)!==V.resolve(e.file))try{let o=await Oe(a),s=nv(o);if(s.status==="missing")continue;if(s.status==="stale"&&o){await to(o,t);continue}n.name<r&&(i=!0)}catch{n.name<r&&(i=!0)}}return i}async function Fl(e){let t=await Oe(e.file);if(t){if(t.owner.id!==e.owner.id||!eo(t.identity,e.identity))throw new Error(`Native lock coordinator ownership changed: ${e.file}`);await to(t,V.dirname(e.file))}}async function cv(e,t){let i=Date.now()+ev;for(;;){let r=await ov(e,t);if(!await sv(r))return r;if(await Fl(r),Date.now()>=i)throw new Error(`Native lock coordinator is busy: ${e.locksDir}`);await new Promise(n=>setTimeout(n,2+Math.floor(Math.random()*7)))}}async function lv(e){let t=Hr.get(e)??Promise.resolve(),i,r=new Promise(a=>{i=a}),n=t.then(()=>r);return Hr.set(e,n),await t,()=>{i(),Hr.get(e)===n&&Hr.delete(e)}}async function Vl(e,t,i){let r=V.resolve(e.locksDir),n=$l.getStore();if(n?.has(r))return i();let a=await lv(r);try{let o=await cv(e,t),s=new Map(n??[]);return s.set(r,o),await $l.run(s,async()=>{try{return await i()}finally{await Fl(o)}})}finally{a()}}async function li(e,t,i){return Vl(e,`acquire ${t}`,async()=>{let r=await $(e.runtimeDir,e.locksDir);await Q.mkdir(r,{recursive:!0});let n=await $(e.runtimeDir,V.join(r,tv(t))),a=Ll(i),o=await Ml(n,a);return{file:n,nativeRoot:e.runtimeDir,locksDir:r,owner:a,identity:o}})}async function ui(e){await Oe(e.file)&&await Vl({runtimeDir:e.nativeRoot,locksDir:e.locksDir},`release ${V.basename(e.file)}`,async()=>{let t=await Oe(e.file);if(!t)return;if(t.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!eo(t.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);let i=V.join(e.locksDir,Dl);await to(t,i)})}function uv(e){try{return process.kill(e,0),!0}catch(t){let i=t.code;return i==="ESRCH"?!1:i==="EPERM"?!0:null}}import{createHash as dv}from"node:crypto";import{constants as Dr,promises as R}from"node:fs";import _ from"node:path";function he(e,t){let i=_.relative(e,t);return i===""||!_.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${_.sep}`)}function ql(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native protected file byte limit must be a positive integer");return e}function Br(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Wl(e){return{dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs,ctimeMs:e.ctimeMs,mtimeMs:e.mtimeMs,size:e.size}}function mt(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function Ke(e,t){let i=await R.lstat(e);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${t} parent must be a real directory: ${e}`);return{path:e,realPath:await R.realpath(e),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function di(e,t,i){let r=_.resolve(e),n=_.resolve(t);if(!he(r,n))throw new Error(`${i} is outside its managed root`);let a=[await Ke(r,i)],o=r;for(let s of _.relative(r,n).split(_.sep).filter(Boolean)){await L(a,i),o=_.join(o,s);let c=await Ke(o,i);if(!he(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await L(a,i),a}async function L(e,t){for(let i of e){let r=await R.lstat(i.path);if(!r.isDirectory()||r.isSymbolicLink()||!Br(i,r)||await R.realpath(i.path)!==i.realPath)throw new Error(`${t} parent changed during I/O: ${i.path}`)}}async function fv(e,t,i){let r=[],n=0,a=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let o=t+1-n,{bytesRead:s}=await e.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(n+=s,n>t)throw new Error(`${i} exceeds ${t} bytes`);r.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(r,n)}async function J(e){let t=ql(e.maxBytes),i=_.resolve(e.file),r=await di(e.root,_.dirname(i),e.label),n=await Promise.all((e.forbiddenRoots??[]).map(d=>Ke(_.resolve(d),e.label)));await e.hooks?.afterParentChainCaptured?.(),await L(r,e.label);let a=await R.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);if(a.size>t)throw new Error(`${e.label} exceeds ${t} bytes`);let o=Wl(a),s=await R.realpath(i);if(!he(r[0].realPath,s))throw new Error(`${e.label} resolves outside its managed root`);if(n.some(d=>he(d.realPath,s)))throw new Error(`${e.label} resolves inside an excluded root`);let c=process.platform==="win32"?Dr.O_RDONLY:Dr.O_RDONLY|Dr.O_NOFOLLOW|Dr.O_NONBLOCK,l=await R.open(i,c);try{let d=await l.stat();await e.hooks?.afterOpen?.();let[u,f]=await Promise.all([R.lstat(i),R.realpath(i)]);if(await L(r,e.label),await L(n,e.label),!d.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!mt(o,d)||!mt(o,u))throw new Error(`${e.label} changed while opening`);await e.hooks?.beforeRead?.();let p=await fv(l,t,e.label);await e.hooks?.beforeFinalCheck?.();let[v,h,m]=await Promise.all([l.stat(),R.lstat(i),R.realpath(i)]);if(await L(r,e.label),await L(n,e.label),!h.isFile()||h.isSymbolicLink()||m!==s||!mt(o,v)||!mt(o,h))throw new Error(`${e.label} changed while reading`);return{bytes:p,hash:dv("sha256").update(p).digest("hex"),size:p.length}}finally{await l.close()}}async function Ye(e){let t=await di(e.root,e.directory,e.label),i;if(e.maxEntries===void 0)i=await R.readdir(e.directory,{withFileTypes:!0});else{let r=ql(e.maxEntries);i=[];let n=await R.opendir(e.directory);try{for await(let a of n)if(i.push(a),i.length>r)throw new Error(`${e.label} exceeds ${r} entries`)}finally{await n.close().catch(a=>{if(a.code!=="ERR_DIR_CLOSED")throw a})}}return await L(t,e.label),{entries:i,verify:()=>L(t,e.label)}}async function hv(e){let t=_.resolve(e.directory),i=_.resolve(e.quarantine);if(_.dirname(i)!==_.dirname(t)||!he(_.resolve(e.root),i)||i===t)throw new Error(`${e.label} quarantine must be a distinct sibling inside its root`);let r=await di(e.root,_.dirname(t),e.label),n=await Ke(t,e.label);if(!he(r[0].realPath,n.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeQuarantine?.(),await L(r,e.label);let a=await R.lstat(t);if(!a.isDirectory()||a.isSymbolicLink()||!Br(n,a)||await R.realpath(t)!==n.realPath)throw new Error(`${e.label} changed before quarantine`);try{throw await R.lstat(i),new Error(`${e.label} quarantine path is occupied`)}catch(s){if(s.code!=="ENOENT")throw s}await R.rename(t,i),await L(r,e.label);let o=await R.lstat(i);if(!o.isDirectory()||o.isSymbolicLink()||!Br(n,o))throw new Error(`${e.label} changed while quarantining`);await e.afterQuarantine?.(i);try{throw await R.lstat(t),new Error(`${e.label} path was recreated while quarantining`)}catch(s){if(s.code!=="ENOENT")throw s}return{quarantine:i,parentChain:r,identity:n}}async function zl(e){await hv(e)}async function io(e){let t=_.resolve(e.file),i=await di(e.root,_.dirname(t),e.label),r=await R.lstat(t);if(!r.isFile()||r.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);let n=Wl(r),a=await R.realpath(t);if(!he(i[0].realPath,a))throw new Error(`${e.label} resolves outside its managed root`);let o=await J({root:e.root,file:t,maxBytes:e.maxBytes,label:e.label});if(o.hash!==e.expectedHash||o.size!==e.expectedSize)throw new Error(`${e.label} changed before removal`);let[s,c]=await Promise.all([R.lstat(t),R.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!mt(n,s)||c!==a)throw new Error(`${e.label} changed while verifying removal`);await e.beforeRemove?.(),await L(i,e.label);let[l,d]=await Promise.all([R.lstat(t),R.realpath(t)]);if(!l.isFile()||l.isSymbolicLink()||!mt(n,l)||d!==a)throw new Error(`${e.label} changed before removal`);await R.rm(t),await L(i,e.label)}async function ro(e){let t=_.resolve(e.directory),i=await di(e.root,_.dirname(t),e.label),r=await Ke(t,e.label);if(!he(i[0].realPath,r.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeRemove?.(),await L(i,e.label);let n=await R.lstat(t);if(!n.isDirectory()||n.isSymbolicLink()||!Br(r,n)||await R.realpath(t)!==r.realPath)throw new Error(`${e.label} changed before removal`);await R.rmdir(t),await L(i,e.label)}async function fi(e){let t=_.resolve(e.root),i=_.resolve(e.directory);if(!he(t,i))throw new Error(`${e.label} is outside its managed root`);let r=[await Ke(t,e.label)],n=t;for(let a of _.relative(t,i).split(_.sep).filter(Boolean)){await L(r,e.label),n=_.join(n,a);try{await R.mkdir(n)}catch(s){if(s.code!=="EEXIST")throw s}let o=await Ke(n,e.label);if(!he(r[0].realPath,o.realPath))throw new Error(`${e.label} resolves outside its managed root: ${n}`);r.push(o)}await L(r,e.label)}async function hi(e){let t=await J({root:e.sourceRoot,file:e.source,maxBytes:e.maxBytes,label:e.label,hooks:e.hooks,forbiddenRoots:e.forbiddenRoots});if(e.expectedHash!==void 0&&t.hash!==e.expectedHash)throw new Error(`${e.label} content changed before copy`);await Al(e.target,t.bytes,{containedRoot:e.targetRoot,exclusive:e.exclusive,beforeCommit:async()=>{if(await e.hooks?.beforeTargetCommit?.(),e.expectedTargetHash===void 0)return;if(e.expectedTargetHash===null){try{await R.lstat(e.target)}catch(n){if(n.code==="ENOENT")return;throw n}throw new Error(`${e.label} target changed before commit`)}if((await J({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} existing target`})).hash!==e.expectedTargetHash)throw new Error(`${e.label} target changed before commit`)}});let i=await J({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} target`});if(i.hash!==t.hash||i.size!==t.size)throw new Error(`${e.label} target could not be verified`);return i}import{promises as Mr}from"fs";import ge from"path";import{TextDecoder as pv}from"util";var mv=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),vv=new Set(["id","type","source","target","staged","backup"]),gv=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),wv=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]),yv=new Set(["sequence","timestamp","type","operationId"]),Ul=new Set(["prepared","applying","committed","rolling-back","rolled-back"]),Kl=new Set(["prepared","operation-started","operation-completed","archive-finalization-started","archive-finalized","commit","rollback-started","rollback-completed"]),Nv=256*1024,bv=1024*1024,Yl=16*1024,Fr=1024,pb=64*1024*1024;var Xl=new pv("utf-8",{fatal:!0});function pi(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function mi(e,t,i){let r=Object.keys(e).filter(n=>!t.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function gt(e){if(typeof e!="string")return!1;let t=new Date(e);return!Number.isNaN(t.valueOf())&&t.toISOString()===e}function no(e,t){if(typeof e!="string"||e.length===0||ge.isAbsolute(e)||/^(?:[A-Za-z]:|~|[\\/])/u.test(e)||e.split(/[\\/]/u).includes(".."))throw new Error(`${t} must stay inside the Native root`)}function Lr(e,t){if(typeof e!="string"||!/^[a-f0-9]{64}$/u.test(e))throw new Error(`${t} must be a SHA-256 hash`)}function Jl(e,t){if(no(e,t),e.includes("\\")||e!==ge.posix.normalize(e)||e.split("/").includes(".")||e.endsWith("/")||Buffer.byteLength(e,"utf8")>1024)throw new Error(`${t} must be a normalized Native-relative ref`)}function kv(e,t){let i=pi(e,`transaction operations[${t}]`);if(mi(i,vv,`transaction operations[${t}]`),typeof i.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.id))throw new Error(`transaction operations[${t}].id is invalid`);if(i.type!=="write"&&i.type!=="remove"&&i.type!=="move")throw new Error(`transaction operation ${i.id} has an invalid type`);no(i.target,`transaction operation ${i.id} target`);for(let r of["source","staged","backup"])i[r]!==void 0&&no(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 Ql(e){let t=pi(e,"Native Archive transaction journal");if(mi(t,gv,"Native Archive transaction journal"),t.schema!=="comet.native.transaction.v2")throw new Error("Unsupported Native Archive transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native Archive transaction id is invalid");if(t.kind!=="archive")throw new Error("Native v2 transaction kind must be archive");if(typeof t.status!="string"||!Ul.has(t.status))throw new Error("Native Archive transaction status is invalid");if(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change))throw new Error("Native Archive transaction change name is invalid");if(!gt(t.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(Lr(t.preflightHash,"Native Archive transaction preflightHash"),!Array.isArray(t.operations)||t.operations.length>65)throw new Error("Native Archive transaction operations must be an array");let i=t.operations.map((s,c)=>{let l=pi(s,`Archive transaction operations[${c}]`);if(mi(l,wv,`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`);Jl(l.target,`Archive transaction operation ${l.id} target`);for(let d of["source","staged","backup"])l[d]!==void 0&&Jl(l[d],`Archive transaction operation ${l.id} ${d}`);if(l.expectedTargetHash!==null&&Lr(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(Lr(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`);Lr(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/${t.id}`,a=i.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${t.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${t.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:t.id,kind:"archive",status:t.status,change:t.change,createdAt:t.createdAt,preflightHash:t.preflightHash,operations:i}}function ao(e){let t=pi(e,"Native transaction journal");if(t.schema==="comet.native.transaction.v2")return Ql(t);if(mi(t,mv,"Native transaction journal"),t.schema!=="comet.native.transaction.v1")throw new Error("Unsupported Native transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native transaction id is invalid");if(t.kind!=="archive"&&t.kind!=="root-move")throw new Error("Native transaction kind is invalid");if(typeof t.status!="string"||!Ul.has(t.status))throw new Error("Native transaction status is invalid");if(typeof t.projectRoot!="string"||!ge.isAbsolute(t.projectRoot)||typeof t.nativeRoot!="string"||!ge.isAbsolute(t.nativeRoot))throw new Error("Native transaction roots must be absolute paths");if(t.change!==void 0&&(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change)))throw new Error("Native transaction change name is invalid");if(!gt(t.createdAt))throw new Error("Native transaction createdAt is invalid");if(!Array.isArray(t.operations))throw new Error("Native transaction operations must be an array");let i=t.operations.map(kv),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:t.id,kind:t.kind,status:t.status,projectRoot:t.projectRoot,nativeRoot:t.nativeRoot,...typeof t.change=="string"?{change:t.change}:{},createdAt:t.createdAt,operations:i}}function Zl(e,t){let i=pi(e,`Native transaction event at line ${t}`);if(mi(i,yv,`Native transaction event at line ${t}`),i.sequence!==t)throw new Error(`Native transaction event sequence at line ${t} must be ${t}`);if(!gt(i.timestamp))throw new Error(`Native transaction event timestamp at line ${t} is invalid`);if(typeof i.type!="string"||!Kl.has(i.type))throw new Error(`Native transaction event type at line ${t} is invalid`);let r=i.type==="operation-started"||i.type==="operation-completed";if(r&&(typeof i.operationId!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.operationId)||Buffer.byteLength(i.operationId,"utf8")>256)||!r&&i.operationId!==void 0)throw new Error(`Native transaction event operationId at line ${t} is invalid`);return{sequence:i.sequence,timestamp:i.timestamp,type:i.type,...typeof i.operationId=="string"?{operationId:i.operationId}:{}}}function Sv(e){if(e.length>24)return!1;let t="0000-00-00T00:00:00.000Z";for(let r=0;r<e.length;r+=1){let n=t[r],a=e[r];if(n==="0"){if(!/[0-9]/u.test(a))return!1}else if(a!==n)return!1}let i=[[5,2,1,12],[8,2,1,31],[11,2,0,23],[14,2,0,59],[17,2,0,59],[20,3,0,999]];for(let[r,n,a,o]of i){if(e.length<=r)continue;let s=e.slice(r,Math.min(r+n,e.length));if(!Array.from({length:o-a+1},(l,d)=>String(a+d).padStart(n,"0")).some(l=>l.startsWith(s)))return!1}return e.length>=10&&!gt(`${e.slice(0,10)}T00:00:00.000Z`)?!1:e.length<24||gt(e)}function vt(e,t){return e.length<t.length&&t.startsWith(e)}function Ev(e){let t='","operationId":"';if(vt(e,t))return!0;if(!e.startsWith(t))return!1;let i=e.slice(t.length),r=i.indexOf('"');if(r===-1)return i.length===0||/^[a-z0-9][a-z0-9-]*$/u.test(i);let n=i.slice(0,r);return/^[a-z0-9][a-z0-9-]*$/u.test(n)?vt(i.slice(r),'"}'):!1}function Pv(e,t){if(e.length===0||Buffer.byteLength(e,"utf8")>Yl)return!1;let i=`{"sequence":${t},"timestamp":"`;if(vt(e,i))return!0;if(!e.startsWith(i))return!1;let r=e.slice(i.length),n=r.slice(0,Math.min(24,r.length));if(!Sv(n))return!1;if(r.length<24)return!0;if(!gt(n))return!1;let a='","type":"',o=r.slice(24);if(vt(o,a))return!0;if(!o.startsWith(a))return!1;let s=o.slice(a.length);for(let c of Kl){if(vt(s,c))return!0;if(!s.startsWith(c))continue;let l=s.slice(c.length);if(c==="operation-started"||c==="operation-completed"){if(Ev(l))return!0}else if(vt(l,'"}'))return!0}return!1}function Rv(e,t){if(e.length===0)throw new Error("Blank transaction event line");if(Buffer.byteLength(e,"utf8")>Yl)throw new Error(`Native transaction event at line ${t} is too large`);return Zl(JSON.parse(e),t)}function xv(e){let t=e.split(`
166
+ `),i=t.at(-1)==="";if(i&&t.pop(),t.length>Fr)throw new Error(`Native transaction event log exceeds ${Fr} events`);let r=[];for(let n=0;n<t.length;n+=1){let a=n+1,o=t[n],s=o.endsWith("\r")?o.slice(0,-1):o,c=!i&&n===t.length-1;try{r.push(Rv(s,a))}catch(l){if(c){let d=!1;try{JSON.parse(s),d=!0}catch{}if(!d&&Pv(s,a))break}throw new Error(`Invalid Native transaction event at line ${a}`,{cause:l})}}return r}function eu(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
167
167
  `)}
168
- `}function ig(e,t){if(!/^[a-f0-9-]{8,}$/u.test(t))throw new Error(`Invalid Native transaction id: ${t}`);return ye.join(e.transactionsDir,t)}function er(e,t){let i=ig(e,t);return{directory:i,journal:ye.join(i,"transaction.json"),events:ye.join(i,"events.jsonl"),staged:ye.join(i,"staged"),backups:ye.join(i,"backups")}}async function Ye(e,t){let i=er(e,t);return await Promise.all(Object.values(i).map(n=>O(e.nativeRoot,n))),i}async function bu(e,t,i={}){let n=await Ye(e,t);try{await Qn.lstat(n.events)}catch(r){if(r.code==="ENOENT")return{exists:!1,hash:null,size:0,events:[],canonicalSource:"",needsRepair:!1};throw r}try{let r=await q({root:e.nativeRoot,file:n.events,maxBytes:Uv,label:`Native transaction event log ${t}`,hooks:i.hooks}),a;try{a=gu.decode(r.bytes)}catch(c){throw new Error(`Native transaction event log ${t} is not valid UTF-8`,{cause:c})}let o=tg(a),s=Nu(o);return{exists:!0,hash:r.hash,size:r.size,events:o,canonicalSource:s,needsRepair:a!==s}}catch(r){throw r.code==="ENOENT"?new Error(`Native transaction event log ${t} changed while reading`,{cause:r}):r}}async function hu(e,t,i){let n=await bu(e,t);if(n.exists!==i.exists||n.hash!==i.hash||n.size!==i.size)throw new Error(`Native transaction event log ${t} changed before append`)}async function No(e,t,i,n){let r=await Ye(e,t),a=await bu(e,t),o=a.events.find(c=>c.type===i&&c.operationId===n);if(o)return a.needsRepair&&await he(r.events,a.canonicalSource,{containedRoot:e.nativeRoot,beforeCommit:()=>hu(e,t,a)}),o;if(a.events.length>=Zn)throw new Error(`Native transaction event log ${t} exceeds ${Zn} events`);let s={sequence:a.events.length+1,timestamp:new Date().toISOString(),type:i,...n?{operationId:n}:{}};return yu(s,s.sequence),await Qn.mkdir(r.directory,{recursive:!0}),await he(r.events,Nu([...a.events,s]),{containedRoot:e.nativeRoot,beforeCommit:()=>hu(e,t,a)}),s}async function ku(e,t){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");t=yo(t);let i=await Ye(e,t.id);await Qn.mkdir(i.staged,{recursive:!0}),await Qn.mkdir(i.backups,{recursive:!0}),await oe(i.journal,t),await No(e,t.id,"prepared")}async function Ei(e,t,i={}){let n=await Ye(e,t),r=await q({root:e.nativeRoot,file:n.journal,maxBytes:Kv,label:`Native transaction journal ${t}`,hooks:i.hooks}),a=JSON.parse(gu.decode(r.bytes)),o=yo(a);if(o.id!==t)throw new Error(`Invalid Native transaction journal: ${t}`);return o}async function ng(e,t,i){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");let n=yo({...t,status:i});return await oe((await Ye(e,t.id)).journal,n),n}async function bo(e,t,i){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");return await No(e,t.id,i),i==="commit"?ng(e,t,"committed"):t}import ir from"path";import{createHash as rg}from"crypto";function Z(e){return rg("sha256").update(e).digest("hex")}var Sk={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},og=1e3,sg=8*1024*1024,cg=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,lg=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),ug=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),fg=new Set(["schema","include","exclude","hash"]),dg=new Set(["provider","gitSelection","physicalSelection","projection"]),hg=new Set(["provider","selection"]),pg=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),mg=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),vg=new Set(["schema","status","before","after"]),gg=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),wg=new Set(["path","hash","size","type","gitObjectId"]),yg=new Set(["path","size","type","reason"]),Ng=new Set(["ref","hash","count"]),bg=new Set(["change-created","legacy-migration","explicit"]),kg=new Set(["file","directory","other"]),Sg=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"]),nr=/^[a-f0-9]{64}$/u,Eg=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var Ek=64*1024,Rk=64*1024;var Ck={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},Pk={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function tr(e,t){return e.hash===t.hash&&e.recordCount===t.recordCount&&e.storedRecordCount===t.storedRecordCount&&e.stdoutBytes===t.stdoutBytes&&e.overflow===t.overflow}var Ak=(1n<<256n)-1n;function Rg(e,t){return e.hash===t.hash&&e.visitedNodeCount===t.visitedNodeCount&&e.recordCount===t.recordCount&&e.storedRecordCount===t.storedRecordCount&&e.encodedBytes===t.encodedBytes&&e.overflow===t.overflow&&e.unstable===t.unstable}function Cg(e){return Buffer.byteLength(JSON.stringify(e,null,2)+`
169
- `)}function Pg(e,t){return Z(`comet.native.snapshot-policy.v1
170
- ${JSON.stringify({include:e,exclude:t,hash:"sha256"})}`)}function ko(e,t,i){let n=new Set(t),r=[...t];for(;r.length>0;){if(i&&!i())return null;let a=r.pop(),o=e[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 Ag(e){let t=0;return()=>t>0?(t-=1,!0):e()?(t=63,!0):!1}function Eu(e){let t=zn(e,"Native snapshot pattern"),i=[];for(let n=0;n<t.length;n+=1){let r=t[n];r==="*"&&t[n+1]==="*"?(n+=1,t[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?Ag(r):void 0;if(a&&!a())return!1;let o=ko(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 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=ko(i,c,a),o===null||o.size===0)return!1}return ko(i,o,a)?.has(i.length)??!1}}function xg(e){if(e===void 0)return;let t=[...new Set(e.include.map(r=>zn(r,"include")))].sort((r,a)=>r.localeCompare(a,"en")),i=[...new Set(e.exclude.map(r=>zn(r,"exclude")))].sort((r,a)=>r.localeCompare(a,"en"));if(t.length===0)throw new Error("Native snapshot policy include must not be empty");let n=Pg(t,i);if("hash"in e&&e.hash!==n)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:t,exclude:i,hash:n},includeMatchers:t.map(Eu),excludeMatchers:i.map(Eu),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 ee(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function te(e,t,i){let n=Object.keys(e).find(r=>!t.has(r));if(n)throw new Error(`${i} contains unknown field: ${n}`)}function Et(e,t){if(!Number.isSafeInteger(e)||e<1)throw new Error(`${t} must be a positive integer`);return e}function me(e,t){if(!Number.isSafeInteger(e)||e<0)throw new Error(`${t} must be a non-negative integer`);return e}function Pu(e,t){if(typeof e!="string"||e.length===0||e.includes("\\")||e.includes("\0"))throw new Error(`${t} must be a normalized project-relative path`);let i=ir.posix.normalize(e);if(i!==e||ir.posix.isAbsolute(e)||i===".."||i.startsWith("../"))throw new Error(`${t} must stay inside the project root`);return e}function Tg(e,t){let i=ee(e,`Native snapshot entry ${t}`);te(i,wg,`Native snapshot entry ${t}`);let n=Pu(i.path,`Native snapshot entry ${t} path`);if(typeof i.hash!="string"||!nr.test(i.hash))throw new Error(`Native snapshot entry ${t} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${t} type is invalid`);let r={path:n,hash:i.hash,size:me(i.size,`Native snapshot entry ${t} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!Eg.test(i.gitObjectId))throw new Error(`Native snapshot entry ${t} gitObjectId is invalid`);r.gitObjectId=i.gitObjectId}return r}function _g(e,t){let i=ee(e,`Native snapshot omission ${t}`);if(te(i,yg,`Native snapshot omission ${t}`),!kg.has(i.type))throw new Error(`Native snapshot omission ${t} type is invalid`);if(!Sg.has(i.reason))throw new Error(`Native snapshot omission ${t} reason is invalid`);return{path:Pu(i.path,`Native snapshot omission ${t} path`),size:i.size===null?null:me(i.size,`Native snapshot omission ${t} size`),type:i.type,reason:i.reason}}function Ig(e){let t=ee(e,"Native snapshot omission overflow");if(te(t,Ng,"Native snapshot omission overflow"),typeof t.hash!="string"||!nr.test(t.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${t.hash}`;if(t.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:t.hash,count:Et(t.count,"Native snapshot omission overflow count")}}function St(e,t){let i=ee(e,t);if(te(i,mg,t),typeof i.hash!="string"||!nr.test(i.hash))throw new Error(`${t} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${t} overflow flag is invalid`);let n=me(i.recordCount,`${t} recordCount`),r=me(i.storedRecordCount,`${t} storedRecordCount`),a=me(i.stdoutBytes,`${t} stdoutBytes`);if(r>n||!i.overflow&&r!==n)throw new Error(`${t} stored record count is inconsistent`);return{hash:i.hash,recordCount:n,storedRecordCount:r,stdoutBytes:a,overflow:i.overflow}}function Ru(e){let t=ee(e,"Native Git selection evidence");if(te(t,pg,"Native Git selection evidence"),t.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(t.status!=="overflow"&&t.status!=="changed"&&t.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=St(t.stageBefore,"Native Git selection stageBefore"),n=St(t.combined,"Native Git selection combined"),r=St(t.stageAfter,"Native Git selection stageAfter"),a=St(t.finalStageBefore,"Native Git selection finalStageBefore"),o=St(t.finalCombined,"Native Git selection finalCombined"),s=St(t.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,n,r,a,o,s].some(f=>f.overflow),l=!tr(i,r)||!tr(r,a)||!tr(n,o)||!tr(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(t.status!==u)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:u,stageBefore:i,combined:n,stageAfter:r,finalStageBefore:a,finalCombined:o,finalStageAfter:s}}function Cu(e,t){let i=ee(e,t);if(te(i,gg,t),typeof i.hash!="string"||!nr.test(i.hash))throw new Error(`${t} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${t} flags are invalid`);let n=me(i.visitedNodeCount,`${t} visitedNodeCount`),r=me(i.recordCount,`${t} recordCount`),a=me(i.storedRecordCount,`${t} storedRecordCount`),o=me(i.encodedBytes,`${t} encodedBytes`);if(a>r||!i.overflow&&a!==r)throw new Error(`${t} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:n,recordCount:r,storedRecordCount:a,encodedBytes:o,overflow:i.overflow,unstable:i.unstable}}function jg(e){let t=ee(e,"Native physical selection evidence");if(te(t,vg,"Native physical selection evidence"),t.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(t.status!=="overflow"&&t.status!=="changed"&&t.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=Cu(t.before,"Native physical selection before"),n=Cu(t.after,"Native physical selection after"),r=i.overflow||n.overflow,a=i.unstable||n.unstable||!Rg(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(t.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 Au(e){let t=ee(e,"Native content snapshot manifest");if(te(t,lg,"Native content snapshot manifest"),t.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!bg.has(t.origin))throw new Error("Native content snapshot origin is invalid");let i;if(t.capture!==void 0){let v=ee(t.capture,"Native content snapshot capture");if(te(v,dg,"Native content snapshot capture"),v.provider!=="git"&&v.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let C=v.gitSelection===void 0?void 0:Ru(v.gitSelection),b=v.physicalSelection===void 0?void 0:jg(v.physicalSelection),_=null;if(v.projection!==void 0){let z=ee(v.projection,"Native content snapshot projection");if(te(z,hg,"Native content snapshot projection"),z.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");_={provider:"git",...z.selection===void 0?{}:{selection:Ru(z.selection)}}}if(v.provider==="git"){if(b||_)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...C?{gitSelection:C}:{}}}else{if(C)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(b&&_)throw new Error("Native physical-tree capture cannot combine selection and projection");i=_?{provider:"physical-tree",projection:_}:{provider:"physical-tree",...b?{physicalSelection:b}:{}}}}if(typeof t.createdAt!="string"||Number.isNaN(Date.parse(t.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof t.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let n=ee(t.limits,"Native content snapshot limits");te(n,ug,"Native content snapshot limits");let r={maxFiles:Et(n.maxFiles,"Native snapshot maxFiles"),maxFileBytes:Et(n.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:Et(n.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:Et(n.maxManifestBytes,"Native snapshot maxManifestBytes"),...n.maxDurationMs===void 0?{}:{maxDurationMs:Et(n.maxDurationMs,"Native snapshot maxDurationMs")}},a;if(t.policy!==void 0){let v=ee(t.policy,"Native snapshot policy");if(te(v,fg,"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=xg({include:v.include,exclude:v.exclude,hash:v.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(t.entries)||!Array.isArray(t.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let o=t.entries.map(Tg),s=t.omitted.map(_g),c=me(t.omittedCount,"Native content snapshot omittedCount"),l=t.omissionOverflow===void 0?void 0:Ig(t.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,C)=>v+C.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>og||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(t.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let f=s.filter(v=>v.reason==="git-enumeration-limit"),d=s.filter(v=>v.reason==="git-selection-changed");for(let v of[...f,...d])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native Git selection omission must use the project-root sentinel");if(f.length>1||d.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!==(f.length===1))throw new Error("Native Git enumeration omission and selection evidence are inconsistent");if(h!==(d.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:t.origin,...i?{capture:i}:{},createdAt:t.createdAt,complete:t.complete,limits:r,...a?{policy:a}:{},entries:o,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(Cg(E)>r.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function Og(e,t){if(!cg.test(t))throw new Error(`Invalid Native change name: ${t}`);let i=ir.join(e.changesDir,t);if(!K(e.changesDir,i))throw new Error("Native change path escaped");return ir.join(i,"runtime","baseline-manifest.json")}async function xu(e,t){let i=Og(e,t);await O(e.nativeRoot,i);try{let n=await uu({root:e.nativeRoot,file:i,maxBytes:sg,label:"Native baseline snapshot manifest"});return Au(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}var Dg=wr(In(),1);var xS=256*1024;var qS={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 Wg}from"node:crypto";import{promises as ar}from"node:fs";import $e from"node:path";import{execFileSync as qg}from"child_process";import rr from"path";function So(e,t){return qg("git",["-C",e,...t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function Vg(e,t){let i=rr.normalize(e),n=rr.normalize(t);return process.platform==="win32"?i.toLowerCase()===n.toLowerCase():i===n}function _u(e){try{let t=rr.resolve(So(e,["rev-parse","--show-toplevel"])),n=So(e,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),r=n?rr.resolve(n.slice(9)):t,a=null;try{a=So(e,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!Vg(t,r),currentWorktreeRoot:t,primaryWorktreeRoot:r,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}var Ri=/^[a-f0-9]{64}$/u,zg=16*1024,Eo=process.platform;function $u(e,t){let i=$e.relative(e,t);return $e.isAbsolute(i)||i===".."||i.startsWith(`..${$e.sep}`)?null:i.replaceAll("\\","/")||"."}function Hu(e){return Array.from(e).some(t=>{let i=t.codePointAt(0)??0;return i<=31||i===127})}function Mu(e,t){if(e.length===0||Hu(e)||e.includes("\\")||$e.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes(".."))throw new Error(`${t} must be a portable project-relative path`);let i=$e.posix.normalize(e);if(i!==e||i===".."||i.startsWith("../"))throw new Error(`${t} must be a normalized project-relative path`);return i}function Ro(e,t){return Wg("sha256").update(`${e}
171
- ${t}`).digest("hex")}async function Iu(e,t){let i=await ar.realpath(t),n=await ar.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let r=Eo==="win32"?$e.normalize(i).toLowerCase():i;return Ro(e,`${r}
172
- ${n.dev}
173
- ${n.ino}
174
- ${n.birthtimeMs}`)}async function ju(e,t){let i=await ar.realpath(t),n=await ar.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let r=Eo==="win32"?$e.normalize(i).toLowerCase():i;return Ro(e,r)}function Jg(e){if(typeof e!="string")throw new Error("Native workspace capturedAt is invalid");let t=new Date(e);if(!Number.isFinite(t.getTime())||t.toISOString()!==e)throw new Error("Native workspace capturedAt is invalid");return e}function Ou(e,t){if(e===null)return null;if(typeof e!="string"||e.length===0||e.trim()!==e||Hu(e))throw new Error(`${t} must be a non-empty branch name or null`);return e}function Fu(e){if(!new Set(["current","branch","worktree"]).has(e.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(Ou(e.changeBranch,"Native workspace change branch"),Ou(e.targetBranch,"Native workspace target branch"),(e.isolation==="branch"||e.isolation==="worktree")&&(e.changeBranch===null||e.targetBranch===null))throw new Error("Native isolated workspace requires change and target branches")}function or(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace identity must be an object");let t=e,i=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","isolation","changeBranch","targetBranch","finish"]),n=Object.keys(t).filter(o=>!i.has(o));if(n.length>0)throw new Error(`Native workspace identity has unknown field(s): ${n.join(", ")}`);if(t.schema!=="comet.native.workspace.v2"&&t.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(t.capturedRevision)||t.capturedRevision<1||typeof t.nativeRootRef!="string"||!Ri.test(String(t.projectRootId))||!Ri.test(String(t.nativeRootId)))throw new Error("Native workspace identity is invalid");Jg(t.capturedAt),Mu(t.nativeRootRef,"Native workspace root ref");let r=t.projectRootPathId!==void 0,a=t.nativeRootPathId!==void 0;if(r!==a)throw new Error("Native workspace path identities must be provided together");if(r&&!Ri.test(String(t.projectRootPathId))||a&&!Ri.test(String(t.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(t.sessionHash!==void 0&&!Ri.test(String(t.sessionHash)))throw new Error("Native workspace session hash is invalid");if(t.schema==="comet.native.workspace.v2"){if(t.isolation!==void 0||t.changeBranch!==void 0||t.targetBranch!==void 0||t.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof t.isolation!="string"||t.changeBranch===void 0||t.targetBranch===void 0||t.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(Fu(t),t.finish!==null&&!new Set(["merge","push","pull-request","keep"]).has(t.finish))throw new Error("Native workspace finish must be merge, push, pull-request, keep, or null")}function Lu(e,t){return $e.join(e.changesDir,t,"runtime","workspace.json")}function Gg(e,t){let i=$u(e.nativeRoot,Lu(e,t));if(!i||i===".")throw new Error("Native workspace file escaped its root");return Mu(i,"Native workspace file ref")}async function Kg(e,t){try{let i=await je({root:e.nativeRoot,ref:Gg(e,t),maxBytes:zg});return JSON.parse(i.text)}catch(i){if(i.code==="ENOENT")return null;throw i}}async function Du(e){if(!Number.isSafeInteger(e.revision)||e.revision<1)throw new Error("Native workspace revision must be a positive integer");let t=$u(e.paths.projectRoot,e.paths.nativeRoot);if(!t)throw new Error("Native root is outside the project root");let[i,n,r,a]=await Promise.all([Iu("comet.native.workspace-project-root.v2",e.paths.projectRoot),Iu("comet.native.workspace-native-root.v2",e.paths.nativeRoot),ju("comet.native.workspace-project-root-path.v2",e.paths.projectRoot),ju("comet.native.workspace-native-root-path.v2",e.paths.nativeRoot)]),o=(e.now??new Date).toISOString();if(e.finish&&!e.binding)throw new Error("Native workspace finish requires a workspace binding");e.binding&&Fu(e.binding);let s={capturedAt:o,capturedRevision:e.revision,nativeRootRef:t,projectRootId:i,nativeRootId:n,projectRootPathId:r,nativeRootPathId:a,...e.sessionId?{sessionHash:Ro("comet.native.workspace-session.v2",`${i}
175
- ${n}
176
- ${e.sessionId}`)}:{}},c=e.binding?{schema:"comet.native.workspace.v3",...s,...e.binding,finish:e.finish??null}:{schema:"comet.native.workspace.v2",...s};return or(c),c}async function sr(e){let t=await Du(e),i=Lu(e.paths,e.name);return await O(e.paths.nativeRoot,i),await oe(i,t,{containedRoot:e.paths.nativeRoot}),t}async function Rt(e,t){let i=await Kg(e,t);return i===null||i&&typeof i=="object"&&!Array.isArray(i)&&i.schema==="comet.native.workspace.v1"?null:(or(i),i)}async function cr(e){or(e.identity);let t=await Du({paths:e.paths,name:"workspace-advisory",revision:e.identity.capturedRevision}),i=[],n=[];return t.nativeRootRef!==e.identity.nativeRootRef&&i.push("native-root-ref"),e.identity.projectRootPathId&&e.identity.nativeRootPathId?(t.projectRootPathId!==e.identity.projectRootPathId&&i.push("project-root-path"),t.nativeRootPathId!==e.identity.nativeRootPathId&&i.push("native-root-path")):(t.projectRootId!==e.identity.projectRootId&&i.push("project-root-legacy-identity"),t.nativeRootId!==e.identity.nativeRootId&&i.push("native-root-legacy-identity")),Eo==="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 Co(e){if(or(e.identity),e.identity.schema==="comet.native.workspace.v2")return{state:"legacy",code:"workspace-binding-legacy",message:"Legacy Native workspace metadata has no isolation binding"};if((await cr(e)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let i=_u(e.paths.projectRoot);return e.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!==e.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${e.identity.changeBranch}, but the current branch is ${i.currentBranch??"detached HEAD"}`}:e.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"}}var Qe="comet.native.v3",Ze="comet.native.v2",et="comet.native.v1";var Bu=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],Xg=new Set(Bu),qu=new Set([...Bu,"minimum_runtime_version","revision"]),Qg=new Set([...qu,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),Zg=new Set(["capability","operation","source","base_hash"]),ew=new Set(["shape","build","verify","archive"]),tw=new Set(["implicit","confirmed"]),iw=new Set(["pending","pass","fail"]),it="comet-state.yaml",Ao=/^[a-f0-9]{64}$/u,Vu=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,nw=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,xo=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"},Ct=class extends Error{constructor(i,n){super(i!==Qe||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"},lr=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"},ur=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"},fr=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"},TE=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
177
- `);function Pi(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function Wu(e,t,i){let n=Object.keys(e).filter(r=>!t.has(r));if(n.length>0)throw new Error(`${i} has unknown field(s): ${n.join(", ")}`)}function _o(e){if(!Vu.test(e))throw new Error(`Invalid Native change name: ${e}`)}function rw(e){if(!Vu.test(e))throw new Error(`Invalid Native capability id: ${e}`)}function zu(e,t){if(e.length===0||tt.isAbsolute(e)||/^(?:[A-Za-z]:|~|[\\/])/u.test(e)||e.split(/[\\/]/u).includes(".."))throw new Error(`${t} must stay inside the Native change`)}function aw(e,t){let i=Pi(e,`spec_changes[${t}]`);if(Wu(i,Zg,`spec_changes[${t}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(rw(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"&&zu(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"||!Ao.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"||!Ao.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 ow(e){return/^\d{4}-\d{2}-\d{2}$/u.test(e)?new Date(`${e}T00:00:00.000Z`).toISOString().slice(0,10)===e:!1}function Io(e,t){if(Wu(e,t,it),typeof e.name!="string")throw new Error("Native change name is required");if(_o(e.name),e.language!=="en"&&e.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof e.phase!="string"||!ew.has(e.phase))throw new Error("Native change phase is invalid");if(e.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(e.approval!==null&&!tw.has(e.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(e.spec_changes))throw new Error("Native spec_changes must be an array");let i=e.spec_changes.map(aw),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 e.verification_result!="string"||!iw.has(e.verification_result))throw new Error("Native verification_result is invalid");if(e.verification_report!==null&&typeof e.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof e.verification_report=="string"&&zu(e.verification_report,"Native verification_report"),typeof e.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof e.created_at!="string"||!ow(e.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(e.run_id!==null&&(typeof e.run_id!="string"||e.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:e.name,language:e.language,phase:e.phase,brief:"brief.md",approval:e.approval,spec_changes:i,verification_result:e.verification_result,verification_report:e.verification_report,archived:e.archived,created_at:e.created_at,run_id:e.run_id}}function jo(e){let t=Pi(e,it);if(t.schema!==et)throw new Error(`Expected ${et}`);return{schema:et,...Io(t,Xg)}}function Ci(e,t){if(!Number.isSafeInteger(e)||e<1)throw new Error(`${t} must be a positive integer`);return e}function Po(e,t,i){if(e===null)return null;let n=typeof e=="string"?nw.exec(e):null;if(!n||n[1]!==i)throw new Error(`${t} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return e}function sw(e){if(e==null)return null;if(typeof e!="string"||!Ao.test(e))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return e}function cw(e){if(e===void 0)return"legacy-v1";if(e!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return e}function Oo(e){let t=Pi(e,it);if(t.schema!==Ze)throw new Error(`Expected ${Ze}`);if(Ci(t.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${Ze} minimum_runtime_version must be 2`);return{schema:Ze,minimum_runtime_version:2,revision:Ci(t.revision,"Native v2 revision"),...Io(t,qu)}}function $o(e){let t=Pi(e,it);if(t.schema!==Qe){if(t.schema===et||t.schema===Ze){let o=t.schema===et?jo(t):Oo(t);throw new xo(o.name,o.schema)}throw new Ct(typeof t.schema=="string"?t.schema:"(missing)",typeof t.minimum_runtime_version=="number"?t.minimum_runtime_version:null)}let i=Ci(t.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new Ct(t.schema,i);if(i!==3)throw new Error(`Native ${t.schema} minimum_runtime_version must be ${3}`);let n=Ci(t.revision,"Native revision"),r=Io(t,Qg),a=sw(t.approved_contract_hash);if(r.approval===null&&a!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:Qe,minimum_runtime_version:3,revision:n,verification_protocol:cw(t.verification_protocol),...r,approved_contract_hash:a,implementation_scope:Po(t.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:Po(t.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:Po(t.partial_allowance,"Native partial_allowance","allowances")}}function lw(e){let t=Pi(e,it);if(t.schema===et){let r=jo(t);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:1,state:r,message:`Native change ${r.name} requires migration to ${Qe}`}}if(t.schema===Ze){let r=Oo(t);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r,message:`Native change ${r.name} requires migration to ${Qe}`}}if(t.schema!==Qe){let r=typeof t.minimum_runtime_version=="number"&&Number.isSafeInteger(t.minimum_runtime_version)?t.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof t.schema=="string"?t.schema:"(missing)",minimumRuntimeVersion:r,state:null,message:new Ct(typeof t.schema=="string"?t.schema:"(missing)",r).message}}let i=Ci(t.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:t.schema,minimumRuntimeVersion:i,state:null,message:new Ct(t.schema,i).message};let n=$o(t);return{status:"current",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n}}function ce(e,t){_o(t);let i=tt.join(e.changesDir,t);if(!K(e.changesDir,i))throw new Error("Native change path escaped");return i}async function Ho(e,t){let i=tt.join(ce(e,t),"runtime","schema-migration.json");await O(e.nativeRoot,i);try{return await Yg.lstat(i),!0}catch(n){if(n.code==="ENOENT")return!1;throw n}}var uw=256*1024;async function fw(e,t=tt.dirname(e)){let i=tt.relative(t,e).split(tt.sep).join("/"),n=await je({root:t,ref:i,maxBytes:uw}),r=(0,To.parseDocument)(n.text,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid Native change file ${e}: ${r.errors[0].message}`);return r.toJS()}async function Ju(e,t){let i=tt.join(ce(e,t),it);await O(e.nativeRoot,i);let n=lw(await fw(i,e.nativeRoot));if(n.state&&n.state.name!==t)throw new Error(`Native change directory/name mismatch: ${t}`);return await Ho(e,t)?{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimumRuntimeVersion,state:n.state,message:`Native schema migration is incomplete for ${t}; run doctor --repair`}:(n.status==="current"&&n.state&&await dw(e,n.state),n)}async function dw(e,t){if(await xu(e,t.name)!==null&&t.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${t.verification_protocol}`)}var Fo=64*1024*1024,VE=256*1024,Yu=16*1024*1024;async function U(e){try{return await Me.access(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function vw(e){let t;try{t=await Me.readdir(e.transactionsDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t){if(!i.isDirectory()||i.isSymbolicLink())continue;let n;try{n=await Ei(e,i.name)}catch(r){throw r.code==="ENOENT"?new Error(`Native transaction ${i.name} has no journal; run doctor before moving`,{cause:r}):r}if(n.status!=="committed"&&n.status!=="rolled-back")throw new Error(`Native transaction ${n.id} is unfinished; recover it before moving`)}}async function gw(e,t){for(let i of await Me.readdir(e.locksDir,{withFileTypes:!0})){let n=j.join(e.locksDir,i.name);if(j.resolve(n)!==j.resolve(t)&&(i.isFile()||i.isSymbolicLink()))throw new Error(`Native lock must be diagnosed before moving the root: ${n}`)}}async function ww(e){let t;try{t=await Me.readdir(e.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t.sort((n,r)=>n.name.localeCompare(r.name))){if(!i.isDirectory()||i.isSymbolicLink())continue;let n=await Rt(e,i.name);if(n){await sr({paths:e,name:i.name,revision:n.capturedRevision,...n.schema==="comet.native.workspace.v3"?{binding:{isolation:n.isolation,changeBranch:n.changeBranch,targetBranch:n.targetBranch},...n.finish?{finish:n.finish}:{}}:{}});continue}let r;try{r=await Ju(e,i.name)}catch{continue}r.status!=="current"||!r.state||!("revision"in r.state)||await sr({paths:e,name:i.name,revision:r.state.revision})}}async function yw(e){let t;try{t=await Me.readdir(e.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t.sort((n,r)=>n.name.localeCompare(r.name)))if(!(!i.isDirectory()||i.isSymbolicLink()))try{let n=await Rt(e,i.name);if(n?.schema==="comet.native.workspace.v3"){let r=await Co({paths:e,identity:n});if(r.state!=="aligned")throw new Error(r.message??"workspace binding is not aligned")}else if(n){let r=await cr({paths:e,identity:n});if(r.state!=="aligned")throw new Error(`legacy workspace ownership is ${r.state}`)}}catch(n){throw new Error(`Native workspace identity for ${i.name} must be aligned and repaired before moving the root`,{cause:n})}}async function xi(e,t){let i=[];async function n(r){let a=await Ue({root:e,directory:r,label:"Native root tree"}),o=a.entries;o.sort((s,c)=>s.name.localeCompare(c.name));for(let s of o){await a.verify();let c=j.join(r,s.name);if(t.excludedFiles?.has(j.resolve(c))){await a.verify();continue}let l=await Me.lstat(c);if(s.isSymbolicLink()||l.isSymbolicLink()){if(t.rejectSymlinks)throw new Error(`Native root contains a symlink: ${c}`);await a.verify();continue}if(s.isDirectory()&&l.isDirectory())i.push({ref:j.relative(e,c).split(j.sep).join("/"),type:"directory"}),await n(c);else if(s.isFile()&&l.isFile()){let u=await q({root:e,file:c,maxBytes:Fo,label:`Native root file ${j.relative(e,c)}`});i.push({ref:j.relative(e,c).split(j.sep).join("/"),type:"file",size:u.size,hash:u.hash})}else throw new Error(`Native root contains an unsupported file type: ${c}`);await a.verify()}}return await n(e),i.sort((r,a)=>r.ref.localeCompare(a.ref))}async function Nw(e,t,i,n){await Ni({root:n,directory:t,label:"Native root move staging directory"});async function r(a,o){let s=await Ue({root:e,directory:a,label:"Native root move source directory"}),c=s.entries;for(let l of c){await s.verify();let u=j.join(a,l.name);if(j.resolve(u)===j.resolve(i)){await s.verify();continue}let f=await Me.lstat(u);if(l.isSymbolicLink()||f.isSymbolicLink())throw new Error(`Native root contains a symlink: ${u}`);let d=j.join(o,l.name);if(l.isDirectory()&&f.isDirectory())await Ni({root:n,directory:d,label:"Native root move staging directory"}),await r(u,d);else if(l.isFile()&&f.isFile())await bi({sourceRoot:e,source:u,targetRoot:n,target:d,maxBytes:Fo,label:`Native root move file ${j.relative(e,u)}`,exclusive:!0,expectedTargetHash:null});else throw new Error(`Native root contains an unsupported file type: ${u}`);await s.verify()}}await r(e,t)}async function dr(e,t,i,n){let r=await xi(e,{rejectSymlinks:!0,excludedFiles:i?new Set([j.resolve(i)]):void 0}),a=await xi(t,{rejectSymlinks:!0,excludedFiles:n?new Set([j.resolve(n)]):void 0});if(JSON.stringify(r)!==JSON.stringify(a))throw new Error(`Native root copies differ; preserve both trees for manual recovery: ${e} and ${t}`)}function bw(e,t){return j.join(e.artifactRoot,`.comet-native-move-${t}`)}function kw(e,t){return j.join(e.artifactRoot,`.comet-native-source-${t}.removing`)}function Sw(e){return`${e}.removing`}function Xu(e,t,i){return j.join(er(e,t).directory,`root-move-cleanup-${i}.json`)}function Ew(e){return JSON.stringify(e,null,2)+`
178
- `}function Rw(e){return pw("sha256").update(e).digest("hex")}function Cw(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Native root-move cleanup manifest entry ${t} must be an object`);let i=e,n=Object.keys(i).sort(),r=i.type==="file"?["hash","ref","size","type"]:["ref","type"];if(JSON.stringify(n)!==JSON.stringify(r))throw new Error(`Native root-move cleanup manifest entry ${t} has invalid fields`);if(typeof i.ref!="string"||i.ref.length===0||i.ref.includes("\\")||j.posix.normalize(i.ref)!==i.ref||i.ref.startsWith("/")||i.ref.split("/").includes("..")||Buffer.byteLength(i.ref,"utf8")>4096)throw new Error(`Native root-move cleanup manifest entry ${t} has an invalid ref`);if(i.type==="directory")return{ref:i.ref,type:"directory"};if(i.type!=="file"||typeof i.size!="number"||!Number.isSafeInteger(i.size)||i.size<0||typeof i.hash!="string"||!/^[a-f0-9]{64}$/u.test(i.hash))throw new Error(`Native root-move cleanup manifest entry ${t} is invalid`);return{ref:i.ref,type:"file",size:i.size,hash:i.hash}}function Pw(e,t,i){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native root-move cleanup manifest must be an object");let n=e;if(JSON.stringify(Object.keys(n).sort())!==JSON.stringify(["entries","kind","schema","transactionId"])||n.schema!=="comet.native.root-move-cleanup.v1"||n.transactionId!==t||n.kind!==i||!Array.isArray(n.entries))throw new Error("Native root-move cleanup manifest binding is invalid");let r=n.entries.map(Cw);for(let a=0;a<r.length;a+=1){if(a>0&&r[a-1].ref.localeCompare(r[a].ref)>=0)throw new Error("Native root-move cleanup manifest refs must be unique and sorted");let o=j.posix.dirname(r[a].ref);if(o!=="."&&!r.some(s=>s.ref===o&&s.type==="directory"))throw new Error(`Native root-move cleanup manifest parent is missing: ${o}`)}return{schema:"comet.native.root-move-cleanup.v1",transactionId:t,kind:i,entries:r}}async function Aw(e){let t={schema:"comet.native.root-move-cleanup.v1",transactionId:e.id,kind:e.kind,entries:e.entries},i=Ew(t);if(Buffer.byteLength(i,"utf8")>Yu)throw new Error("Native root-move cleanup manifest exceeds its byte budget");return await he(Xu(e.paths,e.id,e.kind),i,{containedRoot:e.paths.nativeRoot}),Rw(i)}async function xw(e){let t=await q({root:e.paths.nativeRoot,file:Xu(e.paths,e.id,e.cleanup.kind),maxBytes:Yu,label:`Native root-move cleanup manifest ${e.cleanup.kind}`});if(t.hash!==e.cleanup.manifestHash)throw new Error("Native root-move cleanup manifest hash changed");return Pw(JSON.parse(t.bytes.toString("utf8")),e.id,e.cleanup.kind)}async function Mo(e){let t=await xi(e.quarantine,{rejectSymlinks:!0}),i=new Map(e.manifest.entries.map(n=>[n.ref,n]));for(let n of t){let r=i.get(n.ref);if(!r||JSON.stringify(r)!==JSON.stringify(n))throw new Error(`Native root-move cleanup quarantine differs from its bound manifest: ${n.ref}`)}if(e.exact&&t.length!==e.manifest.entries.length)throw new Error("Native root-move cleanup quarantine is incomplete before deletion");return t}function Gu(e){return e.ref.split("/").length}async function Tw(e){let i=[...await Mo({quarantine:e.quarantine,manifest:e.manifest,exact:!1})].sort((r,a)=>Gu(a)-Gu(r)||(r.type===a.type?a.ref.localeCompare(r.ref):r.type==="file"?-1:1)),n=0;for(let r of i){let a=j.join(e.quarantine,...r.ref.split("/"));r.type==="file"?await vo({root:e.projectRoot,file:a,maxBytes:Fo,expectedHash:r.hash,expectedSize:r.size,label:`Native root-move cleanup file ${r.ref}`}):await go({root:e.projectRoot,directory:a,label:`Native root-move cleanup directory ${r.ref}`}),n+=1,await e.hooks?.afterRootMoveCleanupEntryRemoved?.(e.manifest.kind,r.ref,n)}await Mo({quarantine:e.quarantine,manifest:e.manifest,exact:!1}),await go({root:e.projectRoot,directory:e.quarantine,label:`Native root-move cleanup quarantine ${e.manifest.kind}`})}function hr(e,t,i=e.native.artifact_root){return{...e,native:{...e.native,artifact_root:i,pending_root_move:t}}}function _w(e){return{schema:"comet.native.transaction.v1",id:e.id,kind:"root-move",status:"prepared",projectRoot:e.paths.projectRoot,nativeRoot:e.paths.nativeRoot,createdAt:e.now.toISOString(),operations:[]}}async function Ku(e){let t=hr(e.config,{...e.pending,stage:e.stage},e.activeArtifactRoot);return await yt(e.projectRoot,t),t}async function Ai(e){let t=e.config.native.pending_root_move;if(!t||t.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let i=hr(e.config,{id:t.id,fromArtifactRoot:t.fromArtifactRoot,toArtifactRoot:t.toArtifactRoot,stage:t.stage,...e.cleanup?{cleanup:e.cleanup}:{}},e.config.native.artifact_root);return await yt(e.projectRoot,i),i}async function Uu(e){let t=e.config,i=t.native.pending_root_move;if(!i||i.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let n=i.cleanup;if(n&&n.kind!==e.kind)throw new Error(`Native root move has unfinished ${n.kind} cleanup; cannot start ${e.kind}`);let r=await U(e.target),a=await U(e.quarantine);if(r&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(!n){if(!r&&!a)return t;if(!r&&a)throw new Error(`Native root-move cleanup quarantine is not transaction-bound: ${e.kind}`);let s=await Aw({paths:e.stablePaths,id:e.id,kind:e.kind,entries:await xi(e.target,{rejectSymlinks:!0})});n={kind:e.kind,state:"prepared",manifestHash:s},t=await Ai({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:n})}let o=await xw({paths:e.stablePaths,id:e.id,cleanup:n});if(r=await U(e.target),a=await U(e.quarantine),r&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(r){if(n.state!=="prepared")throw new Error(`Native root-move cleanup target reappeared after quarantine: ${e.kind}`);await fu({root:e.projectRoot,directory:e.target,quarantine:e.quarantine,label:e.label,beforeQuarantine:e.beforeQuarantine,afterQuarantine:e.afterQuarantine}),a=!0}if(!a){if(n.state!=="deleting")throw new Error(`Native root-move cleanup quarantine disappeared: ${e.kind}`);return Ai({projectRoot:e.projectRoot,config:t,id:e.id})}return await Mo({quarantine:e.quarantine,manifest:o,exact:n.state!=="deleting"}),n.state==="prepared"&&(n={...n,state:"quarantined"},t=await Ai({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:n})),n.state==="quarantined"&&(n={...n,state:"deleting"},t=await Ai({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:n})),await Tw({projectRoot:e.projectRoot,quarantine:e.quarantine,manifest:o,hooks:e.hooks}),Ai({projectRoot:e.projectRoot,config:t,id:e.id})}async function Iw(e){let t=e.config,i=t.native.pending_root_move.stage;if(i==="copying"){if(!await U(e.sourcePaths.nativeRoot))throw new Error(`Native source root is missing: ${e.sourcePaths.nativeRoot}`);let s=Sw(e.staging);t=await Uu({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"restart-staging",stablePaths:e.sourcePaths,target:e.staging,quarantine:s,label:"Native root move stale staging removal",hooks:e.hooks}),await xi(e.sourcePaths.nativeRoot,{rejectSymlinks:!0,excludedFiles:new Set([j.resolve(e.lockFile)])}),await Nw(e.sourcePaths.nativeRoot,e.staging,e.lockFile,e.destinationPaths.projectRoot),await dr(e.sourcePaths.nativeRoot,e.staging,e.lockFile),t=await Ku({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"ready"}),i="ready",await e.hooks?.afterRootMoveStage?.("ready",e.journal)}if(i==="ready"){if(await U(e.destinationPaths.nativeRoot)){if(await U(e.staging))throw new Error(`Native destination is occupied: ${e.destinationPaths.nativeRoot}`);await dr(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile)}else{if(!await U(e.staging))throw new Error("Native move staging tree is missing");await dr(e.sourcePaths.nativeRoot,e.staging,e.lockFile),await Me.rename(e.staging,e.destinationPaths.nativeRoot)}t=await Ku({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"switched",activeArtifactRoot:e.pending.toArtifactRoot}),i="switched",await e.hooks?.afterRootMoveStage?.("switched",e.journal)}if(i!=="switched")throw new Error(`Unsupported Native root-move stage: ${i}`);if(!await U(e.destinationPaths.nativeRoot))throw new Error(`Native destination root is missing: ${e.destinationPaths.nativeRoot}`);let n=kw(e.sourcePaths,e.pending.id);!t.native.pending_root_move?.cleanup&&await U(e.sourcePaths.nativeRoot)&&await dr(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile),t=await Uu({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"forward-source",stablePaths:e.destinationPaths,target:e.sourcePaths.nativeRoot,quarantine:n,label:"Native root move source removal",beforeQuarantine:()=>e.hooks?.beforeRootMoveSourceRemove?.(e.sourcePaths.nativeRoot),afterQuarantine:s=>e.hooks?.afterRootMoveSourceQuarantined?.(s),hooks:e.hooks}),await ww(e.destinationPaths);let r=await Ei(e.destinationPaths,e.pending.id);await bo(e.destinationPaths,r,"commit");let a={artifact_root:t.native.artifact_root,language:t.native.language,clarification_mode:t.native.clarification_mode,archive_confirmation:t.native.archive_confirmation,max_verify_failures:t.native.max_verify_failures,snapshot:t.native.snapshot},o={...t,native:{...a,artifact_root:e.pending.toArtifactRoot}};return await yt(e.projectRoot,o),o}async function Qu(e){let t=await Ie(e.projectRoot)??Ul("docs");if(t.native.pending_root_move)throw new Error(`Native root move ${t.native.pending_root_move.id} is already incomplete`);let i=mi(e.toArtifactRoot);if(i===t.native.artifact_root)throw new Error(`Native artifact root is already ${i}`);let n=await Ge(e.projectRoot,t.native.artifact_root),r=await Ge(e.projectRoot,i);if(K(n.nativeRoot,r.nativeRoot)||K(r.nativeRoot,n.nativeRoot))throw new Error("Native source and destination roots must not overlap");if(!await U(n.nativeRoot))throw new Error(`Native source root does not exist: ${n.nativeRoot}`);if(await vw(n),await U(r.nativeRoot))throw new Error(`Native destination is occupied: ${r.nativeRoot}`);let a=await gi(n,"root-move",`move root to ${i}`),o=mw(),s={id:o,fromArtifactRoot:t.native.artifact_root,toArtifactRoot:i,stage:"copying"},c=_w({id:o,paths:n,now:e.now??new Date}),l=bw(r,o);try{if(await gw(n,a.file),await yw(n),await U(l))throw new Error(`Native move staging path is occupied: ${l}`);return await yt(e.projectRoot,hr(t,s)),await ku(n,c),await e.hooks?.afterRootMoveStage?.("copying",c),await Iw({projectRoot:e.projectRoot,config:hr(t,s),pending:s,sourcePaths:n,destinationPaths:r,staging:l,journal:c,lockFile:a.file,hooks:e.hooks}),{fromNativeRoot:n.nativeRoot,toNativeRoot:r.nativeRoot,transactionId:o}}finally{await wi(a)}}import hy from"path";var Ow=["Outcome","Scope","Non-goals","Acceptance examples"],rR=[...Ow,"Constraints and invariants","Decisions","Open questions","Verification expectations"];import{createHash as $w}from"crypto";function le(e){throw new TypeError(`Value is not valid canonical JSON: ${e}`)}function Hw(e,t){t.has(e)&&le("cyclic structures are not supported"),t.add(e);try{let i=Object.keys(e);for(let n=0;n<e.length;n+=1)Object.prototype.hasOwnProperty.call(e,n)||le("sparse arrays are not supported");return(i.length!==e.length||i.some((n,r)=>n!==String(r)))&&le("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(e).length>0&&le("symbol properties are not supported"),`[${e.map(n=>Lo(n,t)).join(",")}]`}finally{t.delete(e)}}function Mw(e,t){let i=Object.getPrototypeOf(e);i!==Object.prototype&&i!==null&&le("only plain objects are supported"),t.has(e)&&le("cyclic structures are not supported"),Object.getOwnPropertySymbols(e).length>0&&le("symbol properties are not supported"),t.add(e);try{let n=Object.getOwnPropertyDescriptors(e);return`{${Object.keys(e).sort().map(o=>{let s=n[o];return(!s||!("value"in s))&&le("accessor properties are not supported"),`${JSON.stringify(o)}:${Lo(s.value,t)}`}).join(",")}}`}finally{t.delete(e)}}function Lo(e,t){if(e===null)return"null";switch(typeof e){case"boolean":return e?"true":"false";case"string":return JSON.stringify(e);case"number":return Number.isFinite(e)||le("numbers must be finite"),JSON.stringify(Object.is(e,-0)?0:e);case"object":return Array.isArray(e)?Hw(e,t):Mw(e,t);case"bigint":case"function":case"symbol":case"undefined":return le(`${typeof e} values are not supported`)}return le("unsupported value type")}function Do(e){return Lo(e,new Set)}function ue(e,t){if(e.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(e))throw new TypeError("Canonical hash tag must not contain a line break");return $w("sha256").update(`${e}
179
- ${Do(t)}`).digest("hex")}var Fw=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 Zu=1024*1024;var tf="scoped-text-safety",Lw=1,Dw=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var Bw="comet.native.checker-policy.v1";var kR=ue(Bw,{policy:tf,version:Lw,limits:Dw,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var qw=["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"],SR=new Set(qw);var Ww=Zu,BR=3*Ww;var nf={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:[]},zw=Z("comet-native-runtime:v3:semantic-repair-budget"),mC=[{skillVersion:"2",skillHash:Z("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:Z("comet-native-runtime:v1")}];var af=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],UC=new Set(af),Xw=new Set([...af,"minimum_runtime_version","revision"]),YC=new Set([...Xw,"operation"]),XC=512*1024,Qw=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),QC=new Set([...Qw,"implementationScopeHash","repairScopeHash","repairStagnation"]);var tP=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),of=Object.freeze({maxCriteria:1024});var cP={maxAcceptanceCriteria:of.maxCriteria};var hP={maxSpecs:64,maxFileBytes:Gn,maxTotalBytes:4*1024*1024};import{execFile as sy,spawn as tA}from"node:child_process";import{promisify as cy}from"node:util";var EP={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var JP=512*1024;var _i=class extends Error{recovery;constructor(t,i){super(t),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var vA=64*1024;var gA=3600*1e3;var wA=cy(sy);var yA=["$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 mr=class extends Error{details;constructor(t){let i=t.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${t.length} receipt(s)): ${t.map(n=>`${n.ref}${n.acceptanceId?`[${n.acceptanceId}]`:""} -> ${n.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=t}};var ax={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var px=16*1024*1024,mx=256*1024,vx=16*1024;var yx=16*1024;var Tx=16*1024;var mT=16*1024*1024,vr=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"},gr=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 CT=10*1024*1024,ve=class extends Error{};function cf(e,t){let i=e.flatMap((n,r)=>n===t?[r]:[]);if(i.length>1)throw new ve(`${t} may only be provided once`);return i.length===0?!1:(e.splice(i[0],1),!0)}function lf(e,t){let i=e.flatMap((a,o)=>a===t?[o]:[]);if(i.length>1)throw new ve(`${t} may only be provided once`);if(i.length===0)return;let n=i[0],r=e[n+1];if(r===void 0||r.startsWith("--"))throw new ve(`${t} requires a value`);return e.splice(n,2),r}function Bo(e){if(e.length>0)throw new ve(`Unexpected argument: ${e[0]}`)}function qo(e,t){let i=e.shift();if(!i||i.startsWith("--"))throw new ve(`${t} is required`);return i}async function uf(e){return e?hy.resolve(e):uo(process.cwd())}function Vo(e,t,i){return{command:e,exitCode:0,data:t,text:i??JSON.stringify(t,null,2)+`
180
- `}}function ff(e,t){if(t instanceof ve)return{command:e,exitCode:64,error:{code:"usage",message:t.message}};if(t instanceof vr)return{command:e,exitCode:73,data:{capability:t.capability,expectedHash:t.expectedHash,actualHash:t.actualHash,canonicalPath:t.canonicalPath},error:{code:"conflict",message:t.message}};if(t instanceof gr)return{command:e,exitCode:73,data:t.preflight,error:{code:"conflict",message:t.message}};if(t instanceof lr)return{command:e,exitCode:73,data:{change:t.change,expectedRevision:t.expectedRevision,actualRevision:t.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:t.message}};if(t instanceof ur)return{command:e,exitCode:73,data:{requestedIsolation:t.requestedIsolation,activeChanges:t.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:t.message}};if(t instanceof fr)return{command:e,exitCode:65,data:{change:t.change,complete:!1,omittedCount:t.omittedCount,omittedByReason:t.omittedByReason,samplePaths:t.samplePaths,sampleTruncated:t.sampleTruncated,effectiveLimits:t.effectiveLimits,policyHash:t.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:t.message}};if(t instanceof mr)return{command:e,exitCode:65,data:{receiptBindingFailures:t.details},error:{code:"invalid-data",message:t.message}};if(t instanceof _i)return{command:e,exitCode:65,data:t.recovery,error:{code:"implementation-scope-stale",message:t.message}};if(t instanceof Error){let i=t.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:e,exitCode:70,error:{code:"internal",message:t.message}};let n=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(t.message);return{command:e,exitCode:n?73:65,error:{code:n?"conflict":"invalid-data",message:t.message}}}return{command:e,exitCode:70,error:{code:"internal",message:String(t)}}}function df(e,t){return t?{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
181
- `}:e.error?{exitCode:e.exitCode,stderr:e.error.message}:{exitCode:e.exitCode,stdout:e.text}}async function hf(e,t){let i=qo(e,"root subcommand");if(i==="show"){Bo(e);let n=await Ie(t);if(!n)throw new Error(".comet/config.yaml was not found");let r=await Ge(t,n.native.artifact_root);return Vo("root show",{projectRoot:t,artifactRoot:n.native.artifact_root,language:n.native.language,nativeRoot:r.nativeRoot,pendingRootMove:n.native.pending_root_move??null})}if(i==="move"){let n=qo(e,"artifact root");Bo(e);let r=await Qu({projectRoot:t,toArtifactRoot:n});return Vo("root move",r,`Moved Comet Native to ${r.toNativeRoot}
182
- `)}throw new ve(`Unknown root command: ${i}`)}function py(e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
183
- `}}async function pf(e,t,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{cf(r,"--json"),s=lf(r,"--project-root");let u=[...r,...a],f=await uf(s);c=await t(u,f)}catch(u){c=ff(e,u)}let l=o?py(c):df(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
168
+ `}function Cv(e,t){if(!/^[a-f0-9-]{8,}$/u.test(t))throw new Error(`Invalid Native transaction id: ${t}`);return ge.join(e.transactionsDir,t)}function Vr(e,t){let i=Cv(e,t);return{directory:i,journal:ge.join(i,"transaction.json"),events:ge.join(i,"events.jsonl"),staged:ge.join(i,"staged"),backups:ge.join(i,"backups")}}async function Xe(e,t){let i=Vr(e,t);return await Promise.all(Object.values(i).map(r=>$(e.runtimeDir,r))),i}async function tu(e,t,i={}){let r=await Xe(e,t);try{await Mr.lstat(r.events)}catch(n){if(n.code==="ENOENT")return{exists:!1,hash:null,size:0,events:[],canonicalSource:"",needsRepair:!1};throw n}try{let n=await J({root:e.runtimeDir,file:r.events,maxBytes:bv,label:`Native transaction event log ${t}`,hooks:i.hooks}),a;try{a=Xl.decode(n.bytes)}catch(c){throw new Error(`Native transaction event log ${t} is not valid UTF-8`,{cause:c})}let o=xv(a),s=eu(o);return{exists:!0,hash:n.hash,size:n.size,events:o,canonicalSource:s,needsRepair:a!==s}}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction event log ${t} changed while reading`,{cause:n}):n}}async function Gl(e,t,i){let r=await tu(e,t);if(r.exists!==i.exists||r.hash!==i.hash||r.size!==i.size)throw new Error(`Native transaction event log ${t} changed before append`)}async function oo(e,t,i,r){let n=await Xe(e,t),a=await tu(e,t),o=a.events.find(c=>c.type===i&&c.operationId===r);if(o)return a.needsRepair&&await z(n.events,a.canonicalSource,{containedRoot:e.runtimeDir,beforeCommit:()=>Gl(e,t,a)}),o;if(a.events.length>=Fr)throw new Error(`Native transaction event log ${t} exceeds ${Fr} events`);let s={sequence:a.events.length+1,timestamp:new Date().toISOString(),type:i,...r?{operationId:r}:{}};return Zl(s,s.sequence),await Mr.mkdir(n.directory,{recursive:!0}),await z(n.events,eu([...a.events,s]),{containedRoot:e.runtimeDir,beforeCommit:()=>Gl(e,t,a)}),s}async function iu(e,t){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");t=ao(t);let i=await Xe(e,t.id);await Mr.mkdir(i.staged,{recursive:!0}),await Mr.mkdir(i.backups,{recursive:!0}),await X(i.journal,t,{containedRoot:e.runtimeDir}),await oo(e,t.id,"prepared")}async function vi(e,t,i={}){let r=await Xe(e,t),n=await J({root:e.runtimeDir,file:r.journal,maxBytes:Nv,label:`Native transaction journal ${t}`,hooks:i.hooks}),a=JSON.parse(Xl.decode(n.bytes)),o=ao(a);if(o.id!==t)throw new Error(`Invalid Native transaction journal: ${t}`);return o}async function Av(e,t,i){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");let r=ao({...t,status:i});return await X((await Xe(e,t.id)).journal,r,{containedRoot:e.runtimeDir}),r}async function so(e,t,i){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");return await oo(e,t.id,i),i==="commit"?Av(e,t,"committed"):t}import{createHash as mg}from"node:crypto";import{promises as Yr}from"node:fs";import Be from"node:path";import{execFileSync as _v}from"child_process";import Wr from"path";function qr(e,t){return _v("git",["-C",e,...t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function Tv(e,t){let i=Wr.normalize(e),r=Wr.normalize(t);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function He(e){try{let t=Wr.resolve(qr(e,["rev-parse","--show-toplevel"])),r=qr(e,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),n=r?Wr.resolve(r.slice(9)):t,a=null;try{a=qr(e,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!Tv(t,n),currentWorktreeRoot:t,primaryWorktreeRoot:n,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function co(e,t){try{let i=qr(e,["rev-parse","--verify",`${t}^{commit}`]).toLowerCase();return/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(i)?i:null}catch{return null}}import{createHash as Ov}from"node:crypto";import{promises as oe}from"node:fs";import Z from"node:path";import{TextDecoder as Hv}from"node:util";var Iv=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),jv=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function $v(e){return e.toLowerCase().startsWith(".env")}function gi(e){let i=e.replaceAll("\\","/").split("/").filter(Boolean).map(r=>r.toLowerCase());return i.some(r=>$v(r))?"environment-file":i.some(r=>jv.has(r))?"credential-config":i.includes(".git")?"git-metadata":i.some(r=>Iv.has(r))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}var Jr=1024*1024;function lo(e,t){let i=Z.relative(e,t);return i===""||!Z.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Z.sep}`)}function Dv(e){let t=Z.posix.normalize(e);if(e.length===0||e!==e.trim()||e.includes("\\")||Array.from(e).some(n=>{let a=n.codePointAt(0)??0;return a<=31||a===127})||Z.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes("..")||t!==e||t==="."||e.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${e}`);let i=e.toLowerCase(),r=gi(e);if(r||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${r??"native-runtime"}): ${e}`);return e}function Bv(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native artifact byte limit must be a positive integer");return e}function Lv(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function zr(e,t){let i={...e,birthtime:e.birthtimeMs},r={...t,birthtime:t.birthtimeMs};return U(i,r)?T(i,r):T(i,r)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function ru(e){let t=await oe.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${e}`);return{path:e,realPath:await oe.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function Mv(e,t){let i=Z.resolve(e),r=Z.resolve(t);if(!lo(i,r))throw new Error("Native artifact path is outside its root");let n=[await ru(i)],a=i;for(let o of Z.relative(i,r).split(Z.sep).filter(Boolean)){a=Z.join(a,o);let s=await ru(a);if(!lo(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);n.push(s)}return n}async function nu(e){for(let t of e){let i=await oe.lstat(t.path);if(!i.isDirectory()||i.isSymbolicLink()||!Lv(t,i)||await oe.realpath(t.path)!==t.realPath)throw new Error(`Native artifact parent changed while reading: ${t.path}`)}}async function we(e){let t=Dv(e.ref),i=e.maxBytes===null?null:Bv(e.maxBytes??Jr),r=Z.resolve(e.root,...t.split("/")),n=await Mv(e.root,Z.dirname(r));await e.hooks?.afterParentChainCaptured?.();let a=await oe.lstat(r);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${t}`);if(i!==null&&a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${t}`);let o=await oe.realpath(r);if(!lo(n[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${t}`);let s=await oe.open(r,"r");try{let[c,l,d]=await Promise.all([s.stat(),oe.lstat(r),oe.realpath(r)]);if(await nu(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||d!==o||!zr(a,c)||!zr(c,l))throw new Error(`Native artifact changed while opening: ${t}`);await e.hooks?.afterOpen?.();let u=[],f=0,p=Buffer.allocUnsafe(i===null?64*1024:Math.min(64*1024,i+1));for(;;){let b=i===null?p.length:i+1-f,k=await s.read(p,0,Math.min(p.length,b),null);if(k.bytesRead===0)break;if(f+=k.bytesRead,i!==null&&f>i)throw new Error(`Native artifact exceeds ${i} bytes: ${t}`);u.push(Buffer.from(p.subarray(0,k.bytesRead)))}await e.hooks?.beforeFinalCheck?.();let[v,h,m]=await Promise.all([s.stat(),oe.lstat(r),oe.realpath(r)]);if(await nu(n),!h.isFile()||h.isSymbolicLink()||m!==o||!zr(c,v)||!zr(c,h))throw new Error(`Native artifact changed while reading: ${t}`);let w=Buffer.concat(u,f),y;try{y=new Hv("utf-8",{fatal:!0}).decode(w)}catch(b){throw new Error(`Native artifact is not valid UTF-8: ${t}`,{cause:b})}return{ref:t,size:f,hash:e.includeHash===!1?null:Ov("sha256").update(w).digest("hex"),text:y}}finally{await s.close()}}var su=Ri(Yt(),1);import{createHash as Fv}from"crypto";function ee(e){return Fv("sha256").update(e).digest("hex")}var Lb={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024};var Mb=8*1024*1024;var Fb=64*1024,Vb=64*1024;var qb={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},Wb={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};var zb=(1n<<256n)-1n;var Uv=Ri(Yt(),1);var sk=4*1024*1024;var Zk=256*1024;var fS={runStateBytes:256*1024,trajectoryBytes:8*1024*1024,trajectoryEvents:4096,trajectoryEventBytes:256*1024,checkpointBytes:256*1024,pendingActionBytes:256*1024,contextBytes:1024*1024,artifactsBytes:1024*1024};var cu=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],LS=new Set(cu),ig=new Set([...cu,"minimum_runtime_version","revision"]),MS=new Set([...ig,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]);var Gr=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"},wi=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"},Ur=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"},FS=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
169
+ `);var VS=256*1024;import{createHash as rg}from"crypto";function se(e){throw new TypeError(`Value is not valid canonical JSON: ${e}`)}function ng(e,t){t.has(e)&&se("cyclic structures are not supported"),t.add(e);try{let i=Object.keys(e);for(let r=0;r<e.length;r+=1)Object.prototype.hasOwnProperty.call(e,r)||se("sparse arrays are not supported");return(i.length!==e.length||i.some((r,n)=>r!==String(n)))&&se("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(e).length>0&&se("symbol properties are not supported"),`[${e.map(r=>ho(r,t)).join(",")}]`}finally{t.delete(e)}}function ag(e,t){let i=Object.getPrototypeOf(e);i!==Object.prototype&&i!==null&&se("only plain objects are supported"),t.has(e)&&se("cyclic structures are not supported"),Object.getOwnPropertySymbols(e).length>0&&se("symbol properties are not supported"),t.add(e);try{let r=Object.getOwnPropertyDescriptors(e);return`{${Object.keys(e).sort().map(o=>{let s=r[o];return(!s||!("value"in s))&&se("accessor properties are not supported"),`${JSON.stringify(o)}:${ho(s.value,t)}`}).join(",")}}`}finally{t.delete(e)}}function ho(e,t){if(e===null)return"null";switch(typeof e){case"boolean":return e?"true":"false";case"string":return JSON.stringify(e);case"number":return Number.isFinite(e)||se("numbers must be finite"),JSON.stringify(Object.is(e,-0)?0:e);case"object":return Array.isArray(e)?ng(e,t):ag(e,t);case"bigint":case"function":case"symbol":case"undefined":return se(`${typeof e} values are not supported`)}return se("unsupported value type")}function po(e){return ho(e,new Set)}function ce(e,t){if(e.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(e))throw new TypeError("Canonical hash tag must not contain a line break");return rg("sha256").update(`${e}
170
+ ${po(t)}`).digest("hex")}var KS=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),lu=Object.freeze({maxCriteria:1024});var uu=Ri(Yt(),1);var hu="[a-z][a-z0-9]*(?:-[a-z0-9]+)*",gE=new RegExp(`^portable-archive-(${hu})\\.json$`,"u"),wE=new RegExp(`^portable-migration-(${hu})\\.json$`,"u");var yi=/^[a-f0-9]{64}$/u,pu=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u,vg=16*1024,vo=process.platform;function gu(e,t){let i=Be.relative(e,t);return Be.isAbsolute(i)||i===".."||i.startsWith(`..${Be.sep}`)?null:i.replaceAll("\\","/")||"."}function wu(e){return Array.from(e).some(t=>{let i=t.codePointAt(0)??0;return i<=31||i===127})}function yu(e,t){if(e.length===0||wu(e)||e.includes("\\")||Be.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes(".."))throw new Error(`${t} must be a portable project-relative path`);let i=Be.posix.normalize(e);if(i!==e||i===".."||i.startsWith("../"))throw new Error(`${t} must be a normalized project-relative path`);return i}function go(e,t){return mg("sha256").update(`${e}
171
+ ${t}`).digest("hex")}async function mu(e,t){let i=await Yr.realpath(t),r=await Yr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=vo==="win32"?Be.normalize(i).toLowerCase():i;return go(e,`${n}
172
+ ${r.dev}
173
+ ${r.ino}
174
+ ${r.birthtimeMs}`)}async function vu(e,t){let i=await Yr.realpath(t),r=await Yr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=vo==="win32"?Be.normalize(i).toLowerCase():i;return go(e,n)}function gg(e){if(typeof e!="string")throw new Error("Native workspace capturedAt is invalid");let t=new Date(e);if(!Number.isFinite(t.getTime())||t.toISOString()!==e)throw new Error("Native workspace capturedAt is invalid");return e}function mo(e,t){if(e===null)return null;if(typeof e!="string"||e.length===0||e.trim()!==e||wu(e))throw new Error(`${t} must be a non-empty branch name or null`);return e}function Nu(e){if(!new Set(["current","branch","worktree"]).has(e.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(mo(e.changeBranch,"Native workspace change branch"),mo(e.targetBranch,"Native workspace target branch"),(e.isolation==="branch"||e.isolation==="worktree")&&(e.changeBranch===null||e.targetBranch===null))throw new Error("Native isolated workspace requires change and target branches")}function wg(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace Git provenance must be an object");let t=e,i=new Set(["provider","baseCommit","targetBranch","targetCommit"]),r=Object.keys(t).filter(n=>!i.has(n));if(r.length>0)throw new Error(`Native workspace Git provenance has unknown field(s): ${r.join(", ")}`);if(t.provider!=="git"||typeof t.baseCommit!="string"||!pu.test(t.baseCommit)||typeof t.targetCommit!="string"||!pu.test(t.targetCommit))throw new Error("Native workspace Git provenance is invalid");mo(t.targetBranch,"Native workspace Git target branch")}function Xr(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace identity must be an object");let t=e,i=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","git","isolation","changeBranch","targetBranch","finish"]),r=Object.keys(t).filter(o=>!i.has(o));if(r.length>0)throw new Error(`Native workspace identity has unknown field(s): ${r.join(", ")}`);if(t.schema!=="comet.native.workspace.v2"&&t.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(t.capturedRevision)||t.capturedRevision<1||typeof t.nativeRootRef!="string"||!yi.test(String(t.projectRootId))||!yi.test(String(t.nativeRootId)))throw new Error("Native workspace identity is invalid");gg(t.capturedAt),yu(t.nativeRootRef,"Native workspace root ref");let n=t.projectRootPathId!==void 0,a=t.nativeRootPathId!==void 0;if(n!==a)throw new Error("Native workspace path identities must be provided together");if(n&&!yi.test(String(t.projectRootPathId))||a&&!yi.test(String(t.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(t.sessionHash!==void 0&&!yi.test(String(t.sessionHash)))throw new Error("Native workspace session hash is invalid");if(t.git!==void 0&&wg(t.git),t.schema==="comet.native.workspace.v2"){if(t.isolation!==void 0||t.changeBranch!==void 0||t.targetBranch!==void 0||t.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof t.isolation!="string"||t.changeBranch===void 0||t.targetBranch===void 0||t.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(Nu(t),t.finish!==null&&!new Set(["merge","push","pull-request","keep"]).has(t.finish))throw new Error("Native workspace finish must be merge, push, pull-request, keep, or null")}function bu(e,t){return Be.join(de(e,t),"workspace.json")}function yg(e,t){let i=bu(e,t),r=ae(e,i),n=gu(r,i);if(!n||n===".")throw new Error("Native workspace file escaped its root");return{root:r,ref:yu(n,"Native workspace file ref")}}async function Ng(e,t){try{let i=yg(e,t),r=await we({root:i.root,ref:i.ref,maxBytes:vg});return JSON.parse(r.text)}catch(i){if(i.code==="ENOENT")return null;throw i}}async function ku(e){if(!Number.isSafeInteger(e.revision)||e.revision<1)throw new Error("Native workspace revision must be a positive integer");let t=gu(e.paths.projectRoot,e.paths.nativeRoot);if(!t)throw new Error("Native root is outside the project root");let i=He(e.paths.projectRoot),r=i.isGitWorktree?co(e.paths.projectRoot,"HEAD"):null,n=e.binding?.targetBranch??i.currentBranch,a=n==null?null:co(e.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,d]=await Promise.all([mu("comet.native.workspace-project-root.v2",e.paths.projectRoot),mu("comet.native.workspace-native-root.v2",e.paths.nativeRoot),vu("comet.native.workspace-project-root-path.v2",e.paths.projectRoot),vu("comet.native.workspace-native-root-path.v2",e.paths.nativeRoot)]),u=(e.now??new Date).toISOString();if(e.finish&&!e.binding)throw new Error("Native workspace finish requires a workspace binding");e.binding&&Nu(e.binding);let f={capturedAt:u,capturedRevision:e.revision,nativeRootRef:t,projectRootId:s,nativeRootId:c,projectRootPathId:l,nativeRootPathId:d,...o?{git:o}:{},...e.sessionId?{sessionHash:go("comet.native.workspace-session.v2",`${s}
175
+ ${c}
176
+ ${e.sessionId}`)}:{}},p=e.binding?{schema:"comet.native.workspace.v3",...f,...e.binding,finish:e.finish??null}:{schema:"comet.native.workspace.v2",...f};return Xr(p),p}async function uo(e){let t=await ku(e),i=bu(e.paths,e.name),r=ae(e.paths,i);return await $(r,i),await X(i,t,{containedRoot:r}),t}async function wt(e,t){let i=await Ng(e,t);return i===null||i&&typeof i=="object"&&!Array.isArray(i)&&i.schema==="comet.native.workspace.v1"?null:(Xr(i),i)}async function Kr(e){Xr(e.identity);let t=await ku({paths:e.paths,name:"workspace-advisory",revision:e.identity.capturedRevision}),i=[],r=[];return t.nativeRootRef!==e.identity.nativeRootRef&&i.push("native-root-ref"),e.identity.projectRootPathId&&e.identity.nativeRootPathId?(t.projectRootPathId!==e.identity.projectRootPathId&&i.push("project-root-path"),t.nativeRootPathId!==e.identity.nativeRootPathId&&i.push("native-root-path")):(t.projectRootId!==e.identity.projectRootId&&i.push("project-root-legacy-identity"),t.nativeRootId!==e.identity.nativeRootId&&i.push("native-root-legacy-identity")),vo==="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 fo(e){if(Xr(e.identity),e.identity.schema==="comet.native.workspace.v2")return{state:"legacy",code:"workspace-binding-legacy",message:"Legacy Native workspace metadata has no isolation binding"};if((await Kr(e)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let i=He(e.paths.projectRoot);return e.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!==e.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${e.identity.changeBranch}, but the current branch is ${i.currentBranch??"detached HEAD"}`}:e.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"}}var yo=64*1024*1024,UE=256*1024,Ru=16*1024*1024;async function K(e){try{return await Le.access(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Eg(e){let t;try{t=await Le.readdir(e.transactionsDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t){if(!i.isDirectory()||i.isSymbolicLink())continue;let r;try{r=await vi(e,i.name)}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction ${i.name} has no journal; run doctor before moving`,{cause:n}):n}if(r.status!=="committed"&&r.status!=="rolled-back")throw new Error(`Native transaction ${r.id} is unfinished; recover it before moving`)}}async function Pg(e,t){for(let i of await Le.readdir(e.locksDir,{withFileTypes:!0})){let r=I.join(e.locksDir,i.name);if(I.resolve(r)!==I.resolve(t)&&(i.isFile()||i.isSymbolicLink()))throw new Error(`Native lock must be diagnosed before moving the root: ${r}`)}}async function Rg(e){let t;try{t=await Le.readdir(e.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t.sort((r,n)=>r.name.localeCompare(n.name))){if(!i.isDirectory()||i.isSymbolicLink())continue;let r=await wt(e,i.name);if(r){await uo({paths:e,name:i.name,revision:r.capturedRevision,...r.schema==="comet.native.workspace.v3"?{binding:{isolation:r.isolation,changeBranch:r.changeBranch,targetBranch:r.targetBranch},...r.finish?{finish:r.finish}:{}}:{}});continue}}}async function xg(e){let t;try{t=await Le.readdir(e.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t.sort((r,n)=>r.name.localeCompare(n.name)))if(!(!i.isDirectory()||i.isSymbolicLink()))try{let r=await wt(e,i.name);if(r?.schema==="comet.native.workspace.v3"){let n=await fo({paths:e,identity:r});if(n.state!=="aligned")throw new Error(n.message??"workspace binding is not aligned")}else if(r){let n=await Kr({paths:e,identity:r});if(n.state!=="aligned")throw new Error(`legacy workspace ownership is ${n.state}`)}}catch(r){throw new Error(`Native workspace identity for ${i.name} must be aligned and repaired before moving the root`,{cause:r})}}async function bi(e,t){let i=[];async function r(n){let a=await Ye({root:e,directory:n,label:"Native root tree"}),o=a.entries;o.sort((s,c)=>s.name.localeCompare(c.name));for(let s of o){await a.verify();let c=I.join(n,s.name);if(t.excludedFiles?.has(I.resolve(c))){await a.verify();continue}let l=await Le.lstat(c);if(s.isSymbolicLink()||l.isSymbolicLink()){if(t.rejectSymlinks)throw new Error(`Native root contains a symlink: ${c}`);await a.verify();continue}if(s.isDirectory()&&l.isDirectory())i.push({ref:I.relative(e,c).split(I.sep).join("/"),type:"directory"}),await r(c);else if(s.isFile()&&l.isFile()){let d=await J({root:e,file:c,maxBytes:yo,label:`Native root file ${I.relative(e,c)}`});i.push({ref:I.relative(e,c).split(I.sep).join("/"),type:"file",size:d.size,hash:d.hash})}else throw new Error(`Native root contains an unsupported file type: ${c}`);await a.verify()}}return await r(e),i.sort((n,a)=>n.ref.localeCompare(a.ref))}async function Cg(e,t,i,r){await fi({root:r,directory:t,label:"Native root move staging directory"});async function n(a,o){let s=await Ye({root:e,directory:a,label:"Native root move source directory"}),c=s.entries;for(let l of c){await s.verify();let d=I.join(a,l.name);if(I.resolve(d)===I.resolve(i)){await s.verify();continue}let u=await Le.lstat(d);if(l.isSymbolicLink()||u.isSymbolicLink())throw new Error(`Native root contains a symlink: ${d}`);let f=I.join(o,l.name);if(l.isDirectory()&&u.isDirectory())await fi({root:r,directory:f,label:"Native root move staging directory"}),await n(d,f);else if(l.isFile()&&u.isFile())await hi({sourceRoot:e,source:d,targetRoot:r,target:f,maxBytes:yo,label:`Native root move file ${I.relative(e,d)}`,exclusive:!0,expectedTargetHash:null});else throw new Error(`Native root contains an unsupported file type: ${d}`);await s.verify()}}await n(e,t)}async function Qr(e,t,i,r){let n=await bi(e,{rejectSymlinks:!0,excludedFiles:i?new Set([I.resolve(i)]):void 0}),a=await bi(t,{rejectSymlinks:!0,excludedFiles:r?new Set([I.resolve(r)]):void 0});if(JSON.stringify(n)!==JSON.stringify(a))throw new Error(`Native root copies differ; preserve both trees for manual recovery: ${e} and ${t}`)}function Ag(e,t){return I.join(e.artifactRoot,`.comet-native-move-${t}`)}function _g(e,t){return I.join(e.artifactRoot,`.comet-native-source-${t}.removing`)}function Tg(e){return`${e}.removing`}function xu(e,t,i){return I.join(Vr(e,t).directory,`root-move-cleanup-${i}.json`)}function Ig(e){return JSON.stringify(e,null,2)+`
177
+ `}function jg(e){return kg("sha256").update(e).digest("hex")}function $g(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Native root-move cleanup manifest entry ${t} must be an object`);let i=e,r=Object.keys(i).sort(),n=i.type==="file"?["hash","ref","size","type"]:["ref","type"];if(JSON.stringify(r)!==JSON.stringify(n))throw new Error(`Native root-move cleanup manifest entry ${t} has invalid fields`);if(typeof i.ref!="string"||i.ref.length===0||i.ref.includes("\\")||I.posix.normalize(i.ref)!==i.ref||i.ref.startsWith("/")||i.ref.split("/").includes("..")||Buffer.byteLength(i.ref,"utf8")>4096)throw new Error(`Native root-move cleanup manifest entry ${t} has an invalid ref`);if(i.type==="directory")return{ref:i.ref,type:"directory"};if(i.type!=="file"||typeof i.size!="number"||!Number.isSafeInteger(i.size)||i.size<0||typeof i.hash!="string"||!/^[a-f0-9]{64}$/u.test(i.hash))throw new Error(`Native root-move cleanup manifest entry ${t} is invalid`);return{ref:i.ref,type:"file",size:i.size,hash:i.hash}}function Og(e,t,i){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native root-move cleanup manifest must be an object");let r=e;if(JSON.stringify(Object.keys(r).sort())!==JSON.stringify(["entries","kind","schema","transactionId"])||r.schema!=="comet.native.root-move-cleanup.v1"||r.transactionId!==t||r.kind!==i||!Array.isArray(r.entries))throw new Error("Native root-move cleanup manifest binding is invalid");let n=r.entries.map($g);for(let a=0;a<n.length;a+=1){if(a>0&&n[a-1].ref.localeCompare(n[a].ref)>=0)throw new Error("Native root-move cleanup manifest refs must be unique and sorted");let o=I.posix.dirname(n[a].ref);if(o!=="."&&!n.some(s=>s.ref===o&&s.type==="directory"))throw new Error(`Native root-move cleanup manifest parent is missing: ${o}`)}return{schema:"comet.native.root-move-cleanup.v1",transactionId:t,kind:i,entries:n}}async function Hg(e){let t={schema:"comet.native.root-move-cleanup.v1",transactionId:e.id,kind:e.kind,entries:e.entries},i=Ig(t);if(Buffer.byteLength(i,"utf8")>Ru)throw new Error("Native root-move cleanup manifest exceeds its byte budget");return await z(xu(e.paths,e.id,e.kind),i,{containedRoot:e.paths.runtimeDir}),jg(i)}async function Dg(e){let t=await J({root:e.paths.runtimeDir,file:xu(e.paths,e.id,e.cleanup.kind),maxBytes:Ru,label:`Native root-move cleanup manifest ${e.cleanup.kind}`});if(t.hash!==e.cleanup.manifestHash)throw new Error("Native root-move cleanup manifest hash changed");return Og(JSON.parse(t.bytes.toString("utf8")),e.id,e.cleanup.kind)}async function wo(e){let t=await bi(e.quarantine,{rejectSymlinks:!0}),i=new Map(e.manifest.entries.map(r=>[r.ref,r]));for(let r of t){let n=i.get(r.ref);if(!n||JSON.stringify(n)!==JSON.stringify(r))throw new Error(`Native root-move cleanup quarantine differs from its bound manifest: ${r.ref}`)}if(e.exact&&t.length!==e.manifest.entries.length)throw new Error("Native root-move cleanup quarantine is incomplete before deletion");return t}function Su(e){return e.ref.split("/").length}async function Bg(e){let i=[...await wo({quarantine:e.quarantine,manifest:e.manifest,exact:!1})].sort((n,a)=>Su(a)-Su(n)||(n.type===a.type?a.ref.localeCompare(n.ref):n.type==="file"?-1:1)),r=0;for(let n of i){let a=I.join(e.quarantine,...n.ref.split("/"));n.type==="file"?await io({root:e.projectRoot,file:a,maxBytes:yo,expectedHash:n.hash,expectedSize:n.size,label:`Native root-move cleanup file ${n.ref}`}):await ro({root:e.projectRoot,directory:a,label:`Native root-move cleanup directory ${n.ref}`}),r+=1,await e.hooks?.afterRootMoveCleanupEntryRemoved?.(e.manifest.kind,n.ref,r)}await wo({quarantine:e.quarantine,manifest:e.manifest,exact:!1}),await ro({root:e.projectRoot,directory:e.quarantine,label:`Native root-move cleanup quarantine ${e.manifest.kind}`})}function Zr(e,t,i=e.native.artifact_root){return{...e,native:{...e.native,artifact_root:i,pending_root_move:t}}}function Lg(e){return{schema:"comet.native.transaction.v1",id:e.id,kind:"root-move",status:"prepared",projectRoot:e.paths.projectRoot,nativeRoot:e.paths.nativeRoot,createdAt:e.now.toISOString(),operations:[]}}async function Eu(e){let t=Zr(e.config,{...e.pending,stage:e.stage},e.activeArtifactRoot);return await $e(e.projectRoot,t),t}async function Ni(e){let t=e.config.native.pending_root_move;if(!t||t.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let i=Zr(e.config,{id:t.id,fromArtifactRoot:t.fromArtifactRoot,toArtifactRoot:t.toArtifactRoot,stage:t.stage,...e.cleanup?{cleanup:e.cleanup}:{}},e.config.native.artifact_root);return await $e(e.projectRoot,i),i}async function Pu(e){let t=e.config,i=t.native.pending_root_move;if(!i||i.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let r=i.cleanup;if(r&&r.kind!==e.kind)throw new Error(`Native root move has unfinished ${r.kind} cleanup; cannot start ${e.kind}`);let n=await K(e.target),a=await K(e.quarantine);if(n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(!r){if(!n&&!a)return t;if(!n&&a)throw new Error(`Native root-move cleanup quarantine is not transaction-bound: ${e.kind}`);let s=await Hg({paths:e.stablePaths,id:e.id,kind:e.kind,entries:await bi(e.target,{rejectSymlinks:!0})});r={kind:e.kind,state:"prepared",manifestHash:s},t=await Ni({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:r})}let o=await Dg({paths:e.stablePaths,id:e.id,cleanup:r});if(n=await K(e.target),a=await K(e.quarantine),n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(n){if(r.state!=="prepared")throw new Error(`Native root-move cleanup target reappeared after quarantine: ${e.kind}`);await zl({root:e.projectRoot,directory:e.target,quarantine:e.quarantine,label:e.label,beforeQuarantine:e.beforeQuarantine,afterQuarantine:e.afterQuarantine}),a=!0}if(!a){if(r.state!=="deleting")throw new Error(`Native root-move cleanup quarantine disappeared: ${e.kind}`);return Ni({projectRoot:e.projectRoot,config:t,id:e.id})}return await wo({quarantine:e.quarantine,manifest:o,exact:r.state!=="deleting"}),r.state==="prepared"&&(r={...r,state:"quarantined"},t=await Ni({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:r})),r.state==="quarantined"&&(r={...r,state:"deleting"},t=await Ni({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:r})),await Bg({projectRoot:e.projectRoot,quarantine:e.quarantine,manifest:o,hooks:e.hooks}),Ni({projectRoot:e.projectRoot,config:t,id:e.id})}async function Mg(e){let t=e.config,i=t.native.pending_root_move.stage;if(i==="copying"){if(!await K(e.sourcePaths.nativeRoot))throw new Error(`Native source root is missing: ${e.sourcePaths.nativeRoot}`);let s=Tg(e.staging);t=await Pu({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"restart-staging",stablePaths:e.sourcePaths,target:e.staging,quarantine:s,label:"Native root move stale staging removal",hooks:e.hooks}),await bi(e.sourcePaths.nativeRoot,{rejectSymlinks:!0,excludedFiles:new Set([I.resolve(e.lockFile)])}),await Cg(e.sourcePaths.nativeRoot,e.staging,e.lockFile,e.destinationPaths.projectRoot),await Qr(e.sourcePaths.nativeRoot,e.staging,e.lockFile),t=await Eu({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"ready"}),i="ready",await e.hooks?.afterRootMoveStage?.("ready",e.journal)}if(i==="ready"){if(await K(e.destinationPaths.nativeRoot)){if(await K(e.staging))throw new Error(`Native destination is occupied: ${e.destinationPaths.nativeRoot}`);await Qr(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile)}else{if(!await K(e.staging))throw new Error("Native move staging tree is missing");await Qr(e.sourcePaths.nativeRoot,e.staging,e.lockFile),await Le.rename(e.staging,e.destinationPaths.nativeRoot)}t=await Eu({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"switched",activeArtifactRoot:e.pending.toArtifactRoot}),i="switched",await e.hooks?.afterRootMoveStage?.("switched",e.journal)}if(i!=="switched")throw new Error(`Unsupported Native root-move stage: ${i}`);if(!await K(e.destinationPaths.nativeRoot))throw new Error(`Native destination root is missing: ${e.destinationPaths.nativeRoot}`);let r=_g(e.sourcePaths,e.pending.id);!t.native.pending_root_move?.cleanup&&await K(e.sourcePaths.nativeRoot)&&await Qr(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile),t=await Pu({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"forward-source",stablePaths:e.destinationPaths,target:e.sourcePaths.nativeRoot,quarantine:r,label:"Native root move source removal",beforeQuarantine:()=>e.hooks?.beforeRootMoveSourceRemove?.(e.sourcePaths.nativeRoot),afterQuarantine:s=>e.hooks?.afterRootMoveSourceQuarantined?.(s),hooks:e.hooks}),await Rg(e.destinationPaths);let n=await vi(e.destinationPaths,e.pending.id);await so(e.destinationPaths,n,"commit");let a={artifact_root:t.native.artifact_root,language:t.native.language,clarification_mode:t.native.clarification_mode,archive_confirmation:t.native.archive_confirmation,max_verify_failures:t.native.max_verify_failures,snapshot:t.native.snapshot},o={...t,native:{...a,artifact_root:e.pending.toArtifactRoot}};return await $e(e.projectRoot,o),o}async function Cu(e){let t=await fe(e.projectRoot)??Il("docs");if(t.native.pending_root_move)throw new Error(`Native root move ${t.native.pending_root_move.id} is already incomplete`);let i=ci(e.toArtifactRoot);if(i===t.native.artifact_root)throw new Error(`Native artifact root is already ${i}`);let r=await je(e.projectRoot,t.native.artifact_root),n=await je(e.projectRoot,i);if(F(r.nativeRoot,n.nativeRoot)||F(n.nativeRoot,r.nativeRoot))throw new Error("Native source and destination roots must not overlap");if(!await K(r.nativeRoot))throw new Error(`Native source root does not exist: ${r.nativeRoot}`);if(await Eg(r),await K(n.nativeRoot))throw new Error(`Native destination is occupied: ${n.nativeRoot}`);let a=await li(r,"root-move",`move root to ${i}`),o=Sg(),s={id:o,fromArtifactRoot:t.native.artifact_root,toArtifactRoot:i,stage:"copying"},c=Lg({id:o,paths:r,now:e.now??new Date}),l=Ag(n,o);try{if(await Pg(r,a.file),await xg(r),await K(l))throw new Error(`Native move staging path is occupied: ${l}`);return await $e(e.projectRoot,Zr(t,s)),await iu(r,c),await e.hooks?.afterRootMoveStage?.("copying",c),await Mg({projectRoot:e.projectRoot,config:Zr(t,s),pending:s,sourcePaths:r,destinationPaths:n,staging:l,journal:c,lockFile:a.file,hooks:e.hooks}),{fromNativeRoot:r.nativeRoot,toNativeRoot:n.nativeRoot,transactionId:o}}finally{await ui(a)}}import ko from"path";var Vg=["Outcome","Scope","Non-goals","Acceptance examples"],lP=[...Vg,"Constraints and invariants","Decisions","Open questions","Verification expectations"];var qg=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 Au=1024*1024;var Tu="scoped-text-safety",Wg=1,zg=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var Jg="comet.native.checker-policy.v1";var RP=ce(Jg,{policy:Tu,version:Wg,limits:zg,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var Gg=["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"],xP=new Set(Gg);var Yg=Au,WP=3*Yg;var Iu={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:[]},Qg=ee("comet-native-runtime:v3:scope-reopen"),gR=[{skillVersion:"3",skillHash:ee("comet-native-runtime:v3:semantic-repair-budget")},{skillVersion:"2",skillHash:ee("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:ee("comet-native-runtime:v1")}];var $u=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],XR=new Set($u),aw=new Set([...$u,"minimum_runtime_version","revision"]),QR=new Set([...aw,"operation"]),ZR=512*1024,ow=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),ex=new Set([...ow,"implementationScopeHash","repairScopeHash","repairStagnation","returnToBuild"]);var nx={maxAcceptanceCriteria:lu.maxCriteria};var lx={maxSpecs:64,maxFileBytes:Jr,maxTotalBytes:4*1024*1024};import{execFile as gw}from"node:child_process";import{promisify as ww}from"node:util";var dx=["$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("; ");var kx={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var qx=512*1024;var Ei=class extends Error{recovery;constructor(t,i){super(t),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var fC=64*1024;var hC=3600*1e3;var pC=ww(gw);var en=class extends Error{details;constructor(t){let i=t.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${t.length} receipt(s)): ${t.map(r=>`${r.ref}${r.acceptanceId?`[${r.acceptanceId}]`:""} -> ${r.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=t}};var ZC={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var cA=16*1024*1024,lA=256*1024,uA=16*1024;var mA=Object.freeze({maxScopeChanges:128,maxAcceptanceEntries:64,maxUnresolvedReasons:32,maxReceipts:32});var wA=16*1024;var K_=16*1024;var BT=16*1024*1024,tn=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"},rn=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 MT=8*1024*1024;var nn=class extends Error{constructor(i,r,n){super(i,n);this.preparation=r;this.name="NativeWorkspacePreparationError"}preparation};var Du=["--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."],bo=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:Du,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 or inspect 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.",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]
178
+ comet native next <change-name> --runner-input <json-file>`,purpose:"Confirm or recover an Agent boundary, 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]
179
+ 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 No(e,t){return`${e}:
180
+ ${t.map(i=>` ${i}`).join(`
181
+ `)}`}function xw(e){let t=e.filter(r=>r!=="--help");if(t.length===0)return"";let i=t.slice(0,2).join(" ");return bo[i]||t.length>1&&bo[t[0]]?.subcommands?i:t[0]}function Cw(e=[]){let t=xw(e),i=bo[t];if(!i)throw new Error(`Unknown Native help topic: ${t}`);let r=[`Usage: ${i.usage}`,"",i.purpose];i.subcommands&&r.push("",No("Commands",i.subcommands));let n=t===""?i.options:[...i.options??[],...Du];return n&&n.length>0&&r.push("",No("Options",n)),r.push("",`Output:
182
+ ${i.output}`),i.examples&&r.push("",No("Examples",i.examples)),t===""&&r.push("","Run `comet native <command> --help` for command-specific details."),{topic:t,usage:`${r.join(`
183
+ `)}
184
+ `}}var Aw=Cw().usage;var sI=10*1024*1024,pe=class extends Error{};function Lu(e,t){let i=e.flatMap((r,n)=>r===t?[n]:[]);if(i.length>1)throw new pe(`${t} may only be provided once`);return i.length===0?!1:(e.splice(i[0],1),!0)}function Mu(e,t){let i=e.flatMap((a,o)=>a===t?[o]:[]);if(i.length>1)throw new pe(`${t} may only be provided once`);if(i.length===0)return;let r=i[0],n=e[r+1];if(n===void 0||n.startsWith("--"))throw new pe(`${t} requires a value`);return e.splice(r,2),n}function So(e){if(e.length>0)throw new pe(`Unexpected argument: ${e[0]}`)}function Eo(e,t){let i=e.shift();if(!i||i.startsWith("--"))throw new pe(`${t} is required`);return i}function Bu(e,t){let i=ko.normalize(e),r=ko.normalize(t);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function _w(e){let t=ko.resolve(e),i=He(process.cwd());if(!i.isSecondaryWorktree||i.currentWorktreeRoot===null||i.primaryWorktreeRoot===null)return t;let r=He(t);return!r.isGitWorktree||r.currentWorktreeRoot===null||r.primaryWorktreeRoot===null||!Bu(i.primaryWorktreeRoot,r.primaryWorktreeRoot)||Bu(i.currentWorktreeRoot,r.currentWorktreeRoot)?t:i.currentWorktreeRoot}async function Fu(e){return e?_w(e):Qa(process.cwd())}function Po(e,t,i){return{command:e,exitCode:0,data:t,text:i??JSON.stringify(t,null,2)+`
185
+ `}}function Vu(e,t){if(t instanceof pe)return{command:e,exitCode:64,error:{code:"usage",message:t.message}};if(t instanceof tn)return{command:e,exitCode:73,data:{capability:t.capability,expectedHash:t.expectedHash,actualHash:t.actualHash,canonicalPath:t.canonicalPath},error:{code:"conflict",message:t.message}};if(t instanceof rn)return{command:e,exitCode:73,data:t.preflight,error:{code:"conflict",message:t.message}};if(t instanceof Gr)return{command:e,exitCode:73,data:{change:t.change,expectedRevision:t.expectedRevision,actualRevision:t.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:t.message}};if(t instanceof wi)return{command:e,exitCode:73,data:{requestedIsolation:t.requestedIsolation,activeChanges:t.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:t.message}};if(t instanceof nn)return{command:e,exitCode:73,data:{preparation:t.preparation},error:{code:"workspace-preparation-incomplete",message:t.message}};if(t instanceof Ur)return{command:e,exitCode:65,data:{change:t.change,complete:!1,omittedCount:t.omittedCount,omittedByReason:t.omittedByReason,samplePaths:t.samplePaths,sampleTruncated:t.sampleTruncated,effectiveLimits:t.effectiveLimits,policyHash:t.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:t.message}};if(t instanceof en)return{command:e,exitCode:65,data:{receiptBindingFailures:t.details},error:{code:"invalid-data",message:t.message}};if(t instanceof Ei)return{command:e,exitCode:65,data:t.recovery,error:{code:"implementation-scope-stale",message:t.message}};if(t instanceof Error){let i=t.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:e,exitCode:70,error:{code:"internal",message:t.message}};let r=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(t.message);return{command:e,exitCode:r?73:65,error:{code:r?"conflict":"invalid-data",message:t.message}}}return{command:e,exitCode:70,error:{code:"internal",message:String(t)}}}function qu(e,t){return t?{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
186
+ `}:e.error?{exitCode:e.exitCode,stderr:e.error.message}:{exitCode:e.exitCode,stdout:e.text}}async function Wu(e,t){let i=Eo(e,"root subcommand");if(i==="show"){So(e);let r=await fe(t);if(!r)throw new Error(".comet/config.yaml was not found");let n=await je(t,r.native.artifact_root);return Po("root show",{projectRoot:t,artifactRoot:r.native.artifact_root,language:r.native.language,nativeRoot:n.nativeRoot,pendingRootMove:r.native.pending_root_move??null})}if(i==="move"){let r=Eo(e,"artifact root");So(e);let n=await Cu({projectRoot:t,toArtifactRoot:r});return Po("root move",n,`Moved Comet Native to ${n.toNativeRoot}
187
+ `)}throw new pe(`Unknown root command: ${i}`)}function Tw(e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
188
+ `}}async function zu(e,t,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{Lu(n,"--json"),s=Mu(n,"--project-root");let d=[...n,...a],u=await Fu(s);c=await t(d,u)}catch(d){c=Vu(e,d)}let l=o?Tw(c):qu(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
184
189
  `)?"":`
185
- `)),l.exitCode}process.exitCode=await pf("root",hf);
190
+ `)),l.exitCode}process.exitCode=await zu("root",Wu);