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

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: {
@@ -4495,14 +4495,16 @@ var Dr = /* @__PURE__ */ a({
4495
4495
  { fieldSet: "page-base" },
4496
4496
  { title: {
4497
4497
  label: "Event Title",
4498
- required: !0
4498
+ required: !0,
4499
+ showAsEditorTitle: !0
4499
4500
  } },
4500
4501
  { slug: { linkedTo: "title" } },
4501
4502
  { startTime: {
4502
4503
  type: "datetime",
4503
4504
  label: "Starts",
4504
4505
  public: !0,
4505
- index: !0
4506
+ index: !0,
4507
+ showAsEditorTitle: !0
4506
4508
  } },
4507
4509
  { endTime: {
4508
4510
  type: "datetime",
@@ -4649,8 +4651,14 @@ var Dr = /* @__PURE__ */ a({
4649
4651
  label: "Title",
4650
4652
  required: !1
4651
4653
  } },
4652
- { firstName: { label: "First Name" } },
4653
- { lastName: { label: "Last Name" } },
4654
+ { firstName: {
4655
+ label: "First Name",
4656
+ showAsEditorTitle: !0
4657
+ } },
4658
+ { lastName: {
4659
+ label: "Last Name",
4660
+ showAsEditorTitle: !0
4661
+ } },
4654
4662
  { position: null },
4655
4663
  { fieldSet: "access" }
4656
4664
  ]
@@ -7407,9 +7415,14 @@ var X = class {
7407
7415
  zoneId: e.env?.CLOUDFLARE_ZONE_ID || this.env.CLOUDFLARE_ZONE_ID,
7408
7416
  apiToken: e.env?.CLOUDFLARE_API_TOKEN || this.env.CLOUDFLARE_API_TOKEN,
7409
7417
  frontendUrl: (e.env?.PUBLIC_FRONTEND_URL || this.env.PUBLIC_FRONTEND_URL || "https://kama.t3cloud.eu").replace(/\/+$/, ""),
7418
+ cdnDomain: e.env?.CDN_DOMAIN || this.env.CDN_DOMAIN,
7410
7419
  frontendWorker: e.env?.FRONTEND_WORKER || this.env.FRONTEND_WORKER
7411
7420
  };
7412
7421
  }
7422
+ isLocalEnv(e) {
7423
+ let { frontendUrl: t } = this.getEnv(e), n = typeof process < "u" && process.env.NODE_ENV === "development", r = t.includes("localhost") || t.includes("127.0.0.1");
7424
+ return n || r;
7425
+ }
7413
7426
  dispatch(e, t) {
7414
7427
  if (!t || typeof t != "object" || typeof t.catch != "function") return;
7415
7428
  let n = t.catch((e) => {
@@ -7422,8 +7435,17 @@ var X = class {
7422
7435
  }
7423
7436
  } catch {}
7424
7437
  }
7438
+ getSafeUrl(e, t, n) {
7439
+ let r = e || (t ? `/media/${t}` : "");
7440
+ return r && n && r.startsWith(`https://${n}/`) && !r.includes("/media/") && (r = r.replace(`https://${n}/`, `https://${n}/media/`)), r;
7441
+ }
7425
7442
  async callAstroPurge(e, t) {
7426
- let { apiToken: n, frontendUrl: r, frontendWorker: i } = this.getEnv(e), a = `${r}/api/purge`, o = { "Content-Type": "application/json" };
7443
+ let { apiToken: n, frontendUrl: r, frontendWorker: i } = this.getEnv(e);
7444
+ if (this.isLocalEnv(e)) return new Response(JSON.stringify({
7445
+ success: !0,
7446
+ local: !0
7447
+ }), { status: 200 });
7448
+ let a = `${r}/api/purge`, o = { "Content-Type": "application/json" };
7427
7449
  return n && (o.Authorization = `Bearer ${n}`), i && typeof i.fetch == "function" ? i.fetch(a, {
7428
7450
  method: "POST",
7429
7451
  headers: o,
@@ -7438,8 +7460,8 @@ var X = class {
7438
7460
  try {
7439
7461
  let a = J(e);
7440
7462
  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}`);
7463
+ 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 || [];
7464
+ for (let e of i) await a.delete(`tree:default:${e.treeId}`), await a.delete(`tree:all:${e.treeId}`);
7443
7465
  }
7444
7466
  if (r) {
7445
7467
  let e = r.replace(/^\/+|\/+$/g, "");
@@ -7451,100 +7473,101 @@ var X = class {
7451
7473
  ]) await a.delete(`node:${t}:${i}:${e}`), await a.delete(`node:${t}:${i}:/${e}`);
7452
7474
  }
7453
7475
  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}`);
7476
+ 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 || [];
7477
+ for (let e of s) await a.delete(`node:${e.id}:${i}:${r}`), await a.delete(`node:${e.key}:${i}:${r}`);
7456
7478
  }
7457
7479
  } catch (e) {
7458
7480
  console.warn("[CacheManager] Failed to purge internal worker cache:", e);
7459
7481
  }
7460
7482
  }
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);
7483
+ purgeNode(e, t, n, r = !1) {
7484
+ let i = (async () => {
7485
+ try {
7486
+ 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]) || {};
7487
+ if (!a.slug) return;
7488
+ 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);
7489
+ await this.purgeInternalWorkerCache(e, t, n, a.slug, a.language || "en"), await this.purgeAndWarmSlugDirect(e, a.slug, c), r && await this.purgeGlobalCacheDirect(e, t);
7490
+ } catch (e) {
7491
+ console.warn("[CacheManager] purgeNode failed:", e);
7492
+ }
7493
+ })();
7494
+ this.dispatch(e, i);
7468
7495
  }
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)));
7496
+ purgeAsset(e, t, n) {
7497
+ let r = (async () => {
7498
+ try {
7499
+ 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 || [];
7500
+ 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));
7501
+ } catch (e) {
7502
+ console.warn("[CacheManager] purgeAsset failed:", e);
7503
+ }
7473
7504
  })();
7474
- this.dispatch(e, o);
7505
+ this.dispatch(e, r);
7475
7506
  }
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
- }
7507
+ purgeGlobalCache(e, t) {
7508
+ this.dispatch(e, this.purgeGlobalCacheDirect(e, t));
7486
7509
  }
