@fruggr/zendesk-mcp-server 3.1.2 → 3.2.1

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/index.js CHANGED
@@ -442,7 +442,7 @@ function members(proto, table) {
442
442
  }
443
443
  }
444
444
  /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
445
- function own$12(inst, key, value, enumerable = true) {
445
+ function own$13(inst, key, value, enumerable = true) {
446
446
  Object.defineProperty(inst, key, {
447
447
  configurable: true,
448
448
  writable: true,
@@ -453,7 +453,7 @@ function own$12(inst, key, value, enumerable = true) {
453
453
  }
454
454
  /** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
455
455
  function hide(inst, key, value) {
456
- return own$12(inst, key, value, false);
456
+ return own$13(inst, key, value, false);
457
457
  }
458
458
  /** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
459
459
  function derived(computes, table) {
@@ -463,10 +463,10 @@ function derived(computes, table) {
463
463
  configurable: true,
464
464
  enumerable: true,
465
465
  get() {
466
- return own$12(this, key, compute(this));
466
+ return own$13(this, key, compute(this));
467
467
  },
468
468
  set(value) {
469
- own$12(this, key, value);
469
+ own$13(this, key, value);
470
470
  }
471
471
  });
472
472
  }
@@ -476,10 +476,10 @@ function defineBound(proto, key, fn) {
476
476
  Object.defineProperty(proto, key, {
477
477
  configurable: true,
478
478
  get() {
479
- return this == null ? fn : own$12(this, key, fn.bind(this));
479
+ return this == null ? fn : own$13(this, key, fn.bind(this));
480
480
  },
481
481
  set(value) {
482
- own$12(this, key, value);
482
+ own$13(this, key, value);
483
483
  }
484
484
  });
485
485
  }
@@ -1766,7 +1766,7 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1766
1766
  return hide(this, "~standard", standardProps(this));
1767
1767
  },
1768
1768
  set "~standard"(value) {
1769
- own$12(this, "~standard", value);
1769
+ own$13(this, "~standard", value);
1770
1770
  }
1771
1771
  });
1772
1772
  /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
@@ -6535,7 +6535,7 @@ const parse$10 = /* @__PURE__ */ _parse(ZodRealError);
6535
6535
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
6536
6536
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
6537
6537
  const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
6538
- const encode = /* @__PURE__ */ _encode(ZodRealError);
6538
+ const encode$1 = /* @__PURE__ */ _encode(ZodRealError);
6539
6539
  const decode$1 = /* @__PURE__ */ _decode(ZodRealError);
6540
6540
  const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
6541
6541
  const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
@@ -6660,7 +6660,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
6660
6660
  });
6661
6661
  },
6662
6662
  set "~standard"(value) {
6663
- own$12(this, "~standard", value);
6663
+ own$13(this, "~standard", value);
6664
6664
  },
6665
6665
  parse: function _parse(data, params) {
6666
6666
  return parse$10(this, data, params, { callee: _parse });
@@ -6678,7 +6678,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
6678
6678
  return this?.safeParseAsync;
6679
6679
  },
6680
6680
  set spa(value) {
6681
- own$12(this, "spa", value);
6681
+ own$13(this, "spa", value);
6682
6682
  },
6683
6683
  validate(data, params) {
6684
6684
  return validate(this, data, params);
@@ -6687,7 +6687,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
6687
6687
  return validateAsync$1(this, data, params);
6688
6688
  },
6689
6689
  encode: function _encode(data, params) {
6690
- return encode(this, data, params, { callee: _encode });
6690
+ return encode$1(this, data, params, { callee: _encode });
6691
6691
  },
6692
6692
  decode: function _decode(data, params) {
6693
6693
  return decode$1(this, data, params, { callee: _decode });
@@ -7832,7 +7832,7 @@ const loadConfig = (argv = process.argv.slice(2)) => {
7832
7832
  });
7833
7833
  };
7834
7834
  //#endregion
7835
- //#region node_modules/.pnpm/@modelcontextprotocol+server@2.1.0/node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs
7835
+ //#region node_modules/.pnpm/@modelcontextprotocol+server@2.2.0/node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs
7836
7836
  var __create = Object.create;
7837
7837
  var __defProp = Object.defineProperty;
7838
7838
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7864,7 +7864,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
7864
7864
  enumerable: true
7865
7865
  }) : target, mod));
7866
7866
  //#endregion
7867
- //#region node_modules/.pnpm/@modelcontextprotocol+server@2.1.0/node_modules/@modelcontextprotocol/server/dist/dialects-DoSzNhcb.mjs
7867
+ //#region node_modules/.pnpm/@modelcontextprotocol+server@2.2.0/node_modules/@modelcontextprotocol/server/dist/dialects-DoSzNhcb.mjs
7868
7868
  /**
7869
7869
  * Canonical `$schema` URIs per supported dialect (http + https variants, trailing-`#` stripped).
7870
7870
  */
@@ -9447,7 +9447,8 @@ const OAuthTokensSchema = object({
9447
9447
  token_type: string$2(),
9448
9448
  expires_in: number$1().optional(),
9449
9449
  scope: string$2().optional(),
9450
- refresh_token: string$2().optional()
9450
+ refresh_token: string$2().optional(),
9451
+ issuer: string$2().optional().catch(void 0)
9451
9452
  }).strip();
9452
9453
  /**
9453
9454
  * RFC 8693 §2.2.1 Token Exchange response for ID-JAG tokens.
@@ -9504,7 +9505,8 @@ const OAuthClientInformationSchema = object({
9504
9505
  client_id: string$2(),
9505
9506
  client_secret: string$2().optional(),
9506
9507
  client_id_issued_at: number$2().optional(),
9507
- client_secret_expires_at: number$2().optional()
9508
+ client_secret_expires_at: number$2().optional(),
9509
+ issuer: string$2().optional().catch(void 0)
9508
9510
  }).strip();
9509
9511
  /**
9510
9512
  * RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata)
@@ -9525,7 +9527,7 @@ const OAuthTokenRevocationRequestSchema = object({
9525
9527
  token_type_hint: string$2().optional()
9526
9528
  }).strip();
9527
9529
  //#endregion
9528
- //#region node_modules/.pnpm/@modelcontextprotocol+server@2.1.0/node_modules/@modelcontextprotocol/server/dist/src-D-y6h4N7.mjs
9530
+ //#region node_modules/.pnpm/@modelcontextprotocol+server@2.2.0/node_modules/@modelcontextprotocol/server/dist/src-BHSMhZ_W.mjs
9529
9531
  /**
9530
9532
  * Cross-bundle `instanceof` support for the SDK error classes.
9531
9533
  *
@@ -13486,6 +13488,8 @@ const rev2026Codec = {
13486
13488
  const rawInputRequests = raw["inputRequests"];
13487
13489
  const inputRequests = isPlainObject$4(rawInputRequests) ? rawInputRequests : {};
13488
13490
  const requestState = raw["requestState"];
13491
+ const metaParse = raw["_meta"] === void 0 ? void 0 : buildSchemas2026().ResultMetaSchema.safeParse(raw["_meta"]);
13492
+ const meta = metaParse?.success ? metaParse.data : void 0;
13489
13493
  if (Object.keys(inputRequests).length === 0 && typeof requestState !== "string") return {
13490
13494
  kind: "invalid",
13491
13495
  error: new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${method}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`, {
@@ -13496,7 +13500,8 @@ const rev2026Codec = {
13496
13500
  return {
13497
13501
  kind: "input_required",
13498
13502
  inputRequests,
13499
- ...typeof requestState === "string" && { requestState }
13503
+ ...typeof requestState === "string" && { requestState },
13504
+ ...meta !== void 0 && { _meta: meta }
13500
13505
  };
13501
13506
  }
13502
13507
  if (rawResultType !== "complete") return {
@@ -15230,7 +15235,7 @@ var Protocol = class {
15230
15235
  * Emits a notification, which is a one-way message that does not expect a response.
15231
15236
  */
15232
15237
  async notification(notification, options) {
15233
- return this._notificationViaCodec(this._resolveOutboundCodec(notification.method), notification, options);
15238
+ return await this._notificationViaCodec(this._resolveOutboundCodec(notification.method), notification, options);
15234
15239
  }
15235
15240
  /**
15236
15241
  * The notification funnel proper, keyed by the resolved era codec —
@@ -15399,7 +15404,8 @@ function manualInputRequiredValue(decoded) {
15399
15404
  return {
15400
15405
  resultType: "input_required",
15401
15406
  inputRequests: decoded.inputRequests,
15402
- ...decoded.requestState !== void 0 && { requestState: decoded.requestState }
15407
+ ...decoded.requestState !== void 0 && { requestState: decoded.requestState },
15408
+ ...decoded._meta !== void 0 && { _meta: decoded._meta }
15403
15409
  };
15404
15410
  }
15405
15411
  /*!
@@ -15889,7 +15895,7 @@ function normalizeRawShapeSchema(schema) {
15889
15895
  return schema;
15890
15896
  }
15891
15897
  //#endregion
15892
- //#region node_modules/.pnpm/@modelcontextprotocol+server@2.1.0/node_modules/@modelcontextprotocol/server/dist/ajvProvider-CEoC__sr.mjs
15898
+ //#region node_modules/.pnpm/@modelcontextprotocol+server@2.2.0/node_modules/@modelcontextprotocol/server/dist/ajvProvider-CEoC__sr.mjs
15893
15899
  var require_code$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
15894
15900
  Object.defineProperty(exports, "__esModule", { value: true });
15895
15901
  exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
@@ -23024,7 +23030,7 @@ var AjvJsonSchemaValidator = class {
23024
23030
  };
23025
23031
  import_ajv.Ajv;
23026
23032
  //#endregion
23027
- //#region node_modules/.pnpm/@modelcontextprotocol+server@2.1.0/node_modules/@modelcontextprotocol/server/dist/mcp-Dw2OlZ1f.mjs
23033
+ //#region node_modules/.pnpm/@modelcontextprotocol+server@2.2.0/node_modules/@modelcontextprotocol/server/dist/mcp-DYuW2ZSs.mjs
23028
23034
  const COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
23029
23035
  /**
23030
23036
  * Checks if a schema is completable (has completion metadata).
@@ -24595,7 +24601,7 @@ function unwrapOptionalSchema(schema) {
24595
24601
  return schema.def?.innerType ?? schema;
24596
24602
  }
24597
24603
  //#endregion
24598
- //#region node_modules/.pnpm/@modelcontextprotocol+server@2.1.0/node_modules/@modelcontextprotocol/server/dist/index.mjs
24604
+ //#region node_modules/.pnpm/@modelcontextprotocol+server@2.2.0/node_modules/@modelcontextprotocol/server/dist/index.mjs
24599
24605
  /** Default upper bound, in bytes, on a request body read by the HTTP entry points (4 MiB). */
24600
24606
  const DEFAULT_MAX_REQUEST_BODY_SIZE = 4194304;
24601
24607
  /** Upper bound on the number of messages accepted in one JSON-RPC batch array. */
