@brightsideoy/kama 0.1.0-alpha.133 → 0.1.0-alpha.135
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/content/definitions/nodes/article.yaml +2 -13
- package/dist/assets/index-B3BrPZ8f.js +162 -0
- package/dist/assets/{index-qXT1m8zV.css → index-Bv7fPRX7.css} +1 -1
- package/dist/index.html +2 -2
- package/dist/index.js +350 -341
- package/package.json +1 -1
- package/dist/assets/index-B9dNhLCm.js +0 -162
package/dist/index.js
CHANGED
|
@@ -28,12 +28,12 @@ function b(e) {
|
|
|
28
28
|
}
|
|
29
29
|
var x = (e) => (_(e) || y(e)) && !!e.anchor, S = Symbol("break visit"), C = Symbol("skip children"), w = Symbol("remove node");
|
|
30
30
|
function T(e, t) {
|
|
31
|
-
let n =
|
|
31
|
+
let n = k(t);
|
|
32
32
|
m(e) ? E(null, e.contents, n, Object.freeze([e])) === w && (e.contents = null) : E(null, e, n, Object.freeze([]));
|
|
33
33
|
}
|
|
34
34
|
T.BREAK = S, T.SKIP = C, T.REMOVE = w;
|
|
35
35
|
function E(e, t, n, r) {
|
|
36
|
-
let i =
|
|
36
|
+
let i = ee(e, t, n, r);
|
|
37
37
|
if (b(i) || g(i)) return te(e, r, i), E(e, i, n, r);
|
|
38
38
|
if (typeof i != "symbol") {
|
|
39
39
|
if (y(t)) {
|
|
@@ -57,12 +57,12 @@ function E(e, t, n, r) {
|
|
|
57
57
|
return i;
|
|
58
58
|
}
|
|
59
59
|
async function D(e, t) {
|
|
60
|
-
let n =
|
|
60
|
+
let n = k(t);
|
|
61
61
|
m(e) ? await O(null, e.contents, n, Object.freeze([e])) === w && (e.contents = null) : await O(null, e, n, Object.freeze([]));
|
|
62
62
|
}
|
|
63
63
|
D.BREAK = S, D.SKIP = C, D.REMOVE = w;
|
|
64
64
|
async function O(e, t, n, r) {
|
|
65
|
-
let i = await
|
|
65
|
+
let i = await ee(e, t, n, r);
|
|
66
66
|
if (b(i) || g(i)) return te(e, r, i), O(e, i, n, r);
|
|
67
67
|
if (typeof i != "symbol") {
|
|
68
68
|
if (y(t)) {
|
|
@@ -85,7 +85,7 @@ async function O(e, t, n, r) {
|
|
|
85
85
|
}
|
|
86
86
|
return i;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function k(e) {
|
|
89
89
|
return typeof e == "object" && (e.Collection || e.Node || e.Value) ? Object.assign({
|
|
90
90
|
Alias: e.Node,
|
|
91
91
|
Map: e.Node,
|
|
@@ -100,7 +100,7 @@ function ee(e) {
|
|
|
100
100
|
Seq: e.Collection
|
|
101
101
|
}, e) : e;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function ee(e, t, n, r) {
|
|
104
104
|
if (typeof n == "function") return n(e, t, r);
|
|
105
105
|
if (h(t)) return n.Map?.(e, t, r);
|
|
106
106
|
if (v(t)) return n.Seq?.(e, t, r);
|
|
@@ -211,31 +211,31 @@ A.defaultYaml = {
|
|
|
211
211
|
}, A.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region node_modules/yaml/browser/dist/doc/anchors.js
|
|
214
|
-
function
|
|
214
|
+
function ie(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
|
|
221
|
+
function ae(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
|
|
227
|
+
function oe(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
|
|
233
|
+
function se(e, t) {
|
|
234
234
|
let n = [], r = /* @__PURE__ */ new Map(), i = null;
|
|
235
235
|
return {
|
|
236
236
|
onAnchor: (r) => {
|
|
237
|
-
n.push(r), i ??=
|
|
238
|
-
let a =
|
|
237
|
+
n.push(r), i ??= ae(e);
|
|
238
|
+
let a = oe(t, i);
|
|
239
239
|
return i.add(a), a;
|
|
240
240
|
},
|
|
241
241
|
setAnchors: () => {
|
|
@@ -253,22 +253,22 @@ function oe(e, t) {
|
|
|
253
253
|
}
|
|
254
254
|
//#endregion
|
|
255
255
|
//#region node_modules/yaml/browser/dist/doc/applyReviver.js
|
|
256
|
-
function
|
|
256
|
+
function ce(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 =
|
|
259
|
+
let n = r[t], i = ce(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 =
|
|
263
|
+
let n = r.get(t), i = ce(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 =
|
|
267
|
+
let n = ce(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 =
|
|
271
|
+
let i = ce(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 se(e, t, n, r) {
|
|
|
276
276
|
}
|
|
277
277
|
//#endregion
|
|
278
278
|
//#region node_modules/yaml/browser/dist/nodes/toJS.js
|
|
279
|
-
function
|
|
280
|
-
if (Array.isArray(e)) return e.map((e, t) =>
|
|
279
|
+
function j(e, t, n) {
|
|
280
|
+
if (Array.isArray(e)) return e.map((e, t) => j(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 M(e, t, n) {
|
|
|
295
295
|
}
|
|
296
296
|
//#endregion
|
|
297
297
|
//#region node_modules/yaml/browser/dist/nodes/Node.js
|
|
298
|
-
var
|
|
298
|
+
var le = class {
|
|
299
299
|
constructor(e) {
|
|
300
300
|
Object.defineProperty(this, f, { value: e });
|
|
301
301
|
}
|
|
@@ -312,11 +312,11 @@ var ce = class {
|
|
|
312
312
|
mapAsMap: t === !0,
|
|
313
313
|
mapKeyWarned: !1,
|
|
314
314
|
maxAliasCount: typeof n == "number" ? n : 100
|
|
315
|
-
}, o =
|
|
315
|
+
}, o = j(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" ?
|
|
317
|
+
return typeof i == "function" ? ce(i, { "": o }, "", o) : o;
|
|
318
318
|
}
|
|
319
|
-
},
|
|
319
|
+
}, ue = class extends le {
|
|
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 ce = class {
|
|
|
344
344
|
}
|
|
345
345
|
let o = n.get(a);
|
|
346
346
|
/* istanbul ignore if */
|
|
347
|
-
if (o ||= (
|
|
348
|
-
if (i >= 0 && (o.count += 1, o.aliasCount === 0 && (o.aliasCount =
|
|
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 = M(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 (
|
|
354
|
+
if (ie(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 ce = class {
|
|
|
360
360
|
return r;
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
|
-
function
|
|
363
|
+
function M(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 le(e, t, n) {
|
|
|
368
368
|
if (y(t)) {
|
|
369
369
|
let r = 0;
|
|
370
370
|
for (let i of t.items) {
|
|
371
|
-
let t =
|
|
371
|
+
let t = M(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 =
|
|
377
|
+
let r = M(e, t.key, n), i = M(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
|
|
384
|
+
var de = (e) => !e || typeof e != "function" && typeof e != "object", N = class extends le {
|
|
385
385
|
constructor(e) {
|
|
386
386
|
super(u), this.value = e;
|
|
387
387
|
}
|
|
388
388
|
toJSON(e, t) {
|
|
389
|
-
return t?.keep ? this.value :
|
|
389
|
+
return t?.keep ? this.value : j(this.value, e, t);
|
|
390
390
|
}
|
|
391
391
|
toString() {
|
|
392
392
|
return String(this.value);
|
|
393
393
|
}
|
|
394
394
|
};
|
|
395
|
-
|
|
395
|
+
N.BLOCK_FOLDED = "BLOCK_FOLDED", N.BLOCK_LITERAL = "BLOCK_LITERAL", N.PLAIN = "PLAIN", N.QUOTE_DOUBLE = "QUOTE_DOUBLE", N.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
396
396
|
//#endregion
|
|
397
397
|
//#region node_modules/yaml/browser/dist/doc/createNode.js
|
|
398
|
-
var
|
|
399
|
-
function
|
|
398
|
+
var fe = "tag:yaml.org,2002:";
|
|
399
|
+
function pe(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 fe(e, t, n) {
|
|
|
404
404
|
}
|
|
405
405
|
return n.find((t) => t.identify?.(e) && !t.format);
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function P(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,23 +413,23 @@ function pe(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
|
|
416
|
+
if (l = s.get(e), l) return l.anchor ?? (l.anchor = i(e)), new ue(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 =
|
|
423
|
-
let u =
|
|
422
|
+
t?.startsWith("!!") && (t = fe + t.slice(2));
|
|
423
|
+
let u = pe(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
|
|
426
|
+
let t = new N(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
|
|
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);
|
|
433
433
|
return t ? f.tag = t : u.default || (f.tag = u.tag), l && (l.node = f), f;
|
|
434
434
|
}
|
|
435
435
|
//#endregion
|
|
@@ -443,7 +443,7 @@ function me(e, t, n) {
|
|
|
443
443
|
e[n] = r, r = e;
|
|
444
444
|
} else r = /* @__PURE__ */ new Map([[n, r]]);
|
|
445
445
|
}
|
|
446
|
-
return
|
|
446
|
+
return P(r, void 0, {
|
|
447
447
|
aliasDuplicateObjects: !1,
|
|
448
448
|
keepUndefined: !1,
|
|
449
449
|
onAnchor: () => {
|
|
@@ -453,7 +453,7 @@ function me(e, t, n) {
|
|
|
453
453
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
454
454
|
});
|
|
455
455
|
}
|
|
456
|
-
var he = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next().done,
|
|
456
|
+
var he = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next().done, ge = class extends le {
|
|
457
457
|
constructor(e, t) {
|
|
458
458
|
super(e), Object.defineProperty(this, "schema", {
|
|
459
459
|
value: t,
|
|
@@ -509,12 +509,12 @@ var he = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next
|
|
|
509
509
|
else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`);
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
|
-
},
|
|
513
|
-
function
|
|
512
|
+
}, _e = (e) => e.replace(/^(?!$)(?: $)?/gm, "#");
|
|
513
|
+
function F(e, t) {
|
|
514
514
|
return /^\n+$/.test(e) ? e.substring(1) : t ? e.replace(/^(?! *$)/gm, t) : e;
|
|
515
515
|
}
|
|
516
|
-
var
|
|
517
|
-
function
|
|
516
|
+
var ve = (e, t, n) => e.endsWith("\n") ? F(n, t) : n.includes("\n") ? "\n" + F(n, t) : (e.endsWith(" ") ? "" : " ") + n, ye = "flow", be = "block", xe = "quoted";
|
|
517
|
+
function I(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 xe(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
|
|
|
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 =
|
|
525
|
+
n === "block" && (h = Se(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 xe(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
|
|
|
539
539
|
}
|
|
540
540
|
_ = h;
|
|
541
541
|
}
|
|
542
|
-
if (r === "\n") n === "block" && (h =
|
|
542
|
+
if (r === "\n") n === "block" && (h = Se(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 xe(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
|
|
|
566
566
|
}
|
|
567
567
|
return v;
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function Se(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 L(e, t, n) {
|
|
|
579
579
|
}
|
|
580
580
|
//#endregion
|
|
581
581
|
//#region node_modules/yaml/browser/dist/stringify/stringifyString.js
|
|
582
|
-
var
|
|
582
|
+
var Ce = (e, t) => ({
|
|
583
583
|
indentAtStart: t ? e.indent.length : e.indentAtStart,
|
|
584
584
|
lineWidth: e.options.lineWidth,
|
|
585
585
|
minContentWidth: e.options.minContentWidth
|
|
586
|
-
}),
|
|
587
|
-
function
|
|
586
|
+
}), L = (e) => /^(%|---|\.\.\.)/m.test(e);
|
|
587
|
+
function R(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;
|
|
@@ -597,7 +597,7 @@ function Ce(e, t, n) {
|
|
|
597
597
|
function we(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 || (
|
|
600
|
+
let { implicitKey: r } = t, i = t.options.doubleQuotedMinMultiLineLength, a = t.indent || (L(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,12 +642,12 @@ function we(e, t) {
|
|
|
642
642
|
break;
|
|
643
643
|
default: e += 1;
|
|
644
644
|
}
|
|
645
|
-
return o = s ? o + n.slice(s) : n, r ? o :
|
|
645
|
+
return o = s ? o + n.slice(s) : n, r ? o : I(o, a, xe, Ce(t, !1));
|
|
646
646
|
}
|
|
647
647
|
function Te(e, t) {
|
|
648
648
|
if (t.options.singleQuote === !1 || t.implicitKey && e.includes("\n") || /[ \t]\n|\n[ \t]/.test(e)) return we(e, t);
|
|
649
|
-
let n = t.indent || (
|
|
650
|
-
return t.implicitKey ? r :
|
|
649
|
+
let n = t.indent || (L(e) ? " " : ""), r = "'" + e.replace(/'/g, "''").replace(/\n+/g, `$&\n${n}`) + "'";
|
|
650
|
+
return t.implicitKey ? r : I(r, n, ye, Ce(t, !1));
|
|
651
651
|
}
|
|
652
652
|
function Ee(e, t) {
|
|
653
653
|
let { singleQuote: n } = t.options, r;
|
|
@@ -667,7 +667,7 @@ try {
|
|
|
667
667
|
function Oe({ comment: e, type: t, value: n }, r, i, a) {
|
|
668
668
|
let { blockQuote: o, commentString: s, lineWidth: c } = r.options;
|
|
669
669
|
if (!o || /\n[\t ]+$/.test(n)) return Ee(n, r);
|
|
670
|
-
let l = r.indent || (r.forceBlockIndent ||
|
|
670
|
+
let l = r.indent || (r.forceBlockIndent || L(n) ? " " : ""), u = o === "literal" ? !0 : o === "folded" || t === N.BLOCK_FOLDED ? !1 : t === N.BLOCK_LITERAL || !R(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) {
|
|
@@ -687,11 +687,11 @@ function Oe({ 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 =
|
|
691
|
-
o !== "folded" && t !==
|
|
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 = Ce(r, !0);
|
|
691
|
+
o !== "folded" && t !== N.BLOCK_FOLDED && (a.onOverflow = () => {
|
|
692
692
|
i = !0;
|
|
693
693
|
});
|
|
694
|
-
let s =
|
|
694
|
+
let s = I(`${v}${e}${p}`, l, be, 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}`;
|
|
@@ -700,8 +700,8 @@ function ke(e, t, n, r) {
|
|
|
700
700
|
let { type: i, value: a } = e, { actualString: o, implicitKey: s, indent: c, indentStep: l, inFlow: u } = t;
|
|
701
701
|
if (s && a.includes("\n") || u && /[[\]{},]/.test(a)) return Ee(a, t);
|
|
702
702
|
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a)) return s || u || !a.includes("\n") ? Ee(a, t) : Oe(e, t, n, r);
|
|
703
|
-
if (!s && !u && i !==
|
|
704
|
-
if (
|
|
703
|
+
if (!s && !u && i !== N.PLAIN && a.includes("\n")) return Oe(e, t, n, r);
|
|
704
|
+
if (L(a)) {
|
|
705
705
|
if (c === "") return t.forceBlockIndent = !0, Oe(e, t, n, r);
|
|
706
706
|
if (s && c === l) return Ee(a, t);
|
|
707
707
|
}
|
|
@@ -710,18 +710,18 @@ function ke(e, t, n, r) {
|
|
|
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
711
|
if (r.some(e) || n?.some(e)) return Ee(a, t);
|
|
712
712
|
}
|
|
713
|
-
return s ? d :
|
|
713
|
+
return s ? d : I(d, c, ye, Ce(t, !1));
|
|
714
714
|
}
|
|
715
715
|
function Ae(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 !==
|
|
717
|
+
s !== N.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (s = N.QUOTE_DOUBLE);
|
|
718
718
|
let c = (e) => {
|
|
719
719
|
switch (e) {
|
|
720
|
-
case
|
|
721
|
-
case
|
|
722
|
-
case
|
|
723
|
-
case
|
|
724
|
-
case
|
|
720
|
+
case N.BLOCK_FOLDED:
|
|
721
|
+
case N.BLOCK_LITERAL: return i || a ? Ee(o.value, t) : Oe(o, t, n, r);
|
|
722
|
+
case N.QUOTE_DOUBLE: return we(o.value, t);
|
|
723
|
+
case N.QUOTE_SINGLE: return Te(o.value, t);
|
|
724
|
+
case N.PLAIN: return ke(o, t, n, r);
|
|
725
725
|
default: return null;
|
|
726
726
|
}
|
|
727
727
|
}, l = c(s);
|
|
@@ -736,7 +736,7 @@ function Ae(e, t, n, r) {
|
|
|
736
736
|
function je(e, t) {
|
|
737
737
|
let n = Object.assign({
|
|
738
738
|
blockQuote: !0,
|
|
739
|
-
commentString:
|
|
739
|
+
commentString: _e,
|
|
740
740
|
defaultKeyType: null,
|
|
741
741
|
defaultStringType: "PLAIN",
|
|
742
742
|
directives: null,
|
|
@@ -797,7 +797,7 @@ function Me(e, t) {
|
|
|
797
797
|
function Ne(e, t, { anchors: n, doc: r }) {
|
|
798
798
|
if (!r.directives) return "";
|
|
799
799
|
let i = [], a = (_(e) || y(e)) && e.anchor;
|
|
800
|
-
a &&
|
|
800
|
+
a && ie(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
|
}
|
|
@@ -823,7 +823,7 @@ function Fe({ key: e, value: t }, n, r, i) {
|
|
|
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 ===
|
|
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"));
|
|
827
827
|
n = Object.assign({}, n, {
|
|
828
828
|
allNullValues: !1,
|
|
829
829
|
implicitKey: !p && (d || !a),
|
|
@@ -836,15 +836,15 @@ function Fe({ key: e, value: t }, n, r, i) {
|
|
|
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 +=
|
|
840
|
-
m && (f = null), p ? (f && (g +=
|
|
839
|
+
} else if (a && !d || t == null && p) return g = `? ${g}`, f && !m ? g += ve(g, n.indent, l(f)) : h && i && i(), g;
|
|
840
|
+
m && (f = null), p ? (f && (g += ve(g, n.indent, l(f))), g = `? ${g}\n${s}:`) : (g = `${g}:`, f && (g += ve(g, n.indent, l(f))));
|
|
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
843
|
let w = !1, T = Pe(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${
|
|
847
|
+
E += `\n${F(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,7 +858,7 @@ function Fe({ 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 +=
|
|
861
|
+
return g += E + T, n.inFlow ? w && r && r() : C && !w ? g += ve(g, n.indent, l(C)) : h && i && i(), g;
|
|
862
862
|
}
|
|
863
863
|
//#endregion
|
|
864
864
|
//#region node_modules/yaml/browser/dist/log.js
|
|
@@ -872,9 +872,9 @@ var Le = "<<", Re = {
|
|
|
872
872
|
default: "key",
|
|
873
873
|
tag: "tag:yaml.org,2002:merge",
|
|
874
874
|
test: /^<<$/,
|
|
875
|
-
resolve: () => Object.assign(new
|
|
875
|
+
resolve: () => Object.assign(new N(Symbol(Le)), { addToJSMap: Be }),
|
|
876
876
|
stringify: () => Le
|
|
877
|
-
}, ze = (e, t) => (Re.identify(t) || _(t) && (!t.type || t.type ===
|
|
877
|
+
}, ze = (e, t) => (Re.identify(t) || _(t) && (!t.type || t.type === N.PLAIN) && Re.identify(t.value)) && e?.doc.schema.tags.some((e) => e.tag === Re.tag && e.default);
|
|
878
878
|
function Be(e, t, n) {
|
|
879
879
|
let r = He(e, n);
|
|
880
880
|
if (v(r)) for (let n of r.items) Ve(e, t, n);
|
|
@@ -902,11 +902,11 @@ function Ue(e, t, { key: n, value: r }) {
|
|
|
902
902
|
if (b(n) && n.addToJSMap) n.addToJSMap(e, t, r);
|
|
903
903
|
else if (ze(e, n)) Be(e, t, r);
|
|
904
904
|
else {
|
|
905
|
-
let i =
|
|
906
|
-
if (t instanceof Map) t.set(i,
|
|
905
|
+
let i = j(n, "", e);
|
|
906
|
+
if (t instanceof Map) t.set(i, j(r, i, e));
|
|
907
907
|
else if (t instanceof Set) t.add(i);
|
|
908
908
|
else {
|
|
909
|
-
let a = We(n, i, e), o =
|
|
909
|
+
let a = We(n, i, e), o = j(r, a, e);
|
|
910
910
|
a in t ? Object.defineProperty(t, a, {
|
|
911
911
|
value: o,
|
|
912
912
|
writable: !0,
|
|
@@ -937,7 +937,7 @@ function We(e, t, n) {
|
|
|
937
937
|
//#endregion
|
|
938
938
|
//#region node_modules/yaml/browser/dist/nodes/Pair.js
|
|
939
939
|
function Ge(e, t, n) {
|
|
940
|
-
return new z(
|
|
940
|
+
return new z(P(e, void 0, n), P(t, void 0, n));
|
|
941
941
|
}
|
|
942
942
|
var z = class e {
|
|
943
943
|
constructor(e, t = null) {
|
|
@@ -973,7 +973,7 @@ function qe({ comment: e, items: t }, n, { blockItemPrefix: r, flowChars: i, ite
|
|
|
973
973
|
}
|
|
974
974
|
d = !1;
|
|
975
975
|
let s = Pe(i, u, () => o = null, () => d = !0);
|
|
976
|
-
o && (s +=
|
|
976
|
+
o && (s += ve(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 qe({ 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" +
|
|
987
|
+
return e ? (p += "\n" + F(l(e), c), s && s()) : d && o && o(), p;
|
|
988
988
|
}
|
|
989
989
|
function Je({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
990
990
|
let { indent: i, indentStep: a, flowCollectionPadding: o, options: { commentString: s } } = t;
|
|
@@ -1005,7 +1005,7 @@ function Je({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
a && (l = !0);
|
|
1007
1007
|
let o = Pe(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 +=
|
|
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 += ve(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 Je({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
|
1022
1022
|
}
|
|
1023
1023
|
function Ye({ indent: e, options: { commentString: t } }, n, r, i) {
|
|
1024
1024
|
if (r && i && (r = r.replace(/^\n+/, "")), r) {
|
|
1025
|
-
let i =
|
|
1025
|
+
let i = F(t(r), e);
|
|
1026
1026
|
n.push(i.trimStart());
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
@@ -1032,7 +1032,7 @@ function Xe(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 B = class extends
|
|
1035
|
+
var B = class extends ge {
|
|
1036
1036
|
static get tagName() {
|
|
1037
1037
|
return "tag:yaml.org,2002:map";
|
|
1038
1038
|
}
|
|
@@ -1055,7 +1055,7 @@ var B = class extends F {
|
|
|
1055
1055
|
let r = Xe(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) &&
|
|
1058
|
+
_(r.value) && de(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 B = class extends F {
|
|
|
1104
1104
|
return h(e) || t("Expected a mapping for this tag"), e;
|
|
1105
1105
|
},
|
|
1106
1106
|
createNode: (e, t, n) => B.from(e, t, n)
|
|
1107
|
-
}, Qe = class extends
|
|
1107
|
+
}, Qe = class extends ge {
|
|
1108
1108
|
static get tagName() {
|
|
1109
1109
|
return "tag:yaml.org,2002:seq";
|
|
1110
1110
|
}
|
|
@@ -1132,13 +1132,13 @@ var B = class extends F {
|
|
|
1132
1132
|
let n = $e(e);
|
|
1133
1133
|
if (typeof n != "number") throw Error(`Expected a valid index, not ${e}.`);
|
|
1134
1134
|
let r = this.items[n];
|
|
1135
|
-
_(r) &&
|
|
1135
|
+
_(r) && de(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(
|
|
1141
|
+
for (let e of this.items) n.push(j(e, String(r++), t));
|
|
1142
1142
|
return n;
|
|
1143
1143
|
}
|
|
1144
1144
|
toString(e, t, n) {
|
|
@@ -1162,7 +1162,7 @@ var B = class extends F {
|
|
|
1162
1162
|
let n = t instanceof Set ? a : String(e++);
|
|
1163
1163
|
a = r.call(t, n, a);
|
|
1164
1164
|
}
|
|
1165
|
-
i.items.push(
|
|
1165
|
+
i.items.push(P(a, void 0, n));
|
|
1166
1166
|
}
|
|
1167
1167
|
}
|
|
1168
1168
|
return i;
|
|
@@ -1193,18 +1193,18 @@ var et = {
|
|
|
1193
1193
|
}
|
|
1194
1194
|
}, nt = {
|
|
1195
1195
|
identify: (e) => e == null,
|
|
1196
|
-
createNode: () => new
|
|
1196
|
+
createNode: () => new N(null),
|
|
1197
1197
|
default: !0,
|
|
1198
1198
|
tag: "tag:yaml.org,2002:null",
|
|
1199
1199
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
1200
|
-
resolve: () => new
|
|
1200
|
+
resolve: () => new N(null),
|
|
1201
1201
|
stringify: ({ source: e }, t) => typeof e == "string" && nt.test.test(e) ? e : t.options.nullStr
|
|
1202
1202
|
}, rt = {
|
|
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
|
|
1207
|
+
resolve: (e) => new N(e[0] === "t" || e[0] === "T"),
|
|
1208
1208
|
stringify({ source: e, value: t }, n) {
|
|
1209
1209
|
return e && rt.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 it = {
|
|
|
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
|
|
1253
|
+
let t = new N(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: V
|
|
@@ -1310,7 +1310,7 @@ var ht = ({ value: e }) => JSON.stringify(e), gt = [
|
|
|
1310
1310
|
},
|
|
1311
1311
|
{
|
|
1312
1312
|
identify: (e) => e == null,
|
|
1313
|
-
createNode: () => new
|
|
1313
|
+
createNode: () => new N(null),
|
|
1314
1314
|
default: !0,
|
|
1315
1315
|
tag: "tag:yaml.org,2002:null",
|
|
1316
1316
|
test: /^null$/,
|
|
@@ -1368,10 +1368,10 @@ var ht = ({ value: e }) => JSON.stringify(e), gt = [
|
|
|
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 ??=
|
|
1371
|
+
if (t ??= N.BLOCK_LITERAL, t !== N.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 ===
|
|
1374
|
+
s = i.join(t === N.BLOCK_LITERAL ? "\n" : " ");
|
|
1375
1375
|
}
|
|
1376
1376
|
return Ae({
|
|
1377
1377
|
comment: e,
|
|
@@ -1388,7 +1388,7 @@ function yt(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 z(new
|
|
1391
|
+
let e = r.items[0] || new z(new N(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 xt = {
|
|
|
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 =
|
|
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");
|
|
1440
1440
|
n.set(r, i);
|
|
1441
1441
|
}
|
|
1442
1442
|
return n;
|
|
@@ -1470,14 +1470,14 @@ var Tt = {
|
|
|
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
|
|
1473
|
+
resolve: () => new N(!0),
|
|
1474
1474
|
stringify: wt
|
|
1475
1475
|
}, Et = {
|
|
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
|
|
1480
|
+
resolve: () => new N(!1),
|
|
1481
1481
|
stringify: wt
|
|
1482
1482
|
}, Dt = {
|
|
1483
1483
|
identify: (e) => typeof e == "number",
|
|
@@ -1503,7 +1503,7 @@ var Tt = {
|
|
|
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
|
|
1506
|
+
let t = new N(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);
|
|
@@ -1768,28 +1768,28 @@ function Zt(e, t) {
|
|
|
1768
1768
|
if (e.commentBefore) {
|
|
1769
1769
|
n.length !== 1 && n.unshift("");
|
|
1770
1770
|
let t = a(e.commentBefore);
|
|
1771
|
-
n.unshift(
|
|
1771
|
+
n.unshift(F(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(
|
|
1778
|
+
n.push(F(t, ""));
|
|
1779
1779
|
}
|
|
1780
1780
|
i.forceBlockIndent = !!e.comment, s = e.contents.comment;
|
|
1781
1781
|
}
|
|
1782
1782
|
let t = s ? void 0 : () => o = !0, c = Pe(e.contents, i, () => s = null, t);
|
|
1783
|
-
s && (c +=
|
|
1783
|
+
s && (c += ve(c, "", a(s))), (c[0] === "|" || c[0] === ">") && n[n.length - 1] === "---" ? n[n.length - 1] = `--- ${c}` : n.push(c);
|
|
1784
1784
|
} else n.push(Pe(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(
|
|
1788
|
+
t.includes("\n") ? (n.push("..."), n.push(F(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(
|
|
1792
|
+
t && o && (t = t.replace(/^\n+/, "")), t && ((!o || s) && n[n.length - 1] !== "" && n.push(""), n.push(F(a(t), "")));
|
|
1793
1793
|
}
|
|
1794
1794
|
return n.join("\n") + "\n";
|
|
1795
1795
|
}
|
|
@@ -1826,10 +1826,10 @@ var Qt = class e {
|
|
|
1826
1826
|
}
|
|
1827
1827
|
createAlias(e, t) {
|
|
1828
1828
|
if (!e.anchor) {
|
|
1829
|
-
let n =
|
|
1830
|
-
e.anchor = !t || n.has(t) ?
|
|
1829
|
+
let n = ae(this);
|
|
1830
|
+
e.anchor = !t || n.has(t) ? oe(t || "a", n) : t;
|
|
1831
1831
|
}
|
|
1832
|
-
return new
|
|
1832
|
+
return new ue(e.anchor);
|
|
1833
1833
|
}
|
|
1834
1834
|
createNode(e, t, n) {
|
|
1835
1835
|
let r;
|
|
@@ -1838,7 +1838,7 @@ var Qt = 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 } =
|
|
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 = {
|
|
1842
1842
|
aliasDuplicateObjects: i ?? !0,
|
|
1843
1843
|
keepUndefined: s ?? !1,
|
|
1844
1844
|
onAnchor: u,
|
|
@@ -1846,7 +1846,7 @@ var Qt = class e {
|
|
|
1846
1846
|
replacer: r,
|
|
1847
1847
|
schema: this.schema,
|
|
1848
1848
|
sourceObjects: f
|
|
1849
|
-
}, m =
|
|
1849
|
+
}, m = P(e, l, p);
|
|
1850
1850
|
return o && y(m) && (m.flow = !0), d(), m;
|
|
1851
1851
|
}
|
|
1852
1852
|
createPair(e, t, n = {}) {
|
|
@@ -1913,9 +1913,9 @@ var Qt = class e {
|
|
|
1913
1913
|
mapAsMap: n === !0,
|
|
1914
1914
|
mapKeyWarned: !1,
|
|
1915
1915
|
maxAliasCount: typeof r == "number" ? r : 100
|
|
1916
|
-
}, s =
|
|
1916
|
+
}, s = j(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" ?
|
|
1918
|
+
return typeof a == "function" ? ce(a, { "": s }, "", s) : s;
|
|
1919
1919
|
}
|
|
1920
1920
|
toJSON(e, t) {
|
|
1921
1921
|
return this.toJS({
|
|
@@ -2304,7 +2304,7 @@ function _n(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), gn(e, t, n, i, o);
|
|
2306
2306
|
}
|
|
2307
|
-
let l = gn(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
|
|
2307
|
+
let l = gn(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);
|
|
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 vn(e, t, n) {
|
|
|
2321
2321
|
r
|
|
2322
2322
|
]
|
|
2323
2323
|
};
|
|
2324
|
-
let a = i.mode === ">" ?
|
|
2324
|
+
let a = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = t.source ? bn(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 vn(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 ===
|
|
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);
|
|
2366
2366
|
}
|
|
2367
2367
|
switch (i.chomp) {
|
|
2368
2368
|
case "-": break;
|
|
@@ -2438,13 +2438,13 @@ function xn(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 =
|
|
2441
|
+
s = N.PLAIN, c = Sn(a, l);
|
|
2442
2442
|
break;
|
|
2443
2443
|
case "single-quoted-scalar":
|
|
2444
|
-
s =
|
|
2444
|
+
s = N.QUOTE_SINGLE, c = Cn(a, l);
|
|
2445
2445
|
break;
|
|
2446
2446
|
case "double-quoted-scalar":
|
|
2447
|
-
s =
|
|
2447
|
+
s = N.QUOTE_DOUBLE, c = Tn(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 kn(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
|
|
2586
|
+
d = _(a) ? a : new N(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
|
|
2589
|
+
r(n ?? t, "TAG_RESOLVE_FAILED", a), d = new N(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 Fn(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 In({ options: e }, { offset: t, source: n, end: r }, i) {
|
|
2676
|
-
let a = new
|
|
2676
|
+
let a = new ue(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 = fn(r, o, e.strict, i);
|
|
2679
2679
|
return a.range = [
|
|
@@ -4253,7 +4253,7 @@ function Tr(e, t, n) {
|
|
|
4253
4253
|
//#endregion
|
|
4254
4254
|
//#region node_modules/yaml/browser/index.js
|
|
4255
4255
|
var Er = /* @__PURE__ */ a({
|
|
4256
|
-
Alias: () =>
|
|
4256
|
+
Alias: () => ue,
|
|
4257
4257
|
CST: () => tr,
|
|
4258
4258
|
Composer: () => Bn,
|
|
4259
4259
|
Document: () => Qt,
|
|
@@ -4261,7 +4261,7 @@ var Er = /* @__PURE__ */ a({
|
|
|
4261
4261
|
LineCounter: () => fr,
|
|
4262
4262
|
Pair: () => z,
|
|
4263
4263
|
Parser: () => br,
|
|
4264
|
-
Scalar: () =>
|
|
4264
|
+
Scalar: () => N,
|
|
4265
4265
|
Schema: () => Xt,
|
|
4266
4266
|
YAMLError: () => en,
|
|
4267
4267
|
YAMLMap: () => B,
|
|
@@ -4720,19 +4720,19 @@ function Lr(e) {
|
|
|
4720
4720
|
O[e] = W(O[e] || {}, t);
|
|
4721
4721
|
});
|
|
4722
4722
|
});
|
|
4723
|
-
let
|
|
4723
|
+
let k = m ? {
|
|
4724
4724
|
...m,
|
|
4725
4725
|
fields: O
|
|
4726
|
-
} : null,
|
|
4726
|
+
} : null, ee = h?.fields || {};
|
|
4727
4727
|
Array.isArray(h?.fieldSets) && h?.fieldSets.forEach((e) => {
|
|
4728
4728
|
let t = _[e] || {}, n = t.fields || t, r = v(n);
|
|
4729
4729
|
Object.entries(r).forEach(([e, t]) => {
|
|
4730
|
-
|
|
4730
|
+
ee[e] = W(ee[e] || {}, t);
|
|
4731
4731
|
});
|
|
4732
4732
|
});
|
|
4733
4733
|
let te = h ? {
|
|
4734
4734
|
...h,
|
|
4735
|
-
fields:
|
|
4735
|
+
fields: ee
|
|
4736
4736
|
} : null;
|
|
4737
4737
|
return {
|
|
4738
4738
|
nodes: b,
|
|
@@ -4744,7 +4744,7 @@ function Lr(e) {
|
|
|
4744
4744
|
fieldSets: _,
|
|
4745
4745
|
nodeTemplate: f || null,
|
|
4746
4746
|
treeTemplate: p || null,
|
|
4747
|
-
channelTemplate:
|
|
4747
|
+
channelTemplate: k,
|
|
4748
4748
|
userTemplate: te
|
|
4749
4749
|
};
|
|
4750
4750
|
}
|
|
@@ -6458,7 +6458,7 @@ function Ci(e, t = null) {
|
|
|
6458
6458
|
return n;
|
|
6459
6459
|
}
|
|
6460
6460
|
function wi(e) {
|
|
6461
|
-
if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
|
|
6461
|
+
if (e == null || e === "null" || e === "" || e === 0 || e === "0" || typeof e == "string" && e.startsWith("draft-")) return null;
|
|
6462
6462
|
let t = Number(e);
|
|
6463
6463
|
return isNaN(t) ? null : t;
|
|
6464
6464
|
}
|
|
@@ -6549,31 +6549,27 @@ xi.get("/tree.json", async (e) => {
|
|
|
6549
6549
|
if (a === "create") {
|
|
6550
6550
|
let r = f.slug || n.slug || o, a = r ? String(r).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") : null;
|
|
6551
6551
|
if (a) {
|
|
6552
|
-
let r =
|
|
6553
|
-
SELECT 1
|
|
6554
|
-
FROM tree_nodes tn
|
|
6555
|
-
INNER JOIN content_nodes cn ON tn.contentId = cn.id
|
|
6556
|
-
WHERE tn.treeId = ?
|
|
6557
|
-
AND ${r}
|
|
6558
|
-
AND cn.slug = ?
|
|
6559
|
-
AND (cn.deletedAt IS NULL OR cn.deletedAt = '')
|
|
6560
|
-
`, c = m === null ? [i, a] : [
|
|
6552
|
+
let r = "", o = [];
|
|
6553
|
+
m === null ? (r = "\n SELECT 1 \n FROM tree_nodes tn\n INNER JOIN content_nodes cn ON tn.contentId = cn.id\n WHERE tn.treeId = ? \n AND tn.parentId IS NULL\n AND cn.slug = ?\n AND (cn.deletedAt IS NULL OR cn.deletedAt = '')\n ", o = [i, a]) : (r = "\n SELECT 1 \n FROM tree_nodes tn\n INNER JOIN content_nodes cn ON tn.contentId = cn.id\n WHERE tn.treeId = ? \n AND tn.parentId = ?\n AND cn.slug = ?\n AND (cn.deletedAt IS NULL OR cn.deletedAt = '')\n ", o = [
|
|
6561
6554
|
i,
|
|
6562
6555
|
m,
|
|
6563
6556
|
a
|
|
6564
|
-
];
|
|
6565
|
-
|
|
6557
|
+
]);
|
|
6558
|
+
let s = n.contentId || n.id ? Number(n.contentId || n.id) : null;
|
|
6559
|
+
if (s && !isNaN(s) && (r += " AND cn.id != ?", o.push(s)), r += " LIMIT 1", (await X(t, r, o)).length > 0) return e.json({
|
|
6566
6560
|
error: `The slug '${a}' is already in use by another page in this section.`,
|
|
6567
6561
|
field: "slug"
|
|
6568
6562
|
}, 409);
|
|
6569
6563
|
}
|
|
6570
6564
|
let c = JSON.stringify(f), l = await t.prepare("\n INSERT INTO content_nodes (contentType, title, slug, language, isHidden, status, draftDataJson, dataJson, createdById, updatedById)\n VALUES (?, ?, ?, ?, ?, 'draft', ?, NULL, ?, ?)\n ").run(s || "page", o || "Untitled", a, f.language || n.language || "en", p, c, h, h), u = Number(l.lastInsertRowid);
|
|
6571
6565
|
await Z(t, "DELETE FROM tree_nodes WHERE treeId = ? AND contentId = ?", [i, u]);
|
|
6572
|
-
let d =
|
|
6573
|
-
|
|
6574
|
-
let
|
|
6575
|
-
|
|
6576
|
-
|
|
6566
|
+
let d = [];
|
|
6567
|
+
d = m === null ? await X(t, "SELECT COALESCE(MAX(sortOrder), -1) + 1 as nextSort FROM tree_nodes WHERE treeId = ? AND parentId IS NULL", [i]) : await X(t, "SELECT COALESCE(MAX(sortOrder), -1) + 1 as nextSort FROM tree_nodes WHERE treeId = ? AND parentId = ?", [i, m]);
|
|
6568
|
+
let g = d[0]?.nextSort ?? 0, _ = await t.prepare("\n INSERT INTO tree_nodes (treeId, contentId, parentId, sortOrder)\n VALUES (?, ?, ?, ?)\n ").run(i, u, m, g), v = Number(_.lastInsertRowid), y = [];
|
|
6569
|
+
n.channels && Array.isArray(n.channels) ? y = n.channels : n.channelId && n.channelId !== "all" && (y = [n.channelId]);
|
|
6570
|
+
let b = [...new Set(y)].filter((e) => e && e !== "all").map((e) => Number(e));
|
|
6571
|
+
if (b.length > 0) {
|
|
6572
|
+
let e = b.map(() => "(?, ?)").join(", "), n = b.flatMap((e) => [u, e]);
|
|
6577
6573
|
await Z(t, `INSERT OR IGNORE INTO node_channels (nodeId, channelId) VALUES ${e}`, n);
|
|
6578
6574
|
}
|
|
6579
6575
|
return Si(e, async () => {
|
|
@@ -6581,7 +6577,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
6581
6577
|
}), e.json({
|
|
6582
6578
|
success: !0,
|
|
6583
6579
|
id: u,
|
|
6584
|
-
treeNodeId:
|
|
6580
|
+
treeNodeId: v,
|
|
6585
6581
|
status: "draft"
|
|
6586
6582
|
}, 201);
|
|
6587
6583
|
}
|
|
@@ -6589,27 +6585,17 @@ xi.get("/tree.json", async (e) => {
|
|
|
6589
6585
|
if (!l) return e.json({ error: "contentId is required for attach" }, 400);
|
|
6590
6586
|
let n = (await X(t, "SELECT slug FROM content_nodes WHERE id = ?", [l]))[0];
|
|
6591
6587
|
if (n && n.slug) {
|
|
6592
|
-
let r =
|
|
6588
|
+
let r = "", a = [];
|
|
6589
|
+
if (m === null ? (r = "\n SELECT 1 \n FROM tree_nodes tn\n INNER JOIN content_nodes cn ON tn.contentId = cn.id\n WHERE tn.treeId = ? \n AND tn.parentId IS NULL\n AND cn.slug = ?\n AND cn.id != ?\n AND (cn.deletedAt IS NULL OR cn.deletedAt = '')\n LIMIT 1\n ", a = [
|
|
6593
6590
|
i,
|
|
6594
6591
|
n.slug,
|
|
6595
6592
|
l
|
|
6596
|
-
] : [
|
|
6593
|
+
]) : (r = "\n SELECT 1 \n FROM tree_nodes tn\n INNER JOIN content_nodes cn ON tn.contentId = cn.id\n WHERE tn.treeId = ? \n AND tn.parentId = ?\n AND cn.slug = ?\n AND cn.id != ?\n AND (cn.deletedAt IS NULL OR cn.deletedAt = '')\n LIMIT 1\n ", a = [
|
|
6597
6594
|
i,
|
|
6598
6595
|
m,
|
|
6599
6596
|
n.slug,
|
|
6600
6597
|
l
|
|
6601
|
-
]
|
|
6602
|
-
if ((await X(t, `
|
|
6603
|
-
SELECT 1
|
|
6604
|
-
FROM tree_nodes tn
|
|
6605
|
-
INNER JOIN content_nodes cn ON tn.contentId = cn.id
|
|
6606
|
-
WHERE tn.treeId = ?
|
|
6607
|
-
AND ${r}
|
|
6608
|
-
AND cn.slug = ?
|
|
6609
|
-
AND cn.id != ?
|
|
6610
|
-
AND (cn.deletedAt IS NULL OR cn.deletedAt = '')
|
|
6611
|
-
LIMIT 1
|
|
6612
|
-
`, a)).length > 0) return e.json({
|
|
6598
|
+
]), (await X(t, r, a)).length > 0) return e.json({
|
|
6613
6599
|
error: `Cannot attach. The slug '${n.slug}' is already in use by another page in this section.`,
|
|
6614
6600
|
field: "slug"
|
|
6615
6601
|
}, 409);
|
|
@@ -6826,9 +6812,9 @@ Ei.get("/", async (e) => {
|
|
|
6826
6812
|
O = Number(e.lastInsertRowid);
|
|
6827
6813
|
}
|
|
6828
6814
|
await t.prepare("DELETE FROM channel_trees WHERE channelId = ?").run(O);
|
|
6829
|
-
let
|
|
6830
|
-
if (
|
|
6831
|
-
let n =
|
|
6815
|
+
let k = (Array.isArray(f) ? f : []).filter((e) => e && (e.treeId !== void 0 || e.id !== void 0) && e.key);
|
|
6816
|
+
if (k.length > 0) for (let e = 0; e < k.length; e += 20) {
|
|
6817
|
+
let n = k.slice(e, e + 20), r = n.map(() => "(?, ?, ?, ?)").join(", "), i = n.flatMap((e) => {
|
|
6832
6818
|
let t = e.treeId === void 0 ? e.id : e.treeId;
|
|
6833
6819
|
return [
|
|
6834
6820
|
O,
|
|
@@ -7035,17 +7021,8 @@ var Di = {
|
|
|
7035
7021
|
inTree: !1,
|
|
7036
7022
|
hasCanvas: !0,
|
|
7037
7023
|
directLinking: !0,
|
|
7038
|
-
|
|
7039
|
-
allowedBlocks:
|
|
7040
|
-
"header",
|
|
7041
|
-
"hero",
|
|
7042
|
-
"text",
|
|
7043
|
-
"image_card",
|
|
7044
|
-
"header_image",
|
|
7045
|
-
"two-column",
|
|
7046
|
-
"three-column",
|
|
7047
|
-
"single_image"
|
|
7048
|
-
],
|
|
7024
|
+
defaultLayout: "content",
|
|
7025
|
+
allowedBlocks: "*",
|
|
7049
7026
|
tabs: {
|
|
7050
7027
|
settings: {
|
|
7051
7028
|
label: "Article",
|
|
@@ -12243,8 +12220,8 @@ async function Ji(e, t, n) {
|
|
|
12243
12220
|
let l = "ORDER BY updatedAt DESC";
|
|
12244
12221
|
o === "published_desc" || o === "createdAt" ? l = "ORDER BY createdAt DESC" : o === "title_asc" && (l = "ORDER BY LOWER(title) ASC");
|
|
12245
12222
|
try {
|
|
12246
|
-
let n = await e.prepare(`SELECT id, title, slug, language, dataJson, createdAt, updatedAt ${s} ${l} LIMIT ?`).all(...c, a)
|
|
12247
|
-
t.data.initialItems =
|
|
12223
|
+
let n = await Promise.resolve(e.prepare(`SELECT id, title, slug, language, dataJson, createdAt, updatedAt ${s} ${l} LIMIT ?`).all(...c, a));
|
|
12224
|
+
t.data.initialItems = (n || []).map((e) => {
|
|
12248
12225
|
let t = {};
|
|
12249
12226
|
if (e.dataJson) try {
|
|
12250
12227
|
t = typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson;
|
|
@@ -12267,66 +12244,78 @@ async function Ji(e, t, n) {
|
|
|
12267
12244
|
}));
|
|
12268
12245
|
}
|
|
12269
12246
|
async function Yi(e, t, n, r, i = !1, a) {
|
|
12270
|
-
if (!t) return { blocks: [] };
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12296
|
-
|
|
12247
|
+
if (!t || t === "0" || t === 0 || t === "null") return { blocks: [] };
|
|
12248
|
+
try {
|
|
12249
|
+
let o = await Promise.resolve(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 WHERE ap.parentId IS NOT NULL AND ap.parentId != 0 AND ap.parentId != '0' AND ap.parentId != 'null' AND ap.level < 20\n ) SELECT * FROM ancestor_path ORDER BY level ASC\n ").all(t, t));
|
|
12250
|
+
if (!o || o.length === 0) return { blocks: [] };
|
|
12251
|
+
let s = o.map((e) => e.contentId).filter((e) => e != null);
|
|
12252
|
+
if (s.length === 0) return { blocks: [] };
|
|
12253
|
+
let c = s.map(() => "?").join(","), l = +!!i, u = await Promise.resolve(e.prepare(`SELECT * FROM content_blocks WHERE contentId IN (${c}) AND isDraft = ? ORDER BY contentId ASC, sortOrder ASC`).all(...s, l)), d = [];
|
|
12254
|
+
i || (d = await Promise.resolve(e.prepare(`SELECT * FROM content_blocks WHERE contentId IN (${c}) ORDER BY contentId ASC, sortOrder ASC`).all(...s)));
|
|
12255
|
+
let f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
12256
|
+
for (let e of u) {
|
|
12257
|
+
let t = String(e.contentId);
|
|
12258
|
+
f.has(t) || f.set(t, []), f.get(t).push(e);
|
|
12259
|
+
}
|
|
12260
|
+
for (let e of d) {
|
|
12261
|
+
let t = String(e.contentId);
|
|
12262
|
+
p.has(t) || p.set(t, []), p.get(t).push(e);
|
|
12263
|
+
}
|
|
12264
|
+
for (let t of o) {
|
|
12265
|
+
let o = f.get(String(t.contentId)) || [];
|
|
12266
|
+
if (o.length === 0 && !i && (o = p.get(String(t.contentId)) || []), o.filter((e) => e.region === n).length === 0) continue;
|
|
12267
|
+
let s = /* @__PURE__ */ new Set([n]), c = !0;
|
|
12268
|
+
for (; c;) {
|
|
12269
|
+
c = !1;
|
|
12270
|
+
for (let e of o) {
|
|
12271
|
+
if (!s.has(e.region)) continue;
|
|
12272
|
+
let t = {};
|
|
12273
|
+
try {
|
|
12274
|
+
t = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
|
|
12275
|
+
} catch {}
|
|
12276
|
+
let n = String(e.id), r = String(t.blockId || t._instanceId || t.id || e.blockId);
|
|
12277
|
+
for (let e of o) !e.region || s.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))) && (s.add(e.region), c = !0);
|
|
12278
|
+
}
|
|
12279
|
+
}
|
|
12280
|
+
let l = o.filter((e) => s.has(e.region)), u = [];
|
|
12281
|
+
for (let e of l) {
|
|
12297
12282
|
let t = {};
|
|
12298
12283
|
try {
|
|
12299
12284
|
t = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
|
|
12300
12285
|
} catch {}
|
|
12301
|
-
let n =
|
|
12302
|
-
|
|
12286
|
+
let n = t.hidden === !0 || t.hidden === 1 || t.hidden === "1" || t.hidden === "true", a = qi(t.startShowingAt, t.stopShowingAt);
|
|
12287
|
+
if (!i && (n || !a)) continue;
|
|
12288
|
+
let o = e.elementType || e.componentId || "text-block", s = r.blocks?.[o]?.fields || r.elements?.[o]?.fields || r.components?.[o]?.fields || {}, c = String(t.blockId || t._instanceId || (t.id && !String(t.id).startsWith("ast_") ? t.id : null) || e.blockId || e.id), l = Xi(t, s);
|
|
12289
|
+
u.push({
|
|
12290
|
+
original: e,
|
|
12291
|
+
data: l,
|
|
12292
|
+
compId: o,
|
|
12293
|
+
resolvedBlockId: c
|
|
12294
|
+
});
|
|
12303
12295
|
}
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
let
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12296
|
+
let d = u.map((e) => e.data);
|
|
12297
|
+
d.length > 0 && (d = await Xr(e, d), d = Zi(d), a && (d = await Qi(e, d, a)));
|
|
12298
|
+
let m = {};
|
|
12299
|
+
for (let e = 0; e < u.length; e++) {
|
|
12300
|
+
let t = u[e], r = d[e];
|
|
12301
|
+
r.blockId = t.resolvedBlockId;
|
|
12302
|
+
let i = t.original.region || n;
|
|
12303
|
+
m[i] || (m[i] = []), m[i].push({
|
|
12304
|
+
instanceId: t.original.id,
|
|
12305
|
+
blockId: t.resolvedBlockId,
|
|
12306
|
+
componentId: t.compId,
|
|
12307
|
+
data: r
|
|
12308
|
+
});
|
|
12309
|
+
}
|
|
12310
|
+
if (m[n] && m[n].length > 0) return {
|
|
12311
|
+
blocks: m[n],
|
|
12312
|
+
subRegions: m,
|
|
12313
|
+
inheritedFromId: String(t.contentId),
|
|
12314
|
+
inheritedFromTitle: t.title || t.slug
|
|
12321
12315
|
};
|
|
12322
|
-
}
|
|
12323
|
-
|
|
12324
|
-
|
|
12325
|
-
blocks: l[n],
|
|
12326
|
-
subRegions: l,
|
|
12327
|
-
inheritedFromId: String(t.contentId),
|
|
12328
|
-
inheritedFromTitle: t.title || t.slug
|
|
12329
|
-
};
|
|
12316
|
+
}
|
|
12317
|
+
} catch (e) {
|
|
12318
|
+
console.error("[CMS Public API] resolveParentBlocks error:", e);
|
|
12330
12319
|
}
|
|
12331
12320
|
return { blocks: [] };
|
|
12332
12321
|
}
|
|
@@ -12375,9 +12364,9 @@ async function Qi(e, t, n) {
|
|
|
12375
12364
|
for (let e of t.matchAll(/(?:#node:|data-node-id\s*=\s*["'])([^"'\s>]+)/gi)) i.add(e[1]);
|
|
12376
12365
|
for (let e of t.matchAll(/(?:#asset:|data-asset-id\s*=\s*["'])([^"'\s>]+)/gi)) a.add(e[1]);
|
|
12377
12366
|
if (i.size === 0 && a.size === 0) return t;
|
|
12378
|
-
let o = i.size > 0 ?
|
|
12367
|
+
let o = i.size > 0 ? await Promise.resolve(e.prepare(`SELECT id, slug FROM content_nodes WHERE id IN (${Array.from(i).map(() => "?").join(",")})`).all(...Array.from(i))) : [], s = /* @__PURE__ */ new Map();
|
|
12379
12368
|
for (let e of o) s.set(String(e.id), String(e.slug || "").replace(/^\/+|\/+$/g, ""));
|
|
12380
|
-
let c = a.size > 0 ?
|
|
12369
|
+
let c = a.size > 0 ? await Promise.resolve(e.prepare(`SELECT id, cdnUrl, storageKeyPrivate FROM assets WHERE id IN (${Array.from(a).map(() => "?").join(",")})`).all(...Array.from(a))) : [], l = /* @__PURE__ */ new Map();
|
|
12381
12370
|
for (let e of c) l.set(String(e.id), e.cdnUrl || (e.storageKeyPrivate ? `/media/${e.storageKeyPrivate}` : ""));
|
|
12382
12371
|
let u = /* @__PURE__ */ new Map(), d = /<a\s+([^>]+)>/gi;
|
|
12383
12372
|
return await Promise.all(Array.from(t.matchAll(d)).map(async (t) => {
|
|
@@ -12436,14 +12425,14 @@ async function $i(e, t, n) {
|
|
|
12436
12425
|
async function ea(e, t, n, r) {
|
|
12437
12426
|
let i = Gi(t, n);
|
|
12438
12427
|
if (r.treeEdges.has(i)) return r.treeEdges.get(i);
|
|
12439
|
-
let a = e.prepare("SELECT id as treeNodeId FROM tree_nodes WHERE contentId = ? AND treeId = ? LIMIT 1").get(t, n);
|
|
12440
|
-
return r.treeEdges.set(i,
|
|
12428
|
+
let a = Promise.resolve(e.prepare("SELECT id as treeNodeId FROM tree_nodes WHERE contentId = ? AND treeId = ? LIMIT 1").get(t, n));
|
|
12429
|
+
return r.treeEdges.set(i, a), a;
|
|
12441
12430
|
}
|
|
12442
12431
|
async function ta(e, t, n) {
|
|
12443
12432
|
let r = String(t);
|
|
12444
12433
|
if (n.nodeSlugs.has(r)) return n.nodeSlugs.get(r);
|
|
12445
12434
|
let i = (async () => {
|
|
12446
|
-
let n = await e.prepare("SELECT slug FROM content_nodes WHERE id = ?").get(t);
|
|
12435
|
+
let n = await Promise.resolve(e.prepare("SELECT slug FROM content_nodes WHERE id = ?").get(t));
|
|
12447
12436
|
return n?.slug ? String(n.slug).replace(/^\/+|\/+$/g, "") : void 0;
|
|
12448
12437
|
})();
|
|
12449
12438
|
return n.nodeSlugs.set(r, i), i;
|
|
@@ -12452,7 +12441,7 @@ async function na(e, t, n) {
|
|
|
12452
12441
|
let r = String(t);
|
|
12453
12442
|
if (n.assetUrls.has(r)) return n.assetUrls.get(r);
|
|
12454
12443
|
let i = (async () => {
|
|
12455
|
-
let n = await e.prepare("SELECT cdnUrl, storageKeyPrivate FROM assets WHERE id = ?").get(t);
|
|
12444
|
+
let n = await Promise.resolve(e.prepare("SELECT cdnUrl, storageKeyPrivate FROM assets WHERE id = ?").get(t));
|
|
12456
12445
|
return n?.cdnUrl || (n?.storageKeyPrivate ? `/media/${n.storageKeyPrivate}` : "#");
|
|
12457
12446
|
})();
|
|
12458
12447
|
return n.assetUrls.set(r, i), i;
|
|
@@ -12489,23 +12478,29 @@ function ra(e) {
|
|
|
12489
12478
|
};
|
|
12490
12479
|
}
|
|
12491
12480
|
async function ia(e, t, n, r) {
|
|
12492
|
-
if (!t) return "";
|
|
12481
|
+
if (!t || t === "0" || t === "null") return "/home";
|
|
12493
12482
|
let i = Gi(t, n);
|
|
12494
12483
|
if (r && r.fullPath.has(i)) return r.fullPath.get(i);
|
|
12495
12484
|
let a = (async () => {
|
|
12496
|
-
|
|
12497
|
-
|
|
12498
|
-
|
|
12499
|
-
|
|
12485
|
+
try {
|
|
12486
|
+
let r = await Promise.resolve(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 AND ap.parentId IS NOT NULL \n AND ap.parentId != 0 \n AND ap.parentId != '0'\n AND ap.parentId != 'null' \n AND ap.level < 20\n ) SELECT slug FROM ancestor_path ORDER BY level DESC\n ").all(t, n, n));
|
|
12487
|
+
if (!r || r.length === 0) return "/home";
|
|
12488
|
+
let i = [];
|
|
12489
|
+
for (let e of r) {
|
|
12490
|
+
let t = (e.slug || "").replace(/^\/+|\/+$/g, "");
|
|
12491
|
+
t && i.push(t);
|
|
12492
|
+
}
|
|
12493
|
+
return "/" + i.join("/");
|
|
12494
|
+
} catch (e) {
|
|
12495
|
+
return console.error("[CMS Public API] resolveNodeFullPath error:", e), "/home";
|
|
12500
12496
|
}
|
|
12501
|
-
return "/" + a.join("/");
|
|
12502
12497
|
})();
|
|
12503
12498
|
return r && r.fullPath.set(i, a), a;
|
|
12504
12499
|
}
|
|
12505
12500
|
async function aa(e, t, n, r, i) {
|
|
12506
12501
|
let a = {}, o = null;
|
|
12507
|
-
if (t) {
|
|
12508
|
-
let n = await e.prepare("\n
|
|
12502
|
+
if (t && t !== "0" && t !== 0 && t !== "null") try {
|
|
12503
|
+
let n = await Promise.resolve(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 WHERE ap.parentId IS NOT NULL AND ap.parentId != 0 AND ap.parentId != '0' AND ap.parentId != 'null' AND ap.level < 20\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 = /* @__PURE__ */ new Set([
|
|
12509
12504
|
"subpageLayoutId",
|
|
12510
12505
|
"layoutId",
|
|
12511
12506
|
"slug",
|
|
@@ -12519,22 +12514,24 @@ async function aa(e, t, n, r, i) {
|
|
|
12519
12514
|
"hidden",
|
|
12520
12515
|
"status"
|
|
12521
12516
|
]);
|
|
12522
|
-
for (let e of
|
|
12517
|
+
for (let e of n) {
|
|
12523
12518
|
let t = r && e.draftDataJson ? e.draftDataJson : e.dataJson || e.draftDataJson;
|
|
12524
12519
|
if (t) try {
|
|
12525
12520
|
let e = typeof t == "string" ? JSON.parse(t) : t;
|
|
12526
12521
|
!o && e.subpageLayoutId && e.subpageLayoutId !== "inherit" && (o = e.subpageLayoutId);
|
|
12527
|
-
for (let [t, n] of Object.entries(e)) n != null && n !== "" && n !== "inherit" && !
|
|
12522
|
+
for (let [t, n] of Object.entries(e)) n != null && n !== "" && n !== "inherit" && !i.has(t) && !t.startsWith("_") && a[t] === void 0 && (a[t] = n);
|
|
12528
12523
|
} catch {}
|
|
12529
12524
|
}
|
|
12525
|
+
} catch (e) {
|
|
12526
|
+
console.error("[CMS Public API] resolveInheritedNodeData error:", e);
|
|
12530
12527
|
}
|
|
12531
|
-
if (!o) {
|
|
12532
|
-
let t = await e.prepare("SELECT dataJson FROM trees WHERE id = ?").get(n);
|
|
12528
|
+
if (!o) try {
|
|
12529
|
+
let t = await Promise.resolve(e.prepare("SELECT dataJson FROM trees WHERE id = ?").get(n));
|
|
12533
12530
|
if (t?.dataJson) try {
|
|
12534
12531
|
let e = typeof t.dataJson == "string" ? JSON.parse(t.dataJson) : t.dataJson;
|
|
12535
12532
|
e.subpageLayoutId && e.subpageLayoutId !== "inherit" && (o = e.subpageLayoutId);
|
|
12536
12533
|
} catch {}
|
|
12537
|
-
}
|
|
12534
|
+
} catch {}
|
|
12538
12535
|
return {
|
|
12539
12536
|
resolvedLayoutId: o,
|
|
12540
12537
|
inheritedFields: a
|
|
@@ -12546,7 +12543,7 @@ function oa(e) {
|
|
|
12546
12543
|
}
|
|
12547
12544
|
Hi.get("/*", async (e) => {
|
|
12548
12545
|
try {
|
|
12549
|
-
let t = e.get("db"), n = Wi(), 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));
|
|
12546
|
+
let t = e.get("db"), n = Wi(), 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 Promise.resolve(t.prepare("SELECT * FROM channels WHERE key = ?").get(a)) : await Promise.resolve(t.prepare("SELECT * FROM channels WHERE id = ?").get(Number(a)));
|
|
12550
12547
|
if (!c) return e.json({ error: `Channel '${a}' not found` }, 404);
|
|
12551
12548
|
let l = c.status === "disabled" || c.status === "inactive" || c.isEnabled === 0 || c.isEnabled === !1;
|
|
12552
12549
|
if (!s && l) return e.json({ error: `Channel '${c.key || a}' is currently inactive` }, 404);
|
|
@@ -12561,108 +12558,120 @@ Hi.get("/*", async (e) => {
|
|
|
12561
12558
|
INNER JOIN tree_nodes tn ON cn.id = tn.contentId
|
|
12562
12559
|
${u === null ? "" : "INNER JOIN node_channels nc ON cn.id = nc.nodeId"}
|
|
12563
12560
|
WHERE cn.slug = ? ${u === null ? "" : "AND nc.channelId = ?"}
|
|
12564
|
-
`, w = u === null ? [x] : [x, u], T = await t.prepare(C).all(...w)
|
|
12565
|
-
if (
|
|
12566
|
-
let e = await Promise.all(
|
|
12561
|
+
`, w = u === null ? [x] : [x, u], T = await Promise.resolve(t.prepare(C).all(...w));
|
|
12562
|
+
if (T.length > 0) {
|
|
12563
|
+
let e = await Promise.all(T.map(async (e) => ({
|
|
12567
12564
|
candidate: e,
|
|
12568
12565
|
calculatedPath: await ia(t, String(e.treeNodeId), String(e.treeId), n)
|
|
12569
12566
|
}))), r = S.replace(/^\/+|\/+$/g, "");
|
|
12570
12567
|
for (let { candidate: t, calculatedPath: n } of e) {
|
|
12571
12568
|
let e = n.replace(/^\/+|\/+$/g, "");
|
|
12572
|
-
if (e === r || r === "home" && (e === "" || e === "
|
|
12569
|
+
if (e === r || (r === "home" || r === "") && (e === "home" || e === "" || e === "/")) {
|
|
12573
12570
|
_ = t, v = t;
|
|
12574
12571
|
break;
|
|
12575
12572
|
}
|
|
12576
12573
|
}
|
|
12577
12574
|
}
|
|
12578
|
-
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);
|
|
12575
|
+
if (!_ && b.length === 1 && (_ = u === null ? await Promise.resolve(t.prepare("SELECT * FROM content_nodes WHERE slug = ?").get(x)) : await Promise.resolve(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 Promise.resolve(t.prepare("SELECT * FROM content_nodes WHERE id = ?").get(Number(i))) : await Promise.resolve(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);
|
|
12579
12576
|
if (!v) {
|
|
12580
|
-
let e = y ? [_.id, y] : [_.id];
|
|
12581
|
-
v = await t.prepare(
|
|
12577
|
+
let e = `SELECT id as treeNodeId, treeId, parentId FROM tree_nodes WHERE contentId = ? ${y ? "AND treeId = ?" : ""} LIMIT 1`, n = y ? [_.id, y] : [_.id];
|
|
12578
|
+
v = await Promise.resolve(t.prepare(e).get(...n));
|
|
12582
12579
|
}
|
|
12583
|
-
let
|
|
12584
|
-
if (
|
|
12585
|
-
k = typeof
|
|
12580
|
+
let E = v?.treeId || y || "main-nav", D = v?.parentId || null, O = v?.treeNodeId ? await ia(t, String(v.treeNodeId), String(E), n) : `/${(_.slug || "").replace(/^\/+|\/+$/g, "")}`, k = {}, ee = s && _.draftDataJson ? _.draftDataJson : _.dataJson || _.draftDataJson;
|
|
12581
|
+
if (ee) try {
|
|
12582
|
+
k = typeof ee == "string" ? JSON.parse(ee) : ee;
|
|
12586
12583
|
} catch {}
|
|
12587
|
-
let
|
|
12588
|
-
|
|
12589
|
-
Object.assign(
|
|
12584
|
+
let te = k.nodeType || k.contentType || _.contentType || "page", ne = _.contentType || "node", re = h.nodes?.[ne] || Object.values(h.nodes || {})[0] || {}, A = { ...re.fields || {} };
|
|
12585
|
+
re.tabs && Object.values(re.tabs).forEach((e) => {
|
|
12586
|
+
Object.assign(A, e.fields || {});
|
|
12590
12587
|
});
|
|
12591
|
-
let ie = +!!s,
|
|
12592
|
-
|
|
12593
|
-
|
|
12594
|
-
|
|
12595
|
-
|
|
12588
|
+
let ie = +!!s, ae = s ? "COALESCE(c.draftDataJson, c.dataJson, '{}')" : "COALESCE(c.dataJson, c.draftDataJson, '{}')", oe = `
|
|
12589
|
+
SELECT t.id as treeNodeId, t.contentId as id, c.title, c.slug, c.language, c.contentType as nodeType, c.isHidden,
|
|
12590
|
+
json_extract(${ae}, '$.hidden') as extHidden,
|
|
12591
|
+
json_extract(${ae}, '$.startShowingAt') as extStart,
|
|
12592
|
+
json_extract(${ae}, '$.stopShowingAt') as extStop
|
|
12593
|
+
FROM tree_nodes t
|
|
12594
|
+
INNER JOIN content_nodes c ON t.contentId = c.id
|
|
12595
|
+
WHERE t.parentId = ? AND t.treeId = ?
|
|
12596
|
+
ORDER BY t.sortOrder ASC
|
|
12597
|
+
`, [se, ce, j] = await Promise.all([
|
|
12598
|
+
aa(t, D, E, s, A),
|
|
12599
|
+
v?.treeNodeId ? Promise.resolve(t.prepare(oe).all(v.treeNodeId, E)) : Promise.resolve([]),
|
|
12600
|
+
Promise.resolve(t.prepare("SELECT * FROM content_blocks WHERE contentId = ? AND isDraft = ? ORDER BY sortOrder ASC").all(_.id, ie))
|
|
12601
|
+
]), { resolvedLayoutId: le, inheritedFields: ue } = se, M = {
|
|
12596
12602
|
id: _.id,
|
|
12597
12603
|
title: _.title,
|
|
12598
12604
|
slug: _.slug,
|
|
12599
|
-
path:
|
|
12600
|
-
nodeType:
|
|
12605
|
+
path: O === "" ? "/" : O,
|
|
12606
|
+
nodeType: te,
|
|
12601
12607
|
createdAt: Ki(_.createdAt),
|
|
12602
12608
|
updatedAt: Ki(_.updatedAt),
|
|
12603
12609
|
publishedAt: Ki(k.publishedAt || _.createdAt)
|
|
12604
|
-
},
|
|
12605
|
-
|
|
12606
|
-
let
|
|
12607
|
-
if (
|
|
12608
|
-
else if (!
|
|
12610
|
+
}, de = k.disabledRegions || {}, N = k.hidden === !0 || k.hidden === 1 || k.hidden === "1" || k.hidden === "true", fe = k.startShowingAt || null, pe = k.stopShowingAt || null, P = Xi(k, A), me = P.layoutId || null, he = me && me !== "inherit", ge = !1, _e = null;
|
|
12611
|
+
A.layoutId && (ge = !0, A.layoutId.options && Array.isArray(A.layoutId.options) && (_e = A.layoutId.options.map((e) => typeof e == "object" ? e.value || e.id : e)));
|
|
12612
|
+
let F = null;
|
|
12613
|
+
if (ge && _e && _e.length === 1 && _e[0] !== "inherit") F = _e[0];
|
|
12614
|
+
else if (!ge && re.defaultLayout) F = re.defaultLayout;
|
|
12609
12615
|
else {
|
|
12610
|
-
let e =
|
|
12611
|
-
|
|
12612
|
-
}
|
|
12613
|
-
for (let [e, t] of Object.entries(
|
|
12614
|
-
let
|
|
12615
|
-
I = Zi(I), I = await Qi(t, I, n);
|
|
12616
|
-
let _e = ra(I);
|
|
12617
|
-
delete I.socialImage, delete I.fbImage, delete I.xImage, delete I.whatsappImage, _e && (I.socialImages = _e), 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);
|
|
12618
|
-
let ve = Number(_.isHidden) === 1 || ue, ye = !qi(P, de);
|
|
12616
|
+
let e = he ? me : le;
|
|
12617
|
+
F = e && e !== "inherit" && (!_e || _e.includes(e) || _e.includes("inherit")) ? e : re.defaultLayout || null;
|
|
12618
|
+
}
|
|
12619
|
+
for (let [e, t] of Object.entries(ue)) A[e] && (P[e] === void 0 || P[e] === null || P[e] === "" || P[e] === "inherit") && t !== void 0 && (P[e] = t);
|
|
12620
|
+
let ve = Number(_.isHidden) === 1 || N, ye = !qi(fe, pe);
|
|
12619
12621
|
if (!s && (ve || ye)) return e.json({ error: "Node is hidden or outside its scheduled publishing window" }, 404);
|
|
12620
12622
|
let be = [];
|
|
12621
12623
|
if (v?.treeNodeId) {
|
|
12622
|
-
let e =
|
|
12623
|
-
be =
|
|
12624
|
-
let n =
|
|
12625
|
-
|
|
12626
|
-
|
|
12627
|
-
|
|
12628
|
-
|
|
12629
|
-
|
|
12630
|
-
|
|
12631
|
-
|
|
12632
|
-
|
|
12633
|
-
slug: o,
|
|
12634
|
-
language: e.language || "en",
|
|
12635
|
-
path: `${t}/${o}`.replace(/\/+/g, "/"),
|
|
12636
|
-
nodeType: e.nodeType
|
|
12624
|
+
let e = M.path === "/" ? "" : M.path;
|
|
12625
|
+
be = (ce || []).map((t) => {
|
|
12626
|
+
let n = Number(t.isHidden) === 1 || t.extHidden === 1 || t.extHidden === "1" || t.extHidden === "true" || t.extHidden === !0, r = qi(t.extStart, t.extStop), i = (t.slug || "").replace(/^\/+|\/+$/g, "");
|
|
12627
|
+
return !s && (n || !r) ? null : {
|
|
12628
|
+
treeNodeId: t.treeNodeId,
|
|
12629
|
+
id: t.id,
|
|
12630
|
+
title: t.title,
|
|
12631
|
+
slug: i,
|
|
12632
|
+
language: t.language || "en",
|
|
12633
|
+
path: `${e}/${i}`.replace(/\/+/g, "/"),
|
|
12634
|
+
nodeType: t.nodeType
|
|
12637
12635
|
};
|
|
12638
12636
|
}).filter(Boolean);
|
|
12639
12637
|
}
|
|
12640
|
-
|
|
12641
|
-
let xe =
|
|
12642
|
-
|
|
12643
|
-
|
|
12644
|
-
|
|
12645
|
-
|
|
12646
|
-
let L = {}, R = {}, Se = await Promise.all(xe.map(async (e) => {
|
|
12647
|
-
let r = e.region || "main", i = {};
|
|
12638
|
+
M.children = be;
|
|
12639
|
+
let xe = j || [];
|
|
12640
|
+
xe.length === 0 && !s && (xe = await Promise.resolve(t.prepare("SELECT * FROM content_blocks WHERE contentId = ? ORDER BY sortOrder ASC").all(_.id)));
|
|
12641
|
+
let I = {}, Se = {}, Ce = [];
|
|
12642
|
+
for (let e of xe) {
|
|
12643
|
+
let t = e.region || "main", n = {};
|
|
12648
12644
|
try {
|
|
12649
|
-
|
|
12645
|
+
n = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
|
|
12650
12646
|
} catch {}
|
|
12651
|
-
let
|
|
12652
|
-
if (!s && (
|
|
12653
|
-
let
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12657
|
-
|
|
12658
|
-
|
|
12659
|
-
|
|
12660
|
-
|
|
12661
|
-
|
|
12662
|
-
|
|
12663
|
-
|
|
12664
|
-
|
|
12665
|
-
|
|
12647
|
+
let r = n.hidden === !0 || n.hidden === 1 || n.hidden === "1" || n.hidden === "true", i = qi(n.startShowingAt, n.stopShowingAt);
|
|
12648
|
+
if (!s && (r || !i)) continue;
|
|
12649
|
+
let a = e.elementType || e.componentId || "text-block", o = h.blocks?.[a]?.fields || h.elements?.[a]?.fields || h.components?.[a]?.fields || {}, c = String(n.blockId || n._instanceId || (n.id && !String(n.id).startsWith("ast_") ? n.id : null) || e.blockId || e.id), l = Xi(n, o);
|
|
12650
|
+
Ce.push({
|
|
12651
|
+
original: e,
|
|
12652
|
+
region: t,
|
|
12653
|
+
data: l,
|
|
12654
|
+
compId: a,
|
|
12655
|
+
resolvedBlockId: c
|
|
12656
|
+
});
|
|
12657
|
+
}
|
|
12658
|
+
let L = await Xr(t, {
|
|
12659
|
+
node: P,
|
|
12660
|
+
blocks: Ce.map((e) => e.data)
|
|
12661
|
+
});
|
|
12662
|
+
L = Zi(L), L = await Qi(t, L, n);
|
|
12663
|
+
let R = L.node, we = ra(R);
|
|
12664
|
+
delete R.socialImage, delete R.fbImage, delete R.xImage, delete R.whatsappImage, we && (R.socialImages = we), delete R.id, delete R.title, delete R.slug, delete R.language, delete R.contentType, delete R.nodeType, delete R.createdAt, delete R.updatedAt, delete R.publishedAt, delete R.channelId, delete R.treeId, delete R.path, R.iconName === "" && (R.iconName = null), Object.assign(M, R), re.hasCanvas && (M.layoutId = F);
|
|
12665
|
+
for (let e = 0; e < Ce.length; e++) {
|
|
12666
|
+
let t = Ce[e], n = L.blocks[e];
|
|
12667
|
+
n.blockId = t.resolvedBlockId, I[t.region] || (I[t.region] = [], Se[t.region] = { isInherited: !1 }), I[t.region].push({
|
|
12668
|
+
instanceId: t.original.id,
|
|
12669
|
+
blockId: t.resolvedBlockId,
|
|
12670
|
+
componentId: t.compId,
|
|
12671
|
+
data: n
|
|
12672
|
+
});
|
|
12673
|
+
}
|
|
12674
|
+
let Te = {
|
|
12666
12675
|
header: {
|
|
12667
12676
|
label: "Header",
|
|
12668
12677
|
inherit: "parent"
|
|
@@ -12671,33 +12680,33 @@ Hi.get("/*", async (e) => {
|
|
|
12671
12680
|
label: "Footer",
|
|
12672
12681
|
inherit: "parent"
|
|
12673
12682
|
},
|
|
12674
|
-
...(
|
|
12683
|
+
...(F ? h.nodeLayouts?.[F] || h.layouts?.[F] : null)?.regions || { main: { label: "Content" } }
|
|
12675
12684
|
};
|
|
12676
|
-
for (let [e, r] of Object.entries(
|
|
12677
|
-
let i =
|
|
12678
|
-
if (
|
|
12679
|
-
let r = await Yi(t,
|
|
12680
|
-
if (r.blocks.length > 0 && (
|
|
12685
|
+
for (let [e, r] of Object.entries(Te)) {
|
|
12686
|
+
let i = I[e] && I[e].length > 0, a = !!de[e];
|
|
12687
|
+
if (I[e] || (I[e] = [], Se[e] = { isInherited: !1 }), (r?.inherit === "parent" || r?.inherit === !0 || r?.inherit === "true" || e === "header" || e === "footer") && !i && !a && D) {
|
|
12688
|
+
let r = await Yi(t, D, e, h, s, n);
|
|
12689
|
+
if (r.blocks.length > 0 && (I[e] = r.blocks, Se[e] = {
|
|
12681
12690
|
isInherited: !0,
|
|
12682
12691
|
inheritedFromId: r.inheritedFromId,
|
|
12683
12692
|
inheritedFromTitle: r.inheritedFromTitle
|
|
12684
|
-
}, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (
|
|
12693
|
+
}, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (I[t] = n, Se[t] = {
|
|
12685
12694
|
isInherited: !0,
|
|
12686
12695
|
inheritedFromId: r.inheritedFromId,
|
|
12687
12696
|
inheritedFromTitle: r.inheritedFromTitle
|
|
12688
12697
|
});
|
|
12689
12698
|
}
|
|
12690
12699
|
}
|
|
12691
|
-
await Promise.all(Object.keys(
|
|
12692
|
-
let
|
|
12700
|
+
await Promise.all(Object.keys(I).map((e) => Ji(t, I[e], u)));
|
|
12701
|
+
let Ee = {
|
|
12693
12702
|
channelId: u || d,
|
|
12694
|
-
treeId:
|
|
12703
|
+
treeId: E,
|
|
12695
12704
|
language: _.language || o || "en",
|
|
12696
|
-
node:
|
|
12697
|
-
content:
|
|
12698
|
-
regionMeta:
|
|
12705
|
+
node: M,
|
|
12706
|
+
content: I,
|
|
12707
|
+
regionMeta: Se
|
|
12699
12708
|
};
|
|
12700
|
-
return !s && !m ? (e.header("X-Cache", "MISS"), Ui(e, f.set(p,
|
|
12709
|
+
return !s && !m ? (e.header("X-Cache", "MISS"), Ui(e, f.set(p, Ee, oa(e)))) : e.header("Cache-Control", "no-store, no-cache, must-revalidate"), e.json(Ee);
|
|
12701
12710
|
} catch (t) {
|
|
12702
12711
|
console.error("[CMS Public API] Error fetching node by path:", t);
|
|
12703
12712
|
let n = e.env?.ENVIRONMENT === "development";
|