@b4moss/hyogen-md 0.10.1 → 0.11.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
@@ -5,10 +5,10 @@ const He = { file_not_found: "File not found: {path} (referenced from {from} via
5
5
  warningReasons: Fe
6
6
  }, Ie = J.errors, ze = J.warnings;
7
7
  function we(t, e) {
8
- return t === void 0 ? "" : t.replace(/\{([^}]+)\}/g, (n, i) => {
9
- if (e === void 0 || !(i in e))
8
+ return t === void 0 ? "" : t.replace(/\{([^}]+)\}/g, (n, r) => {
9
+ if (e === void 0 || !(r in e))
10
10
  return n;
11
- const s = e[i];
11
+ const s = e[r];
12
12
  return s == null ? "" : String(s);
13
13
  });
14
14
  }
@@ -30,17 +30,17 @@ function _(...t) {
30
30
  }
31
31
  class be {
32
32
  components = /* @__PURE__ */ new Map();
33
- register(e, n, i) {
33
+ register(e, n, r) {
34
34
  if (this.components.has(e.alias))
35
35
  throw u({
36
36
  code: "duplicate_component_alias",
37
- path: i ?? e.definedAt,
37
+ path: r ?? e.definedAt,
38
38
  details: { alias: e.alias }
39
39
  });
40
40
  if (n.includes(e.alias))
41
41
  throw u({
42
42
  code: "alias_collision",
43
- path: i ?? e.definedAt,
43
+ path: r ?? e.definedAt,
44
44
  details: { alias: e.alias }
45
45
  });
46
46
  this.components.set(e.alias, e);
@@ -60,17 +60,17 @@ function H(t, e) {
60
60
  `);
61
61
  if (n === -1)
62
62
  return { context: {}, body: t };
63
- const i = t.indexOf(`
63
+ const r = t.indexOf(`
64
64
  ---`, n);
65
- if (i === -1)
65
+ if (r === -1)
66
66
  return { context: {}, body: t };
67
- const s = t.slice(n + 1, i), r = Buffer.byteLength(s, "utf8");
68
- if (r > le)
67
+ const s = t.slice(n + 1, r), i = Buffer.byteLength(s, "utf8");
68
+ if (i > le)
69
69
  throw u({
70
70
  code: "frontmatter_too_large",
71
71
  path: e,
72
72
  details: {
73
- size: r,
73
+ size: i,
74
74
  limit: le
75
75
  }
76
76
  });
@@ -98,7 +98,7 @@ function H(t, e) {
98
98
  }
99
99
  });
100
100
  }
101
- const a = i + 4;
101
+ const a = r + 4;
102
102
  let c = t.slice(a);
103
103
  return c.startsWith(`
104
104
  `) ? c = c.slice(1) : c.startsWith(`\r
@@ -127,20 +127,20 @@ function qe(t, e) {
127
127
  path: e,
128
128
  details: { message: "props must be a YAML mapping" }
129
129
  });
130
- const i = {};
131
- for (const [s, r] of Object.entries(n)) {
132
- if (typeof r != "object" || r === null || Array.isArray(r)) {
133
- i[s] = {};
130
+ const r = {};
131
+ for (const [s, i] of Object.entries(n)) {
132
+ if (typeof i != "object" || i === null || Array.isArray(i)) {
133
+ r[s] = {};
134
134
  continue;
135
135
  }
136
- const o = r, a = {};
136
+ const o = i, a = {};
137
137
  if ("type" in o && o.type !== void 0) {
138
138
  const c = String(o.type);
139
139
  Ze.has(c) ? a.type = c : a.type = void 0;
140
140
  }
141
- "isRequired" in o && (a.isRequired = !!o.isRequired), "default" in o && (a.default = o.default), i[s] = a;
141
+ "isRequired" in o && (a.isRequired = !!o.isRequired), "default" in o && (a.default = o.default), r[s] = a;
142
142
  }
143
- return i;
143
+ return r;
144
144
  }
145
145
  function Ve(t) {
146
146
  if (t != null) {
@@ -162,18 +162,18 @@ function U(t, e) {
162
162
  };
163
163
  }
164
164
  function Ye(t, e, n) {
165
- const i = [], s = {}, r = new Set(Object.keys(e));
165
+ const r = [], s = {}, i = 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);
168
168
  let h = c ? t[o] : void 0;
169
- if (c || (a.default !== void 0 ? h = a.default : (a.isRequired && i.push(
169
+ if (c || (a.default !== void 0 ? h = a.default : (a.isRequired && r.push(
170
170
  U("prop_missing", {
171
171
  prop: o,
172
172
  component: n
173
173
  })
174
174
  ), h = void 0)), c && h !== void 0 && h !== null) {
175
175
  const l = a.type ?? Ve(h);
176
- l && !Ke(h, l) && (i.push(
176
+ l && !Ke(h, l) && (r.push(
177
177
  U("prop_type_mismatch", {
178
178
  prop: o,
179
179
  component: n,
@@ -185,13 +185,13 @@ function Ye(t, e, n) {
185
185
  s[o] = h;
186
186
  }
187
187
  for (const o of Object.keys(t))
188
- r.has(o) || (Object.keys(e).length > 0 ? i.push(
188
+ i.has(o) || (Object.keys(e).length > 0 ? r.push(
189
189
  U("prop_unknown", {
190
190
  prop: o,
191
191
  component: n
192
192
  })
193
193
  ) : s[o] = t[o]);
194
- return { values: s, warnings: i };
194
+ return { values: s, warnings: r };
195
195
  }
196
196
  function ye(t) {
197
197
  return /^https?:\/\//i.test(t);
@@ -207,7 +207,7 @@ function Je() {
207
207
  if (typeof s != "string")
208
208
  throw new TypeError("Path must be a string. Received " + JSON.stringify(s));
209
209
  }
210
- function e(s, r) {
210
+ function e(s, i) {
211
211
  for (var o = "", a = 0, c = -1, h = 0, l, d = 0; d <= s.length; ++d) {
212
212
  if (d < s.length)
213
213
  l = s.charCodeAt(d);
@@ -230,7 +230,7 @@ function Je() {
230
230
  continue;
231
231
  }
232
232
  }
233
- r && (o.length > 0 ? o += "/.." : o = "..", a = 2);
233
+ i && (o.length > 0 ? o += "/.." : o = "..", a = 2);
234
234
  } else
235
235
  o.length > 0 ? o += "/" + s.slice(c + 1, d) : o = s.slice(c + 1, d), a = d - c - 1;
236
236
  c = d, h = 0;
@@ -238,41 +238,41 @@ function Je() {
238
238
  }
239
239
  return o;
240
240
  }
241
- function n(s, r) {
242
- var o = r.dir || r.root, a = r.base || (r.name || "") + (r.ext || "");
243
- return o ? o === r.root ? o + a : o + s + a : a;
241
+ function n(s, i) {
242
+ var o = i.dir || i.root, a = i.base || (i.name || "") + (i.ext || "");
243
+ return o ? o === i.root ? o + a : o + s + a : a;
244
244
  }
245
- var i = {
245
+ var r = {
246
246
  // path.resolve([from ...], to)
247
247
  resolve: function() {
248
- for (var r = "", o = !1, a, c = arguments.length - 1; c >= -1 && !o; c--) {
248
+ for (var i = "", o = !1, a, c = arguments.length - 1; c >= -1 && !o; c--) {
249
249
  var h;
250
- c >= 0 ? h = arguments[c] : (a === void 0 && (a = process.cwd()), h = a), t(h), h.length !== 0 && (r = h + "/" + r, o = h.charCodeAt(0) === 47);
250
+ c >= 0 ? h = arguments[c] : (a === void 0 && (a = process.cwd()), h = a), t(h), h.length !== 0 && (i = h + "/" + i, o = h.charCodeAt(0) === 47);
251
251
  }
252
- return r = e(r, !o), o ? r.length > 0 ? "/" + r : "/" : r.length > 0 ? r : ".";
252
+ return i = e(i, !o), o ? i.length > 0 ? "/" + i : "/" : i.length > 0 ? i : ".";
253
253
  },
254
- normalize: function(r) {
255
- if (t(r), r.length === 0) return ".";
256
- var o = r.charCodeAt(0) === 47, a = r.charCodeAt(r.length - 1) === 47;
257
- return r = e(r, !o), r.length === 0 && !o && (r = "."), r.length > 0 && a && (r += "/"), o ? "/" + r : r;
254
+ normalize: function(i) {
255
+ if (t(i), i.length === 0) return ".";
256
+ var o = i.charCodeAt(0) === 47, a = i.charCodeAt(i.length - 1) === 47;
257
+ return i = e(i, !o), i.length === 0 && !o && (i = "."), i.length > 0 && a && (i += "/"), o ? "/" + i : i;
258
258
  },
259
- isAbsolute: function(r) {
260
- return t(r), r.length > 0 && r.charCodeAt(0) === 47;
259
+ isAbsolute: function(i) {
260
+ return t(i), i.length > 0 && i.charCodeAt(0) === 47;
261
261
  },
262
262
  join: function() {
263
263
  if (arguments.length === 0)
264
264
  return ".";
265
- for (var r, o = 0; o < arguments.length; ++o) {
265
+ for (var i, o = 0; o < arguments.length; ++o) {
266
266
  var a = arguments[o];
267
- t(a), a.length > 0 && (r === void 0 ? r = a : r += "/" + a);
267
+ t(a), a.length > 0 && (i === void 0 ? i = a : i += "/" + a);
268
268
  }
269
- return r === void 0 ? "." : i.normalize(r);
269
+ return i === void 0 ? "." : r.normalize(i);
270
270
  },
271
- relative: function(r, o) {
272
- if (t(r), t(o), r === o || (r = i.resolve(r), o = i.resolve(o), r === o)) return "";
273
- for (var a = 1; a < r.length && r.charCodeAt(a) === 47; ++a)
271
+ relative: function(i, o) {
272
+ if (t(i), t(o), i === o || (i = r.resolve(i), o = r.resolve(o), i === o)) return "";
273
+ for (var a = 1; a < i.length && i.charCodeAt(a) === 47; ++a)
274
274
  ;
275
- for (var c = r.length, h = c - a, l = 1; l < o.length && o.charCodeAt(l) === 47; ++l)
275
+ for (var c = i.length, h = c - a, l = 1; l < o.length && o.charCodeAt(l) === 47; ++l)
276
276
  ;
277
277
  for (var d = o.length, f = d - l, g = h < f ? h : f, m = -1, p = 0; p <= g; ++p) {
278
278
  if (p === g) {
@@ -281,43 +281,43 @@ function Je() {
281
281
  return o.slice(l + p + 1);
282
282
  if (p === 0)
283
283
  return o.slice(l + p);
284
- } else h > g && (r.charCodeAt(a + p) === 47 ? m = p : p === 0 && (m = 0));
284
+ } else h > g && (i.charCodeAt(a + p) === 47 ? m = p : p === 0 && (m = 0));
285
285
  break;
286
286
  }
287
- var A = r.charCodeAt(a + p), L = o.charCodeAt(l + p);
287
+ var A = i.charCodeAt(a + p), L = o.charCodeAt(l + p);
288
288
  if (A !== L)
289
289
  break;
290
290
  A === 47 && (m = p);
291
291
  }
292
292
  var b = "";
293
293
  for (p = a + m + 1; p <= c; ++p)
294
- (p === c || r.charCodeAt(p) === 47) && (b.length === 0 ? b += ".." : b += "/..");
294
+ (p === c || i.charCodeAt(p) === 47) && (b.length === 0 ? b += ".." : b += "/..");
295
295
  return b.length > 0 ? b + o.slice(l + m) : (l += m, o.charCodeAt(l) === 47 && ++l, o.slice(l));
296
296
  },
297
- _makeLong: function(r) {
298
- return r;
297
+ _makeLong: function(i) {
298
+ return i;
299
299
  },
300
- dirname: function(r) {
301
- if (t(r), r.length === 0) return ".";
302
- for (var o = r.charCodeAt(0), a = o === 47, c = -1, h = !0, l = r.length - 1; l >= 1; --l)
303
- if (o = r.charCodeAt(l), o === 47) {
300
+ dirname: function(i) {
301
+ if (t(i), i.length === 0) return ".";
302
+ for (var o = i.charCodeAt(0), a = o === 47, c = -1, h = !0, l = i.length - 1; l >= 1; --l)
303
+ if (o = i.charCodeAt(l), o === 47) {
304
304
  if (!h) {
305
305
  c = l;
306
306
  break;
307
307
  }
308
308
  } else
309
309
  h = !1;
310
- return c === -1 ? a ? "/" : "." : a && c === 1 ? "//" : r.slice(0, c);
310
+ return c === -1 ? a ? "/" : "." : a && c === 1 ? "//" : i.slice(0, c);
311
311
  },
312
- basename: function(r, o) {
312
+ basename: function(i, o) {
313
313
  if (o !== void 0 && typeof o != "string") throw new TypeError('"ext" argument must be a string');
314
- t(r);
314
+ t(i);
315
315
  var a = 0, c = -1, h = !0, l;
316
- if (o !== void 0 && o.length > 0 && o.length <= r.length) {
317
- if (o.length === r.length && o === r) return "";
316
+ if (o !== void 0 && o.length > 0 && o.length <= i.length) {
317
+ if (o.length === i.length && o === i) return "";
318
318
  var d = o.length - 1, f = -1;
319
- for (l = r.length - 1; l >= 0; --l) {
320
- var g = r.charCodeAt(l);
319
+ for (l = i.length - 1; l >= 0; --l) {
320
+ var g = i.charCodeAt(l);
321
321
  if (g === 47) {
322
322
  if (!h) {
323
323
  a = l + 1;
@@ -326,22 +326,22 @@ function Je() {
326
326
  } else
327
327
  f === -1 && (h = !1, f = l + 1), d >= 0 && (g === o.charCodeAt(d) ? --d === -1 && (c = l) : (d = -1, c = f));
328
328
  }
329
- return a === c ? c = f : c === -1 && (c = r.length), r.slice(a, c);
329
+ return a === c ? c = f : c === -1 && (c = i.length), i.slice(a, c);
330
330
  } else {
331
- for (l = r.length - 1; l >= 0; --l)
332
- if (r.charCodeAt(l) === 47) {
331
+ for (l = i.length - 1; l >= 0; --l)
332
+ if (i.charCodeAt(l) === 47) {
333
333
  if (!h) {
334
334
  a = l + 1;
335
335
  break;
336
336
  }
337
337
  } else c === -1 && (h = !1, c = l + 1);
338
- return c === -1 ? "" : r.slice(a, c);
338
+ return c === -1 ? "" : i.slice(a, c);
339
339
  }
340
340
  },
341
- extname: function(r) {
342
- t(r);
343
- for (var o = -1, a = 0, c = -1, h = !0, l = 0, d = r.length - 1; d >= 0; --d) {
344
- var f = r.charCodeAt(d);
341
+ extname: function(i) {
342
+ t(i);
343
+ for (var o = -1, a = 0, c = -1, h = !0, l = 0, d = i.length - 1; d >= 0; --d) {
344
+ var f = i.charCodeAt(d);
345
345
  if (f === 47) {
346
346
  if (!h) {
347
347
  a = d + 1;
@@ -353,21 +353,21 @@ function Je() {
353
353
  }
354
354
  return o === -1 || c === -1 || // We saw a non-dot character immediately before the dot
355
355
  l === 0 || // The (right-most) trimmed path component is exactly '..'
356
- l === 1 && o === c - 1 && o === a + 1 ? "" : r.slice(o, c);
356
+ l === 1 && o === c - 1 && o === a + 1 ? "" : i.slice(o, c);
357
357
  },
358
- format: function(r) {
359
- if (r === null || typeof r != "object")
360
- throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof r);
361
- return n("/", r);
358
+ format: function(i) {
359
+ if (i === null || typeof i != "object")
360
+ throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof i);
361
+ return n("/", i);
362
362
  },
363
- parse: function(r) {
364
- t(r);
363
+ parse: function(i) {
364
+ t(i);
365
365
  var o = { root: "", dir: "", base: "", ext: "", name: "" };
366
- if (r.length === 0) return o;
367
- var a = r.charCodeAt(0), c = a === 47, h;
366
+ if (i.length === 0) return o;
367
+ var a = i.charCodeAt(0), c = a === 47, h;
368
368
  c ? (o.root = "/", h = 1) : h = 0;
369
- for (var l = -1, d = 0, f = -1, g = !0, m = r.length - 1, p = 0; m >= h; --m) {
370
- if (a = r.charCodeAt(m), a === 47) {
369
+ for (var l = -1, d = 0, f = -1, g = !0, m = i.length - 1, p = 0; m >= h; --m) {
370
+ if (a = i.charCodeAt(m), a === 47) {
371
371
  if (!g) {
372
372
  d = m + 1;
373
373
  break;
@@ -378,14 +378,14 @@ function Je() {
378
378
  }
379
379
  return l === -1 || f === -1 || // We saw a non-dot character immediately before the dot
380
380
  p === 0 || // The (right-most) trimmed path component is exactly '..'
381
- p === 1 && l === f - 1 && l === d + 1 ? f !== -1 && (d === 0 && c ? o.base = o.name = r.slice(1, f) : o.base = o.name = r.slice(d, f)) : (d === 0 && c ? (o.name = r.slice(1, l), o.base = r.slice(1, f)) : (o.name = r.slice(d, l), o.base = r.slice(d, f)), o.ext = r.slice(l, f)), d > 0 ? o.dir = r.slice(0, d - 1) : c && (o.dir = "/"), o;
381
+ p === 1 && l === f - 1 && l === d + 1 ? f !== -1 && (d === 0 && c ? o.base = o.name = i.slice(1, f) : o.base = o.name = i.slice(d, f)) : (d === 0 && c ? (o.name = i.slice(1, l), o.base = i.slice(1, f)) : (o.name = i.slice(d, l), o.base = i.slice(d, f)), o.ext = i.slice(l, f)), d > 0 ? o.dir = i.slice(0, d - 1) : c && (o.dir = "/"), o;
382
382
  },
383
383
  sep: "/",
384
384
  delimiter: ":",
385
385
  win32: null,
386
386
  posix: null
387
387
  };
388
- return i.posix = i, Z = i, Z;
388
+ return r.posix = r, Z = r, Z;
389
389
  }
390
390
  var Xe = Je();
391
391
  const y = /* @__PURE__ */ Ge(Xe);
@@ -394,8 +394,8 @@ function Qe(t, e) {
394
394
  return n === "" || !n.startsWith("..") && !y.isAbsolute(n);
395
395
  }
396
396
  function et(t, e, n) {
397
- const i = y.resolve(e), s = y.resolve(t);
398
- if (!Qe(s, i))
397
+ const r = y.resolve(e), s = y.resolve(t);
398
+ if (!Qe(s, r))
399
399
  throw u({
400
400
  code: "parse_error",
401
401
  path: n,
@@ -403,7 +403,7 @@ function et(t, e, n) {
403
403
  });
404
404
  }
405
405
  function ve(t, e = {}) {
406
- const { rootDir: n, fromPath: i, documentPath: s, constrainToRoot: r = !1, hyogenPath: o = !1 } = e;
406
+ const { rootDir: n, fromPath: r, documentPath: s, constrainToRoot: i = !1, hyogenPath: o = !1 } = e;
407
407
  if (t.length === 0)
408
408
  throw u({
409
409
  code: "parse_error",
@@ -431,8 +431,8 @@ function ve(t, e = {}) {
431
431
  });
432
432
  }
433
433
  else if (t.startsWith("./") || t.startsWith("../"))
434
- if (i)
435
- a = y.resolve(y.dirname(i), t);
434
+ if (r)
435
+ a = y.resolve(y.dirname(r), t);
436
436
  else if (n)
437
437
  a = y.resolve(n, t);
438
438
  else
@@ -451,7 +451,7 @@ function ve(t, e = {}) {
451
451
  path: s,
452
452
  details: { message: "root is required for relative template paths" }
453
453
  });
454
- return n && r && et(a, n, s), a;
454
+ return n && i && et(a, n, s), a;
455
455
  }
456
456
  async function tt(t) {
457
457
  const e = t.registry.get(t.alias);
@@ -469,7 +469,7 @@ async function tt(t) {
469
469
  documentPath: t.path,
470
470
  constrainToRoot: t.constrainToRoot,
471
471
  hyogenPath: !0
472
- }), i = await t.loader(n), { context: s, body: r } = H(i, n), o = qe(s, n), { values: a, warnings: c } = Ye(
472
+ }), r = await t.loader(n), { context: s, body: i } = H(r, n), o = qe(s, n), { values: a, warnings: c } = Ye(
473
473
  t.props,
474
474
  o,
475
475
  t.alias
@@ -479,7 +479,7 @@ async function tt(t) {
479
479
  t.parentContext,
480
480
  l,
481
481
  a
482
- ), g = (await ae(r, {
482
+ ), g = (await ae(i, {
483
483
  context: d,
484
484
  loader: t.loader,
485
485
  root: t.rootDir,
@@ -507,11 +507,11 @@ const nt = /* @__PURE__ */ new Set([
507
507
  "constructor",
508
508
  "__defineGetter__"
509
509
  ]);
510
- function it(t) {
510
+ function rt(t) {
511
511
  return nt.has(t);
512
512
  }
513
513
  function de(t, e) {
514
- if (it(t))
514
+ if (rt(t))
515
515
  throw u({
516
516
  code: "forbidden_property_access",
517
517
  path: e,
@@ -521,7 +521,7 @@ function de(t, e) {
521
521
  function M(t) {
522
522
  return !t;
523
523
  }
524
- function rt(t, e) {
524
+ function it(t, e) {
525
525
  if (t != null && typeof t == "object")
526
526
  return t[e];
527
527
  }
@@ -560,16 +560,16 @@ function st(t, e, n) {
560
560
  }
561
561
  }
562
562
  async function w(t, e) {
563
- const { context: n, path: i } = e;
563
+ const { context: n, path: r } = e;
564
564
  switch (t.type) {
565
565
  case "literal":
566
566
  return t.value;
567
567
  case "identifier":
568
- return de(t.name, i), n[t.name];
568
+ return de(t.name, r), n[t.name];
569
569
  case "member": {
570
- de(t.property, i);
570
+ de(t.property, r);
571
571
  const s = await w(t.object, e);
572
- return rt(s, t.property);
572
+ return it(s, t.property);
573
573
  }
574
574
  case "default": {
575
575
  const s = await w(t.left, e);
@@ -588,14 +588,14 @@ async function w(t, e) {
588
588
  const o = await w(t.left, e);
589
589
  return M(o) ? w(t.right, e) : o;
590
590
  }
591
- const s = await w(t.left, e), r = await w(t.right, e);
592
- return st(t.op, s, r);
591
+ const s = await w(t.left, e), i = await w(t.right, e);
592
+ return st(t.op, s, i);
593
593
  }
594
594
  case "call": {
595
595
  if (!e.registry || !e.loader || !e.visitStack)
596
596
  throw u({
597
597
  code: "parse_error",
598
- path: i,
598
+ path: r,
599
599
  details: {
600
600
  message: `function calls are not allowed: ${t.callee}()`
601
601
  }
@@ -603,14 +603,14 @@ async function w(t, e) {
603
603
  if (!e.registry.has(t.callee))
604
604
  throw u({
605
605
  code: "parse_error",
606
- path: i,
606
+ path: r,
607
607
  details: {
608
608
  message: `unregistered component: ${t.callee}`
609
609
  }
610
610
  });
611
611
  const s = {};
612
- for (const [r, o] of Object.entries(t.args))
613
- s[r] = await w(o, e);
612
+ for (const [i, o] of Object.entries(t.args))
613
+ s[i] = await w(o, e);
614
614
  return tt({
615
615
  alias: t.callee,
616
616
  props: s,
@@ -618,7 +618,7 @@ async function w(t, e) {
618
618
  registry: e.registry,
619
619
  loader: e.loader,
620
620
  rootDir: e.rootDir,
621
- path: i,
621
+ path: r,
622
622
  warnings: e.warnings ?? [],
623
623
  visitStack: e.visitStack,
624
624
  preserveHgComments: e.preserveHgComments,
@@ -629,7 +629,7 @@ async function w(t, e) {
629
629
  if (t.method !== "toLocaleString")
630
630
  throw u({
631
631
  code: "parse_error",
632
- path: i,
632
+ path: r,
633
633
  details: { message: `unsupported method: ${t.method}()` }
634
634
  });
635
635
  const s = await w(t.object, e);
@@ -643,11 +643,11 @@ async function w(t, e) {
643
643
  }
644
644
  case "template": {
645
645
  let s = "";
646
- for (const r of t.parts)
647
- if (typeof r == "string")
648
- s += r;
646
+ for (const i of t.parts)
647
+ if (typeof i == "string")
648
+ s += i;
649
649
  else {
650
- const o = await w(r, e);
650
+ const o = await w(i, e);
651
651
  o != null && (s += String(o));
652
652
  }
653
653
  return s;
@@ -663,13 +663,13 @@ function ot(t) {
663
663
  return /[A-Za-z0-9_$]/.test(t);
664
664
  }
665
665
  function C(t, e, n = {}) {
666
- const i = t.trim();
667
- if (i.length === 0)
666
+ const r = t.trim();
667
+ if (r.length === 0)
668
668
  throw x(e, "empty expression");
669
- const s = new at(i, e, n), r = s.parseExpression();
669
+ const s = new at(r, e, n), i = s.parseExpression();
670
670
  if (s.skipWhitespace(), s.hasMore())
671
671
  throw x(e, `unexpected token at position ${s.position}`);
672
- return r;
672
+ return i;
673
673
  }
674
674
  function x(t, e) {
675
675
  throw u({
@@ -679,8 +679,8 @@ function x(t, e) {
679
679
  });
680
680
  }
681
681
  class at {
682
- constructor(e, n, i = {}) {
683
- this.input = e, this.path = n, this.allowCalls = i.allowCalls !== !1;
682
+ constructor(e, n, r = {}) {
683
+ this.input = e, this.path = n, this.allowCalls = r.allowCalls !== !1;
684
684
  }
685
685
  input;
686
686
  path;
@@ -717,8 +717,8 @@ class at {
717
717
  if (this.skipWhitespace(), this.peek() !== ":")
718
718
  throw x(this.path, "expected ':' in ternary expression");
719
719
  this.index++;
720
- const i = this.parseTernary();
721
- return { type: "ternary", condition: e, consequent: n, alternate: i };
720
+ const r = this.parseTernary();
721
+ return { type: "ternary", condition: e, consequent: n, alternate: r };
722
722
  }
723
723
  parseLogicalOr() {
724
724
  let e = this.parseLogicalAnd();
@@ -743,8 +743,8 @@ class at {
743
743
  const n = this.readComparisonOp();
744
744
  if (!n)
745
745
  break;
746
- const i = this.parseAdditive();
747
- e = { type: "binary", op: n, left: e, right: i };
746
+ const r = this.parseAdditive();
747
+ e = { type: "binary", op: n, left: e, right: r };
748
748
  }
749
749
  return e;
750
750
  }
@@ -772,8 +772,8 @@ class at {
772
772
  if (n !== "+" && n !== "-")
773
773
  break;
774
774
  this.index++;
775
- const i = this.parseMultiplicative();
776
- e = { type: "binary", op: n, left: e, right: i };
775
+ const r = this.parseMultiplicative();
776
+ e = { type: "binary", op: n, left: e, right: r };
777
777
  }
778
778
  return e;
779
779
  }
@@ -785,8 +785,8 @@ class at {
785
785
  if (n !== "*" && n !== "/")
786
786
  break;
787
787
  this.index++;
788
- const i = this.parseUnary();
789
- e = { type: "binary", op: n, left: e, right: i };
788
+ const r = this.parseUnary();
789
+ e = { type: "binary", op: n, left: e, right: r };
790
790
  }
791
791
  return e;
792
792
  }
@@ -813,8 +813,8 @@ class at {
813
813
  if (n !== "toLocaleString")
814
814
  throw x(this.path, `unsupported method: ${n}()`);
815
815
  this.index++;
816
- const i = this.parseMethodArgs();
817
- return { type: "method", object: e, method: n, args: i };
816
+ const r = this.parseMethodArgs();
817
+ return { type: "method", object: e, method: n, args: r };
818
818
  }
819
819
  return { type: "member", object: e, property: n };
820
820
  }
@@ -860,8 +860,8 @@ class at {
860
860
  "component calls are not allowed in template literals"
861
861
  );
862
862
  this.index++;
863
- const i = this.parseCallArgs();
864
- return { type: "call", callee: n, args: i };
863
+ const r = this.parseCallArgs();
864
+ return { type: "call", callee: n, args: r };
865
865
  }
866
866
  if (this.peek() === "[")
867
867
  throw x(this.path, "bracket access is not allowed");
@@ -874,43 +874,43 @@ class at {
874
874
  const e = [];
875
875
  let n = "";
876
876
  for (; this.index < this.input.length; ) {
877
- const i = this.input[this.index];
878
- if (i === "`")
877
+ const r = this.input[this.index];
878
+ if (r === "`")
879
879
  return this.index++, e.push(n), { type: "template", parts: e };
880
- if (i === "\\") {
880
+ if (r === "\\") {
881
881
  if (this.index++, this.index >= this.input.length)
882
882
  throw x(this.path, "unterminated template literal escape");
883
883
  n += this.input[this.index], this.index++;
884
884
  continue;
885
885
  }
886
- if (i === "$" && this.input[this.index + 1] === "{") {
886
+ if (r === "$" && this.input[this.index + 1] === "{") {
887
887
  e.push(n), n = "", this.index += 2;
888
- const s = this.readTemplateExpression(), r = C(s, this.path, {
888
+ const s = this.readTemplateExpression(), i = C(s, this.path, {
889
889
  allowCalls: !1
890
890
  });
891
- e.push(r);
891
+ e.push(i);
892
892
  continue;
893
893
  }
894
- n += i, this.index++;
894
+ n += r, this.index++;
895
895
  }
896
896
  throw x(this.path, "unterminated template literal");
897
897
  }
898
898
  readTemplateExpression() {
899
899
  let e = 1;
900
900
  const n = this.index;
901
- let i = null;
901
+ let r = null;
902
902
  for (; this.index < this.input.length; ) {
903
903
  const s = this.input[this.index];
904
- if (i) {
904
+ if (r) {
905
905
  if (s === "\\") {
906
906
  this.index += 2;
907
907
  continue;
908
908
  }
909
- s === i && (i = null), this.index++;
909
+ s === r && (r = null), this.index++;
910
910
  continue;
911
911
  }
912
912
  if (s === '"' || s === "'" || s === "`") {
913
- i = s, this.index++;
913
+ r = s, this.index++;
914
914
  continue;
915
915
  }
916
916
  if (s === "{") {
@@ -919,8 +919,8 @@ class at {
919
919
  }
920
920
  if (s === "}") {
921
921
  if (e--, e === 0) {
922
- const r = this.input.slice(n, this.index);
923
- return this.index++, r;
922
+ const i = this.input.slice(n, this.index);
923
+ return this.index++, i;
924
924
  }
925
925
  this.index++;
926
926
  continue;
@@ -1055,17 +1055,17 @@ class at {
1055
1055
  this.index++;
1056
1056
  let n = "";
1057
1057
  for (; this.index < this.input.length; ) {
1058
- const i = this.input[this.index];
1059
- if (i === e)
1058
+ const r = this.input[this.index];
1059
+ if (r === e)
1060
1060
  return this.index++, n;
1061
- if (i === "\\") {
1061
+ if (r === "\\") {
1062
1062
  if (this.index++, this.index >= this.input.length)
1063
1063
  throw x(this.path, "unterminated string escape");
1064
1064
  const s = this.input[this.index];
1065
1065
  n += s, this.index++;
1066
1066
  continue;
1067
1067
  }
1068
- n += i, this.index++;
1068
+ n += r, this.index++;
1069
1069
  }
1070
1070
  throw x(this.path, "unterminated string literal");
1071
1071
  }
@@ -1073,91 +1073,91 @@ class at {
1073
1073
  const e = this.index;
1074
1074
  for (this.peek() === "-" && this.index++; this.index < this.input.length && /[0-9.]/.test(this.peek()); )
1075
1075
  this.index++;
1076
- const n = this.input.slice(e, this.index), i = Number(n);
1077
- if (Number.isNaN(i))
1076
+ const n = this.input.slice(e, this.index), r = Number(n);
1077
+ if (Number.isNaN(r))
1078
1078
  throw x(this.path, `invalid number '${n}'`);
1079
- return i;
1079
+ return r;
1080
1080
  }
1081
1081
  }
1082
1082
  async function _e(t, e, n = {}) {
1083
- const i = n.path;
1084
- let s = "", r = 0;
1085
- for (; r < t.length; ) {
1086
- const o = t.indexOf("{", r);
1083
+ const r = n.path;
1084
+ let s = "", i = 0;
1085
+ for (; i < t.length; ) {
1086
+ const o = t.indexOf("{", i);
1087
1087
  if (o === -1) {
1088
- s += t.slice(r);
1088
+ s += t.slice(i);
1089
1089
  break;
1090
1090
  }
1091
- s += t.slice(r, o);
1091
+ s += t.slice(i, o);
1092
1092
  const a = t[o + 1] === "{" && t[o + 2] === "{" && (o === 0 || t[o - 1] !== "\\");
1093
1093
  if (!(!a && t[o + 1] === "{" && (o === 0 || t[o - 1] !== "\\")) && !a) {
1094
- s += "{", r = o + 1;
1094
+ s += "{", i = o + 1;
1095
1095
  continue;
1096
1096
  }
1097
1097
  const h = a ? 3 : 2, l = a ? "}}}" : "}}", d = t.indexOf(l, o + h);
1098
1098
  if (d === -1)
1099
1099
  throw u({
1100
1100
  code: "parse_error",
1101
- path: i,
1101
+ path: r,
1102
1102
  details: { message: "unclosed expression" }
1103
1103
  });
1104
- const f = t.slice(o + h, d).trim(), g = C(f, i), m = await w(g, {
1104
+ const f = t.slice(o + h, d).trim(), g = C(f, r), m = await w(g, {
1105
1105
  ...n,
1106
1106
  context: e,
1107
- path: i,
1107
+ path: r,
1108
1108
  parentContext: n.parentContext ?? e
1109
1109
  });
1110
- s += m == null ? "" : String(m), r = d + l.length;
1110
+ s += m == null ? "" : String(m), i = d + l.length;
1111
1111
  }
1112
1112
  return s;
1113
1113
  }
1114
1114
  function ct(t, e) {
1115
- let n = 0, i = 0;
1116
- for (; i < t.length; ) {
1117
- const s = t.indexOf(e, i);
1115
+ let n = 0, r = 0;
1116
+ for (; r < t.length; ) {
1117
+ const s = t.indexOf(e, r);
1118
1118
  if (s === -1)
1119
1119
  break;
1120
- n++, i = s + e.length;
1120
+ n++, r = s + e.length;
1121
1121
  }
1122
1122
  return n;
1123
1123
  }
1124
1124
  function X(t) {
1125
- const e = t.includes("@hg"), n = t.includes("@endhg"), i = ct(t, "@@");
1126
- return e && n ? i > 0 ? "mixed" : "hg" : i >= 2 && !e && !n ? "at-at" : (e || n) && i > 0 ? "mixed" : e && !n || i === 1 && !n ? "unclosed" : "none";
1125
+ const e = t.includes("@hg"), n = t.includes("@endhg"), r = ct(t, "@@");
1126
+ 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";
1127
1127
  }
1128
1128
  function Q(t) {
1129
1129
  return t.replace(/@endhg/g, "").replace(/@hg/g, "").replace(/@@/g, "");
1130
1130
  }
1131
1131
  function ee(t, e) {
1132
- let n = 0, i = !1;
1132
+ let n = 0, r = !1;
1133
1133
  for (; n < e; ) {
1134
1134
  const s = t.indexOf("```", n);
1135
1135
  if (s === -1 || s >= e)
1136
1136
  break;
1137
- i = !i, n = s + 3;
1137
+ r = !r, n = s + 3;
1138
1138
  }
1139
- return i;
1139
+ return r;
1140
1140
  }
1141
1141
  function T(t) {
1142
1142
  const e = [];
1143
1143
  let n = 0;
1144
1144
  for (; n < t.length; ) {
1145
- const i = t.indexOf("<!--", n);
1146
- if (i === -1)
1145
+ const r = t.indexOf("<!--", n);
1146
+ if (r === -1)
1147
1147
  break;
1148
- if (ee(t, i)) {
1149
- n = i + 4;
1148
+ if (ee(t, r)) {
1149
+ n = r + 4;
1150
1150
  continue;
1151
1151
  }
1152
- const s = t.indexOf("-->", i + 4);
1152
+ const s = t.indexOf("-->", r + 4);
1153
1153
  if (s === -1)
1154
1154
  break;
1155
- const r = t.slice(i, s + 3), o = r.slice(4, r.length - 3), a = X(o);
1155
+ const i = t.slice(r, s + 3), o = i.slice(4, i.length - 3), a = X(o);
1156
1156
  (a === "hg" || a === "at-at") && e.push({
1157
- start: i,
1157
+ start: r,
1158
1158
  end: s + 3,
1159
1159
  inner: o,
1160
- raw: r
1160
+ raw: i
1161
1161
  }), n = s + 3;
1162
1162
  }
1163
1163
  return e;
@@ -1172,13 +1172,13 @@ function Se(t) {
1172
1172
  e = n + 4;
1173
1173
  continue;
1174
1174
  }
1175
- const i = t.indexOf("-->", n + 4);
1176
- if (i === -1)
1175
+ const r = t.indexOf("-->", n + 4);
1176
+ if (r === -1)
1177
1177
  return !1;
1178
- const s = t.slice(n + 4, i), r = X(s);
1179
- if (r === "unclosed" || r === "mixed")
1178
+ const s = t.slice(n + 4, r), i = X(s);
1179
+ if (i === "unclosed" || i === "mixed")
1180
1180
  return !0;
1181
- e = i + 3;
1181
+ e = r + 3;
1182
1182
  }
1183
1183
  return !1;
1184
1184
  }
@@ -1192,15 +1192,15 @@ function Ce(t) {
1192
1192
  e = n + 4;
1193
1193
  continue;
1194
1194
  }
1195
- const i = t.indexOf("-->", n + 4);
1196
- if (i === -1)
1195
+ const r = t.indexOf("-->", n + 4);
1196
+ if (r === -1)
1197
1197
  return null;
1198
- const s = t.slice(n + 4, i), r = X(s);
1199
- if (r === "mixed")
1198
+ const s = t.slice(n + 4, r), i = X(s);
1199
+ if (i === "mixed")
1200
1200
  return "mixed @hg and @@ markers are not allowed";
1201
- if (r === "unclosed")
1201
+ if (i === "unclosed")
1202
1202
  return "unclosed hyogen block (missing closing marker)";
1203
- e = i + 3;
1203
+ e = r + 3;
1204
1204
  }
1205
1205
  return null;
1206
1206
  }
@@ -1220,44 +1220,44 @@ function V(t, e) {
1220
1220
  }
1221
1221
  function ht(t, e) {
1222
1222
  let n = t;
1223
- const i = /^<!--([\s\S]*?)-->$/.exec(t.trim());
1224
- i && (n = i[1]);
1223
+ const r = /^<!--([\s\S]*?)-->$/.exec(t.trim());
1224
+ r && (n = r[1]);
1225
1225
  const s = E(n);
1226
1226
  if (s.length !== 1)
1227
1227
  return null;
1228
- const r = s[0];
1229
- if (/^include\s+/i.test(r) || /^component\s+/i.test(r) || /^const\s+/i.test(r) || /^let\s+/i.test(r) || /^[A-Za-z_$][A-Za-z0-9_$]*\s*=/.test(r))
1228
+ const i = s[0];
1229
+ if (/^include\s+/i.test(i) || /^component\s+/i.test(i) || /^const\s+/i.test(i) || /^let\s+/i.test(i) || /^[A-Za-z_$][A-Za-z0-9_$]*\s*=/.test(i))
1230
1230
  return null;
1231
- if (r === "else")
1231
+ if (i === "else")
1232
1232
  return { kind: "else" };
1233
- if (r === "endif")
1233
+ if (i === "endif")
1234
1234
  return { kind: "endif" };
1235
- if (r === "endeach")
1235
+ if (i === "endeach")
1236
1236
  return { kind: "endeach" };
1237
- if (/^IF\b/.test(r) || /^ELSE\b/.test(r) || /^ENDIF\b/.test(r))
1237
+ if (/^IF\b/.test(i) || /^ELSE\b/.test(i) || /^ENDIF\b/.test(i))
1238
1238
  throw V(e, "control keywords must be lowercase");
1239
- const o = /^else\s+if\s+(.+)$/.exec(r);
1239
+ const o = /^else\s+if\s+(.+)$/.exec(i);
1240
1240
  if (o)
1241
1241
  return {
1242
1242
  kind: "else_if",
1243
1243
  expr: C(o[1], e)
1244
1244
  };
1245
- const a = /^if\s+(.+)$/.exec(r);
1245
+ const a = /^if\s+(.+)$/.exec(i);
1246
1246
  if (a)
1247
1247
  return {
1248
1248
  kind: "if",
1249
1249
  expr: C(a[1], e)
1250
1250
  };
1251
- const c = /^each\s+([A-Za-z_$][A-Za-z0-9_$]*)\s+in\s+(.+)$/.exec(r);
1251
+ const c = /^each\s+([A-Za-z_$][A-Za-z0-9_$]*)\s+in\s+(.+)$/.exec(i);
1252
1252
  if (c)
1253
1253
  return {
1254
1254
  kind: "each",
1255
1255
  item: c[1],
1256
1256
  expr: C(c[2], e)
1257
1257
  };
1258
- if (r === "if")
1258
+ if (i === "if")
1259
1259
  throw V(e, "if requires an expression");
1260
- if (/^each\s+/.test(r))
1260
+ if (/^each\s+/.test(i))
1261
1261
  throw V(e, "invalid each directive");
1262
1262
  return null;
1263
1263
  }
@@ -1273,12 +1273,12 @@ function S(t, e) {
1273
1273
  }
1274
1274
  function dt(t, e) {
1275
1275
  const n = [];
1276
- for (const i of T(t)) {
1277
- const s = ht(i.inner, e);
1276
+ for (const r of T(t)) {
1277
+ const s = ht(r.inner, e);
1278
1278
  s && n.push({
1279
- start: i.start,
1280
- end: i.end,
1281
- raw: i.raw,
1279
+ start: r.start,
1280
+ end: r.end,
1281
+ raw: r.raw,
1282
1282
  opener: s
1283
1283
  });
1284
1284
  }
@@ -1291,26 +1291,26 @@ function ut(t, e) {
1291
1291
  const n = dt(t, e);
1292
1292
  if (n.length === 0)
1293
1293
  return t.length > 0 ? [{ kind: "text", content: t }] : [];
1294
- const { nodes: i, nextIndex: s } = j(t, n, 0, n.length, e);
1294
+ const { nodes: r, nextIndex: s } = B(t, n, 0, n.length, e);
1295
1295
  if (s < n.length) {
1296
- const r = n[s];
1297
- if (r.opener.kind === "endif")
1296
+ const i = n[s];
1297
+ if (i.opener.kind === "endif")
1298
1298
  throw S(e, "endif without matching if");
1299
- if (r.opener.kind === "endeach")
1299
+ if (i.opener.kind === "endeach")
1300
1300
  throw S(e, "endeach without matching each");
1301
- if (r.opener.kind === "else" || r.opener.kind === "else_if")
1301
+ if (i.opener.kind === "else" || i.opener.kind === "else_if")
1302
1302
  throw S(e, "else without matching if");
1303
1303
  }
1304
- return i;
1304
+ return r;
1305
1305
  }
1306
- function j(t, e, n, i, s, r = 0, o) {
1306
+ function B(t, e, n, r, s, i = 0, o) {
1307
1307
  const a = o ?? t.length, c = [];
1308
- let h = r, l = n;
1309
- for (; l < i; ) {
1308
+ let h = i, l = n;
1309
+ for (; l < r; ) {
1310
1310
  const d = e[l];
1311
1311
  if (d.start >= a)
1312
1312
  break;
1313
- if (d.end <= r) {
1313
+ if (d.end <= i) {
1314
1314
  l++;
1315
1315
  continue;
1316
1316
  }
@@ -1318,12 +1318,12 @@ function j(t, e, n, i, s, r = 0, o) {
1318
1318
  kind: "text",
1319
1319
  content: t.slice(h, d.start)
1320
1320
  }), d.opener.kind === "if") {
1321
- const f = ft(t, e, l, i, s);
1321
+ const f = ft(t, e, l, r, s);
1322
1322
  c.push(f.node), h = f.endPos, l = f.nextIndex;
1323
1323
  continue;
1324
1324
  }
1325
1325
  if (d.opener.kind === "each") {
1326
- const f = pt(t, e, l, i, s);
1326
+ const f = pt(t, e, l, r, s);
1327
1327
  c.push(f.node), h = f.endPos, l = f.nextIndex;
1328
1328
  continue;
1329
1329
  }
@@ -1337,13 +1337,13 @@ function j(t, e, n, i, s, r = 0, o) {
1337
1337
  }
1338
1338
  return h < a && c.push({ kind: "text", content: t.slice(h, a) }), { nodes: c, nextIndex: l };
1339
1339
  }
1340
- function ft(t, e, n, i, s) {
1341
- const r = e[n];
1342
- if (r.opener.kind !== "if")
1340
+ function ft(t, e, n, r, s) {
1341
+ const i = e[n];
1342
+ if (i.opener.kind !== "if")
1343
1343
  throw S(s, "expected if");
1344
1344
  const o = [];
1345
- let a = n, c = r.end, h = 0;
1346
- for (; a < i; ) {
1345
+ let a = n, c = i.end, h = 0;
1346
+ for (; a < r; ) {
1347
1347
  const l = e[a];
1348
1348
  if (a === n) {
1349
1349
  if (l.opener.kind !== "if")
@@ -1362,7 +1362,7 @@ function ft(t, e, n, i, s) {
1362
1362
  }
1363
1363
  if (l.opener.kind === "endif") {
1364
1364
  if (h === 0)
1365
- return o[o.length - 1].body = j(
1365
+ return o[o.length - 1].body = B(
1366
1366
  t,
1367
1367
  e,
1368
1368
  n + 1,
@@ -1384,7 +1384,7 @@ function ft(t, e, n, i, s) {
1384
1384
  }
1385
1385
  if (h === 0) {
1386
1386
  if (l.opener.kind === "else_if") {
1387
- o[o.length - 1].body = j(
1387
+ o[o.length - 1].body = B(
1388
1388
  t,
1389
1389
  e,
1390
1390
  n + 1,
@@ -1401,7 +1401,7 @@ function ft(t, e, n, i, s) {
1401
1401
  continue;
1402
1402
  }
1403
1403
  if (l.opener.kind === "else") {
1404
- o[o.length - 1].body = j(
1404
+ o[o.length - 1].body = B(
1405
1405
  t,
1406
1406
  e,
1407
1407
  n + 1,
@@ -1421,14 +1421,14 @@ function ft(t, e, n, i, s) {
1421
1421
  }
1422
1422
  throw S(s, "unclosed if block (missing endif)");
1423
1423
  }
1424
- function pt(t, e, n, i, s) {
1425
- const r = e[n];
1426
- if (r.opener.kind !== "each")
1424
+ function pt(t, e, n, r, s) {
1425
+ const i = e[n];
1426
+ if (i.opener.kind !== "each")
1427
1427
  throw S(s, "expected each");
1428
1428
  let o = n + 1;
1429
- const a = r.end;
1429
+ const a = i.end;
1430
1430
  let c = 0;
1431
- for (; o < i; ) {
1431
+ for (; o < r; ) {
1432
1432
  const h = e[o];
1433
1433
  if (We(h.opener)) {
1434
1434
  c++, o++;
@@ -1436,7 +1436,7 @@ function pt(t, e, n, i, s) {
1436
1436
  }
1437
1437
  if (h.opener.kind === "endeach") {
1438
1438
  if (c === 0) {
1439
- const l = j(
1439
+ const l = B(
1440
1440
  t,
1441
1441
  e,
1442
1442
  n + 1,
@@ -1448,9 +1448,9 @@ function pt(t, e, n, i, s) {
1448
1448
  return {
1449
1449
  node: {
1450
1450
  kind: "each",
1451
- item: r.opener.item,
1452
- expr: r.opener.expr,
1453
- opener: R(r),
1451
+ item: i.opener.item,
1452
+ expr: i.opener.expr,
1453
+ opener: R(i),
1454
1454
  body: l,
1455
1455
  closer: R(h)
1456
1456
  },
@@ -1501,44 +1501,44 @@ function te(t) {
1501
1501
  `) ? t.slice(1) : t;
1502
1502
  }
1503
1503
  async function kt(t, e) {
1504
- const n = e.path, i = e.warnings ?? [], s = ut(t, n), r = new mt();
1505
- return ne(s, e, r, i);
1504
+ const n = e.path, r = e.warnings ?? [], s = ut(t, n), i = new mt();
1505
+ return ne(s, e, i, r);
1506
1506
  }
1507
- async function ne(t, e, n, i) {
1507
+ async function ne(t, e, n, r) {
1508
1508
  const s = e.preserveHgComments === !0;
1509
- let r = "", o = !1;
1509
+ let i = "", o = !1;
1510
1510
  for (const a of t) {
1511
- let c = await wt(a, e, n, i);
1512
- o && (c = te(c)), r += c, o = !s && (a.kind === "if" || a.kind === "each");
1511
+ let c = await wt(a, e, n, r);
1512
+ o && (c = te(c)), i += c, o = !s && (a.kind === "if" || a.kind === "each");
1513
1513
  }
1514
- return r;
1514
+ return i;
1515
1515
  }
1516
- async function wt(t, e, n, i) {
1516
+ async function wt(t, e, n, r) {
1517
1517
  switch (t.kind) {
1518
1518
  case "text":
1519
1519
  return t.content;
1520
1520
  case "if":
1521
- return bt(t, e, n, i);
1521
+ return bt(t, e, n, r);
1522
1522
  case "each":
1523
- return yt(t, e, n, i);
1523
+ return yt(t, e, n, r);
1524
1524
  default:
1525
1525
  return "";
1526
1526
  }
1527
1527
  }
1528
- async function bt(t, e, n, i) {
1528
+ async function bt(t, e, n, r) {
1529
1529
  if (n.enter().exceeded)
1530
- return i.push($e(e.path)), "";
1530
+ return r.push($e(e.path)), "";
1531
1531
  try {
1532
- let r = -1;
1532
+ let i = -1;
1533
1533
  for (let c = 0; c < t.branches.length; c++) {
1534
1534
  const h = t.branches[c];
1535
1535
  if (h.kind === "else") {
1536
- r = c;
1536
+ i = c;
1537
1537
  break;
1538
1538
  }
1539
1539
  const l = await w(h.expr, e);
1540
1540
  if (gt(l)) {
1541
- r = c;
1541
+ i = c;
1542
1542
  break;
1543
1543
  }
1544
1544
  }
@@ -1546,8 +1546,8 @@ async function bt(t, e, n, i) {
1546
1546
  let a = "";
1547
1547
  for (let c = 0; c < t.branches.length; c++) {
1548
1548
  const h = t.branches[c];
1549
- if (o && (a += h.opener.raw), c === r) {
1550
- let l = await ne(h.body, e, n, i);
1549
+ if (o && (a += h.opener.raw), c === i) {
1550
+ let l = await ne(h.body, e, n, r);
1551
1551
  o || (l = te(l)), a += l;
1552
1552
  }
1553
1553
  }
@@ -1556,29 +1556,29 @@ async function bt(t, e, n, i) {
1556
1556
  n.exit();
1557
1557
  }
1558
1558
  }
1559
- async function yt(t, e, n, i) {
1559
+ async function yt(t, e, n, r) {
1560
1560
  if (n.enter().exceeded)
1561
- return i.push($e(e.path)), "";
1561
+ return r.push($e(e.path)), "";
1562
1562
  try {
1563
- const r = await w(t.expr, e);
1564
- if (!xt(r))
1563
+ const i = await w(t.expr, e);
1564
+ if (!xt(i))
1565
1565
  return "";
1566
1566
  const o = e.preserveHgComments === !0;
1567
1567
  let a = "";
1568
- for (const c of r) {
1568
+ for (const c of i) {
1569
1569
  const h = { ...e.context, [t.item]: c };
1570
1570
  o && (a += t.opener.raw);
1571
1571
  let l = await ne(t.body, {
1572
1572
  ...e,
1573
1573
  context: h
1574
- }, n, i);
1574
+ }, n, r);
1575
1575
  o || (l = te(l));
1576
1576
  const d = await _e(l, h, {
1577
1577
  path: e.path,
1578
1578
  registry: e.registry,
1579
1579
  loader: e.loader,
1580
1580
  rootDir: e.rootDir,
1581
- warnings: i,
1581
+ warnings: r,
1582
1582
  visitStack: e.visitStack,
1583
1583
  parentContext: e.parentContext ?? e.context,
1584
1584
  preserveHgComments: e.preserveHgComments,
@@ -1591,13 +1591,13 @@ async function yt(t, e, n, i) {
1591
1591
  n.exit();
1592
1592
  }
1593
1593
  }
1594
- function Y(t, e, n, i, s = !1, r = !1) {
1594
+ function Y(t, e, n, r, s = !1, i = !1) {
1595
1595
  return ye(e) ? e : ve(e, {
1596
1596
  rootDir: t,
1597
- fromPath: i,
1597
+ fromPath: r,
1598
1598
  documentPath: n,
1599
1599
  constrainToRoot: s,
1600
- hyogenPath: r
1600
+ hyogenPath: i
1601
1601
  });
1602
1602
  }
1603
1603
  function Te(t) {
@@ -1615,25 +1615,25 @@ function Ee(t) {
1615
1615
  return e;
1616
1616
  }
1617
1617
  function D(t, e) {
1618
- const n = Te(t), i = Ee(e), s = Math.max(n, i);
1618
+ const n = Te(t), r = Ee(e), s = Math.max(n, r);
1619
1619
  return t.slice(0, t.length - n) + `
1620
- `.repeat(s) + e.slice(i);
1620
+ `.repeat(s) + e.slice(r);
1621
1621
  }
1622
- function ie(t, e) {
1623
- const n = Te(t), i = Ee(e);
1624
- return n + i - Math.max(n, i);
1622
+ function re(t, e) {
1623
+ const n = Te(t), r = Ee(e);
1624
+ return n + r - Math.max(n, r);
1625
1625
  }
1626
1626
  function fe(t, e, n) {
1627
- const i = t.indexOf(e);
1628
- if (i < 0)
1627
+ const r = t.indexOf(e);
1628
+ if (r < 0)
1629
1629
  return t;
1630
- const s = t.slice(0, i), r = t.slice(i + e.length);
1631
- return D(D(s, n), r);
1630
+ const s = t.slice(0, r), i = t.slice(r + e.length);
1631
+ return D(D(s, n), i);
1632
1632
  }
1633
1633
  async function vt(t) {
1634
1634
  let e = t.source;
1635
1635
  for (const n of t.directives) {
1636
- const i = Y(
1636
+ const r = Y(
1637
1637
  t.root,
1638
1638
  n.path,
1639
1639
  t.path,
@@ -1642,39 +1642,39 @@ async function vt(t) {
1642
1642
  !0
1643
1643
  );
1644
1644
  if (t.visitStack) {
1645
- const s = t.visitStack.check(i);
1645
+ const s = t.visitStack.check(r);
1646
1646
  if (s.circular) {
1647
1647
  t.warnings?.push({
1648
1648
  code: "circular_include",
1649
1649
  message: O("circular_include", {
1650
- path: i,
1650
+ path: r,
1651
1651
  from: s.from,
1652
1652
  via: "include"
1653
1653
  }),
1654
1654
  path: t.path,
1655
1655
  details: {
1656
- path: i,
1656
+ path: r,
1657
1657
  from: s.from,
1658
1658
  via: "include"
1659
1659
  }
1660
1660
  }), e = fe(e, n.marker, "");
1661
1661
  continue;
1662
1662
  }
1663
- t.visitStack.push(i);
1663
+ t.visitStack.push(r);
1664
1664
  }
1665
1665
  try {
1666
- const s = await t.loader(i), r = await Yt(s, {
1666
+ const s = await t.loader(r), i = await Yt(s, {
1667
1667
  context: t.context,
1668
1668
  loader: t.loader,
1669
1669
  root: t.root,
1670
- path: i,
1670
+ path: r,
1671
1671
  preserveFrontMatter: t.preserveFrontMatter,
1672
1672
  preserveHgComments: t.preserveHgComments,
1673
1673
  visitStack: t.visitStack,
1674
1674
  warnings: t.warnings,
1675
1675
  registry: t.registry
1676
1676
  }), o = t.preserveHgComments && n.raw ? `${n.raw}
1677
- ${r}` : r;
1677
+ ${i}` : i;
1678
1678
  e = fe(e, n.marker, o);
1679
1679
  } finally {
1680
1680
  t.visitStack?.pop();
@@ -1699,29 +1699,29 @@ class Le {
1699
1699
  }
1700
1700
  }
1701
1701
  async function _t(t, e, n = {}) {
1702
- const { path: i, constBindings: s = /* @__PURE__ */ new Set() } = n, r = await w(t.expr, { context: e, path: i });
1702
+ const { path: r, constBindings: s = /* @__PURE__ */ new Set() } = n, i = await w(t.expr, { context: e, path: r });
1703
1703
  switch (t.kind) {
1704
1704
  case "const": {
1705
1705
  if (s.has(t.name))
1706
1706
  throw u({
1707
1707
  code: "parse_error",
1708
- path: i,
1708
+ path: r,
1709
1709
  details: {
1710
1710
  message: `cannot reassign const binding: ${t.name}`
1711
1711
  }
1712
1712
  });
1713
- e[t.name] = r, s.add(t.name);
1713
+ e[t.name] = i, s.add(t.name);
1714
1714
  break;
1715
1715
  }
1716
1716
  case "let": {
1717
- e[t.name] = r;
1717
+ e[t.name] = i;
1718
1718
  break;
1719
1719
  }
1720
1720
  case "assign": {
1721
1721
  if (s.has(t.name))
1722
1722
  throw u({
1723
1723
  code: "parse_error",
1724
- path: i,
1724
+ path: r,
1725
1725
  details: {
1726
1726
  message: `cannot reassign const binding: ${t.name}`
1727
1727
  }
@@ -1729,12 +1729,12 @@ async function _t(t, e, n = {}) {
1729
1729
  if (!(t.name in e))
1730
1730
  throw u({
1731
1731
  code: "parse_error",
1732
- path: i,
1732
+ path: r,
1733
1733
  details: {
1734
1734
  message: `assignment to undeclared variable: ${t.name}`
1735
1735
  }
1736
1736
  });
1737
- e[t.name] = r;
1737
+ e[t.name] = i;
1738
1738
  break;
1739
1739
  }
1740
1740
  }
@@ -1742,20 +1742,20 @@ async function _t(t, e, n = {}) {
1742
1742
  function pe(t) {
1743
1743
  return !t;
1744
1744
  }
1745
- async function B(t, e, n = {}) {
1746
- const { path: i, constBindings: s = /* @__PURE__ */ new Set(), onUpdate: r } = n;
1745
+ async function j(t, e, n = {}) {
1746
+ const { path: r, constBindings: s = /* @__PURE__ */ new Set(), onUpdate: i } = n;
1747
1747
  switch (t.kind) {
1748
1748
  case "const":
1749
1749
  case "let":
1750
1750
  case "assign": {
1751
- await _t(t, e, { path: i, constBindings: s }), r?.(t.name);
1751
+ await _t(t, e, { path: r, constBindings: s }), i?.(t.name);
1752
1752
  return;
1753
1753
  }
1754
1754
  case "update": {
1755
1755
  if (s.has(t.name))
1756
1756
  throw u({
1757
1757
  code: "parse_error",
1758
- path: i,
1758
+ path: r,
1759
1759
  details: {
1760
1760
  message: `cannot reassign const binding: ${t.name}`
1761
1761
  }
@@ -1763,20 +1763,20 @@ async function B(t, e, n = {}) {
1763
1763
  if (!(t.name in e))
1764
1764
  throw u({
1765
1765
  code: "parse_error",
1766
- path: i,
1766
+ path: r,
1767
1767
  details: {
1768
1768
  message: `assignment to undeclared variable: ${t.name}`
1769
1769
  }
1770
1770
  });
1771
1771
  const o = Number(e[t.name]), a = t.op === "++" ? o + 1 : o - 1;
1772
- e[t.name] = a, r?.(t.name);
1772
+ e[t.name] = a, i?.(t.name);
1773
1773
  return;
1774
1774
  }
1775
1775
  case "compound_assign": {
1776
1776
  if (s.has(t.name))
1777
1777
  throw u({
1778
1778
  code: "parse_error",
1779
- path: i,
1779
+ path: r,
1780
1780
  details: {
1781
1781
  message: `cannot reassign const binding: ${t.name}`
1782
1782
  }
@@ -1784,12 +1784,12 @@ async function B(t, e, n = {}) {
1784
1784
  if (!(t.name in e))
1785
1785
  throw u({
1786
1786
  code: "parse_error",
1787
- path: i,
1787
+ path: r,
1788
1788
  details: {
1789
1789
  message: `assignment to undeclared variable: ${t.name}`
1790
1790
  }
1791
1791
  });
1792
- const o = await w(t.expr, { context: e, path: i }), a = Number(e[t.name]), c = Number(o);
1792
+ const o = await w(t.expr, { context: e, path: r }), a = Number(e[t.name]), c = Number(o);
1793
1793
  let h;
1794
1794
  switch (t.op) {
1795
1795
  case "+=":
@@ -1805,30 +1805,30 @@ async function B(t, e, n = {}) {
1805
1805
  h = a / c;
1806
1806
  break;
1807
1807
  }
1808
- e[t.name] = h, r?.(t.name);
1808
+ e[t.name] = h, i?.(t.name);
1809
1809
  return;
1810
1810
  }
1811
1811
  case "for": {
1812
- for (t.init && await B(t.init, e, n); ; ) {
1812
+ for (t.init && await j(t.init, e, n); ; ) {
1813
1813
  const o = await w(t.cond, {
1814
1814
  context: e,
1815
- path: i
1815
+ path: r
1816
1816
  });
1817
1817
  if (pe(o))
1818
1818
  break;
1819
1819
  for (const a of t.body)
1820
- await B(a, e, n);
1821
- t.update && await B(t.update, e, n);
1820
+ await j(a, e, n);
1821
+ t.update && await j(t.update, e, n);
1822
1822
  }
1823
1823
  return;
1824
1824
  }
1825
1825
  case "do_while": {
1826
1826
  do {
1827
1827
  for (const a of t.body)
1828
- await B(a, e, n);
1828
+ await j(a, e, n);
1829
1829
  const o = await w(t.cond, {
1830
1830
  context: e,
1831
- path: i
1831
+ path: r
1832
1832
  });
1833
1833
  if (pe(o))
1834
1834
  break;
@@ -1838,8 +1838,8 @@ async function B(t, e, n = {}) {
1838
1838
  }
1839
1839
  }
1840
1840
  async function me(t, e, n = {}) {
1841
- for (const i of t)
1842
- await B(i, e, n);
1841
+ for (const r of t)
1842
+ await j(r, e, n);
1843
1843
  }
1844
1844
  const St = /* @__PURE__ */ new Set([
1845
1845
  "if",
@@ -1862,20 +1862,20 @@ const St = /* @__PURE__ */ new Set([
1862
1862
  function Me(t) {
1863
1863
  return St.has(t);
1864
1864
  }
1865
- function re(t) {
1866
- let e = "", n = 0, i = null;
1865
+ function ie(t) {
1866
+ let e = "", n = 0, r = null;
1867
1867
  for (; n < t.length; ) {
1868
1868
  const s = t[n];
1869
- if (i) {
1869
+ if (r) {
1870
1870
  if (e += s, s === "\\" && n + 1 < t.length) {
1871
1871
  e += t[++n], n++;
1872
1872
  continue;
1873
1873
  }
1874
- s === i && (i = null), n++;
1874
+ s === r && (r = null), n++;
1875
1875
  continue;
1876
1876
  }
1877
1877
  if (s === '"' || s === "'" || s === "`") {
1878
- i = s, e += s, n++;
1878
+ r = s, e += s, n++;
1879
1879
  continue;
1880
1880
  }
1881
1881
  if (t.startsWith("//", n)) {
@@ -1885,10 +1885,10 @@ function re(t) {
1885
1885
  continue;
1886
1886
  }
1887
1887
  if (t.startsWith("/*", n)) {
1888
- const r = t.indexOf("*/", n + 2);
1889
- if (r === -1)
1888
+ const i = t.indexOf("*/", n + 2);
1889
+ if (i === -1)
1890
1890
  break;
1891
- n = r + 2;
1891
+ n = i + 2;
1892
1892
  continue;
1893
1893
  }
1894
1894
  e += s, n++;
@@ -1903,21 +1903,21 @@ function k(t, e) {
1903
1903
  });
1904
1904
  }
1905
1905
  function ge(t, e) {
1906
- const n = re(t).trim();
1906
+ const n = ie(t).trim();
1907
1907
  if (n.length === 0)
1908
1908
  throw k(e, "empty statement block");
1909
- const i = new se(n, e), s = i.parseStatementList();
1910
- if (i.skipWhitespace(), i.hasMore())
1909
+ const r = new se(n, e), s = r.parseStatementList();
1910
+ if (r.skipWhitespace(), r.hasMore())
1911
1911
  throw k(
1912
1912
  e,
1913
- `unexpected token at position ${i.position}`
1913
+ `unexpected token at position ${r.position}`
1914
1914
  );
1915
1915
  if (s.length === 0)
1916
1916
  throw k(e, "empty statement block");
1917
1917
  return s;
1918
1918
  }
1919
1919
  function Re(t) {
1920
- const e = re(t).trim();
1920
+ const e = ie(t).trim();
1921
1921
  return e.length === 0 ? !1 : /^const\s+/.test(e) || /^let\s+/.test(e) || /^for\s*\(/.test(e) || /^do\b/.test(e) || /^(\+\+|--)/.test(e) || /^[A-Za-z_$][A-Za-z0-9_$]*\s*(\+\+|--|[+\-*/]=|=)/.test(e);
1922
1922
  }
1923
1923
  class se {
@@ -1971,13 +1971,13 @@ class se {
1971
1971
  const s = this.input.slice(this.index - 2, this.index);
1972
1972
  return { kind: "update", name: n, op: s, position: "postfix" };
1973
1973
  }
1974
- const i = this.readCompoundOp();
1975
- if (i) {
1974
+ const r = this.readCompoundOp();
1975
+ if (r) {
1976
1976
  const s = this.readExpressionSourceUntilTerminator();
1977
1977
  return {
1978
1978
  kind: "compound_assign",
1979
1979
  name: n,
1980
- op: i,
1980
+ op: r,
1981
1981
  expr: C(s, this.path)
1982
1982
  };
1983
1983
  }
@@ -2008,11 +2008,11 @@ class se {
2008
2008
  throw k(this.path, `expected identifier after ${e}`);
2009
2009
  if (this.assertAssignableName(n), this.skipWhitespace(), !this.match("="))
2010
2010
  throw k(this.path, `expected '=' in ${e} declaration`);
2011
- const i = this.readExpressionSourceUntilTerminator();
2011
+ const r = this.readExpressionSourceUntilTerminator();
2012
2012
  return {
2013
2013
  kind: e,
2014
2014
  name: n,
2015
- expr: C(i, this.path)
2015
+ expr: C(r, this.path)
2016
2016
  };
2017
2017
  }
2018
2018
  parseFor() {
@@ -2024,15 +2024,15 @@ class se {
2024
2024
  this.path,
2025
2025
  "for…of / for…in are not allowed; use for (init; cond; update)"
2026
2026
  );
2027
- const [i, s, r] = n;
2027
+ const [r, s, i] = n;
2028
2028
  if (s.trim().length === 0)
2029
2029
  throw k(this.path, "for loop condition cannot be empty");
2030
- if (/^\s*[A-Za-z_$][A-Za-z0-9_$]*\s+(of|in)\s+/.test(i))
2030
+ if (/^\s*[A-Za-z_$][A-Za-z0-9_$]*\s+(of|in)\s+/.test(r))
2031
2031
  throw k(
2032
2032
  this.path,
2033
2033
  "for…of / for…in are not allowed; use for (init; cond; update)"
2034
2034
  );
2035
- const o = i.trim().length === 0 ? null : this.parseClauseStatement(i.trim()), a = C(s.trim(), this.path), c = r.trim().length === 0 ? null : this.parseClauseStatement(r.trim());
2035
+ const o = r.trim().length === 0 ? null : this.parseClauseStatement(r.trim()), a = C(s.trim(), this.path), c = i.trim().length === 0 ? null : this.parseClauseStatement(i.trim());
2036
2036
  if (this.skipWhitespace(), !this.match("{"))
2037
2037
  throw k(this.path, "expected '{' after for (...)");
2038
2038
  const h = this.parseStatementList();
@@ -2053,17 +2053,17 @@ class se {
2053
2053
  const n = this.readBalanced(")");
2054
2054
  if (n.trim().length === 0)
2055
2055
  throw k(this.path, "do…while condition cannot be empty");
2056
- const i = C(n.trim(), this.path);
2057
- return { kind: "do_while", body: e, cond: i };
2056
+ const r = C(n.trim(), this.path);
2057
+ return { kind: "do_while", body: e, cond: r };
2058
2058
  }
2059
2059
  parseClauseStatement(e) {
2060
- const n = new se(e, this.path), i = n.parseSimpleStatement();
2060
+ const n = new se(e, this.path), r = n.parseSimpleStatement();
2061
2061
  if (n.skipWhitespace(), n.hasMore())
2062
2062
  throw k(
2063
2063
  this.path,
2064
2064
  `unexpected token in for clause at position ${n.position}`
2065
2065
  );
2066
- return i;
2066
+ return r;
2067
2067
  }
2068
2068
  assertAssignableName(e) {
2069
2069
  if (Me(e))
@@ -2075,28 +2075,28 @@ class se {
2075
2075
  readExpressionSourceUntilTerminator() {
2076
2076
  this.skipWhitespace();
2077
2077
  const e = this.index;
2078
- let n = 0, i = 0, s = 0, r = null;
2078
+ let n = 0, r = 0, s = 0, i = null;
2079
2079
  for (; this.index < this.input.length; ) {
2080
2080
  const a = this.input[this.index];
2081
- if (r) {
2081
+ if (i) {
2082
2082
  if (a === "\\") {
2083
2083
  this.index += 2;
2084
2084
  continue;
2085
2085
  }
2086
- a === r && (r = null), this.index++;
2086
+ a === i && (i = null), this.index++;
2087
2087
  continue;
2088
2088
  }
2089
2089
  if (a === '"' || a === "'" || a === "`") {
2090
- r = a, this.index++;
2090
+ i = a, this.index++;
2091
2091
  continue;
2092
2092
  }
2093
- if (a === "(" && n++, a === ")" && (n = Math.max(0, n - 1)), a === "{" && i++, a === "}") {
2094
- if (i === 0 && n === 0 && s === 0)
2093
+ if (a === "(" && n++, a === ")" && (n = Math.max(0, n - 1)), a === "{" && r++, a === "}") {
2094
+ if (r === 0 && n === 0 && s === 0)
2095
2095
  break;
2096
- i = Math.max(0, i - 1);
2096
+ r = Math.max(0, r - 1);
2097
2097
  }
2098
2098
  if (a === "[" && s++, a === "]" && (s = Math.max(0, s - 1)), (a === ";" || a === `
2099
- `) && n === 0 && i === 0 && s === 0)
2099
+ `) && n === 0 && r === 0 && s === 0)
2100
2100
  break;
2101
2101
  this.index++;
2102
2102
  }
@@ -2107,29 +2107,29 @@ class se {
2107
2107
  }
2108
2108
  readBalanced(e) {
2109
2109
  const n = e === ")" ? "(" : "{";
2110
- let i = 1;
2110
+ let r = 1;
2111
2111
  const s = this.index;
2112
- let r = null;
2112
+ let i = null;
2113
2113
  for (; this.index < this.input.length; ) {
2114
2114
  const o = this.input[this.index];
2115
- if (r) {
2115
+ if (i) {
2116
2116
  if (o === "\\") {
2117
2117
  this.index += 2;
2118
2118
  continue;
2119
2119
  }
2120
- o === r && (r = null), this.index++;
2120
+ o === i && (i = null), this.index++;
2121
2121
  continue;
2122
2122
  }
2123
2123
  if (o === '"' || o === "'" || o === "`") {
2124
- r = o, this.index++;
2124
+ i = o, this.index++;
2125
2125
  continue;
2126
2126
  }
2127
2127
  if (o === n) {
2128
- i++, this.index++;
2128
+ r++, this.index++;
2129
2129
  continue;
2130
2130
  }
2131
2131
  if (o === e) {
2132
- if (i--, i === 0) {
2132
+ if (r--, r === 0) {
2133
2133
  const a = this.input.slice(s, this.index);
2134
2134
  return this.index++, a;
2135
2135
  }
@@ -2175,12 +2175,12 @@ class se {
2175
2175
  }
2176
2176
  function Ct(t) {
2177
2177
  const e = [];
2178
- let n = "", i = 0, s = null;
2179
- for (let r = 0; r < t.length; r++) {
2180
- const o = t[r];
2178
+ let n = "", r = 0, s = null;
2179
+ for (let i = 0; i < t.length; i++) {
2180
+ const o = t[i];
2181
2181
  if (s) {
2182
- if (n += o, o === "\\" && r + 1 < t.length) {
2183
- n += t[++r];
2182
+ if (n += o, o === "\\" && i + 1 < t.length) {
2183
+ n += t[++i];
2184
2184
  continue;
2185
2185
  }
2186
2186
  o === s && (s = null);
@@ -2191,14 +2191,14 @@ function Ct(t) {
2191
2191
  continue;
2192
2192
  }
2193
2193
  if (o === "(" || o === "[" || o === "{") {
2194
- i++, n += o;
2194
+ r++, n += o;
2195
2195
  continue;
2196
2196
  }
2197
2197
  if (o === ")" || o === "]" || o === "}") {
2198
- i = Math.max(0, i - 1), n += o;
2198
+ r = Math.max(0, r - 1), n += o;
2199
2199
  continue;
2200
2200
  }
2201
- if (o === ";" && i === 0) {
2201
+ if (o === ";" && r === 0) {
2202
2202
  e.push(n), n = "";
2203
2203
  continue;
2204
2204
  }
@@ -2215,14 +2215,14 @@ function oe(t, e) {
2215
2215
  path: e,
2216
2216
  details: { message: "missing extend path" }
2217
2217
  });
2218
- const i = /^extend\s+(\S+)\s*$/.exec(n);
2219
- if (!i)
2218
+ const r = /^extend\s+(\S+)\s*$/.exec(n);
2219
+ if (!r)
2220
2220
  throw u({
2221
2221
  code: "parse_error",
2222
2222
  path: e,
2223
2223
  details: { message: "invalid extend directive" }
2224
2224
  });
2225
- const s = i[1];
2225
+ const s = r[1];
2226
2226
  if (s.length === 0)
2227
2227
  throw u({
2228
2228
  code: "parse_error",
@@ -2234,10 +2234,10 @@ function oe(t, e) {
2234
2234
  function At(t, e) {
2235
2235
  const n = E(t);
2236
2236
  if (n.length === 0) return null;
2237
- const i = n[0], s = oe(i, e);
2237
+ const r = n[0], s = oe(r, e);
2238
2238
  if (!s) return null;
2239
- for (const r of n.slice(1))
2240
- if (/^extend\s+/i.test(r))
2239
+ for (const i of n.slice(1))
2240
+ if (/^extend\s+/i.test(i))
2241
2241
  throw u({
2242
2242
  code: "parse_error",
2243
2243
  path: e,
@@ -2250,7 +2250,7 @@ function At(t, e) {
2250
2250
  };
2251
2251
  }
2252
2252
  async function Wt(t, e = {}) {
2253
- const n = e.path, i = e.context ?? {};
2253
+ const n = e.path, r = e.context ?? {};
2254
2254
  if (Se(t))
2255
2255
  throw u({
2256
2256
  code: "parse_error",
@@ -2261,9 +2261,9 @@ async function Wt(t, e = {}) {
2261
2261
  });
2262
2262
  const s = T(t);
2263
2263
  if (s.length === 0)
2264
- return { source: t, context: i, declarationUpdates: {} };
2265
- const r = /* @__PURE__ */ new Set(), o = {}, a = (l) => {
2266
- o[l] = i[l];
2264
+ return { source: t, context: r, declarationUpdates: {} };
2265
+ const i = /* @__PURE__ */ new Set(), o = {}, a = (l) => {
2266
+ o[l] = r[l];
2267
2267
  };
2268
2268
  let c = t, h = 0;
2269
2269
  for (const l of s) {
@@ -2277,9 +2277,9 @@ async function Wt(t, e = {}) {
2277
2277
  f.declarationsSource,
2278
2278
  n
2279
2279
  );
2280
- await me(P, i, {
2280
+ await me(P, r, {
2281
2281
  path: n,
2282
- constBindings: r,
2282
+ constBindings: i,
2283
2283
  onUpdate: a
2284
2284
  });
2285
2285
  }
@@ -2301,15 +2301,15 @@ extend ${f.path}
2301
2301
  });
2302
2302
  }
2303
2303
  const m = ge(g, n);
2304
- await me(m, i, {
2304
+ await me(m, r, {
2305
2305
  path: n,
2306
- constBindings: r,
2306
+ constBindings: i,
2307
2307
  onUpdate: a
2308
2308
  });
2309
2309
  const p = l.start - h, A = l.end - h, L = c.slice(0, p), b = c.slice(A);
2310
- c = D(L, b), h += l.raw.length + ie(L, b);
2310
+ c = D(L, b), h += l.raw.length + re(L, b);
2311
2311
  }
2312
- return { source: c, context: i, declarationUpdates: o };
2312
+ return { source: c, context: r, declarationUpdates: o };
2313
2313
  }
2314
2314
  const $t = /^component\s+(\S+)\s+as\s+([A-Za-z_$][A-Za-z0-9_$]*)\s*$/;
2315
2315
  function Tt(t, e) {
@@ -2320,8 +2320,8 @@ function Tt(t, e) {
2320
2320
  path: e,
2321
2321
  details: { message: "empty hyogen block" }
2322
2322
  });
2323
- const i = n.split(/\r?\n/).map((a) => a.trim()).filter((a) => a.length > 0);
2324
- if (i.length !== 1)
2323
+ const r = n.split(/\r?\n/).map((a) => a.trim()).filter((a) => a.length > 0);
2324
+ if (r.length !== 1)
2325
2325
  throw u({
2326
2326
  code: "parse_error",
2327
2327
  path: e,
@@ -2329,21 +2329,21 @@ function Tt(t, e) {
2329
2329
  message: "hyogen block must contain a single component directive"
2330
2330
  }
2331
2331
  });
2332
- const s = i[0];
2332
+ const s = r[0];
2333
2333
  if (/^include\s+/i.test(s))
2334
2334
  throw u({
2335
2335
  code: "parse_error",
2336
2336
  path: e,
2337
2337
  details: { message: "include and component cannot coexist in one block" }
2338
2338
  });
2339
- const r = $t.exec(s);
2340
- if (!r)
2339
+ const i = $t.exec(s);
2340
+ if (!i)
2341
2341
  throw u({
2342
2342
  code: "parse_error",
2343
2343
  path: e,
2344
2344
  details: { message: `unsupported component directive: ${s}` }
2345
2345
  });
2346
- const o = r[1];
2346
+ const o = i[1];
2347
2347
  if (o.length === 0)
2348
2348
  throw u({
2349
2349
  code: "parse_error",
@@ -2353,7 +2353,7 @@ function Tt(t, e) {
2353
2353
  return {
2354
2354
  kind: "component",
2355
2355
  path: o,
2356
- alias: r[2]
2356
+ alias: i[2]
2357
2357
  };
2358
2358
  }
2359
2359
  function Et(t, e) {
@@ -2364,16 +2364,16 @@ function Et(t, e) {
2364
2364
  path: e,
2365
2365
  details: { message: "empty hyogen block" }
2366
2366
  });
2367
- const i = n.split(/\r?\n/).map((o) => o.trim()).filter((o) => o.length > 0);
2368
- if (i.length !== 1)
2367
+ const r = n.split(/\r?\n/).map((o) => o.trim()).filter((o) => o.length > 0);
2368
+ if (r.length !== 1)
2369
2369
  throw u({
2370
2370
  code: "parse_error",
2371
2371
  path: e,
2372
2372
  details: { message: "hyogen block must contain a single include directive" }
2373
2373
  });
2374
- const s = i[0], r = /^include\s+(\S+)\s*$/.exec(s);
2375
- if (r)
2376
- return { kind: "include", path: r[1] };
2374
+ const s = r[0], i = /^include\s+(\S+)\s*$/.exec(s);
2375
+ if (i)
2376
+ return { kind: "include", path: i[1] };
2377
2377
  throw u({
2378
2378
  code: "parse_error",
2379
2379
  path: e,
@@ -2381,7 +2381,7 @@ function Et(t, e) {
2381
2381
  });
2382
2382
  }
2383
2383
  function Lt(t) {
2384
- const e = re(t).trim();
2384
+ const e = ie(t).trim();
2385
2385
  return e.length === 0 ? !1 : /^const\s+/.test(e) || /^let\s+/.test(e) || /^[A-Za-z_$][A-Za-z0-9_$]*\s*=/.test(e);
2386
2386
  }
2387
2387
  const Mt = "\0HYOGEN_INCLUDE_";
@@ -2400,23 +2400,23 @@ function Ot(t, e) {
2400
2400
  path: e,
2401
2401
  details: { message: "hyogen block must contain a single directive" }
2402
2402
  });
2403
- const i = n[0];
2404
- if (/^include\s+/i.test(i) && /\bcomponent\s+/i.test(i))
2403
+ const r = n[0];
2404
+ if (/^include\s+/i.test(r) && /\bcomponent\s+/i.test(r))
2405
2405
  throw u({
2406
2406
  code: "parse_error",
2407
2407
  path: e,
2408
2408
  details: { message: "include and component cannot coexist in one block" }
2409
2409
  });
2410
- if (/^include\s+/i.test(i))
2410
+ if (/^include\s+/i.test(r))
2411
2411
  return Et(t, e);
2412
- if (/^component\s+/i.test(i))
2412
+ if (/^component\s+/i.test(r))
2413
2413
  return Tt(t, e);
2414
- if (i === "endblock" || /^block\s+/.test(i) || /^extend\s+/.test(i))
2414
+ if (r === "endblock" || /^block\s+/.test(r) || /^extend\s+/.test(r))
2415
2415
  return null;
2416
2416
  throw u({
2417
2417
  code: "parse_error",
2418
2418
  path: e,
2419
- details: { message: `unsupported hyogen directive: ${i}` }
2419
+ details: { message: `unsupported hyogen directive: ${r}` }
2420
2420
  });
2421
2421
  }
2422
2422
  function Dt(t, e = {}) {
@@ -2429,12 +2429,12 @@ function Dt(t, e = {}) {
2429
2429
  message: Ce(t) ?? "unclosed hyogen block (missing closing marker)"
2430
2430
  }
2431
2431
  });
2432
- const i = T(t);
2433
- if (i.length === 0)
2432
+ const r = T(t);
2433
+ if (r.length === 0)
2434
2434
  return { source: t, directives: [] };
2435
2435
  const s = [];
2436
- let r = t, o = 0, a = 0;
2437
- for (const c of i) {
2436
+ let i = t, o = 0, a = 0;
2437
+ for (const c of r) {
2438
2438
  const h = Ot(c.inner, n);
2439
2439
  if (!h || h.kind === "control")
2440
2440
  continue;
@@ -2449,46 +2449,46 @@ function Dt(t, e = {}) {
2449
2449
  Object.keys(e.context ?? {}),
2450
2450
  n
2451
2451
  );
2452
- const g = r.slice(0, l), m = r.slice(d);
2453
- r = D(g, m), o += c.raw.length + ie(g, m);
2452
+ const g = i.slice(0, l), m = i.slice(d);
2453
+ i = D(g, m), o += c.raw.length + re(g, m);
2454
2454
  continue;
2455
2455
  }
2456
2456
  const f = Rt(a++);
2457
- s.push({ ...h, marker: f, raw: c.raw }), r = r.slice(0, l) + f + r.slice(d), o += c.raw.length - f.length;
2457
+ s.push({ ...h, marker: f, raw: c.raw }), i = i.slice(0, l) + f + i.slice(d), o += c.raw.length - f.length;
2458
2458
  }
2459
- return { source: r, directives: s };
2459
+ return { source: i, directives: s };
2460
2460
  }
2461
- function Bt(t, e) {
2461
+ function jt(t, e) {
2462
2462
  return !e.preserveFrontMatter || !e.rawFrontMatter ? t : t.length === 0 ? `${e.rawFrontMatter}
2463
2463
  ` : `${e.rawFrontMatter}
2464
2464
  ${t}`;
2465
2465
  }
2466
- function jt(t, e = !1) {
2466
+ function Bt(t, e = !1) {
2467
2467
  if (e)
2468
2468
  return t;
2469
2469
  const n = T(t);
2470
2470
  if (n.length === 0)
2471
2471
  return t;
2472
- let i = t, s = 0;
2473
- for (const r of n) {
2474
- const o = r.start - s, a = r.end - s, c = i.slice(0, o), h = i.slice(a);
2475
- i = D(c, h), s += r.raw.length + ie(c, h);
2472
+ let r = t, s = 0;
2473
+ for (const i of n) {
2474
+ const o = i.start - s, a = i.end - s, c = r.slice(0, o), h = r.slice(a);
2475
+ r = D(c, h), s += i.raw.length + re(c, h);
2476
2476
  }
2477
- return i;
2477
+ return r;
2478
2478
  }
2479
2479
  const Nt = /^block\s+([A-Za-z_$][A-Za-z0-9_$]*)$/;
2480
2480
  function Ht(t, e) {
2481
2481
  const n = t.trim();
2482
2482
  if (n === "endblock")
2483
2483
  return { kind: "endblock" };
2484
- const i = Nt.exec(n);
2485
- if (!i)
2484
+ const r = Nt.exec(n);
2485
+ if (!r)
2486
2486
  throw u({
2487
2487
  code: "parse_error",
2488
2488
  path: e,
2489
2489
  details: { message: "invalid block directive" }
2490
2490
  });
2491
- const s = i[1];
2491
+ const s = r[1];
2492
2492
  if (Me(s))
2493
2493
  throw u({
2494
2494
  code: "parse_error",
@@ -2498,15 +2498,15 @@ function Ht(t, e) {
2498
2498
  return { kind: "block", name: s };
2499
2499
  }
2500
2500
  function xe(t, e) {
2501
- const { path: n, mode: i, hasExtend: s = !1 } = e, r = T(t);
2502
- if (r.length === 0) return [];
2501
+ const { path: n, mode: r, hasExtend: s = !1 } = e, i = T(t);
2502
+ if (i.length === 0) return [];
2503
2503
  const o = [], a = [], c = /* @__PURE__ */ new Set();
2504
- for (const h of r) {
2504
+ for (const h of i) {
2505
2505
  const l = E(h.inner);
2506
2506
  if (l.length !== 1) continue;
2507
2507
  const d = l[0];
2508
2508
  if (!(d === "endblock" || d.startsWith("block "))) continue;
2509
- if (i === "child" && !s)
2509
+ if (r === "child" && !s)
2510
2510
  throw u({
2511
2511
  code: "parse_error",
2512
2512
  path: n,
@@ -2558,20 +2558,20 @@ function xe(t, e) {
2558
2558
  }
2559
2559
  function ke(t) {
2560
2560
  const e = T(t), n = [];
2561
- for (const i of e) {
2562
- const s = E(i.inner);
2561
+ for (const r of e) {
2562
+ const s = E(r.inner);
2563
2563
  if (s.length === 0) continue;
2564
- const r = oe(s[0]);
2565
- r && n.push({ path: r.path, start: i.start });
2564
+ const i = oe(s[0]);
2565
+ i && n.push({ path: i.path, start: r.start });
2566
2566
  }
2567
2567
  return n;
2568
2568
  }
2569
2569
  function Pt(t) {
2570
2570
  const e = T(t);
2571
2571
  for (const n of e) {
2572
- const i = E(n.inner);
2573
- if (i.length !== 1) continue;
2574
- const s = i[0];
2572
+ const r = E(n.inner);
2573
+ if (r.length !== 1) continue;
2574
+ const s = r[0];
2575
2575
  if (s === "endblock" || s.startsWith("block ")) return !0;
2576
2576
  }
2577
2577
  return !1;
@@ -2580,11 +2580,11 @@ function K(t) {
2580
2580
  return t.map((e) => e.body).join("");
2581
2581
  }
2582
2582
  function Ft(t, e, n) {
2583
- const i = [...e].sort((o, a) => o.start - a.start), s = [];
2584
- let r = 0;
2585
- for (const o of i)
2586
- s.push(t.slice(r, o.start)), s.push(n.get(o.name) ?? o.body), r = o.end;
2587
- return s.push(t.slice(r)), s.reduce((o, a) => D(o, a));
2583
+ const r = [...e].sort((o, a) => o.start - a.start), s = [];
2584
+ let i = 0;
2585
+ for (const o of r)
2586
+ s.push(t.slice(i, o.start)), s.push(n.get(o.name) ?? o.body), i = o.end;
2587
+ return s.push(t.slice(i)), s.reduce((o, a) => D(o, a));
2588
2588
  }
2589
2589
  function It(t) {
2590
2590
  if (t instanceof Error && "code" in t && "details" in t) {
@@ -2597,9 +2597,9 @@ function It(t) {
2597
2597
  async function zt(t, e) {
2598
2598
  const {
2599
2599
  path: n,
2600
- context: i,
2600
+ context: r,
2601
2601
  declarationUpdates: s,
2602
- loader: r,
2602
+ loader: i,
2603
2603
  root: o,
2604
2604
  constrainToRoot: a,
2605
2605
  visitStack: c,
@@ -2613,12 +2613,12 @@ async function zt(t, e) {
2613
2613
  path: n,
2614
2614
  details: { message: "orphan block without extend" }
2615
2615
  });
2616
- return { source: t, context: _(i, s) };
2616
+ return { source: t, context: _(r, s) };
2617
2617
  }
2618
2618
  const g = T(t)[0];
2619
2619
  if (!g)
2620
- return { source: t, context: _(i, s) };
2621
- if (!r)
2620
+ return { source: t, context: _(r, s) };
2621
+ if (!i)
2622
2622
  throw new Error("loader is required when processing extend directives");
2623
2623
  const m = E(g.inner);
2624
2624
  if (!(m.length > 0 ? oe(m[0]) : null))
@@ -2646,7 +2646,7 @@ async function zt(t, e) {
2646
2646
  details: { path: n }
2647
2647
  }), {
2648
2648
  source: K(A),
2649
- context: _(i, s)
2649
+ context: _(r, s)
2650
2650
  };
2651
2651
  const L = d[0].path, b = n, v = Y(
2652
2652
  o,
@@ -2671,11 +2671,11 @@ async function zt(t, e) {
2671
2671
  details: { path: v, from: W.from, via: "extend" }
2672
2672
  }), {
2673
2673
  source: K(A),
2674
- context: _(i, s)
2674
+ context: _(r, s)
2675
2675
  };
2676
2676
  c.push(v);
2677
2677
  try {
2678
- const $ = await r(v);
2678
+ const $ = await i(v);
2679
2679
  if ($ === void 0)
2680
2680
  throw new Error("loader returned undefined");
2681
2681
  const { context: P, body: F } = H(
@@ -2703,7 +2703,7 @@ async function zt(t, e) {
2703
2703
  details: { path: I, from: z.from, via: "extend" }
2704
2704
  }), {
2705
2705
  source: K(A),
2706
- context: _(i, s)
2706
+ context: _(r, s)
2707
2707
  };
2708
2708
  throw u({
2709
2709
  code: "parse_error",
@@ -2716,16 +2716,16 @@ async function zt(t, e) {
2716
2716
  mode: "layout"
2717
2717
  }), De = new Map(
2718
2718
  A.map((N) => [N.name, N.body])
2719
- ), Be = Ft(
2719
+ ), je = Ft(
2720
2720
  F,
2721
2721
  Oe,
2722
2722
  De
2723
- ), je = _(
2724
- i,
2723
+ ), Be = _(
2724
+ r,
2725
2725
  P,
2726
2726
  s
2727
2727
  );
2728
- return { source: Be, context: je };
2728
+ return { source: je, context: Be };
2729
2729
  } finally {
2730
2730
  c.pop();
2731
2731
  }
@@ -2761,7 +2761,7 @@ const Ut = J.warningReasons, Zt = [
2761
2761
  function qt(t) {
2762
2762
  return Ut[t] ?? t;
2763
2763
  }
2764
- function G(t, e, n, i) {
2764
+ function G(t, e, n, r) {
2765
2765
  if (typeof t == "string") {
2766
2766
  for (const s of Zt)
2767
2767
  s.test(t) && n.push({
@@ -2770,7 +2770,7 @@ function G(t, e, n, i) {
2770
2770
  key: e,
2771
2771
  reason: qt(s.reason)
2772
2772
  }),
2773
- path: i,
2773
+ path: r,
2774
2774
  details: { key: e, reason: s.reason }
2775
2775
  });
2776
2776
  return;
@@ -2778,41 +2778,41 @@ function G(t, e, n, i) {
2778
2778
  if (t != null) {
2779
2779
  if (Array.isArray(t)) {
2780
2780
  for (let s = 0; s < t.length; s++)
2781
- G(t[s], `${e}[${s}]`, n, i);
2781
+ G(t[s], `${e}[${s}]`, n, r);
2782
2782
  return;
2783
2783
  }
2784
2784
  if (typeof t == "object")
2785
- for (const [s, r] of Object.entries(
2785
+ for (const [s, i] of Object.entries(
2786
2786
  t
2787
2787
  )) {
2788
2788
  const o = e.length > 0 ? `${e}.${s}` : s;
2789
- G(r, o, n, i);
2789
+ G(i, o, n, r);
2790
2790
  }
2791
2791
  }
2792
2792
  }
2793
2793
  function Vt(t, e, n) {
2794
- for (const [i, s] of Object.entries(t))
2795
- G(s, i, e, n);
2794
+ for (const [r, s] of Object.entries(t))
2795
+ G(s, r, e, n);
2796
2796
  }
2797
2797
  async function ae(t, e) {
2798
- const n = e.path, i = e.context, s = e.registry ?? new be(), r = e.warnings ?? [], o = e.visitStack ?? new Le(), {
2798
+ const n = e.path, r = e.context, s = e.registry ?? new be(), i = e.warnings ?? [], o = e.visitStack ?? new Le(), {
2799
2799
  source: a,
2800
2800
  declarationUpdates: c
2801
- } = await Wt(t, { path: n, context: { ...i } });
2801
+ } = await Wt(t, { path: n, context: { ...r } });
2802
2802
  Vt(
2803
- _(i, c ?? {}),
2804
- r,
2803
+ _(r, c ?? {}),
2804
+ i,
2805
2805
  n
2806
2806
  );
2807
2807
  const h = await zt(a, {
2808
2808
  path: n,
2809
- context: i,
2809
+ context: r,
2810
2810
  declarationUpdates: c ?? {},
2811
2811
  loader: e.loader,
2812
2812
  root: e.root,
2813
2813
  constrainToRoot: e.constrainToRoot,
2814
2814
  visitStack: o,
2815
- warnings: r,
2815
+ warnings: i,
2816
2816
  inComponent: e.inComponent ?? !1
2817
2817
  }), { source: l, context: d } = h, { source: f, directives: g } = Dt(l, {
2818
2818
  path: n,
@@ -2832,7 +2832,7 @@ async function ae(t, e) {
2832
2832
  preserveFrontMatter: e.preserveFrontMatter,
2833
2833
  preserveHgComments: e.preserveHgComments,
2834
2834
  visitStack: o,
2835
- warnings: r,
2835
+ warnings: i,
2836
2836
  registry: s,
2837
2837
  constrainToRoot: e.constrainToRoot
2838
2838
  })), p = await kt(p, {
@@ -2841,7 +2841,7 @@ async function ae(t, e) {
2841
2841
  registry: s,
2842
2842
  loader: m,
2843
2843
  rootDir: e.root,
2844
- warnings: r,
2844
+ warnings: i,
2845
2845
  visitStack: o,
2846
2846
  parentContext: d,
2847
2847
  preserveHgComments: e.preserveHgComments,
@@ -2851,38 +2851,38 @@ async function ae(t, e) {
2851
2851
  registry: s,
2852
2852
  loader: m,
2853
2853
  rootDir: e.root,
2854
- warnings: r,
2854
+ warnings: i,
2855
2855
  visitStack: o,
2856
2856
  parentContext: d,
2857
2857
  preserveHgComments: e.preserveHgComments,
2858
2858
  constrainToRoot: e.constrainToRoot
2859
- }), p = jt(p, e.preserveHgComments), p;
2859
+ }), p = Bt(p, e.preserveHgComments), p;
2860
2860
  }
2861
2861
  async function Kt(t, e = {}) {
2862
- const n = e.path, i = _(e.context), s = e.registry ?? new be(), r = e.warnings ?? [], o = e.visitStack ?? new Le(), { context: a, body: c, rawFrontMatter: h } = H(
2862
+ const n = e.path, r = _(e.context), s = e.registry ?? new be(), i = e.warnings ?? [], o = e.visitStack ?? new Le(), { context: a, body: c, rawFrontMatter: h } = H(
2863
2863
  t,
2864
2864
  n
2865
- ), l = _(i, a);
2865
+ ), l = _(r, a);
2866
2866
  let d = await ae(c, {
2867
2867
  ...e,
2868
2868
  context: l,
2869
2869
  registry: s,
2870
- warnings: r,
2870
+ warnings: i,
2871
2871
  visitStack: o
2872
2872
  });
2873
- return d = Bt(d, {
2873
+ return d = jt(d, {
2874
2874
  preserveFrontMatter: e.preserveFrontMatter,
2875
2875
  rawFrontMatter: h
2876
2876
  }), {
2877
2877
  markdown: d,
2878
- warnings: r
2878
+ warnings: i
2879
2879
  };
2880
2880
  }
2881
2881
  async function Yt(t, e) {
2882
- const n = e.path, { context: i, body: s } = H(t, n), r = _(e.context, i);
2882
+ const n = e.path, { context: r, body: s } = H(t, n), i = _(e.context, r);
2883
2883
  return ae(s, {
2884
2884
  ...e,
2885
- context: r,
2885
+ context: i,
2886
2886
  preserveFrontMatter: !1
2887
2887
  });
2888
2888
  }
@@ -2891,33 +2891,37 @@ async function Jt(t, e, n) {
2891
2891
  throw u({
2892
2892
  code: "server_context_on_client"
2893
2893
  });
2894
- const i = n?.loader;
2895
- if (!i)
2894
+ if (n != null && "dataSources" in n && n.dataSources != null && Object.keys(n.dataSources).length > 0)
2895
+ throw u({
2896
+ code: "data_sources_on_client"
2897
+ });
2898
+ const r = n?.loader;
2899
+ if (!r)
2896
2900
  throw u({
2897
2901
  code: "parse_error",
2898
2902
  details: { message: "loader is required for renderClient" }
2899
2903
  });
2900
- let s, r;
2901
- typeof t == "string" ? s = t : (r = t.path, s = await i(t.path));
2904
+ let s, i;
2905
+ typeof t == "string" ? s = t : (i = t.path, s = await r(t.path));
2902
2906
  const o = _(e);
2903
2907
  return Kt(s, {
2904
2908
  context: o,
2905
- loader: i,
2909
+ loader: r,
2906
2910
  root: n?.root,
2907
- path: r ?? n?.path,
2911
+ path: i ?? n?.path,
2908
2912
  preserveFrontMatter: n?.preserveFrontMatter,
2909
2913
  preserveHgComments: n?.preserveHgComments,
2910
2914
  constrainToRoot: n?.constrainToRoot
2911
2915
  });
2912
2916
  }
2913
2917
  function Xt(t, e) {
2914
- const n = [`[hyogen:${t}] ${e.code}`], i = {};
2918
+ const n = [`[hyogen:${t}] ${e.code}`], r = {};
2915
2919
  if (e.details)
2916
- for (const [s, r] of Object.entries(e.details))
2917
- r !== void 0 && (i[s] = r);
2918
- i.path === void 0 && e.path !== void 0 && (i.path = e.path);
2919
- for (const [s, r] of Object.entries(i))
2920
- n.push(` ${s}: ${String(r)}`);
2920
+ for (const [s, i] of Object.entries(e.details))
2921
+ i !== void 0 && (r[s] = i);
2922
+ r.path === void 0 && e.path !== void 0 && (r.path = e.path);
2923
+ for (const [s, i] of Object.entries(r))
2924
+ n.push(` ${s}: ${String(i)}`);
2921
2925
  return n.join(`
2922
2926
  `);
2923
2927
  }