zudoku 0.3.0-dev.9 → 0.3.0-dev.90

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 (663) hide show
  1. package/cli.js +5 -1
  2. package/dist/app/App.d.ts +1 -2
  3. package/dist/app/App.js +1 -29
  4. package/dist/app/App.js.map +1 -1
  5. package/dist/app/demo.d.ts +2 -0
  6. package/dist/app/demo.js +33 -0
  7. package/dist/app/demo.js.map +1 -0
  8. package/dist/app/entry.client.d.ts +2 -0
  9. package/dist/app/entry.client.js +35 -0
  10. package/dist/app/entry.client.js.map +1 -0
  11. package/dist/app/entry.server.d.ts +14 -0
  12. package/dist/app/entry.server.js +105 -0
  13. package/dist/app/entry.server.js.map +1 -0
  14. package/dist/app/main.d.ts +6 -1
  15. package/dist/app/main.js +74 -12
  16. package/dist/app/main.js.map +1 -1
  17. package/dist/app/standalone.d.ts +2 -0
  18. package/dist/app/standalone.js +38 -0
  19. package/dist/app/standalone.js.map +1 -0
  20. package/dist/app/tailwind.d.ts +1 -1
  21. package/dist/app/tailwind.js +0 -4
  22. package/dist/app/tailwind.js.map +1 -1
  23. package/dist/cli/cmds/dev.js +5 -0
  24. package/dist/cli/cmds/dev.js.map +1 -1
  25. package/dist/cli/dev/handler.d.ts +1 -0
  26. package/dist/cli/dev/handler.js +3 -1
  27. package/dist/cli/dev/handler.js.map +1 -1
  28. package/dist/config/config.d.ts +21 -46
  29. package/dist/config/validators/InputSidebarSchema.d.ts +176 -0
  30. package/dist/config/validators/InputSidebarSchema.js +71 -0
  31. package/dist/config/validators/InputSidebarSchema.js.map +1 -0
  32. package/dist/config/validators/SidebarSchema.d.ts +17 -0
  33. package/dist/config/validators/SidebarSchema.js +76 -0
  34. package/dist/config/validators/SidebarSchema.js.map +1 -0
  35. package/dist/config/validators/validate.d.ts +1263 -2
  36. package/dist/config/validators/validate.js +170 -1
  37. package/dist/config/validators/validate.js.map +1 -1
  38. package/dist/index.d.ts +1 -1
  39. package/dist/internal.d.ts +1 -0
  40. package/dist/internal.js +2 -0
  41. package/dist/internal.js.map +1 -0
  42. package/dist/lib/authentication/AuthenticationPlugin.d.ts +13 -0
  43. package/dist/lib/authentication/AuthenticationPlugin.js +31 -0
  44. package/dist/lib/authentication/AuthenticationPlugin.js.map +1 -0
  45. package/dist/lib/authentication/authentication.d.ts +10 -9
  46. package/dist/lib/authentication/components/SignIn.d.ts +1 -0
  47. package/dist/lib/authentication/components/SignIn.js +14 -0
  48. package/dist/lib/authentication/components/SignIn.js.map +1 -0
  49. package/dist/lib/authentication/components/SignOut.d.ts +1 -0
  50. package/dist/lib/authentication/components/SignOut.js +12 -0
  51. package/dist/lib/authentication/components/SignOut.js.map +1 -0
  52. package/dist/lib/authentication/components/SignUp.d.ts +1 -0
  53. package/dist/lib/authentication/components/SignUp.js +10 -0
  54. package/dist/lib/authentication/components/SignUp.js.map +1 -0
  55. package/dist/lib/authentication/hook.js +4 -4
  56. package/dist/lib/authentication/hook.js.map +1 -1
  57. package/dist/lib/authentication/providers/auth0.js +11 -6
  58. package/dist/lib/authentication/providers/auth0.js.map +1 -1
  59. package/dist/lib/authentication/providers/clerk.js +59 -30
  60. package/dist/lib/authentication/providers/clerk.js.map +1 -1
  61. package/dist/lib/authentication/providers/openid.d.ts +30 -7
  62. package/dist/lib/authentication/providers/openid.js +79 -29
  63. package/dist/lib/authentication/providers/openid.js.map +1 -1
  64. package/dist/lib/authentication/state.js +1 -1
  65. package/dist/lib/authentication/state.js.map +1 -1
  66. package/dist/lib/components/Bootstrap.d.ts +13 -0
  67. package/dist/lib/components/Bootstrap.js +12 -0
  68. package/dist/lib/components/Bootstrap.js.map +1 -0
  69. package/dist/lib/components/DevPortal.d.ts +5 -23
  70. package/dist/lib/components/DevPortal.js +43 -20
  71. package/dist/lib/components/DevPortal.js.map +1 -1
  72. package/dist/lib/components/DeveloperHint.d.ts +5 -0
  73. package/dist/lib/components/DeveloperHint.js +10 -0
  74. package/dist/lib/components/DeveloperHint.js.map +1 -0
  75. package/dist/lib/components/ErrorPage.d.ts +6 -0
  76. package/dist/lib/components/ErrorPage.js +9 -0
  77. package/dist/lib/components/ErrorPage.js.map +1 -0
  78. package/dist/lib/components/Header.js +23 -4
  79. package/dist/lib/components/Header.js.map +1 -1
  80. package/dist/lib/components/Heading.d.ts +9 -4
  81. package/dist/lib/components/Heading.js +17 -2
  82. package/dist/lib/components/Heading.js.map +1 -1
  83. package/dist/lib/components/InlineCode.d.ts +5 -0
  84. package/dist/lib/components/InlineCode.js +4 -0
  85. package/dist/lib/components/InlineCode.js.map +1 -0
  86. package/dist/lib/components/Layout.js +7 -5
  87. package/dist/lib/components/Layout.js.map +1 -1
  88. package/dist/lib/components/NotFoundPage.d.ts +1 -0
  89. package/dist/lib/components/NotFoundPage.js +12 -0
  90. package/dist/lib/components/NotFoundPage.js.map +1 -0
  91. package/dist/lib/components/SlotletProvider.d.ts +9 -0
  92. package/dist/lib/components/SlotletProvider.js +11 -0
  93. package/dist/lib/components/SlotletProvider.js.map +1 -0
  94. package/dist/lib/components/SyntaxHighlight.d.ts +3 -2
  95. package/dist/lib/components/SyntaxHighlight.js +24 -22
  96. package/dist/lib/components/SyntaxHighlight.js.map +1 -1
  97. package/dist/lib/components/TopNavigation.d.ts +1 -1
  98. package/dist/lib/components/TopNavigation.js +8 -4
  99. package/dist/lib/components/TopNavigation.js.map +1 -1
  100. package/dist/lib/components/context/ThemeContext.d.ts +1 -4
  101. package/dist/lib/components/context/ThemeContext.js +3 -29
  102. package/dist/lib/components/context/ThemeContext.js.map +1 -1
  103. package/dist/lib/components/context/ThemeProvider.d.ts +4 -0
  104. package/dist/lib/components/context/ThemeProvider.js +23 -0
  105. package/dist/lib/components/context/ThemeProvider.js.map +1 -0
  106. package/dist/lib/components/context/ZudokuContext.d.ts +15 -0
  107. package/dist/lib/components/context/ZudokuContext.js +43 -0
  108. package/dist/lib/components/context/ZudokuContext.js.map +1 -0
  109. package/dist/lib/components/context/ZudokuProvider.d.ts +5 -0
  110. package/dist/lib/components/context/ZudokuProvider.js +16 -0
  111. package/dist/lib/components/context/ZudokuProvider.js.map +1 -0
  112. package/dist/lib/components/index.d.ts +32 -3
  113. package/dist/lib/components/index.js +21 -3
  114. package/dist/lib/components/index.js.map +1 -1
  115. package/dist/lib/components/navigation/Sidebar.d.ts +1 -0
  116. package/dist/lib/components/navigation/Sidebar.js +12 -0
  117. package/dist/lib/components/navigation/Sidebar.js.map +1 -0
  118. package/dist/lib/components/navigation/SidebarBadge.d.ts +22 -0
  119. package/dist/lib/components/navigation/SidebarBadge.js +24 -0
  120. package/dist/lib/components/navigation/SidebarBadge.js.map +1 -0
  121. package/dist/lib/components/navigation/SidebarCategory.d.ts +5 -0
  122. package/dist/lib/components/navigation/SidebarCategory.js +33 -0
  123. package/dist/lib/components/navigation/SidebarCategory.js.map +1 -0
  124. package/dist/lib/components/navigation/SidebarItem.d.ts +12 -0
  125. package/dist/lib/components/navigation/SidebarItem.js +42 -0
  126. package/dist/lib/components/navigation/SidebarItem.js.map +1 -0
  127. package/dist/lib/components/navigation/{SideNavigationWrapper.d.ts → SidebarWrapper.d.ts} +1 -1
  128. package/dist/lib/components/navigation/{SideNavigationWrapper.js → SidebarWrapper.js} +2 -2
  129. package/dist/lib/components/navigation/SidebarWrapper.js.map +1 -0
  130. package/dist/lib/components/navigation/utils.d.ts +16 -0
  131. package/dist/lib/components/navigation/utils.js +85 -0
  132. package/dist/lib/components/navigation/utils.js.map +1 -0
  133. package/dist/lib/core/DevPortalContext.d.ts +58 -42
  134. package/dist/lib/core/DevPortalContext.js +18 -19
  135. package/dist/lib/core/DevPortalContext.js.map +1 -1
  136. package/dist/lib/core/plugins.d.ts +25 -10
  137. package/dist/lib/core/plugins.js +3 -0
  138. package/dist/lib/core/plugins.js.map +1 -1
  139. package/dist/lib/errors/ErrorAlert.d.ts +3 -0
  140. package/dist/lib/errors/ErrorAlert.js +8 -0
  141. package/dist/lib/errors/ErrorAlert.js.map +1 -0
  142. package/dist/lib/errors/RouterError.d.ts +1 -0
  143. package/dist/lib/errors/RouterError.js +12 -0
  144. package/dist/lib/errors/RouterError.js.map +1 -0
  145. package/dist/lib/errors/ServerError.d.ts +3 -0
  146. package/dist/lib/errors/ServerError.js +6 -0
  147. package/dist/lib/errors/ServerError.js.map +1 -0
  148. package/dist/lib/errors/TopLevelError.d.ts +2 -0
  149. package/dist/lib/errors/TopLevelError.js +7 -0
  150. package/dist/lib/errors/TopLevelError.js.map +1 -0
  151. package/dist/lib/oas/graphql/index.js +8 -5
  152. package/dist/lib/oas/graphql/index.js.map +1 -1
  153. package/dist/lib/oas/parser/index.d.ts +1 -1
  154. package/dist/lib/oas/parser/index.js +38 -12
  155. package/dist/lib/oas/parser/index.js.map +1 -1
  156. package/dist/lib/plugins/{api-key → api-keys}/CreateApiKey.js +4 -4
  157. package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -0
  158. package/dist/lib/plugins/api-keys/ProtectedRoute.d.ts +1 -0
  159. package/dist/lib/plugins/api-keys/ProtectedRoute.js +14 -0
  160. package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -0
  161. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +54 -0
  162. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -0
  163. package/dist/lib/plugins/{api-key → api-keys}/index.d.ts +4 -5
  164. package/dist/lib/plugins/{api-key → api-keys}/index.js +18 -20
  165. package/dist/lib/plugins/api-keys/index.js.map +1 -0
  166. package/dist/lib/plugins/custom-page/index.d.ts +8 -0
  167. package/dist/lib/plugins/custom-page/index.js +12 -0
  168. package/dist/lib/plugins/custom-page/index.js.map +1 -0
  169. package/dist/lib/plugins/markdown/MdxPage.d.ts +3 -2
  170. package/dist/lib/plugins/markdown/MdxPage.js +10 -40
  171. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  172. package/dist/lib/plugins/markdown/Toc.js +17 -9
  173. package/dist/lib/plugins/markdown/Toc.js.map +1 -1
  174. package/dist/lib/plugins/markdown/generateRoutes.d.ts +3 -3
  175. package/dist/lib/plugins/markdown/generateRoutes.js +20 -43
  176. package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
  177. package/dist/lib/plugins/markdown/index.d.ts +4 -1
  178. package/dist/lib/plugins/markdown/index.js +3 -7
  179. package/dist/lib/plugins/markdown/index.js.map +1 -1
  180. package/dist/lib/plugins/openapi/ColorizedParam.d.ts +2 -1
  181. package/dist/lib/plugins/openapi/ColorizedParam.js +14 -9
  182. package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
  183. package/dist/lib/plugins/openapi/OperationList.js +17 -5
  184. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  185. package/dist/lib/plugins/openapi/OperationListItem.js +11 -5
  186. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  187. package/dist/lib/plugins/openapi/ParameterList.js +2 -1
  188. package/dist/lib/plugins/openapi/ParameterList.js.map +1 -1
  189. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  190. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  191. package/dist/lib/plugins/openapi/{MakeRequest.d.ts → PlaygroundDialogWrapper.d.ts} +2 -1
  192. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js +23 -0
  193. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -0
  194. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +3 -9
  195. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  196. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +1 -1
  197. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  198. package/dist/lib/plugins/openapi/Route.d.ts +6 -0
  199. package/dist/lib/plugins/openapi/Route.js +8 -0
  200. package/dist/lib/plugins/openapi/Route.js.map +1 -0
  201. package/dist/lib/plugins/openapi/SchemaListView.js +10 -26
  202. package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -1
  203. package/dist/lib/plugins/openapi/SchemaListViewItem.d.ts +8 -0
  204. package/dist/lib/plugins/openapi/SchemaListViewItem.js +25 -0
  205. package/dist/lib/plugins/openapi/SchemaListViewItem.js.map +1 -0
  206. package/dist/lib/plugins/openapi/SchemaListViewItemGroup.d.ts +8 -0
  207. package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js +17 -0
  208. package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js.map +1 -0
  209. package/dist/lib/plugins/openapi/Sidecar.d.ts +4 -0
  210. package/dist/lib/plugins/openapi/Sidecar.js +55 -21
  211. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  212. package/dist/lib/plugins/openapi/SidecarBox.d.ts +1 -0
  213. package/dist/lib/plugins/openapi/SidecarBox.js +3 -2
  214. package/dist/lib/plugins/openapi/SidecarBox.js.map +1 -1
  215. package/dist/lib/plugins/openapi/{Select.d.ts → SimpleSelect.d.ts} +3 -2
  216. package/dist/lib/plugins/openapi/SimpleSelect.js +5 -0
  217. package/dist/lib/plugins/openapi/SimpleSelect.js.map +1 -0
  218. package/dist/lib/plugins/openapi/StaggeredRender.d.ts +8 -0
  219. package/dist/lib/plugins/openapi/StaggeredRender.js +18 -0
  220. package/dist/lib/plugins/openapi/StaggeredRender.js.map +1 -0
  221. package/dist/lib/plugins/openapi/client/createMemoryClient.d.ts +12 -0
  222. package/dist/lib/plugins/openapi/client/createMemoryClient.js +46 -0
  223. package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +1 -0
  224. package/dist/lib/plugins/openapi/client/createServer.d.ts +4 -0
  225. package/dist/lib/plugins/openapi/client/createServer.js +30 -0
  226. package/dist/lib/plugins/openapi/client/createServer.js.map +1 -0
  227. package/dist/lib/plugins/openapi/client/createWorkerClient.d.ts +10 -0
  228. package/dist/lib/plugins/openapi/{worker/createSharedWorkerClient.js → client/createWorkerClient.js} +15 -2
  229. package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +1 -0
  230. package/dist/lib/plugins/openapi/client/interfaces.d.ts +4 -0
  231. package/dist/lib/plugins/openapi/client/interfaces.js +2 -0
  232. package/dist/lib/plugins/openapi/client/interfaces.js.map +1 -0
  233. package/dist/lib/plugins/openapi/{worker → client}/worker.js +2 -2
  234. package/dist/lib/plugins/openapi/client/worker.js.map +1 -0
  235. package/dist/lib/plugins/openapi/context.d.ts +5 -0
  236. package/dist/lib/plugins/openapi/context.js +11 -0
  237. package/dist/lib/plugins/openapi/context.js.map +1 -0
  238. package/dist/lib/plugins/openapi/graphql/gql.d.ts +6 -6
  239. package/dist/lib/plugins/openapi/graphql/gql.js +1 -1
  240. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  241. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +15 -15
  242. package/dist/lib/plugins/openapi/graphql/graphql.js +67 -67
  243. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  244. package/dist/lib/plugins/openapi/index.d.ts +4 -18
  245. package/dist/lib/plugins/openapi/index.js +76 -32
  246. package/dist/lib/plugins/openapi/index.js.map +1 -1
  247. package/dist/lib/plugins/openapi/interfaces.d.ts +15 -0
  248. package/dist/lib/plugins/openapi/interfaces.js +2 -0
  249. package/dist/lib/plugins/openapi/interfaces.js.map +1 -0
  250. package/dist/lib/plugins/openapi/playground/Headers.js +1 -1
  251. package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
  252. package/dist/lib/plugins/openapi/playground/PathParams.d.ts +4 -5
  253. package/dist/lib/plugins/openapi/playground/PathParams.js +9 -13
  254. package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
  255. package/dist/lib/plugins/openapi/playground/Playground.d.ts +26 -14
  256. package/dist/lib/plugins/openapi/playground/Playground.js +54 -26
  257. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  258. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.d.ts +5 -0
  259. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +12 -0
  260. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -0
  261. package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +4 -3
  262. package/dist/lib/plugins/openapi/playground/QueryParams.js +21 -12
  263. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
  264. package/dist/lib/plugins/openapi/playground/ResponseTab.d.ts +4 -0
  265. package/dist/lib/plugins/openapi/playground/ResponseTab.js +40 -0
  266. package/dist/lib/plugins/openapi/playground/ResponseTab.js.map +1 -0
  267. package/dist/lib/plugins/openapi/playground/createUrl.d.ts +1 -1
  268. package/dist/lib/plugins/openapi/playground/createUrl.js +5 -9
  269. package/dist/lib/plugins/openapi/playground/createUrl.js.map +1 -1
  270. package/dist/lib/plugins/openapi/util/prose.d.ts +1 -0
  271. package/dist/lib/plugins/openapi/util/prose.js +4 -0
  272. package/dist/lib/plugins/openapi/util/prose.js.map +1 -0
  273. package/dist/lib/plugins/openapi-worker.d.ts +1 -1
  274. package/dist/lib/plugins/openapi-worker.js +1 -1
  275. package/dist/lib/plugins/openapi-worker.js.map +1 -1
  276. package/dist/lib/plugins/redirect/index.d.ts +0 -1
  277. package/dist/lib/plugins/redirect/index.js +3 -4
  278. package/dist/lib/plugins/redirect/index.js.map +1 -1
  279. package/dist/lib/ui/Button.d.ts +5 -1
  280. package/dist/lib/ui/Button.js +24 -1
  281. package/dist/lib/ui/Button.js.map +1 -1
  282. package/dist/lib/ui/Callout.js +2 -2
  283. package/dist/lib/ui/Callout.js.map +1 -1
  284. package/dist/lib/ui/Card.js +1 -1
  285. package/dist/lib/ui/Card.js.map +1 -1
  286. package/dist/lib/ui/DropdownMenu.d.ts +27 -0
  287. package/dist/lib/ui/DropdownMenu.js +36 -0
  288. package/dist/lib/ui/DropdownMenu.js.map +1 -0
  289. package/dist/lib/ui/Input.js.map +1 -0
  290. package/dist/lib/util/MdxComponents.d.ts +2 -2
  291. package/dist/lib/util/MdxComponents.js +7 -5
  292. package/dist/lib/util/MdxComponents.js.map +1 -1
  293. package/dist/lib/util/fetchTimeout.d.ts +1 -0
  294. package/dist/lib/util/fetchTimeout.js +14 -0
  295. package/dist/lib/util/fetchTimeout.js.map +1 -0
  296. package/dist/lib/util/groupBy.d.ts +1 -6
  297. package/dist/lib/util/groupBy.js +10 -8
  298. package/dist/lib/util/groupBy.js.map +1 -1
  299. package/dist/lib/util/invariant.d.ts +6 -0
  300. package/dist/lib/util/invariant.js +21 -0
  301. package/dist/lib/util/invariant.js.map +1 -0
  302. package/dist/lib/util/joinPath.js +2 -1
  303. package/dist/lib/util/joinPath.js.map +1 -1
  304. package/dist/lib/util/logInit.d.ts +1 -0
  305. package/dist/lib/util/logInit.js +9 -0
  306. package/dist/lib/util/logInit.js.map +1 -0
  307. package/dist/lib/util/objectEntries.d.ts +4 -0
  308. package/dist/lib/util/objectEntries.js +2 -0
  309. package/dist/lib/util/objectEntries.js.map +1 -0
  310. package/dist/lib/util/renderIf.d.ts +1 -0
  311. package/dist/lib/util/renderIf.js +2 -0
  312. package/dist/lib/util/renderIf.js.map +1 -0
  313. package/dist/lib/util/requestIdleCallbackPolyfill.d.ts +1 -0
  314. package/dist/lib/util/requestIdleCallbackPolyfill.js +7 -0
  315. package/dist/lib/util/requestIdleCallbackPolyfill.js.map +1 -0
  316. package/dist/lib/util/useScrollToAnchor.js +31 -17
  317. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  318. package/dist/vite/build.js +30 -7
  319. package/dist/vite/build.js.map +1 -1
  320. package/dist/vite/config.d.ts +20 -12
  321. package/dist/vite/config.js +107 -55
  322. package/dist/vite/config.js.map +1 -1
  323. package/dist/vite/config.test.js +6 -3
  324. package/dist/vite/config.test.js.map +1 -1
  325. package/dist/vite/dev-server.d.ts +2 -1
  326. package/dist/vite/dev-server.js +44 -15
  327. package/dist/vite/dev-server.js.map +1 -1
  328. package/dist/vite/html.js +18 -5
  329. package/dist/vite/html.js.map +1 -1
  330. package/dist/vite/plugin-api-keys.js +7 -8
  331. package/dist/vite/plugin-api-keys.js.map +1 -1
  332. package/dist/vite/plugin-api.js +9 -20
  333. package/dist/vite/plugin-api.js.map +1 -1
  334. package/dist/vite/plugin-auth.js +5 -6
  335. package/dist/vite/plugin-auth.js.map +1 -1
  336. package/dist/vite/plugin-component.js +5 -2
  337. package/dist/vite/plugin-component.js.map +1 -1
  338. package/dist/vite/plugin-config.d.ts +3 -6
  339. package/dist/vite/plugin-config.js +5 -8
  340. package/dist/vite/plugin-config.js.map +1 -1
  341. package/dist/vite/plugin-custom-css.d.ts +6 -0
  342. package/dist/vite/plugin-custom-css.js +54 -0
  343. package/dist/vite/plugin-custom-css.js.map +1 -0
  344. package/dist/vite/plugin-docs.js +15 -5
  345. package/dist/vite/plugin-docs.js.map +1 -1
  346. package/dist/vite/plugin-mdx.d.ts +3 -1
  347. package/dist/vite/plugin-mdx.js +5 -5
  348. package/dist/vite/plugin-mdx.js.map +1 -1
  349. package/dist/vite/plugin-metadata.js +1 -1
  350. package/dist/vite/plugin-metadata.js.map +1 -1
  351. package/dist/vite/plugin-redirect.js +10 -10
  352. package/dist/vite/plugin-redirect.js.map +1 -1
  353. package/dist/vite/plugin-sidebar.d.ts +3 -0
  354. package/dist/vite/plugin-sidebar.js +23 -0
  355. package/dist/vite/plugin-sidebar.js.map +1 -0
  356. package/dist/vite/plugin.js +5 -5
  357. package/dist/vite/plugin.js.map +1 -1
  358. package/dist/vite/prerender.d.ts +17 -0
  359. package/dist/vite/prerender.js +79 -0
  360. package/dist/vite/prerender.js.map +1 -0
  361. package/lib/AuthenticationPlugin-C3dzfGaA.js +55 -0
  362. package/lib/AuthenticationPlugin-C3dzfGaA.js.map +1 -0
  363. package/lib/CategoryHeading-BWq12Bfa.js +10 -0
  364. package/lib/CategoryHeading-BWq12Bfa.js.map +1 -0
  365. package/lib/Combination-Djh-LWhb.js +2789 -0
  366. package/lib/Combination-Djh-LWhb.js.map +1 -0
  367. package/lib/DeveloperHint-BQSFXH01.js +10 -0
  368. package/lib/DeveloperHint-BQSFXH01.js.map +1 -0
  369. package/lib/Input-SCGD-EvD.js +2239 -0
  370. package/lib/Input-SCGD-EvD.js.map +1 -0
  371. package/lib/Markdown-B_Gax7at.js +14108 -0
  372. package/lib/Markdown-B_Gax7at.js.map +1 -0
  373. package/lib/MdxPage-d02krMBw.js +187 -0
  374. package/lib/MdxPage-d02krMBw.js.map +1 -0
  375. package/lib/OperationList-BQweX28o.js +448 -0
  376. package/lib/OperationList-BQweX28o.js.map +1 -0
  377. package/lib/Route-BPGW1TS_.js +14 -0
  378. package/lib/Route-BPGW1TS_.js.map +1 -0
  379. package/lib/SlotletProvider-CzMAO73_.js +82 -0
  380. package/lib/SlotletProvider-CzMAO73_.js.map +1 -0
  381. package/lib/Spinner-DEgs-1Gu.js +274 -0
  382. package/lib/Spinner-DEgs-1Gu.js.map +1 -0
  383. package/lib/ZudokuContext-C3JtXViU.js +1084 -0
  384. package/lib/ZudokuContext-C3JtXViU.js.map +1 -0
  385. package/lib/_commonjsHelpers-BVfed4GL.js +29 -0
  386. package/lib/_commonjsHelpers-BVfed4GL.js.map +1 -0
  387. package/lib/assets/index-BPdJm2ty.js +1 -0
  388. package/lib/assets/index-BPdJm2ty.js.map +1 -0
  389. package/lib/assets/{worker-BCcpCNJ7.js → worker-CyHZIIfE.js} +10727 -10300
  390. package/lib/assets/worker-CyHZIIfE.js.map +1 -0
  391. package/lib/index-7kcHaXD6.js +1771 -0
  392. package/lib/index-7kcHaXD6.js.map +1 -0
  393. package/lib/index-B8BCBPkc.js +124 -0
  394. package/lib/index-B8BCBPkc.js.map +1 -0
  395. package/lib/index-DoIWqOG1.js +5934 -0
  396. package/lib/index-DoIWqOG1.js.map +1 -0
  397. package/lib/index-pI9JkN46.js +4765 -0
  398. package/lib/index-pI9JkN46.js.map +1 -0
  399. package/lib/joinPath-VeNuJa7y.js +8 -0
  400. package/lib/joinPath-VeNuJa7y.js.map +1 -0
  401. package/lib/jsx-runtime-B6kdoens.js +635 -0
  402. package/lib/jsx-runtime-B6kdoens.js.map +1 -0
  403. package/lib/prism-bash.min-DadFsM4Z.js +1 -0
  404. package/lib/prism-bash.min-DadFsM4Z.js.map +1 -0
  405. package/lib/prism-csharp.min-Yizuc34Y.js +1 -0
  406. package/lib/prism-csharp.min-Yizuc34Y.js.map +1 -0
  407. package/lib/prism-java.min-d5iT_mOd.js +1 -0
  408. package/lib/prism-java.min-d5iT_mOd.js.map +1 -0
  409. package/lib/prism-json.min-B1GJqK1k.js +1 -0
  410. package/lib/prism-json.min-B1GJqK1k.js.map +1 -0
  411. package/lib/prism-markup-templating-DZrrEs0A.js +1 -0
  412. package/lib/prism-markup-templating-DZrrEs0A.js.map +1 -0
  413. package/lib/prism-objectivec.min-BXSWqpJJ.js +1 -0
  414. package/lib/prism-objectivec.min-BXSWqpJJ.js.map +1 -0
  415. package/lib/prism-php.min-o7FpoMP_.js +1 -0
  416. package/lib/prism-php.min-o7FpoMP_.js.map +1 -0
  417. package/lib/prism-ruby.min-C7LwcKyz.js +1 -0
  418. package/lib/prism-ruby.min-C7LwcKyz.js.map +1 -0
  419. package/lib/router-BiRCp01d.js +2971 -0
  420. package/lib/router-BiRCp01d.js.map +1 -0
  421. package/lib/slugify-CiPVjteN.js +28 -0
  422. package/lib/slugify-CiPVjteN.js.map +1 -0
  423. package/lib/state-DsXXkBLH.js +288 -0
  424. package/lib/state-DsXXkBLH.js.map +1 -0
  425. package/lib/{urql-DMlBWUKL.js → urql-DrBfkb92.js} +2 -2
  426. package/lib/urql-DrBfkb92.js.map +1 -0
  427. package/lib/utils-D3fcGEot.js +749 -0
  428. package/lib/utils-D3fcGEot.js.map +1 -0
  429. package/lib/zudoku.auth-auth0.js +31 -20
  430. package/lib/zudoku.auth-auth0.js.map +1 -0
  431. package/lib/zudoku.auth-clerk.js +59 -29
  432. package/lib/zudoku.auth-clerk.js.map +1 -0
  433. package/lib/zudoku.auth-openid.js +742 -573
  434. package/lib/zudoku.auth-openid.js.map +1 -0
  435. package/lib/zudoku.components.js +2008 -684
  436. package/lib/zudoku.components.js.map +1 -0
  437. package/lib/zudoku.openapi-worker.js +15035 -146
  438. package/lib/zudoku.openapi-worker.js.map +1 -0
  439. package/lib/zudoku.plugin-api-keys.js +325 -0
  440. package/lib/zudoku.plugin-api-keys.js.map +1 -0
  441. package/lib/zudoku.plugin-custom-page.js +13 -0
  442. package/lib/zudoku.plugin-custom-page.js.map +1 -0
  443. package/lib/zudoku.plugin-markdown.js +31 -0
  444. package/lib/zudoku.plugin-markdown.js.map +1 -0
  445. package/lib/zudoku.plugin-openapi.js +14 -0
  446. package/lib/zudoku.plugin-openapi.js.map +1 -0
  447. package/lib/zudoku.plugin-redirect.js +11 -0
  448. package/lib/zudoku.plugin-redirect.js.map +1 -0
  449. package/package.json +64 -25
  450. package/src/app/App.tsx +0 -41
  451. package/src/app/demo-cdn.html +26 -0
  452. package/src/app/demo.html +18 -0
  453. package/src/app/demo.tsx +46 -0
  454. package/src/app/entry.client.tsx +47 -0
  455. package/src/app/entry.server.tsx +160 -0
  456. package/src/app/main.css +83 -3
  457. package/src/app/main.tsx +87 -15
  458. package/src/app/standalone.html +20 -0
  459. package/src/app/standalone.tsx +52 -0
  460. package/src/app/tailwind.ts +2 -6
  461. package/src/lib/authentication/AuthenticationPlugin.tsx +38 -0
  462. package/src/lib/authentication/authentication.ts +6 -12
  463. package/src/lib/authentication/components/SignIn.tsx +15 -0
  464. package/src/lib/authentication/components/SignOut.tsx +13 -0
  465. package/src/lib/authentication/components/SignUp.tsx +11 -0
  466. package/src/lib/authentication/hook.ts +4 -4
  467. package/src/lib/authentication/providers/auth0.tsx +16 -6
  468. package/src/lib/authentication/providers/clerk.tsx +63 -31
  469. package/src/lib/authentication/providers/openid.tsx +104 -34
  470. package/src/lib/authentication/state.ts +1 -1
  471. package/src/lib/components/Bootstrap.tsx +44 -0
  472. package/src/lib/components/DevPortal.tsx +75 -66
  473. package/src/lib/components/DeveloperHint.tsx +25 -0
  474. package/src/lib/components/ErrorPage.tsx +28 -0
  475. package/src/lib/components/Header.tsx +106 -31
  476. package/src/lib/components/Heading.tsx +26 -7
  477. package/src/lib/components/InlineCode.tsx +19 -0
  478. package/src/lib/components/Layout.tsx +16 -11
  479. package/src/lib/components/NotFoundPage.tsx +33 -0
  480. package/src/lib/components/SlotletProvider.tsx +25 -0
  481. package/src/lib/components/SyntaxHighlight.tsx +53 -44
  482. package/src/lib/components/TopNavigation.tsx +10 -5
  483. package/src/lib/components/context/ThemeContext.tsx +3 -41
  484. package/src/lib/components/context/ThemeProvider.tsx +27 -0
  485. package/src/lib/components/context/ZudokuContext.ts +55 -0
  486. package/src/lib/components/context/ZudokuProvider.tsx +26 -0
  487. package/src/lib/components/index.ts +25 -3
  488. package/src/lib/components/navigation/Sidebar.tsx +24 -0
  489. package/src/lib/components/navigation/SidebarBadge.tsx +40 -0
  490. package/src/lib/components/navigation/SidebarCategory.tsx +105 -0
  491. package/src/lib/components/navigation/SidebarItem.tsx +100 -0
  492. package/src/lib/components/navigation/{SideNavigationWrapper.tsx → SidebarWrapper.tsx} +1 -1
  493. package/src/lib/components/navigation/utils.ts +117 -0
  494. package/src/lib/core/DevPortalContext.ts +72 -68
  495. package/src/lib/core/plugins.ts +40 -16
  496. package/src/lib/errors/ErrorAlert.tsx +21 -0
  497. package/src/lib/errors/RouterError.tsx +13 -0
  498. package/src/lib/errors/ServerError.tsx +5 -0
  499. package/src/lib/errors/TopLevelError.tsx +8 -0
  500. package/src/lib/oas/graphql/index.ts +11 -6
  501. package/src/lib/oas/parser/index.ts +41 -20
  502. package/src/lib/plugins/{api-key → api-keys}/CreateApiKey.tsx +4 -4
  503. package/src/lib/plugins/api-keys/ProtectedRoute.tsx +29 -0
  504. package/src/lib/plugins/{api-key → api-keys}/SettingsApiKeys.tsx +49 -16
  505. package/src/lib/plugins/{api-key → api-keys}/index.tsx +27 -41
  506. package/src/lib/plugins/custom-page/index.tsx +22 -0
  507. package/src/lib/plugins/markdown/MdxPage.tsx +54 -73
  508. package/src/lib/plugins/markdown/Toc.tsx +53 -40
  509. package/src/lib/plugins/markdown/generateRoutes.tsx +35 -53
  510. package/src/lib/plugins/markdown/index.tsx +10 -7
  511. package/src/lib/plugins/openapi/ColorizedParam.tsx +23 -16
  512. package/src/lib/plugins/openapi/OperationList.tsx +46 -10
  513. package/src/lib/plugins/openapi/OperationListItem.tsx +51 -30
  514. package/src/lib/plugins/openapi/ParameterList.tsx +13 -10
  515. package/src/lib/plugins/openapi/ParameterListItem.tsx +3 -4
  516. package/src/lib/plugins/openapi/PlaygroundDialogWrapper.tsx +39 -0
  517. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +3 -15
  518. package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +3 -2
  519. package/src/lib/plugins/openapi/Route.tsx +21 -0
  520. package/src/lib/plugins/openapi/SchemaListView.tsx +39 -192
  521. package/src/lib/plugins/openapi/SchemaListViewItem.tsx +125 -0
  522. package/src/lib/plugins/openapi/SchemaListViewItemGroup.tsx +63 -0
  523. package/src/lib/plugins/openapi/Sidecar.tsx +77 -30
  524. package/src/lib/plugins/openapi/SidecarBox.tsx +13 -2
  525. package/src/lib/plugins/openapi/{Select.tsx → SimpleSelect.tsx} +6 -3
  526. package/src/lib/plugins/openapi/StaggeredRender.tsx +31 -0
  527. package/src/lib/plugins/openapi/client/createMemoryClient.ts +56 -0
  528. package/src/lib/plugins/openapi/client/createServer.ts +33 -0
  529. package/src/lib/plugins/openapi/{worker/createSharedWorkerClient.ts → client/createWorkerClient.ts} +21 -2
  530. package/src/lib/plugins/openapi/client/interfaces.ts +5 -0
  531. package/src/lib/plugins/openapi/{worker → client}/worker.ts +3 -3
  532. package/src/lib/plugins/openapi/context.tsx +16 -0
  533. package/src/lib/plugins/openapi/graphql/gql.ts +8 -8
  534. package/src/lib/plugins/openapi/graphql/graphql.ts +80 -80
  535. package/src/lib/plugins/openapi/index.tsx +134 -76
  536. package/src/lib/plugins/openapi/interfaces.ts +9 -0
  537. package/src/lib/plugins/openapi/playground/Headers.tsx +1 -1
  538. package/src/lib/plugins/openapi/playground/PathParams.tsx +76 -50
  539. package/src/lib/plugins/openapi/playground/Playground.tsx +240 -230
  540. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +40 -0
  541. package/src/lib/plugins/openapi/playground/QueryParams.tsx +107 -66
  542. package/src/lib/plugins/openapi/playground/ResponseTab.tsx +76 -0
  543. package/src/lib/plugins/openapi/playground/createUrl.ts +12 -15
  544. package/src/lib/plugins/openapi/util/prose.ts +7 -0
  545. package/src/lib/plugins/openapi-worker.ts +1 -1
  546. package/src/lib/plugins/redirect/index.tsx +3 -4
  547. package/src/lib/ui/Button.tsx +32 -2
  548. package/src/lib/ui/Callout.tsx +4 -4
  549. package/src/lib/ui/Card.tsx +1 -1
  550. package/src/lib/ui/DropdownMenu.tsx +199 -0
  551. package/src/lib/util/MdxComponents.tsx +7 -15
  552. package/src/lib/util/fetchTimeout.tsx +21 -0
  553. package/src/lib/util/groupBy.ts +7 -12
  554. package/src/lib/util/invariant.ts +26 -0
  555. package/src/lib/util/joinPath.tsx +2 -1
  556. package/src/lib/util/logInit.ts +9 -0
  557. package/src/lib/util/objectEntries.ts +5 -0
  558. package/src/lib/util/renderIf.ts +4 -0
  559. package/src/lib/util/requestIdleCallbackPolyfill.ts +6 -0
  560. package/src/lib/util/useScrollToAnchor.ts +39 -18
  561. package/dist/lib/authentication/Callback.d.ts +0 -3
  562. package/dist/lib/authentication/Callback.js +0 -34
  563. package/dist/lib/authentication/Callback.js.map +0 -1
  564. package/dist/lib/components/Input.js.map +0 -1
  565. package/dist/lib/components/Link.d.ts +0 -1
  566. package/dist/lib/components/Link.js +0 -2
  567. package/dist/lib/components/Link.js.map +0 -1
  568. package/dist/lib/components/Router.d.ts +0 -4
  569. package/dist/lib/components/Router.js +0 -20
  570. package/dist/lib/components/Router.js.map +0 -1
  571. package/dist/lib/components/context/DevPortalProvider.d.ts +0 -9
  572. package/dist/lib/components/context/DevPortalProvider.js +0 -39
  573. package/dist/lib/components/context/DevPortalProvider.js.map +0 -1
  574. package/dist/lib/components/navigation/SideNavigation.d.ts +0 -1
  575. package/dist/lib/components/navigation/SideNavigation.js +0 -11
  576. package/dist/lib/components/navigation/SideNavigation.js.map +0 -1
  577. package/dist/lib/components/navigation/SideNavigationCategory.d.ts +0 -4
  578. package/dist/lib/components/navigation/SideNavigationCategory.js +0 -26
  579. package/dist/lib/components/navigation/SideNavigationCategory.js.map +0 -1
  580. package/dist/lib/components/navigation/SideNavigationItem.d.ts +0 -13
  581. package/dist/lib/components/navigation/SideNavigationItem.js +0 -44
  582. package/dist/lib/components/navigation/SideNavigationItem.js.map +0 -1
  583. package/dist/lib/components/navigation/SideNavigationWrapper.js.map +0 -1
  584. package/dist/lib/components/navigation/useNavigationCollapsibleState.d.ts +0 -6
  585. package/dist/lib/components/navigation/useNavigationCollapsibleState.js +0 -16
  586. package/dist/lib/components/navigation/useNavigationCollapsibleState.js.map +0 -1
  587. package/dist/lib/components/navigation/util.d.ts +0 -8
  588. package/dist/lib/components/navigation/util.js +0 -15
  589. package/dist/lib/components/navigation/util.js.map +0 -1
  590. package/dist/lib/core/helmet.d.ts +0 -4
  591. package/dist/lib/core/helmet.js +0 -5
  592. package/dist/lib/core/helmet.js.map +0 -1
  593. package/dist/lib/core/icons.d.ts +0 -1
  594. package/dist/lib/core/icons.js +0 -2
  595. package/dist/lib/core/icons.js.map +0 -1
  596. package/dist/lib/core/router.d.ts +0 -1
  597. package/dist/lib/core/router.js +0 -2
  598. package/dist/lib/core/router.js.map +0 -1
  599. package/dist/lib/plugins/api-key/CreateApiKey.js.map +0 -1
  600. package/dist/lib/plugins/api-key/SettingsApiKeys.js +0 -38
  601. package/dist/lib/plugins/api-key/SettingsApiKeys.js.map +0 -1
  602. package/dist/lib/plugins/api-key/index.js.map +0 -1
  603. package/dist/lib/plugins/index.d.ts +0 -4
  604. package/dist/lib/plugins/index.js +0 -5
  605. package/dist/lib/plugins/index.js.map +0 -1
  606. package/dist/lib/plugins/openapi/MakeRequest.js +0 -43
  607. package/dist/lib/plugins/openapi/MakeRequest.js.map +0 -1
  608. package/dist/lib/plugins/openapi/MethodBadge.d.ts +0 -13
  609. package/dist/lib/plugins/openapi/MethodBadge.js +0 -26
  610. package/dist/lib/plugins/openapi/MethodBadge.js.map +0 -1
  611. package/dist/lib/plugins/openapi/Select.js +0 -5
  612. package/dist/lib/plugins/openapi/Select.js.map +0 -1
  613. package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.d.ts +0 -5
  614. package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.js.map +0 -1
  615. package/dist/lib/plugins/openapi/worker/shared-worker.d.ts +0 -1
  616. package/dist/lib/plugins/openapi/worker/shared-worker.js +0 -6
  617. package/dist/lib/plugins/openapi/worker/shared-worker.js.map +0 -1
  618. package/dist/lib/plugins/openapi/worker/worker.js.map +0 -1
  619. package/dist/lib/ui/button-variants.d.ts +0 -4
  620. package/dist/lib/ui/button-variants.js +0 -24
  621. package/dist/lib/ui/button-variants.js.map +0 -1
  622. package/dist/lib/util/traverseNavigation.d.ts +0 -6
  623. package/dist/lib/util/traverseNavigation.js +0 -30
  624. package/dist/lib/util/traverseNavigation.js.map +0 -1
  625. package/dist/vite/common.d.ts +0 -1
  626. package/dist/vite/common.js +0 -5
  627. package/dist/vite/common.js.map +0 -1
  628. package/dist/vite/plugin-html.d.ts +0 -3
  629. package/dist/vite/plugin-html.js +0 -47
  630. package/dist/vite/plugin-html.js.map +0 -1
  631. package/dist/vite/plugin-openapi-worker.d.ts +0 -4
  632. package/dist/vite/plugin-openapi-worker.js +0 -28
  633. package/dist/vite/plugin-openapi-worker.js.map +0 -1
  634. package/lib/Spinner-BewqqUU-.js +0 -8413
  635. package/lib/clerk-Wslx_mPo.js +0 -19685
  636. package/lib/index-PyGcnQFX.js +0 -3462
  637. package/lib/loglevel-CoH7VSwE.js +0 -152
  638. package/lib/state-2Hu1renZ.js +0 -313
  639. package/lib/zudoku.plugins.js +0 -19904
  640. package/src/lib/authentication/Callback.tsx +0 -60
  641. package/src/lib/components/Link.tsx +0 -1
  642. package/src/lib/components/Router.tsx +0 -28
  643. package/src/lib/components/context/DevPortalProvider.ts +0 -54
  644. package/src/lib/components/navigation/SideNavigation.tsx +0 -21
  645. package/src/lib/components/navigation/SideNavigationCategory.tsx +0 -76
  646. package/src/lib/components/navigation/SideNavigationItem.tsx +0 -152
  647. package/src/lib/components/navigation/useNavigationCollapsibleState.ts +0 -27
  648. package/src/lib/components/navigation/util.ts +0 -38
  649. package/src/lib/core/helmet.ts +0 -5
  650. package/src/lib/core/icons.tsx +0 -1
  651. package/src/lib/core/router.tsx +0 -1
  652. package/src/lib/plugins/index.ts +0 -4
  653. package/src/lib/plugins/openapi/MakeRequest.tsx +0 -63
  654. package/src/lib/plugins/openapi/MethodBadge.tsx +0 -36
  655. package/src/lib/plugins/openapi/worker/shared-worker.ts +0 -5
  656. package/src/lib/ui/button-variants.ts +0 -31
  657. package/src/lib/util/traverseNavigation.ts +0 -55
  658. /package/dist/lib/plugins/{api-key → api-keys}/CreateApiKey.d.ts +0 -0
  659. /package/dist/lib/plugins/{api-key → api-keys}/SettingsApiKeys.d.ts +0 -0
  660. /package/dist/lib/plugins/openapi/{worker → client}/worker.d.ts +0 -0
  661. /package/dist/lib/{components → ui}/Input.d.ts +0 -0
  662. /package/dist/lib/{components → ui}/Input.js +0 -0
  663. /package/src/lib/{components → ui}/Input.tsx +0 -0