7487
7510
  async purgeGlobalCacheDirect(e, t) {
7488
7511
  try {
7489
7512
  let { zoneId: n, apiToken: r, frontendUrl: i } = this.getEnv(e);
7513
+ if (this.isLocalEnv(e)) {
7514
+ console.log("[CacheManager] Local environment detected; skipping Cloudflare edge purge.");
7515
+ return;
7516
+ }
7490
7517
  console.log("[CacheManager] Executing Direct Global Version Purge...");
7491
7518
  let a = await this.callAstroPurge(e, { purge_everything: !0 });
7492
7519
  if (!a.ok) {
7493
- let e = await a.text();
7494
- console.error(`❌ [CacheManager] Astro Global Purge FAILED (${a.status}): ${e}`);
7520
+ console.warn(`[CacheManager] Astro Global Purge skipped or unauthenticated (${a.status})`);
7495
7521
  return;
7496
7522
  }
7497
- if (console.log("✅ [CacheManager] Astro Global Version Tag Updated"), n && r && fetch(`https://api.cloudflare.com/client/v4/zones/${n}/purge_cache`, {
7523
+ n && r && fetch(`https://api.cloudflare.com/client/v4/zones/${n}/purge_cache`, {
7498
7524
  method: "POST",
7499
7525
  headers: {
7500
7526
  Authorization: `Bearer ${r}`,
7501
7527
  "Content-Type": "application/json"
7502
7528
  },
7503
7529
  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
- }
7530
+ }).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
7531
  } catch (e) {
7510
- console.error("❌ [CacheManager] Direct Global Purge CRASH:", e);
7532
+ console.warn("[CacheManager] Direct Global Purge skipped:", e);
7511
7533
  }
7512
7534
  }
7513
7535
  async purgeAndWarmSlugDirect(e, t, n = []) {
7514
7536
  try {
7515
- let { zoneId: r, apiToken: i, frontendUrl: a } = this.getEnv(e), o = t.replace(/^\/+|\/+$/g, ""), s = o === "home" || !o ? a : `${a}/${o}`, c = [
7537
+ let { zoneId: r, apiToken: i, frontendUrl: a } = this.getEnv(e);
7538
+ if (this.isLocalEnv(e)) return;
7539
+ let o = t.replace(/^\/+|\/+$/g, ""), s = o === "home" || !o ? a : `${a}/${o}`, c = [
7516
7540
  s,
7517
7541
  `${s}/`,
7518
7542
  `https://admin.t3cloud.eu/api/v1/node/${o}?channelId=1&lang=en`,
7519
7543
  `https://admin.t3cloud.eu/api/v1/node/${o}?channelId=corporate&lang=en`,
7520
7544
  `https://admin.t3cloud.eu/api/v1/node/${o}?channelId=default&lang=en`
7521
7545
  ];
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`, {
7546
+ for (let e of n) e && c.push(`${a}${e.startsWith("/") ? e : `/${e}`}`);
7547
+ if (!(await this.callAstroPurge(e, { urls: c })).ok) return;
7548
+ r && i && fetch(`https://api.cloudflare.com/client/v4/zones/${r}/purge_cache`, {
7535
7549
  method: "POST",
7536
7550
  headers: {
7537
7551
  Authorization: `Bearer ${i}`,
7538
7552
  "Content-Type": "application/json"
7539
7553
  },
7540
7554
  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);
7555
+ }).catch(() => {}), await new Promise((e) => setTimeout(e, 100)), fetch(`${s}?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).catch(() => {});
7556
+ } catch (e) {
7557
+ console.warn("[CacheManager] Dual Slug Purge skipped:", e);
7558
+ }
7559
+ }
7560
+ async warmAllPublishedPages(e, t) {
7561
+ try {
7562
+ let { frontendUrl: n } = this.getEnv(e);
7563
+ if (this.isLocalEnv(e)) return;
7564
+ let 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) => {
7565
+ let t = String(e.slug).replace(/^\/+|\/+$/g, ""), r = t === "home" || !t ? n : `${n}/${t}`;
7566
+ return fetch(`${r}?_warmer=${s}`, { headers: o }).catch(() => {});
7545
7567
  });
7568
+ c.push(fetch(`${n}/?_warmer=${s}`, { headers: o }).catch(() => {})), await Promise.all(c);
7546
7569
  } catch (e) {
7547
- console.error("❌ [CacheManager] Dual Slug Purge CRASH:", e);
7570
+ console.warn("⚠️ [CacheWarmer] Tree-wide warming failed:", e);
7548
7571
  }
7549
7572
  }
7550
7573
  }, Z = new e();
@@ -7565,25 +7588,18 @@ async function di(e, t, n = []) {
7565
7588
  if (typeof r.bind == "function") return r.bind(...n).run();
7566
7589
  if (typeof r.run == "function") return r.run(...n);
7567
7590
  }
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) {
7591
+ function fi(e) {
7576
7592
  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
7593
  }
7578
- function mi(e) {
7594
+ function pi(e) {
7579
7595
  return +(e === !0 || e === 1 || e === "1" || e === "true");
7580
7596
  }
7581
- function hi(e) {
7597
+ function mi(e) {
7582
7598
  if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
7583
7599
  let t = Number(e);
7584
7600
  return isNaN(t) ? null : t;
7585
7601
  }
7586
- function gi(e) {
7602
+ function hi(e) {
7587
7603
  let t = { ...e };
7588
7604
  for (let e of [
7589
7605
  "id",
@@ -7612,10 +7628,10 @@ function gi(e) {
7612
7628
  ]) delete t[e];
7613
7629
  return t;
7614
7630
  }
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;
7631
+ function gi(e, t = /* @__PURE__ */ new Set()) {
7632
+ 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
7633
  }
7618
- async function vi(e, t, n) {
7634
+ async function _i(e, t, n) {
7619
7635
  for (let r of n) {
7620
7636
  let n = (await ui(e, "\n SELECT id, storageKeyPrivate, isSystemVariant, parentAssetId, filename\n FROM assets WHERE id = ?\n ", [r]))[0];
7621
7637
  if (!n || (await ui(e, "SELECT 1 FROM node_assets WHERE assetId = ? LIMIT 1", [n.id])).length > 0) continue;
@@ -7634,7 +7650,7 @@ async function vi(e, t, n) {
7634
7650
  await di(e, `DELETE FROM node_assets WHERE assetId IN (${o})`, a), await di(e, `DELETE FROM assets WHERE id IN (${o})`, a);
7635
7651
  }
7636
7652
  }
7637
- async function yi(e, t, n) {
7653
+ async function vi(e, t, n) {
7638
7654
  let r = {}, i = null;
7639
7655
  if (t) {
7640
7656
  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 +7702,18 @@ Z.get("/", async (e) => {
7686
7702
  if (s) try {
7687
7703
  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
7704
  if (a) {
7689
- let { resolvedLayoutId: e, inheritedFields: r } = await yi(t, a.parentId, a.treeId);
7705
+ let { resolvedLayoutId: e, inheritedFields: r } = await vi(t, a.parentId, a.treeId);
7690
7706
  (l === "inherit" || !l) && (l = e || c.defaultLayout || null);
7691
7707
  for (let [e, t] of Object.entries(r)) (n[e] === void 0 || n[e] === null || n[e] === "") && t !== void 0 && (n[e] = t);
7692
7708
  } else (l === "inherit" || !l) && (l = c.defaultLayout || null);
7693
- let u = await oi(t, gi(n));
7709
+ let u = await oi(t, hi(n));
7694
7710
  Object.assign(o, u), o.resolvedLayoutId = l;
7695
7711
  } catch {}
7696
7712
  let c = await t.prepare("SELECT channelId FROM node_channels WHERE nodeId = ?").all(r);
7697
7713
  o.channels = (Array.isArray(c) ? c : c?.results || []).map((e) => e.channelId);
7698
7714
  let l = await t.prepare("SELECT treeId, parentId, sortOrder FROM tree_nodes WHERE contentId = ?").all(r);
7699
7715
  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) => {
7716
+ 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
7717
  let n = {};
7702
7718
  try {
7703
7719
  n = typeof e.dataJson == "string" ? JSON.parse(e.dataJson || "{}") : e.dataJson || {}, n && typeof n == "object" && (n = await oi(t, n));
@@ -7719,12 +7735,9 @@ Z.get("/", async (e) => {
7719
7735
  });
7720
7736
  }
7721
7737
  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") {
7738
+ 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
7739
  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
- }
7740
+ e.length > 0 && (h.push(`cn.contentType IN (${e.map(() => "?").join(",")})`), m.push(...e));
7728
7741
  }
7729
7742
  if (i && i.trim()) {
7730
7743
  h.push("(cn.title LIKE ? OR cn.slug LIKE ?)");
@@ -7744,19 +7757,12 @@ Z.get("/", async (e) => {
7744
7757
  b[c] && (y = b[c]);
7745
7758
  let x = `
7746
7759
  WITH filtered_nodes AS (
7747
- SELECT cn.*
7748
- FROM content_nodes cn
7749
- ${g}
7750
- ORDER BY ${y} ${l}
7751
- LIMIT ? OFFSET ?
7760
+ SELECT cn.* FROM content_nodes cn ${g} ORDER BY ${y} ${l} LIMIT ? OFFSET ?
7752
7761
  )
7753
- SELECT
7754
- fn.*,
7755
- COUNT(na.assetId) as assetCount
7762
+ SELECT fn.*, COUNT(na.assetId) as assetCount
7756
7763
  FROM filtered_nodes fn
7757
7764
  LEFT JOIN node_assets na ON fn.id = na.nodeId
7758
- GROUP BY fn.id
7759
- ORDER BY ${y.replace("cn.", "fn.")} ${l}
7765
+ GROUP BY fn.id ORDER BY ${y.replace("cn.", "fn.")} ${l}
7760
7766
  `, S = [
7761
7767
  ...m,
7762
7768
  f,
@@ -7764,19 +7770,17 @@ Z.get("/", async (e) => {
7764
7770
  ], C = await t.prepare(x).all(...S), w = Array.isArray(C) ? C : C?.results || [], T = w.map((e) => e.id), E = {}, D = {};
7765
7771
  if (T.length > 0) {
7766
7772
  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);
7773
+ SELECT nc.nodeId, c.label FROM node_channels nc JOIN channels c ON nc.channelId = c.id WHERE nc.nodeId IN (${e})
7774
+ `).all(...T);
7775
+ (Array.isArray(n) ? n : n?.results || []).forEach((e) => {
7776
+ E[e.nodeId] || (E[e.nodeId] = []), E[e.nodeId].push(e.label);
7777
+ });
7778
+ let r = await t.prepare(`
7779
+ SELECT tn.contentId as nodeId, t.label FROM tree_nodes tn JOIN trees t ON tn.treeId = t.id WHERE tn.contentId IN (${e})
7780
+ `).all(...T);
7781
+ (Array.isArray(r) ? r : r?.results || []).forEach((e) => {
7782
+ D[e.nodeId] || (D[e.nodeId] = []), D[e.nodeId].includes(e.label) || D[e.nodeId].push(e.label);
7783
+ });
7780
7784
  }
7781
7785
  let O = await Promise.all(w.map(async (e) => {
7782
7786
  let n = (e.status === "draft" || !e.status) && !!e.publishedAt, r = {
@@ -7800,7 +7804,7 @@ Z.get("/", async (e) => {
7800
7804
  assetCount: e.assetCount || 0
7801
7805
  }, i = e.draftDataJson || e.dataJson;
7802
7806
  if (i) try {
7803
- let e = typeof i == "string" ? JSON.parse(i) : i, n = await oi(t, gi(e));
7807
+ let e = typeof i == "string" ? JSON.parse(i) : i, n = await oi(t, hi(e));
7804
7808
  Object.assign(r, n);
7805
7809
  } catch {}
7806
7810
  return r;
@@ -7813,29 +7817,35 @@ Z.get("/", async (e) => {
7813
7817
  limit: f
7814
7818
  });
7815
7819
  }), 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);
7820
+ 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
7821
  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,
7822
+ let n = !1, r = [];
7823
+ if (g !== void 0 && Array.isArray(g) && g.length > 0) for (let e of g) r.push({
7824
+ treeId: Number(e.treeId),
7825
+ parentId: mi(e.parentId ?? e._draftParentId ?? null)
7826
+ });
7827
+ else if (a) {
7828
+ let e = await t.prepare("SELECT treeId, parentId FROM tree_nodes WHERE contentId = ?").all(a), n = Array.isArray(e) ? e : e?.results || [];
7829
+ for (let e of n) r.push({
7830
+ treeId: Number(e.treeId),
7831
+ parentId: e.parentId === null ? null : Number(e.parentId)
7832
+ });
7833
+ }
7834
+ for (let e of r) {
7835
+ let r = e.parentId === null ? "tn.parentId IS NULL" : "tn.parentId = ?", i = e.parentId === null ? [e.treeId, E] : [
7836
+ e.treeId,
7837
+ e.parentId,
7823
7838
  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)) {
7839
+ ], o = `
7840
+ SELECT cn.id FROM tree_nodes tn
7841
+ INNER JOIN content_nodes cn ON tn.contentId = cn.id
7842
+ WHERE tn.treeId = ? AND ${r} AND cn.slug = ? AND (cn.deletedAt IS NULL OR cn.deletedAt = '')
7843
+ `;
7844
+ if (a && (o += " AND cn.id != ?", i.push(a)), o += " LIMIT 1", await t.prepare(o).get(...i)) {
7834
7845
  n = !0;
7835
7846
  break;
7836
7847
  }
7837
7848
  }
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
7849
  if (n) return e.json({
7840
7850
  error: `The slug '${E}' is already in use by another page in this section.`,
7841
7851
  field: "slug"
@@ -7844,13 +7854,13 @@ Z.get("/", async (e) => {
7844
7854
  if (a) {
7845
7855
  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
7856
  try {
7847
- _i(typeof n == "string" ? JSON.parse(n) : n, T);
7857
+ gi(typeof n == "string" ? JSON.parse(n) : n, T);
7848
7858
  } catch {}
7849
7859
  if (m !== void 0) {
7850
7860
  let e = await t.prepare("SELECT dataJson FROM content_blocks WHERE contentId = ? AND isDraft = 1").all(a);
7851
7861
  (Array.isArray(e) ? e : e?.results || []).forEach((e) => {
7852
7862
  try {
7853
- _i(typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson, T);
7863
+ gi(typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson, T);
7854
7864
  } catch {}
7855
7865
  });
7856
7866
  }
@@ -7862,32 +7872,23 @@ Z.get("/", async (e) => {
7862
7872
  ...u,
7863
7873
  ...v
7864
7874
  });
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);
7875
+ 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
7876
  } 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);
7877
+ 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);
7878
+ w = Number(e.lastInsertRowid);
7869
7879
  }
7870
7880
  if (h !== void 0 && Array.isArray(h) && w) {
7871
7881
  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);
7876
- }
7877
- }
7878
- if (g !== void 0 && Array.isArray(g) && g.length > 0 && w) {
7879
- let e = await t.prepare("SELECT treeId, parentId, sortOrder FROM tree_nodes WHERE contentId = ?").all(w), n = Array.isArray(e) ? e : e?.results || [], r = /* @__PURE__ */ new Set(), i = [], a = [];
7880
- for (let e of g) if (e && e.treeId) {
7881
- let t = Number(e.treeId) || e.treeId;
7882
- if (!r.has(t)) {
7883
- r.add(t);
7884
- let o = n.find((e) => Number(e.treeId) === Number(t)), s = hi(e.parentId ?? e._draftParentId ?? null);
7885
- 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);
7888
- }
7882
+ 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);
7883
+ if (e.length > 0) {
7884
+ let n = e.map(() => "(?, ?)").join(", "), r = e.flatMap((e) => [w, e]);
7885
+ await t.prepare(`INSERT OR IGNORE INTO node_channels (nodeId, channelId) VALUES ${n}`).run(...r);
7889
7886
  }
