From 73e40d9080de9727274e2c96a9671d516c0f327c Mon Sep 17 00:00:00 2001 From: John Haugeland Date: Tue, 27 Jun 2017 20:04:37 -0700 Subject: [PATCH] modernize the tests for fixed labels; make them more data driven --- dist/jssm.es5.cjs.js | 772 +++++++++++++++++---------------------- dist/jssm.es5.cjs.min.js | 2 +- docs/lib/index.html | 4 +- package.json | 2 +- src/js/jssm-dot.peg | 43 ++- src/js/tests/parse.js | 64 ++-- 6 files changed, 395 insertions(+), 492 deletions(-) diff --git a/dist/jssm.es5.cjs.js b/dist/jssm.es5.cjs.js index c725bc77..4990bb9a 100644 --- a/dist/jssm.es5.cjs.js +++ b/dist/jssm.es5.cjs.js @@ -211,21 +211,27 @@ function peg$parse(input, options) { return text.join(''); }, peg$c59 = peg$otherExpectation("label"), - peg$c60 = ":", - peg$c61 = peg$literalExpectation(":", false), - peg$c62 = ";", - peg$c63 = peg$literalExpectation(";", false), - peg$c64 = function peg$c64(text, value) { - return { text: text, value: value }; + peg$c60 = "arc_label", + peg$c61 = peg$literalExpectation("arc_label", false), + peg$c62 = "head_label", + peg$c63 = peg$literalExpectation("head_label", false), + peg$c64 = "tail_label", + peg$c65 = peg$literalExpectation("tail_label", false), + peg$c66 = ":", + peg$c67 = peg$literalExpectation(":", false), + peg$c68 = ";", + peg$c69 = peg$literalExpectation(";", false), + peg$c70 = function peg$c70(key, value) { + return { key: key, value: value }; }, - peg$c65 = "{", - peg$c66 = peg$literalExpectation("{", false), - peg$c67 = "}", - peg$c68 = peg$literalExpectation("}", false), - peg$c69 = function peg$c69(items) { + peg$c71 = "{", + peg$c72 = peg$literalExpectation("{", false), + peg$c73 = "}", + peg$c74 = peg$literalExpectation("}", false), + peg$c75 = function peg$c75(items) { return items; }, - peg$c70 = function peg$c70(lactl, ldesc, arrow, rdesc, ractl, label, tail) { + peg$c76 = function peg$c76(lactl, ldesc, arrow, rdesc, ractl, label, tail) { var base = { kind: arrow, to: label }; if (tail && tail !== []) { @@ -240,90 +246,81 @@ function peg$parse(input, options) { return base; }, - peg$c71 = function peg$c71(label, se) { + peg$c77 = function peg$c77(label, se) { var base = { from: label }; if (se && se !== []) { base.se = se; } return base; }, - peg$c72 = "whargarbl", - peg$c73 = peg$literalExpectation("whargarbl", false), - peg$c74 = "todo", - peg$c75 = peg$literalExpectation("todo", false), - peg$c76 = function peg$c76(validationkey, value) { + peg$c78 = "whargarbl", + peg$c79 = peg$literalExpectation("whargarbl", false), + peg$c80 = "todo", + peg$c81 = peg$literalExpectation("todo", false), + peg$c82 = function peg$c82(validationkey, value) { return { key: validationkey, value: value }; }, - peg$c77 = "validation", - peg$c78 = peg$literalExpectation("validation", false), - peg$c79 = "};", - peg$c80 = peg$literalExpectation("};", false), - peg$c81 = function peg$c81(validation_items) { + peg$c83 = "validation", + peg$c84 = peg$literalExpectation("validation", false), + peg$c85 = "};", + peg$c86 = peg$literalExpectation("};", false), + peg$c87 = function peg$c87(validation_items) { return { config_kind: "validation", config_items: validation_items || [] }; }, - peg$c82 = "dot", - peg$c83 = peg$literalExpectation("dot", false), - peg$c84 = "circo", - peg$c85 = peg$literalExpectation("circo", false), - peg$c86 = "in_shape", - peg$c87 = peg$literalExpectation("in_shape", false), - peg$c88 = function peg$c88(value) { - return { key: "in_shape", value: value }; - }, - peg$c89 = "out_shape", - peg$c90 = peg$literalExpectation("out_shape", false), - peg$c91 = function peg$c91(value) { - return { key: "out_shape", value: value }; - }, - peg$c92 = "node_shape", - peg$c93 = peg$literalExpectation("node_shape", false), - peg$c94 = function peg$c94(value) { - return { key: "node_shape", value: value }; - }, - peg$c95 = "graph_layout", - peg$c96 = peg$literalExpectation("graph_layout", false), - peg$c97 = function peg$c97(value) { + peg$c88 = "dot", + peg$c89 = peg$literalExpectation("dot", false), + peg$c90 = "circo", + peg$c91 = peg$literalExpectation("circo", false), + peg$c92 = "in_shape", + peg$c93 = peg$literalExpectation("in_shape", false), + peg$c94 = "out_shape", + peg$c95 = peg$literalExpectation("out_shape", false), + peg$c96 = "node_shape", + peg$c97 = peg$literalExpectation("node_shape", false), + peg$c98 = "graph_layout", + peg$c99 = peg$literalExpectation("graph_layout", false), + peg$c100 = function peg$c100(value) { return { key: "graph_layout", value: value }; }, - peg$c98 = "state", - peg$c99 = peg$literalExpectation("state", false), - peg$c100 = function peg$c100(state_items) { + peg$c101 = "state", + peg$c102 = peg$literalExpectation("state", false), + peg$c103 = function peg$c103(state_items) { return { config_kind: "state", config_items: state_items || [] }; }, - peg$c101 = function peg$c101(actionkey, value) { + peg$c104 = function peg$c104(actionkey, value) { return { key: actionkey, value: value }; }, - peg$c102 = "action", - peg$c103 = peg$literalExpectation("action", false), - peg$c104 = function peg$c104(action_items) { + peg$c105 = "action", + peg$c106 = peg$literalExpectation("action", false), + peg$c107 = function peg$c107(action_items) { return { config_kind: "action", config_items: action_items || [] }; }, - peg$c105 = function peg$c105(transitionkey, value) { + peg$c108 = function peg$c108(transitionkey, value) { return { key: transitionkey, value: value }; }, - peg$c106 = "transition", - peg$c107 = peg$literalExpectation("transition", false), - peg$c108 = function peg$c108(transition_items) { + peg$c109 = "transition", + peg$c110 = peg$literalExpectation("transition", false), + peg$c111 = function peg$c111(transition_items) { return { config_kind: "transition", config_items: transition_items || [] }; }, - peg$c109 = "graph_bg", - peg$c110 = peg$literalExpectation("graph_bg", false), - peg$c111 = function peg$c111(value) { + peg$c112 = "graph_bg", + peg$c113 = peg$literalExpectation("graph_bg", false), + peg$c114 = function peg$c114(value) { return { key: "graph_bg", value: value }; }, - peg$c112 = "min_transitions_per_state", - peg$c113 = peg$literalExpectation("min_transitions_per_state", false), - peg$c114 = function peg$c114(value) { + peg$c115 = "min_transitions_per_state", + peg$c116 = peg$literalExpectation("min_transitions_per_state", false), + peg$c117 = function peg$c117(value) { return { key: "min_transitions_per_state", value: value }; }, - peg$c115 = "max_transitions_per_state", - peg$c116 = peg$literalExpectation("max_transitions_per_state", false), - peg$c117 = function peg$c117(value) { + peg$c118 = "max_transitions_per_state", + peg$c119 = peg$literalExpectation("max_transitions_per_state", false), + peg$c120 = function peg$c120(value) { return { key: "max_transitions_per_state", value: value }; }, - peg$c118 = "graph", - peg$c119 = peg$literalExpectation("graph", false), - peg$c120 = function peg$c120(graph_items) { + peg$c121 = "graph", + peg$c122 = peg$literalExpectation("graph", false), + peg$c123 = function peg$c123(graph_items) { return { config_kind: "graph", config_items: graph_items || [] }; }, peg$currPos = 0, @@ -1296,45 +1293,105 @@ function peg$parse(input, options) { return s0; } - function peg$parseValue() { + function peg$parseArrowItemKey() { var s0; - s0 = peg$parseLabel(); + if (input.substr(peg$currPos, 9) === peg$c60) { + s0 = peg$c60; + peg$currPos += 9; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c61); + } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 10) === peg$c62) { + s0 = peg$c62; + peg$currPos += 10; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c63); + } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 10) === peg$c64) { + s0 = peg$c64; + peg$currPos += 10; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c65); + } + } + } + } return s0; } - function peg$parseItem() { - var s0, s1, s2, s3, s4; + function peg$parseArrowItem() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; - s1 = peg$parseLabel(); + s1 = peg$parseWhitespace(); if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s2 = peg$c60; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c61); - } - } + s2 = peg$parseArrowItemKey(); if (s2 !== peg$FAILED) { - s3 = peg$parseValue(); + s3 = peg$parseWhitespace(); if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 59) { - s4 = peg$c62; + if (input.charCodeAt(peg$currPos) === 58) { + s4 = peg$c66; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c63); + peg$fail(peg$c67); } } if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c64(s1, s3); - s0 = s1; + s5 = peg$parseWhitespace(); + if (s5 !== peg$FAILED) { + s6 = peg$parseLabel(); + if (s6 !== peg$FAILED) { + s7 = peg$parseWhitespace(); + if (s7 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 59) { + s8 = peg$c68; + peg$currPos++; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c69); + } + } + if (s8 !== peg$FAILED) { + s9 = peg$parseWhitespace(); + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c70(s2, s6); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1355,15 +1412,15 @@ function peg$parse(input, options) { return s0; } - function peg$parseItems() { + function peg$parseArrowItems() { var s0, s1; s0 = []; - s1 = peg$parseItem(); + s1 = peg$parseArrowItem(); if (s1 !== peg$FAILED) { while (s1 !== peg$FAILED) { s0.push(s1); - s1 = peg$parseItem(); + s1 = peg$parseArrowItem(); } } else { s0 = peg$FAILED; @@ -1373,37 +1430,49 @@ function peg$parse(input, options) { } function peg$parseArrowDesc() { - var s0, s1, s2, s3; + var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c65; + s1 = peg$c71; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c66); + peg$fail(peg$c72); } } if (s1 !== peg$FAILED) { - s2 = peg$parseItems(); - if (s2 === peg$FAILED) { - s2 = null; - } + s2 = peg$parseWhitespace(); if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s3 = peg$c67; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c68); - } + s3 = peg$parseArrowItems(); + if (s3 === peg$FAILED) { + s3 = null; } if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c69(s2); - s0 = s1; + s4 = peg$parseWhitespace(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c73; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c74); + } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c75(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1468,7 +1537,7 @@ function peg$parse(input, options) { } if (s14 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c70(s2, s4, s6, s8, s10, s12, s14); + s1 = peg$c76(s2, s4, s6, s8, s10, s12, s14); s0 = s1; } else { peg$currPos = s0; @@ -1541,19 +1610,19 @@ function peg$parse(input, options) { s3 = peg$parseWhitespace(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 59) { - s4 = peg$c62; + s4 = peg$c68; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c63); + peg$fail(peg$c69); } } if (s4 !== peg$FAILED) { s5 = peg$parseWhitespace(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c71(s1, s2); + s1 = peg$c77(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -1582,23 +1651,23 @@ function peg$parse(input, options) { function peg$parseValidationKey() { var s0; - if (input.substr(peg$currPos, 9) === peg$c72) { - s0 = peg$c72; + if (input.substr(peg$currPos, 9) === peg$c78) { + s0 = peg$c78; peg$currPos += 9; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c73); + peg$fail(peg$c79); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c74) { - s0 = peg$c74; + if (input.substr(peg$currPos, 4) === peg$c80) { + s0 = peg$c80; peg$currPos += 4; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c75); + peg$fail(peg$c81); } } } @@ -1613,29 +1682,29 @@ function peg$parse(input, options) { s1 = peg$parseValidationKey(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s2 = peg$c60; + s2 = peg$c66; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s2 !== peg$FAILED) { - s3 = peg$parseValue(); + s3 = peg$parseLabel(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 59) { - s4 = peg$c62; + s4 = peg$c68; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c63); + peg$fail(peg$c69); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c76(s1, s3); + s1 = peg$c82(s1, s3); s0 = s1; } else { peg$currPos = s0; @@ -1680,37 +1749,37 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parseWhitespace(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 10) === peg$c77) { - s2 = peg$c77; + if (input.substr(peg$currPos, 10) === peg$c83) { + s2 = peg$c83; peg$currPos += 10; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c78); + peg$fail(peg$c84); } } if (s2 !== peg$FAILED) { s3 = peg$parseWhitespace(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c60; + s4 = peg$c66; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s4 !== peg$FAILED) { s5 = peg$parseWhitespace(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 123) { - s6 = peg$c65; + s6 = peg$c71; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c66); + peg$fail(peg$c72); } } if (s6 !== peg$FAILED) { @@ -1723,20 +1792,20 @@ function peg$parse(input, options) { if (s8 !== peg$FAILED) { s9 = peg$parseWhitespace(); if (s9 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c79) { - s10 = peg$c79; + if (input.substr(peg$currPos, 2) === peg$c85) { + s10 = peg$c85; peg$currPos += 2; } else { s10 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c80); + peg$fail(peg$c86); } } if (s10 !== peg$FAILED) { s11 = peg$parseWhitespace(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c81(s8); + s1 = peg$c87(s8); s0 = s1; } else { peg$currPos = s0; @@ -1789,23 +1858,23 @@ function peg$parse(input, options) { function peg$parseGvizLayout() { var s0; - if (input.substr(peg$currPos, 3) === peg$c82) { - s0 = peg$c82; + if (input.substr(peg$currPos, 3) === peg$c88) { + s0 = peg$c88; peg$currPos += 3; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c83); + peg$fail(peg$c89); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c84) { - s0 = peg$c84; + if (input.substr(peg$currPos, 5) === peg$c90) { + s0 = peg$c90; peg$currPos += 5; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c85); + peg$fail(peg$c91); } } } @@ -1813,209 +1882,61 @@ function peg$parse(input, options) { return s0; } - function peg$parseInShape() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + function peg$parseStateItemShapeKey() { + var s0; - s0 = peg$currPos; - s1 = peg$parseWhitespace(); - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c86) { - s2 = peg$c86; - peg$currPos += 8; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c87); - } - } - if (s2 !== peg$FAILED) { - s3 = peg$parseWhitespace(); - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c60; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c61); - } - } - if (s4 !== peg$FAILED) { - s5 = peg$parseWhitespace(); - if (s5 !== peg$FAILED) { - s6 = peg$parseGvizShape(); - if (s6 !== peg$FAILED) { - s7 = peg$parseWhitespace(); - if (s7 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 59) { - s8 = peg$c62; - peg$currPos++; - } else { - s8 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c63); - } - } - if (s8 !== peg$FAILED) { - s9 = peg$parseWhitespace(); - if (s9 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c88(s6); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.substr(peg$currPos, 8) === peg$c92) { + s0 = peg$c92; + peg$currPos += 8; } else { - peg$currPos = s0; s0 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c93); + } } - - return s0; - } - - function peg$parseOutShape() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; - - s0 = peg$currPos; - s1 = peg$parseWhitespace(); - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 9) === peg$c89) { - s2 = peg$c89; + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 9) === peg$c94) { + s0 = peg$c94; peg$currPos += 9; } else { - s2 = peg$FAILED; + s0 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c90); + peg$fail(peg$c95); } } - if (s2 !== peg$FAILED) { - s3 = peg$parseWhitespace(); - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c60; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c61); - } - } - if (s4 !== peg$FAILED) { - s5 = peg$parseWhitespace(); - if (s5 !== peg$FAILED) { - s6 = peg$parseGvizShape(); - if (s6 !== peg$FAILED) { - s7 = peg$parseWhitespace(); - if (s7 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 59) { - s8 = peg$c62; - peg$currPos++; - } else { - s8 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c63); - } - } - if (s8 !== peg$FAILED) { - s9 = peg$parseWhitespace(); - if (s9 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c91(s6); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 10) === peg$c96) { + s0 = peg$c96; + peg$currPos += 10; } else { - peg$currPos = s0; s0 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c97); + } } - } else { - peg$currPos = s0; - s0 = peg$FAILED; } - } else { - peg$currPos = s0; - s0 = peg$FAILED; } return s0; } - function peg$parseNodeShape() { + function peg$parseStateItemShape() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parseWhitespace(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 10) === peg$c92) { - s2 = peg$c92; - peg$currPos += 10; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c93); - } - } + s2 = peg$parseStateItemShapeKey(); if (s2 !== peg$FAILED) { s3 = peg$parseWhitespace(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c60; + s4 = peg$c66; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s4 !== peg$FAILED) { @@ -2026,19 +1947,19 @@ function peg$parse(input, options) { s7 = peg$parseWhitespace(); if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 59) { - s8 = peg$c62; + s8 = peg$c68; peg$currPos++; } else { s8 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c63); + peg$fail(peg$c69); } } if (s8 !== peg$FAILED) { s9 = peg$parseWhitespace(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c94(s6); + s1 = peg$c70(s2, s6); s0 = s1; } else { peg$currPos = s0; @@ -2080,31 +2001,31 @@ function peg$parse(input, options) { return s0; } - function peg$parseGraphLayout() { + function peg$parseStateItemGraphLayout() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parseWhitespace(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 12) === peg$c95) { - s2 = peg$c95; + if (input.substr(peg$currPos, 12) === peg$c98) { + s2 = peg$c98; peg$currPos += 12; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c96); + peg$fail(peg$c99); } } if (s2 !== peg$FAILED) { s3 = peg$parseWhitespace(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c60; + s4 = peg$c66; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s4 !== peg$FAILED) { @@ -2115,19 +2036,19 @@ function peg$parse(input, options) { s7 = peg$parseWhitespace(); if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 59) { - s8 = peg$c62; + s8 = peg$c68; peg$currPos++; } else { s8 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c63); + peg$fail(peg$c69); } } if (s8 !== peg$FAILED) { s9 = peg$parseWhitespace(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c97(s6); + s1 = peg$c100(s6); s0 = s1; } else { peg$currPos = s0; @@ -2172,15 +2093,9 @@ function peg$parse(input, options) { function peg$parseStateItem() { var s0; - s0 = peg$parseInShape(); + s0 = peg$parseStateItemShape(); if (s0 === peg$FAILED) { - s0 = peg$parseOutShape(); - if (s0 === peg$FAILED) { - s0 = peg$parseNodeShape(); - if (s0 === peg$FAILED) { - s0 = peg$parseGraphLayout(); - } - } + s0 = peg$parseStateItemGraphLayout(); } return s0; @@ -2209,37 +2124,37 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parseWhitespace(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c98) { - s2 = peg$c98; + if (input.substr(peg$currPos, 5) === peg$c101) { + s2 = peg$c101; peg$currPos += 5; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c99); + peg$fail(peg$c102); } } if (s2 !== peg$FAILED) { s3 = peg$parseWhitespace(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c60; + s4 = peg$c66; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s4 !== peg$FAILED) { s5 = peg$parseWhitespace(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 123) { - s6 = peg$c65; + s6 = peg$c71; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c66); + peg$fail(peg$c72); } } if (s6 !== peg$FAILED) { @@ -2252,20 +2167,20 @@ function peg$parse(input, options) { if (s8 !== peg$FAILED) { s9 = peg$parseWhitespace(); if (s9 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c79) { - s10 = peg$c79; + if (input.substr(peg$currPos, 2) === peg$c85) { + s10 = peg$c85; peg$currPos += 2; } else { s10 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c80); + peg$fail(peg$c86); } } if (s10 !== peg$FAILED) { s11 = peg$parseWhitespace(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c100(s8); + s1 = peg$c103(s8); s0 = s1; } else { peg$currPos = s0; @@ -2318,23 +2233,23 @@ function peg$parse(input, options) { function peg$parseActionKey() { var s0; - if (input.substr(peg$currPos, 9) === peg$c72) { - s0 = peg$c72; + if (input.substr(peg$currPos, 9) === peg$c78) { + s0 = peg$c78; peg$currPos += 9; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c73); + peg$fail(peg$c79); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c74) { - s0 = peg$c74; + if (input.substr(peg$currPos, 4) === peg$c80) { + s0 = peg$c80; peg$currPos += 4; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c75); + peg$fail(peg$c81); } } } @@ -2349,29 +2264,29 @@ function peg$parse(input, options) { s1 = peg$parseActionKey(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s2 = peg$c60; + s2 = peg$c66; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s2 !== peg$FAILED) { - s3 = peg$parseValue(); + s3 = peg$parseLabel(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 59) { - s4 = peg$c62; + s4 = peg$c68; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c63); + peg$fail(peg$c69); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c101(s1, s3); + s1 = peg$c104(s1, s3); s0 = s1; } else { peg$currPos = s0; @@ -2416,37 +2331,37 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parseWhitespace(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c102) { - s2 = peg$c102; + if (input.substr(peg$currPos, 6) === peg$c105) { + s2 = peg$c105; peg$currPos += 6; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c103); + peg$fail(peg$c106); } } if (s2 !== peg$FAILED) { s3 = peg$parseWhitespace(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c60; + s4 = peg$c66; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s4 !== peg$FAILED) { s5 = peg$parseWhitespace(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 123) { - s6 = peg$c65; + s6 = peg$c71; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c66); + peg$fail(peg$c72); } } if (s6 !== peg$FAILED) { @@ -2459,20 +2374,20 @@ function peg$parse(input, options) { if (s8 !== peg$FAILED) { s9 = peg$parseWhitespace(); if (s9 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c79) { - s10 = peg$c79; + if (input.substr(peg$currPos, 2) === peg$c85) { + s10 = peg$c85; peg$currPos += 2; } else { s10 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c80); + peg$fail(peg$c86); } } if (s10 !== peg$FAILED) { s11 = peg$parseWhitespace(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c104(s8); + s1 = peg$c107(s8); s0 = s1; } else { peg$currPos = s0; @@ -2525,23 +2440,23 @@ function peg$parse(input, options) { function peg$parseTransitionKey() { var s0; - if (input.substr(peg$currPos, 9) === peg$c72) { - s0 = peg$c72; + if (input.substr(peg$currPos, 9) === peg$c78) { + s0 = peg$c78; peg$currPos += 9; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c73); + peg$fail(peg$c79); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c74) { - s0 = peg$c74; + if (input.substr(peg$currPos, 4) === peg$c80) { + s0 = peg$c80; peg$currPos += 4; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c75); + peg$fail(peg$c81); } } } @@ -2556,29 +2471,29 @@ function peg$parse(input, options) { s1 = peg$parseTransitionKey(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s2 = peg$c60; + s2 = peg$c66; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s2 !== peg$FAILED) { - s3 = peg$parseValue(); + s3 = peg$parseLabel(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 59) { - s4 = peg$c62; + s4 = peg$c68; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c63); + peg$fail(peg$c69); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c105(s1, s3); + s1 = peg$c108(s1, s3); s0 = s1; } else { peg$currPos = s0; @@ -2623,37 +2538,37 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parseWhitespace(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 10) === peg$c106) { - s2 = peg$c106; + if (input.substr(peg$currPos, 10) === peg$c109) { + s2 = peg$c109; peg$currPos += 10; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c107); + peg$fail(peg$c110); } } if (s2 !== peg$FAILED) { s3 = peg$parseWhitespace(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c60; + s4 = peg$c66; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s4 !== peg$FAILED) { s5 = peg$parseWhitespace(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 123) { - s6 = peg$c65; + s6 = peg$c71; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c66); + peg$fail(peg$c72); } } if (s6 !== peg$FAILED) { @@ -2666,20 +2581,20 @@ function peg$parse(input, options) { if (s8 !== peg$FAILED) { s9 = peg$parseWhitespace(); if (s9 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c79) { - s10 = peg$c79; + if (input.substr(peg$currPos, 2) === peg$c85) { + s10 = peg$c85; peg$currPos += 2; } else { s10 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c80); + peg$fail(peg$c86); } } if (s10 !== peg$FAILED) { s11 = peg$parseWhitespace(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c108(s8); + s1 = peg$c111(s8); s0 = s1; } else { peg$currPos = s0; @@ -2735,25 +2650,25 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parseWhitespace(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c109) { - s2 = peg$c109; + if (input.substr(peg$currPos, 8) === peg$c112) { + s2 = peg$c112; peg$currPos += 8; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c110); + peg$fail(peg$c113); } } if (s2 !== peg$FAILED) { s3 = peg$parseWhitespace(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c60; + s4 = peg$c66; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s4 !== peg$FAILED) { @@ -2764,19 +2679,19 @@ function peg$parse(input, options) { s7 = peg$parseWhitespace(); if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 59) { - s8 = peg$c62; + s8 = peg$c68; peg$currPos++; } else { s8 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c63); + peg$fail(peg$c69); } } if (s8 !== peg$FAILED) { s9 = peg$parseWhitespace(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c111(s6); + s1 = peg$c114(s6); s0 = s1; } else { peg$currPos = s0; @@ -2824,25 +2739,25 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parseWhitespace(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 25) === peg$c112) { - s2 = peg$c112; + if (input.substr(peg$currPos, 25) === peg$c115) { + s2 = peg$c115; peg$currPos += 25; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c113); + peg$fail(peg$c116); } } if (s2 !== peg$FAILED) { s3 = peg$parseWhitespace(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c60; + s4 = peg$c66; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s4 !== peg$FAILED) { @@ -2853,19 +2768,19 @@ function peg$parse(input, options) { s7 = peg$parseWhitespace(); if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 59) { - s8 = peg$c62; + s8 = peg$c68; peg$currPos++; } else { s8 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c63); + peg$fail(peg$c69); } } if (s8 !== peg$FAILED) { s9 = peg$parseWhitespace(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c114(s6); + s1 = peg$c117(s6); s0 = s1; } else { peg$currPos = s0; @@ -2913,25 +2828,25 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parseWhitespace(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 25) === peg$c115) { - s2 = peg$c115; + if (input.substr(peg$currPos, 25) === peg$c118) { + s2 = peg$c118; peg$currPos += 25; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c116); + peg$fail(peg$c119); } } if (s2 !== peg$FAILED) { s3 = peg$parseWhitespace(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c60; + s4 = peg$c66; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s4 !== peg$FAILED) { @@ -2942,19 +2857,19 @@ function peg$parse(input, options) { s7 = peg$parseWhitespace(); if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 59) { - s8 = peg$c62; + s8 = peg$c68; peg$currPos++; } else { s8 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c63); + peg$fail(peg$c69); } } if (s8 !== peg$FAILED) { s9 = peg$parseWhitespace(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c117(s6); + s1 = peg$c120(s6); s0 = s1; } else { peg$currPos = s0; @@ -3033,37 +2948,37 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parseWhitespace(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c118) { - s2 = peg$c118; + if (input.substr(peg$currPos, 5) === peg$c121) { + s2 = peg$c121; peg$currPos += 5; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c119); + peg$fail(peg$c122); } } if (s2 !== peg$FAILED) { s3 = peg$parseWhitespace(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c60; + s4 = peg$c66; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c61); + peg$fail(peg$c67); } } if (s4 !== peg$FAILED) { s5 = peg$parseWhitespace(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 123) { - s6 = peg$c65; + s6 = peg$c71; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c66); + peg$fail(peg$c72); } } if (s6 !== peg$FAILED) { @@ -3076,20 +2991,20 @@ function peg$parse(input, options) { if (s8 !== peg$FAILED) { s9 = peg$parseWhitespace(); if (s9 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c79) { - s10 = peg$c79; + if (input.substr(peg$currPos, 2) === peg$c85) { + s10 = peg$c85; peg$currPos += 2; } else { s10 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c80); + peg$fail(peg$c86); } } if (s10 !== peg$FAILED) { s11 = peg$parseWhitespace(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c120(s8); + s1 = peg$c123(s8); s0 = s1; } else { peg$currPos = s0; @@ -3217,6 +3132,7 @@ var weighted_rand_select = function weighted_rand_select(options) { if (!Array.isArray(options)) { throw new TypeError('options must be a non-empty array of objects'); } + if (!(_typeof(options[0]) === 'object')) { throw new TypeError('options must be a non-empty array of objects'); } @@ -3388,7 +3304,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var version = '2.7.1'; // replaced from package.js in build +var version = '2.8.1'; // replaced from package.js in build // whargarbl lots of these return arrays could/should be sets diff --git a/dist/jssm.es5.cjs.min.js b/dist/jssm.es5.cjs.min.js index f37a2de0..b6cc2e46 100644 --- a/dist/jssm.es5.cjs.min.js +++ b/dist/jssm.es5.cjs.min.js @@ -1 +1 @@ -require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;opeg$maxFailPos&&(peg$maxFailPos=peg$currPos,peg$maxFailExpected=[]),peg$maxFailExpected.push(expected))}function peg$buildStructuredError(expected,found,location){return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected,found),expected,found,location)}function peg$parseDocument(){var s0,s1,s2;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED&&(s2=peg$parseTermList())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c0(s2)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGvizShape(){var s0;return input.substr(peg$currPos,6)===peg$c1?(s0=peg$c1,peg$currPos+=6):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c2)),s0===peg$FAILED&&(input.substr(peg$currPos,9)===peg$c3?(s0=peg$c3,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c4)),s0===peg$FAILED&&(input.substr(peg$currPos,6)===peg$c5?(s0=peg$c5,peg$currPos+=6):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c6)))),s0}function peg$parseForwardArrow(){var s0;return peg$silentFails++,input.substr(peg$currPos,2)===peg$c8?(s0=peg$c8,peg$currPos+=2):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c9)),peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c7)),s0}function peg$parseTwoWayArrow(){var s0;return peg$silentFails++,input.substr(peg$currPos,3)===peg$c11?(s0=peg$c11,peg$currPos+=3):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c12)),peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c10)),s0}function peg$parseArrow(){var s0;return(s0=peg$parseForwardArrow())===peg$FAILED&&(s0=peg$parseTwoWayArrow()),s0}function peg$parseHexDigit(){var s0;return peg$c13.test(input.charAt(peg$currPos))?(s0=input.charAt(peg$currPos),peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c14)),s0}function peg$parseChar(){var s0,s2,s3,s4,s5,s6,s7,s8,s9;return(s0=peg$parseUnescaped())===peg$FAILED&&(s0=peg$currPos,peg$parseEscape()!==peg$FAILED?(34===input.charCodeAt(peg$currPos)?(s2=peg$c15,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c16)),s2===peg$FAILED&&(92===input.charCodeAt(peg$currPos)?(s2=peg$c17,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c18)),s2===peg$FAILED&&(47===input.charCodeAt(peg$currPos)?(s2=peg$c19,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c20)),s2===peg$FAILED&&(s2=peg$currPos,98===input.charCodeAt(peg$currPos)?(s3=peg$c21,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c22)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c23()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,102===input.charCodeAt(peg$currPos)?(s3=peg$c24,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c25)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c26()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,110===input.charCodeAt(peg$currPos)?(s3=peg$c27,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c28)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c29()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,114===input.charCodeAt(peg$currPos)?(s3=peg$c30,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c31)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c32()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,116===input.charCodeAt(peg$currPos)?(s3=peg$c33,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c34)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c35()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,118===input.charCodeAt(peg$currPos)?(s3=peg$c36,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c37)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c38()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,117===input.charCodeAt(peg$currPos)?(s3=peg$c39,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c40)),s3!==peg$FAILED?(s4=peg$currPos,s5=peg$currPos,(s6=peg$parseHexDigit())!==peg$FAILED&&(s7=peg$parseHexDigit())!==peg$FAILED&&(s8=peg$parseHexDigit())!==peg$FAILED&&(s9=peg$parseHexDigit())!==peg$FAILED?s5=s6=[s6,s7,s8,s9]:(peg$currPos=s5,s5=peg$FAILED),(s4=s5!==peg$FAILED?input.substring(s4,peg$currPos):s5)!==peg$FAILED?(peg$savedPos=s2,s2=s3=peg$c41(s4)):(peg$currPos=s2,s2=peg$FAILED)):(peg$currPos=s2,s2=peg$FAILED)))))))))),s2!==peg$FAILED?(peg$savedPos=s0,s0=peg$c42(s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)),s0}function peg$parseEscape(){var s0;return 92===input.charCodeAt(peg$currPos)?(s0=peg$c17,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c18)),s0}function peg$parseQuoteMark(){var s0;return 34===input.charCodeAt(peg$currPos)?(s0=peg$c15,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c16)),s0}function peg$parseUnescaped(){var s0;return peg$c43.test(input.charAt(peg$currPos))?(s0=input.charAt(peg$currPos),peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c44)),s0}function peg$parseActionLabelChar(){var s0,s2,s3,s4,s5,s6,s7,s8,s9;return(s0=peg$parseActionLabelUnescaped())===peg$FAILED&&(s0=peg$currPos,peg$parseEscape()!==peg$FAILED?(96===input.charCodeAt(peg$currPos)?(s2=peg$c45,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c46)),s2===peg$FAILED&&(92===input.charCodeAt(peg$currPos)?(s2=peg$c17,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c18)),s2===peg$FAILED&&(47===input.charCodeAt(peg$currPos)?(s2=peg$c19,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c20)),s2===peg$FAILED&&(s2=peg$currPos,98===input.charCodeAt(peg$currPos)?(s3=peg$c21,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c22)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c23()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,102===input.charCodeAt(peg$currPos)?(s3=peg$c24,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c25)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c26()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,110===input.charCodeAt(peg$currPos)?(s3=peg$c27,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c28)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c29()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,114===input.charCodeAt(peg$currPos)?(s3=peg$c30,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c31)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c32()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,116===input.charCodeAt(peg$currPos)?(s3=peg$c33,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c34)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c35()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,118===input.charCodeAt(peg$currPos)?(s3=peg$c36,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c37)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c38()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,117===input.charCodeAt(peg$currPos)?(s3=peg$c39,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c40)),s3!==peg$FAILED?(s4=peg$currPos,s5=peg$currPos,(s6=peg$parseHexDigit())!==peg$FAILED&&(s7=peg$parseHexDigit())!==peg$FAILED&&(s8=peg$parseHexDigit())!==peg$FAILED&&(s9=peg$parseHexDigit())!==peg$FAILED?s5=s6=[s6,s7,s8,s9]:(peg$currPos=s5,s5=peg$FAILED),(s4=s5!==peg$FAILED?input.substring(s4,peg$currPos):s5)!==peg$FAILED?(peg$savedPos=s2,s2=s3=peg$c41(s4)):(peg$currPos=s2,s2=peg$FAILED)):(peg$currPos=s2,s2=peg$FAILED)))))))))),s2!==peg$FAILED?(peg$savedPos=s0,s0=peg$c42(s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)),s0}function peg$parseActionLabelQuoteMark(){var s0;return 96===input.charCodeAt(peg$currPos)?(s0=peg$c45,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c46)),s0}function peg$parseActionLabelUnescaped(){var s0;return peg$c47.test(input.charAt(peg$currPos))?(s0=input.charAt(peg$currPos),peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c48)),s0}function peg$parseActionLabel(){var s0,s2,s3;if(peg$silentFails++,s0=peg$currPos,peg$parseActionLabelQuoteMark()!==peg$FAILED){for(s2=[],s3=peg$parseActionLabelChar();s3!==peg$FAILED;)s2.push(s3),s3=peg$parseActionLabelChar();s2!==peg$FAILED&&(s3=peg$parseActionLabelQuoteMark())!==peg$FAILED?(peg$savedPos=s0,s0=peg$c50(s2)):(peg$currPos=s0,s0=peg$FAILED)}else peg$currPos=s0,s0=peg$FAILED;return peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c49)),s0}function peg$parseWhitespace(){var s0,s1;for(peg$silentFails++,s0=[],peg$c52.test(input.charAt(peg$currPos))?(s1=input.charAt(peg$currPos),peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c53));s1!==peg$FAILED;)s0.push(s1),peg$c52.test(input.charAt(peg$currPos))?(s1=input.charAt(peg$currPos),peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c53));return peg$silentFails--,s0===peg$FAILED&&(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c51)),s0}function peg$parseString(){var s0,s2,s3;if(peg$silentFails++,s0=peg$currPos,peg$parseQuoteMark()!==peg$FAILED){for(s2=[],s3=peg$parseChar();s3!==peg$FAILED;)s2.push(s3),s3=peg$parseChar();s2!==peg$FAILED&&(s3=peg$parseQuoteMark())!==peg$FAILED?(peg$savedPos=s0,s0=peg$c50(s2)):(peg$currPos=s0,s0=peg$FAILED)}else peg$currPos=s0,s0=peg$FAILED;return peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c54)),s0}function peg$parseAtom(){var s0,s1,s2;if(peg$silentFails++,s0=peg$currPos,s1=[],peg$c56.test(input.charAt(peg$currPos))?(s2=input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c57)),s2!==peg$FAILED)for(;s2!==peg$FAILED;)s1.push(s2),peg$c56.test(input.charAt(peg$currPos))?(s2=input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c57));else s1=peg$FAILED;return s1!==peg$FAILED&&(peg$savedPos=s0,s1=peg$c58(s1)),s0=s1,peg$silentFails--,s0===peg$FAILED&&(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c55)),s0}function peg$parseLabel(){var s0;return peg$silentFails++,(s0=peg$parseAtom())===peg$FAILED&&(s0=peg$parseString()),peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c59)),s0}function peg$parseValue(){return peg$parseLabel()}function peg$parseItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseLabel(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c60,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s2!==peg$FAILED&&(s3=peg$parseValue())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c62,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c64(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseItems(){var s0,s1;if(s0=[],(s1=peg$parseItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseItem();else s0=peg$FAILED;return s0}function peg$parseArrowDesc(){var s0,s1,s2,s3;return s0=peg$currPos,123===input.charCodeAt(peg$currPos)?(s1=peg$c65,peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c66)),s1!==peg$FAILED?((s2=peg$parseItems())===peg$FAILED&&(s2=null),s2!==peg$FAILED?(125===input.charCodeAt(peg$currPos)?(s3=peg$c67,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c68)),s3!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c69(s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseSubexp(){var s0,s1,s2,s4,s6,s8,s10,s12,s14;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?((s2=peg$parseActionLabel())===peg$FAILED&&(s2=null),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s4=peg$parseArrowDesc())===peg$FAILED&&(s4=null),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseArrow())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseArrowDesc())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s10=peg$parseActionLabel())===peg$FAILED&&(s10=null),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s12=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s14=peg$parseSubexp())===peg$FAILED&&(s14=null),s14!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c70(s2,s4,s6,s8,s10,s12,s14)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseExp(){var s0,s1,s2,s4;return s0=peg$currPos,s1=peg$parseLabel(),s1!==peg$FAILED&&(s2=peg$parseSubexp())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c62,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c71(s1,s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseValidationKey(){var s0;return input.substr(peg$currPos,9)===peg$c72?(s0=peg$c72,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c73)),s0===peg$FAILED&&(input.substr(peg$currPos,4)===peg$c74?(s0=peg$c74,peg$currPos+=4):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75))),s0}function peg$parseValidationItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseValidationKey(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c60,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s2!==peg$FAILED&&(s3=peg$parseValue())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c62,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c76(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseValidationItems(){var s0,s1;if(s0=[],(s1=peg$parseValidationItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseValidationItem();else s0=peg$FAILED;return s0}function peg$parseConfigValidation(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,10)===peg$c77?(s2=peg$c77,peg$currPos+=10):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c78)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c60,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c65,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c66)),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseValidationItems())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c79?(s10=peg$c79,peg$currPos+=2):(s10=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c80)),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c81(s8)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGvizLayout(){var s0;return input.substr(peg$currPos,3)===peg$c82?(s0=peg$c82,peg$currPos+=3):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c83)),s0===peg$FAILED&&(input.substr(peg$currPos,5)===peg$c84?(s0=peg$c84,peg$currPos+=5):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c85))),s0}function peg$parseInShape(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,8)===peg$c86?(s2=peg$c86,peg$currPos+=8):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c87)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c60,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c62,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c88(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseOutShape(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,9)===peg$c89?(s2=peg$c89,peg$currPos+=9):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c90)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c60,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c62,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c91(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseNodeShape(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,10)===peg$c92?(s2=peg$c92,peg$currPos+=10):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c93)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c60,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c62,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c94(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGraphLayout(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,12)===peg$c95?(s2=peg$c95,peg$currPos+=12):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c96)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c60,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizLayout())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c62,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c97(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseStateItem(){var s0;return(s0=peg$parseInShape())===peg$FAILED&&(s0=peg$parseOutShape())===peg$FAILED&&(s0=peg$parseNodeShape())===peg$FAILED&&(s0=peg$parseGraphLayout()),s0}function peg$parseStateItems(){var s0,s1;if(s0=[],(s1=peg$parseStateItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseStateItem();else s0=peg$FAILED;return s0}function peg$parseConfigState(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,5)===peg$c98?(s2=peg$c98,peg$currPos+=5):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c99)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c60,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c65,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c66)),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseStateItems())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c79?(s10=peg$c79,peg$currPos+=2):(s10=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c80)),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c100(s8)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseActionKey(){var s0;return input.substr(peg$currPos,9)===peg$c72?(s0=peg$c72,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c73)),s0===peg$FAILED&&(input.substr(peg$currPos,4)===peg$c74?(s0=peg$c74,peg$currPos+=4):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75))),s0}function peg$parseActionItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseActionKey(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c60,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s2!==peg$FAILED&&(s3=peg$parseValue())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c62,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c101(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseActionItems(){var s0,s1;if(s0=[],(s1=peg$parseActionItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseActionItem();else s0=peg$FAILED;return s0}function peg$parseConfigAction(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,6)===peg$c102?(s2=peg$c102,peg$currPos+=6):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c103)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c60,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c65,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c66)),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseActionItems())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c79?(s10=peg$c79,peg$currPos+=2):(s10=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c80)),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c104(s8)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseTransitionKey(){var s0;return input.substr(peg$currPos,9)===peg$c72?(s0=peg$c72,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c73)),s0===peg$FAILED&&(input.substr(peg$currPos,4)===peg$c74?(s0=peg$c74,peg$currPos+=4):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75))),s0}function peg$parseTransitionItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseTransitionKey(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c60,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s2!==peg$FAILED&&(s3=peg$parseValue())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c62,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c105(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseTransitionItems(){var s0,s1;if(s0=[],(s1=peg$parseTransitionItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseTransitionItem();else s0=peg$FAILED;return s0}function peg$parseConfigTransition(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,10)===peg$c106?(s2=peg$c106,peg$currPos+=10):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c107)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c60,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c65,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c66)),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseTransitionItems())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c79?(s10=peg$c79,peg$currPos+=2):(s10=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c80)),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c108(s8)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGraphBg(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,8)===peg$c109?(s2=peg$c109,peg$currPos+=8):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c110)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c60,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c62,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c111(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseMinTransitionsPerState(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,25)===peg$c112?(s2=peg$c112,peg$currPos+=25):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c113)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c60,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c62,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c114(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseMaxTransitionsPerState(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,25)===peg$c115?(s2=peg$c115,peg$currPos+=25):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c116)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c60,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c62,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c117(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGraphItem(){var s0;return(s0=peg$parseGraphBg())===peg$FAILED&&(s0=peg$parseMinTransitionsPerState())===peg$FAILED&&(s0=peg$parseMaxTransitionsPerState()),s0}function peg$parseGraphItems(){var s0,s1;if(s0=[],(s1=peg$parseGraphItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseGraphItem();else s0=peg$FAILED;return s0}function peg$parseConfigGraph(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,5)===peg$c118?(s2=peg$c118,peg$currPos+=5):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c119)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c60,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c65,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c66)),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseGraphItems())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c79?(s10=peg$c79,peg$currPos+=2):(s10=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c80)),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c120(s8)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseConfig(){var s0;return(s0=peg$parseConfigGraph())===peg$FAILED&&(s0=peg$parseConfigTransition())===peg$FAILED&&(s0=peg$parseConfigAction())===peg$FAILED&&(s0=peg$parseConfigState())===peg$FAILED&&(s0=peg$parseConfigValidation()),s0}function peg$parseTerm(){var s0;return(s0=peg$parseExp())===peg$FAILED&&(s0=peg$parseConfig()),s0}function peg$parseTermList(){var s0,s1;for(s0=[],s1=peg$parseTerm();s1!==peg$FAILED;)s0.push(s1),s1=peg$parseTerm();return s0}options=void 0!==options?options:{};var peg$result,peg$FAILED={},peg$startRuleFunctions={Document:peg$parseDocument},peg$startRuleFunction=peg$parseDocument,peg$c0=function(e){return e},peg$c1="square",peg$c2=peg$literalExpectation("square",!1),peg$c3="rectangle",peg$c4=peg$literalExpectation("rectangle",!1),peg$c5="circle",peg$c6=peg$literalExpectation("circle",!1),peg$c7=peg$otherExpectation("forward arrow"),peg$c8="->",peg$c9=peg$literalExpectation("->",!1),peg$c10=peg$otherExpectation("two way arrow"),peg$c11="<->",peg$c12=peg$literalExpectation("<->",!1),peg$c13=/^[0-9a-fA-F]/,peg$c14=peg$classExpectation([["0","9"],["a","f"],["A","F"]],!1,!1),peg$c15='"',peg$c16=peg$literalExpectation('"',!1),peg$c17="\\",peg$c18=peg$literalExpectation("\\",!1),peg$c19="/",peg$c20=peg$literalExpectation("/",!1),peg$c21="b",peg$c22=peg$literalExpectation("b",!1),peg$c23=function(){return"\b"},peg$c24="f",peg$c25=peg$literalExpectation("f",!1),peg$c26=function(){return"\f"},peg$c27="n",peg$c28=peg$literalExpectation("n",!1),peg$c29=function(){return"\n"},peg$c30="r",peg$c31=peg$literalExpectation("r",!1),peg$c32=function(){return"\r"},peg$c33="t",peg$c34=peg$literalExpectation("t",!1),peg$c35=function(){return"\t"},peg$c36="v",peg$c37=peg$literalExpectation("v",!1),peg$c38=function(){return"\v"},peg$c39="u",peg$c40=peg$literalExpectation("u",!1),peg$c41=function(digits){return String.fromCharCode(parseInt(digits,16))},peg$c42=function(Sequence){return Sequence},peg$c43=/^[ -!#-[\]-\u10FFFF]/,peg$c44=peg$classExpectation([[" ","!"],["#","["],["]","ჿ"],"F","F"],!1,!1),peg$c45="`",peg$c46=peg$literalExpectation("`",!1),peg$c47=/^[ -[\]-_a-\u10FFFF]/,peg$c48=peg$classExpectation([[" ","["],["]","_"],["a","ჿ"],"F","F"],!1,!1),peg$c49=peg$otherExpectation("action label"),peg$c50=function(chars){return chars.join("")},peg$c51=peg$otherExpectation("whitespace"),peg$c52=/^[ \t\n\r\x0B]/,peg$c53=peg$classExpectation([" ","\t","\n","\r","\v"],!1,!1),peg$c54=peg$otherExpectation("string"),peg$c55=peg$otherExpectation("atom"),peg$c56=/^[0-9a-zA-Z.+_&()%$#@!?,']/,peg$c57=peg$classExpectation([["0","9"],["a","z"],["A","Z"],".","+","_","&","(",")","%","$","#","@","!","?",",","'"],!1,!1),peg$c58=function(text){return text.join("")},peg$c59=peg$otherExpectation("label"),peg$c60=":",peg$c61=peg$literalExpectation(":",!1),peg$c62=";",peg$c63=peg$literalExpectation(";",!1),peg$c64=function(text,value){return{text:text,value:value}},peg$c65="{",peg$c66=peg$literalExpectation("{",!1),peg$c67="}",peg$c68=peg$literalExpectation("}",!1),peg$c69=function(items){return items},peg$c70=function(lactl,ldesc,arrow,rdesc,ractl,label,tail){var base={kind:arrow,to:label};return tail&&tail!==[]&&(base.se=tail),ldesc&&(base.ldesc=ldesc),rdesc&&(base.rdesc=rdesc),base},peg$c71=function(label,se){var base={from:label};return se&&se!==[]&&(base.se=se),base},peg$c72="whargarbl",peg$c73=peg$literalExpectation("whargarbl",!1),peg$c74="todo",peg$c75=peg$literalExpectation("todo",!1),peg$c76=function(validationkey,value){return{key:validationkey,value:value}},peg$c77="validation",peg$c78=peg$literalExpectation("validation",!1),peg$c79="};",peg$c80=peg$literalExpectation("};",!1),peg$c81=function(validation_items){return{config_kind:"validation",config_items:validation_items||[]}},peg$c82="dot",peg$c83=peg$literalExpectation("dot",!1),peg$c84="circo",peg$c85=peg$literalExpectation("circo",!1),peg$c86="in_shape",peg$c87=peg$literalExpectation("in_shape",!1),peg$c88=function(value){return{key:"in_shape",value:value}},peg$c89="out_shape",peg$c90=peg$literalExpectation("out_shape",!1),peg$c91=function(value){return{key:"out_shape",value:value}},peg$c92="node_shape",peg$c93=peg$literalExpectation("node_shape",!1),peg$c94=function(value){return{key:"node_shape",value:value}},peg$c95="graph_layout",peg$c96=peg$literalExpectation("graph_layout",!1),peg$c97=function(value){return{key:"graph_layout",value:value}},peg$c98="state",peg$c99=peg$literalExpectation("state",!1),peg$c100=function(state_items){return{config_kind:"state",config_items:state_items||[]}},peg$c101=function(actionkey,value){return{key:actionkey,value:value}},peg$c102="action",peg$c103=peg$literalExpectation("action",!1),peg$c104=function(action_items){return{config_kind:"action",config_items:action_items||[]}},peg$c105=function(transitionkey,value){return{key:transitionkey,value:value}},peg$c106="transition",peg$c107=peg$literalExpectation("transition",!1),peg$c108=function(transition_items){return{config_kind:"transition",config_items:transition_items||[]}},peg$c109="graph_bg",peg$c110=peg$literalExpectation("graph_bg",!1),peg$c111=function(value){return{key:"graph_bg",value:value}},peg$c112="min_transitions_per_state",peg$c113=peg$literalExpectation("min_transitions_per_state",!1),peg$c114=function(value){return{key:"min_transitions_per_state",value:value}},peg$c115="max_transitions_per_state",peg$c116=peg$literalExpectation("max_transitions_per_state",!1),peg$c117=function(value){return{key:"max_transitions_per_state",value:value}},peg$c118="graph",peg$c119=peg$literalExpectation("graph",!1),peg$c120=function(graph_items){return{config_kind:"graph",config_items:graph_items||[]}},peg$currPos=0,peg$savedPos=0,peg$posDetailsCache=[{line:1,column:1}],peg$maxFailPos=0,peg$maxFailExpected=[],peg$silentFails=0;if("startRule"in options){if(!(options.startRule in peg$startRuleFunctions))throw new Error("Can't start parsing from rule \""+options.startRule+'".');peg$startRuleFunction=peg$startRuleFunctions[options.startRule]}if((peg$result=peg$startRuleFunction())!==peg$FAILED&&peg$currPos===input.length)return peg$result;throw peg$result!==peg$FAILED&&peg$currPos0){for(i=1,j=1;i1&&void 0!==arguments[1]?arguments[1]:"probability";if(!Array.isArray(options))throw new TypeError("options must be a non-empty array of objects");if("object"!==_typeof(options[0]))throw new TypeError("options must be a non-empty array of objects");for(var rnd=function(cap){return Math.random()*cap}(options.reduce(function(acc,val){return acc+val[probability_property]},0)),cursor=0,cursor_sum=0;(cursor_sum+=options[cursor++][probability_property])<=rnd;);return options[cursor-1]},seq=function(n){return new Array(n).fill(!0).map(function(_,i){return i})},histograph=function(a){return a.sort().reduce(function(m,v){return m.set(v,m.has(v)?m.get(v)+1:1),m},new Map)},weighted_sample_select=function(n,options,probability_property){return seq(n).map(function(i){return weighted_rand_select(options,probability_property)})},weighted_histo_key=function(n,options,probability_property,extract){return histograph(weighted_sample_select(n,options,probability_property).map(function(s){return s[extract]}))};exports.seq=seq,exports.histograph=histograph,exports.weighted_histo_key=weighted_histo_key,exports.weighted_rand_select=weighted_rand_select,exports.weighted_sample_select=weighted_sample_select},{}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var viz=function(jssm){var l_states=jssm.states(),node_of=function(state){return"n"+l_states.indexOf(state)},vc=function(col){return jssm._viz_colors[col]||""},strike=[];return'digraph G {\n fontname="helvetica neue";\n style=filled;\n bgcolor=lightgrey;\n node [fontsize=14; shape=box; style=filled; fillcolor=white; fontname="helvetica neue"];\n edge [fontsize=6;fontname="helvetica neue"];\n\n '+l_states.map(function(s){jssm.state_for(s);var terminal=jssm.state_is_terminal(s),final=jssm.state_is_final(s),complete=jssm.state_is_complete(s),features=[["label",s],["peripheries",complete?2:1],["fillcolor",final?vc("fill_final"):complete?vc("fill_complete"):terminal?vc("fill_terminal"):""]].filter(function(r){return r[1]}).map(function(r){return r[0]+'="'+r[1]+'"'}).join(" ");return node_of(s)+" ["+features+"];"}).join(" ")+"\n\n "+jssm.states().map(function(s){return jssm.list_exits(s).map(function(ex){if(strike.find(function(row){return row[0]===s&&row[1]==ex}))return"";var edge=jssm.list_transitions(s,ex),pair=jssm.list_transitions(ex,s),double=pair&&s!==ex,if_obj_field=(jssm.state_for(s),jssm.state_for(ex),function(obj,field){return obj?obj[field]||"":""}),h_final=jssm.state_is_final(s),h_complete=jssm.state_is_complete(s),h_terminal=jssm.state_is_terminal(s),t_final=jssm.state_is_final(ex),t_complete=jssm.state_is_complete(ex),t_terminal=jssm.state_is_terminal(ex),lineColor=function(final,complete,terminal){var _solo_1_2=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"_solo";return vc(final?"line_final"+_solo_1_2:complete?"line_complete"+_solo_1_2:terminal?"line_terminal"+_solo_1_2:"normal_line"+_solo_1_2)},textColor=function(final,complete,terminal){var _solo_1_2=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"_solo";return final?vc("text_final"+_solo_1_2):complete?vc("text_complete"+_solo_1_2):terminal?vc("text_terminal"+_solo_1_2):""},labelInline=[[pair,"probability","headlabel","name","action",double,textColor(h_final,h_complete,h_terminal,double?"_1":"_solo")],[edge,"probability","taillabel","name","action",!0,textColor(t_final,t_complete,t_terminal,double?"_2":"_solo")]].map(function(r){return{which:r[2],whether:r[5]?[if_obj_field(r[0],r[5]),if_obj_field(r[0],r[1]),if_obj_field(r[0],r[3])].filter(function(q){return q}).join("
")||"":"",color:r[6]}}).filter(function(present){return present.whether}).map(function(r){return r.which+"="+(r.color?'<'+r.whether+">":'"'+r.whether+'"')+";"}).join(" "),tc1=lineColor(t_final,t_complete,t_terminal,"_1"),tc2=lineColor(h_final,h_complete,h_terminal,"_2"),tcd=lineColor(t_final,t_complete,t_terminal,"_solo"),edgeInline=edge?double?'dir=both;color="'+tc1+":"+tc2+'"':'color="'+tcd+'"':"";return pair&&strike.push([ex,s]),node_of(s)+"->"+node_of(ex)+" ["+labelInline+edgeInline+"];"}).join(" ")}).join(" ")+"\n}"};exports.viz=viz},{}],jssm:[function(require,module,exports){"use strict";function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i to already exists "+tr.from+" "+tr.to);if(from_mapping.set(tr.to,thisEdgeId),tr.action){_this._actions.has(tr.action)||_this._actions.set(tr.action,new Map);var actionMap=_this._actions.get(tr.action);if(!actionMap)throw new Error("should be impossible, satisfying type checker that doesn't know .set precedes .get. severe error?");if(actionMap.has(tr.from))throw new Error("action "+tr.action+" already attached to origin "+tr.from);actionMap.set(tr.from,thisEdgeId),_this._reverse_actions.has(tr.from)||_this._reverse_actions.set(tr.from,new Map);var rActionMap=_this._reverse_actions.get(tr.from);if(!rActionMap)throw new Error("should be impossible, satisfying type checker that doesn't know .set precedes .get again. severe error?");if(rActionMap.has(tr.action))throw new Error("r-action "+tr.from+" already attached to action "+tr.action);rActionMap.set(tr.action,thisEdgeId),_this._reverse_action_targets.has(tr.to)||_this._reverse_action_targets.set(tr.to,new Map)}})}return _createClass(machine,[{key:"_new_state",value:function(state_config){if(this._states.has(state_config.name))throw new Error("state "+state_config.name+" already exists");return this._states.set(state_config.name,state_config),state_config.name}},{key:"state",value:function(){return this._state}},{key:"is_changing",value:function(){return!0}},{key:"state_is_final",value:function(whichState){return this.state_is_terminal(whichState)&&this.state_is_complete(whichState)}},{key:"is_final",value:function(){return!this.is_changing()&&this.state_is_final(this.state())}},{key:"machine_state",value:function(){return{internal_state_impl_version:1,actions:this._actions,edge_map:this._edge_map,edges:this._edges,named_transitions:this._named_transitions,reverse_actions:this._reverse_actions,state:this._state,states:this._states}}},{key:"load_machine_state",value:function(){return!1}},{key:"states",value:function(){return[].concat(_toConsumableArray(this._states.keys()))}},{key:"state_for",value:function(whichState){var state=this._states.get(whichState);if(state)return state;throw new Error("no such state "+JSON.stringify(state))}},{key:"list_transitions",value:function(){return this._edges}},{key:"list_named_transitions",value:function(){return this._named_transitions}},{key:"list_actions",value:function(){return[].concat(_toConsumableArray(this._actions.keys()))}},{key:"get_transition_by_id",value:function(from,to){return this._edge_map.has(from)?this._edge_map.get(from).get(to):void 0}},{key:"lookup_transition_for",value:function(from,to){var id=this.get_transition_by_id(from,to);return void 0===id?void 0:this._edges[id]}},{key:"list_transitions",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return{entrances:this.list_entrances(whichState),exits:this.list_exits(whichState)}}},{key:"list_entrances",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return(this._states.get(whichState)||{}).from}},{key:"list_exits",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return(this._states.get(whichState)||{}).to}},{key:"probable_exits_for",value:function(whichState){var _this2=this;return(this._states.get(whichState)||{to:[]}).to.map(function(ws){return _this2.lookup_transition_for(_this2.state(),ws)}).filter(function(defined){return defined})||[]}},{key:"probabilistic_transition",value:function(){var selected=(0,_jssmUtil.weighted_rand_select)(this.probable_exits_for(this.state()));return this.transition(selected.to)}},{key:"probabilistic_walk",value:function(n){var _this3=this;return(0,_jssmUtil.seq)(n-1).map(function(i){var state_was=_this3.state();return _this3.probabilistic_transition(),state_was}).concat([this.state()])}},{key:"probabilistic_histo_walk",value:function(n){return(0,_jssmUtil.histograph)(this.probabilistic_walk(n))}},{key:"actions",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state(),wstate=this._reverse_actions.get(whichState);if(wstate)return[].concat(_toConsumableArray(wstate.keys()));throw new Error("No such state "+JSON.stringify(whichState))}},{key:"list_states_having_action",value:function(whichState){var wstate=this._actions.get(whichState);if(wstate)return[].concat(_toConsumableArray(wstate.keys()));throw new Error("No such state "+JSON.stringify(whichState))}},{key:"list_exit_actions",value:function(){var _this4=this,whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return[].concat(_toConsumableArray((this._reverse_actions.get(whichState)||new Map).values())).map(function(edgeId){return _this4._edges[edgeId]}).filter(function(o){return o.from===whichState}).map(function(filtered){return filtered.action})}},{key:"probable_action_exits",value:function(){var _this5=this,whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return[].concat(_toConsumableArray((this._reverse_actions.get(whichState)||new Map).values())).map(function(edgeId){return _this5._edges[edgeId]}).filter(function(o){return o.from===whichState}).map(function(filtered){return{action:filtered.action,probability:filtered.probability}})}},{key:"is_unenterable",value:function(whichState){return 0===this.list_entrances(whichState).length}},{key:"has_unenterables",value:function(){return this.states.some(this.is_unenterable)}},{key:"is_terminal",value:function(){return this.state_is_terminal(this.state())}},{key:"state_is_terminal",value:function(whichState){return 0===this.list_exits(whichState).length}},{key:"has_terminals",value:function(){return this.states.some(this.state_is_terminal)}},{key:"is_complete",value:function(){return this.state_is_complete(this.state())}},{key:"state_is_complete",value:function(whichState){var wstate=this._states.get(whichState);if(wstate)return wstate.complete;throw new Error("No such state "+JSON.stringify(whichState))}},{key:"has_completes",value:function(){return this.states.some(this.state_is_complete)}},{key:"action",value:function(name,newData){if(this.valid_action(name,newData)){var edge=this.current_action_edge_for(name);if(!edge)throw new Error("Should be impossible - valid_action true, no edge in current_action_edge_for, in action("+JSON.stringify(name)+"...)");return this._state=edge.to,!0}return!1}},{key:"transition",value:function(newState,newData){return!!this.valid_transition(newState,newData)&&(this._state=newState,!0)}},{key:"force_transition",value:function(newState,newData){return!!this.valid_force_transition(newState,newData)&&(this._state=newState,!0)}},{key:"current_action_for",value:function(action){var action_base=this._actions.get(action);return action_base?action_base.get(this.state()):void 0}},{key:"current_action_edge_for",value:function(action){var idx=this.current_action_for(action);return void 0!==idx?this._edges[idx]:void 0}},{key:"valid_action",value:function(action,newData){return void 0!==this.current_action_for(action)}},{key:"valid_transition",value:function(newState,newData){return void 0!==this.lookup_transition_for(this.state(),newState)}},{key:"valid_force_transition",value:function(newState,newData){return!1}},{key:"viz",value:function(){return(0,_jssmViz.viz)(this)}},{key:"set_viz_colors",value:function(){this._viz_colors={fill_final:"#eeeeff",fill_terminal:"#ffeeee",fill_complete:"#eeffee",normal_line_1:"#999999",normal_line_2:"#888888",normal_line_solo:"#888888",line_final_1:"#8888bb",line_final_2:"#7777aa",line_final_solo:"#7777aa",line_terminal_1:"#bb8888",line_terminal_2:"#aa7777",line_terminal_solo:"#aa7777",line_complete_1:"#88bb88",line_complete_2:"#77aa77",line_complete_solo:"#77aa77",text_final_1:"#000088",text_final_2:"#000088",text_final_solo:"#000088",text_terminal_1:"#880000",text_terminal_2:"#880000",text_terminal_solo:"#880000",text_complete_1:"#007700",text_complete_2:"#007700",text_complete_solo:"#007700"}}}]),machine}();exports.version="2.7.1",exports.machine=machine,exports.parse=parse,exports.seq=_jssmUtil.seq,exports.weighted_rand_select=_jssmUtil.weighted_rand_select,exports.histograph=_jssmUtil.histograph,exports.weighted_sample_select=_jssmUtil.weighted_sample_select,exports.weighted_histo_key=_jssmUtil.weighted_histo_key},{"./jssm-dot.js":1,"./jssm-util.js":2,"./jssm-viz.js":3}]},{},[]); \ No newline at end of file +require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;opeg$maxFailPos&&(peg$maxFailPos=peg$currPos,peg$maxFailExpected=[]),peg$maxFailExpected.push(expected))}function peg$buildStructuredError(expected,found,location){return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected,found),expected,found,location)}function peg$parseDocument(){var s0,s1,s2;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED&&(s2=peg$parseTermList())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c0(s2)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGvizShape(){var s0;return input.substr(peg$currPos,6)===peg$c1?(s0=peg$c1,peg$currPos+=6):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c2)),s0===peg$FAILED&&(input.substr(peg$currPos,9)===peg$c3?(s0=peg$c3,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c4)),s0===peg$FAILED&&(input.substr(peg$currPos,6)===peg$c5?(s0=peg$c5,peg$currPos+=6):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c6)))),s0}function peg$parseForwardArrow(){var s0;return peg$silentFails++,input.substr(peg$currPos,2)===peg$c8?(s0=peg$c8,peg$currPos+=2):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c9)),peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c7)),s0}function peg$parseTwoWayArrow(){var s0;return peg$silentFails++,input.substr(peg$currPos,3)===peg$c11?(s0=peg$c11,peg$currPos+=3):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c12)),peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c10)),s0}function peg$parseArrow(){var s0;return(s0=peg$parseForwardArrow())===peg$FAILED&&(s0=peg$parseTwoWayArrow()),s0}function peg$parseHexDigit(){var s0;return peg$c13.test(input.charAt(peg$currPos))?(s0=input.charAt(peg$currPos),peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c14)),s0}function peg$parseChar(){var s0,s2,s3,s4,s5,s6,s7,s8,s9;return(s0=peg$parseUnescaped())===peg$FAILED&&(s0=peg$currPos,peg$parseEscape()!==peg$FAILED?(34===input.charCodeAt(peg$currPos)?(s2=peg$c15,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c16)),s2===peg$FAILED&&(92===input.charCodeAt(peg$currPos)?(s2=peg$c17,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c18)),s2===peg$FAILED&&(47===input.charCodeAt(peg$currPos)?(s2=peg$c19,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c20)),s2===peg$FAILED&&(s2=peg$currPos,98===input.charCodeAt(peg$currPos)?(s3=peg$c21,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c22)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c23()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,102===input.charCodeAt(peg$currPos)?(s3=peg$c24,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c25)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c26()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,110===input.charCodeAt(peg$currPos)?(s3=peg$c27,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c28)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c29()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,114===input.charCodeAt(peg$currPos)?(s3=peg$c30,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c31)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c32()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,116===input.charCodeAt(peg$currPos)?(s3=peg$c33,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c34)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c35()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,118===input.charCodeAt(peg$currPos)?(s3=peg$c36,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c37)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c38()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,117===input.charCodeAt(peg$currPos)?(s3=peg$c39,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c40)),s3!==peg$FAILED?(s4=peg$currPos,s5=peg$currPos,(s6=peg$parseHexDigit())!==peg$FAILED&&(s7=peg$parseHexDigit())!==peg$FAILED&&(s8=peg$parseHexDigit())!==peg$FAILED&&(s9=peg$parseHexDigit())!==peg$FAILED?s5=s6=[s6,s7,s8,s9]:(peg$currPos=s5,s5=peg$FAILED),(s4=s5!==peg$FAILED?input.substring(s4,peg$currPos):s5)!==peg$FAILED?(peg$savedPos=s2,s2=s3=peg$c41(s4)):(peg$currPos=s2,s2=peg$FAILED)):(peg$currPos=s2,s2=peg$FAILED)))))))))),s2!==peg$FAILED?(peg$savedPos=s0,s0=peg$c42(s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)),s0}function peg$parseEscape(){var s0;return 92===input.charCodeAt(peg$currPos)?(s0=peg$c17,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c18)),s0}function peg$parseQuoteMark(){var s0;return 34===input.charCodeAt(peg$currPos)?(s0=peg$c15,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c16)),s0}function peg$parseUnescaped(){var s0;return peg$c43.test(input.charAt(peg$currPos))?(s0=input.charAt(peg$currPos),peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c44)),s0}function peg$parseActionLabelChar(){var s0,s2,s3,s4,s5,s6,s7,s8,s9;return(s0=peg$parseActionLabelUnescaped())===peg$FAILED&&(s0=peg$currPos,peg$parseEscape()!==peg$FAILED?(96===input.charCodeAt(peg$currPos)?(s2=peg$c45,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c46)),s2===peg$FAILED&&(92===input.charCodeAt(peg$currPos)?(s2=peg$c17,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c18)),s2===peg$FAILED&&(47===input.charCodeAt(peg$currPos)?(s2=peg$c19,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c20)),s2===peg$FAILED&&(s2=peg$currPos,98===input.charCodeAt(peg$currPos)?(s3=peg$c21,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c22)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c23()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,102===input.charCodeAt(peg$currPos)?(s3=peg$c24,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c25)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c26()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,110===input.charCodeAt(peg$currPos)?(s3=peg$c27,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c28)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c29()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,114===input.charCodeAt(peg$currPos)?(s3=peg$c30,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c31)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c32()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,116===input.charCodeAt(peg$currPos)?(s3=peg$c33,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c34)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c35()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,118===input.charCodeAt(peg$currPos)?(s3=peg$c36,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c37)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c38()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,117===input.charCodeAt(peg$currPos)?(s3=peg$c39,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c40)),s3!==peg$FAILED?(s4=peg$currPos,s5=peg$currPos,(s6=peg$parseHexDigit())!==peg$FAILED&&(s7=peg$parseHexDigit())!==peg$FAILED&&(s8=peg$parseHexDigit())!==peg$FAILED&&(s9=peg$parseHexDigit())!==peg$FAILED?s5=s6=[s6,s7,s8,s9]:(peg$currPos=s5,s5=peg$FAILED),(s4=s5!==peg$FAILED?input.substring(s4,peg$currPos):s5)!==peg$FAILED?(peg$savedPos=s2,s2=s3=peg$c41(s4)):(peg$currPos=s2,s2=peg$FAILED)):(peg$currPos=s2,s2=peg$FAILED)))))))))),s2!==peg$FAILED?(peg$savedPos=s0,s0=peg$c42(s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)),s0}function peg$parseActionLabelQuoteMark(){var s0;return 96===input.charCodeAt(peg$currPos)?(s0=peg$c45,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c46)),s0}function peg$parseActionLabelUnescaped(){var s0;return peg$c47.test(input.charAt(peg$currPos))?(s0=input.charAt(peg$currPos),peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c48)),s0}function peg$parseActionLabel(){var s0,s2,s3;if(peg$silentFails++,s0=peg$currPos,peg$parseActionLabelQuoteMark()!==peg$FAILED){for(s2=[],s3=peg$parseActionLabelChar();s3!==peg$FAILED;)s2.push(s3),s3=peg$parseActionLabelChar();s2!==peg$FAILED&&(s3=peg$parseActionLabelQuoteMark())!==peg$FAILED?(peg$savedPos=s0,s0=peg$c50(s2)):(peg$currPos=s0,s0=peg$FAILED)}else peg$currPos=s0,s0=peg$FAILED;return peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c49)),s0}function peg$parseWhitespace(){var s0,s1;for(peg$silentFails++,s0=[],peg$c52.test(input.charAt(peg$currPos))?(s1=input.charAt(peg$currPos),peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c53));s1!==peg$FAILED;)s0.push(s1),peg$c52.test(input.charAt(peg$currPos))?(s1=input.charAt(peg$currPos),peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c53));return peg$silentFails--,s0===peg$FAILED&&(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c51)),s0}function peg$parseString(){var s0,s2,s3;if(peg$silentFails++,s0=peg$currPos,peg$parseQuoteMark()!==peg$FAILED){for(s2=[],s3=peg$parseChar();s3!==peg$FAILED;)s2.push(s3),s3=peg$parseChar();s2!==peg$FAILED&&(s3=peg$parseQuoteMark())!==peg$FAILED?(peg$savedPos=s0,s0=peg$c50(s2)):(peg$currPos=s0,s0=peg$FAILED)}else peg$currPos=s0,s0=peg$FAILED;return peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c54)),s0}function peg$parseAtom(){var s0,s1,s2;if(peg$silentFails++,s0=peg$currPos,s1=[],peg$c56.test(input.charAt(peg$currPos))?(s2=input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c57)),s2!==peg$FAILED)for(;s2!==peg$FAILED;)s1.push(s2),peg$c56.test(input.charAt(peg$currPos))?(s2=input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c57));else s1=peg$FAILED;return s1!==peg$FAILED&&(peg$savedPos=s0,s1=peg$c58(s1)),s0=s1,peg$silentFails--,s0===peg$FAILED&&(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c55)),s0}function peg$parseLabel(){var s0;return peg$silentFails++,(s0=peg$parseAtom())===peg$FAILED&&(s0=peg$parseString()),peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c59)),s0}function peg$parseArrowItemKey(){var s0;return input.substr(peg$currPos,9)===peg$c60?(s0=peg$c60,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s0===peg$FAILED&&(input.substr(peg$currPos,10)===peg$c62?(s0=peg$c62,peg$currPos+=10):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s0===peg$FAILED&&(input.substr(peg$currPos,10)===peg$c64?(s0=peg$c64,peg$currPos+=10):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c65)))),s0}function peg$parseArrowItem(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED&&(s2=peg$parseArrowItemKey())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c66,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c68,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c69)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c70(s2,s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseArrowItems(){var s0,s1;if(s0=[],(s1=peg$parseArrowItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseArrowItem();else s0=peg$FAILED;return s0}function peg$parseArrowDesc(){var s0,s1,s3,s5;return s0=peg$currPos,123===input.charCodeAt(peg$currPos)?(s1=peg$c71,peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c72)),s1!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s3=peg$parseArrowItems())===peg$FAILED&&(s3=null),s3!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(125===input.charCodeAt(peg$currPos)?(s5=peg$c73,peg$currPos++):(s5=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c74)),s5!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c75(s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseSubexp(){var s0,s1,s2,s4,s6,s8,s10,s12,s14;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?((s2=peg$parseActionLabel())===peg$FAILED&&(s2=null),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s4=peg$parseArrowDesc())===peg$FAILED&&(s4=null),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseArrow())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseArrowDesc())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s10=peg$parseActionLabel())===peg$FAILED&&(s10=null),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s12=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s14=peg$parseSubexp())===peg$FAILED&&(s14=null),s14!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c76(s2,s4,s6,s8,s10,s12,s14)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseExp(){var s0,s1,s2,s4;return s0=peg$currPos,s1=peg$parseLabel(),s1!==peg$FAILED&&(s2=peg$parseSubexp())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c68,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c69)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c77(s1,s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseValidationKey(){var s0;return input.substr(peg$currPos,9)===peg$c78?(s0=peg$c78,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c79)),s0===peg$FAILED&&(input.substr(peg$currPos,4)===peg$c80?(s0=peg$c80,peg$currPos+=4):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c81))),s0}function peg$parseValidationItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseValidationKey(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c66,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s2!==peg$FAILED&&(s3=peg$parseLabel())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c68,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c69)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c82(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseValidationItems(){var s0,s1;if(s0=[],(s1=peg$parseValidationItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseValidationItem();else s0=peg$FAILED;return s0}function peg$parseConfigValidation(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,10)===peg$c83?(s2=peg$c83,peg$currPos+=10):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c84)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c66,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c71,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c72)),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseValidationItems())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c85?(s10=peg$c85,peg$currPos+=2):(s10=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c86)),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c87(s8)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGvizLayout(){var s0;return input.substr(peg$currPos,3)===peg$c88?(s0=peg$c88,peg$currPos+=3):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c89)),s0===peg$FAILED&&(input.substr(peg$currPos,5)===peg$c90?(s0=peg$c90,peg$currPos+=5):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c91))),s0}function peg$parseStateItemShapeKey(){var s0;return input.substr(peg$currPos,8)===peg$c92?(s0=peg$c92,peg$currPos+=8):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c93)),s0===peg$FAILED&&(input.substr(peg$currPos,9)===peg$c94?(s0=peg$c94,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c95)),s0===peg$FAILED&&(input.substr(peg$currPos,10)===peg$c96?(s0=peg$c96,peg$currPos+=10):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c97)))),s0}function peg$parseStateItemShape(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED&&(s2=peg$parseStateItemShapeKey())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c66,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c68,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c69)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c70(s2,s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseStateItemGraphLayout(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,12)===peg$c98?(s2=peg$c98,peg$currPos+=12):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c99)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c66,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizLayout())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c68,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c69)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c100(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseStateItem(){var s0;return(s0=peg$parseStateItemShape())===peg$FAILED&&(s0=peg$parseStateItemGraphLayout()),s0}function peg$parseStateItems(){var s0,s1;if(s0=[],(s1=peg$parseStateItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseStateItem();else s0=peg$FAILED;return s0}function peg$parseConfigState(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,5)===peg$c101?(s2=peg$c101,peg$currPos+=5):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c102)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c66,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c71,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c72)),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseStateItems())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c85?(s10=peg$c85,peg$currPos+=2):(s10=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c86)),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c103(s8)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseActionKey(){var s0;return input.substr(peg$currPos,9)===peg$c78?(s0=peg$c78,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c79)),s0===peg$FAILED&&(input.substr(peg$currPos,4)===peg$c80?(s0=peg$c80,peg$currPos+=4):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c81))),s0}function peg$parseActionItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseActionKey(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c66,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s2!==peg$FAILED&&(s3=peg$parseLabel())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c68,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c69)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c104(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseActionItems(){var s0,s1;if(s0=[],(s1=peg$parseActionItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseActionItem();else s0=peg$FAILED;return s0}function peg$parseConfigAction(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,6)===peg$c105?(s2=peg$c105,peg$currPos+=6):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c106)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c66,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c71,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c72)),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseActionItems())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c85?(s10=peg$c85,peg$currPos+=2):(s10=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c86)),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c107(s8)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseTransitionKey(){var s0;return input.substr(peg$currPos,9)===peg$c78?(s0=peg$c78,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c79)),s0===peg$FAILED&&(input.substr(peg$currPos,4)===peg$c80?(s0=peg$c80,peg$currPos+=4):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c81))),s0}function peg$parseTransitionItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseTransitionKey(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c66,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s2!==peg$FAILED&&(s3=peg$parseLabel())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c68,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c69)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c108(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseTransitionItems(){var s0,s1;if(s0=[],(s1=peg$parseTransitionItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseTransitionItem();else s0=peg$FAILED;return s0}function peg$parseConfigTransition(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,10)===peg$c109?(s2=peg$c109,peg$currPos+=10):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c110)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c66,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c71,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c72)),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseTransitionItems())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c85?(s10=peg$c85,peg$currPos+=2):(s10=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c86)),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c111(s8)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGraphBg(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,8)===peg$c112?(s2=peg$c112,peg$currPos+=8):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c113)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c66,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c68,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c69)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c114(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseMinTransitionsPerState(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,25)===peg$c115?(s2=peg$c115,peg$currPos+=25):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c116)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c66,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c68,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c69)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c117(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseMaxTransitionsPerState(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,25)===peg$c118?(s2=peg$c118,peg$currPos+=25):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c119)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c66,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c68,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c69)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c120(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGraphItem(){var s0;return(s0=peg$parseGraphBg())===peg$FAILED&&(s0=peg$parseMinTransitionsPerState())===peg$FAILED&&(s0=peg$parseMaxTransitionsPerState()),s0}function peg$parseGraphItems(){var s0,s1;if(s0=[],(s1=peg$parseGraphItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseGraphItem();else s0=peg$FAILED;return s0}function peg$parseConfigGraph(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,5)===peg$c121?(s2=peg$c121,peg$currPos+=5):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c122)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c66,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c67)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c71,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c72)),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseGraphItems())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c85?(s10=peg$c85,peg$currPos+=2):(s10=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c86)),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c123(s8)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseConfig(){var s0;return(s0=peg$parseConfigGraph())===peg$FAILED&&(s0=peg$parseConfigTransition())===peg$FAILED&&(s0=peg$parseConfigAction())===peg$FAILED&&(s0=peg$parseConfigState())===peg$FAILED&&(s0=peg$parseConfigValidation()),s0}function peg$parseTerm(){var s0;return(s0=peg$parseExp())===peg$FAILED&&(s0=peg$parseConfig()),s0}function peg$parseTermList(){var s0,s1;for(s0=[],s1=peg$parseTerm();s1!==peg$FAILED;)s0.push(s1),s1=peg$parseTerm();return s0}options=void 0!==options?options:{};var peg$result,peg$FAILED={},peg$startRuleFunctions={Document:peg$parseDocument},peg$startRuleFunction=peg$parseDocument,peg$c0=function(e){return e},peg$c1="square",peg$c2=peg$literalExpectation("square",!1),peg$c3="rectangle",peg$c4=peg$literalExpectation("rectangle",!1),peg$c5="circle",peg$c6=peg$literalExpectation("circle",!1),peg$c7=peg$otherExpectation("forward arrow"),peg$c8="->",peg$c9=peg$literalExpectation("->",!1),peg$c10=peg$otherExpectation("two way arrow"),peg$c11="<->",peg$c12=peg$literalExpectation("<->",!1),peg$c13=/^[0-9a-fA-F]/,peg$c14=peg$classExpectation([["0","9"],["a","f"],["A","F"]],!1,!1),peg$c15='"',peg$c16=peg$literalExpectation('"',!1),peg$c17="\\",peg$c18=peg$literalExpectation("\\",!1),peg$c19="/",peg$c20=peg$literalExpectation("/",!1),peg$c21="b",peg$c22=peg$literalExpectation("b",!1),peg$c23=function(){return"\b"},peg$c24="f",peg$c25=peg$literalExpectation("f",!1),peg$c26=function(){return"\f"},peg$c27="n",peg$c28=peg$literalExpectation("n",!1),peg$c29=function(){return"\n"},peg$c30="r",peg$c31=peg$literalExpectation("r",!1),peg$c32=function(){return"\r"},peg$c33="t",peg$c34=peg$literalExpectation("t",!1),peg$c35=function(){return"\t"},peg$c36="v",peg$c37=peg$literalExpectation("v",!1),peg$c38=function(){return"\v"},peg$c39="u",peg$c40=peg$literalExpectation("u",!1),peg$c41=function(digits){return String.fromCharCode(parseInt(digits,16))},peg$c42=function(Sequence){return Sequence},peg$c43=/^[ -!#-[\]-\u10FFFF]/,peg$c44=peg$classExpectation([[" ","!"],["#","["],["]","ჿ"],"F","F"],!1,!1),peg$c45="`",peg$c46=peg$literalExpectation("`",!1),peg$c47=/^[ -[\]-_a-\u10FFFF]/,peg$c48=peg$classExpectation([[" ","["],["]","_"],["a","ჿ"],"F","F"],!1,!1),peg$c49=peg$otherExpectation("action label"),peg$c50=function(chars){return chars.join("")},peg$c51=peg$otherExpectation("whitespace"),peg$c52=/^[ \t\n\r\x0B]/,peg$c53=peg$classExpectation([" ","\t","\n","\r","\v"],!1,!1),peg$c54=peg$otherExpectation("string"),peg$c55=peg$otherExpectation("atom"),peg$c56=/^[0-9a-zA-Z.+_&()%$#@!?,']/,peg$c57=peg$classExpectation([["0","9"],["a","z"],["A","Z"],".","+","_","&","(",")","%","$","#","@","!","?",",","'"],!1,!1),peg$c58=function(text){return text.join("")},peg$c59=peg$otherExpectation("label"),peg$c60="arc_label",peg$c61=peg$literalExpectation("arc_label",!1),peg$c62="head_label",peg$c63=peg$literalExpectation("head_label",!1),peg$c64="tail_label",peg$c65=peg$literalExpectation("tail_label",!1),peg$c66=":",peg$c67=peg$literalExpectation(":",!1),peg$c68=";",peg$c69=peg$literalExpectation(";",!1),peg$c70=function(key,value){return{key:key,value:value}},peg$c71="{",peg$c72=peg$literalExpectation("{",!1),peg$c73="}",peg$c74=peg$literalExpectation("}",!1),peg$c75=function(items){return items},peg$c76=function(lactl,ldesc,arrow,rdesc,ractl,label,tail){var base={kind:arrow,to:label};return tail&&tail!==[]&&(base.se=tail),ldesc&&(base.ldesc=ldesc),rdesc&&(base.rdesc=rdesc),base},peg$c77=function(label,se){var base={from:label};return se&&se!==[]&&(base.se=se),base},peg$c78="whargarbl",peg$c79=peg$literalExpectation("whargarbl",!1),peg$c80="todo",peg$c81=peg$literalExpectation("todo",!1),peg$c82=function(validationkey,value){return{key:validationkey,value:value}},peg$c83="validation",peg$c84=peg$literalExpectation("validation",!1),peg$c85="};",peg$c86=peg$literalExpectation("};",!1),peg$c87=function(validation_items){return{config_kind:"validation",config_items:validation_items||[]}},peg$c88="dot",peg$c89=peg$literalExpectation("dot",!1),peg$c90="circo",peg$c91=peg$literalExpectation("circo",!1),peg$c92="in_shape",peg$c93=peg$literalExpectation("in_shape",!1),peg$c94="out_shape",peg$c95=peg$literalExpectation("out_shape",!1),peg$c96="node_shape",peg$c97=peg$literalExpectation("node_shape",!1),peg$c98="graph_layout",peg$c99=peg$literalExpectation("graph_layout",!1),peg$c100=function(value){return{key:"graph_layout",value:value}},peg$c101="state",peg$c102=peg$literalExpectation("state",!1),peg$c103=function(state_items){return{config_kind:"state",config_items:state_items||[]}},peg$c104=function(actionkey,value){return{key:actionkey,value:value}},peg$c105="action",peg$c106=peg$literalExpectation("action",!1),peg$c107=function(action_items){return{config_kind:"action",config_items:action_items||[]}},peg$c108=function(transitionkey,value){return{key:transitionkey,value:value}},peg$c109="transition",peg$c110=peg$literalExpectation("transition",!1),peg$c111=function(transition_items){return{config_kind:"transition",config_items:transition_items||[]}},peg$c112="graph_bg",peg$c113=peg$literalExpectation("graph_bg",!1),peg$c114=function(value){return{key:"graph_bg",value:value}},peg$c115="min_transitions_per_state",peg$c116=peg$literalExpectation("min_transitions_per_state",!1),peg$c117=function(value){return{key:"min_transitions_per_state",value:value}},peg$c118="max_transitions_per_state",peg$c119=peg$literalExpectation("max_transitions_per_state",!1),peg$c120=function(value){return{key:"max_transitions_per_state",value:value}},peg$c121="graph",peg$c122=peg$literalExpectation("graph",!1),peg$c123=function(graph_items){return{config_kind:"graph",config_items:graph_items||[]}},peg$currPos=0,peg$savedPos=0,peg$posDetailsCache=[{line:1,column:1}],peg$maxFailPos=0,peg$maxFailExpected=[],peg$silentFails=0;if("startRule"in options){if(!(options.startRule in peg$startRuleFunctions))throw new Error("Can't start parsing from rule \""+options.startRule+'".');peg$startRuleFunction=peg$startRuleFunctions[options.startRule]}if((peg$result=peg$startRuleFunction())!==peg$FAILED&&peg$currPos===input.length)return peg$result;throw peg$result!==peg$FAILED&&peg$currPos0){for(i=1,j=1;i1&&void 0!==arguments[1]?arguments[1]:"probability";if(!Array.isArray(options))throw new TypeError("options must be a non-empty array of objects");if("object"!==_typeof(options[0]))throw new TypeError("options must be a non-empty array of objects");for(var rnd=function(cap){return Math.random()*cap}(options.reduce(function(acc,val){return acc+val[probability_property]},0)),cursor=0,cursor_sum=0;(cursor_sum+=options[cursor++][probability_property])<=rnd;);return options[cursor-1]},seq=function(n){return new Array(n).fill(!0).map(function(_,i){return i})},histograph=function(a){return a.sort().reduce(function(m,v){return m.set(v,m.has(v)?m.get(v)+1:1),m},new Map)},weighted_sample_select=function(n,options,probability_property){return seq(n).map(function(i){return weighted_rand_select(options,probability_property)})},weighted_histo_key=function(n,options,probability_property,extract){return histograph(weighted_sample_select(n,options,probability_property).map(function(s){return s[extract]}))};exports.seq=seq,exports.histograph=histograph,exports.weighted_histo_key=weighted_histo_key,exports.weighted_rand_select=weighted_rand_select,exports.weighted_sample_select=weighted_sample_select},{}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var viz=function(jssm){var l_states=jssm.states(),node_of=function(state){return"n"+l_states.indexOf(state)},vc=function(col){return jssm._viz_colors[col]||""},strike=[];return'digraph G {\n fontname="helvetica neue";\n style=filled;\n bgcolor=lightgrey;\n node [fontsize=14; shape=box; style=filled; fillcolor=white; fontname="helvetica neue"];\n edge [fontsize=6;fontname="helvetica neue"];\n\n '+l_states.map(function(s){jssm.state_for(s);var terminal=jssm.state_is_terminal(s),final=jssm.state_is_final(s),complete=jssm.state_is_complete(s),features=[["label",s],["peripheries",complete?2:1],["fillcolor",final?vc("fill_final"):complete?vc("fill_complete"):terminal?vc("fill_terminal"):""]].filter(function(r){return r[1]}).map(function(r){return r[0]+'="'+r[1]+'"'}).join(" ");return node_of(s)+" ["+features+"];"}).join(" ")+"\n\n "+jssm.states().map(function(s){return jssm.list_exits(s).map(function(ex){if(strike.find(function(row){return row[0]===s&&row[1]==ex}))return"";var edge=jssm.list_transitions(s,ex),pair=jssm.list_transitions(ex,s),double=pair&&s!==ex,if_obj_field=(jssm.state_for(s),jssm.state_for(ex),function(obj,field){return obj?obj[field]||"":""}),h_final=jssm.state_is_final(s),h_complete=jssm.state_is_complete(s),h_terminal=jssm.state_is_terminal(s),t_final=jssm.state_is_final(ex),t_complete=jssm.state_is_complete(ex),t_terminal=jssm.state_is_terminal(ex),lineColor=function(final,complete,terminal){var _solo_1_2=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"_solo";return vc(final?"line_final"+_solo_1_2:complete?"line_complete"+_solo_1_2:terminal?"line_terminal"+_solo_1_2:"normal_line"+_solo_1_2)},textColor=function(final,complete,terminal){var _solo_1_2=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"_solo";return final?vc("text_final"+_solo_1_2):complete?vc("text_complete"+_solo_1_2):terminal?vc("text_terminal"+_solo_1_2):""},labelInline=[[pair,"probability","headlabel","name","action",double,textColor(h_final,h_complete,h_terminal,double?"_1":"_solo")],[edge,"probability","taillabel","name","action",!0,textColor(t_final,t_complete,t_terminal,double?"_2":"_solo")]].map(function(r){return{which:r[2],whether:r[5]?[if_obj_field(r[0],r[5]),if_obj_field(r[0],r[1]),if_obj_field(r[0],r[3])].filter(function(q){return q}).join("
")||"":"",color:r[6]}}).filter(function(present){return present.whether}).map(function(r){return r.which+"="+(r.color?'<'+r.whether+">":'"'+r.whether+'"')+";"}).join(" "),tc1=lineColor(t_final,t_complete,t_terminal,"_1"),tc2=lineColor(h_final,h_complete,h_terminal,"_2"),tcd=lineColor(t_final,t_complete,t_terminal,"_solo"),edgeInline=edge?double?'dir=both;color="'+tc1+":"+tc2+'"':'color="'+tcd+'"':"";return pair&&strike.push([ex,s]),node_of(s)+"->"+node_of(ex)+" ["+labelInline+edgeInline+"];"}).join(" ")}).join(" ")+"\n}"};exports.viz=viz},{}],jssm:[function(require,module,exports){"use strict";function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i to already exists "+tr.from+" "+tr.to);if(from_mapping.set(tr.to,thisEdgeId),tr.action){_this._actions.has(tr.action)||_this._actions.set(tr.action,new Map);var actionMap=_this._actions.get(tr.action);if(!actionMap)throw new Error("should be impossible, satisfying type checker that doesn't know .set precedes .get. severe error?");if(actionMap.has(tr.from))throw new Error("action "+tr.action+" already attached to origin "+tr.from);actionMap.set(tr.from,thisEdgeId),_this._reverse_actions.has(tr.from)||_this._reverse_actions.set(tr.from,new Map);var rActionMap=_this._reverse_actions.get(tr.from);if(!rActionMap)throw new Error("should be impossible, satisfying type checker that doesn't know .set precedes .get again. severe error?");if(rActionMap.has(tr.action))throw new Error("r-action "+tr.from+" already attached to action "+tr.action);rActionMap.set(tr.action,thisEdgeId),_this._reverse_action_targets.has(tr.to)||_this._reverse_action_targets.set(tr.to,new Map)}})}return _createClass(machine,[{key:"_new_state",value:function(state_config){if(this._states.has(state_config.name))throw new Error("state "+state_config.name+" already exists");return this._states.set(state_config.name,state_config),state_config.name}},{key:"state",value:function(){return this._state}},{key:"is_changing",value:function(){return!0}},{key:"state_is_final",value:function(whichState){return this.state_is_terminal(whichState)&&this.state_is_complete(whichState)}},{key:"is_final",value:function(){return!this.is_changing()&&this.state_is_final(this.state())}},{key:"machine_state",value:function(){return{internal_state_impl_version:1,actions:this._actions,edge_map:this._edge_map,edges:this._edges,named_transitions:this._named_transitions,reverse_actions:this._reverse_actions,state:this._state,states:this._states}}},{key:"load_machine_state",value:function(){return!1}},{key:"states",value:function(){return[].concat(_toConsumableArray(this._states.keys()))}},{key:"state_for",value:function(whichState){var state=this._states.get(whichState);if(state)return state;throw new Error("no such state "+JSON.stringify(state))}},{key:"list_transitions",value:function(){return this._edges}},{key:"list_named_transitions",value:function(){return this._named_transitions}},{key:"list_actions",value:function(){return[].concat(_toConsumableArray(this._actions.keys()))}},{key:"get_transition_by_id",value:function(from,to){return this._edge_map.has(from)?this._edge_map.get(from).get(to):void 0}},{key:"lookup_transition_for",value:function(from,to){var id=this.get_transition_by_id(from,to);return void 0===id?void 0:this._edges[id]}},{key:"list_transitions",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return{entrances:this.list_entrances(whichState),exits:this.list_exits(whichState)}}},{key:"list_entrances",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return(this._states.get(whichState)||{}).from}},{key:"list_exits",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return(this._states.get(whichState)||{}).to}},{key:"probable_exits_for",value:function(whichState){var _this2=this;return(this._states.get(whichState)||{to:[]}).to.map(function(ws){return _this2.lookup_transition_for(_this2.state(),ws)}).filter(function(defined){return defined})||[]}},{key:"probabilistic_transition",value:function(){var selected=(0,_jssmUtil.weighted_rand_select)(this.probable_exits_for(this.state()));return this.transition(selected.to)}},{key:"probabilistic_walk",value:function(n){var _this3=this;return(0,_jssmUtil.seq)(n-1).map(function(i){var state_was=_this3.state();return _this3.probabilistic_transition(),state_was}).concat([this.state()])}},{key:"probabilistic_histo_walk",value:function(n){return(0,_jssmUtil.histograph)(this.probabilistic_walk(n))}},{key:"actions",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state(),wstate=this._reverse_actions.get(whichState);if(wstate)return[].concat(_toConsumableArray(wstate.keys()));throw new Error("No such state "+JSON.stringify(whichState))}},{key:"list_states_having_action",value:function(whichState){var wstate=this._actions.get(whichState);if(wstate)return[].concat(_toConsumableArray(wstate.keys()));throw new Error("No such state "+JSON.stringify(whichState))}},{key:"list_exit_actions",value:function(){var _this4=this,whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return[].concat(_toConsumableArray((this._reverse_actions.get(whichState)||new Map).values())).map(function(edgeId){return _this4._edges[edgeId]}).filter(function(o){return o.from===whichState}).map(function(filtered){return filtered.action})}},{key:"probable_action_exits",value:function(){var _this5=this,whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return[].concat(_toConsumableArray((this._reverse_actions.get(whichState)||new Map).values())).map(function(edgeId){return _this5._edges[edgeId]}).filter(function(o){return o.from===whichState}).map(function(filtered){return{action:filtered.action,probability:filtered.probability}})}},{key:"is_unenterable",value:function(whichState){return 0===this.list_entrances(whichState).length}},{key:"has_unenterables",value:function(){return this.states.some(this.is_unenterable)}},{key:"is_terminal",value:function(){return this.state_is_terminal(this.state())}},{key:"state_is_terminal",value:function(whichState){return 0===this.list_exits(whichState).length}},{key:"has_terminals",value:function(){return this.states.some(this.state_is_terminal)}},{key:"is_complete",value:function(){return this.state_is_complete(this.state())}},{key:"state_is_complete",value:function(whichState){var wstate=this._states.get(whichState);if(wstate)return wstate.complete;throw new Error("No such state "+JSON.stringify(whichState))}},{key:"has_completes",value:function(){return this.states.some(this.state_is_complete)}},{key:"action",value:function(name,newData){if(this.valid_action(name,newData)){var edge=this.current_action_edge_for(name);if(!edge)throw new Error("Should be impossible - valid_action true, no edge in current_action_edge_for, in action("+JSON.stringify(name)+"...)");return this._state=edge.to,!0}return!1}},{key:"transition",value:function(newState,newData){return!!this.valid_transition(newState,newData)&&(this._state=newState,!0)}},{key:"force_transition",value:function(newState,newData){return!!this.valid_force_transition(newState,newData)&&(this._state=newState,!0)}},{key:"current_action_for",value:function(action){var action_base=this._actions.get(action);return action_base?action_base.get(this.state()):void 0}},{key:"current_action_edge_for",value:function(action){var idx=this.current_action_for(action);return void 0!==idx?this._edges[idx]:void 0}},{key:"valid_action",value:function(action,newData){return void 0!==this.current_action_for(action)}},{key:"valid_transition",value:function(newState,newData){return void 0!==this.lookup_transition_for(this.state(),newState)}},{key:"valid_force_transition",value:function(newState,newData){return!1}},{key:"viz",value:function(){return(0,_jssmViz.viz)(this)}},{key:"set_viz_colors",value:function(){this._viz_colors={fill_final:"#eeeeff",fill_terminal:"#ffeeee",fill_complete:"#eeffee",normal_line_1:"#999999",normal_line_2:"#888888",normal_line_solo:"#888888",line_final_1:"#8888bb",line_final_2:"#7777aa",line_final_solo:"#7777aa",line_terminal_1:"#bb8888",line_terminal_2:"#aa7777",line_terminal_solo:"#aa7777",line_complete_1:"#88bb88",line_complete_2:"#77aa77",line_complete_solo:"#77aa77",text_final_1:"#000088",text_final_2:"#000088",text_final_solo:"#000088",text_terminal_1:"#880000",text_terminal_2:"#880000",text_terminal_solo:"#880000",text_complete_1:"#007700",text_complete_2:"#007700",text_complete_solo:"#007700"}}}]),machine}();exports.version="2.8.1",exports.machine=machine,exports.parse=parse,exports.seq=_jssmUtil.seq,exports.weighted_rand_select=_jssmUtil.weighted_rand_select,exports.histograph=_jssmUtil.histograph,exports.weighted_sample_select=_jssmUtil.weighted_sample_select,exports.weighted_histo_key=_jssmUtil.weighted_histo_key},{"./jssm-dot.js":1,"./jssm-util.js":2,"./jssm-viz.js":3}]},{},[]); \ No newline at end of file diff --git a/docs/lib/index.html b/docs/lib/index.html index cd10af73..cdb38efe 100644 --- a/docs/lib/index.html +++ b/docs/lib/index.html @@ -2,7 +2,7 @@ - jssm 2.7.1 | Documentation + jssm 2.8.1 | Documentation @@ -14,7 +14,7 @@

