@8btc/xcanvas 0.0.1

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 (121) hide show
  1. package/README.md +70 -0
  2. package/dist/Tableau10-BqnYsPR6.js +9 -0
  3. package/dist/XCanvas-BxdLBkBz.js +27732 -0
  4. package/dist/_commonjs-dynamic-modules-TGKdzP3c.js +6 -0
  5. package/dist/ar-SA-G6X2FPQ2-DjqDLLYL.js +41 -0
  6. package/dist/arc-D1qX5GFf.js +132 -0
  7. package/dist/array-DgktLKBx.js +6 -0
  8. package/dist/az-AZ-76LH7QW2-D7LOsF3_.js +32 -0
  9. package/dist/bg-BG-XCXSNQG7-WI4tFn23.js +36 -0
  10. package/dist/blockDiagram-38ab4fdb-DtemKfEh.js +1811 -0
  11. package/dist/bn-BD-2XOGV67Q-Bugx_8fy.js +36 -0
  12. package/dist/c4Diagram-3d4e48cf-Byd2vU9K.js +2463 -0
  13. package/dist/ca-ES-6MX7JW3Y-6rFwKGsQ.js +39 -0
  14. package/dist/channel-BT_3Ze-Y.js +7 -0
  15. package/dist/chunk-EIO257PC-C7qD7hGu.js +1641 -0
  16. package/dist/classDiagram-70f12bd4-CwfYadk-.js +354 -0
  17. package/dist/classDiagram-v2-f2320105-B28MuM8f.js +284 -0
  18. package/dist/clone-D2FUK8WY.js +8 -0
  19. package/dist/createText-2e5e7dd3-Ca1JfQaJ.js +4914 -0
  20. package/dist/cs-CZ-2BRQDIVT-Dhd8XszK.js +42 -0
  21. package/dist/da-DK-5WZEPLOC-BhL87sSs.js +36 -0
  22. package/dist/de-DE-XR44H4JA-xSrZSV0J.js +39 -0
  23. package/dist/directory-open-01563666-XowynPwH.js +14 -0
  24. package/dist/directory-open-4ed118d0-BwYbu9dw.js +55 -0
  25. package/dist/edges-e0da2a9e-9VbVapWU.js +1840 -0
  26. package/dist/el-GR-BZB4AONW-DQORZ_pY.js +41 -0
  27. package/dist/en-B4ZKOASM-D2BVbEdz.js +39 -0
  28. package/dist/erDiagram-9861fffd-D4S9QDes.js +1318 -0
  29. package/dist/es-ES-U4NZUMDT-C0Q89-0V.js +40 -0
  30. package/dist/eu-ES-A7QVB2H4-BwBW3cEw.js +42 -0
  31. package/dist/fa-IR-HGAKTJCU-DtZ74rm4.js +39 -0
  32. package/dist/fi-FI-Z5N7JZ37-QvQan48z.js +37 -0
  33. package/dist/file-open-002ab408-BNIYSKAV.js +18 -0
  34. package/dist/file-open-7c801643-B_l1UXdI.js +15 -0
  35. package/dist/file-save-3189631c-vzijizFw.js +23 -0
  36. package/dist/file-save-745eba88-B5-wM56X.js +25 -0
  37. package/dist/flowDb-956e92f1-S6T8ppJw.js +1713 -0
  38. package/dist/flowDiagram-66a62f08-C6TTwS5_.js +1264 -0
  39. package/dist/flowDiagram-v2-96b9c2cf-CzfeUNGP.js +24 -0
  40. package/dist/flowchart-elk-definition-4a651766-CRv1kWtk.js +92922 -0
  41. package/dist/fr-FR-RHASNOE6-CZFiweNU.js +40 -0
  42. package/dist/ganttDiagram-c361ad54-CAnfd8Sw.js +3420 -0
  43. package/dist/gitGraphDiagram-72cf32ee-CSGI-xRI.js +1790 -0
  44. package/dist/gl-ES-HMX3MZ6V-Bqv2xL-V.js +41 -0
  45. package/dist/graph-Ct2tKpKj.js +1253 -0
  46. package/dist/he-IL-6SHJWFNN-kso30jhn.js +41 -0
  47. package/dist/hi-IN-IWLTKZ5I-Busk5oaa.js +35 -0
  48. package/dist/hu-HU-A5ZG7DT2-xSR2C2H0.js +38 -0
  49. package/dist/id-ID-SAP4L64H-BQQZYm1L.js +41 -0
  50. package/dist/image-EDRW2JGV-Cx7o2kxD.js +6 -0
  51. package/dist/image-blob-reduce.esm-BKPqMdie.js +2396 -0
  52. package/dist/index-3862675e-B3j3w-v_.js +663 -0
  53. package/dist/index-CLOU2Ikr.js +14364 -0
  54. package/dist/index.css +450 -0
  55. package/dist/index.d.ts +40 -0
  56. package/dist/index.js +7 -0
  57. package/dist/index.umd.cjs +235477 -0
  58. package/dist/infoDiagram-f8f76790-NqA75uBo.js +510 -0
  59. package/dist/init-ZxktEp_H.js +16 -0
  60. package/dist/it-IT-JPQ66NNP-CAMVZrYt.js +42 -0
  61. package/dist/ja-JP-DBVTYXUO-CAX8A_Uj.js +39 -0
  62. package/dist/journeyDiagram-49397b02-By5oBzsZ.js +1182 -0
  63. package/dist/kaa-6HZHGXH3-4-o94cPY.js +32 -0
  64. package/dist/kab-KAB-ZGHBKWFO-CgyjjBvZ.js +39 -0
  65. package/dist/katex-C-jAQc2m.js +14516 -0
  66. package/dist/kk-KZ-P5N5QNE5-BEqZcwLA.js +32 -0
  67. package/dist/km-KH-HSX4SM5Z-DvKDbeH4.js +42 -0
  68. package/dist/ko-KR-MTYHY66A-DKCuAbKE.js +40 -0
  69. package/dist/ku-TR-6OUDTVRD-CNUs4cCe.js +40 -0
  70. package/dist/layout-AJxYKqQV.js +2292 -0
  71. package/dist/line-DJIf5OM8.js +45 -0
  72. package/dist/linear-Cfj4s4vI.js +539 -0
  73. package/dist/lt-LT-XHIRWOB4-gouzGdoW.js +34 -0
  74. package/dist/lv-LV-5QDEKY6T-CTvg1XFv.js +38 -0
  75. package/dist/mindmap-definition-fc14e90a-CBlwH_UF.js +35283 -0
  76. package/dist/mr-IN-CRQNXWMA-QeYm06Kq.js +44 -0
  77. package/dist/my-MM-5M5IBNSE-DG3k9ORf.js +32 -0
  78. package/dist/nb-NO-T6EIAALU-Cj995Nmg.js +41 -0
  79. package/dist/nl-NL-IS3SIHDZ-B-2H7xey.js +39 -0
  80. package/dist/nn-NO-6E72VCQL-DrAwKKTN.js +39 -0
  81. package/dist/oc-FR-POXYY2M6-CeyJD7tq.js +39 -0
  82. package/dist/ordinal-DSZU4PqD.js +76 -0
  83. package/dist/pa-IN-N4M65BXN-DHzi6mjo.js +35 -0
  84. package/dist/path-Cp2qmpkd.js +109 -0
  85. package/dist/percentages-BXMCSKIN-CDYsTuua.js +6 -0
  86. package/dist/pica-CzzcRNRD.js +1702 -0
  87. package/dist/pieDiagram-8a3498a8-DueGoZOh.js +768 -0
  88. package/dist/pl-PL-T2D74RX3-BBNEV2c6.js +40 -0
  89. package/dist/pt-BR-5N22H2LF-D2cTx_F0.js +40 -0
  90. package/dist/pt-PT-UZXXM6DQ-BddvLLsF.js +40 -0
  91. package/dist/quadrantDiagram-120e2f19-Tb6_oGIn.js +1198 -0
  92. package/dist/requirementDiagram-deff3bca-CEeg0ep-.js +1089 -0
  93. package/dist/ro-RO-JPDTUUEW-DynuW50i.js +42 -0
  94. package/dist/roundRect-CjfubgrN.js +152 -0
  95. package/dist/ru-RU-B4JR7IUQ-B5Hecrew.js +40 -0
  96. package/dist/sankeyDiagram-04a897e0-CGTLQ8Gm.js +1172 -0
  97. package/dist/sequenceDiagram-704730f1-CZ72D-Nd.js +3336 -0
  98. package/dist/si-LK-N5RQ5JYF-BGMa93tc.js +32 -0
  99. package/dist/sk-SK-C5VTKIMK-BttCAlBm.js +37 -0
  100. package/dist/sl-SI-NN7IZMDC-DTC59nzG.js +37 -0
  101. package/dist/stateDiagram-587899a1-XISZzz_f.js +451 -0
  102. package/dist/stateDiagram-v2-d93cdb3a-DbCcmzTc.js +319 -0
  103. package/dist/styles-6aaf32cf-CyfdkEib.js +1363 -0
  104. package/dist/styles-9a916d00-zQ92RrTB.js +1483 -0
  105. package/dist/styles-c10674c1-BWmkigmR.js +571 -0
  106. package/dist/subset-shared.chunk-BuFt2PpZ.js +8 -0
  107. package/dist/subset-worker.chunk-CgaFXU4O.js +14 -0
  108. package/dist/sv-SE-XGPEYMSR-BPDlPxC1.js +41 -0
  109. package/dist/svgDrawCommon-08f97a94-CJ0lufOi.js +100 -0
  110. package/dist/ta-IN-2NMHFXQM-CI1ZsNk9.js +40 -0
  111. package/dist/th-TH-HPSO5L25-CUM-w2Qt.js +33 -0
  112. package/dist/timeline-definition-85554ec2-DV6084Gl.js +1210 -0
  113. package/dist/tr-TR-DEFEU3FU-CGpyf_vD.js +38 -0
  114. package/dist/uk-UA-QMV73CPH-Bg15Mv3J.js +37 -0
  115. package/dist/vi-VN-M7AON7JQ-AYmca9so.js +36 -0
  116. package/dist/vite.svg +1 -0
  117. package/dist/xychartDiagram-e933f94c-P1e6EEaH.js +1796 -0
  118. package/dist/zh-CN-LNUGB5OW-Dem2Cc-c.js +41 -0
  119. package/dist/zh-HK-E62DVLB3-BjsDyiLI.js +32 -0
  120. package/dist/zh-TW-RAJ6MFWO-IDAsc9Pz.js +40 -0
  121. package/package.json +52 -0
