@cloud-cli/on 0.1.2 → 0.1.4

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 (2) hide show
  1. package/dist/on.js +1292 -1162
  2. package/package.json +1 -1
package/dist/on.js CHANGED
@@ -1,19 +1,17 @@
1
1
  #!/usr/bin/env node
2
- import { createServer as ms } from "node:http";
3
- import { parseArgs as gs } from "node:util";
4
- import { spawn as ys } from "node:child_process";
5
- import { readFile as et } from "node:fs/promises";
6
- import bt from "node:path";
7
- async function bs(s) {
8
- const e = [];
9
- for await (const t of s)
10
- e.push(Buffer.isBuffer(t) ? t : Buffer.from(t));
11
- return Buffer.concat(e).toString("utf8");
12
- }
13
- function Fe(s, e, t) {
2
+ import { parseArgs as Ss } from "node:util";
3
+ import { createServer as Ns } from "node:http";
4
+ import { readFile as tt, mkdtemp as _t, writeFile as Os, rm as As } from "node:fs/promises";
5
+ import kt, { join as st } from "node:path";
6
+ import { spawn as jt } from "node:child_process";
7
+ import { existsSync as Es } from "node:fs";
8
+ import { tmpdir as Bt } from "node:os";
9
+ import { join as Ts } from "node:path/posix";
10
+ import { randomUUID as Is } from "node:crypto";
11
+ function x(s, e, t) {
14
12
  s.writeHead(e, { "content-type": "application/json" }).end(JSON.stringify(t));
15
13
  }
16
- function ws(s) {
14
+ function $s(s) {
17
15
  const e = Number.parseInt(s, 10);
18
16
  if (!Number.isInteger(e) || e < 0 || e > 65535)
19
17
  throw new Error(
@@ -21,98 +19,95 @@ function ws(s) {
21
19
  );
22
20
  return e;
23
21
  }
24
- function tt(s) {
22
+ function nt(s) {
25
23
  if (!s || typeof s != "object" || Array.isArray(s))
26
24
  throw new Error("Incoming webhook payload must be a JSON object.");
27
25
  return s;
28
26
  }
29
- function vt(s, e) {
30
- const n = e.trim().replace(/^\$\{/, "").replace(/}$/, "").split(".").filter(Boolean);
31
- let i = s;
32
- for (const r of n) {
33
- if (typeof i != "object" || i === null || !(r in i))
34
- return;
35
- i = i[r];
36
- }
37
- return i;
27
+ function Mt(s) {
28
+ return typeof s == "object" && s !== null ? new Proxy(s, {
29
+ get(e, t) {
30
+ const n = Reflect.get(e, t);
31
+ return typeof n == "object" && n !== null ? Mt(n) : t === "toString" ? () => "'" + JSON.stringify(e) + "'" : n;
32
+ }
33
+ }) : s ?? "";
38
34
  }
39
- function ks(s, e) {
40
- return s.replace(/\$\{([^}]+)}/g, (t, n) => {
41
- const i = vt(e, n);
42
- return i == null ? "" : String(i);
43
- });
35
+ function _e(s, e) {
36
+ const t = Function(
37
+ "context",
38
+ "const { secrets = {}, inputs = {}, step = {}, env } = context;return `" + s + "`;"
39
+ );
40
+ return String(t(e) || "");
44
41
  }
45
- function Ss(s, e) {
42
+ function Ls(s, e) {
46
43
  if (!e)
47
44
  return { ...s };
48
- const t = { ...s };
49
- for (const [n, i] of Object.entries(e)) {
50
- const r = i.startsWith("${") ? i : `\${${i}}`;
51
- t[n] = vt({ inputs: t }, r);
52
- }
53
- return t;
45
+ const t = { inputs: s };
46
+ for (const [n, i] of Object.entries(e))
47
+ t.inputs[n] = _e(`\${${i}}`, t);
48
+ return t.inputs;
54
49
  }
55
- const st = /* @__PURE__ */ Symbol.for("yaml.alias"), We = /* @__PURE__ */ Symbol.for("yaml.document"), J = /* @__PURE__ */ Symbol.for("yaml.map"), Ct = /* @__PURE__ */ Symbol.for("yaml.pair"), q = /* @__PURE__ */ Symbol.for("yaml.scalar"), oe = /* @__PURE__ */ Symbol.for("yaml.seq"), j = /* @__PURE__ */ Symbol.for("yaml.node.type"), Q = (s) => !!s && typeof s == "object" && s[j] === st, Ce = (s) => !!s && typeof s == "object" && s[j] === We, ye = (s) => !!s && typeof s == "object" && s[j] === J, $ = (s) => !!s && typeof s == "object" && s[j] === Ct, E = (s) => !!s && typeof s == "object" && s[j] === q, be = (s) => !!s && typeof s == "object" && s[j] === oe;
50
+ const it = /* @__PURE__ */ Symbol.for("yaml.alias"), Qe = /* @__PURE__ */ Symbol.for("yaml.document"), J = /* @__PURE__ */ Symbol.for("yaml.map"), Pt = /* @__PURE__ */ Symbol.for("yaml.pair"), U = /* @__PURE__ */ Symbol.for("yaml.scalar"), ae = /* @__PURE__ */ Symbol.for("yaml.seq"), P = /* @__PURE__ */ Symbol.for("yaml.node.type"), Q = (s) => !!s && typeof s == "object" && s[P] === it, je = (s) => !!s && typeof s == "object" && s[P] === Qe, be = (s) => !!s && typeof s == "object" && s[P] === J, L = (s) => !!s && typeof s == "object" && s[P] === Pt, T = (s) => !!s && typeof s == "object" && s[P] === U, we = (s) => !!s && typeof s == "object" && s[P] === ae;
56
51
  function I(s) {
57
52
  if (s && typeof s == "object")
58
- switch (s[j]) {
53
+ switch (s[P]) {
59
54
  case J:
60
- case oe:
55
+ case ae:
61
56
  return !0;
62
57
  }
63
58
  return !1;
64
59
  }
65
- function L(s) {
60
+ function $(s) {
66
61
  if (s && typeof s == "object")
67
- switch (s[j]) {
68
- case st:
62
+ switch (s[P]) {
63
+ case it:
69
64
  case J:
70
- case q:
71
- case oe:
65
+ case U:
66
+ case ae:
72
67
  return !0;
73
68
  }
74
69
  return !1;
75
70
  }
76
- const _t = (s) => (E(s) || I(s)) && !!s.anchor, Y = /* @__PURE__ */ Symbol("break visit"), Ns = /* @__PURE__ */ Symbol("skip children"), de = /* @__PURE__ */ Symbol("remove node");
71
+ const Kt = (s) => (T(s) || I(s)) && !!s.anchor, Y = /* @__PURE__ */ Symbol("break visit"), vs = /* @__PURE__ */ Symbol("skip children"), pe = /* @__PURE__ */ Symbol("remove node");
77
72
  function le(s, e) {
78
- const t = Os(e);
79
- Ce(s) ? Z(null, s.contents, t, Object.freeze([s])) === de && (s.contents = null) : Z(null, s, t, Object.freeze([]));
73
+ const t = Cs(e);
74
+ je(s) ? ee(null, s.contents, t, Object.freeze([s])) === pe && (s.contents = null) : ee(null, s, t, Object.freeze([]));
80
75
  }
81
76
  le.BREAK = Y;
82
- le.SKIP = Ns;
83
- le.REMOVE = de;
84
- function Z(s, e, t, n) {
85
- const i = As(s, e, t, n);
86
- if (L(i) || $(i))
87
- return Ts(s, n, i), Z(s, i, t, n);
77
+ le.SKIP = vs;
78
+ le.REMOVE = pe;
79
+ function ee(s, e, t, n) {
80
+ const i = _s(s, e, t, n);
81
+ if ($(i) || L(i))
82
+ return js(s, n, i), ee(s, i, t, n);
88
83
  if (typeof i != "symbol") {
89
84
  if (I(e)) {
90
85
  n = Object.freeze(n.concat(e));
91
86
  for (let r = 0; r < e.items.length; ++r) {
92
- const o = Z(r, e.items[r], t, n);
87
+ const o = ee(r, e.items[r], t, n);
93
88
  if (typeof o == "number")
94
89
  r = o - 1;
95
90
  else {
96
91
  if (o === Y)
97
92
  return Y;
98
- o === de && (e.items.splice(r, 1), r -= 1);
93
+ o === pe && (e.items.splice(r, 1), r -= 1);
99
94
  }
100
95
  }
101
- } else if ($(e)) {
96
+ } else if (L(e)) {
102
97
  n = Object.freeze(n.concat(e));
103
- const r = Z("key", e.key, t, n);
98
+ const r = ee("key", e.key, t, n);
104
99
  if (r === Y)
105
100
  return Y;
106
- r === de && (e.key = null);
107
- const o = Z("value", e.value, t, n);
101
+ r === pe && (e.key = null);
102
+ const o = ee("value", e.value, t, n);
108
103
  if (o === Y)
109
104
  return Y;
110
- o === de && (e.value = null);
105
+ o === pe && (e.value = null);
111
106
  }
112
107
  }
113
108
  return i;
114
109
  }
115
- function Os(s) {
110
+ function Cs(s) {
116
111
  return typeof s == "object" && (s.Collection || s.Node || s.Value) ? Object.assign({
117
112
  Alias: s.Node,
118
113
  Map: s.Node,
@@ -127,41 +122,41 @@ function Os(s) {
127
122
  Seq: s.Collection
128
123
  }, s) : s;
129
124
  }
130
- function As(s, e, t, n) {
125
+ function _s(s, e, t, n) {
131
126
  if (typeof t == "function")
132
127
  return t(s, e, n);
133
- if (ye(e))
134
- return t.Map?.(s, e, n);
135
128
  if (be(e))
129
+ return t.Map?.(s, e, n);
130
+ if (we(e))
136
131
  return t.Seq?.(s, e, n);
137
- if ($(e))
132
+ if (L(e))
138
133
  return t.Pair?.(s, e, n);
139
- if (E(e))
134
+ if (T(e))
140
135
  return t.Scalar?.(s, e, n);
141
136
  if (Q(e))
142
137
  return t.Alias?.(s, e, n);
143
138
  }
144
- function Ts(s, e, t) {
139
+ function js(s, e, t) {
145
140
  const n = e[e.length - 1];
146
141
  if (I(n))
147
142
  n.items[s] = t;
148
- else if ($(n))
143
+ else if (L(n))
149
144
  s === "key" ? n.key = t : n.value = t;
150
- else if (Ce(n))
145
+ else if (je(n))
151
146
  n.contents = t;
152
147
  else {
153
148
  const i = Q(n) ? "alias" : "scalar";
154
149
  throw new Error(`Cannot replace node with ${i} parent`);
155
150
  }
156
151
  }
157
- const Es = {
152
+ const Bs = {
158
153
  "!": "%21",
159
154
  ",": "%2C",
160
155
  "[": "%5B",
161
156
  "]": "%5D",
162
157
  "{": "%7B",
163
158
  "}": "%7D"
164
- }, Is = (s) => s.replace(/[!,[\]{}]/g, (e) => Es[e]);
159
+ }, Ms = (s) => s.replace(/[!,[\]{}]/g, (e) => Bs[e]);
165
160
  class _ {
166
161
  constructor(e, t) {
167
162
  this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, _.defaultYaml, e), this.tags = Object.assign({}, _.defaultTags, t);
@@ -251,35 +246,35 @@ class _ {
251
246
  tagString(e) {
252
247
  for (const [t, n] of Object.entries(this.tags))
253
248
  if (e.startsWith(n))
254
- return t + Is(e.substring(n.length));
249
+ return t + Ms(e.substring(n.length));
255
250
  return e[0] === "!" ? e : `!<${e}>`;
256
251
  }
257
252
  toString(e) {
258
253
  const t = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [], n = Object.entries(this.tags);
259
254
  let i;
260
- if (e && n.length > 0 && L(e.contents)) {
255
+ if (e && n.length > 0 && $(e.contents)) {
261
256
  const r = {};
262
- le(e.contents, (o, l) => {
263
- L(l) && l.tag && (r[l.tag] = !0);
257
+ le(e.contents, (o, a) => {
258
+ $(a) && a.tag && (r[a.tag] = !0);
264
259
  }), i = Object.keys(r);
265
260
  } else
266
261
  i = [];
267
262
  for (const [r, o] of n)
268
- r === "!!" && o === "tag:yaml.org,2002:" || (!e || i.some((l) => l.startsWith(o))) && t.push(`%TAG ${r} ${o}`);
263
+ r === "!!" && o === "tag:yaml.org,2002:" || (!e || i.some((a) => a.startsWith(o))) && t.push(`%TAG ${r} ${o}`);
269
264
  return t.join(`
270
265
  `);
271
266
  }
272
267
  }
273
268
  _.defaultYaml = { explicit: !1, version: "1.2" };
274
269
  _.defaultTags = { "!!": "tag:yaml.org,2002:" };
275
- function Bt(s) {
270
+ function Dt(s) {
276
271
  if (/[\x00-\x19\s,[\]{}]/.test(s)) {
277
272
  const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;
278
273
  throw new Error(t);
279
274
  }
280
275
  return !0;
281
276
  }
282
- function Mt(s) {
277
+ function Ut(s) {
283
278
  const e = /* @__PURE__ */ new Set();
284
279
  return le(s, {
285
280
  Value(t, n) {
@@ -287,20 +282,20 @@ function Mt(s) {
287
282
  }
288
283
  }), e;
289
284
  }
290
- function Pt(s, e) {
285
+ function Ft(s, e) {
291
286
  for (let t = 1; ; ++t) {
292
287
  const n = `${s}${t}`;
293
288
  if (!e.has(n))
294
289
  return n;
295
290
  }
296
291
  }
297
- function Ls(s, e) {
292
+ function Ps(s, e) {
298
293
  const t = [], n = /* @__PURE__ */ new Map();
299
294
  let i = null;
300
295
  return {
301
296
  onAnchor: (r) => {
302
- t.push(r), i ?? (i = Mt(s));
303
- const o = Pt(e, i);
297
+ t.push(r), i ?? (i = Ut(s));
298
+ const o = Ft(e, i);
304
299
  return i.add(o), o;
305
300
  },
306
301
  /**
@@ -311,46 +306,46 @@ function Ls(s, e) {
311
306
  setAnchors: () => {
312
307
  for (const r of t) {
313
308
  const o = n.get(r);
314
- if (typeof o == "object" && o.anchor && (E(o.node) || I(o.node)))
309
+ if (typeof o == "object" && o.anchor && (T(o.node) || I(o.node)))
315
310
  o.node.anchor = o.anchor;
316
311
  else {
317
- const l = new Error("Failed to resolve repeated object (this should not happen)");
318
- throw l.source = r, l;
312
+ const a = new Error("Failed to resolve repeated object (this should not happen)");
313
+ throw a.source = r, a;
319
314
  }
320
315
  }
321
316
  },
322
317
  sourceObjects: n
323
318
  };
324
319
  }
325
- function ee(s, e, t, n) {
320
+ function te(s, e, t, n) {
326
321
  if (n && typeof n == "object")
327
322
  if (Array.isArray(n))
328
323
  for (let i = 0, r = n.length; i < r; ++i) {
329
- const o = n[i], l = ee(s, n, String(i), o);
330
- l === void 0 ? delete n[i] : l !== o && (n[i] = l);
324
+ const o = n[i], a = te(s, n, String(i), o);
325
+ a === void 0 ? delete n[i] : a !== o && (n[i] = a);
331
326
  }
332
327
  else if (n instanceof Map)
333
328
  for (const i of Array.from(n.keys())) {
334
- const r = n.get(i), o = ee(s, n, i, r);
329
+ const r = n.get(i), o = te(s, n, i, r);
335
330
  o === void 0 ? n.delete(i) : o !== r && n.set(i, o);
336
331
  }
337
332
  else if (n instanceof Set)
338
333
  for (const i of Array.from(n)) {
339
- const r = ee(s, n, i, i);
334
+ const r = te(s, n, i, i);
340
335
  r === void 0 ? n.delete(i) : r !== i && (n.delete(i), n.add(r));
341
336
  }
342
337
  else
343
338
  for (const [i, r] of Object.entries(n)) {
344
- const o = ee(s, n, i, r);
339
+ const o = te(s, n, i, r);
345
340
  o === void 0 ? delete n[i] : o !== r && (n[i] = o);
346
341
  }
347
342
  return s.call(e, t, n);
348
343
  }
349
- function P(s, e, t) {
344
+ function M(s, e, t) {
350
345
  if (Array.isArray(s))
351
- return s.map((n, i) => P(n, String(i), t));
346
+ return s.map((n, i) => M(n, String(i), t));
352
347
  if (s && typeof s.toJSON == "function") {
353
- if (!t || !_t(s))
348
+ if (!t || !Kt(s))
354
349
  return s.toJSON(e, t);
355
350
  const n = { aliasCount: 0, count: 1, res: void 0 };
356
351
  t.anchors.set(s, n), t.onCreate = (r) => {
@@ -361,9 +356,9 @@ function P(s, e, t) {
361
356
  }
362
357
  return typeof s == "bigint" && !t?.keep ? Number(s) : s;
363
358
  }
364
- class nt {
359
+ class rt {
365
360
  constructor(e) {
366
- Object.defineProperty(this, j, { value: e });
361
+ Object.defineProperty(this, P, { value: e });
367
362
  }
368
363
  /** Create a copy of this node. */
369
364
  clone() {
@@ -372,7 +367,7 @@ class nt {
372
367
  }
373
368
  /** A plain JavaScript representation of this node. */
374
369
  toJS(e, { mapAsMap: t, maxAliasCount: n, onAnchor: i, reviver: r } = {}) {
375
- if (!Ce(e))
370
+ if (!je(e))
376
371
  throw new TypeError("A document argument is required");
377
372
  const o = {
378
373
  anchors: /* @__PURE__ */ new Map(),
@@ -381,16 +376,16 @@ class nt {
381
376
  mapAsMap: t === !0,
382
377
  mapKeyWarned: !1,
383
378
  maxAliasCount: typeof n == "number" ? n : 100
384
- }, l = P(this, "", o);
379
+ }, a = M(this, "", o);
385
380
  if (typeof i == "function")
386
- for (const { count: a, res: c } of o.anchors.values())
387
- i(c, a);
388
- return typeof r == "function" ? ee(r, { "": l }, "", l) : l;
381
+ for (const { count: l, res: c } of o.anchors.values())
382
+ i(c, l);
383
+ return typeof r == "function" ? te(r, { "": a }, "", a) : a;
389
384
  }
390
385
  }
391
- class it extends nt {
386
+ class ot extends rt {
392
387
  constructor(e) {
393
- super(st), this.source = e, Object.defineProperty(this, "tag", {
388
+ super(it), this.source = e, Object.defineProperty(this, "tag", {
394
389
  set() {
395
390
  throw new Error("Alias nodes cannot have tags");
396
391
  }
@@ -404,7 +399,7 @@ class it extends nt {
404
399
  let n;
405
400
  t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [], le(e, {
406
401
  Node: (r, o) => {
407
- (Q(o) || _t(o)) && n.push(o);
402
+ (Q(o) || Kt(o)) && n.push(o);
408
403
  }
409
404
  }), t && (t.aliasResolveCache = n));
410
405
  let i;
@@ -420,24 +415,24 @@ class it extends nt {
420
415
  return { source: this.source };
421
416
  const { anchors: n, doc: i, maxAliasCount: r } = t, o = this.resolve(i, t);
422
417
  if (!o) {
423
- const a = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
424
- throw new ReferenceError(a);
418
+ const l = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
419
+ throw new ReferenceError(l);
425
420
  }
426
- let l = n.get(o);
427
- if (l || (P(o, null, t), l = n.get(o)), l?.res === void 0) {
428
- const a = "This should not happen: Alias anchor was not resolved?";
429
- throw new ReferenceError(a);
421
+ let a = n.get(o);
422
+ if (a || (M(o, null, t), a = n.get(o)), a?.res === void 0) {
423
+ const l = "This should not happen: Alias anchor was not resolved?";
424
+ throw new ReferenceError(l);
430
425
  }
431
- if (r >= 0 && (l.count += 1, l.aliasCount === 0 && (l.aliasCount = Ee(i, o, n)), l.count * l.aliasCount > r)) {
432
- const a = "Excessive alias count indicates a resource exhaustion attack";
433
- throw new ReferenceError(a);
426
+ if (r >= 0 && (a.count += 1, a.aliasCount === 0 && (a.aliasCount = Ie(i, o, n)), a.count * a.aliasCount > r)) {
427
+ const l = "Excessive alias count indicates a resource exhaustion attack";
428
+ throw new ReferenceError(l);
434
429
  }
435
- return l.res;
430
+ return a.res;
436
431
  }
437
432
  toString(e, t, n) {
438
433
  const i = `*${this.source}`;
439
434
  if (e) {
440
- if (Bt(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
435
+ if (Dt(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
441
436
  const r = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
442
437
  throw new Error(r);
443
438
  }
@@ -447,30 +442,30 @@ class it extends nt {
447
442
  return i;
448
443
  }
449
444
  }
450
- function Ee(s, e, t) {
445
+ function Ie(s, e, t) {
451
446
  if (Q(e)) {
452
447
  const n = e.resolve(s), i = t && n && t.get(n);
453
448
  return i ? i.count * i.aliasCount : 0;
454
449
  } else if (I(e)) {
455
450
  let n = 0;
456
451
  for (const i of e.items) {
457
- const r = Ee(s, i, t);
452
+ const r = Ie(s, i, t);
458
453
  r > n && (n = r);
459
454
  }
460
455
  return n;
461
- } else if ($(e)) {
462
- const n = Ee(s, e.key, t), i = Ee(s, e.value, t);
456
+ } else if (L(e)) {
457
+ const n = Ie(s, e.key, t), i = Ie(s, e.value, t);
463
458
  return Math.max(n, i);
464
459
  }
465
460
  return 1;
466
461
  }
467
- const jt = (s) => !s || typeof s != "function" && typeof s != "object";
468
- class O extends nt {
462
+ const Rt = (s) => !s || typeof s != "function" && typeof s != "object";
463
+ class O extends rt {
469
464
  constructor(e) {
470
- super(q), this.value = e;
465
+ super(U), this.value = e;
471
466
  }
472
467
  toJSON(e, t) {
473
- return t?.keep ? this.value : P(this.value, e, t);
468
+ return t?.keep ? this.value : M(this.value, e, t);
474
469
  }
475
470
  toString() {
476
471
  return String(this.value);
@@ -481,8 +476,8 @@ O.BLOCK_LITERAL = "BLOCK_LITERAL";
481
476
  O.PLAIN = "PLAIN";
482
477
  O.QUOTE_DOUBLE = "QUOTE_DOUBLE";
483
478
  O.QUOTE_SINGLE = "QUOTE_SINGLE";
484
- const $s = "tag:yaml.org,2002:";
485
- function vs(s, e, t) {
479
+ const Ks = "tag:yaml.org,2002:";
480
+ function Ds(s, e, t) {
486
481
  if (e) {
487
482
  const n = t.filter((r) => r.tag === e), i = n.find((r) => !r.format) ?? n[0];
488
483
  if (!i)
@@ -491,35 +486,35 @@ function vs(s, e, t) {
491
486
  }
492
487
  return t.find((n) => n.identify?.(s) && !n.format);
493
488
  }
494
- function me(s, e, t) {
495
- if (Ce(s) && (s = s.contents), L(s))
489
+ function ge(s, e, t) {
490
+ if (je(s) && (s = s.contents), $(s))
496
491
  return s;
497
- if ($(s)) {
498
- const f = t.schema[J].createNode?.(t.schema, null, t);
499
- return f.items.push(s), f;
492
+ if (L(s)) {
493
+ const u = t.schema[J].createNode?.(t.schema, null, t);
494
+ return u.items.push(s), u;
500
495
  }
501
496
  (s instanceof String || s instanceof Number || s instanceof Boolean || typeof BigInt < "u" && s instanceof BigInt) && (s = s.valueOf());
502
- const { aliasDuplicateObjects: n, onAnchor: i, onTagObj: r, schema: o, sourceObjects: l } = t;
503
- let a;
497
+ const { aliasDuplicateObjects: n, onAnchor: i, onTagObj: r, schema: o, sourceObjects: a } = t;
498
+ let l;
504
499
  if (n && s && typeof s == "object") {
505
- if (a = l.get(s), a)
506
- return a.anchor ?? (a.anchor = i(s)), new it(a.anchor);
507
- a = { anchor: null, node: null }, l.set(s, a);
500
+ if (l = a.get(s), l)
501
+ return l.anchor ?? (l.anchor = i(s)), new ot(l.anchor);
502
+ l = { anchor: null, node: null }, a.set(s, l);
508
503
  }
509
- e?.startsWith("!!") && (e = $s + e.slice(2));
510
- let c = vs(s, e, o.tags);
504
+ e?.startsWith("!!") && (e = Ks + e.slice(2));
505
+ let c = Ds(s, e, o.tags);
511
506
  if (!c) {
512
507
  if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
513
- const f = new O(s);
514
- return a && (a.node = f), f;
508
+ const u = new O(s);
509
+ return l && (l.node = u), u;
515
510
  }
516
- c = s instanceof Map ? o[J] : Symbol.iterator in Object(s) ? o[oe] : o[J];
511
+ c = s instanceof Map ? o[J] : Symbol.iterator in Object(s) ? o[ae] : o[J];
517
512
  }
518
513
  r && (r(c), delete t.onTagObj);
519
514
  const d = c?.createNode ? c.createNode(t.schema, s, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, s, t) : new O(s);
520
- return e ? d.tag = e : c.default || (d.tag = c.tag), a && (a.node = d), d;
515
+ return e ? d.tag = e : c.default || (d.tag = c.tag), l && (l.node = d), d;
521
516
  }
522
- function $e(s, e, t) {
517
+ function ve(s, e, t) {
523
518
  let n = t;
524
519
  for (let i = e.length - 1; i >= 0; --i) {
525
520
  const r = e[i];
@@ -529,7 +524,7 @@ function $e(s, e, t) {
529
524
  } else
530
525
  n = /* @__PURE__ */ new Map([[r, n]]);
531
526
  }
532
- return me(n, void 0, {
527
+ return ge(n, void 0, {
533
528
  aliasDuplicateObjects: !1,
534
529
  keepUndefined: !1,
535
530
  onAnchor: () => {
@@ -539,8 +534,8 @@ function $e(s, e, t) {
539
534
  sourceObjects: /* @__PURE__ */ new Map()
540
535
  });
541
536
  }
542
- const ue = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
543
- class Kt extends nt {
537
+ const he = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
538
+ class qt extends rt {
544
539
  constructor(e, t) {
545
540
  super(e), Object.defineProperty(this, "schema", {
546
541
  value: t,
@@ -556,7 +551,7 @@ class Kt extends nt {
556
551
  */
557
552
  clone(e) {
558
553
  const t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
559
- return e && (t.schema = e), t.items = t.items.map((n) => L(n) || $(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
554
+ return e && (t.schema = e), t.items = t.items.map((n) => $(n) || L(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
560
555
  }
561
556
  /**
562
557
  * Adds a value to the collection. For `!!map` and `!!omap` the value must
@@ -564,14 +559,14 @@ class Kt extends nt {
564
559
  * that already exists in the map.
565
560
  */
566
561
  addIn(e, t) {
567
- if (ue(e))
562
+ if (he(e))
568
563
  this.add(t);
569
564
  else {
570
565
  const [n, ...i] = e, r = this.get(n, !0);
571
566
  if (I(r))
572
567
  r.addIn(i, t);
573
568
  else if (r === void 0 && this.schema)
574
- this.set(n, $e(this.schema, i, t));
569
+ this.set(n, ve(this.schema, i, t));
575
570
  else
576
571
  throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
577
572
  }
@@ -596,14 +591,14 @@ class Kt extends nt {
596
591
  */
597
592
  getIn(e, t) {
598
593
  const [n, ...i] = e, r = this.get(n, !0);
599
- return i.length === 0 ? !t && E(r) ? r.value : r : I(r) ? r.getIn(i, t) : void 0;
594
+ return i.length === 0 ? !t && T(r) ? r.value : r : I(r) ? r.getIn(i, t) : void 0;
600
595
  }
601
596
  hasAllNullValues(e) {
602
597
  return this.items.every((t) => {
603
- if (!$(t))
598
+ if (!L(t))
604
599
  return !1;
605
600
  const n = t.value;
606
- return n == null || e && E(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
601
+ return n == null || e && T(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
607
602
  });
608
603
  }
609
604
  /**
@@ -629,35 +624,35 @@ class Kt extends nt {
629
624
  if (I(r))
630
625
  r.setIn(i, t);
631
626
  else if (r === void 0 && this.schema)
632
- this.set(n, $e(this.schema, i, t));
627
+ this.set(n, ve(this.schema, i, t));
633
628
  else
634
629
  throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
635
630
  }
636
631
  }
637
632
  }
638
- const Cs = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
639
- function U(s, e) {
633
+ const Us = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
634
+ function F(s, e) {
640
635
  return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
641
636
  }
642
637
  const G = (s, e, t) => s.endsWith(`
643
- `) ? U(t, e) : t.includes(`
638
+ `) ? F(t, e) : t.includes(`
644
639
  `) ? `
645
- ` + U(t, e) : (s.endsWith(" ") ? "" : " ") + t, Dt = "flow", Qe = "block", Ie = "quoted";
646
- function _e(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: l } = {}) {
640
+ ` + F(t, e) : (s.endsWith(" ") ? "" : " ") + t, Vt = "flow", Xe = "block", $e = "quoted";
641
+ function Be(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: a } = {}) {
647
642
  if (!i || i < 0)
648
643
  return s;
649
644
  i < r && (r = 0);
650
- const a = Math.max(1 + r, 1 + i - e.length);
651
- if (s.length <= a)
645
+ const l = Math.max(1 + r, 1 + i - e.length);
646
+ if (s.length <= l)
652
647
  return s;
653
648
  const c = [], d = {};
654
- let f = i - e.length;
655
- typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : f = i - n);
656
- let u, m, g = !1, h = -1, p = -1, b = -1;
657
- t === Qe && (h = wt(s, h, e.length), h !== -1 && (f = h + a));
649
+ let u = i - e.length;
650
+ typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : u = i - n);
651
+ let f, p, g = !1, h = -1, m = -1, b = -1;
652
+ t === Xe && (h = St(s, h, e.length), h !== -1 && (u = h + l));
658
653
  for (let k; k = s[h += 1]; ) {
659
- if (t === Ie && k === "\\") {
660
- switch (p = h, s[h + 1]) {
654
+ if (t === $e && k === "\\") {
655
+ switch (m = h, s[h + 1]) {
661
656
  case "x":
662
657
  h += 3;
663
658
  break;
@@ -674,42 +669,42 @@ function _e(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
674
669
  }
675
670
  if (k === `
676
671
  `)
677
- t === Qe && (h = wt(s, h, e.length)), f = h + e.length + a, u = void 0;
672
+ t === Xe && (h = St(s, h, e.length)), u = h + e.length + l, f = void 0;
678
673
  else {
679
- if (k === " " && m && m !== " " && m !== `
680
- ` && m !== " ") {
674
+ if (k === " " && p && p !== " " && p !== `
675
+ ` && p !== " ") {
681
676
  const S = s[h + 1];
682
677
  S && S !== " " && S !== `
683
- ` && S !== " " && (u = h);
678
+ ` && S !== " " && (f = h);
684
679
  }
685
- if (h >= f)
686
- if (u)
687
- c.push(u), f = u + a, u = void 0;
688
- else if (t === Ie) {
689
- for (; m === " " || m === " "; )
690
- m = k, k = s[h += 1], g = !0;
691
- const S = h > b + 1 ? h - 2 : p - 1;
680
+ if (h >= u)
681
+ if (f)
682
+ c.push(f), u = f + l, f = void 0;
683
+ else if (t === $e) {
684
+ for (; p === " " || p === " "; )
685
+ p = k, k = s[h += 1], g = !0;
686
+ const S = h > b + 1 ? h - 2 : m - 1;
692
687
  if (d[S])
693
688
  return s;
694
- c.push(S), d[S] = !0, f = S + a, u = void 0;
689
+ c.push(S), d[S] = !0, u = S + l, f = void 0;
695
690
  } else
696
691
  g = !0;
697
692
  }
698
- m = k;
693
+ p = k;
699
694
  }
700
- if (g && l && l(), c.length === 0)
695
+ if (g && a && a(), c.length === 0)
701
696
  return s;
702
697
  o && o();
703
698
  let w = s.slice(0, c[0]);
704
699
  for (let k = 0; k < c.length; ++k) {
705
700
  const S = c[k], N = c[k + 1] || s.length;
706
701
  S === 0 ? w = `
707
- ${e}${s.slice(0, N)}` : (t === Ie && d[S] && (w += `${s[S]}\\`), w += `
702
+ ${e}${s.slice(0, N)}` : (t === $e && d[S] && (w += `${s[S]}\\`), w += `
708
703
  ${e}${s.slice(S + 1, N)}`);
709
704
  }
710
705
  return w;
711
706
  }
712
- function wt(s, e, t) {
707
+ function St(s, e, t) {
713
708
  let n = e, i = e + 1, r = s[i];
714
709
  for (; r === " " || r === " "; )
715
710
  if (e < i + t)
@@ -723,12 +718,12 @@ function wt(s, e, t) {
723
718
  }
724
719
  return n;
725
720
  }
726
- const Be = (s, e) => ({
721
+ const Me = (s, e) => ({
727
722
  indentAtStart: e ? s.indent.length : s.indentAtStart,
728
723
  lineWidth: s.options.lineWidth,
729
724
  minContentWidth: s.options.minContentWidth
730
- }), Me = (s) => /^(%|---|\.\.\.)/m.test(s);
731
- function _s(s, e, t) {
725
+ }), Pe = (s) => /^(%|---|\.\.\.)/m.test(s);
726
+ function Fs(s, e, t) {
732
727
  if (!e || e < 0)
733
728
  return !1;
734
729
  const n = e - t, i = s.length;
@@ -744,19 +739,19 @@ function _s(s, e, t) {
744
739
  }
745
740
  return !0;
746
741
  }
747
- function pe(s, e) {
742
+ function me(s, e) {
748
743
  const t = JSON.stringify(s);
749
744
  if (e.options.doubleQuotedAsJSON)
750
745
  return t;
751
- const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (Me(s) ? " " : "");
752
- let o = "", l = 0;
753
- for (let a = 0, c = t[a]; c; c = t[++a])
754
- if (c === " " && t[a + 1] === "\\" && t[a + 2] === "n" && (o += t.slice(l, a) + "\\ ", a += 1, l = a, c = "\\"), c === "\\")
755
- switch (t[a + 1]) {
746
+ const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (Pe(s) ? " " : "");
747
+ let o = "", a = 0;
748
+ for (let l = 0, c = t[l]; c; c = t[++l])
749
+ if (c === " " && t[l + 1] === "\\" && t[l + 2] === "n" && (o += t.slice(a, l) + "\\ ", l += 1, a = l, c = "\\"), c === "\\")
750
+ switch (t[l + 1]) {
756
751
  case "u":
757
752
  {
758
- o += t.slice(l, a);
759
- const d = t.substr(a + 2, 4);
753
+ o += t.slice(a, l);
754
+ const d = t.substr(l + 2, 4);
760
755
  switch (d) {
761
756
  case "0000":
762
757
  o += "\\0";
@@ -783,164 +778,164 @@ function pe(s, e) {
783
778
  o += "\\P";
784
779
  break;
785
780
  default:
786
- d.substr(0, 2) === "00" ? o += "\\x" + d.substr(2) : o += t.substr(a, 6);
781
+ d.substr(0, 2) === "00" ? o += "\\x" + d.substr(2) : o += t.substr(l, 6);
787
782
  }
788
- a += 5, l = a + 1;
783
+ l += 5, a = l + 1;
789
784
  }
790
785
  break;
791
786
  case "n":
792
- if (n || t[a + 2] === '"' || t.length < i)
793
- a += 1;
787
+ if (n || t[l + 2] === '"' || t.length < i)
788
+ l += 1;
794
789
  else {
795
- for (o += t.slice(l, a) + `
790
+ for (o += t.slice(a, l) + `
796
791
 
797
- `; t[a + 2] === "\\" && t[a + 3] === "n" && t[a + 4] !== '"'; )
792
+ `; t[l + 2] === "\\" && t[l + 3] === "n" && t[l + 4] !== '"'; )
798
793
  o += `
799
- `, a += 2;
800
- o += r, t[a + 2] === " " && (o += "\\"), a += 1, l = a + 1;
794
+ `, l += 2;
795
+ o += r, t[l + 2] === " " && (o += "\\"), l += 1, a = l + 1;
801
796
  }
802
797
  break;
803
798
  default:
804
- a += 1;
799
+ l += 1;
805
800
  }
806
- return o = l ? o + t.slice(l) : t, n ? o : _e(o, r, Ie, Be(e, !1));
801
+ return o = a ? o + t.slice(a) : t, n ? o : Be(o, r, $e, Me(e, !1));
807
802
  }
808
- function Xe(s, e) {
803
+ function xe(s, e) {
809
804
  if (e.options.singleQuote === !1 || e.implicitKey && s.includes(`
810
805
  `) || /[ \t]\n|\n[ \t]/.test(s))
811
- return pe(s, e);
812
- const t = e.indent || (Me(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
806
+ return me(s, e);
807
+ const t = e.indent || (Pe(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
813
808
  ${t}`) + "'";
814
- return e.implicitKey ? n : _e(n, t, Dt, Be(e, !1));
809
+ return e.implicitKey ? n : Be(n, t, Vt, Me(e, !1));
815
810
  }
816
- function te(s, e) {
811
+ function se(s, e) {
817
812
  const { singleQuote: t } = e.options;
818
813
  let n;
819
814
  if (t === !1)
820
- n = pe;
815
+ n = me;
821
816
  else {
822
817
  const i = s.includes('"'), r = s.includes("'");
823
- i && !r ? n = Xe : r && !i ? n = pe : n = t ? Xe : pe;
818
+ i && !r ? n = xe : r && !i ? n = me : n = t ? xe : me;
824
819
  }
825
820
  return n(s, e);
826
821
  }
827
- let xe;
822
+ let ze;
828
823
  try {
829
- xe = new RegExp(`(^|(?<!
824
+ ze = new RegExp(`(^|(?<!
830
825
  ))
831
826
  +(?!
832
827
  |$)`, "g");
833
828
  } catch {
834
- xe = /\n+(?!\n|$)/g;
829
+ ze = /\n+(?!\n|$)/g;
835
830
  }
836
831
  function Le({ comment: s, type: e, value: t }, n, i, r) {
837
- const { blockQuote: o, commentString: l, lineWidth: a } = n.options;
832
+ const { blockQuote: o, commentString: a, lineWidth: l } = n.options;
838
833
  if (!o || /\n[\t ]+$/.test(t))
839
- return te(t, n);
840
- const c = n.indent || (n.forceBlockIndent || Me(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e === O.BLOCK_FOLDED ? !1 : e === O.BLOCK_LITERAL ? !0 : !_s(t, a, c.length);
834
+ return se(t, n);
835
+ const c = n.indent || (n.forceBlockIndent || Pe(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e === O.BLOCK_FOLDED ? !1 : e === O.BLOCK_LITERAL ? !0 : !Fs(t, l, c.length);
841
836
  if (!t)
842
837
  return d ? `|
843
838
  ` : `>
844
839
  `;
845
- let f, u;
846
- for (u = t.length; u > 0; --u) {
847
- const N = t[u - 1];
840
+ let u, f;
841
+ for (f = t.length; f > 0; --f) {
842
+ const N = t[f - 1];
848
843
  if (N !== `
849
844
  ` && N !== " " && N !== " ")
850
845
  break;
851
846
  }
852
- let m = t.substring(u);
853
- const g = m.indexOf(`
847
+ let p = t.substring(f);
848
+ const g = p.indexOf(`
854
849
  `);
855
- g === -1 ? f = "-" : t === m || g !== m.length - 1 ? (f = "+", r && r()) : f = "", m && (t = t.slice(0, -m.length), m[m.length - 1] === `
856
- ` && (m = m.slice(0, -1)), m = m.replace(xe, `$&${c}`));
857
- let h = !1, p, b = -1;
858
- for (p = 0; p < t.length; ++p) {
859
- const N = t[p];
850
+ g === -1 ? u = "-" : t === p || g !== p.length - 1 ? (u = "+", r && r()) : u = "", p && (t = t.slice(0, -p.length), p[p.length - 1] === `
851
+ ` && (p = p.slice(0, -1)), p = p.replace(ze, `$&${c}`));
852
+ let h = !1, m, b = -1;
853
+ for (m = 0; m < t.length; ++m) {
854
+ const N = t[m];
860
855
  if (N === " ")
861
856
  h = !0;
862
857
  else if (N === `
863
858
  `)
864
- b = p;
859
+ b = m;
865
860
  else
866
861
  break;
867
862
  }
868
- let w = t.substring(0, b < p ? b + 1 : p);
863
+ let w = t.substring(0, b < m ? b + 1 : m);
869
864
  w && (t = t.substring(w.length), w = w.replace(/\n+/g, `$&${c}`));
870
- let S = (h ? c ? "2" : "1" : "") + f;
871
- if (s && (S += " " + l(s.replace(/ ?[\r\n]+/g, " ")), i && i()), !d) {
865
+ let S = (h ? c ? "2" : "1" : "") + u;
866
+ if (s && (S += " " + a(s.replace(/ ?[\r\n]+/g, " ")), i && i()), !d) {
872
867
  const N = t.replace(/\n+/g, `
873
868
  $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
874
869
  let A = !1;
875
- const T = Be(n, !0);
876
- o !== "folded" && e !== O.BLOCK_FOLDED && (T.onOverflow = () => {
870
+ const E = Me(n, !0);
871
+ o !== "folded" && e !== O.BLOCK_FOLDED && (E.onOverflow = () => {
877
872
  A = !0;
878
873
  });
879
- const y = _e(`${w}${N}${m}`, c, Qe, T);
874
+ const y = Be(`${w}${N}${p}`, c, Xe, E);
880
875
  if (!A)
881
876
  return `>${S}
882
877
  ${c}${y}`;
883
878
  }
884
879
  return t = t.replace(/\n+/g, `$&${c}`), `|${S}
885
- ${c}${w}${t}${m}`;
880
+ ${c}${w}${t}${p}`;
886
881
  }
887
- function Bs(s, e, t, n) {
888
- const { type: i, value: r } = s, { actualString: o, implicitKey: l, indent: a, indentStep: c, inFlow: d } = e;
889
- if (l && r.includes(`
882
+ function Rs(s, e, t, n) {
883
+ const { type: i, value: r } = s, { actualString: o, implicitKey: a, indent: l, indentStep: c, inFlow: d } = e;
884
+ if (a && r.includes(`
890
885
  `) || d && /[[\]{},]/.test(r))
891
- return te(r, e);
886
+ return se(r, e);
892
887
  if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
893
- return l || d || !r.includes(`
894
- `) ? te(r, e) : Le(s, e, t, n);
895
- if (!l && !d && i !== O.PLAIN && r.includes(`
888
+ return a || d || !r.includes(`
889
+ `) ? se(r, e) : Le(s, e, t, n);
890
+ if (!a && !d && i !== O.PLAIN && r.includes(`
896
891
  `))
897
892
  return Le(s, e, t, n);
898
- if (Me(r)) {
899
- if (a === "")
893
+ if (Pe(r)) {
894
+ if (l === "")
900
895
  return e.forceBlockIndent = !0, Le(s, e, t, n);
901
- if (l && a === c)
902
- return te(r, e);
896
+ if (a && l === c)
897
+ return se(r, e);
903
898
  }
904
- const f = r.replace(/\n+/g, `$&
905
- ${a}`);
899
+ const u = r.replace(/\n+/g, `$&
900
+ ${l}`);
906
901
  if (o) {
907
- const u = (h) => h.default && h.tag !== "tag:yaml.org,2002:str" && h.test?.test(f), { compat: m, tags: g } = e.doc.schema;
908
- if (g.some(u) || m?.some(u))
909
- return te(r, e);
902
+ const f = (h) => h.default && h.tag !== "tag:yaml.org,2002:str" && h.test?.test(u), { compat: p, tags: g } = e.doc.schema;
903
+ if (g.some(f) || p?.some(f))
904
+ return se(r, e);
910
905
  }
911
- return l ? f : _e(f, a, Dt, Be(e, !1));
906
+ return a ? u : Be(u, l, Vt, Me(e, !1));
912
907
  }
913
- function rt(s, e, t, n) {
908
+ function at(s, e, t, n) {
914
909
  const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
915
- let { type: l } = s;
916
- l !== O.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (l = O.QUOTE_DOUBLE);
917
- const a = (d) => {
910
+ let { type: a } = s;
911
+ a !== O.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (a = O.QUOTE_DOUBLE);
912
+ const l = (d) => {
918
913
  switch (d) {
919
914
  case O.BLOCK_FOLDED:
920
915
  case O.BLOCK_LITERAL:
921
- return i || r ? te(o.value, e) : Le(o, e, t, n);
916
+ return i || r ? se(o.value, e) : Le(o, e, t, n);
922
917
  case O.QUOTE_DOUBLE:
923
- return pe(o.value, e);
918
+ return me(o.value, e);
924
919
  case O.QUOTE_SINGLE:
925
- return Xe(o.value, e);
920
+ return xe(o.value, e);
926
921
  case O.PLAIN:
927
- return Bs(o, e, t, n);
922
+ return Rs(o, e, t, n);
928
923
  default:
929
924
  return null;
930
925
  }
931
926
  };
932
- let c = a(l);
927
+ let c = l(a);
933
928
  if (c === null) {
934
- const { defaultKeyType: d, defaultStringType: f } = e.options, u = i && d || f;
935
- if (c = a(u), c === null)
936
- throw new Error(`Unsupported default string type ${u}`);
929
+ const { defaultKeyType: d, defaultStringType: u } = e.options, f = i && d || u;
930
+ if (c = l(f), c === null)
931
+ throw new Error(`Unsupported default string type ${f}`);
937
932
  }
938
933
  return c;
939
934
  }
940
- function qt(s, e) {
935
+ function Jt(s, e) {
941
936
  const t = Object.assign({
942
937
  blockQuote: !0,
943
- commentString: Cs,
938
+ commentString: Us,
944
939
  defaultKeyType: null,
945
940
  defaultStringType: "PLAIN",
946
941
  directives: null,
@@ -978,14 +973,14 @@ function qt(s, e) {
978
973
  options: t
979
974
  };
980
975
  }
981
- function Ms(s, e) {
976
+ function qs(s, e) {
982
977
  if (e.tag) {
983
978
  const i = s.filter((r) => r.tag === e.tag);
984
979
  if (i.length > 0)
985
980
  return i.find((r) => r.format === e.format) ?? i[0];
986
981
  }
987
982
  let t, n;
988
- if (E(e)) {
983
+ if (T(e)) {
989
984
  n = e.value;
990
985
  let i = s.filter((r) => r.identify?.(n));
991
986
  if (i.length > 1) {
@@ -1001,16 +996,16 @@ function Ms(s, e) {
1001
996
  }
1002
997
  return t;
1003
998
  }
1004
- function Ps(s, e, { anchors: t, doc: n }) {
999
+ function Vs(s, e, { anchors: t, doc: n }) {
1005
1000
  if (!n.directives)
1006
1001
  return "";
1007
- const i = [], r = (E(s) || I(s)) && s.anchor;
1008
- r && Bt(r) && (t.add(r), i.push(`&${r}`));
1002
+ const i = [], r = (T(s) || I(s)) && s.anchor;
1003
+ r && Dt(r) && (t.add(r), i.push(`&${r}`));
1009
1004
  const o = s.tag ?? (e.default ? null : e.tag);
1010
1005
  return o && i.push(n.directives.tagString(o)), i.join(" ");
1011
1006
  }
1012
- function ie(s, e, t, n) {
1013
- if ($(s))
1007
+ function re(s, e, t, n) {
1008
+ if (L(s))
1014
1009
  return s.toString(e, t, n);
1015
1010
  if (Q(s)) {
1016
1011
  if (e.doc.directives)
@@ -1020,103 +1015,103 @@ function ie(s, e, t, n) {
1020
1015
  e.resolvedAliases ? e.resolvedAliases.add(s) : e.resolvedAliases = /* @__PURE__ */ new Set([s]), s = s.resolve(e.doc);
1021
1016
  }
1022
1017
  let i;
1023
- const r = L(s) ? s : e.doc.createNode(s, { onTagObj: (a) => i = a });
1024
- i ?? (i = Ms(e.doc.schema.tags, r));
1025
- const o = Ps(r, i, e);
1018
+ const r = $(s) ? s : e.doc.createNode(s, { onTagObj: (l) => i = l });
1019
+ i ?? (i = qs(e.doc.schema.tags, r));
1020
+ const o = Vs(r, i, e);
1026
1021
  o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
1027
- const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : E(r) ? rt(r, e, t, n) : r.toString(e, t, n);
1028
- return o ? E(r) || l[0] === "{" || l[0] === "[" ? `${o} ${l}` : `${o}
1029
- ${e.indent}${l}` : l;
1030
- }
1031
- function js({ key: s, value: e }, t, n, i) {
1032
- const { allNullValues: r, doc: o, indent: l, indentStep: a, options: { commentString: c, indentSeq: d, simpleKeys: f } } = t;
1033
- let u = L(s) && s.comment || null;
1034
- if (f) {
1035
- if (u)
1022
+ const a = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : T(r) ? at(r, e, t, n) : r.toString(e, t, n);
1023
+ return o ? T(r) || a[0] === "{" || a[0] === "[" ? `${o} ${a}` : `${o}
1024
+ ${e.indent}${a}` : a;
1025
+ }
1026
+ function Js({ key: s, value: e }, t, n, i) {
1027
+ const { allNullValues: r, doc: o, indent: a, indentStep: l, options: { commentString: c, indentSeq: d, simpleKeys: u } } = t;
1028
+ let f = $(s) && s.comment || null;
1029
+ if (u) {
1030
+ if (f)
1036
1031
  throw new Error("With simple keys, key nodes cannot have comments");
1037
- if (I(s) || !L(s) && typeof s == "object") {
1038
- const T = "With simple keys, collection cannot be used as a key value";
1039
- throw new Error(T);
1032
+ if (I(s) || !$(s) && typeof s == "object") {
1033
+ const E = "With simple keys, collection cannot be used as a key value";
1034
+ throw new Error(E);
1040
1035
  }
1041
1036
  }
1042
- let m = !f && (!s || u && e == null && !t.inFlow || I(s) || (E(s) ? s.type === O.BLOCK_FOLDED || s.type === O.BLOCK_LITERAL : typeof s == "object"));
1037
+ let p = !u && (!s || f && e == null && !t.inFlow || I(s) || (T(s) ? s.type === O.BLOCK_FOLDED || s.type === O.BLOCK_LITERAL : typeof s == "object"));
1043
1038
  t = Object.assign({}, t, {
1044
1039
  allNullValues: !1,
1045
- implicitKey: !m && (f || !r),
1046
- indent: l + a
1040
+ implicitKey: !p && (u || !r),
1041
+ indent: a + l
1047
1042
  });
1048
- let g = !1, h = !1, p = ie(s, t, () => g = !0, () => h = !0);
1049
- if (!m && !t.inFlow && p.length > 1024) {
1050
- if (f)
1043
+ let g = !1, h = !1, m = re(s, t, () => g = !0, () => h = !0);
1044
+ if (!p && !t.inFlow && m.length > 1024) {
1045
+ if (u)
1051
1046
  throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
1052
- m = !0;
1047
+ p = !0;
1053
1048
  }
1054
1049
  if (t.inFlow) {
1055
1050
  if (r || e == null)
1056
- return g && n && n(), p === "" ? "?" : m ? `? ${p}` : p;
1057
- } else if (r && !f || e == null && m)
1058
- return p = `? ${p}`, u && !g ? p += G(p, t.indent, c(u)) : h && i && i(), p;
1059
- g && (u = null), m ? (u && (p += G(p, t.indent, c(u))), p = `? ${p}
1060
- ${l}:`) : (p = `${p}:`, u && (p += G(p, t.indent, c(u))));
1051
+ return g && n && n(), m === "" ? "?" : p ? `? ${m}` : m;
1052
+ } else if (r && !u || e == null && p)
1053
+ return m = `? ${m}`, f && !g ? m += G(m, t.indent, c(f)) : h && i && i(), m;
1054
+ g && (f = null), p ? (f && (m += G(m, t.indent, c(f))), m = `? ${m}
1055
+ ${a}:`) : (m = `${m}:`, f && (m += G(m, t.indent, c(f))));
1061
1056
  let b, w, k;
1062
- L(e) ? (b = !!e.spaceBefore, w = e.commentBefore, k = e.comment) : (b = !1, w = null, k = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !m && !u && E(e) && (t.indentAtStart = p.length + 1), h = !1, !d && a.length >= 2 && !t.inFlow && !m && be(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
1057
+ $(e) ? (b = !!e.spaceBefore, w = e.commentBefore, k = e.comment) : (b = !1, w = null, k = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !p && !f && T(e) && (t.indentAtStart = m.length + 1), h = !1, !d && l.length >= 2 && !t.inFlow && !p && we(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
1063
1058
  let S = !1;
1064
- const N = ie(e, t, () => S = !0, () => h = !0);
1059
+ const N = re(e, t, () => S = !0, () => h = !0);
1065
1060
  let A = " ";
1066
- if (u || b || w) {
1061
+ if (f || b || w) {
1067
1062
  if (A = b ? `
1068
1063
  ` : "", w) {
1069
- const T = c(w);
1064
+ const E = c(w);
1070
1065
  A += `
1071
- ${U(T, t.indent)}`;
1066
+ ${F(E, t.indent)}`;
1072
1067
  }
1073
1068
  N === "" && !t.inFlow ? A === `
1074
1069
  ` && k && (A = `
1075
1070
 
1076
1071
  `) : A += `
1077
1072
  ${t.indent}`;
1078
- } else if (!m && I(e)) {
1079
- const T = N[0], y = N.indexOf(`
1080
- `), v = y !== -1, R = t.inFlow ?? e.flow ?? e.items.length === 0;
1081
- if (v || !R) {
1073
+ } else if (!p && I(e)) {
1074
+ const E = N[0], y = N.indexOf(`
1075
+ `), v = y !== -1, q = t.inFlow ?? e.flow ?? e.items.length === 0;
1076
+ if (v || !q) {
1082
1077
  let X = !1;
1083
- if (v && (T === "&" || T === "!")) {
1078
+ if (v && (E === "&" || E === "!")) {
1084
1079
  let C = N.indexOf(" ");
1085
- T === "&" && C !== -1 && C < y && N[C + 1] === "!" && (C = N.indexOf(" ", C + 1)), (C === -1 || y < C) && (X = !0);
1080
+ E === "&" && C !== -1 && C < y && N[C + 1] === "!" && (C = N.indexOf(" ", C + 1)), (C === -1 || y < C) && (X = !0);
1086
1081
  }
1087
1082
  X || (A = `
1088
1083
  ${t.indent}`);
1089
1084
  }
1090
1085
  } else (N === "" || N[0] === `
1091
1086
  `) && (A = "");
1092
- return p += A + N, t.inFlow ? S && n && n() : k && !S ? p += G(p, t.indent, c(k)) : h && i && i(), p;
1087
+ return m += A + N, t.inFlow ? S && n && n() : k && !S ? m += G(m, t.indent, c(k)) : h && i && i(), m;
1093
1088
  }
1094
- function Ut(s, e) {
1089
+ function Yt(s, e) {
1095
1090
  (s === "debug" || s === "warn") && console.warn(e);
1096
1091
  }
1097
- const Se = "<<", F = {
1098
- identify: (s) => s === Se || typeof s == "symbol" && s.description === Se,
1092
+ const Ne = "<<", R = {
1093
+ identify: (s) => s === Ne || typeof s == "symbol" && s.description === Ne,
1099
1094
  default: "key",
1100
1095
  tag: "tag:yaml.org,2002:merge",
1101
1096
  test: /^<<$/,
1102
- resolve: () => Object.assign(new O(Symbol(Se)), {
1103
- addToJSMap: Ft
1097
+ resolve: () => Object.assign(new O(Symbol(Ne)), {
1098
+ addToJSMap: Gt
1104
1099
  }),
1105
- stringify: () => Se
1106
- }, Ks = (s, e) => (F.identify(e) || E(e) && (!e.type || e.type === O.PLAIN) && F.identify(e.value)) && s?.doc.schema.tags.some((t) => t.tag === F.tag && t.default);
1107
- function Ft(s, e, t) {
1108
- if (t = s && Q(t) ? t.resolve(s.doc) : t, be(t))
1100
+ stringify: () => Ne
1101
+ }, Ys = (s, e) => (R.identify(e) || T(e) && (!e.type || e.type === O.PLAIN) && R.identify(e.value)) && s?.doc.schema.tags.some((t) => t.tag === R.tag && t.default);
1102
+ function Gt(s, e, t) {
1103
+ if (t = s && Q(t) ? t.resolve(s.doc) : t, we(t))
1109
1104
  for (const n of t.items)
1110
- Re(s, e, n);
1105
+ Ve(s, e, n);
1111
1106
  else if (Array.isArray(t))
1112
1107
  for (const n of t)
1113
- Re(s, e, n);
1108
+ Ve(s, e, n);
1114
1109
  else
1115
- Re(s, e, t);
1110
+ Ve(s, e, t);
1116
1111
  }
1117
- function Re(s, e, t) {
1112
+ function Ve(s, e, t) {
1118
1113
  const n = s && Q(t) ? t.resolve(s.doc) : t;
1119
- if (!ye(n))
1114
+ if (!be(n))
1120
1115
  throw new Error("Merge sources must be maps or map aliases");
1121
1116
  const i = n.toJSON(null, s, Map);
1122
1117
  for (const [r, o] of i)
@@ -1128,19 +1123,19 @@ function Re(s, e, t) {
1128
1123
  });
1129
1124
  return e;
1130
1125
  }
1131
- function Rt(s, e, { key: t, value: n }) {
1132
- if (L(t) && t.addToJSMap)
1126
+ function Wt(s, e, { key: t, value: n }) {
1127
+ if ($(t) && t.addToJSMap)
1133
1128
  t.addToJSMap(s, e, n);
1134
- else if (Ks(s, t))
1135
- Ft(s, e, n);
1129
+ else if (Ys(s, t))
1130
+ Gt(s, e, n);
1136
1131
  else {
1137
- const i = P(t, "", s);
1132
+ const i = M(t, "", s);
1138
1133
  if (e instanceof Map)
1139
- e.set(i, P(n, i, s));
1134
+ e.set(i, M(n, i, s));
1140
1135
  else if (e instanceof Set)
1141
1136
  e.add(i);
1142
1137
  else {
1143
- const r = Ds(t, i, s), o = P(n, r, s);
1138
+ const r = Gs(t, i, s), o = M(n, r, s);
1144
1139
  r in e ? Object.defineProperty(e, r, {
1145
1140
  value: o,
1146
1141
  writable: !0,
@@ -1151,13 +1146,13 @@ function Rt(s, e, { key: t, value: n }) {
1151
1146
  }
1152
1147
  return e;
1153
1148
  }
1154
- function Ds(s, e, t) {
1149
+ function Gs(s, e, t) {
1155
1150
  if (e === null)
1156
1151
  return "";
1157
1152
  if (typeof e != "object")
1158
1153
  return String(e);
1159
- if (L(s) && t?.doc) {
1160
- const n = qt(t.doc, {});
1154
+ if ($(s) && t?.doc) {
1155
+ const n = Jt(t.doc, {});
1161
1156
  n.anchors = /* @__PURE__ */ new Set();
1162
1157
  for (const r of t.anchors.keys())
1163
1158
  n.anchors.add(r.anchor);
@@ -1165,124 +1160,124 @@ function Ds(s, e, t) {
1165
1160
  const i = s.toString(n);
1166
1161
  if (!t.mapKeyWarned) {
1167
1162
  let r = JSON.stringify(i);
1168
- r.length > 40 && (r = r.substring(0, 36) + '..."'), Ut(t.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`), t.mapKeyWarned = !0;
1163
+ r.length > 40 && (r = r.substring(0, 36) + '..."'), Yt(t.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`), t.mapKeyWarned = !0;
1169
1164
  }
1170
1165
  return i;
1171
1166
  }
1172
1167
  return JSON.stringify(e);
1173
1168
  }
1174
- function ot(s, e, t) {
1175
- const n = me(s, void 0, t), i = me(e, void 0, t);
1176
- return new B(n, i);
1169
+ function lt(s, e, t) {
1170
+ const n = ge(s, void 0, t), i = ge(e, void 0, t);
1171
+ return new j(n, i);
1177
1172
  }
1178
- class B {
1173
+ class j {
1179
1174
  constructor(e, t = null) {
1180
- Object.defineProperty(this, j, { value: Ct }), this.key = e, this.value = t;
1175
+ Object.defineProperty(this, P, { value: Pt }), this.key = e, this.value = t;
1181
1176
  }
1182
1177
  clone(e) {
1183
1178
  let { key: t, value: n } = this;
1184
- return L(t) && (t = t.clone(e)), L(n) && (n = n.clone(e)), new B(t, n);
1179
+ return $(t) && (t = t.clone(e)), $(n) && (n = n.clone(e)), new j(t, n);
1185
1180
  }
1186
1181
  toJSON(e, t) {
1187
1182
  const n = t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
1188
- return Rt(t, n, this);
1183
+ return Wt(t, n, this);
1189
1184
  }
1190
1185
  toString(e, t, n) {
1191
- return e?.doc ? js(this, e, t, n) : JSON.stringify(this);
1186
+ return e?.doc ? Js(this, e, t, n) : JSON.stringify(this);
1192
1187
  }
1193
1188
  }
1194
- function Vt(s, e, t) {
1195
- return (e.inFlow ?? s.flow ? Us : qs)(s, e, t);
1189
+ function Ht(s, e, t) {
1190
+ return (e.inFlow ?? s.flow ? Hs : Ws)(s, e, t);
1196
1191
  }
1197
- function qs({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: l }) {
1198
- const { indent: a, options: { commentString: c } } = t, d = Object.assign({}, t, { indent: r, type: null });
1199
- let f = !1;
1200
- const u = [];
1192
+ function Ws({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: a }) {
1193
+ const { indent: l, options: { commentString: c } } = t, d = Object.assign({}, t, { indent: r, type: null });
1194
+ let u = !1;
1195
+ const f = [];
1201
1196
  for (let g = 0; g < e.length; ++g) {
1202
1197
  const h = e[g];
1203
- let p = null;
1204
- if (L(h))
1205
- !f && h.spaceBefore && u.push(""), ve(t, u, h.commentBefore, f), h.comment && (p = h.comment);
1206
- else if ($(h)) {
1207
- const w = L(h.key) ? h.key : null;
1208
- w && (!f && w.spaceBefore && u.push(""), ve(t, u, w.commentBefore, f));
1198
+ let m = null;
1199
+ if ($(h))
1200
+ !u && h.spaceBefore && f.push(""), Ce(t, f, h.commentBefore, u), h.comment && (m = h.comment);
1201
+ else if (L(h)) {
1202
+ const w = $(h.key) ? h.key : null;
1203
+ w && (!u && w.spaceBefore && f.push(""), Ce(t, f, w.commentBefore, u));
1209
1204
  }
1210
- f = !1;
1211
- let b = ie(h, d, () => p = null, () => f = !0);
1212
- p && (b += G(b, r, c(p))), f && p && (f = !1), u.push(n + b);
1205
+ u = !1;
1206
+ let b = re(h, d, () => m = null, () => u = !0);
1207
+ m && (b += G(b, r, c(m))), u && m && (u = !1), f.push(n + b);
1213
1208
  }
1214
- let m;
1215
- if (u.length === 0)
1216
- m = i.start + i.end;
1209
+ let p;
1210
+ if (f.length === 0)
1211
+ p = i.start + i.end;
1217
1212
  else {
1218
- m = u[0];
1219
- for (let g = 1; g < u.length; ++g) {
1220
- const h = u[g];
1221
- m += h ? `
1222
- ${a}${h}` : `
1213
+ p = f[0];
1214
+ for (let g = 1; g < f.length; ++g) {
1215
+ const h = f[g];
1216
+ p += h ? `
1217
+ ${l}${h}` : `
1223
1218
  `;
1224
1219
  }
1225
1220
  }
1226
- return s ? (m += `
1227
- ` + U(c(s), a), l && l()) : f && o && o(), m;
1221
+ return s ? (p += `
1222
+ ` + F(c(s), l), a && a()) : u && o && o(), p;
1228
1223
  }
1229
- function Us({ items: s }, e, { flowChars: t, itemIndent: n }) {
1230
- const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: l } } = e;
1224
+ function Hs({ items: s }, e, { flowChars: t, itemIndent: n }) {
1225
+ const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: a } } = e;
1231
1226
  n += r;
1232
- const a = Object.assign({}, e, {
1227
+ const l = Object.assign({}, e, {
1233
1228
  indent: n,
1234
1229
  inFlow: !0,
1235
1230
  type: null
1236
1231
  });
1237
1232
  let c = !1, d = 0;
1238
- const f = [];
1233
+ const u = [];
1239
1234
  for (let g = 0; g < s.length; ++g) {
1240
1235
  const h = s[g];
1241
- let p = null;
1242
- if (L(h))
1243
- h.spaceBefore && f.push(""), ve(e, f, h.commentBefore, !1), h.comment && (p = h.comment);
1244
- else if ($(h)) {
1245
- const w = L(h.key) ? h.key : null;
1246
- w && (w.spaceBefore && f.push(""), ve(e, f, w.commentBefore, !1), w.comment && (c = !0));
1247
- const k = L(h.value) ? h.value : null;
1248
- k ? (k.comment && (p = k.comment), k.commentBefore && (c = !0)) : h.value == null && w?.comment && (p = w.comment);
1236
+ let m = null;
1237
+ if ($(h))
1238
+ h.spaceBefore && u.push(""), Ce(e, u, h.commentBefore, !1), h.comment && (m = h.comment);
1239
+ else if (L(h)) {
1240
+ const w = $(h.key) ? h.key : null;
1241
+ w && (w.spaceBefore && u.push(""), Ce(e, u, w.commentBefore, !1), w.comment && (c = !0));
1242
+ const k = $(h.value) ? h.value : null;
1243
+ k ? (k.comment && (m = k.comment), k.commentBefore && (c = !0)) : h.value == null && w?.comment && (m = w.comment);
1249
1244
  }
1250
- p && (c = !0);
1251
- let b = ie(h, a, () => p = null);
1252
- g < s.length - 1 && (b += ","), p && (b += G(b, n, l(p))), !c && (f.length > d || b.includes(`
1253
- `)) && (c = !0), f.push(b), d = f.length;
1245
+ m && (c = !0);
1246
+ let b = re(h, l, () => m = null);
1247
+ g < s.length - 1 && (b += ","), m && (b += G(b, n, a(m))), !c && (u.length > d || b.includes(`
1248
+ `)) && (c = !0), u.push(b), d = u.length;
1254
1249
  }
1255
- const { start: u, end: m } = t;
1256
- if (f.length === 0)
1257
- return u + m;
1250
+ const { start: f, end: p } = t;
1251
+ if (u.length === 0)
1252
+ return f + p;
1258
1253
  if (!c) {
1259
- const g = f.reduce((h, p) => h + p.length + 2, 2);
1254
+ const g = u.reduce((h, m) => h + m.length + 2, 2);
1260
1255
  c = e.options.lineWidth > 0 && g > e.options.lineWidth;
1261
1256
  }
1262
1257
  if (c) {
1263
- let g = u;
1264
- for (const h of f)
1258
+ let g = f;
1259
+ for (const h of u)
1265
1260
  g += h ? `
1266
1261
  ${r}${i}${h}` : `
1267
1262
  `;
1268
1263
  return `${g}
1269
- ${i}${m}`;
1264
+ ${i}${p}`;
1270
1265
  } else
1271
- return `${u}${o}${f.join(" ")}${o}${m}`;
1266
+ return `${f}${o}${u.join(" ")}${o}${p}`;
1272
1267
  }
1273
- function ve({ indent: s, options: { commentString: e } }, t, n, i) {
1268
+ function Ce({ indent: s, options: { commentString: e } }, t, n, i) {
1274
1269
  if (n && i && (n = n.replace(/^\n+/, "")), n) {
1275
- const r = U(e(n), s);
1270
+ const r = F(e(n), s);
1276
1271
  t.push(r.trimStart());
1277
1272
  }
1278
1273
  }
1279
- function H(s, e) {
1280
- const t = E(e) ? e.value : e;
1274
+ function W(s, e) {
1275
+ const t = T(e) ? e.value : e;
1281
1276
  for (const n of s)
1282
- if ($(n) && (n.key === e || n.key === t || E(n.key) && n.key.value === t))
1277
+ if (L(n) && (n.key === e || n.key === t || T(n.key) && n.key.value === t))
1283
1278
  return n;
1284
1279
  }
1285
- class M extends Kt {
1280
+ class B extends qt {
1286
1281
  static get tagName() {
1287
1282
  return "tag:yaml.org,2002:map";
1288
1283
  }
@@ -1294,19 +1289,19 @@ class M extends Kt {
1294
1289
  * to other node classes that inherit from YAMLMap
1295
1290
  */
1296
1291
  static from(e, t, n) {
1297
- const { keepUndefined: i, replacer: r } = n, o = new this(e), l = (a, c) => {
1292
+ const { keepUndefined: i, replacer: r } = n, o = new this(e), a = (l, c) => {
1298
1293
  if (typeof r == "function")
1299
- c = r.call(t, a, c);
1300
- else if (Array.isArray(r) && !r.includes(a))
1294
+ c = r.call(t, l, c);
1295
+ else if (Array.isArray(r) && !r.includes(l))
1301
1296
  return;
1302
- (c !== void 0 || i) && o.items.push(ot(a, c, n));
1297
+ (c !== void 0 || i) && o.items.push(lt(l, c, n));
1303
1298
  };
1304
1299
  if (t instanceof Map)
1305
- for (const [a, c] of t)
1306
- l(a, c);
1300
+ for (const [l, c] of t)
1301
+ a(l, c);
1307
1302
  else if (t && typeof t == "object")
1308
- for (const a of Object.keys(t))
1309
- l(a, t[a]);
1303
+ for (const l of Object.keys(t))
1304
+ a(l, t[l]);
1310
1305
  return typeof e.sortMapEntries == "function" && o.items.sort(e.sortMapEntries), o;
1311
1306
  }
1312
1307
  /**
@@ -1317,31 +1312,31 @@ class M extends Kt {
1317
1312
  */
1318
1313
  add(e, t) {
1319
1314
  let n;
1320
- $(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new B(e, e?.value) : n = new B(e.key, e.value);
1321
- const i = H(this.items, n.key), r = this.schema?.sortMapEntries;
1315
+ L(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new j(e, e?.value) : n = new j(e.key, e.value);
1316
+ const i = W(this.items, n.key), r = this.schema?.sortMapEntries;
1322
1317
  if (i) {
1323
1318
  if (!t)
1324
1319
  throw new Error(`Key ${n.key} already set`);
1325
- E(i.value) && jt(n.value) ? i.value.value = n.value : i.value = n.value;
1320
+ T(i.value) && Rt(n.value) ? i.value.value = n.value : i.value = n.value;
1326
1321
  } else if (r) {
1327
- const o = this.items.findIndex((l) => r(n, l) < 0);
1322
+ const o = this.items.findIndex((a) => r(n, a) < 0);
1328
1323
  o === -1 ? this.items.push(n) : this.items.splice(o, 0, n);
1329
1324
  } else
1330
1325
  this.items.push(n);
1331
1326
  }
1332
1327
  delete(e) {
1333
- const t = H(this.items, e);
1328
+ const t = W(this.items, e);
1334
1329
  return t ? this.items.splice(this.items.indexOf(t), 1).length > 0 : !1;
1335
1330
  }
1336
1331
  get(e, t) {
1337
- const i = H(this.items, e)?.value;
1338
- return (!t && E(i) ? i.value : i) ?? void 0;
1332
+ const i = W(this.items, e)?.value;
1333
+ return (!t && T(i) ? i.value : i) ?? void 0;
1339
1334
  }
1340
1335
  has(e) {
1341
- return !!H(this.items, e);
1336
+ return !!W(this.items, e);
1342
1337
  }
1343
1338
  set(e, t) {
1344
- this.add(new B(e, t), !0);
1339
+ this.add(new j(e, t), !0);
1345
1340
  }
1346
1341
  /**
1347
1342
  * @param ctx - Conversion context, originally set in Document#toJS()
@@ -1352,16 +1347,16 @@ class M extends Kt {
1352
1347
  const i = n ? new n() : t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
1353
1348
  t?.onCreate && t.onCreate(i);
1354
1349
  for (const r of this.items)
1355
- Rt(t, i, r);
1350
+ Wt(t, i, r);
1356
1351
  return i;
1357
1352
  }
1358
1353
  toString(e, t, n) {
1359
1354
  if (!e)
1360
1355
  return JSON.stringify(this);
1361
1356
  for (const i of this.items)
1362
- if (!$(i))
1357
+ if (!L(i))
1363
1358
  throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);
1364
- return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), Vt(this, e, {
1359
+ return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), Ht(this, e, {
1365
1360
  blockItemPrefix: "",
1366
1361
  flowChars: { start: "{", end: "}" },
1367
1362
  itemIndent: e.indent || "",
@@ -1370,22 +1365,22 @@ class M extends Kt {
1370
1365
  });
1371
1366
  }
1372
1367
  }
1373
- const ae = {
1368
+ const ce = {
1374
1369
  collection: "map",
1375
1370
  default: !0,
1376
- nodeClass: M,
1371
+ nodeClass: B,
1377
1372
  tag: "tag:yaml.org,2002:map",
1378
1373
  resolve(s, e) {
1379
- return ye(s) || e("Expected a mapping for this tag"), s;
1374
+ return be(s) || e("Expected a mapping for this tag"), s;
1380
1375
  },
1381
- createNode: (s, e, t) => M.from(s, e, t)
1376
+ createNode: (s, e, t) => B.from(s, e, t)
1382
1377
  };
1383
- class W extends Kt {
1378
+ class H extends qt {
1384
1379
  static get tagName() {
1385
1380
  return "tag:yaml.org,2002:seq";
1386
1381
  }
1387
1382
  constructor(e) {
1388
- super(oe, e), this.items = [];
1383
+ super(ae, e), this.items = [];
1389
1384
  }
1390
1385
  add(e) {
1391
1386
  this.items.push(e);
@@ -1399,15 +1394,15 @@ class W extends Kt {
1399
1394
  * @returns `true` if the item was found and removed.
1400
1395
  */
1401
1396
  delete(e) {
1402
- const t = Ne(e);
1397
+ const t = Oe(e);
1403
1398
  return typeof t != "number" ? !1 : this.items.splice(t, 1).length > 0;
1404
1399
  }
1405
1400
  get(e, t) {
1406
- const n = Ne(e);
1401
+ const n = Oe(e);
1407
1402
  if (typeof n != "number")
1408
1403
  return;
1409
1404
  const i = this.items[n];
1410
- return !t && E(i) ? i.value : i;
1405
+ return !t && T(i) ? i.value : i;
1411
1406
  }
1412
1407
  /**
1413
1408
  * Checks if the collection includes a value with the key `key`.
@@ -1416,7 +1411,7 @@ class W extends Kt {
1416
1411
  * It may be wrapped in a `Scalar`.
1417
1412
  */
1418
1413
  has(e) {
1419
- const t = Ne(e);
1414
+ const t = Oe(e);
1420
1415
  return typeof t == "number" && t < this.items.length;
1421
1416
  }
1422
1417
  /**
@@ -1427,22 +1422,22 @@ class W extends Kt {
1427
1422
  * It may be wrapped in a `Scalar`.
1428
1423
  */
1429
1424
  set(e, t) {
1430
- const n = Ne(e);
1425
+ const n = Oe(e);
1431
1426
  if (typeof n != "number")
1432
1427
  throw new Error(`Expected a valid index, not ${e}.`);
1433
1428
  const i = this.items[n];
1434
- E(i) && jt(t) ? i.value = t : this.items[n] = t;
1429
+ T(i) && Rt(t) ? i.value = t : this.items[n] = t;
1435
1430
  }
1436
1431
  toJSON(e, t) {
1437
1432
  const n = [];
1438
1433
  t?.onCreate && t.onCreate(n);
1439
1434
  let i = 0;
1440
1435
  for (const r of this.items)
1441
- n.push(P(r, String(i++), t));
1436
+ n.push(M(r, String(i++), t));
1442
1437
  return n;
1443
1438
  }
1444
1439
  toString(e, t, n) {
1445
- return e ? Vt(this, e, {
1440
+ return e ? Ht(this, e, {
1446
1441
  blockItemPrefix: "- ",
1447
1442
  flowChars: { start: "[", end: "]" },
1448
1443
  itemIndent: (e.indent || "") + " ",
@@ -1454,54 +1449,54 @@ class W extends Kt {
1454
1449
  const { replacer: i } = n, r = new this(e);
1455
1450
  if (t && Symbol.iterator in Object(t)) {
1456
1451
  let o = 0;
1457
- for (let l of t) {
1452
+ for (let a of t) {
1458
1453
  if (typeof i == "function") {
1459
- const a = t instanceof Set ? l : String(o++);
1460
- l = i.call(t, a, l);
1454
+ const l = t instanceof Set ? a : String(o++);
1455
+ a = i.call(t, l, a);
1461
1456
  }
1462
- r.items.push(me(l, void 0, n));
1457
+ r.items.push(ge(a, void 0, n));
1463
1458
  }
1464
1459
  }
1465
1460
  return r;
1466
1461
  }
1467
1462
  }
1468
- function Ne(s) {
1469
- let e = E(s) ? s.value : s;
1463
+ function Oe(s) {
1464
+ let e = T(s) ? s.value : s;
1470
1465
  return e && typeof e == "string" && (e = Number(e)), typeof e == "number" && Number.isInteger(e) && e >= 0 ? e : null;
1471
1466
  }
1472
- const ce = {
1467
+ const fe = {
1473
1468
  collection: "seq",
1474
1469
  default: !0,
1475
- nodeClass: W,
1470
+ nodeClass: H,
1476
1471
  tag: "tag:yaml.org,2002:seq",
1477
1472
  resolve(s, e) {
1478
- return be(s) || e("Expected a sequence for this tag"), s;
1473
+ return we(s) || e("Expected a sequence for this tag"), s;
1479
1474
  },
1480
- createNode: (s, e, t) => W.from(s, e, t)
1481
- }, Pe = {
1475
+ createNode: (s, e, t) => H.from(s, e, t)
1476
+ }, Ke = {
1482
1477
  identify: (s) => typeof s == "string",
1483
1478
  default: !0,
1484
1479
  tag: "tag:yaml.org,2002:str",
1485
1480
  resolve: (s) => s,
1486
1481
  stringify(s, e, t, n) {
1487
- return e = Object.assign({ actualString: !0 }, e), rt(s, e, t, n);
1482
+ return e = Object.assign({ actualString: !0 }, e), at(s, e, t, n);
1488
1483
  }
1489
- }, je = {
1484
+ }, De = {
1490
1485
  identify: (s) => s == null,
1491
1486
  createNode: () => new O(null),
1492
1487
  default: !0,
1493
1488
  tag: "tag:yaml.org,2002:null",
1494
1489
  test: /^(?:~|[Nn]ull|NULL)?$/,
1495
1490
  resolve: () => new O(null),
1496
- stringify: ({ source: s }, e) => typeof s == "string" && je.test.test(s) ? s : e.options.nullStr
1497
- }, lt = {
1491
+ stringify: ({ source: s }, e) => typeof s == "string" && De.test.test(s) ? s : e.options.nullStr
1492
+ }, ct = {
1498
1493
  identify: (s) => typeof s == "boolean",
1499
1494
  default: !0,
1500
1495
  tag: "tag:yaml.org,2002:bool",
1501
1496
  test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
1502
1497
  resolve: (s) => new O(s[0] === "t" || s[0] === "T"),
1503
1498
  stringify({ source: s, value: e }, t) {
1504
- if (s && lt.test.test(s)) {
1499
+ if (s && ct.test.test(s)) {
1505
1500
  const n = s[0] === "t" || s[0] === "T";
1506
1501
  if (e === n)
1507
1502
  return s;
@@ -1519,20 +1514,20 @@ function D({ format: s, minFractionDigits: e, tag: t, value: n }) {
1519
1514
  if (!s && e && (!t || t === "tag:yaml.org,2002:float") && /^\d/.test(r)) {
1520
1515
  let o = r.indexOf(".");
1521
1516
  o < 0 && (o = r.length, r += ".");
1522
- let l = e - (r.length - o - 1);
1523
- for (; l-- > 0; )
1517
+ let a = e - (r.length - o - 1);
1518
+ for (; a-- > 0; )
1524
1519
  r += "0";
1525
1520
  }
1526
1521
  return r;
1527
1522
  }
1528
- const Jt = {
1523
+ const Qt = {
1529
1524
  identify: (s) => typeof s == "number",
1530
1525
  default: !0,
1531
1526
  tag: "tag:yaml.org,2002:float",
1532
1527
  test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
1533
1528
  resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
1534
1529
  stringify: D
1535
- }, Yt = {
1530
+ }, Xt = {
1536
1531
  identify: (s) => typeof s == "number",
1537
1532
  default: !0,
1538
1533
  tag: "tag:yaml.org,2002:float",
@@ -1543,7 +1538,7 @@ const Jt = {
1543
1538
  const e = Number(s.value);
1544
1539
  return isFinite(e) ? e.toExponential() : D(s);
1545
1540
  }
1546
- }, Gt = {
1541
+ }, xt = {
1547
1542
  identify: (s) => typeof s == "number",
1548
1543
  default: !0,
1549
1544
  tag: "tag:yaml.org,2002:float",
@@ -1553,57 +1548,57 @@ const Jt = {
1553
1548
  return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
1554
1549
  },
1555
1550
  stringify: D
1556
- }, Ke = (s) => typeof s == "bigint" || Number.isInteger(s), at = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
1557
- function Ht(s, e, t) {
1551
+ }, Ue = (s) => typeof s == "bigint" || Number.isInteger(s), ft = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
1552
+ function zt(s, e, t) {
1558
1553
  const { value: n } = s;
1559
- return Ke(n) && n >= 0 ? t + n.toString(e) : D(s);
1554
+ return Ue(n) && n >= 0 ? t + n.toString(e) : D(s);
1560
1555
  }
1561
- const Wt = {
1562
- identify: (s) => Ke(s) && s >= 0,
1556
+ const Zt = {
1557
+ identify: (s) => Ue(s) && s >= 0,
1563
1558
  default: !0,
1564
1559
  tag: "tag:yaml.org,2002:int",
1565
1560
  format: "OCT",
1566
1561
  test: /^0o[0-7]+$/,
1567
- resolve: (s, e, t) => at(s, 2, 8, t),
1568
- stringify: (s) => Ht(s, 8, "0o")
1569
- }, Qt = {
1570
- identify: Ke,
1562
+ resolve: (s, e, t) => ft(s, 2, 8, t),
1563
+ stringify: (s) => zt(s, 8, "0o")
1564
+ }, es = {
1565
+ identify: Ue,
1571
1566
  default: !0,
1572
1567
  tag: "tag:yaml.org,2002:int",
1573
1568
  test: /^[-+]?[0-9]+$/,
1574
- resolve: (s, e, t) => at(s, 0, 10, t),
1569
+ resolve: (s, e, t) => ft(s, 0, 10, t),
1575
1570
  stringify: D
1576
- }, Xt = {
1577
- identify: (s) => Ke(s) && s >= 0,
1571
+ }, ts = {
1572
+ identify: (s) => Ue(s) && s >= 0,
1578
1573
  default: !0,
1579
1574
  tag: "tag:yaml.org,2002:int",
1580
1575
  format: "HEX",
1581
1576
  test: /^0x[0-9a-fA-F]+$/,
1582
- resolve: (s, e, t) => at(s, 2, 16, t),
1583
- stringify: (s) => Ht(s, 16, "0x")
1584
- }, Fs = [
1585
- ae,
1577
+ resolve: (s, e, t) => ft(s, 2, 16, t),
1578
+ stringify: (s) => zt(s, 16, "0x")
1579
+ }, Qs = [
1586
1580
  ce,
1587
- Pe,
1588
- je,
1589
- lt,
1590
- Wt,
1581
+ fe,
1582
+ Ke,
1583
+ De,
1584
+ ct,
1585
+ Zt,
1586
+ es,
1587
+ ts,
1591
1588
  Qt,
1592
1589
  Xt,
1593
- Jt,
1594
- Yt,
1595
- Gt
1590
+ xt
1596
1591
  ];
1597
- function kt(s) {
1592
+ function Nt(s) {
1598
1593
  return typeof s == "bigint" || Number.isInteger(s);
1599
1594
  }
1600
- const Oe = ({ value: s }) => JSON.stringify(s), Rs = [
1595
+ const Ae = ({ value: s }) => JSON.stringify(s), Xs = [
1601
1596
  {
1602
1597
  identify: (s) => typeof s == "string",
1603
1598
  default: !0,
1604
1599
  tag: "tag:yaml.org,2002:str",
1605
1600
  resolve: (s) => s,
1606
- stringify: Oe
1601
+ stringify: Ae
1607
1602
  },
1608
1603
  {
1609
1604
  identify: (s) => s == null,
@@ -1612,7 +1607,7 @@ const Oe = ({ value: s }) => JSON.stringify(s), Rs = [
1612
1607
  tag: "tag:yaml.org,2002:null",
1613
1608
  test: /^null$/,
1614
1609
  resolve: () => null,
1615
- stringify: Oe
1610
+ stringify: Ae
1616
1611
  },
1617
1612
  {
1618
1613
  identify: (s) => typeof s == "boolean",
@@ -1620,15 +1615,15 @@ const Oe = ({ value: s }) => JSON.stringify(s), Rs = [
1620
1615
  tag: "tag:yaml.org,2002:bool",
1621
1616
  test: /^true$|^false$/,
1622
1617
  resolve: (s) => s === "true",
1623
- stringify: Oe
1618
+ stringify: Ae
1624
1619
  },
1625
1620
  {
1626
- identify: kt,
1621
+ identify: Nt,
1627
1622
  default: !0,
1628
1623
  tag: "tag:yaml.org,2002:int",
1629
1624
  test: /^-?(?:0|[1-9][0-9]*)$/,
1630
1625
  resolve: (s, e, { intAsBigInt: t }) => t ? BigInt(s) : parseInt(s, 10),
1631
- stringify: ({ value: s }) => kt(s) ? s.toString() : JSON.stringify(s)
1626
+ stringify: ({ value: s }) => Nt(s) ? s.toString() : JSON.stringify(s)
1632
1627
  },
1633
1628
  {
1634
1629
  identify: (s) => typeof s == "number",
@@ -1636,16 +1631,16 @@ const Oe = ({ value: s }) => JSON.stringify(s), Rs = [
1636
1631
  tag: "tag:yaml.org,2002:float",
1637
1632
  test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
1638
1633
  resolve: (s) => parseFloat(s),
1639
- stringify: Oe
1634
+ stringify: Ae
1640
1635
  }
1641
- ], Vs = {
1636
+ ], xs = {
1642
1637
  default: !0,
1643
1638
  tag: "",
1644
1639
  test: /^/,
1645
1640
  resolve(s, e) {
1646
1641
  return e(`Unresolved plain scalar ${JSON.stringify(s)}`), s;
1647
1642
  }
1648
- }, Js = [ae, ce].concat(Rs, Vs), ct = {
1643
+ }, zs = [ce, fe].concat(Xs, xs), ut = {
1649
1644
  identify: (s) => s instanceof Uint8Array,
1650
1645
  // Buffer inherits from Uint8Array
1651
1646
  default: !1,
@@ -1671,32 +1666,32 @@ const Oe = ({ value: s }) => JSON.stringify(s), Rs = [
1671
1666
  if (!t)
1672
1667
  return "";
1673
1668
  const o = t;
1674
- let l;
1669
+ let a;
1675
1670
  if (typeof btoa == "function") {
1676
- let a = "";
1671
+ let l = "";
1677
1672
  for (let c = 0; c < o.length; ++c)
1678
- a += String.fromCharCode(o[c]);
1679
- l = btoa(a);
1673
+ l += String.fromCharCode(o[c]);
1674
+ a = btoa(l);
1680
1675
  } else
1681
1676
  throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
1682
1677
  if (e ?? (e = O.BLOCK_LITERAL), e !== O.QUOTE_DOUBLE) {
1683
- const a = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(l.length / a), d = new Array(c);
1684
- for (let f = 0, u = 0; f < c; ++f, u += a)
1685
- d[f] = l.substr(u, a);
1686
- l = d.join(e === O.BLOCK_LITERAL ? `
1678
+ const l = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(a.length / l), d = new Array(c);
1679
+ for (let u = 0, f = 0; u < c; ++u, f += l)
1680
+ d[u] = a.substr(f, l);
1681
+ a = d.join(e === O.BLOCK_LITERAL ? `
1687
1682
  ` : " ");
1688
1683
  }
1689
- return rt({ comment: s, type: e, value: l }, n, i, r);
1684
+ return at({ comment: s, type: e, value: a }, n, i, r);
1690
1685
  }
1691
1686
  };
1692
- function xt(s, e) {
1693
- if (be(s))
1687
+ function ss(s, e) {
1688
+ if (we(s))
1694
1689
  for (let t = 0; t < s.items.length; ++t) {
1695
1690
  let n = s.items[t];
1696
- if (!$(n)) {
1697
- if (ye(n)) {
1691
+ if (!L(n)) {
1692
+ if (be(n)) {
1698
1693
  n.items.length > 1 && e("Each pair must have its own sequence indicator");
1699
- const i = n.items[0] || new B(new O(null));
1694
+ const i = n.items[0] || new j(new O(null));
1700
1695
  if (n.commentBefore && (i.key.commentBefore = i.key.commentBefore ? `${n.commentBefore}
1701
1696
  ${i.key.commentBefore}` : n.commentBefore), n.comment) {
1702
1697
  const r = i.value ?? i.key;
@@ -1705,48 +1700,48 @@ ${r.comment}` : n.comment;
1705
1700
  }
1706
1701
  n = i;
1707
1702
  }
1708
- s.items[t] = $(n) ? n : new B(n);
1703
+ s.items[t] = L(n) ? n : new j(n);
1709
1704
  }
1710
1705
  }
1711
1706
  else
1712
1707
  e("Expected a sequence for this tag");
1713
1708
  return s;
1714
1709
  }
1715
- function zt(s, e, t) {
1716
- const { replacer: n } = t, i = new W(s);
1710
+ function ns(s, e, t) {
1711
+ const { replacer: n } = t, i = new H(s);
1717
1712
  i.tag = "tag:yaml.org,2002:pairs";
1718
1713
  let r = 0;
1719
1714
  if (e && Symbol.iterator in Object(e))
1720
1715
  for (let o of e) {
1721
1716
  typeof n == "function" && (o = n.call(e, String(r++), o));
1722
- let l, a;
1717
+ let a, l;
1723
1718
  if (Array.isArray(o))
1724
1719
  if (o.length === 2)
1725
- l = o[0], a = o[1];
1720
+ a = o[0], l = o[1];
1726
1721
  else
1727
1722
  throw new TypeError(`Expected [key, value] tuple: ${o}`);
1728
1723
  else if (o && o instanceof Object) {
1729
1724
  const c = Object.keys(o);
1730
1725
  if (c.length === 1)
1731
- l = c[0], a = o[l];
1726
+ a = c[0], l = o[a];
1732
1727
  else
1733
1728
  throw new TypeError(`Expected tuple with one key, not ${c.length} keys`);
1734
1729
  } else
1735
- l = o;
1736
- i.items.push(ot(l, a, t));
1730
+ a = o;
1731
+ i.items.push(lt(a, l, t));
1737
1732
  }
1738
1733
  return i;
1739
1734
  }
1740
- const ft = {
1735
+ const ht = {
1741
1736
  collection: "seq",
1742
1737
  default: !1,
1743
1738
  tag: "tag:yaml.org,2002:pairs",
1744
- resolve: xt,
1745
- createNode: zt
1739
+ resolve: ss,
1740
+ createNode: ns
1746
1741
  };
1747
- class se extends W {
1742
+ class ne extends H {
1748
1743
  constructor() {
1749
- super(), this.add = M.prototype.add.bind(this), this.delete = M.prototype.delete.bind(this), this.get = M.prototype.get.bind(this), this.has = M.prototype.has.bind(this), this.set = M.prototype.set.bind(this), this.tag = se.tag;
1744
+ super(), this.add = B.prototype.add.bind(this), this.delete = B.prototype.delete.bind(this), this.get = B.prototype.get.bind(this), this.has = B.prototype.has.bind(this), this.set = B.prototype.set.bind(this), this.tag = ne.tag;
1750
1745
  }
1751
1746
  /**
1752
1747
  * If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
@@ -1759,57 +1754,57 @@ class se extends W {
1759
1754
  t?.onCreate && t.onCreate(n);
1760
1755
  for (const i of this.items) {
1761
1756
  let r, o;
1762
- if ($(i) ? (r = P(i.key, "", t), o = P(i.value, r, t)) : r = P(i, "", t), n.has(r))
1757
+ if (L(i) ? (r = M(i.key, "", t), o = M(i.value, r, t)) : r = M(i, "", t), n.has(r))
1763
1758
  throw new Error("Ordered maps must not include duplicate keys");
1764
1759
  n.set(r, o);
1765
1760
  }
1766
1761
  return n;
1767
1762
  }
1768
1763
  static from(e, t, n) {
1769
- const i = zt(e, t, n), r = new this();
1764
+ const i = ns(e, t, n), r = new this();
1770
1765
  return r.items = i.items, r;
1771
1766
  }
1772
1767
  }
1773
- se.tag = "tag:yaml.org,2002:omap";
1774
- const ut = {
1768
+ ne.tag = "tag:yaml.org,2002:omap";
1769
+ const dt = {
1775
1770
  collection: "seq",
1776
1771
  identify: (s) => s instanceof Map,
1777
- nodeClass: se,
1772
+ nodeClass: ne,
1778
1773
  default: !1,
1779
1774
  tag: "tag:yaml.org,2002:omap",
1780
1775
  resolve(s, e) {
1781
- const t = xt(s, e), n = [];
1776
+ const t = ss(s, e), n = [];
1782
1777
  for (const { key: i } of t.items)
1783
- E(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
1784
- return Object.assign(new se(), t);
1778
+ T(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
1779
+ return Object.assign(new ne(), t);
1785
1780
  },
1786
- createNode: (s, e, t) => se.from(s, e, t)
1781
+ createNode: (s, e, t) => ne.from(s, e, t)
1787
1782
  };
1788
- function Zt({ value: s, source: e }, t) {
1789
- return e && (s ? es : ts).test.test(e) ? e : s ? t.options.trueStr : t.options.falseStr;
1783
+ function is({ value: s, source: e }, t) {
1784
+ return e && (s ? rs : os).test.test(e) ? e : s ? t.options.trueStr : t.options.falseStr;
1790
1785
  }
1791
- const es = {
1786
+ const rs = {
1792
1787
  identify: (s) => s === !0,
1793
1788
  default: !0,
1794
1789
  tag: "tag:yaml.org,2002:bool",
1795
1790
  test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
1796
1791
  resolve: () => new O(!0),
1797
- stringify: Zt
1798
- }, ts = {
1792
+ stringify: is
1793
+ }, os = {
1799
1794
  identify: (s) => s === !1,
1800
1795
  default: !0,
1801
1796
  tag: "tag:yaml.org,2002:bool",
1802
1797
  test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
1803
1798
  resolve: () => new O(!1),
1804
- stringify: Zt
1805
- }, Ys = {
1799
+ stringify: is
1800
+ }, Zs = {
1806
1801
  identify: (s) => typeof s == "number",
1807
1802
  default: !0,
1808
1803
  tag: "tag:yaml.org,2002:float",
1809
1804
  test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
1810
1805
  resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
1811
1806
  stringify: D
1812
- }, Gs = {
1807
+ }, en = {
1813
1808
  identify: (s) => typeof s == "number",
1814
1809
  default: !0,
1815
1810
  tag: "tag:yaml.org,2002:float",
@@ -1820,7 +1815,7 @@ const es = {
1820
1815
  const e = Number(s.value);
1821
1816
  return isFinite(e) ? e.toExponential() : D(s);
1822
1817
  }
1823
- }, Hs = {
1818
+ }, tn = {
1824
1819
  identify: (s) => typeof s == "number",
1825
1820
  default: !0,
1826
1821
  tag: "tag:yaml.org,2002:float",
@@ -1834,8 +1829,8 @@ const es = {
1834
1829
  return e;
1835
1830
  },
1836
1831
  stringify: D
1837
- }, we = (s) => typeof s == "bigint" || Number.isInteger(s);
1838
- function De(s, e, t, { intAsBigInt: n }) {
1832
+ }, ke = (s) => typeof s == "bigint" || Number.isInteger(s);
1833
+ function Fe(s, e, t, { intAsBigInt: n }) {
1839
1834
  const i = s[0];
1840
1835
  if ((i === "-" || i === "+") && (e += 1), s = s.substring(e).replace(/_/g, ""), n) {
1841
1836
  switch (t) {
@@ -1855,67 +1850,67 @@ function De(s, e, t, { intAsBigInt: n }) {
1855
1850
  const r = parseInt(s, t);
1856
1851
  return i === "-" ? -1 * r : r;
1857
1852
  }
1858
- function ht(s, e, t) {
1853
+ function pt(s, e, t) {
1859
1854
  const { value: n } = s;
1860
- if (we(n)) {
1855
+ if (ke(n)) {
1861
1856
  const i = n.toString(e);
1862
1857
  return n < 0 ? "-" + t + i.substr(1) : t + i;
1863
1858
  }
1864
1859
  return D(s);
1865
1860
  }
1866
- const Ws = {
1867
- identify: we,
1861
+ const sn = {
1862
+ identify: ke,
1868
1863
  default: !0,
1869
1864
  tag: "tag:yaml.org,2002:int",
1870
1865
  format: "BIN",
1871
1866
  test: /^[-+]?0b[0-1_]+$/,
1872
- resolve: (s, e, t) => De(s, 2, 2, t),
1873
- stringify: (s) => ht(s, 2, "0b")
1874
- }, Qs = {
1875
- identify: we,
1867
+ resolve: (s, e, t) => Fe(s, 2, 2, t),
1868
+ stringify: (s) => pt(s, 2, "0b")
1869
+ }, nn = {
1870
+ identify: ke,
1876
1871
  default: !0,
1877
1872
  tag: "tag:yaml.org,2002:int",
1878
1873
  format: "OCT",
1879
1874
  test: /^[-+]?0[0-7_]+$/,
1880
- resolve: (s, e, t) => De(s, 1, 8, t),
1881
- stringify: (s) => ht(s, 8, "0")
1882
- }, Xs = {
1883
- identify: we,
1875
+ resolve: (s, e, t) => Fe(s, 1, 8, t),
1876
+ stringify: (s) => pt(s, 8, "0")
1877
+ }, rn = {
1878
+ identify: ke,
1884
1879
  default: !0,
1885
1880
  tag: "tag:yaml.org,2002:int",
1886
1881
  test: /^[-+]?[0-9][0-9_]*$/,
1887
- resolve: (s, e, t) => De(s, 0, 10, t),
1882
+ resolve: (s, e, t) => Fe(s, 0, 10, t),
1888
1883
  stringify: D
1889
- }, xs = {
1890
- identify: we,
1884
+ }, on = {
1885
+ identify: ke,
1891
1886
  default: !0,
1892
1887
  tag: "tag:yaml.org,2002:int",
1893
1888
  format: "HEX",
1894
1889
  test: /^[-+]?0x[0-9a-fA-F_]+$/,
1895
- resolve: (s, e, t) => De(s, 2, 16, t),
1896
- stringify: (s) => ht(s, 16, "0x")
1890
+ resolve: (s, e, t) => Fe(s, 2, 16, t),
1891
+ stringify: (s) => pt(s, 16, "0x")
1897
1892
  };
1898
- class ne extends M {
1893
+ class ie extends B {
1899
1894
  constructor(e) {
1900
- super(e), this.tag = ne.tag;
1895
+ super(e), this.tag = ie.tag;
1901
1896
  }
1902
1897
  add(e) {
1903
1898
  let t;
1904
- $(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new B(e.key, null) : t = new B(e, null), H(this.items, t.key) || this.items.push(t);
1899
+ L(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new j(e.key, null) : t = new j(e, null), W(this.items, t.key) || this.items.push(t);
1905
1900
  }
1906
1901
  /**
1907
1902
  * If `keepPair` is `true`, returns the Pair matching `key`.
1908
1903
  * Otherwise, returns the value of that Pair's key.
1909
1904
  */
1910
1905
  get(e, t) {
1911
- const n = H(this.items, e);
1912
- return !t && $(n) ? E(n.key) ? n.key.value : n.key : n;
1906
+ const n = W(this.items, e);
1907
+ return !t && L(n) ? T(n.key) ? n.key.value : n.key : n;
1913
1908
  }
1914
1909
  set(e, t) {
1915
1910
  if (typeof t != "boolean")
1916
1911
  throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);
1917
- const n = H(this.items, e);
1918
- n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new B(e));
1912
+ const n = W(this.items, e);
1913
+ n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new j(e));
1919
1914
  }
1920
1915
  toJSON(e, t) {
1921
1916
  return super.toJSON(e, t, Set);
@@ -1931,33 +1926,33 @@ class ne extends M {
1931
1926
  const { replacer: i } = n, r = new this(e);
1932
1927
  if (t && Symbol.iterator in Object(t))
1933
1928
  for (let o of t)
1934
- typeof i == "function" && (o = i.call(t, o, o)), r.items.push(ot(o, null, n));
1929
+ typeof i == "function" && (o = i.call(t, o, o)), r.items.push(lt(o, null, n));
1935
1930
  return r;
1936
1931
  }
1937
1932
  }
1938
- ne.tag = "tag:yaml.org,2002:set";
1939
- const dt = {
1933
+ ie.tag = "tag:yaml.org,2002:set";
1934
+ const mt = {
1940
1935
  collection: "map",
1941
1936
  identify: (s) => s instanceof Set,
1942
- nodeClass: ne,
1937
+ nodeClass: ie,
1943
1938
  default: !1,
1944
1939
  tag: "tag:yaml.org,2002:set",
1945
- createNode: (s, e, t) => ne.from(s, e, t),
1940
+ createNode: (s, e, t) => ie.from(s, e, t),
1946
1941
  resolve(s, e) {
1947
- if (ye(s)) {
1942
+ if (be(s)) {
1948
1943
  if (s.hasAllNullValues(!0))
1949
- return Object.assign(new ne(), s);
1944
+ return Object.assign(new ie(), s);
1950
1945
  e("Set items must all have null values");
1951
1946
  } else
1952
1947
  e("Expected a mapping for this tag");
1953
1948
  return s;
1954
1949
  }
1955
1950
  };
1956
- function pt(s, e) {
1957
- const t = s[0], n = t === "-" || t === "+" ? s.substring(1) : s, i = (o) => e ? BigInt(o) : Number(o), r = n.replace(/_/g, "").split(":").reduce((o, l) => o * i(60) + i(l), i(0));
1951
+ function gt(s, e) {
1952
+ const t = s[0], n = t === "-" || t === "+" ? s.substring(1) : s, i = (o) => e ? BigInt(o) : Number(o), r = n.replace(/_/g, "").split(":").reduce((o, a) => o * i(60) + i(a), i(0));
1958
1953
  return t === "-" ? i(-1) * r : r;
1959
1954
  }
1960
- function ss(s) {
1955
+ function as(s) {
1961
1956
  let { value: e } = s, t = (o) => o;
1962
1957
  if (typeof e == "bigint")
1963
1958
  t = (o) => BigInt(o);
@@ -1968,23 +1963,23 @@ function ss(s) {
1968
1963
  const i = t(60), r = [e % i];
1969
1964
  return e < 60 ? r.unshift(0) : (e = (e - r[0]) / i, r.unshift(e % i), e >= 60 && (e = (e - r[0]) / i, r.unshift(e))), n + r.map((o) => String(o).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
1970
1965
  }
1971
- const ns = {
1966
+ const ls = {
1972
1967
  identify: (s) => typeof s == "bigint" || Number.isInteger(s),
1973
1968
  default: !0,
1974
1969
  tag: "tag:yaml.org,2002:int",
1975
1970
  format: "TIME",
1976
1971
  test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
1977
- resolve: (s, e, { intAsBigInt: t }) => pt(s, t),
1978
- stringify: ss
1979
- }, is = {
1972
+ resolve: (s, e, { intAsBigInt: t }) => gt(s, t),
1973
+ stringify: as
1974
+ }, cs = {
1980
1975
  identify: (s) => typeof s == "number",
1981
1976
  default: !0,
1982
1977
  tag: "tag:yaml.org,2002:float",
1983
1978
  format: "TIME",
1984
1979
  test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
1985
- resolve: (s) => pt(s, !1),
1986
- stringify: ss
1987
- }, qe = {
1980
+ resolve: (s) => gt(s, !1),
1981
+ stringify: as
1982
+ }, Re = {
1988
1983
  identify: (s) => s instanceof Date,
1989
1984
  default: !0,
1990
1985
  tag: "tag:yaml.org,2002:timestamp",
@@ -1993,155 +1988,155 @@ const ns = {
1993
1988
  // assumed to be 00:00:00Z (start of day, UTC).
1994
1989
  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})?))?)?$"),
1995
1990
  resolve(s) {
1996
- const e = s.match(qe.test);
1991
+ const e = s.match(Re.test);
1997
1992
  if (!e)
1998
1993
  throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
1999
- const [, t, n, i, r, o, l] = e.map(Number), a = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
2000
- let c = Date.UTC(t, n - 1, i, r || 0, o || 0, l || 0, a);
1994
+ const [, t, n, i, r, o, a] = e.map(Number), l = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
1995
+ let c = Date.UTC(t, n - 1, i, r || 0, o || 0, a || 0, l);
2001
1996
  const d = e[8];
2002
1997
  if (d && d !== "Z") {
2003
- let f = pt(d, !1);
2004
- Math.abs(f) < 30 && (f *= 60), c -= 6e4 * f;
1998
+ let u = gt(d, !1);
1999
+ Math.abs(u) < 30 && (u *= 60), c -= 6e4 * u;
2005
2000
  }
2006
2001
  return new Date(c);
2007
2002
  },
2008
2003
  stringify: ({ value: s }) => s?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
2009
- }, St = [
2010
- ae,
2004
+ }, Ot = [
2011
2005
  ce,
2012
- Pe,
2013
- je,
2014
- es,
2015
- ts,
2016
- Ws,
2017
- Qs,
2018
- Xs,
2019
- xs,
2020
- Ys,
2021
- Gs,
2022
- Hs,
2023
- ct,
2024
- F,
2006
+ fe,
2007
+ Ke,
2008
+ De,
2009
+ rs,
2010
+ os,
2011
+ sn,
2012
+ nn,
2013
+ rn,
2014
+ on,
2015
+ Zs,
2016
+ en,
2017
+ tn,
2025
2018
  ut,
2026
- ft,
2019
+ R,
2027
2020
  dt,
2028
- ns,
2029
- is,
2030
- qe
2031
- ], Nt = /* @__PURE__ */ new Map([
2032
- ["core", Fs],
2033
- ["failsafe", [ae, ce, Pe]],
2034
- ["json", Js],
2035
- ["yaml11", St],
2036
- ["yaml-1.1", St]
2037
- ]), Ot = {
2038
- binary: ct,
2039
- bool: lt,
2040
- float: Gt,
2041
- floatExp: Yt,
2042
- floatNaN: Jt,
2043
- floatTime: is,
2044
- int: Qt,
2045
- intHex: Xt,
2046
- intOct: Wt,
2047
- intTime: ns,
2048
- map: ae,
2049
- merge: F,
2050
- null: je,
2051
- omap: ut,
2052
- pairs: ft,
2053
- seq: ce,
2054
- set: dt,
2055
- timestamp: qe
2056
- }, zs = {
2057
- "tag:yaml.org,2002:binary": ct,
2058
- "tag:yaml.org,2002:merge": F,
2059
- "tag:yaml.org,2002:omap": ut,
2060
- "tag:yaml.org,2002:pairs": ft,
2061
- "tag:yaml.org,2002:set": dt,
2062
- "tag:yaml.org,2002:timestamp": qe
2021
+ ht,
2022
+ mt,
2023
+ ls,
2024
+ cs,
2025
+ Re
2026
+ ], At = /* @__PURE__ */ new Map([
2027
+ ["core", Qs],
2028
+ ["failsafe", [ce, fe, Ke]],
2029
+ ["json", zs],
2030
+ ["yaml11", Ot],
2031
+ ["yaml-1.1", Ot]
2032
+ ]), Et = {
2033
+ binary: ut,
2034
+ bool: ct,
2035
+ float: xt,
2036
+ floatExp: Xt,
2037
+ floatNaN: Qt,
2038
+ floatTime: cs,
2039
+ int: es,
2040
+ intHex: ts,
2041
+ intOct: Zt,
2042
+ intTime: ls,
2043
+ map: ce,
2044
+ merge: R,
2045
+ null: De,
2046
+ omap: dt,
2047
+ pairs: ht,
2048
+ seq: fe,
2049
+ set: mt,
2050
+ timestamp: Re
2051
+ }, an = {
2052
+ "tag:yaml.org,2002:binary": ut,
2053
+ "tag:yaml.org,2002:merge": R,
2054
+ "tag:yaml.org,2002:omap": dt,
2055
+ "tag:yaml.org,2002:pairs": ht,
2056
+ "tag:yaml.org,2002:set": mt,
2057
+ "tag:yaml.org,2002:timestamp": Re
2063
2058
  };
2064
- function Ve(s, e, t) {
2065
- const n = Nt.get(e);
2059
+ function Je(s, e, t) {
2060
+ const n = At.get(e);
2066
2061
  if (n && !s)
2067
- return t && !n.includes(F) ? n.concat(F) : n.slice();
2062
+ return t && !n.includes(R) ? n.concat(R) : n.slice();
2068
2063
  let i = n;
2069
2064
  if (!i)
2070
2065
  if (Array.isArray(s))
2071
2066
  i = [];
2072
2067
  else {
2073
- const r = Array.from(Nt.keys()).filter((o) => o !== "yaml11").map((o) => JSON.stringify(o)).join(", ");
2068
+ const r = Array.from(At.keys()).filter((o) => o !== "yaml11").map((o) => JSON.stringify(o)).join(", ");
2074
2069
  throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`);
2075
2070
  }
2076
2071
  if (Array.isArray(s))
2077
2072
  for (const r of s)
2078
2073
  i = i.concat(r);
2079
2074
  else typeof s == "function" && (i = s(i.slice()));
2080
- return t && (i = i.concat(F)), i.reduce((r, o) => {
2081
- const l = typeof o == "string" ? Ot[o] : o;
2082
- if (!l) {
2083
- const a = JSON.stringify(o), c = Object.keys(Ot).map((d) => JSON.stringify(d)).join(", ");
2084
- throw new Error(`Unknown custom tag ${a}; use one of ${c}`);
2075
+ return t && (i = i.concat(R)), i.reduce((r, o) => {
2076
+ const a = typeof o == "string" ? Et[o] : o;
2077
+ if (!a) {
2078
+ const l = JSON.stringify(o), c = Object.keys(Et).map((d) => JSON.stringify(d)).join(", ");
2079
+ throw new Error(`Unknown custom tag ${l}; use one of ${c}`);
2085
2080
  }
2086
- return r.includes(l) || r.push(l), r;
2081
+ return r.includes(a) || r.push(a), r;
2087
2082
  }, []);
2088
2083
  }
2089
- const Zs = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
2090
- class mt {
2091
- constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: l }) {
2092
- this.compat = Array.isArray(e) ? Ve(e, "compat") : e ? Ve(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? zs : {}, this.tags = Ve(t, this.name, n), this.toStringOptions = l ?? null, Object.defineProperty(this, J, { value: ae }), Object.defineProperty(this, q, { value: Pe }), Object.defineProperty(this, oe, { value: ce }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? Zs : null;
2084
+ const ln = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
2085
+ class yt {
2086
+ constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: a }) {
2087
+ this.compat = Array.isArray(e) ? Je(e, "compat") : e ? Je(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? an : {}, this.tags = Je(t, this.name, n), this.toStringOptions = a ?? null, Object.defineProperty(this, J, { value: ce }), Object.defineProperty(this, U, { value: Ke }), Object.defineProperty(this, ae, { value: fe }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? ln : null;
2093
2088
  }
2094
2089
  clone() {
2095
- const e = Object.create(mt.prototype, Object.getOwnPropertyDescriptors(this));
2090
+ const e = Object.create(yt.prototype, Object.getOwnPropertyDescriptors(this));
2096
2091
  return e.tags = this.tags.slice(), e;
2097
2092
  }
2098
2093
  }
2099
- function en(s, e) {
2094
+ function cn(s, e) {
2100
2095
  const t = [];
2101
2096
  let n = e.directives === !0;
2102
2097
  if (e.directives !== !1 && s.directives) {
2103
- const a = s.directives.toString(s);
2104
- a ? (t.push(a), n = !0) : s.directives.docStart && (n = !0);
2098
+ const l = s.directives.toString(s);
2099
+ l ? (t.push(l), n = !0) : s.directives.docStart && (n = !0);
2105
2100
  }
2106
2101
  n && t.push("---");
2107
- const i = qt(s, e), { commentString: r } = i.options;
2102
+ const i = Jt(s, e), { commentString: r } = i.options;
2108
2103
  if (s.commentBefore) {
2109
2104
  t.length !== 1 && t.unshift("");
2110
- const a = r(s.commentBefore);
2111
- t.unshift(U(a, ""));
2105
+ const l = r(s.commentBefore);
2106
+ t.unshift(F(l, ""));
2112
2107
  }
2113
- let o = !1, l = null;
2108
+ let o = !1, a = null;
2114
2109
  if (s.contents) {
2115
- if (L(s.contents)) {
2110
+ if ($(s.contents)) {
2116
2111
  if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
2117
2112
  const d = r(s.contents.commentBefore);
2118
- t.push(U(d, ""));
2113
+ t.push(F(d, ""));
2119
2114
  }
2120
- i.forceBlockIndent = !!s.comment, l = s.contents.comment;
2115
+ i.forceBlockIndent = !!s.comment, a = s.contents.comment;
2121
2116
  }
2122
- const a = l ? void 0 : () => o = !0;
2123
- let c = ie(s.contents, i, () => l = null, a);
2124
- l && (c += G(c, "", r(l))), (c[0] === "|" || c[0] === ">") && t[t.length - 1] === "---" ? t[t.length - 1] = `--- ${c}` : t.push(c);
2117
+ const l = a ? void 0 : () => o = !0;
2118
+ let c = re(s.contents, i, () => a = null, l);
2119
+ a && (c += G(c, "", r(a))), (c[0] === "|" || c[0] === ">") && t[t.length - 1] === "---" ? t[t.length - 1] = `--- ${c}` : t.push(c);
2125
2120
  } else
2126
- t.push(ie(s.contents, i));
2121
+ t.push(re(s.contents, i));
2127
2122
  if (s.directives?.docEnd)
2128
2123
  if (s.comment) {
2129
- const a = r(s.comment);
2130
- a.includes(`
2131
- `) ? (t.push("..."), t.push(U(a, ""))) : t.push(`... ${a}`);
2124
+ const l = r(s.comment);
2125
+ l.includes(`
2126
+ `) ? (t.push("..."), t.push(F(l, ""))) : t.push(`... ${l}`);
2132
2127
  } else
2133
2128
  t.push("...");
2134
2129
  else {
2135
- let a = s.comment;
2136
- a && o && (a = a.replace(/^\n+/, "")), a && ((!o || l) && t[t.length - 1] !== "" && t.push(""), t.push(U(r(a), "")));
2130
+ let l = s.comment;
2131
+ l && o && (l = l.replace(/^\n+/, "")), l && ((!o || a) && t[t.length - 1] !== "" && t.push(""), t.push(F(r(l), "")));
2137
2132
  }
2138
2133
  return t.join(`
2139
2134
  `) + `
2140
2135
  `;
2141
2136
  }
2142
- class Ue {
2137
+ class qe {
2143
2138
  constructor(e, t, n) {
2144
- this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, j, { value: We });
2139
+ this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, P, { value: Qe });
2145
2140
  let i = null;
2146
2141
  typeof t == "function" || Array.isArray(t) ? i = t : n === void 0 && t && (n = t, t = void 0);
2147
2142
  const r = Object.assign({
@@ -2164,18 +2159,18 @@ class Ue {
2164
2159
  * Custom Node values that inherit from `Object` still refer to their original instances.
2165
2160
  */
2166
2161
  clone() {
2167
- const e = Object.create(Ue.prototype, {
2168
- [j]: { value: We }
2162
+ const e = Object.create(qe.prototype, {
2163
+ [P]: { value: Qe }
2169
2164
  });
2170
- return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents = L(this.contents) ? this.contents.clone(e.schema) : this.contents, this.range && (e.range = this.range.slice()), e;
2165
+ return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents = $(this.contents) ? this.contents.clone(e.schema) : this.contents, this.range && (e.range = this.range.slice()), e;
2171
2166
  }
2172
2167
  /** Adds a value to the document. */
2173
2168
  add(e) {
2174
- x(this.contents) && this.contents.add(e);
2169
+ z(this.contents) && this.contents.add(e);
2175
2170
  }
2176
2171
  /** Adds a value to the document. */
2177
2172
  addIn(e, t) {
2178
- x(this.contents) && this.contents.addIn(e, t);
2173
+ z(this.contents) && this.contents.addIn(e, t);
2179
2174
  }
2180
2175
  /**
2181
2176
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -2188,34 +2183,34 @@ class Ue {
2188
2183
  */
2189
2184
  createAlias(e, t) {
2190
2185
  if (!e.anchor) {
2191
- const n = Mt(this);
2186
+ const n = Ut(this);
2192
2187
  e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
2193
- !t || n.has(t) ? Pt(t || "a", n) : t;
2188
+ !t || n.has(t) ? Ft(t || "a", n) : t;
2194
2189
  }
2195
- return new it(e.anchor);
2190
+ return new ot(e.anchor);
2196
2191
  }
2197
2192
  createNode(e, t, n) {
2198
2193
  let i;
2199
2194
  if (typeof t == "function")
2200
2195
  e = t.call({ "": e }, "", e), i = t;
2201
2196
  else if (Array.isArray(t)) {
2202
- const p = (w) => typeof w == "number" || w instanceof String || w instanceof Number, b = t.filter(p).map(String);
2197
+ const m = (w) => typeof w == "number" || w instanceof String || w instanceof Number, b = t.filter(m).map(String);
2203
2198
  b.length > 0 && (t = t.concat(b)), i = t;
2204
2199
  } else n === void 0 && t && (n = t, t = void 0);
2205
- const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: d } = n ?? {}, { onAnchor: f, setAnchors: u, sourceObjects: m } = Ls(
2200
+ const { aliasDuplicateObjects: r, anchorPrefix: o, flow: a, keepUndefined: l, onTagObj: c, tag: d } = n ?? {}, { onAnchor: u, setAnchors: f, sourceObjects: p } = Ps(
2206
2201
  this,
2207
2202
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
2208
2203
  o || "a"
2209
2204
  ), g = {
2210
2205
  aliasDuplicateObjects: r ?? !0,
2211
- keepUndefined: a ?? !1,
2212
- onAnchor: f,
2206
+ keepUndefined: l ?? !1,
2207
+ onAnchor: u,
2213
2208
  onTagObj: c,
2214
2209
  replacer: i,
2215
2210
  schema: this.schema,
2216
- sourceObjects: m
2217
- }, h = me(e, d, g);
2218
- return l && I(h) && (h.flow = !0), u(), h;
2211
+ sourceObjects: p
2212
+ }, h = ge(e, d, g);
2213
+ return a && I(h) && (h.flow = !0), f(), h;
2219
2214
  }
2220
2215
  /**
2221
2216
  * Convert a key and a value into a `Pair` using the current schema,
@@ -2223,21 +2218,21 @@ class Ue {
2223
2218
  */
2224
2219
  createPair(e, t, n = {}) {
2225
2220
  const i = this.createNode(e, null, n), r = this.createNode(t, null, n);
2226
- return new B(i, r);
2221
+ return new j(i, r);
2227
2222
  }
2228
2223
  /**
2229
2224
  * Removes a value from the document.
2230
2225
  * @returns `true` if the item was found and removed.
2231
2226
  */
2232
2227
  delete(e) {
2233
- return x(this.contents) ? this.contents.delete(e) : !1;
2228
+ return z(this.contents) ? this.contents.delete(e) : !1;
2234
2229
  }
2235
2230
  /**
2236
2231
  * Removes a value from the document.
2237
2232
  * @returns `true` if the item was found and removed.
2238
2233
  */
2239
2234
  deleteIn(e) {
2240
- return ue(e) ? this.contents == null ? !1 : (this.contents = null, !0) : x(this.contents) ? this.contents.deleteIn(e) : !1;
2235
+ return he(e) ? this.contents == null ? !1 : (this.contents = null, !0) : z(this.contents) ? this.contents.deleteIn(e) : !1;
2241
2236
  }
2242
2237
  /**
2243
2238
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -2253,7 +2248,7 @@ class Ue {
2253
2248
  * `true` (collections are always returned intact).
2254
2249
  */
2255
2250
  getIn(e, t) {
2256
- return ue(e) ? !t && E(this.contents) ? this.contents.value : this.contents : I(this.contents) ? this.contents.getIn(e, t) : void 0;
2251
+ return he(e) ? !t && T(this.contents) ? this.contents.value : this.contents : I(this.contents) ? this.contents.getIn(e, t) : void 0;
2257
2252
  }
2258
2253
  /**
2259
2254
  * Checks if the document includes a value with the key `key`.
@@ -2265,21 +2260,21 @@ class Ue {
2265
2260
  * Checks if the document includes a value at `path`.
2266
2261
  */
2267
2262
  hasIn(e) {
2268
- return ue(e) ? this.contents !== void 0 : I(this.contents) ? this.contents.hasIn(e) : !1;
2263
+ return he(e) ? this.contents !== void 0 : I(this.contents) ? this.contents.hasIn(e) : !1;
2269
2264
  }
2270
2265
  /**
2271
2266
  * Sets a value in this document. For `!!set`, `value` needs to be a
2272
2267
  * boolean to add/remove the item from the set.
2273
2268
  */
2274
2269
  set(e, t) {
2275
- this.contents == null ? this.contents = $e(this.schema, [e], t) : x(this.contents) && this.contents.set(e, t);
2270
+ this.contents == null ? this.contents = ve(this.schema, [e], t) : z(this.contents) && this.contents.set(e, t);
2276
2271
  }
2277
2272
  /**
2278
2273
  * Sets a value in this document. For `!!set`, `value` needs to be a
2279
2274
  * boolean to add/remove the item from the set.
2280
2275
  */
2281
2276
  setIn(e, t) {
2282
- ue(e) ? this.contents = t : this.contents == null ? this.contents = $e(this.schema, Array.from(e), t) : x(this.contents) && this.contents.setIn(e, t);
2277
+ he(e) ? this.contents = t : this.contents == null ? this.contents = ve(this.schema, Array.from(e), t) : z(this.contents) && this.contents.setIn(e, t);
2283
2278
  }
2284
2279
  /**
2285
2280
  * Change the YAML version and schema used by the document.
@@ -2310,24 +2305,24 @@ class Ue {
2310
2305
  if (t.schema instanceof Object)
2311
2306
  this.schema = t.schema;
2312
2307
  else if (n)
2313
- this.schema = new mt(Object.assign(n, t));
2308
+ this.schema = new yt(Object.assign(n, t));
2314
2309
  else
2315
2310
  throw new Error("With a null YAML version, the { schema: Schema } option is required");
2316
2311
  }
2317
2312
  // json & jsonArg are only used from toJSON()
2318
2313
  toJS({ json: e, jsonArg: t, mapAsMap: n, maxAliasCount: i, onAnchor: r, reviver: o } = {}) {
2319
- const l = {
2314
+ const a = {
2320
2315
  anchors: /* @__PURE__ */ new Map(),
2321
2316
  doc: this,
2322
2317
  keep: !e,
2323
2318
  mapAsMap: n === !0,
2324
2319
  mapKeyWarned: !1,
2325
2320
  maxAliasCount: typeof i == "number" ? i : 100
2326
- }, a = P(this.contents, t ?? "", l);
2321
+ }, l = M(this.contents, t ?? "", a);
2327
2322
  if (typeof r == "function")
2328
- for (const { count: c, res: d } of l.anchors.values())
2323
+ for (const { count: c, res: d } of a.anchors.values())
2329
2324
  r(d, c);
2330
- return typeof o == "function" ? ee(o, { "": a }, "", a) : a;
2325
+ return typeof o == "function" ? te(o, { "": l }, "", l) : l;
2331
2326
  }
2332
2327
  /**
2333
2328
  * A JSON representation of the document `contents`.
@@ -2346,50 +2341,50 @@ class Ue {
2346
2341
  const t = JSON.stringify(e.indent);
2347
2342
  throw new Error(`"indent" option must be a positive integer, not ${t}`);
2348
2343
  }
2349
- return en(this, e);
2344
+ return cn(this, e);
2350
2345
  }
2351
2346
  }
2352
- function x(s) {
2347
+ function z(s) {
2353
2348
  if (I(s))
2354
2349
  return !0;
2355
2350
  throw new Error("Expected a YAML collection as document contents");
2356
2351
  }
2357
- class rs extends Error {
2352
+ class fs extends Error {
2358
2353
  constructor(e, t, n, i) {
2359
2354
  super(), this.name = e, this.code = n, this.message = i, this.pos = t;
2360
2355
  }
2361
2356
  }
2362
- class he extends rs {
2357
+ class de extends fs {
2363
2358
  constructor(e, t, n) {
2364
2359
  super("YAMLParseError", e, t, n);
2365
2360
  }
2366
2361
  }
2367
- class tn extends rs {
2362
+ class fn extends fs {
2368
2363
  constructor(e, t, n) {
2369
2364
  super("YAMLWarning", e, t, n);
2370
2365
  }
2371
2366
  }
2372
- const At = (s, e) => (t) => {
2367
+ const Tt = (s, e) => (t) => {
2373
2368
  if (t.pos[0] === -1)
2374
2369
  return;
2375
- t.linePos = t.pos.map((l) => e.linePos(l));
2370
+ t.linePos = t.pos.map((a) => e.linePos(a));
2376
2371
  const { line: n, col: i } = t.linePos[0];
2377
2372
  t.message += ` at line ${n}, column ${i}`;
2378
2373
  let r = i - 1, o = s.substring(e.lineStarts[n - 1], e.lineStarts[n]).replace(/[\n\r]+$/, "");
2379
2374
  if (r >= 60 && o.length > 80) {
2380
- const l = Math.min(r - 39, o.length - 79);
2381
- o = "…" + o.substring(l), r -= l - 1;
2375
+ const a = Math.min(r - 39, o.length - 79);
2376
+ o = "…" + o.substring(a), r -= a - 1;
2382
2377
  }
2383
2378
  if (o.length > 80 && (o = o.substring(0, 79) + "…"), n > 1 && /^ *$/.test(o.substring(0, r))) {
2384
- let l = s.substring(e.lineStarts[n - 2], e.lineStarts[n - 1]);
2385
- l.length > 80 && (l = l.substring(0, 79) + `…
2386
- `), o = l + o;
2379
+ let a = s.substring(e.lineStarts[n - 2], e.lineStarts[n - 1]);
2380
+ a.length > 80 && (a = a.substring(0, 79) + `…
2381
+ `), o = a + o;
2387
2382
  }
2388
2383
  if (/[^ ]/.test(o)) {
2389
- let l = 1;
2390
- const a = t.linePos[1];
2391
- a?.line === n && a.col > i && (l = Math.max(1, Math.min(a.col - i, 80 - r)));
2392
- const c = " ".repeat(r) + "^".repeat(l);
2384
+ let a = 1;
2385
+ const l = t.linePos[1];
2386
+ l?.line === n && l.col > i && (a = Math.max(1, Math.min(l.col - i, 80 - r)));
2387
+ const c = " ".repeat(r) + "^".repeat(a);
2393
2388
  t.message += `:
2394
2389
 
2395
2390
  ${o}
@@ -2397,8 +2392,8 @@ ${c}
2397
2392
  `;
2398
2393
  }
2399
2394
  };
2400
- function re(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIndent: o, startOnNewline: l }) {
2401
- let a = !1, c = l, d = l, f = "", u = "", m = !1, g = !1, h = null, p = null, b = null, w = null, k = null, S = null, N = null;
2395
+ function oe(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIndent: o, startOnNewline: a }) {
2396
+ let l = !1, c = a, d = a, u = "", f = "", p = !1, g = !1, h = null, m = null, b = null, w = null, k = null, S = null, N = null;
2402
2397
  for (const y of s)
2403
2398
  switch (g && (y.type !== "space" && y.type !== "newline" && y.type !== "comma" && r(y.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), g = !1), h && (c && y.type !== "comment" && y.type !== "newline" && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), h = null), y.type) {
2404
2399
  case "space":
@@ -2407,21 +2402,21 @@ function re(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIn
2407
2402
  case "comment": {
2408
2403
  d || r(y, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
2409
2404
  const v = y.source.substring(1) || " ";
2410
- f ? f += u + v : f = v, u = "", c = !1;
2405
+ u ? u += f + v : u = v, f = "", c = !1;
2411
2406
  break;
2412
2407
  }
2413
2408
  case "newline":
2414
- c ? f ? f += y.source : (!S || t !== "seq-item-ind") && (a = !0) : u += y.source, c = !0, m = !0, (p || b) && (w = y), d = !0;
2409
+ c ? u ? u += y.source : (!S || t !== "seq-item-ind") && (l = !0) : f += y.source, c = !0, p = !0, (m || b) && (w = y), d = !0;
2415
2410
  break;
2416
2411
  case "anchor":
2417
- p && r(y, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), y.source.endsWith(":") && r(y.offset + y.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), p = y, N ?? (N = y.offset), c = !1, d = !1, g = !0;
2412
+ m && r(y, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), y.source.endsWith(":") && r(y.offset + y.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), m = y, N ?? (N = y.offset), c = !1, d = !1, g = !0;
2418
2413
  break;
2419
2414
  case "tag": {
2420
2415
  b && r(y, "MULTIPLE_TAGS", "A node can have at most one tag"), b = y, N ?? (N = y.offset), c = !1, d = !1, g = !0;
2421
2416
  break;
2422
2417
  }
2423
2418
  case t:
2424
- (p || b) && r(y, "BAD_PROP_ORDER", `Anchors and tags must be after the ${y.source} indicator`), S && r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.source} in ${e ?? "collection"}`), S = y, c = t === "seq-item-ind" || t === "explicit-key-ind", d = !1;
2419
+ (m || b) && r(y, "BAD_PROP_ORDER", `Anchors and tags must be after the ${y.source} indicator`), S && r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.source} in ${e ?? "collection"}`), S = y, c = t === "seq-item-ind" || t === "explicit-key-ind", d = !1;
2425
2420
  break;
2426
2421
  case "comma":
2427
2422
  if (e) {
@@ -2432,21 +2427,21 @@ function re(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIn
2432
2427
  default:
2433
2428
  r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.type} token`), c = !1, d = !1;
2434
2429
  }
2435
- const A = s[s.length - 1], T = A ? A.offset + A.source.length : i;
2430
+ const A = s[s.length - 1], E = A ? A.offset + A.source.length : i;
2436
2431
  return g && n && n.type !== "space" && n.type !== "newline" && n.type !== "comma" && (n.type !== "scalar" || n.source !== "") && r(n.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), h && (c && h.indent <= o || n?.type === "block-map" || n?.type === "block-seq") && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
2437
2432
  comma: k,
2438
2433
  found: S,
2439
- spaceBefore: a,
2440
- comment: f,
2441
- hasNewline: m,
2442
- anchor: p,
2434
+ spaceBefore: l,
2435
+ comment: u,
2436
+ hasNewline: p,
2437
+ anchor: m,
2443
2438
  tag: b,
2444
2439
  newlineAfterProp: w,
2445
- end: T,
2446
- start: N ?? T
2440
+ end: E,
2441
+ start: N ?? E
2447
2442
  };
2448
2443
  }
2449
- function ge(s) {
2444
+ function ye(s) {
2450
2445
  if (!s)
2451
2446
  return null;
2452
2447
  switch (s.type) {
@@ -2473,7 +2468,7 @@ function ge(s) {
2473
2468
  if (t.type === "newline")
2474
2469
  return !0;
2475
2470
  }
2476
- if (ge(e.key) || ge(e.value))
2471
+ if (ye(e.key) || ye(e.value))
2477
2472
  return !0;
2478
2473
  }
2479
2474
  return !1;
@@ -2481,179 +2476,179 @@ function ge(s) {
2481
2476
  return !0;
2482
2477
  }
2483
2478
  }
2484
- function ze(s, e, t) {
2479
+ function Ze(s, e, t) {
2485
2480
  if (e?.type === "flow-collection") {
2486
2481
  const n = e.end[0];
2487
- n.indent === s && (n.source === "]" || n.source === "}") && ge(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
2482
+ n.indent === s && (n.source === "]" || n.source === "}") && ye(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
2488
2483
  }
2489
2484
  }
2490
- function os(s, e, t) {
2485
+ function us(s, e, t) {
2491
2486
  const { uniqueKeys: n } = s.options;
2492
2487
  if (n === !1)
2493
2488
  return !1;
2494
- const i = typeof n == "function" ? n : (r, o) => r === o || E(r) && E(o) && r.value === o.value;
2489
+ const i = typeof n == "function" ? n : (r, o) => r === o || T(r) && T(o) && r.value === o.value;
2495
2490
  return e.some((r) => i(r.key, t));
2496
2491
  }
2497
- const Tt = "All mapping items must start at the same column";
2498
- function sn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2499
- const o = r?.nodeClass ?? M, l = new o(t.schema);
2492
+ const It = "All mapping items must start at the same column";
2493
+ function un({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2494
+ const o = r?.nodeClass ?? B, a = new o(t.schema);
2500
2495
  t.atRoot && (t.atRoot = !1);
2501
- let a = n.offset, c = null;
2496
+ let l = n.offset, c = null;
2502
2497
  for (const d of n.items) {
2503
- const { start: f, key: u, sep: m, value: g } = d, h = re(f, {
2498
+ const { start: u, key: f, sep: p, value: g } = d, h = oe(u, {
2504
2499
  indicator: "explicit-key-ind",
2505
- next: u ?? m?.[0],
2506
- offset: a,
2500
+ next: f ?? p?.[0],
2501
+ offset: l,
2507
2502
  onError: i,
2508
2503
  parentIndent: n.indent,
2509
2504
  startOnNewline: !0
2510
- }), p = !h.found;
2511
- if (p) {
2512
- if (u && (u.type === "block-seq" ? i(a, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in u && u.indent !== n.indent && i(a, "BAD_INDENT", Tt)), !h.anchor && !h.tag && !m) {
2513
- c = h.end, h.comment && (l.comment ? l.comment += `
2514
- ` + h.comment : l.comment = h.comment);
2505
+ }), m = !h.found;
2506
+ if (m) {
2507
+ if (f && (f.type === "block-seq" ? i(l, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in f && f.indent !== n.indent && i(l, "BAD_INDENT", It)), !h.anchor && !h.tag && !p) {
2508
+ c = h.end, h.comment && (a.comment ? a.comment += `
2509
+ ` + h.comment : a.comment = h.comment);
2515
2510
  continue;
2516
2511
  }
2517
- (h.newlineAfterProp || ge(u)) && i(u ?? f[f.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
2518
- } else h.found?.indent !== n.indent && i(a, "BAD_INDENT", Tt);
2512
+ (h.newlineAfterProp || ye(f)) && i(f ?? u[u.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
2513
+ } else h.found?.indent !== n.indent && i(l, "BAD_INDENT", It);
2519
2514
  t.atKey = !0;
2520
- const b = h.end, w = u ? s(t, u, h, i) : e(t, b, f, null, h, i);
2521
- t.schema.compat && ze(n.indent, u, i), t.atKey = !1, os(t, l.items, w) && i(b, "DUPLICATE_KEY", "Map keys must be unique");
2522
- const k = re(m ?? [], {
2515
+ const b = h.end, w = f ? s(t, f, h, i) : e(t, b, u, null, h, i);
2516
+ t.schema.compat && Ze(n.indent, f, i), t.atKey = !1, us(t, a.items, w) && i(b, "DUPLICATE_KEY", "Map keys must be unique");
2517
+ const k = oe(p ?? [], {
2523
2518
  indicator: "map-value-ind",
2524
2519
  next: g,
2525
2520
  offset: w.range[2],
2526
2521
  onError: i,
2527
2522
  parentIndent: n.indent,
2528
- startOnNewline: !u || u.type === "block-scalar"
2523
+ startOnNewline: !f || f.type === "block-scalar"
2529
2524
  });
2530
- if (a = k.end, k.found) {
2531
- p && (g?.type === "block-map" && !k.hasNewline && i(a, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && h.start < k.found.offset - 1024 && i(w.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
2532
- const S = g ? s(t, g, k, i) : e(t, a, m, null, k, i);
2533
- t.schema.compat && ze(n.indent, g, i), a = S.range[2];
2534
- const N = new B(w, S);
2535
- t.options.keepSourceTokens && (N.srcToken = d), l.items.push(N);
2525
+ if (l = k.end, k.found) {
2526
+ m && (g?.type === "block-map" && !k.hasNewline && i(l, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && h.start < k.found.offset - 1024 && i(w.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
2527
+ const S = g ? s(t, g, k, i) : e(t, l, p, null, k, i);
2528
+ t.schema.compat && Ze(n.indent, g, i), l = S.range[2];
2529
+ const N = new j(w, S);
2530
+ t.options.keepSourceTokens && (N.srcToken = d), a.items.push(N);
2536
2531
  } else {
2537
- p && i(w.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), k.comment && (w.comment ? w.comment += `
2532
+ m && i(w.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), k.comment && (w.comment ? w.comment += `
2538
2533
  ` + k.comment : w.comment = k.comment);
2539
- const S = new B(w);
2540
- t.options.keepSourceTokens && (S.srcToken = d), l.items.push(S);
2534
+ const S = new j(w);
2535
+ t.options.keepSourceTokens && (S.srcToken = d), a.items.push(S);
2541
2536
  }
2542
2537
  }
2543
- return c && c < a && i(c, "IMPOSSIBLE", "Map comment with trailing content"), l.range = [n.offset, a, c ?? a], l;
2538
+ return c && c < l && i(c, "IMPOSSIBLE", "Map comment with trailing content"), a.range = [n.offset, l, c ?? l], a;
2544
2539
  }
2545
- function nn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2546
- const o = r?.nodeClass ?? W, l = new o(t.schema);
2540
+ function hn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2541
+ const o = r?.nodeClass ?? H, a = new o(t.schema);
2547
2542
  t.atRoot && (t.atRoot = !1), t.atKey && (t.atKey = !1);
2548
- let a = n.offset, c = null;
2549
- for (const { start: d, value: f } of n.items) {
2550
- const u = re(d, {
2543
+ let l = n.offset, c = null;
2544
+ for (const { start: d, value: u } of n.items) {
2545
+ const f = oe(d, {
2551
2546
  indicator: "seq-item-ind",
2552
- next: f,
2553
- offset: a,
2547
+ next: u,
2548
+ offset: l,
2554
2549
  onError: i,
2555
2550
  parentIndent: n.indent,
2556
2551
  startOnNewline: !0
2557
2552
  });
2558
- if (!u.found)
2559
- if (u.anchor || u.tag || f)
2560
- f?.type === "block-seq" ? i(u.end, "BAD_INDENT", "All sequence items must start at the same column") : i(a, "MISSING_CHAR", "Sequence item without - indicator");
2553
+ if (!f.found)
2554
+ if (f.anchor || f.tag || u)
2555
+ u?.type === "block-seq" ? i(f.end, "BAD_INDENT", "All sequence items must start at the same column") : i(l, "MISSING_CHAR", "Sequence item without - indicator");
2561
2556
  else {
2562
- c = u.end, u.comment && (l.comment = u.comment);
2557
+ c = f.end, f.comment && (a.comment = f.comment);
2563
2558
  continue;
2564
2559
  }
2565
- const m = f ? s(t, f, u, i) : e(t, u.end, d, null, u, i);
2566
- t.schema.compat && ze(n.indent, f, i), a = m.range[2], l.items.push(m);
2560
+ const p = u ? s(t, u, f, i) : e(t, f.end, d, null, f, i);
2561
+ t.schema.compat && Ze(n.indent, u, i), l = p.range[2], a.items.push(p);
2567
2562
  }
2568
- return l.range = [n.offset, a, c ?? a], l;
2563
+ return a.range = [n.offset, l, c ?? l], a;
2569
2564
  }
2570
- function ke(s, e, t, n) {
2565
+ function Se(s, e, t, n) {
2571
2566
  let i = "";
2572
2567
  if (s) {
2573
2568
  let r = !1, o = "";
2574
- for (const l of s) {
2575
- const { source: a, type: c } = l;
2569
+ for (const a of s) {
2570
+ const { source: l, type: c } = a;
2576
2571
  switch (c) {
2577
2572
  case "space":
2578
2573
  r = !0;
2579
2574
  break;
2580
2575
  case "comment": {
2581
- t && !r && n(l, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
2582
- const d = a.substring(1) || " ";
2576
+ t && !r && n(a, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
2577
+ const d = l.substring(1) || " ";
2583
2578
  i ? i += o + d : i = d, o = "";
2584
2579
  break;
2585
2580
  }
2586
2581
  case "newline":
2587
- i && (o += a), r = !0;
2582
+ i && (o += l), r = !0;
2588
2583
  break;
2589
2584
  default:
2590
- n(l, "UNEXPECTED_TOKEN", `Unexpected ${c} at node end`);
2585
+ n(a, "UNEXPECTED_TOKEN", `Unexpected ${c} at node end`);
2591
2586
  }
2592
- e += a.length;
2587
+ e += l.length;
2593
2588
  }
2594
2589
  }
2595
2590
  return { comment: i, offset: e };
2596
2591
  }
2597
- const Je = "Block collections are not allowed within flow collections", Ye = (s) => s && (s.type === "block-map" || s.type === "block-seq");
2598
- function rn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2599
- const o = n.start.source === "{", l = o ? "flow map" : "flow sequence", a = r?.nodeClass ?? (o ? M : W), c = new a(t.schema);
2592
+ const Ye = "Block collections are not allowed within flow collections", Ge = (s) => s && (s.type === "block-map" || s.type === "block-seq");
2593
+ function dn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2594
+ const o = n.start.source === "{", a = o ? "flow map" : "flow sequence", l = r?.nodeClass ?? (o ? B : H), c = new l(t.schema);
2600
2595
  c.flow = !0;
2601
2596
  const d = t.atRoot;
2602
2597
  d && (t.atRoot = !1), t.atKey && (t.atKey = !1);
2603
- let f = n.offset + n.start.source.length;
2604
- for (let p = 0; p < n.items.length; ++p) {
2605
- const b = n.items[p], { start: w, key: k, sep: S, value: N } = b, A = re(w, {
2606
- flow: l,
2598
+ let u = n.offset + n.start.source.length;
2599
+ for (let m = 0; m < n.items.length; ++m) {
2600
+ const b = n.items[m], { start: w, key: k, sep: S, value: N } = b, A = oe(w, {
2601
+ flow: a,
2607
2602
  indicator: "explicit-key-ind",
2608
2603
  next: k ?? S?.[0],
2609
- offset: f,
2604
+ offset: u,
2610
2605
  onError: i,
2611
2606
  parentIndent: n.indent,
2612
2607
  startOnNewline: !1
2613
2608
  });
2614
2609
  if (!A.found) {
2615
2610
  if (!A.anchor && !A.tag && !S && !N) {
2616
- p === 0 && A.comma ? i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`) : p < n.items.length - 1 && i(A.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${l}`), A.comment && (c.comment ? c.comment += `
2617
- ` + A.comment : c.comment = A.comment), f = A.end;
2611
+ m === 0 && A.comma ? i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${a}`) : m < n.items.length - 1 && i(A.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${a}`), A.comment && (c.comment ? c.comment += `
2612
+ ` + A.comment : c.comment = A.comment), u = A.end;
2618
2613
  continue;
2619
2614
  }
2620
- !o && t.options.strict && ge(k) && i(
2615
+ !o && t.options.strict && ye(k) && i(
2621
2616
  k,
2622
2617
  // checked by containsNewline()
2623
2618
  "MULTILINE_IMPLICIT_KEY",
2624
2619
  "Implicit keys of flow sequence pairs need to be on a single line"
2625
2620
  );
2626
2621
  }
2627
- if (p === 0)
2628
- A.comma && i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`);
2629
- else if (A.comma || i(A.start, "MISSING_CHAR", `Missing , between ${l} items`), A.comment) {
2630
- let T = "";
2622
+ if (m === 0)
2623
+ A.comma && i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${a}`);
2624
+ else if (A.comma || i(A.start, "MISSING_CHAR", `Missing , between ${a} items`), A.comment) {
2625
+ let E = "";
2631
2626
  e: for (const y of w)
2632
2627
  switch (y.type) {
2633
2628
  case "comma":
2634
2629
  case "space":
2635
2630
  break;
2636
2631
  case "comment":
2637
- T = y.source.substring(1);
2632
+ E = y.source.substring(1);
2638
2633
  break e;
2639
2634
  default:
2640
2635
  break e;
2641
2636
  }
2642
- if (T) {
2637
+ if (E) {
2643
2638
  let y = c.items[c.items.length - 1];
2644
- $(y) && (y = y.value ?? y.key), y.comment ? y.comment += `
2645
- ` + T : y.comment = T, A.comment = A.comment.substring(T.length + 1);
2639
+ L(y) && (y = y.value ?? y.key), y.comment ? y.comment += `
2640
+ ` + E : y.comment = E, A.comment = A.comment.substring(E.length + 1);
2646
2641
  }
2647
2642
  }
2648
2643
  if (!o && !S && !A.found) {
2649
- const T = N ? s(t, N, A, i) : e(t, A.end, S, null, A, i);
2650
- c.items.push(T), f = T.range[2], Ye(N) && i(T.range, "BLOCK_IN_FLOW", Je);
2644
+ const E = N ? s(t, N, A, i) : e(t, A.end, S, null, A, i);
2645
+ c.items.push(E), u = E.range[2], Ge(N) && i(E.range, "BLOCK_IN_FLOW", Ye);
2651
2646
  } else {
2652
2647
  t.atKey = !0;
2653
- const T = A.end, y = k ? s(t, k, A, i) : e(t, T, w, null, A, i);
2654
- Ye(k) && i(y.range, "BLOCK_IN_FLOW", Je), t.atKey = !1;
2655
- const v = re(S ?? [], {
2656
- flow: l,
2648
+ const E = A.end, y = k ? s(t, k, A, i) : e(t, E, w, null, A, i);
2649
+ Ge(k) && i(y.range, "BLOCK_IN_FLOW", Ye), t.atKey = !1;
2650
+ const v = oe(S ?? [], {
2651
+ flow: a,
2657
2652
  indicator: "map-value-ind",
2658
2653
  next: N,
2659
2654
  offset: y.range[2],
@@ -2674,197 +2669,197 @@ function rn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2674
2669
  }
2675
2670
  A.start < v.found.offset - 1024 && i(v.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
2676
2671
  }
2677
- } else N && ("source" in N && N.source?.[0] === ":" ? i(N, "MISSING_CHAR", `Missing space after : in ${l}`) : i(v.start, "MISSING_CHAR", `Missing , or : between ${l} items`));
2678
- const R = N ? s(t, N, v, i) : v.found ? e(t, v.end, S, null, v, i) : null;
2679
- R ? Ye(N) && i(R.range, "BLOCK_IN_FLOW", Je) : v.comment && (y.comment ? y.comment += `
2672
+ } else N && ("source" in N && N.source?.[0] === ":" ? i(N, "MISSING_CHAR", `Missing space after : in ${a}`) : i(v.start, "MISSING_CHAR", `Missing , or : between ${a} items`));
2673
+ const q = N ? s(t, N, v, i) : v.found ? e(t, v.end, S, null, v, i) : null;
2674
+ q ? Ge(N) && i(q.range, "BLOCK_IN_FLOW", Ye) : v.comment && (y.comment ? y.comment += `
2680
2675
  ` + v.comment : y.comment = v.comment);
2681
- const X = new B(y, R);
2676
+ const X = new j(y, q);
2682
2677
  if (t.options.keepSourceTokens && (X.srcToken = b), o) {
2683
2678
  const C = c;
2684
- os(t, C.items, y) && i(T, "DUPLICATE_KEY", "Map keys must be unique"), C.items.push(X);
2679
+ us(t, C.items, y) && i(E, "DUPLICATE_KEY", "Map keys must be unique"), C.items.push(X);
2685
2680
  } else {
2686
- const C = new M(t.schema);
2681
+ const C = new B(t.schema);
2687
2682
  C.flow = !0, C.items.push(X);
2688
- const yt = (R ?? y).range;
2689
- C.range = [y.range[0], yt[1], yt[2]], c.items.push(C);
2683
+ const wt = (q ?? y).range;
2684
+ C.range = [y.range[0], wt[1], wt[2]], c.items.push(C);
2690
2685
  }
2691
- f = R ? R.range[2] : v.end;
2686
+ u = q ? q.range[2] : v.end;
2692
2687
  }
2693
2688
  }
2694
- const u = o ? "}" : "]", [m, ...g] = n.end;
2695
- let h = f;
2696
- if (m?.source === u)
2697
- h = m.offset + m.source.length;
2689
+ const f = o ? "}" : "]", [p, ...g] = n.end;
2690
+ let h = u;
2691
+ if (p?.source === f)
2692
+ h = p.offset + p.source.length;
2698
2693
  else {
2699
- const p = l[0].toUpperCase() + l.substring(1), b = d ? `${p} must end with a ${u}` : `${p} in block collection must be sufficiently indented and end with a ${u}`;
2700
- i(f, d ? "MISSING_CHAR" : "BAD_INDENT", b), m && m.source.length !== 1 && g.unshift(m);
2694
+ const m = a[0].toUpperCase() + a.substring(1), b = d ? `${m} must end with a ${f}` : `${m} in block collection must be sufficiently indented and end with a ${f}`;
2695
+ i(u, d ? "MISSING_CHAR" : "BAD_INDENT", b), p && p.source.length !== 1 && g.unshift(p);
2701
2696
  }
2702
2697
  if (g.length > 0) {
2703
- const p = ke(g, h, t.options.strict, i);
2704
- p.comment && (c.comment ? c.comment += `
2705
- ` + p.comment : c.comment = p.comment), c.range = [n.offset, h, p.offset];
2698
+ const m = Se(g, h, t.options.strict, i);
2699
+ m.comment && (c.comment ? c.comment += `
2700
+ ` + m.comment : c.comment = m.comment), c.range = [n.offset, h, m.offset];
2706
2701
  } else
2707
2702
  c.range = [n.offset, h, h];
2708
2703
  return c;
2709
2704
  }
2710
- function Ge(s, e, t, n, i, r) {
2711
- const o = t.type === "block-map" ? sn(s, e, t, n, r) : t.type === "block-seq" ? nn(s, e, t, n, r) : rn(s, e, t, n, r), l = o.constructor;
2712
- return i === "!" || i === l.tagName ? (o.tag = l.tagName, o) : (i && (o.tag = i), o);
2705
+ function We(s, e, t, n, i, r) {
2706
+ const o = t.type === "block-map" ? un(s, e, t, n, r) : t.type === "block-seq" ? hn(s, e, t, n, r) : dn(s, e, t, n, r), a = o.constructor;
2707
+ return i === "!" || i === a.tagName ? (o.tag = a.tagName, o) : (i && (o.tag = i), o);
2713
2708
  }
2714
- function on(s, e, t, n, i) {
2715
- const r = n.tag, o = r ? e.directives.tagName(r.source, (u) => i(r, "TAG_RESOLVE_FAILED", u)) : null;
2709
+ function pn(s, e, t, n, i) {
2710
+ const r = n.tag, o = r ? e.directives.tagName(r.source, (f) => i(r, "TAG_RESOLVE_FAILED", f)) : null;
2716
2711
  if (t.type === "block-seq") {
2717
- const { anchor: u, newlineAfterProp: m } = n, g = u && r ? u.offset > r.offset ? u : r : u ?? r;
2718
- g && (!m || m.offset < g.offset) && i(g, "MISSING_CHAR", "Missing newline after block sequence props");
2719
- }
2720
- const l = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
2721
- if (!r || !o || o === "!" || o === M.tagName && l === "map" || o === W.tagName && l === "seq")
2722
- return Ge(s, e, t, i, o);
2723
- let a = e.schema.tags.find((u) => u.tag === o && u.collection === l);
2724
- if (!a) {
2725
- const u = e.schema.knownTags[o];
2726
- if (u?.collection === l)
2727
- e.schema.tags.push(Object.assign({}, u, { default: !1 })), a = u;
2712
+ const { anchor: f, newlineAfterProp: p } = n, g = f && r ? f.offset > r.offset ? f : r : f ?? r;
2713
+ g && (!p || p.offset < g.offset) && i(g, "MISSING_CHAR", "Missing newline after block sequence props");
2714
+ }
2715
+ const a = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
2716
+ if (!r || !o || o === "!" || o === B.tagName && a === "map" || o === H.tagName && a === "seq")
2717
+ return We(s, e, t, i, o);
2718
+ let l = e.schema.tags.find((f) => f.tag === o && f.collection === a);
2719
+ if (!l) {
2720
+ const f = e.schema.knownTags[o];
2721
+ if (f?.collection === a)
2722
+ e.schema.tags.push(Object.assign({}, f, { default: !1 })), l = f;
2728
2723
  else
2729
- return u ? i(r, "BAD_COLLECTION_TYPE", `${u.tag} used for ${l} collection, but expects ${u.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), Ge(s, e, t, i, o);
2724
+ return f ? i(r, "BAD_COLLECTION_TYPE", `${f.tag} used for ${a} collection, but expects ${f.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), We(s, e, t, i, o);
2730
2725
  }
2731
- const c = Ge(s, e, t, i, o, a), d = a.resolve?.(c, (u) => i(r, "TAG_RESOLVE_FAILED", u), e.options) ?? c, f = L(d) ? d : new O(d);
2732
- return f.range = c.range, f.tag = o, a?.format && (f.format = a.format), f;
2726
+ const c = We(s, e, t, i, o, l), d = l.resolve?.(c, (f) => i(r, "TAG_RESOLVE_FAILED", f), e.options) ?? c, u = $(d) ? d : new O(d);
2727
+ return u.range = c.range, u.tag = o, l?.format && (u.format = l.format), u;
2733
2728
  }
2734
- function ln(s, e, t) {
2735
- const n = e.offset, i = an(e, s.options.strict, t);
2729
+ function mn(s, e, t) {
2730
+ const n = e.offset, i = gn(e, s.options.strict, t);
2736
2731
  if (!i)
2737
2732
  return { value: "", type: null, comment: "", range: [n, n, n] };
2738
- const r = i.mode === ">" ? O.BLOCK_FOLDED : O.BLOCK_LITERAL, o = e.source ? cn(e.source) : [];
2739
- let l = o.length;
2733
+ const r = i.mode === ">" ? O.BLOCK_FOLDED : O.BLOCK_LITERAL, o = e.source ? yn(e.source) : [];
2734
+ let a = o.length;
2740
2735
  for (let h = o.length - 1; h >= 0; --h) {
2741
- const p = o[h][1];
2742
- if (p === "" || p === "\r")
2743
- l = h;
2736
+ const m = o[h][1];
2737
+ if (m === "" || m === "\r")
2738
+ a = h;
2744
2739
  else
2745
2740
  break;
2746
2741
  }
2747
- if (l === 0) {
2742
+ if (a === 0) {
2748
2743
  const h = i.chomp === "+" && o.length > 0 ? `
2749
2744
  `.repeat(Math.max(1, o.length - 1)) : "";
2750
- let p = n + i.length;
2751
- return e.source && (p += e.source.length), { value: h, type: r, comment: i.comment, range: [n, p, p] };
2745
+ let m = n + i.length;
2746
+ return e.source && (m += e.source.length), { value: h, type: r, comment: i.comment, range: [n, m, m] };
2752
2747
  }
2753
- let a = e.indent + i.indent, c = e.offset + i.length, d = 0;
2754
- for (let h = 0; h < l; ++h) {
2755
- const [p, b] = o[h];
2748
+ let l = e.indent + i.indent, c = e.offset + i.length, d = 0;
2749
+ for (let h = 0; h < a; ++h) {
2750
+ const [m, b] = o[h];
2756
2751
  if (b === "" || b === "\r")
2757
- i.indent === 0 && p.length > a && (a = p.length);
2752
+ i.indent === 0 && m.length > l && (l = m.length);
2758
2753
  else {
2759
- p.length < a && t(c + p.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (a = p.length), d = h, a === 0 && !s.atRoot && t(c, "BAD_INDENT", "Block scalar values in collections must be indented");
2754
+ m.length < l && t(c + m.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (l = m.length), d = h, l === 0 && !s.atRoot && t(c, "BAD_INDENT", "Block scalar values in collections must be indented");
2760
2755
  break;
2761
2756
  }
2762
- c += p.length + b.length + 1;
2757
+ c += m.length + b.length + 1;
2763
2758
  }
2764
- for (let h = o.length - 1; h >= l; --h)
2765
- o[h][0].length > a && (l = h + 1);
2766
- let f = "", u = "", m = !1;
2759
+ for (let h = o.length - 1; h >= a; --h)
2760
+ o[h][0].length > l && (a = h + 1);
2761
+ let u = "", f = "", p = !1;
2767
2762
  for (let h = 0; h < d; ++h)
2768
- f += o[h][0].slice(a) + `
2763
+ u += o[h][0].slice(l) + `
2769
2764
  `;
2770
- for (let h = d; h < l; ++h) {
2771
- let [p, b] = o[h];
2772
- c += p.length + b.length + 1;
2765
+ for (let h = d; h < a; ++h) {
2766
+ let [m, b] = o[h];
2767
+ c += m.length + b.length + 1;
2773
2768
  const w = b[b.length - 1] === "\r";
2774
- if (w && (b = b.slice(0, -1)), b && p.length < a) {
2769
+ if (w && (b = b.slice(0, -1)), b && m.length < l) {
2775
2770
  const S = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
2776
- t(c - b.length - (w ? 2 : 1), "BAD_INDENT", S), p = "";
2771
+ t(c - b.length - (w ? 2 : 1), "BAD_INDENT", S), m = "";
2777
2772
  }
2778
- r === O.BLOCK_LITERAL ? (f += u + p.slice(a) + b, u = `
2779
- `) : p.length > a || b[0] === " " ? (u === " " ? u = `
2780
- ` : !m && u === `
2781
- ` && (u = `
2773
+ r === O.BLOCK_LITERAL ? (u += f + m.slice(l) + b, f = `
2774
+ `) : m.length > l || b[0] === " " ? (f === " " ? f = `
2775
+ ` : !p && f === `
2776
+ ` && (f = `
2782
2777
 
2783
- `), f += u + p.slice(a) + b, u = `
2784
- `, m = !0) : b === "" ? u === `
2785
- ` ? f += `
2786
- ` : u = `
2787
- ` : (f += u + b, u = " ", m = !1);
2778
+ `), u += f + m.slice(l) + b, f = `
2779
+ `, p = !0) : b === "" ? f === `
2780
+ ` ? u += `
2781
+ ` : f = `
2782
+ ` : (u += f + b, f = " ", p = !1);
2788
2783
  }
2789
2784
  switch (i.chomp) {
2790
2785
  case "-":
2791
2786
  break;
2792
2787
  case "+":
2793
- for (let h = l; h < o.length; ++h)
2794
- f += `
2795
- ` + o[h][0].slice(a);
2796
- f[f.length - 1] !== `
2797
- ` && (f += `
2788
+ for (let h = a; h < o.length; ++h)
2789
+ u += `
2790
+ ` + o[h][0].slice(l);
2791
+ u[u.length - 1] !== `
2792
+ ` && (u += `
2798
2793
  `);
2799
2794
  break;
2800
2795
  default:
2801
- f += `
2796
+ u += `
2802
2797
  `;
2803
2798
  }
2804
2799
  const g = n + i.length + e.source.length;
2805
- return { value: f, type: r, comment: i.comment, range: [n, g, g] };
2800
+ return { value: u, type: r, comment: i.comment, range: [n, g, g] };
2806
2801
  }
2807
- function an({ offset: s, props: e }, t, n) {
2802
+ function gn({ offset: s, props: e }, t, n) {
2808
2803
  if (e[0].type !== "block-scalar-header")
2809
2804
  return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
2810
2805
  const { source: i } = e[0], r = i[0];
2811
- let o = 0, l = "", a = -1;
2812
- for (let u = 1; u < i.length; ++u) {
2813
- const m = i[u];
2814
- if (!l && (m === "-" || m === "+"))
2815
- l = m;
2806
+ let o = 0, a = "", l = -1;
2807
+ for (let f = 1; f < i.length; ++f) {
2808
+ const p = i[f];
2809
+ if (!a && (p === "-" || p === "+"))
2810
+ a = p;
2816
2811
  else {
2817
- const g = Number(m);
2818
- !o && g ? o = g : a === -1 && (a = s + u);
2812
+ const g = Number(p);
2813
+ !o && g ? o = g : l === -1 && (l = s + f);
2819
2814
  }
2820
2815
  }
2821
- a !== -1 && n(a, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
2822
- let c = !1, d = "", f = i.length;
2823
- for (let u = 1; u < e.length; ++u) {
2824
- const m = e[u];
2825
- switch (m.type) {
2816
+ l !== -1 && n(l, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
2817
+ let c = !1, d = "", u = i.length;
2818
+ for (let f = 1; f < e.length; ++f) {
2819
+ const p = e[f];
2820
+ switch (p.type) {
2826
2821
  case "space":
2827
2822
  c = !0;
2828
2823
  // fallthrough
2829
2824
  case "newline":
2830
- f += m.source.length;
2825
+ u += p.source.length;
2831
2826
  break;
2832
2827
  case "comment":
2833
- t && !c && n(m, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"), f += m.source.length, d = m.source.substring(1);
2828
+ t && !c && n(p, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"), u += p.source.length, d = p.source.substring(1);
2834
2829
  break;
2835
2830
  case "error":
2836
- n(m, "UNEXPECTED_TOKEN", m.message), f += m.source.length;
2831
+ n(p, "UNEXPECTED_TOKEN", p.message), u += p.source.length;
2837
2832
  break;
2838
2833
  /* istanbul ignore next should not happen */
2839
2834
  default: {
2840
- const g = `Unexpected token in block scalar header: ${m.type}`;
2841
- n(m, "UNEXPECTED_TOKEN", g);
2842
- const h = m.source;
2843
- h && typeof h == "string" && (f += h.length);
2835
+ const g = `Unexpected token in block scalar header: ${p.type}`;
2836
+ n(p, "UNEXPECTED_TOKEN", g);
2837
+ const h = p.source;
2838
+ h && typeof h == "string" && (u += h.length);
2844
2839
  }
2845
2840
  }
2846
2841
  }
2847
- return { mode: r, indent: o, chomp: l, comment: d, length: f };
2842
+ return { mode: r, indent: o, chomp: a, comment: d, length: u };
2848
2843
  }
2849
- function cn(s) {
2844
+ function yn(s) {
2850
2845
  const e = s.split(/\n( *)/), t = e[0], n = t.match(/^( *)/), r = [n?.[1] ? [n[1], t.slice(n[1].length)] : ["", t]];
2851
2846
  for (let o = 1; o < e.length; o += 2)
2852
2847
  r.push([e[o], e[o + 1]]);
2853
2848
  return r;
2854
2849
  }
2855
- function fn(s, e, t) {
2850
+ function bn(s, e, t) {
2856
2851
  const { offset: n, type: i, source: r, end: o } = s;
2857
- let l, a;
2858
- const c = (u, m, g) => t(n + u, m, g);
2852
+ let a, l;
2853
+ const c = (f, p, g) => t(n + f, p, g);
2859
2854
  switch (i) {
2860
2855
  case "scalar":
2861
- l = O.PLAIN, a = un(r, c);
2856
+ a = O.PLAIN, l = wn(r, c);
2862
2857
  break;
2863
2858
  case "single-quoted-scalar":
2864
- l = O.QUOTE_SINGLE, a = hn(r, c);
2859
+ a = O.QUOTE_SINGLE, l = kn(r, c);
2865
2860
  break;
2866
2861
  case "double-quoted-scalar":
2867
- l = O.QUOTE_DOUBLE, a = dn(r, c);
2862
+ a = O.QUOTE_DOUBLE, l = Sn(r, c);
2868
2863
  break;
2869
2864
  /* istanbul ignore next should not happen */
2870
2865
  default:
@@ -2875,15 +2870,15 @@ function fn(s, e, t) {
2875
2870
  range: [n, n + r.length, n + r.length]
2876
2871
  };
2877
2872
  }
2878
- const d = n + r.length, f = ke(o, d, e, t);
2873
+ const d = n + r.length, u = Se(o, d, e, t);
2879
2874
  return {
2880
- value: a,
2881
- type: l,
2882
- comment: f.comment,
2883
- range: [n, d, f.offset]
2875
+ value: l,
2876
+ type: a,
2877
+ comment: u.comment,
2878
+ range: [n, d, u.offset]
2884
2879
  };
2885
2880
  }
2886
- function un(s, e) {
2881
+ function wn(s, e) {
2887
2882
  let t = "";
2888
2883
  switch (s[0]) {
2889
2884
  /* istanbul ignore next should not happen */
@@ -2907,12 +2902,12 @@ function un(s, e) {
2907
2902
  break;
2908
2903
  }
2909
2904
  }
2910
- return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), ls(s);
2905
+ return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), hs(s);
2911
2906
  }
2912
- function hn(s, e) {
2913
- return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), ls(s.slice(1, -1)).replace(/''/g, "'");
2907
+ function kn(s, e) {
2908
+ return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), hs(s.slice(1, -1)).replace(/''/g, "'");
2914
2909
  }
2915
- function ls(s) {
2910
+ function hs(s) {
2916
2911
  let e, t;
2917
2912
  try {
2918
2913
  e = new RegExp(`(.*?)(?<![ ])[ ]*\r?
@@ -2929,10 +2924,10 @@ function ls(s) {
2929
2924
  n[1] === "" ? r === `
2930
2925
  ` ? i += r : r = `
2931
2926
  ` : (i += r + n[1], r = " "), o = t.lastIndex;
2932
- const l = /[ \t]*(.*)/sy;
2933
- return l.lastIndex = o, n = l.exec(s), i + r + (n?.[1] ?? "");
2927
+ const a = /[ \t]*(.*)/sy;
2928
+ return a.lastIndex = o, n = a.exec(s), i + r + (n?.[1] ?? "");
2934
2929
  }
2935
- function dn(s, e) {
2930
+ function Sn(s, e) {
2936
2931
  let t = "";
2937
2932
  for (let n = 1; n < s.length - 1; ++n) {
2938
2933
  const i = s[n];
@@ -2940,11 +2935,11 @@ function dn(s, e) {
2940
2935
  `))
2941
2936
  if (i === `
2942
2937
  `) {
2943
- const { fold: r, offset: o } = pn(s, n);
2938
+ const { fold: r, offset: o } = Nn(s, n);
2944
2939
  t += r, n = o;
2945
2940
  } else if (i === "\\") {
2946
2941
  let r = s[++n];
2947
- const o = mn[r];
2942
+ const o = On[r];
2948
2943
  if (o)
2949
2944
  t += o;
2950
2945
  else if (r === `
@@ -2956,11 +2951,11 @@ function dn(s, e) {
2956
2951
  for (r = s[++n + 1]; r === " " || r === " "; )
2957
2952
  r = s[++n + 1];
2958
2953
  else if (r === "x" || r === "u" || r === "U") {
2959
- const l = { x: 2, u: 4, U: 8 }[r];
2960
- t += gn(s, n + 1, l, e), n += l;
2954
+ const a = { x: 2, u: 4, U: 8 }[r];
2955
+ t += An(s, n + 1, a, e), n += a;
2961
2956
  } else {
2962
- const l = s.substr(n - 1, 2);
2963
- e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), t += l;
2957
+ const a = s.substr(n - 1, 2);
2958
+ e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${a}`), t += a;
2964
2959
  }
2965
2960
  } else if (i === " " || i === " ") {
2966
2961
  const r = n;
@@ -2975,7 +2970,7 @@ function dn(s, e) {
2975
2970
  }
2976
2971
  return (s[s.length - 1] !== '"' || s.length === 1) && e(s.length, "MISSING_CHAR", 'Missing closing "quote'), t;
2977
2972
  }
2978
- function pn(s, e) {
2973
+ function Nn(s, e) {
2979
2974
  let t = "", n = s[e + 1];
2980
2975
  for (; (n === " " || n === " " || n === `
2981
2976
  ` || n === "\r") && !(n === "\r" && s[e + 2] !== `
@@ -2985,7 +2980,7 @@ function pn(s, e) {
2985
2980
  `), e += 1, n = s[e + 1];
2986
2981
  return t || (t = " "), { fold: t, offset: e };
2987
2982
  }
2988
- const mn = {
2983
+ const On = {
2989
2984
  0: "\0",
2990
2985
  // null character
2991
2986
  a: "\x07",
@@ -3019,56 +3014,56 @@ const mn = {
3019
3014
  "\\": "\\",
3020
3015
  " ": " "
3021
3016
  };
3022
- function gn(s, e, t, n) {
3017
+ function An(s, e, t, n) {
3023
3018
  const i = s.substr(e, t), o = i.length === t && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
3024
3019
  if (isNaN(o)) {
3025
- const l = s.substr(e - 2, t + 2);
3026
- return n(e - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), l;
3020
+ const a = s.substr(e - 2, t + 2);
3021
+ return n(e - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${a}`), a;
3027
3022
  }
3028
3023
  return String.fromCodePoint(o);
3029
3024
  }
3030
- function as(s, e, t, n) {
3031
- const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ? ln(s, e, n) : fn(e, s.options.strict, n), a = t ? s.directives.tagName(t.source, (f) => n(t, "TAG_RESOLVE_FAILED", f)) : null;
3025
+ function ds(s, e, t, n) {
3026
+ const { value: i, type: r, comment: o, range: a } = e.type === "block-scalar" ? mn(s, e, n) : bn(e, s.options.strict, n), l = t ? s.directives.tagName(t.source, (u) => n(t, "TAG_RESOLVE_FAILED", u)) : null;
3032
3027
  let c;
3033
- s.options.stringKeys && s.atKey ? c = s.schema[q] : a ? c = yn(s.schema, i, a, t, n) : e.type === "scalar" ? c = bn(s, i, e, n) : c = s.schema[q];
3028
+ s.options.stringKeys && s.atKey ? c = s.schema[U] : l ? c = En(s.schema, i, l, t, n) : e.type === "scalar" ? c = Tn(s, i, e, n) : c = s.schema[U];
3034
3029
  let d;
3035
3030
  try {
3036
- const f = c.resolve(i, (u) => n(t ?? e, "TAG_RESOLVE_FAILED", u), s.options);
3037
- d = E(f) ? f : new O(f);
3038
- } catch (f) {
3039
- const u = f instanceof Error ? f.message : String(f);
3040
- n(t ?? e, "TAG_RESOLVE_FAILED", u), d = new O(i);
3031
+ const u = c.resolve(i, (f) => n(t ?? e, "TAG_RESOLVE_FAILED", f), s.options);
3032
+ d = T(u) ? u : new O(u);
3033
+ } catch (u) {
3034
+ const f = u instanceof Error ? u.message : String(u);
3035
+ n(t ?? e, "TAG_RESOLVE_FAILED", f), d = new O(i);
3041
3036
  }
3042
- return d.range = l, d.source = i, r && (d.type = r), a && (d.tag = a), c.format && (d.format = c.format), o && (d.comment = o), d;
3037
+ return d.range = a, d.source = i, r && (d.type = r), l && (d.tag = l), c.format && (d.format = c.format), o && (d.comment = o), d;
3043
3038
  }
3044
- function yn(s, e, t, n, i) {
3039
+ function En(s, e, t, n, i) {
3045
3040
  if (t === "!")
3046
- return s[q];
3041
+ return s[U];
3047
3042
  const r = [];
3048
- for (const l of s.tags)
3049
- if (!l.collection && l.tag === t)
3050
- if (l.default && l.test)
3051
- r.push(l);
3043
+ for (const a of s.tags)
3044
+ if (!a.collection && a.tag === t)
3045
+ if (a.default && a.test)
3046
+ r.push(a);
3052
3047
  else
3053
- return l;
3054
- for (const l of r)
3055
- if (l.test?.test(e))
3056
- return l;
3048
+ return a;
3049
+ for (const a of r)
3050
+ if (a.test?.test(e))
3051
+ return a;
3057
3052
  const o = s.knownTags[t];
3058
- return o && !o.collection ? (s.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(n, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), s[q]);
3053
+ return o && !o.collection ? (s.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(n, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), s[U]);
3059
3054
  }
3060
- function bn({ atKey: s, directives: e, schema: t }, n, i, r) {
3061
- const o = t.tags.find((l) => (l.default === !0 || s && l.default === "key") && l.test?.test(n)) || t[q];
3055
+ function Tn({ atKey: s, directives: e, schema: t }, n, i, r) {
3056
+ const o = t.tags.find((a) => (a.default === !0 || s && a.default === "key") && a.test?.test(n)) || t[U];
3062
3057
  if (t.compat) {
3063
- const l = t.compat.find((a) => a.default && a.test?.test(n)) ?? t[q];
3064
- if (o.tag !== l.tag) {
3065
- const a = e.tagString(o.tag), c = e.tagString(l.tag), d = `Value may be parsed as either ${a} or ${c}`;
3058
+ const a = t.compat.find((l) => l.default && l.test?.test(n)) ?? t[U];
3059
+ if (o.tag !== a.tag) {
3060
+ const l = e.tagString(o.tag), c = e.tagString(a.tag), d = `Value may be parsed as either ${l} or ${c}`;
3066
3061
  r(i, "TAG_RESOLVE_FAILED", d, !0);
3067
3062
  }
3068
3063
  }
3069
3064
  return o;
3070
3065
  }
3071
- function wn(s, e, t) {
3066
+ function In(s, e, t) {
3072
3067
  if (e) {
3073
3068
  t ?? (t = e.length);
3074
3069
  for (let n = t - 1; n >= 0; --n) {
@@ -3087,55 +3082,55 @@ function wn(s, e, t) {
3087
3082
  }
3088
3083
  return s;
3089
3084
  }
3090
- const kn = { composeNode: cs, composeEmptyNode: gt };
3091
- function cs(s, e, t, n) {
3092
- const i = s.atKey, { spaceBefore: r, comment: o, anchor: l, tag: a } = t;
3085
+ const $n = { composeNode: ps, composeEmptyNode: bt };
3086
+ function ps(s, e, t, n) {
3087
+ const i = s.atKey, { spaceBefore: r, comment: o, anchor: a, tag: l } = t;
3093
3088
  let c, d = !0;
3094
3089
  switch (e.type) {
3095
3090
  case "alias":
3096
- c = Sn(s, e, n), (l || a) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
3091
+ c = Ln(s, e, n), (a || l) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
3097
3092
  break;
3098
3093
  case "scalar":
3099
3094
  case "single-quoted-scalar":
3100
3095
  case "double-quoted-scalar":
3101
3096
  case "block-scalar":
3102
- c = as(s, e, a, n), l && (c.anchor = l.source.substring(1));
3097
+ c = ds(s, e, l, n), a && (c.anchor = a.source.substring(1));
3103
3098
  break;
3104
3099
  case "block-map":
3105
3100
  case "block-seq":
3106
3101
  case "flow-collection":
3107
- c = on(kn, s, e, t, n), l && (c.anchor = l.source.substring(1));
3102
+ c = pn($n, s, e, t, n), a && (c.anchor = a.source.substring(1));
3108
3103
  break;
3109
3104
  default: {
3110
- const f = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
3111
- n(e, "UNEXPECTED_TOKEN", f), c = gt(s, e.offset, void 0, null, t, n), d = !1;
3105
+ const u = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
3106
+ n(e, "UNEXPECTED_TOKEN", u), c = bt(s, e.offset, void 0, null, t, n), d = !1;
3112
3107
  }
3113
3108
  }
3114
- return l && c.anchor === "" && n(l, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!E(c) || typeof c.value != "string" || c.tag && c.tag !== "tag:yaml.org,2002:str") && n(a ?? e, "NON_STRING_KEY", "With stringKeys, all keys must be strings"), r && (c.spaceBefore = !0), o && (e.type === "scalar" && e.source === "" ? c.comment = o : c.commentBefore = o), s.options.keepSourceTokens && d && (c.srcToken = e), c;
3109
+ return a && c.anchor === "" && n(a, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!T(c) || typeof c.value != "string" || c.tag && c.tag !== "tag:yaml.org,2002:str") && n(l ?? e, "NON_STRING_KEY", "With stringKeys, all keys must be strings"), r && (c.spaceBefore = !0), o && (e.type === "scalar" && e.source === "" ? c.comment = o : c.commentBefore = o), s.options.keepSourceTokens && d && (c.srcToken = e), c;
3115
3110
  }
3116
- function gt(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: l, end: a }, c) {
3111
+ function bt(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: a, end: l }, c) {
3117
3112
  const d = {
3118
3113
  type: "scalar",
3119
- offset: wn(e, t, n),
3114
+ offset: In(e, t, n),
3120
3115
  indent: -1,
3121
3116
  source: ""
3122
- }, f = as(s, d, l, c);
3123
- return o && (f.anchor = o.source.substring(1), f.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (f.spaceBefore = !0), r && (f.comment = r, f.range[2] = a), f;
3117
+ }, u = ds(s, d, a, c);
3118
+ return o && (u.anchor = o.source.substring(1), u.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (u.spaceBefore = !0), r && (u.comment = r, u.range[2] = l), u;
3124
3119
  }
3125
- function Sn({ options: s }, { offset: e, source: t, end: n }, i) {
3126
- const r = new it(t.substring(1));
3120
+ function Ln({ options: s }, { offset: e, source: t, end: n }, i) {
3121
+ const r = new ot(t.substring(1));
3127
3122
  r.source === "" && i(e, "BAD_ALIAS", "Alias cannot be an empty string"), r.source.endsWith(":") && i(e + t.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
3128
- const o = e + t.length, l = ke(n, o, s.strict, i);
3129
- return r.range = [e, o, l.offset], l.comment && (r.comment = l.comment), r;
3123
+ const o = e + t.length, a = Se(n, o, s.strict, i);
3124
+ return r.range = [e, o, a.offset], a.comment && (r.comment = a.comment), r;
3130
3125
  }
3131
- function Nn(s, e, { offset: t, start: n, value: i, end: r }, o) {
3132
- const l = Object.assign({ _directives: e }, s), a = new Ue(void 0, l), c = {
3126
+ function vn(s, e, { offset: t, start: n, value: i, end: r }, o) {
3127
+ const a = Object.assign({ _directives: e }, s), l = new qe(void 0, a), c = {
3133
3128
  atKey: !1,
3134
3129
  atRoot: !0,
3135
- directives: a.directives,
3136
- options: a.options,
3137
- schema: a.schema
3138
- }, d = re(n, {
3130
+ directives: l.directives,
3131
+ options: l.options,
3132
+ schema: l.schema
3133
+ }, d = oe(n, {
3139
3134
  indicator: "doc-start",
3140
3135
  next: i ?? r?.[0],
3141
3136
  offset: t,
@@ -3143,11 +3138,11 @@ function Nn(s, e, { offset: t, start: n, value: i, end: r }, o) {
3143
3138
  parentIndent: 0,
3144
3139
  startOnNewline: !0
3145
3140
  });
3146
- d.found && (a.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !d.hasNewline && o(d.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), a.contents = i ? cs(c, i, d, o) : gt(c, d.end, n, null, d, o);
3147
- const f = a.contents.range[2], u = ke(r, f, !1, o);
3148
- return u.comment && (a.comment = u.comment), a.range = [t, f, u.offset], a;
3141
+ d.found && (l.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !d.hasNewline && o(d.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), l.contents = i ? ps(c, i, d, o) : bt(c, d.end, n, null, d, o);
3142
+ const u = l.contents.range[2], f = Se(r, u, !1, o);
3143
+ return f.comment && (l.comment = f.comment), l.range = [t, u, f.offset], l;
3149
3144
  }
3150
- function fe(s) {
3145
+ function ue(s) {
3151
3146
  if (typeof s == "number")
3152
3147
  return [s, s + 1];
3153
3148
  if (Array.isArray(s))
@@ -3155,7 +3150,7 @@ function fe(s) {
3155
3150
  const { offset: e, source: t } = s;
3156
3151
  return [e, e + (typeof t == "string" ? t.length : 1)];
3157
3152
  }
3158
- function Et(s) {
3153
+ function $t(s) {
3159
3154
  let e = "", t = !1, n = !1;
3160
3155
  for (let i = 0; i < s.length; ++i) {
3161
3156
  const r = s[i];
@@ -3175,15 +3170,15 @@ function Et(s) {
3175
3170
  }
3176
3171
  return { comment: e, afterEmptyLine: n };
3177
3172
  }
3178
- class On {
3173
+ class Cn {
3179
3174
  constructor(e = {}) {
3180
3175
  this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
3181
- const o = fe(t);
3182
- r ? this.warnings.push(new tn(o, n, i)) : this.errors.push(new he(o, n, i));
3176
+ const o = ue(t);
3177
+ r ? this.warnings.push(new fn(o, n, i)) : this.errors.push(new de(o, n, i));
3183
3178
  }, this.directives = new _({ version: e.version || "1.2" }), this.options = e;
3184
3179
  }
3185
3180
  decorate(e, t) {
3186
- const { comment: n, afterEmptyLine: i } = Et(this.prelude);
3181
+ const { comment: n, afterEmptyLine: i } = $t(this.prelude);
3187
3182
  if (n) {
3188
3183
  const r = e.contents;
3189
3184
  if (t)
@@ -3193,10 +3188,10 @@ ${n}` : n;
3193
3188
  e.commentBefore = n;
3194
3189
  else if (I(r) && !r.flow && r.items.length > 0) {
3195
3190
  let o = r.items[0];
3196
- $(o) && (o = o.key);
3197
- const l = o.commentBefore;
3198
- o.commentBefore = l ? `${n}
3199
- ${l}` : n;
3191
+ L(o) && (o = o.key);
3192
+ const a = o.commentBefore;
3193
+ o.commentBefore = a ? `${n}
3194
+ ${a}` : n;
3200
3195
  } else {
3201
3196
  const o = r.commentBefore;
3202
3197
  r.commentBefore = o ? `${n}
@@ -3212,7 +3207,7 @@ ${o}` : n;
3212
3207
  */
3213
3208
  streamInfo() {
3214
3209
  return {
3215
- comment: Et(this.prelude).comment,
3210
+ comment: $t(this.prelude).comment,
3216
3211
  directives: this.directives,
3217
3212
  errors: this.errors,
3218
3213
  warnings: this.warnings
@@ -3234,12 +3229,12 @@ ${o}` : n;
3234
3229
  switch (e.type) {
3235
3230
  case "directive":
3236
3231
  this.directives.add(e.source, (t, n, i) => {
3237
- const r = fe(e);
3232
+ const r = ue(e);
3238
3233
  r[0] += t, this.onError(r, "BAD_DIRECTIVE", n, i);
3239
3234
  }), this.prelude.push(e.source), this.atDirectives = !0;
3240
3235
  break;
3241
3236
  case "document": {
3242
- const t = Nn(this.options, this.directives, e, this.onError);
3237
+ const t = vn(this.options, this.directives, e, this.onError);
3243
3238
  this.atDirectives && !t.directives.docStart && this.onError(e, "MISSING_CHAR", "Missing directives-end/doc-start indicator line"), this.decorate(t, !1), this.doc && (yield this.doc), this.doc = t, this.atDirectives = !1;
3244
3239
  break;
3245
3240
  }
@@ -3251,18 +3246,18 @@ ${o}` : n;
3251
3246
  this.prelude.push(e.source);
3252
3247
  break;
3253
3248
  case "error": {
3254
- const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new he(fe(e), "UNEXPECTED_TOKEN", t);
3249
+ const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new de(ue(e), "UNEXPECTED_TOKEN", t);
3255
3250
  this.atDirectives || !this.doc ? this.errors.push(n) : this.doc.errors.push(n);
3256
3251
  break;
3257
3252
  }
3258
3253
  case "doc-end": {
3259
3254
  if (!this.doc) {
3260
3255
  const n = "Unexpected doc-end without preceding document";
3261
- this.errors.push(new he(fe(e), "UNEXPECTED_TOKEN", n));
3256
+ this.errors.push(new de(ue(e), "UNEXPECTED_TOKEN", n));
3262
3257
  break;
3263
3258
  }
3264
3259
  this.doc.directives.docEnd = !0;
3265
- const t = ke(e.end, e.offset + e.source.length, this.doc.options.strict, this.onError);
3260
+ const t = Se(e.end, e.offset + e.source.length, this.doc.options.strict, this.onError);
3266
3261
  if (this.decorate(this.doc, !0), t.comment) {
3267
3262
  const n = this.doc.comment;
3268
3263
  this.doc.comment = n ? `${n}
@@ -3272,7 +3267,7 @@ ${t.comment}` : t.comment;
3272
3267
  break;
3273
3268
  }
3274
3269
  default:
3275
- this.errors.push(new he(fe(e), "UNEXPECTED_TOKEN", `Unsupported token ${e.type}`));
3270
+ this.errors.push(new de(ue(e), "UNEXPECTED_TOKEN", `Unsupported token ${e.type}`));
3276
3271
  }
3277
3272
  }
3278
3273
  /**
@@ -3285,21 +3280,21 @@ ${t.comment}` : t.comment;
3285
3280
  if (this.doc)
3286
3281
  this.decorate(this.doc, !0), yield this.doc, this.doc = null;
3287
3282
  else if (e) {
3288
- const n = Object.assign({ _directives: this.directives }, this.options), i = new Ue(void 0, n);
3283
+ const n = Object.assign({ _directives: this.directives }, this.options), i = new qe(void 0, n);
3289
3284
  this.atDirectives && this.onError(t, "MISSING_CHAR", "Missing directives-end indicator line"), i.range = [0, t, t], this.decorate(i, !1), yield i;
3290
3285
  }
3291
3286
  }
3292
3287
  }
3293
- const fs = "\uFEFF", us = "", hs = "", Ze = "";
3294
- function An(s) {
3288
+ const ms = "\uFEFF", gs = "", ys = "", et = "";
3289
+ function _n(s) {
3295
3290
  switch (s) {
3296
- case fs:
3291
+ case ms:
3297
3292
  return "byte-order-mark";
3298
- case us:
3293
+ case gs:
3299
3294
  return "doc-mode";
3300
- case hs:
3295
+ case ys:
3301
3296
  return "flow-error-end";
3302
- case Ze:
3297
+ case et:
3303
3298
  return "scalar";
3304
3299
  case "---":
3305
3300
  return "doc-start";
@@ -3365,9 +3360,9 @@ function K(s) {
3365
3360
  return !1;
3366
3361
  }
3367
3362
  }
3368
- const It = new Set("0123456789ABCDEFabcdef"), Tn = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), Ae = new Set(",[]{}"), En = new Set(` ,[]{}
3369
- \r `), He = (s) => !s || En.has(s);
3370
- class In {
3363
+ const Lt = new Set("0123456789ABCDEFabcdef"), jn = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), Ee = new Set(",[]{}"), Bn = new Set(` ,[]{}
3364
+ \r `), He = (s) => !s || Bn.has(s);
3365
+ class Mn {
3371
3366
  constructor() {
3372
3367
  this.atEnd = !1, this.blockScalarIndent = -1, this.blockScalarKeep = !1, this.buffer = "", this.flowKey = !1, this.flowLevel = 0, this.indentNext = 0, this.indentValue = 0, this.lineEndPos = null, this.next = null, this.pos = 0;
3373
3368
  }
@@ -3459,7 +3454,7 @@ class In {
3459
3454
  let e = this.getLine();
3460
3455
  if (e === null)
3461
3456
  return this.setNext("stream");
3462
- if (e[0] === fs && (yield* this.pushCount(1), e = e.substring(1)), e[0] === "%") {
3457
+ if (e[0] === ms && (yield* this.pushCount(1), e = e.substring(1)), e[0] === "%") {
3463
3458
  let t = e.length, n = e.indexOf("#");
3464
3459
  for (; n !== -1; ) {
3465
3460
  const r = e[n - 1];
@@ -3483,7 +3478,7 @@ class In {
3483
3478
  const t = yield* this.pushSpaces(!0);
3484
3479
  return yield* this.pushCount(e.length - t), yield* this.pushNewline(), "stream";
3485
3480
  }
3486
- return yield us, yield* this.parseLineStart();
3481
+ return yield gs, yield* this.parseLineStart();
3487
3482
  }
3488
3483
  *parseLineStart() {
3489
3484
  const e = this.charAt(0);
@@ -3547,7 +3542,7 @@ class In {
3547
3542
  if (i === null)
3548
3543
  return this.setNext("flow");
3549
3544
  if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) && K(i[3])) && !(n === this.indentNext - 1 && this.flowLevel === 1 && (i[0] === "]" || i[0] === "}")))
3550
- return this.flowLevel = 0, yield hs, yield* this.parseLineStart();
3545
+ return this.flowLevel = 0, yield ys, yield* this.parseLineStart();
3551
3546
  let r = 0;
3552
3547
  for (; i[r] === ","; )
3553
3548
  r += yield* this.pushCount(1), r += yield* this.pushSpaces(!0), this.flowKey = !1;
@@ -3678,16 +3673,16 @@ class In {
3678
3673
  do {
3679
3674
  let r = e - 1, o = this.buffer[r];
3680
3675
  o === "\r" && (o = this.buffer[--r]);
3681
- const l = r;
3676
+ const a = r;
3682
3677
  for (; o === " "; )
3683
3678
  o = this.buffer[--r];
3684
3679
  if (o === `
3685
- ` && r >= this.pos && r + 1 + t > l)
3680
+ ` && r >= this.pos && r + 1 + t > a)
3686
3681
  e = r;
3687
3682
  else
3688
3683
  break;
3689
3684
  } while (!0);
3690
- return yield Ze, yield* this.pushToIndex(e + 1, !0), yield* this.parseLineStart();
3685
+ return yield et, yield* this.pushToIndex(e + 1, !0), yield* this.parseLineStart();
3691
3686
  }
3692
3687
  *parsePlainScalar() {
3693
3688
  const e = this.flowLevel > 0;
@@ -3695,14 +3690,14 @@ class In {
3695
3690
  for (; i = this.buffer[++n]; )
3696
3691
  if (i === ":") {
3697
3692
  const r = this.buffer[n + 1];
3698
- if (K(r) || e && Ae.has(r))
3693
+ if (K(r) || e && Ee.has(r))
3699
3694
  break;
3700
3695
  t = n;
3701
3696
  } else if (K(i)) {
3702
3697
  let r = this.buffer[n + 1];
3703
3698
  if (i === "\r" && (r === `
3704
3699
  ` ? (n += 1, i = `
3705
- `, r = this.buffer[n + 1]) : t = n), r === "#" || e && Ae.has(r))
3700
+ `, r = this.buffer[n + 1]) : t = n), r === "#" || e && Ee.has(r))
3706
3701
  break;
3707
3702
  if (i === `
3708
3703
  `) {
@@ -3712,11 +3707,11 @@ class In {
3712
3707
  n = Math.max(n, o - 2);
3713
3708
  }
3714
3709
  } else {
3715
- if (e && Ae.has(i))
3710
+ if (e && Ee.has(i))
3716
3711
  break;
3717
3712
  t = n;
3718
3713
  }
3719
- return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield Ze, yield* this.pushToIndex(t + 1, !0), e ? "flow" : "doc");
3714
+ return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield et, yield* this.pushToIndex(t + 1, !0), e ? "flow" : "doc");
3720
3715
  }
3721
3716
  *pushCount(e) {
3722
3717
  return e > 0 ? (yield this.buffer.substr(this.pos, e), this.pos += e, e) : 0;
@@ -3737,7 +3732,7 @@ class In {
3737
3732
  // this is an error outside flow collections
3738
3733
  case ":": {
3739
3734
  const e = this.flowLevel > 0, t = this.charAt(1);
3740
- if (K(t) || e && Ae.has(t))
3735
+ if (K(t) || e && Ee.has(t))
3741
3736
  return e ? this.flowKey && (this.flowKey = !1) : this.indentNext = this.indentValue + 1, (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
3742
3737
  }
3743
3738
  }
@@ -3752,9 +3747,9 @@ class In {
3752
3747
  } else {
3753
3748
  let e = this.pos + 1, t = this.buffer[e];
3754
3749
  for (; t; )
3755
- if (Tn.has(t))
3750
+ if (jn.has(t))
3756
3751
  t = this.buffer[++e];
3757
- else if (t === "%" && It.has(this.buffer[e + 1]) && It.has(this.buffer[e + 2]))
3752
+ else if (t === "%" && Lt.has(this.buffer[e + 1]) && Lt.has(this.buffer[e + 2]))
3758
3753
  t = this.buffer[e += 3];
3759
3754
  else
3760
3755
  break;
@@ -3782,7 +3777,7 @@ class In {
3782
3777
  return yield* this.pushToIndex(t, !1);
3783
3778
  }
3784
3779
  }
3785
- class Ln {
3780
+ class Pn {
3786
3781
  constructor() {
3787
3782
  this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
3788
3783
  let t = 0, n = this.lineStarts.length;
@@ -3805,7 +3800,7 @@ function V(s, e) {
3805
3800
  return !0;
3806
3801
  return !1;
3807
3802
  }
3808
- function Lt(s) {
3803
+ function vt(s) {
3809
3804
  for (let e = 0; e < s.length; ++e)
3810
3805
  switch (s[e].type) {
3811
3806
  case "space":
@@ -3817,7 +3812,7 @@ function Lt(s) {
3817
3812
  }
3818
3813
  return -1;
3819
3814
  }
3820
- function ds(s) {
3815
+ function bs(s) {
3821
3816
  switch (s?.type) {
3822
3817
  case "alias":
3823
3818
  case "scalar":
@@ -3844,7 +3839,7 @@ function Te(s) {
3844
3839
  return [];
3845
3840
  }
3846
3841
  }
3847
- function z(s) {
3842
+ function Z(s) {
3848
3843
  if (s.length === 0)
3849
3844
  return [];
3850
3845
  let e = s.length;
@@ -3861,18 +3856,18 @@ function z(s) {
3861
3856
  ;
3862
3857
  return s.splice(e, s.length);
3863
3858
  }
3864
- function $t(s) {
3859
+ function Ct(s) {
3865
3860
  if (s.start.type === "flow-seq-start")
3866
3861
  for (const e of s.items)
3867
- e.sep && !e.value && !V(e.start, "explicit-key-ind") && !V(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, ds(e.value) ? e.value.end ? Array.prototype.push.apply(e.value.end, e.sep) : e.value.end = e.sep : Array.prototype.push.apply(e.start, e.sep), delete e.sep);
3862
+ e.sep && !e.value && !V(e.start, "explicit-key-ind") && !V(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, bs(e.value) ? e.value.end ? Array.prototype.push.apply(e.value.end, e.sep) : e.value.end = e.sep : Array.prototype.push.apply(e.start, e.sep), delete e.sep);
3868
3863
  }
3869
- class $n {
3864
+ class Kn {
3870
3865
  /**
3871
3866
  * @param onNewLine - If defined, called separately with the start position of
3872
3867
  * each new line (in `parse()`, including the start of input).
3873
3868
  */
3874
3869
  constructor(e) {
3875
- this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new In(), this.onNewLine = e;
3870
+ this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new Mn(), this.onNewLine = e;
3876
3871
  }
3877
3872
  /**
3878
3873
  * Parse `source` as a YAML stream.
@@ -3896,7 +3891,7 @@ class $n {
3896
3891
  this.atScalar = !1, yield* this.step(), this.offset += e.length;
3897
3892
  return;
3898
3893
  }
3899
- const t = An(e);
3894
+ const t = _n(e);
3900
3895
  if (t)
3901
3896
  if (t === "scalar")
3902
3897
  this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
@@ -3985,7 +3980,7 @@ class $n {
3985
3980
  yield t;
3986
3981
  else {
3987
3982
  const n = this.peek(1);
3988
- switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" && $t(t), n.type) {
3983
+ switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" && Ct(t), n.type) {
3989
3984
  case "document":
3990
3985
  n.value = t;
3991
3986
  break;
@@ -4021,7 +4016,7 @@ class $n {
4021
4016
  }
4022
4017
  if ((n.type === "document" || n.type === "block-map" || n.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
4023
4018
  const i = t.items[t.items.length - 1];
4024
- i && !i.sep && !i.value && i.start.length > 0 && Lt(i.start) === -1 && (t.indent === 0 || i.start.every((r) => r.type !== "comment" || r.indent < t.indent)) && (n.type === "document" ? n.end = i.start : n.items.push({ start: i.start }), t.items.splice(-1, 1));
4019
+ i && !i.sep && !i.value && i.start.length > 0 && vt(i.start) === -1 && (t.indent === 0 || i.start.every((r) => r.type !== "comment" || r.indent < t.indent)) && (n.type === "document" ? n.end = i.start : n.items.push({ start: i.start }), t.items.splice(-1, 1));
4025
4020
  }
4026
4021
  }
4027
4022
  }
@@ -4059,7 +4054,7 @@ class $n {
4059
4054
  return yield* this.lineEnd(e);
4060
4055
  switch (this.type) {
4061
4056
  case "doc-start": {
4062
- Lt(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
4057
+ vt(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
4063
4058
  return;
4064
4059
  }
4065
4060
  case "anchor":
@@ -4080,7 +4075,7 @@ class $n {
4080
4075
  }
4081
4076
  *scalar(e) {
4082
4077
  if (this.type === "map-value-ind") {
4083
- const t = Te(this.peek(2)), n = z(t);
4078
+ const t = Te(this.peek(2)), n = Z(t);
4084
4079
  let i;
4085
4080
  e.end ? (i = e.end, i.push(this.sourceToken), delete e.end) : i = [this.sourceToken];
4086
4081
  const r = {
@@ -4147,16 +4142,16 @@ class $n {
4147
4142
  let r = [];
4148
4143
  if (i && t.sep && !t.value) {
4149
4144
  const o = [];
4150
- for (let l = 0; l < t.sep.length; ++l) {
4151
- const a = t.sep[l];
4152
- switch (a.type) {
4145
+ for (let a = 0; a < t.sep.length; ++a) {
4146
+ const l = t.sep[a];
4147
+ switch (l.type) {
4153
4148
  case "newline":
4154
- o.push(l);
4149
+ o.push(a);
4155
4150
  break;
4156
4151
  case "space":
4157
4152
  break;
4158
4153
  case "comment":
4159
- a.indent > e.indent && (o.length = 0);
4154
+ l.indent > e.indent && (o.length = 0);
4160
4155
  break;
4161
4156
  default:
4162
4157
  o.length = 0;
@@ -4189,19 +4184,19 @@ class $n {
4189
4184
  indent: this.indent,
4190
4185
  items: [{ start: r, key: null, sep: [this.sourceToken] }]
4191
4186
  });
4192
- else if (ds(t.key) && !V(t.sep, "newline")) {
4193
- const o = z(t.start), l = t.key, a = t.sep;
4194
- a.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
4187
+ else if (bs(t.key) && !V(t.sep, "newline")) {
4188
+ const o = Z(t.start), a = t.key, l = t.sep;
4189
+ l.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
4195
4190
  type: "block-map",
4196
4191
  offset: this.offset,
4197
4192
  indent: this.indent,
4198
- items: [{ start: o, key: l, sep: a }]
4193
+ items: [{ start: o, key: a, sep: l }]
4199
4194
  });
4200
4195
  } else r.length > 0 ? t.sep = t.sep.concat(r, this.sourceToken) : t.sep.push(this.sourceToken);
4201
4196
  else if (V(t.start, "newline"))
4202
4197
  Object.assign(t, { key: null, sep: [this.sourceToken] });
4203
4198
  else {
4204
- const o = z(t.start);
4199
+ const o = Z(t.start);
4205
4200
  this.stack.push({
4206
4201
  type: "block-map",
4207
4202
  offset: this.offset,
@@ -4337,17 +4332,17 @@ class $n {
4337
4332
  if (n.type === "block-map" && (this.type === "map-value-ind" && n.indent === e.indent || this.type === "newline" && !n.items[n.items.length - 1].sep))
4338
4333
  yield* this.pop(), yield* this.step();
4339
4334
  else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
4340
- const i = Te(n), r = z(i);
4341
- $t(e);
4335
+ const i = Te(n), r = Z(i);
4336
+ Ct(e);
4342
4337
  const o = e.end.splice(1, e.end.length);
4343
4338
  o.push(this.sourceToken);
4344
- const l = {
4339
+ const a = {
4345
4340
  type: "block-map",
4346
4341
  offset: e.offset,
4347
4342
  indent: e.indent,
4348
4343
  items: [{ start: r, key: e, sep: o }]
4349
4344
  };
4350
- this.onKeyLine = !0, this.stack[this.stack.length - 1] = l;
4345
+ this.onKeyLine = !0, this.stack[this.stack.length - 1] = a;
4351
4346
  } else
4352
4347
  yield* this.lineEnd(e);
4353
4348
  }
@@ -4401,7 +4396,7 @@ class $n {
4401
4396
  };
4402
4397
  case "explicit-key-ind": {
4403
4398
  this.onKeyLine = !0;
4404
- const t = Te(e), n = z(t);
4399
+ const t = Te(e), n = Z(t);
4405
4400
  return n.push(this.sourceToken), {
4406
4401
  type: "block-map",
4407
4402
  offset: this.offset,
@@ -4411,7 +4406,7 @@ class $n {
4411
4406
  }
4412
4407
  case "map-value-ind": {
4413
4408
  this.onKeyLine = !0;
4414
- const t = Te(e), n = z(t);
4409
+ const t = Te(e), n = Z(t);
4415
4410
  return {
4416
4411
  type: "block-map",
4417
4412
  offset: this.offset,
@@ -4445,44 +4440,44 @@ class $n {
4445
4440
  }
4446
4441
  }
4447
4442
  }
4448
- function vn(s) {
4443
+ function Dn(s) {
4449
4444
  const e = s.prettyErrors !== !1;
4450
- return { lineCounter: s.lineCounter || e && new Ln() || null, prettyErrors: e };
4445
+ return { lineCounter: s.lineCounter || e && new Pn() || null, prettyErrors: e };
4451
4446
  }
4452
- function Cn(s, e = {}) {
4453
- const { lineCounter: t, prettyErrors: n } = vn(e), i = new $n(t?.addNewLine), r = new On(e);
4447
+ function Un(s, e = {}) {
4448
+ const { lineCounter: t, prettyErrors: n } = Dn(e), i = new Kn(t?.addNewLine), r = new Cn(e);
4454
4449
  let o = null;
4455
- for (const l of r.compose(i.parse(s), !0, s.length))
4450
+ for (const a of r.compose(i.parse(s), !0, s.length))
4456
4451
  if (!o)
4457
- o = l;
4452
+ o = a;
4458
4453
  else if (o.options.logLevel !== "silent") {
4459
- o.errors.push(new he(l.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
4454
+ o.errors.push(new de(a.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
4460
4455
  break;
4461
4456
  }
4462
- return n && t && (o.errors.forEach(At(s, t)), o.warnings.forEach(At(s, t))), o;
4457
+ return n && t && (o.errors.forEach(Tt(s, t)), o.warnings.forEach(Tt(s, t))), o;
4463
4458
  }
4464
- function _n(s, e, t) {
4459
+ function Fn(s, e, t) {
4465
4460
  let n;
4466
- const i = Cn(s, t);
4461
+ const i = Un(s, t);
4467
4462
  if (!i)
4468
4463
  return null;
4469
- if (i.warnings.forEach((r) => Ut(i.options.logLevel, r)), i.errors.length > 0) {
4464
+ if (i.warnings.forEach((r) => Yt(i.options.logLevel, r)), i.errors.length > 0) {
4470
4465
  if (i.options.logLevel !== "silent")
4471
4466
  throw i.errors[0];
4472
4467
  i.errors = [];
4473
4468
  }
4474
4469
  return i.toJS(Object.assign({ reviver: n }, t));
4475
4470
  }
4476
- function Bn(s) {
4477
- return bt.isAbsolute(s) ? s : bt.resolve(process.cwd(), s);
4471
+ function Rn(s) {
4472
+ return kt.isAbsolute(s) ? s : kt.resolve(process.cwd(), s);
4478
4473
  }
4479
- async function Mn(s) {
4474
+ async function qn(s) {
4480
4475
  if (!s)
4481
- return {};
4482
- const e = Bn(s), t = await et(e, "utf8");
4483
- return e.endsWith(".yaml") || e.endsWith(".yml") ? _n(t) ?? {} : JSON.parse(t);
4476
+ return { on: {} };
4477
+ const e = Rn(s), t = await tt(e, "utf8");
4478
+ return e.endsWith(".yaml") || e.endsWith(".yml") ? Fn(t) ?? { on: {} } : JSON.parse(t);
4484
4479
  }
4485
- function Pn(s) {
4480
+ function Vn(s) {
4486
4481
  return s.split(/\r?\n/u).map((e) => e.trim()).filter((e) => e.length > 0 && !e.startsWith("#")).reduce((e, t) => {
4487
4482
  const n = t.indexOf("=");
4488
4483
  if (n <= 0)
@@ -4491,143 +4486,278 @@ function Pn(s) {
4491
4486
  return e[i] = r, e;
4492
4487
  }, {});
4493
4488
  }
4494
- async function jn(s) {
4489
+ async function Jn(s) {
4495
4490
  const e = {};
4496
4491
  for (const [t, n] of Object.entries(process.env))
4497
4492
  typeof n == "string" && (e[t] = n);
4498
4493
  for (const t of s ?? []) {
4499
- const n = await et(t, "utf8");
4494
+ const n = await tt(t, "utf8");
4500
4495
  if (t.endsWith(".json")) {
4501
- const i = tt(JSON.parse(n));
4496
+ const i = nt(JSON.parse(n));
4502
4497
  for (const [r, o] of Object.entries(i))
4503
4498
  o != null && (e[r] = String(o));
4504
4499
  continue;
4505
4500
  }
4506
- Object.assign(e, Pn(n));
4501
+ Object.assign(e, Vn(n));
4507
4502
  }
4508
4503
  return e;
4509
4504
  }
4510
- const Kn = `on - daemonized webhook runner
4505
+ const ws = await _t(st(Bt(), "workflow-reports"));
4506
+ async function Yn(s, e) {
4507
+ try {
4508
+ const t = st(ws, `${s.id}.json`);
4509
+ await Os(
4510
+ t,
4511
+ JSON.stringify({ ...s, outputs: e }, null, 2),
4512
+ "utf8"
4513
+ );
4514
+ } catch (t) {
4515
+ const n = t instanceof Error ? t.message : String(t);
4516
+ console.error("Error writing report:", n);
4517
+ }
4518
+ }
4519
+ async function Gn(s) {
4520
+ try {
4521
+ return await import(st(ws, `${s}.json`));
4522
+ } catch (e) {
4523
+ const t = e instanceof Error ? e.message : String(e);
4524
+ return console.error("Error reading report:", t), null;
4525
+ }
4526
+ }
4527
+ const Wn = "/workspace", Hn = "dhi.io/alpine-base:3.23-alpine3.23-dev";
4528
+ function Qn(s, e) {
4529
+ if (typeof s.run != "string")
4530
+ throw new Error("Each workflow step must have a 'run' command string.");
4531
+ const t = e.workflow.defaults || {};
4532
+ return s.image ||= t.image || Hn, s.volumes ||= t.volumes || {}, s.args ||= t.args || [], s.run = _e(s.run, { ...e, step: s }), s;
4533
+ }
4534
+ function Xn(s, e) {
4535
+ return (s || []).flatMap(
4536
+ (t) => Object.entries(t).flatMap(([n, i]) => [
4537
+ `--${n}`,
4538
+ _e(String(i), e)
4539
+ ])
4540
+ );
4541
+ }
4542
+ function xn(s, e) {
4543
+ return s["."] ||= Wn, Object.entries(s).flatMap(([t, n]) => [
4544
+ "-v",
4545
+ `${t === "." ? e.workingDir : t}:${n}`
4546
+ ]);
4547
+ }
4548
+ function zn(s) {
4549
+ const { workflow: e, secrets: t } = s, n = {
4550
+ ...process.env,
4551
+ ...Object.fromEntries(
4552
+ Object.entries(t).map(([i, r]) => [i, String(r)])
4553
+ ),
4554
+ PWD: s.workingDir
4555
+ };
4556
+ if (e.env) {
4557
+ if (typeof e.env != "object")
4558
+ throw new Error("Workflow env field must be an object.");
4559
+ for (const [i, r] of Object.entries(e.env))
4560
+ n[i] = _e(r, s);
4561
+ }
4562
+ Object.assign(s.env, n);
4563
+ }
4564
+ function Zn(s, e) {
4565
+ const t = Object.keys(s), n = Object.keys(e.on), i = n.find((a) => s[a]), r = i ? e.on[i] : null;
4566
+ if (!r)
4567
+ return console.log(
4568
+ `No workflow defined for event keys: ${t.join(", ")}, only accepting ${n.join(", ")}.`
4569
+ ), null;
4570
+ if (!r.steps || r.steps.length === 0)
4571
+ return console.warn(
4572
+ `Workflow for event ${s.source}:${s.event} has no steps defined, skipping.`
4573
+ ), null;
4574
+ const o = s[i];
4575
+ return {
4576
+ workflow: r,
4577
+ event: o
4578
+ };
4579
+ }
4580
+ async function ei(s, e) {
4581
+ typeof s == "string" && (s = { run: s });
4582
+ const t = Qn(s, e), { args: n, image: i, volumes: r } = t, o = xn(r, e), a = Xn(n, e), l = r["."], c = [
4583
+ "run",
4584
+ "-i",
4585
+ "--rm",
4586
+ ...o,
4587
+ ...a,
4588
+ "-w",
4589
+ l,
4590
+ "--entrypoint",
4591
+ "sh",
4592
+ i
4593
+ ];
4594
+ return new Promise((d, u) => {
4595
+ const f = jt("docker", c, {
4596
+ env: e.env
4597
+ }), p = [], g = [];
4598
+ f.stdout?.on("data", (h) => {
4599
+ p.push(h);
4600
+ }), f.stderr?.on("data", (h) => {
4601
+ g.push(h);
4602
+ }), f.once("error", u), f.once("exit", (h) => {
4603
+ const m = {
4604
+ code: h ?? 0,
4605
+ cmd: t.run,
4606
+ stdout: Buffer.concat(p).toString("utf-8"),
4607
+ stderr: Buffer.concat(g).toString("utf-8")
4608
+ };
4609
+ d(m);
4610
+ }), f.stdin?.write(t.run), f.stdin?.write(`
4611
+ exit $?;
4612
+ `), f.stdin?.end();
4613
+ });
4614
+ }
4615
+ async function ks(s, e, t) {
4616
+ const n = Is(), i = Zn(s, e);
4617
+ if (!i)
4618
+ return { id: n, parentId: t, outputs: [] };
4619
+ const { workflow: r, event: o } = i, a = Ls(o, r.mappings), l = await Jn(r.secrets), c = await _t(Ts(Bt(), "workflow")), d = Mt({
4620
+ inputs: a,
4621
+ secrets: l,
4622
+ workflow: r,
4623
+ env: {},
4624
+ outputs: [],
4625
+ workingDir: c
4626
+ });
4627
+ zn(d);
4628
+ const u = [];
4629
+ try {
4630
+ for (const f of r.steps ?? []) {
4631
+ const p = await ei(f, d);
4632
+ if (p.code !== 0)
4633
+ throw new Error(
4634
+ `Step failed with code ${p.code}.
4635
+ stdout: ${p.stdout}
4636
+ stderr: ${p.stderr}`
4637
+ );
4638
+ d.outputs.push(p);
4639
+ }
4640
+ for (const f of r.triggers ?? []) {
4641
+ const p = await ti(f, e, t);
4642
+ p && u.push(p.id);
4643
+ }
4644
+ } catch (f) {
4645
+ const p = f instanceof Error ? f.message : String(f);
4646
+ console.error(`Error processing event: ${p}`), console.debug(JSON.stringify(o));
4647
+ } finally {
4648
+ await As(d.workingDir, { recursive: !0, force: !0 });
4649
+ }
4650
+ return await Yn({ id: n, parentId: t, children: u }, d.outputs), { id: n, parentId: t, children: u, outputs: d.outputs };
4651
+ }
4652
+ async function ti(s, e, t) {
4653
+ if (!Es(s)) {
4654
+ console.warn(`Trigger file does not exist: ${s}`);
4655
+ return;
4656
+ }
4657
+ const n = await tt(s, "utf8"), i = nt(JSON.parse(n));
4658
+ return await ks(i, e, t);
4659
+ }
4660
+ async function si(s) {
4661
+ if (s.daemon) {
4662
+ const i = process.argv.slice(1).filter((a) => a !== "--daemon" && a !== "-d"), r = process.execArgv.concat(i), o = jt(process.execPath, r, {
4663
+ detached: !0,
4664
+ stdio: "ignore"
4665
+ });
4666
+ return console.log(o.pid), o.unref(), null;
4667
+ }
4668
+ const e = await qn(s.configPath), t = Ns(async (i, r) => {
4669
+ if (i.method === "GET" && i.url === "/health") {
4670
+ x(r, 200, { status: "OK" });
4671
+ return;
4672
+ }
4673
+ if (i.method === "GET" && i.url?.startsWith("/logs/")) {
4674
+ const o = i.url.split("/logs/")[1], a = await Gn(o);
4675
+ a ? x(r, 200, {
4676
+ exitCode: a.outputs.slice(-1)[0]?.code ?? null,
4677
+ stdout: a.outputs.map((l) => l.stdout),
4678
+ stderr: a.outputs.map((l) => l.stderr)
4679
+ }) : x(r, 404, { error: "Report not found." });
4680
+ return;
4681
+ }
4682
+ if (i.method !== "POST") {
4683
+ x(r, 405, { error: "Only POST webhooks are supported." });
4684
+ return;
4685
+ }
4686
+ try {
4687
+ const o = Buffer.concat(await i.toArray()).toString(), a = nt(JSON.parse(o || "{}")), l = await ks(a, e), c = (d) => new URL("/logs/" + d, `http://${i.headers.host}`);
4688
+ x(r, 202, {
4689
+ id: l.id,
4690
+ logUrl: c(l.id).href,
4691
+ parent: l.parentId ? {
4692
+ id: l.parentId,
4693
+ logUrl: l.parentId ? c(l.parentId).href : void 0
4694
+ } : null,
4695
+ children: l.children?.map((d) => ({
4696
+ id: d,
4697
+ logUrl: c(d).href
4698
+ })) || []
4699
+ });
4700
+ } catch (o) {
4701
+ const a = o instanceof Error ? o.message : "Unknown error";
4702
+ console.error("Error processing webhook:", o), x(r, 400, { error: a });
4703
+ }
4704
+ });
4705
+ await new Promise((i, r) => {
4706
+ t.once("error", r), t.listen(s.port, s.host, () => i());
4707
+ });
4708
+ const n = t.address();
4709
+ return n && typeof n == "object" && console.log(`Started on http://${n.address}:${n.port}`), t;
4710
+ }
4711
+ const ni = `on - daemonized webhook runner
4511
4712
 
4512
4713
  Usage:
4513
4714
  on --port <port> [--host <host>] [--config <path>]
4514
4715
 
4515
4716
  Options:
4717
+ --daemon Run as a background service
4516
4718
  --port, -p HTTP port for incoming webhooks (required)
4517
4719
  --host, -H Host binding for the HTTP server (default: 127.0.0.1)
4518
4720
  --config, -c Path to a YAML/JSON config file
4519
4721
  --help, -h Show this help message
4520
4722
  `;
4521
- async function Dn(s, e) {
4522
- await new Promise((t, n) => {
4523
- const i = ys(s, {
4524
- env: e,
4525
- shell: !0,
4526
- stdio: "inherit"
4527
- });
4528
- i.once("error", n), i.once("exit", (r) => {
4529
- if (r === 0) {
4530
- t();
4531
- return;
4532
- }
4533
- n(new Error(`Step failed with exit code ${r}: ${s}`));
4534
- });
4535
- });
4536
- }
4537
- async function ps(s, e) {
4538
- if (typeof s.source != "string" || typeof s.event != "string")
4539
- throw new Error(
4540
- "Incoming payload must include string fields 'source' and 'event'."
4541
- );
4542
- const t = e.on?.[s.source]?.[s.event];
4543
- if (!t)
4544
- throw new Error(
4545
- `No workflow configured for source '${s.source}' and event '${s.event}'.`
4546
- );
4547
- const n = Ss({ ...s }, t.mappings), i = await jn(t.secrets), r = {
4548
- ...process.env,
4549
- ...Object.fromEntries(
4550
- Object.entries(i).map(([l, a]) => [l, String(a)])
4551
- )
4552
- }, o = {
4553
- inputs: n,
4554
- secrets: i
4555
- };
4556
- for (const [l, a] of Object.entries(t.env ?? {}))
4557
- r[l] = ks(a, o);
4558
- t.defaults?.image && (r.ON_DEFAULT_IMAGE = t.defaults.image), t.defaults?.volumes && (r.ON_DEFAULT_VOLUMES = JSON.stringify(t.defaults.volumes)), t.defaults?.args && (r.ON_DEFAULT_ARGS = JSON.stringify(t.defaults.args));
4559
- for (const l of t.steps ?? [])
4560
- await Dn(l, r);
4561
- for (const l of t.dispatch ?? []) {
4562
- const a = await et(l, "utf8"), c = tt(JSON.parse(a));
4563
- await ps(c, e);
4564
- }
4565
- }
4566
- function qn(s) {
4567
- const { values: e } = gs({
4723
+ function ii(s) {
4724
+ const { values: e } = Ss({
4568
4725
  args: s,
4569
4726
  options: {
4570
4727
  port: { type: "string", short: "p" },
4571
4728
  host: { type: "string", short: "H", default: "127.0.0.1" },
4572
4729
  config: { type: "string", short: "c" },
4573
- help: { type: "boolean", short: "h", default: !1 }
4730
+ help: { type: "boolean", short: "h", default: !1 },
4731
+ daemon: { type: "boolean", short: "d", default: !1 }
4574
4732
  },
4575
4733
  allowPositionals: !1
4576
4734
  });
4577
4735
  if (e.help)
4578
- return console.log(Kn), null;
4736
+ return console.log(ni), null;
4579
4737
  if (!e.port)
4580
4738
  throw new Error("Missing required option --port.");
4581
4739
  return {
4582
- port: ws(e.port),
4740
+ port: $s(e.port),
4583
4741
  host: e.host,
4584
- configPath: e.config
4742
+ configPath: e.config,
4743
+ daemon: e.daemon
4585
4744
  };
4586
4745
  }
4587
- async function Un(s) {
4588
- const e = await Mn(s.configPath), t = ms(async (i, r) => {
4589
- if (i.method !== "POST") {
4590
- Fe(r, 405, { error: "Only POST webhooks are supported." });
4591
- return;
4592
- }
4593
- try {
4594
- const o = await bs(i), l = tt(
4595
- o.length > 0 ? JSON.parse(o) : {}
4596
- );
4597
- await ps(l, e), Fe(r, 202, {
4598
- status: "accepted",
4599
- source: l.source,
4600
- event: l.event
4601
- });
4602
- } catch (o) {
4603
- const l = o instanceof Error ? o.message : "Unknown error";
4604
- Fe(r, 400, { error: l });
4605
- }
4606
- });
4607
- await new Promise((i, r) => {
4608
- t.once("error", r), t.listen(s.port, s.host, () => i());
4609
- });
4610
- const n = t.address();
4611
- return n && typeof n == "object" && console.log(
4612
- `on daemon listening on http://${n.address}:${n.port}`
4613
- ), t;
4614
- }
4615
- async function Fn() {
4746
+ async function ri() {
4616
4747
  try {
4617
- const s = qn(process.argv.slice(2));
4748
+ const s = ii(process.argv.slice(2));
4618
4749
  if (!s) {
4619
4750
  process.exitCode = 0;
4620
4751
  return;
4621
4752
  }
4622
- await Un(s);
4753
+ await si(s);
4623
4754
  } catch (s) {
4624
4755
  const e = s instanceof Error ? s.message : String(s);
4625
4756
  console.error(`on: ${e}`), process.exitCode = 1;
4626
4757
  }
4627
4758
  }
4628
- Fn();
4759
+ ri();
4629
4760
  export {
4630
- Fn as main,
4631
- qn as parseCliOptions,
4632
- Un as startDaemon
4761
+ ri as main,
4762
+ ii as parseCliOptions
4633
4763
  };