@rpamis/comet 0.4.0-rc.1 → 0.4.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/README.md +4 -651
  2. package/assets/manifest.json +1 -1
  3. package/assets/skills/comet/scripts/comet-archive.mjs +80 -80
  4. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +1 -1
  5. package/assets/skills/comet/scripts/comet-guard.mjs +102 -102
  6. package/assets/skills/comet/scripts/comet-handoff.mjs +82 -82
  7. package/assets/skills/comet/scripts/comet-hook-guard.mjs +69 -70
  8. package/assets/skills/comet/scripts/comet-hook-router.mjs +120 -121
  9. package/assets/skills/comet/scripts/comet-intent.mjs +6 -6
  10. package/assets/skills/comet/scripts/comet-resume-probe.mjs +48 -48
  11. package/assets/skills/comet/scripts/comet-runtime.mjs +174 -175
  12. package/assets/skills/comet/scripts/comet-state.mjs +105 -105
  13. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +17 -17
  14. package/assets/skills/comet-native/SKILL.md +6 -5
  15. package/assets/skills/comet-native/reference/commands.md +7 -6
  16. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +124 -118
  17. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +131 -125
  18. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +97 -90
  19. package/assets/skills/comet-native/scripts/comet-native-init.mjs +121 -115
  20. package/assets/skills/comet-native/scripts/comet-native-new.mjs +113 -107
  21. package/assets/skills/comet-native/scripts/comet-native-next.mjs +134 -128
  22. package/assets/skills/comet-native/scripts/comet-native-root.mjs +101 -95
  23. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +166 -159
  24. package/assets/skills/comet-native/scripts/comet-native-select.mjs +114 -108
  25. package/assets/skills/comet-native/scripts/comet-native-show.mjs +98 -92
  26. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +107 -101
  27. package/assets/skills/comet-native/scripts/comet-native-status.mjs +111 -105
  28. package/assets/skills-zh/comet-native/SKILL.md +6 -5
  29. package/assets/skills-zh/comet-native/reference/commands.md +7 -6
  30. package/dist/app/commands/bundle.d.ts.map +1 -1
  31. package/dist/app/commands/bundle.js.map +1 -1
  32. package/dist/app/commands/dashboard.d.ts +1 -1
  33. package/dist/app/commands/dashboard.js +1 -1
  34. package/dist/app/commands/doctor.d.ts.map +1 -1
  35. package/dist/app/commands/doctor.js +1 -1
  36. package/dist/app/commands/doctor.js.map +1 -1
  37. package/dist/app/commands/init.js +2 -2
  38. package/dist/app/commands/init.js.map +1 -1
  39. package/dist/app/commands/platform-select-prompt.d.ts.map +1 -1
  40. package/dist/app/commands/platform-select-prompt.js +1 -0
  41. package/dist/app/commands/platform-select-prompt.js.map +1 -1
  42. package/dist/app/commands/status.d.ts.map +1 -1
  43. package/dist/app/commands/status.js +49 -9
  44. package/dist/app/commands/status.js.map +1 -1
  45. package/dist/app/commands/update.d.ts.map +1 -1
  46. package/dist/app/commands/update.js +13 -49
  47. package/dist/app/commands/update.js.map +1 -1
  48. package/dist/domains/agent-learning/policy-compiler.d.ts.map +1 -1
  49. package/dist/domains/agent-learning/policy-compiler.js.map +1 -1
  50. package/dist/domains/agent-learning/types.d.ts.map +1 -1
  51. package/dist/domains/agent-learning/types.js.map +1 -1
  52. package/dist/domains/bundle/authoring.d.ts.map +1 -1
  53. package/dist/domains/bundle/authoring.js.map +1 -1
  54. package/dist/domains/bundle/next-action.d.ts.map +1 -1
  55. package/dist/domains/bundle/next-action.js.map +1 -1
  56. package/dist/domains/bundle/readiness-user-summary.d.ts.map +1 -1
  57. package/dist/domains/bundle/readiness-user-summary.js.map +1 -1
  58. package/dist/domains/bundle/types.d.ts.map +1 -1
  59. package/dist/domains/comet-classic/classic-archive.d.ts.map +1 -1
  60. package/dist/domains/comet-classic/classic-archive.js +15 -0
  61. package/dist/domains/comet-classic/classic-archive.js.map +1 -1
  62. package/dist/domains/comet-classic/classic-cli.d.ts +8 -0
  63. package/dist/domains/comet-classic/classic-cli.d.ts.map +1 -1
  64. package/dist/domains/comet-classic/classic-cli.js +10 -0
  65. package/dist/domains/comet-classic/classic-cli.js.map +1 -1
  66. package/dist/domains/comet-classic/classic-guard.d.ts.map +1 -1
  67. package/dist/domains/comet-classic/classic-guard.js +20 -0
  68. package/dist/domains/comet-classic/classic-guard.js.map +1 -1
  69. package/dist/domains/comet-classic/classic-handoff.d.ts.map +1 -1
  70. package/dist/domains/comet-classic/classic-handoff.js +13 -0
  71. package/dist/domains/comet-classic/classic-handoff.js.map +1 -1
  72. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  73. package/dist/domains/comet-classic/classic-hook-guard.js +14 -15
  74. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  75. package/dist/domains/comet-classic/classic-layout-initialization.d.ts.map +1 -1
  76. package/dist/domains/comet-classic/classic-layout-initialization.js.map +1 -1
  77. package/dist/domains/comet-classic/classic-output-language.d.ts +73 -0
  78. package/dist/domains/comet-classic/classic-output-language.d.ts.map +1 -0
  79. package/dist/domains/comet-classic/classic-output-language.js +175 -0
  80. package/dist/domains/comet-classic/classic-output-language.js.map +1 -0
  81. package/dist/domains/comet-classic/classic-script-entry.d.ts.map +1 -1
  82. package/dist/domains/comet-classic/classic-script-entry.js +10 -0
  83. package/dist/domains/comet-classic/classic-script-entry.js.map +1 -1
  84. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  85. package/dist/domains/comet-classic/classic-state-command.js +43 -4
  86. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  87. package/dist/domains/comet-entry/current-selection.d.ts.map +1 -1
  88. package/dist/domains/comet-entry/current-selection.js.map +1 -1
  89. package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
  90. package/dist/domains/comet-entry/init-workflow.js.map +1 -1
  91. package/dist/domains/comet-entry/project-status.d.ts.map +1 -1
  92. package/dist/domains/comet-entry/project-status.js +15 -3
  93. package/dist/domains/comet-entry/project-status.js.map +1 -1
  94. package/dist/domains/comet-entry/types.d.ts +5 -1
  95. package/dist/domains/comet-entry/types.d.ts.map +1 -1
  96. package/dist/domains/comet-memory/personal-memory.d.ts.map +1 -1
  97. package/dist/domains/comet-memory/personal-memory.js.map +1 -1
  98. package/dist/domains/comet-memory/types.d.ts.map +1 -1
  99. package/dist/domains/comet-memory/types.js.map +1 -1
  100. package/dist/domains/comet-native/native-atomic-file.d.ts +1 -0
  101. package/dist/domains/comet-native/native-atomic-file.d.ts.map +1 -1
  102. package/dist/domains/comet-native/native-atomic-file.js +19 -0
  103. package/dist/domains/comet-native/native-atomic-file.js.map +1 -1
  104. package/dist/domains/comet-native/native-children.d.ts +17 -0
  105. package/dist/domains/comet-native/native-children.d.ts.map +1 -1
  106. package/dist/domains/comet-native/native-children.js +86 -9
  107. package/dist/domains/comet-native/native-children.js.map +1 -1
  108. package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -1
  109. package/dist/domains/comet-native/native-cli-help.js +3 -2
  110. package/dist/domains/comet-native/native-cli-help.js.map +1 -1
  111. package/dist/domains/comet-native/native-cli-shared.d.ts +7 -1
  112. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  113. package/dist/domains/comet-native/native-cli-shared.js +51 -4
  114. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  115. package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
  116. package/dist/domains/comet-native/native-cli.js +4 -2
  117. package/dist/domains/comet-native/native-cli.js.map +1 -1
  118. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  119. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  120. package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
  121. package/dist/domains/comet-native/native-lock.js +10 -1
  122. package/dist/domains/comet-native/native-lock.js.map +1 -1
  123. package/dist/domains/comet-native/native-loop-runtime.d.ts +4 -1
  124. package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -1
  125. package/dist/domains/comet-native/native-loop-runtime.js +39 -6
  126. package/dist/domains/comet-native/native-loop-runtime.js.map +1 -1
  127. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
  128. package/dist/domains/comet-native/native-next-command.js +36 -2
  129. package/dist/domains/comet-native/native-next-command.js.map +1 -1
  130. package/dist/domains/comet-native/native-output-language.d.ts +69 -0
  131. package/dist/domains/comet-native/native-output-language.d.ts.map +1 -0
  132. package/dist/domains/comet-native/native-output-language.js +369 -0
  133. package/dist/domains/comet-native/native-output-language.js.map +1 -0
  134. package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -1
  135. package/dist/domains/comet-native/native-portable-archive.js +17 -1
  136. package/dist/domains/comet-native/native-portable-archive.js.map +1 -1
  137. package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -1
  138. package/dist/domains/comet-native/native-portable-continuation.js +70 -27
  139. package/dist/domains/comet-native/native-portable-continuation.js.map +1 -1
  140. package/dist/domains/comet-native/native-portable-migration.d.ts.map +1 -1
  141. package/dist/domains/comet-native/native-portable-migration.js.map +1 -1
  142. package/dist/domains/comet-native/native-portable-recovery.d.ts +1 -0
  143. package/dist/domains/comet-native/native-portable-recovery.d.ts.map +1 -1
  144. package/dist/domains/comet-native/native-portable-recovery.js +2 -2
  145. package/dist/domains/comet-native/native-portable-recovery.js.map +1 -1
  146. package/dist/domains/comet-native/native-portable-runtime.d.ts +22 -0
  147. package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -1
  148. package/dist/domains/comet-native/native-portable-runtime.js +114 -4
  149. package/dist/domains/comet-native/native-portable-runtime.js.map +1 -1
  150. package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -1
  151. package/dist/domains/comet-native/native-portable-state.js +5 -0
  152. package/dist/domains/comet-native/native-portable-state.js.map +1 -1
  153. package/dist/domains/comet-native/native-portable-types.d.ts +3 -0
  154. package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -1
  155. package/dist/domains/comet-native/native-portable-types.js.map +1 -1
  156. package/dist/domains/comet-native/native-runner-input.d.ts +30 -28
  157. package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -1
  158. package/dist/domains/comet-native/native-runner-input.js +19 -27
  159. package/dist/domains/comet-native/native-runner-input.js.map +1 -1
  160. package/dist/domains/comet-native/native-schema-migration.d.ts.map +1 -1
  161. package/dist/domains/comet-native/native-schema-migration.js.map +1 -1
  162. package/dist/domains/comet-native/native-script-entry.d.ts +5 -4
  163. package/dist/domains/comet-native/native-script-entry.d.ts.map +1 -1
  164. package/dist/domains/comet-native/native-script-entry.js +8 -16
  165. package/dist/domains/comet-native/native-script-entry.js.map +1 -1
  166. package/dist/domains/comet-native/native-status-discovery.d.ts +31 -1
  167. package/dist/domains/comet-native/native-status-discovery.d.ts.map +1 -1
  168. package/dist/domains/comet-native/native-status-discovery.js +46 -8
  169. package/dist/domains/comet-native/native-status-discovery.js.map +1 -1
  170. package/dist/domains/comet-native/native-supervisor.d.ts +11 -1
  171. package/dist/domains/comet-native/native-supervisor.d.ts.map +1 -1
  172. package/dist/domains/comet-native/native-supervisor.js +61 -0
  173. package/dist/domains/comet-native/native-supervisor.js.map +1 -1
  174. package/dist/domains/comet-native/native-types.d.ts.map +1 -1
  175. package/dist/domains/comet-native/native-verification-receipt.d.ts.map +1 -1
  176. package/dist/domains/comet-native/native-verification-receipt.js.map +1 -1
  177. package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
  178. package/dist/domains/comet-native/native-workspace.js.map +1 -1
  179. package/dist/domains/comet-plugin/integration.d.ts +2 -0
  180. package/dist/domains/comet-plugin/integration.d.ts.map +1 -1
  181. package/dist/domains/comet-plugin/integration.js +10 -6
  182. package/dist/domains/comet-plugin/integration.js.map +1 -1
  183. package/dist/domains/dashboard/collector.js +1 -1
  184. package/dist/domains/dashboard/default-plugin-host.d.ts +3 -0
  185. package/dist/domains/dashboard/default-plugin-host.d.ts.map +1 -1
  186. package/dist/domains/dashboard/default-plugin-host.js +38 -4
  187. package/dist/domains/dashboard/default-plugin-host.js.map +1 -1
  188. package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
  189. package/dist/domains/dashboard/native-adapter.js.map +1 -1
  190. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  191. package/dist/domains/dashboard/native-collector.js +2 -0
  192. package/dist/domains/dashboard/native-collector.js.map +1 -1
  193. package/dist/domains/dashboard/web/assets/abnfDiagram-VCTEODGH-UcCx24DV.js +1 -0
  194. package/dist/domains/dashboard/web/assets/arc-n8qsRq7W.js +1 -0
  195. package/dist/domains/dashboard/web/assets/architecture-7GRP2DOG-B5p4GzJf.js +1 -0
  196. package/dist/domains/dashboard/web/assets/architectureDiagram-5GKGNRK7-D4pJ8CU0.js +36 -0
  197. package/dist/domains/dashboard/web/assets/array-BifhSqXX.js +1 -0
  198. package/dist/domains/dashboard/web/assets/blockDiagram-I7D4REHJ-C7n-qrSQ.js +129 -0
  199. package/dist/domains/dashboard/web/assets/browser-CgwPGwaV.js +107 -0
  200. package/dist/domains/dashboard/web/assets/c4Diagram-7LVT6UL2-cMVrWYOm.js +38 -0
  201. package/dist/domains/dashboard/web/assets/channel-BZeSeXVb.js +1 -0
  202. package/dist/domains/dashboard/web/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  203. package/dist/domains/dashboard/web/assets/chunk-4HAMMTFA-CE5QrCQd.js +62 -0
  204. package/dist/domains/dashboard/web/assets/{chunk-5VM5RSS4-CopXcnFA.js → chunk-5VM5RSS4-ZNzvKenW.js} +2 -2
  205. package/dist/domains/dashboard/web/assets/chunk-75Z2AOVW-BtZqN-pM.js +2 -0
  206. package/dist/domains/dashboard/web/assets/chunk-DU6HZSFF-CChv0huc.js +125 -0
  207. package/dist/domains/dashboard/web/assets/chunk-F27PBJKO-CDT1ttJ8.js +1 -0
  208. package/dist/domains/dashboard/web/assets/chunk-FOHPRMQF-DHwB1DNv.js +161 -0
  209. package/dist/domains/dashboard/web/assets/chunk-GMAD6QVW-y5m6LMR7.js +72 -0
  210. package/dist/domains/dashboard/web/assets/chunk-GVQU2GXP-DkhKkaHd.js +1 -0
  211. package/dist/domains/dashboard/web/assets/chunk-IMKFNOWR-BaDSh7Jp.js +231 -0
  212. package/dist/domains/dashboard/web/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  213. package/dist/domains/dashboard/web/assets/chunk-L3NEJ4N5-B4ztH2fV.js +1 -0
  214. package/dist/domains/dashboard/web/assets/chunk-OSK3NFVY-BhX6NVzA.js +10 -0
  215. package/dist/domains/dashboard/web/assets/chunk-P2QGCYS3-BCNdGJkX.js +1 -0
  216. package/dist/domains/dashboard/web/assets/chunk-POPQ4Y6H-DwYVuiXw.js +1 -0
  217. package/dist/domains/dashboard/web/assets/chunk-PWAF6VOD-Cyg0IO0R.js +1 -0
  218. package/dist/domains/dashboard/web/assets/chunk-SHT3W25Y-BZ6skx8I.js +168 -0
  219. package/dist/domains/dashboard/web/assets/chunk-SVP7TREG-CLIGmSO0.js +88 -0
  220. package/dist/domains/dashboard/web/assets/chunk-TICWLB2K-BAQBbsn9.js +206 -0
  221. package/dist/domains/dashboard/web/assets/chunk-XXDRQBXY-D07UbEpV.js +1 -0
  222. package/dist/domains/dashboard/web/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  223. package/dist/domains/dashboard/web/assets/classDiagram-ZZMXUADV-2fcinal6.js +1 -0
  224. package/dist/domains/dashboard/web/assets/classDiagram-v2-VYDZK3BY-2fcinal6.js +1 -0
  225. package/dist/domains/dashboard/web/assets/cose-bilkent-JH36ORCC-wIi0mUih.js +1 -0
  226. package/dist/domains/dashboard/web/assets/cynefin-OW5HDTMX-DBdxyuTN.js +1 -0
  227. package/dist/domains/dashboard/web/assets/cynefinDiagram-5FMLGOSQ-DzO3jXxV.js +62 -0
  228. package/dist/domains/dashboard/web/assets/cytoscape.esm-CGd-uY3x.js +321 -0
  229. package/dist/domains/dashboard/web/assets/dagre-GXQ25YYZ-CE7H_hZS.js +4 -0
  230. package/dist/domains/dashboard/web/assets/dagre-PrKaheQc.js +1 -0
  231. package/dist/domains/dashboard/web/assets/defaultLocale-BFoDCU3G.js +1 -0
  232. package/dist/domains/dashboard/web/assets/demo-DrJ2uuUL.js +456 -0
  233. package/dist/domains/dashboard/web/assets/diagram-S7CK7UJ4-jUGQk5n-.js +30 -0
  234. package/dist/domains/dashboard/web/assets/diagram-UQ7AKVKN-DaH_zW8T.js +41 -0
  235. package/dist/domains/dashboard/web/assets/diagram-VSXAHHWV-DmG80db0.js +3 -0
  236. package/dist/domains/dashboard/web/assets/diagram-VX7I27RA-ltQ6niKn.js +24 -0
  237. package/dist/domains/dashboard/web/assets/diagram-Z3DM3KII-x92ex4lK.js +24 -0
  238. package/dist/domains/dashboard/web/assets/dist-Cf0h0n6i.js +1 -0
  239. package/dist/domains/dashboard/web/assets/ebnfDiagram-PWID7BFC-CI2u976k.js +1 -0
  240. package/dist/domains/dashboard/web/assets/erDiagram-RLTQ6QDP-DKs90SRd.js +99 -0
  241. package/dist/domains/dashboard/web/assets/es-D7xGlyQk.js +10 -0
  242. package/dist/domains/dashboard/web/assets/eventmodeling-NTZA5JFV-uARcGZPD.js +1 -0
  243. package/dist/domains/dashboard/web/assets/flowDiagram-HODETNUW-DXL1E4Bl.js +1 -0
  244. package/dist/domains/dashboard/web/assets/ganttDiagram-EL5Y4UJY-D3z6G60S.js +292 -0
  245. package/dist/domains/dashboard/web/assets/gitGraph-4MIJSDKK-vT1UnORT.js +1 -0
  246. package/dist/domains/dashboard/web/assets/gitGraphDiagram-WWUBYQGX-BJmJ96jv.js +106 -0
  247. package/dist/domains/dashboard/web/assets/graphlib-DS17s2tU.js +1 -0
  248. package/dist/domains/dashboard/web/assets/index-BG3MF8re.js +261 -0
  249. package/dist/domains/dashboard/web/assets/index-C2Hlo7VZ.css +1 -0
  250. package/dist/domains/dashboard/web/assets/info-A6RAGUB7-DFeLqqen.js +1 -0
  251. package/dist/domains/dashboard/web/assets/infoDiagram-27XIBGKW-DxuY43XD.js +2 -0
  252. package/dist/domains/dashboard/web/assets/init-C-OQMol4.js +1 -0
  253. package/dist/domains/dashboard/web/assets/ishikawaDiagram-5VMMS53U-DxillfWQ.js +70 -0
  254. package/dist/domains/dashboard/web/assets/journeyDiagram-3NMN7TZE-BPngQ3ag.js +139 -0
  255. package/dist/domains/dashboard/web/assets/kanban-definition-UXKFOSKX-DHMLEGD4.js +89 -0
  256. package/dist/domains/dashboard/web/assets/katex-CXMH3UgJ.js +257 -0
  257. package/dist/domains/dashboard/web/assets/line-D31peBjo.js +1 -0
  258. package/dist/domains/dashboard/web/assets/linear-B7X50T2m.js +1 -0
  259. package/dist/domains/dashboard/web/assets/marked.esm-BtJme7Pf.js +65 -0
  260. package/dist/domains/dashboard/web/assets/mermaid-parser.core-CX3Pzygh.js +7 -0
  261. package/dist/domains/dashboard/web/assets/mermaid.core-DlMjBFb6.js +44 -0
  262. package/dist/domains/dashboard/web/assets/mindmap-definition-YA3MSWOX-BKuSGF75.js +96 -0
  263. package/dist/domains/dashboard/web/assets/ordinal-BDEzSJ7C.js +1 -0
  264. package/dist/domains/dashboard/web/assets/packet-AYTQ26CC-B1T8Bds9.js +1 -0
  265. package/dist/domains/dashboard/web/assets/path-fybaL0A-.js +1 -0
  266. package/dist/domains/dashboard/web/assets/pegDiagram-XKGWAZYB-BYgTNxLw.js +1 -0
  267. package/dist/domains/dashboard/web/assets/pie-WAS4IAKB-fqAjmoQw.js +1 -0
  268. package/dist/domains/dashboard/web/assets/pieDiagram-E7YTZNPT-BAO0Ufky.js +39 -0
  269. package/dist/domains/dashboard/web/assets/purify.es-ChwZkWde.js +3 -0
  270. package/dist/domains/dashboard/web/assets/quadrantDiagram-AXDQQJYC-SA_1-7DT.js +7 -0
  271. package/dist/domains/dashboard/web/assets/radar-RG4KPBEZ-Bl_UfUle.js +1 -0
  272. package/dist/domains/dashboard/web/assets/railroad-74A4TZTK-yj6dkiSy.js +1 -0
  273. package/dist/domains/dashboard/web/assets/railroad-abnf-HS5TGJTU-CvouMciM.js +1 -0
  274. package/dist/domains/dashboard/web/assets/railroad-ebnf-LZEXJU2U-CkYQEX72.js +1 -0
  275. package/dist/domains/dashboard/web/assets/railroad-peg-WCYAUIDC-B0uYr48F.js +1 -0
  276. package/dist/domains/dashboard/web/assets/railroadDiagram-O6MQD6OU-DqV18Y46.js +1 -0
  277. package/dist/domains/dashboard/web/assets/requirementDiagram-BXWQKSXE-Ca2K5LuT.js +84 -0
  278. package/dist/domains/dashboard/web/assets/rough.esm-Dy-Kn_BL.js +1 -0
  279. package/dist/domains/dashboard/web/assets/sankeyDiagram-P5KCCOFB-D9MKl-Nr.js +40 -0
  280. package/dist/domains/dashboard/web/assets/sequenceDiagram-WJ2MYXX4-CXfvIzRx.js +162 -0
  281. package/dist/domains/dashboard/web/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
  282. package/dist/domains/dashboard/web/assets/src-CquUPIQx.js +1 -0
  283. package/dist/domains/dashboard/web/assets/stateDiagram-D77RDMKH-B7iaZHW7.js +1 -0
  284. package/dist/domains/dashboard/web/assets/stateDiagram-v2-MP3YSRHH-B6KoHQVe.js +1 -0
  285. package/dist/domains/dashboard/web/assets/swimlanes-42K2YHIH-OK-62yZl.js +1 -0
  286. package/dist/domains/dashboard/web/assets/swimlanesDiagram-VR7AAH4N-CjdOls9K.js +8 -0
  287. package/dist/domains/dashboard/web/assets/timeline-definition-24CTP7MA-D0l01B1h.js +120 -0
  288. package/dist/domains/dashboard/web/assets/treeView-Q6P3EWNA-Bg5u_o3A.js +1 -0
  289. package/dist/domains/dashboard/web/assets/treemap-WGGIJYW6-x89ccozk.js +1 -0
  290. package/dist/domains/dashboard/web/assets/vennDiagram-4TSXK5OY-DV19Cqhv.js +34 -0
  291. package/dist/domains/dashboard/web/assets/wardley-WFR3VGLG-BWoeoVk5.js +1 -0
  292. package/dist/domains/dashboard/web/assets/wardleyDiagram-VM6X3IG4-D4fCpoIP.js +78 -0
  293. package/dist/domains/dashboard/web/assets/xychartDiagram-S5SC5T6Z-DALnOMLb.js +7 -0
  294. package/dist/domains/dashboard/web/index.html +2 -2
  295. package/dist/domains/factory/artifacts.d.ts.map +1 -1
  296. package/dist/domains/factory/artifacts.js.map +1 -1
  297. package/dist/domains/factory/types.d.ts.map +1 -1
  298. package/dist/domains/integrations/codegraph.d.ts.map +1 -1
  299. package/dist/domains/integrations/codegraph.js.map +1 -1
  300. package/dist/domains/project-knowledge/local-store.d.ts +21 -0
  301. package/dist/domains/project-knowledge/local-store.d.ts.map +1 -1
  302. package/dist/domains/project-knowledge/local-store.js +97 -0
  303. package/dist/domains/project-knowledge/local-store.js.map +1 -1
  304. package/dist/domains/project-knowledge/types.d.ts.map +1 -1
  305. package/dist/domains/skill/platform-inspect.d.ts +1 -1
  306. package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
  307. package/dist/domains/skill/platform-inspect.js +50 -10
  308. package/dist/domains/skill/platform-inspect.js.map +1 -1
  309. package/dist/domains/skill/platform-install.d.ts +10 -5
  310. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  311. package/dist/domains/skill/platform-install.js +107 -17
  312. package/dist/domains/skill/platform-install.js.map +1 -1
  313. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  314. package/dist/domains/skill/uninstall.js +38 -61
  315. package/dist/domains/skill/uninstall.js.map +1 -1
  316. package/dist/domains/workflow-contract/contained-atomic-write.d.ts +1 -0
  317. package/dist/domains/workflow-contract/contained-atomic-write.d.ts.map +1 -1
  318. package/dist/domains/workflow-contract/contained-atomic-write.js +19 -0
  319. package/dist/domains/workflow-contract/contained-atomic-write.js.map +1 -1
  320. package/dist/domains/workflow-contract/global-config.d.ts +8 -0
  321. package/dist/domains/workflow-contract/global-config.d.ts.map +1 -1
  322. package/dist/domains/workflow-contract/global-config.js +25 -0
  323. package/dist/domains/workflow-contract/global-config.js.map +1 -1
  324. package/dist/domains/workflow-contract/index.d.ts +1 -1
  325. package/dist/domains/workflow-contract/index.d.ts.map +1 -1
  326. package/dist/domains/workflow-contract/index.js +1 -1
  327. package/dist/domains/workflow-contract/index.js.map +1 -1
  328. package/dist/domains/workflow-contract/output-envelope.d.ts +59 -0
  329. package/dist/domains/workflow-contract/output-envelope.d.ts.map +1 -0
  330. package/dist/domains/workflow-contract/output-envelope.js +108 -0
  331. package/dist/domains/workflow-contract/output-envelope.js.map +1 -0
  332. package/dist/domains/workflow-contract/project-config.d.ts +1 -1
  333. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  334. package/dist/domains/workflow-contract/project-config.js +1 -0
  335. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  336. package/dist/domains/workflow-contract/types.d.ts.map +1 -1
  337. package/dist/platform/install/platforms.d.ts +4 -0
  338. package/dist/platform/install/platforms.d.ts.map +1 -1
  339. package/dist/platform/install/platforms.js +15 -3
  340. package/dist/platform/install/platforms.js.map +1 -1
  341. package/dist/platform/paths/project-knowledge-storage.d.ts +1 -1
  342. package/dist/platform/paths/project-knowledge-storage.d.ts.map +1 -1
  343. package/dist/platform/paths/project-knowledge-storage.js +9 -4
  344. package/dist/platform/paths/project-knowledge-storage.js.map +1 -1
  345. package/dist/platform/version/version.d.ts +8 -0
  346. package/dist/platform/version/version.d.ts.map +1 -1
  347. package/dist/platform/version/version.js +58 -8
  348. package/dist/platform/version/version.js.map +1 -1
  349. package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +13 -13
  350. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/instruction.md +2 -0
  351. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/task.toml +1 -0
  352. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/validation/test_native_wave_d_stagnation_stop.py +37 -0
  353. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +13 -13
  354. package/package.json +24 -24
  355. package/dist/domains/dashboard/web/assets/abnfDiagram-N423BO3Z-BkUJc7LK.js +0 -1
  356. package/dist/domains/dashboard/web/assets/arc-DY4Y9tSO.js +0 -1
  357. package/dist/domains/dashboard/web/assets/architectureDiagram-T3A2C74G-7wC9YZS-.js +0 -36
  358. package/dist/domains/dashboard/web/assets/blockDiagram-VBNYF7ZC-Biqe-SaL.js +0 -132
  359. package/dist/domains/dashboard/web/assets/c4Diagram-5PPSVZJV-CccUFD1S.js +0 -10
  360. package/dist/domains/dashboard/web/assets/channel-DnRvSkOm.js +0 -1
  361. package/dist/domains/dashboard/web/assets/chunk-2GRJ4B5K-BUL4dDxo.js +0 -1
  362. package/dist/domains/dashboard/web/assets/chunk-2Q5K7J3B-BnKtDH9O.js +0 -1
  363. package/dist/domains/dashboard/web/assets/chunk-5RXB4S5H-C9pHQ1n3.js +0 -231
  364. package/dist/domains/dashboard/web/assets/chunk-6Q2QTUOP-CxrbngCi.js +0 -88
  365. package/dist/domains/dashboard/web/assets/chunk-GF5L2VYU-01mzgCUh.js +0 -206
  366. package/dist/domains/dashboard/web/assets/chunk-JWPE2WC7-wTiZVDvw.js +0 -1
  367. package/dist/domains/dashboard/web/assets/chunk-KBJHAD2P-Bxdv5bl-.js +0 -1
  368. package/dist/domains/dashboard/web/assets/chunk-RYQCIY6F-B5vF9l9A.js +0 -1
  369. package/dist/domains/dashboard/web/assets/chunk-XXDRQBXY-Dra3NnDp.js +0 -1
  370. package/dist/domains/dashboard/web/assets/classDiagram-JCYQIIEL-D3E-rgaQ.js +0 -1
  371. package/dist/domains/dashboard/web/assets/classDiagram-v2-OCEON4UE-D3E-rgaQ.js +0 -1
  372. package/dist/domains/dashboard/web/assets/cose-bilkent-JH36ORCC-DC96ge-n.js +0 -1
  373. package/dist/domains/dashboard/web/assets/cynefin-VYW2F7L2-Tt_NiopT.js +0 -166
  374. package/dist/domains/dashboard/web/assets/cynefinDiagram-MW4NZA55-BQ5__1hv.js +0 -62
  375. package/dist/domains/dashboard/web/assets/cytoscape.esm-D3_iZ_3b.js +0 -321
  376. package/dist/domains/dashboard/web/assets/dagre-VZM6K2ZE-Cr2zq3ro.js +0 -4
  377. package/dist/domains/dashboard/web/assets/defaultLocale-DX6XiGOO.js +0 -1
  378. package/dist/domains/dashboard/web/assets/demo-lxXhgJ9-.js +0 -456
  379. package/dist/domains/dashboard/web/assets/diagram-7IWD3JNH-BRpYDwPl.js +0 -30
  380. package/dist/domains/dashboard/web/assets/diagram-B4RE2ZJO-D7u-VBxW.js +0 -3
  381. package/dist/domains/dashboard/web/assets/diagram-LBJQPF4R-CHYuv2JD.js +0 -24
  382. package/dist/domains/dashboard/web/assets/diagram-Q27KOJAE-CV3ZE8Q3.js +0 -24
  383. package/dist/domains/dashboard/web/assets/diagram-UB23O5K3-co_OsTiQ.js +0 -41
  384. package/dist/domains/dashboard/web/assets/ebnfDiagram-BXEA7PRR-CETcWswS.js +0 -1
  385. package/dist/domains/dashboard/web/assets/erDiagram-JOGREHBK-edkItb7Z.js +0 -85
  386. package/dist/domains/dashboard/web/assets/flowDiagram-UKHOOZJN-D_oFJtSf.js +0 -156
  387. package/dist/domains/dashboard/web/assets/ganttDiagram-PKOTCBZU-CFjLVoA1.js +0 -292
  388. package/dist/domains/dashboard/web/assets/gitGraphDiagram-DS77QQ5N-BfD0tiKH.js +0 -106
  389. package/dist/domains/dashboard/web/assets/graph-DOmOIIwC.js +0 -1
  390. package/dist/domains/dashboard/web/assets/index-BzyqCfMb.css +0 -1
  391. package/dist/domains/dashboard/web/assets/index-CCKHH_A9.js +0 -10
  392. package/dist/domains/dashboard/web/assets/index-D8dxsTJY.js +0 -271
  393. package/dist/domains/dashboard/web/assets/index-DlSYK56b.js +0 -139
  394. package/dist/domains/dashboard/web/assets/infoDiagram-6WML65LV-Cx6xa9DS.js +0 -2
  395. package/dist/domains/dashboard/web/assets/init-Gi6I4Gst.js +0 -1
  396. package/dist/domains/dashboard/web/assets/ishikawaDiagram-WSZJBQD7-BjNLyyv_.js +0 -70
  397. package/dist/domains/dashboard/web/assets/journeyDiagram-NVQOT4AX-D2n9vrhx.js +0 -139
  398. package/dist/domains/dashboard/web/assets/kanban-definition-27J2QSJJ-kJL7v018.js +0 -89
  399. package/dist/domains/dashboard/web/assets/katex-HP8lGamR.js +0 -257
  400. package/dist/domains/dashboard/web/assets/layout-D-LzfAck.js +0 -1
  401. package/dist/domains/dashboard/web/assets/linear-CeHtd5-l.js +0 -1
  402. package/dist/domains/dashboard/web/assets/map-DxJ2ADlA.js +0 -1
  403. package/dist/domains/dashboard/web/assets/marked.esm-DECB3bxB.js +0 -64
  404. package/dist/domains/dashboard/web/assets/mermaid.core-B0EPSHs2.js +0 -306
  405. package/dist/domains/dashboard/web/assets/mindmap-definition-FAOFIHXS-bQQWINF4.js +0 -96
  406. package/dist/domains/dashboard/web/assets/ordinal-Cboi1Yqb.js +0 -1
  407. package/dist/domains/dashboard/web/assets/pegDiagram-VL7TDLO6-LxLY1W7W.js +0 -1
  408. package/dist/domains/dashboard/web/assets/pieDiagram-7S7Q4E2Y-BMDQqvuT.js +0 -39
  409. package/dist/domains/dashboard/web/assets/purify.es-Cz4mVeUR.js +0 -3
  410. package/dist/domains/dashboard/web/assets/quadrantDiagram-CIZ2JOQS-XWYjcuZN.js +0 -7
  411. package/dist/domains/dashboard/web/assets/railroadDiagram-AXF67PYL-p-OlQTa7.js +0 -1
  412. package/dist/domains/dashboard/web/assets/requirementDiagram-LRYGKXZP-BL4N8Vsl.js +0 -84
  413. package/dist/domains/dashboard/web/assets/sankeyDiagram-W5VNT64P-Btu-o6LN.js +0 -40
  414. package/dist/domains/dashboard/web/assets/sequenceDiagram-SI44F4Z6-9HpdQQ47.js +0 -162
  415. package/dist/domains/dashboard/web/assets/sizeCapture-X5ZJPWSS-5AnBiBHD.js +0 -1
  416. package/dist/domains/dashboard/web/assets/stateDiagram-OKZ733FA-Dv8IDsai.js +0 -1
  417. package/dist/domains/dashboard/web/assets/stateDiagram-v2-UEYNNEHI-DxOMyFOm.js +0 -1
  418. package/dist/domains/dashboard/web/assets/swimlanes-SLNWSIFB-BfJcN7dK.js +0 -2
  419. package/dist/domains/dashboard/web/assets/swimlanesDiagram-ULZ7WXOC-BnHRSbDk.js +0 -8
  420. package/dist/domains/dashboard/web/assets/timeline-definition-Z64GVDOM-DEOuEHi5.js +0 -120
  421. package/dist/domains/dashboard/web/assets/vennDiagram-T6HMQDX7-BqsGpwgo.js +0 -34
  422. package/dist/domains/dashboard/web/assets/wardleyDiagram-T6FBY63Y-CXlOp9so.js +0 -78
  423. package/dist/domains/dashboard/web/assets/xychartDiagram-ELKLHX3M-DyqqtC9X.js +0 -7
@@ -1,77 +1,77 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var cd=Object.create;var Oo=Object.defineProperty;var ld=Object.getOwnPropertyDescriptor;var ud=Object.getOwnPropertyNames;var dd=Object.getPrototypeOf,fd=Object.prototype.hasOwnProperty;var Ir=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var g=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var hd=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ud(t))!fd.call(e,n)&&n!==r&&Oo(e,n,{get:()=>t[n],enumerable:!(i=ld(t,n))||i.enumerable});return e};var Pt=(e,t,r)=>(r=e!=null?cd(dd(e)):{},hd(t||!e||!e.__esModule?Oo(r,"default",{value:e,enumerable:!0}):r,e));var P=g(B=>{"use strict";var dn=Symbol.for("yaml.alias"),Ho=Symbol.for("yaml.document"),jr=Symbol.for("yaml.map"),Do=Symbol.for("yaml.pair"),fn=Symbol.for("yaml.scalar"),$r=Symbol.for("yaml.seq"),ye=Symbol.for("yaml.node.type"),pd=e=>!!e&&typeof e=="object"&&e[ye]===dn,md=e=>!!e&&typeof e=="object"&&e[ye]===Ho,vd=e=>!!e&&typeof e=="object"&&e[ye]===jr,gd=e=>!!e&&typeof e=="object"&&e[ye]===Do,Bo=e=>!!e&&typeof e=="object"&&e[ye]===fn,wd=e=>!!e&&typeof e=="object"&&e[ye]===$r;function Lo(e){if(e&&typeof e=="object")switch(e[ye]){case jr:case $r:return!0}return!1}function yd(e){if(e&&typeof e=="object")switch(e[ye]){case dn:case jr:case fn:case $r:return!0}return!1}var Nd=e=>(Bo(e)||Lo(e))&&!!e.anchor;B.ALIAS=dn;B.DOC=Ho;B.MAP=jr;B.NODE_TYPE=ye;B.PAIR=Do;B.SCALAR=fn;B.SEQ=$r;B.hasAnchor=Nd;B.isAlias=pd;B.isCollection=Lo;B.isDocument=md;B.isMap=vd;B.isNode=yd;B.isPair=gd;B.isScalar=Bo;B.isSeq=wd});var Ct=g(hn=>{"use strict";var D=P(),q=Symbol("break visit"),Mo=Symbol("skip children"),ue=Symbol("remove node");function Or(e,t){let r=Fo(t);D.isDocument(e)?rt(null,e.contents,r,Object.freeze([e]))===ue&&(e.contents=null):rt(null,e,r,Object.freeze([]))}Or.BREAK=q;Or.SKIP=Mo;Or.REMOVE=ue;function rt(e,t,r,i){let n=Vo(e,t,r,i);if(D.isNode(n)||D.isPair(n))return qo(e,i,n),rt(e,n,r,i);if(typeof n!="symbol"){if(D.isCollection(t)){i=Object.freeze(i.concat(t));for(let a=0;a<t.items.length;++a){let o=rt(a,t.items[a],r,i);if(typeof o=="number")a=o-1;else{if(o===q)return q;o===ue&&(t.items.splice(a,1),a-=1)}}}else if(D.isPair(t)){i=Object.freeze(i.concat(t));let a=rt("key",t.key,r,i);if(a===q)return q;a===ue&&(t.key=null);let o=rt("value",t.value,r,i);if(o===q)return q;o===ue&&(t.value=null)}}return n}async function Hr(e,t){let r=Fo(t);D.isDocument(e)?await it(null,e.contents,r,Object.freeze([e]))===ue&&(e.contents=null):await it(null,e,r,Object.freeze([]))}Hr.BREAK=q;Hr.SKIP=Mo;Hr.REMOVE=ue;async function it(e,t,r,i){let n=await Vo(e,t,r,i);if(D.isNode(n)||D.isPair(n))return qo(e,i,n),it(e,n,r,i);if(typeof n!="symbol"){if(D.isCollection(t)){i=Object.freeze(i.concat(t));for(let a=0;a<t.items.length;++a){let o=await it(a,t.items[a],r,i);if(typeof o=="number")a=o-1;else{if(o===q)return q;o===ue&&(t.items.splice(a,1),a-=1)}}}else if(D.isPair(t)){i=Object.freeze(i.concat(t));let a=await it("key",t.key,r,i);if(a===q)return q;a===ue&&(t.key=null);let o=await it("value",t.value,r,i);if(o===q)return q;o===ue&&(t.value=null)}}return n}function Fo(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Vo(e,t,r,i){if(typeof r=="function")return r(e,t,i);if(D.isMap(t))return r.Map?.(e,t,i);if(D.isSeq(t))return r.Seq?.(e,t,i);if(D.isPair(t))return r.Pair?.(e,t,i);if(D.isScalar(t))return r.Scalar?.(e,t,i);if(D.isAlias(t))return r.Alias?.(e,t,i)}function qo(e,t,r){let i=t[t.length-1];if(D.isCollection(i))i.items[e]=r;else if(D.isPair(i))e==="key"?i.key=r:i.value=r;else if(D.isDocument(i))i.contents=r;else{let n=D.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}hn.visit=Or;hn.visitAsync=Hr});var pn=g(zo=>{"use strict";var Wo=P(),bd=Ct(),kd={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Sd=e=>e.replace(/[!,[\]{}]/g,t=>kd[t]),xt=class e{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,r)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let i=t.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[a,o]=i;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[a]=i;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return r(6,`Unsupported YAML version ${a}`,o),!1}}default:return r(0,`Unknown directive ${n}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,i,n]=t.match(/^(.*!)([^!]*)$/s);n||r(`The ${t} tag has no suffix`);let a=this.tags[i];if(a)try{return a+decodeURIComponent(n)}catch(o){return r(String(o)),null}return i==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[r,i]of Object.entries(this.tags))if(t.startsWith(i))return r+Sd(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(t&&i.length>0&&Wo.isNode(t.contents)){let a={};bd.visit(t.contents,(o,s)=>{Wo.isNode(s)&&s.tag&&(a[s.tag]=!0)}),n=Object.keys(a)}else n=[];for(let[a,o]of i)a==="!!"&&o==="tag:yaml.org,2002:"||(!t||n.some(s=>s.startsWith(o)))&&r.push(`%TAG ${a} ${o}`);return r.join(`
5
- `)}};xt.defaultYaml={explicit:!1,version:"1.2"};xt.defaultTags={"!!":"tag:yaml.org,2002:"};zo.Directives=xt});var Dr=g(Rt=>{"use strict";var Jo=P(),Ed=Ct();function Pd(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(r)}return!0}function Go(e){let t=new Set;return Ed.visit(e,{Value(r,i){i.anchor&&t.add(i.anchor)}}),t}function Uo(e,t){for(let r=1;;++r){let i=`${e}${r}`;if(!t.has(i))return i}}function Cd(e,t){let r=[],i=new Map,n=null;return{onAnchor:a=>{r.push(a),n??(n=Go(e));let o=Uo(t,n);return n.add(o),o},setAnchors:()=>{for(let a of r){let o=i.get(a);if(typeof o=="object"&&o.anchor&&(Jo.isScalar(o.node)||Jo.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:i}}Rt.anchorIsValid=Pd;Rt.anchorNames=Go;Rt.createNodeAnchors=Cd;Rt.findNewAnchor=Uo});var mn=g(Ko=>{"use strict";function At(e,t,r,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,a=i.length;n<a;++n){let o=i[n],s=At(e,i,String(n),o);s===void 0?delete i[n]:s!==o&&(i[n]=s)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let a=i.get(n),o=At(e,i,n,a);o===void 0?i.delete(n):o!==a&&i.set(n,o)}else if(i instanceof Set)for(let n of Array.from(i)){let a=At(e,i,n,n);a===void 0?i.delete(n):a!==n&&(i.delete(n),i.add(a))}else for(let[n,a]of Object.entries(i)){let o=At(e,i,n,a);o===void 0?delete i[n]:o!==a&&(i[n]=o)}return e.call(t,r,i)}Ko.applyReviver=At});var Pe=g(Xo=>{"use strict";var xd=P();function Yo(e,t,r){if(Array.isArray(e))return e.map((i,n)=>Yo(i,String(n),r));if(e&&typeof e.toJSON=="function"){if(!r||!xd.hasAnchor(e))return e.toJSON(t,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=a=>{i.res=a,delete r.onCreate};let n=e.toJSON(t,r);return r.onCreate&&r.onCreate(n),n}return typeof e=="bigint"&&!r?.keep?Number(e):e}Xo.toJS=Yo});var Br=g(Zo=>{"use strict";var Rd=mn(),Qo=P(),Ad=Pe(),vn=class{constructor(t){Object.defineProperty(this,Qo.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:r,maxAliasCount:i,onAnchor:n,reviver:a}={}){if(!Qo.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},s=Ad.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:l}of o.anchors.values())n(l,c);return typeof a=="function"?Rd.applyReviver(a,{"":s},"",s):s}};Zo.NodeBase=vn});var _t=g(es=>{"use strict";var _d=Dr(),Td=Ct(),nt=P(),Id=Br(),jd=Pe(),gn=class extends Id.NodeBase{constructor(t){super(nt.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;r?.aliasResolveCache?i=r.aliasResolveCache:(i=[],Td.visit(t,{Node:(a,o)=>{(nt.isAlias(o)||nt.hasAnchor(o))&&i.push(o)}}),r&&(r.aliasResolveCache=i));let n;for(let a of i){if(a===this)break;a.anchor===this.source&&(n=a)}return n}toJSON(t,r){if(!r)return{source:this.source};let{anchors:i,doc:n,maxAliasCount:a}=r,o=this.resolve(n,r);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=i.get(o);if(s||(jd.toJS(o,null,r),s=i.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=Lr(n,o,i)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(t,r,i){let n=`*${this.source}`;if(t){if(_d.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${n} `}return n}};function Lr(e,t,r){if(nt.isAlias(t)){let i=t.resolve(e),n=r&&i&&r.get(i);return n?n.count*n.aliasCount:0}else if(nt.isCollection(t)){let i=0;for(let n of t.items){let a=Lr(e,n,r);a>i&&(i=a)}return i}else if(nt.isPair(t)){let i=Lr(e,t.key,r),n=Lr(e,t.value,r);return Math.max(i,n)}return 1}es.Alias=gn});var j=g(wn=>{"use strict";var $d=P(),Od=Br(),Hd=Pe(),Dd=e=>!e||typeof e!="function"&&typeof e!="object",Ce=class extends Od.NodeBase{constructor(t){super($d.SCALAR),this.value=t}toJSON(t,r){return r?.keep?this.value:Hd.toJS(this.value,t,r)}toString(){return String(this.value)}};Ce.BLOCK_FOLDED="BLOCK_FOLDED";Ce.BLOCK_LITERAL="BLOCK_LITERAL";Ce.PLAIN="PLAIN";Ce.QUOTE_DOUBLE="QUOTE_DOUBLE";Ce.QUOTE_SINGLE="QUOTE_SINGLE";wn.Scalar=Ce;wn.isScalarValue=Dd});var Tt=g(rs=>{"use strict";var Bd=_t(),qe=P(),ts=j(),Ld="tag:yaml.org,2002:";function Md(e,t,r){if(t){let i=r.filter(a=>a.tag===t),n=i.find(a=>!a.format)??i[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return r.find(i=>i.identify?.(e)&&!i.format)}function Fd(e,t,r){if(qe.isDocument(e)&&(e=e.contents),qe.isNode(e))return e;if(qe.isPair(e)){let d=r.schema[qe.MAP].createNode?.(r.schema,null,r);return d.items.push(e),d}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:a,schema:o,sourceObjects:s}=r,c;if(i&&e&&typeof e=="object"){if(c=s.get(e),c)return c.anchor??(c.anchor=n(e)),new Bd.Alias(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith("!!")&&(t=Ld+t.slice(2));let l=Md(e,t,o.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let d=new ts.Scalar(e);return c&&(c.node=d),d}l=e instanceof Map?o[qe.MAP]:Symbol.iterator in Object(e)?o[qe.SEQ]:o[qe.MAP]}a&&(a(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,e,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,e,r):new ts.Scalar(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}rs.createNode=Fd});var Fr=g(Mr=>{"use strict";var Vd=Tt(),de=P(),qd=Br();function yn(e,t,r){let i=r;for(let n=t.length-1;n>=0;--n){let a=t[n];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=i,i=o}else i=new Map([[a,i]])}return Vd.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var is=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Nn=class extends qd.NodeBase{constructor(t,r){super(t),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(t){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(r.schema=t),r.items=r.items.map(i=>de.isNode(i)||de.isPair(i)?i.clone(t):i),this.range&&(r.range=this.range.slice()),r}addIn(t,r){if(is(t))this.add(r);else{let[i,...n]=t,a=this.get(i,!0);if(de.isCollection(a))a.addIn(n,r);else if(a===void 0&&this.schema)this.set(i,yn(this.schema,n,r));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(t){let[r,...i]=t;if(i.length===0)return this.delete(r);let n=this.get(r,!0);if(de.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}getIn(t,r){let[i,...n]=t,a=this.get(i,!0);return n.length===0?!r&&de.isScalar(a)?a.value:a:de.isCollection(a)?a.getIn(n,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!de.isPair(r))return!1;let i=r.value;return i==null||t&&de.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){let[r,...i]=t;if(i.length===0)return this.has(r);let n=this.get(r,!0);return de.isCollection(n)?n.hasIn(i):!1}setIn(t,r){let[i,...n]=t;if(n.length===0)this.set(i,r);else{let a=this.get(i,!0);if(de.isCollection(a))a.setIn(n,r);else if(a===void 0&&this.schema)this.set(i,yn(this.schema,n,r));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};Mr.Collection=Nn;Mr.collectionFromPath=yn;Mr.isEmptyPath=is});var It=g(Vr=>{"use strict";var Wd=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function bn(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var zd=(e,t,r)=>e.endsWith(`
6
- `)?bn(r,t):r.includes(`
4
+ var Sd=Object.create;var Fo=Object.defineProperty;var Ed=Object.getOwnPropertyDescriptor;var Cd=Object.getOwnPropertyNames;var Pd=Object.getPrototypeOf,xd=Object.prototype.hasOwnProperty;var $r=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var g=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Rd=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Cd(t))!xd.call(e,n)&&n!==r&&Fo(e,n,{get:()=>t[n],enumerable:!(i=Ed(t,n))||i.enumerable});return e};var Rt=(e,t,r)=>(r=e!=null?Sd(Pd(e)):{},Rd(t||!e||!e.__esModule?Fo(r,"default",{value:e,enumerable:!0}):r,e));var P=g(M=>{"use strict";var vn=Symbol.for("yaml.alias"),Vo=Symbol.for("yaml.document"),Or=Symbol.for("yaml.map"),qo=Symbol.for("yaml.pair"),gn=Symbol.for("yaml.scalar"),Hr=Symbol.for("yaml.seq"),Ne=Symbol.for("yaml.node.type"),Ad=e=>!!e&&typeof e=="object"&&e[Ne]===vn,_d=e=>!!e&&typeof e=="object"&&e[Ne]===Vo,Td=e=>!!e&&typeof e=="object"&&e[Ne]===Or,Id=e=>!!e&&typeof e=="object"&&e[Ne]===qo,Wo=e=>!!e&&typeof e=="object"&&e[Ne]===gn,jd=e=>!!e&&typeof e=="object"&&e[Ne]===Hr;function zo(e){if(e&&typeof e=="object")switch(e[Ne]){case Or:case Hr:return!0}return!1}function $d(e){if(e&&typeof e=="object")switch(e[Ne]){case vn:case Or:case gn:case Hr:return!0}return!1}var Od=e=>(Wo(e)||zo(e))&&!!e.anchor;M.ALIAS=vn;M.DOC=Vo;M.MAP=Or;M.NODE_TYPE=Ne;M.PAIR=qo;M.SCALAR=gn;M.SEQ=Hr;M.hasAnchor=Od;M.isAlias=Ad;M.isCollection=zo;M.isDocument=_d;M.isMap=Td;M.isNode=$d;M.isPair=Id;M.isScalar=Wo;M.isSeq=jd});var At=g(wn=>{"use strict";var L=P(),W=Symbol("break visit"),Jo=Symbol("skip children"),de=Symbol("remove node");function Dr(e,t){let r=Go(t);L.isDocument(e)?nt(null,e.contents,r,Object.freeze([e]))===de&&(e.contents=null):nt(null,e,r,Object.freeze([]))}Dr.BREAK=W;Dr.SKIP=Jo;Dr.REMOVE=de;function nt(e,t,r,i){let n=Uo(e,t,r,i);if(L.isNode(n)||L.isPair(n))return Ko(e,i,n),nt(e,n,r,i);if(typeof n!="symbol"){if(L.isCollection(t)){i=Object.freeze(i.concat(t));for(let a=0;a<t.items.length;++a){let o=nt(a,t.items[a],r,i);if(typeof o=="number")a=o-1;else{if(o===W)return W;o===de&&(t.items.splice(a,1),a-=1)}}}else if(L.isPair(t)){i=Object.freeze(i.concat(t));let a=nt("key",t.key,r,i);if(a===W)return W;a===de&&(t.key=null);let o=nt("value",t.value,r,i);if(o===W)return W;o===de&&(t.value=null)}}return n}async function Lr(e,t){let r=Go(t);L.isDocument(e)?await at(null,e.contents,r,Object.freeze([e]))===de&&(e.contents=null):await at(null,e,r,Object.freeze([]))}Lr.BREAK=W;Lr.SKIP=Jo;Lr.REMOVE=de;async function at(e,t,r,i){let n=await Uo(e,t,r,i);if(L.isNode(n)||L.isPair(n))return Ko(e,i,n),at(e,n,r,i);if(typeof n!="symbol"){if(L.isCollection(t)){i=Object.freeze(i.concat(t));for(let a=0;a<t.items.length;++a){let o=await at(a,t.items[a],r,i);if(typeof o=="number")a=o-1;else{if(o===W)return W;o===de&&(t.items.splice(a,1),a-=1)}}}else if(L.isPair(t)){i=Object.freeze(i.concat(t));let a=await at("key",t.key,r,i);if(a===W)return W;a===de&&(t.key=null);let o=await at("value",t.value,r,i);if(o===W)return W;o===de&&(t.value=null)}}return n}function Go(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Uo(e,t,r,i){if(typeof r=="function")return r(e,t,i);if(L.isMap(t))return r.Map?.(e,t,i);if(L.isSeq(t))return r.Seq?.(e,t,i);if(L.isPair(t))return r.Pair?.(e,t,i);if(L.isScalar(t))return r.Scalar?.(e,t,i);if(L.isAlias(t))return r.Alias?.(e,t,i)}function Ko(e,t,r){let i=t[t.length-1];if(L.isCollection(i))i.items[e]=r;else if(L.isPair(i))e==="key"?i.key=r:i.value=r;else if(L.isDocument(i))i.contents=r;else{let n=L.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}wn.visit=Dr;wn.visitAsync=Lr});var yn=g(Xo=>{"use strict";var Yo=P(),Hd=At(),Dd={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Ld=e=>e.replace(/[!,[\]{}]/g,t=>Dd[t]),_t=class e{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,r)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let i=t.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[a,o]=i;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[a]=i;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return r(6,`Unsupported YAML version ${a}`,o),!1}}default:return r(0,`Unknown directive ${n}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,i,n]=t.match(/^(.*!)([^!]*)$/s);n||r(`The ${t} tag has no suffix`);let a=this.tags[i];if(a)try{return a+decodeURIComponent(n)}catch(o){return r(String(o)),null}return i==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[r,i]of Object.entries(this.tags))if(t.startsWith(i))return r+Ld(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(t&&i.length>0&&Yo.isNode(t.contents)){let a={};Hd.visit(t.contents,(o,s)=>{Yo.isNode(s)&&s.tag&&(a[s.tag]=!0)}),n=Object.keys(a)}else n=[];for(let[a,o]of i)a==="!!"&&o==="tag:yaml.org,2002:"||(!t||n.some(s=>s.startsWith(o)))&&r.push(`%TAG ${a} ${o}`);return r.join(`
5
+ `)}};_t.defaultYaml={explicit:!1,version:"1.2"};_t.defaultTags={"!!":"tag:yaml.org,2002:"};Xo.Directives=_t});var Br=g(Tt=>{"use strict";var Qo=P(),Bd=At();function Md(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(r)}return!0}function Zo(e){let t=new Set;return Bd.visit(e,{Value(r,i){i.anchor&&t.add(i.anchor)}}),t}function es(e,t){for(let r=1;;++r){let i=`${e}${r}`;if(!t.has(i))return i}}function Fd(e,t){let r=[],i=new Map,n=null;return{onAnchor:a=>{r.push(a),n??(n=Zo(e));let o=es(t,n);return n.add(o),o},setAnchors:()=>{for(let a of r){let o=i.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:i}}Tt.anchorIsValid=Md;Tt.anchorNames=Zo;Tt.createNodeAnchors=Fd;Tt.findNewAnchor=es});var Nn=g(ts=>{"use strict";function It(e,t,r,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,a=i.length;n<a;++n){let o=i[n],s=It(e,i,String(n),o);s===void 0?delete i[n]:s!==o&&(i[n]=s)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let a=i.get(n),o=It(e,i,n,a);o===void 0?i.delete(n):o!==a&&i.set(n,o)}else if(i instanceof Set)for(let n of Array.from(i)){let a=It(e,i,n,n);a===void 0?i.delete(n):a!==n&&(i.delete(n),i.add(a))}else for(let[n,a]of Object.entries(i)){let o=It(e,i,n,a);o===void 0?delete i[n]:o!==a&&(i[n]=o)}return e.call(t,r,i)}ts.applyReviver=It});var Re=g(is=>{"use strict";var Vd=P();function rs(e,t,r){if(Array.isArray(e))return e.map((i,n)=>rs(i,String(n),r));if(e&&typeof e.toJSON=="function"){if(!r||!Vd.hasAnchor(e))return e.toJSON(t,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=a=>{i.res=a,delete r.onCreate};let n=e.toJSON(t,r);return r.onCreate&&r.onCreate(n),n}return typeof e=="bigint"&&!r?.keep?Number(e):e}is.toJS=rs});var Mr=g(as=>{"use strict";var qd=Nn(),ns=P(),Wd=Re(),bn=class{constructor(t){Object.defineProperty(this,ns.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:r,maxAliasCount:i,onAnchor:n,reviver:a}={}){if(!ns.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},s=Wd.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:l}of o.anchors.values())n(l,c);return typeof a=="function"?qd.applyReviver(a,{"":s},"",s):s}};as.NodeBase=bn});var jt=g(os=>{"use strict";var zd=Br(),Jd=At(),ot=P(),Gd=Mr(),Ud=Re(),kn=class extends Gd.NodeBase{constructor(t){super(ot.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;r?.aliasResolveCache?i=r.aliasResolveCache:(i=[],Jd.visit(t,{Node:(a,o)=>{(ot.isAlias(o)||ot.hasAnchor(o))&&i.push(o)}}),r&&(r.aliasResolveCache=i));let n;for(let a of i){if(a===this)break;a.anchor===this.source&&(n=a)}return n}toJSON(t,r){if(!r)return{source:this.source};let{anchors:i,doc:n,maxAliasCount:a}=r,o=this.resolve(n,r);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=i.get(o);if(s||(Ud.toJS(o,null,r),s=i.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=Fr(n,o,i)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(t,r,i){let n=`*${this.source}`;if(t){if(zd.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${n} `}return n}};function Fr(e,t,r){if(ot.isAlias(t)){let i=t.resolve(e),n=r&&i&&r.get(i);return n?n.count*n.aliasCount:0}else if(ot.isCollection(t)){let i=0;for(let n of t.items){let a=Fr(e,n,r);a>i&&(i=a)}return i}else if(ot.isPair(t)){let i=Fr(e,t.key,r),n=Fr(e,t.value,r);return Math.max(i,n)}return 1}os.Alias=kn});var $=g(Sn=>{"use strict";var Kd=P(),Yd=Mr(),Xd=Re(),Qd=e=>!e||typeof e!="function"&&typeof e!="object",Ae=class extends Yd.NodeBase{constructor(t){super(Kd.SCALAR),this.value=t}toJSON(t,r){return r?.keep?this.value:Xd.toJS(this.value,t,r)}toString(){return String(this.value)}};Ae.BLOCK_FOLDED="BLOCK_FOLDED";Ae.BLOCK_LITERAL="BLOCK_LITERAL";Ae.PLAIN="PLAIN";Ae.QUOTE_DOUBLE="QUOTE_DOUBLE";Ae.QUOTE_SINGLE="QUOTE_SINGLE";Sn.Scalar=Ae;Sn.isScalarValue=Qd});var $t=g(cs=>{"use strict";var Zd=jt(),ze=P(),ss=$(),ef="tag:yaml.org,2002:";function tf(e,t,r){if(t){let i=r.filter(a=>a.tag===t),n=i.find(a=>!a.format)??i[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return r.find(i=>i.identify?.(e)&&!i.format)}function rf(e,t,r){if(ze.isDocument(e)&&(e=e.contents),ze.isNode(e))return e;if(ze.isPair(e)){let d=r.schema[ze.MAP].createNode?.(r.schema,null,r);return d.items.push(e),d}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:a,schema:o,sourceObjects:s}=r,c;if(i&&e&&typeof e=="object"){if(c=s.get(e),c)return c.anchor??(c.anchor=n(e)),new Zd.Alias(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith("!!")&&(t=ef+t.slice(2));let l=tf(e,t,o.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let d=new ss.Scalar(e);return c&&(c.node=d),d}l=e instanceof Map?o[ze.MAP]:Symbol.iterator in Object(e)?o[ze.SEQ]:o[ze.MAP]}a&&(a(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,e,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,e,r):new ss.Scalar(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}cs.createNode=rf});var qr=g(Vr=>{"use strict";var nf=$t(),fe=P(),af=Mr();function En(e,t,r){let i=r;for(let n=t.length-1;n>=0;--n){let a=t[n];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=i,i=o}else i=new Map([[a,i]])}return nf.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var ls=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Cn=class extends af.NodeBase{constructor(t,r){super(t),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(t){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(r.schema=t),r.items=r.items.map(i=>fe.isNode(i)||fe.isPair(i)?i.clone(t):i),this.range&&(r.range=this.range.slice()),r}addIn(t,r){if(ls(t))this.add(r);else{let[i,...n]=t,a=this.get(i,!0);if(fe.isCollection(a))a.addIn(n,r);else if(a===void 0&&this.schema)this.set(i,En(this.schema,n,r));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(t){let[r,...i]=t;if(i.length===0)return this.delete(r);let n=this.get(r,!0);if(fe.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}getIn(t,r){let[i,...n]=t,a=this.get(i,!0);return n.length===0?!r&&fe.isScalar(a)?a.value:a:fe.isCollection(a)?a.getIn(n,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!fe.isPair(r))return!1;let i=r.value;return i==null||t&&fe.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){let[r,...i]=t;if(i.length===0)return this.has(r);let n=this.get(r,!0);return fe.isCollection(n)?n.hasIn(i):!1}setIn(t,r){let[i,...n]=t;if(n.length===0)this.set(i,r);else{let a=this.get(i,!0);if(fe.isCollection(a))a.setIn(n,r);else if(a===void 0&&this.schema)this.set(i,En(this.schema,n,r));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};Vr.Collection=Cn;Vr.collectionFromPath=En;Vr.isEmptyPath=ls});var Ot=g(Wr=>{"use strict";var of=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Pn(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var sf=(e,t,r)=>e.endsWith(`
6
+ `)?Pn(r,t):r.includes(`
7
7
  `)?`
8
- `+bn(r,t):(e.endsWith(" ")?"":" ")+r;Vr.indentComment=bn;Vr.lineComment=zd;Vr.stringifyComment=Wd});var as=g(jt=>{"use strict";var Jd="flow",kn="block",qr="quoted";function Gd(e,t,r="flow",{indentAtStart:i,lineWidth:n=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!n||n<0)return e;n<a&&(a=0);let c=Math.max(1+a,1+n-t.length);if(e.length<=c)return e;let l=[],u={},d=n-t.length;typeof i=="number"&&(i>n-Math.max(2,a)?l.push(0):d=n-i);let f,p,v=!1,h=-1,m=-1,w=-1;r===kn&&(h=ns(e,h,t.length),h!==-1&&(d=h+c));for(let b;b=e[h+=1];){if(r===qr&&b==="\\"){switch(m=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(b===`
9
- `)r===kn&&(h=ns(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(b===" "&&p&&p!==" "&&p!==`
8
+ `+Pn(r,t):(e.endsWith(" ")?"":" ")+r;Wr.indentComment=Pn;Wr.lineComment=sf;Wr.stringifyComment=of});var ds=g(Ht=>{"use strict";var cf="flow",xn="block",zr="quoted";function lf(e,t,r="flow",{indentAtStart:i,lineWidth:n=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!n||n<0)return e;n<a&&(a=0);let c=Math.max(1+a,1+n-t.length);if(e.length<=c)return e;let l=[],u={},d=n-t.length;typeof i=="number"&&(i>n-Math.max(2,a)?l.push(0):d=n-i);let f,p,v=!1,h=-1,m=-1,w=-1;r===xn&&(h=us(e,h,t.length),h!==-1&&(d=h+c));for(let b;b=e[h+=1];){if(r===zr&&b==="\\"){switch(m=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(b===`
9
+ `)r===xn&&(h=us(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(b===" "&&p&&p!==" "&&p!==`
10
10
  `&&p!==" "){let k=e[h+1];k&&k!==" "&&k!==`
11
- `&&k!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===qr){for(;p===" "||p===" ";)p=b,b=e[h+=1],v=!0;let k=h>w+1?h-2:m-1;if(u[k])return e;l.push(k),u[k]=!0,d=k+c,f=void 0}else v=!0}p=b}if(v&&s&&s(),l.length===0)return e;o&&o();let y=e.slice(0,l[0]);for(let b=0;b<l.length;++b){let k=l[b],S=l[b+1]||e.length;k===0?y=`
12
- ${t}${e.slice(0,S)}`:(r===qr&&u[k]&&(y+=`${e[k]}\\`),y+=`
13
- ${t}${e.slice(k+1,S)}`)}return y}function ns(e,t,r){let i=t,n=t+1,a=e[n];for(;a===" "||a===" ";)if(t<n+r)a=e[++t];else{do a=e[++t];while(a&&a!==`
14
- `);i=t,n=t+1,a=e[n]}return i}jt.FOLD_BLOCK=kn;jt.FOLD_FLOW=Jd;jt.FOLD_QUOTED=qr;jt.foldFlowLines=Gd});var Ot=g(os=>{"use strict";var ie=j(),xe=as(),zr=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Jr=e=>/^(%|---|\.\.\.)/m.test(e);function Ud(e,t,r){if(!t||t<0)return!1;let i=t-r,n=e.length;if(n<=i)return!1;for(let a=0,o=0;a<n;++a)if(e[a]===`
15
- `){if(a-o>i)return!0;if(o=a+1,n-o<=i)return!1}return!0}function $t(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:i}=t,n=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Jr(e)?" ":""),o="",s=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(o+=r.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{o+=r.slice(s,c);let u=r.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=r.substr(c,6)}c+=5,s=c+1}break;case"n":if(i||r[c+2]==='"'||r.length<n)c+=1;else{for(o+=r.slice(s,c)+`
11
+ `&&k!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===zr){for(;p===" "||p===" ";)p=b,b=e[h+=1],v=!0;let k=h>w+1?h-2:m-1;if(u[k])return e;l.push(k),u[k]=!0,d=k+c,f=void 0}else v=!0}p=b}if(v&&s&&s(),l.length===0)return e;o&&o();let y=e.slice(0,l[0]);for(let b=0;b<l.length;++b){let k=l[b],S=l[b+1]||e.length;k===0?y=`
12
+ ${t}${e.slice(0,S)}`:(r===zr&&u[k]&&(y+=`${e[k]}\\`),y+=`
13
+ ${t}${e.slice(k+1,S)}`)}return y}function us(e,t,r){let i=t,n=t+1,a=e[n];for(;a===" "||a===" ";)if(t<n+r)a=e[++t];else{do a=e[++t];while(a&&a!==`
14
+ `);i=t,n=t+1,a=e[n]}return i}Ht.FOLD_BLOCK=xn;Ht.FOLD_FLOW=cf;Ht.FOLD_QUOTED=zr;Ht.foldFlowLines=lf});var Lt=g(fs=>{"use strict";var ne=$(),_e=ds(),Gr=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ur=e=>/^(%|---|\.\.\.)/m.test(e);function uf(e,t,r){if(!t||t<0)return!1;let i=t-r,n=e.length;if(n<=i)return!1;for(let a=0,o=0;a<n;++a)if(e[a]===`
15
+ `){if(a-o>i)return!0;if(o=a+1,n-o<=i)return!1}return!0}function Dt(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:i}=t,n=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Ur(e)?" ":""),o="",s=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(o+=r.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{o+=r.slice(s,c);let u=r.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=r.substr(c,6)}c+=5,s=c+1}break;case"n":if(i||r[c+2]==='"'||r.length<n)c+=1;else{for(o+=r.slice(s,c)+`
16
16
 
17
17
  `;r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"';)o+=`
18
- `,c+=2;o+=a,r[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+r.slice(s):r,i?o:xe.foldFlowLines(o,a,xe.FOLD_QUOTED,zr(t,!1))}function Sn(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(e))return $t(e,t);let r=t.indent||(Jr(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${r}`)+"'";return t.implicitKey?i:xe.foldFlowLines(i,r,xe.FOLD_FLOW,zr(t,!1))}function at(e,t){let{singleQuote:r}=t.options,i;if(r===!1)i=$t;else{let n=e.includes('"'),a=e.includes("'");n&&!a?i=Sn:a&&!n?i=$t:i=r?Sn:$t}return i(e,t)}var En;try{En=new RegExp(`(^|(?<!
18
+ `,c+=2;o+=a,r[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+r.slice(s):r,i?o:_e.foldFlowLines(o,a,_e.FOLD_QUOTED,Gr(t,!1))}function Rn(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(e))return Dt(e,t);let r=t.indent||(Ur(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${r}`)+"'";return t.implicitKey?i:_e.foldFlowLines(i,r,_e.FOLD_FLOW,Gr(t,!1))}function st(e,t){let{singleQuote:r}=t.options,i;if(r===!1)i=Dt;else{let n=e.includes('"'),a=e.includes("'");n&&!a?i=Rn:a&&!n?i=Dt:i=r?Rn:Dt}return i(e,t)}var An;try{An=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{En=/\n+(?!\n|$)/g}function Wr({comment:e,type:t,value:r},i,n,a){let{blockQuote:o,commentString:s,lineWidth:c}=i.options;if(!o||/\n[\t ]+$/.test(r))return at(r,i);let l=i.indent||(i.forceBlockIndent||Jr(r)?" ":""),u=o==="literal"?!0:o==="folded"||t===ie.Scalar.BLOCK_FOLDED?!1:t===ie.Scalar.BLOCK_LITERAL?!0:!Ud(r,c,l.length);if(!r)return u?`|
23
+ |$)`,"g")}catch{An=/\n+(?!\n|$)/g}function Jr({comment:e,type:t,value:r},i,n,a){let{blockQuote:o,commentString:s,lineWidth:c}=i.options;if(!o||/\n[\t ]+$/.test(r))return st(r,i);let l=i.indent||(i.forceBlockIndent||Ur(r)?" ":""),u=o==="literal"?!0:o==="folded"||t===ne.Scalar.BLOCK_FOLDED?!1:t===ne.Scalar.BLOCK_LITERAL?!0:!uf(r,c,l.length);if(!r)return u?`|
24
24
  `:`>
25
25
  `;let d,f;for(f=r.length;f>0;--f){let S=r[f-1];if(S!==`
26
26
  `&&S!==" "&&S!==" ")break}let p=r.substring(f),v=p.indexOf(`
27
27
  `);v===-1?d="-":r===p||v!==p.length-1?(d="+",a&&a()):d="",p&&(r=r.slice(0,-p.length),p[p.length-1]===`
28
- `&&(p=p.slice(0,-1)),p=p.replace(En,`$&${l}`));let h=!1,m,w=-1;for(m=0;m<r.length;++m){let S=r[m];if(S===" ")h=!0;else if(S===`
28
+ `&&(p=p.slice(0,-1)),p=p.replace(An,`$&${l}`));let h=!1,m,w=-1;for(m=0;m<r.length;++m){let S=r[m];if(S===" ")h=!0;else if(S===`
29
29
  `)w=m;else break}let y=r.substring(0,w<m?w+1:m);y&&(r=r.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let k=(h?l?"2":"1":"")+d;if(e&&(k+=" "+s(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!u){let S=r.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,A=zr(i,!0);o!=="folded"&&t!==ie.Scalar.BLOCK_FOLDED&&(A.onOverflow=()=>{E=!0});let N=xe.foldFlowLines(`${y}${S}${p}`,l,xe.FOLD_BLOCK,A);if(!E)return`>${k}
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,_=Gr(i,!0);o!=="folded"&&t!==ne.Scalar.BLOCK_FOLDED&&(_.onOverflow=()=>{E=!0});let N=_e.foldFlowLines(`${y}${S}${p}`,l,_e.FOLD_BLOCK,_);if(!E)return`>${k}
31
31
  ${l}${N}`}return r=r.replace(/\n+/g,`$&${l}`),`|${k}
32
- ${l}${y}${r}${p}`}function Kd(e,t,r,i){let{type:n,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
33
- `)||u&&/[[\]{},]/.test(a))return at(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
34
- `)?at(a,t):Wr(e,t,r,i);if(!s&&!u&&n!==ie.Scalar.PLAIN&&a.includes(`
35
- `))return Wr(e,t,r,i);if(Jr(a)){if(c==="")return t.forceBlockIndent=!0,Wr(e,t,r,i);if(s&&c===l)return at(a,t)}let d=a.replace(/\n+/g,`$&
36
- ${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:v}=t.doc.schema;if(v.some(f)||p?.some(f))return at(a,t)}return s?d:xe.foldFlowLines(d,c,xe.FOLD_FLOW,zr(t,!1))}function Yd(e,t,r,i){let{implicitKey:n,inFlow:a}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==ie.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=ie.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ie.Scalar.BLOCK_FOLDED:case ie.Scalar.BLOCK_LITERAL:return n||a?at(o.value,t):Wr(o,t,r,i);case ie.Scalar.QUOTE_DOUBLE:return $t(o.value,t);case ie.Scalar.QUOTE_SINGLE:return Sn(o.value,t);case ie.Scalar.PLAIN:return Kd(o,t,r,i);default:return null}},l=c(s);if(l===null){let{defaultKeyType:u,defaultStringType:d}=t.options,f=n&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}os.stringifyString=Yd});var Ht=g(Pn=>{"use strict";var Xd=Dr(),Re=P(),Qd=It(),Zd=Ot();function ef(e,t){let r=Object.assign({blockQuote:!0,commentString:Qd.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(r.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:i,options:r}}function tf(e,t){if(t.tag){let n=e.filter(a=>a.tag===t.tag);if(n.length>0)return n.find(a=>a.format===t.format)??n[0]}let r,i;if(Re.isScalar(t)){i=t.value;let n=e.filter(a=>a.identify?.(i));if(n.length>1){let a=n.filter(o=>o.test);a.length>0&&(n=a)}r=n.find(a=>a.format===t.format)??n.find(a=>!a.format)}else i=t,r=e.find(n=>n.nodeClass&&i instanceof n.nodeClass);if(!r){let n=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${n} value`)}return r}function rf(e,t,{anchors:r,doc:i}){if(!i.directives)return"";let n=[],a=(Re.isScalar(e)||Re.isCollection(e))&&e.anchor;a&&Xd.anchorIsValid(a)&&(r.add(a),n.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&n.push(i.directives.tagString(o)),n.join(" ")}function nf(e,t,r,i){if(Re.isPair(e))return e.toString(t,r,i);if(Re.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let n,a=Re.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>n=c});n??(n=tf(t.doc.schema.tags,a));let o=rf(a,n,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof n.stringify=="function"?n.stringify(a,t,r,i):Re.isScalar(a)?Zd.stringifyString(a,t,r,i):a.toString(t,r,i);return o?Re.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
- ${t.indent}${s}`:s}Pn.createStringifyContext=ef;Pn.stringify=nf});var us=g(ls=>{"use strict";var Ne=P(),ss=j(),cs=Ht(),Dt=It();function af({key:e,value:t},r,i,n){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=Ne.isNode(e)&&e.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Ne.isCollection(e)||!Ne.isNode(e)&&typeof e=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!d&&(!e||f&&t==null&&!r.inFlow||Ne.isCollection(e)||(Ne.isScalar(e)?e.type===ss.Scalar.BLOCK_FOLDED||e.type===ss.Scalar.BLOCK_LITERAL:typeof e=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let v=!1,h=!1,m=cs.stringify(e,r,()=>v=!0,()=>h=!0);if(!p&&!r.inFlow&&m.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(a||t==null)return v&&i&&i(),m===""?"?":p?`? ${m}`:m}else if(a&&!d||t==null&&p)return m=`? ${m}`,f&&!v?m+=Dt.lineComment(m,r.indent,l(f)):h&&n&&n(),m;v&&(f=null),p?(f&&(m+=Dt.lineComment(m,r.indent,l(f))),m=`? ${m}
38
- ${s}:`):(m=`${m}:`,f&&(m+=Dt.lineComment(m,r.indent,l(f))));let w,y,b;Ne.isNode(t)?(w=!!t.spaceBefore,y=t.commentBefore,b=t.comment):(w=!1,y=null,b=null,t&&typeof t=="object"&&(t=o.createNode(t))),r.implicitKey=!1,!p&&!f&&Ne.isScalar(t)&&(r.indentAtStart=m.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&Ne.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(r.indent=r.indent.substring(2));let k=!1,S=cs.stringify(t,r,()=>k=!0,()=>h=!0),E=" ";if(f||w||y){if(E=w?`
39
- `:"",y){let A=l(y);E+=`
40
- ${Dt.indentComment(A,r.indent)}`}S===""&&!r.inFlow?E===`
32
+ ${l}${y}${r}${p}`}function df(e,t,r,i){let{type:n,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
33
+ `)||u&&/[[\]{},]/.test(a))return st(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
34
+ `)?st(a,t):Jr(e,t,r,i);if(!s&&!u&&n!==ne.Scalar.PLAIN&&a.includes(`
35
+ `))return Jr(e,t,r,i);if(Ur(a)){if(c==="")return t.forceBlockIndent=!0,Jr(e,t,r,i);if(s&&c===l)return st(a,t)}let d=a.replace(/\n+/g,`$&
36
+ ${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:v}=t.doc.schema;if(v.some(f)||p?.some(f))return st(a,t)}return s?d:_e.foldFlowLines(d,c,_e.FOLD_FLOW,Gr(t,!1))}function ff(e,t,r,i){let{implicitKey:n,inFlow:a}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==ne.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=ne.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ne.Scalar.BLOCK_FOLDED:case ne.Scalar.BLOCK_LITERAL:return n||a?st(o.value,t):Jr(o,t,r,i);case ne.Scalar.QUOTE_DOUBLE:return Dt(o.value,t);case ne.Scalar.QUOTE_SINGLE:return Rn(o.value,t);case ne.Scalar.PLAIN:return df(o,t,r,i);default:return null}},l=c(s);if(l===null){let{defaultKeyType:u,defaultStringType:d}=t.options,f=n&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}fs.stringifyString=ff});var Bt=g(_n=>{"use strict";var hf=Br(),Te=P(),pf=Ot(),mf=Lt();function vf(e,t){let r=Object.assign({blockQuote:!0,commentString:pf.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(r.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:i,options:r}}function gf(e,t){if(t.tag){let n=e.filter(a=>a.tag===t.tag);if(n.length>0)return n.find(a=>a.format===t.format)??n[0]}let r,i;if(Te.isScalar(t)){i=t.value;let n=e.filter(a=>a.identify?.(i));if(n.length>1){let a=n.filter(o=>o.test);a.length>0&&(n=a)}r=n.find(a=>a.format===t.format)??n.find(a=>!a.format)}else i=t,r=e.find(n=>n.nodeClass&&i instanceof n.nodeClass);if(!r){let n=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${n} value`)}return r}function wf(e,t,{anchors:r,doc:i}){if(!i.directives)return"";let n=[],a=(Te.isScalar(e)||Te.isCollection(e))&&e.anchor;a&&hf.anchorIsValid(a)&&(r.add(a),n.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&n.push(i.directives.tagString(o)),n.join(" ")}function yf(e,t,r,i){if(Te.isPair(e))return e.toString(t,r,i);if(Te.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let n,a=Te.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>n=c});n??(n=gf(t.doc.schema.tags,a));let o=wf(a,n,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof n.stringify=="function"?n.stringify(a,t,r,i):Te.isScalar(a)?mf.stringifyString(a,t,r,i):a.toString(t,r,i);return o?Te.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
+ ${t.indent}${s}`:s}_n.createStringifyContext=vf;_n.stringify=yf});var vs=g(ms=>{"use strict";var be=P(),hs=$(),ps=Bt(),Mt=Ot();function Nf({key:e,value:t},r,i,n){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=be.isNode(e)&&e.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(be.isCollection(e)||!be.isNode(e)&&typeof e=="object"){let _="With simple keys, collection cannot be used as a key value";throw new Error(_)}}let p=!d&&(!e||f&&t==null&&!r.inFlow||be.isCollection(e)||(be.isScalar(e)?e.type===hs.Scalar.BLOCK_FOLDED||e.type===hs.Scalar.BLOCK_LITERAL:typeof e=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let v=!1,h=!1,m=ps.stringify(e,r,()=>v=!0,()=>h=!0);if(!p&&!r.inFlow&&m.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(a||t==null)return v&&i&&i(),m===""?"?":p?`? ${m}`:m}else if(a&&!d||t==null&&p)return m=`? ${m}`,f&&!v?m+=Mt.lineComment(m,r.indent,l(f)):h&&n&&n(),m;v&&(f=null),p?(f&&(m+=Mt.lineComment(m,r.indent,l(f))),m=`? ${m}
38
+ ${s}:`):(m=`${m}:`,f&&(m+=Mt.lineComment(m,r.indent,l(f))));let w,y,b;be.isNode(t)?(w=!!t.spaceBefore,y=t.commentBefore,b=t.comment):(w=!1,y=null,b=null,t&&typeof t=="object"&&(t=o.createNode(t))),r.implicitKey=!1,!p&&!f&&be.isScalar(t)&&(r.indentAtStart=m.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&be.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(r.indent=r.indent.substring(2));let k=!1,S=ps.stringify(t,r,()=>k=!0,()=>h=!0),E=" ";if(f||w||y){if(E=w?`
39
+ `:"",y){let _=l(y);E+=`
40
+ ${Mt.indentComment(_,r.indent)}`}S===""&&!r.inFlow?E===`
41
41
  `&&b&&(E=`
42
42
 
43
43
  `):E+=`
44
- ${r.indent}`}else if(!p&&Ne.isCollection(t)){let A=S[0],N=S.indexOf(`
45
- `),O=N!==-1,Ee=r.inFlow??t.flow??t.items.length===0;if(O||!Ee){let tt=!1;if(O&&(A==="&"||A==="!")){let H=S.indexOf(" ");A==="&"&&H!==-1&&H<N&&S[H+1]==="!"&&(H=S.indexOf(" ",H+1)),(H===-1||N<H)&&(tt=!0)}tt||(E=`
44
+ ${r.indent}`}else if(!p&&be.isCollection(t)){let _=S[0],N=S.indexOf(`
45
+ `),H=N!==-1,xe=r.inFlow??t.flow??t.items.length===0;if(H||!xe){let it=!1;if(H&&(_==="&"||_==="!")){let D=S.indexOf(" ");_==="&"&&D!==-1&&D<N&&S[D+1]==="!"&&(D=S.indexOf(" ",D+1)),(D===-1||N<D)&&(it=!0)}it||(E=`
46
46
  ${r.indent}`)}}else(S===""||S[0]===`
47
- `)&&(E="");return m+=E+S,r.inFlow?k&&i&&i():b&&!k?m+=Dt.lineComment(m,r.indent,l(b)):h&&n&&n(),m}ls.stringifyPair=af});var xn=g(Cn=>{"use strict";var ds=Ir("process");function of(e,...t){e==="debug"&&console.log(...t)}function sf(e,t){(e==="debug"||e==="warn")&&(typeof ds.emitWarning=="function"?ds.emitWarning(t):console.warn(t))}Cn.debug=of;Cn.warn=sf});var Xr=g(Yr=>{"use strict";var Kr=P(),fs=j(),Gr="<<",Ur={identify:e=>e===Gr||typeof e=="symbol"&&e.description===Gr,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new fs.Scalar(Symbol(Gr)),{addToJSMap:hs}),stringify:()=>Gr},cf=(e,t)=>(Ur.identify(t)||Kr.isScalar(t)&&(!t.type||t.type===fs.Scalar.PLAIN)&&Ur.identify(t.value))&&e?.doc.schema.tags.some(r=>r.tag===Ur.tag&&r.default);function hs(e,t,r){let i=ps(e,r);if(Kr.isSeq(i))for(let n of i.items)Rn(e,t,n);else if(Array.isArray(i))for(let n of i)Rn(e,t,n);else Rn(e,t,i)}function Rn(e,t,r){let i=ps(e,r);if(!Kr.isMap(i))throw new Error("Merge sources must be maps or map aliases");let n=i.toJSON(null,e,Map);for(let[a,o]of n)t instanceof Map?t.has(a)||t.set(a,o):t instanceof Set?t.add(a):Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function ps(e,t){return e&&Kr.isAlias(t)?t.resolve(e.doc,e):t}Yr.addMergeToJSMap=hs;Yr.isMergeKey=cf;Yr.merge=Ur});var _n=g(gs=>{"use strict";var lf=xn(),ms=Xr(),uf=Ht(),vs=P(),An=Pe();function df(e,t,{key:r,value:i}){if(vs.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,i);else if(ms.isMergeKey(e,r))ms.addMergeToJSMap(e,t,i);else{let n=An.toJS(r,"",e);if(t instanceof Map)t.set(n,An.toJS(i,n,e));else if(t instanceof Set)t.add(n);else{let a=ff(r,n,e),o=An.toJS(i,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function ff(e,t,r){if(t===null)return"";if(typeof t!="object")return String(t);if(vs.isNode(e)&&r?.doc){let i=uf.createStringifyContext(r.doc,{});i.anchors=new Set;for(let a of r.anchors.keys())i.anchors.add(a.anchor);i.inFlow=!0,i.inStringifyKey=!0;let n=e.toString(i);if(!r.mapKeyWarned){let a=JSON.stringify(n);a.length>40&&(a=a.substring(0,36)+'..."'),lf.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return n}return JSON.stringify(t)}gs.addPairToJSMap=df});var Ae=g(Tn=>{"use strict";var ws=Tt(),hf=us(),pf=_n(),Qr=P();function mf(e,t,r){let i=ws.createNode(e,void 0,r),n=ws.createNode(t,void 0,r);return new Zr(i,n)}var Zr=class e{constructor(t,r=null){Object.defineProperty(this,Qr.NODE_TYPE,{value:Qr.PAIR}),this.key=t,this.value=r}clone(t){let{key:r,value:i}=this;return Qr.isNode(r)&&(r=r.clone(t)),Qr.isNode(i)&&(i=i.clone(t)),new e(r,i)}toJSON(t,r){let i=r?.mapAsMap?new Map:{};return pf.addPairToJSMap(r,i,this)}toString(t,r,i){return t?.doc?hf.stringifyPair(this,t,r,i):JSON.stringify(this)}};Tn.Pair=Zr;Tn.createPair=mf});var In=g(Ns=>{"use strict";var We=P(),ys=Ht(),ei=It();function vf(e,t,r){return(t.inFlow??e.flow?wf:gf)(e,t,r)}function gf({comment:e,items:t},r,{blockItemPrefix:i,flowChars:n,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:a,type:null}),d=!1,f=[];for(let v=0;v<t.length;++v){let h=t[v],m=null;if(We.isNode(h))!d&&h.spaceBefore&&f.push(""),ti(r,f,h.commentBefore,d),h.comment&&(m=h.comment);else if(We.isPair(h)){let y=We.isNode(h.key)?h.key:null;y&&(!d&&y.spaceBefore&&f.push(""),ti(r,f,y.commentBefore,d))}d=!1;let w=ys.stringify(h,u,()=>m=null,()=>d=!0);m&&(w+=ei.lineComment(w,a,l(m))),d&&m&&(d=!1),f.push(i+w)}let p;if(f.length===0)p=n.start+n.end;else{p=f[0];for(let v=1;v<f.length;++v){let h=f[v];p+=h?`
47
+ `)&&(E="");return m+=E+S,r.inFlow?k&&i&&i():b&&!k?m+=Mt.lineComment(m,r.indent,l(b)):h&&n&&n(),m}ms.stringifyPair=Nf});var In=g(Tn=>{"use strict";var gs=$r("process");function bf(e,...t){e==="debug"&&console.log(...t)}function kf(e,t){(e==="debug"||e==="warn")&&(typeof gs.emitWarning=="function"?gs.emitWarning(t):console.warn(t))}Tn.debug=bf;Tn.warn=kf});var Zr=g(Qr=>{"use strict";var Xr=P(),ws=$(),Kr="<<",Yr={identify:e=>e===Kr||typeof e=="symbol"&&e.description===Kr,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ws.Scalar(Symbol(Kr)),{addToJSMap:ys}),stringify:()=>Kr},Sf=(e,t)=>(Yr.identify(t)||Xr.isScalar(t)&&(!t.type||t.type===ws.Scalar.PLAIN)&&Yr.identify(t.value))&&e?.doc.schema.tags.some(r=>r.tag===Yr.tag&&r.default);function ys(e,t,r){let i=Ns(e,r);if(Xr.isSeq(i))for(let n of i.items)jn(e,t,n);else if(Array.isArray(i))for(let n of i)jn(e,t,n);else jn(e,t,i)}function jn(e,t,r){let i=Ns(e,r);if(!Xr.isMap(i))throw new Error("Merge sources must be maps or map aliases");let n=i.toJSON(null,e,Map);for(let[a,o]of n)t instanceof Map?t.has(a)||t.set(a,o):t instanceof Set?t.add(a):Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function Ns(e,t){return e&&Xr.isAlias(t)?t.resolve(e.doc,e):t}Qr.addMergeToJSMap=ys;Qr.isMergeKey=Sf;Qr.merge=Yr});var On=g(Ss=>{"use strict";var Ef=In(),bs=Zr(),Cf=Bt(),ks=P(),$n=Re();function Pf(e,t,{key:r,value:i}){if(ks.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,i);else if(bs.isMergeKey(e,r))bs.addMergeToJSMap(e,t,i);else{let n=$n.toJS(r,"",e);if(t instanceof Map)t.set(n,$n.toJS(i,n,e));else if(t instanceof Set)t.add(n);else{let a=xf(r,n,e),o=$n.toJS(i,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function xf(e,t,r){if(t===null)return"";if(typeof t!="object")return String(t);if(ks.isNode(e)&&r?.doc){let i=Cf.createStringifyContext(r.doc,{});i.anchors=new Set;for(let a of r.anchors.keys())i.anchors.add(a.anchor);i.inFlow=!0,i.inStringifyKey=!0;let n=e.toString(i);if(!r.mapKeyWarned){let a=JSON.stringify(n);a.length>40&&(a=a.substring(0,36)+'..."'),Ef.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return n}return JSON.stringify(t)}Ss.addPairToJSMap=Pf});var Ie=g(Hn=>{"use strict";var Es=$t(),Rf=vs(),Af=On(),ei=P();function _f(e,t,r){let i=Es.createNode(e,void 0,r),n=Es.createNode(t,void 0,r);return new ti(i,n)}var ti=class e{constructor(t,r=null){Object.defineProperty(this,ei.NODE_TYPE,{value:ei.PAIR}),this.key=t,this.value=r}clone(t){let{key:r,value:i}=this;return ei.isNode(r)&&(r=r.clone(t)),ei.isNode(i)&&(i=i.clone(t)),new e(r,i)}toJSON(t,r){let i=r?.mapAsMap?new Map:{};return Af.addPairToJSMap(r,i,this)}toString(t,r,i){return t?.doc?Rf.stringifyPair(this,t,r,i):JSON.stringify(this)}};Hn.Pair=ti;Hn.createPair=_f});var Dn=g(Ps=>{"use strict";var Je=P(),Cs=Bt(),ri=Ot();function Tf(e,t,r){return(t.inFlow??e.flow?jf:If)(e,t,r)}function If({comment:e,items:t},r,{blockItemPrefix:i,flowChars:n,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:a,type:null}),d=!1,f=[];for(let v=0;v<t.length;++v){let h=t[v],m=null;if(Je.isNode(h))!d&&h.spaceBefore&&f.push(""),ii(r,f,h.commentBefore,d),h.comment&&(m=h.comment);else if(Je.isPair(h)){let y=Je.isNode(h.key)?h.key:null;y&&(!d&&y.spaceBefore&&f.push(""),ii(r,f,y.commentBefore,d))}d=!1;let w=Cs.stringify(h,u,()=>m=null,()=>d=!0);m&&(w+=ri.lineComment(w,a,l(m))),d&&m&&(d=!1),f.push(i+w)}let p;if(f.length===0)p=n.start+n.end;else{p=f[0];for(let v=1;v<f.length;++v){let h=f[v];p+=h?`
48
48
  ${c}${h}`:`
49
49
  `}}return e?(p+=`
50
- `+ei.indentComment(l(e),c),s&&s()):d&&o&&o(),p}function wf({items:e},t,{flowChars:r,itemIndent:i}){let{indent:n,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;i+=a;let c=Object.assign({},t,{indent:i,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let v=0;v<e.length;++v){let h=e[v],m=null;if(We.isNode(h))h.spaceBefore&&d.push(""),ti(t,d,h.commentBefore,!1),h.comment&&(m=h.comment);else if(We.isPair(h)){let y=We.isNode(h.key)?h.key:null;y&&(y.spaceBefore&&d.push(""),ti(t,d,y.commentBefore,!1),y.comment&&(l=!0));let b=We.isNode(h.value)?h.value:null;b?(b.comment&&(m=b.comment),b.commentBefore&&(l=!0)):h.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=ys.stringify(h,c,()=>m=null);l||(l=d.length>u||w.includes(`
51
- `)),v<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=d.reduce((y,b)=>y+b.length+2,2)+(w.length+2)>t.options.lineWidth)),l&&(w+=",")),m&&(w+=ei.lineComment(w,i,s(m))),d.push(w),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let v=d.reduce((h,m)=>h+m.length+2,2);l=t.options.lineWidth>0&&v>t.options.lineWidth}if(l){let v=f;for(let h of d)v+=h?`
50
+ `+ri.indentComment(l(e),c),s&&s()):d&&o&&o(),p}function jf({items:e},t,{flowChars:r,itemIndent:i}){let{indent:n,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;i+=a;let c=Object.assign({},t,{indent:i,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let v=0;v<e.length;++v){let h=e[v],m=null;if(Je.isNode(h))h.spaceBefore&&d.push(""),ii(t,d,h.commentBefore,!1),h.comment&&(m=h.comment);else if(Je.isPair(h)){let y=Je.isNode(h.key)?h.key:null;y&&(y.spaceBefore&&d.push(""),ii(t,d,y.commentBefore,!1),y.comment&&(l=!0));let b=Je.isNode(h.value)?h.value:null;b?(b.comment&&(m=b.comment),b.commentBefore&&(l=!0)):h.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=Cs.stringify(h,c,()=>m=null);l||(l=d.length>u||w.includes(`
51
+ `)),v<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=d.reduce((y,b)=>y+b.length+2,2)+(w.length+2)>t.options.lineWidth)),l&&(w+=",")),m&&(w+=ri.lineComment(w,i,s(m))),d.push(w),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let v=d.reduce((h,m)=>h+m.length+2,2);l=t.options.lineWidth>0&&v>t.options.lineWidth}if(l){let v=f;for(let h of d)v+=h?`
52
52
  ${a}${n}${h}`:`
53
53
  `;return`${v}
54
- ${n}${p}`}else return`${f}${o}${d.join(" ")}${o}${p}`}function ti({indent:e,options:{commentString:t}},r,i,n){if(i&&n&&(i=i.replace(/^\n+/,"")),i){let a=ei.indentComment(t(i),e);r.push(a.trimStart())}}Ns.stringifyCollection=vf});var Te=g($n=>{"use strict";var yf=In(),Nf=_n(),bf=Fr(),_e=P(),ri=Ae(),kf=j();function Bt(e,t){let r=_e.isScalar(t)?t.value:t;for(let i of e)if(_e.isPair(i)&&(i.key===t||i.key===r||_e.isScalar(i.key)&&i.key.value===r))return i}var jn=class extends bf.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(_e.MAP,t),this.items=[]}static from(t,r,i){let{keepUndefined:n,replacer:a}=i,o=new this(t),s=(c,l)=>{if(typeof a=="function")l=a.call(r,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||n)&&o.items.push(ri.createPair(c,l,i))};if(r instanceof Map)for(let[c,l]of r)s(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))s(c,r[c]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,r){let i;_e.isPair(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new ri.Pair(t,t?.value):i=new ri.Pair(t.key,t.value);let n=Bt(this.items,i.key),a=this.schema?.sortMapEntries;if(n){if(!r)throw new Error(`Key ${i.key} already set`);_e.isScalar(n.value)&&kf.isScalarValue(i.value)?n.value.value=i.value:n.value=i.value}else if(a){let o=this.items.findIndex(s=>a(i,s)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(t){let r=Bt(this.items,t);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(t,r){let n=Bt(this.items,t)?.value;return(!r&&_e.isScalar(n)?n.value:n)??void 0}has(t){return!!Bt(this.items,t)}set(t,r){this.add(new ri.Pair(t,r),!0)}toJSON(t,r,i){let n=i?new i:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(n);for(let a of this.items)Nf.addPairToJSMap(r,n,a);return n}toString(t,r,i){if(!t)return JSON.stringify(this);for(let n of this.items)if(!_e.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),yf.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:r})}};$n.YAMLMap=jn;$n.findPair=Bt});var ot=g(ks=>{"use strict";var Sf=P(),bs=Te(),Ef={collection:"map",default:!0,nodeClass:bs.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return Sf.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,r)=>bs.YAMLMap.from(e,t,r)};ks.map=Ef});var Ie=g(Ss=>{"use strict";var Pf=Tt(),Cf=In(),xf=Fr(),ni=P(),Rf=j(),Af=Pe(),On=class extends xf.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(ni.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let r=ii(t);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(t,r){let i=ii(t);if(typeof i!="number")return;let n=this.items[i];return!r&&ni.isScalar(n)?n.value:n}has(t){let r=ii(t);return typeof r=="number"&&r<this.items.length}set(t,r){let i=ii(t);if(typeof i!="number")throw new Error(`Expected a valid index, not ${t}.`);let n=this.items[i];ni.isScalar(n)&&Rf.isScalarValue(r)?n.value=r:this.items[i]=r}toJSON(t,r){let i=[];r?.onCreate&&r.onCreate(i);let n=0;for(let a of this.items)i.push(Af.toJS(a,String(n++),r));return i}toString(t,r,i){return t?Cf.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:i,onComment:r}):JSON.stringify(this)}static from(t,r,i){let{replacer:n}=i,a=new this(t);if(r&&Symbol.iterator in Object(r)){let o=0;for(let s of r){if(typeof n=="function"){let c=r instanceof Set?s:String(o++);s=n.call(r,c,s)}a.items.push(Pf.createNode(s,void 0,i))}}return a}};function ii(e){let t=ni.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}Ss.YAMLSeq=On});var st=g(Ps=>{"use strict";var _f=P(),Es=Ie(),Tf={collection:"seq",default:!0,nodeClass:Es.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return _f.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,r)=>Es.YAMLSeq.from(e,t,r)};Ps.seq=Tf});var Lt=g(Cs=>{"use strict";var If=Ot(),jf={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,r,i){return t=Object.assign({actualString:!0},t),If.stringifyString(e,t,r,i)}};Cs.string=jf});var ai=g(As=>{"use strict";var xs=j(),Rs={identify:e=>e==null,createNode:()=>new xs.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new xs.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&Rs.test.test(e)?e:t.options.nullStr};As.nullTag=Rs});var Hn=g(Ts=>{"use strict";var $f=j(),_s={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new $f.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},r){if(e&&_s.test.test(e)){let i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?r.options.trueStr:r.options.falseStr}};Ts.boolTag=_s});var ct=g(Is=>{"use strict";function Of({format:e,minFractionDigits:t,tag:r,value:i}){if(typeof i=="bigint")return String(i);let n=typeof i=="number"?i:Number(i);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let a=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=t-(a.length-o-1);for(;s-- >0;)a+="0"}return a}Is.stringifyNumber=Of});var Bn=g(oi=>{"use strict";var Hf=j(),Dn=ct(),Df={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Dn.stringifyNumber},Bf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Dn.stringifyNumber(e)}},Lf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Hf.Scalar(parseFloat(e)),r=e.indexOf(".");return r!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-r-1),t},stringify:Dn.stringifyNumber};oi.float=Lf;oi.floatExp=Bf;oi.floatNaN=Df});var Mn=g(ci=>{"use strict";var js=ct(),si=e=>typeof e=="bigint"||Number.isInteger(e),Ln=(e,t,r,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),r);function $s(e,t,r){let{value:i}=e;return si(i)&&i>=0?r+i.toString(t):js.stringifyNumber(e)}var Mf={identify:e=>si(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>Ln(e,2,8,r),stringify:e=>$s(e,8,"0o")},Ff={identify:si,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>Ln(e,0,10,r),stringify:js.stringifyNumber},Vf={identify:e=>si(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>Ln(e,2,16,r),stringify:e=>$s(e,16,"0x")};ci.int=Ff;ci.intHex=Vf;ci.intOct=Mf});var Hs=g(Os=>{"use strict";var qf=ot(),Wf=ai(),zf=st(),Jf=Lt(),Gf=Hn(),Fn=Bn(),Vn=Mn(),Uf=[qf.map,zf.seq,Jf.string,Wf.nullTag,Gf.boolTag,Vn.intOct,Vn.int,Vn.intHex,Fn.floatNaN,Fn.floatExp,Fn.float];Os.schema=Uf});var Ls=g(Bs=>{"use strict";var Kf=j(),Yf=ot(),Xf=st();function Ds(e){return typeof e=="bigint"||Number.isInteger(e)}var li=({value:e})=>JSON.stringify(e),Qf=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:li},{identify:e=>e==null,createNode:()=>new Kf.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:li},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:li},{identify:Ds,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:r})=>r?BigInt(e):parseInt(e,10),stringify:({value:e})=>Ds(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:li}],Zf={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},eh=[Yf.map,Xf.seq].concat(Qf,Zf);Bs.schema=eh});var Wn=g(Ms=>{"use strict";var Mt=Ir("buffer"),qn=j(),th=Ot(),rh={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Mt.Buffer=="function")return Mt.Buffer.from(e,"base64");if(typeof atob=="function"){let r=atob(e.replace(/[\n\r]/g,"")),i=new Uint8Array(r.length);for(let n=0;n<r.length;++n)i[n]=r.charCodeAt(n);return i}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:r},i,n,a){if(!r)return"";let o=r,s;if(typeof Mt.Buffer=="function")s=o instanceof Mt.Buffer?o.toString("base64"):Mt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=qn.Scalar.BLOCK_LITERAL),t!==qn.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(s.length/c),u=new Array(l);for(let d=0,f=0;d<l;++d,f+=c)u[d]=s.substr(f,c);s=u.join(t===qn.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return th.stringifyString({comment:e,type:t,value:s},i,n,a)}};Ms.binary=rh});var fi=g(di=>{"use strict";var ui=P(),zn=Ae(),ih=j(),nh=Ie();function Fs(e,t){if(ui.isSeq(e))for(let r=0;r<e.items.length;++r){let i=e.items[r];if(!ui.isPair(i)){if(ui.isMap(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");let n=i.items[0]||new zn.Pair(new ih.Scalar(null));if(i.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${i.commentBefore}
54
+ ${n}${p}`}else return`${f}${o}${d.join(" ")}${o}${p}`}function ii({indent:e,options:{commentString:t}},r,i,n){if(i&&n&&(i=i.replace(/^\n+/,"")),i){let a=ri.indentComment(t(i),e);r.push(a.trimStart())}}Ps.stringifyCollection=Tf});var $e=g(Bn=>{"use strict";var $f=Dn(),Of=On(),Hf=qr(),je=P(),ni=Ie(),Df=$();function Ft(e,t){let r=je.isScalar(t)?t.value:t;for(let i of e)if(je.isPair(i)&&(i.key===t||i.key===r||je.isScalar(i.key)&&i.key.value===r))return i}var Ln=class extends Hf.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(je.MAP,t),this.items=[]}static from(t,r,i){let{keepUndefined:n,replacer:a}=i,o=new this(t),s=(c,l)=>{if(typeof a=="function")l=a.call(r,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||n)&&o.items.push(ni.createPair(c,l,i))};if(r instanceof Map)for(let[c,l]of r)s(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))s(c,r[c]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,r){let i;je.isPair(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new ni.Pair(t,t?.value):i=new ni.Pair(t.key,t.value);let n=Ft(this.items,i.key),a=this.schema?.sortMapEntries;if(n){if(!r)throw new Error(`Key ${i.key} already set`);je.isScalar(n.value)&&Df.isScalarValue(i.value)?n.value.value=i.value:n.value=i.value}else if(a){let o=this.items.findIndex(s=>a(i,s)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(t){let r=Ft(this.items,t);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(t,r){let n=Ft(this.items,t)?.value;return(!r&&je.isScalar(n)?n.value:n)??void 0}has(t){return!!Ft(this.items,t)}set(t,r){this.add(new ni.Pair(t,r),!0)}toJSON(t,r,i){let n=i?new i:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(n);for(let a of this.items)Of.addPairToJSMap(r,n,a);return n}toString(t,r,i){if(!t)return JSON.stringify(this);for(let n of this.items)if(!je.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),$f.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:r})}};Bn.YAMLMap=Ln;Bn.findPair=Ft});var ct=g(Rs=>{"use strict";var Lf=P(),xs=$e(),Bf={collection:"map",default:!0,nodeClass:xs.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return Lf.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,r)=>xs.YAMLMap.from(e,t,r)};Rs.map=Bf});var Oe=g(As=>{"use strict";var Mf=$t(),Ff=Dn(),Vf=qr(),oi=P(),qf=$(),Wf=Re(),Mn=class extends Vf.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(oi.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let r=ai(t);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(t,r){let i=ai(t);if(typeof i!="number")return;let n=this.items[i];return!r&&oi.isScalar(n)?n.value:n}has(t){let r=ai(t);return typeof r=="number"&&r<this.items.length}set(t,r){let i=ai(t);if(typeof i!="number")throw new Error(`Expected a valid index, not ${t}.`);let n=this.items[i];oi.isScalar(n)&&qf.isScalarValue(r)?n.value=r:this.items[i]=r}toJSON(t,r){let i=[];r?.onCreate&&r.onCreate(i);let n=0;for(let a of this.items)i.push(Wf.toJS(a,String(n++),r));return i}toString(t,r,i){return t?Ff.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:i,onComment:r}):JSON.stringify(this)}static from(t,r,i){let{replacer:n}=i,a=new this(t);if(r&&Symbol.iterator in Object(r)){let o=0;for(let s of r){if(typeof n=="function"){let c=r instanceof Set?s:String(o++);s=n.call(r,c,s)}a.items.push(Mf.createNode(s,void 0,i))}}return a}};function ai(e){let t=oi.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}As.YAMLSeq=Mn});var lt=g(Ts=>{"use strict";var zf=P(),_s=Oe(),Jf={collection:"seq",default:!0,nodeClass:_s.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return zf.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,r)=>_s.YAMLSeq.from(e,t,r)};Ts.seq=Jf});var Vt=g(Is=>{"use strict";var Gf=Lt(),Uf={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,r,i){return t=Object.assign({actualString:!0},t),Gf.stringifyString(e,t,r,i)}};Is.string=Uf});var si=g(Os=>{"use strict";var js=$(),$s={identify:e=>e==null,createNode:()=>new js.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new js.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&$s.test.test(e)?e:t.options.nullStr};Os.nullTag=$s});var Fn=g(Ds=>{"use strict";var Kf=$(),Hs={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Kf.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},r){if(e&&Hs.test.test(e)){let i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?r.options.trueStr:r.options.falseStr}};Ds.boolTag=Hs});var ut=g(Ls=>{"use strict";function Yf({format:e,minFractionDigits:t,tag:r,value:i}){if(typeof i=="bigint")return String(i);let n=typeof i=="number"?i:Number(i);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let a=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=t-(a.length-o-1);for(;s-- >0;)a+="0"}return a}Ls.stringifyNumber=Yf});var qn=g(ci=>{"use strict";var Xf=$(),Vn=ut(),Qf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Vn.stringifyNumber},Zf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Vn.stringifyNumber(e)}},eh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Xf.Scalar(parseFloat(e)),r=e.indexOf(".");return r!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-r-1),t},stringify:Vn.stringifyNumber};ci.float=eh;ci.floatExp=Zf;ci.floatNaN=Qf});var zn=g(ui=>{"use strict";var Bs=ut(),li=e=>typeof e=="bigint"||Number.isInteger(e),Wn=(e,t,r,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),r);function Ms(e,t,r){let{value:i}=e;return li(i)&&i>=0?r+i.toString(t):Bs.stringifyNumber(e)}var th={identify:e=>li(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>Wn(e,2,8,r),stringify:e=>Ms(e,8,"0o")},rh={identify:li,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>Wn(e,0,10,r),stringify:Bs.stringifyNumber},ih={identify:e=>li(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>Wn(e,2,16,r),stringify:e=>Ms(e,16,"0x")};ui.int=rh;ui.intHex=ih;ui.intOct=th});var Vs=g(Fs=>{"use strict";var nh=ct(),ah=si(),oh=lt(),sh=Vt(),ch=Fn(),Jn=qn(),Gn=zn(),lh=[nh.map,oh.seq,sh.string,ah.nullTag,ch.boolTag,Gn.intOct,Gn.int,Gn.intHex,Jn.floatNaN,Jn.floatExp,Jn.float];Fs.schema=lh});var zs=g(Ws=>{"use strict";var uh=$(),dh=ct(),fh=lt();function qs(e){return typeof e=="bigint"||Number.isInteger(e)}var di=({value:e})=>JSON.stringify(e),hh=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:di},{identify:e=>e==null,createNode:()=>new uh.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:di},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:di},{identify:qs,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:r})=>r?BigInt(e):parseInt(e,10),stringify:({value:e})=>qs(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:di}],ph={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},mh=[dh.map,fh.seq].concat(hh,ph);Ws.schema=mh});var Kn=g(Js=>{"use strict";var qt=$r("buffer"),Un=$(),vh=Lt(),gh={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof qt.Buffer=="function")return qt.Buffer.from(e,"base64");if(typeof atob=="function"){let r=atob(e.replace(/[\n\r]/g,"")),i=new Uint8Array(r.length);for(let n=0;n<r.length;++n)i[n]=r.charCodeAt(n);return i}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:r},i,n,a){if(!r)return"";let o=r,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(t??(t=Un.Scalar.BLOCK_LITERAL),t!==Un.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(s.length/c),u=new Array(l);for(let d=0,f=0;d<l;++d,f+=c)u[d]=s.substr(f,c);s=u.join(t===Un.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return vh.stringifyString({comment:e,type:t,value:s},i,n,a)}};Js.binary=gh});var pi=g(hi=>{"use strict";var fi=P(),Yn=Ie(),wh=$(),yh=Oe();function Gs(e,t){if(fi.isSeq(e))for(let r=0;r<e.items.length;++r){let i=e.items[r];if(!fi.isPair(i)){if(fi.isMap(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");let n=i.items[0]||new Yn.Pair(new wh.Scalar(null));if(i.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${i.commentBefore}
56
56
  ${n.key.commentBefore}`:i.commentBefore),i.comment){let a=n.value??n.key;a.comment=a.comment?`${i.comment}
57
- ${a.comment}`:i.comment}i=n}e.items[r]=ui.isPair(i)?i:new zn.Pair(i)}}else t("Expected a sequence for this tag");return e}function Vs(e,t,r){let{replacer:i}=r,n=new nh.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let a=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof i=="function"&&(o=i.call(t,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;n.items.push(zn.createPair(s,c,r))}return n}var ah={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Fs,createNode:Vs};di.createPairs=Vs;di.pairs=ah;di.resolvePairs=Fs});var Un=g(Gn=>{"use strict";var qs=P(),Jn=Pe(),Ft=Te(),oh=Ie(),Ws=fi(),ze=class e extends oh.YAMLSeq{constructor(){super(),this.add=Ft.YAMLMap.prototype.add.bind(this),this.delete=Ft.YAMLMap.prototype.delete.bind(this),this.get=Ft.YAMLMap.prototype.get.bind(this),this.has=Ft.YAMLMap.prototype.has.bind(this),this.set=Ft.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,r){if(!r)return super.toJSON(t);let i=new Map;r?.onCreate&&r.onCreate(i);for(let n of this.items){let a,o;if(qs.isPair(n)?(a=Jn.toJS(n.key,"",r),o=Jn.toJS(n.value,a,r)):a=Jn.toJS(n,"",r),i.has(a))throw new Error("Ordered maps must not include duplicate keys");i.set(a,o)}return i}static from(t,r,i){let n=Ws.createPairs(t,r,i),a=new this;return a.items=n.items,a}};ze.tag="tag:yaml.org,2002:omap";var sh={collection:"seq",identify:e=>e instanceof Map,nodeClass:ze,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=Ws.resolvePairs(e,t),i=[];for(let{key:n}of r.items)qs.isScalar(n)&&(i.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):i.push(n.value));return Object.assign(new ze,r)},createNode:(e,t,r)=>ze.from(e,t,r)};Gn.YAMLOMap=ze;Gn.omap=sh});var Ks=g(Kn=>{"use strict";var zs=j();function Js({value:e,source:t},r){return t&&(e?Gs:Us).test.test(t)?t:e?r.options.trueStr:r.options.falseStr}var Gs={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new zs.Scalar(!0),stringify:Js},Us={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new zs.Scalar(!1),stringify:Js};Kn.falseTag=Us;Kn.trueTag=Gs});var Ys=g(hi=>{"use strict";var ch=j(),Yn=ct(),lh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Yn.stringifyNumber},uh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Yn.stringifyNumber(e)}},dh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new ch.Scalar(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){let i=e.substring(r+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:Yn.stringifyNumber};hi.float=dh;hi.floatExp=uh;hi.floatNaN=lh});var Qs=g(qt=>{"use strict";var Xs=ct(),Vt=e=>typeof e=="bigint"||Number.isInteger(e);function pi(e,t,r,{intAsBigInt:i}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return n==="-"?BigInt(-1)*o:o}let a=parseInt(e,r);return n==="-"?-1*a:a}function Xn(e,t,r){let{value:i}=e;if(Vt(i)){let n=i.toString(t);return i<0?"-"+r+n.substr(1):r+n}return Xs.stringifyNumber(e)}var fh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>pi(e,2,2,r),stringify:e=>Xn(e,2,"0b")},hh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>pi(e,1,8,r),stringify:e=>Xn(e,8,"0")},ph={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>pi(e,0,10,r),stringify:Xs.stringifyNumber},mh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>pi(e,2,16,r),stringify:e=>Xn(e,16,"0x")};qt.int=ph;qt.intBin=fh;qt.intHex=mh;qt.intOct=hh});var Zn=g(Qn=>{"use strict";var gi=P(),mi=Ae(),vi=Te(),Je=class e extends vi.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let r;gi.isPair(t)?r=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?r=new mi.Pair(t.key,null):r=new mi.Pair(t,null),vi.findPair(this.items,r.key)||this.items.push(r)}get(t,r){let i=vi.findPair(this.items,t);return!r&&gi.isPair(i)?gi.isScalar(i.key)?i.key.value:i.key:i}set(t,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let i=vi.findPair(this.items,t);i&&!r?this.items.splice(this.items.indexOf(i),1):!i&&r&&this.items.push(new mi.Pair(t))}toJSON(t,r){return super.toJSON(t,r,Set)}toString(t,r,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),r,i);throw new Error("Set items must all have null values")}static from(t,r,i){let{replacer:n}=i,a=new this(t);if(r&&Symbol.iterator in Object(r))for(let o of r)typeof n=="function"&&(o=n.call(r,o,o)),a.items.push(mi.createPair(o,null,i));return a}};Je.tag="tag:yaml.org,2002:set";var vh={collection:"map",identify:e=>e instanceof Set,nodeClass:Je,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>Je.from(e,t,r),resolve(e,t){if(gi.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Je,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Qn.YAMLSet=Je;Qn.set=vh});var ta=g(wi=>{"use strict";var gh=ct();function ea(e,t){let r=e[0],i=r==="-"||r==="+"?e.substring(1):e,n=o=>t?BigInt(o):Number(o),a=i.replace(/_/g,"").split(":").reduce((o,s)=>o*n(60)+n(s),n(0));return r==="-"?n(-1)*a:a}function Zs(e){let{value:t}=e,r=o=>o;if(typeof t=="bigint")r=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return gh.stringifyNumber(e);let i="";t<0&&(i="-",t*=r(-1));let n=r(60),a=[t%n];return t<60?a.unshift(0):(t=(t-a[0])/n,a.unshift(t%n),t>=60&&(t=(t-a[0])/n,a.unshift(t))),i+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var wh={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>ea(e,r),stringify:Zs},yh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>ea(e,!1),stringify:Zs},ec={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(ec.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,i,n,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(r,i-1,n,a||0,o||0,s||0,c),u=t[8];if(u&&u!=="Z"){let d=ea(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};wi.floatTime=yh;wi.intTime=wh;wi.timestamp=ec});var ic=g(rc=>{"use strict";var Nh=ot(),bh=ai(),kh=st(),Sh=Lt(),Eh=Wn(),tc=Ks(),ra=Ys(),yi=Qs(),Ph=Xr(),Ch=Un(),xh=fi(),Rh=Zn(),ia=ta(),Ah=[Nh.map,kh.seq,Sh.string,bh.nullTag,tc.trueTag,tc.falseTag,yi.intBin,yi.intOct,yi.int,yi.intHex,ra.floatNaN,ra.floatExp,ra.float,Eh.binary,Ph.merge,Ch.omap,xh.pairs,Rh.set,ia.intTime,ia.floatTime,ia.timestamp];rc.schema=Ah});var hc=g(oa=>{"use strict";var sc=ot(),_h=ai(),cc=st(),Th=Lt(),Ih=Hn(),na=Bn(),aa=Mn(),jh=Hs(),$h=Ls(),lc=Wn(),Wt=Xr(),uc=Un(),dc=fi(),nc=ic(),fc=Zn(),Ni=ta(),ac=new Map([["core",jh.schema],["failsafe",[sc.map,cc.seq,Th.string]],["json",$h.schema],["yaml11",nc.schema],["yaml-1.1",nc.schema]]),oc={binary:lc.binary,bool:Ih.boolTag,float:na.float,floatExp:na.floatExp,floatNaN:na.floatNaN,floatTime:Ni.floatTime,int:aa.int,intHex:aa.intHex,intOct:aa.intOct,intTime:Ni.intTime,map:sc.map,merge:Wt.merge,null:_h.nullTag,omap:uc.omap,pairs:dc.pairs,seq:cc.seq,set:fc.set,timestamp:Ni.timestamp},Oh={"tag:yaml.org,2002:binary":lc.binary,"tag:yaml.org,2002:merge":Wt.merge,"tag:yaml.org,2002:omap":uc.omap,"tag:yaml.org,2002:pairs":dc.pairs,"tag:yaml.org,2002:set":fc.set,"tag:yaml.org,2002:timestamp":Ni.timestamp};function Hh(e,t,r){let i=ac.get(t);if(i&&!e)return r&&!i.includes(Wt.merge)?i.concat(Wt.merge):i.slice();let n=i;if(!n)if(Array.isArray(e))n=[];else{let a=Array.from(ac.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${a} or define customTags array`)}if(Array.isArray(e))for(let a of e)n=n.concat(a);else typeof e=="function"&&(n=e(n.slice()));return r&&(n=n.concat(Wt.merge)),n.reduce((a,o)=>{let s=typeof o=="string"?oc[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(oc).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}oa.coreKnownTags=Oh;oa.getTags=Hh});var la=g(pc=>{"use strict";var sa=P(),Dh=ot(),Bh=st(),Lh=Lt(),bi=hc(),Mh=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,ca=class e{constructor({compat:t,customTags:r,merge:i,resolveKnownTags:n,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(t)?bi.getTags(t,"compat"):t?bi.getTags(null,t):null,this.name=typeof a=="string"&&a||"core",this.knownTags=n?bi.coreKnownTags:{},this.tags=bi.getTags(r,this.name,i),this.toStringOptions=s??null,Object.defineProperty(this,sa.MAP,{value:Dh.map}),Object.defineProperty(this,sa.SCALAR,{value:Lh.string}),Object.defineProperty(this,sa.SEQ,{value:Bh.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Mh:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};pc.Schema=ca});var vc=g(mc=>{"use strict";var Fh=P(),ua=Ht(),zt=It();function Vh(e,t){let r=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(r.push(c),i=!0):e.directives.docStart&&(i=!0)}i&&r.push("---");let n=ua.createStringifyContext(e,t),{commentString:a}=n.options;if(e.commentBefore){r.length!==1&&r.unshift("");let c=a(e.commentBefore);r.unshift(zt.indentComment(c,""))}let o=!1,s=null;if(e.contents){if(Fh.isNode(e.contents)){if(e.contents.spaceBefore&&i&&r.push(""),e.contents.commentBefore){let u=a(e.contents.commentBefore);r.push(zt.indentComment(u,""))}n.forceBlockIndent=!!e.comment,s=e.contents.comment}let c=s?void 0:()=>o=!0,l=ua.stringify(e.contents,n,()=>s=null,c);s&&(l+=zt.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(ua.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let c=a(e.comment);c.includes(`
58
- `)?(r.push("..."),r.push(zt.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=e.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&r[r.length-1]!==""&&r.push(""),r.push(zt.indentComment(a(c),"")))}return r.join(`
57
+ ${a.comment}`:i.comment}i=n}e.items[r]=fi.isPair(i)?i:new Yn.Pair(i)}}else t("Expected a sequence for this tag");return e}function Us(e,t,r){let{replacer:i}=r,n=new yh.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let a=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof i=="function"&&(o=i.call(t,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;n.items.push(Yn.createPair(s,c,r))}return n}var Nh={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Gs,createNode:Us};hi.createPairs=Us;hi.pairs=Nh;hi.resolvePairs=Gs});var Zn=g(Qn=>{"use strict";var Ks=P(),Xn=Re(),Wt=$e(),bh=Oe(),Ys=pi(),Ge=class e extends bh.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=e.tag}toJSON(t,r){if(!r)return super.toJSON(t);let i=new Map;r?.onCreate&&r.onCreate(i);for(let n of this.items){let a,o;if(Ks.isPair(n)?(a=Xn.toJS(n.key,"",r),o=Xn.toJS(n.value,a,r)):a=Xn.toJS(n,"",r),i.has(a))throw new Error("Ordered maps must not include duplicate keys");i.set(a,o)}return i}static from(t,r,i){let n=Ys.createPairs(t,r,i),a=new this;return a.items=n.items,a}};Ge.tag="tag:yaml.org,2002:omap";var kh={collection:"seq",identify:e=>e instanceof Map,nodeClass:Ge,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=Ys.resolvePairs(e,t),i=[];for(let{key:n}of r.items)Ks.isScalar(n)&&(i.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):i.push(n.value));return Object.assign(new Ge,r)},createNode:(e,t,r)=>Ge.from(e,t,r)};Qn.YAMLOMap=Ge;Qn.omap=kh});var tc=g(ea=>{"use strict";var Xs=$();function Qs({value:e,source:t},r){return t&&(e?Zs:ec).test.test(t)?t:e?r.options.trueStr:r.options.falseStr}var Zs={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Xs.Scalar(!0),stringify:Qs},ec={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Xs.Scalar(!1),stringify:Qs};ea.falseTag=ec;ea.trueTag=Zs});var rc=g(mi=>{"use strict";var Sh=$(),ta=ut(),Eh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ta.stringifyNumber},Ch={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():ta.stringifyNumber(e)}},Ph={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Sh.Scalar(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){let i=e.substring(r+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:ta.stringifyNumber};mi.float=Ph;mi.floatExp=Ch;mi.floatNaN=Eh});var nc=g(Jt=>{"use strict";var ic=ut(),zt=e=>typeof e=="bigint"||Number.isInteger(e);function vi(e,t,r,{intAsBigInt:i}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return n==="-"?BigInt(-1)*o:o}let a=parseInt(e,r);return n==="-"?-1*a:a}function ra(e,t,r){let{value:i}=e;if(zt(i)){let n=i.toString(t);return i<0?"-"+r+n.substr(1):r+n}return ic.stringifyNumber(e)}var xh={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>vi(e,2,2,r),stringify:e=>ra(e,2,"0b")},Rh={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>vi(e,1,8,r),stringify:e=>ra(e,8,"0")},Ah={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>vi(e,0,10,r),stringify:ic.stringifyNumber},_h={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>vi(e,2,16,r),stringify:e=>ra(e,16,"0x")};Jt.int=Ah;Jt.intBin=xh;Jt.intHex=_h;Jt.intOct=Rh});var na=g(ia=>{"use strict";var yi=P(),gi=Ie(),wi=$e(),Ue=class e extends wi.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let r;yi.isPair(t)?r=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?r=new gi.Pair(t.key,null):r=new gi.Pair(t,null),wi.findPair(this.items,r.key)||this.items.push(r)}get(t,r){let i=wi.findPair(this.items,t);return!r&&yi.isPair(i)?yi.isScalar(i.key)?i.key.value:i.key:i}set(t,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let i=wi.findPair(this.items,t);i&&!r?this.items.splice(this.items.indexOf(i),1):!i&&r&&this.items.push(new gi.Pair(t))}toJSON(t,r){return super.toJSON(t,r,Set)}toString(t,r,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),r,i);throw new Error("Set items must all have null values")}static from(t,r,i){let{replacer:n}=i,a=new this(t);if(r&&Symbol.iterator in Object(r))for(let o of r)typeof n=="function"&&(o=n.call(r,o,o)),a.items.push(gi.createPair(o,null,i));return a}};Ue.tag="tag:yaml.org,2002:set";var Th={collection:"map",identify:e=>e instanceof Set,nodeClass:Ue,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>Ue.from(e,t,r),resolve(e,t){if(yi.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Ue,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};ia.YAMLSet=Ue;ia.set=Th});var oa=g(Ni=>{"use strict";var Ih=ut();function aa(e,t){let r=e[0],i=r==="-"||r==="+"?e.substring(1):e,n=o=>t?BigInt(o):Number(o),a=i.replace(/_/g,"").split(":").reduce((o,s)=>o*n(60)+n(s),n(0));return r==="-"?n(-1)*a:a}function ac(e){let{value:t}=e,r=o=>o;if(typeof t=="bigint")r=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Ih.stringifyNumber(e);let i="";t<0&&(i="-",t*=r(-1));let n=r(60),a=[t%n];return t<60?a.unshift(0):(t=(t-a[0])/n,a.unshift(t%n),t>=60&&(t=(t-a[0])/n,a.unshift(t))),i+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var jh={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>aa(e,r),stringify:ac},$h={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>aa(e,!1),stringify:ac},oc={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(oc.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,i,n,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(r,i-1,n,a||0,o||0,s||0,c),u=t[8];if(u&&u!=="Z"){let d=aa(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Ni.floatTime=$h;Ni.intTime=jh;Ni.timestamp=oc});var lc=g(cc=>{"use strict";var Oh=ct(),Hh=si(),Dh=lt(),Lh=Vt(),Bh=Kn(),sc=tc(),sa=rc(),bi=nc(),Mh=Zr(),Fh=Zn(),Vh=pi(),qh=na(),ca=oa(),Wh=[Oh.map,Dh.seq,Lh.string,Hh.nullTag,sc.trueTag,sc.falseTag,bi.intBin,bi.intOct,bi.int,bi.intHex,sa.floatNaN,sa.floatExp,sa.float,Bh.binary,Mh.merge,Fh.omap,Vh.pairs,qh.set,ca.intTime,ca.floatTime,ca.timestamp];cc.schema=Wh});var yc=g(da=>{"use strict";var hc=ct(),zh=si(),pc=lt(),Jh=Vt(),Gh=Fn(),la=qn(),ua=zn(),Uh=Vs(),Kh=zs(),mc=Kn(),Gt=Zr(),vc=Zn(),gc=pi(),uc=lc(),wc=na(),ki=oa(),dc=new Map([["core",Uh.schema],["failsafe",[hc.map,pc.seq,Jh.string]],["json",Kh.schema],["yaml11",uc.schema],["yaml-1.1",uc.schema]]),fc={binary:mc.binary,bool:Gh.boolTag,float:la.float,floatExp:la.floatExp,floatNaN:la.floatNaN,floatTime:ki.floatTime,int:ua.int,intHex:ua.intHex,intOct:ua.intOct,intTime:ki.intTime,map:hc.map,merge:Gt.merge,null:zh.nullTag,omap:vc.omap,pairs:gc.pairs,seq:pc.seq,set:wc.set,timestamp:ki.timestamp},Yh={"tag:yaml.org,2002:binary":mc.binary,"tag:yaml.org,2002:merge":Gt.merge,"tag:yaml.org,2002:omap":vc.omap,"tag:yaml.org,2002:pairs":gc.pairs,"tag:yaml.org,2002:set":wc.set,"tag:yaml.org,2002:timestamp":ki.timestamp};function Xh(e,t,r){let i=dc.get(t);if(i&&!e)return r&&!i.includes(Gt.merge)?i.concat(Gt.merge):i.slice();let n=i;if(!n)if(Array.isArray(e))n=[];else{let a=Array.from(dc.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${a} or define customTags array`)}if(Array.isArray(e))for(let a of e)n=n.concat(a);else typeof e=="function"&&(n=e(n.slice()));return r&&(n=n.concat(Gt.merge)),n.reduce((a,o)=>{let s=typeof o=="string"?fc[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(fc).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}da.coreKnownTags=Yh;da.getTags=Xh});var pa=g(Nc=>{"use strict";var fa=P(),Qh=ct(),Zh=lt(),ep=Vt(),Si=yc(),tp=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,ha=class e{constructor({compat:t,customTags:r,merge:i,resolveKnownTags:n,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(t)?Si.getTags(t,"compat"):t?Si.getTags(null,t):null,this.name=typeof a=="string"&&a||"core",this.knownTags=n?Si.coreKnownTags:{},this.tags=Si.getTags(r,this.name,i),this.toStringOptions=s??null,Object.defineProperty(this,fa.MAP,{value:Qh.map}),Object.defineProperty(this,fa.SCALAR,{value:ep.string}),Object.defineProperty(this,fa.SEQ,{value:Zh.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?tp:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Nc.Schema=ha});var kc=g(bc=>{"use strict";var rp=P(),ma=Bt(),Ut=Ot();function ip(e,t){let r=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(r.push(c),i=!0):e.directives.docStart&&(i=!0)}i&&r.push("---");let n=ma.createStringifyContext(e,t),{commentString:a}=n.options;if(e.commentBefore){r.length!==1&&r.unshift("");let c=a(e.commentBefore);r.unshift(Ut.indentComment(c,""))}let o=!1,s=null;if(e.contents){if(rp.isNode(e.contents)){if(e.contents.spaceBefore&&i&&r.push(""),e.contents.commentBefore){let u=a(e.contents.commentBefore);r.push(Ut.indentComment(u,""))}n.forceBlockIndent=!!e.comment,s=e.contents.comment}let c=s?void 0:()=>o=!0,l=ma.stringify(e.contents,n,()=>s=null,c);s&&(l+=Ut.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(ma.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let c=a(e.comment);c.includes(`
58
+ `)?(r.push("..."),r.push(Ut.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=e.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&r[r.length-1]!==""&&r.push(""),r.push(Ut.indentComment(a(c),"")))}return r.join(`
59
59
  `)+`
60
- `}mc.stringifyDocument=Vh});var Jt=g(gc=>{"use strict";var qh=_t(),lt=Fr(),X=P(),Wh=Ae(),zh=Pe(),Jh=la(),Gh=vc(),da=Dr(),Uh=mn(),Kh=Tt(),fa=pn(),ha=class e{constructor(t,r,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,X.NODE_TYPE,{value:X.DOC});let n=null;typeof r=="function"||Array.isArray(r)?n=r:i===void 0&&r&&(i=r,r=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=a;let{version:o}=a;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new fa.Directives({version:o}),this.setSchema(o,i),this.contents=t===void 0?null:this.createNode(t,n,i)}clone(){let t=Object.create(e.prototype,{[X.NODE_TYPE]:{value:X.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=X.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){ut(this.contents)&&this.contents.add(t)}addIn(t,r){ut(this.contents)&&this.contents.addIn(t,r)}createAlias(t,r){if(!t.anchor){let i=da.anchorNames(this);t.anchor=!r||i.has(r)?da.findNewAnchor(r||"a",i):r}return new qh.Alias(t.anchor)}createNode(t,r,i){let n;if(typeof r=="function")t=r.call({"":t},"",t),n=r;else if(Array.isArray(r)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=r.filter(m).map(String);w.length>0&&(r=r.concat(w)),n=r}else i===void 0&&r&&(i=r,r=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:u}=i??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=da.createNodeAnchors(this,o||"a"),v={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:p},h=Kh.createNode(t,u,v);return s&&X.isCollection(h)&&(h.flow=!0),f(),h}createPair(t,r,i={}){let n=this.createNode(t,null,i),a=this.createNode(r,null,i);return new Wh.Pair(n,a)}delete(t){return ut(this.contents)?this.contents.delete(t):!1}deleteIn(t){return lt.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):ut(this.contents)?this.contents.deleteIn(t):!1}get(t,r){return X.isCollection(this.contents)?this.contents.get(t,r):void 0}getIn(t,r){return lt.isEmptyPath(t)?!r&&X.isScalar(this.contents)?this.contents.value:this.contents:X.isCollection(this.contents)?this.contents.getIn(t,r):void 0}has(t){return X.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return lt.isEmptyPath(t)?this.contents!==void 0:X.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,r){this.contents==null?this.contents=lt.collectionFromPath(this.schema,[t],r):ut(this.contents)&&this.contents.set(t,r)}setIn(t,r){lt.isEmptyPath(t)?this.contents=r:this.contents==null?this.contents=lt.collectionFromPath(this.schema,Array.from(t),r):ut(this.contents)&&this.contents.setIn(t,r)}setSchema(t,r={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new fa.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new fa.Directives({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let n=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(i)this.schema=new Jh.Schema(Object.assign(i,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:r,mapAsMap:i,maxAliasCount:n,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=zh.toJS(this.contents,r??"",s);if(typeof a=="function")for(let{count:l,res:u}of s.anchors.values())a(u,l);return typeof o=="function"?Uh.applyReviver(o,{"":c},"",c):c}toJSON(t,r){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:r})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let r=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Gh.stringifyDocument(this,t)}};function ut(e){if(X.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}gc.Document=ha});var Kt=g(Ut=>{"use strict";var Gt=class extends Error{constructor(t,r,i,n){super(),this.name=t,this.code=i,this.message=n,this.pos=r}},pa=class extends Gt{constructor(t,r,i){super("YAMLParseError",t,r,i)}},ma=class extends Gt{constructor(t,r,i){super("YAMLWarning",t,r,i)}},Yh=(e,t)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(s=>t.linePos(s));let{line:i,col:n}=r.linePos[0];r.message+=` at line ${i}, column ${n}`;let a=n-1,o=e.substring(t.lineStarts[i-1],t.lineStarts[i]).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)+"…"),i>1&&/^ *$/.test(o.substring(0,a))){let s=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);s.length>80&&(s=s.substring(0,79)+`…
60
+ `}bc.stringifyDocument=ip});var Kt=g(Sc=>{"use strict";var np=jt(),dt=qr(),Q=P(),ap=Ie(),op=Re(),sp=pa(),cp=kc(),va=Br(),lp=Nn(),up=$t(),ga=yn(),wa=class e{constructor(t,r,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Q.NODE_TYPE,{value:Q.DOC});let n=null;typeof r=="function"||Array.isArray(r)?n=r:i===void 0&&r&&(i=r,r=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=a;let{version:o}=a;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ga.Directives({version:o}),this.setSchema(o,i),this.contents=t===void 0?null:this.createNode(t,n,i)}clone(){let t=Object.create(e.prototype,{[Q.NODE_TYPE]:{value:Q.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Q.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){ft(this.contents)&&this.contents.add(t)}addIn(t,r){ft(this.contents)&&this.contents.addIn(t,r)}createAlias(t,r){if(!t.anchor){let i=va.anchorNames(this);t.anchor=!r||i.has(r)?va.findNewAnchor(r||"a",i):r}return new np.Alias(t.anchor)}createNode(t,r,i){let n;if(typeof r=="function")t=r.call({"":t},"",t),n=r;else if(Array.isArray(r)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=r.filter(m).map(String);w.length>0&&(r=r.concat(w)),n=r}else i===void 0&&r&&(i=r,r=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:u}=i??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=va.createNodeAnchors(this,o||"a"),v={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:p},h=up.createNode(t,u,v);return s&&Q.isCollection(h)&&(h.flow=!0),f(),h}createPair(t,r,i={}){let n=this.createNode(t,null,i),a=this.createNode(r,null,i);return new ap.Pair(n,a)}delete(t){return ft(this.contents)?this.contents.delete(t):!1}deleteIn(t){return dt.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):ft(this.contents)?this.contents.deleteIn(t):!1}get(t,r){return Q.isCollection(this.contents)?this.contents.get(t,r):void 0}getIn(t,r){return dt.isEmptyPath(t)?!r&&Q.isScalar(this.contents)?this.contents.value:this.contents:Q.isCollection(this.contents)?this.contents.getIn(t,r):void 0}has(t){return Q.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return dt.isEmptyPath(t)?this.contents!==void 0:Q.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,r){this.contents==null?this.contents=dt.collectionFromPath(this.schema,[t],r):ft(this.contents)&&this.contents.set(t,r)}setIn(t,r){dt.isEmptyPath(t)?this.contents=r:this.contents==null?this.contents=dt.collectionFromPath(this.schema,Array.from(t),r):ft(this.contents)&&this.contents.setIn(t,r)}setSchema(t,r={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ga.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new ga.Directives({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let n=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(i)this.schema=new sp.Schema(Object.assign(i,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:r,mapAsMap:i,maxAliasCount:n,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=op.toJS(this.contents,r??"",s);if(typeof a=="function")for(let{count:l,res:u}of s.anchors.values())a(u,l);return typeof o=="function"?lp.applyReviver(o,{"":c},"",c):c}toJSON(t,r){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:r})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let r=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return cp.stringifyDocument(this,t)}};function ft(e){if(Q.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}Sc.Document=wa});var Qt=g(Xt=>{"use strict";var Yt=class extends Error{constructor(t,r,i,n){super(),this.name=t,this.code=i,this.message=n,this.pos=r}},ya=class extends Yt{constructor(t,r,i){super("YAMLParseError",t,r,i)}},Na=class extends Yt{constructor(t,r,i){super("YAMLWarning",t,r,i)}},dp=(e,t)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(s=>t.linePos(s));let{line:i,col:n}=r.linePos[0];r.message+=` at line ${i}, column ${n}`;let a=n-1,o=e.substring(t.lineStarts[i-1],t.lineStarts[i]).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)+"…"),i>1&&/^ *$/.test(o.substring(0,a))){let s=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);s.length>80&&(s=s.substring(0,79)+`…
61
61
  `),o=s+o}if(/[^ ]/.test(o)){let s=1,c=r.linePos[1];c?.line===i&&c.col>n&&(s=Math.max(1,Math.min(c.col-n,80-a)));let l=" ".repeat(a)+"^".repeat(s);r.message+=`:
62
62
 
63
63
  ${o}
64
64
  ${l}
65
- `}};Ut.YAMLError=Gt;Ut.YAMLParseError=pa;Ut.YAMLWarning=ma;Ut.prettifyError=Yh});var Yt=g(wc=>{"use strict";function Xh(e,{flow:t,indicator:r,next:i,offset:n,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d="",f="",p=!1,v=!1,h=null,m=null,w=null,y=null,b=null,k=null,S=null;for(let N of e)switch(v&&(N.type!=="space"&&N.type!=="newline"&&N.type!=="comma"&&a(N.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),h&&(l&&N.type!=="comment"&&N.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),N.type){case"space":!t&&(r!=="doc-start"||i?.type!=="flow-collection")&&N.source.includes(" ")&&(h=N),u=!0;break;case"comment":{u||a(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let O=N.source.substring(1)||" ";d?d+=f+O:d=O,f="",l=!1;break}case"newline":l?d?d+=N.source:(!k||r!=="seq-item-ind")&&(c=!0):f+=N.source,l=!0,p=!0,(m||w)&&(y=N),u=!0;break;case"anchor":m&&a(N,"MULTIPLE_ANCHORS","A node can have at most one anchor"),N.source.endsWith(":")&&a(N.offset+N.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=N,S??(S=N.offset),l=!1,u=!1,v=!0;break;case"tag":{w&&a(N,"MULTIPLE_TAGS","A node can have at most one tag"),w=N,S??(S=N.offset),l=!1,u=!1,v=!0;break}case r:(m||w)&&a(N,"BAD_PROP_ORDER",`Anchors and tags must be after the ${N.source} indicator`),k&&a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.source} in ${t??"collection"}`),k=N,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(t){b&&a(N,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=N,l=!1,u=!1;break}default:a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.type} token`),l=!1,u=!1}let E=e[e.length-1],A=E?E.offset+E.source.length:n;return v&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&a(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:k,spaceBefore:c,comment:d,hasNewline:p,anchor:m,tag:w,newlineAfterProp:y,end:A,start:S??A}}wc.resolveProps=Xh});var ki=g(yc=>{"use strict";function va(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
66
- `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let r of t.start)if(r.type==="newline")return!0;if(t.sep){for(let r of t.sep)if(r.type==="newline")return!0}if(va(t.key)||va(t.value))return!0}return!1;default:return!0}}yc.containsNewline=va});var ga=g(Nc=>{"use strict";var Qh=ki();function Zh(e,t,r){if(t?.type==="flow-collection"){let i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&Qh.containsNewline(t)&&r(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Nc.flowIndentCheck=Zh});var wa=g(kc=>{"use strict";var bc=P();function ep(e,t,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let n=typeof i=="function"?i:(a,o)=>a===o||bc.isScalar(a)&&bc.isScalar(o)&&a.value===o.value;return t.some(a=>n(a.key,r))}kc.mapIncludes=ep});var Rc=g(xc=>{"use strict";var Sc=Ae(),tp=Te(),Ec=Yt(),rp=ki(),Pc=ga(),ip=wa(),Cc="All mapping items must start at the same column";function np({composeNode:e,composeEmptyNode:t},r,i,n,a){let o=a?.nodeClass??tp.YAMLMap,s=new o(r.schema);r.atRoot&&(r.atRoot=!1);let c=i.offset,l=null;for(let u of i.items){let{start:d,key:f,sep:p,value:v}=u,h=Ec.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:n,parentIndent:i.indent,startOnNewline:!0}),m=!h.found;if(m){if(f&&(f.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==i.indent&&n(c,"BAD_INDENT",Cc)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(s.comment?s.comment+=`
67
- `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||rp.containsNewline(f))&&n(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==i.indent&&n(c,"BAD_INDENT",Cc);r.atKey=!0;let w=h.end,y=f?e(r,f,h,n):t(r,w,d,null,h,n);r.schema.compat&&Pc.flowIndentCheck(i.indent,f,n),r.atKey=!1,ip.mapIncludes(r,s.items,y)&&n(w,"DUPLICATE_KEY","Map keys must be unique");let b=Ec.resolveProps(p??[],{indicator:"map-value-ind",next:v,offset:y.range[2],onError:n,parentIndent:i.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=b.end,b.found){m&&(v?.type==="block-map"&&!b.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start<b.found.offset-1024&&n(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=v?e(r,v,b,n):t(r,c,p,null,b,n);r.schema.compat&&Pc.flowIndentCheck(i.indent,v,n),c=k.range[2];let S=new Sc.Pair(y,k);r.options.keepSourceTokens&&(S.srcToken=u),s.items.push(S)}else{m&&n(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(y.comment?y.comment+=`
68
- `+b.comment:y.comment=b.comment);let k=new Sc.Pair(y);r.options.keepSourceTokens&&(k.srcToken=u),s.items.push(k)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[i.offset,c,l??c],s}xc.resolveBlockMap=np});var _c=g(Ac=>{"use strict";var ap=Ie(),op=Yt(),sp=ga();function cp({composeNode:e,composeEmptyNode:t},r,i,n,a){let o=a?.nodeClass??ap.YAMLSeq,s=new o(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=i.offset,l=null;for(let{start:u,value:d}of i.items){let f=op.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:n,parentIndent:i.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?n(f.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(s.comment=f.comment);continue}let p=d?e(r,d,f,n):t(r,f.end,u,null,f,n);r.schema.compat&&sp.flowIndentCheck(i.indent,d,n),c=p.range[2],s.items.push(p)}return s.range=[i.offset,c,l??c],s}Ac.resolveBlockSeq=cp});var dt=g(Tc=>{"use strict";function lp(e,t,r,i){let n="";if(e){let a=!1,o="";for(let s of e){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{r&&!a&&i(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";n?n+=o+u:n=u,o="";break}case"newline":n&&(o+=c),a=!0;break;default:i(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:n,offset:t}}Tc.resolveEnd=lp});var Oc=g($c=>{"use strict";var up=P(),dp=Ae(),Ic=Te(),fp=Ie(),hp=dt(),jc=Yt(),pp=ki(),mp=wa(),ya="Block collections are not allowed within flow collections",Na=e=>e&&(e.type==="block-map"||e.type==="block-seq");function vp({composeNode:e,composeEmptyNode:t},r,i,n,a){let o=i.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?Ic.YAMLMap:fp.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let w=i.items[m],{start:y,key:b,sep:k,value:S}=w,E=jc.resolveProps(y,{flow:s,indicator:"explicit-key-ind",next:b??k?.[0],offset:d,onError:n,parentIndent:i.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!k&&!S){m===0&&E.comma?n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):m<i.items.length-1&&n(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),E.comment&&(l.comment?l.comment+=`
69
- `+E.comment:l.comment=E.comment),d=E.end;continue}!o&&r.options.strict&&pp.containsNewline(b)&&n(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(E.comma||n(E.start,"MISSING_CHAR",`Missing , between ${s} items`),E.comment){let A="";e:for(let N of y)switch(N.type){case"comma":case"space":break;case"comment":A=N.source.substring(1);break e;default:break e}if(A){let N=l.items[l.items.length-1];up.isPair(N)&&(N=N.value??N.key),N.comment?N.comment+=`
70
- `+A:N.comment=A,E.comment=E.comment.substring(A.length+1)}}if(!o&&!k&&!E.found){let A=S?e(r,S,E,n):t(r,E.end,k,null,E,n);l.items.push(A),d=A.range[2],Na(S)&&n(A.range,"BLOCK_IN_FLOW",ya)}else{r.atKey=!0;let A=E.end,N=b?e(r,b,E,n):t(r,A,y,null,E,n);Na(b)&&n(N.range,"BLOCK_IN_FLOW",ya),r.atKey=!1;let O=jc.resolveProps(k??[],{flow:s,indicator:"map-value-ind",next:S,offset:N.range[2],onError:n,parentIndent:i.indent,startOnNewline:!1});if(O.found){if(!o&&!E.found&&r.options.strict){if(k)for(let H of k){if(H===O.found)break;if(H.type==="newline"){n(H,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<O.found.offset-1024&&n(O.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else S&&("source"in S&&S.source?.[0]===":"?n(S,"MISSING_CHAR",`Missing space after : in ${s}`):n(O.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let Ee=S?e(r,S,O,n):O.found?t(r,O.end,k,null,O,n):null;Ee?Na(S)&&n(Ee.range,"BLOCK_IN_FLOW",ya):O.comment&&(N.comment?N.comment+=`
71
- `+O.comment:N.comment=O.comment);let tt=new dp.Pair(N,Ee);if(r.options.keepSourceTokens&&(tt.srcToken=w),o){let H=l;mp.mapIncludes(r,H.items,N)&&n(A,"DUPLICATE_KEY","Map keys must be unique"),H.items.push(tt)}else{let H=new Ic.YAMLMap(r.schema);H.flow=!0,H.items.push(tt);let $o=(Ee??N).range;H.range=[N.range[0],$o[1],$o[2]],l.items.push(H)}d=Ee?Ee.range[2]:O.end}}let f=o?"}":"]",[p,...v]=i.end,h=d;if(p?.source===f)h=p.offset+p.source.length;else{let m=s[0].toUpperCase()+s.substring(1),w=u?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;n(d,u?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&v.unshift(p)}if(v.length>0){let m=hp.resolveEnd(v,h,r.options.strict,n);m.comment&&(l.comment?l.comment+=`
72
- `+m.comment:l.comment=m.comment),l.range=[i.offset,h,m.offset]}else l.range=[i.offset,h,h];return l}$c.resolveFlowCollection=vp});var Dc=g(Hc=>{"use strict";var gp=P(),wp=j(),yp=Te(),Np=Ie(),bp=Rc(),kp=_c(),Sp=Oc();function ba(e,t,r,i,n,a){let o=r.type==="block-map"?bp.resolveBlockMap(e,t,r,i,a):r.type==="block-seq"?kp.resolveBlockSeq(e,t,r,i,a):Sp.resolveFlowCollection(e,t,r,i,a),s=o.constructor;return n==="!"||n===s.tagName?(o.tag=s.tagName,o):(n&&(o.tag=n),o)}function Ep(e,t,r,i,n){let a=i.tag,o=a?t.directives.tagName(a.source,f=>n(a,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=i,v=f&&a?f.offset>a.offset?f:a:f??a;v&&(!p||p.offset<v.offset)&&n(v,"MISSING_CHAR","Missing newline after block sequence props")}let s=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!a||!o||o==="!"||o===yp.YAMLMap.tagName&&s==="map"||o===Np.YAMLSeq.tagName&&s==="seq")return ba(e,t,r,n,o);let c=t.schema.tags.find(f=>f.tag===o&&f.collection===s);if(!c){let f=t.schema.knownTags[o];if(f?.collection===s)t.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?n(a,"BAD_COLLECTION_TYPE",`${f.tag} used for ${s} collection, but expects ${f.collection??"scalar"}`,!0):n(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),ba(e,t,r,n,o)}let l=ba(e,t,r,n,o,c),u=c.resolve?.(l,f=>n(a,"TAG_RESOLVE_FAILED",f),t.options)??l,d=gp.isNode(u)?u:new wp.Scalar(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}Hc.composeCollection=Ep});var Sa=g(Bc=>{"use strict";var ka=j();function Pp(e,t,r){let i=t.offset,n=Cp(t,e.options.strict,r);if(!n)return{value:"",type:null,comment:"",range:[i,i,i]};let a=n.mode===">"?ka.Scalar.BLOCK_FOLDED:ka.Scalar.BLOCK_LITERAL,o=t.source?xp(t.source):[],s=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===""||m==="\r")s=h;else break}if(s===0){let h=n.chomp==="+"&&o.length>0?`
65
+ `}};Xt.YAMLError=Yt;Xt.YAMLParseError=ya;Xt.YAMLWarning=Na;Xt.prettifyError=dp});var Zt=g(Ec=>{"use strict";function fp(e,{flow:t,indicator:r,next:i,offset:n,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d="",f="",p=!1,v=!1,h=null,m=null,w=null,y=null,b=null,k=null,S=null;for(let N of e)switch(v&&(N.type!=="space"&&N.type!=="newline"&&N.type!=="comma"&&a(N.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),h&&(l&&N.type!=="comment"&&N.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),N.type){case"space":!t&&(r!=="doc-start"||i?.type!=="flow-collection")&&N.source.includes(" ")&&(h=N),u=!0;break;case"comment":{u||a(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let H=N.source.substring(1)||" ";d?d+=f+H:d=H,f="",l=!1;break}case"newline":l?d?d+=N.source:(!k||r!=="seq-item-ind")&&(c=!0):f+=N.source,l=!0,p=!0,(m||w)&&(y=N),u=!0;break;case"anchor":m&&a(N,"MULTIPLE_ANCHORS","A node can have at most one anchor"),N.source.endsWith(":")&&a(N.offset+N.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=N,S??(S=N.offset),l=!1,u=!1,v=!0;break;case"tag":{w&&a(N,"MULTIPLE_TAGS","A node can have at most one tag"),w=N,S??(S=N.offset),l=!1,u=!1,v=!0;break}case r:(m||w)&&a(N,"BAD_PROP_ORDER",`Anchors and tags must be after the ${N.source} indicator`),k&&a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.source} in ${t??"collection"}`),k=N,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(t){b&&a(N,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=N,l=!1,u=!1;break}default:a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.type} token`),l=!1,u=!1}let E=e[e.length-1],_=E?E.offset+E.source.length:n;return v&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&a(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:k,spaceBefore:c,comment:d,hasNewline:p,anchor:m,tag:w,newlineAfterProp:y,end:_,start:S??_}}Ec.resolveProps=fp});var Ei=g(Cc=>{"use strict";function ba(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
66
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let r of t.start)if(r.type==="newline")return!0;if(t.sep){for(let r of t.sep)if(r.type==="newline")return!0}if(ba(t.key)||ba(t.value))return!0}return!1;default:return!0}}Cc.containsNewline=ba});var ka=g(Pc=>{"use strict";var hp=Ei();function pp(e,t,r){if(t?.type==="flow-collection"){let i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&hp.containsNewline(t)&&r(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Pc.flowIndentCheck=pp});var Sa=g(Rc=>{"use strict";var xc=P();function mp(e,t,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let n=typeof i=="function"?i:(a,o)=>a===o||xc.isScalar(a)&&xc.isScalar(o)&&a.value===o.value;return t.some(a=>n(a.key,r))}Rc.mapIncludes=mp});var $c=g(jc=>{"use strict";var Ac=Ie(),vp=$e(),_c=Zt(),gp=Ei(),Tc=ka(),wp=Sa(),Ic="All mapping items must start at the same column";function yp({composeNode:e,composeEmptyNode:t},r,i,n,a){let o=a?.nodeClass??vp.YAMLMap,s=new o(r.schema);r.atRoot&&(r.atRoot=!1);let c=i.offset,l=null;for(let u of i.items){let{start:d,key:f,sep:p,value:v}=u,h=_c.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:n,parentIndent:i.indent,startOnNewline:!0}),m=!h.found;if(m){if(f&&(f.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==i.indent&&n(c,"BAD_INDENT",Ic)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(s.comment?s.comment+=`
67
+ `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||gp.containsNewline(f))&&n(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==i.indent&&n(c,"BAD_INDENT",Ic);r.atKey=!0;let w=h.end,y=f?e(r,f,h,n):t(r,w,d,null,h,n);r.schema.compat&&Tc.flowIndentCheck(i.indent,f,n),r.atKey=!1,wp.mapIncludes(r,s.items,y)&&n(w,"DUPLICATE_KEY","Map keys must be unique");let b=_c.resolveProps(p??[],{indicator:"map-value-ind",next:v,offset:y.range[2],onError:n,parentIndent:i.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=b.end,b.found){m&&(v?.type==="block-map"&&!b.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start<b.found.offset-1024&&n(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=v?e(r,v,b,n):t(r,c,p,null,b,n);r.schema.compat&&Tc.flowIndentCheck(i.indent,v,n),c=k.range[2];let S=new Ac.Pair(y,k);r.options.keepSourceTokens&&(S.srcToken=u),s.items.push(S)}else{m&&n(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(y.comment?y.comment+=`
68
+ `+b.comment:y.comment=b.comment);let k=new Ac.Pair(y);r.options.keepSourceTokens&&(k.srcToken=u),s.items.push(k)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[i.offset,c,l??c],s}jc.resolveBlockMap=yp});var Hc=g(Oc=>{"use strict";var Np=Oe(),bp=Zt(),kp=ka();function Sp({composeNode:e,composeEmptyNode:t},r,i,n,a){let o=a?.nodeClass??Np.YAMLSeq,s=new o(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=i.offset,l=null;for(let{start:u,value:d}of i.items){let f=bp.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:n,parentIndent:i.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?n(f.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(s.comment=f.comment);continue}let p=d?e(r,d,f,n):t(r,f.end,u,null,f,n);r.schema.compat&&kp.flowIndentCheck(i.indent,d,n),c=p.range[2],s.items.push(p)}return s.range=[i.offset,c,l??c],s}Oc.resolveBlockSeq=Sp});var ht=g(Dc=>{"use strict";function Ep(e,t,r,i){let n="";if(e){let a=!1,o="";for(let s of e){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{r&&!a&&i(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";n?n+=o+u:n=u,o="";break}case"newline":n&&(o+=c),a=!0;break;default:i(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:n,offset:t}}Dc.resolveEnd=Ep});var Fc=g(Mc=>{"use strict";var Cp=P(),Pp=Ie(),Lc=$e(),xp=Oe(),Rp=ht(),Bc=Zt(),Ap=Ei(),_p=Sa(),Ea="Block collections are not allowed within flow collections",Ca=e=>e&&(e.type==="block-map"||e.type==="block-seq");function Tp({composeNode:e,composeEmptyNode:t},r,i,n,a){let o=i.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?Lc.YAMLMap:xp.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let w=i.items[m],{start:y,key:b,sep:k,value:S}=w,E=Bc.resolveProps(y,{flow:s,indicator:"explicit-key-ind",next:b??k?.[0],offset:d,onError:n,parentIndent:i.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!k&&!S){m===0&&E.comma?n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):m<i.items.length-1&&n(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),E.comment&&(l.comment?l.comment+=`
69
+ `+E.comment:l.comment=E.comment),d=E.end;continue}!o&&r.options.strict&&Ap.containsNewline(b)&&n(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(E.comma||n(E.start,"MISSING_CHAR",`Missing , between ${s} items`),E.comment){let _="";e:for(let N of y)switch(N.type){case"comma":case"space":break;case"comment":_=N.source.substring(1);break e;default:break e}if(_){let N=l.items[l.items.length-1];Cp.isPair(N)&&(N=N.value??N.key),N.comment?N.comment+=`
70
+ `+_:N.comment=_,E.comment=E.comment.substring(_.length+1)}}if(!o&&!k&&!E.found){let _=S?e(r,S,E,n):t(r,E.end,k,null,E,n);l.items.push(_),d=_.range[2],Ca(S)&&n(_.range,"BLOCK_IN_FLOW",Ea)}else{r.atKey=!0;let _=E.end,N=b?e(r,b,E,n):t(r,_,y,null,E,n);Ca(b)&&n(N.range,"BLOCK_IN_FLOW",Ea),r.atKey=!1;let H=Bc.resolveProps(k??[],{flow:s,indicator:"map-value-ind",next:S,offset:N.range[2],onError:n,parentIndent:i.indent,startOnNewline:!1});if(H.found){if(!o&&!E.found&&r.options.strict){if(k)for(let D of k){if(D===H.found)break;if(D.type==="newline"){n(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<H.found.offset-1024&&n(H.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else S&&("source"in S&&S.source?.[0]===":"?n(S,"MISSING_CHAR",`Missing space after : in ${s}`):n(H.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let xe=S?e(r,S,H,n):H.found?t(r,H.end,k,null,H,n):null;xe?Ca(S)&&n(xe.range,"BLOCK_IN_FLOW",Ea):H.comment&&(N.comment?N.comment+=`
71
+ `+H.comment:N.comment=H.comment);let it=new Pp.Pair(N,xe);if(r.options.keepSourceTokens&&(it.srcToken=w),o){let D=l;_p.mapIncludes(r,D.items,N)&&n(_,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(it)}else{let D=new Lc.YAMLMap(r.schema);D.flow=!0,D.items.push(it);let Mo=(xe??N).range;D.range=[N.range[0],Mo[1],Mo[2]],l.items.push(D)}d=xe?xe.range[2]:H.end}}let f=o?"}":"]",[p,...v]=i.end,h=d;if(p?.source===f)h=p.offset+p.source.length;else{let m=s[0].toUpperCase()+s.substring(1),w=u?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;n(d,u?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&v.unshift(p)}if(v.length>0){let m=Rp.resolveEnd(v,h,r.options.strict,n);m.comment&&(l.comment?l.comment+=`
72
+ `+m.comment:l.comment=m.comment),l.range=[i.offset,h,m.offset]}else l.range=[i.offset,h,h];return l}Mc.resolveFlowCollection=Tp});var qc=g(Vc=>{"use strict";var Ip=P(),jp=$(),$p=$e(),Op=Oe(),Hp=$c(),Dp=Hc(),Lp=Fc();function Pa(e,t,r,i,n,a){let o=r.type==="block-map"?Hp.resolveBlockMap(e,t,r,i,a):r.type==="block-seq"?Dp.resolveBlockSeq(e,t,r,i,a):Lp.resolveFlowCollection(e,t,r,i,a),s=o.constructor;return n==="!"||n===s.tagName?(o.tag=s.tagName,o):(n&&(o.tag=n),o)}function Bp(e,t,r,i,n){let a=i.tag,o=a?t.directives.tagName(a.source,f=>n(a,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=i,v=f&&a?f.offset>a.offset?f:a:f??a;v&&(!p||p.offset<v.offset)&&n(v,"MISSING_CHAR","Missing newline after block sequence props")}let s=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!a||!o||o==="!"||o===$p.YAMLMap.tagName&&s==="map"||o===Op.YAMLSeq.tagName&&s==="seq")return Pa(e,t,r,n,o);let c=t.schema.tags.find(f=>f.tag===o&&f.collection===s);if(!c){let f=t.schema.knownTags[o];if(f?.collection===s)t.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?n(a,"BAD_COLLECTION_TYPE",`${f.tag} used for ${s} collection, but expects ${f.collection??"scalar"}`,!0):n(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Pa(e,t,r,n,o)}let l=Pa(e,t,r,n,o,c),u=c.resolve?.(l,f=>n(a,"TAG_RESOLVE_FAILED",f),t.options)??l,d=Ip.isNode(u)?u:new jp.Scalar(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}Vc.composeCollection=Bp});var Ra=g(Wc=>{"use strict";var xa=$();function Mp(e,t,r){let i=t.offset,n=Fp(t,e.options.strict,r);if(!n)return{value:"",type:null,comment:"",range:[i,i,i]};let a=n.mode===">"?xa.Scalar.BLOCK_FOLDED:xa.Scalar.BLOCK_LITERAL,o=t.source?Vp(t.source):[],s=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===""||m==="\r")s=h;else break}if(s===0){let h=n.chomp==="+"&&o.length>0?`
73
73
  `.repeat(Math.max(1,o.length-1)):"",m=i+n.length;return t.source&&(m+=t.source.length),{value:h,type:a,comment:n.comment,range:[i,m,m]}}let c=t.indent+n.indent,l=t.offset+n.length,u=0;for(let h=0;h<s;++h){let[m,w]=o[h];if(w===""||w==="\r")n.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&r(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(c=m.length),u=h,c===0&&!e.atRoot&&r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+w.length+1}for(let h=o.length-1;h>=s;--h)o[h][0].length>c&&(s=h+1);let d="",f="",p=!1;for(let h=0;h<u;++h)d+=o[h][0].slice(c)+`
74
- `;for(let h=u;h<s;++h){let[m,w]=o[h];l+=m.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&m.length<c){let k=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;r(l-w.length-(y?2:1),"BAD_INDENT",k),m=""}a===ka.Scalar.BLOCK_LITERAL?(d+=f+m.slice(c)+w,f=`
74
+ `;for(let h=u;h<s;++h){let[m,w]=o[h];l+=m.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&m.length<c){let k=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;r(l-w.length-(y?2:1),"BAD_INDENT",k),m=""}a===xa.Scalar.BLOCK_LITERAL?(d+=f+m.slice(c)+w,f=`
75
75
  `):m.length>c||w[0]===" "?(f===" "?f=`
76
76
  `:!p&&f===`
77
77
  `&&(f=`
@@ -84,62 +84,62 @@ ${l}
84
84
  `+o[h][0].slice(c);d[d.length-1]!==`
85
85
  `&&(d+=`
86
86
  `);break;default:d+=`
87
- `}let v=i+n.length+t.source.length;return{value:d,type:a,comment:n.comment,range:[i,v,v]}}function Cp({offset:e,props:t},r,i){if(t[0].type!=="block-scalar-header")return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=t[0],a=n[0],o=0,s="",c=-1;for(let f=1;f<n.length;++f){let p=n[f];if(!s&&(p==="-"||p==="+"))s=p;else{let v=Number(p);!o&&v?o=v:c===-1&&(c=e+f)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,u="",d=n.length;for(let f=1;f<t.length;++f){let p=t[f];switch(p.type){case"space":l=!0;case"newline":d+=p.source.length;break;case"comment":r&&!l&&i(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=p.source.length,u=p.source.substring(1);break;case"error":i(p,"UNEXPECTED_TOKEN",p.message),d+=p.source.length;break;default:{let v=`Unexpected token in block scalar header: ${p.type}`;i(p,"UNEXPECTED_TOKEN",v);let h=p.source;h&&typeof h=="string"&&(d+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function xp(e){let t=e.split(/\n( *)/),r=t[0],i=r.match(/^( *)/),a=[i?.[1]?[i[1],r.slice(i[1].length)]:["",r]];for(let o=1;o<t.length;o+=2)a.push([t[o],t[o+1]]);return a}Bc.resolveBlockScalar=Pp});var Pa=g(Mc=>{"use strict";var Ea=j(),Rp=dt();function Ap(e,t,r){let{offset:i,type:n,source:a,end:o}=e,s,c,l=(f,p,v)=>r(i+f,p,v);switch(n){case"scalar":s=Ea.Scalar.PLAIN,c=_p(a,l);break;case"single-quoted-scalar":s=Ea.Scalar.QUOTE_SINGLE,c=Tp(a,l);break;case"double-quoted-scalar":s=Ea.Scalar.QUOTE_DOUBLE,c=Ip(a,l);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[i,i+a.length,i+a.length]}}let u=i+a.length,d=Rp.resolveEnd(o,u,t,r);return{value:c,type:s,comment:d.comment,range:[i,u,d.offset]}}function _p(e,t){let r="";switch(e[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${e[0]}`;break}case"@":case"`":{r=`reserved character ${e[0]}`;break}}return r&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),Lc(e)}function Tp(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Lc(e.slice(1,-1)).replace(/''/g,"'")}function Lc(e){let t,r;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
87
+ `}let v=i+n.length+t.source.length;return{value:d,type:a,comment:n.comment,range:[i,v,v]}}function Fp({offset:e,props:t},r,i){if(t[0].type!=="block-scalar-header")return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=t[0],a=n[0],o=0,s="",c=-1;for(let f=1;f<n.length;++f){let p=n[f];if(!s&&(p==="-"||p==="+"))s=p;else{let v=Number(p);!o&&v?o=v:c===-1&&(c=e+f)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,u="",d=n.length;for(let f=1;f<t.length;++f){let p=t[f];switch(p.type){case"space":l=!0;case"newline":d+=p.source.length;break;case"comment":r&&!l&&i(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=p.source.length,u=p.source.substring(1);break;case"error":i(p,"UNEXPECTED_TOKEN",p.message),d+=p.source.length;break;default:{let v=`Unexpected token in block scalar header: ${p.type}`;i(p,"UNEXPECTED_TOKEN",v);let h=p.source;h&&typeof h=="string"&&(d+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function Vp(e){let t=e.split(/\n( *)/),r=t[0],i=r.match(/^( *)/),a=[i?.[1]?[i[1],r.slice(i[1].length)]:["",r]];for(let o=1;o<t.length;o+=2)a.push([t[o],t[o+1]]);return a}Wc.resolveBlockScalar=Mp});var _a=g(Jc=>{"use strict";var Aa=$(),qp=ht();function Wp(e,t,r){let{offset:i,type:n,source:a,end:o}=e,s,c,l=(f,p,v)=>r(i+f,p,v);switch(n){case"scalar":s=Aa.Scalar.PLAIN,c=zp(a,l);break;case"single-quoted-scalar":s=Aa.Scalar.QUOTE_SINGLE,c=Jp(a,l);break;case"double-quoted-scalar":s=Aa.Scalar.QUOTE_DOUBLE,c=Gp(a,l);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[i,i+a.length,i+a.length]}}let u=i+a.length,d=qp.resolveEnd(o,u,t,r);return{value:c,type:s,comment:d.comment,range:[i,u,d.offset]}}function zp(e,t){let r="";switch(e[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${e[0]}`;break}case"@":case"`":{r=`reserved character ${e[0]}`;break}}return r&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),zc(e)}function Jp(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),zc(e.slice(1,-1)).replace(/''/g,"'")}function zc(e){let t,r;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
88
  `,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
89
  `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=t.exec(e);if(!i)return e;let n=i[1],a=" ",o=t.lastIndex;for(r.lastIndex=o;i=r.exec(e);)i[1]===""?a===`
90
90
  `?n+=a:a=`
91
- `:(n+=a+i[1],a=" "),o=r.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,i=s.exec(e),n+a+(i?.[1]??"")}function Ip(e,t){let r="";for(let i=1;i<e.length-1;++i){let n=e[i];if(!(n==="\r"&&e[i+1]===`
91
+ `:(n+=a+i[1],a=" "),o=r.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,i=s.exec(e),n+a+(i?.[1]??"")}function Gp(e,t){let r="";for(let i=1;i<e.length-1;++i){let n=e[i];if(!(n==="\r"&&e[i+1]===`
92
92
  `))if(n===`
93
- `){let{fold:a,offset:o}=jp(e,i);r+=a,i=o}else if(n==="\\"){let a=e[++i],o=$p[a];if(o)r+=o;else if(a===`
93
+ `){let{fold:a,offset:o}=Up(e,i);r+=a,i=o}else if(n==="\\"){let a=e[++i],o=Kp[a];if(o)r+=o;else if(a===`
94
94
  `)for(a=e[i+1];a===" "||a===" ";)a=e[++i+1];else if(a==="\r"&&e[i+1]===`
95
- `)for(a=e[++i+1];a===" "||a===" ";)a=e[++i+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;r+=Op(e,i+1,s,t),i+=s}else{let s=e.substr(i-1,2);t(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),r+=s}}else if(n===" "||n===" "){let a=i,o=e[i+1];for(;o===" "||o===" ";)o=e[++i+1];o!==`
95
+ `)for(a=e[++i+1];a===" "||a===" ";)a=e[++i+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;r+=Yp(e,i+1,s,t),i+=s}else{let s=e.substr(i-1,2);t(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),r+=s}}else if(n===" "||n===" "){let a=i,o=e[i+1];for(;o===" "||o===" ";)o=e[++i+1];o!==`
96
96
  `&&!(o==="\r"&&e[i+2]===`
97
- `)&&(r+=i>a?e.slice(a,i+1):n)}else r+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),r}function jp(e,t){let r="",i=e[t+1];for(;(i===" "||i===" "||i===`
97
+ `)&&(r+=i>a?e.slice(a,i+1):n)}else r+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),r}function Up(e,t){let r="",i=e[t+1];for(;(i===" "||i===" "||i===`
98
98
  `||i==="\r")&&!(i==="\r"&&e[t+2]!==`
99
99
  `);)i===`
100
100
  `&&(r+=`
101
- `),t+=1,i=e[t+1];return r||(r=" "),{fold:r,offset:t}}var $p={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Op(e,t,r,i){let n=e.substr(t,r),o=n.length===r&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(o)}catch{let s=e.substr(t-2,r+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Mc.resolveFlowScalar=Ap});var qc=g(Vc=>{"use strict";var Ge=P(),Fc=j(),Hp=Sa(),Dp=Pa();function Bp(e,t,r,i){let{value:n,type:a,comment:o,range:s}=t.type==="block-scalar"?Hp.resolveBlockScalar(e,t,i):Dp.resolveFlowScalar(t,e.options.strict,i),c=r?e.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[Ge.SCALAR]:c?l=Lp(e.schema,n,c,r,i):t.type==="scalar"?l=Mp(e,n,t,i):l=e.schema[Ge.SCALAR];let u;try{let d=l.resolve(n,f=>i(r??t,"TAG_RESOLVE_FAILED",f),e.options);u=Ge.isScalar(d)?d:new Fc.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);i(r??t,"TAG_RESOLVE_FAILED",f),u=new Fc.Scalar(n)}return u.range=s,u.source=n,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Lp(e,t,r,i,n){if(r==="!")return e[Ge.SCALAR];let a=[];for(let s of e.tags)if(!s.collection&&s.tag===r)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(t))return s;let o=e.knownTags[r];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),e[Ge.SCALAR])}function Mp({atKey:e,directives:t,schema:r},i,n,a){let o=r.tags.find(s=>(s.default===!0||e&&s.default==="key")&&s.test?.test(i))||r[Ge.SCALAR];if(r.compat){let s=r.compat.find(c=>c.default&&c.test?.test(i))??r[Ge.SCALAR];if(o.tag!==s.tag){let c=t.tagString(o.tag),l=t.tagString(s.tag),u=`Value may be parsed as either ${c} or ${l}`;a(n,"TAG_RESOLVE_FAILED",u,!0)}}return o}Vc.composeScalar=Bp});var zc=g(Wc=>{"use strict";function Fp(e,t,r){if(t){r??(r=t.length);for(let i=r-1;i>=0;--i){let n=t[i];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++i];n?.type==="space";)e+=n.source.length,n=t[++i];break}}return e}Wc.emptyScalarPosition=Fp});var Uc=g(xa=>{"use strict";var Vp=_t(),qp=P(),Wp=Dc(),Jc=qc(),zp=dt(),Jp=zc(),Gp={composeNode:Gc,composeEmptyNode:Ca};function Gc(e,t,r,i){let n=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=r,l,u=!0;switch(t.type){case"alias":l=Up(e,t,i),(s||c)&&i(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Jc.composeScalar(e,t,c,i),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Wp.composeCollection(Gp,e,t,r,i),s&&(l.anchor=s.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);i(t,"RESOURCE_EXHAUSTION",f)}break;default:{let d=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=Ca(e,t.offset,void 0,null,r,i)),s&&l.anchor===""&&i(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!qp.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&i(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Ca(e,t,r,i,{spaceBefore:n,comment:a,anchor:o,tag:s,end:c},l){let u={type:"scalar",offset:Jp.emptyScalarPosition(t,r,i),indent:-1,source:""},d=Jc.composeScalar(e,u,s,l);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(d.spaceBefore=!0),a&&(d.comment=a,d.range[2]=c),d}function Up({options:e},{offset:t,source:r,end:i},n){let a=new Vp.Alias(r.substring(1));a.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&n(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+r.length,s=zp.resolveEnd(i,o,e.strict,n);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}xa.composeEmptyNode=Ca;xa.composeNode=Gc});var Xc=g(Yc=>{"use strict";var Kp=Jt(),Kc=Uc(),Yp=dt(),Xp=Yt();function Qp(e,t,{offset:r,start:i,value:n,end:a},o){let s=Object.assign({_directives:t},e),c=new Kp.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Xp.resolveProps(i,{indicator:"doc-start",next:n??a?.[0],offset:r,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?Kc.composeNode(l,n,u,o):Kc.composeEmptyNode(l,u.end,i,null,u,o);let d=c.contents.range[2],f=Yp.resolveEnd(a,d,!1,o);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}Yc.composeDoc=Qp});var Aa=g(el=>{"use strict";var Zp=Ir("process"),em=pn(),tm=Jt(),Xt=Kt(),Qc=P(),rm=Xc(),im=dt();function Qt(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+(typeof r=="string"?r.length:1)]}function Zc(e){let t="",r=!1,i=!1;for(let n=0;n<e.length;++n){let a=e[n];switch(a[0]){case"#":t+=(t===""?"":i?`
101
+ `),t+=1,i=e[t+1];return r||(r=" "),{fold:r,offset:t}}var Kp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Yp(e,t,r,i){let n=e.substr(t,r),o=n.length===r&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(o)}catch{let s=e.substr(t-2,r+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Jc.resolveFlowScalar=Wp});var Kc=g(Uc=>{"use strict";var Ke=P(),Gc=$(),Xp=Ra(),Qp=_a();function Zp(e,t,r,i){let{value:n,type:a,comment:o,range:s}=t.type==="block-scalar"?Xp.resolveBlockScalar(e,t,i):Qp.resolveFlowScalar(t,e.options.strict,i),c=r?e.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[Ke.SCALAR]:c?l=em(e.schema,n,c,r,i):t.type==="scalar"?l=tm(e,n,t,i):l=e.schema[Ke.SCALAR];let u;try{let d=l.resolve(n,f=>i(r??t,"TAG_RESOLVE_FAILED",f),e.options);u=Ke.isScalar(d)?d:new Gc.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);i(r??t,"TAG_RESOLVE_FAILED",f),u=new Gc.Scalar(n)}return u.range=s,u.source=n,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function em(e,t,r,i,n){if(r==="!")return e[Ke.SCALAR];let a=[];for(let s of e.tags)if(!s.collection&&s.tag===r)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(t))return s;let o=e.knownTags[r];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),e[Ke.SCALAR])}function tm({atKey:e,directives:t,schema:r},i,n,a){let o=r.tags.find(s=>(s.default===!0||e&&s.default==="key")&&s.test?.test(i))||r[Ke.SCALAR];if(r.compat){let s=r.compat.find(c=>c.default&&c.test?.test(i))??r[Ke.SCALAR];if(o.tag!==s.tag){let c=t.tagString(o.tag),l=t.tagString(s.tag),u=`Value may be parsed as either ${c} or ${l}`;a(n,"TAG_RESOLVE_FAILED",u,!0)}}return o}Uc.composeScalar=Zp});var Xc=g(Yc=>{"use strict";function rm(e,t,r){if(t){r??(r=t.length);for(let i=r-1;i>=0;--i){let n=t[i];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++i];n?.type==="space";)e+=n.source.length,n=t[++i];break}}return e}Yc.emptyScalarPosition=rm});var el=g(Ia=>{"use strict";var im=jt(),nm=P(),am=qc(),Qc=Kc(),om=ht(),sm=Xc(),cm={composeNode:Zc,composeEmptyNode:Ta};function Zc(e,t,r,i){let n=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=r,l,u=!0;switch(t.type){case"alias":l=lm(e,t,i),(s||c)&&i(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Qc.composeScalar(e,t,c,i),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=am.composeCollection(cm,e,t,r,i),s&&(l.anchor=s.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);i(t,"RESOURCE_EXHAUSTION",f)}break;default:{let d=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=Ta(e,t.offset,void 0,null,r,i)),s&&l.anchor===""&&i(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!nm.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&i(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Ta(e,t,r,i,{spaceBefore:n,comment:a,anchor:o,tag:s,end:c},l){let u={type:"scalar",offset:sm.emptyScalarPosition(t,r,i),indent:-1,source:""},d=Qc.composeScalar(e,u,s,l);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(d.spaceBefore=!0),a&&(d.comment=a,d.range[2]=c),d}function lm({options:e},{offset:t,source:r,end:i},n){let a=new im.Alias(r.substring(1));a.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&n(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+r.length,s=om.resolveEnd(i,o,e.strict,n);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}Ia.composeEmptyNode=Ta;Ia.composeNode=Zc});var il=g(rl=>{"use strict";var um=Kt(),tl=el(),dm=ht(),fm=Zt();function hm(e,t,{offset:r,start:i,value:n,end:a},o){let s=Object.assign({_directives:t},e),c=new um.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=fm.resolveProps(i,{indicator:"doc-start",next:n??a?.[0],offset:r,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?tl.composeNode(l,n,u,o):tl.composeEmptyNode(l,u.end,i,null,u,o);let d=c.contents.range[2],f=dm.resolveEnd(a,d,!1,o);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}rl.composeDoc=hm});var $a=g(ol=>{"use strict";var pm=$r("process"),mm=yn(),vm=Kt(),er=Qt(),nl=P(),gm=il(),wm=ht();function tr(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+(typeof r=="string"?r.length:1)]}function al(e){let t="",r=!1,i=!1;for(let n=0;n<e.length;++n){let a=e[n];switch(a[0]){case"#":t+=(t===""?"":i?`
103
103
 
104
104
  `:`
105
- `)+(a.substring(1)||" "),r=!0,i=!1;break;case"%":e[n+1]?.[0]!=="#"&&(n+=1),r=!1;break;default:r||(i=!0),r=!1}}return{comment:t,afterEmptyLine:i}}var Ra=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,i,n,a)=>{let o=Qt(r);a?this.warnings.push(new Xt.YAMLWarning(o,i,n)):this.errors.push(new Xt.YAMLParseError(o,i,n))},this.directives=new em.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,r){let{comment:i,afterEmptyLine:n}=Zc(this.prelude);if(i){let a=t.contents;if(r)t.comment=t.comment?`${t.comment}
106
- ${i}`:i;else if(n||t.directives.docStart||!a)t.commentBefore=i;else if(Qc.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];Qc.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${i}
105
+ `)+(a.substring(1)||" "),r=!0,i=!1;break;case"%":e[n+1]?.[0]!=="#"&&(n+=1),r=!1;break;default:r||(i=!0),r=!1}}return{comment:t,afterEmptyLine:i}}var ja=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,i,n,a)=>{let o=tr(r);a?this.warnings.push(new er.YAMLWarning(o,i,n)):this.errors.push(new er.YAMLParseError(o,i,n))},this.directives=new mm.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,r){let{comment:i,afterEmptyLine:n}=al(this.prelude);if(i){let a=t.contents;if(r)t.comment=t.comment?`${t.comment}
106
+ ${i}`:i;else if(n||t.directives.docStart||!a)t.commentBefore=i;else if(nl.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];nl.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${i}
107
107
  ${s}`:i}else{let o=a.commentBefore;a.commentBefore=o?`${i}
108
- ${o}`:i}}if(r){for(let a=0;a<this.errors.length;++a)t.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)t.warnings.push(this.warnings[a])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Zc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,r=!1,i=-1){for(let n of t)yield*this.next(n);yield*this.end(r,i)}*next(t){switch(Zp.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(r,i,n)=>{let a=Qt(t);a[0]+=r,this.onError(a,"BAD_DIRECTIVE",i,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let r=rm.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let r=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,i=new Xt.YAMLParseError(Qt(t),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new Xt.YAMLParseError(Qt(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let r=im.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
109
- ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Xt.YAMLParseError(Qt(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let i=Object.assign({_directives:this.directives},this.options),n=new tm.Document(void 0,i);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,r,r],this.decorate(n,!1),yield n}}};el.Composer=Ra});var il=g(Si=>{"use strict";var nm=Sa(),am=Pa(),om=Kt(),tl=Ot();function sm(e,t=!0,r){if(e){let i=(n,a,o)=>{let s=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(r)r(s,a,o);else throw new om.YAMLParseError([s,s+1],a,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return am.resolveFlowScalar(e,t,i);case"block-scalar":return nm.resolveBlockScalar({options:{strict:t}},e,i)}}return null}function cm(e,t){let{implicitKey:r=!1,indent:i,inFlow:n=!1,offset:a=-1,type:o="PLAIN"}=t,s=tl.stringifyString({type:o,value:e},{implicitKey:r,indent:i>0?" ".repeat(i):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:i,source:`
108
+ ${o}`:i}}if(r){for(let a=0;a<this.errors.length;++a)t.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)t.warnings.push(this.warnings[a])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:al(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,r=!1,i=-1){for(let n of t)yield*this.next(n);yield*this.end(r,i)}*next(t){switch(pm.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(r,i,n)=>{let a=tr(t);a[0]+=r,this.onError(a,"BAD_DIRECTIVE",i,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let r=gm.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let r=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,i=new er.YAMLParseError(tr(t),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new er.YAMLParseError(tr(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let r=wm.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
109
+ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new er.YAMLParseError(tr(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let i=Object.assign({_directives:this.directives},this.options),n=new vm.Document(void 0,i);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,r,r],this.decorate(n,!1),yield n}}};ol.Composer=ja});var ll=g(Ci=>{"use strict";var ym=Ra(),Nm=_a(),bm=Qt(),sl=Lt();function km(e,t=!0,r){if(e){let i=(n,a,o)=>{let s=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(r)r(s,a,o);else throw new bm.YAMLParseError([s,s+1],a,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Nm.resolveFlowScalar(e,t,i);case"block-scalar":return ym.resolveBlockScalar({options:{strict:t}},e,i)}}return null}function Sm(e,t){let{implicitKey:r=!1,indent:i,inFlow:n=!1,offset:a=-1,type:o="PLAIN"}=t,s=sl.stringifyString({type:o,value:e},{implicitKey:r,indent:i>0?" ".repeat(i):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:i,source:`
110
110
  `}];switch(s[0]){case"|":case">":{let l=s.indexOf(`
111
111
  `),u=s.substring(0,l),d=s.substring(l+1)+`
112
- `,f=[{type:"block-scalar-header",offset:a,indent:i,source:u}];return rl(f,c)||f.push({type:"newline",offset:-1,indent:i,source:`
113
- `}),{type:"block-scalar",offset:a,indent:i,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:a,indent:i,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:i,source:s,end:c};default:return{type:"scalar",offset:a,indent:i,source:s,end:c}}}function lm(e,t,r={}){let{afterKey:i=!1,implicitKey:n=!1,inFlow:a=!1,type:o}=r,s="indent"in e?e.indent:null;if(i&&typeof s=="number"&&(s+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=tl.stringifyString({type:o,value:t},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":um(e,c);break;case'"':_a(e,c,"double-quoted-scalar");break;case"'":_a(e,c,"single-quoted-scalar");break;default:_a(e,c,"scalar")}}function um(e,t){let r=t.indexOf(`
112
+ `,f=[{type:"block-scalar-header",offset:a,indent:i,source:u}];return cl(f,c)||f.push({type:"newline",offset:-1,indent:i,source:`
113
+ `}),{type:"block-scalar",offset:a,indent:i,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:a,indent:i,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:i,source:s,end:c};default:return{type:"scalar",offset:a,indent:i,source:s,end:c}}}function Em(e,t,r={}){let{afterKey:i=!1,implicitKey:n=!1,inFlow:a=!1,type:o}=r,s="indent"in e?e.indent:null;if(i&&typeof s=="number"&&(s+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=sl.stringifyString({type:o,value:t},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Cm(e,c);break;case'"':Oa(e,c,"double-quoted-scalar");break;case"'":Oa(e,c,"single-quoted-scalar");break;default:Oa(e,c,"scalar")}}function Cm(e,t){let r=t.indexOf(`
114
114
  `),i=t.substring(0,r),n=t.substring(r+1)+`
115
- `;if(e.type==="block-scalar"){let a=e.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=i,e.source=n}else{let{offset:a}=e,o="indent"in e?e.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:i}];rl(s,"end"in e?e.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
- `});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:s,source:n})}}function rl(e,t){if(t)for(let r of t)switch(r.type){case"space":case"comment":e.push(r);break;case"newline":return e.push(r),!0}return!1}function _a(e,t,r){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=r,e.source=t;break;case"block-scalar":{let i=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let a of i)a.offset+=n;delete e.props,Object.assign(e,{type:r,source:t,end:i});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
117
- `};delete e.items,Object.assign(e,{type:r,source:t,end:[n]});break}default:{let i="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(e))a!=="type"&&a!=="offset"&&delete e[a];Object.assign(e,{type:r,indent:i,source:t,end:n})}}}Si.createScalarToken=cm;Si.resolveAsScalar=sm;Si.setScalarValue=lm});var al=g(nl=>{"use strict";var dm=e=>"type"in e?Pi(e):Ei(e);function Pi(e){switch(e.type){case"block-scalar":{let t="";for(let r of e.props)t+=Pi(r);return t+e.source}case"block-map":case"block-seq":{let t="";for(let r of e.items)t+=Ei(r);return t}case"flow-collection":{let t=e.start.source;for(let r of e.items)t+=Ei(r);for(let r of e.end)t+=r.source;return t}case"document":{let t=Ei(e);if(e.end)for(let r of e.end)t+=r.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let r of e.end)t+=r.source;return t}}}function Ei({start:e,key:t,sep:r,value:i}){let n="";for(let a of e)n+=a.source;if(t&&(n+=Pi(t)),r)for(let a of r)n+=a.source;return i&&(n+=Pi(i)),n}nl.stringify=dm});var ll=g(cl=>{"use strict";var Ta=Symbol("break visit"),fm=Symbol("skip children"),ol=Symbol("remove item");function Ue(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),sl(Object.freeze([]),e,t)}Ue.BREAK=Ta;Ue.SKIP=fm;Ue.REMOVE=ol;Ue.itemAtPath=(e,t)=>{let r=e;for(let[i,n]of t){let a=r?.[i];if(a&&"items"in a)r=a.items[n];else return}return r};Ue.parentCollection=(e,t)=>{let r=Ue.itemAtPath(e,t.slice(0,-1)),i=t[t.length-1][0],n=r?.[i];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function sl(e,t,r){let i=r(t,e);if(typeof i=="symbol")return i;for(let n of["key","value"]){let a=t[n];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=sl(Object.freeze(e.concat([[n,o]])),a.items[o],r);if(typeof s=="number")o=s-1;else{if(s===Ta)return Ta;s===ol&&(a.items.splice(o,1),o-=1)}}typeof i=="function"&&n==="key"&&(i=i(t,e))}}return typeof i=="function"?i(t,e):i}cl.visit=Ue});var Ci=g(W=>{"use strict";var Ia=il(),hm=al(),pm=ll(),ja="\uFEFF",$a="",Oa="",Ha="",mm=e=>!!e&&"items"in e,vm=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function gm(e){switch(e){case ja:return"<BOM>";case $a:return"<DOC>";case Oa:return"<FLOW_END>";case Ha:return"<SCALAR>";default:return JSON.stringify(e)}}function wm(e){switch(e){case ja:return"byte-order-mark";case $a:return"doc-mode";case Oa:return"flow-error-end";case Ha:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
115
+ `;if(e.type==="block-scalar"){let a=e.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=i,e.source=n}else{let{offset:a}=e,o="indent"in e?e.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:i}];cl(s,"end"in e?e.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
+ `});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:s,source:n})}}function cl(e,t){if(t)for(let r of t)switch(r.type){case"space":case"comment":e.push(r);break;case"newline":return e.push(r),!0}return!1}function Oa(e,t,r){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=r,e.source=t;break;case"block-scalar":{let i=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let a of i)a.offset+=n;delete e.props,Object.assign(e,{type:r,source:t,end:i});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
117
+ `};delete e.items,Object.assign(e,{type:r,source:t,end:[n]});break}default:{let i="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(e))a!=="type"&&a!=="offset"&&delete e[a];Object.assign(e,{type:r,indent:i,source:t,end:n})}}}Ci.createScalarToken=Sm;Ci.resolveAsScalar=km;Ci.setScalarValue=Em});var dl=g(ul=>{"use strict";var Pm=e=>"type"in e?xi(e):Pi(e);function xi(e){switch(e.type){case"block-scalar":{let t="";for(let r of e.props)t+=xi(r);return t+e.source}case"block-map":case"block-seq":{let t="";for(let r of e.items)t+=Pi(r);return t}case"flow-collection":{let t=e.start.source;for(let r of e.items)t+=Pi(r);for(let r of e.end)t+=r.source;return t}case"document":{let t=Pi(e);if(e.end)for(let r of e.end)t+=r.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let r of e.end)t+=r.source;return t}}}function Pi({start:e,key:t,sep:r,value:i}){let n="";for(let a of e)n+=a.source;if(t&&(n+=xi(t)),r)for(let a of r)n+=a.source;return i&&(n+=xi(i)),n}ul.stringify=Pm});var ml=g(pl=>{"use strict";var Ha=Symbol("break visit"),xm=Symbol("skip children"),fl=Symbol("remove item");function Ye(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),hl(Object.freeze([]),e,t)}Ye.BREAK=Ha;Ye.SKIP=xm;Ye.REMOVE=fl;Ye.itemAtPath=(e,t)=>{let r=e;for(let[i,n]of t){let a=r?.[i];if(a&&"items"in a)r=a.items[n];else return}return r};Ye.parentCollection=(e,t)=>{let r=Ye.itemAtPath(e,t.slice(0,-1)),i=t[t.length-1][0],n=r?.[i];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function hl(e,t,r){let i=r(t,e);if(typeof i=="symbol")return i;for(let n of["key","value"]){let a=t[n];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=hl(Object.freeze(e.concat([[n,o]])),a.items[o],r);if(typeof s=="number")o=s-1;else{if(s===Ha)return Ha;s===fl&&(a.items.splice(o,1),o-=1)}}typeof i=="function"&&n==="key"&&(i=i(t,e))}}return typeof i=="function"?i(t,e):i}pl.visit=Ye});var Ri=g(z=>{"use strict";var Da=ll(),Rm=dl(),Am=ml(),La="\uFEFF",Ba="",Ma="",Fa="",_m=e=>!!e&&"items"in e,Tm=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function Im(e){switch(e){case La:return"<BOM>";case Ba:return"<DOC>";case Ma:return"<FLOW_END>";case Fa:return"<SCALAR>";default:return JSON.stringify(e)}}function jm(e){switch(e){case La:return"byte-order-mark";case Ba:return"doc-mode";case Ma:return"flow-error-end";case Fa:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
118
118
  `:case`\r
119
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}W.createScalarToken=Ia.createScalarToken;W.resolveAsScalar=Ia.resolveAsScalar;W.setScalarValue=Ia.setScalarValue;W.stringify=hm.stringify;W.visit=pm.visit;W.BOM=ja;W.DOCUMENT=$a;W.FLOW_END=Oa;W.SCALAR=Ha;W.isCollection=mm;W.isScalar=vm;W.prettyToken=gm;W.tokenType=wm});var La=g(dl=>{"use strict";var Zt=Ci();function ne(e){switch(e){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var ul=new Set("0123456789ABCDEFabcdef"),ym=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),xi=new Set(",[]{}"),Nm=new Set(` ,[]{}
121
- \r `),Da=e=>!e||Nm.has(e),Ba=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,r=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!r;let i=this.next??"stream";for(;i&&(r||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let t=this.pos,r=this.buffer[t];for(;r===" "||r===" ";)r=this.buffer[++t];return!r||r==="#"||r===`
119
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}z.createScalarToken=Da.createScalarToken;z.resolveAsScalar=Da.resolveAsScalar;z.setScalarValue=Da.setScalarValue;z.stringify=Rm.stringify;z.visit=Am.visit;z.BOM=La;z.DOCUMENT=Ba;z.FLOW_END=Ma;z.SCALAR=Fa;z.isCollection=_m;z.isScalar=Tm;z.prettyToken=Im;z.tokenType=jm});var Wa=g(gl=>{"use strict";var rr=Ri();function ae(e){switch(e){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var vl=new Set("0123456789ABCDEFabcdef"),$m=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ai=new Set(",[]{}"),Om=new Set(` ,[]{}
121
+ \r `),Va=e=>!e||Om.has(e),qa=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,r=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!r;let i=this.next??"stream";for(;i&&(r||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let t=this.pos,r=this.buffer[t];for(;r===" "||r===" ";)r=this.buffer[++t];return!r||r==="#"||r===`
122
122
  `?!0:r==="\r"?this.buffer[t+1]===`
123
123
  `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let r=this.buffer[t];if(this.indentNext>0){let i=0;for(;r===" ";)r=this.buffer[++i+t];if(r==="\r"){let n=this.buffer[i+t+1];if(n===`
124
124
  `||!n&&!this.atEnd)return t+i+1}return r===`
125
- `||i>=this.indentNext||!r&&!this.atEnd?t+i:-1}if(r==="-"||r==="."){let i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&ne(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
126
- `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===Zt.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let r=t.length,i=t.indexOf("#");for(;i!==-1;){let a=t[i-1];if(a===" "||a===" "){r=i-1;break}else i=t.indexOf("#",i+1)}for(;;){let a=t[r-1];if(a===" "||a===" ")r-=1;else break}let n=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-r),yield*this.pushNewline(),"stream"}return yield Zt.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&ne(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ne(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&ne(r)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(t[r]){case"#":yield*this.pushCount(t.length-r);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(Da),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,r,i=-1;do t=yield*this.pushNewline(),t>0?(r=yield*this.pushSpaces(!1),this.indentValue=i=r):r=0,r+=yield*this.pushSpaces(!0);while(t+r>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&n[0]!=="#"||i===0&&(n.startsWith("---")||n.startsWith("..."))&&ne(n[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield Zt.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(Da),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ne(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),r=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let a=0;for(;this.buffer[r-1-a]==="\\";)a+=1;if(a%2===0)break;r=this.buffer.indexOf('"',r+1)}let i=this.buffer.substring(0,r),n=i.indexOf(`
125
+ `||i>=this.indentNext||!r&&!this.atEnd?t+i:-1}if(r==="-"||r==="."){let i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&ae(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
126
+ `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===rr.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let r=t.length,i=t.indexOf("#");for(;i!==-1;){let a=t[i-1];if(a===" "||a===" "){r=i-1;break}else i=t.indexOf("#",i+1)}for(;;){let a=t[r-1];if(a===" "||a===" ")r-=1;else break}let n=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-r),yield*this.pushNewline(),"stream"}return yield rr.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&ae(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ae(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&ae(r)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(t[r]){case"#":yield*this.pushCount(t.length-r);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(Va),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,r,i=-1;do t=yield*this.pushNewline(),t>0?(r=yield*this.pushSpaces(!1),this.indentValue=i=r):r=0,r+=yield*this.pushSpaces(!0);while(t+r>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&n[0]!=="#"||i===0&&(n.startsWith("---")||n.startsWith("..."))&&ae(n[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield rr.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(Va),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ae(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),r=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let a=0;for(;this.buffer[r-1-a]==="\\";)a+=1;if(a%2===0)break;r=this.buffer.indexOf('"',r+1)}let i=this.buffer.substring(0,r),n=i.indexOf(`
127
127
  `,this.pos);if(n!==-1){for(;n!==-1;){let a=this.continueScalar(n+1);if(a===-1)break;n=i.indexOf(`
128
- `,a)}n!==-1&&(r=n-(i[n-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let r=this.buffer[++t];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>ne(r)||r==="#")}*parseBlockScalar(){let t=this.pos-1,r=0,i;e:for(let a=this.pos;i=this.buffer[a];++a)switch(i){case" ":r+=1;break;case`
128
+ `,a)}n!==-1&&(r=n-(i[n-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let r=this.buffer[++t];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>ae(r)||r==="#")}*parseBlockScalar(){let t=this.pos-1,r=0,i;e:for(let a=this.pos;i=this.buffer[a];++a)switch(i){case" ":r+=1;break;case`
129
129
  `:t=a,r=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(!i&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(t+1);if(a===-1)break;t=this.buffer.indexOf(`
131
131
  `,a)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let n=t+1;for(i=this.buffer[n];i===" ";)i=this.buffer[++n];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
132
132
  `;)i=this.buffer[++n];t=n-1}else if(!this.blockScalarKeep)do{let a=t-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);let s=a;for(;o===" ";)o=this.buffer[--a];if(o===`
133
- `&&a>=this.pos&&a+1+r>s)t=a;else break}while(!0);return yield Zt.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,r=this.pos-1,i=this.pos-1,n;for(;n=this.buffer[++i];)if(n===":"){let a=this.buffer[i+1];if(ne(a)||t&&xi.has(a))break;r=i}else if(ne(n)){let a=this.buffer[i+1];if(n==="\r"&&(a===`
133
+ `&&a>=this.pos&&a+1+r>s)t=a;else break}while(!0);return yield rr.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,r=this.pos-1,i=this.pos-1,n;for(;n=this.buffer[++i];)if(n===":"){let a=this.buffer[i+1];if(ae(a)||t&&Ai.has(a))break;r=i}else if(ae(n)){let a=this.buffer[i+1];if(n==="\r"&&(a===`
134
134
  `?(i+=1,n=`
135
- `,a=this.buffer[i+1]):r=i),a==="#"||t&&xi.has(a))break;if(n===`
136
- `){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(t&&xi.has(n))break;r=i}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield Zt.SCALAR,yield*this.pushToIndex(r+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,r){let i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(r&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Da),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,i=this.charAt(1);if(ne(i)||r&&xi.has(i)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,r=this.buffer[t];for(;!ne(r)&&r!==">";)r=this.buffer[++t];return yield*this.pushToIndex(r===">"?t+1:t,!1)}else{let t=this.pos+1,r=this.buffer[t];for(;r;)if(ym.has(r))r=this.buffer[++t];else if(r==="%"&&ul.has(this.buffer[t+1])&&ul.has(this.buffer[t+2]))r=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
135
+ `,a=this.buffer[i+1]):r=i),a==="#"||t&&Ai.has(a))break;if(n===`
136
+ `){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(t&&Ai.has(n))break;r=i}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield rr.SCALAR,yield*this.pushToIndex(r+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,r){let i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(r&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Va),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,i=this.charAt(1);if(ae(i)||r&&Ai.has(i)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,r=this.buffer[t];for(;!ae(r)&&r!==">";)r=this.buffer[++t];return yield*this.pushToIndex(r===">"?t+1:t,!1)}else{let t=this.pos+1,r=this.buffer[t];for(;r;)if($m.has(r))r=this.buffer[++t];else if(r==="%"&&vl.has(this.buffer[t+1])&&vl.has(this.buffer[t+2]))r=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
137
137
  `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
138
- `?yield*this.pushCount(2):0}*pushSpaces(t){let r=this.pos-1,i;do i=this.buffer[++r];while(i===" "||t&&i===" ");let n=r-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=r),n}*pushUntil(t){let r=this.pos,i=this.buffer[r];for(;!t(i);)i=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};dl.Lexer=Ba});var Fa=g(fl=>{"use strict";var Ma=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let r=0,i=this.lineStarts.length;for(;r<i;){let a=r+i>>1;this.lineStarts[a]<t?r=a+1:i=a}if(this.lineStarts[r]===t)return{line:r+1,col:1};if(r===0)return{line:0,col:t};let n=this.lineStarts[r-1];return{line:r,col:t-n+1}}}};fl.LineCounter=Ma});var qa=g(gl=>{"use strict";var bm=Ir("process"),hl=Ci(),km=La();function je(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function pl(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function vl(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Ri(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function ft(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Ai(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let r=0;r<t.length;++r)e.push(t[r])}function ml(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!je(t.start,"explicit-key-ind")&&!je(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,vl(t.value)?t.value.end?Ai(t.value.end,t.sep):t.value.end=t.sep:Ai(t.start,t.sep),delete t.sep)}var Va=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new km.Lexer,this.onNewLine=t}*parse(t,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(t,r))yield*this.next(i);r||(yield*this.end())}*next(t){if(this.source=t,bm.env.LOG_TOKENS&&console.log("|",hl.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let r=hl.tokenType(t);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let i=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let r=t??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let i=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in i?i.indent:0:r.type==="flow-collection"&&i.type==="document"&&(r.indent=0),r.type==="flow-collection"&&ml(r),i.type){case"document":i.value=r;break;case"block-scalar":i.props.push(r);break;case"block-map":{let n=i.items[i.items.length-1];if(n.value){i.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=r;else{Object.assign(n,{key:r,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=i.items[i.items.length-1];n.value?i.items.push({start:[],value:r}):n.value=r;break}case"flow-collection":{let n=i.items[i.items.length-1];!n||n.value?i.items.push({start:[],key:r,sep:[]}):n.sep?n.value=r:Object.assign(n,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let n=r.items[r.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&pl(n.start)===-1&&(r.indent===0||n.start.every(a=>a.type!=="comment"||a.indent<r.indent))&&(i.type==="document"?i.end=n.start:i.items.push({start:n.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{pl(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let r=Ri(this.peek(2)),i=ft(r),n;t.end?(n=t.end,n.push(this.sourceToken),delete t.end):n=[this.sourceToken];let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
138
+ `?yield*this.pushCount(2):0}*pushSpaces(t){let r=this.pos-1,i;do i=this.buffer[++r];while(i===" "||t&&i===" ");let n=r-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=r),n}*pushUntil(t){let r=this.pos,i=this.buffer[r];for(;!t(i);)i=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};gl.Lexer=qa});var Ja=g(wl=>{"use strict";var za=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let r=0,i=this.lineStarts.length;for(;r<i;){let a=r+i>>1;this.lineStarts[a]<t?r=a+1:i=a}if(this.lineStarts[r]===t)return{line:r+1,col:1};if(r===0)return{line:0,col:t};let n=this.lineStarts[r-1];return{line:r,col:t-n+1}}}};wl.LineCounter=za});var Ua=g(Sl=>{"use strict";var Hm=$r("process"),yl=Ri(),Dm=Wa();function He(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function Nl(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function kl(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function _i(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function pt(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Ti(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let r=0;r<t.length;++r)e.push(t[r])}function bl(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!He(t.start,"explicit-key-ind")&&!He(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,kl(t.value)?t.value.end?Ti(t.value.end,t.sep):t.value.end=t.sep:Ti(t.start,t.sep),delete t.sep)}var Ga=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Dm.Lexer,this.onNewLine=t}*parse(t,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(t,r))yield*this.next(i);r||(yield*this.end())}*next(t){if(this.source=t,Hm.env.LOG_TOKENS&&console.log("|",yl.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let r=yl.tokenType(t);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let i=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let r=t??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let i=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in i?i.indent:0:r.type==="flow-collection"&&i.type==="document"&&(r.indent=0),r.type==="flow-collection"&&bl(r),i.type){case"document":i.value=r;break;case"block-scalar":i.props.push(r);break;case"block-map":{let n=i.items[i.items.length-1];if(n.value){i.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=r;else{Object.assign(n,{key:r,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=i.items[i.items.length-1];n.value?i.items.push({start:[],value:r}):n.value=r;break}case"flow-collection":{let n=i.items[i.items.length-1];!n||n.value?i.items.push({start:[],key:r,sep:[]}):n.sep?n.value=r:Object.assign(n,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let n=r.items[r.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Nl(n.start)===-1&&(r.indent===0||n.start.every(a=>a.type!=="comment"||a.indent<r.indent))&&(i.type==="document"?i.end=n.start:i.items.push({start:n.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{Nl(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let r=_i(this.peek(2)),i=pt(r),n;t.end?(n=t.end,n.push(this.sourceToken),delete t.end):n=[this.sourceToken];let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
139
139
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
140
- `,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Ai(n,r.start),n.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let i=!this.onKeyLine&&this.indent===t.indent,n=i&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",a=[];if(n&&r.sep&&!r.value){let o=[];for(let s=0;s<r.sep.length;++s){let c=r.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=r.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||r.value?(a.push(this.sourceToken),t.items.push({start:a}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):n||r.value?(a.push(this.sourceToken),t.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(je(r.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(vl(r.key)&&!je(r.sep,"newline")){let o=ft(r.start),s=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:c}]})}else a.length>0?r.sep=r.sep.concat(a,this.sourceToken):r.sep.push(this.sourceToken);else if(je(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=ft(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||n?t.items.push({start:a,key:null,sep:[this.sourceToken]}):je(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{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||r.value?(t.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(o):(Object.assign(r,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!r.explicitKey&&r.sep&&!je(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Ai(n,r.start),n.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=t.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;r.value||je(r.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>t.indent){let i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let r=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?t.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!r||r.value?t.items.push({start:[],key:n,sep:[]}):r.sep?this.stack.push(n):Object.assign(r,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let n=Ri(i),a=ft(n);ml(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let r=this.source.indexOf(`
140
+ `,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Ti(n,r.start),n.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let i=!this.onKeyLine&&this.indent===t.indent,n=i&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",a=[];if(n&&r.sep&&!r.value){let o=[];for(let s=0;s<r.sep.length;++s){let c=r.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=r.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||r.value?(a.push(this.sourceToken),t.items.push({start:a}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):n||r.value?(a.push(this.sourceToken),t.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(He(r.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(kl(r.key)&&!He(r.sep,"newline")){let o=pt(r.start),s=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:c}]})}else a.length>0?r.sep=r.sep.concat(a,this.sourceToken):r.sep.push(this.sourceToken);else if(He(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=pt(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||n?t.items.push({start:a,key:null,sep:[this.sourceToken]}):He(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{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||r.value?(t.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(o):(Object.assign(r,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!r.explicitKey&&r.sep&&!He(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Ti(n,r.start),n.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=t.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;r.value||He(r.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>t.indent){let i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let r=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?t.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!r||r.value?t.items.push({start:[],key:n,sep:[]}):r.sep?this.stack.push(n):Object.assign(r,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let n=_i(i),a=pt(n);bl(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let r=this.source.indexOf(`
141
141
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
142
- `,r)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Ri(t),i=ft(r);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Ri(t),i=ft(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,r){return this.type!=="comment"||this.indent<=r?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};gl.Parser=Va});var kl=g(tr=>{"use strict";var wl=Aa(),Sm=Jt(),er=Kt(),Em=xn(),Pm=P(),Cm=Fa(),yl=qa();function Nl(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Cm.LineCounter||null,prettyErrors:t}}function xm(e,t={}){let{lineCounter:r,prettyErrors:i}=Nl(t),n=new yl.Parser(r?.addNewLine),a=new wl.Composer(t),o=Array.from(a.compose(n.parse(e)));if(i&&r)for(let s of o)s.errors.forEach(er.prettifyError(e,r)),s.warnings.forEach(er.prettifyError(e,r));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function bl(e,t={}){let{lineCounter:r,prettyErrors:i}=Nl(t),n=new yl.Parser(r?.addNewLine),a=new wl.Composer(t),o=null;for(let s of a.compose(n.parse(e),!0,e.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new er.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&r&&(o.errors.forEach(er.prettifyError(e,r)),o.warnings.forEach(er.prettifyError(e,r))),o}function Rm(e,t,r){let i;typeof t=="function"?i=t:r===void 0&&t&&typeof t=="object"&&(r=t);let n=bl(e,r);if(!n)return null;if(n.warnings.forEach(a=>Em.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:i},r))}function Am(e,t,r){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r=="string"&&(r=r.length),typeof r=="number"){let n=Math.round(r);r=n<1?void 0:n>8?{indent:8}:{indent:n}}if(e===void 0){let{keepUndefined:n}=r??t??{};if(!n)return}return Pm.isDocument(e)&&!i?e.toString(r):new Sm.Document(e,i,r).toString(r)}tr.parse=Rm;tr.parseAllDocuments=xm;tr.parseDocument=bl;tr.stringify=Am});var ht=g(x=>{"use strict";var _m=Aa(),Tm=Jt(),Im=la(),Wa=Kt(),jm=_t(),$e=P(),$m=Ae(),Om=j(),Hm=Te(),Dm=Ie(),Bm=Ci(),Lm=La(),Mm=Fa(),Fm=qa(),_i=kl(),Sl=Ct();x.Composer=_m.Composer;x.Document=Tm.Document;x.Schema=Im.Schema;x.YAMLError=Wa.YAMLError;x.YAMLParseError=Wa.YAMLParseError;x.YAMLWarning=Wa.YAMLWarning;x.Alias=jm.Alias;x.isAlias=$e.isAlias;x.isCollection=$e.isCollection;x.isDocument=$e.isDocument;x.isMap=$e.isMap;x.isNode=$e.isNode;x.isPair=$e.isPair;x.isScalar=$e.isScalar;x.isSeq=$e.isSeq;x.Pair=$m.Pair;x.Scalar=Om.Scalar;x.YAMLMap=Hm.YAMLMap;x.YAMLSeq=Dm.YAMLSeq;x.CST=Bm;x.Lexer=Lm.Lexer;x.LineCounter=Mm.LineCounter;x.Parser=Fm.Parser;x.parse=_i.parse;x.parseAllDocuments=_i.parseAllDocuments;x.parseDocument=_i.parseDocument;x.stringify=_i.stringify;x.visit=Sl.visit;x.visitAsync=Sl.visitAsync});import Ev from"path";var ir=Pt(ht(),1);import Oe from"path";var nr=64*1024,Ti=1024,Ii=64,El=1024,Pl=64,Ja=5,rr={learning:!0,retrieval:!0},Ga={provider:"local"},Vm=12e4,Cl=6e5,qm=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Wm=["**/.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"],zm=[...qm,...Wm].sort((e,t)=>e.localeCompare(t,"en"));var U={include:["**/*"],exclude:[...zm],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4},pt={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
142
+ `,r)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=_i(t),i=pt(r);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=_i(t),i=pt(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,r){return this.type!=="comment"||this.indent<=r?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Sl.Parser=Ga});var Rl=g(nr=>{"use strict";var El=$a(),Lm=Kt(),ir=Qt(),Bm=In(),Mm=P(),Fm=Ja(),Cl=Ua();function Pl(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Fm.LineCounter||null,prettyErrors:t}}function Vm(e,t={}){let{lineCounter:r,prettyErrors:i}=Pl(t),n=new Cl.Parser(r?.addNewLine),a=new El.Composer(t),o=Array.from(a.compose(n.parse(e)));if(i&&r)for(let s of o)s.errors.forEach(ir.prettifyError(e,r)),s.warnings.forEach(ir.prettifyError(e,r));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function xl(e,t={}){let{lineCounter:r,prettyErrors:i}=Pl(t),n=new Cl.Parser(r?.addNewLine),a=new El.Composer(t),o=null;for(let s of a.compose(n.parse(e),!0,e.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new ir.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&r&&(o.errors.forEach(ir.prettifyError(e,r)),o.warnings.forEach(ir.prettifyError(e,r))),o}function qm(e,t,r){let i;typeof t=="function"?i=t:r===void 0&&t&&typeof t=="object"&&(r=t);let n=xl(e,r);if(!n)return null;if(n.warnings.forEach(a=>Bm.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:i},r))}function Wm(e,t,r){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r=="string"&&(r=r.length),typeof r=="number"){let n=Math.round(r);r=n<1?void 0:n>8?{indent:8}:{indent:n}}if(e===void 0){let{keepUndefined:n}=r??t??{};if(!n)return}return Mm.isDocument(e)&&!i?e.toString(r):new Lm.Document(e,i,r).toString(r)}nr.parse=qm;nr.parseAllDocuments=Vm;nr.parseDocument=xl;nr.stringify=Wm});var mt=g(R=>{"use strict";var zm=$a(),Jm=Kt(),Gm=pa(),Ka=Qt(),Um=jt(),De=P(),Km=Ie(),Ym=$(),Xm=$e(),Qm=Oe(),Zm=Ri(),ev=Wa(),tv=Ja(),rv=Ua(),Ii=Rl(),Al=At();R.Composer=zm.Composer;R.Document=Jm.Document;R.Schema=Gm.Schema;R.YAMLError=Ka.YAMLError;R.YAMLParseError=Ka.YAMLParseError;R.YAMLWarning=Ka.YAMLWarning;R.Alias=Um.Alias;R.isAlias=De.isAlias;R.isCollection=De.isCollection;R.isDocument=De.isDocument;R.isMap=De.isMap;R.isNode=De.isNode;R.isPair=De.isPair;R.isScalar=De.isScalar;R.isSeq=De.isSeq;R.Pair=Km.Pair;R.Scalar=Ym.Scalar;R.YAMLMap=Xm.YAMLMap;R.YAMLSeq=Qm.YAMLSeq;R.CST=Zm;R.Lexer=ev.Lexer;R.LineCounter=tv.LineCounter;R.Parser=rv.Parser;R.parse=Ii.parse;R.parseAllDocuments=Ii.parseAllDocuments;R.parseDocument=Ii.parseDocument;R.stringify=Ii.stringify;R.visit=Al.visit;R.visitAsync=Al.visitAsync});import Mv from"path";var or=Rt(mt(),1);import Le from"path";var sr=64*1024,ji=1024,$i=64,_l=1024,Tl=64,Xa=5,ar={learning:!0,retrieval:!0},Qa={provider:"local"},iv=12e4,Il=6e5,nv=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".devin/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],av=["**/.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"],ov=[...nv,...av].sort((e,t)=>e.localeCompare(t,"en"));var K={include:["**/*"],exclude:[...ov],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4},vt={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
143
143
  # ambient_resume: true | false`,memory:"# Project policy for automatic personal-memory learning and retrieval.","memory.learning":`# Allows workflow events in this project to form new personal memories automatically.
144
144
  # learning: true | false`,"memory.retrieval":`# Allows personal memories to be injected into Agent context for this project.
145
145
  # retrieval: true | false`,knowledge:"# Project knowledge retrieval provider used by ordinary Comet tasks.","knowledge.provider":`# Provider for project knowledge.
@@ -163,35 +163,41 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
163
163
  # 可选值:en | zh-CN`,"classic.context_compression":`# 新建 Classic change 是否启用 beta 上下文压缩。
164
164
  # 可选值:off | beta`,"classic.review_mode":`# 新建 Classic change 默认使用的审查深度。
165
165
  # 可选值:off | standard | thorough`,"classic.auto_transition":`# Classic 阶段通过后是否自动进入下一阶段。
166
- # 可选值:true | false`}};function Rl(e,t){return pt[t][e]}function Jm(e,t,r,i){let n=/^(\s*)([a-z_]+):/u.exec(e);if(!n)return null;let a=n[1].length,o=n[2];if(a===0&&o in pt.en)return o;if(a===2&&t){let s=`${t}.${o}`;if(s in pt.en)return s}if(a===4&&t==="knowledge"&&i==="remote"){let s=`knowledge.remote.${o}`;if(s in pt.en)return s}if(a===4&&t==="knowledge"&&i==="local"){let s=`knowledge.local.${o}`;if(s in pt.en)return s}if(a===2&&t===null&&o==="hook")return"hook";if(a===2&&t==="hook"&&o==="allow_paths")return"hook.allow_paths";if(a===4&&t==="native"&&r==="snapshot"){let s=`native.snapshot.${o}`;if(s in pt.en)return s}return null}function ar(e,t){let r=[],i=null,n=null,a=null;for(let o of(0,ir.stringify)(e).trimEnd().split(`
167
- `)){let s=Jm(o,i,n,a);if(s){let c=o.match(/^\s*/u)?.[0]??"";for(let l of Rl(s,t).split(`
166
+ # 可选值:true | false`}};function $l(e,t){return vt[t][e]}function sv(e,t,r,i){let n=/^(\s*)([a-z_]+):/u.exec(e);if(!n)return null;let a=n[1].length,o=n[2];if(a===0&&o in vt.en)return o;if(a===2&&t){let s=`${t}.${o}`;if(s in vt.en)return s}if(a===4&&t==="knowledge"&&i==="remote"){let s=`knowledge.remote.${o}`;if(s in vt.en)return s}if(a===4&&t==="knowledge"&&i==="local"){let s=`knowledge.local.${o}`;if(s in vt.en)return s}if(a===2&&t===null&&o==="hook")return"hook";if(a===2&&t==="hook"&&o==="allow_paths")return"hook.allow_paths";if(a===4&&t==="native"&&r==="snapshot"){let s=`native.snapshot.${o}`;if(s in vt.en)return s}return null}function cr(e,t){let r=[],i=null,n=null,a=null;for(let o of(0,or.stringify)(e).trimEnd().split(`
167
+ `)){let s=sv(o,i,n,a);if(s){let c=o.match(/^\s*/u)?.[0]??"";for(let l of $l(s,t).split(`
168
168
  `))r.push(`${c}${l}`)}r.push(o),/^[a-z_]+:/u.test(o)?(o.startsWith("native:")?i="native":o.startsWith("classic:")?i="classic":o.startsWith("hook:")?i="hook":o.startsWith("memory:")?i="memory":o.startsWith("knowledge:")?i="knowledge":i=null,n=null,a=null):/^ {2}[a-z_]+:/u.test(o)&&(i==="native"&&(n=o.startsWith(" snapshot:")?"snapshot":null),i==="knowledge"&&(a=o.startsWith(" local:")?"local":o.startsWith(" remote:")?"remote":null))}return r.push(""),r.join(`
169
- `)}function Gm(e,t){if(typeof e!="string")throw new Error(`${t} must be a string`);let r=e.trim();if(r.length===0||Oe.posix.isAbsolute(r)||Oe.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${t} must be a project-relative path`);if(r===".")return[];let i=r.replaceAll("\\","/").split("/");if(i.some(n=>n===".."))throw new Error(`${t} must stay inside the project root`);if(i.some(n=>n===""||n==="."))throw new Error(`${t} must not contain empty or dot path segments`);return i}function Ke(e){let t=Gm(e,"native.artifact_root");return t.length===0?".":t.join("/")}function Al(e,t="docs"){let r=e??t;if(r!=="legacy"&&r!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return r}function ji(e,t,r=!1){if(typeof e!="string")throw new Error(`${t} must be a string`);let i=e.trim().replaceAll("\\","/");if(i.length===0||Oe.posix.isAbsolute(i)||Oe.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${t} must be relative to its declared path base`);let n=i.split("/");if(n.some(a=>a===".."))throw new Error(`${t} must stay inside its declared path base`);if(n.some(a=>a===""||a==="."))throw new Error(`${t} must not contain empty or dot path segments`);if(!r&&/[*?]/u.test(i))throw new Error(`${t} cannot contain wildcards`);return n.join("/")}function be(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function _l(e,t,r){let i=e??t;if(i!=="en"&&i!=="zh-CN")throw new Error(`${r} must be en or zh-CN`);return i}function Ua(e,t){if(typeof e!="string"||e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.split("/").includes(".."))throw new Error(`${t} contains an unsafe pattern`);if(e.length>Ti)throw new Error(`${t} exceeds ${Ti} characters`);let r=0;for(let i=0;i<e.length;i+=1)e[i]==="?"?r+=1:e[i]==="*"&&(r+=1,e[i+1]==="*"&&(i+=1));if(r>Ii)throw new Error(`${t} contains more than ${Ii} wildcard tokens`);return e}function xl(e,t,r){if(e===void 0)return[...r];if(!Array.isArray(e))throw new Error(`${t} contains an unsafe pattern`);return[...new Set(e.map(i=>Ua(i,t)))].sort((i,n)=>i.localeCompare(n,"en"))}function za(e,t,r){let i=e??t;if(!Number.isSafeInteger(i)||i<1)throw new Error(`${r} must be a positive integer`);return i}function Um(e){if(e===void 0)return{...U,include:[...U.include],exclude:[...U.exclude]};let t=be(e,"native.snapshot");return{include:xl(t.include,"native.snapshot.include",U.include),exclude:xl(t.exclude,"native.snapshot.exclude",U.exclude),max_files:za(t.max_files,U.max_files,"native.snapshot.max_files"),max_total_bytes:za(t.max_total_bytes,U.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:za(t.max_duration_ms,U.max_duration_ms,"native.snapshot.max_duration_ms")}}function Km(e){if(e===void 0)return;let t=be(e,"native.pending_root_move"),r=t.id,i=t.from_artifact_root,n=t.to_artifact_root,a=t.stage;if(typeof r!="string"||!/^[a-f0-9-]{8,}$/u.test(r))throw new Error("native.pending_root_move.id is invalid");if(typeof i!="string"||typeof n!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(t.cleanup!==void 0){let s=be(t.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,u=s.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:u}}return{id:r,fromArtifactRoot:Ke(i),toArtifactRoot:Ke(n),stage:a,...o?{cleanup:o}:{}}}function Ym(e){if(e===void 0)return;let t=be(e,"native.finish");if(t.pull_request===void 0)return{};let r=be(t.pull_request,"native.finish.pull_request");if(r.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(r.command)||r.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(r.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let i=r.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(Oe.posix.isAbsolute(i[0])||Oe.win32.isAbsolute(i[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let n=r.timeout_ms??Vm;if(!Number.isSafeInteger(n)||n<1||n>Cl)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${Cl}`);return{pull_request:{provider:"repository-command",command:i,timeout_ms:n}}}function Xm(e,t={}){let r=be(e,"native"),i=r.artifact_root??(t.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let n=r.clarification_mode??"batch";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=r.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=r.max_verify_failures??Ja;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Km(r.pending_root_move),c=Ym(r.finish);return{artifact_root:Ke(i),language:_l(r.language,"en","native.language"),clarification_mode:n,archive_confirmation:a,max_verify_failures:o,snapshot:Um(r.snapshot),...c?{finish:c}:{},...s?{pending_root_move:s}:{}}}function Qm(e){let t=be(e,"classic"),r=t.context_compression??"off";if(r!=="off"&&r!=="beta")throw new Error("classic.context_compression must be off or beta");let i=t.review_mode??"standard";if(i!=="off"&&i!=="standard"&&i!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=t.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Al(t.artifact_layout),language:_l(t.language,"zh-CN","classic.language"),context_compression:r,review_mode:i,auto_transition:n}}function Zm(e){let r=be(e,"hook").allow_paths??[];if(!Array.isArray(r))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(r.map((i,n)=>ji(i,`hook.allow_paths[${n}]`)))]}}function ev(e){if(e===void 0)return{...rr};let t=be(e,"memory"),r=t.learning??rr.learning,i=t.retrieval??rr.retrieval;if(typeof r!="boolean")throw new Error("memory.learning must be true or false");if(typeof i!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:r,retrieval:i}}function Ka(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function tv(e,t){if(typeof e!="string")throw new Error(`${t} must be a string`);let r=e.trim();if(r.length===0||r.includes("\\")||r.includes("\0")||Oe.posix.isAbsolute(r)||Oe.win32.isAbsolute(r)||r.startsWith("~")||r.split("/").some(n=>n===""||n==="."||n===".."))throw new Error(`${t} must be a safe project-relative glob`);if(!r.toLowerCase().endsWith(".md"))throw new Error(`${t} must target a Markdown file ending in .md`);if(r.length>El)throw new Error(`${t} exceeds ${El} characters`);let i=0;for(let n=0;n<r.length;n+=1)r[n]==="?"?i+=1:r[n]==="*"&&(i+=1,r[n+1]==="*"&&(n+=1));if(i>Pl)throw new Error(`${t} contains more than ${Pl} wildcard tokens`);return r}function rv(e){let r=Ka(e,"knowledge.local").include??[];if(!Array.isArray(r))throw new Error("knowledge.local.include must be an array");return{include:[...new Set(r.map((i,n)=>tv(i,`knowledge.local.include[${n}]`)))]}}function iv(e){if(typeof e!="string"||e.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let t;try{t=new URL(e)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let r=t.hostname.toLowerCase().replace(/^\[|\]$/gu,""),i=r==="localhost"||r==="127.0.0.1"||r==="::1";if(t.protocol!=="https:"&&!(t.protocol==="http:"&&i))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return t.toString()}function nv(e){let t=Ka(e,"knowledge.remote"),r=iv(t.endpoint),i=t.token_env;if(i!==void 0&&(typeof i!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(i)))throw new Error("knowledge.remote.token_env must be an environment variable name");let n=t.scope;if(n!==void 0&&(typeof n!="string"||n.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let a=t.timeout_ms??5e3;if(typeof a!="number"||!Number.isSafeInteger(a)||a<100||a>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:r,...i===void 0?{}:{token_env:i},...n===void 0?{}:{scope:n},timeout_ms:a}}function av(e){if(e===void 0)return{...Ga};let t=Ka(e,"knowledge"),r=t.provider??"local";if(r!=="local"&&r!=="remote")throw new Error("knowledge.provider must be local or remote");let i=t.local===void 0?void 0:rv(t.local);if(r==="local")return{provider:r,...i?{local:i}:{}};let n=t.remote===void 0?void 0:nv(t.remote);if(n===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:r,...i?{local:i}:{},remote:n}}function ov(e){let t=e??!0;if(typeof t!="boolean")throw new Error("ambient_resume must be true or false");return t}function sv(e,t,r,i,n,a,o,s){let c=e.schema!==void 0;if(!(c||e.default_workflow!==void 0||e.workflows!==void 0||!s.allowPartialProject&&e.native!==void 0)||s.allowPartialProject&&!c)return null;if(e.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(e.default_workflow!=="native"&&e.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let u=e.workflows??[e.default_workflow];if(!Array.isArray(u)||u.length===0||u.some(f=>f!=="native"&&f!=="classic"))throw new Error("workflows must contain native and/or classic");let d=[...new Set(u)];if(!d.includes(e.default_workflow))throw new Error("workflows must include default_workflow");if(d.includes("native")&&!n)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:e.default_workflow,workflows:d,ambient_resume:o,...t?{hook:t}:{},memory:r,knowledge:i,...n?{native:n}:{},...a?{classic:a}:{}}}function mt(e,t={}){let r=(0,ir.parseDocument)(e,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${r.errors[0].message}`);let i=r.toJS();if(i==null)return{value:{},config:null,ambient_resume:!0};if(typeof i!="object"||Array.isArray(i))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let n=i,a=ov(n.ambient_resume),o=n.hook===void 0?void 0:Zm(n.hook),s=ev(n.memory),c=av(n.knowledge),l=n.native===void 0?void 0:Xm(n.native,{allowMissingArtifactRoot:t.allowMissingNativeFields}),u=n.classic===void 0?void 0:Qm(n.classic),d=sv(n,o,s,c,l,u,a,{allowPartialProject:t.allowPartialProject??!1});return{value:n,config:d,ambient_resume:a,memory:s,knowledge:c,...o?{hook:o}:{},...l?{native:l}:{},...u?{classic:u}:{}}}function Tl(e){return{id:e.id,from_artifact_root:e.fromArtifactRoot,to_artifact_root:e.toArtifactRoot,stage:e.stage,...e.cleanup?{cleanup:{kind:e.cleanup.kind,state:e.cleanup.state,manifest_hash:e.cleanup.manifestHash}}:{}}}function Il(e){let t=e.knowledge??{...Ga};return{schema:e.schema,default_workflow:e.default_workflow,workflows:e.workflows??[e.default_workflow],ambient_resume:e.ambient_resume,memory:e.memory??{...rr},knowledge:{provider:t.provider,...t.local&&t.local.include.length>0?{local:{include:[...t.local.include]}}:{},...t.remote?{remote:{endpoint:t.remote.endpoint,timeout_ms:t.remote.timeout_ms,...t.remote.token_env===void 0?{}:{token_env:t.remote.token_env},...t.remote.scope===void 0?{}:{scope:t.remote.scope}}}:{}},...e.hook?{hook:{allow_paths:[...e.hook.allow_paths]}}:{},...e.native?{native:{artifact_root:e.native.artifact_root,language:e.native.language,clarification_mode:e.native.clarification_mode,archive_confirmation:e.native.archive_confirmation,max_verify_failures:e.native.max_verify_failures,...e.native.finish?.pull_request?{finish:{pull_request:{provider:e.native.finish.pull_request.provider,command:[...e.native.finish.pull_request.command],timeout_ms:e.native.finish.pull_request.timeout_ms}}}:{},...e.native.pending_root_move?{pending_root_move:Tl(e.native.pending_root_move)}:{}}}:{},...e.classic?{classic:{artifact_layout:e.classic.artifact_layout,language:e.classic.language,context_compression:e.classic.context_compression,review_mode:e.classic.review_mode,auto_transition:e.classic.auto_transition}}:{}}}function G(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function or(e,t){let r=Il(t),i=mt((0,ir.stringify)(r)).config;if(!i)throw new Error("Unsupported Comet project schema");let n={...e,schema:i.schema,default_workflow:i.default_workflow,workflows:i.workflows,ambient_resume:i.ambient_resume};if(i.hook&&(n.hook={...G(e.hook),allow_paths:[...i.hook.allow_paths]}),i.memory){let a=G(e.memory);n.memory={...a,learning:i.memory.learning,retrieval:i.memory.retrieval}}if(i.knowledge){let a=G(e.knowledge),o={...a,provider:i.knowledge.provider};if(i.knowledge.local&&i.knowledge.local.include.length>0?o.local={...G(a.local),include:[...i.knowledge.local.include]}:delete o.local,i.knowledge.remote){let c={...G(a.remote),endpoint:i.knowledge.remote.endpoint,timeout_ms:i.knowledge.remote.timeout_ms,...i.knowledge.remote.token_env===void 0?{}:{token_env:i.knowledge.remote.token_env},...i.knowledge.remote.scope===void 0?{}:{scope:i.knowledge.remote.scope}};i.knowledge.remote.token_env===void 0&&delete c.token_env,i.knowledge.remote.scope===void 0&&delete c.scope,o.remote=c}else delete o.remote;n.knowledge=o}if(i.native){let a=G(e.native),o={...a,artifact_root:i.native.artifact_root,language:i.native.language,clarification_mode:i.native.clarification_mode,archive_confirmation:i.native.archive_confirmation,max_verify_failures:i.native.max_verify_failures};if(i.native.finish?.pull_request){let s=G(a.finish);o.finish={...s,pull_request:{...G(s.pull_request),provider:i.native.finish.pull_request.provider,command:[...i.native.finish.pull_request.command],timeout_ms:i.native.finish.pull_request.timeout_ms}}}else{let s={...G(a.finish)};delete s.pull_request,Object.keys(s).length>0?o.finish=s:delete o.finish}if(delete o.snapshot,i.native.pending_root_move){let s=G(a.pending_root_move),c=Tl(i.native.pending_root_move),l=G(s.cleanup),u=G(c.cleanup);o.pending_root_move={...s,...c,...c.cleanup?{cleanup:{...l,...u}}:{}}}else delete o.pending_root_move;n.native=o}return i.classic&&(n.classic={...G(e.classic),artifact_layout:i.classic.artifact_layout,language:i.classic.language,context_compression:i.classic.context_compression,review_mode:i.classic.review_mode,auto_transition:i.classic.auto_transition}),n}function $i(e="docs",t="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,memory:{...rr},knowledge:{...Ga},native:{artifact_root:Ke(e),language:t,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Ja,snapshot:{...U,include:[...U.include],exclude:[...U.exclude]}}}}import{createHash as lv}from"crypto";import{promises as Di}from"fs";import De from"path";import{constants as Oi,promises as Ye}from"fs";function He(e){return e!==0&&e!==0n&&e!=="0"}function fe(e,t){return He(e.dev)&&He(t.dev)&&He(e.ino)&&He(t.ino)}function T(e,t){let r=He(e.dev)&&He(t.dev);if(r&&e.dev!==t.dev)return!1;let i=He(e.ino)&&He(t.ino);return i&&e.ino!==t.ino?!1:r&&i?!0:e.birthtime===t.birthtime}var ae=class extends Error{reason;constructor(t,r,i){super(r,i),this.name="RaceSafeReadError",this.reason=t}};function Ya(e){return"birthtimeNs"in e&&typeof e.birthtimeNs=="bigint"?e.birthtimeNs:e.birthtimeMs}function jl(e){return"ctimeNs"in e&&typeof e.ctimeNs=="bigint"?e.ctimeNs:e.ctimeMs}function sr(e){return{dev:e.dev,ino:e.ino,birthtime:Ya(e)}}function Hi(e,t){let r=sr(e),i=sr(t);return fe(r,i)?T(r,i):T(r,i)&&Ya(e)===Ya(t)&&jl(e)===jl(t)&&e.size===t.size}async function vt(e,t,r={}){if(!Number.isSafeInteger(t)||t<1)throw new Error("race-safe read byte limit must be a positive integer");let i=r.label??"file",n=r.bigint===!0,a=await Ye.lstat(e,{bigint:n});if(!a.isFile()||a.isSymbolicLink())throw new ae("not-regular-file",`${i} must be a regular file`);if(BigInt(a.size)>BigInt(t))throw new ae("too-large",`${i} exceeds ${t} bytes`);let o=await Ye.realpath(e);await r.verify?.("pre-open",{realPath:o,identity:sr(a)});let s=process.platform==="win32"?Oi.O_RDONLY:Oi.O_RDONLY|Oi.O_NOFOLLOW|Oi.O_NONBLOCK,c;try{c=await Ye.open(e,s)}catch(l){throw l.code==="ELOOP"?new ae("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,u,d]=await Promise.all([c.stat({bigint:n}),Ye.lstat(e,{bigint:n}),Ye.realpath(e)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||d!==o||!Hi(a,l)||!Hi(a,u))throw new ae("changed",`${i} changed while opening`);await r.verify?.("post-open",{realPath:d,identity:sr(l)}),await r.hooks?.afterOpen?.();let f=[],p=0,v=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let y=t+1-p,{bytesRead:b}=await c.read(v,0,Math.min(v.length,y),null);if(b===0)break;if(p+=b,p>t)throw new ae("too-large",`${i} exceeds ${t} bytes`);f.push(Buffer.from(v.subarray(0,b)))}await r.hooks?.beforeFinalCheck?.();let[h,m,w]=await Promise.all([c.stat({bigint:n}),Ye.lstat(e,{bigint:n}),Ye.realpath(e)]);if(!m.isFile()||m.isSymbolicLink()||w!==o||!Hi(a,h)||!Hi(a,m))throw new ae("changed",`${i} changed while reading`);return await r.verify?.("post-read",{realPath:w,identity:sr(h)}),{bytes:Buffer.concat(f,p),stat:h,realPath:w}}finally{await c.close()}}function cv(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function Xa(e,t){let r=De.relative(e,t);return r===""||!De.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${De.sep}`)}async function $l(e,t){let r=De.resolve(e),i=await Di.lstat(r);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${t} project root must be a real directory`);return Di.realpath(r)}async function Ol(e,t,r,i){let n=e;for(let a=0;a<r.length;a++){n=De.join(n,r[a]);let o;try{o=await Di.lstat(n)}catch(u){if(cv(u))return{exists:!1,kind:"missing"};throw u}let s=De.relative(e,n).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${s}`);let c=a===r.length-1;if(!c&&!o.isDirectory())throw new Error(`${i.label} ancestor ${s} must be a real directory`);if(c&&(i.expected==="file"&&!o.isFile()||i.expected==="directory"&&!o.isDirectory()||i.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${i.label} must be a real ${i.expected}`);let l=await Di.realpath(n);if(!Xa(t,l))throw new Error(`${i.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function gt(e,t,r){let i=ji(t,r.label),n=De.resolve(e),a=await $l(n,r.label),o=i.split("/"),s=De.resolve(n,...o);if(!Xa(n,s))throw new Error(`${r.label} must stay inside the project root`);let c=await Ol(n,a,o,r);return{projectRoot:n,target:s,relative:i,exists:c.exists,kind:c.kind}}async function Be(e,t,r,i){let n=await gt(e,t,{label:i.label,expected:"file"});if(!n.exists){let o=new Error(`${i.label} does not exist`);throw o.code="ENOENT",o}let a=await $l(n.projectRoot,i.label);return vt(n.target,r,{...i,verify:async(o,s)=>{if(!Xa(a,s.realPath))throw new Error(`${i.label} resolves outside the project root`);await Ol(n.projectRoot,a,n.relative.split("/"),{label:i.label,expected:"file"})}})}var cr=".comet/config.yaml";function Qa(e,t){return e.exists===t.exists&&e.sha256===t.sha256}function uv(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}async function Bi(e,t={}){return(await lr(e,t)).document}async function Hl(e){try{return(await Be(e,cr,nr,{label:cr})).bytes}catch(t){if(uv(t))return null;throw t}}function Dl(e){return e?{exists:!0,sha256:lv("sha256").update(e).digest("hex")}:{exists:!1,sha256:null}}async function Li(e){return Dl(await Hl(e))}async function lr(e,t={}){let r=await Hl(e);return{document:r?mt(r.toString("utf8"),t):null,identity:Dl(r)}}async function Za(e){return(await Bi(e))?.config??null}var tb=16*1024;async function eo(e,t){if(!t)return;let r=await Li(e);if(!Qa(r,t))throw new Error("Project config changed before commit; rerun the operation")}import{randomUUID as pv}from"crypto";import{promises as M}from"fs";import oe from"path";function to(e,t){let r=oe.relative(e,t);return r===""||!oe.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${oe.sep}`)}function mv(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function ro(e,t){return T({dev:e.dev,ino:e.ino,birthtime:e.birthtimeMs},{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs})}function vv(e,t){return ro(e,t)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function Bl(e){let t=await M.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${e}`);return{path:e,realPath:await M.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function dr(e){for(let t of e){let r=await M.lstat(t.path);if(!r.isDirectory()||r.isSymbolicLink()||!mv(t,r)||await M.realpath(t.path)!==t.realPath)throw new Error(`Native atomic write parent changed before commit: ${t.path}`)}}async function gv(e,t){let r=oe.resolve(e),i=oe.resolve(t);if(!to(r,i))throw new Error(`Native atomic write parent is outside its managed root: ${t}`);let n=[await Bl(r)],a=oe.relative(r,i).split(oe.sep).filter(Boolean),o=r;for(let s of a){await dr(n),o=oe.join(o,s);try{await M.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Bl(o);if(!to(n[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);n.push(c)}return await dr(n),n}async function wv(e){let t;try{t=await M.open(e,"r"),await t.sync()}catch(r){let i=r.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(i??""))throw r}finally{await t?.close()}}async function Ll(e,t,r={}){let i=oe.dirname(e),n=r.containedRoot?await gv(r.containedRoot,i):null;n||await M.mkdir(i,{recursive:!0});let a=oe.join(i,`.${oe.basename(e)}.${pv()}.tmp`),o,s,c;try{if(await r.beforeTemporaryOpen?.(),o=await M.open(a,"wx"),s=await o.stat(),n){let[l,u]=await Promise.all([M.lstat(a),M.realpath(a)]);if(await dr(n),!l.isFile()||l.isSymbolicLink()||!ro(s,l)||!to(n[0].realPath,u))throw new Error("Native atomic write temporary file opened outside its managed parent")}if(typeof t=="string"?await o.writeFile(t,"utf8"):await o.writeFile(t),await o.sync(),c=await o.stat(),!ro(s,c))throw new Error("Native atomic write temporary file changed while writing");if(await o.close(),o=void 0,await r.beforeCommit?.(),n){await dr(n);let l=await M.lstat(a);if(!l.isFile()||l.isSymbolicLink()||!c||!vv(l,c))throw new Error("Native atomic write temporary file changed before commit")}r.exclusive?(await M.link(a,e),await M.unlink(a)):await M.rename(a,e),await wv(i)}catch(l){if(await o?.close(),!n)await M.rm(a,{force:!0});else try{await dr(n),await M.rm(a,{force:!0})}catch{}throw l}}async function z(e,t,r={}){await Ll(e,t,r)}async function Ml(e,t,r={}){await Ll(e,t,r)}async function K(e,t,r={}){await z(e,JSON.stringify(t,null,2)+`
170
- `,r)}import{existsSync as Fl,promises as Xe}from"fs";import R from"path";import yv from"os";var Mi=".comet/config.yaml",Nv=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;async function io(e){try{return await Xe.lstat(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function bv(e){try{let t=await Xe.readFile(e,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(t)}catch(t){if(t.code==="ENOENT")return!1;throw t}}function yt(e,t){let r=R.relative(e,t);return r===""||!R.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${R.sep}`)}async function wt(e){let t=[],r=e;for(;!await io(r);){let n=R.dirname(r);if(n===r)break;t.push(R.basename(r)),r=n}let i=await Xe.realpath(r);return R.resolve(i,...t.reverse())}async function no(e){try{return(await Xe.lstat(e)).isSymbolicLink()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function ao(e){let t=R.resolve(e);try{(await Xe.stat(t)).isDirectory()||(t=R.dirname(t))}catch(n){if(n.code!=="ENOENT")throw n}let r=t,i=R.resolve(yv.homedir());for(;;){if(!(t===i&&r!==i)){let o=R.join(t,...Mi.split("/")),s=t===r||await bv(o);if(await io(o)&&s)return t}if(await io(R.join(t,".git")))return t;let a=R.dirname(t);if(a===t)return r;t=a}}function fr(e){return Ke(e)}async function kv(e,t){let r=fr(t),i=R.resolve(e,...r.split("/")),n=await Xe.realpath(e),a=await wt(i);if(!yt(n,a))throw new Error("native.artifact_root resolves outside the project root");return i}async function he(e,t){let r=fr(t),i=await kv(e,r),n=R.join(i,"comet");if(await no(n))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([wt(i),wt(n)]);if(!yt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");let s=R.resolve(e),c=R.join(s,".comet","runtime","native");if(await no(c))throw new Error("The Native Runtime root must not be a symbolic link");let[l,u]=await Promise.all([Xe.realpath(s),wt(c)]);if(!yt(l,u))throw new Error("The Native Runtime root resolves outside the project root");return{projectRoot:s,configFile:R.join(e,...Mi.split("/")),artifactRoot:i,artifactRootRef:r,nativeRoot:n,specsDir:R.join(n,"specs"),changesDir:R.join(n,"changes"),archiveDir:R.join(n,"archive"),runtimeDir:c,changesRuntimeDir:R.join(c,"changes"),locksDir:R.join(c,"locks"),transactionsDir:R.join(c,"transactions")}}function Vl(e){if(!Nv.test(e))throw new Error(`Invalid Native change name: ${e}`)}function hr(e,t){Vl(t);let r=R.join(e.changesRuntimeDir,t);if(!F(e.changesRuntimeDir,r))throw new Error("Native change Runtime path escaped");return r}function Sv(e,t){Vl(t);let r=R.join(e.changesDir,t,"runtime");if(!F(e.changesDir,r))throw new Error("Legacy Native change Runtime path escaped");return r}function pe(e,t){let r=hr(e,t);if(Fl(r))return r;let i=Sv(e,t);return Fl(i)?i:r}function se(e,t){let r=R.resolve(t);if(F(e.runtimeDir,r))return e.runtimeDir;if(F(e.nativeRoot,r))return e.nativeRoot;throw new Error(`Path is outside Native document and Runtime roots: ${t}`)}function F(e,t){return yt(R.resolve(e),R.resolve(t))}async function $(e,t){let r=R.resolve(e),i=R.resolve(t);if(!yt(r,i))throw new Error(`Path is outside the Native root: ${t}`);if(await no(r))throw new Error(`Native root must not be a symbolic link: ${e}`);let[n,a]=await Promise.all([wt(r),wt(i)]);if(!yt(n,a))throw new Error(`Path resolves outside the Native root: ${t}`);return i}function ql(e="docs",t="en"){return $i(e,t)}async function Q(e){let t=(await Bi(e))?.config??null;return t?.native?t:null}async function Le(e,t,r={}){let i=await lr(e,{allowPartialProject:!0}),n=or(i.document?.value??{},t),a=Ev.join(e,...Mi.split("/"));await z(a,ar(n,t.native.language==="zh-CN"?"zh-CN":"en"),{containedRoot:e,beforeCommit:async()=>{await r.beforeCommit?.(),await eo(e,i.identity)}})}import{createHash as Xg,randomUUID as Qg}from"crypto";import{promises as Ve}from"fs";import I from"path";import{AsyncLocalStorage as Pv}from"async_hooks";import{randomUUID as Jl}from"crypto";import{promises as Z}from"fs";import Gl from"os";import V from"path";var Wl=16*1024,Ul=".coordinator",Cv=5e3,zl=new Pv,Fi=new Map;function xv(e){if(!/^[a-z][a-z0-9-]*$/u.test(e))throw new Error(`Invalid Native lock name: ${e}`);return`${e}.lock`}function Rv(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Invalid Native lock metadata: ${t}`);let r=e;if(typeof r.id!="string"||r.id.length===0||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<1||typeof r.hostname!="string"||r.hostname.length===0||typeof r.createdAt!="string"||r.createdAt.length===0||typeof r.operation!="string"||r.operation.length===0)throw new Error(`Invalid Native lock metadata: ${t}`);return r}function Kl(e){return{device:e.dev.toString(),inode:e.ino.toString(),size:e.size.toString(),birthtimeNs:e.birthtimeNs.toString(),ctimeNs:e.ctimeNs.toString(),mtimeNs:e.mtimeNs.toString()}}function oo(e,t){let r={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs},i={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs};return fe(r,i)?T(r,i):T(r,i)&&e.size===t.size}function so(e,t){return oo(e,t)&&e.size===t.size&&e.birthtimeNs===t.birthtimeNs&&e.ctimeNs===t.ctimeNs&&e.mtimeNs===t.mtimeNs}async function Me(e){let t,r;try{let i=await vt(e,Wl,{bigint:!0,label:"Native lock"});t=i.bytes,r=i.stat}catch(i){if(i.code==="ENOENT")return null;throw i instanceof ae?i.reason==="too-large"?new Error(`Native lock metadata exceeds ${Wl} bytes: ${e}`,{cause:i}):i.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${e}`,{cause:i}):new Error(`Native lock changed while reading: ${e}`,{cause:i}):i}return{file:e,owner:Rv(JSON.parse(t.toString("utf8")),e),identity:Kl(r)}}async function Av(e){return(await Me(e))?.owner??null}function _v(e){if(!e)return{status:"missing",owner:null,identity:null};if(e.owner.hostname!==Gl.hostname())return{status:"unknown",owner:e.owner,identity:e.identity};let t=Hv(e.owner.pid);return{status:t===!0?"active":t===!1?"stale":"unknown",owner:e.owner,identity:e.identity}}async function Tv(e,t){try{await Z.lstat(t);return}catch(r){if(r.code!=="ENOENT")throw r}try{await Z.rename(e,t)}catch(r){if(r.code!=="ENOENT")throw r}}async function co(e,t){let r=await Me(e.file);if(!r)return"missing";if(r.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!so(r.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);await Z.mkdir(t,{recursive:!0});let i=V.join(t,`${V.basename(e.file)}.${e.owner.id}.${Jl()}.removed`);try{await Z.rename(e.file,i)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let n=await Me(i);if(!n||n.owner.id!==e.owner.id||!oo(n.identity,e.identity))throw await Tv(i,e.file),new Error(`Native lock changed before quarantine: ${e.file}`);return await Z.rm(i,{force:!0}),"removed"}function Yl(e){return{id:Jl(),pid:process.pid,hostname:Gl.hostname(),createdAt:new Date().toISOString(),operation:e}}async function Xl(e,t){let r;try{r=await Z.open(e,"wx")}catch(i){if(i.code==="EEXIST"){let n=await Av(e);throw new Error(`Native lock is already held: ${e}${n?` by pid ${n.pid} for ${n.operation}`:""}`,{cause:i})}throw i}try{return await r.writeFile(JSON.stringify(t,null,2)+`
171
- `,"utf8"),await r.sync(),Kl(await r.stat({bigint:!0}))}finally{await r.close()}}async function Iv(e,t){let r=await $(e.runtimeDir,e.locksDir);await Z.mkdir(r,{recursive:!0});let i=await $(e.runtimeDir,V.join(r,Ul));await Z.mkdir(i,{recursive:!0});let n=Yl(t),a=V.join(i,`.${n.id}.tmp`),o=V.join(i,`${n.id}.claim`);try{let s=await Xl(a,n);await Z.rename(a,o);let c=await Me(o);if(!c||!oo(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:e.runtimeDir,locksDir:r,owner:n,identity:c.identity}}finally{await Z.rm(a,{force:!0})}}async function jv(e){let t=V.dirname(e.file),r=!1,i=V.basename(e.file);for(let n of await Z.readdir(t,{withFileTypes:!0})){if(!n.isFile()||n.isSymbolicLink()||!n.name.endsWith(".claim"))continue;let a=V.join(t,n.name);if(V.resolve(a)!==V.resolve(e.file))try{let o=await Me(a),s=_v(o);if(s.status==="missing")continue;if(s.status==="stale"&&o){await co(o,t);continue}n.name<i&&(r=!0)}catch{n.name<i&&(r=!0)}}return r}async function Ql(e){let t=await Me(e.file);if(t){if(t.owner.id!==e.owner.id||!so(t.identity,e.identity))throw new Error(`Native lock coordinator ownership changed: ${e.file}`);await co(t,V.dirname(e.file))}}async function $v(e,t){let r=Date.now()+Cv;for(;;){let i=await Iv(e,t);if(!await jv(i))return i;if(await Ql(i),Date.now()>=r)throw new Error(`Native lock coordinator is busy: ${e.locksDir}`);await new Promise(n=>setTimeout(n,2+Math.floor(Math.random()*7)))}}async function Ov(e){let t=Fi.get(e)??Promise.resolve(),r,i=new Promise(a=>{r=a}),n=t.then(()=>i);return Fi.set(e,n),await t,()=>{r(),Fi.get(e)===n&&Fi.delete(e)}}async function Zl(e,t,r){let i=V.resolve(e.locksDir),n=zl.getStore();if(n?.has(i))return r();let a=await Ov(i);try{let o=await $v(e,t),s=new Map(n??[]);return s.set(i,o),await zl.run(s,async()=>{try{return await r()}finally{await Ql(o)}})}finally{a()}}async function pr(e,t,r){return Zl(e,`acquire ${t}`,async()=>{let i=await $(e.runtimeDir,e.locksDir);await Z.mkdir(i,{recursive:!0});let n=await $(e.runtimeDir,V.join(i,xv(t))),a=Yl(r),o=await Xl(n,a);return{file:n,nativeRoot:e.runtimeDir,locksDir:i,owner:a,identity:o}})}async function mr(e){await Me(e.file)&&await Zl({runtimeDir:e.nativeRoot,locksDir:e.locksDir},`release ${V.basename(e.file)}`,async()=>{let t=await Me(e.file);if(!t)return;if(t.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!so(t.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);let r=V.join(e.locksDir,Ul);await co(t,r)})}function Hv(e){try{return process.kill(e,0),!0}catch(t){let r=t.code;return r==="ESRCH"?!1:r==="EPERM"?!0:null}}import{createHash as Dv}from"node:crypto";import{constants as Vi,promises as C}from"node:fs";import _ from"node:path";function me(e,t){let r=_.relative(e,t);return r===""||!_.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${_.sep}`)}function eu(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native protected file byte limit must be a positive integer");return e}function qi(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function tu(e){return{dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs,ctimeMs:e.ctimeMs,mtimeMs:e.mtimeMs,size:e.size}}function Nt(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function Qe(e,t){let r=await C.lstat(e);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${t} parent must be a real directory: ${e}`);return{path:e,realPath:await C.realpath(e),dev:r.dev,ino:r.ino,birthtimeMs:r.birthtimeMs}}async function vr(e,t,r){let i=_.resolve(e),n=_.resolve(t);if(!me(i,n))throw new Error(`${r} is outside its managed root`);let a=[await Qe(i,r)],o=i;for(let s of _.relative(i,n).split(_.sep).filter(Boolean)){await L(a,r),o=_.join(o,s);let c=await Qe(o,r);if(!me(a[0].realPath,c.realPath))throw new Error(`${r} parent resolves outside its managed root: ${o}`);a.push(c)}return await L(a,r),a}async function L(e,t){for(let r of e){let i=await C.lstat(r.path);if(!i.isDirectory()||i.isSymbolicLink()||!qi(r,i)||await C.realpath(r.path)!==r.realPath)throw new Error(`${t} parent changed during I/O: ${r.path}`)}}async function Bv(e,t,r){let i=[],n=0,a=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let o=t+1-n,{bytesRead:s}=await e.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(n+=s,n>t)throw new Error(`${r} exceeds ${t} bytes`);i.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(i,n)}async function J(e){let t=eu(e.maxBytes),r=_.resolve(e.file),i=await vr(e.root,_.dirname(r),e.label),n=await Promise.all((e.forbiddenRoots??[]).map(u=>Qe(_.resolve(u),e.label)));await e.hooks?.afterParentChainCaptured?.(),await L(i,e.label);let a=await C.lstat(r);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);if(a.size>t)throw new Error(`${e.label} exceeds ${t} bytes`);let o=tu(a),s=await C.realpath(r);if(!me(i[0].realPath,s))throw new Error(`${e.label} resolves outside its managed root`);if(n.some(u=>me(u.realPath,s)))throw new Error(`${e.label} resolves inside an excluded root`);let c=process.platform==="win32"?Vi.O_RDONLY:Vi.O_RDONLY|Vi.O_NOFOLLOW|Vi.O_NONBLOCK,l=await C.open(r,c);try{let u=await l.stat();await e.hooks?.afterOpen?.();let[d,f]=await Promise.all([C.lstat(r),C.realpath(r)]);if(await L(i,e.label),await L(n,e.label),!u.isFile()||!d.isFile()||d.isSymbolicLink()||f!==s||!Nt(o,u)||!Nt(o,d))throw new Error(`${e.label} changed while opening`);await e.hooks?.beforeRead?.();let p=await Bv(l,t,e.label);await e.hooks?.beforeFinalCheck?.();let[v,h,m]=await Promise.all([l.stat(),C.lstat(r),C.realpath(r)]);if(await L(i,e.label),await L(n,e.label),!h.isFile()||h.isSymbolicLink()||m!==s||!Nt(o,v)||!Nt(o,h))throw new Error(`${e.label} changed while reading`);return{bytes:p,hash:Dv("sha256").update(p).digest("hex"),size:p.length}}finally{await l.close()}}async function Ze(e){let t=await vr(e.root,e.directory,e.label),r;if(e.maxEntries===void 0)r=await C.readdir(e.directory,{withFileTypes:!0});else{let i=eu(e.maxEntries);r=[];let n=await C.opendir(e.directory);try{for await(let a of n)if(r.push(a),r.length>i)throw new Error(`${e.label} exceeds ${i} entries`)}finally{await n.close().catch(a=>{if(a.code!=="ERR_DIR_CLOSED")throw a})}}return await L(t,e.label),{entries:r,verify:()=>L(t,e.label)}}async function Lv(e){let t=_.resolve(e.directory),r=_.resolve(e.quarantine);if(_.dirname(r)!==_.dirname(t)||!me(_.resolve(e.root),r)||r===t)throw new Error(`${e.label} quarantine must be a distinct sibling inside its root`);let i=await vr(e.root,_.dirname(t),e.label),n=await Qe(t,e.label);if(!me(i[0].realPath,n.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeQuarantine?.(),await L(i,e.label);let a=await C.lstat(t);if(!a.isDirectory()||a.isSymbolicLink()||!qi(n,a)||await C.realpath(t)!==n.realPath)throw new Error(`${e.label} changed before quarantine`);try{throw await C.lstat(r),new Error(`${e.label} quarantine path is occupied`)}catch(s){if(s.code!=="ENOENT")throw s}await C.rename(t,r),await L(i,e.label);let o=await C.lstat(r);if(!o.isDirectory()||o.isSymbolicLink()||!qi(n,o))throw new Error(`${e.label} changed while quarantining`);await e.afterQuarantine?.(r);try{throw await C.lstat(t),new Error(`${e.label} path was recreated while quarantining`)}catch(s){if(s.code!=="ENOENT")throw s}return{quarantine:r,parentChain:i,identity:n}}async function ru(e){await Lv(e)}async function lo(e){let t=_.resolve(e.file),r=await vr(e.root,_.dirname(t),e.label),i=await C.lstat(t);if(!i.isFile()||i.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);let n=tu(i),a=await C.realpath(t);if(!me(r[0].realPath,a))throw new Error(`${e.label} resolves outside its managed root`);let o=await J({root:e.root,file:t,maxBytes:e.maxBytes,label:e.label});if(o.hash!==e.expectedHash||o.size!==e.expectedSize)throw new Error(`${e.label} changed before removal`);let[s,c]=await Promise.all([C.lstat(t),C.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!Nt(n,s)||c!==a)throw new Error(`${e.label} changed while verifying removal`);await e.beforeRemove?.(),await L(r,e.label);let[l,u]=await Promise.all([C.lstat(t),C.realpath(t)]);if(!l.isFile()||l.isSymbolicLink()||!Nt(n,l)||u!==a)throw new Error(`${e.label} changed before removal`);await C.rm(t),await L(r,e.label)}async function uo(e){let t=_.resolve(e.directory),r=await vr(e.root,_.dirname(t),e.label),i=await Qe(t,e.label);if(!me(r[0].realPath,i.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeRemove?.(),await L(r,e.label);let n=await C.lstat(t);if(!n.isDirectory()||n.isSymbolicLink()||!qi(i,n)||await C.realpath(t)!==i.realPath)throw new Error(`${e.label} changed before removal`);await C.rmdir(t),await L(r,e.label)}async function gr(e){let t=_.resolve(e.root),r=_.resolve(e.directory);if(!me(t,r))throw new Error(`${e.label} is outside its managed root`);let i=[await Qe(t,e.label)],n=t;for(let a of _.relative(t,r).split(_.sep).filter(Boolean)){await L(i,e.label),n=_.join(n,a);try{await C.mkdir(n)}catch(s){if(s.code!=="EEXIST")throw s}let o=await Qe(n,e.label);if(!me(i[0].realPath,o.realPath))throw new Error(`${e.label} resolves outside its managed root: ${n}`);i.push(o)}await L(i,e.label)}async function wr(e){let t=await J({root:e.sourceRoot,file:e.source,maxBytes:e.maxBytes,label:e.label,hooks:e.hooks,forbiddenRoots:e.forbiddenRoots});if(e.expectedHash!==void 0&&t.hash!==e.expectedHash)throw new Error(`${e.label} content changed before copy`);await Ml(e.target,t.bytes,{containedRoot:e.targetRoot,exclusive:e.exclusive,beforeCommit:async()=>{if(await e.hooks?.beforeTargetCommit?.(),e.expectedTargetHash===void 0)return;if(e.expectedTargetHash===null){try{await C.lstat(e.target)}catch(n){if(n.code==="ENOENT")return;throw n}throw new Error(`${e.label} target changed before commit`)}if((await J({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} existing target`})).hash!==e.expectedTargetHash)throw new Error(`${e.label} target changed before commit`)}});let r=await J({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} target`});if(r.hash!==t.hash||r.size!==t.size)throw new Error(`${e.label} target could not be verified`);return r}import{promises as zi}from"fs";import ke from"path";import{TextDecoder as Mv}from"util";var Fv=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),Vv=new Set(["id","type","source","target","staged","backup"]),qv=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),Wv=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]),zv=new Set(["sequence","timestamp","type","operationId"]),au=new Set(["prepared","applying","committed","rolling-back","rolled-back"]),ou=new Set(["prepared","operation-started","operation-completed","archive-finalization-started","archive-finalized","commit","rollback-started","rollback-completed"]),Jv=256*1024,Gv=1024*1024,su=16*1024,Ji=1024,Qb=64*1024*1024;var cu=new Mv("utf-8",{fatal:!0});function yr(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function Nr(e,t,r){let i=Object.keys(e).filter(n=>!t.has(n));if(i.length>0)throw new Error(`${r} has unknown field(s): ${i.join(", ")}`)}function kt(e){if(typeof e!="string")return!1;let t=new Date(e);return!Number.isNaN(t.valueOf())&&t.toISOString()===e}function fo(e,t){if(typeof e!="string"||e.length===0||ke.isAbsolute(e)||/^(?:[A-Za-z]:|~|[\\/])/u.test(e)||e.split(/[\\/]/u).includes(".."))throw new Error(`${t} must stay inside the Native root`)}function Wi(e,t){if(typeof e!="string"||!/^[a-f0-9]{64}$/u.test(e))throw new Error(`${t} must be a SHA-256 hash`)}function iu(e,t){if(fo(e,t),e.includes("\\")||e!==ke.posix.normalize(e)||e.split("/").includes(".")||e.endsWith("/")||Buffer.byteLength(e,"utf8")>1024)throw new Error(`${t} must be a normalized Native-relative ref`)}function Uv(e,t){let r=yr(e,`transaction operations[${t}]`);if(Nr(r,Vv,`transaction operations[${t}]`),typeof r.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(r.id))throw new Error(`transaction operations[${t}].id is invalid`);if(r.type!=="write"&&r.type!=="remove"&&r.type!=="move")throw new Error(`transaction operation ${r.id} has an invalid type`);fo(r.target,`transaction operation ${r.id} target`);for(let i of["source","staged","backup"])r[i]!==void 0&&fo(r[i],`transaction operation ${r.id} ${i}`);if(r.type==="write"){if(r.staged===void 0||r.source!==void 0)throw new Error(`write operation ${r.id} requires staged and forbids source`)}else if(r.type==="remove"){if(r.source!==void 0||r.staged!==void 0)throw new Error(`remove operation ${r.id} forbids source and staged`)}else if(r.source===void 0||r.staged!==void 0||r.backup!==void 0)throw new Error(`move operation ${r.id} requires source and forbids staged and backup`);return r}function lu(e){let t=yr(e,"Native Archive transaction journal");if(Nr(t,qv,"Native Archive transaction journal"),t.schema!=="comet.native.transaction.v2")throw new Error("Unsupported Native Archive transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native Archive transaction id is invalid");if(t.kind!=="archive")throw new Error("Native v2 transaction kind must be archive");if(typeof t.status!="string"||!au.has(t.status))throw new Error("Native Archive transaction status is invalid");if(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change))throw new Error("Native Archive transaction change name is invalid");if(!kt(t.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(Wi(t.preflightHash,"Native Archive transaction preflightHash"),!Array.isArray(t.operations)||t.operations.length>65)throw new Error("Native Archive transaction operations must be an array");let r=t.operations.map((s,c)=>{let l=yr(s,`Archive transaction operations[${c}]`);if(Nr(l,Wv,`Archive transaction operations[${c}]`),typeof l.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(l.id))throw new Error(`Archive transaction operations[${c}].id is invalid`);if(l.type!=="write"&&l.type!=="remove"&&l.type!=="move")throw new Error(`Archive transaction operation ${l.id} has an invalid type`);iu(l.target,`Archive transaction operation ${l.id} target`);for(let u of["source","staged","backup"])l[u]!==void 0&&iu(l[u],`Archive transaction operation ${l.id} ${u}`);if(l.expectedTargetHash!==null&&Wi(l.expectedTargetHash,`Archive transaction operation ${l.id} expectedTargetHash`),l.type==="write"){if(l.staged===void 0||l.source!==void 0||l.expectedSourceHash!==void 0)throw new Error(`Archive write operation ${l.id} requires staged and forbids source`);if(Wi(l.stagedHash,`Archive write operation ${l.id} stagedHash`),l.expectedTargetHash===null!=(l.backup===void 0))throw new Error(`Archive write operation ${l.id} backup must match target existence`)}else if(l.type==="remove"){if(l.source!==void 0||l.staged!==void 0||l.stagedHash!==void 0||l.expectedSourceHash!==void 0||l.backup===void 0||l.expectedTargetHash===null)throw new Error(`Archive remove operation ${l.id} requires a bound target and backup`)}else{if(l.source===void 0||l.staged!==void 0||l.stagedHash!==void 0||l.backup!==void 0||l.expectedTargetHash!==null)throw new Error(`Archive move operation ${l.id} requires source and an absent target`);Wi(l.expectedSourceHash,`Archive move operation ${l.id} expectedSourceHash`)}return l}),i=r.map(s=>s.id);if(new Set(i).size!==i.length)throw new Error("Native Archive transaction operation ids must be unique");let n=`runtime/transactions/${t.id}`,a=r.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${t.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${t.change}$`,"u").test(a[0].target)||r.at(-1)!==a[0])throw new Error("Native Archive transaction must end with its exact change move");let o=new Set;for(let s of r.slice(0,-1)){if(s.type==="move"||!/^specs\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/spec\.md$/u.test(s.target)||o.has(s.target))throw new Error(`Native Archive transaction spec target is invalid: ${s.target}`);if(o.add(s.target),s.staged!==void 0&&!s.staged.startsWith(`${n}/staged/specs/`))throw new Error(`Native Archive transaction staged ref is invalid: ${s.staged}`);if(s.backup!==void 0&&!s.backup.startsWith(`${n}/backups/specs/`))throw new Error(`Native Archive transaction backup ref is invalid: ${s.backup}`)}return{schema:"comet.native.transaction.v2",id:t.id,kind:"archive",status:t.status,change:t.change,createdAt:t.createdAt,preflightHash:t.preflightHash,operations:r}}function ho(e){let t=yr(e,"Native transaction journal");if(t.schema==="comet.native.transaction.v2")return lu(t);if(Nr(t,Fv,"Native transaction journal"),t.schema!=="comet.native.transaction.v1")throw new Error("Unsupported Native transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native transaction id is invalid");if(t.kind!=="archive"&&t.kind!=="root-move")throw new Error("Native transaction kind is invalid");if(typeof t.status!="string"||!au.has(t.status))throw new Error("Native transaction status is invalid");if(typeof t.projectRoot!="string"||!ke.isAbsolute(t.projectRoot)||typeof t.nativeRoot!="string"||!ke.isAbsolute(t.nativeRoot))throw new Error("Native transaction roots must be absolute paths");if(t.change!==void 0&&(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change)))throw new Error("Native transaction change name is invalid");if(!kt(t.createdAt))throw new Error("Native transaction createdAt is invalid");if(!Array.isArray(t.operations))throw new Error("Native transaction operations must be an array");let r=t.operations.map(Uv),i=r.map(n=>n.id);if(new Set(i).size!==i.length)throw new Error("Native transaction operation ids must be unique");return{schema:"comet.native.transaction.v1",id:t.id,kind:t.kind,status:t.status,projectRoot:t.projectRoot,nativeRoot:t.nativeRoot,...typeof t.change=="string"?{change:t.change}:{},createdAt:t.createdAt,operations:r}}function uu(e,t){let r=yr(e,`Native transaction event at line ${t}`);if(Nr(r,zv,`Native transaction event at line ${t}`),r.sequence!==t)throw new Error(`Native transaction event sequence at line ${t} must be ${t}`);if(!kt(r.timestamp))throw new Error(`Native transaction event timestamp at line ${t} is invalid`);if(typeof r.type!="string"||!ou.has(r.type))throw new Error(`Native transaction event type at line ${t} is invalid`);let i=r.type==="operation-started"||r.type==="operation-completed";if(i&&(typeof r.operationId!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(r.operationId)||Buffer.byteLength(r.operationId,"utf8")>256)||!i&&r.operationId!==void 0)throw new Error(`Native transaction event operationId at line ${t} is invalid`);return{sequence:r.sequence,timestamp:r.timestamp,type:r.type,...typeof r.operationId=="string"?{operationId:r.operationId}:{}}}function Kv(e){if(e.length>24)return!1;let t="0000-00-00T00:00:00.000Z";for(let i=0;i<e.length;i+=1){let n=t[i],a=e[i];if(n==="0"){if(!/[0-9]/u.test(a))return!1}else if(a!==n)return!1}let r=[[5,2,1,12],[8,2,1,31],[11,2,0,23],[14,2,0,59],[17,2,0,59],[20,3,0,999]];for(let[i,n,a,o]of r){if(e.length<=i)continue;let s=e.slice(i,Math.min(i+n,e.length));if(!Array.from({length:o-a+1},(l,u)=>String(a+u).padStart(n,"0")).some(l=>l.startsWith(s)))return!1}return e.length>=10&&!kt(`${e.slice(0,10)}T00:00:00.000Z`)?!1:e.length<24||kt(e)}function bt(e,t){return e.length<t.length&&t.startsWith(e)}function Yv(e){let t='","operationId":"';if(bt(e,t))return!0;if(!e.startsWith(t))return!1;let r=e.slice(t.length),i=r.indexOf('"');if(i===-1)return r.length===0||/^[a-z0-9][a-z0-9-]*$/u.test(r);let n=r.slice(0,i);return/^[a-z0-9][a-z0-9-]*$/u.test(n)?bt(r.slice(i),'"}'):!1}function Xv(e,t){if(e.length===0||Buffer.byteLength(e,"utf8")>su)return!1;let r=`{"sequence":${t},"timestamp":"`;if(bt(e,r))return!0;if(!e.startsWith(r))return!1;let i=e.slice(r.length),n=i.slice(0,Math.min(24,i.length));if(!Kv(n))return!1;if(i.length<24)return!0;if(!kt(n))return!1;let a='","type":"',o=i.slice(24);if(bt(o,a))return!0;if(!o.startsWith(a))return!1;let s=o.slice(a.length);for(let c of ou){if(bt(s,c))return!0;if(!s.startsWith(c))continue;let l=s.slice(c.length);if(c==="operation-started"||c==="operation-completed"){if(Yv(l))return!0}else if(bt(l,'"}'))return!0}return!1}function Qv(e,t){if(e.length===0)throw new Error("Blank transaction event line");if(Buffer.byteLength(e,"utf8")>su)throw new Error(`Native transaction event at line ${t} is too large`);return uu(JSON.parse(e),t)}function Zv(e){let t=e.split(`
172
- `),r=t.at(-1)==="";if(r&&t.pop(),t.length>Ji)throw new Error(`Native transaction event log exceeds ${Ji} events`);let i=[];for(let n=0;n<t.length;n+=1){let a=n+1,o=t[n],s=o.endsWith("\r")?o.slice(0,-1):o,c=!r&&n===t.length-1;try{i.push(Qv(s,a))}catch(l){if(c){let u=!1;try{JSON.parse(s),u=!0}catch{}if(!u&&Xv(s,a))break}throw new Error(`Invalid Native transaction event at line ${a}`,{cause:l})}}return i}function du(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
169
+ `)}function cv(e,t){if(typeof e!="string")throw new Error(`${t} must be a string`);let r=e.trim();if(r.length===0||Le.posix.isAbsolute(r)||Le.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${t} must be a project-relative path`);if(r===".")return[];let i=r.replaceAll("\\","/").split("/");if(i.some(n=>n===".."))throw new Error(`${t} must stay inside the project root`);if(i.some(n=>n===""||n==="."))throw new Error(`${t} must not contain empty or dot path segments`);return i}function Xe(e){let t=cv(e,"native.artifact_root");return t.length===0?".":t.join("/")}function Ol(e,t="docs"){let r=e??t;if(r!=="legacy"&&r!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return r}function Oi(e,t,r=!1){if(typeof e!="string")throw new Error(`${t} must be a string`);let i=e.trim().replaceAll("\\","/");if(i.length===0||Le.posix.isAbsolute(i)||Le.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${t} must be relative to its declared path base`);let n=i.split("/");if(n.some(a=>a===".."))throw new Error(`${t} must stay inside its declared path base`);if(n.some(a=>a===""||a==="."))throw new Error(`${t} must not contain empty or dot path segments`);if(!r&&/[*?]/u.test(i))throw new Error(`${t} cannot contain wildcards`);return n.join("/")}function ke(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function Hl(e,t,r){let i=e??t;if(i!=="en"&&i!=="zh-CN")throw new Error(`${r} must be en or zh-CN`);return i}function Za(e,t){if(typeof e!="string"||e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.split("/").includes(".."))throw new Error(`${t} contains an unsafe pattern`);if(e.length>ji)throw new Error(`${t} exceeds ${ji} characters`);let r=0;for(let i=0;i<e.length;i+=1)e[i]==="?"?r+=1:e[i]==="*"&&(r+=1,e[i+1]==="*"&&(i+=1));if(r>$i)throw new Error(`${t} contains more than ${$i} wildcard tokens`);return e}function jl(e,t,r){if(e===void 0)return[...r];if(!Array.isArray(e))throw new Error(`${t} contains an unsafe pattern`);return[...new Set(e.map(i=>Za(i,t)))].sort((i,n)=>i.localeCompare(n,"en"))}function Ya(e,t,r){let i=e??t;if(!Number.isSafeInteger(i)||i<1)throw new Error(`${r} must be a positive integer`);return i}function lv(e){if(e===void 0)return{...K,include:[...K.include],exclude:[...K.exclude]};let t=ke(e,"native.snapshot");return{include:jl(t.include,"native.snapshot.include",K.include),exclude:jl(t.exclude,"native.snapshot.exclude",K.exclude),max_files:Ya(t.max_files,K.max_files,"native.snapshot.max_files"),max_total_bytes:Ya(t.max_total_bytes,K.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Ya(t.max_duration_ms,K.max_duration_ms,"native.snapshot.max_duration_ms")}}function uv(e){if(e===void 0)return;let t=ke(e,"native.pending_root_move"),r=t.id,i=t.from_artifact_root,n=t.to_artifact_root,a=t.stage;if(typeof r!="string"||!/^[a-f0-9-]{8,}$/u.test(r))throw new Error("native.pending_root_move.id is invalid");if(typeof i!="string"||typeof n!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(t.cleanup!==void 0){let s=ke(t.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,u=s.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:u}}return{id:r,fromArtifactRoot:Xe(i),toArtifactRoot:Xe(n),stage:a,...o?{cleanup:o}:{}}}function dv(e){if(e===void 0)return;let t=ke(e,"native.finish");if(t.pull_request===void 0)return{};let r=ke(t.pull_request,"native.finish.pull_request");if(r.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(r.command)||r.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(r.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let i=r.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(Le.posix.isAbsolute(i[0])||Le.win32.isAbsolute(i[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let n=r.timeout_ms??iv;if(!Number.isSafeInteger(n)||n<1||n>Il)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${Il}`);return{pull_request:{provider:"repository-command",command:i,timeout_ms:n}}}function fv(e,t={}){let r=ke(e,"native"),i=r.artifact_root??(t.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let n=r.clarification_mode??"batch";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=r.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=r.max_verify_failures??Xa;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=uv(r.pending_root_move),c=dv(r.finish);return{artifact_root:Xe(i),language:Hl(r.language,"en","native.language"),clarification_mode:n,archive_confirmation:a,max_verify_failures:o,snapshot:lv(r.snapshot),...c?{finish:c}:{},...s?{pending_root_move:s}:{}}}function hv(e){let t=ke(e,"classic"),r=t.context_compression??"off";if(r!=="off"&&r!=="beta")throw new Error("classic.context_compression must be off or beta");let i=t.review_mode??"standard";if(i!=="off"&&i!=="standard"&&i!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=t.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Ol(t.artifact_layout),language:Hl(t.language,"zh-CN","classic.language"),context_compression:r,review_mode:i,auto_transition:n}}function pv(e){let r=ke(e,"hook").allow_paths??[];if(!Array.isArray(r))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(r.map((i,n)=>Oi(i,`hook.allow_paths[${n}]`)))]}}function mv(e){if(e===void 0)return{...ar};let t=ke(e,"memory"),r=t.learning??ar.learning,i=t.retrieval??ar.retrieval;if(typeof r!="boolean")throw new Error("memory.learning must be true or false");if(typeof i!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:r,retrieval:i}}function eo(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function vv(e,t){if(typeof e!="string")throw new Error(`${t} must be a string`);let r=e.trim();if(r.length===0||r.includes("\\")||r.includes("\0")||Le.posix.isAbsolute(r)||Le.win32.isAbsolute(r)||r.startsWith("~")||r.split("/").some(n=>n===""||n==="."||n===".."))throw new Error(`${t} must be a safe project-relative glob`);if(!r.toLowerCase().endsWith(".md"))throw new Error(`${t} must target a Markdown file ending in .md`);if(r.length>_l)throw new Error(`${t} exceeds ${_l} characters`);let i=0;for(let n=0;n<r.length;n+=1)r[n]==="?"?i+=1:r[n]==="*"&&(i+=1,r[n+1]==="*"&&(n+=1));if(i>Tl)throw new Error(`${t} contains more than ${Tl} wildcard tokens`);return r}function gv(e){let r=eo(e,"knowledge.local").include??[];if(!Array.isArray(r))throw new Error("knowledge.local.include must be an array");return{include:[...new Set(r.map((i,n)=>vv(i,`knowledge.local.include[${n}]`)))]}}function wv(e){if(typeof e!="string"||e.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let t;try{t=new URL(e)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let r=t.hostname.toLowerCase().replace(/^\[|\]$/gu,""),i=r==="localhost"||r==="127.0.0.1"||r==="::1";if(t.protocol!=="https:"&&!(t.protocol==="http:"&&i))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return t.toString()}function yv(e){let t=eo(e,"knowledge.remote"),r=wv(t.endpoint),i=t.token_env;if(i!==void 0&&(typeof i!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(i)))throw new Error("knowledge.remote.token_env must be an environment variable name");let n=t.scope;if(n!==void 0&&(typeof n!="string"||n.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let a=t.timeout_ms??5e3;if(typeof a!="number"||!Number.isSafeInteger(a)||a<100||a>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:r,...i===void 0?{}:{token_env:i},...n===void 0?{}:{scope:n},timeout_ms:a}}function Nv(e){if(e===void 0)return{...Qa};let t=eo(e,"knowledge"),r=t.provider??"local";if(r!=="local"&&r!=="remote")throw new Error("knowledge.provider must be local or remote");let i=t.local===void 0?void 0:gv(t.local);if(r==="local")return{provider:r,...i?{local:i}:{}};let n=t.remote===void 0?void 0:yv(t.remote);if(n===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:r,...i?{local:i}:{},remote:n}}function bv(e){let t=e??!0;if(typeof t!="boolean")throw new Error("ambient_resume must be true or false");return t}function kv(e,t,r,i,n,a,o,s){let c=e.schema!==void 0;if(!(c||e.default_workflow!==void 0||e.workflows!==void 0||!s.allowPartialProject&&e.native!==void 0)||s.allowPartialProject&&!c)return null;if(e.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(e.default_workflow!=="native"&&e.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let u=e.workflows??[e.default_workflow];if(!Array.isArray(u)||u.length===0||u.some(f=>f!=="native"&&f!=="classic"))throw new Error("workflows must contain native and/or classic");let d=[...new Set(u)];if(!d.includes(e.default_workflow))throw new Error("workflows must include default_workflow");if(d.includes("native")&&!n)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:e.default_workflow,workflows:d,ambient_resume:o,...t?{hook:t}:{},memory:r,knowledge:i,...n?{native:n}:{},...a?{classic:a}:{}}}function gt(e,t={}){let r=(0,or.parseDocument)(e,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${r.errors[0].message}`);let i=r.toJS();if(i==null)return{value:{},config:null,ambient_resume:!0};if(typeof i!="object"||Array.isArray(i))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let n=i,a=bv(n.ambient_resume),o=n.hook===void 0?void 0:pv(n.hook),s=mv(n.memory),c=Nv(n.knowledge),l=n.native===void 0?void 0:fv(n.native,{allowMissingArtifactRoot:t.allowMissingNativeFields}),u=n.classic===void 0?void 0:hv(n.classic),d=kv(n,o,s,c,l,u,a,{allowPartialProject:t.allowPartialProject??!1});return{value:n,config:d,ambient_resume:a,memory:s,knowledge:c,...o?{hook:o}:{},...l?{native:l}:{},...u?{classic:u}:{}}}function Dl(e){return{id:e.id,from_artifact_root:e.fromArtifactRoot,to_artifact_root:e.toArtifactRoot,stage:e.stage,...e.cleanup?{cleanup:{kind:e.cleanup.kind,state:e.cleanup.state,manifest_hash:e.cleanup.manifestHash}}:{}}}function Ll(e){let t=e.knowledge??{...Qa};return{schema:e.schema,default_workflow:e.default_workflow,workflows:e.workflows??[e.default_workflow],ambient_resume:e.ambient_resume,memory:e.memory??{...ar},knowledge:{provider:t.provider,...t.local&&t.local.include.length>0?{local:{include:[...t.local.include]}}:{},...t.remote?{remote:{endpoint:t.remote.endpoint,timeout_ms:t.remote.timeout_ms,...t.remote.token_env===void 0?{}:{token_env:t.remote.token_env},...t.remote.scope===void 0?{}:{scope:t.remote.scope}}}:{}},...e.hook?{hook:{allow_paths:[...e.hook.allow_paths]}}:{},...e.native?{native:{artifact_root:e.native.artifact_root,language:e.native.language,clarification_mode:e.native.clarification_mode,archive_confirmation:e.native.archive_confirmation,max_verify_failures:e.native.max_verify_failures,...e.native.finish?.pull_request?{finish:{pull_request:{provider:e.native.finish.pull_request.provider,command:[...e.native.finish.pull_request.command],timeout_ms:e.native.finish.pull_request.timeout_ms}}}:{},...e.native.pending_root_move?{pending_root_move:Dl(e.native.pending_root_move)}:{}}}:{},...e.classic?{classic:{artifact_layout:e.classic.artifact_layout,language:e.classic.language,context_compression:e.classic.context_compression,review_mode:e.classic.review_mode,auto_transition:e.classic.auto_transition}}:{}}}function U(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function lr(e,t){let r=Ll(t),i=gt((0,or.stringify)(r)).config;if(!i)throw new Error("Unsupported Comet project schema");let n={...e,schema:i.schema,default_workflow:i.default_workflow,workflows:i.workflows,ambient_resume:i.ambient_resume};if(i.hook&&(n.hook={...U(e.hook),allow_paths:[...i.hook.allow_paths]}),i.memory){let a=U(e.memory);n.memory={...a,learning:i.memory.learning,retrieval:i.memory.retrieval}}if(i.knowledge){let a=U(e.knowledge),o={...a,provider:i.knowledge.provider};if(i.knowledge.local&&i.knowledge.local.include.length>0?o.local={...U(a.local),include:[...i.knowledge.local.include]}:delete o.local,i.knowledge.remote){let c={...U(a.remote),endpoint:i.knowledge.remote.endpoint,timeout_ms:i.knowledge.remote.timeout_ms,...i.knowledge.remote.token_env===void 0?{}:{token_env:i.knowledge.remote.token_env},...i.knowledge.remote.scope===void 0?{}:{scope:i.knowledge.remote.scope}};i.knowledge.remote.token_env===void 0&&delete c.token_env,i.knowledge.remote.scope===void 0&&delete c.scope,o.remote=c}else delete o.remote;n.knowledge=o}if(i.native){let a=U(e.native),o={...a,artifact_root:i.native.artifact_root,language:i.native.language,clarification_mode:i.native.clarification_mode,archive_confirmation:i.native.archive_confirmation,max_verify_failures:i.native.max_verify_failures};if(i.native.finish?.pull_request){let s=U(a.finish);o.finish={...s,pull_request:{...U(s.pull_request),provider:i.native.finish.pull_request.provider,command:[...i.native.finish.pull_request.command],timeout_ms:i.native.finish.pull_request.timeout_ms}}}else{let s={...U(a.finish)};delete s.pull_request,Object.keys(s).length>0?o.finish=s:delete o.finish}if(delete o.snapshot,i.native.pending_root_move){let s=U(a.pending_root_move),c=Dl(i.native.pending_root_move),l=U(s.cleanup),u=U(c.cleanup);o.pending_root_move={...s,...c,...c.cleanup?{cleanup:{...l,...u}}:{}}}else delete o.pending_root_move;n.native=o}return i.classic&&(n.classic={...U(e.classic),artifact_layout:i.classic.artifact_layout,language:i.classic.language,context_compression:i.classic.context_compression,review_mode:i.classic.review_mode,auto_transition:i.classic.auto_transition}),n}function Hi(e="docs",t="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,memory:{...ar},knowledge:{...Qa},native:{artifact_root:Xe(e),language:t,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Xa,snapshot:{...K,include:[...K.include],exclude:[...K.exclude]}}}}import{createHash as Ev}from"crypto";import{promises as Bi}from"fs";import Me from"path";import{constants as Di,promises as Qe}from"fs";function Be(e){return e!==0&&e!==0n&&e!=="0"}function he(e,t){return Be(e.dev)&&Be(t.dev)&&Be(e.ino)&&Be(t.ino)}function I(e,t){let r=Be(e.dev)&&Be(t.dev);if(r&&e.dev!==t.dev)return!1;let i=Be(e.ino)&&Be(t.ino);return i&&e.ino!==t.ino?!1:r&&i?!0:e.birthtime===t.birthtime}var oe=class extends Error{reason;constructor(t,r,i){super(r,i),this.name="RaceSafeReadError",this.reason=t}};function to(e){return"birthtimeNs"in e&&typeof e.birthtimeNs=="bigint"?e.birthtimeNs:e.birthtimeMs}function Bl(e){return"ctimeNs"in e&&typeof e.ctimeNs=="bigint"?e.ctimeNs:e.ctimeMs}function ur(e){return{dev:e.dev,ino:e.ino,birthtime:to(e)}}function Li(e,t){let r=ur(e),i=ur(t);return he(r,i)?I(r,i):I(r,i)&&to(e)===to(t)&&Bl(e)===Bl(t)&&e.size===t.size}async function wt(e,t,r={}){if(!Number.isSafeInteger(t)||t<1)throw new Error("race-safe read byte limit must be a positive integer");let i=r.label??"file",n=r.bigint===!0,a=await Qe.lstat(e,{bigint:n});if(!a.isFile()||a.isSymbolicLink())throw new oe("not-regular-file",`${i} must be a regular file`);if(BigInt(a.size)>BigInt(t))throw new oe("too-large",`${i} exceeds ${t} bytes`);let o=await Qe.realpath(e);await r.verify?.("pre-open",{realPath:o,identity:ur(a)});let s=process.platform==="win32"?Di.O_RDONLY:Di.O_RDONLY|Di.O_NOFOLLOW|Di.O_NONBLOCK,c;try{c=await Qe.open(e,s)}catch(l){throw l.code==="ELOOP"?new oe("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,u,d]=await Promise.all([c.stat({bigint:n}),Qe.lstat(e,{bigint:n}),Qe.realpath(e)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||d!==o||!Li(a,l)||!Li(a,u))throw new oe("changed",`${i} changed while opening`);await r.verify?.("post-open",{realPath:d,identity:ur(l)}),await r.hooks?.afterOpen?.();let f=[],p=0,v=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let y=t+1-p,{bytesRead:b}=await c.read(v,0,Math.min(v.length,y),null);if(b===0)break;if(p+=b,p>t)throw new oe("too-large",`${i} exceeds ${t} bytes`);f.push(Buffer.from(v.subarray(0,b)))}await r.hooks?.beforeFinalCheck?.();let[h,m,w]=await Promise.all([c.stat({bigint:n}),Qe.lstat(e,{bigint:n}),Qe.realpath(e)]);if(!m.isFile()||m.isSymbolicLink()||w!==o||!Li(a,h)||!Li(a,m))throw new oe("changed",`${i} changed while reading`);return await r.verify?.("post-read",{realPath:w,identity:ur(h)}),{bytes:Buffer.concat(f,p),stat:h,realPath:w}}finally{await c.close()}}function Sv(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function ro(e,t){let r=Me.relative(e,t);return r===""||!Me.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${Me.sep}`)}async function Ml(e,t){let r=Me.resolve(e),i=await Bi.lstat(r);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${t} project root must be a real directory`);return Bi.realpath(r)}async function Fl(e,t,r,i){let n=e;for(let a=0;a<r.length;a++){n=Me.join(n,r[a]);let o;try{o=await Bi.lstat(n)}catch(u){if(Sv(u))return{exists:!1,kind:"missing"};throw u}let s=Me.relative(e,n).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${s}`);let c=a===r.length-1;if(!c&&!o.isDirectory())throw new Error(`${i.label} ancestor ${s} must be a real directory`);if(c&&(i.expected==="file"&&!o.isFile()||i.expected==="directory"&&!o.isDirectory()||i.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${i.label} must be a real ${i.expected}`);let l=await Bi.realpath(n);if(!ro(t,l))throw new Error(`${i.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function yt(e,t,r){let i=Oi(t,r.label),n=Me.resolve(e),a=await Ml(n,r.label),o=i.split("/"),s=Me.resolve(n,...o);if(!ro(n,s))throw new Error(`${r.label} must stay inside the project root`);let c=await Fl(n,a,o,r);return{projectRoot:n,target:s,relative:i,exists:c.exists,kind:c.kind}}async function Fe(e,t,r,i){let n=await yt(e,t,{label:i.label,expected:"file"});if(!n.exists){let o=new Error(`${i.label} does not exist`);throw o.code="ENOENT",o}let a=await Ml(n.projectRoot,i.label);return wt(n.target,r,{...i,verify:async(o,s)=>{if(!ro(a,s.realPath))throw new Error(`${i.label} resolves outside the project root`);await Fl(n.projectRoot,a,n.relative.split("/"),{label:i.label,expected:"file"})}})}var dr=".comet/config.yaml";function io(e,t){return e.exists===t.exists&&e.sha256===t.sha256}function Cv(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}async function Mi(e,t={}){return(await fr(e,t)).document}async function Vl(e){try{return(await Fe(e,dr,sr,{label:dr})).bytes}catch(t){if(Cv(t))return null;throw t}}function ql(e){return e?{exists:!0,sha256:Ev("sha256").update(e).digest("hex")}:{exists:!1,sha256:null}}async function Fi(e){return ql(await Vl(e))}async function fr(e,t={}){let r=await Vl(e);return{document:r?gt(r.toString("utf8"),t):null,identity:ql(r)}}async function no(e){return(await Mi(e))?.config??null}var Rb=16*1024;async function ao(e,t){if(!t)return;let r=await Fi(e);if(!io(r,t))throw new Error("Project config changed before commit; rerun the operation")}import{randomUUID as Av}from"crypto";import{promises as B}from"fs";import se from"path";function Vi(e,t){let r=se.relative(e,t);return r===""||!se.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${se.sep}`)}function _v(e,t){return I({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function qi(e,t){return I({dev:e.dev,ino:e.ino,birthtime:e.birthtimeMs},{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs})}function Tv(e,t){return qi(e,t)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function Wl(e){let t=await B.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${e}`);return{path:e,realPath:await B.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function Nt(e){for(let t of e){let r=await B.lstat(t.path);if(!r.isDirectory()||r.isSymbolicLink()||!_v(t,r)||await B.realpath(t.path)!==t.realPath)throw new Error(`Native atomic write parent changed before commit: ${t.path}`)}}async function Iv(e,t,r){let[i,n]=await Promise.all([B.lstat(e),B.realpath(e),r?Nt(r):Promise.resolve()]);if(!i.isFile()||i.isSymbolicLink()||!qi(i,t)||r&&!Vi(r[0].realPath,n))throw new Error("Native atomic write temporary file changed after close");return i}async function jv(e,t){let r=se.resolve(e),i=se.resolve(t);if(!Vi(r,i))throw new Error(`Native atomic write parent is outside its managed root: ${t}`);let n=[await Wl(r)],a=se.relative(r,i).split(se.sep).filter(Boolean),o=r;for(let s of a){await Nt(n),o=se.join(o,s);try{await B.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Wl(o);if(!Vi(n[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);n.push(c)}return await Nt(n),n}async function $v(e){let t;try{t=await B.open(e,"r"),await t.sync()}catch(r){let i=r.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(i??""))throw r}finally{await t?.close()}}async function zl(e,t,r={}){let i=se.dirname(e),n=r.containedRoot?await jv(r.containedRoot,i):null;n||await B.mkdir(i,{recursive:!0});let a=se.join(i,`.${se.basename(e)}.${Av()}.tmp`),o,s,c;try{if(await r.beforeTemporaryOpen?.(),o=await B.open(a,"wx"),s=await o.stat(),n){let[l,u]=await Promise.all([B.lstat(a),B.realpath(a)]);if(await Nt(n),!l.isFile()||l.isSymbolicLink()||!qi(s,l)||!Vi(n[0].realPath,u))throw new Error("Native atomic write temporary file opened outside its managed parent")}if(typeof t=="string"?await o.writeFile(t,"utf8"):await o.writeFile(t),await o.sync(),c=await o.stat(),!qi(s,c))throw new Error("Native atomic write temporary file changed while writing");if(await o.close(),o=void 0,await r.afterTemporaryClose?.(),!c)throw new Error("Native atomic write temporary file was not written");if(c=await Iv(a,c,n),await r.beforeCommit?.(),n){await Nt(n);let l=await B.lstat(a);if(!l.isFile()||l.isSymbolicLink()||!c||!Tv(l,c))throw new Error("Native atomic write temporary file changed before commit")}r.exclusive?(await B.link(a,e),await B.unlink(a)):await B.rename(a,e),await $v(i)}catch(l){if(await o?.close(),!n)await B.rm(a,{force:!0});else try{await Nt(n),await B.rm(a,{force:!0})}catch{}throw l}}async function J(e,t,r={}){await zl(e,t,r)}async function Jl(e,t,r={}){await zl(e,t,r)}async function Y(e,t,r={}){await J(e,JSON.stringify(t,null,2)+`
170
+ `,r)}import{existsSync as Gl,promises as Ze}from"fs";import A from"path";import Ov from"os";var Wi=".comet/config.yaml",Hv=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;async function oo(e){try{return await Ze.lstat(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Dv(e){try{let t=await Ze.readFile(e,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(t)}catch(t){if(t.code==="ENOENT")return!1;throw t}}function kt(e,t){let r=A.relative(e,t);return r===""||!A.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${A.sep}`)}async function bt(e){let t=[],r=e;for(;!await oo(r);){let n=A.dirname(r);if(n===r)break;t.push(A.basename(r)),r=n}let i=await Ze.realpath(r);return A.resolve(i,...t.reverse())}async function so(e){try{return(await Ze.lstat(e)).isSymbolicLink()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function co(e){let t=A.resolve(e);try{(await Ze.stat(t)).isDirectory()||(t=A.dirname(t))}catch(n){if(n.code!=="ENOENT")throw n}let r=t,i=A.resolve(Ov.homedir());for(;;){if(!(t===i&&r!==i)){let o=A.join(t,...Wi.split("/")),s=t===r||await Dv(o);if(await oo(o)&&s)return t}if(await oo(A.join(t,".git")))return t;let a=A.dirname(t);if(a===t)return r;t=a}}function pr(e){return Xe(e)}async function Lv(e,t){let r=pr(t),i=A.resolve(e,...r.split("/")),n=await Ze.realpath(e),a=await bt(i);if(!kt(n,a))throw new Error("native.artifact_root resolves outside the project root");return i}async function pe(e,t){let r=pr(t),i=await Lv(e,r),n=A.join(i,"comet");if(await so(n))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([bt(i),bt(n)]);if(!kt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");let s=A.resolve(e),c=A.join(s,".comet","runtime","native");if(await so(c))throw new Error("The Native Runtime root must not be a symbolic link");let[l,u]=await Promise.all([Ze.realpath(s),bt(c)]);if(!kt(l,u))throw new Error("The Native Runtime root resolves outside the project root");return{projectRoot:s,configFile:A.join(e,...Wi.split("/")),artifactRoot:i,artifactRootRef:r,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 Ul(e){if(!Hv.test(e))throw new Error(`Invalid Native change name: ${e}`)}function mr(e,t){Ul(t);let r=A.join(e.changesRuntimeDir,t);if(!V(e.changesRuntimeDir,r))throw new Error("Native change Runtime path escaped");return r}function Bv(e,t){Ul(t);let r=A.join(e.changesDir,t,"runtime");if(!V(e.changesDir,r))throw new Error("Legacy Native change Runtime path escaped");return r}function me(e,t){let r=mr(e,t);if(Gl(r))return r;let i=Bv(e,t);return Gl(i)?i:r}function ce(e,t){let r=A.resolve(t);if(V(e.runtimeDir,r))return e.runtimeDir;if(V(e.nativeRoot,r))return e.nativeRoot;throw new Error(`Path is outside Native document and Runtime roots: ${t}`)}function V(e,t){return kt(A.resolve(e),A.resolve(t))}async function O(e,t){let r=A.resolve(e),i=A.resolve(t);if(!kt(r,i))throw new Error(`Path is outside the Native root: ${t}`);if(await so(r))throw new Error(`Native root must not be a symbolic link: ${e}`);let[n,a]=await Promise.all([bt(r),bt(i)]);if(!kt(n,a))throw new Error(`Path resolves outside the Native root: ${t}`);return i}function Kl(e="docs",t="en"){return Hi(e,t)}async function Z(e){let t=(await Mi(e))?.config??null;return t?.native?t:null}async function Ve(e,t,r={}){let i=await fr(e,{allowPartialProject:!0}),n=lr(i.document?.value??{},t),a=Mv.join(e,...Wi.split("/"));await J(a,cr(n,t.native.language==="zh-CN"?"zh-CN":"en"),{containedRoot:e,beforeCommit:async()=>{await r.beforeCommit?.(),await ao(e,i.identity)}})}import{createHash as hw,randomUUID as pw}from"crypto";import{promises as We}from"fs";import j from"path";import{AsyncLocalStorage as Fv}from"async_hooks";import{randomUUID as Ql}from"crypto";import{promises as ee}from"fs";import Zl from"os";import q from"path";var Yl=16*1024,eu=".coordinator",Vv=5e3,Xl=new Fv,zi=new Map;function qv(e){if(!/^[a-z][a-z0-9-]*$/u.test(e))throw new Error(`Invalid Native lock name: ${e}`);return`${e}.lock`}function Wv(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Invalid Native lock metadata: ${t}`);let r=e;if(typeof r.id!="string"||r.id.length===0||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<1||typeof r.hostname!="string"||r.hostname.length===0||typeof r.createdAt!="string"||r.createdAt.length===0||typeof r.operation!="string"||r.operation.length===0)throw new Error(`Invalid Native lock metadata: ${t}`);return r}function tu(e){return{device:e.dev.toString(),inode:e.ino.toString(),size:e.size.toString(),birthtimeNs:e.birthtimeNs.toString(),ctimeNs:e.ctimeNs.toString(),mtimeNs:e.mtimeNs.toString()}}function Ji(e,t){let r={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs},i={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs};return he(r,i)?I(r,i):I(r,i)&&e.size===t.size}function lo(e,t){return Ji(e,t)&&e.size===t.size&&e.birthtimeNs===t.birthtimeNs&&e.ctimeNs===t.ctimeNs&&e.mtimeNs===t.mtimeNs}async function Se(e){let t,r;try{let i=await wt(e,Yl,{bigint:!0,label:"Native lock"});t=i.bytes,r=i.stat}catch(i){if(i.code==="ENOENT")return null;throw i instanceof oe?i.reason==="too-large"?new Error(`Native lock metadata exceeds ${Yl} bytes: ${e}`,{cause:i}):i.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${e}`,{cause:i}):new Error(`Native lock changed while reading: ${e}`,{cause:i}):i}return{file:e,owner:Wv(JSON.parse(t.toString("utf8")),e),identity:tu(r)}}async function zv(e){return(await Se(e))?.owner??null}function Jv(e){if(!e)return{status:"missing",owner:null,identity:null};if(e.owner.hostname!==Zl.hostname())return{status:"unknown",owner:e.owner,identity:e.identity};let t=Qv(e.owner.pid);return{status:t===!0?"active":t===!1?"stale":"unknown",owner:e.owner,identity:e.identity}}async function Gv(e,t){try{await ee.lstat(t);return}catch(r){if(r.code!=="ENOENT")throw r}try{await ee.rename(e,t)}catch(r){if(r.code!=="ENOENT")throw r}}async function uo(e,t){let r=await Se(e.file);if(!r)return"missing";if(r.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!lo(r.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);await ee.mkdir(t,{recursive:!0});let i=q.join(t,`${q.basename(e.file)}.${e.owner.id}.${Ql()}.removed`);try{await ee.rename(e.file,i)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let n=await Se(i);if(!n||n.owner.id!==e.owner.id||!Ji(n.identity,e.identity))throw await Gv(i,e.file),new Error(`Native lock changed before quarantine: ${e.file}`);return await ee.rm(i,{force:!0}),"removed"}function ru(e){return{id:Ql(),pid:process.pid,hostname:Zl.hostname(),createdAt:new Date().toISOString(),operation:e}}async function iu(e,t){let r;try{r=await ee.open(e,"wx")}catch(a){if(a.code==="EEXIST"){let o=await zv(e);throw new Error(`Native lock is already held: ${e}${o?` by pid ${o.pid} for ${o.operation}`:""}`,{cause:a})}throw a}let i;try{await r.writeFile(JSON.stringify(t,null,2)+`
171
+ `,"utf8"),await r.sync(),i=tu(await r.stat({bigint:!0}))}finally{await r.close()}let n=await Se(e);if(!i||!n||n.owner.id!==t.id||!Ji(n.identity,i))throw new Error(`Native lock changed after write: ${e}`);return n.identity}async function Uv(e,t){let r=await O(e.runtimeDir,e.locksDir);await ee.mkdir(r,{recursive:!0});let i=await O(e.runtimeDir,q.join(r,eu));await ee.mkdir(i,{recursive:!0});let n=ru(t),a=q.join(i,`.${n.id}.tmp`),o=q.join(i,`${n.id}.claim`);try{let s=await iu(a,n);await ee.rename(a,o);let c=await Se(o);if(!c||!Ji(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:e.runtimeDir,locksDir:r,owner:n,identity:c.identity}}finally{await ee.rm(a,{force:!0})}}async function Kv(e){let t=q.dirname(e.file),r=!1,i=q.basename(e.file);for(let n of await ee.readdir(t,{withFileTypes:!0})){if(!n.isFile()||n.isSymbolicLink()||!n.name.endsWith(".claim"))continue;let a=q.join(t,n.name);if(q.resolve(a)!==q.resolve(e.file))try{let o=await Se(a),s=Jv(o);if(s.status==="missing")continue;if(s.status==="stale"&&o){await uo(o,t);continue}n.name<i&&(r=!0)}catch{n.name<i&&(r=!0)}}return r}async function nu(e){let t=await Se(e.file);if(t){if(t.owner.id!==e.owner.id||!lo(t.identity,e.identity))throw new Error(`Native lock coordinator ownership changed: ${e.file}`);await uo(t,q.dirname(e.file))}}async function Yv(e,t){let r=Date.now()+Vv;for(;;){let i=await Uv(e,t);if(!await Kv(i))return i;if(await nu(i),Date.now()>=r)throw new Error(`Native lock coordinator is busy: ${e.locksDir}`);await new Promise(n=>setTimeout(n,2+Math.floor(Math.random()*7)))}}async function Xv(e){let t=zi.get(e)??Promise.resolve(),r,i=new Promise(a=>{r=a}),n=t.then(()=>i);return zi.set(e,n),await t,()=>{r(),zi.get(e)===n&&zi.delete(e)}}async function au(e,t,r){let i=q.resolve(e.locksDir),n=Xl.getStore();if(n?.has(i))return r();let a=await Xv(i);try{let o=await Yv(e,t),s=new Map(n??[]);return s.set(i,o),await Xl.run(s,async()=>{try{return await r()}finally{await nu(o)}})}finally{a()}}async function vr(e,t,r){return au(e,`acquire ${t}`,async()=>{let i=await O(e.runtimeDir,e.locksDir);await ee.mkdir(i,{recursive:!0});let n=await O(e.runtimeDir,q.join(i,qv(t))),a=ru(r),o=await iu(n,a);return{file:n,nativeRoot:e.runtimeDir,locksDir:i,owner:a,identity:o}})}async function gr(e){await Se(e.file)&&await au({runtimeDir:e.nativeRoot,locksDir:e.locksDir},`release ${q.basename(e.file)}`,async()=>{let t=await Se(e.file);if(!t)return;if(t.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!lo(t.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);let r=q.join(e.locksDir,eu);await uo(t,r)})}function Qv(e){try{return process.kill(e,0),!0}catch(t){let r=t.code;return r==="ESRCH"?!1:r==="EPERM"?!0:null}}import{createHash as Zv}from"node:crypto";import{constants as Gi,promises as x}from"node:fs";import T from"node:path";function ve(e,t){let r=T.relative(e,t);return r===""||!T.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${T.sep}`)}function ou(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native protected file byte limit must be a positive integer");return e}function Ui(e,t){return I({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function su(e){return{dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs,ctimeMs:e.ctimeMs,mtimeMs:e.mtimeMs,size:e.size}}function St(e,t){return I({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function et(e,t){let r=await x.lstat(e);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${t} parent must be a real directory: ${e}`);return{path:e,realPath:await x.realpath(e),dev:r.dev,ino:r.ino,birthtimeMs:r.birthtimeMs}}async function wr(e,t,r){let i=T.resolve(e),n=T.resolve(t);if(!ve(i,n))throw new Error(`${r} is outside its managed root`);let a=[await et(i,r)],o=i;for(let s of T.relative(i,n).split(T.sep).filter(Boolean)){await F(a,r),o=T.join(o,s);let c=await et(o,r);if(!ve(a[0].realPath,c.realPath))throw new Error(`${r} parent resolves outside its managed root: ${o}`);a.push(c)}return await F(a,r),a}async function F(e,t){for(let r of e){let i=await x.lstat(r.path);if(!i.isDirectory()||i.isSymbolicLink()||!Ui(r,i)||await x.realpath(r.path)!==r.realPath)throw new Error(`${t} parent changed during I/O: ${r.path}`)}}async function eg(e,t,r){let i=[],n=0,a=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let o=t+1-n,{bytesRead:s}=await e.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(n+=s,n>t)throw new Error(`${r} exceeds ${t} bytes`);i.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(i,n)}async function G(e){let t=ou(e.maxBytes),r=T.resolve(e.file),i=await wr(e.root,T.dirname(r),e.label),n=await Promise.all((e.forbiddenRoots??[]).map(u=>et(T.resolve(u),e.label)));await e.hooks?.afterParentChainCaptured?.(),await F(i,e.label);let a=await x.lstat(r);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);if(a.size>t)throw new Error(`${e.label} exceeds ${t} bytes`);let o=su(a),s=await x.realpath(r);if(!ve(i[0].realPath,s))throw new Error(`${e.label} resolves outside its managed root`);if(n.some(u=>ve(u.realPath,s)))throw new Error(`${e.label} resolves inside an excluded root`);let c=process.platform==="win32"?Gi.O_RDONLY:Gi.O_RDONLY|Gi.O_NOFOLLOW|Gi.O_NONBLOCK,l=await x.open(r,c);try{let u=await l.stat();await e.hooks?.afterOpen?.();let[d,f]=await Promise.all([x.lstat(r),x.realpath(r)]);if(await F(i,e.label),await F(n,e.label),!u.isFile()||!d.isFile()||d.isSymbolicLink()||f!==s||!St(o,u)||!St(o,d))throw new Error(`${e.label} changed while opening`);await e.hooks?.beforeRead?.();let p=await eg(l,t,e.label);await e.hooks?.beforeFinalCheck?.();let[v,h,m]=await Promise.all([l.stat(),x.lstat(r),x.realpath(r)]);if(await F(i,e.label),await F(n,e.label),!h.isFile()||h.isSymbolicLink()||m!==s||!St(o,v)||!St(o,h))throw new Error(`${e.label} changed while reading`);return{bytes:p,hash:Zv("sha256").update(p).digest("hex"),size:p.length}}finally{await l.close()}}async function tt(e){let t=await wr(e.root,e.directory,e.label),r;if(e.maxEntries===void 0)r=await x.readdir(e.directory,{withFileTypes:!0});else{let i=ou(e.maxEntries);r=[];let n=await x.opendir(e.directory);try{for await(let a of n)if(r.push(a),r.length>i)throw new Error(`${e.label} exceeds ${i} entries`)}finally{await n.close().catch(a=>{if(a.code!=="ERR_DIR_CLOSED")throw a})}}return await F(t,e.label),{entries:r,verify:()=>F(t,e.label)}}async function tg(e){let t=T.resolve(e.directory),r=T.resolve(e.quarantine);if(T.dirname(r)!==T.dirname(t)||!ve(T.resolve(e.root),r)||r===t)throw new Error(`${e.label} quarantine must be a distinct sibling inside its root`);let i=await wr(e.root,T.dirname(t),e.label),n=await et(t,e.label);if(!ve(i[0].realPath,n.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeQuarantine?.(),await F(i,e.label);let a=await x.lstat(t);if(!a.isDirectory()||a.isSymbolicLink()||!Ui(n,a)||await x.realpath(t)!==n.realPath)throw new Error(`${e.label} changed before quarantine`);try{throw await x.lstat(r),new Error(`${e.label} quarantine path is occupied`)}catch(s){if(s.code!=="ENOENT")throw s}await x.rename(t,r),await F(i,e.label);let o=await x.lstat(r);if(!o.isDirectory()||o.isSymbolicLink()||!Ui(n,o))throw new Error(`${e.label} changed while quarantining`);await e.afterQuarantine?.(r);try{throw await x.lstat(t),new Error(`${e.label} path was recreated while quarantining`)}catch(s){if(s.code!=="ENOENT")throw s}return{quarantine:r,parentChain:i,identity:n}}async function cu(e){await tg(e)}async function fo(e){let t=T.resolve(e.file),r=await wr(e.root,T.dirname(t),e.label),i=await x.lstat(t);if(!i.isFile()||i.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);let n=su(i),a=await x.realpath(t);if(!ve(r[0].realPath,a))throw new Error(`${e.label} resolves outside its managed root`);let o=await G({root:e.root,file:t,maxBytes:e.maxBytes,label:e.label});if(o.hash!==e.expectedHash||o.size!==e.expectedSize)throw new Error(`${e.label} changed before removal`);let[s,c]=await Promise.all([x.lstat(t),x.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!St(n,s)||c!==a)throw new Error(`${e.label} changed while verifying removal`);await e.beforeRemove?.(),await F(r,e.label);let[l,u]=await Promise.all([x.lstat(t),x.realpath(t)]);if(!l.isFile()||l.isSymbolicLink()||!St(n,l)||u!==a)throw new Error(`${e.label} changed before removal`);await x.rm(t),await F(r,e.label)}async function ho(e){let t=T.resolve(e.directory),r=await wr(e.root,T.dirname(t),e.label),i=await et(t,e.label);if(!ve(r[0].realPath,i.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeRemove?.(),await F(r,e.label);let n=await x.lstat(t);if(!n.isDirectory()||n.isSymbolicLink()||!Ui(i,n)||await x.realpath(t)!==i.realPath)throw new Error(`${e.label} changed before removal`);await x.rmdir(t),await F(r,e.label)}async function yr(e){let t=T.resolve(e.root),r=T.resolve(e.directory);if(!ve(t,r))throw new Error(`${e.label} is outside its managed root`);let i=[await et(t,e.label)],n=t;for(let a of T.relative(t,r).split(T.sep).filter(Boolean)){await F(i,e.label),n=T.join(n,a);try{await x.mkdir(n)}catch(s){if(s.code!=="EEXIST")throw s}let o=await et(n,e.label);if(!ve(i[0].realPath,o.realPath))throw new Error(`${e.label} resolves outside its managed root: ${n}`);i.push(o)}await F(i,e.label)}async function Nr(e){let t=await G({root:e.sourceRoot,file:e.source,maxBytes:e.maxBytes,label:e.label,hooks:e.hooks,forbiddenRoots:e.forbiddenRoots});if(e.expectedHash!==void 0&&t.hash!==e.expectedHash)throw new Error(`${e.label} content changed before copy`);await Jl(e.target,t.bytes,{containedRoot:e.targetRoot,exclusive:e.exclusive,beforeCommit:async()=>{if(await e.hooks?.beforeTargetCommit?.(),e.expectedTargetHash===void 0)return;if(e.expectedTargetHash===null){try{await x.lstat(e.target)}catch(n){if(n.code==="ENOENT")return;throw n}throw new Error(`${e.label} target changed before commit`)}if((await G({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} existing target`})).hash!==e.expectedTargetHash)throw new Error(`${e.label} target changed before commit`)}});let r=await G({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} target`});if(r.hash!==t.hash||r.size!==t.size)throw new Error(`${e.label} target could not be verified`);return r}import{promises as Yi}from"fs";import Ee from"path";import{TextDecoder as rg}from"util";var ig=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),ng=new Set(["id","type","source","target","staged","backup"]),ag=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),og=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]),sg=new Set(["sequence","timestamp","type","operationId"]),du=new Set(["prepared","applying","committed","rolling-back","rolled-back"]),fu=new Set(["prepared","operation-started","operation-completed","archive-finalization-started","archive-finalized","commit","rollback-started","rollback-completed"]),cg=256*1024,lg=1024*1024,hu=16*1024,Xi=1024,Ck=64*1024*1024;var pu=new rg("utf-8",{fatal:!0});function br(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function kr(e,t,r){let i=Object.keys(e).filter(n=>!t.has(n));if(i.length>0)throw new Error(`${r} has unknown field(s): ${i.join(", ")}`)}function Ct(e){if(typeof e!="string")return!1;let t=new Date(e);return!Number.isNaN(t.valueOf())&&t.toISOString()===e}function po(e,t){if(typeof e!="string"||e.length===0||Ee.isAbsolute(e)||/^(?:[A-Za-z]:|~|[\\/])/u.test(e)||e.split(/[\\/]/u).includes(".."))throw new Error(`${t} must stay inside the Native root`)}function Ki(e,t){if(typeof e!="string"||!/^[a-f0-9]{64}$/u.test(e))throw new Error(`${t} must be a SHA-256 hash`)}function lu(e,t){if(po(e,t),e.includes("\\")||e!==Ee.posix.normalize(e)||e.split("/").includes(".")||e.endsWith("/")||Buffer.byteLength(e,"utf8")>1024)throw new Error(`${t} must be a normalized Native-relative ref`)}function ug(e,t){let r=br(e,`transaction operations[${t}]`);if(kr(r,ng,`transaction operations[${t}]`),typeof r.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(r.id))throw new Error(`transaction operations[${t}].id is invalid`);if(r.type!=="write"&&r.type!=="remove"&&r.type!=="move")throw new Error(`transaction operation ${r.id} has an invalid type`);po(r.target,`transaction operation ${r.id} target`);for(let i of["source","staged","backup"])r[i]!==void 0&&po(r[i],`transaction operation ${r.id} ${i}`);if(r.type==="write"){if(r.staged===void 0||r.source!==void 0)throw new Error(`write operation ${r.id} requires staged and forbids source`)}else if(r.type==="remove"){if(r.source!==void 0||r.staged!==void 0)throw new Error(`remove operation ${r.id} forbids source and staged`)}else if(r.source===void 0||r.staged!==void 0||r.backup!==void 0)throw new Error(`move operation ${r.id} requires source and forbids staged and backup`);return r}function mu(e){let t=br(e,"Native Archive transaction journal");if(kr(t,ag,"Native Archive transaction journal"),t.schema!=="comet.native.transaction.v2")throw new Error("Unsupported Native Archive transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native Archive transaction id is invalid");if(t.kind!=="archive")throw new Error("Native v2 transaction kind must be archive");if(typeof t.status!="string"||!du.has(t.status))throw new Error("Native Archive transaction status is invalid");if(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change))throw new Error("Native Archive transaction change name is invalid");if(!Ct(t.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(Ki(t.preflightHash,"Native Archive transaction preflightHash"),!Array.isArray(t.operations)||t.operations.length>65)throw new Error("Native Archive transaction operations must be an array");let r=t.operations.map((s,c)=>{let l=br(s,`Archive transaction operations[${c}]`);if(kr(l,og,`Archive transaction operations[${c}]`),typeof l.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(l.id))throw new Error(`Archive transaction operations[${c}].id is invalid`);if(l.type!=="write"&&l.type!=="remove"&&l.type!=="move")throw new Error(`Archive transaction operation ${l.id} has an invalid type`);lu(l.target,`Archive transaction operation ${l.id} target`);for(let u of["source","staged","backup"])l[u]!==void 0&&lu(l[u],`Archive transaction operation ${l.id} ${u}`);if(l.expectedTargetHash!==null&&Ki(l.expectedTargetHash,`Archive transaction operation ${l.id} expectedTargetHash`),l.type==="write"){if(l.staged===void 0||l.source!==void 0||l.expectedSourceHash!==void 0)throw new Error(`Archive write operation ${l.id} requires staged and forbids source`);if(Ki(l.stagedHash,`Archive write operation ${l.id} stagedHash`),l.expectedTargetHash===null!=(l.backup===void 0))throw new Error(`Archive write operation ${l.id} backup must match target existence`)}else if(l.type==="remove"){if(l.source!==void 0||l.staged!==void 0||l.stagedHash!==void 0||l.expectedSourceHash!==void 0||l.backup===void 0||l.expectedTargetHash===null)throw new Error(`Archive remove operation ${l.id} requires a bound target and backup`)}else{if(l.source===void 0||l.staged!==void 0||l.stagedHash!==void 0||l.backup!==void 0||l.expectedTargetHash!==null)throw new Error(`Archive move operation ${l.id} requires source and an absent target`);Ki(l.expectedSourceHash,`Archive move operation ${l.id} expectedSourceHash`)}return l}),i=r.map(s=>s.id);if(new Set(i).size!==i.length)throw new Error("Native Archive transaction operation ids must be unique");let n=`runtime/transactions/${t.id}`,a=r.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${t.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${t.change}$`,"u").test(a[0].target)||r.at(-1)!==a[0])throw new Error("Native Archive transaction must end with its exact change move");let o=new Set;for(let s of r.slice(0,-1)){if(s.type==="move"||!/^specs\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/spec\.md$/u.test(s.target)||o.has(s.target))throw new Error(`Native Archive transaction spec target is invalid: ${s.target}`);if(o.add(s.target),s.staged!==void 0&&!s.staged.startsWith(`${n}/staged/specs/`))throw new Error(`Native Archive transaction staged ref is invalid: ${s.staged}`);if(s.backup!==void 0&&!s.backup.startsWith(`${n}/backups/specs/`))throw new Error(`Native Archive transaction backup ref is invalid: ${s.backup}`)}return{schema:"comet.native.transaction.v2",id:t.id,kind:"archive",status:t.status,change:t.change,createdAt:t.createdAt,preflightHash:t.preflightHash,operations:r}}function mo(e){let t=br(e,"Native transaction journal");if(t.schema==="comet.native.transaction.v2")return mu(t);if(kr(t,ig,"Native transaction journal"),t.schema!=="comet.native.transaction.v1")throw new Error("Unsupported Native transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native transaction id is invalid");if(t.kind!=="archive"&&t.kind!=="root-move")throw new Error("Native transaction kind is invalid");if(typeof t.status!="string"||!du.has(t.status))throw new Error("Native transaction status is invalid");if(typeof t.projectRoot!="string"||!Ee.isAbsolute(t.projectRoot)||typeof t.nativeRoot!="string"||!Ee.isAbsolute(t.nativeRoot))throw new Error("Native transaction roots must be absolute paths");if(t.change!==void 0&&(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change)))throw new Error("Native transaction change name is invalid");if(!Ct(t.createdAt))throw new Error("Native transaction createdAt is invalid");if(!Array.isArray(t.operations))throw new Error("Native transaction operations must be an array");let r=t.operations.map(ug),i=r.map(n=>n.id);if(new Set(i).size!==i.length)throw new Error("Native transaction operation ids must be unique");return{schema:"comet.native.transaction.v1",id:t.id,kind:t.kind,status:t.status,projectRoot:t.projectRoot,nativeRoot:t.nativeRoot,...typeof t.change=="string"?{change:t.change}:{},createdAt:t.createdAt,operations:r}}function vu(e,t){let r=br(e,`Native transaction event at line ${t}`);if(kr(r,sg,`Native transaction event at line ${t}`),r.sequence!==t)throw new Error(`Native transaction event sequence at line ${t} must be ${t}`);if(!Ct(r.timestamp))throw new Error(`Native transaction event timestamp at line ${t} is invalid`);if(typeof r.type!="string"||!fu.has(r.type))throw new Error(`Native transaction event type at line ${t} is invalid`);let i=r.type==="operation-started"||r.type==="operation-completed";if(i&&(typeof r.operationId!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(r.operationId)||Buffer.byteLength(r.operationId,"utf8")>256)||!i&&r.operationId!==void 0)throw new Error(`Native transaction event operationId at line ${t} is invalid`);return{sequence:r.sequence,timestamp:r.timestamp,type:r.type,...typeof r.operationId=="string"?{operationId:r.operationId}:{}}}function dg(e){if(e.length>24)return!1;let t="0000-00-00T00:00:00.000Z";for(let i=0;i<e.length;i+=1){let n=t[i],a=e[i];if(n==="0"){if(!/[0-9]/u.test(a))return!1}else if(a!==n)return!1}let r=[[5,2,1,12],[8,2,1,31],[11,2,0,23],[14,2,0,59],[17,2,0,59],[20,3,0,999]];for(let[i,n,a,o]of r){if(e.length<=i)continue;let s=e.slice(i,Math.min(i+n,e.length));if(!Array.from({length:o-a+1},(l,u)=>String(a+u).padStart(n,"0")).some(l=>l.startsWith(s)))return!1}return e.length>=10&&!Ct(`${e.slice(0,10)}T00:00:00.000Z`)?!1:e.length<24||Ct(e)}function Et(e,t){return e.length<t.length&&t.startsWith(e)}function fg(e){let t='","operationId":"';if(Et(e,t))return!0;if(!e.startsWith(t))return!1;let r=e.slice(t.length),i=r.indexOf('"');if(i===-1)return r.length===0||/^[a-z0-9][a-z0-9-]*$/u.test(r);let n=r.slice(0,i);return/^[a-z0-9][a-z0-9-]*$/u.test(n)?Et(r.slice(i),'"}'):!1}function hg(e,t){if(e.length===0||Buffer.byteLength(e,"utf8")>hu)return!1;let r=`{"sequence":${t},"timestamp":"`;if(Et(e,r))return!0;if(!e.startsWith(r))return!1;let i=e.slice(r.length),n=i.slice(0,Math.min(24,i.length));if(!dg(n))return!1;if(i.length<24)return!0;if(!Ct(n))return!1;let a='","type":"',o=i.slice(24);if(Et(o,a))return!0;if(!o.startsWith(a))return!1;let s=o.slice(a.length);for(let c of fu){if(Et(s,c))return!0;if(!s.startsWith(c))continue;let l=s.slice(c.length);if(c==="operation-started"||c==="operation-completed"){if(fg(l))return!0}else if(Et(l,'"}'))return!0}return!1}function pg(e,t){if(e.length===0)throw new Error("Blank transaction event line");if(Buffer.byteLength(e,"utf8")>hu)throw new Error(`Native transaction event at line ${t} is too large`);return vu(JSON.parse(e),t)}function mg(e){let t=e.split(`
172
+ `),r=t.at(-1)==="";if(r&&t.pop(),t.length>Xi)throw new Error(`Native transaction event log exceeds ${Xi} events`);let i=[];for(let n=0;n<t.length;n+=1){let a=n+1,o=t[n],s=o.endsWith("\r")?o.slice(0,-1):o,c=!r&&n===t.length-1;try{i.push(pg(s,a))}catch(l){if(c){let u=!1;try{JSON.parse(s),u=!0}catch{}if(!u&&hg(s,a))break}throw new Error(`Invalid Native transaction event at line ${a}`,{cause:l})}}return i}function gu(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
173
173
  `)}
174
- `}function eg(e,t){if(!/^[a-f0-9-]{8,}$/u.test(t))throw new Error(`Invalid Native transaction id: ${t}`);return ke.join(e.transactionsDir,t)}function Gi(e,t){let r=eg(e,t);return{directory:r,journal:ke.join(r,"transaction.json"),events:ke.join(r,"events.jsonl"),staged:ke.join(r,"staged"),backups:ke.join(r,"backups")}}async function et(e,t){let r=Gi(e,t);return await Promise.all(Object.values(r).map(i=>$(e.runtimeDir,i))),r}async function fu(e,t,r={}){let i=await et(e,t);try{await zi.lstat(i.events)}catch(n){if(n.code==="ENOENT")return{exists:!1,hash:null,size:0,events:[],canonicalSource:"",needsRepair:!1};throw n}try{let n=await J({root:e.runtimeDir,file:i.events,maxBytes:Gv,label:`Native transaction event log ${t}`,hooks:r.hooks}),a;try{a=cu.decode(n.bytes)}catch(c){throw new Error(`Native transaction event log ${t} is not valid UTF-8`,{cause:c})}let o=Zv(a),s=du(o);return{exists:!0,hash:n.hash,size:n.size,events:o,canonicalSource:s,needsRepair:a!==s}}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction event log ${t} changed while reading`,{cause:n}):n}}async function nu(e,t,r){let i=await fu(e,t);if(i.exists!==r.exists||i.hash!==r.hash||i.size!==r.size)throw new Error(`Native transaction event log ${t} changed before append`)}async function po(e,t,r,i){let n=await et(e,t),a=await fu(e,t),o=a.events.find(c=>c.type===r&&c.operationId===i);if(o)return a.needsRepair&&await z(n.events,a.canonicalSource,{containedRoot:e.runtimeDir,beforeCommit:()=>nu(e,t,a)}),o;if(a.events.length>=Ji)throw new Error(`Native transaction event log ${t} exceeds ${Ji} events`);let s={sequence:a.events.length+1,timestamp:new Date().toISOString(),type:r,...i?{operationId:i}:{}};return uu(s,s.sequence),await zi.mkdir(n.directory,{recursive:!0}),await z(n.events,du([...a.events,s]),{containedRoot:e.runtimeDir,beforeCommit:()=>nu(e,t,a)}),s}async function hu(e,t){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");t=ho(t);let r=await et(e,t.id);await zi.mkdir(r.staged,{recursive:!0}),await zi.mkdir(r.backups,{recursive:!0}),await K(r.journal,t,{containedRoot:e.runtimeDir}),await po(e,t.id,"prepared")}async function br(e,t,r={}){let i=await et(e,t),n=await J({root:e.runtimeDir,file:i.journal,maxBytes:Jv,label:`Native transaction journal ${t}`,hooks:r.hooks}),a=JSON.parse(cu.decode(n.bytes)),o=ho(a);if(o.id!==t)throw new Error(`Invalid Native transaction journal: ${t}`);return o}async function tg(e,t,r){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");let i=ho({...t,status:r});return await K((await et(e,t.id)).journal,i,{containedRoot:e.runtimeDir}),i}async function mo(e,t,r){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");return await po(e,t.id,r),r==="commit"?tg(e,t,"committed"):t}import{createHash as Wg}from"node:crypto";import{promises as rn}from"node:fs";import Fe from"node:path";import{execFileSync as rg}from"child_process";import Ki from"path";function Ui(e,t){return rg("git",["-C",e,...t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function ig(e,t){let r=Ki.normalize(e),i=Ki.normalize(t);return process.platform==="win32"?r.toLowerCase()===i.toLowerCase():r===i}function ve(e){try{let t=Ki.resolve(Ui(e,["rev-parse","--show-toplevel"])),i=Ui(e,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),n=i?Ki.resolve(i.slice(9)):t,a=null;try{a=Ui(e,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!ig(t,n),currentWorktreeRoot:t,primaryWorktreeRoot:n,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function kr(e,t){try{let r=Ui(e,["rev-parse","--verify",`${t}^{commit}`]).toLowerCase();return/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(r)?r:null}catch{return null}}import{createHash as sg}from"node:crypto";import{promises as ce}from"node:fs";import ee from"node:path";import{TextDecoder as cg}from"node:util";var ng=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),ag=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function og(e){return e.toLowerCase().startsWith(".env")}function Sr(e){let r=e.replaceAll("\\","/").split("/").filter(Boolean).map(i=>i.toLowerCase());return r.some(i=>og(i))?"environment-file":r.some(i=>ag.has(i))?"credential-config":r.includes(".git")?"git-metadata":r.some(i=>ng.has(i))?"dependency-or-cache":r.join("/")===".comet/config.yaml"?"comet-config":r.join("/")===".comet/current-change.json"?"comet-selection":null}var Xi=1024*1024;function vo(e,t){let r=ee.relative(e,t);return r===""||!ee.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${ee.sep}`)}function lg(e){let t=ee.posix.normalize(e);if(e.length===0||e!==e.trim()||e.includes("\\")||Array.from(e).some(n=>{let a=n.codePointAt(0)??0;return a<=31||a===127})||ee.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes("..")||t!==e||t==="."||e.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${e}`);let r=e.toLowerCase(),i=Sr(e);if(i||r==="runtime"||r.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${i??"native-runtime"}): ${e}`);return e}function ug(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native artifact byte limit must be a positive integer");return e}function dg(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Yi(e,t){let r={...e,birthtime:e.birthtimeMs},i={...t,birthtime:t.birthtimeMs};return fe(r,i)?T(r,i):T(r,i)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function pu(e){let t=await ce.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${e}`);return{path:e,realPath:await ce.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function fg(e,t){let r=ee.resolve(e),i=ee.resolve(t);if(!vo(r,i))throw new Error("Native artifact path is outside its root");let n=[await pu(r)],a=r;for(let o of ee.relative(r,i).split(ee.sep).filter(Boolean)){a=ee.join(a,o);let s=await pu(a);if(!vo(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);n.push(s)}return n}async function mu(e){for(let t of e){let r=await ce.lstat(t.path);if(!r.isDirectory()||r.isSymbolicLink()||!dg(t,r)||await ce.realpath(t.path)!==t.realPath)throw new Error(`Native artifact parent changed while reading: ${t.path}`)}}async function ge(e){let t=lg(e.ref),r=e.maxBytes===null?null:ug(e.maxBytes??Xi),i=ee.resolve(e.root,...t.split("/")),n=await fg(e.root,ee.dirname(i));await e.hooks?.afterParentChainCaptured?.();let a=await ce.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${t}`);if(r!==null&&a.size>r)throw new Error(`Native artifact exceeds ${r} bytes: ${t}`);let o=await ce.realpath(i);if(!vo(n[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${t}`);let s=await ce.open(i,"r");try{let[c,l,u]=await Promise.all([s.stat(),ce.lstat(i),ce.realpath(i)]);if(await mu(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||u!==o||!Yi(a,c)||!Yi(c,l))throw new Error(`Native artifact changed while opening: ${t}`);await e.hooks?.afterOpen?.();let d=[],f=0,p=Buffer.allocUnsafe(r===null?64*1024:Math.min(64*1024,r+1));for(;;){let b=r===null?p.length:r+1-f,k=await s.read(p,0,Math.min(p.length,b),null);if(k.bytesRead===0)break;if(f+=k.bytesRead,r!==null&&f>r)throw new Error(`Native artifact exceeds ${r} bytes: ${t}`);d.push(Buffer.from(p.subarray(0,k.bytesRead)))}await e.hooks?.beforeFinalCheck?.();let[v,h,m]=await Promise.all([s.stat(),ce.lstat(i),ce.realpath(i)]);if(await mu(n),!h.isFile()||h.isSymbolicLink()||m!==o||!Yi(c,v)||!Yi(c,h))throw new Error(`Native artifact changed while reading: ${t}`);let w=Buffer.concat(d,f),y;try{y=new cg("utf-8",{fatal:!0}).decode(w)}catch(b){throw new Error(`Native artifact is not valid UTF-8: ${t}`,{cause:b})}return{ref:t,size:f,hash:e.includeHash===!1?null:sg("sha256").update(w).digest("hex"),text:y}}finally{await s.close()}}var Nu=Pt(ht(),1);var go={en:{outcome:"Outcome",scope:"Scope",nonGoals:"Non-goals",acceptanceExamples:"Acceptance examples",constraints:"Constraints and invariants",decisions:"Decisions",openQuestions:"Open questions",verificationExpectations:"Verification expectations"},"zh-CN":{outcome:"目标",scope:"范围",nonGoals:"非目标",acceptanceExamples:"验收示例",constraints:"约束与不变量",decisions:"决策",openQuestions:"待解决问题",verificationExpectations:"验证预期"}},hg={en:{verification:"Verification",currentResult:"Current result",acceptance:"Acceptance",checks:"Checks",blockers:"Blockers",risks:"Risks and skipped work",previousIterations:"Previous iterations",conclusion:"Conclusion"},"zh-CN":{verification:"验证",currentResult:"当前结果",acceptance:"验收",checks:"检查",blockers:"阻塞项",risks:"风险与跳过的工作",previousIterations:"之前的迭代",conclusion:"结论"}},pg={en:{acceptanceEvidence:"Acceptance evidence",commandsAndResults:"Commands and results",skippedChecks:"Skipped checks",specConsistency:"Spec consistency",knownLimitationsAndRisks:"Known limitations and risks",conclusion:"Conclusion"},"zh-CN":{acceptanceEvidence:"验收证据",commandsAndResults:"命令与结果",skippedChecks:"跳过的检查",specConsistency:"规格一致性",knownLimitationsAndRisks:"已知限制与风险",conclusion:"结论"}},mg=new Map,vu=new Map;for(let e of Object.keys(go)){for(let[t,r]of Object.entries(go[e]))mg.set(r.toLocaleLowerCase("en-US"),t);for(let[t,r]of Object.entries(hg[e]))vu.set(r.toLocaleLowerCase("en-US"),t);for(let[t,r]of Object.entries(pg[e]))vu.set(r.toLocaleLowerCase("en-US"),t)}function vg(e,t){return go[e][t]}function Qi(e){return["outcome","scope","nonGoals","acceptanceExamples","constraints","decisions","openQuestions","verificationExpectations"].map(r=>`# ${vg(e,r)}
174
+ `}function vg(e,t){if(!/^[a-f0-9-]{8,}$/u.test(t))throw new Error(`Invalid Native transaction id: ${t}`);return Ee.join(e.transactionsDir,t)}function Qi(e,t){let r=vg(e,t);return{directory:r,journal:Ee.join(r,"transaction.json"),events:Ee.join(r,"events.jsonl"),staged:Ee.join(r,"staged"),backups:Ee.join(r,"backups")}}async function rt(e,t){let r=Qi(e,t);return await Promise.all(Object.values(r).map(i=>O(e.runtimeDir,i))),r}async function wu(e,t,r={}){let i=await rt(e,t);try{await Yi.lstat(i.events)}catch(n){if(n.code==="ENOENT")return{exists:!1,hash:null,size:0,events:[],canonicalSource:"",needsRepair:!1};throw n}try{let n=await G({root:e.runtimeDir,file:i.events,maxBytes:lg,label:`Native transaction event log ${t}`,hooks:r.hooks}),a;try{a=pu.decode(n.bytes)}catch(c){throw new Error(`Native transaction event log ${t} is not valid UTF-8`,{cause:c})}let o=mg(a),s=gu(o);return{exists:!0,hash:n.hash,size:n.size,events:o,canonicalSource:s,needsRepair:a!==s}}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction event log ${t} changed while reading`,{cause:n}):n}}async function uu(e,t,r){let i=await wu(e,t);if(i.exists!==r.exists||i.hash!==r.hash||i.size!==r.size)throw new Error(`Native transaction event log ${t} changed before append`)}async function vo(e,t,r,i){let n=await rt(e,t),a=await wu(e,t),o=a.events.find(c=>c.type===r&&c.operationId===i);if(o)return a.needsRepair&&await J(n.events,a.canonicalSource,{containedRoot:e.runtimeDir,beforeCommit:()=>uu(e,t,a)}),o;if(a.events.length>=Xi)throw new Error(`Native transaction event log ${t} exceeds ${Xi} events`);let s={sequence:a.events.length+1,timestamp:new Date().toISOString(),type:r,...i?{operationId:i}:{}};return vu(s,s.sequence),await Yi.mkdir(n.directory,{recursive:!0}),await J(n.events,gu([...a.events,s]),{containedRoot:e.runtimeDir,beforeCommit:()=>uu(e,t,a)}),s}async function yu(e,t){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");t=mo(t);let r=await rt(e,t.id);await Yi.mkdir(r.staged,{recursive:!0}),await Yi.mkdir(r.backups,{recursive:!0}),await Y(r.journal,t,{containedRoot:e.runtimeDir}),await vo(e,t.id,"prepared")}async function Sr(e,t,r={}){let i=await rt(e,t),n=await G({root:e.runtimeDir,file:i.journal,maxBytes:cg,label:`Native transaction journal ${t}`,hooks:r.hooks}),a=JSON.parse(pu.decode(n.bytes)),o=mo(a);if(o.id!==t)throw new Error(`Invalid Native transaction journal: ${t}`);return o}async function gg(e,t,r){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");let i=mo({...t,status:r});return await Y((await rt(e,t.id)).journal,i,{containedRoot:e.runtimeDir}),i}async function go(e,t,r){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");return await vo(e,t.id,r),r==="commit"?gg(e,t,"committed"):t}import{createHash as ow}from"node:crypto";import{promises as cn}from"node:fs";import qe from"node:path";import{execFileSync as wg}from"child_process";import en from"path";function Zi(e,t){return wg("git",["-C",e,...t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function yg(e,t){let r=en.normalize(e),i=en.normalize(t);return process.platform==="win32"?r.toLowerCase()===i.toLowerCase():r===i}function ge(e){try{let t=en.resolve(Zi(e,["rev-parse","--show-toplevel"])),i=Zi(e,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),n=i?en.resolve(i.slice(9)):t,a=null;try{a=Zi(e,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!yg(t,n),currentWorktreeRoot:t,primaryWorktreeRoot:n,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function Er(e,t){try{let r=Zi(e,["rev-parse","--verify",`${t}^{commit}`]).toLowerCase();return/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(r)?r:null}catch{return null}}import{createHash as Sg}from"node:crypto";import{promises as le}from"node:fs";import te from"node:path";import{TextDecoder as Eg}from"node:util";var Ng=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),bg=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function kg(e){return e.toLowerCase().startsWith(".env")}function Cr(e){let r=e.replaceAll("\\","/").split("/").filter(Boolean).map(i=>i.toLowerCase());return r.some(i=>kg(i))?"environment-file":r.some(i=>bg.has(i))?"credential-config":r.includes(".git")?"git-metadata":r.some(i=>Ng.has(i))?"dependency-or-cache":r.join("/")===".comet/config.yaml"?"comet-config":r.join("/")===".comet/current-change.json"?"comet-selection":null}var rn=1024*1024;function wo(e,t){let r=te.relative(e,t);return r===""||!te.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${te.sep}`)}function Cg(e){let t=te.posix.normalize(e);if(e.length===0||e!==e.trim()||e.includes("\\")||Array.from(e).some(n=>{let a=n.codePointAt(0)??0;return a<=31||a===127})||te.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes("..")||t!==e||t==="."||e.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${e}`);let r=e.toLowerCase(),i=Cr(e);if(i||r==="runtime"||r.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${i??"native-runtime"}): ${e}`);return e}function Pg(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native artifact byte limit must be a positive integer");return e}function xg(e,t){return I({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function tn(e,t){let r={...e,birthtime:e.birthtimeMs},i={...t,birthtime:t.birthtimeMs};return he(r,i)?I(r,i):I(r,i)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function Nu(e){let t=await le.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${e}`);return{path:e,realPath:await le.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function Rg(e,t){let r=te.resolve(e),i=te.resolve(t);if(!wo(r,i))throw new Error("Native artifact path is outside its root");let n=[await Nu(r)],a=r;for(let o of te.relative(r,i).split(te.sep).filter(Boolean)){a=te.join(a,o);let s=await Nu(a);if(!wo(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);n.push(s)}return n}async function bu(e){for(let t of e){let r=await le.lstat(t.path);if(!r.isDirectory()||r.isSymbolicLink()||!xg(t,r)||await le.realpath(t.path)!==t.realPath)throw new Error(`Native artifact parent changed while reading: ${t.path}`)}}async function we(e){let t=Cg(e.ref),r=e.maxBytes===null?null:Pg(e.maxBytes??rn),i=te.resolve(e.root,...t.split("/")),n=await Rg(e.root,te.dirname(i));await e.hooks?.afterParentChainCaptured?.();let a=await le.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${t}`);if(r!==null&&a.size>r)throw new Error(`Native artifact exceeds ${r} bytes: ${t}`);let o=await le.realpath(i);if(!wo(n[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${t}`);let s=await le.open(i,"r");try{let[c,l,u]=await Promise.all([s.stat(),le.lstat(i),le.realpath(i)]);if(await bu(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||u!==o||!tn(a,c)||!tn(c,l))throw new Error(`Native artifact changed while opening: ${t}`);await e.hooks?.afterOpen?.();let d=[],f=0,p=Buffer.allocUnsafe(r===null?64*1024:Math.min(64*1024,r+1));for(;;){let b=r===null?p.length:r+1-f,k=await s.read(p,0,Math.min(p.length,b),null);if(k.bytesRead===0)break;if(f+=k.bytesRead,r!==null&&f>r)throw new Error(`Native artifact exceeds ${r} bytes: ${t}`);d.push(Buffer.from(p.subarray(0,k.bytesRead)))}await e.hooks?.beforeFinalCheck?.();let[v,h,m]=await Promise.all([s.stat(),le.lstat(i),le.realpath(i)]);if(await bu(n),!h.isFile()||h.isSymbolicLink()||m!==o||!tn(c,v)||!tn(c,h))throw new Error(`Native artifact changed while reading: ${t}`);let w=Buffer.concat(d,f),y;try{y=new Eg("utf-8",{fatal:!0}).decode(w)}catch(b){throw new Error(`Native artifact is not valid UTF-8: ${t}`,{cause:b})}return{ref:t,size:f,hash:e.includeHash===!1?null:Sg("sha256").update(w).digest("hex"),text:y}}finally{await s.close()}}var Pu=Rt(mt(),1);var yo={en:{outcome:"Outcome",scope:"Scope",nonGoals:"Non-goals",acceptanceExamples:"Acceptance examples",constraints:"Constraints and invariants",decisions:"Decisions",openQuestions:"Open questions",verificationExpectations:"Verification expectations"},"zh-CN":{outcome:"目标",scope:"范围",nonGoals:"非目标",acceptanceExamples:"验收示例",constraints:"约束与不变量",decisions:"决策",openQuestions:"待解决问题",verificationExpectations:"验证预期"}},Ag={en:{verification:"Verification",currentResult:"Current result",acceptance:"Acceptance",checks:"Checks",blockers:"Blockers",risks:"Risks and skipped work",previousIterations:"Previous iterations",conclusion:"Conclusion"},"zh-CN":{verification:"验证",currentResult:"当前结果",acceptance:"验收",checks:"检查",blockers:"阻塞项",risks:"风险与跳过的工作",previousIterations:"之前的迭代",conclusion:"结论"}},_g={en:{acceptanceEvidence:"Acceptance evidence",commandsAndResults:"Commands and results",skippedChecks:"Skipped checks",specConsistency:"Spec consistency",knownLimitationsAndRisks:"Known limitations and risks",conclusion:"Conclusion"},"zh-CN":{acceptanceEvidence:"验收证据",commandsAndResults:"命令与结果",skippedChecks:"跳过的检查",specConsistency:"规格一致性",knownLimitationsAndRisks:"已知限制与风险",conclusion:"结论"}},Tg=new Map,ku=new Map;for(let e of Object.keys(yo)){for(let[t,r]of Object.entries(yo[e]))Tg.set(r.toLocaleLowerCase("en-US"),t);for(let[t,r]of Object.entries(Ag[e]))ku.set(r.toLocaleLowerCase("en-US"),t);for(let[t,r]of Object.entries(_g[e]))ku.set(r.toLocaleLowerCase("en-US"),t)}function Ig(e,t){return yo[e][t]}function nn(e){return["outcome","scope","nonGoals","acceptanceExamples","constraints","decisions","openQuestions","verificationExpectations"].map(r=>`# ${Ig(e,r)}
175
175
  `).join(`
176
- `)}import{createHash as gg}from"crypto";function te(e){return gg("sha256").update(e).digest("hex")}var Ek={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024};var Pk=8*1024*1024;var Ck=64*1024,xk=64*1024;var Rk={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},Ak={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};var _k=(1n<<256n)-1n;var Eg=Pt(ht(),1);var Jk=4*1024*1024;var Pg=null;function Cg(e,t){let r=e;for(let i of t)r+="\0"+(typeof i=="string"?i:JSON.stringify(i));return r}function gu(e,t){return(...r)=>{let i=Pg;if(i===null)return t(...r);let n=Cg(`async:${e}`,r),a=i.entries.get(n);if(a)return a.value;let o=t(...r).catch(s=>{throw i.entries.delete(n),s});return i.entries.set(n,{value:o}),o}}var Xk=gu("hookWritePolicy",async e=>(await Za(e))?.hook??{allow_paths:[]});var WS=256*1024;var iE={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 bu=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],TE=new Set(bu),jg=new Set([...bu,"minimum_runtime_version","revision"]),IE=new Set([...jg,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]);var Zi=class extends Error{constructor(r,i,n){super(`Native change ${r} revision conflict: expected ${i}, actual ${n}`);this.change=r;this.expectedRevision=i;this.actualRevision=n;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},Er=class extends Error{constructor(r,i){super(`Native working directory already contains active change${i.length===1?"":"s"} ${i.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=r;this.activeChanges=i;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},en=class extends Error{constructor(r,i,n,a,o,s=null,c=null){super(`Native change ${r} baseline is incomplete (${i} omitted entr${i===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=r;this.omittedCount=i;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"},jE=Qi("en");import{createHash as $g}from"crypto";function le(e){throw new TypeError(`Value is not valid canonical JSON: ${e}`)}function Og(e,t){t.has(e)&&le("cyclic structures are not supported"),t.add(e);try{let r=Object.keys(e);for(let i=0;i<e.length;i+=1)Object.prototype.hasOwnProperty.call(e,i)||le("sparse arrays are not supported");return(r.length!==e.length||r.some((i,n)=>i!==String(n)))&&le("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(e).length>0&&le("symbol properties are not supported"),`[${e.map(i=>bo(i,t)).join(",")}]`}finally{t.delete(e)}}function Hg(e,t){let r=Object.getPrototypeOf(e);r!==Object.prototype&&r!==null&&le("only plain objects are supported"),t.has(e)&&le("cyclic structures are not supported"),Object.getOwnPropertySymbols(e).length>0&&le("symbol properties are not supported"),t.add(e);try{let i=Object.getOwnPropertyDescriptors(e);return`{${Object.keys(e).sort().map(o=>{let s=i[o];return(!s||!("value"in s))&&le("accessor properties are not supported"),`${JSON.stringify(o)}:${bo(s.value,t)}`}).join(",")}}`}finally{t.delete(e)}}function bo(e,t){if(e===null)return"null";switch(typeof e){case"boolean":return e?"true":"false";case"string":return JSON.stringify(e);case"number":return Number.isFinite(e)||le("numbers must be finite"),JSON.stringify(Object.is(e,-0)?0:e);case"object":return Array.isArray(e)?Og(e,t):Hg(e,t);case"bigint":case"function":case"symbol":case"undefined":return le(`${typeof e} values are not supported`)}return le("unsupported value type")}function ko(e){return bo(e,new Set)}function re(e,t){if(e.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(e))throw new TypeError("Canonical hash tag must not contain a line break");return $g("sha256").update(`${e}
177
- ${ko(t)}`).digest("hex")}var FE=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),ku=Object.freeze({maxCriteria:1024});var Su=Pt(ht(),1);var xu="[a-z][a-z0-9]*(?:-[a-z0-9]+)*",lP=new RegExp(`^portable-archive-(${xu})\\.json$`,"u"),uP=new RegExp(`^portable-migration-(${xu})\\.json$`,"u");var Pr=/^[a-f0-9]{64}$/u,Ru=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u,zg=16*1024,Eo=process.platform;function Iu(e,t){let r=Fe.relative(e,t);return Fe.isAbsolute(r)||r===".."||r.startsWith(`..${Fe.sep}`)?null:r.replaceAll("\\","/")||"."}function ju(e){return Array.from(e).some(t=>{let r=t.codePointAt(0)??0;return r<=31||r===127})}function $u(e,t){if(e.length===0||ju(e)||e.includes("\\")||Fe.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes(".."))throw new Error(`${t} must be a portable project-relative path`);let r=Fe.posix.normalize(e);if(r!==e||r===".."||r.startsWith("../"))throw new Error(`${t} must be a normalized project-relative path`);return r}function Po(e,t){return Wg("sha256").update(`${e}
178
- ${t}`).digest("hex")}async function Au(e,t){let r=await rn.realpath(t),i=await rn.lstat(r);if(!i.isDirectory()||i.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=Eo==="win32"?Fe.normalize(r).toLowerCase():r;return Po(e,`${n}
176
+ `)}import{createHash as jg}from"crypto";function re(e){return jg("sha256").update(e).digest("hex")}var Xk={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024};var Qk=8*1024*1024;var Zk=64*1024,eS=64*1024;var tS={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},rS={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};var iS=(1n<<256n)-1n;var Mg=Rt(mt(),1);var yS=4*1024*1024;var Fg=null;function Vg(e,t){let r=e;for(let i of t)r+="\0"+(typeof i=="string"?i:JSON.stringify(i));return r}function Su(e,t){return(...r)=>{let i=Fg;if(i===null)return t(...r);let n=Vg(`async:${e}`,r),a=i.entries.get(n);if(a)return a.value;let o=t(...r).catch(s=>{throw i.entries.delete(n),s});return i.entries.set(n,{value:o}),o}}var ES=Su("hookWritePolicy",async e=>(await no(e))?.hook??{allow_paths:[]});var yE=256*1024;var IE={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 xu=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],oC=new Set(xu),Kg=new Set([...xu,"minimum_runtime_version","revision"]),sC=new Set([...Kg,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]);var an=class extends Error{constructor(r,i,n){super(`Native change ${r} revision conflict: expected ${i}, actual ${n}`);this.change=r;this.expectedRevision=i;this.actualRevision=n;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},Pr=class extends Error{constructor(r,i){super(`Native working directory already contains active change${i.length===1?"":"s"} ${i.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=r;this.activeChanges=i;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},on=class extends Error{constructor(r,i,n,a,o,s=null,c=null){super(`Native change ${r} baseline is incomplete (${i} omitted entr${i===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=r;this.omittedCount=i;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"},cC=nn("en");import{createHash as Yg}from"crypto";function ue(e){throw new TypeError(`Value is not valid canonical JSON: ${e}`)}function Xg(e,t){t.has(e)&&ue("cyclic structures are not supported"),t.add(e);try{let r=Object.keys(e);for(let i=0;i<e.length;i+=1)Object.prototype.hasOwnProperty.call(e,i)||ue("sparse arrays are not supported");return(r.length!==e.length||r.some((i,n)=>i!==String(n)))&&ue("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(e).length>0&&ue("symbol properties are not supported"),`[${e.map(i=>So(i,t)).join(",")}]`}finally{t.delete(e)}}function Qg(e,t){let r=Object.getPrototypeOf(e);r!==Object.prototype&&r!==null&&ue("only plain objects are supported"),t.has(e)&&ue("cyclic structures are not supported"),Object.getOwnPropertySymbols(e).length>0&&ue("symbol properties are not supported"),t.add(e);try{let i=Object.getOwnPropertyDescriptors(e);return`{${Object.keys(e).sort().map(o=>{let s=i[o];return(!s||!("value"in s))&&ue("accessor properties are not supported"),`${JSON.stringify(o)}:${So(s.value,t)}`}).join(",")}}`}finally{t.delete(e)}}function So(e,t){if(e===null)return"null";switch(typeof e){case"boolean":return e?"true":"false";case"string":return JSON.stringify(e);case"number":return Number.isFinite(e)||ue("numbers must be finite"),JSON.stringify(Object.is(e,-0)?0:e);case"object":return Array.isArray(e)?Xg(e,t):Qg(e,t);case"bigint":case"function":case"symbol":case"undefined":return ue(`${typeof e} values are not supported`)}return ue("unsupported value type")}function Eo(e){return So(e,new Set)}function ie(e,t){if(e.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(e))throw new TypeError("Canonical hash tag must not contain a line break");return Yg("sha256").update(`${e}
177
+ ${Eo(t)}`).digest("hex")}var vC=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),Ru=Object.freeze({maxCriteria:1024});var Au=Rt(mt(),1);var ju="[a-z][a-z0-9]*(?:-[a-z0-9]+)*",LC=new RegExp(`^portable-archive-(${ju})\\.json$`,"u"),BC=new RegExp(`^portable-migration-(${ju})\\.json$`,"u");var xr=/^[a-f0-9]{64}$/u,$u=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u,sw=16*1024,Po=process.platform;function Lu(e,t){let r=qe.relative(e,t);return qe.isAbsolute(r)||r===".."||r.startsWith(`..${qe.sep}`)?null:r.replaceAll("\\","/")||"."}function Bu(e){return Array.from(e).some(t=>{let r=t.codePointAt(0)??0;return r<=31||r===127})}function Mu(e,t){if(e.length===0||Bu(e)||e.includes("\\")||qe.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes(".."))throw new Error(`${t} must be a portable project-relative path`);let r=qe.posix.normalize(e);if(r!==e||r===".."||r.startsWith("../"))throw new Error(`${t} must be a normalized project-relative path`);return r}function xo(e,t){return ow("sha256").update(`${e}
178
+ ${t}`).digest("hex")}async function Ou(e,t){let r=await cn.realpath(t),i=await cn.lstat(r);if(!i.isDirectory()||i.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=Po==="win32"?qe.normalize(r).toLowerCase():r;return xo(e,`${n}
179
179
  ${i.dev}
180
180
  ${i.ino}
181
- ${i.birthtimeMs}`)}async function _u(e,t){let r=await rn.realpath(t),i=await rn.lstat(r);if(!i.isDirectory()||i.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=Eo==="win32"?Fe.normalize(r).toLowerCase():r;return Po(e,n)}function Jg(e){if(typeof e!="string")throw new Error("Native workspace capturedAt is invalid");let t=new Date(e);if(!Number.isFinite(t.getTime())||t.toISOString()!==e)throw new Error("Native workspace capturedAt is invalid");return e}function So(e,t){if(e===null)return null;if(typeof e!="string"||e.length===0||e.trim()!==e||ju(e))throw new Error(`${t} must be a non-empty branch name or null`);return e}function Ou(e){if(!new Set(["current","branch","worktree"]).has(e.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(So(e.changeBranch,"Native workspace change branch"),So(e.targetBranch,"Native workspace target branch"),(e.isolation==="branch"||e.isolation==="worktree")&&(e.changeBranch===null||e.targetBranch===null))throw new Error("Native isolated workspace requires change and target branches")}function Gg(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace Git provenance must be an object");let t=e,r=new Set(["provider","baseCommit","targetBranch","targetCommit"]),i=Object.keys(t).filter(n=>!r.has(n));if(i.length>0)throw new Error(`Native workspace Git provenance has unknown field(s): ${i.join(", ")}`);if(t.provider!=="git"||typeof t.baseCommit!="string"||!Ru.test(t.baseCommit)||typeof t.targetCommit!="string"||!Ru.test(t.targetCommit))throw new Error("Native workspace Git provenance is invalid");So(t.targetBranch,"Native workspace Git target branch")}function nn(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace identity must be an object");let t=e,r=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","git","isolation","changeBranch","targetBranch","finish"]),i=Object.keys(t).filter(o=>!r.has(o));if(i.length>0)throw new Error(`Native workspace identity has unknown field(s): ${i.join(", ")}`);if(t.schema!=="comet.native.workspace.v2"&&t.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(t.capturedRevision)||t.capturedRevision<1||typeof t.nativeRootRef!="string"||!Pr.test(String(t.projectRootId))||!Pr.test(String(t.nativeRootId)))throw new Error("Native workspace identity is invalid");Jg(t.capturedAt),$u(t.nativeRootRef,"Native workspace root ref");let n=t.projectRootPathId!==void 0,a=t.nativeRootPathId!==void 0;if(n!==a)throw new Error("Native workspace path identities must be provided together");if(n&&!Pr.test(String(t.projectRootPathId))||a&&!Pr.test(String(t.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(t.sessionHash!==void 0&&!Pr.test(String(t.sessionHash)))throw new Error("Native workspace session hash is invalid");if(t.git!==void 0&&Gg(t.git),t.schema==="comet.native.workspace.v2"){if(t.isolation!==void 0||t.changeBranch!==void 0||t.targetBranch!==void 0||t.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof t.isolation!="string"||t.changeBranch===void 0||t.targetBranch===void 0||t.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(Ou(t),t.finish!==null&&!new Set(["merge","push","pull-request","keep"]).has(t.finish))throw new Error("Native workspace finish must be merge, push, pull-request, keep, or null")}function Hu(e,t){return Fe.join(pe(e,t),"workspace.json")}function Ug(e,t){let r=Hu(e,t),i=se(e,r),n=Iu(i,r);if(!n||n===".")throw new Error("Native workspace file escaped its root");return{root:i,ref:$u(n,"Native workspace file ref")}}async function Kg(e,t){try{let r=Ug(e,t),i=await ge({root:r.root,ref:r.ref,maxBytes:zg});return JSON.parse(i.text)}catch(r){if(r.code==="ENOENT")return null;throw r}}async function Du(e){if(!Number.isSafeInteger(e.revision)||e.revision<1)throw new Error("Native workspace revision must be a positive integer");let t=Iu(e.paths.projectRoot,e.paths.nativeRoot);if(!t)throw new Error("Native root is outside the project root");let r=ve(e.paths.projectRoot),i=r.isGitWorktree?kr(e.paths.projectRoot,"HEAD"):null,n=e.binding?.targetBranch??r.currentBranch,a=n==null?null:kr(e.paths.projectRoot,n),o=i!==null&&n!==null&&n!==void 0&&a!==null?{provider:"git",baseCommit:i,targetBranch:n,targetCommit:a}:void 0,[s,c,l,u]=await Promise.all([Au("comet.native.workspace-project-root.v2",e.paths.projectRoot),Au("comet.native.workspace-native-root.v2",e.paths.nativeRoot),_u("comet.native.workspace-project-root-path.v2",e.paths.projectRoot),_u("comet.native.workspace-native-root-path.v2",e.paths.nativeRoot)]),d=(e.now??new Date).toISOString();if(e.finish&&!e.binding)throw new Error("Native workspace finish requires a workspace binding");e.binding&&Ou(e.binding);let f={capturedAt:d,capturedRevision:e.revision,nativeRootRef:t,projectRootId:s,nativeRootId:c,projectRootPathId:l,nativeRootPathId:u,...o?{git:o}:{},...e.sessionId?{sessionHash:Po("comet.native.workspace-session.v2",`${s}
181
+ ${i.birthtimeMs}`)}async function Hu(e,t){let r=await cn.realpath(t),i=await cn.lstat(r);if(!i.isDirectory()||i.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=Po==="win32"?qe.normalize(r).toLowerCase():r;return xo(e,n)}function cw(e){if(typeof e!="string")throw new Error("Native workspace capturedAt is invalid");let t=new Date(e);if(!Number.isFinite(t.getTime())||t.toISOString()!==e)throw new Error("Native workspace capturedAt is invalid");return e}function Co(e,t){if(e===null)return null;if(typeof e!="string"||e.length===0||e.trim()!==e||Bu(e))throw new Error(`${t} must be a non-empty branch name or null`);return e}function Fu(e){if(!new Set(["current","branch","worktree"]).has(e.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(Co(e.changeBranch,"Native workspace change branch"),Co(e.targetBranch,"Native workspace target branch"),(e.isolation==="branch"||e.isolation==="worktree")&&(e.changeBranch===null||e.targetBranch===null))throw new Error("Native isolated workspace requires change and target branches")}function lw(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace Git provenance must be an object");let t=e,r=new Set(["provider","baseCommit","targetBranch","targetCommit"]),i=Object.keys(t).filter(n=>!r.has(n));if(i.length>0)throw new Error(`Native workspace Git provenance has unknown field(s): ${i.join(", ")}`);if(t.provider!=="git"||typeof t.baseCommit!="string"||!$u.test(t.baseCommit)||typeof t.targetCommit!="string"||!$u.test(t.targetCommit))throw new Error("Native workspace Git provenance is invalid");Co(t.targetBranch,"Native workspace Git target branch")}function ln(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace identity must be an object");let t=e,r=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","git","isolation","changeBranch","targetBranch","finish"]),i=Object.keys(t).filter(o=>!r.has(o));if(i.length>0)throw new Error(`Native workspace identity has unknown field(s): ${i.join(", ")}`);if(t.schema!=="comet.native.workspace.v2"&&t.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(t.capturedRevision)||t.capturedRevision<1||typeof t.nativeRootRef!="string"||!xr.test(String(t.projectRootId))||!xr.test(String(t.nativeRootId)))throw new Error("Native workspace identity is invalid");cw(t.capturedAt),Mu(t.nativeRootRef,"Native workspace root ref");let n=t.projectRootPathId!==void 0,a=t.nativeRootPathId!==void 0;if(n!==a)throw new Error("Native workspace path identities must be provided together");if(n&&!xr.test(String(t.projectRootPathId))||a&&!xr.test(String(t.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(t.sessionHash!==void 0&&!xr.test(String(t.sessionHash)))throw new Error("Native workspace session hash is invalid");if(t.git!==void 0&&lw(t.git),t.schema==="comet.native.workspace.v2"){if(t.isolation!==void 0||t.changeBranch!==void 0||t.targetBranch!==void 0||t.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof t.isolation!="string"||t.changeBranch===void 0||t.targetBranch===void 0||t.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(Fu(t),t.finish!==null&&!new Set(["merge","push","pull-request","keep"]).has(t.finish))throw new Error("Native workspace finish must be merge, push, pull-request, keep, or null")}function Vu(e,t){return qe.join(me(e,t),"workspace.json")}function uw(e,t){let r=Vu(e,t),i=ce(e,r),n=Lu(i,r);if(!n||n===".")throw new Error("Native workspace file escaped its root");return{root:i,ref:Mu(n,"Native workspace file ref")}}async function dw(e,t){try{let r=uw(e,t),i=await we({root:r.root,ref:r.ref,maxBytes:sw});return JSON.parse(i.text)}catch(r){if(r.code==="ENOENT")return null;throw r}}async function qu(e){if(!Number.isSafeInteger(e.revision)||e.revision<1)throw new Error("Native workspace revision must be a positive integer");let t=Lu(e.paths.projectRoot,e.paths.nativeRoot);if(!t)throw new Error("Native root is outside the project root");let r=ge(e.paths.projectRoot),i=r.isGitWorktree?Er(e.paths.projectRoot,"HEAD"):null,n=e.binding?.targetBranch??r.currentBranch,a=n==null?null:Er(e.paths.projectRoot,n),o=i!==null&&n!==null&&n!==void 0&&a!==null?{provider:"git",baseCommit:i,targetBranch:n,targetCommit:a}:void 0,[s,c,l,u]=await Promise.all([Ou("comet.native.workspace-project-root.v2",e.paths.projectRoot),Ou("comet.native.workspace-native-root.v2",e.paths.nativeRoot),Hu("comet.native.workspace-project-root-path.v2",e.paths.projectRoot),Hu("comet.native.workspace-native-root-path.v2",e.paths.nativeRoot)]),d=(e.now??new Date).toISOString();if(e.finish&&!e.binding)throw new Error("Native workspace finish requires a workspace binding");e.binding&&Fu(e.binding);let f={capturedAt:d,capturedRevision:e.revision,nativeRootRef:t,projectRootId:s,nativeRootId:c,projectRootPathId:l,nativeRootPathId:u,...o?{git:o}:{},...e.sessionId?{sessionHash:xo("comet.native.workspace-session.v2",`${s}
182
182
  ${c}
183
- ${e.sessionId}`)}:{}},p=e.binding?{schema:"comet.native.workspace.v3",...f,...e.binding,finish:e.finish??null}:{schema:"comet.native.workspace.v2",...f};return nn(p),p}async function yo(e){let t=await Du(e),r=Hu(e.paths,e.name),i=se(e.paths,r);return await $(i,r),await K(r,t,{containedRoot:i}),t}async function St(e,t){let r=await Kg(e,t);return r===null||r&&typeof r=="object"&&!Array.isArray(r)&&r.schema==="comet.native.workspace.v1"?null:(nn(r),r)}async function tn(e){nn(e.identity);let t=await Du({paths:e.paths,name:"workspace-advisory",revision:e.identity.capturedRevision}),r=[],i=[];return t.nativeRootRef!==e.identity.nativeRootRef&&r.push("native-root-ref"),e.identity.projectRootPathId&&e.identity.nativeRootPathId?(t.projectRootPathId!==e.identity.projectRootPathId&&r.push("project-root-path"),t.nativeRootPathId!==e.identity.nativeRootPathId&&r.push("native-root-path")):(t.projectRootId!==e.identity.projectRootId&&r.push("project-root-legacy-identity"),t.nativeRootId!==e.identity.nativeRootId&&r.push("native-root-legacy-identity")),Eo==="win32"&&r.length>0&&r.every(a=>a==="project-root-legacy-identity"||a==="native-root-legacy-identity")?i.push("workspace-inspection-unavailable"):r.length>0&&i.push("workspace-root-changed"),{state:i.length===0?"aligned":i.includes("workspace-root-changed")?"drifted":"unknown",findingCodes:i,driftComponents:r}}async function No(e){if(nn(e.identity),e.identity.schema==="comet.native.workspace.v2")return{state:"legacy",code:"workspace-binding-legacy",message:"Legacy Native workspace metadata has no isolation binding"};if((await tn(e)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let r=ve(e.paths.projectRoot);return e.identity.changeBranch===null?r.isGitWorktree?{state:"drifted",code:"workspace-branch-changed",message:"Native change was created outside Git but is now being accessed inside Git"}:{state:"aligned",code:null,message:null}:r.isGitWorktree?r.currentBranch!==e.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${e.identity.changeBranch}, but the current branch is ${r.currentBranch??"detached HEAD"}`}:e.identity.isolation==="worktree"&&!r.isSecondaryWorktree?{state:"drifted",code:"workspace-kind-changed",message:"Native change is bound to a linked Git worktree"}:{state:"aligned",code:null,message:null}:{state:"drifted",code:"workspace-vcs-unavailable",message:"Native change requires its bound Git working directory"}}var xo=64*1024*1024,MP=256*1024,Fu=16*1024*1024;async function Y(e){try{return await Ve.access(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Zg(e){let t;try{t=await Ve.readdir(e.transactionsDir,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;throw r}for(let r of t){if(!r.isDirectory()||r.isSymbolicLink())continue;let i;try{i=await br(e,r.name)}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction ${r.name} has no journal; run doctor before moving`,{cause:n}):n}if(i.status!=="committed"&&i.status!=="rolled-back")throw new Error(`Native transaction ${i.id} is unfinished; recover it before moving`)}}async function ew(e,t){for(let r of await Ve.readdir(e.locksDir,{withFileTypes:!0})){let i=I.join(e.locksDir,r.name);if(I.resolve(i)!==I.resolve(t)&&(r.isFile()||r.isSymbolicLink()))throw new Error(`Native lock must be diagnosed before moving the root: ${i}`)}}async function tw(e){let t;try{t=await Ve.readdir(e.changesDir,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;throw r}for(let r of t.sort((i,n)=>i.name.localeCompare(n.name))){if(!r.isDirectory()||r.isSymbolicLink())continue;let i=await St(e,r.name);if(i){await yo({paths:e,name:r.name,revision:i.capturedRevision,...i.schema==="comet.native.workspace.v3"?{binding:{isolation:i.isolation,changeBranch:i.changeBranch,targetBranch:i.targetBranch},...i.finish?{finish:i.finish}:{}}:{}});continue}}}async function rw(e){let t;try{t=await Ve.readdir(e.changesDir,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;throw r}for(let r of t.sort((i,n)=>i.name.localeCompare(n.name)))if(!(!r.isDirectory()||r.isSymbolicLink()))try{let i=await St(e,r.name);if(i?.schema==="comet.native.workspace.v3"){let n=await No({paths:e,identity:i});if(n.state!=="aligned")throw new Error(n.message??"workspace binding is not aligned")}else if(i){let n=await tn({paths:e,identity:i});if(n.state!=="aligned")throw new Error(`legacy workspace ownership is ${n.state}`)}}catch(i){throw new Error(`Native workspace identity for ${r.name} must be aligned and repaired before moving the root`,{cause:i})}}async function xr(e,t){let r=[];async function i(n){let a=await Ze({root:e,directory:n,label:"Native root tree"}),o=a.entries;o.sort((s,c)=>s.name.localeCompare(c.name));for(let s of o){await a.verify();let c=I.join(n,s.name);if(t.excludedFiles?.has(I.resolve(c))){await a.verify();continue}let l=await Ve.lstat(c);if(s.isSymbolicLink()||l.isSymbolicLink()){if(t.rejectSymlinks)throw new Error(`Native root contains a symlink: ${c}`);await a.verify();continue}if(s.isDirectory()&&l.isDirectory())r.push({ref:I.relative(e,c).split(I.sep).join("/"),type:"directory"}),await i(c);else if(s.isFile()&&l.isFile()){let u=await J({root:e,file:c,maxBytes:xo,label:`Native root file ${I.relative(e,c)}`});r.push({ref:I.relative(e,c).split(I.sep).join("/"),type:"file",size:u.size,hash:u.hash})}else throw new Error(`Native root contains an unsupported file type: ${c}`);await a.verify()}}return await i(e),r.sort((n,a)=>n.ref.localeCompare(a.ref))}async function iw(e,t,r,i){await gr({root:i,directory:t,label:"Native root move staging directory"});async function n(a,o){let s=await Ze({root:e,directory:a,label:"Native root move source directory"}),c=s.entries;for(let l of c){await s.verify();let u=I.join(a,l.name);if(I.resolve(u)===I.resolve(r)){await s.verify();continue}let d=await Ve.lstat(u);if(l.isSymbolicLink()||d.isSymbolicLink())throw new Error(`Native root contains a symlink: ${u}`);let f=I.join(o,l.name);if(l.isDirectory()&&d.isDirectory())await gr({root:i,directory:f,label:"Native root move staging directory"}),await n(u,f);else if(l.isFile()&&d.isFile())await wr({sourceRoot:e,source:u,targetRoot:i,target:f,maxBytes:xo,label:`Native root move file ${I.relative(e,u)}`,exclusive:!0,expectedTargetHash:null});else throw new Error(`Native root contains an unsupported file type: ${u}`);await s.verify()}}await n(e,t)}async function an(e,t,r,i){let n=await xr(e,{rejectSymlinks:!0,excludedFiles:r?new Set([I.resolve(r)]):void 0}),a=await xr(t,{rejectSymlinks:!0,excludedFiles:i?new Set([I.resolve(i)]):void 0});if(JSON.stringify(n)!==JSON.stringify(a))throw new Error(`Native root copies differ; preserve both trees for manual recovery: ${e} and ${t}`)}function nw(e,t){return I.join(e.artifactRoot,`.comet-native-move-${t}`)}function aw(e,t){return I.join(e.artifactRoot,`.comet-native-source-${t}.removing`)}function ow(e){return`${e}.removing`}function Vu(e,t,r){return I.join(Gi(e,t).directory,`root-move-cleanup-${r}.json`)}function sw(e){return JSON.stringify(e,null,2)+`
184
- `}function cw(e){return Xg("sha256").update(e).digest("hex")}function lw(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Native root-move cleanup manifest entry ${t} must be an object`);let r=e,i=Object.keys(r).sort(),n=r.type==="file"?["hash","ref","size","type"]:["ref","type"];if(JSON.stringify(i)!==JSON.stringify(n))throw new Error(`Native root-move cleanup manifest entry ${t} has invalid fields`);if(typeof r.ref!="string"||r.ref.length===0||r.ref.includes("\\")||I.posix.normalize(r.ref)!==r.ref||r.ref.startsWith("/")||r.ref.split("/").includes("..")||Buffer.byteLength(r.ref,"utf8")>4096)throw new Error(`Native root-move cleanup manifest entry ${t} has an invalid ref`);if(r.type==="directory")return{ref:r.ref,type:"directory"};if(r.type!=="file"||typeof r.size!="number"||!Number.isSafeInteger(r.size)||r.size<0||typeof r.hash!="string"||!/^[a-f0-9]{64}$/u.test(r.hash))throw new Error(`Native root-move cleanup manifest entry ${t} is invalid`);return{ref:r.ref,type:"file",size:r.size,hash:r.hash}}function uw(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native root-move cleanup manifest must be an object");let i=e;if(JSON.stringify(Object.keys(i).sort())!==JSON.stringify(["entries","kind","schema","transactionId"])||i.schema!=="comet.native.root-move-cleanup.v1"||i.transactionId!==t||i.kind!==r||!Array.isArray(i.entries))throw new Error("Native root-move cleanup manifest binding is invalid");let n=i.entries.map(lw);for(let a=0;a<n.length;a+=1){if(a>0&&n[a-1].ref.localeCompare(n[a].ref)>=0)throw new Error("Native root-move cleanup manifest refs must be unique and sorted");let o=I.posix.dirname(n[a].ref);if(o!=="."&&!n.some(s=>s.ref===o&&s.type==="directory"))throw new Error(`Native root-move cleanup manifest parent is missing: ${o}`)}return{schema:"comet.native.root-move-cleanup.v1",transactionId:t,kind:r,entries:n}}async function dw(e){let t={schema:"comet.native.root-move-cleanup.v1",transactionId:e.id,kind:e.kind,entries:e.entries},r=sw(t);if(Buffer.byteLength(r,"utf8")>Fu)throw new Error("Native root-move cleanup manifest exceeds its byte budget");return await z(Vu(e.paths,e.id,e.kind),r,{containedRoot:e.paths.runtimeDir}),cw(r)}async function fw(e){let t=await J({root:e.paths.runtimeDir,file:Vu(e.paths,e.id,e.cleanup.kind),maxBytes:Fu,label:`Native root-move cleanup manifest ${e.cleanup.kind}`});if(t.hash!==e.cleanup.manifestHash)throw new Error("Native root-move cleanup manifest hash changed");return uw(JSON.parse(t.bytes.toString("utf8")),e.id,e.cleanup.kind)}async function Co(e){let t=await xr(e.quarantine,{rejectSymlinks:!0}),r=new Map(e.manifest.entries.map(i=>[i.ref,i]));for(let i of t){let n=r.get(i.ref);if(!n||JSON.stringify(n)!==JSON.stringify(i))throw new Error(`Native root-move cleanup quarantine differs from its bound manifest: ${i.ref}`)}if(e.exact&&t.length!==e.manifest.entries.length)throw new Error("Native root-move cleanup quarantine is incomplete before deletion");return t}function Bu(e){return e.ref.split("/").length}async function hw(e){let r=[...await Co({quarantine:e.quarantine,manifest:e.manifest,exact:!1})].sort((n,a)=>Bu(a)-Bu(n)||(n.type===a.type?a.ref.localeCompare(n.ref):n.type==="file"?-1:1)),i=0;for(let n of r){let a=I.join(e.quarantine,...n.ref.split("/"));n.type==="file"?await lo({root:e.projectRoot,file:a,maxBytes:xo,expectedHash:n.hash,expectedSize:n.size,label:`Native root-move cleanup file ${n.ref}`}):await uo({root:e.projectRoot,directory:a,label:`Native root-move cleanup directory ${n.ref}`}),i+=1,await e.hooks?.afterRootMoveCleanupEntryRemoved?.(e.manifest.kind,n.ref,i)}await Co({quarantine:e.quarantine,manifest:e.manifest,exact:!1}),await uo({root:e.projectRoot,directory:e.quarantine,label:`Native root-move cleanup quarantine ${e.manifest.kind}`})}function on(e,t,r=e.native.artifact_root){return{...e,native:{...e.native,artifact_root:r,pending_root_move:t}}}function pw(e){return{schema:"comet.native.transaction.v1",id:e.id,kind:"root-move",status:"prepared",projectRoot:e.paths.projectRoot,nativeRoot:e.paths.nativeRoot,createdAt:e.now.toISOString(),operations:[]}}async function Lu(e){let t=on(e.config,{...e.pending,stage:e.stage},e.activeArtifactRoot);return await Le(e.projectRoot,t),t}async function Cr(e){let t=e.config.native.pending_root_move;if(!t||t.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let r=on(e.config,{id:t.id,fromArtifactRoot:t.fromArtifactRoot,toArtifactRoot:t.toArtifactRoot,stage:t.stage,...e.cleanup?{cleanup:e.cleanup}:{}},e.config.native.artifact_root);return await Le(e.projectRoot,r),r}async function Mu(e){let t=e.config,r=t.native.pending_root_move;if(!r||r.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let i=r.cleanup;if(i&&i.kind!==e.kind)throw new Error(`Native root move has unfinished ${i.kind} cleanup; cannot start ${e.kind}`);let n=await Y(e.target),a=await Y(e.quarantine);if(n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(!i){if(!n&&!a)return t;if(!n&&a)throw new Error(`Native root-move cleanup quarantine is not transaction-bound: ${e.kind}`);let s=await dw({paths:e.stablePaths,id:e.id,kind:e.kind,entries:await xr(e.target,{rejectSymlinks:!0})});i={kind:e.kind,state:"prepared",manifestHash:s},t=await Cr({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:i})}let o=await fw({paths:e.stablePaths,id:e.id,cleanup:i});if(n=await Y(e.target),a=await Y(e.quarantine),n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(n){if(i.state!=="prepared")throw new Error(`Native root-move cleanup target reappeared after quarantine: ${e.kind}`);await ru({root:e.projectRoot,directory:e.target,quarantine:e.quarantine,label:e.label,beforeQuarantine:e.beforeQuarantine,afterQuarantine:e.afterQuarantine}),a=!0}if(!a){if(i.state!=="deleting")throw new Error(`Native root-move cleanup quarantine disappeared: ${e.kind}`);return Cr({projectRoot:e.projectRoot,config:t,id:e.id})}return await Co({quarantine:e.quarantine,manifest:o,exact:i.state!=="deleting"}),i.state==="prepared"&&(i={...i,state:"quarantined"},t=await Cr({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:i})),i.state==="quarantined"&&(i={...i,state:"deleting"},t=await Cr({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:i})),await hw({projectRoot:e.projectRoot,quarantine:e.quarantine,manifest:o,hooks:e.hooks}),Cr({projectRoot:e.projectRoot,config:t,id:e.id})}async function mw(e){let t=e.config,r=t.native.pending_root_move.stage;if(r==="copying"){if(!await Y(e.sourcePaths.nativeRoot))throw new Error(`Native source root is missing: ${e.sourcePaths.nativeRoot}`);let s=ow(e.staging);t=await Mu({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"restart-staging",stablePaths:e.sourcePaths,target:e.staging,quarantine:s,label:"Native root move stale staging removal",hooks:e.hooks}),await xr(e.sourcePaths.nativeRoot,{rejectSymlinks:!0,excludedFiles:new Set([I.resolve(e.lockFile)])}),await iw(e.sourcePaths.nativeRoot,e.staging,e.lockFile,e.destinationPaths.projectRoot),await an(e.sourcePaths.nativeRoot,e.staging,e.lockFile),t=await Lu({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"ready"}),r="ready",await e.hooks?.afterRootMoveStage?.("ready",e.journal)}if(r==="ready"){if(await Y(e.destinationPaths.nativeRoot)){if(await Y(e.staging))throw new Error(`Native destination is occupied: ${e.destinationPaths.nativeRoot}`);await an(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile)}else{if(!await Y(e.staging))throw new Error("Native move staging tree is missing");await an(e.sourcePaths.nativeRoot,e.staging,e.lockFile),await Ve.rename(e.staging,e.destinationPaths.nativeRoot)}t=await Lu({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"switched",activeArtifactRoot:e.pending.toArtifactRoot}),r="switched",await e.hooks?.afterRootMoveStage?.("switched",e.journal)}if(r!=="switched")throw new Error(`Unsupported Native root-move stage: ${r}`);if(!await Y(e.destinationPaths.nativeRoot))throw new Error(`Native destination root is missing: ${e.destinationPaths.nativeRoot}`);let i=aw(e.sourcePaths,e.pending.id);!t.native.pending_root_move?.cleanup&&await Y(e.sourcePaths.nativeRoot)&&await an(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile),t=await Mu({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"forward-source",stablePaths:e.destinationPaths,target:e.sourcePaths.nativeRoot,quarantine:i,label:"Native root move source removal",beforeQuarantine:()=>e.hooks?.beforeRootMoveSourceRemove?.(e.sourcePaths.nativeRoot),afterQuarantine:s=>e.hooks?.afterRootMoveSourceQuarantined?.(s),hooks:e.hooks}),await tw(e.destinationPaths);let n=await br(e.destinationPaths,e.pending.id);await mo(e.destinationPaths,n,"commit");let a={artifact_root:t.native.artifact_root,language:t.native.language,clarification_mode:t.native.clarification_mode,archive_confirmation:t.native.archive_confirmation,max_verify_failures:t.native.max_verify_failures,snapshot:t.native.snapshot},o={...t,native:{...a,artifact_root:e.pending.toArtifactRoot}};return await Le(e.projectRoot,o),o}async function qu(e){let t=await Q(e.projectRoot)??ql("docs");if(t.native.pending_root_move)throw new Error(`Native root move ${t.native.pending_root_move.id} is already incomplete`);let r=fr(e.toArtifactRoot);if(r===t.native.artifact_root)throw new Error(`Native artifact root is already ${r}`);let i=await he(e.projectRoot,t.native.artifact_root),n=await he(e.projectRoot,r);if(F(i.nativeRoot,n.nativeRoot)||F(n.nativeRoot,i.nativeRoot))throw new Error("Native source and destination roots must not overlap");if(!await Y(i.nativeRoot))throw new Error(`Native source root does not exist: ${i.nativeRoot}`);if(await Zg(i),await Y(n.nativeRoot))throw new Error(`Native destination is occupied: ${n.nativeRoot}`);let a=await pr(i,"root-move",`move root to ${r}`),o=Qg(),s={id:o,fromArtifactRoot:t.native.artifact_root,toArtifactRoot:r,stage:"copying"},c=pw({id:o,paths:i,now:e.now??new Date}),l=nw(n,o);try{if(await ew(i,a.file),await rw(i),await Y(l))throw new Error(`Native move staging path is occupied: ${l}`);return await Le(e.projectRoot,on(t,s)),await hu(i,c),await e.hooks?.afterRootMoveStage?.("copying",c),await mw({projectRoot:e.projectRoot,config:on(t,s),pending:s,sourcePaths:i,destinationPaths:n,staging:l,journal:c,lockFile:a.file,hooks:e.hooks}),{fromNativeRoot:i.nativeRoot,toNativeRoot:n.nativeRoot,transactionId:o}}finally{await mr(a)}}import Tr from"path";import{realpathSync as hy}from"fs";var gw=["outcome","scope","nonGoals","acceptanceExamples"],nC=[...gw,"constraints","decisions","openQuestions","verificationExpectations"];var ww=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 Wu=1024*1024;var Ju="scoped-text-safety",yw=1,Nw=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var bw="comet.native.checker-policy.v1";var bC=re(bw,{policy:Ju,version:yw,limits:Nw,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var kw=["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"],kC=new Set(kw);var Pw=Wu,LC=3*Pw;var Gu={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:[]},xw=te("comet-native-runtime:v3:scope-reopen"),fx=[{skillVersion:"3",skillHash:te("comet-native-runtime:v3:semantic-repair-budget")},{skillVersion:"2",skillHash:te("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:te("comet-native-runtime:v1")}];var Ku=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],Jx=new Set(Ku),$w=new Set([...Ku,"minimum_runtime_version","revision"]),Gx=new Set([...$w,"operation"]),Ux=512*1024,Ow=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),Kx=new Set([...Ow,"implementationScopeHash","repairScopeHash","repairStagnation","returnToBuild"]);var eR={maxAcceptanceCriteria:ku.maxCriteria};var aR={maxSpecs:64,maxFileBytes:Xi,maxTotalBytes:4*1024*1024};import{execFile as Jw}from"node:child_process";import{promisify as Gw}from"node:util";var sR=["$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 wR={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var LR=512*1024;var _r=class extends Error{recovery;constructor(t,r){super(t),this.name="NativeReceiptScopeStaleError",this.recovery=r}};var cA=64*1024;var lA=3600*1e3;var uA=Gw(Jw);var sn=class extends Error{details;constructor(t){let r=t.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${t.length} receipt(s)): ${t.map(i=>`${i.ref}${i.acceptanceId?`[${i.acceptanceId}]`:""} -> ${i.mismatches.join("; ")}`).join(" | ")}`;super(r),this.name="NativeVerificationReceiptBindingError",this.details=t}};var KA={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var n_=16*1024*1024,a_=256*1024,o_=16*1024;var f_=Object.freeze({maxScopeChanges:128,maxAcceptanceEntries:64,maxUnresolvedReasons:32,maxReceipts:32});var m_=16*1024;var oy=Pt(ht(),1);var g_=8*1024*1024;var cn=class extends Error{constructor(r,i,n){super(r,n);this.preparation=i;this.name="NativeWorkspacePreparationError"}preparation};var SI=Qi("en");var BI=16*1024;var xj=16*1024*1024,ln=class extends Error{constructor(r,i,n,a){super(`Canonical spec conflict for ${r}: expected ${i??"(missing)"}, actual ${n??"(missing)"}`);this.capability=r;this.expectedHash=i;this.actualHash=n;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},un=class extends Error{constructor(r,i=r.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${r.findingCodes.join(", ")}`){super(i);this.preflight=r;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};var Zu=["--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.","check <change-name> Run the read-only Native verification check.","doctor [<change-name>] Diagnose, migrate, or rebuild local execution state."],options:Zu,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, or a named details/history page.","--details Include one fixed-size page of acceptance, Spec, handoff, verification, history, workspace, and report details."],output:"A compact v2 status page or one compact Loop projection with local execution availability. Use --details and --cursor to read fixed-size detail pages; parent changes expose childSummary 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] [--coordination-mode multi-session|single-session] [--accept-result|--revise-implementation|--revise-requirements|--retry-verifier|--resolve-verifier-blocker] [--max-parallel <n>] [--expected-state-version <n>] [--expected-action <action>]
185
- comet native next <change-name> --runner-input <json-file>`,purpose:"Confirm or recover an Agent boundary, advance parent child changes, handle Supervisor task operations, 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.","--coordination-mode multi-session|single-session Required when confirming a multi-child Supervisor Shape.","--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 or Archive 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.","--max-parallel <n> Supervisor task concurrency cap; defaults to 2, use 1 for serial fallback.","--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, review. review fields: status=passed, summary, reviewer_execution_ref from a separate read-only review."," 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."," Supervisor task fields: supervisor-builder-result (child, runId, candidateCommit), supervisor-builder-failure (child, runId, reason), supervisor-verifier-result (child, runId, verdict, verification data), supervisor-reconnect (child, runId), supervisor-cancel (child, runId, reason), or supervisor-integrate (child, checks)."],output:'A compact portable state summary, explicit skill-coordinated label, Runtime-owned check results, scoped verifierDispatch, bounded request-check response, continuation.runnerAction, machine-readable continuation.inputOptions, and continuation.userCommunication with a user-ready message and Agent relay guidance. Read acceptance text and other long fields from paged status --details output. Human-readable verification statuses include "Host independently verified", "Checks completed, but your confirmation is required", "Full verification was unavailable; only automatic checks completed", and "You accepted the incomplete verification result". 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]
186
- 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(e,t){return`${e}:
183
+ ${e.sessionId}`)}:{}},p=e.binding?{schema:"comet.native.workspace.v3",...f,...e.binding,finish:e.finish??null}:{schema:"comet.native.workspace.v2",...f};return ln(p),p}async function bo(e){let t=await qu(e),r=Vu(e.paths,e.name),i=ce(e.paths,r);return await O(i,r),await Y(r,t,{containedRoot:i}),t}async function Pt(e,t){let r=await dw(e,t);return r===null||r&&typeof r=="object"&&!Array.isArray(r)&&r.schema==="comet.native.workspace.v1"?null:(ln(r),r)}async function sn(e){ln(e.identity);let t=await qu({paths:e.paths,name:"workspace-advisory",revision:e.identity.capturedRevision}),r=[],i=[];return t.nativeRootRef!==e.identity.nativeRootRef&&r.push("native-root-ref"),e.identity.projectRootPathId&&e.identity.nativeRootPathId?(t.projectRootPathId!==e.identity.projectRootPathId&&r.push("project-root-path"),t.nativeRootPathId!==e.identity.nativeRootPathId&&r.push("native-root-path")):(t.projectRootId!==e.identity.projectRootId&&r.push("project-root-legacy-identity"),t.nativeRootId!==e.identity.nativeRootId&&r.push("native-root-legacy-identity")),Po==="win32"&&r.length>0&&r.every(a=>a==="project-root-legacy-identity"||a==="native-root-legacy-identity")?i.push("workspace-inspection-unavailable"):r.length>0&&i.push("workspace-root-changed"),{state:i.length===0?"aligned":i.includes("workspace-root-changed")?"drifted":"unknown",findingCodes:i,driftComponents:r}}async function ko(e){if(ln(e.identity),e.identity.schema==="comet.native.workspace.v2")return{state:"legacy",code:"workspace-binding-legacy",message:"Legacy Native workspace metadata has no isolation binding"};if((await sn(e)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let r=ge(e.paths.projectRoot);return e.identity.changeBranch===null?r.isGitWorktree?{state:"drifted",code:"workspace-branch-changed",message:"Native change was created outside Git but is now being accessed inside Git"}:{state:"aligned",code:null,message:null}:r.isGitWorktree?r.currentBranch!==e.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${e.identity.changeBranch}, but the current branch is ${r.currentBranch??"detached HEAD"}`}:e.identity.isolation==="worktree"&&!r.isSecondaryWorktree?{state:"drifted",code:"workspace-kind-changed",message:"Native change is bound to a linked Git worktree"}:{state:"aligned",code:null,message:null}:{state:"drifted",code:"workspace-vcs-unavailable",message:"Native change requires its bound Git working directory"}}var Ao=64*1024*1024,mP=256*1024,Gu=16*1024*1024;async function X(e){try{return await We.access(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function mw(e){let t;try{t=await We.readdir(e.transactionsDir,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;throw r}for(let r of t){if(!r.isDirectory()||r.isSymbolicLink())continue;let i;try{i=await Sr(e,r.name)}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction ${r.name} has no journal; run doctor before moving`,{cause:n}):n}if(i.status!=="committed"&&i.status!=="rolled-back")throw new Error(`Native transaction ${i.id} is unfinished; recover it before moving`)}}async function vw(e,t){for(let r of await We.readdir(e.locksDir,{withFileTypes:!0})){let i=j.join(e.locksDir,r.name);if(j.resolve(i)!==j.resolve(t)&&(r.isFile()||r.isSymbolicLink()))throw new Error(`Native lock must be diagnosed before moving the root: ${i}`)}}async function gw(e){let t;try{t=await We.readdir(e.changesDir,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;throw r}for(let r of t.sort((i,n)=>i.name.localeCompare(n.name))){if(!r.isDirectory()||r.isSymbolicLink())continue;let i=await Pt(e,r.name);if(i){await bo({paths:e,name:r.name,revision:i.capturedRevision,...i.schema==="comet.native.workspace.v3"?{binding:{isolation:i.isolation,changeBranch:i.changeBranch,targetBranch:i.targetBranch},...i.finish?{finish:i.finish}:{}}:{}});continue}}}async function ww(e){let t;try{t=await We.readdir(e.changesDir,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;throw r}for(let r of t.sort((i,n)=>i.name.localeCompare(n.name)))if(!(!r.isDirectory()||r.isSymbolicLink()))try{let i=await Pt(e,r.name);if(i?.schema==="comet.native.workspace.v3"){let n=await ko({paths:e,identity:i});if(n.state!=="aligned")throw new Error(n.message??"workspace binding is not aligned")}else if(i){let n=await sn({paths:e,identity:i});if(n.state!=="aligned")throw new Error(`legacy workspace ownership is ${n.state}`)}}catch(i){throw new Error(`Native workspace identity for ${r.name} must be aligned and repaired before moving the root`,{cause:i})}}async function Ar(e,t){let r=[];async function i(n){let a=await tt({root:e,directory:n,label:"Native root tree"}),o=a.entries;o.sort((s,c)=>s.name.localeCompare(c.name));for(let s of o){await a.verify();let c=j.join(n,s.name);if(t.excludedFiles?.has(j.resolve(c))){await a.verify();continue}let l=await We.lstat(c);if(s.isSymbolicLink()||l.isSymbolicLink()){if(t.rejectSymlinks)throw new Error(`Native root contains a symlink: ${c}`);await a.verify();continue}if(s.isDirectory()&&l.isDirectory())r.push({ref:j.relative(e,c).split(j.sep).join("/"),type:"directory"}),await i(c);else if(s.isFile()&&l.isFile()){let u=await G({root:e,file:c,maxBytes:Ao,label:`Native root file ${j.relative(e,c)}`});r.push({ref:j.relative(e,c).split(j.sep).join("/"),type:"file",size:u.size,hash:u.hash})}else throw new Error(`Native root contains an unsupported file type: ${c}`);await a.verify()}}return await i(e),r.sort((n,a)=>n.ref.localeCompare(a.ref))}async function yw(e,t,r,i){await yr({root:i,directory:t,label:"Native root move staging directory"});async function n(a,o){let s=await tt({root:e,directory:a,label:"Native root move source directory"}),c=s.entries;for(let l of c){await s.verify();let u=j.join(a,l.name);if(j.resolve(u)===j.resolve(r)){await s.verify();continue}let d=await We.lstat(u);if(l.isSymbolicLink()||d.isSymbolicLink())throw new Error(`Native root contains a symlink: ${u}`);let f=j.join(o,l.name);if(l.isDirectory()&&d.isDirectory())await yr({root:i,directory:f,label:"Native root move staging directory"}),await n(u,f);else if(l.isFile()&&d.isFile())await Nr({sourceRoot:e,source:u,targetRoot:i,target:f,maxBytes:Ao,label:`Native root move file ${j.relative(e,u)}`,exclusive:!0,expectedTargetHash:null});else throw new Error(`Native root contains an unsupported file type: ${u}`);await s.verify()}}await n(e,t)}async function un(e,t,r,i){let n=await Ar(e,{rejectSymlinks:!0,excludedFiles:r?new Set([j.resolve(r)]):void 0}),a=await Ar(t,{rejectSymlinks:!0,excludedFiles:i?new Set([j.resolve(i)]):void 0});if(JSON.stringify(n)!==JSON.stringify(a))throw new Error(`Native root copies differ; preserve both trees for manual recovery: ${e} and ${t}`)}function Nw(e,t){return j.join(e.artifactRoot,`.comet-native-move-${t}`)}function bw(e,t){return j.join(e.artifactRoot,`.comet-native-source-${t}.removing`)}function kw(e){return`${e}.removing`}function Uu(e,t,r){return j.join(Qi(e,t).directory,`root-move-cleanup-${r}.json`)}function Sw(e){return JSON.stringify(e,null,2)+`
184
+ `}function Ew(e){return hw("sha256").update(e).digest("hex")}function Cw(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Native root-move cleanup manifest entry ${t} must be an object`);let r=e,i=Object.keys(r).sort(),n=r.type==="file"?["hash","ref","size","type"]:["ref","type"];if(JSON.stringify(i)!==JSON.stringify(n))throw new Error(`Native root-move cleanup manifest entry ${t} has invalid fields`);if(typeof r.ref!="string"||r.ref.length===0||r.ref.includes("\\")||j.posix.normalize(r.ref)!==r.ref||r.ref.startsWith("/")||r.ref.split("/").includes("..")||Buffer.byteLength(r.ref,"utf8")>4096)throw new Error(`Native root-move cleanup manifest entry ${t} has an invalid ref`);if(r.type==="directory")return{ref:r.ref,type:"directory"};if(r.type!=="file"||typeof r.size!="number"||!Number.isSafeInteger(r.size)||r.size<0||typeof r.hash!="string"||!/^[a-f0-9]{64}$/u.test(r.hash))throw new Error(`Native root-move cleanup manifest entry ${t} is invalid`);return{ref:r.ref,type:"file",size:r.size,hash:r.hash}}function Pw(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native root-move cleanup manifest must be an object");let i=e;if(JSON.stringify(Object.keys(i).sort())!==JSON.stringify(["entries","kind","schema","transactionId"])||i.schema!=="comet.native.root-move-cleanup.v1"||i.transactionId!==t||i.kind!==r||!Array.isArray(i.entries))throw new Error("Native root-move cleanup manifest binding is invalid");let n=i.entries.map(Cw);for(let a=0;a<n.length;a+=1){if(a>0&&n[a-1].ref.localeCompare(n[a].ref)>=0)throw new Error("Native root-move cleanup manifest refs must be unique and sorted");let o=j.posix.dirname(n[a].ref);if(o!=="."&&!n.some(s=>s.ref===o&&s.type==="directory"))throw new Error(`Native root-move cleanup manifest parent is missing: ${o}`)}return{schema:"comet.native.root-move-cleanup.v1",transactionId:t,kind:r,entries:n}}async function xw(e){let t={schema:"comet.native.root-move-cleanup.v1",transactionId:e.id,kind:e.kind,entries:e.entries},r=Sw(t);if(Buffer.byteLength(r,"utf8")>Gu)throw new Error("Native root-move cleanup manifest exceeds its byte budget");return await J(Uu(e.paths,e.id,e.kind),r,{containedRoot:e.paths.runtimeDir}),Ew(r)}async function Rw(e){let t=await G({root:e.paths.runtimeDir,file:Uu(e.paths,e.id,e.cleanup.kind),maxBytes:Gu,label:`Native root-move cleanup manifest ${e.cleanup.kind}`});if(t.hash!==e.cleanup.manifestHash)throw new Error("Native root-move cleanup manifest hash changed");return Pw(JSON.parse(t.bytes.toString("utf8")),e.id,e.cleanup.kind)}async function Ro(e){let t=await Ar(e.quarantine,{rejectSymlinks:!0}),r=new Map(e.manifest.entries.map(i=>[i.ref,i]));for(let i of t){let n=r.get(i.ref);if(!n||JSON.stringify(n)!==JSON.stringify(i))throw new Error(`Native root-move cleanup quarantine differs from its bound manifest: ${i.ref}`)}if(e.exact&&t.length!==e.manifest.entries.length)throw new Error("Native root-move cleanup quarantine is incomplete before deletion");return t}function Wu(e){return e.ref.split("/").length}async function Aw(e){let r=[...await Ro({quarantine:e.quarantine,manifest:e.manifest,exact:!1})].sort((n,a)=>Wu(a)-Wu(n)||(n.type===a.type?a.ref.localeCompare(n.ref):n.type==="file"?-1:1)),i=0;for(let n of r){let a=j.join(e.quarantine,...n.ref.split("/"));n.type==="file"?await fo({root:e.projectRoot,file:a,maxBytes:Ao,expectedHash:n.hash,expectedSize:n.size,label:`Native root-move cleanup file ${n.ref}`}):await ho({root:e.projectRoot,directory:a,label:`Native root-move cleanup directory ${n.ref}`}),i+=1,await e.hooks?.afterRootMoveCleanupEntryRemoved?.(e.manifest.kind,n.ref,i)}await Ro({quarantine:e.quarantine,manifest:e.manifest,exact:!1}),await ho({root:e.projectRoot,directory:e.quarantine,label:`Native root-move cleanup quarantine ${e.manifest.kind}`})}function dn(e,t,r=e.native.artifact_root){return{...e,native:{...e.native,artifact_root:r,pending_root_move:t}}}function _w(e){return{schema:"comet.native.transaction.v1",id:e.id,kind:"root-move",status:"prepared",projectRoot:e.paths.projectRoot,nativeRoot:e.paths.nativeRoot,createdAt:e.now.toISOString(),operations:[]}}async function zu(e){let t=dn(e.config,{...e.pending,stage:e.stage},e.activeArtifactRoot);return await Ve(e.projectRoot,t),t}async function Rr(e){let t=e.config.native.pending_root_move;if(!t||t.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let r=dn(e.config,{id:t.id,fromArtifactRoot:t.fromArtifactRoot,toArtifactRoot:t.toArtifactRoot,stage:t.stage,...e.cleanup?{cleanup:e.cleanup}:{}},e.config.native.artifact_root);return await Ve(e.projectRoot,r),r}async function Ju(e){let t=e.config,r=t.native.pending_root_move;if(!r||r.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let i=r.cleanup;if(i&&i.kind!==e.kind)throw new Error(`Native root move has unfinished ${i.kind} cleanup; cannot start ${e.kind}`);let n=await X(e.target),a=await X(e.quarantine);if(n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(!i){if(!n&&!a)return t;if(!n&&a)throw new Error(`Native root-move cleanup quarantine is not transaction-bound: ${e.kind}`);let s=await xw({paths:e.stablePaths,id:e.id,kind:e.kind,entries:await Ar(e.target,{rejectSymlinks:!0})});i={kind:e.kind,state:"prepared",manifestHash:s},t=await Rr({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:i})}let o=await Rw({paths:e.stablePaths,id:e.id,cleanup:i});if(n=await X(e.target),a=await X(e.quarantine),n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(n){if(i.state!=="prepared")throw new Error(`Native root-move cleanup target reappeared after quarantine: ${e.kind}`);await cu({root:e.projectRoot,directory:e.target,quarantine:e.quarantine,label:e.label,beforeQuarantine:e.beforeQuarantine,afterQuarantine:e.afterQuarantine}),a=!0}if(!a){if(i.state!=="deleting")throw new Error(`Native root-move cleanup quarantine disappeared: ${e.kind}`);return Rr({projectRoot:e.projectRoot,config:t,id:e.id})}return await Ro({quarantine:e.quarantine,manifest:o,exact:i.state!=="deleting"}),i.state==="prepared"&&(i={...i,state:"quarantined"},t=await Rr({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:i})),i.state==="quarantined"&&(i={...i,state:"deleting"},t=await Rr({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:i})),await Aw({projectRoot:e.projectRoot,quarantine:e.quarantine,manifest:o,hooks:e.hooks}),Rr({projectRoot:e.projectRoot,config:t,id:e.id})}async function Tw(e){let t=e.config,r=t.native.pending_root_move.stage;if(r==="copying"){if(!await X(e.sourcePaths.nativeRoot))throw new Error(`Native source root is missing: ${e.sourcePaths.nativeRoot}`);let s=kw(e.staging);t=await Ju({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"restart-staging",stablePaths:e.sourcePaths,target:e.staging,quarantine:s,label:"Native root move stale staging removal",hooks:e.hooks}),await Ar(e.sourcePaths.nativeRoot,{rejectSymlinks:!0,excludedFiles:new Set([j.resolve(e.lockFile)])}),await yw(e.sourcePaths.nativeRoot,e.staging,e.lockFile,e.destinationPaths.projectRoot),await un(e.sourcePaths.nativeRoot,e.staging,e.lockFile),t=await zu({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"ready"}),r="ready",await e.hooks?.afterRootMoveStage?.("ready",e.journal)}if(r==="ready"){if(await X(e.destinationPaths.nativeRoot)){if(await X(e.staging))throw new Error(`Native destination is occupied: ${e.destinationPaths.nativeRoot}`);await un(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile)}else{if(!await X(e.staging))throw new Error("Native move staging tree is missing");await un(e.sourcePaths.nativeRoot,e.staging,e.lockFile),await We.rename(e.staging,e.destinationPaths.nativeRoot)}t=await zu({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"switched",activeArtifactRoot:e.pending.toArtifactRoot}),r="switched",await e.hooks?.afterRootMoveStage?.("switched",e.journal)}if(r!=="switched")throw new Error(`Unsupported Native root-move stage: ${r}`);if(!await X(e.destinationPaths.nativeRoot))throw new Error(`Native destination root is missing: ${e.destinationPaths.nativeRoot}`);let i=bw(e.sourcePaths,e.pending.id);!t.native.pending_root_move?.cleanup&&await X(e.sourcePaths.nativeRoot)&&await un(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile),t=await Ju({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"forward-source",stablePaths:e.destinationPaths,target:e.sourcePaths.nativeRoot,quarantine:i,label:"Native root move source removal",beforeQuarantine:()=>e.hooks?.beforeRootMoveSourceRemove?.(e.sourcePaths.nativeRoot),afterQuarantine:s=>e.hooks?.afterRootMoveSourceQuarantined?.(s),hooks:e.hooks}),await gw(e.destinationPaths);let n=await Sr(e.destinationPaths,e.pending.id);await go(e.destinationPaths,n,"commit");let a={artifact_root:t.native.artifact_root,language:t.native.language,clarification_mode:t.native.clarification_mode,archive_confirmation:t.native.archive_confirmation,max_verify_failures:t.native.max_verify_failures,snapshot:t.native.snapshot},o={...t,native:{...a,artifact_root:e.pending.toArtifactRoot}};return await Ve(e.projectRoot,o),o}async function Ku(e){let t=await Z(e.projectRoot)??Kl("docs");if(t.native.pending_root_move)throw new Error(`Native root move ${t.native.pending_root_move.id} is already incomplete`);let r=pr(e.toArtifactRoot);if(r===t.native.artifact_root)throw new Error(`Native artifact root is already ${r}`);let i=await pe(e.projectRoot,t.native.artifact_root),n=await pe(e.projectRoot,r);if(V(i.nativeRoot,n.nativeRoot)||V(n.nativeRoot,i.nativeRoot))throw new Error("Native source and destination roots must not overlap");if(!await X(i.nativeRoot))throw new Error(`Native source root does not exist: ${i.nativeRoot}`);if(await mw(i),await X(n.nativeRoot))throw new Error(`Native destination is occupied: ${n.nativeRoot}`);let a=await vr(i,"root-move",`move root to ${r}`),o=pw(),s={id:o,fromArtifactRoot:t.native.artifact_root,toArtifactRoot:r,stage:"copying"},c=_w({id:o,paths:i,now:e.now??new Date}),l=Nw(n,o);try{if(await vw(i,a.file),await ww(i),await X(l))throw new Error(`Native move staging path is occupied: ${l}`);return await Ve(e.projectRoot,dn(t,s)),await yu(i,c),await e.hooks?.afterRootMoveStage?.("copying",c),await Tw({projectRoot:e.projectRoot,config:dn(t,s),pending:s,sourcePaths:i,destinationPaths:n,staging:l,journal:c,lockFile:a.file,hooks:e.hooks}),{fromNativeRoot:i.nativeRoot,toNativeRoot:n.nativeRoot,transactionId:o}}finally{await gr(a)}}import jr from"path";import{realpathSync as My}from"fs";var Pe={next:"NEXT:",relay:"RELAY TO USER:",detail:"DETAIL:",details:"--- machine projection (run with --json to consume it) ---"};function Yu(e){return e?e.command?`${Pe.next} ${e.command}`:e.ask_user?`${Pe.next} ${e.ask_user}`:null:null}function Xu(e,t){let r=[e.summary],i=Yu(e.next);return i&&r.push(i),e.user_message&&r.push("",Pe.relay,e.user_message),t!==void 0&&r.push("",Pe.details,JSON.stringify(t,null,2)),`${r.join(`
185
+ `)}
186
+ `}function Qu(e,t,r){let i=[e.summary],n=Yu(e.next);return n&&i.push(n),e.user_message&&i.push("",Pe.relay,e.user_message),i.push("",`${Pe.detail} ${t}`),r!==void 0&&i.push("",Pe.details,JSON.stringify(r,null,2)),i.join(`
187
+ `)}var jw=["outcome","scope","nonGoals","acceptanceExamples"],$P=[...jw,"constraints","decisions","openQuestions","verificationExpectations"];var $w=Object.freeze({maxChanges:32,maxSpecsPerChange:64,maxArtifactsPerChange:128,maxTotalSpecs:512,maxTotalArtifacts:1024,maxSignalsPerRelationship:8,maxRelationships:256,maxSerializedBytes:64*1024,maxNameBytes:128,maxCapabilityBytes:128,maxArtifactPathBytes:512});var Zu=1024*1024;var td="scoped-text-safety",Ow=1,Hw=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var Dw="comet.native.checker-policy.v1";var XP=ie(Dw,{policy:td,version:Ow,limits:Hw,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var Lw=["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"],QP=new Set(Lw);var Fw=Zu,mx=3*Fw;var rd={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:[]},qw=re("comet-native-runtime:v3:scope-reopen"),Vx=[{skillVersion:"3",skillHash:re("comet-native-runtime:v3:semantic-repair-budget")},{skillVersion:"2",skillHash:re("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:re("comet-native-runtime:v1")}];var nd=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],kR=new Set(nd),Yw=new Set([...nd,"minimum_runtime_version","revision"]),SR=new Set([...Yw,"operation"]),ER=512*1024,Xw=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),CR=new Set([...Xw,"implementationScopeHash","repairScopeHash","repairStagnation","returnToBuild"]);var _R={maxAcceptanceCriteria:Ru.maxCriteria};var OR={maxSpecs:64,maxFileBytes:rn,maxTotalBytes:4*1024*1024};import{execFile as cy}from"node:child_process";import{promisify as ly}from"node:util";var DR=["$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 UR={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var mA=512*1024;var Ir=class extends Error{recovery;constructor(t,r){super(t),this.name="NativeReceiptScopeStaleError",this.recovery=r}};var LA=64*1024;var BA=3600*1e3;var MA=ly(cy);var fn=class extends Error{details;constructor(t){let r=t.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${t.length} receipt(s)): ${t.map(i=>`${i.ref}${i.acceptanceId?`[${i.acceptanceId}]`:""} -> ${i.mismatches.join("; ")}`).join(" | ")}`;super(r),this.name="NativeVerificationReceiptBindingError",this.details=t}};var C_={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var $_=16*1024*1024,O_=256*1024,H_=16*1024;var V_=Object.freeze({maxScopeChanges:128,maxAcceptanceEntries:64,maxUnresolvedReasons:32,maxReceipts:32});var z_=16*1024;var ky=Rt(mt(),1);var G_=8*1024*1024;var hn=class extends Error{constructor(r,i,n){super(r,n);this.preparation=i;this.name="NativeWorkspacePreparationError"}preparation};var ij=nn("en");var wj=16*1024;var s$=16*1024*1024,pn=class extends Error{constructor(r,i,n,a){super(`Canonical spec conflict for ${r}: expected ${i??"(missing)"}, actual ${n??"(missing)"}`);this.capability=r;this.expectedHash=i;this.actualHash=n;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},mn=class extends Error{constructor(r,i=r.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${r.findingCodes.join(", ")}`){super(i);this.preflight=r;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};function C(e,t,r){return e==="zh-CN"?r:t}var _o={shape:{en:"Shape (agreeing on requirements)",zh:"Shape(需求共识)"},build:{en:"Build",zh:"Build(实现)"},verify:{en:"Verify",zh:"Verify(验证)"},archive:{en:"Archive",zh:"Archive(归档)"}};function cd(e,t){return typeof e=="string"&&_o[e]?C(t,_o[e].en,_o[e].zh):typeof e=="string"?e:""}function To(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return typeof t.total=="number"&&typeof t.passed=="number"&&typeof t.failed=="number"&&typeof t.blocked=="number"&&typeof t.pending=="number"}function Py(e){let t={total:e.length,passed:0,failed:0,blocked:0,pending:0};for(let r of e){if(!r||typeof r!="object")return null;let i=r.result;if(i!=="passed"&&i!=="failed"&&i!=="blocked"&&i!=="pending")return null;t[i]+=1}return t}function ld(e,t){let r=[];e.failed>0&&r.push(C(t,`${e.failed} failed`,`${e.failed} 项失败`)),e.blocked>0&&r.push(C(t,`${e.blocked} blocked`,`${e.blocked} 项受阻`)),e.pending>0&&r.push(C(t,`${e.pending} pending`,`${e.pending} 项待验`));let i=C(t,`acceptance ${e.passed}/${e.total} passed`,`验收 ${e.passed}/${e.total} 通过`);return r.length>0?`${i} (${r.join(", ")})`:i}function ud(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;if(typeof t.change!="string"||t.disposition!=="continue"&&t.disposition!=="await-user"&&t.disposition!=="blocked"&&t.disposition!=="done"||t.commandArgs!==null&&t.commandArgs!==void 0&&!Array.isArray(t.commandArgs))return!1;let r=t.userCommunication;return!!(r&&typeof r=="object"&&typeof r.required=="boolean"&&(r.message===null||typeof r.message=="string")&&typeof r.agentInstruction=="string")}function Io(e){return/[\u4e00-\u9fff]/u.test(e.userCommunication.agentInstruction)?"zh-CN":"en"}function xy(e,t,r){return e==="done"?C(r,"complete","已完成"):e==="await-user"?C(r,"waiting for a user decision","等待用户决定"):e==="blocked"?C(r,"paused: needs attention","已暂停,需要处理"):t?C(r,"waiting for a user decision","等待用户决定"):C(r,"ready to continue","可继续推进")}function Ry(e,t,r){let i=Io(e),n=[];r&&n.push(r);let a=C(i,`Change ${e.change}`,`需求 ${e.change}`),o=cd(e.phase,i),s=xy(e.disposition,e.userCommunication.required,i);n.push([a,o||null,s].filter(Boolean).join(" · ")),t&&t.total>0&&n.push(ld(t,i));let c=e.userCommunication,l=dd(e,i);return{summary:n.join("; "),...l?{next:l}:{},...c.required&&c.message?{user_message:c.message}:{}}}function dd(e,t){let r=e.userCommunication;if(e.disposition==="await-user"&&r.required)return{ask_user:C(t,"Relay the message below, wait for the user decision, then run the matching option (run with --json to see the exact alternative commands).","先转述下方信息并等待用户选择,再执行对应命令(完整候选命令以 --json 输出为准)。")};if(e.commandArgs&&e.commandArgs.length>0)return{command:e.commandArgs.join(" ")};if(e.disposition==="done")return{ask_user:C(t,"No further workflow action; report the completed change to the user.","工作流已无后续动作;向用户报告该需求已完成即可。")};if(e.disposition==="blocked")return{ask_user:C(t,"Resolve the paused condition before continuing; run with --json for the structured diagnosis.","先解除暂停原因再继续;结构化诊断信息以 --json 输出为准。")}}function Ay(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return typeof t.total=="number"&&Array.isArray(t.items)}function _y(e,t){let r=typeof e.name=="string"?e.name:"(unnamed)",i=cd(e.phase,t),n=e.status==="await-user"?C(t,"waiting for a user decision","等待用户决定"):e.status==="blocked"?C(t,"paused","已暂停"):e.status==="done"?C(t,"complete","已完成"):C(t,"in progress","进行中"),a=To(e.acceptance)?`${C(t,", ",",")}${ld(e.acceptance,t)}`:"";return` ${r} · ${i||String(e.phase??"?")} · ${n}${a}`}function Ty(e){for(let t of e){let r=t.continuation;if(r?.userCommunication&&typeof r.userCommunication.agentInstruction=="string"&&/[\u4e00-\u9fff]/u.test(r.userCommunication.agentInstruction))return"zh-CN"}return"en"}function Iy(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return typeof t.healthy!="boolean"?!1:t.findings===void 0||Array.isArray(t.findings)}function jy(e){if(e.healthy){let i=e.repaired?C("en","Diagnostics passed and the reported problem was repaired automatically.","诊断通过,报告的问题已自动修复。"):C("en","Diagnostics passed: no problems found.","诊断通过:未发现问题。"),n=$y(e.continuation);return n?{summary:i,next:n}:{summary:i}}let r=Array.isArray(e.findings)?e.findings.length:0;return{summary:C("en",r>0?`Diagnostics found ${r} problem${r===1?"":"s"} that need attention before this change can continue.`:"Diagnostics found problems that need attention before this change can continue.",r>0?`诊断发现 ${r} 个需要处理的问题,处理后该需求才能继续。`:"诊断发现需要处理的问题,处理后该需求才能继续。"),next:{ask_user:C("en","Run with --json to read the structured findings; re-run with --repair once the cause is understood.","结构化诊断以 --json 输出为准;确认原因后再用 --repair 修复。")}}}function $y(e){return ud(e)?dd(e,Io(e)):void 0}function fd(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;if(Iy(t))return jy(t);if(Ay(t)){let i=Ty(t.items);return{summary:[t.total===t.items.length?C(i,`Native changes (${t.total})`,`Native 需求列表(共 ${t.total} 条)`):C(i,`Native changes (showing ${t.items.length} of ${t.total})`,`Native 需求列表(显示 ${t.items.length}/${t.total} 条)`),...t.items.map(a=>_y(a,i))].join(`
188
+ `)}}let r=t.continuation;if(ud(r))return Ry(r,Oy(t),Hy(t,Io(r)));if(typeof t.artifactRoot=="string"&&typeof t.nativeRoot=="string"){let i=t.language==="zh-CN"?"zh-CN":"en",n="pendingRootMove"in t;return{summary:C(i,n?`Comet Native artifacts live under ${t.artifactRoot} (state root: ${t.nativeRoot}).`:`Initialized Comet Native at ${t.nativeRoot} (artifacts: ${t.artifactRoot}).`,n?`Comet Native 产物位于 ${t.artifactRoot}(状态根目录:${t.nativeRoot})。`:`Comet Native 已初始化于 ${t.nativeRoot}(产物目录:${t.artifactRoot})。`)}}}function Oy(e){if(To(e.acceptance))return e.acceptance;let t=e.state;if(t&&typeof t=="object"&&!Array.isArray(t)){let r=t;if(To(r.acceptance))return r.acceptance;if(Array.isArray(r.acceptance))return Py(r.acceptance)}return null}function Hy(e,t){if(e.selected!==void 0&&typeof e.selected=="string")return C(t,`Selected ${e.selected}.`,`已选择需求 ${e.selected}。`);let r=e.migration;return r&&typeof r=="object"&&r.completed===!0?C(t,"Upgraded this change to the current Native format.","已将该需求升级到当前 Native 格式。"):null}function hd(e){let r=e.data&&typeof e.data=="object"&&!Array.isArray(e.data)?e.data:{};switch(e.code){case"conflict":return{summary:C("en","This change was updated elsewhere while the command ran, so the command stopped without changing anything. Nothing was lost — reload the latest state and continue from there.","这条需求刚被另一个会话更新,本次命令未做任何改动。没有工作丢失——重新读取最新状态后继续即可。"),...typeof r.change=="string"?{next:{command:`comet native status ${r.change} --json`}}:{}};case"baseline-incomplete":return{summary:C("en","The safety snapshot for this change exceeded its configured size budget, so the command stopped before changing anything. Raise the snapshot limits in .comet/config.yaml or exclude out-of-scope data, then retry.","该需求的安全快照超出配置的容量预算,命令在改动任何内容前已停止。请在 .comet/config.yaml 中调高快照上限,或将范围外的数据加入排除列表后重试。"),next:{ask_user:C("en","Run with --json to see the exact limits, omitted paths, and supported fixes.","具体上限、被省略的路径和支持的修复方式以 --json 输出为准。")}};case"workspace-isolation-required":return{summary:C("en","This change runs in its own Git worktree to keep work isolated. Create the linked worktree first, then continue inside it.","这条需求需要在独立的 Git worktree 中执行以保证隔离。请先创建关联的 worktree,然后在其中继续。"),next:{ask_user:C("en","Run with --json to see the exact worktree creation command.","完整的 worktree 创建命令以 --json 输出为准。")}};case"workspace-preparation-incomplete":return{summary:C("en","The change workspace is not fully prepared (for example a branch or worktree is missing). Finish the preparation steps, then retry.","需求的工作区尚未准备完成(例如分支或 worktree 缺失)。请先完成准备步骤,再重试。"),next:{ask_user:C("en","Run with --json to see the remaining preparation steps.","剩余的准备步骤以 --json 输出为准。")}};case"implementation-scope-stale":return{summary:C("en","The recorded implementation scope no longer matches the current files. Refresh the scope, then retry.","记录的实现范围与当前文件不再一致。请刷新范围后重试。"),next:{ask_user:C("en","Run with --json to see the exact recovery steps.","具体恢复步骤以 --json 输出为准。")}};default:return}}var pd=["--project-root <path> Resolve the Native project from this working directory.","--json Emit the stable JSON command envelope.","--verbose Append the raw machine projection after the human/agent text.","--help Show help without requiring an initialized project."],$o=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.","check <change-name> Run the read-only Native verification check.","doctor [<change-name>] Diagnose, migrate, or rebuild local execution state."],options:pd,output:"A human summary plus a NEXT step by default (RELAY TO USER blocks carry user decisions); use --json for the structured envelope, --verbose to append the raw machine projection.",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, or a named details/history page.","--details Include one fixed-size page of acceptance, Spec, handoff, verification, history, workspace, and report details."],output:"A compact v2 status page or one compact Loop projection with local execution availability. Use --details and --cursor to read fixed-size detail pages; parent changes expose childSummary 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] [--coordination-mode multi-session|single-session] [--accept-result|--revise-implementation|--revise-requirements|--retry-verifier|--resolve-verifier-blocker] [--max-parallel <n>] [--expected-state-version <n>] [--expected-action <action>]
189
+ comet native next <change-name> --runner-input <json-file>`,purpose:"Confirm or recover an Agent boundary, advance parent child changes, handle Supervisor task operations, 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.","--coordination-mode multi-session|single-session Required when confirming a multi-child Supervisor Shape.","--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 or Archive to Shape when user-visible goals or acceptance criteria must change.","--retry-verifier Retry a failed or unavailable Verifier when the continuation allows it.","--resolve-verifier-blocker Resolve a semantic Verifier blocker without changing the candidate, then dispatch a new attempt.","--max-parallel <n> Supervisor task concurrency cap; defaults to 2, use 1 for serial fallback.","--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, review. review fields: status=passed, summary, reviewer_execution_ref from a separate read-only review."," 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."," Supervisor task fields: supervisor-builder-result (child, runId, candidateCommit), supervisor-builder-failure (child, runId, reason), supervisor-verifier-result (child, runId, verdict, verification data), supervisor-reconnect (child, runId), supervisor-cancel (child, runId, reason), or supervisor-integrate (child, checks)."],output:'A compact portable state summary, explicit skill-coordinated label, Runtime-owned check results, scoped verifierDispatch, bounded request-check response, continuation.runnerAction, machine-readable continuation.inputOptions, and continuation.userCommunication with a user-ready message and Agent relay guidance. Read acceptance text and other long fields from paged status --details output. Human-readable verification statuses include "Host independently verified", "Checks completed, but your confirmation is required", "Full verification was unavailable; only automatic checks completed", and "You accepted the incomplete verification result". 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]
190
+ 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 jo(e,t){return`${e}:
187
191
  ${t.map(r=>` ${r}`).join(`
188
- `)}`}function uy(e){let t=e.filter(i=>i!=="--help");if(t.length===0)return"";let r=t.slice(0,2).join(" ");return Ao[r]||t.length>1&&Ao[t[0]]?.subcommands?r:t[0]}function dy(e=[]){let t=uy(e),r=Ao[t];if(!r)throw new Error(`Unknown Native help topic: ${t}`);let i=[`Usage: ${r.usage}`,"",r.purpose];r.subcommands&&i.push("",Ro("Commands",r.subcommands));let n=t===""?r.options:[...r.options??[],...Zu];return n&&n.length>0&&i.push("",Ro("Options",n)),i.push("",`Output:
189
- ${r.output}`),r.examples&&i.push("",Ro("Examples",r.examples)),t===""&&i.push("","Run `comet native <command> --help` for command-specific details."),{topic:t,usage:`${i.join(`
192
+ `)}`}function Dy(e){let t=e.filter(i=>i!=="--help");if(t.length===0)return"";let r=t.slice(0,2).join(" ");return $o[r]||t.length>1&&$o[t[0]]?.subcommands?r:t[0]}function Ly(e=[]){let t=Dy(e),r=$o[t];if(!r)throw new Error(`Unknown Native help topic: ${t}`);let i=[`Usage: ${r.usage}`,"",r.purpose];r.subcommands&&i.push("",jo("Commands",r.subcommands));let n=t===""?r.options:[...r.options??[],...pd];return n&&n.length>0&&i.push("",jo("Options",n)),i.push("",`Output:
193
+ ${r.output}`),r.examples&&i.push("",jo("Examples",r.examples)),t===""&&i.push("","Run `comet native <command> --help` for command-specific details."),{topic:t,usage:`${i.join(`
190
194
  `)}
191
- `}}var fy=dy().usage;var Wj=10*1024*1024,we=class extends Error{};function td(e,t){let r=e.flatMap((i,n)=>i===t?[n]:[]);if(r.length>1)throw new we(`${t} may only be provided once`);return r.length===0?!1:(e.splice(r[0],1),!0)}function rd(e,t){let r=e.flatMap((a,o)=>a===t?[o]:[]);if(r.length>1)throw new we(`${t} may only be provided once`);if(r.length===0)return;let i=r[0],n=e[i+1];if(n===void 0||n.startsWith("--"))throw new we(`${t} requires a value`);return e.splice(i,2),n}function To(e){if(e.length>0)throw new we(`Unexpected argument: ${e[0]}`)}function Io(e,t){let r=e.shift();if(!r||r.startsWith("--"))throw new we(`${t} is required`);return r}function _o(e,t){let r=Tr.normalize(ed(e)),i=Tr.normalize(ed(t));return process.platform==="win32"?r.toLowerCase()===i.toLowerCase():r===i}function ed(e){let t=Tr.resolve(e);try{return hy.native(t)}catch{return t}}function py(e){let t=Tr.resolve(e),r=ve(process.cwd());if(!r.isSecondaryWorktree||r.currentWorktreeRoot===null||r.primaryWorktreeRoot===null)return t;let i=ve(t);return!i.isGitWorktree||i.currentWorktreeRoot===null||i.primaryWorktreeRoot===null||!_o(r.primaryWorktreeRoot,i.primaryWorktreeRoot)||_o(r.currentWorktreeRoot,i.currentWorktreeRoot)?t:_o(process.cwd(),r.currentWorktreeRoot)?Tr.resolve(process.cwd()):r.currentWorktreeRoot}async function id(e){return e?py(e):ao(process.cwd())}function jo(e,t,r){return{command:e,exitCode:0,data:t,text:r??JSON.stringify(t,null,2)+`
192
- `}}function nd(e,t){if(t instanceof we)return{command:e,exitCode:64,error:{code:"usage",message:t.message}};if(t instanceof ln)return{command:e,exitCode:73,data:{capability:t.capability,expectedHash:t.expectedHash,actualHash:t.actualHash,canonicalPath:t.canonicalPath},error:{code:"conflict",message:t.message}};if(t instanceof un)return{command:e,exitCode:73,data:t.preflight,error:{code:"conflict",message:t.message}};if(t instanceof Zi)return{command:e,exitCode:73,data:{change:t.change,expectedRevision:t.expectedRevision,actualRevision:t.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:t.message}};if(t instanceof Er)return{command:e,exitCode:73,data:{requestedIsolation:t.requestedIsolation,activeChanges:t.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:t.message}};if(t instanceof cn)return{command:e,exitCode:73,data:{preparation:t.preparation},error:{code:"workspace-preparation-incomplete",message:t.message}};if(t instanceof en)return{command:e,exitCode:65,data:{change:t.change,complete:!1,omittedCount:t.omittedCount,omittedByReason:t.omittedByReason,samplePaths:t.samplePaths,sampleTruncated:t.sampleTruncated,effectiveLimits:t.effectiveLimits,policyHash:t.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:t.message}};if(t instanceof sn)return{command:e,exitCode:65,data:{receiptBindingFailures:t.details},error:{code:"invalid-data",message:t.message}};if(t instanceof _r)return{command:e,exitCode:65,data:t.recovery,error:{code:"implementation-scope-stale",message:t.message}};if(t instanceof Error){let r=t.code;if(r&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(r))return{command:e,exitCode:70,error:{code:"internal",message:t.message}};let i=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(t.message);return{command:e,exitCode:i?73:65,error:{code:i?"conflict":"invalid-data",message:t.message}}}return{command:e,exitCode:70,error:{code:"internal",message:String(t)}}}function ad(e,t){return t?{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
193
- `}:e.error?{exitCode:e.exitCode,stderr:e.error.message}:{exitCode:e.exitCode,stdout:e.text}}async function od(e,t){let r=Io(e,"root subcommand");if(r==="show"){To(e);let i=await Q(t);if(!i)throw new Error(".comet/config.yaml was not found");let n=await he(t,i.native.artifact_root);return jo("root show",{projectRoot:t,artifactRoot:i.native.artifact_root,language:i.native.language,nativeRoot:n.nativeRoot,pendingRootMove:i.native.pending_root_move??null})}if(r==="move"){let i=Io(e,"artifact root");To(e);let n=await qu({projectRoot:t,toArtifactRoot:i});return jo("root move",n,`Moved Comet Native to ${n.toNativeRoot}
194
- `)}throw new we(`Unknown root command: ${r}`)}function my(e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
195
- `}}async function sd(e,t,r=process.argv.slice(2)){let i=r.indexOf("--"),n=i<0?[...r]:r.slice(0,i),a=i<0?[]:r.slice(i),o=n.includes("--json"),s,c;try{td(n,"--json"),s=rd(n,"--project-root");let u=[...n,...a],d=await id(s);c=await t(u,d)}catch(u){c=nd(e,u)}let l=o?my(c):ad(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
195
+ `}}var By=Ly().usage;var x$=10*1024*1024,ye=class extends Error{};function Ho(e,t){let r=e.flatMap((i,n)=>i===t?[n]:[]);if(r.length>1)throw new ye(`${t} may only be provided once`);return r.length===0?!1:(e.splice(r[0],1),!0)}function vd(e,t){let r=e.flatMap((a,o)=>a===t?[o]:[]);if(r.length>1)throw new ye(`${t} may only be provided once`);if(r.length===0)return;let i=r[0],n=e[i+1];if(n===void 0||n.startsWith("--"))throw new ye(`${t} requires a value`);return e.splice(i,2),n}function Do(e){if(e.length>0)throw new ye(`Unexpected argument: ${e[0]}`)}function Lo(e,t){let r=e.shift();if(!r||r.startsWith("--"))throw new ye(`${t} is required`);return r}function Oo(e,t){let r=jr.normalize(md(e)),i=jr.normalize(md(t));return process.platform==="win32"?r.toLowerCase()===i.toLowerCase():r===i}function md(e){let t=jr.resolve(e);try{return My.native(t)}catch{return t}}function Fy(e){let t=jr.resolve(e),r=ge(process.cwd());if(!r.isSecondaryWorktree||r.currentWorktreeRoot===null||r.primaryWorktreeRoot===null)return t;let i=ge(t);return!i.isGitWorktree||i.currentWorktreeRoot===null||i.primaryWorktreeRoot===null||!Oo(r.primaryWorktreeRoot,i.primaryWorktreeRoot)||Oo(r.currentWorktreeRoot,i.currentWorktreeRoot)?t:Oo(process.cwd(),r.currentWorktreeRoot)?jr.resolve(process.cwd()):r.currentWorktreeRoot}async function gd(e){return e?Fy(e):co(process.cwd())}function wd(e){return JSON.stringify(e,null,2)+`
196
+ `}function Bo(e,t,r){return{command:e,exitCode:0,data:t,text:r??wd(t)}}function Vy(e,t){if(t instanceof ye)return{command:e,exitCode:64,error:{code:"usage",message:t.message}};if(t instanceof pn)return{command:e,exitCode:73,data:{capability:t.capability,expectedHash:t.expectedHash,actualHash:t.actualHash,canonicalPath:t.canonicalPath},error:{code:"conflict",message:t.message}};if(t instanceof mn)return{command:e,exitCode:73,data:t.preflight,error:{code:"conflict",message:t.message}};if(t instanceof an)return{command:e,exitCode:73,data:{change:t.change,expectedRevision:t.expectedRevision,actualRevision:t.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:t.message}};if(t instanceof Pr)return{command:e,exitCode:73,data:{requestedIsolation:t.requestedIsolation,activeChanges:t.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:t.message}};if(t instanceof hn)return{command:e,exitCode:73,data:{preparation:t.preparation},error:{code:"workspace-preparation-incomplete",message:t.message}};if(t instanceof on)return{command:e,exitCode:65,data:{change:t.change,complete:!1,omittedCount:t.omittedCount,omittedByReason:t.omittedByReason,samplePaths:t.samplePaths,sampleTruncated:t.sampleTruncated,effectiveLimits:t.effectiveLimits,policyHash:t.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:t.message}};if(t instanceof fn)return{command:e,exitCode:65,data:{receiptBindingFailures:t.details},error:{code:"invalid-data",message:t.message}};if(t instanceof Ir)return{command:e,exitCode:65,data:t.recovery,error:{code:"implementation-scope-stale",message:t.message}};if(t instanceof Error){let r=t.code;if(r&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(r))return{command:e,exitCode:70,error:{code:"internal",message:t.message}};let i=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(t.message);return{command:e,exitCode:i?73:65,error:{code:i?"conflict":"invalid-data",message:t.message}}}return{command:e,exitCode:70,error:{code:"internal",message:String(t)}}}function yd(e,t){let r=Vy(e,t),i=r.error;if(!i)return r;let n=hd({code:i.code,message:i.message,data:r.data});return n?{...r,envelope:n}:r}function Nd(e,t,r=!1){let i=e.envelope??fd(e.data);return t?{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...i===void 0?{}:{summary:i.summary,...i.next===void 0?{}:{next:i.next},...i.user_message===void 0?{}:{user_message:i.user_message}},...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
197
+ `}:e.error?{exitCode:e.exitCode,stderr:i?Qu(i,e.error.message,r?e.data:void 0):e.error.message}:i?{exitCode:e.exitCode,stdout:Xu(i,r?e.data:void 0)}:r&&e.text!==void 0&&e.data!==void 0&&e.text!==wd(e.data)?{exitCode:e.exitCode,stdout:`${e.text}
198
+ ${Pe.details}
199
+ ${JSON.stringify(e.data,null,2)}
200
+ `}:{exitCode:e.exitCode,stdout:e.text}}async function bd(e,t){let r=Lo(e,"root subcommand");if(r==="show"){Do(e);let i=await Z(t);if(!i)throw new Error(".comet/config.yaml was not found");let n=await pe(t,i.native.artifact_root);return Bo("root show",{projectRoot:t,artifactRoot:i.native.artifact_root,language:i.native.language,nativeRoot:n.nativeRoot,pendingRootMove:i.native.pending_root_move??null})}if(r==="move"){let i=Lo(e,"artifact root");Do(e);let n=await Ku({projectRoot:t,toArtifactRoot:i});return Bo("root move",n,`Moved Comet Native to ${n.toNativeRoot}
201
+ `)}throw new ye(`Unknown root command: ${r}`)}async function kd(e,t,r=process.argv.slice(2)){let i=r.indexOf("--"),n=i<0?[...r]:r.slice(0,i),a=i<0?[]:r.slice(i),o=n.includes("--json"),s=n.includes("--verbose"),c,l;try{Ho(n,"--json"),Ho(n,"--verbose"),c=vd(n,"--project-root");let d=[...n,...a],f=await gd(c);l=await t(d,f)}catch(d){l=yd(e,d)}let u=Nd(l,o,s);return u.stdout&&process.stdout.write(u.stdout),u.stderr&&process.stderr.write(u.stderr+(u.stderr.endsWith(`
196
202
  `)?"":`
197
- `)),l.exitCode}process.exitCode=await sd("root",od);
203
+ `)),u.exitCode}process.exitCode=await kd("root",bd);