@@ -0,0 +1,1182 @@
1
+ import { a as getAccDescription, s as setAccDescription, b as getAccTitle, c as setAccTitle, o as getDiagramTitle, p as setDiagramTitle, g as getConfig, d as select, e as configureSvgSize, r as clear$1 } from "./index-CLOU2Ikr.js";
2
+ import { a as drawBackgroundRect$1, g as getNoteRect, f as drawText$1, d as drawRect$1 } from "./svgDrawCommon-08f97a94-CJ0lufOi.js";
3
+ import { a as arc } from "./arc-D1qX5GFf.js";
4
+ var parser = (function() {
5
+ var o = function(k, v, o2, l) {
6
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
7
+ ;
8
+ return o2;
9
+ }, $V0 = [6, 8, 10, 11, 12, 14, 16, 17, 18], $V1 = [1, 9], $V2 = [1, 10], $V3 = [1, 11], $V4 = [1, 12], $V5 = [1, 13], $V6 = [1, 14];
10
+ var parser2 = {
11
+ trace: function trace() {
12
+ },
13
+ yy: {},
14
+ symbols_: { "error": 2, "start": 3, "journey": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NEWLINE": 10, "title": 11, "acc_title": 12, "acc_title_value": 13, "acc_descr": 14, "acc_descr_value": 15, "acc_descr_multiline_value": 16, "section": 17, "taskName": 18, "taskData": 19, "$accept": 0, "$end": 1 },
15
+ terminals_: { 2: "error", 4: "journey", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 11: "title", 12: "acc_title", 13: "acc_title_value", 14: "acc_descr", 15: "acc_descr_value", 16: "acc_descr_multiline_value", 17: "section", 18: "taskName", 19: "taskData" },
16
+ productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2]],
17
+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
18
+ var $0 = $$.length - 1;
19
+ switch (yystate) {
20
+ case 1:
21
+ return $$[$0 - 1];
22
+ case 2:
23
+ this.$ = [];
24
+ break;
25
+ case 3:
26
+ $$[$0 - 1].push($$[$0]);
27
+ this.$ = $$[$0 - 1];
28
+ break;
29
+ case 4:
30
+ case 5:
31
+ this.$ = $$[$0];
32
+ break;
33
+ case 6:
34
+ case 7:
35
+ this.$ = [];
36
+ break;
37
+ case 8:
38
+ yy.setDiagramTitle($$[$0].substr(6));
39
+ this.$ = $$[$0].substr(6);
40
+ break;
41
+ case 9:
42
+ this.$ = $$[$0].trim();
43
+ yy.setAccTitle(this.$);
44
+ break;
45
+ case 10:
46
+ case 11:
47
+ this.$ = $$[$0].trim();
48
+ yy.setAccDescription(this.$);
49
+ break;
50
+ case 12:
51
+ yy.addSection($$[$0].substr(8));
52
+ this.$ = $$[$0].substr(8);
53
+ break;
54
+ case 13:
55
+ yy.addTask($$[$0 - 1], $$[$0]);
56
+ this.$ = "task";
57
+ break;
58
+ }
59
+ },
60
+ table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 15, 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 8]), { 13: [1, 16] }, { 15: [1, 17] }, o($V0, [2, 11]), o($V0, [2, 12]), { 19: [1, 18] }, o($V0, [2, 4]), o($V0, [2, 9]), o($V0, [2, 10]), o($V0, [2, 13])],
61
+ defaultActions: {},
62
+ parseError: function parseError(str, hash) {
63
+ if (hash.recoverable) {
64
+ this.trace(str);
65
+ } else {
66
+ var error = new Error(str);
67
+ error.hash = hash;
68
+ throw error;
69
+ }
70
+ },
71
+ parse: function parse(input) {
72
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
73
+ var args = lstack.slice.call(arguments, 1);
74
+ var lexer2 = Object.create(this.lexer);
75
+ var sharedState = { yy: {} };
76
+ for (var k in this.yy) {
77
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
78
+ sharedState.yy[k] = this.yy[k];
79
+ }
80
+ }
81
+ lexer2.setInput(input, sharedState.yy);
82
+ sharedState.yy.lexer = lexer2;
83
+ sharedState.yy.parser = this;
84
+ if (typeof lexer2.yylloc == "undefined") {
85
+ lexer2.yylloc = {};
86
+ }
87
+ var yyloc = lexer2.yylloc;
88
+ lstack.push(yyloc);
89
+ var ranges = lexer2.options && lexer2.options.ranges;
90
+ if (typeof sharedState.yy.parseError === "function") {
91
+ this.parseError = sharedState.yy.parseError;
92
+ } else {
93
+ this.parseError = Object.getPrototypeOf(this).parseError;
94
+ }
95
+ function lex() {
96
+ var token;
97
+ token = tstack.pop() || lexer2.lex() || EOF;
98
+ if (typeof token !== "number") {
99
+ if (token instanceof Array) {
100
+ tstack = token;
101
+ token = tstack.pop();
102
+ }
103
+ token = self.symbols_[token] || token;
104
+ }
105
+ return token;
106
+ }
107
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
108
+ while (true) {
109
+ state = stack[stack.length - 1];
110
+ if (this.defaultActions[state]) {
111
+ action = this.defaultActions[state];
112
+ } else {
113
+ if (symbol === null || typeof symbol == "undefined") {
114
+ symbol = lex();
115
+ }
116
+ action = table[state] && table[state][symbol];
117
+ }
118
+ if (typeof action === "undefined" || !action.length || !action[0]) {
119
+ var errStr = "";
120
+ expected = [];
121
+ for (p in table[state]) {
122
+ if (this.terminals_[p] && p > TERROR) {
123
+ expected.push("'" + this.terminals_[p] + "'");
124
+ }
125
+ }
126
+ if (lexer2.showPosition) {
127
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
128
+ } else {
129
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
130
+ }
131
+ this.parseError(errStr, {
132
+ text: lexer2.match,
133
+ token: this.terminals_[symbol] || symbol,
134
+ line: lexer2.yylineno,
135
+ loc: yyloc,
136
+ expected
137
+ });
138
+ }
139
+ if (action[0] instanceof Array && action.length > 1) {
140
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
141
+ }
142
+ switch (action[0]) {
143
+ case 1:
144
+ stack.push(symbol);
145
+ vstack.push(lexer2.yytext);
146
+ lstack.push(lexer2.yylloc);
147
+ stack.push(action[1]);
148
+ symbol = null;
149
+ {
150
+ yyleng = lexer2.yyleng;
151
+ yytext = lexer2.yytext;
152
+ yylineno = lexer2.yylineno;
153
+ yyloc = lexer2.yylloc;
154
+ }
155
+ break;
156
+ case 2:
157
+ len = this.productions_[action[1]][1];
158
+ yyval.$ = vstack[vstack.length - len];
159
+ yyval._$ = {
160
+ first_line: lstack[lstack.length - (len || 1)].first_line,
161
+ last_line: lstack[lstack.length - 1].last_line,
162
+ first_column: lstack[lstack.length - (len || 1)].first_column,
163
+ last_column: lstack[lstack.length - 1].last_column
164
+ };
165
+ if (ranges) {
166
+ yyval._$.range = [
167
+ lstack[lstack.length - (len || 1)].range[0],
168
+ lstack[lstack.length - 1].range[1]
169
+ ];
170
+ }
171
+ r = this.performAction.apply(yyval, [
172
+ yytext,
173
+ yyleng,
174
+ yylineno,
175
+ sharedState.yy,
176
+ action[1],
177
+ vstack,
178
+ lstack
179
+ ].concat(args));
180
+ if (typeof r !== "undefined") {
181
+ return r;
182
+ }
183
+ if (len) {
184
+ stack = stack.slice(0, -1 * len * 2);
185
+ vstack = vstack.slice(0, -1 * len);
186
+ lstack = lstack.slice(0, -1 * len);
187
+ }
188
+ stack.push(this.productions_[action[1]][0]);
189
+ vstack.push(yyval.$);
190
+ lstack.push(yyval._$);
191
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
192
+ stack.push(newState);
193
+ break;
194
+ case 3:
195
+ return true;
196
+ }
197
+ }
198
+ return true;
199
+ }
200
+ };
201
+ var lexer = /* @__PURE__ */ (function() {
202
+ var lexer2 = {
203
+ EOF: 1,
204
+ parseError: function parseError(str, hash) {
205
+ if (this.yy.parser) {
206
+ this.yy.parser.parseError(str, hash);
207
+ } else {
208
+ throw new Error(str);
209
+ }
210
+ },
211
+ // resets the lexer, sets new input
212
+ setInput: function(input, yy) {
213
+ this.yy = yy || this.yy || {};
214
+ this._input = input;
215
+ this._more = this._backtrack = this.done = false;
216
+ this.yylineno = this.yyleng = 0;
217
+ this.yytext = this.matched = this.match = "";
218
+ this.conditionStack = ["INITIAL"];
219
+ this.yylloc = {
220
+ first_line: 1,
221
+ first_column: 0,
222
+ last_line: 1,
223
+ last_column: 0
224
+ };
225
+ if (this.options.ranges) {
226
+ this.yylloc.range = [0, 0];
227
+ }
228
+ this.offset = 0;
229
+ return this;
230
+ },
231
+ // consumes and returns one char from the input
232
+ input: function() {
233
+ var ch = this._input[0];
234
+ this.yytext += ch;
235
+ this.yyleng++;
236
+ this.offset++;
237
+ this.match += ch;
238
+ this.matched += ch;
239
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
240
+ if (lines) {
241
+ this.yylineno++;
242
+ this.yylloc.last_line++;
243
+ } else {
244
+ this.yylloc.last_column++;
245
+ }
246
+ if (this.options.ranges) {
247
+ this.yylloc.range[1]++;
248
+ }
249
+ this._input = this._input.slice(1);
250
+ return ch;
251
+ },
252
+ // unshifts one char (or a string) into the input
253
+ unput: function(ch) {
254
+ var len = ch.length;
255
+ var lines = ch.split(/(?:\r\n?|\n)/g);
256
+ this._input = ch + this._input;
257
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
258
+ this.offset -= len;
259
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
260
+ this.match = this.match.substr(0, this.match.length - 1);
261
+ this.matched = this.matched.substr(0, this.matched.length - 1);
262
+ if (lines.length - 1) {
263
+ this.yylineno -= lines.length - 1;
264
+ }
265
+ var r = this.yylloc.range;
266
+ this.yylloc = {
267
+ first_line: this.yylloc.first_line,
268
+ last_line: this.yylineno + 1,
269
+ first_column: this.yylloc.first_column,
270
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
271
+ };
272
+ if (this.options.ranges) {
273
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
274
+ }
275
+ this.yyleng = this.yytext.length;
276
+ return this;
277
+ },
278
+ // When called from action, caches matched text and appends it on next action
279
+ more: function() {
280
+ this._more = true;
281
+ return this;
282
+ },
283
+ // 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.
284
+ reject: function() {
285
+ if (this.options.backtrack_lexer) {
286
+ this._backtrack = true;
287
+ } else {
288
+ 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).\n" + this.showPosition(), {
289
+ text: "",
290
+ token: null,
291
+ line: this.yylineno
292
+ });
293
+ }
294
+ return this;
295
+ },
296
+ // retain first n characters of the match
297
+ less: function(n) {
298
+ this.unput(this.match.slice(n));
299
+ },
300
+ // displays already matched input, i.e. for error messages
301
+ pastInput: function() {
302
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
303
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
304
+ },
305
+ // displays upcoming input, i.e. for error messages
306
+ upcomingInput: function() {
307
+ var next = this.match;
308
+ if (next.length < 20) {
309
+ next += this._input.substr(0, 20 - next.length);
310
+ }
311
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
312
+ },
313
+ // displays the character position where the lexing error occurred, i.e. for error messages
314
+ showPosition: function() {
315
+ var pre = this.pastInput();
316
+ var c = new Array(pre.length + 1).join("-");
317
+ return pre + this.upcomingInput() + "\n" + c + "^";
318
+ },
319
+ // test the lexed token: return FALSE when not a match, otherwise return token
320
+ test_match: function(match, indexed_rule) {
321
+ var token, lines, backup;
322
+ if (this.options.backtrack_lexer) {
323
+ backup = {
324
+ yylineno: this.yylineno,
325
+ yylloc: {
326
+ first_line: this.yylloc.first_line,
327
+ last_line: this.last_line,
328
+ first_column: this.yylloc.first_column,
329
+ last_column: this.yylloc.last_column
330
+ },
331
+ yytext: this.yytext,
332
+ match: this.match,
333
+ matches: this.matches,
334
+ matched: this.matched,
335
+ yyleng: this.yyleng,
336
+ offset: this.offset,
337
+ _more: this._more,
338
+ _input: this._input,
339
+ yy: this.yy,
340
+ conditionStack: this.conditionStack.slice(0),
341
+ done: this.done
342
+ };
343
+ if (this.options.ranges) {
344
+ backup.yylloc.range = this.yylloc.range.slice(0);
345
+ }
346
+ }
347
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
348
+ if (lines) {
349
+ this.yylineno += lines.length;
350
+ }
351
+ this.yylloc = {
352
+ first_line: this.yylloc.last_line,
353
+ last_line: this.yylineno + 1,
354
+ first_column: this.yylloc.last_column,
355
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
356
+ };
357
+ this.yytext += match[0];
358
+ this.match += match[0];
359
+ this.matches = match;
360
+ this.yyleng = this.yytext.length;
361
+ if (this.options.ranges) {
362
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
363
+ }
364
+ this._more = false;
365
+ this._backtrack = false;
366
+ this._input = this._input.slice(match[0].length);
367
+ this.matched += match[0];
368
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
369
+ if (this.done && this._input) {
370
+ this.done = false;
371
+ }
372
+ if (token) {
373
+ return token;
374
+ } else if (this._backtrack) {
375
+ for (var k in backup) {
376
+ this[k] = backup[k];
377
+ }
378
+ return false;
379
+ }
380
+ return false;
381
+ },
382
+ // return next match in input
383
+ next: function() {
384
+ if (this.done) {
385
+ return this.EOF;
386
+ }
387
+ if (!this._input) {
388
+ this.done = true;
389
+ }
390
+ var token, match, tempMatch, index;
391
+ if (!this._more) {
392
+ this.yytext = "";
393
+ this.match = "";
394
+ }
395
+ var rules = this._currentRules();
396
+ for (var i = 0; i < rules.length; i++) {
397
+ tempMatch = this._input.match(this.rules[rules[i]]);
398
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
399
+ match = tempMatch;
400
+ index = i;
401
+ if (this.options.backtrack_lexer) {
402
+ token = this.test_match(tempMatch, rules[i]);
403
+ if (token !== false) {
404
+ return token;
405
+ } else if (this._backtrack) {
406
+ match = false;
407
+ continue;
408
+ } else {
409
+ return false;
410
+ }
411
+ } else if (!this.options.flex) {
412
+ break;
413
+ }
414
+ }
415
+ }
416
+ if (match) {
417
+ token = this.test_match(match, rules[index]);
418
+ if (token !== false) {
419
+ return token;
420
+ }
421
+ return false;
422
+ }
423
+ if (this._input === "") {
424
+ return this.EOF;
425
+ } else {
426
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
427
+ text: "",
428
+ token: null,
429
+ line: this.yylineno
430
+ });
431
+ }
432
+ },
433
+ // return next match that has a token
434
+ lex: function lex() {
435
+ var r = this.next();
436
+ if (r) {
437
+ return r;
438
+ } else {
439
+ return this.lex();
440
+ }
441
+ },
442
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
443
+ begin: function begin(condition) {
444
+ this.conditionStack.push(condition);
445
+ },
446
+ // pop the previously active lexer condition state off the condition stack
447
+ popState: function popState() {
448
+ var n = this.conditionStack.length - 1;
449
+ if (n > 0) {
450
+ return this.conditionStack.pop();
451
+ } else {
452
+ return this.conditionStack[0];
453
+ }
454
+ },
455
+ // produce the lexer rule set which is active for the currently active lexer condition state
456
+ _currentRules: function _currentRules() {
457
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
458
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
459
+ } else {
460
+ return this.conditions["INITIAL"].rules;
461
+ }
462
+ },
463
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
464
+ topState: function topState(n) {
465
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
466
+ if (n >= 0) {
467
+ return this.conditionStack[n];
468
+ } else {
469
+ return "INITIAL";
470
+ }
471
+ },
472
+ // alias for begin(condition)
473
+ pushState: function pushState(condition) {
474
+ this.begin(condition);
475
+ },
476
+ // return the number of states currently on the stack
477
+ stateStackSize: function stateStackSize() {
478
+ return this.conditionStack.length;
479
+ },
480
+ options: { "case-insensitive": true },
481
+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
482
+ switch ($avoiding_name_collisions) {
483
+ case 0:
484
+ break;
485
+ case 1:
486
+ break;
487
+ case 2:
488
+ return 10;
489
+ case 3:
490
+ break;
491
+ case 4:
492
+ break;
493
+ case 5:
494
+ return 4;
495
+ case 6:
496
+ return 11;
497
+ case 7:
498
+ this.begin("acc_title");
499
+ return 12;
500
+ case 8:
501
+ this.popState();
502
+ return "acc_title_value";
503
+ case 9:
504
+ this.begin("acc_descr");
505
+ return 14;
506
+ case 10:
507
+ this.popState();
508
+ return "acc_descr_value";
509
+ case 11:
510
+ this.begin("acc_descr_multiline");
511
+ break;
512
+ case 12:
513
+ this.popState();
514
+ break;
515
+ case 13:
516
+ return "acc_descr_multiline_value";
517
+ case 14:
518
+ return 17;
519
+ case 15:
520
+ return 18;
521
+ case 16:
522
+ return 19;
523
+ case 17:
524
+ return ":";
525
+ case 18:
526
+ return 6;
527
+ case 19:
528
+ return "INVALID";
529
+ }
530
+ },
531
+ rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:journey\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i],
532
+ conditions: { "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19], "inclusive": true } }
533
+ };
534
+ return lexer2;
535
+ })();
536
+ parser2.lexer = lexer;
537
+ function Parser() {
538
+ this.yy = {};
539
+ }
540
+ Parser.prototype = parser2;
541
+ parser2.Parser = Parser;
542
+ return new Parser();
543
+ })();
544
+ parser.parser = parser;
545
+ const parser$1 = parser;
546
+ let currentSection = "";
547
+ const sections = [];
548
+ const tasks = [];
549
+ const rawTasks = [];
550
+ const clear = function() {
551
+ sections.length = 0;
552
+ tasks.length = 0;
553
+ currentSection = "";
554
+ rawTasks.length = 0;
555
+ clear$1();
556
+ };
557
+ const addSection = function(txt) {
558
+ currentSection = txt;
559
+ sections.push(txt);
560
+ };
561
+ const getSections = function() {
562
+ return sections;
563
+ };
564
+ const getTasks = function() {
565
+ let allItemsProcessed = compileTasks();
566
+ const maxDepth = 100;
567
+ let iterationCount = 0;
568
+ while (!allItemsProcessed && iterationCount < maxDepth) {
569
+ allItemsProcessed = compileTasks();
570
+ iterationCount++;
571
+ }
572
+ tasks.push(...rawTasks);
573
+ return tasks;
574
+ };
575
+ const updateActors = function() {
576
+ const tempActors = [];
577
+ tasks.forEach((task) => {
578
+ if (task.people) {
579
+ tempActors.push(...task.people);
580
+ }
581
+ });
582
+ const unique = new Set(tempActors);
583
+ return [...unique].sort();
584
+ };
585
+ const addTask = function(descr, taskData) {
586
+ const pieces = taskData.substr(1).split(":");
587
+ let score = 0;
588
+ let peeps = [];
589
+ if (pieces.length === 1) {
590
+ score = Number(pieces[0]);
591
+ peeps = [];
592
+ } else {
593
+ score = Number(pieces[0]);
594
+ peeps = pieces[1].split(",");
595
+ }
596
+ const peopleList = peeps.map((s) => s.trim());
597
+ const rawTask = {
598
+ section: currentSection,
599
+ type: currentSection,
600
+ people: peopleList,
601
+ task: descr,
602
+ score
603
+ };
604
+ rawTasks.push(rawTask);
605
+ };
606
+ const addTaskOrg = function(descr) {
607
+ const newTask = {
608
+ section: currentSection,
609
+ type: currentSection,
610
+ description: descr,
611
+ task: descr,
612
+ classes: []
613
+ };
614
+ tasks.push(newTask);
615
+ };
616
+ const compileTasks = function() {
617
+ const compileTask = function(pos) {
618
+ return rawTasks[pos].processed;
619
+ };
620
+ let allProcessed = true;
621
+ for (const [i, rawTask] of rawTasks.entries()) {
622
+ compileTask(i);
623
+ allProcessed = allProcessed && rawTask.processed;
624
+ }
625
+ return allProcessed;
626
+ };
627
+ const getActors = function() {
628
+ return updateActors();
629
+ };
630
+ const db = {
631
+ getConfig: () => getConfig().journey,
632
+ clear,
633
+ setDiagramTitle,
634
+ getDiagramTitle,
635
+ setAccTitle,
636
+ getAccTitle,
637
+ setAccDescription,
638
+ getAccDescription,
639
+ addSection,
640
+ getSections,
641
+ getTasks,
642
+ addTask,
643
+ addTaskOrg,
644
+ getActors
645
+ };
646
+ const getStyles = (options) => `.label {
647
+ font-family: 'trebuchet ms', verdana, arial, sans-serif;
648
+ font-family: var(--mermaid-font-family);
649
+ color: ${options.textColor};
650
+ }
651
+ .mouth {
652
+ stroke: #666;
653
+ }
654
+
655
+ line {
656
+ stroke: ${options.textColor}
657
+ }
658
+
659
+ .legend {
660
+ fill: ${options.textColor};
661
+ }
662
+
663
+ .label text {
664
+ fill: #333;
665
+ }
666
+ .label {
667
+ color: ${options.textColor}
668
+ }
669
+
670
+ .face {
671
+ ${options.faceColor ? `fill: ${options.faceColor}` : "fill: #FFF8DC"};
672
+ stroke: #999;
673
+ }
674
+
675
+ .node rect,
676
+ .node circle,
677
+ .node ellipse,
678
+ .node polygon,
679
+ .node path {
680
+ fill: ${options.mainBkg};
681
+ stroke: ${options.nodeBorder};
682
+ stroke-width: 1px;
683
+ }
684
+
685
+ .node .label {
686
+ text-align: center;
687
+ }
688
+ .node.clickable {
689
+ cursor: pointer;
690
+ }
691
+
692
+ .arrowheadPath {
693
+ fill: ${options.arrowheadColor};
694
+ }
695
+
696
+ .edgePath .path {
697
+ stroke: ${options.lineColor};
698
+ stroke-width: 1.5px;
699
+ }
700
+
701
+ .flowchart-link {
702
+ stroke: ${options.lineColor};
703
+ fill: none;
704
+ }
705
+
706
+ .edgeLabel {
707
+ background-color: ${options.edgeLabelBackground};
708
+ rect {
709
+ opacity: 0.5;
710
+ }
711
+ text-align: center;
712
+ }
713
+
714
+ .cluster rect {
715
+ }
716
+
717
+ .cluster text {
718
+ fill: ${options.titleColor};
719
+ }
720
+
721
+ div.mermaidTooltip {
722
+ position: absolute;
723
+ text-align: center;
724
+ max-width: 200px;
725
+ padding: 2px;
726
+ font-family: 'trebuchet ms', verdana, arial, sans-serif;
727
+ font-family: var(--mermaid-font-family);
728
+ font-size: 12px;
729
+ background: ${options.tertiaryColor};
730
+ border: 1px solid ${options.border2};
731
+ border-radius: 2px;
732
+ pointer-events: none;
733
+ z-index: 100;
734
+ }
735
+
736
+ .task-type-0, .section-type-0 {
737
+ ${options.fillType0 ? `fill: ${options.fillType0}` : ""};
738
+ }
739
+ .task-type-1, .section-type-1 {
740
+ ${options.fillType0 ? `fill: ${options.fillType1}` : ""};
741
+ }
742
+ .task-type-2, .section-type-2 {
743
+ ${options.fillType0 ? `fill: ${options.fillType2}` : ""};
744
+ }
745
+ .task-type-3, .section-type-3 {
746
+ ${options.fillType0 ? `fill: ${options.fillType3}` : ""};
747
+ }
748
+ .task-type-4, .section-type-4 {
749
+ ${options.fillType0 ? `fill: ${options.fillType4}` : ""};
750
+ }
751
+ .task-type-5, .section-type-5 {
752
+ ${options.fillType0 ? `fill: ${options.fillType5}` : ""};
753
+ }
754
+ .task-type-6, .section-type-6 {
755
+ ${options.fillType0 ? `fill: ${options.fillType6}` : ""};
756
+ }
757
+ .task-type-7, .section-type-7 {
758
+ ${options.fillType0 ? `fill: ${options.fillType7}` : ""};
759
+ }
760
+
761
+ .actor-0 {
762
+ ${options.actor0 ? `fill: ${options.actor0}` : ""};
763
+ }
764
+ .actor-1 {
765
+ ${options.actor1 ? `fill: ${options.actor1}` : ""};
766
+ }
767
+ .actor-2 {
768
+ ${options.actor2 ? `fill: ${options.actor2}` : ""};
769
+ }
770
+ .actor-3 {
771
+ ${options.actor3 ? `fill: ${options.actor3}` : ""};
772
+ }
773
+ .actor-4 {
774
+ ${options.actor4 ? `fill: ${options.actor4}` : ""};
775
+ }
776
+ .actor-5 {
777
+ ${options.actor5 ? `fill: ${options.actor5}` : ""};
778
+ }
779
+ `;
780
+ const styles = getStyles;
781
+ const drawRect = function(elem, rectData) {
782
+ return drawRect$1(elem, rectData);
783
+ };
784
+ const drawFace = function(element, faceData) {
785
+ const radius = 15;
786
+ const circleElement = element.append("circle").attr("cx", faceData.cx).attr("cy", faceData.cy).attr("class", "face").attr("r", radius).attr("stroke-width", 2).attr("overflow", "visible");
787
+ const face = element.append("g");
788
+ face.append("circle").attr("cx", faceData.cx - radius / 3).attr("cy", faceData.cy - radius / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
789
+ face.append("circle").attr("cx", faceData.cx + radius / 3).attr("cy", faceData.cy - radius / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
790
+ function smile(face2) {
791
+ const arc$1 = arc().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
792
+ face2.append("path").attr("class", "mouth").attr("d", arc$1).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")");
793
+ }
794
+ function sad(face2) {
795
+ const arc$1 = arc().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
796
+ face2.append("path").attr("class", "mouth").attr("d", arc$1).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")");
797
+ }
798
+ function ambivalent(face2) {
799
+ face2.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", faceData.cx - 5).attr("y1", faceData.cy + 7).attr("x2", faceData.cx + 5).attr("y2", faceData.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
800
+ }
801
+ if (faceData.score > 3) {
802
+ smile(face);
803
+ } else if (faceData.score < 3) {
804
+ sad(face);
805
+ } else {
806
+ ambivalent(face);
807
+ }
808
+ return circleElement;
809
+ };
810
+ const drawCircle = function(element, circleData) {
811
+ const circleElement = element.append("circle");
812
+ circleElement.attr("cx", circleData.cx);
813
+ circleElement.attr("cy", circleData.cy);
814
+ circleElement.attr("class", "actor-" + circleData.pos);
815
+ circleElement.attr("fill", circleData.fill);
816
+ circleElement.attr("stroke", circleData.stroke);
817
+ circleElement.attr("r", circleData.r);
818
+ if (circleElement.class !== void 0) {
819
+ circleElement.attr("class", circleElement.class);
820
+ }
821
+ if (circleData.title !== void 0) {
822
+ circleElement.append("title").text(circleData.title);
823
+ }
824
+ return circleElement;
825
+ };
826
+ const drawText = function(elem, textData) {
827
+ return drawText$1(elem, textData);
828
+ };
829
+ const drawLabel = function(elem, txtObject) {
830
+ function genPoints(x, y, width, height, cut) {
831
+ return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
832
+ }
833
+ const polygon = elem.append("polygon");
834
+ polygon.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7));
835
+ polygon.attr("class", "labelBox");
836
+ txtObject.y = txtObject.y + txtObject.labelMargin;
837
+ txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
838
+ drawText(elem, txtObject);
839
+ };
840
+ const drawSection = function(elem, section, conf2) {
841
+ const g = elem.append("g");
842
+ const rect = getNoteRect();
843
+ rect.x = section.x;
844
+ rect.y = section.y;
845
+ rect.fill = section.fill;
846
+ rect.width = conf2.width * section.taskCount + // width of the tasks
847
+ conf2.diagramMarginX * (section.taskCount - 1);
848
+ rect.height = conf2.height;
849
+ rect.class = "journey-section section-type-" + section.num;
850
+ rect.rx = 3;
851
+ rect.ry = 3;
852
+ drawRect(g, rect);
853
+ _drawTextCandidateFunc(conf2)(
854
+ section.text,
855
+ g,
856
+ rect.x,
857
+ rect.y,
858
+ rect.width,
859
+ rect.height,
860
+ { class: "journey-section section-type-" + section.num },
861
+ conf2,
862
+ section.colour
863
+ );
864
+ };
865
+ let taskCount = -1;
866
+ const drawTask = function(elem, task, conf2) {
867
+ const center = task.x + conf2.width / 2;
868
+ const g = elem.append("g");
869
+ taskCount++;
870
+ const maxHeight = 300 + 5 * 30;
871
+ g.append("line").attr("id", "task" + taskCount).attr("x1", center).attr("y1", task.y).attr("x2", center).attr("y2", maxHeight).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666");
872
+ drawFace(g, {
873
+ cx: center,
874
+ cy: 300 + (5 - task.score) * 30,
875
+ score: task.score
876
+ });
877
+ const rect = getNoteRect();
878
+ rect.x = task.x;
879
+ rect.y = task.y;
880
+ rect.fill = task.fill;
881
+ rect.width = conf2.width;
882
+ rect.height = conf2.height;
883
+ rect.class = "task task-type-" + task.num;
884
+ rect.rx = 3;
885
+ rect.ry = 3;
886
+ drawRect(g, rect);
887
+ let xPos = task.x + 14;
888
+ task.people.forEach((person) => {
889
+ const colour = task.actors[person].color;
890
+ const circle = {
891
+ cx: xPos,
892
+ cy: task.y,
893
+ r: 7,
894
+ fill: colour,
895
+ stroke: "#000",
896
+ title: person,
897
+ pos: task.actors[person].position
898
+ };
899
+ drawCircle(g, circle);
900
+ xPos += 10;
901
+ });
902
+ _drawTextCandidateFunc(conf2)(
903
+ task.task,
904
+ g,
905
+ rect.x,
906
+ rect.y,
907
+ rect.width,
908
+ rect.height,
909
+ { class: "task" },
910
+ conf2,
911
+ task.colour
912
+ );
913
+ };
914
+ const drawBackgroundRect = function(elem, bounds2) {
915
+ drawBackgroundRect$1(elem, bounds2);
916
+ };
917
+ const _drawTextCandidateFunc = /* @__PURE__ */ (function() {
918
+ function byText(content, g, x, y, width, height, textAttrs, colour) {
919
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("font-color", colour).style("text-anchor", "middle").text(content);
920
+ _setTextAttrs(text, textAttrs);
921
+ }
922
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2, colour) {
923
+ const { taskFontSize, taskFontFamily } = conf2;
924
+ const lines = content.split(/<br\s*\/?>/gi);
925
+ for (let i = 0; i < lines.length; i++) {
926
+ const dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2;
927
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y).attr("fill", colour).style("text-anchor", "middle").style("font-size", taskFontSize).style("font-family", taskFontFamily);
928
+ text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]);
929
+ text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
930
+ _setTextAttrs(text, textAttrs);
931
+ }
932
+ }
933
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
934
+ const body = g.append("switch");
935
+ const f = body.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("position", "fixed");
936
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
937
+ text.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
938
+ byTspan(content, body, x, y, width, height, textAttrs, conf2);
939
+ _setTextAttrs(text, textAttrs);
940
+ }
941
+ function _setTextAttrs(toText, fromTextAttrsDict) {
942
+ for (const key in fromTextAttrsDict) {
943
+ if (key in fromTextAttrsDict) {
944
+ toText.attr(key, fromTextAttrsDict[key]);
945
+ }
946
+ }
947
+ }
948
+ return function(conf2) {
949
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
950
+ };
951
+ })();
952
+ const initGraphics = function(graphics) {
953
+ graphics.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
954
+ };
955
+ const svgDraw = {
956
+ drawRect,
957
+ drawCircle,
958
+ drawSection,
959
+ drawText,
960
+ drawLabel,
961
+ drawTask,
962
+ drawBackgroundRect,
963
+ initGraphics
964
+ };
965
+ const setConf = function(cnf) {
966
+ const keys = Object.keys(cnf);
967
+ keys.forEach(function(key) {
968
+ conf[key] = cnf[key];
969
+ });
970
+ };
971
+ const actors = {};
972
+ function drawActorLegend(diagram2) {
973
+ const conf2 = getConfig().journey;
974
+ let yPos = 60;
975
+ Object.keys(actors).forEach((person) => {
976
+ const colour = actors[person].color;
977
+ const circleData = {
978
+ cx: 20,
979
+ cy: yPos,
980
+ r: 7,
981
+ fill: colour,
982
+ stroke: "#000",
983
+ pos: actors[person].position
984
+ };
985
+ svgDraw.drawCircle(diagram2, circleData);
986
+ const labelData = {
987
+ x: 40,
988
+ y: yPos + 7,
989
+ fill: "#666",
990
+ text: person,
991
+ textMargin: conf2.boxTextMargin | 5
992
+ };
993
+ svgDraw.drawText(diagram2, labelData);
994
+ yPos += 20;
995
+ });
996
+ }
997
+ const conf = getConfig().journey;
998
+ const LEFT_MARGIN = conf.leftMargin;
999
+ const draw = function(text, id, version, diagObj) {
1000
+ const conf2 = getConfig().journey;
1001
+ const securityLevel = getConfig().securityLevel;
1002
+ let sandboxElement;
1003
+ if (securityLevel === "sandbox") {
1004
+ sandboxElement = select("#i" + id);
1005
+ }
1006
+ const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
1007
+ bounds.init();
1008
+ const diagram2 = root.select("#" + id);
1009
+ svgDraw.initGraphics(diagram2);
1010
+ const tasks2 = diagObj.db.getTasks();
1011
+ const title = diagObj.db.getDiagramTitle();
1012
+ const actorNames = diagObj.db.getActors();
1013
+ for (const member in actors) {
1014
+ delete actors[member];
1015
+ }
1016
+ let actorPos = 0;
1017
+ actorNames.forEach((actorName) => {
1018
+ actors[actorName] = {
1019
+ color: conf2.actorColours[actorPos % conf2.actorColours.length],
1020
+ position: actorPos
1021
+ };
1022
+ actorPos++;
1023
+ });
1024
+ drawActorLegend(diagram2);
1025
+ bounds.insert(0, 0, LEFT_MARGIN, Object.keys(actors).length * 50);
1026
+ drawTasks(diagram2, tasks2, 0);
1027
+ const box = bounds.getBounds();
1028
+ if (title) {
1029
+ diagram2.append("text").text(title).attr("x", LEFT_MARGIN).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 25);
1030
+ }
1031
+ const height = box.stopy - box.starty + 2 * conf2.diagramMarginY;
1032
+ const width = LEFT_MARGIN + box.stopx + 2 * conf2.diagramMarginX;
1033
+ configureSvgSize(diagram2, height, width, conf2.useMaxWidth);
1034
+ diagram2.append("line").attr("x1", LEFT_MARGIN).attr("y1", conf2.height * 4).attr("x2", width - LEFT_MARGIN - 4).attr("y2", conf2.height * 4).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)");
1035
+ const extraVertForTitle = title ? 70 : 0;
1036
+ diagram2.attr("viewBox", `${box.startx} -25 ${width} ${height + extraVertForTitle}`);
1037
+ diagram2.attr("preserveAspectRatio", "xMinYMin meet");
1038
+ diagram2.attr("height", height + extraVertForTitle + 25);
1039
+ };
1040
+ const bounds = {
1041
+ data: {
1042
+ startx: void 0,
1043
+ stopx: void 0,
1044
+ starty: void 0,
1045
+ stopy: void 0
1046
+ },
1047
+ verticalPos: 0,
1048
+ sequenceItems: [],
1049
+ init: function() {
1050
+ this.sequenceItems = [];
1051
+ this.data = {
1052
+ startx: void 0,
1053
+ stopx: void 0,
1054
+ starty: void 0,
1055
+ stopy: void 0
1056
+ };
1057
+ this.verticalPos = 0;
1058
+ },
1059
+ updateVal: function(obj, key, val, fun) {
1060
+ if (obj[key] === void 0) {
1061
+ obj[key] = val;
1062
+ } else {
1063
+ obj[key] = fun(val, obj[key]);
1064
+ }
1065
+ },
1066
+ updateBounds: function(startx, starty, stopx, stopy) {
1067
+ const conf2 = getConfig().journey;
1068
+ const _self = this;
1069
+ let cnt = 0;
1070
+ function updateFn(type) {
1071
+ return function updateItemBounds(item) {
1072
+ cnt++;
1073
+ const n = _self.sequenceItems.length - cnt + 1;
1074
+ _self.updateVal(item, "starty", starty - n * conf2.boxMargin, Math.min);
1075
+ _self.updateVal(item, "stopy", stopy + n * conf2.boxMargin, Math.max);
1076
+ _self.updateVal(bounds.data, "startx", startx - n * conf2.boxMargin, Math.min);
1077
+ _self.updateVal(bounds.data, "stopx", stopx + n * conf2.boxMargin, Math.max);
1078
+ {
1079
+ _self.updateVal(item, "startx", startx - n * conf2.boxMargin, Math.min);
1080
+ _self.updateVal(item, "stopx", stopx + n * conf2.boxMargin, Math.max);
1081
+ _self.updateVal(bounds.data, "starty", starty - n * conf2.boxMargin, Math.min);
1082
+ _self.updateVal(bounds.data, "stopy", stopy + n * conf2.boxMargin, Math.max);
1083
+ }
1084
+ };
1085
+ }
1086
+ this.sequenceItems.forEach(updateFn());
1087
+ },
1088
+ insert: function(startx, starty, stopx, stopy) {
1089
+ const _startx = Math.min(startx, stopx);
1090
+ const _stopx = Math.max(startx, stopx);
1091
+ const _starty = Math.min(starty, stopy);
1092
+ const _stopy = Math.max(starty, stopy);
1093
+ this.updateVal(bounds.data, "startx", _startx, Math.min);
1094
+ this.updateVal(bounds.data, "starty", _starty, Math.min);
1095
+ this.updateVal(bounds.data, "stopx", _stopx, Math.max);
1096
+ this.updateVal(bounds.data, "stopy", _stopy, Math.max);
1097
+ this.updateBounds(_startx, _starty, _stopx, _stopy);
1098
+ },
1099
+ bumpVerticalPos: function(bump) {
1100
+ this.verticalPos = this.verticalPos + bump;
1101
+ this.data.stopy = this.verticalPos;
1102
+ },
1103
+ getVerticalPos: function() {
1104
+ return this.verticalPos;
1105
+ },
1106
+ getBounds: function() {
1107
+ return this.data;
1108
+ }
1109
+ };
1110
+ const fills = conf.sectionFills;
1111
+ const textColours = conf.sectionColours;
1112
+ const drawTasks = function(diagram2, tasks2, verticalPos) {
1113
+ const conf2 = getConfig().journey;
1114
+ let lastSection = "";
1115
+ const sectionVHeight = conf2.height * 2 + conf2.diagramMarginY;
1116
+ const taskPos = verticalPos + sectionVHeight;
1117
+ let sectionNumber = 0;
1118
+ let fill = "#CCC";
1119
+ let colour = "black";
1120
+ let num = 0;
1121
+ for (const [i, task] of tasks2.entries()) {
1122
+ if (lastSection !== task.section) {
1123
+ fill = fills[sectionNumber % fills.length];
1124
+ num = sectionNumber % fills.length;
1125
+ colour = textColours[sectionNumber % textColours.length];
1126
+ let taskInSectionCount = 0;
1127
+ const currentSection2 = task.section;
1128
+ for (let taskIndex = i; taskIndex < tasks2.length; taskIndex++) {
1129
+ if (tasks2[taskIndex].section == currentSection2) {
1130
+ taskInSectionCount = taskInSectionCount + 1;
1131
+ } else {
1132
+ break;
1133
+ }
1134
+ }
1135
+ const section = {
1136
+ x: i * conf2.taskMargin + i * conf2.width + LEFT_MARGIN,
1137
+ y: 50,
1138
+ text: task.section,
1139
+ fill,
1140
+ num,
1141
+ colour,
1142
+ taskCount: taskInSectionCount
1143
+ };
1144
+ svgDraw.drawSection(diagram2, section, conf2);
1145
+ lastSection = task.section;
1146
+ sectionNumber++;
1147
+ }
1148
+ const taskActors = task.people.reduce((acc, actorName) => {
1149
+ if (actors[actorName]) {
1150
+ acc[actorName] = actors[actorName];
1151
+ }
1152
+ return acc;
1153
+ }, {});
1154
+ task.x = i * conf2.taskMargin + i * conf2.width + LEFT_MARGIN;
1155
+ task.y = taskPos;
1156
+ task.width = conf2.diagramMarginX;
1157
+ task.height = conf2.diagramMarginY;
1158
+ task.colour = colour;
1159
+ task.fill = fill;
1160
+ task.num = num;
1161
+ task.actors = taskActors;
1162
+ svgDraw.drawTask(diagram2, task, conf2);
1163
+ bounds.insert(task.x, task.y, task.x + task.width + conf2.taskMargin, 300 + 5 * 30);
1164
+ }
1165
+ };
1166
+ const renderer = {
1167
+ setConf,
1168
+ draw
1169
+ };
1170
+ const diagram = {
1171
+ parser: parser$1,
1172
+ db,
1173
+ renderer,
1174
+ styles,
1175
+ init: (cnf) => {
1176
+ renderer.setConf(cnf.journey);
1177
+ db.clear();
1178
+ }
1179
+ };
1180
+ export {
1181
+ diagram
1182
+ };