@brightsideoy/kama 0.1.0-alpha.123 → 0.1.0-alpha.124

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
@@ -127,7 +127,7 @@ var ne = {
127
127
  "]": "%5D",
128
128
  "{": "%7B",
129
129
  "}": "%7D"
130
- }, re = (e) => e.replace(/[!,[\]{}]/g, (e) => ne[e]), ie = class e {
130
+ }, re = (e) => e.replace(/[!,[\]{}]/g, (e) => ne[e]), A = class e {
131
131
  constructor(t, n) {
132
132
  this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, e.defaultYaml, t), this.tags = Object.assign({}, e.defaultTags, n);
133
133
  }
@@ -205,37 +205,37 @@ var ne = {
205
205
  return t.join("\n");
206
206
  }
207
207
  };
208
- ie.defaultYaml = {
208
+ A.defaultYaml = {
209
209
  explicit: !1,
210
210
  version: "1.2"
211
- }, ie.defaultTags = { "!!": "tag:yaml.org,2002:" };
211
+ }, A.defaultTags = { "!!": "tag:yaml.org,2002:" };
212
212
  //#endregion
213
213
  //#region node_modules/yaml/browser/dist/doc/anchors.js
214
- function ae(e) {
214
+ function j(e) {
215
215
  if (/[\x00-\x19\s,[\]{}]/.test(e)) {
216
216
  let t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;
217
217
  throw Error(t);
218
218
  }
219
219
  return !0;
220
220
  }
221
- function A(e) {
221
+ function ie(e) {
222
222
  let t = /* @__PURE__ */ new Set();
223
223
  return T(e, { Value(e, n) {
224
224
  n.anchor && t.add(n.anchor);
225
225
  } }), t;
226
226
  }
227
- function oe(e, t) {
227
+ function ae(e, t) {
228
228
  for (let n = 1;; ++n) {
229
229
  let r = `${e}${n}`;
230
230
  if (!t.has(r)) return r;
231
231
  }
232
232
  }
233
- function se(e, t) {
233
+ function oe(e, t) {
234
234
  let n = [], r = /* @__PURE__ */ new Map(), i = null;
235
235
  return {
236
236
  onAnchor: (r) => {
237
- n.push(r), i ??= A(e);
238
- let a = oe(t, i);
237
+ n.push(r), i ??= ie(e);
238
+ let a = ae(t, i);
239
239
  return i.add(a), a;
240
240
  },
241
241
  setAnchors: () => {
@@ -253,22 +253,22 @@ function se(e, t) {
253
253
  }
254
254
  //#endregion
255
255
  //#region node_modules/yaml/browser/dist/doc/applyReviver.js
256
- function ce(e, t, n, r) {
256
+ function se(e, t, n, r) {
257
257
  if (r && typeof r == "object") {
258
258
  if (Array.isArray(r)) for (let t = 0, n = r.length; t < n; ++t) {
259
- let n = r[t], i = ce(e, r, String(t), n);
259
+ let n = r[t], i = se(e, r, String(t), n);
260
260
  i === void 0 ? delete r[t] : i !== n && (r[t] = i);
261
261
  }
262
262
  else if (r instanceof Map) for (let t of Array.from(r.keys())) {
263
- let n = r.get(t), i = ce(e, r, t, n);
263
+ let n = r.get(t), i = se(e, r, t, n);
264
264
  i === void 0 ? r.delete(t) : i !== n && r.set(t, i);
265
265
  }
266
266
  else if (r instanceof Set) for (let t of Array.from(r)) {
267
- let n = ce(e, r, t, t);
267
+ let n = se(e, r, t, t);
268
268
  n === void 0 ? r.delete(t) : n !== t && (r.delete(t), r.add(n));
269
269
  }
270
270
  else for (let [t, n] of Object.entries(r)) {
271
- let i = ce(e, r, t, n);
271
+ let i = se(e, r, t, n);
272
272
  i === void 0 ? delete r[t] : i !== n && (r[t] = i);
273
273
  }
274
274
  }
@@ -276,8 +276,8 @@ function ce(e, t, n, r) {
276
276
  }
277
277
  //#endregion
278
278
  //#region node_modules/yaml/browser/dist/nodes/toJS.js
279
- function j(e, t, n) {
280
- if (Array.isArray(e)) return e.map((e, t) => j(e, String(t), n));
279
+ function M(e, t, n) {
280
+ if (Array.isArray(e)) return e.map((e, t) => M(e, String(t), n));
281
281
  if (e && typeof e.toJSON == "function") {
282
282
  if (!n || !x(e)) return e.toJSON(t, n);
283
283
  let r = {
@@ -295,7 +295,7 @@ function j(e, t, n) {
295
295
  }
296
296
  //#endregion
297
297
  //#region node_modules/yaml/browser/dist/nodes/Node.js
298
- var M = class {
298
+ var ce = class {
299
299
  constructor(e) {
300
300
  Object.defineProperty(this, f, { value: e });
301
301
  }
@@ -312,11 +312,11 @@ var M = class {
312
312
  mapAsMap: t === !0,
313
313
  mapKeyWarned: !1,
314
314
  maxAliasCount: typeof n == "number" ? n : 100
315
- }, o = j(this, "", a);
315
+ }, o = M(this, "", a);
316
316
  if (typeof r == "function") for (let { count: e, res: t } of a.anchors.values()) r(t, e);
317
- return typeof i == "function" ? ce(i, { "": o }, "", o) : o;
317
+ return typeof i == "function" ? se(i, { "": o }, "", o) : o;
318
318
  }
319
- }, le = class extends M {
319
+ }, N = class extends ce {
320
320
  constructor(e) {
321
321
  super(o), this.source = e, Object.defineProperty(this, "tag", { set() {
322
322
  throw Error("Alias nodes cannot have tags");
@@ -344,14 +344,14 @@ var M = class {
344
344
  }
345
345
  let o = n.get(a);
346
346
  /* istanbul ignore if */
347
- if (o ||= (j(a, null, t), n.get(a)), o?.res === void 0) throw ReferenceError("This should not happen: Alias anchor was not resolved?");
348
- if (i >= 0 && (o.count += 1, o.aliasCount === 0 && (o.aliasCount = ue(r, a, n)), o.count * o.aliasCount > i)) throw ReferenceError("Excessive alias count indicates a resource exhaustion attack");
347
+ if (o ||= (M(a, null, t), n.get(a)), o?.res === void 0) throw ReferenceError("This should not happen: Alias anchor was not resolved?");
348
+ if (i >= 0 && (o.count += 1, o.aliasCount === 0 && (o.aliasCount = le(r, a, n)), o.count * o.aliasCount > i)) throw ReferenceError("Excessive alias count indicates a resource exhaustion attack");
349
349
  return o.res;
350
350
  }
351
351
  toString(e, t, n) {
352
352
  let r = `*${this.source}`;
353
353
  if (e) {
354
- if (ae(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
354
+ if (j(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
355
355
  let e = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
356
356
  throw Error(e);
357
357
  }
@@ -360,7 +360,7 @@ var M = class {
360
360
  return r;
361
361
  }
362
362
  };
363
- function ue(e, t, n) {
363
+ function le(e, t, n) {
364
364
  if (p(t)) {
365
365
  let r = t.resolve(e), i = n && r && n.get(r);
366
366
  return i ? i.count * i.aliasCount : 0;
@@ -368,35 +368,35 @@ function ue(e, t, n) {
368
368
  if (y(t)) {
369
369
  let r = 0;
370
370
  for (let i of t.items) {
371
- let t = ue(e, i, n);
371
+ let t = le(e, i, n);
372
372
  t > r && (r = t);
373
373
  }
374
374
  return r;
375
375
  }
376
376
  if (g(t)) {
377
- let r = ue(e, t.key, n), i = ue(e, t.value, n);
377
+ let r = le(e, t.key, n), i = le(e, t.value, n);
378
378
  return Math.max(r, i);
379
379
  }
380
380
  return 1;
381
381
  }
382
382
  //#endregion
383
383
  //#region node_modules/yaml/browser/dist/nodes/Scalar.js
384
- var de = (e) => !e || typeof e != "function" && typeof e != "object", N = class extends M {
384
+ var ue = (e) => !e || typeof e != "function" && typeof e != "object", P = class extends ce {
385
385
  constructor(e) {
386
386
  super(u), this.value = e;
387
387
  }
388
388
  toJSON(e, t) {
389
- return t?.keep ? this.value : j(this.value, e, t);
389
+ return t?.keep ? this.value : M(this.value, e, t);
390
390
  }
391
391
  toString() {
392
392
  return String(this.value);
393
393
  }
394
394
  };
395
- N.BLOCK_FOLDED = "BLOCK_FOLDED", N.BLOCK_LITERAL = "BLOCK_LITERAL", N.PLAIN = "PLAIN", N.QUOTE_DOUBLE = "QUOTE_DOUBLE", N.QUOTE_SINGLE = "QUOTE_SINGLE";
395
+ P.BLOCK_FOLDED = "BLOCK_FOLDED", P.BLOCK_LITERAL = "BLOCK_LITERAL", P.PLAIN = "PLAIN", P.QUOTE_DOUBLE = "QUOTE_DOUBLE", P.QUOTE_SINGLE = "QUOTE_SINGLE";
396
396
  //#endregion
397
397
  //#region node_modules/yaml/browser/dist/doc/createNode.js
398
- var fe = "tag:yaml.org,2002:";
399
- function P(e, t, n) {
398
+ var de = "tag:yaml.org,2002:";
399
+ function fe(e, t, n) {
400
400
  if (t) {
401
401
  let e = n.filter((e) => e.tag === t), r = e.find((e) => !e.format) ?? e[0];
402
402
  if (!r) throw Error(`Tag ${t} not found`);
@@ -404,7 +404,7 @@ function P(e, t, n) {
404
404
  }
405
405
  return n.find((t) => t.identify?.(e) && !t.format);
406
406
  }
407
- function F(e, t, n) {
407
+ function pe(e, t, n) {
408
408
  if (m(e) && (e = e.contents), b(e)) return e;
409
409
  if (g(e)) {
410
410
  let t = n.schema[c].createNode?.(n.schema, null, n);
@@ -413,28 +413,28 @@ function F(e, t, n) {
413
413
  (e instanceof String || e instanceof Number || e instanceof Boolean || typeof BigInt < "u" && e instanceof BigInt) && (e = e.valueOf());
414
414
  let { aliasDuplicateObjects: r, onAnchor: i, onTagObj: a, schema: o, sourceObjects: s } = n, l;
415
415
  if (r && e && typeof e == "object") {
416
- if (l = s.get(e), l) return l.anchor ?? (l.anchor = i(e)), new le(l.anchor);
416
+ if (l = s.get(e), l) return l.anchor ?? (l.anchor = i(e)), new N(l.anchor);
417
417
  l = {
418
418
  anchor: null,
419
419
  node: null
420
420
  }, s.set(e, l);
421
421
  }
422
- t?.startsWith("!!") && (t = fe + t.slice(2));
423
- let u = P(e, t, o.tags);
422
+ t?.startsWith("!!") && (t = de + t.slice(2));
423
+ let u = fe(e, t, o.tags);
424
424
  if (!u) {
425
425
  if (e && typeof e.toJSON == "function" && (e = e.toJSON()), !e || typeof e != "object") {
426
- let t = new N(e);
426
+ let t = new P(e);
427
427
  return l && (l.node = t), t;
428
428
  }
429
429
  u = e instanceof Map ? o[c] : Symbol.iterator in Object(e) ? o[d] : o[c];
430
430
  }
431
431
  a && (a(u), delete n.onTagObj);
432
- let f = u?.createNode ? u.createNode(n.schema, e, n) : typeof u?.nodeClass?.from == "function" ? u.nodeClass.from(n.schema, e, n) : new N(e);
432
+ let f = u?.createNode ? u.createNode(n.schema, e, n) : typeof u?.nodeClass?.from == "function" ? u.nodeClass.from(n.schema, e, n) : new P(e);
433
433
  return t ? f.tag = t : u.default || (f.tag = u.tag), l && (l.node = f), f;
434
434
  }
435
435
  //#endregion
436
436
  //#region node_modules/yaml/browser/dist/nodes/Collection.js
437
- function I(e, t, n) {
437
+ function me(e, t, n) {
438
438
  let r = n;
439
439
  for (let e = t.length - 1; e >= 0; --e) {
440
440
  let n = t[e];
@@ -443,7 +443,7 @@ function I(e, t, n) {
443
443
  e[n] = r, r = e;
444
444
  } else r = /* @__PURE__ */ new Map([[n, r]]);
445
445
  }
446
- return F(r, void 0, {
446
+ return pe(r, void 0, {
447
447
  aliasDuplicateObjects: !1,
448
448
  keepUndefined: !1,
449
449
  onAnchor: () => {
@@ -453,7 +453,7 @@ function I(e, t, n) {
453
453
  sourceObjects: /* @__PURE__ */ new Map()
454
454
  });
455
455
  }
456
- var pe = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next().done, me = class extends M {
456
+ var he = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next().done, F = class extends ce {
457
457
  constructor(e, t) {
458
458
  super(e), Object.defineProperty(this, "schema", {
459
459
  value: t,
@@ -467,11 +467,11 @@ var pe = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next
467
467
  return e && (t.schema = e), t.items = t.items.map((t) => b(t) || g(t) ? t.clone(e) : t), this.range && (t.range = this.range.slice()), t;
468
468
  }
469
469
  addIn(e, t) {
470
- if (pe(e)) this.add(t);
470
+ if (he(e)) this.add(t);
471
471
  else {
472
472
  let [n, ...r] = e, i = this.get(n, !0);
473
473
  if (y(i)) i.addIn(r, t);
474
- else if (i === void 0 && this.schema) this.set(n, I(this.schema, r, t));
474
+ else if (i === void 0 && this.schema) this.set(n, me(this.schema, r, t));
475
475
  else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`);
476
476
  }
477
477
  }
@@ -505,16 +505,16 @@ var pe = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next
505
505
  else {
506
506
  let e = this.get(n, !0);
507
507
  if (y(e)) e.setIn(r, t);
508
- else if (e === void 0 && this.schema) this.set(n, I(this.schema, r, t));
508
+ else if (e === void 0 && this.schema) this.set(n, me(this.schema, r, t));
509
509
  else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`);
510
510
  }
511
511
  }
512
- }, he = (e) => e.replace(/^(?!$)(?: $)?/gm, "#");
513
- function L(e, t) {
512
+ }, ge = (e) => e.replace(/^(?!$)(?: $)?/gm, "#");
513
+ function I(e, t) {
514
514
  return /^\n+$/.test(e) ? e.substring(1) : t ? e.replace(/^(?! *$)/gm, t) : e;
515
515
  }
516
- var ge = (e, t, n) => e.endsWith("\n") ? L(n, t) : n.includes("\n") ? "\n" + L(n, t) : (e.endsWith(" ") ? "" : " ") + n, R = "flow", _e = "block", z = "quoted";
517
- function B(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentWidth: a = 20, onFold: o, onOverflow: s } = {}) {
516
+ var L = (e, t, n) => e.endsWith("\n") ? I(n, t) : n.includes("\n") ? "\n" + I(n, t) : (e.endsWith(" ") ? "" : " ") + n, _e = "flow", ve = "block", ye = "quoted";
517
+ function be(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentWidth: a = 20, onFold: o, onOverflow: s } = {}) {
518
518
  if (!i || i < 0) return e;
519
519
  i < a && (a = 0);
520
520
  let c = Math.max(1 + a, 1 + i - t.length);
@@ -522,7 +522,7 @@ function B(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentWi
522
522
  let l = [], u = {}, d = i - t.length;
523
523
  typeof r == "number" && (r > i - Math.max(2, a) ? l.push(0) : d = i - r);
524
524
  let f, p, m = !1, h = -1, g = -1, _ = -1;
525
- n === "block" && (h = ve(e, h, t.length), h !== -1 && (d = h + c));
525
+ n === "block" && (h = R(e, h, t.length), h !== -1 && (d = h + c));
526
526
  for (let r; r = e[h += 1];) {
527
527
  if (n === "quoted" && r === "\\") {
528
528
  switch (g = h, e[h + 1]) {
@@ -539,7 +539,7 @@ function B(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentWi
539
539
  }
540
540
  _ = h;
541
541
  }
542
- if (r === "\n") n === "block" && (h = ve(e, h, t.length)), d = h + t.length + c, f = void 0;
542
+ if (r === "\n") n === "block" && (h = R(e, h, t.length)), d = h + t.length + c, f = void 0;
543
543
  else {
544
544
  if (r === " " && p && p !== " " && p !== "\n" && p !== " ") {
545
545
  let t = e[h + 1];
@@ -566,7 +566,7 @@ function B(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentWi
566
566
  }
567
567
  return v;
568
568
  }
569
- function ve(e, t, n) {
569
+ function R(e, t, n) {
570
570
  let r = t, i = t + 1, a = e[i];
571
571
  for (; a === " " || a === " ";) if (t < i + n) a = e[++t];
572
572
  else {
@@ -579,12 +579,12 @@ function ve(e, t, n) {
579
579
  }
580
580
  //#endregion
581
581
  //#region node_modules/yaml/browser/dist/stringify/stringifyString.js
582
- var ye = (e, t) => ({
582
+ var z = (e, t) => ({
583
583
  indentAtStart: t ? e.indent.length : e.indentAtStart,
584
584
  lineWidth: e.options.lineWidth,
585
585
  minContentWidth: e.options.minContentWidth
586
- }), be = (e) => /^(%|---|\.\.\.)/m.test(e);
587
- function xe(e, t, n) {
586
+ }), xe = (e) => /^(%|---|\.\.\.)/m.test(e);
587
+ function Se(e, t, n) {
588
588
  if (!t || t < 0) return !1;
589
589
  let r = t - n, i = e.length;
590
590
  if (i <= r) return !1;
@@ -594,10 +594,10 @@ function xe(e, t, n) {
594
594
  }
595
595
  return !0;
596
596
  }
597
- function Se(e, t) {
597
+ function Ce(e, t) {
598
598
  let n = JSON.stringify(e);
599
599
  if (t.options.doubleQuotedAsJSON) return n;
600
- let { implicitKey: r } = t, i = t.options.doubleQuotedMinMultiLineLength, a = t.indent || (be(e) ? " " : ""), o = "", s = 0;
600
+ let { implicitKey: r } = t, i = t.options.doubleQuotedMinMultiLineLength, a = t.indent || (xe(e) ? " " : ""), o = "", s = 0;
601
601
  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]) {
602
602
  case "u":
603
603
  {
@@ -642,32 +642,32 @@ function Se(e, t) {
642
642
  break;
643
643
  default: e += 1;
644
644
  }
645
- return o = s ? o + n.slice(s) : n, r ? o : B(o, a, z, ye(t, !1));
646
- }
647
- function Ce(e, t) {
648
- if (t.options.singleQuote === !1 || t.implicitKey && e.includes("\n") || /[ \t]\n|\n[ \t]/.test(e)) return Se(e, t);
649
- let n = t.indent || (be(e) ? " " : ""), r = "'" + e.replace(/'/g, "''").replace(/\n+/g, `$&\n${n}`) + "'";
650
- return t.implicitKey ? r : B(r, n, R, ye(t, !1));
645
+ return o = s ? o + n.slice(s) : n, r ? o : be(o, a, ye, z(t, !1));
651
646
  }
652
647
  function we(e, t) {
648
+ if (t.options.singleQuote === !1 || t.implicitKey && e.includes("\n") || /[ \t]\n|\n[ \t]/.test(e)) return Ce(e, t);
649
+ let n = t.indent || (xe(e) ? " " : ""), r = "'" + e.replace(/'/g, "''").replace(/\n+/g, `$&\n${n}`) + "'";
650
+ return t.implicitKey ? r : be(r, n, _e, z(t, !1));
651
+ }
652
+ function Te(e, t) {
653
653
  let { singleQuote: n } = t.options, r;
654
- if (n === !1) r = Se;
654
+ if (n === !1) r = Ce;
655
655
  else {
656
656
  let t = e.includes("\""), i = e.includes("'");
657
- r = t && !i ? Ce : i && !t ? Se : n ? Ce : Se;
657
+ r = t && !i ? we : i && !t ? Ce : n ? we : Ce;
658
658
  }
659
659
  return r(e, t);
660
660
  }
661
- var Te;
661
+ var Ee;
662
662
  try {
663
- Te = /* @__PURE__ */ RegExp("(^|(?<!\n))\n+(?!\n|$)", "g");
663
+ Ee = /* @__PURE__ */ RegExp("(^|(?<!\n))\n+(?!\n|$)", "g");
664
664
  } catch {
665
- Te = /\n+(?!\n|$)/g;
665
+ Ee = /\n+(?!\n|$)/g;
666
666
  }
667
- function Ee({ comment: e, type: t, value: n }, r, i, a) {
667
+ function De({ comment: e, type: t, value: n }, r, i, a) {
668
668
  let { blockQuote: o, commentString: s, lineWidth: c } = r.options;
669
- if (!o || /\n[\t ]+$/.test(n)) return we(n, r);
670
- let l = r.indent || (r.forceBlockIndent || be(n) ? " " : ""), u = o === "literal" ? !0 : o === "folded" || t === N.BLOCK_FOLDED ? !1 : t === N.BLOCK_LITERAL || !xe(n, c, l.length);
669
+ if (!o || /\n[\t ]+$/.test(n)) return Te(n, r);
670
+ let l = r.indent || (r.forceBlockIndent || xe(n) ? " " : ""), u = o === "literal" ? !0 : o === "folded" || t === P.BLOCK_FOLDED ? !1 : t === P.BLOCK_LITERAL || !Se(n, c, l.length);
671
671
  if (!n) return u ? "|\n" : ">\n";
672
672
  let d, f;
673
673
  for (f = n.length; f > 0; --f) {
@@ -675,7 +675,7 @@ function Ee({ comment: e, type: t, value: n }, r, i, a) {
675
675
  if (e !== "\n" && e !== " " && e !== " ") break;
676
676
  }
677
677
  let p = n.substring(f), m = p.indexOf("\n");
678
- 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(Te, `$&${l}`));
678
+ 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(Ee, `$&${l}`));
679
679
  let h = !1, g, _ = -1;
680
680
  for (g = 0; g < n.length; ++g) {
681
681
  let e = n[g];
@@ -687,41 +687,41 @@ function Ee({ comment: e, type: t, value: n }, r, i, a) {
687
687
  v &&= (n = n.substring(v.length), v.replace(/\n+/g, `$&${l}`));
688
688
  let y = (h ? l ? "2" : "1" : "") + d;
689
689
  if (e && (y += " " + s(e.replace(/ ?[\r\n]+/g, " ")), i && i()), !u) {
690
- 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 = ye(r, !0);
691
- o !== "folded" && t !== N.BLOCK_FOLDED && (a.onOverflow = () => {
690
+ 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 = z(r, !0);
691
+ o !== "folded" && t !== P.BLOCK_FOLDED && (a.onOverflow = () => {
692
692
  i = !0;
693
693
  });
694
- let s = B(`${v}${e}${p}`, l, _e, a);
694
+ let s = be(`${v}${e}${p}`, l, ve, a);
695
695
  if (!i) return `>${y}\n${l}${s}`;
696
696
  }
697
697
  return n = n.replace(/\n+/g, `$&${l}`), `|${y}\n${l}${v}${n}${p}`;
698
698
  }
699
- function De(e, t, n, r) {
699
+ function Oe(e, t, n, r) {
700
700
  let { type: i, value: a } = e, { actualString: o, implicitKey: s, indent: c, indentStep: l, inFlow: u } = t;
701
- if (s && a.includes("\n") || u && /[[\]{},]/.test(a)) return we(a, t);
702
- if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a)) return s || u || !a.includes("\n") ? we(a, t) : Ee(e, t, n, r);
703
- if (!s && !u && i !== N.PLAIN && a.includes("\n")) return Ee(e, t, n, r);
704
- if (be(a)) {
705
- if (c === "") return t.forceBlockIndent = !0, Ee(e, t, n, r);
706
- if (s && c === l) return we(a, t);
701
+ if (s && a.includes("\n") || u && /[[\]{},]/.test(a)) return Te(a, t);
702
+ if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a)) return s || u || !a.includes("\n") ? Te(a, t) : De(e, t, n, r);
703
+ if (!s && !u && i !== P.PLAIN && a.includes("\n")) return De(e, t, n, r);
704
+ if (xe(a)) {
705
+ if (c === "") return t.forceBlockIndent = !0, De(e, t, n, r);
706
+ if (s && c === l) return Te(a, t);
707
707
  }
708
708
  let d = a.replace(/\n+/g, `$&\n${c}`);
709
709
  if (o) {
710
710
  let e = (e) => e.default && e.tag !== "tag:yaml.org,2002:str" && e.test?.test(d), { compat: n, tags: r } = t.doc.schema;
711
- if (r.some(e) || n?.some(e)) return we(a, t);
711
+ if (r.some(e) || n?.some(e)) return Te(a, t);
712
712
  }
713
- return s ? d : B(d, c, R, ye(t, !1));
713
+ return s ? d : be(d, c, _e, z(t, !1));
714
714
  }
715
- function Oe(e, t, n, r) {
715
+ function ke(e, t, n, r) {
716
716
  let { implicitKey: i, inFlow: a } = t, o = typeof e.value == "string" ? e : Object.assign({}, e, { value: String(e.value) }), { type: s } = e;
717
- s !== N.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (s = N.QUOTE_DOUBLE);
717
+ s !== P.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (s = P.QUOTE_DOUBLE);
718
718
  let c = (e) => {
719
719
  switch (e) {
720
- case N.BLOCK_FOLDED:
721
- case N.BLOCK_LITERAL: return i || a ? we(o.value, t) : Ee(o, t, n, r);
722
- case N.QUOTE_DOUBLE: return Se(o.value, t);
723
- case N.QUOTE_SINGLE: return Ce(o.value, t);
724
- case N.PLAIN: return De(o, t, n, r);
720
+ case P.BLOCK_FOLDED:
721
+ case P.BLOCK_LITERAL: return i || a ? Te(o.value, t) : De(o, t, n, r);
722
+ case P.QUOTE_DOUBLE: return Ce(o.value, t);
723
+ case P.QUOTE_SINGLE: return we(o.value, t);
724
+ case P.PLAIN: return Oe(o, t, n, r);
725
725
  default: return null;
726
726
  }
727
727
  }, l = c(s);
@@ -733,10 +733,10 @@ function Oe(e, t, n, r) {
733
733
  }
734
734
  //#endregion
735
735
  //#region node_modules/yaml/browser/dist/stringify/stringify.js
736
- function ke(e, t) {
736
+ function Ae(e, t) {
737
737
  let n = Object.assign({
738
738
  blockQuote: !0,
739
- commentString: he,
739
+ commentString: ge,
740
740
  defaultKeyType: null,
741
741
  defaultStringType: "PLAIN",
742
742
  directives: null,
@@ -773,7 +773,7 @@ function ke(e, t) {
773
773
  options: n
774
774
  };
775
775
  }
776
- function Ae(e, t) {
776
+ function je(e, t) {
777
777
  if (t.tag) {
778
778
  let n = e.filter((e) => e.tag === t.tag);
779
779
  if (n.length > 0) return n.find((e) => e.format === t.format) ?? n[0];
@@ -794,14 +794,14 @@ function Ae(e, t) {
794
794
  }
795
795
  return n;
796
796
  }
797
- function je(e, t, { anchors: n, doc: r }) {
797
+ function Me(e, t, { anchors: n, doc: r }) {
798
798
  if (!r.directives) return "";
799
799
  let i = [], a = (_(e) || y(e)) && e.anchor;
800
- a && ae(a) && (n.add(a), i.push(`&${a}`));
800
+ a && j(a) && (n.add(a), i.push(`&${a}`));
801
801
  let o = e.tag ?? (t.default ? null : t.tag);
802
802
  return o && i.push(r.directives.tagString(o)), i.join(" ");
803
803
  }
804
- function Me(e, t, n, r) {
804
+ function Ne(e, t, n, r) {
805
805
  if (g(e)) return e.toString(t, n, r);
806
806
  if (p(e)) {
807
807
  if (t.doc.directives) return e.toString(t);
@@ -809,42 +809,42 @@ function Me(e, t, n, r) {
809
809
  t.resolvedAliases ? t.resolvedAliases.add(e) : t.resolvedAliases = /* @__PURE__ */ new Set([e]), e = e.resolve(t.doc);
810
810
  }
811
811
  let i, a = b(e) ? e : t.doc.createNode(e, { onTagObj: (e) => i = e });
812
- i ??= Ae(t.doc.schema.tags, a);
813
- let o = je(a, i, t);
812
+ i ??= je(t.doc.schema.tags, a);
813
+ let o = Me(a, i, t);
814
814
  o.length > 0 && (t.indentAtStart = (t.indentAtStart ?? 0) + o.length + 1);
815
- let s = typeof i.stringify == "function" ? i.stringify(a, t, n, r) : _(a) ? Oe(a, t, n, r) : a.toString(t, n, r);
815
+ let s = typeof i.stringify == "function" ? i.stringify(a, t, n, r) : _(a) ? ke(a, t, n, r) : a.toString(t, n, r);
816
816
  return o ? _(a) || s[0] === "{" || s[0] === "[" ? `${o} ${s}` : `${o}\n${t.indent}${s}` : s;
817
817
  }
818
818
  //#endregion
819
819
  //#region node_modules/yaml/browser/dist/stringify/stringifyPair.js
820
- function Ne({ key: e, value: t }, n, r, i) {
820
+ function Pe({ key: e, value: t }, n, r, i) {
821
821
  let { allNullValues: a, doc: o, indent: s, indentStep: c, options: { commentString: l, indentSeq: u, simpleKeys: d } } = n, f = b(e) && e.comment || null;
822
822
  if (d) {
823
823
  if (f) throw Error("With simple keys, key nodes cannot have comments");
824
824
  if (y(e) || !b(e) && typeof e == "object") throw Error("With simple keys, collection cannot be used as a key value");
825
825
  }
826
- let p = !d && (!e || f && t == null && !n.inFlow || y(e) || (_(e) ? e.type === N.BLOCK_FOLDED || e.type === N.BLOCK_LITERAL : typeof e == "object"));
826
+ let p = !d && (!e || f && t == null && !n.inFlow || y(e) || (_(e) ? e.type === P.BLOCK_FOLDED || e.type === P.BLOCK_LITERAL : typeof e == "object"));
827
827
  n = Object.assign({}, n, {
828
828
  allNullValues: !1,
829
829
  implicitKey: !p && (d || !a),
830
830
  indent: s + c
831
831
  });
832
- let m = !1, h = !1, g = Me(e, n, () => m = !0, () => h = !0);
832
+ let m = !1, h = !1, g = Ne(e, n, () => m = !0, () => h = !0);
833
833
  if (!p && !n.inFlow && g.length > 1024) {
834
834
  if (d) throw Error("With simple keys, single line scalar must not span more than 1024 characters");
835
835
  p = !0;
836
836
  }
837
837
  if (n.inFlow) {
838
838
  if (a || t == null) return m && r && r(), g === "" ? "?" : p ? `? ${g}` : g;
839
- } else if (a && !d || t == null && p) return g = `? ${g}`, f && !m ? g += ge(g, n.indent, l(f)) : h && i && i(), g;
840
- m && (f = null), p ? (f && (g += ge(g, n.indent, l(f))), g = `? ${g}\n${s}:`) : (g = `${g}:`, f && (g += ge(g, n.indent, l(f))));
839
+ } else if (a && !d || t == null && p) return g = `? ${g}`, f && !m ? g += L(g, n.indent, l(f)) : h && i && i(), g;
840
+ m && (f = null), p ? (f && (g += L(g, n.indent, l(f))), g = `? ${g}\n${s}:`) : (g = `${g}:`, f && (g += L(g, n.indent, l(f))));
841
841
  let x, S, C;
842
842
  b(t) ? (x = !!t.spaceBefore, S = t.commentBefore, C = t.comment) : (x = !1, S = null, C = null, t && typeof t == "object" && (t = o.createNode(t))), n.implicitKey = !1, !p && !f && _(t) && (n.indentAtStart = g.length + 1), h = !1, !u && c.length >= 2 && !n.inFlow && !p && v(t) && !t.flow && !t.tag && !t.anchor && (n.indent = n.indent.substring(2));
843
- let w = !1, T = Me(t, n, () => w = !0, () => h = !0), E = " ";
843
+ let w = !1, T = Ne(t, n, () => w = !0, () => h = !0), E = " ";
844
844
  if (f || x || S) {
845
845
  if (E = x ? "\n" : "", S) {
846
846
  let e = l(S);
847
- E += `\n${L(e, n.indent)}`;
847
+ E += `\n${I(e, n.indent)}`;
848
848
  }
849
849
  T === "" && !n.inFlow ? E === "\n" && C && (E = "\n\n") : E += `\n${n.indent}`;
850
850
  } else if (!p && y(t)) {
@@ -858,23 +858,23 @@ function Ne({ key: e, value: t }, n, r, i) {
858
858
  t || (E = `\n${n.indent}`);
859
859
  }
860
860
  } else (T === "" || T[0] === "\n") && (E = "");
861
- return g += E + T, n.inFlow ? w && r && r() : C && !w ? g += ge(g, n.indent, l(C)) : h && i && i(), g;
861
+ return g += E + T, n.inFlow ? w && r && r() : C && !w ? g += L(g, n.indent, l(C)) : h && i && i(), g;
862
862
  }
863
863
  //#endregion
864
864
  //#region node_modules/yaml/browser/dist/log.js
865
- function Pe(e, t) {
865
+ function Fe(e, t) {
866
866
  (e === "debug" || e === "warn") && console.warn(t);
867
867
  }
868
868
  //#endregion
869
869
  //#region node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js
870
- var Fe = "<<", Ie = {
871
- identify: (e) => e === Fe || typeof e == "symbol" && e.description === Fe,
870
+ var Ie = "<<", B = {
871
+ identify: (e) => e === Ie || typeof e == "symbol" && e.description === Ie,
872
872
  default: "key",
873
873
  tag: "tag:yaml.org,2002:merge",
874
874
  test: /^<<$/,
875
- resolve: () => Object.assign(new N(Symbol(Fe)), { addToJSMap: Re }),
876
- stringify: () => Fe
877
- }, Le = (e, t) => (Ie.identify(t) || _(t) && (!t.type || t.type === N.PLAIN) && Ie.identify(t.value)) && e?.doc.schema.tags.some((e) => e.tag === Ie.tag && e.default);
875
+ resolve: () => Object.assign(new P(Symbol(Ie)), { addToJSMap: Re }),
876
+ stringify: () => Ie
877
+ }, Le = (e, t) => (B.identify(t) || _(t) && (!t.type || t.type === P.PLAIN) && B.identify(t.value)) && e?.doc.schema.tags.some((e) => e.tag === B.tag && e.default);
878
878
  function Re(e, t, n) {
879
879
  let r = Be(e, n);
880
880
  if (v(r)) for (let n of r.items) ze(e, t, n);
@@ -902,11 +902,11 @@ function Ve(e, t, { key: n, value: r }) {
902
902
  if (b(n) && n.addToJSMap) n.addToJSMap(e, t, r);
903
903
  else if (Le(e, n)) Re(e, t, r);
904
904
  else {
905
- let i = j(n, "", e);
906
- if (t instanceof Map) t.set(i, j(r, i, e));
905
+ let i = M(n, "", e);
906
+ if (t instanceof Map) t.set(i, M(r, i, e));
907
907
  else if (t instanceof Set) t.add(i);
908
908
  else {
909
- let a = He(n, i, e), o = j(r, a, e);
909
+ let a = He(n, i, e), o = M(r, a, e);
910
910
  a in t ? Object.defineProperty(t, a, {
911
911
  value: o,
912
912
  writable: !0,
@@ -921,14 +921,14 @@ function He(e, t, n) {
921
921
  if (t === null) return "";
922
922
  if (typeof t != "object") return String(t);
923
923
  if (b(e) && n?.doc) {
924
- let t = ke(n.doc, {});
924
+ let t = Ae(n.doc, {});
925
925
  t.anchors = /* @__PURE__ */ new Set();
926
926
  for (let e of n.anchors.keys()) t.anchors.add(e.anchor);
927
927
  t.inFlow = !0, t.inStringifyKey = !0;
928
928
  let r = e.toString(t);
929
929
  if (!n.mapKeyWarned) {
930
930
  let e = JSON.stringify(r);
931
- e.length > 40 && (e = e.substring(0, 36) + "...\""), Pe(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;
931
+ e.length > 40 && (e = e.substring(0, 36) + "...\""), Fe(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;
932
932
  }
933
933
  return r;
934
934
  }
@@ -937,7 +937,7 @@ function He(e, t, n) {
937
937
  //#endregion
938
938
  //#region node_modules/yaml/browser/dist/nodes/Pair.js
939
939
  function Ue(e, t, n) {
940
- return new V(F(e, void 0, n), F(t, void 0, n));
940
+ return new V(pe(e, void 0, n), pe(t, void 0, n));
941
941
  }
942
942
  var V = class e {
943
943
  constructor(e, t = null) {
@@ -951,7 +951,7 @@ var V = class e {
951
951
  return Ve(t, t?.mapAsMap ? /* @__PURE__ */ new Map() : {}, this);
952
952
  }
953
953
  toString(e, t, n) {
954
- return e?.doc ? Ne(this, e, t, n) : JSON.stringify(this);
954
+ return e?.doc ? Pe(this, e, t, n) : JSON.stringify(this);
955
955
  }
956
956
  };
957
957
  //#endregion
@@ -972,8 +972,8 @@ function Ge({ comment: e, items: t }, n, { blockItemPrefix: r, flowChars: i, ite
972
972
  e && (!d && e.spaceBefore && f.push(""), qe(n, f, e.commentBefore, d));
973
973
  }
974
974
  d = !1;
975
- let s = Me(i, u, () => o = null, () => d = !0);
976
- o && (s += ge(s, a, l(o))), d && o && (d = !1), f.push(r + s);
975
+ let s = Ne(i, u, () => o = null, () => d = !0);
976
+ o && (s += L(s, a, l(o))), d && o && (d = !1), f.push(r + s);
977
977
  }
978
978
  let p;
979
979
  if (f.length === 0) p = i.start + i.end;
@@ -984,7 +984,7 @@ function Ge({ comment: e, items: t }, n, { blockItemPrefix: r, flowChars: i, ite
984
984
  p += t ? `\n${c}${t}` : "\n";
985
985
  }
986
986
  }
987
- return e ? (p += "\n" + L(l(e), c), s && s()) : d && o && o(), p;
987
+ return e ? (p += "\n" + I(l(e), c), s && s()) : d && o && o(), p;
988
988
  }
989
989
  function Ke({ items: e }, t, { flowChars: n, itemIndent: r }) {
990
990
  let { indent: i, indentStep: a, flowCollectionPadding: o, options: { commentString: s } } = t;
@@ -1004,8 +1004,8 @@ function Ke({ items: e }, t, { flowChars: n, itemIndent: r }) {
1004
1004
  n ? (n.comment && (a = n.comment), n.commentBefore && (l = !0)) : i.value == null && e?.comment && (a = e.comment);
1005
1005
  }
1006
1006
  a && (l = !0);
1007
- let o = Me(i, c, () => a = null);
1008
- 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 += ge(o, r, s(a))), d.push(o), u = d.length;
1007
+ let o = Ne(i, c, () => a = null);
1008
+ 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 += L(o, r, s(a))), d.push(o), u = d.length;
1009
1009
  }
1010
1010
  let { start: f, end: p } = n;
1011
1011
  if (d.length === 0) return f + p;
@@ -1022,7 +1022,7 @@ function Ke({ items: e }, t, { flowChars: n, itemIndent: r }) {
1022
1022
  }
1023
1023
  function qe({ indent: e, options: { commentString: t } }, n, r, i) {
1024
1024
  if (r && i && (r = r.replace(/^\n+/, "")), r) {
1025
- let i = L(t(r), e);
1025
+ let i = I(t(r), e);
1026
1026
  n.push(i.trimStart());
1027
1027
  }
1028
1028
  }
@@ -1032,7 +1032,7 @@ function Je(e, t) {
1032
1032
  let n = _(t) ? t.value : t;
1033
1033
  for (let r of e) if (g(r) && (r.key === t || r.key === n || _(r.key) && r.key.value === n)) return r;
1034
1034
  }
1035
- var H = class extends me {
1035
+ var H = class extends F {
1036
1036
  static get tagName() {
1037
1037
  return "tag:yaml.org,2002:map";
1038
1038
  }
@@ -1055,7 +1055,7 @@ var H = class extends me {
1055
1055
  let r = Je(this.items, n.key), i = this.schema?.sortMapEntries;
1056
1056
  if (r) {
1057
1057
  if (!t) throw Error(`Key ${n.key} already set`);
1058
- _(r.value) && de(n.value) ? r.value.value = n.value : r.value = n.value;
1058
+ _(r.value) && ue(n.value) ? r.value.value = n.value : r.value = n.value;
1059
1059
  } else if (i) {
1060
1060
  let e = this.items.findIndex((e) => i(n, e) < 0);
1061
1061
  e === -1 ? this.items.push(n) : this.items.splice(e, 0, n);
@@ -1104,7 +1104,7 @@ var H = class extends me {
1104
1104
  return h(e) || t("Expected a mapping for this tag"), e;
1105
1105
  },
1106
1106
  createNode: (e, t, n) => H.from(e, t, n)
1107
- }, Xe = class extends me {
1107
+ }, Xe = class extends F {
1108
1108
  static get tagName() {
1109
1109
  return "tag:yaml.org,2002:seq";
1110
1110
  }
@@ -1132,13 +1132,13 @@ var H = class extends me {
1132
1132
  let n = Ze(e);
1133
1133
  if (typeof n != "number") throw Error(`Expected a valid index, not ${e}.`);
1134
1134
  let r = this.items[n];
1135
- _(r) && de(t) ? r.value = t : this.items[n] = t;
1135
+ _(r) && ue(t) ? r.value = t : this.items[n] = t;
1136
1136
  }
1137
1137
  toJSON(e, t) {
1138
1138
  let n = [];
1139
1139
  t?.onCreate && t.onCreate(n);
1140
1140
  let r = 0;
1141
- for (let e of this.items) n.push(j(e, String(r++), t));
1141
+ for (let e of this.items) n.push(M(e, String(r++), t));
1142
1142
  return n;
1143
1143
  }
1144
1144
  toString(e, t, n) {
@@ -1162,7 +1162,7 @@ var H = class extends me {
1162
1162
  let n = t instanceof Set ? a : String(e++);
1163
1163
  a = r.call(t, n, a);
1164
1164
  }
1165
- i.items.push(F(a, void 0, n));
1165
+ i.items.push(pe(a, void 0, n));
1166
1166
  }
1167
1167
  }
1168
1168
  return i;
@@ -1189,22 +1189,22 @@ var Qe = {
1189
1189
  tag: "tag:yaml.org,2002:str",
1190
1190
  resolve: (e) => e,
1191
1191
  stringify(e, t, n, r) {
1192
- return t = Object.assign({ actualString: !0 }, t), Oe(e, t, n, r);
1192
+ return t = Object.assign({ actualString: !0 }, t), ke(e, t, n, r);
1193
1193
  }
1194
1194
  }, et = {
1195
1195
  identify: (e) => e == null,
1196
- createNode: () => new N(null),
1196
+ createNode: () => new P(null),
1197
1197
  default: !0,
1198
1198
  tag: "tag:yaml.org,2002:null",
1199
1199
  test: /^(?:~|[Nn]ull|NULL)?$/,
1200
- resolve: () => new N(null),
1200
+ resolve: () => new P(null),
1201
1201
  stringify: ({ source: e }, t) => typeof e == "string" && et.test.test(e) ? e : t.options.nullStr
1202
1202
  }, tt = {
1203
1203
  identify: (e) => typeof e == "boolean",
1204
1204
  default: !0,
1205
1205
  tag: "tag:yaml.org,2002:bool",
1206
1206
  test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
1207
- resolve: (e) => new N(e[0] === "t" || e[0] === "T"),
1207
+ resolve: (e) => new P(e[0] === "t" || e[0] === "T"),
1208
1208
  stringify({ source: e, value: t }, n) {
1209
1209
  return e && tt.test.test(e) && t === (e[0] === "t" || e[0] === "T") ? e : t ? n.options.trueStr : n.options.falseStr;
1210
1210
  }
@@ -1250,7 +1250,7 @@ var nt = {
1250
1250
  tag: "tag:yaml.org,2002:float",
1251
1251
  test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
1252
1252
  resolve(e) {
1253
- let t = new N(parseFloat(e)), n = e.indexOf(".");
1253
+ let t = new P(parseFloat(e)), n = e.indexOf(".");
1254
1254
  return n !== -1 && e[e.length - 1] === "0" && (t.minFractionDigits = e.length - n - 1), t;
1255
1255
  },
1256
1256
  stringify: U
@@ -1310,7 +1310,7 @@ var pt = ({ value: e }) => JSON.stringify(e), mt = [
1310
1310
  },
1311
1311
  {
1312
1312
  identify: (e) => e == null,
1313
- createNode: () => new N(null),
1313
+ createNode: () => new P(null),
1314
1314
  default: !0,
1315
1315
  tag: "tag:yaml.org,2002:null",
1316
1316
  test: /^null$/,
@@ -1368,12 +1368,12 @@ var pt = ({ value: e }) => JSON.stringify(e), mt = [
1368
1368
  for (let t = 0; t < o.length; ++t) e += String.fromCharCode(o[t]);
1369
1369
  s = btoa(e);
1370
1370
  } else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");
1371
- if (t ??= N.BLOCK_LITERAL, t !== N.QUOTE_DOUBLE) {
1371
+ if (t ??= P.BLOCK_LITERAL, t !== P.QUOTE_DOUBLE) {
1372
1372
  let e = Math.max(r.options.lineWidth - r.indent.length, r.options.minContentWidth), n = Math.ceil(s.length / e), i = Array(n);
1373
1373
  for (let t = 0, r = 0; t < n; ++t, r += e) i[t] = s.substr(r, e);
1374
- s = i.join(t === N.BLOCK_LITERAL ? "\n" : " ");
1374
+ s = i.join(t === P.BLOCK_LITERAL ? "\n" : " ");
1375
1375
  }
1376
- return Oe({
1376
+ return ke({
1377
1377
  comment: e,
1378
1378
  type: t,
1379
1379
  value: s
@@ -1388,7 +1388,7 @@ function _t(e, t) {
1388
1388
  if (!g(r)) {
1389
1389
  if (h(r)) {
1390
1390
  r.items.length > 1 && t("Each pair must have its own sequence indicator");
1391
- let e = r.items[0] || new V(new N(null));
1391
+ let e = r.items[0] || new V(new P(null));
1392
1392
  if (r.commentBefore && (e.key.commentBefore = e.key.commentBefore ? `${r.commentBefore}\n${e.key.commentBefore}` : r.commentBefore), r.comment) {
1393
1393
  let t = e.value ?? e.key;
1394
1394
  t.comment = t.comment ? `${r.comment}\n${t.comment}` : r.comment;
@@ -1436,7 +1436,7 @@ var yt = {
1436
1436
  t?.onCreate && t.onCreate(n);
1437
1437
  for (let e of this.items) {
1438
1438
  let r, i;
1439
- if (g(e) ? (r = j(e.key, "", t), i = j(e.value, r, t)) : r = j(e, "", t), n.has(r)) throw Error("Ordered maps must not include duplicate keys");
1439
+ if (g(e) ? (r = M(e.key, "", t), i = M(e.value, r, t)) : r = M(e, "", t), n.has(r)) throw Error("Ordered maps must not include duplicate keys");
1440
1440
  n.set(r, i);
1441
1441
  }
1442
1442
  return n;
@@ -1470,14 +1470,14 @@ var Ct = {
1470
1470
  default: !0,
1471
1471
  tag: "tag:yaml.org,2002:bool",
1472
1472
  test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
1473
- resolve: () => new N(!0),
1473
+ resolve: () => new P(!0),
1474
1474
  stringify: St
1475
1475
  }, wt = {
1476
1476
  identify: (e) => e === !1,
1477
1477
  default: !0,
1478
1478
  tag: "tag:yaml.org,2002:bool",
1479
1479
  test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
1480
- resolve: () => new N(!1),
1480
+ resolve: () => new P(!1),
1481
1481
  stringify: St
1482
1482
  }, Tt = {
1483
1483
  identify: (e) => typeof e == "number",
@@ -1503,7 +1503,7 @@ var Ct = {
1503
1503
  tag: "tag:yaml.org,2002:float",
1504
1504
  test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
1505
1505
  resolve(e) {
1506
- let t = new N(parseFloat(e.replace(/_/g, ""))), n = e.indexOf(".");
1506
+ let t = new P(parseFloat(e.replace(/_/g, ""))), n = e.indexOf(".");
1507
1507
  if (n !== -1) {
1508
1508
  let r = e.substring(n + 1).replace(/_/g, "");
1509
1509
  r[r.length - 1] === "0" && (t.minFractionDigits = r.length);
@@ -1678,7 +1678,7 @@ var zt = {
1678
1678
  Et,
1679
1679
  Dt,
1680
1680
  gt,
1681
- Ie,
1681
+ B,
1682
1682
  xt,
1683
1683
  yt,
1684
1684
  It,
@@ -1707,7 +1707,7 @@ var zt = {
1707
1707
  intOct: ct,
1708
1708
  intTime: zt,
1709
1709
  map: Ye,
1710
- merge: Ie,
1710
+ merge: B,
1711
1711
  null: et,
1712
1712
  omap: xt,
1713
1713
  pairs: yt,
@@ -1716,7 +1716,7 @@ var zt = {
1716
1716
  timestamp: Vt
1717
1717
  }, Gt = {
1718
1718
  "tag:yaml.org,2002:binary": gt,
1719
- "tag:yaml.org,2002:merge": Ie,
1719
+ "tag:yaml.org,2002:merge": B,
1720
1720
  "tag:yaml.org,2002:omap": xt,
1721
1721
  "tag:yaml.org,2002:pairs": yt,
1722
1722
  "tag:yaml.org,2002:set": It,
@@ -1724,7 +1724,7 @@ var zt = {
1724
1724
  };
1725
1725
  function Kt(e, t, n) {
1726
1726
  let r = Ut.get(t);
1727
- if (r && !e) return n && !r.includes(Ie) ? r.concat(Ie) : r.slice();
1727
+ if (r && !e) return n && !r.includes(B) ? r.concat(B) : r.slice();
1728
1728
  let i = r;
1729
1729
  if (!i) {
1730
1730
  if (Array.isArray(e)) i = [];
@@ -1735,7 +1735,7 @@ function Kt(e, t, n) {
1735
1735
  }
1736
1736
  if (Array.isArray(e)) for (let t of e) i = i.concat(t);
1737
1737
  else typeof e == "function" && (i = e(i.slice()));
1738
- return n && (i = i.concat(Ie)), i.reduce((e, t) => {
1738
+ return n && (i = i.concat(B)), i.reduce((e, t) => {
1739
1739
  let n = typeof t == "string" ? Wt[t] : t;
1740
1740
  if (!n) {
1741
1741
  let e = JSON.stringify(t), n = Object.keys(Wt).map((e) => JSON.stringify(e)).join(", ");
@@ -1764,32 +1764,32 @@ function Yt(e, t) {
1764
1764
  t ? (n.push(t), r = !0) : e.directives.docStart && (r = !0);
1765
1765
  }
1766
1766
  r && n.push("---");
1767
- let i = ke(e, t), { commentString: a } = i.options;
1767
+ let i = Ae(e, t), { commentString: a } = i.options;
1768
1768
  if (e.commentBefore) {
1769
1769
  n.length !== 1 && n.unshift("");
1770
1770
  let t = a(e.commentBefore);
1771
- n.unshift(L(t, ""));
1771
+ n.unshift(I(t, ""));
1772
1772
  }
1773
1773
  let o = !1, s = null;
1774
1774
  if (e.contents) {
1775
1775
  if (b(e.contents)) {
1776
1776
  if (e.contents.spaceBefore && r && n.push(""), e.contents.commentBefore) {
1777
1777
  let t = a(e.contents.commentBefore);
1778
- n.push(L(t, ""));
1778
+ n.push(I(t, ""));
1779
1779
  }
1780
1780
  i.forceBlockIndent = !!e.comment, s = e.contents.comment;
1781
1781
  }
1782
- let t = s ? void 0 : () => o = !0, c = Me(e.contents, i, () => s = null, t);
1783
- s && (c += ge(c, "", a(s))), (c[0] === "|" || c[0] === ">") && n[n.length - 1] === "---" ? n[n.length - 1] = `--- ${c}` : n.push(c);
1784
- } else n.push(Me(e.contents, i));
1782
+ let t = s ? void 0 : () => o = !0, c = Ne(e.contents, i, () => s = null, t);
1783
+ s && (c += L(c, "", a(s))), (c[0] === "|" || c[0] === ">") && n[n.length - 1] === "---" ? n[n.length - 1] = `--- ${c}` : n.push(c);
1784
+ } else n.push(Ne(e.contents, i));
1785
1785
  if (e.directives?.docEnd) {
1786
1786
  if (e.comment) {
1787
1787
  let t = a(e.comment);
1788
- t.includes("\n") ? (n.push("..."), n.push(L(t, ""))) : n.push(`... ${t}`);
1788
+ t.includes("\n") ? (n.push("..."), n.push(I(t, ""))) : n.push(`... ${t}`);
1789
1789
  } else n.push("...");
1790
1790
  } else {
1791
1791
  let t = e.comment;
1792
- t && o && (t = t.replace(/^\n+/, "")), t && ((!o || s) && n[n.length - 1] !== "" && n.push(""), n.push(L(a(t), "")));
1792
+ t && o && (t = t.replace(/^\n+/, "")), t && ((!o || s) && n[n.length - 1] !== "" && n.push(""), n.push(I(a(t), "")));
1793
1793
  }
1794
1794
  return n.join("\n") + "\n";
1795
1795
  }
@@ -1812,7 +1812,7 @@ var Xt = class e {
1812
1812
  }, n);
1813
1813
  this.options = i;
1814
1814
  let { version: a } = i;
1815
- n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (a = this.directives.yaml.version)) : this.directives = new ie({ version: a }), this.setSchema(a, n), this.contents = e === void 0 ? null : this.createNode(e, r, n);
1815
+ n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (a = this.directives.yaml.version)) : this.directives = new A({ version: a }), this.setSchema(a, n), this.contents = e === void 0 ? null : this.createNode(e, r, n);
1816
1816
  }
1817
1817
  clone() {
1818
1818
  let t = Object.create(e.prototype, { [f]: { value: s } });
@@ -1826,10 +1826,10 @@ var Xt = class e {
1826
1826
  }
1827
1827
  createAlias(e, t) {
1828
1828
  if (!e.anchor) {
1829
- let n = A(this);
1830
- e.anchor = !t || n.has(t) ? oe(t || "a", n) : t;
1829
+ let n = ie(this);
1830
+ e.anchor = !t || n.has(t) ? ae(t || "a", n) : t;
1831
1831
  }
1832
- return new le(e.anchor);
1832
+ return new N(e.anchor);
1833
1833
  }
1834
1834
  createNode(e, t, n) {
1835
1835
  let r;
@@ -1838,7 +1838,7 @@ var Xt = class e {
1838
1838
  let e = t.filter((e) => typeof e == "number" || e instanceof String || e instanceof Number).map(String);
1839
1839
  e.length > 0 && (t = t.concat(e)), r = t;
1840
1840
  } else n === void 0 && t && (n = t, t = void 0);
1841
- let { aliasDuplicateObjects: i, anchorPrefix: a, flow: o, keepUndefined: s, onTagObj: c, tag: l } = n ?? {}, { onAnchor: u, setAnchors: d, sourceObjects: f } = se(this, a || "a"), p = {
1841
+ let { aliasDuplicateObjects: i, anchorPrefix: a, flow: o, keepUndefined: s, onTagObj: c, tag: l } = n ?? {}, { onAnchor: u, setAnchors: d, sourceObjects: f } = oe(this, a || "a"), p = {
1842
1842
  aliasDuplicateObjects: i ?? !0,
1843
1843
  keepUndefined: s ?? !1,
1844
1844
  onAnchor: u,
@@ -1846,7 +1846,7 @@ var Xt = class e {
1846
1846
  replacer: r,
1847
1847
  schema: this.schema,
1848
1848
  sourceObjects: f
1849
- }, m = F(e, l, p);
1849
+ }, m = pe(e, l, p);
1850
1850
  return o && y(m) && (m.flow = !0), d(), m;
1851
1851
  }
1852
1852
  createPair(e, t, n = {}) {
@@ -1856,39 +1856,39 @@ var Xt = class e {
1856
1856
  return Zt(this.contents) ? this.contents.delete(e) : !1;
1857
1857
  }
1858
1858
  deleteIn(e) {
1859
- return pe(e) ? this.contents != null && (this.contents = null, !0) : Zt(this.contents) ? this.contents.deleteIn(e) : !1;
1859
+ return he(e) ? this.contents != null && (this.contents = null, !0) : Zt(this.contents) ? this.contents.deleteIn(e) : !1;
1860
1860
  }
1861
1861
  get(e, t) {
1862
1862
  return y(this.contents) ? this.contents.get(e, t) : void 0;
1863
1863
  }
1864
1864
  getIn(e, t) {
1865
- return pe(e) ? !t && _(this.contents) ? this.contents.value : this.contents : y(this.contents) ? this.contents.getIn(e, t) : void 0;
1865
+ return he(e) ? !t && _(this.contents) ? this.contents.value : this.contents : y(this.contents) ? this.contents.getIn(e, t) : void 0;
1866
1866
  }
1867
1867
  has(e) {
1868
1868
  return y(this.contents) ? this.contents.has(e) : !1;
1869
1869
  }
1870
1870
  hasIn(e) {
1871
- return pe(e) ? this.contents !== void 0 : y(this.contents) ? this.contents.hasIn(e) : !1;
1871
+ return he(e) ? this.contents !== void 0 : y(this.contents) ? this.contents.hasIn(e) : !1;
1872
1872
  }
1873
1873
  set(e, t) {
1874
- this.contents == null ? this.contents = I(this.schema, [e], t) : Zt(this.contents) && this.contents.set(e, t);
1874
+ this.contents == null ? this.contents = me(this.schema, [e], t) : Zt(this.contents) && this.contents.set(e, t);
1875
1875
  }
1876
1876
  setIn(e, t) {
1877
- pe(e) ? this.contents = t : this.contents == null ? this.contents = I(this.schema, Array.from(e), t) : Zt(this.contents) && this.contents.setIn(e, t);
1877
+ he(e) ? this.contents = t : this.contents == null ? this.contents = me(this.schema, Array.from(e), t) : Zt(this.contents) && this.contents.setIn(e, t);
1878
1878
  }
1879
1879
  setSchema(e, t = {}) {
1880
1880
  typeof e == "number" && (e = String(e));
1881
1881
  let n;
1882
1882
  switch (e) {
1883
1883
  case "1.1":
1884
- this.directives ? this.directives.yaml.version = "1.1" : this.directives = new ie({ version: "1.1" }), n = {
1884
+ this.directives ? this.directives.yaml.version = "1.1" : this.directives = new A({ version: "1.1" }), n = {
1885
1885
  resolveKnownTags: !1,
1886
1886
  schema: "yaml-1.1"
1887
1887
  };
1888
1888
  break;
1889
1889
  case "1.2":
1890
1890
  case "next":
1891
- this.directives ? this.directives.yaml.version = e : this.directives = new ie({ version: e }), n = {
1891
+ this.directives ? this.directives.yaml.version = e : this.directives = new A({ version: e }), n = {
1892
1892
  resolveKnownTags: !0,
1893
1893
  schema: "core"
1894
1894
  };
@@ -1913,9 +1913,9 @@ var Xt = class e {
1913
1913
  mapAsMap: n === !0,
1914
1914
  mapKeyWarned: !1,
1915
1915
  maxAliasCount: typeof r == "number" ? r : 100
1916
- }, s = j(this.contents, t ?? "", o);
1916
+ }, s = M(this.contents, t ?? "", o);
1917
1917
  if (typeof i == "function") for (let { count: e, res: t } of o.anchors.values()) i(t, e);
1918
- return typeof a == "function" ? ce(a, { "": s }, "", s) : s;
1918
+ return typeof a == "function" ? se(a, { "": s }, "", s) : s;
1919
1919
  }
1920
1920
  toJSON(e, t) {
1921
1921
  return this.toJS({
@@ -2304,7 +2304,7 @@ function hn(e, t, n, r, i) {
2304
2304
  if (r?.collection === s) t.schema.tags.push(Object.assign({}, r, { default: !1 })), c = r;
2305
2305
  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), mn(e, t, n, i, o);
2306
2306
  }
2307
- let l = mn(e, t, n, i, o, c), u = c.resolve?.(l, (e) => i(a, "TAG_RESOLVE_FAILED", e), t.options) ?? l, d = b(u) ? u : new N(u);
2307
+ let l = mn(e, t, n, i, o, c), u = c.resolve?.(l, (e) => i(a, "TAG_RESOLVE_FAILED", e), t.options) ?? l, d = b(u) ? u : new P(u);
2308
2308
  return d.range = l.range, d.tag = o, c?.format && (d.format = c.format), d;
2309
2309
  }
2310
2310
  //#endregion
@@ -2321,7 +2321,7 @@ function gn(e, t, n) {
2321
2321
  r
2322
2322
  ]
2323
2323
  };
2324
- let a = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = t.source ? vn(t.source) : [], s = o.length;
2324
+ let a = i.mode === ">" ? P.BLOCK_FOLDED : P.BLOCK_LITERAL, o = t.source ? vn(t.source) : [], s = o.length;
2325
2325
  for (let e = o.length - 1; e >= 0; --e) {
2326
2326
  let t = o[e][1];
2327
2327
  if (t === "" || t === "\r") s = e;
@@ -2362,7 +2362,7 @@ function gn(e, t, n) {
2362
2362
  let e = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
2363
2363
  n(l - r.length - (s ? 2 : 1), "BAD_INDENT", e), t = "";
2364
2364
  }
2365
- a === N.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);
2365
+ a === P.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);
2366
2366
  }
2367
2367
  switch (i.chomp) {
2368
2368
  case "-": break;
@@ -2438,13 +2438,13 @@ function yn(e, t, n) {
2438
2438
  let { offset: r, type: i, source: a, end: o } = e, s, c, l = (e, t, i) => n(r + e, t, i);
2439
2439
  switch (i) {
2440
2440
  case "scalar":
2441
- s = N.PLAIN, c = bn(a, l);
2441
+ s = P.PLAIN, c = bn(a, l);
2442
2442
  break;
2443
2443
  case "single-quoted-scalar":
2444
- s = N.QUOTE_SINGLE, c = xn(a, l);
2444
+ s = P.QUOTE_SINGLE, c = xn(a, l);
2445
2445
  break;
2446
2446
  case "double-quoted-scalar":
2447
- s = N.QUOTE_DOUBLE, c = Cn(a, l);
2447
+ s = P.QUOTE_DOUBLE, c = Cn(a, l);
2448
2448
  break;
2449
2449
  /* istanbul ignore next should not happen */
2450
2450
  default: return n(e, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${i}`), {
@@ -2583,10 +2583,10 @@ function Dn(e, t, n, r) {
2583
2583
  let d;
2584
2584
  try {
2585
2585
  let a = l.resolve(i, (e) => r(n ?? t, "TAG_RESOLVE_FAILED", e), e.options);
2586
- d = _(a) ? a : new N(a);
2586
+ d = _(a) ? a : new P(a);
2587
2587
  } catch (e) {
2588
2588
  let a = e instanceof Error ? e.message : String(e);
2589
- r(n ?? t, "TAG_RESOLVE_FAILED", a), d = new N(i);
2589
+ r(n ?? t, "TAG_RESOLVE_FAILED", a), d = new P(i);
2590
2590
  }
2591
2591
  return d.range = s, d.source = i, a && (d.type = a), c && (d.tag = c), l.format && (d.format = l.format), o && (d.comment = o), d;
2592
2592
  }
@@ -2673,7 +2673,7 @@ function Nn(e, t, n, r, { spaceBefore: i, comment: a, anchor: o, tag: s, end: c
2673
2673
  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;
2674
2674
  }
2675
2675
  function Pn({ options: e }, { offset: t, source: n, end: r }, i) {
2676
- let a = new le(n.substring(1));
2676
+ let a = new N(n.substring(1));
2677
2677
  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);
2678
2678
  let o = t + n.length, s = un(r, o, e.strict, i);
2679
2679
  return a.range = [
@@ -2739,7 +2739,7 @@ var Rn = class {
2739
2739
  this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (e, t, n, r) => {
2740
2740
  let i = In(e);
2741
2741
  r ? this.warnings.push(new en(i, t, n)) : this.errors.push(new $t(i, t, n));
2742
- }, this.directives = new ie({ version: e.version || "1.2" }), this.options = e;
2742
+ }, this.directives = new A({ version: e.version || "1.2" }), this.options = e;
2743
2743
  }
2744
2744
  decorate(e, t) {
2745
2745
  let { comment: n, afterEmptyLine: r } = Ln(this.prelude);
@@ -2847,7 +2847,7 @@ function zn(e, t = !0, n) {
2847
2847
  return null;
2848
2848
  }
2849
2849
  function Bn(e, t) {
2850
- let { implicitKey: n = !1, indent: r, inFlow: i = !1, offset: a = -1, type: o = "PLAIN" } = t, s = Oe({
2850
+ let { implicitKey: n = !1, indent: r, inFlow: i = !1, offset: a = -1, type: o = "PLAIN" } = t, s = ke({
2851
2851
  type: o,
2852
2852
  value: e
2853
2853
  }, {
@@ -2926,7 +2926,7 @@ function Vn(e, t, n = {}) {
2926
2926
  }
2927
2927
  default: o = "PLAIN";
2928
2928
  }
2929
- let c = Oe({
2929
+ let c = ke({
2930
2930
  type: o,
2931
2931
  value: t
2932
2932
  }, {
@@ -4232,7 +4232,7 @@ function Sr(e, t, n) {
4232
4232
  typeof t == "function" ? r = t : n === void 0 && t && typeof t == "object" && (n = t);
4233
4233
  let i = xr(e, n);
4234
4234
  if (!i) return null;
4235
- if (i.warnings.forEach((e) => Pe(i.options.logLevel, e)), i.errors.length > 0) {
4235
+ if (i.warnings.forEach((e) => Fe(i.options.logLevel, e)), i.errors.length > 0) {
4236
4236
  if (i.options.logLevel !== "silent") throw i.errors[0];
4237
4237
  i.errors = [];
4238
4238
  }
@@ -4253,7 +4253,7 @@ function Cr(e, t, n) {
4253
4253
  //#endregion
4254
4254
  //#region node_modules/yaml/browser/index.js
4255
4255
  var wr = /* @__PURE__ */ a({
4256
- Alias: () => le,
4256
+ Alias: () => N,
4257
4257
  CST: () => $n,
4258
4258
  Composer: () => Rn,
4259
4259
  Document: () => Xt,
@@ -4261,7 +4261,7 @@ var wr = /* @__PURE__ */ a({
4261
4261
  LineCounter: () => ur,
4262
4262
  Pair: () => V,
4263
4263
  Parser: () => vr,
4264
- Scalar: () => N,
4264
+ Scalar: () => P,
4265
4265
  Schema: () => Jt,
4266
4266
  YAMLError: () => Qt,
4267
4267
  YAMLMap: () => H,
@@ -5809,7 +5809,7 @@ function pi(e) {
5809
5809
  return null;
5810
5810
  }
5811
5811
  async function mi(e, t) {
5812
- if (!t || typeof t != "object") return t;
5812
+ if (!t || typeof t != "object" || !JSON.stringify(t).includes("ast_")) return t;
5813
5813
  let n = /* @__PURE__ */ new Set(), r = (e) => {
5814
5814
  if (!e) return;
5815
5815
  let t = pi(e);
@@ -5821,51 +5821,58 @@ async function mi(e, t) {
5821
5821
  } else Array.isArray(e) ? e.forEach(r) : typeof e == "object" && Object.values(e).forEach(r);
5822
5822
  };
5823
5823
  if (r(t), n.size === 0) return t;
5824
- let i = Array.from(n).map(() => "?").join(","), a = await e.prepare(`
5825
- SELECT
5826
- a.id,
5827
- a.filename,
5828
- a.mimeType,
5829
- a.cdnUrl,
5830
- a.storageKeyPrivate,
5831
- a.parentAssetId,
5832
- a.cropCoordinatesJson,
5833
- a.dataJson,
5834
- p.cdnUrl AS parentCdnUrl,
5835
- p.storageKeyPrivate AS parentStorageKeyPrivate,
5836
- p.dataJson AS parentDataJson
5837
- FROM assets a
5838
- LEFT JOIN assets p ON a.parentAssetId = p.id
5839
- WHERE a.id IN (${i})
5840
- `).all(...Array.from(n)), o = Array.isArray(a) ? a : a?.results || [], s = await e.prepare(`
5841
- SELECT id, cdnUrl, storageKeyPrivate, filename, parentAssetId, cropCoordinatesJson, dataJson
5842
- FROM assets
5843
- WHERE isSystemVariant = 1
5844
- AND (parentAssetId IN (${i}) OR ${Array.from(n).map(() => "filename LIKE ?").join(" OR ")})
5845
- `).all(...Array.from(n), ...Array.from(n).map((e) => `%${e}%`)), c = Array.isArray(s) ? s : s?.results || [], l = /* @__PURE__ */ new Map();
5846
- for (let e of c) {
5847
- let t = pi(e.parentAssetId) || Array.from(n).find((t) => e.filename.includes(t));
5824
+ let i = Array.from(n), a = [], o = [];
5825
+ for (let t = 0; t < i.length; t += 30) {
5826
+ let n = i.slice(t, t + 30), r = n.map(() => "?").join(","), s = await e.prepare(`
5827
+ SELECT
5828
+ a.id,
5829
+ a.filename,
5830
+ a.mimeType,
5831
+ a.cdnUrl,
5832
+ a.storageKeyPrivate,
5833
+ a.parentAssetId,
5834
+ a.cropCoordinatesJson,
5835
+ a.dataJson,
5836
+ p.cdnUrl AS parentCdnUrl,
5837
+ p.storageKeyPrivate AS parentStorageKeyPrivate,
5838
+ p.dataJson AS parentDataJson
5839
+ FROM assets a
5840
+ LEFT JOIN assets p ON a.parentAssetId = p.id
5841
+ WHERE a.id IN (${r})
5842
+ `).all(...n);
5843
+ a.push(...Array.isArray(s) ? s : s?.results || []);
5844
+ let c = n.map(() => "filename LIKE ?").join(" OR "), l = await e.prepare(`
5845
+ SELECT id, cdnUrl, storageKeyPrivate, filename, parentAssetId, cropCoordinatesJson, dataJson
5846
+ FROM assets
5847
+ WHERE isSystemVariant = 1
5848
+ AND (parentAssetId IN (${r}) OR ${c})
5849
+ `).all(...n, ...n.map((e) => `%${e}%`));
5850
+ o.push(...Array.isArray(l) ? l : l?.results || []);
5851
+ }
5852
+ let s = /* @__PURE__ */ new Map();
5853
+ for (let e of o) {
5854
+ let t = pi(e.parentAssetId) || i.find((t) => e.filename.includes(t));
5848
5855
  if (!t) continue;
5849
- let r = e.filename.match(/^crop_([a-z0-9]+)_/i), i = r ? r[1] : "standard", a = null;
5856
+ let n = e.filename.match(/^crop_([a-z0-9]+)_/i), r = n ? n[1] : "standard", a = null;
5850
5857
  if (e.cropCoordinatesJson) try {
5851
5858
  a = typeof e.cropCoordinatesJson == "string" ? JSON.parse(e.cropCoordinatesJson) : e.cropCoordinatesJson;
5852
5859
  } catch {}
5853
5860
  let o = e.cdnUrl || (e.storageKeyPrivate ? `/media/${e.storageKeyPrivate}` : "");
5854
- l.has(t) || l.set(t, {}), l.get(t)[i] = {
5861
+ s.has(t) || s.set(t, {}), s.get(t)[r] = {
5855
5862
  id: e.id,
5856
5863
  url: o,
5857
5864
  cropCoordinates: a
5858
5865
  };
5859
5866
  }
5860
- let u = /* @__PURE__ */ new Map();
5861
- for (let e of o) {
5867
+ let c = /* @__PURE__ */ new Map();
5868
+ for (let e of a) {
5862
5869
  let t = e.cdnUrl || (e.storageKeyPrivate ? `/media/${e.storageKeyPrivate}` : ""), n = t;
5863
5870
  e.parentAssetId && (e.parentCdnUrl || e.parentStorageKeyPrivate) && (n = e.parentCdnUrl || `/media/${e.parentStorageKeyPrivate}`);
5864
5871
  let r = null;
5865
5872
  if (e.cropCoordinatesJson) try {
5866
5873
  r = typeof e.cropCoordinatesJson == "string" ? JSON.parse(e.cropCoordinatesJson) : e.cropCoordinatesJson;
5867
5874
  } catch {}
5868
- let i = l.get(e.id), a = {};
5875
+ let i = s.get(e.id), a = {};
5869
5876
  try {
5870
5877
  a = JSON.parse(e.dataJson || "{}");
5871
5878
  } catch {}
@@ -5875,7 +5882,7 @@ async function mi(e, t) {
5875
5882
  ...a
5876
5883
  };
5877
5884
  } catch {}
5878
- u.set(e.id, {
5885
+ c.set(e.id, {
5879
5886
  id: e.id,
5880
5887
  url: t,
5881
5888
  originalUrl: n,
@@ -5889,11 +5896,11 @@ async function mi(e, t) {
5889
5896
  description: a.description || ""
5890
5897
  });
5891
5898
  }
5892
- let d = (e) => {
5899
+ let l = (e) => {
5893
5900
  if (!e) return e;
5894
5901
  let t = pi(e);
5895
5902
  if (t) {
5896
- let n = u.get(t) || {
5903
+ let n = c.get(t) || {
5897
5904
  id: t,
5898
5905
  url: "",
5899
5906
  originalUrl: ""
@@ -5909,15 +5916,15 @@ async function mi(e, t) {
5909
5916
  metadataOverrides: a
5910
5917
  };
5911
5918
  }
5912
- if (Array.isArray(e)) return e.map(d);
5919
+ if (Array.isArray(e)) return e.map(l);
5913
5920
  if (typeof e == "object") {
5914
5921
  let t = {};
5915
- for (let [n, r] of Object.entries(e)) t[n] = d(r);
5922
+ for (let [n, r] of Object.entries(e)) t[n] = l(r);
5916
5923
  return t;
5917
5924
  }
5918
5925
  return e;
5919
5926
  };
5920
- return d(t);
5927
+ return l(t);
5921
5928
  }
5922
5929
  //#endregion
5923
5930
  //#region server/services/cache-manager.ts
@@ -5945,10 +5952,7 @@ var Y = class {
5945
5952
  console.warn("[CacheManager Warn]:", e?.message || e);
5946
5953
  });
5947
5954
  try {
5948
- if (e.executionCtx && typeof e.executionCtx.waitUntil == "function") {
5949
- e.executionCtx.waitUntil(n);
5950
- return;
5951
- }
5955
+ e.executionCtx && typeof e.executionCtx.waitUntil == "function" && e.executionCtx.waitUntil(n);
5952
5956
  } catch {}
5953
5957
  }
5954
5958
  getSafeUrl(e, t, n) {
@@ -5974,10 +5978,12 @@ var Y = class {
5974
5978
  }
5975
5979
  async purgeInternalWorkerCache(e, t, n, r, i = "en") {
5976
5980
  try {
5977
- let a = J(e);
5981
+ let a = J(e), o = [];
5978
5982
  if (n) {
5979
- 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 || [];
5980
- for (let e of i) await a.delete(`tree:default:${e.treeId}`), await a.delete(`tree:all:${e.treeId}`);
5983
+ let e = await t.prepare("SELECT treeId FROM tree_nodes WHERE contentId = ?").all(n) || [];
5984
+ for (let t of e) o.push(a.delete(`tree:default:${t.treeId}`)), o.push(a.delete(`tree:all:${t.treeId}`));
5985
+ let s = 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) || [];
5986
+ for (let e of s) o.push(a.delete(`node:${e.id}:${i}:${r}`)), o.push(a.delete(`node:${e.key}:${i}:${r}`));
5981
5987
  }
5982
5988
  if (r) {
5983
5989
  let e = r.replace(/^\/+|\/+$/g, "");
@@ -5986,12 +5992,9 @@ var Y = class {
5986
5992
  "default",
5987
5993
  "1",
5988
5994
  "main"
5989
- ]) await a.delete(`node:${t}:${i}:${e}`), await a.delete(`node:${t}:${i}:/${e}`);
5990
- }
5991
- if (n) {
5992
- 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 || [];
5993
- for (let e of s) await a.delete(`node:${e.id}:${i}:${r}`), await a.delete(`node:${e.key}:${i}:${r}`);
5995
+ ]) o.push(a.delete(`node:${t}:${i}:${e}`)), o.push(a.delete(`node:${t}:${i}:/${e}`));
5994
5996
  }
5997
+ o.length > 0 && await Promise.all(o);
5995
5998
  } catch (e) {
5996
5999
  console.warn("[CacheManager] Failed to purge internal worker cache:", e);
5997
6000
  }
@@ -5999,10 +6002,10 @@ var Y = class {
5999
6002
  purgeNode(e, t, n, r = !1) {
6000
6003
  let i = (async () => {
6001
6004
  try {
6002
- 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]) || {};
6003
- if (!a.slug) return;
6004
- 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);
6005
- await this.purgeInternalWorkerCache(e, t, n, a.slug, a.language || "en"), await this.purgeAndWarmSlugDirect(e, a.slug, c), r && await this.purgeGlobalCacheDirect(e, t);
6005
+ let i = await t.prepare("SELECT slug, status, language FROM content_nodes WHERE id = ?").get(n) || {};
6006
+ if (!i.slug) return;
6007
+ let a = (await 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 ").all(n) || []).map((t) => t.url || this.getSafeUrl(t.cdnUrl, t.storageKeyPrivate, this.getEnv(e).cdnDomain)).filter(Boolean);
6008
+ await this.purgeInternalWorkerCache(e, t, n, i.slug, i.language || "en"), await this.purgeAndWarmSlugDirect(e, i.slug, a), r && await this.purgeGlobalCacheDirect(e, t);
6006
6009
  } catch (e) {
6007
6010
  console.warn("[CacheManager] purgeNode failed:", e);
6008
6011
  }
@@ -6012,8 +6015,8 @@ var Y = class {
6012
6015
  purgeAsset(e, t, n) {
6013
6016
  let r = (async () => {
6014
6017
  try {
6015
- 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 || [];
6016
- 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));
6018
+ let r = (await t.prepare("SELECT cdnUrl, storageKeyPrivate FROM assets WHERE id = ? OR parentAssetId = ?").all(n, n) || []).map((t) => this.getSafeUrl(t.cdnUrl, t.storageKeyPrivate, this.getEnv(e).cdnDomain)).filter(Boolean), i = await 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 ").all(n, n, n) || [];
6019
+ for (let n of i) n.id && n.slug && (await this.purgeInternalWorkerCache(e, t, n.id, n.slug, n.language || "en"), await this.purgeAndWarmSlugDirect(e, n.slug, r));
6017
6020
  } catch (e) {
6018
6021
  console.warn("[CacheManager] purgeAsset failed:", e);
6019
6022
  }
@@ -6071,7 +6074,7 @@ var Y = class {
6071
6074
  "Content-Type": "application/json"
6072
6075
  },
6073
6076
  body: JSON.stringify({ files: c })
6074
- }).catch(() => {}), await new Promise((e) => setTimeout(e, 100)), fetch(`${s}?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).catch(() => {}), fetch(`${a}/llms.txt?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).catch(() => {});
6077
+ }).catch(() => {}), await new Promise((e) => setTimeout(e, 100)), await Promise.all([fetch(`${s}?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).catch(() => {}), fetch(`${a}/llms.txt?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).catch(() => {})]);
6075
6078
  } catch (e) {
6076
6079
  console.warn("[CacheManager] Dual Slug Purge skipped:", e);
6077
6080
  }
@@ -6080,11 +6083,15 @@ var Y = class {
6080
6083
  try {
6081
6084
  let { frontendUrl: n } = this.getEnv(e);
6082
6085
  if (this.isLocalEnv(e)) return;
6083
- 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) => {
6084
- let t = String(e.slug).replace(/^\/+|\/+$/g, ""), r = t === "home" || !t ? n : `${n}/${t}`;
6085
- return fetch(`${r}?_warmer=${s}`, { headers: o }).catch(() => {});
6086
+ let 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 = { "X-Cache-Warmer": "true" }, a = Date.now(), o = r.map((e) => {
6087
+ let t = String(e.slug).replace(/^\/+|\/+$/g, "");
6088
+ return t === "home" || !t ? n : `${n}/${t}`;
6086
6089
  });
6087
- c.push(fetch(`${n}/?_warmer=${s}`, { headers: o }).catch(() => {})), c.push(fetch(`${n}/llms.txt?_warmer=${s}`, { headers: o }).catch(() => {})), await Promise.all(c);
6090
+ o.push(`${n}/`), o.push(`${n}/llms.txt`);
6091
+ for (let e = 0; e < o.length; e += 15) {
6092
+ let t = o.slice(e, e + 15);
6093
+ await Promise.all(t.map((e) => fetch(`${e}?_warmer=${a}`, { headers: i }).catch(() => {}))), await new Promise((e) => setTimeout(e, 50));
6094
+ }
6088
6095
  } catch (e) {
6089
6096
  console.warn("⚠️ [CacheWarmer] Tree-wide warming failed:", e);
6090
6097
  }
@@ -12310,7 +12317,13 @@ Ii.get("/", async (e) => {
12310
12317
  //#endregion
12311
12318
  //#region server/routes/public/node.ts
12312
12319
  var zi = new n();
12313
- function Bi() {
12320
+ function Bi(e, t) {
12321
+ let n = Promise.resolve(t).catch((e) => console.error("[Background Task Error]:", e));
12322
+ try {
12323
+ e.executionCtx && typeof e.executionCtx.waitUntil == "function" && e.executionCtx.waitUntil(n);
12324
+ } catch {}
12325
+ }
12326
+ function Vi() {
12314
12327
  return {
12315
12328
  fullPath: /* @__PURE__ */ new Map(),
12316
12329
  treeEdges: /* @__PURE__ */ new Map(),
@@ -12318,15 +12331,15 @@ function Bi() {
12318
12331
  assetUrls: /* @__PURE__ */ new Map()
12319
12332
  };
12320
12333
  }
12321
- function Vi(...e) {
12334
+ function Hi(...e) {
12322
12335
  return e.map((e) => String(e ?? "")).join(":");
12323
12336
  }
12324
- function Hi(e) {
12337
+ function Ui(e) {
12325
12338
  if (!e || String(e).trim() === "") return null;
12326
12339
  let t = new Date(e.includes("T") ? e : e.replace(" ", "T") + "Z");
12327
12340
  return isNaN(t.getTime()) ? e : t.toISOString();
12328
12341
  }
12329
- function Ui(e, t) {
12342
+ function Wi(e, t) {
12330
12343
  let n = Date.now();
12331
12344
  if (e && String(e).trim() !== "") {
12332
12345
  let t = Date.parse(e);
@@ -12338,34 +12351,27 @@ function Ui(e, t) {
12338
12351
  }
12339
12352
  return !0;
12340
12353
  }
12341
- async function Wi(e, t, n) {
12354
+ async function Gi(e, t, n) {
12342
12355
  let r = t.filter((e) => e.componentId === "content-feed" || e.componentId === "article-list");
12343
12356
  await Promise.all(r.map(async (t) => {
12344
12357
  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];
12345
12358
  n && n !== "all" && (s += " AND id IN (SELECT nodeId FROM node_channels WHERE channelId = ?)", c.push(Number(n) || n));
12346
12359
  let l = "ORDER BY updatedAt DESC";
12347
12360
  o === "published_desc" || o === "createdAt" ? l = "ORDER BY createdAt DESC" : o === "title_asc" && (l = "ORDER BY LOWER(title) ASC");
12348
- let u = `
12349
- SELECT id, title, slug, language, dataJson, createdAt, updatedAt
12350
- ${s}
12351
- ${l}
12352
- LIMIT ?
12353
- `;
12354
- c.push(a);
12355
12361
  try {
12356
- let n = await e.prepare(u).all(...c), r = Array.isArray(n) ? n : n?.results || [];
12362
+ let n = await e.prepare(`SELECT id, title, slug, language, dataJson, createdAt, updatedAt ${s} ${l} LIMIT ?`).all(...c, a), r = Array.isArray(n) ? n : n?.results || [];
12357
12363
  t.data.initialItems = r.map((e) => {
12358
12364
  let t = {};
12359
12365
  if (e.dataJson) try {
12360
12366
  t = typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson;
12361
12367
  } catch {}
12362
- return Ui(t.startShowingAt, t.stopShowingAt) ? {
12368
+ return Wi(t.startShowingAt, t.stopShowingAt) ? {
12363
12369
  id: e.id,
12364
12370
  title: e.title,
12365
12371
  slug: e.slug,
12366
12372
  language: e.language || "en",
12367
- createdAt: Hi(e.createdAt),
12368
- updatedAt: Hi(e.updatedAt),
12373
+ createdAt: Ui(e.createdAt),
12374
+ updatedAt: Ui(e.updatedAt),
12369
12375
  excerpt: t.excerpt || "",
12370
12376
  image: t.image || t.coverImage || null,
12371
12377
  author: t.author || null
@@ -12376,26 +12382,15 @@ async function Wi(e, t, n) {
12376
12382
  }
12377
12383
  }));
12378
12384
  }
12379
- async function Gi(e, t, n, r, i = !1, a) {
12385
+ async function Ki(e, t, n, r, i = !1, a) {
12380
12386
  if (!t) return { blocks: [] };
12381
- 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 || [];
12387
+ 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 FROM tree_nodes t INNER JOIN content_nodes c ON t.contentId = c.id WHERE t.id = ? OR c.id = ?\n UNION ALL\n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, ap.level + 1 FROM tree_nodes t INNER JOIN content_nodes c ON t.contentId = c.id INNER JOIN ancestor_path ap ON t.id = ap.parentId\n ) SELECT * FROM ancestor_path ORDER BY level ASC\n ").all(t, t), s = Array.isArray(o) ? o : o?.results || [];
12382
12388
  if (!s || s.length === 0) return { blocks: [] };
12383
12389
  let c = s.map((e) => e.contentId).filter((e) => e != null);
12384
12390
  if (c.length === 0) return { blocks: [] };
12385
- let l = c.map(() => "?").join(","), u = +!!i, d = await e.prepare(`
12386
- SELECT *
12387
- FROM content_blocks
12388
- WHERE contentId IN (${l})
12389
- AND isDraft = ?
12390
- ORDER BY contentId ASC, sortOrder ASC
12391
- `).all(...c, u), f = Array.isArray(d) ? d : d?.results || [], p = [];
12391
+ let l = c.map(() => "?").join(","), u = +!!i, d = await e.prepare(`SELECT * FROM content_blocks WHERE contentId IN (${l}) AND isDraft = ? ORDER BY contentId ASC, sortOrder ASC`).all(...c, u), f = Array.isArray(d) ? d : d?.results || [], p = [];
12392
12392
  if (!i) {
12393
- let t = await e.prepare(`
12394
- SELECT *
12395
- FROM content_blocks
12396
- WHERE contentId IN (${l})
12397
- ORDER BY contentId ASC, sortOrder ASC
12398
- `).all(...c);
12393
+ let t = await e.prepare(`SELECT * FROM content_blocks WHERE contentId IN (${l}) ORDER BY contentId ASC, sortOrder ASC`).all(...c);
12399
12394
  p = Array.isArray(t) ? t : t?.results || [];
12400
12395
  }
12401
12396
  let m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
@@ -12420,11 +12415,7 @@ async function Gi(e, t, n, r, i = !1, a) {
12420
12415
  t = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
12421
12416
  } catch {}
12422
12417
  let n = String(e.id), r = String(t.blockId || t._instanceId || t.id || e.blockId);
12423
- for (let e of a) {
12424
- if (!e.region) continue;
12425
- let t = e.region;
12426
- o.has(t) || (t.startsWith(`${n}-`) || t.startsWith(`${n}_`) || r && r !== "undefined" && r !== "null" && (t.startsWith(`${r}-`) || t.startsWith(`${r}_`) || t.startsWith(r))) && (o.add(t), s = !0);
12427
- }
12418
+ for (let e of a) !e.region || o.has(e.region) || (e.region.startsWith(`${n}-`) || e.region.startsWith(`${n}_`) || r && r !== "undefined" && r !== "null" && (e.region.startsWith(`${r}-`) || e.region.startsWith(`${r}_`) || e.region.startsWith(r))) && (o.add(e.region), s = !0);
12428
12419
  }
12429
12420
  }
12430
12421
  let c = await Promise.all(a.filter((e) => o.has(e.region)).map(async (t) => {
@@ -12432,10 +12423,10 @@ async function Gi(e, t, n, r, i = !1, a) {
12432
12423
  try {
12433
12424
  a = (typeof t.dataJson == "string" ? JSON.parse(t.dataJson) : t.dataJson) || {};
12434
12425
  } catch {}
12435
- let o = a.hidden === !0 || a.hidden === 1 || a.hidden === "1" || a.hidden === "true", s = Ui(a.startShowingAt, a.stopShowingAt);
12426
+ let o = a.hidden === !0 || a.hidden === 1 || a.hidden === "1" || a.hidden === "true", s = Wi(a.startShowingAt, a.stopShowingAt);
12436
12427
  if (!i && (o || !s)) return null;
12437
- 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 && !String(a.id).startsWith("ast_") ? a.id : null) || t.blockId || t.id), d = Ki(a, l);
12438
- return d = await mi(e, d), d = qi(d), d.blockId = u, {
12428
+ 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 && !String(a.id).startsWith("ast_") ? a.id : null) || t.blockId || t.id), d = qi(a, l);
12429
+ return d = await mi(e, d), d = Ji(d), d.blockId = u, {
12439
12430
  region: t.region || n,
12440
12431
  block: {
12441
12432
  instanceId: t.id,
@@ -12455,27 +12446,25 @@ async function Gi(e, t, n, r, i = !1, a) {
12455
12446
  }
12456
12447
  return { blocks: [] };
12457
12448
  }
12458
- function Ki(e, t = {}) {
12449
+ function qi(e, t = {}) {
12459
12450
  let n = {};
12460
12451
  for (let [r, i] of Object.entries(e)) {
12461
12452
  if (r === "id" && typeof i == "string" && i.startsWith("ast_")) {
12462
12453
  n[r] = i;
12463
12454
  continue;
12464
12455
  }
12465
- 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("_") && r !== "_instanceId") continue;
12466
- let e = t[r];
12467
- e && e.public === !1 || (n[r] = i);
12456
+ 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("_") && r !== "_instanceId" || t[r] && t[r].public === !1 || (n[r] = i);
12468
12457
  }
12469
12458
  return n;
12470
12459
  }
12471
- function qi(e) {
12472
- if (Array.isArray(e)) return e.map(qi);
12460
+ function Ji(e) {
12461
+ if (Array.isArray(e)) return e.map(Ji);
12473
12462
  if (!e || typeof e != "object") return e;
12474
12463
  if (typeof e.id == "string" && e.id.startsWith("ast_") && typeof e.url == "string") {
12475
12464
  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 ? {
12476
12465
  ...t,
12477
12466
  ...t.crops?.[r] || {}
12478
- } : t, a = Object.fromEntries(Object.entries(n).filter(([, t]) => t?.id !== e.id).map(([t, n]) => [t, qi({
12467
+ } : t, a = Object.fromEntries(Object.entries(n).filter(([, t]) => t?.id !== e.id).map(([t, n]) => [t, Ji({
12479
12468
  ...n,
12480
12469
  title: n?.title ?? e.title ?? "",
12481
12470
  alt: n?.alt ?? e.alt ?? "",
@@ -12489,9 +12478,10 @@ function qi(e) {
12489
12478
  ...Object.keys(a).length > 0 ? { variants: a } : {}
12490
12479
  };
12491
12480
  }
12492
- return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, qi(t)]));
12481
+ return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Ji(t)]));
12493
12482
  }
12494
- async function Ji(e, t, n) {
12483
+ async function Yi(e, t, n) {
12484
+ if (!t) return t;
12495
12485
  if (typeof t == "string") {
12496
12486
  if (!t.includes("#node:") && !t.includes("data-node-id") && !t.includes("#asset:") && !t.includes("data-asset-id")) return t;
12497
12487
  let r = (e, t) => {
@@ -12501,95 +12491,89 @@ async function Ji(e, t, n) {
12501
12491
  for (let e of t.matchAll(/(?:#node:|data-node-id\s*=\s*["'])([^"'\s>]+)/gi)) i.add(e[1]);
12502
12492
  for (let e of t.matchAll(/(?:#asset:|data-asset-id\s*=\s*["'])([^"'\s>]+)/gi)) a.add(e[1]);
12503
12493
  if (i.size === 0 && a.size === 0) return t;
12504
- let o = Array.from(i).map(() => "?").join(","), s = i.size > 0 ? await e.prepare(`
12505
- SELECT id, slug
12506
- FROM content_nodes
12507
- WHERE id IN (${o})
12508
- `).all(...i) : [], c = Array.isArray(s) ? s : s?.results || [], l = /* @__PURE__ */ new Map();
12509
- for (let e of c) l.set(String(e.id), String(e.slug || "").replace(/^\/+|\/+$/g, ""));
12510
- let u = Array.from(a).map(() => "?").join(","), d = a.size > 0 ? await e.prepare(`
12511
- SELECT id, cdnUrl, storageKeyPrivate
12512
- FROM assets
12513
- WHERE id IN (${u})
12514
- `).all(...a) : [], f = Array.isArray(d) ? d : d?.results || [], p = /* @__PURE__ */ new Map();
12515
- for (let e of f) p.set(String(e.id), e.cdnUrl || (e.storageKeyPrivate ? `/media/${e.storageKeyPrivate}` : ""));
12516
- let m = /* @__PURE__ */ new Map(), h = /<a\s+([^>]+)>/gi;
12517
- return await Promise.all(Array.from(t.matchAll(h)).map(async (t) => {
12494
+ let o = i.size > 0 ? Array.isArray(await e.prepare(`SELECT id, slug FROM content_nodes WHERE id IN (${Array.from(i).map(() => "?").join(",")})`).all(...i)) ? await e.prepare(`SELECT id, slug FROM content_nodes WHERE id IN (${Array.from(i).map(() => "?").join(",")})`).all(...i) : (await e.prepare(`SELECT id, slug FROM content_nodes WHERE id IN (${Array.from(i).map(() => "?").join(",")})`).all(...i)).results || [] : [], s = /* @__PURE__ */ new Map();
12495
+ for (let e of o) s.set(String(e.id), String(e.slug || "").replace(/^\/+|\/+$/g, ""));
12496
+ let c = a.size > 0 ? Array.isArray(await e.prepare(`SELECT id, cdnUrl, storageKeyPrivate FROM assets WHERE id IN (${Array.from(a).map(() => "?").join(",")})`).all(...a)) ? await e.prepare(`SELECT id, cdnUrl, storageKeyPrivate FROM assets WHERE id IN (${Array.from(a).map(() => "?").join(",")})`).all(...a) : (await e.prepare(`SELECT id, cdnUrl, storageKeyPrivate FROM assets WHERE id IN (${Array.from(a).map(() => "?").join(",")})`).all(...a)).results || [] : [], l = /* @__PURE__ */ new Map();
12497
+ for (let e of c) l.set(String(e.id), e.cdnUrl || (e.storageKeyPrivate ? `/media/${e.storageKeyPrivate}` : ""));
12498
+ let u = /* @__PURE__ */ new Map(), d = /<a\s+([^>]+)>/gi;
12499
+ return await Promise.all(Array.from(t.matchAll(d)).map(async (t) => {
12518
12500
  let i = t[1], a = r(i, "data-node-id"), o = r(i, "data-tree-id");
12519
12501
  if (!a || !o) return;
12520
- let s = await Xi(e, a, o, n);
12502
+ let s = await Zi(e, a, o, n);
12521
12503
  if (s?.treeNodeId) {
12522
- let t = await ea(e, String(s.treeNodeId), o, n);
12523
- m.set(`${a}:${o}`, t);
12504
+ let t = await ta(e, String(s.treeNodeId), o, n);
12505
+ u.set(`${a}:${o}`, t);
12524
12506
  }
12525
- })), t.replace(h, (e, t) => {
12507
+ })), t.replace(d, (e, t) => {
12526
12508
  let n = r(t, "data-node-id"), i = r(t, "data-asset-id"), a = r(t, "href") || "";
12527
12509
  if (a.startsWith("mailto:")) return `<a ${t.replace(/\s+target\s*=\s*["'][^"']*["']/i, "")}>`;
12528
- let o = a.match(/^#node:(.+)$/i), s = a.match(/^#asset:(.+)$/i), c = i || s?.[1], u = n || o?.[1];
12529
- if (!u && !c) return e;
12530
- if (c && !u) {
12531
- let n = p.get(c);
12510
+ let o = i || a.match(/^#asset:(.+)$/i)?.[1], c = n || a.match(/^#node:(.+)$/i)?.[1];
12511
+ if (!c && !o) return e;
12512
+ if (o && !c) {
12513
+ let n = l.get(o);
12532
12514
  if (n) {
12533
- let e = t;
12534
- return /href\s*=\s*["'][^"']*["']/i.test(e) ? e = e.replace(/href\s*=\s*["'][^"']*["']/i, `href="${n}"`) : e += ` href="${n}"`, i || (e += ` data-asset-id="${c}"`), `<a ${e}>`;
12515
+ let e = t.replace(/href\s*=\s*["'][^"']*["']/i, `href="${n}"`);
12516
+ return /href\s*=/.test(e) || (e += ` href="${n}"`), i || (e += ` data-asset-id="${o}"`), `<a ${e}>`;
12535
12517
  }
12536
12518
  return e;
12537
12519
  }
12538
- let d = r(t, "data-tree-id"), f = d ? m.get(`${u}:${d}`) : void 0, h = l.get(u), g = f || (h === void 0 ? "#" : `/${h}`), _ = t;
12539
- return /href\s*=\s*["'][^"']*["']/i.test(_) ? _ = _.replace(/href\s*=\s*["'][^"']*["']/i, `href="${g || "/"}"`) : _ += ` href="${g || "/"}"`, `<a ${_}>`;
12520
+ let d = r(t, "data-tree-id"), f = d ? u.get(`${c}:${d}`) : void 0, p = s.get(c), m = f || (p === void 0 ? "#" : `/${p}`), h = t.replace(/href\s*=\s*["'][^"']*["']/i, `href="${m || "/"}"`);
12521
+ return /href\s*=/.test(h) || (h += ` href="${m || "/"}"`), `<a ${h}>`;
12540
12522
  });
12541
12523
  }
12542
- if (Array.isArray(t)) return Promise.all(t.map((t) => Ji(e, t, n)));
12543
- if (t && typeof t == "object") {
12524
+ if (Array.isArray(t)) return Promise.all(t.map((t) => Yi(e, t, n)));
12525
+ if (typeof t == "object") {
12526
+ let r = JSON.stringify(t);
12527
+ if (!r.includes("#node:") && !r.includes("data-node-id") && !r.includes("#asset:") && !r.includes("data-asset-id")) return t;
12544
12528
  if (typeof t.href == "string" && (t.href.startsWith("#node:") || t.href.startsWith("#asset:"))) return {
12545
12529
  ...t,
12546
- href: await Yi(e, t, n)
12530
+ href: await Xi(e, t, n)
12547
12531
  };
12548
- let r = await Promise.all(Object.entries(t).map(async ([t, r]) => [t, await Ji(e, r, n)]));
12549
- return Object.fromEntries(r);
12532
+ let i = await Promise.all(Object.entries(t).map(async ([t, r]) => [t, await Yi(e, r, n)]));
12533
+ return Object.fromEntries(i);
12550
12534
  }
12551
12535
  return t;
12552
12536
  }
12553
- async function Yi(e, t, n) {
12537
+ async function Xi(e, t, n) {
12554
12538
  let r = t.href.match(/^#node:(.+)$/), i = t.href.match(/^#asset:(.+)$/);
12555
- if (i) return Qi(e, i[1], n);
12539
+ if (i) return $i(e, i[1], n);
12556
12540
  if (!r) return t.href;
12557
12541
  let a = r[1];
12558
12542
  if (t.treeId) {
12559
- let r = await Xi(e, a, String(t.treeId), n);
12543
+ let r = await Zi(e, a, String(t.treeId), n);
12560
12544
  if (r?.treeNodeId) {
12561
- let i = await ea(e, String(r.treeNodeId), String(t.treeId), n);
12545
+ let i = await ta(e, String(r.treeNodeId), String(t.treeId), n);
12562
12546
  if (i) return i;
12563
12547
  }
12564
12548
  }
12565
- let o = await Zi(e, a, n);
12549
+ let o = await Qi(e, a, n);
12566
12550
  return o === void 0 ? "#" : `/${o}`;
12567
12551
  }
12568
- async function Xi(e, t, n, r) {
12569
- let i = Vi(t, n), a = r.treeEdges.get(i);
12570
- if (a) return a;
12571
- let o = e.prepare("\n SELECT id as treeNodeId\n FROM tree_nodes\n WHERE contentId = ? AND treeId = ?\n LIMIT 1\n ").get(t, n);
12572
- return r.treeEdges.set(i, Promise.resolve(o)), o;
12552
+ async function Zi(e, t, n, r) {
12553
+ let i = Hi(t, n);
12554
+ if (r.treeEdges.has(i)) return r.treeEdges.get(i);
12555
+ let a = e.prepare("SELECT id as treeNodeId FROM tree_nodes WHERE contentId = ? AND treeId = ? LIMIT 1").get(t, n);
12556
+ return r.treeEdges.set(i, Promise.resolve(a)), a;
12573
12557
  }
12574
- async function Zi(e, t, n) {
12575
- let r = String(t), i = n.nodeSlugs.get(r);
12576
- if (i) return i;
12577
- let a = (async () => {
12558
+ async function Qi(e, t, n) {
12559
+ let r = String(t);
12560
+ if (n.nodeSlugs.has(r)) return n.nodeSlugs.get(r);
12561
+ let i = (async () => {
12578
12562
  let n = await e.prepare("SELECT slug FROM content_nodes WHERE id = ?").get(t);
12579
12563
  return n?.slug ? String(n.slug).replace(/^\/+|\/+$/g, "") : void 0;
12580
12564
  })();
12581
- return n.nodeSlugs.set(r, a), a;
12565
+ return n.nodeSlugs.set(r, i), i;
12582
12566
  }
12583
- async function Qi(e, t, n) {
12584
- let r = String(t), i = n.assetUrls.get(r);
12585
- if (i) return i;
12586
- let a = (async () => {
12567
+ async function $i(e, t, n) {
12568
+ let r = String(t);
12569
+ if (n.assetUrls.has(r)) return n.assetUrls.get(r);
12570
+ let i = (async () => {
12587
12571
  let n = await e.prepare("SELECT cdnUrl, storageKeyPrivate FROM assets WHERE id = ?").get(t);
12588
12572
  return n?.cdnUrl || (n?.storageKeyPrivate ? `/media/${n.storageKeyPrivate}` : "#");
12589
12573
  })();
12590
- return n.assetUrls.set(r, a), a;
12574
+ return n.assetUrls.set(r, i), i;
12591
12575
  }
12592
- function $i(e) {
12576
+ function ea(e) {
12593
12577
  let t = e.socialImage;
12594
12578
  if (!t || typeof t != "object") return null;
12595
12579
  let n = (e, t) => {
@@ -12620,15 +12604,12 @@ function $i(e) {
12620
12604
  ])
12621
12605
  };
12622
12606
  }
12623
- async function ea(e, t, n, r) {
12607
+ async function ta(e, t, n, r) {
12624
12608
  if (!t) return "";
12625
- let i = Vi(t, n);
12626
- if (r) {
12627
- let e = r.fullPath.get(i);
12628
- if (e) return e;
12629
- }
12609
+ let i = Hi(t, n);
12610
+ if (r && r.fullPath.has(i)) return r.fullPath.get(i);
12630
12611
  let a = (async () => {
12631
- let r = await e.prepare("\n WITH RECURSIVE ancestor_path(id, parentId, slug, level) AS (\n SELECT t.id, t.parentId, c.slug, 0\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n WHERE t.id = ? AND t.treeId = ?\n\n UNION ALL\n\n SELECT t.id, t.parentId, c.slug, 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 WHERE t.treeId = ?\n )\n SELECT slug\n FROM ancestor_path\n ORDER BY level DESC\n ").all(t, n, n), i = Array.isArray(r) ? r : r?.results || [], a = [];
12612
+ let r = await e.prepare("\n WITH RECURSIVE ancestor_path(id, parentId, slug, level) AS (\n SELECT t.id, t.parentId, c.slug, 0 FROM tree_nodes t INNER JOIN content_nodes c ON t.contentId = c.id WHERE t.id = ? AND t.treeId = ?\n UNION ALL\n SELECT t.id, t.parentId, c.slug, ap.level + 1 FROM tree_nodes t INNER JOIN content_nodes c ON t.contentId = c.id INNER JOIN ancestor_path ap ON t.id = ap.parentId WHERE t.treeId = ?\n ) SELECT slug FROM ancestor_path ORDER BY level DESC\n ").all(t, n, n), i = Array.isArray(r) ? r : r?.results || [], a = [];
12632
12613
  for (let e of i) {
12633
12614
  let t = (e.slug || "").replace(/^\/+|\/+$/g, "");
12634
12615
  t === "home" || t === "homee" ? i.length === 1 && (a.length = 0) : t && a.push(t);
@@ -12637,10 +12618,10 @@ async function ea(e, t, n, r) {
12637
12618
  })();
12638
12619
  return r && r.fullPath.set(i, a), a;
12639
12620
  }
12640
- async function ta(e, t, n, r, i) {
12621
+ async function na(e, t, n, r, i) {
12641
12622
  let a = {}, o = null;
12642
12623
  if (t) {
12643
- 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([
12624
+ 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 FROM tree_nodes t INNER JOIN content_nodes c ON t.contentId = c.id WHERE t.id = ? OR c.id = ?\n UNION ALL\n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, ap.level + 1 FROM tree_nodes t INNER JOIN content_nodes c ON t.contentId = c.id INNER JOIN ancestor_path ap ON t.id = ap.parentId\n ) SELECT c.dataJson, c.draftDataJson FROM ancestor_path ap INNER JOIN content_nodes c ON ap.contentId = c.id ORDER BY ap.level ASC\n ").all(t, t), i = Array.isArray(n) ? n : n?.results || [], s = /* @__PURE__ */ new Set([
12644
12625
  "subpageLayoutId",
12645
12626
  "layoutId",
12646
12627
  "slug",
@@ -12675,20 +12656,13 @@ async function ta(e, t, n, r, i) {
12675
12656
  inheritedFields: a
12676
12657
  };
12677
12658
  }
12678
- function na(e) {
12659
+ function ra(e) {
12679
12660
  let t = Number(e?.env?.CMS_NODE_CACHE_TTL);
12680
12661
  return Number.isFinite(t) && t >= 60 ? Math.floor(t) : 300;
12681
12662
  }
12682
- async function ra(e, t, n, r) {
12683
- try {
12684
- await e.set(t, n, r);
12685
- } catch (e) {
12686
- console.warn("[CMS Cache] Failed to write node response to cache:", e);
12687
- }
12688
- }
12689
12663
  zi.get("/*", async (e) => {
12690
12664
  try {
12691
- let t = e.get("db"), n = Bi(), 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));
12665
+ let t = e.get("db"), n = Vi(), 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));
12692
12666
  if (!c) return e.json({ error: `Channel '${a}' not found` }, 404);
12693
12667
  let l = c.status === "disabled" || c.status === "inactive" || c.isEnabled === 0 || c.isEnabled === !1;
12694
12668
  if (!s && l) return e.json({ error: `Channel '${c.key || a}' is currently inactive` }, 404);
@@ -12698,21 +12672,16 @@ zi.get("/*", async (e) => {
12698
12672
  if (t) return e.header("X-Cache", "HIT"), e.json(t);
12699
12673
  }
12700
12674
  let h = jr(e.env?.BUNDLED_DEFINITIONS), g = /^\d+$/.test(i), _ = null, v = null, y = e.req.query("treeId"), b = i.split("/"), x = b[b.length - 1], S = "/" + i.replace(/^\/+|\/+$/g, ""), C = `
12701
- SELECT
12702
- cn.*,
12703
- tn.id as treeNodeId,
12704
- tn.parentId,
12705
- tn.treeId
12675
+ SELECT cn.*, tn.id as treeNodeId, tn.parentId, tn.treeId
12706
12676
  FROM content_nodes cn
12707
12677
  INNER JOIN tree_nodes tn ON cn.id = tn.contentId
12708
12678
  ${u === null ? "" : "INNER JOIN node_channels nc ON cn.id = nc.nodeId"}
12709
- WHERE cn.slug = ?
12710
- ${u === null ? "" : "AND nc.channelId = ?"}
12679
+ WHERE cn.slug = ? ${u === null ? "" : "AND nc.channelId = ?"}
12711
12680
  `, w = u === null ? [x] : [x, u], T = await t.prepare(C).all(...w), E = Array.isArray(T) ? T : T?.results || [];
12712
12681
  if (E.length > 0) {
12713
12682
  let e = await Promise.all(E.map(async (e) => ({
12714
12683
  candidate: e,
12715
- calculatedPath: await ea(t, String(e.treeNodeId), String(e.treeId), n)
12684
+ calculatedPath: await ta(t, String(e.treeNodeId), String(e.treeId), n)
12716
12685
  }))), r = S.replace(/^\/+|\/+$/g, "");
12717
12686
  for (let { candidate: t, calculatedPath: n } of e) {
12718
12687
  let e = n.replace(/^\/+|\/+$/g, "");
@@ -12722,84 +12691,83 @@ zi.get("/*", async (e) => {
12722
12691
  }
12723
12692
  }
12724
12693
  }
12725
- if (!_ && b.length === 1 && (_ = u === null ? await t.prepare("SELECT * FROM content_nodes WHERE slug = ?").get(x) : await t.prepare("\n SELECT cn.*\n FROM content_nodes cn\n INNER JOIN node_channels nc ON cn.id = nc.nodeId\n WHERE cn.slug = ? AND nc.channelId = ?\n ").get(x, u)), !_ && g && (_ = u === null ? await t.prepare("SELECT * FROM content_nodes WHERE id = ?").get(Number(i)) : await t.prepare("\n SELECT cn.*\n FROM content_nodes cn\n INNER JOIN node_channels nc ON cn.id = nc.nodeId\n WHERE cn.id = ? AND nc.channelId = ?\n ").get(Number(i), u)), !_) return e.json({ error: `Node '${i}' not found for Channel '${a}'` }, 404);
12694
+ if (!_ && b.length === 1 && (_ = u === null ? await t.prepare("SELECT * FROM content_nodes WHERE slug = ?").get(x) : await t.prepare("SELECT cn.* FROM content_nodes cn INNER JOIN node_channels nc ON cn.id = nc.nodeId WHERE cn.slug = ? AND nc.channelId = ?").get(x, u)), !_ && g && (_ = u === null ? await t.prepare("SELECT * FROM content_nodes WHERE id = ?").get(Number(i)) : await t.prepare("SELECT cn.* FROM content_nodes cn INNER JOIN node_channels nc ON cn.id = nc.nodeId WHERE cn.id = ? AND nc.channelId = ?").get(Number(i), u)), !_) return e.json({ error: `Node '${i}' not found for Channel '${a}'` }, 404);
12726
12695
  if (!v) {
12727
12696
  let e = y ? [_.id, y] : [_.id];
12728
- v = await t.prepare(`
12729
- SELECT id as treeNodeId, treeId, parentId
12730
- FROM tree_nodes
12731
- WHERE contentId = ?
12732
- ${y ? "AND treeId = ?" : ""}
12733
- LIMIT 1
12734
- `).get(...e);
12697
+ v = await t.prepare(`SELECT id as treeNodeId, treeId, parentId FROM tree_nodes WHERE contentId = ? ${y ? "AND treeId = ?" : ""} LIMIT 1`).get(...e);
12735
12698
  }
12736
- let D = v?.treeId || y || "main-nav", O = v?.parentId || null, ee = v?.treeNodeId ? await ea(t, String(v.treeNodeId), String(D), n) : `/${(_.slug || "").replace(/^\/+|\/+$/g, "")}`, k = {}, te = s && _.draftDataJson ? _.draftDataJson : _.dataJson || _.draftDataJson;
12699
+ let D = v?.treeId || y || "main-nav", O = v?.parentId || null, ee = v?.treeNodeId ? await ta(t, String(v.treeNodeId), String(D), n) : `/${(_.slug || "").replace(/^\/+|\/+$/g, "")}`, k = {}, te = s && _.draftDataJson ? _.draftDataJson : _.dataJson || _.draftDataJson;
12737
12700
  if (te) try {
12738
12701
  k = typeof te == "string" ? JSON.parse(te) : te;
12739
12702
  } catch {}
12740
- let ne = k.nodeType || k.contentType || _.contentType || "page", re = {
12703
+ let ne = k.nodeType || k.contentType || _.contentType || "page", re = _.contentType || "node", A = h.nodes?.[re] || Object.values(h.nodes || {})[0] || {}, j = { ...A.fields || {} };
12704
+ A.tabs && Object.values(A.tabs).forEach((e) => {
12705
+ Object.assign(j, e.fields || {});
12706
+ });
12707
+ let ie = +!!s, [ae, oe, se] = await Promise.all([
12708
+ na(t, O, D, s, j),
12709
+ v?.treeNodeId ? t.prepare("SELECT t.id as treeNodeId, t.contentId as id, c.title, c.slug, c.language, c.contentType as nodeType, c.isHidden, c.dataJson, c.draftDataJson FROM tree_nodes t INNER JOIN content_nodes c ON t.contentId = c.id WHERE t.parentId = ? AND t.treeId = ? ORDER BY t.sortOrder ASC").all(v.treeNodeId, D) : Promise.resolve([]),
12710
+ t.prepare("SELECT * FROM content_blocks WHERE contentId = ? AND isDraft = ? ORDER BY sortOrder ASC").all(_.id, ie)
12711
+ ]), { resolvedLayoutId: M, inheritedFields: ce } = ae, N = {
12741
12712
  id: _.id,
12742
12713
  title: _.title,
12743
12714
  slug: _.slug,
12744
12715
  path: ee === "" ? "/" : ee,
12745
12716
  nodeType: ne,
12746
- createdAt: Hi(_.createdAt),
12747
- updatedAt: Hi(_.updatedAt),
12748
- publishedAt: Hi(k.publishedAt || _.createdAt)
12749
- }, ie = _.contentType || "node", ae = h.nodes?.[ie] || Object.values(h.nodes || {})[0] || {}, A = { ...ae.fields || {} };
12750
- ae.tabs && Object.values(ae.tabs).forEach((e) => {
12751
- Object.assign(A, e.fields || {});
12752
- });
12753
- let oe = {}, se = null, ce = null, j = !1;
12754
- k.disabledRegions && (oe = k.disabledRegions), j = k.hidden === !0 || k.hidden === 1 || k.hidden === "1" || k.hidden === "true", se = k.startShowingAt || null, ce = k.stopShowingAt || null;
12755
- let M = Ki(k, A), le = M.layoutId || null, ue = le && le !== "inherit", { resolvedLayoutId: de, inheritedFields: N } = await ta(t, O, D, s, A), fe = !1, P = null;
12756
- A.layoutId && (fe = !0, A.layoutId.options && Array.isArray(A.layoutId.options) && (P = A.layoutId.options.map((e) => typeof e == "object" ? e.value || e.id : e)));
12757
- let F = null;
12758
- if (fe && P && P.length === 1 && P[0] !== "inherit") F = P[0];
12759
- else if (!fe && ae.defaultLayout) F = ae.defaultLayout;
12717
+ createdAt: Ui(_.createdAt),
12718
+ updatedAt: Ui(_.updatedAt),
12719
+ publishedAt: Ui(k.publishedAt || _.createdAt)
12720
+ }, le = k.disabledRegions || {}, ue = k.hidden === !0 || k.hidden === 1 || k.hidden === "1" || k.hidden === "true", P = k.startShowingAt || null, de = k.stopShowingAt || null, fe = qi(k, j), pe = fe.layoutId || null, me = pe && pe !== "inherit", he = !1, F = null;
12721
+ j.layoutId && (he = !0, j.layoutId.options && Array.isArray(j.layoutId.options) && (F = j.layoutId.options.map((e) => typeof e == "object" ? e.value || e.id : e)));
12722
+ let ge = null;
12723
+ if (he && F && F.length === 1 && F[0] !== "inherit") ge = F[0];
12724
+ else if (!he && A.defaultLayout) ge = A.defaultLayout;
12760
12725
  else {
12761
- let e = ue ? le : de;
12762
- F = e && e !== "inherit" && (!P || P.includes(e) || P.includes("inherit")) ? e : ae.defaultLayout || null;
12763
- }
12764
- for (let [e, t] of Object.entries(N)) A[e] && (M[e] === void 0 || M[e] === null || M[e] === "" || M[e] === "inherit") && t !== void 0 && (M[e] = t);
12765
- let I = await mi(t, M);
12766
- I = qi(I), I = await Ji(t, I, n);
12767
- let pe = $i(I);
12768
- delete I.socialImage, delete I.fbImage, delete I.xImage, delete I.whatsappImage, pe && (I.socialImages = pe), delete I.id, delete I.title, delete I.slug, delete I.language, delete I.contentType, delete I.nodeType, delete I.createdAt, delete I.updatedAt, delete I.publishedAt, delete I.channelId, delete I.treeId, delete I.path, I.iconName === "" && (I.iconName = null), Object.assign(re, I), ae.hasCanvas && (re.layoutId = F);
12769
- let me = Number(_.isHidden) === 1 || j, he = !Ui(se, ce);
12770
- if (!s && (me || he)) return e.json({ error: "Node is hidden or outside its scheduled publishing window" }, 404);
12771
- let L = [];
12726
+ let e = me ? pe : M;
12727
+ ge = e && e !== "inherit" && (!F || F.includes(e) || F.includes("inherit")) ? e : A.defaultLayout || null;
12728
+ }
12729
+ for (let [e, t] of Object.entries(ce)) j[e] && (fe[e] === void 0 || fe[e] === null || fe[e] === "" || fe[e] === "inherit") && t !== void 0 && (fe[e] = t);
12730
+ let I = await mi(t, fe);
12731
+ I = Ji(I), I = await Yi(t, I, n);
12732
+ let L = ea(I);
12733
+ delete I.socialImage, delete I.fbImage, delete I.xImage, delete I.whatsappImage, L && (I.socialImages = L), delete I.id, delete I.title, delete I.slug, delete I.language, delete I.contentType, delete I.nodeType, delete I.createdAt, delete I.updatedAt, delete I.publishedAt, delete I.channelId, delete I.treeId, delete I.path, I.iconName === "" && (I.iconName = null), Object.assign(N, I), A.hasCanvas && (N.layoutId = ge);
12734
+ let _e = Number(_.isHidden) === 1 || ue, ve = !Wi(P, de);
12735
+ if (!s && (_e || ve)) return e.json({ error: "Node is hidden or outside its scheduled publishing window" }, 404);
12736
+ let ye = [];
12772
12737
  if (v?.treeNodeId) {
12773
- 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 ON t.contentId = c.id\n WHERE t.parentId = ? AND t.treeId = ?\n ORDER BY t.sortOrder ASC\n ").all(v.treeNodeId, D), n = Array.isArray(e) ? e : e?.results || [], r = re.path === "/" ? "" : re.path;
12774
- L = n.map((e) => {
12775
- let t = {}, n = s && e.draftDataJson ? e.draftDataJson : e.dataJson;
12738
+ let e = Array.isArray(oe) ? oe : oe?.results || [], t = N.path === "/" ? "" : N.path;
12739
+ ye = e.map((e) => {
12740
+ let n = {}, r = s && e.draftDataJson ? e.draftDataJson : e.dataJson;
12776
12741
  try {
12777
- t = (typeof n == "string" ? JSON.parse(n) : n) || {};
12742
+ n = (typeof r == "string" ? JSON.parse(r) : r) || {};
12778
12743
  } catch {}
12779
- let i = Number(e.isHidden) === 1 || t.hidden === !0 || t.hidden === 1 || t.hidden === "1", a = Ui(t.startShowingAt, t.stopShowingAt), o = (e.slug || "").replace(/^\/+|\/+$/g, "");
12744
+ let i = Number(e.isHidden) === 1 || n.hidden === !0 || n.hidden === 1 || n.hidden === "1", a = Wi(n.startShowingAt, n.stopShowingAt), o = (e.slug || "").replace(/^\/+|\/+$/g, "");
12780
12745
  return !s && (i || !a) ? null : {
12781
12746
  treeNodeId: e.treeNodeId,
12782
12747
  id: e.id,
12783
12748
  title: e.title,
12784
12749
  slug: o,
12785
12750
  language: e.language || "en",
12786
- path: `${r}/${o}`.replace(/\/+/g, "/"),
12751
+ path: `${t}/${o}`.replace(/\/+/g, "/"),
12787
12752
  nodeType: e.nodeType
12788
12753
  };
12789
12754
  }).filter(Boolean);
12790
12755
  }
12791
- re.children = L;
12792
- let ge = +!!s, R = await t.prepare("\n SELECT *\n FROM content_blocks\n WHERE contentId = ? AND isDraft = ?\n ORDER BY sortOrder ASC\n ").all(_.id, ge), _e = Array.isArray(R) ? R : R?.results || [];
12793
- _e.length === 0 && !s && (R = await t.prepare("\n SELECT *\n FROM content_blocks\n WHERE contentId = ?\n ORDER BY sortOrder ASC\n ").all(_.id), _e = Array.isArray(R) ? R : R?.results || []);
12794
- let z = {}, B = {}, ve = await Promise.all(_e.map(async (e) => {
12756
+ N.children = ye;
12757
+ let be = Array.isArray(se) ? se : se?.results || [];
12758
+ if (be.length === 0 && !s) {
12759
+ let e = await t.prepare("SELECT * FROM content_blocks WHERE contentId = ? ORDER BY sortOrder ASC").all(_.id);
12760
+ be = Array.isArray(e) ? e : e?.results || [];
12761
+ }
12762
+ let R = {}, z = {}, xe = await Promise.all(be.map(async (e) => {
12795
12763
  let r = e.region || "main", i = {};
12796
12764
  try {
12797
12765
  i = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
12798
12766
  } catch {}
12799
- let a = i.hidden === !0 || i.hidden === 1 || i.hidden === "1" || i.hidden === "true", o = Ui(i.startShowingAt, i.stopShowingAt);
12767
+ let a = i.hidden === !0 || i.hidden === 1 || i.hidden === "1" || i.hidden === "true", o = Wi(i.startShowingAt, i.stopShowingAt);
12800
12768
  if (!s && (a || !o)) return null;
12801
- 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 && !String(i.id).startsWith("ast_") ? i.id : null) || e.blockId || e.id), d = Ki(i, l);
12802
- return d = await mi(t, d), d = qi(d), d = await Ji(t, d, n), d.blockId = u, {
12769
+ 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 && !String(i.id).startsWith("ast_") ? i.id : null) || e.blockId || e.id), d = qi(i, l);
12770
+ return d = await mi(t, d), d = Ji(d), d = await Yi(t, d, n), d.blockId = u, {
12803
12771
  region: r,
12804
12772
  block: {
12805
12773
  instanceId: e.id,
@@ -12809,8 +12777,8 @@ zi.get("/*", async (e) => {
12809
12777
  }
12810
12778
  };
12811
12779
  }));
12812
- for (let e of ve) e && (z[e.region] || (z[e.region] = [], B[e.region] = { isInherited: !1 }), z[e.region].push(e.block));
12813
- let ye = {
12780
+ for (let e of xe) e && (R[e.region] || (R[e.region] = [], z[e.region] = { isInherited: !1 }), R[e.region].push(e.block));
12781
+ let Se = {
12814
12782
  header: {
12815
12783
  label: "Header",
12816
12784
  inherit: "parent"
@@ -12819,33 +12787,33 @@ zi.get("/*", async (e) => {
12819
12787
  label: "Footer",
12820
12788
  inherit: "parent"
12821
12789
  },
12822
- ...(F ? h.nodeLayouts?.[F] || h.layouts?.[F] : null)?.regions || { main: { label: "Content" } }
12790
+ ...(ge ? h.nodeLayouts?.[ge] || h.layouts?.[ge] : null)?.regions || { main: { label: "Content" } }
12823
12791
  };
12824
- for (let [e, r] of Object.entries(ye)) {
12825
- let i = z[e] && z[e].length > 0, a = !!oe[e];
12826
- 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) {
12827
- let r = await Gi(t, O, e, h, s, n);
12828
- if (r.blocks.length > 0 && (z[e] = r.blocks, B[e] = {
12792
+ for (let [e, r] of Object.entries(Se)) {
12793
+ let i = R[e] && R[e].length > 0, a = !!le[e];
12794
+ 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) {
12795
+ let r = await Ki(t, O, e, h, s, n);
12796
+ if (r.blocks.length > 0 && (R[e] = r.blocks, z[e] = {
12829
12797
  isInherited: !0,
12830
12798
  inheritedFromId: r.inheritedFromId,
12831
12799
  inheritedFromTitle: r.inheritedFromTitle
12832
- }, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (z[t] = n, B[t] = {
12800
+ }, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (R[t] = n, z[t] = {
12833
12801
  isInherited: !0,
12834
12802
  inheritedFromId: r.inheritedFromId,
12835
12803
  inheritedFromTitle: r.inheritedFromTitle
12836
12804
  });
12837
12805
  }
12838
12806
  }
12839
- await Promise.all(Object.keys(z).map((e) => Wi(t, z[e], u)));
12840
- let be = {
12807
+ await Promise.all(Object.keys(R).map((e) => Gi(t, R[e], u)));
12808
+ let Ce = {
12841
12809
  channelId: u || d,
12842
12810
  treeId: D,
12843
12811
  language: _.language || o || "en",
12844
- node: re,
12845
- content: z,
12846
- regionMeta: B
12812
+ node: N,
12813
+ content: R,
12814
+ regionMeta: z
12847
12815
  };
12848
- return !s && !m && (e.header("X-Cache", "MISS"), await ra(f, p, be, na(e))), e.json(be);
12816
+ return !s && !m ? (e.header("X-Cache", "MISS"), Bi(e, f.set(p, Ce, ra(e)))) : e.header("Cache-Control", "no-store, no-cache, must-revalidate"), e.json(Ce);
12849
12817
  } catch (t) {
12850
12818
  console.error("[CMS Public API] Error fetching node by path:", t);
12851
12819
  let n = e.env?.ENVIRONMENT === "development";
@@ -12859,6 +12827,12 @@ zi.get("/*", async (e) => {
12859
12827
  //#region server/routes/public/tree.ts
12860
12828
  var ia = new n();
12861
12829
  function aa(e, t) {
12830
+ let n = Promise.resolve(t).catch((e) => console.error("[Background Task Error]:", e));
12831
+ try {
12832
+ e.executionCtx && typeof e.executionCtx.waitUntil == "function" && e.executionCtx.waitUntil(n);
12833
+ } catch {}
12834
+ }
12835
+ function oa(e, t) {
12862
12836
  let n = /* @__PURE__ */ new Date();
12863
12837
  if (e && String(e).trim() !== "") {
12864
12838
  let t = new Date(e);
@@ -12870,13 +12844,6 @@ function aa(e, t) {
12870
12844
  }
12871
12845
  return !0;
12872
12846
  }
12873
- async function oa(e, t, n, r) {
12874
- try {
12875
- await e.set(t, n, r);
12876
- } catch (e) {
12877
- console.warn("[CMS Cache] Failed to write tree response to cache:", e);
12878
- }
12879
- }
12880
12847
  ia.get("/:treeParam", async (e) => {
12881
12848
  try {
12882
12849
  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";
@@ -12892,46 +12859,70 @@ ia.get("/:treeParam", async (e) => {
12892
12859
  let t = await a.get(o);
12893
12860
  if (t) return e.header("X-Cache", "HIT"), e.json(t);
12894
12861
  }
12895
- let c = !isNaN(Number(n)), l = c ? await t.prepare("SELECT * FROM trees WHERE id = ?").get(Number(n)) : await t.prepare("SELECT * FROM trees WHERE key = ?").get(n);
12896
- if (l && Number(l.isHidden) === 1 && !i) return e.json({ error: `Tree '${n}' is hidden` }, 404);
12897
- let u = l?.id || (c ? Number(n) : null), d = {};
12898
- if (l && l.dataJson) try {
12899
- let t = typeof l.dataJson == "string" ? JSON.parse(l.dataJson) : l.dataJson, r = e.env?.BUNDLED_DEFINITIONS, i = jr(r), a = (i.trees?.[l.treeType || n] || i.trees?.site || {}).fields || {};
12900
- for (let [e, n] of Object.entries(t)) a[e]?.public === !0 && (d[e] = n);
12862
+ let c = !isNaN(Number(n)), l = c ? Number(n) : n, [u, d] = await Promise.all([t.prepare(`SELECT * FROM trees WHERE ${c ? "id" : "key"} = ?`).get(l), t.prepare(`
12863
+ SELECT
12864
+ t.id as treeNodeId,
12865
+ t.treeId,
12866
+ t.contentId as id,
12867
+ t.parentId,
12868
+ t.sortOrder,
12869
+ c.title,
12870
+ c.slug,
12871
+ c.language,
12872
+ c.contentType as nodeType,
12873
+ c.isHidden,
12874
+ c.status,
12875
+ c.dataJson,
12876
+ c.draftDataJson
12877
+ FROM tree_nodes t
12878
+ INNER JOIN content_nodes c ON t.contentId = c.id
12879
+ WHERE t.treeId = ${c ? "?" : "(SELECT id FROM trees WHERE key = ?)"}
12880
+ AND (c.deletedAt IS NULL OR c.deletedAt = '')
12881
+ ORDER BY t.sortOrder ASC
12882
+ `).all(l)]);
12883
+ if (u && Number(u.isHidden) === 1 && !i) return e.json({ error: `Tree '${n}' is hidden` }, 404);
12884
+ let f = u?.id || (c ? Number(n) : null), p = Array.isArray(d) ? d : d?.results || [];
12885
+ if ((!p || p.length === 0) && !u) return e.json({ error: `Tree '${n}' not found` }, 404);
12886
+ let m = {};
12887
+ if (u && u.dataJson) try {
12888
+ let t = typeof u.dataJson == "string" ? JSON.parse(u.dataJson) : u.dataJson, r = e.env?.BUNDLED_DEFINITIONS, i = jr(r), a = (i.trees?.[u.treeType || n] || i.trees?.site || {}).fields || {};
12889
+ for (let [e, n] of Object.entries(t)) a[e]?.public === !0 && (m[e] = n);
12901
12890
  } catch (e) {
12902
12891
  console.warn("[CMS Public Tree API] Failed to parse tree dataJson", e);
12903
12892
  }
12904
- let f = [];
12905
- if (u !== null) {
12906
- let e = await t.prepare("\n SELECT \n t.id as treeNodeId,\n t.treeId,\n t.contentId as id,\n t.parentId,\n t.sortOrder,\n c.title,\n c.slug,\n c.language,\n c.contentType as nodeType,\n c.isHidden,\n c.status,\n c.dataJson,\n c.draftDataJson\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n WHERE t.treeId = ? AND (c.deletedAt IS NULL OR c.deletedAt = '')\n ORDER BY t.sortOrder ASC\n ").all(u);
12907
- f = Array.isArray(e) ? e : e?.results || [];
12908
- }
12909
- if ((!f || f.length === 0) && !l) return e.json({ error: `Tree '${n}' not found` }, 404);
12910
- let p = /* @__PURE__ */ new Map();
12911
- for (let e of f) {
12912
- let t = !e.parentId || e.parentId === "null" || e.parentId === "" ? null : e.parentId, n = t === null ? "__ROOT__" : String(t), r = p.get(n);
12913
- r ? r.push(e) : p.set(n, [e]);
12893
+ let h = /* @__PURE__ */ new Map();
12894
+ for (let e of p) {
12895
+ let t = !e.parentId || e.parentId === "null" || e.parentId === "" ? null : e.parentId, n = t === null ? "__ROOT__" : String(t), r = h.get(n);
12896
+ r ? r.push(e) : h.set(n, [e]);
12914
12897
  }
12915
- let m = /* @__PURE__ */ new Map();
12916
- for (let e of f) {
12898
+ let g = /* @__PURE__ */ new Map();
12899
+ for (let e of p) {
12917
12900
  let t = String(e.treeNodeId), n = i && e.draftDataJson ? e.draftDataJson : e.dataJson;
12918
12901
  if (!n) {
12919
- m.set(t, {});
12902
+ g.set(t, {});
12920
12903
  continue;
12921
12904
  }
12922
12905
  try {
12923
12906
  let e = typeof n == "string" ? JSON.parse(n) : n;
12924
- m.set(t, e && typeof e == "object" ? e : {});
12907
+ g.set(t, e && typeof e == "object" ? e : {});
12925
12908
  } catch {
12926
- m.set(t, {});
12909
+ g.set(t, {});
12927
12910
  }
12928
12911
  }
12929
- function h(e = null, t = "") {
12912
+ function _(e = null, t = "") {
12930
12913
  let n = e == null || e === "" || e === "null" ? "__ROOT__" : String(e);
12931
- return (p.get(n) || []).map((e) => {
12932
- let n = m.get(String(e.treeNodeId)) || {}, r = {};
12933
- 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);
12934
- 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 = aa(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 = {
12914
+ return (h.get(n) || []).map((e) => {
12915
+ let n = g.get(String(e.treeNodeId)) || {}, r = {};
12916
+ for (let [e, t] of Object.entries(n)) [
12917
+ "_isTreeDraft",
12918
+ "_draftParentId",
12919
+ "isNew",
12920
+ "hidden",
12921
+ "is_hidden",
12922
+ "isHidden",
12923
+ "status"
12924
+ ].includes(e) || (r[e] = t);
12925
+ 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 = oa(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 = {
12935
12926
  id: e.id,
12936
12927
  treeNodeId: e.treeNodeId,
12937
12928
  parentId: e.parentId || null,
@@ -12945,18 +12936,18 @@ ia.get("/:treeParam", async (e) => {
12945
12936
  };
12946
12937
  e.nodeType === "external-link" && (r.url && (u.url = r.url), r.target && (u.target = r.target));
12947
12938
  let d = l === "/" ? "" : l;
12948
- return u.children = h(e.treeNodeId, d), u;
12939
+ return u.children = _(e.treeNodeId, d), u;
12949
12940
  }).filter((e) => i || !e.hidden);
12950
12941
  }
12951
- let g = {
12952
- treeId: l?.id || u,
12953
- key: l?.key || n,
12942
+ let v = {
12943
+ treeId: u?.id || f,
12944
+ key: u?.key || n,
12954
12945
  channelId: r,
12955
- label: l?.label || n,
12956
- ...d,
12957
- items: h(null)
12946
+ label: u?.label || n,
12947
+ ...m,
12948
+ items: _(null)
12958
12949
  };
12959
- return !i && !s && (e.header("X-Cache", "MISS"), await oa(a, o, g, 300)), e.json(g);
12950
+ return !i && !s ? (e.header("X-Cache", "MISS"), aa(e, a.set(o, v, 300))) : e.header("Cache-Control", "no-store, no-cache, must-revalidate"), e.json(v);
12960
12951
  } catch (t) {
12961
12952
  return console.error("[CMS Public Tree API] Error:", t), e.json({
12962
12953
  error: "Failed to fetch public tree",
@@ -12992,63 +12983,37 @@ sa.get("/*", async (e) => {
12992
12983
  }
12993
12984
  let p = e.req.header("Via")?.includes("image-resizing") || e.req.header("User-Agent")?.includes("Cloudflare-ImgRen"), m = new URL(e.req.url), h = e.env?.CDN_DOMAIN || m.hostname;
12994
12985
  if (n) {
12995
- let c = await n.get(t);
12996
- if (!c && t.includes("/")) {
12997
- let e = t.split("/").slice(1).join("/");
12998
- c = await n.get(e);
12999
- }
13000
- if (!c) return e.text(`Asset not found: ${t}`, 404);
13001
- let d = c.httpMetadata?.contentType || ca(t), m = d.startsWith("image/") && !d.includes("svg"), g = !1;
13002
- if (s && m && e.env?.IMAGES) {
13003
- g = !0;
13004
- try {
13005
- let t = r ? parseInt(r, 10) : void 0, n = i ? parseInt(i, 10) : void 0, o = {
13006
- quality: a ? parseInt(a, 10) : 80,
13007
- fit: "cover"
13008
- };
13009
- t && (o.width = t), n && (o.height = n);
13010
- let s = (await e.env.IMAGES.input(c.body).transform(o).output({ format: `image/${l || "webp"}` })).response(), d = new Headers(s.headers);
13011
- d.set("Cache-Control", "public, max-age=31536000, immutable"), d.set("Access-Control-Allow-Origin", "*");
13012
- let p = new Response(s.body, {
13013
- status: 200,
13014
- headers: d
13015
- });
13016
- return u && f && e.executionCtx?.waitUntil && e.executionCtx.waitUntil(u.put(f, p.clone())), p;
13017
- } catch (e) {
13018
- console.warn("[Cloudflare Images Binding] Transformation failed, falling back:", e);
13019
- }
13020
- }
13021
- if (s && h && !p && !e.env?.IMAGES) {
13022
- g = !0;
13023
- let n = r ? parseInt(r, 10) : void 0, s = i ? parseInt(i, 10) : void 0, c = a ? parseInt(a, 10) : 85, l = o || "auto", d = `https://${h}/media/${t}`;
12986
+ let l = ca(t), u = l.startsWith("image/") && !l.includes("svg");
12987
+ if (s && u && h && !p) {
12988
+ let e = r ? parseInt(r, 10) : void 0, n = i ? parseInt(i, 10) : void 0, s = a ? parseInt(a, 10) : 85, l = o || "auto", u = `https://${h}/media/${t}`;
13024
12989
  try {
13025
- let t = await fetch(d, {
13026
- headers: { Accept: e.req.header("Accept") || "image/webp,image/avif,image/*,*/*;q=0.8" },
12990
+ let t = await fetch(u, {
12991
+ headers: { Accept: c || "image/webp,image/avif,image/*,*/*;q=0.8" },
13027
12992
  cf: { image: {
13028
- width: n,
13029
- height: s,
13030
- quality: c,
12993
+ width: e,
12994
+ height: n,
12995
+ quality: s,
13031
12996
  format: l,
13032
12997
  fit: "cover",
13033
12998
  anim: !1
13034
12999
  } }
13035
13000
  });
13036
- if (t.ok) return u && f && e.executionCtx?.waitUntil && e.executionCtx.waitUntil(u.put(f, t.clone())), t;
13037
- console.warn(`[Cloudflare Image] Resizing returned status ${t.status}. Falling back to raw R2 stream.`);
13038
- } catch (e) {
13039
- console.warn("[Cloudflare Image] Resize fetch failed. Falling back to raw R2 stream.", e);
13001
+ if (t.ok) return t;
13002
+ } catch {
13003
+ console.warn("[Cloudflare Image] Resize fetch failed. Falling back to R2 stream.");
13040
13004
  }
13041
13005
  }
13042
- if (g && (c = await n.get(t), !c && t.includes("/"))) {
13006
+ let d = await n.get(t);
13007
+ if (!d && t.includes("/")) {
13043
13008
  let e = t.split("/").slice(1).join("/");
13044
- c = await n.get(e);
13045
- }
13046
- if (c) {
13047
- let t = new Headers();
13048
- c.writeHttpMetadata(t), t.set("etag", c.httpEtag), t.set("Cache-Control", "public, max-age=31536000, immutable"), t.set("Access-Control-Allow-Origin", "*");
13049
- let n = e.body(c.body, 200, Object.fromEntries(t.entries()));
13050
- return u && f && e.executionCtx?.waitUntil && e.executionCtx.waitUntil(u.put(f, n.clone())), n;
13009
+ d = await n.get(e);
13051
13010
  }
13011
+ if (!d) return e.text(`Asset not found: ${t}`, 404);
13012
+ let f = new Headers();
13013
+ return d.writeHttpMetadata(f), f.set("etag", d.httpEtag), f.set("Cache-Control", "public, max-age=31536000, immutable"), f.set("Access-Control-Allow-Origin", "*"), new Response(d.body, {
13014
+ status: 200,
13015
+ headers: f
13016
+ });
13052
13017
  }
13053
13018
  let [{ existsSync: g, readFileSync: _, mkdirSync: v, writeFileSync: y }, { join: b, dirname: x }] = await Promise.all([import(
13054
13019
  /* @vite-ignore */