@rohal12/spindle 0.64.1 → 0.64.3

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.
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __defProp = Object.defineProperty;
3
3
  var __exportAll = (all, no_symbols) => {
4
4
  let target = {};
@@ -9,8 +9,7 @@ var __exportAll = (all, no_symbols) => {
9
9
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
10
  return target;
11
11
  };
12
- //#endregion
13
- //#region src/utils/macro-names.ts
12
+ // src/utils/macro-names.ts
14
13
  /**
15
14
  * Macro and widget names are case-insensitive: `{StatusBar}` invokes the
16
15
  * widget defined as `statusbar`. A NameMap keys its entries by the lowercased
@@ -55,8 +54,7 @@ var NameSet = class {
55
54
  this.names.clear();
56
55
  }
57
56
  };
58
- //#endregion
59
- //#region src/markup/tokens.ts
57
+ // src/markup/tokens.ts
60
58
  /** Variable sigils: story ($), temporary (_), local (@), transient (%). */
61
59
  var SIGIL_SCOPES = {
62
60
  $: "variable",
@@ -76,8 +74,7 @@ function withSelectors$1(target, from) {
76
74
  if (from.id) target.id = from.id;
77
75
  return target;
78
76
  }
79
- //#endregion
80
- //#region src/markup/grammar-shared.ts
77
+ // src/markup/grammar-shared.ts
81
78
  /**
82
79
  * What the grammar (spindle.peggy) imports from the rest of Spindle, so that
83
80
  * it holds no second copy: the generated parser imports this module's
@@ -87,8 +84,7 @@ var grammar_shared_default = {
87
84
  SIGIL_SCOPES,
88
85
  withSelectors: withSelectors$1
89
86
  };
90
- //#endregion
91
- //#region src/markup/spindle.peggy
87
+ // src/markup/spindle.peggy
92
88
  var LB = String.fromCharCode(123);
93
89
  var RB = String.fromCharCode(125);
94
90
  var { SIGIL_SCOPES: SIGIL_SCOPES$1, withSelectors } = grammar_shared_default;
@@ -3636,8 +3632,7 @@ function peg$parse(input, options) {
3636
3632
  if (peg$success) return peg$result;
3637
3633
  else peg$throw();
3638
3634
  }
3639
- //#endregion
3640
- //#region src/components/macros/option-clauses.ts
3635
+ // src/components/macros/option-clauses.ts
3641
3636
  /** The direct value clauses read by the built-in choice controls. */
3642
3637
  var OPTION_CLAUSE = "option";
3643
3638
  function isOptionClause(name) {
@@ -3760,8 +3755,7 @@ getMacroParameters.source = (name) => metadataRegistry.get(name)?.source;
3760
3755
  function getMacroRegistry() {
3761
3756
  return Array.from(metadataRegistry.values());
3762
3757
  }
3763
- //#endregion
3764
- //#region src/markup/ast.ts
3758
+ // src/markup/ast.ts
3765
3759
  /**
3766
3760
  * The passage AST (built by parse.ts), and the registry of block macros:
3767
3761
  * those whose body the parser nests up to their `{/name}`.
@@ -3884,8 +3878,7 @@ function astNode({ token, body }) {
3884
3878
  }
3885
3879
  }
3886
3880
  }
3887
- //#endregion
3888
- //#region src/utils/sorted.ts
3881
+ // src/utils/sorted.ts
3889
3882
  /** Index of the first sorted value greater than `value` (or the length). */
3890
3883
  function upperBound(sorted, value) {
3891
3884
  let low = 0;
@@ -3897,8 +3890,7 @@ function upperBound(sorted, value) {
3897
3890
  }
3898
3891
  return low;
3899
3892
  }
3900
- //#endregion
3901
- //#region src/markup/line-column.ts
3893
+ // src/markup/line-column.ts
3902
3894
  /** 1-based line and column of `offset` in `text`. */
3903
3895
  function lineColumn(text, offset) {
3904
3896
  let line = 1;
@@ -3925,8 +3917,7 @@ function sourcePositions(text) {
3925
3917
  };
3926
3918
  };
3927
3919
  }
3928
- //#endregion
3929
- //#region src/markup/pair.ts
3920
+ // src/markup/pair.ts
3930
3921
  /**
3931
3922
  * Pairing: which closer closes which opener among the flat tokens of markup
3932
3923
  * (parse.ts tokenizeMarkup), and which branch (`{else}`, `{case}`) belongs to
@@ -4118,8 +4109,7 @@ function lastEnd(body) {
4118
4109
  const branch = last$1(body.branches);
4119
4110
  return last$1(branch?.children ?? body.children)?.end ?? branch?.tag.end;
4120
4111
  }
4121
- //#endregion
4122
- //#region node_modules/acorn/dist/acorn.mjs
4112
+ // node_modules/acorn/dist/acorn.mjs
4123
4113
  var astralIdentifierCodes = [
4124
4114
  509,
4125
4115
  0,
@@ -9319,8 +9309,7 @@ Parser.acorn = {
9319
9309
  function parse$1(input, options) {
9320
9310
  return Parser.parse(input, options);
9321
9311
  }
9322
- //#endregion
9323
- //#region src/js-lexer.ts
9312
+ // src/js-lexer.ts
9324
9313
  /** Code runs through `new Function`: a non-strict script body. */
9325
9314
  var OPTIONS = {
9326
9315
  ecmaVersion: "latest",
@@ -10239,8 +10228,7 @@ function scanStringLiteral(src, start) {
10239
10228
  closed: false
10240
10229
  };
10241
10230
  }
10242
- //#endregion
10243
- //#region src/markup/code-end.ts
10231
+ // src/markup/code-end.ts
10244
10232
  /**
10245
10233
  * A quote directly after a letter/digit is an apostrophe (don't), not a
10246
10234
  * string; after a backslash it is an escaped attribute delimiter (\").
@@ -10410,8 +10398,7 @@ function indexCodeEnds(input) {
10410
10398
  return end < 0 ? -1 : base + end;
10411
10399
  };
10412
10400
  }
10413
- //#endregion
10414
- //#region src/markup/code-attributes.ts
10401
+ // src/markup/code-attributes.ts
10415
10402
  /**
10416
10403
  * Attributes whose value is code with braces of its own, not text: event
10417
10404
  * handlers (`on…`, JavaScript), `pattern` (a regular expression, as in
@@ -10463,8 +10450,7 @@ function splitSigilTemplate(template, incomplete = false) {
10463
10450
  if (text) parts.push({ text });
10464
10451
  return parts;
10465
10452
  }
10466
- //#endregion
10467
- //#region src/markup/parse.ts
10453
+ // src/markup/parse.ts
10468
10454
  /**
10469
10455
  * Passage markup parser: the Peggy grammar (spindle.peggy) with Spindle's
10470
10456
  * hooks plugged in. It builds the AST directly and reports malformed markup
@@ -10693,8 +10679,7 @@ function mapOffsets(token, map) {
10693
10679
  function shiftOffsets(token, by) {
10694
10680
  return by === 0 ? token : mapOffsets(token, (offset) => offset + by);
10695
10681
  }
10696
- //#endregion
10697
- //#region src/utils/parse-delay.ts
10682
+ // src/utils/parse-delay.ts
10698
10683
  /**
10699
10684
  * Parse a delay string into milliseconds.
10700
10685
  * Supports: "2s" → 2000, "500ms" → 500, bare number → ms
@@ -10705,8 +10690,7 @@ function parseDelay(str) {
10705
10690
  if (trimmed.endsWith("s")) return parseFloat(trimmed.slice(0, -1)) * 1e3;
10706
10691
  return parseFloat(trimmed);
10707
10692
  }
10708
- //#endregion
10709
- //#region src/utils/error-message.ts
10693
+ // src/utils/error-message.ts
10710
10694
  /**
10711
10695
  * The message to show for a caught value. Anything can be thrown, not only
10712
10696
  * Errors: an Error gives its message, a string is its own message, and any
@@ -10723,8 +10707,7 @@ function errorMessage(err, fallback) {
10723
10707
  return fallback ?? "Unprintable error";
10724
10708
  }
10725
10709
  }
10726
- //#endregion
10727
- //#region src/utils/listeners.ts
10710
+ // src/utils/listeners.ts
10728
10711
  /**
10729
10712
  * A set of listeners to call when something happens: `subscribe` adds one and
10730
10713
  * returns the function that removes it, `notify` calls each one. A listener
@@ -10745,8 +10728,7 @@ function createListeners() {
10745
10728
  }
10746
10729
  };
10747
10730
  }
10748
- //#endregion
10749
- //#region src/runtime-errors.ts
10731
+ // src/runtime-errors.ts
10750
10732
  var listeners = createListeners();
10751
10733
  /**
10752
10734
  * The error for `name`, a passage name that names no passage, used in the
@@ -10756,8 +10738,7 @@ function noPassageError(name, from) {
10756
10738
  return /* @__PURE__ */ new Error(`No passage named ${JSON.stringify(name)} (in passage ${JSON.stringify(from)})`);
10757
10739
  }
10758
10740
  listeners.subscribe;
10759
- //#endregion
10760
- //#region src/utils/namespace.ts
10741
+ // src/utils/namespace.ts
10761
10742
  /** The variable name no namespace can hold. */
10762
10743
  var RESERVED_NAME = "__proto__";
10763
10744
  /**
@@ -10789,8 +10770,7 @@ function ownEntries(sources, keep = () => true) {
10789
10770
  /** A namespace with no prototype holding the own entries of `sources`. */
10790
10771
  var createNamespace = (...sources) => ownEntries(sources);
10791
10772
  Object.freeze(createNamespace());
10792
- //#endregion
10793
- //#region src/components/macros/arg-utils.ts
10773
+ // src/components/macros/arg-utils.ts
10794
10774
  /**
10795
10775
  * Shared helpers for macros that split or read their raw argument text by
10796
10776
  * hand. Their lexical model is the expression lexer's (`js-lexer.ts`):
@@ -10976,8 +10956,11 @@ function splitArgSpans(raw) {
10976
10956
  function splitArgs(raw) {
10977
10957
  return splitArgSpans(raw).map(([a, b]) => raw.slice(a, b));
10978
10958
  }
10979
- //#endregion
10980
- //#region src/components/macros/macro-args.ts
10959
+ /** `text` as a regular expression source that matches it literally. */
10960
+ function escapeRegExp(text) {
10961
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
10962
+ }
10963
+ // src/components/macros/macro-args.ts
10981
10964
  /**
10982
10965
  * The macro argument layer: reads a macro's raw argument text into the
10983
10966
  * parameters its definition declares (see ParameterDef), so every macro
@@ -11368,8 +11351,7 @@ var SUB_MACRO_PARAMETERS = /* @__PURE__ */ new Map([[OPTION_CLAUSE, [{
11368
11351
  function subMacroParameters(name) {
11369
11352
  return SUB_MACRO_PARAMETERS.get(name.toLowerCase());
11370
11353
  }
11371
- //#endregion
11372
- //#region src/markup/expansion-budget.ts
11354
+ // src/markup/expansion-budget.ts
11373
11355
  var _MarkupExpansionBudget;
11374
11356
  /** Shared bounds for reparsing markup inside labels, selectors and attributes. */
11375
11357
  var MarkupExpansionBudget = class MarkupExpansionBudget {
@@ -11389,8 +11371,7 @@ var MarkupExpansionBudget = class MarkupExpansionBudget {
11389
11371
  };
11390
11372
  _MarkupExpansionBudget = MarkupExpansionBudget;
11391
11373
  _MarkupExpansionBudget.maxDepth = 64;
11392
- //#endregion
11393
- //#region src/code-check.ts
11374
+ // src/code-check.ts
11394
11375
  /** While a pass runs: the code it parsed so far, by goal and source. */
11395
11376
  var parses = null;
11396
11377
  /**
@@ -12002,8 +11983,7 @@ function referencesOf(pieces) {
12002
11983
  });
12003
11984
  return refs;
12004
11985
  }
12005
- //#endregion
12006
- //#region src/completion-context.ts
11986
+ // src/completion-context.ts
12007
11987
  /** Cursor context from the runtime grammar and argument metadata, without executing code. */
12008
11988
  var LITERAL = { kind: "literal" };
12009
11989
  /**
@@ -12126,8 +12106,7 @@ function completionContext(source, cursor, macros = []) {
12126
12106
  };
12127
12107
  return read(source.slice(0, cursor), (i) => i);
12128
12108
  }
12129
- //#endregion
12130
- //#region src/widgets/ast-scanner.ts
12109
+ // src/widgets/ast-scanner.ts
12131
12110
  /** The declared parameters of the macros registered so far. */
12132
12111
  var registeredParameters = (name) => parameterLookup(getMacroRegistry())(name);
12133
12112
  registeredParameters.source = getMacroParameters.source;
@@ -12200,8 +12179,7 @@ function astContainsChildren(nodes, parametersOf = registeredParameters, hooks,
12200
12179
  }
12201
12180
  return false;
12202
12181
  }
12203
- //#endregion
12204
- //#region src/widgets/widget-def.ts
12182
+ // src/widgets/widget-def.ts
12205
12183
  /**
12206
12184
  * Reading widget definitions without rendering anything: the `{widget}`
12207
12185
  * macro, startup and markup validation (also in tooling) share these.
@@ -12328,8 +12306,7 @@ function effectiveWidgetDefinitions(definitions) {
12328
12306
  for (const def of [...definitions.filter((def) => !inInit(def)), ...definitions.filter(inInit)]) if (def.closeStart !== void 0) effective.set(def.name, def);
12329
12307
  return [...effective.values()];
12330
12308
  }
12331
- //#endregion
12332
- //#region src/passage-roles.ts
12309
+ // src/passage-roles.ts
12333
12310
  /** Runtime-owned passage roles, shared with stateless authoring tools. */
12334
12311
  var SPECIAL_PASSAGES = /* @__PURE__ */ new Set([
12335
12312
  "StoryInit",
@@ -12348,8 +12325,7 @@ var SPECIAL_PASSAGES = /* @__PURE__ */ new Set([
12348
12325
  function isSpecialPassage(name) {
12349
12326
  return SPECIAL_PASSAGES.has(name);
12350
12327
  }
12351
- //#endregion
12352
- //#region src/markup/validate.ts
12328
+ // src/markup/validate.ts
12353
12329
  /**
12354
12330
  * Markup validation: parse every passage when the story starts and report
12355
12331
  * malformed markup, unknown macros, syntax errors in the code it runs and
@@ -12576,8 +12552,7 @@ function validateMarkup(passages, options) {
12576
12552
  for (const [passage, tokens] of parsed) withParseCache(() => checkPassage(passage, tokens));
12577
12553
  return diagnostics;
12578
12554
  }
12579
- //#endregion
12580
- //#region src/static-literal.ts
12555
+ // src/static-literal.ts
12581
12556
  /**
12582
12557
  * The shape of a JavaScript literal, read from its text without running it:
12583
12558
  * what a StoryVariables initializer is when it is a literal, or an array or
@@ -12996,8 +12971,7 @@ var Reader = class {
12996
12971
  return this.skipNested("`");
12997
12972
  }
12998
12973
  };
12999
- //#endregion
13000
- //#region src/story-variables.ts
12974
+ // src/story-variables.ts
13001
12975
  /**
13002
12976
  * The tokens of markup, or none if it is malformed (validateMarkup reports
13003
12977
  * that, with its position); in tolerant mode, those of the well-formed parts.
@@ -13016,8 +12990,7 @@ function tokensOf(text, textMode, { tolerant, parametersOf } = {}) {
13016
12990
  }
13017
12991
  }
13018
12992
  function declarationRegex(sigil) {
13019
- const escaped = sigil.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
13020
- return new RegExp(`^${escaped}(\\w+)\\s*=\\s*(.+)$`);
12993
+ return new RegExp(`^${escapeRegExp(sigil)}(\\w+)\\s*=\\s*(.+)$`);
13021
12994
  }
13022
12995
  var VALID_VAR_TYPES = /* @__PURE__ */ new Set([
13023
12996
  "number",
@@ -13499,8 +13472,18 @@ function checkVariableReferences(passages, declared, options) {
13499
13472
  }
13500
13473
  return diagnostics;
13501
13474
  }
13502
- //#endregion
13503
- //#region src/js-bindings.ts
13475
+ // src/js-bindings.ts
13476
+ /**
13477
+ * Which declaration a variable names where it is used in JavaScript, read
13478
+ * from the text without running it (see discoverMacros): the scope the use is
13479
+ * in, the declarations of the name that scope can see, and the innermost one.
13480
+ *
13481
+ * It reads the shape of the code (brackets, and the words before and after a
13482
+ * name) in text whose strings, comments and regexes are blanked, so it needs
13483
+ * no syntax tree and goes on through code that is not complete. What it
13484
+ * cannot place, it counts as a declaration of unknown value: a parameter, a
13485
+ * pattern, an assignment. Better no answer than another declaration's.
13486
+ */
13504
13487
  var CLOSERS = {
13505
13488
  "}": "{",
13506
13489
  ")": "(",
@@ -13587,7 +13570,7 @@ var Bindings = class {
13587
13570
  /** Declaration and write facts are immutable for this source and property set. */
13588
13571
  readBindings(name, properties) {
13589
13572
  const { code } = this;
13590
- const escaped = name.replace(/\$/g, "\\$");
13573
+ const escaped = escapeRegExp(name);
13591
13574
  const bindings = [];
13592
13575
  for (const m of code.matchAll(new RegExp(`(?<![\\w$])${escaped}(?![\\w$])`, "g"))) {
13593
13576
  const binding = this.bindingAt(m.index, name.length, properties);
@@ -13979,8 +13962,7 @@ var Bindings = class {
13979
13962
  return group?.kind === "(" && ",)".includes(this.code.charAt(end)) && MUTATING_CALL_RE.test(this.code.slice(0, group.open));
13980
13963
  }
13981
13964
  };
13982
- //#endregion
13983
- //#region src/macro-discovery.ts
13965
+ // src/macro-discovery.ts
13984
13966
  /**
13985
13967
  * What `defineMacro({ … })` calls in JavaScript declare, read from the text
13986
13968
  * without running it (see discoverMacros): the literal parts of the config
@@ -14287,8 +14269,7 @@ function discoverMacros(source) {
14287
14269
  }
14288
14270
  return found;
14289
14271
  }
14290
- //#endregion
14291
- //#region src/format/segment.ts
14272
+ // src/format/segment.ts
14292
14273
  var VOID_ELEMENTS = /* @__PURE__ */ new Set([
14293
14274
  "area",
14294
14275
  "base",
@@ -14386,8 +14367,7 @@ function pushSpindleLine(regions, line) {
14386
14367
  lines: [line]
14387
14368
  });
14388
14369
  }
14389
- //#endregion
14390
- //#region node_modules/character-entities/index.js
14370
+ // node_modules/character-entities/index.js
14391
14371
  /**
14392
14372
  * Map of named character references.
14393
14373
  *
@@ -16520,8 +16500,7 @@ var characterEntities = {
16520
16500
  zwj: "‍",
16521
16501
  zwnj: "‌"
16522
16502
  };
16523
- //#endregion
16524
- //#region node_modules/decode-named-character-reference/index.js
16503
+ // node_modules/decode-named-character-reference/index.js
16525
16504
  var own = {}.hasOwnProperty;
16526
16505
  /**
16527
16506
  * Decode a single character reference (without the `&` or `;`).
@@ -16537,8 +16516,7 @@ var own = {}.hasOwnProperty;
16537
16516
  function decodeNamedCharacterReference(value) {
16538
16517
  return own.call(characterEntities, value) ? characterEntities[value] : false;
16539
16518
  }
16540
- //#endregion
16541
- //#region node_modules/micromark-util-chunked/index.js
16519
+ // node_modules/micromark-util-chunked/index.js
16542
16520
  /**
16543
16521
  * Like `Array#splice`, but smarter for giant arrays.
16544
16522
  *
@@ -16607,8 +16585,7 @@ function push(list, items) {
16607
16585
  }
16608
16586
  return items;
16609
16587
  }
16610
- //#endregion
16611
- //#region node_modules/micromark-util-combine-extensions/index.js
16588
+ // node_modules/micromark-util-combine-extensions/index.js
16612
16589
  /**
16613
16590
  * @import {
16614
16591
  * Extension,
@@ -16678,8 +16655,7 @@ function constructs(existing, list) {
16678
16655
  while (++index < list.length) (list[index].add === "after" ? existing : before).push(list[index]);
16679
16656
  splice(existing, 0, 0, before);
16680
16657
  }
16681
- //#endregion
16682
- //#region node_modules/micromark-util-normalize-identifier/index.js
16658
+ // node_modules/micromark-util-normalize-identifier/index.js
16683
16659
  /**
16684
16660
  * Normalize an identifier (as found in references, definitions).
16685
16661
  *
@@ -16702,8 +16678,7 @@ function constructs(existing, list) {
16702
16678
  function normalizeIdentifier(value) {
16703
16679
  return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
16704
16680
  }
16705
- //#endregion
16706
- //#region node_modules/micromark-util-character/index.js
16681
+ // node_modules/micromark-util-character/index.js
16707
16682
  /**
16708
16683
  * @import {Code} from 'micromark-util-types'
16709
16684
  */
@@ -16930,8 +16905,7 @@ function regexCheck(regex) {
16930
16905
  return code !== null && code > -1 && regex.test(String.fromCharCode(code));
16931
16906
  }
16932
16907
  }
16933
- //#endregion
16934
- //#region node_modules/micromark-factory-space/index.js
16908
+ // node_modules/micromark-factory-space/index.js
16935
16909
  /**
16936
16910
  * @import {Effects, State, TokenType} from 'micromark-util-types'
16937
16911
  */
@@ -16961,14 +16935,14 @@ function regexCheck(regex) {
16961
16935
  * @param {State} ok
16962
16936
  * State switched to when successful.
16963
16937
  * @param {TokenType} type
16964
- * Type (`' \t'`).
16938
+ * Type of the whole whitespace.
16965
16939
  * @param {number | undefined} [max=Infinity]
16966
16940
  * Max (exclusive).
16967
16941
  * @returns {State}
16968
16942
  * Start state.
16969
16943
  */
16970
16944
  function factorySpace(effects, ok, type, max) {
16971
- const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
16945
+ const limit = max ? max - 1 : Infinity;
16972
16946
  let size = 0;
16973
16947
  return start;
16974
16948
  /** @type {State} */
@@ -16989,8 +16963,55 @@ function factorySpace(effects, ok, type, max) {
16989
16963
  return ok(code);
16990
16964
  }
16991
16965
  }
16992
- //#endregion
16993
- //#region node_modules/micromark/lib/initialize/content.js
16966
+ /**
16967
+ * Parse spaces and tabs, with a required minimum and maximum, matching
16968
+ * `markdown-rs`’s `space_or_tab_min_max`.
16969
+ *
16970
+ * Unlike `factorySpace`, this can fail: `nok` is used when fewer than
16971
+ * `min` spaces or tabs are found.
16972
+ *
16973
+ * @param {Effects} effects
16974
+ * Context.
16975
+ * @param {State} ok
16976
+ * State switched to when successful.
16977
+ * @param {State} nok
16978
+ * State switched to when unsuccessful.
16979
+ * @param {TokenType} type
16980
+ * Type of the whole whitespace.
16981
+ * @param {number} min
16982
+ * Minimum allowed characters (inclusive).
16983
+ * @param {number} max
16984
+ * Maximum allowed characters (inclusive).
16985
+ * @returns {State}
16986
+ * Start state.
16987
+ */
16988
+ function factorySpaceMinMax(effects, ok, nok, type, min, max) {
16989
+ let size = 0;
16990
+ return start;
16991
+ /** @type {State} */
16992
+ function start(code) {
16993
+ if (max > 0 && markdownSpace(code)) {
16994
+ effects.enter(type);
16995
+ return prefix(code);
16996
+ }
16997
+ return after(code);
16998
+ }
16999
+ /** @type {State} */
17000
+ function prefix(code) {
17001
+ if (markdownSpace(code) && size < max) {
17002
+ effects.consume(code);
17003
+ size++;
17004
+ return prefix;
17005
+ }
17006
+ effects.exit(type);
17007
+ return after(code);
17008
+ }
17009
+ /** @type {State} */
17010
+ function after(code) {
17011
+ return size >= min ? ok(code) : nok(code);
17012
+ }
17013
+ }
17014
+ // node_modules/micromark/lib/initialize/content.js
16994
17015
  /**
16995
17016
  * @import {
16996
17017
  * InitialConstruct,
@@ -17056,8 +17077,7 @@ function initializeContent(effects) {
17056
17077
  return data;
17057
17078
  }
17058
17079
  }
17059
- //#endregion
17060
- //#region node_modules/micromark-util-edit-map/index.js
17080
+ // node_modules/micromark-util-edit-map/index.js
17061
17081
  /**
17062
17082
  * @import {Event} from 'micromark-util-types'
17063
17083
  */
@@ -17202,8 +17222,7 @@ function addImplementation$1(editMap, at, remove, add, before) {
17202
17222
  editMap.map.push(change);
17203
17223
  editMap.index.set(at, change);
17204
17224
  }
17205
- //#endregion
17206
- //#region node_modules/micromark/lib/initialize/document.js
17225
+ // node_modules/micromark/lib/initialize/document.js
17207
17226
  /**
17208
17227
  * @import {
17209
17228
  * Construct,
@@ -17422,8 +17441,7 @@ function initializeDocument(effects) {
17422
17441
  function tokenizeContainer(effects, ok, nok) {
17423
17442
  return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
17424
17443
  }
17425
- //#endregion
17426
- //#region node_modules/micromark-util-classify-character/index.js
17444
+ // node_modules/micromark-util-classify-character/index.js
17427
17445
  /**
17428
17446
  * @import {Code} from 'micromark-util-types'
17429
17447
  */
@@ -17445,8 +17463,7 @@ function classifyCharacter(code) {
17445
17463
  if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) return 1;
17446
17464
  if (unicodePunctuation(code)) return 2;
17447
17465
  }
17448
- //#endregion
17449
- //#region node_modules/micromark-util-resolve-all/index.js
17466
+ // node_modules/micromark-util-resolve-all/index.js
17450
17467
  /**
17451
17468
  * @import {Event, Resolver, TokenizeContext} from 'micromark-util-types'
17452
17469
  */
@@ -17475,8 +17492,7 @@ function resolveAll(constructs, events, context) {
17475
17492
  }
17476
17493
  return events;
17477
17494
  }
17478
- //#endregion
17479
- //#region node_modules/micromark-core-commonmark/lib/attention.js
17495
+ // node_modules/micromark-core-commonmark/lib/attention.js
17480
17496
  /**
17481
17497
  * @import {
17482
17498
  * Code,
@@ -17503,47 +17519,33 @@ var attention = {
17503
17519
  */
17504
17520
  function resolveAllAttention(events, context) {
17505
17521
  let index = -1;
17506
- /** @type {number} */
17507
- let open;
17508
- /** @type {Token} */
17509
- let group;
17510
- /** @type {Token} */
17511
- let text;
17512
- /** @type {Token} */
17513
- let openingSequence;
17514
- /** @type {Token} */
17515
- let closingSequence;
17516
- /** @type {number} */
17517
- let use;
17518
17522
  /** @type {Array<Event>} */
17519
17523
  let nextEvents;
17520
- /** @type {number} */
17521
- let offset;
17522
17524
  while (++index < events.length) if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) {
17523
- open = index;
17525
+ let open = index;
17524
17526
  while (open--) if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {
17525
17527
  if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) continue;
17526
- use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
17528
+ const use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
17527
17529
  const start = { ...events[open][1].end };
17528
17530
  const end = { ...events[index][1].start };
17529
17531
  movePoint(start, -use);
17530
17532
  movePoint(end, use);
17531
- openingSequence = {
17533
+ const openingSequence = {
17532
17534
  type: use > 1 ? "strongSequence" : "emphasisSequence",
17533
17535
  start,
17534
17536
  end: { ...events[open][1].end }
17535
17537
  };
17536
- closingSequence = {
17538
+ const closingSequence = {
17537
17539
  type: use > 1 ? "strongSequence" : "emphasisSequence",
17538
17540
  start: { ...events[index][1].start },
17539
17541
  end
17540
17542
  };
17541
- text = {
17543
+ const text = {
17542
17544
  type: use > 1 ? "strongText" : "emphasisText",
17543
17545
  start: { ...events[open][1].end },
17544
17546
  end: { ...events[index][1].start }
17545
17547
  };
17546
- group = {
17548
+ const group = {
17547
17549
  type: use > 1 ? "strong" : "emphasis",
17548
17550
  start: { ...openingSequence.start },
17549
17551
  end: { ...closingSequence.end }
@@ -17605,6 +17607,8 @@ function resolveAllAttention(events, context) {
17605
17607
  context
17606
17608
  ]
17607
17609
  ]);
17610
+ /** @type {number} */
17611
+ let offset = 0;
17608
17612
  if (events[index][1].end.offset - events[index][1].start.offset) {
17609
17613
  offset = 2;
17610
17614
  nextEvents = push(nextEvents, [[
@@ -17616,7 +17620,7 @@ function resolveAllAttention(events, context) {
17616
17620
  events[index][1],
17617
17621
  context
17618
17622
  ]]);
17619
- } else offset = 0;
17623
+ }
17620
17624
  splice(events, open - 1, index - open + 3, nextEvents);
17621
17625
  index = open + nextEvents.length - offset - 2;
17622
17626
  break;
@@ -17670,8 +17674,8 @@ function tokenizeAttention(effects, ok) {
17670
17674
  }
17671
17675
  const token = effects.exit("attentionSequence");
17672
17676
  const after = classifyCharacter(code);
17673
- const open = !after || after === 2 && before || attentionMarkers.includes(code);
17674
- const close = !before || before === 2 && after || attentionMarkers.includes(previous);
17677
+ const open = !after || after === 2 && before || attentionMarkers.includes(code) && code !== 42 && code !== 95;
17678
+ const close = !before || before === 2 && after || attentionMarkers.includes(previous) && previous !== 42 && previous !== 95;
17675
17679
  token._open = Boolean(marker === 42 ? open : open && (before || !close));
17676
17680
  token._close = Boolean(marker === 42 ? close : close && (after || !open));
17677
17681
  return ok(code);
@@ -17695,8 +17699,7 @@ function movePoint(point, offset) {
17695
17699
  point.offset += offset;
17696
17700
  point._bufferIndex += offset;
17697
17701
  }
17698
- //#endregion
17699
- //#region node_modules/micromark-core-commonmark/lib/autolink.js
17702
+ // node_modules/micromark-core-commonmark/lib/autolink.js
17700
17703
  /**
17701
17704
  * @import {
17702
17705
  * Construct,
@@ -17906,8 +17909,7 @@ function tokenizeAutolink(effects, ok, nok) {
17906
17909
  return nok(code);
17907
17910
  }
17908
17911
  }
17909
- //#endregion
17910
- //#region node_modules/micromark-core-commonmark/lib/blank-line.js
17912
+ // node_modules/micromark-core-commonmark/lib/blank-line.js
17911
17913
  /**
17912
17914
  * @import {
17913
17915
  * Construct,
@@ -17963,8 +17965,7 @@ function tokenizeBlankLine(effects, ok, nok) {
17963
17965
  return code === null || markdownLineEnding(code) ? ok(code) : nok(code);
17964
17966
  }
17965
17967
  }
17966
- //#endregion
17967
- //#region node_modules/micromark-core-commonmark/lib/block-quote.js
17968
+ // node_modules/micromark-core-commonmark/lib/block-quote.js
17968
17969
  /**
17969
17970
  * @import {
17970
17971
  * Construct,
@@ -18090,8 +18091,7 @@ function tokenizeBlockQuoteContinuation(effects, ok, nok) {
18090
18091
  function exit(effects) {
18091
18092
  effects.exit("blockQuote");
18092
18093
  }
18093
- //#endregion
18094
- //#region node_modules/micromark-core-commonmark/lib/character-escape.js
18094
+ // node_modules/micromark-core-commonmark/lib/character-escape.js
18095
18095
  /**
18096
18096
  * @import {
18097
18097
  * Construct,
@@ -18150,8 +18150,7 @@ function tokenizeCharacterEscape(effects, ok, nok) {
18150
18150
  return nok(code);
18151
18151
  }
18152
18152
  }
18153
- //#endregion
18154
- //#region node_modules/micromark-core-commonmark/lib/character-reference.js
18153
+ // node_modules/micromark-core-commonmark/lib/character-reference.js
18155
18154
  /**
18156
18155
  * @import {
18157
18156
  * Code,
@@ -18288,8 +18287,54 @@ function tokenizeCharacterReference(effects, ok, nok) {
18288
18287
  return nok(code);
18289
18288
  }
18290
18289
  }
18291
- //#endregion
18292
- //#region node_modules/micromark-core-commonmark/lib/code-fenced.js
18290
+ // node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js
18291
+ /** @type {Construct} */
18292
+ var nonLazyContinuation = {
18293
+ partial: true,
18294
+ tokenize: tokenizeNonLazyContinuation
18295
+ };
18296
+ /**
18297
+ * @this {TokenizeContext}
18298
+ * Context.
18299
+ * @type {Tokenizer}
18300
+ */
18301
+ function tokenizeNonLazyContinuation(effects, ok, nok) {
18302
+ const self = this;
18303
+ return start;
18304
+ /**
18305
+ * At eol, before continuation.
18306
+ *
18307
+ * ```markdown
18308
+ * > | * ```js
18309
+ * ^
18310
+ * | b
18311
+ * ```
18312
+ *
18313
+ * @type {State}
18314
+ */
18315
+ function start(code) {
18316
+ if (code === null) return nok(code);
18317
+ effects.enter("lineEnding");
18318
+ effects.consume(code);
18319
+ effects.exit("lineEnding");
18320
+ return after;
18321
+ }
18322
+ /**
18323
+ * A continuation.
18324
+ *
18325
+ * ```markdown
18326
+ * | * ```js
18327
+ * > | b
18328
+ * ^
18329
+ * ```
18330
+ *
18331
+ * @type {State}
18332
+ */
18333
+ function after(code) {
18334
+ return self.parser.lazy[self.now().line] ? nok(code) : ok(code);
18335
+ }
18336
+ }
18337
+ // node_modules/micromark-core-commonmark/lib/code-fenced.js
18293
18338
  /**
18294
18339
  * @import {
18295
18340
  * Code,
@@ -18300,11 +18345,6 @@ function tokenizeCharacterReference(effects, ok, nok) {
18300
18345
  * } from 'micromark-util-types'
18301
18346
  */
18302
18347
  /** @type {Construct} */
18303
- var nonLazyContinuation = {
18304
- partial: true,
18305
- tokenize: tokenizeNonLazyContinuation
18306
- };
18307
- /** @type {Construct} */
18308
18348
  var codeFenced = {
18309
18349
  concrete: true,
18310
18350
  name: "codeFenced",
@@ -18674,37 +18714,7 @@ function tokenizeCodeFenced(effects, ok, nok) {
18674
18714
  }
18675
18715
  }
18676
18716
  }
18677
- /**
18678
- * @this {TokenizeContext}
18679
- * Context.
18680
- * @type {Tokenizer}
18681
- */
18682
- function tokenizeNonLazyContinuation(effects, ok, nok) {
18683
- const self = this;
18684
- return start;
18685
- /**
18686
- *
18687
- *
18688
- * @type {State}
18689
- */
18690
- function start(code) {
18691
- if (code === null) return nok(code);
18692
- effects.enter("lineEnding");
18693
- effects.consume(code);
18694
- effects.exit("lineEnding");
18695
- return lineStart;
18696
- }
18697
- /**
18698
- *
18699
- *
18700
- * @type {State}
18701
- */
18702
- function lineStart(code) {
18703
- return self.parser.lazy[self.now().line] ? nok(code) : ok(code);
18704
- }
18705
- }
18706
- //#endregion
18707
- //#region node_modules/micromark-core-commonmark/lib/code-indented.js
18717
+ // node_modules/micromark-core-commonmark/lib/code-indented.js
18708
18718
  /**
18709
18719
  * @import {
18710
18720
  * Construct,
@@ -18729,7 +18739,6 @@ var furtherStart = {
18729
18739
  * @type {Tokenizer}
18730
18740
  */
18731
18741
  function tokenizeCodeIndented(effects, ok, nok) {
18732
- const self = this;
18733
18742
  return start;
18734
18743
  /**
18735
18744
  * Start of code (indented).
@@ -18747,21 +18756,7 @@ function tokenizeCodeIndented(effects, ok, nok) {
18747
18756
  */
18748
18757
  function start(code) {
18749
18758
  effects.enter("codeIndented");
18750
- return factorySpace(effects, afterPrefix, "linePrefix", 5)(code);
18751
- }
18752
- /**
18753
- * At start, after 1 or 4 spaces.
18754
- *
18755
- * ```markdown
18756
- * > | aaa
18757
- * ^
18758
- * ```
18759
- *
18760
- * @type {State}
18761
- */
18762
- function afterPrefix(code) {
18763
- const tail = self.events[self.events.length - 1];
18764
- return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code) : nok(code);
18759
+ return factorySpaceMinMax(effects, atBreak, nok, "linePrefix", 4, 4)(code);
18765
18760
  }
18766
18761
  /**
18767
18762
  * At a break.
@@ -18830,25 +18825,27 @@ function tokenizeFurtherStart(effects, ok, nok) {
18830
18825
  effects.exit("lineEnding");
18831
18826
  return furtherStart;
18832
18827
  }
18833
- return factorySpace(effects, afterPrefix, "linePrefix", 5)(code);
18828
+ return factorySpaceMinMax(effects, ok, onNotEnoughPrefix, "linePrefix", 4, 4)(code);
18834
18829
  }
18835
18830
  /**
18836
- * At start, after 1 or 4 spaces.
18831
+ * After not enough of a prefix.
18832
+ *
18833
+ * A following line ending is another (potentially blank) line to try,
18834
+ * anything else means this isn’t a continuation.
18837
18835
  *
18838
18836
  * ```markdown
18839
18837
  * > | aaa
18840
- * ^
18838
+ *
18839
+ * | bbb
18841
18840
  * ```
18842
18841
  *
18843
18842
  * @type {State}
18844
18843
  */
18845
- function afterPrefix(code) {
18846
- const tail = self.events[self.events.length - 1];
18847
- return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code);
18844
+ function onNotEnoughPrefix(code) {
18845
+ return markdownLineEnding(code) ? furtherStart(code) : nok(code);
18848
18846
  }
18849
18847
  }
18850
- //#endregion
18851
- //#region node_modules/micromark-core-commonmark/lib/code-text.js
18848
+ // node_modules/micromark-core-commonmark/lib/code-text.js
18852
18849
  /**
18853
18850
  * @import {
18854
18851
  * Construct,
@@ -19032,8 +19029,7 @@ function tokenizeCodeText(effects, ok, nok) {
19032
19029
  return data(code);
19033
19030
  }
19034
19031
  }
19035
- //#endregion
19036
- //#region node_modules/micromark-util-subtokenize/lib/splice-buffer.js
19032
+ // node_modules/micromark-util-subtokenize/lib/splice-buffer.js
19037
19033
  /**
19038
19034
  * Some of the internal operations of micromark do lots of editing
19039
19035
  * operations on very large arrays. This runs into problems with two
@@ -19262,8 +19258,7 @@ function chunkedPush(list, right) {
19262
19258
  chunkStart += 1e4;
19263
19259
  }
19264
19260
  }
19265
- //#endregion
19266
- //#region node_modules/micromark-util-subtokenize/index.js
19261
+ // node_modules/micromark-util-subtokenize/index.js
19267
19262
  /**
19268
19263
  * @import {Chunk, Event, Token} from 'micromark-util-types'
19269
19264
  */
@@ -19417,8 +19412,7 @@ function subcontent(events, eventIndex) {
19417
19412
  }
19418
19413
  return gaps;
19419
19414
  }
19420
- //#endregion
19421
- //#region node_modules/micromark-core-commonmark/lib/content.js
19415
+ // node_modules/micromark-core-commonmark/lib/content.js
19422
19416
  /**
19423
19417
  * @import {
19424
19418
  * Construct,
@@ -19550,8 +19544,7 @@ function tokenizeContinuation(effects, ok, nok) {
19550
19544
  return effects.interrupt(self.parser.constructs.flow, nok, ok)(code);
19551
19545
  }
19552
19546
  }
19553
- //#endregion
19554
- //#region node_modules/micromark-factory-destination/index.js
19547
+ // node_modules/micromark-factory-destination/index.js
19555
19548
  /**
19556
19549
  * @import {Effects, State, TokenType} from 'micromark-util-types'
19557
19550
  */
@@ -19734,8 +19727,7 @@ function factoryDestination(effects, ok, nok, type, literalType, literalMarkerTy
19734
19727
  return raw(code);
19735
19728
  }
19736
19729
  }
19737
- //#endregion
19738
- //#region node_modules/micromark-factory-label/index.js
19730
+ // node_modules/micromark-factory-label/index.js
19739
19731
  /**
19740
19732
  * @import {
19741
19733
  * Effects,
@@ -19868,8 +19860,7 @@ function factoryLabel(effects, ok, nok, type, markerType, stringType) {
19868
19860
  return labelInside(code);
19869
19861
  }
19870
19862
  }
19871
- //#endregion
19872
- //#region node_modules/micromark-factory-title/index.js
19863
+ // node_modules/micromark-factory-title/index.js
19873
19864
  /**
19874
19865
  * @import {
19875
19866
  * Code,
@@ -20013,8 +20004,7 @@ function factoryTitle(effects, ok, nok, type, markerType, stringType) {
20013
20004
  return inside(code);
20014
20005
  }
20015
20006
  }
20016
- //#endregion
20017
- //#region node_modules/micromark-factory-whitespace/index.js
20007
+ // node_modules/micromark-factory-whitespace/index.js
20018
20008
  /**
20019
20009
  * @import {Effects, State} from 'micromark-util-types'
20020
20010
  */
@@ -20053,8 +20043,7 @@ function factoryWhitespace(effects, ok) {
20053
20043
  return ok(code);
20054
20044
  }
20055
20045
  }
20056
- //#endregion
20057
- //#region node_modules/micromark-core-commonmark/lib/definition.js
20046
+ // node_modules/micromark-core-commonmark/lib/definition.js
20058
20047
  /**
20059
20048
  * @import {
20060
20049
  * Construct,
@@ -20268,8 +20257,7 @@ function tokenizeTitleBefore(effects, ok, nok) {
20268
20257
  return code === null || markdownLineEnding(code) ? ok(code) : nok(code);
20269
20258
  }
20270
20259
  }
20271
- //#endregion
20272
- //#region node_modules/micromark-core-commonmark/lib/hard-break-escape.js
20260
+ // node_modules/micromark-core-commonmark/lib/hard-break-escape.js
20273
20261
  /**
20274
20262
  * @import {
20275
20263
  * Construct,
@@ -20325,8 +20313,7 @@ function tokenizeHardBreakEscape(effects, ok, nok) {
20325
20313
  return nok(code);
20326
20314
  }
20327
20315
  }
20328
- //#endregion
20329
- //#region node_modules/micromark-core-commonmark/lib/heading-atx.js
20316
+ // node_modules/micromark-core-commonmark/lib/heading-atx.js
20330
20317
  /**
20331
20318
  * @import {
20332
20319
  * Construct,
@@ -20347,20 +20334,16 @@ var headingAtx = {
20347
20334
  function resolveHeadingAtx(events, context) {
20348
20335
  let contentEnd = events.length - 2;
20349
20336
  let contentStart = 3;
20350
- /** @type {Token} */
20351
- let content;
20352
- /** @type {Token} */
20353
- let text;
20354
20337
  if (events[contentStart][1].type === "whitespace") contentStart += 2;
20355
20338
  if (contentEnd - 2 > contentStart && events[contentEnd][1].type === "whitespace") contentEnd -= 2;
20356
20339
  if (events[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === "whitespace")) contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
20357
20340
  if (contentEnd > contentStart) {
20358
- content = {
20341
+ const content = {
20359
20342
  type: "atxHeadingText",
20360
20343
  start: events[contentStart][1].start,
20361
20344
  end: events[contentEnd][1].end
20362
20345
  };
20363
- text = {
20346
+ const text = {
20364
20347
  type: "chunkText",
20365
20348
  start: events[contentStart][1].start,
20366
20349
  end: events[contentEnd][1].end,
@@ -20510,8 +20493,7 @@ function tokenizeHeadingAtx(effects, ok, nok) {
20510
20493
  return data;
20511
20494
  }
20512
20495
  }
20513
- //#endregion
20514
- //#region node_modules/micromark-util-html-tag-name/index.js
20496
+ // node_modules/micromark-util-html-tag-name/index.js
20515
20497
  /**
20516
20498
  * List of lowercase HTML “block” tag names.
20517
20499
  *
@@ -20609,8 +20591,7 @@ var htmlRawNames = [
20609
20591
  "style",
20610
20592
  "textarea"
20611
20593
  ];
20612
- //#endregion
20613
- //#region node_modules/micromark-core-commonmark/lib/html-flow.js
20594
+ // node_modules/micromark-core-commonmark/lib/html-flow.js
20614
20595
  /**
20615
20596
  * @import {
20616
20597
  * Code,
@@ -20633,10 +20614,6 @@ var blankLineBefore = {
20633
20614
  partial: true,
20634
20615
  tokenize: tokenizeBlankLineBefore
20635
20616
  };
20636
- var nonLazyContinuationStart = {
20637
- partial: true,
20638
- tokenize: tokenizeNonLazyContinuationStart
20639
- };
20640
20617
  /** @type {Resolver} */
20641
20618
  function resolveToHtmlFlow(events) {
20642
20619
  let index = events.length;
@@ -21139,7 +21116,7 @@ function tokenizeHtmlFlow(effects, ok, nok) {
21139
21116
  * @type {State}
21140
21117
  */
21141
21118
  function continuationStart(code) {
21142
- return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
21119
+ return effects.check(nonLazyContinuation, continuationStartNonLazy, continuationAfter)(code);
21143
21120
  }
21144
21121
  /**
21145
21122
  * In continuation, at eol, before non-lazy content.
@@ -21319,49 +21296,6 @@ function tokenizeHtmlFlow(effects, ok, nok) {
21319
21296
  * Context.
21320
21297
  * @type {Tokenizer}
21321
21298
  */
21322
- function tokenizeNonLazyContinuationStart(effects, ok, nok) {
21323
- const self = this;
21324
- return start;
21325
- /**
21326
- * At eol, before continuation.
21327
- *
21328
- * ```markdown
21329
- * > | * ```js
21330
- * ^
21331
- * | b
21332
- * ```
21333
- *
21334
- * @type {State}
21335
- */
21336
- function start(code) {
21337
- if (markdownLineEnding(code)) {
21338
- effects.enter("lineEnding");
21339
- effects.consume(code);
21340
- effects.exit("lineEnding");
21341
- return after;
21342
- }
21343
- return nok(code);
21344
- }
21345
- /**
21346
- * A continuation.
21347
- *
21348
- * ```markdown
21349
- * | * ```js
21350
- * > | b
21351
- * ^
21352
- * ```
21353
- *
21354
- * @type {State}
21355
- */
21356
- function after(code) {
21357
- return self.parser.lazy[self.now().line] ? nok(code) : ok(code);
21358
- }
21359
- }
21360
- /**
21361
- * @this {TokenizeContext}
21362
- * Context.
21363
- * @type {Tokenizer}
21364
- */
21365
21299
  function tokenizeBlankLineBefore(effects, ok, nok) {
21366
21300
  return start;
21367
21301
  /**
@@ -21382,8 +21316,7 @@ function tokenizeBlankLineBefore(effects, ok, nok) {
21382
21316
  return effects.attempt(blankLine, ok, nok);
21383
21317
  }
21384
21318
  }
21385
- //#endregion
21386
- //#region node_modules/micromark-core-commonmark/lib/html-text.js
21319
+ // node_modules/micromark-core-commonmark/lib/html-text.js
21387
21320
  /**
21388
21321
  * @import {
21389
21322
  * Code,
@@ -21996,8 +21929,7 @@ function tokenizeHtmlText(effects, ok, nok) {
21996
21929
  return returnState(code);
21997
21930
  }
21998
21931
  }
21999
- //#endregion
22000
- //#region node_modules/micromark-core-commonmark/lib/label-end.js
21932
+ // node_modules/micromark-core-commonmark/lib/label-end.js
22001
21933
  /**
22002
21934
  * @import {
22003
21935
  * Construct,
@@ -22043,8 +21975,6 @@ function resolveAllLabelEnd(events) {
22043
21975
  function resolveToLabelEnd(events, context) {
22044
21976
  let index = events.length;
22045
21977
  let offset = 0;
22046
- /** @type {Token} */
22047
- let token;
22048
21978
  /** @type {number | undefined} */
22049
21979
  let open;
22050
21980
  /** @type {number | undefined} */
@@ -22052,7 +21982,7 @@ function resolveToLabelEnd(events, context) {
22052
21982
  /** @type {Array<Event>} */
22053
21983
  let media;
22054
21984
  while (index--) {
22055
- token = events[index][1];
21985
+ const token = events[index][1];
22056
21986
  if (open) {
22057
21987
  if (token.type === "link" || token.type === "labelLink" && token._inactive) break;
22058
21988
  if (events[index][0] === "enter" && token.type === "labelLink") token._inactive = true;
@@ -22127,14 +22057,14 @@ function resolveToLabelEnd(events, context) {
22127
22057
  */
22128
22058
  function tokenizeLabelEnd(effects, ok, nok) {
22129
22059
  const self = this;
22130
- let index = self.events.length;
22060
+ const labelStarts = self._labelStarts;
22131
22061
  /** @type {Token} */
22132
22062
  let labelStart;
22133
22063
  /** @type {boolean} */
22134
22064
  let defined;
22135
- while (index--) if ((self.events[index][1].type === "labelImage" || self.events[index][1].type === "labelLink") && !self.events[index][1]._balanced) {
22136
- labelStart = self.events[index][1];
22137
- break;
22065
+ if (labelStarts) {
22066
+ while (labelStarts.length > 0 && labelStarts[labelStarts.length - 1]._balanced) labelStarts.pop();
22067
+ labelStart = labelStarts[labelStarts.length - 1];
22138
22068
  }
22139
22069
  return start;
22140
22070
  /**
@@ -22221,6 +22151,7 @@ function tokenizeLabelEnd(effects, ok, nok) {
22221
22151
  * @type {State}
22222
22152
  */
22223
22153
  function labelEndOk(code) {
22154
+ labelStarts.pop();
22224
22155
  return ok(code);
22225
22156
  }
22226
22157
  /**
@@ -22466,12 +22397,12 @@ function tokenizeReferenceCollapsed(effects, ok, nok) {
22466
22397
  return nok(code);
22467
22398
  }
22468
22399
  }
22469
- //#endregion
22470
- //#region node_modules/micromark-core-commonmark/lib/label-start-image.js
22400
+ // node_modules/micromark-core-commonmark/lib/label-start-image.js
22471
22401
  /**
22472
22402
  * @import {
22473
22403
  * Construct,
22474
22404
  * State,
22405
+ * Token,
22475
22406
  * TokenizeContext,
22476
22407
  * Tokenizer
22477
22408
  * } from 'micromark-util-types'
@@ -22489,6 +22420,8 @@ var labelStartImage = {
22489
22420
  */
22490
22421
  function tokenizeLabelStartImage(effects, ok, nok) {
22491
22422
  const self = this;
22423
+ /** @type {Token} */
22424
+ let labelImage;
22492
22425
  return start;
22493
22426
  /**
22494
22427
  * Start of label (image) start.
@@ -22522,7 +22455,7 @@ function tokenizeLabelStartImage(effects, ok, nok) {
22522
22455
  effects.enter("labelMarker");
22523
22456
  effects.consume(code);
22524
22457
  effects.exit("labelMarker");
22525
- effects.exit("labelImage");
22458
+ labelImage = effects.exit("labelImage");
22526
22459
  return after;
22527
22460
  }
22528
22461
  return nok(code);
@@ -22555,16 +22488,19 @@ function tokenizeLabelStartImage(effects, ok, nok) {
22555
22488
  * @type {State}
22556
22489
  */
22557
22490
  function after(code) {
22558
- /* c8 ignore next 3 */
22559
- return code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code) : ok(code);
22491
+ /* c8 ignore next 6 */
22492
+ if (code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs) return nok(code);
22493
+ self._labelStarts = self._labelStarts || [];
22494
+ self._labelStarts.push(labelImage);
22495
+ return ok(code);
22560
22496
  }
22561
22497
  }
22562
- //#endregion
22563
- //#region node_modules/micromark-core-commonmark/lib/label-start-link.js
22498
+ // node_modules/micromark-core-commonmark/lib/label-start-link.js
22564
22499
  /**
22565
22500
  * @import {
22566
22501
  * Construct,
22567
22502
  * State,
22503
+ * Token,
22568
22504
  * TokenizeContext,
22569
22505
  * Tokenizer
22570
22506
  * } from 'micromark-util-types'
@@ -22582,6 +22518,8 @@ var labelStartLink = {
22582
22518
  */
22583
22519
  function tokenizeLabelStartLink(effects, ok, nok) {
22584
22520
  const self = this;
22521
+ /** @type {Token} */
22522
+ let labelLink;
22585
22523
  return start;
22586
22524
  /**
22587
22525
  * Start of label (link) start.
@@ -22598,17 +22536,19 @@ function tokenizeLabelStartLink(effects, ok, nok) {
22598
22536
  effects.enter("labelMarker");
22599
22537
  effects.consume(code);
22600
22538
  effects.exit("labelMarker");
22601
- effects.exit("labelLink");
22539
+ labelLink = effects.exit("labelLink");
22602
22540
  return after;
22603
22541
  }
22604
22542
  /** @type {State} */
22605
22543
  function after(code) {
22606
- /* c8 ignore next 3 */
22607
- return code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code) : ok(code);
22544
+ /* c8 ignore next 6 */
22545
+ if (code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs) return nok(code);
22546
+ self._labelStarts = self._labelStarts || [];
22547
+ self._labelStarts.push(labelLink);
22548
+ return ok(code);
22608
22549
  }
22609
22550
  }
22610
- //#endregion
22611
- //#region node_modules/micromark-core-commonmark/lib/line-ending.js
22551
+ // node_modules/micromark-core-commonmark/lib/line-ending.js
22612
22552
  /**
22613
22553
  * @import {
22614
22554
  * Construct,
@@ -22637,8 +22577,7 @@ function tokenizeLineEnding(effects, ok) {
22637
22577
  return factorySpace(effects, ok, "linePrefix");
22638
22578
  }
22639
22579
  }
22640
- //#endregion
22641
- //#region node_modules/micromark-core-commonmark/lib/thematic-break.js
22580
+ // node_modules/micromark-core-commonmark/lib/thematic-break.js
22642
22581
  /**
22643
22582
  * @import {
22644
22583
  * Code,
@@ -22732,8 +22671,7 @@ function tokenizeThematicBreak(effects, ok, nok) {
22732
22671
  return markdownSpace(code) ? factorySpace(effects, atBreak, "whitespace")(code) : atBreak(code);
22733
22672
  }
22734
22673
  }
22735
- //#endregion
22736
- //#region node_modules/micromark-core-commonmark/lib/list.js
22674
+ // node_modules/micromark-core-commonmark/lib/list.js
22737
22675
  /**
22738
22676
  * @import {
22739
22677
  * Code,
@@ -22904,8 +22842,7 @@ function tokenizeListItemPrefixWhitespace(effects, ok, nok) {
22904
22842
  return !markdownSpace(code) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok(code) : nok(code);
22905
22843
  }
22906
22844
  }
22907
- //#endregion
22908
- //#region node_modules/micromark-core-commonmark/lib/setext-underline.js
22845
+ // node_modules/micromark-core-commonmark/lib/setext-underline.js
22909
22846
  /**
22910
22847
  * @import {
22911
22848
  * Code,
@@ -22924,6 +22861,7 @@ var setextUnderline = {
22924
22861
  };
22925
22862
  /** @type {Resolver} */
22926
22863
  function resolveToSetextUnderline(events, context) {
22864
+ const editMap = new EditMap$1();
22927
22865
  let index = events.length;
22928
22866
  /** @type {number | undefined} */
22929
22867
  let content;
@@ -22938,7 +22876,7 @@ function resolveToSetextUnderline(events, context) {
22938
22876
  }
22939
22877
  if (events[index][1].type === "paragraph") text = index;
22940
22878
  } else {
22941
- if (events[index][1].type === "content") events.splice(index, 1);
22879
+ if (events[index][1].type === "content") editMap.add(index, 1, []);
22942
22880
  if (!definition && events[index][1].type === "definition") definition = index;
22943
22881
  }
22944
22882
  const heading = {
@@ -22948,23 +22886,24 @@ function resolveToSetextUnderline(events, context) {
22948
22886
  };
22949
22887
  events[text][1].type = "setextHeadingText";
22950
22888
  if (definition) {
22951
- events.splice(text, 0, [
22889
+ editMap.add(text, 0, [[
22952
22890
  "enter",
22953
22891
  heading,
22954
22892
  context
22955
- ]);
22956
- events.splice(definition + 1, 0, [
22893
+ ]]);
22894
+ editMap.add(definition + 1, 0, [[
22957
22895
  "exit",
22958
22896
  events[content][1],
22959
22897
  context
22960
- ]);
22898
+ ]]);
22961
22899
  events[content][1].end = { ...events[definition][1].end };
22962
22900
  } else events[content][1] = heading;
22963
- events.push([
22901
+ editMap.add(events.length, 0, [[
22964
22902
  "exit",
22965
22903
  heading,
22966
22904
  context
22967
- ]);
22905
+ ]]);
22906
+ editMap.consume(events);
22968
22907
  return events;
22969
22908
  }
22970
22909
  /**
@@ -23056,8 +22995,7 @@ function tokenizeSetextUnderline(effects, ok, nok) {
23056
22995
  return nok(code);
23057
22996
  }
23058
22997
  }
23059
- //#endregion
23060
- //#region node_modules/micromark/lib/initialize/flow.js
22998
+ // node_modules/micromark/lib/initialize/flow.js
23061
22999
  /**
23062
23000
  * @import {
23063
23001
  * InitialConstruct,
@@ -23103,8 +23041,7 @@ function initializeFlow(effects) {
23103
23041
  return initial;
23104
23042
  }
23105
23043
  }
23106
- //#endregion
23107
- //#region node_modules/micromark/lib/initialize/text.js
23044
+ // node_modules/micromark/lib/initialize/text.js
23108
23045
  /**
23109
23046
  * @import {
23110
23047
  * Code,
@@ -23279,8 +23216,7 @@ function resolveAllLineSuffixes(events, context) {
23279
23216
  editMap.consume(events);
23280
23217
  return events;
23281
23218
  }
23282
- //#endregion
23283
- //#region node_modules/micromark/lib/constructs.js
23219
+ // node_modules/micromark/lib/constructs.js
23284
23220
  /**
23285
23221
  * @import {Extension} from 'micromark-util-types'
23286
23222
  */
@@ -23357,8 +23293,7 @@ var insideSpan = { null: [attention, resolver] };
23357
23293
  var attentionMarkers = { null: [42, 95] };
23358
23294
  /** @satisfies {Extension['disable']} */
23359
23295
  var disable = { null: [] };
23360
- //#endregion
23361
- //#region node_modules/micromark/lib/create-tokenizer.js
23296
+ // node_modules/micromark/lib/create-tokenizer.js
23362
23297
  /**
23363
23298
  * @import {
23364
23299
  * Chunk,
@@ -23824,8 +23759,7 @@ function serializeChunks(chunks, expandTabs) {
23824
23759
  }
23825
23760
  return result.join("");
23826
23761
  }
23827
- //#endregion
23828
- //#region node_modules/micromark/lib/parse.js
23762
+ // node_modules/micromark/lib/parse.js
23829
23763
  /**
23830
23764
  * @import {
23831
23765
  * Create,
@@ -23868,8 +23802,7 @@ function parse(options) {
23868
23802
  }
23869
23803
  }
23870
23804
  }
23871
- //#endregion
23872
- //#region node_modules/micromark/lib/postprocess.js
23805
+ // node_modules/micromark/lib/postprocess.js
23873
23806
  /**
23874
23807
  * @import {Event} from 'micromark-util-types'
23875
23808
  */
@@ -23883,8 +23816,7 @@ function postprocess(events) {
23883
23816
  while (!subtokenize(events));
23884
23817
  return events;
23885
23818
  }
23886
- //#endregion
23887
- //#region node_modules/micromark/lib/preprocess.js
23819
+ // node_modules/micromark/lib/preprocess.js
23888
23820
  /**
23889
23821
  * @import {Chunk, Code, Encoding, Value} from 'micromark-util-types'
23890
23822
  */
@@ -23975,8 +23907,7 @@ function preprocess() {
23975
23907
  return chunks;
23976
23908
  }
23977
23909
  }
23978
- //#endregion
23979
- //#region node_modules/micromark-extension-gfm-table/lib/html.js
23910
+ // node_modules/micromark-extension-gfm-table/lib/html.js
23980
23911
  /**
23981
23912
  * @import {HtmlExtension} from 'micromark-util-types'
23982
23913
  */
@@ -24090,8 +24021,7 @@ function gfmTableHtml() {
24090
24021
  function replace($0, $1) {
24091
24022
  return $1 === "|" ? $1 : $0;
24092
24023
  }
24093
- //#endregion
24094
- //#region node_modules/micromark-extension-gfm-table/lib/edit-map.js
24024
+ // node_modules/micromark-extension-gfm-table/lib/edit-map.js
24095
24025
  /**
24096
24026
  * @import {Event} from 'micromark-util-types'
24097
24027
  */
@@ -24201,8 +24131,7 @@ function addImplementation(editMap, at, remove, add) {
24201
24131
  editMap.map.push(change);
24202
24132
  editMap.index.set(at, change);
24203
24133
  }
24204
- //#endregion
24205
- //#region node_modules/micromark-extension-gfm-table/lib/infer.js
24134
+ // node_modules/micromark-extension-gfm-table/lib/infer.js
24206
24135
  /**
24207
24136
  * @import {Event} from 'micromark-util-types'
24208
24137
  */
@@ -24239,8 +24168,7 @@ function gfmTableAlign(events, index) {
24239
24168
  }
24240
24169
  return align;
24241
24170
  }
24242
- //#endregion
24243
- //#region node_modules/micromark-extension-gfm-table/lib/syntax.js
24171
+ // node_modules/micromark-extension-gfm-table/lib/syntax.js
24244
24172
  /**
24245
24173
  * @import {Event, Extension, Point, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types'
24246
24174
  */
@@ -24956,8 +24884,7 @@ function getPoint(events, index) {
24956
24884
  const side = event[0] === "enter" ? "start" : "end";
24957
24885
  return event[1][side];
24958
24886
  }
24959
- //#endregion
24960
- //#region node_modules/micromark-extension-gfm-strikethrough/lib/html.js
24887
+ // node_modules/micromark-extension-gfm-strikethrough/lib/html.js
24961
24888
  /**
24962
24889
  * @import {HtmlExtension} from 'micromark-util-types'
24963
24890
  */
@@ -24979,8 +24906,7 @@ function gfmStrikethroughHtml() {
24979
24906
  } }
24980
24907
  };
24981
24908
  }
24982
- //#endregion
24983
- //#region node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
24909
+ // node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
24984
24910
  /**
24985
24911
  * @import {Options} from 'micromark-extension-gfm-strikethrough'
24986
24912
  * @import {Event, Extension, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types'
@@ -25120,8 +25046,7 @@ function gfmStrikethrough(options) {
25120
25046
  }
25121
25047
  }
25122
25048
  }
25123
- //#endregion
25124
- //#region src/markup/markdown.ts
25049
+ // src/markup/markdown.ts
25125
25050
  /**
25126
25051
  * micromark options for spindle's markdown: CommonMark with GFM tables and
25127
25052
  * strikethrough, raw HTML passed through, and no indented code.
@@ -25144,15 +25069,13 @@ function markdownOptions(options) {
25144
25069
  htmlExtensions: [gfmTableHtml(), gfmStrikethroughHtml()]
25145
25070
  };
25146
25071
  }
25147
- //#endregion
25148
- //#region src/format/source-lines.ts
25072
+ // src/format/source-lines.ts
25149
25073
  /** Index a source once; locate zero-based lines without rescanning its prefixes. */
25150
25074
  function sourceLines(source) {
25151
25075
  const position = sourcePositions(source);
25152
25076
  return (offset) => position(offset).line - 1;
25153
25077
  }
25154
- //#endregion
25155
- //#region src/format/markdown-lines.ts
25078
+ // src/format/markdown-lines.ts
25156
25079
  /** Source lines belonging to the given constructs in runtime Markdown documents. */
25157
25080
  function markdownLines(source, isBlock, types) {
25158
25081
  const found = /* @__PURE__ */ new Set();
@@ -25203,8 +25126,7 @@ function markdownLines(source, isBlock, types) {
25203
25126
  visit(nodes);
25204
25127
  return found;
25205
25128
  }
25206
- //#endregion
25207
- //#region src/format/prettier.ts
25129
+ // src/format/prettier.ts
25208
25130
  /** The options the formatter gives Prettier unless the caller passes its own. */
25209
25131
  var DEFAULT_PRETTIER_OPTIONS = { tabWidth: 2 };
25210
25132
  async function run(code, prettier, options, overrides) {
@@ -25230,8 +25152,7 @@ function formatHTML(code, prettier, options) {
25230
25152
  htmlWhitespaceSensitivity: "css"
25231
25153
  });
25232
25154
  }
25233
- //#endregion
25234
- //#region src/format/placeholders.ts
25155
+ // src/format/placeholders.ts
25235
25156
  /**
25236
25157
  * Read `text` with Spindle's own tokenizer (`tokenizeMarkupTolerant`), so the
25237
25158
  * formatter protects exactly what the runtime executes. A token inside an
@@ -25447,8 +25368,7 @@ function replaceSpindleTokens(html) {
25447
25368
  tokens
25448
25369
  };
25449
25370
  }
25450
- //#endregion
25451
- //#region src/format/format-passage.ts
25371
+ // src/format/format-passage.ts
25452
25372
  /** Default dedenting sub-macros. */
25453
25373
  var DEFAULT_DEDENTING = /* @__PURE__ */ new Set([
25454
25374
  "else",
@@ -25929,8 +25849,7 @@ function wordWrap(text, maxLen, indent) {
25929
25849
  }
25930
25850
  return lines;
25931
25851
  }
25932
- //#endregion
25933
- //#region src/components/macros/include-args.ts
25852
+ // src/components/macros/include-args.ts
25934
25853
  /**
25935
25854
  * The parameters of `{include}`. A standalone `inline` flag only counts
25936
25855
  * outside quotes and brackets, so passage names and expressions containing
@@ -25955,8 +25874,7 @@ function splitIncludeFlag(rawArgs) {
25955
25874
  passage
25956
25875
  };
25957
25876
  }
25958
- //#endregion
25959
- //#region src/transform.ts
25877
+ // src/transform.ts
25960
25878
  /**
25961
25879
  * The sigil transform: the story's code with its variable references
25962
25880
  * (`$var`, `_var`, `@var`, `%var`) turned into the namespace lookups the
@@ -26019,8 +25937,7 @@ function transform(expr, goal = "expression") {
26019
25937
  }
26020
25938
  /** Transformed code by goal and source. */
26021
25939
  var transformCache = /* @__PURE__ */ new Map();
26022
- //#endregion
26023
- //#region src/tooling.ts
25940
+ // src/tooling.ts
26024
25941
  /**
26025
25942
  * What the tooling entry point (`@rohal12/spindle/tooling`) bundles as
26026
25943
  * dist/pkg/story-variables.js: the StoryVariables parser and the markup
@@ -26267,5 +26184,4 @@ function validateVariableReferences(passages, declarations, macros = []) {
26267
26184
  const list = [...passages];
26268
26185
  return checkVariableReferences(list.filter((p) => !p.tags?.some((t) => NOT_MARKUP_TAGS.includes(t))), declarations, referenceOptions(macros, false, list));
26269
26186
  }
26270
- //#endregion
26271
26187
  export { MarkupError, SIGIL_SCOPES, checkParameterTypes, collectStoryPassageReferences, completionContext, discoverMacros, effectiveWidgetDefinitions, endsWithOperator, evaluatePassageName, findCodeEnd, formatDiagnostic, formatPassage, isBlockMacro, isSigil, isSpecialPassage, lexJs, lexTemplate, macroArgumentSpans, macroCalls, pairMarkup, parseBoundVariable, parseCode, parseDeclarations, parseSelectors, parseStoryVariables, parseWidgetDef, passagePieces, passagePiecesOfTokens, passageTarget, pieceOffset, readQuoted, scanStringLiteral, splitArgs, splitIncludeFlag, splitTopLevel, stripLooseQuotes, tokenizeMarkup, tokenizeMarkupTolerant, transform, unescapeQuoted, validateStoryMarkup, validateVariableReferences, variableReferences, widgetDefinitions };