@rexeus/typeweaver 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/chunk-AYKTAXMI.js +14954 -0
  2. package/dist/chunk-K3NQKI34.js +1 -3
  3. package/dist/cli-Q5T6SL57.js +14951 -0
  4. package/dist/cli.cjs +1045 -102301
  5. package/dist/cli.js +1 -2
  6. package/dist/entry.js +3 -3
  7. package/dist/index.cjs +1 -116227
  8. package/dist/index.js +1 -2
  9. package/dist/metafile-cjs.json +1 -0
  10. package/dist/metafile-esm.json +1 -0
  11. package/dist/tsx-loader-3QUDYASH.js +1 -3
  12. package/package.json +18 -8
  13. package/dist/acorn-TNAGPKCR.js +0 -3130
  14. package/dist/acorn-ZFAHQIG7.js +0 -3131
  15. package/dist/angular-3KXBV3WD.js +0 -3030
  16. package/dist/angular-WMVKTHFF.js +0 -3031
  17. package/dist/babel-5QZSVJOE.js +0 -7297
  18. package/dist/babel-V7SGJWS6.js +0 -7296
  19. package/dist/chunk-4ST7XK4F.js +0 -34641
  20. package/dist/chunk-MLKGABMK.js +0 -9
  21. package/dist/cli-GOSMI5D3.js +0 -34642
  22. package/dist/estree-QSPT5I7I.js +0 -4612
  23. package/dist/estree-Y36AM62I.js +0 -4613
  24. package/dist/flow-7LH7X5GA.js +0 -27547
  25. package/dist/flow-WHVBWPDR.js +0 -27546
  26. package/dist/glimmer-BHRIPYOK.js +0 -2894
  27. package/dist/glimmer-CBYXJR5M.js +0 -2895
  28. package/dist/graphql-7EJJJFHU.js +0 -1266
  29. package/dist/graphql-KKVSZXX7.js +0 -1267
  30. package/dist/html-M3WOAMIJ.js +0 -2927
  31. package/dist/html-YM5TKPVB.js +0 -2926
  32. package/dist/markdown-FIK6SNTF.js +0 -3551
  33. package/dist/markdown-X6DQGEVV.js +0 -3552
  34. package/dist/meriyah-FBUICA5T.js +0 -2684
  35. package/dist/meriyah-GWPOVAHY.js +0 -2685
  36. package/dist/postcss-N2W7KQ6Q.js +0 -5081
  37. package/dist/postcss-ODV7XV5T.js +0 -5080
  38. package/dist/typescript-BG63TNYD.js +0 -13203
  39. package/dist/typescript-IYJMK2NE.js +0 -13204
  40. package/dist/yaml-5FEMTYXO.js +0 -4225
  41. package/dist/yaml-DV3ZI4ZT.js +0 -4224
