@life-exe/wiki-engine 0.1.0

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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +180 -0
  3. package/dist/analytics/index.d.ts +10 -0
  4. package/dist/chunks/abnfDiagram-VCTEODGH-DyAP6Aua.js +87 -0
  5. package/dist/chunks/arc-OroUeRL_.js +83 -0
  6. package/dist/chunks/architectureDiagram-5GKGNRK7-FjmrDCl4.js +4784 -0
  7. package/dist/chunks/blockDiagram-I7D4REHJ-BF3oIDlI.js +1416 -0
  8. package/dist/chunks/c4Diagram-7LVT6UL2-Cmdq0LZr.js +1511 -0
  9. package/dist/chunks/channel-Bdy1QZHo.js +5 -0
  10. package/dist/chunks/chunk-2Q5K7J3B-BwxRSEKd.js +15 -0
  11. package/dist/chunks/chunk-5VM5RSS4-BtHwUU4T.js +19 -0
  12. package/dist/chunks/chunk-F27PBJKO-DF4TGftR.js +68 -0
  13. package/dist/chunks/chunk-IMKFNOWR-DkBQ-1aV.js +1421 -0
  14. package/dist/chunks/chunk-JWPE2WC7-BIokdAUW.js +9 -0
  15. package/dist/chunks/chunk-POPQ4Y6H-CcjOsf9X.js +20 -0
  16. package/dist/chunks/chunk-SHT3W25Y-lYp5BdEg.js +1695 -0
  17. package/dist/chunks/chunk-SVP7TREG-DN-ravNt.js +664 -0
  18. package/dist/chunks/chunk-TICWLB2K-CtTJ0xaY.js +1534 -0
  19. package/dist/chunks/chunk-XXDRQBXY-BovkWFC0.js +8 -0
  20. package/dist/chunks/classDiagram-ZZMXUADV-CMYS0pHw.js +16 -0
  21. package/dist/chunks/classDiagram-v2-VYDZK3BY-CMYS0pHw.js +16 -0
  22. package/dist/chunks/common-BJ4q25wy.js +12633 -0
  23. package/dist/chunks/cose-bilkent-JH36ORCC-CaMqpJY7.js +2608 -0
  24. package/dist/chunks/cynefin-OW5HDTMX-Bzjecpt-.js +23853 -0
  25. package/dist/chunks/cynefinDiagram-5FMLGOSQ-C0NuKLt0.js +299 -0
  26. package/dist/chunks/cytoscape.esm-DmPrb1GM.js +18787 -0
  27. package/dist/chunks/dagre-GXQ25YYZ-Ds09_NdN.js +461 -0
  28. package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
  29. package/dist/chunks/diagram-S7CK7UJ4-IvSazk1O.js +349 -0
  30. package/dist/chunks/diagram-UQ7AKVKN-58epdx5V.js +223 -0
  31. package/dist/chunks/diagram-VSXAHHWV-BrzRGMeV.js +466 -0
  32. package/dist/chunks/diagram-VX7I27RA-DPL0Nw6d.js +530 -0
  33. package/dist/chunks/diagram-Z3DM3KII-8VWVu0I5.js +143 -0
  34. package/dist/chunks/ebnfDiagram-PWID7BFC-DeByR_ze.js +109 -0
  35. package/dist/chunks/erDiagram-RLTQ6QDP-C9uo9iE1.js +1060 -0
  36. package/dist/chunks/flowDiagram-HODETNUW-BpoY3OMp.js +7 -0
  37. package/dist/chunks/ganttDiagram-EL5Y4UJY-psdwnC-T.js +2711 -0
  38. package/dist/chunks/gitGraphDiagram-WWUBYQGX-vsDfkn_Q.js +828 -0
  39. package/dist/chunks/index-f7Uzykhj.js +38262 -0
  40. package/dist/chunks/infoDiagram-27XIBGKW-8K-eQZiU.js +24 -0
  41. package/dist/chunks/init-DjUOC4st.js +16 -0
  42. package/dist/chunks/ishikawaDiagram-5VMMS53U-CuqR1k5i.js +622 -0
  43. package/dist/chunks/journeyDiagram-3NMN7TZE-BPW1nmwZ.js +834 -0
  44. package/dist/chunks/kanban-definition-UXKFOSKX-iY6-d6jO.js +726 -0
  45. package/dist/chunks/katex-jHfnQmlp.js +11682 -0
  46. package/dist/chunks/layout-CgV9vOdp.js +1704 -0
  47. package/dist/chunks/linear-BzcaSMTS.js +259 -0
  48. package/dist/chunks/mindmap-definition-YA3MSWOX-CaLfHyv0.js +831 -0
  49. package/dist/chunks/ordinal-DfAQgscy.js +61 -0
  50. package/dist/chunks/pegDiagram-XKGWAZYB-6Y28VvVh.js +95 -0
  51. package/dist/chunks/pieDiagram-E7YTZNPT-OrjeRxhs.js +209 -0
  52. package/dist/chunks/quadrantDiagram-AXDQQJYC-rgw2lV2J.js +1025 -0
  53. package/dist/chunks/railroadDiagram-O6MQD6OU-D6QNO5r1.js +77 -0
  54. package/dist/chunks/requirementDiagram-BXWQKSXE-a8tNRSuE.js +884 -0
  55. package/dist/chunks/sankeyDiagram-P5KCCOFB-CdaC8rLw.js +847 -0
  56. package/dist/chunks/sequenceDiagram-WJ2MYXX4-CGLi38Hj.js +2898 -0
  57. package/dist/chunks/sizeCapture-INFHLROL-g5RJXnik.js +47 -0
  58. package/dist/chunks/stateDiagram-D77RDMKH-Cou0eVl1.js +262 -0
  59. package/dist/chunks/stateDiagram-v2-MP3YSRHH-BHQspnUg.js +16 -0
  60. package/dist/chunks/swimlanes-42K2YHIH-BU7S1WgJ.js +5239 -0
  61. package/dist/chunks/swimlanesDiagram-VR7AAH4N-BsEplbno.js +13 -0
  62. package/dist/chunks/timeline-definition-24CTP7MA-BB-IyxWL.js +1066 -0
  63. package/dist/chunks/vennDiagram-4TSXK5OY-BToYolPI.js +1585 -0
  64. package/dist/chunks/wardleyDiagram-VM6X3IG4-BgoueOw_.js +684 -0
  65. package/dist/chunks/xychartDiagram-S5SC5T6Z-CF0fWv-W.js +1492 -0
  66. package/dist/components/CodeBlock.d.ts +5 -0
  67. package/dist/components/CommunityLinks.d.ts +21 -0
  68. package/dist/components/CookieConsent.d.ts +2 -0
  69. package/dist/components/DocLinkCard.d.ts +6 -0
  70. package/dist/components/LecturePageView.d.ts +3 -0
  71. package/dist/components/MermaidDiagram.d.ts +3 -0
  72. package/dist/components/SearchPopup.d.ts +6 -0
  73. package/dist/components/WikiApp.d.ts +9 -0
  74. package/dist/components/WikiLayout.d.ts +2 -0
  75. package/dist/components/WikiPageView.d.ts +6 -0
  76. package/dist/components/ZoomableImage.d.ts +2 -0
  77. package/dist/context/LangContext.d.ts +2 -0
  78. package/dist/context/WikiContext.d.ts +18 -0
  79. package/dist/data.d.ts +8 -0
  80. package/dist/hooks/useLanguage.d.ts +4 -0
  81. package/dist/hooks/useTheme.d.ts +5 -0
  82. package/dist/hooks/useWiki.d.ts +2 -0
  83. package/dist/index.d.ts +24 -0
  84. package/dist/index.js +45 -0
  85. package/dist/languages/ue-cpp.d.ts +7 -0
  86. package/dist/languages/ue-cpp.js +21 -0
  87. package/dist/types.d.ts +119 -0
  88. package/dist/wiki-engine.css +1 -0
  89. package/package.json +76 -0
