state-machine-cat 10.1.5 → 10.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/bin/smcat.mjs +5 -4
  2. package/dist/commonjs/bundle.js +67 -67
  3. package/{src → dist/esm}/cli/actions.mjs +24 -40
  4. package/dist/esm/cli/attributes-parser.mjs +981 -0
  5. package/dist/esm/cli/file-name-to-stream.mjs +13 -0
  6. package/dist/esm/cli/make-description.mjs +21 -0
  7. package/dist/esm/cli/normalize.mjs +95 -0
  8. package/dist/esm/cli/validations.mjs +70 -0
  9. package/dist/esm/index-node.mjs +16 -0
  10. package/dist/esm/index.mjs +19 -0
  11. package/dist/esm/options.mjs +61 -0
  12. package/dist/esm/parse/index.mjs +27 -0
  13. package/dist/esm/parse/parser-helpers.mjs +175 -0
  14. package/dist/esm/parse/scxml/index.mjs +136 -0
  15. package/dist/esm/parse/scxml/normalize-machine.mjs +44 -0
  16. package/dist/esm/parse/smcat/smcat-parser.mjs +2924 -0
  17. package/dist/esm/parse/smcat-ast.schema.mjs +170 -0
  18. package/dist/esm/render/dot/attributebuilder.mjs +51 -0
  19. package/dist/esm/render/dot/counter.mjs +16 -0
  20. package/dist/esm/render/dot/dot.states.template.js +26 -0
  21. package/dist/esm/render/dot/dot.template.js +14 -0
  22. package/dist/esm/render/dot/index.mjs +106 -0
  23. package/dist/esm/render/dot/render-dot-from-ast.js +29 -0
  24. package/dist/esm/render/dot/state-transformers.mjs +113 -0
  25. package/dist/esm/render/dot/transition-transformers.mjs +49 -0
  26. package/dist/esm/render/dot/utl.mjs +29 -0
  27. package/dist/esm/render/index-node.mjs +28 -0
  28. package/dist/esm/render/index.mjs +20 -0
  29. package/dist/esm/render/scjson/index.mjs +121 -0
  30. package/dist/esm/render/scjson/make-valid-event-names.mjs +27 -0
  31. package/dist/esm/render/scjson/make-valid-xml-name.mjs +19 -0
  32. package/dist/esm/render/scxml/index.mjs +4 -0
  33. package/dist/esm/render/scxml/render-from-scjson.js +9 -0
  34. package/dist/esm/render/scxml/scxml.states.template.js +14 -0
  35. package/dist/esm/render/scxml/scxml.template.js +6 -0
  36. package/dist/esm/render/smcat/index.js +63 -0
  37. package/dist/esm/render/smcat/smcat.template.js +13 -0
  38. package/dist/esm/render/vector/dot-to-vector-native.mjs +35 -0
  39. package/dist/esm/render/vector/vector-native-dot-with-fallback.mjs +37 -0
  40. package/dist/esm/render/vector/vector-with-viz-js.mjs +13 -0
  41. package/dist/esm/state-machine-model.mjs +58 -0
  42. package/dist/esm/transform/desugar.mjs +77 -0
  43. package/dist/esm/transform/utl.mjs +16 -0
  44. package/dist/esm/version.mjs +1 -0
  45. package/package.json +36 -45
  46. package/src/render/dot/dot.states.template.js +1 -1
  47. package/src/render/dot/index.mjs +14 -14
  48. package/types/state-machine-cat.d.ts +4 -4
  49. package/src/cli/file-name-to-stream.mjs +0 -25
  50. package/src/cli/make-description.mjs +0 -45
  51. package/src/cli/normalize.mjs +0 -204
  52. package/src/cli/validations.mjs +0 -140
  53. package/src/index-node.mjs +0 -55
  54. package/src/index.mjs +0 -58
  55. package/src/options.mjs +0 -78
  56. package/src/parse/index.mjs +0 -47
  57. package/src/parse/parser-helpers.mjs +0 -297
  58. package/src/parse/scxml/normalize-machine.mjs +0 -73
  59. package/src/parse/smcat-ast.schema.mjs +0 -187
  60. package/src/render/dot/attributebuilder.mjs +0 -68
  61. package/src/render/dot/counter.mjs +0 -33
  62. package/src/render/dot/render-dot-from-ast.js +0 -70
  63. package/src/render/dot/state-transformers.mjs +0 -128
  64. package/src/render/dot/transition-transformers.mjs +0 -52
  65. package/src/render/dot/utl.mjs +0 -56
  66. package/src/render/index-node.mjs +0 -36
  67. package/src/render/index.mjs +0 -22
  68. package/src/render/scjson/index.mjs +0 -175
  69. package/src/render/scjson/make-valid-event-names.mjs +0 -71
  70. package/src/render/scjson/make-valid-xml-name.mjs +0 -70
  71. package/src/render/scxml/index.mjs +0 -8
  72. package/src/render/smcat/index.js +0 -129
  73. package/src/render/vector/dot-to-vector-native.mjs +0 -60
  74. package/src/render/vector/vector-native-dot-with-fallback.mjs +0 -55
  75. package/src/render/vector/vector-with-viz-js.mjs +0 -18
  76. package/src/state-machine-model.mjs +0 -124
  77. package/src/transform/desugar.mjs +0 -222
  78. package/src/transform/utl.mjs +0 -26
  79. package/src/version.mjs +0 -2
