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