7890
- 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));
7887
+ }
7888
+ if (g !== void 0 && Array.isArray(g) && g.length > 0 && w) for (let e of g) {
7889
+ if (!e || !e.treeId) continue;
7890
+ let n = Number(e.treeId) || e.treeId, r = mi(e.parentId ?? e._draftParentId ?? null), i = typeof e.sortOrder == "number" ? e.sortOrder : 0, a = await t.prepare("SELECT id FROM tree_nodes WHERE treeId = ? AND contentId = ?").get(n, w);
7891
+ a ? await t.prepare("UPDATE tree_nodes SET parentId = ?, sortOrder = ? WHERE id = ?").run(r, i, a.id) : await t.prepare("INSERT INTO tree_nodes (treeId, contentId, parentId, sortOrder) VALUES (?, ?, ?, ?)").run(n, w, r, i);
7891
7892
  }
7892
7893
  let D = [];
7893
7894
  if (m !== void 0 && Array.isArray(m) && w) {
@@ -7899,12 +7900,10 @@ Z.get("/", async (e) => {
7899
7900
  blockId: o,
7900
7901
  _instanceId: o
7901
7902
  });
7902
- c.forEach((e) => {
7903
- D.push({
7904
- ...e,
7905
- fieldKey: `blocks[${t}].${e.fieldKey}`
7906
- });
7907
- });
7903
+ c.forEach((e) => D.push({
7904
+ ...e,
7905
+ fieldKey: `blocks[${t}].${e.fieldKey}`
7906
+ }));
7908
7907
  let l = r.region !== void 0 && r.region !== null && String(r.region).trim() !== "" ? String(r.region) : "content";
7909
7908
  e.push("(?, ?, ?, ?, ?, 1)"), n.push(w, t, i, JSON.stringify(s), l);
7910
7909
  }
@@ -7914,7 +7913,7 @@ Z.get("/", async (e) => {
7914
7913
  let n = [...y, ...D];
7915
7914
  await ii(t, w, n);
7916
7915
  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);
7916
+ i.size > 0 && await _i(t, ni(e.env), i);
7918
7917
  }
7919
7918
  return await J(e).clear(), e.json({
7920
7919
  success: !0,
@@ -7935,7 +7934,7 @@ Z.get("/", async (e) => {
7935
7934
  c = typeof o.draftDataJson == "string" ? JSON.parse(o.draftDataJson) : o.draftDataJson || {};
7936
7935
  } catch {}
7937
7936
  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);
7937
+ 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
7938
  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
7939
  if (g.length > 0) {
7941
7940
  let e = [], n = [];
@@ -7954,9 +7953,7 @@ Z.get("/", async (e) => {
7954
7953
  },
7955
7954
  blocks: g
7956
7955
  };
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({
7956
+ 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
7957
  success: !0,
7961
7958
  id: i,
7962
7959
  status: "published",
@@ -7966,45 +7963,30 @@ Z.get("/", async (e) => {
7966
7963
  }), Z.delete("/", async (e) => {
7967
7964
  let t = e.get("db"), n = e.req.query("id");
7968
7965
  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({
7966
+ let r = Number(n);
7967
+ 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
7968
  success: !0,
7978
7969
  deletedNodeId: r
7979
7970
  });
7980
7971
  }), Z.post("/restore", async (e) => {
7981
7972
  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({
7973
+ 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
7974
  success: !0,
7993
7975
  restoredNodeId: r
7994
- });
7976
+ })) : e.json({ error: "Node not found" }, 404) : e.json({ error: "Node ID required" }, 400);
7995
7977
  }), Z.delete("/purge", async (e) => {
7996
7978
  let t = e.get("db"), n = e.req.query("id");
7997
7979
  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({
7980
+ let r = Number(n);
7981
+ 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
7982
  success: !0,
8001
7983
  purgedNodeId: r
8002
7984
  });
8003
7985
  });
8004
7986
  //#endregion
8005
7987
  //#region server/routes/admin/trees.ts
8006
- var bi = new e();
8007
- function xi(e, t = null) {
7988
+ var yi = new e();
7989
+ function bi(e, t = null) {
8008
7990
  let n = [];
8009
7991
  for (let r = 0; r < e.length; r++) {
8010
7992
  let i = e[r];
@@ -8016,19 +7998,19 @@ function xi(e, t = null) {
8016
7998
  id: o,
8017
7999
  parentId: t,
8018
8000
  sortOrder: r
8019
- }), i.children && Array.isArray(i.children) && i.children.length > 0 && n.push(...xi(i.children, o)));
8001
+ }), i.children && Array.isArray(i.children) && i.children.length > 0 && n.push(...bi(i.children, o)));
8020
8002
  }