jssm

-
2.7.1
+
2.8.1
=6.0.0" }, diff --git a/src/js/jssm-dot.peg b/src/js/jssm-dot.peg index 1419491c..796dd6ca 100644 --- a/src/js/jssm-dot.peg +++ b/src/js/jssm-dot.peg @@ -86,17 +86,19 @@ Label "label" -Value - = label:Label +ArrowItemKey + = "arc_label" + / "head_label" + / "tail_label" -Item - = text:Label ":" value:Value ";" { return {text:text, value:value}; } +ArrowItem + = Whitespace key:ArrowItemKey Whitespace ":" Whitespace value:Label Whitespace ";" Whitespace { return {key:key, value:value}; } -Items - = Item+ +ArrowItems + = ArrowItem+ ArrowDesc - = "{" items:Items? "}" { return items; } + = "{" Whitespace items:ArrowItems? Whitespace "}" { return items; } @@ -131,7 +133,7 @@ ValidationKey / "todo" ValidationItem - = validationkey:ValidationKey ":" value:Value ";" { return {key:validationkey, value:value}; } + = validationkey:ValidationKey ":" value:Label ";" { return {key:validationkey, value:value}; } ValidationItems = ValidationItem+ @@ -147,23 +149,20 @@ GvizLayout = "dot" / "circo" -InShape - = Whitespace "in_shape" Whitespace ":" Whitespace value:GvizShape Whitespace ";" Whitespace { return {key:"in_shape", value:value}; } +StateItemShapeKey + = "in_shape" + / "out_shape" + / "node_shape" -OutShape - = Whitespace "out_shape" Whitespace ":" Whitespace value:GvizShape Whitespace ";" Whitespace { return {key:"out_shape", value:value}; } +StateItemShape + = Whitespace key:StateItemShapeKey Whitespace ":" Whitespace value:GvizShape Whitespace ";" Whitespace { return {key:key, value:value}; } -NodeShape - = Whitespace "node_shape" Whitespace ":" Whitespace value:GvizShape Whitespace ";" Whitespace { return {key:"node_shape", value:value}; } - -GraphLayout +StateItemGraphLayout = Whitespace "graph_layout" Whitespace ":" Whitespace value:GvizLayout Whitespace ";" Whitespace { return {key:"graph_layout", value:value}; } StateItem - = InShape - / OutShape - / NodeShape - / GraphLayout + = StateItemShape + / StateItemGraphLayout StateItems = StateItem+ @@ -180,7 +179,7 @@ ActionKey / "todo" ActionItem - = actionkey:ActionKey ":" value:Value ";" { return {key:actionkey, value:value}; } + = actionkey:ActionKey ":" value:Label ";" { return {key:actionkey, value:value}; } ActionItems = ActionItem+ @@ -197,7 +196,7 @@ TransitionKey / "todo" TransitionItem - = transitionkey:TransitionKey ":" value:Value ";" { return {key:transitionkey, value:value}; } + = transitionkey:TransitionKey ":" value:Label ";" { return {key:transitionkey, value:value}; } TransitionItems = TransitionItem+ diff --git a/src/js/tests/parse.js b/src/js/tests/parse.js index 79e5d7dd..e2894e7b 100644 --- a/src/js/tests/parse.js +++ b/src/js/tests/parse.js @@ -12,50 +12,38 @@ describe('parse/1', async it => { describe('forward arrow', async it => { const AtoB = [{"from": "a","se": {"kind": "->","to": "b"}}], - AdB = [{"from": "a","se": {"kind": "->","to": "b","ldesc": [{"text":"c","value":"d"}]}}], - ABd = [{"from": "a","se": {"kind": "->","to": "b","rdesc": [{"text":"c","value":"d"}]}}], - AdBd = [{"from": "a","se": {"kind": "->","to": "b","ldesc": [{"text":"c","value":"d"}],"rdesc": [{"text":"e","value":"f"}]}}]; - - it('a->b;', t => t.deepEqual(AtoB, jssm.parse('a->b;') )); - it('a ->b;', t => t.deepEqual(AtoB, jssm.parse('a ->b;') )); - it('a-> b;', t => t.deepEqual(AtoB, jssm.parse('a-> b;') )); - it('a -> b;', t => t.deepEqual(AtoB, jssm.parse('a -> b;') )); - - it('a{}->b;', t => t.deepEqual(AtoB, jssm.parse('a{}->b;') )); - it('a->{}b;', t => t.deepEqual(AtoB, jssm.parse('a->{}b;') )); - it('a{}->{}b;', t => t.deepEqual(AtoB, jssm.parse('a{}->{}b;') )); - - it('a{c:d}->b;', t => t.deepEqual(AdB, jssm.parse('a{c:d;}->b;') )); - it('a{c:"d"}->b;', t => t.deepEqual(AdB, jssm.parse('a{c:"d";}->b;') )); - it('a{"c":d}->b;', t => t.deepEqual(AdB, jssm.parse('a{"c":d;}->b;') )); - it('a{"c":"d"}->b;', t => t.deepEqual(AdB, jssm.parse('a{"c":"d";}->b;') )); - it('a{c:d}->b;', t => t.deepEqual(ABd, jssm.parse('a->{c:d;}b;') )); - it('a{c:d}->b;', t => t.deepEqual(AdBd, jssm.parse('a{c:d;}->{e:f;}b;') )); + AdB = [{"from": "a","se": {"kind": "->","to": "b","ldesc": [{"key":"arc_label","value":"d"}]}}], + ABd = [{"from": "a","se": {"kind": "->","to": "b","rdesc": [{"key":"arc_label","value":"d"}]}}], + AdBd = [{"from": "a","se": {"kind": "->","to": "b","ldesc": [{"key":"arc_label","value":"d"}],"rdesc": [{"key":"arc_label","value":"f"}]}}]; + + const echo_equal = (test, validator) => it(test, t => t.deepEqual(validator, jssm.parse(test))); + + const ShouldEqualAtoB = ['a->b;', 'a ->b;', 'a-> b;', 'a -> b;', 'a{}->b;', 'a->{}b;', 'a{}->{}b;']; + ShouldEqualAtoB.map(p => echo_equal(p, AtoB)); + + echo_equal('a{arc_label:d;}->b;', AdB); + echo_equal('a{arc_label:"d";}->b;', AdB); + echo_equal('a->{arc_label:d;}b;', ABd); + echo_equal('a{arc_label:d;}->{arc_label:f;}b;', AdBd); }); describe('double arrow', async it => { const AtoB = [{"from": "a","se": {"kind": "<->","to": "b"}}], - AdB = [{"from": "a","se": {"kind": "<->","to": "b","ldesc": [{"text":"c","value":"d"}]}}], - ABd = [{"from": "a","se": {"kind": "<->","to": "b","rdesc": [{"text":"c","value":"d"}]}}], - AdBd = [{"from": "a","se": {"kind": "<->","to": "b","ldesc": [{"text":"c","value":"d"}],"rdesc": [{"text":"e","value":"f"}]}}]; - - it('a<->b;', t => t.deepEqual(AtoB, jssm.parse('a<->b;') )); - it('a <->b;', t => t.deepEqual(AtoB, jssm.parse('a <->b;') )); - it('a<-> b;', t => t.deepEqual(AtoB, jssm.parse('a<-> b;') )); - it('a <-> b;', t => t.deepEqual(AtoB, jssm.parse('a <-> b;') )); - - it('a{}<->b;', t => t.deepEqual(AtoB, jssm.parse('a{}<->b;') )); - it('a<->{}b;', t => t.deepEqual(AtoB, jssm.parse('a<->{}b;') )); - it('a{}<->{}b;', t => t.deepEqual(AtoB, jssm.parse('a{}<->{}b;') )); - - it('a{c:d}<->b;', t => t.deepEqual(AdB, jssm.parse('a{c:d;}<->b;') )); - it('a{c:"d"}<->b;', t => t.deepEqual(AdB, jssm.parse('a{c:"d";}<->b;') )); - it('a{"c":d}<->b;', t => t.deepEqual(AdB, jssm.parse('a{"c":d;}<->b;') )); - it('a{"c":"d"}<->b;', t => t.deepEqual(AdB, jssm.parse('a{"c":"d";}<->b;') )); - it('a{c:d}<->b;', t => t.deepEqual(ABd, jssm.parse('a<->{c:d;}b;') )); - it('a{c:d}<->b;', t => t.deepEqual(AdBd, jssm.parse('a{c:d;}<->{e:f;}b;') )); + AdB = [{"from": "a","se": {"kind": "<->","to": "b","ldesc": [{"key":"arc_label","value":"d"}]}}], + ABd = [{"from": "a","se": {"kind": "<->","to": "b","rdesc": [{"key":"arc_label","value":"d"}]}}], + AdBd = [{"from": "a","se": {"kind": "<->","to": "b","ldesc": [{"key":"arc_label","value":"d"}],"rdesc": [{"key":"arc_label","value":"f"}]}}]; + + const echo_equal = (test, validator) => it(test, t => t.deepEqual(validator, jssm.parse(test))); + + const ShouldEqualAtoB = ['a<->b;', 'a <->b;', 'a<-> b;', 'a <-> b;', 'a{}<->b;', 'a<->{}b;', 'a{}<->{}b;']; + ShouldEqualAtoB.map(p => echo_equal(p, AtoB)); + + echo_equal('a{arc_label:d;}<->b;', AdB); + echo_equal('a{arc_label:"d";}<->b;', AdB); + echo_equal('a<->{arc_label:d;}b;', ABd); + echo_equal('a{arc_label:d;}<->{arc_label:f;}b;', AdBd); });