jssm 5.141.5 → 5.141.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cdn/viz.js CHANGED
@@ -351,7 +351,7 @@ function peg$parse(input, options) {
351
351
  var peg$FAILED = {}, peg$startRuleFunctions = { Document: peg$parseDocument }, peg$startRuleFunction = peg$parseDocument, peg$c0 = function (e) { return e; }, peg$c1 = "default", peg$c2 = peg$literalExpectation("default", false), peg$c3 = "ocean", peg$c4 = peg$literalExpectation("ocean", false), peg$c5 = "modern", peg$c6 = peg$literalExpectation("modern", false), peg$c7 = "plain", peg$c8 = peg$literalExpectation("plain", false), peg$c9 = "bold", peg$c10 = peg$literalExpectation("bold", false), peg$c11 = "[", peg$c12 = peg$literalExpectation("[", false), peg$c13 = "]", peg$c14 = peg$literalExpectation("]", false), peg$c15 = function (ths, th) { const themes = ths.map(t => t[0]); if (th)
352
352
  themes.push(th); return themes; }, peg$c16 = function (th) { return [th]; }, peg$c17 = "box3d", peg$c18 = peg$literalExpectation("box3d", false), peg$c19 = "polygon", peg$c20 = peg$literalExpectation("polygon", false), peg$c21 = "ellipse", peg$c22 = peg$literalExpectation("ellipse", false), peg$c23 = "oval", peg$c24 = peg$literalExpectation("oval", false), peg$c25 = "circle", peg$c26 = peg$literalExpectation("circle", false), peg$c27 = "point", peg$c28 = peg$literalExpectation("point", false), peg$c29 = "egg", peg$c30 = peg$literalExpectation("egg", false), peg$c31 = "triangle", peg$c32 = peg$literalExpectation("triangle", false), peg$c33 = "plaintext", peg$c34 = peg$literalExpectation("plaintext", false), peg$c35 = "diamond", peg$c36 = peg$literalExpectation("diamond", false), peg$c37 = "trapezium", peg$c38 = peg$literalExpectation("trapezium", false), peg$c39 = "parallelogram", peg$c40 = peg$literalExpectation("parallelogram", false), peg$c41 = "house", peg$c42 = peg$literalExpectation("house", false), peg$c43 = "pentagon", peg$c44 = peg$literalExpectation("pentagon", false), peg$c45 = "hexagon", peg$c46 = peg$literalExpectation("hexagon", false), peg$c47 = "septagon", peg$c48 = peg$literalExpectation("septagon", false), peg$c49 = "octagon", peg$c50 = peg$literalExpectation("octagon", false), peg$c51 = "doublecircle", peg$c52 = peg$literalExpectation("doublecircle", false), peg$c53 = "doubleoctagon", peg$c54 = peg$literalExpectation("doubleoctagon", false), peg$c55 = "tripleoctagon", peg$c56 = peg$literalExpectation("tripleoctagon", false), peg$c57 = "invtriangle", peg$c58 = peg$literalExpectation("invtriangle", false), peg$c59 = "invtrapezium", peg$c60 = peg$literalExpectation("invtrapezium", false), peg$c61 = "invhouse", peg$c62 = peg$literalExpectation("invhouse", false), peg$c63 = "Mdiamond", peg$c64 = peg$literalExpectation("Mdiamond", false), peg$c65 = "Msquare", peg$c66 = peg$literalExpectation("Msquare", false), peg$c67 = "Mcircle", peg$c68 = peg$literalExpectation("Mcircle", false), peg$c69 = "rectangle", peg$c70 = peg$literalExpectation("rectangle", false), peg$c71 = "rect", peg$c72 = peg$literalExpectation("rect", false), peg$c73 = "square", peg$c74 = peg$literalExpectation("square", false), peg$c75 = "star", peg$c76 = peg$literalExpectation("star", false), peg$c77 = "none", peg$c78 = peg$literalExpectation("none", false), peg$c79 = "underline", peg$c80 = peg$literalExpectation("underline", false), peg$c81 = "cylinder", peg$c82 = peg$literalExpectation("cylinder", false), peg$c83 = "note", peg$c84 = peg$literalExpectation("note", false), peg$c85 = "tab", peg$c86 = peg$literalExpectation("tab", false), peg$c87 = "folder", peg$c88 = peg$literalExpectation("folder", false), peg$c89 = "box", peg$c90 = peg$literalExpectation("box", false), peg$c91 = "component", peg$c92 = peg$literalExpectation("component", false), peg$c93 = "promoter", peg$c94 = peg$literalExpectation("promoter", false), peg$c95 = "cds", peg$c96 = peg$literalExpectation("cds", false), peg$c97 = "terminator", peg$c98 = peg$literalExpectation("terminator", false), peg$c99 = "utr", peg$c100 = peg$literalExpectation("utr", false), peg$c101 = "primersite", peg$c102 = peg$literalExpectation("primersite", false), peg$c103 = "restrictionsite", peg$c104 = peg$literalExpectation("restrictionsite", false), peg$c105 = "fivepoverhang", peg$c106 = peg$literalExpectation("fivepoverhang", false), peg$c107 = "threepoverhang", peg$c108 = peg$literalExpectation("threepoverhang", false), peg$c109 = "noverhang", peg$c110 = peg$literalExpectation("noverhang", false), peg$c111 = "assembly", peg$c112 = peg$literalExpectation("assembly", false), peg$c113 = "signature", peg$c114 = peg$literalExpectation("signature", false), peg$c115 = "insulator", peg$c116 = peg$literalExpectation("insulator", false), peg$c117 = "ribosite", peg$c118 = peg$literalExpectation("ribosite", false), peg$c119 = "rnastab", peg$c120 = peg$literalExpectation("rnastab", false), peg$c121 = "proteasesite", peg$c122 = peg$literalExpectation("proteasesite", false), peg$c123 = "proteinstab", peg$c124 = peg$literalExpectation("proteinstab", false), peg$c125 = "rpromoter", peg$c126 = peg$literalExpectation("rpromoter", false), peg$c127 = "rarrow", peg$c128 = peg$literalExpectation("rarrow", false), peg$c129 = "larrow", peg$c130 = peg$literalExpectation("larrow", false), peg$c131 = "lpromoter", peg$c132 = peg$literalExpectation("lpromoter", false), peg$c133 = "record", peg$c134 = peg$literalExpectation("record", false), peg$c135 = peg$otherExpectation("forward light arrow ->"), peg$c136 = "->", peg$c137 = peg$literalExpectation("->", false), peg$c138 = "\u2192", peg$c139 = peg$literalExpectation("\u2192", false), peg$c140 = function () { return "->"; }, peg$c141 = peg$otherExpectation("two way light arrow <->"), peg$c142 = "<->", peg$c143 = peg$literalExpectation("<->", false), peg$c144 = "\u2194", peg$c145 = peg$literalExpectation("\u2194", false), peg$c146 = function () { return "<->"; }, peg$c147 = peg$otherExpectation("back light arrow <-"), peg$c148 = "<-", peg$c149 = peg$literalExpectation("<-", false), peg$c150 = "\u2190", peg$c151 = peg$literalExpectation("\u2190", false), peg$c152 = function () { return "<-"; }, peg$c153 = peg$otherExpectation("forward fat arrow =>"), peg$c154 = "=>", peg$c155 = peg$literalExpectation("=>", false), peg$c156 = "\u21D2", peg$c157 = peg$literalExpectation("\u21D2", false), peg$c158 = function () { return "=>"; }, peg$c159 = peg$otherExpectation("two way fat arrow <=>"), peg$c160 = "<=>", peg$c161 = peg$literalExpectation("<=>", false), peg$c162 = "\u21D4", peg$c163 = peg$literalExpectation("\u21D4", false), peg$c164 = function () { return "<=>"; }, peg$c165 = peg$otherExpectation("back fat arrow <="), peg$c166 = "<=", peg$c167 = peg$literalExpectation("<=", false), peg$c168 = "\u21D0", peg$c169 = peg$literalExpectation("\u21D0", false), peg$c170 = function () { return "<="; }, peg$c171 = peg$otherExpectation("forward tilde arrow ~>"), peg$c172 = "~>", peg$c173 = peg$literalExpectation("~>", false), peg$c174 = "\u219B", peg$c175 = peg$literalExpectation("\u219B", false), peg$c176 = function () { return "~>"; }, peg$c177 = peg$otherExpectation("two way tilde arrow <~>"), peg$c178 = "<~>", peg$c179 = peg$literalExpectation("<~>", false), peg$c180 = "\u21AE", peg$c181 = peg$literalExpectation("\u21AE", false), peg$c182 = function () { return "<~>"; }, peg$c183 = peg$otherExpectation("back tilde arrow <~"), peg$c184 = "<~", peg$c185 = peg$literalExpectation("<~", false), peg$c186 = "\u219A", peg$c187 = peg$literalExpectation("\u219A", false), peg$c188 = function () { return "<~"; }, peg$c189 = peg$otherExpectation("light fat arrow <-=>"), peg$c190 = "<-=>", peg$c191 = peg$literalExpectation("<-=>", false), peg$c192 = "\u2190\u21D2", peg$c193 = peg$literalExpectation("\u2190\u21D2", false), peg$c194 = function () { return "<-=>"; }, peg$c195 = peg$otherExpectation("light tilde arrow <-~>"), peg$c196 = "<-~>", peg$c197 = peg$literalExpectation("<-~>", false), peg$c198 = "\u2190\u219B", peg$c199 = peg$literalExpectation("\u2190\u219B", false), peg$c200 = function () { return "<-~>"; }, peg$c201 = peg$otherExpectation("fat light arrow <=->"), peg$c202 = "<=->", peg$c203 = peg$literalExpectation("<=->", false), peg$c204 = "\u21D0\u2192", peg$c205 = peg$literalExpectation("\u21D0\u2192", false), peg$c206 = function () { return "<=->"; }, peg$c207 = peg$otherExpectation("fat tilde arrow <=~>"), peg$c208 = "<=~>", peg$c209 = peg$literalExpectation("<=~>", false), peg$c210 = "\u21D0\u219B", peg$c211 = peg$literalExpectation("\u21D0\u219B", false), peg$c212 = function () { return "<=~>"; }, peg$c213 = peg$otherExpectation("tilde light arrow <~->"), peg$c214 = "<~->", peg$c215 = peg$literalExpectation("<~->", false), peg$c216 = "\u219A\u2192", peg$c217 = peg$literalExpectation("\u219A\u2192", false), peg$c218 = function () { return "<~->"; }, peg$c219 = peg$otherExpectation("tilde fat arrow <~=>"), peg$c220 = "<~=>", peg$c221 = peg$literalExpectation("<~=>", false), peg$c222 = "\u219A\u21D2", peg$c223 = peg$literalExpectation("\u219A\u21D2", false), peg$c224 = function () { return "<~=>"; }, peg$c225 = peg$otherExpectation("light arrow"), peg$c226 = peg$otherExpectation("fat arrow"), peg$c227 = peg$otherExpectation("tilde arrow"), peg$c228 = peg$otherExpectation("mixed arrow"), peg$c229 = peg$otherExpectation("arrow"), peg$c230 = "true", peg$c231 = peg$literalExpectation("true", false), peg$c232 = function () { return true; }, peg$c233 = "false", peg$c234 = peg$literalExpectation("false", false), peg$c235 = function () { return false; }, peg$c236 = "regular", peg$c237 = peg$literalExpectation("regular", false), peg$c238 = "rounded", peg$c239 = peg$literalExpectation("rounded", false), peg$c240 = "lined", peg$c241 = peg$literalExpectation("lined", false), peg$c242 = "solid", peg$c243 = peg$literalExpectation("solid", false), peg$c244 = "dotted", peg$c245 = peg$literalExpectation("dotted", false), peg$c246 = "dashed", peg$c247 = peg$literalExpectation("dashed", false), peg$c248 = "\"", peg$c249 = peg$literalExpectation("\"", false), peg$c250 = "\\", peg$c251 = peg$literalExpectation("\\", false), peg$c252 = "/", peg$c253 = peg$literalExpectation("/", false), peg$c254 = "b", peg$c255 = peg$literalExpectation("b", false), peg$c256 = function () { return "\b"; }, peg$c257 = "f", peg$c258 = peg$literalExpectation("f", false), peg$c259 = function () { return "\f"; }, peg$c260 = "n", peg$c261 = peg$literalExpectation("n", false), peg$c262 = function () { return "\n"; }, peg$c263 = "r", peg$c264 = peg$literalExpectation("r", false), peg$c265 = function () { return "\r"; }, peg$c266 = "t", peg$c267 = peg$literalExpectation("t", false), peg$c268 = function () { return "\t"; }, peg$c269 = "v", peg$c270 = peg$literalExpectation("v", false), peg$c271 = function () { return "\v"; }, peg$c272 = "u", peg$c273 = peg$literalExpectation("u", false), peg$c274 = function (digits) {
353
353
  return String.fromCharCode(parseInt(digits, 16));
354
- }, peg$c275 = function (Sequence) { return Sequence; }, peg$c276 = "null", peg$c277 = peg$literalExpectation("null", false), peg$c278 = function () { return null; }, peg$c279 = "undefined", peg$c280 = peg$literalExpectation("undefined", false), peg$c281 = function () { return undefined; }, peg$c282 = /^[\0-!#-[\]-\uFFFF]/, peg$c283 = peg$classExpectation([["\0", "!"], ["#", "["], ["]", "\uFFFF"]], false, false), peg$c284 = "'", peg$c285 = peg$literalExpectation("'", false), peg$c286 = /^[ -&(-[\]-\uFFFF]/, peg$c287 = peg$classExpectation([[" ", "&"], ["(", "["], ["]", "\uFFFF"]], false, false), peg$c288 = peg$otherExpectation("action label"), peg$c289 = function (chars) { return chars.join(""); }, peg$c290 = /^[\n\r\u2028\u2029]/, peg$c291 = peg$classExpectation(["\n", "\r", "\u2028", "\u2029"], false, false), peg$c292 = "*/", peg$c293 = peg$literalExpectation("*/", false), peg$c294 = peg$anyExpectation(), peg$c295 = peg$otherExpectation("block comment"), peg$c296 = "/*", peg$c297 = peg$literalExpectation("/*", false), peg$c298 = peg$otherExpectation("line comment"), peg$c299 = "//", peg$c300 = peg$literalExpectation("//", false), peg$c301 = peg$otherExpectation("whitespace"), peg$c302 = /^[ \t\r\n\x0B]/, peg$c303 = peg$classExpectation([" ", "\t", "\r", "\n", "\x0B"], false, false), peg$c304 = peg$otherExpectation("string"), peg$c305 = /^[0-9a-zA-Z._!$\^*!?,\x80-\uFFFF]/, peg$c306 = peg$classExpectation([["0", "9"], ["a", "z"], ["A", "Z"], ".", "_", "!", "$", "^", "*", "!", "?", ",", ["\x80", "\uFFFF"]], false, false), peg$c307 = /^[0-9a-zA-Z.+_\^()*&$#@!?,\x80-\uFFFF]/, peg$c308 = peg$classExpectation([["0", "9"], ["a", "z"], ["A", "Z"], ".", "+", "_", "^", "(", ")", "*", "&", "$", "#", "@", "!", "?", ",", ["\x80", "\uFFFF"]], false, false), peg$c309 = peg$otherExpectation("atom"), peg$c310 = function (firstletter, text) {
354
+ }, peg$c275 = function (Sequence) { return Sequence; }, peg$c276 = "null", peg$c277 = peg$literalExpectation("null", false), peg$c278 = function () { return null; }, peg$c279 = "undefined", peg$c280 = peg$literalExpectation("undefined", false), peg$c281 = function () { return undefined; }, peg$c282 = /^[\0-!#-[\]-\uFFFF]/, peg$c283 = peg$classExpectation([["\0", "!"], ["#", "["], ["]", "\uFFFF"]], false, false), peg$c284 = "'", peg$c285 = peg$literalExpectation("'", false), peg$c286 = /^[ -&(-[\]-\uFFFF]/, peg$c287 = peg$classExpectation([[" ", "&"], ["(", "["], ["]", "\uFFFF"]], false, false), peg$c288 = peg$otherExpectation("action label"), peg$c289 = function (chars) { return chars.join(""); }, peg$c290 = /^[\n\r\u2028\u2029]/, peg$c291 = peg$classExpectation(["\n", "\r", "\u2028", "\u2029"], false, false), peg$c292 = peg$otherExpectation("block comment"), peg$c293 = "/*", peg$c294 = peg$literalExpectation("/*", false), peg$c295 = "*/", peg$c296 = peg$literalExpectation("*/", false), peg$c297 = peg$anyExpectation(), peg$c298 = peg$otherExpectation("line comment"), peg$c299 = "//", peg$c300 = peg$literalExpectation("//", false), peg$c301 = peg$otherExpectation("whitespace"), peg$c302 = /^[ \t\r\n\x0B]/, peg$c303 = peg$classExpectation([" ", "\t", "\r", "\n", "\x0B"], false, false), peg$c304 = peg$otherExpectation("string"), peg$c305 = /^[0-9a-zA-Z._!$\^*!?,\x80-\uFFFF]/, peg$c306 = peg$classExpectation([["0", "9"], ["a", "z"], ["A", "Z"], ".", "_", "!", "$", "^", "*", "!", "?", ",", ["\x80", "\uFFFF"]], false, false), peg$c307 = /^[0-9a-zA-Z.+_\^()*&$#@!?,\x80-\uFFFF]/, peg$c308 = peg$classExpectation([["0", "9"], ["a", "z"], ["A", "Z"], ".", "+", "_", "^", "(", ")", "*", "&", "$", "#", "@", "!", "?", ",", ["\x80", "\uFFFF"]], false, false), peg$c309 = peg$otherExpectation("atom"), peg$c310 = function (firstletter, text) {
355
355
  return firstletter + ((text || []).join(''));
356
356
  }, peg$c311 = peg$otherExpectation("label"), peg$c312 = "0", peg$c313 = peg$literalExpectation("0", false), peg$c314 = /^[0-9]/, peg$c315 = peg$classExpectation([["0", "9"]], false, false), peg$c316 = /^[1-9]/, peg$c317 = peg$classExpectation([["1", "9"]], false, false), peg$c318 = /^[0-9a-f]/i, peg$c319 = peg$classExpectation([["0", "9"], ["a", "f"]], false, true), peg$c320 = /^[0-1]/, peg$c321 = peg$classExpectation([["0", "1"]], false, false), peg$c322 = /^[0-7]/, peg$c323 = peg$classExpectation([["0", "7"]], false, false), peg$c324 = peg$otherExpectation("nonneg number"), peg$c325 = ".", peg$c326 = peg$literalExpectation(".", false), peg$c327 = function () { return parseFloat(text()); }, peg$c328 = peg$otherExpectation("number"), peg$c329 = function (literal) { return literal; }, peg$c330 = "NaN", peg$c331 = peg$literalExpectation("NaN", false), peg$c332 = function () { return NaN; }, peg$c333 = "NegativeInfinity", peg$c334 = peg$literalExpectation("NegativeInfinity", false), peg$c335 = function () { return Number.NEGATIVE_INFINITY; }, peg$c336 = "NegativeInf", peg$c337 = peg$literalExpectation("NegativeInf", false), peg$c338 = "NegInfinity", peg$c339 = peg$literalExpectation("NegInfinity", false), peg$c340 = "NegInf", peg$c341 = peg$literalExpectation("NegInf", false), peg$c342 = "NInfinity", peg$c343 = peg$literalExpectation("NInfinity", false), peg$c344 = "NInf", peg$c345 = peg$literalExpectation("NInf", false), peg$c346 = "-\u221E", peg$c347 = peg$literalExpectation("-\u221E", false), peg$c348 = "PInfinity", peg$c349 = peg$literalExpectation("PInfinity", false), peg$c350 = function () { return Number.POSITIVE_INFINITY; }, peg$c351 = "Infinity", peg$c352 = peg$literalExpectation("Infinity", false), peg$c353 = "PInf", peg$c354 = peg$literalExpectation("PInf", false), peg$c355 = "Inf", peg$c356 = peg$literalExpectation("Inf", false), peg$c357 = "\u221E", peg$c358 = peg$literalExpectation("\u221E", false), peg$c359 = "Epsilon", peg$c360 = peg$literalExpectation("Epsilon", false), peg$c361 = function () { return Number.EPSILON; }, peg$c362 = "\uD835\uDF00", peg$c363 = peg$literalExpectation("\uD835\uDF00", false), peg$c364 = "\u03B5", peg$c365 = peg$literalExpectation("\u03B5", false), peg$c366 = "Pi", peg$c367 = peg$literalExpectation("Pi", false), peg$c368 = function () { return Math.PI; }, peg$c369 = "\uD835\uDF0B", peg$c370 = peg$literalExpectation("\uD835\uDF0B", false), peg$c371 = "\u03C0", peg$c372 = peg$literalExpectation("\u03C0", false), peg$c373 = "EulerNumber", peg$c374 = peg$literalExpectation("EulerNumber", false), peg$c375 = function () { return Math.E; }, peg$c376 = "E", peg$c377 = peg$literalExpectation("E", false), peg$c378 = "e", peg$c379 = peg$literalExpectation("e", false), peg$c380 = "\u0190", peg$c381 = peg$literalExpectation("\u0190", false), peg$c382 = "\u2107", peg$c383 = peg$literalExpectation("\u2107", false), peg$c384 = "Root2", peg$c385 = peg$literalExpectation("Root2", false), peg$c386 = function () { return Math.SQRT2; }, peg$c387 = "RootHalf", peg$c388 = peg$literalExpectation("RootHalf", false), peg$c389 = function () { return Math.SQRT1_2; }, peg$c390 = "Ln2", peg$c391 = peg$literalExpectation("Ln2", false), peg$c392 = function () { return Math.LN2; }, peg$c393 = "NatLog2", peg$c394 = peg$literalExpectation("NatLog2", false), peg$c395 = "Ln10", peg$c396 = peg$literalExpectation("Ln10", false), peg$c397 = function () { return Math.LN10; }, peg$c398 = "NatLog10", peg$c399 = peg$literalExpectation("NatLog10", false), peg$c400 = "Log2E", peg$c401 = peg$literalExpectation("Log2E", false), peg$c402 = function () { return Math.LOG2E; }, peg$c403 = "Log10E", peg$c404 = peg$literalExpectation("Log10E", false), peg$c405 = function () { return Math.LOG10E; }, peg$c406 = "MaxSafeInt", peg$c407 = peg$literalExpectation("MaxSafeInt", false), peg$c408 = function () { return Number.MAX_SAFE_INTEGER; }, peg$c409 = "MinSafeInt", peg$c410 = peg$literalExpectation("MinSafeInt", false), peg$c411 = function () { return Number.MIN_SAFE_INTEGER; }, peg$c412 = "MaxPosNum", peg$c413 = peg$literalExpectation("MaxPosNum", false), peg$c414 = function () { return Number.MAX_VALUE; }, peg$c415 = "MinPosNum", peg$c416 = peg$literalExpectation("MinPosNum", false), peg$c417 = function () { return Number.MIN_VALUE; }, peg$c418 = "Phi", peg$c419 = peg$literalExpectation("Phi", false), peg$c420 = function () { return 1.61803398874989484820; }, peg$c421 = "\uD835\uDF11", peg$c422 = peg$literalExpectation("\uD835\uDF11", false), peg$c423 = "\uD835\uDF19", peg$c424 = peg$literalExpectation("\uD835\uDF19", false), peg$c425 = "\u03D5", peg$c426 = peg$literalExpectation("\u03D5", false), peg$c427 = "\u03C6", peg$c428 = peg$literalExpectation("\u03C6", false), peg$c429 = "EulerConstant", peg$c430 = peg$literalExpectation("EulerConstant", false), peg$c431 = function () { return 0.57721566490153286060; }, peg$c432 = "\u03B3", peg$c433 = peg$literalExpectation("\u03B3", false), peg$c434 = "\uD835\uDEFE", peg$c435 = peg$literalExpectation("\uD835\uDEFE", false), peg$c436 = peg$literalExpectation("e", true), peg$c437 = /^[+\-]/, peg$c438 = peg$classExpectation(["+", "-"], false, false), peg$c439 = "0x", peg$c440 = peg$literalExpectation("0x", true), peg$c441 = function (digits) {
357
357
  return parseInt(digits, 16);
@@ -2927,67 +2927,134 @@ function peg$parse(input, options) {
2927
2927
  }
2928
2928
  return s0;
2929
2929
  }
2930
- function peg$parseBlockCommentTail() {
2931
- var s0, s1, s2;
2932
- if (input.substr(peg$currPos, 2) === peg$c292) {
2933
- s0 = peg$c292;
2930
+ function peg$parseBlockComment() {
2931
+ var s0, s1, s2, s3, s4, s5;
2932
+ peg$silentFails++;
2933
+ s0 = peg$currPos;
2934
+ if (input.substr(peg$currPos, 2) === peg$c293) {
2935
+ s1 = peg$c293;
2934
2936
  peg$currPos += 2;
2935
2937
  }
2936
2938
  else {
2937
- s0 = peg$FAILED;
2939
+ s1 = peg$FAILED;
2938
2940
  if (peg$silentFails === 0) {
2939
- peg$fail(peg$c293);
2941
+ peg$fail(peg$c294);
2940
2942
  }
2941
2943
  }
2942
- if (s0 === peg$FAILED) {
2943
- s0 = peg$currPos;
2944
- if (input.length > peg$currPos) {
2945
- s1 = input.charAt(peg$currPos);
2946
- peg$currPos++;
2944
+ if (s1 !== peg$FAILED) {
2945
+ s2 = [];
2946
+ s3 = peg$currPos;
2947
+ s4 = peg$currPos;
2948
+ peg$silentFails++;
2949
+ if (input.substr(peg$currPos, 2) === peg$c295) {
2950
+ s5 = peg$c295;
2951
+ peg$currPos += 2;
2947
2952
  }
2948
2953
  else {
2949
- s1 = peg$FAILED;
2954
+ s5 = peg$FAILED;
2950
2955
  if (peg$silentFails === 0) {
2951
- peg$fail(peg$c294);
2956
+ peg$fail(peg$c296);
2952
2957
  }
2953
2958
  }
2954
- if (s1 !== peg$FAILED) {
2955
- s2 = peg$parseBlockCommentTail();
2956
- if (s2 !== peg$FAILED) {
2957
- s1 = [s1, s2];
2958
- s0 = s1;
2959
+ peg$silentFails--;
2960
+ if (s5 === peg$FAILED) {
2961
+ s4 = void 0;
2962
+ }
2963
+ else {
2964
+ peg$currPos = s4;
2965
+ s4 = peg$FAILED;
2966
+ }
2967
+ if (s4 !== peg$FAILED) {
2968
+ if (input.length > peg$currPos) {
2969
+ s5 = input.charAt(peg$currPos);
2970
+ peg$currPos++;
2959
2971
  }
2960
2972
  else {
2961
- peg$currPos = s0;
2962
- s0 = peg$FAILED;
2973
+ s5 = peg$FAILED;
2974
+ if (peg$silentFails === 0) {
2975
+ peg$fail(peg$c297);
2976
+ }
2977
+ }
2978
+ if (s5 !== peg$FAILED) {
2979
+ s4 = [s4, s5];
2980
+ s3 = s4;
2981
+ }
2982
+ else {
2983
+ peg$currPos = s3;
2984
+ s3 = peg$FAILED;
2963
2985
  }
2964
2986
  }
2965
2987
  else {
2966
- peg$currPos = s0;
2967
- s0 = peg$FAILED;
2988
+ peg$currPos = s3;
2989
+ s3 = peg$FAILED;
2968
2990
  }
2969
- }
2970
- return s0;
2971
- }
2972
- function peg$parseBlockComment() {
2973
- var s0, s1, s2;
2974
- peg$silentFails++;
2975
- s0 = peg$currPos;
2976
- if (input.substr(peg$currPos, 2) === peg$c296) {
2977
- s1 = peg$c296;
2978
- peg$currPos += 2;
2979
- }
2980
- else {
2981
- s1 = peg$FAILED;
2982
- if (peg$silentFails === 0) {
2983
- peg$fail(peg$c297);
2991
+ while (s3 !== peg$FAILED) {
2992
+ s2.push(s3);
2993
+ s3 = peg$currPos;
2994
+ s4 = peg$currPos;
2995
+ peg$silentFails++;
2996
+ if (input.substr(peg$currPos, 2) === peg$c295) {
2997
+ s5 = peg$c295;
2998
+ peg$currPos += 2;
2999
+ }
3000
+ else {
3001
+ s5 = peg$FAILED;
3002
+ if (peg$silentFails === 0) {
3003
+ peg$fail(peg$c296);
3004
+ }
3005
+ }
3006
+ peg$silentFails--;
3007
+ if (s5 === peg$FAILED) {
3008
+ s4 = void 0;
3009
+ }
3010
+ else {
3011
+ peg$currPos = s4;
3012
+ s4 = peg$FAILED;
3013
+ }
3014
+ if (s4 !== peg$FAILED) {
3015
+ if (input.length > peg$currPos) {
3016
+ s5 = input.charAt(peg$currPos);
3017
+ peg$currPos++;
3018
+ }
3019
+ else {
3020
+ s5 = peg$FAILED;
3021
+ if (peg$silentFails === 0) {
3022
+ peg$fail(peg$c297);
3023
+ }
3024
+ }
3025
+ if (s5 !== peg$FAILED) {
3026
+ s4 = [s4, s5];
3027
+ s3 = s4;
3028
+ }
3029
+ else {
3030
+ peg$currPos = s3;
3031
+ s3 = peg$FAILED;
3032
+ }
3033
+ }
3034
+ else {
3035
+ peg$currPos = s3;
3036
+ s3 = peg$FAILED;
3037
+ }
2984
3038
  }
2985
- }
2986
- if (s1 !== peg$FAILED) {
2987
- s2 = peg$parseBlockCommentTail();
2988
3039
  if (s2 !== peg$FAILED) {
2989
- s1 = [s1, s2];
2990
- s0 = s1;
3040
+ if (input.substr(peg$currPos, 2) === peg$c295) {
3041
+ s3 = peg$c295;
3042
+ peg$currPos += 2;
3043
+ }
3044
+ else {
3045
+ s3 = peg$FAILED;
3046
+ if (peg$silentFails === 0) {
3047
+ peg$fail(peg$c296);
3048
+ }
3049
+ }
3050
+ if (s3 !== peg$FAILED) {
3051
+ s1 = [s1, s2, s3];
3052
+ s0 = s1;
3053
+ }
3054
+ else {
3055
+ peg$currPos = s0;
3056
+ s0 = peg$FAILED;
3057
+ }
2991
3058
  }
2992
3059
  else {
2993
3060
  peg$currPos = s0;
@@ -3002,7 +3069,7 @@ function peg$parse(input, options) {
3002
3069
  if (s0 === peg$FAILED) {
3003
3070
  s1 = peg$FAILED;
3004
3071
  if (peg$silentFails === 0) {
3005
- peg$fail(peg$c295);
3072
+ peg$fail(peg$c292);
3006
3073
  }
3007
3074
  }
3008
3075
  return s0;
@@ -3018,7 +3085,7 @@ function peg$parse(input, options) {
3018
3085
  else {
3019
3086
  s1 = peg$FAILED;
3020
3087
  if (peg$silentFails === 0) {
3021
- peg$fail(peg$c294);
3088
+ peg$fail(peg$c297);
3022
3089
  }
3023
3090
  }
3024
3091
  peg$silentFails--;
@@ -3031,44 +3098,8 @@ function peg$parse(input, options) {
3031
3098
  }
3032
3099
  return s0;
3033
3100
  }
3034
- function peg$parseLineCommentTail() {
3035
- var s0, s1, s2;
3036
- s0 = peg$parseLineTerminator();
3037
- if (s0 === peg$FAILED) {
3038
- s0 = peg$parseEOF();
3039
- if (s0 === peg$FAILED) {
3040
- s0 = peg$currPos;
3041
- if (input.length > peg$currPos) {
3042
- s1 = input.charAt(peg$currPos);
3043
- peg$currPos++;
3044
- }
3045
- else {
3046
- s1 = peg$FAILED;
3047
- if (peg$silentFails === 0) {
3048
- peg$fail(peg$c294);
3049
- }
3050
- }
3051
- if (s1 !== peg$FAILED) {
3052
- s2 = peg$parseLineCommentTail();
3053
- if (s2 !== peg$FAILED) {
3054
- s1 = [s1, s2];
3055
- s0 = s1;
3056
- }
3057
- else {
3058
- peg$currPos = s0;
3059
- s0 = peg$FAILED;
3060
- }
3061
- }
3062
- else {
3063
- peg$currPos = s0;
3064
- s0 = peg$FAILED;
3065
- }
3066
- }
3067
- }
3068
- return s0;
3069
- }
3070
3101
  function peg$parseLineComment() {
3071
- var s0, s1, s2;
3102
+ var s0, s1, s2, s3, s4, s5;
3072
3103
  peg$silentFails++;
3073
3104
  s0 = peg$currPos;
3074
3105
  if (input.substr(peg$currPos, 2) === peg$c299) {
@@ -3082,10 +3113,95 @@ function peg$parse(input, options) {
3082
3113
  }
3083
3114
  }
3084
3115
  if (s1 !== peg$FAILED) {
3085
- s2 = peg$parseLineCommentTail();
3116
+ s2 = [];
3117
+ s3 = peg$currPos;
3118
+ s4 = peg$currPos;
3119
+ peg$silentFails++;
3120
+ s5 = peg$parseLineTerminator();
3121
+ peg$silentFails--;
3122
+ if (s5 === peg$FAILED) {
3123
+ s4 = void 0;
3124
+ }
3125
+ else {
3126
+ peg$currPos = s4;
3127
+ s4 = peg$FAILED;
3128
+ }
3129
+ if (s4 !== peg$FAILED) {
3130
+ if (input.length > peg$currPos) {
3131
+ s5 = input.charAt(peg$currPos);
3132
+ peg$currPos++;
3133
+ }
3134
+ else {
3135
+ s5 = peg$FAILED;
3136
+ if (peg$silentFails === 0) {
3137
+ peg$fail(peg$c297);
3138
+ }
3139
+ }
3140
+ if (s5 !== peg$FAILED) {
3141
+ s4 = [s4, s5];
3142
+ s3 = s4;
3143
+ }
3144
+ else {
3145
+ peg$currPos = s3;
3146
+ s3 = peg$FAILED;
3147
+ }
3148
+ }
3149
+ else {
3150
+ peg$currPos = s3;
3151
+ s3 = peg$FAILED;
3152
+ }
3153
+ while (s3 !== peg$FAILED) {
3154
+ s2.push(s3);
3155
+ s3 = peg$currPos;
3156
+ s4 = peg$currPos;
3157
+ peg$silentFails++;
3158
+ s5 = peg$parseLineTerminator();
3159
+ peg$silentFails--;
3160
+ if (s5 === peg$FAILED) {
3161
+ s4 = void 0;
3162
+ }
3163
+ else {
3164
+ peg$currPos = s4;
3165
+ s4 = peg$FAILED;
3166
+ }
3167
+ if (s4 !== peg$FAILED) {
3168
+ if (input.length > peg$currPos) {
3169
+ s5 = input.charAt(peg$currPos);
3170
+ peg$currPos++;
3171
+ }
3172
+ else {
3173
+ s5 = peg$FAILED;
3174
+ if (peg$silentFails === 0) {
3175
+ peg$fail(peg$c297);
3176
+ }
3177
+ }
3178
+ if (s5 !== peg$FAILED) {
3179
+ s4 = [s4, s5];
3180
+ s3 = s4;
3181
+ }
3182
+ else {
3183
+ peg$currPos = s3;
3184
+ s3 = peg$FAILED;
3185
+ }
3186
+ }
3187
+ else {
3188
+ peg$currPos = s3;
3189
+ s3 = peg$FAILED;
3190
+ }
3191
+ }
3086
3192
  if (s2 !== peg$FAILED) {
3087
- s1 = [s1, s2];
3088
- s0 = s1;
3193
+ s3 = peg$parseLineTerminator();
3194
+ if (s3 === peg$FAILED) {
3195
+ s3 = peg$parseEOF();
3196
+ }
3197
+ if (s3 !== peg$FAILED) {
3198
+ s1 = [s1, s2, s3];
3199
+ s0 = s1;
3200
+ }
3201
+ else {
3202
+ peg$currPos = s0;
3203
+ s0 = peg$FAILED;
3204
+ }
3089
3205
  }
3090
3206
  else {
3091
3207
  peg$currPos = s0;
@@ -3108,49 +3224,45 @@ function peg$parse(input, options) {
3108
3224
  function peg$parseWS() {
3109
3225
  var s0, s1, s2;
3110
3226
  peg$silentFails++;
3111
- s0 = peg$currPos;
3112
- s1 = peg$parseBlockComment();
3113
- if (s1 !== peg$FAILED) {
3114
- s2 = peg$parseWS();
3115
- if (s2 === peg$FAILED) {
3116
- s2 = null;
3117
- }
3118
- if (s2 !== peg$FAILED) {
3119
- s1 = [s1, s2];
3120
- s0 = s1;
3121
- }
3122
- else {
3123
- peg$currPos = s0;
3124
- s0 = peg$FAILED;
3125
- }
3227
+ s0 = [];
3228
+ s1 = [];
3229
+ if (peg$c302.test(input.charAt(peg$currPos))) {
3230
+ s2 = input.charAt(peg$currPos);
3231
+ peg$currPos++;
3126
3232
  }
3127
3233
  else {
3128
- peg$currPos = s0;
3129
- s0 = peg$FAILED;
3234
+ s2 = peg$FAILED;
3235
+ if (peg$silentFails === 0) {
3236
+ peg$fail(peg$c303);
3237
+ }
3130
3238
  }
3131
- if (s0 === peg$FAILED) {
3132
- s0 = peg$currPos;
3133
- s1 = peg$parseLineComment();
3134
- if (s1 !== peg$FAILED) {
3135
- s2 = peg$parseWS();
3136
- if (s2 === peg$FAILED) {
3137
- s2 = null;
3138
- }
3139
- if (s2 !== peg$FAILED) {
3140
- s1 = [s1, s2];
3141
- s0 = s1;
3239
+ if (s2 !== peg$FAILED) {
3240
+ while (s2 !== peg$FAILED) {
3241
+ s1.push(s2);
3242
+ if (peg$c302.test(input.charAt(peg$currPos))) {
3243
+ s2 = input.charAt(peg$currPos);
3244
+ peg$currPos++;
3142
3245
  }
3143
3246
  else {
3144
- peg$currPos = s0;
3145
- s0 = peg$FAILED;
3247
+ s2 = peg$FAILED;
3248
+ if (peg$silentFails === 0) {
3249
+ peg$fail(peg$c303);
3250
+ }
3146
3251
  }
3147
3252
  }
3148
- else {
3149
- peg$currPos = s0;
3150
- s0 = peg$FAILED;
3253
+ }
3254
+ else {
3255
+ s1 = peg$FAILED;
3256
+ }
3257
+ if (s1 === peg$FAILED) {
3258
+ s1 = peg$parseBlockComment();
3259
+ if (s1 === peg$FAILED) {
3260
+ s1 = peg$parseLineComment();
3151
3261
  }
3152
- if (s0 === peg$FAILED) {
3153
- s0 = peg$currPos;
3262
+ }
3263
+ if (s1 !== peg$FAILED) {
3264
+ while (s1 !== peg$FAILED) {
3265
+ s0.push(s1);
3154
3266
  s1 = [];
3155
3267
  if (peg$c302.test(input.charAt(peg$currPos))) {
3156
3268
  s2 = input.charAt(peg$currPos);
@@ -3180,26 +3292,17 @@ function peg$parse(input, options) {
3180
3292
  else {
3181
3293
  s1 = peg$FAILED;
3182
3294
  }
3183
- if (s1 !== peg$FAILED) {
3184
- s2 = peg$parseWS();
3185
- if (s2 === peg$FAILED) {
3186
- s2 = null;
3187
- }
3188
- if (s2 !== peg$FAILED) {
3189
- s1 = [s1, s2];
3190
- s0 = s1;
3191
- }
3192
- else {
3193
- peg$currPos = s0;
3194
- s0 = peg$FAILED;
3295
+ if (s1 === peg$FAILED) {
3296
+ s1 = peg$parseBlockComment();
3297
+ if (s1 === peg$FAILED) {
3298
+ s1 = peg$parseLineComment();
3195
3299
  }
3196
3300
  }
3197
- else {
3198
- peg$currPos = s0;
3199
- s0 = peg$FAILED;
3200
- }
3201
3301
  }
3202
3302
  }
3303
+ else {
3304
+ s0 = peg$FAILED;
3305
+ }
3203
3306
  peg$silentFails--;
3204
3307
  if (s0 === peg$FAILED) {
3205
3308
  s1 = peg$FAILED;
@@ -21271,7 +21374,7 @@ theme_mapping.set('bold', bold_theme);
21271
21374
  * import { state_name_chars } from 'jssm';
21272
21375
  * state_name_chars.some(r => 'A' >= r.from && 'A' <= r.to); // => true
21273
21376
  */
21274
- // keep in sync with src/ts/fsl_parser.peg:278
21377
+ // keep in sync with src/ts/fsl_parser.peg:267
21275
21378
  const state_name_chars$1 = Object.freeze([
21276
21379
  { from: '0', to: '9' },
21277
21380
  { from: 'a', to: 'z' },
@@ -21304,7 +21407,7 @@ const state_name_chars$1 = Object.freeze([
21304
21407
  * import { state_name_first_chars } from 'jssm';
21305
21408
  * state_name_first_chars.some(r => '+' >= r.from && '+' <= r.to); // => false
21306
21409
  */
21307
- // keep in sync with src/ts/fsl_parser.peg:275
21410
+ // keep in sync with src/ts/fsl_parser.peg:264
21308
21411
  const state_name_first_chars$1 = Object.freeze([
21309
21412
  { from: '0', to: '9' },
21310
21413
  { from: 'a', to: 'z' },
@@ -21352,7 +21455,7 @@ var constants = /*#__PURE__*/Object.freeze({
21352
21455
  * Useful for runtime diagnostics and for embedding in serialized machine
21353
21456
  * snapshots so that deserializers can detect version-skew.
21354
21457
  */
21355
- const version = "5.141.5";
21458
+ const version = "5.141.8";
21356
21459
 
21357
21460
  // whargarbl lots of these return arrays could/should be sets
21358
21461
  const { state_name_chars, state_name_first_chars, action_label_chars } = constants;
@@ -23873,6 +23976,44 @@ class Machine {
23873
23976
  throw new JssmError(this, "Code specifies no override, but config tries to permit; config may not be less strict than code");
23874
23977
  }
23875
23978
  }
23979
+ /*********
23980
+ *
23981
+ * Fire a `'rejection'` event caused by a hook vetoing a pending transition.
23982
+ * Extracted from the per-call closures inside {@link transition_impl} so
23983
+ * that it is allocated once at class-definition time rather than on every
23984
+ * hooked transition.
23985
+ *
23986
+ * @param hook_name Name of the hook that rejected (e.g. `'exit'`).
23987
+ * @param fromState State the machine was in when the transition was
23988
+ * attempted; used as the `from` field of the rejection event.
23989
+ * @param newState State that would have been entered had the hook
23990
+ * passed; used as the `to` field of the rejection event.
23991
+ * @param fromAction Action name when the transition was initiated by an
23992
+ * action call; `undefined` for plain state transitions.
23993
+ * @param oldData Machine data at the moment the transition was
23994
+ * attempted, before any hook mutations.
23995
+ * @param newData The `next_data` value passed to the transition call.
23996
+ * @param wasForced Whether the transition was attempted via
23997
+ * `force_transition`.
23998
+ *
23999
+ * @see transition_impl
24000
+ * @see _fire
24001
+ *
24002
+ * @internal
24003
+ *
24004
+ */
24005
+ _fire_hook_rejection(hook_name, fromState, newState, fromAction, oldData, newData, wasForced) {
24006
+ this._fire('rejection', {
24007
+ from: fromState,
24008
+ to: newState,
24009
+ action: fromAction,
24010
+ data: oldData,
24011
+ next_data: newData,
24012
+ reason: 'hook',
24013
+ hook_name,
24014
+ forced: wasForced
24015
+ });
24016
+ }
23876
24017
  /*********
23877
24018
  *
23878
24019
  * Shared transition core used by {@link transition}, {@link force_transition},
@@ -23964,14 +24105,19 @@ class Machine {
23964
24105
  const hook_args = hook_args_obj;
23965
24106
  // 'action' event fires when an action is attempted, regardless of whether
23966
24107
  // it ultimately succeeds — matches the issue spec for observation events.
24108
+ // Gated on live listener count so we skip the detail-object allocation
24109
+ // when nothing is subscribed. Gate is read at fire time, so a listener
24110
+ // registered inside a pre-hook still receives the event. #671
23967
24111
  if (wasAction) {
23968
- this._fire('action', {
23969
- action: newStateOrAction,
23970
- from: this._state,
23971
- to: newState,
23972
- data: this._data,
23973
- next_data: newData
23974
- });
24112
+ if (this._event_listener_count !== 0) {
24113
+ this._fire('action', {
24114
+ action: newStateOrAction,
24115
+ from: this._state,
24116
+ to: newState,
24117
+ data: this._data,
24118
+ next_data: newData
24119
+ });
24120
+ }
23975
24121
  }
23976
24122
  // Captured pre-transition source state so 'data-change' detail and similar
23977
24123
  // events can name where we came from.
@@ -23981,75 +24127,68 @@ class Machine {
23981
24127
  if (this._has_hooks) {
23982
24128
  // once validity is known, clear old 'after' timeout clause
23983
24129
  this.clear_state_timeout();
23984
- function update_fields(res) {
23985
- if (res.hasOwnProperty('data')) {
23986
- hook_args.data = res.data;
23987
- hook_args.next_data = res.next_data;
23988
- data_changed = true;
23989
- }
23990
- }
23991
24130
  let data_changed = false;
23992
- const fire_rejection = (hook_name) => {
23993
- this._fire('rejection', {
23994
- from: fromState,
23995
- to: newState,
23996
- action: fromAction,
23997
- data: oldData,
23998
- next_data: newData,
23999
- reason: 'hook',
24000
- hook_name,
24001
- forced: wasForced
24002
- });
24003
- };
24004
24131
  // 0. pre everything hook (fires before all other pre-hooks)
24005
24132
  if (this._pre_everything_hook !== undefined) {
24006
24133
  const outcome = abstract_everything_hook_step(this._pre_everything_hook, Object.assign(Object.assign({}, hook_args), { hook_name: 'pre everything' }));
24007
24134
  if (outcome.pass === false) {
24008
- fire_rejection('pre everything');
24135
+ this._fire_hook_rejection('pre everything', fromState, newState, fromAction, oldData, newData, wasForced);
24009
24136
  return false;
24010
24137
  }
24011
- update_fields(outcome);
24138
+ if (_update_hook_fields(hook_args, outcome)) {
24139
+ data_changed = true;
24140
+ }
24012
24141
  }
24013
24142
  if (wasAction) {
24014
24143
  // 1a. any action hook
24015
24144
  const outcome = abstract_hook_step(this._any_action_hook, hook_args);
24016
24145
  if (outcome.pass === false) {
24017
- fire_rejection('any action');
24146
+ this._fire_hook_rejection('any action', fromState, newState, fromAction, oldData, newData, wasForced);
24018
24147
  return false;
24019
24148
  }
24020
- update_fields(outcome);
24149
+ if (_update_hook_fields(hook_args, outcome)) {
24150
+ data_changed = true;
24151
+ }
24021
24152
  // 1b. global specific action hook
24022
24153
  const outcome2 = abstract_hook_step(this._global_action_hooks.get(newStateOrAction), hook_args);
24023
24154
  if (outcome2.pass === false) {
24024
- fire_rejection('global action');
24155
+ this._fire_hook_rejection('global action', fromState, newState, fromAction, oldData, newData, wasForced);
24025
24156
  return false;
24026
24157
  }
24027
- update_fields(outcome2);
24158
+ if (_update_hook_fields(hook_args, outcome2)) {
24159
+ data_changed = true;
24160
+ }
24028
24161
  }
24029
24162
  // 2. after hook
24030
24163
  if (this._has_after_hooks) {
24031
24164
  const ah = this._after_hooks.get(newStateOrAction);
24032
24165
  const outcome = abstract_hook_step(ah, hook_args);
24033
- // there's no such thing as after not passing, so, omit the result pass check
24034
- update_fields(outcome);
24166
+ // there's no such thing as after not passing, so, omit the result pass check.
24167
+ // after hooks are post-exit and informational — their outcome never changes
24168
+ // data, so there's no data_changed branch here (it would be unreachable).
24169
+ _update_hook_fields(hook_args, outcome);
24035
24170
  }
24036
24171
  // 3. any transition hook
24037
24172
  if (this._any_transition_hook !== undefined) {
24038
24173
  const outcome = abstract_hook_step(this._any_transition_hook, hook_args);
24039
24174
  if (outcome.pass === false) {
24040
- fire_rejection('any transition');
24175
+ this._fire_hook_rejection('any transition', fromState, newState, fromAction, oldData, newData, wasForced);
24041
24176
  return false;
24042
24177
  }
24043
- update_fields(outcome);
24178
+ if (_update_hook_fields(hook_args, outcome)) {
24179
+ data_changed = true;
24180
+ }
24044
24181
  }
24045
24182
  // 4. exit hook
24046
24183
  if (this._has_exit_hooks) {
24047
24184
  const outcome = abstract_hook_step(this._exit_hooks.get(this._state), hook_args);
24048
24185
  if (outcome.pass === false) {
24049
- fire_rejection('exit');
24186
+ this._fire_hook_rejection('exit', fromState, newState, fromAction, oldData, newData, wasForced);
24050
24187
  return false;
24051
24188
  }
24052
- update_fields(outcome);
24189
+ if (_update_hook_fields(hook_args, outcome)) {
24190
+ data_changed = true;
24191
+ }
24053
24192
  }
24054
24193
  // 5. named transition / action hook
24055
24194
  if (this._has_named_hooks) {
@@ -24061,10 +24200,12 @@ class Machine {
24061
24200
  const nh = byAct === undefined ? undefined : byAct.get(newStateOrAction);
24062
24201
  const outcome = abstract_hook_step(nh, hook_args);
24063
24202
  if (outcome.pass === false) {
24064
- fire_rejection('named');
24203
+ this._fire_hook_rejection('named', fromState, newState, fromAction, oldData, newData, wasForced);
24065
24204
  return false;
24066
24205
  }
24067
- update_fields(outcome);
24206
+ if (_update_hook_fields(hook_args, outcome)) {
24207
+ data_changed = true;
24208
+ }
24068
24209
  }
24069
24210
  }
24070
24211
  // 6. regular hook
@@ -24074,56 +24215,68 @@ class Machine {
24074
24215
  const h = byTo === undefined ? undefined : byTo.get(newState);
24075
24216
  const outcome = abstract_hook_step(h, hook_args);
24076
24217
  if (outcome.pass === false) {
24077
- fire_rejection('hook');
24218
+ this._fire_hook_rejection('hook', fromState, newState, fromAction, oldData, newData, wasForced);
24078
24219
  return false;
24079
24220
  }
24080
- update_fields(outcome);
24221
+ if (_update_hook_fields(hook_args, outcome)) {
24222
+ data_changed = true;
24223
+ }
24081
24224
  }
24082
24225
  // 7. edge type hook
24083
24226
  // 7a. standard transition hook
24084
24227
  if (trans_type === 'legal') {
24085
24228
  const outcome = abstract_hook_step(this._standard_transition_hook, hook_args);
24086
24229
  if (outcome.pass === false) {
24087
- fire_rejection('standard transition');
24230
+ this._fire_hook_rejection('standard transition', fromState, newState, fromAction, oldData, newData, wasForced);
24088
24231
  return false;
24089
24232
  }
24090
- update_fields(outcome);
24233
+ if (_update_hook_fields(hook_args, outcome)) {
24234
+ data_changed = true;
24235
+ }
24091
24236
  }
24092
24237
  // 7b. main type hook
24093
24238
  if (trans_type === 'main') {
24094
24239
  const outcome = abstract_hook_step(this._main_transition_hook, hook_args);
24095
24240
  if (outcome.pass === false) {
24096
- fire_rejection('main transition');
24241
+ this._fire_hook_rejection('main transition', fromState, newState, fromAction, oldData, newData, wasForced);
24097
24242
  return false;
24098
24243
  }
24099
- update_fields(outcome);
24244
+ if (_update_hook_fields(hook_args, outcome)) {
24245
+ data_changed = true;
24246
+ }
24100
24247
  }
24101
24248
  // 7c. forced transition hook
24102
24249
  if (trans_type === 'forced') {
24103
24250
  const outcome = abstract_hook_step(this._forced_transition_hook, hook_args);
24104
24251
  if (outcome.pass === false) {
24105
- fire_rejection('forced transition');
24252
+ this._fire_hook_rejection('forced transition', fromState, newState, fromAction, oldData, newData, wasForced);
24106
24253
  return false;
24107
24254
  }
24108
- update_fields(outcome);
24255
+ if (_update_hook_fields(hook_args, outcome)) {
24256
+ data_changed = true;
24257
+ }
24109
24258
  }
24110
24259
  // 8. entry hook
24111
24260
  if (this._has_entry_hooks) {
24112
24261
  const outcome = abstract_hook_step(this._entry_hooks.get(newState), hook_args);
24113
24262
  if (outcome.pass === false) {
24114
- fire_rejection('entry');
24263
+ this._fire_hook_rejection('entry', fromState, newState, fromAction, oldData, newData, wasForced);
24115
24264
  return false;
24116
24265
  }
24117
- update_fields(outcome);
24266
+ if (_update_hook_fields(hook_args, outcome)) {
24267
+ data_changed = true;
24268
+ }
24118
24269
  }
24119
24270
  // 9. everything hook (fires after all other pre-hooks)
24120
24271
  if (this._everything_hook !== undefined) {
24121
24272
  const outcome = abstract_everything_hook_step(this._everything_hook, Object.assign(Object.assign({}, hook_args), { hook_name: 'everything' }));
24122
24273
  if (outcome.pass === false) {
24123
- fire_rejection('everything');
24274
+ this._fire_hook_rejection('everything', fromState, newState, fromAction, oldData, newData, wasForced);
24124
24275
  return false;
24125
24276
  }
24126
- update_fields(outcome);
24277
+ if (_update_hook_fields(hook_args, outcome)) {
24278
+ data_changed = true;
24279
+ }
24127
24280
  }
24128
24281
  // all hooks passed! let's now establish the result
24129
24282
  if (this._history_length) {
@@ -24156,15 +24309,20 @@ class Machine {
24156
24309
  // not valid
24157
24310
  }
24158
24311
  else {
24159
- this._fire('rejection', {
24160
- from: fromState,
24161
- to: newStateOrAction,
24162
- action: fromAction,
24163
- data: oldData,
24164
- next_data: newData,
24165
- reason: 'invalid',
24166
- forced: wasForced
24167
- });
24312
+ // Gated on live listener count so we skip the detail-object allocation
24313
+ // when nothing is subscribed. A listener still receives the event
24314
+ // because the gate is read at fire time. #671
24315
+ if (this._event_listener_count !== 0) {
24316
+ this._fire('rejection', {
24317
+ from: fromState,
24318
+ to: newStateOrAction,
24319
+ action: fromAction,
24320
+ data: oldData,
24321
+ next_data: newData,
24322
+ reason: 'invalid',
24323
+ forced: wasForced
24324
+ });
24325
+ }
24168
24326
  return false;
24169
24327
  }
24170
24328
  // posthooks begin here
@@ -25049,6 +25207,46 @@ function is_hook_complex_result(hr) {
25049
25207
  }
25050
25208
  return false;
25051
25209
  }
25210
+ /**
25211
+ *
25212
+ * Apply any data-field updates from a hook's complex result into `hook_args`,
25213
+ * and return whether data actually changed.
25214
+ *
25215
+ * This is the hoisted, allocation-free replacement for the `update_fields`
25216
+ * inner function that used to be re-created on every hooked transition inside
25217
+ * {@link Machine.transition_impl}. By moving it to module scope the function
25218
+ * object is allocated once at module load time.
25219
+ *
25220
+ * When the result does not carry a `data` property (the common case —
25221
+ * most hooks return `true` or `undefined`) the function returns `false`
25222
+ * immediately without touching `hook_args`.
25223
+ *
25224
+ * ```typescript
25225
+ * const args = { data: 'old', next_data: undefined, ... };
25226
+ * const changed = _update_hook_fields(args, { pass: true, data: 'new', next_data: undefined });
25227
+ * // changed === true, args.data === 'new'
25228
+ * ```
25229
+ *
25230
+ * @param hook_args The shared hook-argument object for the current
25231
+ * transition. Mutated in-place when the result carries `data`.
25232
+ * @param res The normalised complex result returned by
25233
+ * {@link abstract_hook_step} or {@link abstract_everything_hook_step}.
25234
+ *
25235
+ * @returns `true` if `res` contained a `data` property (i.e. the hook
25236
+ * mutated the machine's data); `false` otherwise.
25237
+ *
25238
+ * @see Machine.transition_impl
25239
+ * @see abstract_hook_step
25240
+ *
25241
+ */
25242
+ function _update_hook_fields(hook_args, res) {
25243
+ if (Object.prototype.hasOwnProperty.call(res, 'data')) {
25244
+ hook_args.data = res.data;
25245
+ hook_args.next_data = res.next_data;
25246
+ return true;
25247
+ }
25248
+ return false;
25249
+ }
25052
25250
  /**
25053
25251
  *
25054
25252
  * Invoke an optional transition/action hook and normalize its return value