@@ -0,0 +1,4765 @@
1
+ const ut = Symbol.for("yaml.alias"), rt = Symbol.for("yaml.document"), J = Symbol.for("yaml.map"), Kt = Symbol.for("yaml.pair"), V = Symbol.for("yaml.scalar"), fe = Symbol.for("yaml.seq"), K = Symbol.for("yaml.node.type"), Z = (s) => !!s && typeof s == "object" && s[K] === ut, ue = (s) => !!s && typeof s == "object" && s[K] === rt, he = (s) => !!s && typeof s == "object" && s[K] === J, E = (s) => !!s && typeof s == "object" && s[K] === Kt, A = (s) => !!s && typeof s == "object" && s[K] === V, de = (s) => !!s && typeof s == "object" && s[K] === fe;
2
+ function T(s) {
3
+ if (s && typeof s == "object")
4
+ switch (s[K]) {
5
+ case J:
6
+ case fe:
7
+ return !0;
8
+ }
9
+ return !1;
10
+ }
11
+ function $(s) {
12
+ if (s && typeof s == "object")
13
+ switch (s[K]) {
14
+ case ut:
15
+ case J:
16
+ case V:
17
+ case fe:
18
+ return !0;
19
+ }
20
+ return !1;
21
+ }
22
+ const $s = (s) => (A(s) || T(s)) && !!s.anchor, M = Symbol("break visit"), qt = Symbol("skip children"), U = Symbol("remove node");
23
+ function Y(s, e) {
24
+ const t = Ft(e);
25
+ ue(s) ? se(null, s.contents, t, Object.freeze([s])) === U && (s.contents = null) : se(null, s, t, Object.freeze([]));
26
+ }
27
+ Y.BREAK = M;
28
+ Y.SKIP = qt;
29
+ Y.REMOVE = U;
30
+ function se(s, e, t, n) {
31
+ const i = Ut(s, e, t, n);
32
+ if ($(i) || E(i))
33
+ return Rt(s, n, i), se(s, i, t, n);
34
+ if (typeof i != "symbol") {
35
+ if (T(e)) {
36
+ n = Object.freeze(n.concat(e));
37
+ for (let r = 0; r < e.items.length; ++r) {
38
+ const o = se(r, e.items[r], t, n);
39
+ if (typeof o == "number")
40
+ r = o - 1;
41
+ else {
42
+ if (o === M)
43
+ return M;
44
+ o === U && (e.items.splice(r, 1), r -= 1);
45
+ }
46
+ }
47
+ } else if (E(e)) {
48
+ n = Object.freeze(n.concat(e));
49
+ const r = se("key", e.key, t, n);
50
+ if (r === M)
51
+ return M;
52
+ r === U && (e.key = null);
53
+ const o = se("value", e.value, t, n);
54
+ if (o === M)
55
+ return M;
56
+ o === U && (e.value = null);
57
+ }
58
+ }
59
+ return i;
60
+ }
61
+ async function De(s, e) {
62
+ const t = Ft(e);
63
+ ue(s) ? await ne(null, s.contents, t, Object.freeze([s])) === U && (s.contents = null) : await ne(null, s, t, Object.freeze([]));
64
+ }
65
+ De.BREAK = M;
66
+ De.SKIP = qt;
67
+ De.REMOVE = U;
68
+ async function ne(s, e, t, n) {
69
+ const i = await Ut(s, e, t, n);
70
+ if ($(i) || E(i))
71
+ return Rt(s, n, i), ne(s, i, t, n);
72
+ if (typeof i != "symbol") {
73
+ if (T(e)) {
74
+ n = Object.freeze(n.concat(e));
75
+ for (let r = 0; r < e.items.length; ++r) {
76
+ const o = await ne(r, e.items[r], t, n);
77
+ if (typeof o == "number")
78
+ r = o - 1;
79
+ else {
80
+ if (o === M)
81
+ return M;
82
+ o === U && (e.items.splice(r, 1), r -= 1);
83
+ }
84
+ }
85
+ } else if (E(e)) {
86
+ n = Object.freeze(n.concat(e));
87
+ const r = await ne("key", e.key, t, n);
88
+ if (r === M)
89
+ return M;
90
+ r === U && (e.key = null);
91
+ const o = await ne("value", e.value, t, n);
92
+ if (o === M)
93
+ return M;
94
+ o === U && (e.value = null);
95
+ }
96
+ }
97
+ return i;
98
+ }
99
+ function Ft(s) {
100
+ return typeof s == "object" && (s.Collection || s.Node || s.Value) ? Object.assign({
101
+ Alias: s.Node,
102
+ Map: s.Node,
103
+ Scalar: s.Node,
104
+ Seq: s.Node
105
+ }, s.Value && {
106
+ Map: s.Value,
107
+ Scalar: s.Value,
108
+ Seq: s.Value
109
+ }, s.Collection && {
110
+ Map: s.Collection,
111
+ Seq: s.Collection
112
+ }, s) : s;
113
+ }
114
+ function Ut(s, e, t, n) {
115
+ var i, r, o, l, a;
116
+ if (typeof t == "function")
117
+ return t(s, e, n);
118
+ if (he(e))
119
+ return (i = t.Map) == null ? void 0 : i.call(t, s, e, n);
120
+ if (de(e))
121
+ return (r = t.Seq) == null ? void 0 : r.call(t, s, e, n);
122
+ if (E(e))
123
+ return (o = t.Pair) == null ? void 0 : o.call(t, s, e, n);
124
+ if (A(e))
125
+ return (l = t.Scalar) == null ? void 0 : l.call(t, s, e, n);
126
+ if (Z(e))
127
+ return (a = t.Alias) == null ? void 0 : a.call(t, s, e, n);
128
+ }
129
+ function Rt(s, e, t) {
130
+ const n = e[e.length - 1];
131
+ if (T(n))
132
+ n.items[s] = t;
133
+ else if (E(n))
134
+ s === "key" ? n.key = t : n.value = t;
135
+ else if (ue(n))
136
+ n.contents = t;
137
+ else {
138
+ const i = Z(n) ? "alias" : "scalar";
139
+ throw new Error(`Cannot replace node with ${i} parent`);
140
+ }
141
+ }
142
+ const _s = {
143
+ "!": "%21",
144
+ ",": "%2C",
145
+ "[": "%5B",
146
+ "]": "%5D",
147
+ "{": "%7B",
148
+ "}": "%7D"
149
+ }, Cs = (s) => s.replace(/[!,[\]{}]/g, (e) => _s[e]);
150
+ class B {
151
+ constructor(e, t) {
152
+ this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, B.defaultYaml, e), this.tags = Object.assign({}, B.defaultTags, t);
153
+ }
154
+ clone() {
155
+ const e = new B(this.yaml, this.tags);
156
+ return e.docStart = this.docStart, e;
157
+ }
158
+ /**
159
+ * During parsing, get a Directives instance for the current document and
160
+ * update the stream state according to the current version's spec.
161
+ */
162
+ atDocument() {
163
+ const e = new B(this.yaml, this.tags);
164
+ switch (this.yaml.version) {
165
+ case "1.1":
166
+ this.atNextDocument = !0;
167
+ break;
168
+ case "1.2":
169
+ this.atNextDocument = !1, this.yaml = {
170
+ explicit: B.defaultYaml.explicit,
171
+ version: "1.2"
172
+ }, this.tags = Object.assign({}, B.defaultTags);
173
+ break;
174
+ }
175
+ return e;
176
+ }
177
+ /**
178
+ * @param onError - May be called even if the action was successful
179
+ * @returns `true` on success
180
+ */
181
+ add(e, t) {
182
+ this.atNextDocument && (this.yaml = { explicit: B.defaultYaml.explicit, version: "1.1" }, this.tags = Object.assign({}, B.defaultTags), this.atNextDocument = !1);
183
+ const n = e.trim().split(/[ \t]+/), i = n.shift();
184
+ switch (i) {
185
+ case "%TAG": {
186
+ if (n.length !== 2 && (t(0, "%TAG directive should contain exactly two parts"), n.length < 2))
187
+ return !1;
188
+ const [r, o] = n;
189
+ return this.tags[r] = o, !0;
190
+ }
191
+ case "%YAML": {
192
+ if (this.yaml.explicit = !0, n.length !== 1)
193
+ return t(0, "%YAML directive should contain exactly one part"), !1;
194
+ const [r] = n;
195
+ if (r === "1.1" || r === "1.2")
196
+ return this.yaml.version = r, !0;
197
+ {
198
+ const o = /^\d+\.\d+$/.test(r);
199
+ return t(6, `Unsupported YAML version ${r}`, o), !1;
200
+ }
201
+ }
202
+ default:
203
+ return t(0, `Unknown directive ${i}`, !0), !1;
204
+ }
205
+ }
206
+ /**
207
+ * Resolves a tag, matching handles to those defined in %TAG directives.
208
+ *
209
+ * @returns Resolved tag, which may also be the non-specific tag `'!'` or a
210
+ * `'!local'` tag, or `null` if unresolvable.
211
+ */
212
+ tagName(e, t) {
213
+ if (e === "!")
214
+ return "!";
215
+ if (e[0] !== "!")
216
+ return t(`Not a valid tag: ${e}`), null;
217
+ if (e[1] === "<") {
218
+ const o = e.slice(2, -1);
219
+ return o === "!" || o === "!!" ? (t(`Verbatim tags aren't resolved, so ${e} is invalid.`), null) : (e[e.length - 1] !== ">" && t("Verbatim tags must end with a >"), o);
220
+ }
221
+ const [, n, i] = e.match(/^(.*!)([^!]*)$/s);
222
+ i || t(`The ${e} tag has no suffix`);
223
+ const r = this.tags[n];
224
+ if (r)
225
+ try {
226
+ return r + decodeURIComponent(i);
227
+ } catch (o) {
228
+ return t(String(o)), null;
229
+ }
230
+ return n === "!" ? e : (t(`Could not resolve tag: ${e}`), null);
231
+ }
232
+ /**
233
+ * Given a fully resolved tag, returns its printable string form,
234
+ * taking into account current tag prefixes and defaults.
235
+ */
236
+ tagString(e) {
237
+ for (const [t, n] of Object.entries(this.tags))
238
+ if (e.startsWith(n))
239
+ return t + Cs(e.substring(n.length));
240
+ return e[0] === "!" ? e : `!<${e}>`;
241
+ }
242
+ toString(e) {
243
+ const t = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [], n = Object.entries(this.tags);
244
+ let i;
245
+ if (e && n.length > 0 && $(e.contents)) {
246
+ const r = {};
247
+ Y(e.contents, (o, l) => {
248
+ $(l) && l.tag && (r[l.tag] = !0);
249
+ }), i = Object.keys(r);
250
+ } else
251
+ i = [];
252
+ for (const [r, o] of n)
253
+ r === "!!" && o === "tag:yaml.org,2002:" || (!e || i.some((l) => l.startsWith(o))) && t.push(`%TAG ${r} ${o}`);
254
+ return t.join(`
255
+ `);
256
+ }
257
+ }
258
+ B.defaultYaml = { explicit: !1, version: "1.2" };
259
+ B.defaultTags = { "!!": "tag:yaml.org,2002:" };
260
+ function Vt(s) {
261
+ if (/[\x00-\x19\s,[\]{}]/.test(s)) {
262
+ const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;
263
+ throw new Error(t);
264
+ }
265
+ return !0;
266
+ }
267
+ function Jt(s) {
268
+ const e = /* @__PURE__ */ new Set();
269
+ return Y(s, {
270
+ Value(t, n) {
271
+ n.anchor && e.add(n.anchor);
272
+ }
273
+ }), e;
274
+ }
275
+ function Yt(s, e) {
276
+ for (let t = 1; ; ++t) {
277
+ const n = `${s}${t}`;
278
+ if (!e.has(n))
279
+ return n;
280
+ }
281
+ }
282
+ function vs(s, e) {
283
+ const t = [], n = /* @__PURE__ */ new Map();
284
+ let i = null;
285
+ return {
286
+ onAnchor: (r) => {
287
+ t.push(r), i || (i = Jt(s));
288
+ const o = Yt(e, i);
289
+ return i.add(o), o;
290
+ },
291
+ /**
292
+ * With circular references, the source node is only resolved after all
293
+ * of its child nodes are. This is why anchors are set only after all of
294
+ * the nodes have been created.
295
+ */
296
+ setAnchors: () => {
297
+ for (const r of t) {
298
+ const o = n.get(r);
299
+ if (typeof o == "object" && o.anchor && (A(o.node) || T(o.node)))
300
+ o.node.anchor = o.anchor;
301
+ else {
302
+ const l = new Error("Failed to resolve repeated object (this should not happen)");
303
+ throw l.source = r, l;
304
+ }
305
+ }
306
+ },
307
+ sourceObjects: n
308
+ };
309
+ }
310
+ function ie(s, e, t, n) {
311
+ if (n && typeof n == "object")
312
+ if (Array.isArray(n))
313
+ for (let i = 0, r = n.length; i < r; ++i) {
314
+ const o = n[i], l = ie(s, n, String(i), o);
315
+ l === void 0 ? delete n[i] : l !== o && (n[i] = l);
316
+ }
317
+ else if (n instanceof Map)
318
+ for (const i of Array.from(n.keys())) {
319
+ const r = n.get(i), o = ie(s, n, i, r);
320
+ o === void 0 ? n.delete(i) : o !== r && n.set(i, o);
321
+ }
322
+ else if (n instanceof Set)
323
+ for (const i of Array.from(n)) {
324
+ const r = ie(s, n, i, i);
325
+ r === void 0 ? n.delete(i) : r !== i && (n.delete(i), n.add(r));
326
+ }
327
+ else
328
+ for (const [i, r] of Object.entries(n)) {
329
+ const o = ie(s, n, i, r);
330
+ o === void 0 ? delete n[i] : o !== r && (n[i] = o);
331
+ }
332
+ return s.call(e, t, n);
333
+ }
334
+ function D(s, e, t) {
335
+ if (Array.isArray(s))
336
+ return s.map((n, i) => D(n, String(i), t));
337
+ if (s && typeof s.toJSON == "function") {
338
+ if (!t || !$s(s))
339
+ return s.toJSON(e, t);
340
+ const n = { aliasCount: 0, count: 1, res: void 0 };
341
+ t.anchors.set(s, n), t.onCreate = (r) => {
342
+ n.res = r, delete t.onCreate;
343
+ };
344
+ const i = s.toJSON(e, t);
345
+ return t.onCreate && t.onCreate(i), i;
346
+ }
347
+ return typeof s == "bigint" && !(t != null && t.keep) ? Number(s) : s;
348
+ }
349
+ class ht {
350
+ constructor(e) {
351
+ Object.defineProperty(this, K, { value: e });
352
+ }
353
+ /** Create a copy of this node. */
354
+ clone() {
355
+ const e = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
356
+ return this.range && (e.range = this.range.slice()), e;
357
+ }
358
+ /** A plain JavaScript representation of this node. */
359
+ toJS(e, { mapAsMap: t, maxAliasCount: n, onAnchor: i, reviver: r } = {}) {
360
+ if (!ue(e))
361
+ throw new TypeError("A document argument is required");
362
+ const o = {
363
+ anchors: /* @__PURE__ */ new Map(),
364
+ doc: e,
365
+ keep: !0,
366
+ mapAsMap: t === !0,
367
+ mapKeyWarned: !1,
368
+ maxAliasCount: typeof n == "number" ? n : 100
369
+ }, l = D(this, "", o);
370
+ if (typeof i == "function")
371
+ for (const { count: a, res: c } of o.anchors.values())
372
+ i(c, a);
373
+ return typeof r == "function" ? ie(r, { "": l }, "", l) : l;
374
+ }
375
+ }
376
+ class Ke extends ht {
377
+ constructor(e) {
378
+ super(ut), this.source = e, Object.defineProperty(this, "tag", {
379
+ set() {
380
+ throw new Error("Alias nodes cannot have tags");
381
+ }
382
+ });
383
+ }
384
+ /**
385
+ * Resolve the value of this alias within `doc`, finding the last
386
+ * instance of the `source` anchor before this node.
387
+ */
388
+ resolve(e) {
389
+ let t;
390
+ return Y(e, {
391
+ Node: (n, i) => {
392
+ if (i === this)
393
+ return Y.BREAK;
394
+ i.anchor === this.source && (t = i);
395
+ }
396
+ }), t;
397
+ }
398
+ toJSON(e, t) {
399
+ if (!t)
400
+ return { source: this.source };
401
+ const { anchors: n, doc: i, maxAliasCount: r } = t, o = this.resolve(i);
402
+ if (!o) {
403
+ const a = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
404
+ throw new ReferenceError(a);
405
+ }
406
+ let l = n.get(o);
407
+ if (l || (D(o, null, t), l = n.get(o)), !l || l.res === void 0) {
408
+ const a = "This should not happen: Alias anchor was not resolved?";
409
+ throw new ReferenceError(a);
410
+ }
411
+ if (r >= 0 && (l.count += 1, l.aliasCount === 0 && (l.aliasCount = $e(i, o, n)), l.count * l.aliasCount > r)) {
412
+ const a = "Excessive alias count indicates a resource exhaustion attack";
413
+ throw new ReferenceError(a);
414
+ }
415
+ return l.res;
416
+ }
417
+ toString(e, t, n) {
418
+ const i = `*${this.source}`;
419
+ if (e) {
420
+ if (Vt(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
421
+ const r = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
422
+ throw new Error(r);
423
+ }
424
+ if (e.implicitKey)
425
+ return `${i} `;
426
+ }
427
+ return i;
428
+ }
429
+ }
430
+ function $e(s, e, t) {
431
+ if (Z(e)) {
432
+ const n = e.resolve(s), i = t && n && t.get(n);
433
+ return i ? i.count * i.aliasCount : 0;
434
+ } else if (T(e)) {
435
+ let n = 0;
436
+ for (const i of e.items) {
437
+ const r = $e(s, i, t);
438
+ r > n && (n = r);
439
+ }
440
+ return n;
441
+ } else if (E(e)) {
442
+ const n = $e(s, e.key, t), i = $e(s, e.value, t);
443
+ return Math.max(n, i);
444
+ }
445
+ return 1;
446
+ }
447
+ const Gt = (s) => !s || typeof s != "function" && typeof s != "object";
448
+ class N extends ht {
449
+ constructor(e) {
450
+ super(V), this.value = e;
451
+ }
452
+ toJSON(e, t) {
453
+ return t != null && t.keep ? this.value : D(this.value, e, t);
454
+ }
455
+ toString() {
456
+ return String(this.value);
457
+ }
458
+ }
459
+ N.BLOCK_FOLDED = "BLOCK_FOLDED";
460
+ N.BLOCK_LITERAL = "BLOCK_LITERAL";
461
+ N.PLAIN = "PLAIN";
462
+ N.QUOTE_DOUBLE = "QUOTE_DOUBLE";
463
+ N.QUOTE_SINGLE = "QUOTE_SINGLE";
464
+ const Bs = "tag:yaml.org,2002:";
465
+ function Ms(s, e, t) {
466
+ if (e) {
467
+ const n = t.filter((r) => r.tag === e), i = n.find((r) => !r.format) ?? n[0];
468
+ if (!i)
469
+ throw new Error(`Tag ${e} not found`);
470
+ return i;
471
+ }
472
+ return t.find((n) => {
473
+ var i;
474
+ return ((i = n.identify) == null ? void 0 : i.call(n, s)) && !n.format;
475
+ });
476
+ }
477
+ function Se(s, e, t) {
478
+ var f, u, m;
479
+ if (ue(s) && (s = s.contents), $(s))
480
+ return s;
481
+ if (E(s)) {
482
+ const g = (u = (f = t.schema[J]).createNode) == null ? void 0 : u.call(f, t.schema, null, t);
483
+ return g.items.push(s), g;
484
+ }
485
+ (s instanceof String || s instanceof Number || s instanceof Boolean || typeof BigInt < "u" && s instanceof BigInt) && (s = s.valueOf());
486
+ const { aliasDuplicateObjects: n, onAnchor: i, onTagObj: r, schema: o, sourceObjects: l } = t;
487
+ let a;
488
+ if (n && s && typeof s == "object") {
489
+ if (a = l.get(s), a)
490
+ return a.anchor || (a.anchor = i(s)), new Ke(a.anchor);
491
+ a = { anchor: null, node: null }, l.set(s, a);
492
+ }
493
+ e != null && e.startsWith("!!") && (e = Bs + e.slice(2));
494
+ let c = Ms(s, e, o.tags);
495
+ if (!c) {
496
+ if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
497
+ const g = new N(s);
498
+ return a && (a.node = g), g;
499
+ }
500
+ c = s instanceof Map ? o[J] : Symbol.iterator in Object(s) ? o[fe] : o[J];
501
+ }
502
+ r && (r(c), delete t.onTagObj);
503
+ const p = c != null && c.createNode ? c.createNode(t.schema, s, t) : typeof ((m = c == null ? void 0 : c.nodeClass) == null ? void 0 : m.from) == "function" ? c.nodeClass.from(t.schema, s, t) : new N(s);
504
+ return e ? p.tag = e : c.default || (p.tag = c.tag), a && (a.node = p), p;
505
+ }
506
+ function Be(s, e, t) {
507
+ let n = t;
508
+ for (let i = e.length - 1; i >= 0; --i) {
509
+ const r = e[i];
510
+ if (typeof r == "number" && Number.isInteger(r) && r >= 0) {
511
+ const o = [];
512
+ o[r] = n, n = o;
513
+ } else
514
+ n = /* @__PURE__ */ new Map([[r, n]]);
515
+ }
516
+ return Se(n, void 0, {
517
+ aliasDuplicateObjects: !1,
518
+ keepUndefined: !1,
519
+ onAnchor: () => {
520
+ throw new Error("This should not happen, please report a bug.");
521
+ },
522
+ schema: s,
523
+ sourceObjects: /* @__PURE__ */ new Map()
524
+ });
525
+ }
526
+ const be = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
527
+ class dt extends ht {
528
+ constructor(e, t) {
529
+ super(e), Object.defineProperty(this, "schema", {
530
+ value: t,
531
+ configurable: !0,
532
+ enumerable: !1,
533
+ writable: !0
534
+ });
535
+ }
536
+ /**
537
+ * Create a copy of this collection.
538
+ *
539
+ * @param schema - If defined, overwrites the original's schema
540
+ */
541
+ clone(e) {
542
+ const t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
543
+ return e && (t.schema = e), t.items = t.items.map((n) => $(n) || E(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
544
+ }
545
+ /**
546
+ * Adds a value to the collection. For `!!map` and `!!omap` the value must
547
+ * be a Pair instance or a `{ key, value }` object, which may not have a key
548
+ * that already exists in the map.
549
+ */
550
+ addIn(e, t) {
551
+ if (be(e))
552
+ this.add(t);
553
+ else {
554
+ const [n, ...i] = e, r = this.get(n, !0);
555
+ if (T(r))
556
+ r.addIn(i, t);
557
+ else if (r === void 0 && this.schema)
558
+ this.set(n, Be(this.schema, i, t));
559
+ else
560
+ throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
561
+ }
562
+ }
563
+ /**
564
+ * Removes a value from the collection.
565
+ * @returns `true` if the item was found and removed.
566
+ */
567
+ deleteIn(e) {
568
+ const [t, ...n] = e;
569
+ if (n.length === 0)
570
+ return this.delete(t);
571
+ const i = this.get(t, !0);
572
+ if (T(i))
573
+ return i.deleteIn(n);
574
+ throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`);
575
+ }
576
+ /**
577
+ * Returns item at `key`, or `undefined` if not found. By default unwraps
578
+ * scalar values from their surrounding node; to disable set `keepScalar` to
579
+ * `true` (collections are always returned intact).
580
+ */
581
+ getIn(e, t) {
582
+ const [n, ...i] = e, r = this.get(n, !0);
583
+ return i.length === 0 ? !t && A(r) ? r.value : r : T(r) ? r.getIn(i, t) : void 0;
584
+ }
585
+ hasAllNullValues(e) {
586
+ return this.items.every((t) => {
587
+ if (!E(t))
588
+ return !1;
589
+ const n = t.value;
590
+ return n == null || e && A(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
591
+ });
592
+ }
593
+ /**
594
+ * Checks if the collection includes a value with the key `key`.
595
+ */
596
+ hasIn(e) {
597
+ const [t, ...n] = e;
598
+ if (n.length === 0)
599
+ return this.has(t);
600
+ const i = this.get(t, !0);
601
+ return T(i) ? i.hasIn(n) : !1;
602
+ }
603
+ /**
604
+ * Sets a value in this collection. For `!!set`, `value` needs to be a
605
+ * boolean to add/remove the item from the set.
606
+ */
607
+ setIn(e, t) {
608
+ const [n, ...i] = e;
609
+ if (i.length === 0)
610
+ this.set(n, t);
611
+ else {
612
+ const r = this.get(n, !0);
613
+ if (T(r))
614
+ r.setIn(i, t);
615
+ else if (r === void 0 && this.schema)
616
+ this.set(n, Be(this.schema, i, t));
617
+ else
618
+ throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
619
+ }
620
+ }
621
+ }
622
+ dt.maxFlowStringSingleLineLength = 60;
623
+ const Ps = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
624
+ function R(s, e) {
625
+ return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
626
+ }
627
+ const W = (s, e, t) => s.endsWith(`
628
+ `) ? R(t, e) : t.includes(`
629
+ `) ? `
630
+ ` + R(t, e) : (s.endsWith(" ") ? "" : " ") + t, Qt = "flow", ot = "block", _e = "quoted";
631
+ function qe(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: l } = {}) {
632
+ if (!i || i < 0)
633
+ return s;
634
+ const a = Math.max(1 + r, 1 + i - e.length);
635
+ if (s.length <= a)
636
+ return s;
637
+ const c = [], p = {};
638
+ let f = i - e.length;
639
+ typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : f = i - n);
640
+ let u, m, g = !1, h = -1, d = -1, b = -1;
641
+ t === ot && (h = Tt(s, h, e.length), h !== -1 && (f = h + a));
642
+ for (let k; k = s[h += 1]; ) {
643
+ if (t === _e && k === "\\") {
644
+ switch (d = h, s[h + 1]) {
645
+ case "x":
646
+ h += 3;
647
+ break;
648
+ case "u":
649
+ h += 5;
650
+ break;
651
+ case "U":
652
+ h += 9;
653
+ break;
654
+ default:
655
+ h += 1;
656
+ }
657
+ b = h;
658
+ }
659
+ if (k === `
660
+ `)
661
+ t === ot && (h = Tt(s, h, e.length)), f = h + e.length + a, u = void 0;
662
+ else {
663
+ if (k === " " && m && m !== " " && m !== `
664
+ ` && m !== " ") {
665
+ const S = s[h + 1];
666
+ S && S !== " " && S !== `
667
+ ` && S !== " " && (u = h);
668
+ }
669
+ if (h >= f)
670
+ if (u)
671
+ c.push(u), f = u + a, u = void 0;
672
+ else if (t === _e) {
673
+ for (; m === " " || m === " "; )
674
+ m = k, k = s[h += 1], g = !0;
675
+ const S = h > b + 1 ? h - 2 : d - 1;
676
+ if (p[S])
677
+ return s;
678
+ c.push(S), p[S] = !0, f = S + a, u = void 0;
679
+ } else
680
+ g = !0;
681
+ }
682
+ m = k;
683
+ }
684
+ if (g && l && l(), c.length === 0)
685
+ return s;
686
+ o && o();
687
+ let w = s.slice(0, c[0]);
688
+ for (let k = 0; k < c.length; ++k) {
689
+ const S = c[k], O = c[k + 1] || s.length;
690
+ S === 0 ? w = `
691
+ ${e}${s.slice(0, O)}` : (t === _e && p[S] && (w += `${s[S]}\\`), w += `
692
+ ${e}${s.slice(S + 1, O)}`);
693
+ }
694
+ return w;
695
+ }
696
+ function Tt(s, e, t) {
697
+ let n = e, i = e + 1, r = s[i];
698
+ for (; r === " " || r === " "; )
699
+ if (e < i + t)
700
+ r = s[++e];
701
+ else {
702
+ do
703
+ r = s[++e];
704
+ while (r && r !== `
705
+ `);
706
+ n = e, i = e + 1, r = s[i];
707
+ }
708
+ return n;
709
+ }
710
+ const Fe = (s, e) => ({
711
+ indentAtStart: e ? s.indent.length : s.indentAtStart,
712
+ lineWidth: s.options.lineWidth,
713
+ minContentWidth: s.options.minContentWidth
714
+ }), Ue = (s) => /^(%|---|\.\.\.)/m.test(s);
715
+ function js(s, e, t) {
716
+ if (!e || e < 0)
717
+ return !1;
718
+ const n = e - t, i = s.length;
719
+ if (i <= n)
720
+ return !1;
721
+ for (let r = 0, o = 0; r < i; ++r)
722
+ if (s[r] === `
723
+ `) {
724
+ if (r - o > n)
725
+ return !0;
726
+ if (o = r + 1, i - o <= n)
727
+ return !1;
728
+ }
729
+ return !0;
730
+ }
731
+ function we(s, e) {
732
+ const t = JSON.stringify(s);
733
+ if (e.options.doubleQuotedAsJSON)
734
+ return t;
735
+ const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (Ue(s) ? " " : "");
736
+ let o = "", l = 0;
737
+ for (let a = 0, c = t[a]; c; c = t[++a])
738
+ if (c === " " && t[a + 1] === "\\" && t[a + 2] === "n" && (o += t.slice(l, a) + "\\ ", a += 1, l = a, c = "\\"), c === "\\")
739
+ switch (t[a + 1]) {
740
+ case "u":
741
+ {
742
+ o += t.slice(l, a);
743
+ const p = t.substr(a + 2, 4);
744
+ switch (p) {
745
+ case "0000":
746
+ o += "\\0";
747
+ break;
748
+ case "0007":
749
+ o += "\\a";
750
+ break;
751
+ case "000b":
752
+ o += "\\v";
753
+ break;
754
+ case "001b":
755
+ o += "\\e";
756
+ break;
757
+ case "0085":
758
+ o += "\\N";
759
+ break;
760
+ case "00a0":
761
+ o += "\\_";
762
+ break;
763
+ case "2028":
764
+ o += "\\L";
765
+ break;
766
+ case "2029":
767
+ o += "\\P";
768
+ break;
769
+ default:
770
+ p.substr(0, 2) === "00" ? o += "\\x" + p.substr(2) : o += t.substr(a, 6);
771
+ }
772
+ a += 5, l = a + 1;
773
+ }
774
+ break;
775
+ case "n":
776
+ if (n || t[a + 2] === '"' || t.length < i)
777
+ a += 1;
778
+ else {
779
+ for (o += t.slice(l, a) + `
780
+
781
+ `; t[a + 2] === "\\" && t[a + 3] === "n" && t[a + 4] !== '"'; )
782
+ o += `
783
+ `, a += 2;
784
+ o += r, t[a + 2] === " " && (o += "\\"), a += 1, l = a + 1;
785
+ }
786
+ break;
787
+ default:
788
+ a += 1;
789
+ }
790
+ return o = l ? o + t.slice(l) : t, n ? o : qe(o, r, _e, Fe(e, !1));
791
+ }
792
+ function lt(s, e) {
793
+ if (e.options.singleQuote === !1 || e.implicitKey && s.includes(`
794
+ `) || /[ \t]\n|\n[ \t]/.test(s))
795
+ return we(s, e);
796
+ const t = e.indent || (Ue(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
797
+ ${t}`) + "'";
798
+ return e.implicitKey ? n : qe(n, t, Qt, Fe(e, !1));
799
+ }
800
+ function re(s, e) {
801
+ const { singleQuote: t } = e.options;
802
+ let n;
803
+ if (t === !1)
804
+ n = we;
805
+ else {
806
+ const i = s.includes('"'), r = s.includes("'");
807
+ i && !r ? n = lt : r && !i ? n = we : n = t ? lt : we;
808
+ }
809
+ return n(s, e);
810
+ }
811
+ let at;
812
+ try {
813
+ at = new RegExp(`(^|(?<!
814
+ ))
815
+ +(?!
816
+ |$)`, "g");
817
+ } catch {
818
+ at = /\n+(?!\n|$)/g;
819
+ }
820
+ function Ce({ comment: s, type: e, value: t }, n, i, r) {
821
+ const { blockQuote: o, commentString: l, lineWidth: a } = n.options;
822
+ if (!o || /\n[\t ]+$/.test(t) || /^\s*$/.test(t))
823
+ return re(t, n);
824
+ const c = n.indent || (n.forceBlockIndent || Ue(t) ? " " : ""), p = o === "literal" ? !0 : o === "folded" || e === N.BLOCK_FOLDED ? !1 : e === N.BLOCK_LITERAL ? !0 : !js(t, a, c.length);
825
+ if (!t)
826
+ return p ? `|
827
+ ` : `>
828
+ `;
829
+ let f, u;
830
+ for (u = t.length; u > 0; --u) {
831
+ const y = t[u - 1];
832
+ if (y !== `
833
+ ` && y !== " " && y !== " ")
834
+ break;
835
+ }
836
+ let m = t.substring(u);
837
+ const g = m.indexOf(`
838
+ `);
839
+ g === -1 ? f = "-" : t === m || g !== m.length - 1 ? (f = "+", r && r()) : f = "", m && (t = t.slice(0, -m.length), m[m.length - 1] === `
840
+ ` && (m = m.slice(0, -1)), m = m.replace(at, `$&${c}`));
841
+ let h = !1, d, b = -1;
842
+ for (d = 0; d < t.length; ++d) {
843
+ const y = t[d];
844
+ if (y === " ")
845
+ h = !0;
846
+ else if (y === `
847
+ `)
848
+ b = d;
849
+ else
850
+ break;
851
+ }
852
+ let w = t.substring(0, b < d ? b + 1 : d);
853
+ w && (t = t.substring(w.length), w = w.replace(/\n+/g, `$&${c}`));
854
+ let S = (p ? "|" : ">") + (h ? c ? "2" : "1" : "") + f;
855
+ if (s && (S += " " + l(s.replace(/ ?[\r\n]+/g, " ")), i && i()), p)
856
+ return t = t.replace(/\n+/g, `$&${c}`), `${S}
857
+ ${c}${w}${t}${m}`;
858
+ t = t.replace(/\n+/g, `
859
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
860
+ const O = qe(`${w}${t}${m}`, c, ot, Fe(n, !0));
861
+ return `${S}
862
+ ${c}${O}`;
863
+ }
864
+ function Ds(s, e, t, n) {
865
+ const { type: i, value: r } = s, { actualString: o, implicitKey: l, indent: a, indentStep: c, inFlow: p } = e;
866
+ if (l && r.includes(`
867
+ `) || p && /[[\]{},]/.test(r))
868
+ return re(r, e);
869
+ if (!r || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
870
+ return l || p || !r.includes(`
871
+ `) ? re(r, e) : Ce(s, e, t, n);
872
+ if (!l && !p && i !== N.PLAIN && r.includes(`
873
+ `))
874
+ return Ce(s, e, t, n);
875
+ if (Ue(r)) {
876
+ if (a === "")
877
+ return e.forceBlockIndent = !0, Ce(s, e, t, n);
878
+ if (l && a === c)
879
+ return re(r, e);
880
+ }
881
+ const f = r.replace(/\n+/g, `$&
882
+ ${a}`);
883
+ if (o) {
884
+ const u = (h) => {
885
+ var d;
886
+ return h.default && h.tag !== "tag:yaml.org,2002:str" && ((d = h.test) == null ? void 0 : d.test(f));
887
+ }, { compat: m, tags: g } = e.doc.schema;
888
+ if (g.some(u) || m != null && m.some(u))
889
+ return re(r, e);
890
+ }
891
+ return l ? f : qe(f, a, Qt, Fe(e, !1));
892
+ }
893
+ function Oe(s, e, t, n) {
894
+ const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
895
+ let { type: l } = s;
896
+ l !== N.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (l = N.QUOTE_DOUBLE);
897
+ const a = (p) => {
898
+ switch (p) {
899
+ case N.BLOCK_FOLDED:
900
+ case N.BLOCK_LITERAL:
901
+ return i || r ? re(o.value, e) : Ce(o, e, t, n);
902
+ case N.QUOTE_DOUBLE:
903
+ return we(o.value, e);
904
+ case N.QUOTE_SINGLE:
905
+ return lt(o.value, e);
906
+ case N.PLAIN:
907
+ return Ds(o, e, t, n);
908
+ default:
909
+ return null;
910
+ }
911
+ };
912
+ let c = a(l);
913
+ if (c === null) {
914
+ const { defaultKeyType: p, defaultStringType: f } = e.options, u = i && p || f;
915
+ if (c = a(u), c === null)
916
+ throw new Error(`Unsupported default string type ${u}`);
917
+ }
918
+ return c;
919
+ }
920
+ function Wt(s, e) {
921
+ const t = Object.assign({
922
+ blockQuote: !0,
923
+ commentString: Ps,
924
+ defaultKeyType: null,
925
+ defaultStringType: "PLAIN",
926
+ directives: null,
927
+ doubleQuotedAsJSON: !1,
928
+ doubleQuotedMinMultiLineLength: 40,
929
+ falseStr: "false",
930
+ flowCollectionPadding: !0,
931
+ indentSeq: !0,
932
+ lineWidth: 80,
933
+ minContentWidth: 20,
934
+ nullStr: "null",
935
+ simpleKeys: !1,
936
+ singleQuote: null,
937
+ trueStr: "true",
938
+ verifyAliasOrder: !0
939
+ }, s.schema.toStringOptions, e);
940
+ let n;
941
+ switch (t.collectionStyle) {
942
+ case "block":
943
+ n = !1;
944
+ break;
945
+ case "flow":
946
+ n = !0;
947
+ break;
948
+ default:
949
+ n = null;
950
+ }
951
+ return {
952
+ anchors: /* @__PURE__ */ new Set(),
953
+ doc: s,
954
+ flowCollectionPadding: t.flowCollectionPadding ? " " : "",
955
+ indent: "",
956
+ indentStep: typeof t.indent == "number" ? " ".repeat(t.indent) : " ",
957
+ inFlow: n,
958
+ options: t
959
+ };
960
+ }
961
+ function Ks(s, e) {
962
+ var i;
963
+ if (e.tag) {
964
+ const r = s.filter((o) => o.tag === e.tag);
965
+ if (r.length > 0)
966
+ return r.find((o) => o.format === e.format) ?? r[0];
967
+ }
968
+ let t, n;
969
+ if (A(e)) {
970
+ n = e.value;
971
+ const r = s.filter((o) => {
972
+ var l;
973
+ return (l = o.identify) == null ? void 0 : l.call(o, n);
974
+ });
975
+ t = r.find((o) => o.format === e.format) ?? r.find((o) => !o.format);
976
+ } else
977
+ n = e, t = s.find((r) => r.nodeClass && n instanceof r.nodeClass);
978
+ if (!t) {
979
+ const r = ((i = n == null ? void 0 : n.constructor) == null ? void 0 : i.name) ?? typeof n;
980
+ throw new Error(`Tag not resolved for ${r} value`);
981
+ }
982
+ return t;
983
+ }
984
+ function qs(s, e, { anchors: t, doc: n }) {
985
+ if (!n.directives)
986
+ return "";
987
+ const i = [], r = (A(s) || T(s)) && s.anchor;
988
+ r && Vt(r) && (t.add(r), i.push(`&${r}`));
989
+ const o = s.tag ? s.tag : e.default ? null : e.tag;
990
+ return o && i.push(n.directives.tagString(o)), i.join(" ");
991
+ }
992
+ function ae(s, e, t, n) {
993
+ var a;
994
+ if (E(s))
995
+ return s.toString(e, t, n);
996
+ if (Z(s)) {
997
+ if (e.doc.directives)
998
+ return s.toString(e);
999
+ if ((a = e.resolvedAliases) != null && a.has(s))
1000
+ throw new TypeError("Cannot stringify circular structure without alias nodes");
1001
+ e.resolvedAliases ? e.resolvedAliases.add(s) : e.resolvedAliases = /* @__PURE__ */ new Set([s]), s = s.resolve(e.doc);
1002
+ }
1003
+ let i;
1004
+ const r = $(s) ? s : e.doc.createNode(s, { onTagObj: (c) => i = c });
1005
+ i || (i = Ks(e.doc.schema.tags, r));
1006
+ const o = qs(r, i, e);
1007
+ o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
1008
+ const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : A(r) ? Oe(r, e, t, n) : r.toString(e, t, n);
1009
+ return o ? A(r) || l[0] === "{" || l[0] === "[" ? `${o} ${l}` : `${o}
1010
+ ${e.indent}${l}` : l;
1011
+ }
1012
+ function Fs({ key: s, value: e }, t, n, i) {
1013
+ const { allNullValues: r, doc: o, indent: l, indentStep: a, options: { commentString: c, indentSeq: p, simpleKeys: f } } = t;
1014
+ let u = $(s) && s.comment || null;
1015
+ if (f) {
1016
+ if (u)
1017
+ throw new Error("With simple keys, key nodes cannot have comments");
1018
+ if (T(s)) {
1019
+ const I = "With simple keys, collection cannot be used as a key value";
1020
+ throw new Error(I);
1021
+ }
1022
+ }
1023
+ let m = !f && (!s || u && e == null && !t.inFlow || T(s) || (A(s) ? s.type === N.BLOCK_FOLDED || s.type === N.BLOCK_LITERAL : typeof s == "object"));
1024
+ t = Object.assign({}, t, {
1025
+ allNullValues: !1,
1026
+ implicitKey: !m && (f || !r),
1027
+ indent: l + a
1028
+ });
1029
+ let g = !1, h = !1, d = ae(s, t, () => g = !0, () => h = !0);
1030
+ if (!m && !t.inFlow && d.length > 1024) {
1031
+ if (f)
1032
+ throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
1033
+ m = !0;
1034
+ }
1035
+ if (t.inFlow) {
1036
+ if (r || e == null)
1037
+ return g && n && n(), d === "" ? "?" : m ? `? ${d}` : d;
1038
+ } else if (r && !f || e == null && m)
1039
+ return d = `? ${d}`, u && !g ? d += W(d, t.indent, c(u)) : h && i && i(), d;
1040
+ g && (u = null), m ? (u && (d += W(d, t.indent, c(u))), d = `? ${d}
1041
+ ${l}:`) : (d = `${d}:`, u && (d += W(d, t.indent, c(u))));
1042
+ let b, w, k;
1043
+ $(e) ? (b = !!e.spaceBefore, w = e.commentBefore, k = e.comment) : (b = !1, w = null, k = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !m && !u && A(e) && (t.indentAtStart = d.length + 1), h = !1, !p && a.length >= 2 && !t.inFlow && !m && de(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
1044
+ let S = !1;
1045
+ const O = ae(e, t, () => S = !0, () => h = !0);
1046
+ let y = " ";
1047
+ if (u || b || w) {
1048
+ if (y = b ? `
1049
+ ` : "", w) {
1050
+ const I = c(w);
1051
+ y += `
1052
+ ${R(I, t.indent)}`;
1053
+ }
1054
+ O === "" && !t.inFlow ? y === `
1055
+ ` && (y = `
1056
+
1057
+ `) : y += `
1058
+ ${t.indent}`;
1059
+ } else if (!m && T(e)) {
1060
+ const I = O[0], L = O.indexOf(`
1061
+ `), C = L !== -1, Q = t.inFlow ?? e.flow ?? e.items.length === 0;
1062
+ if (C || !Q) {
1063
+ let x = !1;
1064
+ if (C && (I === "&" || I === "!")) {
1065
+ let _ = O.indexOf(" ");
1066
+ I === "&" && _ !== -1 && _ < L && O[_ + 1] === "!" && (_ = O.indexOf(" ", _ + 1)), (_ === -1 || L < _) && (x = !0);
1067
+ }
1068
+ x || (y = `
1069
+ ${t.indent}`);
1070
+ }
1071
+ } else (O === "" || O[0] === `
1072
+ `) && (y = "");
1073
+ return d += y + O, t.inFlow ? S && n && n() : k && !S ? d += W(d, t.indent, c(k)) : h && i && i(), d;
1074
+ }
1075
+ function Ht(s, e) {
1076
+ (s === "debug" || s === "warn") && (typeof process < "u" && process.emitWarning ? process.emitWarning(e) : console.warn(e));
1077
+ }
1078
+ const Lt = "<<";
1079
+ function Xt(s, e, { key: t, value: n }) {
1080
+ if (s != null && s.doc.schema.merge && Us(t))
1081
+ if (n = Z(n) ? n.resolve(s.doc) : n, de(n))
1082
+ for (const i of n.items)
1083
+ ze(s, e, i);
1084
+ else if (Array.isArray(n))
1085
+ for (const i of n)
1086
+ ze(s, e, i);
1087
+ else
1088
+ ze(s, e, n);
1089
+ else {
1090
+ const i = D(t, "", s);
1091
+ if (e instanceof Map)
1092
+ e.set(i, D(n, i, s));
1093
+ else if (e instanceof Set)
1094
+ e.add(i);
1095
+ else {
1096
+ const r = Rs(t, i, s), o = D(n, r, s);
1097
+ r in e ? Object.defineProperty(e, r, {
1098
+ value: o,
1099
+ writable: !0,
1100
+ enumerable: !0,
1101
+ configurable: !0
1102
+ }) : e[r] = o;
1103
+ }
1104
+ }
1105
+ return e;
1106
+ }
1107
+ const Us = (s) => s === Lt || A(s) && s.value === Lt && (!s.type || s.type === N.PLAIN);
1108
+ function ze(s, e, t) {
1109
+ const n = s && Z(t) ? t.resolve(s.doc) : t;
1110
+ if (!he(n))
1111
+ throw new Error("Merge sources must be maps or map aliases");
1112
+ const i = n.toJSON(null, s, Map);
1113
+ for (const [r, o] of i)
1114
+ e instanceof Map ? e.has(r) || e.set(r, o) : e instanceof Set ? e.add(r) : Object.prototype.hasOwnProperty.call(e, r) || Object.defineProperty(e, r, {
1115
+ value: o,
1116
+ writable: !0,
1117
+ enumerable: !0,
1118
+ configurable: !0
1119
+ });
1120
+ return e;
1121
+ }
1122
+ function Rs(s, e, t) {
1123
+ if (e === null)
1124
+ return "";
1125
+ if (typeof e != "object")
1126
+ return String(e);
1127
+ if ($(s) && (t != null && t.doc)) {
1128
+ const n = Wt(t.doc, {});
1129
+ n.anchors = /* @__PURE__ */ new Set();
1130
+ for (const r of t.anchors.keys())
1131
+ n.anchors.add(r.anchor);
1132
+ n.inFlow = !0, n.inStringifyKey = !0;
1133
+ const i = s.toString(n);
1134
+ if (!t.mapKeyWarned) {
1135
+ let r = JSON.stringify(i);
1136
+ r.length > 40 && (r = r.substring(0, 36) + '..."'), Ht(t.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`), t.mapKeyWarned = !0;
1137
+ }
1138
+ return i;
1139
+ }
1140
+ return JSON.stringify(e);
1141
+ }
1142
+ function pt(s, e, t) {
1143
+ const n = Se(s, void 0, t), i = Se(e, void 0, t);
1144
+ return new v(n, i);
1145
+ }
1146
+ class v {
1147
+ constructor(e, t = null) {
1148
+ Object.defineProperty(this, K, { value: Kt }), this.key = e, this.value = t;
1149
+ }
1150
+ clone(e) {
1151
+ let { key: t, value: n } = this;
1152
+ return $(t) && (t = t.clone(e)), $(n) && (n = n.clone(e)), new v(t, n);
1153
+ }
1154
+ toJSON(e, t) {
1155
+ const n = t != null && t.mapAsMap ? /* @__PURE__ */ new Map() : {};
1156
+ return Xt(t, n, this);
1157
+ }
1158
+ toString(e, t, n) {
1159
+ return e != null && e.doc ? Fs(this, e, t, n) : JSON.stringify(this);
1160
+ }
1161
+ }
1162
+ function zt(s, e, t) {
1163
+ return (e.inFlow ?? s.flow ? Js : Vs)(s, e, t);
1164
+ }
1165
+ function Vs({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: l }) {
1166
+ const { indent: a, options: { commentString: c } } = t, p = Object.assign({}, t, { indent: r, type: null });
1167
+ let f = !1;
1168
+ const u = [];
1169
+ for (let g = 0; g < e.length; ++g) {
1170
+ const h = e[g];
1171
+ let d = null;
1172
+ if ($(h))
1173
+ !f && h.spaceBefore && u.push(""), Me(t, u, h.commentBefore, f), h.comment && (d = h.comment);
1174
+ else if (E(h)) {
1175
+ const w = $(h.key) ? h.key : null;
1176
+ w && (!f && w.spaceBefore && u.push(""), Me(t, u, w.commentBefore, f));
1177
+ }
1178
+ f = !1;
1179
+ let b = ae(h, p, () => d = null, () => f = !0);
1180
+ d && (b += W(b, r, c(d))), f && d && (f = !1), u.push(n + b);
1181
+ }
1182
+ let m;
1183
+ if (u.length === 0)
1184
+ m = i.start + i.end;
1185
+ else {
1186
+ m = u[0];
1187
+ for (let g = 1; g < u.length; ++g) {
1188
+ const h = u[g];
1189
+ m += h ? `
1190
+ ${a}${h}` : `
1191
+ `;
1192
+ }
1193
+ }
1194
+ return s ? (m += `
1195
+ ` + R(c(s), a), l && l()) : f && o && o(), m;
1196
+ }
1197
+ function Js({ items: s }, e, { flowChars: t, itemIndent: n }) {
1198
+ const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: l } } = e;
1199
+ n += r;
1200
+ const a = Object.assign({}, e, {
1201
+ indent: n,
1202
+ inFlow: !0,
1203
+ type: null
1204
+ });
1205
+ let c = !1, p = 0;
1206
+ const f = [];
1207
+ for (let g = 0; g < s.length; ++g) {
1208
+ const h = s[g];
1209
+ let d = null;
1210
+ if ($(h))
1211
+ h.spaceBefore && f.push(""), Me(e, f, h.commentBefore, !1), h.comment && (d = h.comment);
1212
+ else if (E(h)) {
1213
+ const w = $(h.key) ? h.key : null;
1214
+ w && (w.spaceBefore && f.push(""), Me(e, f, w.commentBefore, !1), w.comment && (c = !0));
1215
+ const k = $(h.value) ? h.value : null;
1216
+ k ? (k.comment && (d = k.comment), k.commentBefore && (c = !0)) : h.value == null && (w != null && w.comment) && (d = w.comment);
1217
+ }
1218
+ d && (c = !0);
1219
+ let b = ae(h, a, () => d = null);
1220
+ g < s.length - 1 && (b += ","), d && (b += W(b, n, l(d))), !c && (f.length > p || b.includes(`
1221
+ `)) && (c = !0), f.push(b), p = f.length;
1222
+ }
1223
+ const { start: u, end: m } = t;
1224
+ if (f.length === 0)
1225
+ return u + m;
1226
+ if (!c) {
1227
+ const g = f.reduce((h, d) => h + d.length + 2, 2);
1228
+ c = e.options.lineWidth > 0 && g > e.options.lineWidth;
1229
+ }
1230
+ if (c) {
1231
+ let g = u;
1232
+ for (const h of f)
1233
+ g += h ? `
1234
+ ${r}${i}${h}` : `
1235
+ `;
1236
+ return `${g}
1237
+ ${i}${m}`;
1238
+ } else
1239
+ return `${u}${o}${f.join(" ")}${o}${m}`;
1240
+ }
1241
+ function Me({ indent: s, options: { commentString: e } }, t, n, i) {
1242
+ if (n && i && (n = n.replace(/^\n+/, "")), n) {
1243
+ const r = R(e(n), s);
1244
+ t.push(r.trimStart());
1245
+ }
1246
+ }
1247
+ function H(s, e) {
1248
+ const t = A(e) ? e.value : e;
1249
+ for (const n of s)
1250
+ if (E(n) && (n.key === e || n.key === t || A(n.key) && n.key.value === t))
1251
+ return n;
1252
+ }
1253
+ class P extends dt {
1254
+ static get tagName() {
1255
+ return "tag:yaml.org,2002:map";
1256
+ }
1257
+ constructor(e) {
1258
+ super(J, e), this.items = [];
1259
+ }
1260
+ /**
1261
+ * A generic collection parsing method that can be extended
1262
+ * to other node classes that inherit from YAMLMap
1263
+ */
1264
+ static from(e, t, n) {
1265
+ const { keepUndefined: i, replacer: r } = n, o = new this(e), l = (a, c) => {
1266
+ if (typeof r == "function")
1267
+ c = r.call(t, a, c);
1268
+ else if (Array.isArray(r) && !r.includes(a))
1269
+ return;
1270
+ (c !== void 0 || i) && o.items.push(pt(a, c, n));
1271
+ };
1272
+ if (t instanceof Map)
1273
+ for (const [a, c] of t)
1274
+ l(a, c);
1275
+ else if (t && typeof t == "object")
1276
+ for (const a of Object.keys(t))
1277
+ l(a, t[a]);
1278
+ return typeof e.sortMapEntries == "function" && o.items.sort(e.sortMapEntries), o;
1279
+ }
1280
+ /**
1281
+ * Adds a value to the collection.
1282
+ *
1283
+ * @param overwrite - If not set `true`, using a key that is already in the
1284
+ * collection will throw. Otherwise, overwrites the previous value.
1285
+ */
1286
+ add(e, t) {
1287
+ var o;
1288
+ let n;
1289
+ E(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new v(e, e == null ? void 0 : e.value) : n = new v(e.key, e.value);
1290
+ const i = H(this.items, n.key), r = (o = this.schema) == null ? void 0 : o.sortMapEntries;
1291
+ if (i) {
1292
+ if (!t)
1293
+ throw new Error(`Key ${n.key} already set`);
1294
+ A(i.value) && Gt(n.value) ? i.value.value = n.value : i.value = n.value;
1295
+ } else if (r) {
1296
+ const l = this.items.findIndex((a) => r(n, a) < 0);
1297
+ l === -1 ? this.items.push(n) : this.items.splice(l, 0, n);
1298
+ } else
1299
+ this.items.push(n);
1300
+ }
1301
+ delete(e) {
1302
+ const t = H(this.items, e);
1303
+ return t ? this.items.splice(this.items.indexOf(t), 1).length > 0 : !1;
1304
+ }
1305
+ get(e, t) {
1306
+ const n = H(this.items, e), i = n == null ? void 0 : n.value;
1307
+ return (!t && A(i) ? i.value : i) ?? void 0;
1308
+ }
1309
+ has(e) {
1310
+ return !!H(this.items, e);
1311
+ }
1312
+ set(e, t) {
1313
+ this.add(new v(e, t), !0);
1314
+ }
1315
+ /**
1316
+ * @param ctx - Conversion context, originally set in Document#toJS()
1317
+ * @param {Class} Type - If set, forces the returned collection type
1318
+ * @returns Instance of Type, Map, or Object
1319
+ */
1320
+ toJSON(e, t, n) {
1321
+ const i = n ? new n() : t != null && t.mapAsMap ? /* @__PURE__ */ new Map() : {};
1322
+ t != null && t.onCreate && t.onCreate(i);
1323
+ for (const r of this.items)
1324
+ Xt(t, i, r);
1325
+ return i;
1326
+ }
1327
+ toString(e, t, n) {
1328
+ if (!e)
1329
+ return JSON.stringify(this);
1330
+ for (const i of this.items)
1331
+ if (!E(i))
1332
+ throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);
1333
+ return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), zt(this, e, {
1334
+ blockItemPrefix: "",
1335
+ flowChars: { start: "{", end: "}" },
1336
+ itemIndent: e.indent || "",
1337
+ onChompKeep: n,
1338
+ onComment: t
1339
+ });
1340
+ }
1341
+ }
1342
+ const pe = {
1343
+ collection: "map",
1344
+ default: !0,
1345
+ nodeClass: P,
1346
+ tag: "tag:yaml.org,2002:map",
1347
+ resolve(s, e) {
1348
+ return he(s) || e("Expected a mapping for this tag"), s;
1349
+ },
1350
+ createNode: (s, e, t) => P.from(s, e, t)
1351
+ };
1352
+ class G extends dt {
1353
+ static get tagName() {
1354
+ return "tag:yaml.org,2002:seq";
1355
+ }
1356
+ constructor(e) {
1357
+ super(fe, e), this.items = [];
1358
+ }
1359
+ add(e) {
1360
+ this.items.push(e);
1361
+ }
1362
+ /**
1363
+ * Removes a value from the collection.
1364
+ *
1365
+ * `key` must contain a representation of an integer for this to succeed.
1366
+ * It may be wrapped in a `Scalar`.
1367
+ *
1368
+ * @returns `true` if the item was found and removed.
1369
+ */
1370
+ delete(e) {
1371
+ const t = Ie(e);
1372
+ return typeof t != "number" ? !1 : this.items.splice(t, 1).length > 0;
1373
+ }
1374
+ get(e, t) {
1375
+ const n = Ie(e);
1376
+ if (typeof n != "number")
1377
+ return;
1378
+ const i = this.items[n];
1379
+ return !t && A(i) ? i.value : i;
1380
+ }
1381
+ /**
1382
+ * Checks if the collection includes a value with the key `key`.
1383
+ *
1384
+ * `key` must contain a representation of an integer for this to succeed.
1385
+ * It may be wrapped in a `Scalar`.
1386
+ */
1387
+ has(e) {
1388
+ const t = Ie(e);
1389
+ return typeof t == "number" && t < this.items.length;
1390
+ }
1391
+ /**
1392
+ * Sets a value in this collection. For `!!set`, `value` needs to be a
1393
+ * boolean to add/remove the item from the set.
1394
+ *
1395
+ * If `key` does not contain a representation of an integer, this will throw.
1396
+ * It may be wrapped in a `Scalar`.
1397
+ */
1398
+ set(e, t) {
1399
+ const n = Ie(e);
1400
+ if (typeof n != "number")
1401
+ throw new Error(`Expected a valid index, not ${e}.`);
1402
+ const i = this.items[n];
1403
+ A(i) && Gt(t) ? i.value = t : this.items[n] = t;
1404
+ }
1405
+ toJSON(e, t) {
1406
+ const n = [];
1407
+ t != null && t.onCreate && t.onCreate(n);
1408
+ let i = 0;
1409
+ for (const r of this.items)
1410
+ n.push(D(r, String(i++), t));
1411
+ return n;
1412
+ }
1413
+ toString(e, t, n) {
1414
+ return e ? zt(this, e, {
1415
+ blockItemPrefix: "- ",
1416
+ flowChars: { start: "[", end: "]" },
1417
+ itemIndent: (e.indent || "") + " ",
1418
+ onChompKeep: n,
1419
+ onComment: t
1420
+ }) : JSON.stringify(this);
1421
+ }
1422
+ static from(e, t, n) {
1423
+ const { replacer: i } = n, r = new this(e);
1424
+ if (t && Symbol.iterator in Object(t)) {
1425
+ let o = 0;
1426
+ for (let l of t) {
1427
+ if (typeof i == "function") {
1428
+ const a = t instanceof Set ? l : String(o++);
1429
+ l = i.call(t, a, l);
1430
+ }
1431
+ r.items.push(Se(l, void 0, n));
1432
+ }
1433
+ }
1434
+ return r;
1435
+ }
1436
+ }
1437
+ function Ie(s) {
1438
+ let e = A(s) ? s.value : s;
1439
+ return e && typeof e == "string" && (e = Number(e)), typeof e == "number" && Number.isInteger(e) && e >= 0 ? e : null;
1440
+ }
1441
+ const me = {
1442
+ collection: "seq",
1443
+ default: !0,
1444
+ nodeClass: G,
1445
+ tag: "tag:yaml.org,2002:seq",
1446
+ resolve(s, e) {
1447
+ return de(s) || e("Expected a sequence for this tag"), s;
1448
+ },
1449
+ createNode: (s, e, t) => G.from(s, e, t)
1450
+ }, Re = {
1451
+ identify: (s) => typeof s == "string",
1452
+ default: !0,
1453
+ tag: "tag:yaml.org,2002:str",
1454
+ resolve: (s) => s,
1455
+ stringify(s, e, t, n) {
1456
+ return e = Object.assign({ actualString: !0 }, e), Oe(s, e, t, n);
1457
+ }
1458
+ }, Ve = {
1459
+ identify: (s) => s == null,
1460
+ createNode: () => new N(null),
1461
+ default: !0,
1462
+ tag: "tag:yaml.org,2002:null",
1463
+ test: /^(?:~|[Nn]ull|NULL)?$/,
1464
+ resolve: () => new N(null),
1465
+ stringify: ({ source: s }, e) => typeof s == "string" && Ve.test.test(s) ? s : e.options.nullStr
1466
+ }, mt = {
1467
+ identify: (s) => typeof s == "boolean",
1468
+ default: !0,
1469
+ tag: "tag:yaml.org,2002:bool",
1470
+ test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
1471
+ resolve: (s) => new N(s[0] === "t" || s[0] === "T"),
1472
+ stringify({ source: s, value: e }, t) {
1473
+ if (s && mt.test.test(s)) {
1474
+ const n = s[0] === "t" || s[0] === "T";
1475
+ if (e === n)
1476
+ return s;
1477
+ }
1478
+ return e ? t.options.trueStr : t.options.falseStr;
1479
+ }
1480
+ };
1481
+ function F({ format: s, minFractionDigits: e, tag: t, value: n }) {
1482
+ if (typeof n == "bigint")
1483
+ return String(n);
1484
+ const i = typeof n == "number" ? n : Number(n);
1485
+ if (!isFinite(i))
1486
+ return isNaN(i) ? ".nan" : i < 0 ? "-.inf" : ".inf";
1487
+ let r = JSON.stringify(n);
1488
+ if (!s && e && (!t || t === "tag:yaml.org,2002:float") && /^\d/.test(r)) {
1489
+ let o = r.indexOf(".");
1490
+ o < 0 && (o = r.length, r += ".");
1491
+ let l = e - (r.length - o - 1);
1492
+ for (; l-- > 0; )
1493
+ r += "0";
1494
+ }
1495
+ return r;
1496
+ }
1497
+ const Zt = {
1498
+ identify: (s) => typeof s == "number",
1499
+ default: !0,
1500
+ tag: "tag:yaml.org,2002:float",
1501
+ test: /^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,
1502
+ resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
1503
+ stringify: F
1504
+ }, xt = {
1505
+ identify: (s) => typeof s == "number",
1506
+ default: !0,
1507
+ tag: "tag:yaml.org,2002:float",
1508
+ format: "EXP",
1509
+ test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
1510
+ resolve: (s) => parseFloat(s),
1511
+ stringify(s) {
1512
+ const e = Number(s.value);
1513
+ return isFinite(e) ? e.toExponential() : F(s);
1514
+ }
1515
+ }, es = {
1516
+ identify: (s) => typeof s == "number",
1517
+ default: !0,
1518
+ tag: "tag:yaml.org,2002:float",
1519
+ test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
1520
+ resolve(s) {
1521
+ const e = new N(parseFloat(s)), t = s.indexOf(".");
1522
+ return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
1523
+ },
1524
+ stringify: F
1525
+ }, Je = (s) => typeof s == "bigint" || Number.isInteger(s), yt = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
1526
+ function ts(s, e, t) {
1527
+ const { value: n } = s;
1528
+ return Je(n) && n >= 0 ? t + n.toString(e) : F(s);
1529
+ }
1530
+ const ss = {
1531
+ identify: (s) => Je(s) && s >= 0,
1532
+ default: !0,
1533
+ tag: "tag:yaml.org,2002:int",
1534
+ format: "OCT",
1535
+ test: /^0o[0-7]+$/,
1536
+ resolve: (s, e, t) => yt(s, 2, 8, t),
1537
+ stringify: (s) => ts(s, 8, "0o")
1538
+ }, ns = {
1539
+ identify: Je,
1540
+ default: !0,
1541
+ tag: "tag:yaml.org,2002:int",
1542
+ test: /^[-+]?[0-9]+$/,
1543
+ resolve: (s, e, t) => yt(s, 0, 10, t),
1544
+ stringify: F
1545
+ }, is = {
1546
+ identify: (s) => Je(s) && s >= 0,
1547
+ default: !0,
1548
+ tag: "tag:yaml.org,2002:int",
1549
+ format: "HEX",
1550
+ test: /^0x[0-9a-fA-F]+$/,
1551
+ resolve: (s, e, t) => yt(s, 2, 16, t),
1552
+ stringify: (s) => ts(s, 16, "0x")
1553
+ }, Ys = [
1554
+ pe,
1555
+ me,
1556
+ Re,
1557
+ Ve,
1558
+ mt,
1559
+ ss,
1560
+ ns,
1561
+ is,
1562
+ Zt,
1563
+ xt,
1564
+ es
1565
+ ];
1566
+ function $t(s) {
1567
+ return typeof s == "bigint" || Number.isInteger(s);
1568
+ }
1569
+ const Te = ({ value: s }) => JSON.stringify(s), Gs = [
1570
+ {
1571
+ identify: (s) => typeof s == "string",
1572
+ default: !0,
1573
+ tag: "tag:yaml.org,2002:str",
1574
+ resolve: (s) => s,
1575
+ stringify: Te
1576
+ },
1577
+ {
1578
+ identify: (s) => s == null,
1579
+ createNode: () => new N(null),
1580
+ default: !0,
1581
+ tag: "tag:yaml.org,2002:null",
1582
+ test: /^null$/,
1583
+ resolve: () => null,
1584
+ stringify: Te
1585
+ },
1586
+ {
1587
+ identify: (s) => typeof s == "boolean",
1588
+ default: !0,
1589
+ tag: "tag:yaml.org,2002:bool",
1590
+ test: /^true|false$/,
1591
+ resolve: (s) => s === "true",
1592
+ stringify: Te
1593
+ },
1594
+ {
1595
+ identify: $t,
1596
+ default: !0,
1597
+ tag: "tag:yaml.org,2002:int",
1598
+ test: /^-?(?:0|[1-9][0-9]*)$/,
1599
+ resolve: (s, e, { intAsBigInt: t }) => t ? BigInt(s) : parseInt(s, 10),
1600
+ stringify: ({ value: s }) => $t(s) ? s.toString() : JSON.stringify(s)
1601
+ },
1602
+ {
1603
+ identify: (s) => typeof s == "number",
1604
+ default: !0,
1605
+ tag: "tag:yaml.org,2002:float",
1606
+ test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
1607
+ resolve: (s) => parseFloat(s),
1608
+ stringify: Te
1609
+ }
1610
+ ], Qs = {
1611
+ default: !0,
1612
+ tag: "",
1613
+ test: /^/,
1614
+ resolve(s, e) {
1615
+ return e(`Unresolved plain scalar ${JSON.stringify(s)}`), s;
1616
+ }
1617
+ }, Ws = [pe, me].concat(Gs, Qs), gt = {
1618
+ identify: (s) => s instanceof Uint8Array,
1619
+ // Buffer inherits from Uint8Array
1620
+ default: !1,
1621
+ tag: "tag:yaml.org,2002:binary",
1622
+ /**
1623
+ * Returns a Buffer in node and an Uint8Array in browsers
1624
+ *
1625
+ * To use the resulting buffer as an image, you'll want to do something like:
1626
+ *
1627
+ * const blob = new Blob([buffer], { type: 'image/jpeg' })
1628
+ * document.querySelector('#photo').src = URL.createObjectURL(blob)
1629
+ */
1630
+ resolve(s, e) {
1631
+ if (typeof Buffer == "function")
1632
+ return Buffer.from(s, "base64");
1633
+ if (typeof atob == "function") {
1634
+ const t = atob(s.replace(/[\n\r]/g, "")), n = new Uint8Array(t.length);
1635
+ for (let i = 0; i < t.length; ++i)
1636
+ n[i] = t.charCodeAt(i);
1637
+ return n;
1638
+ } else
1639
+ return e("This environment does not support reading binary tags; either Buffer or atob is required"), s;
1640
+ },
1641
+ stringify({ comment: s, type: e, value: t }, n, i, r) {
1642
+ const o = t;
1643
+ let l;
1644
+ if (typeof Buffer == "function")
1645
+ l = o instanceof Buffer ? o.toString("base64") : Buffer.from(o.buffer).toString("base64");
1646
+ else if (typeof btoa == "function") {
1647
+ let a = "";
1648
+ for (let c = 0; c < o.length; ++c)
1649
+ a += String.fromCharCode(o[c]);
1650
+ l = btoa(a);
1651
+ } else
1652
+ throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
1653
+ if (e || (e = N.BLOCK_LITERAL), e !== N.QUOTE_DOUBLE) {
1654
+ const a = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(l.length / a), p = new Array(c);
1655
+ for (let f = 0, u = 0; f < c; ++f, u += a)
1656
+ p[f] = l.substr(u, a);
1657
+ l = p.join(e === N.BLOCK_LITERAL ? `
1658
+ ` : " ");
1659
+ }
1660
+ return Oe({ comment: s, type: e, value: l }, n, i, r);
1661
+ }
1662
+ };
1663
+ function rs(s, e) {
1664
+ if (de(s))
1665
+ for (let t = 0; t < s.items.length; ++t) {
1666
+ let n = s.items[t];
1667
+ if (!E(n)) {
1668
+ if (he(n)) {
1669
+ n.items.length > 1 && e("Each pair must have its own sequence indicator");
1670
+ const i = n.items[0] || new v(new N(null));
1671
+ if (n.commentBefore && (i.key.commentBefore = i.key.commentBefore ? `${n.commentBefore}
1672
+ ${i.key.commentBefore}` : n.commentBefore), n.comment) {
1673
+ const r = i.value ?? i.key;
1674
+ r.comment = r.comment ? `${n.comment}
1675
+ ${r.comment}` : n.comment;
1676
+ }
1677
+ n = i;
1678
+ }
1679
+ s.items[t] = E(n) ? n : new v(n);
1680
+ }
1681
+ }
1682
+ else
1683
+ e("Expected a sequence for this tag");
1684
+ return s;
1685
+ }
1686
+ function os(s, e, t) {
1687
+ const { replacer: n } = t, i = new G(s);
1688
+ i.tag = "tag:yaml.org,2002:pairs";
1689
+ let r = 0;
1690
+ if (e && Symbol.iterator in Object(e))
1691
+ for (let o of e) {
1692
+ typeof n == "function" && (o = n.call(e, String(r++), o));
1693
+ let l, a;
1694
+ if (Array.isArray(o))
1695
+ if (o.length === 2)
1696
+ l = o[0], a = o[1];
1697
+ else
1698
+ throw new TypeError(`Expected [key, value] tuple: ${o}`);
1699
+ else if (o && o instanceof Object) {
1700
+ const c = Object.keys(o);
1701
+ if (c.length === 1)
1702
+ l = c[0], a = o[l];
1703
+ else
1704
+ throw new TypeError(`Expected tuple with one key, not ${c.length} keys`);
1705
+ } else
1706
+ l = o;
1707
+ i.items.push(pt(l, a, t));
1708
+ }
1709
+ return i;
1710
+ }
1711
+ const bt = {
1712
+ collection: "seq",
1713
+ default: !1,
1714
+ tag: "tag:yaml.org,2002:pairs",
1715
+ resolve: rs,
1716
+ createNode: os
1717
+ };
1718
+ class oe extends G {
1719
+ constructor() {
1720
+ super(), this.add = P.prototype.add.bind(this), this.delete = P.prototype.delete.bind(this), this.get = P.prototype.get.bind(this), this.has = P.prototype.has.bind(this), this.set = P.prototype.set.bind(this), this.tag = oe.tag;
1721
+ }
1722
+ /**
1723
+ * If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
1724
+ * but TypeScript won't allow widening the signature of a child method.
1725
+ */
1726
+ toJSON(e, t) {
1727
+ if (!t)
1728
+ return super.toJSON(e);
1729
+ const n = /* @__PURE__ */ new Map();
1730
+ t != null && t.onCreate && t.onCreate(n);
1731
+ for (const i of this.items) {
1732
+ let r, o;
1733
+ if (E(i) ? (r = D(i.key, "", t), o = D(i.value, r, t)) : r = D(i, "", t), n.has(r))
1734
+ throw new Error("Ordered maps must not include duplicate keys");
1735
+ n.set(r, o);
1736
+ }
1737
+ return n;
1738
+ }
1739
+ static from(e, t, n) {
1740
+ const i = os(e, t, n), r = new this();
1741
+ return r.items = i.items, r;
1742
+ }
1743
+ }
1744
+ oe.tag = "tag:yaml.org,2002:omap";
1745
+ const wt = {
1746
+ collection: "seq",
1747
+ identify: (s) => s instanceof Map,
1748
+ nodeClass: oe,
1749
+ default: !1,
1750
+ tag: "tag:yaml.org,2002:omap",
1751
+ resolve(s, e) {
1752
+ const t = rs(s, e), n = [];
1753
+ for (const { key: i } of t.items)
1754
+ A(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
1755
+ return Object.assign(new oe(), t);
1756
+ },
1757
+ createNode: (s, e, t) => oe.from(s, e, t)
1758
+ };
1759
+ function ls({ value: s, source: e }, t) {
1760
+ return e && (s ? as : cs).test.test(e) ? e : s ? t.options.trueStr : t.options.falseStr;
1761
+ }
1762
+ const as = {
1763
+ identify: (s) => s === !0,
1764
+ default: !0,
1765
+ tag: "tag:yaml.org,2002:bool",
1766
+ test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
1767
+ resolve: () => new N(!0),
1768
+ stringify: ls
1769
+ }, cs = {
1770
+ identify: (s) => s === !1,
1771
+ default: !0,
1772
+ tag: "tag:yaml.org,2002:bool",
1773
+ test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
1774
+ resolve: () => new N(!1),
1775
+ stringify: ls
1776
+ }, Hs = {
1777
+ identify: (s) => typeof s == "number",
1778
+ default: !0,
1779
+ tag: "tag:yaml.org,2002:float",
1780
+ test: /^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,
1781
+ resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
1782
+ stringify: F
1783
+ }, Xs = {
1784
+ identify: (s) => typeof s == "number",
1785
+ default: !0,
1786
+ tag: "tag:yaml.org,2002:float",
1787
+ format: "EXP",
1788
+ test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
1789
+ resolve: (s) => parseFloat(s.replace(/_/g, "")),
1790
+ stringify(s) {
1791
+ const e = Number(s.value);
1792
+ return isFinite(e) ? e.toExponential() : F(s);
1793
+ }
1794
+ }, zs = {
1795
+ identify: (s) => typeof s == "number",
1796
+ default: !0,
1797
+ tag: "tag:yaml.org,2002:float",
1798
+ test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
1799
+ resolve(s) {
1800
+ const e = new N(parseFloat(s.replace(/_/g, ""))), t = s.indexOf(".");
1801
+ if (t !== -1) {
1802
+ const n = s.substring(t + 1).replace(/_/g, "");
1803
+ n[n.length - 1] === "0" && (e.minFractionDigits = n.length);
1804
+ }
1805
+ return e;
1806
+ },
1807
+ stringify: F
1808
+ }, Ae = (s) => typeof s == "bigint" || Number.isInteger(s);
1809
+ function Ye(s, e, t, { intAsBigInt: n }) {
1810
+ const i = s[0];
1811
+ if ((i === "-" || i === "+") && (e += 1), s = s.substring(e).replace(/_/g, ""), n) {
1812
+ switch (t) {
1813
+ case 2:
1814
+ s = `0b${s}`;
1815
+ break;
1816
+ case 8:
1817
+ s = `0o${s}`;
1818
+ break;
1819
+ case 16:
1820
+ s = `0x${s}`;
1821
+ break;
1822
+ }
1823
+ const o = BigInt(s);
1824
+ return i === "-" ? BigInt(-1) * o : o;
1825
+ }
1826
+ const r = parseInt(s, t);
1827
+ return i === "-" ? -1 * r : r;
1828
+ }
1829
+ function St(s, e, t) {
1830
+ const { value: n } = s;
1831
+ if (Ae(n)) {
1832
+ const i = n.toString(e);
1833
+ return n < 0 ? "-" + t + i.substr(1) : t + i;
1834
+ }
1835
+ return F(s);
1836
+ }
1837
+ const Zs = {
1838
+ identify: Ae,
1839
+ default: !0,
1840
+ tag: "tag:yaml.org,2002:int",
1841
+ format: "BIN",
1842
+ test: /^[-+]?0b[0-1_]+$/,
1843
+ resolve: (s, e, t) => Ye(s, 2, 2, t),
1844
+ stringify: (s) => St(s, 2, "0b")
1845
+ }, xs = {
1846
+ identify: Ae,
1847
+ default: !0,
1848
+ tag: "tag:yaml.org,2002:int",
1849
+ format: "OCT",
1850
+ test: /^[-+]?0[0-7_]+$/,
1851
+ resolve: (s, e, t) => Ye(s, 1, 8, t),
1852
+ stringify: (s) => St(s, 8, "0")
1853
+ }, en = {
1854
+ identify: Ae,
1855
+ default: !0,
1856
+ tag: "tag:yaml.org,2002:int",
1857
+ test: /^[-+]?[0-9][0-9_]*$/,
1858
+ resolve: (s, e, t) => Ye(s, 0, 10, t),
1859
+ stringify: F
1860
+ }, tn = {
1861
+ identify: Ae,
1862
+ default: !0,
1863
+ tag: "tag:yaml.org,2002:int",
1864
+ format: "HEX",
1865
+ test: /^[-+]?0x[0-9a-fA-F_]+$/,
1866
+ resolve: (s, e, t) => Ye(s, 2, 16, t),
1867
+ stringify: (s) => St(s, 16, "0x")
1868
+ };
1869
+ class le extends P {
1870
+ constructor(e) {
1871
+ super(e), this.tag = le.tag;
1872
+ }
1873
+ add(e) {
1874
+ let t;
1875
+ E(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new v(e.key, null) : t = new v(e, null), H(this.items, t.key) || this.items.push(t);
1876
+ }
1877
+ /**
1878
+ * If `keepPair` is `true`, returns the Pair matching `key`.
1879
+ * Otherwise, returns the value of that Pair's key.
1880
+ */
1881
+ get(e, t) {
1882
+ const n = H(this.items, e);
1883
+ return !t && E(n) ? A(n.key) ? n.key.value : n.key : n;
1884
+ }
1885
+ set(e, t) {
1886
+ if (typeof t != "boolean")
1887
+ throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);
1888
+ const n = H(this.items, e);
1889
+ n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new v(e));
1890
+ }
1891
+ toJSON(e, t) {
1892
+ return super.toJSON(e, t, Set);
1893
+ }
1894
+ toString(e, t, n) {
1895
+ if (!e)
1896
+ return JSON.stringify(this);
1897
+ if (this.hasAllNullValues(!0))
1898
+ return super.toString(Object.assign({}, e, { allNullValues: !0 }), t, n);
1899
+ throw new Error("Set items must all have null values");
1900
+ }
1901
+ static from(e, t, n) {
1902
+ const { replacer: i } = n, r = new this(e);
1903
+ if (t && Symbol.iterator in Object(t))
1904
+ for (let o of t)
1905
+ typeof i == "function" && (o = i.call(t, o, o)), r.items.push(pt(o, null, n));
1906
+ return r;
1907
+ }
1908
+ }
1909
+ le.tag = "tag:yaml.org,2002:set";
1910
+ const kt = {
1911
+ collection: "map",
1912
+ identify: (s) => s instanceof Set,
1913
+ nodeClass: le,
1914
+ default: !1,
1915
+ tag: "tag:yaml.org,2002:set",
1916
+ createNode: (s, e, t) => le.from(s, e, t),
1917
+ resolve(s, e) {
1918
+ if (he(s)) {
1919
+ if (s.hasAllNullValues(!0))
1920
+ return Object.assign(new le(), s);
1921
+ e("Set items must all have null values");
1922
+ } else
1923
+ e("Expected a mapping for this tag");
1924
+ return s;
1925
+ }
1926
+ };
1927
+ function Nt(s, e) {
1928
+ const t = s[0], n = t === "-" || t === "+" ? s.substring(1) : s, i = (o) => e ? BigInt(o) : Number(o), r = n.replace(/_/g, "").split(":").reduce((o, l) => o * i(60) + i(l), i(0));
1929
+ return t === "-" ? i(-1) * r : r;
1930
+ }
1931
+ function fs(s) {
1932
+ let { value: e } = s, t = (o) => o;
1933
+ if (typeof e == "bigint")
1934
+ t = (o) => BigInt(o);
1935
+ else if (isNaN(e) || !isFinite(e))
1936
+ return F(s);
1937
+ let n = "";
1938
+ e < 0 && (n = "-", e *= t(-1));
1939
+ const i = t(60), r = [e % i];
1940
+ return e < 60 ? r.unshift(0) : (e = (e - r[0]) / i, r.unshift(e % i), e >= 60 && (e = (e - r[0]) / i, r.unshift(e))), n + r.map((o) => String(o).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
1941
+ }
1942
+ const us = {
1943
+ identify: (s) => typeof s == "bigint" || Number.isInteger(s),
1944
+ default: !0,
1945
+ tag: "tag:yaml.org,2002:int",
1946
+ format: "TIME",
1947
+ test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
1948
+ resolve: (s, e, { intAsBigInt: t }) => Nt(s, t),
1949
+ stringify: fs
1950
+ }, hs = {
1951
+ identify: (s) => typeof s == "number",
1952
+ default: !0,
1953
+ tag: "tag:yaml.org,2002:float",
1954
+ format: "TIME",
1955
+ test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
1956
+ resolve: (s) => Nt(s, !1),
1957
+ stringify: fs
1958
+ }, Ge = {
1959
+ identify: (s) => s instanceof Date,
1960
+ default: !0,
1961
+ tag: "tag:yaml.org,2002:timestamp",
1962
+ // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
1963
+ // may be omitted altogether, resulting in a date format. In such a case, the time part is
1964
+ // assumed to be 00:00:00Z (start of day, UTC).
1965
+ 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})?))?)?$"),
1966
+ resolve(s) {
1967
+ const e = s.match(Ge.test);
1968
+ if (!e)
1969
+ throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
1970
+ const [, t, n, i, r, o, l] = e.map(Number), a = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
1971
+ let c = Date.UTC(t, n - 1, i, r || 0, o || 0, l || 0, a);
1972
+ const p = e[8];
1973
+ if (p && p !== "Z") {
1974
+ let f = Nt(p, !1);
1975
+ Math.abs(f) < 30 && (f *= 60), c -= 6e4 * f;
1976
+ }
1977
+ return new Date(c);
1978
+ },
1979
+ stringify: ({ value: s }) => s.toISOString().replace(/((T00:00)?:00)?\.000Z$/, "")
1980
+ }, _t = [
1981
+ pe,
1982
+ me,
1983
+ Re,
1984
+ Ve,
1985
+ as,
1986
+ cs,
1987
+ Zs,
1988
+ xs,
1989
+ en,
1990
+ tn,
1991
+ Hs,
1992
+ Xs,
1993
+ zs,
1994
+ gt,
1995
+ wt,
1996
+ bt,
1997
+ kt,
1998
+ us,
1999
+ hs,
2000
+ Ge
2001
+ ], Ct = /* @__PURE__ */ new Map([
2002
+ ["core", Ys],
2003
+ ["failsafe", [pe, me, Re]],
2004
+ ["json", Ws],
2005
+ ["yaml11", _t],
2006
+ ["yaml-1.1", _t]
2007
+ ]), vt = {
2008
+ binary: gt,
2009
+ bool: mt,
2010
+ float: es,
2011
+ floatExp: xt,
2012
+ floatNaN: Zt,
2013
+ floatTime: hs,
2014
+ int: ns,
2015
+ intHex: is,
2016
+ intOct: ss,
2017
+ intTime: us,
2018
+ map: pe,
2019
+ null: Ve,
2020
+ omap: wt,
2021
+ pairs: bt,
2022
+ seq: me,
2023
+ set: kt,
2024
+ timestamp: Ge
2025
+ }, sn = {
2026
+ "tag:yaml.org,2002:binary": gt,
2027
+ "tag:yaml.org,2002:omap": wt,
2028
+ "tag:yaml.org,2002:pairs": bt,
2029
+ "tag:yaml.org,2002:set": kt,
2030
+ "tag:yaml.org,2002:timestamp": Ge
2031
+ };
2032
+ function Ze(s, e) {
2033
+ let t = Ct.get(e);
2034
+ if (!t)
2035
+ if (Array.isArray(s))
2036
+ t = [];
2037
+ else {
2038
+ const n = Array.from(Ct.keys()).filter((i) => i !== "yaml11").map((i) => JSON.stringify(i)).join(", ");
2039
+ throw new Error(`Unknown schema "${e}"; use one of ${n} or define customTags array`);
2040
+ }
2041
+ if (Array.isArray(s))
2042
+ for (const n of s)
2043
+ t = t.concat(n);
2044
+ else typeof s == "function" && (t = s(t.slice()));
2045
+ return t.map((n) => {
2046
+ if (typeof n != "string")
2047
+ return n;
2048
+ const i = vt[n];
2049
+ if (i)
2050
+ return i;
2051
+ const r = Object.keys(vt).map((o) => JSON.stringify(o)).join(", ");
2052
+ throw new Error(`Unknown custom tag "${n}"; use one of ${r}`);
2053
+ });
2054
+ }
2055
+ const nn = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
2056
+ class Qe {
2057
+ constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: l }) {
2058
+ this.compat = Array.isArray(e) ? Ze(e, "compat") : e ? Ze(null, e) : null, this.merge = !!n, this.name = typeof r == "string" && r || "core", this.knownTags = i ? sn : {}, this.tags = Ze(t, this.name), this.toStringOptions = l ?? null, Object.defineProperty(this, J, { value: pe }), Object.defineProperty(this, V, { value: Re }), Object.defineProperty(this, fe, { value: me }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? nn : null;
2059
+ }
2060
+ clone() {
2061
+ const e = Object.create(Qe.prototype, Object.getOwnPropertyDescriptors(this));
2062
+ return e.tags = this.tags.slice(), e;
2063
+ }
2064
+ }
2065
+ function rn(s, e) {
2066
+ var a;
2067
+ const t = [];
2068
+ let n = e.directives === !0;
2069
+ if (e.directives !== !1 && s.directives) {
2070
+ const c = s.directives.toString(s);
2071
+ c ? (t.push(c), n = !0) : s.directives.docStart && (n = !0);
2072
+ }
2073
+ n && t.push("---");
2074
+ const i = Wt(s, e), { commentString: r } = i.options;
2075
+ if (s.commentBefore) {
2076
+ t.length !== 1 && t.unshift("");
2077
+ const c = r(s.commentBefore);
2078
+ t.unshift(R(c, ""));
2079
+ }
2080
+ let o = !1, l = null;
2081
+ if (s.contents) {
2082
+ if ($(s.contents)) {
2083
+ if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
2084
+ const f = r(s.contents.commentBefore);
2085
+ t.push(R(f, ""));
2086
+ }
2087
+ i.forceBlockIndent = !!s.comment, l = s.contents.comment;
2088
+ }
2089
+ const c = l ? void 0 : () => o = !0;
2090
+ let p = ae(s.contents, i, () => l = null, c);
2091
+ l && (p += W(p, "", r(l))), (p[0] === "|" || p[0] === ">") && t[t.length - 1] === "---" ? t[t.length - 1] = `--- ${p}` : t.push(p);
2092
+ } else
2093
+ t.push(ae(s.contents, i));
2094
+ if ((a = s.directives) != null && a.docEnd)
2095
+ if (s.comment) {
2096
+ const c = r(s.comment);
2097
+ c.includes(`
2098
+ `) ? (t.push("..."), t.push(R(c, ""))) : t.push(`... ${c}`);
2099
+ } else
2100
+ t.push("...");
2101
+ else {
2102
+ let c = s.comment;
2103
+ c && o && (c = c.replace(/^\n+/, "")), c && ((!o || l) && t[t.length - 1] !== "" && t.push(""), t.push(R(r(c), "")));
2104
+ }
2105
+ return t.join(`
2106
+ `) + `
2107
+ `;
2108
+ }
2109
+ class ye {
2110
+ constructor(e, t, n) {
2111
+ this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, K, { value: rt });
2112
+ let i = null;
2113
+ typeof t == "function" || Array.isArray(t) ? i = t : n === void 0 && t && (n = t, t = void 0);
2114
+ const r = Object.assign({
2115
+ intAsBigInt: !1,
2116
+ keepSourceTokens: !1,
2117
+ logLevel: "warn",
2118
+ prettyErrors: !0,
2119
+ strict: !0,
2120
+ uniqueKeys: !0,
2121
+ version: "1.2"
2122
+ }, n);
2123
+ this.options = r;
2124
+ let { version: o } = r;
2125
+ n != null && n._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (o = this.directives.yaml.version)) : this.directives = new B({ version: o }), this.setSchema(o, n), this.contents = e === void 0 ? null : this.createNode(e, i, n);
2126
+ }
2127
+ /**
2128
+ * Create a deep copy of this Document and its contents.
2129
+ *
2130
+ * Custom Node values that inherit from `Object` still refer to their original instances.
2131
+ */
2132
+ clone() {
2133
+ const e = Object.create(ye.prototype, {
2134
+ [K]: { value: rt }
2135
+ });
2136
+ return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents = $(this.contents) ? this.contents.clone(e.schema) : this.contents, this.range && (e.range = this.range.slice()), e;
2137
+ }
2138
+ /** Adds a value to the document. */
2139
+ add(e) {
2140
+ ee(this.contents) && this.contents.add(e);
2141
+ }
2142
+ /** Adds a value to the document. */
2143
+ addIn(e, t) {
2144
+ ee(this.contents) && this.contents.addIn(e, t);
2145
+ }
2146
+ /**
2147
+ * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
2148
+ *
2149
+ * If `node` already has an anchor, `name` is ignored.
2150
+ * Otherwise, the `node.anchor` value will be set to `name`,
2151
+ * or if an anchor with that name is already present in the document,
2152
+ * `name` will be used as a prefix for a new unique anchor.
2153
+ * If `name` is undefined, the generated anchor will use 'a' as a prefix.
2154
+ */
2155
+ createAlias(e, t) {
2156
+ if (!e.anchor) {
2157
+ const n = Jt(this);
2158
+ e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
2159
+ !t || n.has(t) ? Yt(t || "a", n) : t;
2160
+ }
2161
+ return new Ke(e.anchor);
2162
+ }
2163
+ createNode(e, t, n) {
2164
+ let i;
2165
+ if (typeof t == "function")
2166
+ e = t.call({ "": e }, "", e), i = t;
2167
+ else if (Array.isArray(t)) {
2168
+ const d = (w) => typeof w == "number" || w instanceof String || w instanceof Number, b = t.filter(d).map(String);
2169
+ b.length > 0 && (t = t.concat(b)), i = t;
2170
+ } else n === void 0 && t && (n = t, t = void 0);
2171
+ const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: p } = n ?? {}, { onAnchor: f, setAnchors: u, sourceObjects: m } = vs(
2172
+ this,
2173
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
2174
+ o || "a"
2175
+ ), g = {
2176
+ aliasDuplicateObjects: r ?? !0,
2177
+ keepUndefined: a ?? !1,
2178
+ onAnchor: f,
2179
+ onTagObj: c,
2180
+ replacer: i,
2181
+ schema: this.schema,
2182
+ sourceObjects: m
2183
+ }, h = Se(e, p, g);
2184
+ return l && T(h) && (h.flow = !0), u(), h;
2185
+ }
2186
+ /**
2187
+ * Convert a key and a value into a `Pair` using the current schema,
2188
+ * recursively wrapping all values as `Scalar` or `Collection` nodes.
2189
+ */
2190
+ createPair(e, t, n = {}) {
2191
+ const i = this.createNode(e, null, n), r = this.createNode(t, null, n);
2192
+ return new v(i, r);
2193
+ }
2194
+ /**
2195
+ * Removes a value from the document.
2196
+ * @returns `true` if the item was found and removed.
2197
+ */
2198
+ delete(e) {
2199
+ return ee(this.contents) ? this.contents.delete(e) : !1;
2200
+ }
2201
+ /**
2202
+ * Removes a value from the document.
2203
+ * @returns `true` if the item was found and removed.
2204
+ */
2205
+ deleteIn(e) {
2206
+ return be(e) ? this.contents == null ? !1 : (this.contents = null, !0) : ee(this.contents) ? this.contents.deleteIn(e) : !1;
2207
+ }
2208
+ /**
2209
+ * Returns item at `key`, or `undefined` if not found. By default unwraps
2210
+ * scalar values from their surrounding node; to disable set `keepScalar` to
2211
+ * `true` (collections are always returned intact).
2212
+ */
2213
+ get(e, t) {
2214
+ return T(this.contents) ? this.contents.get(e, t) : void 0;
2215
+ }
2216
+ /**
2217
+ * Returns item at `path`, or `undefined` if not found. By default unwraps
2218
+ * scalar values from their surrounding node; to disable set `keepScalar` to
2219
+ * `true` (collections are always returned intact).
2220
+ */
2221
+ getIn(e, t) {
2222
+ return be(e) ? !t && A(this.contents) ? this.contents.value : this.contents : T(this.contents) ? this.contents.getIn(e, t) : void 0;
2223
+ }
2224
+ /**
2225
+ * Checks if the document includes a value with the key `key`.
2226
+ */
2227
+ has(e) {
2228
+ return T(this.contents) ? this.contents.has(e) : !1;
2229
+ }
2230
+ /**
2231
+ * Checks if the document includes a value at `path`.
2232
+ */
2233
+ hasIn(e) {
2234
+ return be(e) ? this.contents !== void 0 : T(this.contents) ? this.contents.hasIn(e) : !1;
2235
+ }
2236
+ /**
2237
+ * Sets a value in this document. For `!!set`, `value` needs to be a
2238
+ * boolean to add/remove the item from the set.
2239
+ */
2240
+ set(e, t) {
2241
+ this.contents == null ? this.contents = Be(this.schema, [e], t) : ee(this.contents) && this.contents.set(e, t);
2242
+ }
2243
+ /**
2244
+ * Sets a value in this document. For `!!set`, `value` needs to be a
2245
+ * boolean to add/remove the item from the set.
2246
+ */
2247
+ setIn(e, t) {
2248
+ be(e) ? this.contents = t : this.contents == null ? this.contents = Be(this.schema, Array.from(e), t) : ee(this.contents) && this.contents.setIn(e, t);
2249
+ }
2250
+ /**
2251
+ * Change the YAML version and schema used by the document.
2252
+ * A `null` version disables support for directives, explicit tags, anchors, and aliases.
2253
+ * It also requires the `schema` option to be given as a `Schema` instance value.
2254
+ *
2255
+ * Overrides all previously set schema options.
2256
+ */
2257
+ setSchema(e, t = {}) {
2258
+ typeof e == "number" && (e = String(e));
2259
+ let n;
2260
+ switch (e) {
2261
+ case "1.1":
2262
+ this.directives ? this.directives.yaml.version = "1.1" : this.directives = new B({ version: "1.1" }), n = { merge: !0, resolveKnownTags: !1, schema: "yaml-1.1" };
2263
+ break;
2264
+ case "1.2":
2265
+ case "next":
2266
+ this.directives ? this.directives.yaml.version = e : this.directives = new B({ version: e }), n = { merge: !1, resolveKnownTags: !0, schema: "core" };
2267
+ break;
2268
+ case null:
2269
+ this.directives && delete this.directives, n = null;
2270
+ break;
2271
+ default: {
2272
+ const i = JSON.stringify(e);
2273
+ throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`);
2274
+ }
2275
+ }
2276
+ if (t.schema instanceof Object)
2277
+ this.schema = t.schema;
2278
+ else if (n)
2279
+ this.schema = new Qe(Object.assign(n, t));
2280
+ else
2281
+ throw new Error("With a null YAML version, the { schema: Schema } option is required");
2282
+ }
2283
+ // json & jsonArg are only used from toJSON()
2284
+ toJS({ json: e, jsonArg: t, mapAsMap: n, maxAliasCount: i, onAnchor: r, reviver: o } = {}) {
2285
+ const l = {
2286
+ anchors: /* @__PURE__ */ new Map(),
2287
+ doc: this,
2288
+ keep: !e,
2289
+ mapAsMap: n === !0,
2290
+ mapKeyWarned: !1,
2291
+ maxAliasCount: typeof i == "number" ? i : 100
2292
+ }, a = D(this.contents, t ?? "", l);
2293
+ if (typeof r == "function")
2294
+ for (const { count: c, res: p } of l.anchors.values())
2295
+ r(p, c);
2296
+ return typeof o == "function" ? ie(o, { "": a }, "", a) : a;
2297
+ }
2298
+ /**
2299
+ * A JSON representation of the document `contents`.
2300
+ *
2301
+ * @param jsonArg Used by `JSON.stringify` to indicate the array index or
2302
+ * property name.
2303
+ */
2304
+ toJSON(e, t) {
2305
+ return this.toJS({ json: !0, jsonArg: e, mapAsMap: !1, onAnchor: t });
2306
+ }
2307
+ /** A YAML representation of the document. */
2308
+ toString(e = {}) {
2309
+ if (this.errors.length > 0)
2310
+ throw new Error("Document with errors cannot be stringified");
2311
+ if ("indent" in e && (!Number.isInteger(e.indent) || Number(e.indent) <= 0)) {
2312
+ const t = JSON.stringify(e.indent);
2313
+ throw new Error(`"indent" option must be a positive integer, not ${t}`);
2314
+ }
2315
+ return rn(this, e);
2316
+ }
2317
+ }
2318
+ function ee(s) {
2319
+ if (T(s))
2320
+ return !0;
2321
+ throw new Error("Expected a YAML collection as document contents");
2322
+ }
2323
+ class Ot extends Error {
2324
+ constructor(e, t, n, i) {
2325
+ super(), this.name = e, this.code = n, this.message = i, this.pos = t;
2326
+ }
2327
+ }
2328
+ class X extends Ot {
2329
+ constructor(e, t, n) {
2330
+ super("YAMLParseError", e, t, n);
2331
+ }
2332
+ }
2333
+ class ds extends Ot {
2334
+ constructor(e, t, n) {
2335
+ super("YAMLWarning", e, t, n);
2336
+ }
2337
+ }
2338
+ const Pe = (s, e) => (t) => {
2339
+ if (t.pos[0] === -1)
2340
+ return;
2341
+ t.linePos = t.pos.map((l) => e.linePos(l));
2342
+ const { line: n, col: i } = t.linePos[0];
2343
+ t.message += ` at line ${n}, column ${i}`;
2344
+ let r = i - 1, o = s.substring(e.lineStarts[n - 1], e.lineStarts[n]).replace(/[\n\r]+$/, "");
2345
+ if (r >= 60 && o.length > 80) {
2346
+ const l = Math.min(r - 39, o.length - 79);
2347
+ o = "…" + o.substring(l), r -= l - 1;
2348
+ }
2349
+ if (o.length > 80 && (o = o.substring(0, 79) + "…"), n > 1 && /^ *$/.test(o.substring(0, r))) {
2350
+ let l = s.substring(e.lineStarts[n - 2], e.lineStarts[n - 1]);
2351
+ l.length > 80 && (l = l.substring(0, 79) + `…
2352
+ `), o = l + o;
2353
+ }
2354
+ if (/[^ ]/.test(o)) {
2355
+ let l = 1;
2356
+ const a = t.linePos[1];
2357
+ a && a.line === n && a.col > i && (l = Math.max(1, Math.min(a.col - i, 80 - r)));
2358
+ const c = " ".repeat(r) + "^".repeat(l);
2359
+ t.message += `:
2360
+
2361
+ ${o}
2362
+ ${c}
2363
+ `;
2364
+ }
2365
+ };
2366
+ function ce(s, { flow: e, indicator: t, next: n, offset: i, onError: r, startOnNewline: o }) {
2367
+ let l = !1, a = o, c = o, p = "", f = "", u = !1, m = !1, g = !1, h = null, d = null, b = null, w = null, k = null;
2368
+ for (const y of s)
2369
+ switch (g && (y.type !== "space" && y.type !== "newline" && y.type !== "comma" && r(y.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), g = !1), y.type) {
2370
+ case "space":
2371
+ !e && a && t !== "doc-start" && y.source[0] === " " && r(y, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), c = !0;
2372
+ break;
2373
+ case "comment": {
2374
+ c || r(y, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
2375
+ const I = y.source.substring(1) || " ";
2376
+ p ? p += f + I : p = I, f = "", a = !1;
2377
+ break;
2378
+ }
2379
+ case "newline":
2380
+ a ? p ? p += y.source : l = !0 : f += y.source, a = !0, u = !0, (h || d) && (m = !0), c = !0;
2381
+ break;
2382
+ case "anchor":
2383
+ h && r(y, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), y.source.endsWith(":") && r(y.offset + y.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), h = y, k === null && (k = y.offset), a = !1, c = !1, g = !0;
2384
+ break;
2385
+ case "tag": {
2386
+ d && r(y, "MULTIPLE_TAGS", "A node can have at most one tag"), d = y, k === null && (k = y.offset), a = !1, c = !1, g = !0;
2387
+ break;
2388
+ }
2389
+ case t:
2390
+ (h || d) && r(y, "BAD_PROP_ORDER", `Anchors and tags must be after the ${y.source} indicator`), w && r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.source} in ${e ?? "collection"}`), w = y, a = !1, c = !1;
2391
+ break;
2392
+ case "comma":
2393
+ if (e) {
2394
+ b && r(y, "UNEXPECTED_TOKEN", `Unexpected , in ${e}`), b = y, a = !1, c = !1;
2395
+ break;
2396
+ }
2397
+ default:
2398
+ r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.type} token`), a = !1, c = !1;
2399
+ }
2400
+ const S = s[s.length - 1], O = S ? S.offset + S.source.length : i;
2401
+ return g && n && n.type !== "space" && n.type !== "newline" && n.type !== "comma" && (n.type !== "scalar" || n.source !== "") && r(n.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), {
2402
+ comma: b,
2403
+ found: w,
2404
+ spaceBefore: l,
2405
+ comment: p,
2406
+ hasNewline: u,
2407
+ hasNewlineAfterProp: m,
2408
+ anchor: h,
2409
+ tag: d,
2410
+ end: O,
2411
+ start: k ?? O
2412
+ };
2413
+ }
2414
+ function ke(s) {
2415
+ if (!s)
2416
+ return null;
2417
+ switch (s.type) {
2418
+ case "alias":
2419
+ case "scalar":
2420
+ case "double-quoted-scalar":
2421
+ case "single-quoted-scalar":
2422
+ if (s.source.includes(`
2423
+ `))
2424
+ return !0;
2425
+ if (s.end) {
2426
+ for (const e of s.end)
2427
+ if (e.type === "newline")
2428
+ return !0;
2429
+ }
2430
+ return !1;
2431
+ case "flow-collection":
2432
+ for (const e of s.items) {
2433
+ for (const t of e.start)
2434
+ if (t.type === "newline")
2435
+ return !0;
2436
+ if (e.sep) {
2437
+ for (const t of e.sep)
2438
+ if (t.type === "newline")
2439
+ return !0;
2440
+ }
2441
+ if (ke(e.key) || ke(e.value))
2442
+ return !0;
2443
+ }
2444
+ return !1;
2445
+ default:
2446
+ return !0;
2447
+ }
2448
+ }
2449
+ function ct(s, e, t) {
2450
+ if ((e == null ? void 0 : e.type) === "flow-collection") {
2451
+ const n = e.end[0];
2452
+ n.indent === s && (n.source === "]" || n.source === "}") && ke(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
2453
+ }
2454
+ }
2455
+ function ps(s, e, t) {
2456
+ const { uniqueKeys: n } = s.options;
2457
+ if (n === !1)
2458
+ return !1;
2459
+ const i = typeof n == "function" ? n : (r, o) => r === o || A(r) && A(o) && r.value === o.value && !(r.value === "<<" && s.schema.merge);
2460
+ return e.some((r) => i(r.key, t));
2461
+ }
2462
+ const Bt = "All mapping items must start at the same column";
2463
+ function on({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2464
+ var p;
2465
+ const o = (r == null ? void 0 : r.nodeClass) ?? P, l = new o(t.schema);
2466
+ t.atRoot && (t.atRoot = !1);
2467
+ let a = n.offset, c = null;
2468
+ for (const f of n.items) {
2469
+ const { start: u, key: m, sep: g, value: h } = f, d = ce(u, {
2470
+ indicator: "explicit-key-ind",
2471
+ next: m ?? (g == null ? void 0 : g[0]),
2472
+ offset: a,
2473
+ onError: i,
2474
+ startOnNewline: !0
2475
+ }), b = !d.found;
2476
+ if (b) {
2477
+ if (m && (m.type === "block-seq" ? i(a, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in m && m.indent !== n.indent && i(a, "BAD_INDENT", Bt)), !d.anchor && !d.tag && !g) {
2478
+ c = d.end, d.comment && (l.comment ? l.comment += `
2479
+ ` + d.comment : l.comment = d.comment);
2480
+ continue;
2481
+ }
2482
+ (d.hasNewlineAfterProp || ke(m)) && i(m ?? u[u.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
2483
+ } else ((p = d.found) == null ? void 0 : p.indent) !== n.indent && i(a, "BAD_INDENT", Bt);
2484
+ const w = d.end, k = m ? s(t, m, d, i) : e(t, w, u, null, d, i);
2485
+ t.schema.compat && ct(n.indent, m, i), ps(t, l.items, k) && i(w, "DUPLICATE_KEY", "Map keys must be unique");
2486
+ const S = ce(g ?? [], {
2487
+ indicator: "map-value-ind",
2488
+ next: h,
2489
+ offset: k.range[2],
2490
+ onError: i,
2491
+ startOnNewline: !m || m.type === "block-scalar"
2492
+ });
2493
+ if (a = S.end, S.found) {
2494
+ b && ((h == null ? void 0 : h.type) === "block-map" && !S.hasNewline && i(a, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && d.start < S.found.offset - 1024 && i(k.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
2495
+ const O = h ? s(t, h, S, i) : e(t, a, g, null, S, i);
2496
+ t.schema.compat && ct(n.indent, h, i), a = O.range[2];
2497
+ const y = new v(k, O);
2498
+ t.options.keepSourceTokens && (y.srcToken = f), l.items.push(y);
2499
+ } else {
2500
+ b && i(k.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), S.comment && (k.comment ? k.comment += `
2501
+ ` + S.comment : k.comment = S.comment);
2502
+ const O = new v(k);
2503
+ t.options.keepSourceTokens && (O.srcToken = f), l.items.push(O);
2504
+ }
2505
+ }
2506
+ return c && c < a && i(c, "IMPOSSIBLE", "Map comment with trailing content"), l.range = [n.offset, a, c ?? a], l;
2507
+ }
2508
+ function ln({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2509
+ const o = (r == null ? void 0 : r.nodeClass) ?? G, l = new o(t.schema);
2510
+ t.atRoot && (t.atRoot = !1);
2511
+ let a = n.offset, c = null;
2512
+ for (const { start: p, value: f } of n.items) {
2513
+ const u = ce(p, {
2514
+ indicator: "seq-item-ind",
2515
+ next: f,
2516
+ offset: a,
2517
+ onError: i,
2518
+ startOnNewline: !0
2519
+ });
2520
+ if (!u.found)
2521
+ if (u.anchor || u.tag || f)
2522
+ f && f.type === "block-seq" ? i(u.end, "BAD_INDENT", "All sequence items must start at the same column") : i(a, "MISSING_CHAR", "Sequence item without - indicator");
2523
+ else {
2524
+ c = u.end, u.comment && (l.comment = u.comment);
2525
+ continue;
2526
+ }
2527
+ const m = f ? s(t, f, u, i) : e(t, u.end, p, null, u, i);
2528
+ t.schema.compat && ct(n.indent, f, i), a = m.range[2], l.items.push(m);
2529
+ }
2530
+ return l.range = [n.offset, a, c ?? a], l;
2531
+ }
2532
+ function Ee(s, e, t, n) {
2533
+ let i = "";
2534
+ if (s) {
2535
+ let r = !1, o = "";
2536
+ for (const l of s) {
2537
+ const { source: a, type: c } = l;
2538
+ switch (c) {
2539
+ case "space":
2540
+ r = !0;
2541
+ break;
2542
+ case "comment": {
2543
+ t && !r && n(l, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
2544
+ const p = a.substring(1) || " ";
2545
+ i ? i += o + p : i = p, o = "";
2546
+ break;
2547
+ }
2548
+ case "newline":
2549
+ i && (o += a), r = !0;
2550
+ break;
2551
+ default:
2552
+ n(l, "UNEXPECTED_TOKEN", `Unexpected ${c} at node end`);
2553
+ }
2554
+ e += a.length;
2555
+ }
2556
+ }
2557
+ return { comment: i, offset: e };
2558
+ }
2559
+ const xe = "Block collections are not allowed within flow collections", et = (s) => s && (s.type === "block-map" || s.type === "block-seq");
2560
+ function an({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2561
+ const o = n.start.source === "{", l = o ? "flow map" : "flow sequence", a = (r == null ? void 0 : r.nodeClass) ?? (o ? P : G), c = new a(t.schema);
2562
+ c.flow = !0;
2563
+ const p = t.atRoot;
2564
+ p && (t.atRoot = !1);
2565
+ let f = n.offset + n.start.source.length;
2566
+ for (let d = 0; d < n.items.length; ++d) {
2567
+ const b = n.items[d], { start: w, key: k, sep: S, value: O } = b, y = ce(w, {
2568
+ flow: l,
2569
+ indicator: "explicit-key-ind",
2570
+ next: k ?? (S == null ? void 0 : S[0]),
2571
+ offset: f,
2572
+ onError: i,
2573
+ startOnNewline: !1
2574
+ });
2575
+ if (!y.found) {
2576
+ if (!y.anchor && !y.tag && !S && !O) {
2577
+ d === 0 && y.comma ? i(y.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`) : d < n.items.length - 1 && i(y.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${l}`), y.comment && (c.comment ? c.comment += `
2578
+ ` + y.comment : c.comment = y.comment), f = y.end;
2579
+ continue;
2580
+ }
2581
+ !o && t.options.strict && ke(k) && i(
2582
+ k,
2583
+ // checked by containsNewline()
2584
+ "MULTILINE_IMPLICIT_KEY",
2585
+ "Implicit keys of flow sequence pairs need to be on a single line"
2586
+ );
2587
+ }
2588
+ if (d === 0)
2589
+ y.comma && i(y.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`);
2590
+ else if (y.comma || i(y.start, "MISSING_CHAR", `Missing , between ${l} items`), y.comment) {
2591
+ let I = "";
2592
+ e: for (const L of w)
2593
+ switch (L.type) {
2594
+ case "comma":
2595
+ case "space":
2596
+ break;
2597
+ case "comment":
2598
+ I = L.source.substring(1);
2599
+ break e;
2600
+ default:
2601
+ break e;
2602
+ }
2603
+ if (I) {
2604
+ let L = c.items[c.items.length - 1];
2605
+ E(L) && (L = L.value ?? L.key), L.comment ? L.comment += `
2606
+ ` + I : L.comment = I, y.comment = y.comment.substring(I.length + 1);
2607
+ }
2608
+ }
2609
+ if (!o && !S && !y.found) {
2610
+ const I = O ? s(t, O, y, i) : e(t, y.end, S, null, y, i);
2611
+ c.items.push(I), f = I.range[2], et(O) && i(I.range, "BLOCK_IN_FLOW", xe);
2612
+ } else {
2613
+ const I = y.end, L = k ? s(t, k, y, i) : e(t, I, w, null, y, i);
2614
+ et(k) && i(L.range, "BLOCK_IN_FLOW", xe);
2615
+ const C = ce(S ?? [], {
2616
+ flow: l,
2617
+ indicator: "map-value-ind",
2618
+ next: O,
2619
+ offset: L.range[2],
2620
+ onError: i,
2621
+ startOnNewline: !1
2622
+ });
2623
+ if (C.found) {
2624
+ if (!o && !y.found && t.options.strict) {
2625
+ if (S)
2626
+ for (const _ of S) {
2627
+ if (_ === C.found)
2628
+ break;
2629
+ if (_.type === "newline") {
2630
+ i(_, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
2631
+ break;
2632
+ }
2633
+ }
2634
+ y.start < C.found.offset - 1024 && i(C.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
2635
+ }
2636
+ } else O && ("source" in O && O.source && O.source[0] === ":" ? i(O, "MISSING_CHAR", `Missing space after : in ${l}`) : i(C.start, "MISSING_CHAR", `Missing , or : between ${l} items`));
2637
+ const Q = O ? s(t, O, C, i) : C.found ? e(t, C.end, S, null, C, i) : null;
2638
+ Q ? et(O) && i(Q.range, "BLOCK_IN_FLOW", xe) : C.comment && (L.comment ? L.comment += `
2639
+ ` + C.comment : L.comment = C.comment);
2640
+ const x = new v(L, Q);
2641
+ if (t.options.keepSourceTokens && (x.srcToken = b), o) {
2642
+ const _ = c;
2643
+ ps(t, _.items, L) && i(I, "DUPLICATE_KEY", "Map keys must be unique"), _.items.push(x);
2644
+ } else {
2645
+ const _ = new P(t.schema);
2646
+ _.flow = !0, _.items.push(x), c.items.push(_);
2647
+ }
2648
+ f = Q ? Q.range[2] : C.end;
2649
+ }
2650
+ }
2651
+ const u = o ? "}" : "]", [m, ...g] = n.end;
2652
+ let h = f;
2653
+ if (m && m.source === u)
2654
+ h = m.offset + m.source.length;
2655
+ else {
2656
+ const d = l[0].toUpperCase() + l.substring(1), b = p ? `${d} must end with a ${u}` : `${d} in block collection must be sufficiently indented and end with a ${u}`;
2657
+ i(f, p ? "MISSING_CHAR" : "BAD_INDENT", b), m && m.source.length !== 1 && g.unshift(m);
2658
+ }
2659
+ if (g.length > 0) {
2660
+ const d = Ee(g, h, t.options.strict, i);
2661
+ d.comment && (c.comment ? c.comment += `
2662
+ ` + d.comment : c.comment = d.comment), c.range = [n.offset, h, d.offset];
2663
+ } else
2664
+ c.range = [n.offset, h, h];
2665
+ return c;
2666
+ }
2667
+ function tt(s, e, t, n, i, r) {
2668
+ const o = t.type === "block-map" ? on(s, e, t, n, r) : t.type === "block-seq" ? ln(s, e, t, n, r) : an(s, e, t, n, r), l = o.constructor;
2669
+ return i === "!" || i === l.tagName ? (o.tag = l.tagName, o) : (i && (o.tag = i), o);
2670
+ }
2671
+ function cn(s, e, t, n, i) {
2672
+ var f;
2673
+ const r = n ? e.directives.tagName(n.source, (u) => i(n, "TAG_RESOLVE_FAILED", u)) : null, o = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
2674
+ if (!n || !r || r === "!" || r === P.tagName && o === "map" || r === G.tagName && o === "seq" || !o)
2675
+ return tt(s, e, t, i, r);
2676
+ let l = e.schema.tags.find((u) => u.tag === r && u.collection === o);
2677
+ if (!l) {
2678
+ const u = e.schema.knownTags[r];
2679
+ if (u && u.collection === o)
2680
+ e.schema.tags.push(Object.assign({}, u, { default: !1 })), l = u;
2681
+ else
2682
+ return u != null && u.collection ? i(n, "BAD_COLLECTION_TYPE", `${u.tag} used for ${o} collection, but expects ${u.collection}`, !0) : i(n, "TAG_RESOLVE_FAILED", `Unresolved tag: ${r}`, !0), tt(s, e, t, i, r);
2683
+ }
2684
+ const a = tt(s, e, t, i, r, l), c = ((f = l.resolve) == null ? void 0 : f.call(l, a, (u) => i(n, "TAG_RESOLVE_FAILED", u), e.options)) ?? a, p = $(c) ? c : new N(c);
2685
+ return p.range = a.range, p.tag = r, l != null && l.format && (p.format = l.format), p;
2686
+ }
2687
+ function ms(s, e, t) {
2688
+ const n = s.offset, i = fn(s, e, t);
2689
+ if (!i)
2690
+ return { value: "", type: null, comment: "", range: [n, n, n] };
2691
+ const r = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = s.source ? un(s.source) : [];
2692
+ let l = o.length;
2693
+ for (let h = o.length - 1; h >= 0; --h) {
2694
+ const d = o[h][1];
2695
+ if (d === "" || d === "\r")
2696
+ l = h;
2697
+ else
2698
+ break;
2699
+ }
2700
+ if (l === 0) {
2701
+ const h = i.chomp === "+" && o.length > 0 ? `
2702
+ `.repeat(Math.max(1, o.length - 1)) : "";
2703
+ let d = n + i.length;
2704
+ return s.source && (d += s.source.length), { value: h, type: r, comment: i.comment, range: [n, d, d] };
2705
+ }
2706
+ let a = s.indent + i.indent, c = s.offset + i.length, p = 0;
2707
+ for (let h = 0; h < l; ++h) {
2708
+ const [d, b] = o[h];
2709
+ if (b === "" || b === "\r")
2710
+ i.indent === 0 && d.length > a && (a = d.length);
2711
+ else {
2712
+ d.length < a && t(c + d.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (a = d.length), p = h;
2713
+ break;
2714
+ }
2715
+ c += d.length + b.length + 1;
2716
+ }
2717
+ for (let h = o.length - 1; h >= l; --h)
2718
+ o[h][0].length > a && (l = h + 1);
2719
+ let f = "", u = "", m = !1;
2720
+ for (let h = 0; h < p; ++h)
2721
+ f += o[h][0].slice(a) + `
2722
+ `;
2723
+ for (let h = p; h < l; ++h) {
2724
+ let [d, b] = o[h];
2725
+ c += d.length + b.length + 1;
2726
+ const w = b[b.length - 1] === "\r";
2727
+ if (w && (b = b.slice(0, -1)), b && d.length < a) {
2728
+ const S = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
2729
+ t(c - b.length - (w ? 2 : 1), "BAD_INDENT", S), d = "";
2730
+ }
2731
+ r === N.BLOCK_LITERAL ? (f += u + d.slice(a) + b, u = `
2732
+ `) : d.length > a || b[0] === " " ? (u === " " ? u = `
2733
+ ` : !m && u === `
2734
+ ` && (u = `
2735
+
2736
+ `), f += u + d.slice(a) + b, u = `
2737
+ `, m = !0) : b === "" ? u === `
2738
+ ` ? f += `
2739
+ ` : u = `
2740
+ ` : (f += u + b, u = " ", m = !1);
2741
+ }
2742
+ switch (i.chomp) {
2743
+ case "-":
2744
+ break;
2745
+ case "+":
2746
+ for (let h = l; h < o.length; ++h)
2747
+ f += `
2748
+ ` + o[h][0].slice(a);
2749
+ f[f.length - 1] !== `
2750
+ ` && (f += `
2751
+ `);
2752
+ break;
2753
+ default:
2754
+ f += `
2755
+ `;
2756
+ }
2757
+ const g = n + i.length + s.source.length;
2758
+ return { value: f, type: r, comment: i.comment, range: [n, g, g] };
2759
+ }
2760
+ function fn({ offset: s, props: e }, t, n) {
2761
+ if (e[0].type !== "block-scalar-header")
2762
+ return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
2763
+ const { source: i } = e[0], r = i[0];
2764
+ let o = 0, l = "", a = -1;
2765
+ for (let u = 1; u < i.length; ++u) {
2766
+ const m = i[u];
2767
+ if (!l && (m === "-" || m === "+"))
2768
+ l = m;
2769
+ else {
2770
+ const g = Number(m);
2771
+ !o && g ? o = g : a === -1 && (a = s + u);
2772
+ }
2773
+ }
2774
+ a !== -1 && n(a, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
2775
+ let c = !1, p = "", f = i.length;
2776
+ for (let u = 1; u < e.length; ++u) {
2777
+ const m = e[u];
2778
+ switch (m.type) {
2779
+ case "space":
2780
+ c = !0;
2781
+ case "newline":
2782
+ f += m.source.length;
2783
+ break;
2784
+ case "comment":
2785
+ t && !c && n(m, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"), f += m.source.length, p = m.source.substring(1);
2786
+ break;
2787
+ case "error":
2788
+ n(m, "UNEXPECTED_TOKEN", m.message), f += m.source.length;
2789
+ break;
2790
+ default: {
2791
+ const g = `Unexpected token in block scalar header: ${m.type}`;
2792
+ n(m, "UNEXPECTED_TOKEN", g);
2793
+ const h = m.source;
2794
+ h && typeof h == "string" && (f += h.length);
2795
+ }
2796
+ }
2797
+ }
2798
+ return { mode: r, indent: o, chomp: l, comment: p, length: f };
2799
+ }
2800
+ function un(s) {
2801
+ const e = s.split(/\n( *)/), t = e[0], n = t.match(/^( *)/), r = [n != null && n[1] ? [n[1], t.slice(n[1].length)] : ["", t]];
2802
+ for (let o = 1; o < e.length; o += 2)
2803
+ r.push([e[o], e[o + 1]]);
2804
+ return r;
2805
+ }
2806
+ function ys(s, e, t) {
2807
+ const { offset: n, type: i, source: r, end: o } = s;
2808
+ let l, a;
2809
+ const c = (u, m, g) => t(n + u, m, g);
2810
+ switch (i) {
2811
+ case "scalar":
2812
+ l = N.PLAIN, a = hn(r, c);
2813
+ break;
2814
+ case "single-quoted-scalar":
2815
+ l = N.QUOTE_SINGLE, a = dn(r, c);
2816
+ break;
2817
+ case "double-quoted-scalar":
2818
+ l = N.QUOTE_DOUBLE, a = pn(r, c);
2819
+ break;
2820
+ default:
2821
+ return t(s, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${i}`), {
2822
+ value: "",
2823
+ type: null,
2824
+ comment: "",
2825
+ range: [n, n + r.length, n + r.length]
2826
+ };
2827
+ }
2828
+ const p = n + r.length, f = Ee(o, p, e, t);
2829
+ return {
2830
+ value: a,
2831
+ type: l,
2832
+ comment: f.comment,
2833
+ range: [n, p, f.offset]
2834
+ };
2835
+ }
2836
+ function hn(s, e) {
2837
+ let t = "";
2838
+ switch (s[0]) {
2839
+ case " ":
2840
+ t = "a tab character";
2841
+ break;
2842
+ case ",":
2843
+ t = "flow indicator character ,";
2844
+ break;
2845
+ case "%":
2846
+ t = "directive indicator character %";
2847
+ break;
2848
+ case "|":
2849
+ case ">": {
2850
+ t = `block scalar indicator ${s[0]}`;
2851
+ break;
2852
+ }
2853
+ case "@":
2854
+ case "`": {
2855
+ t = `reserved character ${s[0]}`;
2856
+ break;
2857
+ }
2858
+ }
2859
+ return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), gs(s);
2860
+ }
2861
+ function dn(s, e) {
2862
+ return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), gs(s.slice(1, -1)).replace(/''/g, "'");
2863
+ }
2864
+ function gs(s) {
2865
+ let e, t;
2866
+ try {
2867
+ e = new RegExp(`(.*?)(?<![ ])[ ]*\r?
2868
+ `, "sy"), t = new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
2869
+ `, "sy");
2870
+ } catch {
2871
+ e = /(.*?)[ \t]*\r?\n/sy, t = /[ \t]*(.*?)[ \t]*\r?\n/sy;
2872
+ }
2873
+ let n = e.exec(s);
2874
+ if (!n)
2875
+ return s;
2876
+ let i = n[1], r = " ", o = e.lastIndex;
2877
+ for (t.lastIndex = o; n = t.exec(s); )
2878
+ n[1] === "" ? r === `
2879
+ ` ? i += r : r = `
2880
+ ` : (i += r + n[1], r = " "), o = t.lastIndex;
2881
+ const l = /[ \t]*(.*)/sy;
2882
+ return l.lastIndex = o, n = l.exec(s), i + r + ((n == null ? void 0 : n[1]) ?? "");
2883
+ }
2884
+ function pn(s, e) {
2885
+ let t = "";
2886
+ for (let n = 1; n < s.length - 1; ++n) {
2887
+ const i = s[n];
2888
+ if (!(i === "\r" && s[n + 1] === `
2889
+ `))
2890
+ if (i === `
2891
+ `) {
2892
+ const { fold: r, offset: o } = mn(s, n);
2893
+ t += r, n = o;
2894
+ } else if (i === "\\") {
2895
+ let r = s[++n];
2896
+ const o = yn[r];
2897
+ if (o)
2898
+ t += o;
2899
+ else if (r === `
2900
+ `)
2901
+ for (r = s[n + 1]; r === " " || r === " "; )
2902
+ r = s[++n + 1];
2903
+ else if (r === "\r" && s[n + 1] === `
2904
+ `)
2905
+ for (r = s[++n + 1]; r === " " || r === " "; )
2906
+ r = s[++n + 1];
2907
+ else if (r === "x" || r === "u" || r === "U") {
2908
+ const l = { x: 2, u: 4, U: 8 }[r];
2909
+ t += gn(s, n + 1, l, e), n += l;
2910
+ } else {
2911
+ const l = s.substr(n - 1, 2);
2912
+ e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), t += l;
2913
+ }
2914
+ } else if (i === " " || i === " ") {
2915
+ const r = n;
2916
+ let o = s[n + 1];
2917
+ for (; o === " " || o === " "; )
2918
+ o = s[++n + 1];
2919
+ o !== `
2920
+ ` && !(o === "\r" && s[n + 2] === `
2921
+ `) && (t += n > r ? s.slice(r, n + 1) : i);
2922
+ } else
2923
+ t += i;
2924
+ }
2925
+ return (s[s.length - 1] !== '"' || s.length === 1) && e(s.length, "MISSING_CHAR", 'Missing closing "quote'), t;
2926
+ }
2927
+ function mn(s, e) {
2928
+ let t = "", n = s[e + 1];
2929
+ for (; (n === " " || n === " " || n === `
2930
+ ` || n === "\r") && !(n === "\r" && s[e + 2] !== `
2931
+ `); )
2932
+ n === `
2933
+ ` && (t += `
2934
+ `), e += 1, n = s[e + 1];
2935
+ return t || (t = " "), { fold: t, offset: e };
2936
+ }
2937
+ const yn = {
2938
+ 0: "\0",
2939
+ // null character
2940
+ a: "\x07",
2941
+ // bell character
2942
+ b: "\b",
2943
+ // backspace
2944
+ e: "\x1B",
2945
+ // escape character
2946
+ f: "\f",
2947
+ // form feed
2948
+ n: `
2949
+ `,
2950
+ // line feed
2951
+ r: "\r",
2952
+ // carriage return
2953
+ t: " ",
2954
+ // horizontal tab
2955
+ v: "\v",
2956
+ // vertical tab
2957
+ N: "…",
2958
+ // Unicode next line
2959
+ _: " ",
2960
+ // Unicode non-breaking space
2961
+ L: "\u2028",
2962
+ // Unicode line separator
2963
+ P: "\u2029",
2964
+ // Unicode paragraph separator
2965
+ " ": " ",
2966
+ '"': '"',
2967
+ "/": "/",
2968
+ "\\": "\\",
2969
+ " ": " "
2970
+ };
2971
+ function gn(s, e, t, n) {
2972
+ const i = s.substr(e, t), o = i.length === t && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
2973
+ if (isNaN(o)) {
2974
+ const l = s.substr(e - 2, t + 2);
2975
+ return n(e - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), l;
2976
+ }
2977
+ return String.fromCodePoint(o);
2978
+ }
2979
+ function bs(s, e, t, n) {
2980
+ const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ? ms(e, s.options.strict, n) : ys(e, s.options.strict, n), a = t ? s.directives.tagName(t.source, (f) => n(t, "TAG_RESOLVE_FAILED", f)) : null, c = t && a ? bn(s.schema, i, a, t, n) : e.type === "scalar" ? wn(s, i, e, n) : s.schema[V];
2981
+ let p;
2982
+ try {
2983
+ const f = c.resolve(i, (u) => n(t ?? e, "TAG_RESOLVE_FAILED", u), s.options);
2984
+ p = A(f) ? f : new N(f);
2985
+ } catch (f) {
2986
+ const u = f instanceof Error ? f.message : String(f);
2987
+ n(t ?? e, "TAG_RESOLVE_FAILED", u), p = new N(i);
2988
+ }
2989
+ return p.range = l, p.source = i, r && (p.type = r), a && (p.tag = a), c.format && (p.format = c.format), o && (p.comment = o), p;
2990
+ }
2991
+ function bn(s, e, t, n, i) {
2992
+ var l;
2993
+ if (t === "!")
2994
+ return s[V];
2995
+ const r = [];
2996
+ for (const a of s.tags)
2997
+ if (!a.collection && a.tag === t)
2998
+ if (a.default && a.test)
2999
+ r.push(a);
3000
+ else
3001
+ return a;
3002
+ for (const a of r)
3003
+ if ((l = a.test) != null && l.test(e))
3004
+ return a;
3005
+ const o = s.knownTags[t];
3006
+ return o && !o.collection ? (s.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(n, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), s[V]);
3007
+ }
3008
+ function wn({ directives: s, schema: e }, t, n, i) {
3009
+ const r = e.tags.find((o) => {
3010
+ var l;
3011
+ return o.default && ((l = o.test) == null ? void 0 : l.test(t));
3012
+ }) || e[V];
3013
+ if (e.compat) {
3014
+ const o = e.compat.find((l) => {
3015
+ var a;
3016
+ return l.default && ((a = l.test) == null ? void 0 : a.test(t));
3017
+ }) ?? e[V];
3018
+ if (r.tag !== o.tag) {
3019
+ const l = s.tagString(r.tag), a = s.tagString(o.tag), c = `Value may be parsed as either ${l} or ${a}`;
3020
+ i(n, "TAG_RESOLVE_FAILED", c, !0);
3021
+ }
3022
+ }
3023
+ return r;
3024
+ }
3025
+ function Sn(s, e, t) {
3026
+ if (e) {
3027
+ t === null && (t = e.length);
3028
+ for (let n = t - 1; n >= 0; --n) {
3029
+ let i = e[n];
3030
+ switch (i.type) {
3031
+ case "space":
3032
+ case "comment":
3033
+ case "newline":
3034
+ s -= i.source.length;
3035
+ continue;
3036
+ }
3037
+ for (i = e[++n]; (i == null ? void 0 : i.type) === "space"; )
3038
+ s += i.source.length, i = e[++n];
3039
+ break;
3040
+ }
3041
+ }
3042
+ return s;
3043
+ }
3044
+ const kn = { composeNode: ws, composeEmptyNode: At };
3045
+ function ws(s, e, t, n) {
3046
+ const { spaceBefore: i, comment: r, anchor: o, tag: l } = t;
3047
+ let a, c = !0;
3048
+ switch (e.type) {
3049
+ case "alias":
3050
+ a = Nn(s, e, n), (o || l) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
3051
+ break;
3052
+ case "scalar":
3053
+ case "single-quoted-scalar":
3054
+ case "double-quoted-scalar":
3055
+ case "block-scalar":
3056
+ a = bs(s, e, l, n), o && (a.anchor = o.source.substring(1));
3057
+ break;
3058
+ case "block-map":
3059
+ case "block-seq":
3060
+ case "flow-collection":
3061
+ a = cn(kn, s, e, l, n), o && (a.anchor = o.source.substring(1));
3062
+ break;
3063
+ default: {
3064
+ const p = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
3065
+ n(e, "UNEXPECTED_TOKEN", p), a = At(s, e.offset, void 0, null, t, n), c = !1;
3066
+ }
3067
+ }
3068
+ return o && a.anchor === "" && n(o, "BAD_ALIAS", "Anchor cannot be an empty string"), i && (a.spaceBefore = !0), r && (e.type === "scalar" && e.source === "" ? a.comment = r : a.commentBefore = r), s.options.keepSourceTokens && c && (a.srcToken = e), a;
3069
+ }
3070
+ function At(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: l, end: a }, c) {
3071
+ const p = {
3072
+ type: "scalar",
3073
+ offset: Sn(e, t, n),
3074
+ indent: -1,
3075
+ source: ""
3076
+ }, f = bs(s, p, l, c);
3077
+ return o && (f.anchor = o.source.substring(1), f.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (f.spaceBefore = !0), r && (f.comment = r, f.range[2] = a), f;
3078
+ }
3079
+ function Nn({ options: s }, { offset: e, source: t, end: n }, i) {
3080
+ const r = new Ke(t.substring(1));
3081
+ r.source === "" && i(e, "BAD_ALIAS", "Alias cannot be an empty string"), r.source.endsWith(":") && i(e + t.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
3082
+ const o = e + t.length, l = Ee(n, o, s.strict, i);
3083
+ return r.range = [e, o, l.offset], l.comment && (r.comment = l.comment), r;
3084
+ }
3085
+ function On(s, e, { offset: t, start: n, value: i, end: r }, o) {
3086
+ const l = Object.assign({ _directives: e }, s), a = new ye(void 0, l), c = {
3087
+ atRoot: !0,
3088
+ directives: a.directives,
3089
+ options: a.options,
3090
+ schema: a.schema
3091
+ }, p = ce(n, {
3092
+ indicator: "doc-start",
3093
+ next: i ?? (r == null ? void 0 : r[0]),
3094
+ offset: t,
3095
+ onError: o,
3096
+ startOnNewline: !0
3097
+ });
3098
+ p.found && (a.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !p.hasNewline && o(p.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), a.contents = i ? ws(c, i, p, o) : At(c, p.end, n, null, p, o);
3099
+ const f = a.contents.range[2], u = Ee(r, f, !1, o);
3100
+ return u.comment && (a.comment = u.comment), a.range = [t, f, u.offset], a;
3101
+ }
3102
+ function ge(s) {
3103
+ if (typeof s == "number")
3104
+ return [s, s + 1];
3105
+ if (Array.isArray(s))
3106
+ return s.length === 2 ? s : [s[0], s[1]];
3107
+ const { offset: e, source: t } = s;
3108
+ return [e, e + (typeof t == "string" ? t.length : 1)];
3109
+ }
3110
+ function Mt(s) {
3111
+ var i;
3112
+ let e = "", t = !1, n = !1;
3113
+ for (let r = 0; r < s.length; ++r) {
3114
+ const o = s[r];
3115
+ switch (o[0]) {
3116
+ case "#":
3117
+ e += (e === "" ? "" : n ? `
3118
+
3119
+ ` : `
3120
+ `) + (o.substring(1) || " "), t = !0, n = !1;
3121
+ break;
3122
+ case "%":
3123
+ ((i = s[r + 1]) == null ? void 0 : i[0]) !== "#" && (r += 1), t = !1;
3124
+ break;
3125
+ default:
3126
+ t || (n = !0), t = !1;
3127
+ }
3128
+ }
3129
+ return { comment: e, afterEmptyLine: n };
3130
+ }
3131
+ class Et {
3132
+ constructor(e = {}) {
3133
+ this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
3134
+ const o = ge(t);
3135
+ r ? this.warnings.push(new ds(o, n, i)) : this.errors.push(new X(o, n, i));
3136
+ }, this.directives = new B({ version: e.version || "1.2" }), this.options = e;
3137
+ }
3138
+ decorate(e, t) {
3139
+ const { comment: n, afterEmptyLine: i } = Mt(this.prelude);
3140
+ if (n) {
3141
+ const r = e.contents;
3142
+ if (t)
3143
+ e.comment = e.comment ? `${e.comment}
3144
+ ${n}` : n;
3145
+ else if (i || e.directives.docStart || !r)
3146
+ e.commentBefore = n;
3147
+ else if (T(r) && !r.flow && r.items.length > 0) {
3148
+ let o = r.items[0];
3149
+ E(o) && (o = o.key);
3150
+ const l = o.commentBefore;
3151
+ o.commentBefore = l ? `${n}
3152
+ ${l}` : n;
3153
+ } else {
3154
+ const o = r.commentBefore;
3155
+ r.commentBefore = o ? `${n}
3156
+ ${o}` : n;
3157
+ }
3158
+ }
3159
+ t ? (Array.prototype.push.apply(e.errors, this.errors), Array.prototype.push.apply(e.warnings, this.warnings)) : (e.errors = this.errors, e.warnings = this.warnings), this.prelude = [], this.errors = [], this.warnings = [];
3160
+ }
3161
+ /**
3162
+ * Current stream status information.
3163
+ *
3164
+ * Mostly useful at the end of input for an empty stream.
3165
+ */
3166
+ streamInfo() {
3167
+ return {
3168
+ comment: Mt(this.prelude).comment,
3169
+ directives: this.directives,
3170
+ errors: this.errors,
3171
+ warnings: this.warnings
3172
+ };
3173
+ }
3174
+ /**
3175
+ * Compose tokens into documents.
3176
+ *
3177
+ * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
3178
+ * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
3179
+ */
3180
+ *compose(e, t = !1, n = -1) {
3181
+ for (const i of e)
3182
+ yield* this.next(i);
3183
+ yield* this.end(t, n);
3184
+ }
3185
+ /** Advance the composer by one CST token. */
3186
+ *next(e) {
3187
+ switch (e.type) {
3188
+ case "directive":
3189
+ this.directives.add(e.source, (t, n, i) => {
3190
+ const r = ge(e);
3191
+ r[0] += t, this.onError(r, "BAD_DIRECTIVE", n, i);
3192
+ }), this.prelude.push(e.source), this.atDirectives = !0;
3193
+ break;
3194
+ case "document": {
3195
+ const t = On(this.options, this.directives, e, this.onError);
3196
+ 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;
3197
+ break;
3198
+ }
3199
+ case "byte-order-mark":
3200
+ case "space":
3201
+ break;
3202
+ case "comment":
3203
+ case "newline":
3204
+ this.prelude.push(e.source);
3205
+ break;
3206
+ case "error": {
3207
+ const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new X(ge(e), "UNEXPECTED_TOKEN", t);
3208
+ this.atDirectives || !this.doc ? this.errors.push(n) : this.doc.errors.push(n);
3209
+ break;
3210
+ }
3211
+ case "doc-end": {
3212
+ if (!this.doc) {
3213
+ const n = "Unexpected doc-end without preceding document";
3214
+ this.errors.push(new X(ge(e), "UNEXPECTED_TOKEN", n));
3215
+ break;
3216
+ }
3217
+ this.doc.directives.docEnd = !0;
3218
+ const t = Ee(e.end, e.offset + e.source.length, this.doc.options.strict, this.onError);
3219
+ if (this.decorate(this.doc, !0), t.comment) {
3220
+ const n = this.doc.comment;
3221
+ this.doc.comment = n ? `${n}
3222
+ ${t.comment}` : t.comment;
3223
+ }
3224
+ this.doc.range[2] = t.offset;
3225
+ break;
3226
+ }
3227
+ default:
3228
+ this.errors.push(new X(ge(e), "UNEXPECTED_TOKEN", `Unsupported token ${e.type}`));
3229
+ }
3230
+ }
3231
+ /**
3232
+ * Call at end of input to yield any remaining document.
3233
+ *
3234
+ * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
3235
+ * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
3236
+ */
3237
+ *end(e = !1, t = -1) {
3238
+ if (this.doc)
3239
+ this.decorate(this.doc, !0), yield this.doc, this.doc = null;
3240
+ else if (e) {
3241
+ const n = Object.assign({ _directives: this.directives }, this.options), i = new ye(void 0, n);
3242
+ this.atDirectives && this.onError(t, "MISSING_CHAR", "Missing directives-end indicator line"), i.range = [0, t, t], this.decorate(i, !1), yield i;
3243
+ }
3244
+ }
3245
+ }
3246
+ function An(s, e = !0, t) {
3247
+ if (s) {
3248
+ const n = (i, r, o) => {
3249
+ const l = typeof i == "number" ? i : Array.isArray(i) ? i[0] : i.offset;
3250
+ if (t)
3251
+ t(l, r, o);
3252
+ else
3253
+ throw new X([l, l + 1], r, o);
3254
+ };
3255
+ switch (s.type) {
3256
+ case "scalar":
3257
+ case "single-quoted-scalar":
3258
+ case "double-quoted-scalar":
3259
+ return ys(s, e, n);
3260
+ case "block-scalar":
3261
+ return ms(s, e, n);
3262
+ }
3263
+ }
3264
+ return null;
3265
+ }
3266
+ function En(s, e) {
3267
+ const { implicitKey: t = !1, indent: n, inFlow: i = !1, offset: r = -1, type: o = "PLAIN" } = e, l = Oe({ type: o, value: s }, {
3268
+ implicitKey: t,
3269
+ indent: n > 0 ? " ".repeat(n) : "",
3270
+ inFlow: i,
3271
+ options: { blockQuote: !0, lineWidth: -1 }
3272
+ }), a = e.end ?? [
3273
+ { type: "newline", offset: -1, indent: n, source: `
3274
+ ` }
3275
+ ];
3276
+ switch (l[0]) {
3277
+ case "|":
3278
+ case ">": {
3279
+ const c = l.indexOf(`
3280
+ `), p = l.substring(0, c), f = l.substring(c + 1) + `
3281
+ `, u = [
3282
+ { type: "block-scalar-header", offset: r, indent: n, source: p }
3283
+ ];
3284
+ return Ss(u, a) || u.push({ type: "newline", offset: -1, indent: n, source: `
3285
+ ` }), { type: "block-scalar", offset: r, indent: n, props: u, source: f };
3286
+ }
3287
+ case '"':
3288
+ return { type: "double-quoted-scalar", offset: r, indent: n, source: l, end: a };
3289
+ case "'":
3290
+ return { type: "single-quoted-scalar", offset: r, indent: n, source: l, end: a };
3291
+ default:
3292
+ return { type: "scalar", offset: r, indent: n, source: l, end: a };
3293
+ }
3294
+ }
3295
+ function In(s, e, t = {}) {
3296
+ let { afterKey: n = !1, implicitKey: i = !1, inFlow: r = !1, type: o } = t, l = "indent" in s ? s.indent : null;
3297
+ if (n && typeof l == "number" && (l += 2), !o)
3298
+ switch (s.type) {
3299
+ case "single-quoted-scalar":
3300
+ o = "QUOTE_SINGLE";
3301
+ break;
3302
+ case "double-quoted-scalar":
3303
+ o = "QUOTE_DOUBLE";
3304
+ break;
3305
+ case "block-scalar": {
3306
+ const c = s.props[0];
3307
+ if (c.type !== "block-scalar-header")
3308
+ throw new Error("Invalid block scalar header");
3309
+ o = c.source[0] === ">" ? "BLOCK_FOLDED" : "BLOCK_LITERAL";
3310
+ break;
3311
+ }
3312
+ default:
3313
+ o = "PLAIN";
3314
+ }
3315
+ const a = Oe({ type: o, value: e }, {
3316
+ implicitKey: i || l === null,
3317
+ indent: l !== null && l > 0 ? " ".repeat(l) : "",
3318
+ inFlow: r,
3319
+ options: { blockQuote: !0, lineWidth: -1 }
3320
+ });
3321
+ switch (a[0]) {
3322
+ case "|":
3323
+ case ">":
3324
+ Tn(s, a);
3325
+ break;
3326
+ case '"':
3327
+ st(s, a, "double-quoted-scalar");
3328
+ break;
3329
+ case "'":
3330
+ st(s, a, "single-quoted-scalar");
3331
+ break;
3332
+ default:
3333
+ st(s, a, "scalar");
3334
+ }
3335
+ }
3336
+ function Tn(s, e) {
3337
+ const t = e.indexOf(`
3338
+ `), n = e.substring(0, t), i = e.substring(t + 1) + `
3339
+ `;
3340
+ if (s.type === "block-scalar") {
3341
+ const r = s.props[0];
3342
+ if (r.type !== "block-scalar-header")
3343
+ throw new Error("Invalid block scalar header");
3344
+ r.source = n, s.source = i;
3345
+ } else {
3346
+ const { offset: r } = s, o = "indent" in s ? s.indent : -1, l = [
3347
+ { type: "block-scalar-header", offset: r, indent: o, source: n }
3348
+ ];
3349
+ Ss(l, "end" in s ? s.end : void 0) || l.push({ type: "newline", offset: -1, indent: o, source: `
3350
+ ` });
3351
+ for (const a of Object.keys(s))
3352
+ a !== "type" && a !== "offset" && delete s[a];
3353
+ Object.assign(s, { type: "block-scalar", indent: o, props: l, source: i });
3354
+ }
3355
+ }
3356
+ function Ss(s, e) {
3357
+ if (e)
3358
+ for (const t of e)
3359
+ switch (t.type) {
3360
+ case "space":
3361
+ case "comment":
3362
+ s.push(t);
3363
+ break;
3364
+ case "newline":
3365
+ return s.push(t), !0;
3366
+ }
3367
+ return !1;
3368
+ }
3369
+ function st(s, e, t) {
3370
+ switch (s.type) {
3371
+ case "scalar":
3372
+ case "double-quoted-scalar":
3373
+ case "single-quoted-scalar":
3374
+ s.type = t, s.source = e;
3375
+ break;
3376
+ case "block-scalar": {
3377
+ const n = s.props.slice(1);
3378
+ let i = e.length;
3379
+ s.props[0].type === "block-scalar-header" && (i -= s.props[0].source.length);
3380
+ for (const r of n)
3381
+ r.offset += i;
3382
+ delete s.props, Object.assign(s, { type: t, source: e, end: n });
3383
+ break;
3384
+ }
3385
+ case "block-map":
3386
+ case "block-seq": {
3387
+ const i = { type: "newline", offset: s.offset + e.length, indent: s.indent, source: `
3388
+ ` };
3389
+ delete s.items, Object.assign(s, { type: t, source: e, end: [i] });
3390
+ break;
3391
+ }
3392
+ default: {
3393
+ const n = "indent" in s ? s.indent : -1, i = "end" in s && Array.isArray(s.end) ? s.end.filter((r) => r.type === "space" || r.type === "comment" || r.type === "newline") : [];
3394
+ for (const r of Object.keys(s))
3395
+ r !== "type" && r !== "offset" && delete s[r];
3396
+ Object.assign(s, { type: t, indent: n, source: e, end: i });
3397
+ }
3398
+ }
3399
+ }
3400
+ const Ln = (s) => "type" in s ? je(s) : ve(s);
3401
+ function je(s) {
3402
+ switch (s.type) {
3403
+ case "block-scalar": {
3404
+ let e = "";
3405
+ for (const t of s.props)
3406
+ e += je(t);
3407
+ return e + s.source;
3408
+ }
3409
+ case "block-map":
3410
+ case "block-seq": {
3411
+ let e = "";
3412
+ for (const t of s.items)
3413
+ e += ve(t);
3414
+ return e;
3415
+ }
3416
+ case "flow-collection": {
3417
+ let e = s.start.source;
3418
+ for (const t of s.items)
3419
+ e += ve(t);
3420
+ for (const t of s.end)
3421
+ e += t.source;
3422
+ return e;
3423
+ }
3424
+ case "document": {
3425
+ let e = ve(s);
3426
+ if (s.end)
3427
+ for (const t of s.end)
3428
+ e += t.source;
3429
+ return e;
3430
+ }
3431
+ default: {
3432
+ let e = s.source;
3433
+ if ("end" in s && s.end)
3434
+ for (const t of s.end)
3435
+ e += t.source;
3436
+ return e;
3437
+ }
3438
+ }
3439
+ }
3440
+ function ve({ start: s, key: e, sep: t, value: n }) {
3441
+ let i = "";
3442
+ for (const r of s)
3443
+ i += r.source;
3444
+ if (e && (i += je(e)), t)
3445
+ for (const r of t)
3446
+ i += r.source;
3447
+ return n && (i += je(n)), i;
3448
+ }
3449
+ const ft = Symbol("break visit"), $n = Symbol("skip children"), ks = Symbol("remove item");
3450
+ function z(s, e) {
3451
+ "type" in s && s.type === "document" && (s = { start: s.start, value: s.value }), Ns(Object.freeze([]), s, e);
3452
+ }
3453
+ z.BREAK = ft;
3454
+ z.SKIP = $n;
3455
+ z.REMOVE = ks;
3456
+ z.itemAtPath = (s, e) => {
3457
+ let t = s;
3458
+ for (const [n, i] of e) {
3459
+ const r = t == null ? void 0 : t[n];
3460
+ if (r && "items" in r)
3461
+ t = r.items[i];
3462
+ else
3463
+ return;
3464
+ }
3465
+ return t;
3466
+ };
3467
+ z.parentCollection = (s, e) => {
3468
+ const t = z.itemAtPath(s, e.slice(0, -1)), n = e[e.length - 1][0], i = t == null ? void 0 : t[n];
3469
+ if (i && "items" in i)
3470
+ return i;
3471
+ throw new Error("Parent collection not found");
3472
+ };
3473
+ function Ns(s, e, t) {
3474
+ let n = t(e, s);
3475
+ if (typeof n == "symbol")
3476
+ return n;
3477
+ for (const i of ["key", "value"]) {
3478
+ const r = e[i];
3479
+ if (r && "items" in r) {
3480
+ for (let o = 0; o < r.items.length; ++o) {
3481
+ const l = Ns(Object.freeze(s.concat([[i, o]])), r.items[o], t);
3482
+ if (typeof l == "number")
3483
+ o = l - 1;
3484
+ else {
3485
+ if (l === ft)
3486
+ return ft;
3487
+ l === ks && (r.items.splice(o, 1), o -= 1);
3488
+ }
3489
+ }
3490
+ typeof n == "function" && i === "key" && (n = n(e, s));
3491
+ }
3492
+ }
3493
+ return typeof n == "function" ? n(e, s) : n;
3494
+ }
3495
+ const We = "\uFEFF", He = "", Xe = "", Ne = "", _n = (s) => !!s && "items" in s, Cn = (s) => !!s && (s.type === "scalar" || s.type === "single-quoted-scalar" || s.type === "double-quoted-scalar" || s.type === "block-scalar");
3496
+ function vn(s) {
3497
+ switch (s) {
3498
+ case We:
3499
+ return "<BOM>";
3500
+ case He:
3501
+ return "<DOC>";
3502
+ case Xe:
3503
+ return "<FLOW_END>";
3504
+ case Ne:
3505
+ return "<SCALAR>";
3506
+ default:
3507
+ return JSON.stringify(s);
3508
+ }
3509
+ }
3510
+ function Os(s) {
3511
+ switch (s) {
3512
+ case We:
3513
+ return "byte-order-mark";
3514
+ case He:
3515
+ return "doc-mode";
3516
+ case Xe:
3517
+ return "flow-error-end";
3518
+ case Ne:
3519
+ return "scalar";
3520
+ case "---":
3521
+ return "doc-start";
3522
+ case "...":
3523
+ return "doc-end";
3524
+ case "":
3525
+ case `
3526
+ `:
3527
+ case `\r
3528
+ `:
3529
+ return "newline";
3530
+ case "-":
3531
+ return "seq-item-ind";
3532
+ case "?":
3533
+ return "explicit-key-ind";
3534
+ case ":":
3535
+ return "map-value-ind";
3536
+ case "{":
3537
+ return "flow-map-start";
3538
+ case "}":
3539
+ return "flow-map-end";
3540
+ case "[":
3541
+ return "flow-seq-start";
3542
+ case "]":
3543
+ return "flow-seq-end";
3544
+ case ",":
3545
+ return "comma";
3546
+ }
3547
+ switch (s[0]) {
3548
+ case " ":
3549
+ case " ":
3550
+ return "space";
3551
+ case "#":
3552
+ return "comment";
3553
+ case "%":
3554
+ return "directive-line";
3555
+ case "*":
3556
+ return "alias";
3557
+ case "&":
3558
+ return "anchor";
3559
+ case "!":
3560
+ return "tag";
3561
+ case "'":
3562
+ return "single-quoted-scalar";
3563
+ case '"':
3564
+ return "double-quoted-scalar";
3565
+ case "|":
3566
+ case ">":
3567
+ return "block-scalar-header";
3568
+ }
3569
+ return null;
3570
+ }
3571
+ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3572
+ __proto__: null,
3573
+ BOM: We,
3574
+ DOCUMENT: He,
3575
+ FLOW_END: Xe,
3576
+ SCALAR: Ne,
3577
+ createScalarToken: En,
3578
+ isCollection: _n,
3579
+ isScalar: Cn,
3580
+ prettyToken: vn,
3581
+ resolveAsScalar: An,
3582
+ setScalarValue: In,
3583
+ stringify: Ln,
3584
+ tokenType: Os,
3585
+ visit: z
3586
+ }, Symbol.toStringTag, { value: "Module" }));
3587
+ function j(s) {
3588
+ switch (s) {
3589
+ case void 0:
3590
+ case " ":
3591
+ case `
3592
+ `:
3593
+ case "\r":
3594
+ case " ":
3595
+ return !0;
3596
+ default:
3597
+ return !1;
3598
+ }
3599
+ }
3600
+ const Pt = "0123456789ABCDEFabcdef".split(""), Mn = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""), nt = ",[]{}".split(""), Pn = ` ,[]{}
3601
+ \r `.split(""), it = (s) => !s || Pn.includes(s);
3602
+ class As {
3603
+ constructor() {
3604
+ 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;
3605
+ }
3606
+ /**
3607
+ * Generate YAML tokens from the `source` string. If `incomplete`,
3608
+ * a part of the last line may be left as a buffer for the next call.
3609
+ *
3610
+ * @returns A generator of lexical tokens
3611
+ */
3612
+ *lex(e, t = !1) {
3613
+ e && (this.buffer = this.buffer ? this.buffer + e : e, this.lineEndPos = null), this.atEnd = !t;
3614
+ let n = this.next ?? "stream";
3615
+ for (; n && (t || this.hasChars(1)); )
3616
+ n = yield* this.parseNext(n);
3617
+ }
3618
+ atLineEnd() {
3619
+ let e = this.pos, t = this.buffer[e];
3620
+ for (; t === " " || t === " "; )
3621
+ t = this.buffer[++e];
3622
+ return !t || t === "#" || t === `
3623
+ ` ? !0 : t === "\r" ? this.buffer[e + 1] === `
3624
+ ` : !1;
3625
+ }
3626
+ charAt(e) {
3627
+ return this.buffer[this.pos + e];
3628
+ }
3629
+ continueScalar(e) {
3630
+ let t = this.buffer[e];
3631
+ if (this.indentNext > 0) {
3632
+ let n = 0;
3633
+ for (; t === " "; )
3634
+ t = this.buffer[++n + e];
3635
+ if (t === "\r") {
3636
+ const i = this.buffer[n + e + 1];
3637
+ if (i === `
3638
+ ` || !i && !this.atEnd)
3639
+ return e + n + 1;
3640
+ }
3641
+ return t === `
3642
+ ` || n >= this.indentNext || !t && !this.atEnd ? e + n : -1;
3643
+ }
3644
+ if (t === "-" || t === ".") {
3645
+ const n = this.buffer.substr(e, 3);
3646
+ if ((n === "---" || n === "...") && j(this.buffer[e + 3]))
3647
+ return -1;
3648
+ }
3649
+ return e;
3650
+ }
3651
+ getLine() {
3652
+ let e = this.lineEndPos;
3653
+ return (typeof e != "number" || e !== -1 && e < this.pos) && (e = this.buffer.indexOf(`
3654
+ `, this.pos), this.lineEndPos = e), e === -1 ? this.atEnd ? this.buffer.substring(this.pos) : null : (this.buffer[e - 1] === "\r" && (e -= 1), this.buffer.substring(this.pos, e));
3655
+ }
3656
+ hasChars(e) {
3657
+ return this.pos + e <= this.buffer.length;
3658
+ }
3659
+ setNext(e) {
3660
+ return this.buffer = this.buffer.substring(this.pos), this.pos = 0, this.lineEndPos = null, this.next = e, null;
3661
+ }
3662
+ peek(e) {
3663
+ return this.buffer.substr(this.pos, e);
3664
+ }
3665
+ *parseNext(e) {
3666
+ switch (e) {
3667
+ case "stream":
3668
+ return yield* this.parseStream();
3669
+ case "line-start":
3670
+ return yield* this.parseLineStart();
3671
+ case "block-start":
3672
+ return yield* this.parseBlockStart();
3673
+ case "doc":
3674
+ return yield* this.parseDocument();
3675
+ case "flow":
3676
+ return yield* this.parseFlowCollection();
3677
+ case "quoted-scalar":
3678
+ return yield* this.parseQuotedScalar();
3679
+ case "block-scalar":
3680
+ return yield* this.parseBlockScalar();
3681
+ case "plain-scalar":
3682
+ return yield* this.parsePlainScalar();
3683
+ }
3684
+ }
3685
+ *parseStream() {
3686
+ let e = this.getLine();
3687
+ if (e === null)
3688
+ return this.setNext("stream");
3689
+ if (e[0] === We && (yield* this.pushCount(1), e = e.substring(1)), e[0] === "%") {
3690
+ let t = e.length;
3691
+ const n = e.indexOf("#");
3692
+ if (n !== -1) {
3693
+ const r = e[n - 1];
3694
+ (r === " " || r === " ") && (t = n - 1);
3695
+ }
3696
+ for (; ; ) {
3697
+ const r = e[t - 1];
3698
+ if (r === " " || r === " ")
3699
+ t -= 1;
3700
+ else
3701
+ break;
3702
+ }
3703
+ const i = (yield* this.pushCount(t)) + (yield* this.pushSpaces(!0));
3704
+ return yield* this.pushCount(e.length - i), this.pushNewline(), "stream";
3705
+ }
3706
+ if (this.atLineEnd()) {
3707
+ const t = yield* this.pushSpaces(!0);
3708
+ return yield* this.pushCount(e.length - t), yield* this.pushNewline(), "stream";
3709
+ }
3710
+ return yield He, yield* this.parseLineStart();
3711
+ }
3712
+ *parseLineStart() {
3713
+ const e = this.charAt(0);
3714
+ if (!e && !this.atEnd)
3715
+ return this.setNext("line-start");
3716
+ if (e === "-" || e === ".") {
3717
+ if (!this.atEnd && !this.hasChars(4))
3718
+ return this.setNext("line-start");
3719
+ const t = this.peek(3);
3720
+ if (t === "---" && j(this.charAt(3)))
3721
+ return yield* this.pushCount(3), this.indentValue = 0, this.indentNext = 0, "doc";
3722
+ if (t === "..." && j(this.charAt(3)))
3723
+ return yield* this.pushCount(3), "stream";
3724
+ }
3725
+ return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !j(this.charAt(1)) && (this.indentNext = this.indentValue), yield* this.parseBlockStart();
3726
+ }
3727
+ *parseBlockStart() {
3728
+ const [e, t] = this.peek(2);
3729
+ if (!t && !this.atEnd)
3730
+ return this.setNext("block-start");
3731
+ if ((e === "-" || e === "?" || e === ":") && j(t)) {
3732
+ const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0));
3733
+ return this.indentNext = this.indentValue + 1, this.indentValue += n, yield* this.parseBlockStart();
3734
+ }
3735
+ return "doc";
3736
+ }
3737
+ *parseDocument() {
3738
+ yield* this.pushSpaces(!0);
3739
+ const e = this.getLine();
3740
+ if (e === null)
3741
+ return this.setNext("doc");
3742
+ let t = yield* this.pushIndicators();
3743
+ switch (e[t]) {
3744
+ case "#":
3745
+ yield* this.pushCount(e.length - t);
3746
+ case void 0:
3747
+ return yield* this.pushNewline(), yield* this.parseLineStart();
3748
+ case "{":
3749
+ case "[":
3750
+ return yield* this.pushCount(1), this.flowKey = !1, this.flowLevel = 1, "flow";
3751
+ case "}":
3752
+ case "]":
3753
+ return yield* this.pushCount(1), "doc";
3754
+ case "*":
3755
+ return yield* this.pushUntil(it), "doc";
3756
+ case '"':
3757
+ case "'":
3758
+ return yield* this.parseQuotedScalar();
3759
+ case "|":
3760
+ case ">":
3761
+ return t += yield* this.parseBlockScalarHeader(), t += yield* this.pushSpaces(!0), yield* this.pushCount(e.length - t), yield* this.pushNewline(), yield* this.parseBlockScalar();
3762
+ default:
3763
+ return yield* this.parsePlainScalar();
3764
+ }
3765
+ }
3766
+ *parseFlowCollection() {
3767
+ let e, t, n = -1;
3768
+ do
3769
+ e = yield* this.pushNewline(), e > 0 ? (t = yield* this.pushSpaces(!1), this.indentValue = n = t) : t = 0, t += yield* this.pushSpaces(!0);
3770
+ while (e + t > 0);
3771
+ const i = this.getLine();
3772
+ if (i === null)
3773
+ return this.setNext("flow");
3774
+ if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) && j(i[3])) && !(n === this.indentNext - 1 && this.flowLevel === 1 && (i[0] === "]" || i[0] === "}")))
3775
+ return this.flowLevel = 0, yield Xe, yield* this.parseLineStart();
3776
+ let r = 0;
3777
+ for (; i[r] === ","; )
3778
+ r += yield* this.pushCount(1), r += yield* this.pushSpaces(!0), this.flowKey = !1;
3779
+ switch (r += yield* this.pushIndicators(), i[r]) {
3780
+ case void 0:
3781
+ return "flow";
3782
+ case "#":
3783
+ return yield* this.pushCount(i.length - r), "flow";
3784
+ case "{":
3785
+ case "[":
3786
+ return yield* this.pushCount(1), this.flowKey = !1, this.flowLevel += 1, "flow";
3787
+ case "}":
3788
+ case "]":
3789
+ return yield* this.pushCount(1), this.flowKey = !0, this.flowLevel -= 1, this.flowLevel ? "flow" : "doc";
3790
+ case "*":
3791
+ return yield* this.pushUntil(it), "flow";
3792
+ case '"':
3793
+ case "'":
3794
+ return this.flowKey = !0, yield* this.parseQuotedScalar();
3795
+ case ":": {
3796
+ const o = this.charAt(1);
3797
+ if (this.flowKey || j(o) || o === ",")
3798
+ return this.flowKey = !1, yield* this.pushCount(1), yield* this.pushSpaces(!0), "flow";
3799
+ }
3800
+ default:
3801
+ return this.flowKey = !1, yield* this.parsePlainScalar();
3802
+ }
3803
+ }
3804
+ *parseQuotedScalar() {
3805
+ const e = this.charAt(0);
3806
+ let t = this.buffer.indexOf(e, this.pos + 1);
3807
+ if (e === "'")
3808
+ for (; t !== -1 && this.buffer[t + 1] === "'"; )
3809
+ t = this.buffer.indexOf("'", t + 2);
3810
+ else
3811
+ for (; t !== -1; ) {
3812
+ let r = 0;
3813
+ for (; this.buffer[t - 1 - r] === "\\"; )
3814
+ r += 1;
3815
+ if (r % 2 === 0)
3816
+ break;
3817
+ t = this.buffer.indexOf('"', t + 1);
3818
+ }
3819
+ const n = this.buffer.substring(0, t);
3820
+ let i = n.indexOf(`
3821
+ `, this.pos);
3822
+ if (i !== -1) {
3823
+ for (; i !== -1; ) {
3824
+ const r = this.continueScalar(i + 1);
3825
+ if (r === -1)
3826
+ break;
3827
+ i = n.indexOf(`
3828
+ `, r);
3829
+ }
3830
+ i !== -1 && (t = i - (n[i - 1] === "\r" ? 2 : 1));
3831
+ }
3832
+ if (t === -1) {
3833
+ if (!this.atEnd)
3834
+ return this.setNext("quoted-scalar");
3835
+ t = this.buffer.length;
3836
+ }
3837
+ return yield* this.pushToIndex(t + 1, !1), this.flowLevel ? "flow" : "doc";
3838
+ }
3839
+ *parseBlockScalarHeader() {
3840
+ this.blockScalarIndent = -1, this.blockScalarKeep = !1;
3841
+ let e = this.pos;
3842
+ for (; ; ) {
3843
+ const t = this.buffer[++e];
3844
+ if (t === "+")
3845
+ this.blockScalarKeep = !0;
3846
+ else if (t > "0" && t <= "9")
3847
+ this.blockScalarIndent = Number(t) - 1;
3848
+ else if (t !== "-")
3849
+ break;
3850
+ }
3851
+ return yield* this.pushUntil((t) => j(t) || t === "#");
3852
+ }
3853
+ *parseBlockScalar() {
3854
+ let e = this.pos - 1, t = 0, n;
3855
+ e: for (let i = this.pos; n = this.buffer[i]; ++i)
3856
+ switch (n) {
3857
+ case " ":
3858
+ t += 1;
3859
+ break;
3860
+ case `
3861
+ `:
3862
+ e = i, t = 0;
3863
+ break;
3864
+ case "\r": {
3865
+ const r = this.buffer[i + 1];
3866
+ if (!r && !this.atEnd)
3867
+ return this.setNext("block-scalar");
3868
+ if (r === `
3869
+ `)
3870
+ break;
3871
+ }
3872
+ default:
3873
+ break e;
3874
+ }
3875
+ if (!n && !this.atEnd)
3876
+ return this.setNext("block-scalar");
3877
+ if (t >= this.indentNext) {
3878
+ this.blockScalarIndent === -1 ? this.indentNext = t : this.indentNext += this.blockScalarIndent;
3879
+ do {
3880
+ const i = this.continueScalar(e + 1);
3881
+ if (i === -1)
3882
+ break;
3883
+ e = this.buffer.indexOf(`
3884
+ `, i);
3885
+ } while (e !== -1);
3886
+ if (e === -1) {
3887
+ if (!this.atEnd)
3888
+ return this.setNext("block-scalar");
3889
+ e = this.buffer.length;
3890
+ }
3891
+ }
3892
+ if (!this.blockScalarKeep)
3893
+ do {
3894
+ let i = e - 1, r = this.buffer[i];
3895
+ r === "\r" && (r = this.buffer[--i]);
3896
+ const o = i;
3897
+ for (; r === " " || r === " "; )
3898
+ r = this.buffer[--i];
3899
+ if (r === `
3900
+ ` && i >= this.pos && i + 1 + t > o)
3901
+ e = i;
3902
+ else
3903
+ break;
3904
+ } while (!0);
3905
+ return yield Ne, yield* this.pushToIndex(e + 1, !0), yield* this.parseLineStart();
3906
+ }
3907
+ *parsePlainScalar() {
3908
+ const e = this.flowLevel > 0;
3909
+ let t = this.pos - 1, n = this.pos - 1, i;
3910
+ for (; i = this.buffer[++n]; )
3911
+ if (i === ":") {
3912
+ const r = this.buffer[n + 1];
3913
+ if (j(r) || e && r === ",")
3914
+ break;
3915
+ t = n;
3916
+ } else if (j(i)) {
3917
+ let r = this.buffer[n + 1];
3918
+ if (i === "\r" && (r === `
3919
+ ` ? (n += 1, i = `
3920
+ `, r = this.buffer[n + 1]) : t = n), r === "#" || e && nt.includes(r))
3921
+ break;
3922
+ if (i === `
3923
+ `) {
3924
+ const o = this.continueScalar(n + 1);
3925
+ if (o === -1)
3926
+ break;
3927
+ n = Math.max(n, o - 2);
3928
+ }
3929
+ } else {
3930
+ if (e && nt.includes(i))
3931
+ break;
3932
+ t = n;
3933
+ }
3934
+ return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield Ne, yield* this.pushToIndex(t + 1, !0), e ? "flow" : "doc");
3935
+ }
3936
+ *pushCount(e) {
3937
+ return e > 0 ? (yield this.buffer.substr(this.pos, e), this.pos += e, e) : 0;
3938
+ }
3939
+ *pushToIndex(e, t) {
3940
+ const n = this.buffer.slice(this.pos, e);
3941
+ return n ? (yield n, this.pos += n.length, n.length) : (t && (yield ""), 0);
3942
+ }
3943
+ *pushIndicators() {
3944
+ switch (this.charAt(0)) {
3945
+ case "!":
3946
+ return (yield* this.pushTag()) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
3947
+ case "&":
3948
+ return (yield* this.pushUntil(it)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
3949
+ case "-":
3950
+ case "?":
3951
+ case ":": {
3952
+ const e = this.flowLevel > 0, t = this.charAt(1);
3953
+ if (j(t) || e && nt.includes(t))
3954
+ return e ? this.flowKey && (this.flowKey = !1) : this.indentNext = this.indentValue + 1, (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
3955
+ }
3956
+ }
3957
+ return 0;
3958
+ }
3959
+ *pushTag() {
3960
+ if (this.charAt(1) === "<") {
3961
+ let e = this.pos + 2, t = this.buffer[e];
3962
+ for (; !j(t) && t !== ">"; )
3963
+ t = this.buffer[++e];
3964
+ return yield* this.pushToIndex(t === ">" ? e + 1 : e, !1);
3965
+ } else {
3966
+ let e = this.pos + 1, t = this.buffer[e];
3967
+ for (; t; )
3968
+ if (Mn.includes(t))
3969
+ t = this.buffer[++e];
3970
+ else if (t === "%" && Pt.includes(this.buffer[e + 1]) && Pt.includes(this.buffer[e + 2]))
3971
+ t = this.buffer[e += 3];
3972
+ else
3973
+ break;
3974
+ return yield* this.pushToIndex(e, !1);
3975
+ }
3976
+ }
3977
+ *pushNewline() {
3978
+ const e = this.buffer[this.pos];
3979
+ return e === `
3980
+ ` ? yield* this.pushCount(1) : e === "\r" && this.charAt(1) === `
3981
+ ` ? yield* this.pushCount(2) : 0;
3982
+ }
3983
+ *pushSpaces(e) {
3984
+ let t = this.pos - 1, n;
3985
+ do
3986
+ n = this.buffer[++t];
3987
+ while (n === " " || e && n === " ");
3988
+ const i = t - this.pos;
3989
+ return i > 0 && (yield this.buffer.substr(this.pos, i), this.pos = t), i;
3990
+ }
3991
+ *pushUntil(e) {
3992
+ let t = this.pos, n = this.buffer[t];
3993
+ for (; !e(n); )
3994
+ n = this.buffer[++t];
3995
+ return yield* this.pushToIndex(t, !1);
3996
+ }
3997
+ }
3998
+ class Es {
3999
+ constructor() {
4000
+ this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
4001
+ let t = 0, n = this.lineStarts.length;
4002
+ for (; t < n; ) {
4003
+ const r = t + n >> 1;
4004
+ this.lineStarts[r] < e ? t = r + 1 : n = r;
4005
+ }
4006
+ if (this.lineStarts[t] === e)
4007
+ return { line: t + 1, col: 1 };
4008
+ if (t === 0)
4009
+ return { line: 0, col: e };
4010
+ const i = this.lineStarts[t - 1];
4011
+ return { line: t, col: e - i + 1 };
4012
+ };
4013
+ }
4014
+ }
4015
+ function q(s, e) {
4016
+ for (let t = 0; t < s.length; ++t)
4017
+ if (s[t].type === e)
4018
+ return !0;
4019
+ return !1;
4020
+ }
4021
+ function jt(s) {
4022
+ for (let e = 0; e < s.length; ++e)
4023
+ switch (s[e].type) {
4024
+ case "space":
4025
+ case "comment":
4026
+ case "newline":
4027
+ break;
4028
+ default:
4029
+ return e;
4030
+ }
4031
+ return -1;
4032
+ }
4033
+ function Is(s) {
4034
+ switch (s == null ? void 0 : s.type) {
4035
+ case "alias":
4036
+ case "scalar":
4037
+ case "single-quoted-scalar":
4038
+ case "double-quoted-scalar":
4039
+ case "flow-collection":
4040
+ return !0;
4041
+ default:
4042
+ return !1;
4043
+ }
4044
+ }
4045
+ function Le(s) {
4046
+ switch (s.type) {
4047
+ case "document":
4048
+ return s.start;
4049
+ case "block-map": {
4050
+ const e = s.items[s.items.length - 1];
4051
+ return e.sep ?? e.start;
4052
+ }
4053
+ case "block-seq":
4054
+ return s.items[s.items.length - 1].start;
4055
+ default:
4056
+ return [];
4057
+ }
4058
+ }
4059
+ function te(s) {
4060
+ var t;
4061
+ if (s.length === 0)
4062
+ return [];
4063
+ let e = s.length;
4064
+ e: for (; --e >= 0; )
4065
+ switch (s[e].type) {
4066
+ case "doc-start":
4067
+ case "explicit-key-ind":
4068
+ case "map-value-ind":
4069
+ case "seq-item-ind":
4070
+ case "newline":
4071
+ break e;
4072
+ }
4073
+ for (; ((t = s[++e]) == null ? void 0 : t.type) === "space"; )
4074
+ ;
4075
+ return s.splice(e, s.length);
4076
+ }
4077
+ function Dt(s) {
4078
+ if (s.start.type === "flow-seq-start")
4079
+ for (const e of s.items)
4080
+ e.sep && !e.value && !q(e.start, "explicit-key-ind") && !q(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, Is(e.value) ? e.value.end ? Array.prototype.push.apply(e.value.end, e.sep) : e.value.end = e.sep : Array.prototype.push.apply(e.start, e.sep), delete e.sep);
4081
+ }
4082
+ class It {
4083
+ /**
4084
+ * @param onNewLine - If defined, called separately with the start position of
4085
+ * each new line (in `parse()`, including the start of input).
4086
+ */
4087
+ constructor(e) {
4088
+ this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new As(), this.onNewLine = e;
4089
+ }
4090
+ /**
4091
+ * Parse `source` as a YAML stream.
4092
+ * If `incomplete`, a part of the last line may be left as a buffer for the next call.
4093
+ *
4094
+ * Errors are not thrown, but yielded as `{ type: 'error', message }` tokens.
4095
+ *
4096
+ * @returns A generator of tokens representing each directive, document, and other structure.
4097
+ */
4098
+ *parse(e, t = !1) {
4099
+ this.onNewLine && this.offset === 0 && this.onNewLine(0);
4100
+ for (const n of this.lexer.lex(e, t))
4101
+ yield* this.next(n);
4102
+ t || (yield* this.end());
4103
+ }
4104
+ /**
4105
+ * Advance the parser by the `source` of one lexical token.
4106
+ */
4107
+ *next(e) {
4108
+ if (this.source = e, this.atScalar) {
4109
+ this.atScalar = !1, yield* this.step(), this.offset += e.length;
4110
+ return;
4111
+ }
4112
+ const t = Os(e);
4113
+ if (t)
4114
+ if (t === "scalar")
4115
+ this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
4116
+ else {
4117
+ switch (this.type = t, yield* this.step(), t) {
4118
+ case "newline":
4119
+ this.atNewLine = !0, this.indent = 0, this.onNewLine && this.onNewLine(this.offset + e.length);
4120
+ break;
4121
+ case "space":
4122
+ this.atNewLine && e[0] === " " && (this.indent += e.length);
4123
+ break;
4124
+ case "explicit-key-ind":
4125
+ case "map-value-ind":
4126
+ case "seq-item-ind":
4127
+ this.atNewLine && (this.indent += e.length);
4128
+ break;
4129
+ case "doc-mode":
4130
+ case "flow-error-end":
4131
+ return;
4132
+ default:
4133
+ this.atNewLine = !1;
4134
+ }
4135
+ this.offset += e.length;
4136
+ }
4137
+ else {
4138
+ const n = `Not a YAML token: ${e}`;
4139
+ yield* this.pop({ type: "error", offset: this.offset, message: n, source: e }), this.offset += e.length;
4140
+ }
4141
+ }
4142
+ /** Call at end of input to push out any remaining constructions */
4143
+ *end() {
4144
+ for (; this.stack.length > 0; )
4145
+ yield* this.pop();
4146
+ }
4147
+ get sourceToken() {
4148
+ return {
4149
+ type: this.type,
4150
+ offset: this.offset,
4151
+ indent: this.indent,
4152
+ source: this.source
4153
+ };
4154
+ }
4155
+ *step() {
4156
+ const e = this.peek(1);
4157
+ if (this.type === "doc-end" && (!e || e.type !== "doc-end")) {
4158
+ for (; this.stack.length > 0; )
4159
+ yield* this.pop();
4160
+ this.stack.push({
4161
+ type: "doc-end",
4162
+ offset: this.offset,
4163
+ source: this.source
4164
+ });
4165
+ return;
4166
+ }
4167
+ if (!e)
4168
+ return yield* this.stream();
4169
+ switch (e.type) {
4170
+ case "document":
4171
+ return yield* this.document(e);
4172
+ case "alias":
4173
+ case "scalar":
4174
+ case "single-quoted-scalar":
4175
+ case "double-quoted-scalar":
4176
+ return yield* this.scalar(e);
4177
+ case "block-scalar":
4178
+ return yield* this.blockScalar(e);
4179
+ case "block-map":
4180
+ return yield* this.blockMap(e);
4181
+ case "block-seq":
4182
+ return yield* this.blockSequence(e);
4183
+ case "flow-collection":
4184
+ return yield* this.flowCollection(e);
4185
+ case "doc-end":
4186
+ return yield* this.documentEnd(e);
4187
+ }
4188
+ yield* this.pop();
4189
+ }
4190
+ peek(e) {
4191
+ return this.stack[this.stack.length - e];
4192
+ }
4193
+ *pop(e) {
4194
+ const t = e ?? this.stack.pop();
4195
+ if (!t)
4196
+ yield { type: "error", offset: this.offset, source: "", message: "Tried to pop an empty stack" };
4197
+ else if (this.stack.length === 0)
4198
+ yield t;
4199
+ else {
4200
+ const n = this.peek(1);
4201
+ switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" && Dt(t), n.type) {
4202
+ case "document":
4203
+ n.value = t;
4204
+ break;
4205
+ case "block-scalar":
4206
+ n.props.push(t);
4207
+ break;
4208
+ case "block-map": {
4209
+ const i = n.items[n.items.length - 1];
4210
+ if (i.value) {
4211
+ n.items.push({ start: [], key: t, sep: [] }), this.onKeyLine = !0;
4212
+ return;
4213
+ } else if (i.sep)
4214
+ i.value = t;
4215
+ else {
4216
+ Object.assign(i, { key: t, sep: [] }), this.onKeyLine = !q(i.start, "explicit-key-ind");
4217
+ return;
4218
+ }
4219
+ break;
4220
+ }
4221
+ case "block-seq": {
4222
+ const i = n.items[n.items.length - 1];
4223
+ i.value ? n.items.push({ start: [], value: t }) : i.value = t;
4224
+ break;
4225
+ }
4226
+ case "flow-collection": {
4227
+ const i = n.items[n.items.length - 1];
4228
+ !i || i.value ? n.items.push({ start: [], key: t, sep: [] }) : i.sep ? i.value = t : Object.assign(i, { key: t, sep: [] });
4229
+ return;
4230
+ }
4231
+ default:
4232
+ yield* this.pop(), yield* this.pop(t);
4233
+ }
4234
+ if ((n.type === "document" || n.type === "block-map" || n.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
4235
+ const i = t.items[t.items.length - 1];
4236
+ i && !i.sep && !i.value && i.start.length > 0 && jt(i.start) === -1 && (t.indent === 0 || i.start.every((r) => r.type !== "comment" || r.indent < t.indent)) && (n.type === "document" ? n.end = i.start : n.items.push({ start: i.start }), t.items.splice(-1, 1));
4237
+ }
4238
+ }
4239
+ }
4240
+ *stream() {
4241
+ switch (this.type) {
4242
+ case "directive-line":
4243
+ yield { type: "directive", offset: this.offset, source: this.source };
4244
+ return;
4245
+ case "byte-order-mark":
4246
+ case "space":
4247
+ case "comment":
4248
+ case "newline":
4249
+ yield this.sourceToken;
4250
+ return;
4251
+ case "doc-mode":
4252
+ case "doc-start": {
4253
+ const e = {
4254
+ type: "document",
4255
+ offset: this.offset,
4256
+ start: []
4257
+ };
4258
+ this.type === "doc-start" && e.start.push(this.sourceToken), this.stack.push(e);
4259
+ return;
4260
+ }
4261
+ }
4262
+ yield {
4263
+ type: "error",
4264
+ offset: this.offset,
4265
+ message: `Unexpected ${this.type} token in YAML stream`,
4266
+ source: this.source
4267
+ };
4268
+ }
4269
+ *document(e) {
4270
+ if (e.value)
4271
+ return yield* this.lineEnd(e);
4272
+ switch (this.type) {
4273
+ case "doc-start": {
4274
+ jt(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
4275
+ return;
4276
+ }
4277
+ case "anchor":
4278
+ case "tag":
4279
+ case "space":
4280
+ case "comment":
4281
+ case "newline":
4282
+ e.start.push(this.sourceToken);
4283
+ return;
4284
+ }
4285
+ const t = this.startBlockValue(e);
4286
+ t ? this.stack.push(t) : yield {
4287
+ type: "error",
4288
+ offset: this.offset,
4289
+ message: `Unexpected ${this.type} token in YAML document`,
4290
+ source: this.source
4291
+ };
4292
+ }
4293
+ *scalar(e) {
4294
+ if (this.type === "map-value-ind") {
4295
+ const t = Le(this.peek(2)), n = te(t);
4296
+ let i;
4297
+ e.end ? (i = e.end, i.push(this.sourceToken), delete e.end) : i = [this.sourceToken];
4298
+ const r = {
4299
+ type: "block-map",
4300
+ offset: e.offset,
4301
+ indent: e.indent,
4302
+ items: [{ start: n, key: e, sep: i }]
4303
+ };
4304
+ this.onKeyLine = !0, this.stack[this.stack.length - 1] = r;
4305
+ } else
4306
+ yield* this.lineEnd(e);
4307
+ }
4308
+ *blockScalar(e) {
4309
+ switch (this.type) {
4310
+ case "space":
4311
+ case "comment":
4312
+ case "newline":
4313
+ e.props.push(this.sourceToken);
4314
+ return;
4315
+ case "scalar":
4316
+ if (e.source = this.source, this.atNewLine = !0, this.indent = 0, this.onNewLine) {
4317
+ let t = this.source.indexOf(`
4318
+ `) + 1;
4319
+ for (; t !== 0; )
4320
+ this.onNewLine(this.offset + t), t = this.source.indexOf(`
4321
+ `, t) + 1;
4322
+ }
4323
+ yield* this.pop();
4324
+ break;
4325
+ default:
4326
+ yield* this.pop(), yield* this.step();
4327
+ }
4328
+ }
4329
+ *blockMap(e) {
4330
+ var n;
4331
+ const t = e.items[e.items.length - 1];
4332
+ switch (this.type) {
4333
+ case "newline":
4334
+ if (this.onKeyLine = !1, t.value) {
4335
+ const i = "end" in t.value ? t.value.end : void 0, r = Array.isArray(i) ? i[i.length - 1] : void 0;
4336
+ (r == null ? void 0 : r.type) === "comment" ? i == null || i.push(this.sourceToken) : e.items.push({ start: [this.sourceToken] });
4337
+ } else t.sep ? t.sep.push(this.sourceToken) : t.start.push(this.sourceToken);
4338
+ return;
4339
+ case "space":
4340
+ case "comment":
4341
+ if (t.value)
4342
+ e.items.push({ start: [this.sourceToken] });
4343
+ else if (t.sep)
4344
+ t.sep.push(this.sourceToken);
4345
+ else {
4346
+ if (this.atIndentedComment(t.start, e.indent)) {
4347
+ const i = e.items[e.items.length - 2], r = (n = i == null ? void 0 : i.value) == null ? void 0 : n.end;
4348
+ if (Array.isArray(r)) {
4349
+ Array.prototype.push.apply(r, t.start), r.push(this.sourceToken), e.items.pop();
4350
+ return;
4351
+ }
4352
+ }
4353
+ t.start.push(this.sourceToken);
4354
+ }
4355
+ return;
4356
+ }
4357
+ if (this.indent >= e.indent) {
4358
+ const i = !this.onKeyLine && this.indent === e.indent && t.sep && this.type !== "seq-item-ind";
4359
+ let r = [];
4360
+ if (i && t.sep && !t.value) {
4361
+ const o = [];
4362
+ for (let l = 0; l < t.sep.length; ++l) {
4363
+ const a = t.sep[l];
4364
+ switch (a.type) {
4365
+ case "newline":
4366
+ o.push(l);
4367
+ break;
4368
+ case "space":
4369
+ break;
4370
+ case "comment":
4371
+ a.indent > e.indent && (o.length = 0);
4372
+ break;
4373
+ default:
4374
+ o.length = 0;
4375
+ }
4376
+ }
4377
+ o.length >= 2 && (r = t.sep.splice(o[1]));
4378
+ }
4379
+ switch (this.type) {
4380
+ case "anchor":
4381
+ case "tag":
4382
+ i || t.value ? (r.push(this.sourceToken), e.items.push({ start: r }), this.onKeyLine = !0) : t.sep ? t.sep.push(this.sourceToken) : t.start.push(this.sourceToken);
4383
+ return;
4384
+ case "explicit-key-ind":
4385
+ !t.sep && !q(t.start, "explicit-key-ind") ? t.start.push(this.sourceToken) : i || t.value ? (r.push(this.sourceToken), e.items.push({ start: r })) : this.stack.push({
4386
+ type: "block-map",
4387
+ offset: this.offset,
4388
+ indent: this.indent,
4389
+ items: [{ start: [this.sourceToken] }]
4390
+ }), this.onKeyLine = !0;
4391
+ return;
4392
+ case "map-value-ind":
4393
+ if (q(t.start, "explicit-key-ind"))
4394
+ if (t.sep)
4395
+ if (t.value)
4396
+ e.items.push({ start: [], key: null, sep: [this.sourceToken] });
4397
+ else if (q(t.sep, "map-value-ind"))
4398
+ this.stack.push({
4399
+ type: "block-map",
4400
+ offset: this.offset,
4401
+ indent: this.indent,
4402
+ items: [{ start: r, key: null, sep: [this.sourceToken] }]
4403
+ });
4404
+ else if (Is(t.key) && !q(t.sep, "newline")) {
4405
+ const o = te(t.start), l = t.key, a = t.sep;
4406
+ a.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
4407
+ type: "block-map",
4408
+ offset: this.offset,
4409
+ indent: this.indent,
4410
+ items: [{ start: o, key: l, sep: a }]
4411
+ });
4412
+ } else r.length > 0 ? t.sep = t.sep.concat(r, this.sourceToken) : t.sep.push(this.sourceToken);
4413
+ else if (q(t.start, "newline"))
4414
+ Object.assign(t, { key: null, sep: [this.sourceToken] });
4415
+ else {
4416
+ const o = te(t.start);
4417
+ this.stack.push({
4418
+ type: "block-map",
4419
+ offset: this.offset,
4420
+ indent: this.indent,
4421
+ items: [{ start: o, key: null, sep: [this.sourceToken] }]
4422
+ });
4423
+ }
4424
+ else
4425
+ t.sep ? t.value || i ? e.items.push({ start: r, key: null, sep: [this.sourceToken] }) : q(t.sep, "map-value-ind") ? this.stack.push({
4426
+ type: "block-map",
4427
+ offset: this.offset,
4428
+ indent: this.indent,
4429
+ items: [{ start: [], key: null, sep: [this.sourceToken] }]
4430
+ }) : t.sep.push(this.sourceToken) : Object.assign(t, { key: null, sep: [this.sourceToken] });
4431
+ this.onKeyLine = !0;
4432
+ return;
4433
+ case "alias":
4434
+ case "scalar":
4435
+ case "single-quoted-scalar":
4436
+ case "double-quoted-scalar": {
4437
+ const o = this.flowScalar(this.type);
4438
+ i || t.value ? (e.items.push({ start: r, key: o, sep: [] }), this.onKeyLine = !0) : t.sep ? this.stack.push(o) : (Object.assign(t, { key: o, sep: [] }), this.onKeyLine = !0);
4439
+ return;
4440
+ }
4441
+ default: {
4442
+ const o = this.startBlockValue(e);
4443
+ if (o) {
4444
+ i && o.type !== "block-seq" && q(t.start, "explicit-key-ind") && e.items.push({ start: r }), this.stack.push(o);
4445
+ return;
4446
+ }
4447
+ }
4448
+ }
4449
+ }
4450
+ yield* this.pop(), yield* this.step();
4451
+ }
4452
+ *blockSequence(e) {
4453
+ var n;
4454
+ const t = e.items[e.items.length - 1];
4455
+ switch (this.type) {
4456
+ case "newline":
4457
+ if (t.value) {
4458
+ const i = "end" in t.value ? t.value.end : void 0, r = Array.isArray(i) ? i[i.length - 1] : void 0;
4459
+ (r == null ? void 0 : r.type) === "comment" ? i == null || i.push(this.sourceToken) : e.items.push({ start: [this.sourceToken] });
4460
+ } else
4461
+ t.start.push(this.sourceToken);
4462
+ return;
4463
+ case "space":
4464
+ case "comment":
4465
+ if (t.value)
4466
+ e.items.push({ start: [this.sourceToken] });
4467
+ else {
4468
+ if (this.atIndentedComment(t.start, e.indent)) {
4469
+ const i = e.items[e.items.length - 2], r = (n = i == null ? void 0 : i.value) == null ? void 0 : n.end;
4470
+ if (Array.isArray(r)) {
4471
+ Array.prototype.push.apply(r, t.start), r.push(this.sourceToken), e.items.pop();
4472
+ return;
4473
+ }
4474
+ }
4475
+ t.start.push(this.sourceToken);
4476
+ }
4477
+ return;
4478
+ case "anchor":
4479
+ case "tag":
4480
+ if (t.value || this.indent <= e.indent)
4481
+ break;
4482
+ t.start.push(this.sourceToken);
4483
+ return;
4484
+ case "seq-item-ind":
4485
+ if (this.indent !== e.indent)
4486
+ break;
4487
+ t.value || q(t.start, "seq-item-ind") ? e.items.push({ start: [this.sourceToken] }) : t.start.push(this.sourceToken);
4488
+ return;
4489
+ }
4490
+ if (this.indent > e.indent) {
4491
+ const i = this.startBlockValue(e);
4492
+ if (i) {
4493
+ this.stack.push(i);
4494
+ return;
4495
+ }
4496
+ }
4497
+ yield* this.pop(), yield* this.step();
4498
+ }
4499
+ *flowCollection(e) {
4500
+ const t = e.items[e.items.length - 1];
4501
+ if (this.type === "flow-error-end") {
4502
+ let n;
4503
+ do
4504
+ yield* this.pop(), n = this.peek(1);
4505
+ while (n && n.type === "flow-collection");
4506
+ } else if (e.end.length === 0) {
4507
+ switch (this.type) {
4508
+ case "comma":
4509
+ case "explicit-key-ind":
4510
+ !t || t.sep ? e.items.push({ start: [this.sourceToken] }) : t.start.push(this.sourceToken);
4511
+ return;
4512
+ case "map-value-ind":
4513
+ !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] });
4514
+ return;
4515
+ case "space":
4516
+ case "comment":
4517
+ case "newline":
4518
+ case "anchor":
4519
+ case "tag":
4520
+ !t || t.value ? e.items.push({ start: [this.sourceToken] }) : t.sep ? t.sep.push(this.sourceToken) : t.start.push(this.sourceToken);
4521
+ return;
4522
+ case "alias":
4523
+ case "scalar":
4524
+ case "single-quoted-scalar":
4525
+ case "double-quoted-scalar": {
4526
+ const i = this.flowScalar(this.type);
4527
+ !t || t.value ? e.items.push({ start: [], key: i, sep: [] }) : t.sep ? this.stack.push(i) : Object.assign(t, { key: i, sep: [] });
4528
+ return;
4529
+ }
4530
+ case "flow-map-end":
4531
+ case "flow-seq-end":
4532
+ e.end.push(this.sourceToken);
4533
+ return;
4534
+ }
4535
+ const n = this.startBlockValue(e);
4536
+ n ? this.stack.push(n) : (yield* this.pop(), yield* this.step());
4537
+ } else {
4538
+ const n = this.peek(2);
4539
+ if (n.type === "block-map" && (this.type === "map-value-ind" && n.indent === e.indent || this.type === "newline" && !n.items[n.items.length - 1].sep))
4540
+ yield* this.pop(), yield* this.step();
4541
+ else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
4542
+ const i = Le(n), r = te(i);
4543
+ Dt(e);
4544
+ const o = e.end.splice(1, e.end.length);
4545
+ o.push(this.sourceToken);
4546
+ const l = {
4547
+ type: "block-map",
4548
+ offset: e.offset,
4549
+ indent: e.indent,
4550
+ items: [{ start: r, key: e, sep: o }]
4551
+ };
4552
+ this.onKeyLine = !0, this.stack[this.stack.length - 1] = l;
4553
+ } else
4554
+ yield* this.lineEnd(e);
4555
+ }
4556
+ }
4557
+ flowScalar(e) {
4558
+ if (this.onNewLine) {
4559
+ let t = this.source.indexOf(`
4560
+ `) + 1;
4561
+ for (; t !== 0; )
4562
+ this.onNewLine(this.offset + t), t = this.source.indexOf(`
4563
+ `, t) + 1;
4564
+ }
4565
+ return {
4566
+ type: e,
4567
+ offset: this.offset,
4568
+ indent: this.indent,
4569
+ source: this.source
4570
+ };
4571
+ }
4572
+ startBlockValue(e) {
4573
+ switch (this.type) {
4574
+ case "alias":
4575
+ case "scalar":
4576
+ case "single-quoted-scalar":
4577
+ case "double-quoted-scalar":
4578
+ return this.flowScalar(this.type);
4579
+ case "block-scalar-header":
4580
+ return {
4581
+ type: "block-scalar",
4582
+ offset: this.offset,
4583
+ indent: this.indent,
4584
+ props: [this.sourceToken],
4585
+ source: ""
4586
+ };
4587
+ case "flow-map-start":
4588
+ case "flow-seq-start":
4589
+ return {
4590
+ type: "flow-collection",
4591
+ offset: this.offset,
4592
+ indent: this.indent,
4593
+ start: this.sourceToken,
4594
+ items: [],
4595
+ end: []
4596
+ };
4597
+ case "seq-item-ind":
4598
+ return {
4599
+ type: "block-seq",
4600
+ offset: this.offset,
4601
+ indent: this.indent,
4602
+ items: [{ start: [this.sourceToken] }]
4603
+ };
4604
+ case "explicit-key-ind": {
4605
+ this.onKeyLine = !0;
4606
+ const t = Le(e), n = te(t);
4607
+ return n.push(this.sourceToken), {
4608
+ type: "block-map",
4609
+ offset: this.offset,
4610
+ indent: this.indent,
4611
+ items: [{ start: n }]
4612
+ };
4613
+ }
4614
+ case "map-value-ind": {
4615
+ this.onKeyLine = !0;
4616
+ const t = Le(e), n = te(t);
4617
+ return {
4618
+ type: "block-map",
4619
+ offset: this.offset,
4620
+ indent: this.indent,
4621
+ items: [{ start: n, key: null, sep: [this.sourceToken] }]
4622
+ };
4623
+ }
4624
+ }
4625
+ return null;
4626
+ }
4627
+ atIndentedComment(e, t) {
4628
+ return this.type !== "comment" || this.indent <= t ? !1 : e.every((n) => n.type === "newline" || n.type === "space");
4629
+ }
4630
+ *documentEnd(e) {
4631
+ this.type !== "doc-mode" && (e.end ? e.end.push(this.sourceToken) : e.end = [this.sourceToken], this.type === "newline" && (yield* this.pop()));
4632
+ }
4633
+ *lineEnd(e) {
4634
+ switch (this.type) {
4635
+ case "comma":
4636
+ case "doc-start":
4637
+ case "doc-end":
4638
+ case "flow-seq-end":
4639
+ case "flow-map-end":
4640
+ case "map-value-ind":
4641
+ yield* this.pop(), yield* this.step();
4642
+ break;
4643
+ case "newline":
4644
+ this.onKeyLine = !1;
4645
+ case "space":
4646
+ case "comment":
4647
+ default:
4648
+ e.end ? e.end.push(this.sourceToken) : e.end = [this.sourceToken], this.type === "newline" && (yield* this.pop());
4649
+ }
4650
+ }
4651
+ }
4652
+ function Ts(s) {
4653
+ const e = s.prettyErrors !== !1;
4654
+ return { lineCounter: s.lineCounter || e && new Es() || null, prettyErrors: e };
4655
+ }
4656
+ function jn(s, e = {}) {
4657
+ const { lineCounter: t, prettyErrors: n } = Ts(e), i = new It(t == null ? void 0 : t.addNewLine), r = new Et(e), o = Array.from(r.compose(i.parse(s)));
4658
+ if (n && t)
4659
+ for (const l of o)
4660
+ l.errors.forEach(Pe(s, t)), l.warnings.forEach(Pe(s, t));
4661
+ return o.length > 0 ? o : Object.assign([], { empty: !0 }, r.streamInfo());
4662
+ }
4663
+ function Ls(s, e = {}) {
4664
+ const { lineCounter: t, prettyErrors: n } = Ts(e), i = new It(t == null ? void 0 : t.addNewLine), r = new Et(e);
4665
+ let o = null;
4666
+ for (const l of r.compose(i.parse(s), !0, s.length))
4667
+ if (!o)
4668
+ o = l;
4669
+ else if (o.options.logLevel !== "silent") {
4670
+ o.errors.push(new X(l.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
4671
+ break;
4672
+ }
4673
+ return n && t && (o.errors.forEach(Pe(s, t)), o.warnings.forEach(Pe(s, t))), o;
4674
+ }
4675
+ function Dn(s, e, t) {
4676
+ let n;
4677
+ typeof e == "function" ? n = e : t === void 0 && e && typeof e == "object" && (t = e);
4678
+ const i = Ls(s, t);
4679
+ if (!i)
4680
+ return null;
4681
+ if (i.warnings.forEach((r) => Ht(i.options.logLevel, r)), i.errors.length > 0) {
4682
+ if (i.options.logLevel !== "silent")
4683
+ throw i.errors[0];
4684
+ i.errors = [];
4685
+ }
4686
+ return i.toJS(Object.assign({ reviver: n }, t));
4687
+ }
4688
+ function Kn(s, e, t) {
4689
+ let n = null;
4690
+ if (typeof e == "function" || Array.isArray(e) ? n = e : t === void 0 && e && (t = e), typeof t == "string" && (t = t.length), typeof t == "number") {
4691
+ const i = Math.round(t);
4692
+ t = i < 1 ? void 0 : i > 8 ? { indent: 8 } : { indent: i };
4693
+ }
4694
+ if (s === void 0) {
4695
+ const { keepUndefined: i } = t ?? e ?? {};
4696
+ if (!i)
4697
+ return;
4698
+ }
4699
+ return new ye(s, n, t).toString(t);
4700
+ }
4701
+ const qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4702
+ __proto__: null,
4703
+ Alias: Ke,
4704
+ CST: Bn,
4705
+ Composer: Et,
4706
+ Document: ye,
4707
+ Lexer: As,
4708
+ LineCounter: Es,
4709
+ Pair: v,
4710
+ Parser: It,
4711
+ Scalar: N,
4712
+ Schema: Qe,
4713
+ YAMLError: Ot,
4714
+ YAMLMap: P,
4715
+ YAMLParseError: X,
4716
+ YAMLSeq: G,
4717
+ YAMLWarning: ds,
4718
+ isAlias: Z,
4719
+ isCollection: T,
4720
+ isDocument: ue,
4721
+ isMap: he,
4722
+ isNode: $,
4723
+ isPair: E,
4724
+ isScalar: A,
4725
+ isSeq: de,
4726
+ parse: Dn,
4727
+ parseAllDocuments: jn,
4728
+ parseDocument: Ls,
4729
+ stringify: Kn,
4730
+ visit: Y,
4731
+ visitAsync: De
4732
+ }, Symbol.toStringTag, { value: "Module" }));
4733
+ export {
4734
+ Ke as Alias,
4735
+ Bn as CST,
4736
+ Et as Composer,
4737
+ ye as Document,
4738
+ As as Lexer,
4739
+ Es as LineCounter,
4740
+ v as Pair,
4741
+ It as Parser,
4742
+ N as Scalar,
4743
+ Qe as Schema,
4744
+ Ot as YAMLError,
4745
+ P as YAMLMap,
4746
+ X as YAMLParseError,
4747
+ G as YAMLSeq,
4748
+ ds as YAMLWarning,
4749
+ qn as default,
4750
+ Z as isAlias,
4751
+ T as isCollection,
4752
+ ue as isDocument,
4753
+ he as isMap,
4754
+ $ as isNode,
4755
+ E as isPair,
4756
+ A as isScalar,
4757
+ de as isSeq,
4758
+ Dn as parse,
4759
+ jn as parseAllDocuments,
4760
+ Ls as parseDocument,
4761
+ Kn as stringify,
4762
+ Y as visit,
4763
+ De as visitAsync
4764
+ };
4765
+ //# sourceMappingURL=index-pI9JkN46.js.map