mark-deco-cli 0.12.0 → 0.13.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
@@ -2,12 +2,12 @@
2
2
  "use strict";
3
3
  /*!
4
4
  * name: mark-deco-cli
5
- * version: 0.12.0
5
+ * version: 0.13.0
6
6
  * description: Command-line interface for mark-deco Markdown to HTML conversion processor
7
7
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
8
8
  * license: MIT
9
9
  * repository.url: https://github.com/kekyo/mark-deco.git
10
- * git.commit.hash: aff53ffd52269533e39dd1090efe8b582e087d53
10
+ * git.commit.hash: a57a326430fda951da873116177f76aa783d4413
11
11
  */
12
12
  const commander = require("commander");
13
13
  const promises = require("fs/promises");
@@ -4338,7 +4338,7 @@ function requireJs() {
4338
4338
  return js$1.exports;
4339
4339
  }
4340
4340
  var jsExports = requireJs();
4341
- const ot$1 = /* @__PURE__ */ getDefaultExportFromCjs(jsExports);
4341
+ const at$1 = /* @__PURE__ */ getDefaultExportFromCjs(jsExports);
4342
4342
  const htmlVoidElements = [
4343
4343
  "area",
4344
4344
  "base",
@@ -6082,12 +6082,12 @@ function stringify$1(values, options2) {
6082
6082
  function stringify(values) {
6083
6083
  return values.join(" ").trim();
6084
6084
  }
6085
- const re$1 = /[ \t\n\f\r]/g;
6085
+ const re$2 = /[ \t\n\f\r]/g;
6086
6086
  function whitespace(thing) {
6087
6087
  return typeof thing === "object" ? thing.type === "text" ? empty$1(thing.value) : false : empty$1(thing);
6088
6088
  }
6089
6089
  function empty$1(value) {
6090
- return value.replace(re$1, "") === "";
6090
+ return value.replace(re$2, "") === "";
6091
6091
  }
6092
6092
  const siblingAfter = siblings(1);
6093
6093
  const siblingBefore = siblings(-1);
@@ -21417,12 +21417,12 @@ var load = loader.load;
21417
21417
  var dump = dumper.dump;
21418
21418
  /*!
21419
21419
  * name: mark-deco
21420
- * version: 0.12.0
21420
+ * version: 0.13.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: aff53ffd52269533e39dd1090efe8b582e087d53
21425
+ * git.commit.hash: a57a326430fda951da873116177f76aa783d4413
21426
21426
  */
21427
21427
  const qd = (e) => {
21428
21428
  try {
@@ -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, ee2) => M2.order - ee2.order), w = [], v = [];
21776
+ const A = T.sort((M2, ee) => M2.order - ee.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
  });
@@ -21910,14 +21910,14 @@ const Gd = async (e, t, u, r, a) => {
21910
21910
  } else
21911
21911
  return `<div class="oembed-responsive-content">${e}</div>`;
21912
21912
  };
21913
- var L$1;
21913
+ var L;
21914
21914
  (function(e) {
21915
21915
  e.Root = "root", e.Text = "text", e.Directive = "directive", e.Comment = "comment", e.Script = "script", e.Style = "style", e.Tag = "tag", e.CDATA = "cdata", e.Doctype = "doctype";
21916
- })(L$1 || (L$1 = {}));
21916
+ })(L || (L = {}));
21917
21917
  function aa(e) {
21918
- return e.type === L$1.Tag || e.type === L$1.Script || e.type === L$1.Style;
21918
+ return e.type === L.Tag || e.type === L.Script || e.type === L.Style;
21919
21919
  }
