typerighter 0.4.3 → 0.30.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/app-gH0dpuch.js +2382 -0
  2. package/dist/brand-CG1fQshq.js +5 -0
  3. package/dist/cli-BFgBPypP.js +440 -0
  4. package/dist/cli.js +1 -1
  5. package/dist/client/app/index.d.ts +43 -4
  6. package/dist/client/app/index.d.ts.map +1 -1
  7. package/dist/client/app/router.d.ts +6 -2
  8. package/dist/client/app/router.d.ts.map +1 -1
  9. package/dist/client/theme-default.js +2314 -593
  10. package/dist/client.js +1 -1
  11. package/dist/fonts.css +2 -0
  12. package/dist/index.js +3 -4
  13. package/dist/init-EKDV1L4U.js +821 -0
  14. package/dist/math.css +1 -0
  15. package/dist/node/build/index.d.ts.map +1 -1
  16. package/dist/node/build/prerender.d.ts +2 -0
  17. package/dist/node/build/prerender.d.ts.map +1 -1
  18. package/dist/node/cli/index.d.ts.map +1 -1
  19. package/dist/node/cli/init.d.ts +7 -1
  20. package/dist/node/cli/init.d.ts.map +1 -1
  21. package/dist/node/context.d.ts.map +1 -1
  22. package/dist/node/lib/html-template.d.ts +22 -0
  23. package/dist/node/lib/html-template.d.ts.map +1 -0
  24. package/dist/node/lib/image-dimensions.d.ts +6 -0
  25. package/dist/node/lib/image-dimensions.d.ts.map +1 -0
  26. package/dist/node/lib/index.d.ts +0 -1
  27. package/dist/node/lib/index.d.ts.map +1 -1
  28. package/dist/node/lib/progress.d.ts +2 -0
  29. package/dist/node/lib/progress.d.ts.map +1 -1
  30. package/dist/node/lib/render/highlight/index.d.ts.map +1 -0
  31. package/dist/node/lib/render/highlight/language.d.ts.map +1 -0
  32. package/dist/node/lib/render/postprocess.d.ts +2 -0
  33. package/dist/node/lib/render/postprocess.d.ts.map +1 -0
  34. package/dist/node/lib/render/vue.d.ts +1 -0
  35. package/dist/node/lib/render/vue.d.ts.map +1 -1
  36. package/dist/node/{plugin/vite/search.d.ts → lib/search-indexer/index.d.ts} +2 -3
  37. package/dist/node/lib/search-indexer/index.d.ts.map +1 -0
  38. package/dist/node/lib/search-indexer/scan.d.ts +4 -0
  39. package/dist/node/lib/search-indexer/scan.d.ts.map +1 -0
  40. package/dist/node/lib/typedown-context.d.ts +6 -10
  41. package/dist/node/lib/typedown-context.d.ts.map +1 -1
  42. package/dist/node/plugin/vite/constants.d.ts +6 -0
  43. package/dist/node/plugin/vite/constants.d.ts.map +1 -1
  44. package/dist/node/plugin/vite/index.d.ts +7 -13
  45. package/dist/node/plugin/vite/index.d.ts.map +1 -1
  46. package/dist/node/plugin/vite/middleware/index.d.ts +3 -0
  47. package/dist/node/plugin/vite/middleware/index.d.ts.map +1 -0
  48. package/dist/node/plugin/vite/middleware/vault-assets.d.ts +5 -0
  49. package/dist/node/plugin/vite/middleware/vault-assets.d.ts.map +1 -0
  50. package/dist/node/plugin/vite/middleware/virtual-html.d.ts +6 -0
  51. package/dist/node/plugin/vite/middleware/virtual-html.d.ts.map +1 -0
  52. package/dist/node/plugin/vite/virtual/app.d.ts +23 -0
  53. package/dist/node/plugin/vite/virtual/app.d.ts.map +1 -0
  54. package/dist/node/plugin/vite/virtual/pages.d.ts +12 -0
  55. package/dist/node/plugin/vite/virtual/pages.d.ts.map +1 -0
  56. package/dist/node/plugin/vite/virtual/search-index.d.ts +11 -0
  57. package/dist/node/plugin/vite/virtual/search-index.d.ts.map +1 -0
  58. package/dist/node/plugin/vite/virtual/site-data.d.ts +13 -0
  59. package/dist/node/plugin/vite/virtual/site-data.d.ts.map +1 -0
  60. package/dist/node/plugin/vite/virtual/utils.d.ts +8 -0
  61. package/dist/node/plugin/vite/virtual/utils.d.ts.map +1 -0
  62. package/dist/shared/constants.d.ts.map +1 -1
  63. package/dist/shared/types/content.d.ts +42 -11
  64. package/dist/shared/types/content.d.ts.map +1 -1
  65. package/dist/shared/types/index.d.ts +0 -1
  66. package/dist/shared/types/index.d.ts.map +1 -1
  67. package/dist/shared/types/ssg.d.ts +15 -3
  68. package/dist/shared/types/ssg.d.ts.map +1 -1
  69. package/dist/shared/utils/content.d.ts +5 -3
  70. package/dist/shared/utils/content.d.ts.map +1 -1
  71. package/dist/shared/utils/field.d.ts +2 -0
  72. package/dist/shared/utils/field.d.ts.map +1 -0
  73. package/dist/shared/utils/html.d.ts +1 -0
  74. package/dist/shared/utils/html.d.ts.map +1 -1
  75. package/dist/shared/utils/index.d.ts +1 -0
  76. package/dist/shared/utils/index.d.ts.map +1 -1
  77. package/dist/shared/utils/path.d.ts +1 -0
  78. package/dist/shared/utils/path.d.ts.map +1 -1
  79. package/dist/shared/utils/url.d.ts +9 -1
  80. package/dist/shared/utils/url.d.ts.map +1 -1
  81. package/dist/shared-BuA2cqMO.js +401 -0
  82. package/dist/shared.js +2 -0
  83. package/dist/temml-DZbhOfRE.js +8146 -0
  84. package/dist/typerighter.css +1 -1
  85. package/dist/vite-CYozrIIG.js +1468 -0
  86. package/dist/vite.js +2 -2
  87. package/package.json +26 -40
  88. package/dist/app-Bw90hv7G.js +0 -266
  89. package/dist/brand-CmL-6h9U.js +0 -203
  90. package/dist/cli-BbvLsY1i.js +0 -640
  91. package/dist/constants-7heqadyd.js +0 -32183
  92. package/dist/init-DCkztTxJ.js +0 -2356
  93. package/dist/node/lib/markdown/index.d.ts +0 -5
  94. package/dist/node/lib/markdown/index.d.ts.map +0 -1
  95. package/dist/node/lib/markdown/plugins/callout-container.d.ts +0 -4
  96. package/dist/node/lib/markdown/plugins/callout-container.d.ts.map +0 -1
  97. package/dist/node/lib/markdown/plugins/custom-container.d.ts +0 -3
  98. package/dist/node/lib/markdown/plugins/custom-container.d.ts.map +0 -1
  99. package/dist/node/lib/markdown/plugins/highlight/index.d.ts.map +0 -1
  100. package/dist/node/lib/markdown/plugins/highlight/language.d.ts.map +0 -1
  101. package/dist/node/lib/markdown/plugins/image.d.ts +0 -3
  102. package/dist/node/lib/markdown/plugins/image.d.ts.map +0 -1
  103. package/dist/node/lib/markdown/plugins/line-number.d.ts +0 -3
  104. package/dist/node/lib/markdown/plugins/line-number.d.ts.map +0 -1
  105. package/dist/node/lib/markdown/plugins/link.d.ts +0 -3
  106. package/dist/node/lib/markdown/plugins/link.d.ts.map +0 -1
  107. package/dist/node/lib/markdown/plugins/pre-wrapper.d.ts +0 -6
  108. package/dist/node/lib/markdown/plugins/pre-wrapper.d.ts.map +0 -1
  109. package/dist/node/lib/markdown/plugins/restore-entities.d.ts +0 -3
  110. package/dist/node/lib/markdown/plugins/restore-entities.d.ts.map +0 -1
  111. package/dist/node/lib/markdown/plugins/table.d.ts +0 -3
  112. package/dist/node/lib/markdown/plugins/table.d.ts.map +0 -1
  113. package/dist/node/plugin/vite/search.d.ts.map +0 -1
  114. package/dist/shared/types/markdown.d.ts +0 -62
  115. package/dist/shared/types/markdown.d.ts.map +0 -1
  116. package/dist/vite-B-ktlRz9.js +0 -309
  117. /package/dist/node/lib/{markdown/plugins → render}/highlight/index.d.ts +0 -0
  118. /package/dist/node/lib/{markdown/plugins → render}/highlight/language.d.ts +0 -0