8021
8003
  return n;
8022
8004
  }
8023
- function Si(e) {
8005
+ function xi(e) {
8024
8006
  if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
8025
8007
  let t = Number(e);
8026
8008
  return isNaN(t) ? null : t;
8027
8009
  }
8028
- function Ci(e) {
8010
+ function Si(e) {
8029
8011
  return +(e === !0 || e === 1 || e === "1" || e === "true");
8030
8012
  }
8031
- bi.get("/tree.json", async (e) => {
8013
+ yi.get("/tree.json", async (e) => {
8032
8014
  try {
8033
8015
  let t = e.get("db"), n = e.req.query("treeId") || "main-nav", r = e.req.query("preview") === "true", i = 1;
8034
8016
  if (isNaN(Number(n))) {
@@ -8078,7 +8060,7 @@ bi.get("/tree.json", async (e) => {
8078
8060
  } catch (t) {
8079
8061
  return console.error("[CMS Tree API] GET Error:", t), e.json({ error: t.message || "Failed to fetch tree" }, 500);
8080
8062
  }
8081
- }), bi.post("/tree.json", async (e) => {
8063
+ }), yi.post("/tree.json", async (e) => {
8082
8064
  try {
8083
8065
  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
8066
  if (isNaN(Number(r))) {
@@ -8090,7 +8072,7 @@ bi.get("/tree.json", async (e) => {
8090
8072
  }
8091
8073
  } else o = Number(r);
8092
8074
  if (n.tree && Array.isArray(n.tree)) {
8093
- let r = xi(n.tree, null);
8075
+ let r = bi(n.tree, null);
8094
8076
  if (r.length > 0) for (let e = 0; e < r.length; e += 50) {
8095
8077
  let n = r.slice(e, e + 50), i = n.map((e) => e.id), a = i.map(() => "?").join(","), s = "UPDATE tree_nodes SET \n";
8096
8078
  s += "parentId = CASE id \n", n.forEach(() => {
@@ -8110,9 +8092,9 @@ bi.get("/tree.json", async (e) => {
8110
8092
  reorderedCount: r.length
8111
8093
  });
8112
8094
  }
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);
8095
+ 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
8096
  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;
8097
+ let g = xi(u), _ = e.get("user")?.id || null;
8116
8098
  if (s === "create") {
8117
8099
  let r = m.slug || n.slug || c, s = r ? String(r).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") : null;
8118
8100
  if (s) {
@@ -8201,7 +8183,7 @@ bi.get("/tree.json", async (e) => {
8201
8183
  details: t.message
8202
8184
  }, 500);
8203
8185
  }
8204
- }), bi.get("/trees.json", async (e) => {
8186
+ }), yi.get("/trees.json", async (e) => {
8205
8187
  try {
8206
8188
  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
8189
  let n = Number(t.treeId), r = Number(t.channelId);
@@ -8231,7 +8213,7 @@ bi.get("/tree.json", async (e) => {
8231
8213
  } catch {
8232
8214
  return e.json([]);
8233
8215
  }
8234
- }), bi.post("/trees.json", async (e) => {
8216
+ }), yi.post("/trees.json", async (e) => {
8235
8217
  try {
8236
8218
  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
8219
  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 +8252,7 @@ bi.get("/tree.json", async (e) => {
8270
8252
  } catch (t) {
8271
8253
  return console.error("[API Trees] Error saving tree:", t), e.json({ error: t.message || "Failed to save tree" }, 500);
8272
8254
  }
8273
- }), bi.delete("/trees.json", async (e) => {
8255
+ }), yi.delete("/trees.json", async (e) => {
8274
8256
  let t = e.get("db"), n = e.req.query("id");
8275
8257
  if (!n) return e.json({ error: "Tree ID required" }, 400);
8276
8258
  let r = Number(n);
@@ -8285,8 +8267,8 @@ bi.get("/tree.json", async (e) => {
8285
8267
  });
8286
8268
  //#endregion
8287
8269
  //#region server/routes/admin/channels.ts
8288
- var wi = new e();
8289
- wi.get("/", async (e) => {
8270
+ var Ci = new e();
8271
+ Ci.get("/", async (e) => {
8290
8272
  try {
8291
8273
  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
8274
  e[t.channelId] || (e[t.channelId] = []);
@@ -8352,7 +8334,7 @@ wi.get("/", async (e) => {
8352
8334
  error: t.message
8353
8335
  }, 500);
8354
8336
  }
8355
- }), wi.post("/", async (e) => {
8337
+ }), Ci.post("/", async (e) => {
8356
8338
  try {
8357
8339
  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
8340
  if (await t.prepare("SELECT id FROM channels WHERE key = ? AND id != ? LIMIT 1").get(y, i ?? -1)) return e.json({
@@ -8389,7 +8371,7 @@ wi.get("/", async (e) => {
8389
8371
  details: t.message
8390
8372
  }, 500);
8391
8373
  }
8392
- }), wi.delete("/", async (e) => {
8374
+ }), Ci.delete("/", async (e) => {
8393
8375
  let t = e.get("db"), n = e.req.query("id");
8394
8376
  if (!n) return e.json({ error: "Channel ID required" }, 400);
8395
8377
  let r = Number(n);
@@ -8407,9 +8389,9 @@ wi.get("/", async (e) => {
8407
8389
  });
8408
8390
  //#endregion
8409
8391
  //#region server/routes/admin/schemas.ts
8410
- var Ti = new e(), Ei = null, Di = (e) => {
8392
+ var wi = new e(), Ti = null, Ei = (e) => {
8411
8393
  try {
8412
- if (!Ei) {
8394
+ if (!Ti) {
8413
8395
  let t = ci(e.env?.BUNDLED_DEFINITIONS || Or), n = t.userTemplate || {
8414
8396
  id: "userTemplate",
8415
8397
  label: "User Account",
@@ -8446,7 +8428,7 @@ var Ti = new e(), Ei = null, Di = (e) => {
8446
8428
  }
8447
8429
  }
8448
8430
  };
8449
- Ei = {
8431
+ Ti = {
8450
8432
  channelTemplate: t.channelTemplate || null,
8451
8433
  treeTemplate: t.treeTemplate || null,
8452
8434
  userTemplate: n,
@@ -8458,7 +8440,7 @@ var Ti = new e(), Ei = null, Di = (e) => {
8458
8440
  blockLayouts: t.blockLayouts || {}
8459
8441
  };
8460
8442
  }
8461
- return e.json(Ei, 200, { "Cache-Control": "public, max-age=300, stale-while-revalidate=86400" });
8443
+ return e.json(Ti, 200, { "Cache-Control": "public, max-age=300, stale-while-revalidate=86400" });
8462
8444
  } catch (t) {
8463
8445
  return console.error("[CMS API] Error loading schemas:", t), e.json({
8464
8446
  error: "Failed to load schemas",
@@ -8466,10 +8448,10 @@ var Ti = new e(), Ei = null, Di = (e) => {
8466
8448
  }, 500);
8467
8449
  }
8468
8450
  };
8469
- Ti.get("/", Di), Ti.get("/schemas.json", Di);
8451
+ wi.get("/", Ei), wi.get("/schemas.json", Ei);
8470
8452
  //#endregion
8471
8453
  //#region server/routes/admin/validation.ts
8472
- var Oi = new e(), ki = {
8454
+ var Di = new e(), Oi = {
8473
8455
  node: "content_nodes",
8474
8456
  nodes: "content_nodes",
8475
8457
  content_node: "content_nodes",
@@ -8481,7 +8463,7 @@ var Oi = new e(), ki = {
8481
8463
  user: "users",
8482
8464
  users: "users",
8483
8465
  user_account: "user_accounts"
8484
- }, Ai = {
8466
+ }, ki = {
8485
8467
  content_nodes: [
8486
8468
  "id",
8487
8469
  "title",
@@ -8538,11 +8520,11 @@ var Oi = new e(), ki = {
8538
8520
  "createdAt"
8539
8521
  ]
8540
8522
  };
8541
- Oi.post("/validate-unique", async (e) => {
8523
+ Di.post("/validate-unique", async (e) => {
8542
8524
  try {
8543
8525
  let t = e.get("db"), { entityType: n, field: r, value: i, excludeId: a } = await e.req.json();
8544
8526
  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;
8527
+ 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
8528
  if (a != null && String(a).trim() !== "") {
8547
8529
  let e = Number(a);
8548
8530
  l = isNaN(e) ? String(a) : e;
@@ -8554,35 +8536,11 @@ Oi.post("/validate-unique", async (e) => {
8554
8536
  } catch (t) {
8555
8537
  return console.error("[API Validation] Error validating global uniqueness:", t), e.json({ error: "Failed to validate uniqueness" }, 500);
8556
8538
  }
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
- });
8539
+ }), Di.post("/validate-unique-sibling", async (e) => e.json({ isUnique: !0 }));
8582
8540
  //#endregion
8583
8541
  //#region server/routes/admin/stats.ts
8584
- var ji = new e();
8585
- ji.get("/", async (e) => {
8542
+ var Ai = new e();
8543
+ Ai.get("/", async (e) => {
8586
8544
  try {
8587
8545
  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
8546
  ...e,
@@ -8625,7 +8583,7 @@ ji.get("/", async (e) => {
8625
8583
  });
8626
8584
  //#endregion
8627
8585
  //#region server/routes/admin/assets.ts
8628
- var Mi = new e();
8586
+ var ji = new e();
8629
8587
  async function Q(e, t, n = []) {
8630
8588
  let r = e.prepare(t);
8631
8589
  if (typeof r.bind == "function") {
@@ -8638,34 +8596,16 @@ async function Q(e, t, n = []) {
8638
8596
  }
8639
8597
  return [];
8640
8598
  }
8641
- async function Ni(e, t, n = []) {
8599
+ async function Mi(e, t, n = []) {
8642
8600
  let r = e.prepare(t);
8643
8601
  if (typeof r.bind == "function") return await r.bind(...n).run();
8644
8602
  if (typeof r.run == "function") return await r.run(...n);
8645
8603
  }
8646
- function Pi(e, t, n) {
8604
+ function Ni(e, t, n) {
8647
8605
  let r = e || (t ? `/media/${t}` : "");
8648
8606
  return r && n && r.startsWith(`https://${n}/`) && !r.includes("/media/") && (r = r.replace(`https://${n}/`, `https://${n}/media/`)), r;
8649
8607
  }
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) => {
8608
+ ji.get("/", async (e) => {
8669
8609
  try {
8670
8610
  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
8611
  createdAt: "a.createdAt",
@@ -8732,7 +8672,7 @@ Mi.get("/", async (e) => {
8732
8672
  ...JSON.parse(t.dataJson || "{}")
8733
8673
  };
8734
8674
  } catch {}
8735
- let r = Pi(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN);
8675
+ let r = Ni(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN);
8736
8676
  return {
8737
8677
  id: t.id,
8738
8678
  filename: t.filename || "Untitled Asset",
@@ -8756,7 +8696,7 @@ Mi.get("/", async (e) => {
8756
8696
  details: t.message || String(t)
8757
8697
  }, 500);
8758
8698
  }
8759
- }), Mi.post("/upload", async (e) => {
8699
+ }), ji.post("/upload", async (e) => {
8760
8700
  try {
8761
8701
  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
8702
  s && (await Q(t, "SELECT id FROM assets WHERE id = ?", [s])).length === 0 && (s = null);
@@ -8775,7 +8715,7 @@ Mi.get("/", async (e) => {
8775
8715
  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
8716
  T && (await Q(t, "SELECT id FROM users WHERE id = ?", [T])).length === 0 && (T = null);
8777
8717
  let E = +!!h;
8778
- await Ni(t, "\n INSERT INTO assets (id, filename, mimeType, sizeBytes, storageKeyPrivate, cdnUrl, createdById, isSystemVariant, parentAssetId, cropCoordinatesJson)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ", [
8718
+ await Mi(t, "\n INSERT INTO assets (id, filename, mimeType, sizeBytes, storageKeyPrivate, cdnUrl, createdById, isSystemVariant, parentAssetId, cropCoordinatesJson)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ", [
8779
8719
  p,
8780
8720
  i.name,
8781
8721
  S,
@@ -8790,7 +8730,7 @@ Mi.get("/", async (e) => {
8790
8730
  let D = x;
8791
8731
  if (s) {
8792
8732
  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);
8733
+ n.length > 0 && (D = Ni(n[0].cdnUrl, n[0].storageKeyPrivate, y)), new X(e.env).purgeAsset(e, t, s);
8794
8734
  }
8795
8735
  return e.json({
8796
8736
  id: p,
@@ -8809,7 +8749,7 @@ Mi.get("/", async (e) => {
8809
8749
  details: t.message || String(t)
8810
8750
  }, 500);
8811
8751
  }
8812
- }), Mi.get("/:id/details", async (e) => {
8752
+ }), ji.get("/:id/details", async (e) => {
8813
8753
  try {
8814
8754
  let t = u(e), n = e.req.param("id"), r = await Q(t, "SELECT * FROM assets WHERE id = ?", [n]);
8815
8755
  if (!r || r.length === 0) return e.json({ error: "Asset not found" }, 404);
@@ -8832,7 +8772,7 @@ Mi.get("/", async (e) => {
8832
8772
  ...JSON.parse(i.dataJson || "{}")
8833
8773
  };
8834
8774
  } catch {}
8835
- let l = Pi(i.cdnUrl, i.storageKeyPrivate, e.env?.CDN_DOMAIN);
8775
+ let l = Ni(i.cdnUrl, i.storageKeyPrivate, e.env?.CDN_DOMAIN);
8836
8776
  return e.json({
8837
8777
  id: i.id,
8838
8778
  filename: i.filename,
@@ -8859,7 +8799,7 @@ Mi.get("/", async (e) => {
8859
8799
  createdAt: t.createdAt,
8860
8800
  parentAssetId: t.parentAssetId || i.id,
8861
8801
  cropCoordinates: n,
8862
- url: Pi(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN),
8802
+ url: Ni(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN),
8863
8803
  originalUrl: l
8864
8804
  };
8865
8805
  })
@@ -8867,7 +8807,7 @@ Mi.get("/", async (e) => {
8867
8807
  } catch (t) {
8868
8808
  return console.error("❌ [Asset Details Error]:", t), e.json({ error: "Failed to load details" }, 500);
8869
8809
  }
8870
- }), Mi.put("/:id", async (e) => {
8810
+ }), ji.put("/:id", async (e) => {
8871
8811
  try {
8872
8812
  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
8813
  if (!i || i.length === 0) return e.json({ error: "Asset not found" }, 404);
@@ -8875,18 +8815,18 @@ Mi.get("/", async (e) => {
8875
8815
  try {
8876
8816
  o = JSON.parse(a.dataJson || "{}");
8877
8817
  } 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 = ?", [
8818
+ 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
8819
  r.filename === void 0 ? a.filename : r.filename,
8880
8820
  JSON.stringify(o),
8881
8821
  n
8882
- ]), await Fi(e, t, n), e.json({ success: !0 });
8822
+ ]), new X(e.env).purgeAsset(e, t, n), e.json({ success: !0 });
8883
8823
  } catch (t) {
8884
8824
  return console.error("❌ [Asset Update Error]:", t), e.json({ error: "Failed to update asset" }, 500);
8885
8825
  }
8886
- }), Mi.delete("/:id", async (e) => {
8826
+ }), ji.delete("/:id", async (e) => {
8887
8827
  try {
8888
8828
  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 ?))", [
8829
+ 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
8830
  n,
8891
8831
  n,
8892
8832
  `crop_%${r.filename ? r.filename.replace(/\.[^/.]+$/, "") : ""}%`,
@@ -8902,17 +8842,17 @@ Mi.get("/", async (e) => {
8902
8842
  details: t.message || String(t)
8903
8843
  }, 500);
8904
8844
  }
8905
- }), Mi.post("/restore", async (e) => {
8845
+ }), ji.post("/restore", async (e) => {
8906
8846
  try {
8907
8847
  let t = u(e), n = await e.req.json(), r = n.id || n.assetId;
8908
8848
  if (!r) return e.json({ error: "Asset ID required" }, 400);
8909
8849
  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 ?))", [
8850
+ 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
8851
  r,
8912
8852
  r,
8913
8853
  `crop_%${i.filename ? i.filename.replace(/\.[^/.]+$/, "") : ""}%`,
8914
8854
  `%${r}%`
8915
- ]), await Fi(e, t, r), e.json({
8855
+ ]), new X(e.env).purgeAsset(e, t, r), e.json({
8916
8856
  success: !0,
8917
8857
  id: r,
8918
8858
  restored: !0
@@ -8923,11 +8863,11 @@ Mi.get("/", async (e) => {
8923
8863
  details: t.message
8924
8864
  }, 500);
8925
8865
  }
8926
- }), Mi.delete("/purge/:id", async (e) => {
8866
+ }), ji.delete("/purge/:id", async (e) => {
8927
8867
  try {
8928
8868
  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
8869
  if (!i) return e.json({ error: "Asset not found" }, 404);
8930
- await Fi(e, t, r);
8870
+ new X(e.env).purgeAsset(e, t, r);
8931
8871
  let a = [i];
8932
8872
  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
8873
  r,
@@ -8943,7 +8883,7 @@ Mi.get("/", async (e) => {
8943
8883
  }
8944
8884
  }
8945
8885
  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({
8886
+ 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
8887
  success: !0,
8948
8888
  id: r,
8949
8889
  purged: !0,
@@ -8959,8 +8899,8 @@ Mi.get("/", async (e) => {
8959
8899
  });
8960
8900
  //#endregion
8961
8901
  //#region server/routes/public/node.ts
8962
- var Ii = new e();
8963
- function Li() {
8902
+ var Pi = new e();
8903
+ function Fi() {
8964
8904
  return {
8965
8905
  fullPath: /* @__PURE__ */ new Map(),
8966
8906
  treeEdges: /* @__PURE__ */ new Map(),
@@ -8968,10 +8908,10 @@ function Li() {
8968
8908
  assetUrls: /* @__PURE__ */ new Map()
8969
8909
  };
8970
8910
  }
8971
- function Ri(...e) {
8911
+ function Ii(...e) {
8972
8912
  return e.map((e) => String(e ?? "")).join(":");
8973
8913
  }
8974
- function zi(e, t) {
8914
+ function Li(e, t) {
8975
8915
  let n = Date.now();
8976
8916
  if (e && String(e).trim() !== "") {
8977
8917
  let t = Date.parse(e);
@@ -8983,7 +8923,7 @@ function zi(e, t) {
8983
8923
  }
8984
8924
  return !0;
8985
8925
  }
8986
- async function Bi(e, t, n) {
8926
+ async function Ri(e, t, n) {
8987
8927
  let r = t.filter((e) => e.componentId === "content-feed" || e.componentId === "article-list");
8988
8928
  await Promise.all(r.map(async (t) => {
8989
8929
  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 +8944,7 @@ async function Bi(e, t, n) {
9004
8944
  if (e.dataJson) try {
9005
8945
  t = typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson;
9006
8946
  } catch {}
9007
- return zi(t.startShowingAt, t.stopShowingAt) ? {
8947
+ return Li(t.startShowingAt, t.stopShowingAt) ? {
9008
8948
  id: e.id,
9009
8949
  title: e.title,
9010
8950
  slug: e.slug,
@@ -9021,7 +8961,7 @@ async function Bi(e, t, n) {
9021
8961
  }
9022
8962
  }));
9023
8963
  }
9024
- async function Vi(e, t, n, r, i = !1, a) {
8964
+ async function zi(e, t, n, r, i = !1, a) {
9025
8965
  if (!t) return { blocks: [] };
9026
8966
  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
8967
  if (!s || s.length === 0) return { blocks: [] };
@@ -9077,10 +9017,10 @@ async function Vi(e, t, n, r, i = !1, a) {
9077
9017
  try {
9078
9018
  a = (typeof t.dataJson == "string" ? JSON.parse(t.dataJson) : t.dataJson) || {};
9079
9019
  } catch {}
9080
- let o = a.hidden === !0 || a.hidden === 1 || a.hidden === "1" || a.hidden === "true", s = zi(a.startShowingAt, a.stopShowingAt);
9020
+ let o = a.hidden === !0 || a.hidden === 1 || a.hidden === "1" || a.hidden === "true", s = Li(a.startShowingAt, a.stopShowingAt);
9081
9021
  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, {
9022
+ 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);
9023
+ return d = await oi(e, d), d = Vi(d), d.blockId = u, {
9084
9024
  region: t.region || n,
9085
9025
  block: {
9086
9026
  instanceId: t.id,
@@ -9100,7 +9040,7 @@ async function Vi(e, t, n, r, i = !1, a) {
9100
9040
  }
9101
9041
  return { blocks: [] };
9102
9042
  }
9103
- function Hi(e, t = {}) {
9043
+ function Bi(e, t = {}) {
9104
9044
  let n = {};
9105
9045
  for (let [r, i] of Object.entries(e)) {
9106
9046
  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 +9049,14 @@ function Hi(e, t = {}) {
9109
9049
  }
9110
9050
  return n;
9111
9051
  }
9112
- function Ui(e) {
9113
- if (Array.isArray(e)) return e.map(Ui);
9052
+ function Vi(e) {
9053
+ if (Array.isArray(e)) return e.map(Vi);
9114
9054
  if (!e || typeof e != "object") return e;
9115
9055
  if (typeof e.id == "string" && e.id.startsWith("ast_") && typeof e.url == "string") {
9116
9056
  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
9057
  ...t,
9118
9058
  ...t.crops?.[r] || {}
9119
- } : t, a = Object.fromEntries(Object.entries(n).filter(([, t]) => t?.id !== e.id).map(([t, n]) => [t, Ui({
9059
+ } : t, a = Object.fromEntries(Object.entries(n).filter(([, t]) => t?.id !== e.id).map(([t, n]) => [t, Vi({
9120
9060
  ...n,
9121
9061
  title: n?.title ?? e.title ?? "",
9122
9062
  alt: n?.alt ?? e.alt ?? "",
@@ -9130,9 +9070,9 @@ function Ui(e) {
9130
9070
  ...Object.keys(a).length > 0 ? { variants: a } : {}
9131
9071
  };
9132
9072
  }
9133
- return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Ui(t)]));
9073
+ return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Vi(t)]));
9134
9074
  }
9135
- async function Wi(e, t, n) {
9075
+ async function Hi(e, t, n) {
9136
9076
  if (typeof t == "string") {
9137
9077
  if (!t.includes("#node:") && !t.includes("data-node-id") && !t.includes("#asset:") && !t.includes("data-asset-id")) return t;
9138
9078
  let r = (e, t) => {
@@ -9158,9 +9098,9 @@ async function Wi(e, t, n) {
9158
9098
  return await Promise.all(Array.from(t.matchAll(h)).map(async (t) => {
9159
9099
  let i = t[1], a = r(i, "data-node-id"), o = r(i, "data-tree-id");
9160
9100
  if (!a || !o) return;
9161
- let s = await Ki(e, a, o, n);
9101
+ let s = await Wi(e, a, o, n);
9162
9102
  if (s?.treeNodeId) {
9163
- let t = await Xi(e, String(s.treeNodeId), o, n);
9103
+ let t = await Ji(e, String(s.treeNodeId), o, n);
9164
9104
  m.set(`${a}:${o}`, t);
9165
9105
  }
9166
9106
  })), t.replace(h, (e, t) => {
@@ -9180,39 +9120,39 @@ async function Wi(e, t, n) {
9180
9120
  return /href\s*=\s*["'][^"']*["']/i.test(_) ? _ = _.replace(/href\s*=\s*["'][^"']*["']/i, `href="${g || "/"}"`) : _ += ` href="${g || "/"}"`, `<a ${_}>`;
9181
9121
  });
9182
9122
  }
9183
- if (Array.isArray(t)) return Promise.all(t.map((t) => Wi(e, t, n)));
9123
+ if (Array.isArray(t)) return Promise.all(t.map((t) => Hi(e, t, n)));
9184
9124
  if (t && typeof t == "object") {
9185
9125
  if (typeof t.href == "string" && (t.href.startsWith("#node:") || t.href.startsWith("#asset:"))) return {
9186
9126
  ...t,
9187
- href: await Gi(e, t, n)
9127
+ href: await Ui(e, t, n)
9188
9128
  };
9189
- let r = await Promise.all(Object.entries(t).map(async ([t, r]) => [t, await Wi(e, r, n)]));
9129
+ let r = await Promise.all(Object.entries(t).map(async ([t, r]) => [t, await Hi(e, r, n)]));
9190
9130
  return Object.fromEntries(r);
9191
9131
  }
9192
9132
  return t;
9193
9133
  }
9194
- async function Gi(e, t, n) {
9134
+ async function Ui(e, t, n) {
9195
9135
  let r = t.href.match(/^#node:(.+)$/), i = t.href.match(/^#asset:(.+)$/);
9196
- if (i) return Ji(e, i[1], n);
9136
+ if (i) return Ki(e, i[1], n);
9197
9137
  if (!r) return t.href;
9198
9138
  let a = r[1];
9199
9139
  if (t.treeId) {
9200
- let r = await Ki(e, a, String(t.treeId), n);
9140
+ let r = await Wi(e, a, String(t.treeId), n);
9201
9141
  if (r?.treeNodeId) {
9202
- let i = await Xi(e, String(r.treeNodeId), String(t.treeId), n);
9142
+ let i = await Ji(e, String(r.treeNodeId), String(t.treeId), n);
9203
9143
  if (i) return i;
9204
9144
  }
9205
9145
  }
9206
- let o = await qi(e, a, n);
9146
+ let o = await Gi(e, a, n);
9207
9147
  return o === void 0 ? "#" : `/${o}`;
9208
9148
  }
9209
- async function Ki(e, t, n, r) {
9210
- let i = Ri(t, n), a = r.treeEdges.get(i);
9149
+ async function Wi(e, t, n, r) {
9150
+ let i = Ii(t, n), a = r.treeEdges.get(i);
9211
9151
  if (a) return a;
9212
9152
  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
9153
  return r.treeEdges.set(i, Promise.resolve(o)), o;
9214
9154
  }
9215
- async function qi(e, t, n) {
9155
+ async function Gi(e, t, n) {
9216
9156
  let r = String(t), i = n.nodeSlugs.get(r);
9217
9157
  if (i) return i;
9218
9158
  let a = (async () => {
@@ -9221,7 +9161,7 @@ async function qi(e, t, n) {
9221
9161
  })();
9222
9162
  return n.nodeSlugs.set(r, a), a;
9223
9163
  }
9224
- async function Ji(e, t, n) {
9164
+ async function Ki(e, t, n) {
9225
9165
  let r = String(t), i = n.assetUrls.get(r);
9226
9166
  if (i) return i;
9227
9167
  let a = (async () => {
@@ -9230,7 +9170,7 @@ async function Ji(e, t, n) {
9230
9170
  })();
9231
9171
  return n.assetUrls.set(r, a), a;
9232
9172
  }
9233
- function Yi(e) {
9173
+ function qi(e) {
9234
9174
  let t = e.socialImage;
9235
9175
  if (!t || typeof t != "object") return null;
9236
9176
  let n = (e, t) => {
@@ -9261,9 +9201,9 @@ function Yi(e) {
9261
9201
  ])
9262
9202
  };
9263
9203
  }
9264
- async function Xi(e, t, n, r) {
9204
+ async function Ji(e, t, n, r) {
9265
9205
  if (!t) return "";
9266
- let i = Ri(t, n);
9206
+ let i = Ii(t, n);
9267
9207
  if (r) {
9268
9208
  let e = r.fullPath.get(i);
9269
9209
  if (e) return e;
@@ -9278,7 +9218,7 @@ async function Xi(e, t, n, r) {
9278
9218
  })();
9279
9219
  return r && r.fullPath.set(i, a), a;
9280
9220
  }
9281
- async function Zi(e, t, n, r, i) {
9221
+ async function Yi(e, t, n, r, i) {
9282
9222
  let a = {}, o = null;
9283
9223
  if (t) {
9284
9224
  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 +9256,20 @@ async function Zi(e, t, n, r, i) {
9316
9256
  inheritedFields: a
9317
9257
  };
9318
9258
  }
9319
- function Qi(e) {
9259
+ function Xi(e) {
9320
9260
  let t = Number(e?.env?.CMS_NODE_CACHE_TTL);
9321
9261
  return Number.isFinite(t) && t >= 60 ? Math.floor(t) : 300;
9322
9262
  }
9323
- async function $i(e, t, n, r) {
9263
+ async function Zi(e, t, n, r) {
9324
9264
  try {
9325
9265
  await e.set(t, n, r);
9326
9266
  } catch (e) {
9327
9267
  console.warn("[CMS Cache] Failed to write node response to cache:", e);
9328
9268
  }
9329
9269
  }
9330
- Ii.get("/*", async (e) => {
9270
+ Pi.get("/*", async (e) => {
9331
9271
  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));
9272
+ 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
9273
  if (!c) return e.json({ error: `Channel '${a}' not found` }, 404);
9334
9274
  let l = c.status === "disabled" || c.status === "inactive" || c.isEnabled === 0 || c.isEnabled === !1;
9335
9275
  if (!s && l) return e.json({ error: `Channel '${c.key || a}' is currently inactive` }, 404);
@@ -9354,7 +9294,7 @@ Ii.get("/*", async (e) => {
9354
9294
  if (E.length > 0) {
9355
9295
  let e = await Promise.all(E.map(async (e) => ({
9356
9296
  candidate: e,
9357
- calculatedPath: await Xi(t, String(e.treeNodeId), String(e.treeId), n)
9297
+ calculatedPath: await Ji(t, String(e.treeNodeId), String(e.treeId), n)
9358
9298
  }))), r = S.replace(/^\/+|\/+$/g, "");
9359
9299
  for (let { candidate: t, calculatedPath: n } of e) {
9360
9300
  let e = n.replace(/^\/+|\/+$/g, "");
@@ -9378,7 +9318,7 @@ Ii.get("/*", async (e) => {
9378
9318
  LIMIT 1
9379
9319
  `).get(...e);
9380
9320
  }
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 = {
9321
+ 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
9322
  id: _.id,
9383
9323
  title: _.title,
9384
9324
  slug: _.slug,
@@ -9387,32 +9327,32 @@ Ii.get("/*", async (e) => {
9387
9327
  nodeType: _.contentType,
9388
9328
  createdAt: _.createdAt,
9389
9329
  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 || {});
9330
+ }, ee = _.contentType || "node", j = h.nodes?.[ee] || Object.values(h.nodes || {})[0] || {}, M = { ...j.fields || {} };
9331
+ j.tabs && Object.values(j.tabs).forEach((e) => {
9332
+ Object.assign(M, e.fields || {});
9393
9333
  });
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;
9334
+ let te = {}, ne = null, re = null, ie = !1, N = {}, P = s && _.draftDataJson ? _.draftDataJson : _.dataJson || _.draftDataJson;
9335
+ if (P) try {
9336
+ N = typeof P == "string" ? JSON.parse(P) : P;
9397
9337
  } 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 = [];
9338
+ 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;
9339
+ 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;
9340
+ 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);
9341
+ let I = await oi(t, Bi(N, M));
9342
+ I = Vi(I), I = await Hi(t, I, n);
9343
+ let le = qi(I);
9344
+ 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;
9345
+ let ue = Number(_.isHidden) === 1 || ie, de = !Li(ne, re);
9346
+ if (!s && (ue || de)) return e.json({ error: "Node is hidden or outside its scheduled publishing window" }, 404);
9347
+ let fe = [];
9408
9348
  if (v?.treeNodeId) {
9409
9349
  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) => {
9350
+ fe = n.map((e) => {
9411
9351
  let t = {}, n = s && e.draftDataJson ? e.draftDataJson : e.dataJson;
9412
9352
  try {
9413
9353
  t = (typeof n == "string" ? JSON.parse(n) : n) || {};
9414
9354
  } 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, "");
9355
+ 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
9356
  return !s && (i || !a) ? null : {
9417
9357
  treeNodeId: e.treeNodeId,
9418
9358
  id: e.id,
@@ -9424,18 +9364,18 @@ Ii.get("/*", async (e) => {
9424
9364
  };
9425
9365
  }).filter(Boolean);
9426
9366
  }
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) => {
9367
+ A.children = fe;
9368
+ 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 || [];
9369
+ 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 || []);
9370
+ let z = {}, B = {}, me = await Promise.all(pe.map(async (e) => {
9431
9371
  let r = e.region || "main", i = {};
9432
9372
  try {
9433
9373
  i = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
9434
9374
  } catch {}
9435
- let a = i.hidden === !0 || i.hidden === 1 || i.hidden === "1" || i.hidden === "true", o = zi(i.startShowingAt, i.stopShowingAt);
9375
+ let a = i.hidden === !0 || i.hidden === 1 || i.hidden === "1" || i.hidden === "true", o = Li(i.startShowingAt, i.stopShowingAt);
9436
9376
  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, {
9377
+ 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);
9378
+ return d = await oi(t, d), d = Vi(d), d = await Hi(t, d, n), d.blockId = u, {
9439
9379
  region: r,
9440
9380
  block: {
9441
9381
  instanceId: e.id,
@@ -9445,8 +9385,8 @@ Ii.get("/*", async (e) => {
9445
9385
  }
9446
9386
  };
9447
9387
  }));
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 = {
9388
+ for (let e of me) e && (z[e.region] || (z[e.region] = [], B[e.region] = { isInherited: !1 }), z[e.region].push(e.block));
9389
+ let he = {
9450
9390
  header: {
9451
9391
  label: "Header",
9452
9392
  inherit: "parent"
@@ -9455,33 +9395,33 @@ Ii.get("/*", async (e) => {
9455
9395
  label: "Footer",
9456
9396
  inherit: "parent"
9457
9397
  },
9458
- ...(P ? h.nodeLayouts?.[P] || h.layouts?.[P] : null)?.regions || { main: { label: "Content" } }
9398
+ ...(F ? h.nodeLayouts?.[F] || h.layouts?.[F] : null)?.regions || { main: { label: "Content" } }
9459
9399
  };
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] = {
9400
+ for (let [e, r] of Object.entries(he)) {
9401
+ let i = z[e] && z[e].length > 0, a = !!te[e];
9402
+ 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) {
9403
+ let r = await zi(t, O, e, h, s, n);
9404
+ if (r.blocks.length > 0 && (z[e] = r.blocks, B[e] = {
9465
9405
  isInherited: !0,
9466
9406
  inheritedFromId: r.inheritedFromId,
9467
9407
  inheritedFromTitle: r.inheritedFromTitle
9468
- }, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (R[t] = n, z[t] = {
9408
+ }, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (z[t] = n, B[t] = {
9469
9409
  isInherited: !0,
9470
9410
  inheritedFromId: r.inheritedFromId,
9471
9411
  inheritedFromTitle: r.inheritedFromTitle
9472
9412
  });
9473
9413
  }
9474
9414
  }
9475
- await Promise.all(Object.keys(R).map((e) => Bi(t, R[e], u)));
9476
- let _e = {
9415
+ await Promise.all(Object.keys(z).map((e) => Ri(t, z[e], u)));
9416
+ let ge = {
9477
9417
  channelId: u || d,
9478
9418
  treeId: D,
9479
9419
  language: A.language,
9480
9420
  node: A,
9481
- content: R,
9482
- regionMeta: z
9421
+ content: z,
9422
+ regionMeta: B
9483
9423
  };
9484
- return !s && !m && (e.header("X-Cache", "MISS"), await $i(f, p, _e, Qi(e))), e.json(_e);
9424
+ return !s && !m && (e.header("X-Cache", "MISS"), await Zi(f, p, ge, Xi(e))), e.json(ge);
9485
9425
  } catch (t) {
9486
9426
  console.error("[CMS Public API] Error fetching node by path:", t);
9487
9427
  let n = e.env?.ENVIRONMENT === "development";
@@ -9493,8 +9433,8 @@ Ii.get("/*", async (e) => {
9493
9433
  });
9494
9434
  //#endregion
9495
9435
  //#region server/routes/public/tree.ts
9496
- var ea = new e();
9497
- function ta(e, t) {
9436
+ var Qi = new e();
9437
+ function $i(e, t) {
9498
9438
  let n = /* @__PURE__ */ new Date();
9499
9439
  if (e && String(e).trim() !== "") {
9500
9440
  let t = new Date(e);
@@ -9506,14 +9446,14 @@ function ta(e, t) {
9506
9446
  }
9507
9447
  return !0;
9508
9448
  }
9509
- async function na(e, t, n, r) {
9449
+ async function ea(e, t, n, r) {
9510
9450
  try {
9511
9451
  await e.set(t, n, r);
9512
9452
  } catch (e) {
9513
9453
  console.warn("[CMS Cache] Failed to write tree response to cache:", e);
9514
9454
  }
9515
9455
  }
9516
- ea.get("/:treeParam", async (e) => {
9456
+ Qi.get("/:treeParam", async (e) => {
9517
9457
  try {
9518
9458
  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
9459
  if (r && r !== "default" && r !== "all") {
@@ -9567,7 +9507,7 @@ ea.get("/:treeParam", async (e) => {
9567
9507
  return (p.get(n) || []).map((e) => {
9568
9508
  let n = m.get(String(e.treeNodeId)) || {}, r = {};
9569
9509
  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 = {
9510
+ 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
9511
  id: e.id,
9572
9512
  treeNodeId: e.treeNodeId,
9573
9513
  parentId: e.parentId || null,
@@ -9592,7 +9532,7 @@ ea.get("/:treeParam", async (e) => {
9592
9532
  ...d,
9593
9533
  items: h(null)
9594
9534
  };
9595
- return !i && !s && (e.header("X-Cache", "MISS"), await na(a, o, g, 300)), e.json(g);
9535
+ return !i && !s && (e.header("X-Cache", "MISS"), await ea(a, o, g, 300)), e.json(g);
9596
9536
  } catch (t) {
9597
9537
  return console.error("[CMS Public Tree API] Error:", t), e.json({
9598
9538
  error: "Failed to fetch public tree",
@@ -9602,8 +9542,8 @@ ea.get("/:treeParam", async (e) => {
9602
9542
  });
9603
9543
  //#endregion
9604
9544
  //#region server/routes/public/assets.ts
9605
- var ra = new e();
9606
- function ia(e, t) {
9545
+ var ta = new e();
9546
+ function na(e, t) {
9607
9547
  if (t === "webp") return "image/webp";
9608
9548
  if (t === "avif") return "image/avif";
9609
9549
  if (t === "jpeg" || t === "jpg") return "image/jpeg";
@@ -9611,7 +9551,7 @@ function ia(e, t) {
9611
9551
  let n = e.toLowerCase();
9612
9552
  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
9553
  }
9614
- ra.get("/*", async (e) => {
9554
+ ta.get("/*", async (e) => {
9615
9555
  let t = e.req.path.replace(/^\/media\//, "").replace(/^\//, "");
9616
9556
  if (!t) return e.text("Asset key missing", 400);
9617
9557
  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 +9574,7 @@ ra.get("/*", async (e) => {
9634
9574
  c = await n.get(e);
9635
9575
  }
9636
9576
  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;
9577
+ let d = c.httpMetadata?.contentType || na(t), m = d.startsWith("image/") && !d.includes("svg"), g = !1;
9638
9578
  if (s && m && e.env?.IMAGES) {
9639
9579
  g = !0;
9640
9580
  try {
@@ -9697,7 +9637,7 @@ ra.get("/*", async (e) => {
9697
9637
  if (!s) {
9698
9638
  let n = _(C);
9699
9639
  return e.body(n, 200, {
9700
- "Content-Type": ia(t),
9640
+ "Content-Type": na(t),
9701
9641
  "Cache-Control": "public, max-age=86400"
9702
9642
  });
9703
9643
  }
@@ -9705,7 +9645,7 @@ ra.get("/*", async (e) => {
9705
9645
  if (g(f)) {
9706
9646
  let n = _(f);
9707
9647
  return e.body(n, 200, {
9708
- "Content-Type": ia(t, u),
9648
+ "Content-Type": na(t, u),
9709
9649
  "Cache-Control": "public, max-age=31536000, immutable",
9710
9650
  "X-Local-Cache": "HIT"
9711
9651
  });
@@ -9718,14 +9658,14 @@ ra.get("/*", async (e) => {
9718
9658
  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
9659
  let s = await i.toBuffer();
9720
9660
  return v(x(f), { recursive: !0 }), y(f, s), e.body(s, 200, {
9721
- "Content-Type": ia(t, u),
9661
+ "Content-Type": na(t, u),
9722
9662
  "Cache-Control": "public, max-age=31536000, immutable",
9723
9663
  "X-Local-Cache": "MISS"
9724
9664
  });
9725
9665
  } catch {
9726
9666
  let n = _(C);
9727
9667
  return e.body(n, 200, {
9728
- "Content-Type": ia(t),
9668
+ "Content-Type": na(t),
9729
9669
  "Cache-Control": "public, max-age=86400"
9730
9670
  });
9731
9671
  }
@@ -9736,8 +9676,8 @@ ra.get("/*", async (e) => {
9736
9676
  });
9737
9677
  //#endregion
9738
9678
  //#region server/routes/public/paths.ts
9739
- var aa = new e();
9740
- function oa(e, t) {
9679
+ var ra = new e();
9680
+ function ia(e, t) {
9741
9681
  let n = /* @__PURE__ */ new Date();
9742
9682
  if (e && String(e).trim() !== "") {
9743
9683
  let t = new Date(e);
@@ -9749,7 +9689,7 @@ function oa(e, t) {
9749
9689
  }
9750
9690
  return !0;
9751
9691
  }
9752
- aa.get("/", async (e) => {
9692
+ ra.get("/", async (e) => {
9753
9693
  try {
9754
9694
  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
9695
  for (let e of n) {
@@ -9773,7 +9713,7 @@ aa.get("/", async (e) => {
9773
9713
  function o(e = null, t = "") {
9774
9714
  let n = e == null || e === "" || e === "null" ? "__ROOT__" : String(e), s = i.get(n) || [];
9775
9715
  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);
9716
+ let n = a.get(String(e.treeNodeId)) || {}, i = e.status === "published" || e.status === "active", s = ia(n.startShowingAt, n.stopShowingAt);
9777
9717
  if (!i || !s) continue;
9778
9718
  let c = (e.slug || "").replace(/^\/+|\/+$/g, ""), l = c === "home" || c === "homee" ? "/" : `${t}/${c}`.replace(/\/+/g, "/");
9779
9719
  e.nodeType !== "external-link" && r.push(l);
@@ -9790,7 +9730,7 @@ aa.get("/", async (e) => {
9790
9730
  });
9791
9731
  //#endregion
9792
9732
  //#region server/index.ts
9793
- var $ = new e(), sa = !1;
9733
+ var $ = new e(), aa = !1;
9794
9734
  $.use("*", o()), $.use("/media/*", o({
9795
9735
  origin: "*",
9796
9736
  allowMethods: [
@@ -9811,13 +9751,13 @@ $.use("*", o()), $.use("/media/*", o({
9811
9751
  let n = new URL(e.req.url), r = (e.req.header("host") || n.hostname).split(":")[0];
9812
9752
  e.set("currentDomain", r);
9813
9753
  let i = u(e);
9814
- if (e.set("db", i), !sa) try {
9815
- await Mr(i), sa = !0;
9754
+ if (e.set("db", i), !aa) try {
9755
+ await Mr(i), aa = !0;
9816
9756
  } catch (e) {
9817
9757
  console.error("❌ [CMS Server] Failed to initialize system tables on cold start:", e);
9818
9758
  }
9819
9759
  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) => {
9760
+ }), $.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
9761
  if (e.env?.ASSETS) {
9822
9762
  let t = await e.env.ASSETS.fetch(e.req.raw);
9823
9763
  if (t.status === 404) {