@brightsideoy/kama 0.1.0-alpha.95 → 0.1.0-alpha.96

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.
package/dist/index.js CHANGED
@@ -142,13 +142,13 @@ function T(e) {
142
142
  }
143
143
  var E = (e) => (S(e) || w(e)) && !!e.anchor, D = Symbol("break visit"), O = Symbol("skip children"), k = Symbol("remove node");
144
144
  function A(e, t) {
145
- let n = ne(t);
145
+ let n = te(t);
146
146
  y(e) ? ee(null, e.contents, n, Object.freeze([e])) === k && (e.contents = null) : ee(null, e, n, Object.freeze([]));
147
147
  }
148
148
  A.BREAK = D, A.SKIP = O, A.REMOVE = k;
149
149
  function ee(e, t, n, r) {
150
- let i = re(e, t, n, r);
151
- if (T(i) || x(i)) return ie(e, r, i), ee(e, i, n, r);
150
+ let i = ne(e, t, n, r);
151
+ if (T(i) || x(i)) return re(e, r, i), ee(e, i, n, r);
152
152
  if (typeof i != "symbol") {
153
153
  if (w(t)) {
154
154
  r = Object.freeze(r.concat(t));
@@ -170,36 +170,36 @@ function ee(e, t, n, r) {
170
170
  }
171
171
  return i;
172
172
  }
173
- async function te(e, t) {
174
- let n = ne(t);
175
- y(e) ? await j(null, e.contents, n, Object.freeze([e])) === k && (e.contents = null) : await j(null, e, n, Object.freeze([]));
173
+ async function j(e, t) {
174
+ let n = te(t);
175
+ y(e) ? await M(null, e.contents, n, Object.freeze([e])) === k && (e.contents = null) : await M(null, e, n, Object.freeze([]));
176
176
  }
177
- te.BREAK = D, te.SKIP = O, te.REMOVE = k;
178
- async function j(e, t, n, r) {
179
- let i = await re(e, t, n, r);
180
- if (T(i) || x(i)) return ie(e, r, i), j(e, i, n, r);
177
+ j.BREAK = D, j.SKIP = O, j.REMOVE = k;
178
+ async function M(e, t, n, r) {
179
+ let i = await ne(e, t, n, r);
180
+ if (T(i) || x(i)) return re(e, r, i), M(e, i, n, r);
181
181
  if (typeof i != "symbol") {
182
182
  if (w(t)) {
183
183
  r = Object.freeze(r.concat(t));
184
184
  for (let e = 0; e < t.items.length; ++e) {
185
- let i = await j(e, t.items[e], n, r);
185
+ let i = await M(e, t.items[e], n, r);
186
186
  if (typeof i == "number") e = i - 1;
187
187
  else if (i === D) return D;
188
188
  else i === k && (t.items.splice(e, 1), --e);
189
189
  }
190
190
  } else if (x(t)) {
191
191
  r = Object.freeze(r.concat(t));
192
- let e = await j("key", t.key, n, r);
192
+ let e = await M("key", t.key, n, r);
193
193
  if (e === D) return D;
194
194
  e === k && (t.key = null);
195
- let i = await j("value", t.value, n, r);
195
+ let i = await M("value", t.value, n, r);
196
196
  if (i === D) return D;
197
197
  i === k && (t.value = null);
198
198
  }
199
199
  }
200
200
  return i;
201
201
  }
202
- function ne(e) {
202
+ function te(e) {
203
203
  return typeof e == "object" && (e.Collection || e.Node || e.Value) ? Object.assign({
204
204
  Alias: e.Node,
205
205
  Map: e.Node,
@@ -214,7 +214,7 @@ function ne(e) {
214
214
  Seq: e.Collection
215
215
  }, e) : e;
216
216
  }
217
- function re(e, t, n, r) {
217
+ function ne(e, t, n, r) {
218
218
  if (typeof n == "function") return n(e, t, r);
219
219
  if (b(t)) return n.Map?.(e, t, r);
220
220
  if (C(t)) return n.Seq?.(e, t, r);
@@ -222,7 +222,7 @@ function re(e, t, n, r) {
222
222
  if (S(t)) return n.Scalar?.(e, t, r);
223
223
  if (v(t)) return n.Alias?.(e, t, r);
224
224
  }
225
- function ie(e, t, n) {
225
+ function re(e, t, n) {
226
226
  let r = t[t.length - 1];
227
227
  if (w(r)) r.items[e] = n;
228
228
  else if (x(r)) e === "key" ? r.key = n : r.value = n;
@@ -234,14 +234,14 @@ function ie(e, t, n) {
234
234
  }
235
235
  //#endregion
236
236
  //#region node_modules/yaml/browser/dist/doc/directives.js
237
- var ae = {
237
+ var ie = {
238
238
  "!": "%21",
239
239
  ",": "%2C",
240
240
  "[": "%5B",
241
241
  "]": "%5D",
242
242
  "{": "%7B",
243
243
  "}": "%7D"
244
- }, M = (e) => e.replace(/[!,[\]{}]/g, (e) => ae[e]), N = class e {
244
+ }, N = (e) => e.replace(/[!,[\]{}]/g, (e) => ie[e]), P = class e {
245
245
  constructor(t, n) {
246
246
  this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, e.defaultYaml, t), this.tags = Object.assign({}, e.defaultTags, n);
247
247
  }
@@ -304,7 +304,7 @@ var ae = {
304
304
  return n === "!" ? e : (t(`Could not resolve tag: ${e}`), null);
305
305
  }
306
306
  tagString(e) {
307
- for (let [t, n] of Object.entries(this.tags)) if (e.startsWith(n)) return t + M(e.substring(n.length));
307
+ for (let [t, n] of Object.entries(this.tags)) if (e.startsWith(n)) return t + N(e.substring(n.length));
308
308
  return e[0] === "!" ? e : `!<${e}>`;
309
309
  }
310
310
  toString(e) {
@@ -319,37 +319,37 @@ var ae = {
319
319
  return t.join("\n");
320
320
  }
321
321
  };
322
- N.defaultYaml = {
322
+ P.defaultYaml = {
323
323
  explicit: !1,
324
324
  version: "1.2"
325
- }, N.defaultTags = { "!!": "tag:yaml.org,2002:" };
325
+ }, P.defaultTags = { "!!": "tag:yaml.org,2002:" };
326
326
  //#endregion
327
327
  //#region node_modules/yaml/browser/dist/doc/anchors.js
328
- function oe(e) {
328
+ function ae(e) {
329
329
  if (/[\x00-\x19\s,[\]{}]/.test(e)) {
330
330
  let t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;
331
331
  throw Error(t);
332
332
  }
333
333
  return !0;
334
334
  }
335
- function se(e) {
335
+ function oe(e) {
336
336
  let t = /* @__PURE__ */ new Set();
337
337
  return A(e, { Value(e, n) {
338
338
  n.anchor && t.add(n.anchor);
339
339
  } }), t;
340
340
  }
341
- function ce(e, t) {
341
+ function se(e, t) {
342
342
  for (let n = 1;; ++n) {
343
343
  let r = `${e}${n}`;
344
344
  if (!t.has(r)) return r;
345
345
  }
346
346
  }
347
- function le(e, t) {
347
+ function ce(e, t) {
348
348
  let n = [], r = /* @__PURE__ */ new Map(), i = null;
349
349
  return {
350
350
  onAnchor: (r) => {
351
- n.push(r), i ??= se(e);
352
- let a = ce(t, i);
351
+ n.push(r), i ??= oe(e);
352
+ let a = se(t, i);
353
353
  return i.add(a), a;
354
354
  },
355
355
  setAnchors: () => {
@@ -367,22 +367,22 @@ function le(e, t) {
367
367
  }
368
368
  //#endregion
369
369
  //#region node_modules/yaml/browser/dist/doc/applyReviver.js
370
- function P(e, t, n, r) {
370
+ function F(e, t, n, r) {
371
371
  if (r && typeof r == "object") {
372
372
  if (Array.isArray(r)) for (let t = 0, n = r.length; t < n; ++t) {
373
- let n = r[t], i = P(e, r, String(t), n);
373
+ let n = r[t], i = F(e, r, String(t), n);
374
374
  i === void 0 ? delete r[t] : i !== n && (r[t] = i);
375
375
  }
376
376
  else if (r instanceof Map) for (let t of Array.from(r.keys())) {
377
- let n = r.get(t), i = P(e, r, t, n);
377
+ let n = r.get(t), i = F(e, r, t, n);
378
378
  i === void 0 ? r.delete(t) : i !== n && r.set(t, i);
379
379
  }
380
380
  else if (r instanceof Set) for (let t of Array.from(r)) {
381
- let n = P(e, r, t, t);
381
+ let n = F(e, r, t, t);
382
382
  n === void 0 ? r.delete(t) : n !== t && (r.delete(t), r.add(n));
383
383
  }
384
384
  else for (let [t, n] of Object.entries(r)) {
385
- let i = P(e, r, t, n);
385
+ let i = F(e, r, t, n);
386
386
  i === void 0 ? delete r[t] : i !== n && (r[t] = i);
387
387
  }
388
388
  }
@@ -390,8 +390,8 @@ function P(e, t, n, r) {
390
390
  }
391
391
  //#endregion
392
392
  //#region node_modules/yaml/browser/dist/nodes/toJS.js
393
- function F(e, t, n) {
394
- if (Array.isArray(e)) return e.map((e, t) => F(e, String(t), n));
393
+ function I(e, t, n) {
394
+ if (Array.isArray(e)) return e.map((e, t) => I(e, String(t), n));
395
395
  if (e && typeof e.toJSON == "function") {
396
396
  if (!n || !E(e)) return e.toJSON(t, n);
397
397
  let r = {
@@ -409,7 +409,7 @@ function F(e, t, n) {
409
409
  }
410
410
  //#endregion
411
411
  //#region node_modules/yaml/browser/dist/nodes/Node.js
412
- var ue = class {
412
+ var le = class {
413
413
  constructor(e) {
414
414
  Object.defineProperty(this, _, { value: e });
415
415
  }
@@ -426,11 +426,11 @@ var ue = class {
426
426
  mapAsMap: t === !0,
427
427
  mapKeyWarned: !1,
428
428
  maxAliasCount: typeof n == "number" ? n : 100
429
- }, o = F(this, "", a);
429
+ }, o = I(this, "", a);
430
430
  if (typeof r == "function") for (let { count: e, res: t } of a.anchors.values()) r(t, e);
431
- return typeof i == "function" ? P(i, { "": o }, "", o) : o;
431
+ return typeof i == "function" ? F(i, { "": o }, "", o) : o;
432
432
  }
433
- }, de = class extends ue {
433
+ }, ue = class extends le {
434
434
  constructor(e) {
435
435
  super(d), this.source = e, Object.defineProperty(this, "tag", { set() {
436
436
  throw Error("Alias nodes cannot have tags");
@@ -458,14 +458,14 @@ var ue = class {
458
458
  }
459
459
  let o = n.get(a);
460
460
  /* istanbul ignore if */
461
- if (o ||= (F(a, null, t), n.get(a)), o?.res === void 0) throw ReferenceError("This should not happen: Alias anchor was not resolved?");
462
- if (i >= 0 && (o.count += 1, o.aliasCount === 0 && (o.aliasCount = fe(r, a, n)), o.count * o.aliasCount > i)) throw ReferenceError("Excessive alias count indicates a resource exhaustion attack");
461
+ if (o ||= (I(a, null, t), n.get(a)), o?.res === void 0) throw ReferenceError("This should not happen: Alias anchor was not resolved?");
462
+ if (i >= 0 && (o.count += 1, o.aliasCount === 0 && (o.aliasCount = de(r, a, n)), o.count * o.aliasCount > i)) throw ReferenceError("Excessive alias count indicates a resource exhaustion attack");
463
463
  return o.res;
464
464
  }
465
465
  toString(e, t, n) {
466
466
  let r = `*${this.source}`;
467
467
  if (e) {
468
- if (oe(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
468
+ if (ae(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
469
469
  let e = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
470
470
  throw Error(e);
471
471
  }
@@ -474,7 +474,7 @@ var ue = class {
474
474
  return r;
475
475
  }
476
476
  };
477
- function fe(e, t, n) {
477
+ function de(e, t, n) {
478
478
  if (v(t)) {
479
479
  let r = t.resolve(e), i = n && r && n.get(r);
480
480
  return i ? i.count * i.aliasCount : 0;
@@ -482,35 +482,35 @@ function fe(e, t, n) {
482
482
  if (w(t)) {
483
483
  let r = 0;
484
484
  for (let i of t.items) {
485
- let t = fe(e, i, n);
485
+ let t = de(e, i, n);
486
486
  t > r && (r = t);
487
487
  }
488
488
  return r;
489
489
  }
490
490
  if (x(t)) {
491
- let r = fe(e, t.key, n), i = fe(e, t.value, n);
491
+ let r = de(e, t.key, n), i = de(e, t.value, n);
492
492
  return Math.max(r, i);
493
493
  }
494
494
  return 1;
495
495
  }
496
496
  //#endregion
497
497
  //#region node_modules/yaml/browser/dist/nodes/Scalar.js
498
- var pe = (e) => !e || typeof e != "function" && typeof e != "object", I = class extends ue {
498
+ var fe = (e) => !e || typeof e != "function" && typeof e != "object", L = class extends le {
499
499
  constructor(e) {
500
500
  super(h), this.value = e;
501
501
  }
502
502
  toJSON(e, t) {
503
- return t?.keep ? this.value : F(this.value, e, t);
503
+ return t?.keep ? this.value : I(this.value, e, t);
504
504
  }
505
505
  toString() {
506
506
  return String(this.value);
507
507
  }
508
508
  };
509
- I.BLOCK_FOLDED = "BLOCK_FOLDED", I.BLOCK_LITERAL = "BLOCK_LITERAL", I.PLAIN = "PLAIN", I.QUOTE_DOUBLE = "QUOTE_DOUBLE", I.QUOTE_SINGLE = "QUOTE_SINGLE";
509
+ L.BLOCK_FOLDED = "BLOCK_FOLDED", L.BLOCK_LITERAL = "BLOCK_LITERAL", L.PLAIN = "PLAIN", L.QUOTE_DOUBLE = "QUOTE_DOUBLE", L.QUOTE_SINGLE = "QUOTE_SINGLE";
510
510
  //#endregion
511
511
  //#region node_modules/yaml/browser/dist/doc/createNode.js
512
- var L = "tag:yaml.org,2002:";
513
- function me(e, t, n) {
512
+ var R = "tag:yaml.org,2002:";
513
+ function pe(e, t, n) {
514
514
  if (t) {
515
515
  let e = n.filter((e) => e.tag === t), r = e.find((e) => !e.format) ?? e[0];
516
516
  if (!r) throw Error(`Tag ${t} not found`);
@@ -518,7 +518,7 @@ function me(e, t, n) {
518
518
  }
519
519
  return n.find((t) => t.identify?.(e) && !t.format);
520
520
  }
521
- function R(e, t, n) {
521
+ function z(e, t, n) {
522
522
  if (y(e) && (e = e.contents), T(e)) return e;
523
523
  if (x(e)) {
524
524
  let t = n.schema[p].createNode?.(n.schema, null, n);
@@ -527,28 +527,28 @@ function R(e, t, n) {
527
527
  (e instanceof String || e instanceof Number || e instanceof Boolean || typeof BigInt < "u" && e instanceof BigInt) && (e = e.valueOf());
528
528
  let { aliasDuplicateObjects: r, onAnchor: i, onTagObj: a, schema: o, sourceObjects: s } = n, c;
529
529
  if (r && e && typeof e == "object") {
530
- if (c = s.get(e), c) return c.anchor ?? (c.anchor = i(e)), new de(c.anchor);
530
+ if (c = s.get(e), c) return c.anchor ?? (c.anchor = i(e)), new ue(c.anchor);
531
531
  c = {
532
532
  anchor: null,
533
533
  node: null
534
534
  }, s.set(e, c);
535
535
  }
536
- t?.startsWith("!!") && (t = L + t.slice(2));
537
- let l = me(e, t, o.tags);
536
+ t?.startsWith("!!") && (t = R + t.slice(2));
537
+ let l = pe(e, t, o.tags);
538
538
  if (!l) {
539
539
  if (e && typeof e.toJSON == "function" && (e = e.toJSON()), !e || typeof e != "object") {
540
- let t = new I(e);
540
+ let t = new L(e);
541
541
  return c && (c.node = t), t;
542
542
  }
543
543
  l = e instanceof Map ? o[p] : Symbol.iterator in Object(e) ? o[g] : o[p];
544
544
  }
545
545
  a && (a(l), delete n.onTagObj);
546
- let u = l?.createNode ? l.createNode(n.schema, e, n) : typeof l?.nodeClass?.from == "function" ? l.nodeClass.from(n.schema, e, n) : new I(e);
546
+ let u = l?.createNode ? l.createNode(n.schema, e, n) : typeof l?.nodeClass?.from == "function" ? l.nodeClass.from(n.schema, e, n) : new L(e);
547
547
  return t ? u.tag = t : l.default || (u.tag = l.tag), c && (c.node = u), u;
548
548
  }
549
549
  //#endregion
550
550
  //#region node_modules/yaml/browser/dist/nodes/Collection.js
551
- function z(e, t, n) {
551
+ function B(e, t, n) {
552
552
  let r = n;
553
553
  for (let e = t.length - 1; e >= 0; --e) {
554
554
  let n = t[e];
@@ -557,7 +557,7 @@ function z(e, t, n) {
557
557
  e[n] = r, r = e;
558
558
  } else r = /* @__PURE__ */ new Map([[n, r]]);
559
559
  }
560
- return R(r, void 0, {
560
+ return z(r, void 0, {
561
561
  aliasDuplicateObjects: !1,
562
562
  keepUndefined: !1,
563
563
  onAnchor: () => {
@@ -567,7 +567,7 @@ function z(e, t, n) {
567
567
  sourceObjects: /* @__PURE__ */ new Map()
568
568
  });
569
569
  }
570
- var he = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next().done, ge = class extends ue {
570
+ var me = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next().done, he = class extends le {
571
571
  constructor(e, t) {
572
572
  super(e), Object.defineProperty(this, "schema", {
573
573
  value: t,
@@ -581,11 +581,11 @@ var he = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next
581
581
  return e && (t.schema = e), t.items = t.items.map((t) => T(t) || x(t) ? t.clone(e) : t), this.range && (t.range = this.range.slice()), t;
582
582
  }
583
583
  addIn(e, t) {
584
- if (he(e)) this.add(t);
584
+ if (me(e)) this.add(t);
585
585
  else {
586
586
  let [n, ...r] = e, i = this.get(n, !0);
587
587
  if (w(i)) i.addIn(r, t);
588
- else if (i === void 0 && this.schema) this.set(n, z(this.schema, r, t));
588
+ else if (i === void 0 && this.schema) this.set(n, B(this.schema, r, t));
589
589
  else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`);
590
590
  }
591
591
  }
@@ -619,16 +619,16 @@ var he = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next
619
619
  else {
620
620
  let e = this.get(n, !0);
621
621
  if (w(e)) e.setIn(r, t);
622
- else if (e === void 0 && this.schema) this.set(n, z(this.schema, r, t));
622
+ else if (e === void 0 && this.schema) this.set(n, B(this.schema, r, t));
623
623
  else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`);
624
624
  }
625
625
  }
626
- }, _e = (e) => e.replace(/^(?!$)(?: $)?/gm, "#");
627
- function B(e, t) {
626
+ }, ge = (e) => e.replace(/^(?!$)(?: $)?/gm, "#");
627
+ function V(e, t) {
628
628
  return /^\n+$/.test(e) ? e.substring(1) : t ? e.replace(/^(?! *$)/gm, t) : e;
629
629
  }
630
- var ve = (e, t, n) => e.endsWith("\n") ? B(n, t) : n.includes("\n") ? "\n" + B(n, t) : (e.endsWith(" ") ? "" : " ") + n, ye = "flow", be = "block", xe = "quoted";
631
- function Se(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentWidth: a = 20, onFold: o, onOverflow: s } = {}) {
630
+ var _e = (e, t, n) => e.endsWith("\n") ? V(n, t) : n.includes("\n") ? "\n" + V(n, t) : (e.endsWith(" ") ? "" : " ") + n, ve = "flow", ye = "block", be = "quoted";
631
+ function xe(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentWidth: a = 20, onFold: o, onOverflow: s } = {}) {
632
632
  if (!i || i < 0) return e;
633
633
  i < a && (a = 0);
634
634
  let c = Math.max(1 + a, 1 + i - t.length);
@@ -636,7 +636,7 @@ function Se(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
636
636
  let l = [], u = {}, d = i - t.length;
637
637
  typeof r == "number" && (r > i - Math.max(2, a) ? l.push(0) : d = i - r);
638
638
  let f, p, m = !1, h = -1, g = -1, _ = -1;
639
- n === "block" && (h = Ce(e, h, t.length), h !== -1 && (d = h + c));
639
+ n === "block" && (h = Se(e, h, t.length), h !== -1 && (d = h + c));
640
640
  for (let r; r = e[h += 1];) {
641
641
  if (n === "quoted" && r === "\\") {
642
642
  switch (g = h, e[h + 1]) {
@@ -653,7 +653,7 @@ function Se(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
653
653
  }
654
654
  _ = h;
655
655
  }
656
- if (r === "\n") n === "block" && (h = Ce(e, h, t.length)), d = h + t.length + c, f = void 0;
656
+ if (r === "\n") n === "block" && (h = Se(e, h, t.length)), d = h + t.length + c, f = void 0;
657
657
  else {
658
658
  if (r === " " && p && p !== " " && p !== "\n" && p !== " ") {
659
659
  let t = e[h + 1];
@@ -680,7 +680,7 @@ function Se(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
680
680
  }
681
681
  return v;
682
682
  }
683
- function Ce(e, t, n) {
683
+ function Se(e, t, n) {
684
684
  let r = t, i = t + 1, a = e[i];
685
685
  for (; a === " " || a === " ";) if (t < i + n) a = e[++t];
686
686
  else {
@@ -693,12 +693,12 @@ function Ce(e, t, n) {
693
693
  }
694
694
  //#endregion
695
695
  //#region node_modules/yaml/browser/dist/stringify/stringifyString.js
696
- var we = (e, t) => ({
696
+ var Ce = (e, t) => ({
697
697
  indentAtStart: t ? e.indent.length : e.indentAtStart,
698
698
  lineWidth: e.options.lineWidth,
699
699
  minContentWidth: e.options.minContentWidth
700
- }), Te = (e) => /^(%|---|\.\.\.)/m.test(e);
701
- function Ee(e, t, n) {
700
+ }), we = (e) => /^(%|---|\.\.\.)/m.test(e);
701
+ function Te(e, t, n) {
702
702
  if (!t || t < 0) return !1;
703
703
  let r = t - n, i = e.length;
704
704
  if (i <= r) return !1;
@@ -708,10 +708,10 @@ function Ee(e, t, n) {
708
708
  }
709
709
  return !0;
710
710
  }
711
- function De(e, t) {
711
+ function Ee(e, t) {
712
712
  let n = JSON.stringify(e);
713
713
  if (t.options.doubleQuotedAsJSON) return n;
714
- let { implicitKey: r } = t, i = t.options.doubleQuotedMinMultiLineLength, a = t.indent || (Te(e) ? " " : ""), o = "", s = 0;
714
+ let { implicitKey: r } = t, i = t.options.doubleQuotedMinMultiLineLength, a = t.indent || (we(e) ? " " : ""), o = "", s = 0;
715
715
  for (let e = 0, t = n[e]; t; t = n[++e]) if (t === " " && n[e + 1] === "\\" && n[e + 2] === "n" && (o += n.slice(s, e) + "\\ ", e += 1, s = e, t = "\\"), t === "\\") switch (n[e + 1]) {
716
716
  case "u":
717
717
  {
@@ -756,32 +756,32 @@ function De(e, t) {
756
756
  break;
757
757
  default: e += 1;
758
758
  }
759
- return o = s ? o + n.slice(s) : n, r ? o : Se(o, a, xe, we(t, !1));
759
+ return o = s ? o + n.slice(s) : n, r ? o : xe(o, a, be, Ce(t, !1));
760
760
  }
761
- function Oe(e, t) {
762
- if (t.options.singleQuote === !1 || t.implicitKey && e.includes("\n") || /[ \t]\n|\n[ \t]/.test(e)) return De(e, t);
763
- let n = t.indent || (Te(e) ? " " : ""), r = "'" + e.replace(/'/g, "''").replace(/\n+/g, `$&\n${n}`) + "'";
764
- return t.implicitKey ? r : Se(r, n, ye, we(t, !1));
761
+ function De(e, t) {
762
+ if (t.options.singleQuote === !1 || t.implicitKey && e.includes("\n") || /[ \t]\n|\n[ \t]/.test(e)) return Ee(e, t);
763
+ let n = t.indent || (we(e) ? " " : ""), r = "'" + e.replace(/'/g, "''").replace(/\n+/g, `$&\n${n}`) + "'";
764
+ return t.implicitKey ? r : xe(r, n, ve, Ce(t, !1));
765
765
  }
766
- function ke(e, t) {
766
+ function Oe(e, t) {
767
767
  let { singleQuote: n } = t.options, r;
768
- if (n === !1) r = De;
768
+ if (n === !1) r = Ee;
769
769
  else {
770
770
  let t = e.includes("\""), i = e.includes("'");
771
- r = t && !i ? Oe : i && !t ? De : n ? Oe : De;
771
+ r = t && !i ? De : i && !t ? Ee : n ? De : Ee;
772
772
  }
773
773
  return r(e, t);
774
774
  }
775
- var Ae;
775
+ var ke;
776
776
  try {
777
- Ae = /* @__PURE__ */ RegExp("(^|(?<!\n))\n+(?!\n|$)", "g");
777
+ ke = /* @__PURE__ */ RegExp("(^|(?<!\n))\n+(?!\n|$)", "g");
778
778
  } catch {
779
- Ae = /\n+(?!\n|$)/g;
779
+ ke = /\n+(?!\n|$)/g;
780
780
  }
781
- function je({ comment: e, type: t, value: n }, r, i, a) {
781
+ function Ae({ comment: e, type: t, value: n }, r, i, a) {
782
782
  let { blockQuote: o, commentString: s, lineWidth: c } = r.options;
783
- if (!o || /\n[\t ]+$/.test(n)) return ke(n, r);
784
- let l = r.indent || (r.forceBlockIndent || Te(n) ? " " : ""), u = o === "literal" ? !0 : o === "folded" || t === I.BLOCK_FOLDED ? !1 : t === I.BLOCK_LITERAL || !Ee(n, c, l.length);
783
+ if (!o || /\n[\t ]+$/.test(n)) return Oe(n, r);
784
+ let l = r.indent || (r.forceBlockIndent || we(n) ? " " : ""), u = o === "literal" ? !0 : o === "folded" || t === L.BLOCK_FOLDED ? !1 : t === L.BLOCK_LITERAL || !Te(n, c, l.length);
785
785
  if (!n) return u ? "|\n" : ">\n";
786
786
  let d, f;
787
787
  for (f = n.length; f > 0; --f) {
@@ -789,7 +789,7 @@ function je({ comment: e, type: t, value: n }, r, i, a) {
789
789
  if (e !== "\n" && e !== " " && e !== " ") break;
790
790
  }
791
791
  let p = n.substring(f), m = p.indexOf("\n");
792
- m === -1 ? d = "-" : n === p || m !== p.length - 1 ? (d = "+", a && a()) : d = "", p &&= (n = n.slice(0, -p.length), p[p.length - 1] === "\n" && (p = p.slice(0, -1)), p.replace(Ae, `$&${l}`));
792
+ m === -1 ? d = "-" : n === p || m !== p.length - 1 ? (d = "+", a && a()) : d = "", p &&= (n = n.slice(0, -p.length), p[p.length - 1] === "\n" && (p = p.slice(0, -1)), p.replace(ke, `$&${l}`));
793
793
  let h = !1, g, _ = -1;
794
794
  for (g = 0; g < n.length; ++g) {
795
795
  let e = n[g];
@@ -801,41 +801,41 @@ function je({ comment: e, type: t, value: n }, r, i, a) {
801
801
  v &&= (n = n.substring(v.length), v.replace(/\n+/g, `$&${l}`));
802
802
  let y = (h ? l ? "2" : "1" : "") + d;
803
803
  if (e && (y += " " + s(e.replace(/ ?[\r\n]+/g, " ")), i && i()), !u) {
804
- let e = n.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${l}`), i = !1, a = we(r, !0);
805
- o !== "folded" && t !== I.BLOCK_FOLDED && (a.onOverflow = () => {
804
+ let e = n.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${l}`), i = !1, a = Ce(r, !0);
805
+ o !== "folded" && t !== L.BLOCK_FOLDED && (a.onOverflow = () => {
806
806
  i = !0;
807
807
  });
808
- let s = Se(`${v}${e}${p}`, l, be, a);
808
+ let s = xe(`${v}${e}${p}`, l, ye, a);
809
809
  if (!i) return `>${y}\n${l}${s}`;
810
810
  }
811
811
  return n = n.replace(/\n+/g, `$&${l}`), `|${y}\n${l}${v}${n}${p}`;
812
812
  }
813
- function Me(e, t, n, r) {
813
+ function je(e, t, n, r) {
814
814
  let { type: i, value: a } = e, { actualString: o, implicitKey: s, indent: c, indentStep: l, inFlow: u } = t;
815
- if (s && a.includes("\n") || u && /[[\]{},]/.test(a)) return ke(a, t);
816
- if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a)) return s || u || !a.includes("\n") ? ke(a, t) : je(e, t, n, r);
817
- if (!s && !u && i !== I.PLAIN && a.includes("\n")) return je(e, t, n, r);
818
- if (Te(a)) {
819
- if (c === "") return t.forceBlockIndent = !0, je(e, t, n, r);
820
- if (s && c === l) return ke(a, t);
815
+ if (s && a.includes("\n") || u && /[[\]{},]/.test(a)) return Oe(a, t);
816
+ if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a)) return s || u || !a.includes("\n") ? Oe(a, t) : Ae(e, t, n, r);
817
+ if (!s && !u && i !== L.PLAIN && a.includes("\n")) return Ae(e, t, n, r);
818
+ if (we(a)) {
819
+ if (c === "") return t.forceBlockIndent = !0, Ae(e, t, n, r);
820
+ if (s && c === l) return Oe(a, t);
821
821
  }
822
822
  let d = a.replace(/\n+/g, `$&\n${c}`);
823
823
  if (o) {
824
824
  let e = (e) => e.default && e.tag !== "tag:yaml.org,2002:str" && e.test?.test(d), { compat: n, tags: r } = t.doc.schema;
825
- if (r.some(e) || n?.some(e)) return ke(a, t);
825
+ if (r.some(e) || n?.some(e)) return Oe(a, t);
826
826
  }
827
- return s ? d : Se(d, c, ye, we(t, !1));
827
+ return s ? d : xe(d, c, ve, Ce(t, !1));
828
828
  }
829
- function Ne(e, t, n, r) {
829
+ function Me(e, t, n, r) {
830
830
  let { implicitKey: i, inFlow: a } = t, o = typeof e.value == "string" ? e : Object.assign({}, e, { value: String(e.value) }), { type: s } = e;
831
- s !== I.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (s = I.QUOTE_DOUBLE);
831
+ s !== L.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (s = L.QUOTE_DOUBLE);
832
832
  let c = (e) => {
833
833
  switch (e) {
834
- case I.BLOCK_FOLDED:
835
- case I.BLOCK_LITERAL: return i || a ? ke(o.value, t) : je(o, t, n, r);
836
- case I.QUOTE_DOUBLE: return De(o.value, t);
837
- case I.QUOTE_SINGLE: return Oe(o.value, t);
838
- case I.PLAIN: return Me(o, t, n, r);
834
+ case L.BLOCK_FOLDED:
835
+ case L.BLOCK_LITERAL: return i || a ? Oe(o.value, t) : Ae(o, t, n, r);
836
+ case L.QUOTE_DOUBLE: return Ee(o.value, t);
837
+ case L.QUOTE_SINGLE: return De(o.value, t);
838
+ case L.PLAIN: return je(o, t, n, r);
839
839
  default: return null;
840
840
  }
841
841
  }, l = c(s);
@@ -847,10 +847,10 @@ function Ne(e, t, n, r) {
847
847
  }
848
848
  //#endregion
849
849
  //#region node_modules/yaml/browser/dist/stringify/stringify.js
850
- function Pe(e, t) {
850
+ function Ne(e, t) {
851
851
  let n = Object.assign({
852
852
  blockQuote: !0,
853
- commentString: _e,
853
+ commentString: ge,
854
854
  defaultKeyType: null,
855
855
  defaultStringType: "PLAIN",
856
856
  directives: null,
@@ -887,7 +887,7 @@ function Pe(e, t) {
887
887
  options: n
888
888
  };
889
889
  }
890
- function Fe(e, t) {
890
+ function Pe(e, t) {
891
891
  if (t.tag) {
892
892
  let n = e.filter((e) => e.tag === t.tag);
893
893
  if (n.length > 0) return n.find((e) => e.format === t.format) ?? n[0];
@@ -908,14 +908,14 @@ function Fe(e, t) {
908
908
  }
909
909
  return n;
910
910
  }
911
- function Ie(e, t, { anchors: n, doc: r }) {
911
+ function Fe(e, t, { anchors: n, doc: r }) {
912
912
  if (!r.directives) return "";
913
913
  let i = [], a = (S(e) || w(e)) && e.anchor;
914
- a && oe(a) && (n.add(a), i.push(`&${a}`));
914
+ a && ae(a) && (n.add(a), i.push(`&${a}`));
915
915
  let o = e.tag ?? (t.default ? null : t.tag);
916
916
  return o && i.push(r.directives.tagString(o)), i.join(" ");
917
917
  }
918
- function Le(e, t, n, r) {
918
+ function Ie(e, t, n, r) {
919
919
  if (x(e)) return e.toString(t, n, r);
920
920
  if (v(e)) {
921
921
  if (t.doc.directives) return e.toString(t);
@@ -923,42 +923,42 @@ function Le(e, t, n, r) {
923
923
  t.resolvedAliases ? t.resolvedAliases.add(e) : t.resolvedAliases = /* @__PURE__ */ new Set([e]), e = e.resolve(t.doc);
924
924
  }
925
925
  let i, a = T(e) ? e : t.doc.createNode(e, { onTagObj: (e) => i = e });
926
- i ??= Fe(t.doc.schema.tags, a);
927
- let o = Ie(a, i, t);
926
+ i ??= Pe(t.doc.schema.tags, a);
927
+ let o = Fe(a, i, t);
928
928
  o.length > 0 && (t.indentAtStart = (t.indentAtStart ?? 0) + o.length + 1);
929
- let s = typeof i.stringify == "function" ? i.stringify(a, t, n, r) : S(a) ? Ne(a, t, n, r) : a.toString(t, n, r);
929
+ let s = typeof i.stringify == "function" ? i.stringify(a, t, n, r) : S(a) ? Me(a, t, n, r) : a.toString(t, n, r);
930
930
  return o ? S(a) || s[0] === "{" || s[0] === "[" ? `${o} ${s}` : `${o}\n${t.indent}${s}` : s;
931
931
  }
932
932
  //#endregion
933
933
  //#region node_modules/yaml/browser/dist/stringify/stringifyPair.js
934
- function Re({ key: e, value: t }, n, r, i) {
934
+ function Le({ key: e, value: t }, n, r, i) {
935
935
  let { allNullValues: a, doc: o, indent: s, indentStep: c, options: { commentString: l, indentSeq: u, simpleKeys: d } } = n, f = T(e) && e.comment || null;
936
936
  if (d) {
937
937
  if (f) throw Error("With simple keys, key nodes cannot have comments");
938
938
  if (w(e) || !T(e) && typeof e == "object") throw Error("With simple keys, collection cannot be used as a key value");
939
939
  }
940
- let p = !d && (!e || f && t == null && !n.inFlow || w(e) || (S(e) ? e.type === I.BLOCK_FOLDED || e.type === I.BLOCK_LITERAL : typeof e == "object"));
940
+ let p = !d && (!e || f && t == null && !n.inFlow || w(e) || (S(e) ? e.type === L.BLOCK_FOLDED || e.type === L.BLOCK_LITERAL : typeof e == "object"));
941
941
  n = Object.assign({}, n, {
942
942
  allNullValues: !1,
943
943
  implicitKey: !p && (d || !a),
944
944
  indent: s + c
945
945
  });
946
- let m = !1, h = !1, g = Le(e, n, () => m = !0, () => h = !0);
946
+ let m = !1, h = !1, g = Ie(e, n, () => m = !0, () => h = !0);
947
947
  if (!p && !n.inFlow && g.length > 1024) {
948
948
  if (d) throw Error("With simple keys, single line scalar must not span more than 1024 characters");
949
949
  p = !0;
950
950
  }
951
951
  if (n.inFlow) {
952
952
  if (a || t == null) return m && r && r(), g === "" ? "?" : p ? `? ${g}` : g;
953
- } else if (a && !d || t == null && p) return g = `? ${g}`, f && !m ? g += ve(g, n.indent, l(f)) : h && i && i(), g;
954
- m && (f = null), p ? (f && (g += ve(g, n.indent, l(f))), g = `? ${g}\n${s}:`) : (g = `${g}:`, f && (g += ve(g, n.indent, l(f))));
953
+ } else if (a && !d || t == null && p) return g = `? ${g}`, f && !m ? g += _e(g, n.indent, l(f)) : h && i && i(), g;
954
+ m && (f = null), p ? (f && (g += _e(g, n.indent, l(f))), g = `? ${g}\n${s}:`) : (g = `${g}:`, f && (g += _e(g, n.indent, l(f))));
955
955
  let _, v, y;
956
956
  T(t) ? (_ = !!t.spaceBefore, v = t.commentBefore, y = t.comment) : (_ = !1, v = null, y = null, t && typeof t == "object" && (t = o.createNode(t))), n.implicitKey = !1, !p && !f && S(t) && (n.indentAtStart = g.length + 1), h = !1, !u && c.length >= 2 && !n.inFlow && !p && C(t) && !t.flow && !t.tag && !t.anchor && (n.indent = n.indent.substring(2));
957
- let b = !1, x = Le(t, n, () => b = !0, () => h = !0), E = " ";
957
+ let b = !1, x = Ie(t, n, () => b = !0, () => h = !0), E = " ";
958
958
  if (f || _ || v) {
959
959
  if (E = _ ? "\n" : "", v) {
960
960
  let e = l(v);
961
- E += `\n${B(e, n.indent)}`;
961
+ E += `\n${V(e, n.indent)}`;
962
962
  }
963
963
  x === "" && !n.inFlow ? E === "\n" && y && (E = "\n\n") : E += `\n${n.indent}`;
964
964
  } else if (!p && w(t)) {
@@ -972,31 +972,31 @@ function Re({ key: e, value: t }, n, r, i) {
972
972
  t || (E = `\n${n.indent}`);
973
973
  }
974
974
  } else (x === "" || x[0] === "\n") && (E = "");
975
- return g += E + x, n.inFlow ? b && r && r() : y && !b ? g += ve(g, n.indent, l(y)) : h && i && i(), g;
975
+ return g += E + x, n.inFlow ? b && r && r() : y && !b ? g += _e(g, n.indent, l(y)) : h && i && i(), g;
976
976
  }
977
977
  //#endregion
978
978
  //#region node_modules/yaml/browser/dist/log.js
979
- function ze(e, t) {
979
+ function Re(e, t) {
980
980
  (e === "debug" || e === "warn") && console.warn(t);
981
981
  }
982
982
  //#endregion
983
983
  //#region node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js
984
- var Be = "<<", V = {
985
- identify: (e) => e === Be || typeof e == "symbol" && e.description === Be,
984
+ var ze = "<<", H = {
985
+ identify: (e) => e === ze || typeof e == "symbol" && e.description === ze,
986
986
  default: "key",
987
987
  tag: "tag:yaml.org,2002:merge",
988
988
  test: /^<<$/,
989
- resolve: () => Object.assign(new I(Symbol(Be)), { addToJSMap: He }),
990
- stringify: () => Be
991
- }, Ve = (e, t) => (V.identify(t) || S(t) && (!t.type || t.type === I.PLAIN) && V.identify(t.value)) && e?.doc.schema.tags.some((e) => e.tag === V.tag && e.default);
992
- function He(e, t, n) {
993
- let r = We(e, n);
994
- if (C(r)) for (let n of r.items) Ue(e, t, n);
995
- else if (Array.isArray(r)) for (let n of r) Ue(e, t, n);
996
- else Ue(e, t, r);
989
+ resolve: () => Object.assign(new L(Symbol(ze)), { addToJSMap: Ve }),
990
+ stringify: () => ze
991
+ }, Be = (e, t) => (H.identify(t) || S(t) && (!t.type || t.type === L.PLAIN) && H.identify(t.value)) && e?.doc.schema.tags.some((e) => e.tag === H.tag && e.default);
992
+ function Ve(e, t, n) {
993
+ let r = Ue(e, n);
994
+ if (C(r)) for (let n of r.items) He(e, t, n);
995
+ else if (Array.isArray(r)) for (let n of r) He(e, t, n);
996
+ else He(e, t, r);
997
997
  }
998
- function Ue(e, t, n) {
999
- let r = We(e, n);
998
+ function He(e, t, n) {
999
+ let r = Ue(e, n);
1000
1000
  if (!b(r)) throw Error("Merge sources must be maps or map aliases");
1001
1001
  let i = r.toJSON(null, e, Map);
1002
1002
  for (let [e, n] of i) t instanceof Map ? t.has(e) || t.set(e, n) : t instanceof Set ? t.add(e) : Object.prototype.hasOwnProperty.call(t, e) || Object.defineProperty(t, e, {
@@ -1007,20 +1007,20 @@ function Ue(e, t, n) {
1007
1007
  });
1008
1008
  return t;
1009
1009
  }
1010
- function We(e, t) {
1010
+ function Ue(e, t) {
1011
1011
  return e && v(t) ? t.resolve(e.doc, e) : t;
1012
1012
  }
1013
1013
  //#endregion
1014
1014
  //#region node_modules/yaml/browser/dist/nodes/addPairToJSMap.js
1015
- function Ge(e, t, { key: n, value: r }) {
1015
+ function We(e, t, { key: n, value: r }) {
1016
1016
  if (T(n) && n.addToJSMap) n.addToJSMap(e, t, r);
1017
- else if (Ve(e, n)) He(e, t, r);
1017
+ else if (Be(e, n)) Ve(e, t, r);
1018
1018
  else {
1019
- let i = F(n, "", e);
1020
- if (t instanceof Map) t.set(i, F(r, i, e));
1019
+ let i = I(n, "", e);
1020
+ if (t instanceof Map) t.set(i, I(r, i, e));
1021
1021
  else if (t instanceof Set) t.add(i);
1022
1022
  else {
1023
- let a = Ke(n, i, e), o = F(r, a, e);
1023
+ let a = Ge(n, i, e), o = I(r, a, e);
1024
1024
  a in t ? Object.defineProperty(t, a, {
1025
1025
  value: o,
1026
1026
  writable: !0,
@@ -1031,18 +1031,18 @@ function Ge(e, t, { key: n, value: r }) {
1031
1031
  }
1032
1032
  return t;
1033
1033
  }
1034
- function Ke(e, t, n) {
1034
+ function Ge(e, t, n) {
1035
1035
  if (t === null) return "";
1036
1036
  if (typeof t != "object") return String(t);
1037
1037
  if (T(e) && n?.doc) {
1038
- let t = Pe(n.doc, {});
1038
+ let t = Ne(n.doc, {});
1039
1039
  t.anchors = /* @__PURE__ */ new Set();
1040
1040
  for (let e of n.anchors.keys()) t.anchors.add(e.anchor);
1041
1041
  t.inFlow = !0, t.inStringifyKey = !0;
1042
1042
  let r = e.toString(t);
1043
1043
  if (!n.mapKeyWarned) {
1044
1044
  let e = JSON.stringify(r);
1045
- e.length > 40 && (e = e.substring(0, 36) + "...\""), ze(n.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`), n.mapKeyWarned = !0;
1045
+ e.length > 40 && (e = e.substring(0, 36) + "...\""), Re(n.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`), n.mapKeyWarned = !0;
1046
1046
  }
1047
1047
  return r;
1048
1048
  }
@@ -1050,10 +1050,10 @@ function Ke(e, t, n) {
1050
1050
  }
1051
1051
  //#endregion
1052
1052
  //#region node_modules/yaml/browser/dist/nodes/Pair.js
1053
- function qe(e, t, n) {
1054
- return new H(R(e, void 0, n), R(t, void 0, n));
1053
+ function Ke(e, t, n) {
1054
+ return new U(z(e, void 0, n), z(t, void 0, n));
1055
1055
  }
1056
- var H = class e {
1056
+ var U = class e {
1057
1057
  constructor(e, t = null) {
1058
1058
  Object.defineProperty(this, _, { value: m }), this.key = e, this.value = t;
1059
1059
  }
@@ -1062,32 +1062,32 @@ var H = class e {
1062
1062
  return T(n) && (n = n.clone(t)), T(r) && (r = r.clone(t)), new e(n, r);
1063
1063
  }
1064
1064
  toJSON(e, t) {
1065
- return Ge(t, t?.mapAsMap ? /* @__PURE__ */ new Map() : {}, this);
1065
+ return We(t, t?.mapAsMap ? /* @__PURE__ */ new Map() : {}, this);
1066
1066
  }
1067
1067
  toString(e, t, n) {
1068
- return e?.doc ? Re(this, e, t, n) : JSON.stringify(this);
1068
+ return e?.doc ? Le(this, e, t, n) : JSON.stringify(this);
1069
1069
  }
1070
1070
  };
1071
1071
  //#endregion
1072
1072
  //#region node_modules/yaml/browser/dist/stringify/stringifyCollection.js
1073
- function Je(e, t, n) {
1074
- return (t.inFlow ?? e.flow ? Xe : Ye)(e, t, n);
1073
+ function qe(e, t, n) {
1074
+ return (t.inFlow ?? e.flow ? Ye : Je)(e, t, n);
1075
1075
  }
1076
- function Ye({ comment: e, items: t }, n, { blockItemPrefix: r, flowChars: i, itemIndent: a, onChompKeep: o, onComment: s }) {
1076
+ function Je({ comment: e, items: t }, n, { blockItemPrefix: r, flowChars: i, itemIndent: a, onChompKeep: o, onComment: s }) {
1077
1077
  let { indent: c, options: { commentString: l } } = n, u = Object.assign({}, n, {
1078
1078
  indent: a,
1079
1079
  type: null
1080
1080
  }), d = !1, f = [];
1081
1081
  for (let e = 0; e < t.length; ++e) {
1082
1082
  let i = t[e], o = null;
1083
- if (T(i)) !d && i.spaceBefore && f.push(""), Ze(n, f, i.commentBefore, d), i.comment && (o = i.comment);
1083
+ if (T(i)) !d && i.spaceBefore && f.push(""), Xe(n, f, i.commentBefore, d), i.comment && (o = i.comment);
1084
1084
  else if (x(i)) {
1085
1085
  let e = T(i.key) ? i.key : null;
1086
- e && (!d && e.spaceBefore && f.push(""), Ze(n, f, e.commentBefore, d));
1086
+ e && (!d && e.spaceBefore && f.push(""), Xe(n, f, e.commentBefore, d));
1087
1087
  }
1088
1088
  d = !1;
1089
- let s = Le(i, u, () => o = null, () => d = !0);
1090
- o && (s += ve(s, a, l(o))), d && o && (d = !1), f.push(r + s);
1089
+ let s = Ie(i, u, () => o = null, () => d = !0);
1090
+ o && (s += _e(s, a, l(o))), d && o && (d = !1), f.push(r + s);
1091
1091
  }
1092
1092
  let p;
1093
1093
  if (f.length === 0) p = i.start + i.end;
@@ -1098,9 +1098,9 @@ function Ye({ comment: e, items: t }, n, { blockItemPrefix: r, flowChars: i, ite
1098
1098
  p += t ? `\n${c}${t}` : "\n";
1099
1099
  }
1100
1100
  }
1101
- return e ? (p += "\n" + B(l(e), c), s && s()) : d && o && o(), p;
1101
+ return e ? (p += "\n" + V(l(e), c), s && s()) : d && o && o(), p;
1102
1102
  }
1103
- function Xe({ items: e }, t, { flowChars: n, itemIndent: r }) {
1103
+ function Ye({ items: e }, t, { flowChars: n, itemIndent: r }) {
1104
1104
  let { indent: i, indentStep: a, flowCollectionPadding: o, options: { commentString: s } } = t;
1105
1105
  r += a;
1106
1106
  let c = Object.assign({}, t, {
@@ -1110,16 +1110,16 @@ function Xe({ items: e }, t, { flowChars: n, itemIndent: r }) {
1110
1110
  }), l = !1, u = 0, d = [];
1111
1111
  for (let n = 0; n < e.length; ++n) {
1112
1112
  let i = e[n], a = null;
1113
- if (T(i)) i.spaceBefore && d.push(""), Ze(t, d, i.commentBefore, !1), i.comment && (a = i.comment);
1113
+ if (T(i)) i.spaceBefore && d.push(""), Xe(t, d, i.commentBefore, !1), i.comment && (a = i.comment);
1114
1114
  else if (x(i)) {
1115
1115
  let e = T(i.key) ? i.key : null;
1116
- e && (e.spaceBefore && d.push(""), Ze(t, d, e.commentBefore, !1), e.comment && (l = !0));
1116
+ e && (e.spaceBefore && d.push(""), Xe(t, d, e.commentBefore, !1), e.comment && (l = !0));
1117
1117
  let n = T(i.value) ? i.value : null;
1118
1118
  n ? (n.comment && (a = n.comment), n.commentBefore && (l = !0)) : i.value == null && e?.comment && (a = e.comment);
1119
1119
  }
1120
1120
  a && (l = !0);
1121
- let o = Le(i, c, () => a = null);
1122
- l ||= d.length > u || o.includes("\n"), n < e.length - 1 ? o += "," : t.options.trailingComma && (t.options.lineWidth > 0 && (l ||= d.reduce((e, t) => e + t.length + 2, 2) + (o.length + 2) > t.options.lineWidth), l && (o += ",")), a && (o += ve(o, r, s(a))), d.push(o), u = d.length;
1121
+ let o = Ie(i, c, () => a = null);
1122
+ l ||= d.length > u || o.includes("\n"), n < e.length - 1 ? o += "," : t.options.trailingComma && (t.options.lineWidth > 0 && (l ||= d.reduce((e, t) => e + t.length + 2, 2) + (o.length + 2) > t.options.lineWidth), l && (o += ",")), a && (o += _e(o, r, s(a))), d.push(o), u = d.length;
1123
1123
  }
1124
1124
  let { start: f, end: p } = n;
1125
1125
  if (d.length === 0) return f + p;
@@ -1134,19 +1134,19 @@ function Xe({ items: e }, t, { flowChars: n, itemIndent: r }) {
1134
1134
  }
1135
1135
  return `${f}${o}${d.join(" ")}${o}${p}`;
1136
1136
  }
1137
- function Ze({ indent: e, options: { commentString: t } }, n, r, i) {
1137
+ function Xe({ indent: e, options: { commentString: t } }, n, r, i) {
1138
1138
  if (r && i && (r = r.replace(/^\n+/, "")), r) {
1139
- let i = B(t(r), e);
1139
+ let i = V(t(r), e);
1140
1140
  n.push(i.trimStart());
1141
1141
  }
1142
1142
  }
1143
1143
  //#endregion
1144
1144
  //#region node_modules/yaml/browser/dist/nodes/YAMLMap.js
1145
- function Qe(e, t) {
1145
+ function Ze(e, t) {
1146
1146
  let n = S(t) ? t.value : t;
1147
1147
  for (let r of e) if (x(r) && (r.key === t || r.key === n || S(r.key) && r.key.value === n)) return r;
1148
1148
  }
1149
- var U = class extends ge {
1149
+ var W = class extends he {
1150
1150
  static get tagName() {
1151
1151
  return "tag:yaml.org,2002:map";
1152
1152
  }
@@ -1157,7 +1157,7 @@ var U = class extends ge {
1157
1157
  let { keepUndefined: r, replacer: i } = n, a = new this(e), o = (e, o) => {
1158
1158
  if (typeof i == "function") o = i.call(t, e, o);
1159
1159
  else if (Array.isArray(i) && !i.includes(e)) return;
1160
- (o !== void 0 || r) && a.items.push(qe(e, o, n));
1160
+ (o !== void 0 || r) && a.items.push(Ke(e, o, n));
1161
1161
  };
1162
1162
  if (t instanceof Map) for (let [e, n] of t) o(e, n);
1163
1163
  else if (t && typeof t == "object") for (let e of Object.keys(t)) o(e, t[e]);
@@ -1165,40 +1165,40 @@ var U = class extends ge {
1165
1165
  }
1166
1166
  add(e, t) {
1167
1167
  let n;
1168
- n = x(e) ? e : !e || typeof e != "object" || !("key" in e) ? new H(e, e?.value) : new H(e.key, e.value);
1169
- let r = Qe(this.items, n.key), i = this.schema?.sortMapEntries;
1168
+ n = x(e) ? e : !e || typeof e != "object" || !("key" in e) ? new U(e, e?.value) : new U(e.key, e.value);
1169
+ let r = Ze(this.items, n.key), i = this.schema?.sortMapEntries;
1170
1170
  if (r) {
1171
1171
  if (!t) throw Error(`Key ${n.key} already set`);
1172
- S(r.value) && pe(n.value) ? r.value.value = n.value : r.value = n.value;
1172
+ S(r.value) && fe(n.value) ? r.value.value = n.value : r.value = n.value;
1173
1173
  } else if (i) {
1174
1174
  let e = this.items.findIndex((e) => i(n, e) < 0);
1175
1175
  e === -1 ? this.items.push(n) : this.items.splice(e, 0, n);
1176
1176
  } else this.items.push(n);
1177
1177
  }
1178
1178
  delete(e) {
1179
- let t = Qe(this.items, e);
1179
+ let t = Ze(this.items, e);
1180
1180
  return t ? this.items.splice(this.items.indexOf(t), 1).length > 0 : !1;
1181
1181
  }
1182
1182
  get(e, t) {
1183
- let n = Qe(this.items, e)?.value;
1183
+ let n = Ze(this.items, e)?.value;
1184
1184
  return (!t && S(n) ? n.value : n) ?? void 0;
1185
1185
  }
1186
1186
  has(e) {
1187
- return !!Qe(this.items, e);
1187
+ return !!Ze(this.items, e);
1188
1188
  }
1189
1189
  set(e, t) {
1190
- this.add(new H(e, t), !0);
1190
+ this.add(new U(e, t), !0);
1191
1191
  }
1192
1192
  toJSON(e, t, n) {
1193
1193
  let r = n ? new n() : t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
1194
1194
  t?.onCreate && t.onCreate(r);
1195
- for (let e of this.items) Ge(t, r, e);
1195
+ for (let e of this.items) We(t, r, e);
1196
1196
  return r;
1197
1197
  }
1198
1198
  toString(e, t, n) {
1199
1199
  if (!e) return JSON.stringify(this);
1200
1200
  for (let e of this.items) if (!x(e)) throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);
1201
- return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), Je(this, e, {
1201
+ return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), qe(this, e, {
1202
1202
  blockItemPrefix: "",
1203
1203
  flowChars: {
1204
1204
  start: "{",
@@ -1209,16 +1209,16 @@ var U = class extends ge {
1209
1209
  onComment: t
1210
1210
  });
1211
1211
  }
1212
- }, $e = {
1212
+ }, Qe = {
1213
1213
  collection: "map",
1214
1214
  default: !0,
1215
- nodeClass: U,
1215
+ nodeClass: W,
1216
1216
  tag: "tag:yaml.org,2002:map",
1217
1217
  resolve(e, t) {
1218
1218
  return b(e) || t("Expected a mapping for this tag"), e;
1219
1219
  },
1220
- createNode: (e, t, n) => U.from(e, t, n)
1221
- }, W = class extends ge {
1220
+ createNode: (e, t, n) => W.from(e, t, n)
1221
+ }, $e = class extends he {
1222
1222
  static get tagName() {
1223
1223
  return "tag:yaml.org,2002:seq";
1224
1224
  }
@@ -1246,17 +1246,17 @@ var U = class extends ge {
1246
1246
  let n = et(e);
1247
1247
  if (typeof n != "number") throw Error(`Expected a valid index, not ${e}.`);
1248
1248
  let r = this.items[n];
1249
- S(r) && pe(t) ? r.value = t : this.items[n] = t;
1249
+ S(r) && fe(t) ? r.value = t : this.items[n] = t;
1250
1250
  }
1251
1251
  toJSON(e, t) {
1252
1252
  let n = [];
1253
1253
  t?.onCreate && t.onCreate(n);
1254
1254
  let r = 0;
1255
- for (let e of this.items) n.push(F(e, String(r++), t));
1255
+ for (let e of this.items) n.push(I(e, String(r++), t));
1256
1256
  return n;
1257
1257
  }
1258
1258
  toString(e, t, n) {
1259
- return e ? Je(this, e, {
1259
+ return e ? qe(this, e, {
1260
1260
  blockItemPrefix: "- ",
1261
1261
  flowChars: {
1262
1262
  start: "[",
@@ -1276,7 +1276,7 @@ var U = class extends ge {
1276
1276
  let n = t instanceof Set ? a : String(e++);
1277
1277
  a = r.call(t, n, a);
1278
1278
  }
1279
- i.items.push(R(a, void 0, n));
1279
+ i.items.push(z(a, void 0, n));
1280
1280
  }
1281
1281
  }
1282
1282
  return i;
@@ -1291,34 +1291,34 @@ function et(e) {
1291
1291
  var tt = {
1292
1292
  collection: "seq",
1293
1293
  default: !0,
1294
- nodeClass: W,
1294
+ nodeClass: $e,
1295
1295
  tag: "tag:yaml.org,2002:seq",
1296
1296
  resolve(e, t) {
1297
1297
  return C(e) || t("Expected a sequence for this tag"), e;
1298
1298
  },
1299
- createNode: (e, t, n) => W.from(e, t, n)
1299
+ createNode: (e, t, n) => $e.from(e, t, n)
1300
1300
  }, nt = {
1301
1301
  identify: (e) => typeof e == "string",
1302
1302
  default: !0,
1303
1303
  tag: "tag:yaml.org,2002:str",
1304
1304
  resolve: (e) => e,
1305
1305
  stringify(e, t, n, r) {
1306
- return t = Object.assign({ actualString: !0 }, t), Ne(e, t, n, r);
1306
+ return t = Object.assign({ actualString: !0 }, t), Me(e, t, n, r);
1307
1307
  }
1308
1308
  }, rt = {
1309
1309
  identify: (e) => e == null,
1310
- createNode: () => new I(null),
1310
+ createNode: () => new L(null),
1311
1311
  default: !0,
1312
1312
  tag: "tag:yaml.org,2002:null",
1313
1313
  test: /^(?:~|[Nn]ull|NULL)?$/,
1314
- resolve: () => new I(null),
1314
+ resolve: () => new L(null),
1315
1315
  stringify: ({ source: e }, t) => typeof e == "string" && rt.test.test(e) ? e : t.options.nullStr
1316
1316
  }, it = {
1317
1317
  identify: (e) => typeof e == "boolean",
1318
1318
  default: !0,
1319
1319
  tag: "tag:yaml.org,2002:bool",
1320
1320
  test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
1321
- resolve: (e) => new I(e[0] === "t" || e[0] === "T"),
1321
+ resolve: (e) => new L(e[0] === "t" || e[0] === "T"),
1322
1322
  stringify({ source: e, value: t }, n) {
1323
1323
  return e && it.test.test(e) && t === (e[0] === "t" || e[0] === "T") ? e : t ? n.options.trueStr : n.options.falseStr;
1324
1324
  }
@@ -1364,7 +1364,7 @@ var at = {
1364
1364
  tag: "tag:yaml.org,2002:float",
1365
1365
  test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
1366
1366
  resolve(e) {
1367
- let t = new I(parseFloat(e)), n = e.indexOf(".");
1367
+ let t = new L(parseFloat(e)), n = e.indexOf(".");
1368
1368
  return n !== -1 && e[e.length - 1] === "0" && (t.minFractionDigits = e.length - n - 1), t;
1369
1369
  },
1370
1370
  stringify: G
@@ -1397,7 +1397,7 @@ var dt = {
1397
1397
  resolve: (e, t, n) => lt(e, 2, 16, n),
1398
1398
  stringify: (e) => ut(e, 16, "0x")
1399
1399
  }, mt = [
1400
- $e,
1400
+ Qe,
1401
1401
  tt,
1402
1402
  nt,
1403
1403
  rt,
@@ -1424,7 +1424,7 @@ var gt = ({ value: e }) => JSON.stringify(e), _t = [
1424
1424
  },
1425
1425
  {
1426
1426
  identify: (e) => e == null,
1427
- createNode: () => new I(null),
1427
+ createNode: () => new L(null),
1428
1428
  default: !0,
1429
1429
  tag: "tag:yaml.org,2002:null",
1430
1430
  test: /^null$/,
@@ -1455,7 +1455,7 @@ var gt = ({ value: e }) => JSON.stringify(e), _t = [
1455
1455
  resolve: (e) => parseFloat(e),
1456
1456
  stringify: gt
1457
1457
  }
1458
- ], vt = [$e, tt].concat(_t, {
1458
+ ], vt = [Qe, tt].concat(_t, {
1459
1459
  default: !0,
1460
1460
  tag: "",
1461
1461
  test: /^/,
@@ -1482,12 +1482,12 @@ var gt = ({ value: e }) => JSON.stringify(e), _t = [
1482
1482
  for (let t = 0; t < o.length; ++t) e += String.fromCharCode(o[t]);
1483
1483
  s = btoa(e);
1484
1484
  } else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");
1485
- if (t ??= I.BLOCK_LITERAL, t !== I.QUOTE_DOUBLE) {
1485
+ if (t ??= L.BLOCK_LITERAL, t !== L.QUOTE_DOUBLE) {
1486
1486
  let e = Math.max(r.options.lineWidth - r.indent.length, r.options.minContentWidth), n = Math.ceil(s.length / e), i = Array(n);
1487
1487
  for (let t = 0, r = 0; t < n; ++t, r += e) i[t] = s.substr(r, e);
1488
- s = i.join(t === I.BLOCK_LITERAL ? "\n" : " ");
1488
+ s = i.join(t === L.BLOCK_LITERAL ? "\n" : " ");
1489
1489
  }
1490
- return Ne({
1490
+ return Me({
1491
1491
  comment: e,
1492
1492
  type: t,
1493
1493
  value: s
@@ -1502,21 +1502,21 @@ function bt(e, t) {
1502
1502
  if (!x(r)) {
1503
1503
  if (b(r)) {
1504
1504
  r.items.length > 1 && t("Each pair must have its own sequence indicator");
1505
- let e = r.items[0] || new H(new I(null));
1505
+ let e = r.items[0] || new U(new L(null));
1506
1506
  if (r.commentBefore && (e.key.commentBefore = e.key.commentBefore ? `${r.commentBefore}\n${e.key.commentBefore}` : r.commentBefore), r.comment) {
1507
1507
  let t = e.value ?? e.key;
1508
1508
  t.comment = t.comment ? `${r.comment}\n${t.comment}` : r.comment;
1509
1509
  }
1510
1510
  r = e;
1511
1511
  }
1512
- e.items[n] = x(r) ? r : new H(r);
1512
+ e.items[n] = x(r) ? r : new U(r);
1513
1513
  }
1514
1514
  }
1515
1515
  else t("Expected a sequence for this tag");
1516
1516
  return e;
1517
1517
  }
1518
1518
  function xt(e, t, n) {
1519
- let { replacer: r } = n, i = new W(e);
1519
+ let { replacer: r } = n, i = new $e(e);
1520
1520
  i.tag = "tag:yaml.org,2002:pairs";
1521
1521
  let a = 0;
1522
1522
  if (t && Symbol.iterator in Object(t)) for (let e of t) {
@@ -1530,7 +1530,7 @@ function xt(e, t, n) {
1530
1530
  if (t.length === 1) o = t[0], s = e[o];
1531
1531
  else throw TypeError(`Expected tuple with one key, not ${t.length} keys`);
1532
1532
  } else o = e;
1533
- i.items.push(qe(o, s, n));
1533
+ i.items.push(Ke(o, s, n));
1534
1534
  }
1535
1535
  return i;
1536
1536
  }
@@ -1540,9 +1540,9 @@ var St = {
1540
1540
  tag: "tag:yaml.org,2002:pairs",
1541
1541
  resolve: bt,
1542
1542
  createNode: xt
1543
- }, Ct = class e extends W {
1543
+ }, Ct = class e extends $e {
1544
1544
  constructor() {
1545
- super(), this.add = U.prototype.add.bind(this), this.delete = U.prototype.delete.bind(this), this.get = U.prototype.get.bind(this), this.has = U.prototype.has.bind(this), this.set = U.prototype.set.bind(this), this.tag = e.tag;
1545
+ super(), this.add = W.prototype.add.bind(this), this.delete = W.prototype.delete.bind(this), this.get = W.prototype.get.bind(this), this.has = W.prototype.has.bind(this), this.set = W.prototype.set.bind(this), this.tag = e.tag;
1546
1546
  }
1547
1547
  toJSON(e, t) {
1548
1548
  if (!t) return super.toJSON(e);
@@ -1550,7 +1550,7 @@ var St = {
1550
1550
  t?.onCreate && t.onCreate(n);
1551
1551
  for (let e of this.items) {
1552
1552
  let r, i;
1553
- if (x(e) ? (r = F(e.key, "", t), i = F(e.value, r, t)) : r = F(e, "", t), n.has(r)) throw Error("Ordered maps must not include duplicate keys");
1553
+ if (x(e) ? (r = I(e.key, "", t), i = I(e.value, r, t)) : r = I(e, "", t), n.has(r)) throw Error("Ordered maps must not include duplicate keys");
1554
1554
  n.set(r, i);
1555
1555
  }
1556
1556
  return n;
@@ -1584,14 +1584,14 @@ var Et = {
1584
1584
  default: !0,
1585
1585
  tag: "tag:yaml.org,2002:bool",
1586
1586
  test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
1587
- resolve: () => new I(!0),
1587
+ resolve: () => new L(!0),
1588
1588
  stringify: Tt
1589
1589
  }, Dt = {
1590
1590
  identify: (e) => e === !1,
1591
1591
  default: !0,
1592
1592
  tag: "tag:yaml.org,2002:bool",
1593
1593
  test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
1594
- resolve: () => new I(!1),
1594
+ resolve: () => new L(!1),
1595
1595
  stringify: Tt
1596
1596
  }, Ot = {
1597
1597
  identify: (e) => typeof e == "number",
@@ -1617,7 +1617,7 @@ var Et = {
1617
1617
  tag: "tag:yaml.org,2002:float",
1618
1618
  test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
1619
1619
  resolve(e) {
1620
- let t = new I(parseFloat(e.replace(/_/g, ""))), n = e.indexOf(".");
1620
+ let t = new L(parseFloat(e.replace(/_/g, ""))), n = e.indexOf(".");
1621
1621
  if (n !== -1) {
1622
1622
  let r = e.substring(n + 1).replace(/_/g, "");
1623
1623
  r[r.length - 1] === "0" && (t.minFractionDigits = r.length);
@@ -1683,22 +1683,22 @@ var Pt = {
1683
1683
  test: /^[-+]?0x[0-9a-fA-F_]+$/,
1684
1684
  resolve: (e, t, n) => Mt(e, 2, 16, n),
1685
1685
  stringify: (e) => Nt(e, 16, "0x")
1686
- }, Rt = class e extends U {
1686
+ }, Rt = class e extends W {
1687
1687
  constructor(t) {
1688
1688
  super(t), this.tag = e.tag;
1689
1689
  }
1690
1690
  add(e) {
1691
1691
  let t;
1692
- t = x(e) ? e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? new H(e.key, null) : new H(e, null), Qe(this.items, t.key) || this.items.push(t);
1692
+ t = x(e) ? e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? new U(e.key, null) : new U(e, null), Ze(this.items, t.key) || this.items.push(t);
1693
1693
  }
1694
1694
  get(e, t) {
1695
- let n = Qe(this.items, e);
1695
+ let n = Ze(this.items, e);
1696
1696
  return !t && x(n) ? S(n.key) ? n.key.value : n.key : n;
1697
1697
  }
1698
1698
  set(e, t) {
1699
1699
  if (typeof t != "boolean") throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);
1700
- let n = Qe(this.items, e);
1701
- n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new H(e));
1700
+ let n = Ze(this.items, e);
1701
+ n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new U(e));
1702
1702
  }
1703
1703
  toJSON(e, t) {
1704
1704
  return super.toJSON(e, t, Set);
@@ -1710,7 +1710,7 @@ var Pt = {
1710
1710
  }
1711
1711
  static from(e, t, n) {
1712
1712
  let { replacer: r } = n, i = new this(e);
1713
- if (t && Symbol.iterator in Object(t)) for (let e of t) typeof r == "function" && (e = r.call(t, e, e)), i.items.push(qe(e, null, n));
1713
+ if (t && Symbol.iterator in Object(t)) for (let e of t) typeof r == "function" && (e = r.call(t, e, e)), i.items.push(Ke(e, null, n));
1714
1714
  return i;
1715
1715
  }
1716
1716
  };
@@ -1778,7 +1778,7 @@ var Ht = {
1778
1778
  },
1779
1779
  stringify: ({ value: e }) => e?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
1780
1780
  }, Gt = [
1781
- $e,
1781
+ Qe,
1782
1782
  tt,
1783
1783
  nt,
1784
1784
  rt,
@@ -1792,7 +1792,7 @@ var Ht = {
1792
1792
  kt,
1793
1793
  At,
1794
1794
  yt,
1795
- V,
1795
+ H,
1796
1796
  wt,
1797
1797
  St,
1798
1798
  zt,
@@ -1802,7 +1802,7 @@ var Ht = {
1802
1802
  ], Kt = /* @__PURE__ */ new Map([
1803
1803
  ["core", mt],
1804
1804
  ["failsafe", [
1805
- $e,
1805
+ Qe,
1806
1806
  tt,
1807
1807
  nt
1808
1808
  ]],
@@ -1820,8 +1820,8 @@ var Ht = {
1820
1820
  intHex: pt,
1821
1821
  intOct: dt,
1822
1822
  intTime: Ht,
1823
- map: $e,
1824
- merge: V,
1823
+ map: Qe,
1824
+ merge: H,
1825
1825
  null: rt,
1826
1826
  omap: wt,
1827
1827
  pairs: St,
@@ -1830,7 +1830,7 @@ var Ht = {
1830
1830
  timestamp: Wt
1831
1831
  }, Jt = {
1832
1832
  "tag:yaml.org,2002:binary": yt,
1833
- "tag:yaml.org,2002:merge": V,
1833
+ "tag:yaml.org,2002:merge": H,
1834
1834
  "tag:yaml.org,2002:omap": wt,
1835
1835
  "tag:yaml.org,2002:pairs": St,
1836
1836
  "tag:yaml.org,2002:set": zt,
@@ -1838,7 +1838,7 @@ var Ht = {
1838
1838
  };
1839
1839
  function Yt(e, t, n) {
1840
1840
  let r = Kt.get(t);
1841
- if (r && !e) return n && !r.includes(V) ? r.concat(V) : r.slice();
1841
+ if (r && !e) return n && !r.includes(H) ? r.concat(H) : r.slice();
1842
1842
  let i = r;
1843
1843
  if (!i) {
1844
1844
  if (Array.isArray(e)) i = [];
@@ -1849,7 +1849,7 @@ function Yt(e, t, n) {
1849
1849
  }
1850
1850
  if (Array.isArray(e)) for (let t of e) i = i.concat(t);
1851
1851
  else typeof e == "function" && (i = e(i.slice()));
1852
- return n && (i = i.concat(V)), i.reduce((e, t) => {
1852
+ return n && (i = i.concat(H)), i.reduce((e, t) => {
1853
1853
  let n = typeof t == "string" ? qt[t] : t;
1854
1854
  if (!n) {
1855
1855
  let e = JSON.stringify(t), n = Object.keys(qt).map((e) => JSON.stringify(e)).join(", ");
@@ -1862,7 +1862,7 @@ function Yt(e, t, n) {
1862
1862
  //#region node_modules/yaml/browser/dist/schema/Schema.js
1863
1863
  var Xt = (e, t) => e.key < t.key ? -1 : +(e.key > t.key), Zt = class e {
1864
1864
  constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: r, schema: i, sortMapEntries: a, toStringDefaults: o }) {
1865
- this.compat = Array.isArray(e) ? Yt(e, "compat") : e ? Yt(null, e) : null, this.name = typeof i == "string" && i || "core", this.knownTags = r ? Jt : {}, this.tags = Yt(t, this.name, n), this.toStringOptions = o ?? null, Object.defineProperty(this, p, { value: $e }), Object.defineProperty(this, h, { value: nt }), Object.defineProperty(this, g, { value: tt }), this.sortMapEntries = typeof a == "function" ? a : a === !0 ? Xt : null;
1865
+ this.compat = Array.isArray(e) ? Yt(e, "compat") : e ? Yt(null, e) : null, this.name = typeof i == "string" && i || "core", this.knownTags = r ? Jt : {}, this.tags = Yt(t, this.name, n), this.toStringOptions = o ?? null, Object.defineProperty(this, p, { value: Qe }), Object.defineProperty(this, h, { value: nt }), Object.defineProperty(this, g, { value: tt }), this.sortMapEntries = typeof a == "function" ? a : a === !0 ? Xt : null;
1866
1866
  }
1867
1867
  clone() {
1868
1868
  let t = Object.create(e.prototype, Object.getOwnPropertyDescriptors(this));
@@ -1878,32 +1878,32 @@ function Qt(e, t) {
1878
1878
  t ? (n.push(t), r = !0) : e.directives.docStart && (r = !0);
1879
1879
  }
1880
1880
  r && n.push("---");
1881
- let i = Pe(e, t), { commentString: a } = i.options;
1881
+ let i = Ne(e, t), { commentString: a } = i.options;
1882
1882
  if (e.commentBefore) {
1883
1883
  n.length !== 1 && n.unshift("");
1884
1884
  let t = a(e.commentBefore);
1885
- n.unshift(B(t, ""));
1885
+ n.unshift(V(t, ""));
1886
1886
  }
1887
1887
  let o = !1, s = null;
1888
1888
  if (e.contents) {
1889
1889
  if (T(e.contents)) {
1890
1890
  if (e.contents.spaceBefore && r && n.push(""), e.contents.commentBefore) {
1891
1891
  let t = a(e.contents.commentBefore);
1892
- n.push(B(t, ""));
1892
+ n.push(V(t, ""));
1893
1893
  }
1894
1894
  i.forceBlockIndent = !!e.comment, s = e.contents.comment;
1895
1895
  }
1896
- let t = s ? void 0 : () => o = !0, c = Le(e.contents, i, () => s = null, t);
1897
- s && (c += ve(c, "", a(s))), (c[0] === "|" || c[0] === ">") && n[n.length - 1] === "---" ? n[n.length - 1] = `--- ${c}` : n.push(c);
1898
- } else n.push(Le(e.contents, i));
1896
+ let t = s ? void 0 : () => o = !0, c = Ie(e.contents, i, () => s = null, t);
1897
+ s && (c += _e(c, "", a(s))), (c[0] === "|" || c[0] === ">") && n[n.length - 1] === "---" ? n[n.length - 1] = `--- ${c}` : n.push(c);
1898
+ } else n.push(Ie(e.contents, i));
1899
1899
  if (e.directives?.docEnd) {
1900
1900
  if (e.comment) {
1901
1901
  let t = a(e.comment);
1902
- t.includes("\n") ? (n.push("..."), n.push(B(t, ""))) : n.push(`... ${t}`);
1902
+ t.includes("\n") ? (n.push("..."), n.push(V(t, ""))) : n.push(`... ${t}`);
1903
1903
  } else n.push("...");
1904
1904
  } else {
1905
1905
  let t = e.comment;
1906
- t && o && (t = t.replace(/^\n+/, "")), t && ((!o || s) && n[n.length - 1] !== "" && n.push(""), n.push(B(a(t), "")));
1906
+ t && o && (t = t.replace(/^\n+/, "")), t && ((!o || s) && n[n.length - 1] !== "" && n.push(""), n.push(V(a(t), "")));
1907
1907
  }
1908
1908
  return n.join("\n") + "\n";
1909
1909
  }
@@ -1926,7 +1926,7 @@ var $t = class e {
1926
1926
  }, n);
1927
1927
  this.options = i;
1928
1928
  let { version: a } = i;
1929
- n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (a = this.directives.yaml.version)) : this.directives = new N({ version: a }), this.setSchema(a, n), this.contents = e === void 0 ? null : this.createNode(e, r, n);
1929
+ n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (a = this.directives.yaml.version)) : this.directives = new P({ version: a }), this.setSchema(a, n), this.contents = e === void 0 ? null : this.createNode(e, r, n);
1930
1930
  }
1931
1931
  clone() {
1932
1932
  let t = Object.create(e.prototype, { [_]: { value: f } });
@@ -1940,10 +1940,10 @@ var $t = class e {
1940
1940
  }
1941
1941
  createAlias(e, t) {
1942
1942
  if (!e.anchor) {
1943
- let n = se(this);
1944
- e.anchor = !t || n.has(t) ? ce(t || "a", n) : t;
1943
+ let n = oe(this);
1944
+ e.anchor = !t || n.has(t) ? se(t || "a", n) : t;
1945
1945
  }
1946
- return new de(e.anchor);
1946
+ return new ue(e.anchor);
1947
1947
  }
1948
1948
  createNode(e, t, n) {
1949
1949
  let r;
@@ -1952,7 +1952,7 @@ var $t = class e {
1952
1952
  let e = t.filter((e) => typeof e == "number" || e instanceof String || e instanceof Number).map(String);
1953
1953
  e.length > 0 && (t = t.concat(e)), r = t;
1954
1954
  } else n === void 0 && t && (n = t, t = void 0);
1955
- let { aliasDuplicateObjects: i, anchorPrefix: a, flow: o, keepUndefined: s, onTagObj: c, tag: l } = n ?? {}, { onAnchor: u, setAnchors: d, sourceObjects: f } = le(this, a || "a"), p = {
1955
+ let { aliasDuplicateObjects: i, anchorPrefix: a, flow: o, keepUndefined: s, onTagObj: c, tag: l } = n ?? {}, { onAnchor: u, setAnchors: d, sourceObjects: f } = ce(this, a || "a"), p = {
1956
1956
  aliasDuplicateObjects: i ?? !0,
1957
1957
  keepUndefined: s ?? !1,
1958
1958
  onAnchor: u,
@@ -1960,49 +1960,49 @@ var $t = class e {
1960
1960
  replacer: r,
1961
1961
  schema: this.schema,
1962
1962
  sourceObjects: f
1963
- }, m = R(e, l, p);
1963
+ }, m = z(e, l, p);
1964
1964
  return o && w(m) && (m.flow = !0), d(), m;
1965
1965
  }
1966
1966
  createPair(e, t, n = {}) {
1967
- return new H(this.createNode(e, null, n), this.createNode(t, null, n));
1967
+ return new U(this.createNode(e, null, n), this.createNode(t, null, n));
1968
1968
  }
1969
1969
  delete(e) {
1970
1970
  return en(this.contents) ? this.contents.delete(e) : !1;
1971
1971
  }
1972
1972
  deleteIn(e) {
1973
- return he(e) ? this.contents != null && (this.contents = null, !0) : en(this.contents) ? this.contents.deleteIn(e) : !1;
1973
+ return me(e) ? this.contents != null && (this.contents = null, !0) : en(this.contents) ? this.contents.deleteIn(e) : !1;
1974
1974
  }
1975
1975
  get(e, t) {
1976
1976
  return w(this.contents) ? this.contents.get(e, t) : void 0;
1977
1977
  }
1978
1978
  getIn(e, t) {
1979
- return he(e) ? !t && S(this.contents) ? this.contents.value : this.contents : w(this.contents) ? this.contents.getIn(e, t) : void 0;
1979
+ return me(e) ? !t && S(this.contents) ? this.contents.value : this.contents : w(this.contents) ? this.contents.getIn(e, t) : void 0;
1980
1980
  }
1981
1981
  has(e) {
1982
1982
  return w(this.contents) ? this.contents.has(e) : !1;
1983
1983
  }
1984
1984
  hasIn(e) {
1985
- return he(e) ? this.contents !== void 0 : w(this.contents) ? this.contents.hasIn(e) : !1;
1985
+ return me(e) ? this.contents !== void 0 : w(this.contents) ? this.contents.hasIn(e) : !1;
1986
1986
  }
1987
1987
  set(e, t) {
1988
- this.contents == null ? this.contents = z(this.schema, [e], t) : en(this.contents) && this.contents.set(e, t);
1988
+ this.contents == null ? this.contents = B(this.schema, [e], t) : en(this.contents) && this.contents.set(e, t);
1989
1989
  }
1990
1990
  setIn(e, t) {
1991
- he(e) ? this.contents = t : this.contents == null ? this.contents = z(this.schema, Array.from(e), t) : en(this.contents) && this.contents.setIn(e, t);
1991
+ me(e) ? this.contents = t : this.contents == null ? this.contents = B(this.schema, Array.from(e), t) : en(this.contents) && this.contents.setIn(e, t);
1992
1992
  }
1993
1993
  setSchema(e, t = {}) {
1994
1994
  typeof e == "number" && (e = String(e));
1995
1995
  let n;
1996
1996
  switch (e) {
1997
1997
  case "1.1":
1998
- this.directives ? this.directives.yaml.version = "1.1" : this.directives = new N({ version: "1.1" }), n = {
1998
+ this.directives ? this.directives.yaml.version = "1.1" : this.directives = new P({ version: "1.1" }), n = {
1999
1999
  resolveKnownTags: !1,
2000
2000
  schema: "yaml-1.1"
2001
2001
  };
2002
2002
  break;
2003
2003
  case "1.2":
2004
2004
  case "next":
2005
- this.directives ? this.directives.yaml.version = e : this.directives = new N({ version: e }), n = {
2005
+ this.directives ? this.directives.yaml.version = e : this.directives = new P({ version: e }), n = {
2006
2006
  resolveKnownTags: !0,
2007
2007
  schema: "core"
2008
2008
  };
@@ -2027,9 +2027,9 @@ var $t = class e {
2027
2027
  mapAsMap: n === !0,
2028
2028
  mapKeyWarned: !1,
2029
2029
  maxAliasCount: typeof r == "number" ? r : 100
2030
- }, s = F(this.contents, t ?? "", o);
2030
+ }, s = I(this.contents, t ?? "", o);
2031
2031
  if (typeof i == "function") for (let { count: e, res: t } of o.anchors.values()) i(t, e);
2032
- return typeof a == "function" ? P(a, { "": s }, "", s) : s;
2032
+ return typeof a == "function" ? F(a, { "": s }, "", s) : s;
2033
2033
  }
2034
2034
  toJSON(e, t) {
2035
2035
  return this.toJS({
@@ -2179,7 +2179,7 @@ function ln(e, t, n) {
2179
2179
  //#region node_modules/yaml/browser/dist/compose/resolve-block-map.js
2180
2180
  var un = "All mapping items must start at the same column";
2181
2181
  function dn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
2182
- let o = new ((a?.nodeClass) ?? U)(n.schema);
2182
+ let o = new ((a?.nodeClass) ?? W)(n.schema);
2183
2183
  n.atRoot &&= !1;
2184
2184
  let s = r.offset, c = null;
2185
2185
  for (let a of r.items) {
@@ -2213,11 +2213,11 @@ function dn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
2213
2213
  m && (f?.type === "block-map" && !_.hasNewline && i(s, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), n.options.strict && p.start < _.found.offset - 1024 && i(g.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
2214
2214
  let c = f ? e(n, f, _, i) : t(n, s, d, null, _, i);
2215
2215
  n.schema.compat && cn(r.indent, f, i), s = c.range[2];
2216
- let l = new H(g, c);
2216
+ let l = new U(g, c);
2217
2217
  n.options.keepSourceTokens && (l.srcToken = a), o.items.push(l);
2218
2218
  } else {
2219
2219
  m && i(g.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), _.comment && (g.comment ? g.comment += "\n" + _.comment : g.comment = _.comment);
2220
- let e = new H(g);
2220
+ let e = new U(g);
2221
2221
  n.options.keepSourceTokens && (e.srcToken = a), o.items.push(e);
2222
2222
  }
2223
2223
  }
@@ -2230,7 +2230,7 @@ function dn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
2230
2230
  //#endregion
2231
2231
  //#region node_modules/yaml/browser/dist/compose/resolve-block-seq.js
2232
2232
  function fn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
2233
- let o = new ((a?.nodeClass) ?? W)(n.schema);
2233
+ let o = new ((a?.nodeClass) ?? $e)(n.schema);
2234
2234
  n.atRoot &&= !1, n.atKey &&= !1;
2235
2235
  let s = r.offset, c = null;
2236
2236
  for (let { start: a, value: l } of r.items) {
@@ -2293,7 +2293,7 @@ function pn(e, t, n, r) {
2293
2293
  //#region node_modules/yaml/browser/dist/compose/resolve-flow-collection.js
2294
2294
  var mn = "Block collections are not allowed within flow collections", hn = (e) => e && (e.type === "block-map" || e.type === "block-seq");
2295
2295
  function gn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
2296
- let o = r.start.source === "{", s = o ? "flow map" : "flow sequence", c = new ((a?.nodeClass) ?? (o ? U : W))(n.schema);
2296
+ let o = r.start.source === "{", s = o ? "flow map" : "flow sequence", c = new ((a?.nodeClass) ?? (o ? W : $e))(n.schema);
2297
2297
  c.flow = !0;
2298
2298
  let l = n.atRoot;
2299
2299
  l && (n.atRoot = !1), n.atKey &&= !1;
@@ -2361,12 +2361,12 @@ function gn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
2361
2361
  } else m && ("source" in m && m.source?.[0] === ":" ? i(m, "MISSING_CHAR", `Missing space after : in ${s}`) : i(_.start, "MISSING_CHAR", `Missing , or : between ${s} items`));
2362
2362
  let v = m ? e(n, m, _, i) : _.found ? t(n, _.end, p, null, _, i) : null;
2363
2363
  v ? hn(m) && i(v.range, "BLOCK_IN_FLOW", mn) : _.comment && (g.comment ? g.comment += "\n" + _.comment : g.comment = _.comment);
2364
- let y = new H(g, v);
2364
+ let y = new U(g, v);
2365
2365
  if (n.options.keepSourceTokens && (y.srcToken = l), o) {
2366
2366
  let e = c;
2367
2367
  ln(n, e.items, g) && i(a, "DUPLICATE_KEY", "Map keys must be unique"), e.items.push(y);
2368
2368
  } else {
2369
- let e = new U(n.schema);
2369
+ let e = new W(n.schema);
2370
2370
  e.flow = !0, e.items.push(y);
2371
2371
  let t = (v ?? g).range;
2372
2372
  e.range = [
@@ -2411,14 +2411,14 @@ function vn(e, t, n, r, i) {
2411
2411
  n && (!t || t.offset < n.offset) && i(n, "MISSING_CHAR", "Missing newline after block sequence props");
2412
2412
  }
2413
2413
  let s = n.type === "block-map" ? "map" : n.type === "block-seq" ? "seq" : n.start.source === "{" ? "map" : "seq";
2414
- if (!a || !o || o === "!" || o === U.tagName && s === "map" || o === W.tagName && s === "seq") return _n(e, t, n, i, o);
2414
+ if (!a || !o || o === "!" || o === W.tagName && s === "map" || o === $e.tagName && s === "seq") return _n(e, t, n, i, o);
2415
2415
  let c = t.schema.tags.find((e) => e.tag === o && e.collection === s);
2416
2416
  if (!c) {
2417
2417
  let r = t.schema.knownTags[o];
2418
2418
  if (r?.collection === s) t.schema.tags.push(Object.assign({}, r, { default: !1 })), c = r;
2419
2419
  else return r ? i(a, "BAD_COLLECTION_TYPE", `${r.tag} used for ${s} collection, but expects ${r.collection ?? "scalar"}`, !0) : i(a, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), _n(e, t, n, i, o);
2420
2420
  }
2421
- let l = _n(e, t, n, i, o, c), u = c.resolve?.(l, (e) => i(a, "TAG_RESOLVE_FAILED", e), t.options) ?? l, d = T(u) ? u : new I(u);
2421
+ let l = _n(e, t, n, i, o, c), u = c.resolve?.(l, (e) => i(a, "TAG_RESOLVE_FAILED", e), t.options) ?? l, d = T(u) ? u : new L(u);
2422
2422
  return d.range = l.range, d.tag = o, c?.format && (d.format = c.format), d;
2423
2423
  }
2424
2424
  //#endregion
@@ -2435,7 +2435,7 @@ function yn(e, t, n) {
2435
2435
  r
2436
2436
  ]
2437
2437
  };
2438
- let a = i.mode === ">" ? I.BLOCK_FOLDED : I.BLOCK_LITERAL, o = t.source ? xn(t.source) : [], s = o.length;
2438
+ let a = i.mode === ">" ? L.BLOCK_FOLDED : L.BLOCK_LITERAL, o = t.source ? xn(t.source) : [], s = o.length;
2439
2439
  for (let e = o.length - 1; e >= 0; --e) {
2440
2440
  let t = o[e][1];
2441
2441
  if (t === "" || t === "\r") s = e;
@@ -2476,7 +2476,7 @@ function yn(e, t, n) {
2476
2476
  let e = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
2477
2477
  n(l - r.length - (s ? 2 : 1), "BAD_INDENT", e), t = "";
2478
2478
  }
2479
- a === I.BLOCK_LITERAL ? (d += f + t.slice(c) + r, f = "\n") : t.length > c || r[0] === " " ? (f === " " ? f = "\n" : !p && f === "\n" && (f = "\n\n"), d += f + t.slice(c) + r, f = "\n", p = !0) : r === "" ? f === "\n" ? d += "\n" : f = "\n" : (d += f + r, f = " ", p = !1);
2479
+ a === L.BLOCK_LITERAL ? (d += f + t.slice(c) + r, f = "\n") : t.length > c || r[0] === " " ? (f === " " ? f = "\n" : !p && f === "\n" && (f = "\n\n"), d += f + t.slice(c) + r, f = "\n", p = !0) : r === "" ? f === "\n" ? d += "\n" : f = "\n" : (d += f + r, f = " ", p = !1);
2480
2480
  }
2481
2481
  switch (i.chomp) {
2482
2482
  case "-": break;
@@ -2552,13 +2552,13 @@ function Sn(e, t, n) {
2552
2552
  let { offset: r, type: i, source: a, end: o } = e, s, c, l = (e, t, i) => n(r + e, t, i);
2553
2553
  switch (i) {
2554
2554
  case "scalar":
2555
- s = I.PLAIN, c = Cn(a, l);
2555
+ s = L.PLAIN, c = Cn(a, l);
2556
2556
  break;
2557
2557
  case "single-quoted-scalar":
2558
- s = I.QUOTE_SINGLE, c = wn(a, l);
2558
+ s = L.QUOTE_SINGLE, c = wn(a, l);
2559
2559
  break;
2560
2560
  case "double-quoted-scalar":
2561
- s = I.QUOTE_DOUBLE, c = En(a, l);
2561
+ s = L.QUOTE_DOUBLE, c = En(a, l);
2562
2562
  break;
2563
2563
  /* istanbul ignore next should not happen */
2564
2564
  default: return n(e, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${i}`), {
@@ -2697,10 +2697,10 @@ function An(e, t, n, r) {
2697
2697
  let u;
2698
2698
  try {
2699
2699
  let a = l.resolve(i, (e) => r(n ?? t, "TAG_RESOLVE_FAILED", e), e.options);
2700
- u = S(a) ? a : new I(a);
2700
+ u = S(a) ? a : new L(a);
2701
2701
  } catch (e) {
2702
2702
  let a = e instanceof Error ? e.message : String(e);
2703
- r(n ?? t, "TAG_RESOLVE_FAILED", a), u = new I(i);
2703
+ r(n ?? t, "TAG_RESOLVE_FAILED", a), u = new L(i);
2704
2704
  }
2705
2705
  return u.range = s, u.source = i, a && (u.type = a), c && (u.tag = c), l.format && (u.format = l.format), o && (u.comment = o), u;
2706
2706
  }
@@ -2787,7 +2787,7 @@ function In(e, t, n, r, { spaceBefore: i, comment: a, anchor: o, tag: s, end: c
2787
2787
  return o && (u.anchor = o.source.substring(1), u.anchor === "" && l(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (u.spaceBefore = !0), a && (u.comment = a, u.range[2] = c), u;
2788
2788
  }
2789
2789
  function Ln({ options: e }, { offset: t, source: n, end: r }, i) {
2790
- let a = new de(n.substring(1));
2790
+ let a = new ue(n.substring(1));
2791
2791
  a.source === "" && i(t, "BAD_ALIAS", "Alias cannot be an empty string"), a.source.endsWith(":") && i(t + n.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
2792
2792
  let o = t + n.length, s = pn(r, o, e.strict, i);
2793
2793
  return a.range = [
@@ -2853,7 +2853,7 @@ var Vn = class {
2853
2853
  this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (e, t, n, r) => {
2854
2854
  let i = zn(e);
2855
2855
  r ? this.warnings.push(new rn(i, t, n)) : this.errors.push(new nn(i, t, n));
2856
- }, this.directives = new N({ version: e.version || "1.2" }), this.options = e;
2856
+ }, this.directives = new P({ version: e.version || "1.2" }), this.options = e;
2857
2857
  }
2858
2858
  decorate(e, t) {
2859
2859
  let { comment: n, afterEmptyLine: r } = Bn(this.prelude);
@@ -2961,7 +2961,7 @@ function Hn(e, t = !0, n) {
2961
2961
  return null;
2962
2962
  }
2963
2963
  function Un(e, t) {
2964
- let { implicitKey: n = !1, indent: r, inFlow: i = !1, offset: a = -1, type: o = "PLAIN" } = t, s = Ne({
2964
+ let { implicitKey: n = !1, indent: r, inFlow: i = !1, offset: a = -1, type: o = "PLAIN" } = t, s = Me({
2965
2965
  type: o,
2966
2966
  value: e
2967
2967
  }, {
@@ -3040,7 +3040,7 @@ function Wn(e, t, n = {}) {
3040
3040
  }
3041
3041
  default: o = "PLAIN";
3042
3042
  }
3043
- let c = Ne({
3043
+ let c = Me({
3044
3044
  type: o,
3045
3045
  value: t
3046
3046
  }, {
@@ -4346,7 +4346,7 @@ function Tr(e, t, n) {
4346
4346
  typeof t == "function" ? r = t : n === void 0 && t && typeof t == "object" && (n = t);
4347
4347
  let i = wr(e, n);
4348
4348
  if (!i) return null;
4349
- if (i.warnings.forEach((e) => ze(i.options.logLevel, e)), i.errors.length > 0) {
4349
+ if (i.warnings.forEach((e) => Re(i.options.logLevel, e)), i.errors.length > 0) {
4350
4350
  if (i.options.logLevel !== "silent") throw i.errors[0];
4351
4351
  i.errors = [];
4352
4352
  }
@@ -4367,20 +4367,20 @@ function Er(e, t, n) {
4367
4367
  //#endregion
4368
4368
  //#region node_modules/yaml/browser/index.js
4369
4369
  var Dr = /* @__PURE__ */ a({
4370
- Alias: () => de,
4370
+ Alias: () => ue,
4371
4371
  CST: () => nr,
4372
4372
  Composer: () => Vn,
4373
4373
  Document: () => $t,
4374
4374
  Lexer: () => fr,
4375
4375
  LineCounter: () => pr,
4376
- Pair: () => H,
4376
+ Pair: () => U,
4377
4377
  Parser: () => xr,
4378
- Scalar: () => I,
4378
+ Scalar: () => L,
4379
4379
  Schema: () => Zt,
4380
4380
  YAMLError: () => tn,
4381
- YAMLMap: () => U,
4381
+ YAMLMap: () => W,
4382
4382
  YAMLParseError: () => nn,
4383
- YAMLSeq: () => W,
4383
+ YAMLSeq: () => $e,
4384
4384
  YAMLWarning: () => rn,
4385
4385
  isAlias: () => v,
4386
4386
  isCollection: () => w,
@@ -4395,7 +4395,7 @@ var Dr = /* @__PURE__ */ a({
4395
4395
  parseDocument: () => wr,
4396
4396
  stringify: () => Er,
4397
4397
  visit: () => A,
4398
- visitAsync: () => te
4398
+ visitAsync: () => j
4399
4399
  }), Or = {
4400
4400
  rawNodes: {
4401
4401
  address: {
@@ -7407,6 +7407,7 @@ var X = class {
7407
7407
  zoneId: e.env?.CLOUDFLARE_ZONE_ID || this.env.CLOUDFLARE_ZONE_ID,
7408
7408
  apiToken: e.env?.CLOUDFLARE_API_TOKEN || this.env.CLOUDFLARE_API_TOKEN,
7409
7409
  frontendUrl: (e.env?.PUBLIC_FRONTEND_URL || this.env.PUBLIC_FRONTEND_URL || "https://kama.t3cloud.eu").replace(/\/+$/, ""),
7410
+ cdnDomain: e.env?.CDN_DOMAIN || this.env.CDN_DOMAIN,
7410
7411
  frontendWorker: e.env?.FRONTEND_WORKER || this.env.FRONTEND_WORKER
7411
7412
  };
7412
7413
  }
@@ -7422,6 +7423,10 @@ var X = class {
7422
7423
  }
7423
7424
  } catch {}
7424
7425
  }
7426
+ getSafeUrl(e, t, n) {
7427
+ let r = e || (t ? `/media/${t}` : "");
7428
+ return r && n && r.startsWith(`https://${n}/`) && !r.includes("/media/") && (r = r.replace(`https://${n}/`, `https://${n}/media/`)), r;
7429
+ }
7425
7430
  async callAstroPurge(e, t) {
7426
7431
  let { apiToken: n, frontendUrl: r, frontendWorker: i } = this.getEnv(e), a = `${r}/api/purge`, o = { "Content-Type": "application/json" };
7427
7432
  return n && (o.Authorization = `Bearer ${n}`), i && typeof i.fetch == "function" ? i.fetch(a, {
@@ -7438,8 +7443,8 @@ var X = class {
7438
7443
  try {
7439
7444
  let a = J(e);
7440
7445
  if (n) {
7441
- let e = await t.prepare("SELECT treeId FROM tree_nodes WHERE contentId = ?").all(n), r = Array.isArray(e) ? e : e?.results || [];
7442
- for (let e of r) await a.delete(`tree:default:${e.treeId}`), await a.delete(`tree:all:${e.treeId}`);
7446
+ let e = t.prepare("SELECT treeId FROM tree_nodes WHERE contentId = ?"), r = typeof e.all == "function" ? await e.all(n) : await e.bind(n).all(), i = Array.isArray(r) ? r : r?.results || [];
7447
+ for (let e of i) await a.delete(`tree:default:${e.treeId}`), await a.delete(`tree:all:${e.treeId}`);
7443
7448
  }
7444
7449
  if (r) {
7445
7450
  let e = r.replace(/^\/+|\/+$/g, "");
@@ -7451,38 +7456,39 @@ var X = class {
7451
7456
  ]) await a.delete(`node:${t}:${i}:${e}`), await a.delete(`node:${t}:${i}:/${e}`);
7452
7457
  }
7453
7458
  if (n) {
7454
- let e = await t.prepare("SELECT c.key, c.id FROM node_channels nc JOIN channels c ON nc.channelId = c.id WHERE nc.nodeId = ?").all(n), o = Array.isArray(e) ? e : e?.results || [];
7455
- for (let e of o) await a.delete(`node:${e.id}:${i}:${r}`), await a.delete(`node:${e.key}:${i}:${r}`);
7459
+ let e = t.prepare("SELECT c.key, c.id FROM node_channels nc JOIN channels c ON nc.channelId = c.id WHERE nc.nodeId = ?"), o = typeof e.all == "function" ? await e.all(n) : await e.bind(n).all(), s = Array.isArray(o) ? o : o?.results || [];
7460
+ for (let e of s) await a.delete(`node:${e.id}:${i}:${r}`), await a.delete(`node:${e.key}:${i}:${r}`);
7456
7461
  }
7457
7462
  } catch (e) {
7458
7463
  console.warn("[CacheManager] Failed to purge internal worker cache:", e);
7459
7464
  }
7460
7465
  }
7461
- purgeAndWarmSlug(e, t, n = []) {
7462
- let r = this.purgeAndWarmSlugDirect(e, t, n);
7463
- this.dispatch(e, r);
7464
- }
7465
- purgeGlobalCache(e, t) {
7466
- let n = this.purgeGlobalCacheDirect(e, t);
7467
- this.dispatch(e, n);
7466
+ purgeNode(e, t, n, r = !1) {
7467
+ let i = (async () => {
7468
+ try {
7469
+ let i = t.prepare("SELECT slug, status, language FROM content_nodes WHERE id = ?"), a = (typeof i.get == "function" ? await i.get(n) : (await i.bind(n).all())?.results?.[0]) || {};
7470
+ if (!a.slug) return;
7471
+ let o = t.prepare("\n SELECT DISTINCT a.cdnUrl, a.storageKeyPrivate\n FROM node_assets na\n JOIN assets a ON na.assetId = a.id\n WHERE na.nodeId = ?\n "), s = typeof o.all == "function" ? await o.all(n) : await o.bind(n).all(), c = (Array.isArray(s) ? s : s?.results || []).map((t) => t.url || this.getSafeUrl(t.cdnUrl, t.storageKeyPrivate, this.getEnv(e).cdnDomain)).filter(Boolean);
7472
+ await this.purgeInternalWorkerCache(e, t, n, a.slug, a.language || "en"), await this.purgeAndWarmSlugDirect(e, a.slug, c), r && (console.log("[CacheManager] Structural change detected. Triggering Global Version Bump..."), await this.purgeGlobalCacheDirect(e, t));
7473
+ } catch (e) {
7474
+ console.warn("[CacheManager] purgeNode failed:", e);
7475
+ }
7476
+ })();
7477
+ this.dispatch(e, i);
7468
7478
  }
7469
- purgeSmart(e, t, n, r, i = [], a = !1) {
7470
- let o = (async () => {
7471
- let o = r;
7472
- !o && n && (o = (await t.prepare("SELECT slug FROM content_nodes WHERE id = ?").get(n))?.slug), o && (await this.purgeInternalWorkerCache(e, t, n, o), await this.purgeAndWarmSlugDirect(e, o, i), a && (console.log("[CacheManager] Structural change detected (Title/Slug). Triggering Global Version Bump..."), await this.purgeGlobalCacheDirect(e, t)));
7479
+ purgeAsset(e, t, n) {
7480
+ let r = (async () => {
7481
+ try {
7482
+ let r = t.prepare("SELECT cdnUrl, storageKeyPrivate FROM assets WHERE id = ? OR parentAssetId = ?"), i = typeof r.all == "function" ? await r.all(n, n) : await r.bind(n, n).all(), a = (Array.isArray(i) ? i : i?.results || []).map((t) => this.getSafeUrl(t.cdnUrl, t.storageKeyPrivate, this.getEnv(e).cdnDomain)).filter(Boolean), o = t.prepare("\n SELECT DISTINCT cn.id, cn.slug, cn.language\n FROM node_assets na\n INNER JOIN content_nodes cn ON na.nodeId = cn.id\n LEFT JOIN assets crop ON na.assetId = crop.id\n WHERE cn.status = 'published' AND (\n na.assetId = ? OR crop.parentAssetId = ? OR crop.id = (SELECT parentAssetId FROM assets WHERE id = ?)\n )\n "), s = typeof o.all == "function" ? await o.all(n, n, n) : await o.bind(n, n, n).all(), c = Array.isArray(s) ? s : s?.results || [];
7483
+ for (let n of c) n.id && n.slug && (await this.purgeInternalWorkerCache(e, t, n.id, n.slug, n.language || "en"), await this.purgeAndWarmSlugDirect(e, n.slug, a));
7484
+ } catch (e) {
7485
+ console.warn("[CacheManager] purgeAsset failed:", e);
7486
+ }
7473
7487
  })();
7474
- this.dispatch(e, o);
7488
+ this.dispatch(e, r);
7475
7489
  }
7476
- async warmAllPublishedPages(e, t) {
7477
- try {
7478
- let { frontendUrl: n } = this.getEnv(e), r = await t.prepare("SELECT DISTINCT slug FROM content_nodes WHERE status = 'published' AND slug IS NOT NULL AND (deletedAt IS NULL OR deletedAt = '')").all(), i = Array.isArray(r) ? r : r?.results || [], a = { "X-Cache-Warmer": "true" }, o = Date.now(), s = i.map((e) => {
7479
- let t = String(e.slug).replace(/^\/+|\/+$/g, ""), r = t === "home" || !t ? n : `${n}/${t}`;
7480
- return fetch(`${r}?_warmer=${o}`, { headers: a }).then((e) => console.log(`🔥 [CacheWarmer] Tree-wide warm for ${t || "/"}: ${e.status}`)).catch((e) => console.warn(`⚠️ [CacheWarmer] Failed to warm ${t}:`, e));
7481
- });
7482
- s.push(fetch(`${n}/?_warmer=${o}`, { headers: a }).then((e) => console.log(`🔥 [CacheWarmer] Tree-wide warm for root /: ${e.status}`)).catch(() => {})), await Promise.all(s), console.log(`✅ [CacheWarmer] Warmed ${s.length} published pages across the tree.`);
7483
- } catch (e) {
7484
- console.warn("⚠️ [CacheWarmer] Tree-wide warming failed:", e);
7485
- }
7490
+ purgeGlobalCache(e, t) {
7491
+ this.dispatch(e, this.purgeGlobalCacheDirect(e, t));
7486
7492
  }
7487
7493
  async purgeGlobalCacheDirect(e, t) {
7488
7494
  try {
@@ -7490,22 +7496,17 @@ var X = class {
7490
7496
  console.log("[CacheManager] Executing Direct Global Version Purge...");
7491
7497
  let a = await this.callAstroPurge(e, { purge_everything: !0 });
7492
7498
  if (!a.ok) {
7493
- let e = await a.text();
7494
- console.error(`❌ [CacheManager] Astro Global Purge FAILED (${a.status}): ${e}`);
7499
+ console.error(`❌ [CacheManager] Astro Global Purge FAILED (${a.status})`);
7495
7500
  return;
7496
7501
  }
7497
- if (console.log("✅ [CacheManager] Astro Global Version Tag Updated"), n && r && fetch(`https://api.cloudflare.com/client/v4/zones/${n}/purge_cache`, {
7502
+ n && r && fetch(`https://api.cloudflare.com/client/v4/zones/${n}/purge_cache`, {
7498
7503
  method: "POST",
7499
7504
  headers: {
7500
7505
  Authorization: `Bearer ${r}`,
7501
7506
  "Content-Type": "application/json"
7502
7507
  },
7503
7508
  body: JSON.stringify({ purge_everything: !0 })
7504
- }).catch((e) => console.warn("⚠️ Zone purge warning:", e)), await new Promise((e) => setTimeout(e, 100)), t) await this.warmAllPublishedPages(e, t);
7505
- else {
7506
- let e = i.replace(/\/+$/, "");
7507
- fetch(`${e}/?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).catch(() => {});
7508
- }
7509
+ }).catch(() => {}), await new Promise((e) => setTimeout(e, 100)), t ? await this.warmAllPublishedPages(e, t) : fetch(`${i.replace(/\/+$/, "")}/?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).catch(() => {});
7509
7510
  } catch (e) {
7510
7511
  console.error("❌ [CacheManager] Direct Global Purge CRASH:", e);
7511
7512
  }
@@ -7519,34 +7520,31 @@ var X = class {
7519
7520
  `https://admin.t3cloud.eu/api/v1/node/${o}?channelId=corporate&lang=en`,
7520
7521
  `https://admin.t3cloud.eu/api/v1/node/${o}?channelId=default&lang=en`
7521
7522
  ];
7522
- for (let e of n) {
7523
- if (!e) continue;
7524
- let t = e.startsWith("/") ? e : `/${e}`;
7525
- c.push(`${a}${t}`);
7526
- }
7527
- console.log(`[CacheManager] Executing Version Invalidation for ${c.length} URLs...`);
7528
- let l = await this.callAstroPurge(e, { urls: c });
7529
- if (!l.ok) {
7530
- let e = await l.text();
7531
- console.error(`❌ [CacheManager] Astro Slug Invalidation FAILED (${l.status}): ${e}`);
7532
- return;
7533
- }
7534
- console.log("✅ [CacheManager] Dual Slug Invalidation SUCCESS"), r && i && fetch(`https://api.cloudflare.com/client/v4/zones/${r}/purge_cache`, {
7523
+ for (let e of n) e && c.push(`${a}${e.startsWith("/") ? e : `/${e}`}`);
7524
+ if (!(await this.callAstroPurge(e, { urls: c })).ok) return;
7525
+ r && i && fetch(`https://api.cloudflare.com/client/v4/zones/${r}/purge_cache`, {
7535
7526
  method: "POST",
7536
7527
  headers: {
7537
7528
  Authorization: `Bearer ${i}`,
7538
7529
  "Content-Type": "application/json"
7539
7530
  },
7540
7531
  body: JSON.stringify({ files: c })
7541
- }).catch((e) => console.warn("⚠️ Zone files purge warning:", e)), await new Promise((e) => setTimeout(e, 100)), await fetch(`${s}?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).then((e) => {
7542
- console.log(`🔥 [CacheWarmer] Warm state for ${s}: ${e.status}`);
7543
- }).catch((e) => {
7544
- console.warn(`⚠️ [CacheWarmer] Failed to warm ${s}:`, e);
7545
- });
7532
+ }).catch(() => {}), await new Promise((e) => setTimeout(e, 100)), fetch(`${s}?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).catch(() => {});
7546
7533
  } catch (e) {
7547
7534
  console.error("❌ [CacheManager] Dual Slug Purge CRASH:", e);
7548
7535
  }
7549
7536
  }
7537
+ async warmAllPublishedPages(e, t) {
7538
+ try {
7539
+ let { frontendUrl: n } = this.getEnv(e), r = t.prepare("SELECT DISTINCT slug FROM content_nodes WHERE status = 'published' AND slug IS NOT NULL AND (deletedAt IS NULL OR deletedAt = '')"), i = typeof r.all == "function" ? await r.all() : await r.bind().all(), a = Array.isArray(i) ? i : i?.results || [], o = { "X-Cache-Warmer": "true" }, s = Date.now(), c = a.map((e) => {
7540
+ let t = String(e.slug).replace(/^\/+|\/+$/g, ""), r = t === "home" || !t ? n : `${n}/${t}`;
7541
+ return fetch(`${r}?_warmer=${s}`, { headers: o }).catch(() => {});
7542
+ });
7543
+ c.push(fetch(`${n}/?_warmer=${s}`, { headers: o }).catch(() => {})), await Promise.all(c);
7544
+ } catch (e) {
7545
+ console.warn("⚠️ [CacheWarmer] Tree-wide warming failed:", e);
7546
+ }
7547
+ }
7550
7548
  }, Z = new e();
7551
7549
  async function ui(e, t, n = []) {
7552
7550
  let r = e.prepare(t);
@@ -7565,25 +7563,18 @@ async function di(e, t, n = []) {
7565
7563
  if (typeof r.bind == "function") return r.bind(...n).run();
7566
7564
  if (typeof r.run == "function") return r.run(...n);
7567
7565
  }
7568
- async function fi(e, t) {
7569
- try {
7570
- return (await ui(e, "\n SELECT DISTINCT a.url\n FROM node_assets na\n JOIN assets a ON na.assetId = a.id\n WHERE na.nodeId = ? AND a.url IS NOT NULL AND a.url != ''\n ", [t])).map((e) => e.url).filter(Boolean);
7571
- } catch {
7572
- return [];
7573
- }
7574
- }
7575
- function pi(e) {
7566
+ function fi(e) {
7576
7567
  return !e || !e.trim() ? null : e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/[\s-]+/g, "-").replace(/^-+|-+$/g, "") || null;
7577
7568
  }
7578
- function mi(e) {
7569
+ function pi(e) {
7579
7570
  return +(e === !0 || e === 1 || e === "1" || e === "true");
7580
7571
  }
7581
- function hi(e) {
7572
+ function mi(e) {
7582
7573
  if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
7583
7574
  let t = Number(e);
7584
7575
  return isNaN(t) ? null : t;
7585
7576
  }
7586
- function gi(e) {
7577
+ function hi(e) {
7587
7578
  let t = { ...e };
7588
7579
  for (let e of [
7589
7580
  "id",
@@ -7612,10 +7603,10 @@ function gi(e) {
7612
7603
  ]) delete t[e];
7613
7604
  return t;
7614
7605
  }
7615
- function _i(e, t = /* @__PURE__ */ new Set()) {
7616
- return e ? typeof e == "string" ? (e.startsWith("ast_") && t.add(e), t) : Array.isArray(e) ? (e.forEach((e) => _i(e, t)), t) : (typeof e == "object" && Object.values(e).forEach((e) => _i(e, t)), t) : t;
7606
+ function gi(e, t = /* @__PURE__ */ new Set()) {
7607
+ return e ? typeof e == "string" ? (e.startsWith("ast_") && t.add(e), t) : Array.isArray(e) ? (e.forEach((e) => gi(e, t)), t) : (typeof e == "object" && Object.values(e).forEach((e) => gi(e, t)), t) : t;
7617
7608
  }
7618
- async function vi(e, t, n) {
7609
+ async function _i(e, t, n) {
7619
7610
  for (let r of n) {
7620
7611
  let n = (await ui(e, "\n SELECT id, storageKeyPrivate, isSystemVariant, parentAssetId, filename\n FROM assets WHERE id = ?\n ", [r]))[0];
7621
7612
  if (!n || (await ui(e, "SELECT 1 FROM node_assets WHERE assetId = ? LIMIT 1", [n.id])).length > 0) continue;
@@ -7634,7 +7625,7 @@ async function vi(e, t, n) {
7634
7625
  await di(e, `DELETE FROM node_assets WHERE assetId IN (${o})`, a), await di(e, `DELETE FROM assets WHERE id IN (${o})`, a);
7635
7626
  }
7636
7627
  }
7637
- async function yi(e, t, n) {
7628
+ async function vi(e, t, n) {
7638
7629
  let r = {}, i = null;
7639
7630
  if (t) {
7640
7631
  let n = await e.prepare("\n WITH RECURSIVE ancestor_path(id, parentId, draftDataJson, dataJson, level) AS (\n SELECT t.id, t.parentId, c.draftDataJson, c.dataJson, 0\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n WHERE t.id = ?\n UNION ALL\n SELECT t.id, t.parentId, c.draftDataJson, c.dataJson, ap.level + 1\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n INNER JOIN ancestor_path ap ON t.id = ap.parentId\n )\n SELECT draftDataJson, dataJson FROM ancestor_path ORDER BY level ASC\n ").all(t), a = Array.isArray(n) ? n : n?.results || [];
@@ -7686,18 +7677,18 @@ Z.get("/", async (e) => {
7686
7677
  if (s) try {
7687
7678
  let n = typeof s == "string" ? JSON.parse(s) : s, a = await t.prepare("SELECT id as treeNodeId, treeId, parentId FROM tree_nodes WHERE contentId = ? LIMIT 1").get(r), c = li(e.env?.BUNDLED_DEFINITIONS).nodes?.[i.contentType] || {}, l = n.layoutId || null;
7688
7679
  if (a) {
7689
- let { resolvedLayoutId: e, inheritedFields: r } = await yi(t, a.parentId, a.treeId);
7680
+ let { resolvedLayoutId: e, inheritedFields: r } = await vi(t, a.parentId, a.treeId);
7690
7681
  (l === "inherit" || !l) && (l = e || c.defaultLayout || null);
7691
7682
  for (let [e, t] of Object.entries(r)) (n[e] === void 0 || n[e] === null || n[e] === "") && t !== void 0 && (n[e] = t);
7692
7683
  } else (l === "inherit" || !l) && (l = c.defaultLayout || null);
7693
- let u = await oi(t, gi(n));
7684
+ let u = await oi(t, hi(n));
7694
7685
  Object.assign(o, u), o.resolvedLayoutId = l;
7695
7686
  } catch {}
7696
7687
  let c = await t.prepare("SELECT channelId FROM node_channels WHERE nodeId = ?").all(r);
7697
7688
  o.channels = (Array.isArray(c) ? c : c?.results || []).map((e) => e.channelId);
7698
7689
  let l = await t.prepare("SELECT treeId, parentId, sortOrder FROM tree_nodes WHERE contentId = ?").all(r);
7699
7690
  o.trees = Array.isArray(l) ? l : l?.results || [];
7700
- let u = await t.prepare("\n SELECT * FROM content_blocks \n WHERE contentId = ? AND isDraft = 1 \n ORDER BY sortOrder ASC\n ").all(r), d = Array.isArray(u) ? u : u?.results || [], f = await Promise.all(d.map(async (e) => {
7691
+ let u = await t.prepare("SELECT * FROM content_blocks WHERE contentId = ? AND isDraft = 1 ORDER BY sortOrder ASC").all(r), d = Array.isArray(u) ? u : u?.results || [], f = await Promise.all(d.map(async (e) => {
7701
7692
  let n = {};
7702
7693
  try {
7703
7694
  n = typeof e.dataJson == "string" ? JSON.parse(e.dataJson || "{}") : e.dataJson || {}, n && typeof n == "object" && (n = await oi(t, n));
@@ -7719,12 +7710,9 @@ Z.get("/", async (e) => {
7719
7710
  });
7720
7711
  }
7721
7712
  let m = [], h = [o ? "(cn.deletedAt IS NOT NULL AND cn.deletedAt != '')" : "(cn.deletedAt IS NULL OR cn.deletedAt = '')"];
7722
- if (a && a !== "all" && (h.push("EXISTS (SELECT 1 FROM node_channels nc WHERE nc.nodeId = cn.id AND nc.channelId = ?)"), m.push(Number(a) || a)), s && (h.push("\n EXISTS (\n SELECT 1 FROM node_assets na_f \n JOIN assets a_f ON a_f.id = na_f.assetId\n WHERE na_f.nodeId = cn.id \n AND (\n na_f.assetId = ? \n OR a_f.parentAssetId = ? \n OR a_f.id = (SELECT parentAssetId FROM assets WHERE id = ?)\n )\n )\n "), m.push(s, s, s)), r && r !== "all") {
7713
+ if (a && a !== "all" && (h.push("EXISTS (SELECT 1 FROM node_channels nc WHERE nc.nodeId = cn.id AND nc.channelId = ?)"), m.push(Number(a) || a)), s && (h.push("\n EXISTS (\n SELECT 1 FROM node_assets na_f \n JOIN assets a_f ON a_f.id = na_f.assetId\n WHERE na_f.nodeId = cn.id \n AND (na_f.assetId = ? OR a_f.parentAssetId = ? OR a_f.id = (SELECT parentAssetId FROM assets WHERE id = ?))\n )\n "), m.push(s, s, s)), r && r !== "all") {
7723
7714
  let e = r.split(",").map((e) => e.trim()).filter(Boolean);
7724
- if (e.length > 0) {
7725
- let t = e.map(() => "?").join(",");
7726
- h.push(`cn.contentType IN (${t})`), m.push(...e);
7727
- }
7715
+ e.length > 0 && (h.push(`cn.contentType IN (${e.map(() => "?").join(",")})`), m.push(...e));
7728
7716
  }
7729
7717
  if (i && i.trim()) {
7730
7718
  h.push("(cn.title LIKE ? OR cn.slug LIKE ?)");
@@ -7744,19 +7732,12 @@ Z.get("/", async (e) => {
7744
7732
  b[c] && (y = b[c]);
7745
7733
  let x = `
7746
7734
  WITH filtered_nodes AS (
7747
- SELECT cn.*
7748
- FROM content_nodes cn
7749
- ${g}
7750
- ORDER BY ${y} ${l}
7751
- LIMIT ? OFFSET ?
7735
+ SELECT cn.* FROM content_nodes cn ${g} ORDER BY ${y} ${l} LIMIT ? OFFSET ?
7752
7736
  )
7753
- SELECT
7754
- fn.*,
7755
- COUNT(na.assetId) as assetCount
7737
+ SELECT fn.*, COUNT(na.assetId) as assetCount
7756
7738
  FROM filtered_nodes fn
7757
7739
  LEFT JOIN node_assets na ON fn.id = na.nodeId
7758
- GROUP BY fn.id
7759
- ORDER BY ${y.replace("cn.", "fn.")} ${l}
7740
+ GROUP BY fn.id ORDER BY ${y.replace("cn.", "fn.")} ${l}
7760
7741
  `, S = [
7761
7742
  ...m,
7762
7743
  f,
@@ -7764,19 +7745,17 @@ Z.get("/", async (e) => {
7764
7745
  ], C = await t.prepare(x).all(...S), w = Array.isArray(C) ? C : C?.results || [], T = w.map((e) => e.id), E = {}, D = {};
7765
7746
  if (T.length > 0) {
7766
7747
  let e = T.map(() => "?").join(","), n = await t.prepare(`
7767
- SELECT nc.nodeId, c.label
7768
- FROM node_channels nc
7769
- JOIN channels c ON nc.channelId = c.id
7770
- WHERE nc.nodeId IN (${e})
7771
- `).all(...T), r = Array.isArray(n) ? n : n?.results || [];
7772
- for (let e of r) E[e.nodeId] || (E[e.nodeId] = []), E[e.nodeId].push(e.label);
7773
- let i = await t.prepare(`
7774
- SELECT tn.contentId as nodeId, t.label
7775
- FROM tree_nodes tn
7776
- JOIN trees t ON tn.treeId = t.id
7777
- WHERE tn.contentId IN (${e})
7778
- `).all(...T), a = Array.isArray(i) ? i : a?.results || [];
7779
- for (let e of a) D[e.nodeId] || (D[e.nodeId] = []), D[e.nodeId].includes(e.label) || D[e.nodeId].push(e.label);
7748
+ SELECT nc.nodeId, c.label FROM node_channels nc JOIN channels c ON nc.channelId = c.id WHERE nc.nodeId IN (${e})
7749
+ `).all(...T);
7750
+ (Array.isArray(n) ? n : n?.results || []).forEach((e) => {
7751
+ E[e.nodeId] || (E[e.nodeId] = []), E[e.nodeId].push(e.label);
7752
+ });
7753
+ let r = await t.prepare(`
7754
+ SELECT tn.contentId as nodeId, t.label FROM tree_nodes tn JOIN trees t ON tn.treeId = t.id WHERE tn.contentId IN (${e})
7755
+ `).all(...T);
7756
+ (Array.isArray(r) ? r : r?.results || []).forEach((e) => {
7757
+ D[e.nodeId] || (D[e.nodeId] = []), D[e.nodeId].includes(e.label) || D[e.nodeId].push(e.label);
7758
+ });
7780
7759
  }
7781
7760
  let O = await Promise.all(w.map(async (e) => {
7782
7761
  let n = (e.status === "draft" || !e.status) && !!e.publishedAt, r = {
@@ -7800,7 +7779,7 @@ Z.get("/", async (e) => {
7800
7779
  assetCount: e.assetCount || 0
7801
7780
  }, i = e.draftDataJson || e.dataJson;
7802
7781
  if (i) try {
7803
- let e = typeof i == "string" ? JSON.parse(i) : i, n = await oi(t, gi(e));
7782
+ let e = typeof i == "string" ? JSON.parse(i) : i, n = await oi(t, hi(e));
7804
7783
  Object.assign(r, n);
7805
7784
  } catch {}
7806
7785
  return r;
@@ -7813,29 +7792,35 @@ Z.get("/", async (e) => {
7813
7792
  limit: f
7814
7793
  });
7815
7794
  }), Z.post("/", async (e) => {
7816
- let t = e.get("db"), n = await e.req.json(), r = n.node || n.activeNode || n, i = r.id || n.id, a = i != null && i !== "" && !isNaN(Number(i)) ? Number(i) : null, { title: o, slug: s, language: c, nodeType: l, contentType: u, isHidden: d, hidden: f, is_hidden: p, blocks: m, channels: h, trees: g, ..._ } = r, { cleanedData: v, assetRefs: y } = ri(gi(_)), b = mi(d === void 0 ? f === void 0 ? p : f : d), x = c || "en", S = l || u || "page", C = e.get("user")?.id || null, w = a, T = /* @__PURE__ */ new Set(), E = s === void 0 ? null : pi(s);
7795
+ let t = e.get("db"), n = await e.req.json(), r = n.node || n.activeNode || n, i = r.id || n.id, a = i != null && i !== "" && !isNaN(Number(i)) ? Number(i) : null, { title: o, slug: s, language: c, nodeType: l, contentType: u, isHidden: d, hidden: f, is_hidden: p, blocks: m, channels: h, trees: g, ..._ } = r, { cleanedData: v, assetRefs: y } = ri(hi(_)), b = pi(d === void 0 ? f === void 0 ? p : f : d), x = c || "en", S = l || u || "page", C = e.get("user")?.id || null, w = a, T = /* @__PURE__ */ new Set(), E = s === void 0 ? null : fi(s);
7817
7796
  if (E) {
7818
- let n = !1;
7819
- if (g !== void 0 && Array.isArray(g) && g.length > 0) for (let e of g) {
7820
- let r = Number(e.treeId), i = hi(e.parentId ?? e._draftParentId ?? null), o = i === null ? "tn.parentId IS NULL" : "tn.parentId = ?", s = i === null ? [r, E] : [
7821
- r,
7822
- i,
7797
+ let n = !1, r = [];
7798
+ if (g !== void 0 && Array.isArray(g) && g.length > 0) for (let e of g) r.push({
7799
+ treeId: Number(e.treeId),
7800
+ parentId: mi(e.parentId ?? e._draftParentId ?? null)
7801
+ });
7802
+ else if (a) {
7803
+ let e = await t.prepare("SELECT treeId, parentId FROM tree_nodes WHERE contentId = ?").all(a), n = Array.isArray(e) ? e : e?.results || [];
7804
+ for (let e of n) r.push({
7805
+ treeId: Number(e.treeId),
7806
+ parentId: e.parentId === null ? null : Number(e.parentId)
7807
+ });
7808
+ }
7809
+ for (let e of r) {
7810
+ let r = e.parentId === null ? "tn.parentId IS NULL" : "tn.parentId = ?", i = e.parentId === null ? [e.treeId, E] : [
7811
+ e.treeId,
7812
+ e.parentId,
7823
7813
  E
7824
- ], c = `
7825
- SELECT 1
7826
- FROM tree_nodes tn
7827
- INNER JOIN content_nodes cn ON tn.contentId = cn.id
7828
- WHERE tn.treeId = ?
7829
- AND ${o}
7830
- AND cn.slug = ?
7831
- AND (cn.deletedAt IS NULL OR cn.deletedAt = '')
7832
- `;
7833
- if (a && (c += " AND cn.id != ?", s.push(a)), c += " LIMIT 1", await t.prepare(c).get(...s)) {
7814
+ ], o = `
7815
+ SELECT cn.id FROM tree_nodes tn
7816
+ INNER JOIN content_nodes cn ON tn.contentId = cn.id
7817
+ WHERE tn.treeId = ? AND ${r} AND cn.slug = ? AND (cn.deletedAt IS NULL OR cn.deletedAt = '')
7818
+ `;
7819
+ if (a && (o += " AND cn.id != ?", i.push(a)), o += " LIMIT 1", await t.prepare(o).get(...i)) {
7834
7820
  n = !0;
7835
7821
  break;
7836
7822
  }
7837
7823
  }
7838
- else a && await t.prepare("\n SELECT 1\n FROM content_nodes cn\n JOIN tree_nodes tn_other ON cn.id = tn_other.contentId\n JOIN tree_nodes tn_self ON tn_other.treeId = tn_self.treeId AND IFNULL(tn_other.parentId, -1) = IFNULL(tn_self.parentId, -1)\n WHERE cn.slug = ?\n AND cn.id != ?\n AND tn_self.contentId = ?\n AND (cn.deletedAt IS NULL OR cn.deletedAt = '')\n LIMIT 1\n ").get(E, a, a) && (n = !0);
7839
7824
  if (n) return e.json({
7840
7825
  error: `The slug '${E}' is already in use by another page in this section.`,
7841
7826
  field: "slug"
@@ -7844,13 +7829,13 @@ Z.get("/", async (e) => {
7844
7829
  if (a) {
7845
7830
  let e = await t.prepare("SELECT title, slug, language, contentType, draftDataJson, dataJson, publishedAt, status FROM content_nodes WHERE id = ?").get(a), n = e?.draftDataJson || e?.dataJson || "{}";
7846
7831
  try {
7847
- _i(typeof n == "string" ? JSON.parse(n) : n, T);
7832
+ gi(typeof n == "string" ? JSON.parse(n) : n, T);
7848
7833
  } catch {}
7849
7834
  if (m !== void 0) {
7850
7835
  let e = await t.prepare("SELECT dataJson FROM content_blocks WHERE contentId = ? AND isDraft = 1").all(a);
7851
7836
  (Array.isArray(e) ? e : e?.results || []).forEach((e) => {
7852
7837
  try {
7853
- _i(typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson, T);
7838
+ gi(typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson, T);
7854
7839
  } catch {}
7855
7840
  });
7856
7841
  }
@@ -7862,17 +7847,17 @@ Z.get("/", async (e) => {
7862
7847
  ...u,
7863
7848
  ...v
7864
7849
  });
7865
- await t.prepare("\n UPDATE content_nodes \n SET title = ?, \n slug = ?, \n language = ?,\n contentType = ?, \n isHidden = ?, \n status = 'draft', \n draftDataJson = ?, \n updatedById = ?, \n updatedAt = CURRENT_TIMESTAMP\n WHERE id = ?\n ").run(r, i, c, s, b, d, C, a);
7850
+ await t.prepare("\n UPDATE content_nodes \n SET title = ?, slug = ?, language = ?, contentType = ?, isHidden = ?, status = 'draft', draftDataJson = ?, updatedById = ?, updatedAt = CURRENT_TIMESTAMP\n WHERE id = ?\n ").run(r, i, c, s, b, d, C, a);
7866
7851
  } else {
7867
- let e = o || "Untitled", n = E, r = JSON.stringify(v), i = await t.prepare("\n INSERT INTO content_nodes (contentType, title, slug, language, isHidden, status, draftDataJson, dataJson, createdById, updatedById)\n VALUES (?, ?, ?, ?, ?, 'draft', ?, NULL, ?, ?)\n ").run(S, e, n, x, b, r, C, C);
7868
- w = Number(i.lastInsertRowid);
7852
+ let e = await t.prepare("\n INSERT INTO content_nodes (contentType, title, slug, language, isHidden, status, draftDataJson, dataJson, createdById, updatedById)\n VALUES (?, ?, ?, ?, ?, 'draft', ?, NULL, ?, ?)\n ").run(S, o || "Untitled", E, x, b, JSON.stringify(v), C, C);
7853
+ w = Number(e.lastInsertRowid);
7869
7854
  }
7870
7855
  if (h !== void 0 && Array.isArray(h) && w) {
7871
7856
  await t.prepare("DELETE FROM node_channels WHERE nodeId = ?").run(w);
7872
- let e = h.map((e) => typeof e == "object" && e ? e.id || e.channelId : e), n = [...new Set(e)].filter((e) => e && e !== "all").map((e) => Number(e) || e);
7873
- if (n.length > 0) {
7874
- let e = n.map(() => "(?, ?)").join(", "), r = n.flatMap((e) => [w, e]);
7875
- await t.prepare(`INSERT OR IGNORE INTO node_channels (nodeId, channelId) VALUES ${e}`).run(...r);
7857
+ let e = [...new Set(h.map((e) => typeof e == "object" && e ? e.id || e.channelId : e))].filter((e) => e && e !== "all").map((e) => Number(e) || e);
7858
+ if (e.length > 0) {
7859
+ let n = e.map(() => "(?, ?)").join(", "), r = e.flatMap((e) => [w, e]);
7860
+ await t.prepare(`INSERT OR IGNORE INTO node_channels (nodeId, channelId) VALUES ${n}`).run(...r);
7876
7861
  }
7877
7862
  }
7878
7863
  if (g !== void 0 && Array.isArray(g) && g.length > 0 && w) {
@@ -7881,10 +7866,10 @@ Z.get("/", async (e) => {
7881
7866
  let t = Number(e.treeId) || e.treeId;
7882
7867
  if (!r.has(t)) {
7883
7868
  r.add(t);
7884
- let o = n.find((e) => Number(e.treeId) === Number(t)), s = hi(e.parentId ?? e._draftParentId ?? null);
7869
+ let o = n.find((e) => Number(e.treeId) === Number(t)), s = mi(e.parentId ?? e._draftParentId ?? null);
7885
7870
  s === null && o && o.parentId !== null && (s = o.parentId);
7886
- let c = 0;
7887
- typeof e.sortOrder == "number" ? c = e.sortOrder : o && typeof o.sortOrder == "number" && (c = o.sortOrder), i.push("(?, ?, ?, ?)"), a.push(t, w, s, c);
7871
+ let c = typeof e.sortOrder == "number" ? e.sortOrder : o && typeof o.sortOrder == "number" ? o.sortOrder : 0;
7872
+ i.push("(?, ?, ?, ?)"), a.push(t, w, s, c);
7888
7873
  }
7889
7874
  }
7890
7875
  i.length > 0 && (await t.prepare("DELETE FROM tree_nodes WHERE contentId = ?").run(w), await t.prepare(`INSERT INTO tree_nodes (treeId, contentId, parentId, sortOrder) VALUES ${i.join(", ")}`).run(...a));
@@ -7899,12 +7884,10 @@ Z.get("/", async (e) => {
7899
7884
  blockId: o,
7900
7885
  _instanceId: o
7901
7886
  });
7902
- c.forEach((e) => {
7903
- D.push({
7904
- ...e,
7905
- fieldKey: `blocks[${t}].${e.fieldKey}`
7906
- });
7907
- });
7887
+ c.forEach((e) => D.push({
7888
+ ...e,
7889
+ fieldKey: `blocks[${t}].${e.fieldKey}`
7890
+ }));
7908
7891
  let l = r.region !== void 0 && r.region !== null && String(r.region).trim() !== "" ? String(r.region) : "content";
7909
7892
  e.push("(?, ?, ?, ?, ?, 1)"), n.push(w, t, i, JSON.stringify(s), l);
7910
7893
  }
@@ -7914,7 +7897,7 @@ Z.get("/", async (e) => {
7914
7897
  let n = [...y, ...D];
7915
7898
  await ii(t, w, n);
7916
7899
  let r = new Set(n.map((e) => e.assetId)), i = new Set([...T].filter((e) => !r.has(e)));
7917
- i.size > 0 && await vi(t, ni(e.env), i);
7900
+ i.size > 0 && await _i(t, ni(e.env), i);
7918
7901
  }
7919
7902
  return await J(e).clear(), e.json({
7920
7903
  success: !0,
@@ -7935,7 +7918,7 @@ Z.get("/", async (e) => {
7935
7918
  c = typeof o.draftDataJson == "string" ? JSON.parse(o.draftDataJson) : o.draftDataJson || {};
7936
7919
  } catch {}
7937
7920
  let l = (s.title ?? o.title ?? "").trim(), u = (c.title ?? n.title ?? o.title ?? "").trim(), d = (s.slug ?? o.slug ?? "").trim(), f = (c.slug ?? n.slug ?? o.slug ?? "").trim(), p = l !== "" && u !== "" && l !== u || d !== "" && f !== "" && d !== f, m = o.draftDataJson || o.dataJson || "{}";
7938
- await t.prepare("\n UPDATE content_nodes\n SET publishedDataJson = ?,\n dataJson = ?,\n publishedAt = CURRENT_TIMESTAMP,\n status = 'published',\n updatedById = ?,\n updatedAt = CURRENT_TIMESTAMP\n WHERE id = ?\n ").run(m, m, a, i), await t.prepare("DELETE FROM content_blocks WHERE contentId = ? AND isDraft = 0").run(i);
7921
+ await t.prepare("\n UPDATE content_nodes\n SET publishedDataJson = ?, dataJson = ?, publishedAt = CURRENT_TIMESTAMP, status = 'published', updatedById = ?, updatedAt = CURRENT_TIMESTAMP\n WHERE id = ?\n ").run(m, m, a, i), await t.prepare("DELETE FROM content_blocks WHERE contentId = ? AND isDraft = 0").run(i);
7939
7922
  let h = await t.prepare("SELECT * FROM content_blocks WHERE contentId = ? AND isDraft = 1 ORDER BY sortOrder ASC").all(i), g = Array.isArray(h) ? h : h?.results || [];
7940
7923
  if (g.length > 0) {
7941
7924
  let e = [], n = [];
@@ -7954,9 +7937,7 @@ Z.get("/", async (e) => {
7954
7937
  },
7955
7938
  blocks: g
7956
7939
  };
7957
- await t.prepare("\n INSERT INTO node_revisions (nodeId, version, snapshotJson, createdById)\n VALUES (?, ?, ?, ?)\n ").run(i, _, v.publishedAt, a), await J(e).clear();
7958
- let y = await fi(t, i), b = new X(e.env);
7959
- return b.purgeInternalWorkerCache(e, t, i, o.slug, o.language || "en"), b.purgeSmart(e, t, i, o.slug, y, p), e.json({
7940
+ return await t.prepare("INSERT INTO node_revisions (nodeId, version, snapshotJson, createdById) VALUES (?, ?, ?, ?)").run(i, _, v.publishedAt, a), await J(e).clear(), new X(e.env).purgeNode(e, t, i, p), e.json({
7960
7941
  success: !0,
7961
7942
  id: i,
7962
7943
  status: "published",
@@ -7966,45 +7947,30 @@ Z.get("/", async (e) => {
7966
7947
  }), Z.delete("/", async (e) => {
7967
7948
  let t = e.get("db"), n = e.req.query("id");
7968
7949
  if (!n) return e.json({ error: "Node ID required" }, 400);
7969
- let r = Number(n), i = await t.prepare("SELECT slug, language, status FROM content_nodes WHERE id = ?").get(r);
7970
- await t.prepare("UPDATE content_nodes SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?").run(r), await J(e).clear();
7971
- let a = new X(e.env);
7972
- if (i && a.purgeInternalWorkerCache(e, t, r, i.slug, i.language || "en"), i && i.status === "published") {
7973
- let n = await fi(t, r);
7974
- i.slug && a.purgeAndWarmSlug(e, i.slug, n), a.purgeSmart(e, t, r, i.slug, n, !0);
7975
- }
7976
- return e.json({
7950
+ let r = Number(n);
7951
+ return await t.prepare("UPDATE content_nodes SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?").run(r), await J(e).clear(), new X(e.env).purgeNode(e, t, r, !0), e.json({
7977
7952
  success: !0,
7978
7953
  deletedNodeId: r
7979
7954
  });
7980
7955
  }), Z.post("/restore", async (e) => {
7981
7956
  let t = e.get("db"), n = await e.req.json(), r = Number(n.id);
7982
- if (!r) return e.json({ error: "Node ID required" }, 400);
7983
- let i = await t.prepare("SELECT slug, language, status FROM content_nodes WHERE id = ?").get(r);
7984
- if (!i) return e.json({ error: "Node not found" }, 404);
7985
- await t.prepare("UPDATE content_nodes SET deletedAt = NULL WHERE id = ?").run(r), await J(e).clear();
7986
- let a = new X(e.env);
7987
- if (i && a.purgeInternalWorkerCache(e, t, r, i.slug, i.language || "en"), i && i.status === "published") {
7988
- let n = await fi(t, r);
7989
- i.slug && a.purgeAndWarmSlug(e, i.slug, n), a.purgeSmart(e, t, r, i.slug, n, !0);
7990
- }
7991
- return e.json({
7957
+ return r ? await t.prepare("SELECT id FROM content_nodes WHERE id = ?").get(r) ? (await t.prepare("UPDATE content_nodes SET deletedAt = NULL WHERE id = ?").run(r), await J(e).clear(), new X(e.env).purgeNode(e, t, r, !0), e.json({
7992
7958
  success: !0,
7993
7959
  restoredNodeId: r
7994
- });
7960
+ })) : e.json({ error: "Node not found" }, 404) : e.json({ error: "Node ID required" }, 400);
7995
7961
  }), Z.delete("/purge", async (e) => {
7996
7962
  let t = e.get("db"), n = e.req.query("id");
7997
7963
  if (!n) return e.json({ error: "Node ID required" }, 400);
7998
- let r = Number(n), i = await t.prepare("SELECT slug, language, status FROM content_nodes WHERE id = ?").get(r), a = await fi(t, r), o = new X(e.env);
7999
- return i && o.purgeInternalWorkerCache(e, t, r, i.slug, i.language || "en"), await t.prepare("DELETE FROM node_channels WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM tree_nodes WHERE contentId = ?").run(r), await t.prepare("DELETE FROM content_blocks WHERE contentId = ?").run(r), await t.prepare("DELETE FROM node_revisions WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM node_assets WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM content_nodes WHERE id = ?").run(r), await J(e).clear(), i && i.status === "published" && (i.slug && o.purgeAndWarmSlug(e, i.slug, a), o.purgeSmart(e, t, r, i.slug, a, !0)), e.json({
7964
+ let r = Number(n);
7965
+ return new X(e.env).purgeNode(e, t, r, !0), await t.prepare("DELETE FROM node_channels WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM tree_nodes WHERE contentId = ?").run(r), await t.prepare("DELETE FROM content_blocks WHERE contentId = ?").run(r), await t.prepare("DELETE FROM node_revisions WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM node_assets WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM content_nodes WHERE id = ?").run(r), await J(e).clear(), e.json({
8000
7966
  success: !0,
8001
7967
  purgedNodeId: r
8002
7968
  });
8003
7969
  });
8004
7970
  //#endregion
8005
7971
  //#region server/routes/admin/trees.ts
8006
- var bi = new e();
8007
- function xi(e, t = null) {
7972
+ var yi = new e();
7973
+ function bi(e, t = null) {
8008
7974
  let n = [];
8009
7975
  for (let r = 0; r < e.length; r++) {
8010
7976
  let i = e[r];
@@ -8016,19 +7982,19 @@ function xi(e, t = null) {
8016
7982
  id: o,
8017
7983
  parentId: t,
8018
7984
  sortOrder: r
8019
- }), i.children && Array.isArray(i.children) && i.children.length > 0 && n.push(...xi(i.children, o)));
7985
+ }), i.children && Array.isArray(i.children) && i.children.length > 0 && n.push(...bi(i.children, o)));
8020
7986
  }
8021
7987
  return n;
8022
7988
  }
8023
- function Si(e) {
7989
+ function xi(e) {
8024
7990
  if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
8025
7991
  let t = Number(e);
8026
7992
  return isNaN(t) ? null : t;
8027
7993
  }
8028
- function Ci(e) {
7994
+ function Si(e) {
8029
7995
  return +(e === !0 || e === 1 || e === "1" || e === "true");
8030
7996
  }
8031
- bi.get("/tree.json", async (e) => {
7997
+ yi.get("/tree.json", async (e) => {
8032
7998
  try {
8033
7999
  let t = e.get("db"), n = e.req.query("treeId") || "main-nav", r = e.req.query("preview") === "true", i = 1;
8034
8000
  if (isNaN(Number(n))) {
@@ -8078,7 +8044,7 @@ bi.get("/tree.json", async (e) => {
8078
8044
  } catch (t) {
8079
8045
  return console.error("[CMS Tree API] GET Error:", t), e.json({ error: t.message || "Failed to fetch tree" }, 500);
8080
8046
  }
8081
- }), bi.post("/tree.json", async (e) => {
8047
+ }), yi.post("/tree.json", async (e) => {
8082
8048
  try {
8083
8049
  let t = e.get("db"), n = await e.req.json(), r = n.treeId ? String(n.treeId).trim() : "main-nav", i = J(e), a = new X(e.env), o = 1;
8084
8050
  if (isNaN(Number(r))) {
@@ -8090,7 +8056,7 @@ bi.get("/tree.json", async (e) => {
8090
8056
  }
8091
8057
  } else o = Number(r);
8092
8058
  if (n.tree && Array.isArray(n.tree)) {
8093
- let r = xi(n.tree, null);
8059
+ let r = bi(n.tree, null);
8094
8060
  if (r.length > 0) for (let e = 0; e < r.length; e += 50) {
8095
8061
  let n = r.slice(e, e + 50), i = n.map((e) => e.id), a = i.map(() => "?").join(","), s = "UPDATE tree_nodes SET \n";
8096
8062
  s += "parentId = CASE id \n", n.forEach(() => {
@@ -8110,9 +8076,9 @@ bi.get("/tree.json", async (e) => {
8110
8076
  reorderedCount: r.length
8111
8077
  });
8112
8078
  }
8113
- let { action: s, title: c, nodeType: l, parentId: u, contentId: d, nodeData: f = {}, pageData: p = {} } = n, m = Object.keys(f).length > 0 ? { ...f } : { ...p }, h = Ci(n.isHidden === void 0 ? m.isHidden === void 0 ? m.hidden : m.isHidden : n.isHidden);
8079
+ let { action: s, title: c, nodeType: l, parentId: u, contentId: d, nodeData: f = {}, pageData: p = {} } = n, m = Object.keys(f).length > 0 ? { ...f } : { ...p }, h = Si(n.isHidden === void 0 ? m.isHidden === void 0 ? m.hidden : m.isHidden : n.isHidden);
8114
8080
  delete m._isTreeDraft, delete m._draftParentId, delete m.isNew, delete m.nodeType, delete m.contentType, delete m.title, delete m.slug, delete m.hidden, delete m.is_hidden, delete m.isHidden, delete m.status;
8115
- let g = Si(u), _ = e.get("user")?.id || null;
8081
+ let g = xi(u), _ = e.get("user")?.id || null;
8116
8082
  if (s === "create") {
8117
8083
  let r = m.slug || n.slug || c, s = r ? String(r).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") : null;
8118
8084
  if (s) {
@@ -8201,7 +8167,7 @@ bi.get("/tree.json", async (e) => {
8201
8167
  details: t.message
8202
8168
  }, 500);
8203
8169
  }
8204
- }), bi.get("/trees.json", async (e) => {
8170
+ }), yi.get("/trees.json", async (e) => {
8205
8171
  try {
8206
8172
  let t = e.get("db"), n = await t.prepare("SELECT * FROM trees ORDER BY LOWER(label) ASC").all(), r = Array.isArray(n) ? n : n?.results || [], i = await t.prepare("SELECT channelId, treeId FROM channel_trees").all(), a = (Array.isArray(i) ? i : i?.results || []).reduce((e, t) => {
8207
8173
  let n = Number(t.treeId), r = Number(t.channelId);
@@ -8231,7 +8197,7 @@ bi.get("/tree.json", async (e) => {
8231
8197
  } catch {
8232
8198
  return e.json([]);
8233
8199
  }
8234
- }), bi.post("/trees.json", async (e) => {
8200
+ }), yi.post("/trees.json", async (e) => {
8235
8201
  try {
8236
8202
  let t = e.get("db"), n = await e.req.json(), r = n.id, i = r != null && r !== "" && !isNaN(Number(r)) ? Number(r) : null, a = `tree-${Date.now().toString(36)}`, o = (n.key || n.slug || a).toLowerCase().replace(/[^a-z0-9_-]/g, "-"), s = n.label?.trim() || o, c = n.treeType !== void 0 && n.treeType !== null ? n.treeType : n.type ?? "site", l = n.channelId !== void 0 && n.channelId !== null && Number(n.channelId) || null, u = +(n.isHidden === !0 || n.isHidden === 1 || n.isHidden === "true"), d = e.get("user")?.id || null, f = { ...n };
8237
8203
  if (delete f.id, delete f.key, delete f.label, delete f.treeType, delete f.type, delete f.channelId, delete f.channels, delete f.isHidden, delete f.createdById, delete f.updatedById, delete f.createdAt, delete f.updatedAt, await t.prepare("SELECT id FROM trees WHERE key = ? AND id != ? LIMIT 1").get(o, i ?? -1)) return e.json({
@@ -8270,7 +8236,7 @@ bi.get("/tree.json", async (e) => {
8270
8236
  } catch (t) {
8271
8237
  return console.error("[API Trees] Error saving tree:", t), e.json({ error: t.message || "Failed to save tree" }, 500);
8272
8238
  }
8273
- }), bi.delete("/trees.json", async (e) => {
8239
+ }), yi.delete("/trees.json", async (e) => {
8274
8240
  let t = e.get("db"), n = e.req.query("id");
8275
8241
  if (!n) return e.json({ error: "Tree ID required" }, 400);
8276
8242
  let r = Number(n);
@@ -8285,8 +8251,8 @@ bi.get("/tree.json", async (e) => {
8285
8251
  });
8286
8252
  //#endregion
8287
8253
  //#region server/routes/admin/channels.ts
8288
- var wi = new e();
8289
- wi.get("/", async (e) => {
8254
+ var Ci = new e();
8255
+ Ci.get("/", async (e) => {
8290
8256
  try {
8291
8257
  let t = e.get("db"), n = await t.prepare("SELECT * FROM channels ORDER BY id ASC").all(), r = Array.isArray(n) ? n : n?.results || [], i = await t.prepare("SELECT channelId, treeId, key, metaJson FROM channel_trees").all(), a = ((Array.isArray(i) ? i : i?.results || []) || []).reduce((e, t) => {
8292
8258
  e[t.channelId] || (e[t.channelId] = []);
@@ -8352,7 +8318,7 @@ wi.get("/", async (e) => {
8352
8318
  error: t.message
8353
8319
  }, 500);
8354
8320
  }
8355
- }), wi.post("/", async (e) => {
8321
+ }), Ci.post("/", async (e) => {
8356
8322
  try {
8357
8323
  let t = e.get("db"), n = await e.req.json(), r = n.id, i = r != null && r !== "" && !isNaN(Number(r)) ? Number(r) : null, { key: a, label: o, channelType: s = "website", domain: c = "localhost", baseUrl: l = "http://localhost:4321", defaultLanguage: u = "en", isHidden: d = !1, trees: f = [], createdById: p = null, updatedById: m = null, id: h, createdAt: g, updatedAt: _, ...v } = n, y = a?.trim() || "main", b = o?.trim() || "Untitled Channel", x = Array.isArray(f) ? f : [], S = JSON.stringify(v || {}), C = e.get("user")?.id || m || p || null;
8358
8324
  if (await t.prepare("SELECT id FROM channels WHERE key = ? AND id != ? LIMIT 1").get(y, i ?? -1)) return e.json({
@@ -8389,7 +8355,7 @@ wi.get("/", async (e) => {
8389
8355
  details: t.message
8390
8356
  }, 500);
8391
8357
  }
8392
- }), wi.delete("/", async (e) => {
8358
+ }), Ci.delete("/", async (e) => {
8393
8359
  let t = e.get("db"), n = e.req.query("id");
8394
8360
  if (!n) return e.json({ error: "Channel ID required" }, 400);
8395
8361
  let r = Number(n);
@@ -8407,9 +8373,9 @@ wi.get("/", async (e) => {
8407
8373
  });
8408
8374
  //#endregion
8409
8375
  //#region server/routes/admin/schemas.ts
8410
- var Ti = new e(), Ei = null, Di = (e) => {
8376
+ var wi = new e(), Ti = null, Ei = (e) => {
8411
8377
  try {
8412
- if (!Ei) {
8378
+ if (!Ti) {
8413
8379
  let t = ci(e.env?.BUNDLED_DEFINITIONS || Or), n = t.userTemplate || {
8414
8380
  id: "userTemplate",
8415
8381
  label: "User Account",
@@ -8446,7 +8412,7 @@ var Ti = new e(), Ei = null, Di = (e) => {
8446
8412
  }
8447
8413
  }
8448
8414
  };
8449
- Ei = {
8415
+ Ti = {
8450
8416
  channelTemplate: t.channelTemplate || null,
8451
8417
  treeTemplate: t.treeTemplate || null,
8452
8418
  userTemplate: n,
@@ -8458,7 +8424,7 @@ var Ti = new e(), Ei = null, Di = (e) => {
8458
8424
  blockLayouts: t.blockLayouts || {}
8459
8425
  };
8460
8426
  }
8461
- return e.json(Ei, 200, { "Cache-Control": "public, max-age=300, stale-while-revalidate=86400" });
8427
+ return e.json(Ti, 200, { "Cache-Control": "public, max-age=300, stale-while-revalidate=86400" });
8462
8428
  } catch (t) {
8463
8429
  return console.error("[CMS API] Error loading schemas:", t), e.json({
8464
8430
  error: "Failed to load schemas",
@@ -8466,10 +8432,10 @@ var Ti = new e(), Ei = null, Di = (e) => {
8466
8432
  }, 500);
8467
8433
  }
8468
8434
  };
8469
- Ti.get("/", Di), Ti.get("/schemas.json", Di);
8435
+ wi.get("/", Ei), wi.get("/schemas.json", Ei);
8470
8436
  //#endregion
8471
8437
  //#region server/routes/admin/validation.ts
8472
- var Oi = new e(), ki = {
8438
+ var Di = new e(), Oi = {
8473
8439
  node: "content_nodes",
8474
8440
  nodes: "content_nodes",
8475
8441
  content_node: "content_nodes",
@@ -8481,7 +8447,7 @@ var Oi = new e(), ki = {
8481
8447
  user: "users",
8482
8448
  users: "users",
8483
8449
  user_account: "user_accounts"
8484
- }, Ai = {
8450
+ }, ki = {
8485
8451
  content_nodes: [
8486
8452
  "id",
8487
8453
  "title",
@@ -8538,11 +8504,11 @@ var Oi = new e(), ki = {
8538
8504
  "createdAt"
8539
8505
  ]
8540
8506
  };
8541
- Oi.post("/validate-unique", async (e) => {
8507
+ Di.post("/validate-unique", async (e) => {
8542
8508
  try {
8543
8509
  let t = e.get("db"), { entityType: n, field: r, value: i, excludeId: a } = await e.req.json();
8544
8510
  if (!r || i == null || String(i).trim() === "") return e.json({ isUnique: !0 });
8545
- let o = ki[n] || "content_nodes", s = r.replace(/[^a-zA-Z0-9_]/g, ""), c = (Ai[o] || Ai.content_nodes).includes(s), l = -1;
8511
+ let o = Oi[n] || "content_nodes", s = r.replace(/[^a-zA-Z0-9_]/g, ""), c = (ki[o] || ki.content_nodes).includes(s), l = -1;
8546
8512
  if (a != null && String(a).trim() !== "") {
8547
8513
  let e = Number(a);
8548
8514
  l = isNaN(e) ? String(a) : e;
@@ -8554,35 +8520,11 @@ Oi.post("/validate-unique", async (e) => {
8554
8520
  } catch (t) {
8555
8521
  return console.error("[API Validation] Error validating global uniqueness:", t), e.json({ error: "Failed to validate uniqueness" }, 500);
8556
8522
  }
8557
- }), Oi.post("/validate-unique-sibling", async (e) => {
8558
- try {
8559
- let t = e.get("db"), { slug: n, treeId: r, parentId: i, excludeTreeNodeId: a } = await e.req.json();
8560
- if (!n || !String(n).trim() || !r) return e.json({ isUnique: !0 });
8561
- let o = String(n).trim().toLowerCase(), s = i === void 0 || i === "null" || i === "" ? null : i, c = s === null ? "tn.parentId IS NULL" : "tn.parentId = ?", l = s === null ? [r, o] : [
8562
- r,
8563
- s,
8564
- o
8565
- ], u = "";
8566
- a && !String(a).startsWith("draft-") && (u = "AND tn.id != ? AND tn.contentId != ?", l.push(a, a));
8567
- let d = `
8568
- SELECT 1
8569
- FROM tree_nodes tn
8570
- INNER JOIN content_nodes cn ON tn.contentId = cn.id
8571
- WHERE tn.treeId = ?
8572
- AND ${c}
8573
- AND cn.slug = ?
8574
- ${u}
8575
- LIMIT 1
8576
- `, f = await t.prepare(d).get(...l);
8577
- return e.json({ isUnique: !f });
8578
- } catch (t) {
8579
- return console.error("[Validation Endpoint] Error validating unique sibling:", t), e.json({ isUnique: !0 });
8580
- }
8581
- });
8523
+ }), Di.post("/validate-unique-sibling", async (e) => e.json({ isUnique: !0 }));
8582
8524
  //#endregion
8583
8525
  //#region server/routes/admin/stats.ts
8584
- var ji = new e();
8585
- ji.get("/", async (e) => {
8526
+ var Ai = new e();
8527
+ Ai.get("/", async (e) => {
8586
8528
  try {
8587
8529
  let t = e.get("db"), n = await t.prepare("\n SELECT \n COUNT(*) as total,\n SUM(CASE WHEN isHidden = 0 THEN 1 ELSE 0 END) as published,\n SUM(CASE WHEN isHidden = 1 THEN 1 ELSE 0 END) as hidden\n FROM content_nodes\n ").get(), r = Number(n?.total) || 0, i = Number(n?.published) || 0, a = Number(n?.hidden) || 0, o = await t.prepare("\n SELECT \n (SELECT COUNT(*) FROM channels) as totalChannels,\n (SELECT COUNT(*) FROM trees) as totalTrees,\n (SELECT COUNT(*) FROM users) as totalUsers\n ").get(), s = await t.prepare("\n SELECT contentType as type, COUNT(*) as count \n FROM content_nodes \n GROUP BY contentType \n ORDER BY count DESC\n ").all(), c = Array.isArray(s) ? s : s?.results || [], l = await t.prepare("\n SELECT id, title, slug, contentType, isHidden, status, updatedAt \n FROM content_nodes \n ORDER BY updatedAt DESC \n LIMIT 5\n ").all(), u = (Array.isArray(l) ? l : l?.results || []).map((e) => ({
8588
8530
  ...e,
@@ -8625,7 +8567,7 @@ ji.get("/", async (e) => {
8625
8567
  });
8626
8568
  //#endregion
8627
8569
  //#region server/routes/admin/assets.ts
8628
- var Mi = new e();
8570
+ var ji = new e();
8629
8571
  async function Q(e, t, n = []) {
8630
8572
  let r = e.prepare(t);
8631
8573
  if (typeof r.bind == "function") {
@@ -8638,34 +8580,16 @@ async function Q(e, t, n = []) {
8638
8580
  }
8639
8581
  return [];
8640
8582
  }
8641
- async function Ni(e, t, n = []) {
8583
+ async function Mi(e, t, n = []) {
8642
8584
  let r = e.prepare(t);
8643
8585
  if (typeof r.bind == "function") return await r.bind(...n).run();
8644
8586
  if (typeof r.run == "function") return await r.run(...n);
8645
8587
  }
8646
- function Pi(e, t, n) {
8588
+ function Ni(e, t, n) {
8647
8589
  let r = e || (t ? `/media/${t}` : "");
8648
8590
  return r && n && r.startsWith(`https://${n}/`) && !r.includes("/media/") && (r = r.replace(`https://${n}/`, `https://${n}/media/`)), r;
8649
8591
  }
8650
- async function Fi(e, t, n) {
8651
- try {
8652
- let r = new X(e.env), i = await Q(t, "\n SELECT cdnUrl, storageKeyPrivate\n FROM assets\n WHERE id = ? OR parentAssetId = ?\n ", [n, n]), a = [];
8653
- for (let t of i) {
8654
- let n = Pi(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN);
8655
- n && a.push(n);
8656
- }
8657
- let o = await Q(t, "\n SELECT DISTINCT cn.id, cn.slug, cn.status\n FROM node_assets na\n INNER JOIN content_nodes cn ON na.nodeId = cn.id\n LEFT JOIN assets crop ON na.assetId = crop.id\n WHERE cn.status = 'published' AND (\n na.assetId = ?\n OR crop.parentAssetId = ?\n OR crop.id = (SELECT parentAssetId FROM assets WHERE id = ?)\n )\n ", [
8658
- n,
8659
- n,
8660
- n
8661
- ]);
8662
- if (o.length === 0) return;
8663
- for (let n of o) n.id && n.slug && r.purgeSmart(e, t, n.id, n.slug, a, !1);
8664
- } catch (e) {
8665
- console.warn("[Assets Router] Failed to purge edge cache for asset nodes:", e);
8666
- }
8667
- }
8668
- Mi.get("/", async (e) => {
8592
+ ji.get("/", async (e) => {
8669
8593
  try {
8670
8594
  let t = u(e), { search: n = "", type: r = "all", page: i = "1", limit: a = "24", sort: o = "createdAt", order: s = "DESC", nodeId: c, channelId: l, trashed: d } = e.req.query(), f = Math.max(1, parseInt(i, 10) || 1), p = Math.max(1, Math.min(100, parseInt(a, 10) || 24)), m = (f - 1) * p, h = {
8671
8595
  createdAt: "a.createdAt",
@@ -8732,7 +8656,7 @@ Mi.get("/", async (e) => {
8732
8656
  ...JSON.parse(t.dataJson || "{}")
8733
8657
  };
8734
8658
  } catch {}
8735
- let r = Pi(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN);
8659
+ let r = Ni(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN);
8736
8660
  return {
8737
8661
  id: t.id,
8738
8662
  filename: t.filename || "Untitled Asset",
@@ -8756,7 +8680,7 @@ Mi.get("/", async (e) => {
8756
8680
  details: t.message || String(t)
8757
8681
  }, 500);
8758
8682
  }
8759
- }), Mi.post("/upload", async (e) => {
8683
+ }), ji.post("/upload", async (e) => {
8760
8684
  try {
8761
8685
  let t = u(e), n = ni(e.env), r = await e.req.parseBody(), i = r.file, a = r.isVariant === "true" || r.isVariant === "1" || r.temporary === "true", o = r.parentAssetId || r.parentAsset, s = typeof o == "string" && o.trim().length > 0 ? o.trim() : null;
8762
8686
  s && (await Q(t, "SELECT id FROM assets WHERE id = ?", [s])).length === 0 && (s = null);
@@ -8775,7 +8699,7 @@ Mi.get("/", async (e) => {
8775
8699
  let y = e.env.CDN_DOMAIN, b = v.replace(/^\//, ""), x = y ? `https://${y}/media/${b}` : `/media/${b}`, S = i.type || "application/octet-stream", C = i.size || 0, w = e.get("userId"), T = typeof w == "string" && w.trim().length > 0 ? w : null;
8776
8700
  T && (await Q(t, "SELECT id FROM users WHERE id = ?", [T])).length === 0 && (T = null);
8777
8701
  let E = +!!h;
8778
- await Ni(t, "\n INSERT INTO assets (id, filename, mimeType, sizeBytes, storageKeyPrivate, cdnUrl, createdById, isSystemVariant, parentAssetId, cropCoordinatesJson)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ", [
8702
+ await Mi(t, "\n INSERT INTO assets (id, filename, mimeType, sizeBytes, storageKeyPrivate, cdnUrl, createdById, isSystemVariant, parentAssetId, cropCoordinatesJson)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ", [
8779
8703
  p,
8780
8704
  i.name,
8781
8705
  S,
@@ -8790,7 +8714,7 @@ Mi.get("/", async (e) => {
8790
8714
  let D = x;
8791
8715
  if (s) {
8792
8716
  let n = await Q(t, "SELECT cdnUrl, storageKeyPrivate FROM assets WHERE id = ?", [s]);
8793
- n.length > 0 && (D = Pi(n[0].cdnUrl, n[0].storageKeyPrivate, y)), await Fi(e, t, s);
8717
+ n.length > 0 && (D = Ni(n[0].cdnUrl, n[0].storageKeyPrivate, y)), new X(e.env).purgeAsset(e, t, s);
8794
8718
  }
8795
8719
  return e.json({
8796
8720
  id: p,
@@ -8809,7 +8733,7 @@ Mi.get("/", async (e) => {
8809
8733
  details: t.message || String(t)
8810
8734
  }, 500);
8811
8735
  }
8812
- }), Mi.get("/:id/details", async (e) => {
8736
+ }), ji.get("/:id/details", async (e) => {
8813
8737
  try {
8814
8738
  let t = u(e), n = e.req.param("id"), r = await Q(t, "SELECT * FROM assets WHERE id = ?", [n]);
8815
8739
  if (!r || r.length === 0) return e.json({ error: "Asset not found" }, 404);
@@ -8832,7 +8756,7 @@ Mi.get("/", async (e) => {
8832
8756
  ...JSON.parse(i.dataJson || "{}")
8833
8757
  };
8834
8758
  } catch {}
8835
- let l = Pi(i.cdnUrl, i.storageKeyPrivate, e.env?.CDN_DOMAIN);
8759
+ let l = Ni(i.cdnUrl, i.storageKeyPrivate, e.env?.CDN_DOMAIN);
8836
8760
  return e.json({
8837
8761
  id: i.id,
8838
8762
  filename: i.filename,
@@ -8859,7 +8783,7 @@ Mi.get("/", async (e) => {
8859
8783
  createdAt: t.createdAt,
8860
8784
  parentAssetId: t.parentAssetId || i.id,
8861
8785
  cropCoordinates: n,
8862
- url: Pi(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN),
8786
+ url: Ni(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN),
8863
8787
  originalUrl: l
8864
8788
  };
8865
8789
  })
@@ -8867,7 +8791,7 @@ Mi.get("/", async (e) => {
8867
8791
  } catch (t) {
8868
8792
  return console.error("❌ [Asset Details Error]:", t), e.json({ error: "Failed to load details" }, 500);
8869
8793
  }
8870
- }), Mi.put("/:id", async (e) => {
8794
+ }), ji.put("/:id", async (e) => {
8871
8795
  try {
8872
8796
  let t = u(e), n = e.req.param("id"), r = await e.req.json(), i = await Q(t, "SELECT filename, dataJson FROM assets WHERE id = ?", [n]);
8873
8797
  if (!i || i.length === 0) return e.json({ error: "Asset not found" }, 404);
@@ -8875,18 +8799,18 @@ Mi.get("/", async (e) => {
8875
8799
  try {
8876
8800
  o = JSON.parse(a.dataJson || "{}");
8877
8801
  } catch {}
8878
- return r.title !== void 0 && (o.title = r.title), r.alt !== void 0 && (o.alt = r.alt), r.description !== void 0 && (o.description = r.description), await Ni(t, "UPDATE assets SET filename = ?, dataJson = ?, updatedAt = CURRENT_TIMESTAMP WHERE id = ?", [
8802
+ return r.title !== void 0 && (o.title = r.title), r.alt !== void 0 && (o.alt = r.alt), r.description !== void 0 && (o.description = r.description), await Mi(t, "UPDATE assets SET filename = ?, dataJson = ?, updatedAt = CURRENT_TIMESTAMP WHERE id = ?", [
8879
8803
  r.filename === void 0 ? a.filename : r.filename,
8880
8804
  JSON.stringify(o),
8881
8805
  n
8882
- ]), await Fi(e, t, n), e.json({ success: !0 });
8806
+ ]), new X(e.env).purgeAsset(e, t, n), e.json({ success: !0 });
8883
8807
  } catch (t) {
8884
8808
  return console.error("❌ [Asset Update Error]:", t), e.json({ error: "Failed to update asset" }, 500);
8885
8809
  }
8886
- }), Mi.delete("/:id", async (e) => {
8810
+ }), ji.delete("/:id", async (e) => {
8887
8811
  try {
8888
8812
  let t = u(e), n = e.req.param("id"), r = (await Q(t, "SELECT id, filename, isSystemVariant FROM assets WHERE id = ?", [n]))[0];
8889
- return r ? (await Fi(e, t, n), r.isSystemVariant ? await Ni(t, "UPDATE assets SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?", [n]) : await Ni(t, "UPDATE assets\n SET deletedAt = CURRENT_TIMESTAMP\n WHERE id = ? OR parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))", [
8813
+ return r ? (new X(e.env).purgeAsset(e, t, n), r.isSystemVariant ? await Mi(t, "UPDATE assets SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?", [n]) : await Mi(t, "UPDATE assets\n SET deletedAt = CURRENT_TIMESTAMP\n WHERE id = ? OR parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))", [
8890
8814
  n,
8891
8815
  n,
8892
8816
  `crop_%${r.filename ? r.filename.replace(/\.[^/.]+$/, "") : ""}%`,
@@ -8902,17 +8826,17 @@ Mi.get("/", async (e) => {
8902
8826
  details: t.message || String(t)
8903
8827
  }, 500);
8904
8828
  }
8905
- }), Mi.post("/restore", async (e) => {
8829
+ }), ji.post("/restore", async (e) => {
8906
8830
  try {
8907
8831
  let t = u(e), n = await e.req.json(), r = n.id || n.assetId;
8908
8832
  if (!r) return e.json({ error: "Asset ID required" }, 400);
8909
8833
  let i = (await Q(t, "SELECT id, filename FROM assets WHERE id = ?", [r]))[0];
8910
- return i ? (await Ni(t, "UPDATE assets \n SET deletedAt = NULL \n WHERE id = ? OR parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))", [
8834
+ return i ? (await Mi(t, "UPDATE assets \n SET deletedAt = NULL \n WHERE id = ? OR parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))", [
8911
8835
  r,
8912
8836
  r,
8913
8837
  `crop_%${i.filename ? i.filename.replace(/\.[^/.]+$/, "") : ""}%`,
8914
8838
  `%${r}%`
8915
- ]), await Fi(e, t, r), e.json({
8839
+ ]), new X(e.env).purgeAsset(e, t, r), e.json({
8916
8840
  success: !0,
8917
8841
  id: r,
8918
8842
  restored: !0
@@ -8923,11 +8847,11 @@ Mi.get("/", async (e) => {
8923
8847
  details: t.message
8924
8848
  }, 500);
8925
8849
  }
8926
- }), Mi.delete("/purge/:id", async (e) => {
8850
+ }), ji.delete("/purge/:id", async (e) => {
8927
8851
  try {
8928
8852
  let t = u(e), n = ni(e.env), r = e.req.param("id"), i = (await Q(t, "SELECT id, filename, storageKeyPrivate, isSystemVariant FROM assets WHERE id = ?", [r]))[0];
8929
8853
  if (!i) return e.json({ error: "Asset not found" }, 404);
8930
- await Fi(e, t, r);
8854
+ new X(e.env).purgeAsset(e, t, r);
8931
8855
  let a = [i];
8932
8856
  i.isSystemVariant || (a = [i, ...await Q(t, "SELECT id, storageKeyPrivate FROM assets \n WHERE parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))", [
8933
8857
  r,
@@ -8943,7 +8867,7 @@ Mi.get("/", async (e) => {
8943
8867
  }
8944
8868
  }
8945
8869
  let s = o.map(() => "?").join(",");
8946
- return await Ni(t, `DELETE FROM node_assets WHERE assetId IN (${s})`, o), await Ni(t, `DELETE FROM assets WHERE id IN (${s})`, o), e.json({
8870
+ return await Mi(t, `DELETE FROM node_assets WHERE assetId IN (${s})`, o), await Mi(t, `DELETE FROM assets WHERE id IN (${s})`, o), e.json({
8947
8871
  success: !0,
8948
8872
  id: r,
8949
8873
  purged: !0,
@@ -8959,8 +8883,8 @@ Mi.get("/", async (e) => {
8959
8883
  });
8960
8884
  //#endregion
8961
8885
  //#region server/routes/public/node.ts
8962
- var Ii = new e();
8963
- function Li() {
8886
+ var Pi = new e();
8887
+ function Fi() {
8964
8888
  return {
8965
8889
  fullPath: /* @__PURE__ */ new Map(),
8966
8890
  treeEdges: /* @__PURE__ */ new Map(),
@@ -8968,10 +8892,10 @@ function Li() {
8968
8892
  assetUrls: /* @__PURE__ */ new Map()
8969
8893
  };
8970
8894
  }
8971
- function Ri(...e) {
8895
+ function Ii(...e) {
8972
8896
  return e.map((e) => String(e ?? "")).join(":");
8973
8897
  }
8974
- function zi(e, t) {
8898
+ function Li(e, t) {
8975
8899
  let n = Date.now();
8976
8900
  if (e && String(e).trim() !== "") {
8977
8901
  let t = Date.parse(e);
@@ -8983,7 +8907,7 @@ function zi(e, t) {
8983
8907
  }
8984
8908
  return !0;
8985
8909
  }
8986
- async function Bi(e, t, n) {
8910
+ async function Ri(e, t, n) {
8987
8911
  let r = t.filter((e) => e.componentId === "content-feed" || e.componentId === "article-list");
8988
8912
  await Promise.all(r.map(async (t) => {
8989
8913
  let r = t.data || {}, i = r.nodeType || "article", a = Number(r.limit) || 12, o = r.sortBy || "updatedAt", s = "FROM content_nodes WHERE contentType = ? AND isHidden = 0 AND (status = 'published' OR status IS NULL)", c = [i];
@@ -9004,7 +8928,7 @@ async function Bi(e, t, n) {
9004
8928
  if (e.dataJson) try {
9005
8929
  t = typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson;
9006
8930
  } catch {}
9007
- return zi(t.startShowingAt, t.stopShowingAt) ? {
8931
+ return Li(t.startShowingAt, t.stopShowingAt) ? {
9008
8932
  id: e.id,
9009
8933
  title: e.title,
9010
8934
  slug: e.slug,
@@ -9021,7 +8945,7 @@ async function Bi(e, t, n) {
9021
8945
  }
9022
8946
  }));
9023
8947
  }
9024
- async function Vi(e, t, n, r, i = !1, a) {
8948
+ async function zi(e, t, n, r, i = !1, a) {
9025
8949
  if (!t) return { blocks: [] };
9026
8950
  let o = await e.prepare("\n WITH RECURSIVE ancestor_path(id, contentId, title, slug, parentId, level) AS (\n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, 0\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n WHERE t.id = ? OR c.id = ?\n\n UNION ALL\n\n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, ap.level + 1\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n INNER JOIN ancestor_path ap ON t.id = ap.parentId\n )\n SELECT *\n FROM ancestor_path\n ORDER BY level ASC\n ").all(t, t), s = Array.isArray(o) ? o : o?.results || [];
9027
8951
  if (!s || s.length === 0) return { blocks: [] };
@@ -9077,10 +9001,10 @@ async function Vi(e, t, n, r, i = !1, a) {
9077
9001
  try {
9078
9002
  a = (typeof t.dataJson == "string" ? JSON.parse(t.dataJson) : t.dataJson) || {};
9079
9003
  } catch {}
9080
- let o = a.hidden === !0 || a.hidden === 1 || a.hidden === "1" || a.hidden === "true", s = zi(a.startShowingAt, a.stopShowingAt);
9004
+ let o = a.hidden === !0 || a.hidden === 1 || a.hidden === "1" || a.hidden === "true", s = Li(a.startShowingAt, a.stopShowingAt);
9081
9005
  if (!i && (o || !s)) return null;
9082
- let c = t.elementType || t.componentId || "text-block", l = r.blocks?.[c]?.fields || r.elements?.[c]?.fields || r.components?.[c]?.fields || {}, u = String(a.blockId || a._instanceId || a.id || t.blockId || t.id), d = Hi(a, l);
9083
- return d = await oi(e, d), d = Ui(d), d.blockId = u, {
9006
+ let c = t.elementType || t.componentId || "text-block", l = r.blocks?.[c]?.fields || r.elements?.[c]?.fields || r.components?.[c]?.fields || {}, u = String(a.blockId || a._instanceId || a.id || t.blockId || t.id), d = Bi(a, l);
9007
+ return d = await oi(e, d), d = Vi(d), d.blockId = u, {
9084
9008
  region: t.region || n,
9085
9009
  block: {
9086
9010
  instanceId: t.id,
@@ -9100,7 +9024,7 @@ async function Vi(e, t, n, r, i = !1, a) {
9100
9024
  }
9101
9025
  return { blocks: [] };
9102
9026
  }
9103
- function Hi(e, t = {}) {
9027
+ function Bi(e, t = {}) {
9104
9028
  let n = {};
9105
9029
  for (let [r, i] of Object.entries(e)) {
9106
9030
  if (r.endsWith("_meta") || r === "disabledRegions" || r === "hidden" || r === "is_hidden" || r === "isHidden" || r === "status" || r === "startShowingAt" || r === "stopShowingAt" || r === "slug" || r === "title" || r === "id" || r.startsWith("_")) continue;
@@ -9109,14 +9033,14 @@ function Hi(e, t = {}) {
9109
9033
  }
9110
9034
  return n;
9111
9035
  }
9112
- function Ui(e) {
9113
- if (Array.isArray(e)) return e.map(Ui);
9036
+ function Vi(e) {
9037
+ if (Array.isArray(e)) return e.map(Vi);
9114
9038
  if (!e || typeof e != "object") return e;
9115
9039
  if (typeof e.id == "string" && e.id.startsWith("ast_") && typeof e.url == "string") {
9116
9040
  let t = e.metadataOverrides || {}, n = e.variants && typeof e.variants == "object" ? e.variants : {}, r = Object.entries(n).find(([, t]) => t?.id === e.id)?.[0], i = r ? {
9117
9041
  ...t,
9118
9042
  ...t.crops?.[r] || {}
9119
- } : t, a = Object.fromEntries(Object.entries(n).filter(([, t]) => t?.id !== e.id).map(([t, n]) => [t, Ui({
9043
+ } : t, a = Object.fromEntries(Object.entries(n).filter(([, t]) => t?.id !== e.id).map(([t, n]) => [t, Vi({
9120
9044
  ...n,
9121
9045
  title: n?.title ?? e.title ?? "",
9122
9046
  alt: n?.alt ?? e.alt ?? "",
@@ -9130,9 +9054,9 @@ function Ui(e) {
9130
9054
  ...Object.keys(a).length > 0 ? { variants: a } : {}
9131
9055
  };
9132
9056
  }
9133
- return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Ui(t)]));
9057
+ return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Vi(t)]));
9134
9058
  }
9135
- async function Wi(e, t, n) {
9059
+ async function Hi(e, t, n) {
9136
9060
  if (typeof t == "string") {
9137
9061
  if (!t.includes("#node:") && !t.includes("data-node-id") && !t.includes("#asset:") && !t.includes("data-asset-id")) return t;
9138
9062
  let r = (e, t) => {
@@ -9158,9 +9082,9 @@ async function Wi(e, t, n) {
9158
9082
  return await Promise.all(Array.from(t.matchAll(h)).map(async (t) => {
9159
9083
  let i = t[1], a = r(i, "data-node-id"), o = r(i, "data-tree-id");
9160
9084
  if (!a || !o) return;
9161
- let s = await Ki(e, a, o, n);
9085
+ let s = await Wi(e, a, o, n);
9162
9086
  if (s?.treeNodeId) {
9163
- let t = await Xi(e, String(s.treeNodeId), o, n);
9087
+ let t = await Ji(e, String(s.treeNodeId), o, n);
9164
9088
  m.set(`${a}:${o}`, t);
9165
9089
  }
9166
9090
  })), t.replace(h, (e, t) => {
@@ -9180,39 +9104,39 @@ async function Wi(e, t, n) {
9180
9104
  return /href\s*=\s*["'][^"']*["']/i.test(_) ? _ = _.replace(/href\s*=\s*["'][^"']*["']/i, `href="${g || "/"}"`) : _ += ` href="${g || "/"}"`, `<a ${_}>`;
9181
9105
  });
9182
9106
  }
9183
- if (Array.isArray(t)) return Promise.all(t.map((t) => Wi(e, t, n)));
9107
+ if (Array.isArray(t)) return Promise.all(t.map((t) => Hi(e, t, n)));
9184
9108
  if (t && typeof t == "object") {
9185
9109
  if (typeof t.href == "string" && (t.href.startsWith("#node:") || t.href.startsWith("#asset:"))) return {
9186
9110
  ...t,
9187
- href: await Gi(e, t, n)
9111
+ href: await Ui(e, t, n)
9188
9112
  };
9189
- let r = await Promise.all(Object.entries(t).map(async ([t, r]) => [t, await Wi(e, r, n)]));
9113
+ let r = await Promise.all(Object.entries(t).map(async ([t, r]) => [t, await Hi(e, r, n)]));
9190
9114
  return Object.fromEntries(r);
9191
9115
  }
9192
9116
  return t;
9193
9117
  }
9194
- async function Gi(e, t, n) {
9118
+ async function Ui(e, t, n) {
9195
9119
  let r = t.href.match(/^#node:(.+)$/), i = t.href.match(/^#asset:(.+)$/);
9196
- if (i) return Ji(e, i[1], n);
9120
+ if (i) return Ki(e, i[1], n);
9197
9121
  if (!r) return t.href;
9198
9122
  let a = r[1];
9199
9123
  if (t.treeId) {
9200
- let r = await Ki(e, a, String(t.treeId), n);
9124
+ let r = await Wi(e, a, String(t.treeId), n);
9201
9125
  if (r?.treeNodeId) {
9202
- let i = await Xi(e, String(r.treeNodeId), String(t.treeId), n);
9126
+ let i = await Ji(e, String(r.treeNodeId), String(t.treeId), n);
9203
9127
  if (i) return i;
9204
9128
  }
9205
9129
  }
9206
- let o = await qi(e, a, n);
9130
+ let o = await Gi(e, a, n);
9207
9131
  return o === void 0 ? "#" : `/${o}`;
9208
9132
  }
9209
- async function Ki(e, t, n, r) {
9210
- let i = Ri(t, n), a = r.treeEdges.get(i);
9133
+ async function Wi(e, t, n, r) {
9134
+ let i = Ii(t, n), a = r.treeEdges.get(i);
9211
9135
  if (a) return a;
9212
9136
  let o = e.prepare("\n SELECT id as treeNodeId\n FROM tree_nodes\n WHERE contentId = ?\n AND treeId = ?\n LIMIT 1\n ").get(t, n);
9213
9137
  return r.treeEdges.set(i, Promise.resolve(o)), o;
9214
9138
  }
9215
- async function qi(e, t, n) {
9139
+ async function Gi(e, t, n) {
9216
9140
  let r = String(t), i = n.nodeSlugs.get(r);
9217
9141
  if (i) return i;
9218
9142
  let a = (async () => {
@@ -9221,7 +9145,7 @@ async function qi(e, t, n) {
9221
9145
  })();
9222
9146
  return n.nodeSlugs.set(r, a), a;
9223
9147
  }
9224
- async function Ji(e, t, n) {
9148
+ async function Ki(e, t, n) {
9225
9149
  let r = String(t), i = n.assetUrls.get(r);
9226
9150
  if (i) return i;
9227
9151
  let a = (async () => {
@@ -9230,7 +9154,7 @@ async function Ji(e, t, n) {
9230
9154
  })();
9231
9155
  return n.assetUrls.set(r, a), a;
9232
9156
  }
9233
- function Yi(e) {
9157
+ function qi(e) {
9234
9158
  let t = e.socialImage;
9235
9159
  if (!t || typeof t != "object") return null;
9236
9160
  let n = (e, t) => {
@@ -9261,9 +9185,9 @@ function Yi(e) {
9261
9185
  ])
9262
9186
  };
9263
9187
  }
9264
- async function Xi(e, t, n, r) {
9188
+ async function Ji(e, t, n, r) {
9265
9189
  if (!t) return "";
9266
- let i = Ri(t, n);
9190
+ let i = Ii(t, n);
9267
9191
  if (r) {
9268
9192
  let e = r.fullPath.get(i);
9269
9193
  if (e) return e;
@@ -9278,7 +9202,7 @@ async function Xi(e, t, n, r) {
9278
9202
  })();
9279
9203
  return r && r.fullPath.set(i, a), a;
9280
9204
  }
9281
- async function Zi(e, t, n, r, i) {
9205
+ async function Yi(e, t, n, r, i) {
9282
9206
  let a = {}, o = null;
9283
9207
  if (t) {
9284
9208
  let n = await e.prepare("\n WITH RECURSIVE ancestor_path(id, contentId, title, slug, parentId, level) AS (\n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, 0\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n WHERE t.id = ? OR c.id = ?\n\n UNION ALL\n\n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, ap.level + 1\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n INNER JOIN ancestor_path ap ON t.id = ap.parentId\n )\n SELECT c.dataJson, c.draftDataJson\n FROM ancestor_path ap\n INNER JOIN content_nodes c ON ap.contentId = c.id\n ORDER BY ap.level ASC\n ").all(t, t), i = Array.isArray(n) ? n : n?.results || [], s = /* @__PURE__ */ new Set([
@@ -9316,20 +9240,20 @@ async function Zi(e, t, n, r, i) {
9316
9240
  inheritedFields: a
9317
9241
  };
9318
9242
  }
9319
- function Qi(e) {
9243
+ function Xi(e) {
9320
9244
  let t = Number(e?.env?.CMS_NODE_CACHE_TTL);
9321
9245
  return Number.isFinite(t) && t >= 60 ? Math.floor(t) : 300;
9322
9246
  }
9323
- async function $i(e, t, n, r) {
9247
+ async function Zi(e, t, n, r) {
9324
9248
  try {
9325
9249
  await e.set(t, n, r);
9326
9250
  } catch (e) {
9327
9251
  console.warn("[CMS Cache] Failed to write node response to cache:", e);
9328
9252
  }
9329
9253
  }
9330
- Ii.get("/*", async (e) => {
9254
+ Pi.get("/*", async (e) => {
9331
9255
  try {
9332
- let t = e.get("db"), n = Li(), r = new URL(e.req.url).pathname.match(/\/node\/(.+)$/), i = (r ? r[1] : "home").replace(/^\/+|\/+$/g, ""), a = e.req.query("channelId") || e.req.query("channel") || "1", o = e.req.query("lang") || "en", s = e.req.query("preview") === "true", c = isNaN(Number(a)) ? await t.prepare("SELECT * FROM channels WHERE key = ?").get(a) : await t.prepare("SELECT * FROM channels WHERE id = ?").get(Number(a));
9256
+ let t = e.get("db"), n = Fi(), r = new URL(e.req.url).pathname.match(/\/node\/(.+)$/), i = (r ? r[1] : "home").replace(/^\/+|\/+$/g, ""), a = e.req.query("channelId") || e.req.query("channel") || "1", o = e.req.query("lang") || "en", s = e.req.query("preview") === "true", c = isNaN(Number(a)) ? await t.prepare("SELECT * FROM channels WHERE key = ?").get(a) : await t.prepare("SELECT * FROM channels WHERE id = ?").get(Number(a));
9333
9257
  if (!c) return e.json({ error: `Channel '${a}' not found` }, 404);
9334
9258
  let l = c.status === "disabled" || c.status === "inactive" || c.isEnabled === 0 || c.isEnabled === !1;
9335
9259
  if (!s && l) return e.json({ error: `Channel '${c.key || a}' is currently inactive` }, 404);
@@ -9354,7 +9278,7 @@ Ii.get("/*", async (e) => {
9354
9278
  if (E.length > 0) {
9355
9279
  let e = await Promise.all(E.map(async (e) => ({
9356
9280
  candidate: e,
9357
- calculatedPath: await Xi(t, String(e.treeNodeId), String(e.treeId), n)
9281
+ calculatedPath: await Ji(t, String(e.treeNodeId), String(e.treeId), n)
9358
9282
  }))), r = S.replace(/^\/+|\/+$/g, "");
9359
9283
  for (let { candidate: t, calculatedPath: n } of e) {
9360
9284
  let e = n.replace(/^\/+|\/+$/g, "");
@@ -9378,7 +9302,7 @@ Ii.get("/*", async (e) => {
9378
9302
  LIMIT 1
9379
9303
  `).get(...e);
9380
9304
  }
9381
- let D = v?.treeId || y || "main-nav", O = v?.parentId || null, k = v?.treeNodeId ? await Xi(t, String(v.treeNodeId), String(D), n) : `/${(_.slug || "").replace(/^\/+|\/+$/g, "")}`, A = {
9305
+ let D = v?.treeId || y || "main-nav", O = v?.parentId || null, k = v?.treeNodeId ? await Ji(t, String(v.treeNodeId), String(D), n) : `/${(_.slug || "").replace(/^\/+|\/+$/g, "")}`, A = {
9382
9306
  id: _.id,
9383
9307
  title: _.title,
9384
9308
  slug: _.slug,
@@ -9387,32 +9311,32 @@ Ii.get("/*", async (e) => {
9387
9311
  nodeType: _.contentType,
9388
9312
  createdAt: _.createdAt,
9389
9313
  updatedAt: _.updatedAt
9390
- }, ee = _.contentType || "node", te = h.nodes?.[ee] || Object.values(h.nodes || {})[0] || {}, j = { ...te.fields || {} };
9391
- te.tabs && Object.values(te.tabs).forEach((e) => {
9392
- Object.assign(j, e.fields || {});
9314
+ }, ee = _.contentType || "node", j = h.nodes?.[ee] || Object.values(h.nodes || {})[0] || {}, M = { ...j.fields || {} };
9315
+ j.tabs && Object.values(j.tabs).forEach((e) => {
9316
+ Object.assign(M, e.fields || {});
9393
9317
  });
9394
- let ne = {}, re = null, ie = null, ae = !1, M = {}, N = s && _.draftDataJson ? _.draftDataJson : _.dataJson || _.draftDataJson;
9395
- if (N) try {
9396
- M = typeof N == "string" ? JSON.parse(N) : N;
9318
+ let te = {}, ne = null, re = null, ie = !1, N = {}, P = s && _.draftDataJson ? _.draftDataJson : _.dataJson || _.draftDataJson;
9319
+ if (P) try {
9320
+ N = typeof P == "string" ? JSON.parse(P) : P;
9397
9321
  } catch {}
9398
- M.disabledRegions && (ne = M.disabledRegions), ae = M.hidden === !0 || M.hidden === 1 || M.hidden === "1" || M.hidden === "true", re = M.startShowingAt || null, ie = M.stopShowingAt || null;
9399
- let oe = M.layoutId, se = oe && oe !== "inherit", { resolvedLayoutId: ce, inheritedFields: le } = await Zi(t, O, D, s, j), P = se ? oe : ce || te.defaultLayout || null;
9400
- for (let [e, t] of Object.entries(le)) (M[e] === void 0 || M[e] === null || M[e] === "" || M[e] === "inherit") && t !== void 0 && (M[e] = t);
9401
- let F = await oi(t, Hi(M, j));
9402
- F = Ui(F), F = await Wi(t, F, n);
9403
- let ue = Yi(F);
9404
- delete F.socialImage, delete F.fbImage, delete F.xImage, delete F.whatsappImage, ue && (F.socialImages = ue), A.slug = _.slug, A.title = _.title, Object.assign(A, F), A.layoutId = P;
9405
- let de = Number(_.isHidden) === 1 || ae, fe = !zi(re, ie);
9406
- if (!s && (de || fe)) return e.json({ error: "Node is hidden or outside its scheduled publishing window" }, 404);
9407
- let pe = [];
9322
+ N.disabledRegions && (te = N.disabledRegions), ie = N.hidden === !0 || N.hidden === 1 || N.hidden === "1" || N.hidden === "true", ne = N.startShowingAt || null, re = N.stopShowingAt || null;
9323
+ let ae = N.layoutId, oe = ae && ae !== "inherit", { resolvedLayoutId: se, inheritedFields: ce } = await Yi(t, O, D, s, M), F = oe ? ae : se || j.defaultLayout || null;
9324
+ for (let [e, t] of Object.entries(ce)) (N[e] === void 0 || N[e] === null || N[e] === "" || N[e] === "inherit") && t !== void 0 && (N[e] = t);
9325
+ let I = await oi(t, Bi(N, M));
9326
+ I = Vi(I), I = await Hi(t, I, n);
9327
+ let le = qi(I);
9328
+ delete I.socialImage, delete I.fbImage, delete I.xImage, delete I.whatsappImage, le && (I.socialImages = le), A.slug = _.slug, A.title = _.title, Object.assign(A, I), A.layoutId = F;
9329
+ let ue = Number(_.isHidden) === 1 || ie, de = !Li(ne, re);
9330
+ if (!s && (ue || de)) return e.json({ error: "Node is hidden or outside its scheduled publishing window" }, 404);
9331
+ let fe = [];
9408
9332
  if (v?.treeNodeId) {
9409
9333
  let e = await t.prepare("\n SELECT\n t.id as treeNodeId,\n t.contentId as id,\n c.title,\n c.slug,\n c.language,\n c.contentType as nodeType,\n c.isHidden,\n c.dataJson,\n c.draftDataJson\n FROM tree_nodes t\n INNER JOIN content_nodes c\n ON t.contentId = c.id\n WHERE t.parentId = ?\n AND t.treeId = ?\n ORDER BY t.sortOrder ASC\n ").all(v.treeNodeId, D), n = Array.isArray(e) ? e : e?.results || [], r = A.path === "/" ? "" : A.path;
9410
- pe = n.map((e) => {
9334
+ fe = n.map((e) => {
9411
9335
  let t = {}, n = s && e.draftDataJson ? e.draftDataJson : e.dataJson;
9412
9336
  try {
9413
9337
  t = (typeof n == "string" ? JSON.parse(n) : n) || {};
9414
9338
  } catch {}
9415
- let i = Number(e.isHidden) === 1 || t.hidden === !0 || t.hidden === 1 || t.hidden === "1", a = zi(t.startShowingAt, t.stopShowingAt), o = (e.slug || "").replace(/^\/+|\/+$/g, "");
9339
+ let i = Number(e.isHidden) === 1 || t.hidden === !0 || t.hidden === 1 || t.hidden === "1", a = Li(t.startShowingAt, t.stopShowingAt), o = (e.slug || "").replace(/^\/+|\/+$/g, "");
9416
9340
  return !s && (i || !a) ? null : {
9417
9341
  treeNodeId: e.treeNodeId,
9418
9342
  id: e.id,
@@ -9424,18 +9348,18 @@ Ii.get("/*", async (e) => {
9424
9348
  };
9425
9349
  }).filter(Boolean);
9426
9350
  }
9427
- A.children = pe;
9428
- let I = +!!s, L = await t.prepare("\n SELECT *\n FROM content_blocks\n WHERE contentId = ?\n AND isDraft = ?\n ORDER BY sortOrder ASC\n ").all(_.id, I), me = Array.isArray(L) ? L : L?.results || [];
9429
- me.length === 0 && !s && (L = await t.prepare("\n SELECT *\n FROM content_blocks\n WHERE contentId = ?\n ORDER BY sortOrder ASC\n ").all(_.id), me = Array.isArray(L) ? L : L?.results || []);
9430
- let R = {}, z = {}, he = await Promise.all(me.map(async (e) => {
9351
+ A.children = fe;
9352
+ let L = +!!s, R = await t.prepare("\n SELECT *\n FROM content_blocks\n WHERE contentId = ?\n AND isDraft = ?\n ORDER BY sortOrder ASC\n ").all(_.id, L), pe = Array.isArray(R) ? R : R?.results || [];
9353
+ pe.length === 0 && !s && (R = await t.prepare("\n SELECT *\n FROM content_blocks\n WHERE contentId = ?\n ORDER BY sortOrder ASC\n ").all(_.id), pe = Array.isArray(R) ? R : R?.results || []);
9354
+ let z = {}, B = {}, me = await Promise.all(pe.map(async (e) => {
9431
9355
  let r = e.region || "main", i = {};
9432
9356
  try {
9433
9357
  i = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
9434
9358
  } catch {}
9435
- let a = i.hidden === !0 || i.hidden === 1 || i.hidden === "1" || i.hidden === "true", o = zi(i.startShowingAt, i.stopShowingAt);
9359
+ let a = i.hidden === !0 || i.hidden === 1 || i.hidden === "1" || i.hidden === "true", o = Li(i.startShowingAt, i.stopShowingAt);
9436
9360
  if (!s && (a || !o)) return null;
9437
- let c = e.elementType || e.componentId || "text-block", l = h.blocks?.[c]?.fields || h.elements?.[c]?.fields || h.components?.[c]?.fields || {}, u = String(i.blockId || i._instanceId || i.id || e.blockId || e.id), d = Hi(i, l);
9438
- return d = await oi(t, d), d = Ui(d), d = await Wi(t, d, n), d.blockId = u, {
9361
+ let c = e.elementType || e.componentId || "text-block", l = h.blocks?.[c]?.fields || h.elements?.[c]?.fields || h.components?.[c]?.fields || {}, u = String(i.blockId || i._instanceId || i.id || e.blockId || e.id), d = Bi(i, l);
9362
+ return d = await oi(t, d), d = Vi(d), d = await Hi(t, d, n), d.blockId = u, {
9439
9363
  region: r,
9440
9364
  block: {
9441
9365
  instanceId: e.id,
@@ -9445,8 +9369,8 @@ Ii.get("/*", async (e) => {
9445
9369
  }
9446
9370
  };
9447
9371
  }));
9448
- for (let e of he) e && (R[e.region] || (R[e.region] = [], z[e.region] = { isInherited: !1 }), R[e.region].push(e.block));
9449
- let ge = {
9372
+ for (let e of me) e && (z[e.region] || (z[e.region] = [], B[e.region] = { isInherited: !1 }), z[e.region].push(e.block));
9373
+ let he = {
9450
9374
  header: {
9451
9375
  label: "Header",
9452
9376
  inherit: "parent"
@@ -9455,33 +9379,33 @@ Ii.get("/*", async (e) => {
9455
9379
  label: "Footer",
9456
9380
  inherit: "parent"
9457
9381
  },
9458
- ...(P ? h.nodeLayouts?.[P] || h.layouts?.[P] : null)?.regions || { main: { label: "Content" } }
9382
+ ...(F ? h.nodeLayouts?.[F] || h.layouts?.[F] : null)?.regions || { main: { label: "Content" } }
9459
9383
  };
9460
- for (let [e, r] of Object.entries(ge)) {
9461
- let i = R[e] && R[e].length > 0, a = !!ne[e];
9462
- if (R[e] || (R[e] = [], z[e] = { isInherited: !1 }), (r?.inherit === "parent" || r?.inherit === !0 || r?.inherit === "true" || e === "header" || e === "footer") && !i && !a && O) {
9463
- let r = await Vi(t, O, e, h, s, n);
9464
- if (r.blocks.length > 0 && (R[e] = r.blocks, z[e] = {
9384
+ for (let [e, r] of Object.entries(he)) {
9385
+ let i = z[e] && z[e].length > 0, a = !!te[e];
9386
+ if (z[e] || (z[e] = [], B[e] = { isInherited: !1 }), (r?.inherit === "parent" || r?.inherit === !0 || r?.inherit === "true" || e === "header" || e === "footer") && !i && !a && O) {
9387
+ let r = await zi(t, O, e, h, s, n);
9388
+ if (r.blocks.length > 0 && (z[e] = r.blocks, B[e] = {
9465
9389
  isInherited: !0,
9466
9390
  inheritedFromId: r.inheritedFromId,
9467
9391
  inheritedFromTitle: r.inheritedFromTitle
9468
- }, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (R[t] = n, z[t] = {
9392
+ }, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (z[t] = n, B[t] = {
9469
9393
  isInherited: !0,
9470
9394
  inheritedFromId: r.inheritedFromId,
9471
9395
  inheritedFromTitle: r.inheritedFromTitle
9472
9396
  });
9473
9397
  }
9474
9398
  }
9475
- await Promise.all(Object.keys(R).map((e) => Bi(t, R[e], u)));
9476
- let _e = {
9399
+ await Promise.all(Object.keys(z).map((e) => Ri(t, z[e], u)));
9400
+ let ge = {
9477
9401
  channelId: u || d,
9478
9402
  treeId: D,
9479
9403
  language: A.language,
9480
9404
  node: A,
9481
- content: R,
9482
- regionMeta: z
9405
+ content: z,
9406
+ regionMeta: B
9483
9407
  };
9484
- return !s && !m && (e.header("X-Cache", "MISS"), await $i(f, p, _e, Qi(e))), e.json(_e);
9408
+ return !s && !m && (e.header("X-Cache", "MISS"), await Zi(f, p, ge, Xi(e))), e.json(ge);
9485
9409
  } catch (t) {
9486
9410
  console.error("[CMS Public API] Error fetching node by path:", t);
9487
9411
  let n = e.env?.ENVIRONMENT === "development";
@@ -9493,8 +9417,8 @@ Ii.get("/*", async (e) => {
9493
9417
  });
9494
9418
  //#endregion
9495
9419
  //#region server/routes/public/tree.ts
9496
- var ea = new e();
9497
- function ta(e, t) {
9420
+ var Qi = new e();
9421
+ function $i(e, t) {
9498
9422
  let n = /* @__PURE__ */ new Date();
9499
9423
  if (e && String(e).trim() !== "") {
9500
9424
  let t = new Date(e);
@@ -9506,14 +9430,14 @@ function ta(e, t) {
9506
9430
  }
9507
9431
  return !0;
9508
9432
  }
9509
- async function na(e, t, n, r) {
9433
+ async function ea(e, t, n, r) {
9510
9434
  try {
9511
9435
  await e.set(t, n, r);
9512
9436
  } catch (e) {
9513
9437
  console.warn("[CMS Cache] Failed to write tree response to cache:", e);
9514
9438
  }
9515
9439
  }
9516
- ea.get("/:treeParam", async (e) => {
9440
+ Qi.get("/:treeParam", async (e) => {
9517
9441
  try {
9518
9442
  let t = e.get("db"), n = e.req.param("treeParam"), r = e.req.query("channelId") || e.req.query("channel") || "default", i = e.req.query("preview") === "true";
9519
9443
  if (r && r !== "default" && r !== "all") {
@@ -9567,7 +9491,7 @@ ea.get("/:treeParam", async (e) => {
9567
9491
  return (p.get(n) || []).map((e) => {
9568
9492
  let n = m.get(String(e.treeNodeId)) || {}, r = {};
9569
9493
  for (let [e, t] of Object.entries(n)) e !== "_isTreeDraft" && e !== "_draftParentId" && e !== "isNew" && e !== "hidden" && e !== "is_hidden" && e !== "isHidden" && e !== "status" && (r[e] = t);
9570
- let a = !i && (e.status === "draft" || e.status === "new"), o = Number(e.isHidden) === 1 || a || n.hidden === !0 || n.hidden === 1 || n.hidden === "1" || n.hidden === "true", s = ta(n.startShowingAt, n.stopShowingAt), c = (e.slug || "").replace(/^\/+|\/+$/g, ""), l = (!e.parentId || e.parentId === "null" || e.parentId === "") && (c === "home" || c === "homee") ? "/" : `${t}/${c}`.replace(/\/+/g, "/"), u = {
9494
+ let a = !i && (e.status === "draft" || e.status === "new"), o = Number(e.isHidden) === 1 || a || n.hidden === !0 || n.hidden === 1 || n.hidden === "1" || n.hidden === "true", s = $i(n.startShowingAt, n.stopShowingAt), c = (e.slug || "").replace(/^\/+|\/+$/g, ""), l = (!e.parentId || e.parentId === "null" || e.parentId === "") && (c === "home" || c === "homee") ? "/" : `${t}/${c}`.replace(/\/+/g, "/"), u = {
9571
9495
  id: e.id,
9572
9496
  treeNodeId: e.treeNodeId,
9573
9497
  parentId: e.parentId || null,
@@ -9592,7 +9516,7 @@ ea.get("/:treeParam", async (e) => {
9592
9516
  ...d,
9593
9517
  items: h(null)
9594
9518
  };
9595
- return !i && !s && (e.header("X-Cache", "MISS"), await na(a, o, g, 300)), e.json(g);
9519
+ return !i && !s && (e.header("X-Cache", "MISS"), await ea(a, o, g, 300)), e.json(g);
9596
9520
  } catch (t) {
9597
9521
  return console.error("[CMS Public Tree API] Error:", t), e.json({
9598
9522
  error: "Failed to fetch public tree",
@@ -9602,8 +9526,8 @@ ea.get("/:treeParam", async (e) => {
9602
9526
  });
9603
9527
  //#endregion
9604
9528
  //#region server/routes/public/assets.ts
9605
- var ra = new e();
9606
- function ia(e, t) {
9529
+ var ta = new e();
9530
+ function na(e, t) {
9607
9531
  if (t === "webp") return "image/webp";
9608
9532
  if (t === "avif") return "image/avif";
9609
9533
  if (t === "jpeg" || t === "jpg") return "image/jpeg";
@@ -9611,7 +9535,7 @@ function ia(e, t) {
9611
9535
  let n = e.toLowerCase();
9612
9536
  return n.endsWith(".jpg") || n.endsWith(".jpeg") ? "image/jpeg" : n.endsWith(".png") ? "image/png" : n.endsWith(".webp") ? "image/webp" : n.endsWith(".gif") ? "image/gif" : n.endsWith(".svg") ? "image/svg+xml" : n.endsWith(".pdf") ? "application/pdf" : n.endsWith(".mp4") ? "video/mp4" : n.endsWith(".webm") ? "video/webm" : "application/octet-stream";
9613
9537
  }
9614
- ra.get("/*", async (e) => {
9538
+ ta.get("/*", async (e) => {
9615
9539
  let t = e.req.path.replace(/^\/media\//, "").replace(/^\//, "");
9616
9540
  if (!t) return e.text("Asset key missing", 400);
9617
9541
  let n = e.env?.MEDIA_BUCKET, { w: r, h: i, q: a, f: o } = e.req.query(), s = !!(r || i || a || o), c = e.req.header("Accept") || "", l = "";
@@ -9634,7 +9558,7 @@ ra.get("/*", async (e) => {
9634
9558
  c = await n.get(e);
9635
9559
  }
9636
9560
  if (!c) return e.text(`Asset not found: ${t}`, 404);
9637
- let d = c.httpMetadata?.contentType || ia(t), m = d.startsWith("image/") && !d.includes("svg"), g = !1;
9561
+ let d = c.httpMetadata?.contentType || na(t), m = d.startsWith("image/") && !d.includes("svg"), g = !1;
9638
9562
  if (s && m && e.env?.IMAGES) {
9639
9563
  g = !0;
9640
9564
  try {
@@ -9697,7 +9621,7 @@ ra.get("/*", async (e) => {
9697
9621
  if (!s) {
9698
9622
  let n = _(C);
9699
9623
  return e.body(n, 200, {
9700
- "Content-Type": ia(t),
9624
+ "Content-Type": na(t),
9701
9625
  "Cache-Control": "public, max-age=86400"
9702
9626
  });
9703
9627
  }
@@ -9705,7 +9629,7 @@ ra.get("/*", async (e) => {
9705
9629
  if (g(f)) {
9706
9630
  let n = _(f);
9707
9631
  return e.body(n, 200, {
9708
- "Content-Type": ia(t, u),
9632
+ "Content-Type": na(t, u),
9709
9633
  "Cache-Control": "public, max-age=31536000, immutable",
9710
9634
  "X-Local-Cache": "HIT"
9711
9635
  });
@@ -9718,14 +9642,14 @@ ra.get("/*", async (e) => {
9718
9642
  typeof n == "number" && (a.width = n), typeof o == "number" && (a.height = o), (a.width || a.height) && (a.fit = "cover", i = i.resize(a)), u === "webp" ? i = i.webp({ quality: typeof c == "number" ? c : 80 }) : u === "avif" ? i = i.avif({ quality: typeof c == "number" ? c : 70 }) : u === "jpeg" || u === "jpg" ? i = i.jpeg({ quality: typeof c == "number" ? c : 80 }) : u === "png" && (i = i.png({ quality: typeof c == "number" ? c : 80 }));
9719
9643
  let s = await i.toBuffer();
9720
9644
  return v(x(f), { recursive: !0 }), y(f, s), e.body(s, 200, {
9721
- "Content-Type": ia(t, u),
9645
+ "Content-Type": na(t, u),
9722
9646
  "Cache-Control": "public, max-age=31536000, immutable",
9723
9647
  "X-Local-Cache": "MISS"
9724
9648
  });
9725
9649
  } catch {
9726
9650
  let n = _(C);
9727
9651
  return e.body(n, 200, {
9728
- "Content-Type": ia(t),
9652
+ "Content-Type": na(t),
9729
9653
  "Cache-Control": "public, max-age=86400"
9730
9654
  });
9731
9655
  }
@@ -9736,8 +9660,8 @@ ra.get("/*", async (e) => {
9736
9660
  });
9737
9661
  //#endregion
9738
9662
  //#region server/routes/public/paths.ts
9739
- var aa = new e();
9740
- function oa(e, t) {
9663
+ var ra = new e();
9664
+ function ia(e, t) {
9741
9665
  let n = /* @__PURE__ */ new Date();
9742
9666
  if (e && String(e).trim() !== "") {
9743
9667
  let t = new Date(e);
@@ -9749,7 +9673,7 @@ function oa(e, t) {
9749
9673
  }
9750
9674
  return !0;
9751
9675
  }
9752
- aa.get("/", async (e) => {
9676
+ ra.get("/", async (e) => {
9753
9677
  try {
9754
9678
  let t = await e.get("db").prepare("\n SELECT\n t.id as treeNodeId,\n t.parentId,\n c.slug,\n c.contentType as nodeType,\n c.status,\n c.dataJson\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n WHERE (c.deletedAt IS NULL OR c.deletedAt = '')\n ORDER BY t.sortOrder ASC\n ").all(), n = Array.isArray(t) ? t : t?.results || [], r = [], i = /* @__PURE__ */ new Map();
9755
9679
  for (let e of n) {
@@ -9773,7 +9697,7 @@ aa.get("/", async (e) => {
9773
9697
  function o(e = null, t = "") {
9774
9698
  let n = e == null || e === "" || e === "null" ? "__ROOT__" : String(e), s = i.get(n) || [];
9775
9699
  for (let e of s) {
9776
- let n = a.get(String(e.treeNodeId)) || {}, i = e.status === "published" || e.status === "active", s = oa(n.startShowingAt, n.stopShowingAt);
9700
+ let n = a.get(String(e.treeNodeId)) || {}, i = e.status === "published" || e.status === "active", s = ia(n.startShowingAt, n.stopShowingAt);
9777
9701
  if (!i || !s) continue;
9778
9702
  let c = (e.slug || "").replace(/^\/+|\/+$/g, ""), l = c === "home" || c === "homee" ? "/" : `${t}/${c}`.replace(/\/+/g, "/");
9779
9703
  e.nodeType !== "external-link" && r.push(l);
@@ -9790,7 +9714,7 @@ aa.get("/", async (e) => {
9790
9714
  });
9791
9715
  //#endregion
9792
9716
  //#region server/index.ts
9793
- var $ = new e(), sa = !1;
9717
+ var $ = new e(), aa = !1;
9794
9718
  $.use("*", o()), $.use("/media/*", o({
9795
9719
  origin: "*",
9796
9720
  allowMethods: [
@@ -9811,13 +9735,13 @@ $.use("*", o()), $.use("/media/*", o({
9811
9735
  let n = new URL(e.req.url), r = (e.req.header("host") || n.hostname).split(":")[0];
9812
9736
  e.set("currentDomain", r);
9813
9737
  let i = u(e);
9814
- if (e.set("db", i), !sa) try {
9815
- await Mr(i), sa = !0;
9738
+ if (e.set("db", i), !aa) try {
9739
+ await Mr(i), aa = !0;
9816
9740
  } catch (e) {
9817
9741
  console.error("❌ [CMS Server] Failed to initialize system tables on cold start:", e);
9818
9742
  }
9819
9743
  await t();
9820
- }), $.route("/media", ra), $.use("/media/*", Fr()), $.route("/api/cms/nodes", Z), $.route("/api/cms/nodes.json", Z), $.route("/api/cms/formcsv", Z), $.route("/api/cms/formcsv.json", Z), $.route("/api/cms/stats", ji), $.route("/api/cms/stats.json", ji), $.route("/api/cms", bi), $.route("/api/cms/channels", wi), $.route("/api/cms/channels.json", wi), $.route("/api/cms/schemas", Ti), $.route("/api/cms/schemas.json", Ti), $.route("/api/cms", Oi), $.route("/api/admin/assets", Mi), $.route("/api/v1/node", Ii), $.route("/api/v1/page", Ii), $.route("/api/v1/tree", ea), $.route("/api/v1/all-paths", aa), $.get("*", async (e) => {
9744
+ }), $.route("/media", ta), $.use("/media/*", Fr()), $.route("/api/cms/nodes", Z), $.route("/api/cms/nodes.json", Z), $.route("/api/cms/formcsv", Z), $.route("/api/cms/formcsv.json", Z), $.route("/api/cms/stats", Ai), $.route("/api/cms/stats.json", Ai), $.route("/api/cms", yi), $.route("/api/cms/channels", Ci), $.route("/api/cms/channels.json", Ci), $.route("/api/cms/schemas", wi), $.route("/api/cms/schemas.json", wi), $.route("/api/cms", Di), $.route("/api/admin/assets", ji), $.route("/api/v1/node", Pi), $.route("/api/v1/page", Pi), $.route("/api/v1/tree", Qi), $.route("/api/v1/all-paths", ra), $.get("*", async (e) => {
9821
9745
  if (e.env?.ASSETS) {
9822
9746
  let t = await e.env.ASSETS.fetch(e.req.raw);
9823
9747
  if (t.status === 404) {