@@ -26430,7 +26436,7 @@ const singleTag = /* @__PURE__ */ new Set([
26430
26436
  * @param node Node to be rendered.
26431
26437
  * @param options Changes serialization behavior
26432
26438
  */
26433
- function render$1(node, options = {}) {
26439
+ function render$2(node, options = {}) {
26434
26440
  const nodes = "length" in node ? node : [node];
26435
26441
  let output = "";
26436
26442
  for (let i = 0; i < nodes.length; i++) output += renderNode(nodes[i], options);
@@ -26438,7 +26444,7 @@ function render$1(node, options = {}) {
26438
26444
  }
26439
26445
  function renderNode(node, options) {
26440
26446
  switch (node.type) {
26441
- case Root: return render$1(node.children, options);
26447
+ case Root: return render$2(node.children, options);
26442
26448
  case Doctype:
26443
26449
  case Directive: return renderDirective(node);
26444
26450
  case Comment$1: return renderComment(node);
@@ -26482,7 +26488,7 @@ function renderTag(elem, opts) {
26482
26488
  tag += "/>";
26483
26489
  } else {
26484
26490
  tag += ">";
26485
- if (elem.children.length > 0) tag += render$1(elem.children, opts);
26491
+ if (elem.children.length > 0) tag += render$2(elem.children, opts);
26486
26492
  if (opts.xmlMode || !singleTag.has(elem.name)) tag += `</${elem.name}>`;
26487
26493
  }
26488
26494
  return tag;
@@ -26512,7 +26518,7 @@ function renderComment(elem) {
26512
26518
  * @returns `node`'s outer HTML.
26513
26519
  */
26514
26520
  function getOuterHTML(node, options) {
26515
- return render$1(node, options);
26521
+ return render$2(node, options);
26516
26522
  }
26517
26523
  /**
26518
26524
  * @category Stringify
@@ -27385,7 +27391,7 @@ var static_exports = /* @__PURE__ */ __exportAll$1({
27385
27391
  * @param options - Options for rendering.
27386
27392
  * @returns The rendered document.
27387
27393
  */
27388
- function render(that, dom, options) {
27394
+ function render$1(that, dom, options) {
27389
27395
  if (!that) return "";
27390
27396
  return that(dom !== null && dom !== void 0 ? dom : that._root.children, null, void 0, options).toString();
27391
27397
  }
@@ -27405,7 +27411,7 @@ function html$7(dom, options) {
27405
27411
  ...this === null || this === void 0 ? void 0 : this._options,
27406
27412
  ...flattenOptions(options)
27407
27413
  };
27408
- return render(this, toRender, opts);
27414
+ return render$1(this, toRender, opts);
27409
27415
  }
27410
27416
  /**
27411
27417
  * Render the document as XML.
@@ -27419,7 +27425,7 @@ function xml$1(dom) {
27419
27425
  ...this._options,
27420
27426
  xmlMode: true
27421
27427
  };
27422
- return render(this, dom, options);
27428
+ return render$1(this, dom, options);
27423
27429
  }
27424
27430
  /**
27425
27431
  * Render the document as text.
@@ -32803,7 +32809,7 @@ function parse$5(styles) {
32803
32809
  //#endregion
32804
32810
  //#region node_modules/.pnpm/cheerio@1.2.0/node_modules/cheerio/dist/esm/api/forms.js
32805
32811
  var forms_exports = /* @__PURE__ */ __exportAll$1({
32806
- serialize: () => serialize$2,
32812
+ serialize: () => serialize$3,
32807
32813
  serializeArray: () => serializeArray
32808
32814
  });
32809
32815
  const submittableSelector = "input,select,textarea,keygen";
@@ -32823,7 +32829,7 @@ const rCRLF = /\r?\n/g;
32823
32829
  * @returns The serialized form.
32824
32830
  * @see {@link https://api.jquery.com/serialize/}
32825
32831
  */
32826
- function serialize$2() {
32832
+ function serialize$3() {
32827
32833
  return this.serializeArray().map((data) => `${encodeURIComponent(data.name)}=${encodeURIComponent(data.value)}`).join("&").replace(r20, "+");
32828
32834
  }
32829
32835
  /**
@@ -40104,7 +40110,7 @@ function renderWithParse5(dom) {
40104
40110
  * @returns The loaded document.
40105
40111
  * @see {@link https://cheerio.js.org/docs/basics/loading#load} for additional usage information.
40106
40112
  */
40107
- const load = getLoad(getParse((content, options, isDocument, context) => options._useHtmlParser2 ? parseDocument(content, options) : parseWithParse5(content, options, isDocument, context)), (dom, options) => options._useHtmlParser2 ? render$1(dom, options) : renderWithParse5(dom));
40113
+ const load = getLoad(getParse((content, options, isDocument, context) => options._useHtmlParser2 ? parseDocument(content, options) : parseWithParse5(content, options, isDocument, context)), (dom, options) => options._useHtmlParser2 ? render$2(dom, options) : renderWithParse5(dom));
40108
40114
  //#endregion
40109
40115
  //#region node_modules/.pnpm/safer-buffer@2.1.2/node_modules/safer-buffer/safer.js
40110
40116
  var require_safer = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
@@ -73545,7 +73551,7 @@ const svg = merge([
73545
73551
  * @property {Handlers} [handlers]
73546
73552
  * Handlers to use.
73547
73553
  */
73548
- const own$11 = {}.hasOwnProperty;
73554
+ const own$12 = {}.hasOwnProperty;
73549
73555
  /**
73550
73556
  * Handle values based on a field.
73551
73557
  *
@@ -73592,9 +73598,9 @@ function zwitch(key, options) {
73592
73598
  /** @type {Handler|undefined} */
73593
73599
  let fn = one.invalid;
73594
73600
  const handlers = one.handlers;
73595
- if (value && own$11.call(value, key)) {
73601
+ if (value && own$12.call(value, key)) {
73596
73602
  const id = String(value[key]);
73597
- fn = own$11.call(handlers, id) ? handlers[id] : one.unknown;
73603
+ fn = own$12.call(handlers, id) ? handlers[id] : one.unknown;
73598
73604
  }
73599
73605
  if (fn) return fn.call(this, value, ...parameters);
73600
73606
  }
@@ -74106,7 +74112,7 @@ const dangerous = [
74106
74112
  ];
74107
74113
  //#endregion
74108
74114
  //#region node_modules/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/to-named.js
74109
- const own$10 = {}.hasOwnProperty;
74115
+ const own$11 = {}.hasOwnProperty;
74110
74116
  /**
74111
74117
  * `characterEntitiesHtml4` but inverted.
74112
74118
  *
@@ -74115,7 +74121,7 @@ const own$10 = {}.hasOwnProperty;
74115
74121
  const characters = {};
74116
74122
  /** @type {string} */
74117
74123
  let key;
74118
- for (key in characterEntitiesHtml4) if (own$10.call(characterEntitiesHtml4, key)) characters[characterEntitiesHtml4[key]] = key;
74124
+ for (key in characterEntitiesHtml4) if (own$11.call(characterEntitiesHtml4, key)) characters[characterEntitiesHtml4[key]] = key;
74119
74125
  const notAlphanumericRegex = /[^\dA-Za-z]/;
74120
74126
  /**
74121
74127
  * Configurable ways to encode characters as named references.
@@ -74128,7 +74134,7 @@ const notAlphanumericRegex = /[^\dA-Za-z]/;
74128
74134
  */
74129
74135
  function toNamed(code, next, omit, attribute) {
74130
74136
  const character = String.fromCharCode(code);
74131
- if (own$10.call(characters, character)) {
74137
+ if (own$11.call(characters, character)) {
74132
74138
  const name = characters[character];
74133
74139
  const value = "&" + name;
74134
74140
  if (omit && characterEntitiesLegacy.includes(name) && !dangerous.includes(name) && (!attribute || next && next !== 61 && notAlphanumericRegex.test(String.fromCharCode(next)))) return value;
@@ -74437,7 +74443,7 @@ function siblings(increment) {
74437
74443
  * Whether to omit a tag.
74438
74444
  *
74439
74445
  */
74440
- const own$9 = {}.hasOwnProperty;
74446
+ const own$10 = {}.hasOwnProperty;
74441
74447
  /**
74442
74448
  * Factory to check if a given node can have a tag omitted.
74443
74449
  *
@@ -74455,7 +74461,7 @@ function omission(handlers) {
74455
74461
  * @type {OmitHandle}
74456
74462
  */
74457
74463
  function omit(node, index, parent) {
74458
- return own$9.call(handlers, node.tagName) && handlers[node.tagName](node, index, parent);
74464
+ return own$10.call(handlers, node.tagName) && handlers[node.tagName](node, index, parent);
74459
74465
  }
74460
74466
  }
74461
74467
  //#endregion
@@ -75786,7 +75792,7 @@ const webNamespaces = {
75786
75792
  * @property {boolean | undefined} verbose
75787
75793
  * Add extra positional info.
75788
75794
  */
75789
- const own$8 = {}.hasOwnProperty;
75795
+ const own$9 = {}.hasOwnProperty;
75790
75796
  /** @type {unknown} */
75791
75797
  const proto = Object.prototype;
75792
75798
  /**
@@ -75911,7 +75917,7 @@ function element$3(state, node) {
75911
75917
  while (++index < node.attrs.length) {
75912
75918
  const attribute = node.attrs[index];
75913
75919
  const name = (attribute.prefix ? attribute.prefix + ":" : "") + attribute.name;
75914
- if (!own$8.call(proto, name)) properties[name] = attribute.value;
75920
+ if (!own$9.call(proto, name)) properties[name] = attribute.value;
75915
75921
  }
75916
75922
  const result = (state.schema.space === "svg" ? s : h)(node.tagName, properties, all$6(state, node.childNodes));
75917
75923
  patch$3(state, node, result);
@@ -75974,7 +75980,7 @@ function createLocation(state, node, location) {
75974
75980
  /** @type {string} */
75975
75981
  let key;
75976
75982
  if (location.attrs) {
75977
- for (key in location.attrs) if (own$8.call(location.attrs, key)) properties[find(state.schema, key).property] = position$2(location.attrs[key]);
75983
+ for (key in location.attrs) if (own$9.call(location.attrs, key)) properties[find(state.schema, key).property] = position$2(location.attrs[key]);
75978
75984
  }
75979
75985
  location.startTag;
75980
75986
  const opening = position$2(location.startTag);
@@ -77621,7 +77627,7 @@ const serializer = (strict, json, $, _) => {
77621
77627
  * like JSON stringify would behave. Symbol and Function will be discarded.
77622
77628
  * @returns {Record[]}
77623
77629
  */
77624
- const serialize$1 = (value, { json, lossy } = {}) => {
77630
+ const serialize$2 = (value, { json, lossy } = {}) => {
77625
77631
  const _ = [];
77626
77632
  return serializer(!(json || lossy), !!json, /* @__PURE__ */ new Map(), _)(value), _;
77627
77633
  };
@@ -77640,7 +77646,7 @@ const serialize$1 = (value, { json, lossy } = {}) => {
77640
77646
  */
77641
77647
  var esm_default = typeof structuredClone === "function" ?
77642
77648
  /* c8 ignore start */
77643
- (any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize$1(any, options)) : structuredClone(any) : (any, options) => deserialize(serialize$1(any, options));
77649
+ (any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize$2(any, options)) : structuredClone(any) : (any, options) => deserialize(serialize$2(any, options));
77644
77650
  //#endregion
77645
77651
  //#region node_modules/.pnpm/hast-util-to-parse5@8.0.1/node_modules/hast-util-to-parse5/lib/index.js
77646
77652
  /**
@@ -77674,7 +77680,7 @@ var esm_default = typeof structuredClone === "function" ?
77674
77680
  */
77675
77681
  /** @type {Options} */
77676
77682
  const emptyOptions$5 = {};
77677
- const own$7 = {}.hasOwnProperty;
77683
+ const own$8 = {}.hasOwnProperty;
77678
77684
  const one$2 = zwitch("type", { handlers: {
77679
77685
  root: root$4,
77680
77686
  element: element$2,
@@ -77800,7 +77806,7 @@ function element$2(node, schema) {
77800
77806
  /** @type {string} */
77801
77807
  let prop;
77802
77808
  if (node.properties) {
77803
- for (prop in node.properties) if (prop !== "children" && own$7.call(node.properties, prop)) {
77809
+ for (prop in node.properties) if (prop !== "children" && own$8.call(node.properties, prop)) {
77804
77810
  const result = createProperty(currentSchema, prop, node.properties[prop]);
77805
77811
  if (result) attrs.push(result);
77806
77812
  }
@@ -80413,7 +80419,7 @@ const prefix = "language-";
80413
80419
  * @returns {Code}
80414
80420
  * mdast node.
80415
80421
  */
80416
- function code$3(state, node) {
80422
+ function code$4(state, node) {
80417
80423
  const children = node.children;
80418
80424
  let index = -1;
80419
80425
  /** @type {Array<number | string> | undefined} */
@@ -80968,7 +80974,7 @@ function input(state, node) {
80968
80974
  * @typedef {import('hast').Element} Element
80969
80975
  * @typedef {import('hast').Nodes} Nodes
80970
80976
  */
80971
- const own$6 = {}.hasOwnProperty;
80977
+ const own$7 = {}.hasOwnProperty;
80972
80978
  /**
80973
80979
  * Check if `node` is an element and has a `name` property.
80974
80980
  *
@@ -80984,7 +80990,7 @@ const own$6 = {}.hasOwnProperty;
80984
80990
  * Note: see <https://github.com/DefinitelyTyped/DefinitelyTyped/blob/27c9274/types/hast/index.d.ts#L37C29-L37C98>.
80985
80991
  */
80986
80992
  function hasProperty(node, name) {
80987
- const value = node.type === "element" && own$6.call(node.properties, name) && node.properties[name];
80993
+ const value = node.type === "element" && own$7.call(node.properties, name) && node.properties[name];
80988
80994
  return value !== null && value !== void 0 && value !== false;
80989
80995
  }
80990
80996
  //#endregion
@@ -81074,7 +81080,7 @@ const meta = convertElement("meta");
81074
81080
  * @returns {boolean}
81075
81081
  * Whether `value` is phrasing content.
81076
81082
  */
81077
- function phrasing$2(value) {
81083
+ function phrasing$3(value) {
81078
81084
  return Boolean(value.type === "text" || basic(value) || embedded(value) || isBodyOkLink(value) || meta(value) && hasProperty(value, "itemProp"));
81079
81085
  }
81080
81086
  //#endregion
@@ -81142,7 +81148,7 @@ function spreadout(node) {
81142
81148
  while (++index < node.children.length) {
81143
81149
  const child = node.children[index];
81144
81150
  if (child.type === "element") {
81145
- if (phrasing$2(child)) continue;
81151
+ if (phrasing$3(child)) continue;
81146
81152
  if (child.tagName === "p" || seenFlow || spreadout(child)) return true;
81147
81153
  seenFlow = true;
81148
81154
  }
@@ -81346,7 +81352,7 @@ function node(value) {
81346
81352
  * @returns
81347
81353
  * Whether `value` is phrasing content.
81348
81354
  */
81349
- const phrasing$1 = convert([
81355
+ const phrasing$2 = convert([
81350
81356
  "break",
81351
81357
  "delete",
81352
81358
  "emphasis",
@@ -81392,7 +81398,7 @@ function wrapNeeded(nodes) {
81392
81398
  let index = -1;
81393
81399
  while (++index < nodes.length) {
81394
81400
  const node = nodes[index];
81395
- if (!phrasing(node) || "children" in node && wrapNeeded(node.children)) return true;
81401
+ if (!phrasing$1(node) || "children" in node && wrapNeeded(node.children)) return true;
81396
81402
  }
81397
81403
  return false;
81398
81404
  }
@@ -81478,7 +81484,7 @@ function runs(nodes, onphrasing, onnonphrasing) {
81478
81484
  let index = -1;
81479
81485
  while (++index < flattened.length) {
81480
81486
  const node = flattened[index];
81481
- if (phrasing(node)) queue.push(node);
81487
+ if (phrasing$1(node)) queue.push(node);
81482
81488
  else {
81483
81489
  if (queue.length > 0) {
81484
81490
  result.push(...onphrasing(queue));
@@ -81523,14 +81529,14 @@ function flatten(nodes) {
81523
81529
  * Whether `node` is phrasing content (includes nodes with `hName` fields
81524
81530
  * set to phrasing hast element names).
81525
81531
  */
81526
- function phrasing(node) {
81532
+ function phrasing$1(node) {
81527
81533
  const tagName = node.data && node.data.hName;
81528
- return tagName ? phrasing$2({
81534
+ return tagName ? phrasing$3({
81529
81535
  type: "element",
81530
81536
  tagName,
81531
81537
  properties: {},
81532
81538
  children: []
81533
- }) : phrasing$1(node);
81539
+ }) : phrasing$2(node);
81534
81540
  }
81535
81541
  /**
81536
81542
  * @template {Parents} ParentType
@@ -82186,12 +82192,12 @@ const handlers$1 = {
82186
82192
  input,
82187
82193
  kbd: inlineCode$2,
82188
82194
  li,
82189
- listing: code$3,
82195
+ listing: code$4,
82190
82196
  mark: em,
82191
82197
  ol: list$4,
82192
82198
  p,
82193
- plaintext: code$3,
82194
- pre: code$3,
82199
+ plaintext: code$4,
82200
+ pre: code$4,
82195
82201
  q,
82196
82202
  s: del,
82197
82203
  samp: inlineCode$2,
@@ -82210,7 +82216,7 @@ const handlers$1 = {
82210
82216
  var: inlineCode$2,
82211
82217
  video: media,
82212
82218
  wbr,
82213
- xmp: code$3
82219
+ xmp: code$4
82214
82220
  };
82215
82221
  /**
82216
82222
  * @param {State} state
@@ -82396,7 +82402,7 @@ function ignore$1() {}
82396
82402
  * @returns {Array<MdastFlowContent>}
82397
82403
  * mdast flow children.
82398
82404
  */
82399
- const own$5 = {}.hasOwnProperty;
82405
+ const own$6 = {}.hasOwnProperty;
82400
82406
  /**
82401
82407
  * Create a state.
82402
82408
  *
@@ -82469,8 +82475,8 @@ function all(parent) {
82469
82475
  function one(node, parent) {
82470
82476
  if (node.type === "element") {
82471
82477
  if (node.properties && node.properties.dataMdast === "ignore") return;
82472
- if (own$5.call(this.handlers, node.tagName)) return this.handlers[node.tagName](this, node, parent) || void 0;
82473
- } else if (own$5.call(this.nodeHandlers, node.type)) return this.nodeHandlers[node.type](this, node, parent) || void 0;
82478
+ if (own$6.call(this.handlers, node.tagName)) return this.handlers[node.tagName](this, node, parent) || void 0;
82479
+ } else if (own$6.call(this.nodeHandlers, node.type)) return this.nodeHandlers[node.type](this, node, parent) || void 0;
82474
82480
  if ("value" in node && typeof node.value === "string") {
82475
82481
  /** @type {MdastRootContent} */
82476
82482
  const result = {
@@ -83631,17 +83637,20 @@ function mapAll(line, index, blank) {
83631
83637
  return (blank ? "" : " ") + line;
83632
83638
  }
83633
83639
  //#endregion
83634
- //#region node_modules/.pnpm/mdast-util-gfm-strikethrough@2.0.0_supports-color@7.2.0/node_modules/mdast-util-gfm-strikethrough/lib/index.js
83640
+ //#region node_modules/.pnpm/mdast-util-gfm-strikethrough@2.0.1_supports-color@7.2.0/node_modules/mdast-util-gfm-strikethrough/lib/index.js
83635
83641
  /**
83636
- * @typedef {import('mdast').Delete} Delete
83637
- *
83638
- * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext
83639
- * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
83640
- * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle
83641
- *
83642
- * @typedef {import('mdast-util-to-markdown').ConstructName} ConstructName
83643
- * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle
83644
- * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
83642
+ * @import {Delete} from 'mdast'
83643
+ * @import {
83644
+ * CompileContext,
83645
+ * Extension as FromMarkdownExtension,
83646
+ * Handle as FromMarkdownHandle
83647
+ * } from 'mdast-util-from-markdown'
83648
+ * @import {
83649
+ * Attention,
83650
+ * ConstructName,
83651
+ * Handle as ToMarkdownHandle,
83652
+ * Options as ToMarkdownExtension
83653
+ * } from 'mdast-util-to-markdown'
83645
83654
  */
83646
83655
  /**
83647
83656
  * List of constructs that occur in phrasing (paragraphs, headings), but cannot
@@ -83661,6 +83670,7 @@ const constructsWithoutStrikethrough = [
83661
83670
  "titleQuote",
83662
83671
  "titleApostrophe"
83663
83672
  ];
83673
+ handleDelete.attention = attentionDelete;
83664
83674
  handleDelete.peek = peekDelete;
83665
83675
  /**
83666
83676
  * Create an extension for `mdast-util-from-markdown` to enable GFM
@@ -83685,25 +83695,30 @@ function gfmStrikethroughFromMarkdown() {
83685
83695
  */
83686
83696
  function gfmStrikethroughToMarkdown() {
83687
83697
  return {
83698
+ handlers: { delete: handleDelete },
83688
83699
  unsafe: [{
83689
83700
  character: "~",
83690
83701
  inConstruct: "phrasing",
83691
83702
  notInConstruct: constructsWithoutStrikethrough
83692
- }],
83693
- handlers: { delete: handleDelete }
83703
+ }]
83694
83704
  };
83695
83705
  }
83696
83706
  /**
83707
+ * Enter strikethrough.
83708
+ *
83697
83709
  * @this {CompileContext}
83698
83710
  * @type {FromMarkdownHandle}
83699
83711
  */
83700
83712
  function enterStrikethrough(token) {
83701
83713
  this.enter({
83702
83714
  type: "delete",
83703
- children: []
83715
+ children: [],
83716
+ position: void 0
83704
83717
  }, token);
83705
83718
  }
83706
83719
  /**
83720
+ * Exit strikethrough.
83721
+ *
83707
83722
  * @this {CompileContext}
83708
83723
  * @type {FromMarkdownHandle}
83709
83724
  */
@@ -83711,23 +83726,43 @@ function exitStrikethrough(token) {
83711
83726
  this.exit(token);
83712
83727
  }
83713
83728
  /**
83729
+ * Serialize a delete node.
83730
+ *
83714
83731
  * @type {ToMarkdownHandle}
83715
83732
  * @param {Delete} node
83733
+ * Node to serialize.
83716
83734
  */
83717
83735
  function handleDelete(node, _, state, info) {
83718
83736
  const tracker = state.createTracker(info);
83737
+ const sequence = state.stack.includes("strikethrough") ? "~" : "~~";
83719
83738
  const exit = state.enter("strikethrough");
83720
- let value = tracker.move("~~");
83739
+ let value = tracker.move(sequence);
83721
83740
  value += state.containerPhrasing(node, {
83722
83741
  ...tracker.current(),
83723
83742
  before: value,
83724
83743
  after: "~"
83725
83744
  });
83726
- value += tracker.move("~~");
83745
+ value += tracker.move(sequence);
83727
83746
  exit();
83728
83747
  return value;
83729
83748
  }
83730
- /** @type {ToMarkdownHandle} */
83749
+ /**
83750
+ * Serialize a delete node as attention.
83751
+ *
83752
+ * @type {Attention}
83753
+ */
83754
+ function attentionDelete() {
83755
+ return {
83756
+ construct: "strikethrough",
83757
+ markers: ["~"],
83758
+ sizes: [2, 1]
83759
+ };
83760
+ }
83761
+ /**
83762
+ * Peek the first character of a delete node.
83763
+ *
83764
+ * @type {ToMarkdownHandle}
83765
+ */
83731
83766
  function peekDelete() {
83732
83767
  return "~";
83733
83768
  }
@@ -83920,7 +83955,7 @@ function markdownTable(table, options) {
83920
83955
  let columnIndex = -1;
83921
83956
  if (table[rowIndex].length > mostCellsPerRow) mostCellsPerRow = table[rowIndex].length;
83922
83957
  while (++columnIndex < table[rowIndex].length) {
83923
- const cell = serialize(table[rowIndex][columnIndex]);
83958
+ const cell = serialize$1(table[rowIndex][columnIndex]);
83924
83959
  if (settings.alignDelimiters !== false) {
83925
83960
  const size = stringLength(cell);
83926
83961
  sizes[columnIndex] = size;
@@ -84007,7 +84042,7 @@ function markdownTable(table, options) {
84007
84042
  * @returns {string}
84008
84043
  * Result.
84009
84044
  */
84010
- function serialize(value) {
84045
+ function serialize$1(value) {
84011
84046
  return value === null || value === void 0 ? "" : String(value);
84012
84047
  }
84013
84048
  /**
@@ -84021,22 +84056,27 @@ function toAlignment(value) {
84021
84056
  return code === 67 || code === 99 ? 99 : code === 76 || code === 108 ? 108 : code === 82 || code === 114 ? 114 : 0;
84022
84057
  }
84023
84058
  //#endregion
84024
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/configure.js
84059
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/configure.js
84025
84060
  /**
84026
84061
  * @import {Options, State} from './types.js'
84027
84062
  */
84028
- const own$4 = {}.hasOwnProperty;
84063
+ const own$5 = {}.hasOwnProperty;
84029
84064
  /**
84065
+ * Configure a base state w/ an extension.
84066
+ *
84030
84067
  * @param {State} base
84068
+ * Base state to configure.
84031
84069
  * @param {Options} extension
84070
+ * Extension to apply.
84032
84071
  * @returns {State}
84072
+ * Given `base`.
84033
84073
  */
84034
84074
  function configure$1(base, extension) {
84035
84075
  let index = -1;
84036
84076
  /** @type {keyof Options} */
84037
84077
  let key;
84038
84078
  if (extension.extensions) while (++index < extension.extensions.length) configure$1(base, extension.extensions[index]);
84039
- for (key in extension) if (own$4.call(extension, key)) switch (key) {
84079
+ for (key in extension) if (own$5.call(extension, key)) switch (key) {
84040
84080
  case "extensions": break;
84041
84081
  /* c8 ignore next 4 */
84042
84082
  case "unsafe":
@@ -84053,33 +84093,54 @@ function configure$1(base, extension) {
84053
84093
  return base;
84054
84094
  }
84055
84095
  /**
84096
+ * Merge arrays from the extension into the base state.
84097
+ *
84056
84098
  * @template T
84099
+ * Kind.
84057
84100
  * @param {Array<T>} left
84101
+ * List to merge into.
84058
84102
  * @param {Array<T> | null | undefined} right
84103
+ * List to merge from.
84104
+ * @returns {undefined}
84105
+ * Nothing.
84059
84106
  */
84060
84107
  function list$3(left, right) {
84061
84108
  if (right) left.push(...right);
84062
84109
  }
84063
84110
  /**
84111
+ * Merge objects from the extension into the base state.
84112
+ *
84064
84113
  * @template T
84114
+ * Kind.
84065
84115
  * @param {Record<string, T>} left
84116
+ * Object to merge into.
84066
84117
  * @param {Record<string, T> | null | undefined} right
84118
+ * Object to merge from.
84119
+ * @returns {undefined}
84120
+ * Nothing.
84067
84121
  */
84068
84122
  function map$2(left, right) {
84069
84123
  if (right) Object.assign(left, right);
84070
84124
  }
84071
84125
  //#endregion
84072
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
84126
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
84073
84127
  /**
84074
84128
  * @import {Blockquote, Parents} from 'mdast'
84075
84129
  * @import {Info, Map, State} from 'mdast-util-to-markdown'
84076
84130
  */
84077
84131
  /**
84132
+ * Serialize a blockquote node.
84133
+ *
84078
84134
  * @param {Blockquote} node
84135
+ * Node to serialize.
84079
84136
  * @param {Parents | undefined} _
84137
+ * Parent node.
84080
84138
  * @param {State} state
84139
+ * Info passed around.
84081
84140
  * @param {Info} info
84141
+ * Info on surrounding context.
84082
84142
  * @returns {string}
84143
+ * Serialized markdown.
84083
84144
  */
84084
84145
  function blockquote$1(node, _, state, info) {
84085
84146
  const exit = state.enter("blockquote");
@@ -84090,28 +84151,43 @@ function blockquote$1(node, _, state, info) {
84090
84151
  exit();
84091
84152
  return value;
84092
84153
  }
84093
- /** @type {Map} */
84154
+ /**
84155
+ * Indent lines w/ blockquote markers.
84156
+ *
84157
+ * @type {Map}
84158
+ */
84094
84159
  function map$1(line, _, blank) {
84095
84160
  return ">" + (blank ? "" : " ") + line;
84096
84161
  }
84097
84162
  //#endregion
84098
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
84163
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
84099
84164
  /**
84100
84165
  * @import {ConstructName, Unsafe} from 'mdast-util-to-markdown'
84101
84166
  */
84102
84167
  /**
84168
+ * Check if a pattern is in scope based on the current stack of constructs.
84169
+ *
84103
84170
  * @param {Array<ConstructName>} stack
84171
+ * Current stack of constructs.
84104
84172
  * @param {Unsafe} pattern
84173
+ * Pattern to check.
84105
84174
  * @returns {boolean}
84175
+ * Whether the pattern is in scope.
84106
84176
  */
84107
84177
  function patternInScope(stack, pattern) {
84108
84178
  return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);
84109
84179
  }
84110
84180
  /**
84181
+ * Check if any of the constructs in the list are present in the stack.
84182
+ *
84111
84183
  * @param {Array<ConstructName>} stack
84184
+ * Current stack of constructs.
84112
84185
  * @param {Unsafe['inConstruct']} list
84186
+ * List of constructs to check for in the stack.
84113
84187
  * @param {boolean} none
84188
+ * Value to return if the list is empty or not provided.
84114
84189
  * @returns {boolean}
84190
+ * Whether any of the constructs in the list are present in the stack.
84115
84191
  */
84116
84192
  function listInScope(stack, list, none) {
84117
84193
  if (typeof list === "string") list = [list];
@@ -84121,21 +84197,31 @@ function listInScope(stack, list, none) {
84121
84197
  return false;
84122
84198
  }
84123
84199
  //#endregion
84124
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/break.js
84200
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/break.js
84125
84201
  /**
84126
84202
  * @import {Break, Parents} from 'mdast'
84127
84203
  * @import {Info, State} from 'mdast-util-to-markdown'
84128
84204
  */
84129
84205
  /**
84206
+ * Serialize a break node.
84207
+ *
84130
84208
  * @param {Break} _
84209
+ * Node to serialize.
84131
84210
  * @param {Parents | undefined} _1
84211
+ * Parent node.
84132
84212
  * @param {State} state
84213
+ * Info passed around.
84133
84214
  * @param {Info} info
84215
+ * Info on surrounding context.
84134
84216
  * @returns {string}
84217
+ * Serialized markdown.
84135
84218
  */
84136
84219
  function hardBreak$1(_, _1, state, info) {
84137
84220
  let index = -1;
84138
- while (++index < state.unsafe.length) if (state.unsafe[index].character === "\n" && patternInScope(state.stack, state.unsafe[index])) return /[ \t]/.test(info.before) ? "" : " ";
84221
+ while (++index < state.unsafe.length) {
84222
+ const pattern = state.unsafe[index];
84223
+ if (pattern.character === "\n" && !pattern.before && !pattern.after && patternInScope(state.stack, pattern)) return /[\t ]/.test(info.before) ? "" : " ";
84224
+ }
84139
84225
  return "\\\n";
84140
84226
  }
84141
84227
  //#endregion
@@ -84167,27 +84253,36 @@ function longestStreak(value, substring) {
84167
84253
  return max;
84168
84254
  }
84169
84255
  //#endregion
84170
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
84256
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
84171
84257
  /**
84172
84258
  * @import {State} from 'mdast-util-to-markdown'
84173
84259
  * @import {Code} from 'mdast'
84174
84260
  */
84175
84261
  /**
84262
+ * Checks if a code block can be formatted as an indented code block.
84263
+ *
84176
84264
  * @param {Code} node
84265
+ * Node to check.
84177
84266
  * @param {State} state
84267
+ * Info passed around.
84178
84268
  * @returns {boolean}
84269
+ * Whether the code can be formatted as an indented code block.
84179
84270
  */
84180
84271
  function formatCodeAsIndented(node, state) {
84181
- return Boolean(state.options.fences === false && node.value && !node.lang && /[^ \r\n]/.test(node.value) && !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node.value));
84272
+ return Boolean(state.options.fences === false && node.value && !node.lang && /[^\n\r ]/.test(node.value) && !/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(node.value));
84182
84273
  }
84183
84274
  //#endregion
84184
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-fence.js
84275
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/check-fence.js
84185
84276
  /**
84186
84277
  * @import {Options, State} from 'mdast-util-to-markdown'
84187
84278
  */
84188
84279
  /**
84280
+ * Checks the preferred fence option.
84281
+ *
84189
84282
  * @param {State} state
84283
+ * Info passed around.
84190
84284
  * @returns {Exclude<Options['fence'], null | undefined>}
84285
+ * Preferred fence marker.
84191
84286
  */
84192
84287
  function checkFence(state) {
84193
84288
  const marker = state.options.fence || "`";
@@ -84195,22 +84290,28 @@ function checkFence(state) {
84195
84290
  return marker;
84196
84291
  }
84197
84292
  //#endregion
84198
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/code.js
84293
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/code.js
84199
84294
  /**
84200
84295
  * @import {Info, Map, State} from 'mdast-util-to-markdown'
84201
84296
  * @import {Code, Parents} from 'mdast'
84202
84297
  */
84203
84298
  /**
84299
+ * Serialize a code node.
84300
+ *
84204
84301
  * @param {Code} node
84302
+ * Node to serialize.
84205
84303
  * @param {Parents | undefined} _
84304
+ * Parent node.
84206
84305
  * @param {State} state
84306
+ * Info passed around.
84207
84307
  * @param {Info} info
84308
+ * Info on surrounding context.
84208
84309
  * @returns {string}
84310
+ * Serialized markdown.
84209
84311
  */
84210
- function code$2(node, _, state, info) {
84312
+ function code$3(node, _, state, info) {
84211
84313
  const marker = checkFence(state);
84212
84314
  const raw = node.value || "";
84213
- const suffix = marker === "`" ? "GraveAccent" : "Tilde";
84214
84315
  if (formatCodeAsIndented(node, state)) {
84215
84316
  const exit = state.enter("codeIndented");
84216
84317
  const value = state.indentLines(raw, map);
@@ -84220,6 +84321,7 @@ function code$2(node, _, state, info) {
84220
84321
  const tracker = state.createTracker(info);
84221
84322
  const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
84222
84323
  const exit = state.enter("codeFenced");
84324
+ const suffix = marker === "`" ? "GraveAccent" : "Tilde";
84223
84325
  let value = tracker.move(sequence);
84224
84326
  if (node.lang) {
84225
84327
  const subexit = state.enter(`codeFencedLang${suffix}`);
@@ -84248,18 +84350,26 @@ function code$2(node, _, state, info) {
84248
84350
  exit();
84249
84351
  return value;
84250
84352
  }
84251
- /** @type {Map} */
84353
+ /**
84354
+ * Indent lines w/ code indent.
84355
+ *
84356
+ * @type {Map}
84357
+ */
84252
84358
  function map(line, _, blank) {
84253
84359
  return (blank ? "" : " ") + line;
84254
84360
  }
84255
84361
  //#endregion
84256
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-quote.js
84362
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/check-quote.js
84257
84363
  /**
84258
84364
  * @import {Options, State} from 'mdast-util-to-markdown'
84259
84365
  */
84260
84366
  /**
84367
+ * Checks the preferred quote option.
84368
+ *
84261
84369
  * @param {State} state
84370
+ * Info passed around.
84262
84371
  * @returns {Exclude<Options['quote'], null | undefined>}
84372
+ * Preferred quote.
84263
84373
  */
84264
84374
  function checkQuote(state) {
84265
84375
  const marker = state.options.quote || "\"";
@@ -84267,17 +84377,24 @@ function checkQuote(state) {
84267
84377
  return marker;
84268
84378
  }
84269
84379
  //#endregion
84270
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/definition.js
84380
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/definition.js
84271
84381
  /**
84272
84382
  * @import {Info, State} from 'mdast-util-to-markdown'
84273
84383
  * @import {Definition, Parents} from 'mdast'
84274
84384
  */
84275
84385
  /**
84386
+ * Serialize a definition node.
84387
+ *
84276
84388
  * @param {Definition} node
84389
+ * Node to serialize.
84277
84390
  * @param {Parents | undefined} _
84391
+ * Parent node.
84278
84392
  * @param {State} state
84393
+ * Info passed around.
84279
84394
  * @param {Info} info
84395
+ * Info on surrounding context.
84280
84396
  * @returns {string}
84397
+ * Serialized markdown.
84281
84398
  */
84282
84399
  function definition$1(node, _, state, info) {
84283
84400
  const quote = checkQuote(state);
@@ -84326,13 +84443,17 @@ function definition$1(node, _, state, info) {
84326
84443
  return value;
84327
84444
  }
84328
84445
  //#endregion
84329
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js
84446
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js
84330
84447
  /**
84331
84448
  * @import {Options, State} from 'mdast-util-to-markdown'
84332
84449
  */
84333
84450
  /**
84451
+ * Checks the preferred emphasis option.
84452
+ *
84334
84453
  * @param {State} state
84454
+ * Info passed around.
84335
84455
  * @returns {Exclude<Options['emphasis'], null | undefined>}
84456
+ * Preferred emphasis marker.
84336
84457
  */
84337
84458
  function checkEmphasis(state) {
84338
84459
  const marker = state.options.emphasis || "*";
@@ -84340,170 +84461,98 @@ function checkEmphasis(state) {
84340
84461
  return marker;
84341
84462
  }
84342
84463
  //#endregion
84343
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
84464
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
84344
84465
  /**
84345
- * Encode a code point as a character reference.
84346
- *
84347
- * @param {number} code
84348
- * Code point to encode.
84349
- * @returns {string}
84350
- * Encoded character reference.
84351
- */
84352
- function encodeCharacterReference(code) {
84353
- return "&#x" + code.toString(16).toUpperCase() + ";";
84354
- }
84355
- //#endregion
84356
- //#region node_modules/.pnpm/micromark-util-classify-character@2.0.1/node_modules/micromark-util-classify-character/index.js
84357
- /**
84358
- * @import {Code} from 'micromark-util-types'
84359
- */
84360
- /**
84361
- * Classify whether a code represents whitespace, punctuation, or something
84362
- * else.
84363
- *
84364
- * Used for attention (emphasis, strong), whose sequences can open or close
84365
- * based on the class of surrounding characters.
84366
- *
84367
- * > 👉 **Note**: eof (`null`) is seen as whitespace.
84368
- *
84369
- * @param {Code} code
84370
- * Code.
84371
- * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}
84372
- * Group.
84373
- */
84374
- function classifyCharacter(code) {
84375
- if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) return 1;
84376
- if (unicodePunctuation(code)) return 2;
84377
- }
84378
- //#endregion
84379
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/encode-info.js
84380
- /**
84381
- * @import {EncodeSides} from '../types.js'
84466
+ * @import {AttentionInfo, Info, State} from 'mdast-util-to-markdown'
84467
+ * @import {Emphasis, Parents} from 'mdast'
84382
84468
  */
84469
+ emphasis$1.attention = attention$2;
84470
+ emphasis$1.peek = peek$1;
84383
84471
  /**
84384
- * Check whether to encode (as a character reference) the characters
84385
- * surrounding an attention run.
84386
- *
84387
- * Which characters are around an attention run influence whether it works or
84388
- * not.
84389
- *
84390
- * See <https://github.com/orgs/syntax-tree/discussions/60> for more info.
84391
- * See this markdown in a particular renderer to see what works:
84472
+ * Serialize an emphasis node.
84392
84473
  *
84393
- * ```markdown
84394
- * | | A (letter inside) | B (punctuation inside) | C (whitespace inside) | D (nothing inside) |
84395
- * | ----------------------- | ----------------- | ---------------------- | --------------------- | ------------------ |
84396
- * | 1 (letter outside) | x*y*z | x*.*z | x* *z | x**z |
84397
- * | 2 (punctuation outside) | .*y*. | .*.*. | .* *. | .**. |
84398
- * | 3 (whitespace outside) | x *y* z | x *.* z | x * * z | x ** z |
84399
- * | 4 (nothing outside) | *x* | *.* | * * | ** |
84400
- * ```
84474
+ * Attention is properly handled by `containerPhrasing`.
84401
84475
  *
84402
- * @param {number} outside
84403
- * Code point on the outer side of the run.
84404
- * @param {number} inside
84405
- * Code point on the inner side of the run.
84406
- * @param {'*' | '_'} marker
84407
- * Marker of the run.
84408
- * Underscores are handled more strictly (they form less often) than
84409
- * asterisks.
84410
- * @returns {EncodeSides}
84411
- * Whether to encode characters.
84412
- */
84413
- function encodeInfo(outside, inside, marker) {
84414
- const outsideKind = classifyCharacter(outside);
84415
- const insideKind = classifyCharacter(inside);
84416
- if (outsideKind === void 0) return insideKind === void 0 ? marker === "_" ? {
84417
- inside: true,
84418
- outside: true
84419
- } : {
84420
- inside: false,
84421
- outside: false
84422
- } : insideKind === 1 ? {
84423
- inside: true,
84424
- outside: true
84425
- } : {
84426
- inside: false,
84427
- outside: true
84428
- };
84429
- if (outsideKind === 1) return insideKind === void 0 ? {
84430
- inside: false,
84431
- outside: false
84432
- } : insideKind === 1 ? {
84433
- inside: true,
84434
- outside: true
84435
- } : {
84436
- inside: false,
84437
- outside: false
84438
- };
84439
- return insideKind === void 0 ? {
84440
- inside: false,
84441
- outside: false
84442
- } : insideKind === 1 ? {
84443
- inside: true,
84444
- outside: false
84445
- } : {
84446
- inside: false,
84447
- outside: false
84448
- };
84449
- }
84450
- //#endregion
84451
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
84452
- /**
84453
- * @import {Info, State} from 'mdast-util-to-markdown'
84454
- * @import {Emphasis, Parents} from 'mdast'
84455
- */
84456
- emphasis$1.peek = emphasisPeek;
84457
- /**
84458
84476
  * @param {Emphasis} node
84477
+ * Node to serialize.
84459
84478
  * @param {Parents | undefined} _
84479
+ * Parent node.
84460
84480
  * @param {State} state
84481
+ * Info passed around.
84461
84482
  * @param {Info} info
84483
+ * Info on surrounding context.
84462
84484
  * @returns {string}
84485
+ * Serialized markdown.
84463
84486
  */
84464
84487
  function emphasis$1(node, _, state, info) {
84465
- const marker = checkEmphasis(state);
84466
- const exit = state.enter("emphasis");
84467
- const tracker = state.createTracker(info);
84468
- const before = tracker.move(marker);
84469
- let between = tracker.move(state.containerPhrasing(node, {
84470
- after: marker,
84471
- before,
84472
- ...tracker.current()
84473
- }));
84474
- const betweenHead = between.charCodeAt(0);
84475
- const open = encodeInfo(info.before.charCodeAt(info.before.length - 1), betweenHead, marker);
84476
- if (open.inside) between = encodeCharacterReference(betweenHead) + between.slice(1);
84477
- const betweenTail = between.charCodeAt(between.length - 1);
84478
- const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
84479
- if (close.inside) between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
84480
- const after = tracker.move(marker);
84488
+ const exit = state.enter("phrasing");
84489
+ const value = state.containerPhrasing({
84490
+ type: "root",
84491
+ children: [node]
84492
+ }, info);
84481
84493
  exit();
84482
- state.attentionEncodeSurroundingInfo = {
84483
- after: close.outside,
84484
- before: open.outside
84494
+ return value;
84495
+ }
84496
+ /**
84497
+ * Serialize an emphasis node as attention.
84498
+ *
84499
+ * @param {Emphasis} _
84500
+ * Node to serialize.
84501
+ * @param {State} state
84502
+ * Info passed around.
84503
+ * @returns {AttentionInfo}
84504
+ * Info on how to serialize the node.
84505
+ */
84506
+ function attention$2(_, state) {
84507
+ return {
84508
+ construct: "emphasis",
84509
+ markers: checkEmphasis(state) === "*" ? ["*", "_"] : ["_", "*"],
84510
+ sizes: [1]
84485
84511
  };
84486
- return before + between + after;
84487
84512
  }
84488
84513
  /**
84514
+ * Peek at this node.
84515
+ *
84489
84516
  * @param {Emphasis} _
84517
+ * Node to serialize.
84490
84518
  * @param {Parents | undefined} _1
84519
+ * Parent node.
84491
84520
  * @param {State} state
84521
+ * Info passed around.
84492
84522
  * @returns {string}
84523
+ * Start of the serialized markdown.
84493
84524
  */
84494
- function emphasisPeek(_, _1, state) {
84525
+ function peek$1(_, _1, state) {
84495
84526
  return state.options.emphasis || "*";
84496
84527
  }
84497
84528
  //#endregion
84498
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
84529
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
84530
+ /**
84531
+ * Encode a code point as a character reference.
84532
+ *
84533
+ * @param {number} code
84534
+ * Code point to encode.
84535
+ * @returns {string}
84536
+ * Encoded character reference.
84537
+ */
84538
+ function encodeCharacterReference(code) {
84539
+ return "&#x" + code.toString(16).toUpperCase() + ";";
84540
+ }
84541
+ //#endregion
84542
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
84499
84543
  /**
84500
84544
  * @import {State} from 'mdast-util-to-markdown'
84501
84545
  * @import {Heading} from 'mdast'
84502
84546
  */
84503
84547
  /**
84548
+ * Checks if a heading can be formatted as a setext heading.
84549
+ *
84504
84550
  * @param {Heading} node
84551
+ * Node to check.
84505
84552
  * @param {State} state
84553
+ * Info passed around.
84506
84554
  * @returns {boolean}
84555
+ * Whether the heading can be formatted as a setext heading.
84507
84556
  */
84508
84557
  function formatHeadingAsSetext(node, state) {
84509
84558
  let literalWithBreak = false;
@@ -84516,17 +84565,24 @@ function formatHeadingAsSetext(node, state) {
84516
84565
  return Boolean((!node.depth || node.depth < 3) && toString(node) && (state.options.setext || literalWithBreak));
84517
84566
  }
84518
84567
  //#endregion
84519
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/heading.js
84568
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/heading.js
84520
84569
  /**
84521
84570
  * @import {Info, State} from 'mdast-util-to-markdown'
84522
84571
  * @import {Heading, Parents} from 'mdast'
84523
84572
  */
84524
84573
  /**
84574
+ * Serialize a heading node.
84575
+ *
84525
84576
  * @param {Heading} node
84577
+ * Node to serialize.
84526
84578
  * @param {Parents | undefined} _
84579
+ * Parent node.
84527
84580
  * @param {State} state
84581
+ * Info passed around.
84528
84582
  * @param {Info} info
84583
+ * Info on surrounding context.
84529
84584
  * @returns {string}
84585
+ * Serialized markdown.
84530
84586
  */
84531
84587
  function heading$1(node, _, state, info) {
84532
84588
  const rank = Math.max(Math.min(6, node.depth || 1), 1);
@@ -84552,7 +84608,8 @@ function heading$1(node, _, state, info) {
84552
84608
  after: "\n",
84553
84609
  ...tracker.current()
84554
84610
  });
84555
- if (/^[\t ]/.test(value)) value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);
84611
+ const head = value.charCodeAt(0);
84612
+ if (head === 9 || head === 32) value = encodeCharacterReference(head) + value.slice(1);
84556
84613
  value = value ? sequence + " " + value : sequence;
84557
84614
  if (state.options.closeAtx) value += " " + sequence;
84558
84615
  subexit();
@@ -84560,37 +84617,51 @@ function heading$1(node, _, state, info) {
84560
84617
  return value;
84561
84618
  }
84562
84619
  //#endregion
84563
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/html.js
84620
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/html.js
84564
84621
  /**
84565
84622
  * @import {Html} from 'mdast'
84566
84623
  */
84567
84624
  html$1.peek = htmlPeek;
84568
84625
  /**
84626
+ * Serialize an HTML node.
84627
+ *
84569
84628
  * @param {Html} node
84629
+ * Node to serialize.
84570
84630
  * @returns {string}
84631
+ * Serialized markdown.
84571
84632
  */
84572
84633
  function html$1(node) {
84573
84634
  return node.value || "";
84574
84635
  }
84575
84636
  /**
84637
+ * Peek at this node.
84638
+ *
84576
84639
  * @returns {string}
84640
+ * Start of the serialized markdown.
84577
84641
  */
84578
84642
  function htmlPeek() {
84579
84643
  return "<";
84580
84644
  }
84581
84645
  //#endregion
84582
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/image.js
84646
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/image.js
84583
84647
  /**
84584
84648
  * @import {Info, State} from 'mdast-util-to-markdown'
84585
84649
  * @import {Image, Parents} from 'mdast'
84586
84650
  */
84587
84651
  image$1.peek = imagePeek;
84588
84652
  /**
84653
+ * Serialize an image node.
84654
+ *
84589
84655
  * @param {Image} node
84656
+ * Node to serialize.
84590
84657
  * @param {Parents | undefined} _
84658
+ * Parent node.
84591
84659
  * @param {State} state
84660
+ * Info passed around.
84592
84661
  * @param {Info} info
84662
+ * Info on surrounding context.
84593
84663
  * @returns {string}
84664
+ * Serialized markdown.
84594
84665
  */
84595
84666
  function image$1(node, _, state, info) {
84596
84667
  const quote = checkQuote(state);
@@ -84640,24 +84711,34 @@ function image$1(node, _, state, info) {
84640
84711
  return value;
84641
84712
  }
84642
84713
  /**
84714
+ * Peek at this node.
84715
+ *
84643
84716
  * @returns {string}
84717
+ * Start of the serialized markdown.
84644
84718
  */
84645
84719
  function imagePeek() {
84646
84720
  return "!";
84647
84721
  }
84648
84722
  //#endregion
84649
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
84723
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
84650
84724
  /**
84651
84725
  * @import {Info, State} from 'mdast-util-to-markdown'
84652
84726
  * @import {ImageReference, Parents} from 'mdast'
84653
84727
  */
84654
84728
  imageReference$1.peek = imageReferencePeek;
84655
84729
  /**
84730
+ * Serialize an image reference node.
84731
+ *
84656
84732
  * @param {ImageReference} node
84733
+ * Node to serialize.
84657
84734
  * @param {Parents | undefined} _
84735
+ * Parent node.
84658
84736
  * @param {State} state
84737
+ * Info passed around.
84659
84738
  * @param {Info} info
84739
+ * Info on surrounding context.
84660
84740
  * @returns {string}
84741
+ * Serialized markdown.
84661
84742
  */
84662
84743
  function imageReference$1(node, _, state, info) {
84663
84744
  const type = node.referenceType;
@@ -84673,7 +84754,9 @@ function imageReference$1(node, _, state, info) {
84673
84754
  value += tracker.move(alt + "][");
84674
84755
  subexit();
84675
84756
  const stack = state.stack;
84676
- state.stack = [];
84757
+ state.stack = stack.filter(function(d) {
84758
+ return d !== "phrasing";
84759
+ });
84677
84760
  subexit = state.enter("reference");
84678
84761
  const reference = state.safe(state.associationId(node), {
84679
84762
  before: value,
@@ -84689,36 +84772,45 @@ function imageReference$1(node, _, state, info) {
84689
84772
  return value;
84690
84773
  }
84691
84774
  /**
84775
+ * Peek at this node.
84776
+ *
84692
84777
  * @returns {string}
84778
+ * Start of the serialized markdown.
84693
84779
  */
84694
84780
  function imageReferencePeek() {
84695
84781
  return "!";
84696
84782
  }
84697
84783
  //#endregion
84698
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
84784
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
84699
84785
  /**
84700
84786
  * @import {State} from 'mdast-util-to-markdown'
84701
84787
  * @import {InlineCode, Parents} from 'mdast'
84702
84788
  */
84703
84789
  inlineCode$1.peek = inlineCodePeek;
84704
84790
  /**
84791
+ * Serialize an inline code node.
84792
+ *
84705
84793
  * @param {InlineCode} node
84794
+ * Node to serialize.
84706
84795
  * @param {Parents | undefined} _
84796
+ * Parent node.
84707
84797
  * @param {State} state
84798
+ * Info passed around.
84708
84799
  * @returns {string}
84800
+ * Serialized markdown.
84709
84801
  */
84710
84802
  function inlineCode$1(node, _, state) {
84711
84803
  let value = node.value || "";
84712
84804
  let sequence = "`";
84713
84805
  let index = -1;
84714
84806
  while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) sequence += "`";
84715
- if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) value = " " + value + " ";
84807
+ if (/[^\n\r ]/.test(value) && (/^[\n\r ]/.test(value) && /[\n\r ]$/.test(value) || /^`|`$/.test(value))) value = " " + value + " ";
84716
84808
  while (++index < state.unsafe.length) {
84717
84809
  const pattern = state.unsafe[index];
84718
84810
  const expression = state.compilePattern(pattern);
84811
+ if (!pattern.atBreak) continue;
84719
84812
  /** @type {RegExpExecArray | null} */
84720
84813
  let match;
84721
- if (!pattern.atBreak) continue;
84722
84814
  while (match = expression.exec(value)) {
84723
84815
  let position = match.index;
84724
84816
  if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) position--;
@@ -84728,28 +84820,36 @@ function inlineCode$1(node, _, state) {
84728
84820
  return sequence + value + sequence;
84729
84821
  }
84730
84822
  /**
84823
+ * Peek at this node.
84824
+ *
84731
84825
  * @returns {string}
84826
+ * Start of the serialized markdown.
84732
84827
  */
84733
84828
  function inlineCodePeek() {
84734
84829
  return "`";
84735
84830
  }
84736
84831
  //#endregion
84737
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
84832
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
84738
84833
  /**
84739
84834
  * @import {State} from 'mdast-util-to-markdown'
84740
84835
  * @import {Link} from 'mdast'
84741
84836
  */
84742
84837
  /**
84838
+ * Checks if a link can be formatted as an autolink.
84839
+ *
84743
84840
  * @param {Link} node
84841
+ * Node to check.
84744
84842
  * @param {State} state
84843
+ * Info passed around.
84745
84844
  * @returns {boolean}
84845
+ * Whether the link can be formatted as an autolink.
84746
84846
  */
84747
84847
  function formatLinkAsAutolink(node, state) {
84748
84848
  const raw = toString(node);
84749
- return Boolean(!state.options.resourceLink && node.url && !node.title && node.children && node.children.length === 1 && node.children[0].type === "text" && (raw === node.url || "mailto:" + raw === node.url) && /^[a-z][a-z+.-]+:/i.test(node.url) && !/[\0- <>\u007F]/.test(node.url));
84849
+ return Boolean(!state.options.resourceLink && node.url && !node.title && node.children && node.children.length === 1 && node.children[0].type === "text" && (raw === node.url || "mailto:" + raw === node.url) && /^[a-z][+\-.a-z]+:/i.test(node.url) && !/[\0- <>\u007F]/.test(node.url));
84750
84850
  }
84751
84851
  //#endregion
84752
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/link.js
84852
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/link.js
84753
84853
  /**
84754
84854
  * @import {Info, State} from 'mdast-util-to-markdown'
84755
84855
  * @import {Link, Parents} from 'mdast'
@@ -84757,24 +84857,29 @@ function formatLinkAsAutolink(node, state) {
84757
84857
  */
84758
84858
  link$1.peek = linkPeek;
84759
84859
  /**
84860
+ * Serialize a link node.
84861
+ *
84760
84862
  * @param {Link} node
84863
+ * Node to serialize.
84761
84864
  * @param {Parents | undefined} _
84865
+ * Parent node.
84762
84866
  * @param {State} state
84867
+ * Info passed around.
84763
84868
  * @param {Info} info
84869
+ * Info on surrounding context.
84764
84870
  * @returns {string}
84871
+ * Serialized markdown.
84765
84872
  */
84766
84873
  function link$1(node, _, state, info) {
84767
84874
  const quote = checkQuote(state);
84768
84875
  const suffix = quote === "\"" ? "Quote" : "Apostrophe";
84769
84876
  const tracker = state.createTracker(info);
84770
- /** @type {Exit} */
84771
- let exit;
84772
- /** @type {Exit} */
84773
- let subexit;
84774
84877
  if (formatLinkAsAutolink(node, state)) {
84775
84878
  const stack = state.stack;
84776
- state.stack = [];
84777
- exit = state.enter("autolink");
84879
+ state.stack = stack.filter(function(d) {
84880
+ return d !== "phrasing";
84881
+ });
84882
+ const exit = state.enter("autolink");
84778
84883
  let value = tracker.move("<");
84779
84884
  value += tracker.move(state.containerPhrasing(node, {
84780
84885
  before: value,
@@ -84786,8 +84891,8 @@ function link$1(node, _, state, info) {
84786
84891
  state.stack = stack;
84787
84892
  return value;
84788
84893
  }
84789
- exit = state.enter("link");
84790
- subexit = state.enter("label");
84894
+ const exit = state.enter("link");
84895
+ let subexit = state.enter("label");
84791
84896
  let value = tracker.move("[");
84792
84897
  value += tracker.move(state.containerPhrasing(node, {
84793
84898
  before: value,
@@ -84830,27 +84935,40 @@ function link$1(node, _, state, info) {
84830
84935
  return value;
84831
84936
  }
84832
84937
  /**
84938
+ * Peek at this node.
84939
+ *
84833
84940
  * @param {Link} node
84941
+ * Node to peek at.
84834
84942
  * @param {Parents | undefined} _
84943
+ * Parent node.
84835
84944
  * @param {State} state
84945
+ * Info passed around.
84836
84946
  * @returns {string}
84947
+ * Start of the serialized markdown.
84837
84948
  */
84838
84949
  function linkPeek(node, _, state) {
84839
84950
  return formatLinkAsAutolink(node, state) ? "<" : "[";
84840
84951
  }
84841
84952
  //#endregion
84842
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
84953
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
84843
84954
  /**
84844
84955
  * @import {Info, State} from 'mdast-util-to-markdown'
84845
84956
  * @import {LinkReference, Parents} from 'mdast'
84846
84957
  */
84847
84958
  linkReference$1.peek = linkReferencePeek;
84848
84959
  /**
84960
+ * Serialize a link reference node.
84961
+ *
84849
84962
  * @param {LinkReference} node
84963
+ * Node to serialize.
84850
84964
  * @param {Parents | undefined} _
84965
+ * Parent node.
84851
84966
  * @param {State} state
84967
+ * Info passed around.
84852
84968
  * @param {Info} info
84969
+ * Info on surrounding context.
84853
84970
  * @returns {string}
84971
+ * Serialized markdown.
84854
84972
  */
84855
84973
  function linkReference$1(node, _, state, info) {
84856
84974
  const type = node.referenceType;
@@ -84866,7 +84984,9 @@ function linkReference$1(node, _, state, info) {
84866
84984
  value += tracker.move(text + "][");
84867
84985
  subexit();
84868
84986
  const stack = state.stack;
84869
- state.stack = [];
84987
+ state.stack = stack.filter(function(d) {
84988
+ return d !== "phrasing";
84989
+ });
84870
84990
  subexit = state.enter("reference");
84871
84991
  const reference = state.safe(state.associationId(node), {
84872
84992
  before: value,
@@ -84882,19 +85002,26 @@ function linkReference$1(node, _, state, info) {
84882
85002
  return value;
84883
85003
  }
84884
85004
  /**
85005
+ * Peek at this node.
85006
+ *
84885
85007
  * @returns {string}
85008
+ * Start of the serialized markdown.
84886
85009
  */
84887
85010
  function linkReferencePeek() {
84888
85011
  return "[";
84889
85012
  }
84890
85013
  //#endregion
84891
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
85014
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
84892
85015
  /**
84893
85016
  * @import {Options, State} from 'mdast-util-to-markdown'
84894
85017
  */
84895
85018
  /**
85019
+ * Checks the preferred list bullet option.
85020
+ *
84896
85021
  * @param {State} state
85022
+ * Info passed around.
84897
85023
  * @returns {Exclude<Options['bullet'], null | undefined>}
85024
+ * Preferred list bullet.
84898
85025
  */
84899
85026
  function checkBullet(state) {
84900
85027
  const marker = state.options.bullet || "*";
@@ -84902,13 +85029,17 @@ function checkBullet(state) {
84902
85029
  return marker;
84903
85030
  }
84904
85031
  //#endregion
84905
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js
85032
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js
84906
85033
  /**
84907
85034
  * @import {Options, State} from 'mdast-util-to-markdown'
84908
85035
  */
84909
85036
  /**
85037
+ * Checks the preferred alternate list bullet option.
85038
+ *
84910
85039
  * @param {State} state
85040
+ * Info passed around.
84911
85041
  * @returns {Exclude<Options['bullet'], null | undefined>}
85042
+ * Preferred alternate list bullet.
84912
85043
  */
84913
85044
  function checkBulletOther(state) {
84914
85045
  const bullet = checkBullet(state);
@@ -84919,13 +85050,17 @@ function checkBulletOther(state) {
84919
85050
  return bulletOther;
84920
85051
  }
84921
85052
  //#endregion
84922
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js
85053
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js
84923
85054
  /**
84924
85055
  * @import {Options, State} from 'mdast-util-to-markdown'
84925
85056
  */
84926
85057
  /**
85058
+ * Checks the preferred ordered list bullet option.
85059
+ *
84927
85060
  * @param {State} state
85061
+ * Info passed around.
84928
85062
  * @returns {Exclude<Options['bulletOrdered'], null | undefined>}
85063
+ * Preferred ordered list bullet.
84929
85064
  */
84930
85065
  function checkBulletOrdered(state) {
84931
85066
  const marker = state.options.bulletOrdered || ".";
@@ -84933,13 +85068,17 @@ function checkBulletOrdered(state) {
84933
85068
  return marker;
84934
85069
  }
84935
85070
  //#endregion
84936
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-rule.js
85071
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/check-rule.js
84937
85072
  /**
84938
85073
  * @import {Options, State} from 'mdast-util-to-markdown'
84939
85074
  */
84940
85075
  /**
85076
+ * Checks the preferred rule option.
85077
+ *
84941
85078
  * @param {State} state
85079
+ * Info passed around.
84942
85080
  * @returns {Exclude<Options['rule'], null | undefined>}
85081
+ * Preferred rule marker.
84943
85082
  */
84944
85083
  function checkRule(state) {
84945
85084
  const marker = state.options.rule || "*";
@@ -84947,17 +85086,24 @@ function checkRule(state) {
84947
85086
  return marker;
84948
85087
  }
84949
85088
  //#endregion
84950
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/list.js
85089
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/list.js
84951
85090
  /**
84952
85091
  * @import {Info, State} from 'mdast-util-to-markdown'
84953
85092
  * @import {List, Parents} from 'mdast'
84954
85093
  */
84955
85094
  /**
85095
+ * Serialize a list node.
85096
+ *
84956
85097
  * @param {List} node
85098
+ * Node to serialize.
84957
85099
  * @param {Parents | undefined} parent
85100
+ * Parent node.
84958
85101
  * @param {State} state
85102
+ * Info passed around.
84959
85103
  * @param {Info} info
85104
+ * Info on surrounding context.
84960
85105
  * @returns {string}
85106
+ * Serialized markdown.
84961
85107
  */
84962
85108
  function list$2(node, parent, state, info) {
84963
85109
  const exit = state.enter("list");
@@ -84990,13 +85136,17 @@ function list$2(node, parent, state, info) {
84990
85136
  return value;
84991
85137
  }
84992
85138
  //#endregion
84993
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
85139
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
84994
85140
  /**
84995
85141
  * @import {Options, State} from 'mdast-util-to-markdown'
84996
85142
  */
84997
85143
  /**
85144
+ * Checks the preferred list item indent option.
85145
+ *
84998
85146
  * @param {State} state
85147
+ * Info passed around.
84999
85148
  * @returns {Exclude<Options['listItemIndent'], null | undefined>}
85149
+ * Preferred list item indent.
85000
85150
  */
85001
85151
  function checkListItemIndent(state) {
85002
85152
  const style = state.options.listItemIndent || "one";
@@ -85004,17 +85154,24 @@ function checkListItemIndent(state) {
85004
85154
  return style;
85005
85155
  }
85006
85156
  //#endregion
85007
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/list-item.js
85157
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/list-item.js
85008
85158
  /**
85009
85159
  * @import {Info, Map, State} from 'mdast-util-to-markdown'
85010
85160
  * @import {ListItem, Parents} from 'mdast'
85011
85161
  */
85012
85162
  /**
85163
+ * Serialize a list item node.
85164
+ *
85013
85165
  * @param {ListItem} node
85166
+ * Node to serialize.
85014
85167
  * @param {Parents | undefined} parent
85168
+ * Parent node.
85015
85169
  * @param {State} state
85170
+ * Info passed around.
85016
85171
  * @param {Info} info
85172
+ * Info on surrounding context.
85017
85173
  * @returns {string}
85174
+ * Serialized markdown.
85018
85175
  */
85019
85176
  function listItem$1(node, parent, state, info) {
85020
85177
  const listItemIndent = checkListItemIndent(state);
@@ -85029,24 +85186,35 @@ function listItem$1(node, parent, state, info) {
85029
85186
  const value = state.indentLines(state.containerFlow(node, tracker.current()), map);
85030
85187
  exit();
85031
85188
  return value;
85032
- /** @type {Map} */
85189
+ /**
85190
+ * Indent lines of the list item.
85191
+ *
85192
+ * @type {Map}
85193
+ */
85033
85194
  function map(line, index, blank) {
85034
85195
  if (index) return (blank ? "" : " ".repeat(size)) + line;
85035
85196
  return (blank ? bullet : bullet + " ".repeat(size - bullet.length)) + line;
85036
85197
  }
85037
85198
  }
85038
85199
  //#endregion
85039
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
85200
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
85040
85201
  /**
85041
85202
  * @import {Info, State} from 'mdast-util-to-markdown'
85042
85203
  * @import {Paragraph, Parents} from 'mdast'
85043
85204
  */
85044
85205
  /**
85206
+ * Serialize a paragraph node.
85207
+ *
85045
85208
  * @param {Paragraph} node
85209
+ * Node to serialize.
85046
85210
  * @param {Parents | undefined} _
85211
+ * Parent node.
85047
85212
  * @param {State} state
85213
+ * Info passed around.
85048
85214
  * @param {Info} info
85215
+ * Info on surrounding context.
85049
85216
  * @returns {string}
85217
+ * Serialized markdown.
85050
85218
  */
85051
85219
  function paragraph$1(node, _, state, info) {
85052
85220
  const exit = state.enter("paragraph");
@@ -85057,31 +85225,46 @@ function paragraph$1(node, _, state, info) {
85057
85225
  return value;
85058
85226
  }
85059
85227
  //#endregion
85060
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/root.js
85228
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/root.js
85061
85229
  /**
85062
85230
  * @import {Info, State} from 'mdast-util-to-markdown'
85063
85231
  * @import {Parents, Root} from 'mdast'
85064
85232
  */
85065
85233
  /**
85234
+ * Serialize a root node.
85235
+ *
85066
85236
  * @param {Root} node
85237
+ * Node to serialize.
85067
85238
  * @param {Parents | undefined} _
85239
+ * Parent node.
85068
85240
  * @param {State} state
85241
+ * Info passed around.
85069
85242
  * @param {Info} info
85243
+ * Info on surrounding context.
85070
85244
  * @returns {string}
85245
+ * Serialized markdown.
85071
85246
  */
85072
85247
  function root$1(node, _, state, info) {
85073
- return (node.children.some(function(d) {
85074
- return phrasing$1(d);
85075
- }) ? state.containerPhrasing : state.containerFlow).call(state, node, info);
85248
+ if (!node.children.some(function(d) {
85249
+ return phrasing$2(d);
85250
+ })) return state.containerFlow(node, info);
85251
+ const exit = state.enter("phrasing");
85252
+ const value = state.containerPhrasing(node, info);
85253
+ exit();
85254
+ return value;
85076
85255
  }
85077
85256
  //#endregion
85078
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-strong.js
85257
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/check-strong.js
85079
85258
  /**
85080
85259
  * @import {Options, State} from 'mdast-util-to-markdown'
85081
85260
  */
85082
85261
  /**
85262
+ * Checks the preferred strong option.
85263
+ *
85083
85264
  * @param {State} state
85265
+ * Info passed around.
85084
85266
  * @returns {Exclude<Options['strong'], null | undefined>}
85267
+ * Preferred strong marker.
85085
85268
  */
85086
85269
  function checkStrong(state) {
85087
85270
  const marker = state.options.strong || "*";
@@ -85089,76 +85272,105 @@ function checkStrong(state) {
85089
85272
  return marker;
85090
85273
  }
85091
85274
  //#endregion
85092
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/strong.js
85275
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/strong.js
85093
85276
  /**
85094
- * @import {Info, State} from 'mdast-util-to-markdown'
85277
+ * @import {AttentionInfo, Info, State} from 'mdast-util-to-markdown'
85095
85278
  * @import {Parents, Strong} from 'mdast'
85096
85279
  */
85097
- strong$1.peek = strongPeek;
85280
+ strong$1.attention = attention$1;
85281
+ strong$1.peek = peek;
85098
85282
  /**
85283
+ * Serialize a strong node.
85284
+ *
85285
+ * Attention is properly handled by `containerPhrasing`.
85286
+ *
85099
85287
  * @param {Strong} node
85288
+ * Node to serialize.
85100
85289
  * @param {Parents | undefined} _
85290
+ * Parent node.
85101
85291
  * @param {State} state
85292
+ * Info passed around.
85102
85293
  * @param {Info} info
85294
+ * Info on surrounding context.
85103
85295
  * @returns {string}
85296
+ * Serialized markdown.
85104
85297
  */
85105
85298
  function strong$1(node, _, state, info) {
85106
- const marker = checkStrong(state);
85107
- const exit = state.enter("strong");
85108
- const tracker = state.createTracker(info);
85109
- const before = tracker.move(marker + marker);
85110
- let between = tracker.move(state.containerPhrasing(node, {
85111
- after: marker,
85112
- before,
85113
- ...tracker.current()
85114
- }));
85115
- const betweenHead = between.charCodeAt(0);
85116
- const open = encodeInfo(info.before.charCodeAt(info.before.length - 1), betweenHead, marker);
85117
- if (open.inside) between = encodeCharacterReference(betweenHead) + between.slice(1);
85118
- const betweenTail = between.charCodeAt(between.length - 1);
85119
- const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
85120
- if (close.inside) between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
85121
- const after = tracker.move(marker + marker);
85299
+ const exit = state.enter("phrasing");
85300
+ const value = state.containerPhrasing({
85301
+ type: "root",
85302
+ children: [node]
85303
+ }, info);
85122
85304
  exit();
85123
- state.attentionEncodeSurroundingInfo = {
85124
- after: close.outside,
85125
- before: open.outside
85305
+ return value;
85306
+ }
85307
+ /**
85308
+ * Serialize a strong node as attention.
85309
+ *
85310
+ * @param {Strong} _
85311
+ * Node to serialize.
85312
+ * @param {State} state
85313
+ * Info passed around.
85314
+ * @returns {AttentionInfo}
85315
+ * Info on how to serialize the node.
85316
+ */
85317
+ function attention$1(_, state) {
85318
+ return {
85319
+ construct: "strong",
85320
+ markers: checkStrong(state) === "*" ? ["*", "_"] : ["_", "*"],
85321
+ sizes: [2]
85126
85322
  };
85127
- return before + between + after;
85128
85323
  }
85129
85324
  /**
85325
+ * Peek at this node.
85326
+ *
85130
85327
  * @param {Strong} _
85328
+ * Node to serialize.
85131
85329
  * @param {Parents | undefined} _1
85330
+ * Parent node.
85132
85331
  * @param {State} state
85332
+ * Info passed around.
85133
85333
  * @returns {string}
85334
+ * Start of the serialized markdown.
85134
85335
  */
85135
- function strongPeek(_, _1, state) {
85336
+ function peek(_, _1, state) {
85136
85337
  return state.options.strong || "*";
85137
85338
  }
85138
85339
  //#endregion
85139
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/text.js
85340
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/text.js
85140
85341
  /**
85141
85342
  * @import {Info, State} from 'mdast-util-to-markdown'
85142
85343
  * @import {Parents, Text} from 'mdast'
85143
85344
  */
85144
85345
  /**
85346
+ * Serialize a text node.
85347
+ *
85145
85348
  * @param {Text} node
85349
+ * Node to serialize.
85146
85350
  * @param {Parents | undefined} _
85351
+ * Parent node.
85147
85352
  * @param {State} state
85353
+ * Info passed around.
85148
85354
  * @param {Info} info
85355
+ * Info on surrounding context.
85149
85356
  * @returns {string}
85357
+ * Serialized markdown.
85150
85358
  */
85151
85359
  function text$4(node, _, state, info) {
85152
85360
  return state.safe(node.value, info);
85153
85361
  }
85154
85362
  //#endregion
85155
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
85363
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
85156
85364
  /**
85157
85365
  * @import {Options, State} from 'mdast-util-to-markdown'
85158
85366
  */
85159
85367
  /**
85368
+ * Checks the preferred rule repetition option.
85369
+ *
85160
85370
  * @param {State} state
85371
+ * Info passed around.
85161
85372
  * @returns {Exclude<Options['ruleRepetition'], null | undefined>}
85373
+ * Preferred rule repetition.
85162
85374
  */
85163
85375
  function checkRuleRepetition(state) {
85164
85376
  const repetition = state.options.ruleRepetition || 3;
@@ -85166,30 +85378,36 @@ function checkRuleRepetition(state) {
85166
85378
  return repetition;
85167
85379
  }
85168
85380
  //#endregion
85169
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
85381
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
85170
85382
  /**
85171
85383
  * @import {State} from 'mdast-util-to-markdown'
85172
85384
  * @import {Parents, ThematicBreak} from 'mdast'
85173
85385
  */
85174
85386
  /**
85387
+ * Serialize a thematic break node.
85388
+ *
85175
85389
  * @param {ThematicBreak} _
85390
+ * Node to serialize.
85176
85391
  * @param {Parents | undefined} _1
85392
+ * Parent node.
85177
85393
  * @param {State} state
85394
+ * Info passed around.
85178
85395
  * @returns {string}
85396
+ * Serialized markdown.
85179
85397
  */
85180
85398
  function thematicBreak$2(_, _1, state) {
85181
85399
  const value = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state));
85182
85400
  return state.options.ruleSpaces ? value.slice(0, -1) : value;
85183
85401
  }
85184
85402
  //#endregion
85185
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/index.js
85403
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/handle/index.js
85186
85404
  /**
85187
85405
  * Default (CommonMark) handlers.
85188
85406
  */
85189
85407
  const handle = {
85190
85408
  blockquote: blockquote$1,
85191
85409
  break: hardBreak$1,
85192
- code: code$2,
85410
+ code: code$3,
85193
85411
  definition: definition$1,
85194
85412
  emphasis: emphasis$1,
85195
85413
  hardBreak: hardBreak$1,
@@ -85209,22 +85427,181 @@ const handle = {
85209
85427
  thematicBreak: thematicBreak$2
85210
85428
  };
85211
85429
  //#endregion
85212
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/join.js
85430
+ //#region node_modules/.pnpm/micromark-util-html-tag-name@2.0.1/node_modules/micromark-util-html-tag-name/index.js
85431
+ /**
85432
+ * List of lowercase HTML “block” tag names.
85433
+ *
85434
+ * The list, when parsing HTML (flow), results in more relaxed rules (condition
85435
+ * 6).
85436
+ * Because they are known blocks, the HTML-like syntax doesn’t have to be
85437
+ * strictly parsed.
85438
+ * For tag names not in this list, a more strict algorithm (condition 7) is used
85439
+ * to detect whether the HTML-like syntax is seen as HTML (flow) or not.
85440
+ *
85441
+ * This is copied from:
85442
+ * <https://spec.commonmark.org/0.30/#html-blocks>.
85443
+ *
85444
+ * > 👉 **Note**: `search` was added in `CommonMark@0.31`.
85445
+ */
85446
+ const htmlBlockNames = [
85447
+ "address",
85448
+ "article",
85449
+ "aside",
85450
+ "base",
85451
+ "basefont",
85452
+ "blockquote",
85453
+ "body",
85454
+ "caption",
85455
+ "center",
85456
+ "col",
85457
+ "colgroup",
85458
+ "dd",
85459
+ "details",
85460
+ "dialog",
85461
+ "dir",
85462
+ "div",
85463
+ "dl",
85464
+ "dt",
85465
+ "fieldset",
85466
+ "figcaption",
85467
+ "figure",
85468
+ "footer",
85469
+ "form",
85470
+ "frame",
85471
+ "frameset",
85472
+ "h1",
85473
+ "h2",
85474
+ "h3",
85475
+ "h4",
85476
+ "h5",
85477
+ "h6",
85478
+ "head",
85479
+ "header",
85480
+ "hr",
85481
+ "html",
85482
+ "iframe",
85483
+ "legend",
85484
+ "li",
85485
+ "link",
85486
+ "main",
85487
+ "menu",
85488
+ "menuitem",
85489
+ "nav",
85490
+ "noframes",
85491
+ "ol",
85492
+ "optgroup",
85493
+ "option",
85494
+ "p",
85495
+ "param",
85496
+ "search",
85497
+ "section",
85498
+ "summary",
85499
+ "table",
85500
+ "tbody",
85501
+ "td",
85502
+ "tfoot",
85503
+ "th",
85504
+ "thead",
85505
+ "title",
85506
+ "tr",
85507
+ "track",
85508
+ "ul"
85509
+ ];
85510
+ /**
85511
+ * List of lowercase HTML “raw” tag names.
85512
+ *
85513
+ * The list, when parsing HTML (flow), results in HTML that can include lines
85514
+ * without exiting, until a closing tag also in this list is found (condition
85515
+ * 1).
85516
+ *
85517
+ * This module is copied from:
85518
+ * <https://spec.commonmark.org/0.30/#html-blocks>.
85519
+ *
85520
+ * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`.
85521
+ */
85522
+ const htmlRawNames = [
85523
+ "pre",
85524
+ "script",
85525
+ "style",
85526
+ "textarea"
85527
+ ];
85528
+ //#endregion
85529
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/html-kind.js
85530
+ /**
85531
+ * @typedef {1 | 2 | 3 | 4 | 5 | 6 | 7} Kind
85532
+ * Kind of HTML (flow) element.
85533
+ */
85534
+ /**
85535
+ * Infer the kind of HTML that `value` is.
85536
+ *
85537
+ * This works on valid trees as produced by `micromark`.
85538
+ * Kinds:
85539
+ *
85540
+ * 1. raw
85541
+ * 2. comment
85542
+ * 3. instruction
85543
+ * 4. declaration
85544
+ * 5. cdata
85545
+ * 6. block
85546
+ * 7. other
85547
+ *
85548
+ * See: <https://spec.commonmark.org/0.31.2/#html-blocks>.
85549
+ *
85550
+ * @param {string} value
85551
+ * HTML.
85552
+ * @returns {Kind | undefined}
85553
+ * Kind; `undefined` if unknown.
85554
+ */
85555
+ function htmlKind(value) {
85556
+ if (value.charCodeAt(0) !== 60) return;
85557
+ const next = value.charCodeAt(1);
85558
+ if (next === 33) {
85559
+ const code = value.charCodeAt(2);
85560
+ if (code === 45) return 2;
85561
+ if (code === 91) return 5;
85562
+ if (asciiAlpha(code)) return 4;
85563
+ return;
85564
+ }
85565
+ if (next === 63) return 3;
85566
+ const closing = next === 47;
85567
+ const start = closing ? 2 : 1;
85568
+ let end = start;
85569
+ let code = value.charCodeAt(end);
85570
+ if (!asciiAlpha(code)) return;
85571
+ while (code === 45 || asciiAlphanumeric(code)) code = value.charCodeAt(++end);
85572
+ const name = value.slice(start, end).toLowerCase();
85573
+ if (!closing && code !== 47 && htmlRawNames.includes(name)) return 1;
85574
+ return htmlBlockNames.includes(name) ? 6 : 7;
85575
+ }
85576
+ //#endregion
85577
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/join.js
85213
85578
  /**
85214
85579
  * @import {Join} from 'mdast-util-to-markdown'
85215
85580
  */
85216
85581
  /** @type {Array<Join>} */
85217
85582
  const join$1 = [joinDefaults];
85218
- /** @type {Join} */
85583
+ /**
85584
+ * Default join function.
85585
+ *
85586
+ * @type {Join}
85587
+ */
85219
85588
  function joinDefaults(left, right, parent, state) {
85220
85589
  if (right.type === "code" && formatCodeAsIndented(right, state) && (left.type === "list" || left.type === right.type && formatCodeAsIndented(left, state))) return false;
85221
85590
  if ("spread" in parent && typeof parent.spread === "boolean") {
85222
85591
  if (left.type === "paragraph" && (left.type === right.type || right.type === "definition" || right.type === "heading" && formatHeadingAsSetext(right, state))) return;
85592
+ if (left.type === "html") {
85593
+ const kind = htmlKind(left.value);
85594
+ if (kind === void 0 || kind === 6 || kind === 7) return 1;
85595
+ }
85596
+ if (left.type === "paragraph" && right.type === "html") {
85597
+ const kind = htmlKind(right.value);
85598
+ if (kind === void 0 || kind === 7) return 1;
85599
+ }
85223
85600
  return parent.spread ? 1 : 0;
85224
85601
  }
85225
85602
  }
85226
85603
  //#endregion
85227
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/unsafe.js
85604
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/unsafe.js
85228
85605
  /**
85229
85606
  * @import {ConstructName, Unsafe} from 'mdast-util-to-markdown'
85230
85607
  */
@@ -85282,6 +85659,26 @@ const unsafe = [
85282
85659
  "headingAtx"
85283
85660
  ]
85284
85661
  },
85662
+ {
85663
+ character: "\r",
85664
+ before: "[\\r\\n]",
85665
+ inConstruct: "phrasing"
85666
+ },
85667
+ {
85668
+ character: "\r",
85669
+ after: "\\r",
85670
+ inConstruct: "phrasing"
85671
+ },
85672
+ {
85673
+ character: "\n",
85674
+ before: "\\n",
85675
+ inConstruct: "phrasing"
85676
+ },
85677
+ {
85678
+ character: "\n",
85679
+ after: "[\\r\\n]",
85680
+ inConstruct: "phrasing"
85681
+ },
85285
85682
  {
85286
85683
  character: " ",
85287
85684
  after: "[\\r\\n]",
@@ -85443,8 +85840,25 @@ const unsafe = [
85443
85840
  {
85444
85841
  atBreak: true,
85445
85842
  character: "~"
85843
+ },
85844
+ {
85845
+ character: "<",
85846
+ inConstruct: "autolink"
85847
+ },
85848
+ {
85849
+ character: ">",
85850
+ inConstruct: "autolink"
85851
+ },
85852
+ {
85853
+ character: "",
85854
+ inConstruct: "autolink"
85446
85855
  }
85447
85856
  ];
85857
+ let code$2 = -1;
85858
+ while (++code$2 < 33) unsafe.push({
85859
+ character: String.fromCharCode(code$2),
85860
+ inConstruct: "autolink"
85861
+ });
85448
85862
  //#endregion
85449
85863
  //#region node_modules/.pnpm/character-entities@2.0.2/node_modules/character-entities/index.js
85450
85864
  /**
@@ -87581,7 +87995,7 @@ const characterEntities = {
87581
87995
  };
87582
87996
  //#endregion
87583
87997
  //#region node_modules/.pnpm/decode-named-character-reference@1.3.0/node_modules/decode-named-character-reference/index.js
87584
- const own$3 = {}.hasOwnProperty;
87998
+ const own$4 = {}.hasOwnProperty;
87585
87999
  /**
87586
88000
  * Decode a single character reference (without the `&` or `;`).
87587
88001
  * You probably only need this when you’re building parsers yourself that follow
@@ -87594,7 +88008,7 @@ const own$3 = {}.hasOwnProperty;
87594
88008
  * Decoded reference.
87595
88009
  */
87596
88010
  function decodeNamedCharacterReference(value) {
87597
- return own$3.call(characterEntities, value) ? characterEntities[value] : false;
88011
+ return own$4.call(characterEntities, value) ? characterEntities[value] : false;
87598
88012
  }
87599
88013
  //#endregion
87600
88014
  //#region node_modules/.pnpm/micromark-util-decode-numeric-character-reference@2.0.2/node_modules/micromark-util-decode-numeric-character-reference/index.js
@@ -87655,7 +88069,7 @@ function decode($0, $1, $2) {
87655
88069
  return decodeNamedCharacterReference($2) || $0;
87656
88070
  }
87657
88071
  //#endregion
87658
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/association.js
88072
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/association.js
87659
88073
  /**
87660
88074
  * @import {AssociationId} from '../types.js'
87661
88075
  */
@@ -87684,49 +88098,484 @@ function association(node) {
87684
88098
  return decodeString(node.identifier);
87685
88099
  }
87686
88100
  //#endregion
87687
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js
88101
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js
87688
88102
  /**
87689
88103
  * @import {CompilePattern} from '../types.js'
87690
88104
  */
87691
88105
  /**
88106
+ * Compiles a pattern object into a regular expression.
88107
+ *
87692
88108
  * @type {CompilePattern}
87693
88109
  */
87694
88110
  function compilePattern(pattern) {
87695
88111
  if (!pattern._compiled) {
87696
88112
  const before = (pattern.atBreak ? "[\\r\\n][\\t ]*" : "") + (pattern.before ? "(?:" + pattern.before + ")" : "");
87697
- pattern._compiled = new RegExp((before ? "(" + before + ")" : "") + (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? "\\" : "") + pattern.character + (pattern.after ? "(?:" + pattern.after + ")" : ""), "g");
88113
+ pattern._compiled = new RegExp((before ? "(" + before + ")" : "") + (/[$()*+\-.?[\\\]^{|}]/.test(pattern.character) ? "\\" : "") + pattern.character + (pattern.after ? "(?:" + pattern.after + ")" : ""), "g");
87698
88114
  }
87699
88115
  return pattern._compiled;
87700
88116
  }
87701
88117
  //#endregion
87702
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
88118
+ //#region node_modules/.pnpm/micromark-util-classify-character@2.0.1/node_modules/micromark-util-classify-character/index.js
88119
+ /**
88120
+ * @import {Code} from 'micromark-util-types'
88121
+ */
88122
+ /**
88123
+ * Classify whether a code represents whitespace, punctuation, or something
88124
+ * else.
88125
+ *
88126
+ * Used for attention (emphasis, strong), whose sequences can open or close
88127
+ * based on the class of surrounding characters.
88128
+ *
88129
+ * > 👉 **Note**: eof (`null`) is seen as whitespace.
88130
+ *
88131
+ * @param {Code} code
88132
+ * Code.
88133
+ * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}
88134
+ * Group.
88135
+ */
88136
+ function classifyCharacter(code) {
88137
+ if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) return 1;
88138
+ if (unicodePunctuation(code)) return 2;
88139
+ }
88140
+ //#endregion
88141
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/character.js
88142
+ /**
88143
+ * Get the first character of a value.
88144
+ *
88145
+ * Is aware of astral characters (such as emoji).
88146
+ *
88147
+ * @param {string} value
88148
+ * Value.
88149
+ * @returns {string}
88150
+ * First character; empty if `value` is empty.
88151
+ */
88152
+ function firstCharacter(value) {
88153
+ const code = value.codePointAt(0);
88154
+ return code === void 0 ? "" : String.fromCodePoint(code);
88155
+ }
88156
+ /**
88157
+ * Get the last character of a value.
88158
+ *
88159
+ * Is aware of astral characters (such as emoji).
88160
+ *
88161
+ * @param {string} value
88162
+ * Value.
88163
+ * @returns {string}
88164
+ * Last character; empty if `value` is empty.
88165
+ */
88166
+ function lastCharacter(value) {
88167
+ const code = value.codePointAt(value.length - 2);
88168
+ return code !== void 0 && code > 65535 ? value.slice(-2) : value.slice(-1);
88169
+ }
88170
+ //#endregion
88171
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/encode-info.js
88172
+ /**
88173
+ * @import {EncodeSides} from '../types.js'
88174
+ */
88175
+ /**
88176
+ * Check whether to encode (as a character reference) the characters
88177
+ * surrounding an attention run.
88178
+ *
88179
+ * Which characters are around an attention run influence whether it works or
88180
+ * not.
88181
+ *
88182
+ * See <https://github.com/orgs/syntax-tree/discussions/60> for more info.
88183
+ * See this markdown in a particular renderer to see what works:
88184
+ *
88185
+ * ```markdown
88186
+ * | | A (letter inside) | B (punctuation inside) | C (whitespace inside) | D (nothing inside) |
88187
+ * | ----------------------- | ----------------- | ---------------------- | --------------------- | ------------------ |
88188
+ * | 1 (letter outside) | x*y*z | x*.*z | x* *z | x**z |
88189
+ * | 2 (punctuation outside) | .*y*. | .*.*. | .* *. | .**. |
88190
+ * | 3 (whitespace outside) | x *y* z | x *.* z | x * * z | x ** z |
88191
+ * | 4 (nothing outside) | *x* | *.* | * * | ** |
88192
+ * ```
88193
+ *
88194
+ * @param {number} outside
88195
+ * Code point on the outer side of the run.
88196
+ * @param {number} inside
88197
+ * Code point on the inner side of the run.
88198
+ * @param {string} marker
88199
+ * Marker of the run.
88200
+ * Underscores are handled more strictly (they form less often) than
88201
+ * asterisks.
88202
+ * @returns {EncodeSides}
88203
+ * Whether to encode characters.
88204
+ */
88205
+ function encodeInfo(outside, inside, marker) {
88206
+ const outsideKind = classifyCharacter(outside);
88207
+ const insideKind = classifyCharacter(inside);
88208
+ if (outsideKind === void 0) return insideKind === void 0 ? marker === "_" ? {
88209
+ inside: true,
88210
+ outside: true
88211
+ } : {
88212
+ inside: false,
88213
+ outside: false
88214
+ } : insideKind === 1 ? {
88215
+ inside: true,
88216
+ outside: true
88217
+ } : {
88218
+ inside: false,
88219
+ outside: true
88220
+ };
88221
+ if (outsideKind === 1) return insideKind === void 0 ? {
88222
+ inside: false,
88223
+ outside: false
88224
+ } : insideKind === 1 ? {
88225
+ inside: true,
88226
+ outside: true
88227
+ } : {
88228
+ inside: false,
88229
+ outside: false
88230
+ };
88231
+ return insideKind === void 0 ? {
88232
+ inside: false,
88233
+ outside: false
88234
+ } : insideKind === 1 ? {
88235
+ inside: true,
88236
+ outside: false
88237
+ } : {
88238
+ inside: false,
88239
+ outside: false
88240
+ };
88241
+ }
88242
+ //#endregion
88243
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
87703
88244
  /**
87704
- * @import {Handle, Info, State} from 'mdast-util-to-markdown'
88245
+ * @import {Attention, Handle, Info, State} from 'mdast-util-to-markdown'
87705
88246
  * @import {PhrasingParents} from '../types.js'
87706
88247
  */
87707
88248
  /**
87708
- * Serialize the children of a parent that contains phrasing children.
88249
+ * Markers for builtin attention (emphasis, strong) to whether they are stricter:
88250
+ * whether they cannot open and close inside words.
87709
88251
  *
87710
- * These children will be joined flush together.
88252
+ * Builtin runs pair following CommonMark rules for emphasis and strong:
88253
+ * they are split,
88254
+ * using one or two markers at a time,
88255
+ * with the rule of 3.
88256
+ * Other markers pair like GFM strikethrough:
88257
+ * whole runs pair with a run of the same size.
88258
+ *
88259
+ * @type {Map<string, boolean>}
88260
+ */
88261
+ const builtins = /* @__PURE__ */ new Map([["*", false], ["_", true]]);
88262
+ /**
88263
+ * @typedef AttentionResult
88264
+ * Attention, of which the sequence is chosen later.
88265
+ * @property {Array<Item>} children
88266
+ * Serialized children.
88267
+ * @property {Array<string>} sequences
88268
+ * Sequences that can be used, in order of preference.
88269
+ */
88270
+ /**
88271
+ * @typedef Improvement
88272
+ * Improvement of attention sequences.
88273
+ * @property {Map<AttentionResult, string>} chosen
88274
+ * Chosen sequences for each attention.
88275
+ * @property {Array<Token>} tokens
88276
+ * Tokens involved in the improvement.
88277
+ * @property {Mistake | undefined} mistake
88278
+ * Mistake that led to this improvement, if any.
88279
+ */
88280
+ /**
88281
+ * @typedef {AttentionResult | string} Item
88282
+ * Serialized phrasing.
88283
+ */
88284
+ /**
88285
+ * @typedef Mistake
88286
+ * Sequence that does not form its attention.
88287
+ * @property {Array<AttentionResult>} attention
88288
+ * Attention to try other sequences for.
88289
+ * @property {number} index
88290
+ * Index of the token.
88291
+ */
88292
+ /**
88293
+ * @typedef Run
88294
+ * Sequences next to each other with the same marker.
88295
+ * @property {boolean} close
88296
+ * Whether it can close.
88297
+ * @property {number} end
88298
+ * Index after the last marker not used (to open).
88299
+ * @property {Array<Token>} markers
88300
+ * Sequence of each marker.
88301
+ * @property {boolean} open
88302
+ * Whether it can open.
88303
+ * @property {boolean} split
88304
+ * Whether it can be split (built-in attention).
88305
+ * @property {number} start
88306
+ * Index of the first marker not used (to close).
88307
+ * @property {Array<Token>} tokens
88308
+ * Sequences.
88309
+ */
88310
+ /**
88311
+ * @typedef Token
88312
+ * Rendered phrasing.
88313
+ * @property {AttentionResult | undefined} attention
88314
+ * Attention, if this is one of its sequences.
88315
+ * @property {string} value
88316
+ * Value.
88317
+ */
88318
+ /**
88319
+ * Get candidates for a mistake:
88320
+ * attention to try other sequences for,
88321
+ * later first.
88322
+ *
88323
+ * @param {Array<Token>} tokens
88324
+ * Tokens.
88325
+ * @param {Array<Token>} involved
88326
+ * Sequences involved in the mistake.
88327
+ * @param {Map<Token, Run>} runOf
88328
+ * Run of each sequence.
88329
+ * @returns {Array<AttentionResult>}
88330
+ * Candidates.
88331
+ */
88332
+ function candidates(tokens, involved, runOf) {
88333
+ /** @type {Set<AttentionResult | undefined>} */
88334
+ const related = /* @__PURE__ */ new Set();
88335
+ for (const token of tokens) {
88336
+ const siblings = runOf.get(token);
88337
+ if (siblings && token.attention && involved.some((d) => d.attention === token.attention)) for (const sibling of siblings.tokens) related.add(sibling.attention);
88338
+ }
88339
+ /** @type {Array<AttentionResult>} */
88340
+ const ordered = [];
88341
+ for (const token of tokens) if (token.attention && related.delete(token.attention)) ordered.push(token.attention);
88342
+ ordered.reverse();
88343
+ return ordered;
88344
+ }
88345
+ /**
88346
+ * Check whether sequences form their attention, like `micromark`.
88347
+ *
88348
+ * Sequences of `*` and `_` pair like emphasis and strong in CommonMark,
88349
+ * others like strikethrough in GFM.
88350
+ *
88351
+ * @param {Array<Token>} tokens
88352
+ * Tokens.
88353
+ * @param {string} before
88354
+ * Characters before.
88355
+ * @param {string} after
88356
+ * Characters after.
88357
+ * @returns {Mistake | undefined}
88358
+ * First mistake, if any.
88359
+ */
88360
+ function check(tokens, before, after) {
88361
+ /** @type {Array<Run>} */
88362
+ const runs = [];
88363
+ /** @type {Map<Token, Array<Token>>} */
88364
+ const wrong = /* @__PURE__ */ new Map();
88365
+ /** @type {Map<Token, Run>} */
88366
+ const runOf = /* @__PURE__ */ new Map();
88367
+ let index = 0;
88368
+ while (index < tokens.length) {
88369
+ if (!tokens[index].attention) {
88370
+ index++;
88371
+ continue;
88372
+ }
88373
+ const marker = tokens[index].value.charAt(0);
88374
+ const strict = builtins.get(marker);
88375
+ let end = index + 1;
88376
+ while (end < tokens.length && tokens[end].attention && tokens[end].value.charAt(0) === marker) end++;
88377
+ const head = index ? tokens[index - 1].value : before;
88378
+ const previous = classifyCharacter(head.charCodeAt(head.length - 1));
88379
+ const next = classifyCharacter((end < tokens.length ? tokens[end].value : after).charCodeAt(0));
88380
+ const open = !next || next === 2 && Boolean(previous);
88381
+ const close = !previous || previous === 2 && Boolean(next);
88382
+ /** @type {Run} */
88383
+ const run = {
88384
+ tokens: tokens.slice(index, end),
88385
+ markers: [],
88386
+ start: 0,
88387
+ end: 0,
88388
+ open: strict ? open && (Boolean(previous) || !close) : open,
88389
+ close: strict ? close && (Boolean(next) || !open) : close,
88390
+ split: strict !== void 0
88391
+ };
88392
+ for (const token of run.tokens) {
88393
+ wrong.set(token, [...run.tokens]);
88394
+ runOf.set(token, run);
88395
+ let size = token.value.length;
88396
+ while (size--) run.markers.push(token);
88397
+ }
88398
+ run.end = run.markers.length;
88399
+ runs.push(run);
88400
+ index = end;
88401
+ }
88402
+ pair(runs, wrong);
88403
+ index = -1;
88404
+ while (++index < tokens.length) {
88405
+ const involved = wrong.get(tokens[index]);
88406
+ if (involved) return {
88407
+ attention: candidates(tokens, involved, runOf),
88408
+ index
88409
+ };
88410
+ }
88411
+ }
88412
+ /**
88413
+ * Serialize the children of a parent that contains phrasing children.
87711
88414
  *
87712
88415
  * @param {PhrasingParents} parent
87713
- * Parent of flow nodes.
88416
+ * Parent of phrasing nodes.
87714
88417
  * @param {State} state
87715
88418
  * Info passed around about the current state.
87716
88419
  * @param {Info} info
87717
88420
  * Info on where we are in the document we are generating.
87718
88421
  * @returns {string}
87719
- * Serialized children, joined together.
88422
+ * Serialized result.
87720
88423
  */
87721
88424
  function containerPhrasing(parent, state, info) {
88425
+ return serialize(phrasing(parent, state, info), info.before, info.after);
88426
+ }
88427
+ /**
88428
+ * Encode the first or last character of tokens as a character reference,
88429
+ * if it is text.
88430
+ *
88431
+ * @param {Array<Token>} tokens
88432
+ * Tokens.
88433
+ * @param {boolean} start
88434
+ * Whether to encode the first or last character.
88435
+ * @returns {undefined}
88436
+ * Nothing.
88437
+ */
88438
+ function encode(tokens, start) {
88439
+ const token = tokens[start ? 0 : tokens.length - 1];
88440
+ if (!token || token.attention) return;
88441
+ const character = start ? firstCharacter(token.value) : lastCharacter(token.value);
88442
+ const reference = encodeCharacterReference(character.codePointAt(0));
88443
+ token.value = start ? reference + token.value.slice(character.length) : token.value.slice(0, token.value.length - character.length) + reference;
88444
+ }
88445
+ /**
88446
+ * Try other sequences for the candidates of a mistake and use the first that
88447
+ * moves the mistake further.
88448
+ *
88449
+ * @param {Array<Item>} items
88450
+ * Items.
88451
+ * @param {Map<AttentionResult, string>} chosen
88452
+ * Sequences to use instead of preferred sequences.
88453
+ * @param {Mistake} mistake
88454
+ * Mistake.
88455
+ * @param {string} before
88456
+ * Characters before.
88457
+ * @param {string} after
88458
+ * Characters after.
88459
+ * @returns {Improvement | undefined}
88460
+ * Result if better.
88461
+ */
88462
+ function improve(items, chosen, mistake, before, after) {
88463
+ for (const attention of mistake.attention) {
88464
+ const current = chosen.get(attention) || attention.sequences[0];
88465
+ for (const sequence of attention.sequences) {
88466
+ if (sequence === current) continue;
88467
+ const trial = new Map(chosen);
88468
+ trial.set(attention, sequence);
88469
+ const tokens = render(items, trial, before, after);
88470
+ const next = check(tokens, before, after);
88471
+ if (!next || next.index > mistake.index) return {
88472
+ chosen: trial,
88473
+ mistake: next,
88474
+ tokens
88475
+ };
88476
+ }
88477
+ }
88478
+ }
88479
+ /**
88480
+ * Pair runs like `micromark` and mark sequences that do form their attention
88481
+ * as fine.
88482
+ *
88483
+ * Each pair uses markers from the end of an opener and the start of a closer.
88484
+ * It forms the intended attention if those markers are exactly the whole
88485
+ * opening and closing sequence of one attention.
88486
+ * Otherwise attention is mixed up:
88487
+ * either sequences of different attention pair,
88488
+ * part of a sequence is used (such as `**` of strong as `*`),
88489
+ * or several sequences are used together (such as `*` and `*` as `**`).
88490
+ * Then the sequences involved are recorded with each other.
88491
+ *
88492
+ * @param {Array<Run>} runs
88493
+ * Runs.
88494
+ * @param {Map<Token, Array<Token>>} wrong
88495
+ * Sequences that are wrong, with the sequences involved.
88496
+ * @returns {undefined}
88497
+ * Nothing, `wrong` is changed.
88498
+ */
88499
+ function pair(runs, wrong) {
88500
+ let index = 0;
88501
+ while (index < runs.length) {
88502
+ const closer = runs[index];
88503
+ const marker = closer.tokens[0].value.charAt(0);
88504
+ const closerSize = closer.end - closer.start;
88505
+ let open = closer.close && closerSize ? index : 0;
88506
+ while (open--) {
88507
+ const opener = runs[open];
88508
+ const openerSize = opener.end - opener.start;
88509
+ if (opener.tokens[0].value.charAt(0) === marker && opener.open && openerSize && (closer.split ? !((opener.close || closer.open) && closerSize % 3) || (openerSize + closerSize) % 3 : openerSize === opener.markers.length && openerSize === closerSize)) {
88510
+ const size = closer.split ? openerSize > 1 && closerSize > 1 ? 2 : 1 : closerSize;
88511
+ const opening = opener.markers.slice(opener.end - size, opener.end);
88512
+ const closing = closer.markers.slice(closer.start, closer.start + size);
88513
+ const openToken = opening[0];
88514
+ const closeToken = closing[0];
88515
+ if (openToken === opening[size - 1] && openToken.value.length === size && closeToken === closing[size - 1] && closeToken.value.length === size && openToken.attention === closeToken.attention) {
88516
+ wrong.delete(openToken);
88517
+ wrong.delete(closeToken);
88518
+ } else {
88519
+ const involved = [.../* @__PURE__ */ new Set([...opening, ...closing])];
88520
+ for (const token of involved) {
88521
+ const list = wrong.get(token);
88522
+ if (list) list.push(...involved);
88523
+ }
88524
+ }
88525
+ opener.end -= size;
88526
+ closer.start += size;
88527
+ break;
88528
+ }
88529
+ }
88530
+ if (open === -1 || closer.start === closer.end) index++;
88531
+ }
88532
+ }
88533
+ /**
88534
+ * Get the sequences that can be used for attention, in order of preference.
88535
+ *
88536
+ * @param {string} type
88537
+ * Node type.
88538
+ * @param {Array<string>} markers
88539
+ * Markers.
88540
+ * @param {Array<number>} sizes
88541
+ * Sizes.
88542
+ * @returns {Array<string>}
88543
+ * Sequences.
88544
+ */
88545
+ function attentionSequences(type, markers, sizes) {
88546
+ if (markers.length === 0) throw new Error("Cannot serialize `" + type + "` as attention without markers, expected one or more markers");
88547
+ if (sizes.length === 0) throw new Error("Cannot serialize `" + type + "` as attention without sizes, expected one or more sizes");
88548
+ for (const size of sizes) if (!Number.isSafeInteger(size) || size < 1) throw new Error("Cannot serialize `" + type + "` as attention with `" + size + "` as size, expected positive integer");
88549
+ /** @type {Array<string>} */
88550
+ const sequences = [];
88551
+ for (const marker of markers) {
88552
+ if (marker.length !== 1) throw new Error("Cannot serialize `" + type + "` as attention with `" + marker + "` as marker, expected a single ascii character");
88553
+ if (!asciiPunctuation(marker.charCodeAt(0))) throw new Error("Cannot serialize `" + type + "` as attention with `" + marker + "` as marker, expected ascii punctuation");
88554
+ for (const size of sizes) sequences.push(marker.repeat(size));
88555
+ }
88556
+ return sequences;
88557
+ }
88558
+ /**
88559
+ * Serialize the children of a parent that contains phrasing children,
88560
+ * keeping attention separate,
88561
+ * so that its markers can be chosen later.
88562
+ *
88563
+ * @param {PhrasingParents} parent
88564
+ * Parent of phrasing nodes.
88565
+ * @param {State} state
88566
+ * Info passed around about the current state.
88567
+ * @param {Info} info
88568
+ * Info on where we are in the document we are generating.
88569
+ * @returns {Array<Item>}
88570
+ * Items.
88571
+ */
88572
+ function phrasing(parent, state, info) {
87722
88573
  const indexStack = state.indexStack;
87723
88574
  const children = parent.children || [];
87724
- /** @type {Array<string>} */
88575
+ /** @type {Array<Item>} */
87725
88576
  const results = [];
87726
88577
  let index = -1;
87727
88578
  let before = info.before;
87728
- /** @type {string | undefined} */
87729
- let encodeAfter;
87730
88579
  indexStack.push(-1);
87731
88580
  let tracker = state.createTracker(info);
87732
88581
  while (++index < children.length) {
@@ -87737,47 +88586,161 @@ function containerPhrasing(parent, state, info) {
87737
88586
  if (index + 1 < children.length) {
87738
88587
  /** @type {Handle} */
87739
88588
  let handle = state.handle.handlers[children[index + 1].type];
87740
- /** @type {Handle} */
87741
88589
  if (handle && handle.peek) handle = handle.peek;
87742
- after = handle ? handle(children[index + 1], parent, state, {
88590
+ after = handle ? firstCharacter(handle(children[index + 1], parent, state, {
87743
88591
  before: "",
87744
88592
  after: "",
87745
88593
  ...tracker.current()
87746
- }).charAt(0) : "";
88594
+ })) : "";
87747
88595
  } else after = info.after;
87748
- if (results.length > 0 && (before === "\r" || before === "\n") && child.type === "html") {
87749
- results[results.length - 1] = results[results.length - 1].replace(/(\r?\n|\r)$/, " ");
88596
+ const previous = results[results.length - 1];
88597
+ if (typeof previous === "string" && (before === "\r" || before === "\n") && child.type === "html" && htmlKind(child.value) !== 7) {
88598
+ results[results.length - 1] = previous.replace(/(\r?\n|\r)$/, " ");
87750
88599
  before = " ";
87751
88600
  tracker = state.createTracker(info);
87752
- tracker.move(results.join(""));
88601
+ tracker.move(serialize(results, info.before, info.after));
88602
+ }
88603
+ /** @type {(Handle & {attention?: Attention | undefined}) | undefined} */
88604
+ const handle = state.handle.handlers[child.type];
88605
+ if (handle && handle.attention) {
88606
+ const { construct, markers, sizes } = handle.attention(child, state);
88607
+ const sequences = attentionSequences(child.type, markers, sizes);
88608
+ const sequence = sequences[0];
88609
+ const exit = state.enter(construct);
88610
+ tracker.move(sequence);
88611
+ const inside = phrasing(child, state, {
88612
+ ...tracker.current(),
88613
+ before: sequence,
88614
+ after: sequence
88615
+ });
88616
+ tracker.move(serialize(inside, sequence, sequence));
88617
+ tracker.move(sequence);
88618
+ exit();
88619
+ results.push({
88620
+ children: inside,
88621
+ sequences
88622
+ });
88623
+ before = sequence.charAt(sequence.length - 1);
88624
+ } else {
88625
+ const value = state.handle(child, parent, state, {
88626
+ ...tracker.current(),
88627
+ after,
88628
+ before
88629
+ });
88630
+ if (!value) continue;
88631
+ tracker.move(value);
88632
+ results.push(value);
88633
+ before = lastCharacter(value);
87753
88634
  }
87754
- let value = state.handle(child, parent, state, {
87755
- ...tracker.current(),
87756
- after,
87757
- before
87758
- });
87759
- if (encodeAfter && encodeAfter === value.slice(0, 1)) value = encodeCharacterReference(encodeAfter.charCodeAt(0)) + value.slice(1);
87760
- const encodingInfo = state.attentionEncodeSurroundingInfo;
87761
- state.attentionEncodeSurroundingInfo = void 0;
87762
- encodeAfter = void 0;
87763
- if (encodingInfo) {
87764
- if (results.length > 0 && encodingInfo.before && before === results[results.length - 1].slice(-1)) results[results.length - 1] = results[results.length - 1].slice(0, -1) + encodeCharacterReference(before.charCodeAt(0));
87765
- if (encodingInfo.after) encodeAfter = after;
87766
- }
87767
- tracker.move(value);
87768
- results.push(value);
87769
- before = value.slice(-1);
87770
88635
  }
87771
88636
  indexStack.pop();
87772
- return results.join("");
88637
+ return results;
88638
+ }
88639
+ /**
88640
+ * Render items with sequences;
88641
+ * encoding characters around attention where needed.
88642
+ *
88643
+ * @param {Array<Item>} items
88644
+ * Serialized phrasing.
88645
+ * @param {Map<AttentionResult, string>} chosen
88646
+ * Sequences to use instead of preferred sequences.
88647
+ * @param {string} before
88648
+ * Characters before.
88649
+ * @param {string} after
88650
+ * Characters after.
88651
+ * @returns {Array<Token>}
88652
+ * Tokens.
88653
+ */
88654
+ function render(items, chosen, before, after) {
88655
+ /** @type {Array<Token>} */
88656
+ const tokens = [];
88657
+ /** @type {string | undefined} */
88658
+ let encodeAfter;
88659
+ let previous = lastCharacter(before);
88660
+ let index = -1;
88661
+ while (++index < items.length) {
88662
+ const item = items[index];
88663
+ if (typeof item === "string") {
88664
+ /** @type {Token} */
88665
+ const token = {
88666
+ value: item,
88667
+ attention: void 0
88668
+ };
88669
+ if (encodeAfter && encodeAfter === firstCharacter(item)) encode([token], true);
88670
+ encodeAfter = void 0;
88671
+ tokens.push(token);
88672
+ if (token.value) previous = lastCharacter(token.value);
88673
+ continue;
88674
+ }
88675
+ const sequence = chosen.get(item) || item.sequences[0];
88676
+ const marker = sequence.charAt(0);
88677
+ const next = items[index + 1];
88678
+ const outsideBefore = previous;
88679
+ const outsideAfter = firstCharacter(next === void 0 ? after : typeof next === "string" ? next : chosen.get(next) || next.sequences[0]);
88680
+ const inside = render(item.children, chosen, sequence, sequence);
88681
+ const head = inside.length > 0 ? inside[0].value : "";
88682
+ const open = encodeInfo(outsideBefore.charCodeAt(outsideBefore.length - 1), head.charCodeAt(0), marker);
88683
+ if (open.inside) encode(inside, true);
88684
+ const tail = inside.length > 0 ? lastCharacter(inside[inside.length - 1].value) : "";
88685
+ const close = encodeInfo(outsideAfter.charCodeAt(0), tail.charCodeAt(tail.length - 1), marker);
88686
+ if (close.inside) encode(inside, false);
88687
+ if (open.outside && outsideBefore !== "\n" && outsideBefore !== "\r") encode(tokens, false);
88688
+ if (close.outside) encodeAfter = outsideAfter;
88689
+ tokens.push({
88690
+ value: sequence,
88691
+ attention: item
88692
+ }, ...inside, {
88693
+ value: sequence,
88694
+ attention: item
88695
+ });
88696
+ previous = sequence.charAt(sequence.length - 1);
88697
+ }
88698
+ return tokens;
88699
+ }
88700
+ /**
88701
+ * Serialize phrasing with attention.
88702
+ *
88703
+ * Whether attention forms depends on everything around it.
88704
+ * This checks that it does and tries other sequences if not.
88705
+ *
88706
+ * @param {Array<Item>} items
88707
+ * Phrasing items.
88708
+ * @param {string} before
88709
+ * Characters before.
88710
+ * @param {string} after
88711
+ * Characters after.
88712
+ * @returns {string}
88713
+ * Serialized markdown.
88714
+ */
88715
+ function serialize(items, before, after) {
88716
+ /** @type {Map<AttentionResult, string>} */
88717
+ let chosen = /* @__PURE__ */ new Map();
88718
+ const initial = render(items, chosen, before, after);
88719
+ let tokens = initial;
88720
+ let mistake = check(tokens, before, after);
88721
+ while (mistake) {
88722
+ const next = improve(items, chosen, mistake, before, after);
88723
+ if (!next) {
88724
+ tokens = initial;
88725
+ break;
88726
+ }
88727
+ chosen = next.chosen;
88728
+ tokens = next.tokens;
88729
+ mistake = next.mistake;
88730
+ }
88731
+ let result = "";
88732
+ for (const token of tokens) result += token.value;
88733
+ return result;
87773
88734
  }
87774
88735
  //#endregion
87775
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/container-flow.js
88736
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/container-flow.js
87776
88737
  /**
87777
88738
  * @import {State} from 'mdast-util-to-markdown'
87778
88739
  * @import {FlowChildren, FlowParents, TrackFields} from '../types.js'
87779
88740
  */
87780
88741
  /**
88742
+ * Serialize the children of a parent that contains flow children.
88743
+ *
87781
88744
  * @param {FlowParents} parent
87782
88745
  * Parent of flow nodes.
87783
88746
  * @param {State} state
@@ -87810,11 +88773,18 @@ function containerFlow(parent, state, info) {
87810
88773
  return results.join("");
87811
88774
  }
87812
88775
  /**
88776
+ * Determine the markdown to insert between two flow nodes.
88777
+ *
87813
88778
  * @param {FlowChildren} left
88779
+ * Left flow node.
87814
88780
  * @param {FlowChildren} right
88781
+ * Right flow node.
87815
88782
  * @param {FlowParents} parent
88783
+ * Parent of the flow nodes.
87816
88784
  * @param {State} state
88785
+ * Info passed around.
87817
88786
  * @returns {string}
88787
+ * Markdown to insert between the two flow nodes.
87818
88788
  */
87819
88789
  function between(left, right, parent, state) {
87820
88790
  let index = state.join.length;
@@ -87827,12 +88797,14 @@ function between(left, right, parent, state) {
87827
88797
  return "\n\n";
87828
88798
  }
87829
88799
  //#endregion
87830
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js
88800
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js
87831
88801
  /**
87832
88802
  * @import {IndentLines} from '../types.js'
87833
88803
  */
87834
88804
  const eol = /\r?\n|\r/g;
87835
88805
  /**
88806
+ * Indents each line.
88807
+ *
87836
88808
  * @type {IndentLines}
87837
88809
  */
87838
88810
  function indentLines(value, map) {
@@ -87851,17 +88823,21 @@ function indentLines(value, map) {
87851
88823
  one(value.slice(start));
87852
88824
  return result.join("");
87853
88825
  /**
88826
+ * Indents a single line.
88827
+ *
87854
88828
  * @param {string} value
88829
+ * Line.
87855
88830
  */
87856
88831
  function one(value) {
87857
88832
  result.push(map(value, line, !value));
87858
88833
  }
87859
88834
  }
87860
88835
  //#endregion
87861
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/safe.js
88836
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/safe.js
87862
88837
  /**
87863
88838
  * @import {SafeConfig, State} from 'mdast-util-to-markdown'
87864
88839
  */
88840
+ const own$3 = {}.hasOwnProperty;
87865
88841
  /**
87866
88842
  * Make a string safe for embedding in markdown constructs.
87867
88843
  *
@@ -87872,8 +88848,8 @@ function indentLines(value, map) {
87872
88848
  *
87873
88849
  * To solve this, `mdast-util-to-markdown` tracks:
87874
88850
  *
87875
- * * Characters before and after something;
87876
- * * What “constructs” we are in.
88851
+ * * characters before and after something;
88852
+ * * what “constructs” we are in.
87877
88853
  *
87878
88854
  * This information is then used by this function to escape or encode
87879
88855
  * special characters.
@@ -87895,6 +88871,7 @@ function safe(state, input, config) {
87895
88871
  const result = [];
87896
88872
  /** @type {Record<number, {before: boolean, after: boolean}>} */
87897
88873
  const infos = {};
88874
+ const percentEncode = state.stack.includes("autolink");
87898
88875
  let index = -1;
87899
88876
  while (++index < state.unsafe.length) {
87900
88877
  const pattern = state.unsafe[index];
@@ -87906,7 +88883,7 @@ function safe(state, input, config) {
87906
88883
  const before = "before" in pattern || Boolean(pattern.atBreak);
87907
88884
  const after = "after" in pattern;
87908
88885
  const position = match.index + (before ? match[1].length : 0);
87909
- if (positions.includes(position)) {
88886
+ if (own$3.call(infos, position)) {
87910
88887
  if (infos[position].before && !before) infos[position].before = false;
87911
88888
  if (infos[position].after && !after) infos[position].after = false;
87912
88889
  } else {
@@ -87919,36 +88896,63 @@ function safe(state, input, config) {
87919
88896
  }
87920
88897
  }
87921
88898
  positions.sort(numerical);
87922
- let start = config.before ? config.before.length : 0;
88899
+ const offset = config.before ? config.before.length : 0;
87923
88900
  const end = value.length - (config.after ? config.after.length : 0);
88901
+ let start = offset;
87924
88902
  index = -1;
87925
88903
  while (++index < positions.length) {
87926
88904
  const position = positions[index];
87927
88905
  if (position < start || position >= end) continue;
88906
+ if (value.charAt(position) === "_" && position > 0 && classifyCharacter(value.charCodeAt(position - 1)) === void 0 && !own$3.call(infos, position - 1) && !(position - 1 === offset && /[*_]/.test(value.charAt(offset - 1)))) {
88907
+ let sequenceEnd = position + 1;
88908
+ while (sequenceEnd < end && value.charAt(sequenceEnd) === "_") sequenceEnd++;
88909
+ const skip = sequenceEnd - position - 1;
88910
+ if (positions[index + skip] === sequenceEnd - 1 && sequenceEnd < value.length && classifyCharacter(value.charCodeAt(sequenceEnd)) === void 0 && !own$3.call(infos, sequenceEnd) && !(sequenceEnd === end - 1 && /[*_]/.test(value.charAt(end)))) {
88911
+ index += skip;
88912
+ continue;
88913
+ }
88914
+ }
87928
88915
  if (position + 1 < end && positions[index + 1] === position + 1 && infos[position].after && !infos[position + 1].before && !infos[position + 1].after || positions[index - 1] === position - 1 && infos[position].before && !infos[position - 1].before && !infos[position - 1].after) continue;
87929
- if (start !== position) result.push(escapeBackslashes(value.slice(start, position), "\\"));
88916
+ if (start !== position) {
88917
+ const slice = value.slice(start, position);
88918
+ result.push(percentEncode ? slice : escapeBackslashes(slice, "\\"));
88919
+ }
87930
88920
  start = position;
87931
- if (/[!-/:-@[-`{-~]/.test(value.charAt(position)) && (!config.encode || !config.encode.includes(value.charAt(position)))) result.push("\\");
88921
+ if (percentEncode) {
88922
+ result.push("%" + value.charCodeAt(position).toString(16).toUpperCase().padStart(2, "0"));
88923
+ start++;
88924
+ } else if (/[!-/:-@[-`{-~]/.test(value.charAt(position)) && (!config.encode || !config.encode.includes(value.charAt(position)))) result.push("\\");
87932
88925
  else {
87933
88926
  result.push(encodeCharacterReference(value.charCodeAt(position)));
87934
88927
  start++;
87935
88928
  }
87936
88929
  }
87937
- result.push(escapeBackslashes(value.slice(start, end), config.after));
88930
+ const rest = value.slice(start, end);
88931
+ result.push(percentEncode ? rest : escapeBackslashes(rest, config.after));
87938
88932
  return result.join("");
87939
88933
  }
87940
88934
  /**
88935
+ * Compare two numbers.
88936
+ *
87941
88937
  * @param {number} a
88938
+ * Number.
87942
88939
  * @param {number} b
88940
+ * Other number.
87943
88941
  * @returns {number}
88942
+ * Result.
87944
88943
  */
87945
88944
  function numerical(a, b) {
87946
88945
  return a - b;
87947
88946
  }
87948
88947
  /**
88948
+ * Escape backslashes in a string, considering characters that follow.
88949
+ *
87949
88950
  * @param {string} value
88951
+ * Value.
87950
88952
  * @param {string} after
88953
+ * Characters that follow the value.
87951
88954
  * @returns {string}
88955
+ * Escaped string.
87952
88956
  */
87953
88957
  function escapeBackslashes(value, after) {
87954
88958
  const expression = /\\(?=[!-/:-@[-`{-~])/g;
@@ -87971,7 +88975,7 @@ function escapeBackslashes(value, after) {
87971
88975
  return results.join("");
87972
88976
  }
87973
88977
  //#endregion
87974
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/track.js
88978
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/util/track.js
87975
88979
  /**
87976
88980
  * @import {CreateTracker, TrackCurrent, TrackMove, TrackShift} from '../types.js'
87977
88981
  */
@@ -88029,7 +89033,7 @@ function track(config) {
88029
89033
  }
88030
89034
  }
88031
89035
  //#endregion
88032
- //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/index.js
89036
+ //#region node_modules/.pnpm/mdast-util-to-markdown@2.1.3/node_modules/mdast-util-to-markdown/lib/index.js
88033
89037
  /**
88034
89038
  * @import {Info, Join, Options, SafeConfig, State} from 'mdast-util-to-markdown'
88035
89039
  * @import {Nodes} from 'mdast'
@@ -88050,6 +89054,8 @@ function toMarkdown(tree, options) {
88050
89054
  /** @type {State} */
88051
89055
  const state = {
88052
89056
  associationId: association,
89057
+ bulletCurrent: void 0,
89058
+ bulletLastUsed: void 0,
88053
89059
  containerPhrasing: containerPhrasingBound,
88054
89060
  containerFlow: containerFlowBound,
88055
89061
  createTracker: track,
@@ -88072,7 +89078,10 @@ function toMarkdown(tree, options) {
88072
89078
  unknown,
88073
89079
  handlers: state.handlers
88074
89080
  });
88075
- let result = state.handle(tree, void 0, state, {
89081
+ let result = state.handle(phrasing$2(tree) ? {
89082
+ type: "root",
89083
+ children: [tree]
89084
+ } : tree, void 0, state, {
88076
89085
  before: "\n",
88077
89086
  after: "\n",
88078
89087
  now: {
@@ -88083,12 +89092,19 @@ function toMarkdown(tree, options) {
88083
89092
  });
88084
89093
  if (result && result.charCodeAt(result.length - 1) !== 10 && result.charCodeAt(result.length - 1) !== 13) result += "\n";
88085
89094
  return result;
88086
- /** @type {Enter} */
89095
+ /**
89096
+ * Enter a construct.
89097
+ *
89098
+ * @type {Enter}
89099
+ */
88087
89100
  function enter(name) {
88088
89101
  state.stack.push(name);
88089
89102
  return exit;
88090
89103
  /**
89104
+ * Exit a construct.
89105
+ *
88091
89106
  * @returns {undefined}
89107
+ * Nothing.
88092
89108
  */
88093
89109
  function exit() {
88094
89110
  state.stack.pop();
@@ -88096,20 +89112,36 @@ function toMarkdown(tree, options) {
88096
89112
  }
88097
89113
  }
88098
89114
  /**
89115
+ * Handle an invalid value that cannot be processed.
89116
+ *
88099
89117
  * @param {unknown} value
89118
+ * Value.
88100
89119
  * @returns {never}
89120
+ * Never.
89121
+ * @throws {Error}
89122
+ * Always.
88101
89123
  */
88102
89124
  function invalid(value) {
88103
89125
  throw new Error("Cannot handle value `" + value + "`, expected node");
88104
89126
  }
88105
89127
  /**
89128
+ * Handle an unknown node.
89129
+ *
88106
89130
  * @param {unknown} value
89131
+ * Value.
88107
89132
  * @returns {never}
89133
+ * Never.
89134
+ * @throws {Error}
89135
+ * Always.
88108
89136
  */
88109
89137
  function unknown(value) {
88110
89138
  throw new Error("Cannot handle unknown node `" + value.type + "`");
88111
89139
  }
88112
- /** @type {Join} */
89140
+ /**
89141
+ * Join function for `tightDefinitions` option.
89142
+ *
89143
+ * @type {Join}
89144
+ */
88113
89145
  function joinDefinition(left, right) {
88114
89146
  if (left.type === "definition" && left.type === right.type) return 0;
88115
89147
  }
@@ -92639,105 +93671,6 @@ function tokenizeHeadingAtx(effects, ok, nok) {
92639
93671
  }
92640
93672
  }
92641
93673
  //#endregion
92642
- //#region node_modules/.pnpm/micromark-util-html-tag-name@2.0.1/node_modules/micromark-util-html-tag-name/index.js
92643
- /**
92644
- * List of lowercase HTML “block” tag names.
92645
- *
92646
- * The list, when parsing HTML (flow), results in more relaxed rules (condition
92647
- * 6).
92648
- * Because they are known blocks, the HTML-like syntax doesn’t have to be
92649
- * strictly parsed.
92650
- * For tag names not in this list, a more strict algorithm (condition 7) is used
92651
- * to detect whether the HTML-like syntax is seen as HTML (flow) or not.
92652
- *
92653
- * This is copied from:
92654
- * <https://spec.commonmark.org/0.30/#html-blocks>.
92655
- *
92656
- * > 👉 **Note**: `search` was added in `CommonMark@0.31`.
92657
- */
92658
- const htmlBlockNames = [
92659
- "address",
92660
- "article",
92661
- "aside",
92662
- "base",
92663
- "basefont",
92664
- "blockquote",
92665
- "body",
92666
- "caption",
92667
- "center",
92668
- "col",
92669
- "colgroup",
92670
- "dd",
92671
- "details",
92672
- "dialog",
92673
- "dir",
92674
- "div",
92675
- "dl",
92676
- "dt",
92677
- "fieldset",
92678
- "figcaption",
92679
- "figure",
92680
- "footer",
92681
- "form",
92682
- "frame",
92683
- "frameset",
92684
- "h1",
92685
- "h2",
92686
- "h3",
92687
- "h4",
92688
- "h5",
92689
- "h6",
92690
- "head",
92691
- "header",
92692
- "hr",
92693
- "html",
92694
- "iframe",
92695
- "legend",
92696
- "li",
92697
- "link",
92698
- "main",
92699
- "menu",
92700
- "menuitem",
92701
- "nav",
92702
- "noframes",
92703
- "ol",
92704
- "optgroup",
92705
- "option",
92706
- "p",
92707
- "param",
92708
- "search",
92709
- "section",
92710
- "summary",
92711
- "table",
92712
- "tbody",
92713
- "td",
92714
- "tfoot",
92715
- "th",
92716
- "thead",
92717
- "title",
92718
- "tr",
92719
- "track",
92720
- "ul"
92721
- ];
92722
- /**
92723
- * List of lowercase HTML “raw” tag names.
92724
- *
92725
- * The list, when parsing HTML (flow), results in HTML that can include lines
92726
- * without exiting, until a closing tag also in this list is found (condition
92727
- * 1).
92728
- *
92729
- * This module is copied from:
92730
- * <https://spec.commonmark.org/0.30/#html-blocks>.
92731
- *
92732
- * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`.
92733
- */
92734
- const htmlRawNames = [
92735
- "pre",
92736
- "script",
92737
- "style",
92738
- "textarea"
92739
- ];
92740
- //#endregion
92741
93674
  //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/html-flow.js
92742
93675
  /**
92743
93676
  * @import {
@@ -102528,6 +103461,17 @@ const truncateIfNeeded = (text, advice = "Use pagination or filters to reduce re
102528
103461
  if (text.length <= CHARACTER_LIMIT) return text;
102529
103462
  return `${text.slice(0, CHARACTER_LIMIT)}\n\n--- Response truncated (${text.length} chars, limit ${CHARACTER_LIMIT}). ${advice} ---`;
102530
103463
  };
103464
+ const INPUT_NAME_OF = {
103465
+ Labels: "label_names",
103466
+ Section: "section_id",
103467
+ "Permission group": "permission_group_id",
103468
+ "User segment": "user_segment_id",
103469
+ Assignee: "assignee_id",
103470
+ Form: "form_id",
103471
+ assignee: "assignee_id",
103472
+ group: "group_id"
103473
+ };
103474
+ const writable = (label) => `**${label}** (${INPUT_NAME_OF[label]})`;
102531
103475
  const formatPagination = (meta) => {
102532
103476
  const parts = [`Results: ${meta.count}`];
102533
103477
  if (meta.has_more) parts.push(`More available (cursor: ${meta.after_cursor})`);
@@ -102536,7 +103480,7 @@ const formatPagination = (meta) => {
102536
103480
  const formatTicket = (ticket) => [
102537
103481
  `## Ticket #${ticket.id}: ${ticket.subject}`,
102538
103482
  `- **Status**: ${ticket.status} | **Priority**: ${ticket.priority ?? "none"} | **Type**: ${ticket.type ?? "none"}`,
102539
- `- **Requester**: ${ticket.requester_id} | **Assignee**: ${ticket.assignee_id ?? "unassigned"}`,
103483
+ `- **Requester**: ${ticket.requester_id} | ${writable("Assignee")}: ${ticket.assignee_id ?? "unassigned"}`,
102540
103484
  `- **Tags**: ${ticket.tags.length > 0 ? ticket.tags.join(", ") : "none"}`,
102541
103485
  `- **Created**: ${ticket.created_at} | **Updated**: ${ticket.updated_at}`,
102542
103486
  ticket.description ? `\n${ticket.description}` : ""
@@ -102647,7 +103591,7 @@ const formatComment = (comment, authors) => {
102647
103591
  const formatRequest = (request) => [
102648
103592
  `## Request #${request.id}: ${request.subject}`,
102649
103593
  `- **Status**: ${request.status}${request.type ? ` | **Type**: ${request.type}` : ""}${request.priority ? ` | **Priority**: ${request.priority}` : ""}`,
102650
- request.ticket_form_id ? `- **Form**: ${request.ticket_form_id}` : "",
103594
+ request.ticket_form_id ? `- ${writable("Form")}: ${request.ticket_form_id}` : "",
102651
103595
  `- **Can you mark it solved**: ${request.can_be_solved_by_me ? "yes" : "no"}`,
102652
103596
  request.via?.channel ? `- **Submitted via**: ${request.via.channel}` : "",
102653
103597
  `- **Created**: ${request.created_at} | **Updated**: ${request.updated_at}`,
@@ -102691,6 +103635,10 @@ const AUDIT_FIELD_LABELS = {
102691
103635
  submitter_id: "submitter",
102692
103636
  group_id: "group"
102693
103637
  };
103638
+ const auditLabel = (field) => {
103639
+ const label = AUDIT_FIELD_LABELS[field] ?? field;
103640
+ return label in INPUT_NAME_OF ? writable(label) : `**${label}**`;
103641
+ };
102694
103642
  const renderAuditValue = (field, value, names) => {
102695
103643
  if (value === null || value === void 0 || value === "") return "";
102696
103644
  const entity = AUDIT_ENTITY_FIELDS[field];
@@ -102710,7 +103658,7 @@ const renderCreateEvent = (event, names) => {
102710
103658
  return tags.length > 0 ? `- **tags**: ${tags.join(", ")}` : null;
102711
103659
  }
102712
103660
  const value = renderAuditValue(field, event.value, names);
102713
- return value === "" ? null : `- **${AUDIT_FIELD_LABELS[field] ?? field}**: ${value}`;
103661
+ return value === "" ? null : `- ${auditLabel(field)}: ${value}`;
102714
103662
  };
102715
103663
  const renderChangeEvent = (event, names) => {
102716
103664
  const field = event.field_name;
@@ -102719,7 +103667,7 @@ const renderChangeEvent = (event, names) => {
102719
103667
  const after = renderAuditValue(field, event.value, names);
102720
103668
  const before = renderAuditValue(field, event.previous_value, names);
102721
103669
  if (before === after) return null;
102722
- return `- **${AUDIT_FIELD_LABELS[field] ?? field}**: ${before || "(none)"} → ${after || "(none)"}`;
103670
+ return `- ${auditLabel(field)}: ${before || "(none)"} → ${after || "(none)"}`;
102723
103671
  };
102724
103672
  const renderAuditEvent = (event, names) => {
102725
103673
  switch (event.type) {
@@ -102757,11 +103705,11 @@ const formatOrganization = (org) => [
102757
103705
  const formatArticleSummary = (article) => [
102758
103706
  `## ${article.title} (${article.id})`,
102759
103707
  `- **Locale**: ${article.locale} | **Source locale**: ${article.source_locale}`,
102760
- `- **Section**: ${article.section_id} | **Draft**: ${article.draft}`,
103708
+ `- ${writable("Section")}: ${article.section_id} | **Draft**: ${article.draft}`,
102761
103709
  article.promoted ? "- **Promoted**: featured in its section — changing this requires Help Center admin (Guide admin) rights; set via update_article `promoted`." : "",
102762
- `- **Permission group**: ${article.permission_group_id} | **User segment**: ${article.user_segment_id ?? "everyone (no segment)"}`,
103710
+ `- ${writable("Permission group")}: ${article.permission_group_id} | ${writable("User segment")}: ${article.user_segment_id ?? "everyone (no segment)"}`,
102763
103711
  typeof article.position === "number" ? `- **Position**: ${article.position}` : "",
102764
- article.label_names.length > 0 ? `- **Labels**: ${article.label_names.join(", ")}` : "",
103712
+ article.label_names.length > 0 ? `- ${writable("Labels")}: ${article.label_names.join(", ")}` : "",
102765
103713
  `- **Created**: ${article.created_at} | **Updated**: ${article.updated_at}`
102766
103714
  ].filter(Boolean).join("\n");
102767
103715
  const formatArticle = (article) => [
@@ -104066,7 +105014,7 @@ const createHelpCenterTools = (ctx) => {
104066
105014
  namespace: "help_center",
104067
105015
  readOnly: false,
104068
105016
  title: "Update Help Center Article",
104069
- description: "Update article metadata only (draft, promoted, labels, tags, visibility, section, sort position, etc.) and return the updated article. Does NOT update content (title, body) — use update_article_translation for that.",
105017
+ description: "Update article metadata only (draft, promoted, labels as label_names, content tags as content_tag_ids, visibility as permission_group_id / user_segment_id, section_id, sort position, etc.) and return the updated article. Does NOT update content (title, body) — use update_article_translation for that.",
104070
105018
  inputSchema: object({
104071
105019
  article_id: number$2().int().describe("Article ID — the numeric id of the article to update. Obtain it from list_articles or search_articles."),
104072
105020
  draft: boolean$1().optional().describe("Set true to unpublish the article (revert to draft) or false to publish it."),
@@ -104247,7 +105195,7 @@ const createHelpCenterTools = (ctx) => {
104247
105195
  namespace: "help_center",
104248
105196
  readOnly: true,
104249
105197
  title: "List Article Labels",
104250
- description: "List all article labels. Labels improve Help Center search ranking and are not visible to end users.",
105198
+ description: "List all article labels. Labels improve Help Center search ranking and are not visible to end users. Attach them to an article through the label_names parameter of create_article or update_article.",
104251
105199
  inputSchema: object({}),
104252
105200
  annotations: {
104253
105201
  readOnlyHint: true,
@@ -106621,7 +107569,7 @@ const createMcpServer = (config, getToken, logger = silentLogger, onUnauthorized
106621
107569
  return server;
106622
107570
  };
106623
107571
  //#endregion
106624
- //#region node_modules/.pnpm/@modelcontextprotocol+server@2.1.0/node_modules/@modelcontextprotocol/server/dist/stdio.mjs
107572
+ //#region node_modules/.pnpm/@modelcontextprotocol+server@2.2.0/node_modules/@modelcontextprotocol/server/dist/stdio.mjs
106625
107573
  /**
106626
107574
  * Marks a stdout `'error'` listener that a closed transport left attached purely to
106627
107575
  * swallow late write failures (see {@link StdioServerTransport.close}). A fresh
@@ -107046,7 +107994,7 @@ const installShutdown = (options) => {
107046
107994
  //#endregion
107047
107995
  //#region src/index.ts
107048
107996
  const buildStdioTokenStore = async (config, logger) => {
107049
- const { createTokenStore } = await import("./token-store-CLtwRaxI.js");
107997
+ const { createTokenStore } = await import("./token-store-SYK0DN9M.js");
107050
107998
  return createTokenStore({
107051
107999
  subdomain: config.subdomain,
107052
108000
  oauthClientId: config.oauthClientId,
@@ -107085,7 +108033,7 @@ const main = async () => {
107085
108033
  return;
107086
108034
  }
107087
108035
  if (config.dev) logger.warn("dev_mode_ignored_http");
107088
- const { startHttpTransport } = await import("./http-CmtU-oNu.js");
108036
+ const { startHttpTransport } = await import("./http-7NVoxfEA.js");
107089
108037
  const http = await startHttpTransport(config, logger);
107090
108038
  installShutdown({
107091
108039
  watchStdin: false,