copperflow 0.0.0-stage → 0.3.0

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 (767) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +265 -2
  4. package/dist/app/THIRD_PARTY_LICENSES.txt +118 -0
  5. package/dist/app/assets/NewPartDialog-Qb7NwhBb.js +160 -0
  6. package/dist/app/assets/index-CSWIIMFE.css +1 -0
  7. package/dist/app/assets/index-C_TXwo-N.js +19 -0
  8. package/dist/app/index.html +15 -0
  9. package/dist/app/theme-boot.js +3 -0
  10. package/dist/cli-commands.d.ts +14 -0
  11. package/dist/cli-commands.js +285 -0
  12. package/dist/cli-commands.js.map +1 -0
  13. package/dist/cli.d.ts +2 -0
  14. package/dist/cli.js +24 -0
  15. package/dist/cli.js.map +1 -0
  16. package/dist/core/analyze.d.ts +29 -0
  17. package/dist/core/analyze.js +284 -0
  18. package/dist/core/analyze.js.map +1 -0
  19. package/dist/core/annotations.d.ts +77 -0
  20. package/dist/core/annotations.js +138 -0
  21. package/dist/core/annotations.js.map +1 -0
  22. package/dist/core/board-edits.d.ts +8 -0
  23. package/dist/core/board-edits.js +56 -0
  24. package/dist/core/board-edits.js.map +1 -0
  25. package/dist/core/board-items.d.ts +40 -0
  26. package/dist/core/board-items.js +95 -0
  27. package/dist/core/board-items.js.map +1 -0
  28. package/dist/core/bom.d.ts +35 -0
  29. package/dist/core/bom.js +146 -0
  30. package/dist/core/bom.js.map +1 -0
  31. package/dist/core/check.d.ts +42 -0
  32. package/dist/core/check.js +91 -0
  33. package/dist/core/check.js.map +1 -0
  34. package/dist/core/checks-line.d.ts +7 -0
  35. package/dist/core/checks-line.js +8 -0
  36. package/dist/core/checks-line.js.map +1 -0
  37. package/dist/core/connection-names.d.ts +2 -0
  38. package/dist/core/connection-names.js +16 -0
  39. package/dist/core/connection-names.js.map +1 -0
  40. package/dist/core/design-source.d.ts +6 -0
  41. package/dist/core/design-source.js +14 -0
  42. package/dist/core/design-source.js.map +1 -0
  43. package/dist/core/drawing-edits.d.ts +19 -0
  44. package/dist/core/drawing-edits.js +158 -0
  45. package/dist/core/drawing-edits.js.map +1 -0
  46. package/dist/core/drawing-identity.d.ts +12 -0
  47. package/dist/core/drawing-identity.js +32 -0
  48. package/dist/core/drawing-identity.js.map +1 -0
  49. package/dist/core/drawing-names.d.ts +10 -0
  50. package/dist/core/drawing-names.js +30 -0
  51. package/dist/core/drawing-names.js.map +1 -0
  52. package/dist/core/drawing-scan.d.ts +41 -0
  53. package/dist/core/drawing-scan.js +82 -0
  54. package/dist/core/drawing-scan.js.map +1 -0
  55. package/dist/core/edit-error.d.ts +5 -0
  56. package/dist/core/edit-error.js +9 -0
  57. package/dist/core/edit-error.js.map +1 -0
  58. package/dist/core/edit-text.d.ts +28 -0
  59. package/dist/core/edit-text.js +89 -0
  60. package/dist/core/edit-text.js.map +1 -0
  61. package/dist/core/edit.d.ts +13 -0
  62. package/dist/core/edit.js +341 -0
  63. package/dist/core/edit.js.map +1 -0
  64. package/dist/core/fabrication.d.ts +39 -0
  65. package/dist/core/fabrication.js +94 -0
  66. package/dist/core/fabrication.js.map +1 -0
  67. package/dist/core/file-writes.d.ts +18 -0
  68. package/dist/core/file-writes.js +81 -0
  69. package/dist/core/file-writes.js.map +1 -0
  70. package/dist/core/fs-utils.d.ts +13 -0
  71. package/dist/core/fs-utils.js +51 -0
  72. package/dist/core/fs-utils.js.map +1 -0
  73. package/dist/core/history.d.ts +80 -0
  74. package/dist/core/history.js +161 -0
  75. package/dist/core/history.js.map +1 -0
  76. package/dist/core/index.d.ts +21 -0
  77. package/dist/core/index.js +22 -0
  78. package/dist/core/index.js.map +1 -0
  79. package/dist/core/instance-edits.d.ts +15 -0
  80. package/dist/core/instance-edits.js +69 -0
  81. package/dist/core/instance-edits.js.map +1 -0
  82. package/dist/core/instance-locks.d.ts +10 -0
  83. package/dist/core/instance-locks.js +16 -0
  84. package/dist/core/instance-locks.js.map +1 -0
  85. package/dist/core/instance-requests.d.ts +45 -0
  86. package/dist/core/instance-requests.js +93 -0
  87. package/dist/core/instance-requests.js.map +1 -0
  88. package/dist/core/layout-edits.d.ts +51 -0
  89. package/dist/core/layout-edits.js +82 -0
  90. package/dist/core/layout-edits.js.map +1 -0
  91. package/dist/core/layout-file.d.ts +80 -0
  92. package/dist/core/layout-file.js +209 -0
  93. package/dist/core/layout-file.js.map +1 -0
  94. package/dist/core/layout-locks.d.ts +38 -0
  95. package/dist/core/layout-locks.js +39 -0
  96. package/dist/core/layout-locks.js.map +1 -0
  97. package/dist/core/layout-records.d.ts +72 -0
  98. package/dist/core/layout-records.js +146 -0
  99. package/dist/core/layout-records.js.map +1 -0
  100. package/dist/core/library.d.ts +128 -0
  101. package/dist/core/library.js +378 -0
  102. package/dist/core/library.js.map +1 -0
  103. package/dist/core/literals.d.ts +19 -0
  104. package/dist/core/literals.js +106 -0
  105. package/dist/core/literals.js.map +1 -0
  106. package/dist/core/make-sheet.d.ts +44 -0
  107. package/dist/core/make-sheet.js +130 -0
  108. package/dist/core/make-sheet.js.map +1 -0
  109. package/dist/core/netlist.d.ts +41 -0
  110. package/dist/core/netlist.js +147 -0
  111. package/dist/core/netlist.js.map +1 -0
  112. package/dist/core/new-circuit-sheets.d.ts +35 -0
  113. package/dist/core/new-circuit-sheets.js +146 -0
  114. package/dist/core/new-circuit-sheets.js.map +1 -0
  115. package/dist/core/new-circuit.d.ts +65 -0
  116. package/dist/core/new-circuit.js +83 -0
  117. package/dist/core/new-circuit.js.map +1 -0
  118. package/dist/core/page-edits.d.ts +25 -0
  119. package/dist/core/page-edits.js +180 -0
  120. package/dist/core/page-edits.js.map +1 -0
  121. package/dist/core/pin-types.d.ts +8 -0
  122. package/dist/core/pin-types.js +10 -0
  123. package/dist/core/pin-types.js.map +1 -0
  124. package/dist/core/place.d.ts +30 -0
  125. package/dist/core/place.js +77 -0
  126. package/dist/core/place.js.map +1 -0
  127. package/dist/core/placement-write.d.ts +56 -0
  128. package/dist/core/placement-write.js +222 -0
  129. package/dist/core/placement-write.js.map +1 -0
  130. package/dist/core/pour-edits.d.ts +20 -0
  131. package/dist/core/pour-edits.js +241 -0
  132. package/dist/core/pour-edits.js.map +1 -0
  133. package/dist/core/project-text.d.ts +15 -0
  134. package/dist/core/project-text.js +58 -0
  135. package/dist/core/project-text.js.map +1 -0
  136. package/dist/core/project.d.ts +23 -0
  137. package/dist/core/project.js +63 -0
  138. package/dist/core/project.js.map +1 -0
  139. package/dist/core/rename-designators.d.ts +23 -0
  140. package/dist/core/rename-designators.js +83 -0
  141. package/dist/core/rename-designators.js.map +1 -0
  142. package/dist/core/rename-parts.d.ts +12 -0
  143. package/dist/core/rename-parts.js +129 -0
  144. package/dist/core/rename-parts.js.map +1 -0
  145. package/dist/core/rules-edit.d.ts +7 -0
  146. package/dist/core/rules-edit.js +56 -0
  147. package/dist/core/rules-edit.js.map +1 -0
  148. package/dist/core/selectors.d.ts +11 -0
  149. package/dist/core/selectors.js +33 -0
  150. package/dist/core/selectors.js.map +1 -0
  151. package/dist/core/sheet-cut-layout.d.ts +13 -0
  152. package/dist/core/sheet-cut-layout.js +62 -0
  153. package/dist/core/sheet-cut-layout.js.map +1 -0
  154. package/dist/core/sheet-cut-text.d.ts +23 -0
  155. package/dist/core/sheet-cut-text.js +129 -0
  156. package/dist/core/sheet-cut-text.js.map +1 -0
  157. package/dist/core/sheet-cut.d.ts +55 -0
  158. package/dist/core/sheet-cut.js +204 -0
  159. package/dist/core/sheet-cut.js.map +1 -0
  160. package/dist/core/sheet-edits.d.ts +12 -0
  161. package/dist/core/sheet-edits.js +107 -0
  162. package/dist/core/sheet-edits.js.map +1 -0
  163. package/dist/core/sheet-files.d.ts +31 -0
  164. package/dist/core/sheet-files.js +134 -0
  165. package/dist/core/sheet-files.js.map +1 -0
  166. package/dist/core/sheet-layout.d.ts +27 -0
  167. package/dist/core/sheet-layout.js +60 -0
  168. package/dist/core/sheet-layout.js.map +1 -0
  169. package/dist/core/summary.d.ts +10 -0
  170. package/dist/core/summary.js +79 -0
  171. package/dist/core/summary.js.map +1 -0
  172. package/dist/core/track-split.d.ts +22 -0
  173. package/dist/core/track-split.js +24 -0
  174. package/dist/core/track-split.js.map +1 -0
  175. package/dist/core/types.d.ts +309 -0
  176. package/dist/core/types.js +2 -0
  177. package/dist/core/types.js.map +1 -0
  178. package/dist/core/unroute.d.ts +56 -0
  179. package/dist/core/unroute.js +87 -0
  180. package/dist/core/unroute.js.map +1 -0
  181. package/dist/core/workspace.d.ts +94 -0
  182. package/dist/core/workspace.js +376 -0
  183. package/dist/core/workspace.js.map +1 -0
  184. package/dist/engine/autoplace.d.ts +18 -0
  185. package/dist/engine/autoplace.js +68 -0
  186. package/dist/engine/autoplace.js.map +1 -0
  187. package/dist/engine/board.d.ts +12 -0
  188. package/dist/engine/board.js +60 -0
  189. package/dist/engine/board.js.map +1 -0
  190. package/dist/engine/checks/copper-clearance.d.ts +7 -0
  191. package/dist/engine/checks/copper-clearance.js +116 -0
  192. package/dist/engine/checks/copper-clearance.js.map +1 -0
  193. package/dist/engine/checks/copper-notes.d.ts +11 -0
  194. package/dist/engine/checks/copper-notes.js +17 -0
  195. package/dist/engine/checks/copper-notes.js.map +1 -0
  196. package/dist/engine/checks/copper-pieces.d.ts +26 -0
  197. package/dist/engine/checks/copper-pieces.js +42 -0
  198. package/dist/engine/checks/copper-pieces.js.map +1 -0
  199. package/dist/engine/checks/copper-violation.d.ts +9 -0
  200. package/dist/engine/checks/copper-violation.js +11 -0
  201. package/dist/engine/checks/copper-violation.js.map +1 -0
  202. package/dist/engine/checks/drc-copper.d.ts +14 -0
  203. package/dist/engine/checks/drc-copper.js +139 -0
  204. package/dist/engine/checks/drc-copper.js.map +1 -0
  205. package/dist/engine/checks/drc-pads.d.ts +8 -0
  206. package/dist/engine/checks/drc-pads.js +172 -0
  207. package/dist/engine/checks/drc-pads.js.map +1 -0
  208. package/dist/engine/checks/drc-parts.d.ts +5 -0
  209. package/dist/engine/checks/drc-parts.js +208 -0
  210. package/dist/engine/checks/drc-parts.js.map +1 -0
  211. package/dist/engine/checks/drc-pours.d.ts +6 -0
  212. package/dist/engine/checks/drc-pours.js +240 -0
  213. package/dist/engine/checks/drc-pours.js.map +1 -0
  214. package/dist/engine/checks/erc.d.ts +6 -0
  215. package/dist/engine/checks/erc.js +94 -0
  216. package/dist/engine/checks/erc.js.map +1 -0
  217. package/dist/engine/checks/fillet-guard.d.ts +29 -0
  218. package/dist/engine/checks/fillet-guard.js +75 -0
  219. package/dist/engine/checks/fillet-guard.js.map +1 -0
  220. package/dist/engine/checks/geometry.d.ts +25 -0
  221. package/dist/engine/checks/geometry.js +182 -0
  222. package/dist/engine/checks/geometry.js.map +1 -0
  223. package/dist/engine/checks/grid-index.d.ts +24 -0
  224. package/dist/engine/checks/grid-index.js +57 -0
  225. package/dist/engine/checks/grid-index.js.map +1 -0
  226. package/dist/engine/checks/index.d.ts +16 -0
  227. package/dist/engine/checks/index.js +55 -0
  228. package/dist/engine/checks/index.js.map +1 -0
  229. package/dist/engine/checks/limits.d.ts +7 -0
  230. package/dist/engine/checks/limits.js +10 -0
  231. package/dist/engine/checks/limits.js.map +1 -0
  232. package/dist/engine/checks/unplaced-parts.d.ts +4 -0
  233. package/dist/engine/checks/unplaced-parts.js +29 -0
  234. package/dist/engine/checks/unplaced-parts.js.map +1 -0
  235. package/dist/engine/checks/violation.d.ts +14 -0
  236. package/dist/engine/checks/violation.js +7 -0
  237. package/dist/engine/checks/violation.js.map +1 -0
  238. package/dist/engine/component.d.ts +34 -0
  239. package/dist/engine/component.js +125 -0
  240. package/dist/engine/component.js.map +1 -0
  241. package/dist/engine/copper.d.ts +63 -0
  242. package/dist/engine/copper.js +276 -0
  243. package/dist/engine/copper.js.map +1 -0
  244. package/dist/engine/design.d.ts +21 -0
  245. package/dist/engine/design.js +63 -0
  246. package/dist/engine/design.js.map +1 -0
  247. package/dist/engine/diagnostics.d.ts +2 -0
  248. package/dist/engine/diagnostics.js +6 -0
  249. package/dist/engine/diagnostics.js.map +1 -0
  250. package/dist/engine/drawing-ids.d.ts +23 -0
  251. package/dist/engine/drawing-ids.js +45 -0
  252. package/dist/engine/drawing-ids.js.map +1 -0
  253. package/dist/engine/drawing-kinds.d.ts +18 -0
  254. package/dist/engine/drawing-kinds.js +102 -0
  255. package/dist/engine/drawing-kinds.js.map +1 -0
  256. package/dist/engine/drawing-reader.d.ts +42 -0
  257. package/dist/engine/drawing-reader.js +97 -0
  258. package/dist/engine/drawing-reader.js.map +1 -0
  259. package/dist/engine/drawings.d.ts +35 -0
  260. package/dist/engine/drawings.js +94 -0
  261. package/dist/engine/drawings.js.map +1 -0
  262. package/dist/engine/elaborate.d.ts +8 -0
  263. package/dist/engine/elaborate.js +490 -0
  264. package/dist/engine/elaborate.js.map +1 -0
  265. package/dist/engine/engine-worker.d.ts +1 -0
  266. package/dist/engine/engine-worker.js +17 -0
  267. package/dist/engine/engine-worker.js.map +1 -0
  268. package/dist/engine/engine.d.ts +41 -0
  269. package/dist/engine/engine.js +95 -0
  270. package/dist/engine/engine.js.map +1 -0
  271. package/dist/engine/evaluate.d.ts +10 -0
  272. package/dist/engine/evaluate.js +125 -0
  273. package/dist/engine/evaluate.js.map +1 -0
  274. package/dist/engine/fab/bom-csv.d.ts +5 -0
  275. package/dist/engine/fab/bom-csv.js +16 -0
  276. package/dist/engine/fab/bom-csv.js.map +1 -0
  277. package/dist/engine/fab/csv.d.ts +4 -0
  278. package/dist/engine/fab/csv.js +11 -0
  279. package/dist/engine/fab/csv.js.map +1 -0
  280. package/dist/engine/fab/designators.d.ts +42 -0
  281. package/dist/engine/fab/designators.js +109 -0
  282. package/dist/engine/fab/designators.js.map +1 -0
  283. package/dist/engine/fab/excellon.d.ts +23 -0
  284. package/dist/engine/fab/excellon.js +82 -0
  285. package/dist/engine/fab/excellon.js.map +1 -0
  286. package/dist/engine/fab/export.d.ts +33 -0
  287. package/dist/engine/fab/export.js +105 -0
  288. package/dist/engine/fab/export.js.map +1 -0
  289. package/dist/engine/fab/gerber.d.ts +53 -0
  290. package/dist/engine/fab/gerber.js +151 -0
  291. package/dist/engine/fab/gerber.js.map +1 -0
  292. package/dist/engine/fab/layers.d.ts +26 -0
  293. package/dist/engine/fab/layers.js +162 -0
  294. package/dist/engine/fab/layers.js.map +1 -0
  295. package/dist/engine/fab/names.d.ts +20 -0
  296. package/dist/engine/fab/names.js +58 -0
  297. package/dist/engine/fab/names.js.map +1 -0
  298. package/dist/engine/fab/pick-and-place.d.ts +5 -0
  299. package/dist/engine/fab/pick-and-place.js +36 -0
  300. package/dist/engine/fab/pick-and-place.js.map +1 -0
  301. package/dist/engine/fab/stroke-font.d.ts +8 -0
  302. package/dist/engine/fab/stroke-font.js +83 -0
  303. package/dist/engine/fab/stroke-font.js.map +1 -0
  304. package/dist/engine/fab/zip.d.ts +14 -0
  305. package/dist/engine/fab/zip.js +93 -0
  306. package/dist/engine/fab/zip.js.map +1 -0
  307. package/dist/engine/fillet-plan.d.ts +39 -0
  308. package/dist/engine/fillet-plan.js +87 -0
  309. package/dist/engine/fillet-plan.js.map +1 -0
  310. package/dist/engine/fillet.d.ts +54 -0
  311. package/dist/engine/fillet.js +175 -0
  312. package/dist/engine/fillet.js.map +1 -0
  313. package/dist/engine/footprints/bga.d.ts +14 -0
  314. package/dist/engine/footprints/bga.js +122 -0
  315. package/dist/engine/footprints/bga.js.map +1 -0
  316. package/dist/engine/footprints/chip.d.ts +3 -0
  317. package/dist/engine/footprints/chip.js +52 -0
  318. package/dist/engine/footprints/chip.js.map +1 -0
  319. package/dist/engine/footprints/crystal.d.ts +4 -0
  320. package/dist/engine/footprints/crystal.js +47 -0
  321. package/dist/engine/footprints/crystal.js.map +1 -0
  322. package/dist/engine/footprints/dfn.d.ts +13 -0
  323. package/dist/engine/footprints/dfn.js +52 -0
  324. package/dist/engine/footprints/dfn.js.map +1 -0
  325. package/dist/engine/footprints/dip.d.ts +8 -0
  326. package/dist/engine/footprints/dip.js +65 -0
  327. package/dist/engine/footprints/dip.js.map +1 -0
  328. package/dist/engine/footprints/dual.d.ts +14 -0
  329. package/dist/engine/footprints/dual.js +171 -0
  330. package/dist/engine/footprints/dual.js.map +1 -0
  331. package/dist/engine/footprints/exposed.d.ts +27 -0
  332. package/dist/engine/footprints/exposed.js +50 -0
  333. package/dist/engine/footprints/exposed.js.map +1 -0
  334. package/dist/engine/footprints/file.d.ts +65 -0
  335. package/dist/engine/footprints/file.js +141 -0
  336. package/dist/engine/footprints/file.js.map +1 -0
  337. package/dist/engine/footprints/ic.d.ts +34 -0
  338. package/dist/engine/footprints/ic.js +31 -0
  339. package/dist/engine/footprints/ic.js.map +1 -0
  340. package/dist/engine/footprints/index.d.ts +17 -0
  341. package/dist/engine/footprints/index.js +104 -0
  342. package/dist/engine/footprints/index.js.map +1 -0
  343. package/dist/engine/footprints/ipc7251.d.ts +30 -0
  344. package/dist/engine/footprints/ipc7251.js +44 -0
  345. package/dist/engine/footprints/ipc7251.js.map +1 -0
  346. package/dist/engine/footprints/ipc7351.d.ts +179 -0
  347. package/dist/engine/footprints/ipc7351.js +194 -0
  348. package/dist/engine/footprints/ipc7351.js.map +1 -0
  349. package/dist/engine/footprints/jedec.d.ts +24 -0
  350. package/dist/engine/footprints/jedec.js +148 -0
  351. package/dist/engine/footprints/jedec.js.map +1 -0
  352. package/dist/engine/footprints/known.d.ts +6 -0
  353. package/dist/engine/footprints/known.js +76 -0
  354. package/dist/engine/footprints/known.js.map +1 -0
  355. package/dist/engine/footprints/molded.d.ts +8 -0
  356. package/dist/engine/footprints/molded.js +76 -0
  357. package/dist/engine/footprints/molded.js.map +1 -0
  358. package/dist/engine/footprints/outline.d.ts +64 -0
  359. package/dist/engine/footprints/outline.js +187 -0
  360. package/dist/engine/footprints/outline.js.map +1 -0
  361. package/dist/engine/footprints/parse.d.ts +32 -0
  362. package/dist/engine/footprints/parse.js +68 -0
  363. package/dist/engine/footprints/parse.js.map +1 -0
  364. package/dist/engine/footprints/pinrow.d.ts +11 -0
  365. package/dist/engine/footprints/pinrow.js +102 -0
  366. package/dist/engine/footprints/pinrow.js.map +1 -0
  367. package/dist/engine/footprints/quad.d.ts +7 -0
  368. package/dist/engine/footprints/quad.js +135 -0
  369. package/dist/engine/footprints/quad.js.map +1 -0
  370. package/dist/engine/footprints/radial.d.ts +7 -0
  371. package/dist/engine/footprints/radial.js +62 -0
  372. package/dist/engine/footprints/radial.js.map +1 -0
  373. package/dist/engine/footprints/sod.d.ts +8 -0
  374. package/dist/engine/footprints/sod.js +60 -0
  375. package/dist/engine/footprints/sod.js.map +1 -0
  376. package/dist/engine/footprints/sot.d.ts +4 -0
  377. package/dist/engine/footprints/sot.js +72 -0
  378. package/dist/engine/footprints/sot.js.map +1 -0
  379. package/dist/engine/footprints/sotpower.d.ts +4 -0
  380. package/dist/engine/footprints/sotpower.js +98 -0
  381. package/dist/engine/footprints/sotpower.js.map +1 -0
  382. package/dist/engine/footprints/to220.d.ts +4 -0
  383. package/dist/engine/footprints/to220.js +49 -0
  384. package/dist/engine/footprints/to220.js.map +1 -0
  385. package/dist/engine/footprints/to92.d.ts +4 -0
  386. package/dist/engine/footprints/to92.js +43 -0
  387. package/dist/engine/footprints/to92.js.map +1 -0
  388. package/dist/engine/footprints/types.d.ts +50 -0
  389. package/dist/engine/footprints/types.js +3 -0
  390. package/dist/engine/footprints/types.js.map +1 -0
  391. package/dist/engine/hole.d.ts +15 -0
  392. package/dist/engine/hole.js +28 -0
  393. package/dist/engine/hole.js.map +1 -0
  394. package/dist/engine/index.d.ts +6 -0
  395. package/dist/engine/index.js +6 -0
  396. package/dist/engine/index.js.map +1 -0
  397. package/dist/engine/instance-anchor.d.ts +16 -0
  398. package/dist/engine/instance-anchor.js +45 -0
  399. package/dist/engine/instance-anchor.js.map +1 -0
  400. package/dist/engine/jsx-runtime.d.ts +26 -0
  401. package/dist/engine/jsx-runtime.js +49 -0
  402. package/dist/engine/jsx-runtime.js.map +1 -0
  403. package/dist/engine/keepout.d.ts +9 -0
  404. package/dist/engine/keepout.js +50 -0
  405. package/dist/engine/keepout.js.map +1 -0
  406. package/dist/engine/kinds.d.ts +34 -0
  407. package/dist/engine/kinds.js +134 -0
  408. package/dist/engine/kinds.js.map +1 -0
  409. package/dist/engine/model.d.ts +310 -0
  410. package/dist/engine/model.js +5 -0
  411. package/dist/engine/model.js.map +1 -0
  412. package/dist/engine/nets.d.ts +6 -0
  413. package/dist/engine/nets.js +49 -0
  414. package/dist/engine/nets.js.map +1 -0
  415. package/dist/engine/no-connect.d.ts +28 -0
  416. package/dist/engine/no-connect.js +36 -0
  417. package/dist/engine/no-connect.js.map +1 -0
  418. package/dist/engine/order.d.ts +7 -0
  419. package/dist/engine/order.js +25 -0
  420. package/dist/engine/order.js.map +1 -0
  421. package/dist/engine/pad-text.d.ts +20 -0
  422. package/dist/engine/pad-text.js +26 -0
  423. package/dist/engine/pad-text.js.map +1 -0
  424. package/dist/engine/part-labels.d.ts +29 -0
  425. package/dist/engine/part-labels.js +28 -0
  426. package/dist/engine/part-labels.js.map +1 -0
  427. package/dist/engine/pcb-place/blocks.d.ts +46 -0
  428. package/dist/engine/pcb-place/blocks.js +186 -0
  429. package/dist/engine/pcb-place/blocks.js.map +1 -0
  430. package/dist/engine/pcb-place/constructive.d.ts +73 -0
  431. package/dist/engine/pcb-place/constructive.js +515 -0
  432. package/dist/engine/pcb-place/constructive.js.map +1 -0
  433. package/dist/engine/pcb-place/edge.d.ts +7 -0
  434. package/dist/engine/pcb-place/edge.js +78 -0
  435. package/dist/engine/pcb-place/edge.js.map +1 -0
  436. package/dist/engine/pcb-place/fit-board.d.ts +22 -0
  437. package/dist/engine/pcb-place/fit-board.js +48 -0
  438. package/dist/engine/pcb-place/fit-board.js.map +1 -0
  439. package/dist/engine/pcb-place/geometry.d.ts +45 -0
  440. package/dist/engine/pcb-place/geometry.js +158 -0
  441. package/dist/engine/pcb-place/geometry.js.map +1 -0
  442. package/dist/engine/pcb-place/index.d.ts +81 -0
  443. package/dist/engine/pcb-place/index.js +98 -0
  444. package/dist/engine/pcb-place/index.js.map +1 -0
  445. package/dist/engine/pcb-place/refine.d.ts +32 -0
  446. package/dist/engine/pcb-place/refine.js +220 -0
  447. package/dist/engine/pcb-place/refine.js.map +1 -0
  448. package/dist/engine/pcb-place/roles.d.ts +37 -0
  449. package/dist/engine/pcb-place/roles.js +127 -0
  450. package/dist/engine/pcb-place/roles.js.map +1 -0
  451. package/dist/engine/pcb-place/scope.d.ts +80 -0
  452. package/dist/engine/pcb-place/scope.js +107 -0
  453. package/dist/engine/pcb-place/scope.js.map +1 -0
  454. package/dist/engine/pcb-place/score.d.ts +40 -0
  455. package/dist/engine/pcb-place/score.js +140 -0
  456. package/dist/engine/pcb-place/score.js.map +1 -0
  457. package/dist/engine/pcb.d.ts +72 -0
  458. package/dist/engine/pcb.js +153 -0
  459. package/dist/engine/pcb.js.map +1 -0
  460. package/dist/engine/pour/build.d.ts +32 -0
  461. package/dist/engine/pour/build.js +108 -0
  462. package/dist/engine/pour/build.js.map +1 -0
  463. package/dist/engine/pour/cache.d.ts +8 -0
  464. package/dist/engine/pour/cache.js +55 -0
  465. package/dist/engine/pour/cache.js.map +1 -0
  466. package/dist/engine/pour/clip.d.ts +50 -0
  467. package/dist/engine/pour/clip.js +72 -0
  468. package/dist/engine/pour/clip.js.map +1 -0
  469. package/dist/engine/pour/fill.d.ts +22 -0
  470. package/dist/engine/pour/fill.js +112 -0
  471. package/dist/engine/pour/fill.js.map +1 -0
  472. package/dist/engine/pour/islands.d.ts +8 -0
  473. package/dist/engine/pour/islands.js +19 -0
  474. package/dist/engine/pour/islands.js.map +1 -0
  475. package/dist/engine/pour/joins.d.ts +18 -0
  476. package/dist/engine/pour/joins.js +74 -0
  477. package/dist/engine/pour/joins.js.map +1 -0
  478. package/dist/engine/pour/obstacles.d.ts +45 -0
  479. package/dist/engine/pour/obstacles.js +85 -0
  480. package/dist/engine/pour/obstacles.js.map +1 -0
  481. package/dist/engine/pour/resolve.d.ts +21 -0
  482. package/dist/engine/pour/resolve.js +19 -0
  483. package/dist/engine/pour/resolve.js.map +1 -0
  484. package/dist/engine/pour/shapes.d.ts +9 -0
  485. package/dist/engine/pour/shapes.js +62 -0
  486. package/dist/engine/pour/shapes.js.map +1 -0
  487. package/dist/engine/pour/thermal.d.ts +16 -0
  488. package/dist/engine/pour/thermal.js +38 -0
  489. package/dist/engine/pour/thermal.js.map +1 -0
  490. package/dist/engine/project-files.d.ts +18 -0
  491. package/dist/engine/project-files.js +58 -0
  492. package/dist/engine/project-files.js.map +1 -0
  493. package/dist/engine/ratsnest.d.ts +16 -0
  494. package/dist/engine/ratsnest.js +69 -0
  495. package/dist/engine/ratsnest.js.map +1 -0
  496. package/dist/engine/read-props.d.ts +22 -0
  497. package/dist/engine/read-props.js +74 -0
  498. package/dist/engine/read-props.js.map +1 -0
  499. package/dist/engine/router/astar.d.ts +74 -0
  500. package/dist/engine/router/astar.js +231 -0
  501. package/dist/engine/router/astar.js.map +1 -0
  502. package/dist/engine/router/blockers.d.ts +4 -0
  503. package/dist/engine/router/blockers.js +69 -0
  504. package/dist/engine/router/blockers.js.map +1 -0
  505. package/dist/engine/router/cleanup.d.ts +21 -0
  506. package/dist/engine/router/cleanup.js +157 -0
  507. package/dist/engine/router/cleanup.js.map +1 -0
  508. package/dist/engine/router/clear.d.ts +18 -0
  509. package/dist/engine/router/clear.js +39 -0
  510. package/dist/engine/router/clear.js.map +1 -0
  511. package/dist/engine/router/congestion.d.ts +79 -0
  512. package/dist/engine/router/congestion.js +212 -0
  513. package/dist/engine/router/congestion.js.map +1 -0
  514. package/dist/engine/router/connect.d.ts +79 -0
  515. package/dist/engine/router/connect.js +174 -0
  516. package/dist/engine/router/connect.js.map +1 -0
  517. package/dist/engine/router/ends.d.ts +25 -0
  518. package/dist/engine/router/ends.js +135 -0
  519. package/dist/engine/router/ends.js.map +1 -0
  520. package/dist/engine/router/grid.d.ts +131 -0
  521. package/dist/engine/router/grid.js +297 -0
  522. package/dist/engine/router/grid.js.map +1 -0
  523. package/dist/engine/router/keep-clear.d.ts +10 -0
  524. package/dist/engine/router/keep-clear.js +60 -0
  525. package/dist/engine/router/keep-clear.js.map +1 -0
  526. package/dist/engine/router/obstacles.d.ts +18 -0
  527. package/dist/engine/router/obstacles.js +66 -0
  528. package/dist/engine/router/obstacles.js.map +1 -0
  529. package/dist/engine/router/path.d.ts +34 -0
  530. package/dist/engine/router/path.js +41 -0
  531. package/dist/engine/router/path.js.map +1 -0
  532. package/dist/engine/router/pour-rounds.d.ts +17 -0
  533. package/dist/engine/router/pour-rounds.js +124 -0
  534. package/dist/engine/router/pour-rounds.js.map +1 -0
  535. package/dist/engine/router/replicate.d.ts +32 -0
  536. package/dist/engine/router/replicate.js +143 -0
  537. package/dist/engine/router/replicate.js.map +1 -0
  538. package/dist/engine/router/rip-up.d.ts +5 -0
  539. package/dist/engine/router/rip-up.js +95 -0
  540. package/dist/engine/router/rip-up.js.map +1 -0
  541. package/dist/engine/router/route-board.d.ts +109 -0
  542. package/dist/engine/router/route-board.js +223 -0
  543. package/dist/engine/router/route-board.js.map +1 -0
  544. package/dist/engine/rules/classes.d.ts +14 -0
  545. package/dist/engine/rules/classes.js +50 -0
  546. package/dist/engine/rules/classes.js.map +1 -0
  547. package/dist/engine/rules/load.d.ts +14 -0
  548. package/dist/engine/rules/load.js +146 -0
  549. package/dist/engine/rules/load.js.map +1 -0
  550. package/dist/engine/rules/profiles.d.ts +5 -0
  551. package/dist/engine/rules/profiles.js +53 -0
  552. package/dist/engine/rules/profiles.js.map +1 -0
  553. package/dist/engine/rules/rotations.d.ts +31 -0
  554. package/dist/engine/rules/rotations.js +124 -0
  555. package/dist/engine/rules/rotations.js.map +1 -0
  556. package/dist/engine/rules/schema.d.ts +82 -0
  557. package/dist/engine/rules/schema.js +59 -0
  558. package/dist/engine/rules/schema.js.map +1 -0
  559. package/dist/engine/rules/track-defaults.d.ts +23 -0
  560. package/dist/engine/rules/track-defaults.js +26 -0
  561. package/dist/engine/rules/track-defaults.js.map +1 -0
  562. package/dist/engine/schematic-astar.d.ts +37 -0
  563. package/dist/engine/schematic-astar.js +202 -0
  564. package/dist/engine/schematic-astar.js.map +1 -0
  565. package/dist/engine/schematic-geometry.d.ts +23 -0
  566. package/dist/engine/schematic-geometry.js +49 -0
  567. package/dist/engine/schematic-geometry.js.map +1 -0
  568. package/dist/engine/schematic-grid.d.ts +60 -0
  569. package/dist/engine/schematic-grid.js +150 -0
  570. package/dist/engine/schematic-grid.js.map +1 -0
  571. package/dist/engine/schematic-nets.d.ts +38 -0
  572. package/dist/engine/schematic-nets.js +157 -0
  573. package/dist/engine/schematic-nets.js.map +1 -0
  574. package/dist/engine/schematic-pages.d.ts +9 -0
  575. package/dist/engine/schematic-pages.js +52 -0
  576. package/dist/engine/schematic-pages.js.map +1 -0
  577. package/dist/engine/schematic-place-chains.d.ts +22 -0
  578. package/dist/engine/schematic-place-chains.js +111 -0
  579. package/dist/engine/schematic-place-chains.js.map +1 -0
  580. package/dist/engine/schematic-place-plan.d.ts +43 -0
  581. package/dist/engine/schematic-place-plan.js +155 -0
  582. package/dist/engine/schematic-place-plan.js.map +1 -0
  583. package/dist/engine/schematic-place-units.d.ts +38 -0
  584. package/dist/engine/schematic-place-units.js +101 -0
  585. package/dist/engine/schematic-place-units.js.map +1 -0
  586. package/dist/engine/schematic-place.d.ts +5 -0
  587. package/dist/engine/schematic-place.js +268 -0
  588. package/dist/engine/schematic-place.js.map +1 -0
  589. package/dist/engine/schematic-route.d.ts +37 -0
  590. package/dist/engine/schematic-route.js +288 -0
  591. package/dist/engine/schematic-route.js.map +1 -0
  592. package/dist/engine/schematic-sheets.d.ts +22 -0
  593. package/dist/engine/schematic-sheets.js +104 -0
  594. package/dist/engine/schematic-sheets.js.map +1 -0
  595. package/dist/engine/schematic.d.ts +64 -0
  596. package/dist/engine/schematic.js +200 -0
  597. package/dist/engine/schematic.js.map +1 -0
  598. package/dist/engine/selectors.d.ts +25 -0
  599. package/dist/engine/selectors.js +28 -0
  600. package/dist/engine/selectors.js.map +1 -0
  601. package/dist/engine/sheet-ports.d.ts +44 -0
  602. package/dist/engine/sheet-ports.js +126 -0
  603. package/dist/engine/sheet-ports.js.map +1 -0
  604. package/dist/engine/sheet-symbol.d.ts +52 -0
  605. package/dist/engine/sheet-symbol.js +92 -0
  606. package/dist/engine/sheet-symbol.js.map +1 -0
  607. package/dist/engine/sheets.d.ts +79 -0
  608. package/dist/engine/sheets.js +159 -0
  609. package/dist/engine/sheets.js.map +1 -0
  610. package/dist/engine/symbols/box.d.ts +8 -0
  611. package/dist/engine/symbols/box.js +83 -0
  612. package/dist/engine/symbols/box.js.map +1 -0
  613. package/dist/engine/symbols/index.d.ts +8 -0
  614. package/dist/engine/symbols/index.js +58 -0
  615. package/dist/engine/symbols/index.js.map +1 -0
  616. package/dist/engine/symbols/passives.d.ts +16 -0
  617. package/dist/engine/symbols/passives.js +58 -0
  618. package/dist/engine/symbols/passives.js.map +1 -0
  619. package/dist/engine/symbols/power.d.ts +5 -0
  620. package/dist/engine/symbols/power.js +10 -0
  621. package/dist/engine/symbols/power.js.map +1 -0
  622. package/dist/engine/symbols/semis.d.ts +10 -0
  623. package/dist/engine/symbols/semis.js +62 -0
  624. package/dist/engine/symbols/semis.js.map +1 -0
  625. package/dist/engine/symbols/types.d.ts +83 -0
  626. package/dist/engine/symbols/types.js +61 -0
  627. package/dist/engine/symbols/types.js.map +1 -0
  628. package/dist/engine/traces.d.ts +29 -0
  629. package/dist/engine/traces.js +102 -0
  630. package/dist/engine/traces.js.map +1 -0
  631. package/dist/engine/units.d.ts +4 -0
  632. package/dist/engine/units.js +31 -0
  633. package/dist/engine/units.js.map +1 -0
  634. package/dist/engine/worker-env.d.ts +9 -0
  635. package/dist/engine/worker-env.js +12 -0
  636. package/dist/engine/worker-env.js.map +1 -0
  637. package/dist/library/attach-datasheet.d.ts +20 -0
  638. package/dist/library/attach-datasheet.js +61 -0
  639. package/dist/library/attach-datasheet.js.map +1 -0
  640. package/dist/library/easyeda-footprint.d.ts +41 -0
  641. package/dist/library/easyeda-footprint.js +255 -0
  642. package/dist/library/easyeda-footprint.js.map +1 -0
  643. package/dist/library/easyeda-path.d.ts +13 -0
  644. package/dist/library/easyeda-path.js +133 -0
  645. package/dist/library/easyeda-path.js.map +1 -0
  646. package/dist/library/easyeda-symbol.d.ts +20 -0
  647. package/dist/library/easyeda-symbol.js +53 -0
  648. package/dist/library/easyeda-symbol.js.map +1 -0
  649. package/dist/library/import-lcsc.d.ts +30 -0
  650. package/dist/library/import-lcsc.js +155 -0
  651. package/dist/library/import-lcsc.js.map +1 -0
  652. package/dist/library/lcsc-part.d.ts +40 -0
  653. package/dist/library/lcsc-part.js +153 -0
  654. package/dist/library/lcsc-part.js.map +1 -0
  655. package/dist/library/new-part.d.ts +50 -0
  656. package/dist/library/new-part.js +160 -0
  657. package/dist/library/new-part.js.map +1 -0
  658. package/dist/library/pin-table.d.ts +23 -0
  659. package/dist/library/pin-table.js +92 -0
  660. package/dist/library/pin-table.js.map +1 -0
  661. package/dist/mcp/batch.d.ts +111 -0
  662. package/dist/mcp/batch.js +241 -0
  663. package/dist/mcp/batch.js.map +1 -0
  664. package/dist/mcp/board-summary.d.ts +19 -0
  665. package/dist/mcp/board-summary.js +144 -0
  666. package/dist/mcp/board-summary.js.map +1 -0
  667. package/dist/mcp/compact-sheets.d.ts +31 -0
  668. package/dist/mcp/compact-sheets.js +63 -0
  669. package/dist/mcp/compact-sheets.js.map +1 -0
  670. package/dist/mcp/compact-tool-list.d.ts +8 -0
  671. package/dist/mcp/compact-tool-list.js +42 -0
  672. package/dist/mcp/compact-tool-list.js.map +1 -0
  673. package/dist/mcp/compact.d.ts +33 -0
  674. package/dist/mcp/compact.js +189 -0
  675. package/dist/mcp/compact.js.map +1 -0
  676. package/dist/mcp/copper-summary.d.ts +26 -0
  677. package/dist/mcp/copper-summary.js +122 -0
  678. package/dist/mcp/copper-summary.js.map +1 -0
  679. package/dist/mcp/copper-tools.d.ts +93 -0
  680. package/dist/mcp/copper-tools.js +228 -0
  681. package/dist/mcp/copper-tools.js.map +1 -0
  682. package/dist/mcp/copper-under.d.ts +16 -0
  683. package/dist/mcp/copper-under.js +46 -0
  684. package/dist/mcp/copper-under.js.map +1 -0
  685. package/dist/mcp/create-part.d.ts +71 -0
  686. package/dist/mcp/create-part.js +31 -0
  687. package/dist/mcp/create-part.js.map +1 -0
  688. package/dist/mcp/datasheet-tools.d.ts +14 -0
  689. package/dist/mcp/datasheet-tools.js +15 -0
  690. package/dist/mcp/datasheet-tools.js.map +1 -0
  691. package/dist/mcp/fillet-tools.d.ts +24 -0
  692. package/dist/mcp/fillet-tools.js +52 -0
  693. package/dist/mcp/fillet-tools.js.map +1 -0
  694. package/dist/mcp/guide.d.ts +37 -0
  695. package/dist/mcp/guide.js +78 -0
  696. package/dist/mcp/guide.js.map +1 -0
  697. package/dist/mcp/import-part.d.ts +13 -0
  698. package/dist/mcp/import-part.js +20 -0
  699. package/dist/mcp/import-part.js.map +1 -0
  700. package/dist/mcp/make-sheet.d.ts +18 -0
  701. package/dist/mcp/make-sheet.js +29 -0
  702. package/dist/mcp/make-sheet.js.map +1 -0
  703. package/dist/mcp/new-circuit.d.ts +77 -0
  704. package/dist/mcp/new-circuit.js +114 -0
  705. package/dist/mcp/new-circuit.js.map +1 -0
  706. package/dist/mcp/place-tools.d.ts +46 -0
  707. package/dist/mcp/place-tools.js +121 -0
  708. package/dist/mcp/place-tools.js.map +1 -0
  709. package/dist/mcp/pour-tools.d.ts +126 -0
  710. package/dist/mcp/pour-tools.js +105 -0
  711. package/dist/mcp/pour-tools.js.map +1 -0
  712. package/dist/mcp/project-tools.d.ts +36 -0
  713. package/dist/mcp/project-tools.js +115 -0
  714. package/dist/mcp/project-tools.js.map +1 -0
  715. package/dist/mcp/route-by-ref.d.ts +20 -0
  716. package/dist/mcp/route-by-ref.js +70 -0
  717. package/dist/mcp/route-by-ref.js.map +1 -0
  718. package/dist/mcp/route-tools.d.ts +54 -0
  719. package/dist/mcp/route-tools.js +173 -0
  720. package/dist/mcp/route-tools.js.map +1 -0
  721. package/dist/mcp/server.d.ts +9 -0
  722. package/dist/mcp/server.js +290 -0
  723. package/dist/mcp/server.js.map +1 -0
  724. package/dist/skill-install.d.ts +13 -0
  725. package/dist/skill-install.js +28 -0
  726. package/dist/skill-install.js.map +1 -0
  727. package/dist/studio/fit-board.d.ts +11 -0
  728. package/dist/studio/fit-board.js +15 -0
  729. package/dist/studio/fit-board.js.map +1 -0
  730. package/dist/studio/layout-schema.d.ts +157 -0
  731. package/dist/studio/layout-schema.js +32 -0
  732. package/dist/studio/layout-schema.js.map +1 -0
  733. package/dist/studio/live.d.ts +79 -0
  734. package/dist/studio/live.js +187 -0
  735. package/dist/studio/live.js.map +1 -0
  736. package/dist/studio/place-events.d.ts +60 -0
  737. package/dist/studio/place-events.js +42 -0
  738. package/dist/studio/place-events.js.map +1 -0
  739. package/dist/studio/place-runner.d.ts +62 -0
  740. package/dist/studio/place-runner.js +205 -0
  741. package/dist/studio/place-runner.js.map +1 -0
  742. package/dist/studio/place-worker.d.ts +1 -0
  743. package/dist/studio/place-worker.js +23 -0
  744. package/dist/studio/place-worker.js.map +1 -0
  745. package/dist/studio/route-events.d.ts +64 -0
  746. package/dist/studio/route-events.js +61 -0
  747. package/dist/studio/route-events.js.map +1 -0
  748. package/dist/studio/route-runner.d.ts +90 -0
  749. package/dist/studio/route-runner.js +272 -0
  750. package/dist/studio/route-runner.js.map +1 -0
  751. package/dist/studio/router-worker.d.ts +1 -0
  752. package/dist/studio/router-worker.js +17 -0
  753. package/dist/studio/router-worker.js.map +1 -0
  754. package/dist/studio/server.d.ts +32 -0
  755. package/dist/studio/server.js +610 -0
  756. package/dist/studio/server.js.map +1 -0
  757. package/dist/version.d.ts +1 -0
  758. package/dist/version.js +2 -0
  759. package/dist/version.js.map +1 -0
  760. package/package.json +64 -4
  761. package/skills/copperflow/SKILL.md +199 -0
  762. package/skills/copperflow/references/copper.md +82 -0
  763. package/skills/copperflow/references/design-rules.md +163 -0
  764. package/skills/copperflow/references/design-workflow.md +199 -0
  765. package/skills/copperflow/references/editable-subset.md +83 -0
  766. package/skills/copperflow/references/parts-library.md +83 -0
  767. package/skills/copperflow/references/writing-circuits.md +62 -0