@@ -1,2356 +0,0 @@
1
- import { a as e, c as t, i as n } from "./constants-7heqadyd.js";
2
- import { l as r, r as i } from "./brand-CmL-6h9U.js";
3
- import a from "node:path";
4
- import "node:fs";
5
- import o from "node:fs/promises";
6
- import { styleText as s } from "node:util";
7
- import c, { stdin as l, stdout as u } from "node:process";
8
- import d from "node:readline";
9
- import "node:tty";
10
- //#region ../../node_modules/.pnpm/js-yaml@5.2.3/node_modules/js-yaml/dist/js-yaml.mjs
11
- var f = Symbol("NOT_RESOLVED"), p = Symbol("MERGE_KEY");
12
- function m(e, t) {
13
- return {
14
- tagName: e,
15
- nodeKind: "scalar",
16
- implicit: t.implicit ?? !1,
17
- matchByTagPrefix: t.matchByTagPrefix ?? !1,
18
- implicitFirstChars: t.implicitFirstChars ?? null,
19
- resolve: t.resolve,
20
- identify: t.identify ?? null,
21
- represent: t.represent ?? ((e) => String(e)),
22
- representTagName: t.representTagName ?? null
23
- };
24
- }
25
- function h(e, t) {
26
- let n = t.finalize === void 0;
27
- return {
28
- tagName: e,
29
- nodeKind: "sequence",
30
- implicit: !1,
31
- matchByTagPrefix: t.matchByTagPrefix ?? !1,
32
- create: t.create,
33
- addItem: t.addItem,
34
- finalize: t.finalize ?? ((e) => e),
35
- carrierIsResult: n,
36
- identify: t.identify ?? null,
37
- represent: t.represent ?? ((e) => e),
38
- representTagName: t.representTagName ?? null
39
- };
40
- }
41
- function g(e, t) {
42
- let n = t.finalize === void 0;
43
- return {
44
- tagName: e,
45
- nodeKind: "mapping",
46
- implicit: !1,
47
- matchByTagPrefix: t.matchByTagPrefix ?? !1,
48
- create: t.create,
49
- addPair: t.addPair,
50
- has: t.has,
51
- keys: t.keys,
52
- get: t.get,
53
- finalize: t.finalize ?? ((e) => e),
54
- carrierIsResult: n,
55
- identify: t.identify ?? null,
56
- represent: t.represent ?? ((e) => e),
57
- representTagName: t.representTagName ?? null
58
- };
59
- }
60
- var _ = m("tag:yaml.org,2002:str", {
61
- resolve: (e) => e,
62
- identify: (e) => typeof e == "string"
63
- }), v = [
64
- "",
65
- "~",
66
- "null",
67
- "Null",
68
- "NULL"
69
- ], y = m("tag:yaml.org,2002:null", {
70
- implicit: !0,
71
- implicitFirstChars: [
72
- "",
73
- "~",
74
- "n",
75
- "N"
76
- ],
77
- resolve: (e) => v.indexOf(e) === -1 ? f : null,
78
- identify: (e) => e === null,
79
- represent: () => "null"
80
- }), b = m("tag:yaml.org,2002:null", {
81
- implicit: !0,
82
- implicitFirstChars: ["n"],
83
- resolve: (e, t) => e === "null" || t && e === "" ? null : f,
84
- identify: (e) => e === null,
85
- represent: () => "null"
86
- }), x = [
87
- "",
88
- "~",
89
- "null",
90
- "Null",
91
- "NULL"
92
- ], S = m("tag:yaml.org,2002:null", {
93
- implicit: !0,
94
- implicitFirstChars: [
95
- "",
96
- "~",
97
- "n",
98
- "N"
99
- ],
100
- resolve: (e) => x.indexOf(e) === -1 ? f : null,
101
- identify: (e) => e === null,
102
- represent: () => "null"
103
- }), ee = [
104
- "true",
105
- "True",
106
- "TRUE"
107
- ], te = [
108
- "false",
109
- "False",
110
- "FALSE"
111
- ], ne = m("tag:yaml.org,2002:bool", {
112
- implicit: !0,
113
- implicitFirstChars: [
114
- "t",
115
- "T",
116
- "f",
117
- "F"
118
- ],
119
- resolve: (e) => ee.indexOf(e) !== -1 || te.indexOf(e) === -1 && f,
120
- identify: (e) => Object.prototype.toString.call(e) === "[object Boolean]",
121
- represent: (e) => e ? "true" : "false"
122
- }), re = ["true"], ie = ["false"], ae = m("tag:yaml.org,2002:bool", {
123
- implicit: !0,
124
- implicitFirstChars: ["t", "f"],
125
- resolve: (e) => re.indexOf(e) !== -1 || ie.indexOf(e) === -1 && f,
126
- identify: (e) => Object.prototype.toString.call(e) === "[object Boolean]",
127
- represent: (e) => e ? "true" : "false"
128
- }), oe = [
129
- "true",
130
- "True",
131
- "TRUE",
132
- "y",
133
- "Y",
134
- "yes",
135
- "Yes",
136
- "YES",
137
- "on",
138
- "On",
139
- "ON"
140
- ], se = [
141
- "false",
142
- "False",
143
- "FALSE",
144
- "n",
145
- "N",
146
- "no",
147
- "No",
148
- "NO",
149
- "off",
150
- "Off",
151
- "OFF"
152
- ], ce = m("tag:yaml.org,2002:bool", {
153
- implicit: !0,
154
- implicitFirstChars: [
155
- "y",
156
- "Y",
157
- "n",
158
- "N",
159
- "t",
160
- "T",
161
- "f",
162
- "F",
163
- "o",
164
- "O"
165
- ],
166
- resolve: (e) => oe.indexOf(e) !== -1 || se.indexOf(e) === -1 && f,
167
- identify: (e) => Object.prototype.toString.call(e) === "[object Boolean]",
168
- represent: (e) => e ? "true" : "false"
169
- }), le = /* @__PURE__ */ RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$"), ue = /* @__PURE__ */ RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
170
- function de(e) {
171
- let t = e, n = 1;
172
- return (t[0] === "-" || t[0] === "+") && (t[0] === "-" && (n = -1), t = t.slice(1)), t.startsWith("0b") ? n * parseInt(t.slice(2), 2) : t.startsWith("0o") ? n * parseInt(t.slice(2), 8) : t.startsWith("0x") ? n * parseInt(t.slice(2), 16) : n * parseInt(t, 10);
173
- }
174
- function fe(e, t) {
175
- if (t) {
176
- if (!ue.test(e)) return f;
177
- } else if (!le.test(e)) return f;
178
- let n = de(e);
179
- return Number.isFinite(n) ? n : f;
180
- }
181
- var pe = m("tag:yaml.org,2002:int", {
182
- implicit: !0,
183
- implicitFirstChars: [
184
- "-",
185
- "+",
186
- ..."0123456789"
187
- ],
188
- resolve: fe,
189
- identify: (e) => Number.isInteger(e) && !Object.is(e, -0) && e.toString(10).indexOf("e") < 0,
190
- represent: (e) => e.toString(10)
191
- }), me = /* @__PURE__ */ RegExp("^-?(?:0|[1-9][0-9]*)$"), he = /* @__PURE__ */ RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
192
- function ge(e) {
193
- let t = e, n = 1;
194
- return (t[0] === "-" || t[0] === "+") && (t[0] === "-" && (n = -1), t = t.slice(1)), t.startsWith("0b") ? n * parseInt(t.slice(2), 2) : t.startsWith("0o") ? n * parseInt(t.slice(2), 8) : t.startsWith("0x") ? n * parseInt(t.slice(2), 16) : n * parseInt(t, 10);
195
- }
196
- function _e(e, t) {
197
- if (t) {
198
- if (!he.test(e)) return f;
199
- } else if (!me.test(e)) return f;
200
- let n = ge(e);
201
- return Number.isFinite(n) ? n : f;
202
- }
203
- var ve = m("tag:yaml.org,2002:int", {
204
- implicit: !0,
205
- implicitFirstChars: ["-", ..."0123456789"],
206
- resolve: _e,
207
- identify: (e) => Number.isInteger(e) && !Object.is(e, -0) && e.toString(10).indexOf("e") < 0,
208
- represent: (e) => e.toString(10)
209
- }), ye = /* @__PURE__ */ RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");
210
- function be(e) {
211
- let t = e.replace(/_/g, ""), n = 1;
212
- if ((t[0] === "-" || t[0] === "+") && (t[0] === "-" && (n = -1), t = t.slice(1)), t.startsWith("0b")) return n * parseInt(t.slice(2), 2);
213
- if (t.startsWith("0x")) return n * parseInt(t.slice(2), 16);
214
- if (t.includes(":")) {
215
- let e = 0;
216
- for (let n of t.split(":")) e = e * 60 + Number(n);
217
- return n * e;
218
- }
219
- return t !== "0" && t[0] === "0" ? n * parseInt(t, 8) : n * parseInt(t, 10);
220
- }
221
- function xe(e) {
222
- if (!ye.test(e)) return f;
223
- let t = be(e);
224
- return Number.isFinite(t) ? t : f;
225
- }
226
- var Se = m("tag:yaml.org,2002:int", {
227
- implicit: !0,
228
- implicitFirstChars: [
229
- "-",
230
- "+",
231
- ..."0123456789"
232
- ],
233
- resolve: xe,
234
- identify: (e) => Number.isInteger(e) && !Object.is(e, -0) && e.toString(10).indexOf("e") < 0,
235
- represent: (e) => e.toString(10)
236
- }), Ce = /* @__PURE__ */ RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"), we = /* @__PURE__ */ RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
237
- function Te(e) {
238
- if (!Ce.test(e)) return f;
239
- let t = e.toLowerCase(), n = t[0] === "-" ? -1 : 1;
240
- if ("+-".includes(t[0]) && (t = t.slice(1)), t === ".inf") return n === 1 ? Infinity : -Infinity;
241
- if (t === ".nan") return NaN;
242
- let r = n * parseFloat(t);
243
- return Number.isFinite(r) || we.test(e) ? r : f;
244
- }
245
- function Ee(e) {
246
- if (isNaN(e)) return ".nan";
247
- if (e === Infinity) return ".inf";
248
- if (e === -Infinity) return "-.inf";
249
- if (Object.is(e, -0)) return "-0.0";
250
- let t = e.toString(10);
251
- return /^[-+]?[0-9]+e/.test(t) ? t.replace("e", ".e") : t;
252
- }
253
- var De = m("tag:yaml.org,2002:float", {
254
- implicit: !0,
255
- implicitFirstChars: [
256
- "-",
257
- "+",
258
- ".",
259
- ..."0123456789"
260
- ],
261
- resolve: Te,
262
- identify: (e) => typeof e == "number" && (!Number.isInteger(e) || Object.is(e, -0) || e.toString(10).indexOf("e") >= 0),
263
- represent: Ee
264
- }), Oe = /* @__PURE__ */ RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$"), ke = /* @__PURE__ */ RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
265
- function Ae(e, t) {
266
- if (t) {
267
- if (!ke.test(e)) return f;
268
- let t = e.toLowerCase(), n = t[0] === "-" ? -1 : 1;
269
- if ("+-".includes(t[0]) && (t = t.slice(1)), t === ".inf") return n === 1 ? Infinity : -Infinity;
270
- if (t === ".nan") return NaN;
271
- let r = n * parseFloat(t);
272
- return Number.isFinite(r) ? r : f;
273
- }
274
- if (!Oe.test(e)) return f;
275
- let n = Number(e);
276
- return Number.isFinite(n) ? n : f;
277
- }
278
- function je(e) {
279
- if (isNaN(e)) return ".nan";
280
- if (e === Infinity) return ".inf";
281
- if (e === -Infinity) return "-.inf";
282
- if (Object.is(e, -0)) return "-0.0";
283
- let t = e.toString(10);
284
- return /^[-+]?[0-9]+e/.test(t) ? t.replace("e", ".e") : t;
285
- }
286
- var Me = m("tag:yaml.org,2002:float", {
287
- implicit: !0,
288
- implicitFirstChars: ["-", ..."0123456789"],
289
- resolve: Ae,
290
- identify: (e) => typeof e == "number" && (!Number.isInteger(e) || Object.is(e, -0) || e.toString(10).indexOf("e") >= 0),
291
- represent: je
292
- }), Ne = /* @__PURE__ */ RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"), Pe = /* @__PURE__ */ RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
293
- function Fe(e) {
294
- if (!Ne.test(e)) return f;
295
- let t = e.toLowerCase().replace(/_/g, ""), n = t[0] === "-" ? -1 : 1;
296
- if ("+-".includes(t[0]) && (t = t.slice(1)), t === ".inf") return n === 1 ? Infinity : -Infinity;
297
- if (t === ".nan") return NaN;
298
- let r = 0;
299
- if (t.includes(":")) {
300
- for (let e of t.split(":")) r = r * 60 + Number(e);
301
- r *= n;
302
- } else r = n * parseFloat(t);
303
- return Number.isFinite(r) || Pe.test(e) ? r : f;
304
- }
305
- function Ie(e) {
306
- if (isNaN(e)) return ".nan";
307
- if (e === Infinity) return ".inf";
308
- if (e === -Infinity) return "-.inf";
309
- if (Object.is(e, -0)) return "-0.0";
310
- let t = e.toString(10);
311
- return /^[-+]?[0-9]+e/.test(t) ? t.replace("e", ".e") : t;
312
- }
313
- var Le = m("tag:yaml.org,2002:float", {
314
- implicit: !0,
315
- implicitFirstChars: [
316
- "-",
317
- "+",
318
- ".",
319
- ..."0123456789"
320
- ],
321
- resolve: Fe,
322
- identify: (e) => typeof e == "number" && (!Number.isInteger(e) || Object.is(e, -0) || e.toString(10).indexOf("e") >= 0),
323
- represent: Ie
324
- }), Re = m("tag:yaml.org,2002:merge", {
325
- implicit: !0,
326
- implicitFirstChars: ["<"],
327
- resolve: (e, t) => e === "<<" || t && e === "" ? p : f
328
- }), ze = /^[A-Za-z0-9+/]*={0,2}$/;
329
- function Be(e) {
330
- let t = e.replace(/\s/g, "");
331
- if (t.length % 4 != 0 || !ze.test(t)) return f;
332
- let n = atob(t), r = new Uint8Array(n.length);
333
- for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
334
- return r;
335
- }
336
- function Ve(e) {
337
- let t = "";
338
- for (let n = 0; n < e.length; n++) t += String.fromCharCode(e[n]);
339
- return btoa(t);
340
- }
341
- var He = m("tag:yaml.org,2002:binary", {
342
- resolve: Be,
343
- identify: (e) => Object.prototype.toString.call(e) === "[object Uint8Array]",
344
- represent: Ve
345
- }), Ue = /* @__PURE__ */ RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"), We = /* @__PURE__ */ RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
346
- function Ge(e, t, n, r = 0, i = 0, a = 0, o = 0) {
347
- let s = new Date(Date.UTC(e, t, n, r, i, a, o));
348
- return s.setUTCFullYear(e, t, n), s;
349
- }
350
- function Ke(e) {
351
- let t = Ue.exec(e);
352
- if (t === null && (t = We.exec(e)), t === null) return f;
353
- let n = +t[1], r = t[2] - 1, i = +t[3];
354
- if (!t[4]) {
355
- let e = Ge(n, r, i);
356
- return e.getUTCFullYear() !== n || e.getUTCMonth() !== r || e.getUTCDate() !== i ? f : e;
357
- }
358
- let a = +t[4], o = +t[5], s = +t[6], c = 0;
359
- if (a > 23 || o > 59 || s > 59) return f;
360
- if (t[7]) {
361
- let e = t[7].slice(0, 3);
362
- for (; e.length < 3;) e += "0";
363
- c = +e;
364
- }
365
- let l = Ge(n, r, i, a, o, s, c);
366
- if (l.getUTCFullYear() !== n || l.getUTCMonth() !== r || l.getUTCDate() !== i) return f;
367
- if (t[9]) {
368
- let e = +t[10], n = +(t[11] || 0);
369
- if (e > 23 || n > 59) return f;
370
- let r = (e * 60 + n) * 6e4;
371
- l.setTime(l.getTime() - (t[9] === "-" ? -r : r));
372
- }
373
- return l;
374
- }
375
- var qe = m("tag:yaml.org,2002:timestamp", {
376
- implicit: !0,
377
- implicitFirstChars: [..."0123456789"],
378
- resolve: Ke,
379
- identify: (e) => e instanceof Date,
380
- represent: (e) => e.toISOString()
381
- }), Je = h("tag:yaml.org,2002:seq", {
382
- create: () => [],
383
- addItem: (e, t) => {
384
- e.push(t);
385
- },
386
- identify: Array.isArray
387
- });
388
- function C(e) {
389
- if (typeof e != "object" || !e || Array.isArray(e)) return !1;
390
- let t = Object.getPrototypeOf(e);
391
- return t === null || t === Object.prototype;
392
- }
393
- function Ye(e, t) {
394
- let n = {};
395
- for (let r of t) e[r] !== void 0 && (n[r] = e[r]);
396
- return n;
397
- }
398
- var Xe = h("tag:yaml.org,2002:omap", {
399
- create: () => ({
400
- list: [],
401
- seen: /* @__PURE__ */ new Set()
402
- }),
403
- addItem: (e, t) => {
404
- let n;
405
- if (t instanceof Map) {
406
- if (t.size !== 1) return "cannot resolve an ordered map item";
407
- n = t.keys().next().value;
408
- } else if (C(t)) {
409
- let e = Object.keys(t);
410
- if (e.length !== 1) return "cannot resolve an ordered map item";
411
- n = e[0];
412
- } else return "cannot resolve an ordered map item";
413
- return e.seen.has(n) ? "duplicate key in ordered map" : (e.seen.add(n), e.list.push(t), "");
414
- },
415
- finalize: (e) => e.list
416
- }), Ze = h("tag:yaml.org,2002:pairs", {
417
- create: () => [],
418
- addItem: (e, t) => {
419
- if (t instanceof Map) return t.size === 1 ? (e.push(t.entries().next().value), "") : "cannot resolve a pairs item";
420
- if (Object.prototype.toString.call(t) !== "[object Object]") return "cannot resolve a pairs item";
421
- let n = t, r = Object.keys(n);
422
- return r.length === 1 ? (e.push([r[0], n[r[0]]]), "") : "cannot resolve a pairs item";
423
- }
424
- }), Qe = g("tag:yaml.org,2002:map", {
425
- create: () => ({}),
426
- identify: C,
427
- represent: (e) => {
428
- let t = /* @__PURE__ */ new Map();
429
- for (let n of Object.keys(e)) t.set(n, e[n]);
430
- return t;
431
- },
432
- addPair: (e, t, n) => {
433
- if (typeof t == "object" && t) return "object-based map does not support complex keys";
434
- let r = String(t);
435
- return r === "__proto__" ? Object.defineProperty(e, r, {
436
- value: n,
437
- enumerable: !0,
438
- configurable: !0,
439
- writable: !0
440
- }) : e[r] = n, "";
441
- },
442
- has: (e, t) => typeof t == "object" && t ? !1 : Object.prototype.hasOwnProperty.call(e, String(t)),
443
- keys: (e) => Object.keys(e),
444
- get: (e, t) => {
445
- let n = String(t);
446
- return Object.prototype.hasOwnProperty.call(e, n) ? e[n] : null;
447
- }
448
- }), $e = g("tag:yaml.org,2002:set", {
449
- create: () => /* @__PURE__ */ new Set(),
450
- identify: (e) => e instanceof Set,
451
- represent: (e) => {
452
- let t = /* @__PURE__ */ new Map();
453
- for (let n of e) t.set(n, null);
454
- return t;
455
- },
456
- addPair: (e, t, n) => n === null ? (e.add(t), "") : "cannot resolve a set item",
457
- has: (e, t) => e.has(t),
458
- keys: (e) => e.keys(),
459
- get: () => null
460
- });
461
- function et() {
462
- return {
463
- scalar: Object.create(null),
464
- sequence: Object.create(null),
465
- mapping: Object.create(null)
466
- };
467
- }
468
- function tt() {
469
- return {
470
- scalar: [],
471
- sequence: [],
472
- mapping: []
473
- };
474
- }
475
- function nt(e) {
476
- let t = [];
477
- for (let n of e) {
478
- let e = t.length;
479
- for (let r = 0; r < t.length; r++) {
480
- let i = t[r];
481
- if (i.nodeKind === n.nodeKind && i.tagName === n.tagName && i.matchByTagPrefix === n.matchByTagPrefix) {
482
- e = r;
483
- break;
484
- }
485
- }
486
- t[e] = n;
487
- }
488
- return t;
489
- }
490
- var w = class e {
491
- tags;
492
- implicitScalarTags;
493
- implicitScalarByFirstChar;
494
- implicitScalarAnyFirstChar;
495
- defaultScalarTag;
496
- defaultSequenceTag;
497
- defaultMappingTag;
498
- exact;
499
- prefix;
500
- constructor(e) {
501
- let t = nt(e), n = [], r = et(), i = tt();
502
- for (let e of t) {
503
- if (e.nodeKind === "scalar" && e.implicit) {
504
- if (e.matchByTagPrefix) throw Error("Implicit scalar tags cannot match by tag prefix");
505
- n.push(e);
506
- }
507
- switch (e.nodeKind) {
508
- case "scalar":
509
- e.matchByTagPrefix ? i.scalar.push(e) : r.scalar[e.tagName] = e;
510
- break;
511
- case "sequence":
512
- e.matchByTagPrefix ? i.sequence.push(e) : r.sequence[e.tagName] = e;
513
- break;
514
- case "mapping":
515
- e.matchByTagPrefix ? i.mapping.push(e) : r.mapping[e.tagName] = e;
516
- break;
517
- }
518
- }
519
- let a = n.filter((e) => e.implicitFirstChars === null), o = /* @__PURE__ */ new Set();
520
- for (let e of n) if (e.implicitFirstChars !== null) for (let t of e.implicitFirstChars) o.add(t);
521
- let s = /* @__PURE__ */ new Map();
522
- for (let e of o) s.set(e, n.filter((t) => t.implicitFirstChars === null || t.implicitFirstChars.indexOf(e) !== -1));
523
- let c = r.scalar["tag:yaml.org,2002:str"];
524
- if (!c) throw Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");
525
- this.tags = t, this.implicitScalarTags = n, this.implicitScalarByFirstChar = s, this.implicitScalarAnyFirstChar = a, this.defaultScalarTag = c, this.defaultSequenceTag = r.sequence["tag:yaml.org,2002:seq"], this.defaultMappingTag = r.mapping["tag:yaml.org,2002:map"], this.exact = r, this.prefix = i;
526
- }
527
- withTags(...t) {
528
- let n = [];
529
- for (let e of t) n = n.concat(e);
530
- return new e([...this.tags, ...n]);
531
- }
532
- }, rt = new w([
533
- _,
534
- Je,
535
- Qe
536
- ]);
537
- new w([
538
- ...rt.tags,
539
- b,
540
- ae,
541
- ve,
542
- Me
543
- ]);
544
- var it = new w([
545
- ...rt.tags,
546
- y,
547
- ne,
548
- pe,
549
- De
550
- ]), at = new w([
551
- ...rt.tags,
552
- S,
553
- ce,
554
- Se,
555
- Le,
556
- qe,
557
- Re,
558
- He,
559
- Xe,
560
- Ze,
561
- $e
562
- ]);
563
- g("tag:yaml.org,2002:map", {
564
- create: () => /* @__PURE__ */ new Map(),
565
- addPair: (e, t, n) => (e.set(t, n), ""),
566
- has: (e, t) => e.has(t),
567
- keys: (e) => e.keys(),
568
- get: (e, t) => e.get(t),
569
- identify: (e) => e instanceof Map || C(e),
570
- represent: (e) => {
571
- if (e instanceof Map) return e;
572
- let t = /* @__PURE__ */ new Map(), n = e;
573
- for (let e of Object.keys(n)) t.set(e, n[e]);
574
- return t;
575
- }
576
- });
577
- function ot(e) {
578
- if (Array.isArray(e)) {
579
- let t = Array.prototype.slice.call(e);
580
- for (let e = 0; e < t.length; e++) {
581
- if (Array.isArray(t[e])) return null;
582
- typeof t[e] == "object" && Object.prototype.toString.call(t[e]) === "[object Object]" && (t[e] = "[object Object]");
583
- }
584
- return String(t);
585
- }
586
- return typeof e == "object" && Object.prototype.toString.call(e) === "[object Object]" ? "[object Object]" : String(e);
587
- }
588
- g("tag:yaml.org,2002:map", {
589
- create: () => ({}),
590
- identify: C,
591
- represent: (e) => {
592
- let t = /* @__PURE__ */ new Map();
593
- for (let n of Object.keys(e)) t.set(n, e[n]);
594
- return t;
595
- },
596
- addPair: (e, t, n) => {
597
- let r = ot(t);
598
- return r === null ? "nested arrays are not supported inside keys" : (r === "__proto__" ? Object.defineProperty(e, r, {
599
- value: n,
600
- enumerable: !0,
601
- configurable: !0,
602
- writable: !0
603
- }) : e[r] = n, "");
604
- },
605
- has: (e, t) => {
606
- let n = ot(t);
607
- return n !== null && Object.prototype.hasOwnProperty.call(e, n);
608
- },
609
- keys: (e) => Object.keys(e),
610
- get: (e, t) => {
611
- let n = String(t);
612
- return Object.prototype.hasOwnProperty.call(e, n) ? e[n] : null;
613
- }
614
- });
615
- var st = {
616
- maxLength: 79,
617
- indent: 1,
618
- linesBefore: 3,
619
- linesAfter: 2
620
- };
621
- function ct(e, t, n, r, i) {
622
- let a = "", o = "", s = Math.floor(i / 2) - 1;
623
- return r - t > s && (a = " ... ", t = r - s + a.length), n - r > s && (o = " ...", n = r + s - o.length), {
624
- str: a + e.slice(t, n).replace(/\t/g, "→") + o,
625
- pos: r - t + a.length
626
- };
627
- }
628
- function lt(e, t) {
629
- return " ".repeat(Math.max(t - e.length, 0)) + e;
630
- }
631
- function ut(e, t) {
632
- if (!e.buffer) return null;
633
- let n = {
634
- ...st,
635
- ...t
636
- }, r = /\r?\n|\r|\0/g, i = [0], a = [], o, s = -1;
637
- for (; o = r.exec(e.buffer);) a.push(o.index), i.push(o.index + o[0].length), e.position <= o.index && s < 0 && (s = i.length - 2);
638
- s < 0 && (s = i.length - 1);
639
- let c = "", l = Math.min(e.line + n.linesAfter, a.length).toString().length, u = n.maxLength - (n.indent + l + 3);
640
- for (let t = 1; t <= n.linesBefore && !(s - t < 0); t++) {
641
- let r = ct(e.buffer, i[s - t], a[s - t], e.position - (i[s] - i[s - t]), u);
642
- c = `${" ".repeat(n.indent)}${lt((e.line - t + 1).toString(), l)} | ${r.str}\n${c}`;
643
- }
644
- let d = ct(e.buffer, i[s], a[s], e.position, u);
645
- c += `${" ".repeat(n.indent)}${lt((e.line + 1).toString(), l)} | ${d.str}\n`, c += `${"-".repeat(n.indent + l + 3 + d.pos)}^\n`;
646
- for (let t = 1; t <= n.linesAfter && !(s + t >= a.length); t++) {
647
- let r = ct(e.buffer, i[s + t], a[s + t], e.position - (i[s] - i[s + t]), u);
648
- c += `${" ".repeat(n.indent)}${lt((e.line + t + 1).toString(), l)} | ${r.str}\n`;
649
- }
650
- return c.replace(/\n$/, "");
651
- }
652
- function dt(e, t) {
653
- let n = "";
654
- return e.mark ? (e.mark.name && (n += `in "${e.mark.name}" `), n += `(${e.mark.line + 1}:${e.mark.column + 1})`, !t && e.mark.snippet && (n += `\n\n${e.mark.snippet}`), `${e.reason} ${n}`) : e.reason;
655
- }
656
- var ft = class extends Error {
657
- reason;
658
- mark;
659
- constructor(e, t) {
660
- super(), this.name = "YAMLException", this.reason = e, this.mark = t, this.message = dt(this, !1), Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
661
- }
662
- toString(e) {
663
- return `${this.name}: ${dt(this, e)}`;
664
- }
665
- };
666
- function pt(e, t, n, r = "") {
667
- let i = 0, a = 0;
668
- for (let n = 0; n < t; n++) {
669
- let t = e.charCodeAt(n);
670
- t === 10 ? (i++, a = n + 1) : t === 13 && (i++, e.charCodeAt(n + 1) === 10 && n++, a = n + 1);
671
- }
672
- let o = {
673
- name: r,
674
- buffer: e,
675
- position: t,
676
- line: i,
677
- column: t - a
678
- };
679
- throw o.snippet = ut(o), new ft(n, o);
680
- }
681
- var mt = -1;
682
- function ht(e) {
683
- switch (e) {
684
- case 48: return "\0";
685
- case 97: return "\x07";
686
- case 98: return "\b";
687
- case 116: return " ";
688
- case 9: return " ";
689
- case 110: return "\n";
690
- case 118: return "\v";
691
- case 102: return "\f";
692
- case 114: return "\r";
693
- case 101: return "\x1B";
694
- case 32: return " ";
695
- case 34: return "\"";
696
- case 47: return "/";
697
- case 92: return "\\";
698
- case 78: return "…";
699
- case 95: return "\xA0";
700
- case 76: return "\u2028";
701
- case 80: return "\u2029";
702
- default: return "";
703
- }
704
- }
705
- var gt = Array(256), _t = Array(256);
706
- for (let e = 0; e < 256; e++) gt[e] = +!!ht(e), _t[e] = ht(e);
707
- function vt(e) {
708
- return e <= 65535 ? String.fromCharCode(e) : String.fromCharCode((e - 65536 >> 10) + 55296, (e - 65536 & 1023) + 56320);
709
- }
710
- function yt(e) {
711
- return e >= 48 && e <= 57 ? e - 48 : (e | 32) - 97 + 10;
712
- }
713
- function bt(e) {
714
- return e === 120 ? 2 : e === 117 ? 4 : 8;
715
- }
716
- function xt(e, t, n) {
717
- let r = 0;
718
- for (; t < n;) {
719
- let n = e.charCodeAt(t);
720
- if (n === 10) r++, t++;
721
- else if (n === 13) r++, t++, e.charCodeAt(t) === 10 && t++;
722
- else if (n === 32 || n === 9) t++;
723
- else break;
724
- }
725
- return {
726
- position: t,
727
- breaks: r
728
- };
729
- }
730
- function St(e) {
731
- return e === 1 ? " " : "\n".repeat(e - 1);
732
- }
733
- function Ct(e, t, n) {
734
- let r = "", i = t, a = t, o = t;
735
- for (; i < n;) {
736
- let t = e.charCodeAt(i);
737
- if (t === 10 || t === 13) {
738
- r += e.slice(a, o);
739
- let t = xt(e, i, n);
740
- r += St(t.breaks), i = a = o = t.position;
741
- } else i++, t !== 32 && t !== 9 && (o = i);
742
- }
743
- return r + e.slice(a, o);
744
- }
745
- function wt(e, t, n) {
746
- let r = "", i = t, a = t, o = t;
747
- for (; i < n;) {
748
- let t = e.charCodeAt(i);
749
- if (t === 39) r += e.slice(a, i) + "'", i += 2, a = o = i;
750
- else if (t === 10 || t === 13) {
751
- r += e.slice(a, o);
752
- let t = xt(e, i, n);
753
- r += St(t.breaks), i = a = o = t.position;
754
- } else i++, t !== 32 && t !== 9 && (o = i);
755
- }
756
- return r + e.slice(a, n);
757
- }
758
- function Tt(e, t, n) {
759
- let r = "", i = t, a = t, o = t;
760
- for (; i < n;) {
761
- let t = e.charCodeAt(i);
762
- if (t === 92) {
763
- r += e.slice(a, i), i++;
764
- let t = e.charCodeAt(i);
765
- if (t === 10 || t === 13) i = xt(e, i, n).position;
766
- else if (t < 256 && gt[t]) r += _t[t], i++;
767
- else {
768
- let n = bt(t), a = 0;
769
- for (; n > 0; n--) {
770
- i++;
771
- let t = yt(e.charCodeAt(i));
772
- a = (a << 4) + t;
773
- }
774
- r += vt(a), i++;
775
- }
776
- a = o = i;
777
- } else if (t === 10 || t === 13) {
778
- r += e.slice(a, o);
779
- let t = xt(e, i, n);
780
- r += St(t.breaks), i = a = o = t.position;
781
- } else i++, t !== 32 && t !== 9 && (o = i);
782
- }
783
- return r + e.slice(a, n);
784
- }
785
- function Et(e, t, n, r, i, a) {
786
- let o = r < 0 ? 0 : r, s = e.slice(t, n).replace(/\r\n?/g, "\n"), c = s === "" ? [] : (s.endsWith("\n") ? s.slice(0, -1) : s).split("\n"), l = "", u = !1, d = 0, f = !1;
787
- for (let e of c) {
788
- let t = 0;
789
- for (; t < o && e.charCodeAt(t) === 32;) t++;
790
- if (r < 0 || t >= e.length) {
791
- d++;
792
- continue;
793
- }
794
- let n = e.slice(o), i = n.charCodeAt(0);
795
- a ? i === 32 || i === 9 ? (f = !0, l += "\n".repeat(u ? 1 + d : d)) : f ? (f = !1, l += "\n".repeat(d + 1)) : d === 0 ? u && (l += " ") : l += "\n".repeat(d) : l += "\n".repeat(u ? 1 + d : d), l += n, u = !0, d = 0;
796
- }
797
- return i === 3 ? l += "\n".repeat(u ? 1 + d : d) : i !== 2 && u && (l += "\n"), l;
798
- }
799
- function Dt(e, t) {
800
- if (t.valueStart === mt) return "";
801
- let { valueStart: n, valueEnd: r } = t;
802
- if (t.fast) return e.slice(n, r);
803
- switch (t.style) {
804
- case 2: return wt(e, n, r);
805
- case 3: return Tt(e, n, r);
806
- case 4: return Et(e, n, r, t.indent, t.chomping, !1);
807
- case 5: return Et(e, n, r, t.indent, t.chomping, !0);
808
- default: return Ct(e, n, r);
809
- }
810
- }
811
- var Ot = Object.assign(Object.create(null), {
812
- "!": "!",
813
- "!!": "tag:yaml.org,2002:"
814
- });
815
- function kt(e, t) {
816
- if (e.startsWith("!<") && e.endsWith(">")) return decodeURIComponent(e.slice(2, -1));
817
- let n = e.indexOf("!", 1), r = n === -1 ? "!" : e.slice(0, n + 1), i = t?.[r] ?? Ot[r] ?? r;
818
- return decodeURIComponent(i) + decodeURIComponent(e.slice(r.length));
819
- }
820
- var T = -1, At = {
821
- filename: "",
822
- schema: it,
823
- json: !1,
824
- maxTotalMergeKeys: 1e4,
825
- maxAliases: -1
826
- };
827
- function jt(e) {
828
- return "tagStart" in e && e.tagStart !== T ? e.tagStart : "anchorStart" in e && e.anchorStart !== T ? e.anchorStart : "valueStart" in e && e.valueStart !== T ? e.valueStart : "start" in e ? e.start : 0;
829
- }
830
- function E(e, t) {
831
- pt(e.source, e.position, t, e.filename);
832
- }
833
- function Mt(e, t, n, r) {
834
- try {
835
- return n.finalize(r);
836
- } catch (n) {
837
- if (n instanceof ft) throw n;
838
- pt(e.source, t, n instanceof Error ? n.message : String(n), e.filename);
839
- }
840
- }
841
- function Nt(e, t, n) {
842
- let r = e[n];
843
- if (r) return r;
844
- for (let e of t) if (n.startsWith(e.tagName)) return e;
845
- }
846
- function Pt(e, t, n, r, i) {
847
- let a = Nt(t, n, r);
848
- if (a) return a;
849
- E(e, `unknown ${i} tag !<${r}>`);
850
- }
851
- function Ft(e, t) {
852
- let n = Dt(e.source, t), r = t.tagStart === T ? "" : e.source.slice(t.tagStart, t.tagEnd), i = e.schema.defaultScalarTag;
853
- if (r !== "") {
854
- if (r === "!") return {
855
- value: n,
856
- tag: i
857
- };
858
- let t = kt(r, e.tagHandlers), a = Nt(e.schema.exact.scalar, e.schema.prefix.scalar, t);
859
- if (a) {
860
- let r = a.resolve(n, !0, t);
861
- return r === f && E(e, `cannot resolve a node with !<${t}> explicit tag`), {
862
- value: r,
863
- tag: a
864
- };
865
- }
866
- let o = Nt(e.schema.exact.mapping, e.schema.prefix.mapping, t) ?? Nt(e.schema.exact.sequence, e.schema.prefix.sequence, t);
867
- if (o) {
868
- n !== "" && E(e, `cannot resolve a node with !<${t}> explicit tag`);
869
- let r = o.create(t);
870
- return {
871
- value: o.carrierIsResult ? r : Mt(e, e.position, o, r),
872
- tag: o
873
- };
874
- }
875
- E(e, `unknown scalar tag !<${t}>`);
876
- }
877
- if (t.style === 1) {
878
- let t = e.schema.implicitScalarByFirstChar.get(n.charAt(0)) ?? e.schema.implicitScalarAnyFirstChar;
879
- for (let e of t) {
880
- let t = e.resolve(n, !1, e.tagName);
881
- if (t !== f) return {
882
- value: t,
883
- tag: e
884
- };
885
- }
886
- }
887
- return {
888
- value: i.resolve(n, !1, i.tagName),
889
- tag: i
890
- };
891
- }
892
- function It(e, t, n, r, i, a) {
893
- let o = t.tagStart === T ? "" : e.source.slice(t.tagStart, t.tagEnd), s = o === "" || o === "!" ? i : kt(o, e.tagHandlers);
894
- return {
895
- tagName: s,
896
- tag: Pt(e, n, r, s, a)
897
- };
898
- }
899
- function Lt(e) {
900
- return e.nodeKind === "mapping";
901
- }
902
- function Rt(e, t, n, r) {
903
- for (let i of r.keys(n)) {
904
- if (e.maxTotalMergeKeys !== -1 && ++e.totalMergeKeys > e.maxTotalMergeKeys && E(e, `merge keys exceeded maxTotalMergeKeys (${e.maxTotalMergeKeys})`), t.tag.has(t.value, i)) continue;
905
- let a = t.tag.addPair(t.value, i, r.get(n, i));
906
- a && E(e, a), (t.overridable ??= /* @__PURE__ */ new Set()).add(i);
907
- }
908
- }
909
- function zt(e, t, n, r) {
910
- if (e.position = t.keyPosition, Lt(r)) Rt(e, t, n, r);
911
- else if (r.nodeKind === "sequence" && Array.isArray(n)) for (let r of n) Rt(e, t, r, t.tag);
912
- else E(e, "cannot merge mappings; the provided source object is unacceptable");
913
- }
914
- function Bt(e, t, n, r, i) {
915
- if (e.position = t.keyPosition, n === p) {
916
- zt(e, t, r, i);
917
- return;
918
- }
919
- !e.json && t.tag.has(t.value, n) && !t.overridable?.has(n) && E(e, "duplicated mapping key");
920
- let a = t.tag.addPair(t.value, n, r);
921
- a && E(e, a), t.overridable?.delete(n);
922
- }
923
- function Vt(e, t, n) {
924
- let r = e.frames[e.frames.length - 1];
925
- if (r.kind === "document") r.value = t, r.hasValue = !0;
926
- else if (r.kind === "sequence") {
927
- r.merge && (Lt(n) || E(e, "cannot merge mappings; the provided source object is unacceptable"));
928
- let i = r.tag.addItem(r.value, t, r.index++);
929
- i && E(e, i);
930
- } else if (r.hasKey) {
931
- let i = r.key;
932
- r.key = void 0, r.hasKey = !1, Bt(e, r, i, t, n);
933
- } else r.key = t, r.keyPosition = e.position, r.hasKey = !0;
934
- }
935
- function Ht(e, t, n, r, i) {
936
- if (t.anchorStart !== T) {
937
- let a = {
938
- value: n,
939
- tag: r,
940
- isValueFinal: i
941
- };
942
- return e.anchors.set(e.source.slice(t.anchorStart, t.anchorEnd), a), a;
943
- }
944
- return null;
945
- }
946
- function Ut(e, t) {
947
- let n = {
948
- ...At,
949
- ...t,
950
- events: e,
951
- documents: [],
952
- eventIndex: 0,
953
- position: 0,
954
- frames: [],
955
- anchors: /* @__PURE__ */ new Map(),
956
- tagHandlers: Object.create(null),
957
- totalMergeKeys: 0,
958
- aliasCount: 0
959
- };
960
- for (; n.eventIndex < n.events.length;) {
961
- let e = n.events[n.eventIndex++];
962
- switch (n.position = jt(e), e.type) {
963
- case 1:
964
- n.anchors = /* @__PURE__ */ new Map(), n.aliasCount = 0, n.tagHandlers = Object.create(null);
965
- for (let t of e.directives) t.kind === "tag" && (n.tagHandlers[t.handle] = t.prefix);
966
- n.frames.push({
967
- kind: "document",
968
- position: n.position,
969
- value: void 0,
970
- hasValue: !1
971
- });
972
- break;
973
- case 4: {
974
- let { value: t, tag: r } = Ft(n, e);
975
- Ht(n, e, t, r, !0), Vt(n, t, r);
976
- break;
977
- }
978
- case 2: {
979
- let t = It(n, e, n.schema.exact.sequence, n.schema.prefix.sequence, "tag:yaml.org,2002:seq", "sequence"), r = t.tag.create(t.tagName), i = Ht(n, e, r, t.tag, t.tag.carrierIsResult), a = n.frames[n.frames.length - 1], o = a !== void 0 && a.kind === "mapping" && a.hasKey && a.key === p;
980
- n.frames.push({
981
- kind: "sequence",
982
- position: n.position,
983
- value: r,
984
- tag: t.tag,
985
- anchor: i,
986
- index: 0,
987
- merge: o
988
- });
989
- break;
990
- }
991
- case 3: {
992
- let t = It(n, e, n.schema.exact.mapping, n.schema.prefix.mapping, "tag:yaml.org,2002:map", "mapping"), r = t.tag.create(t.tagName), i = Ht(n, e, r, t.tag, t.tag.carrierIsResult);
993
- n.frames.push({
994
- kind: "mapping",
995
- position: n.position,
996
- value: r,
997
- tag: t.tag,
998
- anchor: i,
999
- key: void 0,
1000
- keyPosition: n.position,
1001
- hasKey: !1,
1002
- overridable: null
1003
- });
1004
- break;
1005
- }
1006
- case 5: {
1007
- n.maxAliases !== -1 && ++n.aliasCount > n.maxAliases && E(n, `aliases exceeded maxAliases (${n.maxAliases})`);
1008
- let t = n.source.slice(e.anchorStart, e.anchorEnd), r = n.anchors.get(t);
1009
- r || E(n, `unidentified alias "${t}"`), r.isValueFinal || E(n, `recursive alias "${t}" is not supported for tag ${r.tag.tagName} because it uses finalize()`), Vt(n, r.value, r.tag);
1010
- break;
1011
- }
1012
- case 6: {
1013
- let e = n.frames.pop();
1014
- if (e.kind === "mapping" && e.hasKey && (n.position = e.keyPosition, E(n, "incomplete mapping pair in event stream")), e.kind === "document") n.documents.push(e.value);
1015
- else {
1016
- let t = e.tag.carrierIsResult ? e.value : Mt(n, e.position, e.tag, e.value);
1017
- e.anchor && (e.anchor.value = t, e.anchor.isValueFinal = !0), Vt(n, t, e.tag);
1018
- }
1019
- break;
1020
- }
1021
- }
1022
- }
1023
- return n.documents;
1024
- }
1025
- var D = -1, Wt = Object.prototype.hasOwnProperty, O = 1, Gt = 2, Kt = 3, k = 4, qt = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, Jt = /[,\[\]{}]/, Yt = /^(?:!|!!|![0-9A-Za-z-]+!)$/, Xt = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`, Zt = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`, Qt = RegExp(`^(?:${Xt})*$`), $t = RegExp(`^(?:${Zt})+$`), en = RegExp(`^(?:!(?:${Xt})*|${Zt}(?:${Xt})*)$`), tn = {
1026
- filename: "",
1027
- maxDepth: 100
1028
- };
1029
- function nn(e, t, n) {
1030
- e.events.push({
1031
- type: 1,
1032
- explicitStart: t,
1033
- explicitEnd: n,
1034
- directives: e.directives
1035
- });
1036
- }
1037
- function rn(e, t, n, r, i, a, o) {
1038
- e.events.push({
1039
- type: 2,
1040
- start: t,
1041
- anchorStart: n,
1042
- anchorEnd: r,
1043
- tagStart: i,
1044
- tagEnd: a,
1045
- style: o
1046
- });
1047
- }
1048
- function an(e, t, n, r, i, a, o) {
1049
- e.events.push({
1050
- type: 3,
1051
- start: t,
1052
- anchorStart: n,
1053
- anchorEnd: r,
1054
- tagStart: i,
1055
- tagEnd: a,
1056
- style: o
1057
- });
1058
- }
1059
- function on(e, t) {
1060
- e.events.splice(t.eventsLength, 0, {
1061
- type: 3,
1062
- start: t.position,
1063
- anchorStart: D,
1064
- anchorEnd: D,
1065
- tagStart: D,
1066
- tagEnd: D,
1067
- style: 2
1068
- });
1069
- }
1070
- function A(e, t, n, r, i, a, o, s, c = 1, l = -1, u = !1) {
1071
- e.events.push({
1072
- type: 4,
1073
- valueStart: t,
1074
- valueEnd: n,
1075
- anchorStart: r,
1076
- anchorEnd: i,
1077
- tagStart: a,
1078
- tagEnd: o,
1079
- style: s,
1080
- chomping: c,
1081
- indent: l,
1082
- fast: u
1083
- });
1084
- }
1085
- function sn(e, t, n) {
1086
- e.events.push({
1087
- type: 5,
1088
- anchorStart: t,
1089
- anchorEnd: n
1090
- });
1091
- }
1092
- function j(e) {
1093
- e.events.push({ type: 6 });
1094
- }
1095
- function M(e) {
1096
- A(e, D, D, D, D, D, D, 1);
1097
- }
1098
- function cn() {
1099
- return {
1100
- anchorStart: D,
1101
- anchorEnd: D,
1102
- tagStart: D,
1103
- tagEnd: D
1104
- };
1105
- }
1106
- function N(e) {
1107
- return {
1108
- position: e.position,
1109
- line: e.line,
1110
- lineStart: e.lineStart,
1111
- lineIndent: e.lineIndent,
1112
- firstTabInLine: e.firstTabInLine,
1113
- eventsLength: e.events.length
1114
- };
1115
- }
1116
- function P(e, t) {
1117
- e.position = t.position, e.line = t.line, e.lineStart = t.lineStart, e.lineIndent = t.lineIndent, e.firstTabInLine = t.firstTabInLine, e.events.length = t.eventsLength;
1118
- }
1119
- function F(e, t) {
1120
- pt(e.input.slice(0, e.length), e.position, t, e.filename);
1121
- }
1122
- function I(e) {
1123
- return e === 10 || e === 13;
1124
- }
1125
- function L(e) {
1126
- return e === 9 || e === 32;
1127
- }
1128
- function R(e) {
1129
- return L(e) || I(e);
1130
- }
1131
- function z(e) {
1132
- return e === 0 || R(e);
1133
- }
1134
- function B(e) {
1135
- return e === 44 || e === 91 || e === 93 || e === 123 || e === 125;
1136
- }
1137
- function ln(e) {
1138
- return e >= 48 && e <= 57 ? e - 48 : -1;
1139
- }
1140
- function un(e) {
1141
- if (e >= 48 && e <= 57) return e - 48;
1142
- let t = e | 32;
1143
- return t >= 97 && t <= 102 ? t - 97 + 10 : -1;
1144
- }
1145
- function dn(e) {
1146
- return e === 120 ? 2 : e === 117 ? 4 : e === 85 ? 8 : 0;
1147
- }
1148
- function fn(e) {
1149
- return e === 48 || e === 97 || e === 98 || e === 116 || e === 9 || e === 110 || e === 118 || e === 102 || e === 114 || e === 101 || e === 32 || e === 34 || e === 47 || e === 92 || e === 78 || e === 95 || e === 76 || e === 80;
1150
- }
1151
- function pn(e) {
1152
- e.input.charCodeAt(e.position) === 10 ? e.position++ : (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++), e.line++, e.lineStart = e.position, e.lineIndent = 0, e.firstTabInLine = -1;
1153
- }
1154
- function V(e, t) {
1155
- let n = 0, r = e.input.charCodeAt(e.position), i = e.position === e.lineStart || R(e.input.charCodeAt(e.position - 1));
1156
- for (; r !== 0;) {
1157
- for (; L(r);) i = !0, r === 9 && e.firstTabInLine === -1 && (e.firstTabInLine = e.position), r = e.input.charCodeAt(++e.position);
1158
- if (t && i && r === 35) do
1159
- r = e.input.charCodeAt(++e.position);
1160
- while (!I(r) && r !== 0);
1161
- if (!I(r)) break;
1162
- for (pn(e), n++, i = !0, r = e.input.charCodeAt(e.position); r === 32;) e.lineIndent++, r = e.input.charCodeAt(++e.position);
1163
- }
1164
- return n;
1165
- }
1166
- function H(e, t = e.position) {
1167
- let n = e.input.charCodeAt(t);
1168
- if ((n === 45 || n === 46) && n === e.input.charCodeAt(t + 1) && n === e.input.charCodeAt(t + 2)) {
1169
- let n = e.input.charCodeAt(t + 3);
1170
- return n === 0 || R(n);
1171
- }
1172
- return !1;
1173
- }
1174
- function mn(e) {
1175
- let t = e.input.charCodeAt(e.position);
1176
- for (; t !== 0 && !I(t);) t = e.input.charCodeAt(++e.position);
1177
- }
1178
- function hn(e, t, n) {
1179
- qt.test(e.input.slice(t, n)) && F(e, "the stream contains non-printable characters");
1180
- }
1181
- function gn(e, t, n) {
1182
- if (e.input.charCodeAt(e.position) !== 33) return !1;
1183
- t.tagStart !== D && F(e, "duplication of a tag property");
1184
- let r = e.position, i = !1, a = !1, o = "!", s = e.input.charCodeAt(++e.position);
1185
- s === 60 ? (i = !0, s = e.input.charCodeAt(++e.position)) : s === 33 && (a = !0, o = "!!", s = e.input.charCodeAt(++e.position));
1186
- let c = e.position, l;
1187
- if (i) {
1188
- for (; s !== 0 && s !== 62;) s = e.input.charCodeAt(++e.position);
1189
- s !== 62 && F(e, "unexpected end of the stream within a verbatim tag"), l = e.input.slice(c, e.position), e.position++;
1190
- } else {
1191
- for (; s !== 0 && !R(s) && !(n && B(s));) s === 33 && (a ? F(e, "tag suffix cannot contain exclamation marks") : (o = e.input.slice(c - 1, e.position + 1), Yt.test(o) || F(e, "named tag handle cannot contain such characters"), a = !0, c = e.position + 1)), s = e.input.charCodeAt(++e.position);
1192
- l = e.input.slice(c, e.position), Jt.test(l) && F(e, "tag suffix cannot contain flow indicator characters");
1193
- }
1194
- return l && !(i ? Qt.test(l) : $t.test(l)) && F(e, `tag name cannot contain such characters: ${l}`), !i && o !== "!" && o !== "!!" && !Wt.call(e.tagHandlers, o) && F(e, `undeclared tag handle "${o}"`), t.tagStart = r, t.tagEnd = e.position, !0;
1195
- }
1196
- function _n(e, t) {
1197
- if (e.input.charCodeAt(e.position) !== 38) return !1;
1198
- t.anchorStart !== D && F(e, "duplication of an anchor property"), e.position++;
1199
- let n = e.position;
1200
- for (; e.input.charCodeAt(e.position) !== 0 && !R(e.input.charCodeAt(e.position)) && !B(e.input.charCodeAt(e.position));) e.position++;
1201
- return e.position === n && F(e, "name of an anchor node must contain at least one character"), t.anchorStart = n, t.anchorEnd = e.position, !0;
1202
- }
1203
- function vn(e, t) {
1204
- if (e.input.charCodeAt(e.position) !== 42) return !1;
1205
- (t.anchorStart !== D || t.tagStart !== D) && F(e, "alias node should not have any properties"), e.position++;
1206
- let n = e.position;
1207
- for (; e.input.charCodeAt(e.position) !== 0 && !R(e.input.charCodeAt(e.position)) && !B(e.input.charCodeAt(e.position));) e.position++;
1208
- return e.position === n && F(e, "name of an alias node must contain at least one character"), sn(e, n, e.position), !0;
1209
- }
1210
- function yn(e, t) {
1211
- V(e, !1), e.lineIndent < t && F(e, "deficient indentation");
1212
- }
1213
- function bn(e, t, n) {
1214
- if (e.input.charCodeAt(e.position) !== 39) return !1;
1215
- e.position++;
1216
- let r = e.position, i = !0;
1217
- for (; e.input.charCodeAt(e.position) !== 0;) {
1218
- let a = e.input.charCodeAt(e.position);
1219
- if (a === 39) {
1220
- if (e.input.charCodeAt(e.position + 1) === 39) {
1221
- i = !1, e.position += 2;
1222
- continue;
1223
- }
1224
- let t = e.position;
1225
- return e.position++, A(e, r, t, n.anchorStart, n.anchorEnd, n.tagStart, n.tagEnd, 2, 1, -1, i), !0;
1226
- }
1227
- I(a) ? (i = !1, yn(e, t)) : e.position === e.lineStart && H(e) ? F(e, "unexpected end of the document within a single quoted scalar") : a !== 9 && a < 32 ? F(e, "expected valid JSON character") : e.position++;
1228
- }
1229
- F(e, "unexpected end of the stream within a single quoted scalar");
1230
- }
1231
- function xn(e, t, n) {
1232
- if (e.input.charCodeAt(e.position) !== 34) return !1;
1233
- e.position++;
1234
- let r = e.position, i = !0;
1235
- for (; e.input.charCodeAt(e.position) !== 0;) {
1236
- let a = e.input.charCodeAt(e.position);
1237
- if (a === 34) {
1238
- let t = e.position;
1239
- return e.position++, A(e, r, t, n.anchorStart, n.anchorEnd, n.tagStart, n.tagEnd, 3, 1, -1, i), !0;
1240
- }
1241
- if (a === 92) {
1242
- i = !1;
1243
- let n = e.input.charCodeAt(++e.position);
1244
- if (I(n)) yn(e, t);
1245
- else if (fn(n)) e.position++;
1246
- else {
1247
- let t = dn(n);
1248
- for (t === 0 && F(e, "unknown escape sequence"); t-- > 0;) e.position++, un(e.input.charCodeAt(e.position)) < 0 && F(e, "expected hexadecimal character");
1249
- e.position++;
1250
- }
1251
- } else I(a) ? (i = !1, yn(e, t)) : e.position === e.lineStart && H(e) ? F(e, "unexpected end of the document within a double quoted scalar") : a !== 9 && a < 32 ? F(e, "expected valid JSON character") : e.position++;
1252
- }
1253
- F(e, "unexpected end of the stream within a double quoted scalar");
1254
- }
1255
- function Sn(e, t, n) {
1256
- let r = e.input.charCodeAt(e.position), i = 1, a = -1, o = !1;
1257
- if (r !== 124 && r !== 62) return !1;
1258
- let s = r === 124 ? 4 : 5;
1259
- for (e.position++; e.input.charCodeAt(e.position) !== 0;) {
1260
- let n = e.input.charCodeAt(e.position), r = ln(n);
1261
- if (n === 43 || n === 45) i !== 1 && F(e, "repeat of a chomping mode identifier"), i = n === 43 ? 3 : 2, e.position++;
1262
- else if (r >= 0) r === 0 && F(e, "bad explicit indentation width of a block scalar; it cannot be less than one"), o && F(e, "repeat of an indentation width identifier"), a = t + r - 1, o = !0, e.position++;
1263
- else break;
1264
- }
1265
- let c = !1;
1266
- for (; L(e.input.charCodeAt(e.position));) c = !0, e.position++;
1267
- c && e.input.charCodeAt(e.position) === 35 && mn(e), I(e.input.charCodeAt(e.position)) ? pn(e) : e.input.charCodeAt(e.position) !== 0 && F(e, "a line break is expected");
1268
- let l = o ? a : -1, u = 0, d = e.position, f = e.position;
1269
- for (; e.input.charCodeAt(e.position) !== 0;) {
1270
- let n = e.position, r = 0;
1271
- for (; e.input.charCodeAt(n + r) === 32;) r++;
1272
- let i = e.input.charCodeAt(n + r);
1273
- if (i === 0) {
1274
- l >= 0 ? r > l && (f = n + r) : r > 0 && (f = n + r);
1275
- break;
1276
- }
1277
- if (n === e.lineStart && H(e, n)) break;
1278
- if (!o && l === -1 && I(i) && (u = Math.max(u, r)), !o && l === -1 && !I(i) && (i === 9 && r < t && (e.position = n + r, F(e, "tab characters must not be used in indentation")), r < u && (e.position = n + r, F(e, "bad indentation of a mapping entry"))), l === -1 && i !== 0 && !I(i) && r < t) {
1279
- e.lineIndent = r, e.position = n + r;
1280
- break;
1281
- }
1282
- !o && i !== 0 && !I(i) && l === -1 && (l = r);
1283
- let a = l === -1 ? t + 1 : l;
1284
- if (i !== 0 && !I(i) && r < a) {
1285
- e.lineIndent = r, e.position = n + r;
1286
- break;
1287
- }
1288
- mn(e), f = e.position, I(e.input.charCodeAt(e.position)) && (pn(e), f = e.position);
1289
- }
1290
- return hn(e, d, f), A(e, d, f, n.anchorStart, n.anchorEnd, n.tagStart, n.tagEnd, s, i, l), !0;
1291
- }
1292
- function Cn(e, t) {
1293
- let n = e.input.charCodeAt(e.position), r = t === O;
1294
- if (n === 0 || R(n) || n === 35 || n === 38 || n === 42 || n === 33 || n === 124 || n === 62 || n === 39 || n === 34 || n === 37 || n === 64 || n === 96 || r && B(n)) return !1;
1295
- if (n === 63 || n === 45) {
1296
- let t = e.input.charCodeAt(e.position + 1);
1297
- if (z(t) || r && B(t)) return !1;
1298
- }
1299
- return !0;
1300
- }
1301
- function wn(e, t, n, r) {
1302
- if (!Cn(e, n)) return !1;
1303
- let i = e.position, a = e.position, o = e.input.charCodeAt(e.position), s = n === O, c = !1;
1304
- for (; o !== 0 && !(e.position === e.lineStart && H(e));) {
1305
- if (o === 58) {
1306
- let t = e.input.charCodeAt(e.position + 1);
1307
- if (z(t) || s && B(t)) break;
1308
- } else if (o === 35) {
1309
- if (R(e.input.charCodeAt(e.position - 1))) break;
1310
- } else if (s && B(o)) break;
1311
- else if (I(o)) {
1312
- let n = e.position, r = e.line, i = e.lineStart, a = e.lineIndent;
1313
- if (V(e, !1), e.lineIndent >= t) {
1314
- c = !0, o = e.input.charCodeAt(e.position);
1315
- continue;
1316
- }
1317
- e.position = n, e.line = r, e.lineStart = i, e.lineIndent = a;
1318
- break;
1319
- }
1320
- L(o) || (a = e.position + 1), o = e.input.charCodeAt(++e.position);
1321
- }
1322
- return a === i ? !1 : (hn(e, i, a), A(e, i, a, r.anchorStart, r.anchorEnd, r.tagStart, r.tagEnd, 1, 1, -1, !c), !0);
1323
- }
1324
- function U(e, t) {
1325
- let n = e.line;
1326
- V(e, !0), (e.line > n && e.lineIndent < t || e.firstTabInLine !== -1 && e.lineIndent < t) && F(e, "deficient indentation");
1327
- }
1328
- function Tn(e, t, n) {
1329
- let r = e.input.charCodeAt(e.position), i = r === 123, a = e.position, o = !0;
1330
- if (r !== 91 && r !== 123) return !1;
1331
- let s = i ? 125 : 93;
1332
- for (i ? an(e, a, n.anchorStart, n.anchorEnd, n.tagStart, n.tagEnd, 2) : rn(e, a, n.anchorStart, n.anchorEnd, n.tagStart, n.tagEnd, 2), e.position++; e.input.charCodeAt(e.position) !== 0;) {
1333
- U(e, t);
1334
- let n = e.input.charCodeAt(e.position);
1335
- if (n === s) return e.position++, j(e), !0;
1336
- o ? n === 44 && F(e, "expected the node content, but found ','") : F(e, "missed comma between flow collection entries");
1337
- let r = !1, a = !1;
1338
- n === 63 && R(e.input.charCodeAt(e.position + 1)) && (r = a = !0, e.position += 1, U(e, t));
1339
- let c = e.line, l = N(e), u = W(e, t, O, !1, !0);
1340
- U(e, t), n = e.input.charCodeAt(e.position), (i || a || e.line === c) && n === 58 ? (r = !0, e.position++, U(e, t), i || on(e, l), u || M(e), W(e, t, O, !1, !0) || M(e), U(e, t), i || j(e)) : i && r ? (u || M(e), M(e)) : i ? M(e) : r && (on(e, l), u || M(e), M(e), j(e)), n = e.input.charCodeAt(e.position), n === 44 ? (o = !0, e.position++) : o = !1;
1341
- }
1342
- F(e, "unexpected end of the stream within a flow collection");
1343
- }
1344
- function En(e, t, n) {
1345
- if (e.firstTabInLine !== -1 || e.input.charCodeAt(e.position) !== 45 || !z(e.input.charCodeAt(e.position + 1))) return !1;
1346
- for (rn(e, e.position, n.anchorStart, n.anchorEnd, n.tagStart, n.tagEnd, 1); e.input.charCodeAt(e.position) === 45 && z(e.input.charCodeAt(e.position + 1));) {
1347
- e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, F(e, "tab characters must not be used in indentation"));
1348
- let n = e.line;
1349
- e.position++;
1350
- let r = V(e, !0) > 0;
1351
- if (e.firstTabInLine !== -1 && e.input.charCodeAt(e.position) === 45 && z(e.input.charCodeAt(e.position + 1)) && F(e, "bad indentation of a sequence entry"), r && e.lineIndent <= t ? M(e) : W(e, t, Kt, !1, !0), V(e, !0), e.lineIndent < t || e.position >= e.length) break;
1352
- e.lineIndent > t && F(e, "bad indentation of a sequence entry"), e.line === n && e.input.charCodeAt(e.position) === 45 && z(e.input.charCodeAt(e.position + 1)) && F(e, "bad indentation of a sequence entry");
1353
- }
1354
- return j(e), !0;
1355
- }
1356
- function Dn(e, t, n, r) {
1357
- let i = !1, a = !1, o = !1, s = !1;
1358
- if (e.firstTabInLine !== -1) return !1;
1359
- let c = e.input.charCodeAt(e.position);
1360
- for (; c !== 0;) {
1361
- !i && e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, F(e, "tab characters must not be used in indentation"));
1362
- let l = e.input.charCodeAt(e.position + 1), u = e.line;
1363
- if ((c === 63 || c === 58) && z(l)) o ||= (an(e, e.position, r.anchorStart, r.anchorEnd, r.tagStart, r.tagEnd, 1), !0), c === 63 ? (i && M(e), a = !0, i = !0) : i ? i = !1 : (M(e), a = !0, i = !1), e.position += 1, s = !0;
1364
- else {
1365
- i &&= (M(e), !1);
1366
- let t = N(e);
1367
- if (!W(e, n, Gt, !1, !0)) break;
1368
- if (e.line === u) {
1369
- for (c = e.input.charCodeAt(e.position); L(c);) c = e.input.charCodeAt(++e.position);
1370
- if (c === 58) {
1371
- if (c = e.input.charCodeAt(++e.position), z(c) || F(e, "a whitespace character is expected after the key-value separator within a block mapping"), !o) {
1372
- for (P(e, t), an(e, t.position, r.anchorStart, r.anchorEnd, r.tagStart, r.tagEnd, 1), o = !0, W(e, n, Gt, !1, !0), c = e.input.charCodeAt(e.position); L(c);) c = e.input.charCodeAt(++e.position);
1373
- e.position++;
1374
- }
1375
- a = !0, i = !1, s = !1;
1376
- } else if (a) F(e, "expected ':' after a mapping key");
1377
- else return r.anchorStart !== D || r.tagStart !== D ? (P(e, t), !1) : !0;
1378
- } else if (a) F(e, "can not read a block mapping entry; a multiline key may not be an implicit key");
1379
- else return r.anchorStart !== D || r.tagStart !== D ? (P(e, t), !1) : !0;
1380
- }
1381
- if (W(e, t, k, !0, s) && (s = !1), i || (s &&= (M(e), !1)), V(e, !0), c = e.input.charCodeAt(e.position), (e.line === u || e.lineIndent > t) && c !== 0) F(e, "bad indentation of a mapping entry");
1382
- else if (e.lineIndent < t) break;
1383
- }
1384
- return a ? (i && M(e), o && j(e), !0) : !1;
1385
- }
1386
- function W(e, t, n, r, i, a = !0) {
1387
- e.depth >= e.maxDepth && F(e, `nesting exceeded maxDepth (${e.maxDepth})`), e.depth++;
1388
- let o = 1, s = !1, c = !1, l = null, u = cn(), d = n === k || n === Kt, f = d, p = d;
1389
- if (r && V(e, !0) && (s = !0, o = e.lineIndent > t ? 1 : e.lineIndent === t ? 0 : -1), o === 1) for (;;) {
1390
- let r = e.input.charCodeAt(e.position), i = N(e);
1391
- if (s && o !== 1 && (r === 33 || r === 38)) break;
1392
- if (s && p && (u.tagStart !== D || u.anchorStart !== D) && (r === 33 || r === 38)) {
1393
- let n = N(e), r = t + 1;
1394
- if (Dn(e, e.position - e.lineStart, r, u) && e.events[n.eventsLength]?.type === 3) return e.depth--, !0;
1395
- P(e, n);
1396
- }
1397
- if (s && (r === 33 && u.tagStart !== D || r === 38 && u.anchorStart !== D) || !gn(e, u, n === O) && !_n(e, u)) break;
1398
- l === null && (l = i), V(e, !0) ? (s = !0, f = p, o = e.lineIndent > t ? 1 : e.lineIndent === t ? 0 : -1) : f = !1;
1399
- }
1400
- if (f &&= s || i, o === 1 || n === k) {
1401
- let r = n === O || n === Gt ? t : t + 1, i = e.position - e.lineStart;
1402
- if (o === 1) if (f && (En(e, i, u) || Dn(e, i, r, u)) || Tn(e, r, u)) c = !0;
1403
- else {
1404
- let t = e.input.charCodeAt(e.position);
1405
- if (l !== null && a && p && !f && t !== 124 && t !== 62) {
1406
- let t = N(e), n = l.position - l.lineStart;
1407
- P(e, l), Dn(e, n, r, cn()) && e.events[t.eventsLength]?.type === 3 ? c = !0 : P(e, t);
1408
- }
1409
- !c && (d && Sn(e, r, u) || bn(e, r, u) || xn(e, r, u) || vn(e, u) || wn(e, r, n, u)) && (c = !0);
1410
- }
1411
- else o === 0 && (c = f && En(e, i, u));
1412
- }
1413
- return d &&= !c, !c && (u.anchorStart !== D || u.tagStart !== D || d) && (A(e, D, D, u.anchorStart, u.anchorEnd, u.tagStart, u.tagEnd, 1), c = !0), e.depth--, c || u.anchorStart !== D || u.tagStart !== D;
1414
- }
1415
- function On(e) {
1416
- if (e.lineIndent > 0 || e.input.charCodeAt(e.position) !== 37) return !1;
1417
- e.position++;
1418
- let t = e.position;
1419
- for (; e.input.charCodeAt(e.position) !== 0 && !R(e.input.charCodeAt(e.position));) e.position++;
1420
- let n = e.input.slice(t, e.position), r = [];
1421
- for (n.length === 0 && F(e, "directive name must not be less than one character in length"); e.input.charCodeAt(e.position) !== 0 && !I(e.input.charCodeAt(e.position));) {
1422
- for (; L(e.input.charCodeAt(e.position));) e.position++;
1423
- if (e.input.charCodeAt(e.position) === 35 || I(e.input.charCodeAt(e.position)) || e.input.charCodeAt(e.position) === 0) break;
1424
- let t = e.position;
1425
- for (; e.input.charCodeAt(e.position) !== 0 && !R(e.input.charCodeAt(e.position));) e.position++;
1426
- r.push(e.input.slice(t, e.position));
1427
- }
1428
- if (I(e.input.charCodeAt(e.position)) && pn(e), n === "YAML") {
1429
- e.directives.some((e) => e.kind === "yaml") && F(e, "duplication of %YAML directive"), r.length !== 1 && F(e, "YAML directive accepts exactly one argument");
1430
- let t = /^([0-9]+)\.([0-9]+)$/.exec(r[0]);
1431
- t === null && F(e, "ill-formed argument of the YAML directive"), parseInt(t[1], 10) !== 1 && F(e, "unacceptable YAML version of the document"), e.directives.push({
1432
- kind: "yaml",
1433
- version: r[0]
1434
- });
1435
- } else if (n === "TAG") {
1436
- r.length !== 2 && F(e, "TAG directive accepts exactly two arguments");
1437
- let [t, n] = r;
1438
- Yt.test(t) || F(e, "ill-formed tag handle (first argument) of the TAG directive"), Wt.call(e.tagHandlers, t) && F(e, `there is a previously declared suffix for "${t}" tag handle`), en.test(n) || F(e, "ill-formed tag prefix (second argument) of the TAG directive"), e.tagHandlers[t] = n, e.directives.push({
1439
- kind: "tag",
1440
- handle: t,
1441
- prefix: n
1442
- });
1443
- }
1444
- return !0;
1445
- }
1446
- function kn(e) {
1447
- e.directives = [], e.tagHandlers = Object.create(null);
1448
- let t = !1;
1449
- for (V(e, !0); On(e);) t = !0, V(e, !0);
1450
- let n = !1, r = !1, i = !0;
1451
- if (e.lineIndent === 0 && e.input.charCodeAt(e.position) === 45 && e.input.charCodeAt(e.position + 1) === 45 && e.input.charCodeAt(e.position + 2) === 45 && z(e.input.charCodeAt(e.position + 3))) {
1452
- n = !0;
1453
- let t = e.line;
1454
- e.position += 3, V(e, !0), i = e.line > t;
1455
- } else t && F(e, "directives end mark is expected");
1456
- let a = e.events.length;
1457
- if (!n && e.position === e.lineStart && e.input.charCodeAt(e.position) === 46 && H(e)) {
1458
- e.position += 3, V(e, !0);
1459
- return;
1460
- }
1461
- if (nn(e, n, !1), W(e, e.lineIndent - 1, k, !1, i, i) || M(e), V(e, !0), e.position === e.lineStart && H(e) && (r = e.input.charCodeAt(e.position) === 46, r)) {
1462
- let t = e.line;
1463
- e.position += 3, V(e, !0), e.line === t && e.position < e.length && F(e, "end of the stream or a document separator is expected");
1464
- }
1465
- let o = e.events[a];
1466
- o?.type === 1 && (o.explicitEnd = r), j(e), !r && e.position < e.length && !(e.position === e.lineStart && H(e)) && F(e, "end of the stream or a document separator is expected");
1467
- }
1468
- function An(e, t) {
1469
- let n = e.length, r = {
1470
- ...tn,
1471
- ...t,
1472
- input: `${e}\0`,
1473
- length: n,
1474
- position: 0,
1475
- line: 0,
1476
- lineStart: 0,
1477
- lineIndent: 0,
1478
- firstTabInLine: -1,
1479
- depth: 0,
1480
- directives: [],
1481
- tagHandlers: Object.create(null),
1482
- events: []
1483
- }, i = e.indexOf("\0");
1484
- for (i !== -1 && pt(e, i, "null byte is not allowed in input", r.filename), r.input.charCodeAt(r.position) === 65279 && r.position++; r.position < r.length && (V(r, !0), !(r.position >= r.length));) {
1485
- let e = r.position;
1486
- kn(r), r.position === e && F(r, "can not read a document");
1487
- }
1488
- return r.events;
1489
- }
1490
- var jn = {
1491
- ...tn,
1492
- ...At
1493
- };
1494
- function Mn(e, t = {}) {
1495
- let n = {
1496
- ...jn,
1497
- ...t
1498
- }, r = String(e), i = Object.keys(tn), a = Object.keys(At);
1499
- return Ut(An(r, Ye(n, i)), {
1500
- ...Ye(n, a),
1501
- source: r
1502
- });
1503
- }
1504
- function Nn(e, t) {
1505
- let n = Mn(e, t);
1506
- if (n.length === 0) throw new ft("expected a document, but the input is empty");
1507
- if (n.length === 1) return n[0];
1508
- throw new ft("expected a single document in the stream, but found more");
1509
- }
1510
- var G = {};
1511
- G[0] = "\\0", G[7] = "\\a", G[8] = "\\b", G[9] = "\\t", G[10] = "\\n", G[11] = "\\v", G[12] = "\\f", G[13] = "\\r", G[27] = "\\e", G[34] = "\\\"", G[92] = "\\\\", G[133] = "\\N", G[160] = "\\_", G[8232] = "\\L", G[8233] = "\\P";
1512
- var Pn = {
1513
- indent: 2,
1514
- seqNoIndent: !1,
1515
- seqInlineFirst: !0,
1516
- sortKeys: !1,
1517
- lineWidth: 80,
1518
- flowBracketPadding: !1,
1519
- flowSkipCommaSpace: !1,
1520
- flowSkipColonSpace: !1,
1521
- quoteFlowKeys: !1,
1522
- quoteStyle: "single",
1523
- forceQuotes: !1,
1524
- tagBeforeAnchor: !1
1525
- };
1526
- at.withTags({
1527
- ...Se,
1528
- resolve: (e, t, n) => {
1529
- let r = Se.resolve(e, t, n);
1530
- return r === f ? pe.resolve(e, t, n) : r;
1531
- }
1532
- }, {
1533
- ...Le,
1534
- resolve: (e, t, n) => {
1535
- let r = Le.resolve(e, t, n);
1536
- return r === f ? De.resolve(e, t, n) : r;
1537
- }
1538
- }), { ...Pn };
1539
- //#endregion
1540
- //#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
1541
- var Fn = (() => {
1542
- let e = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
1543
- return (t) => {
1544
- let n = 0;
1545
- for (e.lastIndex = 0; e.test(t);) n += 1;
1546
- return t.length - n;
1547
- };
1548
- })(), In = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, Ln = (e) => e === 8987 || e === 9001 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, Rn = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y, zn = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, Bn = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy, Vn = /\t{1,1000}/y, Hn = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy, Un = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, Wn = /\p{M}+/gu, Gn = {
1549
- limit: Infinity,
1550
- ellipsis: ""
1551
- }, Kn = (e, t = {}, n = {}) => {
1552
- let r = t.limit ?? Infinity, i = t.ellipsis ?? "", a = t?.ellipsisWidth ?? (i ? Kn(i, Gn, n).width : 0), o = n.controlWidth ?? 0, s = n.tabWidth ?? 8, c = n.emojiWidth ?? 2, l = n.regularWidth ?? 1, u = n.wideWidth ?? 2, d = [
1553
- [Un, l],
1554
- [Rn, 0],
1555
- [zn, o],
1556
- [Vn, s],
1557
- [Hn, c],
1558
- [Bn, u]
1559
- ], f = 0, p = 0, m = e.length, h = 0, g = !1, _ = m, v = Math.max(0, r - a), y = 0, b = 0, x = 0, S = 0;
1560
- outer: for (;;) {
1561
- if (b > y || p >= m && p > f) {
1562
- let t = e.slice(y, b) || e.slice(f, p);
1563
- h = 0;
1564
- for (let e of t.replaceAll(Wn, "")) {
1565
- let t = e.codePointAt(0) || 0;
1566
- if (S = In(t) ? 2 : Ln(t) ? u : l, x + S > v && (_ = Math.min(_, Math.max(y, f) + h)), x + S > r) {
1567
- g = !0;
1568
- break outer;
1569
- }
1570
- h += e.length, x += S;
1571
- }
1572
- y = b = 0;
1573
- }
1574
- if (p >= m) break outer;
1575
- for (let t = 0, n = d.length; t < n; t++) {
1576
- let [n, i] = d[t];
1577
- if (n.lastIndex = p, n.test(e)) {
1578
- if (h = n === Bn ? Fn(e.slice(p, n.lastIndex)) : n === Hn ? 1 : n.lastIndex - p, S = h * i, x + S > v && (_ = Math.min(_, p + Math.floor((v - x) / i))), x + S > r) {
1579
- g = !0;
1580
- break outer;
1581
- }
1582
- x += S, y = f, b = p, p = f = n.lastIndex;
1583
- continue outer;
1584
- }
1585
- }
1586
- p += 1;
1587
- }
1588
- return {
1589
- width: g ? v : x,
1590
- index: g ? _ : m,
1591
- truncated: g,
1592
- ellipsed: g && r >= a
1593
- };
1594
- }, qn = {
1595
- limit: Infinity,
1596
- ellipsis: "",
1597
- ellipsisWidth: 0
1598
- }, K = (e, t = {}) => Kn(e, qn, t).width, Jn = "\x1B", Yn = "›", Xn = 39, Zn = "\x07", Qn = "[", $n = "]", er = "m", tr = `${$n}8;;`, nr = RegExp(`(?:\\${Qn}(?<code>\\d+)m|\\${tr}(?<uri>.*)${Zn})`, "y"), rr = (e) => {
1599
- if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
1600
- if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
1601
- if (e === 1 || e === 2) return 22;
1602
- if (e === 3) return 23;
1603
- if (e === 4) return 24;
1604
- if (e === 7) return 27;
1605
- if (e === 8) return 28;
1606
- if (e === 9) return 29;
1607
- if (e === 0) return 0;
1608
- }, ir = (e) => `${Jn}${Qn}${e}${er}`, ar = (e) => `${Jn}${tr}${e}${Zn}`, or = (e, t, n) => {
1609
- let r = t[Symbol.iterator](), i = !1, a = !1, o = e.at(-1), s = o === void 0 ? 0 : K(o), c = r.next(), l = r.next(), u = 0;
1610
- for (; !c.done;) {
1611
- let o = c.value, d = K(o);
1612
- s + d <= n ? e[e.length - 1] += o : (e.push(o), s = 0), (o === Jn || o === Yn) && (i = !0, a = t.startsWith(tr, u + 1)), i ? a ? o === Zn && (i = !1, a = !1) : o === er && (i = !1) : (s += d, s === n && !l.done && (e.push(""), s = 0)), c = l, l = r.next(), u += o.length;
1613
- }
1614
- o = e.at(-1), !s && o !== void 0 && o.length && e.length > 1 && (e[e.length - 2] += e.pop());
1615
- }, sr = (e) => {
1616
- let t = e.split(" "), n = t.length;
1617
- for (; n && !K(t[n - 1]);) n--;
1618
- return n === t.length ? e : t.slice(0, n).join(" ") + t.slice(n).join("");
1619
- }, cr = (e, t, n = {}) => {
1620
- if (n.trim !== !1 && e.trim() === "") return "";
1621
- let r = "", i, a, o = e.split(" "), s = [""], c = 0;
1622
- for (let e = 0; e < o.length; e++) {
1623
- let r = o[e];
1624
- if (n.trim !== !1) {
1625
- let e = s.at(-1) ?? "", t = e.trimStart();
1626
- e.length !== t.length && (s[s.length - 1] = t, c = K(t));
1627
- }
1628
- e !== 0 && (c >= t && (n.wordWrap === !1 || n.trim === !1) && (s.push(""), c = 0), (c || n.trim === !1) && (s[s.length - 1] += " ", c++));
1629
- let i = K(r);
1630
- if (n.hard && i > t) {
1631
- let e = t - c, n = 1 + Math.floor((i - e - 1) / t);
1632
- Math.floor((i - 1) / t) < n && s.push(""), or(s, r, t), c = K(s.at(-1) ?? "");
1633
- continue;
1634
- }
1635
- if (c + i > t && c && i) {
1636
- if (n.wordWrap === !1 && c < t) {
1637
- or(s, r, t), c = K(s.at(-1) ?? "");
1638
- continue;
1639
- }
1640
- s.push(""), c = 0;
1641
- }
1642
- if (c + i > t && n.wordWrap === !1) {
1643
- or(s, r, t), c = K(s.at(-1) ?? "");
1644
- continue;
1645
- }
1646
- s[s.length - 1] += r, c += i;
1647
- }
1648
- n.trim !== !1 && (s = s.map((e) => sr(e)));
1649
- let l = s.join("\n"), u = !1;
1650
- for (let e = 0; e < l.length; e++) {
1651
- let t = l[e];
1652
- if (r += t, u) u = !1;
1653
- else if (u = t >= "\ud800" && t <= "\udbff", u) continue;
1654
- if (t === Jn || t === Yn) {
1655
- nr.lastIndex = e + 1;
1656
- let t = nr.exec(l)?.groups;
1657
- if (t?.code !== void 0) {
1658
- let e = Number.parseFloat(t.code);
1659
- i = e === Xn ? void 0 : e;
1660
- } else t?.uri !== void 0 && (a = t.uri.length === 0 ? void 0 : t.uri);
1661
- }
1662
- if (l[e + 1] === "\n") {
1663
- a && (r += ar(""));
1664
- let e = i ? rr(i) : void 0;
1665
- i && e && (r += ir(e));
1666
- } else t === "\n" && (i && rr(i) && (r += ir(i)), a && (r += ar(a)));
1667
- }
1668
- return r;
1669
- }, lr = /\r?\n/;
1670
- function ur(e, t, n) {
1671
- return String(e).normalize().split(lr).map((e) => cr(e, t, n)).join("\n");
1672
- }
1673
- //#endregion
1674
- //#region ../../node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
1675
- var q = (/* @__PURE__ */ t(((e, t) => {
1676
- var n = "\x1B", r = `${n}[`, i = "\x07", a = {
1677
- to(e, t) {
1678
- return t ? `${r}${t + 1};${e + 1}H` : `${r}${e + 1}G`;
1679
- },
1680
- move(e, t) {
1681
- let n = "";
1682
- return e < 0 ? n += `${r}${-e}D` : e > 0 && (n += `${r}${e}C`), t < 0 ? n += `${r}${-t}A` : t > 0 && (n += `${r}${t}B`), n;
1683
- },
1684
- up: (e = 1) => `${r}${e}A`,
1685
- down: (e = 1) => `${r}${e}B`,
1686
- forward: (e = 1) => `${r}${e}C`,
1687
- backward: (e = 1) => `${r}${e}D`,
1688
- nextLine: (e = 1) => `${r}E`.repeat(e),
1689
- prevLine: (e = 1) => `${r}F`.repeat(e),
1690
- left: `${r}G`,
1691
- hide: `${r}?25l`,
1692
- show: `${r}?25h`,
1693
- save: `${n}7`,
1694
- restore: `${n}8`
1695
- };
1696
- t.exports = {
1697
- cursor: a,
1698
- scroll: {
1699
- up: (e = 1) => `${r}S`.repeat(e),
1700
- down: (e = 1) => `${r}T`.repeat(e)
1701
- },
1702
- erase: {
1703
- screen: `${r}2J`,
1704
- up: (e = 1) => `${r}1J`.repeat(e),
1705
- down: (e = 1) => `${r}J`.repeat(e),
1706
- line: `${r}2K`,
1707
- lineEnd: `${r}K`,
1708
- lineStart: `${r}1K`,
1709
- lines(e) {
1710
- let t = "";
1711
- for (let n = 0; n < e; n++) t += this.line + (n < e - 1 ? a.up() : "");
1712
- return e && (t += a.left), t;
1713
- }
1714
- },
1715
- beep: i
1716
- };
1717
- })))();
1718
- function dr(e, t, n) {
1719
- if (!n.some((e) => !e.disabled)) return e;
1720
- let r = e + t, i = Math.max(n.length - 1, 0), a = r < 0 ? i : r > i ? 0 : r;
1721
- return n[a]?.disabled ? dr(a, t < 0 ? -1 : 1, n) : a;
1722
- }
1723
- var J = {
1724
- actions: /* @__PURE__ */ new Set([
1725
- "up",
1726
- "down",
1727
- "left",
1728
- "right",
1729
- "space",
1730
- "enter",
1731
- "cancel"
1732
- ]),
1733
- aliases: /* @__PURE__ */ new Map([
1734
- ["k", "up"],
1735
- ["j", "down"],
1736
- ["h", "left"],
1737
- ["l", "right"],
1738
- ["", "cancel"],
1739
- ["escape", "cancel"]
1740
- ]),
1741
- messages: {
1742
- cancel: "Canceled",
1743
- error: "Something went wrong"
1744
- },
1745
- withGuide: !0,
1746
- date: {
1747
- monthNames: [
1748
- "January",
1749
- "February",
1750
- "March",
1751
- "April",
1752
- "May",
1753
- "June",
1754
- "July",
1755
- "August",
1756
- "September",
1757
- "October",
1758
- "November",
1759
- "December"
1760
- ],
1761
- messages: {
1762
- required: "Please enter a valid date",
1763
- invalidMonth: "There are only 12 months in a year",
1764
- invalidDay: (e, t) => `There are only ${e} days in ${t}`,
1765
- afterMin: (e) => `Date must be on or after ${e.toISOString().slice(0, 10)}`,
1766
- beforeMax: (e) => `Date must be on or before ${e.toISOString().slice(0, 10)}`
1767
- }
1768
- }
1769
- };
1770
- function fr(e, t) {
1771
- if (typeof e == "string") return J.aliases.get(e) === t;
1772
- for (let n of e) if (n !== void 0 && fr(n, t)) return !0;
1773
- return !1;
1774
- }
1775
- function pr(e, t) {
1776
- if (e === t) return;
1777
- let n = e.split("\n"), r = t.split("\n"), i = Math.max(n.length, r.length), a = [];
1778
- for (let e = 0; e < i; e++) n[e] !== r[e] && a.push(e);
1779
- return {
1780
- lines: a,
1781
- numLinesBefore: n.length,
1782
- numLinesAfter: r.length,
1783
- numLines: i
1784
- };
1785
- }
1786
- globalThis.process.platform.startsWith("win");
1787
- var mr = Symbol("clack:cancel");
1788
- function hr(e) {
1789
- return e === mr;
1790
- }
1791
- function gr(e, t) {
1792
- let n = e;
1793
- n.isTTY && n.setRawMode(t);
1794
- }
1795
- var _r = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80, vr = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
1796
- function yr(e, t, n, r = n, i = n, a) {
1797
- return ur(t, _r(e ?? u) - n.length, {
1798
- hard: !0,
1799
- trim: !1
1800
- }).split("\n").map((e, t, o) => {
1801
- let s = a ? a(e, t) : e;
1802
- return t === 0 ? `${r}${s}` : t === o.length - 1 ? `${i}${s}` : `${n}${s}`;
1803
- }).join("\n");
1804
- }
1805
- function br(e, t) {
1806
- if ("~standard" in e) {
1807
- let n = e["~standard"].validate(t);
1808
- if (n instanceof Promise) throw TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
1809
- return n.issues?.at(0)?.message;
1810
- }
1811
- return e(t);
1812
- }
1813
- var xr = class {
1814
- input;
1815
- output;
1816
- _abortSignal;
1817
- rl;
1818
- opts;
1819
- _render;
1820
- _track = !1;
1821
- _prevFrame = "";
1822
- _subscribers = /* @__PURE__ */ new Map();
1823
- _cursor = 0;
1824
- state = "initial";
1825
- error = "";
1826
- value;
1827
- userInput = "";
1828
- constructor(e, t = !0) {
1829
- let { input: n = l, output: r = u, render: i, signal: a, ...o } = e;
1830
- this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = a, this.input = n, this.output = r;
1831
- }
1832
- unsubscribe() {
1833
- this._subscribers.clear();
1834
- }
1835
- setSubscriber(e, t) {
1836
- let n = this._subscribers.get(e) ?? [];
1837
- n.push(t), this._subscribers.set(e, n);
1838
- }
1839
- on(e, t) {
1840
- this.setSubscriber(e, { cb: t });
1841
- }
1842
- once(e, t) {
1843
- this.setSubscriber(e, {
1844
- cb: t,
1845
- once: !0
1846
- });
1847
- }
1848
- emit(e, ...t) {
1849
- let n = this._subscribers.get(e) ?? [], r = [];
1850
- for (let e of n) e.cb(...t), e.once && r.push(() => n.splice(n.indexOf(e), 1));
1851
- for (let e of r) e();
1852
- }
1853
- prompt() {
1854
- return new Promise((e) => {
1855
- if (this._abortSignal) {
1856
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(mr);
1857
- this._abortSignal.addEventListener("abort", () => {
1858
- this.state = "cancel", this.close();
1859
- }, { once: !0 });
1860
- }
1861
- this.rl = d.createInterface({
1862
- input: this.input,
1863
- tabSize: 2,
1864
- prompt: "",
1865
- escapeCodeTimeout: 50,
1866
- terminal: !0
1867
- }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), gr(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
1868
- this.output.write(q.cursor.show), this.output.off("resize", this.render), gr(this.input, !1), e(this.value);
1869
- }), this.once("cancel", () => {
1870
- this.output.write(q.cursor.show), this.output.off("resize", this.render), gr(this.input, !1), e(mr);
1871
- });
1872
- });
1873
- }
1874
- _isActionKey(e, t) {
1875
- return e === " ";
1876
- }
1877
- _shouldSubmit(e, t) {
1878
- return !0;
1879
- }
1880
- _setValue(e) {
1881
- this.value = e, this.emit("value", this.value);
1882
- }
1883
- _setUserInput(e, t) {
1884
- this.userInput = e ?? "", this.emit("userInput", this.userInput), t && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
1885
- }
1886
- _clearUserInput() {
1887
- this.rl?.write(null, {
1888
- ctrl: !0,
1889
- name: "u"
1890
- }), this._setUserInput("");
1891
- }
1892
- onKeypress(e, t) {
1893
- if (this._track && t.name !== "return" && (t.name && this._isActionKey(e, t) && this.rl?.write(null, {
1894
- ctrl: !0,
1895
- name: "h"
1896
- }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), t?.name && (!this._track && J.aliases.has(t.name) && this.emit("cursor", J.aliases.get(t.name)), J.actions.has(t.name) && this.emit("cursor", t.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e, t), t?.name === "return" && this._shouldSubmit(e, t)) {
1897
- if (this.opts.validate) {
1898
- let e = br(this.opts.validate, this.value);
1899
- e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.userInput));
1900
- }
1901
- this.state !== "error" && (this.state = "submit");
1902
- }
1903
- fr([
1904
- e,
1905
- t?.name,
1906
- t?.sequence
1907
- ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
1908
- }
1909
- close() {
1910
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write("\n"), gr(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
1911
- }
1912
- restoreCursor() {
1913
- let e = ur(this._prevFrame, process.stdout.columns, {
1914
- hard: !0,
1915
- trim: !1
1916
- }).split("\n").length - 1;
1917
- this.output.write(q.cursor.move(-999, e * -1));
1918
- }
1919
- render() {
1920
- let e = ur(this._render(this) ?? "", process.stdout.columns, {
1921
- hard: !0,
1922
- trim: !1
1923
- });
1924
- if (e !== this._prevFrame) {
1925
- if (this.state === "initial") this.output.write(q.cursor.hide);
1926
- else {
1927
- let t = pr(this._prevFrame, e), n = vr(this.output);
1928
- if (this.restoreCursor(), t) {
1929
- let r = Math.max(0, t.numLinesAfter - n), i = Math.max(0, t.numLinesBefore - n), a = t.lines.find((e) => e >= r);
1930
- if (a === void 0) {
1931
- this._prevFrame = e;
1932
- return;
1933
- }
1934
- if (t.lines.length === 1) {
1935
- this.output.write(q.cursor.move(0, a - i)), this.output.write(q.erase.lines(1));
1936
- let t = e.split("\n");
1937
- this.output.write(t[a]), this._prevFrame = e, this.output.write(q.cursor.move(0, t.length - a - 1));
1938
- return;
1939
- } else if (t.lines.length > 1) {
1940
- if (r < i) a = r;
1941
- else {
1942
- let e = a - i;
1943
- e > 0 && this.output.write(q.cursor.move(0, e));
1944
- }
1945
- this.output.write(q.erase.down());
1946
- let t = e.split("\n").slice(a);
1947
- this.output.write(t.join("\n")), this._prevFrame = e;
1948
- return;
1949
- }
1950
- }
1951
- this.output.write(q.erase.down());
1952
- }
1953
- this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
1954
- }
1955
- }
1956
- }, Sr = class extends xr {
1957
- options;
1958
- cursor = 0;
1959
- get _selectedValue() {
1960
- return this.options[this.cursor];
1961
- }
1962
- changeValue() {
1963
- let e = this._selectedValue;
1964
- this.value = e === void 0 ? void 0 : e.value;
1965
- }
1966
- constructor(e) {
1967
- super(e, !1), this.options = e.options;
1968
- let t = this.options.findIndex(({ value: t }) => t === e.initialValue), n = t === -1 ? 0 : t;
1969
- this.cursor = this.options[n]?.disabled ? dr(n, 1, this.options) : n, this.changeValue(), this.on("cursor", (e) => {
1970
- switch (e) {
1971
- case "left":
1972
- case "up":
1973
- this.cursor = dr(this.cursor, -1, this.options);
1974
- break;
1975
- case "down":
1976
- case "right":
1977
- this.cursor = dr(this.cursor, 1, this.options);
1978
- break;
1979
- }
1980
- this.changeValue();
1981
- });
1982
- }
1983
- }, Cr = class extends xr {
1984
- get userInputWithCursor() {
1985
- if (this.state === "submit") return this.userInput;
1986
- let e = this.userInput;
1987
- if (this.cursor >= e.length) return `${this.userInput}\u2588`;
1988
- let t = e.slice(0, this.cursor), n = e.slice(this.cursor, this.cursor + 1), r = e.slice(this.cursor + 1);
1989
- return `${t}${s("inverse", n)}${r}`;
1990
- }
1991
- get cursor() {
1992
- return this._cursor;
1993
- }
1994
- constructor(e) {
1995
- super({
1996
- ...e,
1997
- initialUserInput: e.initialUserInput ?? e.initialValue
1998
- }), this.on("userInput", (e) => {
1999
- this._setValue(e);
2000
- }), this.on("finalize", () => {
2001
- this.value ||= e.defaultValue, this.value === void 0 && (this.value = "");
2002
- });
2003
- }
2004
- };
2005
- //#endregion
2006
- //#region ../../node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
2007
- function wr() {
2008
- return c.platform === "win32" ? !!c.env.CI || !!c.env.WT_SESSION || !!c.env.TERMINUS_SUBLIME || c.env.ConEmuTask === "{cmd::Cmder}" || c.env.TERM_PROGRAM === "Terminus-Sublime" || c.env.TERM_PROGRAM === "vscode" || c.env.TERM === "xterm-256color" || c.env.TERM === "alacritty" || c.env.TERMINAL_EMULATOR === "JetBrains-JediTerm" : c.env.TERM !== "linux";
2009
- }
2010
- var Tr = wr(), Y = (e, t) => Tr ? e : t, Er = Y("◆", "*"), Dr = Y("■", "x"), Or = Y("▲", "x"), kr = Y("◇", "o"), Ar = Y("┌", "T"), X = Y("│", "|"), Z = Y("└", "—"), jr = Y("●", ">"), Mr = Y("○", " "), Nr = Y("●", "•"), Pr = Y("◆", "*"), Fr = Y("▲", "!"), Ir = Y("■", "x"), Lr = (e) => {
2011
- switch (e) {
2012
- case "initial":
2013
- case "active": return s("cyan", Er);
2014
- case "cancel": return s("red", Dr);
2015
- case "error": return s("yellow", Or);
2016
- case "submit": return s("green", kr);
2017
- }
2018
- }, Rr = (e) => {
2019
- switch (e) {
2020
- case "initial":
2021
- case "active": return s("cyan", X);
2022
- case "cancel": return s("red", X);
2023
- case "error": return s("yellow", X);
2024
- case "submit": return s("green", X);
2025
- }
2026
- };
2027
- function zr(e, t) {
2028
- let n = [`${t ? `${s("cyan", X)} ` : ""}${e.join(" • ")}`];
2029
- return t && n.push(s("cyan", Z)), n;
2030
- }
2031
- var Br = (e, t, n, r, i, a = !1) => {
2032
- let o = t, s = 0;
2033
- if (a) for (let t = r - 1; t >= n; t--) {
2034
- let n = e[t];
2035
- if (n && (o -= n.length), s++, o <= i) break;
2036
- }
2037
- else for (let t = n; t < r; t++) {
2038
- let n = e[t];
2039
- if (n && (o -= n.length), s++, o <= i) break;
2040
- }
2041
- return {
2042
- lineCount: o,
2043
- removals: s
2044
- };
2045
- }, Vr = ({ cursor: e, options: t, style: n, output: r = process.stdout, maxItems: i = Infinity, columnPadding: a = 0, rowPadding: o = 4 }) => {
2046
- let c = _r(r) - a, l = vr(r), u = s("dim", "..."), d = Math.max(l - o, 0), f = Math.max(Math.min(i, d), 5), p = 0;
2047
- e >= f - 3 && (p = Math.max(Math.min(e - f + 3, t.length - f), 0));
2048
- let m = f < t.length && p > 0, h = f < t.length && p + f < t.length, g = Math.min(p + f, t.length), _ = [], v = 0;
2049
- m && v++, h && v++;
2050
- let y = p + +!!m, b = g - +!!h;
2051
- for (let r = y; r < b; r++) {
2052
- let i = t[r], a = ur(i ? n(i, r === e) : "", c, {
2053
- hard: !0,
2054
- trim: !1
2055
- }).split("\n");
2056
- _.push(a), v += a.length;
2057
- }
2058
- if (v > d) {
2059
- let t = 0, n = 0, r = v, i = e - y, a = d, o = () => Br(_, r, 0, i, a), s = () => Br(_, r, i + 1, _.length, a, !0);
2060
- m ? ({lineCount: r, removals: t} = o(), r > a && (h || --a, {lineCount: r, removals: n} = s())) : (h || --a, {lineCount: r, removals: n} = s(), r > a && (--a, {lineCount: r, removals: t} = o())), t > 0 && (m = !0, _.splice(0, t)), n > 0 && (h = !0, _.splice(_.length - n, n));
2061
- }
2062
- let x = [];
2063
- m && x.push(u);
2064
- for (let e of _) for (let t of e) x.push(t);
2065
- return h && x.push(u), x;
2066
- };
2067
- `${s("dim", "↑/↓")}`, `${s("dim", "Space:")}`, `${s("dim", "Enter:")}`;
2068
- var Q = {
2069
- message: (e = [], { symbol: t = s("gray", X), secondarySymbol: n = s("gray", X), output: r = process.stdout, spacing: i = 1, withGuide: a } = {}) => {
2070
- let o = [], c = a ?? J.withGuide, l = c ? n : "", u = c ? `${t} ` : "", d = c ? `${n} ` : "";
2071
- for (let e = 0; e < i; e++) o.push(l);
2072
- let f = Array.isArray(e) ? e : e.split("\n");
2073
- if (f.length > 0) {
2074
- let [e, ...r] = f;
2075
- e.length > 0 ? o.push(`${u}${e}`) : o.push(c ? t : "");
2076
- for (let e of r) e.length > 0 ? o.push(`${d}${e}`) : o.push(c ? n : "");
2077
- }
2078
- r.write(`${o.join("\n")}
2079
- `);
2080
- },
2081
- info: (e, t) => {
2082
- Q.message(e, {
2083
- ...t,
2084
- symbol: s("blue", Nr)
2085
- });
2086
- },
2087
- success: (e, t) => {
2088
- Q.message(e, {
2089
- ...t,
2090
- symbol: s("green", Pr)
2091
- });
2092
- },
2093
- step: (e, t) => {
2094
- Q.message(e, {
2095
- ...t,
2096
- symbol: s("green", kr)
2097
- });
2098
- },
2099
- warn: (e, t) => {
2100
- Q.message(e, {
2101
- ...t,
2102
- symbol: s("yellow", Fr)
2103
- });
2104
- },
2105
- warning: (e, t) => {
2106
- Q.warn(e, t);
2107
- },
2108
- error: (e, t) => {
2109
- Q.message(e, {
2110
- ...t,
2111
- symbol: s("red", Ir)
2112
- });
2113
- }
2114
- }, Hr = (e = "", t) => {
2115
- let n = t?.output ?? process.stdout, r = t?.withGuide ?? J.withGuide ? `${s("gray", Z)} ` : "";
2116
- n.write(`${r}${s("red", e)}
2117
-
2118
- `);
2119
- }, Ur = (e = "", t) => {
2120
- let n = t?.output ?? process.stdout, r = t?.withGuide ?? J.withGuide ? `${s("gray", Ar)} ` : "";
2121
- n.write(`${r}${e}
2122
- `);
2123
- }, Wr = (e = "", t) => {
2124
- let n = t?.output ?? process.stdout, r = t?.withGuide ?? J.withGuide ? `${s("gray", X)}
2125
- ${s("gray", Z)} ` : "";
2126
- n.write(`${r}${e}
2127
-
2128
- `);
2129
- }, Gr = [`${s("dim", "↑/↓")} to navigate`, `${s("dim", "Enter:")} confirm`], Kr = (e, t) => e.includes("\n") ? e.split("\n").map((e) => t(e)).join("\n") : t(e), qr = (e) => {
2130
- let t = (e, t) => {
2131
- if (e === void 0) return "";
2132
- let n = e.label ?? String(e.value);
2133
- switch (t) {
2134
- case "disabled": return `${s("gray", Mr)} ${Kr(n, (e) => s("gray", e))}${e.hint ? ` ${s("dim", `(${e.hint ?? "disabled"})`)}` : ""}`;
2135
- case "selected": return `${Kr(n, (e) => s("dim", e))}`;
2136
- case "active": return `${s("green", jr)} ${n}${e.hint ? ` ${s("dim", `(${e.hint})`)}` : ""}`;
2137
- case "cancelled": return `${Kr(n, (e) => s(["strikethrough", "dim"], e))}`;
2138
- default: return `${s("dim", Mr)} ${Kr(n, (e) => s("dim", e))}`;
2139
- }
2140
- }, n = e.showInstructions ?? !0;
2141
- return new Sr({
2142
- options: e.options,
2143
- signal: e.signal,
2144
- input: e.input,
2145
- output: e.output,
2146
- initialValue: e.initialValue,
2147
- render() {
2148
- let r = e.withGuide ?? J.withGuide, i = `${Lr(this.state)} `, a = `${Rr(this.state)} `, o = yr(e.output, e.message, a, i), c = `${r ? `${s("gray", X)}
2149
- ` : ""}${o}
2150
- `;
2151
- switch (this.state) {
2152
- case "submit": {
2153
- let n = r ? `${s("gray", X)} ` : "";
2154
- return `${c}${yr(e.output, t(this.options[this.cursor], "selected"), n)}`;
2155
- }
2156
- case "cancel": {
2157
- let n = r ? `${s("gray", X)} ` : "";
2158
- return `${c}${yr(e.output, t(this.options[this.cursor], "cancelled"), n)}${r ? `
2159
- ${s("gray", X)}` : ""}`;
2160
- }
2161
- default: {
2162
- let i = r ? `${s("cyan", X)} ` : "", a = c.split("\n").length, o = n ? zr(Gr, r) : r ? [s("cyan", Z)] : [], l = o.join("\n"), u = o.length + 1;
2163
- return `${c}${i}${Vr({
2164
- output: e.output,
2165
- cursor: this.cursor,
2166
- options: this.options,
2167
- maxItems: e.maxItems,
2168
- columnPadding: i.length,
2169
- rowPadding: a + u,
2170
- style: (e, n) => t(e, e.disabled ? "disabled" : n ? "active" : "inactive")
2171
- }).join(`
2172
- ${i}`)}
2173
- ${l}
2174
- `;
2175
- }
2176
- }
2177
- }
2178
- }).prompt();
2179
- };
2180
- `${s("gray", X)}`;
2181
- var Jr = (e) => new Cr({
2182
- validate: e.validate,
2183
- placeholder: e.placeholder,
2184
- defaultValue: e.defaultValue,
2185
- initialValue: e.initialValue,
2186
- output: e.output,
2187
- signal: e.signal,
2188
- input: e.input,
2189
- render() {
2190
- let t = e?.withGuide ?? J.withGuide, n = `${`${t ? `${s("gray", X)}
2191
- ` : ""}${Lr(this.state)} `}${e.message}
2192
- `, r = e.placeholder && e.placeholder.length > 0 ? s("inverse", e.placeholder[0]) + s("dim", e.placeholder.slice(1)) : s(["inverse", "hidden"], "_"), i = this.userInput ? this.userInputWithCursor : r, a = this.value ?? "";
2193
- switch (this.state) {
2194
- case "error": {
2195
- let e = this.error ? ` ${s("yellow", this.error)}` : "", r = t ? `${s("yellow", X)} ` : "", a = t ? s("yellow", Z) : "";
2196
- return `${n.trim()}
2197
- ${r}${i}
2198
- ${a}${e}
2199
- `;
2200
- }
2201
- case "submit": {
2202
- let e = a ? ` ${s("dim", a)}` : "";
2203
- return `${n}${t ? s("gray", X) : ""}${e}`;
2204
- }
2205
- case "cancel": {
2206
- let e = a ? ` ${s(["strikethrough", "dim"], a)}` : "", r = t ? s("gray", X) : "";
2207
- return `${n}${r}${e}${a.trim() ? `
2208
- ${r}` : ""}`;
2209
- }
2210
- default: return `${n}${t ? `${s("cyan", X)} ` : ""}${i}
2211
- ${t ? s("cyan", Z) : ""}
2212
- `;
2213
- }
2214
- }
2215
- }).prompt();
2216
- //#endregion
2217
- //#region src/node/cli/init.ts
2218
- async function Yr(e) {
2219
- await oi(e, await Xr(e)), ii(e);
2220
- }
2221
- async function Xr(e) {
2222
- Ur("typedown");
2223
- let t = await Qr(e);
2224
- t.hasTypedownYaml && await Zr();
2225
- let n = await ai("Project name", t.packageName ?? a.basename(e));
2226
- return {
2227
- projectName: n,
2228
- siteTitle: await ai("Site title", t.siteTitle ?? n),
2229
- siteDescription: await ai("Site description", t.siteDescription ?? "A typedown site")
2230
- };
2231
- }
2232
- async function Zr() {
2233
- Q.warn("typedown.yaml already exists in this directory");
2234
- let e = await qr({
2235
- message: "What would you like to do?",
2236
- options: [{
2237
- value: "scaffold",
2238
- label: "Continue scaffolding (skip existing files)"
2239
- }, {
2240
- value: "cancel",
2241
- label: "Cancel"
2242
- }]
2243
- });
2244
- (hr(e) || e === "cancel") && (Hr("Cancelled."), process.exit(0));
2245
- }
2246
- async function Qr(t) {
2247
- let n = {
2248
- hasPackageJson: !1,
2249
- hasTypedownYaml: !1,
2250
- packageName: void 0,
2251
- siteTitle: void 0,
2252
- siteDescription: void 0
2253
- }, r = a.join(t, "package.json");
2254
- try {
2255
- let e = await o.readFile(r, "utf-8"), t = JSON.parse(e);
2256
- n.hasPackageJson = !0, typeof t.name == "string" && 0 < t.name.length && (n.packageName = t.name);
2257
- } catch {}
2258
- for (let r of e) try {
2259
- let e = Nn(await o.readFile(a.join(t, r), "utf-8"));
2260
- n.hasTypedownYaml = !0;
2261
- let i = e?.site;
2262
- typeof i?.title == "string" && (n.siteTitle = i.title), typeof i?.description == "string" && (n.siteDescription = i.description);
2263
- break;
2264
- } catch {}
2265
- return n;
2266
- }
2267
- function $r(e) {
2268
- return `<!doctype html>
2269
- <html lang="en">
2270
- <head>
2271
- <meta charset="UTF-8" />
2272
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
2273
- <title>${r(e.siteTitle)}</title>
2274
- <link
2275
- rel="icon"
2276
- type="image/svg+xml"
2277
- href="${i}"
2278
- >
2279
- </head>
2280
- <body>
2281
- <div id="app"></div>
2282
- <script
2283
- type="module"
2284
- src="/${n}"
2285
- ><\/script>
2286
- </body>
2287
- </html>
2288
- `;
2289
- }
2290
- function ei(e) {
2291
- return JSON.stringify({
2292
- name: e.projectName,
2293
- version: "0.0.0",
2294
- private: !0,
2295
- type: "module",
2296
- scripts: {
2297
- dev: "typerighter dev",
2298
- build: "typerighter build",
2299
- preview: "typerighter preview"
2300
- },
2301
- devDependencies: { typerighter: "^0.4.3" }
2302
- }, void 0, 2) + "\n";
2303
- }
2304
- function ti() {
2305
- return "---\n_type: Article\ntitle: \"Hello, world\"\n---\n\nWelcome to your new typedown site.\n";
2306
- }
2307
- function ni() {
2308
- return "---\n_type: schema\nproperties:\n title:\n type: string\n tags:\n type: list[string]\n optional: true\n---\n";
2309
- }
2310
- function ri(e) {
2311
- return `version: "1.0.0"
2312
- vault:
2313
- content_dir: vault/content
2314
- schema_dir: vault/schemas
2315
- site:
2316
- title: "${e.siteTitle}"
2317
- description: "${e.siteDescription}"
2318
- `;
2319
- }
2320
- function ii(e) {
2321
- let t = ["Done scaffolding."];
2322
- e !== "." && t.push(`cd ${e}`), t.push("pnpm install"), t.push("pnpm dev"), Wr(t.join("\n"));
2323
- }
2324
- async function ai(e, t) {
2325
- let n = await Jr({
2326
- message: e,
2327
- placeholder: t,
2328
- defaultValue: t
2329
- });
2330
- return hr(n) && (Hr("Cancelled."), process.exit(0)), n;
2331
- }
2332
- async function oi(e, t) {
2333
- let n = a.join(e, "vault", "content"), r = a.join(e, "vault", "schemas"), i = a.join(e, ".typedown", ".local");
2334
- await Promise.all([
2335
- o.mkdir(n, { recursive: !0 }),
2336
- o.mkdir(r, { recursive: !0 }),
2337
- o.mkdir(i, { recursive: !0 })
2338
- ]), await $(i, ".gitignore", "*\n", { silent: !0 }), await Promise.all([
2339
- $(e, ".gitignore", "node_modules/\ndist/\n", { silent: !0 }),
2340
- $(e, "package.json", ei(t)),
2341
- $(e, "typedown.yaml", ri(t)),
2342
- $(e, "index.html", $r(t))
2343
- ]);
2344
- let s = await Promise.all([$(r, "Article.td", ni(), { silent: !0 }), $(n, "hello.td", ti(), { silent: !0 })]), c = s.filter(Boolean), l = s.filter((e) => !e);
2345
- 0 < c.length && Q.success(`created sample schema and content (${c.length} files)`), 0 < l.length && Q.warn(`skipped ${l.length} sample files (already exist)`);
2346
- }
2347
- async function $(e, t, n, r = {}) {
2348
- let i = a.join(e, t);
2349
- try {
2350
- return await o.access(i), r.silent || Q.warn(`skip ${t} (already exists)`), !1;
2351
- } catch {
2352
- return await o.writeFile(i, n), r.silent || Q.success(`created ${t}`), !0;
2353
- }
2354
- }
2355
- //#endregion
2356
- export { Yr as initialize };