mark-deco-cli 0.9.0 → 0.12.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/cli.cjs CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
+ "use strict";
2
3
  /*!
3
4
  * name: mark-deco-cli
4
- * version: 0.9.0
5
+ * version: 0.12.0
5
6
  * description: Command-line interface for mark-deco Markdown to HTML conversion processor
6
7
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
7
8
  * license: MIT
8
9
  * repository.url: https://github.com/kekyo/mark-deco.git
9
- * git.commit.hash: d0e45da82482af0e17292db548313487c588061b
10
+ * git.commit.hash: aff53ffd52269533e39dd1090efe8b582e087d53
10
11
  */
11
- "use strict";
12
12
  const commander = require("commander");
13
13
  const promises = require("fs/promises");
14
14
  const path$1 = require("path");
@@ -4338,7 +4338,7 @@ function requireJs() {
4338
4338
  return js$1.exports;
4339
4339
  }
4340
4340
  var jsExports = requireJs();
4341
- const tt$1 = /* @__PURE__ */ getDefaultExportFromCjs(jsExports);
4341
+ const ot$1 = /* @__PURE__ */ getDefaultExportFromCjs(jsExports);
4342
4342
  const htmlVoidElements = [
4343
4343
  "area",
4344
4344
  "base",
@@ -21417,12 +21417,12 @@ var load = loader.load;
21417
21417
  var dump = dumper.dump;
21418
21418
  /*!
21419
21419
  * name: mark-deco
21420
- * version: 0.9.0
21420
+ * version: 0.12.0
21421
21421
  * description: Flexible Markdown to HTML conversion library
21422
21422
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
21423
21423
  * license: MIT
21424
21424
  * repository.url: https://github.com/kekyo/mark-deco.git
21425
- * git.commit.hash: d0e45da82482af0e17292db548313487c588061b
21425
+ * git.commit.hash: aff53ffd52269533e39dd1090efe8b582e087d53
21426
21426
  */
21427
21427
  const qd = (e) => {
21428
21428
  try {
@@ -21460,12 +21460,12 @@ const qd = (e) => {
21460
21460
  }, Ys = () => "width: 100%; height: auto; display: block; object-fit: contain; object-position: center;", ou = (e, t, u, r) => {
21461
21461
  const a = Ys(), i = "", n = r ? ` ${r}` : "";
21462
21462
  return `<img src="${e}" alt="${t}"${i} style="${a}"${n} />`;
21463
- }, At = (e, t, u, r, a) => {
21463
+ }, At$1 = (e, t, u, r, a) => {
21464
21464
  const i = ou(e, t, r, a);
21465
21465
  return `<div class="${u}">
21466
21466
  ${i}
21467
21467
  </div>`;
21468
- }, vt$1 = (e) => {
21468
+ }, vt = (e) => {
21469
21469
  if (e instanceof TypeError) {
21470
21470
  const t = e.message.toLowerCase();
21471
21471
  return t.includes("cors") || t.includes("network") || t.includes("fetch");
@@ -21592,7 +21592,7 @@ const qd = (e) => {
21592
21592
  }
21593
21593
  }
21594
21594
  } catch (c) {
21595
- vt$1(c) ? u.debug(
21595
+ vt(c) ? u.debug(
21596
21596
  "getOEmbedUrl: Discovery blocked by CORS restrictions for",
21597
21597
  e
21598
21598
  ) : u.warn("getOEmbedUrl: Discovery failed for", e, ":", c);
@@ -21621,7 +21621,7 @@ const qd = (e) => {
21621
21621
  }
21622
21622
  break;
21623
21623
  } catch (h) {
21624
- return vt$1(h) ? a.debug(
21624
+ return vt(h) ? a.debug(
21625
21625
  "resolveRedirects: Browser CORS restrictions prevent redirect resolution for URL:",
21626
21626
  n
21627
21627
  ) : a.warn(
@@ -21663,7 +21663,7 @@ const Gd = async (e, t, u, r, a) => {
21663
21663
  );
21664
21664
  return i.info("fetchOEmbedData: Parsed JSON data:", T), T.web_page || (T.web_page = h), T;
21665
21665
  } catch (h) {
21666
- throw vt$1(h) ? (typeof window < "u" ? i.debug(
21666
+ throw vt(h) ? (typeof window < "u" ? i.debug(
21667
21667
  "fetchOEmbedData: Browser CORS restrictions block oEmbed API access for URL:",
21668
21668
  e
21669
21669
  ) : i.warn(
@@ -21745,7 +21745,7 @@ const Gd = async (e, t, u, r, a) => {
21745
21745
  html: `<div class="oembed-description">${R(e.author_name)}</div>`
21746
21746
  }), r.thumbnail !== void 0 && e.thumbnail_url && T.push({
21747
21747
  order: r.thumbnail,
21748
- html: At(
21748
+ html: At$1(
21749
21749
  R(e.thumbnail_url),
21750
21750
  R(i),
21751
21751
  "oembed-thumbnail"
@@ -21773,7 +21773,7 @@ const Gd = async (e, t, u, r, a) => {
21773
21773
  </div>`
21774
21774
  });
21775
21775
  }
21776
- const A = T.sort((M2, ee) => M2.order - ee.order), w = [], v = [];
21776
+ const A = T.sort((M2, ee2) => M2.order - ee2.order), w = [], v = [];
21777
21777
  A.forEach((M2) => {
21778
21778
  M2.html.includes("oembed-title") || M2.html.includes("oembed-author") || M2.html.includes("oembed-provider") || M2.html.includes("oembed-description") ? w.push(M2.html) : v.push(M2.html);
21779
21779
  });
@@ -21802,7 +21802,7 @@ const Gd = async (e, t, u, r, a) => {
21802
21802
  html: `<div class="oembed-description">${R(e.author_name)}</div>`
21803
21803
  }), r.thumbnail !== void 0 && e.thumbnail_url && m.push({
21804
21804
  order: r.thumbnail,
21805
- html: At(
21805
+ html: At$1(
21806
21806
  R(e.thumbnail_url),
21807
21807
  R(i),
21808
21808
  "oembed-thumbnail"
@@ -21850,7 +21850,7 @@ const Gd = async (e, t, u, r, a) => {
21850
21850
  html: `<div class="oembed-description">${R(n)}</div>`
21851
21851
  }), r.thumbnail !== void 0 && c && h.push({
21852
21852
  order: r.thumbnail,
21853
- html: At(
21853
+ html: At$1(
21854
21854
  R(c),
21855
21855
  R(i),
21856
21856
  "oembed-thumbnail"
@@ -22087,7 +22087,7 @@ class pu extends mu {
22087
22087
  function I(e) {
22088
22088
  return aa(e);
22089
22089
  }
22090
- function wt$1(e) {
22090
+ function wt(e) {
22091
22091
  return e.type === L$1.CDATA;
22092
22092
  }
22093
22093
  function se(e) {
@@ -22114,7 +22114,7 @@ function ze(e, t = false) {
22114
22114
  else if (I(e)) {
22115
22115
  const r = t ? Mt(e.children) : [], a = new pu(e.name, { ...e.attribs }, r);
22116
22116
  r.forEach((i) => i.parent = a), e.namespace != null && (a.namespace = e.namespace), e["x-attribsNamespace"] && (a["x-attribsNamespace"] = { ...e["x-attribsNamespace"] }), e["x-attribsPrefix"] && (a["x-attribsPrefix"] = { ...e["x-attribsPrefix"] }), u = a;
22117
- } else if (wt$1(e)) {
22117
+ } else if (wt(e)) {
22118
22118
  const r = t ? Mt(e.children) : [], a = new wr(r);
22119
22119
  r.forEach((i) => i.parent = a), u = a;
22120
22120
  } else if (Te(e)) {
@@ -22466,13 +22466,13 @@ function ya(e, t) {
22466
22466
  }
22467
22467
  function ot(e) {
22468
22468
  return Array.isArray(e) ? e.map(ot).join("") : I(e) ? e.name === "br" ? `
22469
- ` : ot(e.children) : wt$1(e) ? ot(e.children) : se(e) ? e.data : "";
22469
+ ` : ot(e.children) : wt(e) ? ot(e.children) : se(e) ? e.data : "";
22470
22470
  }
22471
22471
  function Le(e) {
22472
22472
  return Array.isArray(e) ? e.map(Le).join("") : B(e) && !Nt$1(e) ? Le(e.children) : se(e) ? e.data : "";
22473
22473
  }
22474
22474
  function dt(e) {
22475
- return Array.isArray(e) ? e.map(dt).join("") : B(e) && (e.type === L$1.Tag || wt$1(e)) ? dt(e.children) : se(e) ? e.data : "";
22475
+ return Array.isArray(e) ? e.map(dt).join("") : B(e) && (e.type === L$1.Tag || wt(e)) ? dt(e.children) : se(e) ? e.data : "";
22476
22476
  }
22477
22477
  function It$1(e) {
22478
22478
  return B(e) ? e.children : [];
@@ -22813,7 +22813,7 @@ const St$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
22813
22813
  hasAttrib: La,
22814
22814
  hasChildren: B,
22815
22815
  innerText: dt,
22816
- isCDATA: wt$1,
22816
+ isCDATA: wt,
22817
22817
  isComment: Nt$1,
22818
22818
  isDocument: Te,
22819
22819
  isTag: I,
@@ -22831,7 +22831,7 @@ const St$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
22831
22831
  }, Symbol.toStringTag, { value: "Module" })), Ja = {
22832
22832
  _useHtmlParser2: false
22833
22833
  };
22834
- function Kt$1(e, t) {
22834
+ function Kt(e, t) {
22835
22835
  if (!e)
22836
22836
  return t ?? Ja;
22837
22837
  const u = {
@@ -22850,7 +22850,7 @@ function ei(e, t) {
22850
22850
  function ti(e, t) {
22851
22851
  const u = ei(e) ? (t = e, void 0) : e, r = {
22852
22852
  ...this === null || this === void 0 ? void 0 : this._options,
22853
- ...Kt$1(t)
22853
+ ...Kt(t)
22854
22854
  };
22855
22855
  return Dr(this, u, r);
22856
22856
  }
@@ -22936,7 +22936,7 @@ var ve;
22936
22936
  (function(e) {
22937
22937
  e[e.LowerA = 97] = "LowerA", e[e.LowerZ = 122] = "LowerZ", e[e.UpperA = 65] = "UpperA", e[e.UpperZ = 90] = "UpperZ", e[e.Exclamation = 33] = "Exclamation";
22938
22938
  })(ve || (ve = {}));
22939
- function Xt(e) {
22939
+ function Xt$1(e) {
22940
22940
  const t = e.indexOf("<");
22941
22941
  if (t === -1 || t > e.length - 3)
22942
22942
  return false;
@@ -23001,14 +23001,14 @@ var be;
23001
23001
  (function(e) {
23002
23002
  e[e.VALUE_LENGTH = 49152] = "VALUE_LENGTH", e[e.BRANCH_LENGTH = 16256] = "BRANCH_LENGTH", e[e.JUMP_TABLE = 127] = "JUMP_TABLE";
23003
23003
  })(be || (be = {}));
23004
- function Zt(e) {
23004
+ function Zt$1(e) {
23005
23005
  return e >= V$1.ZERO && e <= V$1.NINE;
23006
23006
  }
23007
23007
  function fi(e) {
23008
23008
  return e >= V$1.UPPER_A && e <= V$1.UPPER_F || e >= V$1.LOWER_A && e <= V$1.LOWER_F;
23009
23009
  }
23010
23010
  function bi(e) {
23011
- return e >= V$1.UPPER_A && e <= V$1.UPPER_Z || e >= V$1.LOWER_A && e <= V$1.LOWER_Z || Zt(e);
23011
+ return e >= V$1.UPPER_A && e <= V$1.UPPER_Z || e >= V$1.LOWER_A && e <= V$1.LOWER_Z || Zt$1(e);
23012
23012
  }
23013
23013
  function Ei(e) {
23014
23014
  return e === V$1.EQUALS || bi(e);
@@ -23085,7 +23085,7 @@ let Ti = class {
23085
23085
  const r = u;
23086
23086
  for (; u < t.length; ) {
23087
23087
  const a = t.charCodeAt(u);
23088
- if (Zt(a) || fi(a))
23088
+ if (Zt$1(a) || fi(a))
23089
23089
  u += 1;
23090
23090
  else
23091
23091
  return this.addToNumericResult(t, r, u, 16), this.emitNumericEntity(a, 3);
@@ -23105,7 +23105,7 @@ let Ti = class {
23105
23105
  const r = u;
23106
23106
  for (; u < t.length; ) {
23107
23107
  const a = t.charCodeAt(u);
23108
- if (Zt(a))
23108
+ if (Zt$1(a))
23109
23109
  u += 1;
23110
23110
  else
23111
23111
  return this.addToNumericResult(t, r, u, 10), this.emitNumericEntity(a, 2);
@@ -24214,17 +24214,17 @@ var N;
24214
24214
  (function(e) {
24215
24215
  e.Attribute = "attribute", e.Pseudo = "pseudo", e.PseudoElement = "pseudo-element", e.Tag = "tag", e.Universal = "universal", e.Adjacent = "adjacent", e.Child = "child", e.Descendant = "descendant", e.Parent = "parent", e.Sibling = "sibling", e.ColumnCombinator = "column-combinator";
24216
24216
  })(N || (N = {}));
24217
- var H$1;
24217
+ var H;
24218
24218
  (function(e) {
24219
24219
  e.Any = "any", e.Element = "element", e.End = "end", e.Equals = "equals", e.Exists = "exists", e.Hyphen = "hyphen", e.Not = "not", e.Start = "start";
24220
- })(H$1 || (H$1 = {}));
24220
+ })(H || (H = {}));
24221
24221
  const Wu = /^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/, Bi = /\\([\da-f]{1,6}\s?|(\s)|.)/gi, Ui = /* @__PURE__ */ new Map([
24222
- [126, H$1.Element],
24223
- [94, H$1.Start],
24224
- [36, H$1.End],
24225
- [42, H$1.Any],
24226
- [33, H$1.Not],
24227
- [124, H$1.Hyphen]
24222
+ [126, H.Element],
24223
+ [94, H.Start],
24224
+ [36, H.End],
24225
+ [42, H.Any],
24226
+ [33, H.Not],
24227
+ [124, H.Hyphen]
24228
24228
  ]), Fi = /* @__PURE__ */ new Set([
24229
24229
  "has",
24230
24230
  "not",
@@ -24361,25 +24361,25 @@ function Hr(e, t, u) {
24361
24361
  }
24362
24362
  // Special attribute selectors: .class, #id
24363
24363
  case 46: {
24364
- f("class", H$1.Element);
24364
+ f("class", H.Element);
24365
24365
  break;
24366
24366
  }
24367
24367
  case 35: {
24368
- f("id", H$1.Equals);
24368
+ f("id", H.Equals);
24369
24369
  break;
24370
24370
  }
24371
24371
  case 91: {
24372
24372
  i(1);
24373
24373
  let w, v = null;
24374
24374
  t.charCodeAt(u) === 124 ? w = a(1) : t.startsWith("*|", u) ? (v = "*", w = a(2)) : (w = a(0), t.charCodeAt(u) === 124 && t.charCodeAt(u + 1) !== 61 && (v = w, w = a(1))), i(0);
24375
- let S = H$1.Exists;
24375
+ let S = H.Exists;
24376
24376
  const U2 = Ui.get(t.charCodeAt(u));
24377
24377
  if (U2) {
24378
24378
  if (S = U2, t.charCodeAt(u + 1) !== 61)
24379
24379
  throw new Error("Expected `=`");
24380
24380
  i(2);
24381
- } else t.charCodeAt(u) === 61 && (S = H$1.Equals, i(1));
24382
- let M2 = "", ee = null;
24381
+ } else t.charCodeAt(u) === 61 && (S = H.Equals, i(1));
24382
+ let M2 = "", ee2 = null;
24383
24383
  if (S !== "exists") {
24384
24384
  if (Ht$1(t.charCodeAt(u))) {
24385
24385
  const ge = t.charCodeAt(u);
@@ -24397,7 +24397,7 @@ function Hr(e, t, u) {
24397
24397
  }
24398
24398
  i(0);
24399
24399
  const ae = t.charCodeAt(u) | 32;
24400
- ae === 115 ? (ee = false, i(1)) : ae === 105 && (ee = true, i(1));
24400
+ ae === 115 ? (ee2 = false, i(1)) : ae === 105 && (ee2 = true, i(1));
24401
24401
  }
24402
24402
  if (t.charCodeAt(u) !== 93)
24403
24403
  throw new Error("Attribute selector didn't terminate");
@@ -24408,7 +24408,7 @@ function Hr(e, t, u) {
24408
24408
  action: S,
24409
24409
  value: M2,
24410
24410
  namespace: v,
24411
- ignoreCase: ee
24411
+ ignoreCase: ee2
24412
24412
  };
24413
24413
  r.push(he);
24414
24414
  break;
@@ -24496,12 +24496,12 @@ function Au(e) {
24496
24496
  return !qr.has(e.type);
24497
24497
  }
24498
24498
  const Vi = /* @__PURE__ */ new Map([
24499
- [H$1.Exists, 10],
24500
- [H$1.Equals, 8],
24501
- [H$1.Not, 7],
24502
- [H$1.Start, 6],
24503
- [H$1.End, 6],
24504
- [H$1.Any, 5]
24499
+ [H.Exists, 10],
24500
+ [H.Equals, 8],
24501
+ [H.Not, 7],
24502
+ [H.Start, 6],
24503
+ [H.End, 6],
24504
+ [H.Any, 5]
24505
24505
  ]);
24506
24506
  function $i(e) {
24507
24507
  const t = e.map(Yr);
@@ -24517,7 +24517,7 @@ function $i(e) {
24517
24517
  function Yr(e) {
24518
24518
  var t, u;
24519
24519
  let r = (t = qr.get(e.type)) !== null && t !== void 0 ? t : -1;
24520
- return e.type === N.Attribute ? (r = (u = Vi.get(e.action)) !== null && u !== void 0 ? u : 4, e.action === H$1.Equals && e.name === "id" && (r = 9), e.ignoreCase && (r >>= 1)) : e.type === N.Pseudo && (e.data ? e.name === "has" || e.name === "contains" ? r = 0 : Array.isArray(e.data) ? (r = Math.min(...e.data.map((a) => Math.min(...a.map(Yr)))), r < 0 && (r = 0)) : r = 2 : r = 3), r;
24520
+ return e.type === N.Attribute ? (r = (u = Vi.get(e.action)) !== null && u !== void 0 ? u : 4, e.action === H.Equals && e.name === "id" && (r = 9), e.ignoreCase && (r >>= 1)) : e.type === N.Pseudo && (e.data ? e.name === "has" || e.name === "contains" ? r = 0 : Array.isArray(e.data) ? (r = Math.min(...e.data.map((a) => Math.min(...a.map(Yr)))), r < 0 && (r = 0)) : r = 2 : r = 3), r;
24521
24521
  }
24522
24522
  const Gi = /[-[\]{}()*+?.,\\^$|#\s]/g;
24523
24523
  function Ku(e) {
@@ -24775,11 +24775,11 @@ const eu = {
24775
24775
  const { equals: a } = u;
24776
24776
  return !r || r.length === 0 ? eu.root(e, t, u) : r.length === 1 ? (i) => a(r[0], i) && e(i) : (i) => r.includes(i) && e(i);
24777
24777
  },
24778
- hover: Yt$1("isHovered"),
24779
- visited: Yt$1("isVisited"),
24780
- active: Yt$1("isActive")
24778
+ hover: Yt("isHovered"),
24779
+ visited: Yt("isVisited"),
24780
+ active: Yt("isActive")
24781
24781
  };
24782
- function Yt$1(e) {
24782
+ function Yt(e) {
24783
24783
  return function(u, r, { adapter: a }) {
24784
24784
  const i = a[e];
24785
24785
  return typeof i != "function" ? C.falseFunc : function(c) {
@@ -25262,17 +25262,17 @@ function Jr(e, t, u) {
25262
25262
  var r;
25263
25263
  if (e.some(qe)) {
25264
25264
  const a = (r = u.root) !== null && r !== void 0 ? r : bn(t[0]), i = { ...u, context: t, relativeSelector: false };
25265
- return e.push(Tn), Et$1(a, e, i, true, t.length);
25265
+ return e.push(Tn), Et(a, e, i, true, t.length);
25266
25266
  }
25267
- return Et$1(t, e, u, false, t.length);
25267
+ return Et(t, e, u, false, t.length);
25268
25268
  }
25269
25269
  function gn(e, t, u = {}, r = 1 / 0) {
25270
25270
  if (typeof e == "function")
25271
25271
  return es(t, e);
25272
- const [a, i] = wu(Ct$1(e)), n = i.map((c) => Et$1(t, c, u, true, r));
25272
+ const [a, i] = wu(Ct$1(e)), n = i.map((c) => Et(t, c, u, true, r));
25273
25273
  return a.length && n.push(uu(t, a, u, r)), n.length === 0 ? [] : n.length === 1 ? n[0] : ke(n.reduce((c, h) => [...c, ...h]));
25274
25274
  }
25275
- function Et$1(e, t, u, r, a) {
25275
+ function Et(e, t, u, r, a) {
25276
25276
  const i = t.findIndex(bt$1), n = t.slice(0, i), c = t[i], h = t.length - 1 === i ? a : 1 / 0, m = fn(c.name, c.data, h);
25277
25277
  if (m === 0)
25278
25278
  return [];
@@ -25297,7 +25297,7 @@ function Et$1(e, t, u, r, a) {
25297
25297
  rootFunc: (S) => A.includes(S)
25298
25298
  };
25299
25299
  } else u.rootFunc && u.rootFunc !== ft.trueFunc && (u = { ...u, rootFunc: ft.trueFunc });
25300
- return w.some(bt$1) ? Et$1(A, w, u, false, a) : v ? (
25300
+ return w.some(bt$1) ? Et(A, w, u, false, a) : v ? (
25301
25301
  // Query existing elements to resolve traversal.
25302
25302
  uu(A, [w], u, a)
25303
25303
  ) : (
@@ -25381,7 +25381,7 @@ function Iu(e, ...t) {
25381
25381
  }), n;
25382
25382
  })(e, ...t);
25383
25383
  return function(a, i) {
25384
- u = typeof a == "string" ? (c) => Qr(c, a, this.options) : a ? tt(a) : null;
25384
+ u = typeof a == "string" ? (c) => Qr(c, a, this.options) : a ? tt$1(a) : null;
25385
25385
  const n = r.call(this, i);
25386
25386
  return u = null, n;
25387
25387
  };
@@ -25403,7 +25403,7 @@ function Sn(e) {
25403
25403
  const r = {
25404
25404
  xmlMode: this.options.xmlMode,
25405
25405
  root: (t = this._root) === null || t === void 0 ? void 0 : t[0]
25406
- }, a = typeof e == "string" ? (i) => Qr(i, e, r) : tt(e);
25406
+ }, a = typeof e == "string" ? (i) => Qr(i, e, r) : tt$1(e);
25407
25407
  return P(this, (i) => {
25408
25408
  for (i && !Te(i) && !I(i) && (i = i.parent); i && I(i); ) {
25409
25409
  if (a(i, 0)) {
@@ -25444,7 +25444,7 @@ function Un(e) {
25444
25444
  }
25445
25445
  return this._make(t);
25446
25446
  }
25447
- function tt(e) {
25447
+ function tt$1(e) {
25448
25448
  return typeof e == "function" ? (t, u) => e.call(t, u, t) : de(e) ? (t) => Array.prototype.includes.call(e, t) : function(t) {
25449
25449
  return e === t;
25450
25450
  };
@@ -25454,11 +25454,11 @@ function Fn(e) {
25454
25454
  return this._make(Su(this.toArray(), e, this.options.xmlMode, (t = this._root) === null || t === void 0 ? void 0 : t[0]));
25455
25455
  }
25456
25456
  function Su(e, t, u, r) {
25457
- return typeof t == "string" ? Xr(t, e, { xmlMode: u, root: r }) : e.filter(tt(t));
25457
+ return typeof t == "string" ? Xr(t, e, { xmlMode: u, root: r }) : e.filter(tt$1(t));
25458
25458
  }
25459
25459
  function Hn(e) {
25460
25460
  const t = this.toArray();
25461
- return typeof e == "string" ? Kr(t.filter(I), e, this.options) : e ? t.some(tt(e)) : false;
25461
+ return typeof e == "string" ? Kr(t.filter(I), e, this.options) : e ? t.some(tt$1(e)) : false;
25462
25462
  }
25463
25463
  function qn(e) {
25464
25464
  let t = this.toArray();
@@ -25466,7 +25466,7 @@ function qn(e) {
25466
25466
  const u = new Set(Xr(e, t, this.options));
25467
25467
  t = t.filter((r) => !u.has(r));
25468
25468
  } else {
25469
- const u = tt(e);
25469
+ const u = tt$1(e);
25470
25470
  t = t.filter((r, a) => !u(r, a));
25471
25471
  }
25472
25472
  return this._make(t);
@@ -25634,7 +25634,7 @@ function us(e) {
25634
25634
  return function(t) {
25635
25635
  const u = this.length - 1, r = this.parents().last();
25636
25636
  for (let a = 0; a < this.length; a++) {
25637
- const i = this[a], n = typeof t == "function" ? t.call(i, a, i) : typeof t == "string" && !Xt(t) ? r.find(t).clone() : t, [c] = this._makeDomArray(n, a < u);
25637
+ const i = this[a], n = typeof t == "function" ? t.call(i, a, i) : typeof t == "string" && !Xt$1(t) ? r.find(t).clone() : t, [c] = this._makeDomArray(n, a < u);
25638
25638
  if (!c || !B(c))
25639
25639
  continue;
25640
25640
  let h = c, m = 0;
@@ -25943,7 +25943,7 @@ function ko(e, t) {
25943
25943
  return function u(r, a, i = true) {
25944
25944
  if (r == null)
25945
25945
  throw new Error("cheerio.load() expects a string");
25946
- const n = Kt$1(a), c = e(r, n, i, null);
25946
+ const n = Kt(a), c = e(r, n, i, null);
25947
25947
  class h extends ut {
25948
25948
  _make(T, A) {
25949
25949
  const w = m(T, A);
@@ -25959,10 +25959,10 @@ function ko(e, t) {
25959
25959
  function m(f, T, A = c, w) {
25960
25960
  if (f && de(f))
25961
25961
  return f;
25962
- const v = Kt$1(w, n), S = typeof A == "string" ? [e(A, v, false, null)] : "length" in A ? A : [A], U2 = de(S) ? S : new h(S, null, v);
25962
+ const v = Kt(w, n), S = typeof A == "string" ? [e(A, v, false, null)] : "length" in A ? A : [A], U2 = de(S) ? S : new h(S, null, v);
25963
25963
  if (U2._root = U2, !f)
25964
25964
  return new h(void 0, U2, v);
25965
- const M2 = typeof f == "string" && Xt(f) ? (
25965
+ const M2 = typeof f == "string" && Xt$1(f) ? (
25966
25966
  // $(<html>)
25967
25967
  e(f, v, false, null).children
25968
25968
  ) : Po(f) ? (
@@ -25971,15 +25971,15 @@ function ko(e, t) {
25971
25971
  ) : Array.isArray(f) ? (
25972
25972
  // $([dom])
25973
25973
  f
25974
- ) : void 0, ee = new h(M2, U2, v);
25974
+ ) : void 0, ee2 = new h(M2, U2, v);
25975
25975
  if (M2)
25976
- return ee;
25976
+ return ee2;
25977
25977
  if (typeof f != "string")
25978
25978
  throw new TypeError("Unexpected type of selector");
25979
25979
  let he = f;
25980
25980
  const ae = T ? (
25981
25981
  // If we don't have a context, maybe we have a root, from loading
25982
- typeof T == "string" ? Xt(T) ? (
25982
+ typeof T == "string" ? Xt$1(T) ? (
25983
25983
  // $('li', '<ul>...</ul>')
25984
25984
  new h([e(T, v, false, null)], U2, v)
25985
25985
  ) : (
@@ -25993,7 +25993,7 @@ function ko(e, t) {
25993
25993
  new h(Array.isArray(T) ? T : [T], U2, v)
25994
25994
  )
25995
25995
  ) : U2;
25996
- return ae ? ae.find(he) : ee;
25996
+ return ae ? ae.find(he) : ee2;
25997
25997
  }
25998
25998
  return Object.assign(m, ni, {
25999
25999
  load: u,
@@ -26166,10 +26166,10 @@ class Ho {
26166
26166
  this.isEol = false;
26167
26167
  }
26168
26168
  }
26169
- var O;
26169
+ var O$1;
26170
26170
  (function(e) {
26171
26171
  e[e.CHARACTER = 0] = "CHARACTER", e[e.NULL_CHARACTER = 1] = "NULL_CHARACTER", e[e.WHITESPACE_CHARACTER = 2] = "WHITESPACE_CHARACTER", e[e.START_TAG = 3] = "START_TAG", e[e.END_TAG = 4] = "END_TAG", e[e.COMMENT = 5] = "COMMENT", e[e.DOCTYPE = 6] = "DOCTYPE", e[e.EOF = 7] = "EOF", e[e.HIBERNATION = 8] = "HIBERNATION";
26172
- })(O || (O = {}));
26172
+ })(O$1 || (O$1 = {}));
26173
26173
  function os(e, t) {
26174
26174
  for (let u = e.attrs.length - 1; u >= 0; u--)
26175
26175
  if (e.attrs[u].name === t)
@@ -26235,21 +26235,21 @@ function Go(e) {
26235
26235
  function Wo(e) {
26236
26236
  return e === $.EQUALS || Go(e);
26237
26237
  }
26238
- var Y;
26238
+ var Y$1;
26239
26239
  (function(e) {
26240
26240
  e[e.EntityStart = 0] = "EntityStart", e[e.NumericStart = 1] = "NumericStart", e[e.NumericDecimal = 2] = "NumericDecimal", e[e.NumericHex = 3] = "NumericHex", e[e.NamedEntity = 4] = "NamedEntity";
26241
- })(Y || (Y = {}));
26241
+ })(Y$1 || (Y$1 = {}));
26242
26242
  var ce;
26243
26243
  (function(e) {
26244
26244
  e[e.Legacy = 0] = "Legacy", e[e.Strict = 1] = "Strict", e[e.Attribute = 2] = "Attribute";
26245
26245
  })(ce || (ce = {}));
26246
26246
  class zo {
26247
26247
  constructor(t, u, r) {
26248
- this.decodeTree = t, this.emitCodePoint = u, this.errors = r, this.state = Y.EntityStart, this.consumed = 1, this.result = 0, this.treeIndex = 0, this.excess = 1, this.decodeMode = ce.Strict;
26248
+ this.decodeTree = t, this.emitCodePoint = u, this.errors = r, this.state = Y$1.EntityStart, this.consumed = 1, this.result = 0, this.treeIndex = 0, this.excess = 1, this.decodeMode = ce.Strict;
26249
26249
  }
26250
26250
  /** Resets the instance to make it reusable. */
26251
26251
  startEntity(t) {
26252
- this.decodeMode = t, this.state = Y.EntityStart, this.result = 0, this.treeIndex = 0, this.excess = 1, this.consumed = 1;
26252
+ this.decodeMode = t, this.state = Y$1.EntityStart, this.result = 0, this.treeIndex = 0, this.excess = 1, this.consumed = 1;
26253
26253
  }
26254
26254
  /**
26255
26255
  * Write an entity to the decoder. This can be called multiple times with partial entities.
@@ -26264,15 +26264,15 @@ class zo {
26264
26264
  */
26265
26265
  write(t, u) {
26266
26266
  switch (this.state) {
26267
- case Y.EntityStart:
26268
- return t.charCodeAt(u) === $.NUM ? (this.state = Y.NumericStart, this.consumed += 1, this.stateNumericStart(t, u + 1)) : (this.state = Y.NamedEntity, this.stateNamedEntity(t, u));
26269
- case Y.NumericStart:
26267
+ case Y$1.EntityStart:
26268
+ return t.charCodeAt(u) === $.NUM ? (this.state = Y$1.NumericStart, this.consumed += 1, this.stateNumericStart(t, u + 1)) : (this.state = Y$1.NamedEntity, this.stateNamedEntity(t, u));
26269
+ case Y$1.NumericStart:
26270
26270
  return this.stateNumericStart(t, u);
26271
- case Y.NumericDecimal:
26271
+ case Y$1.NumericDecimal:
26272
26272
  return this.stateNumericDecimal(t, u);
26273
- case Y.NumericHex:
26273
+ case Y$1.NumericHex:
26274
26274
  return this.stateNumericHex(t, u);
26275
- case Y.NamedEntity:
26275
+ case Y$1.NamedEntity:
26276
26276
  return this.stateNamedEntity(t, u);
26277
26277
  }
26278
26278
  }
@@ -26286,7 +26286,7 @@ class zo {
26286
26286
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
26287
26287
  */
26288
26288
  stateNumericStart(t, u) {
26289
- return u >= t.length ? -1 : (t.charCodeAt(u) | Vo) === $.LOWER_X ? (this.state = Y.NumericHex, this.consumed += 1, this.stateNumericHex(t, u + 1)) : (this.state = Y.NumericDecimal, this.stateNumericDecimal(t, u));
26289
+ return u >= t.length ? -1 : (t.charCodeAt(u) | Vo) === $.LOWER_X ? (this.state = Y$1.NumericHex, this.consumed += 1, this.stateNumericHex(t, u + 1)) : (this.state = Y$1.NumericDecimal, this.stateNumericDecimal(t, u));
26290
26290
  }
26291
26291
  addToNumericResult(t, u, r, a) {
26292
26292
  if (u !== r) {
@@ -26417,16 +26417,16 @@ class zo {
26417
26417
  end() {
26418
26418
  var t;
26419
26419
  switch (this.state) {
26420
- case Y.NamedEntity:
26420
+ case Y$1.NamedEntity:
26421
26421
  return this.result !== 0 && (this.decodeMode !== ce.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
26422
26422
  // Otherwise, emit a numeric entity if we have one.
26423
- case Y.NumericDecimal:
26423
+ case Y$1.NumericDecimal:
26424
26424
  return this.emitNumericEntity(0, 2);
26425
- case Y.NumericHex:
26425
+ case Y$1.NumericHex:
26426
26426
  return this.emitNumericEntity(0, 3);
26427
- case Y.NumericStart:
26427
+ case Y$1.NumericStart:
26428
26428
  return (t = this.errors) === null || t === void 0 || t.absenceOfDigitsInNumericCharacterReference(this.consumed), 0;
26429
- case Y.EntityStart:
26429
+ case Y$1.EntityStart:
26430
26430
  return 0;
26431
26431
  }
26432
26432
  }
@@ -26459,10 +26459,10 @@ var we;
26459
26459
  (function(e) {
26460
26460
  e.TYPE = "type", e.ACTION = "action", e.ENCODING = "encoding", e.PROMPT = "prompt", e.NAME = "name", e.COLOR = "color", e.FACE = "face", e.SIZE = "size";
26461
26461
  })(we || (we = {}));
26462
- var X;
26462
+ var X$1;
26463
26463
  (function(e) {
26464
26464
  e.NO_QUIRKS = "no-quirks", e.QUIRKS = "quirks", e.LIMITED_QUIRKS = "limited-quirks";
26465
- })(X || (X = {}));
26465
+ })(X$1 || (X$1 = {}));
26466
26466
  var p;
26467
26467
  (function(e) {
26468
26468
  e.A = "a", e.ADDRESS = "address", e.ANNOTATION_XML = "annotation-xml", e.APPLET = "applet", e.AREA = "area", e.ARTICLE = "article", e.ASIDE = "aside", e.B = "b", e.BASE = "base", e.BASEFONT = "basefont", e.BGSOUND = "bgsound", e.BIG = "big", e.BLOCKQUOTE = "blockquote", e.BODY = "body", e.BR = "br", e.BUTTON = "button", e.CAPTION = "caption", e.CENTER = "center", e.CODE = "code", e.COL = "col", e.COLGROUP = "colgroup", e.DD = "dd", e.DESC = "desc", e.DETAILS = "details", e.DIALOG = "dialog", e.DIR = "dir", e.DIV = "div", e.DL = "dl", e.DT = "dt", e.EM = "em", e.EMBED = "embed", e.FIELDSET = "fieldset", e.FIGCAPTION = "figcaption", e.FIGURE = "figure", e.FONT = "font", e.FOOTER = "footer", e.FOREIGN_OBJECT = "foreignObject", e.FORM = "form", e.FRAME = "frame", e.FRAMESET = "frameset", e.H1 = "h1", e.H2 = "h2", e.H3 = "h3", e.H4 = "h4", e.H5 = "h5", e.H6 = "h6", e.HEAD = "head", e.HEADER = "header", e.HGROUP = "hgroup", e.HR = "hr", e.HTML = "html", e.I = "i", e.IMG = "img", e.IMAGE = "image", e.INPUT = "input", e.IFRAME = "iframe", e.KEYGEN = "keygen", e.LABEL = "label", e.LI = "li", e.LINK = "link", e.LISTING = "listing", e.MAIN = "main", e.MALIGNMARK = "malignmark", e.MARQUEE = "marquee", e.MATH = "math", e.MENU = "menu", e.META = "meta", e.MGLYPH = "mglyph", e.MI = "mi", e.MO = "mo", e.MN = "mn", e.MS = "ms", e.MTEXT = "mtext", e.NAV = "nav", e.NOBR = "nobr", e.NOFRAMES = "noframes", e.NOEMBED = "noembed", e.NOSCRIPT = "noscript", e.OBJECT = "object", e.OL = "ol", e.OPTGROUP = "optgroup", e.OPTION = "option", e.P = "p", e.PARAM = "param", e.PLAINTEXT = "plaintext", e.PRE = "pre", e.RB = "rb", e.RP = "rp", e.RT = "rt", e.RTC = "rtc", e.RUBY = "ruby", e.S = "s", e.SCRIPT = "script", e.SEARCH = "search", e.SECTION = "section", e.SELECT = "select", e.SOURCE = "source", e.SMALL = "small", e.SPAN = "span", e.STRIKE = "strike", e.STRONG = "strong", e.STYLE = "style", e.SUB = "sub", e.SUMMARY = "summary", e.SUP = "sup", e.TABLE = "table", e.TBODY = "tbody", e.TEMPLATE = "template", e.TEXTAREA = "textarea", e.TFOOT = "tfoot", e.TD = "td", e.TH = "th", e.THEAD = "thead", e.TITLE = "title", e.TR = "tr", e.TRACK = "track", e.TT = "tt", e.U = "u", e.UL = "ul", e.SVG = "svg", e.VAR = "var", e.WBR = "wbr", e.XMP = "xmp";
@@ -26817,7 +26817,7 @@ class rc {
26817
26817
  //Token creation
26818
26818
  _createStartTagToken() {
26819
26819
  this.currentToken = {
26820
- type: O.START_TAG,
26820
+ type: O$1.START_TAG,
26821
26821
  tagName: "",
26822
26822
  tagID: s.UNKNOWN,
26823
26823
  selfClosing: false,
@@ -26828,7 +26828,7 @@ class rc {
26828
26828
  }
26829
26829
  _createEndTagToken() {
26830
26830
  this.currentToken = {
26831
- type: O.END_TAG,
26831
+ type: O$1.END_TAG,
26832
26832
  tagName: "",
26833
26833
  tagID: s.UNKNOWN,
26834
26834
  selfClosing: false,
@@ -26839,14 +26839,14 @@ class rc {
26839
26839
  }
26840
26840
  _createCommentToken(t) {
26841
26841
  this.currentToken = {
26842
- type: O.COMMENT,
26842
+ type: O$1.COMMENT,
26843
26843
  data: "",
26844
26844
  location: this.getCurrentLocation(t)
26845
26845
  };
26846
26846
  }
26847
26847
  _createDoctypeToken(t) {
26848
26848
  this.currentToken = {
26849
- type: O.DOCTYPE,
26849
+ type: O$1.DOCTYPE,
26850
26850
  name: t,
26851
26851
  forceQuirks: false,
26852
26852
  publicId: null,
@@ -26888,7 +26888,7 @@ class rc {
26888
26888
  }
26889
26889
  emitCurrentTagToken() {
26890
26890
  const t = this.currentToken;
26891
- this.prepareToken(t), t.tagID = yt(t.tagName), t.type === O.START_TAG ? (this.lastStartTagName = t.tagName, this.handler.onStartTag(t)) : (t.attrs.length > 0 && this._err(b.endTagWithAttributes), t.selfClosing && this._err(b.endTagWithTrailingSolidus), this.handler.onEndTag(t)), this.preprocessor.dropParsedChunk();
26891
+ this.prepareToken(t), t.tagID = yt(t.tagName), t.type === O$1.START_TAG ? (this.lastStartTagName = t.tagName, this.handler.onStartTag(t)) : (t.attrs.length > 0 && this._err(b.endTagWithAttributes), t.selfClosing && this._err(b.endTagWithTrailingSolidus), this.handler.onEndTag(t)), this.preprocessor.dropParsedChunk();
26892
26892
  }
26893
26893
  emitCurrentComment(t) {
26894
26894
  this.prepareToken(t), this.handler.onComment(t), this.preprocessor.dropParsedChunk();
@@ -26899,15 +26899,15 @@ class rc {
26899
26899
  _emitCurrentCharacterToken(t) {
26900
26900
  if (this.currentCharacterToken) {
26901
26901
  switch (t && this.currentCharacterToken.location && (this.currentCharacterToken.location.endLine = t.startLine, this.currentCharacterToken.location.endCol = t.startCol, this.currentCharacterToken.location.endOffset = t.startOffset), this.currentCharacterToken.type) {
26902
- case O.CHARACTER: {
26902
+ case O$1.CHARACTER: {
26903
26903
  this.handler.onCharacter(this.currentCharacterToken);
26904
26904
  break;
26905
26905
  }
26906
- case O.NULL_CHARACTER: {
26906
+ case O$1.NULL_CHARACTER: {
26907
26907
  this.handler.onNullCharacter(this.currentCharacterToken);
26908
26908
  break;
26909
26909
  }
26910
- case O.WHITESPACE_CHARACTER: {
26910
+ case O$1.WHITESPACE_CHARACTER: {
26911
26911
  this.handler.onWhitespaceCharacter(this.currentCharacterToken);
26912
26912
  break;
26913
26913
  }
@@ -26917,7 +26917,7 @@ class rc {
26917
26917
  }
26918
26918
  _emitEOFToken() {
26919
26919
  const t = this.getCurrentLocation(0);
26920
- t && (t.endLine = t.startLine, t.endCol = t.startCol, t.endOffset = t.startOffset), this._emitCurrentCharacterToken(t), this.handler.onEof({ type: O.EOF, location: t }), this.active = false;
26920
+ t && (t.endLine = t.startLine, t.endCol = t.startCol, t.endOffset = t.startOffset), this._emitCurrentCharacterToken(t), this.handler.onEof({ type: O$1.EOF, location: t }), this.active = false;
26921
26921
  }
26922
26922
  //Characters emission
26923
26923
  //OPTIMIZATION: The specification uses only one type of character token (one token per character).
@@ -26938,13 +26938,13 @@ class rc {
26938
26938
  this._createCharacterToken(t, u);
26939
26939
  }
26940
26940
  _emitCodePoint(t) {
26941
- const u = cs(t) ? O.WHITESPACE_CHARACTER : t === o.NULL ? O.NULL_CHARACTER : O.CHARACTER;
26941
+ const u = cs(t) ? O$1.WHITESPACE_CHARACTER : t === o.NULL ? O$1.NULL_CHARACTER : O$1.CHARACTER;
26942
26942
  this._appendCharToCurrentCharacterToken(u, String.fromCodePoint(t));
26943
26943
  }
26944
26944
  //NOTE: used when we emit characters explicitly.
26945
26945
  //This is always for non-whitespace and non-null characters, which allows us to avoid additional checks.
26946
26946
  _emitChars(t) {
26947
- this._appendCharToCurrentCharacterToken(O.CHARACTER, t);
26947
+ this._appendCharToCurrentCharacterToken(O$1.CHARACTER, t);
26948
26948
  }
26949
26949
  // Character reference helpers
26950
26950
  _startCharacterReference() {
@@ -28952,7 +28952,7 @@ const oe = {
28952
28952
  createDocument() {
28953
28953
  return {
28954
28954
  nodeName: "#document",
28955
- mode: X.NO_QUIRKS,
28955
+ mode: X$1.NO_QUIRKS,
28956
28956
  childNodes: []
28957
28957
  };
28958
28958
  },
@@ -29181,21 +29181,21 @@ function Ec(e) {
29181
29181
  }
29182
29182
  function Tc(e) {
29183
29183
  if (e.name !== hs)
29184
- return X.QUIRKS;
29184
+ return X$1.QUIRKS;
29185
29185
  const { systemId: t } = e;
29186
29186
  if (t && t.toLowerCase() === mc)
29187
- return X.QUIRKS;
29187
+ return X$1.QUIRKS;
29188
29188
  let { publicId: u } = e;
29189
29189
  if (u !== null) {
29190
29190
  if (u = u.toLowerCase(), fc.has(u))
29191
- return X.QUIRKS;
29191
+ return X$1.QUIRKS;
29192
29192
  let r = t === null ? pc : ls;
29193
29193
  if (or(u, r))
29194
- return X.QUIRKS;
29194
+ return X$1.QUIRKS;
29195
29195
  if (r = t === null ? ms : bc, or(u, r))
29196
- return X.LIMITED_QUIRKS;
29196
+ return X$1.LIMITED_QUIRKS;
29197
29197
  }
29198
- return X.NO_QUIRKS;
29198
+ return X$1.NO_QUIRKS;
29199
29199
  }
29200
29200
  const cr = {
29201
29201
  TEXT_HTML: "text/html",
@@ -29606,7 +29606,7 @@ class Es {
29606
29606
  const r = u.location, a = this.treeAdapter.getTagName(t), i = (
29607
29607
  // NOTE: For cases like <p> <p> </p> - First 'p' closes without a closing
29608
29608
  // tag and for cases like <td> <p> </td> - 'p' closes without a closing tag.
29609
- u.type === O.END_TAG && a === u.tagName ? {
29609
+ u.type === O$1.END_TAG && a === u.tagName ? {
29610
29610
  endTag: { ...r },
29611
29611
  endLine: r.endLine,
29612
29612
  endCol: r.endCol,
@@ -29635,35 +29635,35 @@ class Es {
29635
29635
  /** @protected */
29636
29636
  _processToken(t) {
29637
29637
  switch (t.type) {
29638
- case O.CHARACTER: {
29638
+ case O$1.CHARACTER: {
29639
29639
  this.onCharacter(t);
29640
29640
  break;
29641
29641
  }
29642
- case O.NULL_CHARACTER: {
29642
+ case O$1.NULL_CHARACTER: {
29643
29643
  this.onNullCharacter(t);
29644
29644
  break;
29645
29645
  }
29646
- case O.COMMENT: {
29646
+ case O$1.COMMENT: {
29647
29647
  this.onComment(t);
29648
29648
  break;
29649
29649
  }
29650
- case O.DOCTYPE: {
29650
+ case O$1.DOCTYPE: {
29651
29651
  this.onDoctype(t);
29652
29652
  break;
29653
29653
  }
29654
- case O.START_TAG: {
29654
+ case O$1.START_TAG: {
29655
29655
  this._processStartTag(t);
29656
29656
  break;
29657
29657
  }
29658
- case O.END_TAG: {
29658
+ case O$1.END_TAG: {
29659
29659
  this.onEndTag(t);
29660
29660
  break;
29661
29661
  }
29662
- case O.EOF: {
29662
+ case O$1.EOF: {
29663
29663
  this.onEof(t);
29664
29664
  break;
29665
29665
  }
29666
- case O.WHITESPACE_CHARACTER: {
29666
+ case O$1.WHITESPACE_CHARACTER: {
29667
29667
  this.onWhitespaceCharacter(t);
29668
29668
  break;
29669
29669
  }
@@ -29860,7 +29860,7 @@ class Es {
29860
29860
  case l.IN_TABLE:
29861
29861
  case l.IN_TABLE_BODY:
29862
29862
  case l.IN_ROW: {
29863
- Wt$1(this, t);
29863
+ Wt(this, t);
29864
29864
  break;
29865
29865
  }
29866
29866
  case l.IN_TABLE_TEXT: {
@@ -29868,7 +29868,7 @@ class Es {
29868
29868
  break;
29869
29869
  }
29870
29870
  case l.IN_COLUMN_GROUP: {
29871
- _t(this, t);
29871
+ _t$1(this, t);
29872
29872
  break;
29873
29873
  }
29874
29874
  case l.AFTER_BODY: {
@@ -29919,11 +29919,11 @@ class Es {
29919
29919
  case l.IN_TABLE:
29920
29920
  case l.IN_TABLE_BODY:
29921
29921
  case l.IN_ROW: {
29922
- Wt$1(this, t);
29922
+ Wt(this, t);
29923
29923
  break;
29924
29924
  }
29925
29925
  case l.IN_COLUMN_GROUP: {
29926
- _t(this, t);
29926
+ _t$1(this, t);
29927
29927
  break;
29928
29928
  }
29929
29929
  case l.AFTER_BODY: {
@@ -30045,7 +30045,7 @@ class Es {
30045
30045
  break;
30046
30046
  }
30047
30047
  case l.IN_BODY: {
30048
- G$1(this, t);
30048
+ G(this, t);
30049
30049
  break;
30050
30050
  }
30051
30051
  case l.IN_TABLE: {
@@ -30065,7 +30065,7 @@ class Es {
30065
30065
  break;
30066
30066
  }
30067
30067
  case l.IN_TABLE_BODY: {
30068
- Rt(this, t);
30068
+ Rt$1(this, t);
30069
30069
  break;
30070
30070
  }
30071
30071
  case l.IN_ROW: {
@@ -30305,7 +30305,7 @@ class Es {
30305
30305
  case l.IN_TABLE:
30306
30306
  case l.IN_TABLE_BODY:
30307
30307
  case l.IN_ROW: {
30308
- Wt$1(this, t);
30308
+ Wt(this, t);
30309
30309
  break;
30310
30310
  }
30311
30311
  case l.IN_TABLE_TEXT: {
@@ -30393,11 +30393,11 @@ function Ou(e, t) {
30393
30393
  }
30394
30394
  function Yc(e, t) {
30395
30395
  e._setDocumentType(t);
30396
- const u = t.forceQuirks ? X.QUIRKS : Tc(t);
30396
+ const u = t.forceQuirks ? X$1.QUIRKS : Tc(t);
30397
30397
  Ec(t) || e._err(t, b.nonConformingDoctype), e.treeAdapter.setDocumentMode(e.document, u), e.insertionMode = l.BEFORE_HTML;
30398
30398
  }
30399
30399
  function Ue(e, t) {
30400
- e._err(t, b.missingDoctype, true), e.treeAdapter.setDocumentMode(e.document, X.QUIRKS), e.insertionMode = l.BEFORE_HTML, e._processToken(t);
30400
+ e._err(t, b.missingDoctype, true), e.treeAdapter.setDocumentMode(e.document, X$1.QUIRKS), e.insertionMode = l.BEFORE_HTML, e._processToken(t);
30401
30401
  }
30402
30402
  function jc(e, t) {
30403
30403
  t.tagID === s.HTML ? (e._insertElement(t, E.HTML), e.insertionMode = l.BEFORE_HEAD) : Ye(e, t);
@@ -30412,7 +30412,7 @@ function Ye(e, t) {
30412
30412
  function $c(e, t) {
30413
30413
  switch (t.tagID) {
30414
30414
  case s.HTML: {
30415
- G$1(e, t);
30415
+ G(e, t);
30416
30416
  break;
30417
30417
  }
30418
30418
  case s.HEAD: {
@@ -30433,7 +30433,7 @@ function je(e, t) {
30433
30433
  function J(e, t) {
30434
30434
  switch (t.tagID) {
30435
30435
  case s.HTML: {
30436
- G$1(e, t);
30436
+ G(e, t);
30437
30437
  break;
30438
30438
  }
30439
30439
  case s.BASE:
@@ -30502,7 +30502,7 @@ function Ve(e, t) {
30502
30502
  function zc(e, t) {
30503
30503
  switch (t.tagID) {
30504
30504
  case s.HTML: {
30505
- G$1(e, t);
30505
+ G(e, t);
30506
30506
  break;
30507
30507
  }
30508
30508
  case s.BASEFONT:
@@ -30538,13 +30538,13 @@ function Qc(e, t) {
30538
30538
  }
30539
30539
  }
30540
30540
  function $e(e, t) {
30541
- const u = t.type === O.EOF ? b.openElementsLeftAfterEof : b.disallowedContentInNoscriptInHead;
30541
+ const u = t.type === O$1.EOF ? b.openElementsLeftAfterEof : b.disallowedContentInNoscriptInHead;
30542
30542
  e._err(t, u), e.openElements.pop(), e.insertionMode = l.IN_HEAD, e._processToken(t);
30543
30543
  }
30544
30544
  function Kc(e, t) {
30545
30545
  switch (t.tagID) {
30546
30546
  case s.HTML: {
30547
- G$1(e, t);
30547
+ G(e, t);
30548
30548
  break;
30549
30549
  }
30550
30550
  case s.BODY: {
@@ -30597,27 +30597,27 @@ function Ge(e, t) {
30597
30597
  }
30598
30598
  function Ot$1(e, t) {
30599
30599
  switch (t.type) {
30600
- case O.CHARACTER: {
30600
+ case O$1.CHARACTER: {
30601
30601
  _s(e, t);
30602
30602
  break;
30603
30603
  }
30604
- case O.WHITESPACE_CHARACTER: {
30604
+ case O$1.WHITESPACE_CHARACTER: {
30605
30605
  Ts(e, t);
30606
30606
  break;
30607
30607
  }
30608
- case O.COMMENT: {
30608
+ case O$1.COMMENT: {
30609
30609
  iu(e, t);
30610
30610
  break;
30611
30611
  }
30612
- case O.START_TAG: {
30613
- G$1(e, t);
30612
+ case O$1.START_TAG: {
30613
+ G(e, t);
30614
30614
  break;
30615
30615
  }
30616
- case O.END_TAG: {
30616
+ case O$1.END_TAG: {
30617
30617
  Lt$1(e, t);
30618
30618
  break;
30619
30619
  }
30620
- case O.EOF: {
30620
+ case O$1.EOF: {
30621
30621
  ws(e, t);
30622
30622
  break;
30623
30623
  }
@@ -30687,7 +30687,7 @@ function h0(e, t) {
30687
30687
  e._reconstructActiveFormattingElements(), e._insertElement(t, E.HTML), e.activeFormattingElements.insertMarker(), e.framesetOk = false;
30688
30688
  }
30689
30689
  function l0(e, t) {
30690
- e.treeAdapter.getDocumentMode(e.document) !== X.QUIRKS && e.openElements.hasInButtonScope(s.P) && e._closePElement(), e._insertElement(t, E.HTML), e.framesetOk = false, e.insertionMode = l.IN_TABLE;
30690
+ e.treeAdapter.getDocumentMode(e.document) !== X$1.QUIRKS && e.openElements.hasInButtonScope(s.P) && e._closePElement(), e._insertElement(t, E.HTML), e.framesetOk = false, e.insertionMode = l.IN_TABLE;
30691
30691
  }
30692
30692
  function gs(e, t) {
30693
30693
  e._reconstructActiveFormattingElements(), e._appendElement(t, E.HTML), e.framesetOk = false, t.ackSelfClosing = true;
@@ -30741,7 +30741,7 @@ function x0(e, t) {
30741
30741
  function lr(e, t) {
30742
30742
  e._reconstructActiveFormattingElements(), e._insertElement(t, E.HTML);
30743
30743
  }
30744
- function G$1(e, t) {
30744
+ function G(e, t) {
30745
30745
  switch (t.tagID) {
30746
30746
  case s.I:
30747
30747
  case s.S:
@@ -31111,14 +31111,14 @@ function M0(e, t) {
31111
31111
  function B0(e, t) {
31112
31112
  e._err(t, b.eofInElementThatCanContainOnlyText), e.openElements.pop(), e.insertionMode = e.originalInsertionMode, e.onEof(t);
31113
31113
  }
31114
- function Wt$1(e, t) {
31114
+ function Wt(e, t) {
31115
31115
  if (e.openElements.currentTagId !== void 0 && bs.has(e.openElements.currentTagId))
31116
31116
  switch (e.pendingCharacterTokens.length = 0, e.hasNonWhitespacePendingCharacterToken = false, e.originalInsertionMode = e.insertionMode, e.insertionMode = l.IN_TABLE_TEXT, t.type) {
31117
- case O.CHARACTER: {
31117
+ case O$1.CHARACTER: {
31118
31118
  xs(e, t);
31119
31119
  break;
31120
31120
  }
31121
- case O.WHITESPACE_CHARACTER: {
31121
+ case O$1.WHITESPACE_CHARACTER: {
31122
31122
  Ns(e, t);
31123
31123
  break;
31124
31124
  }
@@ -31139,7 +31139,7 @@ function q0(e, t) {
31139
31139
  e.openElements.clearBackToTableContext(), e._insertElement(t, E.HTML), e.insertionMode = l.IN_TABLE_BODY;
31140
31140
  }
31141
31141
  function Y0(e, t) {
31142
- e.openElements.clearBackToTableContext(), e._insertFakeElement(p.TBODY, s.TBODY), e.insertionMode = l.IN_TABLE_BODY, Rt(e, t);
31142
+ e.openElements.clearBackToTableContext(), e._insertFakeElement(p.TBODY, s.TBODY), e.insertionMode = l.IN_TABLE_BODY, Rt$1(e, t);
31143
31143
  }
31144
31144
  function j0(e, t) {
31145
31145
  e.openElements.hasInTableScope(s.TABLE) && (e.openElements.popUntilTagNamePopped(s.TABLE), e._resetInsertionMode(), e._processStartTag(t));
@@ -31247,7 +31247,7 @@ function Fe(e, t) {
31247
31247
  const Is = /* @__PURE__ */ new Set([s.CAPTION, s.COL, s.COLGROUP, s.TBODY, s.TD, s.TFOOT, s.TH, s.THEAD, s.TR]);
31248
31248
  function G0(e, t) {
31249
31249
  const u = t.tagID;
31250
- Is.has(u) ? e.openElements.hasInTableScope(s.CAPTION) && (e.openElements.generateImpliedEndTags(), e.openElements.popUntilTagNamePopped(s.CAPTION), e.activeFormattingElements.clearToLastMarker(), e.insertionMode = l.IN_TABLE, Re(e, t)) : G$1(e, t);
31250
+ Is.has(u) ? e.openElements.hasInTableScope(s.CAPTION) && (e.openElements.generateImpliedEndTags(), e.openElements.popUntilTagNamePopped(s.CAPTION), e.activeFormattingElements.clearToLastMarker(), e.insertionMode = l.IN_TABLE, Re(e, t)) : G(e, t);
31251
31251
  }
31252
31252
  function W0(e, t) {
31253
31253
  const u = t.tagID;
@@ -31275,7 +31275,7 @@ function W0(e, t) {
31275
31275
  function Lu(e, t) {
31276
31276
  switch (t.tagID) {
31277
31277
  case s.HTML: {
31278
- G$1(e, t);
31278
+ G(e, t);
31279
31279
  break;
31280
31280
  }
31281
31281
  case s.COL: {
@@ -31287,7 +31287,7 @@ function Lu(e, t) {
31287
31287
  break;
31288
31288
  }
31289
31289
  default:
31290
- _t(e, t);
31290
+ _t$1(e, t);
31291
31291
  }
31292
31292
  }
31293
31293
  function z0(e, t) {
@@ -31303,13 +31303,13 @@ function z0(e, t) {
31303
31303
  case s.COL:
31304
31304
  break;
31305
31305
  default:
31306
- _t(e, t);
31306
+ _t$1(e, t);
31307
31307
  }
31308
31308
  }
31309
- function _t(e, t) {
31309
+ function _t$1(e, t) {
31310
31310
  e.openElements.currentTagId === s.COLGROUP && (e.openElements.pop(), e.insertionMode = l.IN_TABLE, e._processToken(t));
31311
31311
  }
31312
- function Rt(e, t) {
31312
+ function Rt$1(e, t) {
31313
31313
  switch (t.tagID) {
31314
31314
  case s.TR: {
31315
31315
  e.openElements.clearBackToTableBodyContext(), e._insertElement(t, E.HTML), e.insertionMode = l.IN_ROW;
@@ -31373,7 +31373,7 @@ function Dt(e, t) {
31373
31373
  case s.TFOOT:
31374
31374
  case s.THEAD:
31375
31375
  case s.TR: {
31376
- e.openElements.hasInTableScope(s.TR) && (e.openElements.clearBackToTableRowContext(), e.openElements.pop(), e.insertionMode = l.IN_TABLE_BODY, Rt(e, t));
31376
+ e.openElements.hasInTableScope(s.TR) && (e.openElements.clearBackToTableRowContext(), e.openElements.pop(), e.insertionMode = l.IN_TABLE_BODY, Rt$1(e, t));
31377
31377
  break;
31378
31378
  }
31379
31379
  default:
@@ -31410,7 +31410,7 @@ function Ss(e, t) {
31410
31410
  }
31411
31411
  function Q0(e, t) {
31412
31412
  const u = t.tagID;
31413
- Is.has(u) ? (e.openElements.hasInTableScope(s.TD) || e.openElements.hasInTableScope(s.TH)) && (e._closeTableCell(), Dt(e, t)) : G$1(e, t);
31413
+ Is.has(u) ? (e.openElements.hasInTableScope(s.TD) || e.openElements.hasInTableScope(s.TH)) && (e._closeTableCell(), Dt(e, t)) : G(e, t);
31414
31414
  }
31415
31415
  function K0(e, t) {
31416
31416
  const u = t.tagID;
@@ -31441,7 +31441,7 @@ function K0(e, t) {
31441
31441
  function Cs(e, t) {
31442
31442
  switch (t.tagID) {
31443
31443
  case s.HTML: {
31444
- G$1(e, t);
31444
+ G(e, t);
31445
31445
  break;
31446
31446
  }
31447
31447
  case s.OPTION: {
@@ -31528,7 +31528,7 @@ function J0(e, t) {
31528
31528
  break;
31529
31529
  }
31530
31530
  case s.TR: {
31531
- e.tmplInsertionModeStack[0] = l.IN_TABLE_BODY, e.insertionMode = l.IN_TABLE_BODY, Rt(e, t);
31531
+ e.tmplInsertionModeStack[0] = l.IN_TABLE_BODY, e.insertionMode = l.IN_TABLE_BODY, Rt$1(e, t);
31532
31532
  break;
31533
31533
  }
31534
31534
  case s.TD:
@@ -31537,7 +31537,7 @@ function J0(e, t) {
31537
31537
  break;
31538
31538
  }
31539
31539
  default:
31540
- e.tmplInsertionModeStack[0] = l.IN_BODY, e.insertionMode = l.IN_BODY, G$1(e, t);
31540
+ e.tmplInsertionModeStack[0] = l.IN_BODY, e.insertionMode = l.IN_BODY, G(e, t);
31541
31541
  }
31542
31542
  }
31543
31543
  function ed(e, t) {
@@ -31547,7 +31547,7 @@ function Os(e, t) {
31547
31547
  e.openElements.tmplCount > 0 ? (e.openElements.popUntilTagNamePopped(s.TEMPLATE), e.activeFormattingElements.clearToLastMarker(), e.tmplInsertionModeStack.shift(), e._resetInsertionMode(), e.onEof(t)) : Ou(e, t);
31548
31548
  }
31549
31549
  function td(e, t) {
31550
- t.tagID === s.HTML ? G$1(e, t) : gt(e, t);
31550
+ t.tagID === s.HTML ? G(e, t) : gt(e, t);
31551
31551
  }
31552
31552
  function Ls(e, t) {
31553
31553
  var u;
@@ -31566,7 +31566,7 @@ function gt(e, t) {
31566
31566
  function ud(e, t) {
31567
31567
  switch (t.tagID) {
31568
31568
  case s.HTML: {
31569
- G$1(e, t);
31569
+ G(e, t);
31570
31570
  break;
31571
31571
  }
31572
31572
  case s.FRAMESET: {
@@ -31589,7 +31589,7 @@ function rd(e, t) {
31589
31589
  function sd(e, t) {
31590
31590
  switch (t.tagID) {
31591
31591
  case s.HTML: {
31592
- G$1(e, t);
31592
+ G(e, t);
31593
31593
  break;
31594
31594
  }
31595
31595
  case s.NOFRAMES: {
@@ -31602,7 +31602,7 @@ function ad(e, t) {
31602
31602
  t.tagID === s.HTML && (e.insertionMode = l.AFTER_AFTER_FRAMESET);
31603
31603
  }
31604
31604
  function id(e, t) {
31605
- t.tagID === s.HTML ? G$1(e, t) : ct(e, t);
31605
+ t.tagID === s.HTML ? G(e, t) : ct(e, t);
31606
31606
  }
31607
31607
  function ct(e, t) {
31608
31608
  e.insertionMode = l.IN_BODY, Ot$1(e, t);
@@ -31610,7 +31610,7 @@ function ct(e, t) {
31610
31610
  function nd(e, t) {
31611
31611
  switch (t.tagID) {
31612
31612
  case s.HTML: {
31613
- G$1(e, t);
31613
+ G(e, t);
31614
31614
  break;
31615
31615
  }
31616
31616
  case s.NOFRAMES: {
@@ -31775,7 +31775,7 @@ const pe = {
31775
31775
  //Node construction
31776
31776
  createDocument() {
31777
31777
  const e = new Ne([]);
31778
- return e["x-mode"] = X.NO_QUIRKS, e;
31778
+ return e["x-mode"] = X$1.NO_QUIRKS, e;
31779
31779
  },
31780
31780
  createDocumentFragment() {
31781
31781
  return new Ne([]);
@@ -32315,7 +32315,7 @@ const Ld = (e) => {
32315
32315
  } catch {
32316
32316
  return false;
32317
32317
  }
32318
- }, j$1 = (e) => {
32318
+ }, j = (e) => {
32319
32319
  const t = {
32320
32320
  "&": "&amp;",
32321
32321
  "<": "&lt;",
@@ -32387,7 +32387,7 @@ const Ld = (e) => {
32387
32387
  fieldCount: Object.keys(h).length
32388
32388
  }), h;
32389
32389
  } catch (n) {
32390
- throw vt$1(n) ? typeof window < "u" ? r.debug(
32390
+ throw vt(n) ? typeof window < "u" ? r.debug(
32391
32391
  "fetchMetadata: Browser CORS restrictions prevent fetching metadata for URL:",
32392
32392
  e
32393
32393
  ) : r.warn(
@@ -32407,14 +32407,14 @@ const Ld = (e) => {
32407
32407
  <div class="card-body">
32408
32408
  <div class="card-header">
32409
32409
  <div class="card-title">📄 External Content</div>
32410
- <div class="card-provider">${j$1(u)}</div>
32410
+ <div class="card-provider">${j(u)}</div>
32411
32411
  </div>
32412
32412
  <div class="card-description">
32413
32413
  ${r}${a ? ` - ${a}` : ""}
32414
32414
  </div>
32415
32415
  <div class="card-content">
32416
- <a href="${j$1(e)}" target="_blank" rel="noopener noreferrer" class="card-external-link">
32417
- → Open ${j$1(u)} in new tab
32416
+ <a href="${j(e)}" target="_blank" rel="noopener noreferrer" class="card-external-link">
32417
+ → Open ${j(u)} in new tab
32418
32418
  </a>
32419
32419
  </div>
32420
32420
  </div>
@@ -32439,9 +32439,9 @@ const Ld = (e) => {
32439
32439
  h && a.image !== void 0 && v.push({
32440
32440
  order: a.image,
32441
32441
  section: "image",
32442
- html: At(
32443
- j$1(h),
32444
- j$1(A),
32442
+ html: At$1(
32443
+ j(h),
32444
+ j(A),
32445
32445
  "card-image",
32446
32446
  void 0,
32447
32447
  'loading="lazy"'
@@ -32449,7 +32449,7 @@ const Ld = (e) => {
32449
32449
  });
32450
32450
  let S = "";
32451
32451
  m && a.favicon !== void 0 && (S = ou(
32452
- j$1(m),
32452
+ j(m),
32453
32453
  "",
32454
32454
  void 0,
32455
32455
  'class="card-favicon"'
@@ -32459,19 +32459,19 @@ const Ld = (e) => {
32459
32459
  order: a.title,
32460
32460
  section: "header",
32461
32461
  isHeader: true,
32462
- html: `<div class="card-title">${j$1(A)}</div>`
32462
+ html: `<div class="card-title">${j(A)}</div>`
32463
32463
  }), a.siteName !== void 0 && U2.push({
32464
32464
  order: a.siteName,
32465
32465
  section: "header",
32466
32466
  isHeader: true,
32467
32467
  html: `<div class="card-provider">
32468
32468
  ${a.favicon !== void 0 ? S : ""}
32469
- <span>${j$1(T)}</span>
32469
+ <span>${j(T)}</span>
32470
32470
  </div>`
32471
32471
  }), w && a.description !== void 0 && v.push({
32472
32472
  order: a.description,
32473
32473
  section: "body",
32474
- html: `<div class="card-description">${j$1(w)}</div>`
32474
+ html: `<div class="card-description">${j(w)}</div>`
32475
32475
  });
32476
32476
  for (const [y, W2] of Object.entries(e)) {
32477
32477
  if ([
@@ -32489,15 +32489,15 @@ const Ld = (e) => {
32489
32489
  if (Ce !== void 0) {
32490
32490
  let Me = "";
32491
32491
  if (Array.isArray(W2)) {
32492
- const Pt = W2.slice(0, 3).map((Hs) => `<li>${j$1(String(Hs))}</li>`).join("");
32492
+ const Pt2 = W2.slice(0, 3).map((Hs) => `<li>${j(String(Hs))}</li>`).join("");
32493
32493
  Me = `<div class="card-field card-${y}">
32494
- <div class="field-label">${j$1(y)}:</div>
32495
- <ul class="field-list">${Pt}</ul>
32494
+ <div class="field-label">${j(y)}:</div>
32495
+ <ul class="field-list">${Pt2}</ul>
32496
32496
  </div>`;
32497
32497
  } else
32498
32498
  Me = `<div class="card-field card-${y}">
32499
- <span class="field-label">${j$1(y)}:</span>
32500
- <span class="field-value">${j$1(String(W2))}</span>
32499
+ <span class="field-label">${j(y)}:</span>
32500
+ <span class="field-value">${j(String(W2))}</span>
32501
32501
  </div>`;
32502
32502
  v.push({
32503
32503
  order: Ce,
@@ -32518,23 +32518,23 @@ const Ld = (e) => {
32518
32518
  "locale",
32519
32519
  "favicon"
32520
32520
  ].includes(y) || a[y] === void 0 && M2.push(y);
32521
- let ee = 1e3;
32521
+ let ee2 = 1e3;
32522
32522
  for (const y of M2) {
32523
32523
  const W2 = e[y];
32524
32524
  let Ce = "";
32525
32525
  if (Array.isArray(W2)) {
32526
- const Me = W2.slice(0, 3).map((Pt) => `<li>${j$1(String(Pt))}</li>`).join("");
32526
+ const Me = W2.slice(0, 3).map((Pt2) => `<li>${j(String(Pt2))}</li>`).join("");
32527
32527
  Ce = `<div class="card-field card-${y}">
32528
- <div class="field-label">${j$1(y)}:</div>
32528
+ <div class="field-label">${j(y)}:</div>
32529
32529
  <ul class="field-list">${Me}</ul>
32530
32530
  </div>`;
32531
32531
  } else
32532
32532
  Ce = `<div class="card-field card-${y}">
32533
- <span class="field-label">${j$1(y)}:</span>
32534
- <span class="field-value">${j$1(String(W2))}</span>
32533
+ <span class="field-label">${j(y)}:</span>
32534
+ <span class="field-value">${j(String(W2))}</span>
32535
32535
  </div>`;
32536
32536
  v.push({
32537
- order: ee++,
32537
+ order: ee2++,
32538
32538
  section: "enhanced",
32539
32539
  html: Ce
32540
32540
  });
@@ -32552,7 +32552,7 @@ const Ld = (e) => {
32552
32552
  const ku = ae || kt2 ? `<div class="card-body">
32553
32553
  ${ae}
32554
32554
  ${kt2}
32555
- </div>` : "", Us = i("siteName")?.toLowerCase().includes("amazon") ? "card-container card-amazon" : "card-container", Fs = a.url !== void 0 ? `<a href="${j$1(f)}" target="_blank" rel="noopener noreferrer" class="card-link">
32555
+ </div>` : "", Us = i("siteName")?.toLowerCase().includes("amazon") ? "card-container card-amazon" : "card-container", Fs = a.url !== void 0 ? `<a href="${j(f)}" target="_blank" rel="noopener noreferrer" class="card-link">
32556
32556
  ${Du}
32557
32557
  ${ku}
32558
32558
  </a>` : `${Du}
@@ -32563,33 +32563,33 @@ const Ld = (e) => {
32563
32563
  };
32564
32564
  /*!
32565
32565
  * name: mark-deco
32566
- * version: 0.9.0
32566
+ * version: 0.12.0
32567
32567
  * description: Flexible Markdown to HTML conversion library
32568
32568
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
32569
32569
  * license: MIT
32570
32570
  * repository.url: https://github.com/kekyo/mark-deco.git
32571
- * git.commit.hash: d0e45da82482af0e17292db548313487c588061b
32571
+ * git.commit.hash: aff53ffd52269533e39dd1090efe8b582e087d53
32572
32572
  */
32573
- function W(e) {
32573
+ function Q(e) {
32574
32574
  const t = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/, n = e.match(t);
32575
32575
  if (!n)
32576
32576
  return {
32577
32577
  data: {},
32578
32578
  content: e
32579
32579
  };
32580
- const o2 = n[1] || "", r = e.slice(n[0].length);
32580
+ const a = n[1] || "", r = e.slice(n[0].length);
32581
32581
  try {
32582
- const s2 = load(o2, { schema: JSON_SCHEMA });
32582
+ const s2 = load(a, { schema: JSON_SCHEMA });
32583
32583
  return {
32584
32584
  data: s2 && typeof s2 == "object" && !Array.isArray(s2) ? s2 : {},
32585
32585
  content: r
32586
32586
  };
32587
32587
  } catch (s2) {
32588
- const f = s2 instanceof Error ? s2.message : "Unknown YAML parsing error";
32589
- throw new Error(`Failed to parse frontmatter YAML: ${f}`);
32588
+ const h = s2 instanceof Error ? s2.message : "Unknown YAML parsing error";
32589
+ throw new Error(`Failed to parse frontmatter YAML: ${h}`);
32590
32590
  }
32591
32591
  }
32592
- function wt(e) {
32592
+ function kt(e) {
32593
32593
  if (!e || Object.keys(e).length === 0)
32594
32594
  return "";
32595
32595
  const t = dump(e, { lineWidth: 0 });
@@ -32597,58 +32597,58 @@ function wt(e) {
32597
32597
  `) ? t : `${t}
32598
32598
  `;
32599
32599
  }
32600
- function G(e, t) {
32600
+ function V(e, t) {
32601
32601
  const n = t ?? "";
32602
32602
  return `${`---
32603
- ${wt(e)}---
32603
+ ${kt(e)}---
32604
32604
  `}${n}`;
32605
32605
  }
32606
32606
  const _ = () => {
32607
- }, vt = {
32607
+ }, bt = {
32608
32608
  debug: _,
32609
32609
  info: _,
32610
32610
  warn: _,
32611
32611
  error: _
32612
- }, Et = {
32612
+ }, St = {
32613
32613
  debug: console.debug,
32614
32614
  info: console.info,
32615
32615
  warn: console.warn,
32616
32616
  error: console.error
32617
- }, kt = () => vt, Kt = () => Et, H = (e) => {
32618
- const t = {}, n = e.slice(1, -1).trim(), o2 = n.match(/\.([a-zA-Z0-9_-]+)/g);
32619
- if (o2) {
32620
- const f = o2.map((m) => m.slice(1));
32621
- t.class = f.join(" ");
32617
+ }, $t = () => bt, Gt = () => St, O = (e) => {
32618
+ const t = {}, n = e.slice(1, -1).trim(), a = n.match(/\.([a-zA-Z0-9_-]+)/g);
32619
+ if (a) {
32620
+ const h = a.map((u) => u.slice(1));
32621
+ t.class = h.join(" ");
32622
32622
  }
32623
32623
  const r = n.match(/#([a-zA-Z0-9_-]+)/);
32624
32624
  r && r[1] && (t.id = r[1]);
32625
32625
  const s2 = n.match(/([a-zA-Z0-9_-]+)=["']?([^"'\s]*)["']?/g);
32626
32626
  if (s2)
32627
- for (const f of s2) {
32628
- const [m, d2] = f.split("=");
32629
- m && d2 && m !== "class" && m !== "id" && (t[m] = d2.replace(/["']/g, ""));
32627
+ for (const h of s2) {
32628
+ const [u, p2] = h.split("=");
32629
+ u && p2 && u !== "class" && u !== "id" && (t[u] = p2.replace(/["']/g, ""));
32630
32630
  }
32631
32631
  return t;
32632
- }, bt = (e) => {
32632
+ }, xt = (e) => {
32633
32633
  const t = e.lang ? ` class="language-${e.lang}"` : "", n = e.value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
32634
32634
  return `<pre><code${t}>${n}</code></pre>`;
32635
32635
  }, L = (e, t) => {
32636
- e.data || (e.data = {}), e.data.hProperties || (e.data.hProperties = {}), Object.entries(t).forEach(([n, o2]) => {
32636
+ e.data || (e.data = {}), e.data.hProperties || (e.data.hProperties = {}), Object.entries(t).forEach(([n, a]) => {
32637
32637
  if (n === "class") {
32638
32638
  const r = e.data.hProperties.class;
32639
- r ? typeof r == "string" && r.startsWith("language-") ? e.data.hProperties.class = `${r} ${o2}` : e.data.hProperties.class = `${r} ${o2}` : e.data.hProperties.class = o2;
32639
+ r ? typeof r == "string" && r.startsWith("language-") ? e.data.hProperties.class = `${r} ${a}` : e.data.hProperties.class = `${r} ${a}` : e.data.hProperties.class = a;
32640
32640
  } else
32641
- e.data.hProperties[n] = o2;
32641
+ e.data.hProperties[n] = a;
32642
32642
  });
32643
- }, $t = () => (e) => {
32644
- visit(e, (t, n, o2) => {
32643
+ }, Ht = () => (e) => {
32644
+ visit(e, (t, n, a) => {
32645
32645
  if (t.type === "heading" && t.children?.length > 0) {
32646
32646
  const r = t.children[t.children.length - 1];
32647
32647
  if (r?.type === "text" && r.value) {
32648
32648
  const s2 = r.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32649
32649
  if (s2) {
32650
- const f = s2[1].trim(), m = s2[2], d2 = H(m);
32651
- r.value = f, L(t, d2);
32650
+ const h = s2[1].trim(), u = s2[2], p2 = O(u);
32651
+ r.value = h, L(t, p2);
32652
32652
  }
32653
32653
  }
32654
32654
  }
@@ -32657,28 +32657,28 @@ const _ = () => {
32657
32657
  if (r?.type === "text" && r.value) {
32658
32658
  const s2 = r.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32659
32659
  if (s2) {
32660
- const f = s2[1].trim(), m = s2[2], d2 = H(m);
32661
- r.value = f, L(t, d2);
32660
+ const h = s2[1].trim(), u = s2[2], p2 = O(u);
32661
+ r.value = h, L(t, p2);
32662
32662
  }
32663
32663
  }
32664
32664
  }
32665
- if (t.type === "link" && o2 && typeof n == "number") {
32666
- const r = o2.children[n + 1];
32665
+ if (t.type === "link" && a && typeof n == "number") {
32666
+ const r = a.children[n + 1];
32667
32667
  if (r?.type === "text" && r.value) {
32668
32668
  const s2 = r.value.match(/^\s*(\{[^}]+\})/);
32669
32669
  if (s2) {
32670
- const f = s2[1], m = H(f);
32671
- L(t, m), r.value = r.value.replace(s2[0], "");
32670
+ const h = s2[1], u = O(h);
32671
+ L(t, u), r.value = r.value.replace(s2[0], "");
32672
32672
  }
32673
32673
  }
32674
32674
  }
32675
- if (t.type === "image" && o2 && typeof n == "number") {
32676
- const r = o2.children[n + 1];
32675
+ if (t.type === "image" && a && typeof n == "number") {
32676
+ const r = a.children[n + 1];
32677
32677
  if (r?.type === "text" && r.value) {
32678
32678
  const s2 = r.value.match(/^\s*(\{[^}]+\})/);
32679
32679
  if (s2) {
32680
- const f = s2[1], m = H(f);
32681
- L(t, m), r.value = r.value.replace(s2[0], "");
32680
+ const h = s2[1], u = O(h);
32681
+ L(t, u), r.value = r.value.replace(s2[0], "");
32682
32682
  }
32683
32683
  }
32684
32684
  }
@@ -32687,23 +32687,23 @@ const _ = () => {
32687
32687
  if (r?.type === "paragraph" && r.children?.length > 0) {
32688
32688
  const s2 = r.children[r.children.length - 1];
32689
32689
  if (s2?.type === "text" && s2.value) {
32690
- const f = s2.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32691
- if (f) {
32692
- const m = f[1].trim(), d2 = f[2], c = H(d2);
32693
- s2.value = m, L(t, c);
32690
+ const h = s2.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32691
+ if (h) {
32692
+ const u = h[1].trim(), p2 = h[2], i = O(p2);
32693
+ s2.value = u, L(t, i);
32694
32694
  }
32695
32695
  }
32696
32696
  }
32697
32697
  }
32698
- if (t.type === "list" && o2 && typeof n == "number") {
32699
- const r = o2.children[n + 1];
32698
+ if (t.type === "list" && a && typeof n == "number") {
32699
+ const r = a.children[n + 1];
32700
32700
  if (r?.type === "paragraph" && r.children?.length === 1) {
32701
32701
  const s2 = r.children[0];
32702
32702
  if (s2?.type === "text" && s2.value) {
32703
- const f = s2.value.match(/^\s*(\{[^}]+\})\s*$/);
32704
- if (f) {
32705
- const m = f[1], d2 = H(m);
32706
- L(t, d2), o2.children.splice(n + 1, 1);
32703
+ const h = s2.value.match(/^\s*(\{[^}]+\})\s*$/);
32704
+ if (h) {
32705
+ const u = h[1], p2 = O(u);
32706
+ L(t, p2), a.children.splice(n + 1, 1);
32707
32707
  }
32708
32708
  }
32709
32709
  }
@@ -32713,60 +32713,107 @@ const _ = () => {
32713
32713
  if (r?.type === "paragraph" && r.children?.length > 0) {
32714
32714
  const s2 = r.children[r.children.length - 1];
32715
32715
  if (s2?.type === "text" && s2.value) {
32716
- const f = s2.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32717
- if (f) {
32718
- const m = f[1].trim(), d2 = f[2], c = H(d2);
32719
- s2.value = m, L(t, c);
32716
+ const h = s2.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32717
+ if (h) {
32718
+ const u = h[1].trim(), p2 = h[2], i = O(p2);
32719
+ s2.value = u, L(t, i);
32720
32720
  }
32721
32721
  }
32722
32722
  }
32723
32723
  }
32724
- if (t.type === "blockquote" && o2 && typeof n == "number") {
32725
- const r = o2.children[n + 1];
32724
+ if (t.type === "blockquote" && a && typeof n == "number") {
32725
+ const r = a.children[n + 1];
32726
32726
  if (r?.type === "paragraph" && r.children?.length === 1) {
32727
32727
  const s2 = r.children[0];
32728
32728
  if (s2?.type === "text" && s2.value) {
32729
- const f = s2.value.match(/^\s*(\{[^}]+\})\s*$/);
32730
- if (f) {
32731
- const m = f[1], d2 = H(m);
32732
- L(t, d2), o2.children.splice(n + 1, 1);
32729
+ const h = s2.value.match(/^\s*(\{[^}]+\})\s*$/);
32730
+ if (h) {
32731
+ const u = h[1], p2 = O(u);
32732
+ L(t, p2), a.children.splice(n + 1, 1);
32733
32733
  }
32734
32734
  }
32735
32735
  }
32736
32736
  }
32737
- if (t.type === "inlineCode" && o2 && typeof n == "number") {
32738
- const r = o2.children[n + 1];
32737
+ if (t.type === "inlineCode" && a && typeof n == "number") {
32738
+ const r = a.children[n + 1];
32739
32739
  if (r?.type === "text" && r.value) {
32740
32740
  const s2 = r.value.match(/^\s*(\{[^}]+\})/);
32741
32741
  if (s2) {
32742
- const f = s2[1], m = H(f);
32743
- L(t, m), r.value = r.value.replace(s2[0], "");
32742
+ const h = s2[1], u = O(h);
32743
+ L(t, u), r.value = r.value.replace(s2[0], "");
32744
32744
  }
32745
32745
  }
32746
32746
  }
32747
32747
  if (t.type === "code" && t.meta) {
32748
32748
  const r = t.meta.match(/\{([^}]+)\}/);
32749
32749
  if (r) {
32750
- const s2 = `{${r[1]}}`, f = H(s2), m = {
32750
+ const s2 = `{${r[1]}}`, h = O(s2), u = {
32751
32751
  type: "html",
32752
- value: `<div class="${f.class || ""}" ${Object.entries(
32753
- f
32754
- ).filter(([d2]) => d2 !== "class").map(([d2, c]) => `${d2}="${c}"`).join(" ")}>${bt(t)}</div>`
32752
+ value: `<div class="${h.class || ""}" ${Object.entries(
32753
+ h
32754
+ ).filter(([p2]) => p2 !== "class").map(([p2, i]) => `${p2}="${i}"`).join(" ")}>${xt(t)}</div>`
32755
32755
  };
32756
- o2 && typeof n == "number" && (o2.children[n] = m), t.meta = t.meta.replace(r[0], "").trim() || null;
32756
+ a && typeof n == "number" && (a.children[n] = u), t.meta = t.meta.replace(r[0], "").trim() || null;
32757
32757
  }
32758
32758
  }
32759
32759
  });
32760
- }, St = () => (e) => {
32760
+ }, Ct = () => (e) => {
32761
32761
  visit(e, "element", (t) => {
32762
32762
  if (t.tagName === "img") {
32763
32763
  const n = Ys();
32764
32764
  t.properties || (t.properties = {});
32765
- const o2 = t.properties.style || "", r = o2 ? `${o2}; ${n}` : n;
32765
+ const a = t.properties.style || "", r = a ? `${a}; ${n}` : n;
32766
32766
  t.properties.style = r;
32767
32767
  }
32768
32768
  });
32769
- }, { html: xt } = tt$1, Ct = {
32769
+ }, U = (e) => e ? "value" in e && typeof e.value == "string" ? e.value : "children" in e && Array.isArray(e.children) ? e.children.map((t) => U(t)).join("") : "" : "", Ft = (e) => {
32770
+ const { frontmatter: t, hasTitle: n, allowTitleWrite: a, onHeadingApplied: r } = e;
32771
+ return (s2) => {
32772
+ if (!t || !s2.children || s2.children.length === 0)
32773
+ return;
32774
+ let h = 0;
32775
+ for (; h < s2.children.length; h++) {
32776
+ const u = s2.children[h];
32777
+ if (u.type === "heading" && u.depth === 1) {
32778
+ const p2 = u, i = s2.children[h + 1], c = i && i.position ? i.position.start?.offset : void 0, l2 = U(p2).trim();
32779
+ s2.children.splice(h, 1);
32780
+ let o2 = false;
32781
+ !n && a && l2.length > 0 && (t.title = l2, o2 = true), r && r({
32782
+ headingText: l2,
32783
+ position: p2.position,
32784
+ nextNodeStartOffset: c,
32785
+ titleWritten: o2
32786
+ });
32787
+ break;
32788
+ }
32789
+ if (!(u.type === "thematicBreak" || u.type === "html" && typeof u.value == "string" && u.value.trim() === "") && !(u.type === "paragraph" && u.children?.length === 0))
32790
+ break;
32791
+ }
32792
+ };
32793
+ }, Z = (e, t, n) => {
32794
+ const a = t != null && Object.prototype.hasOwnProperty.call(t, "title") && t.title !== void 0 && t.title !== null;
32795
+ let r = false, s2 = false, h, u;
32796
+ const p2 = unified().use(remarkParse).use(Ft, {
32797
+ frontmatter: t,
32798
+ hasTitle: a,
32799
+ allowTitleWrite: n.allowTitleWrite,
32800
+ onHeadingApplied: (c) => {
32801
+ r = true, s2 = c.titleWritten;
32802
+ const l2 = c.position?.start?.offset ?? 0;
32803
+ let o2 = c.position?.end?.offset ?? l2;
32804
+ typeof c.nextNodeStartOffset == "number" && c.nextNodeStartOffset >= o2 ? o2 = c.nextNodeStartOffset : o2 = e.length, h = l2, u = o2;
32805
+ }
32806
+ }), i = p2.parse(e);
32807
+ return p2.runSync(i), r && h !== void 0 && u !== void 0 ? {
32808
+ content: e.slice(0, h) + e.slice(u),
32809
+ headingRemoved: true,
32810
+ titleWritten: s2
32811
+ } : {
32812
+ content: e,
32813
+ headingRemoved: false,
32814
+ titleWritten: false
32815
+ };
32816
+ }, { html: Tt } = ot$1, Ot = {
32770
32817
  indent_size: 2,
32771
32818
  indent_char: " ",
32772
32819
  max_preserve_newlines: 2,
@@ -32778,51 +32825,51 @@ const _ = () => {
32778
32825
  unformatted: ["code", "pre", "textarea"],
32779
32826
  content_unformatted: ["pre", "code", "textarea"],
32780
32827
  extra_liners: []
32781
- }, q = (e) => {
32828
+ }, W = (e) => {
32782
32829
  if (e instanceof Date)
32783
32830
  return e.toISOString();
32784
32831
  if (Array.isArray(e))
32785
- return e.map(q);
32832
+ return e.map(W);
32786
32833
  if (e && typeof e == "object") {
32787
- const t = Object.entries(e).filter(([, o2]) => o2 !== void 0).sort(([o2], [r]) => o2 < r ? -1 : o2 > r ? 1 : 0), n = {};
32788
- for (const [o2, r] of t)
32789
- n[o2] = q(r);
32834
+ const t = Object.entries(e).filter(([, a]) => a !== void 0).sort(([a], [r]) => a < r ? -1 : a > r ? 1 : 0), n = {};
32835
+ for (const [a, r] of t)
32836
+ n[a] = W(r);
32790
32837
  return n;
32791
32838
  }
32792
32839
  return e;
32793
- }, j = (e) => JSON.stringify(q(e ?? {})), D = (e) => e.type === "text" || e.type === "inlineCode" ? e.value || "" : e.children && Array.isArray(e.children) ? e.children.map(D).join("") : "", Ht = (e, t) => `${e}-${t.join("-")}`, Ft = (e) => {
32840
+ }, M = (e) => JSON.stringify(W(e ?? {})), It = (e, t) => `${e}-${t.join("-")}`, Nt = (e) => {
32794
32841
  const t = [], n = [];
32795
- for (const o2 of e) {
32796
- const r = o2.level;
32842
+ for (const a of e) {
32843
+ const r = a.level;
32797
32844
  for (; n.length > r; )
32798
32845
  n.pop();
32799
32846
  for (; n.length < r; )
32800
32847
  n.push(0);
32801
32848
  const s2 = r - 1;
32802
32849
  n[s2] = (n[s2] || 0) + 1;
32803
- const f = n.slice(0, r);
32850
+ const h = n.slice(0, r);
32804
32851
  t.push({
32805
- level: o2.level,
32806
- text: o2.text,
32807
- numbers: f
32852
+ level: a.level,
32853
+ text: a.text,
32854
+ numbers: h
32808
32855
  });
32809
32856
  }
32810
32857
  return t;
32811
- }, Q = (e, t, n) => {
32812
- const o2 = jd(t);
32813
- return o2 !== void 0 ? `${e}-${o2}` : n();
32814
- }, It = (e) => {
32858
+ }, X = (e, t, n) => {
32859
+ const a = jd(t);
32860
+ return a !== void 0 ? `${e}-${a}` : n();
32861
+ }, Lt = (e) => {
32815
32862
  const t = [], n = [];
32816
- for (const o2 of e) {
32863
+ for (const a of e) {
32817
32864
  const r = {
32818
- level: o2.level,
32819
- text: o2.text,
32820
- id: o2.id,
32865
+ level: a.level,
32866
+ text: a.text,
32867
+ id: a.id,
32821
32868
  children: []
32822
32869
  };
32823
32870
  for (; n.length > 0; ) {
32824
32871
  const s2 = n[n.length - 1];
32825
- if (s2 && s2.level >= o2.level)
32872
+ if (s2 && s2.level >= a.level)
32826
32873
  n.pop();
32827
32874
  else
32828
32875
  break;
@@ -32836,252 +32883,267 @@ const _ = () => {
32836
32883
  n.push(r);
32837
32884
  }
32838
32885
  return t;
32839
- }, Wt = (e) => {
32840
- const { plugins: t = [], logger: n = kt(), fetcher: o2 } = e, r = /* @__PURE__ */ new Map();
32841
- for (const a of t) {
32842
- if (r.has(a.name))
32886
+ }, Qt = (e) => {
32887
+ const { plugins: t = [], logger: n = $t(), fetcher: a } = e, r = /* @__PURE__ */ new Map();
32888
+ for (const o2 of t) {
32889
+ if (r.has(o2.name))
32843
32890
  throw new Error(
32844
- `Plugin with name '${a.name}' is already registered`
32891
+ `Plugin with name '${o2.name}' is already registered`
32845
32892
  );
32846
- r.set(a.name, a);
32893
+ r.set(o2.name, o2);
32847
32894
  }
32848
- const s2 = async (a, h, u) => {
32849
- const p2 = r.get(a);
32850
- return p2 ? await p2.processBlock(h, u) : `<pre><code class="language-${a}">${R(h)}</code></pre>`;
32851
- }, f = (a, h, u) => {
32852
- const p2 = {
32895
+ const s2 = async (o2, f, d2) => {
32896
+ const m = r.get(o2);
32897
+ return m ? await m.processBlock(f, d2) : `<pre><code class="language-${o2}">${R(f)}</code></pre>`;
32898
+ }, h = (o2, f, d2) => {
32899
+ const m = {
32853
32900
  logger: n,
32854
- signal: h,
32855
- frontmatter: a,
32856
- getUniqueId: u,
32857
- fetcher: o2
32901
+ signal: f,
32902
+ frontmatter: o2,
32903
+ getUniqueId: d2,
32904
+ fetcher: a
32858
32905
  };
32859
32906
  return () => async (y) => {
32860
- const g2 = [];
32907
+ const w = [];
32861
32908
  visit(
32862
32909
  y,
32863
32910
  "code",
32864
- (w, E2, C2) => {
32865
- if (!w.lang || !r.has(w.lang))
32911
+ (g2, v, $2) => {
32912
+ if (!g2.lang || !r.has(g2.lang))
32866
32913
  return;
32867
- const $2 = (async () => {
32868
- const v = {
32914
+ const S = (async () => {
32915
+ const E2 = {
32869
32916
  type: "html",
32870
32917
  value: await s2(
32871
- w.lang,
32872
- w.value,
32873
- p2
32918
+ g2.lang,
32919
+ g2.value,
32920
+ m
32874
32921
  )
32875
32922
  };
32876
- C2 && typeof E2 == "number" && (C2.children[E2] = v);
32923
+ $2 && typeof v == "number" && ($2.children[v] = E2);
32877
32924
  })();
32878
- g2.push($2);
32925
+ w.push(S);
32879
32926
  }
32880
- ), await Promise.all(g2);
32927
+ ), await Promise.all(w);
32881
32928
  };
32882
- }, m = (a, h, u = false, p2 = false, y = "") => () => (g2) => {
32883
- const w = [], E2 = [];
32884
- visit(g2, "heading", (v) => {
32885
- v.depth >= 1 && v.depth <= 6 && E2.push(v);
32929
+ }, u = (o2, f, d2 = false, m = false, y = "") => () => (w) => {
32930
+ const g2 = [], v = [];
32931
+ visit(w, "heading", (E2) => {
32932
+ E2.depth >= 1 && E2.depth <= 6 && v.push(E2);
32886
32933
  });
32887
- let C2 = [];
32888
- if (u) {
32889
- const v = E2.map((I2) => ({
32934
+ let $2 = [];
32935
+ if (d2) {
32936
+ const E2 = v.map((I2) => ({
32890
32937
  level: I2.depth,
32891
- text: D(I2)
32938
+ text: U(I2)
32892
32939
  }));
32893
- C2 = Ft(v);
32894
- }
32895
- const $2 = [];
32896
- E2.forEach((v, I2) => {
32897
- const O2 = D(v), N2 = v.data?.hProperties?.id;
32898
- let k2;
32899
- if (N2)
32900
- k2 = N2;
32901
- else if (u && p2) {
32902
- const b2 = Q(
32940
+ $2 = Nt(E2);
32941
+ }
32942
+ const S = [];
32943
+ v.forEach((E2, I2) => {
32944
+ const T = U(E2), F2 = E2.data?.hProperties?.id;
32945
+ let b2;
32946
+ if (F2)
32947
+ b2 = F2;
32948
+ else if (d2 && m) {
32949
+ const N2 = X(
32903
32950
  y,
32904
- O2,
32905
- () => h(O2)
32951
+ T,
32952
+ () => f(T)
32906
32953
  ).replace(`${y}-`, "");
32907
- for (; $2.length > 0; ) {
32908
- const S = $2[$2.length - 1];
32909
- if (S && S.level >= v.depth)
32910
- $2.pop();
32954
+ for (; S.length > 0; ) {
32955
+ const k2 = S[S.length - 1];
32956
+ if (k2 && k2.level >= E2.depth)
32957
+ S.pop();
32911
32958
  else
32912
32959
  break;
32913
32960
  }
32914
- const P2 = $2.map((S) => S.contentId);
32915
- k2 = P2.length > 0 ? `${y}-${P2.join("-")}-${b2}` : `${y}-${b2}`, $2.push({
32916
- level: v.depth,
32917
- contentId: b2
32961
+ const R2 = S.map((k2) => k2.contentId);
32962
+ b2 = R2.length > 0 ? `${y}-${R2.join("-")}-${N2}` : `${y}-${N2}`, S.push({
32963
+ level: E2.depth,
32964
+ contentId: N2
32918
32965
  });
32919
- } else if (u && I2 < C2.length) {
32920
- const b2 = C2[I2];
32921
- b2 ? k2 = Ht(
32966
+ } else if (d2 && I2 < $2.length) {
32967
+ const N2 = $2[I2];
32968
+ N2 ? b2 = It(
32922
32969
  y,
32923
- b2.numbers
32924
- ) : k2 = h(O2);
32970
+ N2.numbers
32971
+ ) : b2 = f(T);
32925
32972
  } else
32926
- k2 = h(O2);
32927
- v.data || (v.data = {}), v.data.hProperties || (v.data.hProperties = {}), N2 || (v.data.hProperties.id = k2), w.push({
32928
- level: v.depth,
32929
- text: O2,
32930
- id: k2
32973
+ b2 = f(T);
32974
+ E2.data || (E2.data = {}), E2.data.hProperties || (E2.data.hProperties = {}), F2 || (E2.data.hProperties.id = b2), g2.push({
32975
+ level: E2.depth,
32976
+ text: T,
32977
+ id: b2
32931
32978
  });
32932
32979
  });
32933
- const F2 = It(w);
32934
- a.push(...F2);
32935
- }, d2 = (a) => {
32980
+ const x2 = Lt(g2);
32981
+ o2.push(...x2);
32982
+ }, p2 = (o2) => {
32936
32983
  throw n.error(
32937
- `Failed to process markdown: ${a instanceof Error ? a.message : "Unknown error"}`
32984
+ `Failed to process markdown: ${o2 instanceof Error ? o2.message : "Unknown error"}`
32938
32985
  ), new Error(
32939
- `Failed to process markdown: ${a instanceof Error ? a.message : "Unknown error"}`
32986
+ `Failed to process markdown: ${o2 instanceof Error ? o2.message : "Unknown error"}`
32940
32987
  );
32941
- }, c = async (a, h, u, p2, y, g2) => {
32988
+ }, i = async (o2, f, d2, m, y, w) => {
32942
32989
  const {
32943
- signal: w,
32944
- useContentStringHeaderId: E2 = false,
32945
- useHierarchicalHeadingId: C2 = true,
32946
- advancedOptions: $2
32947
- } = u ?? {}, {
32948
- allowDangerousHtml: F2 = true,
32949
- htmlOptions: v = Ct,
32990
+ signal: g2,
32991
+ useContentStringHeaderId: v = false,
32992
+ useHierarchicalHeadingId: $2 = true,
32993
+ advancedOptions: S
32994
+ } = d2 ?? {}, {
32995
+ allowDangerousHtml: x2 = true,
32996
+ htmlOptions: E2 = Ot,
32950
32997
  gfmOptions: I2 = {},
32951
- remarkPlugins: O2 = [],
32952
- rehypePlugins: N2 = []
32953
- } = $2 || {}, k2 = [];
32954
- let b2 = 0;
32955
- const P2 = () => `${h}-${++b2}`;
32956
- let T = unified().use(remarkParse);
32957
- if (O2)
32958
- for (const x2 of O2)
32959
- Array.isArray(x2) ? T = T.use(x2[0], x2[1]) : T = T.use(x2);
32960
- let S = T.use(remarkGfm, I2).use($t).use(
32961
- m(
32962
- k2,
32963
- E2 ? (x2) => Q(h, x2, P2) : P2,
32964
- C2,
32965
- E2,
32966
- h
32998
+ remarkPlugins: T = [],
32999
+ rehypePlugins: F2 = []
33000
+ } = S || {}, b2 = [];
33001
+ let N2 = 0;
33002
+ const R2 = () => `${f}-${++N2}`;
33003
+ let C2 = unified().use(remarkParse);
33004
+ if (T)
33005
+ for (const H2 of T)
33006
+ Array.isArray(H2) ? C2 = C2.use(H2[0], H2[1]) : C2 = C2.use(H2);
33007
+ let k2 = C2.use(remarkGfm, I2).use(Ht).use(
33008
+ u(
33009
+ b2,
33010
+ v ? (H2) => X(f, H2, R2) : R2,
33011
+ $2,
33012
+ v,
33013
+ f
32967
33014
  )
32968
- ).use(f(p2, w, P2)).use(remarkRehype, { allowDangerousHtml: F2 }).use(St).use(rehypeStringify, { allowDangerousHtml: F2 });
32969
- if (N2)
32970
- for (const x2 of N2)
32971
- Array.isArray(x2) ? S = S.use(x2[0], x2[1]) : S = S.use(x2);
32972
- const A = await S.process(y), J2 = String(A);
33015
+ ).use(h(m, g2, R2)).use(remarkRehype, { allowDangerousHtml: x2 }).use(Ct).use(rehypeStringify, { allowDangerousHtml: x2 });
33016
+ if (F2)
33017
+ for (const H2 of F2)
33018
+ Array.isArray(H2) ? k2 = k2.use(H2[0], H2[1]) : k2 = k2.use(H2);
33019
+ const B2 = await k2.process(y), A = String(B2);
32973
33020
  return {
32974
- html: xt(J2, v),
32975
- frontmatter: p2,
32976
- changed: g2,
32977
- headingTree: k2,
32978
- composeMarkdown: () => g2 ? G(p2, y) : a,
32979
- uniqueIdPrefix: h
33021
+ html: Tt(A, E2),
33022
+ frontmatter: m,
33023
+ changed: w,
33024
+ headingTree: b2,
33025
+ composeMarkdown: () => w ? V(m, y) : o2,
33026
+ uniqueIdPrefix: f
32980
33027
  };
32981
33028
  };
32982
33029
  return {
32983
- process: async (a, h, u = {}) => {
33030
+ process: async (o2, f, d2 = {}) => {
32984
33031
  try {
32985
- const { data: p2, content: y } = W(a);
32986
- return await c(
32987
- a,
32988
- h,
32989
- u,
32990
- p2,
32991
- y,
32992
- false
33032
+ const { data: m, content: y } = Q(o2), w = d2.applyTitleFromH1 ?? true;
33033
+ let g2 = y, v = false, $2 = false;
33034
+ if (w) {
33035
+ const x2 = Z(g2, m, {
33036
+ allowTitleWrite: true
33037
+ });
33038
+ g2 = x2.content, v = x2.headingRemoved, $2 = x2.titleWritten;
33039
+ }
33040
+ return await i(
33041
+ o2,
33042
+ f,
33043
+ d2,
33044
+ m,
33045
+ g2,
33046
+ v || $2
32993
33047
  );
32994
- } catch (p2) {
32995
- return d2(p2);
33048
+ } catch (m) {
33049
+ return p2(m);
32996
33050
  }
32997
33051
  },
32998
- processWithFrontmatterTransform: async (a, h, u, p2, y = {}) => {
33052
+ processWithFrontmatterTransform: async (o2, f, d2, m, y = {}) => {
32999
33053
  try {
33000
- const { data: g2, content: w } = W(a), E2 = j(g2), $2 = u({
33001
- originalFrontmatter: g2,
33002
- markdownContent: w,
33003
- uniqueIdPrefix: h
33054
+ const { data: w, content: g2 } = Q(o2), v = M(w), S = d2({
33055
+ originalFrontmatter: w,
33056
+ markdownContent: g2,
33057
+ uniqueIdPrefix: f
33004
33058
  });
33005
- if ($2 === void 0)
33059
+ if (S === void 0)
33006
33060
  return;
33007
- const { frontmatter: F2, uniqueIdPrefix: v } = $2, I2 = v ?? h, N2 = (F2 === g2 ? E2 : j(F2)) !== E2, k2 = await c(
33008
- a,
33061
+ const { frontmatter: x2, uniqueIdPrefix: E2 } = S, I2 = E2 ?? f, T = y.applyTitleFromH1 ?? true;
33062
+ let F2 = g2, b2 = false;
33063
+ if (T) {
33064
+ const P2 = Z(F2, x2, {
33065
+ allowTitleWrite: true
33066
+ });
33067
+ F2 = P2.content, b2 = P2.headingRemoved || b2;
33068
+ }
33069
+ const R2 = M(x2) !== v || b2, C2 = await i(
33070
+ o2,
33009
33071
  I2,
33010
33072
  y,
33073
+ x2,
33011
33074
  F2,
33012
- w,
33013
- N2
33075
+ R2
33014
33076
  );
33015
- let b2 = k2.frontmatter;
33016
- if (p2) {
33017
- const A = {
33018
- frontmatter: b2,
33019
- headingTree: k2.headingTree
33077
+ let k2 = C2.frontmatter;
33078
+ if (m) {
33079
+ const P2 = {
33080
+ frontmatter: k2,
33081
+ headingTree: C2.headingTree
33020
33082
  };
33021
- b2 = p2(A);
33083
+ k2 = m(P2);
33022
33084
  }
33023
- const T = j(b2) !== E2, S = () => T ? G(b2, w) : a;
33085
+ const A = M(k2) !== v || b2, J2 = () => A ? V(k2, F2) : o2;
33024
33086
  return {
33025
- html: k2.html,
33026
- frontmatter: b2,
33027
- changed: T,
33028
- headingTree: k2.headingTree,
33029
- composeMarkdown: S,
33030
- uniqueIdPrefix: k2.uniqueIdPrefix
33087
+ html: C2.html,
33088
+ frontmatter: k2,
33089
+ changed: A,
33090
+ headingTree: C2.headingTree,
33091
+ composeMarkdown: J2,
33092
+ uniqueIdPrefix: C2.uniqueIdPrefix
33031
33093
  };
33032
- } catch (g2) {
33033
- return d2(g2);
33094
+ } catch (w) {
33095
+ return p2(w);
33034
33096
  }
33035
33097
  }
33036
33098
  };
33037
- }, Gt = (e, t = {}) => {
33038
- const { maxRedirects: n = 5, timeoutEachRedirect: o2 = 1e4 } = t;
33099
+ }, Vt = (e, t = {}) => {
33100
+ const { maxRedirects: n = 5, timeoutEachRedirect: a = 1e4 } = t;
33039
33101
  return {
33040
33102
  name: "oembed",
33041
- processBlock: async (s2, f) => {
33042
- const m = s2.trim();
33043
- if (!qd(m))
33044
- throw new Error(`Invalid URL: ${m}`);
33103
+ processBlock: async (s2, h) => {
33104
+ const u = s2.trim();
33105
+ if (!qd(u))
33106
+ throw new Error(`Invalid URL: ${u}`);
33045
33107
  try {
33046
- const d2 = await Gd(
33047
- m,
33108
+ const p2 = await Gd(
33109
+ u,
33048
33110
  n,
33049
- o2,
33050
- f,
33111
+ a,
33112
+ h,
33051
33113
  e
33052
33114
  );
33053
- return Wd(d2, m, t);
33054
- } catch (d2) {
33055
- f.logger.warn("oEmbed fetch failed for URL:", m, d2);
33056
- const c = Vd(d2);
33057
- return typeof window < "u" ? Xs(m, c) : Xs(m, c);
33115
+ return Wd(p2, u, t);
33116
+ } catch (p2) {
33117
+ h.logger.warn("oEmbed fetch failed for URL:", u, p2);
33118
+ const i = Vd(p2);
33119
+ return typeof window < "u" ? Xs(u, i) : Xs(u, i);
33058
33120
  }
33059
33121
  }
33060
33122
  };
33061
- }, Qt = (e = {}) => ({
33123
+ }, Zt = (e = {}) => ({
33062
33124
  name: "card",
33063
- processBlock: async (n, o2) => {
33125
+ processBlock: async (n, a) => {
33064
33126
  const r = n.trim();
33065
33127
  if (!Xd(r))
33066
33128
  throw new Error(`Invalid URL: ${r}`);
33067
33129
  try {
33068
- const s2 = await Jd(r, e, o2);
33130
+ const s2 = await Jd(r, e, a);
33069
33131
  return th(s2, r, e);
33070
33132
  } catch (s2) {
33071
- o2.logger.warn("Card plugin fetch failed for URL:", r, s2);
33072
- const f = Vd(s2);
33073
- return typeof window < "u" ? eh(r, f) : eh(r, f);
33133
+ a.logger.warn("Card plugin fetch failed for URL:", r, s2);
33134
+ const h = Vd(s2);
33135
+ return typeof window < "u" ? eh(r, h) : eh(r, h);
33074
33136
  }
33075
33137
  }
33076
- }), Vt = (e = {}) => {
33138
+ }), Xt = (e = {}) => {
33077
33139
  const { className: t = "mermaid", includeId: n = true } = e;
33078
33140
  return {
33079
33141
  name: "mermaid",
33080
33142
  processBlock: async (r, s2) => {
33081
- const f = r.trim();
33082
- if (!f) {
33143
+ const h = r.trim();
33144
+ if (!h) {
33083
33145
  s2.logger.warn("Mermaid plugin received empty content");
33084
- const l2 = n ? ` id="${s2.getUniqueId()}"` : "";
33146
+ const c = n ? ` id="${s2.getUniqueId()}"` : "";
33085
33147
  return `<div class="${t}-wrapper">
33086
33148
  <style>
33087
33149
  .${t}-wrapper .${t} > svg {
@@ -33090,10 +33152,10 @@ const _ = () => {
33090
33152
  max-width: none !important;
33091
33153
  }
33092
33154
  </style>
33093
- <div class="${t}"${l2}><!-- Empty mermaid content --></div>
33155
+ <div class="${t}"${c}><!-- Empty mermaid content --></div>
33094
33156
  </div>`;
33095
33157
  }
33096
- const m = n ? ` id="${s2.getUniqueId()}"` : "", d2 = f.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), c = `<div class="${t}-wrapper">
33158
+ const u = n ? ` id="${s2.getUniqueId()}"` : "", p2 = h.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), i = `<div class="${t}-wrapper">
33097
33159
  <style>
33098
33160
  .${t}-wrapper .${t} > svg {
33099
33161
  width: auto !important;
@@ -33101,39 +33163,39 @@ const _ = () => {
33101
33163
  max-width: none !important;
33102
33164
  }
33103
33165
  </style>
33104
- <div class="${t}"${m}>${d2}</div>
33166
+ <div class="${t}"${u}>${p2}</div>
33105
33167
  </div>`;
33106
33168
  return s2.logger.debug("Mermaid plugin processed content:", {
33107
- contentLength: f.length,
33169
+ contentLength: h.length,
33108
33170
  className: t,
33109
33171
  includeId: n
33110
- }), c;
33172
+ }), i;
33111
33173
  }
33112
33174
  };
33113
33175
  };
33114
33176
  /*!
33115
33177
  * name: async-primitives
33116
- * version: 1.2.0
33178
+ * version: 1.4.0
33117
33179
  * description: A collection of primitive functions for asynchronous operations
33118
33180
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
33119
33181
  * license: MIT
33120
33182
  * repository.url: https://github.com/kekyo/async-primitives.git
33121
- * git.commit.hash: 3b7bffeaa8ae47aea6e8b0ef0f70e265a6d9ab08
33183
+ * git.commit.hash: 147b7bee11bf17823a185e0492d7f73587748715
33122
33184
  */
33123
- const V = () => {
33124
- }, Z = {
33125
- release: V,
33126
- [Symbol.dispose]: V
33127
- }, Ot = (e, t) => {
33185
+ const Y = () => {
33186
+ }, tt = {
33187
+ release: Y,
33188
+ [Symbol.dispose]: Y
33189
+ }, Rt = (e, t) => {
33128
33190
  if (!e)
33129
- return Z;
33191
+ return tt;
33130
33192
  if (e.aborted) {
33131
33193
  try {
33132
33194
  t();
33133
33195
  } catch (s2) {
33134
33196
  console.warn("AbortHook callback error: ", s2);
33135
33197
  }
33136
- return Z;
33198
+ return tt;
33137
33199
  }
33138
33200
  let n;
33139
33201
  n = () => {
@@ -33146,16 +33208,16 @@ const V = () => {
33146
33208
  }
33147
33209
  }
33148
33210
  };
33149
- const o2 = () => {
33211
+ const a = () => {
33150
33212
  n && (e.removeEventListener("abort", n), n = void 0);
33151
33213
  };
33152
33214
  return e.addEventListener("abort", n, { once: true }), {
33153
- release: o2,
33154
- [Symbol.dispose]: o2
33215
+ release: a,
33216
+ [Symbol.dispose]: a
33155
33217
  };
33156
- }, Tt = (e) => {
33218
+ }, Pt = (e) => {
33157
33219
  typeof setImmediate == "function" ? setImmediate(e) : setTimeout(e, 0);
33158
- }, U = () => new Error("Lock acquisition was aborted"), Lt = (e) => {
33220
+ }, q = () => new Error("Lock acquisition was aborted"), At = (e) => {
33159
33221
  let t = true;
33160
33222
  const n = () => {
33161
33223
  t && (t = false, e());
@@ -33170,56 +33232,56 @@ const V = () => {
33170
33232
  }, z = (e = 20) => {
33171
33233
  let t = false;
33172
33234
  const n = [];
33173
- let o2 = 0;
33235
+ let a = 0;
33174
33236
  const r = () => {
33175
- var l2;
33237
+ var c;
33176
33238
  if (t || n.length === 0)
33177
33239
  return;
33178
- const i = n.shift();
33179
- if ((l2 = i.signal) != null && l2.aborted) {
33180
- i.reject(U()), s2();
33240
+ const l2 = n.shift();
33241
+ if ((c = l2.signal) != null && c.aborted) {
33242
+ l2.reject(q()), s2();
33181
33243
  return;
33182
33244
  }
33183
33245
  t = true;
33184
- const a = Lt(f);
33185
- i.resolve(a);
33246
+ const o2 = At(h);
33247
+ l2.resolve(o2);
33186
33248
  }, s2 = () => {
33187
- o2++, o2 >= e ? (o2 = 0, Tt(r)) : r();
33188
- }, f = () => {
33249
+ a++, a >= e ? (a = 0, Pt(r)) : r();
33250
+ }, h = () => {
33189
33251
  t && (t = false, s2());
33190
- }, m = (l2) => {
33191
- const i = n.indexOf(l2);
33192
- i !== -1 && n.splice(i, 1);
33193
- }, d2 = async (l2) => {
33194
- if (l2) {
33195
- if (l2.aborted)
33196
- throw U();
33197
- return new Promise((i, a) => {
33198
- const h = {
33252
+ }, u = (c) => {
33253
+ const l2 = n.indexOf(c);
33254
+ l2 !== -1 && n.splice(l2, 1);
33255
+ }, p2 = async (c) => {
33256
+ if (c) {
33257
+ if (c.aborted)
33258
+ throw q();
33259
+ return new Promise((l2, o2) => {
33260
+ const f = {
33199
33261
  resolve: void 0,
33200
33262
  reject: void 0,
33201
- signal: l2
33202
- }, u = Ot(l2, () => {
33203
- m(h), a(U());
33263
+ signal: c
33264
+ }, d2 = Rt(c, () => {
33265
+ u(f), o2(q());
33204
33266
  });
33205
- h.resolve = (p2) => {
33206
- u.release(), i(p2);
33207
- }, h.reject = (p2) => {
33208
- u.release(), a(p2);
33209
- }, n.push(h), r();
33267
+ f.resolve = (m) => {
33268
+ d2.release(), l2(m);
33269
+ }, f.reject = (m) => {
33270
+ d2.release(), o2(m);
33271
+ }, n.push(f), r();
33210
33272
  });
33211
33273
  } else
33212
- return new Promise((i, a) => {
33274
+ return new Promise((l2, o2) => {
33213
33275
  n.push({
33214
- resolve: i,
33215
- reject: a
33276
+ resolve: l2,
33277
+ reject: o2
33216
33278
  }), r();
33217
33279
  });
33218
33280
  };
33219
33281
  return {
33220
- lock: d2,
33282
+ lock: p2,
33221
33283
  waiter: {
33222
- wait: d2
33284
+ wait: p2
33223
33285
  },
33224
33286
  get isLocked() {
33225
33287
  return t;
@@ -33228,196 +33290,196 @@ const V = () => {
33228
33290
  return n.length;
33229
33291
  }
33230
33292
  };
33231
- }, Nt = () => {
33232
- const e = /* @__PURE__ */ new Map(), t = z(), n = (d2 = Date.now()) => {
33233
- const c = [];
33234
- for (const [l2, i] of e.entries())
33235
- i.ttl !== void 0 && (i.ttl === 0 || d2 > i.timestamp + i.ttl) && c.push(l2);
33236
- for (const l2 of c)
33237
- e.delete(l2);
33238
- return c;
33293
+ }, _t = () => {
33294
+ const e = /* @__PURE__ */ new Map(), t = z(), n = (p2 = Date.now()) => {
33295
+ const i = [];
33296
+ for (const [c, l2] of e.entries())
33297
+ l2.ttl !== void 0 && (l2.ttl === 0 || p2 > l2.timestamp + l2.ttl) && i.push(c);
33298
+ for (const c of i)
33299
+ e.delete(c);
33300
+ return i;
33239
33301
  };
33240
33302
  return {
33241
- get: async (d2) => {
33242
- const c = e.get(d2);
33243
- if (!c)
33303
+ get: async (p2) => {
33304
+ const i = e.get(p2);
33305
+ if (!i)
33244
33306
  return null;
33245
- if (c.ttl !== void 0 && (c.ttl === 0 || Date.now() > c.timestamp + c.ttl)) {
33246
- const i = await t.lock();
33307
+ if (i.ttl !== void 0 && (i.ttl === 0 || Date.now() > i.timestamp + i.ttl)) {
33308
+ const l2 = await t.lock();
33247
33309
  try {
33248
- const a = e.get(d2);
33249
- if (a && a.ttl !== void 0) {
33250
- const h = Date.now();
33251
- (a.ttl === 0 || h > a.timestamp + a.ttl) && e.delete(d2);
33310
+ const o2 = e.get(p2);
33311
+ if (o2 && o2.ttl !== void 0) {
33312
+ const f = Date.now();
33313
+ (o2.ttl === 0 || f > o2.timestamp + o2.ttl) && e.delete(p2);
33252
33314
  }
33253
33315
  return null;
33254
33316
  } finally {
33255
- i.release();
33317
+ l2.release();
33256
33318
  }
33257
33319
  }
33258
- return c.data;
33320
+ return i.data;
33259
33321
  },
33260
- set: async (d2, c, l2) => {
33261
- const i = {
33262
- data: c,
33322
+ set: async (p2, i, c) => {
33323
+ const l2 = {
33324
+ data: i,
33263
33325
  timestamp: Date.now()
33264
33326
  };
33265
- l2 !== void 0 && (i.ttl = l2);
33266
- const a = await t.lock();
33327
+ c !== void 0 && (l2.ttl = c);
33328
+ const o2 = await t.lock();
33267
33329
  try {
33268
- e.set(d2, i);
33330
+ e.set(p2, l2);
33269
33331
  } finally {
33270
- a.release();
33332
+ o2.release();
33271
33333
  }
33272
33334
  },
33273
- delete: async (d2) => {
33274
- const c = await t.lock();
33335
+ delete: async (p2) => {
33336
+ const i = await t.lock();
33275
33337
  try {
33276
- e.delete(d2);
33338
+ e.delete(p2);
33277
33339
  } finally {
33278
- c.release();
33340
+ i.release();
33279
33341
  }
33280
33342
  },
33281
33343
  clear: async () => {
33282
- const d2 = await t.lock();
33344
+ const p2 = await t.lock();
33283
33345
  try {
33284
33346
  e.clear();
33285
33347
  } finally {
33286
- d2.release();
33348
+ p2.release();
33287
33349
  }
33288
33350
  },
33289
33351
  size: async () => {
33290
33352
  if (Array.from(e.entries()).length === 0)
33291
33353
  return 0;
33292
- const c = await t.lock();
33354
+ const i = await t.lock();
33293
33355
  try {
33294
33356
  return n(), e.size;
33295
33357
  } finally {
33296
- c.release();
33358
+ i.release();
33297
33359
  }
33298
33360
  }
33299
33361
  };
33300
33362
  };
33301
- function M(e, t, n) {
33363
+ function D(e, t, n) {
33302
33364
  return `fetch:${e}:${t}:${n}`;
33303
33365
  }
33304
- const Yt = (e, t = 6e4, n, o2) => {
33366
+ const ee = (e, t = 6e4, n, a) => {
33305
33367
  const {
33306
33368
  cache: r = true,
33307
33369
  cacheTTL: s2 = 3600 * 1e3,
33308
33370
  // 1 hour default
33309
- cacheFailures: f = true,
33310
- failureCacheTTL: m = 300 * 1e3
33371
+ cacheFailures: h = true,
33372
+ failureCacheTTL: u = 300 * 1e3
33311
33373
  // 5 minutes default for failures
33312
- } = {}, d2 = r ? n || Nt() : void 0;
33374
+ } = {}, p2 = r ? n || _t() : void 0;
33313
33375
  return {
33314
- rawFetcher: async (l2, i, a, h) => {
33315
- if (r && d2) {
33316
- const y = M(l2, i, e), g2 = await d2.get(y);
33317
- if (g2)
33376
+ rawFetcher: async (c, l2, o2, f) => {
33377
+ if (r && p2) {
33378
+ const y = D(c, l2, e), w = await p2.get(y);
33379
+ if (w)
33318
33380
  try {
33319
- const w = JSON.parse(g2);
33320
- if (w.type === "success")
33321
- return h?.info(`Cache HIT (success) for URL: ${l2}`), new Response(w.data, {
33381
+ const g2 = JSON.parse(w);
33382
+ if (g2.type === "success")
33383
+ return f?.info(`Cache HIT (success) for URL: ${c}`), new Response(g2.data, {
33322
33384
  status: 200,
33323
33385
  statusText: "OK",
33324
33386
  headers: {
33325
- "Content-Type": i,
33387
+ "Content-Type": l2,
33326
33388
  "X-Cache": "HIT"
33327
33389
  }
33328
33390
  });
33329
- if (w.type === "error" && f)
33330
- throw h?.info(`Cache HIT (error) for URL: ${l2}`), new Error("Cached error");
33331
- h?.debug(
33332
- `Cache entry type ${w.type} not eligible for use, cacheFailures: ${f}`
33391
+ if (g2.type === "error" && h)
33392
+ throw f?.info(`Cache HIT (error) for URL: ${c}`), new Error("Cached error");
33393
+ f?.debug(
33394
+ `Cache entry type ${g2.type} not eligible for use, cacheFailures: ${h}`
33333
33395
  );
33334
- } catch (w) {
33335
- if (h?.warn(
33336
- `Failed to parse cached entry for URL ${l2}:`,
33337
- w
33338
- ), w instanceof SyntaxError)
33339
- h?.debug("JSON parse error, continuing to network fetch");
33396
+ } catch (g2) {
33397
+ if (f?.warn(
33398
+ `Failed to parse cached entry for URL ${c}:`,
33399
+ g2
33400
+ ), g2 instanceof SyntaxError)
33401
+ f?.debug("JSON parse error, continuing to network fetch");
33340
33402
  else
33341
- throw w;
33403
+ throw g2;
33342
33404
  }
33343
33405
  else
33344
- h?.info(`Cache MISS for URL: ${l2}`);
33406
+ f?.info(`Cache MISS for URL: ${c}`);
33345
33407
  }
33346
- let u, p2 = null;
33408
+ let d2, m = null;
33347
33409
  try {
33348
- u = await Yd(
33410
+ d2 = await Yd(
33411
+ c,
33349
33412
  l2,
33350
- i,
33351
33413
  e,
33352
33414
  t,
33353
- a,
33354
- h
33415
+ o2,
33416
+ f
33355
33417
  );
33356
33418
  } catch (y) {
33357
- if (p2 = y, r && d2 && f)
33419
+ if (m = y, r && p2 && h)
33358
33420
  try {
33359
- const g2 = M(l2, i, e), w = {
33421
+ const w = D(c, l2, e), g2 = {
33360
33422
  type: "error",
33361
33423
  data: "",
33362
33424
  error: {
33363
- message: p2.message,
33364
- ...p2.message.includes("HTTP error, status:") && {
33425
+ message: m.message,
33426
+ ...m.message.includes("HTTP error, status:") && {
33365
33427
  status: parseInt(
33366
- p2.message.match(/status: (\d+)/)?.[1] || "0"
33428
+ m.message.match(/status: (\d+)/)?.[1] || "0"
33367
33429
  )
33368
33430
  }
33369
33431
  },
33370
33432
  timestamp: Date.now()
33371
33433
  };
33372
- await d2.set(
33373
- g2,
33374
- JSON.stringify(w),
33375
- m
33376
- ), h?.debug(`Cached error for URL: ${l2}`);
33377
- } catch (g2) {
33378
- h?.warn(`Failed to cache error for URL ${l2}:`, g2), console.warn("Failed to cache error:", g2);
33434
+ await p2.set(
33435
+ w,
33436
+ JSON.stringify(g2),
33437
+ u
33438
+ ), f?.debug(`Cached error for URL: ${c}`);
33439
+ } catch (w) {
33440
+ f?.warn(`Failed to cache error for URL ${c}:`, w), console.warn("Failed to cache error:", w);
33379
33441
  }
33380
- throw p2;
33442
+ throw m;
33381
33443
  }
33382
- if (r && d2 && u.ok)
33444
+ if (r && p2 && d2.ok)
33383
33445
  try {
33384
- const y = await u.clone().text(), g2 = M(l2, i, e), w = {
33446
+ const y = await d2.clone().text(), w = D(c, l2, e), g2 = {
33385
33447
  type: "success",
33386
33448
  data: y,
33387
33449
  timestamp: Date.now()
33388
33450
  };
33389
- await d2.set(
33390
- g2,
33391
- JSON.stringify(w),
33451
+ await p2.set(
33452
+ w,
33453
+ JSON.stringify(g2),
33392
33454
  s2
33393
- ), h?.debug(`Cached successful response for URL: ${l2}`);
33455
+ ), f?.debug(`Cached successful response for URL: ${c}`);
33394
33456
  } catch (y) {
33395
- h?.warn(`Failed to cache response for URL ${l2}:`, y), console.warn("Failed to cache response:", y);
33457
+ f?.warn(`Failed to cache response for URL ${c}:`, y), console.warn("Failed to cache response:", y);
33396
33458
  }
33397
- return u;
33459
+ return d2;
33398
33460
  },
33399
33461
  userAgent: e
33400
33462
  };
33401
33463
  };
33402
33464
  function setupProcessor(config) {
33403
33465
  const plugins = [];
33404
- const logger = Kt();
33405
- const fetcher = Yt(
33466
+ const logger = Gt();
33467
+ const fetcher = ee(
33406
33468
  "mark-deco-cli/0.0.1",
33407
33469
  5e3,
33408
- Nt()
33470
+ _t()
33409
33471
  );
33410
33472
  const enabledPlugins = config.noPlugins ? [] : Array.isArray(config.plugins) ? config.plugins : ["oembed", "card", "mermaid"];
33411
33473
  if (enabledPlugins.includes("oembed") && config.oembed?.enabled !== false) {
33412
- plugins.push(Gt($d, {}));
33474
+ plugins.push(Vt($d, {}));
33413
33475
  }
33414
33476
  if (enabledPlugins.includes("card") && config.card?.enabled !== false) {
33415
- plugins.push(Qt({}));
33477
+ plugins.push(Zt({}));
33416
33478
  }
33417
33479
  if (enabledPlugins.includes("mermaid") && config.mermaid?.enabled !== false) {
33418
- plugins.push(Vt({}));
33480
+ plugins.push(Xt({}));
33419
33481
  }
33420
- return Wt({
33482
+ return Qt({
33421
33483
  plugins,
33422
33484
  logger,
33423
33485
  fetcher
@@ -33452,6 +33514,11 @@ async function main() {
33452
33514
  "--content-based-heading-id",
33453
33515
  "Use content-based heading IDs"
33454
33516
  ).default(false)
33517
+ ).addOption(
33518
+ new commander.Option(
33519
+ "--no-apply-title-from-h1",
33520
+ "Disable applying the first H1 to frontmatter.title"
33521
+ )
33455
33522
  ).addOption(
33456
33523
  new commander.Option(
33457
33524
  "--frontmatter-output <file>",
@@ -33469,12 +33536,14 @@ async function main() {
33469
33536
  const mergedOptions = { ...config, ...options2 };
33470
33537
  const markdown = await readInput(options2.input);
33471
33538
  const processor = setupProcessor(mergedOptions);
33539
+ const applyTitleFromH1 = options2.applyTitleFromH1 ?? config.applyTitleFromH1 ?? true;
33472
33540
  const result = await processor.process(
33473
33541
  markdown,
33474
33542
  options2.uniqueIdPrefix || "section",
33475
33543
  {
33476
33544
  useHierarchicalHeadingId: options2.hierarchicalHeadingId ?? true,
33477
- useContentStringHeaderId: options2.contentBasedHeadingId ?? false
33545
+ useContentStringHeaderId: options2.contentBasedHeadingId ?? false,
33546
+ applyTitleFromH1
33478
33547
  }
33479
33548
  );
33480
33549
  await writeOutput(result.html, options2.output);