21920
- const cu = L$1.Root, gr = L$1.Text, ia = L$1.Directive, Ar = L$1.Comment, na = L$1.Script, oa = L$1.Style, zt = L$1.Tag, ca = L$1.CDATA, da = L$1.Doctype;
21920
+ const cu = L.Root, gr = L.Text, ia = L.Directive, Ar = L.Comment, na = L.Script, oa = L.Style, zt = L.Tag, ca = L.CDATA, da = L.Doctype;
21921
21921
  class vr {
21922
21922
  constructor() {
21923
21923
  this.parent = null, this.prev = null, this.next = null, this.startIndex = null, this.endIndex = null;
@@ -21983,7 +21983,7 @@ class du extends vr {
21983
21983
  }
21984
21984
  class We extends du {
21985
21985
  constructor() {
21986
- super(...arguments), this.type = L$1.Text;
21986
+ super(...arguments), this.type = L.Text;
21987
21987
  }
21988
21988
  get nodeType() {
21989
21989
  return 3;
@@ -21991,7 +21991,7 @@ class We extends du {
21991
21991
  }
21992
21992
  class hu extends du {
21993
21993
  constructor() {
21994
- super(...arguments), this.type = L$1.Comment;
21994
+ super(...arguments), this.type = L.Comment;
21995
21995
  }
21996
21996
  get nodeType() {
21997
21997
  return 8;
@@ -21999,7 +21999,7 @@ class hu extends du {
21999
21999
  }
22000
22000
  class lu extends du {
22001
22001
  constructor(t, u) {
22002
- super(u), this.name = t, this.type = L$1.Directive;
22002
+ super(u), this.name = t, this.type = L.Directive;
22003
22003
  }
22004
22004
  get nodeType() {
22005
22005
  return 1;
@@ -22035,7 +22035,7 @@ class mu extends vr {
22035
22035
  }
22036
22036
  class wr extends mu {
22037
22037
  constructor() {
22038
- super(...arguments), this.type = L$1.CDATA;
22038
+ super(...arguments), this.type = L.CDATA;
22039
22039
  }
22040
22040
  get nodeType() {
22041
22041
  return 4;
@@ -22043,7 +22043,7 @@ class wr extends mu {
22043
22043
  }
22044
22044
  class Ne extends mu {
22045
22045
  constructor() {
22046
- super(...arguments), this.type = L$1.Root;
22046
+ super(...arguments), this.type = L.Root;
22047
22047
  }
22048
22048
  get nodeType() {
22049
22049
  return 9;
@@ -22055,7 +22055,7 @@ class pu extends mu {
22055
22055
  * @param attribs Object mapping attribute names to attribute values.
22056
22056
  * @param children Children of the node.
22057
22057
  */
22058
- constructor(t, u, r = [], a = t === "script" ? L$1.Script : t === "style" ? L$1.Style : L$1.Tag) {
22058
+ constructor(t, u, r = [], a = t === "script" ? L.Script : t === "style" ? L.Style : L.Tag) {
22059
22059
  super(r), this.name = t, this.attribs = u, this.type = a;
22060
22060
  }
22061
22061
  get nodeType() {
@@ -22088,19 +22088,19 @@ function I(e) {
22088
22088
  return aa(e);
22089
22089
  }
22090
22090
  function wt(e) {
22091
- return e.type === L$1.CDATA;
22091
+ return e.type === L.CDATA;
22092
22092
  }
22093
22093
  function se(e) {
22094
- return e.type === L$1.Text;
22094
+ return e.type === L.Text;
22095
22095
  }
22096
22096
  function Nt$1(e) {
22097
- return e.type === L$1.Comment;
22097
+ return e.type === L.Comment;
22098
22098
  }
22099
22099
  function Qt$1(e) {
22100
- return e.type === L$1.Directive;
22100
+ return e.type === L.Directive;
22101
22101
  }
22102
22102
  function Te(e) {
22103
- return e.type === L$1.Root;
22103
+ return e.type === L.Root;
22104
22104
  }
22105
22105
  function B(e) {
22106
22106
  return Object.prototype.hasOwnProperty.call(e, "children");
@@ -22167,12 +22167,12 @@ class ha {
22167
22167
  this.options.withEndIndices && (t.endIndex = this.parser.endIndex), this.elementCB && this.elementCB(t);
22168
22168
  }
22169
22169
  onopentag(t, u) {
22170
- const r = this.options.xmlMode ? L$1.Tag : void 0, a = new pu(t, u, void 0, r);
22170
+ const r = this.options.xmlMode ? L.Tag : void 0, a = new pu(t, u, void 0, r);
22171
22171
  this.addNode(a), this.tagStack.push(a);
22172
22172
  }
22173
22173
  ontext(t) {
22174
22174
  const { lastNode: u } = this;
22175
- if (u && u.type === L$1.Text)
22175
+ if (u && u.type === L.Text)
22176
22176
  u.data += t, this.options.withEndIndices && (u.endIndex = this.parser.endIndex);
22177
22177
  else {
22178
22178
  const r = new We(t);
@@ -22180,7 +22180,7 @@ class ha {
22180
22180
  }
22181
22181
  }
22182
22182
  oncomment(t) {
22183
- if (this.lastNode && this.lastNode.type === L$1.Comment) {
22183
+ if (this.lastNode && this.lastNode.type === L.Comment) {
22184
22184
  this.lastNode.data += t;
22185
22185
  return;
22186
22186
  }
@@ -22472,7 +22472,7 @@ 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(e)) ? dt(e.children) : se(e) ? e.data : "";
22475
+ return Array.isArray(e) ? e.map(dt).join("") : B(e) && (e.type === L.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 : [];
@@ -23246,10 +23246,10 @@ function st(e) {
23246
23246
  function gi(e) {
23247
23247
  return e >= x.LowerA && e <= x.LowerZ || e >= x.UpperA && e <= x.UpperZ;
23248
23248
  }
23249
- var re;
23249
+ var re$1;
23250
23250
  (function(e) {
23251
23251
  e[e.NoValue = 0] = "NoValue", e[e.Unquoted = 1] = "Unquoted", e[e.Single = 2] = "Single", e[e.Double = 3] = "Double";
23252
- })(re || (re = {}));
23252
+ })(re$1 || (re$1 = {}));
23253
23253
  const F = {
23254
23254
  Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
23255
23255
  // CDATA[
@@ -23403,13 +23403,13 @@ let Ai = class {
23403
23403
  (t === x.Eq || st(t)) && (this.cbs.onattribname(this.sectionStart, this.index), this.sectionStart = this.index, this.state = _$1.AfterAttributeName, this.stateAfterAttributeName(t));
23404
23404
  }
23405
23405
  stateAfterAttributeName(t) {
23406
- t === x.Eq ? this.state = _$1.BeforeAttributeValue : t === x.Slash || t === x.Gt ? (this.cbs.onattribend(re.NoValue, this.sectionStart), this.sectionStart = -1, this.state = _$1.BeforeAttributeName, this.stateBeforeAttributeName(t)) : ne(t) || (this.cbs.onattribend(re.NoValue, this.sectionStart), this.state = _$1.InAttributeName, this.sectionStart = this.index);
23406
+ t === x.Eq ? this.state = _$1.BeforeAttributeValue : t === x.Slash || t === x.Gt ? (this.cbs.onattribend(re$1.NoValue, this.sectionStart), this.sectionStart = -1, this.state = _$1.BeforeAttributeName, this.stateBeforeAttributeName(t)) : ne(t) || (this.cbs.onattribend(re$1.NoValue, this.sectionStart), this.state = _$1.InAttributeName, this.sectionStart = this.index);
23407
23407
  }
23408
23408
  stateBeforeAttributeValue(t) {
23409
23409
  t === x.DoubleQuote ? (this.state = _$1.InAttributeValueDq, this.sectionStart = this.index + 1) : t === x.SingleQuote ? (this.state = _$1.InAttributeValueSq, this.sectionStart = this.index + 1) : ne(t) || (this.sectionStart = this.index, this.state = _$1.InAttributeValueNq, this.stateInAttributeValueNoQuotes(t));
23410
23410
  }
23411
23411
  handleInAttributeValue(t, u) {
23412
- t === u || !this.decodeEntities && this.fastForwardTo(u) ? (this.cbs.onattribdata(this.sectionStart, this.index), this.sectionStart = -1, this.cbs.onattribend(u === x.DoubleQuote ? re.Double : re.Single, this.index + 1), this.state = _$1.BeforeAttributeName) : this.decodeEntities && t === x.Amp && this.startEntity();
23412
+ t === u || !this.decodeEntities && this.fastForwardTo(u) ? (this.cbs.onattribdata(this.sectionStart, this.index), this.sectionStart = -1, this.cbs.onattribend(u === x.DoubleQuote ? re$1.Double : re$1.Single, this.index + 1), this.state = _$1.BeforeAttributeName) : this.decodeEntities && t === x.Amp && this.startEntity();
23413
23413
  }
23414
23414
  stateInAttributeValueDoubleQuotes(t) {
23415
23415
  this.handleInAttributeValue(t, x.DoubleQuote);
@@ -23418,7 +23418,7 @@ let Ai = class {
23418
23418
  this.handleInAttributeValue(t, x.SingleQuote);
23419
23419
  }
23420
23420
  stateInAttributeValueNoQuotes(t) {
23421
- ne(t) || t === x.Gt ? (this.cbs.onattribdata(this.sectionStart, this.index), this.sectionStart = -1, this.cbs.onattribend(re.Unquoted, this.index), this.state = _$1.BeforeAttributeName, this.stateBeforeAttributeName(t)) : this.decodeEntities && t === x.Amp && this.startEntity();
23421
+ ne(t) || t === x.Gt ? (this.cbs.onattribdata(this.sectionStart, this.index), this.sectionStart = -1, this.cbs.onattribend(re$1.Unquoted, this.index), this.state = _$1.BeforeAttributeName, this.stateBeforeAttributeName(t)) : this.decodeEntities && t === x.Amp && this.startEntity();
23422
23422
  }
23423
23423
  stateBeforeDeclaration(t) {
23424
23424
  t === x.OpeningSquareBracket ? (this.state = _$1.CDATASequence, this.sequenceIndex = 0) : this.state = t === x.Dash ? _$1.BeforeComment : _$1.InDeclaration;
@@ -23783,7 +23783,7 @@ let xi = class {
23783
23783
  /** @internal */
23784
23784
  onattribend(t, u) {
23785
23785
  var r, a;
23786
- this.endIndex = u, (a = (r = this.cbs).onattribute) === null || a === void 0 || a.call(r, this.attribname, this.attribvalue, t === re.Double ? '"' : t === re.Single ? "'" : t === re.NoValue ? void 0 : null), this.attribs && !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname) && (this.attribs[this.attribname] = this.attribvalue), this.attribvalue = "";
23786
+ this.endIndex = u, (a = (r = this.cbs).onattribute) === null || a === void 0 || a.call(r, this.attribname, this.attribvalue, t === re$1.Double ? '"' : t === re$1.Single ? "'" : t === re$1.NoValue ? void 0 : null), this.attribs && !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname) && (this.attribs[this.attribname] = this.attribvalue), this.attribvalue = "";
23787
23787
  }
23788
23788
  getInstructionName(t) {
23789
23789
  const u = t.search(Ni);
@@ -24210,10 +24210,10 @@ const Mi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
24210
24210
  toggleClass: Fr,
24211
24211
  val: Di
24212
24212
  }, Symbol.toStringTag, { value: "Module" }));
24213
- var N;
24213
+ var N$1;
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
- })(N || (N = {}));
24216
+ })(N$1 || (N$1 = {}));
24217
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";
@@ -24236,12 +24236,12 @@ const Wu = /^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/, Bi = /\\(
24236
24236
  ]);
24237
24237
  function qe(e) {
24238
24238
  switch (e.type) {
24239
- case N.Adjacent:
24240
- case N.Child:
24241
- case N.Descendant:
24242
- case N.Parent:
24243
- case N.Sibling:
24244
- case N.ColumnCombinator:
24239
+ case N$1.Adjacent:
24240
+ case N$1.Child:
24241
+ case N$1.Descendant:
24242
+ case N$1.Parent:
24243
+ case N$1.Sibling:
24244
+ case N$1.ColumnCombinator:
24245
24245
  return true;
24246
24246
  default:
24247
24247
  return false;
@@ -24307,7 +24307,7 @@ function Hr(e, t, u) {
24307
24307
  throw new Error("Did not expect successive traversals.");
24308
24308
  }
24309
24309
  function m(A) {
24310
- if (r.length > 0 && r[r.length - 1].type === N.Descendant) {
24310
+ if (r.length > 0 && r[r.length - 1].type === N$1.Descendant) {
24311
24311
  r[r.length - 1].type = A;
24312
24312
  return;
24313
24313
  }
@@ -24315,7 +24315,7 @@ function Hr(e, t, u) {
24315
24315
  }
24316
24316
  function f(A, w) {
24317
24317
  r.push({
24318
- type: N.Attribute,
24318
+ type: N$1.Attribute,
24319
24319
  name: A,
24320
24320
  action: w,
24321
24321
  value: a(1),
@@ -24324,7 +24324,7 @@ function Hr(e, t, u) {
24324
24324
  });
24325
24325
  }
24326
24326
  function T() {
24327
- if (r.length && r[r.length - 1].type === N.Descendant && r.pop(), r.length === 0)
24327
+ if (r.length && r[r.length - 1].type === N$1.Descendant && r.pop(), r.length === 0)
24328
24328
  throw new Error("Empty sub-selector");
24329
24329
  e.push(r);
24330
24330
  }
@@ -24339,24 +24339,24 @@ function Hr(e, t, u) {
24339
24339
  case 10:
24340
24340
  case 12:
24341
24341
  case 13: {
24342
- (r.length === 0 || r[0].type !== N.Descendant) && (h(), r.push({ type: N.Descendant })), i(1);
24342
+ (r.length === 0 || r[0].type !== N$1.Descendant) && (h(), r.push({ type: N$1.Descendant })), i(1);
24343
24343
  break;
24344
24344
  }
24345
24345
  // Traversals
24346
24346
  case 62: {
24347
- m(N.Child), i(1);
24347
+ m(N$1.Child), i(1);
24348
24348
  break;
24349
24349
  }
24350
24350
  case 60: {
24351
- m(N.Parent), i(1);
24351
+ m(N$1.Parent), i(1);
24352
24352
  break;
24353
24353
  }
24354
24354
  case 126: {
24355
- m(N.Sibling), i(1);
24355
+ m(N$1.Sibling), i(1);
24356
24356
  break;
24357
24357
  }
24358
24358
  case 43: {
24359
- m(N.Adjacent), i(1);
24359
+ m(N$1.Adjacent), i(1);
24360
24360
  break;
24361
24361
  }
24362
24362
  // Special attribute selectors: .class, #id
@@ -24379,7 +24379,7 @@ function Hr(e, t, u) {
24379
24379
  throw new Error("Expected `=`");
24380
24380
  i(2);
24381
24381
  } else t.charCodeAt(u) === 61 && (S = H.Equals, i(1));
24382
- let M2 = "", ee2 = null;
24382
+ let M2 = "", ee = null;
24383
24383
  if (S !== "exists") {
24384
24384
  if (Ht$1(t.charCodeAt(u))) {
24385
24385
  const ge = t.charCodeAt(u);
@@ -24397,18 +24397,18 @@ function Hr(e, t, u) {
24397
24397
  }
24398
24398
  i(0);
24399
24399
  const ae = t.charCodeAt(u) | 32;
24400
- ae === 115 ? (ee2 = false, i(1)) : ae === 105 && (ee2 = true, i(1));
24400
+ ae === 115 ? (ee = false, i(1)) : ae === 105 && (ee = true, i(1));
24401
24401
  }
24402
24402
  if (t.charCodeAt(u) !== 93)
24403
24403
  throw new Error("Attribute selector didn't terminate");
24404
24404
  u += 1;
24405
24405
  const he = {
24406
- type: N.Attribute,
24406
+ type: N$1.Attribute,
24407
24407
  name: w,
24408
24408
  action: S,
24409
24409
  value: M2,
24410
24410
  namespace: v,
24411
- ignoreCase: ee2
24411
+ ignoreCase: ee
24412
24412
  };
24413
24413
  r.push(he);
24414
24414
  break;
@@ -24416,7 +24416,7 @@ function Hr(e, t, u) {
24416
24416
  case 58: {
24417
24417
  if (t.charCodeAt(u + 1) === 58) {
24418
24418
  r.push({
24419
- type: N.PseudoElement,
24419
+ type: N$1.PseudoElement,
24420
24420
  name: a(2).toLowerCase(),
24421
24421
  data: t.charCodeAt(u) === 40 ? n() : null
24422
24422
  });
@@ -24438,7 +24438,7 @@ function Hr(e, t, u) {
24438
24438
  }
24439
24439
  v = Be(v);
24440
24440
  }
24441
- r.push({ type: N.Pseudo, name: w, data: v });
24441
+ r.push({ type: N$1.Pseudo, name: w, data: v });
24442
24442
  break;
24443
24443
  }
24444
24444
  case 44: {
@@ -24458,14 +24458,14 @@ function Hr(e, t, u) {
24458
24458
  u += 1, v = "*";
24459
24459
  else if (A === 124) {
24460
24460
  if (v = "", t.charCodeAt(u + 1) === 124) {
24461
- m(N.ColumnCombinator), i(2);
24461
+ m(N$1.ColumnCombinator), i(2);
24462
24462
  break;
24463
24463
  }
24464
24464
  } else if (Wu.test(t.slice(u)))
24465
24465
  v = a(0);
24466
24466
  else
24467
24467
  break e;
24468
- t.charCodeAt(u) === 124 && t.charCodeAt(u + 1) !== 124 && (w = v, t.charCodeAt(u + 1) === 42 ? (v = "*", u += 2) : v = a(1)), r.push(v === "*" ? { type: N.Universal, namespace: w } : { type: N.Tag, name: v, namespace: w });
24468
+ t.charCodeAt(u) === 124 && t.charCodeAt(u + 1) !== 124 && (w = v, t.charCodeAt(u + 1) === 42 ? (v = "*", u += 2) : v = a(1)), r.push(v === "*" ? { type: N$1.Universal, namespace: w } : { type: N$1.Tag, name: v, namespace: w });
24469
24469
  }
24470
24470
  }
24471
24471
  }
@@ -24487,10 +24487,10 @@ function ji() {
24487
24487
  }
24488
24488
  var ft = ji();
24489
24489
  const C = /* @__PURE__ */ Yi(ft), qr = /* @__PURE__ */ new Map([
24490
- [N.Universal, 50],
24491
- [N.Tag, 30],
24492
- [N.Attribute, 1],
24493
- [N.Pseudo, 0]
24490
+ [N$1.Universal, 50],
24491
+ [N$1.Tag, 30],
24492
+ [N$1.Attribute, 1],
24493
+ [N$1.Pseudo, 0]
24494
24494
  ]);
24495
24495
  function Au(e) {
24496
24496
  return !qr.has(e.type);
@@ -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.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$1.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$1.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("isHovered"),
24779
- visited: Yt("isVisited"),
24780
- active: Yt("isActive")
24778
+ hover: Yt$1("isHovered"),
24779
+ visited: Yt$1("isVisited"),
24780
+ active: Yt$1("isActive")
24781
24781
  };
24782
- function Yt(e) {
24782
+ function Yt$1(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) {
@@ -24900,16 +24900,16 @@ function tu(e) {
24900
24900
  equals: e.equals
24901
24901
  };
24902
24902
  }
24903
- const jt = (e, t, u, r, a) => {
24903
+ const jt$1 = (e, t, u, r, a) => {
24904
24904
  const i = a(t, tu(u), r);
24905
24905
  return i === C.trueFunc ? e : i === C.falseFunc ? C.falseFunc : (n) => i(n) && e(n);
24906
24906
  }, Vt$1 = {
24907
- is: jt,
24907
+ is: jt$1,
24908
24908
  /**
24909
24909
  * `:matches` and `:where` are aliases for `:is`.
24910
24910
  */
24911
- matches: jt,
24912
- where: jt,
24911
+ matches: jt$1,
24912
+ where: jt$1,
24913
24913
  not(e, t, u, r, a) {
24914
24914
  const i = a(t, tu(u), r);
24915
24915
  return i === C.falseFunc ? e : i === C.trueFunc ? C.falseFunc : (n) => !i(n) && e(n);
@@ -24969,19 +24969,19 @@ function $t$1(e, t) {
24969
24969
  function un(e, t, u, r, a) {
24970
24970
  const { adapter: i, equals: n } = u;
24971
24971
  switch (t.type) {
24972
- case N.PseudoElement:
24972
+ case N$1.PseudoElement:
24973
24973
  throw new Error("Pseudo-elements are not supported by css-select");
24974
- case N.ColumnCombinator:
24974
+ case N$1.ColumnCombinator:
24975
24975
  throw new Error("Column combinators are not yet supported by css-select");
24976
- case N.Attribute: {
24976
+ case N$1.Attribute: {
24977
24977
  if (t.namespace != null)
24978
24978
  throw new Error("Namespaced attributes are not yet supported by css-select");
24979
24979
  return (!u.xmlMode || u.lowerCaseAttributeNames) && (t.name = t.name.toLowerCase()), zi[t.action](e, t, u);
24980
24980
  }
24981
- case N.Pseudo:
24981
+ case N$1.Pseudo:
24982
24982
  return tn(e, t, u, r, a);
24983
24983
  // Tags
24984
- case N.Tag: {
24984
+ case N$1.Tag: {
24985
24985
  if (t.namespace != null)
24986
24986
  throw new Error("Namespaced tag names are not yet supported by css-select");
24987
24987
  let { name: c } = t;
@@ -24990,7 +24990,7 @@ function un(e, t, u, r, a) {
24990
24990
  };
24991
24991
  }
24992
24992
  // Traversal
24993
- case N.Descendant: {
24993
+ case N$1.Descendant: {
24994
24994
  if (u.cacheResults === false || typeof WeakSet > "u")
24995
24995
  return function(m) {
24996
24996
  let f = m;
@@ -25020,16 +25020,16 @@ function un(e, t, u, r, a) {
25020
25020
  while (m = $t$1(m, i));
25021
25021
  return false;
25022
25022
  };
25023
- case N.Parent:
25023
+ case N$1.Parent:
25024
25024
  return function(h) {
25025
25025
  return i.getChildren(h).some((m) => i.isTag(m) && e(m));
25026
25026
  };
25027
- case N.Child:
25027
+ case N$1.Child:
25028
25028
  return function(h) {
25029
25029
  const m = i.getParent(h);
25030
25030
  return m != null && i.isTag(m) && e(m);
25031
25031
  };
25032
- case N.Sibling:
25032
+ case N$1.Sibling:
25033
25033
  return function(h) {
25034
25034
  const m = i.getSiblings(h);
25035
25035
  for (let f = 0; f < m.length; f++) {
@@ -25041,7 +25041,7 @@ function un(e, t, u, r, a) {
25041
25041
  }
25042
25042
  return false;
25043
25043
  };
25044
- case N.Adjacent:
25044
+ case N$1.Adjacent:
25045
25045
  return i.prevElementSibling ? function(h) {
25046
25046
  const m = i.prevElementSibling(h);
25047
25047
  return m != null && e(m);
@@ -25056,7 +25056,7 @@ function un(e, t, u, r, a) {
25056
25056
  }
25057
25057
  return !!f && e(f);
25058
25058
  };
25059
- case N.Universal: {
25059
+ case N$1.Universal: {
25060
25060
  if (t.namespace != null && t.namespace !== "*")
25061
25061
  throw new Error("Namespaced universal selectors are not yet supported by css-select");
25062
25062
  return e;
@@ -25064,12 +25064,12 @@ function un(e, t, u, r, a) {
25064
25064
  }
25065
25065
  }
25066
25066
  function $r(e) {
25067
- return e.type === N.Pseudo && (e.name === "scope" || Array.isArray(e.data) && e.data.some((t) => t.some($r)));
25067
+ return e.type === N$1.Pseudo && (e.name === "scope" || Array.isArray(e.data) && e.data.some((t) => t.some($r)));
25068
25068
  }
25069
- const rn = { type: N.Descendant }, sn = {
25069
+ const rn = { type: N$1.Descendant }, sn = {
25070
25070
  type: "_flexibleDescendant"
25071
25071
  }, an = {
25072
- type: N.Pseudo,
25072
+ type: N$1.Pseudo,
25073
25073
  name: "scope",
25074
25074
  data: null
25075
25075
  };
@@ -25079,7 +25079,7 @@ function nn(e, { adapter: t }, u) {
25079
25079
  return a === jr || i && t.isTag(i);
25080
25080
  });
25081
25081
  for (const a of e) {
25082
- if (!(a.length > 0 && Au(a[0]) && a[0].type !== N.Descendant)) if (r && !a.some($r))
25082
+ if (!(a.length > 0 && Au(a[0]) && a[0].type !== N$1.Descendant)) if (r && !a.some($r))
25083
25083
  a.unshift(rn);
25084
25084
  else
25085
25085
  continue;
@@ -25098,7 +25098,7 @@ function Gr(e, t, u) {
25098
25098
  const c = e.map((h) => {
25099
25099
  if (h.length >= 2) {
25100
25100
  const [m, f] = h;
25101
- m.type !== N.Pseudo || m.name !== "scope" || (a && f.type === N.Descendant ? h[1] = sn : (f.type === N.Adjacent || f.type === N.Sibling) && (n = true));
25101
+ m.type !== N$1.Pseudo || m.name !== "scope" || (a && f.type === N$1.Descendant ? h[1] = sn : (f.type === N$1.Adjacent || f.type === N$1.Sibling) && (n = true));
25102
25102
  }
25103
25103
  return on(h, t, i);
25104
25104
  }).reduce(cn, C.falseFunc);
@@ -25150,8 +25150,8 @@ const pn = /* @__PURE__ */ new Set([
25150
25150
  "even",
25151
25151
  "odd"
25152
25152
  ]);
25153
- function bt$1(e) {
25154
- return e.type !== "pseudo" ? false : pn.has(e.name) ? true : e.name === "not" && Array.isArray(e.data) ? e.data.some((t) => t.some(bt$1)) : false;
25153
+ function bt(e) {
25154
+ return e.type !== "pseudo" ? false : pn.has(e.name) ? true : e.name === "not" && Array.isArray(e.data) ? e.data.some((t) => t.some(bt)) : false;
25155
25155
  }
25156
25156
  function fn(e, t, u) {
25157
25157
  const r = t != null ? parseInt(t, 10) : NaN;
@@ -25182,14 +25182,14 @@ function bn(e) {
25182
25182
  function wu(e) {
25183
25183
  const t = [], u = [];
25184
25184
  for (const r of e)
25185
- r.some(bt$1) ? t.push(r) : u.push(r);
25185
+ r.some(bt) ? t.push(r) : u.push(r);
25186
25186
  return [u, t];
25187
25187
  }
25188
25188
  const En = {
25189
- type: N.Universal,
25189
+ type: N$1.Universal,
25190
25190
  namespace: null
25191
25191
  }, Tn = {
25192
- type: N.Pseudo,
25192
+ type: N$1.Pseudo,
25193
25193
  name: "scope",
25194
25194
  data: null
25195
25195
  };
@@ -25273,7 +25273,7 @@ function gn(e, t, u = {}, r = 1 / 0) {
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
25275
  function Et(e, t, u, r, a) {
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);
25276
+ const i = t.findIndex(bt), 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 [];
25279
25279
  const T = (n.length === 0 && !Array.isArray(e) ? It$1(e).filter(I) : n.length === 0 ? (Array.isArray(e) ? e : [e]).filter(I) : r || n.some(qe) ? uu(e, [n], u, m) : ru(e, [n], u)).slice(0, m);
@@ -25284,7 +25284,7 @@ function Et(e, t, u, r, a) {
25284
25284
  if (v) {
25285
25285
  if (qe(w[0])) {
25286
25286
  const { type: S } = w[0];
25287
- (S === N.Sibling || S === N.Adjacent) && (A = zr(A, St$1, true)), w.unshift(En);
25287
+ (S === N$1.Sibling || S === N$1.Adjacent) && (A = zr(A, St$1, true)), w.unshift(En);
25288
25288
  }
25289
25289
  u = {
25290
25290
  ...u,
@@ -25297,7 +25297,7 @@ function Et(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(A, w, u, false, a) : v ? (
25300
+ return w.some(bt) ? Et(A, w, u, false, a) : v ? (
25301
25301
  // Query existing elements to resolve traversal.
25302
25302
  uu(A, [w], u, a)
25303
25303
  ) : (
@@ -25356,7 +25356,7 @@ function Nu(e) {
25356
25356
  };
25357
25357
  };
25358
25358
  }
25359
- const et = Nu((e, t) => {
25359
+ const et$1 = Nu((e, t) => {
25360
25360
  let u = [];
25361
25361
  for (let r = 0; r < t.length; r++) {
25362
25362
  const a = e(t[r]);
@@ -25389,7 +25389,7 @@ function Iu(e, ...t) {
25389
25389
  function Pe(e) {
25390
25390
  return e.length > 1 ? Array.from(new Set(e)) : e;
25391
25391
  }
25392
- const Nn = xu(({ parent: e }) => e && !Te(e) ? e : null, Pe), xn = et((e) => {
25392
+ const Nn = xu(({ parent: e }) => e && !Te(e) ? e : null, Pe), xn = et$1((e) => {
25393
25393
  const t = [];
25394
25394
  for (; e.parent && !Te(e.parent); )
25395
25395
  t.push(e.parent), e = e.parent;
@@ -25414,17 +25414,17 @@ function Sn(e) {
25414
25414
  }
25415
25415
  }), this._make(u);
25416
25416
  }
25417
- const Cn = xu((e) => fu(e)), yn = et((e) => {
25417
+ const Cn = xu((e) => fu(e)), yn = et$1((e) => {
25418
25418
  const t = [];
25419
25419
  for (; e.next; )
25420
25420
  e = e.next, I(e) && t.push(e);
25421
25421
  return t;
25422
- }, Pe), On = Iu((e) => fu(e), Pe), Ln = xu((e) => bu(e)), Rn = et((e) => {
25422
+ }, Pe), On = Iu((e) => fu(e), Pe), Ln = xu((e) => bu(e)), Rn = et$1((e) => {
25423
25423
  const t = [];
25424
25424
  for (; e.prev; )
25425
25425
  e = e.prev, I(e) && t.push(e);
25426
25426
  return t;
25427
- }, Pe), Dn = Iu((e) => bu(e), Pe), kn = et((e) => Cr(e).filter((t) => I(t) && t !== e), ke), Pn = et((e) => It$1(e).filter(I), Pe);
25427
+ }, Pe), Dn = Iu((e) => bu(e), Pe), kn = et$1((e) => Cr(e).filter((t) => I(t) && t !== e), ke), Pn = et$1((e) => It$1(e).filter(I), Pe);
25428
25428
  function Mn() {
25429
25429
  const e = this.toArray().reduce((t, u) => B(u) ? t.concat(u.children) : t, []);
25430
25430
  return this._make(e);
@@ -25971,9 +25971,9 @@ function ko(e, t) {
25971
25971
  ) : Array.isArray(f) ? (
25972
25972
  // $([dom])
25973
25973
  f
25974
- ) : void 0, ee2 = new h(M2, U2, v);
25974
+ ) : void 0, ee = new h(M2, U2, v);
25975
25975
  if (M2)
25976
- return ee2;
25976
+ return ee;
25977
25977
  if (typeof f != "string")
25978
25978
  throw new TypeError("Unexpected type of selector");
25979
25979
  let he = f;
@@ -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) : ee2;
25996
+ return ae ? ae.find(he) : ee;
25997
25997
  }
25998
25998
  return Object.assign(m, ni, {
25999
25999
  load: u,
@@ -28866,7 +28866,7 @@ class dc {
28866
28866
  this.pop();
28867
28867
  }
28868
28868
  }
28869
- const Gt$1 = 3;
28869
+ const Gt = 3;
28870
28870
  var te;
28871
28871
  (function(e) {
28872
28872
  e[e.Marker = 0] = "Marker", e[e.Element = 1] = "Element";
@@ -28894,16 +28894,16 @@ class hc {
28894
28894
  return r;
28895
28895
  }
28896
28896
  _ensureNoahArkCondition(t) {
28897
- if (this.entries.length < Gt$1)
28897
+ if (this.entries.length < Gt)
28898
28898
  return;
28899
28899
  const u = this.treeAdapter.getAttrList(t), r = this._getNoahArkConditionCandidates(t, u);
28900
- if (r.length < Gt$1)
28900
+ if (r.length < Gt)
28901
28901
  return;
28902
28902
  const a = new Map(u.map((n) => [n.name, n.value]));
28903
28903
  let i = 0;
28904
28904
  for (let n = 0; n < r.length; n++) {
28905
28905
  const c = r[n];
28906
- c.attrs.every((h) => a.get(h.name) === h.value) && (i += 1, i >= Gt$1 && this.entries.splice(c.idx, 1));
28906
+ c.attrs.every((h) => a.get(h.name) === h.value) && (i += 1, i >= Gt && this.entries.splice(c.idx, 1));
28907
28907
  }
28908
28908
  }
28909
28909
  //Mutations
@@ -32518,7 +32518,7 @@ const Ld = (e) => {
32518
32518
  "locale",
32519
32519
  "favicon"
32520
32520
  ].includes(y) || a[y] === void 0 && M2.push(y);
32521
- let ee2 = 1e3;
32521
+ let ee = 1e3;
32522
32522
  for (const y of M2) {
32523
32523
  const W2 = e[y];
32524
32524
  let Ce = "";
@@ -32534,7 +32534,7 @@ const Ld = (e) => {
32534
32534
  <span class="field-value">${j(String(W2))}</span>
32535
32535
  </div>`;
32536
32536
  v.push({
32537
- order: ee2++,
32537
+ order: ee++,
32538
32538
  section: "enhanced",
32539
32539
  html: Ce
32540
32540
  });
@@ -32563,12 +32563,12 @@ const Ld = (e) => {
32563
32563
  };
32564
32564
  /*!
32565
32565
  * name: mark-deco
32566
- * version: 0.12.0
32566
+ * version: 0.13.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: aff53ffd52269533e39dd1090efe8b582e087d53
32571
+ * git.commit.hash: a57a326430fda951da873116177f76aa783d4413
32572
32572
  */
32573
32573
  function Q(e) {
32574
32574
  const t = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/, n = e.match(t);
@@ -32585,8 +32585,8 @@ function Q(e) {
32585
32585
  content: r
32586
32586
  };
32587
32587
  } catch (s2) {
32588
- const h = s2 instanceof Error ? s2.message : "Unknown YAML parsing error";
32589
- throw new Error(`Failed to parse frontmatter YAML: ${h}`);
32588
+ const d2 = s2 instanceof Error ? s2.message : "Unknown YAML parsing error";
32589
+ throw new Error(`Failed to parse frontmatter YAML: ${d2}`);
32590
32590
  }
32591
32591
  }
32592
32592
  function kt(e) {
@@ -32604,35 +32604,35 @@ ${kt(e)}---
32604
32604
  `}${n}`;
32605
32605
  }
32606
32606
  const _ = () => {
32607
- }, bt = {
32607
+ }, St = {
32608
32608
  debug: _,
32609
32609
  info: _,
32610
32610
  warn: _,
32611
32611
  error: _
32612
- }, St = {
32612
+ }, $t = {
32613
32613
  debug: console.debug,
32614
32614
  info: console.info,
32615
32615
  warn: console.warn,
32616
32616
  error: console.error
32617
- }, $t = () => bt, Gt = () => St, O = (e) => {
32617
+ }, xt = () => St, Qt = () => $t, O = (e) => {
32618
32618
  const t = {}, n = e.slice(1, -1).trim(), a = n.match(/\.([a-zA-Z0-9_-]+)/g);
32619
32619
  if (a) {
32620
- const h = a.map((u) => u.slice(1));
32621
- t.class = h.join(" ");
32620
+ const d2 = a.map((p2) => p2.slice(1));
32621
+ t.class = d2.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 h of s2) {
32628
- const [u, p2] = h.split("=");
32629
- u && p2 && u !== "class" && u !== "id" && (t[u] = p2.replace(/["']/g, ""));
32627
+ for (const d2 of s2) {
32628
+ const [p2, u] = d2.split("=");
32629
+ p2 && u && p2 !== "class" && p2 !== "id" && (t[p2] = u.replace(/["']/g, ""));
32630
32630
  }
32631
32631
  return t;
32632
- }, xt = (e) => {
32632
+ }, Ht = (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
- }, L = (e, t) => {
32635
+ }, N = (e, t) => {
32636
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;
@@ -32640,15 +32640,15 @@ const _ = () => {
32640
32640
  } else
32641
32641
  e.data.hProperties[n] = a;
32642
32642
  });
32643
- }, Ht = () => (e) => {
32643
+ }, Tt = () => (e) => {
32644
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 h = s2[1].trim(), u = s2[2], p2 = O(u);
32651
- r.value = h, L(t, p2);
32650
+ const d2 = s2[1].trim(), p2 = s2[2], u = O(p2);
32651
+ r.value = d2, N(t, u);
32652
32652
  }
32653
32653
  }
32654
32654
  }
@@ -32657,8 +32657,8 @@ const _ = () => {
32657
32657
  if (r?.type === "text" && r.value) {
32658
32658
  const s2 = r.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32659
32659
  if (s2) {
32660
- const h = s2[1].trim(), u = s2[2], p2 = O(u);
32661
- r.value = h, L(t, p2);
32660
+ const d2 = s2[1].trim(), p2 = s2[2], u = O(p2);
32661
+ r.value = d2, N(t, u);
32662
32662
  }
32663
32663
  }
32664
32664
  }
@@ -32667,8 +32667,8 @@ const _ = () => {
32667
32667
  if (r?.type === "text" && r.value) {
32668
32668
  const s2 = r.value.match(/^\s*(\{[^}]+\})/);
32669
32669
  if (s2) {
32670
- const h = s2[1], u = O(h);
32671
- L(t, u), r.value = r.value.replace(s2[0], "");
32670
+ const d2 = s2[1], p2 = O(d2);
32671
+ N(t, p2), r.value = r.value.replace(s2[0], "");
32672
32672
  }
32673
32673
  }
32674
32674
  }
@@ -32677,8 +32677,8 @@ const _ = () => {
32677
32677
  if (r?.type === "text" && r.value) {
32678
32678
  const s2 = r.value.match(/^\s*(\{[^}]+\})/);
32679
32679
  if (s2) {
32680
- const h = s2[1], u = O(h);
32681
- L(t, u), r.value = r.value.replace(s2[0], "");
32680
+ const d2 = s2[1], p2 = O(d2);
32681
+ N(t, p2), r.value = r.value.replace(s2[0], "");
32682
32682
  }
32683
32683
  }
32684
32684
  }
@@ -32687,10 +32687,10 @@ 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 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);
32690
+ const d2 = s2.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32691
+ if (d2) {
32692
+ const p2 = d2[1].trim(), u = d2[2], i = O(u);
32693
+ s2.value = p2, N(t, i);
32694
32694
  }
32695
32695
  }
32696
32696
  }
@@ -32700,10 +32700,10 @@ const _ = () => {
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 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);
32703
+ const d2 = s2.value.match(/^\s*(\{[^}]+\})\s*$/);
32704
+ if (d2) {
32705
+ const p2 = d2[1], u = O(p2);
32706
+ N(t, u), a.children.splice(n + 1, 1);
32707
32707
  }
32708
32708
  }
32709
32709
  }
@@ -32713,10 +32713,10 @@ 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 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);
32716
+ const d2 = s2.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32717
+ if (d2) {
32718
+ const p2 = d2[1].trim(), u = d2[2], i = O(u);
32719
+ s2.value = p2, N(t, i);
32720
32720
  }
32721
32721
  }
32722
32722
  }
@@ -32726,10 +32726,10 @@ const _ = () => {
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 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);
32729
+ const d2 = s2.value.match(/^\s*(\{[^}]+\})\s*$/);
32730
+ if (d2) {
32731
+ const p2 = d2[1], u = O(p2);
32732
+ N(t, u), a.children.splice(n + 1, 1);
32733
32733
  }
32734
32734
  }
32735
32735
  }
@@ -32739,21 +32739,21 @@ const _ = () => {
32739
32739
  if (r?.type === "text" && r.value) {
32740
32740
  const s2 = r.value.match(/^\s*(\{[^}]+\})/);
32741
32741
  if (s2) {
32742
- const h = s2[1], u = O(h);
32743
- L(t, u), r.value = r.value.replace(s2[0], "");
32742
+ const d2 = s2[1], p2 = O(d2);
32743
+ N(t, p2), 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]}}`, h = O(s2), u = {
32750
+ const s2 = `{${r[1]}}`, d2 = O(s2), p2 = {
32751
32751
  type: "html",
32752
- value: `<div class="${h.class || ""}" ${Object.entries(
32753
- h
32754
- ).filter(([p2]) => p2 !== "class").map(([p2, i]) => `${p2}="${i}"`).join(" ")}>${xt(t)}</div>`
32752
+ value: `<div class="${d2.class || ""}" ${Object.entries(
32753
+ d2
32754
+ ).filter(([u]) => u !== "class").map(([u, i]) => `${u}="${i}"`).join(" ")}>${Ht(t)}</div>`
32755
32755
  };
32756
- a && typeof n == "number" && (a.children[n] = u), t.meta = t.meta.replace(r[0], "").trim() || null;
32756
+ a && typeof n == "number" && (a.children[n] = p2), t.meta = t.meta.replace(r[0], "").trim() || null;
32757
32757
  }
32758
32758
  }
32759
32759
  });
@@ -32767,53 +32767,69 @@ const _ = () => {
32767
32767
  }
32768
32768
  });
32769
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)
32770
+ const {
32771
+ frontmatter: t,
32772
+ hasTitle: n,
32773
+ transform: a,
32774
+ allowTitleWrite: r,
32775
+ onHeadingApplied: s2
32776
+ } = e, d2 = a === "extractAndRemove";
32777
+ return (p2) => {
32778
+ if (!t || !p2.children || p2.children.length === 0)
32773
32779
  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
32780
+ let u = 0;
32781
+ for (; u < p2.children.length; u++) {
32782
+ const i = p2.children[u];
32783
+ if (i.type === "heading" && i.depth === 1) {
32784
+ const l2 = i, c = p2.children[u + 1], o2 = c && c.position ? c.position.start?.offset : void 0, h = U(l2).trim();
32785
+ d2 && p2.children.splice(u, 1);
32786
+ let f = false;
32787
+ !n && r && h.length > 0 && (t.title = h, f = true), s2 && s2({
32788
+ headingText: h,
32789
+ position: l2.position,
32790
+ nextNodeStartOffset: o2,
32791
+ titleWritten: f,
32792
+ headingRemoved: d2
32786
32793
  });
32787
32794
  break;
32788
32795
  }
32789
- if (!(u.type === "thematicBreak" || u.type === "html" && typeof u.value == "string" && u.value.trim() === "") && !(u.type === "paragraph" && u.children?.length === 0))
32796
+ if (!(i.type === "thematicBreak" || i.type === "html" && typeof i.value == "string" && i.value.trim() === "") && !(i.type === "paragraph" && i.children?.length === 0))
32790
32797
  break;
32791
32798
  }
32792
32799
  };
32793
32800
  }, 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, {
32801
+ const { transform: a, allowTitleWrite: r } = n;
32802
+ if (a === "none")
32803
+ return {
32804
+ content: e,
32805
+ headingRemoved: false,
32806
+ titleWritten: false
32807
+ };
32808
+ const s2 = t != null && Object.prototype.hasOwnProperty.call(t, "title") && t.title !== void 0 && t.title !== null;
32809
+ let d2 = false, p2 = false, u, i;
32810
+ const l2 = unified().use(remarkParse).use(Ft, {
32797
32811
  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),
32812
+ hasTitle: s2,
32813
+ transform: a,
32814
+ allowTitleWrite: r,
32815
+ onHeadingApplied: (o2) => {
32816
+ if (d2 = o2.headingRemoved, p2 = o2.titleWritten, !o2.headingRemoved)
32817
+ return;
32818
+ const h = o2.position?.start?.offset ?? 0;
32819
+ let f = o2.position?.end?.offset ?? h;
32820
+ typeof o2.nextNodeStartOffset == "number" && o2.nextNodeStartOffset >= f ? f = o2.nextNodeStartOffset : f = e.length, u = h, i = f;
32821
+ }
32822
+ }), c = l2.parse(e);
32823
+ return l2.runSync(c), d2 && u !== void 0 && i !== void 0 ? {
32824
+ content: e.slice(0, u) + e.slice(i),
32809
32825
  headingRemoved: true,
32810
- titleWritten: s2
32826
+ titleWritten: p2
32811
32827
  } : {
32812
32828
  content: e,
32813
32829
  headingRemoved: false,
32814
32830
  titleWritten: false
32815
32831
  };
32816
- }, { html: Tt } = ot$1, Ot = {
32832
+ }, { html: Ot } = at$1, Rt = {
32817
32833
  indent_size: 2,
32818
32834
  indent_char: " ",
32819
32835
  max_preserve_newlines: 2,
@@ -32847,11 +32863,11 @@ const _ = () => {
32847
32863
  n.push(0);
32848
32864
  const s2 = r - 1;
32849
32865
  n[s2] = (n[s2] || 0) + 1;
32850
- const h = n.slice(0, r);
32866
+ const d2 = n.slice(0, r);
32851
32867
  t.push({
32852
32868
  level: a.level,
32853
32869
  text: a.text,
32854
- numbers: h
32870
+ numbers: d2
32855
32871
  });
32856
32872
  }
32857
32873
  return t;
@@ -32883,8 +32899,8 @@ const _ = () => {
32883
32899
  n.push(r);
32884
32900
  }
32885
32901
  return t;
32886
- }, Qt = (e) => {
32887
- const { plugins: t = [], logger: n = $t(), fetcher: a } = e, r = /* @__PURE__ */ new Map();
32902
+ }, Vt = (e) => {
32903
+ const { plugins: t = [], logger: n = xt(), fetcher: a } = e, r = /* @__PURE__ */ new Map();
32888
32904
  for (const o2 of t) {
32889
32905
  if (r.has(o2.name))
32890
32906
  throw new Error(
@@ -32892,235 +32908,237 @@ const _ = () => {
32892
32908
  );
32893
32909
  r.set(o2.name, o2);
32894
32910
  }
32895
- const s2 = async (o2, f, d2) => {
32911
+ const s2 = async (o2, h, f) => {
32896
32912
  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) => {
32913
+ return m ? await m.processBlock(h, f) : `<pre><code class="language-${o2}">${R(h)}</code></pre>`;
32914
+ }, d2 = (o2, h, f) => {
32899
32915
  const m = {
32900
32916
  logger: n,
32901
- signal: f,
32917
+ signal: h,
32902
32918
  frontmatter: o2,
32903
- getUniqueId: d2,
32919
+ getUniqueId: f,
32904
32920
  fetcher: a
32905
32921
  };
32906
32922
  return () => async (y) => {
32907
- const w = [];
32923
+ const g2 = [];
32908
32924
  visit(
32909
32925
  y,
32910
32926
  "code",
32911
- (g2, v, $2) => {
32912
- if (!g2.lang || !r.has(g2.lang))
32927
+ (w, v, $2) => {
32928
+ if (!w.lang || !r.has(w.lang))
32913
32929
  return;
32914
32930
  const S = (async () => {
32915
32931
  const E2 = {
32916
32932
  type: "html",
32917
32933
  value: await s2(
32918
- g2.lang,
32919
- g2.value,
32934
+ w.lang,
32935
+ w.value,
32920
32936
  m
32921
32937
  )
32922
32938
  };
32923
32939
  $2 && typeof v == "number" && ($2.children[v] = E2);
32924
32940
  })();
32925
- w.push(S);
32941
+ g2.push(S);
32926
32942
  }
32927
- ), await Promise.all(w);
32943
+ ), await Promise.all(g2);
32928
32944
  };
32929
- }, u = (o2, f, d2 = false, m = false, y = "") => () => (w) => {
32930
- const g2 = [], v = [];
32931
- visit(w, "heading", (E2) => {
32945
+ }, p2 = (o2, h, f = false, m = false, y = "") => () => (g2) => {
32946
+ const w = [], v = [];
32947
+ visit(g2, "heading", (E2) => {
32932
32948
  E2.depth >= 1 && E2.depth <= 6 && v.push(E2);
32933
32949
  });
32934
32950
  let $2 = [];
32935
- if (d2) {
32936
- const E2 = v.map((I2) => ({
32937
- level: I2.depth,
32938
- text: U(I2)
32951
+ if (f) {
32952
+ const E2 = v.map((R2) => ({
32953
+ level: R2.depth,
32954
+ text: U(R2)
32939
32955
  }));
32940
32956
  $2 = Nt(E2);
32941
32957
  }
32942
32958
  const S = [];
32943
- v.forEach((E2, I2) => {
32944
- const T = U(E2), F2 = E2.data?.hProperties?.id;
32945
- let b2;
32959
+ v.forEach((E2, R2) => {
32960
+ const C2 = U(E2), F2 = E2.data?.hProperties?.id;
32961
+ let k2;
32946
32962
  if (F2)
32947
- b2 = F2;
32948
- else if (d2 && m) {
32949
- const N2 = X(
32963
+ k2 = F2;
32964
+ else if (f && m) {
32965
+ const I2 = X(
32950
32966
  y,
32951
- T,
32952
- () => f(T)
32967
+ C2,
32968
+ () => h(C2)
32953
32969
  ).replace(`${y}-`, "");
32954
32970
  for (; S.length > 0; ) {
32955
- const k2 = S[S.length - 1];
32956
- if (k2 && k2.level >= E2.depth)
32971
+ const b2 = S[S.length - 1];
32972
+ if (b2 && b2.level >= E2.depth)
32957
32973
  S.pop();
32958
32974
  else
32959
32975
  break;
32960
32976
  }
32961
- const R2 = S.map((k2) => k2.contentId);
32962
- b2 = R2.length > 0 ? `${y}-${R2.join("-")}-${N2}` : `${y}-${N2}`, S.push({
32977
+ const L2 = S.map((b2) => b2.contentId);
32978
+ k2 = L2.length > 0 ? `${y}-${L2.join("-")}-${I2}` : `${y}-${I2}`, S.push({
32963
32979
  level: E2.depth,
32964
- contentId: N2
32980
+ contentId: I2
32965
32981
  });
32966
- } else if (d2 && I2 < $2.length) {
32967
- const N2 = $2[I2];
32968
- N2 ? b2 = It(
32982
+ } else if (f && R2 < $2.length) {
32983
+ const I2 = $2[R2];
32984
+ I2 ? k2 = It(
32969
32985
  y,
32970
- N2.numbers
32971
- ) : b2 = f(T);
32986
+ I2.numbers
32987
+ ) : k2 = h(C2);
32972
32988
  } else
32973
- b2 = f(T);
32974
- E2.data || (E2.data = {}), E2.data.hProperties || (E2.data.hProperties = {}), F2 || (E2.data.hProperties.id = b2), g2.push({
32989
+ k2 = h(C2);
32990
+ E2.data || (E2.data = {}), E2.data.hProperties || (E2.data.hProperties = {}), F2 || (E2.data.hProperties.id = k2), w.push({
32975
32991
  level: E2.depth,
32976
- text: T,
32977
- id: b2
32992
+ text: C2,
32993
+ id: k2
32978
32994
  });
32979
32995
  });
32980
- const x2 = Lt(g2);
32996
+ const x2 = Lt(w);
32981
32997
  o2.push(...x2);
32982
- }, p2 = (o2) => {
32998
+ }, u = (o2) => {
32983
32999
  throw n.error(
32984
33000
  `Failed to process markdown: ${o2 instanceof Error ? o2.message : "Unknown error"}`
32985
33001
  ), new Error(
32986
33002
  `Failed to process markdown: ${o2 instanceof Error ? o2.message : "Unknown error"}`
32987
33003
  );
32988
- }, i = async (o2, f, d2, m, y, w) => {
33004
+ }, i = async (o2, h, f, m, y, g2) => {
32989
33005
  const {
32990
- signal: g2,
33006
+ signal: w,
32991
33007
  useContentStringHeaderId: v = false,
32992
33008
  useHierarchicalHeadingId: $2 = true,
32993
33009
  advancedOptions: S
32994
- } = d2 ?? {}, {
33010
+ } = f ?? {}, {
32995
33011
  allowDangerousHtml: x2 = true,
32996
- htmlOptions: E2 = Ot,
32997
- gfmOptions: I2 = {},
32998
- remarkPlugins: T = [],
33012
+ htmlOptions: E2 = Rt,
33013
+ gfmOptions: R2 = {},
33014
+ remarkPlugins: C2 = [],
32999
33015
  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,
33016
+ } = S || {}, k2 = [];
33017
+ let I2 = 0;
33018
+ const L2 = () => `${h}-${++I2}`;
33019
+ let T = unified().use(remarkParse);
33020
+ if (C2)
33021
+ for (const H2 of C2)
33022
+ Array.isArray(H2) ? T = T.use(H2[0], H2[1]) : T = T.use(H2);
33023
+ let b2 = T.use(remarkGfm, R2).use(Tt).use(
33024
+ p2(
33025
+ k2,
33026
+ v ? (H2) => X(h, H2, L2) : L2,
33011
33027
  $2,
33012
33028
  v,
33013
- f
33029
+ h
33014
33030
  )
33015
- ).use(h(m, g2, R2)).use(remarkRehype, { allowDangerousHtml: x2 }).use(Ct).use(rehypeStringify, { allowDangerousHtml: x2 });
33031
+ ).use(d2(m, w, L2)).use(remarkRehype, { allowDangerousHtml: x2 }).use(Ct).use(rehypeStringify, { allowDangerousHtml: x2 });
33016
33032
  if (F2)
33017
33033
  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);
33034
+ Array.isArray(H2) ? b2 = b2.use(H2[0], H2[1]) : b2 = b2.use(H2);
33035
+ const B2 = await b2.process(y), P2 = String(B2);
33020
33036
  return {
33021
- html: Tt(A, E2),
33037
+ html: Ot(P2, E2),
33022
33038
  frontmatter: m,
33023
- changed: w,
33024
- headingTree: b2,
33025
- composeMarkdown: () => w ? V(m, y) : o2,
33026
- uniqueIdPrefix: f
33039
+ changed: g2,
33040
+ headingTree: k2,
33041
+ composeMarkdown: () => g2 ? V(m, y) : o2,
33042
+ uniqueIdPrefix: h
33027
33043
  };
33028
33044
  };
33029
33045
  return {
33030
- process: async (o2, f, d2 = {}) => {
33046
+ process: async (o2, h, f = {}) => {
33031
33047
  try {
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
33048
+ const { data: m, content: y } = Q(o2), g2 = f.h1TitleTransform ?? "extractAndRemove";
33049
+ let w = y, v = false, $2 = false;
33050
+ if (g2 !== "none") {
33051
+ const x2 = Z(w, m, {
33052
+ allowTitleWrite: true,
33053
+ transform: g2
33037
33054
  });
33038
- g2 = x2.content, v = x2.headingRemoved, $2 = x2.titleWritten;
33055
+ w = x2.content, v = x2.headingRemoved, $2 = x2.titleWritten;
33039
33056
  }
33040
33057
  return await i(
33041
33058
  o2,
33059
+ h,
33042
33060
  f,
33043
- d2,
33044
33061
  m,
33045
- g2,
33062
+ w,
33046
33063
  v || $2
33047
33064
  );
33048
33065
  } catch (m) {
33049
- return p2(m);
33066
+ return u(m);
33050
33067
  }
33051
33068
  },
33052
- processWithFrontmatterTransform: async (o2, f, d2, m, y = {}) => {
33069
+ processWithFrontmatterTransform: async (o2, h, f, m, y = {}) => {
33053
33070
  try {
33054
- const { data: w, content: g2 } = Q(o2), v = M(w), S = d2({
33055
- originalFrontmatter: w,
33056
- markdownContent: g2,
33057
- uniqueIdPrefix: f
33071
+ const { data: g2, content: w } = Q(o2), v = M(g2), S = await f({
33072
+ originalFrontmatter: g2,
33073
+ markdownContent: w,
33074
+ uniqueIdPrefix: h
33058
33075
  });
33059
33076
  if (S === void 0)
33060
33077
  return;
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
33078
+ const { frontmatter: x2, uniqueIdPrefix: E2 } = S, R2 = E2 ?? h, C2 = y.h1TitleTransform ?? "extractAndRemove";
33079
+ let F2 = w, k2 = false;
33080
+ if (C2 !== "none") {
33081
+ const A = Z(F2, x2, {
33082
+ allowTitleWrite: true,
33083
+ transform: C2
33066
33084
  });
33067
- F2 = P2.content, b2 = P2.headingRemoved || b2;
33085
+ F2 = A.content, k2 = A.headingRemoved || k2;
33068
33086
  }
33069
- const R2 = M(x2) !== v || b2, C2 = await i(
33087
+ const L2 = M(x2) !== v || k2, T = await i(
33070
33088
  o2,
33071
- I2,
33089
+ R2,
33072
33090
  y,
33073
33091
  x2,
33074
33092
  F2,
33075
- R2
33093
+ L2
33076
33094
  );
33077
- let k2 = C2.frontmatter;
33095
+ let b2 = T.frontmatter;
33078
33096
  if (m) {
33079
- const P2 = {
33080
- frontmatter: k2,
33081
- headingTree: C2.headingTree
33097
+ const A = {
33098
+ frontmatter: b2,
33099
+ headingTree: T.headingTree
33082
33100
  };
33083
- k2 = m(P2);
33101
+ b2 = await m(A);
33084
33102
  }
33085
- const A = M(k2) !== v || b2, J2 = () => A ? V(k2, F2) : o2;
33103
+ const P2 = M(b2) !== v || k2, J2 = () => P2 ? V(b2, F2) : o2;
33086
33104
  return {
33087
- html: C2.html,
33088
- frontmatter: k2,
33089
- changed: A,
33090
- headingTree: C2.headingTree,
33105
+ html: T.html,
33106
+ frontmatter: b2,
33107
+ changed: P2,
33108
+ headingTree: T.headingTree,
33091
33109
  composeMarkdown: J2,
33092
- uniqueIdPrefix: C2.uniqueIdPrefix
33110
+ uniqueIdPrefix: T.uniqueIdPrefix
33093
33111
  };
33094
- } catch (w) {
33095
- return p2(w);
33112
+ } catch (g2) {
33113
+ return u(g2);
33096
33114
  }
33097
33115
  }
33098
33116
  };
33099
- }, Vt = (e, t = {}) => {
33117
+ }, Zt = (e, t = {}) => {
33100
33118
  const { maxRedirects: n = 5, timeoutEachRedirect: a = 1e4 } = t;
33101
33119
  return {
33102
33120
  name: "oembed",
33103
- processBlock: async (s2, h) => {
33104
- const u = s2.trim();
33105
- if (!qd(u))
33106
- throw new Error(`Invalid URL: ${u}`);
33121
+ processBlock: async (s2, d2) => {
33122
+ const p2 = s2.trim();
33123
+ if (!qd(p2))
33124
+ throw new Error(`Invalid URL: ${p2}`);
33107
33125
  try {
33108
- const p2 = await Gd(
33109
- u,
33126
+ const u = await Gd(
33127
+ p2,
33110
33128
  n,
33111
33129
  a,
33112
- h,
33130
+ d2,
33113
33131
  e
33114
33132
  );
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);
33133
+ return Wd(u, p2, t);
33134
+ } catch (u) {
33135
+ d2.logger.warn("oEmbed fetch failed for URL:", p2, u);
33136
+ const i = Vd(u);
33137
+ return typeof window < "u" ? Xs(p2, i) : Xs(p2, i);
33120
33138
  }
33121
33139
  }
33122
33140
  };
33123
- }, Zt = (e = {}) => ({
33141
+ }, Xt = (e = {}) => ({
33124
33142
  name: "card",
33125
33143
  processBlock: async (n, a) => {
33126
33144
  const r = n.trim();
@@ -33131,19 +33149,19 @@ const _ = () => {
33131
33149
  return th(s2, r, e);
33132
33150
  } catch (s2) {
33133
33151
  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);
33152
+ const d2 = Vd(s2);
33153
+ return typeof window < "u" ? eh(r, d2) : eh(r, d2);
33136
33154
  }
33137
33155
  }
33138
- }), Xt = (e = {}) => {
33156
+ }), Yt = (e = {}) => {
33139
33157
  const { className: t = "mermaid", includeId: n = true } = e;
33140
33158
  return {
33141
33159
  name: "mermaid",
33142
33160
  processBlock: async (r, s2) => {
33143
- const h = r.trim();
33144
- if (!h) {
33161
+ const d2 = r.trim();
33162
+ if (!d2) {
33145
33163
  s2.logger.warn("Mermaid plugin received empty content");
33146
- const c = n ? ` id="${s2.getUniqueId()}"` : "";
33164
+ const l2 = n ? ` id="${s2.getUniqueId()}"` : "";
33147
33165
  return `<div class="${t}-wrapper">
33148
33166
  <style>
33149
33167
  .${t}-wrapper .${t} > svg {
@@ -33152,10 +33170,10 @@ const _ = () => {
33152
33170
  max-width: none !important;
33153
33171
  }
33154
33172
  </style>
33155
- <div class="${t}"${c}><!-- Empty mermaid content --></div>
33173
+ <div class="${t}"${l2}><!-- Empty mermaid content --></div>
33156
33174
  </div>`;
33157
33175
  }
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">
33176
+ const p2 = n ? ` id="${s2.getUniqueId()}"` : "", u = d2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), i = `<div class="${t}-wrapper">
33159
33177
  <style>
33160
33178
  .${t}-wrapper .${t} > svg {
33161
33179
  width: auto !important;
@@ -33163,10 +33181,10 @@ const _ = () => {
33163
33181
  max-width: none !important;
33164
33182
  }
33165
33183
  </style>
33166
- <div class="${t}"${u}>${p2}</div>
33184
+ <div class="${t}"${p2}>${u}</div>
33167
33185
  </div>`;
33168
33186
  return s2.logger.debug("Mermaid plugin processed content:", {
33169
- contentLength: h.length,
33187
+ contentLength: d2.length,
33170
33188
  className: t,
33171
33189
  includeId: n
33172
33190
  }), i;
@@ -33175,23 +33193,23 @@ const _ = () => {
33175
33193
  };
33176
33194
  /*!
33177
33195
  * name: async-primitives
33178
- * version: 1.4.0
33196
+ * version: 1.5.0
33179
33197
  * description: A collection of primitive functions for asynchronous operations
33180
33198
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
33181
33199
  * license: MIT
33182
33200
  * repository.url: https://github.com/kekyo/async-primitives.git
33183
- * git.commit.hash: 147b7bee11bf17823a185e0492d7f73587748715
33201
+ * git.commit.hash: cd35465b7e9b9945049186e7eaeecc0bfba65766
33184
33202
  */
33185
33203
  const Y = () => {
33186
33204
  }, tt = {
33187
33205
  release: Y,
33188
33206
  [Symbol.dispose]: Y
33189
- }, Rt = (e, t) => {
33207
+ }, et = (e) => e instanceof Error ? e : typeof e == "string" ? new Error(e) : new Error("Operation aborted"), At = (e, t) => {
33190
33208
  if (!e)
33191
33209
  return tt;
33192
33210
  if (e.aborted) {
33193
33211
  try {
33194
- t();
33212
+ t(et(e.reason));
33195
33213
  } catch (s2) {
33196
33214
  console.warn("AbortHook callback error: ", s2);
33197
33215
  }
@@ -33200,11 +33218,12 @@ const Y = () => {
33200
33218
  let n;
33201
33219
  n = () => {
33202
33220
  if (n) {
33221
+ const s2 = e.reason;
33203
33222
  e.removeEventListener("abort", n), n = void 0;
33204
33223
  try {
33205
- t();
33206
- } catch (s2) {
33207
- console.warn("AbortHook callback error: ", s2);
33224
+ t(et(s2));
33225
+ } catch (d2) {
33226
+ console.warn("AbortHook callback error: ", d2);
33208
33227
  }
33209
33228
  }
33210
33229
  };
@@ -33217,7 +33236,7 @@ const Y = () => {
33217
33236
  };
33218
33237
  }, Pt = (e) => {
33219
33238
  typeof setImmediate == "function" ? setImmediate(e) : setTimeout(e, 0);
33220
- }, q = () => new Error("Lock acquisition was aborted"), At = (e) => {
33239
+ }, q = () => new Error("Lock acquisition was aborted"), _t = (e) => {
33221
33240
  let t = true;
33222
33241
  const n = () => {
33223
33242
  t && (t = false, e());
@@ -33234,54 +33253,54 @@ const Y = () => {
33234
33253
  const n = [];
33235
33254
  let a = 0;
33236
33255
  const r = () => {
33237
- var c;
33256
+ var l2;
33238
33257
  if (t || n.length === 0)
33239
33258
  return;
33240
- const l2 = n.shift();
33241
- if ((c = l2.signal) != null && c.aborted) {
33242
- l2.reject(q()), s2();
33259
+ const c = n.shift();
33260
+ if ((l2 = c.signal) != null && l2.aborted) {
33261
+ c.reject(q()), s2();
33243
33262
  return;
33244
33263
  }
33245
33264
  t = true;
33246
- const o2 = At(h);
33247
- l2.resolve(o2);
33265
+ const o2 = _t(d2);
33266
+ c.resolve(o2);
33248
33267
  }, s2 = () => {
33249
33268
  a++, a >= e ? (a = 0, Pt(r)) : r();
33250
- }, h = () => {
33269
+ }, d2 = () => {
33251
33270
  t && (t = false, s2());
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)
33271
+ }, p2 = (l2) => {
33272
+ const c = n.indexOf(l2);
33273
+ c !== -1 && n.splice(c, 1);
33274
+ }, u = async (l2) => {
33275
+ if (l2) {
33276
+ if (l2.aborted)
33258
33277
  throw q();
33259
- return new Promise((l2, o2) => {
33260
- const f = {
33278
+ return new Promise((c, o2) => {
33279
+ const h = {
33261
33280
  resolve: void 0,
33262
33281
  reject: void 0,
33263
- signal: c
33264
- }, d2 = Rt(c, () => {
33265
- u(f), o2(q());
33282
+ signal: l2
33283
+ }, f = At(l2, () => {
33284
+ p2(h), o2(q());
33266
33285
  });
33267
- f.resolve = (m) => {
33268
- d2.release(), l2(m);
33269
- }, f.reject = (m) => {
33270
- d2.release(), o2(m);
33271
- }, n.push(f), r();
33286
+ h.resolve = (m) => {
33287
+ f.release(), c(m);
33288
+ }, h.reject = (m) => {
33289
+ f.release(), o2(m);
33290
+ }, n.push(h), r();
33272
33291
  });
33273
33292
  } else
33274
- return new Promise((l2, o2) => {
33293
+ return new Promise((c, o2) => {
33275
33294
  n.push({
33276
- resolve: l2,
33295
+ resolve: c,
33277
33296
  reject: o2
33278
33297
  }), r();
33279
33298
  });
33280
33299
  };
33281
33300
  return {
33282
- lock: p2,
33301
+ lock: u,
33283
33302
  waiter: {
33284
- wait: p2
33303
+ wait: u
33285
33304
  },
33286
33305
  get isLocked() {
33287
33306
  return t;
@@ -33290,62 +33309,62 @@ const Y = () => {
33290
33309
  return n.length;
33291
33310
  }
33292
33311
  };
33293
- }, _t = () => {
33294
- const e = /* @__PURE__ */ new Map(), t = z(), n = (p2 = Date.now()) => {
33312
+ }, jt = () => {
33313
+ const e = /* @__PURE__ */ new Map(), t = z(), n = (u = Date.now()) => {
33295
33314
  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);
33315
+ for (const [l2, c] of e.entries())
33316
+ c.ttl !== void 0 && (c.ttl === 0 || u > c.timestamp + c.ttl) && i.push(l2);
33317
+ for (const l2 of i)
33318
+ e.delete(l2);
33300
33319
  return i;
33301
33320
  };
33302
33321
  return {
33303
- get: async (p2) => {
33304
- const i = e.get(p2);
33322
+ get: async (u) => {
33323
+ const i = e.get(u);
33305
33324
  if (!i)
33306
33325
  return null;
33307
33326
  if (i.ttl !== void 0 && (i.ttl === 0 || Date.now() > i.timestamp + i.ttl)) {
33308
- const l2 = await t.lock();
33327
+ const c = await t.lock();
33309
33328
  try {
33310
- const o2 = e.get(p2);
33329
+ const o2 = e.get(u);
33311
33330
  if (o2 && o2.ttl !== void 0) {
33312
- const f = Date.now();
33313
- (o2.ttl === 0 || f > o2.timestamp + o2.ttl) && e.delete(p2);
33331
+ const h = Date.now();
33332
+ (o2.ttl === 0 || h > o2.timestamp + o2.ttl) && e.delete(u);
33314
33333
  }
33315
33334
  return null;
33316
33335
  } finally {
33317
- l2.release();
33336
+ c.release();
33318
33337
  }
33319
33338
  }
33320
33339
  return i.data;
33321
33340
  },
33322
- set: async (p2, i, c) => {
33323
- const l2 = {
33341
+ set: async (u, i, l2) => {
33342
+ const c = {
33324
33343
  data: i,
33325
33344
  timestamp: Date.now()
33326
33345
  };
33327
- c !== void 0 && (l2.ttl = c);
33346
+ l2 !== void 0 && (c.ttl = l2);
33328
33347
  const o2 = await t.lock();
33329
33348
  try {
33330
- e.set(p2, l2);
33349
+ e.set(u, c);
33331
33350
  } finally {
33332
33351
  o2.release();
33333
33352
  }
33334
33353
  },
33335
- delete: async (p2) => {
33354
+ delete: async (u) => {
33336
33355
  const i = await t.lock();
33337
33356
  try {
33338
- e.delete(p2);
33357
+ e.delete(u);
33339
33358
  } finally {
33340
33359
  i.release();
33341
33360
  }
33342
33361
  },
33343
33362
  clear: async () => {
33344
- const p2 = await t.lock();
33363
+ const u = await t.lock();
33345
33364
  try {
33346
33365
  e.clear();
33347
33366
  } finally {
33348
- p2.release();
33367
+ u.release();
33349
33368
  }
33350
33369
  },
33351
33370
  size: async () => {
@@ -33363,62 +33382,62 @@ const Y = () => {
33363
33382
  function D(e, t, n) {
33364
33383
  return `fetch:${e}:${t}:${n}`;
33365
33384
  }
33366
- const ee = (e, t = 6e4, n, a) => {
33385
+ const re = (e, t = 6e4, n, a) => {
33367
33386
  const {
33368
33387
  cache: r = true,
33369
33388
  cacheTTL: s2 = 3600 * 1e3,
33370
33389
  // 1 hour default
33371
- cacheFailures: h = true,
33372
- failureCacheTTL: u = 300 * 1e3
33390
+ cacheFailures: d2 = true,
33391
+ failureCacheTTL: p2 = 300 * 1e3
33373
33392
  // 5 minutes default for failures
33374
- } = {}, p2 = r ? n || _t() : void 0;
33393
+ } = {}, u = r ? n || jt() : void 0;
33375
33394
  return {
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)
33395
+ rawFetcher: async (l2, c, o2, h) => {
33396
+ if (r && u) {
33397
+ const y = D(l2, c, e), g2 = await u.get(y);
33398
+ if (g2)
33380
33399
  try {
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, {
33400
+ const w = JSON.parse(g2);
33401
+ if (w.type === "success")
33402
+ return h?.info(`Cache HIT (success) for URL: ${l2}`), new Response(w.data, {
33384
33403
  status: 200,
33385
33404
  statusText: "OK",
33386
33405
  headers: {
33387
- "Content-Type": l2,
33406
+ "Content-Type": c,
33388
33407
  "X-Cache": "HIT"
33389
33408
  }
33390
33409
  });
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}`
33410
+ if (w.type === "error" && d2)
33411
+ throw h?.info(`Cache HIT (error) for URL: ${l2}`), new Error("Cached error");
33412
+ h?.debug(
33413
+ `Cache entry type ${w.type} not eligible for use, cacheFailures: ${d2}`
33395
33414
  );
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");
33415
+ } catch (w) {
33416
+ if (h?.warn(
33417
+ `Failed to parse cached entry for URL ${l2}:`,
33418
+ w
33419
+ ), w instanceof SyntaxError)
33420
+ h?.debug("JSON parse error, continuing to network fetch");
33402
33421
  else
33403
- throw g2;
33422
+ throw w;
33404
33423
  }
33405
33424
  else
33406
- f?.info(`Cache MISS for URL: ${c}`);
33425
+ h?.info(`Cache MISS for URL: ${l2}`);
33407
33426
  }
33408
- let d2, m = null;
33427
+ let f, m = null;
33409
33428
  try {
33410
- d2 = await Yd(
33411
- c,
33429
+ f = await Yd(
33412
33430
  l2,
33431
+ c,
33413
33432
  e,
33414
33433
  t,
33415
33434
  o2,
33416
- f
33435
+ h
33417
33436
  );
33418
33437
  } catch (y) {
33419
- if (m = y, r && p2 && h)
33438
+ if (m = y, r && u && d2)
33420
33439
  try {
33421
- const w = D(c, l2, e), g2 = {
33440
+ const g2 = D(l2, c, e), w = {
33422
33441
  type: "error",
33423
33442
  data: "",
33424
33443
  error: {
@@ -33431,55 +33450,55 @@ const ee = (e, t = 6e4, n, a) => {
33431
33450
  },
33432
33451
  timestamp: Date.now()
33433
33452
  };
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);
33453
+ await u.set(
33454
+ g2,
33455
+ JSON.stringify(w),
33456
+ p2
33457
+ ), h?.debug(`Cached error for URL: ${l2}`);
33458
+ } catch (g2) {
33459
+ h?.warn(`Failed to cache error for URL ${l2}:`, g2), console.warn("Failed to cache error:", g2);
33441
33460
  }
33442
33461
  throw m;
33443
33462
  }
33444
- if (r && p2 && d2.ok)
33463
+ if (r && u && f.ok)
33445
33464
  try {
33446
- const y = await d2.clone().text(), w = D(c, l2, e), g2 = {
33465
+ const y = await f.clone().text(), g2 = D(l2, c, e), w = {
33447
33466
  type: "success",
33448
33467
  data: y,
33449
33468
  timestamp: Date.now()
33450
33469
  };
33451
- await p2.set(
33452
- w,
33453
- JSON.stringify(g2),
33470
+ await u.set(
33471
+ g2,
33472
+ JSON.stringify(w),
33454
33473
  s2
33455
- ), f?.debug(`Cached successful response for URL: ${c}`);
33474
+ ), h?.debug(`Cached successful response for URL: ${l2}`);
33456
33475
  } catch (y) {
33457
- f?.warn(`Failed to cache response for URL ${c}:`, y), console.warn("Failed to cache response:", y);
33476
+ h?.warn(`Failed to cache response for URL ${l2}:`, y), console.warn("Failed to cache response:", y);
33458
33477
  }
33459
- return d2;
33478
+ return f;
33460
33479
  },
33461
33480
  userAgent: e
33462
33481
  };
33463
33482
  };
33464
33483
  function setupProcessor(config) {
33465
33484
  const plugins = [];
33466
- const logger = Gt();
33467
- const fetcher = ee(
33485
+ const logger = Qt();
33486
+ const fetcher = re(
33468
33487
  "mark-deco-cli/0.0.1",
33469
33488
  5e3,
33470
- _t()
33489
+ jt()
33471
33490
  );
33472
33491
  const enabledPlugins = config.noPlugins ? [] : Array.isArray(config.plugins) ? config.plugins : ["oembed", "card", "mermaid"];
33473
33492
  if (enabledPlugins.includes("oembed") && config.oembed?.enabled !== false) {
33474
- plugins.push(Vt($d, {}));
33493
+ plugins.push(Zt($d, {}));
33475
33494
  }
33476
33495
  if (enabledPlugins.includes("card") && config.card?.enabled !== false) {
33477
- plugins.push(Zt({}));
33496
+ plugins.push(Xt({}));
33478
33497
  }
33479
33498
  if (enabledPlugins.includes("mermaid") && config.mermaid?.enabled !== false) {
33480
- plugins.push(Xt({}));
33499
+ plugins.push(Yt({}));
33481
33500
  }
33482
- return Qt({
33501
+ return Vt({
33483
33502
  plugins,
33484
33503
  logger,
33485
33504
  fetcher
@@ -33516,9 +33535,9 @@ async function main() {
33516
33535
  ).default(false)
33517
33536
  ).addOption(
33518
33537
  new commander.Option(
33519
- "--no-apply-title-from-h1",
33520
- "Disable applying the first H1 to frontmatter.title"
33521
- )
33538
+ "--h1-title-transform <mode>",
33539
+ "Control how the first H1 heading is applied to frontmatter.title (extract, extractAndRemove, none)"
33540
+ ).choices(["extract", "extractAndRemove", "none"])
33522
33541
  ).addOption(
33523
33542
  new commander.Option(
33524
33543
  "--frontmatter-output <file>",
@@ -33536,14 +33555,14 @@ async function main() {
33536
33555
  const mergedOptions = { ...config, ...options2 };
33537
33556
  const markdown = await readInput(options2.input);
33538
33557
  const processor = setupProcessor(mergedOptions);
33539
- const applyTitleFromH1 = options2.applyTitleFromH1 ?? config.applyTitleFromH1 ?? true;
33558
+ const h1TitleTransform = options2.h1TitleTransform ?? config.h1TitleTransform ?? "extractAndRemove";
33540
33559
  const result = await processor.process(
33541
33560
  markdown,
33542
33561
  options2.uniqueIdPrefix || "section",
33543
33562
  {
33544
33563
  useHierarchicalHeadingId: options2.hierarchicalHeadingId ?? true,
33545
33564
  useContentStringHeaderId: options2.contentBasedHeadingId ?? false,
33546
- applyTitleFromH1
33565
+ h1TitleTransform
33547
33566
  }
33548
33567
  );
33549
33568
  await writeOutput(result.html, options2.output);