@@ -1,4224 +0,0 @@
1
- import "./chunk-MLKGABMK.js";
2
-
3
- // ../../node_modules/.pnpm/prettier@3.7.4/node_modules/prettier/plugins/yaml.mjs
4
- var ki = Object.create;
5
- var sn = Object.defineProperty;
6
- var Pi = Object.getOwnPropertyDescriptor;
7
- var vi = Object.getOwnPropertyNames;
8
- var Ii = Object.getPrototypeOf;
9
- var _i = Object.prototype.hasOwnProperty;
10
- var ne = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
11
- var or = (t, e) => {
12
- for (var n in e) sn(t, n, { get: e[n], enumerable: true });
13
- };
14
- var xi = (t, e, n, r) => {
15
- if (e && typeof e == "object" || typeof e == "function") for (let s of vi(e)) !_i.call(t, s) && s !== n && sn(t, s, { get: () => e[s], enumerable: !(r = Pi(e, s)) || r.enumerable });
16
- return t;
17
- };
18
- var on = (t, e, n) => (n = t != null ? ki(Ii(t)) : {}, xi(e || !t || !t.__esModule ? sn(n, "default", { value: t, enumerable: true }) : n, t));
19
- var ce = ne((B) => {
20
- "use strict";
21
- var ie = { ANCHOR: "&", COMMENT: "#", TAG: "!", DIRECTIVES_END: "-", DOCUMENT_END: "." }, st = { ALIAS: "ALIAS", BLANK_LINE: "BLANK_LINE", BLOCK_FOLDED: "BLOCK_FOLDED", BLOCK_LITERAL: "BLOCK_LITERAL", COMMENT: "COMMENT", DIRECTIVE: "DIRECTIVE", DOCUMENT: "DOCUMENT", FLOW_MAP: "FLOW_MAP", FLOW_SEQ: "FLOW_SEQ", MAP: "MAP", MAP_KEY: "MAP_KEY", MAP_VALUE: "MAP_VALUE", PLAIN: "PLAIN", QUOTE_DOUBLE: "QUOTE_DOUBLE", QUOTE_SINGLE: "QUOTE_SINGLE", SEQ: "SEQ", SEQ_ITEM: "SEQ_ITEM" }, mo = "tag:yaml.org,2002:", ho = { MAP: "tag:yaml.org,2002:map", SEQ: "tag:yaml.org,2002:seq", STR: "tag:yaml.org,2002:str" };
22
- function Wr(t) {
23
- let e = [0], n = t.indexOf(`
24
- `);
25
- for (; n !== -1; ) n += 1, e.push(n), n = t.indexOf(`
26
- `, n);
27
- return e;
28
- }
29
- function Kr(t) {
30
- let e, n;
31
- return typeof t == "string" ? (e = Wr(t), n = t) : (Array.isArray(t) && (t = t[0]), t && t.context && (t.lineStarts || (t.lineStarts = Wr(t.context.src)), e = t.lineStarts, n = t.context.src)), { lineStarts: e, src: n };
32
- }
33
- function wn(t, e) {
34
- if (typeof t != "number" || t < 0) return null;
35
- let { lineStarts: n, src: r } = Kr(e);
36
- if (!n || !r || t > r.length) return null;
37
- for (let i = 0; i < n.length; ++i) {
38
- let o = n[i];
39
- if (t < o) return { line: i, col: t - n[i - 1] + 1 };
40
- if (t === o) return { line: i + 1, col: 1 };
41
- }
42
- let s = n.length;
43
- return { line: s, col: t - n[s - 1] + 1 };
44
- }
45
- function go(t, e) {
46
- let { lineStarts: n, src: r } = Kr(e);
47
- if (!n || !(t >= 1) || t > n.length) return null;
48
- let s = n[t - 1], i = n[t];
49
- for (; i && i > s && r[i - 1] === `
50
- `; ) --i;
51
- return r.slice(s, i);
52
- }
53
- function yo({ start: t, end: e }, n, r = 80) {
54
- let s = go(t.line, n);
55
- if (!s) return null;
56
- let { col: i } = t;
57
- if (s.length > r) if (i <= r - 10) s = s.substr(0, r - 1) + "\u2026";
58
- else {
59
- let f = Math.round(r / 2);
60
- s.length > i + f && (s = s.substr(0, i + f - 1) + "\u2026"), i -= s.length - r, s = "\u2026" + s.substr(1 - r);
61
- }
62
- let o = 1, a = "";
63
- e && (e.line === t.line && i + (e.col - t.col) <= r + 1 ? o = e.col - t.col : (o = Math.min(s.length + 1, r) - i, a = "\u2026"));
64
- let c = i > 1 ? " ".repeat(i - 1) : "", l = "^".repeat(o);
65
- return `${s}
66
- ${c}${l}${a}`;
67
- }
68
- var xe = class t {
69
- static copy(e) {
70
- return new t(e.start, e.end);
71
- }
72
- constructor(e, n) {
73
- this.start = e, this.end = n || e;
74
- }
75
- isEmpty() {
76
- return typeof this.start != "number" || !this.end || this.end <= this.start;
77
- }
78
- setOrigRange(e, n) {
79
- let { start: r, end: s } = this;
80
- if (e.length === 0 || s <= e[0]) return this.origStart = r, this.origEnd = s, n;
81
- let i = n;
82
- for (; i < e.length && !(e[i] > r); ) ++i;
83
- this.origStart = r + i;
84
- let o = i;
85
- for (; i < e.length && !(e[i] >= s); ) ++i;
86
- return this.origEnd = s + i, o;
87
- }
88
- }, oe = class t {
89
- static addStringTerminator(e, n, r) {
90
- if (r[r.length - 1] === `
91
- `) return r;
92
- let s = t.endOfWhiteSpace(e, n);
93
- return s >= e.length || e[s] === `
94
- ` ? r + `
95
- ` : r;
96
- }
97
- static atDocumentBoundary(e, n, r) {
98
- let s = e[n];
99
- if (!s) return true;
100
- let i = e[n - 1];
101
- if (i && i !== `
102
- `) return false;
103
- if (r) {
104
- if (s !== r) return false;
105
- } else if (s !== ie.DIRECTIVES_END && s !== ie.DOCUMENT_END) return false;
106
- let o = e[n + 1], a = e[n + 2];
107
- if (o !== s || a !== s) return false;
108
- let c = e[n + 3];
109
- return !c || c === `
110
- ` || c === " " || c === " ";
111
- }
112
- static endOfIdentifier(e, n) {
113
- let r = e[n], s = r === "<", i = s ? [`
114
- `, " ", " ", ">"] : [`
115
- `, " ", " ", "[", "]", "{", "}", ","];
116
- for (; r && i.indexOf(r) === -1; ) r = e[n += 1];
117
- return s && r === ">" && (n += 1), n;
118
- }
119
- static endOfIndent(e, n) {
120
- let r = e[n];
121
- for (; r === " "; ) r = e[n += 1];
122
- return n;
123
- }
124
- static endOfLine(e, n) {
125
- let r = e[n];
126
- for (; r && r !== `
127
- `; ) r = e[n += 1];
128
- return n;
129
- }
130
- static endOfWhiteSpace(e, n) {
131
- let r = e[n];
132
- for (; r === " " || r === " "; ) r = e[n += 1];
133
- return n;
134
- }
135
- static startOfLine(e, n) {
136
- let r = e[n - 1];
137
- if (r === `
138
- `) return n;
139
- for (; r && r !== `
140
- `; ) r = e[n -= 1];
141
- return n + 1;
142
- }
143
- static endOfBlockIndent(e, n, r) {
144
- let s = t.endOfIndent(e, r);
145
- if (s > r + n) return s;
146
- {
147
- let i = t.endOfWhiteSpace(e, s), o = e[i];
148
- if (!o || o === `
149
- `) return i;
150
- }
151
- return null;
152
- }
153
- static atBlank(e, n, r) {
154
- let s = e[n];
155
- return s === `
156
- ` || s === " " || s === " " || r && !s;
157
- }
158
- static nextNodeIsIndented(e, n, r) {
159
- return !e || n < 0 ? false : n > 0 ? true : r && e === "-";
160
- }
161
- static normalizeOffset(e, n) {
162
- let r = e[n];
163
- return r ? r !== `
164
- ` && e[n - 1] === `
165
- ` ? n - 1 : t.endOfWhiteSpace(e, n) : n;
166
- }
167
- static foldNewline(e, n, r) {
168
- let s = 0, i = false, o = "", a = e[n + 1];
169
- for (; a === " " || a === " " || a === `
170
- `; ) {
171
- switch (a) {
172
- case `
173
- `:
174
- s = 0, n += 1, o += `
175
- `;
176
- break;
177
- case " ":
178
- s <= r && (i = true), n = t.endOfWhiteSpace(e, n + 2) - 1;
179
- break;
180
- case " ":
181
- s += 1, n += 1;
182
- break;
183
- }
184
- a = e[n + 1];
185
- }
186
- return o || (o = " "), a && s <= r && (i = true), { fold: o, offset: n, error: i };
187
- }
188
- constructor(e, n, r) {
189
- Object.defineProperty(this, "context", { value: r || null, writable: true }), this.error = null, this.range = null, this.valueRange = null, this.props = n || [], this.type = e, this.value = null;
190
- }
191
- getPropValue(e, n, r) {
192
- if (!this.context) return null;
193
- let { src: s } = this.context, i = this.props[e];
194
- return i && s[i.start] === n ? s.slice(i.start + (r ? 1 : 0), i.end) : null;
195
- }
196
- get anchor() {
197
- for (let e = 0; e < this.props.length; ++e) {
198
- let n = this.getPropValue(e, ie.ANCHOR, true);
199
- if (n != null) return n;
200
- }
201
- return null;
202
- }
203
- get comment() {
204
- let e = [];
205
- for (let n = 0; n < this.props.length; ++n) {
206
- let r = this.getPropValue(n, ie.COMMENT, true);
207
- r != null && e.push(r);
208
- }
209
- return e.length > 0 ? e.join(`
210
- `) : null;
211
- }
212
- commentHasRequiredWhitespace(e) {
213
- let { src: n } = this.context;
214
- if (this.header && e === this.header.end || !this.valueRange) return false;
215
- let { end: r } = this.valueRange;
216
- return e !== r || t.atBlank(n, r - 1);
217
- }
218
- get hasComment() {
219
- if (this.context) {
220
- let { src: e } = this.context;
221
- for (let n = 0; n < this.props.length; ++n) if (e[this.props[n].start] === ie.COMMENT) return true;
222
- }
223
- return false;
224
- }
225
- get hasProps() {
226
- if (this.context) {
227
- let { src: e } = this.context;
228
- for (let n = 0; n < this.props.length; ++n) if (e[this.props[n].start] !== ie.COMMENT) return true;
229
- }
230
- return false;
231
- }
232
- get includesTrailingLines() {
233
- return false;
234
- }
235
- get jsonLike() {
236
- return [st.FLOW_MAP, st.FLOW_SEQ, st.QUOTE_DOUBLE, st.QUOTE_SINGLE].indexOf(this.type) !== -1;
237
- }
238
- get rangeAsLinePos() {
239
- if (!this.range || !this.context) return;
240
- let e = wn(this.range.start, this.context.root);
241
- if (!e) return;
242
- let n = wn(this.range.end, this.context.root);
243
- return { start: e, end: n };
244
- }
245
- get rawValue() {
246
- if (!this.valueRange || !this.context) return null;
247
- let { start: e, end: n } = this.valueRange;
248
- return this.context.src.slice(e, n);
249
- }
250
- get tag() {
251
- for (let e = 0; e < this.props.length; ++e) {
252
- let n = this.getPropValue(e, ie.TAG, false);
253
- if (n != null) {
254
- if (n[1] === "<") return { verbatim: n.slice(2, -1) };
255
- {
256
- let [r, s, i] = n.match(/^(.*!)([^!]*)$/);
257
- return { handle: s, suffix: i };
258
- }
259
- }
260
- }
261
- return null;
262
- }
263
- get valueRangeContainsNewline() {
264
- if (!this.valueRange || !this.context) return false;
265
- let { start: e, end: n } = this.valueRange, { src: r } = this.context;
266
- for (let s = e; s < n; ++s) if (r[s] === `
267
- `) return true;
268
- return false;
269
- }
270
- parseComment(e) {
271
- let { src: n } = this.context;
272
- if (n[e] === ie.COMMENT) {
273
- let r = t.endOfLine(n, e + 1), s = new xe(e, r);
274
- return this.props.push(s), r;
275
- }
276
- return e;
277
- }
278
- setOrigRanges(e, n) {
279
- return this.range && (n = this.range.setOrigRange(e, n)), this.valueRange && this.valueRange.setOrigRange(e, n), this.props.forEach((r) => r.setOrigRange(e, n)), n;
280
- }
281
- toString() {
282
- let { context: { src: e }, range: n, value: r } = this;
283
- if (r != null) return r;
284
- let s = e.slice(n.start, n.end);
285
- return t.addStringTerminator(e, n.end, s);
286
- }
287
- }, ge = class extends Error {
288
- constructor(e, n, r) {
289
- if (!r || !(n instanceof oe)) throw new Error(`Invalid arguments for new ${e}`);
290
- super(), this.name = e, this.message = r, this.source = n;
291
- }
292
- makePretty() {
293
- if (!this.source) return;
294
- this.nodeType = this.source.type;
295
- let e = this.source.context && this.source.context.root;
296
- if (typeof this.offset == "number") {
297
- this.range = new xe(this.offset, this.offset + 1);
298
- let n = e && wn(this.offset, e);
299
- if (n) {
300
- let r = { line: n.line, col: n.col + 1 };
301
- this.linePos = { start: n, end: r };
302
- }
303
- delete this.offset;
304
- } else this.range = this.source.range, this.linePos = this.source.rangeAsLinePos;
305
- if (this.linePos) {
306
- let { line: n, col: r } = this.linePos.start;
307
- this.message += ` at line ${n}, column ${r}`;
308
- let s = e && yo(this.linePos, e);
309
- s && (this.message += `:
310
-
311
- ${s}
312
- `);
313
- }
314
- delete this.source;
315
- }
316
- }, bn = class extends ge {
317
- constructor(e, n) {
318
- super("YAMLReferenceError", e, n);
319
- }
320
- }, it = class extends ge {
321
- constructor(e, n) {
322
- super("YAMLSemanticError", e, n);
323
- }
324
- }, Nn = class extends ge {
325
- constructor(e, n) {
326
- super("YAMLSyntaxError", e, n);
327
- }
328
- }, On = class extends ge {
329
- constructor(e, n) {
330
- super("YAMLWarning", e, n);
331
- }
332
- };
333
- function Eo(t, e, n) {
334
- return e in t ? Object.defineProperty(t, e, { value: n, enumerable: true, configurable: true, writable: true }) : t[e] = n, t;
335
- }
336
- var An = class t extends oe {
337
- static endOfLine(e, n, r) {
338
- let s = e[n], i = n;
339
- for (; s && s !== `
340
- ` && !(r && (s === "[" || s === "]" || s === "{" || s === "}" || s === ",")); ) {
341
- let o = e[i + 1];
342
- if (s === ":" && (!o || o === `
343
- ` || o === " " || o === " " || r && o === ",") || (s === " " || s === " ") && o === "#") break;
344
- i += 1, s = o;
345
- }
346
- return i;
347
- }
348
- get strValue() {
349
- if (!this.valueRange || !this.context) return null;
350
- let { start: e, end: n } = this.valueRange, { src: r } = this.context, s = r[n - 1];
351
- for (; e < n && (s === `
352
- ` || s === " " || s === " "); ) s = r[--n - 1];
353
- let i = "";
354
- for (let a = e; a < n; ++a) {
355
- let c = r[a];
356
- if (c === `
357
- `) {
358
- let { fold: l, offset: f } = oe.foldNewline(r, a, -1);
359
- i += l, a = f;
360
- } else if (c === " " || c === " ") {
361
- let l = a, f = r[a + 1];
362
- for (; a < n && (f === " " || f === " "); ) a += 1, f = r[a + 1];
363
- f !== `
364
- ` && (i += a > l ? r.slice(l, a + 1) : c);
365
- } else i += c;
366
- }
367
- let o = r[e];
368
- switch (o) {
369
- case " ": {
370
- let a = "Plain value cannot start with a tab character";
371
- return { errors: [new it(this, a)], str: i };
372
- }
373
- case "@":
374
- case "`": {
375
- let a = `Plain value cannot start with reserved character ${o}`;
376
- return { errors: [new it(this, a)], str: i };
377
- }
378
- default:
379
- return i;
380
- }
381
- }
382
- parseBlockValue(e) {
383
- let { indent: n, inFlow: r, src: s } = this.context, i = e, o = e;
384
- for (let a = s[i]; a === `
385
- ` && !oe.atDocumentBoundary(s, i + 1); a = s[i]) {
386
- let c = oe.endOfBlockIndent(s, n, i + 1);
387
- if (c === null || s[c] === "#") break;
388
- s[c] === `
389
- ` ? i = c : (o = t.endOfLine(s, c, r), i = o);
390
- }
391
- return this.valueRange.isEmpty() && (this.valueRange.start = e), this.valueRange.end = o, o;
392
- }
393
- parse(e, n) {
394
- this.context = e;
395
- let { inFlow: r, src: s } = e, i = n, o = s[i];
396
- return o && o !== "#" && o !== `
397
- ` && (i = t.endOfLine(s, n, r)), this.valueRange = new xe(n, i), i = oe.endOfWhiteSpace(s, i), i = this.parseComment(i), (!this.hasComment || this.valueRange.isEmpty()) && (i = this.parseBlockValue(i)), i;
398
- }
399
- };
400
- B.Char = ie;
401
- B.Node = oe;
402
- B.PlainValue = An;
403
- B.Range = xe;
404
- B.Type = st;
405
- B.YAMLError = ge;
406
- B.YAMLReferenceError = bn;
407
- B.YAMLSemanticError = it;
408
- B.YAMLSyntaxError = Nn;
409
- B.YAMLWarning = On;
410
- B._defineProperty = Eo;
411
- B.defaultTagPrefix = mo;
412
- B.defaultTags = ho;
413
- });
414
- var Qr = ne((jr) => {
415
- "use strict";
416
- var u = ce(), Ee = class extends u.Node {
417
- constructor() {
418
- super(u.Type.BLANK_LINE);
419
- }
420
- get includesTrailingLines() {
421
- return true;
422
- }
423
- parse(e, n) {
424
- return this.context = e, this.range = new u.Range(n, n + 1), n + 1;
425
- }
426
- }, ot = class extends u.Node {
427
- constructor(e, n) {
428
- super(e, n), this.node = null;
429
- }
430
- get includesTrailingLines() {
431
- return !!this.node && this.node.includesTrailingLines;
432
- }
433
- parse(e, n) {
434
- this.context = e;
435
- let { parseNode: r, src: s } = e, { atLineStart: i, lineStart: o } = e;
436
- !i && this.type === u.Type.SEQ_ITEM && (this.error = new u.YAMLSemanticError(this, "Sequence items must not have preceding content on the same line"));
437
- let a = i ? n - o : e.indent, c = u.Node.endOfWhiteSpace(s, n + 1), l = s[c], f = l === "#", m = [], g = null;
438
- for (; l === `
439
- ` || l === "#"; ) {
440
- if (l === "#") {
441
- let h = u.Node.endOfLine(s, c + 1);
442
- m.push(new u.Range(c, h)), c = h;
443
- } else {
444
- i = true, o = c + 1;
445
- let h = u.Node.endOfWhiteSpace(s, o);
446
- s[h] === `
447
- ` && m.length === 0 && (g = new Ee(), o = g.parse({ src: s }, o)), c = u.Node.endOfIndent(s, o);
448
- }
449
- l = s[c];
450
- }
451
- if (u.Node.nextNodeIsIndented(l, c - (o + a), this.type !== u.Type.SEQ_ITEM) ? this.node = r({ atLineStart: i, inCollection: false, indent: a, lineStart: o, parent: this }, c) : l && o > n + 1 && (c = o - 1), this.node) {
452
- if (g) {
453
- let h = e.parent.items || e.parent.contents;
454
- h && h.push(g);
455
- }
456
- m.length && Array.prototype.push.apply(this.props, m), c = this.node.range.end;
457
- } else if (f) {
458
- let h = m[0];
459
- this.props.push(h), c = h.end;
460
- } else c = u.Node.endOfLine(s, n + 1);
461
- let y = this.node ? this.node.valueRange.end : c;
462
- return this.valueRange = new u.Range(n, y), c;
463
- }
464
- setOrigRanges(e, n) {
465
- return n = super.setOrigRanges(e, n), this.node ? this.node.setOrigRanges(e, n) : n;
466
- }
467
- toString() {
468
- let { context: { src: e }, node: n, range: r, value: s } = this;
469
- if (s != null) return s;
470
- let i = n ? e.slice(r.start, n.range.start) + String(n) : e.slice(r.start, r.end);
471
- return u.Node.addStringTerminator(e, r.end, i);
472
- }
473
- }, ye = class extends u.Node {
474
- constructor() {
475
- super(u.Type.COMMENT);
476
- }
477
- parse(e, n) {
478
- this.context = e;
479
- let r = this.parseComment(n);
480
- return this.range = new u.Range(n, r), r;
481
- }
482
- };
483
- function Ln(t) {
484
- let e = t;
485
- for (; e instanceof ot; ) e = e.node;
486
- if (!(e instanceof It)) return null;
487
- let n = e.items.length, r = -1;
488
- for (let o = n - 1; o >= 0; --o) {
489
- let a = e.items[o];
490
- if (a.type === u.Type.COMMENT) {
491
- let { indent: c, lineStart: l } = a.context;
492
- if (c > 0 && a.range.start >= l + c) break;
493
- r = o;
494
- } else if (a.type === u.Type.BLANK_LINE) r = o;
495
- else break;
496
- }
497
- if (r === -1) return null;
498
- let s = e.items.splice(r, n - r), i = s[0].range.start;
499
- for (; e.range.end = i, e.valueRange && e.valueRange.end > i && (e.valueRange.end = i), e !== t; ) e = e.context.parent;
500
- return s;
501
- }
502
- var It = class t extends u.Node {
503
- static nextContentHasIndent(e, n, r) {
504
- let s = u.Node.endOfLine(e, n) + 1;
505
- n = u.Node.endOfWhiteSpace(e, s);
506
- let i = e[n];
507
- return i ? n >= s + r ? true : i !== "#" && i !== `
508
- ` ? false : t.nextContentHasIndent(e, n, r) : false;
509
- }
510
- constructor(e) {
511
- super(e.type === u.Type.SEQ_ITEM ? u.Type.SEQ : u.Type.MAP);
512
- for (let r = e.props.length - 1; r >= 0; --r) if (e.props[r].start < e.context.lineStart) {
513
- this.props = e.props.slice(0, r + 1), e.props = e.props.slice(r + 1);
514
- let s = e.props[0] || e.valueRange;
515
- e.range.start = s.start;
516
- break;
517
- }
518
- this.items = [e];
519
- let n = Ln(e);
520
- n && Array.prototype.push.apply(this.items, n);
521
- }
522
- get includesTrailingLines() {
523
- return this.items.length > 0;
524
- }
525
- parse(e, n) {
526
- this.context = e;
527
- let { parseNode: r, src: s } = e, i = u.Node.startOfLine(s, n), o = this.items[0];
528
- o.context.parent = this, this.valueRange = u.Range.copy(o.valueRange);
529
- let a = o.range.start - o.context.lineStart, c = n;
530
- c = u.Node.normalizeOffset(s, c);
531
- let l = s[c], f = u.Node.endOfWhiteSpace(s, i) === c, m = false;
532
- for (; l; ) {
533
- for (; l === `
534
- ` || l === "#"; ) {
535
- if (f && l === `
536
- ` && !m) {
537
- let h = new Ee();
538
- if (c = h.parse({ src: s }, c), this.valueRange.end = c, c >= s.length) {
539
- l = null;
540
- break;
541
- }
542
- this.items.push(h), c -= 1;
543
- } else if (l === "#") {
544
- if (c < i + a && !t.nextContentHasIndent(s, c, a)) return c;
545
- let h = new ye();
546
- if (c = h.parse({ indent: a, lineStart: i, src: s }, c), this.items.push(h), this.valueRange.end = c, c >= s.length) {
547
- l = null;
548
- break;
549
- }
550
- }
551
- if (i = c + 1, c = u.Node.endOfIndent(s, i), u.Node.atBlank(s, c)) {
552
- let h = u.Node.endOfWhiteSpace(s, c), d = s[h];
553
- (!d || d === `
554
- ` || d === "#") && (c = h);
555
- }
556
- l = s[c], f = true;
557
- }
558
- if (!l) break;
559
- if (c !== i + a && (f || l !== ":")) {
560
- if (c < i + a) {
561
- i > n && (c = i);
562
- break;
563
- } else if (!this.error) {
564
- let h = "All collection items must start at the same column";
565
- this.error = new u.YAMLSyntaxError(this, h);
566
- }
567
- }
568
- if (o.type === u.Type.SEQ_ITEM) {
569
- if (l !== "-") {
570
- i > n && (c = i);
571
- break;
572
- }
573
- } else if (l === "-" && !this.error) {
574
- let h = s[c + 1];
575
- if (!h || h === `
576
- ` || h === " " || h === " ") {
577
- let d = "A collection cannot be both a mapping and a sequence";
578
- this.error = new u.YAMLSyntaxError(this, d);
579
- }
580
- }
581
- let g = r({ atLineStart: f, inCollection: true, indent: a, lineStart: i, parent: this }, c);
582
- if (!g) return c;
583
- if (this.items.push(g), this.valueRange.end = g.valueRange.end, c = u.Node.normalizeOffset(s, g.range.end), l = s[c], f = false, m = g.includesTrailingLines, l) {
584
- let h = c - 1, d = s[h];
585
- for (; d === " " || d === " "; ) d = s[--h];
586
- d === `
587
- ` && (i = h + 1, f = true);
588
- }
589
- let y = Ln(g);
590
- y && Array.prototype.push.apply(this.items, y);
591
- }
592
- return c;
593
- }
594
- setOrigRanges(e, n) {
595
- return n = super.setOrigRanges(e, n), this.items.forEach((r) => {
596
- n = r.setOrigRanges(e, n);
597
- }), n;
598
- }
599
- toString() {
600
- let { context: { src: e }, items: n, range: r, value: s } = this;
601
- if (s != null) return s;
602
- let i = e.slice(r.start, n[0].range.start) + String(n[0]);
603
- for (let o = 1; o < n.length; ++o) {
604
- let a = n[o], { atLineStart: c, indent: l } = a.context;
605
- if (c) for (let f = 0; f < l; ++f) i += " ";
606
- i += String(a);
607
- }
608
- return u.Node.addStringTerminator(e, r.end, i);
609
- }
610
- }, Tn = class extends u.Node {
611
- constructor() {
612
- super(u.Type.DIRECTIVE), this.name = null;
613
- }
614
- get parameters() {
615
- let e = this.rawValue;
616
- return e ? e.trim().split(/[ \t]+/) : [];
617
- }
618
- parseName(e) {
619
- let { src: n } = this.context, r = e, s = n[r];
620
- for (; s && s !== `
621
- ` && s !== " " && s !== " "; ) s = n[r += 1];
622
- return this.name = n.slice(e, r), r;
623
- }
624
- parseParameters(e) {
625
- let { src: n } = this.context, r = e, s = n[r];
626
- for (; s && s !== `
627
- ` && s !== "#"; ) s = n[r += 1];
628
- return this.valueRange = new u.Range(e, r), r;
629
- }
630
- parse(e, n) {
631
- this.context = e;
632
- let r = this.parseName(n + 1);
633
- return r = this.parseParameters(r), r = this.parseComment(r), this.range = new u.Range(n, r), r;
634
- }
635
- }, Cn = class t extends u.Node {
636
- static startCommentOrEndBlankLine(e, n) {
637
- let r = u.Node.endOfWhiteSpace(e, n), s = e[r];
638
- return s === "#" || s === `
639
- ` ? r : n;
640
- }
641
- constructor() {
642
- super(u.Type.DOCUMENT), this.directives = null, this.contents = null, this.directivesEndMarker = null, this.documentEndMarker = null;
643
- }
644
- parseDirectives(e) {
645
- let { src: n } = this.context;
646
- this.directives = [];
647
- let r = true, s = false, i = e;
648
- for (; !u.Node.atDocumentBoundary(n, i, u.Char.DIRECTIVES_END); ) switch (i = t.startCommentOrEndBlankLine(n, i), n[i]) {
649
- case `
650
- `:
651
- if (r) {
652
- let o = new Ee();
653
- i = o.parse({ src: n }, i), i < n.length && this.directives.push(o);
654
- } else i += 1, r = true;
655
- break;
656
- case "#":
657
- {
658
- let o = new ye();
659
- i = o.parse({ src: n }, i), this.directives.push(o), r = false;
660
- }
661
- break;
662
- case "%":
663
- {
664
- let o = new Tn();
665
- i = o.parse({ parent: this, src: n }, i), this.directives.push(o), s = true, r = false;
666
- }
667
- break;
668
- default:
669
- return s ? this.error = new u.YAMLSemanticError(this, "Missing directives-end indicator line") : this.directives.length > 0 && (this.contents = this.directives, this.directives = []), i;
670
- }
671
- return n[i] ? (this.directivesEndMarker = new u.Range(i, i + 3), i + 3) : (s ? this.error = new u.YAMLSemanticError(this, "Missing directives-end indicator line") : this.directives.length > 0 && (this.contents = this.directives, this.directives = []), i);
672
- }
673
- parseContents(e) {
674
- let { parseNode: n, src: r } = this.context;
675
- this.contents || (this.contents = []);
676
- let s = e;
677
- for (; r[s - 1] === "-"; ) s -= 1;
678
- let i = u.Node.endOfWhiteSpace(r, e), o = s === e;
679
- for (this.valueRange = new u.Range(i); !u.Node.atDocumentBoundary(r, i, u.Char.DOCUMENT_END); ) {
680
- switch (r[i]) {
681
- case `
682
- `:
683
- if (o) {
684
- let a = new Ee();
685
- i = a.parse({ src: r }, i), i < r.length && this.contents.push(a);
686
- } else i += 1, o = true;
687
- s = i;
688
- break;
689
- case "#":
690
- {
691
- let a = new ye();
692
- i = a.parse({ src: r }, i), this.contents.push(a), o = false;
693
- }
694
- break;
695
- default: {
696
- let a = u.Node.endOfIndent(r, i), l = n({ atLineStart: o, indent: -1, inFlow: false, inCollection: false, lineStart: s, parent: this }, a);
697
- if (!l) return this.valueRange.end = a;
698
- this.contents.push(l), i = l.range.end, o = false;
699
- let f = Ln(l);
700
- f && Array.prototype.push.apply(this.contents, f);
701
- }
702
- }
703
- i = t.startCommentOrEndBlankLine(r, i);
704
- }
705
- if (this.valueRange.end = i, r[i] && (this.documentEndMarker = new u.Range(i, i + 3), i += 3, r[i])) {
706
- if (i = u.Node.endOfWhiteSpace(r, i), r[i] === "#") {
707
- let a = new ye();
708
- i = a.parse({ src: r }, i), this.contents.push(a);
709
- }
710
- switch (r[i]) {
711
- case `
712
- `:
713
- i += 1;
714
- break;
715
- case void 0:
716
- break;
717
- default:
718
- this.error = new u.YAMLSyntaxError(this, "Document end marker line cannot have a non-comment suffix");
719
- }
720
- }
721
- return i;
722
- }
723
- parse(e, n) {
724
- e.root = this, this.context = e;
725
- let { src: r } = e, s = r.charCodeAt(n) === 65279 ? n + 1 : n;
726
- return s = this.parseDirectives(s), s = this.parseContents(s), s;
727
- }
728
- setOrigRanges(e, n) {
729
- return n = super.setOrigRanges(e, n), this.directives.forEach((r) => {
730
- n = r.setOrigRanges(e, n);
731
- }), this.directivesEndMarker && (n = this.directivesEndMarker.setOrigRange(e, n)), this.contents.forEach((r) => {
732
- n = r.setOrigRanges(e, n);
733
- }), this.documentEndMarker && (n = this.documentEndMarker.setOrigRange(e, n)), n;
734
- }
735
- toString() {
736
- let { contents: e, directives: n, value: r } = this;
737
- if (r != null) return r;
738
- let s = n.join("");
739
- return e.length > 0 && ((n.length > 0 || e[0].type === u.Type.COMMENT) && (s += `---
740
- `), s += e.join("")), s[s.length - 1] !== `
741
- ` && (s += `
742
- `), s;
743
- }
744
- }, Mn = class extends u.Node {
745
- parse(e, n) {
746
- this.context = e;
747
- let { src: r } = e, s = u.Node.endOfIdentifier(r, n + 1);
748
- return this.valueRange = new u.Range(n + 1, s), s = u.Node.endOfWhiteSpace(r, s), s = this.parseComment(s), s;
749
- }
750
- }, le = { CLIP: "CLIP", KEEP: "KEEP", STRIP: "STRIP" }, kn = class extends u.Node {
751
- constructor(e, n) {
752
- super(e, n), this.blockIndent = null, this.chomping = le.CLIP, this.header = null;
753
- }
754
- get includesTrailingLines() {
755
- return this.chomping === le.KEEP;
756
- }
757
- get strValue() {
758
- if (!this.valueRange || !this.context) return null;
759
- let { start: e, end: n } = this.valueRange, { indent: r, src: s } = this.context;
760
- if (this.valueRange.isEmpty()) return "";
761
- let i = null, o = s[n - 1];
762
- for (; o === `
763
- ` || o === " " || o === " "; ) {
764
- if (n -= 1, n <= e) {
765
- if (this.chomping === le.KEEP) break;
766
- return "";
767
- }
768
- o === `
769
- ` && (i = n), o = s[n - 1];
770
- }
771
- let a = n + 1;
772
- i && (this.chomping === le.KEEP ? (a = i, n = this.valueRange.end) : n = i);
773
- let c = r + this.blockIndent, l = this.type === u.Type.BLOCK_FOLDED, f = true, m = "", g = "", y = false;
774
- for (let h = e; h < n; ++h) {
775
- for (let w = 0; w < c && s[h] === " "; ++w) h += 1;
776
- let d = s[h];
777
- if (d === `
778
- `) g === `
779
- ` ? m += `
780
- ` : g = `
781
- `;
782
- else {
783
- let w = u.Node.endOfLine(s, h), P = s.slice(h, w);
784
- h = w, l && (d === " " || d === " ") && h < a ? (g === " " ? g = `
785
- ` : !y && !f && g === `
786
- ` && (g = `
787
-
788
- `), m += g + P, g = w < n && s[w] || "", y = true) : (m += g + P, g = l && h < a ? " " : `
789
- `, y = false), f && P !== "" && (f = false);
790
- }
791
- }
792
- return this.chomping === le.STRIP ? m : m + `
793
- `;
794
- }
795
- parseBlockHeader(e) {
796
- let { src: n } = this.context, r = e + 1, s = "";
797
- for (; ; ) {
798
- let i = n[r];
799
- switch (i) {
800
- case "-":
801
- this.chomping = le.STRIP;
802
- break;
803
- case "+":
804
- this.chomping = le.KEEP;
805
- break;
806
- case "0":
807
- case "1":
808
- case "2":
809
- case "3":
810
- case "4":
811
- case "5":
812
- case "6":
813
- case "7":
814
- case "8":
815
- case "9":
816
- s += i;
817
- break;
818
- default:
819
- return this.blockIndent = Number(s) || null, this.header = new u.Range(e, r), r;
820
- }
821
- r += 1;
822
- }
823
- }
824
- parseBlockValue(e) {
825
- let { indent: n, src: r } = this.context, s = !!this.blockIndent, i = e, o = e, a = 1;
826
- for (let c = r[i]; c === `
827
- ` && (i += 1, !u.Node.atDocumentBoundary(r, i)); c = r[i]) {
828
- let l = u.Node.endOfBlockIndent(r, n, i);
829
- if (l === null) break;
830
- let f = r[l], m = l - (i + n);
831
- if (this.blockIndent) {
832
- if (f && f !== `
833
- ` && m < this.blockIndent) {
834
- if (r[l] === "#") break;
835
- if (!this.error) {
836
- let y = `Block scalars must not be less indented than their ${s ? "explicit indentation indicator" : "first line"}`;
837
- this.error = new u.YAMLSemanticError(this, y);
838
- }
839
- }
840
- } else if (r[l] !== `
841
- `) {
842
- if (m < a) {
843
- let g = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator";
844
- this.error = new u.YAMLSemanticError(this, g);
845
- }
846
- this.blockIndent = m;
847
- } else m > a && (a = m);
848
- r[l] === `
849
- ` ? i = l : i = o = u.Node.endOfLine(r, l);
850
- }
851
- return this.chomping !== le.KEEP && (i = r[o] ? o + 1 : o), this.valueRange = new u.Range(e + 1, i), i;
852
- }
853
- parse(e, n) {
854
- this.context = e;
855
- let { src: r } = e, s = this.parseBlockHeader(n);
856
- return s = u.Node.endOfWhiteSpace(r, s), s = this.parseComment(s), s = this.parseBlockValue(s), s;
857
- }
858
- setOrigRanges(e, n) {
859
- return n = super.setOrigRanges(e, n), this.header ? this.header.setOrigRange(e, n) : n;
860
- }
861
- }, Pn = class extends u.Node {
862
- constructor(e, n) {
863
- super(e, n), this.items = null;
864
- }
865
- prevNodeIsJsonLike(e = this.items.length) {
866
- let n = this.items[e - 1];
867
- return !!n && (n.jsonLike || n.type === u.Type.COMMENT && this.prevNodeIsJsonLike(e - 1));
868
- }
869
- parse(e, n) {
870
- this.context = e;
871
- let { parseNode: r, src: s } = e, { indent: i, lineStart: o } = e, a = s[n];
872
- this.items = [{ char: a, offset: n }];
873
- let c = u.Node.endOfWhiteSpace(s, n + 1);
874
- for (a = s[c]; a && a !== "]" && a !== "}"; ) {
875
- switch (a) {
876
- case `
877
- `:
878
- {
879
- o = c + 1;
880
- let l = u.Node.endOfWhiteSpace(s, o);
881
- if (s[l] === `
882
- `) {
883
- let f = new Ee();
884
- o = f.parse({ src: s }, o), this.items.push(f);
885
- }
886
- if (c = u.Node.endOfIndent(s, o), c <= o + i && (a = s[c], c < o + i || a !== "]" && a !== "}")) {
887
- let f = "Insufficient indentation in flow collection";
888
- this.error = new u.YAMLSemanticError(this, f);
889
- }
890
- }
891
- break;
892
- case ",":
893
- this.items.push({ char: a, offset: c }), c += 1;
894
- break;
895
- case "#":
896
- {
897
- let l = new ye();
898
- c = l.parse({ src: s }, c), this.items.push(l);
899
- }
900
- break;
901
- case "?":
902
- case ":": {
903
- let l = s[c + 1];
904
- if (l === `
905
- ` || l === " " || l === " " || l === "," || a === ":" && this.prevNodeIsJsonLike()) {
906
- this.items.push({ char: a, offset: c }), c += 1;
907
- break;
908
- }
909
- }
910
- default: {
911
- let l = r({ atLineStart: false, inCollection: false, inFlow: true, indent: -1, lineStart: o, parent: this }, c);
912
- if (!l) return this.valueRange = new u.Range(n, c), c;
913
- this.items.push(l), c = u.Node.normalizeOffset(s, l.range.end);
914
- }
915
- }
916
- c = u.Node.endOfWhiteSpace(s, c), a = s[c];
917
- }
918
- return this.valueRange = new u.Range(n, c + 1), a && (this.items.push({ char: a, offset: c }), c = u.Node.endOfWhiteSpace(s, c + 1), c = this.parseComment(c)), c;
919
- }
920
- setOrigRanges(e, n) {
921
- return n = super.setOrigRanges(e, n), this.items.forEach((r) => {
922
- if (r instanceof u.Node) n = r.setOrigRanges(e, n);
923
- else if (e.length === 0) r.origOffset = r.offset;
924
- else {
925
- let s = n;
926
- for (; s < e.length && !(e[s] > r.offset); ) ++s;
927
- r.origOffset = r.offset + s, n = s;
928
- }
929
- }), n;
930
- }
931
- toString() {
932
- let { context: { src: e }, items: n, range: r, value: s } = this;
933
- if (s != null) return s;
934
- let i = n.filter((c) => c instanceof u.Node), o = "", a = r.start;
935
- return i.forEach((c) => {
936
- let l = e.slice(a, c.range.start);
937
- a = c.range.end, o += l + String(c), o[o.length - 1] === `
938
- ` && e[a - 1] !== `
939
- ` && e[a] === `
940
- ` && (a += 1);
941
- }), o += e.slice(a, r.end), u.Node.addStringTerminator(e, r.end, o);
942
- }
943
- }, vn = class t extends u.Node {
944
- static endOfQuote(e, n) {
945
- let r = e[n];
946
- for (; r && r !== '"'; ) n += r === "\\" ? 2 : 1, r = e[n];
947
- return n + 1;
948
- }
949
- get strValue() {
950
- if (!this.valueRange || !this.context) return null;
951
- let e = [], { start: n, end: r } = this.valueRange, { indent: s, src: i } = this.context;
952
- i[r - 1] !== '"' && e.push(new u.YAMLSyntaxError(this, 'Missing closing "quote'));
953
- let o = "";
954
- for (let a = n + 1; a < r - 1; ++a) {
955
- let c = i[a];
956
- if (c === `
957
- `) {
958
- u.Node.atDocumentBoundary(i, a + 1) && e.push(new u.YAMLSemanticError(this, "Document boundary indicators are not allowed within string values"));
959
- let { fold: l, offset: f, error: m } = u.Node.foldNewline(i, a, s);
960
- o += l, a = f, m && e.push(new u.YAMLSemanticError(this, "Multi-line double-quoted string needs to be sufficiently indented"));
961
- } else if (c === "\\") switch (a += 1, i[a]) {
962
- case "0":
963
- o += "\0";
964
- break;
965
- case "a":
966
- o += "\x07";
967
- break;
968
- case "b":
969
- o += "\b";
970
- break;
971
- case "e":
972
- o += "\x1B";
973
- break;
974
- case "f":
975
- o += "\f";
976
- break;
977
- case "n":
978
- o += `
979
- `;
980
- break;
981
- case "r":
982
- o += "\r";
983
- break;
984
- case "t":
985
- o += " ";
986
- break;
987
- case "v":
988
- o += "\v";
989
- break;
990
- case "N":
991
- o += "\x85";
992
- break;
993
- case "_":
994
- o += "\xA0";
995
- break;
996
- case "L":
997
- o += "\u2028";
998
- break;
999
- case "P":
1000
- o += "\u2029";
1001
- break;
1002
- case " ":
1003
- o += " ";
1004
- break;
1005
- case '"':
1006
- o += '"';
1007
- break;
1008
- case "/":
1009
- o += "/";
1010
- break;
1011
- case "\\":
1012
- o += "\\";
1013
- break;
1014
- case " ":
1015
- o += " ";
1016
- break;
1017
- case "x":
1018
- o += this.parseCharCode(a + 1, 2, e), a += 2;
1019
- break;
1020
- case "u":
1021
- o += this.parseCharCode(a + 1, 4, e), a += 4;
1022
- break;
1023
- case "U":
1024
- o += this.parseCharCode(a + 1, 8, e), a += 8;
1025
- break;
1026
- case `
1027
- `:
1028
- for (; i[a + 1] === " " || i[a + 1] === " "; ) a += 1;
1029
- break;
1030
- default:
1031
- e.push(new u.YAMLSyntaxError(this, `Invalid escape sequence ${i.substr(a - 1, 2)}`)), o += "\\" + i[a];
1032
- }
1033
- else if (c === " " || c === " ") {
1034
- let l = a, f = i[a + 1];
1035
- for (; f === " " || f === " "; ) a += 1, f = i[a + 1];
1036
- f !== `
1037
- ` && (o += a > l ? i.slice(l, a + 1) : c);
1038
- } else o += c;
1039
- }
1040
- return e.length > 0 ? { errors: e, str: o } : o;
1041
- }
1042
- parseCharCode(e, n, r) {
1043
- let { src: s } = this.context, i = s.substr(e, n), a = i.length === n && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
1044
- return isNaN(a) ? (r.push(new u.YAMLSyntaxError(this, `Invalid escape sequence ${s.substr(e - 2, n + 2)}`)), s.substr(e - 2, n + 2)) : String.fromCodePoint(a);
1045
- }
1046
- parse(e, n) {
1047
- this.context = e;
1048
- let { src: r } = e, s = t.endOfQuote(r, n + 1);
1049
- return this.valueRange = new u.Range(n, s), s = u.Node.endOfWhiteSpace(r, s), s = this.parseComment(s), s;
1050
- }
1051
- }, In = class t extends u.Node {
1052
- static endOfQuote(e, n) {
1053
- let r = e[n];
1054
- for (; r; ) if (r === "'") {
1055
- if (e[n + 1] !== "'") break;
1056
- r = e[n += 2];
1057
- } else r = e[n += 1];
1058
- return n + 1;
1059
- }
1060
- get strValue() {
1061
- if (!this.valueRange || !this.context) return null;
1062
- let e = [], { start: n, end: r } = this.valueRange, { indent: s, src: i } = this.context;
1063
- i[r - 1] !== "'" && e.push(new u.YAMLSyntaxError(this, "Missing closing 'quote"));
1064
- let o = "";
1065
- for (let a = n + 1; a < r - 1; ++a) {
1066
- let c = i[a];
1067
- if (c === `
1068
- `) {
1069
- u.Node.atDocumentBoundary(i, a + 1) && e.push(new u.YAMLSemanticError(this, "Document boundary indicators are not allowed within string values"));
1070
- let { fold: l, offset: f, error: m } = u.Node.foldNewline(i, a, s);
1071
- o += l, a = f, m && e.push(new u.YAMLSemanticError(this, "Multi-line single-quoted string needs to be sufficiently indented"));
1072
- } else if (c === "'") o += c, a += 1, i[a] !== "'" && e.push(new u.YAMLSyntaxError(this, "Unescaped single quote? This should not happen."));
1073
- else if (c === " " || c === " ") {
1074
- let l = a, f = i[a + 1];
1075
- for (; f === " " || f === " "; ) a += 1, f = i[a + 1];
1076
- f !== `
1077
- ` && (o += a > l ? i.slice(l, a + 1) : c);
1078
- } else o += c;
1079
- }
1080
- return e.length > 0 ? { errors: e, str: o } : o;
1081
- }
1082
- parse(e, n) {
1083
- this.context = e;
1084
- let { src: r } = e, s = t.endOfQuote(r, n + 1);
1085
- return this.valueRange = new u.Range(n, s), s = u.Node.endOfWhiteSpace(r, s), s = this.parseComment(s), s;
1086
- }
1087
- };
1088
- function So(t, e) {
1089
- switch (t) {
1090
- case u.Type.ALIAS:
1091
- return new Mn(t, e);
1092
- case u.Type.BLOCK_FOLDED:
1093
- case u.Type.BLOCK_LITERAL:
1094
- return new kn(t, e);
1095
- case u.Type.FLOW_MAP:
1096
- case u.Type.FLOW_SEQ:
1097
- return new Pn(t, e);
1098
- case u.Type.MAP_KEY:
1099
- case u.Type.MAP_VALUE:
1100
- case u.Type.SEQ_ITEM:
1101
- return new ot(t, e);
1102
- case u.Type.COMMENT:
1103
- case u.Type.PLAIN:
1104
- return new u.PlainValue(t, e);
1105
- case u.Type.QUOTE_DOUBLE:
1106
- return new vn(t, e);
1107
- case u.Type.QUOTE_SINGLE:
1108
- return new In(t, e);
1109
- default:
1110
- return null;
1111
- }
1112
- }
1113
- var _n = class t {
1114
- static parseType(e, n, r) {
1115
- switch (e[n]) {
1116
- case "*":
1117
- return u.Type.ALIAS;
1118
- case ">":
1119
- return u.Type.BLOCK_FOLDED;
1120
- case "|":
1121
- return u.Type.BLOCK_LITERAL;
1122
- case "{":
1123
- return u.Type.FLOW_MAP;
1124
- case "[":
1125
- return u.Type.FLOW_SEQ;
1126
- case "?":
1127
- return !r && u.Node.atBlank(e, n + 1, true) ? u.Type.MAP_KEY : u.Type.PLAIN;
1128
- case ":":
1129
- return !r && u.Node.atBlank(e, n + 1, true) ? u.Type.MAP_VALUE : u.Type.PLAIN;
1130
- case "-":
1131
- return !r && u.Node.atBlank(e, n + 1, true) ? u.Type.SEQ_ITEM : u.Type.PLAIN;
1132
- case '"':
1133
- return u.Type.QUOTE_DOUBLE;
1134
- case "'":
1135
- return u.Type.QUOTE_SINGLE;
1136
- default:
1137
- return u.Type.PLAIN;
1138
- }
1139
- }
1140
- constructor(e = {}, { atLineStart: n, inCollection: r, inFlow: s, indent: i, lineStart: o, parent: a } = {}) {
1141
- u._defineProperty(this, "parseNode", (c, l) => {
1142
- if (u.Node.atDocumentBoundary(this.src, l)) return null;
1143
- let f = new t(this, c), { props: m, type: g, valueStart: y } = f.parseProps(l), h = So(g, m), d = h.parse(f, y);
1144
- if (h.range = new u.Range(l, d), d <= l && (h.error = new Error("Node#parse consumed no characters"), h.error.parseEnd = d, h.error.source = h, h.range.end = l + 1), f.nodeStartsCollection(h)) {
1145
- !h.error && !f.atLineStart && f.parent.type === u.Type.DOCUMENT && (h.error = new u.YAMLSyntaxError(h, "Block collection must not have preceding content here (e.g. directives-end indicator)"));
1146
- let w = new It(h);
1147
- return d = w.parse(new t(f), d), w.range = new u.Range(l, d), w;
1148
- }
1149
- return h;
1150
- }), this.atLineStart = n ?? (e.atLineStart || false), this.inCollection = r ?? (e.inCollection || false), this.inFlow = s ?? (e.inFlow || false), this.indent = i ?? e.indent, this.lineStart = o ?? e.lineStart, this.parent = a ?? (e.parent || {}), this.root = e.root, this.src = e.src;
1151
- }
1152
- nodeStartsCollection(e) {
1153
- let { inCollection: n, inFlow: r, src: s } = this;
1154
- if (n || r) return false;
1155
- if (e instanceof ot) return true;
1156
- let i = e.range.end;
1157
- return s[i] === `
1158
- ` || s[i - 1] === `
1159
- ` ? false : (i = u.Node.endOfWhiteSpace(s, i), s[i] === ":");
1160
- }
1161
- parseProps(e) {
1162
- let { inFlow: n, parent: r, src: s } = this, i = [], o = false;
1163
- e = this.atLineStart ? u.Node.endOfIndent(s, e) : u.Node.endOfWhiteSpace(s, e);
1164
- let a = s[e];
1165
- for (; a === u.Char.ANCHOR || a === u.Char.COMMENT || a === u.Char.TAG || a === `
1166
- `; ) {
1167
- if (a === `
1168
- `) {
1169
- let l = e, f;
1170
- do
1171
- f = l + 1, l = u.Node.endOfIndent(s, f);
1172
- while (s[l] === `
1173
- `);
1174
- let m = l - (f + this.indent), g = r.type === u.Type.SEQ_ITEM && r.context.atLineStart;
1175
- if (s[l] !== "#" && !u.Node.nextNodeIsIndented(s[l], m, !g)) break;
1176
- this.atLineStart = true, this.lineStart = f, o = false, e = l;
1177
- } else if (a === u.Char.COMMENT) {
1178
- let l = u.Node.endOfLine(s, e + 1);
1179
- i.push(new u.Range(e, l)), e = l;
1180
- } else {
1181
- let l = u.Node.endOfIdentifier(s, e + 1);
1182
- a === u.Char.TAG && s[l] === "," && /^[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+,\d\d\d\d(-\d\d){0,2}\/\S/.test(s.slice(e + 1, l + 13)) && (l = u.Node.endOfIdentifier(s, l + 5)), i.push(new u.Range(e, l)), o = true, e = u.Node.endOfWhiteSpace(s, l);
1183
- }
1184
- a = s[e];
1185
- }
1186
- o && a === ":" && u.Node.atBlank(s, e + 1, true) && (e -= 1);
1187
- let c = t.parseType(s, e, n);
1188
- return { props: i, type: c, valueStart: e };
1189
- }
1190
- };
1191
- function wo(t) {
1192
- let e = [];
1193
- t.indexOf("\r") !== -1 && (t = t.replace(/\r\n?/g, (s, i) => (s.length > 1 && e.push(i), `
1194
- `)));
1195
- let n = [], r = 0;
1196
- do {
1197
- let s = new Cn(), i = new _n({ src: t });
1198
- r = s.parse(i, r), n.push(s);
1199
- } while (r < t.length);
1200
- return n.setOrigRanges = () => {
1201
- if (e.length === 0) return false;
1202
- for (let i = 1; i < e.length; ++i) e[i] -= i;
1203
- let s = 0;
1204
- for (let i = 0; i < n.length; ++i) s = n[i].setOrigRanges(e, s);
1205
- return e.splice(0, e.length), true;
1206
- }, n.toString = () => n.join(`...
1207
- `), n;
1208
- }
1209
- jr.parse = wo;
1210
- });
1211
- var De = ne((M) => {
1212
- "use strict";
1213
- var p = ce();
1214
- function bo(t, e, n) {
1215
- return n ? `#${n.replace(/[\s\S]^/gm, `$&${e}#`)}
1216
- ${e}${t}` : t;
1217
- }
1218
- function Re(t, e, n) {
1219
- return n ? n.indexOf(`
1220
- `) === -1 ? `${t} #${n}` : `${t}
1221
- ` + n.replace(/^/gm, `${e || ""}#`) : t;
1222
- }
1223
- var j = class {
1224
- };
1225
- function fe(t, e, n) {
1226
- if (Array.isArray(t)) return t.map((r, s) => fe(r, String(s), n));
1227
- if (t && typeof t.toJSON == "function") {
1228
- let r = n && n.anchors && n.anchors.get(t);
1229
- r && (n.onCreate = (i) => {
1230
- r.res = i, delete n.onCreate;
1231
- });
1232
- let s = t.toJSON(e, n);
1233
- return r && n.onCreate && n.onCreate(s), s;
1234
- }
1235
- return (!n || !n.keep) && typeof t == "bigint" ? Number(t) : t;
1236
- }
1237
- var x = class extends j {
1238
- constructor(e) {
1239
- super(), this.value = e;
1240
- }
1241
- toJSON(e, n) {
1242
- return n && n.keep ? this.value : fe(this.value, e, n);
1243
- }
1244
- toString() {
1245
- return String(this.value);
1246
- }
1247
- };
1248
- function Gr(t, e, n) {
1249
- let r = n;
1250
- for (let s = e.length - 1; s >= 0; --s) {
1251
- let i = e[s];
1252
- if (Number.isInteger(i) && i >= 0) {
1253
- let o = [];
1254
- o[i] = r, r = o;
1255
- } else {
1256
- let o = {};
1257
- Object.defineProperty(o, i, { value: r, writable: true, enumerable: true, configurable: true }), r = o;
1258
- }
1259
- }
1260
- return t.createNode(r, false);
1261
- }
1262
- var Xr = (t) => t == null || typeof t == "object" && t[Symbol.iterator]().next().done, Q = class t extends j {
1263
- constructor(e) {
1264
- super(), p._defineProperty(this, "items", []), this.schema = e;
1265
- }
1266
- addIn(e, n) {
1267
- if (Xr(e)) this.add(n);
1268
- else {
1269
- let [r, ...s] = e, i = this.get(r, true);
1270
- if (i instanceof t) i.addIn(s, n);
1271
- else if (i === void 0 && this.schema) this.set(r, Gr(this.schema, s, n));
1272
- else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`);
1273
- }
1274
- }
1275
- deleteIn([e, ...n]) {
1276
- if (n.length === 0) return this.delete(e);
1277
- let r = this.get(e, true);
1278
- if (r instanceof t) return r.deleteIn(n);
1279
- throw new Error(`Expected YAML collection at ${e}. Remaining path: ${n}`);
1280
- }
1281
- getIn([e, ...n], r) {
1282
- let s = this.get(e, true);
1283
- return n.length === 0 ? !r && s instanceof x ? s.value : s : s instanceof t ? s.getIn(n, r) : void 0;
1284
- }
1285
- hasAllNullValues() {
1286
- return this.items.every((e) => {
1287
- if (!e || e.type !== "PAIR") return false;
1288
- let n = e.value;
1289
- return n == null || n instanceof x && n.value == null && !n.commentBefore && !n.comment && !n.tag;
1290
- });
1291
- }
1292
- hasIn([e, ...n]) {
1293
- if (n.length === 0) return this.has(e);
1294
- let r = this.get(e, true);
1295
- return r instanceof t ? r.hasIn(n) : false;
1296
- }
1297
- setIn([e, ...n], r) {
1298
- if (n.length === 0) this.set(e, r);
1299
- else {
1300
- let s = this.get(e, true);
1301
- if (s instanceof t) s.setIn(n, r);
1302
- else if (s === void 0 && this.schema) this.set(e, Gr(this.schema, n, r));
1303
- else throw new Error(`Expected YAML collection at ${e}. Remaining path: ${n}`);
1304
- }
1305
- }
1306
- toJSON() {
1307
- return null;
1308
- }
1309
- toString(e, { blockItem: n, flowChars: r, isMap: s, itemIndent: i }, o, a) {
1310
- let { indent: c, indentStep: l, stringify: f } = e, m = this.type === p.Type.FLOW_MAP || this.type === p.Type.FLOW_SEQ || e.inFlow;
1311
- m && (i += l);
1312
- let g = s && this.hasAllNullValues();
1313
- e = Object.assign({}, e, { allNullValues: g, indent: i, inFlow: m, type: null });
1314
- let y = false, h = false, d = this.items.reduce((P, A, C) => {
1315
- let L;
1316
- A && (!y && A.spaceBefore && P.push({ type: "comment", str: "" }), A.commentBefore && A.commentBefore.match(/^.*$/gm).forEach((Mi) => {
1317
- P.push({ type: "comment", str: `#${Mi}` });
1318
- }), A.comment && (L = A.comment), m && (!y && A.spaceBefore || A.commentBefore || A.comment || A.key && (A.key.commentBefore || A.key.comment) || A.value && (A.value.commentBefore || A.value.comment)) && (h = true)), y = false;
1319
- let R = f(A, e, () => L = null, () => y = true);
1320
- return m && !h && R.includes(`
1321
- `) && (h = true), m && C < this.items.length - 1 && (R += ","), R = Re(R, i, L), y && (L || m) && (y = false), P.push({ type: "item", str: R }), P;
1322
- }, []), w;
1323
- if (d.length === 0) w = r.start + r.end;
1324
- else if (m) {
1325
- let { start: P, end: A } = r, C = d.map((L) => L.str);
1326
- if (h || C.reduce((L, R) => L + R.length + 2, 2) > t.maxFlowStringSingleLineLength) {
1327
- w = P;
1328
- for (let L of C) w += L ? `
1329
- ${l}${c}${L}` : `
1330
- `;
1331
- w += `
1332
- ${c}${A}`;
1333
- } else w = `${P} ${C.join(" ")} ${A}`;
1334
- } else {
1335
- let P = d.map(n);
1336
- w = P.shift();
1337
- for (let A of P) w += A ? `
1338
- ${c}${A}` : `
1339
- `;
1340
- }
1341
- return this.comment ? (w += `
1342
- ` + this.comment.replace(/^/gm, `${c}#`), o && o()) : y && a && a(), w;
1343
- }
1344
- };
1345
- p._defineProperty(Q, "maxFlowStringSingleLineLength", 60);
1346
- function _t(t) {
1347
- let e = t instanceof x ? t.value : t;
1348
- return e && typeof e == "string" && (e = Number(e)), Number.isInteger(e) && e >= 0 ? e : null;
1349
- }
1350
- var ue = class extends Q {
1351
- add(e) {
1352
- this.items.push(e);
1353
- }
1354
- delete(e) {
1355
- let n = _t(e);
1356
- return typeof n != "number" ? false : this.items.splice(n, 1).length > 0;
1357
- }
1358
- get(e, n) {
1359
- let r = _t(e);
1360
- if (typeof r != "number") return;
1361
- let s = this.items[r];
1362
- return !n && s instanceof x ? s.value : s;
1363
- }
1364
- has(e) {
1365
- let n = _t(e);
1366
- return typeof n == "number" && n < this.items.length;
1367
- }
1368
- set(e, n) {
1369
- let r = _t(e);
1370
- if (typeof r != "number") throw new Error(`Expected a valid index, not ${e}.`);
1371
- this.items[r] = n;
1372
- }
1373
- toJSON(e, n) {
1374
- let r = [];
1375
- n && n.onCreate && n.onCreate(r);
1376
- let s = 0;
1377
- for (let i of this.items) r.push(fe(i, String(s++), n));
1378
- return r;
1379
- }
1380
- toString(e, n, r) {
1381
- return e ? super.toString(e, { blockItem: (s) => s.type === "comment" ? s.str : `- ${s.str}`, flowChars: { start: "[", end: "]" }, isMap: false, itemIndent: (e.indent || "") + " " }, n, r) : JSON.stringify(this);
1382
- }
1383
- }, No = (t, e, n) => e === null ? "" : typeof e != "object" ? String(e) : t instanceof j && n && n.doc ? t.toString({ anchors: /* @__PURE__ */ Object.create(null), doc: n.doc, indent: "", indentStep: n.indentStep, inFlow: true, inStringifyKey: true, stringify: n.stringify }) : JSON.stringify(e), T = class t extends j {
1384
- constructor(e, n = null) {
1385
- super(), this.key = e, this.value = n, this.type = t.Type.PAIR;
1386
- }
1387
- get commentBefore() {
1388
- return this.key instanceof j ? this.key.commentBefore : void 0;
1389
- }
1390
- set commentBefore(e) {
1391
- if (this.key == null && (this.key = new x(null)), this.key instanceof j) this.key.commentBefore = e;
1392
- else {
1393
- let n = "Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.";
1394
- throw new Error(n);
1395
- }
1396
- }
1397
- addToJSMap(e, n) {
1398
- let r = fe(this.key, "", e);
1399
- if (n instanceof Map) {
1400
- let s = fe(this.value, r, e);
1401
- n.set(r, s);
1402
- } else if (n instanceof Set) n.add(r);
1403
- else {
1404
- let s = No(this.key, r, e), i = fe(this.value, s, e);
1405
- s in n ? Object.defineProperty(n, s, { value: i, writable: true, enumerable: true, configurable: true }) : n[s] = i;
1406
- }
1407
- return n;
1408
- }
1409
- toJSON(e, n) {
1410
- let r = n && n.mapAsMap ? /* @__PURE__ */ new Map() : {};
1411
- return this.addToJSMap(n, r);
1412
- }
1413
- toString(e, n, r) {
1414
- if (!e || !e.doc) return JSON.stringify(this);
1415
- let { indent: s, indentSeq: i, simpleKeys: o } = e.doc.options, { key: a, value: c } = this, l = a instanceof j && a.comment;
1416
- if (o) {
1417
- if (l) throw new Error("With simple keys, key nodes cannot have comments");
1418
- if (a instanceof Q) {
1419
- let R = "With simple keys, collection cannot be used as a key value";
1420
- throw new Error(R);
1421
- }
1422
- }
1423
- let f = !o && (!a || l || (a instanceof j ? a instanceof Q || a.type === p.Type.BLOCK_FOLDED || a.type === p.Type.BLOCK_LITERAL : typeof a == "object")), { doc: m, indent: g, indentStep: y, stringify: h } = e;
1424
- e = Object.assign({}, e, { implicitKey: !f, indent: g + y });
1425
- let d = false, w = h(a, e, () => l = null, () => d = true);
1426
- if (w = Re(w, e.indent, l), !f && w.length > 1024) {
1427
- if (o) throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
1428
- f = true;
1429
- }
1430
- if (e.allNullValues && !o) return this.comment ? (w = Re(w, e.indent, this.comment), n && n()) : d && !l && r && r(), e.inFlow && !f ? w : `? ${w}`;
1431
- w = f ? `? ${w}
1432
- ${g}:` : `${w}:`, this.comment && (w = Re(w, e.indent, this.comment), n && n());
1433
- let P = "", A = null;
1434
- if (c instanceof j) {
1435
- if (c.spaceBefore && (P = `
1436
- `), c.commentBefore) {
1437
- let R = c.commentBefore.replace(/^/gm, `${e.indent}#`);
1438
- P += `
1439
- ${R}`;
1440
- }
1441
- A = c.comment;
1442
- } else c && typeof c == "object" && (c = m.schema.createNode(c, true));
1443
- e.implicitKey = false, !f && !this.comment && c instanceof x && (e.indentAtStart = w.length + 1), d = false, !i && s >= 2 && !e.inFlow && !f && c instanceof ue && c.type !== p.Type.FLOW_SEQ && !c.tag && !m.anchors.getName(c) && (e.indent = e.indent.substr(2));
1444
- let C = h(c, e, () => A = null, () => d = true), L = " ";
1445
- return P || this.comment ? L = `${P}
1446
- ${e.indent}` : !f && c instanceof Q ? (!(C[0] === "[" || C[0] === "{") || C.includes(`
1447
- `)) && (L = `
1448
- ${e.indent}`) : C[0] === `
1449
- ` && (L = ""), d && !A && r && r(), Re(w + L + C, e.indent, A);
1450
- }
1451
- };
1452
- p._defineProperty(T, "Type", { PAIR: "PAIR", MERGE_PAIR: "MERGE_PAIR" });
1453
- var xt = (t, e) => {
1454
- if (t instanceof we) {
1455
- let n = e.get(t.source);
1456
- return n.count * n.aliasCount;
1457
- } else if (t instanceof Q) {
1458
- let n = 0;
1459
- for (let r of t.items) {
1460
- let s = xt(r, e);
1461
- s > n && (n = s);
1462
- }
1463
- return n;
1464
- } else if (t instanceof T) {
1465
- let n = xt(t.key, e), r = xt(t.value, e);
1466
- return Math.max(n, r);
1467
- }
1468
- return 1;
1469
- }, we = class t extends j {
1470
- static stringify({ range: e, source: n }, { anchors: r, doc: s, implicitKey: i, inStringifyKey: o }) {
1471
- let a = Object.keys(r).find((l) => r[l] === n);
1472
- if (!a && o && (a = s.anchors.getName(n) || s.anchors.newName()), a) return `*${a}${i ? " " : ""}`;
1473
- let c = s.anchors.getName(n) ? "Alias node must be after source node" : "Source node not found for alias node";
1474
- throw new Error(`${c} [${e}]`);
1475
- }
1476
- constructor(e) {
1477
- super(), this.source = e, this.type = p.Type.ALIAS;
1478
- }
1479
- set tag(e) {
1480
- throw new Error("Alias nodes cannot have tags");
1481
- }
1482
- toJSON(e, n) {
1483
- if (!n) return fe(this.source, e, n);
1484
- let { anchors: r, maxAliasCount: s } = n, i = r.get(this.source);
1485
- if (!i || i.res === void 0) {
1486
- let o = "This should not happen: Alias anchor was not resolved?";
1487
- throw this.cstNode ? new p.YAMLReferenceError(this.cstNode, o) : new ReferenceError(o);
1488
- }
1489
- if (s >= 0 && (i.count += 1, i.aliasCount === 0 && (i.aliasCount = xt(this.source, r)), i.count * i.aliasCount > s)) {
1490
- let o = "Excessive alias count indicates a resource exhaustion attack";
1491
- throw this.cstNode ? new p.YAMLReferenceError(this.cstNode, o) : new ReferenceError(o);
1492
- }
1493
- return i.res;
1494
- }
1495
- toString(e) {
1496
- return t.stringify(this, e);
1497
- }
1498
- };
1499
- p._defineProperty(we, "default", true);
1500
- function at(t, e) {
1501
- let n = e instanceof x ? e.value : e;
1502
- for (let r of t) if (r instanceof T && (r.key === e || r.key === n || r.key && r.key.value === n)) return r;
1503
- }
1504
- var ct = class extends Q {
1505
- add(e, n) {
1506
- e ? e instanceof T || (e = new T(e.key || e, e.value)) : e = new T(e);
1507
- let r = at(this.items, e.key), s = this.schema && this.schema.sortMapEntries;
1508
- if (r) if (n) r.value = e.value;
1509
- else throw new Error(`Key ${e.key} already set`);
1510
- else if (s) {
1511
- let i = this.items.findIndex((o) => s(e, o) < 0);
1512
- i === -1 ? this.items.push(e) : this.items.splice(i, 0, e);
1513
- } else this.items.push(e);
1514
- }
1515
- delete(e) {
1516
- let n = at(this.items, e);
1517
- return n ? this.items.splice(this.items.indexOf(n), 1).length > 0 : false;
1518
- }
1519
- get(e, n) {
1520
- let r = at(this.items, e), s = r && r.value;
1521
- return !n && s instanceof x ? s.value : s;
1522
- }
1523
- has(e) {
1524
- return !!at(this.items, e);
1525
- }
1526
- set(e, n) {
1527
- this.add(new T(e, n), true);
1528
- }
1529
- toJSON(e, n, r) {
1530
- let s = r ? new r() : n && n.mapAsMap ? /* @__PURE__ */ new Map() : {};
1531
- n && n.onCreate && n.onCreate(s);
1532
- for (let i of this.items) i.addToJSMap(n, s);
1533
- return s;
1534
- }
1535
- toString(e, n, r) {
1536
- if (!e) return JSON.stringify(this);
1537
- for (let s of this.items) if (!(s instanceof T)) throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);
1538
- return super.toString(e, { blockItem: (s) => s.str, flowChars: { start: "{", end: "}" }, isMap: true, itemIndent: e.indent || "" }, n, r);
1539
- }
1540
- }, zr = "<<", $t = class extends T {
1541
- constructor(e) {
1542
- if (e instanceof T) {
1543
- let n = e.value;
1544
- n instanceof ue || (n = new ue(), n.items.push(e.value), n.range = e.value.range), super(e.key, n), this.range = e.range;
1545
- } else super(new x(zr), new ue());
1546
- this.type = T.Type.MERGE_PAIR;
1547
- }
1548
- addToJSMap(e, n) {
1549
- for (let { source: r } of this.value.items) {
1550
- if (!(r instanceof ct)) throw new Error("Merge sources must be maps");
1551
- let s = r.toJSON(null, e, Map);
1552
- for (let [i, o] of s) n instanceof Map ? n.has(i) || n.set(i, o) : n instanceof Set ? n.add(i) : Object.prototype.hasOwnProperty.call(n, i) || Object.defineProperty(n, i, { value: o, writable: true, enumerable: true, configurable: true });
1553
- }
1554
- return n;
1555
- }
1556
- toString(e, n) {
1557
- let r = this.value;
1558
- if (r.items.length > 1) return super.toString(e, n);
1559
- this.value = r.items[0];
1560
- let s = super.toString(e, n);
1561
- return this.value = r, s;
1562
- }
1563
- }, Oo = { defaultType: p.Type.BLOCK_LITERAL, lineWidth: 76 }, Ao = { trueStr: "true", falseStr: "false" }, Lo = { asBigInt: false }, To = { nullStr: "null" }, be = { defaultType: p.Type.PLAIN, doubleQuoted: { jsonEncoding: false, minMultiLineLength: 40 }, fold: { lineWidth: 80, minContentWidth: 20 } };
1564
- function Rn(t, e, n) {
1565
- for (let { format: r, test: s, resolve: i } of e) if (s) {
1566
- let o = t.match(s);
1567
- if (o) {
1568
- let a = i.apply(null, o);
1569
- return a instanceof x || (a = new x(a)), r && (a.format = r), a;
1570
- }
1571
- }
1572
- return n && (t = n(t)), new x(t);
1573
- }
1574
- var Zr = "flow", xn = "block", Rt = "quoted", Hr = (t, e) => {
1575
- let n = t[e + 1];
1576
- for (; n === " " || n === " "; ) {
1577
- do
1578
- n = t[e += 1];
1579
- while (n && n !== `
1580
- `);
1581
- n = t[e + 1];
1582
- }
1583
- return e;
1584
- };
1585
- function Yt(t, e, n, { indentAtStart: r, lineWidth: s = 80, minContentWidth: i = 20, onFold: o, onOverflow: a }) {
1586
- if (!s || s < 0) return t;
1587
- let c = Math.max(1 + i, 1 + s - e.length);
1588
- if (t.length <= c) return t;
1589
- let l = [], f = {}, m = s - e.length;
1590
- typeof r == "number" && (r > s - Math.max(2, i) ? l.push(0) : m = s - r);
1591
- let g, y, h = false, d = -1, w = -1, P = -1;
1592
- n === xn && (d = Hr(t, d), d !== -1 && (m = d + c));
1593
- for (let C; C = t[d += 1]; ) {
1594
- if (n === Rt && C === "\\") {
1595
- switch (w = d, t[d + 1]) {
1596
- case "x":
1597
- d += 3;
1598
- break;
1599
- case "u":
1600
- d += 5;
1601
- break;
1602
- case "U":
1603
- d += 9;
1604
- break;
1605
- default:
1606
- d += 1;
1607
- }
1608
- P = d;
1609
- }
1610
- if (C === `
1611
- `) n === xn && (d = Hr(t, d)), m = d + c, g = void 0;
1612
- else {
1613
- if (C === " " && y && y !== " " && y !== `
1614
- ` && y !== " ") {
1615
- let L = t[d + 1];
1616
- L && L !== " " && L !== `
1617
- ` && L !== " " && (g = d);
1618
- }
1619
- if (d >= m) if (g) l.push(g), m = g + c, g = void 0;
1620
- else if (n === Rt) {
1621
- for (; y === " " || y === " "; ) y = C, C = t[d += 1], h = true;
1622
- let L = d > P + 1 ? d - 2 : w - 1;
1623
- if (f[L]) return t;
1624
- l.push(L), f[L] = true, m = L + c, g = void 0;
1625
- } else h = true;
1626
- }
1627
- y = C;
1628
- }
1629
- if (h && a && a(), l.length === 0) return t;
1630
- o && o();
1631
- let A = t.slice(0, l[0]);
1632
- for (let C = 0; C < l.length; ++C) {
1633
- let L = l[C], R = l[C + 1] || t.length;
1634
- L === 0 ? A = `
1635
- ${e}${t.slice(0, R)}` : (n === Rt && f[L] && (A += `${t[L]}\\`), A += `
1636
- ${e}${t.slice(L + 1, R)}`);
1637
- }
1638
- return A;
1639
- }
1640
- var Dn = ({ indentAtStart: t }) => t ? Object.assign({ indentAtStart: t }, be.fold) : be.fold, Bt = (t) => /^(%|---|\.\.\.)/m.test(t);
1641
- function Co(t, e, n) {
1642
- if (!e || e < 0) return false;
1643
- let r = e - n, s = t.length;
1644
- if (s <= r) return false;
1645
- for (let i = 0, o = 0; i < s; ++i) if (t[i] === `
1646
- `) {
1647
- if (i - o > r) return true;
1648
- if (o = i + 1, s - o <= r) return false;
1649
- }
1650
- return true;
1651
- }
1652
- function Se(t, e) {
1653
- let { implicitKey: n } = e, { jsonEncoding: r, minMultiLineLength: s } = be.doubleQuoted, i = JSON.stringify(t);
1654
- if (r) return i;
1655
- let o = e.indent || (Bt(t) ? " " : ""), a = "", c = 0;
1656
- for (let l = 0, f = i[l]; f; f = i[++l]) if (f === " " && i[l + 1] === "\\" && i[l + 2] === "n" && (a += i.slice(c, l) + "\\ ", l += 1, c = l, f = "\\"), f === "\\") switch (i[l + 1]) {
1657
- case "u":
1658
- {
1659
- a += i.slice(c, l);
1660
- let m = i.substr(l + 2, 4);
1661
- switch (m) {
1662
- case "0000":
1663
- a += "\\0";
1664
- break;
1665
- case "0007":
1666
- a += "\\a";
1667
- break;
1668
- case "000b":
1669
- a += "\\v";
1670
- break;
1671
- case "001b":
1672
- a += "\\e";
1673
- break;
1674
- case "0085":
1675
- a += "\\N";
1676
- break;
1677
- case "00a0":
1678
- a += "\\_";
1679
- break;
1680
- case "2028":
1681
- a += "\\L";
1682
- break;
1683
- case "2029":
1684
- a += "\\P";
1685
- break;
1686
- default:
1687
- m.substr(0, 2) === "00" ? a += "\\x" + m.substr(2) : a += i.substr(l, 6);
1688
- }
1689
- l += 5, c = l + 1;
1690
- }
1691
- break;
1692
- case "n":
1693
- if (n || i[l + 2] === '"' || i.length < s) l += 1;
1694
- else {
1695
- for (a += i.slice(c, l) + `
1696
-
1697
- `; i[l + 2] === "\\" && i[l + 3] === "n" && i[l + 4] !== '"'; ) a += `
1698
- `, l += 2;
1699
- a += o, i[l + 2] === " " && (a += "\\"), l += 1, c = l + 1;
1700
- }
1701
- break;
1702
- default:
1703
- l += 1;
1704
- }
1705
- return a = c ? a + i.slice(c) : i, n ? a : Yt(a, o, Rt, Dn(e));
1706
- }
1707
- function es(t, e) {
1708
- if (e.implicitKey) {
1709
- if (/\n/.test(t)) return Se(t, e);
1710
- } else if (/[ \t]\n|\n[ \t]/.test(t)) return Se(t, e);
1711
- let n = e.indent || (Bt(t) ? " " : ""), r = "'" + t.replace(/'/g, "''").replace(/\n+/g, `$&
1712
- ${n}`) + "'";
1713
- return e.implicitKey ? r : Yt(r, n, Zr, Dn(e));
1714
- }
1715
- function Dt({ comment: t, type: e, value: n }, r, s, i) {
1716
- if (/\n[\t ]+$/.test(n) || /^\s*$/.test(n)) return Se(n, r);
1717
- let o = r.indent || (r.forceBlockIndent || Bt(n) ? " " : ""), a = o ? "2" : "1", c = e === p.Type.BLOCK_FOLDED ? false : e === p.Type.BLOCK_LITERAL ? true : !Co(n, be.fold.lineWidth, o.length), l = c ? "|" : ">";
1718
- if (!n) return l + `
1719
- `;
1720
- let f = "", m = "";
1721
- if (n = n.replace(/[\n\t ]*$/, (y) => {
1722
- let h = y.indexOf(`
1723
- `);
1724
- return h === -1 ? l += "-" : (n === y || h !== y.length - 1) && (l += "+", i && i()), m = y.replace(/\n$/, ""), "";
1725
- }).replace(/^[\n ]*/, (y) => {
1726
- y.indexOf(" ") !== -1 && (l += a);
1727
- let h = y.match(/ +$/);
1728
- return h ? (f = y.slice(0, -h[0].length), h[0]) : (f = y, "");
1729
- }), m && (m = m.replace(/\n+(?!\n|$)/g, `$&${o}`)), f && (f = f.replace(/\n+/g, `$&${o}`)), t && (l += " #" + t.replace(/ ?[\r\n]+/g, " "), s && s()), !n) return `${l}${a}
1730
- ${o}${m}`;
1731
- if (c) return n = n.replace(/\n+/g, `$&${o}`), `${l}
1732
- ${o}${f}${n}${m}`;
1733
- n = n.replace(/\n+/g, `
1734
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${o}`);
1735
- let g = Yt(`${f}${n}${m}`, o, xn, be.fold);
1736
- return `${l}
1737
- ${o}${g}`;
1738
- }
1739
- function Mo(t, e, n, r) {
1740
- let { comment: s, type: i, value: o } = t, { actualString: a, implicitKey: c, indent: l, inFlow: f } = e;
1741
- if (c && /[\n[\]{},]/.test(o) || f && /[[\]{},]/.test(o)) return Se(o, e);
1742
- if (!o || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o)) return c || f || o.indexOf(`
1743
- `) === -1 ? o.indexOf('"') !== -1 && o.indexOf("'") === -1 ? es(o, e) : Se(o, e) : Dt(t, e, n, r);
1744
- if (!c && !f && i !== p.Type.PLAIN && o.indexOf(`
1745
- `) !== -1) return Dt(t, e, n, r);
1746
- if (l === "" && Bt(o)) return e.forceBlockIndent = true, Dt(t, e, n, r);
1747
- let m = o.replace(/\n+/g, `$&
1748
- ${l}`);
1749
- if (a) {
1750
- let { tags: y } = e.doc.schema;
1751
- if (typeof Rn(m, y, y.scalarFallback).value != "string") return Se(o, e);
1752
- }
1753
- let g = c ? m : Yt(m, l, Zr, Dn(e));
1754
- return s && !f && (g.indexOf(`
1755
- `) !== -1 || s.indexOf(`
1756
- `) !== -1) ? (n && n(), bo(g, l, s)) : g;
1757
- }
1758
- function ko(t, e, n, r) {
1759
- let { defaultType: s } = be, { implicitKey: i, inFlow: o } = e, { type: a, value: c } = t;
1760
- typeof c != "string" && (c = String(c), t = Object.assign({}, t, { value: c }));
1761
- let l = (m) => {
1762
- switch (m) {
1763
- case p.Type.BLOCK_FOLDED:
1764
- case p.Type.BLOCK_LITERAL:
1765
- return Dt(t, e, n, r);
1766
- case p.Type.QUOTE_DOUBLE:
1767
- return Se(c, e);
1768
- case p.Type.QUOTE_SINGLE:
1769
- return es(c, e);
1770
- case p.Type.PLAIN:
1771
- return Mo(t, e, n, r);
1772
- default:
1773
- return null;
1774
- }
1775
- };
1776
- (a !== p.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(c) || (i || o) && (a === p.Type.BLOCK_FOLDED || a === p.Type.BLOCK_LITERAL)) && (a = p.Type.QUOTE_DOUBLE);
1777
- let f = l(a);
1778
- if (f === null && (f = l(s), f === null)) throw new Error(`Unsupported default string type ${s}`);
1779
- return f;
1780
- }
1781
- function Po({ format: t, minFractionDigits: e, tag: n, value: r }) {
1782
- if (typeof r == "bigint") return String(r);
1783
- if (!isFinite(r)) return isNaN(r) ? ".nan" : r < 0 ? "-.inf" : ".inf";
1784
- let s = JSON.stringify(r);
1785
- if (!t && e && (!n || n === "tag:yaml.org,2002:float") && /^\d/.test(s)) {
1786
- let i = s.indexOf(".");
1787
- i < 0 && (i = s.length, s += ".");
1788
- let o = e - (s.length - i - 1);
1789
- for (; o-- > 0; ) s += "0";
1790
- }
1791
- return s;
1792
- }
1793
- function ts(t, e) {
1794
- let n, r;
1795
- switch (e.type) {
1796
- case p.Type.FLOW_MAP:
1797
- n = "}", r = "flow map";
1798
- break;
1799
- case p.Type.FLOW_SEQ:
1800
- n = "]", r = "flow sequence";
1801
- break;
1802
- default:
1803
- t.push(new p.YAMLSemanticError(e, "Not a flow collection!?"));
1804
- return;
1805
- }
1806
- let s;
1807
- for (let i = e.items.length - 1; i >= 0; --i) {
1808
- let o = e.items[i];
1809
- if (!o || o.type !== p.Type.COMMENT) {
1810
- s = o;
1811
- break;
1812
- }
1813
- }
1814
- if (s && s.char !== n) {
1815
- let i = `Expected ${r} to end with ${n}`, o;
1816
- typeof s.offset == "number" ? (o = new p.YAMLSemanticError(e, i), o.offset = s.offset + 1) : (o = new p.YAMLSemanticError(s, i), s.range && s.range.end && (o.offset = s.range.end - s.range.start)), t.push(o);
1817
- }
1818
- }
1819
- function ns(t, e) {
1820
- let n = e.context.src[e.range.start - 1];
1821
- if (n !== `
1822
- ` && n !== " " && n !== " ") {
1823
- let r = "Comments must be separated from other tokens by white space characters";
1824
- t.push(new p.YAMLSemanticError(e, r));
1825
- }
1826
- }
1827
- function rs(t, e) {
1828
- let n = String(e), r = n.substr(0, 8) + "..." + n.substr(-8);
1829
- return new p.YAMLSemanticError(t, `The "${r}" key is too long`);
1830
- }
1831
- function ss(t, e) {
1832
- for (let { afterKey: n, before: r, comment: s } of e) {
1833
- let i = t.items[r];
1834
- i ? (n && i.value && (i = i.value), s === void 0 ? (n || !i.commentBefore) && (i.spaceBefore = true) : i.commentBefore ? i.commentBefore += `
1835
- ` + s : i.commentBefore = s) : s !== void 0 && (t.comment ? t.comment += `
1836
- ` + s : t.comment = s);
1837
- }
1838
- }
1839
- function $n(t, e) {
1840
- let n = e.strValue;
1841
- return n ? typeof n == "string" ? n : (n.errors.forEach((r) => {
1842
- r.source || (r.source = e), t.errors.push(r);
1843
- }), n.str) : "";
1844
- }
1845
- function vo(t, e) {
1846
- let { handle: n, suffix: r } = e.tag, s = t.tagPrefixes.find((i) => i.handle === n);
1847
- if (!s) {
1848
- let i = t.getDefaults().tagPrefixes;
1849
- if (i && (s = i.find((o) => o.handle === n)), !s) throw new p.YAMLSemanticError(e, `The ${n} tag handle is non-default and was not declared.`);
1850
- }
1851
- if (!r) throw new p.YAMLSemanticError(e, `The ${n} tag has no suffix.`);
1852
- if (n === "!" && (t.version || t.options.version) === "1.0") {
1853
- if (r[0] === "^") return t.warnings.push(new p.YAMLWarning(e, "YAML 1.0 ^ tag expansion is not supported")), r;
1854
- if (/[:/]/.test(r)) {
1855
- let i = r.match(/^([a-z0-9-]+)\/(.*)/i);
1856
- return i ? `tag:${i[1]}.yaml.org,2002:${i[2]}` : `tag:${r}`;
1857
- }
1858
- }
1859
- return s.prefix + decodeURIComponent(r);
1860
- }
1861
- function Io(t, e) {
1862
- let { tag: n, type: r } = e, s = false;
1863
- if (n) {
1864
- let { handle: i, suffix: o, verbatim: a } = n;
1865
- if (a) {
1866
- if (a !== "!" && a !== "!!") return a;
1867
- let c = `Verbatim tags aren't resolved, so ${a} is invalid.`;
1868
- t.errors.push(new p.YAMLSemanticError(e, c));
1869
- } else if (i === "!" && !o) s = true;
1870
- else try {
1871
- return vo(t, e);
1872
- } catch (c) {
1873
- t.errors.push(c);
1874
- }
1875
- }
1876
- switch (r) {
1877
- case p.Type.BLOCK_FOLDED:
1878
- case p.Type.BLOCK_LITERAL:
1879
- case p.Type.QUOTE_DOUBLE:
1880
- case p.Type.QUOTE_SINGLE:
1881
- return p.defaultTags.STR;
1882
- case p.Type.FLOW_MAP:
1883
- case p.Type.MAP:
1884
- return p.defaultTags.MAP;
1885
- case p.Type.FLOW_SEQ:
1886
- case p.Type.SEQ:
1887
- return p.defaultTags.SEQ;
1888
- case p.Type.PLAIN:
1889
- return s ? p.defaultTags.STR : null;
1890
- default:
1891
- return null;
1892
- }
1893
- }
1894
- function Jr(t, e, n) {
1895
- let { tags: r } = t.schema, s = [];
1896
- for (let o of r) if (o.tag === n) if (o.test) s.push(o);
1897
- else {
1898
- let a = o.resolve(t, e);
1899
- return a instanceof Q ? a : new x(a);
1900
- }
1901
- let i = $n(t, e);
1902
- return typeof i == "string" && s.length > 0 ? Rn(i, s, r.scalarFallback) : null;
1903
- }
1904
- function _o({ type: t }) {
1905
- switch (t) {
1906
- case p.Type.FLOW_MAP:
1907
- case p.Type.MAP:
1908
- return p.defaultTags.MAP;
1909
- case p.Type.FLOW_SEQ:
1910
- case p.Type.SEQ:
1911
- return p.defaultTags.SEQ;
1912
- default:
1913
- return p.defaultTags.STR;
1914
- }
1915
- }
1916
- function xo(t, e, n) {
1917
- try {
1918
- let r = Jr(t, e, n);
1919
- if (r) return n && e.tag && (r.tag = n), r;
1920
- } catch (r) {
1921
- return r.source || (r.source = e), t.errors.push(r), null;
1922
- }
1923
- try {
1924
- let r = _o(e);
1925
- if (!r) throw new Error(`The tag ${n} is unavailable`);
1926
- let s = `The tag ${n} is unavailable, falling back to ${r}`;
1927
- t.warnings.push(new p.YAMLWarning(e, s));
1928
- let i = Jr(t, e, r);
1929
- return i.tag = n, i;
1930
- } catch (r) {
1931
- let s = new p.YAMLReferenceError(e, r.message);
1932
- return s.stack = r.stack, t.errors.push(s), null;
1933
- }
1934
- }
1935
- var Ro = (t) => {
1936
- if (!t) return false;
1937
- let { type: e } = t;
1938
- return e === p.Type.MAP_KEY || e === p.Type.MAP_VALUE || e === p.Type.SEQ_ITEM;
1939
- };
1940
- function Do(t, e) {
1941
- let n = { before: [], after: [] }, r = false, s = false, i = Ro(e.context.parent) ? e.context.parent.props.concat(e.props) : e.props;
1942
- for (let { start: o, end: a } of i) switch (e.context.src[o]) {
1943
- case p.Char.COMMENT: {
1944
- if (!e.commentHasRequiredWhitespace(o)) {
1945
- let m = "Comments must be separated from other tokens by white space characters";
1946
- t.push(new p.YAMLSemanticError(e, m));
1947
- }
1948
- let { header: c, valueRange: l } = e;
1949
- (l && (o > l.start || c && o > c.start) ? n.after : n.before).push(e.context.src.slice(o + 1, a));
1950
- break;
1951
- }
1952
- case p.Char.ANCHOR:
1953
- if (r) {
1954
- let c = "A node can have at most one anchor";
1955
- t.push(new p.YAMLSemanticError(e, c));
1956
- }
1957
- r = true;
1958
- break;
1959
- case p.Char.TAG:
1960
- if (s) {
1961
- let c = "A node can have at most one tag";
1962
- t.push(new p.YAMLSemanticError(e, c));
1963
- }
1964
- s = true;
1965
- break;
1966
- }
1967
- return { comments: n, hasAnchor: r, hasTag: s };
1968
- }
1969
- function $o(t, e) {
1970
- let { anchors: n, errors: r, schema: s } = t;
1971
- if (e.type === p.Type.ALIAS) {
1972
- let o = e.rawValue, a = n.getNode(o);
1973
- if (!a) {
1974
- let l = `Aliased anchor not found: ${o}`;
1975
- return r.push(new p.YAMLReferenceError(e, l)), null;
1976
- }
1977
- let c = new we(a);
1978
- return n._cstAliases.push(c), c;
1979
- }
1980
- let i = Io(t, e);
1981
- if (i) return xo(t, e, i);
1982
- if (e.type !== p.Type.PLAIN) {
1983
- let o = `Failed to resolve ${e.type} node here`;
1984
- return r.push(new p.YAMLSyntaxError(e, o)), null;
1985
- }
1986
- try {
1987
- let o = $n(t, e);
1988
- return Rn(o, s.tags, s.tags.scalarFallback);
1989
- } catch (o) {
1990
- return o.source || (o.source = e), r.push(o), null;
1991
- }
1992
- }
1993
- function pe(t, e) {
1994
- if (!e) return null;
1995
- e.error && t.errors.push(e.error);
1996
- let { comments: n, hasAnchor: r, hasTag: s } = Do(t.errors, e);
1997
- if (r) {
1998
- let { anchors: o } = t, a = e.anchor, c = o.getNode(a);
1999
- c && (o.map[o.newName(a)] = c), o.map[a] = e;
2000
- }
2001
- if (e.type === p.Type.ALIAS && (r || s)) {
2002
- let o = "An alias node must not specify any properties";
2003
- t.errors.push(new p.YAMLSemanticError(e, o));
2004
- }
2005
- let i = $o(t, e);
2006
- if (i) {
2007
- i.range = [e.range.start, e.range.end], t.options.keepCstNodes && (i.cstNode = e), t.options.keepNodeTypes && (i.type = e.type);
2008
- let o = n.before.join(`
2009
- `);
2010
- o && (i.commentBefore = i.commentBefore ? `${i.commentBefore}
2011
- ${o}` : o);
2012
- let a = n.after.join(`
2013
- `);
2014
- a && (i.comment = i.comment ? `${i.comment}
2015
- ${a}` : a);
2016
- }
2017
- return e.resolved = i;
2018
- }
2019
- function Yo(t, e) {
2020
- if (e.type !== p.Type.MAP && e.type !== p.Type.FLOW_MAP) {
2021
- let o = `A ${e.type} node cannot be resolved as a mapping`;
2022
- return t.errors.push(new p.YAMLSyntaxError(e, o)), null;
2023
- }
2024
- let { comments: n, items: r } = e.type === p.Type.FLOW_MAP ? Uo(t, e) : qo(t, e), s = new ct();
2025
- s.items = r, ss(s, n);
2026
- let i = false;
2027
- for (let o = 0; o < r.length; ++o) {
2028
- let { key: a } = r[o];
2029
- if (a instanceof Q && (i = true), t.schema.merge && a && a.value === zr) {
2030
- r[o] = new $t(r[o]);
2031
- let c = r[o].value.items, l = null;
2032
- c.some((f) => {
2033
- if (f instanceof we) {
2034
- let { type: m } = f.source;
2035
- return m === p.Type.MAP || m === p.Type.FLOW_MAP ? false : l = "Merge nodes aliases can only point to maps";
2036
- }
2037
- return l = "Merge nodes can only have Alias nodes as values";
2038
- }), l && t.errors.push(new p.YAMLSemanticError(e, l));
2039
- } else for (let c = o + 1; c < r.length; ++c) {
2040
- let { key: l } = r[c];
2041
- if (a === l || a && l && Object.prototype.hasOwnProperty.call(a, "value") && a.value === l.value) {
2042
- let f = `Map keys must be unique; "${a}" is repeated`;
2043
- t.errors.push(new p.YAMLSemanticError(e, f));
2044
- break;
2045
- }
2046
- }
2047
- }
2048
- if (i && !t.options.mapAsMap) {
2049
- let o = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.";
2050
- t.warnings.push(new p.YAMLWarning(e, o));
2051
- }
2052
- return e.resolved = s, s;
2053
- }
2054
- var Bo = ({ context: { lineStart: t, node: e, src: n }, props: r }) => {
2055
- if (r.length === 0) return false;
2056
- let { start: s } = r[0];
2057
- if (e && s > e.valueRange.start || n[s] !== p.Char.COMMENT) return false;
2058
- for (let i = t; i < s; ++i) if (n[i] === `
2059
- `) return false;
2060
- return true;
2061
- };
2062
- function Fo(t, e) {
2063
- if (!Bo(t)) return;
2064
- let n = t.getPropValue(0, p.Char.COMMENT, true), r = false, s = e.value.commentBefore;
2065
- if (s && s.startsWith(n)) e.value.commentBefore = s.substr(n.length + 1), r = true;
2066
- else {
2067
- let i = e.value.comment;
2068
- !t.node && i && i.startsWith(n) && (e.value.comment = i.substr(n.length + 1), r = true);
2069
- }
2070
- r && (e.comment = n);
2071
- }
2072
- function qo(t, e) {
2073
- let n = [], r = [], s, i = null;
2074
- for (let o = 0; o < e.items.length; ++o) {
2075
- let a = e.items[o];
2076
- switch (a.type) {
2077
- case p.Type.BLANK_LINE:
2078
- n.push({ afterKey: !!s, before: r.length });
2079
- break;
2080
- case p.Type.COMMENT:
2081
- n.push({ afterKey: !!s, before: r.length, comment: a.comment });
2082
- break;
2083
- case p.Type.MAP_KEY:
2084
- s !== void 0 && r.push(new T(s)), a.error && t.errors.push(a.error), s = pe(t, a.node), i = null;
2085
- break;
2086
- case p.Type.MAP_VALUE:
2087
- {
2088
- if (s === void 0 && (s = null), a.error && t.errors.push(a.error), !a.context.atLineStart && a.node && a.node.type === p.Type.MAP && !a.node.context.atLineStart) {
2089
- let f = "Nested mappings are not allowed in compact mappings";
2090
- t.errors.push(new p.YAMLSemanticError(a.node, f));
2091
- }
2092
- let c = a.node;
2093
- if (!c && a.props.length > 0) {
2094
- c = new p.PlainValue(p.Type.PLAIN, []), c.context = { parent: a, src: a.context.src };
2095
- let f = a.range.start + 1;
2096
- if (c.range = { start: f, end: f }, c.valueRange = { start: f, end: f }, typeof a.range.origStart == "number") {
2097
- let m = a.range.origStart + 1;
2098
- c.range.origStart = c.range.origEnd = m, c.valueRange.origStart = c.valueRange.origEnd = m;
2099
- }
2100
- }
2101
- let l = new T(s, pe(t, c));
2102
- Fo(a, l), r.push(l), s && typeof i == "number" && a.range.start > i + 1024 && t.errors.push(rs(e, s)), s = void 0, i = null;
2103
- }
2104
- break;
2105
- default:
2106
- s !== void 0 && r.push(new T(s)), s = pe(t, a), i = a.range.start, a.error && t.errors.push(a.error);
2107
- e: for (let c = o + 1; ; ++c) {
2108
- let l = e.items[c];
2109
- switch (l && l.type) {
2110
- case p.Type.BLANK_LINE:
2111
- case p.Type.COMMENT:
2112
- continue e;
2113
- case p.Type.MAP_VALUE:
2114
- break e;
2115
- default: {
2116
- let f = "Implicit map keys need to be followed by map values";
2117
- t.errors.push(new p.YAMLSemanticError(a, f));
2118
- break e;
2119
- }
2120
- }
2121
- }
2122
- if (a.valueRangeContainsNewline) {
2123
- let c = "Implicit map keys need to be on a single line";
2124
- t.errors.push(new p.YAMLSemanticError(a, c));
2125
- }
2126
- }
2127
- }
2128
- return s !== void 0 && r.push(new T(s)), { comments: n, items: r };
2129
- }
2130
- function Uo(t, e) {
2131
- let n = [], r = [], s, i = false, o = "{";
2132
- for (let a = 0; a < e.items.length; ++a) {
2133
- let c = e.items[a];
2134
- if (typeof c.char == "string") {
2135
- let { char: l, offset: f } = c;
2136
- if (l === "?" && s === void 0 && !i) {
2137
- i = true, o = ":";
2138
- continue;
2139
- }
2140
- if (l === ":") {
2141
- if (s === void 0 && (s = null), o === ":") {
2142
- o = ",";
2143
- continue;
2144
- }
2145
- } else if (i && (s === void 0 && l !== "," && (s = null), i = false), s !== void 0 && (r.push(new T(s)), s = void 0, l === ",")) {
2146
- o = ":";
2147
- continue;
2148
- }
2149
- if (l === "}") {
2150
- if (a === e.items.length - 1) continue;
2151
- } else if (l === o) {
2152
- o = ":";
2153
- continue;
2154
- }
2155
- let m = `Flow map contains an unexpected ${l}`, g = new p.YAMLSyntaxError(e, m);
2156
- g.offset = f, t.errors.push(g);
2157
- } else c.type === p.Type.BLANK_LINE ? n.push({ afterKey: !!s, before: r.length }) : c.type === p.Type.COMMENT ? (ns(t.errors, c), n.push({ afterKey: !!s, before: r.length, comment: c.comment })) : s === void 0 ? (o === "," && t.errors.push(new p.YAMLSemanticError(c, "Separator , missing in flow map")), s = pe(t, c)) : (o !== "," && t.errors.push(new p.YAMLSemanticError(c, "Indicator : missing in flow map entry")), r.push(new T(s, pe(t, c))), s = void 0, i = false);
2158
- }
2159
- return ts(t.errors, e), s !== void 0 && r.push(new T(s)), { comments: n, items: r };
2160
- }
2161
- function Vo(t, e) {
2162
- if (e.type !== p.Type.SEQ && e.type !== p.Type.FLOW_SEQ) {
2163
- let i = `A ${e.type} node cannot be resolved as a sequence`;
2164
- return t.errors.push(new p.YAMLSyntaxError(e, i)), null;
2165
- }
2166
- let { comments: n, items: r } = e.type === p.Type.FLOW_SEQ ? Ko(t, e) : Wo(t, e), s = new ue();
2167
- if (s.items = r, ss(s, n), !t.options.mapAsMap && r.some((i) => i instanceof T && i.key instanceof Q)) {
2168
- let i = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.";
2169
- t.warnings.push(new p.YAMLWarning(e, i));
2170
- }
2171
- return e.resolved = s, s;
2172
- }
2173
- function Wo(t, e) {
2174
- let n = [], r = [];
2175
- for (let s = 0; s < e.items.length; ++s) {
2176
- let i = e.items[s];
2177
- switch (i.type) {
2178
- case p.Type.BLANK_LINE:
2179
- n.push({ before: r.length });
2180
- break;
2181
- case p.Type.COMMENT:
2182
- n.push({ comment: i.comment, before: r.length });
2183
- break;
2184
- case p.Type.SEQ_ITEM:
2185
- if (i.error && t.errors.push(i.error), r.push(pe(t, i.node)), i.hasProps) {
2186
- let o = "Sequence items cannot have tags or anchors before the - indicator";
2187
- t.errors.push(new p.YAMLSemanticError(i, o));
2188
- }
2189
- break;
2190
- default:
2191
- i.error && t.errors.push(i.error), t.errors.push(new p.YAMLSyntaxError(i, `Unexpected ${i.type} node in sequence`));
2192
- }
2193
- }
2194
- return { comments: n, items: r };
2195
- }
2196
- function Ko(t, e) {
2197
- let n = [], r = [], s = false, i, o = null, a = "[", c = null;
2198
- for (let l = 0; l < e.items.length; ++l) {
2199
- let f = e.items[l];
2200
- if (typeof f.char == "string") {
2201
- let { char: m, offset: g } = f;
2202
- if (m !== ":" && (s || i !== void 0) && (s && i === void 0 && (i = a ? r.pop() : null), r.push(new T(i)), s = false, i = void 0, o = null), m === a) a = null;
2203
- else if (!a && m === "?") s = true;
2204
- else if (a !== "[" && m === ":" && i === void 0) {
2205
- if (a === ",") {
2206
- if (i = r.pop(), i instanceof T) {
2207
- let y = "Chaining flow sequence pairs is invalid", h = new p.YAMLSemanticError(e, y);
2208
- h.offset = g, t.errors.push(h);
2209
- }
2210
- if (!s && typeof o == "number") {
2211
- let y = f.range ? f.range.start : f.offset;
2212
- y > o + 1024 && t.errors.push(rs(e, i));
2213
- let { src: h } = c.context;
2214
- for (let d = o; d < y; ++d) if (h[d] === `
2215
- `) {
2216
- let w = "Implicit keys of flow sequence pairs need to be on a single line";
2217
- t.errors.push(new p.YAMLSemanticError(c, w));
2218
- break;
2219
- }
2220
- }
2221
- } else i = null;
2222
- o = null, s = false, a = null;
2223
- } else if (a === "[" || m !== "]" || l < e.items.length - 1) {
2224
- let y = `Flow sequence contains an unexpected ${m}`, h = new p.YAMLSyntaxError(e, y);
2225
- h.offset = g, t.errors.push(h);
2226
- }
2227
- } else if (f.type === p.Type.BLANK_LINE) n.push({ before: r.length });
2228
- else if (f.type === p.Type.COMMENT) ns(t.errors, f), n.push({ comment: f.comment, before: r.length });
2229
- else {
2230
- if (a) {
2231
- let g = `Expected a ${a} in flow sequence`;
2232
- t.errors.push(new p.YAMLSemanticError(f, g));
2233
- }
2234
- let m = pe(t, f);
2235
- i === void 0 ? (r.push(m), c = f) : (r.push(new T(i, m)), i = void 0), o = f.range.start, a = ",";
2236
- }
2237
- }
2238
- return ts(t.errors, e), i !== void 0 && r.push(new T(i)), { comments: n, items: r };
2239
- }
2240
- M.Alias = we;
2241
- M.Collection = Q;
2242
- M.Merge = $t;
2243
- M.Node = j;
2244
- M.Pair = T;
2245
- M.Scalar = x;
2246
- M.YAMLMap = ct;
2247
- M.YAMLSeq = ue;
2248
- M.addComment = Re;
2249
- M.binaryOptions = Oo;
2250
- M.boolOptions = Ao;
2251
- M.findPair = at;
2252
- M.intOptions = Lo;
2253
- M.isEmptyPath = Xr;
2254
- M.nullOptions = To;
2255
- M.resolveMap = Yo;
2256
- M.resolveNode = pe;
2257
- M.resolveSeq = Vo;
2258
- M.resolveString = $n;
2259
- M.strOptions = be;
2260
- M.stringifyNumber = Po;
2261
- M.stringifyString = ko;
2262
- M.toJSON = fe;
2263
- });
2264
- var qn = ne((ee) => {
2265
- "use strict";
2266
- var G = ce(), O = De(), jo = { identify: (t) => t instanceof Uint8Array, default: false, tag: "tag:yaml.org,2002:binary", resolve: (t, e) => {
2267
- let n = O.resolveString(t, e);
2268
- if (typeof Buffer == "function") return Buffer.from(n, "base64");
2269
- if (typeof atob == "function") {
2270
- let r = atob(n.replace(/[\n\r]/g, "")), s = new Uint8Array(r.length);
2271
- for (let i = 0; i < r.length; ++i) s[i] = r.charCodeAt(i);
2272
- return s;
2273
- } else {
2274
- let r = "This environment does not support reading binary tags; either Buffer or atob is required";
2275
- return t.errors.push(new G.YAMLReferenceError(e, r)), null;
2276
- }
2277
- }, options: O.binaryOptions, stringify: ({ comment: t, type: e, value: n }, r, s, i) => {
2278
- let o;
2279
- if (typeof Buffer == "function") o = n instanceof Buffer ? n.toString("base64") : Buffer.from(n.buffer).toString("base64");
2280
- else if (typeof btoa == "function") {
2281
- let a = "";
2282
- for (let c = 0; c < n.length; ++c) a += String.fromCharCode(n[c]);
2283
- o = btoa(a);
2284
- } else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
2285
- if (e || (e = O.binaryOptions.defaultType), e === G.Type.QUOTE_DOUBLE) n = o;
2286
- else {
2287
- let { lineWidth: a } = O.binaryOptions, c = Math.ceil(o.length / a), l = new Array(c);
2288
- for (let f = 0, m = 0; f < c; ++f, m += a) l[f] = o.substr(m, a);
2289
- n = l.join(e === G.Type.BLOCK_LITERAL ? `
2290
- ` : " ");
2291
- }
2292
- return O.stringifyString({ comment: t, type: e, value: n }, r, s, i);
2293
- } };
2294
- function os(t, e) {
2295
- let n = O.resolveSeq(t, e);
2296
- for (let r = 0; r < n.items.length; ++r) {
2297
- let s = n.items[r];
2298
- if (!(s instanceof O.Pair)) {
2299
- if (s instanceof O.YAMLMap) {
2300
- if (s.items.length > 1) {
2301
- let o = "Each pair must have its own sequence indicator";
2302
- throw new G.YAMLSemanticError(e, o);
2303
- }
2304
- let i = s.items[0] || new O.Pair();
2305
- s.commentBefore && (i.commentBefore = i.commentBefore ? `${s.commentBefore}
2306
- ${i.commentBefore}` : s.commentBefore), s.comment && (i.comment = i.comment ? `${s.comment}
2307
- ${i.comment}` : s.comment), s = i;
2308
- }
2309
- n.items[r] = s instanceof O.Pair ? s : new O.Pair(s);
2310
- }
2311
- }
2312
- return n;
2313
- }
2314
- function as(t, e, n) {
2315
- let r = new O.YAMLSeq(t);
2316
- r.tag = "tag:yaml.org,2002:pairs";
2317
- for (let s of e) {
2318
- let i, o;
2319
- if (Array.isArray(s)) if (s.length === 2) i = s[0], o = s[1];
2320
- else throw new TypeError(`Expected [key, value] tuple: ${s}`);
2321
- else if (s && s instanceof Object) {
2322
- let c = Object.keys(s);
2323
- if (c.length === 1) i = c[0], o = s[i];
2324
- else throw new TypeError(`Expected { key: value } tuple: ${s}`);
2325
- } else i = s;
2326
- let a = t.createPair(i, o, n);
2327
- r.items.push(a);
2328
- }
2329
- return r;
2330
- }
2331
- var Qo = { default: false, tag: "tag:yaml.org,2002:pairs", resolve: os, createNode: as }, $e = class t extends O.YAMLSeq {
2332
- constructor() {
2333
- super(), G._defineProperty(this, "add", O.YAMLMap.prototype.add.bind(this)), G._defineProperty(this, "delete", O.YAMLMap.prototype.delete.bind(this)), G._defineProperty(this, "get", O.YAMLMap.prototype.get.bind(this)), G._defineProperty(this, "has", O.YAMLMap.prototype.has.bind(this)), G._defineProperty(this, "set", O.YAMLMap.prototype.set.bind(this)), this.tag = t.tag;
2334
- }
2335
- toJSON(e, n) {
2336
- let r = /* @__PURE__ */ new Map();
2337
- n && n.onCreate && n.onCreate(r);
2338
- for (let s of this.items) {
2339
- let i, o;
2340
- if (s instanceof O.Pair ? (i = O.toJSON(s.key, "", n), o = O.toJSON(s.value, i, n)) : i = O.toJSON(s, "", n), r.has(i)) throw new Error("Ordered maps must not include duplicate keys");
2341
- r.set(i, o);
2342
- }
2343
- return r;
2344
- }
2345
- };
2346
- G._defineProperty($e, "tag", "tag:yaml.org,2002:omap");
2347
- function Go(t, e) {
2348
- let n = os(t, e), r = [];
2349
- for (let { key: s } of n.items) if (s instanceof O.Scalar) if (r.includes(s.value)) {
2350
- let i = "Ordered maps must not include duplicate keys";
2351
- throw new G.YAMLSemanticError(e, i);
2352
- } else r.push(s.value);
2353
- return Object.assign(new $e(), n);
2354
- }
2355
- function Ho(t, e, n) {
2356
- let r = as(t, e, n), s = new $e();
2357
- return s.items = r.items, s;
2358
- }
2359
- var Jo = { identify: (t) => t instanceof Map, nodeClass: $e, default: false, tag: "tag:yaml.org,2002:omap", resolve: Go, createNode: Ho }, Ye = class t extends O.YAMLMap {
2360
- constructor() {
2361
- super(), this.tag = t.tag;
2362
- }
2363
- add(e) {
2364
- let n = e instanceof O.Pair ? e : new O.Pair(e);
2365
- O.findPair(this.items, n.key) || this.items.push(n);
2366
- }
2367
- get(e, n) {
2368
- let r = O.findPair(this.items, e);
2369
- return !n && r instanceof O.Pair ? r.key instanceof O.Scalar ? r.key.value : r.key : r;
2370
- }
2371
- set(e, n) {
2372
- if (typeof n != "boolean") throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);
2373
- let r = O.findPair(this.items, e);
2374
- r && !n ? this.items.splice(this.items.indexOf(r), 1) : !r && n && this.items.push(new O.Pair(e));
2375
- }
2376
- toJSON(e, n) {
2377
- return super.toJSON(e, n, Set);
2378
- }
2379
- toString(e, n, r) {
2380
- if (!e) return JSON.stringify(this);
2381
- if (this.hasAllNullValues()) return super.toString(e, n, r);
2382
- throw new Error("Set items must all have null values");
2383
- }
2384
- };
2385
- G._defineProperty(Ye, "tag", "tag:yaml.org,2002:set");
2386
- function Xo(t, e) {
2387
- let n = O.resolveMap(t, e);
2388
- if (!n.hasAllNullValues()) throw new G.YAMLSemanticError(e, "Set items must all have null values");
2389
- return Object.assign(new Ye(), n);
2390
- }
2391
- function zo(t, e, n) {
2392
- let r = new Ye();
2393
- for (let s of e) r.items.push(t.createPair(s, null, n));
2394
- return r;
2395
- }
2396
- var Zo = { identify: (t) => t instanceof Set, nodeClass: Ye, default: false, tag: "tag:yaml.org,2002:set", resolve: Xo, createNode: zo }, Yn = (t, e) => {
2397
- let n = e.split(":").reduce((r, s) => r * 60 + Number(s), 0);
2398
- return t === "-" ? -n : n;
2399
- }, cs = ({ value: t }) => {
2400
- if (isNaN(t) || !isFinite(t)) return O.stringifyNumber(t);
2401
- let e = "";
2402
- t < 0 && (e = "-", t = Math.abs(t));
2403
- let n = [t % 60];
2404
- return t < 60 ? n.unshift(0) : (t = Math.round((t - n[0]) / 60), n.unshift(t % 60), t >= 60 && (t = Math.round((t - n[0]) / 60), n.unshift(t))), e + n.map((r) => r < 10 ? "0" + String(r) : String(r)).join(":").replace(/000000\d*$/, "");
2405
- }, ea = { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:int", format: "TIME", test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/, resolve: (t, e, n) => Yn(e, n.replace(/_/g, "")), stringify: cs }, ta = { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", format: "TIME", test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/, resolve: (t, e, n) => Yn(e, n.replace(/_/g, "")), stringify: cs }, na = { identify: (t) => t instanceof Date, default: true, tag: "tag:yaml.org,2002:timestamp", test: RegExp("^(?:([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?)$"), resolve: (t, e, n, r, s, i, o, a, c) => {
2406
- a && (a = (a + "00").substr(1, 3));
2407
- let l = Date.UTC(e, n - 1, r, s || 0, i || 0, o || 0, a || 0);
2408
- if (c && c !== "Z") {
2409
- let f = Yn(c[0], c.slice(1));
2410
- Math.abs(f) < 30 && (f *= 60), l -= 6e4 * f;
2411
- }
2412
- return new Date(l);
2413
- }, stringify: ({ value: t }) => t.toISOString().replace(/((T00:00)?:00)?\.000Z$/, "") };
2414
- function Bn(t) {
2415
- let e = {};
2416
- return t ? typeof YAML_SILENCE_DEPRECATION_WARNINGS < "u" ? !YAML_SILENCE_DEPRECATION_WARNINGS : !e.YAML_SILENCE_DEPRECATION_WARNINGS : typeof YAML_SILENCE_WARNINGS < "u" ? !YAML_SILENCE_WARNINGS : !e.YAML_SILENCE_WARNINGS;
2417
- }
2418
- function Fn(t, e) {
2419
- Bn(false) && console.warn(e ? `${e}: ${t}` : t);
2420
- }
2421
- function ra(t) {
2422
- if (Bn(true)) {
2423
- let e = t.replace(/.*yaml[/\\]/i, "").replace(/\.js$/, "").replace(/\\/g, "/");
2424
- Fn(`The endpoint 'yaml/${e}' will be removed in a future release.`, "DeprecationWarning");
2425
- }
2426
- }
2427
- var is = {};
2428
- function sa(t, e) {
2429
- if (!is[t] && Bn(true)) {
2430
- is[t] = true;
2431
- let n = `The option '${t}' will be removed in a future release`;
2432
- n += e ? `, use '${e}' instead.` : ".", Fn(n, "DeprecationWarning");
2433
- }
2434
- }
2435
- ee.binary = jo;
2436
- ee.floatTime = ta;
2437
- ee.intTime = ea;
2438
- ee.omap = Jo;
2439
- ee.pairs = Qo;
2440
- ee.set = Zo;
2441
- ee.timestamp = na;
2442
- ee.warn = Fn;
2443
- ee.warnFileDeprecation = ra;
2444
- ee.warnOptionDeprecation = sa;
2445
- });
2446
- var Kn = ne((bs) => {
2447
- "use strict";
2448
- var Ut = ce(), E = De(), $ = qn();
2449
- function ia(t, e, n) {
2450
- let r = new E.YAMLMap(t);
2451
- if (e instanceof Map) for (let [s, i] of e) r.items.push(t.createPair(s, i, n));
2452
- else if (e && typeof e == "object") for (let s of Object.keys(e)) r.items.push(t.createPair(s, e[s], n));
2453
- return typeof t.sortMapEntries == "function" && r.items.sort(t.sortMapEntries), r;
2454
- }
2455
- var ft = { createNode: ia, default: true, nodeClass: E.YAMLMap, tag: "tag:yaml.org,2002:map", resolve: E.resolveMap };
2456
- function oa(t, e, n) {
2457
- let r = new E.YAMLSeq(t);
2458
- if (e && e[Symbol.iterator]) for (let s of e) {
2459
- let i = t.createNode(s, n.wrapScalars, null, n);
2460
- r.items.push(i);
2461
- }
2462
- return r;
2463
- }
2464
- var Vt = { createNode: oa, default: true, nodeClass: E.YAMLSeq, tag: "tag:yaml.org,2002:seq", resolve: E.resolveSeq }, aa = { identify: (t) => typeof t == "string", default: true, tag: "tag:yaml.org,2002:str", resolve: E.resolveString, stringify(t, e, n, r) {
2465
- return e = Object.assign({ actualString: true }, e), E.stringifyString(t, e, n, r);
2466
- }, options: E.strOptions }, Vn = [ft, Vt, aa], Wt = (t) => typeof t == "bigint" || Number.isInteger(t), Wn = (t, e, n) => E.intOptions.asBigInt ? BigInt(t) : parseInt(e, n);
2467
- function us(t, e, n) {
2468
- let { value: r } = t;
2469
- return Wt(r) && r >= 0 ? n + r.toString(e) : E.stringifyNumber(t);
2470
- }
2471
- var ps = { identify: (t) => t == null, createNode: (t, e, n) => n.wrapScalars ? new E.Scalar(null) : null, default: true, tag: "tag:yaml.org,2002:null", test: /^(?:~|[Nn]ull|NULL)?$/, resolve: () => null, options: E.nullOptions, stringify: () => E.nullOptions.nullStr }, ms = { identify: (t) => typeof t == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/, resolve: (t) => t[0] === "t" || t[0] === "T", options: E.boolOptions, stringify: ({ value: t }) => t ? E.boolOptions.trueStr : E.boolOptions.falseStr }, hs = { identify: (t) => Wt(t) && t >= 0, default: true, tag: "tag:yaml.org,2002:int", format: "OCT", test: /^0o([0-7]+)$/, resolve: (t, e) => Wn(t, e, 8), options: E.intOptions, stringify: (t) => us(t, 8, "0o") }, ds = { identify: Wt, default: true, tag: "tag:yaml.org,2002:int", test: /^[-+]?[0-9]+$/, resolve: (t) => Wn(t, t, 10), options: E.intOptions, stringify: E.stringifyNumber }, gs = { identify: (t) => Wt(t) && t >= 0, default: true, tag: "tag:yaml.org,2002:int", format: "HEX", test: /^0x([0-9a-fA-F]+)$/, resolve: (t, e) => Wn(t, e, 16), options: E.intOptions, stringify: (t) => us(t, 16, "0x") }, ys = { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^(?:[-+]?\.inf|(\.nan))$/i, resolve: (t, e) => e ? NaN : t[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, stringify: E.stringifyNumber }, Es = { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", format: "EXP", test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/, resolve: (t) => parseFloat(t), stringify: ({ value: t }) => Number(t).toExponential() }, Ss = { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/, resolve(t, e, n) {
2472
- let r = e || n, s = new E.Scalar(parseFloat(t));
2473
- return r && r[r.length - 1] === "0" && (s.minFractionDigits = r.length), s;
2474
- }, stringify: E.stringifyNumber }, ca = Vn.concat([ps, ms, hs, ds, gs, ys, Es, Ss]), ls = (t) => typeof t == "bigint" || Number.isInteger(t), Ft = ({ value: t }) => JSON.stringify(t), ws = [ft, Vt, { identify: (t) => typeof t == "string", default: true, tag: "tag:yaml.org,2002:str", resolve: E.resolveString, stringify: Ft }, { identify: (t) => t == null, createNode: (t, e, n) => n.wrapScalars ? new E.Scalar(null) : null, default: true, tag: "tag:yaml.org,2002:null", test: /^null$/, resolve: () => null, stringify: Ft }, { identify: (t) => typeof t == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^true|false$/, resolve: (t) => t === "true", stringify: Ft }, { identify: ls, default: true, tag: "tag:yaml.org,2002:int", test: /^-?(?:0|[1-9][0-9]*)$/, resolve: (t) => E.intOptions.asBigInt ? BigInt(t) : parseInt(t, 10), stringify: ({ value: t }) => ls(t) ? t.toString() : JSON.stringify(t) }, { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/, resolve: (t) => parseFloat(t), stringify: Ft }];
2475
- ws.scalarFallback = (t) => {
2476
- throw new SyntaxError(`Unresolved plain scalar ${JSON.stringify(t)}`);
2477
- };
2478
- var fs = ({ value: t }) => t ? E.boolOptions.trueStr : E.boolOptions.falseStr, lt = (t) => typeof t == "bigint" || Number.isInteger(t);
2479
- function qt(t, e, n) {
2480
- let r = e.replace(/_/g, "");
2481
- if (E.intOptions.asBigInt) {
2482
- switch (n) {
2483
- case 2:
2484
- r = `0b${r}`;
2485
- break;
2486
- case 8:
2487
- r = `0o${r}`;
2488
- break;
2489
- case 16:
2490
- r = `0x${r}`;
2491
- break;
2492
- }
2493
- let i = BigInt(r);
2494
- return t === "-" ? BigInt(-1) * i : i;
2495
- }
2496
- let s = parseInt(r, n);
2497
- return t === "-" ? -1 * s : s;
2498
- }
2499
- function Un(t, e, n) {
2500
- let { value: r } = t;
2501
- if (lt(r)) {
2502
- let s = r.toString(e);
2503
- return r < 0 ? "-" + n + s.substr(1) : n + s;
2504
- }
2505
- return E.stringifyNumber(t);
2506
- }
2507
- var la = Vn.concat([{ identify: (t) => t == null, createNode: (t, e, n) => n.wrapScalars ? new E.Scalar(null) : null, default: true, tag: "tag:yaml.org,2002:null", test: /^(?:~|[Nn]ull|NULL)?$/, resolve: () => null, options: E.nullOptions, stringify: () => E.nullOptions.nullStr }, { identify: (t) => typeof t == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/, resolve: () => true, options: E.boolOptions, stringify: fs }, { identify: (t) => typeof t == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i, resolve: () => false, options: E.boolOptions, stringify: fs }, { identify: lt, default: true, tag: "tag:yaml.org,2002:int", format: "BIN", test: /^([-+]?)0b([0-1_]+)$/, resolve: (t, e, n) => qt(e, n, 2), stringify: (t) => Un(t, 2, "0b") }, { identify: lt, default: true, tag: "tag:yaml.org,2002:int", format: "OCT", test: /^([-+]?)0([0-7_]+)$/, resolve: (t, e, n) => qt(e, n, 8), stringify: (t) => Un(t, 8, "0") }, { identify: lt, default: true, tag: "tag:yaml.org,2002:int", test: /^([-+]?)([0-9][0-9_]*)$/, resolve: (t, e, n) => qt(e, n, 10), stringify: E.stringifyNumber }, { identify: lt, default: true, tag: "tag:yaml.org,2002:int", format: "HEX", test: /^([-+]?)0x([0-9a-fA-F_]+)$/, resolve: (t, e, n) => qt(e, n, 16), stringify: (t) => Un(t, 16, "0x") }, { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^(?:[-+]?\.inf|(\.nan))$/i, resolve: (t, e) => e ? NaN : t[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, stringify: E.stringifyNumber }, { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", format: "EXP", test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/, resolve: (t) => parseFloat(t.replace(/_/g, "")), stringify: ({ value: t }) => Number(t).toExponential() }, { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/, resolve(t, e) {
2508
- let n = new E.Scalar(parseFloat(t.replace(/_/g, "")));
2509
- if (e) {
2510
- let r = e.replace(/_/g, "");
2511
- r[r.length - 1] === "0" && (n.minFractionDigits = r.length);
2512
- }
2513
- return n;
2514
- }, stringify: E.stringifyNumber }], $.binary, $.omap, $.pairs, $.set, $.intTime, $.floatTime, $.timestamp), fa = { core: ca, failsafe: Vn, json: ws, yaml11: la }, ua = { binary: $.binary, bool: ms, float: Ss, floatExp: Es, floatNaN: ys, floatTime: $.floatTime, int: ds, intHex: gs, intOct: hs, intTime: $.intTime, map: ft, null: ps, omap: $.omap, pairs: $.pairs, seq: Vt, set: $.set, timestamp: $.timestamp };
2515
- function pa(t, e, n) {
2516
- if (e) {
2517
- let r = n.filter((i) => i.tag === e), s = r.find((i) => !i.format) || r[0];
2518
- if (!s) throw new Error(`Tag ${e} not found`);
2519
- return s;
2520
- }
2521
- return n.find((r) => (r.identify && r.identify(t) || r.class && t instanceof r.class) && !r.format);
2522
- }
2523
- function ma(t, e, n) {
2524
- if (t instanceof E.Node) return t;
2525
- let { defaultPrefix: r, onTagObj: s, prevObjects: i, schema: o, wrapScalars: a } = n;
2526
- e && e.startsWith("!!") && (e = r + e.slice(2));
2527
- let c = pa(t, e, o.tags);
2528
- if (!c) {
2529
- if (typeof t.toJSON == "function" && (t = t.toJSON()), !t || typeof t != "object") return a ? new E.Scalar(t) : t;
2530
- c = t instanceof Map ? ft : t[Symbol.iterator] ? Vt : ft;
2531
- }
2532
- s && (s(c), delete n.onTagObj);
2533
- let l = { value: void 0, node: void 0 };
2534
- if (t && typeof t == "object" && i) {
2535
- let f = i.get(t);
2536
- if (f) {
2537
- let m = new E.Alias(f);
2538
- return n.aliasNodes.push(m), m;
2539
- }
2540
- l.value = t, i.set(t, l);
2541
- }
2542
- return l.node = c.createNode ? c.createNode(n.schema, t, n) : a ? new E.Scalar(t) : t, e && l.node instanceof E.Node && (l.node.tag = e), l.node;
2543
- }
2544
- function ha(t, e, n, r) {
2545
- let s = t[r.replace(/\W/g, "")];
2546
- if (!s) {
2547
- let i = Object.keys(t).map((o) => JSON.stringify(o)).join(", ");
2548
- throw new Error(`Unknown schema "${r}"; use one of ${i}`);
2549
- }
2550
- if (Array.isArray(n)) for (let i of n) s = s.concat(i);
2551
- else typeof n == "function" && (s = n(s.slice()));
2552
- for (let i = 0; i < s.length; ++i) {
2553
- let o = s[i];
2554
- if (typeof o == "string") {
2555
- let a = e[o];
2556
- if (!a) {
2557
- let c = Object.keys(e).map((l) => JSON.stringify(l)).join(", ");
2558
- throw new Error(`Unknown custom tag "${o}"; use one of ${c}`);
2559
- }
2560
- s[i] = a;
2561
- }
2562
- }
2563
- return s;
2564
- }
2565
- var da = (t, e) => t.key < e.key ? -1 : t.key > e.key ? 1 : 0, ut = class t {
2566
- constructor({ customTags: e, merge: n, schema: r, sortMapEntries: s, tags: i }) {
2567
- this.merge = !!n, this.name = r, this.sortMapEntries = s === true ? da : s || null, !e && i && $.warnOptionDeprecation("tags", "customTags"), this.tags = ha(fa, ua, e || i, r);
2568
- }
2569
- createNode(e, n, r, s) {
2570
- let i = { defaultPrefix: t.defaultPrefix, schema: this, wrapScalars: n }, o = s ? Object.assign(s, i) : i;
2571
- return ma(e, r, o);
2572
- }
2573
- createPair(e, n, r) {
2574
- r || (r = { wrapScalars: true });
2575
- let s = this.createNode(e, r.wrapScalars, null, r), i = this.createNode(n, r.wrapScalars, null, r);
2576
- return new E.Pair(s, i);
2577
- }
2578
- };
2579
- Ut._defineProperty(ut, "defaultPrefix", Ut.defaultTagPrefix);
2580
- Ut._defineProperty(ut, "defaultTags", Ut.defaultTags);
2581
- bs.Schema = ut;
2582
- });
2583
- var Ls = ne((Gt) => {
2584
- "use strict";
2585
- var Y = ce(), S = De(), Ns = Kn(), ga = { anchorPrefix: "a", customTags: null, indent: 2, indentSeq: true, keepCstNodes: false, keepNodeTypes: true, keepBlobsInJSON: true, mapAsMap: false, maxAliasCount: 100, prettyErrors: false, simpleKeys: false, version: "1.2" }, ya = { get binary() {
2586
- return S.binaryOptions;
2587
- }, set binary(t) {
2588
- Object.assign(S.binaryOptions, t);
2589
- }, get bool() {
2590
- return S.boolOptions;
2591
- }, set bool(t) {
2592
- Object.assign(S.boolOptions, t);
2593
- }, get int() {
2594
- return S.intOptions;
2595
- }, set int(t) {
2596
- Object.assign(S.intOptions, t);
2597
- }, get null() {
2598
- return S.nullOptions;
2599
- }, set null(t) {
2600
- Object.assign(S.nullOptions, t);
2601
- }, get str() {
2602
- return S.strOptions;
2603
- }, set str(t) {
2604
- Object.assign(S.strOptions, t);
2605
- } }, As = { "1.0": { schema: "yaml-1.1", merge: true, tagPrefixes: [{ handle: "!", prefix: Y.defaultTagPrefix }, { handle: "!!", prefix: "tag:private.yaml.org,2002:" }] }, 1.1: { schema: "yaml-1.1", merge: true, tagPrefixes: [{ handle: "!", prefix: "!" }, { handle: "!!", prefix: Y.defaultTagPrefix }] }, 1.2: { schema: "core", merge: false, tagPrefixes: [{ handle: "!", prefix: "!" }, { handle: "!!", prefix: Y.defaultTagPrefix }] } };
2606
- function Os(t, e) {
2607
- if ((t.version || t.options.version) === "1.0") {
2608
- let s = e.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);
2609
- if (s) return "!" + s[1];
2610
- let i = e.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);
2611
- return i ? `!${i[1]}/${i[2]}` : `!${e.replace(/^tag:/, "")}`;
2612
- }
2613
- let n = t.tagPrefixes.find((s) => e.indexOf(s.prefix) === 0);
2614
- if (!n) {
2615
- let s = t.getDefaults().tagPrefixes;
2616
- n = s && s.find((i) => e.indexOf(i.prefix) === 0);
2617
- }
2618
- if (!n) return e[0] === "!" ? e : `!<${e}>`;
2619
- let r = e.substr(n.prefix.length).replace(/[!,[\]{}]/g, (s) => ({ "!": "%21", ",": "%2C", "[": "%5B", "]": "%5D", "{": "%7B", "}": "%7D" })[s]);
2620
- return n.handle + r;
2621
- }
2622
- function Ea(t, e) {
2623
- if (e instanceof S.Alias) return S.Alias;
2624
- if (e.tag) {
2625
- let s = t.filter((i) => i.tag === e.tag);
2626
- if (s.length > 0) return s.find((i) => i.format === e.format) || s[0];
2627
- }
2628
- let n, r;
2629
- if (e instanceof S.Scalar) {
2630
- r = e.value;
2631
- let s = t.filter((i) => i.identify && i.identify(r) || i.class && r instanceof i.class);
2632
- n = s.find((i) => i.format === e.format) || s.find((i) => !i.format);
2633
- } else r = e, n = t.find((s) => s.nodeClass && r instanceof s.nodeClass);
2634
- if (!n) {
2635
- let s = r && r.constructor ? r.constructor.name : typeof r;
2636
- throw new Error(`Tag not resolved for ${s} value`);
2637
- }
2638
- return n;
2639
- }
2640
- function Sa(t, e, { anchors: n, doc: r }) {
2641
- let s = [], i = r.anchors.getName(t);
2642
- return i && (n[i] = t, s.push(`&${i}`)), t.tag ? s.push(Os(r, t.tag)) : e.default || s.push(Os(r, e.tag)), s.join(" ");
2643
- }
2644
- function Kt(t, e, n, r) {
2645
- let { anchors: s, schema: i } = e.doc, o;
2646
- if (!(t instanceof S.Node)) {
2647
- let l = { aliasNodes: [], onTagObj: (f) => o = f, prevObjects: /* @__PURE__ */ new Map() };
2648
- t = i.createNode(t, true, null, l);
2649
- for (let f of l.aliasNodes) {
2650
- f.source = f.source.node;
2651
- let m = s.getName(f.source);
2652
- m || (m = s.newName(), s.map[m] = f.source);
2653
- }
2654
- }
2655
- if (t instanceof S.Pair) return t.toString(e, n, r);
2656
- o || (o = Ea(i.tags, t));
2657
- let a = Sa(t, o, e);
2658
- a.length > 0 && (e.indentAtStart = (e.indentAtStart || 0) + a.length + 1);
2659
- let c = typeof o.stringify == "function" ? o.stringify(t, e, n, r) : t instanceof S.Scalar ? S.stringifyString(t, e, n, r) : t.toString(e, n, r);
2660
- return a ? t instanceof S.Scalar || c[0] === "{" || c[0] === "[" ? `${a} ${c}` : `${a}
2661
- ${e.indent}${c}` : c;
2662
- }
2663
- var jn = class t {
2664
- static validAnchorNode(e) {
2665
- return e instanceof S.Scalar || e instanceof S.YAMLSeq || e instanceof S.YAMLMap;
2666
- }
2667
- constructor(e) {
2668
- Y._defineProperty(this, "map", /* @__PURE__ */ Object.create(null)), this.prefix = e;
2669
- }
2670
- createAlias(e, n) {
2671
- return this.setAnchor(e, n), new S.Alias(e);
2672
- }
2673
- createMergePair(...e) {
2674
- let n = new S.Merge();
2675
- return n.value.items = e.map((r) => {
2676
- if (r instanceof S.Alias) {
2677
- if (r.source instanceof S.YAMLMap) return r;
2678
- } else if (r instanceof S.YAMLMap) return this.createAlias(r);
2679
- throw new Error("Merge sources must be Map nodes or their Aliases");
2680
- }), n;
2681
- }
2682
- getName(e) {
2683
- let { map: n } = this;
2684
- return Object.keys(n).find((r) => n[r] === e);
2685
- }
2686
- getNames() {
2687
- return Object.keys(this.map);
2688
- }
2689
- getNode(e) {
2690
- return this.map[e];
2691
- }
2692
- newName(e) {
2693
- e || (e = this.prefix);
2694
- let n = Object.keys(this.map);
2695
- for (let r = 1; ; ++r) {
2696
- let s = `${e}${r}`;
2697
- if (!n.includes(s)) return s;
2698
- }
2699
- }
2700
- resolveNodes() {
2701
- let { map: e, _cstAliases: n } = this;
2702
- Object.keys(e).forEach((r) => {
2703
- e[r] = e[r].resolved;
2704
- }), n.forEach((r) => {
2705
- r.source = r.source.resolved;
2706
- }), delete this._cstAliases;
2707
- }
2708
- setAnchor(e, n) {
2709
- if (e != null && !t.validAnchorNode(e)) throw new Error("Anchors may only be set for Scalar, Seq and Map nodes");
2710
- if (n && /[\x00-\x19\s,[\]{}]/.test(n)) throw new Error("Anchor names must not contain whitespace or control characters");
2711
- let { map: r } = this, s = e && Object.keys(r).find((i) => r[i] === e);
2712
- if (s) if (n) s !== n && (delete r[s], r[n] = e);
2713
- else return s;
2714
- else {
2715
- if (!n) {
2716
- if (!e) return null;
2717
- n = this.newName();
2718
- }
2719
- r[n] = e;
2720
- }
2721
- return n;
2722
- }
2723
- }, jt = (t, e) => {
2724
- if (t && typeof t == "object") {
2725
- let { tag: n } = t;
2726
- t instanceof S.Collection ? (n && (e[n] = true), t.items.forEach((r) => jt(r, e))) : t instanceof S.Pair ? (jt(t.key, e), jt(t.value, e)) : t instanceof S.Scalar && n && (e[n] = true);
2727
- }
2728
- return e;
2729
- }, wa = (t) => Object.keys(jt(t, {}));
2730
- function ba(t, e) {
2731
- let n = { before: [], after: [] }, r, s = false;
2732
- for (let i of e) if (i.valueRange) {
2733
- if (r !== void 0) {
2734
- let a = "Document contains trailing content not separated by a ... or --- line";
2735
- t.errors.push(new Y.YAMLSyntaxError(i, a));
2736
- break;
2737
- }
2738
- let o = S.resolveNode(t, i);
2739
- s && (o.spaceBefore = true, s = false), r = o;
2740
- } else i.comment !== null ? (r === void 0 ? n.before : n.after).push(i.comment) : i.type === Y.Type.BLANK_LINE && (s = true, r === void 0 && n.before.length > 0 && !t.commentBefore && (t.commentBefore = n.before.join(`
2741
- `), n.before = []));
2742
- if (t.contents = r || null, !r) t.comment = n.before.concat(n.after).join(`
2743
- `) || null;
2744
- else {
2745
- let i = n.before.join(`
2746
- `);
2747
- if (i) {
2748
- let o = r instanceof S.Collection && r.items[0] ? r.items[0] : r;
2749
- o.commentBefore = o.commentBefore ? `${i}
2750
- ${o.commentBefore}` : i;
2751
- }
2752
- t.comment = n.after.join(`
2753
- `) || null;
2754
- }
2755
- }
2756
- function Na({ tagPrefixes: t }, e) {
2757
- let [n, r] = e.parameters;
2758
- if (!n || !r) {
2759
- let s = "Insufficient parameters given for %TAG directive";
2760
- throw new Y.YAMLSemanticError(e, s);
2761
- }
2762
- if (t.some((s) => s.handle === n)) {
2763
- let s = "The %TAG directive must only be given at most once per handle in the same document.";
2764
- throw new Y.YAMLSemanticError(e, s);
2765
- }
2766
- return { handle: n, prefix: r };
2767
- }
2768
- function Oa(t, e) {
2769
- let [n] = e.parameters;
2770
- if (e.name === "YAML:1.0" && (n = "1.0"), !n) {
2771
- let r = "Insufficient parameters given for %YAML directive";
2772
- throw new Y.YAMLSemanticError(e, r);
2773
- }
2774
- if (!As[n]) {
2775
- let s = `Document will be parsed as YAML ${t.version || t.options.version} rather than YAML ${n}`;
2776
- t.warnings.push(new Y.YAMLWarning(e, s));
2777
- }
2778
- return n;
2779
- }
2780
- function Aa(t, e, n) {
2781
- let r = [], s = false;
2782
- for (let i of e) {
2783
- let { comment: o, name: a } = i;
2784
- switch (a) {
2785
- case "TAG":
2786
- try {
2787
- t.tagPrefixes.push(Na(t, i));
2788
- } catch (c) {
2789
- t.errors.push(c);
2790
- }
2791
- s = true;
2792
- break;
2793
- case "YAML":
2794
- case "YAML:1.0":
2795
- if (t.version) {
2796
- let c = "The %YAML directive must only be given at most once per document.";
2797
- t.errors.push(new Y.YAMLSemanticError(i, c));
2798
- }
2799
- try {
2800
- t.version = Oa(t, i);
2801
- } catch (c) {
2802
- t.errors.push(c);
2803
- }
2804
- s = true;
2805
- break;
2806
- default:
2807
- if (a) {
2808
- let c = `YAML only supports %TAG and %YAML directives, and not %${a}`;
2809
- t.warnings.push(new Y.YAMLWarning(i, c));
2810
- }
2811
- }
2812
- o && r.push(o);
2813
- }
2814
- if (n && !s && (t.version || n.version || t.options.version) === "1.1") {
2815
- let i = ({ handle: o, prefix: a }) => ({ handle: o, prefix: a });
2816
- t.tagPrefixes = n.tagPrefixes.map(i), t.version = n.version;
2817
- }
2818
- t.commentBefore = r.join(`
2819
- `) || null;
2820
- }
2821
- function Be(t) {
2822
- if (t instanceof S.Collection) return true;
2823
- throw new Error("Expected a YAML collection as document contents");
2824
- }
2825
- var Qt = class t {
2826
- constructor(e) {
2827
- this.anchors = new jn(e.anchorPrefix), this.commentBefore = null, this.comment = null, this.contents = null, this.directivesEndMarker = null, this.errors = [], this.options = e, this.schema = null, this.tagPrefixes = [], this.version = null, this.warnings = [];
2828
- }
2829
- add(e) {
2830
- return Be(this.contents), this.contents.add(e);
2831
- }
2832
- addIn(e, n) {
2833
- Be(this.contents), this.contents.addIn(e, n);
2834
- }
2835
- delete(e) {
2836
- return Be(this.contents), this.contents.delete(e);
2837
- }
2838
- deleteIn(e) {
2839
- return S.isEmptyPath(e) ? this.contents == null ? false : (this.contents = null, true) : (Be(this.contents), this.contents.deleteIn(e));
2840
- }
2841
- getDefaults() {
2842
- return t.defaults[this.version] || t.defaults[this.options.version] || {};
2843
- }
2844
- get(e, n) {
2845
- return this.contents instanceof S.Collection ? this.contents.get(e, n) : void 0;
2846
- }
2847
- getIn(e, n) {
2848
- return S.isEmptyPath(e) ? !n && this.contents instanceof S.Scalar ? this.contents.value : this.contents : this.contents instanceof S.Collection ? this.contents.getIn(e, n) : void 0;
2849
- }
2850
- has(e) {
2851
- return this.contents instanceof S.Collection ? this.contents.has(e) : false;
2852
- }
2853
- hasIn(e) {
2854
- return S.isEmptyPath(e) ? this.contents !== void 0 : this.contents instanceof S.Collection ? this.contents.hasIn(e) : false;
2855
- }
2856
- set(e, n) {
2857
- Be(this.contents), this.contents.set(e, n);
2858
- }
2859
- setIn(e, n) {
2860
- S.isEmptyPath(e) ? this.contents = n : (Be(this.contents), this.contents.setIn(e, n));
2861
- }
2862
- setSchema(e, n) {
2863
- if (!e && !n && this.schema) return;
2864
- typeof e == "number" && (e = e.toFixed(1)), e === "1.0" || e === "1.1" || e === "1.2" ? (this.version ? this.version = e : this.options.version = e, delete this.options.schema) : e && typeof e == "string" && (this.options.schema = e), Array.isArray(n) && (this.options.customTags = n);
2865
- let r = Object.assign({}, this.getDefaults(), this.options);
2866
- this.schema = new Ns.Schema(r);
2867
- }
2868
- parse(e, n) {
2869
- this.options.keepCstNodes && (this.cstNode = e), this.options.keepNodeTypes && (this.type = "DOCUMENT");
2870
- let { directives: r = [], contents: s = [], directivesEndMarker: i, error: o, valueRange: a } = e;
2871
- if (o && (o.source || (o.source = this), this.errors.push(o)), Aa(this, r, n), i && (this.directivesEndMarker = true), this.range = a ? [a.start, a.end] : null, this.setSchema(), this.anchors._cstAliases = [], ba(this, s), this.anchors.resolveNodes(), this.options.prettyErrors) {
2872
- for (let c of this.errors) c instanceof Y.YAMLError && c.makePretty();
2873
- for (let c of this.warnings) c instanceof Y.YAMLError && c.makePretty();
2874
- }
2875
- return this;
2876
- }
2877
- listNonDefaultTags() {
2878
- return wa(this.contents).filter((e) => e.indexOf(Ns.Schema.defaultPrefix) !== 0);
2879
- }
2880
- setTagPrefix(e, n) {
2881
- if (e[0] !== "!" || e[e.length - 1] !== "!") throw new Error("Handle must start and end with !");
2882
- if (n) {
2883
- let r = this.tagPrefixes.find((s) => s.handle === e);
2884
- r ? r.prefix = n : this.tagPrefixes.push({ handle: e, prefix: n });
2885
- } else this.tagPrefixes = this.tagPrefixes.filter((r) => r.handle !== e);
2886
- }
2887
- toJSON(e, n) {
2888
- let { keepBlobsInJSON: r, mapAsMap: s, maxAliasCount: i } = this.options, o = r && (typeof e != "string" || !(this.contents instanceof S.Scalar)), a = { doc: this, indentStep: " ", keep: o, mapAsMap: o && !!s, maxAliasCount: i, stringify: Kt }, c = Object.keys(this.anchors.map);
2889
- c.length > 0 && (a.anchors = new Map(c.map((f) => [this.anchors.map[f], { alias: [], aliasCount: 0, count: 1 }])));
2890
- let l = S.toJSON(this.contents, e, a);
2891
- if (typeof n == "function" && a.anchors) for (let { count: f, res: m } of a.anchors.values()) n(m, f);
2892
- return l;
2893
- }
2894
- toString() {
2895
- if (this.errors.length > 0) throw new Error("Document with errors cannot be stringified");
2896
- let e = this.options.indent;
2897
- if (!Number.isInteger(e) || e <= 0) {
2898
- let c = JSON.stringify(e);
2899
- throw new Error(`"indent" option must be a positive integer, not ${c}`);
2900
- }
2901
- this.setSchema();
2902
- let n = [], r = false;
2903
- if (this.version) {
2904
- let c = "%YAML 1.2";
2905
- this.schema.name === "yaml-1.1" && (this.version === "1.0" ? c = "%YAML:1.0" : this.version === "1.1" && (c = "%YAML 1.1")), n.push(c), r = true;
2906
- }
2907
- let s = this.listNonDefaultTags();
2908
- this.tagPrefixes.forEach(({ handle: c, prefix: l }) => {
2909
- s.some((f) => f.indexOf(l) === 0) && (n.push(`%TAG ${c} ${l}`), r = true);
2910
- }), (r || this.directivesEndMarker) && n.push("---"), this.commentBefore && ((r || !this.directivesEndMarker) && n.unshift(""), n.unshift(this.commentBefore.replace(/^/gm, "#")));
2911
- let i = { anchors: /* @__PURE__ */ Object.create(null), doc: this, indent: "", indentStep: " ".repeat(e), stringify: Kt }, o = false, a = null;
2912
- if (this.contents) {
2913
- this.contents instanceof S.Node && (this.contents.spaceBefore && (r || this.directivesEndMarker) && n.push(""), this.contents.commentBefore && n.push(this.contents.commentBefore.replace(/^/gm, "#")), i.forceBlockIndent = !!this.comment, a = this.contents.comment);
2914
- let c = a ? null : () => o = true, l = Kt(this.contents, i, () => a = null, c);
2915
- n.push(S.addComment(l, "", a));
2916
- } else this.contents !== void 0 && n.push(Kt(this.contents, i));
2917
- return this.comment && ((!o || a) && n[n.length - 1] !== "" && n.push(""), n.push(this.comment.replace(/^/gm, "#"))), n.join(`
2918
- `) + `
2919
- `;
2920
- }
2921
- };
2922
- Y._defineProperty(Qt, "defaults", As);
2923
- Gt.Document = Qt;
2924
- Gt.defaultOptions = ga;
2925
- Gt.scalarOptions = ya;
2926
- });
2927
- var Ms = ne((Cs) => {
2928
- "use strict";
2929
- var Qn = Qr(), Ne = Ls(), La = Kn(), Ta = ce(), Ca = qn();
2930
- De();
2931
- function Ma(t, e = true, n) {
2932
- n === void 0 && typeof e == "string" && (n = e, e = true);
2933
- let r = Object.assign({}, Ne.Document.defaults[Ne.defaultOptions.version], Ne.defaultOptions);
2934
- return new La.Schema(r).createNode(t, e, n);
2935
- }
2936
- var Fe = class extends Ne.Document {
2937
- constructor(e) {
2938
- super(Object.assign({}, Ne.defaultOptions, e));
2939
- }
2940
- };
2941
- function ka(t, e) {
2942
- let n = [], r;
2943
- for (let s of Qn.parse(t)) {
2944
- let i = new Fe(e);
2945
- i.parse(s, r), n.push(i), r = i;
2946
- }
2947
- return n;
2948
- }
2949
- function Ts(t, e) {
2950
- let n = Qn.parse(t), r = new Fe(e).parse(n[0]);
2951
- if (n.length > 1) {
2952
- let s = "Source contains multiple documents; please use YAML.parseAllDocuments()";
2953
- r.errors.unshift(new Ta.YAMLSemanticError(n[1], s));
2954
- }
2955
- return r;
2956
- }
2957
- function Pa(t, e) {
2958
- let n = Ts(t, e);
2959
- if (n.warnings.forEach((r) => Ca.warn(r)), n.errors.length > 0) throw n.errors[0];
2960
- return n.toJSON();
2961
- }
2962
- function va(t, e) {
2963
- let n = new Fe(e);
2964
- return n.contents = t, String(n);
2965
- }
2966
- var Ia = { createNode: Ma, defaultOptions: Ne.defaultOptions, Document: Fe, parse: Pa, parseAllDocuments: ka, parseCST: Qn.parse, parseDocument: Ts, scalarOptions: Ne.scalarOptions, stringify: va };
2967
- Cs.YAML = Ia;
2968
- });
2969
- var Gn = ne((Lf, ks) => {
2970
- ks.exports = Ms().YAML;
2971
- });
2972
- var Ps = ne((H) => {
2973
- "use strict";
2974
- var qe = De(), Ue = ce();
2975
- H.findPair = qe.findPair;
2976
- H.parseMap = qe.resolveMap;
2977
- H.parseSeq = qe.resolveSeq;
2978
- H.stringifyNumber = qe.stringifyNumber;
2979
- H.stringifyString = qe.stringifyString;
2980
- H.toJSON = qe.toJSON;
2981
- H.Type = Ue.Type;
2982
- H.YAMLError = Ue.YAMLError;
2983
- H.YAMLReferenceError = Ue.YAMLReferenceError;
2984
- H.YAMLSemanticError = Ue.YAMLSemanticError;
2985
- H.YAMLSyntaxError = Ue.YAMLSyntaxError;
2986
- H.YAMLWarning = Ue.YAMLWarning;
2987
- });
2988
- var Ci = {};
2989
- or(Ci, { __parsePrettierYamlConfig: () => Xa, languages: () => Ur, options: () => Vr, parsers: () => ir, printers: () => Ja });
2990
- var mt = (t, e) => (n, r, ...s) => n | 1 && r == null ? void 0 : (e.call(r) ?? r[t]).apply(r, s);
2991
- function Ri(t) {
2992
- return this[t < 0 ? this.length + t : t];
2993
- }
2994
- var Di = mt("at", function() {
2995
- if (Array.isArray(this) || typeof this == "string") return Ri;
2996
- });
2997
- var D = Di;
2998
- var $i = String.prototype.replaceAll ?? function(t, e) {
2999
- return t.global ? this.replace(t, e) : this.split(t).join(e);
3000
- };
3001
- var Yi = mt("replaceAll", function() {
3002
- if (typeof this == "string") return $i;
3003
- });
3004
- var ht = Yi;
3005
- var Bi = () => {
3006
- };
3007
- var je = Bi;
3008
- var Qe = "string";
3009
- var Ge = "array";
3010
- var dt = "cursor";
3011
- var gt = "indent";
3012
- var Ae = "align";
3013
- var yt = "trim";
3014
- var Le = "group";
3015
- var Te = "fill";
3016
- var Ce = "if-break";
3017
- var Et = "indent-if-break";
3018
- var Me = "line-suffix";
3019
- var St = "line-suffix-boundary";
3020
- var re = "line";
3021
- var wt = "label";
3022
- var ke = "break-parent";
3023
- var bt = /* @__PURE__ */ new Set([dt, gt, Ae, yt, Le, Te, Ce, Et, Me, St, re, wt, ke]);
3024
- function Fi(t) {
3025
- if (typeof t == "string") return Qe;
3026
- if (Array.isArray(t)) return Ge;
3027
- if (!t) return;
3028
- let { type: e } = t;
3029
- if (bt.has(e)) return e;
3030
- }
3031
- var Nt = Fi;
3032
- var qi = (t) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(t);
3033
- function Ui(t) {
3034
- let e = t === null ? "null" : typeof t;
3035
- if (e !== "string" && e !== "object") return `Unexpected doc '${e}',
3036
- Expected it to be 'string' or 'object'.`;
3037
- if (Nt(t)) throw new Error("doc is valid.");
3038
- let n = Object.prototype.toString.call(t);
3039
- if (n !== "[object Object]") return `Unexpected doc '${n}'.`;
3040
- let r = qi([...bt].map((s) => `'${s}'`));
3041
- return `Unexpected doc.type '${t.type}'.
3042
- Expected it to be ${r}.`;
3043
- }
3044
- var an = class extends Error {
3045
- name = "InvalidDocError";
3046
- constructor(e) {
3047
- super(Ui(e)), this.doc = e;
3048
- }
3049
- };
3050
- var ar = an;
3051
- function Vi(t, e) {
3052
- if (typeof t == "string") return e(t);
3053
- let n = /* @__PURE__ */ new Map();
3054
- return r(t);
3055
- function r(i) {
3056
- if (n.has(i)) return n.get(i);
3057
- let o = s(i);
3058
- return n.set(i, o), o;
3059
- }
3060
- function s(i) {
3061
- switch (Nt(i)) {
3062
- case Ge:
3063
- return e(i.map(r));
3064
- case Te:
3065
- return e({ ...i, parts: i.parts.map(r) });
3066
- case Ce:
3067
- return e({ ...i, breakContents: r(i.breakContents), flatContents: r(i.flatContents) });
3068
- case Le: {
3069
- let { expandedStates: o, contents: a } = i;
3070
- return o ? (o = o.map(r), a = o[0]) : a = r(a), e({ ...i, contents: a, expandedStates: o });
3071
- }
3072
- case Ae:
3073
- case gt:
3074
- case Et:
3075
- case wt:
3076
- case Me:
3077
- return e({ ...i, contents: r(i.contents) });
3078
- case Qe:
3079
- case dt:
3080
- case yt:
3081
- case St:
3082
- case re:
3083
- case ke:
3084
- return e(i);
3085
- default:
3086
- throw new ar(i);
3087
- }
3088
- }
3089
- }
3090
- function cr(t, e = He) {
3091
- return Vi(t, (n) => typeof n == "string" ? v(e, n.split(`
3092
- `)) : n);
3093
- }
3094
- var Z = je;
3095
- var Ot = je;
3096
- var lr = je;
3097
- var fr = je;
3098
- function Je(t, e) {
3099
- return fr(t), Z(e), { type: Ae, contents: e, n: t };
3100
- }
3101
- function cn(t) {
3102
- return Je(Number.NEGATIVE_INFINITY, t);
3103
- }
3104
- function ur(t) {
3105
- return Je({ type: "root" }, t);
3106
- }
3107
- function pr(t) {
3108
- return Je(-1, t);
3109
- }
3110
- var Xe = { type: ke };
3111
- function At(t) {
3112
- return lr(t), { type: Te, parts: t };
3113
- }
3114
- function Pe(t, e = {}) {
3115
- return Z(t), Ot(e.expandedStates, true), { type: Le, id: e.id, contents: t, break: !!e.shouldBreak, expandedStates: e.expandedStates };
3116
- }
3117
- function ln(t, e) {
3118
- return Pe(t[0], { ...e, expandedStates: t });
3119
- }
3120
- function ze(t, e = "", n = {}) {
3121
- return Z(t), e !== "" && Z(e), { type: Ce, breakContents: t, flatContents: e, groupId: n.groupId };
3122
- }
3123
- function v(t, e) {
3124
- Z(t), Ot(e);
3125
- let n = [];
3126
- for (let r = 0; r < e.length; r++) r !== 0 && n.push(t), n.push(e[r]);
3127
- return n;
3128
- }
3129
- var se = { type: re };
3130
- var Lt = { type: re, soft: true };
3131
- var Wi = { type: re, hard: true };
3132
- var N = [Wi, Xe];
3133
- var Ki = { type: re, hard: true, literal: true };
3134
- var He = [Ki, Xe];
3135
- function mr(t) {
3136
- return Z(t), { type: Me, contents: t };
3137
- }
3138
- function Tt(t) {
3139
- return (e, n, r) => {
3140
- let s = !!r?.backwards;
3141
- if (n === false) return false;
3142
- let { length: i } = e, o = n;
3143
- for (; o >= 0 && o < i; ) {
3144
- let a = e.charAt(o);
3145
- if (t instanceof RegExp) {
3146
- if (!t.test(a)) return o;
3147
- } else if (!t.includes(a)) return o;
3148
- s ? o-- : o++;
3149
- }
3150
- return o === -1 || o === i ? o : false;
3151
- };
3152
- }
3153
- var sl = Tt(/\s/u);
3154
- var fn = Tt(" ");
3155
- var il = Tt(",; ");
3156
- var ol = Tt(/[^\n\r]/u);
3157
- var hr = (t) => t === `
3158
- ` || t === "\r" || t === "\u2028" || t === "\u2029";
3159
- function ji(t, e, n) {
3160
- let r = !!n?.backwards;
3161
- if (e === false) return false;
3162
- let s = t.charAt(e);
3163
- if (r) {
3164
- if (t.charAt(e - 1) === "\r" && s === `
3165
- `) return e - 2;
3166
- if (hr(s)) return e - 1;
3167
- } else {
3168
- if (s === "\r" && t.charAt(e + 1) === `
3169
- `) return e + 2;
3170
- if (hr(s)) return e + 1;
3171
- }
3172
- return e;
3173
- }
3174
- var un = ji;
3175
- function Qi(t, e) {
3176
- let n = e - 1;
3177
- n = fn(t, n, { backwards: true }), n = un(t, n, { backwards: true }), n = fn(t, n, { backwards: true });
3178
- let r = un(t, n, { backwards: true });
3179
- return n !== r;
3180
- }
3181
- var pn = Qi;
3182
- var mn = class extends Error {
3183
- name = "UnexpectedNodeError";
3184
- constructor(e, n, r = "type") {
3185
- super(`Unexpected ${n} node ${r}: ${JSON.stringify(e[r])}.`), this.node = e;
3186
- }
3187
- };
3188
- var dr = mn;
3189
- var gr = "format";
3190
- var yr = /^\s*#[^\S\n]*@(?:noformat|noprettier)\s*?(?:\n|$)/u;
3191
- var Er = /^\s*#[^\S\n]*@(?:format|prettier)\s*?(?:\n|$)/u;
3192
- var Sr = /^\s*@(?:format|prettier)\s*$/u;
3193
- var wr = (t) => Sr.test(t);
3194
- var br = (t) => Er.test(t);
3195
- var Nr = (t) => yr.test(t);
3196
- var Or = (t) => `# @${gr}
3197
-
3198
- ${t}`;
3199
- function Ar(t, e) {
3200
- switch (t.type) {
3201
- case "comment":
3202
- if (wr(t.value)) return null;
3203
- break;
3204
- case "quoteDouble":
3205
- case "quoteSingle":
3206
- e.type = "quote";
3207
- break;
3208
- case "document":
3209
- e.directivesEndMarker || delete e.directivesEndMarker, e.documentEndMarker || delete e.documentEndMarker;
3210
- break;
3211
- }
3212
- }
3213
- Ar.ignoredProperties = /* @__PURE__ */ new Set(["position"]);
3214
- var Lr = Ar;
3215
- function Tr(t, e) {
3216
- let { node: n } = t;
3217
- if (n.type === "root" && e.filepath && /(?:[/\\]|^)\.(?:prettier|stylelint|lintstaged)rc$/u.test(e.filepath)) return async (r) => {
3218
- let s = await r(e.originalText, { parser: "json" });
3219
- return s ? [s, N] : void 0;
3220
- };
3221
- }
3222
- Tr.getVisitorKeys = () => [];
3223
- var Cr = Tr;
3224
- var Ze = null;
3225
- function et(t) {
3226
- if (Ze !== null && typeof Ze.property) {
3227
- let e = Ze;
3228
- return Ze = et.prototype = null, e;
3229
- }
3230
- return Ze = et.prototype = t ?? /* @__PURE__ */ Object.create(null), new et();
3231
- }
3232
- var Gi = 10;
3233
- for (let t = 0; t <= Gi; t++) et();
3234
- function hn(t) {
3235
- return et(t);
3236
- }
3237
- function Hi(t, e = "type") {
3238
- hn(t);
3239
- function n(r) {
3240
- let s = r[e], i = t[s];
3241
- if (!Array.isArray(i)) throw Object.assign(new Error(`Missing visitor keys for '${s}'.`), { node: r });
3242
- return i;
3243
- }
3244
- return n;
3245
- }
3246
- var Mr = Hi;
3247
- var k = [["children", "anchor", "tag", "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"], ["anchor", "tag", "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"], ["key", "value", "children", "anchor", "tag", "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"], ["content", "children", "anchor", "tag", "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"], ["indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"]];
3248
- var kr = { root: k[0], document: ["head", "body", "children", "anchor", "tag", "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"], documentHead: k[0], documentBody: k[0], directive: k[1], alias: k[1], blockLiteral: k[1], blockFolded: k[0], plain: k[0], quoteSingle: k[1], quoteDouble: k[1], mapping: k[0], mappingItem: k[2], mappingKey: k[3], mappingValue: k[3], sequence: k[0], sequenceItem: k[3], flowMapping: k[0], flowMappingItem: k[2], flowSequence: k[0], flowSequenceItem: k[3], comment: k[1], tag: k[4], anchor: k[4] };
3249
- var Ji = Mr(kr);
3250
- var Pr = Ji;
3251
- var tt = (t) => t.position.start.offset;
3252
- var vr = (t) => t.position.end.offset;
3253
- function Xi(t) {
3254
- return Array.isArray(t) && t.length > 0;
3255
- }
3256
- var ve = Xi;
3257
- function W(t, e) {
3258
- return typeof t?.type == "string" && e.includes(t.type);
3259
- }
3260
- function dn(t, e, n) {
3261
- return e("children" in t ? { ...t, children: t.children.map((r) => dn(r, e, t)) } : t, n);
3262
- }
3263
- function Ie(t, e, n) {
3264
- Object.defineProperty(t, e, { get: n, enumerable: false });
3265
- }
3266
- function _r(t, e) {
3267
- let n = 0, r = e.length;
3268
- for (let s = t.position.end.offset - 1; s < r; s++) {
3269
- let i = e[s];
3270
- if (i === `
3271
- ` && n++, n === 1 && /\S/u.test(i)) return false;
3272
- if (n === 2) return true;
3273
- }
3274
- return false;
3275
- }
3276
- function Ct(t) {
3277
- let { node: e } = t;
3278
- switch (e.type) {
3279
- case "tag":
3280
- case "anchor":
3281
- case "comment":
3282
- return false;
3283
- }
3284
- let n = t.stack.length;
3285
- for (let r = 1; r < n; r++) {
3286
- let s = t.stack[r], i = t.stack[r - 1];
3287
- if (Array.isArray(i) && typeof s == "number" && s !== i.length - 1) return false;
3288
- }
3289
- return true;
3290
- }
3291
- function Mt(t) {
3292
- return ve(t.children) ? Mt(D(0, t.children, -1)) : t;
3293
- }
3294
- function Ir(t) {
3295
- return t.value.trim() === "prettier-ignore";
3296
- }
3297
- function xr(t) {
3298
- let { node: e } = t;
3299
- if (e.type === "documentBody") {
3300
- let n = t.parent.head;
3301
- return I(n) && Ir(D(0, n.endComments, -1));
3302
- }
3303
- return te(e) && Ir(D(0, e.leadingComments, -1));
3304
- }
3305
- function _e(t) {
3306
- return !ve(t.children) && !zi(t);
3307
- }
3308
- function zi(t) {
3309
- return te(t) || ae(t) || gn(t) || K(t) || I(t);
3310
- }
3311
- function te(t) {
3312
- return ve(t?.leadingComments);
3313
- }
3314
- function ae(t) {
3315
- return ve(t?.middleComments);
3316
- }
3317
- function gn(t) {
3318
- return t?.indicatorComment;
3319
- }
3320
- function K(t) {
3321
- return t?.trailingComment;
3322
- }
3323
- function I(t) {
3324
- return ve(t?.endComments);
3325
- }
3326
- function Rr(t) {
3327
- return t ? t.split(/(?<!^| ) (?! |$)/u) : [];
3328
- }
3329
- function Dr(t, e, n) {
3330
- let r = e.split(`
3331
- `).map((i, o, a) => o === 0 && o === a.length - 1 ? i : o !== 0 && o !== a.length - 1 ? i.trim() : o === 0 ? i.trimEnd() : i.trimStart());
3332
- if (n.proseWrap === "preserve") return r.map((i) => i ? [i] : []);
3333
- let s = [];
3334
- for (let [i, o] of r.entries()) {
3335
- let a = Rr(o);
3336
- i > 0 && r[i - 1].length > 0 && a.length > 0 && !(t === "quoteDouble" && D(0, D(0, s, -1), -1).endsWith("\\")) ? s[s.length - 1] = [...D(0, s, -1), ...a] : s.push(a);
3337
- }
3338
- return n.proseWrap === "never" ? s.map((i) => [i.join(" ")]) : s;
3339
- }
3340
- function $r(t, { parentIndent: e, isLastDescendant: n, options: r }) {
3341
- let s = t.position.start.line === t.position.end.line ? "" : r.originalText.slice(t.position.start.offset, t.position.end.offset).match(/^[^\n]*\n(.*)$/su)[1], i;
3342
- if (t.indent === null) {
3343
- let l = s.match(/^(?<leadingSpace> *)[^\n\r ]/mu);
3344
- i = l ? l.groups.leadingSpace.length : Number.POSITIVE_INFINITY;
3345
- } else i = t.indent - 1 + e;
3346
- let o = s.split(`
3347
- `).map((l) => l.slice(i));
3348
- if (r.proseWrap === "preserve" || t.type === "blockLiteral") return c(o.map((l) => l ? [l] : []));
3349
- let a = [];
3350
- for (let [l, f] of o.entries()) {
3351
- let m = Rr(f);
3352
- l > 0 && m.length > 0 && o[l - 1].length > 0 && !/^\s/u.test(m[0]) && !/^\s|\s$/u.test(D(0, a, -1)) ? a[a.length - 1] = [...D(0, a, -1), ...m] : a.push(m);
3353
- }
3354
- return a = a.map((l) => {
3355
- let f = [];
3356
- for (let m of l) f.length > 0 && /\s$/u.test(D(0, f, -1)) ? f[f.length - 1] += " " + m : f.push(m);
3357
- return f;
3358
- }), r.proseWrap === "never" && (a = a.map((l) => [l.join(" ")])), c(a);
3359
- function c(l) {
3360
- if (t.chomping === "keep") return D(0, l, -1).length === 0 ? l.slice(0, -1) : l;
3361
- let f = 0;
3362
- for (let m = l.length - 1; m >= 0 && l[m].length === 0; m--) f++;
3363
- return f === 0 ? l : f >= 2 && !n ? l.slice(0, -(f - 1)) : l.slice(0, -f);
3364
- }
3365
- }
3366
- function nt(t) {
3367
- if (!t) return true;
3368
- switch (t.type) {
3369
- case "plain":
3370
- case "quoteDouble":
3371
- case "quoteSingle":
3372
- case "alias":
3373
- case "flowMapping":
3374
- case "flowSequence":
3375
- return true;
3376
- default:
3377
- return false;
3378
- }
3379
- }
3380
- var yn = /* @__PURE__ */ new WeakMap();
3381
- function kt(t, e) {
3382
- let { node: n, root: r } = t, s;
3383
- return yn.has(r) ? s = yn.get(r) : (s = /* @__PURE__ */ new Set(), yn.set(r, s)), !s.has(n.position.end.line) && (s.add(n.position.end.line), _r(n, e) && !En(t.parent)) ? Lt : "";
3384
- }
3385
- function En(t) {
3386
- return I(t) && !W(t, ["documentHead", "documentBody", "flowMapping", "flowSequence"]);
3387
- }
3388
- function _(t, e) {
3389
- return Je(" ".repeat(t), e);
3390
- }
3391
- function Zi(t, e, n) {
3392
- let { node: r } = t, s = t.ancestors.filter((l) => l.type === "sequence" || l.type === "mapping").length, i = Ct(t), o = [r.type === "blockFolded" ? ">" : "|"];
3393
- r.indent !== null && o.push(r.indent.toString()), r.chomping !== "clip" && o.push(r.chomping === "keep" ? "+" : "-"), gn(r) && o.push(" ", n("indicatorComment"));
3394
- let a = $r(r, { parentIndent: s, isLastDescendant: i, options: e }), c = [];
3395
- for (let [l, f] of a.entries()) l === 0 && c.push(N), c.push(At(v(se, f))), l !== a.length - 1 ? c.push(f.length === 0 ? N : ur(He)) : r.chomping === "keep" && i && c.push(cn(f.length === 0 ? N : He));
3396
- return r.indent === null ? o.push(pr(_(e.tabWidth, c))) : o.push(cn(_(r.indent - 1 + s, c))), o;
3397
- }
3398
- var Yr = Zi;
3399
- function Pt(t, e, n) {
3400
- let { node: r } = t, s = r.type === "flowMapping", i = s ? "{" : "[", o = s ? "}" : "]", a = Lt;
3401
- s && r.children.length > 0 && e.bracketSpacing && (a = se);
3402
- let c = D(0, r.children, -1), l = c?.type === "flowMappingItem" && _e(c.key) && _e(c.value);
3403
- return [i, _(e.tabWidth, [a, eo(t, e, n), e.trailingComma === "none" ? "" : ze(","), I(r) ? [N, v(N, t.map(n, "endComments"))] : ""]), l ? "" : a, o];
3404
- }
3405
- function eo(t, e, n) {
3406
- return t.map(({ isLast: r, node: s, next: i }) => [n(), r ? "" : [",", se, s.position.start.line !== i.position.start.line ? kt(t, e.originalText) : ""]], "children");
3407
- }
3408
- function to(t, e, n) {
3409
- let { node: r, parent: s } = t, { key: i, value: o } = r, a = _e(i), c = _e(o);
3410
- if (a && c) return ": ";
3411
- let l = n("key"), f = no(r) ? " " : "";
3412
- if (c) return r.type === "flowMappingItem" && s.type === "flowMapping" ? l : r.type === "mappingItem" && Sn(i.content, e) && !K(i.content) && s.tag?.value !== "tag:yaml.org,2002:set" ? [l, f, ":"] : ["? ", _(2, l)];
3413
- let m = n("value");
3414
- if (a) return [": ", _(2, m)];
3415
- if (te(o) || !nt(i.content)) return ["? ", _(2, l), N, ...t.map(() => [n(), N], "value", "leadingComments"), ": ", _(2, m)];
3416
- if (ro(i.content) && !te(i.content) && !ae(i.content) && !K(i.content) && !I(i) && !te(o.content) && !ae(o.content) && !I(o) && Sn(o.content, e)) return [l, f, ": ", m];
3417
- let g = /* @__PURE__ */ Symbol("mappingKey"), y = Pe([ze("? "), Pe(_(2, l), { id: g })]), h = [N, ": ", _(2, m)], d = [f, ":"];
3418
- I(o) && o.content && W(o.content, ["flowMapping", "flowSequence"]) && o.content.children.length === 0 ? d.push(" ") : te(o.content) || I(o) && o.content && !W(o.content, ["mapping", "sequence"]) || s.type === "mapping" && K(i.content) && nt(o.content) || W(o.content, ["mapping", "sequence"]) && o.content.tag === null && o.content.anchor === null ? d.push(N) : o.content ? d.push(se) : K(o) && d.push(" "), d.push(m);
3419
- let w = _(e.tabWidth, d);
3420
- return Sn(i.content, e) && !te(i.content) && !ae(i.content) && !K(i.content) && !I(i) ? ln([[l, w]]) : ln([[y, ze(h, w, { groupId: g })]]);
3421
- }
3422
- function Sn(t, e) {
3423
- if (!t) return true;
3424
- switch (t.type) {
3425
- case "plain":
3426
- case "quoteSingle":
3427
- case "quoteDouble":
3428
- break;
3429
- case "alias":
3430
- return true;
3431
- default:
3432
- return false;
3433
- }
3434
- if (e.proseWrap === "preserve") return t.position.start.line === t.position.end.line;
3435
- if (/\\$/mu.test(e.originalText.slice(t.position.start.offset, t.position.end.offset))) return false;
3436
- switch (e.proseWrap) {
3437
- case "never":
3438
- return !t.value.includes(`
3439
- `);
3440
- case "always":
3441
- return !/[\n ]/u.test(t.value);
3442
- default:
3443
- return false;
3444
- }
3445
- }
3446
- function no(t) {
3447
- return t.key.content?.type === "alias";
3448
- }
3449
- function ro(t) {
3450
- if (!t) return true;
3451
- switch (t.type) {
3452
- case "plain":
3453
- case "quoteDouble":
3454
- case "quoteSingle":
3455
- return t.position.start.line === t.position.end.line;
3456
- case "alias":
3457
- return true;
3458
- default:
3459
- return false;
3460
- }
3461
- }
3462
- var Br = to;
3463
- function so(t) {
3464
- return dn(t, io);
3465
- }
3466
- function io(t) {
3467
- switch (t.type) {
3468
- case "document":
3469
- Ie(t, "head", () => t.children[0]), Ie(t, "body", () => t.children[1]);
3470
- break;
3471
- case "documentBody":
3472
- case "sequenceItem":
3473
- case "flowSequenceItem":
3474
- case "mappingKey":
3475
- case "mappingValue":
3476
- Ie(t, "content", () => t.children[0]);
3477
- break;
3478
- case "mappingItem":
3479
- case "flowMappingItem":
3480
- Ie(t, "key", () => t.children[0]), Ie(t, "value", () => t.children[1]);
3481
- break;
3482
- }
3483
- return t;
3484
- }
3485
- var Fr = so;
3486
- function oo(t, e, n) {
3487
- let { node: r } = t, s = [];
3488
- r.type !== "mappingValue" && te(r) && s.push([v(N, t.map(n, "leadingComments")), N]);
3489
- let { tag: i, anchor: o } = r;
3490
- i && s.push(n("tag")), i && o && s.push(" "), o && s.push(n("anchor"));
3491
- let a = "";
3492
- return W(r, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !Ct(t) && (a = kt(t, e.originalText)), (i || o) && (W(r, ["sequence", "mapping"]) && !ae(r) ? s.push(N) : s.push(" ")), ae(r) && s.push([r.middleComments.length === 1 ? "" : N, v(N, t.map(n, "middleComments")), N]), xr(t) ? s.push(cr(e.originalText.slice(r.position.start.offset, r.position.end.offset).trimEnd())) : s.push(Pe(ao(t, e, n))), K(r) && !W(r, ["document", "documentHead"]) && s.push(mr([r.type === "mappingValue" && !r.content ? "" : " ", t.parent.type === "mappingKey" && t.getParentNode(2).type === "mapping" && nt(r) ? "" : Xe, n("trailingComment")])), En(r) && s.push(_(r.type === "sequenceItem" ? 2 : 0, [N, v(N, t.map(({ node: c }) => [pn(e.originalText, tt(c)) ? N : "", n()], "endComments"))])), s.push(a), s;
3493
- }
3494
- function ao(t, e, n) {
3495
- let { node: r } = t;
3496
- switch (r.type) {
3497
- case "root": {
3498
- let s = Mt(r), i = !(W(s, ["blockLiteral", "blockFolded"]) && s.chomping === "keep"), o = [];
3499
- return t.each(({ node: a, isFirst: c }) => {
3500
- c || o.push(N), o.push(n()), lo(t) && (i && o.push(N), o.push("..."), K(a) && o.push(" ", n("trailingComment")));
3501
- }, "children"), i && o.push(N), o;
3502
- }
3503
- case "document": {
3504
- let s = [];
3505
- return fo(t) && ((r.head.children.length > 0 || r.head.endComments.length > 0) && s.push(n("head")), K(r.head) ? s.push(["---", " ", n(["head", "trailingComment"])]) : s.push("---")), co(r) && s.push(n("body")), v(N, s);
3506
- }
3507
- case "documentHead":
3508
- return v(N, [...t.map(n, "children"), ...t.map(n, "endComments")]);
3509
- case "documentBody": {
3510
- let { children: s, endComments: i } = r, o = "";
3511
- if (s.length > 0 && i.length > 0) {
3512
- let a = Mt(r);
3513
- if (W(a, ["blockFolded", "blockLiteral"])) a.chomping !== "keep" && (o = [N, N]);
3514
- else {
3515
- let c = D(0, s, -1);
3516
- o = W(c, ["mapping"]) && pn(e.originalText, tt(i[0])) ? [N, N] : N;
3517
- }
3518
- }
3519
- return [v(N, t.map(n, "children")), o, v(N, t.map(n, "endComments"))];
3520
- }
3521
- case "directive":
3522
- return ["%", v(" ", [r.name, ...r.parameters])];
3523
- case "comment":
3524
- return ["#", r.value];
3525
- case "alias":
3526
- return ["*", r.value];
3527
- case "tag":
3528
- return e.originalText.slice(r.position.start.offset, r.position.end.offset);
3529
- case "anchor":
3530
- return ["&", r.value];
3531
- case "plain":
3532
- return rt(r.type, e.originalText.slice(r.position.start.offset, r.position.end.offset), e);
3533
- case "quoteDouble":
3534
- case "quoteSingle": {
3535
- let o = e.originalText.slice(r.position.start.offset + 1, r.position.end.offset - 1);
3536
- if (r.type === "quoteSingle" && o.includes("\\") || r.type === "quoteDouble" && /\\[^"]/u.test(o)) {
3537
- let c = r.type === "quoteDouble" ? '"' : "'";
3538
- return [c, rt(r.type, o, e), c];
3539
- }
3540
- if (o.includes('"')) return ["'", rt(r.type, r.type === "quoteDouble" ? ht(0, ht(0, o, '\\"', '"'), "'", "'".repeat(2)) : o, e), "'"];
3541
- if (o.includes("'")) return ['"', rt(r.type, r.type === "quoteSingle" ? ht(0, o, "''", "'") : o, e), '"'];
3542
- let a = e.singleQuote ? "'" : '"';
3543
- return [a, rt(r.type, o, e), a];
3544
- }
3545
- case "blockFolded":
3546
- case "blockLiteral":
3547
- return Yr(t, e, n);
3548
- case "mapping":
3549
- case "sequence":
3550
- return v(N, t.map(n, "children"));
3551
- case "sequenceItem":
3552
- return ["- ", _(2, r.content ? n("content") : "")];
3553
- case "mappingKey":
3554
- case "mappingValue":
3555
- return r.content ? n("content") : "";
3556
- case "mappingItem":
3557
- case "flowMappingItem":
3558
- return Br(t, e, n);
3559
- case "flowMapping":
3560
- return Pt(t, e, n);
3561
- case "flowSequence":
3562
- return Pt(t, e, n);
3563
- case "flowSequenceItem":
3564
- return n("content");
3565
- default:
3566
- throw new dr(r, "YAML");
3567
- }
3568
- }
3569
- function co(t) {
3570
- return t.body.children.length > 0 || I(t.body);
3571
- }
3572
- function lo(t) {
3573
- let e = t.node;
3574
- if (e.documentEndMarker || K(e)) return true;
3575
- if (t.isLast) return false;
3576
- let n = t.next;
3577
- return n.head.children.length > 0 || I(n.head);
3578
- }
3579
- function fo(t) {
3580
- let e = t.node;
3581
- return e.directivesEndMarker || e.head.children.length > 0 || I(e.head) || K(e.head);
3582
- }
3583
- function rt(t, e, n) {
3584
- let r = Dr(t, e, n);
3585
- return v(N, r.map((s) => At(v(se, s))));
3586
- }
3587
- var uo = { preprocess: Fr, embed: Cr, print: oo, massageAstNode: Lr, insertPragma: Or, getVisitorKeys: Pr };
3588
- var qr = uo;
3589
- var Ur = [{ name: "YAML", type: "data", aceMode: "yaml", extensions: [".yml", ".mir", ".reek", ".rviz", ".sublime-syntax", ".syntax", ".yaml", ".yaml-tmlanguage", ".yaml.sed", ".yml.mysql"], filenames: [".clang-format", ".clang-tidy", ".clangd", ".gemrc", "CITATION.cff", "glide.lock", "pixi.lock", ".prettierrc", ".stylelintrc", ".lintstagedrc"], tmScope: "source.yaml", aliases: ["yml"], codemirrorMode: "yaml", codemirrorMimeType: "text/x-yaml", parsers: ["yaml"], vscodeLanguageIds: ["yaml", "ansible", "dockercompose", "github-actions-workflow", "home-assistant"], linguistLanguageId: 407 }];
3590
- var vt = { bracketSpacing: { category: "Common", type: "boolean", default: true, description: "Print spaces between brackets.", oppositeDescription: "Do not print spaces between brackets." }, objectWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap object literals.", choices: [{ value: "preserve", description: "Keep as multi-line, if there is a newline between the opening brace and first property." }, { value: "collapse", description: "Fit to a single line when possible." }] }, singleQuote: { category: "Common", type: "boolean", default: false, description: "Use single quotes instead of double quotes." }, proseWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap prose.", choices: [{ value: "always", description: "Wrap prose if it exceeds the print width." }, { value: "never", description: "Do not wrap prose." }, { value: "preserve", description: "Wrap prose as-is." }] }, bracketSameLine: { category: "Common", type: "boolean", default: false, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: false, description: "Enforce single attribute per line in HTML, Vue and JSX." } };
3591
- var po = { bracketSpacing: vt.bracketSpacing, singleQuote: vt.singleQuote, proseWrap: vt.proseWrap };
3592
- var Vr = po;
3593
- var ir = {};
3594
- or(ir, { yaml: () => Ha });
3595
- var sr = on(Gn(), 1);
3596
- var J = on(Ps(), 1);
3597
- var Cf = J.default.findPair;
3598
- var Mf = J.default.toJSON;
3599
- var kf = J.default.parseMap;
3600
- var Pf = J.default.parseSeq;
3601
- var vf = J.default.stringifyNumber;
3602
- var If = J.default.stringifyString;
3603
- var _f = J.default.Type;
3604
- var xf = J.default.YAMLError;
3605
- var Rf = J.default.YAMLReferenceError;
3606
- var vs = J.default.YAMLSemanticError;
3607
- var Df = J.default.YAMLSyntaxError;
3608
- var $f = J.default.YAMLWarning;
3609
- function F(t, e = null) {
3610
- "children" in t && t.children.forEach((n) => F(n, t)), "anchor" in t && t.anchor && F(t.anchor, t), "tag" in t && t.tag && F(t.tag, t), "leadingComments" in t && t.leadingComments.forEach((n) => F(n, t)), "middleComments" in t && t.middleComments.forEach((n) => F(n, t)), "indicatorComment" in t && t.indicatorComment && F(t.indicatorComment, t), "trailingComment" in t && t.trailingComment && F(t.trailingComment, t), "endComments" in t && t.endComments.forEach((n) => F(n, t)), Object.defineProperty(t, "_parent", { value: e, enumerable: false });
3611
- }
3612
- function Oe(t) {
3613
- return `${t.line}:${t.column}`;
3614
- }
3615
- function Is(t) {
3616
- F(t);
3617
- let e = _a(t), n = t.children.slice();
3618
- t.comments.sort((r, s) => r.position.start.offset - s.position.end.offset).filter((r) => !r._parent).forEach((r) => {
3619
- for (; n.length > 1 && r.position.start.line > n[0].position.end.line; ) n.shift();
3620
- xa(r, e, n[0]);
3621
- });
3622
- }
3623
- function _a(t) {
3624
- let e = Array.from(new Array(t.position.end.line), () => ({}));
3625
- for (let n of t.comments) e[n.position.start.line - 1].comment = n;
3626
- return _s(e, t), e;
3627
- }
3628
- function _s(t, e) {
3629
- if (e.position.start.offset !== e.position.end.offset) {
3630
- if ("leadingComments" in e) {
3631
- let { start: n } = e.position, { leadingAttachableNode: r } = t[n.line - 1];
3632
- (!r || n.column < r.position.start.column) && (t[n.line - 1].leadingAttachableNode = e);
3633
- }
3634
- if ("trailingComment" in e && e.position.end.column > 1 && e.type !== "document" && e.type !== "documentHead") {
3635
- let { end: n } = e.position, { trailingAttachableNode: r } = t[n.line - 1];
3636
- (!r || n.column >= r.position.end.column) && (t[n.line - 1].trailingAttachableNode = e);
3637
- }
3638
- if (e.type !== "root" && e.type !== "document" && e.type !== "documentHead" && e.type !== "documentBody") {
3639
- let { start: n, end: r } = e.position, s = [r.line].concat(n.line === r.line ? [] : n.line);
3640
- for (let i of s) {
3641
- let o = t[i - 1].trailingNode;
3642
- (!o || r.column >= o.position.end.column) && (t[i - 1].trailingNode = e);
3643
- }
3644
- }
3645
- "children" in e && e.children.forEach((n) => {
3646
- _s(t, n);
3647
- });
3648
- }
3649
- }
3650
- function xa(t, e, n) {
3651
- let r = t.position.start.line, { trailingAttachableNode: s } = e[r - 1];
3652
- if (s) {
3653
- if (s.trailingComment) throw new Error(`Unexpected multiple trailing comment at ${Oe(t.position.start)}`);
3654
- F(t, s), s.trailingComment = t;
3655
- return;
3656
- }
3657
- for (let o = r; o >= n.position.start.line; o--) {
3658
- let { trailingNode: a } = e[o - 1], c;
3659
- if (a) c = a;
3660
- else if (o !== r && e[o - 1].comment) c = e[o - 1].comment._parent;
3661
- else continue;
3662
- if ((c.type === "sequence" || c.type === "mapping") && (c = c.children[0]), c.type === "mappingItem") {
3663
- let [l, f] = c.children;
3664
- c = xs(l) ? l : f;
3665
- }
3666
- for (; ; ) {
3667
- if (Ra(c, t)) {
3668
- F(t, c), c.endComments.push(t);
3669
- return;
3670
- }
3671
- if (!c._parent) break;
3672
- c = c._parent;
3673
- }
3674
- break;
3675
- }
3676
- for (let o = r + 1; o <= n.position.end.line; o++) {
3677
- let { leadingAttachableNode: a } = e[o - 1];
3678
- if (a) {
3679
- F(t, a), a.leadingComments.push(t);
3680
- return;
3681
- }
3682
- }
3683
- let i = n.children[1];
3684
- F(t, i), i.endComments.push(t);
3685
- }
3686
- function Ra(t, e) {
3687
- if (t.position.start.offset < e.position.start.offset && t.position.end.offset > e.position.end.offset) switch (t.type) {
3688
- case "flowMapping":
3689
- case "flowSequence":
3690
- return t.children.length === 0 || e.position.start.line > t.children[t.children.length - 1].position.end.line;
3691
- }
3692
- if (e.position.end.offset < t.position.end.offset) return false;
3693
- switch (t.type) {
3694
- case "sequenceItem":
3695
- return e.position.start.column > t.position.start.column;
3696
- case "mappingKey":
3697
- case "mappingValue":
3698
- return e.position.start.column > t._parent.position.start.column && (t.children.length === 0 || t.children.length === 1 && t.children[0].type !== "blockFolded" && t.children[0].type !== "blockLiteral") && (t.type === "mappingValue" || xs(t));
3699
- default:
3700
- return false;
3701
- }
3702
- }
3703
- function xs(t) {
3704
- return t.position.start !== t.position.end && (t.children.length === 0 || t.position.start.offset !== t.children[0].position.start.offset);
3705
- }
3706
- function b(t, e) {
3707
- return { type: t, position: e };
3708
- }
3709
- function Rs(t, e, n) {
3710
- return { ...b("root", t), children: e, comments: n };
3711
- }
3712
- function pt(t) {
3713
- switch (t.type) {
3714
- case "DOCUMENT":
3715
- for (let e = t.contents.length - 1; e >= 0; e--) t.contents[e].type === "BLANK_LINE" ? t.contents.splice(e, 1) : pt(t.contents[e]);
3716
- for (let e = t.directives.length - 1; e >= 0; e--) t.directives[e].type === "BLANK_LINE" && t.directives.splice(e, 1);
3717
- break;
3718
- case "FLOW_MAP":
3719
- case "FLOW_SEQ":
3720
- case "MAP":
3721
- case "SEQ":
3722
- for (let e = t.items.length - 1; e >= 0; e--) {
3723
- let n = t.items[e];
3724
- "char" in n || (n.type === "BLANK_LINE" ? t.items.splice(e, 1) : pt(n));
3725
- }
3726
- break;
3727
- case "MAP_KEY":
3728
- case "MAP_VALUE":
3729
- case "SEQ_ITEM":
3730
- t.node && pt(t.node);
3731
- break;
3732
- case "ALIAS":
3733
- case "BLANK_LINE":
3734
- case "BLOCK_FOLDED":
3735
- case "BLOCK_LITERAL":
3736
- case "COMMENT":
3737
- case "DIRECTIVE":
3738
- case "PLAIN":
3739
- case "QUOTE_DOUBLE":
3740
- case "QUOTE_SINGLE":
3741
- break;
3742
- default:
3743
- throw new Error(`Unexpected node type ${JSON.stringify(t.type)}`);
3744
- }
3745
- }
3746
- function X(t, e) {
3747
- return { start: t, end: e };
3748
- }
3749
- function Hn(t) {
3750
- return { start: t, end: t };
3751
- }
3752
- var me;
3753
- (function(t) {
3754
- t.Tag = "!", t.Anchor = "&", t.Comment = "#";
3755
- })(me || (me = {}));
3756
- function Ds(t, e) {
3757
- return { ...b("anchor", t), value: e };
3758
- }
3759
- function Ve(t, e) {
3760
- return { ...b("comment", t), value: e };
3761
- }
3762
- function $s(t, e, n) {
3763
- return { anchor: e, tag: t, middleComments: n };
3764
- }
3765
- function Ys(t, e) {
3766
- return { ...b("tag", t), value: e };
3767
- }
3768
- function Ht(t, e, n = () => false) {
3769
- let r = t.cstNode, s = [], i = null, o = null, a = null;
3770
- for (let c of r.props) {
3771
- let l = e.text[c.origStart];
3772
- switch (l) {
3773
- case me.Tag:
3774
- i = i || c, o = Ys(e.transformRange(c), t.tag);
3775
- break;
3776
- case me.Anchor:
3777
- i = i || c, a = Ds(e.transformRange(c), r.anchor);
3778
- break;
3779
- case me.Comment: {
3780
- let f = Ve(e.transformRange(c), e.text.slice(c.origStart + 1, c.origEnd));
3781
- e.comments.push(f), !n(f) && i && i.origEnd <= c.origStart && c.origEnd <= r.valueRange.origStart && s.push(f);
3782
- break;
3783
- }
3784
- default:
3785
- throw new Error(`Unexpected leading character ${JSON.stringify(l)}`);
3786
- }
3787
- }
3788
- return $s(o, a, s);
3789
- }
3790
- function z() {
3791
- return { leadingComments: [] };
3792
- }
3793
- function he(t = null) {
3794
- return { trailingComment: t };
3795
- }
3796
- function q() {
3797
- return { ...z(), ...he() };
3798
- }
3799
- function Bs(t, e, n) {
3800
- return { ...b("alias", t), ...q(), ...e, value: n };
3801
- }
3802
- function Fs(t, e) {
3803
- let n = t.cstNode;
3804
- return Bs(e.transformRange({ origStart: n.valueRange.origStart - 1, origEnd: n.valueRange.origEnd }), e.transformContent(t), n.rawValue);
3805
- }
3806
- function qs(t) {
3807
- return { ...t, type: "blockFolded" };
3808
- }
3809
- function Us(t, e, n, r, s, i) {
3810
- return { ...b("blockValue", t), ...z(), ...e, chomping: n, indent: r, value: s, indicatorComment: i };
3811
- }
3812
- var Jn;
3813
- (function(t) {
3814
- t.CLIP = "clip", t.STRIP = "strip", t.KEEP = "keep";
3815
- })(Jn || (Jn = {}));
3816
- function Jt(t, e) {
3817
- let n = t.cstNode, r = 1, s = n.chomping === "CLIP" ? 0 : 1, o = n.header.origEnd - n.header.origStart - r - s !== 0, a = e.transformRange({ origStart: n.header.origStart, origEnd: n.valueRange.origEnd }), c = null, l = Ht(t, e, (f) => {
3818
- if (!(a.start.offset < f.position.start.offset && f.position.end.offset < a.end.offset)) return false;
3819
- if (c) throw new Error(`Unexpected multiple indicator comments at ${Oe(f.position.start)}`);
3820
- return c = f, true;
3821
- });
3822
- return Us(a, l, Jn[n.chomping], o ? n.blockIndent : null, n.strValue, c);
3823
- }
3824
- function Vs(t, e) {
3825
- return qs(Jt(t, e));
3826
- }
3827
- function Ws(t) {
3828
- return { ...t, type: "blockLiteral" };
3829
- }
3830
- function Ks(t, e) {
3831
- return Ws(Jt(t, e));
3832
- }
3833
- function js(t, e) {
3834
- return Ve(e.transformRange(t.range), t.comment);
3835
- }
3836
- function Qs(t, e, n) {
3837
- return { ...b("directive", t), ...q(), name: e, parameters: n };
3838
- }
3839
- function We(t, e) {
3840
- for (let n of t.props) {
3841
- let r = e.text[n.origStart];
3842
- switch (r) {
3843
- case me.Comment:
3844
- e.comments.push(Ve(e.transformRange(n), e.text.slice(n.origStart + 1, n.origEnd)));
3845
- break;
3846
- default:
3847
- throw new Error(`Unexpected leading character ${JSON.stringify(r)}`);
3848
- }
3849
- }
3850
- }
3851
- function Gs(t, e) {
3852
- return We(t, e), Qs(e.transformRange(t.range), t.name, t.parameters);
3853
- }
3854
- function Hs(t, e, n, r, s, i) {
3855
- return { ...b("document", t), ...he(i), directivesEndMarker: e, documentEndMarker: n, children: [r, s] };
3856
- }
3857
- function U(t = []) {
3858
- return { endComments: t };
3859
- }
3860
- function Js(t, e, n) {
3861
- return { ...b("documentBody", t), ...U(n), children: e ? [e] : [] };
3862
- }
3863
- function V(t) {
3864
- return t[t.length - 1];
3865
- }
3866
- function Xt(t, e) {
3867
- let n = t.match(e);
3868
- return n ? n.index : -1;
3869
- }
3870
- function Xs(t, e, n) {
3871
- let r = t.cstNode, { comments: s, endComments: i, documentTrailingComment: o, documentHeadTrailingComment: a } = Da(r, e, n), c = e.transformNode(t.contents), { position: l, documentEndPoint: f } = $a(r, c, e);
3872
- return e.comments.push(...s, ...i), { documentBody: Js(l, c, i), documentEndPoint: f, documentTrailingComment: o, documentHeadTrailingComment: a };
3873
- }
3874
- function Da(t, e, n) {
3875
- let r = [], s = [], i = [], o = [], a = false;
3876
- for (let c = t.contents.length - 1; c >= 0; c--) {
3877
- let l = t.contents[c];
3878
- if (l.type === "COMMENT") {
3879
- let f = e.transformNode(l);
3880
- n && n.line === f.position.start.line ? o.unshift(f) : a ? r.unshift(f) : f.position.start.offset >= t.valueRange.origEnd ? i.unshift(f) : r.unshift(f);
3881
- } else a = true;
3882
- }
3883
- if (i.length > 1) throw new Error(`Unexpected multiple document trailing comments at ${Oe(i[1].position.start)}`);
3884
- if (o.length > 1) throw new Error(`Unexpected multiple documentHead trailing comments at ${Oe(o[1].position.start)}`);
3885
- return { comments: r, endComments: s, documentTrailingComment: V(i) || null, documentHeadTrailingComment: V(o) || null };
3886
- }
3887
- function $a(t, e, n) {
3888
- let r = Xt(n.text.slice(t.valueRange.origEnd), /^\.\.\./), s = r === -1 ? t.valueRange.origEnd : Math.max(0, t.valueRange.origEnd - 1);
3889
- n.text[s - 1] === "\r" && s--;
3890
- let i = n.transformRange({ origStart: e !== null ? e.position.start.offset : s, origEnd: s }), o = r === -1 ? i.end : n.transformOffset(t.valueRange.origEnd + 3);
3891
- return { position: i, documentEndPoint: o };
3892
- }
3893
- function zs(t, e, n, r) {
3894
- return { ...b("documentHead", t), ...U(n), ...he(r), children: e };
3895
- }
3896
- function Zs(t, e) {
3897
- let n = t.cstNode, { directives: r, comments: s, endComments: i } = Ya(n, e), { position: o, documentEndMarkererPoint: a } = Ba(n, r, e);
3898
- return e.comments.push(...s, ...i), { createDocumentHeadWithTrailingComment: (l) => (l && e.comments.push(l), zs(o, r, i, l)), documentHeadEndMarkerPoint: a };
3899
- }
3900
- function Ya(t, e) {
3901
- let n = [], r = [], s = [], i = false;
3902
- for (let o = t.directives.length - 1; o >= 0; o--) {
3903
- let a = e.transformNode(t.directives[o]);
3904
- a.type === "comment" ? i ? r.unshift(a) : s.unshift(a) : (i = true, n.unshift(a));
3905
- }
3906
- return { directives: n, comments: r, endComments: s };
3907
- }
3908
- function Ba(t, e, n) {
3909
- let r = Xt(n.text.slice(0, t.valueRange.origStart), /---\s*$/);
3910
- r > 0 && !/[\r\n]/.test(n.text[r - 1]) && (r = -1);
3911
- let s = r === -1 ? { origStart: t.valueRange.origStart, origEnd: t.valueRange.origStart } : { origStart: r, origEnd: r + 3 };
3912
- return e.length !== 0 && (s.origStart = e[0].position.start.offset), { position: n.transformRange(s), documentEndMarkererPoint: r === -1 ? null : n.transformOffset(r) };
3913
- }
3914
- function ei(t, e) {
3915
- let { createDocumentHeadWithTrailingComment: n, documentHeadEndMarkerPoint: r } = Zs(t, e), { documentBody: s, documentEndPoint: i, documentTrailingComment: o, documentHeadTrailingComment: a } = Xs(t, e, r), c = n(a);
3916
- o && e.comments.push(o);
3917
- let l = t.cstNode;
3918
- return Hs(X(c.position.start, i), !!l.directivesEndMarker, !!l.documentEndMarker, c, s, o);
3919
- }
3920
- function zt(t, e, n) {
3921
- return { ...b("flowCollection", t), ...q(), ...U(), ...e, children: n };
3922
- }
3923
- function ti(t, e, n) {
3924
- return { ...zt(t, e, n), type: "flowMapping" };
3925
- }
3926
- function Zt(t, e, n) {
3927
- return { ...b("flowMappingItem", t), ...z(), children: [e, n] };
3928
- }
3929
- function de(t, e) {
3930
- let n = [];
3931
- for (let r of t) r && "type" in r && r.type === "COMMENT" ? e.comments.push(e.transformNode(r)) : n.push(r);
3932
- return n;
3933
- }
3934
- function en(t) {
3935
- let [e, n] = ["?", ":"].map((r) => {
3936
- let s = t.find((i) => "char" in i && i.char === r);
3937
- return s ? { origStart: s.origOffset, origEnd: s.origOffset + 1 } : null;
3938
- });
3939
- return { additionalKeyRange: e, additionalValueRange: n };
3940
- }
3941
- function tn(t, e) {
3942
- let n = e;
3943
- return (r) => t.slice(n, n = r);
3944
- }
3945
- function nn(t) {
3946
- let e = [], n = tn(t, 1), r = false;
3947
- for (let s = 1; s < t.length - 1; s++) {
3948
- let i = t[s];
3949
- if ("char" in i && i.char === ",") {
3950
- e.push(n(s)), n(s + 1), r = false;
3951
- continue;
3952
- }
3953
- r = true;
3954
- }
3955
- return r && e.push(n(t.length - 1)), e;
3956
- }
3957
- function Xn(t, e) {
3958
- return { ...b("mappingKey", t), ...he(), ...U(), children: e ? [e] : [] };
3959
- }
3960
- function zn(t, e) {
3961
- return { ...b("mappingValue", t), ...q(), ...U(), children: e ? [e] : [] };
3962
- }
3963
- function Ke(t, e, n, r, s) {
3964
- let i = e.transformNode(t.key), o = e.transformNode(t.value), a = i || r ? Xn(e.transformRange({ origStart: r ? r.origStart : i.position.start.offset, origEnd: i ? i.position.end.offset : r.origStart + 1 }), i) : null, c = o || s ? zn(e.transformRange({ origStart: s ? s.origStart : o.position.start.offset, origEnd: o ? o.position.end.offset : s.origStart + 1 }), o) : null;
3965
- return n(X(a ? a.position.start : c.position.start, c ? c.position.end : a.position.end), a || Xn(Hn(c.position.start), null), c || zn(Hn(a.position.end), null));
3966
- }
3967
- function ni(t, e) {
3968
- let n = de(t.cstNode.items, e), r = nn(n), s = t.items.map((a, c) => {
3969
- let l = r[c], { additionalKeyRange: f, additionalValueRange: m } = en(l);
3970
- return Ke(a, e, Zt, f, m);
3971
- }), i = n[0], o = V(n);
3972
- return ti(e.transformRange({ origStart: i.origOffset, origEnd: o.origOffset + 1 }), e.transformContent(t), s);
3973
- }
3974
- function ri(t, e, n) {
3975
- return { ...zt(t, e, n), type: "flowSequence" };
3976
- }
3977
- function si(t, e) {
3978
- return { ...b("flowSequenceItem", t), children: [e] };
3979
- }
3980
- function ii(t, e) {
3981
- let n = de(t.cstNode.items, e), r = nn(n), s = t.items.map((a, c) => {
3982
- if (a.type !== "PAIR") {
3983
- let l = e.transformNode(a);
3984
- return si(X(l.position.start, l.position.end), l);
3985
- } else {
3986
- let l = r[c], { additionalKeyRange: f, additionalValueRange: m } = en(l);
3987
- return Ke(a, e, Zt, f, m);
3988
- }
3989
- }), i = n[0], o = V(n);
3990
- return ri(e.transformRange({ origStart: i.origOffset, origEnd: o.origOffset + 1 }), e.transformContent(t), s);
3991
- }
3992
- function oi(t, e, n) {
3993
- return { ...b("mapping", t), ...z(), ...e, children: n };
3994
- }
3995
- function ai(t, e, n) {
3996
- return { ...b("mappingItem", t), ...z(), children: [e, n] };
3997
- }
3998
- function ci(t, e) {
3999
- let n = t.cstNode;
4000
- n.items.filter((o) => o.type === "MAP_KEY" || o.type === "MAP_VALUE").forEach((o) => We(o, e));
4001
- let r = de(n.items, e), s = Fa(r), i = t.items.map((o, a) => {
4002
- let c = s[a], [l, f] = c[0].type === "MAP_VALUE" ? [null, c[0].range] : [c[0].range, c.length === 1 ? null : c[1].range];
4003
- return Ke(o, e, ai, l, f);
4004
- });
4005
- return oi(X(i[0].position.start, V(i).position.end), e.transformContent(t), i);
4006
- }
4007
- function Fa(t) {
4008
- let e = [], n = tn(t, 0), r = false;
4009
- for (let s = 0; s < t.length; s++) {
4010
- if (t[s].type === "MAP_VALUE") {
4011
- e.push(n(s + 1)), r = false;
4012
- continue;
4013
- }
4014
- r && e.push(n(s)), r = true;
4015
- }
4016
- return r && e.push(n(1 / 0)), e;
4017
- }
4018
- function li(t, e, n) {
4019
- return { ...b("plain", t), ...q(), ...e, value: n };
4020
- }
4021
- function fi(t, e, n) {
4022
- for (let r = e; r >= 0; r--) if (n.test(t[r])) return r;
4023
- return -1;
4024
- }
4025
- function ui(t, e) {
4026
- let n = t.cstNode;
4027
- return li(e.transformRange({ origStart: n.valueRange.origStart, origEnd: fi(e.text, n.valueRange.origEnd - 1, /\S/) + 1 }), e.transformContent(t), n.strValue);
4028
- }
4029
- function pi(t) {
4030
- return { ...t, type: "quoteDouble" };
4031
- }
4032
- function mi(t, e, n) {
4033
- return { ...b("quoteValue", t), ...e, ...q(), value: n };
4034
- }
4035
- function rn(t, e) {
4036
- let n = t.cstNode;
4037
- return mi(e.transformRange(n.valueRange), e.transformContent(t), n.strValue);
4038
- }
4039
- function hi(t, e) {
4040
- return pi(rn(t, e));
4041
- }
4042
- function di(t) {
4043
- return { ...t, type: "quoteSingle" };
4044
- }
4045
- function gi(t, e) {
4046
- return di(rn(t, e));
4047
- }
4048
- function yi(t, e, n) {
4049
- return { ...b("sequence", t), ...z(), ...U(), ...e, children: n };
4050
- }
4051
- function Ei(t, e) {
4052
- return { ...b("sequenceItem", t), ...q(), ...U(), children: e ? [e] : [] };
4053
- }
4054
- function Si(t, e) {
4055
- let r = de(t.cstNode.items, e).map((s, i) => {
4056
- We(s, e);
4057
- let o = e.transformNode(t.items[i]);
4058
- return Ei(X(e.transformOffset(s.valueRange.origStart), o === null ? e.transformOffset(s.valueRange.origStart + 1) : o.position.end), o);
4059
- });
4060
- return yi(X(r[0].position.start, V(r).position.end), e.transformContent(t), r);
4061
- }
4062
- function wi(t, e) {
4063
- if (t === null || t.type === void 0 && t.value === null) return null;
4064
- switch (t.type) {
4065
- case "ALIAS":
4066
- return Fs(t, e);
4067
- case "BLOCK_FOLDED":
4068
- return Vs(t, e);
4069
- case "BLOCK_LITERAL":
4070
- return Ks(t, e);
4071
- case "COMMENT":
4072
- return js(t, e);
4073
- case "DIRECTIVE":
4074
- return Gs(t, e);
4075
- case "DOCUMENT":
4076
- return ei(t, e);
4077
- case "FLOW_MAP":
4078
- return ni(t, e);
4079
- case "FLOW_SEQ":
4080
- return ii(t, e);
4081
- case "MAP":
4082
- return ci(t, e);
4083
- case "PLAIN":
4084
- return ui(t, e);
4085
- case "QUOTE_DOUBLE":
4086
- return hi(t, e);
4087
- case "QUOTE_SINGLE":
4088
- return gi(t, e);
4089
- case "SEQ":
4090
- return Si(t, e);
4091
- default:
4092
- throw new Error(`Unexpected node type ${t.type}`);
4093
- }
4094
- }
4095
- var Zn;
4096
- var er = class {
4097
- text;
4098
- comments = [];
4099
- #e;
4100
- #t;
4101
- constructor(e, n) {
4102
- this.text = n, this.#e = e;
4103
- }
4104
- setOrigRanges() {
4105
- if (!this.#e.setOrigRanges()) for (let e of this.#e) e.setOrigRanges([], 0);
4106
- }
4107
- #n(e) {
4108
- if (!Zn) {
4109
- let [o] = this.#e, a = Object.getPrototypeOf(Object.getPrototypeOf(o));
4110
- Zn = Object.getOwnPropertyDescriptor(a, "rangeAsLinePos").get;
4111
- }
4112
- if (this.#t ?? (this.#t = { root: { context: { src: this.text } } }), this.text === "" && e.origStart === 0 && e.origEnd === 0) return { start: { offset: 0, line: 1, column: 1 }, end: { offset: 0, line: 1, column: 1 } };
4113
- let { start: { line: n, col: r }, end: { line: s, col: i } } = Zn.call({ range: { start: this.#r(e.origStart), end: this.#r(e.origEnd) }, context: this.#t });
4114
- return { start: { offset: e.origStart, line: n, column: r }, end: { offset: e.origEnd, line: s, column: i } };
4115
- }
4116
- #r(e) {
4117
- return e < 0 ? 0 : e > this.text.length ? this.text.length : e;
4118
- }
4119
- transformOffset(e) {
4120
- return this.#n({ origStart: e, origEnd: e }).start;
4121
- }
4122
- transformRange(e) {
4123
- let { start: n, end: r } = this.#n(e);
4124
- return X(n, r);
4125
- }
4126
- transformNode(e) {
4127
- return wi(e, this);
4128
- }
4129
- transformContent(e) {
4130
- return Ht(e, this);
4131
- }
4132
- };
4133
- var bi = er;
4134
- function Ni(t, e, n) {
4135
- let r = new SyntaxError(t);
4136
- return r.name = "YAMLSyntaxError", r.source = e, r.position = n, r;
4137
- }
4138
- function Oi(t, e) {
4139
- let n = t.source.range || t.source.valueRange;
4140
- return Ni(t.message, e.text, e.transformRange(n));
4141
- }
4142
- function tr(t) {
4143
- if ("children" in t) {
4144
- if (t.children.length === 1) {
4145
- let e = t.children[0];
4146
- if (e.type === "plain" && e.tag === null && e.anchor === null && e.value === "") return t.children.splice(0, 1), t;
4147
- }
4148
- t.children.forEach(tr);
4149
- }
4150
- return t;
4151
- }
4152
- function nr(t, e, n, r) {
4153
- let s = e(t);
4154
- return (i) => {
4155
- r(s, i) && n(t, s = i);
4156
- };
4157
- }
4158
- function rr(t) {
4159
- if (t === null || !("children" in t)) return;
4160
- let e = t.children;
4161
- if (e.forEach(rr), t.type === "document") {
4162
- let [i, o] = t.children;
4163
- i.position.start.offset === i.position.end.offset ? i.position.start = i.position.end = o.position.start : o.position.start.offset === o.position.end.offset && (o.position.start = o.position.end = i.position.end);
4164
- }
4165
- let n = nr(t.position, qa, Ua, Ka), r = nr(t.position, Va, Wa, ja);
4166
- "endComments" in t && t.endComments.length !== 0 && (n(t.endComments[0].position.start), r(V(t.endComments).position.end));
4167
- let s = e.filter((i) => i !== null);
4168
- if (s.length !== 0) {
4169
- let i = s[0], o = V(s);
4170
- n(i.position.start), r(o.position.end), "leadingComments" in i && i.leadingComments.length !== 0 && n(i.leadingComments[0].position.start), "tag" in i && i.tag && n(i.tag.position.start), "anchor" in i && i.anchor && n(i.anchor.position.start), "trailingComment" in o && o.trailingComment && r(o.trailingComment.position.end);
4171
- }
4172
- }
4173
- function qa(t) {
4174
- return t.start;
4175
- }
4176
- function Ua(t, e) {
4177
- t.start = e;
4178
- }
4179
- function Va(t) {
4180
- return t.end;
4181
- }
4182
- function Wa(t, e) {
4183
- t.end = e;
4184
- }
4185
- function Ka(t, e) {
4186
- return e.offset < t.offset;
4187
- }
4188
- function ja(t, e) {
4189
- return e.offset > t.offset;
4190
- }
4191
- function Ai(t) {
4192
- let e = sr.default.parseCST(t), n = new bi(e, t);
4193
- n.setOrigRanges();
4194
- let r = e.map((i) => new sr.default.Document({ merge: false, keepCstNodes: true }).parse(i));
4195
- for (let i of r) for (let o of i.errors) if (!(o instanceof vs && o.message === 'Map keys must be unique; "<<" is repeated')) throw Oi(o, n);
4196
- r.forEach((i) => pt(i.cstNode));
4197
- let s = Rs(n.transformRange({ origStart: 0, origEnd: t.length }), r.map((i) => n.transformNode(i)), n.comments);
4198
- return Is(s), rr(s), tr(s), s;
4199
- }
4200
- function Qa(t, e) {
4201
- let n = new SyntaxError(t + " (" + e.loc.start.line + ":" + e.loc.start.column + ")");
4202
- return Object.assign(n, e);
4203
- }
4204
- var Li = Qa;
4205
- function Ga(t) {
4206
- try {
4207
- let e = Ai(t);
4208
- return delete e.comments, e;
4209
- } catch (e) {
4210
- throw e?.position ? Li(e.message, { loc: e.position, cause: e }) : e;
4211
- }
4212
- }
4213
- var Ha = { astFormat: "yaml", parse: Ga, hasPragma: br, hasIgnorePragma: Nr, locStart: tt, locEnd: vr };
4214
- var Ja = { yaml: qr };
4215
- var Ti = on(Gn(), 1);
4216
- var Xa = Ti.default.parse;
4217
- export {
4218
- Xa as __parsePrettierYamlConfig,
4219
- Ci as default,
4220
- Ur as languages,
4221
- Vr as options,
4222
- ir as parsers,
4223
- Ja as printers
4224
- };