@b4moss/hyogen-md 0.13.0 → 0.14.0

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/client.js CHANGED
@@ -1,10 +1,10 @@
1
- import { parse as Je } from "yaml";
2
- const Qe = { file_not_found: "File not found: {path} (referenced from {from} via {via})", frontmatter_too_large: "Front matter exceeds size limit in {path} ({size} bytes, limit {limit})", duplicate_component_alias: 'Duplicate component alias "{alias}" in {path}', alias_collision: 'Component alias "{alias}" collides with an existing binding in {path}', forbidden_property_access: 'Forbidden property access "{property}" in {path}', parse_error: "Parse error in {path}: {message}", server_context_on_client: "serverContext is not allowed with renderClient", load_failed: "Failed to load {path}: {reason}", data_sources_on_client: "dataSources is not allowed with renderClient", data_source_too_large: "Data source exceeds size limit in {path} ({size} bytes, limit {limit})" }, et = { circular_include: "Circular reference detected; skipped {path} (referenced from {from} via {via})", nest_limit_exceeded: "Nesting limit exceeded ({limit}); skipped block in {path}", extend_in_component: "extend is not allowed inside a component; skipped in {path}", prop_type_mismatch: 'Prop "{prop}" type mismatch in component "{component}"; expected {expected}, got {actual}', prop_missing: 'Required prop "{prop}" is missing for component "{component}"', prop_unknown: 'Unknown prop "{prop}" passed to component "{component}"; ignored', suspicious_context_value: 'Suspicious value in context key "{key}" ({reason})' }, tt = { contains_html_script_tag: "contains HTML script tag", contains_event_handler: "contains inline event handler", contains_dangerous_scheme: "contains dangerous URL scheme", contains_embed_tag: "contains embeddable HTML tag", contains_meta_refresh: "contains meta refresh" }, Q = {
3
- errors: Qe,
4
- warnings: et,
5
- warningReasons: tt
6
- }, nt = Q.errors, rt = Q.warnings;
7
- function Se(t, e) {
1
+ import { parse as Qe } from "yaml";
2
+ const et = { file_not_found: "File not found: {path} (referenced from {from} via {via})", frontmatter_too_large: "Front matter exceeds size limit in {path} ({size} bytes, limit {limit})", duplicate_component_alias: 'Duplicate component alias "{alias}" in {path}', alias_collision: 'Component alias "{alias}" collides with an existing binding in {path}', forbidden_property_access: 'Forbidden property access "{property}" in {path}', parse_error: "Parse error in {path}: {message}", server_context_on_client: "serverContext is not allowed with renderClient", load_failed: "Failed to load {path}: {reason}", data_sources_on_client: "dataSources is not allowed with renderClient", data_source_too_large: "Data source exceeds size limit in {path} ({size} bytes, limit {limit})" }, tt = { circular_include: "Circular reference detected; skipped {path} (referenced from {from} via {via})", nest_limit_exceeded: "Nesting limit exceeded ({limit}); skipped block in {path}", extend_in_component: "extend is not allowed inside a component; skipped in {path}", prop_type_mismatch: 'Prop "{prop}" type mismatch in component "{component}"; expected {expected}, got {actual}', prop_missing: 'Required prop "{prop}" is missing for component "{component}"', prop_unknown: 'Unknown prop "{prop}" passed to component "{component}"; ignored', suspicious_context_value: 'Suspicious value in context key "{key}" ({reason})' }, nt = { contains_html_script_tag: "contains HTML script tag", contains_event_handler: "contains inline event handler", contains_dangerous_scheme: "contains dangerous URL scheme", contains_embed_tag: "contains embeddable HTML tag", contains_meta_refresh: "contains meta refresh" }, Q = {
3
+ errors: et,
4
+ warnings: tt,
5
+ warningReasons: nt
6
+ }, rt = Q.errors, it = Q.warnings;
7
+ function We(t, e) {
8
8
  return t === void 0 ? "" : t.replace(/\{([^}]+)\}/g, (n, r) => {
9
9
  if (e === void 0 || !(r in e))
10
10
  return n;
@@ -12,23 +12,23 @@ function Se(t, e) {
12
12
  return i == null ? "" : String(i);
13
13
  });
14
14
  }
15
- function it(t, e) {
16
- return Se(nt[t], e);
15
+ function st(t, e) {
16
+ return We(rt[t], e);
17
17
  }
18
18
  function H(t, e) {
19
- return Se(rt[t], e);
19
+ return We(it[t], e);
20
20
  }
21
21
  function d(t) {
22
- const e = t.message ?? it(t.code, t.details), n = new Error(e);
22
+ const e = t.message ?? st(t.code, t.details), n = new Error(e);
23
23
  return n.name = "HyogenError", n.code = t.code, n.message = e, n.path = t.path, n.details = t.details, n;
24
24
  }
25
- function _(...t) {
25
+ function S(...t) {
26
26
  const e = {};
27
27
  for (const n of t)
28
28
  n != null && Object.assign(e, n);
29
29
  return e;
30
30
  }
31
- class Ce {
31
+ class $e {
32
32
  components = /* @__PURE__ */ new Map();
33
33
  register(e, n, r) {
34
34
  if (this.components.has(e.alias))
@@ -52,7 +52,7 @@ class Ce {
52
52
  return this.components.has(e);
53
53
  }
54
54
  }
55
- const de = 64 * 1024;
55
+ const pe = 64 * 1024;
56
56
  function I(t, e) {
57
57
  if (!t.startsWith("---"))
58
58
  return { context: {}, body: t };
@@ -65,13 +65,13 @@ function I(t, e) {
65
65
  if (r === -1)
66
66
  return { context: {}, body: t };
67
67
  const i = t.slice(n + 1, r), s = Buffer.byteLength(i, "utf8");
68
- if (s > de)
68
+ if (s > pe)
69
69
  throw d({
70
70
  code: "frontmatter_too_large",
71
71
  path: e,
72
72
  details: {
73
73
  size: s,
74
- limit: de
74
+ limit: pe
75
75
  }
76
76
  });
77
77
  if (i.trim().length === 0)
@@ -82,7 +82,7 @@ function I(t, e) {
82
82
  });
83
83
  let o;
84
84
  try {
85
- const h = Je(i);
85
+ const h = Qe(i);
86
86
  if (h == null)
87
87
  o = {};
88
88
  else if (typeof h == "object" && !Array.isArray(h))
@@ -110,14 +110,14 @@ ${i}
110
110
  ---`
111
111
  };
112
112
  }
113
- const st = /* @__PURE__ */ new Set([
113
+ const ot = /* @__PURE__ */ new Set([
114
114
  "string",
115
115
  "number",
116
116
  "boolean",
117
117
  "object",
118
118
  "array"
119
119
  ]);
120
- function ot(t, e) {
120
+ function at(t, e) {
121
121
  const n = t.props;
122
122
  if (n === void 0)
123
123
  return {};
@@ -136,13 +136,13 @@ function ot(t, e) {
136
136
  const o = s, a = {};
137
137
  if ("type" in o && o.type !== void 0) {
138
138
  const c = String(o.type);
139
- st.has(c) ? a.type = c : a.type = void 0;
139
+ ot.has(c) ? a.type = c : a.type = void 0;
140
140
  }
141
141
  "isRequired" in o && (a.isRequired = !!o.isRequired), "default" in o && (a.default = o.default), r[i] = a;
142
142
  }
143
143
  return r;
144
144
  }
145
- function at(t) {
145
+ function ct(t) {
146
146
  if (t != null) {
147
147
  if (typeof t == "string") return "string";
148
148
  if (typeof t == "number") return "number";
@@ -151,7 +151,7 @@ function at(t) {
151
151
  if (typeof t == "object") return "object";
152
152
  }
153
153
  }
154
- function ct(t, e) {
154
+ function lt(t, e) {
155
155
  return e === "array" ? Array.isArray(t) : e === "object" ? typeof t == "object" && t !== null && !Array.isArray(t) : typeof t === e;
156
156
  }
157
157
  function Z(t, e) {
@@ -161,7 +161,7 @@ function Z(t, e) {
161
161
  details: e
162
162
  };
163
163
  }
164
- function lt(t, e, n) {
164
+ function ht(t, e, n) {
165
165
  const r = [], i = {}, s = new Set(Object.keys(e));
166
166
  for (const [o, a] of Object.entries(e)) {
167
167
  const c = Object.prototype.hasOwnProperty.call(t, o);
@@ -172,8 +172,8 @@ function lt(t, e, n) {
172
172
  component: n
173
173
  })
174
174
  ), h = void 0)), c && h !== void 0 && h !== null) {
175
- const l = a.type ?? at(h);
176
- l && !ct(h, l) && (r.push(
175
+ const l = a.type ?? ct(h);
176
+ l && !lt(h, l) && (r.push(
177
177
  Z("prop_type_mismatch", {
178
178
  prop: o,
179
179
  component: n,
@@ -193,16 +193,16 @@ function lt(t, e, n) {
193
193
  ) : i[o] = t[o]);
194
194
  return { values: i, warnings: r };
195
195
  }
196
- function We(t) {
196
+ function Ae(t) {
197
197
  return /^https?:\/\//i.test(t);
198
198
  }
199
- function ht(t) {
199
+ function ut(t) {
200
200
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
201
201
  }
202
- var q, fe;
203
- function ut() {
204
- if (fe) return q;
205
- fe = 1;
202
+ var q, me;
203
+ function dt() {
204
+ if (me) return q;
205
+ me = 1;
206
206
  function t(i) {
207
207
  if (typeof i != "string")
208
208
  throw new TypeError("Path must be a string. Received " + JSON.stringify(i));
@@ -284,15 +284,15 @@ function ut() {
284
284
  } else h > g && (s.charCodeAt(a + p) === 47 ? m = p : p === 0 && (m = 0));
285
285
  break;
286
286
  }
287
- var S = s.charCodeAt(a + p), D = o.charCodeAt(l + p);
288
- if (S !== D)
287
+ var v = s.charCodeAt(a + p), D = o.charCodeAt(l + p);
288
+ if (v !== D)
289
289
  break;
290
- S === 47 && (m = p);
290
+ v === 47 && (m = p);
291
291
  }
292
- var v = "";
292
+ var b = "";
293
293
  for (p = a + m + 1; p <= c; ++p)
294
- (p === c || s.charCodeAt(p) === 47) && (v.length === 0 ? v += ".." : v += "/..");
295
- return v.length > 0 ? v + o.slice(l + m) : (l += m, o.charCodeAt(l) === 47 && ++l, o.slice(l));
294
+ (p === c || s.charCodeAt(p) === 47) && (b.length === 0 ? b += ".." : b += "/..");
295
+ return b.length > 0 ? b + o.slice(l + m) : (l += m, o.charCodeAt(l) === 47 && ++l, o.slice(l));
296
296
  },
297
297
  _makeLong: function(s) {
298
298
  return s;
@@ -387,22 +387,22 @@ function ut() {
387
387
  };
388
388
  return r.posix = r, q = r, q;
389
389
  }
390
- var dt = ut();
391
- const y = /* @__PURE__ */ ht(dt);
392
- function ft(t, e) {
393
- const n = y.relative(e, t);
394
- return n === "" || !n.startsWith("..") && !y.isAbsolute(n);
390
+ var ft = dt();
391
+ const _ = /* @__PURE__ */ ut(ft);
392
+ function pt(t, e) {
393
+ const n = _.relative(e, t);
394
+ return n === "" || !n.startsWith("..") && !_.isAbsolute(n);
395
395
  }
396
- function pt(t, e, n) {
397
- const r = y.resolve(e), i = y.resolve(t);
398
- if (!ft(i, r))
396
+ function mt(t, e, n) {
397
+ const r = _.resolve(e), i = _.resolve(t);
398
+ if (!pt(i, r))
399
399
  throw d({
400
400
  code: "parse_error",
401
401
  path: n,
402
402
  details: { message: "path resolves outside root directory" }
403
403
  });
404
404
  }
405
- function $e(t, e = {}) {
405
+ function Ee(t, e = {}) {
406
406
  const { rootDir: n, fromPath: r, documentPath: i, constrainToRoot: s = !1, hyogenPath: o = !1 } = e;
407
407
  if (t.length === 0)
408
408
  throw d({
@@ -413,7 +413,7 @@ function $e(t, e = {}) {
413
413
  let a;
414
414
  if (t.startsWith("/"))
415
415
  if (n)
416
- a = y.resolve(n, t.slice(1));
416
+ a = _.resolve(n, t.slice(1));
417
417
  else {
418
418
  if (o)
419
419
  throw d({
@@ -421,8 +421,8 @@ function $e(t, e = {}) {
421
421
  path: i,
422
422
  details: { message: "root-relative paths require a doc root" }
423
423
  });
424
- if (y.isAbsolute(t))
425
- a = y.resolve(t);
424
+ if (_.isAbsolute(t))
425
+ a = _.resolve(t);
426
426
  else
427
427
  throw d({
428
428
  code: "parse_error",
@@ -432,28 +432,28 @@ function $e(t, e = {}) {
432
432
  }
433
433
  else if (t.startsWith("./") || t.startsWith("../"))
434
434
  if (r)
435
- a = y.resolve(y.dirname(r), t);
435
+ a = _.resolve(_.dirname(r), t);
436
436
  else if (n)
437
- a = y.resolve(n, t);
437
+ a = _.resolve(n, t);
438
438
  else
439
439
  throw d({
440
440
  code: "parse_error",
441
441
  path: i,
442
442
  details: { message: "root is required for relative template paths" }
443
443
  });
444
- else if (y.isAbsolute(t))
445
- a = y.resolve(t);
444
+ else if (_.isAbsolute(t))
445
+ a = _.resolve(t);
446
446
  else if (n)
447
- a = y.resolve(n, t);
447
+ a = _.resolve(n, t);
448
448
  else
449
449
  throw d({
450
450
  code: "parse_error",
451
451
  path: i,
452
452
  details: { message: "root is required for relative template paths" }
453
453
  });
454
- return n && s && pt(a, n, i), a;
454
+ return n && s && mt(a, n, i), a;
455
455
  }
456
- async function mt(t) {
456
+ async function gt(t) {
457
457
  const e = t.registry.get(t.alias);
458
458
  if (!e)
459
459
  throw d({
@@ -463,24 +463,24 @@ async function mt(t) {
463
463
  message: `unregistered component: ${t.alias}`
464
464
  }
465
465
  });
466
- const n = We(e.componentPath) ? e.componentPath : $e(e.componentPath, {
466
+ const n = Ae(e.componentPath) ? e.componentPath : Ee(e.componentPath, {
467
467
  rootDir: t.rootDir,
468
468
  fromPath: e.definedAt,
469
469
  documentPath: t.path,
470
470
  constrainToRoot: t.constrainToRoot,
471
471
  hyogenPath: !0
472
- }), r = await t.loader(n), { context: i, body: s } = I(r, n), o = ot(i, n), { values: a, warnings: c } = lt(
472
+ }), r = await t.loader(n), { context: i, body: s } = I(r, n), o = at(i, n), { values: a, warnings: c } = ht(
473
473
  t.props,
474
474
  o,
475
475
  t.alias
476
476
  );
477
477
  t.warnings.push(...c);
478
- const { props: h, ...l } = i, u = _(
478
+ const { props: h, ...l } = i, u = S(
479
479
  t.parentContext,
480
480
  l,
481
481
  a
482
482
  );
483
- return (await he(s, {
483
+ return (await de(s, {
484
484
  context: u,
485
485
  loader: t.loader,
486
486
  root: t.rootDir,
@@ -494,17 +494,17 @@ async function mt(t) {
494
494
  constrainToRoot: t.constrainToRoot
495
495
  })).trim();
496
496
  }
497
- const gt = /* @__PURE__ */ new Set([
497
+ const xt = /* @__PURE__ */ new Set([
498
498
  "__proto__",
499
499
  "prototype",
500
500
  "constructor",
501
501
  "__defineGetter__"
502
502
  ]);
503
- function xt(t) {
504
- return gt.has(t);
503
+ function wt(t) {
504
+ return xt.has(t);
505
505
  }
506
- function pe(t, e) {
507
- if (xt(t))
506
+ function ge(t, e) {
507
+ if (wt(t))
508
508
  throw d({
509
509
  code: "forbidden_property_access",
510
510
  path: e,
@@ -522,7 +522,7 @@ function kt(t, e) {
522
522
  return t[e];
523
523
  }
524
524
  }
525
- function wt(t, e, n) {
525
+ function vt(t, e, n) {
526
526
  switch (t) {
527
527
  case "+":
528
528
  return e + n;
@@ -556,37 +556,37 @@ function wt(t, e, n) {
556
556
  return;
557
557
  }
558
558
  }
559
- async function w(t, e) {
559
+ async function k(t, e) {
560
560
  const { context: n, path: r } = e;
561
561
  switch (t.type) {
562
562
  case "literal":
563
563
  return t.value;
564
564
  case "identifier":
565
- return pe(t.name, r), n[t.name];
565
+ return ge(t.name, r), n[t.name];
566
566
  case "member": {
567
- pe(t.property, r);
568
- const i = await w(t.object, e);
567
+ ge(t.property, r);
568
+ const i = await k(t.object, e);
569
569
  return kt(i, t.property);
570
570
  }
571
571
  case "default": {
572
- const i = await w(t.left, e);
573
- return O(i) ? w(t.right, e) : i;
572
+ const i = await k(t.left, e);
573
+ return O(i) ? k(t.right, e) : i;
574
574
  }
575
575
  case "unary": {
576
- const i = await w(t.operand, e);
576
+ const i = await k(t.operand, e);
577
577
  return t.op === "!" ? !i : void 0;
578
578
  }
579
579
  case "binary": {
580
580
  if (t.op === "&&") {
581
- const o = await w(t.left, e);
582
- return O(o) ? o : w(t.right, e);
581
+ const o = await k(t.left, e);
582
+ return O(o) ? o : k(t.right, e);
583
583
  }
584
584
  if (t.op === "||") {
585
- const o = await w(t.left, e);
586
- return O(o) ? w(t.right, e) : o;
585
+ const o = await k(t.left, e);
586
+ return O(o) ? k(t.right, e) : o;
587
587
  }
588
- const i = await w(t.left, e), s = await w(t.right, e);
589
- return wt(t.op, i, s);
588
+ const i = await k(t.left, e), s = await k(t.right, e);
589
+ return vt(t.op, i, s);
590
590
  }
591
591
  case "call": {
592
592
  if (!e.registry || !e.loader || !e.visitStack)
@@ -607,8 +607,8 @@ async function w(t, e) {
607
607
  });
608
608
  const i = {};
609
609
  for (const [s, o] of Object.entries(t.args))
610
- i[s] = await w(o, e);
611
- return mt({
610
+ i[s] = await k(o, e);
611
+ return gt({
612
612
  alias: t.callee,
613
613
  props: i,
614
614
  parentContext: e.parentContext ?? n,
@@ -629,14 +629,14 @@ async function w(t, e) {
629
629
  path: r,
630
630
  details: { message: `unsupported method: ${t.method}()` }
631
631
  });
632
- const i = await w(t.object, e);
632
+ const i = await k(t.object, e);
633
633
  return i == null || typeof i.toLocaleString != "function" ? void 0 : i.toLocaleString(
634
634
  ...t.args
635
635
  );
636
636
  }
637
637
  case "ternary": {
638
- const i = await w(t.condition, e);
639
- return O(i) ? w(t.alternate, e) : w(t.consequent, e);
638
+ const i = await k(t.condition, e);
639
+ return O(i) ? k(t.alternate, e) : k(t.consequent, e);
640
640
  }
641
641
  case "template": {
642
642
  let i = "";
@@ -644,7 +644,7 @@ async function w(t, e) {
644
644
  if (typeof s == "string")
645
645
  i += s;
646
646
  else {
647
- const o = await w(s, e);
647
+ const o = await k(s, e);
648
648
  o != null && (i += String(o));
649
649
  }
650
650
  return i;
@@ -656,14 +656,14 @@ async function w(t, e) {
656
656
  function V(t) {
657
657
  return /[A-Za-z_$]/.test(t);
658
658
  }
659
- function vt(t) {
659
+ function bt(t) {
660
660
  return /[A-Za-z0-9_$]/.test(t);
661
661
  }
662
- function W(t, e, n = {}) {
662
+ function C(t, e, n = {}) {
663
663
  const r = t.trim();
664
664
  if (r.length === 0)
665
665
  throw x(e, "empty expression");
666
- const i = new bt(r, e, n), s = i.parseExpression();
666
+ const i = new yt(r, e, n), s = i.parseExpression();
667
667
  if (i.skipWhitespace(), i.hasMore())
668
668
  throw x(e, `unexpected token at position ${i.position}`);
669
669
  return s;
@@ -675,7 +675,7 @@ function x(t, e) {
675
675
  details: { message: e }
676
676
  });
677
677
  }
678
- class bt {
678
+ class yt {
679
679
  constructor(e, n, r = {}) {
680
680
  this.input = e, this.path = n, this.allowCalls = r.allowCalls !== !1;
681
681
  }
@@ -882,7 +882,7 @@ class bt {
882
882
  }
883
883
  if (r === "$" && this.input[this.index + 1] === "{") {
884
884
  e.push(n), n = "", this.index += 2;
885
- const i = this.readTemplateExpression(), s = W(i, this.path, {
885
+ const i = this.readTemplateExpression(), s = C(i, this.path, {
886
886
  allowCalls: !1
887
887
  });
888
888
  e.push(s);
@@ -1043,7 +1043,7 @@ class bt {
1043
1043
  const e = this.index;
1044
1044
  if (!V(this.peek()))
1045
1045
  return "";
1046
- for (this.index++; this.index < this.input.length && vt(this.peek()); )
1046
+ for (this.index++; this.index < this.input.length && bt(this.peek()); )
1047
1047
  this.index++;
1048
1048
  return this.input.slice(e, this.index);
1049
1049
  }
@@ -1076,11 +1076,11 @@ class bt {
1076
1076
  return r;
1077
1077
  }
1078
1078
  }
1079
- const yt = /^( {0,3})(=+|-+)[ \t]*$/, Ae = /^( {0,3})(`{3,}|~{3,})(.*)$/;
1079
+ const _t = /^( {0,3})(=+|-+)[ \t]*$/, Te = /^( {0,3})(`{3,}|~{3,})(.*)$/;
1080
1080
  function M(t) {
1081
1081
  return t === " " || t === " ";
1082
1082
  }
1083
- function Ee(t) {
1083
+ function Le(t) {
1084
1084
  let e = 0;
1085
1085
  for (; e < t.length && e < 3 && t[e] === " "; )
1086
1086
  e += 1;
@@ -1113,11 +1113,11 @@ function Ee(t) {
1113
1113
  }
1114
1114
  return { indent: n, level: r, text: t.slice(e, s) };
1115
1115
  }
1116
- function Te() {
1116
+ function ee() {
1117
1117
  return { active: !1, marker: null, length: 0 };
1118
1118
  }
1119
- function Le(t, e) {
1120
- const n = Ae.exec(e);
1119
+ function te(t, e) {
1120
+ const n = Te.exec(e);
1121
1121
  if (!t.active) {
1122
1122
  if (n) {
1123
1123
  const r = n[2];
@@ -1132,29 +1132,29 @@ function Le(t, e) {
1132
1132
  return !0;
1133
1133
  }
1134
1134
  function Me(t) {
1135
- const e = Ee(t);
1135
+ const e = Le(t);
1136
1136
  return e ? e.level : null;
1137
1137
  }
1138
1138
  function Oe(t) {
1139
- const e = yt.exec(t);
1139
+ const e = _t.exec(t);
1140
1140
  return e ? e[2][0] === "=" ? 1 : 2 : null;
1141
1141
  }
1142
- function _t(t) {
1142
+ function St(t) {
1143
1143
  for (let e = 0; e < t.length; e++)
1144
1144
  if (!M(t[e]))
1145
1145
  return !1;
1146
1146
  return !0;
1147
1147
  }
1148
1148
  function Re(t) {
1149
- return !(_t(t) || Me(t) !== null || Ae.test(t) || t.startsWith(" ") || t.startsWith(" "));
1149
+ return !(St(t) || Me(t) !== null || Te.test(t) || t.startsWith(" ") || t.startsWith(" "));
1150
1150
  }
1151
1151
  function He(t) {
1152
1152
  const e = t.split(`
1153
- `), n = Te();
1153
+ `), n = ee();
1154
1154
  let r = 0;
1155
1155
  for (let i = 0; i < e.length; i++) {
1156
1156
  const s = e[i];
1157
- if (Le(n, s))
1157
+ if (te(n, s))
1158
1158
  continue;
1159
1159
  const o = Me(s);
1160
1160
  if (o !== null) {
@@ -1169,21 +1169,21 @@ function He(t) {
1169
1169
  }
1170
1170
  return r;
1171
1171
  }
1172
- function St(t) {
1172
+ function Ct(t) {
1173
1173
  return t < 1 ? 1 : t > 6 ? 6 : t;
1174
1174
  }
1175
- function me(t, e) {
1176
- const n = e.trim(), r = "#".repeat(St(t));
1175
+ function xe(t, e) {
1176
+ const n = e.trim(), r = "#".repeat(Ct(t));
1177
1177
  return n.length === 0 ? r : `${r} ${n}`;
1178
1178
  }
1179
1179
  function De(t, e) {
1180
1180
  if (e <= 0 || t.length === 0)
1181
1181
  return t;
1182
1182
  const n = t.split(`
1183
- `), r = Te(), i = [];
1183
+ `), r = ee(), i = [];
1184
1184
  for (let s = 0; s < n.length; s++) {
1185
1185
  const o = n[s];
1186
- if (Le(r, o)) {
1186
+ if (te(r, o)) {
1187
1187
  i.push(o);
1188
1188
  continue;
1189
1189
  }
@@ -1191,13 +1191,13 @@ function De(t, e) {
1191
1191
  if (a !== null && i.length > 0) {
1192
1192
  const h = i[i.length - 1];
1193
1193
  if (Re(h)) {
1194
- i[i.length - 1] = me(a + e, h);
1194
+ i[i.length - 1] = xe(a + e, h);
1195
1195
  continue;
1196
1196
  }
1197
1197
  }
1198
- const c = Ee(o);
1198
+ const c = Le(o);
1199
1199
  if (c !== null) {
1200
- i.push(c.indent + me(c.level + e, c.text));
1200
+ i.push(c.indent + xe(c.level + e, c.text));
1201
1201
  continue;
1202
1202
  }
1203
1203
  i.push(o);
@@ -1227,7 +1227,7 @@ async function Ne(t, e, n = {}) {
1227
1227
  path: r,
1228
1228
  details: { message: "unclosed expression" }
1229
1229
  });
1230
- const f = t.slice(o + h, u).trim(), g = W(f, r), m = await w(g, {
1230
+ const f = t.slice(o + h, u).trim(), g = C(f, r), m = await k(g, {
1231
1231
  ...n,
1232
1232
  context: e,
1233
1233
  path: r,
@@ -1235,14 +1235,113 @@ async function Ne(t, e, n = {}) {
1235
1235
  });
1236
1236
  let p = m == null ? "" : String(m);
1237
1237
  if (g.type === "call" && p.length > 0) {
1238
- const S = He(i);
1239
- p = De(p, S);
1238
+ const v = He(i);
1239
+ p = De(p, v);
1240
1240
  }
1241
1241
  i += p, s = u + l.length;
1242
1242
  }
1243
1243
  return i;
1244
1244
  }
1245
- function Ct(t, e) {
1245
+ function Wt(t) {
1246
+ const e = [];
1247
+ let n = 0;
1248
+ for (; n < t.length; ) {
1249
+ const r = t.indexOf(`
1250
+ `, n);
1251
+ if (r === -1) {
1252
+ e.push({ content: t.slice(n), eol: "" });
1253
+ break;
1254
+ }
1255
+ let i = t.slice(n, r), s = `
1256
+ `;
1257
+ i.endsWith("\r") && (i = i.slice(0, -1), s = `\r
1258
+ `), e.push({ content: i, eol: s }), n = r + 1;
1259
+ }
1260
+ return e;
1261
+ }
1262
+ function $t(t, e, n) {
1263
+ let r = 1, i = e, s = null;
1264
+ for (; i < t.length; ) {
1265
+ const o = t[i];
1266
+ if (s) {
1267
+ if (o === "\\") {
1268
+ i += 2;
1269
+ continue;
1270
+ }
1271
+ o === s && (s = null), i++;
1272
+ continue;
1273
+ }
1274
+ if (o === '"' || o === "'" || o === "`") {
1275
+ s = o, i++;
1276
+ continue;
1277
+ }
1278
+ if (o === "{") {
1279
+ r++, i++;
1280
+ continue;
1281
+ }
1282
+ if (o === "}") {
1283
+ if (r--, r === 0)
1284
+ return {
1285
+ expr: t.slice(e, i),
1286
+ end: i + 1
1287
+ };
1288
+ i++;
1289
+ continue;
1290
+ }
1291
+ i++;
1292
+ }
1293
+ throw d({
1294
+ code: "parse_error",
1295
+ path: n,
1296
+ details: { message: "unclosed template expression" }
1297
+ });
1298
+ }
1299
+ function At(t, e) {
1300
+ let n = 0, r = e - 1;
1301
+ for (; r >= 0 && t[r] === "\\"; )
1302
+ n++, r--;
1303
+ return n % 2 === 1;
1304
+ }
1305
+ async function Et(t, e, n) {
1306
+ const r = n.path;
1307
+ let i = "", s = 0;
1308
+ for (; s < t.length; ) {
1309
+ const o = t.indexOf("${", s);
1310
+ if (o === -1) {
1311
+ i += t.slice(s);
1312
+ break;
1313
+ }
1314
+ if (At(t, o)) {
1315
+ i += t.slice(s, o - 1), i += "${", s = o + 2;
1316
+ continue;
1317
+ }
1318
+ i += t.slice(s, o);
1319
+ const { expr: a, end: c } = $t(t, o + 2, r), h = C(a.trim(), r, { allowCalls: !1 }), l = await k(h, {
1320
+ ...n,
1321
+ context: e,
1322
+ path: r,
1323
+ parentContext: n.parentContext ?? e
1324
+ });
1325
+ i += l == null ? "" : String(l), s = c;
1326
+ }
1327
+ return i;
1328
+ }
1329
+ async function Be(t, e, n = {}) {
1330
+ const r = Wt(t);
1331
+ if (r.length === 0)
1332
+ return t;
1333
+ const i = ee();
1334
+ let s = "", o = "", a = !1;
1335
+ const c = async () => {
1336
+ a && (s += await Et(o, e, n), o = "", a = !1);
1337
+ };
1338
+ for (const { content: h, eol: l } of r) {
1339
+ const u = te(i, h), f = h + l;
1340
+ u ? (a || (a = !0, o = ""), o += f) : (await c(), s += f);
1341
+ }
1342
+ return await c(), s;
1343
+ }
1344
+ function Tt(t, e) {
1246
1345
  let n = 0, r = 0;
1247
1346
  for (; r < t.length; ) {
1248
1347
  const i = t.indexOf(e, r);
@@ -1252,14 +1351,14 @@ function Ct(t, e) {
1252
1351
  }
1253
1352
  return n;
1254
1353
  }
1255
- function ee(t) {
1256
- const e = t.includes("@hg"), n = t.includes("@endhg"), r = Ct(t, "@@");
1354
+ function ne(t) {
1355
+ const e = t.includes("@hg"), n = t.includes("@endhg"), r = Tt(t, "@@");
1257
1356
  return e && n ? r > 0 ? "mixed" : "hg" : r >= 2 && !e && !n ? "at-at" : (e || n) && r > 0 ? "mixed" : e && !n || r === 1 && !n ? "unclosed" : "none";
1258
1357
  }
1259
- function te(t) {
1358
+ function re(t) {
1260
1359
  return t.replace(/@endhg/g, "").replace(/@hg/g, "").replace(/@@/g, "");
1261
1360
  }
1262
- function ne(t, e) {
1361
+ function ie(t, e) {
1263
1362
  let n = 0, r = !1;
1264
1363
  for (; n < e; ) {
1265
1364
  const i = t.indexOf("```", n);
@@ -1276,14 +1375,14 @@ function E(t) {
1276
1375
  const r = t.indexOf("<!--", n);
1277
1376
  if (r === -1)
1278
1377
  break;
1279
- if (ne(t, r)) {
1378
+ if (ie(t, r)) {
1280
1379
  n = r + 4;
1281
1380
  continue;
1282
1381
  }
1283
1382
  const i = t.indexOf("-->", r + 4);
1284
1383
  if (i === -1)
1285
1384
  break;
1286
- const s = t.slice(r, i + 3), o = s.slice(4, s.length - 3), a = ee(o);
1385
+ const s = t.slice(r, i + 3), o = s.slice(4, s.length - 3), a = ne(o);
1287
1386
  (a === "hg" || a === "at-at") && e.push({
1288
1387
  start: r,
1289
1388
  end: i + 3,
@@ -1293,40 +1392,40 @@ function E(t) {
1293
1392
  }
1294
1393
  return e;
1295
1394
  }
1296
- function Be(t) {
1395
+ function Fe(t) {
1297
1396
  let e = 0;
1298
1397
  for (; e < t.length; ) {
1299
1398
  const n = t.indexOf("<!--", e);
1300
1399
  if (n === -1)
1301
1400
  return !1;
1302
- if (ne(t, n)) {
1401
+ if (ie(t, n)) {
1303
1402
  e = n + 4;
1304
1403
  continue;
1305
1404
  }
1306
1405
  const r = t.indexOf("-->", n + 4);
1307
1406
  if (r === -1)
1308
1407
  return !1;
1309
- const i = t.slice(n + 4, r), s = ee(i);
1408
+ const i = t.slice(n + 4, r), s = ne(i);
1310
1409
  if (s === "unclosed" || s === "mixed")
1311
1410
  return !0;
1312
1411
  e = r + 3;
1313
1412
  }
1314
1413
  return !1;
1315
1414
  }
1316
- function Fe(t) {
1415
+ function je(t) {
1317
1416
  let e = 0;
1318
1417
  for (; e < t.length; ) {
1319
1418
  const n = t.indexOf("<!--", e);
1320
1419
  if (n === -1)
1321
1420
  return null;
1322
- if (ne(t, n)) {
1421
+ if (ie(t, n)) {
1323
1422
  e = n + 4;
1324
1423
  continue;
1325
1424
  }
1326
1425
  const r = t.indexOf("-->", n + 4);
1327
1426
  if (r === -1)
1328
1427
  return null;
1329
- const i = t.slice(n + 4, r), s = ee(i);
1428
+ const i = t.slice(n + 4, r), s = ne(i);
1330
1429
  if (s === "mixed")
1331
1430
  return "mixed @hg and @@ markers are not allowed";
1332
1431
  if (s === "unclosed")
@@ -1336,11 +1435,11 @@ function Fe(t) {
1336
1435
  return null;
1337
1436
  }
1338
1437
  function A(t) {
1339
- return te(t).trim().split(/\r?\n/).map((n) => n.trim()).filter((n) => n.length > 0);
1438
+ return re(t).trim().split(/\r?\n/).map((n) => n.trim()).filter((n) => n.length > 0);
1340
1439
  }
1341
- const Wt = /^(if\s+.+|else\s+if\s+.+|else|endif|each\s+[A-Za-z_$][A-Za-z0-9_$]*\s+in\s+.+|endeach)$/i;
1342
- function je(t) {
1343
- return Wt.test(t.trim());
1440
+ const Lt = /^(if\s+.+|else\s+if\s+.+|else|endif|each\s+[A-Za-z_$][A-Za-z0-9_$]*\s+in\s+.+|endeach)$/i;
1441
+ function Pe(t) {
1442
+ return Lt.test(t.trim());
1344
1443
  }
1345
1444
  function K(t, e) {
1346
1445
  throw d({
@@ -1349,7 +1448,7 @@ function K(t, e) {
1349
1448
  details: { message: e }
1350
1449
  });
1351
1450
  }
1352
- function $t(t, e) {
1451
+ function Mt(t, e) {
1353
1452
  let n = t;
1354
1453
  const r = /^<!--([\s\S]*?)-->$/.exec(t.trim());
1355
1454
  r && (n = r[1]);
@@ -1371,20 +1470,20 @@ function $t(t, e) {
1371
1470
  if (o)
1372
1471
  return {
1373
1472
  kind: "else_if",
1374
- expr: W(o[1], e)
1473
+ expr: C(o[1], e)
1375
1474
  };
1376
1475
  const a = /^if\s+(.+)$/.exec(s);
1377
1476
  if (a)
1378
1477
  return {
1379
1478
  kind: "if",
1380
- expr: W(a[1], e)
1479
+ expr: C(a[1], e)
1381
1480
  };
1382
1481
  const c = /^each\s+([A-Za-z_$][A-Za-z0-9_$]*)\s+in\s+(.+)$/.exec(s);
1383
1482
  if (c)
1384
1483
  return {
1385
1484
  kind: "each",
1386
1485
  item: c[1],
1387
- expr: W(c[2], e)
1486
+ expr: C(c[2], e)
1388
1487
  };
1389
1488
  if (s === "if")
1390
1489
  throw K(e, "if requires an expression");
@@ -1402,10 +1501,10 @@ function $(t, e) {
1402
1501
  details: { message: e }
1403
1502
  });
1404
1503
  }
1405
- function At(t, e) {
1504
+ function Ot(t, e) {
1406
1505
  const n = [];
1407
1506
  for (const r of E(t)) {
1408
- const i = $t(r.inner, e);
1507
+ const i = Mt(r.inner, e);
1409
1508
  i && n.push({
1410
1509
  start: r.start,
1411
1510
  end: r.end,
@@ -1415,11 +1514,11 @@ function At(t, e) {
1415
1514
  }
1416
1515
  return n;
1417
1516
  }
1418
- function Pe(t) {
1517
+ function Ie(t) {
1419
1518
  return t.kind === "if" || t.kind === "each";
1420
1519
  }
1421
- function Et(t, e) {
1422
- const n = At(t, e);
1520
+ function Rt(t, e) {
1521
+ const n = Ot(t, e);
1423
1522
  if (n.length === 0)
1424
1523
  return t.length > 0 ? [{ kind: "text", content: t }] : [];
1425
1524
  const { nodes: r, nextIndex: i } = F(t, n, 0, n.length, e);
@@ -1449,12 +1548,12 @@ function F(t, e, n, r, i, s = 0, o) {
1449
1548
  kind: "text",
1450
1549
  content: t.slice(h, u.start)
1451
1550
  }), u.opener.kind === "if") {
1452
- const f = Tt(t, e, l, r, i);
1551
+ const f = Ht(t, e, l, r, i);
1453
1552
  c.push(f.node), h = f.endPos, l = f.nextIndex;
1454
1553
  continue;
1455
1554
  }
1456
1555
  if (u.opener.kind === "each") {
1457
- const f = Lt(t, e, l, r, i);
1556
+ const f = Dt(t, e, l, r, i);
1458
1557
  c.push(f.node), h = f.endPos, l = f.nextIndex;
1459
1558
  continue;
1460
1559
  }
@@ -1468,7 +1567,7 @@ function F(t, e, n, r, i, s = 0, o) {
1468
1567
  }
1469
1568
  return h < a && c.push({ kind: "text", content: t.slice(h, a) }), { nodes: c, nextIndex: l };
1470
1569
  }
1471
- function Tt(t, e, n, r, i) {
1570
+ function Ht(t, e, n, r, i) {
1472
1571
  const s = e[n];
1473
1572
  if (s.opener.kind !== "if")
1474
1573
  throw $(i, "expected if");
@@ -1487,7 +1586,7 @@ function Tt(t, e, n, r, i) {
1487
1586
  }), a++;
1488
1587
  continue;
1489
1588
  }
1490
- if (Pe(l.opener)) {
1589
+ if (Ie(l.opener)) {
1491
1590
  h++, a++;
1492
1591
  continue;
1493
1592
  }
@@ -1552,7 +1651,7 @@ function Tt(t, e, n, r, i) {
1552
1651
  }
1553
1652
  throw $(i, "unclosed if block (missing endif)");
1554
1653
  }
1555
- function Lt(t, e, n, r, i) {
1654
+ function Dt(t, e, n, r, i) {
1556
1655
  const s = e[n];
1557
1656
  if (s.opener.kind !== "each")
1558
1657
  throw $(i, "expected each");
@@ -1561,7 +1660,7 @@ function Lt(t, e, n, r, i) {
1561
1660
  let c = 0;
1562
1661
  for (; o < r; ) {
1563
1662
  const h = e[o];
1564
- if (Pe(h.opener)) {
1663
+ if (Ie(h.opener)) {
1565
1664
  c++, o++;
1566
1665
  continue;
1567
1666
  }
@@ -1600,26 +1699,26 @@ function Lt(t, e, n, r, i) {
1600
1699
  }
1601
1700
  throw $(i, "unclosed each block (missing endeach)");
1602
1701
  }
1603
- const ge = 20;
1604
- class Mt {
1702
+ const we = 20;
1703
+ class Nt {
1605
1704
  depth = 0;
1606
1705
  get currentDepth() {
1607
1706
  return this.depth;
1608
1707
  }
1609
1708
  enter() {
1610
- return this.depth >= ge ? { exceeded: !0, limit: ge } : (this.depth++, { exceeded: !1, depth: this.depth });
1709
+ return this.depth >= we ? { exceeded: !0, limit: we } : (this.depth++, { exceeded: !1, depth: this.depth });
1611
1710
  }
1612
1711
  exit() {
1613
1712
  this.depth > 0 && this.depth--;
1614
1713
  }
1615
1714
  }
1616
- function Ot(t) {
1715
+ function Bt(t) {
1617
1716
  return !!t;
1618
1717
  }
1619
- function Rt(t) {
1718
+ function Ft(t) {
1620
1719
  return t != null && typeof t[Symbol.iterator] == "function";
1621
1720
  }
1622
- function Ie(t) {
1721
+ function ze(t) {
1623
1722
  return {
1624
1723
  code: "nest_limit_exceeded",
1625
1724
  message: "structure nest limit exceeded",
@@ -1627,38 +1726,38 @@ function Ie(t) {
1627
1726
  details: { limit: 20 }
1628
1727
  };
1629
1728
  }
1630
- function re(t) {
1729
+ function se(t) {
1631
1730
  return t.startsWith(`
1632
1731
  `) ? t.slice(1) : t;
1633
1732
  }
1634
- async function Ht(t, e) {
1635
- const n = e.path, r = e.warnings ?? [], i = Et(t, n), s = new Mt();
1636
- return ie(i, e, s, r);
1733
+ async function jt(t, e) {
1734
+ const n = e.path, r = e.warnings ?? [], i = Rt(t, n), s = new Nt();
1735
+ return oe(i, e, s, r);
1637
1736
  }
1638
- async function ie(t, e, n, r) {
1737
+ async function oe(t, e, n, r) {
1639
1738
  const i = e.preserveHgComments === !0;
1640
1739
  let s = "", o = !1;
1641
1740
  for (const a of t) {
1642
- let c = await Dt(a, e, n, r);
1643
- o && (c = re(c)), s += c, o = !i && (a.kind === "if" || a.kind === "each");
1741
+ let c = await Pt(a, e, n, r);
1742
+ o && (c = se(c)), s += c, o = !i && (a.kind === "if" || a.kind === "each");
1644
1743
  }
1645
1744
  return s;
1646
1745
  }
1647
- async function Dt(t, e, n, r) {
1746
+ async function Pt(t, e, n, r) {
1648
1747
  switch (t.kind) {
1649
1748
  case "text":
1650
1749
  return t.content;
1651
1750
  case "if":
1652
- return Nt(t, e, n, r);
1751
+ return It(t, e, n, r);
1653
1752
  case "each":
1654
- return Bt(t, e, n, r);
1753
+ return zt(t, e, n, r);
1655
1754
  default:
1656
1755
  return "";
1657
1756
  }
1658
1757
  }
1659
- async function Nt(t, e, n, r) {
1758
+ async function It(t, e, n, r) {
1660
1759
  if (n.enter().exceeded)
1661
- return r.push(Ie(e.path)), "";
1760
+ return r.push(ze(e.path)), "";
1662
1761
  try {
1663
1762
  let s = -1;
1664
1763
  for (let c = 0; c < t.branches.length; c++) {
@@ -1667,8 +1766,8 @@ async function Nt(t, e, n, r) {
1667
1766
  s = c;
1668
1767
  break;
1669
1768
  }
1670
- const l = await w(h.expr, e);
1671
- if (Ot(l)) {
1769
+ const l = await k(h.expr, e);
1770
+ if (Bt(l)) {
1672
1771
  s = c;
1673
1772
  break;
1674
1773
  }
@@ -1678,8 +1777,8 @@ async function Nt(t, e, n, r) {
1678
1777
  for (let c = 0; c < t.branches.length; c++) {
1679
1778
  const h = t.branches[c];
1680
1779
  if (o && (a += h.opener.raw), c === s) {
1681
- let l = await ie(h.body, e, n, r);
1682
- o || (l = re(l)), a += l;
1780
+ let l = await oe(h.body, e, n, r);
1781
+ o || (l = se(l)), a += l;
1683
1782
  }
1684
1783
  }
1685
1784
  return o && (a += t.closer.raw), a;
@@ -1687,24 +1786,24 @@ async function Nt(t, e, n, r) {
1687
1786
  n.exit();
1688
1787
  }
1689
1788
  }
1690
- async function Bt(t, e, n, r) {
1789
+ async function zt(t, e, n, r) {
1691
1790
  if (n.enter().exceeded)
1692
- return r.push(Ie(e.path)), "";
1791
+ return r.push(ze(e.path)), "";
1693
1792
  try {
1694
- const s = await w(t.expr, e);
1695
- if (!Rt(s))
1793
+ const s = await k(t.expr, e);
1794
+ if (!Ft(s))
1696
1795
  return "";
1697
1796
  const o = e.preserveHgComments === !0;
1698
1797
  let a = "";
1699
1798
  for (const c of s) {
1700
1799
  const h = { ...e.context, [t.item]: c };
1701
1800
  o && (a += t.opener.raw);
1702
- let l = await ie(t.body, {
1801
+ let l = await oe(t.body, {
1703
1802
  ...e,
1704
1803
  context: h
1705
1804
  }, n, r);
1706
- o || (l = re(l));
1707
- const u = await Ne(l, h, {
1805
+ o || (l = se(l));
1806
+ const u = {
1708
1807
  path: e.path,
1709
1808
  registry: e.registry,
1710
1809
  loader: e.loader,
@@ -1714,8 +1813,17 @@ async function Bt(t, e, n, r) {
1714
1813
  parentContext: e.parentContext ?? e.context,
1715
1814
  preserveHgComments: e.preserveHgComments,
1716
1815
  constrainToRoot: e.constrainToRoot
1717
- });
1718
- a += u, o && (a += t.closer.raw);
1816
+ };
1817
+ let f = await Ne(
1818
+ l,
1819
+ h,
1820
+ u
1821
+ );
1822
+ f = await Be(
1823
+ f,
1824
+ h,
1825
+ u
1826
+ ), a += f, o && (a += t.closer.raw);
1719
1827
  }
1720
1828
  return a;
1721
1829
  } finally {
@@ -1723,7 +1831,7 @@ async function Bt(t, e, n, r) {
1723
1831
  }
1724
1832
  }
1725
1833
  function X(t, e, n, r, i = !1, s = !1) {
1726
- return We(e) ? e : $e(e, {
1834
+ return Ae(e) ? e : Ee(e, {
1727
1835
  rootDir: t,
1728
1836
  fromPath: r,
1729
1837
  documentPath: n,
@@ -1731,14 +1839,14 @@ function X(t, e, n, r, i = !1, s = !1) {
1731
1839
  hyogenPath: s
1732
1840
  });
1733
1841
  }
1734
- function ze(t) {
1842
+ function Ue(t) {
1735
1843
  let e = 0;
1736
1844
  for (let n = t.length - 1; n >= 0 && t[n] === `
1737
1845
  `; n--)
1738
1846
  e++;
1739
1847
  return e;
1740
1848
  }
1741
- function Ue(t) {
1849
+ function Ze(t) {
1742
1850
  let e = 0;
1743
1851
  for (; e < t.length && t[e] === `
1744
1852
  `; )
@@ -1746,22 +1854,22 @@ function Ue(t) {
1746
1854
  return e;
1747
1855
  }
1748
1856
  function T(t, e) {
1749
- const n = ze(t), r = Ue(e), i = Math.max(n, r);
1857
+ const n = Ue(t), r = Ze(e), i = Math.max(n, r);
1750
1858
  return t.slice(0, t.length - n) + `
1751
1859
  `.repeat(i) + e.slice(r);
1752
1860
  }
1753
- function se(t, e) {
1754
- const n = ze(t), r = Ue(e);
1861
+ function ae(t, e) {
1862
+ const n = Ue(t), r = Ze(e);
1755
1863
  return n + r - Math.max(n, r);
1756
1864
  }
1757
- function xe(t, e, n) {
1865
+ function ke(t, e, n) {
1758
1866
  const r = t.indexOf(e);
1759
1867
  if (r < 0)
1760
1868
  return t;
1761
1869
  const i = t.slice(0, r), s = t.slice(r + e.length);
1762
1870
  return T(T(i, n), s);
1763
1871
  }
1764
- async function Ft(t) {
1872
+ async function Ut(t) {
1765
1873
  let e = t.source;
1766
1874
  for (const n of t.directives) {
1767
1875
  const r = X(
@@ -1788,13 +1896,13 @@ async function Ft(t) {
1788
1896
  from: i.from,
1789
1897
  via: "include"
1790
1898
  }
1791
- }), e = xe(e, n.marker, "");
1899
+ }), e = ke(e, n.marker, "");
1792
1900
  continue;
1793
1901
  }
1794
1902
  t.visitStack.push(r);
1795
1903
  }
1796
1904
  try {
1797
- const i = await t.loader(r), s = await $n(i, {
1905
+ const i = await t.loader(r), s = await Mn(i, {
1798
1906
  context: t.context,
1799
1907
  loader: t.loader,
1800
1908
  root: t.root,
@@ -1806,14 +1914,14 @@ async function Ft(t) {
1806
1914
  registry: t.registry
1807
1915
  }), o = e.indexOf(n.marker), a = o >= 0 ? e.slice(0, o) : e, c = He(a), h = De(s, c), l = t.preserveHgComments && n.raw ? `${n.raw}
1808
1916
  ${h}` : h;
1809
- e = xe(e, n.marker, l);
1917
+ e = ke(e, n.marker, l);
1810
1918
  } finally {
1811
1919
  t.visitStack?.pop();
1812
1920
  }
1813
1921
  }
1814
1922
  return e;
1815
1923
  }
1816
- class Ze {
1924
+ class qe {
1817
1925
  stack = [];
1818
1926
  check(e) {
1819
1927
  return e.length === 0 ? { circular: !1 } : this.stack.indexOf(e) !== -1 ? {
@@ -1829,8 +1937,8 @@ class Ze {
1829
1937
  this.stack.pop();
1830
1938
  }
1831
1939
  }
1832
- async function jt(t, e, n = {}) {
1833
- const { path: r, constBindings: i = /* @__PURE__ */ new Set() } = n, s = await w(t.expr, { context: e, path: r });
1940
+ async function Zt(t, e, n = {}) {
1941
+ const { path: r, constBindings: i = /* @__PURE__ */ new Set() } = n, s = await k(t.expr, { context: e, path: r });
1834
1942
  switch (t.kind) {
1835
1943
  case "const": {
1836
1944
  if (i.has(t.name))
@@ -1870,7 +1978,7 @@ async function jt(t, e, n = {}) {
1870
1978
  }
1871
1979
  }
1872
1980
  }
1873
- function ke(t) {
1981
+ function ve(t) {
1874
1982
  return !t;
1875
1983
  }
1876
1984
  async function B(t, e, n = {}) {
@@ -1879,7 +1987,7 @@ async function B(t, e, n = {}) {
1879
1987
  case "const":
1880
1988
  case "let":
1881
1989
  case "assign": {
1882
- await jt(t, e, { path: r, constBindings: i }), s?.(t.name);
1990
+ await Zt(t, e, { path: r, constBindings: i }), s?.(t.name);
1883
1991
  return;
1884
1992
  }
1885
1993
  case "update": {
@@ -1920,7 +2028,7 @@ async function B(t, e, n = {}) {
1920
2028
  message: `assignment to undeclared variable: ${t.name}`
1921
2029
  }
1922
2030
  });
1923
- const a = await w(t.expr, { context: e, path: r }), c = Number(e[t.name]), h = Number(a);
2031
+ const a = await k(t.expr, { context: e, path: r }), c = Number(e[t.name]), h = Number(a);
1924
2032
  let l;
1925
2033
  switch (t.op) {
1926
2034
  case "+=":
@@ -1940,7 +2048,7 @@ async function B(t, e, n = {}) {
1940
2048
  return;
1941
2049
  }
1942
2050
  case "echo": {
1943
- const a = await w(t.expr, {
2051
+ const a = await k(t.expr, {
1944
2052
  context: e,
1945
2053
  path: r
1946
2054
  }), c = a == null ? "" : String(a);
@@ -1949,11 +2057,11 @@ async function B(t, e, n = {}) {
1949
2057
  }
1950
2058
  case "for": {
1951
2059
  for (t.init && await B(t.init, e, n); ; ) {
1952
- const a = await w(t.cond, {
2060
+ const a = await k(t.cond, {
1953
2061
  context: e,
1954
2062
  path: r
1955
2063
  });
1956
- if (ke(a))
2064
+ if (ve(a))
1957
2065
  break;
1958
2066
  for (const c of t.body)
1959
2067
  await B(c, e, n);
@@ -1965,22 +2073,22 @@ async function B(t, e, n = {}) {
1965
2073
  do {
1966
2074
  for (const c of t.body)
1967
2075
  await B(c, e, n);
1968
- const a = await w(t.cond, {
2076
+ const a = await k(t.cond, {
1969
2077
  context: e,
1970
2078
  path: r
1971
2079
  });
1972
- if (ke(a))
2080
+ if (ve(a))
1973
2081
  break;
1974
2082
  } while (!0);
1975
2083
  return;
1976
2084
  }
1977
2085
  }
1978
2086
  }
1979
- async function we(t, e, n = {}) {
2087
+ async function be(t, e, n = {}) {
1980
2088
  for (const r of t)
1981
2089
  await B(r, e, n);
1982
2090
  }
1983
- const Pt = /* @__PURE__ */ new Set([
2091
+ const qt = /* @__PURE__ */ new Set([
1984
2092
  "if",
1985
2093
  "else",
1986
2094
  "endif",
@@ -1999,10 +2107,10 @@ const Pt = /* @__PURE__ */ new Set([
1999
2107
  "as",
2000
2108
  "echo"
2001
2109
  ]);
2002
- function qe(t) {
2003
- return Pt.has(t);
2110
+ function Ve(t) {
2111
+ return qt.has(t);
2004
2112
  }
2005
- function oe(t) {
2113
+ function ce(t) {
2006
2114
  let e = "", n = 0, r = null;
2007
2115
  for (; n < t.length; ) {
2008
2116
  const i = t[n];
@@ -2035,32 +2143,32 @@ function oe(t) {
2035
2143
  }
2036
2144
  return e;
2037
2145
  }
2038
- function k(t, e) {
2146
+ function w(t, e) {
2039
2147
  throw d({
2040
2148
  code: "parse_error",
2041
2149
  path: t,
2042
2150
  details: { message: e }
2043
2151
  });
2044
2152
  }
2045
- function ve(t, e) {
2046
- const n = oe(t).trim();
2153
+ function ye(t, e) {
2154
+ const n = ce(t).trim();
2047
2155
  if (n.length === 0)
2048
- throw k(e, "empty statement block");
2049
- const r = new ae(n, e), i = r.parseStatementList();
2156
+ throw w(e, "empty statement block");
2157
+ const r = new le(n, e), i = r.parseStatementList();
2050
2158
  if (r.skipWhitespace(), r.hasMore())
2051
- throw k(
2159
+ throw w(
2052
2160
  e,
2053
2161
  `unexpected token at position ${r.position}`
2054
2162
  );
2055
2163
  if (i.length === 0)
2056
- throw k(e, "empty statement block");
2164
+ throw w(e, "empty statement block");
2057
2165
  return i;
2058
2166
  }
2059
- function Ve(t) {
2060
- const e = oe(t).trim();
2167
+ function Ke(t) {
2168
+ const e = ce(t).trim();
2061
2169
  return e.length === 0 ? !1 : /^const\s+/.test(e) || /^let\s+/.test(e) || /^echo\b/.test(e) || /^for\s*\(/.test(e) || /^do\b/.test(e) || /^(\+\+|--)/.test(e) || /^[A-Za-z_$][A-Za-z0-9_$]*\s*(\+\+|--|[+\-*/]=|=)/.test(e);
2062
2170
  }
2063
- class ae {
2171
+ class le {
2064
2172
  constructor(e, n) {
2065
2173
  this.input = e, this.path = n;
2066
2174
  }
@@ -2089,7 +2197,7 @@ class ae {
2089
2197
  if (this.matchWord("do"))
2090
2198
  return this.parseDoWhile();
2091
2199
  if (this.matchWord("while"))
2092
- throw k(
2200
+ throw w(
2093
2201
  this.path,
2094
2202
  "bare while loops are not allowed (use do…while)"
2095
2203
  );
@@ -2106,7 +2214,7 @@ class ae {
2106
2214
  return this.parseBindingDeclaration("let");
2107
2215
  const n = this.readIdentifier();
2108
2216
  if (!n)
2109
- throw k(this.path, "expected statement");
2217
+ throw w(this.path, "expected statement");
2110
2218
  if (this.assertAssignableName(n), this.skipWhitespace(), this.match("++") || this.match("--")) {
2111
2219
  const i = this.input.slice(this.index - 2, this.index);
2112
2220
  return { kind: "update", name: n, op: i, position: "postfix" };
@@ -2118,34 +2226,34 @@ class ae {
2118
2226
  kind: "compound_assign",
2119
2227
  name: n,
2120
2228
  op: r,
2121
- expr: W(i, this.path)
2229
+ expr: C(i, this.path)
2122
2230
  };
2123
2231
  }
2124
2232
  if (this.match("=")) {
2125
2233
  if (this.peek() === "=")
2126
- throw k(this.path, "unexpected '==' in assignment");
2234
+ throw w(this.path, "unexpected '==' in assignment");
2127
2235
  const i = this.readExpressionSourceUntilTerminator();
2128
2236
  return {
2129
2237
  kind: "assign",
2130
2238
  name: n,
2131
- expr: W(i, this.path)
2239
+ expr: C(i, this.path)
2132
2240
  };
2133
2241
  }
2134
- throw k(this.path, `invalid statement starting with: ${n}`);
2242
+ throw w(this.path, `invalid statement starting with: ${n}`);
2135
2243
  }
2136
2244
  parseEcho() {
2137
2245
  this.skipWhitespace();
2138
2246
  const e = this.readExpressionSourceUntilTerminator();
2139
2247
  return {
2140
2248
  kind: "echo",
2141
- expr: W(e, this.path)
2249
+ expr: C(e, this.path)
2142
2250
  };
2143
2251
  }
2144
2252
  readPrefixUpdate() {
2145
2253
  if (this.skipWhitespace(), this.match("++") || this.match("--")) {
2146
2254
  const e = this.input.slice(this.index - 2, this.index), n = this.readIdentifier();
2147
2255
  if (!n)
2148
- throw k(this.path, `expected identifier after ${e}`);
2256
+ throw w(this.path, `expected identifier after ${e}`);
2149
2257
  return this.assertAssignableName(n), { kind: "update", name: n, op: e, position: "prefix" };
2150
2258
  }
2151
2259
  return null;
@@ -2153,69 +2261,69 @@ class ae {
2153
2261
  parseBindingDeclaration(e) {
2154
2262
  const n = this.readIdentifier();
2155
2263
  if (!n)
2156
- throw k(this.path, `expected identifier after ${e}`);
2264
+ throw w(this.path, `expected identifier after ${e}`);
2157
2265
  if (this.assertAssignableName(n), this.skipWhitespace(), !this.match("="))
2158
- throw k(this.path, `expected '=' in ${e} declaration`);
2266
+ throw w(this.path, `expected '=' in ${e} declaration`);
2159
2267
  const r = this.readExpressionSourceUntilTerminator();
2160
2268
  return {
2161
2269
  kind: e,
2162
2270
  name: n,
2163
- expr: W(r, this.path)
2271
+ expr: C(r, this.path)
2164
2272
  };
2165
2273
  }
2166
2274
  parseFor() {
2167
2275
  if (this.skipWhitespace(), !this.match("("))
2168
- throw k(this.path, "expected '(' after for");
2169
- const e = this.readBalanced(")"), n = It(e);
2276
+ throw w(this.path, "expected '(' after for");
2277
+ const e = this.readBalanced(")"), n = Vt(e);
2170
2278
  if (n.length !== 3)
2171
- throw k(
2279
+ throw w(
2172
2280
  this.path,
2173
2281
  "for…of / for…in are not allowed; use for (init; cond; update)"
2174
2282
  );
2175
2283
  const [r, i, s] = n;
2176
2284
  if (i.trim().length === 0)
2177
- throw k(this.path, "for loop condition cannot be empty");
2285
+ throw w(this.path, "for loop condition cannot be empty");
2178
2286
  if (/^\s*[A-Za-z_$][A-Za-z0-9_$]*\s+(of|in)\s+/.test(r))
2179
- throw k(
2287
+ throw w(
2180
2288
  this.path,
2181
2289
  "for…of / for…in are not allowed; use for (init; cond; update)"
2182
2290
  );
2183
- const o = r.trim().length === 0 ? null : this.parseClauseStatement(r.trim()), a = W(i.trim(), this.path), c = s.trim().length === 0 ? null : this.parseClauseStatement(s.trim());
2291
+ const o = r.trim().length === 0 ? null : this.parseClauseStatement(r.trim()), a = C(i.trim(), this.path), c = s.trim().length === 0 ? null : this.parseClauseStatement(s.trim());
2184
2292
  if (this.skipWhitespace(), !this.match("{"))
2185
- throw k(this.path, "expected '{' after for (...)");
2293
+ throw w(this.path, "expected '{' after for (...)");
2186
2294
  const h = this.parseStatementList();
2187
2295
  if (this.skipWhitespace(), !this.match("}"))
2188
- throw k(this.path, "expected '}' to close for body");
2296
+ throw w(this.path, "expected '}' to close for body");
2189
2297
  return { kind: "for", init: o, cond: a, update: c, body: h };
2190
2298
  }
2191
2299
  parseDoWhile() {
2192
2300
  if (this.skipWhitespace(), !this.match("{"))
2193
- throw k(this.path, "expected '{' after do");
2301
+ throw w(this.path, "expected '{' after do");
2194
2302
  const e = this.parseStatementList();
2195
2303
  if (this.skipWhitespace(), !this.match("}"))
2196
- throw k(this.path, "expected '}' to close do body");
2304
+ throw w(this.path, "expected '}' to close do body");
2197
2305
  if (this.skipWhitespace(), !this.matchWord("while"))
2198
- throw k(this.path, "expected 'while' after do body");
2306
+ throw w(this.path, "expected 'while' after do body");
2199
2307
  if (this.skipWhitespace(), !this.match("("))
2200
- throw k(this.path, "expected '(' after while");
2308
+ throw w(this.path, "expected '(' after while");
2201
2309
  const n = this.readBalanced(")");
2202
2310
  if (n.trim().length === 0)
2203
- throw k(this.path, "do…while condition cannot be empty");
2204
- const r = W(n.trim(), this.path);
2311
+ throw w(this.path, "do…while condition cannot be empty");
2312
+ const r = C(n.trim(), this.path);
2205
2313
  return { kind: "do_while", body: e, cond: r };
2206
2314
  }
2207
2315
  parseClauseStatement(e) {
2208
- const n = new ae(e, this.path), r = n.parseSimpleStatement();
2316
+ const n = new le(e, this.path), r = n.parseSimpleStatement();
2209
2317
  if (n.skipWhitespace(), n.hasMore())
2210
- throw k(
2318
+ throw w(
2211
2319
  this.path,
2212
2320
  `unexpected token in for clause at position ${n.position}`
2213
2321
  );
2214
2322
  return r;
2215
2323
  }
2216
2324
  assertAssignableName(e) {
2217
- if (qe(e))
2218
- throw k(
2325
+ if (Ve(e))
2326
+ throw w(
2219
2327
  this.path,
2220
2328
  `reserved word cannot be used as identifier: ${e}`
2221
2329
  );
@@ -2250,7 +2358,7 @@ class ae {
2250
2358
  }
2251
2359
  const o = this.input.slice(e, this.index).trim();
2252
2360
  if (o.length === 0)
2253
- throw k(this.path, "expected expression");
2361
+ throw w(this.path, "expected expression");
2254
2362
  return o;
2255
2363
  }
2256
2364
  readBalanced(e) {
@@ -2286,7 +2394,7 @@ class ae {
2286
2394
  }
2287
2395
  this.index++;
2288
2396
  }
2289
- throw k(this.path, `expected '${e}'`);
2397
+ throw w(this.path, `expected '${e}'`);
2290
2398
  }
2291
2399
  readCompoundOp() {
2292
2400
  this.skipWhitespace();
@@ -2321,7 +2429,7 @@ class ae {
2321
2429
  return this.input.slice(e, this.index);
2322
2430
  }
2323
2431
  }
2324
- function It(t) {
2432
+ function Vt(t) {
2325
2433
  const e = [];
2326
2434
  let n = "", r = 0, i = null;
2327
2435
  for (let s = 0; s < t.length; s++) {
@@ -2354,7 +2462,7 @@ function It(t) {
2354
2462
  }
2355
2463
  return e.push(n), e;
2356
2464
  }
2357
- function ce(t, e) {
2465
+ function he(t, e) {
2358
2466
  const n = t.trim();
2359
2467
  if (!/^extend\b/i.test(n)) return null;
2360
2468
  if (!/^extend\s+/i.test(n))
@@ -2379,10 +2487,10 @@ function ce(t, e) {
2379
2487
  });
2380
2488
  return { path: i };
2381
2489
  }
2382
- function zt(t, e) {
2490
+ function Kt(t, e) {
2383
2491
  const n = A(t);
2384
2492
  if (n.length === 0) return null;
2385
- const r = n[0], i = ce(r, e);
2493
+ const r = n[0], i = he(r, e);
2386
2494
  if (!i) return null;
2387
2495
  for (const s of n.slice(1))
2388
2496
  if (/^extend\s+/i.test(s))
@@ -2397,10 +2505,10 @@ function zt(t, e) {
2397
2505
  `)
2398
2506
  };
2399
2507
  }
2400
- function le(t) {
2508
+ function ue(t) {
2401
2509
  return /^toc(\(.*\))?$/.test(t.trim());
2402
2510
  }
2403
- function Ut(t, e) {
2511
+ function Yt(t, e) {
2404
2512
  const n = A(t);
2405
2513
  if (n.length !== 1)
2406
2514
  throw d({
@@ -2431,14 +2539,14 @@ function Ut(t, e) {
2431
2539
  });
2432
2540
  return { maxLevel: Number(s) };
2433
2541
  }
2434
- async function Zt(t, e = {}) {
2542
+ async function Xt(t, e = {}) {
2435
2543
  const n = e.path, r = e.context ?? {};
2436
- if (Be(t))
2544
+ if (Fe(t))
2437
2545
  throw d({
2438
2546
  code: "parse_error",
2439
2547
  path: n,
2440
2548
  details: {
2441
- message: Fe(t) ?? "unclosed hyogen block (missing closing marker)"
2549
+ message: je(t) ?? "unclosed hyogen block (missing closing marker)"
2442
2550
  }
2443
2551
  });
2444
2552
  const i = E(t);
@@ -2450,30 +2558,30 @@ async function Zt(t, e = {}) {
2450
2558
  let c = t, h = 0;
2451
2559
  for (const l of i) {
2452
2560
  const u = A(l.inner);
2453
- if (u.length === 1 && je(u[0]) || u.length === 1 && le(u[0]) || u.length === 1 && /^include\s+/i.test(u[0]) || u.length === 1 && /^component\s+/i.test(u[0]))
2561
+ if (u.length === 1 && Pe(u[0]) || u.length === 1 && ue(u[0]) || u.length === 1 && /^include\s+/i.test(u[0]) || u.length === 1 && /^component\s+/i.test(u[0]))
2454
2562
  continue;
2455
- const f = zt(l.inner, n);
2563
+ const f = Kt(l.inner, n);
2456
2564
  if (f) {
2457
2565
  if (f.declarationsSource.trim().length > 0) {
2458
- const N = ve(
2566
+ const N = ye(
2459
2567
  f.declarationsSource,
2460
2568
  n
2461
2569
  );
2462
- await we(N, r, {
2570
+ await be(N, r, {
2463
2571
  path: n,
2464
2572
  constBindings: s,
2465
2573
  onUpdate: a
2466
2574
  });
2467
2575
  }
2468
- const C = l.start - h, L = l.end - h, j = `<!--@hg
2576
+ const W = l.start - h, L = l.end - h, j = `<!--@hg
2469
2577
  extend ${f.path}
2470
2578
  @endhg-->`;
2471
- c = c.slice(0, C) + j + c.slice(L), h += l.raw.length - j.length;
2579
+ c = c.slice(0, W) + j + c.slice(L), h += l.raw.length - j.length;
2472
2580
  continue;
2473
2581
  }
2474
2582
  const g = u.join(`
2475
2583
  `);
2476
- if (!Ve(g)) {
2584
+ if (!Ke(g)) {
2477
2585
  if (u.length === 1)
2478
2586
  continue;
2479
2587
  throw d({
@@ -2482,25 +2590,25 @@ extend ${f.path}
2482
2590
  details: { message: `unsupported hyogen directive: ${u[0]}` }
2483
2591
  });
2484
2592
  }
2485
- const m = ve(g, n), p = [];
2486
- await we(m, r, {
2593
+ const m = ye(g, n), p = [];
2594
+ await be(m, r, {
2487
2595
  path: n,
2488
2596
  constBindings: s,
2489
2597
  onUpdate: a,
2490
2598
  echoChunks: p
2491
2599
  });
2492
- const S = l.start - h, D = l.end - h, v = c.slice(0, S), b = c.slice(D);
2600
+ const v = l.start - h, D = l.end - h, b = c.slice(0, v), y = c.slice(D);
2493
2601
  if (p.length > 0) {
2494
- const C = p.join("");
2495
- c = v + C + b, h += l.raw.length - C.length;
2602
+ const W = p.join("");
2603
+ c = b + W + y, h += l.raw.length - W.length;
2496
2604
  } else
2497
- c = T(v, b), h += l.raw.length + se(v, b);
2605
+ c = T(b, y), h += l.raw.length + ae(b, y);
2498
2606
  }
2499
2607
  return { source: c, context: r, declarationUpdates: o };
2500
2608
  }
2501
- const qt = /^component\s+(\S+)\s+as\s+([A-Za-z_$][A-Za-z0-9_$]*)\s*$/;
2502
- function Vt(t, e) {
2503
- const n = te(t).trim();
2609
+ const Gt = /^component\s+(\S+)\s+as\s+([A-Za-z_$][A-Za-z0-9_$]*)\s*$/;
2610
+ function Jt(t, e) {
2611
+ const n = re(t).trim();
2504
2612
  if (n.length === 0)
2505
2613
  throw d({
2506
2614
  code: "parse_error",
@@ -2523,7 +2631,7 @@ function Vt(t, e) {
2523
2631
  path: e,
2524
2632
  details: { message: "include and component cannot coexist in one block" }
2525
2633
  });
2526
- const s = qt.exec(i);
2634
+ const s = Gt.exec(i);
2527
2635
  if (!s)
2528
2636
  throw d({
2529
2637
  code: "parse_error",
@@ -2543,8 +2651,8 @@ function Vt(t, e) {
2543
2651
  alias: s[2]
2544
2652
  };
2545
2653
  }
2546
- function Kt(t, e) {
2547
- const n = te(t).trim();
2654
+ function Qt(t, e) {
2655
+ const n = re(t).trim();
2548
2656
  if (n.length === 0)
2549
2657
  throw d({
2550
2658
  code: "parse_error",
@@ -2567,19 +2675,19 @@ function Kt(t, e) {
2567
2675
  details: { message: `unsupported hyogen directive: ${i}` }
2568
2676
  });
2569
2677
  }
2570
- function Yt(t) {
2571
- const e = oe(t).trim();
2678
+ function en(t) {
2679
+ const e = ce(t).trim();
2572
2680
  return e.length === 0 ? !1 : /^const\s+/.test(e) || /^let\s+/.test(e) || /^[A-Za-z_$][A-Za-z0-9_$]*\s*=/.test(e);
2573
2681
  }
2574
- const Xt = "\0HYOGEN_INCLUDE_";
2575
- function Gt(t) {
2576
- return `${Xt}${t}\0`;
2682
+ const tn = "\0HYOGEN_INCLUDE_";
2683
+ function nn(t) {
2684
+ return `${tn}${t}\0`;
2577
2685
  }
2578
- function Jt(t, e) {
2686
+ function rn(t, e) {
2579
2687
  const n = A(t);
2580
- if (n.length === 1 && je(n[0]))
2688
+ if (n.length === 1 && Pe(n[0]))
2581
2689
  return { kind: "control" };
2582
- if (n.length === 1 && le(n[0]) || n.length === 1 && (Yt(n[0]) || Ve(n[0])))
2690
+ if (n.length === 1 && ue(n[0]) || n.length === 1 && (en(n[0]) || Ke(n[0])))
2583
2691
  return null;
2584
2692
  if (n.length !== 1)
2585
2693
  throw d({
@@ -2595,9 +2703,9 @@ function Jt(t, e) {
2595
2703
  details: { message: "include and component cannot coexist in one block" }
2596
2704
  });
2597
2705
  if (/^include\s+/i.test(r))
2598
- return Kt(t, e);
2706
+ return Qt(t, e);
2599
2707
  if (/^component\s+/i.test(r))
2600
- return Vt(t, e);
2708
+ return Jt(t, e);
2601
2709
  if (r === "endblock" || /^block\s+/.test(r) || /^extend\s+/.test(r))
2602
2710
  return null;
2603
2711
  throw d({
@@ -2606,14 +2714,14 @@ function Jt(t, e) {
2606
2714
  details: { message: `unsupported hyogen directive: ${r}` }
2607
2715
  });
2608
2716
  }
2609
- function Qt(t, e = {}) {
2717
+ function sn(t, e = {}) {
2610
2718
  const n = e.path;
2611
- if (Be(t))
2719
+ if (Fe(t))
2612
2720
  throw d({
2613
2721
  code: "parse_error",
2614
2722
  path: n,
2615
2723
  details: {
2616
- message: Fe(t) ?? "unclosed hyogen block (missing closing marker)"
2724
+ message: je(t) ?? "unclosed hyogen block (missing closing marker)"
2617
2725
  }
2618
2726
  });
2619
2727
  const r = E(t);
@@ -2622,7 +2730,7 @@ function Qt(t, e = {}) {
2622
2730
  const i = [];
2623
2731
  let s = t, o = 0, a = 0;
2624
2732
  for (const c of r) {
2625
- const h = Jt(c.inner, n);
2733
+ const h = rn(c.inner, n);
2626
2734
  if (!h || h.kind === "control")
2627
2735
  continue;
2628
2736
  const l = c.start - o, u = c.end - o;
@@ -2637,20 +2745,20 @@ function Qt(t, e = {}) {
2637
2745
  n
2638
2746
  );
2639
2747
  const g = s.slice(0, l), m = s.slice(u);
2640
- s = T(g, m), o += c.raw.length + se(g, m);
2748
+ s = T(g, m), o += c.raw.length + ae(g, m);
2641
2749
  continue;
2642
2750
  }
2643
- const f = Gt(a++);
2751
+ const f = nn(a++);
2644
2752
  i.push({ ...h, marker: f, raw: c.raw }), s = s.slice(0, l) + f + s.slice(u), o += c.raw.length - f.length;
2645
2753
  }
2646
2754
  return { source: s, directives: i };
2647
2755
  }
2648
- function en(t, e) {
2756
+ function on(t, e) {
2649
2757
  return !e.preserveFrontMatter || !e.rawFrontMatter ? t : t.length === 0 ? `${e.rawFrontMatter}
2650
2758
  ` : `${e.rawFrontMatter}
2651
2759
  ${t}`;
2652
2760
  }
2653
- function tn(t, e = !1) {
2761
+ function an(t, e = !1) {
2654
2762
  if (e)
2655
2763
  return t;
2656
2764
  const n = E(t);
@@ -2659,16 +2767,16 @@ function tn(t, e = !1) {
2659
2767
  let r = t, i = 0;
2660
2768
  for (const s of n) {
2661
2769
  const o = s.start - i, a = s.end - i, c = r.slice(0, o), h = r.slice(a);
2662
- r = T(c, h), i += s.raw.length + se(c, h);
2770
+ r = T(c, h), i += s.raw.length + ae(c, h);
2663
2771
  }
2664
2772
  return r;
2665
2773
  }
2666
- const nn = /^block\s+([A-Za-z_$][A-Za-z0-9_$]*)$/;
2667
- function rn(t, e) {
2774
+ const cn = /^block\s+([A-Za-z_$][A-Za-z0-9_$]*)$/;
2775
+ function ln(t, e) {
2668
2776
  const n = t.trim();
2669
2777
  if (n === "endblock")
2670
2778
  return { kind: "endblock" };
2671
- const r = nn.exec(n);
2779
+ const r = cn.exec(n);
2672
2780
  if (!r)
2673
2781
  throw d({
2674
2782
  code: "parse_error",
@@ -2676,7 +2784,7 @@ function rn(t, e) {
2676
2784
  details: { message: "invalid block directive" }
2677
2785
  });
2678
2786
  const i = r[1];
2679
- if (qe(i))
2787
+ if (Ve(i))
2680
2788
  throw d({
2681
2789
  code: "parse_error",
2682
2790
  path: e,
@@ -2684,7 +2792,7 @@ function rn(t, e) {
2684
2792
  });
2685
2793
  return { kind: "block", name: i };
2686
2794
  }
2687
- function be(t, e) {
2795
+ function _e(t, e) {
2688
2796
  const { path: n, mode: r, hasExtend: i = !1 } = e, s = E(t);
2689
2797
  if (s.length === 0) return [];
2690
2798
  const o = [], a = [], c = /* @__PURE__ */ new Set();
@@ -2699,7 +2807,7 @@ function be(t, e) {
2699
2807
  path: n,
2700
2808
  details: { message: "orphan block without extend" }
2701
2809
  });
2702
- const g = rn(u, n);
2810
+ const g = ln(u, n);
2703
2811
  if (g.kind === "endblock") {
2704
2812
  const m = a.pop();
2705
2813
  if (!m)
@@ -2743,17 +2851,17 @@ function be(t, e) {
2743
2851
  });
2744
2852
  return o;
2745
2853
  }
2746
- function ye(t) {
2854
+ function Se(t) {
2747
2855
  const e = E(t), n = [];
2748
2856
  for (const r of e) {
2749
2857
  const i = A(r.inner);
2750
2858
  if (i.length === 0) continue;
2751
- const s = ce(i[0]);
2859
+ const s = he(i[0]);
2752
2860
  s && n.push({ path: s.path, start: r.start });
2753
2861
  }
2754
2862
  return n;
2755
2863
  }
2756
- function sn(t) {
2864
+ function hn(t) {
2757
2865
  const e = E(t);
2758
2866
  for (const n of e) {
2759
2867
  const r = A(n.inner);
@@ -2766,14 +2874,14 @@ function sn(t) {
2766
2874
  function Y(t) {
2767
2875
  return t.map((e) => e.body).join("");
2768
2876
  }
2769
- function on(t, e, n) {
2877
+ function un(t, e, n) {
2770
2878
  const r = [...e].sort((o, a) => o.start - a.start), i = [];
2771
2879
  let s = 0;
2772
2880
  for (const o of r)
2773
2881
  i.push(t.slice(s, o.start)), i.push(n.get(o.name) ?? o.body), s = o.end;
2774
2882
  return i.push(t.slice(s)), i.reduce((o, a) => T(o, a));
2775
2883
  }
2776
- function an(t) {
2884
+ function dn(t) {
2777
2885
  if (t instanceof Error && "code" in t && "details" in t) {
2778
2886
  const e = t;
2779
2887
  if (e.code === "file_not_found" && e.details && e.details.via === "include")
@@ -2781,7 +2889,7 @@ function an(t) {
2781
2889
  }
2782
2890
  return { errorToThrow: t, adjusted: !1 };
2783
2891
  }
2784
- async function cn(t, e) {
2892
+ async function fn(t, e) {
2785
2893
  const {
2786
2894
  path: n,
2787
2895
  context: r,
@@ -2792,23 +2900,23 @@ async function cn(t, e) {
2792
2900
  visitStack: c,
2793
2901
  warnings: h,
2794
2902
  inComponent: l = !1
2795
- } = e, u = ye(t);
2903
+ } = e, u = Se(t);
2796
2904
  if (u.length === 0) {
2797
- if (sn(t))
2905
+ if (hn(t))
2798
2906
  throw d({
2799
2907
  code: "parse_error",
2800
2908
  path: n,
2801
2909
  details: { message: "orphan block without extend" }
2802
2910
  });
2803
- return { source: t, context: _(r, i) };
2911
+ return { source: t, context: S(r, i) };
2804
2912
  }
2805
2913
  const g = E(t)[0];
2806
2914
  if (!g)
2807
- return { source: t, context: _(r, i) };
2915
+ return { source: t, context: S(r, i) };
2808
2916
  if (!s)
2809
2917
  throw new Error("loader is required when processing extend directives");
2810
2918
  const m = A(g.inner);
2811
- if (!(m.length > 0 ? ce(m[0]) : null))
2919
+ if (!(m.length > 0 ? he(m[0]) : null))
2812
2920
  throw d({
2813
2921
  code: "parse_error",
2814
2922
  path: n,
@@ -2820,7 +2928,7 @@ async function cn(t, e) {
2820
2928
  path: n,
2821
2929
  details: { message: "multiple extend directives are not supported" }
2822
2930
  });
2823
- const S = be(t, {
2931
+ const v = _e(t, {
2824
2932
  path: n,
2825
2933
  mode: "child",
2826
2934
  hasExtend: !0
@@ -2832,10 +2940,10 @@ async function cn(t, e) {
2832
2940
  path: n,
2833
2941
  details: { path: n }
2834
2942
  }), {
2835
- source: Y(S),
2836
- context: _(r, i)
2943
+ source: Y(v),
2944
+ context: S(r, i)
2837
2945
  };
2838
- const D = u[0].path, v = n, b = X(
2946
+ const D = u[0].path, b = n, y = X(
2839
2947
  o,
2840
2948
  D,
2841
2949
  n,
@@ -2843,38 +2951,38 @@ async function cn(t, e) {
2843
2951
  a,
2844
2952
  !0
2845
2953
  );
2846
- v && c.push(v);
2954
+ b && c.push(b);
2847
2955
  try {
2848
- const C = v ? c.check(b) : { circular: !1 };
2849
- if (C.circular)
2956
+ const W = b ? c.check(y) : { circular: !1 };
2957
+ if (W.circular)
2850
2958
  return h?.push({
2851
2959
  code: "circular_include",
2852
2960
  message: H("circular_include", {
2853
- path: b,
2854
- from: C.from,
2961
+ path: y,
2962
+ from: W.from,
2855
2963
  via: "extend"
2856
2964
  }),
2857
2965
  path: n,
2858
- details: { path: b, from: C.from, via: "extend" }
2966
+ details: { path: y, from: W.from, via: "extend" }
2859
2967
  }), {
2860
- source: Y(S),
2861
- context: _(r, i)
2968
+ source: Y(v),
2969
+ context: S(r, i)
2862
2970
  };
2863
- c.push(b);
2971
+ c.push(y);
2864
2972
  try {
2865
- const L = await s(b);
2973
+ const L = await s(y);
2866
2974
  if (L === void 0)
2867
2975
  throw new Error("loader returned undefined");
2868
2976
  const { context: j, body: N } = I(
2869
2977
  L,
2870
- b
2871
- ), ue = ye(N);
2872
- if (ue.length > 0) {
2873
- const P = ue[0].path, z = X(
2978
+ y
2979
+ ), fe = Se(N);
2980
+ if (fe.length > 0) {
2981
+ const P = fe[0].path, z = X(
2874
2982
  o,
2875
2983
  P,
2876
- b,
2877
- b,
2984
+ y,
2985
+ y,
2878
2986
  a,
2879
2987
  !0
2880
2988
  ), U = c.check(z);
@@ -2889,41 +2997,41 @@ async function cn(t, e) {
2889
2997
  path: n,
2890
2998
  details: { path: z, from: U.from, via: "extend" }
2891
2999
  }), {
2892
- source: Y(S),
2893
- context: _(r, i)
3000
+ source: Y(v),
3001
+ context: S(r, i)
2894
3002
  };
2895
3003
  throw d({
2896
3004
  code: "parse_error",
2897
- path: b,
3005
+ path: y,
2898
3006
  details: { message: "layout extend is not supported" }
2899
3007
  });
2900
3008
  }
2901
- const Ke = be(N, {
2902
- path: b,
3009
+ const Ye = _e(N, {
3010
+ path: y,
2903
3011
  mode: "layout"
2904
- }), Ye = new Map(
2905
- S.map((P) => [P.name, P.body])
2906
- ), Xe = on(
3012
+ }), Xe = new Map(
3013
+ v.map((P) => [P.name, P.body])
3014
+ ), Ge = un(
2907
3015
  N,
2908
- Ke,
2909
- Ye
2910
- ), Ge = _(
3016
+ Ye,
3017
+ Xe
3018
+ ), Je = S(
2911
3019
  r,
2912
3020
  j,
2913
3021
  i
2914
3022
  );
2915
- return { source: Xe, context: Ge };
3023
+ return { source: Ge, context: Je };
2916
3024
  } finally {
2917
3025
  c.pop();
2918
3026
  }
2919
- } catch (C) {
2920
- const L = an(C);
2921
- throw L.adjusted ? L.errorToThrow : C;
3027
+ } catch (W) {
3028
+ const L = dn(W);
3029
+ throw L.adjusted ? L.errorToThrow : W;
2922
3030
  } finally {
2923
- v && c.pop();
3031
+ b && c.pop();
2924
3032
  }
2925
3033
  }
2926
- const ln = Q.warningReasons, hn = [
3034
+ const pn = Q.warningReasons, mn = [
2927
3035
  {
2928
3036
  reason: "contains_html_script_tag",
2929
3037
  test: (t) => /<\/?script\b/i.test(t)
@@ -2945,17 +3053,17 @@ const ln = Q.warningReasons, hn = [
2945
3053
  test: (t) => /<meta\b[^>]*\bhttp-equiv\b/i.test(t)
2946
3054
  }
2947
3055
  ];
2948
- function un(t) {
2949
- return ln[t] ?? t;
3056
+ function gn(t) {
3057
+ return pn[t] ?? t;
2950
3058
  }
2951
3059
  function G(t, e, n, r) {
2952
3060
  if (typeof t == "string") {
2953
- for (const i of hn)
3061
+ for (const i of mn)
2954
3062
  i.test(t) && n.push({
2955
3063
  code: "suspicious_context_value",
2956
3064
  message: H("suspicious_context_value", {
2957
3065
  key: e,
2958
- reason: un(i.reason)
3066
+ reason: gn(i.reason)
2959
3067
  }),
2960
3068
  path: r,
2961
3069
  details: { key: e, reason: i.reason }
@@ -2977,19 +3085,19 @@ function G(t, e, n, r) {
2977
3085
  }
2978
3086
  }
2979
3087
  }
2980
- function dn(t, e, n) {
3088
+ function xn(t, e, n) {
2981
3089
  for (const [r, i] of Object.entries(t))
2982
3090
  G(i, r, e, n);
2983
3091
  }
2984
- const fn = /^=+[ \t]*$/, pn = /^-+[ \t]*$/, mn = /^(```|~~~)/, gn = /\{#([A-Za-z][\w:.-]*)\}\s*$/;
3092
+ const wn = /^=+[ \t]*$/, kn = /^-+[ \t]*$/, vn = /^(```|~~~)/, bn = /\{#([A-Za-z][\w:.-]*)\}\s*$/;
2985
3093
  function J(t) {
2986
- const e = gn.exec(t);
3094
+ const e = bn.exec(t);
2987
3095
  return e && e.index !== void 0 ? {
2988
3096
  text: t.slice(0, e.index).trim(),
2989
3097
  explicitId: e[1]
2990
3098
  } : { text: t.trim() };
2991
3099
  }
2992
- function xn(t) {
3100
+ function yn(t) {
2993
3101
  let e = 0;
2994
3102
  for (; e < t.length && e < 6 && t[e] === "#"; )
2995
3103
  e += 1;
@@ -3020,7 +3128,7 @@ function xn(t) {
3020
3128
  const s = J(t.slice(n, i));
3021
3129
  return { level: e, ...s };
3022
3130
  }
3023
- function _e(t, e, n) {
3131
+ function Ce(t, e, n) {
3024
3132
  let r = n;
3025
3133
  for (; r < t.length; ) {
3026
3134
  if (!e.inHtmlComment) {
@@ -3036,13 +3144,13 @@ function _e(t, e, n) {
3036
3144
  e.inHtmlComment = !1, r = i + 3;
3037
3145
  }
3038
3146
  }
3039
- function kn(t, e) {
3147
+ function _n(t, e) {
3040
3148
  if (e.inFence || e.inHtmlComment)
3041
3149
  return !0;
3042
3150
  const n = t.trim();
3043
3151
  return !!(n.startsWith("<!--") && n.endsWith("-->") && n.length >= 7 || n.startsWith("<!--") && !n.includes("-->"));
3044
3152
  }
3045
- function wn(t) {
3153
+ function Sn(t) {
3046
3154
  const e = t.split(/\r?\n/), n = [], r = { inFence: !1, inHtmlComment: !1 };
3047
3155
  for (let i = 0; i < e.length; i++) {
3048
3156
  const s = e[i];
@@ -3052,34 +3160,34 @@ function wn(t) {
3052
3160
  continue;
3053
3161
  }
3054
3162
  if (r.inHtmlComment) {
3055
- _e(s, r, 0);
3163
+ Ce(s, r, 0);
3056
3164
  continue;
3057
3165
  }
3058
- const o = mn.exec(s.trimStart());
3166
+ const o = vn.exec(s.trimStart());
3059
3167
  if (o) {
3060
3168
  const l = o[1];
3061
3169
  s.trimStart().slice(l.length).includes(l) || (r.inFence = { marker: l });
3062
3170
  continue;
3063
3171
  }
3064
3172
  if (s.trim().startsWith("<!--")) {
3065
- _e(s, r, s.indexOf("<!--"));
3173
+ Ce(s, r, s.indexOf("<!--"));
3066
3174
  continue;
3067
3175
  }
3068
- if (kn(s, r))
3176
+ if (_n(s, r))
3069
3177
  continue;
3070
- const c = xn(s);
3178
+ const c = yn(s);
3071
3179
  if (c) {
3072
3180
  n.push(c);
3073
3181
  continue;
3074
3182
  }
3075
3183
  const h = e[i + 1];
3076
3184
  if (h !== void 0 && s.trim().length > 0 && !s.trimStart().startsWith("#") && !s.trimStart().startsWith(">") && !s.trimStart().startsWith("|")) {
3077
- if (fn.test(h)) {
3185
+ if (wn.test(h)) {
3078
3186
  const l = J(s.trim());
3079
3187
  n.push({ level: 1, ...l }), i += 1;
3080
3188
  continue;
3081
3189
  }
3082
- if (pn.test(h) && h.trim().length >= 1) {
3190
+ if (kn.test(h) && h.trim().length >= 1) {
3083
3191
  const l = J(s.trim());
3084
3192
  n.push({ level: 2, ...l }), i += 1;
3085
3193
  continue;
@@ -3088,31 +3196,31 @@ function wn(t) {
3088
3196
  }
3089
3197
  return n;
3090
3198
  }
3091
- const vn = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g;
3092
- function bn() {
3199
+ const Cn = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g;
3200
+ function Wn() {
3093
3201
  const t = /* @__PURE__ */ new Map();
3094
3202
  return {
3095
3203
  slug(e, n) {
3096
- const r = n !== void 0 && n.length > 0 ? n : yn(e), i = t.get(r) ?? 0;
3204
+ const r = n !== void 0 && n.length > 0 ? n : $n(e), i = t.get(r) ?? 0;
3097
3205
  return t.set(r, i + 1), i === 0 ? r : `${r}-${i}`;
3098
3206
  }
3099
3207
  };
3100
3208
  }
3101
- function yn(t) {
3102
- return t.toLowerCase().replace(vn, "").replace(/\s+/g, "-");
3209
+ function $n(t) {
3210
+ return t.toLowerCase().replace(Cn, "").replace(/\s+/g, "-");
3103
3211
  }
3104
- function _n(t) {
3212
+ function An(t) {
3105
3213
  let e = t.trim();
3106
3214
  e = e.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1"), e = e.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1"), e = e.replace(/\[([^\]]+)\]\[[^\]]*\]/g, "$1");
3107
3215
  for (let n = 0; n < 3; n++)
3108
3216
  e = e.replace(/\*\*([^*]+)\*\*/g, "$1"), e = e.replace(/__([^_]+)__/g, "$1"), e = e.replace(/~~([^~]+)~~/g, "$1"), e = e.replace(/\*([^*]+)\*/g, "$1"), e = e.replace(/_([^_]+)_/g, "$1"), e = e.replace(/`([^`]+)`/g, "$1");
3109
3217
  return e.trim();
3110
3218
  }
3111
- function Sn(t, e) {
3219
+ function En(t, e) {
3112
3220
  if (t.length === 0)
3113
3221
  return "";
3114
- const n = bn(), i = t.map((o) => {
3115
- const a = _n(o.text), c = n.slug(a, o.explicitId);
3222
+ const n = Wn(), i = t.map((o) => {
3223
+ const a = An(o.text), c = n.slug(a, o.explicitId);
3116
3224
  return { level: o.level, text: a, anchor: c };
3117
3225
  }).filter((o) => o.level <= e);
3118
3226
  if (i.length === 0)
@@ -3121,32 +3229,32 @@ function Sn(t, e) {
3121
3229
  return i.map((o) => `${" ".repeat((o.level - s) * 2)}- [${o.text}](#${o.anchor})`).join(`
3122
3230
  `);
3123
3231
  }
3124
- function Cn(t, e = {}) {
3232
+ function Tn(t, e = {}) {
3125
3233
  const r = E(t).filter((o) => {
3126
3234
  const a = A(o.inner);
3127
- return a.length === 1 && le(a[0]);
3235
+ return a.length === 1 && ue(a[0]);
3128
3236
  });
3129
3237
  if (r.length === 0)
3130
3238
  return t;
3131
- const i = wn(t);
3239
+ const i = Sn(t);
3132
3240
  let s = t;
3133
3241
  for (let o = r.length - 1; o >= 0; o--) {
3134
- const a = r[o], { maxLevel: c } = Ut(a.inner, e.path), h = Sn(i, c), l = s.slice(0, a.start), u = s.slice(a.end);
3242
+ const a = r[o], { maxLevel: c } = Yt(a.inner, e.path), h = En(i, c), l = s.slice(0, a.start), u = s.slice(a.end);
3135
3243
  s = T(T(l, h), u);
3136
3244
  }
3137
3245
  return s;
3138
3246
  }
3139
- async function he(t, e) {
3140
- const n = e.path, r = e.context, i = e.registry ?? new Ce(), s = e.warnings ?? [], o = e.visitStack ?? new Ze(), {
3247
+ async function de(t, e) {
3248
+ const n = e.path, r = e.context, i = e.registry ?? new $e(), s = e.warnings ?? [], o = e.visitStack ?? new qe(), {
3141
3249
  source: a,
3142
3250
  declarationUpdates: c
3143
- } = await Zt(t, { path: n, context: { ...r } });
3144
- dn(
3145
- _(r, c ?? {}),
3251
+ } = await Xt(t, { path: n, context: { ...r } });
3252
+ xn(
3253
+ S(r, c ?? {}),
3146
3254
  s,
3147
3255
  n
3148
3256
  );
3149
- const h = await cn(a, {
3257
+ const h = await fn(a, {
3150
3258
  path: n,
3151
3259
  context: r,
3152
3260
  declarationUpdates: c ?? {},
@@ -3156,7 +3264,7 @@ async function he(t, e) {
3156
3264
  visitStack: o,
3157
3265
  warnings: s,
3158
3266
  inComponent: e.inComponent ?? !1
3159
- }), { source: l, context: u } = h, { source: f, directives: g } = Qt(l, {
3267
+ }), { source: l, context: u } = h, { source: f, directives: g } = sn(l, {
3160
3268
  path: n,
3161
3269
  registry: i,
3162
3270
  context: u
@@ -3164,7 +3272,7 @@ async function he(t, e) {
3164
3272
  if (g.length > 0 && !m)
3165
3273
  throw new Error("loader is required when processing include directives");
3166
3274
  let p = f;
3167
- return g.length > 0 && m && (p = await Ft({
3275
+ g.length > 0 && m && (p = await Ut({
3168
3276
  source: f,
3169
3277
  directives: g,
3170
3278
  context: u,
@@ -3177,7 +3285,7 @@ async function he(t, e) {
3177
3285
  warnings: s,
3178
3286
  registry: i,
3179
3287
  constrainToRoot: e.constrainToRoot
3180
- })), p = await Ht(p, {
3288
+ })), p = await jt(p, {
3181
3289
  context: u,
3182
3290
  path: n,
3183
3291
  registry: i,
@@ -3188,7 +3296,8 @@ async function he(t, e) {
3188
3296
  parentContext: u,
3189
3297
  preserveHgComments: e.preserveHgComments,
3190
3298
  constrainToRoot: e.constrainToRoot
3191
- }), p = await Ne(p, u, {
3299
+ });
3300
+ const v = {
3192
3301
  path: n,
3193
3302
  registry: i,
3194
3303
  loader: m,
@@ -3198,21 +3307,26 @@ async function he(t, e) {
3198
3307
  parentContext: u,
3199
3308
  preserveHgComments: e.preserveHgComments,
3200
3309
  constrainToRoot: e.constrainToRoot
3201
- }), p = Cn(p, { path: n }), p = tn(p, e.preserveHgComments), p;
3202
- }
3203
- async function Wn(t, e = {}) {
3204
- const n = e.path, r = _(e.context), i = e.registry ?? new Ce(), s = e.warnings ?? [], o = e.visitStack ?? new Ze(), { context: a, body: c, rawFrontMatter: h } = I(
3310
+ };
3311
+ return p = await Ne(p, u, v), p = await Be(
3312
+ p,
3313
+ u,
3314
+ v
3315
+ ), p = Tn(p, { path: n }), p = an(p, e.preserveHgComments), p;
3316
+ }
3317
+ async function Ln(t, e = {}) {
3318
+ const n = e.path, r = S(e.context), i = e.registry ?? new $e(), s = e.warnings ?? [], o = e.visitStack ?? new qe(), { context: a, body: c, rawFrontMatter: h } = I(
3205
3319
  t,
3206
3320
  n
3207
- ), l = _(r, a);
3208
- let u = await he(c, {
3321
+ ), l = S(r, a);
3322
+ let u = await de(c, {
3209
3323
  ...e,
3210
3324
  context: l,
3211
3325
  registry: i,
3212
3326
  warnings: s,
3213
3327
  visitStack: o
3214
3328
  });
3215
- return u = en(u, {
3329
+ return u = on(u, {
3216
3330
  preserveFrontMatter: e.preserveFrontMatter,
3217
3331
  rawFrontMatter: h
3218
3332
  }), {
@@ -3220,15 +3334,15 @@ async function Wn(t, e = {}) {
3220
3334
  warnings: s
3221
3335
  };
3222
3336
  }
3223
- async function $n(t, e) {
3224
- const n = e.path, { context: r, body: i } = I(t, n), s = _(e.context, r);
3225
- return he(i, {
3337
+ async function Mn(t, e) {
3338
+ const n = e.path, { context: r, body: i } = I(t, n), s = S(e.context, r);
3339
+ return de(i, {
3226
3340
  ...e,
3227
3341
  context: s,
3228
3342
  preserveFrontMatter: !1
3229
3343
  });
3230
3344
  }
3231
- async function En(t, e, n) {
3345
+ async function Rn(t, e, n) {
3232
3346
  if (n != null && "serverContext" in n && n.serverContext != null)
3233
3347
  throw d({
3234
3348
  code: "server_context_on_client"
@@ -3245,8 +3359,8 @@ async function En(t, e, n) {
3245
3359
  });
3246
3360
  let i, s;
3247
3361
  typeof t == "string" ? i = t : (s = t.path, i = await r(t.path));
3248
- const o = _(e);
3249
- return Wn(i, {
3362
+ const o = S(e);
3363
+ return Ln(i, {
3250
3364
  context: o,
3251
3365
  loader: r,
3252
3366
  root: n?.root,
@@ -3256,7 +3370,7 @@ async function En(t, e, n) {
3256
3370
  constrainToRoot: n?.constrainToRoot
3257
3371
  });
3258
3372
  }
3259
- function Tn(t, e) {
3373
+ function Hn(t, e) {
3260
3374
  const n = [`[hyogen:${t}] ${e.code}`], r = {};
3261
3375
  if (e.details)
3262
3376
  for (const [i, s] of Object.entries(e.details))
@@ -3269,8 +3383,8 @@ function Tn(t, e) {
3269
3383
  }
3270
3384
  export {
3271
3385
  d as createHyogenError,
3272
- Tn as formatDiagnosticLog,
3273
- it as formatMessage,
3274
- En as renderClient
3386
+ Hn as formatDiagnosticLog,
3387
+ st as formatMessage,
3388
+ Rn as renderClient
3275
3389
  };
3276
3390
  //# sourceMappingURL=client.js.map