@@ -0,0 +1,1421 @@
1
+ import { g as ee } from "./chunk-XXDRQBXY-BovkWFC0.js";
2
+ import { s as se } from "./chunk-POPQ4Y6H-CcjOsf9X.js";
3
+ import { _ as S, l as b, c as F, r as ie, u as re, a as ae, b as ne, g as oe, s as le, q as ce, t as he, W as ue, k as K, A as de, j as Dt, z as fe } from "./index-f7Uzykhj.js";
4
+ import { c as pe } from "./chunk-F27PBJKO-DF4TGftR.js";
5
+ var Ct = (function() {
6
+ var t = /* @__PURE__ */ S(function(W, l, u, n) {
7
+ for (u = u || {}, n = W.length; n--; u[W[n]] = l) ;
8
+ return u;
9
+ }, "o"), e = [1, 2], s = [1, 3], a = [1, 4], i = [2, 4], o = [1, 9], h = [1, 11], p = [1, 16], d = [1, 17], T = [1, 18], E = [1, 19], m = [1, 33], I = [1, 20], v = [1, 21], x = [1, 22], $ = [1, 23], O = [1, 24], f = [1, 26], L = [1, 27], C = [1, 28], V = [1, 29], P = [1, 30], k = [1, 31], B = [1, 32], j = [1, 35], nt = [1, 36], ot = [1, 37], lt = [1, 38], J = [1, 34], y = [1, 4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], ct = [1, 4, 5, 14, 15, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 39, 40, 41, 45, 48, 51, 52, 53, 54, 57], Lt = [4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], gt = {
10
+ trace: /* @__PURE__ */ S(function() {
11
+ }, "trace"),
12
+ yy: {},
13
+ symbols_: { error: 2, start: 3, SPACE: 4, NL: 5, SD: 6, document: 7, line: 8, statement: 9, classDefStatement: 10, styleStatement: 11, cssClassStatement: 12, idStatement: 13, DESCR: 14, "-->": 15, HIDE_EMPTY: 16, scale: 17, WIDTH: 18, COMPOSIT_STATE: 19, STRUCT_START: 20, STRUCT_STOP: 21, STATE_DESCR: 22, AS: 23, ID: 24, FORK: 25, JOIN: 26, CHOICE: 27, CONCURRENT: 28, note: 29, notePosition: 30, NOTE_TEXT: 31, direction: 32, acc_title: 33, acc_title_value: 34, acc_descr: 35, acc_descr_value: 36, acc_descr_multiline_value: 37, CLICK: 38, STRING: 39, HREF: 40, classDef: 41, CLASSDEF_ID: 42, CLASSDEF_STYLEOPTS: 43, DEFAULT: 44, style: 45, STYLE_IDS: 46, STYLEDEF_STYLEOPTS: 47, class: 48, CLASSENTITY_IDS: 49, STYLECLASS: 50, direction_tb: 51, direction_bt: 52, direction_rl: 53, direction_lr: 54, eol: 55, ";": 56, EDGE_STATE: 57, STYLE_SEPARATOR: 58, left_of: 59, right_of: 60, $accept: 0, $end: 1 },
14
+ terminals_: { 2: "error", 4: "SPACE", 5: "NL", 6: "SD", 14: "DESCR", 15: "-->", 16: "HIDE_EMPTY", 17: "scale", 18: "WIDTH", 19: "COMPOSIT_STATE", 20: "STRUCT_START", 21: "STRUCT_STOP", 22: "STATE_DESCR", 23: "AS", 24: "ID", 25: "FORK", 26: "JOIN", 27: "CHOICE", 28: "CONCURRENT", 29: "note", 31: "NOTE_TEXT", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 38: "CLICK", 39: "STRING", 40: "HREF", 41: "classDef", 42: "CLASSDEF_ID", 43: "CLASSDEF_STYLEOPTS", 44: "DEFAULT", 45: "style", 46: "STYLE_IDS", 47: "STYLEDEF_STYLEOPTS", 48: "class", 49: "CLASSENTITY_IDS", 50: "STYLECLASS", 51: "direction_tb", 52: "direction_bt", 53: "direction_rl", 54: "direction_lr", 56: ";", 57: "EDGE_STATE", 58: "STYLE_SEPARATOR", 59: "left_of", 60: "right_of" },
15
+ productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 3], [9, 4], [9, 1], [9, 2], [9, 1], [9, 4], [9, 3], [9, 6], [9, 1], [9, 1], [9, 1], [9, 1], [9, 4], [9, 4], [9, 1], [9, 2], [9, 2], [9, 1], [9, 5], [9, 5], [10, 3], [10, 3], [11, 3], [12, 3], [32, 1], [32, 1], [32, 1], [32, 1], [55, 1], [55, 1], [13, 1], [13, 1], [13, 3], [13, 3], [30, 1], [30, 1]],
16
+ performAction: /* @__PURE__ */ S(function(l, u, n, g, _, r, Y) {
17
+ var c = r.length - 1;
18
+ switch (_) {
19
+ case 3:
20
+ return g.setRootDoc(r[c]), r[c];
21
+ case 4:
22
+ this.$ = [];
23
+ break;
24
+ case 5:
25
+ r[c] != "nl" && (r[c - 1].push(r[c]), this.$ = r[c - 1]);
26
+ break;
27
+ case 6:
28
+ case 7:
29
+ this.$ = r[c];
30
+ break;
31
+ case 8:
32
+ this.$ = "nl";
33
+ break;
34
+ case 12:
35
+ this.$ = r[c];
36
+ break;
37
+ case 13:
38
+ const et = r[c - 1];
39
+ et.description = g.trimColon(r[c]), this.$ = et;
40
+ break;
41
+ case 14:
42
+ this.$ = { stmt: "relation", state1: r[c - 2], state2: r[c] };
43
+ break;
44
+ case 15:
45
+ const Tt = g.trimColon(r[c]);
46
+ this.$ = { stmt: "relation", state1: r[c - 3], state2: r[c - 1], description: Tt };
47
+ break;
48
+ case 19:
49
+ this.$ = { stmt: "state", id: r[c - 3], type: "default", description: "", doc: r[c - 1] };
50
+ break;
51
+ case 20:
52
+ var G = r[c], q = r[c - 2].trim();
53
+ if (r[c].match(":")) {
54
+ var ut = r[c].split(":");
55
+ G = ut[0], q = [q, ut[1]];
56
+ }
57
+ this.$ = { stmt: "state", id: G, type: "default", description: q };
58
+ break;
59
+ case 21:
60
+ this.$ = { stmt: "state", id: r[c - 3], type: "default", description: r[c - 5], doc: r[c - 1] };
61
+ break;
62
+ case 22:
63
+ this.$ = { stmt: "state", id: r[c], type: "fork" };
64
+ break;
65
+ case 23:
66
+ this.$ = { stmt: "state", id: r[c], type: "join" };
67
+ break;
68
+ case 24:
69
+ this.$ = { stmt: "state", id: r[c], type: "choice" };
70
+ break;
71
+ case 25:
72
+ this.$ = { stmt: "state", id: g.getDividerId(), type: "divider" };
73
+ break;
74
+ case 26:
75
+ this.$ = { stmt: "state", id: r[c - 1].trim(), note: { position: r[c - 2].trim(), text: r[c].trim() } };
76
+ break;
77
+ case 29:
78
+ this.$ = r[c].trim(), g.setAccTitle(this.$);
79
+ break;
80
+ case 30:
81
+ case 31:
82
+ this.$ = r[c].trim(), g.setAccDescription(this.$);
83
+ break;
84
+ case 32:
85
+ this.$ = {
86
+ stmt: "click",
87
+ id: r[c - 3],
88
+ url: r[c - 2],
89
+ tooltip: r[c - 1]
90
+ };
91
+ break;
92
+ case 33:
93
+ this.$ = {
94
+ stmt: "click",
95
+ id: r[c - 3],
96
+ url: r[c - 1],
97
+ tooltip: ""
98
+ };
99
+ break;
100
+ case 34:
101
+ case 35:
102
+ this.$ = { stmt: "classDef", id: r[c - 1].trim(), classes: r[c].trim() };
103
+ break;
104
+ case 36:
105
+ this.$ = { stmt: "style", id: r[c - 1].trim(), styleClass: r[c].trim() };
106
+ break;
107
+ case 37:
108
+ this.$ = { stmt: "applyClass", id: r[c - 1].trim(), styleClass: r[c].trim() };
109
+ break;
110
+ case 38:
111
+ g.setDirection("TB"), this.$ = { stmt: "dir", value: "TB" };
112
+ break;
113
+ case 39:
114
+ g.setDirection("BT"), this.$ = { stmt: "dir", value: "BT" };
115
+ break;
116
+ case 40:
117
+ g.setDirection("RL"), this.$ = { stmt: "dir", value: "RL" };
118
+ break;
119
+ case 41:
120
+ g.setDirection("LR"), this.$ = { stmt: "dir", value: "LR" };
121
+ break;
122
+ case 44:
123
+ case 45:
124
+ this.$ = { stmt: "state", id: r[c].trim(), type: "default", description: "" };
125
+ break;
126
+ case 46:
127
+ this.$ = { stmt: "state", id: r[c - 2].trim(), classes: [r[c].trim()], type: "default", description: "" };
128
+ break;
129
+ case 47:
130
+ this.$ = { stmt: "state", id: r[c - 2].trim(), classes: [r[c].trim()], type: "default", description: "" };
131
+ break;
132
+ }
133
+ }, "anonymous"),
134
+ table: [{ 3: 1, 4: e, 5: s, 6: a }, { 1: [3] }, { 3: 5, 4: e, 5: s, 6: a }, { 3: 6, 4: e, 5: s, 6: a }, t([1, 4, 5, 16, 17, 19, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], i, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: o, 5: h, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: p, 17: d, 19: T, 22: E, 24: m, 25: I, 26: v, 27: x, 28: $, 29: O, 32: 25, 33: f, 35: L, 37: C, 38: V, 41: P, 45: k, 48: B, 51: j, 52: nt, 53: ot, 54: lt, 57: J }, t(y, [2, 5]), { 9: 39, 10: 12, 11: 13, 12: 14, 13: 15, 16: p, 17: d, 19: T, 22: E, 24: m, 25: I, 26: v, 27: x, 28: $, 29: O, 32: 25, 33: f, 35: L, 37: C, 38: V, 41: P, 45: k, 48: B, 51: j, 52: nt, 53: ot, 54: lt, 57: J }, t(y, [2, 7]), t(y, [2, 8]), t(y, [2, 9]), t(y, [2, 10]), t(y, [2, 11]), t(y, [2, 12], { 14: [1, 40], 15: [1, 41] }), t(y, [2, 16]), { 18: [1, 42] }, t(y, [2, 18], { 20: [1, 43] }), { 23: [1, 44] }, t(y, [2, 22]), t(y, [2, 23]), t(y, [2, 24]), t(y, [2, 25]), { 30: 45, 31: [1, 46], 59: [1, 47], 60: [1, 48] }, t(y, [2, 28]), { 34: [1, 49] }, { 36: [1, 50] }, t(y, [2, 31]), { 13: 51, 24: m, 57: J }, { 42: [1, 52], 44: [1, 53] }, { 46: [1, 54] }, { 49: [1, 55] }, t(ct, [2, 44], { 58: [1, 56] }), t(ct, [2, 45], { 58: [1, 57] }), t(y, [2, 38]), t(y, [2, 39]), t(y, [2, 40]), t(y, [2, 41]), t(y, [2, 6]), t(y, [2, 13]), { 13: 58, 24: m, 57: J }, t(y, [2, 17]), t(Lt, i, { 7: 59 }), { 24: [1, 60] }, { 24: [1, 61] }, { 23: [1, 62] }, { 24: [2, 48] }, { 24: [2, 49] }, t(y, [2, 29]), t(y, [2, 30]), { 39: [1, 63], 40: [1, 64] }, { 43: [1, 65] }, { 43: [1, 66] }, { 47: [1, 67] }, { 50: [1, 68] }, { 24: [1, 69] }, { 24: [1, 70] }, t(y, [2, 14], { 14: [1, 71] }), { 4: o, 5: h, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: p, 17: d, 19: T, 21: [1, 72], 22: E, 24: m, 25: I, 26: v, 27: x, 28: $, 29: O, 32: 25, 33: f, 35: L, 37: C, 38: V, 41: P, 45: k, 48: B, 51: j, 52: nt, 53: ot, 54: lt, 57: J }, t(y, [2, 20], { 20: [1, 73] }), { 31: [1, 74] }, { 24: [1, 75] }, { 39: [1, 76] }, { 39: [1, 77] }, t(y, [2, 34]), t(y, [2, 35]), t(y, [2, 36]), t(y, [2, 37]), t(ct, [2, 46]), t(ct, [2, 47]), t(y, [2, 15]), t(y, [2, 19]), t(Lt, i, { 7: 78 }), t(y, [2, 26]), t(y, [2, 27]), { 5: [1, 79] }, { 5: [1, 80] }, { 4: o, 5: h, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: p, 17: d, 19: T, 21: [1, 81], 22: E, 24: m, 25: I, 26: v, 27: x, 28: $, 29: O, 32: 25, 33: f, 35: L, 37: C, 38: V, 41: P, 45: k, 48: B, 51: j, 52: nt, 53: ot, 54: lt, 57: J }, t(y, [2, 32]), t(y, [2, 33]), t(y, [2, 21])],
135
+ defaultActions: { 5: [2, 1], 6: [2, 2], 47: [2, 48], 48: [2, 49] },
136
+ parseError: /* @__PURE__ */ S(function(l, u) {
137
+ if (u.recoverable)
138
+ this.trace(l);
139
+ else {
140
+ var n = new Error(l);
141
+ throw n.hash = u, n;
142
+ }
143
+ }, "parseError"),
144
+ parse: /* @__PURE__ */ S(function(l) {
145
+ var u = this, n = [0], g = [], _ = [null], r = [], Y = this.table, c = "", G = 0, q = 0, ut = 2, et = 1, Tt = r.slice.call(arguments, 1), D = Object.create(this.lexer), H = { yy: {} };
146
+ for (var Et in this.yy)
147
+ Object.prototype.hasOwnProperty.call(this.yy, Et) && (H.yy[Et] = this.yy[Et]);
148
+ D.setInput(l, H.yy), H.yy.lexer = D, H.yy.parser = this, typeof D.yylloc > "u" && (D.yylloc = {});
149
+ var _t = D.yylloc;
150
+ r.push(_t);
151
+ var Zt = D.options && D.options.ranges;
152
+ typeof H.yy.parseError == "function" ? this.parseError = H.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
153
+ function te(R) {
154
+ n.length = n.length - 2 * R, _.length = _.length - R, r.length = r.length - R;
155
+ }
156
+ S(te, "popStack");
157
+ function wt() {
158
+ var R;
159
+ return R = g.pop() || D.lex() || et, typeof R != "number" && (R instanceof Array && (g = R, R = g.pop()), R = u.symbols_[R] || R), R;
160
+ }
161
+ S(wt, "lex");
162
+ for (var w, z, N, mt, Q = {}, dt, M, It, ft; ; ) {
163
+ if (z = n[n.length - 1], this.defaultActions[z] ? N = this.defaultActions[z] : ((w === null || typeof w > "u") && (w = wt()), N = Y[z] && Y[z][w]), typeof N > "u" || !N.length || !N[0]) {
164
+ var bt = "";
165
+ ft = [];
166
+ for (dt in Y[z])
167
+ this.terminals_[dt] && dt > ut && ft.push("'" + this.terminals_[dt] + "'");
168
+ D.showPosition ? bt = "Parse error on line " + (G + 1) + `:
169
+ ` + D.showPosition() + `
170
+ Expecting ` + ft.join(", ") + ", got '" + (this.terminals_[w] || w) + "'" : bt = "Parse error on line " + (G + 1) + ": Unexpected " + (w == et ? "end of input" : "'" + (this.terminals_[w] || w) + "'"), this.parseError(bt, {
171
+ text: D.match,
172
+ token: this.terminals_[w] || w,
173
+ line: D.yylineno,
174
+ loc: _t,
175
+ expected: ft
176
+ });
177
+ }
178
+ if (N[0] instanceof Array && N.length > 1)
179
+ throw new Error("Parse Error: multiple actions possible at state: " + z + ", token: " + w);
180
+ switch (N[0]) {
181
+ case 1:
182
+ n.push(w), _.push(D.yytext), r.push(D.yylloc), n.push(N[1]), w = null, q = D.yyleng, c = D.yytext, G = D.yylineno, _t = D.yylloc;
183
+ break;
184
+ case 2:
185
+ if (M = this.productions_[N[1]][1], Q.$ = _[_.length - M], Q._$ = {
186
+ first_line: r[r.length - (M || 1)].first_line,
187
+ last_line: r[r.length - 1].last_line,
188
+ first_column: r[r.length - (M || 1)].first_column,
189
+ last_column: r[r.length - 1].last_column
190
+ }, Zt && (Q._$.range = [
191
+ r[r.length - (M || 1)].range[0],
192
+ r[r.length - 1].range[1]
193
+ ]), mt = this.performAction.apply(Q, [
194
+ c,
195
+ q,
196
+ G,
197
+ H.yy,
198
+ N[1],
199
+ _,
200
+ r
201
+ ].concat(Tt)), typeof mt < "u")
202
+ return mt;
203
+ M && (n = n.slice(0, -1 * M * 2), _ = _.slice(0, -1 * M), r = r.slice(0, -1 * M)), n.push(this.productions_[N[1]][0]), _.push(Q.$), r.push(Q._$), It = Y[n[n.length - 2]][n[n.length - 1]], n.push(It);
204
+ break;
205
+ case 3:
206
+ return !0;
207
+ }
208
+ }
209
+ return !0;
210
+ }, "parse")
211
+ }, Qt = /* @__PURE__ */ (function() {
212
+ var W = {
213
+ EOF: 1,
214
+ parseError: /* @__PURE__ */ S(function(u, n) {
215
+ if (this.yy.parser)
216
+ this.yy.parser.parseError(u, n);
217
+ else
218
+ throw new Error(u);
219
+ }, "parseError"),
220
+ // resets the lexer, sets new input
221
+ setInput: /* @__PURE__ */ S(function(l, u) {
222
+ return this.yy = u || this.yy || {}, this._input = l, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
223
+ first_line: 1,
224
+ first_column: 0,
225
+ last_line: 1,
226
+ last_column: 0
227
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
228
+ }, "setInput"),
229
+ // consumes and returns one char from the input
230
+ input: /* @__PURE__ */ S(function() {
231
+ var l = this._input[0];
232
+ this.yytext += l, this.yyleng++, this.offset++, this.match += l, this.matched += l;
233
+ var u = l.match(/(?:\r\n?|\n).*/g);
234
+ return u ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), l;
235
+ }, "input"),
236
+ // unshifts one char (or a string) into the input
237
+ unput: /* @__PURE__ */ S(function(l) {
238
+ var u = l.length, n = l.split(/(?:\r\n?|\n)/g);
239
+ this._input = l + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - u), this.offset -= u;
240
+ var g = this.match.split(/(?:\r\n?|\n)/g);
241
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), n.length - 1 && (this.yylineno -= n.length - 1);
242
+ var _ = this.yylloc.range;
243
+ return this.yylloc = {
244
+ first_line: this.yylloc.first_line,
245
+ last_line: this.yylineno + 1,
246
+ first_column: this.yylloc.first_column,
247
+ last_column: n ? (n.length === g.length ? this.yylloc.first_column : 0) + g[g.length - n.length].length - n[0].length : this.yylloc.first_column - u
248
+ }, this.options.ranges && (this.yylloc.range = [_[0], _[0] + this.yyleng - u]), this.yyleng = this.yytext.length, this;
249
+ }, "unput"),
250
+ // When called from action, caches matched text and appends it on next action
251
+ more: /* @__PURE__ */ S(function() {
252
+ return this._more = !0, this;
253
+ }, "more"),
254
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
255
+ reject: /* @__PURE__ */ S(function() {
256
+ if (this.options.backtrack_lexer)
257
+ this._backtrack = !0;
258
+ else
259
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
260
+ ` + this.showPosition(), {
261
+ text: "",
262
+ token: null,
263
+ line: this.yylineno
264
+ });
265
+ return this;
266
+ }, "reject"),
267
+ // retain first n characters of the match
268
+ less: /* @__PURE__ */ S(function(l) {
269
+ this.unput(this.match.slice(l));
270
+ }, "less"),
271
+ // displays already matched input, i.e. for error messages
272
+ pastInput: /* @__PURE__ */ S(function() {
273
+ var l = this.matched.substr(0, this.matched.length - this.match.length);
274
+ return (l.length > 20 ? "..." : "") + l.substr(-20).replace(/\n/g, "");
275
+ }, "pastInput"),
276
+ // displays upcoming input, i.e. for error messages
277
+ upcomingInput: /* @__PURE__ */ S(function() {
278
+ var l = this.match;
279
+ return l.length < 20 && (l += this._input.substr(0, 20 - l.length)), (l.substr(0, 20) + (l.length > 20 ? "..." : "")).replace(/\n/g, "");
280
+ }, "upcomingInput"),
281
+ // displays the character position where the lexing error occurred, i.e. for error messages
282
+ showPosition: /* @__PURE__ */ S(function() {
283
+ var l = this.pastInput(), u = new Array(l.length + 1).join("-");
284
+ return l + this.upcomingInput() + `
285
+ ` + u + "^";
286
+ }, "showPosition"),
287
+ // test the lexed token: return FALSE when not a match, otherwise return token
288
+ test_match: /* @__PURE__ */ S(function(l, u) {
289
+ var n, g, _;
290
+ if (this.options.backtrack_lexer && (_ = {
291
+ yylineno: this.yylineno,
292
+ yylloc: {
293
+ first_line: this.yylloc.first_line,
294
+ last_line: this.last_line,
295
+ first_column: this.yylloc.first_column,
296
+ last_column: this.yylloc.last_column
297
+ },
298
+ yytext: this.yytext,
299
+ match: this.match,
300
+ matches: this.matches,
301
+ matched: this.matched,
302
+ yyleng: this.yyleng,
303
+ offset: this.offset,
304
+ _more: this._more,
305
+ _input: this._input,
306
+ yy: this.yy,
307
+ conditionStack: this.conditionStack.slice(0),
308
+ done: this.done
309
+ }, this.options.ranges && (_.yylloc.range = this.yylloc.range.slice(0))), g = l[0].match(/(?:\r\n?|\n).*/g), g && (this.yylineno += g.length), this.yylloc = {
310
+ first_line: this.yylloc.last_line,
311
+ last_line: this.yylineno + 1,
312
+ first_column: this.yylloc.last_column,
313
+ last_column: g ? g[g.length - 1].length - g[g.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + l[0].length
314
+ }, this.yytext += l[0], this.match += l[0], this.matches = l, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(l[0].length), this.matched += l[0], n = this.performAction.call(this, this.yy, this, u, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), n)
315
+ return n;
316
+ if (this._backtrack) {
317
+ for (var r in _)
318
+ this[r] = _[r];
319
+ return !1;
320
+ }
321
+ return !1;
322
+ }, "test_match"),
323
+ // return next match in input
324
+ next: /* @__PURE__ */ S(function() {
325
+ if (this.done)
326
+ return this.EOF;
327
+ this._input || (this.done = !0);
328
+ var l, u, n, g;
329
+ this._more || (this.yytext = "", this.match = "");
330
+ for (var _ = this._currentRules(), r = 0; r < _.length; r++)
331
+ if (n = this._input.match(this.rules[_[r]]), n && (!u || n[0].length > u[0].length)) {
332
+ if (u = n, g = r, this.options.backtrack_lexer) {
333
+ if (l = this.test_match(n, _[r]), l !== !1)
334
+ return l;
335
+ if (this._backtrack) {
336
+ u = !1;
337
+ continue;
338
+ } else
339
+ return !1;
340
+ } else if (!this.options.flex)
341
+ break;
342
+ }
343
+ return u ? (l = this.test_match(u, _[g]), l !== !1 ? l : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
344
+ ` + this.showPosition(), {
345
+ text: "",
346
+ token: null,
347
+ line: this.yylineno
348
+ });
349
+ }, "next"),
350
+ // return next match that has a token
351
+ lex: /* @__PURE__ */ S(function() {
352
+ var u = this.next();
353
+ return u || this.lex();
354
+ }, "lex"),
355
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
356
+ begin: /* @__PURE__ */ S(function(u) {
357
+ this.conditionStack.push(u);
358
+ }, "begin"),
359
+ // pop the previously active lexer condition state off the condition stack
360
+ popState: /* @__PURE__ */ S(function() {
361
+ var u = this.conditionStack.length - 1;
362
+ return u > 0 ? this.conditionStack.pop() : this.conditionStack[0];
363
+ }, "popState"),
364
+ // produce the lexer rule set which is active for the currently active lexer condition state
365
+ _currentRules: /* @__PURE__ */ S(function() {
366
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
367
+ }, "_currentRules"),
368
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
369
+ topState: /* @__PURE__ */ S(function(u) {
370
+ return u = this.conditionStack.length - 1 - Math.abs(u || 0), u >= 0 ? this.conditionStack[u] : "INITIAL";
371
+ }, "topState"),
372
+ // alias for begin(condition)
373
+ pushState: /* @__PURE__ */ S(function(u) {
374
+ this.begin(u);
375
+ }, "pushState"),
376
+ // return the number of states currently on the stack
377
+ stateStackSize: /* @__PURE__ */ S(function() {
378
+ return this.conditionStack.length;
379
+ }, "stateStackSize"),
380
+ options: { "case-insensitive": !0 },
381
+ performAction: /* @__PURE__ */ S(function(u, n, g, _) {
382
+ function r() {
383
+ const Y = n.yytext.indexOf("%%");
384
+ if (Y === 0)
385
+ return !1;
386
+ if (Y > 0) {
387
+ const c = n.yytext.slice(0, Y), G = n.yytext.slice(Y);
388
+ G && u.lexer.unput(G), n.yytext = c;
389
+ }
390
+ return !0;
391
+ }
392
+ switch (S(r, "processId"), g) {
393
+ case 0:
394
+ return 38;
395
+ case 1:
396
+ return 40;
397
+ case 2:
398
+ return 39;
399
+ case 3:
400
+ return 44;
401
+ case 4:
402
+ return 51;
403
+ case 5:
404
+ return 52;
405
+ case 6:
406
+ return 53;
407
+ case 7:
408
+ return 54;
409
+ case 8:
410
+ return 5;
411
+ case 9:
412
+ break;
413
+ case 10:
414
+ break;
415
+ case 11:
416
+ break;
417
+ case 12:
418
+ break;
419
+ case 13:
420
+ return this.pushState("SCALE"), 17;
421
+ case 14:
422
+ return 18;
423
+ case 15:
424
+ this.popState();
425
+ break;
426
+ case 16:
427
+ return this.begin("acc_title"), 33;
428
+ case 17:
429
+ return this.popState(), "acc_title_value";
430
+ case 18:
431
+ return this.begin("acc_descr"), 35;
432
+ case 19:
433
+ return this.popState(), "acc_descr_value";
434
+ case 20:
435
+ this.begin("acc_descr_multiline");
436
+ break;
437
+ case 21:
438
+ this.popState();
439
+ break;
440
+ case 22:
441
+ return "acc_descr_multiline_value";
442
+ case 23:
443
+ return this.pushState("CLASSDEF"), 41;
444
+ case 24:
445
+ return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
446
+ case 25:
447
+ return this.popState(), this.pushState("CLASSDEFID"), 42;
448
+ case 26:
449
+ return this.popState(), 43;
450
+ case 27:
451
+ return this.pushState("CLASS"), 48;
452
+ case 28:
453
+ return this.popState(), this.pushState("CLASS_STYLE"), 49;
454
+ case 29:
455
+ return this.popState(), 50;
456
+ case 30:
457
+ return this.pushState("STYLE"), 45;
458
+ case 31:
459
+ return this.popState(), this.pushState("STYLEDEF_STYLES"), 46;
460
+ case 32:
461
+ return this.popState(), 47;
462
+ case 33:
463
+ return this.pushState("SCALE"), 17;
464
+ case 34:
465
+ return 18;
466
+ case 35:
467
+ this.popState();
468
+ break;
469
+ case 36:
470
+ this.pushState("STATE");
471
+ break;
472
+ case 37:
473
+ return this.popState(), n.yytext = n.yytext.slice(0, -8).trim(), 25;
474
+ case 38:
475
+ return this.popState(), n.yytext = n.yytext.slice(0, -8).trim(), 26;
476
+ case 39:
477
+ return this.popState(), n.yytext = n.yytext.slice(0, -10).trim(), 27;
478
+ case 40:
479
+ return this.popState(), n.yytext = n.yytext.slice(0, -8).trim(), 25;
480
+ case 41:
481
+ return this.popState(), n.yytext = n.yytext.slice(0, -8).trim(), 26;
482
+ case 42:
483
+ return this.popState(), n.yytext = n.yytext.slice(0, -10).trim(), 27;
484
+ case 43:
485
+ return 51;
486
+ case 44:
487
+ return 52;
488
+ case 45:
489
+ return 53;
490
+ case 46:
491
+ return 54;
492
+ case 47:
493
+ this.pushState("STATE_STRING");
494
+ break;
495
+ case 48:
496
+ return this.pushState("STATE_ID"), "AS";
497
+ case 49:
498
+ return r() ? (this.popState(), "ID") : void 0;
499
+ case 50:
500
+ this.popState();
501
+ break;
502
+ case 51:
503
+ return "STATE_DESCR";
504
+ case 52:
505
+ throw new Error('Error: State name must be a single word. Found: "' + n.yytext.trim() + '"');
506
+ case 53:
507
+ return 19;
508
+ case 54:
509
+ this.popState();
510
+ break;
511
+ case 55:
512
+ return this.popState(), this.pushState("struct"), 20;
513
+ case 56:
514
+ return this.popState(), 21;
515
+ case 57:
516
+ break;
517
+ case 58:
518
+ return this.begin("NOTE"), 29;
519
+ case 59:
520
+ return this.popState(), this.pushState("NOTE_ID"), 59;
521
+ case 60:
522
+ return this.popState(), this.pushState("NOTE_ID"), 60;
523
+ case 61:
524
+ this.popState(), this.pushState("FLOATING_NOTE");
525
+ break;
526
+ case 62:
527
+ return this.popState(), this.pushState("FLOATING_NOTE_ID"), "AS";
528
+ case 63:
529
+ break;
530
+ case 64:
531
+ return "NOTE_TEXT";
532
+ case 65:
533
+ return r() ? (this.popState(), "ID") : void 0;
534
+ case 66:
535
+ return r() ? (this.popState(), this.pushState("NOTE_TEXT"), 24) : void 0;
536
+ case 67:
537
+ return this.popState(), n.yytext = n.yytext.substr(2).trim(), 31;
538
+ case 68:
539
+ return this.popState(), n.yytext = n.yytext.slice(0, -8).trim(), 31;
540
+ case 69:
541
+ return 6;
542
+ case 70:
543
+ return 6;
544
+ case 71:
545
+ return 16;
546
+ case 72:
547
+ return 57;
548
+ case 73:
549
+ return r() ? 24 : void 0;
550
+ case 74:
551
+ return n.yytext = n.yytext.trim(), 14;
552
+ case 75:
553
+ return 15;
554
+ case 76:
555
+ return 28;
556
+ case 77:
557
+ return 58;
558
+ case 78:
559
+ return 5;
560
+ case 79:
561
+ return "INVALID";
562
+ }
563
+ }, "anonymous"),
564
+ rules: [/^(?:click\b)/i, /^(?:href\b)/i, /^(?:"[^"]*")/i, /^(?:default\b)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:[\n]+)/i, /^(?:[\s]+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:classDef\s+)/i, /^(?:DEFAULT\s+)/i, /^(?:\w+\s+)/i, /^(?:[^\n]*)/i, /^(?:class\s+)/i, /^(?:(\w+)+((,\s*\w+)*))/i, /^(?:[^\n]*)/i, /^(?:style\s+)/i, /^(?:[\w,]+\s+)/i, /^(?:[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:state\s+)/i, /^(?:.*<<fork>>)/i, /^(?:.*<<join>>)/i, /^(?:.*<<choice>>)/i, /^(?:.*\[\[fork\]\])/i, /^(?:.*\[\[join\]\])/i, /^(?:.*\[\[choice\]\])/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:["])/i, /^(?:\s*as\s+)/i, /^(?:[^\n\{]*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\w+\s+\w+.*?\{)/i, /^(?:[^\n\s\{]+)/i, /^(?:\n)/i, /^(?:\{)/i, /^(?:\})/i, /^(?:[\n])/i, /^(?:note\s+)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:")/i, /^(?:\s*as\s*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n]*)/i, /^(?:\s*[^:\n\s\-]+)/i, /^(?:\s*:[^:\n;]+)/i, /^(?:[\s\S]*?\n\s*end note\b)/i, /^(?:stateDiagram\s+)/i, /^(?:stateDiagram-v2\s+)/i, /^(?:hide empty description\b)/i, /^(?:\[\*\])/i, /^(?:[^:\n\s\-\{]+)/i, /^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i, /^(?:-->)/i, /^(?:--)/i, /^(?::::)/i, /^(?:$)/i, /^(?:.)/i],
565
+ conditions: { LINE: { rules: [10, 11, 12], inclusive: !1 }, struct: { rules: [10, 11, 12, 23, 27, 30, 36, 43, 44, 45, 46, 56, 57, 58, 72, 73, 74, 75, 76, 77], inclusive: !1 }, FLOATING_NOTE_ID: { rules: [65], inclusive: !1 }, FLOATING_NOTE: { rules: [62, 63, 64], inclusive: !1 }, NOTE_TEXT: { rules: [67, 68], inclusive: !1 }, NOTE_ID: { rules: [66], inclusive: !1 }, NOTE: { rules: [59, 60, 61], inclusive: !1 }, STYLEDEF_STYLEOPTS: { rules: [], inclusive: !1 }, STYLEDEF_STYLES: { rules: [32], inclusive: !1 }, STYLE_IDS: { rules: [], inclusive: !1 }, STYLE: { rules: [31], inclusive: !1 }, CLASS_STYLE: { rules: [29], inclusive: !1 }, CLASS: { rules: [28], inclusive: !1 }, CLASSDEFID: { rules: [26], inclusive: !1 }, CLASSDEF: { rules: [24, 25], inclusive: !1 }, acc_descr_multiline: { rules: [21, 22], inclusive: !1 }, acc_descr: { rules: [19], inclusive: !1 }, acc_title: { rules: [17], inclusive: !1 }, SCALE: { rules: [14, 15, 34, 35], inclusive: !1 }, ALIAS: { rules: [], inclusive: !1 }, STATE_ID: { rules: [49], inclusive: !1 }, STATE_STRING: { rules: [50, 51], inclusive: !1 }, FORK_STATE: { rules: [], inclusive: !1 }, STATE: { rules: [10, 11, 12, 37, 38, 39, 40, 41, 42, 47, 48, 52, 53, 54, 55], inclusive: !1 }, ID: { rules: [10, 11, 12], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 16, 18, 20, 23, 27, 30, 33, 36, 55, 58, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79], inclusive: !0 } }
566
+ };
567
+ return W;
568
+ })();
569
+ gt.lexer = Qt;
570
+ function ht() {
571
+ this.yy = {};
572
+ }
573
+ return S(ht, "Parser"), ht.prototype = gt, gt.Parser = ht, new ht();
574
+ })();
575
+ Ct.parser = Ct;
576
+ var Ue = Ct, Se = "TB", Yt = "TB", Ot = "dir", tt = "state", Z = "root", At = "relation", ye = "classDef", ge = "style", Te = "applyClass", rt = "default", Gt = "divider", Vt = "fill:none", Mt = "fill: #333", Wt = "c", Ut = "markdown", jt = "normal", kt = "rect", vt = "rectWithTitle", Ee = "stateStart", _e = "stateEnd", Rt = "divider", Nt = "roundedWithTitle", me = "note", be = "noteGroup", at = "statediagram", De = "state", ke = `${at}-${De}`, Ht = "transition", ve = "note", Ce = "note-edge", Ae = `${Ht} ${Ce}`, xe = `${at}-${ve}`, Le = "cluster", we = `${at}-${Le}`, Ie = "cluster-alt", Oe = `${at}-${Ie}`, zt = "parent", Kt = "note", Re = "state", xt = "----", Ne = `${xt}${Kt}`, $t = `${xt}${zt}`, Xt = /* @__PURE__ */ S((t, e = Yt) => {
577
+ if (!t.doc)
578
+ return e;
579
+ let s = e;
580
+ for (const a of t.doc)
581
+ a.stmt === "dir" && (s = a.value);
582
+ return s;
583
+ }, "getDir"), $e = /* @__PURE__ */ S(function(t, e) {
584
+ return e.db.getClasses();
585
+ }, "getClasses"), Fe = /* @__PURE__ */ S(async function(t, e, s, a) {
586
+ b.info("REF0:"), b.info("Drawing state diagram (v2)", e);
587
+ const { securityLevel: i, state: o, layout: h } = F();
588
+ a.db.extract(a.db.getRootDocV2());
589
+ const p = a.db.getData(), d = ee(e, i);
590
+ p.type = a.type, p.layoutAlgorithm = h, p.nodeSpacing = (o == null ? void 0 : o.nodeSpacing) || 50, p.rankSpacing = (o == null ? void 0 : o.rankSpacing) || 50, F().look === "neo" ? p.markers = ["barbNeo"] : p.markers = ["barb"], p.diagramId = e, await ie(p, d);
591
+ const E = 8;
592
+ try {
593
+ (typeof a.db.getLinks == "function" ? a.db.getLinks() : /* @__PURE__ */ new Map()).forEach((I, v) => {
594
+ var P;
595
+ const x = typeof v == "string" ? v : typeof (v == null ? void 0 : v.id) == "string" ? v.id : "", $ = p.nodes.find((k) => k.id === x);
596
+ if (!x) {
597
+ b.warn("⚠️ Invalid or missing stateId from key:", JSON.stringify(v));
598
+ return;
599
+ }
600
+ const O = (P = d.node()) == null ? void 0 : P.querySelectorAll("g.node, g.rough-node");
601
+ let f;
602
+ if (O == null || O.forEach((k) => {
603
+ var j;
604
+ const B = (j = k.textContent) == null ? void 0 : j.trim();
605
+ (k.id === ($ == null ? void 0 : $.domId) || B === x) && (f = k);
606
+ }), !f) {
607
+ b.warn("⚠️ Could not find node matching text:", x);
608
+ return;
609
+ }
610
+ const L = f.parentNode;
611
+ if (!L) {
612
+ b.warn("⚠️ Node has no parent, cannot wrap:", x);
613
+ return;
614
+ }
615
+ const C = document.createElementNS("http://www.w3.org/2000/svg", "a"), V = I.url.replace(/^"+|"+$/g, "");
616
+ if (C.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", V), C.setAttribute("target", "_blank"), I.tooltip) {
617
+ const k = I.tooltip.replace(/^"+|"+$/g, "");
618
+ C.setAttribute("title", k), f.setAttribute("title", k);
619
+ }
620
+ L.replaceChild(C, f), C.appendChild(f), b.info("🔗 Wrapped node in <a> tag for:", x, I.url);
621
+ });
622
+ } catch (m) {
623
+ b.error("❌ Error injecting clickable links:", m);
624
+ }
625
+ re.insertTitle(
626
+ d,
627
+ "statediagramTitleText",
628
+ (o == null ? void 0 : o.titleTopMargin) ?? 25,
629
+ a.db.getDiagramTitle()
630
+ ), se(d, E, at, (o == null ? void 0 : o.useMaxWidth) ?? !0);
631
+ }, "draw"), je = {
632
+ getClasses: $e,
633
+ draw: Fe,
634
+ getDir: Xt
635
+ }, St = /* @__PURE__ */ new Map(), U = 0;
636
+ function yt(t = "", e = 0, s = "", a = xt) {
637
+ const i = s !== null && s.length > 0 ? `${a}${s}` : "";
638
+ return `${Re}-${t}${i}-${e}`;
639
+ }
640
+ S(yt, "stateDomId");
641
+ var Pe = /* @__PURE__ */ S((t, e, s, a, i, o, h, p) => {
642
+ b.trace("items", e), e.forEach((d) => {
643
+ switch (d.stmt) {
644
+ case tt:
645
+ it(t, d, s, a, i, o, h, p);
646
+ break;
647
+ case rt:
648
+ it(t, d, s, a, i, o, h, p);
649
+ break;
650
+ case At:
651
+ {
652
+ it(
653
+ t,
654
+ d.state1,
655
+ s,
656
+ a,
657
+ i,
658
+ o,
659
+ h,
660
+ p
661
+ ), it(
662
+ t,
663
+ d.state2,
664
+ s,
665
+ a,
666
+ i,
667
+ o,
668
+ h,
669
+ p
670
+ );
671
+ const T = h === "neo", E = {
672
+ id: "edge" + U,
673
+ start: d.state1.id,
674
+ end: d.state2.id,
675
+ arrowhead: "normal",
676
+ arrowTypeEnd: T ? "arrow_barb_neo" : "arrow_barb",
677
+ style: Vt,
678
+ labelStyle: "",
679
+ label: K.sanitizeText(d.description ?? "", F()),
680
+ arrowheadStyle: Mt,
681
+ labelpos: Wt,
682
+ labelType: Ut,
683
+ thickness: jt,
684
+ classes: Ht,
685
+ look: h
686
+ };
687
+ i.push(E), U++;
688
+ }
689
+ break;
690
+ }
691
+ });
692
+ }, "setupDoc"), Ft = /* @__PURE__ */ S((t, e = Yt) => {
693
+ let s = e;
694
+ if (t.doc)
695
+ for (const a of t.doc)
696
+ a.stmt === "dir" && (s = a.value);
697
+ return s;
698
+ }, "getDir");
699
+ function st(t, e, s) {
700
+ if (!e.id || e.id === "</join></fork>" || e.id === "</choice>")
701
+ return;
702
+ e.cssClasses && (Array.isArray(e.cssCompiledStyles) || (e.cssCompiledStyles = []), e.cssClasses.split(" ").forEach((i) => {
703
+ const o = s.get(i);
704
+ o && (e.cssCompiledStyles = [...e.cssCompiledStyles ?? [], ...o.styles]);
705
+ }));
706
+ const a = t.find((i) => i.id === e.id);
707
+ a ? Object.assign(a, e) : t.push(e);
708
+ }
709
+ S(st, "insertOrUpdateNode");
710
+ function Jt(t) {
711
+ var e;
712
+ return ((e = t == null ? void 0 : t.classes) == null ? void 0 : e.join(" ")) ?? "";
713
+ }
714
+ S(Jt, "getClassesFromDbInfo");
715
+ function qt(t) {
716
+ return (t == null ? void 0 : t.styles) ?? [];
717
+ }
718
+ S(qt, "getStylesFromDbInfo");
719
+ var it = /* @__PURE__ */ S((t, e, s, a, i, o, h, p) => {
720
+ var v, x, $;
721
+ const d = e.id, T = s.get(d), E = Jt(T), m = qt(T), I = F();
722
+ if (b.info("dataFetcher parsedItem", e, T, m), d !== "root") {
723
+ let O = kt;
724
+ e.start === !0 ? O = Ee : e.start === !1 && (O = _e), e.type !== rt && (O = e.type), St.get(d) || St.set(d, {
725
+ id: d,
726
+ shape: O,
727
+ description: K.sanitizeText(d, I),
728
+ cssClasses: `${E} ${ke}`,
729
+ cssStyles: m
730
+ });
731
+ const f = St.get(d);
732
+ e.description && (Array.isArray(f.description) ? (f.shape = vt, f.description.push(e.description)) : (v = f.description) != null && v.length && f.description.length > 0 ? (f.shape = vt, f.description === d ? f.description = [e.description] : f.description = [f.description, e.description]) : (f.shape = kt, f.description = e.description), f.description = K.sanitizeTextOrArray(f.description, I)), ((x = f.description) == null ? void 0 : x.length) === 1 && f.shape === vt && (f.type === "group" ? f.shape = Nt : f.shape = kt), !f.type && e.doc && (b.info("Setting cluster for XCX", d, Ft(e)), f.type = "group", f.isGroup = !0, f.dir = Ft(e), f.shape = e.type === Gt ? Rt : Nt, f.cssClasses = `${f.cssClasses} ${we} ${o ? Oe : ""}`);
733
+ const L = {
734
+ labelStyle: "",
735
+ shape: f.shape,
736
+ label: f.description,
737
+ cssClasses: f.cssClasses,
738
+ cssCompiledStyles: [],
739
+ cssStyles: f.cssStyles,
740
+ id: d,
741
+ dir: f.dir,
742
+ domId: yt(d, U),
743
+ type: f.type,
744
+ isGroup: f.type === "group",
745
+ padding: 8,
746
+ rx: 10,
747
+ ry: 10,
748
+ look: h,
749
+ labelType: "markdown"
750
+ };
751
+ if (L.shape === Rt && (L.label = ""), t && t.id !== "root" && (b.trace("Setting node ", d, " to be child of its parent ", t.id), L.parentId = t.id), L.centerLabel = !0, e.note) {
752
+ const C = {
753
+ labelStyle: "",
754
+ shape: me,
755
+ label: e.note.text,
756
+ labelType: "markdown",
757
+ cssClasses: xe,
758
+ // useHtmlLabels: false,
759
+ cssStyles: [],
760
+ cssCompiledStyles: [],
761
+ id: d + Ne + "-" + U,
762
+ domId: yt(d, U, Kt),
763
+ type: f.type,
764
+ isGroup: f.type === "group",
765
+ padding: ($ = I.flowchart) == null ? void 0 : $.padding,
766
+ look: h,
767
+ position: e.note.position
768
+ }, V = d + $t, P = {
769
+ labelStyle: "",
770
+ shape: be,
771
+ label: e.note.text,
772
+ cssClasses: f.cssClasses,
773
+ cssStyles: [],
774
+ id: d + $t,
775
+ domId: yt(d, U, zt),
776
+ type: "group",
777
+ isGroup: !0,
778
+ padding: 16,
779
+ //getConfig().flowchart.padding
780
+ look: h,
781
+ position: e.note.position
782
+ };
783
+ U++, P.id = V, C.parentId = V, st(a, P, p), st(a, C, p), st(a, L, p);
784
+ let k = d, B = C.id;
785
+ e.note.position === "left of" && (k = C.id, B = d), i.push({
786
+ id: k + "-" + B,
787
+ start: k,
788
+ end: B,
789
+ arrowhead: "none",
790
+ arrowTypeEnd: "",
791
+ style: Vt,
792
+ labelStyle: "",
793
+ classes: Ae,
794
+ arrowheadStyle: Mt,
795
+ labelpos: Wt,
796
+ labelType: Ut,
797
+ thickness: jt,
798
+ look: h
799
+ });
800
+ } else
801
+ st(a, L, p);
802
+ }
803
+ e.doc && (b.trace("Adding nodes children "), Pe(e, e.doc, s, a, i, !o, h, p));
804
+ }, "dataFetcher"), Be = /* @__PURE__ */ S(() => {
805
+ St.clear(), U = 0;
806
+ }, "reset"), A = {
807
+ START_NODE: "[*]",
808
+ START_TYPE: "start",
809
+ END_NODE: "[*]",
810
+ END_TYPE: "end",
811
+ COLOR_KEYWORD: "color",
812
+ FILL_KEYWORD: "fill",
813
+ BG_FILL: "bgFill",
814
+ STYLECLASS_SEP: ","
815
+ }, Pt = /* @__PURE__ */ S(() => /* @__PURE__ */ new Map(), "newClassesList"), Bt = /* @__PURE__ */ S(() => ({
816
+ relations: [],
817
+ states: /* @__PURE__ */ new Map(),
818
+ documents: {}
819
+ }), "newDoc"), pt = /* @__PURE__ */ S((t) => JSON.parse(JSON.stringify(t)), "clone"), X, He = (X = class {
820
+ constructor(e) {
821
+ this.version = e, this.nodes = [], this.edges = [], this.rootDoc = [], this.classes = Pt(), this.documents = { root: Bt() }, this.currentDocument = this.documents.root, this.startEndCount = 0, this.dividerCnt = 0, this.links = /* @__PURE__ */ new Map(), this.funs = [], this.getAccTitle = ae, this.setAccTitle = ne, this.getAccDescription = oe, this.setAccDescription = le, this.setDiagramTitle = ce, this.getDiagramTitle = he, this.clear(), this.setRootDoc = this.setRootDoc.bind(this), this.getDividerId = this.getDividerId.bind(this), this.setDirection = this.setDirection.bind(this), this.trimColon = this.trimColon.bind(this), this.bindFunctions = this.bindFunctions.bind(this);
822
+ }
823
+ /**
824
+ * Convert all of the statements (stmts) that were parsed into states and relationships.
825
+ * This is done because a state diagram may have nested sections,
826
+ * where each section is a 'document' and has its own set of statements.
827
+ * Ex: the section within a fork has its own statements, and incoming and outgoing statements
828
+ * refer to the fork as a whole (document).
829
+ * See the parser grammar: the definition of a document is a document then a 'line', where a line can be a statement.
830
+ * This will push the statement into the list of statements for the current document.
831
+ */
832
+ extract(e) {
833
+ this.clear(!0);
834
+ for (const i of Array.isArray(e) ? e : e.doc)
835
+ switch (i.stmt) {
836
+ case tt:
837
+ this.addState(i.id.trim(), i.type, i.doc, i.description, i.note);
838
+ break;
839
+ case At:
840
+ this.addRelation(i.state1, i.state2, i.description);
841
+ break;
842
+ case ye:
843
+ this.addStyleClass(i.id.trim(), i.classes);
844
+ break;
845
+ case ge:
846
+ this.handleStyleDef(i);
847
+ break;
848
+ case Te:
849
+ this.setCssClass(i.id.trim(), i.styleClass);
850
+ break;
851
+ case "click":
852
+ this.addLink(i.id, i.url, i.tooltip);
853
+ break;
854
+ }
855
+ const s = this.getStates(), a = F();
856
+ Be(), it(
857
+ void 0,
858
+ this.getRootDocV2(),
859
+ s,
860
+ this.nodes,
861
+ this.edges,
862
+ !0,
863
+ a.look,
864
+ this.classes
865
+ );
866
+ for (const i of this.nodes)
867
+ if (Array.isArray(i.label)) {
868
+ if (i.description = i.label.slice(1), i.isGroup && i.description.length > 0)
869
+ throw new Error(
870
+ `Group nodes can only have label. Remove the additional description for node [${i.id}]`
871
+ );
872
+ i.label = i.label[0];
873
+ }
874
+ }
875
+ handleStyleDef(e) {
876
+ const s = e.id.trim().split(","), a = e.styleClass.split(",");
877
+ for (const i of s) {
878
+ let o = this.getState(i);
879
+ if (!o) {
880
+ const h = i.trim();
881
+ this.addState(h), o = this.getState(h);
882
+ }
883
+ o && (o.styles = a.map((h) => {
884
+ var p;
885
+ return (p = h.replace(/;/g, "")) == null ? void 0 : p.trim();
886
+ }));
887
+ }
888
+ }
889
+ setRootDoc(e) {
890
+ b.info("Setting root doc", e), this.rootDoc = e, this.version === 1 ? this.extract(e) : this.extract(this.getRootDocV2());
891
+ }
892
+ docTranslator(e, s, a) {
893
+ if (s.stmt === At) {
894
+ this.docTranslator(e, s.state1, !0), this.docTranslator(e, s.state2, !1);
895
+ return;
896
+ }
897
+ if (s.stmt === tt && (s.id === A.START_NODE ? (s.id = e.id + (a ? "_start" : "_end"), s.start = a) : s.id = s.id.trim()), s.stmt !== Z && s.stmt !== tt || !s.doc)
898
+ return;
899
+ const i = [];
900
+ let o = [];
901
+ for (const h of s.doc)
902
+ if (h.type === Gt) {
903
+ const p = pt(h);
904
+ p.doc = pt(o), i.push(p), o = [];
905
+ } else
906
+ o.push(h);
907
+ if (i.length > 0 && o.length > 0) {
908
+ const h = {
909
+ stmt: tt,
910
+ id: ue(),
911
+ type: "divider",
912
+ doc: pt(o)
913
+ };
914
+ i.push(pt(h)), s.doc = i;
915
+ }
916
+ s.doc.forEach((h) => this.docTranslator(s, h, !0));
917
+ }
918
+ getRootDocV2() {
919
+ return this.docTranslator(
920
+ { id: Z, stmt: Z },
921
+ { id: Z, stmt: Z, doc: this.rootDoc },
922
+ !0
923
+ ), { id: Z, doc: this.rootDoc };
924
+ }
925
+ /**
926
+ * Function called by parser when a node definition has been found.
927
+ *
928
+ * @param descr - description for the state. Can be a string or a list or strings
929
+ * @param classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class.
930
+ * @param styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style.
931
+ * @param textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style.
932
+ */
933
+ addState(e, s = rt, a = void 0, i = void 0, o = void 0, h = void 0, p = void 0, d = void 0) {
934
+ const T = e == null ? void 0 : e.trim();
935
+ if (!this.currentDocument.states.has(T))
936
+ b.info("Adding state ", T, i), this.currentDocument.states.set(T, {
937
+ stmt: tt,
938
+ id: T,
939
+ descriptions: [],
940
+ type: s,
941
+ doc: a,
942
+ note: o,
943
+ classes: [],
944
+ styles: [],
945
+ textStyles: []
946
+ });
947
+ else {
948
+ const E = this.currentDocument.states.get(T);
949
+ if (!E)
950
+ throw new Error(`State not found: ${T}`);
951
+ E.doc || (E.doc = a), E.type || (E.type = s);
952
+ }
953
+ if (i && (b.info("Setting state description", T, i), (Array.isArray(i) ? i : [i]).forEach((m) => this.addDescription(T, m.trim()))), o) {
954
+ const E = this.currentDocument.states.get(T);
955
+ if (!E)
956
+ throw new Error(`State not found: ${T}`);
957
+ E.note = o, E.note.text = K.sanitizeText(E.note.text, F());
958
+ }
959
+ h && (b.info("Setting state classes", T, h), (Array.isArray(h) ? h : [h]).forEach((m) => this.setCssClass(T, m.trim()))), p && (b.info("Setting state styles", T, p), (Array.isArray(p) ? p : [p]).forEach((m) => this.setStyle(T, m.trim()))), d && (b.info("Setting state styles", T, p), (Array.isArray(d) ? d : [d]).forEach((m) => this.setTextStyle(T, m.trim())));
960
+ }
961
+ clear(e) {
962
+ this.nodes = [], this.edges = [], this.funs = [this.setupToolTips.bind(this)], this.documents = { root: Bt() }, this.currentDocument = this.documents.root, this.startEndCount = 0, this.classes = Pt(), e || (this.links = /* @__PURE__ */ new Map(), de());
963
+ }
964
+ getState(e) {
965
+ return this.currentDocument.states.get(e);
966
+ }
967
+ getStates() {
968
+ return this.currentDocument.states;
969
+ }
970
+ logDocuments() {
971
+ b.info("Documents = ", this.documents);
972
+ }
973
+ getRelations() {
974
+ return this.currentDocument.relations;
975
+ }
976
+ /**
977
+ * Adds a clickable link to a state.
978
+ */
979
+ addLink(e, s, a) {
980
+ this.links.set(e, { url: s, tooltip: a }), b.warn("Adding link", e, s, a);
981
+ }
982
+ /**
983
+ * Get all registered links.
984
+ */
985
+ getLinks() {
986
+ return this.links;
987
+ }
988
+ /**
989
+ * If the id is a start node ( [*] ), then return a new id constructed from
990
+ * the start node name and the current start node count.
991
+ * else return the given id
992
+ */
993
+ startIdIfNeeded(e = "") {
994
+ return e === A.START_NODE ? (this.startEndCount++, `${A.START_TYPE}${this.startEndCount}`) : e;
995
+ }
996
+ /**
997
+ * If the id is a start node ( [*] ), then return the start type ('start')
998
+ * else return the given type
999
+ */
1000
+ startTypeIfNeeded(e = "", s = rt) {
1001
+ return e === A.START_NODE ? A.START_TYPE : s;
1002
+ }
1003
+ /**
1004
+ * If the id is an end node ( [*] ), then return a new id constructed from
1005
+ * the end node name and the current start_end node count.
1006
+ * else return the given id
1007
+ */
1008
+ endIdIfNeeded(e = "") {
1009
+ return e === A.END_NODE ? (this.startEndCount++, `${A.END_TYPE}${this.startEndCount}`) : e;
1010
+ }
1011
+ /**
1012
+ * If the id is an end node ( [*] ), then return the end type
1013
+ * else return the given type
1014
+ *
1015
+ */
1016
+ endTypeIfNeeded(e = "", s = rt) {
1017
+ return e === A.END_NODE ? A.END_TYPE : s;
1018
+ }
1019
+ addRelationObjs(e, s, a = "") {
1020
+ const i = this.startIdIfNeeded(e.id.trim()), o = this.startTypeIfNeeded(e.id.trim(), e.type), h = this.startIdIfNeeded(s.id.trim()), p = this.startTypeIfNeeded(s.id.trim(), s.type);
1021
+ this.addState(
1022
+ i,
1023
+ o,
1024
+ e.doc,
1025
+ e.description,
1026
+ e.note,
1027
+ e.classes,
1028
+ e.styles,
1029
+ e.textStyles
1030
+ ), this.addState(
1031
+ h,
1032
+ p,
1033
+ s.doc,
1034
+ s.description,
1035
+ s.note,
1036
+ s.classes,
1037
+ s.styles,
1038
+ s.textStyles
1039
+ ), this.currentDocument.relations.push({
1040
+ id1: i,
1041
+ id2: h,
1042
+ relationTitle: K.sanitizeText(a, F())
1043
+ });
1044
+ }
1045
+ /**
1046
+ * Add a relation between two items. The items may be full objects or just the string id of a state.
1047
+ */
1048
+ addRelation(e, s, a) {
1049
+ if (typeof e == "object" && typeof s == "object")
1050
+ this.addRelationObjs(e, s, a);
1051
+ else if (typeof e == "string" && typeof s == "string") {
1052
+ const i = this.startIdIfNeeded(e.trim()), o = this.startTypeIfNeeded(e), h = this.endIdIfNeeded(s.trim()), p = this.endTypeIfNeeded(s);
1053
+ this.addState(i, o), this.addState(h, p), this.currentDocument.relations.push({
1054
+ id1: i,
1055
+ id2: h,
1056
+ relationTitle: a ? K.sanitizeText(a, F()) : void 0
1057
+ });
1058
+ }
1059
+ }
1060
+ addDescription(e, s) {
1061
+ var o;
1062
+ const a = this.currentDocument.states.get(e), i = s.startsWith(":") ? s.replace(":", "").trim() : s;
1063
+ (o = a == null ? void 0 : a.descriptions) == null || o.push(K.sanitizeText(i, F()));
1064
+ }
1065
+ cleanupLabel(e) {
1066
+ return e.startsWith(":") ? e.slice(2).trim() : e.trim();
1067
+ }
1068
+ getDividerId() {
1069
+ return this.dividerCnt++, `divider-id-${this.dividerCnt}`;
1070
+ }
1071
+ /**
1072
+ * Called when the parser comes across a (style) class definition
1073
+ * @example classDef my-style fill:#f96;
1074
+ *
1075
+ * @param id - the id of this (style) class
1076
+ * @param styleAttributes - the string with 1 or more style attributes (each separated by a comma)
1077
+ */
1078
+ addStyleClass(e, s = "") {
1079
+ this.classes.has(e) || this.classes.set(e, { id: e, styles: [], textStyles: [] });
1080
+ const a = this.classes.get(e);
1081
+ s && a && s.split(A.STYLECLASS_SEP).forEach((i) => {
1082
+ const o = i.replace(/([^;]*);/, "$1").trim();
1083
+ if (RegExp(A.COLOR_KEYWORD).exec(i)) {
1084
+ const p = o.replace(A.FILL_KEYWORD, A.BG_FILL).replace(A.COLOR_KEYWORD, A.FILL_KEYWORD);
1085
+ a.textStyles.push(p);
1086
+ }
1087
+ a.styles.push(o);
1088
+ });
1089
+ }
1090
+ getClasses() {
1091
+ return this.classes;
1092
+ }
1093
+ setupToolTips(e) {
1094
+ const s = pe();
1095
+ Dt(e).select("svg").selectAll("g.node, g.rough-node").on("mouseover", (o) => {
1096
+ var T;
1097
+ const h = Dt(o.currentTarget), p = h.attr("title");
1098
+ if (p === null)
1099
+ return;
1100
+ const d = (T = o.currentTarget) == null ? void 0 : T.getBoundingClientRect();
1101
+ s.transition().duration(200).style("opacity", ".9"), s.style("left", window.scrollX + d.left + (d.right - d.left) / 2 + "px").style("top", window.scrollY + d.bottom + "px"), s.html(fe.sanitize(p)), h.classed("hover", !0);
1102
+ }).on("mouseout", (o) => {
1103
+ s.transition().duration(500).style("opacity", 0), Dt(o.currentTarget).classed("hover", !1);
1104
+ });
1105
+ }
1106
+ /**
1107
+ * Add a (style) class or css class to a state with the given id.
1108
+ * If the state isn't already in the list of known states, add it.
1109
+ * Might be called by parser when a style class or CSS class should be applied to a state
1110
+ *
1111
+ * @param itemIds - The id or a list of ids of the item(s) to apply the css class to
1112
+ * @param cssClassName - CSS class name
1113
+ */
1114
+ setCssClass(e, s) {
1115
+ e.split(",").forEach((a) => {
1116
+ var o;
1117
+ let i = this.getState(a);
1118
+ if (!i) {
1119
+ const h = a.trim();
1120
+ this.addState(h), i = this.getState(h);
1121
+ }
1122
+ (o = i == null ? void 0 : i.classes) == null || o.push(s);
1123
+ });
1124
+ }
1125
+ /**
1126
+ * Add a style to a state with the given id.
1127
+ * @example style stateId fill:#f9f,stroke:#333,stroke-width:4px
1128
+ * where 'style' is the keyword
1129
+ * stateId is the id of a state
1130
+ * the rest of the string is the styleText (all of the attributes to be applied to the state)
1131
+ *
1132
+ * @param itemId - The id of item to apply the style to
1133
+ * @param styleText - the text of the attributes for the style
1134
+ */
1135
+ setStyle(e, s) {
1136
+ var a, i;
1137
+ (i = (a = this.getState(e)) == null ? void 0 : a.styles) == null || i.push(s);
1138
+ }
1139
+ /**
1140
+ * Add a text style to a state with the given id
1141
+ *
1142
+ * @param itemId - The id of item to apply the css class to
1143
+ * @param cssClassName - CSS class name
1144
+ */
1145
+ setTextStyle(e, s) {
1146
+ var a, i;
1147
+ (i = (a = this.getState(e)) == null ? void 0 : a.textStyles) == null || i.push(s);
1148
+ }
1149
+ bindFunctions(e) {
1150
+ this.funs.forEach((s) => {
1151
+ s(e);
1152
+ });
1153
+ }
1154
+ /**
1155
+ * Finds the direction statement in the root document.
1156
+ * @returns the direction statement if present
1157
+ */
1158
+ getDirectionStatement() {
1159
+ return this.rootDoc.find((e) => e.stmt === Ot);
1160
+ }
1161
+ getDirection() {
1162
+ var e;
1163
+ return ((e = this.getDirectionStatement()) == null ? void 0 : e.value) ?? Se;
1164
+ }
1165
+ setDirection(e) {
1166
+ const s = this.getDirectionStatement();
1167
+ s ? s.value = e : this.rootDoc.unshift({ stmt: Ot, value: e });
1168
+ }
1169
+ trimColon(e) {
1170
+ return e.startsWith(":") ? e.slice(1).trim() : e.trim();
1171
+ }
1172
+ getData() {
1173
+ const e = F();
1174
+ return {
1175
+ nodes: this.nodes,
1176
+ edges: this.edges,
1177
+ other: {},
1178
+ config: e,
1179
+ direction: Xt(this.getRootDocV2())
1180
+ };
1181
+ }
1182
+ getConfig() {
1183
+ return F().state;
1184
+ }
1185
+ }, S(X, "StateDB"), X.relationType = {
1186
+ AGGREGATION: 0,
1187
+ EXTENSION: 1,
1188
+ COMPOSITION: 2,
1189
+ DEPENDENCY: 3
1190
+ }, X), Ye = /* @__PURE__ */ S((t) => `
1191
+ defs [id$="-barbEnd"] {
1192
+ fill: ${t.transitionColor};
1193
+ stroke: ${t.transitionColor};
1194
+ }
1195
+ g.stateGroup text {
1196
+ fill: ${t.nodeBorder};
1197
+ stroke: none;
1198
+ font-size: 10px;
1199
+ }
1200
+ g.stateGroup text {
1201
+ fill: ${t.textColor};
1202
+ stroke: none;
1203
+ font-size: 10px;
1204
+
1205
+ }
1206
+ g.stateGroup .state-title {
1207
+ font-weight: bolder;
1208
+ fill: ${t.stateLabelColor};
1209
+ }
1210
+
1211
+ g.stateGroup rect {
1212
+ fill: ${t.mainBkg};
1213
+ stroke: ${t.nodeBorder};
1214
+ }
1215
+
1216
+ g.stateGroup line {
1217
+ stroke: ${t.lineColor};
1218
+ stroke-width: ${t.strokeWidth || 1};
1219
+ }
1220
+
1221
+ .transition {
1222
+ stroke: ${t.transitionColor};
1223
+ stroke-width: ${t.strokeWidth || 1};
1224
+ fill: none;
1225
+ }
1226
+
1227
+ .stateGroup .composit {
1228
+ fill: ${t.background};
1229
+ border-bottom: 1px
1230
+ }
1231
+
1232
+ .stateGroup .alt-composit {
1233
+ fill: #e0e0e0;
1234
+ border-bottom: 1px
1235
+ }
1236
+
1237
+ .state-note {
1238
+ stroke: ${t.noteBorderColor};
1239
+ fill: ${t.noteBkgColor};
1240
+
1241
+ text {
1242
+ fill: ${t.noteTextColor};
1243
+ stroke: none;
1244
+ font-size: 10px;
1245
+ }
1246
+ }
1247
+
1248
+ .stateLabel .box {
1249
+ stroke: none;
1250
+ stroke-width: 0;
1251
+ fill: ${t.mainBkg};
1252
+ opacity: 0.5;
1253
+ }
1254
+
1255
+ .edgeLabel .label rect {
1256
+ fill: ${t.labelBackgroundColor};
1257
+ opacity: 0.5;
1258
+ }
1259
+ .edgeLabel {
1260
+ background-color: ${t.edgeLabelBackground};
1261
+ p {
1262
+ background-color: ${t.edgeLabelBackground};
1263
+ }
1264
+ rect {
1265
+ opacity: 0.5;
1266
+ background-color: ${t.edgeLabelBackground};
1267
+ fill: ${t.edgeLabelBackground};
1268
+ }
1269
+ text-align: center;
1270
+ }
1271
+ .edgeLabel .label text {
1272
+ fill: ${t.transitionLabelColor || t.tertiaryTextColor};
1273
+ }
1274
+ .label div .edgeLabel {
1275
+ color: ${t.transitionLabelColor || t.tertiaryTextColor};
1276
+ }
1277
+
1278
+ .stateLabel text {
1279
+ fill: ${t.stateLabelColor};
1280
+ font-size: 10px;
1281
+ font-weight: bold;
1282
+ }
1283
+
1284
+ .node circle.state-start {
1285
+ fill: ${t.specialStateColor};
1286
+ stroke: ${t.specialStateColor};
1287
+ }
1288
+
1289
+ .node .fork-join {
1290
+ fill: ${t.specialStateColor};
1291
+ stroke: ${t.specialStateColor};
1292
+ }
1293
+
1294
+ .node circle.state-end {
1295
+ fill: ${t.innerEndBackground};
1296
+ stroke: ${t.background};
1297
+ stroke-width: 1.5
1298
+ }
1299
+ .end-state-inner {
1300
+ fill: ${t.compositeBackground || t.background};
1301
+ // stroke: ${t.background};
1302
+ stroke-width: 1.5
1303
+ }
1304
+
1305
+ .node rect {
1306
+ fill: ${t.stateBkg || t.mainBkg};
1307
+ stroke: ${t.stateBorder || t.nodeBorder};
1308
+ stroke-width: ${t.strokeWidth || 1}px;
1309
+ }
1310
+ .node polygon {
1311
+ fill: ${t.mainBkg};
1312
+ stroke: ${t.stateBorder || t.nodeBorder};;
1313
+ stroke-width: ${t.strokeWidth || 1}px;
1314
+ }
1315
+ [id$="-barbEnd"] {
1316
+ fill: ${t.lineColor};
1317
+ }
1318
+
1319
+ .statediagram-cluster rect {
1320
+ fill: ${t.compositeTitleBackground};
1321
+ stroke: ${t.stateBorder || t.nodeBorder};
1322
+ stroke-width: ${t.strokeWidth || 1}px;
1323
+ }
1324
+
1325
+ .cluster-label, .nodeLabel {
1326
+ color: ${t.stateLabelColor};
1327
+ // line-height: 1;
1328
+ }
1329
+
1330
+ .statediagram-cluster rect.outer {
1331
+ rx: 5px;
1332
+ ry: 5px;
1333
+ }
1334
+ .statediagram-state .divider {
1335
+ stroke: ${t.stateBorder || t.nodeBorder};
1336
+ }
1337
+
1338
+ .statediagram-state .title-state {
1339
+ rx: 5px;
1340
+ ry: 5px;
1341
+ }
1342
+ .statediagram-cluster.statediagram-cluster .inner {
1343
+ fill: ${t.compositeBackground || t.background};
1344
+ }
1345
+ .statediagram-cluster.statediagram-cluster-alt .inner {
1346
+ fill: ${t.altBackground ? t.altBackground : "#efefef"};
1347
+ }
1348
+
1349
+ .statediagram-cluster .inner {
1350
+ rx:0;
1351
+ ry:0;
1352
+ }
1353
+
1354
+ .statediagram-state rect.basic {
1355
+ rx: 5px;
1356
+ ry: 5px;
1357
+ }
1358
+ .statediagram-state rect.divider {
1359
+ stroke-dasharray: 10,10;
1360
+ fill: ${t.altBackground ? t.altBackground : "#efefef"};
1361
+ }
1362
+
1363
+ .note-edge {
1364
+ stroke-dasharray: 5;
1365
+ }
1366
+
1367
+ .statediagram-note rect {
1368
+ fill: ${t.noteBkgColor};
1369
+ stroke: ${t.noteBorderColor};
1370
+ stroke-width: 1px;
1371
+ rx: 0;
1372
+ ry: 0;
1373
+ }
1374
+ .statediagram-note rect {
1375
+ fill: ${t.noteBkgColor};
1376
+ stroke: ${t.noteBorderColor};
1377
+ stroke-width: 1px;
1378
+ rx: 0;
1379
+ ry: 0;
1380
+ }
1381
+
1382
+ .statediagram-note text {
1383
+ fill: ${t.noteTextColor};
1384
+ }
1385
+
1386
+ .statediagram-note .nodeLabel {
1387
+ color: ${t.noteTextColor};
1388
+ }
1389
+ .statediagram .edgeLabel {
1390
+ color: red; // ${t.noteTextColor};
1391
+ }
1392
+
1393
+ [id$="-dependencyStart"], [id$="-dependencyEnd"] {
1394
+ fill: ${t.lineColor};
1395
+ stroke: ${t.lineColor};
1396
+ stroke-width: ${t.strokeWidth || 1};
1397
+ }
1398
+
1399
+ .statediagramTitleText {
1400
+ text-anchor: middle;
1401
+ font-size: 18px;
1402
+ fill: ${t.textColor};
1403
+ }
1404
+
1405
+ [data-look="neo"].statediagram-cluster rect {
1406
+ fill: ${t.mainBkg};
1407
+ stroke: ${t.useGradient ? "url(" + t.svgId + "-gradient)" : t.stateBorder || t.nodeBorder};
1408
+ stroke-width: ${t.strokeWidth ?? 1};
1409
+ }
1410
+ [data-look="neo"].statediagram-cluster rect.outer {
1411
+ rx: ${t.radius}px;
1412
+ ry: ${t.radius}px;
1413
+ filter: ${t.dropShadow ? t.dropShadow.replace("url(#drop-shadow)", `url(${t.svgId}-drop-shadow)`) : "none"}
1414
+ }
1415
+ `, "getStyles"), ze = Ye;
1416
+ export {
1417
+ He as S,
1418
+ Ue as a,
1419
+ je as b,
1420
+ ze as s
1421
+ };