@@ -0,0 +1,170 @@
1
+ export default {
2
+ $schema: "http://json-schema.org/draft-07/schema#",
3
+ title: "state-machine-cat abstract syntax tree schema",
4
+ $ref: "#/definitions/StateMachineType",
5
+ $id: "org.js.state-machine-cat/v7.4.0",
6
+ definitions: {
7
+ StateType: {
8
+ type: "string",
9
+ enum: [
10
+ "regular",
11
+ "initial",
12
+ "terminate",
13
+ "final",
14
+ "parallel",
15
+ "history",
16
+ "deephistory",
17
+ "choice",
18
+ "forkjoin",
19
+ "fork",
20
+ "join",
21
+ "junction",
22
+ ],
23
+ },
24
+ TransitionType: {
25
+ type: "string",
26
+ enum: ["internal", "external"],
27
+ },
28
+ NoteType: {
29
+ type: "array",
30
+ items: {
31
+ type: "string",
32
+ },
33
+ },
34
+ ActionTypeType: {
35
+ type: "string",
36
+ enum: ["entry", "activity", "exit"],
37
+ },
38
+ ActionType: {
39
+ type: "object",
40
+ required: ["type", "body"],
41
+ additionalProperties: false,
42
+ properties: {
43
+ type: { $ref: "#/definitions/ActionTypeType" },
44
+ body: { type: "string" },
45
+ },
46
+ },
47
+ ClassType: {
48
+ type: "string",
49
+ pattern: "^[a-zA-Z0-9_\\- ]*$",
50
+ },
51
+ StateMachineType: {
52
+ type: "object",
53
+ additionalProperties: false,
54
+ required: ["states"],
55
+ properties: {
56
+ states: {
57
+ type: "array",
58
+ items: {
59
+ type: "object",
60
+ required: ["name", "type"],
61
+ additionalProperties: false,
62
+ properties: {
63
+ name: {
64
+ description: "The name and identifier of the state. Unique within the root state machine.",
65
+ type: "string",
66
+ },
67
+ type: {
68
+ description: "What kind of state (or pseudo state) this state is. E.g. 'regular' for normal states or 'initial', 'final', 'choice' etc for pseudo states. Most UML (pseudo-) states are supported.",
69
+ $ref: "#/definitions/StateType",
70
+ },
71
+ label: {
72
+ description: "The display label of the state. If it's not present, most renderers will use the states' name in stead.",
73
+ type: "string",
74
+ },
75
+ color: {
76
+ description: 'Color to use for rendering the state. Accepts all css color names ("blue") and hex notation - with ("#0000FF77") or without ("#0000FF") transparency.',
77
+ type: "string",
78
+ },
79
+ class: {
80
+ description: "Class name to give the state in dot and svg output.",
81
+ $ref: "#/definitions/ClassType",
82
+ },
83
+ active: {
84
+ description: "If true the state is considered to be active and rendered as such.",
85
+ type: "boolean",
86
+ },
87
+ typeExplicitlySet: {
88
+ description: "The default parser derives the `type` from the `name` with inband signaling. The user can override that behavior by explicitly setting the `type`. This attribute is there to express that (and make sure that on next parses & processing it doesn't get accidentily re-derived from the name again).",
89
+ type: "boolean",
90
+ },
91
+ isComposite: {
92
+ description: "convenience, derived attribute - set to true if there's a state machine inside the state; false in all other cases. For internal use - @deprecated",
93
+ type: "boolean",
94
+ },
95
+ actions: {
96
+ type: "array",
97
+ description: "A series of actions and their types. The type describe when the action takes place (on entry, exit, or otherwise ('activity'))",
98
+ items: { $ref: "#/definitions/ActionType" },
99
+ },
100
+ note: {
101
+ description: "Comments related to this state. Some renderers will use the note attribute to render a note (i.e. as a post-it) attached to the state.",
102
+ $ref: "#/definitions/NoteType",
103
+ },
104
+ statemachine: {
105
+ description: "state machine nested within the state.",
106
+ $ref: "#/definitions/StateMachineType",
107
+ },
108
+ },
109
+ },
110
+ },
111
+ transitions: {
112
+ type: "array",
113
+ items: {
114
+ type: "object",
115
+ required: ["from", "to"],
116
+ additionalProperties: false,
117
+ properties: {
118
+ from: {
119
+ description: "The name of the state this transition transitions from",
120
+ type: "string",
121
+ },
122
+ to: {
123
+ description: "The name of the state this transition transitions to",
124
+ type: "string",
125
+ },
126
+ label: {
127
+ description: "A display label to represent this transition. Parsers can parse this label into events conditions and actions.",
128
+ type: "string",
129
+ },
130
+ event: {
131
+ description: "Event triggering the transition",
132
+ type: "string",
133
+ },
134
+ cond: {
135
+ description: "Condition for the transition to occur.",
136
+ type: "string",
137
+ },
138
+ action: {
139
+ description: "Action to execute when the transition occurs.",
140
+ type: "string",
141
+ },
142
+ note: {
143
+ description: "Comments related to this transition",
144
+ $ref: "#/definitions/NoteType",
145
+ },
146
+ color: {
147
+ description: 'Color to use for rendering the transition. Accepts all css color names ("blue") and hex notation - with ("#0000FF77") or without ("#0000FF") transparency.',
148
+ type: "string",
149
+ },
150
+ width: {
151
+ description: "The line width to use for rendering the transition",
152
+ type: "number",
153
+ minimum: 0,
154
+ maximum: 30,
155
+ },
156
+ class: {
157
+ description: "Class name to give the state in dot and svg output.",
158
+ $ref: "#/definitions/ClassType",
159
+ },
160
+ type: {
161
+ description: "Whether the transition is external (default) or internal. See https://www.w3.org/TR/scxml/#transition for details.",
162
+ $ref: "#/definitions/TransitionType",
163
+ },
164
+ },
165
+ },
166
+ },
167
+ },
168
+ },
169
+ },
170
+ };
@@ -0,0 +1,51 @@
1
+ const GENERIC_GRAPH_ATTRIBUTES = [
2
+ { name: "fontname", value: '"Helvetica"' },
3
+ { name: "fontsize", value: "12" },
4
+ { name: "penwidth", value: "2.0" },
5
+ ];
6
+ const GRAPH_ATTRIBUTES = {
7
+ dot: [
8
+ { name: "splines", value: "true" },
9
+ { name: "ordering", value: "out" },
10
+ { name: "compound", value: "true" },
11
+ { name: "overlap", value: "scale" },
12
+ { name: "nodesep", value: "0.3" },
13
+ { name: "ranksep", value: "0.1" },
14
+ ],
15
+ fdp: [{ name: "K", value: "0.9" }],
16
+ osage: [{ name: "pack", value: "42" }],
17
+ neato: [{ name: "epsilon", value: "0.9" }],
18
+ };
19
+ const DIRECTION_ATTRIBUTES = {
20
+ "bottom-top": [{ name: "rankdir", value: "BT" }],
21
+ "left-right": [{ name: "rankdir", value: "LR" }],
22
+ "right-left": [{ name: "rankdir", value: "RL" }],
23
+ };
24
+ const NODE_ATTRIBUTES = [
25
+ { name: "shape", value: "plaintext" },
26
+ { name: "style", value: "filled" },
27
+ { name: "fillcolor", value: '"#FFFFFF01"' },
28
+ { name: "fontname", value: "Helvetica" },
29
+ { name: "fontsize", value: 12 },
30
+ { name: "penwidth", value: "2.0" },
31
+ ];
32
+ const EDGE_ATTRIBUTES = [
33
+ { name: "fontname", value: "Helvetica" },
34
+ { name: "fontsize", value: 10 },
35
+ ];
36
+ function toNameValueString(pAttribute) {
37
+ return `${pAttribute.name}=${pAttribute.value}`;
38
+ }
39
+ export default {
40
+ buildGraphAttributes: (pEngine, pDirection, pDotGraphAttributes) => GENERIC_GRAPH_ATTRIBUTES.concat(GRAPH_ATTRIBUTES[pEngine] || [])
41
+ .concat(DIRECTION_ATTRIBUTES[pDirection] || [])
42
+ .concat(pDotGraphAttributes || [])
43
+ .map(toNameValueString)
44
+ .join(" "),
45
+ buildNodeAttributes: (pDotNodeAttributes) => NODE_ATTRIBUTES.concat(pDotNodeAttributes || [])
46
+ .map(toNameValueString)
47
+ .join(" "),
48
+ buildEdgeAttributes: (pDotEdgeAttributes) => EDGE_ATTRIBUTES.concat(pDotEdgeAttributes || [])
49
+ .map(toNameValueString)
50
+ .join(" "),
51
+ };
@@ -0,0 +1,16 @@
1
+ export default class Counter {
2
+ COUNTER = 0;
3
+ constructor() {
4
+ this.reset();
5
+ }
6
+ reset() {
7
+ this.COUNTER = 0;
8
+ }
9
+ next() {
10
+ return ++this.COUNTER;
11
+ }
12
+ nextAsString() {
13
+ const lBase = 10;
14
+ return this.next().toString(lBase);
15
+ }
16
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var Handlebars = require("handlebars/dist/handlebars.runtime"), template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
4
+ templates["dot.states.template.hbs"] = template({ 1: function (l, n, e, a, t) { var o = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
5
+ return l[n]; }, r = "", c = null != (c = o(e, "nestedExternalSelfTransitions") || (null != n ? o(n, "nestedExternalSelfTransitions") : n)) ? c : l.hooks.helperMissing, t = { name: "nestedExternalSelfTransitions", hash: {}, fn: l.program(2, t, 0), inverse: l.noop, data: t, loc: { start: { line: 2, column: 2 }, end: { line: 4, column: 36 } } }, c = "function" == typeof c ? c.call(null != n ? n : l.nullContext || {}, t) : c; return null != (c = o(e, "nestedExternalSelfTransitions") ? c : l.hooks.blockHelperMissing.call(n, c, t)) && (r += c), r; }, 2: function (l, n, e, a, t) { return ' "self_' + (null != (l = l.lambda(n, n)) ? l : "") + '" [shape=point style=invis width=0 height=0 fixedsize=true]\n'; }, 4: function (l, n, e, a, t) { var o, r, c = null != n ? n : l.nullContext || {}, i = l.hooks.helperMissing, u = "function", s = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
6
+ return l[n]; }; return ' "' + (null != (o = typeof (r = null != (r = s(e, "name") || (null != n ? s(n, "name") : n)) ? r : i) == u ? r.call(c, { name: "name", hash: {}, data: t, loc: { start: { line: 7, column: 3 }, end: { line: 7, column: 13 } } }) : r) ? o : "") + '" [shape=circle style=filled class="' + (null != (o = typeof (r = null != (r = s(e, "class") || (null != n ? s(n, "class") : n)) ? r : i) == u ? r.call(c, { name: "class", hash: {}, data: t, loc: { start: { line: 7, column: 49 }, end: { line: 7, column: 60 } } }) : r) ? o : "") + '" ' + (null != (o = s(e, "if").call(c, null != n ? s(n, "color") : n, { name: "if", hash: {}, fn: l.program(5, t, 0), inverse: l.program(7, t, 0), data: t, loc: { start: { line: 7, column: 62 }, end: { line: 7, column: 150 } } })) ? o : "") + (null != (o = s(e, "if").call(c, null != n ? s(n, "active") : n, { name: "if", hash: {}, fn: l.program(9, t, 0), inverse: l.noop, data: t, loc: { start: { line: 7, column: 150 }, end: { line: 7, column: 184 } } })) ? o : "") + 'fixedsize=true height=0.15 label=""]\n'; }, 5: function (l, n, e, a, t) { var o, r, c = null != n ? n : l.nullContext || {}, i = l.hooks.helperMissing, u = "function", l = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
7
+ return l[n]; }; return 'color="' + (null != (o = typeof (r = null != (r = l(e, "color") || (null != n ? l(n, "color") : n)) ? r : i) == u ? r.call(c, { name: "color", hash: {}, data: t, loc: { start: { line: 7, column: 82 }, end: { line: 7, column: 93 } } }) : r) ? o : "") + '" fillcolor="' + (null != (o = typeof (r = null != (r = l(e, "color") || (null != n ? l(n, "color") : n)) ? r : i) == u ? r.call(c, { name: "color", hash: {}, data: t, loc: { start: { line: 7, column: 106 }, end: { line: 7, column: 117 } } }) : r) ? o : "") + '" '; }, 7: function (l, n, e, a, t) { return "fillcolor=black "; }, 9: function (l, n, e, a, t) { return "penwidth=3.0 "; }, 11: function (l, n, e, a, t) { var o = null != n ? n : l.nullContext || {}, r = l.hooks.helperMissing, c = "function", i = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
8
+ return l[n]; }, u = ' "' + (null != (m = typeof (s = null != (s = i(e, "name") || (null != n ? i(n, "name") : n)) ? s : r) == c ? s.call(o, { name: "name", hash: {}, data: t, loc: { start: { line: 10, column: 3 }, end: { line: 10, column: 13 } } }) : s) ? m : "") + '" [margin=0 class="' + (null != (m = typeof (s = null != (s = i(e, "class") || (null != n ? i(n, "class") : n)) ? s : r) == c ? s.call(o, { name: "class", hash: {}, data: t, loc: { start: { line: 10, column: 32 }, end: { line: 10, column: 43 } } }) : s) ? m : "") + '" ' + (null != (m = i(e, "if").call(o, null != n ? i(n, "color") : n, { name: "if", hash: {}, fn: l.program(12, t, 0), inverse: l.noop, data: t, loc: { start: { line: 10, column: 45 }, end: { line: 10, column: 85 } } })) ? m : "") + (null != (m = i(e, "if").call(o, null != n ? i(n, "active") : n, { name: "if", hash: {}, fn: l.program(14, t, 0), inverse: l.noop, data: t, loc: { start: { line: 10, column: 85 }, end: { line: 10, column: 134 } } })) ? m : "") + 'label= < \n <table align="center" cellborder="0" border="2" style="rounded" width="48">\n <tr><td width="48"' + (null != (m = i(e, "if").call(o, null != n ? i(n, "actionStrings") : n, { name: "if", hash: {}, fn: l.program(16, t, 0), inverse: l.program(18, t, 0), data: t, loc: { start: { line: 12, column: 24 }, end: { line: 12, column: 92 } } })) ? m : "") + ">" + (null != (m = i(e, "if").call(o, null != n ? i(n, "active") : n, { name: "if", hash: {}, fn: l.program(20, t, 0), inverse: l.program(22, t, 0), data: t, loc: { start: { line: 12, column: 93 }, end: { line: 12, column: 147 } } })) ? m : "") + "</td></tr>\n", s = null != (s = i(e, "actionStrings") || (null != n ? i(n, "actionStrings") : n)) ? s : r, r = { name: "actionStrings", hash: {}, fn: l.program(24, t, 0), inverse: l.noop, data: t, loc: { start: { line: 13, column: 6 }, end: { line: 16, column: 24 } } }, m = typeof s == c ? s.call(o, r) : s; return null != (m = i(e, "actionStrings") ? m : l.hooks.blockHelperMissing.call(n, m, r)) && (u += m), u + " </table>\n >]\n"; }, 12: function (l, n, e, a, t) { var o = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
9
+ return l[n]; }; return 'color="' + (null != (o = "function" == typeof (e = null != (e = o(e, "color") || (null != n ? o(n, "color") : n)) ? e : l.hooks.helperMissing) ? e.call(null != n ? n : l.nullContext || {}, { name: "color", hash: {}, data: t, loc: { start: { line: 10, column: 65 }, end: { line: 10, column: 76 } } }) : e) ? o : "") + '" '; }, 14: function (l, n, e, a, t) { return "peripheries=1 style=rounded "; }, 16: function (l, n, e, a, t) { return ' cellpadding="2"'; }, 18: function (l, n, e, a, t) { return ' cellpadding="7"'; }, 20: function (l, n, e, a, t) { var o = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
10
+ return l[n]; }; return "<i>" + l.escapeExpression("function" == typeof (e = null != (e = o(e, "label") || (null != n ? o(n, "label") : n)) ? e : l.hooks.helperMissing) ? e.call(null != n ? n : l.nullContext || {}, { name: "label", hash: {}, data: t, loc: { start: { line: 12, column: 110 }, end: { line: 12, column: 119 } } }) : e) + "</i>"; }, 22: function (l, n, e, a, t) { var o = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
11
+ return l[n]; }; return l.escapeExpression("function" == typeof (e = null != (e = o(e, "label") || (null != n ? o(n, "label") : n)) ? e : l.hooks.helperMissing) ? e.call(null != n ? n : l.nullContext || {}, { name: "label", hash: {}, data: t, loc: { start: { line: 12, column: 131 }, end: { line: 12, column: 140 } } }) : e); }, 24: function (l, n, e, a, t) { var o = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
12
+ return l[n]; }; return " " + (null != (e = o(e, "if").call(null != n ? n : l.nullContext || {}, t && o(t, "first"), { name: "if", hash: {}, fn: l.program(25, t, 0), inverse: l.noop, data: t, loc: { start: { line: 14, column: 8 }, end: { line: 14, column: 34 } } })) ? e : "") + '\n <tr><td align="left" cellpadding="2">' + l.escapeExpression(l.lambda(n, n)) + "</td></tr>\n"; }, 25: function (l, n, e, a, t) { return "<hr/>"; }, 27: function (l, n, e, a, t) { var o, r, c = null != n ? n : l.nullContext || {}, i = l.hooks.helperMissing, u = "function", s = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
13
+ return l[n]; }; return ' "' + (null != (o = typeof (r = null != (r = s(e, "name") || (null != n ? s(n, "name") : n)) ? r : i) == u ? r.call(c, { name: "name", hash: {}, data: t, loc: { start: { line: 21, column: 3 }, end: { line: 21, column: 13 } } }) : r) ? o : "") + '" [shape=circle class="' + (null != (o = typeof (r = null != (r = s(e, "class") || (null != n ? s(n, "class") : n)) ? r : i) == u ? r.call(c, { name: "class", hash: {}, data: t, loc: { start: { line: 21, column: 36 }, end: { line: 21, column: 47 } } }) : r) ? o : "") + '" ' + (null != (o = s(e, "if").call(c, null != n ? s(n, "color") : n, { name: "if", hash: {}, fn: l.program(12, t, 0), inverse: l.noop, data: t, loc: { start: { line: 21, column: 49 }, end: { line: 21, column: 89 } } })) ? o : "") + (null != (o = s(e, "if").call(c, null != n ? s(n, "active") : n, { name: "if", hash: {}, fn: l.program(9, t, 0), inverse: l.noop, data: t, loc: { start: { line: 21, column: 89 }, end: { line: 21, column: 123 } } })) ? o : "") + 'label="H"]\n'; }, 29: function (l, n, e, a, t) { var o, r, c = null != n ? n : l.nullContext || {}, i = l.hooks.helperMissing, u = "function", s = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
14
+ return l[n]; }; return ' "' + (null != (o = typeof (r = null != (r = s(e, "name") || (null != n ? s(n, "name") : n)) ? r : i) == u ? r.call(c, { name: "name", hash: {}, data: t, loc: { start: { line: 24, column: 3 }, end: { line: 24, column: 13 } } }) : r) ? o : "") + '" [shape=circle class="' + (null != (o = typeof (r = null != (r = s(e, "class") || (null != n ? s(n, "class") : n)) ? r : i) == u ? r.call(c, { name: "class", hash: {}, data: t, loc: { start: { line: 24, column: 36 }, end: { line: 24, column: 47 } } }) : r) ? o : "") + '" ' + (null != (o = s(e, "if").call(c, null != n ? s(n, "color") : n, { name: "if", hash: {}, fn: l.program(12, t, 0), inverse: l.noop, data: t, loc: { start: { line: 24, column: 49 }, end: { line: 24, column: 89 } } })) ? o : "") + (null != (o = s(e, "if").call(c, null != n ? s(n, "active") : n, { name: "if", hash: {}, fn: l.program(9, t, 0), inverse: l.noop, data: t, loc: { start: { line: 24, column: 89 }, end: { line: 24, column: 123 } } })) ? o : "") + 'label="H*"]\n'; }, 31: function (l, n, e, a, t, o, r) { var c = null != n ? n : l.nullContext || {}, i = l.hooks.helperMissing, u = "function", s = l.hooks.blockHelperMissing, m = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
15
+ return l[n]; }, p = ' "' + (null != (d = typeof (f = null != (f = m(e, "name") || (null != n ? m(n, "name") : n)) ? f : i) == u ? f.call(c, { name: "name", hash: {}, data: t, loc: { start: { line: 27, column: 3 }, end: { line: 27, column: 13 } } }) : f) ? d : "") + '" [shape=diamond fixedsize=true width=0.35 height=0.35 fontsize=10 class="' + (null != (d = typeof (f = null != (f = m(e, "class") || (null != n ? m(n, "class") : n)) ? f : i) == u ? f.call(c, { name: "class", hash: {}, data: t, loc: { start: { line: 27, column: 87 }, end: { line: 27, column: 98 } } }) : f) ? d : "") + '" ' + (null != (d = m(e, "if").call(c, null != n ? m(n, "color") : n, { name: "if", hash: {}, fn: l.program(12, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 27, column: 100 }, end: { line: 27, column: 140 } } })) ? d : "") + (null != (d = m(e, "if").call(c, null != n ? m(n, "active") : n, { name: "if", hash: {}, fn: l.program(9, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 27, column: 140 }, end: { line: 27, column: 174 } } })) ? d : "") + 'label=" "]\n "' + (null != (d = typeof (f = null != (f = m(e, "name") || (null != n ? m(n, "name") : n)) ? f : i) == u ? f.call(c, { name: "name", hash: {}, data: t, loc: { start: { line: 28, column: 3 }, end: { line: 28, column: 13 } } }) : f) ? d : "") + '" -> "' + (null != (d = typeof (f = null != (f = m(e, "name") || (null != n ? m(n, "name") : n)) ? f : i) == u ? f.call(c, { name: "name", hash: {}, data: t, loc: { start: { line: 28, column: 19 }, end: { line: 28, column: 29 } } }) : f) ? d : "") + '" [label=<', f = null != (f = m(e, "actionStrings") || (null != n ? m(n, "actionStrings") : n)) ? f : i, h = { name: "actionStrings", hash: {}, fn: l.program(32, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 28, column: 39 }, end: { line: 28, column: 156 } } }, d = typeof f == u ? f.call(c, h) : f; return null != (d = m(e, "actionStrings") ? d : s.call(n, d, h)) && (p += d), p += '> color="#FFFFFF01"', f = null != (f = m(e, "color") || (null != n ? m(n, "color") : n)) ? f : i, h = { name: "color", hash: {}, fn: l.program(41, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 28, column: 175 }, end: { line: 28, column: 215 } } }, d = typeof f == u ? f.call(c, h) : f, null != (d = m(e, "color") ? d : s.call(n, d, h)) && (p += d), p + ' class="' + (null != (d = typeof (f = null != (f = m(e, "class") || (null != n ? m(n, "class") : n)) ? f : i) == u ? f.call(c, { name: "class", hash: {}, data: t, loc: { start: { line: 28, column: 223 }, end: { line: 28, column: 234 } } }) : f) ? d : "") + '"];\n'; }, 32: function (l, n, e, a, t, o, r) { var c, n = null != n ? n : l.nullContext || {}, i = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
16
+ return l[n]; }; return (null != (c = i(e, "if").call(n, t && i(t, "first"), { name: "if", hash: {}, fn: l.program(33, t, 0, o, r), inverse: l.program(35, t, 0, o, r), data: t, loc: { start: { line: 28, column: 57 }, end: { line: 28, column: 88 } } })) ? c : "") + (null != (c = i(e, "if").call(n, null != r[1] ? i(r[1], "active") : r[1], { name: "if", hash: {}, fn: l.program(37, t, 0, o, r), inverse: l.program(39, t, 0, o, r), data: t, loc: { start: { line: 28, column: 88 }, end: { line: 28, column: 137 } } })) ? c : ""); }, 33: function (l, n, e, a, t) { return ""; }, 35: function (l, n, e, a, t) { return "\\n"; }, 37: function (l, n, e, a, t) { return "<i>" + l.escapeExpression(l.lambda(n, n)) + "</i>"; }, 39: function (l, n, e, a, t) { return l.escapeExpression(l.lambda(n, n)); }, 41: function (l, n, e, a, t) { return ' fontcolor="' + (null != (l = l.lambda(n, n)) ? l : "") + '"'; }, 43: function (l, n, e, a, t) { var o, r, c = null != n ? n : l.nullContext || {}, i = l.hooks.helperMissing, u = "function", s = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
17
+ return l[n]; }; return ' "' + (null != (o = typeof (r = null != (r = s(e, "name") || (null != n ? s(n, "name") : n)) ? r : i) == u ? r.call(c, { name: "name", hash: {}, data: t, loc: { start: { line: 31, column: 3 }, end: { line: 31, column: 13 } } }) : r) ? o : "") + '" [shape=rect class="' + (null != (o = typeof (r = null != (r = s(e, "class") || (null != n ? s(n, "class") : n)) ? r : i) == u ? r.call(c, { name: "class", hash: {}, data: t, loc: { start: { line: 31, column: 34 }, end: { line: 31, column: 45 } } }) : r) ? o : "") + '" ' + (null != (o = s(e, "if").call(c, null != n ? s(n, "color") : n, { name: "if", hash: {}, fn: l.program(5, t, 0), inverse: l.program(7, t, 0), data: t, loc: { start: { line: 31, column: 47 }, end: { line: 31, column: 135 } } })) ? o : "") + (null != (o = s(e, "if").call(c, null != n ? s(n, "active") : n, { name: "if", hash: {}, fn: l.program(9, t, 0), inverse: l.noop, data: t, loc: { start: { line: 31, column: 135 }, end: { line: 31, column: 169 } } })) ? o : "") + 'label=" " fixedsize=true style=filled ' + (null != (o = typeof (r = null != (r = s(e, "sizingExtras") || (null != n ? s(n, "sizingExtras") : n)) ? r : i) == u ? r.call(c, { name: "sizingExtras", hash: {}, data: t, loc: { start: { line: 31, column: 207 }, end: { line: 31, column: 225 } } }) : r) ? o : "") + "]\n"; }, 45: function (l, n, e, a, t) { var o, r, c = null != n ? n : l.nullContext || {}, i = l.hooks.helperMissing, u = "function", s = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
18
+ return l[n]; }; return ' "' + (null != (o = typeof (r = null != (r = s(e, "name") || (null != n ? s(n, "name") : n)) ? r : i) == u ? r.call(c, { name: "name", hash: {}, data: t, loc: { start: { line: 37, column: 3 }, end: { line: 37, column: 13 } } }) : r) ? o : "") + '" [label= < \n <table align="center" cellborder="0" border="0">\n <tr><td cellpadding="0"><font ' + (null != (o = s(e, "if").call(c, null != n ? s(n, "color") : n, { name: "if", hash: {}, fn: l.program(12, t, 0), inverse: l.noop, data: t, loc: { start: { line: 39, column: 38 }, end: { line: 39, column: 78 } } })) ? o : "") + 'point-size="20">X</font></td></tr>\n <tr><td cellpadding="0"><font ' + (null != (o = s(e, "if").call(c, null != n ? s(n, "color") : n, { name: "if", hash: {}, fn: l.program(46, t, 0), inverse: l.noop, data: t, loc: { start: { line: 40, column: 38 }, end: { line: 40, column: 77 } } })) ? o : "") + ">" + l.escapeExpression(typeof (r = null != (r = s(e, "label") || (null != n ? s(n, "label") : n)) ? r : i) == u ? r.call(c, { name: "label", hash: {}, data: t, loc: { start: { line: 40, column: 78 }, end: { line: 40, column: 87 } } }) : r) + '</font></td></tr>\n </table>\n > class="' + (null != (o = typeof (r = null != (r = s(e, "class") || (null != n ? s(n, "class") : n)) ? r : i) == u ? r.call(c, { name: "class", hash: {}, data: t, loc: { start: { line: 42, column: 13 }, end: { line: 42, column: 24 } } }) : r) ? o : "") + '"]\n'; }, 46: function (l, n, e, a, t) { var o = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
19
+ return l[n]; }; return 'color="' + (null != (o = "function" == typeof (e = null != (e = o(e, "color") || (null != n ? o(n, "color") : n)) ? e : l.hooks.helperMissing) ? e.call(null != n ? n : l.nullContext || {}, { name: "color", hash: {}, data: t, loc: { start: { line: 40, column: 58 }, end: { line: 40, column: 69 } } }) : e) ? o : "") + '"'; }, 48: function (l, n, e, a, t) { var o, r, c = null != n ? n : l.nullContext || {}, i = l.hooks.helperMissing, u = "function", s = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
20
+ return l[n]; }; return ' "' + (null != (o = typeof (r = null != (r = s(e, "name") || (null != n ? s(n, "name") : n)) ? r : i) == u ? r.call(c, { name: "name", hash: {}, data: t, loc: { start: { line: 45, column: 3 }, end: { line: 45, column: 13 } } }) : r) ? o : "") + '" [shape=circle style=filled class="' + (null != (o = typeof (r = null != (r = s(e, "class") || (null != n ? s(n, "class") : n)) ? r : i) == u ? r.call(c, { name: "class", hash: {}, data: t, loc: { start: { line: 45, column: 49 }, end: { line: 45, column: 60 } } }) : r) ? o : "") + '" ' + (null != (o = s(e, "if").call(c, null != n ? s(n, "color") : n, { name: "if", hash: {}, fn: l.program(5, t, 0), inverse: l.program(7, t, 0), data: t, loc: { start: { line: 45, column: 62 }, end: { line: 45, column: 150 } } })) ? o : "") + "fixedsize=true height=0.15 peripheries=2 " + (null != (o = s(e, "if").call(c, null != n ? s(n, "active") : n, { name: "if", hash: {}, fn: l.program(9, t, 0), inverse: l.noop, data: t, loc: { start: { line: 45, column: 191 }, end: { line: 45, column: 225 } } })) ? o : "") + 'label=""]\n'; }, 50: function (l, n, e, a, t) { var o = null != n ? n : l.nullContext || {}, r = l.hooks.helperMissing, c = "function", i = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
21
+ return l[n]; }, u = ' subgraph "cluster_' + (null != (p = typeof (s = null != (s = i(e, "name") || (null != n ? i(n, "name") : n)) ? s : r) == c ? s.call(o, { name: "name", hash: {}, data: t, loc: { start: { line: 48, column: 20 }, end: { line: 48, column: 30 } } }) : s) ? p : "") + '" {\n class="' + (null != (p = typeof (s = null != (s = i(e, "class") || (null != n ? i(n, "class") : n)) ? s : r) == c ? s.call(o, { name: "class", hash: {}, data: t, loc: { start: { line: 49, column: 11 }, end: { line: 49, column: 22 } } }) : s) ? p : "") + '" ' + (null != (p = i(e, "if").call(o, null != n ? i(n, "color") : n, { name: "if", hash: {}, fn: l.program(12, t, 0), inverse: l.noop, data: t, loc: { start: { line: 49, column: 24 }, end: { line: 49, column: 64 } } })) ? p : "") + 'label= <\n <table cellborder="0" border="0">\n <tr><td>' + (null != (p = i(e, "if").call(o, null != n ? i(n, "active") : n, { name: "if", hash: {}, fn: l.program(20, t, 0), inverse: l.program(22, t, 0), data: t, loc: { start: { line: 51, column: 14 }, end: { line: 51, column: 68 } } })) ? p : "") + "</td></tr>\n", s = null != (s = i(e, "actionStrings") || (null != n ? i(n, "actionStrings") : n)) ? s : r, m = { name: "actionStrings", hash: {}, fn: l.program(51, t, 0), inverse: l.noop, data: t, loc: { start: { line: 52, column: 6 }, end: { line: 55, column: 24 } } }, p = typeof s == c ? s.call(o, m) : s; return null != (p = i(e, "actionStrings") ? p : l.hooks.blockHelperMissing.call(n, p, m)) && (u += p), u + " </table>\n > " + (null != (p = i(e, "if").call(o, null != n ? i(n, "parentIsParallel") : n, { name: "if", hash: {}, fn: l.program(53, t, 0), inverse: l.program(55, t, 0), data: t, loc: { start: { line: 57, column: 6 }, end: { line: 57, column: 137 } } })) ? p : "") + '\n "' + (null != (p = typeof (s = null != (s = i(e, "name") || (null != n ? i(n, "name") : n)) ? s : r) == c ? s.call(o, { name: "name", hash: {}, data: t, loc: { start: { line: 58, column: 5 }, end: { line: 58, column: 15 } } }) : s) ? p : "") + '" [shape=point style=invis margin=0 width=0 height=0 fixedsize=true]\n ' + (null != (p = (i(e, "stateSection") || n && i(n, "stateSection") || r).call(o, null != n ? i(n, "statemachine") : n, { name: "stateSection", hash: {}, fn: l.program(33, t, 0), inverse: l.noop, data: t, loc: { start: { line: 59, column: 4 }, end: { line: 59, column: 51 } } })) ? p : "") + "\n }\n"; }, 51: function (l, n, e, a, t) { var o = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
22
+ return l[n]; }; return " " + (null != (e = o(e, "if").call(null != n ? n : l.nullContext || {}, t && o(t, "first"), { name: "if", hash: {}, fn: l.program(25, t, 0), inverse: l.noop, data: t, loc: { start: { line: 53, column: 8 }, end: { line: 53, column: 34 } } })) ? e : "") + '\n <tr><td align="left">' + l.escapeExpression(l.lambda(n, n)) + "</td></tr>\n"; }, 53: function (l, n, e, a, t) { return 'style="dashed" penwidth=1'; }, 55: function (l, n, e, a, t) { var o = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
23
+ return l[n]; }; return "style=rounded " + (null != (e = o(e, "if").call(null != n ? n : l.nullContext || {}, null != n ? o(n, "active") : n, { name: "if", hash: {}, fn: l.program(56, t, 0), inverse: l.program(58, t, 0), data: t, loc: { start: { line: 57, column: 77 }, end: { line: 57, column: 130 } } })) ? e : ""); }, 56: function (l, n, e, a, t) { return "penwidth=3.0"; }, 58: function (l, n, e, a, t) { return "penwidth=2.0"; }, 60: function (l, n, e, a, t, o, r) { var c = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
24
+ return l[n]; }, i = "", u = null != (u = c(e, "noteName") || (null != n ? c(n, "noteName") : n)) ? u : l.hooks.helperMissing, o = { name: "noteName", hash: {}, fn: l.program(61, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 63, column: 4 }, end: { line: 66, column: 17 } } }, r = "function" == typeof u ? u.call(null != n ? n : l.nullContext || {}, o) : u; return null != (r = c(e, "noteName") ? r : l.hooks.blockHelperMissing.call(n, r, o)) && (i += r), i; }, 61: function (l, n, e, a, t, o, r) { var c, i = l.lambda, l = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
25
+ return l[n]; }; return ' "' + (null != (c = i(n, n)) ? c : "") + '" [color=black fontcolor=black label="' + (null != (c = i(null != r[1] ? l(r[1], "noteFlattened") : r[1], n)) ? c : "") + '" shape=note fontsize=10 fillcolor="#ffffcc" penwidth=1.0]\n "' + (null != (c = i(null != r[1] ? l(r[1], "name") : r[1], n)) ? c : "") + '" -> "' + (null != (c = i(n, n)) ? c : "") + '" [style=dashed arrowtail=none arrowhead=none]\n'; }, compiler: [8, ">= 4.3.0"], main: function (l, n, e, a, t, o, r) { var c = null != n ? n : l.nullContext || {}, i = l.hooks.helperMissing, u = "function", s = l.hooks.blockHelperMissing, m = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
26
+ return l[n]; }, p = "", f = null != (f = m(e, "compositeStates") || (null != n ? m(n, "compositeStates") : n)) ? f : i, h = { name: "compositeStates", hash: {}, fn: l.program(1, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 20 } } }, d = typeof f == u ? f.call(c, h) : f; return null != (d = m(e, "compositeStates") ? d : s.call(n, d, h)) && (p += d), f = null != (f = m(e, "initialStates") || (null != n ? m(n, "initialStates") : n)) ? f : i, h = { name: "initialStates", hash: {}, fn: l.program(4, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 6, column: 0 }, end: { line: 8, column: 18 } } }, d = typeof f == u ? f.call(c, h) : f, null != (d = m(e, "initialStates") ? d : s.call(n, d, h)) && (p += d), f = null != (f = m(e, "regularStates") || (null != n ? m(n, "regularStates") : n)) ? f : i, h = { name: "regularStates", hash: {}, fn: l.program(11, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 9, column: 0 }, end: { line: 19, column: 18 } } }, d = typeof f == u ? f.call(c, h) : f, null != (d = m(e, "regularStates") ? d : s.call(n, d, h)) && (p += d), f = null != (f = m(e, "historyStates") || (null != n ? m(n, "historyStates") : n)) ? f : i, h = { name: "historyStates", hash: {}, fn: l.program(27, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 20, column: 0 }, end: { line: 22, column: 18 } } }, d = typeof f == u ? f.call(c, h) : f, null != (d = m(e, "historyStates") ? d : s.call(n, d, h)) && (p += d), f = null != (f = m(e, "deepHistoryStates") || (null != n ? m(n, "deepHistoryStates") : n)) ? f : i, h = { name: "deepHistoryStates", hash: {}, fn: l.program(29, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 23, column: 0 }, end: { line: 25, column: 22 } } }, d = typeof f == u ? f.call(c, h) : f, null != (d = m(e, "deepHistoryStates") ? d : s.call(n, d, h)) && (p += d), f = null != (f = m(e, "choiceStates") || (null != n ? m(n, "choiceStates") : n)) ? f : i, h = { name: "choiceStates", hash: {}, fn: l.program(31, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 26, column: 0 }, end: { line: 29, column: 17 } } }, d = typeof f == u ? f.call(c, h) : f, null != (d = m(e, "choiceStates") ? d : s.call(n, d, h)) && (p += d), f = null != (f = m(e, "forkjoinStates") || (null != n ? m(n, "forkjoinStates") : n)) ? f : i, h = { name: "forkjoinStates", hash: {}, fn: l.program(43, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 30, column: 0 }, end: { line: 32, column: 19 } } }, d = typeof f == u ? f.call(c, h) : f, null != (d = m(e, "forkjoinStates") ? d : s.call(n, d, h)) && (p += d), f = null != (f = m(e, "junctionStates") || (null != n ? m(n, "junctionStates") : n)) ? f : i, h = { name: "junctionStates", hash: {}, fn: l.program(4, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 33, column: 0 }, end: { line: 35, column: 19 } } }, d = typeof f == u ? f.call(c, h) : f, null != (d = m(e, "junctionStates") ? d : s.call(n, d, h)) && (p += d), f = null != (f = m(e, "terminateStates") || (null != n ? m(n, "terminateStates") : n)) ? f : i, h = { name: "terminateStates", hash: {}, fn: l.program(45, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 36, column: 0 }, end: { line: 43, column: 20 } } }, d = typeof f == u ? f.call(c, h) : f, null != (d = m(e, "terminateStates") ? d : s.call(n, d, h)) && (p += d), f = null != (f = m(e, "finalStates") || (null != n ? m(n, "finalStates") : n)) ? f : i, h = { name: "finalStates", hash: {}, fn: l.program(48, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 44, column: 0 }, end: { line: 46, column: 16 } } }, d = typeof f == u ? f.call(c, h) : f, null != (d = m(e, "finalStates") ? d : s.call(n, d, h)) && (p += d), f = null != (f = m(e, "compositeStates") || (null != n ? m(n, "compositeStates") : n)) ? f : i, h = { name: "compositeStates", hash: {}, fn: l.program(50, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 47, column: 0 }, end: { line: 61, column: 20 } } }, d = typeof f == u ? f.call(c, h) : f, null != (d = m(e, "compositeStates") ? d : s.call(n, d, h)) && (p += d), f = null != (f = m(e, "states") || (null != n ? m(n, "states") : n)) ? f : i, h = { name: "states", hash: {}, fn: l.program(60, t, 0, o, r), inverse: l.noop, data: t, loc: { start: { line: 62, column: 0 }, end: { line: 67, column: 11 } } }, d = typeof f == u ? f.call(c, h) : f, null != (d = m(e, "states") ? d : s.call(n, d, h)) && (p += d), p; }, useData: !0, useDepths: !0 });
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var Handlebars = require("handlebars/dist/handlebars.runtime"), template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
4
+ templates["dot.template.hbs"] = template({ 1: function (l, n, o, e, a, t, r) { var u = null != n ? n : l.nullContext || {}, c = l.hooks.helperMissing, s = "function", i = l.hooks.blockHelperMissing, m = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
5
+ return l[n]; }, p = "", f = null != (f = m(o, "noteName") || (null != n ? m(n, "noteName") : n)) ? f : c, h = { name: "noteName", hash: {}, fn: l.noop, inverse: l.program(2, a, 0, t, r), data: a, loc: { start: { line: 9, column: 2 }, end: { line: 26, column: 15 } } }, d = typeof f == s ? f.call(u, h) : f; return null != (d = m(o, "noteName") ? d : i.call(n, d, h)) && (p += d), f = null != (f = m(o, "noteName") || (null != n ? m(n, "noteName") : n)) ? f : c, h = { name: "noteName", hash: {}, fn: l.program(19, a, 0, t, r), inverse: l.noop, data: a, loc: { start: { line: 27, column: 2 }, end: { line: 37, column: 15 } } }, d = typeof f == s ? f.call(u, h) : f, null != (d = m(o, "noteName") ? d : i.call(n, d, h)) && (p += d), p; }, 2: function (l, n, o, e, a) { var t = null != n ? n : l.nullContext || {}, r = l.hooks.helperMissing, u = "function", c = l.hooks.blockHelperMissing, s = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
6
+ return l[n]; }, i = "", m = null != (m = s(o, "isCompositeSelf") || (null != n ? s(n, "isCompositeSelf") : n)) ? m : r, p = { name: "isCompositeSelf", hash: {}, fn: l.noop, inverse: l.program(3, a, 0), data: a, loc: { start: { line: 10, column: 4 }, end: { line: 16, column: 24 } } }, f = typeof m == u ? m.call(t, p) : m; return null != (f = s(o, "isCompositeSelf") ? f : c.call(n, f, p)) && (i += f), m = null != (m = s(o, "isCompositeSelf") || (null != n ? s(n, "isCompositeSelf") : n)) ? m : r, p = { name: "isCompositeSelf", hash: {}, fn: l.program(14, a, 0), inverse: l.noop, data: a, loc: { start: { line: 17, column: 4 }, end: { line: 25, column: 24 } } }, f = typeof m == u ? m.call(t, p) : m, null != (f = s(o, "isCompositeSelf") ? f : c.call(n, f, p)) && (i += f), i; }, 3: function (l, n, o, e, a) { var t = null != n ? n : l.nullContext || {}, r = l.hooks.helperMissing, u = "function", c = l.hooks.blockHelperMissing, s = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
7
+ return l[n]; }, i = ' "' + (null != (f = typeof (m = null != (m = s(o, "from") || (null != n ? s(n, "from") : n)) ? m : r) == u ? m.call(t, { name: "from", hash: {}, data: a, loc: { start: { line: 11, column: 5 }, end: { line: 11, column: 15 } } }) : m) ? f : "") + '" -> "' + (null != (f = typeof (m = null != (m = s(o, "to") || (null != n ? s(n, "to") : n)) ? m : r) == u ? m.call(t, { name: "to", hash: {}, data: a, loc: { start: { line: 11, column: 21 }, end: { line: 11, column: 29 } } }) : m) ? f : "") + '" [label="', m = null != (m = s(o, "label") || (null != n ? s(n, "label") : n)) ? m : r, p = { name: "label", hash: {}, fn: l.noop, inverse: l.program(4, a, 0), data: a, loc: { start: { line: 11, column: 39 }, end: { line: 11, column: 60 } } }, f = typeof m == u ? m.call(t, p) : m; return null != (f = s(o, "label") ? f : c.call(n, f, p)) && (i += f), i += (null != (f = typeof (m = null != (m = s(o, "label") || (null != n ? s(n, "label") : n)) ? m : r) == u ? m.call(t, { name: "label", hash: {}, data: a, loc: { start: { line: 11, column: 60 }, end: { line: 11, column: 71 } } }) : m) ? f : "") + '"', m = null != (m = s(o, "fromComposite") || (null != n ? s(n, "fromComposite") : n)) ? m : r, p = { name: "fromComposite", hash: {}, fn: l.program(6, a, 0), inverse: l.noop, data: a, loc: { start: { line: 12, column: 28 }, end: { line: 12, column: 92 } } }, f = typeof m == u ? m.call(t, p) : m, null != (f = s(o, "fromComposite") ? f : c.call(n, f, p)) && (i += f), m = null != (m = s(o, "toComposite") || (null != n ? s(n, "toComposite") : n)) ? m : r, p = { name: "toComposite", hash: {}, fn: l.program(8, a, 0), inverse: l.noop, data: a, loc: { start: { line: 13, column: 28 }, end: { line: 13, column: 86 } } }, f = typeof m == u ? m.call(t, p) : m, null != (f = s(o, "toComposite") ? f : c.call(n, f, p)) && (i += f), m = null != (m = s(o, "color") || (null != n ? s(n, "color") : n)) ? m : r, p = { name: "color", hash: {}, fn: l.program(10, a, 0), inverse: l.noop, data: a, loc: { start: { line: 14, column: 28 }, end: { line: 14, column: 85 } } }, f = typeof m == u ? m.call(t, p) : m, null != (f = s(o, "color") ? f : c.call(n, f, p)) && (i += f), m = null != (m = s(o, "width") || (null != n ? s(n, "width") : n)) ? m : r, p = { name: "width", hash: {}, fn: l.program(12, a, 0), inverse: l.noop, data: a, loc: { start: { line: 15, column: 28 }, end: { line: 15, column: 68 } } }, f = typeof m == u ? m.call(t, p) : m, null != (f = s(o, "width") ? f : c.call(n, f, p)) && (i += f), i + ' class="' + (null != (f = typeof (m = null != (m = s(o, "class") || (null != n ? s(n, "class") : n)) ? m : r) == u ? m.call(t, { name: "class", hash: {}, data: a, loc: { start: { line: 15, column: 76 }, end: { line: 15, column: 87 } } }) : m) ? f : "") + '"]\n'; }, 4: function (l, n, o, e, a) { return " "; }, 6: function (l, n, o, e, a) { var t = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
8
+ return l[n]; }; return ' ltail="cluster_' + (null != (t = "function" == typeof (o = null != (o = t(o, "from") || (null != n ? t(n, "from") : n)) ? o : l.hooks.helperMissing) ? o.call(null != n ? n : l.nullContext || {}, { name: "from", hash: {}, data: a, loc: { start: { line: 12, column: 63 }, end: { line: 12, column: 73 } } }) : o) ? t : "") + '"'; }, 8: function (l, n, o, e, a) { var t = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
9
+ return l[n]; }; return ' lhead="cluster_' + (null != (t = "function" == typeof (o = null != (o = t(o, "to") || (null != n ? t(n, "to") : n)) ? o : l.hooks.helperMissing) ? o.call(null != n ? n : l.nullContext || {}, { name: "to", hash: {}, data: a, loc: { start: { line: 13, column: 61 }, end: { line: 13, column: 69 } } }) : o) ? t : "") + '"'; }, 10: function (l, n, o, e, a) { var t, l = l.lambda; return ' color="' + (null != (t = l(n, n)) ? t : "") + '" fontcolor="' + (null != (t = l(n, n)) ? t : "") + '"'; }, 12: function (l, n, o, e, a) { return ' penwidth="' + (null != (l = l.lambda(n, n)) ? l : "") + '"'; }, 14: function (l, n, o, e, a) { var t = null != n ? n : l.nullContext || {}, r = l.hooks.helperMissing, u = "function", c = l.hooks.blockHelperMissing, s = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
10
+ return l[n]; }, i = ' "' + (null != (f = typeof (m = null != (m = s(o, "from") || (null != n ? s(n, "from") : n)) ? m : r) == u ? m.call(t, { name: "from", hash: {}, data: a, loc: { start: { line: 18, column: 7 }, end: { line: 18, column: 17 } } }) : m) ? f : "") + '" -> "self_' + (null != (f = typeof (m = null != (m = s(o, "name") || (null != n ? s(n, "name") : n)) ? m : r) == u ? m.call(t, { name: "name", hash: {}, data: a, loc: { start: { line: 18, column: 28 }, end: { line: 18, column: 38 } } }) : m) ? f : "") + '" [label="', m = null != (m = s(o, "label") || (null != n ? s(n, "label") : n)) ? m : r, p = { name: "label", hash: {}, fn: l.noop, inverse: l.program(4, a, 0), data: a, loc: { start: { line: 18, column: 48 }, end: { line: 18, column: 69 } } }, f = typeof m == u ? m.call(t, p) : m; return null != (f = s(o, "label") ? f : c.call(n, f, p)) && (i += f), i += (null != (f = typeof (m = null != (m = s(o, "label") || (null != n ? s(n, "label") : n)) ? m : r) == u ? m.call(t, { name: "label", hash: {}, data: a, loc: { start: { line: 18, column: 69 }, end: { line: 18, column: 80 } } }) : m) ? f : "") + '" arrowhead=none', m = null != (m = s(o, "tailportflags") || (null != n ? s(n, "tailportflags") : n)) ? m : r, p = { name: "tailportflags", hash: {}, fn: l.program(15, a, 0), inverse: l.noop, data: a, loc: { start: { line: 19, column: 28 }, end: { line: 19, column: 73 } } }, f = typeof m == u ? m.call(t, p) : m, null != (f = s(o, "tailportflags") ? f : c.call(n, f, p)) && (i += f), i += ' ltail="cluster_' + (null != (f = typeof (m = null != (m = s(o, "from") || (null != n ? s(n, "from") : n)) ? m : r) == u ? m.call(t, { name: "from", hash: {}, data: a, loc: { start: { line: 19, column: 89 }, end: { line: 19, column: 99 } } }) : m) ? f : "") + '"', m = null != (m = s(o, "color") || (null != n ? s(n, "color") : n)) ? m : r, p = { name: "color", hash: {}, fn: l.program(10, a, 0), inverse: l.noop, data: a, loc: { start: { line: 20, column: 28 }, end: { line: 20, column: 85 } } }, f = typeof m == u ? m.call(t, p) : m, null != (f = s(o, "color") ? f : c.call(n, f, p)) && (i += f), i += ' class="' + (null != (f = typeof (m = null != (m = s(o, "class") || (null != n ? s(n, "class") : n)) ? m : r) == u ? m.call(t, { name: "class", hash: {}, data: a, loc: { start: { line: 20, column: 93 }, end: { line: 20, column: 104 } } }) : m) ? f : "") + '"]\n "self_' + (null != (f = typeof (m = null != (m = s(o, "name") || (null != n ? s(n, "name") : n)) ? m : r) == u ? m.call(t, { name: "name", hash: {}, data: a, loc: { start: { line: 21, column: 12 }, end: { line: 21, column: 22 } } }) : m) ? f : "") + '" -> "' + (null != (f = typeof (m = null != (m = s(o, "from") || (null != n ? s(n, "from") : n)) ? m : r) == u ? m.call(t, { name: "from", hash: {}, data: a, loc: { start: { line: 21, column: 28 }, end: { line: 21, column: 38 } } }) : m) ? f : "") + '" [lhead="cluster_' + (null != (f = typeof (m = null != (m = s(o, "from") || (null != n ? s(n, "from") : n)) ? m : r) == u ? m.call(t, { name: "from", hash: {}, data: a, loc: { start: { line: 21, column: 56 }, end: { line: 21, column: 66 } } }) : m) ? f : "") + '"', m = null != (m = s(o, "headportflags") || (null != n ? s(n, "headportflags") : n)) ? m : r, p = { name: "headportflags", hash: {}, fn: l.program(15, a, 0), inverse: l.noop, data: a, loc: { start: { line: 22, column: 28 }, end: { line: 22, column: 73 } } }, f = typeof m == u ? m.call(t, p) : m, null != (f = s(o, "headportflags") ? f : c.call(n, f, p)) && (i += f), m = null != (m = s(o, "color") || (null != n ? s(n, "color") : n)) ? m : r, p = { name: "color", hash: {}, fn: l.program(17, a, 0), inverse: l.noop, data: a, loc: { start: { line: 23, column: 28 }, end: { line: 23, column: 65 } } }, f = typeof m == u ? m.call(t, p) : m, null != (f = s(o, "color") ? f : c.call(n, f, p)) && (i += f), m = null != (m = s(o, "width") || (null != n ? s(n, "width") : n)) ? m : r, p = { name: "width", hash: {}, fn: l.program(12, a, 0), inverse: l.noop, data: a, loc: { start: { line: 24, column: 28 }, end: { line: 24, column: 68 } } }, f = typeof m == u ? m.call(t, p) : m, null != (f = s(o, "width") ? f : c.call(n, f, p)) && (i += f), i + ' class="' + (null != (f = typeof (m = null != (m = s(o, "class") || (null != n ? s(n, "class") : n)) ? m : r) == u ? m.call(t, { name: "class", hash: {}, data: a, loc: { start: { line: 24, column: 76 }, end: { line: 24, column: 87 } } }) : m) ? f : "") + '"]\n'; }, 15: function (l, n, o, e, a) { return " " + (null != (l = l.lambda(n, n)) ? l : ""); }, 17: function (l, n, o, e, a) { return ' color="' + (null != (l = l.lambda(n, n)) ? l : "") + '"'; }, 19: function (l, n, o, e, a, t, r) { var u, c = l.lambda, s = l.hooks.blockHelperMissing, i = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
11
+ return l[n]; }; return ' "i_' + (null != (u = c(n, n)) ? u : "") + '" [shape=point style=invis margin=0 width=0 height=0 fixedsize=true]\n "' + (null != (u = c(null != r[1] ? i(r[1], "from") : r[1], n)) ? u : "") + '" -> "i_' + (null != (u = c(n, n)) ? u : "") + '" [arrowhead=none' + (null != (u = s.call(n, c(null != r[1] ? i(r[1], "fromComposite") : r[1], n), { name: "../fromComposite", hash: {}, fn: l.program(20, a, 0, t, r), inverse: l.noop, data: a, loc: { start: { line: 30, column: 32 }, end: { line: 30, column: 105 } } })) ? u : "") + (null != (u = s.call(n, c(null != r[1] ? i(r[1], "color") : r[1], n), { name: "../color", hash: {}, fn: l.program(17, a, 0, t, r), inverse: l.noop, data: a, loc: { start: { line: 31, column: 32 }, end: { line: 31, column: 75 } } })) ? u : "") + ']\n "i_' + (null != (u = c(n, n)) ? u : "") + '" -> "' + (null != (u = c(null != r[1] ? i(r[1], "to") : r[1], n)) ? u : "") + '" [label="' + (null != (u = s.call(n, c(null != r[1] ? i(r[1], "label") : r[1], n), { name: "../label", hash: {}, fn: l.noop, inverse: l.program(4, a, 0, t, r), data: a, loc: { start: { line: 32, column: 43 }, end: { line: 32, column: 70 } } })) ? u : "") + (null != (u = c(null != r[1] ? i(r[1], "label") : r[1], n)) ? u : "") + '"' + (null != (u = s.call(n, c(null != r[1] ? i(r[1], "toComposite") : r[1], n), { name: "../toComposite", hash: {}, fn: l.program(22, a, 0, t, r), inverse: l.noop, data: a, loc: { start: { line: 33, column: 32 }, end: { line: 33, column: 99 } } })) ? u : "") + (null != (u = s.call(n, c(null != r[1] ? i(r[1], "color") : r[1], n), { name: "../color", hash: {}, fn: l.program(10, a, 0, t, r), inverse: l.noop, data: a, loc: { start: { line: 34, column: 32 }, end: { line: 34, column: 95 } } })) ? u : "") + ']\n "i_' + (null != (u = c(n, n)) ? u : "") + '" -> "' + (null != (u = c(n, n)) ? u : "") + '" [style=dashed arrowtail=none arrowhead=none weight=0]\n "' + (null != (u = c(n, n)) ? u : "") + '" [label="' + (null != (u = c(null != r[1] ? i(r[1], "noteFlattened") : r[1], n)) ? u : "") + '" shape=note fontsize=10 color=black fontcolor=black fillcolor="#ffffcc" penwidth=1.0]\n'; }, 20: function (l, n, o, e, a, t, r) { var u = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
12
+ return l[n]; }; return ' ltail="cluster_' + (null != (l = l.lambda(null != r[1] ? u(r[1], "from") : r[1], n)) ? l : "") + '"'; }, 22: function (l, n, o, e, a, t, r) { var u = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
13
+ return l[n]; }; return ' lhead="cluster_' + (null != (l = l.lambda(null != r[1] ? u(r[1], "to") : r[1], n)) ? l : "") + '"'; }, compiler: [8, ">= 4.3.0"], main: function (l, n, o, e, a, t, r) { var u = null != n ? n : l.nullContext || {}, c = l.hooks.helperMissing, s = "function", i = l.lookupProperty || function (l, n) { if (Object.prototype.hasOwnProperty.call(l, n))
14
+ return l[n]; }, e = 'digraph "state transitions" {\n ' + (null != (p = typeof (m = null != (m = i(o, "graphAttributes") || (null != n ? i(n, "graphAttributes") : n)) ? m : c) == s ? m.call(u, { name: "graphAttributes", hash: {}, data: a, loc: { start: { line: 2, column: 2 }, end: { line: 2, column: 23 } } }) : m) ? p : "") + "\n node [" + (null != (p = typeof (m = null != (m = i(o, "nodeAttributes") || (null != n ? i(n, "nodeAttributes") : n)) ? m : c) == s ? m.call(u, { name: "nodeAttributes", hash: {}, data: a, loc: { start: { line: 3, column: 8 }, end: { line: 3, column: 28 } } }) : m) ? p : "") + "]\n edge [" + (null != (p = typeof (m = null != (m = i(o, "edgeAttributes") || (null != n ? i(n, "edgeAttributes") : n)) ? m : c) == s ? m.call(u, { name: "edgeAttributes", hash: {}, data: a, loc: { start: { line: 4, column: 8 }, end: { line: 4, column: 28 } } }) : m) ? p : "") + "]\n\n" + (null != (p = l.invokePartial(i(e, "dot.states.template.hbs"), n, { name: "dot.states.template.hbs", data: a, indent: " ", helpers: o, partials: e, decorators: l.decorators })) ? p : "") + "\n", m = null != (m = i(o, "transitions") || (null != n ? i(n, "transitions") : n)) ? m : c, c = { name: "transitions", hash: {}, fn: l.program(1, a, 0, t, r), inverse: l.noop, data: a, loc: { start: { line: 8, column: 2 }, end: { line: 38, column: 18 } } }, p = typeof m == s ? m.call(u, c) : m; return null != (p = i(o, "transitions") ? p : l.hooks.blockHelperMissing.call(n, p, c)) && (e += p), e + "}\n"; }, usePartial: !0, useData: !0, useDepths: !0 });
@@ -0,0 +1,106 @@
1
+ import cloneDeep from "lodash/cloneDeep.js";
2
+ import options from "../../options.mjs";
3
+ import StateMachineModel from "../../state-machine-model.mjs";
4
+ import attributebuilder from "./attributebuilder.mjs";
5
+ import stateTransformers from "./state-transformers.mjs";
6
+ import transitionTransformers from "./transition-transformers.mjs";
7
+ import Counter from "./counter.mjs";
8
+ import renderDotFromAST from "./render-dot-from-ast.js";
9
+ import utl from "./utl.mjs";
10
+ function addExternalSelfTransitions(pStateMachineModel) {
11
+ return (pState) => {
12
+ if (Object.prototype.hasOwnProperty.call(pState, "statemachine")) {
13
+ pState.nestedExternalSelfTransitions = pStateMachineModel
14
+ .findExternalSelfTransitions(pState.name)
15
+ .map((pTransition) => pTransition.name);
16
+ }
17
+ return pState;
18
+ };
19
+ }
20
+ function transformStates(pStates, pDirection, pNodeAttributes, pStateMachineModel) {
21
+ pStates
22
+ .filter((pState) => pState.statemachine)
23
+ .forEach((pState) => {
24
+ pState.statemachine.states = transformStates(pState.statemachine.states, pDirection, pNodeAttributes, pStateMachineModel);
25
+ });
26
+ return pStates
27
+ .map(stateTransformers.setLabel)
28
+ .map(stateTransformers.nameNote)
29
+ .map(stateTransformers.classifyState)
30
+ .map(stateTransformers.escapeStateStrings)
31
+ .map(stateTransformers.flattenNote)
32
+ .map(stateTransformers.flattenActions)
33
+ .map(stateTransformers.flagParallelChildren)
34
+ .map(stateTransformers.tipForkJoinStates(pDirection))
35
+ .map(stateTransformers.recolor(pNodeAttributes))
36
+ .map(addExternalSelfTransitions(pStateMachineModel));
37
+ }
38
+ function splitStates(pStateMachine) {
39
+ pStateMachine.initialStates = pStateMachine.states.filter(stateTransformers.isType("initial"));
40
+ pStateMachine.regularStates = pStateMachine.states.filter((pState) => stateTransformers.isType("regular")(pState) && !pState.statemachine);
41
+ pStateMachine.historyStates = pStateMachine.states.filter(stateTransformers.isType("history"));
42
+ pStateMachine.deepHistoryStates = pStateMachine.states.filter(stateTransformers.isType("deephistory"));
43
+ pStateMachine.choiceStates = pStateMachine.states.filter(stateTransformers.isType("choice"));
44
+ pStateMachine.forkjoinStates = pStateMachine.states.filter(stateTransformers.isOneOfTypes(["fork", "join", "forkjoin"]));
45
+ pStateMachine.junctionStates = pStateMachine.states.filter(stateTransformers.isType("junction"));
46
+ pStateMachine.terminateStates = pStateMachine.states.filter(stateTransformers.isType("terminate"));
47
+ pStateMachine.finalStates = pStateMachine.states.filter(stateTransformers.isType("final"));
48
+ pStateMachine.compositeStates = pStateMachine.states.filter((pState) => pState.statemachine);
49
+ return pStateMachine;
50
+ }
51
+ function addEndTypes(pStateMachineModel) {
52
+ return (pTransition) => {
53
+ if (pStateMachineModel.findStateByName(pTransition.from).statemachine) {
54
+ pTransition.fromComposite = true;
55
+ }
56
+ if (pStateMachineModel.findStateByName(pTransition.to).statemachine) {
57
+ pTransition.toComposite = true;
58
+ }
59
+ return pTransition;
60
+ };
61
+ }
62
+ function addCompositeSelfFlag(pStateMachineModel) {
63
+ return (pTransition) => {
64
+ let lAdditionalAttributes = {};
65
+ if (utl.isCompositeSelf(pStateMachineModel, pTransition)) {
66
+ if (pStateMachineModel.findStateByName(pTransition.from).hasParent) {
67
+ lAdditionalAttributes = { hasParent: true, isCompositeSelf: true };
68
+ }
69
+ else {
70
+ lAdditionalAttributes = { isCompositeSelf: true };
71
+ }
72
+ }
73
+ return { ...pTransition, ...lAdditionalAttributes };
74
+ };
75
+ }
76
+ function nameTransition(pCounter) {
77
+ return (pTransition) => {
78
+ pTransition.name = `tr_${pTransition.from}_${pTransition.to}_${pCounter.nextAsString()}`;
79
+ if (Boolean(pTransition.note)) {
80
+ pTransition.noteName = `note_${pTransition.name}`;
81
+ }
82
+ return pTransition;
83
+ };
84
+ }
85
+ function transformTransitions(pStateMachineModel, pDirection, pCounter) {
86
+ return pStateMachineModel.flattenedTransitions
87
+ .map(nameTransition(pCounter))
88
+ .map(transitionTransformers.escapeTransitionStrings)
89
+ .map(transitionTransformers.classifyTransition)
90
+ .map(stateTransformers.flattenNote)
91
+ .map(addEndTypes(pStateMachineModel))
92
+ .map(addCompositeSelfFlag(pStateMachineModel))
93
+ .map(transitionTransformers.addPorts(pDirection));
94
+ }
95
+ export default (pStateMachine, pOptions) => {
96
+ pOptions = pOptions || {};
97
+ let lStateMachine = cloneDeep(pStateMachine);
98
+ const lStateMachineModel = new StateMachineModel(lStateMachine);
99
+ lStateMachine.transitions = transformTransitions(lStateMachineModel, pOptions.direction, new Counter());
100
+ lStateMachine.states = transformStates(lStateMachine.states, pOptions.direction, pOptions.dotNodeAttrs, lStateMachineModel);
101
+ lStateMachine = splitStates(lStateMachine);
102
+ lStateMachine.graphAttributes = attributebuilder.buildGraphAttributes(options.getOptionValue(pOptions, "engine"), options.getOptionValue(pOptions, "direction"), pOptions.dotGraphAttrs);
103
+ lStateMachine.nodeAttributes = attributebuilder.buildNodeAttributes(pOptions.dotNodeAttrs);
104
+ lStateMachine.edgeAttributes = attributebuilder.buildEdgeAttributes(pOptions.dotEdgeAttrs);
105
+ return renderDotFromAST(lStateMachine);
106
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Handlebars = require("handlebars/dist/handlebars.runtime.js");
4
+ require("./dot.template.js");
5
+ require("./dot.states.template.js");
6
+ Handlebars.registerPartial("dot.states.template.hbs", Handlebars.templates["dot.states.template.hbs"]);
7
+ Handlebars.registerHelper("stateSection", (pStateMachine) => Handlebars.templates["dot.states.template.hbs"](splitStates(pStateMachine)));
8
+ function isType(pString) {
9
+ return (pState) => pState.type === pString;
10
+ }
11
+ function isOneOfTypes(pStringArray) {
12
+ return (pState) => pStringArray.includes(pState.type);
13
+ }
14
+ function splitStates(pStateMachine) {
15
+ pStateMachine.initialStates = pStateMachine.states.filter(isType("initial"));
16
+ pStateMachine.regularStates = pStateMachine.states.filter((pState) => isType("regular")(pState) && !pState.statemachine);
17
+ pStateMachine.historyStates = pStateMachine.states.filter(isType("history"));
18
+ pStateMachine.deepHistoryStates = pStateMachine.states.filter(isType("deephistory"));
19
+ pStateMachine.choiceStates = pStateMachine.states.filter(isType("choice"));
20
+ pStateMachine.forkjoinStates = pStateMachine.states.filter(isOneOfTypes(["fork", "join", "forkjoin"]));
21
+ pStateMachine.junctionStates = pStateMachine.states.filter(isType("junction"));
22
+ pStateMachine.terminateStates = pStateMachine.states.filter(isType("terminate"));
23
+ pStateMachine.finalStates = pStateMachine.states.filter(isType("final"));
24
+ pStateMachine.compositeStates = pStateMachine.states.filter((pState) => pState.statemachine);
25
+ return pStateMachine;
26
+ }
27
+ module.exports = function renderDotFromAST(pStateMachine) {
28
+ return Handlebars.templates["dot.template.hbs"](pStateMachine);
29
+ };
@@ -0,0 +1,113 @@
1
+ import cloneDeep from "lodash/cloneDeep.js";
2
+ import utl from "./utl.mjs";
3
+ function isType(pString) {
4
+ return (pState) => pState.type === pString;
5
+ }
6
+ function isOneOfTypes(pStringArray) {
7
+ return (pState) => pStringArray.includes(pState.type);
8
+ }
9
+ function setLabel(pState) {
10
+ const lState = cloneDeep(pState);
11
+ lState.label = pState.label || pState.name;
12
+ return lState;
13
+ }
14
+ function nameNote(pState) {
15
+ if (pState.note) {
16
+ return {
17
+ noteName: `note_${pState.name}`,
18
+ ...pState,
19
+ };
20
+ }
21
+ return pState;
22
+ }
23
+ function classifyState(pState) {
24
+ const lState = { ...pState };
25
+ const lClasses = ["state", pState.type];
26
+ if (pState.class) {
27
+ lClasses.push(pState.class.trim().replace(/[ ]{2,}/g, " "));
28
+ }
29
+ lState.class = lClasses.join(" ");
30
+ return lState;
31
+ }
32
+ function formatActionType(pString) {
33
+ return pString === "activity" ? "" : `${pString}/ `;
34
+ }
35
+ function flattenActions(pState) {
36
+ if (pState.actions) {
37
+ return {
38
+ ...pState,
39
+ actionStrings: pState.actions.map((pAction) => `${formatActionType(pAction.type)}${pAction.body}`),
40
+ };
41
+ }
42
+ return pState;
43
+ }
44
+ function flattenNote(pState) {
45
+ if (pState.note) {
46
+ return {
47
+ ...pState,
48
+ noteFlattened: pState.note.join(""),
49
+ };
50
+ }
51
+ return pState;
52
+ }
53
+ function recolor(pNodeAttributes) {
54
+ return (pState) => {
55
+ const lNodeColor = (pNodeAttributes || []).find((pAttribute) => pAttribute.name === "color")?.value;
56
+ if (lNodeColor &&
57
+ !pState.color &&
58
+ isOneOfTypes([
59
+ "initial",
60
+ "fork",
61
+ "join",
62
+ "junction",
63
+ "forkjoin",
64
+ "final",
65
+ ])(pState)) {
66
+ pState.color = lNodeColor;
67
+ }
68
+ return pState;
69
+ };
70
+ }
71
+ function escapeStateStrings(pState) {
72
+ if (pState.note) {
73
+ return {
74
+ ...pState,
75
+ note: pState.note.map(utl.escapeString),
76
+ };
77
+ }
78
+ return pState;
79
+ }
80
+ function tipForkJoinStates(pDirection) {
81
+ return (pState) => {
82
+ if (isOneOfTypes(["fork", "join", "forkjoin"])(pState)) {
83
+ return {
84
+ sizingExtras: utl.isVertical(pDirection) ? "height=0.1" : "width=0.1",
85
+ ...pState,
86
+ };
87
+ }
88
+ return pState;
89
+ };
90
+ }
91
+ function flagParallelChildren(pState) {
92
+ if (pState.type === "parallel" &&
93
+ pState.statemachine &&
94
+ pState.statemachine.states) {
95
+ pState.statemachine.states = pState.statemachine.states.map((pChildState) => isType("regular")(pChildState)
96
+ ? { ...pChildState, parentIsParallel: true }
97
+ : pChildState);
98
+ }
99
+ return pState;
100
+ }
101
+ export default {
102
+ isType,
103
+ isOneOfTypes,
104
+ setLabel,
105
+ classifyState,
106
+ nameNote,
107
+ flattenActions,
108
+ flattenNote,
109
+ recolor,
110
+ escapeStateStrings,
111
+ tipForkJoinStates,
112
+ flagParallelChildren,
113
+ };