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

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 (241) hide show
  1. package/README.md +18 -3
  2. package/assets/manifest.json +3 -1
  3. package/assets/skills/comet/scripts/comet-archive.mjs +121 -121
  4. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +84 -84
  5. package/assets/skills/comet/scripts/comet-guard.mjs +152 -152
  6. package/assets/skills/comet/scripts/comet-handoff.mjs +123 -123
  7. package/assets/skills/comet/scripts/comet-hook-guard.mjs +75 -75
  8. package/assets/skills/comet/scripts/comet-hook-router.mjs +91 -91
  9. package/assets/skills/comet/scripts/comet-intent.mjs +6 -6
  10. package/assets/skills/comet/scripts/comet-resume-probe.mjs +79 -79
  11. package/assets/skills/comet/scripts/comet-runtime.mjs +169 -169
  12. package/assets/skills/comet/scripts/comet-state.mjs +88 -88
  13. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +97 -97
  14. package/assets/skills/comet-build/SKILL.md +21 -6
  15. package/assets/skills/comet-design/SKILL.md +2 -2
  16. package/assets/skills/comet-native/SKILL.md +7 -7
  17. package/assets/skills/comet-native/reference/artifacts.md +3 -3
  18. package/assets/skills/comet-native/reference/clarification.md +1 -1
  19. package/assets/skills/comet-native/reference/commands.md +3 -3
  20. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +114 -113
  21. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +123 -123
  22. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +88 -88
  23. package/assets/skills/comet-native/scripts/comet-native-init.mjs +116 -116
  24. package/assets/skills/comet-native/scripts/comet-native-new.mjs +100 -100
  25. package/assets/skills/comet-native/scripts/comet-native-next.mjs +118 -118
  26. package/assets/skills/comet-native/scripts/comet-native-root.mjs +95 -95
  27. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +145 -144
  28. package/assets/skills/comet-native/scripts/comet-native-select.mjs +101 -101
  29. package/assets/skills/comet-native/scripts/comet-native-show.mjs +83 -83
  30. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +87 -87
  31. package/assets/skills/comet-native/scripts/comet-native-status.mjs +98 -98
  32. package/assets/skills/comet-review/SKILL.md +121 -0
  33. package/assets/skills/comet-review/agents/openai.yaml +5 -0
  34. package/assets/skills-zh/comet-build/SKILL.md +21 -6
  35. package/assets/skills-zh/comet-design/SKILL.md +2 -2
  36. package/assets/skills-zh/comet-native/SKILL.md +7 -7
  37. package/assets/skills-zh/comet-native/reference/artifacts.md +3 -3
  38. package/assets/skills-zh/comet-native/reference/clarification.md +1 -1
  39. package/assets/skills-zh/comet-native/reference/commands.md +3 -3
  40. package/assets/skills-zh/comet-review/SKILL.md +121 -0
  41. package/assets/skills-zh/comet-review/agents/openai.yaml +5 -0
  42. package/dist/app/commands/init.d.ts.map +1 -1
  43. package/dist/app/commands/init.js +5 -9
  44. package/dist/app/commands/init.js.map +1 -1
  45. package/dist/app/commands/update.d.ts.map +1 -1
  46. package/dist/app/commands/update.js +5 -9
  47. package/dist/app/commands/update.js.map +1 -1
  48. package/dist/domains/comet-classic/classic-command-context.d.ts +9 -0
  49. package/dist/domains/comet-classic/classic-command-context.d.ts.map +1 -1
  50. package/dist/domains/comet-classic/classic-command-context.js +10 -0
  51. package/dist/domains/comet-classic/classic-command-context.js.map +1 -1
  52. package/dist/domains/comet-classic/classic-guard.d.ts.map +1 -1
  53. package/dist/domains/comet-classic/classic-guard.js +2 -2
  54. package/dist/domains/comet-classic/classic-guard.js.map +1 -1
  55. package/dist/domains/comet-classic/classic-handoff.d.ts.map +1 -1
  56. package/dist/domains/comet-classic/classic-handoff.js +44 -6
  57. package/dist/domains/comet-classic/classic-handoff.js.map +1 -1
  58. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  59. package/dist/domains/comet-classic/classic-hook-guard.js +2 -1
  60. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  61. package/dist/domains/comet-classic/classic-intent-command.d.ts.map +1 -1
  62. package/dist/domains/comet-classic/classic-intent-command.js +2 -1
  63. package/dist/domains/comet-classic/classic-intent-command.js.map +1 -1
  64. package/dist/domains/comet-classic/classic-resume-probe-command.d.ts.map +1 -1
  65. package/dist/domains/comet-classic/classic-resume-probe-command.js +4 -3
  66. package/dist/domains/comet-classic/classic-resume-probe-command.js.map +1 -1
  67. package/dist/domains/comet-classic/classic-runtime-run.d.ts +6 -0
  68. package/dist/domains/comet-classic/classic-runtime-run.d.ts.map +1 -1
  69. package/dist/domains/comet-classic/classic-runtime-run.js +58 -9
  70. package/dist/domains/comet-classic/classic-runtime-run.js.map +1 -1
  71. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  72. package/dist/domains/comet-classic/classic-state-command.js +8 -5
  73. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  74. package/dist/domains/comet-classic/classic-validate-command.d.ts.map +1 -1
  75. package/dist/domains/comet-classic/classic-validate-command.js +2 -2
  76. package/dist/domains/comet-classic/classic-validate-command.js.map +1 -1
  77. package/dist/domains/comet-classic/classic-workspace-command.d.ts.map +1 -1
  78. package/dist/domains/comet-classic/classic-workspace-command.js +3 -3
  79. package/dist/domains/comet-classic/classic-workspace-command.js.map +1 -1
  80. package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
  81. package/dist/domains/comet-entry/hook-adapter.js +4 -1
  82. package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
  83. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
  84. package/dist/domains/comet-native/native-archive-command.js +2 -0
  85. package/dist/domains/comet-native/native-archive-command.js.map +1 -1
  86. package/dist/domains/comet-native/native-atomic-file.d.ts.map +1 -1
  87. package/dist/domains/comet-native/native-atomic-file.js +17 -10
  88. package/dist/domains/comet-native/native-atomic-file.js.map +1 -1
  89. package/dist/domains/comet-native/native-children.d.ts +18 -2
  90. package/dist/domains/comet-native/native-children.d.ts.map +1 -1
  91. package/dist/domains/comet-native/native-children.js +73 -8
  92. package/dist/domains/comet-native/native-children.js.map +1 -1
  93. package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -1
  94. package/dist/domains/comet-native/native-cli-help.js +10 -4
  95. package/dist/domains/comet-native/native-cli-help.js.map +1 -1
  96. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  97. package/dist/domains/comet-native/native-cli-shared.js +18 -5
  98. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  99. package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
  100. package/dist/domains/comet-native/native-hook-guard.js +15 -2
  101. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  102. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
  103. package/dist/domains/comet-native/native-next-command.js +94 -15
  104. package/dist/domains/comet-native/native-next-command.js.map +1 -1
  105. package/dist/domains/comet-native/native-portable-continuation.d.ts +19 -7
  106. package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -1
  107. package/dist/domains/comet-native/native-portable-continuation.js +115 -72
  108. package/dist/domains/comet-native/native-portable-continuation.js.map +1 -1
  109. package/dist/domains/comet-native/native-portable-migration-runtime.d.ts.map +1 -1
  110. package/dist/domains/comet-native/native-portable-migration-runtime.js +9 -4
  111. package/dist/domains/comet-native/native-portable-migration-runtime.js.map +1 -1
  112. package/dist/domains/comet-native/native-portable-runtime.d.ts +14 -1
  113. package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -1
  114. package/dist/domains/comet-native/native-portable-runtime.js +59 -1
  115. package/dist/domains/comet-native/native-portable-runtime.js.map +1 -1
  116. package/dist/domains/comet-native/native-pull-request-finish.d.ts +35 -0
  117. package/dist/domains/comet-native/native-pull-request-finish.d.ts.map +1 -0
  118. package/dist/domains/comet-native/native-pull-request-finish.js +282 -0
  119. package/dist/domains/comet-native/native-pull-request-finish.js.map +1 -0
  120. package/dist/domains/comet-native/native-status-discovery.d.ts.map +1 -1
  121. package/dist/domains/comet-native/native-status-discovery.js +24 -6
  122. package/dist/domains/comet-native/native-status-discovery.js.map +1 -1
  123. package/dist/domains/comet-native/native-workspace-finish.d.ts +6 -0
  124. package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -1
  125. package/dist/domains/comet-native/native-workspace-finish.js +86 -35
  126. package/dist/domains/comet-native/native-workspace-finish.js.map +1 -1
  127. package/dist/domains/dashboard/web/assets/{abnfDiagram-N423BO3Z-B5cFR6hS.js → abnfDiagram-N423BO3Z-BYya6ofk.js} +1 -1
  128. package/dist/domains/dashboard/web/assets/{arc-CVQDtMsu.js → arc-DJbo4TD3.js} +1 -1
  129. package/dist/domains/dashboard/web/assets/{architectureDiagram-T3A2C74G-C0v0kULK.js → architectureDiagram-T3A2C74G-D8uZ2IB-.js} +1 -1
  130. package/dist/domains/dashboard/web/assets/{blockDiagram-VBNYF7ZC-DpHLuxu4.js → blockDiagram-VBNYF7ZC-B16BVj-r.js} +1 -1
  131. package/dist/domains/dashboard/web/assets/{c4Diagram-5PPSVZJV-BHnFxUs1.js → c4Diagram-5PPSVZJV-ayV208_D.js} +1 -1
  132. package/dist/domains/dashboard/web/assets/channel-CEsrvmig.js +1 -0
  133. package/dist/domains/dashboard/web/assets/{chunk-2GRJ4B5K-CGC9gh5n.js → chunk-2GRJ4B5K-Bn5o8p3H.js} +1 -1
  134. package/dist/domains/dashboard/web/assets/{chunk-2Q5K7J3B-l4puLU_O.js → chunk-2Q5K7J3B-BnF1SI6B.js} +1 -1
  135. package/dist/domains/dashboard/web/assets/{chunk-5RXB4S5H-ls9jQHZc.js → chunk-5RXB4S5H-ETnma053.js} +1 -1
  136. package/dist/domains/dashboard/web/assets/{chunk-5VM5RSS4-BVavmTEq.js → chunk-5VM5RSS4-Cuvy639H.js} +1 -1
  137. package/dist/domains/dashboard/web/assets/{chunk-6Q2QTUOP-Dungt2g9.js → chunk-6Q2QTUOP-DOXBzl73.js} +1 -1
  138. package/dist/domains/dashboard/web/assets/{chunk-GF5L2VYU-BidXO_ZP.js → chunk-GF5L2VYU-CfREXlEl.js} +1 -1
  139. package/dist/domains/dashboard/web/assets/{chunk-JWPE2WC7-57L5Up5X.js → chunk-JWPE2WC7-DWIdpYTb.js} +1 -1
  140. package/dist/domains/dashboard/web/assets/{chunk-KBJHAD2P-C5u5vbwr.js → chunk-KBJHAD2P-BnqPcfZB.js} +1 -1
  141. package/dist/domains/dashboard/web/assets/{chunk-RYQCIY6F-CvLz21I2.js → chunk-RYQCIY6F-DdJ00fZz.js} +1 -1
  142. package/dist/domains/dashboard/web/assets/{chunk-XXDRQBXY-D5nJpckG.js → chunk-XXDRQBXY-BVDhdJyW.js} +1 -1
  143. package/dist/domains/dashboard/web/assets/classDiagram-JCYQIIEL-CKFe0hg4.js +1 -0
  144. package/dist/domains/dashboard/web/assets/classDiagram-v2-OCEON4UE-CKFe0hg4.js +1 -0
  145. package/dist/domains/dashboard/web/assets/{cose-bilkent-JH36ORCC-Dp0JAGyE.js → cose-bilkent-JH36ORCC-C-nglwHC.js} +1 -1
  146. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-EjC54l1g.js → cynefin-VYW2F7L2-C8TMmrbP.js} +1 -1
  147. package/dist/domains/dashboard/web/assets/{cynefinDiagram-MW4NZA55-CpYrW3w3.js → cynefinDiagram-MW4NZA55-C3pnQnjg.js} +1 -1
  148. package/dist/domains/dashboard/web/assets/{dagre-VZM6K2ZE-h5K39rCk.js → dagre-VZM6K2ZE-DY7UWiPI.js} +1 -1
  149. package/dist/domains/dashboard/web/assets/{diagram-7IWD3JNH-CKQj9O4H.js → diagram-7IWD3JNH-voTyDkQ5.js} +1 -1
  150. package/dist/domains/dashboard/web/assets/{diagram-B4RE2ZJO-DXRIYcnW.js → diagram-B4RE2ZJO-B3VkUMck.js} +1 -1
  151. package/dist/domains/dashboard/web/assets/{diagram-LBJQPF4R-wWutQYmv.js → diagram-LBJQPF4R-BdJzPkv8.js} +1 -1
  152. package/dist/domains/dashboard/web/assets/{diagram-Q27KOJAE-EgXLJQYi.js → diagram-Q27KOJAE-Bsq0anZx.js} +1 -1
  153. package/dist/domains/dashboard/web/assets/{diagram-UB23O5K3-CsQRXDQZ.js → diagram-UB23O5K3-CBaKRbcu.js} +1 -1
  154. package/dist/domains/dashboard/web/assets/{ebnfDiagram-BXEA7PRR-gm328Eho.js → ebnfDiagram-BXEA7PRR-Bl9Bm5wa.js} +1 -1
  155. package/dist/domains/dashboard/web/assets/{erDiagram-JOGREHBK-BbbMVUx_.js → erDiagram-JOGREHBK-DjOZzfKI.js} +1 -1
  156. package/dist/domains/dashboard/web/assets/{flowDiagram-UKHOOZJN-1Y7scCns.js → flowDiagram-UKHOOZJN-C21e4siK.js} +1 -1
  157. package/dist/domains/dashboard/web/assets/{ganttDiagram-PKOTCBZU-BAoBqczv.js → ganttDiagram-PKOTCBZU-Bs62uy6-.js} +1 -1
  158. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-DS77QQ5N-CMUAyEzl.js → gitGraphDiagram-DS77QQ5N-DQY_Ba00.js} +1 -1
  159. package/dist/domains/dashboard/web/assets/{index-CCApJ0Yr.js → index-BLv71GRj.js} +1 -1
  160. package/dist/domains/dashboard/web/assets/{index-DWdm_XBi.js → index-Be4r99N4.js} +3 -3
  161. package/dist/domains/dashboard/web/assets/index-ByVYiA6g.css +1 -0
  162. package/dist/domains/dashboard/web/assets/{infoDiagram-6WML65LV-BaCdtYYC.js → infoDiagram-6WML65LV-CNgNNG9l.js} +1 -1
  163. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-WSZJBQD7-DQQlNnjU.js → ishikawaDiagram-WSZJBQD7-D9k1fTO1.js} +1 -1
  164. package/dist/domains/dashboard/web/assets/{journeyDiagram-NVQOT4AX-DW9wUMqn.js → journeyDiagram-NVQOT4AX-CHijUnPl.js} +1 -1
  165. package/dist/domains/dashboard/web/assets/{kanban-definition-27J2QSJJ-C_ITaZ0q.js → kanban-definition-27J2QSJJ-DfWlntDq.js} +1 -1
  166. package/dist/domains/dashboard/web/assets/{linear-DXOo6ZRT.js → linear-o6hemX-z.js} +1 -1
  167. package/dist/domains/dashboard/web/assets/{mermaid.core-ol-0NI97.js → mermaid.core-B1DoOsPD.js} +4 -4
  168. package/dist/domains/dashboard/web/assets/{mindmap-definition-FAOFIHXS-CHF_HOLV.js → mindmap-definition-FAOFIHXS-COMQF9Yy.js} +1 -1
  169. package/dist/domains/dashboard/web/assets/{pegDiagram-VL7TDLO6-wQEvkNF8.js → pegDiagram-VL7TDLO6-C_21n7Ps.js} +1 -1
  170. package/dist/domains/dashboard/web/assets/{pieDiagram-7S7Q4E2Y-C3H3kiIP.js → pieDiagram-7S7Q4E2Y-D3EmoYDY.js} +1 -1
  171. package/dist/domains/dashboard/web/assets/{quadrantDiagram-CIZ2JOQS-S0FdVzJb.js → quadrantDiagram-CIZ2JOQS-C3fGdiMa.js} +1 -1
  172. package/dist/domains/dashboard/web/assets/{railroadDiagram-AXF67PYL-DCDXDaVg.js → railroadDiagram-AXF67PYL-mIsjemD-.js} +1 -1
  173. package/dist/domains/dashboard/web/assets/{requirementDiagram-LRYGKXZP-BW8J4gO_.js → requirementDiagram-LRYGKXZP-D_UMpS5e.js} +1 -1
  174. package/dist/domains/dashboard/web/assets/{sankeyDiagram-W5VNT64P-DQQBmLoy.js → sankeyDiagram-W5VNT64P-D1MwyMF6.js} +1 -1
  175. package/dist/domains/dashboard/web/assets/{sequenceDiagram-SI44F4Z6-2tDcli0Y.js → sequenceDiagram-SI44F4Z6-B8jp1RxX.js} +1 -1
  176. package/dist/domains/dashboard/web/assets/{sizeCapture-X5ZJPWSS-4sEZLBKb.js → sizeCapture-X5ZJPWSS-BKioI1Ql.js} +1 -1
  177. package/dist/domains/dashboard/web/assets/{stateDiagram-OKZ733FA-OgPb8pyR.js → stateDiagram-OKZ733FA-B7l8_CDo.js} +1 -1
  178. package/dist/domains/dashboard/web/assets/stateDiagram-v2-UEYNNEHI-BIxuwbeV.js +1 -0
  179. package/dist/domains/dashboard/web/assets/{swimlanes-SLNWSIFB-DR7lwtxd.js → swimlanes-SLNWSIFB-951PRLYp.js} +2 -2
  180. package/dist/domains/dashboard/web/assets/swimlanesDiagram-ULZ7WXOC-CEo6cGsy.js +8 -0
  181. package/dist/domains/dashboard/web/assets/{timeline-definition-Z64GVDOM-DNIJVlQV.js → timeline-definition-Z64GVDOM-CeyA2KbI.js} +1 -1
  182. package/dist/domains/dashboard/web/assets/{vennDiagram-T6HMQDX7-CClhw4QZ.js → vennDiagram-T6HMQDX7-BHe0TZJV.js} +1 -1
  183. package/dist/domains/dashboard/web/assets/{wardleyDiagram-T6FBY63Y-DzR3aFPS.js → wardleyDiagram-T6FBY63Y-CWqdSzJ-.js} +1 -1
  184. package/dist/domains/dashboard/web/assets/{xychartDiagram-ELKLHX3M-DZhq0ZRj.js → xychartDiagram-ELKLHX3M-DCKiZVPV.js} +1 -1
  185. package/dist/domains/dashboard/web/index.html +2 -2
  186. package/dist/domains/dashboard/workspace.d.ts +3 -0
  187. package/dist/domains/dashboard/workspace.d.ts.map +1 -1
  188. package/dist/domains/dashboard/workspace.js +23 -2
  189. package/dist/domains/dashboard/workspace.js.map +1 -1
  190. package/dist/domains/integrations/openspec.d.ts +1 -1
  191. package/dist/domains/integrations/openspec.d.ts.map +1 -1
  192. package/dist/domains/integrations/openspec.js +43 -84
  193. package/dist/domains/integrations/openspec.js.map +1 -1
  194. package/dist/domains/integrations/superpowers.d.ts +10 -1
  195. package/dist/domains/integrations/superpowers.d.ts.map +1 -1
  196. package/dist/domains/integrations/superpowers.js +73 -4
  197. package/dist/domains/integrations/superpowers.js.map +1 -1
  198. package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
  199. package/dist/domains/skill/platform-inspect.js +3 -3
  200. package/dist/domains/skill/platform-inspect.js.map +1 -1
  201. package/dist/domains/skill/platform-install.d.ts +3 -1
  202. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  203. package/dist/domains/skill/platform-install.js +15 -9
  204. package/dist/domains/skill/platform-install.js.map +1 -1
  205. package/dist/domains/skill/project-instructions.d.ts.map +1 -1
  206. package/dist/domains/skill/project-instructions.js +6 -0
  207. package/dist/domains/skill/project-instructions.js.map +1 -1
  208. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  209. package/dist/domains/skill/uninstall.js +39 -29
  210. package/dist/domains/skill/uninstall.js.map +1 -1
  211. package/dist/domains/workflow-contract/contained-atomic-write.d.ts.map +1 -1
  212. package/dist/domains/workflow-contract/contained-atomic-write.js +18 -10
  213. package/dist/domains/workflow-contract/contained-atomic-write.js.map +1 -1
  214. package/dist/domains/workflow-contract/project-config.d.ts +4 -2
  215. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  216. package/dist/domains/workflow-contract/project-config.js +132 -0
  217. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  218. package/dist/domains/workflow-contract/types.d.ts +9 -0
  219. package/dist/domains/workflow-contract/types.d.ts.map +1 -1
  220. package/dist/platform/fs/strip-bom.d.ts +10 -0
  221. package/dist/platform/fs/strip-bom.d.ts.map +1 -0
  222. package/dist/platform/fs/strip-bom.js +12 -0
  223. package/dist/platform/fs/strip-bom.js.map +1 -0
  224. package/dist/platform/install/platforms.d.ts +11 -0
  225. package/dist/platform/install/platforms.d.ts.map +1 -1
  226. package/dist/platform/install/platforms.js +36 -0
  227. package/dist/platform/install/platforms.js.map +1 -1
  228. package/dist/platform/process/external-command.d.ts +1 -0
  229. package/dist/platform/process/external-command.d.ts.map +1 -1
  230. package/dist/platform/process/external-command.js +2 -1
  231. package/dist/platform/process/external-command.js.map +1 -1
  232. package/eval/local/tests/conftest.py +18 -3
  233. package/eval/local/tests/scaffold/test_conftest_helpers.py +57 -0
  234. package/package.json +11 -26
  235. package/dist/domains/dashboard/web/assets/channel-eM0x3m1G.js +0 -1
  236. package/dist/domains/dashboard/web/assets/classDiagram-JCYQIIEL-CEFhao2K.js +0 -1
  237. package/dist/domains/dashboard/web/assets/classDiagram-v2-OCEON4UE-CEFhao2K.js +0 -1
  238. package/dist/domains/dashboard/web/assets/index-DhhbseFJ.css +0 -1
  239. package/dist/domains/dashboard/web/assets/stateDiagram-v2-UEYNNEHI-CiDNPr4P.js +0 -1
  240. package/dist/domains/dashboard/web/assets/swimlanesDiagram-ULZ7WXOC-DggHFP9q.js +0 -8
  241. package/eval/local/tasks/comet-native-interrupted-transition/environment/.comet/config.yaml +0 -6
@@ -1,77 +1,77 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var Lu=Object.create;var Eo=Object.defineProperty;var Mu=Object.getOwnPropertyDescriptor;var Fu=Object.getOwnPropertyNames;var Vu=Object.getPrototypeOf,qu=Object.prototype.hasOwnProperty;var bi=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var N=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}};var Wu=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Fu(e))!qu.call(t,n)&&n!==i&&Eo(t,n,{get:()=>e[n],enumerable:!(r=Mu(e,n))||r.enumerable});return t};var Ct=(t,e,i)=>(i=t!=null?Lu(Vu(t)):{},Wu(e||!t||!t.__esModule?Eo(i,"default",{value:t,enumerable:!0}):i,t));var x=N(H=>{"use strict";var tn=Symbol.for("yaml.alias"),Po=Symbol.for("yaml.document"),ki=Symbol.for("yaml.map"),xo=Symbol.for("yaml.pair"),rn=Symbol.for("yaml.scalar"),Si=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),zu=t=>!!t&&typeof t=="object"&&t[ge]===tn,Ju=t=>!!t&&typeof t=="object"&&t[ge]===Po,Gu=t=>!!t&&typeof t=="object"&&t[ge]===ki,Uu=t=>!!t&&typeof t=="object"&&t[ge]===xo,Co=t=>!!t&&typeof t=="object"&&t[ge]===rn,Ku=t=>!!t&&typeof t=="object"&&t[ge]===Si;function Ro(t){if(t&&typeof t=="object")switch(t[ge]){case ki:case Si:return!0}return!1}function Yu(t){if(t&&typeof t=="object")switch(t[ge]){case tn:case ki:case rn:case Si:return!0}return!1}var Xu=t=>(Co(t)||Ro(t))&&!!t.anchor;H.ALIAS=tn;H.DOC=Po;H.MAP=ki;H.NODE_TYPE=ge;H.PAIR=xo;H.SCALAR=rn;H.SEQ=Si;H.hasAnchor=Xu;H.isAlias=zu;H.isCollection=Ro;H.isDocument=Ju;H.isMap=Gu;H.isNode=Yu;H.isPair=Uu;H.isScalar=Co;H.isSeq=Ku});var Rt=N(nn=>{"use strict";var $=x(),V=Symbol("break visit"),Ao=Symbol("skip children"),ue=Symbol("remove node");function Ei(t,e){let i=_o(e);$.isDocument(t)?nt(null,t.contents,i,Object.freeze([t]))===ue&&(t.contents=null):nt(null,t,i,Object.freeze([]))}Ei.BREAK=V;Ei.SKIP=Ao;Ei.REMOVE=ue;function nt(t,e,i,r){let n=To(t,e,i,r);if($.isNode(n)||$.isPair(n))return Io(t,r,n),nt(t,n,i,r);if(typeof n!="symbol"){if($.isCollection(e)){r=Object.freeze(r.concat(e));for(let a=0;a<e.items.length;++a){let o=nt(a,e.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===V)return V;o===ue&&(e.items.splice(a,1),a-=1)}}}else if($.isPair(e)){r=Object.freeze(r.concat(e));let a=nt("key",e.key,i,r);if(a===V)return V;a===ue&&(e.key=null);let o=nt("value",e.value,i,r);if(o===V)return V;o===ue&&(e.value=null)}}return n}async function Pi(t,e){let i=_o(e);$.isDocument(t)?await at(null,t.contents,i,Object.freeze([t]))===ue&&(t.contents=null):await at(null,t,i,Object.freeze([]))}Pi.BREAK=V;Pi.SKIP=Ao;Pi.REMOVE=ue;async function at(t,e,i,r){let n=await To(t,e,i,r);if($.isNode(n)||$.isPair(n))return Io(t,r,n),at(t,n,i,r);if(typeof n!="symbol"){if($.isCollection(e)){r=Object.freeze(r.concat(e));for(let a=0;a<e.items.length;++a){let o=await at(a,e.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===V)return V;o===ue&&(e.items.splice(a,1),a-=1)}}}else if($.isPair(e)){r=Object.freeze(r.concat(e));let a=await at("key",e.key,i,r);if(a===V)return V;a===ue&&(e.key=null);let o=await at("value",e.value,i,r);if(o===V)return V;o===ue&&(e.value=null)}}return n}function _o(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function To(t,e,i,r){if(typeof i=="function")return i(t,e,r);if($.isMap(e))return i.Map?.(t,e,r);if($.isSeq(e))return i.Seq?.(t,e,r);if($.isPair(e))return i.Pair?.(t,e,r);if($.isScalar(e))return i.Scalar?.(t,e,r);if($.isAlias(e))return i.Alias?.(t,e,r)}function Io(t,e,i){let r=e[e.length-1];if($.isCollection(r))r.items[t]=i;else if($.isPair(r))t==="key"?r.key=i:r.value=i;else if($.isDocument(r))r.contents=i;else{let n=$.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}nn.visit=Ei;nn.visitAsync=Pi});var an=N($o=>{"use strict";var jo=x(),Qu=Rt(),Zu={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ed=t=>t.replace(/[!,[\]{}]/g,e=>Zu[e]),At=class t{constructor(e,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,i)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,i){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[a,o]=r;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[a]=r;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return i(6,`Unsupported YAML version ${a}`,o),!1}}default:return i(0,`Unknown directive ${n}`,!0),!1}}tagName(e,i){if(e==="!")return"!";if(e[0]!=="!")return i(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,r,n]=e.match(/^(.*!)([^!]*)$/s);n||i(`The ${e} tag has no suffix`);let a=this.tags[r];if(a)try{return a+decodeURIComponent(n)}catch(o){return i(String(o)),null}return r==="!"?e:(i(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[i,r]of Object.entries(this.tags))if(e.startsWith(r))return i+ed(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(e&&r.length>0&&jo.isNode(e.contents)){let a={};Qu.visit(e.contents,(o,s)=>{jo.isNode(s)&&s.tag&&(a[s.tag]=!0)}),n=Object.keys(a)}else n=[];for(let[a,o]of r)a==="!!"&&o==="tag:yaml.org,2002:"||(!e||n.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
5
- `)}};At.defaultYaml={explicit:!1,version:"1.2"};At.defaultTags={"!!":"tag:yaml.org,2002:"};$o.Directives=At});var xi=N(_t=>{"use strict";var Oo=x(),td=Rt();function id(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(i)}return!0}function Ho(t){let e=new Set;return td.visit(t,{Value(i,r){r.anchor&&e.add(r.anchor)}}),e}function Do(t,e){for(let i=1;;++i){let r=`${t}${i}`;if(!e.has(r))return r}}function rd(t,e){let i=[],r=new Map,n=null;return{onAnchor:a=>{i.push(a),n??(n=Ho(t));let o=Do(e,n);return n.add(o),o},setAnchors:()=>{for(let a of i){let o=r.get(a);if(typeof o=="object"&&o.anchor&&(Oo.isScalar(o.node)||Oo.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}}_t.anchorIsValid=id;_t.anchorNames=Ho;_t.createNodeAnchors=rd;_t.findNewAnchor=Do});var on=N(Bo=>{"use strict";function Tt(t,e,i,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let n=0,a=r.length;n<a;++n){let o=r[n],s=Tt(t,r,String(n),o);s===void 0?delete r[n]:s!==o&&(r[n]=s)}else if(r instanceof Map)for(let n of Array.from(r.keys())){let a=r.get(n),o=Tt(t,r,n,a);o===void 0?r.delete(n):o!==a&&r.set(n,o)}else if(r instanceof Set)for(let n of Array.from(r)){let a=Tt(t,r,n,n);a===void 0?r.delete(n):a!==n&&(r.delete(n),r.add(a))}else for(let[n,a]of Object.entries(r)){let o=Tt(t,r,n,a);o===void 0?delete r[n]:o!==a&&(r[n]=o)}return t.call(e,i,r)}Bo.applyReviver=Tt});var be=N(Mo=>{"use strict";var nd=x();function Lo(t,e,i){if(Array.isArray(t))return t.map((r,n)=>Lo(r,String(n),i));if(t&&typeof t.toJSON=="function"){if(!i||!nd.hasAnchor(t))return t.toJSON(e,i);let r={aliasCount:0,count:1,res:void 0};i.anchors.set(t,r),i.onCreate=a=>{r.res=a,delete i.onCreate};let n=t.toJSON(e,i);return i.onCreate&&i.onCreate(n),n}return typeof t=="bigint"&&!i?.keep?Number(t):t}Mo.toJS=Lo});var Ci=N(Vo=>{"use strict";var ad=on(),Fo=x(),od=be(),sn=class{constructor(e){Object.defineProperty(this,Fo.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:r,onAnchor:n,reviver:a}={}){if(!Fo.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},s=od.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:l}of o.anchors.values())n(l,c);return typeof a=="function"?ad.applyReviver(a,{"":s},"",s):s}};Vo.NodeBase=sn});var It=N(qo=>{"use strict";var sd=xi(),cd=Rt(),ot=x(),ld=Ci(),ud=be(),cn=class extends ld.NodeBase{constructor(e){super(ot.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;i?.aliasResolveCache?r=i.aliasResolveCache:(r=[],cd.visit(e,{Node:(a,o)=>{(ot.isAlias(o)||ot.hasAnchor(o))&&r.push(o)}}),i&&(i.aliasResolveCache=r));let n;for(let a of r){if(a===this)break;a.anchor===this.source&&(n=a)}return n}toJSON(e,i){if(!i)return{source:this.source};let{anchors:r,doc:n,maxAliasCount:a}=i,o=this.resolve(n,i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=r.get(o);if(s||(ud.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=Ri(n,o,r)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(e,i,r){let n=`*${this.source}`;if(e){if(sd.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(e.implicitKey)return`${n} `}return n}};function Ri(t,e,i){if(ot.isAlias(e)){let r=e.resolve(t),n=i&&r&&i.get(r);return n?n.count*n.aliasCount:0}else if(ot.isCollection(e)){let r=0;for(let n of e.items){let a=Ri(t,n,i);a>r&&(r=a)}return r}else if(ot.isPair(e)){let r=Ri(t,e.key,i),n=Ri(t,e.value,i);return Math.max(r,n)}return 1}qo.Alias=cn});var T=N(ln=>{"use strict";var dd=x(),fd=Ci(),hd=be(),pd=t=>!t||typeof t!="function"&&typeof t!="object",ke=class extends fd.NodeBase{constructor(e){super(dd.SCALAR),this.value=e}toJSON(e,i){return i?.keep?this.value:hd.toJS(this.value,e,i)}toString(){return String(this.value)}};ke.BLOCK_FOLDED="BLOCK_FOLDED";ke.BLOCK_LITERAL="BLOCK_LITERAL";ke.PLAIN="PLAIN";ke.QUOTE_DOUBLE="QUOTE_DOUBLE";ke.QUOTE_SINGLE="QUOTE_SINGLE";ln.Scalar=ke;ln.isScalarValue=pd});var jt=N(zo=>{"use strict";var md=It(),Ve=x(),Wo=T(),vd="tag:yaml.org,2002:";function gd(t,e,i){if(e){let r=i.filter(a=>a.tag===e),n=r.find(a=>!a.format)??r[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return i.find(r=>r.identify?.(t)&&!r.format)}function wd(t,e,i){if(Ve.isDocument(t)&&(t=t.contents),Ve.isNode(t))return t;if(Ve.isPair(t)){let f=i.schema[Ve.MAP].createNode?.(i.schema,null,i);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:n,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(r&&t&&typeof t=="object"){if(c=s.get(t),c)return c.anchor??(c.anchor=n(t)),new md.Alias(c.anchor);c={anchor:null,node:null},s.set(t,c)}e?.startsWith("!!")&&(e=vd+e.slice(2));let l=gd(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new Wo.Scalar(t);return c&&(c.node=f),f}l=t instanceof Map?o[Ve.MAP]:Symbol.iterator in Object(t)?o[Ve.SEQ]:o[Ve.MAP]}a&&(a(l),delete i.onTagObj);let d=l?.createNode?l.createNode(i.schema,t,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,t,i):new Wo.Scalar(t);return e?d.tag=e:l.default||(d.tag=l.tag),c&&(c.node=d),d}zo.createNode=wd});var _i=N(Ai=>{"use strict";var yd=jt(),de=x(),Nd=Ci();function un(t,e,i){let r=i;for(let n=e.length-1;n>=0;--n){let a=e[n];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=r,r=o}else r=new Map([[a,r]])}return yd.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Jo=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,dn=class extends Nd.NodeBase{constructor(e,i){super(e),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(e){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(i.schema=e),i.items=i.items.map(r=>de.isNode(r)||de.isPair(r)?r.clone(e):r),this.range&&(i.range=this.range.slice()),i}addIn(e,i){if(Jo(e))this.add(i);else{let[r,...n]=e,a=this.get(r,!0);if(de.isCollection(a))a.addIn(n,i);else if(a===void 0&&this.schema)this.set(r,un(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(e){let[i,...r]=e;if(r.length===0)return this.delete(i);let n=this.get(i,!0);if(de.isCollection(n))return n.deleteIn(r);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}getIn(e,i){let[r,...n]=e,a=this.get(r,!0);return n.length===0?!i&&de.isScalar(a)?a.value:a:de.isCollection(a)?a.getIn(n,i):void 0}hasAllNullValues(e){return this.items.every(i=>{if(!de.isPair(i))return!1;let r=i.value;return r==null||e&&de.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[i,...r]=e;if(r.length===0)return this.has(i);let n=this.get(i,!0);return de.isCollection(n)?n.hasIn(r):!1}setIn(e,i){let[r,...n]=e;if(n.length===0)this.set(r,i);else{let a=this.get(r,!0);if(de.isCollection(a))a.setIn(n,i);else if(a===void 0&&this.schema)this.set(r,un(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}};Ai.Collection=dn;Ai.collectionFromPath=un;Ai.isEmptyPath=Jo});var $t=N(Ti=>{"use strict";var bd=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function fn(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var kd=(t,e,i)=>t.endsWith(`
6
- `)?fn(i,e):i.includes(`
4
+ var Uu=Object.create;var Io=Object.defineProperty;var Ku=Object.getOwnPropertyDescriptor;var Yu=Object.getOwnPropertyNames;var Xu=Object.getPrototypeOf,Qu=Object.prototype.hasOwnProperty;var Ei=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var N=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}};var Zu=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Yu(e))!Qu.call(t,n)&&n!==i&&Io(t,n,{get:()=>e[n],enumerable:!(r=Ku(e,n))||r.enumerable});return t};var Rt=(t,e,i)=>(i=t!=null?Uu(Xu(t)):{},Zu(e||!t||!t.__esModule?Io(i,"default",{value:t,enumerable:!0}):i,t));var P=N(H=>{"use strict";var ln=Symbol.for("yaml.alias"),jo=Symbol.for("yaml.document"),xi=Symbol.for("yaml.map"),$o=Symbol.for("yaml.pair"),un=Symbol.for("yaml.scalar"),Pi=Symbol.for("yaml.seq"),ve=Symbol.for("yaml.node.type"),ed=t=>!!t&&typeof t=="object"&&t[ve]===ln,td=t=>!!t&&typeof t=="object"&&t[ve]===jo,id=t=>!!t&&typeof t=="object"&&t[ve]===xi,rd=t=>!!t&&typeof t=="object"&&t[ve]===$o,Oo=t=>!!t&&typeof t=="object"&&t[ve]===un,nd=t=>!!t&&typeof t=="object"&&t[ve]===Pi;function Ho(t){if(t&&typeof t=="object")switch(t[ve]){case xi:case Pi:return!0}return!1}function ad(t){if(t&&typeof t=="object")switch(t[ve]){case ln:case xi:case un:case Pi:return!0}return!1}var od=t=>(Oo(t)||Ho(t))&&!!t.anchor;H.ALIAS=ln;H.DOC=jo;H.MAP=xi;H.NODE_TYPE=ve;H.PAIR=$o;H.SCALAR=un;H.SEQ=Pi;H.hasAnchor=od;H.isAlias=ed;H.isCollection=Ho;H.isDocument=td;H.isMap=id;H.isNode=ad;H.isPair=rd;H.isScalar=Oo;H.isSeq=nd});var At=N(dn=>{"use strict";var $=P(),V=Symbol("break visit"),Do=Symbol("skip children"),le=Symbol("remove node");function Ci(t,e){let i=Bo(e);$.isDocument(t)?at(null,t.contents,i,Object.freeze([t]))===le&&(t.contents=null):at(null,t,i,Object.freeze([]))}Ci.BREAK=V;Ci.SKIP=Do;Ci.REMOVE=le;function at(t,e,i,r){let n=Lo(t,e,i,r);if($.isNode(n)||$.isPair(n))return Mo(t,r,n),at(t,n,i,r);if(typeof n!="symbol"){if($.isCollection(e)){r=Object.freeze(r.concat(e));for(let a=0;a<e.items.length;++a){let o=at(a,e.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===V)return V;o===le&&(e.items.splice(a,1),a-=1)}}}else if($.isPair(e)){r=Object.freeze(r.concat(e));let a=at("key",e.key,i,r);if(a===V)return V;a===le&&(e.key=null);let o=at("value",e.value,i,r);if(o===V)return V;o===le&&(e.value=null)}}return n}async function Ri(t,e){let i=Bo(e);$.isDocument(t)?await ot(null,t.contents,i,Object.freeze([t]))===le&&(t.contents=null):await ot(null,t,i,Object.freeze([]))}Ri.BREAK=V;Ri.SKIP=Do;Ri.REMOVE=le;async function ot(t,e,i,r){let n=await Lo(t,e,i,r);if($.isNode(n)||$.isPair(n))return Mo(t,r,n),ot(t,n,i,r);if(typeof n!="symbol"){if($.isCollection(e)){r=Object.freeze(r.concat(e));for(let a=0;a<e.items.length;++a){let o=await ot(a,e.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===V)return V;o===le&&(e.items.splice(a,1),a-=1)}}}else if($.isPair(e)){r=Object.freeze(r.concat(e));let a=await ot("key",e.key,i,r);if(a===V)return V;a===le&&(e.key=null);let o=await ot("value",e.value,i,r);if(o===V)return V;o===le&&(e.value=null)}}return n}function Bo(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Lo(t,e,i,r){if(typeof i=="function")return i(t,e,r);if($.isMap(e))return i.Map?.(t,e,r);if($.isSeq(e))return i.Seq?.(t,e,r);if($.isPair(e))return i.Pair?.(t,e,r);if($.isScalar(e))return i.Scalar?.(t,e,r);if($.isAlias(e))return i.Alias?.(t,e,r)}function Mo(t,e,i){let r=e[e.length-1];if($.isCollection(r))r.items[t]=i;else if($.isPair(r))t==="key"?r.key=i:r.value=i;else if($.isDocument(r))r.contents=i;else{let n=$.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}dn.visit=Ci;dn.visitAsync=Ri});var fn=N(Vo=>{"use strict";var Fo=P(),sd=At(),cd={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ld=t=>t.replace(/[!,[\]{}]/g,e=>cd[e]),_t=class t{constructor(e,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,i)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,i){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[a,o]=r;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[a]=r;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return i(6,`Unsupported YAML version ${a}`,o),!1}}default:return i(0,`Unknown directive ${n}`,!0),!1}}tagName(e,i){if(e==="!")return"!";if(e[0]!=="!")return i(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,r,n]=e.match(/^(.*!)([^!]*)$/s);n||i(`The ${e} tag has no suffix`);let a=this.tags[r];if(a)try{return a+decodeURIComponent(n)}catch(o){return i(String(o)),null}return r==="!"?e:(i(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[i,r]of Object.entries(this.tags))if(e.startsWith(r))return i+ld(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(e&&r.length>0&&Fo.isNode(e.contents)){let a={};sd.visit(e.contents,(o,s)=>{Fo.isNode(s)&&s.tag&&(a[s.tag]=!0)}),n=Object.keys(a)}else n=[];for(let[a,o]of r)a==="!!"&&o==="tag:yaml.org,2002:"||(!e||n.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
5
+ `)}};_t.defaultYaml={explicit:!1,version:"1.2"};_t.defaultTags={"!!":"tag:yaml.org,2002:"};Vo.Directives=_t});var Ai=N(Tt=>{"use strict";var qo=P(),ud=At();function dd(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(i)}return!0}function Wo(t){let e=new Set;return ud.visit(t,{Value(i,r){r.anchor&&e.add(r.anchor)}}),e}function zo(t,e){for(let i=1;;++i){let r=`${t}${i}`;if(!e.has(r))return r}}function fd(t,e){let i=[],r=new Map,n=null;return{onAnchor:a=>{i.push(a),n??(n=Wo(t));let o=zo(e,n);return n.add(o),o},setAnchors:()=>{for(let a of i){let o=r.get(a);if(typeof o=="object"&&o.anchor&&(qo.isScalar(o.node)||qo.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}}Tt.anchorIsValid=dd;Tt.anchorNames=Wo;Tt.createNodeAnchors=fd;Tt.findNewAnchor=zo});var hn=N(Jo=>{"use strict";function It(t,e,i,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let n=0,a=r.length;n<a;++n){let o=r[n],s=It(t,r,String(n),o);s===void 0?delete r[n]:s!==o&&(r[n]=s)}else if(r instanceof Map)for(let n of Array.from(r.keys())){let a=r.get(n),o=It(t,r,n,a);o===void 0?r.delete(n):o!==a&&r.set(n,o)}else if(r instanceof Set)for(let n of Array.from(r)){let a=It(t,r,n,n);a===void 0?r.delete(n):a!==n&&(r.delete(n),r.add(a))}else for(let[n,a]of Object.entries(r)){let o=It(t,r,n,a);o===void 0?delete r[n]:o!==a&&(r[n]=o)}return t.call(e,i,r)}Jo.applyReviver=It});var be=N(Uo=>{"use strict";var hd=P();function Go(t,e,i){if(Array.isArray(t))return t.map((r,n)=>Go(r,String(n),i));if(t&&typeof t.toJSON=="function"){if(!i||!hd.hasAnchor(t))return t.toJSON(e,i);let r={aliasCount:0,count:1,res:void 0};i.anchors.set(t,r),i.onCreate=a=>{r.res=a,delete i.onCreate};let n=t.toJSON(e,i);return i.onCreate&&i.onCreate(n),n}return typeof t=="bigint"&&!i?.keep?Number(t):t}Uo.toJS=Go});var _i=N(Yo=>{"use strict";var pd=hn(),Ko=P(),md=be(),pn=class{constructor(e){Object.defineProperty(this,Ko.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:r,onAnchor:n,reviver:a}={}){if(!Ko.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},s=md.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:l}of o.anchors.values())n(l,c);return typeof a=="function"?pd.applyReviver(a,{"":s},"",s):s}};Yo.NodeBase=pn});var jt=N(Xo=>{"use strict";var vd=Ai(),gd=At(),st=P(),wd=_i(),yd=be(),mn=class extends wd.NodeBase{constructor(e){super(st.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;i?.aliasResolveCache?r=i.aliasResolveCache:(r=[],gd.visit(e,{Node:(a,o)=>{(st.isAlias(o)||st.hasAnchor(o))&&r.push(o)}}),i&&(i.aliasResolveCache=r));let n;for(let a of r){if(a===this)break;a.anchor===this.source&&(n=a)}return n}toJSON(e,i){if(!i)return{source:this.source};let{anchors:r,doc:n,maxAliasCount:a}=i,o=this.resolve(n,i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=r.get(o);if(s||(yd.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=Ti(n,o,r)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(e,i,r){let n=`*${this.source}`;if(e){if(vd.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(e.implicitKey)return`${n} `}return n}};function Ti(t,e,i){if(st.isAlias(e)){let r=e.resolve(t),n=i&&r&&i.get(r);return n?n.count*n.aliasCount:0}else if(st.isCollection(e)){let r=0;for(let n of e.items){let a=Ti(t,n,i);a>r&&(r=a)}return r}else if(st.isPair(e)){let r=Ti(t,e.key,i),n=Ti(t,e.value,i);return Math.max(r,n)}return 1}Xo.Alias=mn});var T=N(vn=>{"use strict";var Nd=P(),bd=_i(),kd=be(),Sd=t=>!t||typeof t!="function"&&typeof t!="object",ke=class extends bd.NodeBase{constructor(e){super(Nd.SCALAR),this.value=e}toJSON(e,i){return i?.keep?this.value:kd.toJS(this.value,e,i)}toString(){return String(this.value)}};ke.BLOCK_FOLDED="BLOCK_FOLDED";ke.BLOCK_LITERAL="BLOCK_LITERAL";ke.PLAIN="PLAIN";ke.QUOTE_DOUBLE="QUOTE_DOUBLE";ke.QUOTE_SINGLE="QUOTE_SINGLE";vn.Scalar=ke;vn.isScalarValue=Sd});var $t=N(Zo=>{"use strict";var Ed=jt(),qe=P(),Qo=T(),xd="tag:yaml.org,2002:";function Pd(t,e,i){if(e){let r=i.filter(a=>a.tag===e),n=r.find(a=>!a.format)??r[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return i.find(r=>r.identify?.(t)&&!r.format)}function Cd(t,e,i){if(qe.isDocument(t)&&(t=t.contents),qe.isNode(t))return t;if(qe.isPair(t)){let f=i.schema[qe.MAP].createNode?.(i.schema,null,i);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:n,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(r&&t&&typeof t=="object"){if(c=s.get(t),c)return c.anchor??(c.anchor=n(t)),new Ed.Alias(c.anchor);c={anchor:null,node:null},s.set(t,c)}e?.startsWith("!!")&&(e=xd+e.slice(2));let l=Pd(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new Qo.Scalar(t);return c&&(c.node=f),f}l=t instanceof Map?o[qe.MAP]:Symbol.iterator in Object(t)?o[qe.SEQ]:o[qe.MAP]}a&&(a(l),delete i.onTagObj);let d=l?.createNode?l.createNode(i.schema,t,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,t,i):new Qo.Scalar(t);return e?d.tag=e:l.default||(d.tag=l.tag),c&&(c.node=d),d}Zo.createNode=Cd});var ji=N(Ii=>{"use strict";var Rd=$t(),ue=P(),Ad=_i();function gn(t,e,i){let r=i;for(let n=e.length-1;n>=0;--n){let a=e[n];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=r,r=o}else r=new Map([[a,r]])}return Rd.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var es=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,wn=class extends Ad.NodeBase{constructor(e,i){super(e),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(e){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(i.schema=e),i.items=i.items.map(r=>ue.isNode(r)||ue.isPair(r)?r.clone(e):r),this.range&&(i.range=this.range.slice()),i}addIn(e,i){if(es(e))this.add(i);else{let[r,...n]=e,a=this.get(r,!0);if(ue.isCollection(a))a.addIn(n,i);else if(a===void 0&&this.schema)this.set(r,gn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(e){let[i,...r]=e;if(r.length===0)return this.delete(i);let n=this.get(i,!0);if(ue.isCollection(n))return n.deleteIn(r);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}getIn(e,i){let[r,...n]=e,a=this.get(r,!0);return n.length===0?!i&&ue.isScalar(a)?a.value:a:ue.isCollection(a)?a.getIn(n,i):void 0}hasAllNullValues(e){return this.items.every(i=>{if(!ue.isPair(i))return!1;let r=i.value;return r==null||e&&ue.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[i,...r]=e;if(r.length===0)return this.has(i);let n=this.get(i,!0);return ue.isCollection(n)?n.hasIn(r):!1}setIn(e,i){let[r,...n]=e;if(n.length===0)this.set(r,i);else{let a=this.get(r,!0);if(ue.isCollection(a))a.setIn(n,i);else if(a===void 0&&this.schema)this.set(r,gn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}};Ii.Collection=wn;Ii.collectionFromPath=gn;Ii.isEmptyPath=es});var Ot=N($i=>{"use strict";var _d=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function yn(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Td=(t,e,i)=>t.endsWith(`
6
+ `)?yn(i,e):i.includes(`
7
7
  `)?`
8
- `+fn(i,e):(t.endsWith(" ")?"":" ")+i;Ti.indentComment=fn;Ti.lineComment=kd;Ti.stringifyComment=bd});var Uo=N(Ot=>{"use strict";var Sd="flow",hn="block",Ii="quoted";function Ed(t,e,i="flow",{indentAtStart:r,lineWidth:n=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!n||n<0)return t;n<a&&(a=0);let c=Math.max(1+a,1+n-e.length);if(t.length<=c)return t;let l=[],d={},f=n-e.length;typeof r=="number"&&(r>n-Math.max(2,a)?l.push(0):f=n-r);let h,m,w=!1,u=-1,p=-1,g=-1;i===hn&&(u=Go(t,u,e.length),u!==-1&&(f=u+c));for(let b;b=t[u+=1];){if(i===Ii&&b==="\\"){switch(p=u,t[u+1]){case"x":u+=3;break;case"u":u+=5;break;case"U":u+=9;break;default:u+=1}g=u}if(b===`
9
- `)i===hn&&(u=Go(t,u,e.length)),f=u+e.length+c,h=void 0;else{if(b===" "&&m&&m!==" "&&m!==`
8
+ `+yn(i,e):(t.endsWith(" ")?"":" ")+i;$i.indentComment=yn;$i.lineComment=Td;$i.stringifyComment=_d});var is=N(Ht=>{"use strict";var Id="flow",Nn="block",Oi="quoted";function jd(t,e,i="flow",{indentAtStart:r,lineWidth:n=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!n||n<0)return t;n<a&&(a=0);let c=Math.max(1+a,1+n-e.length);if(t.length<=c)return t;let l=[],d={},f=n-e.length;typeof r=="number"&&(r>n-Math.max(2,a)?l.push(0):f=n-r);let h,m,w=!1,u=-1,p=-1,g=-1;i===Nn&&(u=ts(t,u,e.length),u!==-1&&(f=u+c));for(let b;b=t[u+=1];){if(i===Oi&&b==="\\"){switch(p=u,t[u+1]){case"x":u+=3;break;case"u":u+=5;break;case"U":u+=9;break;default:u+=1}g=u}if(b===`
9
+ `)i===Nn&&(u=ts(t,u,e.length)),f=u+e.length+c,h=void 0;else{if(b===" "&&m&&m!==" "&&m!==`
10
10
  `&&m!==" "){let S=t[u+1];S&&S!==" "&&S!==`
11
- `&&S!==" "&&(h=u)}if(u>=f)if(h)l.push(h),f=h+c,h=void 0;else if(i===Ii){for(;m===" "||m===" ";)m=b,b=t[u+=1],w=!0;let S=u>g+1?u-2:p-1;if(d[S])return t;l.push(S),d[S]=!0,f=S+c,h=void 0}else w=!0}m=b}if(w&&s&&s(),l.length===0)return t;o&&o();let y=t.slice(0,l[0]);for(let b=0;b<l.length;++b){let S=l[b],E=l[b+1]||t.length;S===0?y=`
12
- ${e}${t.slice(0,E)}`:(i===Ii&&d[S]&&(y+=`${t[S]}\\`),y+=`
13
- ${e}${t.slice(S+1,E)}`)}return y}function Go(t,e,i){let r=e,n=e+1,a=t[n];for(;a===" "||a===" ";)if(e<n+i)a=t[++e];else{do a=t[++e];while(a&&a!==`
14
- `);r=e,n=e+1,a=t[n]}return r}Ot.FOLD_BLOCK=hn;Ot.FOLD_FLOW=Sd;Ot.FOLD_QUOTED=Ii;Ot.foldFlowLines=Ed});var Dt=N(Ko=>{"use strict";var ie=T(),Se=Uo(),$i=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Oi=t=>/^(%|---|\.\.\.)/m.test(t);function Pd(t,e,i){if(!e||e<0)return!1;let r=e-i,n=t.length;if(n<=r)return!1;for(let a=0,o=0;a<n;++a)if(t[a]===`
15
- `){if(a-o>r)return!0;if(o=a+1,n-o<=r)return!1}return!0}function Ht(t,e){let i=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return i;let{implicitKey:r}=e,n=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(Oi(t)?" ":""),o="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(o+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{o+=i.slice(s,c);let d=i.substr(c+2,4);switch(d){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=i.substr(c,6)}c+=5,s=c+1}break;case"n":if(r||i[c+2]==='"'||i.length<n)c+=1;else{for(o+=i.slice(s,c)+`
11
+ `&&S!==" "&&(h=u)}if(u>=f)if(h)l.push(h),f=h+c,h=void 0;else if(i===Oi){for(;m===" "||m===" ";)m=b,b=t[u+=1],w=!0;let S=u>g+1?u-2:p-1;if(d[S])return t;l.push(S),d[S]=!0,f=S+c,h=void 0}else w=!0}m=b}if(w&&s&&s(),l.length===0)return t;o&&o();let y=t.slice(0,l[0]);for(let b=0;b<l.length;++b){let S=l[b],E=l[b+1]||t.length;S===0?y=`
12
+ ${e}${t.slice(0,E)}`:(i===Oi&&d[S]&&(y+=`${t[S]}\\`),y+=`
13
+ ${e}${t.slice(S+1,E)}`)}return y}function ts(t,e,i){let r=e,n=e+1,a=t[n];for(;a===" "||a===" ";)if(e<n+i)a=t[++e];else{do a=t[++e];while(a&&a!==`
14
+ `);r=e,n=e+1,a=t[n]}return r}Ht.FOLD_BLOCK=Nn;Ht.FOLD_FLOW=Id;Ht.FOLD_QUOTED=Oi;Ht.foldFlowLines=jd});var Bt=N(rs=>{"use strict";var ie=T(),Se=is(),Di=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Bi=t=>/^(%|---|\.\.\.)/m.test(t);function $d(t,e,i){if(!e||e<0)return!1;let r=e-i,n=t.length;if(n<=r)return!1;for(let a=0,o=0;a<n;++a)if(t[a]===`
15
+ `){if(a-o>r)return!0;if(o=a+1,n-o<=r)return!1}return!0}function Dt(t,e){let i=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return i;let{implicitKey:r}=e,n=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(Bi(t)?" ":""),o="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(o+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{o+=i.slice(s,c);let d=i.substr(c+2,4);switch(d){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=i.substr(c,6)}c+=5,s=c+1}break;case"n":if(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,r?o:Se.foldFlowLines(o,a,Se.FOLD_QUOTED,$i(e,!1))}function pn(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(t))return Ht(t,e);let i=e.indent||(Oi(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${i}`)+"'";return e.implicitKey?r:Se.foldFlowLines(r,i,Se.FOLD_FLOW,$i(e,!1))}function st(t,e){let{singleQuote:i}=e.options,r;if(i===!1)r=Ht;else{let n=t.includes('"'),a=t.includes("'");n&&!a?r=pn:a&&!n?r=Ht:r=i?pn:Ht}return r(t,e)}var mn;try{mn=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:Se.foldFlowLines(o,a,Se.FOLD_QUOTED,Di(e,!1))}function bn(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(t))return Dt(t,e);let i=e.indent||(Bi(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${i}`)+"'";return e.implicitKey?r:Se.foldFlowLines(r,i,Se.FOLD_FLOW,Di(e,!1))}function ct(t,e){let{singleQuote:i}=e.options,r;if(i===!1)r=Dt;else{let n=t.includes('"'),a=t.includes("'");n&&!a?r=bn:a&&!n?r=Dt:r=i?bn:Dt}return r(t,e)}var kn;try{kn=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{mn=/\n+(?!\n|$)/g}function ji({comment:t,type:e,value:i},r,n,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(i))return st(i,r);let l=r.indent||(r.forceBlockIndent||Oi(i)?" ":""),d=o==="literal"?!0:o==="folded"||e===ie.Scalar.BLOCK_FOLDED?!1:e===ie.Scalar.BLOCK_LITERAL?!0:!Pd(i,c,l.length);if(!i)return d?`|
23
+ |$)`,"g")}catch{kn=/\n+(?!\n|$)/g}function Hi({comment:t,type:e,value:i},r,n,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(i))return ct(i,r);let l=r.indent||(r.forceBlockIndent||Bi(i)?" ":""),d=o==="literal"?!0:o==="folded"||e===ie.Scalar.BLOCK_FOLDED?!1:e===ie.Scalar.BLOCK_LITERAL?!0:!$d(i,c,l.length);if(!i)return d?`|
24
24
  `:`>
25
25
  `;let f,h;for(h=i.length;h>0;--h){let E=i[h-1];if(E!==`
26
26
  `&&E!==" "&&E!==" ")break}let m=i.substring(h),w=m.indexOf(`
27
27
  `);w===-1?f="-":i===m||w!==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(mn,`$&${l}`));let u=!1,p,g=-1;for(p=0;p<i.length;++p){let E=i[p];if(E===" ")u=!0;else if(E===`
28
+ `&&(m=m.slice(0,-1)),m=m.replace(kn,`$&${l}`));let u=!1,p,g=-1;for(p=0;p<i.length;++p){let E=i[p];if(E===" ")u=!0;else if(E===`
29
29
  `)g=p;else break}let y=i.substring(0,g<p?g+1:p);y&&(i=i.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let S=(u?l?"2":"1":"")+f;if(t&&(S+=" "+s(t.replace(/ ?[\r\n]+/g," ")),n&&n()),!d){let E=i.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),v=!1,P=$i(r,!0);o!=="folded"&&e!==ie.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{v=!0});let k=Se.foldFlowLines(`${y}${E}${m}`,l,Se.FOLD_BLOCK,P);if(!v)return`>${S}
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),v=!1,x=Di(r,!0);o!=="folded"&&e!==ie.Scalar.BLOCK_FOLDED&&(x.onOverflow=()=>{v=!0});let k=Se.foldFlowLines(`${y}${E}${m}`,l,Se.FOLD_BLOCK,x);if(!v)return`>${S}
31
31
  ${l}${k}`}return i=i.replace(/\n+/g,`$&${l}`),`|${S}
32
- ${l}${y}${i}${m}`}function xd(t,e,i,r){let{type:n,value:a}=t,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:d}=e;if(s&&a.includes(`
33
- `)||d&&/[[\]{},]/.test(a))return st(a,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||d||!a.includes(`
34
- `)?st(a,e):ji(t,e,i,r);if(!s&&!d&&n!==ie.Scalar.PLAIN&&a.includes(`
35
- `))return ji(t,e,i,r);if(Oi(a)){if(c==="")return e.forceBlockIndent=!0,ji(t,e,i,r);if(s&&c===l)return st(a,e)}let f=a.replace(/\n+/g,`$&
36
- ${c}`);if(o){let h=u=>u.default&&u.tag!=="tag:yaml.org,2002:str"&&u.test?.test(f),{compat:m,tags:w}=e.doc.schema;if(w.some(h)||m?.some(h))return st(a,e)}return s?f:Se.foldFlowLines(f,c,Se.FOLD_FLOW,$i(e,!1))}function Cd(t,e,i,r){let{implicitKey:n,inFlow:a}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:s}=t;s!==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=d=>{switch(d){case ie.Scalar.BLOCK_FOLDED:case ie.Scalar.BLOCK_LITERAL:return n||a?st(o.value,e):ji(o,e,i,r);case ie.Scalar.QUOTE_DOUBLE:return Ht(o.value,e);case ie.Scalar.QUOTE_SINGLE:return pn(o.value,e);case ie.Scalar.PLAIN:return xd(o,e,i,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:d,defaultStringType:f}=e.options,h=n&&d||f;if(l=c(h),l===null)throw new Error(`Unsupported default string type ${h}`)}return l}Ko.stringifyString=Cd});var Bt=N(vn=>{"use strict";var Rd=xi(),Ee=x(),Ad=$t(),_d=Dt();function Td(t,e){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},t.schema.toStringOptions,e),r;switch(i.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:r,options:i}}function Id(t,e){if(e.tag){let n=t.filter(a=>a.tag===e.tag);if(n.length>0)return n.find(a=>a.format===e.format)??n[0]}let i,r;if(Ee.isScalar(e)){r=e.value;let n=t.filter(a=>a.identify?.(r));if(n.length>1){let a=n.filter(o=>o.test);a.length>0&&(n=a)}i=n.find(a=>a.format===e.format)??n.find(a=>!a.format)}else r=e,i=t.find(n=>n.nodeClass&&r instanceof n.nodeClass);if(!i){let n=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${n} value`)}return i}function jd(t,e,{anchors:i,doc:r}){if(!r.directives)return"";let n=[],a=(Ee.isScalar(t)||Ee.isCollection(t))&&t.anchor;a&&Rd.anchorIsValid(a)&&(i.add(a),n.push(`&${a}`));let o=t.tag??(e.default?null:e.tag);return o&&n.push(r.directives.tagString(o)),n.join(" ")}function $d(t,e,i,r){if(Ee.isPair(t))return t.toString(e,i,r);if(Ee.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let n,a=Ee.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>n=c});n??(n=Id(e.doc.schema.tags,a));let o=jd(a,n,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let s=typeof n.stringify=="function"?n.stringify(a,e,i,r):Ee.isScalar(a)?_d.stringifyString(a,e,i,r):a.toString(e,i,r);return o?Ee.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
- ${e.indent}${s}`:s}vn.createStringifyContext=Td;vn.stringify=$d});var Zo=N(Qo=>{"use strict";var we=x(),Yo=T(),Xo=Bt(),Lt=$t();function Od({key:t,value:e},i,r,n){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:d,simpleKeys:f}}=i,h=we.isNode(t)&&t.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(t)||!we.isNode(t)&&typeof t=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let m=!f&&(!t||h&&e==null&&!i.inFlow||we.isCollection(t)||(we.isScalar(t)?t.type===Yo.Scalar.BLOCK_FOLDED||t.type===Yo.Scalar.BLOCK_LITERAL:typeof t=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!m&&(f||!a),indent:s+c});let w=!1,u=!1,p=Xo.stringify(t,i,()=>w=!0,()=>u=!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||e==null)return w&&r&&r(),p===""?"?":m?`? ${p}`:p}else if(a&&!f||e==null&&m)return p=`? ${p}`,h&&!w?p+=Lt.lineComment(p,i.indent,l(h)):u&&n&&n(),p;w&&(h=null),m?(h&&(p+=Lt.lineComment(p,i.indent,l(h))),p=`? ${p}
38
- ${s}:`):(p=`${p}:`,h&&(p+=Lt.lineComment(p,i.indent,l(h))));let g,y,b;we.isNode(e)?(g=!!e.spaceBefore,y=e.commentBefore,b=e.comment):(g=!1,y=null,b=null,e&&typeof e=="object"&&(e=o.createNode(e))),i.implicitKey=!1,!m&&!h&&we.isScalar(e)&&(i.indentAtStart=p.length+1),u=!1,!d&&c.length>=2&&!i.inFlow&&!m&&we.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(i.indent=i.indent.substring(2));let S=!1,E=Xo.stringify(e,i,()=>S=!0,()=>u=!0),v=" ";if(h||g||y){if(v=g?`
39
- `:"",y){let P=l(y);v+=`
40
- ${Lt.indentComment(P,i.indent)}`}E===""&&!i.inFlow?v===`
32
+ ${l}${y}${i}${m}`}function Od(t,e,i,r){let{type:n,value:a}=t,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:d}=e;if(s&&a.includes(`
33
+ `)||d&&/[[\]{},]/.test(a))return ct(a,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||d||!a.includes(`
34
+ `)?ct(a,e):Hi(t,e,i,r);if(!s&&!d&&n!==ie.Scalar.PLAIN&&a.includes(`
35
+ `))return Hi(t,e,i,r);if(Bi(a)){if(c==="")return e.forceBlockIndent=!0,Hi(t,e,i,r);if(s&&c===l)return ct(a,e)}let f=a.replace(/\n+/g,`$&
36
+ ${c}`);if(o){let h=u=>u.default&&u.tag!=="tag:yaml.org,2002:str"&&u.test?.test(f),{compat:m,tags:w}=e.doc.schema;if(w.some(h)||m?.some(h))return ct(a,e)}return s?f:Se.foldFlowLines(f,c,Se.FOLD_FLOW,Di(e,!1))}function Hd(t,e,i,r){let{implicitKey:n,inFlow:a}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:s}=t;s!==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=d=>{switch(d){case ie.Scalar.BLOCK_FOLDED:case ie.Scalar.BLOCK_LITERAL:return n||a?ct(o.value,e):Hi(o,e,i,r);case ie.Scalar.QUOTE_DOUBLE:return Dt(o.value,e);case ie.Scalar.QUOTE_SINGLE:return bn(o.value,e);case ie.Scalar.PLAIN:return Od(o,e,i,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:d,defaultStringType:f}=e.options,h=n&&d||f;if(l=c(h),l===null)throw new Error(`Unsupported default string type ${h}`)}return l}rs.stringifyString=Hd});var Lt=N(Sn=>{"use strict";var Dd=Ai(),Ee=P(),Bd=Ot(),Ld=Bt();function Md(t,e){let i=Object.assign({blockQuote:!0,commentString:Bd.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(i.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:r,options:i}}function Fd(t,e){if(e.tag){let n=t.filter(a=>a.tag===e.tag);if(n.length>0)return n.find(a=>a.format===e.format)??n[0]}let i,r;if(Ee.isScalar(e)){r=e.value;let n=t.filter(a=>a.identify?.(r));if(n.length>1){let a=n.filter(o=>o.test);a.length>0&&(n=a)}i=n.find(a=>a.format===e.format)??n.find(a=>!a.format)}else r=e,i=t.find(n=>n.nodeClass&&r instanceof n.nodeClass);if(!i){let n=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${n} value`)}return i}function Vd(t,e,{anchors:i,doc:r}){if(!r.directives)return"";let n=[],a=(Ee.isScalar(t)||Ee.isCollection(t))&&t.anchor;a&&Dd.anchorIsValid(a)&&(i.add(a),n.push(`&${a}`));let o=t.tag??(e.default?null:e.tag);return o&&n.push(r.directives.tagString(o)),n.join(" ")}function qd(t,e,i,r){if(Ee.isPair(t))return t.toString(e,i,r);if(Ee.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let n,a=Ee.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>n=c});n??(n=Fd(e.doc.schema.tags,a));let o=Vd(a,n,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let s=typeof n.stringify=="function"?n.stringify(a,e,i,r):Ee.isScalar(a)?Ld.stringifyString(a,e,i,r):a.toString(e,i,r);return o?Ee.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
+ ${e.indent}${s}`:s}Sn.createStringifyContext=Md;Sn.stringify=qd});var ss=N(os=>{"use strict";var ge=P(),ns=T(),as=Lt(),Mt=Ot();function Wd({key:t,value:e},i,r,n){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:d,simpleKeys:f}}=i,h=ge.isNode(t)&&t.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(ge.isCollection(t)||!ge.isNode(t)&&typeof t=="object"){let x="With simple keys, collection cannot be used as a key value";throw new Error(x)}}let m=!f&&(!t||h&&e==null&&!i.inFlow||ge.isCollection(t)||(ge.isScalar(t)?t.type===ns.Scalar.BLOCK_FOLDED||t.type===ns.Scalar.BLOCK_LITERAL:typeof t=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!m&&(f||!a),indent:s+c});let w=!1,u=!1,p=as.stringify(t,i,()=>w=!0,()=>u=!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||e==null)return w&&r&&r(),p===""?"?":m?`? ${p}`:p}else if(a&&!f||e==null&&m)return p=`? ${p}`,h&&!w?p+=Mt.lineComment(p,i.indent,l(h)):u&&n&&n(),p;w&&(h=null),m?(h&&(p+=Mt.lineComment(p,i.indent,l(h))),p=`? ${p}
38
+ ${s}:`):(p=`${p}:`,h&&(p+=Mt.lineComment(p,i.indent,l(h))));let g,y,b;ge.isNode(e)?(g=!!e.spaceBefore,y=e.commentBefore,b=e.comment):(g=!1,y=null,b=null,e&&typeof e=="object"&&(e=o.createNode(e))),i.implicitKey=!1,!m&&!h&&ge.isScalar(e)&&(i.indentAtStart=p.length+1),u=!1,!d&&c.length>=2&&!i.inFlow&&!m&&ge.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(i.indent=i.indent.substring(2));let S=!1,E=as.stringify(e,i,()=>S=!0,()=>u=!0),v=" ";if(h||g||y){if(v=g?`
39
+ `:"",y){let x=l(y);v+=`
40
+ ${Mt.indentComment(x,i.indent)}`}E===""&&!i.inFlow?v===`
41
41
  `&&b&&(v=`
42
42
 
43
43
  `):v+=`
44
- ${i.indent}`}else if(!m&&we.isCollection(e)){let P=E[0],k=E.indexOf(`
45
- `),C=k!==-1,F=i.inFlow??e.flow??e.items.length===0;if(C||!F){let ve=!1;if(C&&(P==="&"||P==="!")){let j=E.indexOf(" ");P==="&"&&j!==-1&&j<k&&E[j+1]==="!"&&(j=E.indexOf(" ",j+1)),(j===-1||k<j)&&(ve=!0)}ve||(v=`
44
+ ${i.indent}`}else if(!m&&ge.isCollection(e)){let x=E[0],k=E.indexOf(`
45
+ `),C=k!==-1,F=i.inFlow??e.flow??e.items.length===0;if(C||!F){let me=!1;if(C&&(x==="&"||x==="!")){let j=E.indexOf(" ");x==="&"&&j!==-1&&j<k&&E[j+1]==="!"&&(j=E.indexOf(" ",j+1)),(j===-1||k<j)&&(me=!0)}me||(v=`
46
46
  ${i.indent}`)}}else(E===""||E[0]===`
47
- `)&&(v="");return p+=v+E,i.inFlow?S&&r&&r():b&&!S?p+=Lt.lineComment(p,i.indent,l(b)):u&&n&&n(),p}Qo.stringifyPair=Od});var wn=N(gn=>{"use strict";var es=bi("process");function Hd(t,...e){t==="debug"&&console.log(...e)}function Dd(t,e){(t==="debug"||t==="warn")&&(typeof es.emitWarning=="function"?es.emitWarning(e):console.warn(e))}gn.debug=Hd;gn.warn=Dd});var Mi=N(Li=>{"use strict";var Bi=x(),ts=T(),Hi="<<",Di={identify:t=>t===Hi||typeof t=="symbol"&&t.description===Hi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ts.Scalar(Symbol(Hi)),{addToJSMap:is}),stringify:()=>Hi},Bd=(t,e)=>(Di.identify(e)||Bi.isScalar(e)&&(!e.type||e.type===ts.Scalar.PLAIN)&&Di.identify(e.value))&&t?.doc.schema.tags.some(i=>i.tag===Di.tag&&i.default);function is(t,e,i){let r=rs(t,i);if(Bi.isSeq(r))for(let n of r.items)yn(t,e,n);else if(Array.isArray(r))for(let n of r)yn(t,e,n);else yn(t,e,r)}function yn(t,e,i){let r=rs(t,i);if(!Bi.isMap(r))throw new Error("Merge sources must be maps or map aliases");let n=r.toJSON(null,t,Map);for(let[a,o]of n)e instanceof Map?e.has(a)||e.set(a,o):e instanceof Set?e.add(a):Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function rs(t,e){return t&&Bi.isAlias(e)?e.resolve(t.doc,t):e}Li.addMergeToJSMap=is;Li.isMergeKey=Bd;Li.merge=Di});var bn=N(os=>{"use strict";var Ld=wn(),ns=Mi(),Md=Bt(),as=x(),Nn=be();function Fd(t,e,{key:i,value:r}){if(as.isNode(i)&&i.addToJSMap)i.addToJSMap(t,e,r);else if(ns.isMergeKey(t,i))ns.addMergeToJSMap(t,e,r);else{let n=Nn.toJS(i,"",t);if(e instanceof Map)e.set(n,Nn.toJS(r,n,t));else if(e instanceof Set)e.add(n);else{let a=Vd(i,n,t),o=Nn.toJS(r,a,t);a in e?Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[a]=o}}return e}function Vd(t,e,i){if(e===null)return"";if(typeof e!="object")return String(e);if(as.isNode(t)&&i?.doc){let r=Md.createStringifyContext(i.doc,{});r.anchors=new Set;for(let a of i.anchors.keys())r.anchors.add(a.anchor);r.inFlow=!0,r.inStringifyKey=!0;let n=t.toString(r);if(!i.mapKeyWarned){let a=JSON.stringify(n);a.length>40&&(a=a.substring(0,36)+'..."'),Ld.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return n}return JSON.stringify(e)}os.addPairToJSMap=Fd});var Pe=N(kn=>{"use strict";var ss=jt(),qd=Zo(),Wd=bn(),Fi=x();function zd(t,e,i){let r=ss.createNode(t,void 0,i),n=ss.createNode(e,void 0,i);return new Vi(r,n)}var Vi=class t{constructor(e,i=null){Object.defineProperty(this,Fi.NODE_TYPE,{value:Fi.PAIR}),this.key=e,this.value=i}clone(e){let{key:i,value:r}=this;return Fi.isNode(i)&&(i=i.clone(e)),Fi.isNode(r)&&(r=r.clone(e)),new t(i,r)}toJSON(e,i){let r=i?.mapAsMap?new Map:{};return Wd.addPairToJSMap(i,r,this)}toString(e,i,r){return e?.doc?qd.stringifyPair(this,e,i,r):JSON.stringify(this)}};kn.Pair=Vi;kn.createPair=zd});var Sn=N(ls=>{"use strict";var qe=x(),cs=Bt(),qi=$t();function Jd(t,e,i){return(e.inFlow??t.flow?Ud:Gd)(t,e,i)}function Gd({comment:t,items:e},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}),f=!1,h=[];for(let w=0;w<e.length;++w){let u=e[w],p=null;if(qe.isNode(u))!f&&u.spaceBefore&&h.push(""),Wi(i,h,u.commentBefore,f),u.comment&&(p=u.comment);else if(qe.isPair(u)){let y=qe.isNode(u.key)?u.key:null;y&&(!f&&y.spaceBefore&&h.push(""),Wi(i,h,y.commentBefore,f))}f=!1;let g=cs.stringify(u,d,()=>p=null,()=>f=!0);p&&(g+=qi.lineComment(g,a,l(p))),f&&p&&(f=!1),h.push(r+g)}let m;if(h.length===0)m=n.start+n.end;else{m=h[0];for(let w=1;w<h.length;++w){let u=h[w];m+=u?`
47
+ `)&&(v="");return p+=v+E,i.inFlow?S&&r&&r():b&&!S?p+=Mt.lineComment(p,i.indent,l(b)):u&&n&&n(),p}os.stringifyPair=Wd});var xn=N(En=>{"use strict";var cs=Ei("process");function zd(t,...e){t==="debug"&&console.log(...e)}function Jd(t,e){(t==="debug"||t==="warn")&&(typeof cs.emitWarning=="function"?cs.emitWarning(e):console.warn(e))}En.debug=zd;En.warn=Jd});var qi=N(Vi=>{"use strict";var Fi=P(),ls=T(),Li="<<",Mi={identify:t=>t===Li||typeof t=="symbol"&&t.description===Li,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ls.Scalar(Symbol(Li)),{addToJSMap:us}),stringify:()=>Li},Gd=(t,e)=>(Mi.identify(e)||Fi.isScalar(e)&&(!e.type||e.type===ls.Scalar.PLAIN)&&Mi.identify(e.value))&&t?.doc.schema.tags.some(i=>i.tag===Mi.tag&&i.default);function us(t,e,i){let r=ds(t,i);if(Fi.isSeq(r))for(let n of r.items)Pn(t,e,n);else if(Array.isArray(r))for(let n of r)Pn(t,e,n);else Pn(t,e,r)}function Pn(t,e,i){let r=ds(t,i);if(!Fi.isMap(r))throw new Error("Merge sources must be maps or map aliases");let n=r.toJSON(null,t,Map);for(let[a,o]of n)e instanceof Map?e.has(a)||e.set(a,o):e instanceof Set?e.add(a):Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function ds(t,e){return t&&Fi.isAlias(e)?e.resolve(t.doc,t):e}Vi.addMergeToJSMap=us;Vi.isMergeKey=Gd;Vi.merge=Mi});var Rn=N(ps=>{"use strict";var Ud=xn(),fs=qi(),Kd=Lt(),hs=P(),Cn=be();function Yd(t,e,{key:i,value:r}){if(hs.isNode(i)&&i.addToJSMap)i.addToJSMap(t,e,r);else if(fs.isMergeKey(t,i))fs.addMergeToJSMap(t,e,r);else{let n=Cn.toJS(i,"",t);if(e instanceof Map)e.set(n,Cn.toJS(r,n,t));else if(e instanceof Set)e.add(n);else{let a=Xd(i,n,t),o=Cn.toJS(r,a,t);a in e?Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[a]=o}}return e}function Xd(t,e,i){if(e===null)return"";if(typeof e!="object")return String(e);if(hs.isNode(t)&&i?.doc){let r=Kd.createStringifyContext(i.doc,{});r.anchors=new Set;for(let a of i.anchors.keys())r.anchors.add(a.anchor);r.inFlow=!0,r.inStringifyKey=!0;let n=t.toString(r);if(!i.mapKeyWarned){let a=JSON.stringify(n);a.length>40&&(a=a.substring(0,36)+'..."'),Ud.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return n}return JSON.stringify(e)}ps.addPairToJSMap=Yd});var xe=N(An=>{"use strict";var ms=$t(),Qd=ss(),Zd=Rn(),Wi=P();function ef(t,e,i){let r=ms.createNode(t,void 0,i),n=ms.createNode(e,void 0,i);return new zi(r,n)}var zi=class t{constructor(e,i=null){Object.defineProperty(this,Wi.NODE_TYPE,{value:Wi.PAIR}),this.key=e,this.value=i}clone(e){let{key:i,value:r}=this;return Wi.isNode(i)&&(i=i.clone(e)),Wi.isNode(r)&&(r=r.clone(e)),new t(i,r)}toJSON(e,i){let r=i?.mapAsMap?new Map:{};return Zd.addPairToJSMap(i,r,this)}toString(e,i,r){return e?.doc?Qd.stringifyPair(this,e,i,r):JSON.stringify(this)}};An.Pair=zi;An.createPair=ef});var _n=N(gs=>{"use strict";var We=P(),vs=Lt(),Ji=Ot();function tf(t,e,i){return(e.inFlow??t.flow?nf:rf)(t,e,i)}function rf({comment:t,items:e},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}),f=!1,h=[];for(let w=0;w<e.length;++w){let u=e[w],p=null;if(We.isNode(u))!f&&u.spaceBefore&&h.push(""),Gi(i,h,u.commentBefore,f),u.comment&&(p=u.comment);else if(We.isPair(u)){let y=We.isNode(u.key)?u.key:null;y&&(!f&&y.spaceBefore&&h.push(""),Gi(i,h,y.commentBefore,f))}f=!1;let g=vs.stringify(u,d,()=>p=null,()=>f=!0);p&&(g+=Ji.lineComment(g,a,l(p))),f&&p&&(f=!1),h.push(r+g)}let m;if(h.length===0)m=n.start+n.end;else{m=h[0];for(let w=1;w<h.length;++w){let u=h[w];m+=u?`
48
48
  ${c}${u}`:`
49
49
  `}}return t?(m+=`
50
- `+qi.indentComment(l(t),c),s&&s()):f&&o&&o(),m}function Ud({items:t},e,{flowChars:i,itemIndent:r}){let{indent:n,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=e;r+=a;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,d=0,f=[];for(let w=0;w<t.length;++w){let u=t[w],p=null;if(qe.isNode(u))u.spaceBefore&&f.push(""),Wi(e,f,u.commentBefore,!1),u.comment&&(p=u.comment);else if(qe.isPair(u)){let y=qe.isNode(u.key)?u.key:null;y&&(y.spaceBefore&&f.push(""),Wi(e,f,y.commentBefore,!1),y.comment&&(l=!0));let b=qe.isNode(u.value)?u.value:null;b?(b.comment&&(p=b.comment),b.commentBefore&&(l=!0)):u.value==null&&y?.comment&&(p=y.comment)}p&&(l=!0);let g=cs.stringify(u,c,()=>p=null);l||(l=f.length>d||g.includes(`
51
- `)),w<t.length-1?g+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=f.reduce((y,b)=>y+b.length+2,2)+(g.length+2)>e.options.lineWidth)),l&&(g+=",")),p&&(g+=qi.lineComment(g,r,s(p))),f.push(g),d=f.length}let{start:h,end:m}=i;if(f.length===0)return h+m;if(!l){let w=f.reduce((u,p)=>u+p.length+2,2);l=e.options.lineWidth>0&&w>e.options.lineWidth}if(l){let w=h;for(let u of f)w+=u?`
50
+ `+Ji.indentComment(l(t),c),s&&s()):f&&o&&o(),m}function nf({items:t},e,{flowChars:i,itemIndent:r}){let{indent:n,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=e;r+=a;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,d=0,f=[];for(let w=0;w<t.length;++w){let u=t[w],p=null;if(We.isNode(u))u.spaceBefore&&f.push(""),Gi(e,f,u.commentBefore,!1),u.comment&&(p=u.comment);else if(We.isPair(u)){let y=We.isNode(u.key)?u.key:null;y&&(y.spaceBefore&&f.push(""),Gi(e,f,y.commentBefore,!1),y.comment&&(l=!0));let b=We.isNode(u.value)?u.value:null;b?(b.comment&&(p=b.comment),b.commentBefore&&(l=!0)):u.value==null&&y?.comment&&(p=y.comment)}p&&(l=!0);let g=vs.stringify(u,c,()=>p=null);l||(l=f.length>d||g.includes(`
51
+ `)),w<t.length-1?g+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=f.reduce((y,b)=>y+b.length+2,2)+(g.length+2)>e.options.lineWidth)),l&&(g+=",")),p&&(g+=Ji.lineComment(g,r,s(p))),f.push(g),d=f.length}let{start:h,end:m}=i;if(f.length===0)return h+m;if(!l){let w=f.reduce((u,p)=>u+p.length+2,2);l=e.options.lineWidth>0&&w>e.options.lineWidth}if(l){let w=h;for(let u of f)w+=u?`
52
52
  ${a}${n}${u}`:`
53
53
  `;return`${w}
54
- ${n}${m}`}else return`${h}${o}${f.join(" ")}${o}${m}`}function Wi({indent:t,options:{commentString:e}},i,r,n){if(r&&n&&(r=r.replace(/^\n+/,"")),r){let a=qi.indentComment(e(r),t);i.push(a.trimStart())}}ls.stringifyCollection=Jd});var Ce=N(Pn=>{"use strict";var Kd=Sn(),Yd=bn(),Xd=_i(),xe=x(),zi=Pe(),Qd=T();function Mt(t,e){let i=xe.isScalar(e)?e.value:e;for(let r of t)if(xe.isPair(r)&&(r.key===e||r.key===i||xe.isScalar(r.key)&&r.key.value===i))return r}var En=class extends Xd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(xe.MAP,e),this.items=[]}static from(e,i,r){let{keepUndefined:n,replacer:a}=r,o=new this(e),s=(c,l)=>{if(typeof a=="function")l=a.call(i,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||n)&&o.items.push(zi.createPair(c,l,r))};if(i instanceof Map)for(let[c,l]of i)s(c,l);else if(i&&typeof i=="object")for(let c of Object.keys(i))s(c,i[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,i){let r;xe.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new zi.Pair(e,e?.value):r=new zi.Pair(e.key,e.value);let n=Mt(this.items,r.key),a=this.schema?.sortMapEntries;if(n){if(!i)throw new Error(`Key ${r.key} already set`);xe.isScalar(n.value)&&Qd.isScalarValue(r.value)?n.value.value=r.value:n.value=r.value}else if(a){let o=this.items.findIndex(s=>a(r,s)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(e){let i=Mt(this.items,e);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(e,i){let n=Mt(this.items,e)?.value;return(!i&&xe.isScalar(n)?n.value:n)??void 0}has(e){return!!Mt(this.items,e)}set(e,i){this.add(new zi.Pair(e,i),!0)}toJSON(e,i,r){let n=r?new r:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(n);for(let a of this.items)Yd.addPairToJSMap(i,n,a);return n}toString(e,i,r){if(!e)return JSON.stringify(this);for(let n of this.items)if(!xe.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Kd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:i})}};Pn.YAMLMap=En;Pn.findPair=Mt});var ct=N(ds=>{"use strict";var Zd=x(),us=Ce(),ef={collection:"map",default:!0,nodeClass:us.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Zd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,i)=>us.YAMLMap.from(t,e,i)};ds.map=ef});var Re=N(fs=>{"use strict";var tf=jt(),rf=Sn(),nf=_i(),Gi=x(),af=T(),of=be(),xn=class extends nf.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Gi.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let i=Ji(e);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(e,i){let r=Ji(e);if(typeof r!="number")return;let n=this.items[r];return!i&&Gi.isScalar(n)?n.value:n}has(e){let i=Ji(e);return typeof i=="number"&&i<this.items.length}set(e,i){let r=Ji(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let n=this.items[r];Gi.isScalar(n)&&af.isScalarValue(i)?n.value=i:this.items[r]=i}toJSON(e,i){let r=[];i?.onCreate&&i.onCreate(r);let n=0;for(let a of this.items)r.push(of.toJS(a,String(n++),i));return r}toString(e,i,r){return e?rf.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:i}):JSON.stringify(this)}static from(e,i,r){let{replacer:n}=r,a=new this(e);if(i&&Symbol.iterator in Object(i)){let o=0;for(let s of i){if(typeof n=="function"){let c=i instanceof Set?s:String(o++);s=n.call(i,c,s)}a.items.push(tf.createNode(s,void 0,r))}}return a}};function Ji(t){let e=Gi.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}fs.YAMLSeq=xn});var lt=N(ps=>{"use strict";var sf=x(),hs=Re(),cf={collection:"seq",default:!0,nodeClass:hs.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return sf.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,i)=>hs.YAMLSeq.from(t,e,i)};ps.seq=cf});var Ft=N(ms=>{"use strict";var lf=Dt(),uf={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,i,r){return e=Object.assign({actualString:!0},e),lf.stringifyString(t,e,i,r)}};ms.string=uf});var Ui=N(ws=>{"use strict";var vs=T(),gs={identify:t=>t==null,createNode:()=>new vs.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new vs.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&gs.test.test(t)?t:e.options.nullStr};ws.nullTag=gs});var Cn=N(Ns=>{"use strict";var df=T(),ys={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new df.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},i){if(t&&ys.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?i.options.trueStr:i.options.falseStr}};Ns.boolTag=ys});var ut=N(bs=>{"use strict";function ff({format:t,minFractionDigits:e,tag:i,value:r}){if(typeof r=="bigint")return String(r);let n=typeof r=="number"?r:Number(r);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let a=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=e-(a.length-o-1);for(;s-- >0;)a+="0"}return a}bs.stringifyNumber=ff});var An=N(Ki=>{"use strict";var hf=T(),Rn=ut(),pf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Rn.stringifyNumber},mf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Rn.stringifyNumber(t)}},vf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new hf.Scalar(parseFloat(t)),i=t.indexOf(".");return i!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-i-1),e},stringify:Rn.stringifyNumber};Ki.float=vf;Ki.floatExp=mf;Ki.floatNaN=pf});var Tn=N(Xi=>{"use strict";var ks=ut(),Yi=t=>typeof t=="bigint"||Number.isInteger(t),_n=(t,e,i,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),i);function Ss(t,e,i){let{value:r}=t;return Yi(r)&&r>=0?i+r.toString(e):ks.stringifyNumber(t)}var gf={identify:t=>Yi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,i)=>_n(t,2,8,i),stringify:t=>Ss(t,8,"0o")},wf={identify:Yi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,i)=>_n(t,0,10,i),stringify:ks.stringifyNumber},yf={identify:t=>Yi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,i)=>_n(t,2,16,i),stringify:t=>Ss(t,16,"0x")};Xi.int=wf;Xi.intHex=yf;Xi.intOct=gf});var Ps=N(Es=>{"use strict";var Nf=ct(),bf=Ui(),kf=lt(),Sf=Ft(),Ef=Cn(),In=An(),jn=Tn(),Pf=[Nf.map,kf.seq,Sf.string,bf.nullTag,Ef.boolTag,jn.intOct,jn.int,jn.intHex,In.floatNaN,In.floatExp,In.float];Es.schema=Pf});var Rs=N(Cs=>{"use strict";var xf=T(),Cf=ct(),Rf=lt();function xs(t){return typeof t=="bigint"||Number.isInteger(t)}var Qi=({value:t})=>JSON.stringify(t),Af=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Qi},{identify:t=>t==null,createNode:()=>new xf.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Qi},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Qi},{identify:xs,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:i})=>i?BigInt(t):parseInt(t,10),stringify:({value:t})=>xs(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Qi}],_f={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Tf=[Cf.map,Rf.seq].concat(Af,_f);Cs.schema=Tf});var On=N(As=>{"use strict";var Vt=bi("buffer"),$n=T(),If=Dt(),jf={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Vt.Buffer=="function")return Vt.Buffer.from(t,"base64");if(typeof atob=="function"){let i=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(i.length);for(let n=0;n<i.length;++n)r[n]=i.charCodeAt(n);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:i},r,n,a){if(!i)return"";let o=i,s;if(typeof Vt.Buffer=="function")s=o instanceof Vt.Buffer?o.toString("base64"):Vt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=$n.Scalar.BLOCK_LITERAL),e!==$n.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 f=0,h=0;f<l;++f,h+=c)d[f]=s.substr(h,c);s=d.join(e===$n.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return If.stringifyString({comment:t,type:e,value:s},r,n,a)}};As.binary=jf});var tr=N(er=>{"use strict";var Zi=x(),Hn=Pe(),$f=T(),Of=Re();function _s(t,e){if(Zi.isSeq(t))for(let i=0;i<t.items.length;++i){let r=t.items[i];if(!Zi.isPair(r)){if(Zi.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let n=r.items[0]||new Hn.Pair(new $f.Scalar(null));if(r.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${r.commentBefore}
54
+ ${n}${m}`}else return`${h}${o}${f.join(" ")}${o}${m}`}function Gi({indent:t,options:{commentString:e}},i,r,n){if(r&&n&&(r=r.replace(/^\n+/,"")),r){let a=Ji.indentComment(e(r),t);i.push(a.trimStart())}}gs.stringifyCollection=tf});var Ce=N(In=>{"use strict";var af=_n(),of=Rn(),sf=ji(),Pe=P(),Ui=xe(),cf=T();function Ft(t,e){let i=Pe.isScalar(e)?e.value:e;for(let r of t)if(Pe.isPair(r)&&(r.key===e||r.key===i||Pe.isScalar(r.key)&&r.key.value===i))return r}var Tn=class extends sf.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Pe.MAP,e),this.items=[]}static from(e,i,r){let{keepUndefined:n,replacer:a}=r,o=new this(e),s=(c,l)=>{if(typeof a=="function")l=a.call(i,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||n)&&o.items.push(Ui.createPair(c,l,r))};if(i instanceof Map)for(let[c,l]of i)s(c,l);else if(i&&typeof i=="object")for(let c of Object.keys(i))s(c,i[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,i){let r;Pe.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Ui.Pair(e,e?.value):r=new Ui.Pair(e.key,e.value);let n=Ft(this.items,r.key),a=this.schema?.sortMapEntries;if(n){if(!i)throw new Error(`Key ${r.key} already set`);Pe.isScalar(n.value)&&cf.isScalarValue(r.value)?n.value.value=r.value:n.value=r.value}else if(a){let o=this.items.findIndex(s=>a(r,s)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(e){let i=Ft(this.items,e);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(e,i){let n=Ft(this.items,e)?.value;return(!i&&Pe.isScalar(n)?n.value:n)??void 0}has(e){return!!Ft(this.items,e)}set(e,i){this.add(new Ui.Pair(e,i),!0)}toJSON(e,i,r){let n=r?new r:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(n);for(let a of this.items)of.addPairToJSMap(i,n,a);return n}toString(e,i,r){if(!e)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!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),af.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:i})}};In.YAMLMap=Tn;In.findPair=Ft});var lt=N(ys=>{"use strict";var lf=P(),ws=Ce(),uf={collection:"map",default:!0,nodeClass:ws.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return lf.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,i)=>ws.YAMLMap.from(t,e,i)};ys.map=uf});var Re=N(Ns=>{"use strict";var df=$t(),ff=_n(),hf=ji(),Yi=P(),pf=T(),mf=be(),jn=class extends hf.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Yi.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let i=Ki(e);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(e,i){let r=Ki(e);if(typeof r!="number")return;let n=this.items[r];return!i&&Yi.isScalar(n)?n.value:n}has(e){let i=Ki(e);return typeof i=="number"&&i<this.items.length}set(e,i){let r=Ki(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let n=this.items[r];Yi.isScalar(n)&&pf.isScalarValue(i)?n.value=i:this.items[r]=i}toJSON(e,i){let r=[];i?.onCreate&&i.onCreate(r);let n=0;for(let a of this.items)r.push(mf.toJS(a,String(n++),i));return r}toString(e,i,r){return e?ff.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:i}):JSON.stringify(this)}static from(e,i,r){let{replacer:n}=r,a=new this(e);if(i&&Symbol.iterator in Object(i)){let o=0;for(let s of i){if(typeof n=="function"){let c=i instanceof Set?s:String(o++);s=n.call(i,c,s)}a.items.push(df.createNode(s,void 0,r))}}return a}};function Ki(t){let e=Yi.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Ns.YAMLSeq=jn});var ut=N(ks=>{"use strict";var vf=P(),bs=Re(),gf={collection:"seq",default:!0,nodeClass:bs.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return vf.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,i)=>bs.YAMLSeq.from(t,e,i)};ks.seq=gf});var Vt=N(Ss=>{"use strict";var wf=Bt(),yf={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,i,r){return e=Object.assign({actualString:!0},e),wf.stringifyString(t,e,i,r)}};Ss.string=yf});var Xi=N(Ps=>{"use strict";var Es=T(),xs={identify:t=>t==null,createNode:()=>new Es.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Es.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&xs.test.test(t)?t:e.options.nullStr};Ps.nullTag=xs});var $n=N(Rs=>{"use strict";var Nf=T(),Cs={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Nf.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},i){if(t&&Cs.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?i.options.trueStr:i.options.falseStr}};Rs.boolTag=Cs});var dt=N(As=>{"use strict";function bf({format:t,minFractionDigits:e,tag:i,value:r}){if(typeof r=="bigint")return String(r);let n=typeof r=="number"?r:Number(r);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let a=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=e-(a.length-o-1);for(;s-- >0;)a+="0"}return a}As.stringifyNumber=bf});var Hn=N(Qi=>{"use strict";var kf=T(),On=dt(),Sf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:On.stringifyNumber},Ef={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():On.stringifyNumber(t)}},xf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new kf.Scalar(parseFloat(t)),i=t.indexOf(".");return i!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-i-1),e},stringify:On.stringifyNumber};Qi.float=xf;Qi.floatExp=Ef;Qi.floatNaN=Sf});var Bn=N(er=>{"use strict";var _s=dt(),Zi=t=>typeof t=="bigint"||Number.isInteger(t),Dn=(t,e,i,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),i);function Ts(t,e,i){let{value:r}=t;return Zi(r)&&r>=0?i+r.toString(e):_s.stringifyNumber(t)}var Pf={identify:t=>Zi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,i)=>Dn(t,2,8,i),stringify:t=>Ts(t,8,"0o")},Cf={identify:Zi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,i)=>Dn(t,0,10,i),stringify:_s.stringifyNumber},Rf={identify:t=>Zi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,i)=>Dn(t,2,16,i),stringify:t=>Ts(t,16,"0x")};er.int=Cf;er.intHex=Rf;er.intOct=Pf});var js=N(Is=>{"use strict";var Af=lt(),_f=Xi(),Tf=ut(),If=Vt(),jf=$n(),Ln=Hn(),Mn=Bn(),$f=[Af.map,Tf.seq,If.string,_f.nullTag,jf.boolTag,Mn.intOct,Mn.int,Mn.intHex,Ln.floatNaN,Ln.floatExp,Ln.float];Is.schema=$f});var Hs=N(Os=>{"use strict";var Of=T(),Hf=lt(),Df=ut();function $s(t){return typeof t=="bigint"||Number.isInteger(t)}var tr=({value:t})=>JSON.stringify(t),Bf=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:tr},{identify:t=>t==null,createNode:()=>new Of.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:tr},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:tr},{identify:$s,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:i})=>i?BigInt(t):parseInt(t,10),stringify:({value:t})=>$s(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:tr}],Lf={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Mf=[Hf.map,Df.seq].concat(Bf,Lf);Os.schema=Mf});var Vn=N(Ds=>{"use strict";var qt=Ei("buffer"),Fn=T(),Ff=Bt(),Vf={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof qt.Buffer=="function")return qt.Buffer.from(t,"base64");if(typeof atob=="function"){let i=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(i.length);for(let n=0;n<i.length;++n)r[n]=i.charCodeAt(n);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:i},r,n,a){if(!i)return"";let o=i,s;if(typeof qt.Buffer=="function")s=o instanceof qt.Buffer?o.toString("base64"):qt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Fn.Scalar.BLOCK_LITERAL),e!==Fn.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 f=0,h=0;f<l;++f,h+=c)d[f]=s.substr(h,c);s=d.join(e===Fn.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return Ff.stringifyString({comment:t,type:e,value:s},r,n,a)}};Ds.binary=Vf});var nr=N(rr=>{"use strict";var ir=P(),qn=xe(),qf=T(),Wf=Re();function Bs(t,e){if(ir.isSeq(t))for(let i=0;i<t.items.length;++i){let r=t.items[i];if(!ir.isPair(r)){if(ir.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let n=r.items[0]||new qn.Pair(new qf.Scalar(null));if(r.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${r.commentBefore}
56
56
  ${n.key.commentBefore}`:r.commentBefore),r.comment){let a=n.value??n.key;a.comment=a.comment?`${r.comment}
57
- ${a.comment}`:r.comment}r=n}t.items[i]=Zi.isPair(r)?r:new Hn.Pair(r)}}else e("Expected a sequence for this tag");return t}function Ts(t,e,i){let{replacer:r}=i,n=new Of.YAMLSeq(t);n.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof r=="function"&&(o=r.call(e,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;n.items.push(Hn.createPair(s,c,i))}return n}var Hf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:_s,createNode:Ts};er.createPairs=Ts;er.pairs=Hf;er.resolvePairs=_s});var Ln=N(Bn=>{"use strict";var Is=x(),Dn=be(),qt=Ce(),Df=Re(),js=tr(),We=class t extends Df.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=t.tag}toJSON(e,i){if(!i)return super.toJSON(e);let r=new Map;i?.onCreate&&i.onCreate(r);for(let n of this.items){let a,o;if(Is.isPair(n)?(a=Dn.toJS(n.key,"",i),o=Dn.toJS(n.value,a,i)):a=Dn.toJS(n,"",i),r.has(a))throw new Error("Ordered maps must not include duplicate keys");r.set(a,o)}return r}static from(e,i,r){let n=js.createPairs(e,i,r),a=new this;return a.items=n.items,a}};We.tag="tag:yaml.org,2002:omap";var Bf={collection:"seq",identify:t=>t instanceof Map,nodeClass:We,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let i=js.resolvePairs(t,e),r=[];for(let{key:n}of i.items)Is.isScalar(n)&&(r.includes(n.value)?e(`Ordered maps must not include duplicate keys: ${n.value}`):r.push(n.value));return Object.assign(new We,i)},createNode:(t,e,i)=>We.from(t,e,i)};Bn.YAMLOMap=We;Bn.omap=Bf});var Bs=N(Mn=>{"use strict";var $s=T();function Os({value:t,source:e},i){return e&&(t?Hs:Ds).test.test(e)?e:t?i.options.trueStr:i.options.falseStr}var Hs={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new $s.Scalar(!0),stringify:Os},Ds={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new $s.Scalar(!1),stringify:Os};Mn.falseTag=Ds;Mn.trueTag=Hs});var Ls=N(ir=>{"use strict";var Lf=T(),Fn=ut(),Mf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Fn.stringifyNumber},Ff={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Fn.stringifyNumber(t)}},Vf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Lf.Scalar(parseFloat(t.replace(/_/g,""))),i=t.indexOf(".");if(i!==-1){let r=t.substring(i+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:Fn.stringifyNumber};ir.float=Vf;ir.floatExp=Ff;ir.floatNaN=Mf});var Fs=N(zt=>{"use strict";var Ms=ut(),Wt=t=>typeof t=="bigint"||Number.isInteger(t);function rr(t,e,i,{intAsBigInt:r}){let n=t[0];if((n==="-"||n==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(i){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return n==="-"?BigInt(-1)*o:o}let a=parseInt(t,i);return n==="-"?-1*a:a}function Vn(t,e,i){let{value:r}=t;if(Wt(r)){let n=r.toString(e);return r<0?"-"+i+n.substr(1):i+n}return Ms.stringifyNumber(t)}var qf={identify:Wt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,i)=>rr(t,2,2,i),stringify:t=>Vn(t,2,"0b")},Wf={identify:Wt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,i)=>rr(t,1,8,i),stringify:t=>Vn(t,8,"0")},zf={identify:Wt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,i)=>rr(t,0,10,i),stringify:Ms.stringifyNumber},Jf={identify:Wt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,i)=>rr(t,2,16,i),stringify:t=>Vn(t,16,"0x")};zt.int=zf;zt.intBin=qf;zt.intHex=Jf;zt.intOct=Wf});var Wn=N(qn=>{"use strict";var or=x(),nr=Pe(),ar=Ce(),ze=class t extends ar.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let i;or.isPair(e)?i=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?i=new nr.Pair(e.key,null):i=new nr.Pair(e,null),ar.findPair(this.items,i.key)||this.items.push(i)}get(e,i){let r=ar.findPair(this.items,e);return!i&&or.isPair(r)?or.isScalar(r.key)?r.key.value:r.key:r}set(e,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let r=ar.findPair(this.items,e);r&&!i?this.items.splice(this.items.indexOf(r),1):!r&&i&&this.items.push(new nr.Pair(e))}toJSON(e,i){return super.toJSON(e,i,Set)}toString(e,i,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),i,r);throw new Error("Set items must all have null values")}static from(e,i,r){let{replacer:n}=r,a=new this(e);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof n=="function"&&(o=n.call(i,o,o)),a.items.push(nr.createPair(o,null,r));return a}};ze.tag="tag:yaml.org,2002:set";var Gf={collection:"map",identify:t=>t instanceof Set,nodeClass:ze,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,i)=>ze.from(t,e,i),resolve(t,e){if(or.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ze,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};qn.YAMLSet=ze;qn.set=Gf});var Jn=N(sr=>{"use strict";var Uf=ut();function zn(t,e){let i=t[0],r=i==="-"||i==="+"?t.substring(1):t,n=o=>e?BigInt(o):Number(o),a=r.replace(/_/g,"").split(":").reduce((o,s)=>o*n(60)+n(s),n(0));return i==="-"?n(-1)*a:a}function Vs(t){let{value:e}=t,i=o=>o;if(typeof e=="bigint")i=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Uf.stringifyNumber(t);let r="";e<0&&(r="-",e*=i(-1));let n=i(60),a=[e%n];return e<60?a.unshift(0):(e=(e-a[0])/n,a.unshift(e%n),e>=60&&(e=(e-a[0])/n,a.unshift(e))),r+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Kf={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:i})=>zn(t,i),stringify:Vs},Yf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>zn(t,!1),stringify:Vs},qs={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(qs.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,r,n,a,o,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(i,r-1,n,a||0,o||0,s||0,c),d=e[8];if(d&&d!=="Z"){let f=zn(d,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};sr.floatTime=Yf;sr.intTime=Kf;sr.timestamp=qs});var Js=N(zs=>{"use strict";var Xf=ct(),Qf=Ui(),Zf=lt(),eh=Ft(),th=On(),Ws=Bs(),Gn=Ls(),cr=Fs(),ih=Mi(),rh=Ln(),nh=tr(),ah=Wn(),Un=Jn(),oh=[Xf.map,Zf.seq,eh.string,Qf.nullTag,Ws.trueTag,Ws.falseTag,cr.intBin,cr.intOct,cr.int,cr.intHex,Gn.floatNaN,Gn.floatExp,Gn.float,th.binary,ih.merge,rh.omap,nh.pairs,ah.set,Un.intTime,Un.floatTime,Un.timestamp];zs.schema=oh});var ic=N(Xn=>{"use strict";var Ys=ct(),sh=Ui(),Xs=lt(),ch=Ft(),lh=Cn(),Kn=An(),Yn=Tn(),uh=Ps(),dh=Rs(),Qs=On(),Jt=Mi(),Zs=Ln(),ec=tr(),Gs=Js(),tc=Wn(),lr=Jn(),Us=new Map([["core",uh.schema],["failsafe",[Ys.map,Xs.seq,ch.string]],["json",dh.schema],["yaml11",Gs.schema],["yaml-1.1",Gs.schema]]),Ks={binary:Qs.binary,bool:lh.boolTag,float:Kn.float,floatExp:Kn.floatExp,floatNaN:Kn.floatNaN,floatTime:lr.floatTime,int:Yn.int,intHex:Yn.intHex,intOct:Yn.intOct,intTime:lr.intTime,map:Ys.map,merge:Jt.merge,null:sh.nullTag,omap:Zs.omap,pairs:ec.pairs,seq:Xs.seq,set:tc.set,timestamp:lr.timestamp},fh={"tag:yaml.org,2002:binary":Qs.binary,"tag:yaml.org,2002:merge":Jt.merge,"tag:yaml.org,2002:omap":Zs.omap,"tag:yaml.org,2002:pairs":ec.pairs,"tag:yaml.org,2002:set":tc.set,"tag:yaml.org,2002:timestamp":lr.timestamp};function hh(t,e,i){let r=Us.get(e);if(r&&!t)return i&&!r.includes(Jt.merge)?r.concat(Jt.merge):r.slice();let n=r;if(!n)if(Array.isArray(t))n=[];else{let a=Array.from(Us.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(t))for(let a of t)n=n.concat(a);else typeof t=="function"&&(n=t(n.slice()));return i&&(n=n.concat(Jt.merge)),n.reduce((a,o)=>{let s=typeof o=="string"?Ks[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(Ks).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},[])}Xn.coreKnownTags=fh;Xn.getTags=hh});var ea=N(rc=>{"use strict";var Qn=x(),ph=ct(),mh=lt(),vh=Ft(),ur=ic(),gh=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Zn=class t{constructor({compat:e,customTags:i,merge:r,resolveKnownTags:n,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?ur.getTags(e,"compat"):e?ur.getTags(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=n?ur.coreKnownTags:{},this.tags=ur.getTags(i,this.name,r),this.toStringOptions=s??null,Object.defineProperty(this,Qn.MAP,{value:ph.map}),Object.defineProperty(this,Qn.SCALAR,{value:vh.string}),Object.defineProperty(this,Qn.SEQ,{value:mh.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?gh:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};rc.Schema=Zn});var ac=N(nc=>{"use strict";var wh=x(),ta=Bt(),Gt=$t();function yh(t,e){let i=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(i.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&i.push("---");let n=ta.createStringifyContext(t,e),{commentString:a}=n.options;if(t.commentBefore){i.length!==1&&i.unshift("");let c=a(t.commentBefore);i.unshift(Gt.indentComment(c,""))}let o=!1,s=null;if(t.contents){if(wh.isNode(t.contents)){if(t.contents.spaceBefore&&r&&i.push(""),t.contents.commentBefore){let d=a(t.contents.commentBefore);i.push(Gt.indentComment(d,""))}n.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>o=!0,l=ta.stringify(t.contents,n,()=>s=null,c);s&&(l+=Gt.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(ta.stringify(t.contents,n));if(t.directives?.docEnd)if(t.comment){let c=a(t.comment);c.includes(`
58
- `)?(i.push("..."),i.push(Gt.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(Gt.indentComment(a(c),"")))}return i.join(`
57
+ ${a.comment}`:r.comment}r=n}t.items[i]=ir.isPair(r)?r:new qn.Pair(r)}}else e("Expected a sequence for this tag");return t}function Ls(t,e,i){let{replacer:r}=i,n=new Wf.YAMLSeq(t);n.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof r=="function"&&(o=r.call(e,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;n.items.push(qn.createPair(s,c,i))}return n}var zf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Bs,createNode:Ls};rr.createPairs=Ls;rr.pairs=zf;rr.resolvePairs=Bs});var Jn=N(zn=>{"use strict";var Ms=P(),Wn=be(),Wt=Ce(),Jf=Re(),Fs=nr(),ze=class t extends Jf.YAMLSeq{constructor(){super(),this.add=Wt.YAMLMap.prototype.add.bind(this),this.delete=Wt.YAMLMap.prototype.delete.bind(this),this.get=Wt.YAMLMap.prototype.get.bind(this),this.has=Wt.YAMLMap.prototype.has.bind(this),this.set=Wt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,i){if(!i)return super.toJSON(e);let r=new Map;i?.onCreate&&i.onCreate(r);for(let n of this.items){let a,o;if(Ms.isPair(n)?(a=Wn.toJS(n.key,"",i),o=Wn.toJS(n.value,a,i)):a=Wn.toJS(n,"",i),r.has(a))throw new Error("Ordered maps must not include duplicate keys");r.set(a,o)}return r}static from(e,i,r){let n=Fs.createPairs(e,i,r),a=new this;return a.items=n.items,a}};ze.tag="tag:yaml.org,2002:omap";var Gf={collection:"seq",identify:t=>t instanceof Map,nodeClass:ze,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let i=Fs.resolvePairs(t,e),r=[];for(let{key:n}of i.items)Ms.isScalar(n)&&(r.includes(n.value)?e(`Ordered maps must not include duplicate keys: ${n.value}`):r.push(n.value));return Object.assign(new ze,i)},createNode:(t,e,i)=>ze.from(t,e,i)};zn.YAMLOMap=ze;zn.omap=Gf});var Js=N(Gn=>{"use strict";var Vs=T();function qs({value:t,source:e},i){return e&&(t?Ws:zs).test.test(e)?e:t?i.options.trueStr:i.options.falseStr}var Ws={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Vs.Scalar(!0),stringify:qs},zs={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Vs.Scalar(!1),stringify:qs};Gn.falseTag=zs;Gn.trueTag=Ws});var Gs=N(ar=>{"use strict";var Uf=T(),Un=dt(),Kf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Un.stringifyNumber},Yf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Un.stringifyNumber(t)}},Xf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Uf.Scalar(parseFloat(t.replace(/_/g,""))),i=t.indexOf(".");if(i!==-1){let r=t.substring(i+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:Un.stringifyNumber};ar.float=Xf;ar.floatExp=Yf;ar.floatNaN=Kf});var Ks=N(Jt=>{"use strict";var Us=dt(),zt=t=>typeof t=="bigint"||Number.isInteger(t);function or(t,e,i,{intAsBigInt:r}){let n=t[0];if((n==="-"||n==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(i){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return n==="-"?BigInt(-1)*o:o}let a=parseInt(t,i);return n==="-"?-1*a:a}function Kn(t,e,i){let{value:r}=t;if(zt(r)){let n=r.toString(e);return r<0?"-"+i+n.substr(1):i+n}return Us.stringifyNumber(t)}var Qf={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,i)=>or(t,2,2,i),stringify:t=>Kn(t,2,"0b")},Zf={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,i)=>or(t,1,8,i),stringify:t=>Kn(t,8,"0")},eh={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,i)=>or(t,0,10,i),stringify:Us.stringifyNumber},th={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,i)=>or(t,2,16,i),stringify:t=>Kn(t,16,"0x")};Jt.int=eh;Jt.intBin=Qf;Jt.intHex=th;Jt.intOct=Zf});var Xn=N(Yn=>{"use strict";var lr=P(),sr=xe(),cr=Ce(),Je=class t extends cr.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let i;lr.isPair(e)?i=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?i=new sr.Pair(e.key,null):i=new sr.Pair(e,null),cr.findPair(this.items,i.key)||this.items.push(i)}get(e,i){let r=cr.findPair(this.items,e);return!i&&lr.isPair(r)?lr.isScalar(r.key)?r.key.value:r.key:r}set(e,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let r=cr.findPair(this.items,e);r&&!i?this.items.splice(this.items.indexOf(r),1):!r&&i&&this.items.push(new sr.Pair(e))}toJSON(e,i){return super.toJSON(e,i,Set)}toString(e,i,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),i,r);throw new Error("Set items must all have null values")}static from(e,i,r){let{replacer:n}=r,a=new this(e);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof n=="function"&&(o=n.call(i,o,o)),a.items.push(sr.createPair(o,null,r));return a}};Je.tag="tag:yaml.org,2002:set";var ih={collection:"map",identify:t=>t instanceof Set,nodeClass:Je,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,i)=>Je.from(t,e,i),resolve(t,e){if(lr.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Je,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Yn.YAMLSet=Je;Yn.set=ih});var Zn=N(ur=>{"use strict";var rh=dt();function Qn(t,e){let i=t[0],r=i==="-"||i==="+"?t.substring(1):t,n=o=>e?BigInt(o):Number(o),a=r.replace(/_/g,"").split(":").reduce((o,s)=>o*n(60)+n(s),n(0));return i==="-"?n(-1)*a:a}function Ys(t){let{value:e}=t,i=o=>o;if(typeof e=="bigint")i=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return rh.stringifyNumber(t);let r="";e<0&&(r="-",e*=i(-1));let n=i(60),a=[e%n];return e<60?a.unshift(0):(e=(e-a[0])/n,a.unshift(e%n),e>=60&&(e=(e-a[0])/n,a.unshift(e))),r+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var nh={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:i})=>Qn(t,i),stringify:Ys},ah={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Qn(t,!1),stringify:Ys},Xs={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Xs.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,r,n,a,o,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(i,r-1,n,a||0,o||0,s||0,c),d=e[8];if(d&&d!=="Z"){let f=Qn(d,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ur.floatTime=ah;ur.intTime=nh;ur.timestamp=Xs});var ec=N(Zs=>{"use strict";var oh=lt(),sh=Xi(),ch=ut(),lh=Vt(),uh=Vn(),Qs=Js(),ea=Gs(),dr=Ks(),dh=qi(),fh=Jn(),hh=nr(),ph=Xn(),ta=Zn(),mh=[oh.map,ch.seq,lh.string,sh.nullTag,Qs.trueTag,Qs.falseTag,dr.intBin,dr.intOct,dr.int,dr.intHex,ea.floatNaN,ea.floatExp,ea.float,uh.binary,dh.merge,fh.omap,hh.pairs,ph.set,ta.intTime,ta.floatTime,ta.timestamp];Zs.schema=mh});var uc=N(na=>{"use strict";var nc=lt(),vh=Xi(),ac=ut(),gh=Vt(),wh=$n(),ia=Hn(),ra=Bn(),yh=js(),Nh=Hs(),oc=Vn(),Gt=qi(),sc=Jn(),cc=nr(),tc=ec(),lc=Xn(),fr=Zn(),ic=new Map([["core",yh.schema],["failsafe",[nc.map,ac.seq,gh.string]],["json",Nh.schema],["yaml11",tc.schema],["yaml-1.1",tc.schema]]),rc={binary:oc.binary,bool:wh.boolTag,float:ia.float,floatExp:ia.floatExp,floatNaN:ia.floatNaN,floatTime:fr.floatTime,int:ra.int,intHex:ra.intHex,intOct:ra.intOct,intTime:fr.intTime,map:nc.map,merge:Gt.merge,null:vh.nullTag,omap:sc.omap,pairs:cc.pairs,seq:ac.seq,set:lc.set,timestamp:fr.timestamp},bh={"tag:yaml.org,2002:binary":oc.binary,"tag:yaml.org,2002:merge":Gt.merge,"tag:yaml.org,2002:omap":sc.omap,"tag:yaml.org,2002:pairs":cc.pairs,"tag:yaml.org,2002:set":lc.set,"tag:yaml.org,2002:timestamp":fr.timestamp};function kh(t,e,i){let r=ic.get(e);if(r&&!t)return i&&!r.includes(Gt.merge)?r.concat(Gt.merge):r.slice();let n=r;if(!n)if(Array.isArray(t))n=[];else{let a=Array.from(ic.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(t))for(let a of t)n=n.concat(a);else typeof t=="function"&&(n=t(n.slice()));return i&&(n=n.concat(Gt.merge)),n.reduce((a,o)=>{let s=typeof o=="string"?rc[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(rc).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},[])}na.coreKnownTags=bh;na.getTags=kh});var sa=N(dc=>{"use strict";var aa=P(),Sh=lt(),Eh=ut(),xh=Vt(),hr=uc(),Ph=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,oa=class t{constructor({compat:e,customTags:i,merge:r,resolveKnownTags:n,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?hr.getTags(e,"compat"):e?hr.getTags(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=n?hr.coreKnownTags:{},this.tags=hr.getTags(i,this.name,r),this.toStringOptions=s??null,Object.defineProperty(this,aa.MAP,{value:Sh.map}),Object.defineProperty(this,aa.SCALAR,{value:xh.string}),Object.defineProperty(this,aa.SEQ,{value:Eh.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Ph:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};dc.Schema=oa});var hc=N(fc=>{"use strict";var Ch=P(),ca=Lt(),Ut=Ot();function Rh(t,e){let i=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(i.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&i.push("---");let n=ca.createStringifyContext(t,e),{commentString:a}=n.options;if(t.commentBefore){i.length!==1&&i.unshift("");let c=a(t.commentBefore);i.unshift(Ut.indentComment(c,""))}let o=!1,s=null;if(t.contents){if(Ch.isNode(t.contents)){if(t.contents.spaceBefore&&r&&i.push(""),t.contents.commentBefore){let d=a(t.contents.commentBefore);i.push(Ut.indentComment(d,""))}n.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>o=!0,l=ca.stringify(t.contents,n,()=>s=null,c);s&&(l+=Ut.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(ca.stringify(t.contents,n));if(t.directives?.docEnd)if(t.comment){let c=a(t.comment);c.includes(`
58
+ `)?(i.push("..."),i.push(Ut.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(Ut.indentComment(a(c),"")))}return i.join(`
59
59
  `)+`
60
- `}nc.stringifyDocument=yh});var Ut=N(oc=>{"use strict";var Nh=It(),dt=_i(),K=x(),bh=Pe(),kh=be(),Sh=ea(),Eh=ac(),ia=xi(),Ph=on(),xh=jt(),ra=an(),na=class t{constructor(e,i,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,K.NODE_TYPE,{value:K.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 ra.Directives({version:o}),this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,n,r)}clone(){let e=Object.create(t.prototype,{[K.NODE_TYPE]:{value:K.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=K.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ft(this.contents)&&this.contents.add(e)}addIn(e,i){ft(this.contents)&&this.contents.addIn(e,i)}createAlias(e,i){if(!e.anchor){let r=ia.anchorNames(this);e.anchor=!i||r.has(i)?ia.findNewAnchor(i||"a",r):i}return new Nh.Alias(e.anchor)}createNode(e,i,r){let n;if(typeof i=="function")e=i.call({"":e},"",e),n=i;else if(Array.isArray(i)){let p=y=>typeof y=="number"||y instanceof String||y instanceof Number,g=i.filter(p).map(String);g.length>0&&(i=i.concat(g)),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:f,setAnchors:h,sourceObjects:m}=ia.createNodeAnchors(this,o||"a"),w={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:m},u=xh.createNode(e,d,w);return s&&K.isCollection(u)&&(u.flow=!0),h(),u}createPair(e,i,r={}){let n=this.createNode(e,null,r),a=this.createNode(i,null,r);return new bh.Pair(n,a)}delete(e){return ft(this.contents)?this.contents.delete(e):!1}deleteIn(e){return dt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ft(this.contents)?this.contents.deleteIn(e):!1}get(e,i){return K.isCollection(this.contents)?this.contents.get(e,i):void 0}getIn(e,i){return dt.isEmptyPath(e)?!i&&K.isScalar(this.contents)?this.contents.value:this.contents:K.isCollection(this.contents)?this.contents.getIn(e,i):void 0}has(e){return K.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return dt.isEmptyPath(e)?this.contents!==void 0:K.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,i){this.contents==null?this.contents=dt.collectionFromPath(this.schema,[e],i):ft(this.contents)&&this.contents.set(e,i)}setIn(e,i){dt.isEmptyPath(e)?this.contents=i:this.contents==null?this.contents=dt.collectionFromPath(this.schema,Array.from(e),i):ft(this.contents)&&this.contents.setIn(e,i)}setSchema(e,i={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ra.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new ra.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let n=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(r)this.schema=new Sh.Schema(Object.assign(r,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:i,mapAsMap:r,maxAliasCount:n,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=kh.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"?Ph.applyReviver(o,{"":c},"",c):c}toJSON(e,i){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:i})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let i=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return Eh.stringifyDocument(this,e)}};function ft(t){if(K.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}oc.Document=na});var Xt=N(Yt=>{"use strict";var Kt=class extends Error{constructor(e,i,r,n){super(),this.name=e,this.code=r,this.message=n,this.pos=i}},aa=class extends Kt{constructor(e,i,r){super("YAMLParseError",e,i,r)}},oa=class extends Kt{constructor(e,i,r){super("YAMLWarning",e,i,r)}},Ch=(t,e)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>e.linePos(s));let{line:r,col:n}=i.linePos[0];i.message+=` at line ${r}, column ${n}`;let a=n-1,o=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),r>1&&/^ *$/.test(o.substring(0,a))){let s=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);s.length>80&&(s=s.substring(0,79)+`…
60
+ `}fc.stringifyDocument=Rh});var Kt=N(pc=>{"use strict";var Ah=jt(),ft=ji(),K=P(),_h=xe(),Th=be(),Ih=sa(),jh=hc(),la=Ai(),$h=hn(),Oh=$t(),ua=fn(),da=class t{constructor(e,i,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,K.NODE_TYPE,{value:K.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 ua.Directives({version:o}),this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,n,r)}clone(){let e=Object.create(t.prototype,{[K.NODE_TYPE]:{value:K.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=K.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ht(this.contents)&&this.contents.add(e)}addIn(e,i){ht(this.contents)&&this.contents.addIn(e,i)}createAlias(e,i){if(!e.anchor){let r=la.anchorNames(this);e.anchor=!i||r.has(i)?la.findNewAnchor(i||"a",r):i}return new Ah.Alias(e.anchor)}createNode(e,i,r){let n;if(typeof i=="function")e=i.call({"":e},"",e),n=i;else if(Array.isArray(i)){let p=y=>typeof y=="number"||y instanceof String||y instanceof Number,g=i.filter(p).map(String);g.length>0&&(i=i.concat(g)),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:f,setAnchors:h,sourceObjects:m}=la.createNodeAnchors(this,o||"a"),w={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:m},u=Oh.createNode(e,d,w);return s&&K.isCollection(u)&&(u.flow=!0),h(),u}createPair(e,i,r={}){let n=this.createNode(e,null,r),a=this.createNode(i,null,r);return new _h.Pair(n,a)}delete(e){return ht(this.contents)?this.contents.delete(e):!1}deleteIn(e){return ft.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ht(this.contents)?this.contents.deleteIn(e):!1}get(e,i){return K.isCollection(this.contents)?this.contents.get(e,i):void 0}getIn(e,i){return ft.isEmptyPath(e)?!i&&K.isScalar(this.contents)?this.contents.value:this.contents:K.isCollection(this.contents)?this.contents.getIn(e,i):void 0}has(e){return K.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return ft.isEmptyPath(e)?this.contents!==void 0:K.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,i){this.contents==null?this.contents=ft.collectionFromPath(this.schema,[e],i):ht(this.contents)&&this.contents.set(e,i)}setIn(e,i){ft.isEmptyPath(e)?this.contents=i:this.contents==null?this.contents=ft.collectionFromPath(this.schema,Array.from(e),i):ht(this.contents)&&this.contents.setIn(e,i)}setSchema(e,i={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ua.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new ua.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let n=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(r)this.schema=new Ih.Schema(Object.assign(r,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:i,mapAsMap:r,maxAliasCount:n,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=Th.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"?$h.applyReviver(o,{"":c},"",c):c}toJSON(e,i){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:i})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let i=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return jh.stringifyDocument(this,e)}};function ht(t){if(K.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}pc.Document=da});var Qt=N(Xt=>{"use strict";var Yt=class extends Error{constructor(e,i,r,n){super(),this.name=e,this.code=r,this.message=n,this.pos=i}},fa=class extends Yt{constructor(e,i,r){super("YAMLParseError",e,i,r)}},ha=class extends Yt{constructor(e,i,r){super("YAMLWarning",e,i,r)}},Hh=(t,e)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>e.linePos(s));let{line:r,col:n}=i.linePos[0];i.message+=` at line ${r}, column ${n}`;let a=n-1,o=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),r>1&&/^ *$/.test(o.substring(0,a))){let s=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);s.length>80&&(s=s.substring(0,79)+`…
61
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
- `}};Yt.YAMLError=Kt;Yt.YAMLParseError=aa;Yt.YAMLWarning=oa;Yt.prettifyError=Ch});var Qt=N(sc=>{"use strict";function Rh(t,{flow:e,indicator:i,next:r,offset:n,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,d=s,f="",h="",m=!1,w=!1,u=null,p=null,g=null,y=null,b=null,S=null,E=null;for(let k of t)switch(w&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&a(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),w=!1),u&&(l&&k.type!=="comment"&&k.type!=="newline"&&a(u,"TAB_AS_INDENT","Tabs are not allowed as indentation"),u=null),k.type){case"space":!e&&(i!=="doc-start"||r?.type!=="flow-collection")&&k.source.includes(" ")&&(u=k),d=!0;break;case"comment":{d||a(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=k.source.substring(1)||" ";f?f+=h+C:f=C,h="",l=!1;break}case"newline":l?f?f+=k.source:(!S||i!=="seq-item-ind")&&(c=!0):h+=k.source,l=!0,m=!0,(p||g)&&(y=k),d=!0;break;case"anchor":p&&a(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&a(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=k,E??(E=k.offset),l=!1,d=!1,w=!0;break;case"tag":{g&&a(k,"MULTIPLE_TAGS","A node can have at most one tag"),g=k,E??(E=k.offset),l=!1,d=!1,w=!0;break}case i:(p||g)&&a(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),S&&a(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),S=k,l=i==="seq-item-ind"||i==="explicit-key-ind",d=!1;break;case"comma":if(e){b&&a(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=k,l=!1,d=!1;break}default:a(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),l=!1,d=!1}let v=t[t.length-1],P=v?v.offset+v.source.length:n;return w&&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"),u&&(l&&u.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&a(u,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:S,spaceBefore:c,comment:f,hasNewline:m,anchor:p,tag:g,newlineAfterProp:y,end:P,start:E??P}}sc.resolveProps=Rh});var dr=N(cc=>{"use strict";function sa(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
66
- `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let i of e.start)if(i.type==="newline")return!0;if(e.sep){for(let i of e.sep)if(i.type==="newline")return!0}if(sa(e.key)||sa(e.value))return!0}return!1;default:return!0}}cc.containsNewline=sa});var ca=N(lc=>{"use strict";var Ah=dr();function _h(t,e,i){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&Ah.containsNewline(e)&&i(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}lc.flowIndentCheck=_h});var la=N(dc=>{"use strict";var uc=x();function Th(t,e,i){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let n=typeof r=="function"?r:(a,o)=>a===o||uc.isScalar(a)&&uc.isScalar(o)&&a.value===o.value;return e.some(a=>n(a.key,i))}dc.mapIncludes=Th});var gc=N(vc=>{"use strict";var fc=Pe(),Ih=Ce(),hc=Qt(),jh=dr(),pc=ca(),$h=la(),mc="All mapping items must start at the same column";function Oh({composeNode:t,composeEmptyNode:e},i,r,n,a){let o=a?.nodeClass??Ih.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:f,key:h,sep:m,value:w}=d,u=hc.resolveProps(f,{indicator:"explicit-key-ind",next:h??m?.[0],offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0}),p=!u.found;if(p){if(h&&(h.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==r.indent&&n(c,"BAD_INDENT",mc)),!u.anchor&&!u.tag&&!m){l=u.end,u.comment&&(s.comment?s.comment+=`
67
- `+u.comment:s.comment=u.comment);continue}(u.newlineAfterProp||jh.containsNewline(h))&&n(h??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else u.found?.indent!==r.indent&&n(c,"BAD_INDENT",mc);i.atKey=!0;let g=u.end,y=h?t(i,h,u,n):e(i,g,f,null,u,n);i.schema.compat&&pc.flowIndentCheck(r.indent,h,n),i.atKey=!1,$h.mapIncludes(i,s.items,y)&&n(g,"DUPLICATE_KEY","Map keys must be unique");let b=hc.resolveProps(m??[],{indicator:"map-value-ind",next:w,offset:y.range[2],onError:n,parentIndent:r.indent,startOnNewline:!h||h.type==="block-scalar"});if(c=b.end,b.found){p&&(w?.type==="block-map"&&!b.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&u.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 S=w?t(i,w,b,n):e(i,c,m,null,b,n);i.schema.compat&&pc.flowIndentCheck(r.indent,w,n),c=S.range[2];let E=new fc.Pair(y,S);i.options.keepSourceTokens&&(E.srcToken=d),s.items.push(E)}else{p&&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 S=new fc.Pair(y);i.options.keepSourceTokens&&(S.srcToken=d),s.items.push(S)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[r.offset,c,l??c],s}vc.resolveBlockMap=Oh});var yc=N(wc=>{"use strict";var Hh=Re(),Dh=Qt(),Bh=ca();function Lh({composeNode:t,composeEmptyNode:e},i,r,n,a){let o=a?.nodeClass??Hh.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:f}of r.items){let h=Dh.resolveProps(d,{indicator:"seq-item-ind",next:f,offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0});if(!h.found)if(h.anchor||h.tag||f)f?.type==="block-seq"?n(h.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=h.end,h.comment&&(s.comment=h.comment);continue}let m=f?t(i,f,h,n):e(i,h.end,d,null,h,n);i.schema.compat&&Bh.flowIndentCheck(r.indent,f,n),c=m.range[2],s.items.push(m)}return s.range=[r.offset,c,l??c],s}wc.resolveBlockSeq=Lh});var ht=N(Nc=>{"use strict";function Mh(t,e,i,r){let n="";if(t){let a=!1,o="";for(let s of t){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{i&&!a&&r(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let 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`)}e+=c.length}}return{comment:n,offset:e}}Nc.resolveEnd=Mh});var Ec=N(Sc=>{"use strict";var Fh=x(),Vh=Pe(),bc=Ce(),qh=Re(),Wh=ht(),kc=Qt(),zh=dr(),Jh=la(),ua="Block collections are not allowed within flow collections",da=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Gh({composeNode:t,composeEmptyNode:e},i,r,n,a){let o=r.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?bc.YAMLMap:qh.YAMLSeq),l=new c(i.schema);l.flow=!0;let d=i.atRoot;d&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let f=r.offset+r.start.source.length;for(let p=0;p<r.items.length;++p){let g=r.items[p],{start:y,key:b,sep:S,value:E}=g,v=kc.resolveProps(y,{flow:s,indicator:"explicit-key-ind",next:b??S?.[0],offset:f,onError:n,parentIndent:r.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!S&&!E){p===0&&v.comma?n(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):p<r.items.length-1&&n(v.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),v.comment&&(l.comment?l.comment+=`
69
- `+v.comment:l.comment=v.comment),f=v.end;continue}!o&&i.options.strict&&zh.containsNewline(b)&&n(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(p===0)v.comma&&n(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(v.comma||n(v.start,"MISSING_CHAR",`Missing , between ${s} items`),v.comment){let P="";e:for(let k of y)switch(k.type){case"comma":case"space":break;case"comment":P=k.source.substring(1);break e;default:break e}if(P){let k=l.items[l.items.length-1];Fh.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
70
- `+P:k.comment=P,v.comment=v.comment.substring(P.length+1)}}if(!o&&!S&&!v.found){let P=E?t(i,E,v,n):e(i,v.end,S,null,v,n);l.items.push(P),f=P.range[2],da(E)&&n(P.range,"BLOCK_IN_FLOW",ua)}else{i.atKey=!0;let P=v.end,k=b?t(i,b,v,n):e(i,P,y,null,v,n);da(b)&&n(k.range,"BLOCK_IN_FLOW",ua),i.atKey=!1;let C=kc.resolveProps(S??[],{flow:s,indicator:"map-value-ind",next:E,offset:k.range[2],onError:n,parentIndent:r.indent,startOnNewline:!1});if(C.found){if(!o&&!v.found&&i.options.strict){if(S)for(let j of S){if(j===C.found)break;if(j.type==="newline"){n(j,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.start<C.found.offset-1024&&n(C.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?n(E,"MISSING_CHAR",`Missing space after : in ${s}`):n(C.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let F=E?t(i,E,C,n):C.found?e(i,C.end,S,null,C,n):null;F?da(E)&&n(F.range,"BLOCK_IN_FLOW",ua):C.comment&&(k.comment?k.comment+=`
71
- `+C.comment:k.comment=C.comment);let ve=new Vh.Pair(k,F);if(i.options.keepSourceTokens&&(ve.srcToken=g),o){let j=l;Jh.mapIncludes(i,j.items,k)&&n(P,"DUPLICATE_KEY","Map keys must be unique"),j.items.push(ve)}else{let j=new bc.YAMLMap(i.schema);j.flow=!0,j.items.push(ve);let So=(F??k).range;j.range=[k.range[0],So[1],So[2]],l.items.push(j)}f=F?F.range[2]:C.end}}let h=o?"}":"]",[m,...w]=r.end,u=f;if(m?.source===h)u=m.offset+m.source.length;else{let p=s[0].toUpperCase()+s.substring(1),g=d?`${p} must end with a ${h}`:`${p} in block collection must be sufficiently indented and end with a ${h}`;n(f,d?"MISSING_CHAR":"BAD_INDENT",g),m&&m.source.length!==1&&w.unshift(m)}if(w.length>0){let p=Wh.resolveEnd(w,u,i.options.strict,n);p.comment&&(l.comment?l.comment+=`
72
- `+p.comment:l.comment=p.comment),l.range=[r.offset,u,p.offset]}else l.range=[r.offset,u,u];return l}Sc.resolveFlowCollection=Gh});var xc=N(Pc=>{"use strict";var Uh=x(),Kh=T(),Yh=Ce(),Xh=Re(),Qh=gc(),Zh=yc(),ep=Ec();function fa(t,e,i,r,n,a){let o=i.type==="block-map"?Qh.resolveBlockMap(t,e,i,r,a):i.type==="block-seq"?Zh.resolveBlockSeq(t,e,i,r,a):ep.resolveFlowCollection(t,e,i,r,a),s=o.constructor;return n==="!"||n===s.tagName?(o.tag=s.tagName,o):(n&&(o.tag=n),o)}function tp(t,e,i,r,n){let a=r.tag,o=a?e.directives.tagName(a.source,h=>n(a,"TAG_RESOLVE_FAILED",h)):null;if(i.type==="block-seq"){let{anchor:h,newlineAfterProp:m}=r,w=h&&a?h.offset>a.offset?h:a:h??a;w&&(!m||m.offset<w.offset)&&n(w,"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===Yh.YAMLMap.tagName&&s==="map"||o===Xh.YAMLSeq.tagName&&s==="seq")return fa(t,e,i,n,o);let c=e.schema.tags.find(h=>h.tag===o&&h.collection===s);if(!c){let h=e.schema.knownTags[o];if(h?.collection===s)e.schema.tags.push(Object.assign({},h,{default:!1})),c=h;else return h?n(a,"BAD_COLLECTION_TYPE",`${h.tag} used for ${s} collection, but expects ${h.collection??"scalar"}`,!0):n(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),fa(t,e,i,n,o)}let l=fa(t,e,i,n,o,c),d=c.resolve?.(l,h=>n(a,"TAG_RESOLVE_FAILED",h),e.options)??l,f=Uh.isNode(d)?d:new Kh.Scalar(d);return f.range=l.range,f.tag=o,c?.format&&(f.format=c.format),f}Pc.composeCollection=tp});var pa=N(Cc=>{"use strict";var ha=T();function ip(t,e,i){let r=e.offset,n=rp(e,t.options.strict,i);if(!n)return{value:"",type:null,comment:"",range:[r,r,r]};let a=n.mode===">"?ha.Scalar.BLOCK_FOLDED:ha.Scalar.BLOCK_LITERAL,o=e.source?np(e.source):[],s=o.length;for(let u=o.length-1;u>=0;--u){let p=o[u][1];if(p===""||p==="\r")s=u;else break}if(s===0){let u=n.chomp==="+"&&o.length>0?`
65
+ `}};Xt.YAMLError=Yt;Xt.YAMLParseError=fa;Xt.YAMLWarning=ha;Xt.prettifyError=Hh});var Zt=N(mc=>{"use strict";function Dh(t,{flow:e,indicator:i,next:r,offset:n,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,d=s,f="",h="",m=!1,w=!1,u=null,p=null,g=null,y=null,b=null,S=null,E=null;for(let k of t)switch(w&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&a(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),w=!1),u&&(l&&k.type!=="comment"&&k.type!=="newline"&&a(u,"TAB_AS_INDENT","Tabs are not allowed as indentation"),u=null),k.type){case"space":!e&&(i!=="doc-start"||r?.type!=="flow-collection")&&k.source.includes(" ")&&(u=k),d=!0;break;case"comment":{d||a(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=k.source.substring(1)||" ";f?f+=h+C:f=C,h="",l=!1;break}case"newline":l?f?f+=k.source:(!S||i!=="seq-item-ind")&&(c=!0):h+=k.source,l=!0,m=!0,(p||g)&&(y=k),d=!0;break;case"anchor":p&&a(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&a(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=k,E??(E=k.offset),l=!1,d=!1,w=!0;break;case"tag":{g&&a(k,"MULTIPLE_TAGS","A node can have at most one tag"),g=k,E??(E=k.offset),l=!1,d=!1,w=!0;break}case i:(p||g)&&a(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),S&&a(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),S=k,l=i==="seq-item-ind"||i==="explicit-key-ind",d=!1;break;case"comma":if(e){b&&a(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=k,l=!1,d=!1;break}default:a(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),l=!1,d=!1}let v=t[t.length-1],x=v?v.offset+v.source.length:n;return w&&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"),u&&(l&&u.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&a(u,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:S,spaceBefore:c,comment:f,hasNewline:m,anchor:p,tag:g,newlineAfterProp:y,end:x,start:E??x}}mc.resolveProps=Dh});var pr=N(vc=>{"use strict";function pa(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
66
+ `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let i of e.start)if(i.type==="newline")return!0;if(e.sep){for(let i of e.sep)if(i.type==="newline")return!0}if(pa(e.key)||pa(e.value))return!0}return!1;default:return!0}}vc.containsNewline=pa});var ma=N(gc=>{"use strict";var Bh=pr();function Lh(t,e,i){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&Bh.containsNewline(e)&&i(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}gc.flowIndentCheck=Lh});var va=N(yc=>{"use strict";var wc=P();function Mh(t,e,i){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let n=typeof r=="function"?r:(a,o)=>a===o||wc.isScalar(a)&&wc.isScalar(o)&&a.value===o.value;return e.some(a=>n(a.key,i))}yc.mapIncludes=Mh});var xc=N(Ec=>{"use strict";var Nc=xe(),Fh=Ce(),bc=Zt(),Vh=pr(),kc=ma(),qh=va(),Sc="All mapping items must start at the same column";function Wh({composeNode:t,composeEmptyNode:e},i,r,n,a){let o=a?.nodeClass??Fh.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:f,key:h,sep:m,value:w}=d,u=bc.resolveProps(f,{indicator:"explicit-key-ind",next:h??m?.[0],offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0}),p=!u.found;if(p){if(h&&(h.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==r.indent&&n(c,"BAD_INDENT",Sc)),!u.anchor&&!u.tag&&!m){l=u.end,u.comment&&(s.comment?s.comment+=`
67
+ `+u.comment:s.comment=u.comment);continue}(u.newlineAfterProp||Vh.containsNewline(h))&&n(h??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else u.found?.indent!==r.indent&&n(c,"BAD_INDENT",Sc);i.atKey=!0;let g=u.end,y=h?t(i,h,u,n):e(i,g,f,null,u,n);i.schema.compat&&kc.flowIndentCheck(r.indent,h,n),i.atKey=!1,qh.mapIncludes(i,s.items,y)&&n(g,"DUPLICATE_KEY","Map keys must be unique");let b=bc.resolveProps(m??[],{indicator:"map-value-ind",next:w,offset:y.range[2],onError:n,parentIndent:r.indent,startOnNewline:!h||h.type==="block-scalar"});if(c=b.end,b.found){p&&(w?.type==="block-map"&&!b.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&u.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 S=w?t(i,w,b,n):e(i,c,m,null,b,n);i.schema.compat&&kc.flowIndentCheck(r.indent,w,n),c=S.range[2];let E=new Nc.Pair(y,S);i.options.keepSourceTokens&&(E.srcToken=d),s.items.push(E)}else{p&&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 S=new Nc.Pair(y);i.options.keepSourceTokens&&(S.srcToken=d),s.items.push(S)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[r.offset,c,l??c],s}Ec.resolveBlockMap=Wh});var Cc=N(Pc=>{"use strict";var zh=Re(),Jh=Zt(),Gh=ma();function Uh({composeNode:t,composeEmptyNode:e},i,r,n,a){let o=a?.nodeClass??zh.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:f}of r.items){let h=Jh.resolveProps(d,{indicator:"seq-item-ind",next:f,offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0});if(!h.found)if(h.anchor||h.tag||f)f?.type==="block-seq"?n(h.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=h.end,h.comment&&(s.comment=h.comment);continue}let m=f?t(i,f,h,n):e(i,h.end,d,null,h,n);i.schema.compat&&Gh.flowIndentCheck(r.indent,f,n),c=m.range[2],s.items.push(m)}return s.range=[r.offset,c,l??c],s}Pc.resolveBlockSeq=Uh});var pt=N(Rc=>{"use strict";function Kh(t,e,i,r){let n="";if(t){let a=!1,o="";for(let s of t){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{i&&!a&&r(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let 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`)}e+=c.length}}return{comment:n,offset:e}}Rc.resolveEnd=Kh});var Ic=N(Tc=>{"use strict";var Yh=P(),Xh=xe(),Ac=Ce(),Qh=Re(),Zh=pt(),_c=Zt(),ep=pr(),tp=va(),ga="Block collections are not allowed within flow collections",wa=t=>t&&(t.type==="block-map"||t.type==="block-seq");function ip({composeNode:t,composeEmptyNode:e},i,r,n,a){let o=r.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?Ac.YAMLMap:Qh.YAMLSeq),l=new c(i.schema);l.flow=!0;let d=i.atRoot;d&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let f=r.offset+r.start.source.length;for(let p=0;p<r.items.length;++p){let g=r.items[p],{start:y,key:b,sep:S,value:E}=g,v=_c.resolveProps(y,{flow:s,indicator:"explicit-key-ind",next:b??S?.[0],offset:f,onError:n,parentIndent:r.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!S&&!E){p===0&&v.comma?n(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):p<r.items.length-1&&n(v.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),v.comment&&(l.comment?l.comment+=`
69
+ `+v.comment:l.comment=v.comment),f=v.end;continue}!o&&i.options.strict&&ep.containsNewline(b)&&n(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(p===0)v.comma&&n(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(v.comma||n(v.start,"MISSING_CHAR",`Missing , between ${s} items`),v.comment){let x="";e:for(let k of y)switch(k.type){case"comma":case"space":break;case"comment":x=k.source.substring(1);break e;default:break e}if(x){let k=l.items[l.items.length-1];Yh.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
70
+ `+x:k.comment=x,v.comment=v.comment.substring(x.length+1)}}if(!o&&!S&&!v.found){let x=E?t(i,E,v,n):e(i,v.end,S,null,v,n);l.items.push(x),f=x.range[2],wa(E)&&n(x.range,"BLOCK_IN_FLOW",ga)}else{i.atKey=!0;let x=v.end,k=b?t(i,b,v,n):e(i,x,y,null,v,n);wa(b)&&n(k.range,"BLOCK_IN_FLOW",ga),i.atKey=!1;let C=_c.resolveProps(S??[],{flow:s,indicator:"map-value-ind",next:E,offset:k.range[2],onError:n,parentIndent:r.indent,startOnNewline:!1});if(C.found){if(!o&&!v.found&&i.options.strict){if(S)for(let j of S){if(j===C.found)break;if(j.type==="newline"){n(j,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.start<C.found.offset-1024&&n(C.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?n(E,"MISSING_CHAR",`Missing space after : in ${s}`):n(C.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let F=E?t(i,E,C,n):C.found?e(i,C.end,S,null,C,n):null;F?wa(E)&&n(F.range,"BLOCK_IN_FLOW",ga):C.comment&&(k.comment?k.comment+=`
71
+ `+C.comment:k.comment=C.comment);let me=new Xh.Pair(k,F);if(i.options.keepSourceTokens&&(me.srcToken=g),o){let j=l;tp.mapIncludes(i,j.items,k)&&n(x,"DUPLICATE_KEY","Map keys must be unique"),j.items.push(me)}else{let j=new Ac.YAMLMap(i.schema);j.flow=!0,j.items.push(me);let To=(F??k).range;j.range=[k.range[0],To[1],To[2]],l.items.push(j)}f=F?F.range[2]:C.end}}let h=o?"}":"]",[m,...w]=r.end,u=f;if(m?.source===h)u=m.offset+m.source.length;else{let p=s[0].toUpperCase()+s.substring(1),g=d?`${p} must end with a ${h}`:`${p} in block collection must be sufficiently indented and end with a ${h}`;n(f,d?"MISSING_CHAR":"BAD_INDENT",g),m&&m.source.length!==1&&w.unshift(m)}if(w.length>0){let p=Zh.resolveEnd(w,u,i.options.strict,n);p.comment&&(l.comment?l.comment+=`
72
+ `+p.comment:l.comment=p.comment),l.range=[r.offset,u,p.offset]}else l.range=[r.offset,u,u];return l}Tc.resolveFlowCollection=ip});var $c=N(jc=>{"use strict";var rp=P(),np=T(),ap=Ce(),op=Re(),sp=xc(),cp=Cc(),lp=Ic();function ya(t,e,i,r,n,a){let o=i.type==="block-map"?sp.resolveBlockMap(t,e,i,r,a):i.type==="block-seq"?cp.resolveBlockSeq(t,e,i,r,a):lp.resolveFlowCollection(t,e,i,r,a),s=o.constructor;return n==="!"||n===s.tagName?(o.tag=s.tagName,o):(n&&(o.tag=n),o)}function up(t,e,i,r,n){let a=r.tag,o=a?e.directives.tagName(a.source,h=>n(a,"TAG_RESOLVE_FAILED",h)):null;if(i.type==="block-seq"){let{anchor:h,newlineAfterProp:m}=r,w=h&&a?h.offset>a.offset?h:a:h??a;w&&(!m||m.offset<w.offset)&&n(w,"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===ap.YAMLMap.tagName&&s==="map"||o===op.YAMLSeq.tagName&&s==="seq")return ya(t,e,i,n,o);let c=e.schema.tags.find(h=>h.tag===o&&h.collection===s);if(!c){let h=e.schema.knownTags[o];if(h?.collection===s)e.schema.tags.push(Object.assign({},h,{default:!1})),c=h;else return h?n(a,"BAD_COLLECTION_TYPE",`${h.tag} used for ${s} collection, but expects ${h.collection??"scalar"}`,!0):n(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),ya(t,e,i,n,o)}let l=ya(t,e,i,n,o,c),d=c.resolve?.(l,h=>n(a,"TAG_RESOLVE_FAILED",h),e.options)??l,f=rp.isNode(d)?d:new np.Scalar(d);return f.range=l.range,f.tag=o,c?.format&&(f.format=c.format),f}jc.composeCollection=up});var ba=N(Oc=>{"use strict";var Na=T();function dp(t,e,i){let r=e.offset,n=fp(e,t.options.strict,i);if(!n)return{value:"",type:null,comment:"",range:[r,r,r]};let a=n.mode===">"?Na.Scalar.BLOCK_FOLDED:Na.Scalar.BLOCK_LITERAL,o=e.source?hp(e.source):[],s=o.length;for(let u=o.length-1;u>=0;--u){let p=o[u][1];if(p===""||p==="\r")s=u;else break}if(s===0){let u=n.chomp==="+"&&o.length>0?`
73
73
  `.repeat(Math.max(1,o.length-1)):"",p=r+n.length;return e.source&&(p+=e.source.length),{value:u,type:a,comment:n.comment,range:[r,p,p]}}let c=e.indent+n.indent,l=e.offset+n.length,d=0;for(let u=0;u<s;++u){let[p,g]=o[u];if(g===""||g==="\r")n.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"),n.indent===0&&(c=p.length),d=u,c===0&&!t.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=p.length+g.length+1}for(let u=o.length-1;u>=s;--u)o[u][0].length>c&&(s=u+1);let f="",h="",m=!1;for(let u=0;u<d;++u)f+=o[u][0].slice(c)+`
74
- `;for(let u=d;u<s;++u){let[p,g]=o[u];l+=p.length+g.length+1;let y=g[g.length-1]==="\r";if(y&&(g=g.slice(0,-1)),g&&p.length<c){let S=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;i(l-g.length-(y?2:1),"BAD_INDENT",S),p=""}a===ha.Scalar.BLOCK_LITERAL?(f+=h+p.slice(c)+g,h=`
74
+ `;for(let u=d;u<s;++u){let[p,g]=o[u];l+=p.length+g.length+1;let y=g[g.length-1]==="\r";if(y&&(g=g.slice(0,-1)),g&&p.length<c){let S=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;i(l-g.length-(y?2:1),"BAD_INDENT",S),p=""}a===Na.Scalar.BLOCK_LITERAL?(f+=h+p.slice(c)+g,h=`
75
75
  `):p.length>c||g[0]===" "?(h===" "?h=`
76
76
  `:!m&&h===`
77
77
  `&&(h=`
@@ -84,75 +84,75 @@ ${l}
84
84
  `+o[u][0].slice(c);f[f.length-1]!==`
85
85
  `&&(f+=`
86
86
  `);break;default:f+=`
87
- `}let w=r+n.length+e.source.length;return{value:f,type:a,comment:n.comment,range:[r,w,w]}}function rp({offset:t,props:e},i,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=e[0],a=n[0],o=0,s="",c=-1;for(let h=1;h<n.length;++h){let m=n[h];if(!s&&(m==="-"||m==="+"))s=m;else{let w=Number(m);!o&&w?o=w:c===-1&&(c=t+h)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,d="",f=n.length;for(let h=1;h<e.length;++h){let m=e[h];switch(m.type){case"space":l=!0;case"newline":f+=m.source.length;break;case"comment":i&&!l&&r(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=m.source.length,d=m.source.substring(1);break;case"error":r(m,"UNEXPECTED_TOKEN",m.message),f+=m.source.length;break;default:{let w=`Unexpected token in block scalar header: ${m.type}`;r(m,"UNEXPECTED_TOKEN",w);let u=m.source;u&&typeof u=="string"&&(f+=u.length)}}}return{mode:a,indent:o,chomp:s,comment:d,length:f}}function np(t){let e=t.split(/\n( *)/),i=e[0],r=i.match(/^( *)/),a=[r?.[1]?[r[1],i.slice(r[1].length)]:["",i]];for(let o=1;o<e.length;o+=2)a.push([e[o],e[o+1]]);return a}Cc.resolveBlockScalar=ip});var va=N(Ac=>{"use strict";var ma=T(),ap=ht();function op(t,e,i){let{offset:r,type:n,source:a,end:o}=t,s,c,l=(h,m,w)=>i(r+h,m,w);switch(n){case"scalar":s=ma.Scalar.PLAIN,c=sp(a,l);break;case"single-quoted-scalar":s=ma.Scalar.QUOTE_SINGLE,c=cp(a,l);break;case"double-quoted-scalar":s=ma.Scalar.QUOTE_DOUBLE,c=lp(a,l);break;default:return i(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[r,r+a.length,r+a.length]}}let d=r+a.length,f=ap.resolveEnd(o,d,e,i);return{value:c,type:s,comment:f.comment,range:[r,d,f.offset]}}function sp(t,e){let i="";switch(t[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${t[0]}`;break}case"@":case"`":{i=`reserved character ${t[0]}`;break}}return i&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Rc(t)}function cp(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Rc(t.slice(1,-1)).replace(/''/g,"'")}function Rc(t){let e,i;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
87
+ `}let w=r+n.length+e.source.length;return{value:f,type:a,comment:n.comment,range:[r,w,w]}}function fp({offset:t,props:e},i,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=e[0],a=n[0],o=0,s="",c=-1;for(let h=1;h<n.length;++h){let m=n[h];if(!s&&(m==="-"||m==="+"))s=m;else{let w=Number(m);!o&&w?o=w:c===-1&&(c=t+h)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,d="",f=n.length;for(let h=1;h<e.length;++h){let m=e[h];switch(m.type){case"space":l=!0;case"newline":f+=m.source.length;break;case"comment":i&&!l&&r(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=m.source.length,d=m.source.substring(1);break;case"error":r(m,"UNEXPECTED_TOKEN",m.message),f+=m.source.length;break;default:{let w=`Unexpected token in block scalar header: ${m.type}`;r(m,"UNEXPECTED_TOKEN",w);let u=m.source;u&&typeof u=="string"&&(f+=u.length)}}}return{mode:a,indent:o,chomp:s,comment:d,length:f}}function hp(t){let e=t.split(/\n( *)/),i=e[0],r=i.match(/^( *)/),a=[r?.[1]?[r[1],i.slice(r[1].length)]:["",i]];for(let o=1;o<e.length;o+=2)a.push([e[o],e[o+1]]);return a}Oc.resolveBlockScalar=dp});var Sa=N(Dc=>{"use strict";var ka=T(),pp=pt();function mp(t,e,i){let{offset:r,type:n,source:a,end:o}=t,s,c,l=(h,m,w)=>i(r+h,m,w);switch(n){case"scalar":s=ka.Scalar.PLAIN,c=vp(a,l);break;case"single-quoted-scalar":s=ka.Scalar.QUOTE_SINGLE,c=gp(a,l);break;case"double-quoted-scalar":s=ka.Scalar.QUOTE_DOUBLE,c=wp(a,l);break;default:return i(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[r,r+a.length,r+a.length]}}let d=r+a.length,f=pp.resolveEnd(o,d,e,i);return{value:c,type:s,comment:f.comment,range:[r,d,f.offset]}}function vp(t,e){let i="";switch(t[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${t[0]}`;break}case"@":case"`":{i=`reserved character ${t[0]}`;break}}return i&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Hc(t)}function gp(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Hc(t.slice(1,-1)).replace(/''/g,"'")}function Hc(t){let e,i;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
88
  `,"sy"),i=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
89
  `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let n=r[1],a=" ",o=e.lastIndex;for(i.lastIndex=o;r=i.exec(t);)r[1]===""?a===`
90
90
  `?n+=a:a=`
91
- `:(n+=a+r[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(t),n+a+(r?.[1]??"")}function lp(t,e){let i="";for(let r=1;r<t.length-1;++r){let n=t[r];if(!(n==="\r"&&t[r+1]===`
91
+ `:(n+=a+r[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(t),n+a+(r?.[1]??"")}function wp(t,e){let i="";for(let r=1;r<t.length-1;++r){let n=t[r];if(!(n==="\r"&&t[r+1]===`
92
92
  `))if(n===`
93
- `){let{fold:a,offset:o}=up(t,r);i+=a,r=o}else if(n==="\\"){let a=t[++r],o=dp[a];if(o)i+=o;else if(a===`
93
+ `){let{fold:a,offset:o}=yp(t,r);i+=a,r=o}else if(n==="\\"){let a=t[++r],o=Np[a];if(o)i+=o;else if(a===`
94
94
  `)for(a=t[r+1];a===" "||a===" ";)a=t[++r+1];else if(a==="\r"&&t[r+1]===`
95
- `)for(a=t[++r+1];a===" "||a===" ";)a=t[++r+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=fp(t,r+1,s,e),r+=s}else{let s=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(n===" "||n===" "){let a=r,o=t[r+1];for(;o===" "||o===" ";)o=t[++r+1];o!==`
95
+ `)for(a=t[++r+1];a===" "||a===" ";)a=t[++r+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=bp(t,r+1,s,e),r+=s}else{let s=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(n===" "||n===" "){let a=r,o=t[r+1];for(;o===" "||o===" ";)o=t[++r+1];o!==`
96
96
  `&&!(o==="\r"&&t[r+2]===`
97
- `)&&(i+=r>a?t.slice(a,r+1):n)}else i+=n}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),i}function up(t,e){let i="",r=t[e+1];for(;(r===" "||r===" "||r===`
97
+ `)&&(i+=r>a?t.slice(a,r+1):n)}else i+=n}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),i}function yp(t,e){let i="",r=t[e+1];for(;(r===" "||r===" "||r===`
98
98
  `||r==="\r")&&!(r==="\r"&&t[e+2]!==`
99
99
  `);)r===`
100
100
  `&&(i+=`
101
- `),e+=1,r=t[e+1];return i||(i=" "),{fold:i,offset:e}}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 fp(t,e,i,r){let n=t.substr(e,i),o=n.length===i&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(o)}catch{let s=t.substr(e-2,i+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Ac.resolveFlowScalar=op});var Ic=N(Tc=>{"use strict";var Je=x(),_c=T(),hp=pa(),pp=va();function mp(t,e,i,r){let{value:n,type:a,comment:o,range:s}=e.type==="block-scalar"?hp.resolveBlockScalar(t,e,r):pp.resolveFlowScalar(e,t.options.strict,r),c=i?t.directives.tagName(i.source,f=>r(i,"TAG_RESOLVE_FAILED",f)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Je.SCALAR]:c?l=vp(t.schema,n,c,i,r):e.type==="scalar"?l=gp(t,n,e,r):l=t.schema[Je.SCALAR];let d;try{let f=l.resolve(n,h=>r(i??e,"TAG_RESOLVE_FAILED",h),t.options);d=Je.isScalar(f)?f:new _c.Scalar(f)}catch(f){let h=f instanceof Error?f.message:String(f);r(i??e,"TAG_RESOLVE_FAILED",h),d=new _c.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 vp(t,e,i,r,n){if(i==="!")return t[Je.SCALAR];let a=[];for(let s of t.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(e))return s;let o=t.knownTags[i];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),t[Je.SCALAR])}function gp({atKey:t,directives:e,schema:i},r,n,a){let o=i.tags.find(s=>(s.default===!0||t&&s.default==="key")&&s.test?.test(r))||i[Je.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(r))??i[Je.SCALAR];if(o.tag!==s.tag){let c=e.tagString(o.tag),l=e.tagString(s.tag),d=`Value may be parsed as either ${c} or ${l}`;a(n,"TAG_RESOLVE_FAILED",d,!0)}}return o}Tc.composeScalar=mp});var $c=N(jc=>{"use strict";function wp(t,e,i){if(e){i??(i=e.length);for(let r=i-1;r>=0;--r){let n=e[r];switch(n.type){case"space":case"comment":case"newline":t-=n.source.length;continue}for(n=e[++r];n?.type==="space";)t+=n.source.length,n=e[++r];break}}return t}jc.emptyScalarPosition=wp});var Dc=N(wa=>{"use strict";var yp=It(),Np=x(),bp=xc(),Oc=Ic(),kp=ht(),Sp=$c(),Ep={composeNode:Hc,composeEmptyNode:ga};function Hc(t,e,i,r){let n=t.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,d=!0;switch(e.type){case"alias":l=Pp(t,e,r),(s||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Oc.composeScalar(t,e,c,r),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=bp.composeCollection(Ep,t,e,i,r),s&&(l.anchor=s.source.substring(1))}catch(f){let h=f instanceof Error?f.message:String(f);r(e,"RESOURCE_EXHAUSTION",h)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",f),d=!1}}return l??(l=ga(t,e.offset,void 0,null,i,r)),s&&l.anchor===""&&r(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&t.options.stringKeys&&(!Np.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&d&&(l.srcToken=e),l}function ga(t,e,i,r,{spaceBefore:n,comment:a,anchor:o,tag:s,end:c},l){let d={type:"scalar",offset:Sp.emptyScalarPosition(e,i,r),indent:-1,source:""},f=Oc.composeScalar(t,d,s,l);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(f.spaceBefore=!0),a&&(f.comment=a,f.range[2]=c),f}function Pp({options:t},{offset:e,source:i,end:r},n){let a=new yp.Alias(i.substring(1));a.source===""&&n(e,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&n(e+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+i.length,s=kp.resolveEnd(r,o,t.strict,n);return a.range=[e,o,s.offset],s.comment&&(a.comment=s.comment),a}wa.composeEmptyNode=ga;wa.composeNode=Hc});var Mc=N(Lc=>{"use strict";var xp=Ut(),Bc=Dc(),Cp=ht(),Rp=Qt();function Ap(t,e,{offset:i,start:r,value:n,end:a},o){let s=Object.assign({_directives:e},t),c=new xp.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Rp.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?Bc.composeNode(l,n,d,o):Bc.composeEmptyNode(l,d.end,r,null,d,o);let f=c.contents.range[2],h=Cp.resolveEnd(a,f,!1,o);return h.comment&&(c.comment=h.comment),c.range=[i,f,h.offset],c}Lc.composeDoc=Ap});var Na=N(qc=>{"use strict";var _p=bi("process"),Tp=an(),Ip=Ut(),Zt=Xt(),Fc=x(),jp=Mc(),$p=ht();function ei(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:i}=t;return[e,e+(typeof i=="string"?i.length:1)]}function Vc(t){let e="",i=!1,r=!1;for(let n=0;n<t.length;++n){let a=t[n];switch(a[0]){case"#":e+=(e===""?"":r?`
101
+ `),e+=1,r=t[e+1];return i||(i=" "),{fold:i,offset:e}}var Np={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function bp(t,e,i,r){let n=t.substr(e,i),o=n.length===i&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(o)}catch{let s=t.substr(e-2,i+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Dc.resolveFlowScalar=mp});var Mc=N(Lc=>{"use strict";var Ge=P(),Bc=T(),kp=ba(),Sp=Sa();function Ep(t,e,i,r){let{value:n,type:a,comment:o,range:s}=e.type==="block-scalar"?kp.resolveBlockScalar(t,e,r):Sp.resolveFlowScalar(e,t.options.strict,r),c=i?t.directives.tagName(i.source,f=>r(i,"TAG_RESOLVE_FAILED",f)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Ge.SCALAR]:c?l=xp(t.schema,n,c,i,r):e.type==="scalar"?l=Pp(t,n,e,r):l=t.schema[Ge.SCALAR];let d;try{let f=l.resolve(n,h=>r(i??e,"TAG_RESOLVE_FAILED",h),t.options);d=Ge.isScalar(f)?f:new Bc.Scalar(f)}catch(f){let h=f instanceof Error?f.message:String(f);r(i??e,"TAG_RESOLVE_FAILED",h),d=new Bc.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 xp(t,e,i,r,n){if(i==="!")return t[Ge.SCALAR];let a=[];for(let s of t.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(e))return s;let o=t.knownTags[i];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),t[Ge.SCALAR])}function Pp({atKey:t,directives:e,schema:i},r,n,a){let o=i.tags.find(s=>(s.default===!0||t&&s.default==="key")&&s.test?.test(r))||i[Ge.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(r))??i[Ge.SCALAR];if(o.tag!==s.tag){let c=e.tagString(o.tag),l=e.tagString(s.tag),d=`Value may be parsed as either ${c} or ${l}`;a(n,"TAG_RESOLVE_FAILED",d,!0)}}return o}Lc.composeScalar=Ep});var Vc=N(Fc=>{"use strict";function Cp(t,e,i){if(e){i??(i=e.length);for(let r=i-1;r>=0;--r){let n=e[r];switch(n.type){case"space":case"comment":case"newline":t-=n.source.length;continue}for(n=e[++r];n?.type==="space";)t+=n.source.length,n=e[++r];break}}return t}Fc.emptyScalarPosition=Cp});var zc=N(xa=>{"use strict";var Rp=jt(),Ap=P(),_p=$c(),qc=Mc(),Tp=pt(),Ip=Vc(),jp={composeNode:Wc,composeEmptyNode:Ea};function Wc(t,e,i,r){let n=t.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,d=!0;switch(e.type){case"alias":l=$p(t,e,r),(s||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=qc.composeScalar(t,e,c,r),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=_p.composeCollection(jp,t,e,i,r),s&&(l.anchor=s.source.substring(1))}catch(f){let h=f instanceof Error?f.message:String(f);r(e,"RESOURCE_EXHAUSTION",h)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",f),d=!1}}return l??(l=Ea(t,e.offset,void 0,null,i,r)),s&&l.anchor===""&&r(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&t.options.stringKeys&&(!Ap.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&d&&(l.srcToken=e),l}function Ea(t,e,i,r,{spaceBefore:n,comment:a,anchor:o,tag:s,end:c},l){let d={type:"scalar",offset:Ip.emptyScalarPosition(e,i,r),indent:-1,source:""},f=qc.composeScalar(t,d,s,l);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(f.spaceBefore=!0),a&&(f.comment=a,f.range[2]=c),f}function $p({options:t},{offset:e,source:i,end:r},n){let a=new Rp.Alias(i.substring(1));a.source===""&&n(e,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&n(e+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+i.length,s=Tp.resolveEnd(r,o,t.strict,n);return a.range=[e,o,s.offset],s.comment&&(a.comment=s.comment),a}xa.composeEmptyNode=Ea;xa.composeNode=Wc});var Uc=N(Gc=>{"use strict";var Op=Kt(),Jc=zc(),Hp=pt(),Dp=Zt();function Bp(t,e,{offset:i,start:r,value:n,end:a},o){let s=Object.assign({_directives:e},t),c=new Op.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Dp.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?Jc.composeNode(l,n,d,o):Jc.composeEmptyNode(l,d.end,r,null,d,o);let f=c.contents.range[2],h=Hp.resolveEnd(a,f,!1,o);return h.comment&&(c.comment=h.comment),c.range=[i,f,h.offset],c}Gc.composeDoc=Bp});var Ca=N(Xc=>{"use strict";var Lp=Ei("process"),Mp=fn(),Fp=Kt(),ei=Qt(),Kc=P(),Vp=Uc(),qp=pt();function ti(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:i}=t;return[e,e+(typeof i=="string"?i.length:1)]}function Yc(t){let e="",i=!1,r=!1;for(let n=0;n<t.length;++n){let a=t[n];switch(a[0]){case"#":e+=(e===""?"":r?`
103
103
 
104
104
  `:`
105
- `)+(a.substring(1)||" "),i=!0,r=!1;break;case"%":t[n+1]?.[0]!=="#"&&(n+=1),i=!1;break;default:i||(r=!0),i=!1}}return{comment:e,afterEmptyLine:r}}var ya=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,r,n,a)=>{let o=ei(i);a?this.warnings.push(new Zt.YAMLWarning(o,r,n)):this.errors.push(new Zt.YAMLParseError(o,r,n))},this.directives=new Tp.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,i){let{comment:r,afterEmptyLine:n}=Vc(this.prelude);if(r){let a=e.contents;if(i)e.comment=e.comment?`${e.comment}
106
- ${r}`:r;else if(n||e.directives.docStart||!a)e.commentBefore=r;else if(Fc.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];Fc.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${r}
105
+ `)+(a.substring(1)||" "),i=!0,r=!1;break;case"%":t[n+1]?.[0]!=="#"&&(n+=1),i=!1;break;default:i||(r=!0),i=!1}}return{comment:e,afterEmptyLine:r}}var Pa=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,r,n,a)=>{let o=ti(i);a?this.warnings.push(new ei.YAMLWarning(o,r,n)):this.errors.push(new ei.YAMLParseError(o,r,n))},this.directives=new Mp.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,i){let{comment:r,afterEmptyLine:n}=Yc(this.prelude);if(r){let a=e.contents;if(i)e.comment=e.comment?`${e.comment}
106
+ ${r}`:r;else if(n||e.directives.docStart||!a)e.commentBefore=r;else if(Kc.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];Kc.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${r}
107
107
  ${s}`:r}else{let o=a.commentBefore;a.commentBefore=o?`${r}
108
- ${o}`:r}}if(i){for(let a=0;a<this.errors.length;++a)e.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)e.warnings.push(this.warnings[a])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Vc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,i=!1,r=-1){for(let n of e)yield*this.next(n);yield*this.end(i,r)}*next(e){switch(_p.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(i,r,n)=>{let a=ei(e);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",r,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let i=jp.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let i=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new Zt.YAMLParseError(ei(e),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Zt.YAMLParseError(ei(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let i=$p.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
109
- ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new Zt.YAMLParseError(ei(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),n=new Ip.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}}};qc.Composer=ya});var Jc=N(fr=>{"use strict";var Op=pa(),Hp=va(),Dp=Xt(),Wc=Dt();function Bp(t,e=!0,i){if(t){let r=(n,a,o)=>{let s=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(i)i(s,a,o);else throw new Dp.YAMLParseError([s,s+1],a,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Hp.resolveFlowScalar(t,e,r);case"block-scalar":return Op.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function Lp(t,e){let{implicitKey:i=!1,indent:r,inFlow:n=!1,offset:a=-1,type:o="PLAIN"}=e,s=Wc.stringifyString({type:o,value:t},{implicitKey:i,indent:r>0?" ".repeat(r):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
108
+ ${o}`:r}}if(i){for(let a=0;a<this.errors.length;++a)e.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)e.warnings.push(this.warnings[a])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Yc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,i=!1,r=-1){for(let n of e)yield*this.next(n);yield*this.end(i,r)}*next(e){switch(Lp.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(i,r,n)=>{let a=ti(e);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",r,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let i=Vp.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let i=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new ei.YAMLParseError(ti(e),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new ei.YAMLParseError(ti(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let i=qp.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
109
+ ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new ei.YAMLParseError(ti(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),n=new Fp.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}}};Xc.Composer=Pa});var el=N(mr=>{"use strict";var Wp=ba(),zp=Sa(),Jp=Qt(),Qc=Bt();function Gp(t,e=!0,i){if(t){let r=(n,a,o)=>{let s=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(i)i(s,a,o);else throw new Jp.YAMLParseError([s,s+1],a,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return zp.resolveFlowScalar(t,e,r);case"block-scalar":return Wp.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function Up(t,e){let{implicitKey:i=!1,indent:r,inFlow:n=!1,offset:a=-1,type:o="PLAIN"}=e,s=Qc.stringifyString({type:o,value:t},{implicitKey:i,indent:r>0?" ".repeat(r):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
110
110
  `}];switch(s[0]){case"|":case">":{let l=s.indexOf(`
111
111
  `),d=s.substring(0,l),f=s.substring(l+1)+`
112
- `,h=[{type:"block-scalar-header",offset:a,indent:r,source:d}];return zc(h,c)||h.push({type:"newline",offset:-1,indent:r,source:`
113
- `}),{type:"block-scalar",offset:a,indent:r,props:h,source:f}}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 Mp(t,e,i={}){let{afterKey:r=!1,implicitKey:n=!1,inFlow:a=!1,type:o}=i,s="indent"in t?t.indent:null;if(r&&typeof s=="number"&&(s+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=Wc.stringifyString({type:o,value:e},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Fp(t,c);break;case'"':ba(t,c,"double-quoted-scalar");break;case"'":ba(t,c,"single-quoted-scalar");break;default:ba(t,c,"scalar")}}function Fp(t,e){let i=e.indexOf(`
112
+ `,h=[{type:"block-scalar-header",offset:a,indent:r,source:d}];return Zc(h,c)||h.push({type:"newline",offset:-1,indent:r,source:`
113
+ `}),{type:"block-scalar",offset:a,indent:r,props:h,source:f}}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 Kp(t,e,i={}){let{afterKey:r=!1,implicitKey:n=!1,inFlow:a=!1,type:o}=i,s="indent"in t?t.indent:null;if(r&&typeof s=="number"&&(s+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=Qc.stringifyString({type:o,value:e},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Yp(t,c);break;case'"':Ra(t,c,"double-quoted-scalar");break;case"'":Ra(t,c,"single-quoted-scalar");break;default:Ra(t,c,"scalar")}}function Yp(t,e){let i=e.indexOf(`
114
114
  `),r=e.substring(0,i),n=e.substring(i+1)+`
115
- `;if(t.type==="block-scalar"){let a=t.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=r,t.source=n}else{let{offset:a}=t,o="indent"in t?t.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:r}];zc(s,"end"in t?t.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
- `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:s,source:n})}}function zc(t,e){if(e)for(let i of e)switch(i.type){case"space":case"comment":t.push(i);break;case"newline":return t.push(i),!0}return!1}function ba(t,e,i){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=i,t.source=e;break;case"block-scalar":{let r=t.props.slice(1),n=e.length;t.props[0].type==="block-scalar-header"&&(n-=t.props[0].source.length);for(let a of r)a.offset+=n;delete t.props,Object.assign(t,{type:i,source:e,end:r});break}case"block-map":case"block-seq":{let n={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
- `};delete t.items,Object.assign(t,{type:i,source:e,end:[n]});break}default:{let r="indent"in t?t.indent:-1,n="end"in t&&Array.isArray(t.end)?t.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(t))a!=="type"&&a!=="offset"&&delete t[a];Object.assign(t,{type:i,indent:r,source:e,end:n})}}}fr.createScalarToken=Lp;fr.resolveAsScalar=Bp;fr.setScalarValue=Mp});var Uc=N(Gc=>{"use strict";var Vp=t=>"type"in t?pr(t):hr(t);function pr(t){switch(t.type){case"block-scalar":{let e="";for(let i of t.props)e+=pr(i);return e+t.source}case"block-map":case"block-seq":{let e="";for(let i of t.items)e+=hr(i);return e}case"flow-collection":{let e=t.start.source;for(let i of t.items)e+=hr(i);for(let i of t.end)e+=i.source;return e}case"document":{let e=hr(t);if(t.end)for(let i of t.end)e+=i.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let i of t.end)e+=i.source;return e}}}function hr({start:t,key:e,sep:i,value:r}){let n="";for(let a of t)n+=a.source;if(e&&(n+=pr(e)),i)for(let a of i)n+=a.source;return r&&(n+=pr(r)),n}Gc.stringify=Vp});var Qc=N(Xc=>{"use strict";var ka=Symbol("break visit"),qp=Symbol("skip children"),Kc=Symbol("remove item");function Ge(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Yc(Object.freeze([]),t,e)}Ge.BREAK=ka;Ge.SKIP=qp;Ge.REMOVE=Kc;Ge.itemAtPath=(t,e)=>{let i=t;for(let[r,n]of e){let a=i?.[r];if(a&&"items"in a)i=a.items[n];else return}return i};Ge.parentCollection=(t,e)=>{let i=Ge.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],n=i?.[r];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function Yc(t,e,i){let r=i(e,t);if(typeof r=="symbol")return r;for(let n of["key","value"]){let a=e[n];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=Yc(Object.freeze(t.concat([[n,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===ka)return ka;s===Kc&&(a.items.splice(o,1),o-=1)}}typeof r=="function"&&n==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}Xc.visit=Ge});var mr=N(q=>{"use strict";var Sa=Jc(),Wp=Uc(),zp=Qc(),Ea="\uFEFF",Pa="",xa="",Ca="",Jp=t=>!!t&&"items"in t,Gp=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Up(t){switch(t){case Ea:return"<BOM>";case Pa:return"<DOC>";case xa:return"<FLOW_END>";case Ca:return"<SCALAR>";default:return JSON.stringify(t)}}function Kp(t){switch(t){case Ea:return"byte-order-mark";case Pa:return"doc-mode";case xa:return"flow-error-end";case Ca:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
115
+ `;if(t.type==="block-scalar"){let a=t.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=r,t.source=n}else{let{offset:a}=t,o="indent"in t?t.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:r}];Zc(s,"end"in t?t.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
+ `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:s,source:n})}}function Zc(t,e){if(e)for(let i of e)switch(i.type){case"space":case"comment":t.push(i);break;case"newline":return t.push(i),!0}return!1}function Ra(t,e,i){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=i,t.source=e;break;case"block-scalar":{let r=t.props.slice(1),n=e.length;t.props[0].type==="block-scalar-header"&&(n-=t.props[0].source.length);for(let a of r)a.offset+=n;delete t.props,Object.assign(t,{type:i,source:e,end:r});break}case"block-map":case"block-seq":{let n={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
+ `};delete t.items,Object.assign(t,{type:i,source:e,end:[n]});break}default:{let r="indent"in t?t.indent:-1,n="end"in t&&Array.isArray(t.end)?t.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(t))a!=="type"&&a!=="offset"&&delete t[a];Object.assign(t,{type:i,indent:r,source:e,end:n})}}}mr.createScalarToken=Up;mr.resolveAsScalar=Gp;mr.setScalarValue=Kp});var il=N(tl=>{"use strict";var Xp=t=>"type"in t?gr(t):vr(t);function gr(t){switch(t.type){case"block-scalar":{let e="";for(let i of t.props)e+=gr(i);return e+t.source}case"block-map":case"block-seq":{let e="";for(let i of t.items)e+=vr(i);return e}case"flow-collection":{let e=t.start.source;for(let i of t.items)e+=vr(i);for(let i of t.end)e+=i.source;return e}case"document":{let e=vr(t);if(t.end)for(let i of t.end)e+=i.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let i of t.end)e+=i.source;return e}}}function vr({start:t,key:e,sep:i,value:r}){let n="";for(let a of t)n+=a.source;if(e&&(n+=gr(e)),i)for(let a of i)n+=a.source;return r&&(n+=gr(r)),n}tl.stringify=Xp});var ol=N(al=>{"use strict";var Aa=Symbol("break visit"),Qp=Symbol("skip children"),rl=Symbol("remove item");function Ue(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),nl(Object.freeze([]),t,e)}Ue.BREAK=Aa;Ue.SKIP=Qp;Ue.REMOVE=rl;Ue.itemAtPath=(t,e)=>{let i=t;for(let[r,n]of e){let a=i?.[r];if(a&&"items"in a)i=a.items[n];else return}return i};Ue.parentCollection=(t,e)=>{let i=Ue.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],n=i?.[r];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function nl(t,e,i){let r=i(e,t);if(typeof r=="symbol")return r;for(let n of["key","value"]){let a=e[n];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=nl(Object.freeze(t.concat([[n,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===Aa)return Aa;s===rl&&(a.items.splice(o,1),o-=1)}}typeof r=="function"&&n==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}al.visit=Ue});var wr=N(q=>{"use strict";var _a=el(),Zp=il(),em=ol(),Ta="\uFEFF",Ia="",ja="",$a="",tm=t=>!!t&&"items"in t,im=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function rm(t){switch(t){case Ta:return"<BOM>";case Ia:return"<DOC>";case ja:return"<FLOW_END>";case $a:return"<SCALAR>";default:return JSON.stringify(t)}}function nm(t){switch(t){case Ta:return"byte-order-mark";case Ia:return"doc-mode";case ja: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(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}q.createScalarToken=Sa.createScalarToken;q.resolveAsScalar=Sa.resolveAsScalar;q.setScalarValue=Sa.setScalarValue;q.stringify=Wp.stringify;q.visit=zp.visit;q.BOM=Ea;q.DOCUMENT=Pa;q.FLOW_END=xa;q.SCALAR=Ca;q.isCollection=Jp;q.isScalar=Gp;q.prettyToken=Up;q.tokenType=Kp});var _a=N(el=>{"use strict";var ti=mr();function re(t){switch(t){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var Zc=new Set("0123456789ABCDEFabcdef"),Yp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),vr=new Set(",[]{}"),Xp=new Set(` ,[]{}
121
- \r `),Ra=t=>!t||Xp.has(t),Aa=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,i=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!i;let r=this.next??"stream";for(;r&&(i||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,i=this.buffer[e];for(;i===" "||i===" ";)i=this.buffer[++e];return!i||i==="#"||i===`
119
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}q.createScalarToken=_a.createScalarToken;q.resolveAsScalar=_a.resolveAsScalar;q.setScalarValue=_a.setScalarValue;q.stringify=Zp.stringify;q.visit=em.visit;q.BOM=Ta;q.DOCUMENT=Ia;q.FLOW_END=ja;q.SCALAR=$a;q.isCollection=tm;q.isScalar=im;q.prettyToken=rm;q.tokenType=nm});var Da=N(cl=>{"use strict";var ii=wr();function re(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var sl=new Set("0123456789ABCDEFabcdef"),am=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),yr=new Set(",[]{}"),om=new Set(` ,[]{}
121
+ \r `),Oa=t=>!t||om.has(t),Ha=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,i=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!i;let r=this.next??"stream";for(;r&&(i||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,i=this.buffer[e];for(;i===" "||i===" ";)i=this.buffer[++e];return!i||i==="#"||i===`
122
122
  `?!0:i==="\r"?this.buffer[e+1]===`
123
123
  `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let i=this.buffer[e];if(this.indentNext>0){let r=0;for(;i===" ";)i=this.buffer[++r+e];if(i==="\r"){let n=this.buffer[r+e+1];if(n===`
124
124
  `||!n&&!this.atEnd)return e+r+1}return i===`
125
125
  `||r>=this.indentNext||!i&&!this.atEnd?e+r:-1}if(i==="-"||i==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&re(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
126
- `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===ti.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let i=e.length,r=e.indexOf("#");for(;r!==-1;){let a=e[r-1];if(a===" "||a===" "){i=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let a=e[i-1];if(a===" "||a===" ")i-=1;else break}let n=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-i),yield*this.pushNewline(),"stream"}return yield ti.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&re(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&&!re(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&re(i)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(e[i]){case"#":yield*this.pushCount(e.length-i);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Ra),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,i,r=-1;do e=yield*this.pushNewline(),e>0?(i=yield*this.pushSpaces(!1),this.indentValue=r=i):i=0,i+=yield*this.pushSpaces(!0);while(e+i>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&n[0]!=="#"||r===0&&(n.startsWith("---")||n.startsWith("..."))&&re(n[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield ti.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(Ra),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||re(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),i=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let a=0;for(;this.buffer[i-1-a]==="\\";)a+=1;if(a%2===0)break;i=this.buffer.indexOf('"',i+1)}let r=this.buffer.substring(0,i),n=r.indexOf(`
126
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===ii.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let i=e.length,r=e.indexOf("#");for(;r!==-1;){let a=e[r-1];if(a===" "||a===" "){i=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let a=e[i-1];if(a===" "||a===" ")i-=1;else break}let n=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-i),yield*this.pushNewline(),"stream"}return yield ii.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&re(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&&!re(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&re(i)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(e[i]){case"#":yield*this.pushCount(e.length-i);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Oa),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,i,r=-1;do e=yield*this.pushNewline(),e>0?(i=yield*this.pushSpaces(!1),this.indentValue=r=i):i=0,i+=yield*this.pushSpaces(!0);while(e+i>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&n[0]!=="#"||r===0&&(n.startsWith("---")||n.startsWith("..."))&&re(n[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield ii.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(Oa),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||re(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),i=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let a=0;for(;this.buffer[i-1-a]==="\\";)a+=1;if(a%2===0)break;i=this.buffer.indexOf('"',i+1)}let r=this.buffer.substring(0,i),n=r.indexOf(`
127
127
  `,this.pos);if(n!==-1){for(;n!==-1;){let a=this.continueScalar(n+1);if(a===-1)break;n=r.indexOf(`
128
128
  `,a)}n!==-1&&(i=n-(r[n-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let i=this.buffer[++e];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>re(i)||i==="#")}*parseBlockScalar(){let e=this.pos-1,i=0,r;e:for(let a=this.pos;r=this.buffer[a];++a)switch(r){case" ":i+=1;break;case`
129
129
  `:e=a,i=0;break;case"\r":{let o=this.buffer[a+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
130
130
  `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(i>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=i:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(e+1);if(a===-1)break;e=this.buffer.indexOf(`
131
131
  `,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let n=e+1;for(r=this.buffer[n];r===" ";)r=this.buffer[++n];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
132
132
  `;)r=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let a=e-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);let s=a;for(;o===" ";)o=this.buffer[--a];if(o===`
133
- `&&a>=this.pos&&a+1+i>s)e=a;else break}while(!0);return yield ti.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,i=this.pos-1,r=this.pos-1,n;for(;n=this.buffer[++r];)if(n===":"){let a=this.buffer[r+1];if(re(a)||e&&vr.has(a))break;i=r}else if(re(n)){let a=this.buffer[r+1];if(n==="\r"&&(a===`
133
+ `&&a>=this.pos&&a+1+i>s)e=a;else break}while(!0);return yield ii.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,i=this.pos-1,r=this.pos-1,n;for(;n=this.buffer[++r];)if(n===":"){let a=this.buffer[r+1];if(re(a)||e&&yr.has(a))break;i=r}else if(re(n)){let a=this.buffer[r+1];if(n==="\r"&&(a===`
134
134
  `?(r+=1,n=`
135
- `,a=this.buffer[r+1]):i=r),a==="#"||e&&vr.has(a))break;if(n===`
136
- `){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&vr.has(n))break;i=r}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield ti.SCALAR,yield*this.pushToIndex(i+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,i){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(i&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Ra),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,r=this.charAt(1);if(re(r)||i&&vr.has(r)){i?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,i=this.buffer[e];for(;!re(i)&&i!==">";)i=this.buffer[++e];return yield*this.pushToIndex(i===">"?e+1:e,!1)}else{let e=this.pos+1,i=this.buffer[e];for(;i;)if(Yp.has(i))i=this.buffer[++e];else if(i==="%"&&Zc.has(this.buffer[e+1])&&Zc.has(this.buffer[e+2]))i=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
135
+ `,a=this.buffer[r+1]):i=r),a==="#"||e&&yr.has(a))break;if(n===`
136
+ `){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&yr.has(n))break;i=r}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield ii.SCALAR,yield*this.pushToIndex(i+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,i){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(i&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Oa),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,r=this.charAt(1);if(re(r)||i&&yr.has(r)){i?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,i=this.buffer[e];for(;!re(i)&&i!==">";)i=this.buffer[++e];return yield*this.pushToIndex(i===">"?e+1:e,!1)}else{let e=this.pos+1,i=this.buffer[e];for(;i;)if(am.has(i))i=this.buffer[++e];else if(i==="%"&&sl.has(this.buffer[e+1])&&sl.has(this.buffer[e+2]))i=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
137
137
  `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
138
- `?yield*this.pushCount(2):0}*pushSpaces(e){let i=this.pos-1,r;do r=this.buffer[++i];while(r===" "||e&&r===" ");let n=i-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=i),n}*pushUntil(e){let i=this.pos,r=this.buffer[i];for(;!e(r);)r=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};el.Lexer=Aa});var Ia=N(tl=>{"use strict";var Ta=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let i=0,r=this.lineStarts.length;for(;i<r;){let a=i+r>>1;this.lineStarts[a]<e?i=a+1:r=a}if(this.lineStarts[i]===e)return{line:i+1,col:1};if(i===0)return{line:0,col:e};let n=this.lineStarts[i-1];return{line:i,col:e-n+1}}}};tl.LineCounter=Ta});var $a=N(ol=>{"use strict";var Qp=bi("process"),il=mr(),Zp=_a();function Ae(t,e){for(let i=0;i<t.length;++i)if(t[i].type===e)return!0;return!1}function rl(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function al(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function gr(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function pt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function wr(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let i=0;i<e.length;++i)t.push(e[i])}function nl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ae(e.start,"explicit-key-ind")&&!Ae(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,al(e.value)?e.value.end?wr(e.value.end,e.sep):e.value.end=e.sep:wr(e.start,e.sep),delete e.sep)}var ja=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Zp.Lexer,this.onNewLine=e}*parse(e,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,i))yield*this.next(r);i||(yield*this.end())}*next(e){if(this.source=e,Qp.env.LOG_TOKENS&&console.log("|",il.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let i=il.tokenType(e);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let i=e??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let r=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in r?r.indent:0:i.type==="flow-collection"&&r.type==="document"&&(i.indent=0),i.type==="flow-collection"&&nl(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&&rl(n.start)===-1&&(i.indent===0||n.start.every(a=>a.type!=="comment"||a.indent<i.indent))&&(r.type==="document"?r.end=n.start:r.items.push({start:n.start}),i.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{rl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let i=gr(this.peek(2)),r=pt(i),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let i=this.source.indexOf(`
138
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let i=this.pos-1,r;do r=this.buffer[++i];while(r===" "||e&&r===" ");let n=i-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=i),n}*pushUntil(e){let i=this.pos,r=this.buffer[i];for(;!e(r);)r=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};cl.Lexer=Ha});var La=N(ll=>{"use strict";var Ba=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let i=0,r=this.lineStarts.length;for(;i<r;){let a=i+r>>1;this.lineStarts[a]<e?i=a+1:r=a}if(this.lineStarts[i]===e)return{line:i+1,col:1};if(i===0)return{line:0,col:e};let n=this.lineStarts[i-1];return{line:i,col:e-n+1}}}};ll.LineCounter=Ba});var Fa=N(pl=>{"use strict";var sm=Ei("process"),ul=wr(),cm=Da();function Ae(t,e){for(let i=0;i<t.length;++i)if(t[i].type===e)return!0;return!1}function dl(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function hl(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Nr(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function mt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function br(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let i=0;i<e.length;++i)t.push(e[i])}function fl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ae(e.start,"explicit-key-ind")&&!Ae(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,hl(e.value)?e.value.end?br(e.value.end,e.sep):e.value.end=e.sep:br(e.start,e.sep),delete e.sep)}var Ma=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new cm.Lexer,this.onNewLine=e}*parse(e,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,i))yield*this.next(r);i||(yield*this.end())}*next(e){if(this.source=e,sm.env.LOG_TOKENS&&console.log("|",ul.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let i=ul.tokenType(e);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let i=e??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let r=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in r?r.indent:0:i.type==="flow-collection"&&r.type==="document"&&(i.indent=0),i.type==="flow-collection"&&fl(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&&dl(n.start)===-1&&(i.indent===0||n.start.every(a=>a.type!=="comment"||a.indent<i.indent))&&(r.type==="document"?r.end=n.start:r.items.push({start:n.start}),i.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{dl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let i=Nr(this.peek(2)),r=mt(i),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let i=this.source.indexOf(`
139
139
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
140
- `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){wr(n,i.start),n.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,n=r&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",a=[];if(n&&i.sep&&!i.value){let o=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||i.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):n||i.value?(a.push(this.sourceToken),e.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(i.explicitKey)if(i.sep)if(i.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(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(al(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||n?e.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);n||i.value?(e.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!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 r&&e.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){wr(n,i.start),n.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=e.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;i.value||Ae(i.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let i=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?e.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!i||i.value?e.items.push({start:[],key:n,sep:[]}):i.sep?this.stack.push(n):Object.assign(i,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let n=gr(r),a=pt(n);nl(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:a,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let i=this.source.indexOf(`
140
+ `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){br(n,i.start),n.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,n=r&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",a=[];if(n&&i.sep&&!i.value){let o=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||i.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):n||i.value?(a.push(this.sourceToken),e.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(i.explicitKey)if(i.sep)if(i.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(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(hl(i.key)&&!Ae(i.sep,"newline")){let o=mt(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=mt(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||n?e.items.push({start:a,key:null,sep:[this.sourceToken]}):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);n||i.value?(e.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!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 r&&e.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){br(n,i.start),n.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=e.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;i.value||Ae(i.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let i=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?e.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!i||i.value?e.items.push({start:[],key:n,sep:[]}):i.sep?this.stack.push(n):Object.assign(i,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let n=Nr(r),a=mt(n);fl(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:a,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let i=this.source.indexOf(`
141
141
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
142
- `,i)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=gr(e),r=pt(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=gr(e),r=pt(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};ol.Parser=ja});var dl=N(ri=>{"use strict";var sl=Na(),em=Ut(),ii=Xt(),tm=wn(),im=x(),rm=Ia(),cl=$a();function ll(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new rm.LineCounter||null,prettyErrors:e}}function nm(t,e={}){let{lineCounter:i,prettyErrors:r}=ll(e),n=new cl.Parser(i?.addNewLine),a=new sl.Composer(e),o=Array.from(a.compose(n.parse(t)));if(r&&i)for(let s of o)s.errors.forEach(ii.prettifyError(t,i)),s.warnings.forEach(ii.prettifyError(t,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function ul(t,e={}){let{lineCounter:i,prettyErrors:r}=ll(e),n=new cl.Parser(i?.addNewLine),a=new sl.Composer(e),o=null;for(let s of a.compose(n.parse(t),!0,t.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new ii.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&i&&(o.errors.forEach(ii.prettifyError(t,i)),o.warnings.forEach(ii.prettifyError(t,i))),o}function am(t,e,i){let r;typeof e=="function"?r=e:i===void 0&&e&&typeof e=="object"&&(i=e);let n=ul(t,i);if(!n)return null;if(n.warnings.forEach(a=>tm.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 om(t,e,i){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){let n=Math.round(i);i=n<1?void 0:n>8?{indent:8}:{indent:n}}if(t===void 0){let{keepUndefined:n}=i??e??{};if(!n)return}return im.isDocument(t)&&!r?t.toString(i):new em.Document(t,r,i).toString(i)}ri.parse=am;ri.parseAllDocuments=nm;ri.parseDocument=ul;ri.stringify=om});var mt=N(R=>{"use strict";var sm=Na(),cm=Ut(),lm=ea(),Oa=Xt(),um=It(),_e=x(),dm=Pe(),fm=T(),hm=Ce(),pm=Re(),mm=mr(),vm=_a(),gm=Ia(),wm=$a(),yr=dl(),fl=Rt();R.Composer=sm.Composer;R.Document=cm.Document;R.Schema=lm.Schema;R.YAMLError=Oa.YAMLError;R.YAMLParseError=Oa.YAMLParseError;R.YAMLWarning=Oa.YAMLWarning;R.Alias=um.Alias;R.isAlias=_e.isAlias;R.isCollection=_e.isCollection;R.isDocument=_e.isDocument;R.isMap=_e.isMap;R.isNode=_e.isNode;R.isPair=_e.isPair;R.isScalar=_e.isScalar;R.isSeq=_e.isSeq;R.Pair=dm.Pair;R.Scalar=fm.Scalar;R.YAMLMap=hm.YAMLMap;R.YAMLSeq=pm.YAMLSeq;R.CST=mm;R.Lexer=vm.Lexer;R.LineCounter=gm.LineCounter;R.Parser=wm.Parser;R.parse=yr.parse;R.parseAllDocuments=yr.parseAllDocuments;R.parseDocument=yr.parseDocument;R.stringify=yr.stringify;R.visit=fl.visit;R.visitAsync=fl.visitAsync});var oo=Ct(mt(),1);import{promises as Tg}from"fs";import et from"path";import{execFileSync as ym}from"child_process";import ai from"path";function ni(t,e){return ym("git",["-C",t,...e],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function Nm(t,e){let i=ai.normalize(t),r=ai.normalize(e);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function vt(t){try{let e=ai.resolve(ni(t,["rev-parse","--show-toplevel"])),r=ni(t,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),n=r?ai.resolve(r.slice(9)):e,a=null;try{a=ni(t,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!Nm(e,n),currentWorktreeRoot:e,primaryWorktreeRoot:n,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function hl(t){try{ni(t,["rev-parse","--is-inside-work-tree"]);let e=ni(t,["worktree","list","--porcelain"]).split(/\r?\n/u),i=[],r=null;for(let n of e)n.startsWith("worktree ")?(r&&i.push(r),r={root:ai.resolve(n.slice(9)),branch:null,detached:!1}):r&&n.startsWith("branch refs/heads/")?r.branch=n.slice(18):r&&n==="detached"&&(r.detached=!0);return r&&i.push(r),i}catch{return[]}}function Nr(t){return hl(t).map(e=>e.root)}import{createHash as Em}from"node:crypto";import{promises as ae}from"node:fs";import Y from"node:path";import{TextDecoder as Pm}from"node:util";var bm=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),km=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function Sm(t){return t.toLowerCase().startsWith(".env")}function oi(t){let i=t.replaceAll("\\","/").split("/").filter(Boolean).map(r=>r.toLowerCase());return i.some(r=>Sm(r))?"environment-file":i.some(r=>km.has(r))?"credential-config":i.includes(".git")?"git-metadata":i.some(r=>bm.has(r))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}function Te(t){return t!==0&&t!==0n&&t!=="0"}function ne(t,e){return Te(t.dev)&&Te(e.dev)&&Te(t.ino)&&Te(e.ino)}function I(t,e){let i=Te(t.dev)&&Te(e.dev);if(i&&t.dev!==e.dev)return!1;let r=Te(t.ino)&&Te(e.ino);return r&&t.ino!==e.ino?!1:i&&r?!0:t.birthtime===e.birthtime}var kr=1024*1024;function Ha(t,e){let i=Y.relative(t,e);return i===""||!Y.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Y.sep}`)}function xm(t){let e=Y.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(n=>{let a=n.codePointAt(0)??0;return a<=31||a===127})||Y.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let i=t.toLowerCase(),r=oi(t);if(r||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${r??"native-runtime"}): ${t}`);return t}function Cm(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function Rm(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function br(t,e){let i={...t,birthtime:t.birthtimeMs},r={...e,birthtime:e.birthtimeMs};return ne(i,r)?I(i,r):I(i,r)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function pl(t){let e=await ae.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await ae.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function Am(t,e){let i=Y.resolve(t),r=Y.resolve(e);if(!Ha(i,r))throw new Error("Native artifact path is outside its root");let n=[await pl(i)],a=i;for(let o of Y.relative(i,r).split(Y.sep).filter(Boolean)){a=Y.join(a,o);let s=await pl(a);if(!Ha(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);n.push(s)}return n}async function ml(t){for(let e of t){let i=await ae.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!Rm(e,i)||await ae.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function D(t){let e=xm(t.ref),i=t.maxBytes===null?null:Cm(t.maxBytes??kr),r=Y.resolve(t.root,...e.split("/")),n=await Am(t.root,Y.dirname(r));await t.hooks?.afterParentChainCaptured?.();let a=await ae.lstat(r);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(i!==null&&a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);let o=await ae.realpath(r);if(!Ha(n[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${e}`);let s=await ae.open(r,"r");try{let[c,l,d]=await Promise.all([s.stat(),ae.lstat(r),ae.realpath(r)]);if(await ml(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||d!==o||!br(a,c)||!br(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let f=[],h=0,m=Buffer.allocUnsafe(i===null?64*1024:Math.min(64*1024,i+1));for(;;){let b=i===null?m.length:i+1-h,S=await s.read(m,0,Math.min(m.length,b),null);if(S.bytesRead===0)break;if(h+=S.bytesRead,i!==null&&h>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);f.push(Buffer.from(m.subarray(0,S.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[w,u,p]=await Promise.all([s.stat(),ae.lstat(r),ae.realpath(r)]);if(await ml(n),!u.isFile()||u.isSymbolicLink()||p!==o||!br(c,w)||!br(c,u))throw new Error(`Native artifact changed while reading: ${e}`);let g=Buffer.concat(f,h),y;try{y=new Pm("utf-8",{fatal:!0}).decode(g)}catch(b){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:b})}return{ref:e,size:h,hash:t.includeHash===!1?null:Em("sha256").update(g).digest("hex"),text:y}}finally{await s.close()}}var Ba=Ct(mt(),1);import Sr from"path";var si=64*1024,Er=1024,Pr=64,La=5,_m=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Tm=["**/.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"],Im=[..._m,...Tm].sort((t,e)=>t.localeCompare(e,"en"));var G={include:["**/*"],exclude:[...Im],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4};function jm(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim();if(i.length===0||Sr.posix.isAbsolute(i)||Sr.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be a project-relative path`);if(i===".")return[];let r=i.replaceAll("\\","/").split("/");if(r.some(n=>n===".."))throw new Error(`${e} must stay inside the project root`);if(r.some(n=>n===""||n==="."))throw new Error(`${e} must not contain empty or dot path segments`);return r}function Ue(t){let e=jm(t,"native.artifact_root");return e.length===0?".":e.join("/")}function gl(t,e="docs"){let i=t??e;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function xr(t,e,i=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||Sr.posix.isAbsolute(r)||Sr.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let n=r.split("/");if(n.some(a=>a===".."))throw new Error(`${e} must stay inside its declared path base`);if(n.some(a=>a===""||a==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return n.join("/")}function gt(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function wl(t,e,i){let r=t??e;if(r!=="en"&&r!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return r}function Cr(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>Er)throw new Error(`${e} exceeds ${Er} characters`);let i=0;for(let r=0;r<t.length;r+=1)t[r]==="?"?i+=1:t[r]==="*"&&(i+=1,t[r+1]==="*"&&(r+=1));if(i>Pr)throw new Error(`${e} contains more than ${Pr} wildcard tokens`);return t}function vl(t,e,i){if(t===void 0)return[...i];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(r=>Cr(r,e)))].sort((r,n)=>r.localeCompare(n,"en"))}function Da(t,e,i){let r=t??e;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${i} must be a positive integer`);return r}function $m(t){if(t===void 0)return{...G,include:[...G.include],exclude:[...G.exclude]};let e=gt(t,"native.snapshot");return{include:vl(e.include,"native.snapshot.include",G.include),exclude:vl(e.exclude,"native.snapshot.exclude",G.exclude),max_files:Da(e.max_files,G.max_files,"native.snapshot.max_files"),max_total_bytes:Da(e.max_total_bytes,G.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Da(e.max_duration_ms,G.max_duration_ms,"native.snapshot.max_duration_ms")}}function Om(t){if(t===void 0)return;let e=gt(t,"native.pending_root_move"),i=e.id,r=e.from_artifact_root,n=e.to_artifact_root,a=e.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof r!="string"||typeof n!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let s=gt(e.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,d=s.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof d!="string"||!/^[a-f0-9]{64}$/u.test(d))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:d}}return{id:i,fromArtifactRoot:Ue(r),toArtifactRoot:Ue(n),stage:a,...o?{cleanup:o}:{}}}function Hm(t,e={}){let i=gt(t,"native"),r=i.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let n=i.clarification_mode??"batch";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=i.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=i.max_verify_failures??La;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Om(i.pending_root_move);return{artifact_root:Ue(r),language:wl(i.language,"en","native.language"),clarification_mode:n,archive_confirmation:a,max_verify_failures:o,snapshot:$m(i.snapshot),...s?{pending_root_move:s}:{}}}function Dm(t){let e=gt(t,"classic"),i=e.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let r=e.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=e.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:gl(e.artifact_layout),language:wl(e.language,"zh-CN","classic.language"),context_compression:i,review_mode:r,auto_transition:n}}function Bm(t){let i=gt(t,"hook").allow_paths??[];if(!Array.isArray(i))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(i.map((r,n)=>xr(r,`hook.allow_paths[${n}]`)))]}}function Lm(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Mm(t,e,i,r,n,a){let o=t.schema!==void 0;if(!(o||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!o)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let c=t.workflows??[t.default_workflow];if(!Array.isArray(c)||c.length===0||c.some(d=>d!=="native"&&d!=="classic"))throw new Error("workflows must contain native and/or classic");let l=[...new Set(c)];if(!l.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(l.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:l,ambient_resume:n,...e?{hook:e}:{},...i?{native:i}:{},...r?{classic:r}:{}}}function ci(t,e={}){let i=(0,Ba.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let r=i.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let n=r,a=Lm(n.ambient_resume),o=n.hook===void 0?void 0:Bm(n.hook),s=n.native===void 0?void 0:Hm(n.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),c=n.classic===void 0?void 0:Dm(n.classic),l=Mm(n,o,s,c,a,{allowPartialProject:e.allowPartialProject??!1});return{value:n,config:l,ambient_resume:a,...o?{hook:o}:{},...s?{native:s}:{},...c?{classic:c}:{}}}function Rr(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:Ue(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:La,snapshot:{...G,include:[...G.include],exclude:[...G.exclude]}}}}import{createHash as Vm}from"crypto";import{promises as Tr}from"fs";import Ie from"path";import{constants as Ar,promises as Ke}from"fs";var fe=class extends Error{reason;constructor(e,i,r){super(i,r),this.name="RaceSafeReadError",this.reason=e}};function Ma(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function yl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function li(t){return{dev:t.dev,ino:t.ino,birthtime:Ma(t)}}function _r(t,e){let i=li(t),r=li(e);return ne(i,r)?I(i,r):I(i,r)&&Ma(t)===Ma(e)&&yl(t)===yl(e)&&t.size===e.size}async function ui(t,e,i={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=i.label??"file",n=i.bigint===!0,a=await Ke.lstat(t,{bigint:n});if(!a.isFile()||a.isSymbolicLink())throw new fe("not-regular-file",`${r} must be a regular file`);if(BigInt(a.size)>BigInt(e))throw new fe("too-large",`${r} exceeds ${e} bytes`);let o=await Ke.realpath(t);await i.verify?.("pre-open",{realPath:o,identity:li(a)});let s=process.platform==="win32"?Ar.O_RDONLY:Ar.O_RDONLY|Ar.O_NOFOLLOW|Ar.O_NONBLOCK,c;try{c=await Ke.open(t,s)}catch(l){throw l.code==="ELOOP"?new fe("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,d,f]=await Promise.all([c.stat({bigint:n}),Ke.lstat(t,{bigint:n}),Ke.realpath(t)]);if(!l.isFile()||!d.isFile()||d.isSymbolicLink()||f!==o||!_r(a,l)||!_r(a,d))throw new fe("changed",`${r} changed while opening`);await i.verify?.("post-open",{realPath:f,identity:li(l)}),await i.hooks?.afterOpen?.();let h=[],m=0,w=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-m,{bytesRead:b}=await c.read(w,0,Math.min(w.length,y),null);if(b===0)break;if(m+=b,m>e)throw new fe("too-large",`${r} exceeds ${e} bytes`);h.push(Buffer.from(w.subarray(0,b)))}await i.hooks?.beforeFinalCheck?.();let[u,p,g]=await Promise.all([c.stat({bigint:n}),Ke.lstat(t,{bigint:n}),Ke.realpath(t)]);if(!p.isFile()||p.isSymbolicLink()||g!==o||!_r(a,u)||!_r(a,p))throw new fe("changed",`${r} changed while reading`);return await i.verify?.("post-read",{realPath:g,identity:li(u)}),{bytes:Buffer.concat(h,m),stat:u,realPath:g}}finally{await c.close()}}function Fm(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Fa(t,e){let i=Ie.relative(t,e);return i===""||!Ie.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Ie.sep}`)}async function Nl(t,e){let i=Ie.resolve(t),r=await Tr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Tr.realpath(i)}async function bl(t,e,i,r){let n=t;for(let a=0;a<i.length;a++){n=Ie.join(n,i[a]);let o;try{o=await Tr.lstat(n)}catch(d){if(Fm(d))return{exists:!1,kind:"missing"};throw d}let s=Ie.relative(t,n).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${r.label} ancestor ${s} must be a real directory`);if(c&&(r.expected==="file"&&!o.isFile()||r.expected==="directory"&&!o.isDirectory()||r.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await Tr.realpath(n);if(!Fa(e,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function wt(t,e,i){let r=xr(e,i.label),n=Ie.resolve(t),a=await Nl(n,i.label),o=r.split("/"),s=Ie.resolve(n,...o);if(!Fa(n,s))throw new Error(`${i.label} must stay inside the project root`);let c=await bl(n,a,o,i);return{projectRoot:n,target:s,relative:r,exists:c.exists,kind:c.kind}}async function je(t,e,i,r){let n=await wt(t,e,{label:r.label,expected:"file"});if(!n.exists){let o=new Error(`${r.label} does not exist`);throw o.code="ENOENT",o}let a=await Nl(n.projectRoot,r.label);return ui(n.target,i,{...r,verify:async(o,s)=>{if(!Fa(a,s.realPath))throw new Error(`${r.label} resolves outside the project root`);await bl(n.projectRoot,a,n.relative.split("/"),{label:r.label,expected:"file"})}})}var di=".comet/config.yaml";function qm(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Ir(t,e={}){return(await jr(t,e)).document}async function Wm(t){try{return(await je(t,di,si,{label:di})).bytes}catch(e){if(qm(e))return null;throw e}}function zm(t){return t?{exists:!0,sha256:Vm("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function jr(t,e={}){let i=await Wm(t);return{document:i?ci(i.toString("utf8"),e):null,identity:zm(i)}}async function Va(t){return(await Ir(t))?.config??null}var ZN=16*1024;import{existsSync as Sl,promises as Ye}from"fs";import A from"path";import Ym from"os";var $r=".comet/config.yaml",Xm=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;async function za(t){try{return await Ye.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Qm(t){try{let e=await Ye.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function Nt(t,e){let i=A.relative(t,e);return i===""||!A.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${A.sep}`)}async function yt(t){let e=[],i=t;for(;!await za(i);){let n=A.dirname(i);if(n===i)break;e.push(A.basename(i)),i=n}let r=await Ye.realpath(i);return A.resolve(r,...e.reverse())}async function Ja(t){try{return(await Ye.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Or(t){let e=A.resolve(t);try{(await Ye.stat(e)).isDirectory()||(e=A.dirname(e))}catch(n){if(n.code!=="ENOENT")throw n}let i=e,r=A.resolve(Ym.homedir());for(;;){if(!(e===r&&i!==r)){let o=A.join(e,...$r.split("/")),s=e===i||await Qm(o);if(await za(o)&&s)return e}if(await za(A.join(e,".git")))return e;let a=A.dirname(e);if(a===e)return i;e=a}}function Hr(t){return Ue(t)}async function Zm(t,e){let i=Hr(e),r=A.resolve(t,...i.split("/")),n=await Ye.realpath(t),a=await yt(r);if(!Nt(n,a))throw new Error("native.artifact_root resolves outside the project root");return r}async function Xe(t,e){let i=Hr(e),r=await Zm(t,i),n=A.join(r,"comet");if(await Ja(n))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([yt(r),yt(n)]);if(!Nt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");let s=A.resolve(t),c=A.join(s,".comet","runtime","native");if(await Ja(c))throw new Error("The Native Runtime root must not be a symbolic link");let[l,d]=await Promise.all([Ye.realpath(s),yt(c)]);if(!Nt(l,d))throw new Error("The Native Runtime root resolves outside the project root");return{projectRoot:s,configFile:A.join(t,...$r.split("/")),artifactRoot:r,artifactRootRef:i,nativeRoot:n,specsDir:A.join(n,"specs"),changesDir:A.join(n,"changes"),archiveDir:A.join(n,"archive"),runtimeDir:c,changesRuntimeDir:A.join(c,"changes"),locksDir:A.join(c,"locks"),transactionsDir:A.join(c,"transactions")}}function El(t){if(!Xm.test(t))throw new Error(`Invalid Native change name: ${t}`)}function Dr(t,e){El(e);let i=A.join(t.changesRuntimeDir,e);if(!M(t.changesRuntimeDir,i))throw new Error("Native change Runtime path escaped");return i}function ev(t,e){El(e);let i=A.join(t.changesDir,e,"runtime");if(!M(t.changesDir,i))throw new Error("Legacy Native change Runtime path escaped");return i}function X(t,e){let i=Dr(t,e);if(Sl(i))return i;let r=ev(t,e);return Sl(r)?r:i}function he(t,e){let i=A.resolve(e);if(M(t.runtimeDir,i))return t.runtimeDir;if(M(t.nativeRoot,i))return t.nativeRoot;throw new Error(`Path is outside Native document and Runtime roots: ${e}`)}function M(t,e){return Nt(A.resolve(t),A.resolve(e))}async function O(t,e){let i=A.resolve(t),r=A.resolve(e);if(!Nt(i,r))throw new Error(`Path is outside the Native root: ${e}`);if(await Ja(i))throw new Error(`Native root must not be a symbolic link: ${t}`);let[n,a]=await Promise.all([yt(i),yt(r)]);if(!Nt(n,a))throw new Error(`Path resolves outside the Native root: ${e}`);return r}var Br=Cr;function iv(t="docs",e="en"){return Rr(t,e)}async function ye(t){let e=(await Ir(t))?.config??null;return e?.native?e:null}async function Pl(t){let e=await Or(t.startPath),i=await ye(e);if(!i&&t.allowMissingConfig===!1)throw new Error(`${$r} was not found`);if(i?.native.pending_root_move)throw new Error(`Native root move ${i.native.pending_root_move.id} is incomplete; use comet native doctor --repair`);let r=t.explicitArtifactRoot?Hr(t.explicitArtifactRoot):void 0;if(i&&r&&r!==i.native.artifact_root)throw new Error(`Configured Native artifact root is ${i.native.artifact_root}; refusing conflicting root ${r}`);let n=i??iv(r??"docs"),a=await Xe(e,n.native.artifact_root);return{config:n,paths:a,configured:i!==null}}import{AsyncLocalStorage as rv}from"async_hooks";var Eb=16*1024;var Pb=new rv;import{createHash as nv}from"crypto";function oe(t){throw new TypeError(`Value is not valid canonical JSON: ${t}`)}function av(t,e){e.has(t)&&oe("cyclic structures are not supported"),e.add(t);try{let i=Object.keys(t);for(let r=0;r<t.length;r+=1)Object.prototype.hasOwnProperty.call(t,r)||oe("sparse arrays are not supported");return(i.length!==t.length||i.some((r,n)=>r!==String(n)))&&oe("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(t).length>0&&oe("symbol properties are not supported"),`[${t.map(r=>Ga(r,e)).join(",")}]`}finally{e.delete(t)}}function ov(t,e){let i=Object.getPrototypeOf(t);i!==Object.prototype&&i!==null&&oe("only plain objects are supported"),e.has(t)&&oe("cyclic structures are not supported"),Object.getOwnPropertySymbols(t).length>0&&oe("symbol properties are not supported"),e.add(t);try{let r=Object.getOwnPropertyDescriptors(t);return`{${Object.keys(t).sort().map(o=>{let s=r[o];return(!s||!("value"in s))&&oe("accessor properties are not supported"),`${JSON.stringify(o)}:${Ga(s.value,e)}`}).join(",")}}`}finally{e.delete(t)}}function Ga(t,e){if(t===null)return"null";switch(typeof t){case"boolean":return t?"true":"false";case"string":return JSON.stringify(t);case"number":return Number.isFinite(t)||oe("numbers must be finite"),JSON.stringify(Object.is(t,-0)?0:t);case"object":return Array.isArray(t)?av(t,e):ov(t,e);case"bigint":case"function":case"symbol":case"undefined":return oe(`${typeof t} values are not supported`)}return oe("unsupported value type")}function Ua(t){return Ga(t,new Set)}function U(t,e){if(t.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(t))throw new TypeError("Canonical hash tag must not contain a line break");return nv("sha256").update(`${t}
143
- ${Ua(e)}`).digest("hex")}var _b=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),xl=Object.freeze({maxCriteria:1024});var Ya=Ct(mt(),1);import{promises as dv}from"node:fs";var hi="comet.native.v4";var fv=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,hv=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,pv=/^A[1-9][0-9]*$/u,mv=/^[a-f0-9]{64}$/u,vv=new Set(["schema","name","language","phase","status","state_version","brief","children_contract_hash","spec_changes","workspace","loop","acceptance","builder_handoff","blockers","verification","history","history_overflow","verification_result","verification_report","archived","created_at"]);function W(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function z(t,e,i){let r=Object.keys(t).filter(n=>!e.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function L(t,e,i){if(typeof t!="string"||!i?.empty&&t.length===0)throw new Error(`${e} must be ${i?.empty?"a string":"a non-empty string"}`);return t}function Ka(t,e){return t===null?null:L(t,e)}function gv(t,e){let i=L(t,e);if(!mv.test(i))throw new Error(`${e} must be a SHA-256 hash`);return i}function bt(t,e){if(typeof t!="boolean")throw new Error(`${e} must be a boolean`);return t}function _(t,e,i=0){if(!Number.isSafeInteger(t)||t<i)throw new Error(`${e} must be a safe integer greater than or equal to ${i}`);return t}function wv(t,e){return t===null?null:_(t,e,Number.MIN_SAFE_INTEGER)}function B(t,e,i){if(typeof t!="string"||!e.includes(t))throw new Error(`${i} must be one of: ${e.join(", ")}`);return t}function pe(t,e,i){if(!Array.isArray(t))throw new Error(`${e} must be an array`);return t.map((r,n)=>i(r,n))}function Lr(t,e){return pe(t,e,(i,r)=>L(i,`${e}[${r}]`))}function Ze(t,e){if(new Set(t).size!==t.length)throw new Error(`${e} must be unique`)}function kt(t,e){let i=L(t,e);if(Number.isNaN(Date.parse(i)))throw new Error(`${e} must be an ISO date or timestamp`);return i}function Xa(t,e,i=!1){let r=L(t,e);if(r.includes("\\")||r.startsWith("/")||/^[A-Za-z]:/u.test(r)||r.split("/").includes("..")||!i&&(r==="."||r.split("/").includes(".")))throw new Error(`${e} must be a portable relative path`);return r}function se(t,e){let i=W(t,e);return z(i,new Set(["text","truncated"]),e),{text:L(i.text,`${e}.text`,{empty:!0}),truncated:bt(i.truncated,`${e}.truncated`)}}function yv(t,e){let i=`Native spec_changes[${e}]`,r=W(t,i);z(r,new Set(["capability","operation","source"]),i);let n=L(r.capability,`${i}.capability`);if(!hv.test(n))throw new Error(`${i}.capability is invalid`);let a=B(r.operation,["create","modify","remove"],`${i}.operation`),o=r.source===null?null:Xa(r.source,`${i}.source`);if(a==="remove"&&o!==null)throw new Error(`${i} remove requires source null`);if(a!=="remove"&&o===null)throw new Error(`${i} ${a} requires a source`);return{capability:n,operation:a,source:o}}function Nv(t){let e="Native workspace",i=W(t,e);z(i,new Set(["isolation","change_branch","target_branch","finish"]),e);let r=B(i.isolation,["current","branch","worktree"],`${e}.isolation`),n=Ka(i.change_branch,`${e}.change_branch`),a=Ka(i.target_branch,`${e}.target_branch`),o=i.finish===null?null:B(i.finish,["merge","push","pull-request","keep"],`${e}.finish`);if(r==="current"&&o!==null)throw new Error("Native current workspace cannot contain a finish action");if(r==="current"&&n===null!=(a===null))throw new Error("Native workspace branch bindings must both be present or both be null");if(r!=="current"&&(n===null||a===null))throw new Error("Native isolated workspace requires change_branch and target_branch");return{isolation:r,change_branch:n,target_branch:a,finish:o}}function bv(t){let e="Native loop",i=W(t,e);z(i,new Set(["stage","goal_cycle","iteration","attempt","retry_epoch","failed_iteration_count","no_progress_count","execution_failure_count","previous_unresolved_ids","next_action"]),e);let r=Lr(i.previous_unresolved_ids,`${e}.previous_unresolved_ids`);return Ze(r,`${e}.previous_unresolved_ids`),{stage:B(i.stage,["shape","building","verify-ready","repairing","archive-ready","await-user","blocked","done"],`${e}.stage`),goal_cycle:_(i.goal_cycle,`${e}.goal_cycle`,1),iteration:_(i.iteration,`${e}.iteration`),attempt:_(i.attempt,`${e}.attempt`),retry_epoch:_(i.retry_epoch,`${e}.retry_epoch`),failed_iteration_count:_(i.failed_iteration_count,`${e}.failed_iteration_count`),no_progress_count:_(i.no_progress_count,`${e}.no_progress_count`),execution_failure_count:_(i.execution_failure_count,`${e}.execution_failure_count`),previous_unresolved_ids:r,next_action:Ka(i.next_action,`${e}.next_action`)}}function kv(t,e){let i=`Native acceptance[${e}]`,r=W(t,i);z(r,new Set(["id","source","text","result","reason"]),i);let n=L(r.id,`${i}.id`);if(!pv.test(n))throw new Error(`${i}.id must use A1, A2, ...`);return{id:n,source:Xa(r.source,`${i}.source`),text:L(r.text,`${i}.text`),result:B(r.result,["pending","passed","failed","blocked"],`${i}.result`),reason:r.reason===null?null:se(r.reason,`${i}.reason`)}}function Sv(t,e){let i=`Native builder_handoff.checks[${e}]`,r=W(t,i);return z(r,new Set(["name","result","note"]),i),{name:se(r.name,`${i}.name`),result:B(r.result,["passed","failed","not-run"],`${i}.result`),note:r.note===null?null:se(r.note,`${i}.note`)}}function Ev(t){let e="Native builder_handoff",i=W(t,e);z(i,new Set(["candidate_id","identity_provider","builder_execution_ref","iteration","summary","addressed_acceptance_ids","checks","checks_truncated","known_limits","known_limits_truncated","submitted_at"]),e);let r=Lr(i.addressed_acceptance_ids,`${e}.addressed_acceptance_ids`);return Ze(r,`${e}.addressed_acceptance_ids`),{candidate_id:L(i.candidate_id,`${e}.candidate_id`),identity_provider:L(i.identity_provider,`${e}.identity_provider`),builder_execution_ref:L(i.builder_execution_ref,`${e}.builder_execution_ref`),iteration:_(i.iteration,`${e}.iteration`,1),summary:se(i.summary,`${e}.summary`),addressed_acceptance_ids:r,checks:pe(i.checks,`${e}.checks`,Sv),checks_truncated:bt(i.checks_truncated,`${e}.checks_truncated`),known_limits:pe(i.known_limits,`${e}.known_limits`,(n,a)=>se(n,`${e}.known_limits[${a}]`)),known_limits_truncated:bt(i.known_limits_truncated,`${e}.known_limits_truncated`),submitted_at:kt(i.submitted_at,`${e}.submitted_at`)}}function Pv(t,e){let i=`Native blockers[${e}]`,r=W(t,i);z(r,new Set(["owner","reason","acceptance_ids","resolution_action"]),i);let n=Lr(r.acceptance_ids,`${i}.acceptance_ids`);return Ze(n,`${i}.acceptance_ids`),{owner:B(r.owner,["builder","runtime","verifier","user","external"],`${i}.owner`),reason:se(r.reason,`${i}.reason`),acceptance_ids:n,resolution_action:B(r.resolution_action,["return-build","retry-verifier","resolve-verifier-blocker","confirm-verifier-unavailable","await-user","wait-external"],`${i}.resolution_action`)}}function xv(t,e){let i=`Native verification.checks[${e}]`,r=W(t,i);return z(r,new Set(["id","name","argv_display","argv_truncated","cwd_ref","status","exit_code","duration_ms"]),i),{id:L(r.id,`${i}.id`),name:se(r.name,`${i}.name`),argv_display:pe(r.argv_display,`${i}.argv_display`,(n,a)=>se(n,`${i}.argv_display[${a}]`)),argv_truncated:bt(r.argv_truncated,`${i}.argv_truncated`),cwd_ref:Xa(r.cwd_ref,`${i}.cwd_ref`,!0),status:B(r.status,["passed","failed","interrupted"],`${i}.status`),exit_code:wv(r.exit_code,`${i}.exit_code`),duration_ms:_(r.duration_ms,`${i}.duration_ms`)}}function Cv(t){let e="Native verification",i=W(t,e);z(i,new Set(["candidate_id","identity_provider","verifier_execution_ref","iteration","attempt","assurance","verdict","checks","summary","risks","risks_truncated","completed_at"]),e);let r=pe(i.checks,`${e}.checks`,xv);Ze(r.map(a=>a.id),`${e}.checks IDs`);let n=L(i.identity_provider,`${e}.identity_provider`);return{candidate_id:L(i.candidate_id,`${e}.candidate_id`),identity_provider:n,verifier_execution_ref:L(i.verifier_execution_ref,`${e}.verifier_execution_ref`),iteration:_(i.iteration,`${e}.iteration`,1),attempt:_(i.attempt,`${e}.attempt`,1),assurance:i.assurance===void 0?n==="skill-coordinated"?"skill-coordinated":"host-attested":B(i.assurance,["host-attested","skill-coordinated","semantic-verification-unavailable","user-confirmed-degraded"],`${e}.assurance`),verdict:B(i.verdict,["pass","fail","blocked"],`${e}.verdict`),checks:r,summary:se(i.summary,`${e}.summary`),risks:pe(i.risks,`${e}.risks`,(a,o)=>se(a,`${e}.risks[${o}]`)),risks_truncated:bt(i.risks_truncated,`${e}.risks_truncated`),completed_at:kt(i.completed_at,`${e}.completed_at`)}}function Rv(t,e){let i=`Native history[${e}]`,r=W(t,i);z(r,new Set(["goal_cycle","iteration","attempt","outcome","unresolved_ids","summary","completed_at"]),i);let n=Lr(r.unresolved_ids,`${i}.unresolved_ids`);return Ze(n,`${i}.unresolved_ids`),{goal_cycle:_(r.goal_cycle,`${i}.goal_cycle`,1),iteration:_(r.iteration,`${i}.iteration`),attempt:_(r.attempt,`${i}.attempt`),outcome:B(r.outcome,["pass","fail","blocked","execution-error","recovery"],`${i}.outcome`),unresolved_ids:n,summary:se(r.summary,`${i}.summary`),completed_at:kt(r.completed_at,`${i}.completed_at`)}}function Av(t){let e="Native history_overflow.outcome_counts",i=W(t,e),r=["pass","fail","blocked","execution-error","recovery"];return z(i,new Set(r),e),{pass:_(i.pass,`${e}.pass`),fail:_(i.fail,`${e}.fail`),blocked:_(i.blocked,`${e}.blocked`),"execution-error":_(i["execution-error"],`${e}.execution-error`),recovery:_(i.recovery,`${e}.recovery`)}}function _v(t){let e="Native history_overflow",i=W(t,e);z(i,new Set(["dropped_entries","first_dropped_at","last_dropped_at","outcome_counts"]),e);let r=_(i.dropped_entries,`${e}.dropped_entries`),n=i.first_dropped_at===null?null:kt(i.first_dropped_at,`${e}.first_dropped_at`),a=i.last_dropped_at===null?null:kt(i.last_dropped_at,`${e}.last_dropped_at`);if(r===0&&(n!==null||a!==null))throw new Error("Native empty history overflow cannot contain dropped timestamps");if(r>0&&(n===null||a===null))throw new Error("Native non-empty history overflow requires dropped timestamps");let o=Av(i.outcome_counts);if(Object.values(o).reduce((c,l)=>c+l,0)!==r)throw new Error("Native history overflow outcome count must equal dropped_entries");return{dropped_entries:r,first_dropped_at:n,last_dropped_at:a,outcome_counts:o}}function Tv(t){let e=new Set(t.acceptance.map(i=>i.id));for(let i of t.loop.previous_unresolved_ids)if(!e.has(i))throw new Error(`Native loop references unknown acceptance ID ${i}`);for(let i of t.builder_handoff?.addressed_acceptance_ids??[])if(!e.has(i))throw new Error(`Native builder handoff references unknown ID ${i}`);for(let i of t.blockers)for(let r of i.acceptance_ids)if(!e.has(r))throw new Error(`Native blocker references unknown ID ${r}`);if(t.builder_handoff&&!(t.builder_handoff.iteration===t.loop.iteration||t.phase==="build"&&t.loop.stage==="repairing"&&t.builder_handoff.iteration===t.loop.iteration-1))throw new Error("Native builder handoff iteration is not current or the prior repair result");if(t.verification){if(!t.builder_handoff)throw new Error("Native verification requires a builder handoff");if(t.verification.candidate_id!==t.builder_handoff.candidate_id)throw new Error("Native verification candidate must match the builder handoff");if(t.verification.identity_provider!==t.builder_handoff.identity_provider)throw new Error("Native Builder and Verifier identity providers must match");if(["skill-coordinated","semantic-verification-unavailable","user-confirmed-degraded"].includes(t.verification.assurance)!==(t.verification.identity_provider==="skill-coordinated"))throw new Error("Native verification assurance does not match its identity provider");if(t.verification.assurance==="semantic-verification-unavailable"&&t.verification.verdict!=="blocked")throw new Error("Native unavailable semantic verification must remain blocked");if(t.verification.assurance==="user-confirmed-degraded"&&t.verification.verdict!=="pass")throw new Error("Native user-confirmed degraded verification must be passing");if(t.verification.verifier_execution_ref===t.builder_handoff.builder_execution_ref)throw new Error("Native Builder and Verifier execution refs must differ");let r=t.verification.iteration===t.loop.iteration&&t.verification.attempt===t.loop.attempt,n=t.phase==="build"&&t.loop.stage==="repairing"&&t.verification.iteration===t.loop.iteration-1&&t.verification.iteration===t.builder_handoff.iteration;if(!r&&!n)throw new Error("Native verification iteration and attempt do not match a stable loop result")}}function Iv(t){if(!{shape:new Set(["shape","await-user","blocked"]),build:new Set(["building","repairing","await-user","blocked"]),verify:new Set(["verify-ready","await-user","blocked"]),archive:new Set(["archive-ready","await-user","blocked","done"])}[t.phase].has(t.loop.stage))throw new Error(`Native loop stage ${t.loop.stage} is invalid for phase ${t.phase}`);let i=t.status==="await-user"?"await-user":t.status==="blocked"?"blocked":t.status==="done"?"done":null;if(i!==null&&t.loop.stage!==i)throw new Error(`Native status ${t.status} requires loop stage ${i}`);if(t.status==="active"&&["await-user","blocked","done"].includes(t.loop.stage))throw new Error(`Native active status cannot use loop stage ${t.loop.stage}`);if(t.archived!==(t.status==="done"))throw new Error("Native archived must be true exactly when status is done");if(t.archived&&t.phase!=="archive")throw new Error("Native archived state must be in Archive");if(t.verification_result==="pass"){if(t.verification?.verdict!=="pass")throw new Error("Native pass requires a persisted passing verification");if(t.acceptance.some(r=>r.result!=="passed"))throw new Error("Native pass requires every acceptance item to pass");if(t.verification.checks.some(r=>r.status!=="passed"))throw new Error("Native pass requires every persisted check to pass")}if(t.verification?.assurance==="semantic-verification-unavailable"&&(t.phase!=="verify"||t.status!=="await-user"||t.verification_result!=="blocked"||t.loop.next_action!=="confirm-verifier-unavailable"))throw new Error("Native unavailable semantic verification must await explicit user confirmation");if(t.verification_report!==null&&t.verification===null)throw new Error("Native verification report requires persisted verification")}function pi(t){let e=W(t,"Native portable state");if(z(e,vv,"Native portable state"),e.schema!==hi)throw new Error(`Native portable state schema must be ${hi}`);let i=L(e.name,"Native state name");if(!fv.test(i))throw new Error("Native state name is invalid");if(e.brief!=="brief.md")throw new Error("Native state brief must be brief.md");let r=pe(e.spec_changes,"Native spec_changes",yv);Ze(r.map(s=>s.capability),"Native spec change capabilities");let n=pe(e.acceptance,"Native acceptance",kv);Ze(n.map(s=>s.id),"Native acceptance IDs");let a=pe(e.history,"Native history",Rv);if(a.length>50)throw new Error(`Native history cannot exceed ${50} entries`);let o={schema:hi,name:i,language:B(e.language,["en","zh-CN"],"Native state language"),phase:B(e.phase,["shape","build","verify","archive"],"Native state phase"),status:B(e.status,["active","await-user","blocked","done"],"Native state status"),state_version:_(e.state_version,"Native state_version",1),brief:"brief.md",...e.children_contract_hash===void 0?{}:{children_contract_hash:gv(e.children_contract_hash,"Native children contract hash")},spec_changes:r,workspace:Nv(e.workspace),loop:bv(e.loop),acceptance:n,builder_handoff:e.builder_handoff===null?null:Ev(e.builder_handoff),blockers:pe(e.blockers,"Native blockers",Pv),verification:e.verification===null?null:Cv(e.verification),history:a,history_overflow:_v(e.history_overflow),verification_result:B(e.verification_result,["pending","pass","fail","blocked"],"Native verification_result"),verification_report:e.verification_report===null?null:B(e.verification_report,["verification.md"],"Native verification_report"),archived:bt(e.archived,"Native archived"),created_at:kt(e.created_at,"Native created_at")};return Tv(o),Iv(o),o}function jv(t,e){let i=(0,Ya.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`${e} is invalid YAML: ${i.errors[0].message}`);return i.toJS({mapAsMap:!1})}async function mi(t){let e=await dv.readFile(t,"utf8");return pi(jv(e,"Native portable state"))}var $e="comet.native.v3",Oe="comet.native.v2",He="comet.native.v1";var Al="[a-z][a-z0-9]*(?:-[a-z0-9]+)*",Zb=new RegExp(`^portable-archive-(${Al})\\.json$`,"u"),ek=new RegExp(`^portable-migration-(${Al})\\.json$`,"u");import{TextDecoder as Fv}from"util";import{createHash as $v}from"node:crypto";import{constants as qr,promises as ce}from"node:fs";import le from"node:path";import{TextDecoder as Ov}from"node:util";function zr(t,e){let i=le.relative(t,e);return i===""||!le.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${le.sep}`)}function Hv(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function Dv(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Bv(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function Wr(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Qa(t,e){let i=await ce.lstat(t);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await ce.realpath(t),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function _l(t,e,i){let r=le.resolve(t),n=le.resolve(e);if(!zr(r,n))throw new Error(`${i} is outside its managed root`);let a=[await Qa(r,i)],o=r;for(let s of le.relative(r,n).split(le.sep).filter(Boolean)){await De(a,i),o=le.join(o,s);let c=await Qa(o,i);if(!zr(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await De(a,i),a}async function De(t,e){for(let i of t){let r=await ce.lstat(i.path);if(!r.isDirectory()||r.isSymbolicLink()||!Dv(i,r)||await ce.realpath(i.path)!==i.realPath)throw new Error(`${e} parent changed during I/O: ${i.path}`)}}async function Lv(t,e,i){let r=[],n=0,a=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let o=e+1-n,{bytesRead:s}=await t.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(n+=s,n>e)throw new Error(`${i} exceeds ${e} bytes`);r.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(r,n)}async function St(t){let e=Hv(t.maxBytes),i=le.resolve(t.file),r=await _l(t.root,le.dirname(i),t.label),n=await Promise.all((t.forbiddenRoots??[]).map(d=>Qa(le.resolve(d),t.label)));await t.hooks?.afterParentChainCaptured?.(),await De(r,t.label);let a=await ce.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(a.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let o=Bv(a),s=await ce.realpath(i);if(!zr(r[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(n.some(d=>zr(d.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?qr.O_RDONLY:qr.O_RDONLY|qr.O_NOFOLLOW|qr.O_NONBLOCK,l=await ce.open(i,c);try{let d=await l.stat();await t.hooks?.afterOpen?.();let[f,h]=await Promise.all([ce.lstat(i),ce.realpath(i)]);if(await De(r,t.label),await De(n,t.label),!d.isFile()||!f.isFile()||f.isSymbolicLink()||h!==s||!Wr(o,d)||!Wr(o,f))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let m=await Lv(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[w,u,p]=await Promise.all([l.stat(),ce.lstat(i),ce.realpath(i)]);if(await De(r,t.label),await De(n,t.label),!u.isFile()||u.isSymbolicLink()||p!==s||!Wr(o,w)||!Wr(o,u))throw new Error(`${t.label} changed while reading`);return{bytes:m,hash:$v("sha256").update(m).digest("hex"),size:m.length}}finally{await l.close()}}async function Tl(t){let e=await St(t),i;try{i=new Ov("utf-8",{fatal:!0}).decode(e.bytes)}catch(r){throw new Error(`${t.label} is not valid UTF-8`,{cause:r})}return{...e,text:i}}async function Za(t){let e=await _l(t.root,t.directory,t.label);return{verify:()=>De(e,t.label)}}var vk=256*1024,gk=1024*1024,wk=16*1024;var yk=64*1024*1024;var Nk=new Fv("utf-8",{fatal:!0});import io from"path";import{createHash as qv}from"crypto";function J(t){return qv("sha256").update(t).digest("hex")}var Vk={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},zv=1e3,Jv=8*1024*1024,Gv=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Uv=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),Kv=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),Yv=new Set(["schema","include","exclude","hash"]),Xv=new Set(["provider","gitSelection","physicalSelection","projection"]),Qv=new Set(["provider","selection"]),Zv=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),eg=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),tg=new Set(["schema","status","before","after"]),ig=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),rg=new Set(["path","hash","size","type","gitObjectId"]),ng=new Set(["path","size","type","reason"]),ag=new Set(["ref","hash","count"]),og=new Set(["change-created","legacy-migration","explicit"]),sg=new Set(["file","directory","other"]),cg=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"]),Gr=/^[a-f0-9]{64}$/u,lg=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var qk=64*1024,Wk=64*1024;var zk={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},Jk={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function Jr(t,e){return t.hash===e.hash&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.stdoutBytes===e.stdoutBytes&&t.overflow===e.overflow}var Gk=(1n<<256n)-1n;function ug(t,e){return t.hash===e.hash&&t.visitedNodeCount===e.visitedNodeCount&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.encodedBytes===e.encodedBytes&&t.overflow===e.overflow&&t.unstable===e.unstable}function dg(t){return Buffer.byteLength(JSON.stringify(t,null,2)+`
144
- `)}function fg(t,e){return J(`comet.native.snapshot-policy.v1
145
- ${JSON.stringify({include:t,exclude:e,hash:"sha256"})}`)}function to(t,e,i){let r=new Set(e),n=[...e];for(;n.length>0;){if(i&&!i())return null;let a=n.pop(),o=t[a];o&&(o.kind==="star"||o.kind==="globstar"||o.kind==="globstar-slash")&&!r.has(a+1)&&(r.add(a+1),n.push(a+1))}return r}function hg(t){let e=0;return()=>e>0?(e-=1,!0):t()?(e=63,!0):!1}function Hl(t){let e=Br(t,"Native snapshot pattern"),i=[];for(let r=0;r<e.length;r+=1){let n=e[r];n==="*"&&e[r+1]==="*"?(r+=1,e[r+1]==="/"?(r+=1,i.push({kind:"globstar-slash"})):i.push({kind:"globstar"})):n==="*"?i.push({kind:"star"}):n==="?"?i.push({kind:"question"}):i.push({kind:"literal",value:n})}return(r,n)=>{let a=n?hg(n):void 0;if(a&&!a())return!1;let o=to(i,new Set([0]),a);if(o===null)return!1;for(let s of r){if(a&&!a())return!1;let c=new Set;for(let l of o){if(a&&!a())return!1;let d=i[l];d&&(d.kind==="literal"&&d.value===s||d.kind==="question"&&s!=="/"?c.add(l+1):d.kind==="star"&&s!=="/"||d.kind==="globstar"?c.add(l):d.kind==="globstar-slash"&&(c.add(l),s==="/"&&c.add(l+1)))}if(o=to(i,c,a),o===null||o.size===0)return!1}return to(i,o,a)?.has(i.length)??!1}}function pg(t){if(t===void 0)return;let e=[...new Set(t.include.map(n=>Br(n,"include")))].sort((n,a)=>n.localeCompare(a,"en")),i=[...new Set(t.exclude.map(n=>Br(n,"exclude")))].sort((n,a)=>n.localeCompare(a,"en"));if(e.length===0)throw new Error("Native snapshot policy include must not be empty");let r=fg(e,i);if("hash"in t&&t.hash!==r)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:e,exclude:i,hash:r},includeMatchers:e.map(Hl),excludeMatchers:i.map(Hl),excludedDirectoryPrefixes:i.flatMap(n=>{if(!n.endsWith("/**"))return[];let a=n.slice(0,-3);return/[*?]/u.test(a)?[]:[a]}).sort((n,a)=>n.localeCompare(a,"en"))}}function Q(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function Z(t,e,i){let r=Object.keys(t).find(n=>!e.has(n));if(r)throw new Error(`${i} contains unknown field: ${r}`)}function Pt(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function me(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function Ll(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0"))throw new Error(`${e} must be a normalized project-relative path`);let i=io.posix.normalize(t);if(i!==t||io.posix.isAbsolute(t)||i===".."||i.startsWith("../"))throw new Error(`${e} must stay inside the project root`);return t}function mg(t,e){let i=Q(t,`Native snapshot entry ${e}`);Z(i,rg,`Native snapshot entry ${e}`);let r=Ll(i.path,`Native snapshot entry ${e} path`);if(typeof i.hash!="string"||!Gr.test(i.hash))throw new Error(`Native snapshot entry ${e} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${e} type is invalid`);let n={path:r,hash:i.hash,size:me(i.size,`Native snapshot entry ${e} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!lg.test(i.gitObjectId))throw new Error(`Native snapshot entry ${e} gitObjectId is invalid`);n.gitObjectId=i.gitObjectId}return n}function vg(t,e){let i=Q(t,`Native snapshot omission ${e}`);if(Z(i,ng,`Native snapshot omission ${e}`),!sg.has(i.type))throw new Error(`Native snapshot omission ${e} type is invalid`);if(!cg.has(i.reason))throw new Error(`Native snapshot omission ${e} reason is invalid`);return{path:Ll(i.path,`Native snapshot omission ${e} path`),size:i.size===null?null:me(i.size,`Native snapshot omission ${e} size`),type:i.type,reason:i.reason}}function gg(t){let e=Q(t,"Native snapshot omission overflow");if(Z(e,ag,"Native snapshot omission overflow"),typeof e.hash!="string"||!Gr.test(e.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${e.hash}`;if(e.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:e.hash,count:Pt(e.count,"Native snapshot omission overflow count")}}function Et(t,e){let i=Q(t,e);if(Z(i,eg,e),typeof i.hash!="string"||!Gr.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${e} overflow flag is invalid`);let r=me(i.recordCount,`${e} recordCount`),n=me(i.storedRecordCount,`${e} storedRecordCount`),a=me(i.stdoutBytes,`${e} stdoutBytes`);if(n>r||!i.overflow&&n!==r)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,recordCount:r,storedRecordCount:n,stdoutBytes:a,overflow:i.overflow}}function Dl(t){let e=Q(t,"Native Git selection evidence");if(Z(e,Zv,"Native Git selection evidence"),e.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=Et(e.stageBefore,"Native Git selection stageBefore"),r=Et(e.combined,"Native Git selection combined"),n=Et(e.stageAfter,"Native Git selection stageAfter"),a=Et(e.finalStageBefore,"Native Git selection finalStageBefore"),o=Et(e.finalCombined,"Native Git selection finalCombined"),s=Et(e.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,r,n,a,o,s].some(f=>f.overflow),l=!Jr(i,n)||!Jr(n,a)||!Jr(r,o)||!Jr(a,s),d=c&&l?"overflow-and-changed":c?"overflow":"changed";if(!c&&!l)throw new Error("Native Git selection evidence must describe an exceptional selection");if(e.status!==d)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:d,stageBefore:i,combined:r,stageAfter:n,finalStageBefore:a,finalCombined:o,finalStageAfter:s}}function Bl(t,e){let i=Q(t,e);if(Z(i,ig,e),typeof i.hash!="string"||!Gr.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${e} flags are invalid`);let r=me(i.visitedNodeCount,`${e} visitedNodeCount`),n=me(i.recordCount,`${e} recordCount`),a=me(i.storedRecordCount,`${e} storedRecordCount`),o=me(i.encodedBytes,`${e} encodedBytes`);if(a>n||!i.overflow&&a!==n)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:r,recordCount:n,storedRecordCount:a,encodedBytes:o,overflow:i.overflow,unstable:i.unstable}}function wg(t){let e=Q(t,"Native physical selection evidence");if(Z(e,tg,"Native physical selection evidence"),e.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=Bl(e.before,"Native physical selection before"),r=Bl(e.after,"Native physical selection after"),n=i.overflow||r.overflow,a=i.unstable||r.unstable||!ug(i,r);if(!n&&!a)throw new Error("Native physical selection evidence must describe an exceptional selection");let o=n&&a?"overflow-and-changed":n?"overflow":"changed";if(e.status!==o)throw new Error("Native physical selection evidence status is inconsistent");return{schema:"comet.native.physical-selection.v1",status:o,before:i,after:r}}function Ml(t){let e=Q(t,"Native content snapshot manifest");if(Z(e,Uv,"Native content snapshot manifest"),e.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!og.has(e.origin))throw new Error("Native content snapshot origin is invalid");let i;if(e.capture!==void 0){let v=Q(e.capture,"Native content snapshot capture");if(Z(v,Xv,"Native content snapshot capture"),v.provider!=="git"&&v.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let P=v.gitSelection===void 0?void 0:Dl(v.gitSelection),k=v.physicalSelection===void 0?void 0:wg(v.physicalSelection),C=null;if(v.projection!==void 0){let F=Q(v.projection,"Native content snapshot projection");if(Z(F,Qv,"Native content snapshot projection"),F.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");C={provider:"git",...F.selection===void 0?{}:{selection:Dl(F.selection)}}}if(v.provider==="git"){if(k||C)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...P?{gitSelection:P}:{}}}else{if(P)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(k&&C)throw new Error("Native physical-tree capture cannot combine selection and projection");i=C?{provider:"physical-tree",projection:C}:{provider:"physical-tree",...k?{physicalSelection:k}:{}}}}if(typeof e.createdAt!="string"||Number.isNaN(Date.parse(e.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof e.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let r=Q(e.limits,"Native content snapshot limits");Z(r,Kv,"Native content snapshot limits");let n={maxFiles:Pt(r.maxFiles,"Native snapshot maxFiles"),maxFileBytes:Pt(r.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:Pt(r.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:Pt(r.maxManifestBytes,"Native snapshot maxManifestBytes"),...r.maxDurationMs===void 0?{}:{maxDurationMs:Pt(r.maxDurationMs,"Native snapshot maxDurationMs")}},a;if(e.policy!==void 0){let v=Q(e.policy,"Native snapshot policy");if(Z(v,Yv,"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=pg({include:v.include,exclude:v.exclude,hash:v.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(e.entries)||!Array.isArray(e.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let o=e.entries.map(mg),s=e.omitted.map(vg),c=me(e.omittedCount,"Native content snapshot omittedCount"),l=e.omissionOverflow===void 0?void 0:gg(e.omissionOverflow);if(o.length>n.maxFiles)throw new Error("Native content snapshot exceeds its file-count limit");if(o.some(v=>v.size>n.maxFileBytes)||o.reduce((v,P)=>v+P.size,0)>n.maxTotalBytes)throw new Error("Native content snapshot exceeds its byte limits");if(new Set(o.map(v=>v.path)).size!==o.length)throw new Error("Native content snapshot contains duplicate paths");if(s.length>zv||c<s.length)throw new Error("Native content snapshot omission count is invalid");let d=c-s.length;if(d===0&&l||d>0&&l?.count!==d)throw new Error("Native content snapshot omission overflow is inconsistent");if(e.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let f=s.filter(v=>v.reason==="git-enumeration-limit"),h=s.filter(v=>v.reason==="git-selection-changed");for(let v of[...f,...h])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||h.length>1)throw new Error("Native Git selection omissions must not be duplicated");let m=i?.provider==="git"?i.gitSelection:i?.projection?.selection,w=m?.status==="overflow"||m?.status==="overflow-and-changed",u=m?.status==="changed"||m?.status==="overflow-and-changed";if(w!==(f.length===1))throw new Error("Native Git enumeration omission and selection evidence are inconsistent");if(u!==(h.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"),g=s.filter(v=>v.reason==="physical-selection-changed");for(let v of[...p,...g])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||g.length>1)throw new Error("Native physical selection omissions must not be duplicated");let y=i?.physicalSelection,b=y?.status==="overflow"||y?.status==="overflow-and-changed",S=y?.status==="changed"||y?.status==="overflow-and-changed";if(b!==(p.length===1))throw new Error("Native physical enumeration omission and evidence are inconsistent");if(S!==(g.length===1))throw new Error("Native physical selection-change omission and evidence are inconsistent");let E={schema:"comet.native.content-snapshot.v1",origin:e.origin,...i?{capture:i}:{},createdAt:e.createdAt,complete:e.complete,limits:n,...a?{policy:a}:{},entries:o,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(dg(E)>n.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function yg(t,e){if(!Gv.test(e))throw new Error(`Invalid Native change name: ${e}`);return io.join(X(t,e),"baseline-manifest.json")}async function Fl(t,e){let i=yg(t,e),r=he(t,i);await O(r,i);try{let n=await Tl({root:r,file:i,maxBytes:Jv,label:"Native baseline snapshot manifest"});return Ml(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}var Pg=Ct(mt(),1);var lS=4*1024*1024;var xg=null;function Cg(t,e){let i=t;for(let r of e)i+="\0"+(typeof r=="string"?r:JSON.stringify(r));return i}function Vl(t,e){return(...i)=>{let r=xg;if(r===null)return e(...i);let n=Cg(`async:${t}`,i),a=r.entries.get(n);if(a)return a.value;let o=e(...i).catch(s=>{throw r.entries.delete(n),s});return r.entries.set(n,{value:o}),o}}var pS=Vl("hookWritePolicy",async t=>(await Va(t))?.hook??{allow_paths:[]});var lE=256*1024;var kE={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 DE=16*1024,BE=process.platform;var Jl=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],Ig=new Set(Jl),Gl=new Set([...Jl,"minimum_runtime_version","revision"]),jg=new Set([...Gl,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),$g=new Set(["capability","operation","source","base_hash"]),Og=new Set(["shape","build","verify","archive"]),Hg=new Set(["implicit","confirmed"]),Dg=new Set(["pending","pass","fail"]),tt="comet-state.yaml",no=/^[a-f0-9]{64}$/u,Ul=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Bg=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,ao=class extends Error{constructor(i,r){super(`Native change ${i} uses ${r}; run comet native doctor ${i} --repair before mutating it`);this.change=i;this.schema=r;this.name="NativeSchemaMigrationRequiredError"}change;schema;code="native-schema-migration-required"},Me=class extends Error{constructor(i,r){super(i!==$e||r===null?`Unsupported Native change schema ${i} for runtime protocol ${3}`:`Native change ${i} requires runtime protocol ${r}; current protocol is ${3}`);this.schema=i;this.minimumRuntimeVersion=r;this.name="NativeRuntimeCompatibilityError"}schema;minimumRuntimeVersion;code="native-runtime-incompatible"},Ur=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"},vi=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"},Kr=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"},lP=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
146
- `);function wi(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Kl(t,e,i){let r=Object.keys(t).filter(n=>!e.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function yi(t){if(!Ul.test(t))throw new Error(`Invalid Native change name: ${t}`)}function Lg(t){if(!Ul.test(t))throw new Error(`Invalid Native capability id: ${t}`)}function Yl(t,e){if(t.length===0||et.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native change`)}function Mg(t,e){let i=wi(t,`spec_changes[${e}]`);if(Kl(i,$g,`spec_changes[${e}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(Lg(i.capability),i.operation!=="create"&&i.operation!=="replace"&&i.operation!=="remove")throw new Error(`Invalid spec operation for ${i.capability}`);let r=i.source,n=i.base_hash;if(r!==void 0&&typeof r!="string")throw new Error(`Spec source for ${i.capability} must be a string`);if(typeof r=="string"&&Yl(r,`Spec source for ${i.capability}`),i.operation==="create"){if(!r)throw new Error(`Create spec ${i.capability} requires source`);if(n!==null)throw new Error(`Create spec ${i.capability} requires null base_hash`)}else if(i.operation==="replace"){if(!r)throw new Error(`Replace spec ${i.capability} requires source`);if(typeof n!="string"||!no.test(n))throw new Error(`Replace spec ${i.capability} requires a SHA-256 base_hash`)}else{if(r!==void 0)throw new Error(`Remove spec ${i.capability} forbids source`);if(typeof n!="string"||!no.test(n))throw new Error(`Remove spec ${i.capability} requires a SHA-256 base_hash`)}return{capability:i.capability,operation:i.operation,...typeof r=="string"?{source:r}:{},base_hash:n}}function Fg(t){return/^\d{4}-\d{2}-\d{2}$/u.test(t)?new Date(`${t}T00:00:00.000Z`).toISOString().slice(0,10)===t:!1}function so(t,e){if(Kl(t,e,tt),typeof t.name!="string")throw new Error("Native change name is required");if(yi(t.name),t.language!=="en"&&t.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof t.phase!="string"||!Og.has(t.phase))throw new Error("Native change phase is invalid");if(t.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(t.approval!==null&&!Hg.has(t.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(t.spec_changes))throw new Error("Native spec_changes must be an array");let i=t.spec_changes.map(Mg),r=i.map(n=>n.capability).filter((n,a,o)=>o.indexOf(n)!==a);if(r.length>0)throw new Error(`Duplicate Native capability operation: ${[...new Set(r)].join(", ")}`);if(typeof t.verification_result!="string"||!Dg.has(t.verification_result))throw new Error("Native verification_result is invalid");if(t.verification_report!==null&&typeof t.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof t.verification_report=="string"&&Yl(t.verification_report,"Native verification_report"),typeof t.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof t.created_at!="string"||!Fg(t.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(t.run_id!==null&&(typeof t.run_id!="string"||t.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:t.name,language:t.language,phase:t.phase,brief:"brief.md",approval:t.approval,spec_changes:i,verification_result:t.verification_result,verification_report:t.verification_report,archived:t.archived,created_at:t.created_at,run_id:t.run_id}}function Mr(t){let e=wi(t,tt);if(e.schema!==He)throw new Error(`Expected ${He}`);return{schema:He,...so(e,Ig)}}function gi(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function ro(t,e,i){if(t===null)return null;let r=typeof t=="string"?Bg.exec(t):null;if(!r||r[1]!==i)throw new Error(`${e} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return t}function Vg(t){if(t==null)return null;if(typeof t!="string"||!no.test(t))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return t}function qg(t){if(t===void 0)return"legacy-v1";if(t!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return t}function Fr(t){let e=wi(t,tt);if(e.schema!==Oe)throw new Error(`Expected ${Oe}`);if(gi(e.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${Oe} minimum_runtime_version must be 2`);return{schema:Oe,minimum_runtime_version:2,revision:gi(e.revision,"Native v2 revision"),...so(e,Gl)}}function Vr(t){let e=wi(t,tt);if(e.schema!==$e){if(e.schema===He||e.schema===Oe){let o=e.schema===He?Mr(e):Fr(e);throw new ao(o.name,o.schema)}throw new Me(typeof e.schema=="string"?e.schema:"(missing)",typeof e.minimum_runtime_version=="number"?e.minimum_runtime_version:null)}let i=gi(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new Me(e.schema,i);if(i!==3)throw new Error(`Native ${e.schema} minimum_runtime_version must be ${3}`);let r=gi(e.revision,"Native revision"),n=so(e,jg),a=Vg(e.approved_contract_hash);if(n.approval===null&&a!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:$e,minimum_runtime_version:3,revision:r,verification_protocol:qg(e.verification_protocol),...n,approved_contract_hash:a,implementation_scope:ro(e.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:ro(e.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:ro(e.partial_allowance,"Native partial_allowance","allowances")}}function Wg(t){let e=wi(t,tt);if(e.schema===He){let n=Mr(e);return{status:"migration-required",schema:n.schema,minimumRuntimeVersion:1,state:n,message:`Native change ${n.name} requires migration to ${$e}`}}if(e.schema===Oe){let n=Fr(e);return{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n,message:`Native change ${n.name} requires migration to ${$e}`}}if(e.schema!==$e){let n=typeof e.minimum_runtime_version=="number"&&Number.isSafeInteger(e.minimum_runtime_version)?e.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof e.schema=="string"?e.schema:"(missing)",minimumRuntimeVersion:n,state:null,message:new Me(typeof e.schema=="string"?e.schema:"(missing)",n).message}}let i=gi(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:e.schema,minimumRuntimeVersion:i,state:null,message:new Me(e.schema,i).message};let r=Vr(e);return{status:"current",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r}}function ee(t,e){yi(e);let i=et.join(t.changesDir,e);if(!M(t.changesDir,i))throw new Error("Native change path escaped");return i}async function co(t,e){let i=X(t,e),r=et.join(i,"schema-migration.json");await O(M(t.runtimeDir,r)?t.runtimeDir:t.nativeRoot,r);try{return await Tg.lstat(r),!0}catch(n){if(n.code==="ENOENT")return!1;throw n}}var zg=256*1024;async function Jg(t,e=et.dirname(t)){let i=et.relative(e,t).split(et.sep).join("/"),r=await D({root:e,ref:i,maxBytes:zg}),n=(0,oo.parseDocument)(r.text,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid Native change file ${t}: ${n.errors[0].message}`);return n.toJS()}async function Xl(t,e){let i=et.join(ee(t,e),tt);await O(t.nativeRoot,i);let r=Wg(await Jg(i,t.nativeRoot));if(r.state&&r.state.name!==e)throw new Error(`Native change directory/name mismatch: ${e}`);return await co(t,e)?{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimumRuntimeVersion,state:r.state,message:`Native schema migration is incomplete for ${e}; run doctor --repair`}:(r.status==="current"&&r.state&&await Gg(t,r.state),r)}async function Gg(t,e){if(await Fl(t,e.name)!==null&&e.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${e.verification_protocol}`)}var po=Ct(mt(),1);import{promises as ru}from"node:fs";import te from"node:path";import{execFileSync as Ug}from"node:child_process";var Kg=3e4,Yg=8*1024*1024,lo=class extends Error{constructor(i,r,n){super(`git ${r.join(" ")} failed${n?`: ${n}`:""}`);this.cwd=i;this.args=r;this.stderr=n;this.name="GitCommandError"}cwd;args;stderr};function Xg(t,e){try{return Ug("git",["-C",t,...e],{encoding:"utf8",stdio:["ignore","pipe","pipe"],timeout:Kg,maxBuffer:Yg,windowsHide:!0})}catch(i){let r=typeof i.stderr=="string"?i.stderr.trim():Buffer.isBuffer(i.stderr)?i.stderr.toString("utf8").trim():"";throw new lo(t,e,r)}}function uo(t,e){return Xg(t,e).trim()}var Ql="children.yaml",fo="comet.native.children.v1",Qg=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Zg=new Set(["schema","children"]),ew=new Set(["name","depends_on","covers"]);function Zl(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function eu(t,e,i){let r=Object.keys(t).filter(a=>!e.has(a)),n=[...e].filter(a=>!(a in t));if(r.length>0||n.length>0)throw new Error(`${i} fields are invalid`)}function tu(t,e){if(!Array.isArray(t)||!t.every(i=>typeof i=="string"))throw new Error(`${e} must be an array of strings`);return[...new Set(t)].sort((i,r)=>i.localeCompare(r,"en"))}function ho(t,e){let i=te.normalize(te.resolve(t)),r=te.normalize(te.resolve(e));return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function tw(t){let e=new Map(t.map(a=>[a.name,a])),i=new Set,r=new Set,n=a=>{if(!r.has(a)){if(i.has(a))throw new Error(`Native children dependency cycle includes ${a}`);i.add(a);for(let o of e.get(a).depends_on)n(o);i.delete(a),r.add(a)}};for(let a of t)n(a.name)}function iw(t,e){let i=new Set(e);for(let a of t){let o=a.covers.filter(s=>!i.has(s));if(o.length>0)throw new Error(`Native child ${a.name} covers unknown acceptance: ${o.join(", ")}`)}let r=new Set(t.flatMap(a=>a.covers)),n=e.filter(a=>!r.has(a));if(n.length>0)throw new Error(`Native children do not cover parent acceptance: ${n.join(", ")}`)}function rw(t,e){let i=(0,po.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Native children contract is invalid YAML: ${i.errors[0].message}`);let r=Zl(i.toJS({mapAsMap:!1}),"Native children contract");if(eu(r,Zg,"Native children contract"),r.schema!==fo)throw new Error(`Native children schema must be ${fo}`);if(!Array.isArray(r.children)||r.children.length===0)throw new Error("Native children must be a non-empty array");let n=r.children.map((s,c)=>{let l=Zl(s,`Native child ${c}`);if(eu(l,ew,`Native child ${c}`),typeof l.name!="string"||!Qg.test(l.name))throw new Error(`Native child ${c} name is invalid`);return{name:l.name,depends_on:tu(l.depends_on,`Native child ${l.name} depends_on`),covers:tu(l.covers,`Native child ${l.name} covers`)}}),a=n.map(({name:s})=>s);if(new Set(a).size!==a.length)throw new Error("Native child names must be unique");let o=new Set(a);for(let s of n){let c=s.depends_on.filter(l=>!o.has(l));if(c.length>0)throw new Error(`Native child ${s.name} depends on unknown child: ${c.join(", ")}`)}return tw(n),e&&iw(n,e),{schema:fo,children:n}}async function nu(t){let e=te.join(t.changeDir,Ql);try{await ru.lstat(e)}catch(r){if(r.code==="ENOENT")return null;throw r}let i=await D({root:t.changeDir,ref:Ql});return{contract:rw(i.text,t.acceptanceIds),size:i.size}}function au(t){return U("comet.native.parent-contract.v1",{acceptance:t.acceptance.map(({id:e,source:i,text:r})=>({id:e,source:i,text:r})),children:t.children})}async function nw(t){let e=Nr(t.projectRoot);e.some(r=>ho(r,t.projectRoot))||e.push(t.projectRoot);let i=[];for(let r of[...new Set(e.map(n=>te.resolve(n)))]){let n=await ye(r);n&&i.push({projectRoot:r,paths:await Xe(r,n.native.artifact_root),parent:ho(r,t.projectRoot)})}return i.some(({parent:r})=>r)||i.push({projectRoot:t.projectRoot,paths:t,parent:!0}),i}async function aw(t,e){let i=te.join(t.paths.changesDir,e,"comet-state.yaml");try{return await mi(i)}catch(r){if(r.code==="ENOENT")return null;throw r}}async function ow(t,e){let i;try{i=await ru.readdir(t.paths.archiveDir,{withFileTypes:!0})}catch(n){if(n.code==="ENOENT")return[];throw n}let r=[];for(let n of i)if(!(!n.isDirectory()||n.isSymbolicLink()||![...e].some(o=>n.name.endsWith(`-${o}`))))try{let o=te.join(t.paths.archiveDir,n.name,"comet-state.yaml"),s=await mi(o);e.has(s.name)&&r.push({file:o,state:s})}catch{}return r}function sw(t,e,i){let r=te.relative(t.projectRoot,e);if(!r||r===".."||r.startsWith(`..${te.sep}`))return null;let n=r.split(te.sep).join("/");try{let a=(0,po.parseDocument)(uo(t.projectRoot,["show",`${i}:${n}`]),{uniqueKeys:!0});return a.errors.length>0?null:pi(a.toJS({mapAsMap:!1}))}catch{return null}}function cw(t,e,i){return t.workspace.isolation!=="worktree"||t.workspace.target_branch!==i||t.workspace.finish!==null&&t.workspace.finish!=="merge"?{kind:"blocked",phase:t.phase,projectRoot:e.projectRoot,message:`Native child ${t.name} must use a linked worktree targeting parent branch ${i??"(missing)"}`}:t.status==="blocked"||t.status==="await-user"?{kind:"blocked",phase:t.phase,projectRoot:e.projectRoot,message:t.blockers[0]?.reason.text??`Native child ${t.name} requires user resolution`}:{kind:"active",phase:t.phase,projectRoot:e.projectRoot,message:null}}function iu(t,e){return t.status==="done"&&t.archived&&t.workspace.finish==="merge"&&t.workspace.target_branch===e}async function mo(t){let e=te.join(t.paths.changesDir,t.state.name),i=await nu({changeDir:e,...t.state.acceptance.length>0?{acceptanceIds:t.state.acceptance.map(({id:u})=>u)}:{}});if(!i)return t.state.children_contract_hash?{contractHash:null,confirmed:!1,parentBranch:t.state.workspace.change_branch,children:[],readyChildren:[],allDone:!1}:null;let r=au({acceptance:t.state.acceptance,children:i.contract}),n=t.state.phase!=="shape"&&t.state.children_contract_hash===r,a=await nw(t.paths),o=t.state.workspace.change_branch,s=new Set(i.contract.children.map(({name:u})=>u)),c=new Map,l=new Map;for(let u of a){let p=u.parent&&o?`refs/heads/${o}`:"HEAD";for(let g of await ow(u,s)){let y={...g,source:u,committedState:sw(u,g.file,p)};c.set(g.state.name,[...c.get(g.state.name)??[],y])}for(let g of s){let y=await aw(u,g);y&&l.set(g,[...l.get(g)??[],{source:u,state:y}])}}let d=new Map;for(let u of i.contract.children){let p=(c.get(u.name)??[]).find(({source:b,committedState:S})=>b.parent&&S?.name===u.name&&iu(S,o));if(p){d.set(u.name,{kind:"done",phase:p.state.phase,projectRoot:p.source.projectRoot,message:null});continue}let g=c.get(u.name)?.[0];if(g){d.set(u.name,{kind:"blocked",phase:g.state.phase,projectRoot:g.source.projectRoot,message:`Native child ${u.name} is archived but not merged into parent branch ${o??"(missing)"}`});continue}let y=l.get(u.name)??[];y.length>1?d.set(u.name,{kind:"blocked",phase:null,projectRoot:null,message:`Native child ${u.name} has multiple active workspace owners`}):y[0]&&d.set(u.name,cw(y[0].state,y[0].source,o))}let f=new Map(i.contract.children.map(u=>[u.name,u])),h=new Map,m=u=>{let p=h.get(u);if(p)return p;let g=f.get(u),b=g.depends_on.map(m).every(({status:C})=>C==="done"),S=d.get(u),E=S?.kind==="active"&&b?g.depends_on.filter(C=>!(c.get(C)??[]).some(({source:F,committedState:ve})=>ho(F.projectRoot,S.projectRoot)&&ve?.name===C&&iu(ve,o))):[],v,P=S?.message??null;S?.kind==="done"?(v=b?"done":"blocked",b||(P=`Native child ${u} was merged before its dependencies`)):S?.kind==="active"?(v=b&&E.length===0?"active":"blocked",b?E.length>0&&(P=`Native child ${u} does not include merged dependencies: ${E.join(", ")}`):P=`Native child ${u} started before its dependencies merged`):S?.kind==="blocked"?v="blocked":(v=n&&b?"ready":"pending",n||(P="Parent Shape confirmation is required"));let k={name:u,dependsOn:[...g.depends_on],covers:[...g.covers],status:v,phase:S?.phase??null,projectRoot:S?.projectRoot??null,message:P};return h.set(u,k),k},w=i.contract.children.map(({name:u})=>m(u));return{contractHash:r,confirmed:n,parentBranch:o,children:w,readyChildren:w.filter(({status:u})=>u==="ready").map(({name:u})=>u),allDone:w.every(({status:u})=>u==="done")}}var PP={maxAcceptanceCriteria:xl.maxCriteria};var it={maxSpecs:64,maxFileBytes:kr,maxTotalBytes:4*1024*1024};import{promises as mu}from"fs";import vu from"path";var lw=["Outcome","Scope","Non-goals","Acceptance examples"],OP=[...lw,"Constraints and invariants","Decisions","Open questions","Verification expectations"];var JP={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var su=1024*1024;var lu={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:[]},dw=J("comet-native-runtime:v3:scope-reopen"),Nx=[{skillVersion:"3",skillHash:J("comet-native-runtime:v3:semantic-repair-budget")},{skillVersion:"2",skillHash:J("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:J("comet-native-runtime:v1")}];var hu=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],Zx=new Set(hu),vw=new Set([...hu,"minimum_runtime_version","revision"]),eC=new Set([...vw,"operation"]),tC=512*1024,gw=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),iC=new Set([...gw,"implementationScopeHash","repairScopeHash","repairStagnation","returnToBuild"]);var gu=it.maxSpecs*4;async function ww(t,e){let i=vu.join(ee(t,e),"specs"),r;try{r=await Za({root:t.nativeRoot,directory:i,label:"Native proposed specs directory"})}catch(s){if(s.code==="ENOENT")return[];throw s}let n=[],a=0,o=await mu.opendir(i);try{for await(let s of o){if(a+=1,a>gu)throw new Error(`Native proposed specs directory exceeds ${gu} entries`);if(s.isSymbolicLink())throw new Error(`Proposed spec capability must not be a symbolic link: ${s.name}`);if(!s.isDirectory())continue;yi(s.name);let c=vu.join(i,s.name,"spec.md");await O(t.nativeRoot,c);let l;try{l=await mu.lstat(c)}catch(d){if(d.code==="ENOENT")continue;throw d}if(l.isSymbolicLink()||!l.isFile())throw new Error(`Proposed spec must be a regular file: ${s.name}`);if(n.push(s.name),n.length>it.maxSpecs)throw new Error("Native proposed specs exceed the spec-count budget")}}finally{await o.close().catch(s=>{if(s.code!=="ERR_DIR_CLOSED")throw s})}return await r.verify(),n.sort()}async function Nu(t,e){let i=ee(t,e),r={},n=0;for(let a of await ww(t,e)){let o=await D({root:i,ref:`specs/${a}/spec.md`,maxBytes:it.maxFileBytes});if(n+=o.size,n>it.maxTotalBytes)throw new Error("Native proposed specs exceed the total byte budget");r[a]=o.text}return r}function bu(t,e){let i={schema:"comet.native.continuation.v2",skill:"comet-native",change:t.name,phase:t.phase,status:t.status,stateVersion:t.state_version,inputOptions:[]},r=n=>({kind:n,candidateId:t.builder_handoff?.candidate_id??null,iteration:t.loop.iteration,attempt:t.loop.attempt});if(t.status==="done")return{...i,disposition:"done",action:"none",commandArgs:null,requiredInputs:[],runnerAction:r("none")};if(t.status==="await-user")return t.phase==="verify"&&t.verification_result==="pass"&&t.loop.next_action==="confirm-skill-coordinated-pass"?{...i,disposition:"await-user",action:"confirm-skill-coordinated-pass",commandArgs:["comet","native","next",t.name,"--summary","<summary>","--confirmed"],requiredInputs:["summary","user-confirmation"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null},{name:"confirmed",flag:"--confirmed",valueKind:"confirmation",required:!0,template:null}],runnerAction:r("none")}:t.phase==="verify"&&t.verification?.assurance==="semantic-verification-unavailable"&&t.loop.next_action==="confirm-verifier-unavailable"?{...i,disposition:"await-user",action:"confirm-verifier-unavailable",commandArgs:["comet","native","next",t.name,"--summary","<summary>","--confirmed"],requiredInputs:["summary","user-confirmation"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null},{name:"confirmed",flag:"--confirmed",valueKind:"confirmation",required:!0,template:null}],runnerAction:r("none")}:t.phase==="verify"&&t.loop.next_action==="resolve-verifier-blocker"?{...i,disposition:"await-user",action:"resolve-verifier-blocker",commandArgs:["comet","native","next",t.name,"--summary","<summary>","--resolve-verifier-blocker"],requiredInputs:["summary","user-resolution"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null}],runnerAction:r("none")}:t.phase==="verify"&&t.loop.next_action==="await-user"?{...i,disposition:"await-user",action:"resolve-loop-stop",commandArgs:["comet","native","next",t.name,"--return-to-build","--summary","<summary>"],requiredInputs:["summary","user-decision"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null}],runnerAction:r("none")}:{...i,disposition:"await-user",action:"none",commandArgs:null,requiredInputs:["resolve-blocker"],runnerAction:r("none")};if(t.status==="blocked"){let n=t.blockers.some(({resolution_action:a})=>a==="retry-verifier");return{...i,disposition:"blocked",action:n?"retry-verifier":"none",commandArgs:n?["comet","native","next",t.name,"--retry-verifier","--summary","<summary>"]:null,requiredInputs:n?["summary"]:["repair-runtime"],inputOptions:n?[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null}]:[],runnerAction:r(n?"retry-verifier":"none")}}if(t.phase==="shape")return{...i,disposition:"continue",action:"confirm-shape",commandArgs:["comet","native","next",t.name,"--summary","<summary>","--confirmed"],requiredInputs:["summary","shared-understanding-confirmation"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null},{name:"confirmed",flag:"--confirmed",valueKind:"confirmation",required:!0,template:null}],runnerAction:r("none")};if(t.phase==="build"){if(e){if(!e.confirmed)return{...i,disposition:"continue",action:"advance-children",commandArgs:["comet","native","next",t.name,"--summary","<summary>"],requiredInputs:["summary"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null}],runnerAction:r("none")};if(t.loop.stage==="repairing"&&t.verification_result==="fail")return{...i,disposition:"continue",action:"repair",commandArgs:null,requiredInputs:["repair-child"],inputOptions:[],runnerAction:r("none")};if(e.allDone)return{...i,disposition:"continue",action:"advance-children",commandArgs:["comet","native","next",t.name,"--summary","<summary>"],requiredInputs:["summary"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null}],runnerAction:r("none")};let n=e.children.some(({status:o})=>o==="blocked"),a=e.children.some(({status:o})=>o==="ready"||o==="active");return{...i,disposition:n&&!a?"blocked":"continue",action:"advance-children",commandArgs:null,requiredInputs:n&&!a?["resolve-child-blocker"]:["ready-children"],inputOptions:[],runnerAction:r("none")}}return{...i,disposition:"continue",action:t.loop.stage==="repairing"?"repair":"builder-handoff",commandArgs:["comet","native","next",t.name,"--runner-input","<temporary-json-file>"],requiredInputs:["builder-handoff-json-file"],inputOptions:[{name:"runner-input",flag:"--runner-input",valueKind:"json-file",required:!0,template:{kind:"builder-handoff",summary:"<summary>",addressed_acceptance_ids:["<acceptance-id>"],checks:[{name:"<check-name>",result:"not-run",note:null}],known_limits:[]}}],runnerAction:r("builder-handoff")}}if(t.phase==="verify"){let n=t.loop.next_action==="await-verifier-result";return{...i,disposition:"continue",action:n?"await-verifier":"dispatch-verifier",commandArgs:["comet","native","next",t.name,"--runner-input","<temporary-json-file>"],requiredInputs:[n?"verifier-response-or-error-json-file":"resolved-check-plan-json-file"],inputOptions:[{name:"runner-input",flag:"--runner-input",valueKind:"json-file",required:!0,template:n?[{kind:"verifier-response",response:{kind:"request-checks",iteration:t.loop.iteration,attempt:t.loop.attempt,checks:[{id:"<check-id>",name:"<check-name>",executable:"<executable>",argv:[],cwdRef:".",timeoutMs:12e4,repeatable:!0}]}},{kind:"verifier-response",response:{kind:"final-result",result:{iteration:t.loop.iteration,attempt:t.loop.attempt,verdict:"<pass|fail|blocked>",acceptance:[{id:"<acceptance-id>",result:"<passed|failed|blocked>",reason:"<reason>"}],risks:[],summary:"<summary>"}}},{kind:"verifier-execution-error",summary:"<summary>",stateVersion:t.state_version,iteration:t.loop.iteration,attempt:t.loop.attempt,verifierExecutionRef:"<from verifierDispatch>"},{kind:"verifier-unavailable",summary:"<why no independent semantic execution is available>",stateVersion:t.state_version,iteration:t.loop.iteration,attempt:t.loop.attempt,verifierExecutionRef:"<from verifierDispatch>"}]:{kind:"dispatch-verifier",checks:[]}}],runnerAction:r(n?"await-verifier":"dispatch-verifier")}}return{...i,disposition:"continue",action:"archive",commandArgs:["comet","native","archive",t.name,"--confirmed"],requiredInputs:[],runnerAction:r("none")}}import{promises as Ew}from"node:fs";import ku from"node:path";var HC=["$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 Pw=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,xw="comet-state.yaml";function go(t,e){if(!Pw.test(e))throw new Error(`Invalid Native change name: ${e}`);let i=ku.join(t.changesDir,e);if(!M(t.changesDir,i))throw new Error("Native change path escaped");return i}function Su(t,e){return ku.join(go(t,e),xw)}async function wo(t,e){try{let i=await Ew.readFile(Su(t,e),"utf8");return/^schema:\s*comet\.native\.v4\s*$/mu.test(i)}catch(i){if(i.code==="ENOENT")return!1;throw i}}async function yo(t,e){return mi(Su(t,e))}import ko from"path";var Cw=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 Eu="scoped-text-safety",Rw=1,Aw=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var _w="comet.native.checker-policy.v1";var wA=U(_w,{policy:Eu,version:Rw,limits:Aw,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var Tw=["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"],yA=new Set(Tw);var jw=su,HA=3*jw;import{execFile as Fw}from"node:child_process";import{promisify as Vw}from"node:util";var YA=512*1024;var Ni=class extends Error{recovery;constructor(e,i){super(e),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var y_=64*1024;var N_=3600*1e3;var b_=Vw(Fw);var Yr=class extends Error{details;constructor(e){let i=e.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${e.length} receipt(s)): ${e.map(r=>`${r.ref}${r.acceptanceId?`[${r.acceptanceId}]`:""} -> ${r.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=e}};var oT={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var gT=16*1024*1024,wT=256*1024,yT=16*1024;var ET=Object.freeze({maxScopeChanges:128,maxAcceptanceEntries:64,maxUnresolvedReasons:32,maxReceipts:32});var CT=16*1024;var LT=16*1024;var AI=16*1024*1024,Xr=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"},Qr=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 Zr=class extends Error{constructor(i,r,n){super(i,n);this.preparation=r;this.name="NativeWorkspacePreparationError"}preparation};var xu=["--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:xu,output:"Human-readable text by default; use --json for a structured command envelope.",examples:["comet native status --json","comet native status my-change --details --json","comet native next --help"]},init:{usage:"comet native init [--root <artifact-root>] [--language en|zh-CN]",purpose:"Create or normalize .comet/config.yaml and the configured Native directories.",options:["--root <artifact-root> Project-relative artifact root; defaults to docs.","--language en|zh-CN Language for newly generated Native artifacts."],output:"The resolved project configuration and Native paths.",examples:["comet native init --root docs --language zh-CN"]},root:{usage:"comet native root <show|move> [arguments]",purpose:"Inspect or transactionally move the configured Native artifact root.",subcommands:["show Print the configured artifact root and resolved paths.","move <artifact-root> Move Native artifacts and update project configuration."],output:"The current root projection or the completed move result.",examples:["comet native root show","comet native root move artifacts/native"]},"root show":{usage:"comet native root show",purpose:"Print the configured Native artifact root and resolved paths.",output:"The configured artifact root and resolved Native paths."},"root move":{usage:"comet native root move <artifact-root>",purpose:"Transactionally move Native artifacts and update project configuration.",output:"The source, destination, and committed root-move transaction result.",examples:["comet native root move artifacts/native"]},new:{usage:"comet native new <change-name> [--language en|zh-CN] [--isolation current|branch|worktree] [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]",purpose:"Create a portable Native change and prepare the requested branch or linked worktree.",options:["--language en|zh-CN Artifact language; defaults to project configuration.","--isolation <kind> current, branch, or worktree; defaults to current.","--change-branch <branch> Change branch; defaults to comet/<change-name>.","--target-branch <branch> Local base branch; defaults to the current branch.","--worktree-path <path> Worktree directory; defaults to .worktrees/<change-name>."],output:"The portable state, workspace preparation result, and continuation with the next Runner action.",examples:["comet native new session-timeout --language zh-CN","comet native new session-timeout --isolation branch --target-branch main","comet native new session-timeout --isolation worktree --target-branch main"]},spec:{usage:"comet native spec remove <change-name> <capability>",purpose:"Record a capability removal; create and modify intents use complete proposed Spec files.",subcommands:["remove <change-name> <capability> Record a capability removal."],output:"The updated portable state and continuation."},"spec remove":{usage:"comet native spec remove <change-name> <capability>",purpose:"Record removal of a capability in the complete target specification.",output:"The updated portable state and continuation with the next Runner action."},show:{usage:"comet native show <change-name>",purpose:"Read formal artifacts and portable state for one Native change.",output:"The portable state, brief, complete proposed Specs, and continuation; legacy state is reported as migration-required."},status:{usage:"comet native status [<change-name>] [--cursor <token>] [--details]",purpose:"Discover portable stable boundaries, parent child readiness, or the exact next Runner action.",options:["--cursor <token> Continue a status-list page.","--details Include acceptance, Spec, workspace, and report details."],output:"A v2 status page or one portable Loop projection with local execution availability and continuation.runnerAction; parent changes also expose children and readyChildren.",examples:["comet native status --json","comet native status session-timeout --details --json"]},select:{usage:"comet native select <change-name>",purpose:"Select one Native change after validating its workspace binding.",output:"The selected change record."},next:{usage:`comet native next <change-name> --summary <text> [--confirmed|--return-to-build|--retry-verifier|--resolve-verifier-blocker]
147
- comet native next <change-name> --runner-input <json-file>`,purpose:"Confirm or recover an Agent boundary, advance parent child changes, or use one skill-coordinated JSON bridge for Builder handoff, check-plan dispatch, and Verifier response/error.",options:["--summary <text> Required transition or recovery summary.","--confirmed Confirm Shape, a completed skill-coordinated pass, or an explicitly degraded verifier-unavailable fallback before Archive.","--return-to-build Return Verify or Archive to Build after invalidation or user choice.","--retry-verifier Retry a blocked Verifier execution when the continuation allows it.","--resolve-verifier-blocker Resolve a semantic Verifier blocker without changing the candidate, then dispatch a new attempt.","--runner-input <file> Skill-coordinated JSON: builder-handoff, dispatch-verifier, verifier-response, verifier-execution-error, or verifier-unavailable. Identity/provider/execution/candidate fields are rejected."," builder-handoff fields: kind, summary, addressed_acceptance_ids, checks, known_limits."," dispatch-verifier fields: kind, checks (an explicitly resolved plan; [] is allowed)."," verifier-response fields: kind, response (request-checks or final-result)."," verifier-execution-error fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch."," verifier-unavailable fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch; accepted only after the explicit Runtime check plan completed and passed."],output:"The portable state, explicit skill-coordinated label, Runtime-owned check results, complete verifierDispatch, bounded request-check response, continuation.runnerAction, and machine-readable continuation.inputOptions. This generic bridge is not trusted identity attestation: a passing result waits for explicit user confirmation before Archive.",examples:['comet native next session-timeout --summary "Shape confirmed" --confirmed','comet native next session-timeout --summary "Implementation changed" --return-to-build','comet native next session-timeout --summary "Retry verifier infrastructure" --retry-verifier','comet native next session-timeout --summary "Retry semantic verification" --resolve-verifier-blocker',"comet native next session-timeout --runner-input <temporary-json-file>"]},archive:{usage:`comet native archive <change-name> --dry-run [--finish merge|push|pull-request|keep]
148
- 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(t,e){return`${t}:
142
+ `,i)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=Nr(e),r=mt(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=Nr(e),r=mt(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};pl.Parser=Ma});var yl=N(ni=>{"use strict";var ml=Ca(),lm=Kt(),ri=Qt(),um=xn(),dm=P(),fm=La(),vl=Fa();function gl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new fm.LineCounter||null,prettyErrors:e}}function hm(t,e={}){let{lineCounter:i,prettyErrors:r}=gl(e),n=new vl.Parser(i?.addNewLine),a=new ml.Composer(e),o=Array.from(a.compose(n.parse(t)));if(r&&i)for(let s of o)s.errors.forEach(ri.prettifyError(t,i)),s.warnings.forEach(ri.prettifyError(t,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function wl(t,e={}){let{lineCounter:i,prettyErrors:r}=gl(e),n=new vl.Parser(i?.addNewLine),a=new ml.Composer(e),o=null;for(let s of a.compose(n.parse(t),!0,t.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new ri.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&i&&(o.errors.forEach(ri.prettifyError(t,i)),o.warnings.forEach(ri.prettifyError(t,i))),o}function pm(t,e,i){let r;typeof e=="function"?r=e:i===void 0&&e&&typeof e=="object"&&(i=e);let n=wl(t,i);if(!n)return null;if(n.warnings.forEach(a=>um.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 mm(t,e,i){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){let n=Math.round(i);i=n<1?void 0:n>8?{indent:8}:{indent:n}}if(t===void 0){let{keepUndefined:n}=i??e??{};if(!n)return}return dm.isDocument(t)&&!r?t.toString(i):new lm.Document(t,r,i).toString(i)}ni.parse=pm;ni.parseAllDocuments=hm;ni.parseDocument=wl;ni.stringify=mm});var vt=N(R=>{"use strict";var vm=Ca(),gm=Kt(),wm=sa(),Va=Qt(),ym=jt(),_e=P(),Nm=xe(),bm=T(),km=Ce(),Sm=Re(),Em=wr(),xm=Da(),Pm=La(),Cm=Fa(),kr=yl(),Nl=At();R.Composer=vm.Composer;R.Document=gm.Document;R.Schema=wm.Schema;R.YAMLError=Va.YAMLError;R.YAMLParseError=Va.YAMLParseError;R.YAMLWarning=Va.YAMLWarning;R.Alias=ym.Alias;R.isAlias=_e.isAlias;R.isCollection=_e.isCollection;R.isDocument=_e.isDocument;R.isMap=_e.isMap;R.isNode=_e.isNode;R.isPair=_e.isPair;R.isScalar=_e.isScalar;R.isSeq=_e.isSeq;R.Pair=Nm.Pair;R.Scalar=bm.Scalar;R.YAMLMap=km.YAMLMap;R.YAMLSeq=Sm.YAMLSeq;R.CST=Em;R.Lexer=xm.Lexer;R.LineCounter=Pm.LineCounter;R.Parser=Cm.Parser;R.parse=kr.parse;R.parseAllDocuments=kr.parseAllDocuments;R.parseDocument=kr.parseDocument;R.stringify=kr.stringify;R.visit=Nl.visit;R.visitAsync=Nl.visitAsync});var po=Rt(vt(),1);import{promises as Vg}from"fs";import tt from"path";import{execFileSync as Rm}from"child_process";import oi from"path";function ai(t,e){return Rm("git",["-C",t,...e],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function Am(t,e){let i=oi.normalize(t),r=oi.normalize(e);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function gt(t){try{let e=oi.resolve(ai(t,["rev-parse","--show-toplevel"])),r=ai(t,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),n=r?oi.resolve(r.slice(9)):e,a=null;try{a=ai(t,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!Am(e,n),currentWorktreeRoot:e,primaryWorktreeRoot:n,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function bl(t){try{ai(t,["rev-parse","--is-inside-work-tree"]);let e=ai(t,["worktree","list","--porcelain"]).split(/\r?\n/u),i=[],r=null;for(let n of e)n.startsWith("worktree ")?(r&&i.push(r),r={root:oi.resolve(n.slice(9)),branch:null,detached:!1}):r&&n.startsWith("branch refs/heads/")?r.branch=n.slice(18):r&&n==="detached"&&(r.detached=!0);return r&&i.push(r),i}catch{return[]}}function Sr(t){return bl(t).map(e=>e.root)}import{createHash as jm}from"node:crypto";import{promises as ne}from"node:fs";import Y from"node:path";import{TextDecoder as $m}from"node:util";var _m=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),Tm=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function Im(t){return t.toLowerCase().startsWith(".env")}function si(t){let i=t.replaceAll("\\","/").split("/").filter(Boolean).map(r=>r.toLowerCase());return i.some(r=>Im(r))?"environment-file":i.some(r=>Tm.has(r))?"credential-config":i.includes(".git")?"git-metadata":i.some(r=>_m.has(r))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}function Te(t){return t!==0&&t!==0n&&t!=="0"}function we(t,e){return Te(t.dev)&&Te(e.dev)&&Te(t.ino)&&Te(e.ino)}function I(t,e){let i=Te(t.dev)&&Te(e.dev);if(i&&t.dev!==e.dev)return!1;let r=Te(t.ino)&&Te(e.ino);return r&&t.ino!==e.ino?!1:i&&r?!0:t.birthtime===e.birthtime}var xr=1024*1024;function qa(t,e){let i=Y.relative(t,e);return i===""||!Y.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Y.sep}`)}function Om(t){let e=Y.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(n=>{let a=n.codePointAt(0)??0;return a<=31||a===127})||Y.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let i=t.toLowerCase(),r=si(t);if(r||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${r??"native-runtime"}): ${t}`);return t}function Hm(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function Dm(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Er(t,e){let i={...t,birthtime:t.birthtimeMs},r={...e,birthtime:e.birthtimeMs};return we(i,r)?I(i,r):I(i,r)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function kl(t){let e=await ne.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await ne.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function Bm(t,e){let i=Y.resolve(t),r=Y.resolve(e);if(!qa(i,r))throw new Error("Native artifact path is outside its root");let n=[await kl(i)],a=i;for(let o of Y.relative(i,r).split(Y.sep).filter(Boolean)){a=Y.join(a,o);let s=await kl(a);if(!qa(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);n.push(s)}return n}async function Sl(t){for(let e of t){let i=await ne.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!Dm(e,i)||await ne.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function D(t){let e=Om(t.ref),i=t.maxBytes===null?null:Hm(t.maxBytes??xr),r=Y.resolve(t.root,...e.split("/")),n=await Bm(t.root,Y.dirname(r));await t.hooks?.afterParentChainCaptured?.();let a=await ne.lstat(r);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(i!==null&&a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);let o=await ne.realpath(r);if(!qa(n[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${e}`);let s=await ne.open(r,"r");try{let[c,l,d]=await Promise.all([s.stat(),ne.lstat(r),ne.realpath(r)]);if(await Sl(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||d!==o||!Er(a,c)||!Er(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let f=[],h=0,m=Buffer.allocUnsafe(i===null?64*1024:Math.min(64*1024,i+1));for(;;){let b=i===null?m.length:i+1-h,S=await s.read(m,0,Math.min(m.length,b),null);if(S.bytesRead===0)break;if(h+=S.bytesRead,i!==null&&h>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);f.push(Buffer.from(m.subarray(0,S.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[w,u,p]=await Promise.all([s.stat(),ne.lstat(r),ne.realpath(r)]);if(await Sl(n),!u.isFile()||u.isSymbolicLink()||p!==o||!Er(c,w)||!Er(c,u))throw new Error(`Native artifact changed while reading: ${e}`);let g=Buffer.concat(f,h),y;try{y=new $m("utf-8",{fatal:!0}).decode(g)}catch(b){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:b})}return{ref:e,size:h,hash:t.includeHash===!1?null:jm("sha256").update(g).digest("hex"),text:y}}finally{await s.close()}}var za=Rt(vt(),1);import wt from"path";var ci=64*1024,Pr=1024,Cr=64,Ja=5,Lm=12e4,El=6e5,Mm=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/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/**"],Fm=["**/.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"],Vm=[...Mm,...Fm].sort((t,e)=>t.localeCompare(e,"en"));var G={include:["**/*"],exclude:[...Vm],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4};function qm(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim();if(i.length===0||wt.posix.isAbsolute(i)||wt.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be a project-relative path`);if(i===".")return[];let r=i.replaceAll("\\","/").split("/");if(r.some(n=>n===".."))throw new Error(`${e} must stay inside the project root`);if(r.some(n=>n===""||n==="."))throw new Error(`${e} must not contain empty or dot path segments`);return r}function Ke(t){let e=qm(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Pl(t,e="docs"){let i=t??e;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function Rr(t,e,i=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||wt.posix.isAbsolute(r)||wt.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let n=r.split("/");if(n.some(a=>a===".."))throw new Error(`${e} must stay inside its declared path base`);if(n.some(a=>a===""||a==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return n.join("/")}function Ie(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Cl(t,e,i){let r=t??e;if(r!=="en"&&r!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return r}function Ar(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>Pr)throw new Error(`${e} exceeds ${Pr} characters`);let i=0;for(let r=0;r<t.length;r+=1)t[r]==="?"?i+=1:t[r]==="*"&&(i+=1,t[r+1]==="*"&&(r+=1));if(i>Cr)throw new Error(`${e} contains more than ${Cr} wildcard tokens`);return t}function xl(t,e,i){if(t===void 0)return[...i];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(r=>Ar(r,e)))].sort((r,n)=>r.localeCompare(n,"en"))}function Wa(t,e,i){let r=t??e;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${i} must be a positive integer`);return r}function Wm(t){if(t===void 0)return{...G,include:[...G.include],exclude:[...G.exclude]};let e=Ie(t,"native.snapshot");return{include:xl(e.include,"native.snapshot.include",G.include),exclude:xl(e.exclude,"native.snapshot.exclude",G.exclude),max_files:Wa(e.max_files,G.max_files,"native.snapshot.max_files"),max_total_bytes:Wa(e.max_total_bytes,G.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Wa(e.max_duration_ms,G.max_duration_ms,"native.snapshot.max_duration_ms")}}function zm(t){if(t===void 0)return;let e=Ie(t,"native.pending_root_move"),i=e.id,r=e.from_artifact_root,n=e.to_artifact_root,a=e.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof r!="string"||typeof n!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let s=Ie(e.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,d=s.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof d!="string"||!/^[a-f0-9]{64}$/u.test(d))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:d}}return{id:i,fromArtifactRoot:Ke(r),toArtifactRoot:Ke(n),stage:a,...o?{cleanup:o}:{}}}function Jm(t){if(t===void 0)return;let e=Ie(t,"native.finish");if(e.pull_request===void 0)return{};let i=Ie(e.pull_request,"native.finish.pull_request");if(i.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(i.command)||i.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(i.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let r=i.command.map((a,o)=>{if(typeof a!="string"||a.trim().length===0||a.length>4096||/[\0\r\n]/u.test(a))throw new Error(`native.finish.pull_request.command[${o}] must be a non-empty single-line string of at most 4096 characters`);return a});if(wt.posix.isAbsolute(r[0])||wt.win32.isAbsolute(r[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let n=i.timeout_ms??Lm;if(!Number.isSafeInteger(n)||n<1||n>El)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${El}`);return{pull_request:{provider:"repository-command",command:r,timeout_ms:n}}}function Gm(t,e={}){let i=Ie(t,"native"),r=i.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let n=i.clarification_mode??"batch";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=i.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=i.max_verify_failures??Ja;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=zm(i.pending_root_move),c=Jm(i.finish);return{artifact_root:Ke(r),language:Cl(i.language,"en","native.language"),clarification_mode:n,archive_confirmation:a,max_verify_failures:o,snapshot:Wm(i.snapshot),...c?{finish:c}:{},...s?{pending_root_move:s}:{}}}function Um(t){let e=Ie(t,"classic"),i=e.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let r=e.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=e.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Pl(e.artifact_layout),language:Cl(e.language,"zh-CN","classic.language"),context_compression:i,review_mode:r,auto_transition:n}}function Km(t){let i=Ie(t,"hook").allow_paths??[];if(!Array.isArray(i))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(i.map((r,n)=>Rr(r,`hook.allow_paths[${n}]`)))]}}function Ym(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Xm(t,e,i,r,n,a){let o=t.schema!==void 0;if(!(o||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!o)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let c=t.workflows??[t.default_workflow];if(!Array.isArray(c)||c.length===0||c.some(d=>d!=="native"&&d!=="classic"))throw new Error("workflows must contain native and/or classic");let l=[...new Set(c)];if(!l.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(l.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:l,ambient_resume:n,...e?{hook:e}:{},...i?{native:i}:{},...r?{classic:r}:{}}}function li(t,e={}){let i=(0,za.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let r=i.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let n=r,a=Ym(n.ambient_resume),o=n.hook===void 0?void 0:Km(n.hook),s=n.native===void 0?void 0:Gm(n.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),c=n.classic===void 0?void 0:Um(n.classic),l=Xm(n,o,s,c,a,{allowPartialProject:e.allowPartialProject??!1});return{value:n,config:l,ambient_resume:a,...o?{hook:o}:{},...s?{native:s}:{},...c?{classic:c}:{}}}function _r(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:Ke(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Ja,snapshot:{...G,include:[...G.include],exclude:[...G.exclude]}}}}import{createHash as Zm}from"crypto";import{promises as jr}from"fs";import je from"path";import{constants as Tr,promises as Ye}from"fs";var de=class extends Error{reason;constructor(e,i,r){super(i,r),this.name="RaceSafeReadError",this.reason=e}};function Ga(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Rl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function ui(t){return{dev:t.dev,ino:t.ino,birthtime:Ga(t)}}function Ir(t,e){let i=ui(t),r=ui(e);return we(i,r)?I(i,r):I(i,r)&&Ga(t)===Ga(e)&&Rl(t)===Rl(e)&&t.size===e.size}async function di(t,e,i={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=i.label??"file",n=i.bigint===!0,a=await Ye.lstat(t,{bigint:n});if(!a.isFile()||a.isSymbolicLink())throw new de("not-regular-file",`${r} must be a regular file`);if(BigInt(a.size)>BigInt(e))throw new de("too-large",`${r} exceeds ${e} bytes`);let o=await Ye.realpath(t);await i.verify?.("pre-open",{realPath:o,identity:ui(a)});let s=process.platform==="win32"?Tr.O_RDONLY:Tr.O_RDONLY|Tr.O_NOFOLLOW|Tr.O_NONBLOCK,c;try{c=await Ye.open(t,s)}catch(l){throw l.code==="ELOOP"?new de("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,d,f]=await Promise.all([c.stat({bigint:n}),Ye.lstat(t,{bigint:n}),Ye.realpath(t)]);if(!l.isFile()||!d.isFile()||d.isSymbolicLink()||f!==o||!Ir(a,l)||!Ir(a,d))throw new de("changed",`${r} changed while opening`);await i.verify?.("post-open",{realPath:f,identity:ui(l)}),await i.hooks?.afterOpen?.();let h=[],m=0,w=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-m,{bytesRead:b}=await c.read(w,0,Math.min(w.length,y),null);if(b===0)break;if(m+=b,m>e)throw new de("too-large",`${r} exceeds ${e} bytes`);h.push(Buffer.from(w.subarray(0,b)))}await i.hooks?.beforeFinalCheck?.();let[u,p,g]=await Promise.all([c.stat({bigint:n}),Ye.lstat(t,{bigint:n}),Ye.realpath(t)]);if(!p.isFile()||p.isSymbolicLink()||g!==o||!Ir(a,u)||!Ir(a,p))throw new de("changed",`${r} changed while reading`);return await i.verify?.("post-read",{realPath:g,identity:ui(u)}),{bytes:Buffer.concat(h,m),stat:u,realPath:g}}finally{await c.close()}}function Qm(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Ua(t,e){let i=je.relative(t,e);return i===""||!je.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${je.sep}`)}async function Al(t,e){let i=je.resolve(t),r=await jr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return jr.realpath(i)}async function _l(t,e,i,r){let n=t;for(let a=0;a<i.length;a++){n=je.join(n,i[a]);let o;try{o=await jr.lstat(n)}catch(d){if(Qm(d))return{exists:!1,kind:"missing"};throw d}let s=je.relative(t,n).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${r.label} ancestor ${s} must be a real directory`);if(c&&(r.expected==="file"&&!o.isFile()||r.expected==="directory"&&!o.isDirectory()||r.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await jr.realpath(n);if(!Ua(e,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function yt(t,e,i){let r=Rr(e,i.label),n=je.resolve(t),a=await Al(n,i.label),o=r.split("/"),s=je.resolve(n,...o);if(!Ua(n,s))throw new Error(`${i.label} must stay inside the project root`);let c=await _l(n,a,o,i);return{projectRoot:n,target:s,relative:r,exists:c.exists,kind:c.kind}}async function $e(t,e,i,r){let n=await yt(t,e,{label:r.label,expected:"file"});if(!n.exists){let o=new Error(`${r.label} does not exist`);throw o.code="ENOENT",o}let a=await Al(n.projectRoot,r.label);return di(n.target,i,{...r,verify:async(o,s)=>{if(!Ua(a,s.realPath))throw new Error(`${r.label} resolves outside the project root`);await _l(n.projectRoot,a,n.relative.split("/"),{label:r.label,expected:"file"})}})}var fi=".comet/config.yaml";function ev(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function $r(t,e={}){return(await Or(t,e)).document}async function tv(t){try{return(await $e(t,fi,ci,{label:fi})).bytes}catch(e){if(ev(e))return null;throw e}}function iv(t){return t?{exists:!0,sha256:Zm("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Or(t,e={}){let i=await tv(t);return{document:i?li(i.toString("utf8"),e):null,identity:iv(i)}}async function Ka(t){return(await $r(t))?.config??null}var pb=16*1024;import{existsSync as Il,promises as Xe}from"fs";import A from"path";import sv from"os";var Hr=".comet/config.yaml",cv=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;async function Qa(t){try{return await Xe.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function lv(t){try{let e=await Xe.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function bt(t,e){let i=A.relative(t,e);return i===""||!A.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${A.sep}`)}async function Nt(t){let e=[],i=t;for(;!await Qa(i);){let n=A.dirname(i);if(n===i)break;e.push(A.basename(i)),i=n}let r=await Xe.realpath(i);return A.resolve(r,...e.reverse())}async function Za(t){try{return(await Xe.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Dr(t){let e=A.resolve(t);try{(await Xe.stat(e)).isDirectory()||(e=A.dirname(e))}catch(n){if(n.code!=="ENOENT")throw n}let i=e,r=A.resolve(sv.homedir());for(;;){if(!(e===r&&i!==r)){let o=A.join(e,...Hr.split("/")),s=e===i||await lv(o);if(await Qa(o)&&s)return e}if(await Qa(A.join(e,".git")))return e;let a=A.dirname(e);if(a===e)return i;e=a}}function Br(t){return Ke(t)}async function uv(t,e){let i=Br(e),r=A.resolve(t,...i.split("/")),n=await Xe.realpath(t),a=await Nt(r);if(!bt(n,a))throw new Error("native.artifact_root resolves outside the project root");return r}async function Qe(t,e){let i=Br(e),r=await uv(t,i),n=A.join(r,"comet");if(await Za(n))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([Nt(r),Nt(n)]);if(!bt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");let s=A.resolve(t),c=A.join(s,".comet","runtime","native");if(await Za(c))throw new Error("The Native Runtime root must not be a symbolic link");let[l,d]=await Promise.all([Xe.realpath(s),Nt(c)]);if(!bt(l,d))throw new Error("The Native Runtime root resolves outside the project root");return{projectRoot:s,configFile:A.join(t,...Hr.split("/")),artifactRoot:r,artifactRootRef:i,nativeRoot:n,specsDir:A.join(n,"specs"),changesDir:A.join(n,"changes"),archiveDir:A.join(n,"archive"),runtimeDir:c,changesRuntimeDir:A.join(c,"changes"),locksDir:A.join(c,"locks"),transactionsDir:A.join(c,"transactions")}}function jl(t){if(!cv.test(t))throw new Error(`Invalid Native change name: ${t}`)}function Lr(t,e){jl(e);let i=A.join(t.changesRuntimeDir,e);if(!M(t.changesRuntimeDir,i))throw new Error("Native change Runtime path escaped");return i}function dv(t,e){jl(e);let i=A.join(t.changesDir,e,"runtime");if(!M(t.changesDir,i))throw new Error("Legacy Native change Runtime path escaped");return i}function X(t,e){let i=Lr(t,e);if(Il(i))return i;let r=dv(t,e);return Il(r)?r:i}function fe(t,e){let i=A.resolve(e);if(M(t.runtimeDir,i))return t.runtimeDir;if(M(t.nativeRoot,i))return t.nativeRoot;throw new Error(`Path is outside Native document and Runtime roots: ${e}`)}function M(t,e){return bt(A.resolve(t),A.resolve(e))}async function O(t,e){let i=A.resolve(t),r=A.resolve(e);if(!bt(i,r))throw new Error(`Path is outside the Native root: ${e}`);if(await Za(i))throw new Error(`Native root must not be a symbolic link: ${t}`);let[n,a]=await Promise.all([Nt(i),Nt(r)]);if(!bt(n,a))throw new Error(`Path resolves outside the Native root: ${e}`);return r}var Mr=Ar;function hv(t="docs",e="en"){return _r(t,e)}async function ye(t){let e=(await $r(t))?.config??null;return e?.native?e:null}async function $l(t){let e=await Dr(t.startPath),i=await ye(e);if(!i&&t.allowMissingConfig===!1)throw new Error(`${Hr} was not found`);if(i?.native.pending_root_move)throw new Error(`Native root move ${i.native.pending_root_move.id} is incomplete; use comet native doctor --repair`);let r=t.explicitArtifactRoot?Br(t.explicitArtifactRoot):void 0;if(i&&r&&r!==i.native.artifact_root)throw new Error(`Configured Native artifact root is ${i.native.artifact_root}; refusing conflicting root ${r}`);let n=i??hv(r??"docs"),a=await Qe(e,n.native.artifact_root);return{config:n,paths:a,configured:i!==null}}import{AsyncLocalStorage as pv}from"async_hooks";var Lb=16*1024;var Mb=new pv;import{createHash as mv}from"crypto";function ae(t){throw new TypeError(`Value is not valid canonical JSON: ${t}`)}function vv(t,e){e.has(t)&&ae("cyclic structures are not supported"),e.add(t);try{let i=Object.keys(t);for(let r=0;r<t.length;r+=1)Object.prototype.hasOwnProperty.call(t,r)||ae("sparse arrays are not supported");return(i.length!==t.length||i.some((r,n)=>r!==String(n)))&&ae("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(t).length>0&&ae("symbol properties are not supported"),`[${t.map(r=>eo(r,e)).join(",")}]`}finally{e.delete(t)}}function gv(t,e){let i=Object.getPrototypeOf(t);i!==Object.prototype&&i!==null&&ae("only plain objects are supported"),e.has(t)&&ae("cyclic structures are not supported"),Object.getOwnPropertySymbols(t).length>0&&ae("symbol properties are not supported"),e.add(t);try{let r=Object.getOwnPropertyDescriptors(t);return`{${Object.keys(t).sort().map(o=>{let s=r[o];return(!s||!("value"in s))&&ae("accessor properties are not supported"),`${JSON.stringify(o)}:${eo(s.value,e)}`}).join(",")}}`}finally{e.delete(t)}}function eo(t,e){if(t===null)return"null";switch(typeof t){case"boolean":return t?"true":"false";case"string":return JSON.stringify(t);case"number":return Number.isFinite(t)||ae("numbers must be finite"),JSON.stringify(Object.is(t,-0)?0:t);case"object":return Array.isArray(t)?vv(t,e):gv(t,e);case"bigint":case"function":case"symbol":case"undefined":return ae(`${typeof t} values are not supported`)}return ae("unsupported value type")}function to(t){return eo(t,new Set)}function U(t,e){if(t.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(t))throw new TypeError("Canonical hash tag must not contain a line break");return mv("sha256").update(`${t}
143
+ ${to(e)}`).digest("hex")}var zb=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),Ol=Object.freeze({maxCriteria:1024});var ro=Rt(vt(),1);import{promises as kv}from"node:fs";var pi="comet.native.v4";var Sv=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Ev=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,xv=/^A[1-9][0-9]*$/u,Pv=/^[a-f0-9]{64}$/u,Cv=new Set(["schema","name","language","phase","status","state_version","brief","children_contract_hash","spec_changes","workspace","loop","acceptance","builder_handoff","blockers","verification","history","history_overflow","verification_result","verification_report","archived","created_at"]);function W(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function z(t,e,i){let r=Object.keys(t).filter(n=>!e.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function L(t,e,i){if(typeof t!="string"||!i?.empty&&t.length===0)throw new Error(`${e} must be ${i?.empty?"a string":"a non-empty string"}`);return t}function io(t,e){return t===null?null:L(t,e)}function Rv(t,e){let i=L(t,e);if(!Pv.test(i))throw new Error(`${e} must be a SHA-256 hash`);return i}function kt(t,e){if(typeof t!="boolean")throw new Error(`${e} must be a boolean`);return t}function _(t,e,i=0){if(!Number.isSafeInteger(t)||t<i)throw new Error(`${e} must be a safe integer greater than or equal to ${i}`);return t}function Av(t,e){return t===null?null:_(t,e,Number.MIN_SAFE_INTEGER)}function B(t,e,i){if(typeof t!="string"||!e.includes(t))throw new Error(`${i} must be one of: ${e.join(", ")}`);return t}function he(t,e,i){if(!Array.isArray(t))throw new Error(`${e} must be an array`);return t.map((r,n)=>i(r,n))}function Fr(t,e){return he(t,e,(i,r)=>L(i,`${e}[${r}]`))}function et(t,e){if(new Set(t).size!==t.length)throw new Error(`${e} must be unique`)}function St(t,e){let i=L(t,e);if(Number.isNaN(Date.parse(i)))throw new Error(`${e} must be an ISO date or timestamp`);return i}function no(t,e,i=!1){let r=L(t,e);if(r.includes("\\")||r.startsWith("/")||/^[A-Za-z]:/u.test(r)||r.split("/").includes("..")||!i&&(r==="."||r.split("/").includes(".")))throw new Error(`${e} must be a portable relative path`);return r}function oe(t,e){let i=W(t,e);return z(i,new Set(["text","truncated"]),e),{text:L(i.text,`${e}.text`,{empty:!0}),truncated:kt(i.truncated,`${e}.truncated`)}}function _v(t,e){let i=`Native spec_changes[${e}]`,r=W(t,i);z(r,new Set(["capability","operation","source"]),i);let n=L(r.capability,`${i}.capability`);if(!Ev.test(n))throw new Error(`${i}.capability is invalid`);let a=B(r.operation,["create","modify","remove"],`${i}.operation`),o=r.source===null?null:no(r.source,`${i}.source`);if(a==="remove"&&o!==null)throw new Error(`${i} remove requires source null`);if(a!=="remove"&&o===null)throw new Error(`${i} ${a} requires a source`);return{capability:n,operation:a,source:o}}function Tv(t){let e="Native workspace",i=W(t,e);z(i,new Set(["isolation","change_branch","target_branch","finish"]),e);let r=B(i.isolation,["current","branch","worktree"],`${e}.isolation`),n=io(i.change_branch,`${e}.change_branch`),a=io(i.target_branch,`${e}.target_branch`),o=i.finish===null?null:B(i.finish,["merge","push","pull-request","keep"],`${e}.finish`);if(r==="current"&&o!==null)throw new Error("Native current workspace cannot contain a finish action");if(r==="current"&&n===null!=(a===null))throw new Error("Native workspace branch bindings must both be present or both be null");if(r!=="current"&&(n===null||a===null))throw new Error("Native isolated workspace requires change_branch and target_branch");return{isolation:r,change_branch:n,target_branch:a,finish:o}}function Iv(t){let e="Native loop",i=W(t,e);z(i,new Set(["stage","goal_cycle","iteration","attempt","retry_epoch","failed_iteration_count","no_progress_count","execution_failure_count","previous_unresolved_ids","next_action"]),e);let r=Fr(i.previous_unresolved_ids,`${e}.previous_unresolved_ids`);return et(r,`${e}.previous_unresolved_ids`),{stage:B(i.stage,["shape","building","verify-ready","repairing","archive-ready","await-user","blocked","done"],`${e}.stage`),goal_cycle:_(i.goal_cycle,`${e}.goal_cycle`,1),iteration:_(i.iteration,`${e}.iteration`),attempt:_(i.attempt,`${e}.attempt`),retry_epoch:_(i.retry_epoch,`${e}.retry_epoch`),failed_iteration_count:_(i.failed_iteration_count,`${e}.failed_iteration_count`),no_progress_count:_(i.no_progress_count,`${e}.no_progress_count`),execution_failure_count:_(i.execution_failure_count,`${e}.execution_failure_count`),previous_unresolved_ids:r,next_action:io(i.next_action,`${e}.next_action`)}}function jv(t,e){let i=`Native acceptance[${e}]`,r=W(t,i);z(r,new Set(["id","source","text","result","reason"]),i);let n=L(r.id,`${i}.id`);if(!xv.test(n))throw new Error(`${i}.id must use A1, A2, ...`);return{id:n,source:no(r.source,`${i}.source`),text:L(r.text,`${i}.text`),result:B(r.result,["pending","passed","failed","blocked"],`${i}.result`),reason:r.reason===null?null:oe(r.reason,`${i}.reason`)}}function $v(t,e){let i=`Native builder_handoff.checks[${e}]`,r=W(t,i);return z(r,new Set(["name","result","note"]),i),{name:oe(r.name,`${i}.name`),result:B(r.result,["passed","failed","not-run"],`${i}.result`),note:r.note===null?null:oe(r.note,`${i}.note`)}}function Ov(t){let e="Native builder_handoff",i=W(t,e);z(i,new Set(["candidate_id","identity_provider","builder_execution_ref","iteration","summary","addressed_acceptance_ids","checks","checks_truncated","known_limits","known_limits_truncated","submitted_at"]),e);let r=Fr(i.addressed_acceptance_ids,`${e}.addressed_acceptance_ids`);return et(r,`${e}.addressed_acceptance_ids`),{candidate_id:L(i.candidate_id,`${e}.candidate_id`),identity_provider:L(i.identity_provider,`${e}.identity_provider`),builder_execution_ref:L(i.builder_execution_ref,`${e}.builder_execution_ref`),iteration:_(i.iteration,`${e}.iteration`,1),summary:oe(i.summary,`${e}.summary`),addressed_acceptance_ids:r,checks:he(i.checks,`${e}.checks`,$v),checks_truncated:kt(i.checks_truncated,`${e}.checks_truncated`),known_limits:he(i.known_limits,`${e}.known_limits`,(n,a)=>oe(n,`${e}.known_limits[${a}]`)),known_limits_truncated:kt(i.known_limits_truncated,`${e}.known_limits_truncated`),submitted_at:St(i.submitted_at,`${e}.submitted_at`)}}function Hv(t,e){let i=`Native blockers[${e}]`,r=W(t,i);z(r,new Set(["owner","reason","acceptance_ids","resolution_action"]),i);let n=Fr(r.acceptance_ids,`${i}.acceptance_ids`);return et(n,`${i}.acceptance_ids`),{owner:B(r.owner,["builder","runtime","verifier","user","external"],`${i}.owner`),reason:oe(r.reason,`${i}.reason`),acceptance_ids:n,resolution_action:B(r.resolution_action,["return-build","retry-verifier","resolve-verifier-blocker","confirm-verifier-unavailable","await-user","wait-external"],`${i}.resolution_action`)}}function Dv(t,e){let i=`Native verification.checks[${e}]`,r=W(t,i);return z(r,new Set(["id","name","argv_display","argv_truncated","cwd_ref","status","exit_code","duration_ms"]),i),{id:L(r.id,`${i}.id`),name:oe(r.name,`${i}.name`),argv_display:he(r.argv_display,`${i}.argv_display`,(n,a)=>oe(n,`${i}.argv_display[${a}]`)),argv_truncated:kt(r.argv_truncated,`${i}.argv_truncated`),cwd_ref:no(r.cwd_ref,`${i}.cwd_ref`,!0),status:B(r.status,["passed","failed","interrupted"],`${i}.status`),exit_code:Av(r.exit_code,`${i}.exit_code`),duration_ms:_(r.duration_ms,`${i}.duration_ms`)}}function Bv(t){let e="Native verification",i=W(t,e);z(i,new Set(["candidate_id","identity_provider","verifier_execution_ref","iteration","attempt","assurance","verdict","checks","summary","risks","risks_truncated","completed_at"]),e);let r=he(i.checks,`${e}.checks`,Dv);et(r.map(a=>a.id),`${e}.checks IDs`);let n=L(i.identity_provider,`${e}.identity_provider`);return{candidate_id:L(i.candidate_id,`${e}.candidate_id`),identity_provider:n,verifier_execution_ref:L(i.verifier_execution_ref,`${e}.verifier_execution_ref`),iteration:_(i.iteration,`${e}.iteration`,1),attempt:_(i.attempt,`${e}.attempt`,1),assurance:i.assurance===void 0?n==="skill-coordinated"?"skill-coordinated":"host-attested":B(i.assurance,["host-attested","skill-coordinated","semantic-verification-unavailable","user-confirmed-degraded"],`${e}.assurance`),verdict:B(i.verdict,["pass","fail","blocked"],`${e}.verdict`),checks:r,summary:oe(i.summary,`${e}.summary`),risks:he(i.risks,`${e}.risks`,(a,o)=>oe(a,`${e}.risks[${o}]`)),risks_truncated:kt(i.risks_truncated,`${e}.risks_truncated`),completed_at:St(i.completed_at,`${e}.completed_at`)}}function Lv(t,e){let i=`Native history[${e}]`,r=W(t,i);z(r,new Set(["goal_cycle","iteration","attempt","outcome","unresolved_ids","summary","completed_at"]),i);let n=Fr(r.unresolved_ids,`${i}.unresolved_ids`);return et(n,`${i}.unresolved_ids`),{goal_cycle:_(r.goal_cycle,`${i}.goal_cycle`,1),iteration:_(r.iteration,`${i}.iteration`),attempt:_(r.attempt,`${i}.attempt`),outcome:B(r.outcome,["pass","fail","blocked","execution-error","recovery"],`${i}.outcome`),unresolved_ids:n,summary:oe(r.summary,`${i}.summary`),completed_at:St(r.completed_at,`${i}.completed_at`)}}function Mv(t){let e="Native history_overflow.outcome_counts",i=W(t,e),r=["pass","fail","blocked","execution-error","recovery"];return z(i,new Set(r),e),{pass:_(i.pass,`${e}.pass`),fail:_(i.fail,`${e}.fail`),blocked:_(i.blocked,`${e}.blocked`),"execution-error":_(i["execution-error"],`${e}.execution-error`),recovery:_(i.recovery,`${e}.recovery`)}}function Fv(t){let e="Native history_overflow",i=W(t,e);z(i,new Set(["dropped_entries","first_dropped_at","last_dropped_at","outcome_counts"]),e);let r=_(i.dropped_entries,`${e}.dropped_entries`),n=i.first_dropped_at===null?null:St(i.first_dropped_at,`${e}.first_dropped_at`),a=i.last_dropped_at===null?null:St(i.last_dropped_at,`${e}.last_dropped_at`);if(r===0&&(n!==null||a!==null))throw new Error("Native empty history overflow cannot contain dropped timestamps");if(r>0&&(n===null||a===null))throw new Error("Native non-empty history overflow requires dropped timestamps");let o=Mv(i.outcome_counts);if(Object.values(o).reduce((c,l)=>c+l,0)!==r)throw new Error("Native history overflow outcome count must equal dropped_entries");return{dropped_entries:r,first_dropped_at:n,last_dropped_at:a,outcome_counts:o}}function Vv(t){let e=new Set(t.acceptance.map(i=>i.id));for(let i of t.loop.previous_unresolved_ids)if(!e.has(i))throw new Error(`Native loop references unknown acceptance ID ${i}`);for(let i of t.builder_handoff?.addressed_acceptance_ids??[])if(!e.has(i))throw new Error(`Native builder handoff references unknown ID ${i}`);for(let i of t.blockers)for(let r of i.acceptance_ids)if(!e.has(r))throw new Error(`Native blocker references unknown ID ${r}`);if(t.builder_handoff&&!(t.builder_handoff.iteration===t.loop.iteration||t.phase==="build"&&t.loop.stage==="repairing"&&t.builder_handoff.iteration===t.loop.iteration-1))throw new Error("Native builder handoff iteration is not current or the prior repair result");if(t.verification){if(!t.builder_handoff)throw new Error("Native verification requires a builder handoff");if(t.verification.candidate_id!==t.builder_handoff.candidate_id)throw new Error("Native verification candidate must match the builder handoff");if(t.verification.identity_provider!==t.builder_handoff.identity_provider)throw new Error("Native Builder and Verifier identity providers must match");if(["skill-coordinated","semantic-verification-unavailable","user-confirmed-degraded"].includes(t.verification.assurance)!==(t.verification.identity_provider==="skill-coordinated"))throw new Error("Native verification assurance does not match its identity provider");if(t.verification.assurance==="semantic-verification-unavailable"&&t.verification.verdict!=="blocked")throw new Error("Native unavailable semantic verification must remain blocked");if(t.verification.assurance==="user-confirmed-degraded"&&t.verification.verdict!=="pass")throw new Error("Native user-confirmed degraded verification must be passing");if(t.verification.verifier_execution_ref===t.builder_handoff.builder_execution_ref)throw new Error("Native Builder and Verifier execution refs must differ");let r=t.verification.iteration===t.loop.iteration&&t.verification.attempt===t.loop.attempt,n=t.phase==="build"&&t.loop.stage==="repairing"&&t.verification.iteration===t.loop.iteration-1&&t.verification.iteration===t.builder_handoff.iteration;if(!r&&!n)throw new Error("Native verification iteration and attempt do not match a stable loop result")}}function qv(t){if(!{shape:new Set(["shape","await-user","blocked"]),build:new Set(["building","repairing","await-user","blocked"]),verify:new Set(["verify-ready","await-user","blocked"]),archive:new Set(["archive-ready","await-user","blocked","done"])}[t.phase].has(t.loop.stage))throw new Error(`Native loop stage ${t.loop.stage} is invalid for phase ${t.phase}`);let i=t.status==="await-user"?"await-user":t.status==="blocked"?"blocked":t.status==="done"?"done":null;if(i!==null&&t.loop.stage!==i)throw new Error(`Native status ${t.status} requires loop stage ${i}`);if(t.status==="active"&&["await-user","blocked","done"].includes(t.loop.stage))throw new Error(`Native active status cannot use loop stage ${t.loop.stage}`);if(t.archived!==(t.status==="done"))throw new Error("Native archived must be true exactly when status is done");if(t.archived&&t.phase!=="archive")throw new Error("Native archived state must be in Archive");if(t.verification_result==="pass"){if(t.verification?.verdict!=="pass")throw new Error("Native pass requires a persisted passing verification");if(t.acceptance.some(r=>r.result!=="passed"))throw new Error("Native pass requires every acceptance item to pass");if(t.verification.checks.some(r=>r.status!=="passed"))throw new Error("Native pass requires every persisted check to pass")}if(t.verification?.assurance==="semantic-verification-unavailable"&&(t.phase!=="verify"||t.status!=="await-user"||t.verification_result!=="blocked"||t.loop.next_action!=="confirm-verifier-unavailable"))throw new Error("Native unavailable semantic verification must await explicit user confirmation");if(t.verification_report!==null&&t.verification===null)throw new Error("Native verification report requires persisted verification")}function mi(t){let e=W(t,"Native portable state");if(z(e,Cv,"Native portable state"),e.schema!==pi)throw new Error(`Native portable state schema must be ${pi}`);let i=L(e.name,"Native state name");if(!Sv.test(i))throw new Error("Native state name is invalid");if(e.brief!=="brief.md")throw new Error("Native state brief must be brief.md");let r=he(e.spec_changes,"Native spec_changes",_v);et(r.map(s=>s.capability),"Native spec change capabilities");let n=he(e.acceptance,"Native acceptance",jv);et(n.map(s=>s.id),"Native acceptance IDs");let a=he(e.history,"Native history",Lv);if(a.length>50)throw new Error(`Native history cannot exceed ${50} entries`);let o={schema:pi,name:i,language:B(e.language,["en","zh-CN"],"Native state language"),phase:B(e.phase,["shape","build","verify","archive"],"Native state phase"),status:B(e.status,["active","await-user","blocked","done"],"Native state status"),state_version:_(e.state_version,"Native state_version",1),brief:"brief.md",...e.children_contract_hash===void 0?{}:{children_contract_hash:Rv(e.children_contract_hash,"Native children contract hash")},spec_changes:r,workspace:Tv(e.workspace),loop:Iv(e.loop),acceptance:n,builder_handoff:e.builder_handoff===null?null:Ov(e.builder_handoff),blockers:he(e.blockers,"Native blockers",Hv),verification:e.verification===null?null:Bv(e.verification),history:a,history_overflow:Fv(e.history_overflow),verification_result:B(e.verification_result,["pending","pass","fail","blocked"],"Native verification_result"),verification_report:e.verification_report===null?null:B(e.verification_report,["verification.md"],"Native verification_report"),archived:kt(e.archived,"Native archived"),created_at:St(e.created_at,"Native created_at")};return Vv(o),qv(o),o}function Wv(t,e){let i=(0,ro.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`${e} is invalid YAML: ${i.errors[0].message}`);return i.toJS({mapAsMap:!1})}async function vi(t){let e=await kv.readFile(t,"utf8");return mi(Wv(e,"Native portable state"))}var Oe="comet.native.v3",He="comet.native.v2",De="comet.native.v1";var Bl="[a-z][a-z0-9]*(?:-[a-z0-9]+)*",pk=new RegExp(`^portable-archive-(${Bl})\\.json$`,"u"),mk=new RegExp(`^portable-migration-(${Bl})\\.json$`,"u");import{TextDecoder as Qv}from"util";import{createHash as zv}from"node:crypto";import{constants as zr,promises as se}from"node:fs";import ce from"node:path";import{TextDecoder as Jv}from"node:util";function Gr(t,e){let i=ce.relative(t,e);return i===""||!ce.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ce.sep}`)}function Gv(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function Uv(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Kv(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function Jr(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function ao(t,e){let i=await se.lstat(t);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await se.realpath(t),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function Ll(t,e,i){let r=ce.resolve(t),n=ce.resolve(e);if(!Gr(r,n))throw new Error(`${i} is outside its managed root`);let a=[await ao(r,i)],o=r;for(let s of ce.relative(r,n).split(ce.sep).filter(Boolean)){await Be(a,i),o=ce.join(o,s);let c=await ao(o,i);if(!Gr(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await Be(a,i),a}async function Be(t,e){for(let i of t){let r=await se.lstat(i.path);if(!r.isDirectory()||r.isSymbolicLink()||!Uv(i,r)||await se.realpath(i.path)!==i.realPath)throw new Error(`${e} parent changed during I/O: ${i.path}`)}}async function Yv(t,e,i){let r=[],n=0,a=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let o=e+1-n,{bytesRead:s}=await t.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(n+=s,n>e)throw new Error(`${i} exceeds ${e} bytes`);r.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(r,n)}async function Et(t){let e=Gv(t.maxBytes),i=ce.resolve(t.file),r=await Ll(t.root,ce.dirname(i),t.label),n=await Promise.all((t.forbiddenRoots??[]).map(d=>ao(ce.resolve(d),t.label)));await t.hooks?.afterParentChainCaptured?.(),await Be(r,t.label);let a=await se.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(a.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let o=Kv(a),s=await se.realpath(i);if(!Gr(r[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(n.some(d=>Gr(d.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?zr.O_RDONLY:zr.O_RDONLY|zr.O_NOFOLLOW|zr.O_NONBLOCK,l=await se.open(i,c);try{let d=await l.stat();await t.hooks?.afterOpen?.();let[f,h]=await Promise.all([se.lstat(i),se.realpath(i)]);if(await Be(r,t.label),await Be(n,t.label),!d.isFile()||!f.isFile()||f.isSymbolicLink()||h!==s||!Jr(o,d)||!Jr(o,f))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let m=await Yv(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[w,u,p]=await Promise.all([l.stat(),se.lstat(i),se.realpath(i)]);if(await Be(r,t.label),await Be(n,t.label),!u.isFile()||u.isSymbolicLink()||p!==s||!Jr(o,w)||!Jr(o,u))throw new Error(`${t.label} changed while reading`);return{bytes:m,hash:zv("sha256").update(m).digest("hex"),size:m.length}}finally{await l.close()}}async function Ml(t){let e=await Et(t),i;try{i=new Jv("utf-8",{fatal:!0}).decode(e.bytes)}catch(r){throw new Error(`${t.label} is not valid UTF-8`,{cause:r})}return{...e,text:i}}async function oo(t){let e=await Ll(t.root,t.directory,t.label);return{verify:()=>Be(e,t.label)}}var Tk=256*1024,Ik=1024*1024,jk=16*1024;var $k=64*1024*1024;var Ok=new Qv("utf-8",{fatal:!0});import lo from"path";import{createHash as eg}from"crypto";function J(t){return eg("sha256").update(t).digest("hex")}var rS={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},ig=1e3,rg=8*1024*1024,ng=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,ag=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),og=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),sg=new Set(["schema","include","exclude","hash"]),cg=new Set(["provider","gitSelection","physicalSelection","projection"]),lg=new Set(["provider","selection"]),ug=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),dg=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),fg=new Set(["schema","status","before","after"]),hg=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),pg=new Set(["path","hash","size","type","gitObjectId"]),mg=new Set(["path","size","type","reason"]),vg=new Set(["ref","hash","count"]),gg=new Set(["change-created","legacy-migration","explicit"]),wg=new Set(["file","directory","other"]),yg=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"]),Kr=/^[a-f0-9]{64}$/u,Ng=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var nS=64*1024,aS=64*1024;var oS={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},sS={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function Ur(t,e){return t.hash===e.hash&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.stdoutBytes===e.stdoutBytes&&t.overflow===e.overflow}var cS=(1n<<256n)-1n;function bg(t,e){return t.hash===e.hash&&t.visitedNodeCount===e.visitedNodeCount&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.encodedBytes===e.encodedBytes&&t.overflow===e.overflow&&t.unstable===e.unstable}function kg(t){return Buffer.byteLength(JSON.stringify(t,null,2)+`
144
+ `)}function Sg(t,e){return J(`comet.native.snapshot-policy.v1
145
+ ${JSON.stringify({include:t,exclude:e,hash:"sha256"})}`)}function co(t,e,i){let r=new Set(e),n=[...e];for(;n.length>0;){if(i&&!i())return null;let a=n.pop(),o=t[a];o&&(o.kind==="star"||o.kind==="globstar"||o.kind==="globstar-slash")&&!r.has(a+1)&&(r.add(a+1),n.push(a+1))}return r}function Eg(t){let e=0;return()=>e>0?(e-=1,!0):t()?(e=63,!0):!1}function zl(t){let e=Mr(t,"Native snapshot pattern"),i=[];for(let r=0;r<e.length;r+=1){let n=e[r];n==="*"&&e[r+1]==="*"?(r+=1,e[r+1]==="/"?(r+=1,i.push({kind:"globstar-slash"})):i.push({kind:"globstar"})):n==="*"?i.push({kind:"star"}):n==="?"?i.push({kind:"question"}):i.push({kind:"literal",value:n})}return(r,n)=>{let a=n?Eg(n):void 0;if(a&&!a())return!1;let o=co(i,new Set([0]),a);if(o===null)return!1;for(let s of r){if(a&&!a())return!1;let c=new Set;for(let l of o){if(a&&!a())return!1;let d=i[l];d&&(d.kind==="literal"&&d.value===s||d.kind==="question"&&s!=="/"?c.add(l+1):d.kind==="star"&&s!=="/"||d.kind==="globstar"?c.add(l):d.kind==="globstar-slash"&&(c.add(l),s==="/"&&c.add(l+1)))}if(o=co(i,c,a),o===null||o.size===0)return!1}return co(i,o,a)?.has(i.length)??!1}}function xg(t){if(t===void 0)return;let e=[...new Set(t.include.map(n=>Mr(n,"include")))].sort((n,a)=>n.localeCompare(a,"en")),i=[...new Set(t.exclude.map(n=>Mr(n,"exclude")))].sort((n,a)=>n.localeCompare(a,"en"));if(e.length===0)throw new Error("Native snapshot policy include must not be empty");let r=Sg(e,i);if("hash"in t&&t.hash!==r)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:e,exclude:i,hash:r},includeMatchers:e.map(zl),excludeMatchers:i.map(zl),excludedDirectoryPrefixes:i.flatMap(n=>{if(!n.endsWith("/**"))return[];let a=n.slice(0,-3);return/[*?]/u.test(a)?[]:[a]}).sort((n,a)=>n.localeCompare(a,"en"))}}function Q(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function Z(t,e,i){let r=Object.keys(t).find(n=>!e.has(n));if(r)throw new Error(`${i} contains unknown field: ${r}`)}function Pt(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function pe(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function Ul(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0"))throw new Error(`${e} must be a normalized project-relative path`);let i=lo.posix.normalize(t);if(i!==t||lo.posix.isAbsolute(t)||i===".."||i.startsWith("../"))throw new Error(`${e} must stay inside the project root`);return t}function Pg(t,e){let i=Q(t,`Native snapshot entry ${e}`);Z(i,pg,`Native snapshot entry ${e}`);let r=Ul(i.path,`Native snapshot entry ${e} path`);if(typeof i.hash!="string"||!Kr.test(i.hash))throw new Error(`Native snapshot entry ${e} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${e} type is invalid`);let n={path:r,hash:i.hash,size:pe(i.size,`Native snapshot entry ${e} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!Ng.test(i.gitObjectId))throw new Error(`Native snapshot entry ${e} gitObjectId is invalid`);n.gitObjectId=i.gitObjectId}return n}function Cg(t,e){let i=Q(t,`Native snapshot omission ${e}`);if(Z(i,mg,`Native snapshot omission ${e}`),!wg.has(i.type))throw new Error(`Native snapshot omission ${e} type is invalid`);if(!yg.has(i.reason))throw new Error(`Native snapshot omission ${e} reason is invalid`);return{path:Ul(i.path,`Native snapshot omission ${e} path`),size:i.size===null?null:pe(i.size,`Native snapshot omission ${e} size`),type:i.type,reason:i.reason}}function Rg(t){let e=Q(t,"Native snapshot omission overflow");if(Z(e,vg,"Native snapshot omission overflow"),typeof e.hash!="string"||!Kr.test(e.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${e.hash}`;if(e.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:e.hash,count:Pt(e.count,"Native snapshot omission overflow count")}}function xt(t,e){let i=Q(t,e);if(Z(i,dg,e),typeof i.hash!="string"||!Kr.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${e} overflow flag is invalid`);let r=pe(i.recordCount,`${e} recordCount`),n=pe(i.storedRecordCount,`${e} storedRecordCount`),a=pe(i.stdoutBytes,`${e} stdoutBytes`);if(n>r||!i.overflow&&n!==r)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,recordCount:r,storedRecordCount:n,stdoutBytes:a,overflow:i.overflow}}function Jl(t){let e=Q(t,"Native Git selection evidence");if(Z(e,ug,"Native Git selection evidence"),e.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=xt(e.stageBefore,"Native Git selection stageBefore"),r=xt(e.combined,"Native Git selection combined"),n=xt(e.stageAfter,"Native Git selection stageAfter"),a=xt(e.finalStageBefore,"Native Git selection finalStageBefore"),o=xt(e.finalCombined,"Native Git selection finalCombined"),s=xt(e.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,r,n,a,o,s].some(f=>f.overflow),l=!Ur(i,n)||!Ur(n,a)||!Ur(r,o)||!Ur(a,s),d=c&&l?"overflow-and-changed":c?"overflow":"changed";if(!c&&!l)throw new Error("Native Git selection evidence must describe an exceptional selection");if(e.status!==d)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:d,stageBefore:i,combined:r,stageAfter:n,finalStageBefore:a,finalCombined:o,finalStageAfter:s}}function Gl(t,e){let i=Q(t,e);if(Z(i,hg,e),typeof i.hash!="string"||!Kr.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${e} flags are invalid`);let r=pe(i.visitedNodeCount,`${e} visitedNodeCount`),n=pe(i.recordCount,`${e} recordCount`),a=pe(i.storedRecordCount,`${e} storedRecordCount`),o=pe(i.encodedBytes,`${e} encodedBytes`);if(a>n||!i.overflow&&a!==n)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:r,recordCount:n,storedRecordCount:a,encodedBytes:o,overflow:i.overflow,unstable:i.unstable}}function Ag(t){let e=Q(t,"Native physical selection evidence");if(Z(e,fg,"Native physical selection evidence"),e.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=Gl(e.before,"Native physical selection before"),r=Gl(e.after,"Native physical selection after"),n=i.overflow||r.overflow,a=i.unstable||r.unstable||!bg(i,r);if(!n&&!a)throw new Error("Native physical selection evidence must describe an exceptional selection");let o=n&&a?"overflow-and-changed":n?"overflow":"changed";if(e.status!==o)throw new Error("Native physical selection evidence status is inconsistent");return{schema:"comet.native.physical-selection.v1",status:o,before:i,after:r}}function Kl(t){let e=Q(t,"Native content snapshot manifest");if(Z(e,ag,"Native content snapshot manifest"),e.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!gg.has(e.origin))throw new Error("Native content snapshot origin is invalid");let i;if(e.capture!==void 0){let v=Q(e.capture,"Native content snapshot capture");if(Z(v,cg,"Native content snapshot capture"),v.provider!=="git"&&v.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let x=v.gitSelection===void 0?void 0:Jl(v.gitSelection),k=v.physicalSelection===void 0?void 0:Ag(v.physicalSelection),C=null;if(v.projection!==void 0){let F=Q(v.projection,"Native content snapshot projection");if(Z(F,lg,"Native content snapshot projection"),F.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");C={provider:"git",...F.selection===void 0?{}:{selection:Jl(F.selection)}}}if(v.provider==="git"){if(k||C)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...x?{gitSelection:x}:{}}}else{if(x)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(k&&C)throw new Error("Native physical-tree capture cannot combine selection and projection");i=C?{provider:"physical-tree",projection:C}:{provider:"physical-tree",...k?{physicalSelection:k}:{}}}}if(typeof e.createdAt!="string"||Number.isNaN(Date.parse(e.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof e.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let r=Q(e.limits,"Native content snapshot limits");Z(r,og,"Native content snapshot limits");let n={maxFiles:Pt(r.maxFiles,"Native snapshot maxFiles"),maxFileBytes:Pt(r.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:Pt(r.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:Pt(r.maxManifestBytes,"Native snapshot maxManifestBytes"),...r.maxDurationMs===void 0?{}:{maxDurationMs:Pt(r.maxDurationMs,"Native snapshot maxDurationMs")}},a;if(e.policy!==void 0){let v=Q(e.policy,"Native snapshot policy");if(Z(v,sg,"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(e.entries)||!Array.isArray(e.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let o=e.entries.map(Pg),s=e.omitted.map(Cg),c=pe(e.omittedCount,"Native content snapshot omittedCount"),l=e.omissionOverflow===void 0?void 0:Rg(e.omissionOverflow);if(o.length>n.maxFiles)throw new Error("Native content snapshot exceeds its file-count limit");if(o.some(v=>v.size>n.maxFileBytes)||o.reduce((v,x)=>v+x.size,0)>n.maxTotalBytes)throw new Error("Native content snapshot exceeds its byte limits");if(new Set(o.map(v=>v.path)).size!==o.length)throw new Error("Native content snapshot contains duplicate paths");if(s.length>ig||c<s.length)throw new Error("Native content snapshot omission count is invalid");let d=c-s.length;if(d===0&&l||d>0&&l?.count!==d)throw new Error("Native content snapshot omission overflow is inconsistent");if(e.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let f=s.filter(v=>v.reason==="git-enumeration-limit"),h=s.filter(v=>v.reason==="git-selection-changed");for(let v of[...f,...h])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||h.length>1)throw new Error("Native Git selection omissions must not be duplicated");let m=i?.provider==="git"?i.gitSelection:i?.projection?.selection,w=m?.status==="overflow"||m?.status==="overflow-and-changed",u=m?.status==="changed"||m?.status==="overflow-and-changed";if(w!==(f.length===1))throw new Error("Native Git enumeration omission and selection evidence are inconsistent");if(u!==(h.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"),g=s.filter(v=>v.reason==="physical-selection-changed");for(let v of[...p,...g])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||g.length>1)throw new Error("Native physical selection omissions must not be duplicated");let y=i?.physicalSelection,b=y?.status==="overflow"||y?.status==="overflow-and-changed",S=y?.status==="changed"||y?.status==="overflow-and-changed";if(b!==(p.length===1))throw new Error("Native physical enumeration omission and evidence are inconsistent");if(S!==(g.length===1))throw new Error("Native physical selection-change omission and evidence are inconsistent");let E={schema:"comet.native.content-snapshot.v1",origin:e.origin,...i?{capture:i}:{},createdAt:e.createdAt,complete:e.complete,limits:n,...a?{policy:a}:{},entries:o,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(kg(E)>n.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function _g(t,e){if(!ng.test(e))throw new Error(`Invalid Native change name: ${e}`);return lo.join(X(t,e),"baseline-manifest.json")}async function Yl(t,e){let i=_g(t,e),r=fe(t,i);await O(r,i);try{let n=await Ml({root:r,file:i,maxBytes:rg,label:"Native baseline snapshot manifest"});return Kl(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}var Hg=Rt(vt(),1);var ES=4*1024*1024;var Dg=null;function Bg(t,e){let i=t;for(let r of e)i+="\0"+(typeof r=="string"?r:JSON.stringify(r));return i}function Xl(t,e){return(...i)=>{let r=Dg;if(r===null)return e(...i);let n=Bg(`async:${t}`,i),a=r.entries.get(n);if(a)return a.value;let o=e(...i).catch(s=>{throw r.entries.delete(n),s});return r.entries.set(n,{value:o}),o}}var AS=Xl("hookWritePolicy",async t=>(await Ka(t))?.hook??{allow_paths:[]});var EE=256*1024;var DE={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 QE=16*1024,ZE=process.platform;var tu=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],qg=new Set(tu),iu=new Set([...tu,"minimum_runtime_version","revision"]),Wg=new Set([...iu,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),zg=new Set(["capability","operation","source","base_hash"]),Jg=new Set(["shape","build","verify","archive"]),Gg=new Set(["implicit","confirmed"]),Ug=new Set(["pending","pass","fail"]),it="comet-state.yaml",fo=/^[a-f0-9]{64}$/u,ru=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Kg=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,ho=class extends Error{constructor(i,r){super(`Native change ${i} uses ${r}; run comet native doctor ${i} --repair before mutating it`);this.change=i;this.schema=r;this.name="NativeSchemaMigrationRequiredError"}change;schema;code="native-schema-migration-required"},Fe=class extends Error{constructor(i,r){super(i!==Oe||r===null?`Unsupported Native change schema ${i} for runtime protocol ${3}`:`Native change ${i} requires runtime protocol ${r}; current protocol is ${3}`);this.schema=i;this.minimumRuntimeVersion=r;this.name="NativeRuntimeCompatibilityError"}schema;minimumRuntimeVersion;code="native-runtime-incompatible"},Yr=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"},gi=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"},Xr=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"},Ex=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
146
+ `);function yi(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function nu(t,e,i){let r=Object.keys(t).filter(n=>!e.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function Ni(t){if(!ru.test(t))throw new Error(`Invalid Native change name: ${t}`)}function Yg(t){if(!ru.test(t))throw new Error(`Invalid Native capability id: ${t}`)}function au(t,e){if(t.length===0||tt.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native change`)}function Xg(t,e){let i=yi(t,`spec_changes[${e}]`);if(nu(i,zg,`spec_changes[${e}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(Yg(i.capability),i.operation!=="create"&&i.operation!=="replace"&&i.operation!=="remove")throw new Error(`Invalid spec operation for ${i.capability}`);let r=i.source,n=i.base_hash;if(r!==void 0&&typeof r!="string")throw new Error(`Spec source for ${i.capability} must be a string`);if(typeof r=="string"&&au(r,`Spec source for ${i.capability}`),i.operation==="create"){if(!r)throw new Error(`Create spec ${i.capability} requires source`);if(n!==null)throw new Error(`Create spec ${i.capability} requires null base_hash`)}else if(i.operation==="replace"){if(!r)throw new Error(`Replace spec ${i.capability} requires source`);if(typeof n!="string"||!fo.test(n))throw new Error(`Replace spec ${i.capability} requires a SHA-256 base_hash`)}else{if(r!==void 0)throw new Error(`Remove spec ${i.capability} forbids source`);if(typeof n!="string"||!fo.test(n))throw new Error(`Remove spec ${i.capability} requires a SHA-256 base_hash`)}return{capability:i.capability,operation:i.operation,...typeof r=="string"?{source:r}:{},base_hash:n}}function Qg(t){return/^\d{4}-\d{2}-\d{2}$/u.test(t)?new Date(`${t}T00:00:00.000Z`).toISOString().slice(0,10)===t:!1}function mo(t,e){if(nu(t,e,it),typeof t.name!="string")throw new Error("Native change name is required");if(Ni(t.name),t.language!=="en"&&t.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof t.phase!="string"||!Jg.has(t.phase))throw new Error("Native change phase is invalid");if(t.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(t.approval!==null&&!Gg.has(t.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(t.spec_changes))throw new Error("Native spec_changes must be an array");let i=t.spec_changes.map(Xg),r=i.map(n=>n.capability).filter((n,a,o)=>o.indexOf(n)!==a);if(r.length>0)throw new Error(`Duplicate Native capability operation: ${[...new Set(r)].join(", ")}`);if(typeof t.verification_result!="string"||!Ug.has(t.verification_result))throw new Error("Native verification_result is invalid");if(t.verification_report!==null&&typeof t.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof t.verification_report=="string"&&au(t.verification_report,"Native verification_report"),typeof t.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof t.created_at!="string"||!Qg(t.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(t.run_id!==null&&(typeof t.run_id!="string"||t.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:t.name,language:t.language,phase:t.phase,brief:"brief.md",approval:t.approval,spec_changes:i,verification_result:t.verification_result,verification_report:t.verification_report,archived:t.archived,created_at:t.created_at,run_id:t.run_id}}function Vr(t){let e=yi(t,it);if(e.schema!==De)throw new Error(`Expected ${De}`);return{schema:De,...mo(e,qg)}}function wi(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function uo(t,e,i){if(t===null)return null;let r=typeof t=="string"?Kg.exec(t):null;if(!r||r[1]!==i)throw new Error(`${e} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return t}function Zg(t){if(t==null)return null;if(typeof t!="string"||!fo.test(t))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return t}function ew(t){if(t===void 0)return"legacy-v1";if(t!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return t}function qr(t){let e=yi(t,it);if(e.schema!==He)throw new Error(`Expected ${He}`);if(wi(e.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${He} minimum_runtime_version must be 2`);return{schema:He,minimum_runtime_version:2,revision:wi(e.revision,"Native v2 revision"),...mo(e,iu)}}function Wr(t){let e=yi(t,it);if(e.schema!==Oe){if(e.schema===De||e.schema===He){let o=e.schema===De?Vr(e):qr(e);throw new ho(o.name,o.schema)}throw new Fe(typeof e.schema=="string"?e.schema:"(missing)",typeof e.minimum_runtime_version=="number"?e.minimum_runtime_version:null)}let i=wi(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new Fe(e.schema,i);if(i!==3)throw new Error(`Native ${e.schema} minimum_runtime_version must be ${3}`);let r=wi(e.revision,"Native revision"),n=mo(e,Wg),a=Zg(e.approved_contract_hash);if(n.approval===null&&a!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:Oe,minimum_runtime_version:3,revision:r,verification_protocol:ew(e.verification_protocol),...n,approved_contract_hash:a,implementation_scope:uo(e.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:uo(e.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:uo(e.partial_allowance,"Native partial_allowance","allowances")}}function tw(t){let e=yi(t,it);if(e.schema===De){let n=Vr(e);return{status:"migration-required",schema:n.schema,minimumRuntimeVersion:1,state:n,message:`Native change ${n.name} requires migration to ${Oe}`}}if(e.schema===He){let n=qr(e);return{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n,message:`Native change ${n.name} requires migration to ${Oe}`}}if(e.schema!==Oe){let n=typeof e.minimum_runtime_version=="number"&&Number.isSafeInteger(e.minimum_runtime_version)?e.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof e.schema=="string"?e.schema:"(missing)",minimumRuntimeVersion:n,state:null,message:new Fe(typeof e.schema=="string"?e.schema:"(missing)",n).message}}let i=wi(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:e.schema,minimumRuntimeVersion:i,state:null,message:new Fe(e.schema,i).message};let r=Wr(e);return{status:"current",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r}}function ee(t,e){Ni(e);let i=tt.join(t.changesDir,e);if(!M(t.changesDir,i))throw new Error("Native change path escaped");return i}async function vo(t,e){let i=X(t,e),r=tt.join(i,"schema-migration.json");await O(M(t.runtimeDir,r)?t.runtimeDir:t.nativeRoot,r);try{return await Vg.lstat(r),!0}catch(n){if(n.code==="ENOENT")return!1;throw n}}var iw=256*1024;async function rw(t,e=tt.dirname(t)){let i=tt.relative(e,t).split(tt.sep).join("/"),r=await D({root:e,ref:i,maxBytes:iw}),n=(0,po.parseDocument)(r.text,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid Native change file ${t}: ${n.errors[0].message}`);return n.toJS()}async function ou(t,e){let i=tt.join(ee(t,e),it);await O(t.nativeRoot,i);let r=tw(await rw(i,t.nativeRoot));if(r.state&&r.state.name!==e)throw new Error(`Native change directory/name mismatch: ${e}`);return await vo(t,e)?{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimumRuntimeVersion,state:r.state,message:`Native schema migration is incomplete for ${e}; run doctor --repair`}:(r.status==="current"&&r.state&&await nw(t,r.state),r)}async function nw(t,e){if(await Yl(t,e.name)!==null&&e.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${e.verification_protocol}`)}var bo=Rt(vt(),1);import{promises as du}from"node:fs";import te from"node:path";import{execFileSync as aw}from"node:child_process";var ow=3e4,sw=8*1024*1024,go=class extends Error{constructor(i,r,n){super(`git ${r.join(" ")} failed${n?`: ${n}`:""}`);this.cwd=i;this.args=r;this.stderr=n;this.name="GitCommandError"}cwd;args;stderr};function cw(t,e){try{return aw("git",["-C",t,...e],{encoding:"utf8",stdio:["ignore","pipe","pipe"],timeout:ow,maxBuffer:sw,windowsHide:!0})}catch(i){let r=typeof i.stderr=="string"?i.stderr.trim():Buffer.isBuffer(i.stderr)?i.stderr.toString("utf8").trim():"";throw new go(t,e,r)}}function wo(t,e){return cw(t,e).trim()}var su="children.yaml",yo="comet.native.children.v1",bi="comet.native.children.v2",lw=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,uw=new Set(["schema","children"]),dw=new Set(["schema","acceptance_index","children"]),fw=new Set(["name","depends_on","covers"]);function Zr(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function Qr(t,e,i){let r=Object.keys(t).filter(a=>!e.has(a)),n=[...e].filter(a=>!(a in t));if(r.length>0||n.length>0)throw new Error(`${i} fields are invalid`)}function cu(t,e){if(!Array.isArray(t)||!t.every(i=>typeof i=="string"))throw new Error(`${e} must be an array of strings`);return[...new Set(t)].sort((i,r)=>i.localeCompare(r,"en"))}function No(t,e){let i=te.normalize(te.resolve(t)),r=te.normalize(te.resolve(e));return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function hw(t){let e=new Map(t.map(a=>[a.name,a])),i=new Set,r=new Set,n=a=>{if(!r.has(a)){if(i.has(a))throw new Error(`Native children dependency cycle includes ${a}`);i.add(a);for(let o of e.get(a).depends_on)n(o);i.delete(a),r.add(a)}};for(let a of t)n(a.name)}function lu(t,e,i=e){let r=new Set(e);for(let o of t){let s=o.covers.filter(c=>!r.has(c));if(s.length>0)throw new Error(`Native child ${o.name} covers unknown acceptance: ${s.join(", ")}`)}let n=new Set(t.flatMap(o=>o.covers)),a=i.filter(o=>!n.has(o));if(a.length>0)throw new Error(`Native children do not cover parent acceptance: ${a.join(", ")}`)}function fu(t){let e=new Set(t.acceptance.filter(({source:i})=>i===t.brief).map(({id:i})=>i));if(t.loop.stage==="repairing"&&t.verification_result==="fail"){let i=[...t.history].reverse().find(({outcome:r})=>r==="fail");for(let r of i?.unresolved_ids??[])e.add(r)}return{acceptanceCatalog:t.acceptance,requiredAcceptanceIds:[...e]}}function pw(t){let e=Zr(t,"Native children acceptance_index"),i={};for(let[r,n]of Object.entries(e)){let a=Zr(n,`Native children acceptance_index.${r}`);if(Qr(a,new Set(["source","text"]),`Native children acceptance_index.${r}`),typeof a.source!="string"||a.source.length===0)throw new Error(`Native children acceptance_index.${r}.source must be a non-empty string`);if(typeof a.text!="string"||a.text.length===0)throw new Error(`Native children acceptance_index.${r}.text must be a non-empty string`);i[r]={source:a.source,text:a.text}}return i}function mw(t,e,i){let r=i.requiredAcceptanceIds??e??[],n=Object.keys(t),a=r.filter(c=>!(c in t)),o=n.filter(c=>!r.includes(c));if(a.length>0||o.length>0)throw new Error(`Native children acceptance_index must match the required acceptance: missing ${a.join(", ")||"none"}; extra ${o.join(", ")||"none"}`);let s=new Map((i.acceptanceCatalog??[]).map(c=>[c.id,c]));for(let c of r){let l=s.get(c);if(!l)continue;let d=t[c];if(d.source!==l.source||d.text!==l.text)throw new Error(`Native children acceptance_index.${c} does not match the acceptance catalog`)}}function vw(t,e,i={}){let r=(0,bo.parseDocument)(t,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Native children contract is invalid YAML: ${r.errors[0].message}`);let n=Zr(r.toJS({mapAsMap:!1}),"Native children contract"),a=n.schema;if(a===bi?Qr(n,dw,"Native children contract"):Qr(n,uw,"Native children contract"),a!==yo&&a!==bi)throw new Error(`Native children schema must be ${yo} or ${bi}`);if(!Array.isArray(n.children)||n.children.length===0)throw new Error("Native children must be a non-empty array");let o=n.children.map((l,d)=>{let f=Zr(l,`Native child ${d}`);if(Qr(f,fw,`Native child ${d}`),typeof f.name!="string"||!lw.test(f.name))throw new Error(`Native child ${d} name is invalid`);return{name:f.name,depends_on:cu(f.depends_on,`Native child ${f.name} depends_on`),covers:cu(f.covers,`Native child ${f.name} covers`)}}),s=o.map(({name:l})=>l);if(new Set(s).size!==s.length)throw new Error("Native child names must be unique");let c=new Set(s);for(let l of o){let d=l.depends_on.filter(f=>!c.has(f));if(d.length>0)throw new Error(`Native child ${l.name} depends on unknown child: ${d.join(", ")}`)}if(hw(o),a===bi){let l=pw(n.acceptance_index);if(mw(l,e,i),e){let d=Object.keys(l);lu(o,d,d)}return{schema:bi,acceptance_index:l,children:o}}return e&&lu(o,e),{schema:yo,children:o}}async function hu(t){let e=te.join(t.changeDir,su);try{await du.lstat(e)}catch(r){if(r.code==="ENOENT")return null;throw r}let i=await D({root:t.changeDir,ref:su});return{contract:vw(i.text,t.acceptanceIds,t.validation),size:i.size}}function pu(t){return U("comet.native.parent-contract.v1",{acceptance:t.acceptance.map(({id:e,source:i,text:r})=>({id:e,source:i,text:r})),children:t.children})}async function gw(t){let e=Sr(t.projectRoot);e.some(r=>No(r,t.projectRoot))||e.push(t.projectRoot);let i=[];for(let r of[...new Set(e.map(n=>te.resolve(n)))]){let n=await ye(r);n&&i.push({projectRoot:r,paths:await Qe(r,n.native.artifact_root),parent:No(r,t.projectRoot)})}return i.some(({parent:r})=>r)||i.push({projectRoot:t.projectRoot,paths:t,parent:!0}),i}async function ww(t,e){let i=te.join(t.paths.changesDir,e,"comet-state.yaml");try{return await vi(i)}catch(r){if(r.code==="ENOENT")return null;throw r}}async function yw(t,e){let i;try{i=await du.readdir(t.paths.archiveDir,{withFileTypes:!0})}catch(n){if(n.code==="ENOENT")return[];throw n}let r=[];for(let n of i)if(!(!n.isDirectory()||n.isSymbolicLink()||![...e].some(o=>n.name.endsWith(`-${o}`))))try{let o=te.join(t.paths.archiveDir,n.name,"comet-state.yaml"),s=await vi(o);e.has(s.name)&&r.push({file:o,state:s})}catch{}return r}function Nw(t,e,i){let r=te.relative(t.projectRoot,e);if(!r||r===".."||r.startsWith(`..${te.sep}`))return null;let n=r.split(te.sep).join("/");try{let a=(0,bo.parseDocument)(wo(t.projectRoot,["show",`${i}:${n}`]),{uniqueKeys:!0});return a.errors.length>0?null:mi(a.toJS({mapAsMap:!1}))}catch{return null}}function bw(t,e,i){return t.workspace.isolation!=="worktree"||t.workspace.target_branch!==i||t.workspace.finish!==null&&t.workspace.finish!=="merge"?{kind:"blocked",phase:t.phase,projectRoot:e.projectRoot,message:`Native child ${t.name} must use a linked worktree targeting parent branch ${i??"(missing)"}`}:t.status==="blocked"||t.status==="await-user"?{kind:"blocked",phase:t.phase,projectRoot:e.projectRoot,message:t.blockers[0]?.reason.text??`Native child ${t.name} requires user resolution`}:{kind:"active",phase:t.phase,projectRoot:e.projectRoot,message:null}}function uu(t,e){return t.status==="done"&&t.archived&&t.workspace.finish==="merge"&&t.workspace.target_branch===e}async function ko(t){let e=te.join(t.paths.changesDir,t.state.name),i=await hu({changeDir:e,validation:fu(t.state),...t.state.acceptance.length>0?{acceptanceIds:t.state.acceptance.map(({id:u})=>u)}:{}});if(!i)return t.state.children_contract_hash?{contractHash:null,confirmed:!1,parentBranch:t.state.workspace.change_branch,children:[],readyChildren:[],allDone:!1}:null;let r=pu({acceptance:t.state.acceptance,children:i.contract}),n=t.state.phase!=="shape"&&t.state.children_contract_hash===r,a=await gw(t.paths),o=t.state.workspace.change_branch,s=new Set(i.contract.children.map(({name:u})=>u)),c=new Map,l=new Map;for(let u of a){let p=u.parent&&o?`refs/heads/${o}`:"HEAD";for(let g of await yw(u,s)){let y={...g,source:u,committedState:Nw(u,g.file,p)};c.set(g.state.name,[...c.get(g.state.name)??[],y])}for(let g of s){let y=await ww(u,g);y&&l.set(g,[...l.get(g)??[],{source:u,state:y}])}}let d=new Map;for(let u of i.contract.children){let p=(c.get(u.name)??[]).find(({source:b,committedState:S})=>b.parent&&S?.name===u.name&&uu(S,o));if(p){d.set(u.name,{kind:"done",phase:p.state.phase,projectRoot:p.source.projectRoot,message:null});continue}let g=c.get(u.name)?.[0];if(g){d.set(u.name,{kind:"blocked",phase:g.state.phase,projectRoot:g.source.projectRoot,message:`Native child ${u.name} is archived but not merged into parent branch ${o??"(missing)"}`});continue}let y=l.get(u.name)??[];y.length>1?d.set(u.name,{kind:"blocked",phase:null,projectRoot:null,message:`Native child ${u.name} has multiple active workspace owners`}):y[0]&&d.set(u.name,bw(y[0].state,y[0].source,o))}let f=new Map(i.contract.children.map(u=>[u.name,u])),h=new Map,m=u=>{let p=h.get(u);if(p)return p;let g=f.get(u),b=g.depends_on.map(m).every(({status:C})=>C==="done"),S=d.get(u),E=S?.kind==="active"&&b?g.depends_on.filter(C=>!(c.get(C)??[]).some(({source:F,committedState:me})=>No(F.projectRoot,S.projectRoot)&&me?.name===C&&uu(me,o))):[],v,x=S?.message??null;S?.kind==="done"?(v=b?"done":"blocked",b||(x=`Native child ${u} was merged before its dependencies`)):S?.kind==="active"?(v=b&&E.length===0?"active":"blocked",b?E.length>0&&(x=`Native child ${u} does not include merged dependencies: ${E.join(", ")}`):x=`Native child ${u} started before its dependencies merged`):S?.kind==="blocked"?v="blocked":(v=n&&b?"ready":"pending",n||(x="Parent Shape confirmation is required"));let k={name:u,dependsOn:[...g.depends_on],covers:[...g.covers],status:v,phase:S?.phase??null,projectRoot:S?.projectRoot??null,message:x};return h.set(u,k),k},w=i.contract.children.map(({name:u})=>m(u));return{contractHash:r,confirmed:n,parentBranch:o,children:w,readyChildren:w.filter(({status:u})=>u==="ready").map(({name:u})=>u),allDone:w.every(({status:u})=>u==="done")}}var Mx={maxAcceptanceCriteria:Ol.maxCriteria};var rt={maxSpecs:64,maxFileBytes:xr,maxTotalBytes:4*1024*1024};import{promises as Eu}from"fs";import xu from"path";var kw=["Outcome","Scope","Non-goals","Acceptance examples"],Yx=[...kw,"Constraints and invariants","Decisions","Open questions","Verification expectations"];var sP={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var vu=1024*1024;var wu={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:[]},Ew=J("comet-native-runtime:v3:scope-reopen"),OP=[{skillVersion:"3",skillHash:J("comet-native-runtime:v3:semantic-repair-budget")},{skillVersion:"2",skillHash:J("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:J("comet-native-runtime:v1")}];var ku=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],pC=new Set(ku),Aw=new Set([...ku,"minimum_runtime_version","revision"]),mC=new Set([...Aw,"operation"]),vC=512*1024,_w=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),gC=new Set([..._w,"implementationScopeHash","repairScopeHash","repairStagnation","returnToBuild"]);var Pu=rt.maxSpecs*4;async function Tw(t,e){let i=xu.join(ee(t,e),"specs"),r;try{r=await oo({root:t.nativeRoot,directory:i,label:"Native proposed specs directory"})}catch(s){if(s.code==="ENOENT")return[];throw s}let n=[],a=0,o=await Eu.opendir(i);try{for await(let s of o){if(a+=1,a>Pu)throw new Error(`Native proposed specs directory exceeds ${Pu} entries`);if(s.isSymbolicLink())throw new Error(`Proposed spec capability must not be a symbolic link: ${s.name}`);if(!s.isDirectory())continue;Ni(s.name);let c=xu.join(i,s.name,"spec.md");await O(t.nativeRoot,c);let l;try{l=await Eu.lstat(c)}catch(d){if(d.code==="ENOENT")continue;throw d}if(l.isSymbolicLink()||!l.isFile())throw new Error(`Proposed spec must be a regular file: ${s.name}`);if(n.push(s.name),n.length>rt.maxSpecs)throw new Error("Native proposed specs exceed the spec-count budget")}}finally{await o.close().catch(s=>{if(s.code!=="ERR_DIR_CLOSED")throw s})}return await r.verify(),n.sort()}async function Au(t,e){let i=ee(t,e),r={},n=0;for(let a of await Tw(t,e)){let o=await D({root:i,ref:`specs/${a}/spec.md`,maxBytes:rt.maxFileBytes});if(n+=o.size,n>rt.maxTotalBytes)throw new Error("Native proposed specs exceed the total byte budget");r[a]=o.text}return r}function en(t){return["comet","native","next",t.change,"--summary","<summary>",t.flag,"--expected-state-version",String(t.stateVersion),"--expected-action",t.action]}function tn(t,e){return{name:t,flag:e,valueKind:"text",required:!0,template:null}}function Iw(t,e){return{name:t,flag:e,valueKind:"confirmation",required:!0,template:null}}function rn(t){return{name:t.name,stateVersion:t.stateVersion,expectedAction:t.expectedAction,commandArgs:en({change:t.change,stateVersion:t.stateVersion,action:t.expectedAction,flag:t.flag}),requiredInputs:["summary",t.confirmationInput],inputOptions:[tn("summary","--summary"),Iw(t.name,t.flag)]}}function Eo(t){return[rn({name:"revise-implementation",change:t.change,stateVersion:t.stateVersion,expectedAction:"revise-implementation",flag:"--revise-implementation",confirmationInput:"user-decision"}),rn({name:"revise-requirements",change:t.change,stateVersion:t.stateVersion,expectedAction:"revise-requirements",flag:"--revise-requirements",confirmationInput:"user-decision"})]}function _u(t,e){let i={schema:"comet.native.continuation.v2",skill:"comet-native",change:t.name,phase:t.phase,status:t.status,stateVersion:t.state_version,inputOptions:[]},r=n=>({kind:n,candidateId:t.builder_handoff?.candidate_id??null,iteration:t.loop.iteration,attempt:t.loop.attempt});if(t.status==="done")return{...i,disposition:"done",action:"none",commandArgs:null,requiredInputs:[],runnerAction:r("none")};if(t.status==="await-user")return t.phase==="verify"&&t.verification_result==="pass"&&t.loop.next_action==="confirm-skill-coordinated-pass"?{...i,disposition:"await-user",action:"confirm-skill-coordinated-pass",commandArgs:null,requiredInputs:["summary","user-decision"],inputOptions:[tn("summary","--summary")],commandAlternatives:[rn({name:"accept-result",change:t.name,stateVersion:t.state_version,expectedAction:"accept-result",flag:"--accept-result",confirmationInput:"user-decision"}),...Eo({change:t.name,stateVersion:t.state_version})],runnerAction:r("none")}:t.phase==="verify"&&t.verification?.assurance==="semantic-verification-unavailable"&&t.loop.next_action==="confirm-verifier-unavailable"?{...i,disposition:"await-user",action:"confirm-verifier-unavailable",commandArgs:en({change:t.name,stateVersion:t.state_version,action:"confirm-verifier-unavailable",flag:"--confirmed"}),requiredInputs:["summary","user-confirmation"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null},{name:"confirmed",flag:"--confirmed",valueKind:"confirmation",required:!0,template:null}],runnerAction:r("none")}:t.phase==="verify"&&t.loop.next_action==="resolve-verifier-blocker"?{...i,disposition:"await-user",action:"resolve-verifier-blocker",commandArgs:null,requiredInputs:["summary","user-decision"],inputOptions:[tn("summary","--summary")],commandAlternatives:[rn({name:"resolve-verifier-blocker",change:t.name,stateVersion:t.state_version,expectedAction:"resolve-verifier-blocker",flag:"--resolve-verifier-blocker",confirmationInput:"user-resolution"}),...Eo({change:t.name,stateVersion:t.state_version})],runnerAction:r("none")}:t.phase==="verify"&&t.loop.next_action==="await-user"?{...i,disposition:"await-user",action:"resolve-loop-stop",commandArgs:null,requiredInputs:["summary","user-decision"],inputOptions:[tn("summary","--summary")],commandAlternatives:Eo({change:t.name,stateVersion:t.state_version}),runnerAction:r("none")}:{...i,disposition:"await-user",action:"none",commandArgs:null,requiredInputs:["resolve-blocker"],runnerAction:r("none")};if(t.status==="blocked"){let n=t.blockers.some(({resolution_action:a})=>a==="retry-verifier");return{...i,disposition:"blocked",action:n?"retry-verifier":"none",commandArgs:n?en({change:t.name,stateVersion:t.state_version,action:"retry-verifier",flag:"--retry-verifier"}):null,requiredInputs:n?["summary"]:["repair-runtime"],inputOptions:n?[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null}]:[],runnerAction:r(n?"retry-verifier":"none")}}if(t.phase==="shape")return{...i,disposition:"continue",action:"confirm-shape",commandArgs:en({change:t.name,stateVersion:t.state_version,action:"confirm-shape",flag:"--confirmed"}),requiredInputs:["summary","shared-understanding-confirmation"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null},{name:"confirmed",flag:"--confirmed",valueKind:"confirmation",required:!0,template:null}],runnerAction:r("none")};if(t.phase==="build"){if(e){if(!e.confirmed)return{...i,disposition:"continue",action:"advance-children",commandArgs:["comet","native","next",t.name,"--summary","<summary>"],requiredInputs:["summary"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null}],runnerAction:r("none")};if(t.loop.stage==="repairing"&&t.verification_result==="fail")return{...i,disposition:"continue",action:"repair",commandArgs:null,requiredInputs:["repair-child"],inputOptions:[],runnerAction:r("none")};if(e.allDone)return{...i,disposition:"continue",action:"advance-children",commandArgs:["comet","native","next",t.name,"--summary","<summary>"],requiredInputs:["summary"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null}],runnerAction:r("none")};let n=e.children.some(({status:o})=>o==="blocked"),a=e.children.some(({status:o})=>o==="ready"||o==="active");return{...i,disposition:n&&!a?"blocked":"continue",action:"advance-children",commandArgs:null,requiredInputs:n&&!a?["resolve-child-blocker"]:["ready-children"],inputOptions:[],runnerAction:r("none")}}return{...i,disposition:"continue",action:t.loop.stage==="repairing"?"repair":"builder-handoff",commandArgs:["comet","native","next",t.name,"--runner-input","<temporary-json-file>"],requiredInputs:["builder-handoff-json-file"],inputOptions:[{name:"runner-input",flag:"--runner-input",valueKind:"json-file",required:!0,template:{kind:"builder-handoff",summary:"<summary>",addressed_acceptance_ids:["<acceptance-id>"],checks:[{name:"<check-name>",result:"not-run",note:null}],known_limits:[]}}],runnerAction:r("builder-handoff")}}if(t.phase==="verify"){let n=t.loop.next_action==="await-verifier-result";return{...i,disposition:"continue",action:n?"await-verifier":"dispatch-verifier",commandArgs:["comet","native","next",t.name,"--runner-input","<temporary-json-file>"],requiredInputs:[n?"verifier-response-or-error-json-file":"resolved-check-plan-json-file"],inputOptions:[{name:"runner-input",flag:"--runner-input",valueKind:"json-file",required:!0,template:n?[{kind:"verifier-response",response:{kind:"request-checks",iteration:t.loop.iteration,attempt:t.loop.attempt,checks:[{id:"<check-id>",name:"<check-name>",executable:"<executable>",argv:[],cwdRef:".",timeoutMs:12e4,repeatable:!0}]}},{kind:"verifier-response",response:{kind:"final-result",result:{iteration:t.loop.iteration,attempt:t.loop.attempt,verdict:"<pass|fail|blocked>",acceptance:[{id:"<acceptance-id>",result:"<passed|failed|blocked>",reason:"<reason>"}],risks:[],summary:"<summary>"}}},{kind:"verifier-execution-error",summary:"<summary>",stateVersion:t.state_version,iteration:t.loop.iteration,attempt:t.loop.attempt,verifierExecutionRef:"<from verifierDispatch>"},{kind:"verifier-unavailable",summary:"<why no independent semantic execution is available>",stateVersion:t.state_version,iteration:t.loop.iteration,attempt:t.loop.attempt,verifierExecutionRef:"<from verifierDispatch>"}]:{kind:"dispatch-verifier",checks:[]}}],runnerAction:r(n?"await-verifier":"dispatch-verifier")}}return{...i,disposition:"continue",action:"archive",commandArgs:["comet","native","archive",t.name,"--confirmed"],requiredInputs:[],runnerAction:r("none")}}import{promises as Bw}from"node:fs";import Tu from"node:path";var XC=["$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 Lw=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Mw="comet-state.yaml";function xo(t,e){if(!Lw.test(e))throw new Error(`Invalid Native change name: ${e}`);let i=Tu.join(t.changesDir,e);if(!M(t.changesDir,i))throw new Error("Native change path escaped");return i}function Iu(t,e){return Tu.join(xo(t,e),Mw)}async function Po(t,e){try{let i=await Bw.readFile(Iu(t,e),"utf8");return/^schema:\s*comet\.native\.v4\s*$/mu.test(i)}catch(i){if(i.code==="ENOENT")return!1;throw i}}async function Co(t,e){return vi(Iu(t,e))}import Si from"path";import{realpathSync as dy}from"fs";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 ju="scoped-text-safety",Vw=1,qw=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var Ww="comet.native.checker-policy.v1";var $A=U(Ww,{policy:ju,version:Vw,limits:qw,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var zw=["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"],OA=new Set(zw);var Gw=vu,QA=3*Gw;import{execFile as ty}from"node:child_process";import{promisify as iy}from"node:util";var f_=512*1024;var ki=class extends Error{recovery;constructor(e,i){super(e),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var O_=64*1024;var H_=3600*1e3;var D_=iy(ty);var nn=class extends Error{details;constructor(e){let i=e.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${e.length} receipt(s)): ${e.map(r=>`${r.ref}${r.acceptanceId?`[${r.acceptanceId}]`:""} -> ${r.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=e}};var kT={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var jT=16*1024*1024,$T=256*1024,OT=16*1024;var MT=Object.freeze({maxScopeChanges:128,maxAcceptanceEntries:64,maxUnresolvedReasons:32,maxReceipts:32});var qT=16*1024;var tI=16*1024;var zI=16*1024*1024,an=class extends Error{constructor(i,r,n,a){super(`Canonical spec conflict for ${i}: expected ${r??"(missing)"}, actual ${n??"(missing)"}`);this.capability=i;this.expectedHash=r;this.actualHash=n;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},on=class extends Error{constructor(i,r=i.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${i.findingCodes.join(", ")}`){super(r);this.preflight=i;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};var sn=class extends Error{constructor(i,r,n){super(i,n);this.preparation=r;this.name="NativeWorkspacePreparationError"}preparation};var Ou=["--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."],Ao=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:Ou,output:"Human-readable text by default; use --json for a structured command envelope.",examples:["comet native status --json","comet native status my-change --details --json","comet native next --help"]},init:{usage:"comet native init [--root <artifact-root>] [--language en|zh-CN]",purpose:"Create or normalize .comet/config.yaml and the configured Native directories.",options:["--root <artifact-root> Project-relative artifact root; defaults to docs.","--language en|zh-CN Language for newly generated Native artifacts."],output:"The resolved project configuration and Native paths.",examples:["comet native init --root docs --language zh-CN"]},root:{usage:"comet native root <show|move> [arguments]",purpose:"Inspect or transactionally move the configured Native artifact root.",subcommands:["show Print the configured artifact root and resolved paths.","move <artifact-root> Move Native artifacts and update project configuration."],output:"The current root projection or the completed move result.",examples:["comet native root show","comet native root move artifacts/native"]},"root show":{usage:"comet native root show",purpose:"Print the configured Native artifact root and resolved paths.",output:"The configured artifact root and resolved Native paths."},"root move":{usage:"comet native root move <artifact-root>",purpose:"Transactionally move Native artifacts and update project configuration.",output:"The source, destination, and committed root-move transaction result.",examples:["comet native root move artifacts/native"]},new:{usage:"comet native new <change-name> [--language en|zh-CN] [--isolation current|branch|worktree] [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]",purpose:"Create a portable Native change and prepare the requested branch or linked worktree.",options:["--language en|zh-CN Artifact language; defaults to project configuration.","--isolation <kind> current, branch, or worktree; defaults to current.","--change-branch <branch> Change branch; defaults to comet/<change-name>.","--target-branch <branch> Local base branch; defaults to the current branch.","--worktree-path <path> Worktree directory; defaults to .worktrees/<change-name>."],output:"The portable state, workspace preparation result, and continuation with the next Runner action.",examples:["comet native new session-timeout --language zh-CN","comet native new session-timeout --isolation branch --target-branch main","comet native new session-timeout --isolation worktree --target-branch main"]},spec:{usage:"comet native spec remove <change-name> <capability>",purpose:"Record a capability removal; create and modify intents use complete proposed Spec files.",subcommands:["remove <change-name> <capability> Record a capability removal."],output:"The updated portable state and continuation."},"spec remove":{usage:"comet native spec remove <change-name> <capability>",purpose:"Record removal of a capability in the complete target specification.",output:"The updated portable state and continuation with the next Runner action."},show:{usage:"comet native show <change-name>",purpose:"Read formal artifacts and portable state for one Native change.",output:"The portable state, brief, complete proposed Specs, and continuation; legacy state is reported as migration-required."},status:{usage:"comet native status [<change-name>] [--cursor <token>] [--details]",purpose:"Discover portable stable boundaries, parent child readiness, or the exact next Runner action.",options:["--cursor <token> Continue a status-list page.","--details Include acceptance, Spec, workspace, and report details."],output:"A v2 status page or one portable Loop projection with local execution availability and continuation.runnerAction; parent changes also expose children and readyChildren.",examples:["comet native status --json","comet native status session-timeout --details --json"]},select:{usage:"comet native select <change-name>",purpose:"Select one Native change after validating its workspace binding.",output:"The selected change record."},next:{usage:`comet native next <change-name> --summary <text> [--confirmed|--accept-result|--revise-implementation|--revise-requirements|--retry-verifier|--resolve-verifier-blocker]
147
+ comet native next <change-name> --runner-input <json-file>`,purpose:"Confirm or recover an Agent boundary, advance parent child changes, or use one skill-coordinated JSON bridge for Builder handoff, check-plan dispatch, and Verifier response/error.",options:["--summary <text> Required transition or recovery summary.","--confirmed Confirm Shape or an explicitly degraded verifier-unavailable fallback before Archive.","--accept-result Accept the current skill-coordinated Verify result and make it archive-ready.","--revise-implementation Keep confirmed requirements unchanged and return Verify to Build for implementation revision.","--revise-requirements Return Verify to Shape when user-visible goals or acceptance criteria must change.","--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.","--expected-state-version <n> Continuation-issued guard that rejects stale public transition decisions.","--expected-action <action> Continuation-issued guard that binds the public transition decision to its intended action.","--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 "Current result accepted" --accept-result','comet native next session-timeout --summary "Implementation needs revision" --revise-implementation','comet native next session-timeout --summary "Acceptance criteria changed" --revise-requirements','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]
148
+ 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 Ro(t,e){return`${t}:
149
149
  ${e.map(i=>` ${i}`).join(`
150
- `)}`}function Uw(t){let e=t.filter(r=>r!=="--help");if(e.length===0)return"";let i=e.slice(0,2).join(" ");return bo[i]||e.length>1&&bo[e[0]]?.subcommands?i:e[0]}function Kw(t=[]){let e=Uw(t),i=bo[e];if(!i)throw new Error(`Unknown Native help topic: ${e}`);let r=[`Usage: ${i.usage}`,"",i.purpose];i.subcommands&&r.push("",No("Commands",i.subcommands));let n=e===""?i.options:[...i.options??[],...xu];return n&&n.length>0&&r.push("",No("Options",n)),r.push("",`Output:
151
- ${i.output}`),i.examples&&r.push("",No("Examples",i.examples)),e===""&&r.push("","Run `comet native <command> --help` for command-specific details."),{topic:e,usage:`${r.join(`
150
+ `)}`}function cy(t){let e=t.filter(r=>r!=="--help");if(e.length===0)return"";let i=e.slice(0,2).join(" ");return Ao[i]||e.length>1&&Ao[e[0]]?.subcommands?i:e[0]}function ly(t=[]){let e=cy(t),i=Ao[e];if(!i)throw new Error(`Unknown Native help topic: ${e}`);let r=[`Usage: ${i.usage}`,"",i.purpose];i.subcommands&&r.push("",Ro("Commands",i.subcommands));let n=e===""?i.options:[...i.options??[],...Ou];return n&&n.length>0&&r.push("",Ro("Options",n)),r.push("",`Output:
151
+ ${i.output}`),i.examples&&r.push("",Ro("Examples",i.examples)),e===""&&r.push("","Run `comet native <command> --help` for command-specific details."),{topic:e,usage:`${r.join(`
152
152
  `)}
153
- `}}var Yw=Kw().usage;var Ru=10*1024*1024,Fe=class extends Error{};function Au(t,e){let i=t.flatMap((r,n)=>r===e?[n]:[]);if(i.length>1)throw new Fe(`${e} may only be provided once`);return i.length===0?!1:(t.splice(i[0],1),!0)}function _u(t,e){let i=t.flatMap((a,o)=>a===e?[o]:[]);if(i.length>1)throw new Fe(`${e} may only be provided once`);if(i.length===0)return;let r=i[0],n=t[r+1];if(n===void 0||n.startsWith("--"))throw new Fe(`${e} requires a value`);return t.splice(r,2),n}function Tu(t){if(t.length>0)throw new Fe(`Unexpected argument: ${t[0]}`)}function Iu(t,e){let i=t.shift();if(!i||i.startsWith("--"))throw new Fe(`${e} is required`);return i}function Cu(t,e){let i=ko.normalize(t),r=ko.normalize(e);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function Xw(t){let e=ko.resolve(t),i=vt(process.cwd());if(!i.isSecondaryWorktree||i.currentWorktreeRoot===null||i.primaryWorktreeRoot===null)return e;let r=vt(e);return!r.isGitWorktree||r.currentWorktreeRoot===null||r.primaryWorktreeRoot===null||!Cu(i.primaryWorktreeRoot,r.primaryWorktreeRoot)||Cu(i.currentWorktreeRoot,r.currentWorktreeRoot)?e:i.currentWorktreeRoot}async function ju(t){return t?Xw(t):Or(process.cwd())}async function $u(t){let e=await Pl({startPath:t,allowMissingConfig:!1});return{config:e.config,paths:e.paths}}function en(t,e,i){return{command:t,exitCode:0,data:e,text:i??JSON.stringify(e,null,2)+`
154
- `}}function Ou(t,e){if(e instanceof Fe)return{command:t,exitCode:64,error:{code:"usage",message:e.message}};if(e instanceof Xr)return{command:t,exitCode:73,data:{capability:e.capability,expectedHash:e.expectedHash,actualHash:e.actualHash,canonicalPath:e.canonicalPath},error:{code:"conflict",message:e.message}};if(e instanceof Qr)return{command:t,exitCode:73,data:e.preflight,error:{code:"conflict",message:e.message}};if(e instanceof Ur)return{command:t,exitCode:73,data:{change:e.change,expectedRevision:e.expectedRevision,actualRevision:e.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:e.message}};if(e instanceof vi)return{command:t,exitCode:73,data:{requestedIsolation:e.requestedIsolation,activeChanges:e.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:e.message}};if(e instanceof Zr)return{command:t,exitCode:73,data:{preparation:e.preparation},error:{code:"workspace-preparation-incomplete",message:e.message}};if(e instanceof Kr)return{command:t,exitCode:65,data:{change:e.change,complete:!1,omittedCount:e.omittedCount,omittedByReason:e.omittedByReason,samplePaths:e.samplePaths,sampleTruncated:e.sampleTruncated,effectiveLimits:e.effectiveLimits,policyHash:e.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:e.message}};if(e instanceof Yr)return{command:t,exitCode:65,data:{receiptBindingFailures:e.details},error:{code:"invalid-data",message:e.message}};if(e instanceof Ni)return{command:t,exitCode:65,data:e.recovery,error:{code:"implementation-scope-stale",message:e.message}};if(e instanceof Error){let i=e.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:t,exitCode:70,error:{code:"internal",message:e.message}};let r=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(e.message);return{command:t,exitCode:r?73:65,error:{code:r?"conflict":"invalid-data",message:e.message}}}return{command:t,exitCode:70,error:{code:"internal",message:String(e)}}}function Hu(t,e){return e?{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
155
- `}:t.error?{exitCode:t.exitCode,stderr:t.error.message}:{exitCode:t.exitCode,stdout:t.text}}async function Du(t,e){let i=Iu(t,"change name");Tu(t);let{paths:r}=await $u(e);if(await wo(r,i)){let d=await yo(r,i),f=go(r,i),h=await D({root:f,ref:d.brief,maxBytes:null,includeHash:!1}),m=[];for(let u of d.spec_changes){if(u.source===null)continue;let p=await D({root:f,ref:u.source,maxBytes:null,includeHash:!1});m.push({capability:u.capability,operation:u.operation,source:u.source,content:p.text})}let w={state:d,brief:h.text,proposedSpecs:m,continuation:bu(d,await mo({paths:r,state:d}))};return en("show",w)}let n=await Xl(r,i);if(n.status==="migration-required")return en("show",{name:i,schema:n.schema,minimumRuntimeVersion:n.minimumRuntimeVersion,migrationRequired:!0,message:n.message});if(n.status!=="current"||!n.state)throw new Me(n.schema,n.minimumRuntimeVersion);let a=n.state,o=ee(r,i),s=await Nu(r,i),c=await D({root:o,ref:a.brief,maxBytes:it.maxFileBytes}),l={state:a,brief:c.text,proposedSpecs:s};if(Buffer.byteLength(JSON.stringify(l),"utf8")>Ru)throw new Error("Native show output exceeds its serialized byte budget");return en("show",l)}function Qw(t){return{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
156
- `}}async function Bu(t,e,i=process.argv.slice(2)){let r=i.indexOf("--"),n=r<0?[...i]:i.slice(0,r),a=r<0?[]:i.slice(r),o=n.includes("--json"),s,c;try{Au(n,"--json"),s=_u(n,"--project-root");let d=[...n,...a],f=await ju(s);c=await e(d,f)}catch(d){c=Ou(t,d)}let l=o?Qw(c):Hu(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
153
+ `}}var uy=ly().usage;var Du=10*1024*1024,Ve=class extends Error{};function Bu(t,e){let i=t.flatMap((r,n)=>r===e?[n]:[]);if(i.length>1)throw new Ve(`${e} may only be provided once`);return i.length===0?!1:(t.splice(i[0],1),!0)}function Lu(t,e){let i=t.flatMap((a,o)=>a===e?[o]:[]);if(i.length>1)throw new Ve(`${e} may only be provided once`);if(i.length===0)return;let r=i[0],n=t[r+1];if(n===void 0||n.startsWith("--"))throw new Ve(`${e} requires a value`);return t.splice(r,2),n}function Mu(t){if(t.length>0)throw new Ve(`Unexpected argument: ${t[0]}`)}function Fu(t,e){let i=t.shift();if(!i||i.startsWith("--"))throw new Ve(`${e} is required`);return i}function _o(t,e){let i=Si.normalize(Hu(t)),r=Si.normalize(Hu(e));return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function Hu(t){let e=Si.resolve(t);try{return dy.native(e)}catch{return e}}function fy(t){let e=Si.resolve(t),i=gt(process.cwd());if(!i.isSecondaryWorktree||i.currentWorktreeRoot===null||i.primaryWorktreeRoot===null)return e;let r=gt(e);return!r.isGitWorktree||r.currentWorktreeRoot===null||r.primaryWorktreeRoot===null||!_o(i.primaryWorktreeRoot,r.primaryWorktreeRoot)||_o(i.currentWorktreeRoot,r.currentWorktreeRoot)?e:_o(process.cwd(),i.currentWorktreeRoot)?Si.resolve(process.cwd()):i.currentWorktreeRoot}async function Vu(t){return t?fy(t):Dr(process.cwd())}async function qu(t){let e=await $l({startPath:t,allowMissingConfig:!1});return{config:e.config,paths:e.paths}}function cn(t,e,i){return{command:t,exitCode:0,data:e,text:i??JSON.stringify(e,null,2)+`
154
+ `}}function Wu(t,e){if(e instanceof Ve)return{command:t,exitCode:64,error:{code:"usage",message:e.message}};if(e instanceof an)return{command:t,exitCode:73,data:{capability:e.capability,expectedHash:e.expectedHash,actualHash:e.actualHash,canonicalPath:e.canonicalPath},error:{code:"conflict",message:e.message}};if(e instanceof on)return{command:t,exitCode:73,data:e.preflight,error:{code:"conflict",message:e.message}};if(e instanceof Yr)return{command:t,exitCode:73,data:{change:e.change,expectedRevision:e.expectedRevision,actualRevision:e.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:e.message}};if(e instanceof gi)return{command:t,exitCode:73,data:{requestedIsolation:e.requestedIsolation,activeChanges:e.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:e.message}};if(e instanceof sn)return{command:t,exitCode:73,data:{preparation:e.preparation},error:{code:"workspace-preparation-incomplete",message:e.message}};if(e instanceof Xr)return{command:t,exitCode:65,data:{change:e.change,complete:!1,omittedCount:e.omittedCount,omittedByReason:e.omittedByReason,samplePaths:e.samplePaths,sampleTruncated:e.sampleTruncated,effectiveLimits:e.effectiveLimits,policyHash:e.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:e.message}};if(e instanceof nn)return{command:t,exitCode:65,data:{receiptBindingFailures:e.details},error:{code:"invalid-data",message:e.message}};if(e instanceof ki)return{command:t,exitCode:65,data:e.recovery,error:{code:"implementation-scope-stale",message:e.message}};if(e instanceof Error){let i=e.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:t,exitCode:70,error:{code:"internal",message:e.message}};let r=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(e.message);return{command:t,exitCode:r?73:65,error:{code:r?"conflict":"invalid-data",message:e.message}}}return{command:t,exitCode:70,error:{code:"internal",message:String(e)}}}function zu(t,e){return e?{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
155
+ `}:t.error?{exitCode:t.exitCode,stderr:t.error.message}:{exitCode:t.exitCode,stdout:t.text}}async function Ju(t,e){let i=Fu(t,"change name");Mu(t);let{paths:r}=await qu(e);if(await Po(r,i)){let d=await Co(r,i),f=xo(r,i),h=await D({root:f,ref:d.brief,maxBytes:null,includeHash:!1}),m=[];for(let u of d.spec_changes){if(u.source===null)continue;let p=await D({root:f,ref:u.source,maxBytes:null,includeHash:!1});m.push({capability:u.capability,operation:u.operation,source:u.source,content:p.text})}let w={state:d,brief:h.text,proposedSpecs:m,continuation:_u(d,await ko({paths:r,state:d}))};return cn("show",w)}let n=await ou(r,i);if(n.status==="migration-required")return cn("show",{name:i,schema:n.schema,minimumRuntimeVersion:n.minimumRuntimeVersion,migrationRequired:!0,message:n.message});if(n.status!=="current"||!n.state)throw new Fe(n.schema,n.minimumRuntimeVersion);let a=n.state,o=ee(r,i),s=await Au(r,i),c=await D({root:o,ref:a.brief,maxBytes:rt.maxFileBytes}),l={state:a,brief:c.text,proposedSpecs:s};if(Buffer.byteLength(JSON.stringify(l),"utf8")>Du)throw new Error("Native show output exceeds its serialized byte budget");return cn("show",l)}function hy(t){return{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
156
+ `}}async function Gu(t,e,i=process.argv.slice(2)){let r=i.indexOf("--"),n=r<0?[...i]:i.slice(0,r),a=r<0?[]:i.slice(r),o=n.includes("--json"),s,c;try{Bu(n,"--json"),s=Lu(n,"--project-root");let d=[...n,...a],f=await Vu(s);c=await e(d,f)}catch(d){c=Wu(t,d)}let l=o?hy(c):zu(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
157
157
  `)?"":`
158
- `)),l.exitCode}process.exitCode=await Bu("show",Du);
158
+ `)),l.exitCode}process.exitCode=await Gu("show",Ju);