@@ -0,0 +1,160 @@
1
+ import{a as e,i as t,n,r,t as i}from"./index-C_TXwo-N.js";var a=e();function o(e,t,n){let r=e.span.max-e.span.min,i=e.terminal.max-e.terminal.min,a=e.width.max-e.width.min,o=e.span.min-2*e.terminal.max,s=e.span.max-2*e.terminal.min,c=Math.sqrt(r**2+2*i**2),l=s-(s-o-c)/2,u=e=>Math.sqrt(e**2+n.fabrication**2+n.placement**2);return{Z:e.span.min+2*t.toe+u(r),G:l-2*t.heel-u(c),X:e.width.min+2*t.side+u(a)}}function s(e,t,n){let r=o(e,t,n),i=e.span.max-e.span.min,a=e.terminal.max-e.terminal.min,s=e.span.min-2*e.terminal.max,c=e.span.max-2*e.terminal.min,l=c-(c-s-Math.sqrt(i**2+2*a**2))/2,u=Math.sqrt(i**2+n.fabrication**2+n.placement**2);return{...r,G:l-2*t.heel-u}}var c=Object.freeze({fabrication:.1,placement:.05});function l(e,t,n){return Object.freeze({goals:Object.freeze(e),roundOff:t,courtyardExcess:n})}var u=l({toe:.35,heel:0,side:0},.05,.25),d=l({toe:.2,heel:0,side:0},.02,.15),f=l({toe:.35,heel:.35,side:.03},.05,.25),p=l({toe:.35,heel:.35,side:-.02},.05,.25);function m(e){return e>.625000001?f:p}var h=l({toe:.3,heel:0,side:-.04},.05,.25),g=l({toe:.15,heel:.5,side:-.05},.05,.25),_=.15;function v(e){return(e.min+e.max)/2<1.599999999?d:u}function y(e,t,n=f){let r=e.span.min-2*e.terminal.max,i=e.terminal.max-e.terminal.min;return r<=t+1e-9&&i<=.500000001?{...n.goals,heel:_}:{...n.goals}}var ee=1e-6;function b(e,t,n){let r=e/t;return n===`up`?Math.ceil(r-ee):Math.round(r+ee)}function x(e,t){return b(e,t,`up`)/Math.round(1/t)}var te=.25,ne=.25;function re(e,t){let n=Math.round(1/t),r=b(e.Z,t,`nearest`),i=b(e.G,t,`nearest`),a=b(e.X,t,`nearest`);if(i<=0||r<=i)throw Error(`land pattern has no gap between its pads (Z ${e.Z}, G ${e.G})`);return{length:(r-i)/(2*n),width:a/n,centre:(r+i)/(4*n)}}function ie(e,t){let n=re(e,t);return[S(`1`,-n.centre,0,n.length,n.width),S(`2`,n.centre,0,n.length,n.width)]}function S(e,t,n,r,i){return{number:e,shape:`roundrect`,x:t,y:n,width:r,height:i,rotation:0,layers:`top`,cornerRadius:Math.min(ne,te*Math.min(r,i))}}var C=.15,ae=1e6;function w(e){return Math.round(e*ae)/ae+0}function oe(e,t){return Array.from({length:e},(n,r)=>w((r-(e-1)/2)*t))}function se(e){return Math.abs(e.rotation%180)===90?{x:e.height/2,y:e.width/2}:{x:e.width/2,y:e.height/2}}function T(e){return e.reduce((e,t)=>{let n=se(t);return{x:Math.max(e.x,Math.abs(t.x)+n.x),y:Math.max(e.y,Math.abs(t.y)+n.y)}},{x:0,y:0})}function ce(e,t){let n=e.map(e=>({pad:e,half:se(e)}));return n.every((e,r)=>n.slice(r+1).every(n=>{let r=Math.abs(e.pad.x-n.pad.x)-e.half.x-n.half.x,i=Math.abs(e.pad.y-n.pad.y)-e.half.y-n.half.y;return Math.max(r,i)>=t-1e-9}))}function le(e,t=`x`){return Math.min(...e.map(e=>Math.abs(e[t])-se(e)[t]))}function ue(e){return[{x:-e.x,y:-e.y},{x:e.x,y:-e.y},{x:e.x,y:e.y},{x:-e.x,y:e.y}]}function E(e,t,n){let r=T(e);return ue({x:x(Math.max(r.x,t.x)+n.courtyardExcess,n.roundOff),y:x(Math.max(r.y,t.y)+n.courtyardExcess,n.roundOff)})}function de(e){let t={x:w(e.x),y:w(e.y)};return[...ue(t),{x:-t.x,y:-t.y}]}function fe(e){return[de(e)]}function pe(e,t){return w(Math.max(t.y,T(e).y+C))}function me(e,t){let n=pe(e,t),r=w(Math.min(t.x,le(e)));return[[{x:-r,y:n},{x:r,y:n}],[{x:-r,y:-n},{x:r,y:-n}]]}function he(e,t){let n=le(e)-C,r=w(n>0?n:T(e).x+C),i=pe(e,t);return[{x:r,y:-i},{x:r,y:i}]}function ge(e,t){let[n,r]=me(e,t),[,i]=n;return[[{x:-w(T(e).x),y:i.y},i],r]}function _e(e,t){let n=T(e),r=w(Math.max(t.x,n.x+C)),i=w(Math.min(t.y,le(e,`y`)));return[[{x:-r,y:-w(n.y)},{x:-r,y:i}],[{x:r,y:-i},{x:r,y:i}]]}function ve(e){let t=se(e);return Math.abs(e.x)>Math.abs(e.y)?Math.abs(e.y)+t.y:Math.abs(e.x)+t.x}function ye(e,t){let n=w(Math.max(...e.map(ve))+C),r=w(Math.max(t.x,n)),i=(e,t)=>[{x:w(e*r),y:w(t*n)},{x:w(e*r),y:w(t*r)},{x:w(e*n),y:w(t*r)}];return[[{x:-r,y:n},{x:-r,y:r}],[{x:-w(T(e).x),y:r},{x:-n,y:r}],i(1,1),i(1,-1),i(-1,-1)]}function be(e,t,n,r,i=5){let a=Math.max(1,Math.ceil(Math.abs(r-n)/i));return Array.from({length:a+1},(i,o)=>{let s=(n+(r-n)*o/a)*Math.PI/180;return{x:w(e.x+t*Math.cos(s)),y:w(e.y+t*Math.sin(s))}})}function xe(e,t){let n=se(t);if(t.shape===`circle`)return Math.hypot(e.x-t.x,e.y-t.y)-n.x;let r=Math.max(Math.abs(e.x-t.x)-n.x,0),i=Math.max(Math.abs(e.y-t.y)-n.y,0);return Math.hypot(r,i)}function Se(e,t){let n=[],r=[];for(let i of e)t.every(e=>xe(i,e)>=.16999999999999998)?r.push(i):(r.length>1&&n.push(r),r=[]);return r.length>1&&n.push(r),n}var Ce=1;function we(e,t){return[{x:w(e.x-Ce/2),y:w(t)},{x:w(e.x+Ce/2),y:w(t)}]}var D=e=>({refused:e}),Te=e=>typeof e==`object`&&!!e&&`refused`in e,Ee=.1,O=e=>String(w(e)),De=e=>e.x===e.y?O(e.x):`${O(e.x)}x${O(e.y)}`;function Oe(e){return Object.keys(e.params).every(e=>e===`p`)&&e.pairs===void 0}function ke(e,t){let n=[...Object.keys(e.params),...Object.keys(e.pairs??{})].filter(e=>e!==`p`&&e!==`ep`);if(n.length>0)return D(`a ${t} takes only _p and _ep, not _${n[0]}`);let r=e.params.ep,i=e.pairs?.ep;if(r===!0)return D(`_ep needs the exposed pad's size, such as _ep3.1 or _ep1.6x2.4`);if(typeof r==`number`)return r>0?{x:r,y:r}:D(`the exposed pad needs a size above 0`);if(i)return i[0]>0&&i[1]>0?{x:i[0],y:i[1]}:D(`the exposed pad needs a size above 0`)}function Ae(e,t){return ce(e,.1)?void 0:ce(t?e.slice(0,-1):e,.1)?D(`the exposed pad would touch the pins`):D(`the pins would come closer than ${Ee} mm to each other`)}var je=`ABCDEFGHJKLMNPRTUVWY`;function Me(e){let t=``;for(let n=e+1;n>0;n=Math.floor((n-1)/20))t=je[(n-1)%20]+t;return t}var Ne=new Map([[1.27,.75],[1,.5],[.8,.45],[.65,.35],[.5,.3],[.4,.25]]),Pe=.25,Fe=.2,Ie=.05,Le={courtyardExcess:1,roundOff:.05},Re=.3,ze=1,Be=4096,Ve=1e-9;function He(e){for(let[t,n]of Ne)if(!(Math.abs(t-e)>Ve))return{ball:n,land:w(Math.round(n*(1-(n>=.5499999990000001?Pe:Fe))/Ie+1e-6)*Ie)}}function Ue(e,t){if(t){let[n,r]=t;return Number.isInteger(n)&&Number.isInteger(r)&&n*r===e?{rows:n,columns:r}:D(`_rows${n}x${r} is not a full grid of ${e} balls`)}let n=Math.round(Math.sqrt(e));return n*n===e?{rows:n,columns:n}:D(`${e} balls are no square grid; give _rows<R>x<C>`)}var We=[...Ne.keys()].join(`, `);function Ge(e,t,n,r){let i=oe(t,n);return[...oe(e,n)].reverse().flatMap((e,t)=>i.map((n,i)=>({number:`${Me(t)}${i+1}`,shape:`circle`,x:n,y:e,width:r,height:r,rotation:0,layers:`top`})))}function Ke(e,t){let n=T(e),r={x:w(Math.max(t.x,n.x+C)),y:w(Math.max(t.y,n.y+C))},i=w(-r.x-Re),a=w(r.y+Re);return[de(r),[{x:i,y:w(a-ze)},{x:i,y:a},{x:w(i+ze),y:a}]]}function qe(e){if(e.kind!==`bga`||e.variant!==void 0||e.cross!==void 0||e.suffix!==void 0)return;let t=e.size,n=e.params.p;if(!t)return D(`a BGA needs its body, such as bga256_17x17_p1`);if(typeof n!=`number`)return D(`a BGA needs its pitch, such as _p1`);let r=[...Object.keys(e.params),...Object.keys(e.pairs??{})].find(e=>e!==`p`&&e!==`rows`);if(r!==void 0)return D(`a BGA takes only _p and _rows, not _${r}`);let i=Number(e.code);if(!Number.isInteger(i)||i<1||i>Be)return D(`a BGA has 1 to ${Be} balls`);let a=He(n);if(!a)return D(`BGA pitch must be one of ${We} mm`);let o=Ue(i,e.pairs?.rows);if(Te(o))return o;let[s,c]=t,l=(e,t)=>(e-1)*n+a.land<=t+Ve;if(!l(o.columns,s)||!l(o.rows,c))return D(`a ${o.rows}×${o.columns} grid at ${O(n)} mm does not fit the body`);let u=Ge(o.rows,o.columns,n,a.land),d={x:s/2,y:c/2},f=o.rows===o.columns;return{name:`bga${i}_${O(s)}x${O(c)}_p${O(n)}${f?``:`_rows${o.rows}x${o.columns}`}`,pads:u,courtyard:E(u,d,Le),silkscreen:Ke(u,d),fabrication:[de(d)],origin:`IPC-7351B nominal, BGA-${i} ${O(s)}×${O(c)} mm, ${O(n)} mm pitch, ${o.rows}×${o.columns} grid, ${O(a.ball)} mm balls on ${O(a.land)} mm lands`}}function k(e,t){let n=e=>Math.round(e*1e6)/1e6;return{min:n(e-t),max:n(e+t)}}var Je={"0201":{length:k(.6,.03),width:k(.3,.03),terminal:k(.15,.05)},"0402":{length:k(1,.05),width:k(.5,.05),terminal:k(.3,.1)},"0603":{length:k(1.6,.15),width:k(.8,.15),terminal:k(.35,.15)},"0805":{length:k(2,.2),width:k(1.25,.2),terminal:k(.5,.25)},1206:{length:k(3.2,.2),width:k(1.6,.2),terminal:k(.5,.25)},1210:{length:k(3.2,.2),width:k(2.5,.2),terminal:k(.5,.25)},1812:{length:k(4.5,.3),width:k(3.2,.3),terminal:k(.6,.35)}},Ye={2010:{length:k(5,.15),width:k(2.5,.15),terminal:k(.6,.2)},2512:{length:k(6.3,.2),width:k(3.15,.15),terminal:k(.6,.2)}},Xe={...Je,...Ye};function Ze(e){if(!Object.hasOwn(Xe,e))return;let t=Xe[e],n={span:t.length,terminal:t.terminal,width:t.width},r=v(t.length),i=ie(o(n,r.goals,c),r.roundOff),a={x:t.length.max/2,y:t.width.max/2};return{name:e,pads:i,courtyard:E(i,a,r),silkscreen:me(i,a),fabrication:fe(a),origin:`IPC-7351B nominal, EIA ${e}`}}var A=(e,t)=>({min:e,max:t});function Qe(e){return{span:e.span,terminal:e.terminal,width:e.leadWidth}}function $e(e){let t=m(e.pitch),n=y(Qe(e),e.bodyAcross.max,t);return{row:re(s(Qe(e),n,c),t.roundOff),table:t}}function et(e){return{row:re(o(Qe(e),h.goals,c),h.roundOff),table:h}}var tt=1e-6,nt=e=>(e.min+e.max)/2;function rt(e,t,n=[]){return Object.entries(e).every(([e,r])=>e===`p`?r!==!0&&Math.abs(r-t.pitch)<tt:e===`w`?r!==!0&&Math.abs(r-nt(t.span))<tt:n.includes(e)&&r===!0)}var it=.2,at=.05,ot=.5,st=.05,ct={courtyardExcess:.25,roundOff:st};function lt(e,t){return t?Math.hypot(e.max,t.max):e.max}function ut(e){let t=x(e+it,st);return{drill:t,pad:x(t+2*at+ot,st)}}function dt(e,t,n,r,i=!1){return{number:e,shape:i?`rect`:`circle`,x:t,y:n,width:r.pad,height:r.pad,rotation:0,layers:`through`,drill:{width:r.drill,height:r.drill}}}var ft=4.88,pt=A(.4,.46),mt=11.05,ht=4.65,gt=.2,_t=new Map([[void 0,`HC-49/U`],[`s`,`HC-49/S`]]);function vt(){let e=ht/2,t=be({x:mt/2-e,y:0},e,-90,90,10),n=be({x:-3.2,y:0},e,90,270,10);return[...t,...n,t[0]]}function yt(e){let t=e.kind===`hc`&&e.code===`49`?_t.get(e.suffix):void 0,n=e.cross===void 0&&e.size===void 0&&e.pairs===void 0&&e.variant===void 0;if(!t||!n||Object.keys(e.params).length>0)return;let r=ut(lt(pt)),i=[dt(`1`,-4.88/2,0,r,!0),dt(`2`,ft/2,0,r)],a=vt(),o=w(-(T(i).y+C+gt));return{name:`hc49${e.suffix??``}`,pads:i,courtyard:E(i,{x:mt/2,y:ht/2},ct),silkscreen:[a,we(i[0],o)],fabrication:[a],origin:`Through-hole, ${t} crystal: ${r.drill} mm holes, ${r.pad} mm lands (IPC-2222 level B)`}}var bt=String.raw`\d+(?:\.\d+)?`,xt=new RegExp(String.raw`^([a-z]*)(${bt})?(?:x(${bt}))?([a-z]*)$`),St=/^\d+$/,Ct=/^([a-z]+)(.*)$/,wt=new RegExp(String.raw`^(${bt})(?:mm)?x(${bt})(?:mm)?$`);function Tt(e){let[t=``,...n]=e.trim().toLowerCase().split(`_`),r=xt.exec(t);if(!r||t===``)return;let[,i=``,a=``,o,s=``]=r,c=St.test(n[0]??``)?n[0]:void 0,l=c===void 0?n:n.slice(1),u=l.filter(e=>wt.test(e));if(u.length>1)return;let d=Ot(l.filter(e=>!wt.test(e)));if(!d)return;let f=u[0]===void 0?void 0:Dt(u[0]);return{kind:i,code:a,...o===void 0?{}:{cross:o},...s===``?{}:{suffix:s},...c===void 0?{}:{variant:c},...f===void 0?{}:{size:f},params:d.params,...Object.keys(d.pairs).length===0?{}:{pairs:d.pairs}}}function Et(e){return e.cross===void 0&&e.suffix===void 0&&e.size===void 0&&e.pairs===void 0}function Dt(e){let t=wt.exec(e);return t?[Number(t[1]),Number(t[2])]:void 0}function Ot(e){let t={},r={};for(let i of e){let e=Ct.exec(i);if(!e)return;let a=e[1]??``,o=e[2]??``;if(Object.hasOwn(t,a)||Object.hasOwn(r,a))return;let s=Dt(o);if(s){r[a]=s;continue}let c=o===``||n(o);if(c===void 0)return;t[a]=c}return{params:t,pairs:r}}var kt=(e,t)=>Array.from({length:(t-e)/2+1},(t,n)=>e+2*n),At=[{kind:`soic`,suffix:``,label:e=>`SOIC-${e}`,pins:kt(8,16),lead:{pitch:1.27,span:A(5.8,6.2),terminal:A(.41,1.27),leadWidth:A(.33,.51),bodyAcross:A(3.8,4)},bodyLength:new Map([[8,A(4.8,5)],[14,A(8.55,8.75)],[16,A(9.8,10)]]),overhang:.53,bodyTolerance:.1},{kind:`soic`,suffix:`w`,label:e=>`SOIC-${e} wide`,pins:[16,18,20,24,28],lead:{pitch:1.27,span:A(10,10.65),terminal:A(.4,1.27),leadWidth:A(.31,.51),bodyAcross:A(7.4,7.6)},bodyLength:new Map([[16,A(10.1,10.5)],[18,A(11.35,11.75)],[20,A(12.6,13)],[24,A(15.2,15.6)],[28,A(17.7,18.1)]]),overhang:.6,bodyTolerance:.2},{kind:`sop`,suffix:``,label:e=>`SOP-${e}`,pins:kt(8,16),lead:{pitch:1.27,span:A(7.7,8.1),terminal:A(.51,.8),leadWidth:A(.36,.48),bodyAcross:A(5.18,5.38)},bodyLength:new Map([[8,A(5.18,5.33)]]),overhang:.72,bodyTolerance:.08},{kind:`ssop`,suffix:``,label:e=>`SSOP-${e}`,pins:[14,16,20,24,28],lead:{pitch:.65,span:A(7.4,8.2),terminal:A(.55,.95),leadWidth:A(.22,.38),bodyAcross:A(5,5.6)},bodyLength:new Map([[14,A(5.9,6.5)],[16,A(5.9,6.5)],[20,A(6.9,7.5)],[24,A(7.9,8.5)],[28,A(9.9,10.5)]]),overhang:.7,bodyTolerance:.3},{kind:`tssop`,suffix:``,label:e=>`TSSOP-${e}`,pins:kt(8,28),lead:{pitch:.65,span:A(6.2,6.6),terminal:A(.45,.75),leadWidth:A(.19,.3),bodyAcross:A(4.3,4.5)},bodyLength:new Map([[8,A(2.9,3.1)],[14,A(4.9,5.1)],[16,A(4.9,5.1)],[20,A(6.4,6.6)],[24,A(7.7,7.9)],[28,A(9.6,9.8)]]),overhang:.6,bodyTolerance:.1}],jt=At.map(e=>({form:`${e.kind}<N>${e.suffix}`,pins:e.pins}));function Mt(e,t){let n=e.bodyLength.get(t),r=(t/2-1)*e.lead.pitch+2*e.overhang,i=n??A(r-e.bodyTolerance,r+e.bodyTolerance);return{...e.lead,label:e.label(t),bodyAlong:i}}function Nt(e,t,n){let r=oe(e/2,t),i=[...r].reverse().map((e,t)=>S(String(t+1),-n.centre,e,n.length,n.width)),a=r.map((t,r)=>S(String(e/2+r+1),n.centre,t,n.length,n.width));return[...i,...a]}function Pt(e,t){if(e.cross!==void 0||e.size!==void 0||e.pairs!==void 0||e.variant!==void 0)return;let n=Number(e.code);return String(n)===e.code&&t.pins.includes(n)?n:void 0}function Ft(e){let t=At.find(t=>t.kind===e.kind&&t.suffix===(e.suffix??``)),n=t&&Pt(e,t);if(!t||n===void 0)return;let r=Mt(t,n);if(!rt(e.params,r))return;let{row:i,table:a}=$e(r),o=Nt(n,r.pitch,i),s={x:r.bodyAcross.max/2,y:r.bodyAlong.max/2},c=(n/2-1)/2*r.pitch+r.leadWidth.max/2,l={x:r.span.max/2,y:Math.max(s.y,c)};return{name:`${e.kind}${e.code}${t.suffix}`,pads:o,courtyard:E(o,l,a),silkscreen:ge(o,s),fabrication:fe(s),origin:`IPC-7351B nominal, ${r.label}`}}var It=.1,Lt=A(.3,.5),Rt=new Map([[.4,A(.15,.25)],[.5,A(.18,.3)],[.65,A(.25,.35)]]),zt=A(.45,.75),Bt=new Map([[.4,A(.13,.23)],[.5,A(.17,.27)],[.65,A(.22,.38)],[.8,A(.3,.4)]]),Vt=2,Ht=.15,Ut=.25,Wt=1024,Gt=1,Kt=60,qt=1e-9,Jt=(e,t)=>A(Yt(e-t),Yt(e+t)),Yt=e=>Math.round(e*1e6)/1e6;function Xt(e,t){for(let[n,r]of e)if(Math.abs(n-t)<qt)return r}function Zt(e,t,n){let r=Number(e);return!Number.isInteger(r)||r<=0||r>Wt?D(`a ${n} has 1 to ${Wt} pins`):r%t===0?r:D(`a ${n} has a pin count divisible by ${t}`)}var Qt=e=>{let t=[...e.keys()].map(String);return`${t.slice(0,-1).join(`, `)} or ${t[t.length-1]} mm`};function $t(e,t){return t.every(e=>e>=Gt&&e<=Kt)?void 0:D(`a ${e} body is ${Gt} to ${Kt} mm`)}function en(e,t,n,r){return(e-1)*t+n.max<=r+qt?void 0:D(`${e} pins a side at ${t} mm do not fit a ${r} mm side`)}function tn(...e){for(let t of e){let e=t();if(e)return e}}function nn(e,t,n,r,i){let a=Zt(t,4,e);if(Te(a))return a;let o=Xt(i,r);if(!o)return D(`${e} pitch must be ${Qt(i)}`);let[s,c]=n;return tn(()=>Math.abs(s-c)>qt?D(`${e} bodies must be square`):void 0,()=>$t(e,n),()=>en(a/4,r,o,s))??{pins:a,side:s,width:o}}function rn(e,t,n){let r=nn(`QFN`,e,t,n,Rt);if(Te(r))return r;let{pins:i,side:a,width:o}=r,s=Jt(a,It);return{label:`QFN-${i} ${a}×${a} mm, ${n} mm pitch`,pitch:n,span:s,terminal:Lt,leadWidth:o,bodyAcross:s,bodyAlong:s}}function an(e,t,n){let r=Zt(e,2,`DFN`);if(Te(r))return r;let i=Xt(Rt,n);if(!i)return D(`DFN pitch must be ${Qt(Rt)}`);let[a,o]=t,s=tn(()=>$t(`DFN`,t),()=>en(r/2,n,i,o));if(s)return s;let c=Jt(a,It);return{label:`DFN-${r} ${a}×${o} mm, ${n} mm pitch`,pitch:n,span:c,terminal:Lt,leadWidth:i,bodyAcross:c,bodyAlong:Jt(o,It)}}function on(e,t,n){let r=nn(`QFP`,e,t,n,Bt);if(Te(r))return r;let{pins:i,side:a,width:o}=r,s=a<=10.000000001?Ht:Ut,c=Jt(a,It);return{label:`LQFP-${i} ${a}×${a} mm, ${n} mm pitch`,pitch:n,span:Jt(a+Vt,s),terminal:zt,leadWidth:o,bodyAcross:c,bodyAlong:c}}function sn(e){if(e.kind!==`dfn`||e.variant!==void 0||e.cross!==void 0||e.suffix!==void 0)return;let t=e.size,n=e.params.p;if(!t)return D(`a DFN needs its body, such as dfn8_3x3_p0.65`);if(typeof n!=`number`)return D(`a DFN needs its pitch, such as _p0.65`);let r=an(e.code,t,n);if(Te(r))return r;let i=ke(e,`DFN`);if(Te(i))return i;let a=Number(e.code),{row:o,table:s}=et(r),c=Nt(a,n,o),l=i?[...c,S(String(a+1),0,0,i.x,i.y)]:c,u=Ae(l,i!==void 0);if(u)return u;let d={x:r.bodyAcross.max/2,y:r.bodyAlong.max/2};return{name:`dfn${a}_${O(t[0])}x${O(t[1])}_p${O(n)}${i?`_ep${De(i)}`:``}`,pads:l,courtyard:E(l,d,s),silkscreen:ge(c,d),fabrication:fe(d),origin:`IPC-7351B nominal, ${r.label}${i?` with exposed pad`:``}`}}var cn=2.54,ln=A(.36,.56),un=A(.2,.36),dn=1.27,fn=7.62,pn=64,mn=.75;function hn(e,t){let n=ut(lt(ln,un)),r=oe(e/2,cn),i=[...r].reverse().map((e,r)=>dt(String(r+1),w(-t/2),e,n,r===0)),a=r.map((r,i)=>dt(String(e/2+i+1),w(t/2),r,n));return[...i,...a]}function gn(e,t){let n=Math.min(...e.map(e=>Math.abs(e.x)-e.width/2)),r=w(Math.min(t.x,n-C)),i=w(Math.max(t.y,T(e).y+C)),a=be({x:0,y:i},mn,0,-180,15);return[[{x:-.75,y:i},{x:-r,y:i},{x:-r,y:-i},{x:r,y:-i},{x:r,y:i},...a]]}function _n(e){if(e.kind!==`dip`||!Et(e)||e.variant!==void 0)return;let t=Object.keys(e.params).find(e=>e!==`w`);if(t!==void 0)return D(`a DIP takes only _w, not _${t}`);let n=Number(e.code),r=e.params.w??7.62;if(!Number.isInteger(n)||n<4||n>pn||n%2!=0)return D(`a DIP has an even pin count from 4 to ${pn}`);if(r===!0||r<7.619999999)return D(`DIP rows are at least ${fn} mm apart`);let i=hn(n,r),a={x:(r-dn)/2,y:n/2*(cn/2)},o=i[0];return{name:Math.abs(r-7.62)<1e-9?`dip${n}`:`dip${n}_w${O(r)}`,pads:i,courtyard:E(i,a,ct),silkscreen:gn(i,a),fabrication:fe(a),origin:`Through-hole, DIP-${n} with rows ${O(r)} mm apart: ${O(o.drill?.width??0)} mm holes, ${O(o.width)} mm lands (IPC-2222 level B)`}}var vn=Symbol.for(`yaml.alias`),yn=Symbol.for(`yaml.document`),bn=Symbol.for(`yaml.map`),xn=Symbol.for(`yaml.pair`),Sn=Symbol.for(`yaml.scalar`),Cn=Symbol.for(`yaml.seq`),j=Symbol.for(`yaml.node.type`),wn=e=>!!e&&typeof e==`object`&&e[j]===vn,Tn=e=>!!e&&typeof e==`object`&&e[j]===yn,En=e=>!!e&&typeof e==`object`&&e[j]===bn,M=e=>!!e&&typeof e==`object`&&e[j]===xn,N=e=>!!e&&typeof e==`object`&&e[j]===Sn,Dn=e=>!!e&&typeof e==`object`&&e[j]===Cn;function P(e){if(e&&typeof e==`object`)switch(e[j]){case bn:case Cn:return!0}return!1}function F(e){if(e&&typeof e==`object`)switch(e[j]){case vn:case bn:case Sn:case Cn:return!0}return!1}var On=e=>(N(e)||P(e))&&!!e.anchor,kn=Symbol(`break visit`),An=Symbol(`skip children`),jn=Symbol(`remove node`);function Mn(e,t){let n=Pn(t);Tn(e)?Nn(null,e.contents,n,Object.freeze([e]))===jn&&(e.contents=null):Nn(null,e,n,Object.freeze([]))}Mn.BREAK=kn,Mn.SKIP=An,Mn.REMOVE=jn;function Nn(e,t,n,r){let i=Fn(e,t,n,r);if(F(i)||M(i))return In(e,r,i),Nn(e,i,n,r);if(typeof i!=`symbol`){if(P(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Nn(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===kn)return kn;else i===jn&&(t.items.splice(e,1),--e)}}else if(M(t)){r=Object.freeze(r.concat(t));let e=Nn(`key`,t.key,n,r);if(e===kn)return kn;e===jn&&(t.key=null);let i=Nn(`value`,t.value,n,r);if(i===kn)return kn;i===jn&&(t.value=null)}}return i}function Pn(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 Fn(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(En(t))return n.Map?.(e,t,r);if(Dn(t))return n.Seq?.(e,t,r);if(M(t))return n.Pair?.(e,t,r);if(N(t))return n.Scalar?.(e,t,r);if(wn(t))return n.Alias?.(e,t,r)}function In(e,t,n){let r=t[t.length-1];if(P(r))r.items[e]=n;else if(M(r))e===`key`?r.key=n:r.value=n;else if(Tn(r))r.contents=n;else{let e=wn(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var Ln={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},Rn=e=>e.replace(/[!,[\]{}]/g,e=>Ln[e]),zn=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}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)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Rn(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&F(e.contents)){let t={};Mn(e.contents,(e,n)=>{F(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||e&&!r.some(e=>e.startsWith(a))||t.push(`%TAG ${i} ${a}`);return t.join(`
2
+ `)}};zn.defaultYaml={explicit:!1,version:`1.2`},zn.defaultTags={"!!":`tag:yaml.org,2002:`};function Bn(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Vn(e){let t=new Set;return Mn(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function Hn(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Un(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=Vn(e);let a=Hn(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(N(t.node)||P(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function Wn(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Wn(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Wn(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Wn(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Wn(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function I(e,t,n){if(Array.isArray(e))return e.map((e,t)=>I(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!On(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Gn=class{constructor(e){Object.defineProperty(this,j,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Tn(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=I(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Wn(i,{"":o},``,o):o}},Kn=class extends Gn{constructor(e){super(vn),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Mn(e,{Node:(e,t)=>{(wn(t)||On(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(I(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=qn(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Bn(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function qn(e,t,n){if(wn(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(P(t)){let r=0;for(let i of t.items){let t=qn(e,i,n);t>r&&(r=t)}return r}if(M(t)){let r=qn(e,t.key,n),i=qn(e,t.value,n);return Math.max(r,i)}return 1}var Jn=e=>!e||typeof e!=`function`&&typeof e!=`object`,L=class extends Gn{constructor(e){super(Sn),this.value=e}toJSON(e,t){return t?.keep?this.value:I(this.value,e,t)}toString(){return String(this.value)}};L.BLOCK_FOLDED=`BLOCK_FOLDED`,L.BLOCK_LITERAL=`BLOCK_LITERAL`,L.PLAIN=`PLAIN`,L.QUOTE_DOUBLE=`QUOTE_DOUBLE`,L.QUOTE_SINGLE=`QUOTE_SINGLE`;var Yn=`tag:yaml.org,2002:`;function Xn(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function Zn(e,t,n){if(Tn(e)&&(e=e.contents),F(e))return e;if(M(e)){let t=n.schema[bn].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new Kn(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Yn+t.slice(2));let l=Xn(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new L(e);return c&&(c.node=t),t}l=e instanceof Map?o[bn]:Symbol.iterator in Object(e)?o[Cn]:o[bn]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new L(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Qn(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return Zn(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var $n=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,er=class extends Gn{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>F(t)||M(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if($n(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(P(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Qn(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(P(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&N(i)?i.value:i:P(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!M(t))return!1;let n=t.value;return n==null||e&&N(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return P(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(P(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Qn(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},tr=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function nr(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var rr=(e,t,n)=>e.endsWith(`
3
+ `)?nr(n,t):n.includes(`
4
+ `)?`
5
+ `+nr(n,t):(e.endsWith(` `)?``:` `)+n,ir=`flow`,ar=`block`,or=`quoted`;function sr(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=cr(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
6
+ `)n===`block`&&(h=cr(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
7
+ `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
8
+ `&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function cr(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
9
+ `);r=t,i=t+1,a=e[i]}return r}var lr=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),ur=e=>/^(%|---|\.\.\.)/m.test(e);function dr(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
10
+ `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function fr(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(ur(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){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:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
11
+
12
+ `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
13
+ `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:sr(o,a,or,lr(t,!1))}function pr(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
14
+ `)||/[ \t]\n|\n[ \t]/.test(e))return fr(e,t);let n=t.indent||(ur(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:sr(r,n,ir,lr(t,!1))}function mr(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=fr;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?pr:i&&!t?fr:n?pr:fr}return r(e,t)}var hr;try{hr=RegExp(`(^|(?<!
15
+ ))
16
+ +(?!
17
+ |$)`,`g`)}catch{hr=/\n+(?!\n|$)/g}function gr({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return mr(n,r);let l=r.indent||(r.forceBlockIndent||ur(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===L.BLOCK_FOLDED?!1:t===L.BLOCK_LITERAL||!dr(n,c,l.length);if(!n)return u?`|
18
+ `:`>
19
+ `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
20
+ `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
21
+ `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
22
+ `&&(p=p.slice(0,-1)),p.replace(hr,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
23
+ `)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
24
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=lr(r,!0);o!==`folded`&&t!==L.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=sr(`${v}${e}${p}`,l,ar,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function _r(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
25
+ `)||u&&/[[\]{},]/.test(a))return mr(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
26
+ `)?mr(a,t):gr(e,t,n,r);if(!s&&!u&&i!==L.PLAIN&&a.includes(`
27
+ `))return gr(e,t,n,r);if(ur(a)){if(c===``)return t.forceBlockIndent=!0,gr(e,t,n,r);if(s&&c===l)return mr(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return mr(a,t)}return s?d:sr(d,c,ir,lr(t,!1))}function vr(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==L.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=L.QUOTE_DOUBLE);let c=e=>{switch(e){case L.BLOCK_FOLDED:case L.BLOCK_LITERAL:return i||a?mr(o.value,t):gr(o,t,n,r);case L.QUOTE_DOUBLE:return fr(o.value,t);case L.QUOTE_SINGLE:return pr(o.value,t);case L.PLAIN:return _r(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function yr(e,t){let n=Object.assign({blockQuote:!0,commentString:tr,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function br(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(N(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function xr(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(N(e)||P(e))&&e.anchor;a&&Bn(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Sr(e,t,n,r){if(M(e))return e.toString(t,n,r);if(wn(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw 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 i,a=F(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=br(t.doc.schema.tags,a);let o=xr(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):N(a)?vr(a,t,n,r):a.toString(t,n,r);return o?N(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Cr({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=F(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(P(e)||!F(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||P(e)||(N(e)?e.type===L.BLOCK_FOLDED||e.type===L.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Sr(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=rr(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=rr(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=rr(g,n.indent,l(f))));let _,v,y;F(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&N(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Dn(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let ee=!1,b=Sr(t,n,()=>ee=!0,()=>h=!0),x=` `;if(f||_||v){if(x=_?`
28
+ `:``,v){let e=l(v);x+=`\n${nr(e,n.indent)}`}b===``&&!n.inFlow?x===`
29
+ `&&y&&(x=`
30
+
31
+ `):x+=`\n${n.indent}`}else if(!p&&P(t)){let e=b[0],r=b.indexOf(`
32
+ `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=b.indexOf(` `);e===`&`&&n!==-1&&n<r&&b[n+1]===`!`&&(n=b.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(x=`\n${n.indent}`)}}else(b===``||b[0]===`
33
+ `)&&(x=``);return g+=x+b,n.inFlow?ee&&r&&r():y&&!ee?g+=rr(g,n.indent,l(y)):h&&i&&i(),g}function wr(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Tr=`<<`,Er={identify:e=>e===Tr||typeof e==`symbol`&&e.description===Tr,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new L(Symbol(Tr)),{addToJSMap:Or}),stringify:()=>Tr},Dr=(e,t)=>(Er.identify(t)||N(t)&&(!t.type||t.type===L.PLAIN)&&Er.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Er.tag&&e.default);function Or(e,t,n){let r=Ar(e,n);if(Dn(r))for(let n of r.items)kr(e,t,n);else if(Array.isArray(r))for(let n of r)kr(e,t,n);else kr(e,t,r)}function kr(e,t,n){let r=Ar(e,n);if(!En(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Ar(e,t){return e&&wn(t)?t.resolve(e.doc,e):t}function jr(e,t,{key:n,value:r}){if(F(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Dr(e,n))Or(e,t,r);else{let i=I(n,``,e);if(t instanceof Map)t.set(i,I(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Mr(n,i,e),o=I(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Mr(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(F(e)&&n?.doc){let t=yr(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),wr(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Nr(e,t,n){return new R(Zn(e,void 0,n),Zn(t,void 0,n))}var R=class e{constructor(e,t=null){Object.defineProperty(this,j,{value:xn}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return F(n)&&(n=n.clone(t)),F(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return jr(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Cr(this,e,t,n):JSON.stringify(this)}};function Pr(e,t,n){return(t.inFlow??e.flow?Ir:Fr)(e,t,n)}function Fr({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(F(i))!d&&i.spaceBefore&&f.push(``),Lr(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(M(i)){let e=F(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Lr(n,f,e.commentBefore,d))}d=!1;let s=Sr(i,u,()=>o=null,()=>d=!0);o&&(s+=rr(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
34
+ `}}return e?(p+=`
35
+ `+nr(l(e),c),s&&s()):d&&o&&o(),p}function Ir({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(F(i))i.spaceBefore&&d.push(``),Lr(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(M(i)){let e=F(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Lr(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=F(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Sr(i,c,()=>a=null);l||=d.length>u||o.includes(`
36
+ `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=rr(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
37
+ `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Lr({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=nr(t(r),e);n.push(i.trimStart())}}function Rr(e,t){let n=N(t)?t.value:t;for(let r of e)if(M(r)&&(r.key===t||r.key===n||N(r.key)&&r.key.value===n))return r}var z=class extends er{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(bn,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Nr(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=M(e)?e:!e||typeof e!=`object`||!(`key`in e)?new R(e,e?.value):new R(e.key,e.value);let r=Rr(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);N(r.value)&&Jn(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=Rr(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Rr(this.items,e)?.value;return(!t&&N(n)?n.value:n)??void 0}has(e){return!!Rr(this.items,e)}set(e,t){this.add(new R(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)jr(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!M(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Pr(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},zr={collection:`map`,default:!0,nodeClass:z,tag:`tag:yaml.org,2002:map`,resolve(e,t){return En(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>z.from(e,t,n)},Br=class extends er{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Cn,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Vr(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Vr(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&N(r)?r.value:r}has(e){let t=Vr(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Vr(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];N(r)&&Jn(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(I(e,String(r++),t));return n}toString(e,t,n){return e?Pr(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(Zn(a,void 0,n))}}return i}};function Vr(e){let t=N(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Hr={collection:`seq`,default:!0,nodeClass:Br,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Dn(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Br.from(e,t,n)},Ur={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),vr(e,t,n,r)}},Wr={identify:e=>e==null,createNode:()=>new L(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new L(null),stringify:({source:e},t)=>typeof e==`string`&&Wr.test.test(e)?e:t.options.nullStr},Gr={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new L(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&Gr.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function Kr({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var qr={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]===`-`?-1/0:1/0,stringify:Kr},Jr={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():Kr(e)}},Yr={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 L(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:Kr},Xr=e=>typeof e==`bigint`||Number.isInteger(e),Zr=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function Qr(e,t,n){let{value:r}=e;return Xr(r)&&r>=0?n+r.toString(t):Kr(e)}var $r={identify:e=>Xr(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>Zr(e,2,8,n),stringify:e=>Qr(e,8,`0o`)},ei={identify:Xr,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Zr(e,0,10,n),stringify:Kr},ti={identify:e=>Xr(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Zr(e,2,16,n),stringify:e=>Qr(e,16,`0x`)},ni=[zr,Hr,Ur,Wr,Gr,$r,ei,ti,qr,Jr,Yr];function ri(e){return typeof e==`bigint`||Number.isInteger(e)}var ii=({value:e})=>JSON.stringify(e),ai=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:ii},{identify:e=>e==null,createNode:()=>new L(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:ii},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:ii},{identify:ri,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>ri(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:ii}],oi=[zr,Hr].concat(ai,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),si={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=L.BLOCK_LITERAL,t!==L.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===L.BLOCK_LITERAL?`
38
+ `:` `)}return vr({comment:e,type:t,value:s},r,i,a)}};function ci(e,t){if(Dn(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!M(r)){if(En(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new R(new L(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=M(r)?r:new R(r)}}else t(`Expected a sequence for this tag`);return e}function li(e,t,n){let{replacer:r}=n,i=new Br(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Nr(o,s,n))}return i}var ui={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:ci,createNode:li},di=class e extends Br{constructor(){super(),this.add=z.prototype.add.bind(this),this.delete=z.prototype.delete.bind(this),this.get=z.prototype.get.bind(this),this.has=z.prototype.has.bind(this),this.set=z.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(M(e)?(r=I(e.key,``,t),i=I(e.value,r,t)):r=I(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=li(e,t,n),i=new this;return i.items=r.items,i}};di.tag=`tag:yaml.org,2002:omap`;var fi={collection:`seq`,identify:e=>e instanceof Map,nodeClass:di,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=ci(e,t),r=[];for(let{key:e}of n.items)N(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new di,n)},createNode:(e,t,n)=>di.from(e,t,n)};function pi({value:e,source:t},n){return t&&(e?mi:hi).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var mi={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 L(!0),stringify:pi},hi={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 L(!1),stringify:pi},gi={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]===`-`?-1/0:1/0,stringify:Kr},_i={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():Kr(e)}},vi={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 L(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:Kr},yi=e=>typeof e==`bigint`||Number.isInteger(e);function bi(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function xi(e,t,n){let{value:r}=e;if(yi(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return Kr(e)}var Si={identify:yi,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>bi(e,2,2,n),stringify:e=>xi(e,2,`0b`)},Ci={identify:yi,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>bi(e,1,8,n),stringify:e=>xi(e,8,`0`)},wi={identify:yi,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>bi(e,0,10,n),stringify:Kr},Ti={identify:yi,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>bi(e,2,16,n),stringify:e=>xi(e,16,`0x`)},Ei=class e extends z{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=M(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new R(e.key,null):new R(e,null),Rr(this.items,t.key)||this.items.push(t)}get(e,t){let n=Rr(this.items,e);return!t&&M(n)?N(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Rr(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new R(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Nr(e,null,n));return i}};Ei.tag=`tag:yaml.org,2002:set`;var Di={collection:`map`,identify:e=>e instanceof Set,nodeClass:Ei,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Ei.from(e,t,n),resolve(e,t){if(En(e)){if(e.hasAllNullValues(!0))return Object.assign(new Ei,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function Oi(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function ki(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return Kr(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var Ai={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:n})=>Oi(e,n),stringify:ki},ji={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=>Oi(e,!1),stringify:ki},Mi={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(Mi.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=Oi(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},Ni=[zr,Hr,Ur,Wr,mi,hi,Si,Ci,wi,Ti,gi,_i,vi,si,Er,fi,ui,Di,Ai,ji,Mi],Pi=new Map([[`core`,ni],[`failsafe`,[zr,Hr,Ur]],[`json`,oi],[`yaml11`,Ni],[`yaml-1.1`,Ni]]),Fi={binary:si,bool:Gr,float:Yr,floatExp:Jr,floatNaN:qr,floatTime:ji,int:ei,intHex:ti,intOct:$r,intTime:Ai,map:zr,merge:Er,null:Wr,omap:fi,pairs:ui,seq:Hr,set:Di,timestamp:Mi},Ii={"tag:yaml.org,2002:binary":si,"tag:yaml.org,2002:merge":Er,"tag:yaml.org,2002:omap":fi,"tag:yaml.org,2002:pairs":ui,"tag:yaml.org,2002:set":Di,"tag:yaml.org,2002:timestamp":Mi};function Li(e,t,n){let r=Pi.get(t);if(r&&!e)return n&&!r.includes(Er)?r.concat(Er):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(Pi.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(Er)),i.reduce((e,t)=>{let n=typeof t==`string`?Fi[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(Fi).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var Ri=(e,t)=>e.key<t.key?-1:+(e.key>t.key),zi=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?Li(e,`compat`):e?Li(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?Ii:{},this.tags=Li(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,bn,{value:zr}),Object.defineProperty(this,Sn,{value:Ur}),Object.defineProperty(this,Cn,{value:Hr}),this.sortMapEntries=typeof a==`function`?a:a===!0?Ri:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function Bi(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=yr(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(nr(t,``))}let o=!1,s=null;if(e.contents){if(F(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(nr(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Sr(e.contents,i,()=>s=null,t);s&&(c+=rr(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Sr(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
39
+ `)?(n.push(`...`),n.push(nr(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(nr(a(t),``)))}return n.join(`
40
+ `)+`
41
+ `}var Vi=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,j,{value:yn});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new zn({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[j]:{value:yn}});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=F(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){Hi(this.contents)&&this.contents.add(e)}addIn(e,t){Hi(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Vn(this);e.anchor=!t||n.has(t)?Hn(t||`a`,n):t}return new Kn(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=Un(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=Zn(e,l,p);return o&&P(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new R(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return Hi(this.contents)?this.contents.delete(e):!1}deleteIn(e){return $n(e)?this.contents!=null&&(this.contents=null,!0):Hi(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return P(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return $n(e)?!t&&N(this.contents)?this.contents.value:this.contents:P(this.contents)?this.contents.getIn(e,t):void 0}has(e){return P(this.contents)?this.contents.has(e):!1}hasIn(e){return $n(e)?this.contents!==void 0:P(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Qn(this.schema,[e],t):Hi(this.contents)&&this.contents.set(e,t)}setIn(e,t){$n(e)?this.contents=t:this.contents==null?this.contents=Qn(this.schema,Array.from(e),t):Hi(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new zn({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new zn({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new zi(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=I(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?Wn(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return Bi(this,e)}};function Hi(e){if(P(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var Ui=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},Wi=class extends Ui{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},Gi=class extends Ui{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},Ki=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
42
+ `),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function qi(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,ee=null,b=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:ee&&n===`seq-item-ind`||(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,b??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,b??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),ee&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),ee=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let x=e[e.length-1],te=x?x.offset+x.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:ee,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:te,start:b??te}}function Ji(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
43
+ `))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 e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(Ji(t.key)||Ji(t.value))return!0}return!1;default:return!0}}function Yi(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&Ji(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function Xi(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||N(e)&&N(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var Zi=`All mapping items must start at the same column`;function Qi({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??z)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=qi(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,Zi)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
44
+ `+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||Ji(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,Zi);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&Yi(r.indent,u,i),n.atKey=!1,Xi(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=qi(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&Yi(r.indent,f,i),s=c.range[2];let l=new R(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
45
+ `+_.comment:g.comment=_.comment);let e=new R(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function $i({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??Br)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=qi(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found){if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&Yi(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function ea(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var ta=`Block collections are not allowed within flow collections`,na=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function ra({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?z:Br))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=qi(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
46
+ `+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&Ji(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];M(t)&&(t=t.value??t.key),t.comment?t.comment+=`
47
+ `+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],na(m)&&i(r.range,`BLOCK_IN_FLOW`,ta)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);na(f)&&i(g.range,`BLOCK_IN_FLOW`,ta),n.atKey=!1;let _=qi(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?na(m)&&i(v.range,`BLOCK_IN_FLOW`,ta):_.comment&&(g.comment?g.comment+=`
48
+ `+_.comment:g.comment=_.comment);let y=new R(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;Xi(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new z(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=ea(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
49
+ `+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function ia(e,t,n,r,i,a){let o=n.type===`block-map`?Qi(e,t,n,r,a):n.type===`block-seq`?$i(e,t,n,r,a):ra(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function aa(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===z.tagName&&s===`map`||o===Br.tagName&&s===`seq`)return ia(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),ia(e,t,n,i,o)}let l=ia(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=F(u)?u:new L(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function oa(e,t,n){let r=t.offset,i=sa(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?L.BLOCK_FOLDED:L.BLOCK_LITERAL,o=t.source?ca(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
50
+ `.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
51
+ `;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===L.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
52
+ `):t.length>c||r[0]===` `?(f===` `?f=`
53
+ `:!p&&f===`
54
+ `&&(f=`
55
+
56
+ `),d+=f+t.slice(c)+r,f=`
57
+ `,p=!0):r===``?f===`
58
+ `?d+=`
59
+ `:f=`
60
+ `:(d+=f+r,f=` `,p=!1)}switch(i.chomp){case`-`:break;case`+`:for(let e=s;e<o.length;++e)d+=`
61
+ `+o[e][0].slice(c);d[d.length-1]!==`
62
+ `&&(d+=`
63
+ `);break;default:d+=`
64
+ `}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function sa({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function ca(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function la(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=L.PLAIN,c=ua(a,l);break;case`single-quoted-scalar`:s=L.QUOTE_SINGLE,c=da(a,l);break;case`double-quoted-scalar`:s=L.QUOTE_DOUBLE,c=pa(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=ea(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function ua(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),fa(e)}function da(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),fa(e.slice(1,-1)).replace(/''/g,`'`)}function fa(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
65
+ `?a+=o:o=`
66
+ `:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function pa(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
67
+ `){if(i===`
68
+ `){let{fold:t,offset:i}=ma(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=ha[i];if(a)n+=a;else if(i===`
69
+ `)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
70
+ `)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=ga(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
71
+ `&&(a!==`\r`||e[r+2]!==`
72
+ `)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function ma(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
73
+ `||r===`\r`)&&(r!==`\r`||e[t+2]===`
74
+ `);)r===`
75
+ `&&(n+=`
76
+ `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var ha={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
77
+ `,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function ga(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function _a(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?oa(e,t,r):la(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[Sn]:c?va(e.schema,i,c,n,r):t.type===`scalar`?ya(e,i,t,r):e.schema[Sn];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=N(a)?a:new L(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new L(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function va(e,t,n,r,i){if(n===`!`)return e[Sn];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[Sn])}function ya({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[Sn];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Sn];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function ba(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var xa={composeNode:Sa,composeEmptyNode:Ca};function Sa(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=wa(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=_a(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=aa(xa,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=Ca(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!N(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Ca(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=_a(e,{type:`scalar`,offset:ba(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function wa({options:e},{offset:t,source:n,end:r},i){let a=new Kn(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=ea(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Ta(e,t,{offset:n,start:r,value:i,end:a},o){let s=new Vi(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=qi(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Sa(c,i,l,o):Ca(c,l.end,r,null,l,o);let u=s.contents.range[2],d=ea(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Ea(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:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function Da(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
78
+
79
+ `:`
80
+ `)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var Oa=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Ea(e);r?this.warnings.push(new Gi(i,t,n)):this.errors.push(new Wi(i,t,n))},this.directives=new zn({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Da(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(P(i)&&!i.flow&&i.items.length>0){let e=i.items[0];M(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Da(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=Ea(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Ta(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Wi(Ea(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new Wi(Ea(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=ea(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Wi(Ea(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new Vi(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},ka=Symbol(`break visit`),Aa=Symbol(`skip children`),ja=Symbol(`remove item`);function Ma(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Na(Object.freeze([]),e,t)}Ma.BREAK=ka,Ma.SKIP=Aa,Ma.REMOVE=ja,Ma.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Ma.parentCollection=(e,t)=>{let n=Ma.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Na(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Na(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===ka)return ka;else r===ja&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function Pa(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
81
+ `:case`\r
82
+ `: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}function Fa(e){switch(e){case void 0:case` `:case`
83
+ `:case`\r`:case` `:return!0;default:return!1}}var Ia=new Set(`0123456789ABCDEFabcdef`),La=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),Ra=new Set(`,[]{}`),za=new Set(` ,[]{}
84
+ \r `),Ba=e=>!e||za.has(e),Va=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
85
+ `||t===`\r`&&this.buffer[e+1]===`
86
+ `}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
87
+ `||!t&&!this.atEnd)return e+n+1}return t===`
88
+ `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&Fa(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
89
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&Fa(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Fa(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&Fa(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);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(Ba),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&Fa(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`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,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(Ba),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||Fa(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
90
+ `,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
91
+ `,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>Fa(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
92
+ `:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
93
+ `)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?t:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
94
+ `,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
95
+ `;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
96
+ `&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(Fa(r)||e&&Ra.has(r))break;t=n}else if(Fa(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
97
+ `?(n+=1,r=`
98
+ `,i=this.buffer[n+1]):t=n),i===`#`||e&&Ra.has(i))break;if(r===`
99
+ `){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&Ra.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(Ba),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(Fa(n)||t&&Ra.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!Fa(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(La.has(t))t=this.buffer[++e];else if(t===`%`&&Ia.has(this.buffer[e+1])&&Ia.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
100
+ `?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
101
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},Ha=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function Ua(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Wa(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 Ga(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 Ka(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 qa(e){if(e.length===0)return[];let t=e.length;loop: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 loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function Ja(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function Ya(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!Ua(t.start,`explicit-key-ind`)&&!Ua(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,Ga(t.value)?t.value.end?Ja(t.value.end,t.sep):t.value.end=t.sep:Ja(t.start,t.sep),delete t.sep)}var Xa=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new Va,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Pa(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source})}else{if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&Ya(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Wa(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.indent<t.indent))&&(e.type===`document`?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let e={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case`doc-start`:Wa(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===`map-value-ind`){let t=qa(Ka(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case`space`:case`comment`:case`newline`:e.props.push(this.sourceToken);return;case`scalar`:if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf(`
102
+ `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
103
+ `,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Ja(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,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(t.explicitKey){if(!t.sep){if(Ua(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=qa(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ua(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(Ga(t.key)&&!Ua(t.sep,`newline`)){let e=qa(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):Ua(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!Ua(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Ja(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||Ua(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=qa(Ka(t));Ya(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
104
+ `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
105
+ `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=qa(Ka(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=qa(Ka(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function Za(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Ha||null,prettyErrors:t}}function Qa(e,t={}){let{lineCounter:n,prettyErrors:r}=Za(t),i=new Xa(n?.addNewLine),a=new Oa(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new Wi(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(Ki(e,n)),o.warnings.forEach(Ki(e,n))),o}function $a(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=Qa(e,n);if(!i)return null;if(i.warnings.forEach(e=>wr(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function eo(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function to(e,t=`|`){return e.map(e=>Eo(e)).join(t)}function no(e,t){return typeof t==`bigint`?t.toString():t}var ro=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function io(e){return new ro(e)}function ao(e){return e==null}function oo(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function so(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function co(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function lo(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function uo(e){return lo(e._zod.def)??e._zod.def.shape}function fo(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return co(this,t,e),e},enumerable:!0,configurable:!0})}function po(e,t,n){t in e?co(e,t,n):e[t]=n}function mo(e,t,n,r){let i=uo(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?fo(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):po(e,a,r?r(n.value,a):n.value))}}function ho(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?fo(e,n,()=>t[n]):po(e,n,r.value))}}function B(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function go(e){return JSON.stringify(e)}function _o(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var vo=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function yo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var bo=io(()=>{if(hs.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function xo(e){if(yo(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return yo(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function So(e){return xo(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Co=new Set([`string`,`number`,`symbol`]);function wo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function To(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function V(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Eo(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Do(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Oo={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ko={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Ao(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return mo(i,e,jo(e,t)),To(e,B(n,{shape:i,checks:[]}))}function jo(e,t){let n=uo(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Mo(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(jo(e,t)),a={};return mo(a,e,Reflect.ownKeys(uo(e)).filter(e=>!i.has(e))),To(e,B(n,{shape:a,checks:[]}))}function No(e,t){if(!xo(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=uo(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return To(e,B(e._zod.def,{shape:Po(e,t)}))}function Po(e,t){let n={};return mo(n,e,Reflect.ownKeys(uo(e))),ho(n,t),n}function Fo(e,t){if(!xo(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return To(e,B(e._zod.def,{shape:Po(e,t)}))}function Io(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return mo(n,e,Reflect.ownKeys(uo(e))),mo(n,t,Reflect.ownKeys(uo(t))),To(e,B(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Lo(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(jo(t,n)):void 0,o={};return mo(o,t,Reflect.ownKeys(uo(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),To(t,B(t._zod.def,{shape:o,checks:[]}))}function Ro(e,t,n){let r=n?new Set(jo(t,n)):void 0,i={};return mo(i,t,Reflect.ownKeys(uo(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),To(t,B(t._zod.def,{shape:i}))}function zo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Bo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Vo(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ho(e){return typeof e==`string`?e:e?.message}function Uo(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Wo(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Go(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Ho(e.inst?._zod.def?.error?.(e))??Ho(a?.(e))??Ho(t?.error?.(e))??Ho(n.customError?.(e))??Ho(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Ko=/[\uD800-\uDBFF]/;function qo(e){let t=e.length;if(!Ko.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Jo(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Yo(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Xo(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Zo(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):ts(e,n,r.value)}}function Qo(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function $o(e,t,n){return Qo(e,t,n,!1)}function es(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Qo(this,n,r(this))},set(e){Qo(this,n,e)}})}return t}function ts(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Qo(this,t,n.bind(this))},set(e){Qo(this,t,e)}})}function ns(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var rs,is=!1,as={configurable:!0,get(){is=!0}};function H(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&rs!==e._zod?rs=void 0:(rs=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,as);let e=is;is=!1;try{let r=n(this);return is?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),is||=e,r}catch(n){throw delete this[t],is||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function os(e,t,n,r){let i=ns(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var ss=`~constantCatch`;function cs(e){let t=()=>e;return t[ss]=!0,t}var ls,us={value:void 0,enumerable:!1},ds=`captureStackTrace`in Error?Error:null;function fs(e){let t=ds;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return ds=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function U(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){us.value=new a(r);try{Object.defineProperty(n,"_zod",us)}finally{us.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Zo(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?fs(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var ps=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ms=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ls=globalThis).__zod_globalConfig??(ls.__zod_globalConfig={});var hs=globalThis.__zod_globalConfig;function gs(e){return e&&Object.assign(hs,e),hs}function _s(){let e=this._zod;return e.message??=JSON.stringify(e.def,no,2),e.message}function vs(e){this._zod.message=e}var ys={get:_s,set:vs,enumerable:!0,configurable:!0},bs={value:void 0,enumerable:!1},xs=new WeakSet([Object.prototype,Error.prototype]),Ss=U(`$ZodError`,(e,t)=>{e.name=`$ZodError`,bs.value=t,Object.defineProperty(e,"issues",bs),bs.value=void 0,Object.defineProperty(e,"message",ys);let n=Object.getPrototypeOf(e);xs.has(n)||(xs.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function Cs(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function ws(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Cs(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ts(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Es(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ds=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ps;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Go(e,o,gs())));throw vo(n,a?.callee??t),n}return s.value};return t},Os=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Go(e,o,gs())));throw vo(n,a?.callee??t),n}return s.value};return t},ks=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new ps;return a.issues.length?As(e,a.issues,i):{success:!0,data:a.value}};function As(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Go(e,n,gs()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var js=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?As(e,a.issues,i):{success:!0,data:a.value}},Ms=Symbol.for(`zod.compile.invalid`),Ns=Symbol.for(`zod.compile.fallback`),Ps=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Ms)return!0;if(r.definite===!0&&n===void 0)return!1}return Fs(e,t,n)});function Fs(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Ns]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new ps;return a.issues.length===0}var Is=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Ls=e=>{let t=Ds(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Es(n,a))};return n},Rs=e=>{let t=Ds(e),n=(e,r,i,a)=>t(e,r,i,Es(n,a));return n},zs=e=>{let t=Os(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Es(n,a))};return n},Bs=e=>{let t=Os(e),n=async(e,r,i,a)=>await t(e,r,i,Es(n,a));return n},Vs=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ks(e)(t,n,i)},Hs=e=>(t,n,r)=>ks(e)(t,n,r),Us=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return js(e)(t,n,i)},Ws=e=>async(t,n,r)=>js(e)(t,n,r),Gs=/^[cC][0-9a-z]{6,}$/,Ks=/^[0-9a-z]+$/,qs=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Js=/^[0-9a-vA-V]{20}$/,Ys=/^[A-Za-z0-9]{27}$/,Xs=/^[a-zA-Z0-9_-]{21}$/;function Zs(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Qs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$s=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ec=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,tc=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,nc=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function rc(){return new RegExp(nc,`u`)}var ic=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ac=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,oc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,sc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,lc=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,uc=/^https?$/,dc=/^\+[1-9]\d{6,14}$/,fc=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function pc(e){return RegExp(`^${e}$`)}var mc=pc(fc);function hc(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gc(e){return RegExp(`^${hc(e)}$`)}function _c(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${hc({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${hc({precision:e.precision})}`:n;return RegExp(`^${fc}T(?:${r})$`)}var vc=/^[\s\S]{0,}$/,yc=/^-?\d+(?:\.\d+)?$/,bc=/^(?:true|false)$/i,xc=/^[^A-Z]*$/,Sc=/^[^a-z]*$/,W=U(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Cc=e=>{let t=e.value;return!ao(t)&&t.length!==void 0},wc={number:`number`,bigint:`bigint`,object:`date`},Tc=U(`$ZodCheckLessThan`,(e,t)=>{W.init(e,t);let n=wc[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:wc[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ec=U(`$ZodCheckGreaterThan`,(e,t)=>{W.init(e,t);let n=wc[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:wc[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dc=U(`$ZodCheckMultipleOf`,(e,t)=>{W.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):so(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Oc=U(`$ZodCheckNumberFormat`,(e,t)=>{W.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Oo[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),kc=U(`$ZodCheckMaxLength`,(e,t)=>{var n;W.init(e,t),(n=e._zod.def).when??(n.when=Cc),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?qo(r):i)<=t.maximum)return;let a=Jo(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ac=U(`$ZodCheckMinLength`,(e,t)=>{var n;W.init(e,t),(n=e._zod.def).when??(n.when=Cc),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?qo(r):i)>=t.minimum)return;let a=Jo(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),jc=U(`$ZodCheckLengthEquals`,(e,t)=>{var n;W.init(e,t),(n=e._zod.def).when??(n.when=Cc),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?qo(r):i;if(a===t.length)return;let o=Jo(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Mc=U(`$ZodCheckStringFormat`,(e,t)=>{var n,r;W.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Nc=U(`$ZodCheckRegex`,(e,t)=>{Mc.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Pc=U(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=xc,Mc.init(e,t)}),Fc=U(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Sc,Mc.init(e,t)}),Ic=U(`$ZodCheckIncludes`,(e,t)=>{W.init(e,t);let n=wo(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Lc=U(`$ZodCheckStartsWith`,(e,t)=>{W.init(e,t);let n=RegExp(`^${wo(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Rc=U(`$ZodCheckEndsWith`,(e,t)=>{W.init(e,t);let n=RegExp(`.*${wo(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),zc=U(`$ZodCheckOverwrite`,(e,t)=>{W.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Bc=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
106
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
107
+ `)}\n};`)(...Object.values(this.closed))}},Vc={major:4,minor:6,patch:7},G=U(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Vc;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=zo(t),a;for(let o of n){if(o._zod.def.when){if(Bo(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new ps;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Wo(t.issues,n,e),i||=zo(t,n))});else{if(t.issues.length===n)continue;Wo(t.issues,n,e),i||=zo(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(zo(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new ps;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new ps;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return $o(this,`~standard`,Wc(this))},set"~standard"(e){Qo(this,`~standard`,e)}}),Hc=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Go(e,t,gs()))}:{value:e.value};async function Uc(e,t){let n={async:!0};return Hc(await e._zod.run({value:t,issues:[]},n),n)}function Wc(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Hc(r,n)}catch{}return Uc(e,t)},vendor:`zod`,version:1}}var Gc=U(`$ZodString`,(e,t)=>{G.init(e,t),e._zod.pattern=t.pattern??vc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),K=U(`$ZodStringFormat`,(e,t)=>{Mc.init(e,t),Gc.init(e,t)}),Kc=U(`$ZodGUID`,(e,t)=>{t.pattern??=$s,K.init(e,t)}),qc=U(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=ec(e)}else t.pattern??=ec();K.init(e,t)}),Jc=U(`$ZodEmail`,(e,t)=>{t.pattern??=tc,K.init(e,t)});function Yc(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Xc(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Yc(e)||2:Zc(e,t)}function Zc(e,t){if(!t.normalize&&t.protocol?.source===uc.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Qc=/[\t\n\r]/g;function $c(e){return e.replace(Qc,``)}function el(e,t){return t.lastIndex=0,t.test(e.hostname)}function tl(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var nl=U(`$ZodURL`,(e,t)=>{K.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Xc(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=$c(r);return}t.hostname&&!el(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!tl(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:$c(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),rl=U(`$ZodEmoji`,(e,t)=>{t.pattern??=rc(),K.init(e,t)}),il=U(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Xs:Zs(t.length),K.init(e,t)}),al=U(`$ZodCUID`,(e,t)=>{t.pattern??=Gs,K.init(e,t)}),ol=U(`$ZodCUID2`,(e,t)=>{t.pattern??=Ks,K.init(e,t)}),sl=U(`$ZodULID`,(e,t)=>{t.pattern??=qs,K.init(e,t)}),cl=U(`$ZodXID`,(e,t)=>{t.pattern??=Js,K.init(e,t)}),ll=U(`$ZodKSUID`,(e,t)=>{t.pattern??=Ys,K.init(e,t)}),ul=U(`$ZodISODateTime`,(e,t)=>{t.pattern??=_c(t),K.init(e,t)}),dl=U(`$ZodISODate`,(e,t)=>{t.pattern??=mc,K.init(e,t)}),fl=U(`$ZodISOTime`,(e,t)=>{t.pattern??=gc(t),K.init(e,t)}),pl=U(`$ZodISODuration`,(e,t)=>{t.pattern??=Qs,K.init(e,t)}),ml=U(`$ZodIPv4`,(e,t)=>{t.pattern??=ic,K.init(e,t)}),hl=/^[0-9a-fA-F:.]+$/;function gl(e){return hl.test(e)?Yc(`http://[${e}]`):!1}var _l=U(`$ZodIPv6`,(e,t)=>{t.pattern??=ac,K.init(e,t),e._zod.check=n=>{gl(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),vl=U(`$ZodCIDRv4`,(e,t)=>{t.pattern??=oc,K.init(e,t)});function yl(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:gl(n)}var bl=U(`$ZodCIDRv6`,(e,t)=>{t.pattern??=sc,K.init(e,t),e._zod.check=n=>{yl(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function xl(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Sl=/^[0-9a-zA-Z+/]*={0,2}$/,Cl=U(`$ZodBase64`,(e,t)=>{t.pattern??=Sl,K.init(e,t),e._zod.check=n=>{xl(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),wl=/^[A-Za-z0-9_-]*$/;function Tl(e){if(!wl.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return xl(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var El=U(`$ZodBase64URL`,(e,t)=>{t.pattern??=wl,K.init(e,t),e._zod.check=n=>{Tl(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Dl=U(`$ZodE164`,(e,t)=>{t.pattern??=dc,K.init(e,t)});function Ol(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var kl=U(`$ZodJWT`,(e,t)=>{K.init(e,t),e._zod.check=n=>{Ol(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Al=U(`$ZodNumber`,(e,t)=>{G.init(e,t),e._zod.pattern=yc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),jl=U(`$ZodNumberFormat`,(e,t)=>{Oc.init(e,t),Al.init(e,t)}),Ml=U(`$ZodBoolean`,(e,t)=>{G.init(e,t),e._zod.pattern=bc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Nl=U(`$ZodUnknown`,(e,t)=>{G.init(e,t),e._zod.parse=e=>e}),Pl=U(`$ZodNever`,(e,t)=>{G.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Fl(e,t){let n=Uo(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Uo(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Wo(n.issues,t,e),n}}return i(n,a)}}var Il=e=>Array.isArray(e)?e.length:-1;function Ll(e,t,n){e.issues.length&&t.issues.push(...Vo(n,e.issues)),t.value[n]=e.value}var Rl=U(`$ZodArray`,(e,t)=>{G.init(e,t);let n=hs.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Ll(t,r,e)));else if(Ll(c,r,e),s&&c.issues.length!==0&&zo(c))break}return o.length?Promise.all(o).then(()=>r):r},Fl(e,Il)});function zl(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Vo(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Bl=[];function Vl(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Bl,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Do(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Hl(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(zo(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>zl(e,n,i,t,d,f))):zl(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Ul=U(`$ZodObject`,(e,t)=>{G.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=io(()=>Vl(t));H(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||co(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=yo,o=t.catchall,s,c=hs.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(zo(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>zl(n,t,e,r,a,o))):zl(s,t,e,r,a,o)}return o?Hl(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Wl=U(`$ZodObjectJIT`,(e,t)=>{Ul.init(e,t);let n=e._zod.parse,r=io(()=>Vl(t)),i=hs.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Bc([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
108
+ let ${e}_ab = false;
109
+ for (let i = 0; i < ${e}.issues.length; i++) {
110
+ const iss = ${e}.issues[i];
111
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
112
+ payload.issues.push(iss);
113
+ if (iss.continue !== true) ${e}_ab = true;
114
+ }
115
+ if (${e}_ab && ctx && ctx.abortEarly) {
116
+ payload.value = newResult;
117
+ return payload;
118
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:go(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
119
+ const ${n}_present = ${i};
120
+ if (!${n}.issues.length || ${n}_present) {
121
+ if (${n}.issues.length) {${c(n,r)}
122
+ }
123
+
124
+ if (${e}) {
125
+ newResult[${r}] = ${n}.value;
126
+ }
127
+ }
128
+
129
+ `)}else f?(o.write(`
130
+ if (${n}.issues.length) {${c(n,r)}
131
+ }
132
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
133
+ if (${n}.value !== undefined || ${i}) {
134
+ newResult[${r}] = ${n}.value;
135
+ }
136
+ `)):o.write(`
137
+ const ${n}_present = ${i};
138
+ if (${n}.issues.length) {${c(n,r)}
139
+ }
140
+ if (!${n}_present && !${n}.issues.length) {
141
+ payload.issues.push({
142
+ code: "invalid_type",
143
+ expected: "nonoptional",
144
+ input: undefined,
145
+ path: [${r}]
146
+ });
147
+ if (ctx && ctx.abortEarly) {
148
+ payload.value = newResult;
149
+ return payload;
150
+ }
151
+ }
152
+
153
+ if (${n}_present) {
154
+ newResult[${r}] = ${n}.value;
155
+ }
156
+
157
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=yo,c=!hs.jitless,l=c&&bo.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Hl([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Gl(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!zo(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Go(e,r,gs())))}),t)}var Kl=U(`$ZodUnion`,(e,t)=>{G.init(e,t),H(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),H(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),H(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),H(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>oo(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Gl(t,r,e,i)):Gl(o,r,e,i)}}),ql=U(`$ZodIntersection`,(e,t)=>{G.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Yl(e,t,n)):Yl(e,i,a)}});function Jl(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(xo(e)&&xo(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Jl(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Jl(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Yl(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Jl(t.value,n.value);if(!c.valid){if(zo(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Xl=U(`$ZodTuple`,(e,t)=>{G.init(e,t);let n=t.items,r=hs.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=Zl(n,`optin`),l=Zl(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=zo(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(zo(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>Ql(t,i,e))):Ql(r,i,e)}}return s.length?Promise.all(s).then(()=>$l(u,i,n,o,l)):$l(u,i,n,o,l)}});function Zl(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function Ql(e,t,n){e.issues.length&&t.issues.push(...Vo(n,e.issues)),t.value[n]=e.value}function $l(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...Vo(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var eu=U(`$ZodEnum`,(e,t)=>{G.init(e,t);let n=eo(t.entries),r=new Set(n);e._zod.values=r,H(e,`pattern`,e=>{let t=eo(e.def.entries).filter(e=>Co.has(typeof e));return RegExp(t.length?`^(${t.map(e=>wo(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),tu=U(`$ZodTransform`,(e,t)=>{G.init(e,t),e._zod.optin=`optional`,hs.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ms(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new ps;return n.value=i,n}});function nu(e,t){return e.value=t.issues.length?void 0:t.value,e}var ru=U(`$ZodOptional`,(e,t)=>{G.init(e,t),H(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,H(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),H(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${oo(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>nu(e,t)):nu(e,r)}return t.innerType._zod.run(e,n)}}),iu=U(`$ZodExactOptional`,(e,t)=>{ru.init(e,t),H(e,`values`,e=>e.def.innerType._zod.values),H(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),au=U(`$ZodNullable`,(e,t)=>{G.init(e,t),H(e,`optin`,e=>e.def.innerType._zod.optin),H(e,`optout`,e=>e.def.innerType._zod.optout),H(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${oo(t.source)}|null)$`):void 0}),H(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ou=U(`$ZodDefault`,(e,t)=>{G.init(e,t),e._zod.optin=`defaulted`,H(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>su(e,t)):su(r,t)}});function su(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var cu=U(`$ZodPrefault`,(e,t)=>{G.init(e,t),e._zod.optin=`defaulted`,H(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),lu=U(`$ZodNonOptional`,(e,t)=>{G.init(e,t),H(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>uu(t,e)):uu(i,e)}});function uu(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function du(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Go(e,r,gs()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var fu=U(`$ZodCatch`,(e,t)=>{G.init(e,t),H(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),H(e,`optout`,e=>e.def.innerType._zod.optout),H(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>du(e,r,t,n)):du(e,r,t,n)}}),pu=U(`$ZodPipe`,(e,t)=>{G.init(e,t),H(e,`values`,e=>e.def.in._zod.values),H(e,`optin`,e=>e.def.in._zod.optin),H(e,`optout`,e=>e.def.out._zod.optout),H(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>mu(e,t.in,n)):mu(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>mu(e,t.out,n)):mu(r,t.out,n)}});function mu(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var hu=U(`$ZodReadonly`,(e,t)=>{G.init(e,t),H(e,`propValues`,e=>e.def.innerType._zod.propValues),H(e,`values`,e=>e.def.innerType._zod.values),H(e,`optin`,e=>e.def.innerType?._zod?.optin),H(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(gu):gu(r)}});function gu(e){return e.memo||(e.value=Object.freeze(e.value)),e}var _u=U(`$ZodCustom`,(e,t)=>{W.init(e,t),G.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>vu(t,n,r,e));vu(i,n,r,e)}});function vu(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Xo(e))}}var yu=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},bu=`~memo`,xu=[];function Su(e){return typeof e==`object`&&!!e}function Cu(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var wu=new WeakMap,Tu=0,Eu=1,Du=2;function Ou(e,t,n){let r=wu.get(e);if(r!==void 0)return r?Du:Tu;if(t.has(e))return Du;t.add(e);let i=Tu,a=e=>{if(i!==Du&&e?._zod){let r=Ou(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Tu;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Eu:o.value?._zod?Ou(o.value,t,n):Tu;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=lo(c);s(e?o(e,!0):Eu),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Ou(r,t,!1):Eu);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),ku(e,i)}function ku(e,t){return t!==Eu&&wu.set(e,t===Du),t}function Au(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var ju,Mu=[],Nu={alloc(e,t,n){let r=ju;if(!r)return n;ju=void 0;let i={value:n,issues:null};return r.set(t.value,i),Mu.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Fu(n,e.value))throw new yu;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Ou(e,new Set,!1);if(i===Tu)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Du||r?n=!0:r=!0}let l=s.value;if(!Su(l))return t(s,c);let u=c[bu];u||(u={buckets:new WeakMap,backEdges:void 0},c[bu]=u);let d;i===c?d=a:(d=Au(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Cu(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;ju=d;let p=Mu.length,m=t(s,c);ju=void 0;let h=Mu.length>p?Mu.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Cu(e.issues):xu),e)):(h&&(h.issues=m.issues.length?Cu(m.issues):xu),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Pu(){return Nu}function Fu(e,t){let n=e[bu]?.backEdges;return n!==void 0&&Su(t)&&n.has(t)}var Iu=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Yo(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Eo(e.values[0])}`:`Invalid option: expected one of ${to(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${to(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Lu(){return{localeError:Iu()}}var Ru,zu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Bu(){return new zu}(Ru=globalThis).__zod_globalRegistry??(Ru.__zod_globalRegistry=Bu());var Vu=globalThis.__zod_globalRegistry;function Hu(e){return e.checks&&=[...e.checks],e}function Uu(e,t){return new e(Hu({type:`string`,...V(t)}))}function Wu(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...V(t)})}function Gu(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...V(t)})}function Ku(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...V(t)})}function qu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...V(t)})}function Ju(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...V(t)})}function Yu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...V(t)})}function Xu(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...V(t)})}function Zu(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...V(t)})}function Qu(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...V(t)})}function $u(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...V(t)})}function ed(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...V(t)})}function td(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...V(t)})}function nd(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...V(t)})}function rd(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...V(t)})}function id(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...V(t)})}function ad(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...V(t)})}function od(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...V(t)})}function sd(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...V(t)})}function cd(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...V(t)})}function ld(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...V(t)})}function ud(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...V(t)})}function dd(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...V(t)})}function fd(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...V(t)})}function pd(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...V(t)})}function md(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...V(t)})}function hd(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...V(t)})}function gd(e,t){return new e(Hu({type:`number`,checks:[],...V(t)}))}function _d(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...V(t)})}function vd(e,t){return new e({type:`boolean`,...V(t)})}function yd(e){return new e({type:`unknown`})}function bd(e,t){return new e({type:`never`,...V(t)})}function xd(e,t){return new Tc({check:`less_than`,...V(t),value:e,inclusive:!1})}function Sd(e,t){return new Tc({check:`less_than`,...V(t),value:e,inclusive:!0})}function Cd(e,t){return new Ec({check:`greater_than`,...V(t),value:e,inclusive:!1})}function wd(e,t){return new Ec({check:`greater_than`,...V(t),value:e,inclusive:!0})}function Td(e,t){return new Dc({check:`multiple_of`,...V(t),value:e})}function Ed(e,t){return new kc({check:`max_length`,...V(t),maximum:e})}function Dd(e,t){return new Ac({check:`min_length`,...V(t),minimum:e})}function Od(e,t){return new jc({check:`length_equals`,...V(t),length:e})}function kd(e,t){return new Nc({check:`string_format`,format:`regex`,...V(t),pattern:e})}function Ad(e){return new Pc({check:`string_format`,format:`lowercase`,...V(e)})}function jd(e){return new Fc({check:`string_format`,format:`uppercase`,...V(e)})}function Md(e,t){return new Ic({check:`string_format`,format:`includes`,...V(t),includes:e})}function Nd(e,t){return new Lc({check:`string_format`,format:`starts_with`,...V(t),prefix:e})}function Pd(e,t){return new Rc({check:`string_format`,format:`ends_with`,...V(t),suffix:e})}function Fd(e){return new zc({check:`overwrite`,tx:e})}function Id(e){return Fd(t=>t.normalize(e))}function Ld(){return Fd(e=>e.trim())}function Rd(){return Fd(e=>e.toLowerCase())}function zd(){return Fd(e=>e.toUpperCase())}function Bd(){return Fd(e=>_o(e))}function Vd(e,t,n){return new e({type:`array`,element:t,...V(n)})}function Hd(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...V(n)})}function Ud(e,t){let n=Wd(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Xo(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Xo(r))}},e(t.value,t)),t);return n}function Wd(e,t){let n=new W({check:`custom`,...V(t)});return n._zod.check=e,n}function Gd(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&co(e,t,n[t]);return e}function Kd(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Vu,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function qd(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function q(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,q(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Gd(o.schema,c),t.io===`input`&&J(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Jd(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Yd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Jd(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Jd(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
158
+
159
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Xd(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Xd(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Zd=new Set([`type`,`properties`,`required`,`additionalProperties`]),Qd=[`oneOf`,`anyOf`];function $d(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ef(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Zd.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??$d(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}co(n,r,e.length===1?e[0]:ef(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=$d(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function tf(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Zd)if(t in e)return;let n=t.filter(e=>Qd.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ef(t);else{let e=n[0],i=Qd.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>ef([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Gd(e,r))}function nf(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Gd(i,s),Gd(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Xd(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])tf(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Gd(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,co(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:af(t,`input`,e.processors),output:af(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function J(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return J(r.element,n);if(r.type===`set`)return J(r.valueType,n);if(r.type===`lazy`)return J(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return J(r.innerType,n);if(r.type===`intersection`)return J(r.left,n)||J(r.right,n);if(r.type===`record`||r.type===`map`)return J(r.keyType,n)||J(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:J(r.in,n)||J(r.out,n);if(r.type===`object`){for(let e in r.shape)if(J(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(J(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(J(e,n))return!0;return!!(r.rest&&J(r.rest,n))}return!1}var rf=(e,t={})=>n=>{let r=Kd({...n,processors:t});return q(e,r),Yd(r,e),nf(r,e)},af=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Kd({...i??{},target:a,io:t,processors:n});return q(e,o),Yd(o,e),nf(o,e)},of=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},sf=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},cf=(e,t)=>{of(e,`minimum`,t),sf(e,`maximum`,t)},lf=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},uf=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},df=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},ff=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},pf=(e,t)=>of(e,`minimum`,t.minimum),mf=(e,t)=>sf(e,`maximum`,t.maximum),hf=e=>(t,n)=>{ff(t,n.format);let[r,i]=e[n.format];of(t,`minimum`,r),sf(t,`maximum`,i)},gf={greater_than:(e,t)=>of(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>sf(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>lf(e,t.value),number_format:hf(Oo),bigint_format:hf(ko),min_length:pf,max_length:mf,length_equals:(e,t)=>cf(e,t.length),min_size:pf,max_size:mf,size_equals:(e,t)=>cf(e,t.size),string_format:(e,t)=>{ff(e,t.format),t.pattern&&uf(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>df(e,t.mime)};function _f(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)gf[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&of(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&of(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&sf(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&sf(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&lf(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&df(t,i.mime);for(let e of i.patterns??[])uf(t,e);return t}var vf={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},yf=new Map([[Sl,cc],[wl,lc]]),bf=e=>yf.get(e)??e,xf=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=_f(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=vf[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(bf);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Sf=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=_f(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):qd(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Cf=(e,t,n,r)=>{n.type=`boolean`},wf=(e,t,n,r)=>{n.not={}},Tf=(e,t,n,r)=>{let i=e._zod.def,a=eo(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Ef=(e,t,n,r)=>{qd(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Df=(e,t,n,r)=>{qd(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Of=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=_f(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=q(a.element,t,{...r,path:[...r.path,`items`]})};function kf(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?kf(t.out):t.type===`catch`?kf(t.innerType):e._zod.optin}var Af=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&qd(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)co(i.properties,e,q(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?kf(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=q(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},jf=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>q(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Mf=(e,t,n,r)=>{let i=e._zod.def,a=q(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=q(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Nf=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>q(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?q(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?kf(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=_f(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)},Pf=(e,t,n,r)=>{let i=e._zod.def,a=q(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ff=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},If=Symbol();function Lf(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(qd(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),If):JSON.parse(o)}var Rf=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Lf(i.defaultValue,e,t,n,r);o!==If&&(n.default=o)},zf=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Lf(i.defaultValue,e,t,n,r);o!==If&&(n._prefault=o)},Bf=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{qd(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Vf=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;q(o,t,r);let s=t.seen.get(e);s.ref=o},Hf=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Uf=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Wf=new WeakSet([Object.prototype,Error.prototype]);function Gf(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Y=U(`ZodError`,(e,t)=>{Ss.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Wf.has(n)||(Wf.add(n),Gf(n,`format`,e=>t=>Ts(e,t)),Gf(n,`flatten`,e=>t=>ws(e,t)),Gf(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,no,2)}),Gf(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,no,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Kf=Ds(Y),qf=Os(Y),Jf=ks(Y),Yf=js(Y),Xf=Ls(Y),Zf=Rs(Y),Qf=zs(Y),$f=Bs(Y),ep=Vs(Y),tp=Hs(Y),np=Us(Y),rp=Ws(Y);function ip(){hs.localeError||gs(Lu())}function ap(){hs.memoizer||gs({memoizer:Pu()})}var X=U(`ZodType`,(e,t)=>(ip(),G.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(B(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return To(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(xm(e,t))},superRefine(e,t){return this.check(Sm(e,t))},overwrite(e){return this.check(Fd(e))},optional(){return rm(this)},exactOptional(){return am(this)},nullable(){return sm(this)},nullish(){return rm(sm(this))},nonoptional(e){return pm(this,e)},array(){return Up(this)},or(e){return qp([this,e])},and(e){return Yp(this,e)},transform(e){return _m(this,tm(e))},default(e){return lm(this,e)},prefault(e){return dm(this,e)},catch(e){return hm(this,e)},pipe(e){return _m(this,e)},readonly(){return ym(this)},describe(e){let t=this.clone();return Vu.add(t,{description:e}),t},meta(...e){if(e.length===0)return Vu.get(this);let t=this.clone();return Vu.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return $o(this,`~standard`,{...Wc(this),jsonSchema:{input:af(this,`input`),output:af(this,`output`)}})},set"~standard"(e){Qo(this,`~standard`,e)},parse:function e(t,n){return Kf(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await qf(this,t,n,{callee:e})},safeParse(e,t){return Jf(this,e,t)},async safeParseAsync(e,t){return Yf(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Qo(this,`spa`,e)},validate(e,t){return Ps(this,e,t)},validateAsync(e,t){return Is(this,e,t)},encode:function e(t,n){return Xf(this,t,n,{callee:e})},decode:function e(t,n){return Zf(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Qf(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await $f(this,t,n,{callee:e})},safeEncode(e,t){return ep(this,e,t)},safeDecode(e,t){return tp(this,e,t)},async safeEncodeAsync(e,t){return np(this,e,t)},async safeDecodeAsync(e,t){return rp(this,e,t)},toJSONSchema(e){return rf(this,{})(e)},get description(){return Vu.get(this)?.description},get _def(){return this._zod.def}}),op=U(`_ZodString`,(e,t)=>{Gc.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xf(e,t,n,r)},es({format:e=>_f(e).format??null,minLength:e=>_f(e).minimum??null,maxLength:e=>_f(e).maximum??null},{regex(...e){return this.check(kd(...e))},includes(...e){return this.check(Md(...e))},startsWith(...e){return this.check(Nd(...e))},endsWith(...e){return this.check(Pd(...e))},min(...e){return this.check(Dd(...e))},max(...e){return this.check(Ed(...e))},length(...e){return this.check(Od(...e))},nonempty(...e){return this.check(Dd(1,...e))},lowercase(e){return this.check(Ad(e))},uppercase(e){return this.check(jd(e))},trim(){return this.check(Ld())},normalize(...e){return this.check(Id(...e))},toLowerCase(){return this.check(Rd())},toUpperCase(){return this.check(zd())},slugify(){return this.check(Bd())}})),sp=U(`ZodString`,(e,t)=>{Gc.init(e,t),op.init(e,t)},{email(e){return this.check(Wu(pp,e))},url(e){return this.check(Xu(gp,e))},jwt(e){return this.check(dd(jp,e))},emoji(e){return this.check(Zu(_p,e))},guid(e){return this.check(Gu(mp,e))},uuid(e){return this.check(Ku(hp,e))},uuidv4(e){return this.check(qu(hp,e))},uuidv6(e){return this.check(Ju(hp,e))},uuidv7(e){return this.check(Yu(hp,e))},nanoid(e){return this.check(Qu(vp,e))},cuid(e){return this.check($u(yp,e))},cuid2(e){return this.check(ed(bp,e))},ulid(e){return this.check(td(xp,e))},base64(e){return this.check(cd(Op,e))},base64url(e){return this.check(ld(kp,e))},xid(e){return this.check(nd(Sp,e))},ksuid(e){return this.check(rd(Cp,e))},ipv4(e){return this.check(id(wp,e))},ipv6(e){return this.check(ad(Tp,e))},cidrv4(e){return this.check(od(Ep,e))},cidrv6(e){return this.check(sd(Dp,e))},e164(e){return this.check(ud(Ap,e))},datetime(e){return this.check(fd(lp,e))},date(e){return this.check(pd(up,e))},time(e){return this.check(md(dp,e))},duration(e){return this.check(hd(fp,e))}});function cp(e){return Uu(sp,e)}var Z=U(`ZodStringFormat`,(e,t)=>{K.init(e,t),op.init(e,t)}),lp=U(`ZodISODateTime`,(e,t)=>{ul.init(e,t),Z.init(e,t)}),up=U(`ZodISODate`,(e,t)=>{dl.init(e,t),Z.init(e,t)}),dp=U(`ZodISOTime`,(e,t)=>{fl.init(e,t),Z.init(e,t)}),fp=U(`ZodISODuration`,(e,t)=>{pl.init(e,t),Z.init(e,t)}),pp=U(`ZodEmail`,(e,t)=>{Jc.init(e,t),Z.init(e,t)}),mp=U(`ZodGUID`,(e,t)=>{Kc.init(e,t),Z.init(e,t)}),hp=U(`ZodUUID`,(e,t)=>{qc.init(e,t),Z.init(e,t)}),gp=U(`ZodURL`,(e,t)=>{nl.init(e,t),Z.init(e,t)}),_p=U(`ZodEmoji`,(e,t)=>{rl.init(e,t),Z.init(e,t)}),vp=U(`ZodNanoID`,(e,t)=>{il.init(e,t),Z.init(e,t)}),yp=U(`ZodCUID`,(e,t)=>{al.init(e,t),Z.init(e,t)}),bp=U(`ZodCUID2`,(e,t)=>{ol.init(e,t),Z.init(e,t)}),xp=U(`ZodULID`,(e,t)=>{sl.init(e,t),Z.init(e,t)}),Sp=U(`ZodXID`,(e,t)=>{cl.init(e,t),Z.init(e,t)}),Cp=U(`ZodKSUID`,(e,t)=>{ll.init(e,t),Z.init(e,t)}),wp=U(`ZodIPv4`,(e,t)=>{ml.init(e,t),Z.init(e,t)}),Tp=U(`ZodIPv6`,(e,t)=>{_l.init(e,t),Z.init(e,t)}),Ep=U(`ZodCIDRv4`,(e,t)=>{vl.init(e,t),Z.init(e,t)}),Dp=U(`ZodCIDRv6`,(e,t)=>{bl.init(e,t),Z.init(e,t)}),Op=U(`ZodBase64`,(e,t)=>{Cl.init(e,t),Z.init(e,t)}),kp=U(`ZodBase64URL`,(e,t)=>{El.init(e,t),Z.init(e,t)}),Ap=U(`ZodE164`,(e,t)=>{Dl.init(e,t),Z.init(e,t)}),jp=U(`ZodJWT`,(e,t)=>{kl.init(e,t),Z.init(e,t)}),Mp=U(`ZodNumber`,(e,t)=>{Al.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sf(e,t,n,r),e.isFinite=!0},es({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=_f(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=_f(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=_f(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>_f(e).format??null},{gt(e,t){return this.check(Cd(e,t))},gte(e,t){return this.check(wd(e,t))},min(e,t){return this.check(wd(e,t))},lt(e,t){return this.check(xd(e,t))},lte(e,t){return this.check(Sd(e,t))},max(e,t){return this.check(Sd(e,t))},int(e){return this.check(Fp(e))},safe(e){return this.check(Fp(e))},positive(e){return this.check(Cd(0,e))},nonnegative(e){return this.check(wd(0,e))},negative(e){return this.check(xd(0,e))},nonpositive(e){return this.check(Sd(0,e))},multipleOf(e,t){return this.check(Td(e,t))},step(e,t){return this.check(Td(e,t))},finite(){return this}}));function Np(e){return gd(Mp,e)}var Pp=U(`ZodNumberFormat`,(e,t)=>{jl.init(e,t),Mp.init(e,t)});function Fp(e){return _d(Pp,e)}var Ip=U(`ZodBoolean`,(e,t)=>{Ml.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cf(e,t,n,r)});function Lp(e){return vd(Ip,e)}var Rp=U(`ZodUnknown`,(e,t)=>{Nl.init(e,t),X.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function zp(){return yd(Rp)}var Bp=U(`ZodNever`,(e,t)=>{Pl.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wf(e,t,n,r)});function Vp(e){return bd(Bp,e)}var Hp=U(`ZodArray`,(e,t)=>{ap(),Rl.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Of(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Dd(e,t))},nonempty(e){return this.check(Dd(1,e))},max(e,t){return this.check(Ed(e,t))},length(e,t){return this.check(Od(e,t))},unwrap(){return this.element}});function Up(e,t){return Vd(Hp,e,t)}var Wp=U(`ZodObject`,(e,t)=>{ap(),Wl.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Af(e,t,n,r),os(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return $p(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(B(this._zod.def,{catchall:e}))},passthrough(){return this.clone(B(this._zod.def,{catchall:zp()}))},loose(){return this.clone(B(this._zod.def,{catchall:zp()}))},strict(){return this.clone(B(this._zod.def,{catchall:Vp()}))},strip(){return this.clone(B(this._zod.def,{catchall:void 0}))},extend(e){return No(this,e)},safeExtend(e){return Fo(this,e)},merge(e){return Io(this,e)},pick(e){return Ao(this,e)},omit(e){return Mo(this,e)},partial(...e){return Lo(nm,this,e[0])},exactPartial(...e){return Lo(im,this,e[0],`exactPartial`)},required(...e){return Ro(fm,this,e[0])}});function Gp(e,t){return new Wp({type:`object`,shape:e??{},...V(t)})}var Kp=U(`ZodUnion`,(e,t)=>{Kl.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jf(e,t,n,r),e.options=t.options});function qp(e,t){return new Kp({type:`union`,options:e,...V(t)})}var Jp=U(`ZodIntersection`,(e,t)=>{ql.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mf(e,t,n,r)});function Yp(e,t){return new Jp({type:`intersection`,left:e,right:t})}var Xp=U(`ZodTuple`,(e,t)=>{ap(),Xl.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nf(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new nm({type:`optional`,innerType:e}))})}});function Zp(e,t,n){let r=t instanceof G;return new Xp({type:`tuple`,items:e,rest:r?t:null,...V(r?n:t)})}var Qp=U(`ZodEnum`,(e,t)=>{eu.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tf(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Qp({...t,checks:[],...V(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Qp({...t,checks:[],...V(r),entries:i})}});function $p(e,t){return new Qp({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...V(t)})}var em=U(`ZodTransform`,(e,t)=>{ap(),tu.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Df(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ms(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Xo(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Xo(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function tm(e){return new em({type:`transform`,transform:e})}var nm=U(`ZodOptional`,(e,t)=>{ru.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rm(e){return new nm({type:`optional`,innerType:e})}var im=U(`ZodExactOptional`,(e,t)=>{iu.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function am(e){return new im({type:`optional`,innerType:e})}var om=U(`ZodNullable`,(e,t)=>{au.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sm(e){return new om({type:`nullable`,innerType:e})}var cm=U(`ZodDefault`,(e,t)=>{ou.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lm(e,t){return new cm({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():So(t)}})}var um=U(`ZodPrefault`,(e,t)=>{cu.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dm(e,t){return new um({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():So(t)}})}var fm=U(`ZodNonOptional`,(e,t)=>{lu.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ff(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pm(e,t){return new fm({type:`nonoptional`,innerType:e,...V(t)})}var mm=U(`ZodCatch`,(e,t)=>{fu.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hm(e,t){return new mm({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:cs(t)})}var gm=U(`ZodPipe`,(e,t)=>{pu.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vf(e,t,n,r),e.in=t.in,e.out=t.out});function _m(e,t){return new gm({type:`pipe`,in:e,out:t})}var vm=U(`ZodReadonly`,(e,t)=>{hu.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ym(e){return new vm({type:`readonly`,innerType:e})}var bm=U(`ZodCustom`,(e,t)=>{_u.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ef(e,t,n,r)});function xm(e,t={}){return Hd(bm,e,t)}function Sm(e,t){return Ud(e,t)}var Cm=.25,wm=Np().finite(),Tm=Np().finite().positive(),Em=Zp([wm,wm]),Dm=Gp({pads:Up(Gp({number:cp().regex(/^[1-9][0-9]*$/,`pad numbers are pin numbers: digits, starting at 1`),shape:$p([`rect`,`roundrect`,`circle`,`oval`]),x:wm,y:wm,width:Tm,height:Tm,rotation:wm.optional(),layers:$p([`top`,`through`]).optional(),drill:qp([Tm,Gp({width:Tm,height:Tm}).strict()]).optional()}).strict()).min(1),courtyard:Up(Em).min(3).optional(),silkscreen:Up(Up(Em).min(2)).optional(),body:Up(Em).min(3).optional(),placeholder:Lp().optional()}).strict();function Om(e,t){let n=t=>({error:`${e}: ${t}`}),r;try{r=$a(t)}catch(e){return n(`not valid YAML (${e.message.split(`
160
+ `)[0]})`)}let i=Dm.safeParse(Nm(r));if(!i.success)return n(i.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`; `));let a=km(i.data);return a.length>0?n(a.join(`; `)):Am(e,i.data)}function km(e){let t=[];for(let[n,r]of e.pads.entries()){let e=`pad ${r.number} (entry ${n+1})`,i=r.layers===`through`;i&&r.drill===void 0&&t.push(`${e} is a through pad and needs a drill`),!i&&r.drill!==void 0&&t.push(`${e} is a top pad and must not have a drill`)}return t}function Am(e,t){let n=t.pads.map(jm),r=([e,t])=>({x:e,y:t});return{name:e,pads:n,courtyard:t.courtyard?t.courtyard.map(r):Mm(n,Cm),silkscreen:(t.silkscreen??[]).map(e=>e.map(r)),fabrication:t.body?[(e=>[...e,...e[0]?[e[0]]:[]])(t.body.map(r))]:[],origin:`copperflow footprint file ${e}`,...t.placeholder?{placeholder:!0}:{}}}function jm(e){let t=typeof e.drill==`number`?{width:e.drill,height:e.drill}:e.drill;return{number:e.number,shape:e.shape,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation??0,layers:e.layers??`top`,...t?{drill:{...t}}:{}}}function Mm(e,t,n=[]){let r=n.map(e=>e.x),i=n.map(e=>e.y);for(let t of e){let e=t.rotation*Math.PI/180,n=(Math.abs(t.width*Math.cos(e))+Math.abs(t.height*Math.sin(e)))/2,a=(Math.abs(t.width*Math.sin(e))+Math.abs(t.height*Math.cos(e)))/2;r.push(t.x-n,t.x+n),i.push(t.y-a,t.y+a)}let a=Math.min(...r)-t,o=Math.max(...r)+t,s=Math.min(...i)-t,c=Math.max(...i)+t;return[{x:a,y:s},{x:o,y:s},{x:o,y:c},{x:a,y:c}]}function Nm(e){if(typeof e!=`object`||!e||!Array.isArray(e.pads))return e;let t=e.pads.map(e=>typeof e==`object`&&e&&Number.isInteger(e.number)?{...e,number:String(e.number)}:e);return{...e,pads:t}}var Pm=[`chips 0201 0402 0603 0805 1206 1210 1812 2010 2512`,`sod123 sod323`,`sma smb smc (do214ac do214aa do214ab)`,`sot23 sot23_5 sot23_6 sot223 sot89`,...jt.map(({form:e,pins:t})=>`${e} (N ${Fm(t)})`),`qfp32 qfp48 qfp64 qfp100, qfp<N>_<b>x<b>_p<pitch> (lqfp, tqfp)`,`qfn16 qfn32 qfn48 with _ep, qfn<N>_<b>x<b>_p<pitch>[_ep<size>]`,`dfn<N>_<a>x<b>_p<pitch>`,`bga<N>_<x>x<y>_p<pitch>`,`dip<N>[_w<spacing>]`,`to220 to92 hc49 hc49s`,`radial<can>x<spacing>`,`pinrow<N>[_p<pitch>] pinrow2x<N>`].join(`; `);function Fm(e){return e.length>2&&e.every((t,n)=>n===0||t-(e[n-1]??0)===2)?`even ${e[0]}–${e[e.length-1]}`:e.join(`, `)}var Im=[`0201`,`0402`,`0603`,`0805`,`1206`,`1210`,`1812`,`2010`,`2512`],Lm=(e,t,n)=>Array.from({length:Math.floor((t-e)/n)+1},(t,r)=>e+r*n),Rm=[...Im,`sod123`,`sod323`,`sot23`,`sot223`,`sot89`,`do214ac`,`do214aa`,`do214ab`,...jt.flatMap(({form:e,pins:t})=>t.map(t=>e.replace(`<N>`,String(t)))),...[`qfp`,`lqfp`,`tqfp`].flatMap(e=>[32,48,64,100].map(t=>`${e}${t}`)),...[16,32,48].map(e=>`qfn${e}`),...Lm(4,64,2).map(e=>`dip${e}`),`to220`,`to92`,`hc49`,`hc49s`,...Lm(1,40,1).map(e=>`pinrow${e}`)],zm=3,Bm=3,Vm=Rm.flatMap(e=>{let t=Tt(e);return t?[{text:e,kind:t.kind,number:Number(t.code||0),suffix:t.suffix??``}]:[]});function Hm(e){let t=Tt(e);if(!t)return[];let n=Number(t.code||0),r=t.suffix??``,i=e=>(e.suffix===r?0:Bm)+Math.abs(e.number-n);return Vm.filter(e=>e.kind===t.kind).sort((e,t)=>i(e)-i(t)||e.number-t.number||e.text.localeCompare(t.text)).slice(0,zm).sort((e,t)=>e.number-t.number||e.text.localeCompare(t.text)).map(e=>e.text)}function Um(e){let t=Hm(e);return`copperflow cannot make footprint "${e}":${t.length>0?` nearest are ${t.join(`, `)};`:``} known families are ${Pm} (see the skill's parts library reference)`}var Q=(e,t)=>({min:e,max:t}),Wm={label:`DO-214AC (SMA)`,span:Q(4.93,5.28),terminal:Q(.76,1.52),leadWidth:Q(1.25,1.65),bodyLength:Q(3.99,4.5),bodyWidth:Q(2.54,2.79)},Gm={label:`DO-214AA (SMB)`,span:Q(5.21,5.59),terminal:Q(.76,1.52),leadWidth:Q(1.95,2.2),bodyLength:Q(4.06,4.57),bodyWidth:Q(3.3,3.94)},Km={label:`DO-214AB (SMC)`,span:Q(7.75,8.13),terminal:Q(.76,1.52),leadWidth:Q(2.9,3.2),bodyLength:Q(6.6,7.11),bodyWidth:Q(5.59,6.22)},qm=new Map([[`sma`,Wm],[`smb`,Gm],[`smc`,Km],[`do214ac`,Wm],[`do214aa`,Gm],[`do214ab`,Km]]);function Jm(e){if(!(e.variant!==void 0||e.cross!==void 0||e.size!==void 0||e.pairs!==void 0||Object.keys(e.params).length>0))return`${e.kind}${e.code}${e.suffix??``}`}function Ym(e){if(e.kind===`do`&&e.code===`214`&&!qm.has(`do214${e.suffix??``}`))return D(`do214 needs a suffix: do214ac, do214aa or do214ab`);let t=Jm(e),n=t===void 0?void 0:qm.get(t);if(!t||!n)return;let r=ie(o({span:n.span,terminal:n.terminal,width:n.leadWidth},g.goals,c),g.roundOff),i={x:n.bodyLength.max/2,y:n.bodyWidth.max/2};return{name:t,pads:r,courtyard:E(r,{x:n.span.max/2,y:Math.max(n.bodyWidth.max,n.leadWidth.max)/2},g),silkscreen:[...me(r,i),he(r,i)],fabrication:fe(i),origin:`IPC-7351B nominal, ${n.label}`}}var Xm=1,Zm=1.7,Qm=.25,$m=1e3,eh=e=>String(w(e));function th(e,t){return`pinrow${e}_p${eh(t)}mm`}function nh(e,t,n=0){return{number:String(e),shape:e===1?`rect`:`circle`,x:t,y:n,width:Zm,height:Zm,rotation:0,layers:`through`,drill:{width:Xm,height:Xm}}}function rh(e){if(e.kind!==`pinrow`||e.variant!==void 0||Object.keys(e.params).some(e=>e!==`p`))return;let t=e.params.p??2.54;if(t===!0||t<=Zm)return;if(e.cross!==void 0)return sh(e,t);if(!Et(e))return;let n=Number(e.code);if(!Number.isInteger(n)||n<1||n>$m)return;let r=oe(n,t).map((e,t)=>nh(t+1,e));return{name:th(n,t),...ih(r),origin:`Fixed pin row, not an IPC-7351B calculation: ${eh(t)} mm pitch, ${Xm.toFixed(1)} mm drill, ${Zm.toFixed(1)} mm pads`}}function ih(e){let t=T(e),n=e=>({x:w(t.x+e),y:w(t.y+e)});return{pads:e,courtyard:ue(n(Qm)),silkscreen:[de(n(C))],fabrication:[]}}var ah=.3,oh=.1;function sh(e,t){let n=e.suffix===void 0&&e.size===void 0&&e.pairs===void 0,r=Number(e.cross);if(!n)return;if(e.code!==`2`)return D(`headers have one row (pinrow<N>) or two (pinrow2x<N>)`);if(!Number.isInteger(r)||r<1||r>$m/2)return D(`a two-row header has 1 to ${$m/2} pins a row`);let i=oe(r,t).flatMap((e,n)=>[nh(2*n+1,e,w(t/2)),nh(2*n+2,e,w(-t/2))]),a=ih(i),o=T(i),s=w(-(o.x+C+ah)),c=w(t/2+Zm/2);return{name:`pinrow2x${r}_p${eh(t)}mm`,...a,courtyard:ue({x:w(-s+oh),y:w(o.y+Qm)}),silkscreen:[...a.silkscreen,[{x:s,y:c},{x:s,y:w(c-Zm)}]],origin:`Fixed two-row pin header, not an IPC-7351B calculation: ${eh(t)} mm pitch, ${Xm.toFixed(1)} mm drill, ${Zm.toFixed(1)} mm pads`}}var ch=(e,t,n,r,i)=>({label:`LQFP-${e}`,pitch:t,span:n,terminal:A(.45,.75),leadWidth:r,bodyAcross:i,bodyAlong:i}),lh=new Map([[`32`,ch(32,.8,A(8.85,9.15),A(.3,.4),A(6.9,7.1))],[`48`,ch(48,.5,A(8.85,9.15),A(.17,.27),A(6.9,7.1))],[`64`,ch(64,.5,A(11.85,12.15),A(.17,.27),A(9.9,10.1))],[`100`,ch(100,.5,A(15.75,16.25),A(.17,.27),A(13.9,14.1))]]),uh=(e,t,n)=>({label:`QFN-${e}`,pitch:.5,span:t,terminal:A(.3,.5),leadWidth:A(.18,.3),bodyAcross:t,bodyAlong:t,exposedPad:n}),dh=new Map([[`16`,uh(16,A(2.9,3.1),A(1.45,1.75))],[`32`,uh(32,A(4.9,5.1),A(2.95,3.25))],[`48`,uh(48,A(6.9,7.1),A(4.95,5.25))]]);function fh(e,t,n){let r=oe(e/4,t),i=[...r].reverse(),a=n.centre,o=(e,t)=>({x:e,y:t,width:n.length,height:n.width}),s=(e,t)=>({x:e,y:t,width:n.width,height:n.length});return[...i.map(e=>o(-a,e)),...r.map(e=>s(e,-a)),...r.map(e=>o(a,e)),...i.map(e=>s(e,a))].map((e,t)=>S(String(t+1),e.x,e.y,e.width,e.height))}var ph=new Set([`qfn`,...new Set([`qfp`,`lqfp`,`tqfp`])]);function mh(e){if(ph.has(e.kind)&&e.variant===void 0)return e.size?_h(e,e.size):hh(e)}function hh(e){let t=e.kind===`qfn`,n=t?dh.get(e.code):lh.get(e.code);if(!n||!Et(e)||!rt(e.params,n,t?[`ep`]:[]))return;let r=e.params.ep===!0&&n.exposedPad?gh(n.exposedPad):void 0;return vh(e.kind+e.code+(r?`_ep`:``),Number(e.code),n,t,r)}var gh=e=>{let t=w((e.min+e.max)/2);return{x:t,y:t}};function _h(e,t){let n=e.kind===`qfn`,r=n?`QFN`:`QFP`,i=e.params.p;if(e.cross!==void 0||e.suffix!==void 0)return;if(typeof i!=`number`)return D(`a ${r} named by its body needs its pitch, such as _p0.5`);let a=n?rn(e.code,t,i):on(e.code,t,i);if(Te(a))return a;let o=n?ke(e,r):Oe(e)?void 0:D(`a QFP takes only _p`);return Te(o)?o:vh(`${e.kind}${e.code}_${O(t[0])}x${O(t[1])}_p${O(i)}${o?`_ep${De(o)}`:``}`,Number(e.code),a,n,o)}function vh(e,t,n,r,i){let{row:a,table:o}=r?et(n):$e(n),s=fh(t,n.pitch,a),c=i?[...s,S(String(t+1),0,0,i.x,i.y)]:s,l=Ae(c,i!==void 0);if(l)return l;let u=n.bodyAcross.max/2,d=Math.max(n.span.max,n.bodyAcross.max)/2;return{name:e,pads:c,courtyard:E(c,{x:d,y:d},o),silkscreen:ye(s,{x:u,y:u}),fabrication:fe({x:u,y:u}),origin:`IPC-7351B nominal, ${n.label}${i?` with exposed pad`:``}`}}var yh=[{upTo:7.99,lead:A(.4,.5)},{upTo:10,lead:A(.55,.65)},{upTo:1/0,lead:A(.75,.85)}],bh=3,xh=40,Sh=.4;function Ch(e){let t=w(e.y+e.height/2+C+.05+Sh);return[[{x:w(e.x-Sh),y:t},{x:w(e.x+Sh),y:t}],[{x:w(e.x),y:w(t-Sh)},{x:w(e.x),y:w(t+Sh)}]]}function wh(e){let t=e.suffix===void 0&&e.size===void 0&&e.pairs===void 0&&e.variant===void 0;if(e.kind!==`radial`||!t||Object.keys(e.params).length>0)return;if(e.cross===void 0)return D(`a radial capacitor is radial<can diameter>x<lead spacing>, such as radial6.3x2.5`);let n=Number(e.code),r=Number(e.cross),i=yh.find(e=>n<=e.upTo)?.lead;if(!i||n<bh||n>xh)return D(`the can is ${bh} to ${xh} mm across`);if(r<=0||r>=n)return D(`the leads must be closer together than the ${O(n)} mm can is wide`);let a=ut(lt(i));if(r-a.pad<.1)return D(`${a.pad} mm lands ${O(r)} mm apart would touch`);let o=[dt(`1`,w(-r/2),0,a,!0),dt(`2`,w(r/2),0,a)],s=n/2,c=Math.max(s,r/2+a.pad*Math.SQRT2/2+C);return{name:`radial${O(n)}x${O(r)}`,pads:o,courtyard:E(o,{x:c,y:c},ct),silkscreen:[be({x:0,y:0},c,0,360,5),...Ch(o[0])],fabrication:[be({x:0,y:0},s,0,360,5)],origin:`Through-hole, radial electrolytic ${O(n)} mm can, leads ${O(r)} mm apart: ${a.drill} mm holes, ${a.pad} mm lands (IPC-2222 level B)`}}var Th=(e,t)=>({min:e,max:t}),Eh={123:{label:`SOD-123`,span:Th(3.55,3.85),terminal:Th(.25,.4),leadWidth:Th(.52,.62),bodyLength:Th(2.55,2.85),bodyWidth:Th(1.4,1.7)},323:{label:`SOD-323`,span:Th(2.3,2.7),terminal:Th(.2,.4),leadWidth:Th(.25,.35),bodyLength:Th(1.6,1.8),bodyWidth:Th(1.2,1.4)}};function Dh(e){if(!Object.hasOwn(Eh,e))return;let t=Eh[e],n={span:t.span,terminal:t.terminal,width:t.leadWidth},r=ie(o(n,y(n,t.bodyLength.max),c),f.roundOff),i={x:t.bodyLength.max/2,y:t.bodyWidth.max/2},a={x:Math.max(t.span.max,t.bodyLength.max)/2,y:Math.max(t.bodyWidth.max,t.leadWidth.max)/2};return{name:`sod${e}`,pads:r,courtyard:E(r,a,f),silkscreen:[...me(r,i),he(r,i)],fabrication:fe(i),origin:`IPC-7351B nominal, ${t.label}`}}var Oh={pkg:{label:`SOT-23`,pitch:.95,span:A(2.1,2.5),terminal:A(.15,.45),leadWidth:A(.38,.48),bodyAcross:A(1.2,1.4),bodyAlong:A(2.8,3)},bottom:[-1,1],top:[0]},kh=e=>({label:`SOT-23-${e}`,pitch:.95,span:A(2.7,3),terminal:A(.35,.55),leadWidth:A(.35,.5),bodyAcross:A(1.5,1.7),bodyAlong:A(2.9,3.1)}),Ah=new Map([[void 0,Oh],[`5`,{pkg:kh(5),bottom:[-1,0,1],top:[1,-1]}],[`6`,{pkg:kh(6),bottom:[-1,0,1],top:[1,0,-1]}]]);function jh(e,t,n,r){let i=t=>w(t*e.pkg.pitch),a=e.bottom.map((e,a)=>S(String(a+1),i(e),-t,r,n)),o=e.bottom.length+1,s=e.top.map((e,a)=>S(String(o+a),i(e),t,r,n));return[...a,...s]}function Mh(e){let t=e.kind===`sot`&&e.code===`23`?Ah.get(e.variant):void 0;if(!t||!Et(e)||!rt(e.params,t.pkg))return;let{pkg:n}=t,{row:r,table:i}=$e(n),a=jh(t,r.centre,r.length,r.width),o={x:n.bodyAlong.max/2,y:n.bodyAcross.max/2},s=Math.max(...[...t.bottom,...t.top].map(Math.abs))*n.pitch+n.leadWidth.max/2,c={x:Math.max(o.x,s),y:n.span.max/2};return{name:e.variant===void 0?`sot23`:`sot23_${e.variant}`,pads:a,courtyard:E(a,c,i),silkscreen:_e(a,o),fabrication:fe(o),origin:`IPC-7351B nominal, ${n.label}`}}var Nh={pkg:{label:`SOT-223`,pitch:2.3,span:A(6.7,7.3),terminal:A(.7,1.1),leadWidth:A(.6,.8),bodyAcross:A(3.3,3.7),bodyAlong:A(6.3,6.7)},tabWidth:A(2.9,3.1),tabNumber:`4`},Ph={pkg:{label:`SOT-89`,pitch:1.5,span:A(3.94,4.25),terminal:A(.89,1.2),leadWidth:A(.44,.56),bodyAcross:A(2.4,2.6),bodyAlong:A(4.4,4.6)},tabWidth:A(1.62,1.83),tabNumber:`2`,tabUnderBody:!0},Fh=new Map([[`223`,Nh],[`89`,Ph]]),Ih=.3;function Lh(e){let{row:t}=$e(e.pkg),n=$e({...e.pkg,leadWidth:e.tabWidth}).row,r=e.pkg.pitch,i=[-r,0,r].map((e,n)=>S(String(n+1),e,-t.centre,t.width,t.length)),a=n.centre+n.length/2,o=e.tabUnderBody?-t.centre+t.length/2+Ih:n.centre-n.length/2;return[...i,S(e.tabNumber,0,w((a+o)/2),n.width,w(a-o))]}function Rh(e,t){let n=T(e),r=w(Math.max(t.x,n.x+C)),i=w(t.y);return[[{x:-r,y:-w(n.y)},{x:-r,y:i}],[{x:r,y:-i},{x:r,y:i}]]}function zh(e){let t=e.kind===`sot`?Fh.get(e.code):void 0;if(!t||!Et(e)||e.variant!==void 0||Object.keys(e.params).length>0)return;let{pkg:n}=t,{table:r}=$e(n),i=Lh(t),a={x:n.bodyAlong.max/2,y:n.bodyAcross.max/2},o=n.pitch+n.leadWidth.max/2,s={x:Math.max(a.x,o,t.tabWidth.max/2),y:n.span.max/2};return{name:`sot${e.code}`,pads:i,courtyard:E(i,s,r),silkscreen:Rh(i,a),fabrication:fe(a),origin:`IPC-7351B nominal, ${n.label}`}}var Bh=2.54,Vh=A(.7,.9),Hh=A(.45,.6),Uh=10.66,Wh=-2,Gh=2.5,Kh=1.23,qh=Uh/2;function Jh(){let[e,t,n]=[w(qh),w(Wh),w(Gh)];return[{x:-e,y:t},{x:e,y:t},{x:e,y:n},{x:-e,y:n},{x:-e,y:t}]}function Yh(e){let t=Et(e)&&e.variant===void 0&&Object.keys(e.params).length===0;if(e.kind!==`to`||e.code!==`220`||!t)return;let n=ut(lt(Vh,Hh)),r=oe(3,Bh).map((e,t)=>dt(String(t+1),e,0,n,t===0)),i=[{x:-w(qh),y:w(Kh)},{x:w(qh),y:w(Kh)}];return{name:`to220`,pads:r,courtyard:E(r,{x:qh,y:Math.max(2,Gh)},ct),silkscreen:[Jh(),i,we(r[0],-2.3)],fabrication:[Jh(),i],origin:`Through-hole, TO-220 upright: ${n.drill} mm holes, ${n.pad} mm lands (IPC-2222 level B)`}}var Xh=2.54,Zh=A(.36,.53),Qh=A(.36,.51),$h=5.21/2,eg=-1.5850000000000004;function tg(){let e=Math.asin(eg/$h)*180/Math.PI;return be({x:0,y:0},$h,e,180-e,2).concat([be({x:0,y:0},$h,e,e)[0]])}function ng(e){let t=Et(e)&&e.variant===void 0&&Object.keys(e.params).length===0;if(e.kind!==`to`||e.code!==`92`||!t)return;let n=ut(lt(Zh,Qh)),r=[-2.54,0,Xh].map((e,t)=>dt(String(t+1),e,0,n,t===0)),i=tg();return{name:`to92`,pads:r,courtyard:E(r,{x:$h,y:$h},ct),silkscreen:[...Se(i,r),we(r[0],w(-1.8850000000000005))],fabrication:[i],origin:`Through-hole, TO-92 with leads formed to 2.54 mm: ${n.drill} mm holes, ${n.pad} mm lands (IPC-2222 level B)`}}var rg=e=>Et(e)&&e.variant===void 0&&Object.keys(e.params).length===0,ig=[e=>e.kind===``&&rg(e)?Ze(e.code):void 0,e=>e.kind===`sod`&&rg(e)?Dh(e.code):void 0,Mh,zh,Ym,Ft,mh,sn,qe,rh,_n,Yh,ng,yt,wh],ag=512,og=new Map,sg=/^parts\/[A-Za-z0-9._-]+\/footprint\.yaml$/,cg=e=>e.includes(`/`);function lg(e,t){if(cg(e))return fg(ug(e,t));let n=og.get(e);if(n)return n;let r=fg(dg(e));return og.size>=ag&&og.delete(og.keys().next().value),og.set(e,r),r}function ug(e,t){if(!sg.test(e)||e.split(`/`).some(e=>e.includes(`..`)))return{error:`"${e}" is not a footprint file: only parts/<id>/footprint.yaml can be read`};if(!t)return{error:`"${e}" is a footprint file and needs a way to read files`};let n=t(e);return n===void 0?{error:`${e}: footprint file not found`}:Om(e,n)}function dg(e){let t=Tt(e);if(t)for(let n of ig){let r=n(t);if(Te(r))return{error:`copperflow cannot make footprint "${e}": ${r.refused}`};if(r)return r}return{error:Um(e)}}function fg(e){if(typeof e==`object`&&e&&!Object.isFrozen(e)){for(let t of Object.values(e))fg(t);Object.freeze(e)}return e}var pg=`Type a footprint string such as soic8, qfn32_5x5_p0.5 or hc49s.`;function mg(e,t){let n=e.trim();if(n===``)return{error:pg};if(n.includes(`/`))return{error:`"${n}" is not a footprint string`};let r=lg(n);if(`error`in r)return{error:r.error};let i=gg([...r.courtyard,...r.silkscreen.flat(),...r.fabrication.flat(),...r.pads.flatMap(hg)]),a=Math.min((t.width-20)/Math.max(i.width,1e-6),(t.height-20)/Math.max(i.height,1e-6)),o=e=>({x:t.width/2+(e.x-i.cx)*a,y:t.height/2-(e.y-i.cy)*a}),s=r.pads.map(e=>{let t=o(e);return{number:e.number,shape:e.shape,x:t.x,y:t.y,width:e.width*a,height:e.height*a,rotation:-e.rotation,through:e.layers===`through`,...e.drill?{drill:Math.min(e.drill.width,e.drill.height)*a}:{}}}),c=gg(r.courtyard),l=r.pads.length;return{pads:s,courtyard:r.courtyard.map(o),silkscreen:r.silkscreen.map(e=>e.map(o)),body:r.fabrication.map(e=>e.map(o)),scale:a,summary:`${l} pad${l===1?``:`s`}, courtyard ${_g(c.width)} × ${_g(c.height)} mm`}}function hg(e){let[t,n]=[e.width/2,e.height/2],r=e.rotation*Math.PI/180,[i,a]=[Math.cos(r),Math.sin(r)];return[[-t,-n],[t,-n],[t,n],[-t,n]].map(([t=0,n=0])=>({x:e.x+t*i-n*a,y:e.y+t*a+n*i}))}function gg(e){let t=e.map(e=>e.x),n=e.map(e=>e.y),[r,i,a,o]=[Math.min(...t),Math.max(...t),Math.min(...n),Math.max(...n)];return{width:i-r,height:o-a,cx:(r+i)/2,cy:(a+o)/2}}var _g=e=>Number(e.toFixed(2)),vg=[`power_in`,`power_out`,`ground`,`input`,`output`,`bidirectional`,`passive`,`no_connect`],yg=/^[A-Za-z](?:[A-Za-z0-9._-]{0,62}[A-Za-z0-9])?$/,bg=/^[1-9][0-9]*$/,xg=/^[A-Za-z_][A-Za-z0-9_]*$/,Sg=`${vg.slice(0,-1).join(`, `)} or ${vg[vg.length-1]}`;function Cg(e){let t=e.split(/\r?\n/),n=Tg(t),r=t.findIndex(e=>e.trim()!==``),i=[],a=[],o=new Map;return t.forEach((e,t)=>{let s=e.trim();if(s===``)return;let c=Eg(s,n);if(t===r&&Og(s,c[0]??``))return;let l=t+1,u=kg(c,o);typeof u==`string`?a.push({line:l,text:s,message:`Line ${l}: ${u}`}):(o.set(u.number,l),i.push(u))}),{pins:i,errors:a}}function wg(e){let t=e.replace(/[^A-Za-z0-9_]/g,`_`);return/^[A-Za-z_]/.test(t)?t:`_${t}`}function Tg(e){let t=e.map(e=>e.trim()).filter(e=>e!==``);return t.some(e=>e.includes(` `))?`tab`:t.some(e=>/^[^\s,]+\s*,/.test(e))?`comma`:t.some(e=>/ {2,}/.test(e))?`spaces`:`space`}function Eg(e,t){let n={tab:/\t/,comma:/,/,spaces:/ {2,}/,space:/\s+/}[t],r=t===`space`||t===`spaces`&&!/ {2,}/.test(e),i=e.split(r?/\s+/:n).map(e=>e.trim());return r&&i.length>3?[...i.slice(0,3),i.slice(3).join(` `)]:i}var Dg=/\b(pin|no|number|name|type|function|description)\b/i;function Og(e,t){return!/[0-9]/.test(e)||!bg.test(t)&&Dg.test(e)}function kg(e,t){let[n=``,r=``,i=``,...a]=e;if(!bg.test(n))return`"${n}" is not a pin number; pins are numbered 1, 2, 3 …`;let o=t.get(n);if(o!==void 0)return`pin ${n} is already on line ${o}`;if(r===``)return`pin ${n} has no name`;if(!xg.test(r))return`"${r}" is not a pin name; use letters, digits and _, starting with a letter (e.g. ${wg(r)})`;let s=i===``?`passive`:Ag(i);if(!s)return`"${i}" is not a pin type; use ${Sg}`;let c=a.filter(e=>e!==``).join(`, `);return{number:n,name:r,type:s,...c?{description:c}:{}}}function Ag(e){let t=e.toLowerCase().replace(/[-\s]+/g,`_`);return vg.find(e=>e===t)}var jg={id:``,title:``,manufacturer:``,mpn:``,packageKind:`string`,packageText:``,pins:[],suppliers:[{supplier:`lcsc`,number:``}],datasheet:``,replace:!1},Mg=/^[a-z0-9_]+$/,Ng=e=>e.number.trim()===``&&e.name.trim()===``,Pg=(e,t)=>(Number(e.number)||1/0)-(Number(t.number)||1/0);function Fg(e){let t=Math.max(0,...e.map(e=>Number(e.number)).filter(e=>Number.isInteger(e)));return[...e,{number:String(t+1),name:``,type:`passive`,description:``}]}function Ig(e,t,n){return e.map((e,r)=>r===t?{...e,...n}:e)}function Lg(e,t){return e.filter((e,n)=>n!==t)}function Rg(e,t){let n=Cg(t),r=new Map(n.pins.map(e=>[e.number,{...e,description:e.description??``}]));return{pins:[...e.filter(e=>!Ng(e)&&!r.has(e.number.trim())),...r.values()].sort(Pg),errors:n.errors}}function zg(e){let t=e.id.trim(),n=e.title.trim(),r=Vg(e.pins),i=Hg(e.suppliers),a=e.datasheet.trim(),o=[...t===``?[`Give the part an id, such as its part number.`]:yg.test(t)&&!t.includes(`..`)?[]:[`"${t}" is not a part id: start with a letter, end with a letter or digit, and use letters, digits, ".", "_" or "-".`],...n===``?[`Give the part a title.`]:[],...Bg(e),...r.problems,...i.problems,...a===``||/^https?:\/\/\S+$/.test(a)?[]:[`The datasheet link must start with http:// or https://.`]];if(o.length>0)return{problems:o};let s=t=>e[t].trim()?{[t]:e[t].trim()}:{};return{id:t,title:n,...s(`manufacturer`),...s(`mpn`),package:e.packageKind===`file`?{file:`footprint.yaml`}:e.packageText.trim(),pins:r.rows,...Object.keys(i.record).length>0?{suppliers:i.record}:{},...a?{datasheet:{url:a}}:{},replace:e.replace}}function Bg(e){if(e.packageKind===`file`)return[];let t=e.packageText.trim();if(t===``)return[`Type a footprint string such as soic8, or choose a footprint file.`];if(t.includes(`/`))return[`"${t}" is not a footprint string.`];let n=lg(t);return`error`in n?[n.error]:[]}function Vg(e){let t=e.map((e,t)=>({pin:e,row:t+1})).filter(({pin:e})=>!Ng(e));if(t.length===0)return{rows:[],problems:[`Add the pins: type them in the rows or paste the datasheet's pin table.`]};let n=[],r=[],i=new Map;for(let{pin:e,row:a}of t){let[t,o,s]=[e.number.trim(),e.name.trim(),e.description.trim()],c=e=>r.push(`Pin row ${a}: ${e}`);if(!bg.test(t)){c(`"${t}" is not a pin number; pins are numbered 1, 2, 3 ….`);continue}let l=i.get(t);l===void 0?i.set(t,a):c(`pin ${t} is already in row ${l}.`),o===``?c(`pin ${t} has no name.`):xg.test(o)||c(`"${o}" is not a pin name; use letters, digits and _, starting with a letter (e.g. ${wg(o)}).`),n.push({number:t,name:o,type:e.type,...s?{description:s}:{}})}return{rows:n,problems:r}}function Hg(e){let t={},n=[];for(let r of e){let[e,i]=[r.supplier.trim(),r.number.trim()];if(e===``&&i===``)continue;let a=e.toLowerCase();if(!Mg.test(a)||i===``||a in t){let t=a.split(/[^a-z0-9_]/)[0]||`lcsc`;n.push(`Supplier "${e}": name it with lower-case letters, digits and _ (e.g. ${t}) and give its part number.`)}else t[a]=i}return{record:t,problems:n}}var $=r(),Ug={width:240,height:150},Wg={board:t.background,pad:t.topCopper,throughPad:t.multiLayer,drill:t.drill,outline:t.topAssembly,silk:t.topSilk};function Gg(e,t){let n=window.devicePixelRatio||1;e.width=Ug.width*n,e.height=Ug.height*n;let r=e.getContext(`2d`);if(!r)return;r.setTransform(n,0,0,n,0,0),r.fillStyle=Wg.board,r.fillRect(0,0,Ug.width,Ug.height);let i=(e,t,n,i=[])=>{r.strokeStyle=t,r.lineWidth=1,r.setLineDash(i);for(let t of e)r.beginPath(),t.forEach((e,t)=>t===0?r.moveTo(e.x,e.y):r.lineTo(e.x,e.y)),n&&r.closePath(),r.stroke();r.setLineDash([])};i([t.courtyard],Wg.outline,!0,[3,3]),i(t.body,Wg.outline,!1),i(t.silkscreen,Wg.silk,!1);for(let e of t.pads)r.save(),r.translate(e.x,e.y),r.rotate(e.rotation*Math.PI/180),r.fillStyle=e.through?Wg.throughPad:Wg.pad,r.beginPath(),e.shape===`circle`||e.shape===`oval`?r.ellipse(0,0,e.width/2,e.height/2,0,0,2*Math.PI):r.rect(-e.width/2,-e.height/2,e.width,e.height),r.fill(),e.drill&&(r.fillStyle=Wg.drill,r.beginPath(),r.arc(0,0,e.drill/2,0,2*Math.PI),r.fill()),r.restore();let a=t.pads.find(e=>e.number===`1`);a&&(r.fillStyle=Wg.silk,r.font=`10px sans-serif`,r.fillText(`1`,a.x-a.width/2-8,a.y+3))}function Kg({text:e}){let t=(0,a.useRef)(null),n=(0,a.useMemo)(()=>mg(e,Ug),[e]);return(0,a.useEffect)(()=>{t.current&&!(`error`in n)&&Gg(t.current,n)},[n]),`error`in n?(0,$.jsx)(`p`,{className:`new-part-preview-note`,children:n.error}):(0,$.jsxs)(`figure`,{className:`new-part-preview`,children:[(0,$.jsx)(`canvas`,{ref:t,style:Ug,role:`img`,"aria-label":`Footprint ${e.trim()}: ${n.summary}`}),(0,$.jsx)(`figcaption`,{children:n.summary})]})}function qg({pins:e,onChange:t}){return(0,$.jsxs)(`table`,{className:`new-part-pins`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Pin`}),(0,$.jsx)(`th`,{children:`Name`}),(0,$.jsx)(`th`,{children:`Type`}),(0,$.jsx)(`th`,{children:`Description`}),(0,$.jsx)(`th`,{})]})}),(0,$.jsx)(`tbody`,{children:e.map((n,r)=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsx)(`input`,{"aria-label":`Row ${r+1} pin number`,value:n.number,onChange:n=>t(Ig(e,r,{number:n.target.value}))})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`input`,{"aria-label":`Row ${r+1} pin name`,value:n.name,onChange:n=>t(Ig(e,r,{name:n.target.value}))})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`select`,{"aria-label":`Row ${r+1} pin type`,value:n.type,onChange:n=>t(Ig(e,r,{type:n.target.value})),children:vg.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`input`,{"aria-label":`Row ${r+1} description`,value:n.description,onChange:n=>t(Ig(e,r,{description:n.target.value}))})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`button`,{type:`button`,"aria-label":`Remove row ${r+1}`,onClick:()=>t(Lg(e,r)),children:`×`})})]},r))})]})}function Jg({pins:e,onChange:t}){let[n,r]=(0,a.useState)(``),[i,o]=(0,a.useState)([]),s=(0,a.useId)();return(0,$.jsxs)(`div`,{className:`new-part-paste`,children:[(0,$.jsx)(`label`,{htmlFor:s,children:`Paste a pin table: one pin per line, "1 VDD power_in", tab or comma separated; no type means passive.`}),(0,$.jsx)(`textarea`,{id:s,rows:4,value:n,onChange:e=>r(e.target.value)}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>{let i=Rg(e,n);t(i.pins),o(i.errors),i.errors.length===0&&r(``)},disabled:n.trim()===``,children:`Add pasted pins`}),i.length>0&&(0,$.jsx)(`ul`,{role:`alert`,children:i.map(e=>(0,$.jsx)(`li`,{children:e.message},e.line))})]})}function Yg({fields:e,onChange:t}){let n=(n,r,i)=>t(e.map((e,t)=>t===n?{...e,[r]:i}:e));return(0,$.jsxs)($.Fragment,{children:[e.map((e,t)=>(0,$.jsxs)(`div`,{className:`new-part-supplier`,children:[(0,$.jsx)(`input`,{"aria-label":`Supplier ${t+1}`,placeholder:`lcsc`,value:e.supplier,onChange:e=>n(t,`supplier`,e.target.value)}),(0,$.jsx)(`input`,{"aria-label":`Supplier ${t+1} part number`,placeholder:`C16212`,value:e.number,onChange:e=>n(t,`number`,e.target.value)})]},t)),(0,$.jsx)(`button`,{type:`button`,className:`new-part-add`,onClick:()=>t([...e,{supplier:``,number:``}]),children:`Add supplier`})]})}function Xg({result:e}){return(0,$.jsxs)(`div`,{className:`import-result`,role:`status`,children:[(0,$.jsx)(`p`,{children:(0,$.jsx)(`strong`,{children:i(e)})}),e.notes.length>0&&(0,$.jsx)(`ul`,{children:e.notes.map(e=>(0,$.jsx)(`li`,{children:e},e))}),(0,$.jsx)(`h3`,{children:`Written`}),(0,$.jsx)(`ul`,{children:e.files.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(`code`,{children:e})},e))}),(0,$.jsx)(`h3`,{children:(0,$.jsx)(`code`,{children:e.verification})}),(0,$.jsx)(`pre`,{className:`new-part-checklist`,children:e.checklist})]})}function Zg({panel:e,onClose:t}){let[n,r]=(0,a.useState)(()=>({...jg,pins:Fg([])})),[i,o]=(0,a.useState)([]),[s,c]=(0,a.useState)(!1),[l,u]=(0,a.useState)(),d=(0,a.useId)(),f=(e,t)=>r(n=>({...n,[e]:t})),p=async r=>{if(r.preventDefault(),s)return;if(l)return t();let i=zg(n);if(`problems`in i)return o(i.problems);c(!0),o([]);try{u(await e.create(i))}catch(e){o([e.message])}finally{c(!1)}};if(l)return(0,$.jsxs)(`form`,{className:`rules-form new-part-form`,onSubmit:e=>void p(e),children:[(0,$.jsx)(Xg,{result:l}),(0,$.jsx)(`button`,{type:`submit`,children:`Close`})]});let m=(e,t,r)=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{htmlFor:`${d}-${e}`,children:t}),(0,$.jsx)(`input`,{id:`${d}-${e}`,value:n[e],placeholder:r,onChange:t=>f(e,t.target.value)})]});return(0,$.jsxs)(`form`,{className:`rules-form new-part-form`,onSubmit:e=>void p(e),children:[(0,$.jsxs)(`fieldset`,{className:`new-part-fields`,disabled:s,children:[m(`id`,`Part id`,`AP2112K-3.3`),m(`title`,`Title`,`3.3 V LDO regulator`),m(`manufacturer`,`Manufacturer`,`Diodes Incorporated`),m(`mpn`,`MPN`,`AP2112K-3.3TRG1`),(0,$.jsx)(`span`,{children:`Package`}),(0,$.jsxs)(`div`,{className:`new-part-package`,children:[(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`radio`,name:`${d}-kind`,checked:n.packageKind===`string`,onChange:()=>f(`packageKind`,`string`)}),` Footprint string`]}),(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`radio`,name:`${d}-kind`,checked:n.packageKind===`file`,onChange:()=>f(`packageKind`,`file`)}),` Footprint file`]})]}),n.packageKind===`string`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{htmlFor:`${d}-package`,children:`Footprint`}),(0,$.jsx)(`input`,{id:`${d}-package`,value:n.packageText,placeholder:`soic8, qfn32_5x5_p0.5, hc49s`,onChange:e=>f(`packageText`,e.target.value)}),(0,$.jsx)(Kg,{text:n.packageText})]}):(0,$.jsx)(`p`,{children:`footprint.yaml is written as a placeholder, one pad per pin. The schematic can use the part now; the board reports an error for it until you draw its pads from the datasheet's land pattern and delete "placeholder: true".`}),(0,$.jsx)(`h3`,{children:`Pins`}),(0,$.jsx)(qg,{pins:n.pins,onChange:e=>f(`pins`,e)}),(0,$.jsx)(`button`,{type:`button`,className:`new-part-add`,onClick:()=>f(`pins`,Fg(n.pins)),children:`Add pin`}),(0,$.jsx)(Jg,{pins:n.pins,onChange:e=>f(`pins`,e)}),(0,$.jsx)(`h3`,{children:`Suppliers`}),(0,$.jsx)(Yg,{fields:n.suppliers,onChange:e=>f(`suppliers`,e)}),m(`datasheet`,`Datasheet URL`,`https://…`),(0,$.jsxs)(`label`,{className:`make-sheet-rename`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:n.replace,onChange:e=>f(`replace`,e.target.checked)}),`Replace a part with this id that is not verified`]})]}),i.length>0&&(0,$.jsx)(`ul`,{className:`new-part-problems`,role:`alert`,children:i.map(e=>(0,$.jsx)(`li`,{children:e},e))}),(0,$.jsx)(`p`,{children:`The part is written unverified; check it against the datasheet in its verification.md.`}),(0,$.jsx)(`button`,{type:`submit`,disabled:s,children:s?`Writing…`:`Create part`})]})}export{Zg as NewPartForm};