@rohal12/spindle 0.59.25 → 0.59.26

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.
@@ -39,7 +39,7 @@ function create() {
39
39
  */
40
40
  function randomUUID() {
41
41
  if (typeof crypto.randomUUID === "function") return crypto.randomUUID();
42
- const bytes = crypto.getRandomValues(new Uint8Array(16));
42
+ const bytes = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
43
43
  bytes[6] = bytes[6] & 15 | 64;
44
44
  bytes[8] = bytes[8] & 63 | 128;
45
45
  const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0"));
@@ -89,7 +89,7 @@ var grammar_shared_default = {
89
89
  var LB = String.fromCharCode(123);
90
90
  var RB = String.fromCharCode(125);
91
91
  var { SIGIL_SCOPES, withSelectors } = grammar_shared_default;
92
- var VOID_TAGS = new Set([
92
+ var VOID_TAGS = /* @__PURE__ */ new Set([
93
93
  "area",
94
94
  "base",
95
95
  "br",
@@ -751,7 +751,7 @@ function peg$parse(input, options) {
751
751
  return withSelectors(node, s);
752
752
  }
753
753
  function peg$f35() {
754
- fail("Unclosed " + LB + input.substr(location().end.offset, 1) + "…: no } ends it", location(), "unclosed-expression");
754
+ fail("Unclosed {" + input.substr(location().end.offset, 1) + "…: no } ends it", location(), "unclosed-expression");
755
755
  }
756
756
  function peg$f36(start) {
757
757
  return skipTo(hooks.closeBrace(input, start, start));
@@ -783,13 +783,13 @@ function peg$parse(input, options) {
783
783
  tag.nameStart = nameEnd - name.length;
784
784
  tag.nameEnd = nameEnd;
785
785
  tag.selectorSpan = selectorSpan(s, ss, start);
786
- if (tail === null) fail("Unclosed " + LB + (close ? "/" : "") + name + "…: no } ends the macro", loc, "unclosed-macro");
786
+ if (tail === null) fail("Unclosed {" + (close ? "/" : "") + name + "…: no } ends the macro", loc, "unclosed-macro");
787
787
  tag.rawArgs = tail.trim();
788
788
  tag.argsStart = tag.rawArgs ? nameEnd + tail.length - tail.trimStart().length : nameEnd;
789
789
  tag.argsEnd = tag.argsStart + tag.rawArgs.length;
790
790
  if (close) {
791
791
  if (s !== NO_SELECTORS) fail("A closing tag takes no selectors: " + label(tag), loc, "closer-with-selectors");
792
- if (tag.rawArgs) fail("A closing tag takes no arguments: " + LB + "/" + name + " " + tag.rawArgs + RB, loc, "closer-with-arguments");
792
+ if (tag.rawArgs) fail("A closing tag takes no arguments: {/" + name + " " + tag.rawArgs + RB, loc, "closer-with-arguments");
793
793
  tag.kind = "close";
794
794
  } else {
795
795
  withSelectors(tag, s);
@@ -798,7 +798,7 @@ function peg$parse(input, options) {
798
798
  return tag;
799
799
  }
800
800
  function peg$f43(s) {
801
- fail("A closing tag starts with a letter after " + LB + "/", location(), "invalid-closer");
801
+ fail("A closing tag starts with a letter after {/", location(), "invalid-closer");
802
802
  }
803
803
  function peg$f44(value) {
804
804
  return EMAIL_AUTOLINK.test(value);
@@ -1677,12 +1677,14 @@ function peg$parse(input, options) {
1677
1677
  s3 = peg$FAILED;
1678
1678
  if (peg$silentFails === 0) peg$fail(peg$e13);
1679
1679
  }
1680
- if (s3 === peg$FAILED) if (input.substr(peg$currPos, 2) === peg$c8) {
1681
- s3 = peg$c8;
1682
- peg$currPos += 2;
1683
- } else {
1684
- s3 = peg$FAILED;
1685
- if (peg$silentFails === 0) peg$fail(peg$e12);
1680
+ if (s3 === peg$FAILED) {
1681
+ if (input.substr(peg$currPos, 2) === peg$c8) {
1682
+ s3 = peg$c8;
1683
+ peg$currPos += 2;
1684
+ } else {
1685
+ s3 = peg$FAILED;
1686
+ if (peg$silentFails === 0) peg$fail(peg$e12);
1687
+ }
1686
1688
  }
1687
1689
  peg$silentFails--;
1688
1690
  if (s3 === peg$FAILED) s2 = void 0;
@@ -1721,12 +1723,14 @@ function peg$parse(input, options) {
1721
1723
  s3 = peg$FAILED;
1722
1724
  if (peg$silentFails === 0) peg$fail(peg$e13);
1723
1725
  }
1724
- if (s3 === peg$FAILED) if (input.substr(peg$currPos, 2) === peg$c8) {
1725
- s3 = peg$c8;
1726
- peg$currPos += 2;
1727
- } else {
1728
- s3 = peg$FAILED;
1729
- if (peg$silentFails === 0) peg$fail(peg$e12);
1726
+ if (s3 === peg$FAILED) {
1727
+ if (input.substr(peg$currPos, 2) === peg$c8) {
1728
+ s3 = peg$c8;
1729
+ peg$currPos += 2;
1730
+ } else {
1731
+ s3 = peg$FAILED;
1732
+ if (peg$silentFails === 0) peg$fail(peg$e12);
1733
+ }
1730
1734
  }
1731
1735
  peg$silentFails--;
1732
1736
  if (s3 === peg$FAILED) s2 = void 0;
@@ -3409,7 +3413,7 @@ var BLOCK_MACROS = new NameSet([
3409
3413
  "nobr"
3410
3414
  ]);
3411
3415
  /** Macros whose body is JavaScript source, kept verbatim. */
3412
- var RAW_BODY_MACROS = new Set(["do"]);
3416
+ var RAW_BODY_MACROS = /* @__PURE__ */ new Set(["do"]);
3413
3417
  /** Whether a macro's body is JavaScript, kept verbatim (`{do}`). */
3414
3418
  function isRawMacro(name) {
3415
3419
  return RAW_BODY_MACROS.has(name);
@@ -3423,7 +3427,7 @@ function registerBlockMacro(name) {
3423
3427
  BLOCK_MACROS.add(name);
3424
3428
  }
3425
3429
  /** Macros whose branches render as one: the node holds one per branch. */
3426
- var BRANCHING = new Set([
3430
+ var BRANCHING = /* @__PURE__ */ new Set([
3427
3431
  "if",
3428
3432
  "switch",
3429
3433
  "timed"
@@ -4728,7 +4732,8 @@ function binop(name, prec) {
4728
4732
  binop: prec
4729
4733
  });
4730
4734
  }
4731
- var beforeExpr = { beforeExpr: true }, startsExpr = { startsExpr: true };
4735
+ var beforeExpr = { beforeExpr: true };
4736
+ var startsExpr = { startsExpr: true };
4732
4737
  var keywords = {};
4733
4738
  function kw(name, options) {
4734
4739
  if (options === void 0) options = {};
@@ -4983,11 +4988,27 @@ function pushComment(options, array) {
4983
4988
  array.push(comment);
4984
4989
  };
4985
4990
  }
4986
- var SCOPE_TOP = 1, SCOPE_FUNCTION = 2, SCOPE_ASYNC = 4, SCOPE_GENERATOR = 8, SCOPE_ARROW = 16, SCOPE_SIMPLE_CATCH = 32, SCOPE_SUPER = 64, SCOPE_DIRECT_SUPER = 128, SCOPE_CLASS_STATIC_BLOCK = 256, SCOPE_CLASS_FIELD_INIT = 512, SCOPE_SWITCH = 1024, SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
4991
+ var SCOPE_TOP = 1;
4992
+ var SCOPE_FUNCTION = 2;
4993
+ var SCOPE_ASYNC = 4;
4994
+ var SCOPE_GENERATOR = 8;
4995
+ var SCOPE_ARROW = 16;
4996
+ var SCOPE_SIMPLE_CATCH = 32;
4997
+ var SCOPE_SUPER = 64;
4998
+ var SCOPE_DIRECT_SUPER = 128;
4999
+ var SCOPE_CLASS_STATIC_BLOCK = 256;
5000
+ var SCOPE_CLASS_FIELD_INIT = 512;
5001
+ var SCOPE_SWITCH = 1024;
5002
+ var SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
4987
5003
  function functionFlags(async, generator) {
4988
5004
  return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
4989
5005
  }
4990
- var BIND_NONE = 0, BIND_VAR = 1, BIND_LEXICAL = 2, BIND_FUNCTION = 3, BIND_SIMPLE_CATCH = 4, BIND_OUTSIDE = 5;
5006
+ var BIND_NONE = 0;
5007
+ var BIND_VAR = 1;
5008
+ var BIND_LEXICAL = 2;
5009
+ var BIND_FUNCTION = 3;
5010
+ var BIND_SIMPLE_CATCH = 4;
5011
+ var BIND_OUTSIDE = 5;
4991
5012
  var Parser = function Parser(options, input, startPos) {
4992
5013
  this.options = options = getOptions(options);
4993
5014
  this.sourceFile = options.sourceFile;
@@ -5242,7 +5263,8 @@ pp$8.parseTopLevel = function(node) {
5242
5263
  node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType;
5243
5264
  return this.finishNode(node, "Program");
5244
5265
  };
5245
- var loopLabel = { kind: "loop" }, switchLabel = { kind: "switch" };
5266
+ var loopLabel = { kind: "loop" };
5267
+ var switchLabel = { kind: "switch" };
5246
5268
  pp$8.isLet = function(context) {
5247
5269
  if (this.options.ecmaVersion < 6 || !this.isContextual("let")) return false;
5248
5270
  skipWhiteSpace.lastIndex = this.pos;
@@ -5671,7 +5693,9 @@ pp$8.parseVarId = function(decl, kind) {
5671
5693
  decl.id = kind === "using" || kind === "await using" ? this.parseIdent() : this.parseBindingAtom();
5672
5694
  this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
5673
5695
  };
5674
- var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
5696
+ var FUNC_STATEMENT = 1;
5697
+ var FUNC_HANGING_STATEMENT = 2;
5698
+ var FUNC_NULLABLE_ID = 4;
5675
5699
  pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
5676
5700
  this.initFunction(node);
5677
5701
  if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
@@ -5746,13 +5770,17 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
5746
5770
  else keyName = "static";
5747
5771
  }
5748
5772
  node.static = isStatic;
5749
- if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) isAsync = true;
5750
- else keyName = "async";
5773
+ if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
5774
+ if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) isAsync = true;
5775
+ else keyName = "async";
5776
+ }
5751
5777
  if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) isGenerator = true;
5752
5778
  if (!keyName && !isAsync && !isGenerator) {
5753
5779
  var lastValue = this.value;
5754
- if (this.eatContextual("get") || this.eatContextual("set")) if (this.isClassElementNameStart()) kind = lastValue;
5755
- else keyName = lastValue;
5780
+ if (this.eatContextual("get") || this.eatContextual("set")) {
5781
+ if (this.isClassElementNameStart()) kind = lastValue;
5782
+ else keyName = lastValue;
5783
+ }
5756
5784
  }
5757
5785
  if (keyName) {
5758
5786
  node.computed = false;
@@ -5845,8 +5873,10 @@ pp$8.exitClassBody = function() {
5845
5873
  var parent = len === 0 ? null : this.privateNameStack[len - 1];
5846
5874
  for (var i = 0; i < used.length; ++i) {
5847
5875
  var id = used[i];
5848
- if (!hasOwn$1(declared, id.name)) if (parent) parent.used.push(id);
5849
- else this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class");
5876
+ if (!hasOwn$1(declared, id.name)) {
5877
+ if (parent) parent.used.push(id);
5878
+ else this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class");
5879
+ }
5850
5880
  }
5851
5881
  };
5852
5882
  function isPrivateNameConflicted(privateNameMap, element) {
@@ -5868,10 +5898,12 @@ function checkKeyName(node, name) {
5868
5898
  return !computed && (key.type === "Identifier" && key.name === name || key.type === "Literal" && key.value === name);
5869
5899
  }
5870
5900
  pp$8.parseExportAllDeclaration = function(node, exports$1) {
5871
- if (this.options.ecmaVersion >= 11) if (this.eatContextual("as")) {
5872
- node.exported = this.parseModuleExportName();
5873
- this.checkExport(exports$1, node.exported, this.lastTokStart);
5874
- } else node.exported = null;
5901
+ if (this.options.ecmaVersion >= 11) {
5902
+ if (this.eatContextual("as")) {
5903
+ node.exported = this.parseModuleExportName();
5904
+ this.checkExport(exports$1, node.exported, this.lastTokStart);
5905
+ } else node.exported = null;
5906
+ }
5875
5907
  this.expectContextual("from");
5876
5908
  if (this.type !== types$1.string) this.unexpected();
5877
5909
  node.source = this.parseExprAtom();
@@ -6389,9 +6421,11 @@ pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
6389
6421
  var kind = prop.kind;
6390
6422
  if (this.options.ecmaVersion >= 6) {
6391
6423
  if (name === "__proto__" && kind === "init") {
6392
- if (propHash.proto) if (refDestructuringErrors) {
6393
- if (refDestructuringErrors.doubleProto < 0) refDestructuringErrors.doubleProto = key.start;
6394
- } else this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
6424
+ if (propHash.proto) {
6425
+ if (refDestructuringErrors) {
6426
+ if (refDestructuringErrors.doubleProto < 0) refDestructuringErrors.doubleProto = key.start;
6427
+ } else this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
6428
+ }
6395
6429
  propHash.proto = true;
6396
6430
  }
6397
6431
  return;
@@ -6425,8 +6459,10 @@ pp$5.parseExpression = function(forInit, refDestructuringErrors) {
6425
6459
  });
6426
6460
  };
6427
6461
  pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
6428
- if (this.isContextual("yield")) if (this.inGenerator) return this.parseYield(forInit);
6429
- else this.exprAllowed = false;
6462
+ if (this.isContextual("yield")) {
6463
+ if (this.inGenerator) return this.parseYield(forInit);
6464
+ else this.exprAllowed = false;
6465
+ }
6430
6466
  var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
6431
6467
  if (refDestructuringErrors) {
6432
6468
  oldParenAssign = refDestructuringErrors.parenthesizedAssign;
@@ -6545,9 +6581,10 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
6545
6581
  expr = this.finishNode(node$1, "UpdateExpression");
6546
6582
  }
6547
6583
  }
6548
- if (!incDec && !(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.starstar)) if (sawUnary) this.unexpected(this.lastTokStart);
6549
- else return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false);
6550
- else return expr;
6584
+ if (!incDec && !(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.starstar)) {
6585
+ if (sawUnary) this.unexpected(this.lastTokStart);
6586
+ else return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false);
6587
+ } else return expr;
6551
6588
  };
6552
6589
  function isLocalVariableAccess(node) {
6553
6590
  return node.type === "Identifier" || node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression);
@@ -6745,17 +6782,18 @@ pp$5.parseExprImport = function(forNew) {
6745
6782
  pp$5.parseDynamicImport = function(node) {
6746
6783
  this.next();
6747
6784
  node.source = this.parseMaybeAssign();
6748
- if (this.options.ecmaVersion >= 16) if (!this.eat(types$1.parenR)) {
6749
- this.expect(types$1.comma);
6750
- if (!this.afterTrailingComma(types$1.parenR)) {
6751
- node.options = this.parseMaybeAssign();
6752
- if (!this.eat(types$1.parenR)) {
6753
- this.expect(types$1.comma);
6754
- if (!this.afterTrailingComma(types$1.parenR)) this.unexpected();
6755
- }
6785
+ if (this.options.ecmaVersion >= 16) {
6786
+ if (!this.eat(types$1.parenR)) {
6787
+ this.expect(types$1.comma);
6788
+ if (!this.afterTrailingComma(types$1.parenR)) {
6789
+ node.options = this.parseMaybeAssign();
6790
+ if (!this.eat(types$1.parenR)) {
6791
+ this.expect(types$1.comma);
6792
+ if (!this.afterTrailingComma(types$1.parenR)) this.unexpected();
6793
+ }
6794
+ } else node.options = null;
6756
6795
  } else node.options = null;
6757
- } else node.options = null;
6758
- else if (!this.eat(types$1.parenR)) {
6796
+ } else if (!this.eat(types$1.parenR)) {
6759
6797
  var errorPos = this.start;
6760
6798
  if (this.eat(types$1.comma) && this.eat(types$1.parenR)) this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
6761
6799
  else this.unexpected(errorPos);
@@ -6989,12 +7027,14 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
6989
7027
  } else this.unexpected();
6990
7028
  };
6991
7029
  pp$5.parsePropertyName = function(prop) {
6992
- if (this.options.ecmaVersion >= 6) if (this.eat(types$1.bracketL)) {
6993
- prop.computed = true;
6994
- prop.key = this.parseMaybeAssign();
6995
- this.expect(types$1.bracketR);
6996
- return prop.key;
6997
- } else prop.computed = false;
7030
+ if (this.options.ecmaVersion >= 6) {
7031
+ if (this.eat(types$1.bracketL)) {
7032
+ prop.computed = true;
7033
+ prop.key = this.parseMaybeAssign();
7034
+ this.expect(types$1.bracketR);
7035
+ return prop.key;
7036
+ } else prop.computed = false;
7037
+ }
6998
7038
  return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
6999
7039
  };
7000
7040
  pp$5.initFunction = function(node) {
@@ -7129,8 +7169,10 @@ pp$5.parsePrivateIdent = function() {
7129
7169
  else this.unexpected();
7130
7170
  this.next();
7131
7171
  this.finishNode(node, "PrivateIdentifier");
7132
- if (this.options.checkPrivateFields) if (this.privateNameStack.length === 0) this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class");
7133
- else this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
7172
+ if (this.options.checkPrivateFields) {
7173
+ if (this.privateNameStack.length === 0) this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class");
7174
+ else this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
7175
+ }
7134
7176
  return node;
7135
7177
  };
7136
7178
  pp$5.parseYield = function(forInit) {
@@ -7266,23 +7308,21 @@ var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
7266
7308
  var ecma11BinaryProperties = ecma10BinaryProperties;
7267
7309
  var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict";
7268
7310
  var ecma13BinaryProperties = ecma12BinaryProperties;
7269
- var ecma14BinaryProperties = ecma13BinaryProperties;
7270
7311
  var unicodeBinaryProperties = {
7271
7312
  9: ecma9BinaryProperties,
7272
7313
  10: ecma10BinaryProperties,
7273
7314
  11: ecma11BinaryProperties,
7274
7315
  12: ecma12BinaryProperties,
7275
7316
  13: ecma13BinaryProperties,
7276
- 14: ecma14BinaryProperties
7317
+ 14: ecma13BinaryProperties
7277
7318
  };
7278
- var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji";
7279
7319
  var unicodeBinaryPropertiesOfStrings = {
7280
7320
  9: "",
7281
7321
  10: "",
7282
7322
  11: "",
7283
7323
  12: "",
7284
7324
  13: "",
7285
- 14: ecma14BinaryPropertiesOfStrings
7325
+ 14: "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"
7286
7326
  };
7287
7327
  var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
7288
7328
  var ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";
@@ -7290,14 +7330,13 @@ var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Han
7290
7330
  var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
7291
7331
  var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
7292
7332
  var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
7293
- var ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode;
7294
7333
  var unicodeScriptValues = {
7295
7334
  9: ecma9ScriptValues,
7296
7335
  10: ecma10ScriptValues,
7297
7336
  11: ecma11ScriptValues,
7298
7337
  12: ecma12ScriptValues,
7299
7338
  13: ecma13ScriptValues,
7300
- 14: ecma14ScriptValues
7339
+ 14: ecma13ScriptValues + " " + scriptValuesAddedInUnicode
7301
7340
  };
7302
7341
  var data = {};
7303
7342
  function buildUnicodeData(ecmaVersion) {
@@ -7668,9 +7707,11 @@ pp$1.regexp_groupSpecifier = function(state) {
7668
7707
  if (!this.regexp_eatGroupName(state)) state.raise("Invalid group");
7669
7708
  var trackDisjunction = this.options.ecmaVersion >= 16;
7670
7709
  var known = state.groupNames[state.lastStringValue];
7671
- if (known) if (trackDisjunction) {
7672
- for (var i = 0, list = known; i < list.length; i += 1) if (!list[i].separatedFrom(state.branchID)) state.raise("Duplicate capture group name");
7673
- } else state.raise("Duplicate capture group name");
7710
+ if (known) {
7711
+ if (trackDisjunction) {
7712
+ for (var i = 0, list = known; i < list.length; i += 1) if (!list[i].separatedFrom(state.branchID)) state.raise("Duplicate capture group name");
7713
+ } else state.raise("Duplicate capture group name");
7714
+ }
7674
7715
  if (trackDisjunction) (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);
7675
7716
  else state.groupNames[state.lastStringValue] = true;
7676
7717
  }
@@ -8684,12 +8725,14 @@ pp.readTmplToken = function() {
8684
8725
  if (this.pos >= this.input.length) this.raise(this.start, "Unterminated template");
8685
8726
  var ch = this.input.charCodeAt(this.pos);
8686
8727
  if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) {
8687
- if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) if (ch === 36) {
8688
- this.pos += 2;
8689
- return this.finishToken(types$1.dollarBraceL);
8690
- } else {
8691
- ++this.pos;
8692
- return this.finishToken(types$1.backQuote);
8728
+ if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
8729
+ if (ch === 36) {
8730
+ this.pos += 2;
8731
+ return this.finishToken(types$1.dollarBraceL);
8732
+ } else {
8733
+ ++this.pos;
8734
+ return this.finishToken(types$1.backQuote);
8735
+ }
8693
8736
  }
8694
8737
  out += this.input.slice(chunkStart, this.pos);
8695
8738
  return this.finishToken(types$1.template, out);
@@ -8706,9 +8749,7 @@ pp.readTmplToken = function() {
8706
8749
  case 10:
8707
8750
  out += "\n";
8708
8751
  break;
8709
- default:
8710
- out += String.fromCharCode(ch);
8711
- break;
8752
+ default: out += String.fromCharCode(ch);
8712
8753
  }
8713
8754
  if (this.options.locations) {
8714
8755
  ++this.curLine;
@@ -8731,7 +8772,6 @@ pp.readInvalidTemplateToken = function() {
8731
8772
  case "\u2029":
8732
8773
  ++this.curLine;
8733
8774
  this.lineStart = this.pos + 1;
8734
- break;
8735
8775
  }
8736
8776
  this.raise(this.start, "Unterminated template");
8737
8777
  };
@@ -8890,7 +8930,7 @@ function notABody(src, pos) {
8890
8930
  return NOT_A_BODY_RE.test(src);
8891
8931
  }
8892
8932
  /** Tokens that may end an operand, and so a statement before a line break. */
8893
- var OPERAND_ENDS = new Set([
8933
+ var OPERAND_ENDS = /* @__PURE__ */ new Set([
8894
8934
  types$1.name,
8895
8935
  types$1.num,
8896
8936
  types$1.string,
@@ -9016,13 +9056,13 @@ function transientAssignment(p, end) {
9016
9056
  return false;
9017
9057
  }
9018
9058
  }
9019
- var OPENERS = new Set([
9059
+ var OPENERS = /* @__PURE__ */ new Set([
9020
9060
  types$1.parenL,
9021
9061
  types$1.bracketL,
9022
9062
  types$1.braceL,
9023
9063
  types$1.dollarBraceL
9024
9064
  ]);
9025
- var CLOSERS = new Set([
9065
+ var CLOSERS = /* @__PURE__ */ new Set([
9026
9066
  types$1.parenR,
9027
9067
  types$1.bracketR,
9028
9068
  types$1.braceR
@@ -9319,7 +9359,7 @@ var WORD_RE$1 = /[\p{ID_Continue}$.]*/uy;
9319
9359
  /** The flags after a regex literal, whatever they are. */
9320
9360
  var FLAGS_RE = /[\p{ID_Continue}$]*/uy;
9321
9361
  /** Words a string may follow with no space between (`of'x'`, `get"y"`). */
9322
- var WORDS_BEFORE_STRING = new Set([
9362
+ var WORDS_BEFORE_STRING = /* @__PURE__ */ new Set([
9323
9363
  "of",
9324
9364
  "get",
9325
9365
  "set",
@@ -10058,7 +10098,7 @@ function withEntry(ns, key, value) {
10058
10098
  var EMPTY_NAMESPACE = Object.freeze(createNamespace());
10059
10099
  /** The names whose own entries differ between `a` and `b`, `a`'s first. */
10060
10100
  function changedNames(a, b) {
10061
- return [...new Set([...Object.keys(a), ...Object.keys(b)])].filter((name) => ownValue(a, name) !== ownValue(b, name));
10101
+ return [.../* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)])].filter((name) => ownValue(a, name) !== ownValue(b, name));
10062
10102
  }
10063
10103
  var isCount = (value) => typeof value === "number" && Number.isInteger(value) && value >= 0;
10064
10104
  /** The count of `name` in `counts`: its own entry, or 0. */
@@ -10657,7 +10697,7 @@ var OPTION_PARAMETERS = [{
10657
10697
  required: true
10658
10698
  }];
10659
10699
  /** The parameters of the built-in sub-macros that take arguments. */
10660
- var SUB_MACRO_PARAMETERS = new Map([["option", OPTION_PARAMETERS]]);
10700
+ var SUB_MACRO_PARAMETERS = /* @__PURE__ */ new Map([["option", OPTION_PARAMETERS]]);
10661
10701
  /** The parameters of the built-in sub-macro `name`, if it takes any. */
10662
10702
  function subMacroParameters(name) {
10663
10703
  return SUB_MACRO_PARAMETERS.get(name.toLowerCase());
@@ -10713,13 +10753,13 @@ function extentOf(piece) {
10713
10753
  return piece.kind === "code" ? piece.code.length : piece.kind === "text" ? piece.text.length : piece.length;
10714
10754
  }
10715
10755
  /** Macros whose whole argument text is one expression: branch conditions. */
10716
- var CONDITION_MACROS = new Set([
10756
+ var CONDITION_MACROS = /* @__PURE__ */ new Set([
10717
10757
  "if",
10718
10758
  "elseif",
10719
10759
  "case"
10720
10760
  ]);
10721
10761
  /** Block macros whose body is the name of a passage. */
10722
- var PASSAGE_BODIES = new Set(["dialog"]);
10762
+ var PASSAGE_BODIES = /* @__PURE__ */ new Set(["dialog"]);
10723
10763
  /**
10724
10764
  * `params` with each `string` and `text` parameter (options too) saying
10725
10765
  * what it holds: what it declares, else `holds`.
@@ -11333,18 +11373,19 @@ function widgetDefinitions(passages, parametersOf = registeredParameters) {
11333
11373
  if (passage.name !== "StoryInit" && !passage.tags?.includes("widget")) continue;
11334
11374
  const open = [];
11335
11375
  const done = [];
11336
- for (const token of tokenizeMarkupTolerant(passage.content).tokens) if (token.type === "macro" && token.name.toLowerCase() === "widget") if (!token.isClose) open.push({
11337
- token,
11338
- isBlock: false
11339
- });
11340
- else {
11341
- const def = open.pop();
11342
- if (def) done.push({
11343
- ...def,
11344
- closeStart: token.start
11376
+ for (const token of tokenizeMarkupTolerant(passage.content).tokens) if (token.type === "macro" && token.name.toLowerCase() === "widget") {
11377
+ if (!token.isClose) open.push({
11378
+ token,
11379
+ isBlock: false
11345
11380
  });
11346
- }
11347
- else if (open.length > 0 && (token.type === "variable" && token.scope === "local" && token.name === "children" || tokenTextContainsChildren(token, parametersOf))) open[open.length - 1].isBlock = true;
11381
+ else {
11382
+ const def = open.pop();
11383
+ if (def) done.push({
11384
+ ...def,
11385
+ closeStart: token.start
11386
+ });
11387
+ }
11388
+ } else if (open.length > 0 && (token.type === "variable" && token.scope === "local" && token.name === "children" || tokenTextContainsChildren(token, parametersOf))) open[open.length - 1].isBlock = true;
11348
11389
  done.push(...open);
11349
11390
  const defs = [];
11350
11391
  for (const { token, isBlock, closeStart } of done) try {
@@ -11426,7 +11467,7 @@ var OutgoingContext = createContext(null);
11426
11467
  * while the fields don't change, as the store's snapshot must.
11427
11468
  */
11428
11469
  function useStoryFields(...keys) {
11429
- const prev = useRef();
11470
+ const prev = useRef(void 0);
11430
11471
  const freeze = useContext(FrozenStateContext);
11431
11472
  return useStoryStore((s) => {
11432
11473
  if (prev.current && freeze?.(s)) return prev.current;
@@ -12385,7 +12426,7 @@ function unclosedHtml(text) {
12385
12426
  }
12386
12427
  }
12387
12428
  }
12388
- const construct = {
12429
+ return { text: { 60: {
12389
12430
  name: "unclosedHtml",
12390
12431
  resolveTo: joinData,
12391
12432
  tokenize(effects, ok, nok) {
@@ -12398,8 +12439,7 @@ function unclosedHtml(text) {
12398
12439
  return ok;
12399
12440
  };
12400
12441
  }
12401
- };
12402
- return { text: { 60: construct } };
12442
+ } } };
12403
12443
  }
12404
12444
  //#endregion
12405
12445
  //#region src/utils/source-location.ts
@@ -12442,7 +12482,7 @@ function logMacroError(label, error, location = currentSourceLocation()) {
12442
12482
  * from then on; otherwise the macro renders nothing.
12443
12483
  */
12444
12484
  function useRunOnce(macro, rawArgs, effect) {
12445
- const failure = useRef();
12485
+ const failure = useRef(void 0);
12446
12486
  if (failure.current === void 0) {
12447
12487
  failure.current = null;
12448
12488
  const location = currentSourceLocation();
@@ -12516,7 +12556,7 @@ var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
12516
12556
  * paragraphs between them would pull the children out of the structure (#423).
12517
12557
  * Text between the children, when it is only whitespace, is dropped.
12518
12558
  */
12519
- var STRUCTURAL_ELEMENTS = new Set([
12559
+ var STRUCTURAL_ELEMENTS = /* @__PURE__ */ new Set([
12520
12560
  "table",
12521
12561
  "thead",
12522
12562
  "tbody",
@@ -12532,7 +12572,7 @@ var STRUCTURAL_ELEMENTS = new Set([
12532
12572
  "datalist"
12533
12573
  ]);
12534
12574
  /** Elements whose content is literal text, not markdown. */
12535
- var PREFORMATTED_ELEMENTS = new Set([
12575
+ var PREFORMATTED_ELEMENTS = /* @__PURE__ */ new Set([
12536
12576
  "pre",
12537
12577
  "textarea",
12538
12578
  "style"
@@ -12658,7 +12698,8 @@ function htmlToPreact(html, ph, unwrapParagraphs = false) {
12658
12698
  if (unwrapParagraphs) {
12659
12699
  for (const child of Array.from(content.childNodes)) if (child.nodeType === Node.ELEMENT_NODE && child.nodeName === "P") child.replaceWith(...Array.from(child.childNodes));
12660
12700
  }
12661
- return /* @__PURE__ */ jsx(Fragment$1, { children: Array.from(content.childNodes).map((child, i) => convertDomNode(child, i, ph)) });
12701
+ const children = Array.from(content.childNodes).map((child, i) => convertDomNode(child, i, ph));
12702
+ return /* @__PURE__ */ jsx(Fragment$1, { children });
12662
12703
  }
12663
12704
  function convertDomNode(node, key, ph) {
12664
12705
  if (node.nodeType === Node.TEXT_NODE) {
@@ -12716,7 +12757,7 @@ function convertDomNode(node, key, ph) {
12716
12757
  * (lists, headings, paragraphs) is invalid in them: inline elements, and
12717
12758
  * block elements such as headings and buttons that only take inline children.
12718
12759
  */
12719
- var INLINE_ELEMENTS = new Set([
12760
+ var INLINE_ELEMENTS = /* @__PURE__ */ new Set([
12720
12761
  "a",
12721
12762
  "abbr",
12722
12763
  "b",
@@ -12769,7 +12810,7 @@ var INLINE_ELEMENTS = new Set([
12769
12810
  * as `=""` are passed as `true`, since '' is falsy (#177); one that only
12770
12811
  * resolves to '' through an interpolation stays ''.
12771
12812
  */
12772
- var LIVE_PROPERTIES = new Set([
12813
+ var LIVE_PROPERTIES = /* @__PURE__ */ new Set([
12773
12814
  "value",
12774
12815
  "checked",
12775
12816
  "selected",
@@ -12781,7 +12822,7 @@ var LIVE_PROPERTIES = new Set([
12781
12822
  * (`disabled="{$locked ? 'disabled' : ''}"`) is left out, so a variable can
12782
12823
  * switch it off.
12783
12824
  */
12784
- var BOOLEAN_ATTRIBUTES = new Set([
12825
+ var BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
12785
12826
  "allowfullscreen",
12786
12827
  "async",
12787
12828
  "autofocus",
@@ -12809,8 +12850,8 @@ var BOOLEAN_ATTRIBUTES = new Set([
12809
12850
  "selected"
12810
12851
  ]);
12811
12852
  /** Names set directly on SVG elements (see splitAttributes). */
12812
- var SVG_DIRECT = new Set([
12813
- ...new Set([
12853
+ var SVG_DIRECT = /* @__PURE__ */ new Set([
12854
+ .../* @__PURE__ */ new Set([
12814
12855
  "key",
12815
12856
  "ref",
12816
12857
  "children",
@@ -12876,6 +12917,7 @@ function splitAttributes(attributes, svg) {
12876
12917
  */
12877
12918
  function useDirectAttributes(direct) {
12878
12919
  const elementRef = useRef(null);
12920
+ const directKey = JSON.stringify(direct);
12879
12921
  useLayoutEffect(() => {
12880
12922
  const el = elementRef.current;
12881
12923
  if (!el || direct.length === 0) return;
@@ -12883,7 +12925,7 @@ function useDirectAttributes(direct) {
12883
12925
  return () => {
12884
12926
  for (const [name] of direct) el.removeAttribute(name);
12885
12927
  };
12886
- }, [JSON.stringify(direct)]);
12928
+ }, [directKey]);
12887
12929
  return direct.length > 0 ? elementRef : void 0;
12888
12930
  }
12889
12931
  var decodedText = /* @__PURE__ */ new Map();
@@ -12988,29 +13030,31 @@ function HtmlNodeRenderer({ node }) {
12988
13030
  const isInline = INLINE_ELEMENTS.has(tag);
12989
13031
  let children = void 0;
12990
13032
  let structural = false;
12991
- if (node.children.length > 0) if (tag === "style") children = node.children.map((n) => n.type === "text" ? n.value : renderSingleNode(n));
12992
- else if (inRaw || isRawRoot) children = renderInlineNodes(node.children);
12993
- else {
12994
- const summaryAt = tag === "details" ? leadingSummaryIndex(node.children) : -1;
12995
- const body = (nodes) => renderNodes(nodes, {
12996
- nobr,
12997
- locals,
12998
- inline: isInline
12999
- });
13000
- structural = STRUCTURAL_ELEMENTS.has(tag) && node.children.every((n) => n.type !== "text" || isBlankText(n));
13001
- children = structural ? node.children.filter((n) => n.type !== "text").map((n) => renderSingleNode(n)) : summaryAt === -1 ? body(node.children) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
13002
- body(node.children.slice(0, summaryAt)),
13003
- renderSingleNode(node.children[summaryAt]),
13004
- body(node.children.slice(summaryAt + 1))
13005
- ] });
13006
- if (isInline !== parentInline) children = /* @__PURE__ */ jsx(InlineContext.Provider, {
13007
- value: isInline,
13008
- children
13009
- });
13010
- if (structural !== parentStructural) children = /* @__PURE__ */ jsx(StructuralContext.Provider, {
13011
- value: structural,
13012
- children
13013
- });
13033
+ if (node.children.length > 0) {
13034
+ if (tag === "style") children = node.children.map((n) => n.type === "text" ? n.value : renderSingleNode(n));
13035
+ else if (inRaw || isRawRoot) children = renderInlineNodes(node.children);
13036
+ else {
13037
+ const summaryAt = tag === "details" ? leadingSummaryIndex(node.children) : -1;
13038
+ const body = (nodes) => renderNodes(nodes, {
13039
+ nobr,
13040
+ locals,
13041
+ inline: isInline
13042
+ });
13043
+ structural = STRUCTURAL_ELEMENTS.has(tag) && node.children.every((n) => n.type !== "text" || isBlankText(n));
13044
+ children = structural ? node.children.filter((n) => n.type !== "text").map((n) => renderSingleNode(n)) : summaryAt === -1 ? body(node.children) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
13045
+ body(node.children.slice(0, summaryAt)),
13046
+ renderSingleNode(node.children[summaryAt]),
13047
+ body(node.children.slice(summaryAt + 1))
13048
+ ] });
13049
+ if (isInline !== parentInline) children = /* @__PURE__ */ jsx(InlineContext.Provider, {
13050
+ value: isInline,
13051
+ children
13052
+ });
13053
+ if (structural !== parentStructural) children = /* @__PURE__ */ jsx(StructuralContext.Provider, {
13054
+ value: structural,
13055
+ children
13056
+ });
13057
+ }
13014
13058
  }
13015
13059
  if (inSvg && tag === "foreignobject" && children) children = /* @__PURE__ */ jsx(SvgContext.Provider, {
13016
13060
  value: false,
@@ -13576,120 +13620,121 @@ function unflatten(parsed, revivers, options) {
13576
13620
  if (index >= values.length) invalid$1();
13577
13621
  const value = values[index];
13578
13622
  if (!value || typeof value !== "object") hydrated[index] = ops.fromPrimitive(value);
13579
- else if (Array.isArray(value)) if (typeof value[0] === "string") {
13580
- const type = value[0];
13581
- const reviver = revivers && Object.hasOwn(revivers, type) ? revivers[type] : void 0;
13582
- if (reviver) {
13583
- let i = value[1];
13584
- if (typeof i !== "number") i = values.push(value[1]) - 1;
13585
- if (Object.hasOwn(hydrated, i)) return hydrated[index] = reviver(hydrated[i]);
13586
- hydrating ??= /* @__PURE__ */ new Set();
13587
- if (hydrating.has(i)) throw new Error("Invalid circular reference");
13588
- hydrating.add(i);
13589
- hydrated[index] = reviver(hydrate(i));
13590
- hydrating.delete(i);
13591
- return hydrated[index];
13592
- }
13593
- switch (type) {
13594
- case "Date":
13595
- hydrated[index] = ops.fromISOString(value[1]);
13596
- break;
13597
- case "Set":
13598
- const set = ops.createSet();
13599
- hydrated[index] = set;
13600
- for (let i = 1; i < value.length; i += 1) ops.addValue(set, hydrate(value[i]));
13601
- break;
13602
- case "Map":
13603
- const map = ops.createMap();
13604
- hydrated[index] = map;
13605
- for (let i = 1; i < value.length; i += 2) ops.addEntry(map, hydrate(value[i]), hydrate(value[i + 1]));
13606
- break;
13607
- case "RegExp":
13608
- hydrated[index] = ops.fromRegExpInfo(value[1], value[2]);
13609
- break;
13610
- case "Object": {
13611
- const wrapped_index = value[1];
13612
- if (!(wrapped_index === -3 || wrapped_index === -4 || wrapped_index === -5 || wrapped_index === -6)) {
13613
- const wrapped = get_raw(wrapped_index);
13614
- const is_bigint = Array.isArray(wrapped) && wrapped[0] === "BigInt";
13615
- if ((wrapped === void 0 || typeof wrapped === "object") && !is_bigint) invalid$1();
13616
- }
13617
- hydrated[index] = ops.box(hydrate(wrapped_index));
13618
- break;
13623
+ else if (Array.isArray(value)) {
13624
+ if (typeof value[0] === "string") {
13625
+ const type = value[0];
13626
+ const reviver = revivers && Object.hasOwn(revivers, type) ? revivers[type] : void 0;
13627
+ if (reviver) {
13628
+ let i = value[1];
13629
+ if (typeof i !== "number") i = values.push(value[1]) - 1;
13630
+ if (Object.hasOwn(hydrated, i)) return hydrated[index] = reviver(hydrated[i]);
13631
+ hydrating ??= /* @__PURE__ */ new Set();
13632
+ if (hydrating.has(i)) throw new Error("Invalid circular reference");
13633
+ hydrating.add(i);
13634
+ hydrated[index] = reviver(hydrate(i));
13635
+ hydrating.delete(i);
13636
+ return hydrated[index];
13619
13637
  }
13620
- case "BigInt":
13621
- hydrated[index] = ops.fromPrimitive(BigInt(value[1]));
13622
- break;
13623
- case "null":
13624
- const obj = ops.createNullPrototypeObject();
13625
- hydrated[index] = obj;
13626
- for (let i = 1; i < value.length; i += 2) {
13627
- const key = value[i];
13628
- if (typeof key !== "string") throw new Error("Cannot parse an object with a non-string key");
13629
- if (key === "__proto__") throw new Error("Cannot parse an object with a `__proto__` property");
13630
- ops.set(obj, key, hydrate(value[i + 1]));
13638
+ switch (type) {
13639
+ case "Date":
13640
+ hydrated[index] = ops.fromISOString(value[1]);
13641
+ break;
13642
+ case "Set":
13643
+ const set = ops.createSet();
13644
+ hydrated[index] = set;
13645
+ for (let i = 1; i < value.length; i += 1) ops.addValue(set, hydrate(value[i]));
13646
+ break;
13647
+ case "Map":
13648
+ const map = ops.createMap();
13649
+ hydrated[index] = map;
13650
+ for (let i = 1; i < value.length; i += 2) ops.addEntry(map, hydrate(value[i]), hydrate(value[i + 1]));
13651
+ break;
13652
+ case "RegExp":
13653
+ hydrated[index] = ops.fromRegExpInfo(value[1], value[2]);
13654
+ break;
13655
+ case "Object": {
13656
+ const wrapped_index = value[1];
13657
+ if (!(wrapped_index === -3 || wrapped_index === -4 || wrapped_index === -5 || wrapped_index === -6)) {
13658
+ const wrapped = get_raw(wrapped_index);
13659
+ const is_bigint = Array.isArray(wrapped) && wrapped[0] === "BigInt";
13660
+ if ((wrapped === void 0 || typeof wrapped === "object") && !is_bigint) invalid$1();
13661
+ }
13662
+ hydrated[index] = ops.box(hydrate(wrapped_index));
13663
+ break;
13631
13664
  }
13632
- break;
13633
- case "Int8Array":
13634
- case "Uint8Array":
13635
- case "Uint8ClampedArray":
13636
- case "Int16Array":
13637
- case "Uint16Array":
13638
- case "Float16Array":
13639
- case "Int32Array":
13640
- case "Uint32Array":
13641
- case "Float32Array":
13642
- case "Float64Array":
13643
- case "BigInt64Array":
13644
- case "BigUint64Array":
13645
- case "DataView": {
13646
- const buffer_index = value[1];
13647
- const raw = get_raw(buffer_index);
13648
- if (!Array.isArray(raw) || raw[0] !== "ArrayBuffer") invalid$1();
13649
- const buffer = hydrate(buffer_index);
13650
- hydrated[index] = ops.fromViewInfo(type, buffer, value[2], value[3]);
13651
- break;
13665
+ case "BigInt":
13666
+ hydrated[index] = ops.fromPrimitive(BigInt(value[1]));
13667
+ break;
13668
+ case "null":
13669
+ const obj = ops.createNullPrototypeObject();
13670
+ hydrated[index] = obj;
13671
+ for (let i = 1; i < value.length; i += 2) {
13672
+ const key = value[i];
13673
+ if (typeof key !== "string") throw new Error("Cannot parse an object with a non-string key");
13674
+ if (key === "__proto__") throw new Error("Cannot parse an object with a `__proto__` property");
13675
+ ops.set(obj, key, hydrate(value[i + 1]));
13676
+ }
13677
+ break;
13678
+ case "Int8Array":
13679
+ case "Uint8Array":
13680
+ case "Uint8ClampedArray":
13681
+ case "Int16Array":
13682
+ case "Uint16Array":
13683
+ case "Float16Array":
13684
+ case "Int32Array":
13685
+ case "Uint32Array":
13686
+ case "Float32Array":
13687
+ case "Float64Array":
13688
+ case "BigInt64Array":
13689
+ case "BigUint64Array":
13690
+ case "DataView": {
13691
+ const buffer_index = value[1];
13692
+ const raw = get_raw(buffer_index);
13693
+ if (!Array.isArray(raw) || raw[0] !== "ArrayBuffer") invalid$1();
13694
+ const buffer = hydrate(buffer_index);
13695
+ hydrated[index] = ops.fromViewInfo(type, buffer, value[2], value[3]);
13696
+ break;
13697
+ }
13698
+ case "ArrayBuffer": {
13699
+ const base64 = value[1];
13700
+ if (typeof base64 !== "string") throw new Error("Invalid ArrayBuffer encoding");
13701
+ hydrated[index] = ops.fromArrayBuffer(decode64(base64));
13702
+ break;
13703
+ }
13704
+ case "URL":
13705
+ case "URLSearchParams":
13706
+ case "Temporal.Duration":
13707
+ case "Temporal.Instant":
13708
+ case "Temporal.PlainDate":
13709
+ case "Temporal.PlainTime":
13710
+ case "Temporal.PlainDateTime":
13711
+ case "Temporal.PlainMonthDay":
13712
+ case "Temporal.PlainYearMonth":
13713
+ case "Temporal.ZonedDateTime":
13714
+ hydrated[index] = ops.fromStringValue(type, value[1]);
13715
+ break;
13716
+ default: throw new Error(`Unknown type ${type}`);
13652
13717
  }
13653
- case "ArrayBuffer": {
13654
- const base64 = value[1];
13655
- if (typeof base64 !== "string") throw new Error("Invalid ArrayBuffer encoding");
13656
- hydrated[index] = ops.fromArrayBuffer(decode64(base64));
13657
- break;
13718
+ } else if (value[0] === -7) {
13719
+ const len = value[1];
13720
+ if (!is_valid_array_len(len)) invalid$1();
13721
+ const array = ops.createSparseArray(len);
13722
+ hydrated[index] = array;
13723
+ for (let i = 2; i < value.length; i += 2) {
13724
+ const idx = value[i];
13725
+ if (!is_valid_array_index(idx) || idx >= len) invalid$1();
13726
+ ops.set(array, idx, hydrate(value[i + 1]));
13727
+ }
13728
+ } else {
13729
+ const array = ops.createArray(value.length);
13730
+ hydrated[index] = array;
13731
+ for (let i = 0; i < value.length; i += 1) {
13732
+ const n = value[i];
13733
+ if (n === -2) continue;
13734
+ ops.set(array, i, hydrate(n));
13658
13735
  }
13659
- case "URL":
13660
- case "URLSearchParams":
13661
- case "Temporal.Duration":
13662
- case "Temporal.Instant":
13663
- case "Temporal.PlainDate":
13664
- case "Temporal.PlainTime":
13665
- case "Temporal.PlainDateTime":
13666
- case "Temporal.PlainMonthDay":
13667
- case "Temporal.PlainYearMonth":
13668
- case "Temporal.ZonedDateTime":
13669
- hydrated[index] = ops.fromStringValue(type, value[1]);
13670
- break;
13671
- default: throw new Error(`Unknown type ${type}`);
13672
- }
13673
- } else if (value[0] === -7) {
13674
- const len = value[1];
13675
- if (!is_valid_array_len(len)) invalid$1();
13676
- const array = ops.createSparseArray(len);
13677
- hydrated[index] = array;
13678
- for (let i = 2; i < value.length; i += 2) {
13679
- const idx = value[i];
13680
- if (!is_valid_array_index(idx) || idx >= len) invalid$1();
13681
- ops.set(array, idx, hydrate(value[i + 1]));
13682
13736
  }
13683
13737
  } else {
13684
- const array = ops.createArray(value.length);
13685
- hydrated[index] = array;
13686
- for (let i = 0; i < value.length; i += 1) {
13687
- const n = value[i];
13688
- if (n === -2) continue;
13689
- ops.set(array, i, hydrate(n));
13690
- }
13691
- }
13692
- else {
13693
13738
  const object = ops.createObject();
13694
13739
  hydrated[index] = object;
13695
13740
  for (const key of Object.keys(value)) {
@@ -14527,7 +14572,7 @@ function decodeQuietly(encoded) {
14527
14572
  */
14528
14573
  function checkSaveExport(value) {
14529
14574
  if (!isRecord(value)) throw new Error(INVALID_FILE);
14530
- if (!hasOwn(value, "formatVersion")) throw value.version === 1 ? new IncompatibleSaveError() : new Error(INVALID_FILE);
14575
+ if (!hasOwn(value, "formatVersion")) throw value.version === 1 ? new IncompatibleSaveError() : /* @__PURE__ */ new Error(INVALID_FILE);
14531
14576
  checkFormatVersion(value.formatVersion);
14532
14577
  if (typeof value.ifid !== "string") throw new Error(INVALID_FILE);
14533
14578
  const save = value.save;
@@ -15169,7 +15214,7 @@ function loosePairs() {
15169
15214
  const pairs = assumed.get(a);
15170
15215
  if (pairs?.has(b)) return true;
15171
15216
  if (pairs) pairs.add(b);
15172
- else assumed.set(a, new Set([b]));
15217
+ else assumed.set(a, /* @__PURE__ */ new Set([b]));
15173
15218
  };
15174
15219
  }
15175
15220
  /**
@@ -15302,7 +15347,7 @@ function equalKeys(a, b, assumed, keysOf = Object.keys) {
15302
15347
  return true;
15303
15348
  }
15304
15349
  /** Built-in prototypes (see builtinLike), whose instances hold no extra keys. */
15305
- var BUILTIN_PROTOS = new Set([
15350
+ var BUILTIN_PROTOS = /* @__PURE__ */ new Set([
15306
15351
  Array.prototype,
15307
15352
  Map.prototype,
15308
15353
  Set.prototype,
@@ -15762,7 +15807,7 @@ function applyChange(target, change) {
15762
15807
  }
15763
15808
  //#endregion
15764
15809
  //#region src/event-emitter.ts
15765
- var VALID_EVENTS = new Set([
15810
+ var VALID_EVENTS = /* @__PURE__ */ new Set([
15766
15811
  "storyinit",
15767
15812
  "beforerestart",
15768
15813
  "actionsChanged",
@@ -16312,7 +16357,6 @@ function quickSave$1(ifid, playthroughId, payload, slot, custom) {
16312
16357
  return record;
16313
16358
  });
16314
16359
  }
16315
- queued(hasQuickSaveNow);
16316
16360
  async function hasQuickSaveNow(ifid, slot) {
16317
16361
  return await slotRecord(ifid, slot) !== void 0;
16318
16362
  }
@@ -16797,7 +16841,7 @@ function changeTo(ns, path) {
16797
16841
  * replaces exactly what it replaced in program order.
16798
16842
  */
16799
16843
  function writtenPaths(before, after, patches) {
16800
- if (patches.some((p) => p.path.length === 1)) return [...new Set([...Object.keys(before), ...Object.keys(after)])].filter((root) => !hasOwn(before, root) || before[root] !== after[root]).map((root) => changeTo(after, [root]));
16844
+ if (patches.some((p) => p.path.length === 1)) return [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])].filter((root) => !hasOwn(before, root) || before[root] !== after[root]).map((root) => changeTo(after, [root]));
16801
16845
  const seen = /* @__PURE__ */ new Set();
16802
16846
  const changes = [];
16803
16847
  for (const patch of patches) {
@@ -17379,7 +17423,7 @@ function isDialogShowing() {
17379
17423
  //#region src/store.ts
17380
17424
  enablePatches();
17381
17425
  enableMapSet();
17382
- var SPECIAL_PASSAGES = new Set([
17426
+ var SPECIAL_PASSAGES = /* @__PURE__ */ new Set([
17383
17427
  "StoryInit",
17384
17428
  "StoryInterface",
17385
17429
  "StoryVariables",
@@ -17510,12 +17554,14 @@ function persistSession(get) {
17510
17554
  const { storyData, currentPassage, variables, history, historyIndex, visitCounts, renderCounts } = get();
17511
17555
  if (!storyData) return void 0;
17512
17556
  if (sessionMoments.length > history.length) sessionMoments.length = history.length;
17513
- if (sessionMoments.length < history.length) if (history.length - sessionMoments.length === 1) {
17514
- const i = history.length - 1;
17515
- sessionMoments[i] = savedMoment(history[i], variables);
17516
- } else forEachRecorded(history.length, (vars, i) => {
17517
- if (i >= sessionMoments.length) sessionMoments[i] = savedMoment(history[i], vars);
17518
- });
17557
+ if (sessionMoments.length < history.length) {
17558
+ if (history.length - sessionMoments.length === 1) {
17559
+ const i = history.length - 1;
17560
+ sessionMoments[i] = savedMoment(history[i], variables);
17561
+ } else forEachRecorded(history.length, (vars, i) => {
17562
+ if (i >= sessionMoments.length) sessionMoments[i] = savedMoment(history[i], vars);
17563
+ });
17564
+ }
17519
17565
  return saveSession(storyData.ifid, {
17520
17566
  passage: currentPassage,
17521
17567
  variables,
@@ -17933,9 +17979,10 @@ function writeKey(holder, key, value, change) {
17933
17979
  const deleted = change?.deleted ?? false;
17934
17980
  if (Array.isArray(holder)) {
17935
17981
  const index = Number(key);
17936
- if (deleted) if (change && "hole" in change) delete holder[index];
17937
- else holder.length = Math.min(holder.length, index);
17938
- else if (change && "appended" in change) {
17982
+ if (deleted) {
17983
+ if (change && "hole" in change) delete holder[index];
17984
+ else holder.length = Math.min(holder.length, index);
17985
+ } else if (change && "appended" in change) {
17939
17986
  holder.length += change.gap ?? 0;
17940
17987
  holder.push(value);
17941
17988
  } else if (key === "length" && change) holder.length += value;
@@ -18504,7 +18551,8 @@ function StoryInterface() {
18504
18551
  const nobr = overridePassage?.tags.includes("nobr") ?? false;
18505
18552
  const rendered = useMemo(() => {
18506
18553
  try {
18507
- return /* @__PURE__ */ jsx(Fragment$1, { children: renderInlineNodes(parseMarkup(markup)) });
18554
+ const ast = parseMarkup(markup);
18555
+ return /* @__PURE__ */ jsx(Fragment$1, { children: renderInlineNodes(ast) });
18508
18556
  } catch (err) {
18509
18557
  return /* @__PURE__ */ jsxs("span", {
18510
18558
  class: "error",
@@ -18613,7 +18661,7 @@ var openModals = [];
18613
18661
  * - returns focus to the previously focused element on close.
18614
18662
  */
18615
18663
  /** The input types made of several segments, each a native Tab stop. */
18616
- var SEGMENTED_INPUTS = new Set([
18664
+ var SEGMENTED_INPUTS = /* @__PURE__ */ new Set([
18617
18665
  "date",
18618
18666
  "time",
18619
18667
  "datetime-local",
@@ -19011,7 +19059,7 @@ function App() {
19011
19059
  //#region src/parser.ts
19012
19060
  var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
19013
19061
  /** HTML elements written without content or end tag, as innerHTML does. */
19014
- var VOID_ELEMENTS = new Set([
19062
+ var VOID_ELEMENTS = /* @__PURE__ */ new Set([
19015
19063
  "area",
19016
19064
  "base",
19017
19065
  "basefont",
@@ -19127,7 +19175,7 @@ function parseStoryData() {
19127
19175
  const tags = (el.getAttribute("tags") || "").split(/\s+/).filter((t) => t.length > 0);
19128
19176
  const content = passageMarkup(el);
19129
19177
  const metadata = {};
19130
- const skipAttrs = new Set([
19178
+ const skipAttrs = /* @__PURE__ */ new Set([
19131
19179
  "pid",
19132
19180
  "name",
19133
19181
  "tags"
@@ -19906,14 +19954,14 @@ function installStoryAPI() {
19906
19954
  * Passages that hold no markup: declarations, and the JavaScript function
19907
19955
  * body of SaveTitle.
19908
19956
  */
19909
- var NOT_MARKUP = new Set([
19957
+ var NOT_MARKUP = /* @__PURE__ */ new Set([
19910
19958
  "StoryVariables",
19911
19959
  "StoryTransients",
19912
19960
  "SaveTitle"
19913
19961
  ]);
19914
19962
  var NOT_MARKUP_TAGS = ["script", "stylesheet"];
19915
19963
  /** Branch macros, which their parent macro renders. */
19916
- var BRANCH_MACROS = new Set([
19964
+ var BRANCH_MACROS = /* @__PURE__ */ new Set([
19917
19965
  "elseif",
19918
19966
  "else",
19919
19967
  "case",
@@ -20352,7 +20400,7 @@ function declarationRegex(sigil) {
20352
20400
  var VAR_PATH_RE = /([$%])(\w+(?:\.\w+)*)/y;
20353
20401
  /** Quoted first argument of an input macro naming a story variable. */
20354
20402
  var QUOTED_VAR_ARG_RE = /^["']\$(\w+(?:\.\w+)*)["']?$/;
20355
- var VALID_VAR_TYPES = new Set([
20403
+ var VALID_VAR_TYPES = /* @__PURE__ */ new Set([
20356
20404
  "number",
20357
20405
  "string",
20358
20406
  "boolean"
@@ -20808,7 +20856,7 @@ function renderSpecialPassage(passage) {
20808
20856
  return null;
20809
20857
  }
20810
20858
  }
20811
- var CODE_PASSAGES = new Set([
20859
+ var CODE_PASSAGES = /* @__PURE__ */ new Set([
20812
20860
  "PassageReady",
20813
20861
  "PassageHeader",
20814
20862
  "PassageFooter",
@@ -20885,7 +20933,7 @@ function Passage({ passage, dataTransition, navigationId }) {
20885
20933
  }
20886
20934
  //#endregion
20887
20935
  //#region src/transition.ts
20888
- var TRANSITION_TYPES = new Set([
20936
+ var TRANSITION_TYPES = /* @__PURE__ */ new Set([
20889
20937
  "none",
20890
20938
  "fade",
20891
20939
  "fade-through",
@@ -21107,19 +21155,21 @@ defineMacro({
21107
21155
  setDisplayedPassage(currentPassage);
21108
21156
  }, incomingDelay);
21109
21157
  const cleanupDelay = incomingDelay + config.duration;
21110
- timeoutsRef.current = [t1, setTimeout(() => {
21158
+ const t2 = setTimeout(() => {
21111
21159
  cleanupSnapshots(containerEl);
21112
21160
  if (scrollAfterCleanup.current) scrollToPassageStart(containerEl);
21113
21161
  scrollAfterCleanup.current = false;
21114
- }, cleanupDelay)];
21162
+ }, cleanupDelay);
21163
+ timeoutsRef.current = [t1, t2];
21115
21164
  return;
21116
21165
  }
21117
21166
  containerEl.classList.add("passage-container--crossfading");
21118
21167
  containerEl.appendChild(snapshot);
21119
21168
  setDisplayedPassage(currentPassage);
21120
- timeoutsRef.current = [setTimeout(() => {
21169
+ const t1 = setTimeout(() => {
21121
21170
  cleanupSnapshots(containerEl);
21122
- }, config.duration)];
21171
+ }, config.duration);
21172
+ timeoutsRef.current = [t1];
21123
21173
  }, [navigationId]);
21124
21174
  const shownId = displayedPassage && !renderDeferred ? displayed.id : null;
21125
21175
  const lastShownId = useRef(shownId);
@@ -21557,18 +21607,19 @@ function loopArgs(rawArgs, args) {
21557
21607
  };
21558
21608
  }
21559
21609
  function ForIteration({ parentValues, itemVar, itemValue, indexVar, indexValue, children }) {
21610
+ const ownKeys = useMemo(() => ({
21611
+ [itemVar]: itemValue,
21612
+ ...indexVar ? { [indexVar]: indexValue } : void 0
21613
+ }), [
21614
+ itemVar,
21615
+ itemValue,
21616
+ indexVar,
21617
+ indexValue
21618
+ ]);
21560
21619
  return /* @__PURE__ */ jsx(LocalsScope, {
21561
21620
  body: children,
21562
21621
  parentValues,
21563
- ownKeys: useMemo(() => ({
21564
- [itemVar]: itemValue,
21565
- ...indexVar ? { [indexVar]: indexValue } : void 0
21566
- }), [
21567
- itemVar,
21568
- itemValue,
21569
- indexVar,
21570
- indexValue
21571
- ])
21622
+ ownKeys
21572
21623
  });
21573
21624
  }
21574
21625
  defineMacro({
@@ -22094,7 +22145,10 @@ defineMacro({
22094
22145
  const visibleCharsRef = useRef(0);
22095
22146
  visibleCharsRef.current = visibleChars;
22096
22147
  useEffect(() => {
22097
- if (containerRef.current) setMeasured((containerRef.current.textContent || "").length);
22148
+ if (containerRef.current) {
22149
+ const text = containerRef.current.textContent || "";
22150
+ setMeasured(text.length);
22151
+ }
22098
22152
  });
22099
22153
  useEffect(() => {
22100
22154
  if (totalChars === 0) return;
@@ -22403,8 +22457,8 @@ function SaveManagerContent() {
22403
22457
  }
22404
22458
  }, [renamingId]);
22405
22459
  const mounted = useRef(true);
22406
- const statusTimer = useRef();
22407
- const closeTimer = useRef();
22460
+ const statusTimer = useRef(void 0);
22461
+ const closeTimer = useRef(void 0);
22408
22462
  const showStatus = (text, type = "success") => {
22409
22463
  if (!mounted.current) return;
22410
22464
  clearTimeout(statusTimer.current);