@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,1210 @@
1
+ import { a3 as isDark, a4 as lighten, a5 as darken, g as getConfig, l as log$1, d as select, _ as setupGraphViewbox$1, a6 as commonDb, r as clear$1 } from "./index-CLOU2Ikr.js";
2
+ import { a as arc } from "./arc-D1qX5GFf.js";
3
+ var parser = (function() {
4
+ var o = function(k, v, o2, l) {
5
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
6
+ ;
7
+ return o2;
8
+ }, $V0 = [6, 8, 10, 11, 12, 14, 16, 17, 20, 21], $V1 = [1, 9], $V2 = [1, 10], $V3 = [1, 11], $V4 = [1, 12], $V5 = [1, 13], $V6 = [1, 16], $V7 = [1, 17];
9
+ var parser2 = {
10
+ trace: function trace() {
11
+ },
12
+ yy: {},
13
+ symbols_: { "error": 2, "start": 3, "timeline": 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, "period_statement": 18, "event_statement": 19, "period": 20, "event": 21, "$accept": 0, "$end": 1 },
14
+ terminals_: { 2: "error", 4: "timeline", 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", 20: "period", 21: "event" },
15
+ 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, 1], [9, 1], [18, 1], [19, 1]],
16
+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
17
+ var $0 = $$.length - 1;
18
+ switch (yystate) {
19
+ case 1:
20
+ return $$[$0 - 1];
21
+ case 2:
22
+ this.$ = [];
23
+ break;
24
+ case 3:
25
+ $$[$0 - 1].push($$[$0]);
26
+ this.$ = $$[$0 - 1];
27
+ break;
28
+ case 4:
29
+ case 5:
30
+ this.$ = $$[$0];
31
+ break;
32
+ case 6:
33
+ case 7:
34
+ this.$ = [];
35
+ break;
36
+ case 8:
37
+ yy.getCommonDb().setDiagramTitle($$[$0].substr(6));
38
+ this.$ = $$[$0].substr(6);
39
+ break;
40
+ case 9:
41
+ this.$ = $$[$0].trim();
42
+ yy.getCommonDb().setAccTitle(this.$);
43
+ break;
44
+ case 10:
45
+ case 11:
46
+ this.$ = $$[$0].trim();
47
+ yy.getCommonDb().setAccDescription(this.$);
48
+ break;
49
+ case 12:
50
+ yy.addSection($$[$0].substr(8));
51
+ this.$ = $$[$0].substr(8);
52
+ break;
53
+ case 15:
54
+ yy.addTask($$[$0], 0, "");
55
+ this.$ = $$[$0];
56
+ break;
57
+ case 16:
58
+ yy.addEvent($$[$0].substr(2));
59
+ this.$ = $$[$0];
60
+ break;
61
+ }
62
+ },
63
+ 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: 14, 19: 15, 20: $V6, 21: $V7 }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 18, 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: 14, 19: 15, 20: $V6, 21: $V7 }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 8]), { 13: [1, 19] }, { 15: [1, 20] }, o($V0, [2, 11]), o($V0, [2, 12]), o($V0, [2, 13]), o($V0, [2, 14]), o($V0, [2, 15]), o($V0, [2, 16]), o($V0, [2, 4]), o($V0, [2, 9]), o($V0, [2, 10])],
64
+ defaultActions: {},
65
+ parseError: function parseError(str, hash) {
66
+ if (hash.recoverable) {
67
+ this.trace(str);
68
+ } else {
69
+ var error = new Error(str);
70
+ error.hash = hash;
71
+ throw error;
72
+ }
73
+ },
74
+ parse: function parse(input) {
75
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
76
+ var args = lstack.slice.call(arguments, 1);
77
+ var lexer2 = Object.create(this.lexer);
78
+ var sharedState = { yy: {} };
79
+ for (var k in this.yy) {
80
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
81
+ sharedState.yy[k] = this.yy[k];
82
+ }
83
+ }
84
+ lexer2.setInput(input, sharedState.yy);
85
+ sharedState.yy.lexer = lexer2;
86
+ sharedState.yy.parser = this;
87
+ if (typeof lexer2.yylloc == "undefined") {
88
+ lexer2.yylloc = {};
89
+ }
90
+ var yyloc = lexer2.yylloc;
91
+ lstack.push(yyloc);
92
+ var ranges = lexer2.options && lexer2.options.ranges;
93
+ if (typeof sharedState.yy.parseError === "function") {
94
+ this.parseError = sharedState.yy.parseError;
95
+ } else {
96
+ this.parseError = Object.getPrototypeOf(this).parseError;
97
+ }
98
+ function lex() {
99
+ var token;
100
+ token = tstack.pop() || lexer2.lex() || EOF;
101
+ if (typeof token !== "number") {
102
+ if (token instanceof Array) {
103
+ tstack = token;
104
+ token = tstack.pop();
105
+ }
106
+ token = self.symbols_[token] || token;
107
+ }
108
+ return token;
109
+ }
110
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
111
+ while (true) {
112
+ state = stack[stack.length - 1];
113
+ if (this.defaultActions[state]) {
114
+ action = this.defaultActions[state];
115
+ } else {
116
+ if (symbol === null || typeof symbol == "undefined") {
117
+ symbol = lex();
118
+ }
119
+ action = table[state] && table[state][symbol];
120
+ }
121
+ if (typeof action === "undefined" || !action.length || !action[0]) {
122
+ var errStr = "";
123
+ expected = [];
124
+ for (p in table[state]) {
125
+ if (this.terminals_[p] && p > TERROR) {
126
+ expected.push("'" + this.terminals_[p] + "'");
127
+ }
128
+ }
129
+ if (lexer2.showPosition) {
130
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
131
+ } else {
132
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
133
+ }
134
+ this.parseError(errStr, {
135
+ text: lexer2.match,
136
+ token: this.terminals_[symbol] || symbol,
137
+ line: lexer2.yylineno,
138
+ loc: yyloc,
139
+ expected
140
+ });
141
+ }
142
+ if (action[0] instanceof Array && action.length > 1) {
143
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
144
+ }
145
+ switch (action[0]) {
146
+ case 1:
147
+ stack.push(symbol);
148
+ vstack.push(lexer2.yytext);
149
+ lstack.push(lexer2.yylloc);
150
+ stack.push(action[1]);
151
+ symbol = null;
152
+ {
153
+ yyleng = lexer2.yyleng;
154
+ yytext = lexer2.yytext;
155
+ yylineno = lexer2.yylineno;
156
+ yyloc = lexer2.yylloc;
157
+ }
158
+ break;
159
+ case 2:
160
+ len = this.productions_[action[1]][1];
161
+ yyval.$ = vstack[vstack.length - len];
162
+ yyval._$ = {
163
+ first_line: lstack[lstack.length - (len || 1)].first_line,
164
+ last_line: lstack[lstack.length - 1].last_line,
165
+ first_column: lstack[lstack.length - (len || 1)].first_column,
166
+ last_column: lstack[lstack.length - 1].last_column
167
+ };
168
+ if (ranges) {
169
+ yyval._$.range = [
170
+ lstack[lstack.length - (len || 1)].range[0],
171
+ lstack[lstack.length - 1].range[1]
172
+ ];
173
+ }
174
+ r = this.performAction.apply(yyval, [
175
+ yytext,
176
+ yyleng,
177
+ yylineno,
178
+ sharedState.yy,
179
+ action[1],
180
+ vstack,
181
+ lstack
182
+ ].concat(args));
183
+ if (typeof r !== "undefined") {
184
+ return r;
185
+ }
186
+ if (len) {
187
+ stack = stack.slice(0, -1 * len * 2);
188
+ vstack = vstack.slice(0, -1 * len);
189
+ lstack = lstack.slice(0, -1 * len);
190
+ }
191
+ stack.push(this.productions_[action[1]][0]);
192
+ vstack.push(yyval.$);
193
+ lstack.push(yyval._$);
194
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
195
+ stack.push(newState);
196
+ break;
197
+ case 3:
198
+ return true;
199
+ }
200
+ }
201
+ return true;
202
+ }
203
+ };
204
+ var lexer = /* @__PURE__ */ (function() {
205
+ var lexer2 = {
206
+ EOF: 1,
207
+ parseError: function parseError(str, hash) {
208
+ if (this.yy.parser) {
209
+ this.yy.parser.parseError(str, hash);
210
+ } else {
211
+ throw new Error(str);
212
+ }
213
+ },
214
+ // resets the lexer, sets new input
215
+ setInput: function(input, yy) {
216
+ this.yy = yy || this.yy || {};
217
+ this._input = input;
218
+ this._more = this._backtrack = this.done = false;
219
+ this.yylineno = this.yyleng = 0;
220
+ this.yytext = this.matched = this.match = "";
221
+ this.conditionStack = ["INITIAL"];
222
+ this.yylloc = {
223
+ first_line: 1,
224
+ first_column: 0,
225
+ last_line: 1,
226
+ last_column: 0
227
+ };
228
+ if (this.options.ranges) {
229
+ this.yylloc.range = [0, 0];
230
+ }
231
+ this.offset = 0;
232
+ return this;
233
+ },
234
+ // consumes and returns one char from the input
235
+ input: function() {
236
+ var ch = this._input[0];
237
+ this.yytext += ch;
238
+ this.yyleng++;
239
+ this.offset++;
240
+ this.match += ch;
241
+ this.matched += ch;
242
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
243
+ if (lines) {
244
+ this.yylineno++;
245
+ this.yylloc.last_line++;
246
+ } else {
247
+ this.yylloc.last_column++;
248
+ }
249
+ if (this.options.ranges) {
250
+ this.yylloc.range[1]++;
251
+ }
252
+ this._input = this._input.slice(1);
253
+ return ch;
254
+ },
255
+ // unshifts one char (or a string) into the input
256
+ unput: function(ch) {
257
+ var len = ch.length;
258
+ var lines = ch.split(/(?:\r\n?|\n)/g);
259
+ this._input = ch + this._input;
260
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
261
+ this.offset -= len;
262
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
263
+ this.match = this.match.substr(0, this.match.length - 1);
264
+ this.matched = this.matched.substr(0, this.matched.length - 1);
265
+ if (lines.length - 1) {
266
+ this.yylineno -= lines.length - 1;
267
+ }
268
+ var r = this.yylloc.range;
269
+ this.yylloc = {
270
+ first_line: this.yylloc.first_line,
271
+ last_line: this.yylineno + 1,
272
+ first_column: this.yylloc.first_column,
273
+ 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
274
+ };
275
+ if (this.options.ranges) {
276
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
277
+ }
278
+ this.yyleng = this.yytext.length;
279
+ return this;
280
+ },
281
+ // When called from action, caches matched text and appends it on next action
282
+ more: function() {
283
+ this._more = true;
284
+ return this;
285
+ },
286
+ // 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.
287
+ reject: function() {
288
+ if (this.options.backtrack_lexer) {
289
+ this._backtrack = true;
290
+ } else {
291
+ 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(), {
292
+ text: "",
293
+ token: null,
294
+ line: this.yylineno
295
+ });
296
+ }
297
+ return this;
298
+ },
299
+ // retain first n characters of the match
300
+ less: function(n) {
301
+ this.unput(this.match.slice(n));
302
+ },
303
+ // displays already matched input, i.e. for error messages
304
+ pastInput: function() {
305
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
306
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
307
+ },
308
+ // displays upcoming input, i.e. for error messages
309
+ upcomingInput: function() {
310
+ var next = this.match;
311
+ if (next.length < 20) {
312
+ next += this._input.substr(0, 20 - next.length);
313
+ }
314
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
315
+ },
316
+ // displays the character position where the lexing error occurred, i.e. for error messages
317
+ showPosition: function() {
318
+ var pre = this.pastInput();
319
+ var c = new Array(pre.length + 1).join("-");
320
+ return pre + this.upcomingInput() + "\n" + c + "^";
321
+ },
322
+ // test the lexed token: return FALSE when not a match, otherwise return token
323
+ test_match: function(match, indexed_rule) {
324
+ var token, lines, backup;
325
+ if (this.options.backtrack_lexer) {
326
+ backup = {
327
+ yylineno: this.yylineno,
328
+ yylloc: {
329
+ first_line: this.yylloc.first_line,
330
+ last_line: this.last_line,
331
+ first_column: this.yylloc.first_column,
332
+ last_column: this.yylloc.last_column
333
+ },
334
+ yytext: this.yytext,
335
+ match: this.match,
336
+ matches: this.matches,
337
+ matched: this.matched,
338
+ yyleng: this.yyleng,
339
+ offset: this.offset,
340
+ _more: this._more,
341
+ _input: this._input,
342
+ yy: this.yy,
343
+ conditionStack: this.conditionStack.slice(0),
344
+ done: this.done
345
+ };
346
+ if (this.options.ranges) {
347
+ backup.yylloc.range = this.yylloc.range.slice(0);
348
+ }
349
+ }
350
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
351
+ if (lines) {
352
+ this.yylineno += lines.length;
353
+ }
354
+ this.yylloc = {
355
+ first_line: this.yylloc.last_line,
356
+ last_line: this.yylineno + 1,
357
+ first_column: this.yylloc.last_column,
358
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
359
+ };
360
+ this.yytext += match[0];
361
+ this.match += match[0];
362
+ this.matches = match;
363
+ this.yyleng = this.yytext.length;
364
+ if (this.options.ranges) {
365
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
366
+ }
367
+ this._more = false;
368
+ this._backtrack = false;
369
+ this._input = this._input.slice(match[0].length);
370
+ this.matched += match[0];
371
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
372
+ if (this.done && this._input) {
373
+ this.done = false;
374
+ }
375
+ if (token) {
376
+ return token;
377
+ } else if (this._backtrack) {
378
+ for (var k in backup) {
379
+ this[k] = backup[k];
380
+ }
381
+ return false;
382
+ }
383
+ return false;
384
+ },
385
+ // return next match in input
386
+ next: function() {
387
+ if (this.done) {
388
+ return this.EOF;
389
+ }
390
+ if (!this._input) {
391
+ this.done = true;
392
+ }
393
+ var token, match, tempMatch, index;
394
+ if (!this._more) {
395
+ this.yytext = "";
396
+ this.match = "";
397
+ }
398
+ var rules = this._currentRules();
399
+ for (var i = 0; i < rules.length; i++) {
400
+ tempMatch = this._input.match(this.rules[rules[i]]);
401
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
402
+ match = tempMatch;
403
+ index = i;
404
+ if (this.options.backtrack_lexer) {
405
+ token = this.test_match(tempMatch, rules[i]);
406
+ if (token !== false) {
407
+ return token;
408
+ } else if (this._backtrack) {
409
+ match = false;
410
+ continue;
411
+ } else {
412
+ return false;
413
+ }
414
+ } else if (!this.options.flex) {
415
+ break;
416
+ }
417
+ }
418
+ }
419
+ if (match) {
420
+ token = this.test_match(match, rules[index]);
421
+ if (token !== false) {
422
+ return token;
423
+ }
424
+ return false;
425
+ }
426
+ if (this._input === "") {
427
+ return this.EOF;
428
+ } else {
429
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
430
+ text: "",
431
+ token: null,
432
+ line: this.yylineno
433
+ });
434
+ }
435
+ },
436
+ // return next match that has a token
437
+ lex: function lex() {
438
+ var r = this.next();
439
+ if (r) {
440
+ return r;
441
+ } else {
442
+ return this.lex();
443
+ }
444
+ },
445
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
446
+ begin: function begin(condition) {
447
+ this.conditionStack.push(condition);
448
+ },
449
+ // pop the previously active lexer condition state off the condition stack
450
+ popState: function popState() {
451
+ var n = this.conditionStack.length - 1;
452
+ if (n > 0) {
453
+ return this.conditionStack.pop();
454
+ } else {
455
+ return this.conditionStack[0];
456
+ }
457
+ },
458
+ // produce the lexer rule set which is active for the currently active lexer condition state
459
+ _currentRules: function _currentRules() {
460
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
461
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
462
+ } else {
463
+ return this.conditions["INITIAL"].rules;
464
+ }
465
+ },
466
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
467
+ topState: function topState(n) {
468
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
469
+ if (n >= 0) {
470
+ return this.conditionStack[n];
471
+ } else {
472
+ return "INITIAL";
473
+ }
474
+ },
475
+ // alias for begin(condition)
476
+ pushState: function pushState(condition) {
477
+ this.begin(condition);
478
+ },
479
+ // return the number of states currently on the stack
480
+ stateStackSize: function stateStackSize() {
481
+ return this.conditionStack.length;
482
+ },
483
+ options: { "case-insensitive": true },
484
+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
485
+ switch ($avoiding_name_collisions) {
486
+ case 0:
487
+ break;
488
+ case 1:
489
+ break;
490
+ case 2:
491
+ return 10;
492
+ case 3:
493
+ break;
494
+ case 4:
495
+ break;
496
+ case 5:
497
+ return 4;
498
+ case 6:
499
+ return 11;
500
+ case 7:
501
+ this.begin("acc_title");
502
+ return 12;
503
+ case 8:
504
+ this.popState();
505
+ return "acc_title_value";
506
+ case 9:
507
+ this.begin("acc_descr");
508
+ return 14;
509
+ case 10:
510
+ this.popState();
511
+ return "acc_descr_value";
512
+ case 11:
513
+ this.begin("acc_descr_multiline");
514
+ break;
515
+ case 12:
516
+ this.popState();
517
+ break;
518
+ case 13:
519
+ return "acc_descr_multiline_value";
520
+ case 14:
521
+ return 17;
522
+ case 15:
523
+ return 21;
524
+ case 16:
525
+ return 20;
526
+ case 17:
527
+ return 6;
528
+ case 18:
529
+ return "INVALID";
530
+ }
531
+ },
532
+ rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:timeline\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, /^(?::\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?:$)/i, /^(?:.)/i],
533
+ 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], "inclusive": true } }
534
+ };
535
+ return lexer2;
536
+ })();
537
+ parser2.lexer = lexer;
538
+ function Parser() {
539
+ this.yy = {};
540
+ }
541
+ Parser.prototype = parser2;
542
+ parser2.Parser = Parser;
543
+ return new Parser();
544
+ })();
545
+ parser.parser = parser;
546
+ const parser$1 = parser;
547
+ let currentSection = "";
548
+ let currentTaskId = 0;
549
+ const sections = [];
550
+ const tasks = [];
551
+ const rawTasks = [];
552
+ const getCommonDb = () => commonDb;
553
+ const clear = function() {
554
+ sections.length = 0;
555
+ tasks.length = 0;
556
+ currentSection = "";
557
+ rawTasks.length = 0;
558
+ clear$1();
559
+ };
560
+ const addSection = function(txt) {
561
+ currentSection = txt;
562
+ sections.push(txt);
563
+ };
564
+ const getSections = function() {
565
+ return sections;
566
+ };
567
+ const getTasks = function() {
568
+ let allItemsProcessed = compileTasks();
569
+ const maxDepth = 100;
570
+ let iterationCount = 0;
571
+ while (!allItemsProcessed && iterationCount < maxDepth) {
572
+ allItemsProcessed = compileTasks();
573
+ iterationCount++;
574
+ }
575
+ tasks.push(...rawTasks);
576
+ return tasks;
577
+ };
578
+ const addTask = function(period, length, event) {
579
+ const rawTask = {
580
+ id: currentTaskId++,
581
+ section: currentSection,
582
+ type: currentSection,
583
+ task: period,
584
+ score: length ? length : 0,
585
+ //if event is defined, then add it the events array
586
+ events: event ? [event] : []
587
+ };
588
+ rawTasks.push(rawTask);
589
+ };
590
+ const addEvent = function(event) {
591
+ const currentTask = rawTasks.find((task) => task.id === currentTaskId - 1);
592
+ currentTask.events.push(event);
593
+ };
594
+ const addTaskOrg = function(descr) {
595
+ const newTask = {
596
+ section: currentSection,
597
+ type: currentSection,
598
+ description: descr,
599
+ task: descr,
600
+ classes: []
601
+ };
602
+ tasks.push(newTask);
603
+ };
604
+ const compileTasks = function() {
605
+ const compileTask = function(pos) {
606
+ return rawTasks[pos].processed;
607
+ };
608
+ let allProcessed = true;
609
+ for (const [i, rawTask] of rawTasks.entries()) {
610
+ compileTask(i);
611
+ allProcessed = allProcessed && rawTask.processed;
612
+ }
613
+ return allProcessed;
614
+ };
615
+ const timelineDb = {
616
+ clear,
617
+ getCommonDb,
618
+ addSection,
619
+ getSections,
620
+ getTasks,
621
+ addTask,
622
+ addTaskOrg,
623
+ addEvent
624
+ };
625
+ const db = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
626
+ __proto__: null,
627
+ addEvent,
628
+ addSection,
629
+ addTask,
630
+ addTaskOrg,
631
+ clear,
632
+ default: timelineDb,
633
+ getCommonDb,
634
+ getSections,
635
+ getTasks
636
+ }, Symbol.toStringTag, { value: "Module" }));
637
+ const MAX_SECTIONS = 12;
638
+ const drawRect = function(elem, rectData) {
639
+ const rectElem = elem.append("rect");
640
+ rectElem.attr("x", rectData.x);
641
+ rectElem.attr("y", rectData.y);
642
+ rectElem.attr("fill", rectData.fill);
643
+ rectElem.attr("stroke", rectData.stroke);
644
+ rectElem.attr("width", rectData.width);
645
+ rectElem.attr("height", rectData.height);
646
+ rectElem.attr("rx", rectData.rx);
647
+ rectElem.attr("ry", rectData.ry);
648
+ if (rectData.class !== void 0) {
649
+ rectElem.attr("class", rectData.class);
650
+ }
651
+ return rectElem;
652
+ };
653
+ const drawFace = function(element, faceData) {
654
+ const radius = 15;
655
+ 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");
656
+ const face = element.append("g");
657
+ 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");
658
+ 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");
659
+ function smile(face2) {
660
+ const arc$1 = arc().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
661
+ face2.append("path").attr("class", "mouth").attr("d", arc$1).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")");
662
+ }
663
+ function sad(face2) {
664
+ const arc$1 = arc().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
665
+ face2.append("path").attr("class", "mouth").attr("d", arc$1).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")");
666
+ }
667
+ function ambivalent(face2) {
668
+ 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");
669
+ }
670
+ if (faceData.score > 3) {
671
+ smile(face);
672
+ } else if (faceData.score < 3) {
673
+ sad(face);
674
+ } else {
675
+ ambivalent(face);
676
+ }
677
+ return circleElement;
678
+ };
679
+ const drawCircle = function(element, circleData) {
680
+ const circleElement = element.append("circle");
681
+ circleElement.attr("cx", circleData.cx);
682
+ circleElement.attr("cy", circleData.cy);
683
+ circleElement.attr("class", "actor-" + circleData.pos);
684
+ circleElement.attr("fill", circleData.fill);
685
+ circleElement.attr("stroke", circleData.stroke);
686
+ circleElement.attr("r", circleData.r);
687
+ if (circleElement.class !== void 0) {
688
+ circleElement.attr("class", circleElement.class);
689
+ }
690
+ if (circleData.title !== void 0) {
691
+ circleElement.append("title").text(circleData.title);
692
+ }
693
+ return circleElement;
694
+ };
695
+ const drawText = function(elem, textData) {
696
+ const nText = textData.text.replace(/<br\s*\/?>/gi, " ");
697
+ const textElem = elem.append("text");
698
+ textElem.attr("x", textData.x);
699
+ textElem.attr("y", textData.y);
700
+ textElem.attr("class", "legend");
701
+ textElem.style("text-anchor", textData.anchor);
702
+ if (textData.class !== void 0) {
703
+ textElem.attr("class", textData.class);
704
+ }
705
+ const span = textElem.append("tspan");
706
+ span.attr("x", textData.x + textData.textMargin * 2);
707
+ span.text(nText);
708
+ return textElem;
709
+ };
710
+ const drawLabel = function(elem, txtObject) {
711
+ function genPoints(x, y, width, height, cut) {
712
+ return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
713
+ }
714
+ const polygon = elem.append("polygon");
715
+ polygon.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7));
716
+ polygon.attr("class", "labelBox");
717
+ txtObject.y = txtObject.y + txtObject.labelMargin;
718
+ txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
719
+ drawText(elem, txtObject);
720
+ };
721
+ const drawSection = function(elem, section, conf) {
722
+ const g = elem.append("g");
723
+ const rect = getNoteRect();
724
+ rect.x = section.x;
725
+ rect.y = section.y;
726
+ rect.fill = section.fill;
727
+ rect.width = conf.width;
728
+ rect.height = conf.height;
729
+ rect.class = "journey-section section-type-" + section.num;
730
+ rect.rx = 3;
731
+ rect.ry = 3;
732
+ drawRect(g, rect);
733
+ _drawTextCandidateFunc(conf)(
734
+ section.text,
735
+ g,
736
+ rect.x,
737
+ rect.y,
738
+ rect.width,
739
+ rect.height,
740
+ { class: "journey-section section-type-" + section.num },
741
+ conf,
742
+ section.colour
743
+ );
744
+ };
745
+ let taskCount = -1;
746
+ const drawTask = function(elem, task, conf) {
747
+ const center = task.x + conf.width / 2;
748
+ const g = elem.append("g");
749
+ taskCount++;
750
+ const maxHeight = 300 + 5 * 30;
751
+ 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");
752
+ drawFace(g, {
753
+ cx: center,
754
+ cy: 300 + (5 - task.score) * 30,
755
+ score: task.score
756
+ });
757
+ const rect = getNoteRect();
758
+ rect.x = task.x;
759
+ rect.y = task.y;
760
+ rect.fill = task.fill;
761
+ rect.width = conf.width;
762
+ rect.height = conf.height;
763
+ rect.class = "task task-type-" + task.num;
764
+ rect.rx = 3;
765
+ rect.ry = 3;
766
+ drawRect(g, rect);
767
+ task.x + 14;
768
+ _drawTextCandidateFunc(conf)(
769
+ task.task,
770
+ g,
771
+ rect.x,
772
+ rect.y,
773
+ rect.width,
774
+ rect.height,
775
+ { class: "task" },
776
+ conf,
777
+ task.colour
778
+ );
779
+ };
780
+ const drawBackgroundRect = function(elem, bounds) {
781
+ const rectElem = drawRect(elem, {
782
+ x: bounds.startx,
783
+ y: bounds.starty,
784
+ width: bounds.stopx - bounds.startx,
785
+ height: bounds.stopy - bounds.starty,
786
+ fill: bounds.fill,
787
+ class: "rect"
788
+ });
789
+ rectElem.lower();
790
+ };
791
+ const getTextObj = function() {
792
+ return {
793
+ x: 0,
794
+ y: 0,
795
+ fill: void 0,
796
+ "text-anchor": "start",
797
+ width: 100,
798
+ height: 100,
799
+ textMargin: 0,
800
+ rx: 0,
801
+ ry: 0
802
+ };
803
+ };
804
+ const getNoteRect = function() {
805
+ return {
806
+ x: 0,
807
+ y: 0,
808
+ width: 100,
809
+ anchor: "start",
810
+ height: 100,
811
+ rx: 0,
812
+ ry: 0
813
+ };
814
+ };
815
+ const _drawTextCandidateFunc = /* @__PURE__ */ (function() {
816
+ function byText(content, g, x, y, width, height, textAttrs, colour) {
817
+ 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);
818
+ _setTextAttrs(text, textAttrs);
819
+ }
820
+ function byTspan(content, g, x, y, width, height, textAttrs, conf, colour) {
821
+ const { taskFontSize, taskFontFamily } = conf;
822
+ const lines = content.split(/<br\s*\/?>/gi);
823
+ for (let i = 0; i < lines.length; i++) {
824
+ const dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2;
825
+ 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);
826
+ text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]);
827
+ text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
828
+ _setTextAttrs(text, textAttrs);
829
+ }
830
+ }
831
+ function byFo(content, g, x, y, width, height, textAttrs, conf) {
832
+ const body = g.append("switch");
833
+ const f = body.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("position", "fixed");
834
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
835
+ text.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
836
+ byTspan(content, body, x, y, width, height, textAttrs, conf);
837
+ _setTextAttrs(text, textAttrs);
838
+ }
839
+ function _setTextAttrs(toText, fromTextAttrsDict) {
840
+ for (const key in fromTextAttrsDict) {
841
+ if (key in fromTextAttrsDict) {
842
+ toText.attr(key, fromTextAttrsDict[key]);
843
+ }
844
+ }
845
+ }
846
+ return function(conf) {
847
+ return conf.textPlacement === "fo" ? byFo : conf.textPlacement === "old" ? byText : byTspan;
848
+ };
849
+ })();
850
+ const initGraphics = function(graphics) {
851
+ 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");
852
+ };
853
+ function wrap(text, width) {
854
+ text.each(function() {
855
+ var text2 = select(this), words = text2.text().split(/(\s+|<br>)/).reverse(), word, line = [], lineHeight = 1.1, y = text2.attr("y"), dy = parseFloat(text2.attr("dy")), tspan = text2.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em");
856
+ for (let j = 0; j < words.length; j++) {
857
+ word = words[words.length - 1 - j];
858
+ line.push(word);
859
+ tspan.text(line.join(" ").trim());
860
+ if (tspan.node().getComputedTextLength() > width || word === "<br>") {
861
+ line.pop();
862
+ tspan.text(line.join(" ").trim());
863
+ if (word === "<br>") {
864
+ line = [""];
865
+ } else {
866
+ line = [word];
867
+ }
868
+ tspan = text2.append("tspan").attr("x", 0).attr("y", y).attr("dy", lineHeight + "em").text(word);
869
+ }
870
+ }
871
+ });
872
+ }
873
+ const drawNode = function(elem, node, fullSection, conf) {
874
+ const section = fullSection % MAX_SECTIONS - 1;
875
+ const nodeElem = elem.append("g");
876
+ node.section = section;
877
+ nodeElem.attr(
878
+ "class",
879
+ (node.class ? node.class + " " : "") + "timeline-node " + ("section-" + section)
880
+ );
881
+ const bkgElem = nodeElem.append("g");
882
+ const textElem = nodeElem.append("g");
883
+ const txt = textElem.append("text").text(node.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap, node.width);
884
+ const bbox = txt.node().getBBox();
885
+ const fontSize = conf.fontSize && conf.fontSize.replace ? conf.fontSize.replace("px", "") : conf.fontSize;
886
+ node.height = bbox.height + fontSize * 1.1 * 0.5 + node.padding;
887
+ node.height = Math.max(node.height, node.maxHeight);
888
+ node.width = node.width + 2 * node.padding;
889
+ textElem.attr("transform", "translate(" + node.width / 2 + ", " + node.padding / 2 + ")");
890
+ defaultBkg(bkgElem, node, section);
891
+ return node;
892
+ };
893
+ const getVirtualNodeHeight = function(elem, node, conf) {
894
+ const textElem = elem.append("g");
895
+ const txt = textElem.append("text").text(node.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap, node.width);
896
+ const bbox = txt.node().getBBox();
897
+ const fontSize = conf.fontSize && conf.fontSize.replace ? conf.fontSize.replace("px", "") : conf.fontSize;
898
+ textElem.remove();
899
+ return bbox.height + fontSize * 1.1 * 0.5 + node.padding;
900
+ };
901
+ const defaultBkg = function(elem, node, section) {
902
+ const rd = 5;
903
+ elem.append("path").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + node.type).attr(
904
+ "d",
905
+ `M0 ${node.height - rd} v${-node.height + 2 * rd} q0,-5 5,-5 h${node.width - 2 * rd} q5,0 5,5 v${node.height - rd} H0 Z`
906
+ );
907
+ elem.append("line").attr("class", "node-line-" + section).attr("x1", 0).attr("y1", node.height).attr("x2", node.width).attr("y2", node.height);
908
+ };
909
+ const svgDraw = {
910
+ drawRect,
911
+ drawCircle,
912
+ drawSection,
913
+ drawText,
914
+ drawLabel,
915
+ drawTask,
916
+ drawBackgroundRect,
917
+ getTextObj,
918
+ getNoteRect,
919
+ initGraphics,
920
+ drawNode,
921
+ getVirtualNodeHeight
922
+ };
923
+ const draw = function(text, id, version, diagObj) {
924
+ var _a, _b;
925
+ const conf = getConfig();
926
+ const LEFT_MARGIN = conf.leftMargin ?? 50;
927
+ log$1.debug("timeline", diagObj.db);
928
+ const securityLevel = conf.securityLevel;
929
+ let sandboxElement;
930
+ if (securityLevel === "sandbox") {
931
+ sandboxElement = select("#i" + id);
932
+ }
933
+ const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
934
+ const svg = root.select("#" + id);
935
+ svg.append("g");
936
+ const tasks2 = diagObj.db.getTasks();
937
+ const title = diagObj.db.getCommonDb().getDiagramTitle();
938
+ log$1.debug("task", tasks2);
939
+ svgDraw.initGraphics(svg);
940
+ const sections2 = diagObj.db.getSections();
941
+ log$1.debug("sections", sections2);
942
+ let maxSectionHeight = 0;
943
+ let maxTaskHeight = 0;
944
+ let depthY = 0;
945
+ let sectionBeginY = 0;
946
+ let masterX = 50 + LEFT_MARGIN;
947
+ let masterY = 50;
948
+ sectionBeginY = 50;
949
+ let sectionNumber = 0;
950
+ let hasSections = true;
951
+ sections2.forEach(function(section) {
952
+ const sectionNode = {
953
+ number: sectionNumber,
954
+ descr: section,
955
+ section: sectionNumber,
956
+ width: 150,
957
+ padding: 20,
958
+ maxHeight: maxSectionHeight
959
+ };
960
+ const sectionHeight = svgDraw.getVirtualNodeHeight(svg, sectionNode, conf);
961
+ log$1.debug("sectionHeight before draw", sectionHeight);
962
+ maxSectionHeight = Math.max(maxSectionHeight, sectionHeight + 20);
963
+ });
964
+ let maxEventCount = 0;
965
+ let maxEventLineLength = 0;
966
+ log$1.debug("tasks.length", tasks2.length);
967
+ for (const [i, task] of tasks2.entries()) {
968
+ const taskNode = {
969
+ number: i,
970
+ descr: task,
971
+ section: task.section,
972
+ width: 150,
973
+ padding: 20,
974
+ maxHeight: maxTaskHeight
975
+ };
976
+ const taskHeight = svgDraw.getVirtualNodeHeight(svg, taskNode, conf);
977
+ log$1.debug("taskHeight before draw", taskHeight);
978
+ maxTaskHeight = Math.max(maxTaskHeight, taskHeight + 20);
979
+ maxEventCount = Math.max(maxEventCount, task.events.length);
980
+ let maxEventLineLengthTemp = 0;
981
+ for (let j = 0; j < task.events.length; j++) {
982
+ const event = task.events[j];
983
+ const eventNode = {
984
+ descr: event,
985
+ section: task.section,
986
+ number: task.section,
987
+ width: 150,
988
+ padding: 20,
989
+ maxHeight: 50
990
+ };
991
+ maxEventLineLengthTemp += svgDraw.getVirtualNodeHeight(svg, eventNode, conf);
992
+ }
993
+ maxEventLineLength = Math.max(maxEventLineLength, maxEventLineLengthTemp);
994
+ }
995
+ log$1.debug("maxSectionHeight before draw", maxSectionHeight);
996
+ log$1.debug("maxTaskHeight before draw", maxTaskHeight);
997
+ if (sections2 && sections2.length > 0) {
998
+ sections2.forEach((section) => {
999
+ const tasksForSection = tasks2.filter((task) => task.section === section);
1000
+ const sectionNode = {
1001
+ number: sectionNumber,
1002
+ descr: section,
1003
+ section: sectionNumber,
1004
+ width: 200 * Math.max(tasksForSection.length, 1) - 50,
1005
+ padding: 20,
1006
+ maxHeight: maxSectionHeight
1007
+ };
1008
+ log$1.debug("sectionNode", sectionNode);
1009
+ const sectionNodeWrapper = svg.append("g");
1010
+ const node = svgDraw.drawNode(sectionNodeWrapper, sectionNode, sectionNumber, conf);
1011
+ log$1.debug("sectionNode output", node);
1012
+ sectionNodeWrapper.attr("transform", `translate(${masterX}, ${sectionBeginY})`);
1013
+ masterY += maxSectionHeight + 50;
1014
+ if (tasksForSection.length > 0) {
1015
+ drawTasks(
1016
+ svg,
1017
+ tasksForSection,
1018
+ sectionNumber,
1019
+ masterX,
1020
+ masterY,
1021
+ maxTaskHeight,
1022
+ conf,
1023
+ maxEventCount,
1024
+ maxEventLineLength,
1025
+ maxSectionHeight,
1026
+ false
1027
+ );
1028
+ }
1029
+ masterX += 200 * Math.max(tasksForSection.length, 1);
1030
+ masterY = sectionBeginY;
1031
+ sectionNumber++;
1032
+ });
1033
+ } else {
1034
+ hasSections = false;
1035
+ drawTasks(
1036
+ svg,
1037
+ tasks2,
1038
+ sectionNumber,
1039
+ masterX,
1040
+ masterY,
1041
+ maxTaskHeight,
1042
+ conf,
1043
+ maxEventCount,
1044
+ maxEventLineLength,
1045
+ maxSectionHeight,
1046
+ true
1047
+ );
1048
+ }
1049
+ const box = svg.node().getBBox();
1050
+ log$1.debug("bounds", box);
1051
+ if (title) {
1052
+ svg.append("text").text(title).attr("x", box.width / 2 - LEFT_MARGIN).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20);
1053
+ }
1054
+ depthY = hasSections ? maxSectionHeight + maxTaskHeight + 150 : maxTaskHeight + 100;
1055
+ const lineWrapper = svg.append("g").attr("class", "lineWrapper");
1056
+ lineWrapper.append("line").attr("x1", LEFT_MARGIN).attr("y1", depthY).attr("x2", box.width + 3 * LEFT_MARGIN).attr("y2", depthY).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)");
1057
+ setupGraphViewbox$1(
1058
+ void 0,
1059
+ svg,
1060
+ ((_a = conf.timeline) == null ? void 0 : _a.padding) ?? 50,
1061
+ ((_b = conf.timeline) == null ? void 0 : _b.useMaxWidth) ?? false
1062
+ );
1063
+ };
1064
+ const drawTasks = function(diagram2, tasks2, sectionColor, masterX, masterY, maxTaskHeight, conf, maxEventCount, maxEventLineLength, maxSectionHeight, isWithoutSections) {
1065
+ var _a;
1066
+ for (const task of tasks2) {
1067
+ const taskNode = {
1068
+ descr: task.task,
1069
+ section: sectionColor,
1070
+ number: sectionColor,
1071
+ width: 150,
1072
+ padding: 20,
1073
+ maxHeight: maxTaskHeight
1074
+ };
1075
+ log$1.debug("taskNode", taskNode);
1076
+ const taskWrapper = diagram2.append("g").attr("class", "taskWrapper");
1077
+ const node = svgDraw.drawNode(taskWrapper, taskNode, sectionColor, conf);
1078
+ const taskHeight = node.height;
1079
+ log$1.debug("taskHeight after draw", taskHeight);
1080
+ taskWrapper.attr("transform", `translate(${masterX}, ${masterY})`);
1081
+ maxTaskHeight = Math.max(maxTaskHeight, taskHeight);
1082
+ if (task.events) {
1083
+ const lineWrapper = diagram2.append("g").attr("class", "lineWrapper");
1084
+ let lineLength = maxTaskHeight;
1085
+ masterY += 100;
1086
+ lineLength = lineLength + drawEvents(diagram2, task.events, sectionColor, masterX, masterY, conf);
1087
+ masterY -= 100;
1088
+ lineWrapper.append("line").attr("x1", masterX + 190 / 2).attr("y1", masterY + maxTaskHeight).attr("x2", masterX + 190 / 2).attr(
1089
+ "y2",
1090
+ masterY + maxTaskHeight + (isWithoutSections ? maxTaskHeight : maxSectionHeight) + maxEventLineLength + 120
1091
+ ).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5");
1092
+ }
1093
+ masterX = masterX + 200;
1094
+ if (isWithoutSections && !((_a = conf.timeline) == null ? void 0 : _a.disableMulticolor)) {
1095
+ sectionColor++;
1096
+ }
1097
+ }
1098
+ masterY = masterY - 10;
1099
+ };
1100
+ const drawEvents = function(diagram2, events, sectionColor, masterX, masterY, conf) {
1101
+ let maxEventHeight = 0;
1102
+ const eventBeginY = masterY;
1103
+ masterY = masterY + 100;
1104
+ for (const event of events) {
1105
+ const eventNode = {
1106
+ descr: event,
1107
+ section: sectionColor,
1108
+ number: sectionColor,
1109
+ width: 150,
1110
+ padding: 20,
1111
+ maxHeight: 50
1112
+ };
1113
+ log$1.debug("eventNode", eventNode);
1114
+ const eventWrapper = diagram2.append("g").attr("class", "eventWrapper");
1115
+ const node = svgDraw.drawNode(eventWrapper, eventNode, sectionColor, conf);
1116
+ const eventHeight = node.height;
1117
+ maxEventHeight = maxEventHeight + eventHeight;
1118
+ eventWrapper.attr("transform", `translate(${masterX}, ${masterY})`);
1119
+ masterY = masterY + 10 + eventHeight;
1120
+ }
1121
+ masterY = eventBeginY;
1122
+ return maxEventHeight;
1123
+ };
1124
+ const renderer = {
1125
+ setConf: () => {
1126
+ },
1127
+ draw
1128
+ };
1129
+ const genSections = (options) => {
1130
+ let sections2 = "";
1131
+ for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
1132
+ options["lineColor" + i] = options["lineColor" + i] || options["cScaleInv" + i];
1133
+ if (isDark(options["lineColor" + i])) {
1134
+ options["lineColor" + i] = lighten(options["lineColor" + i], 20);
1135
+ } else {
1136
+ options["lineColor" + i] = darken(options["lineColor" + i], 20);
1137
+ }
1138
+ }
1139
+ for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
1140
+ const sw = "" + (17 - 3 * i);
1141
+ sections2 += `
1142
+ .section-${i - 1} rect, .section-${i - 1} path, .section-${i - 1} circle, .section-${i - 1} path {
1143
+ fill: ${options["cScale" + i]};
1144
+ }
1145
+ .section-${i - 1} text {
1146
+ fill: ${options["cScaleLabel" + i]};
1147
+ }
1148
+ .node-icon-${i - 1} {
1149
+ font-size: 40px;
1150
+ color: ${options["cScaleLabel" + i]};
1151
+ }
1152
+ .section-edge-${i - 1}{
1153
+ stroke: ${options["cScale" + i]};
1154
+ }
1155
+ .edge-depth-${i - 1}{
1156
+ stroke-width: ${sw};
1157
+ }
1158
+ .section-${i - 1} line {
1159
+ stroke: ${options["cScaleInv" + i]} ;
1160
+ stroke-width: 3;
1161
+ }
1162
+
1163
+ .lineWrapper line{
1164
+ stroke: ${options["cScaleLabel" + i]} ;
1165
+ }
1166
+
1167
+ .disabled, .disabled circle, .disabled text {
1168
+ fill: lightgray;
1169
+ }
1170
+ .disabled text {
1171
+ fill: #efefef;
1172
+ }
1173
+ `;
1174
+ }
1175
+ return sections2;
1176
+ };
1177
+ const getStyles = (options) => `
1178
+ .edge {
1179
+ stroke-width: 3;
1180
+ }
1181
+ ${genSections(options)}
1182
+ .section-root rect, .section-root path, .section-root circle {
1183
+ fill: ${options.git0};
1184
+ }
1185
+ .section-root text {
1186
+ fill: ${options.gitBranchLabel0};
1187
+ }
1188
+ .icon-container {
1189
+ height:100%;
1190
+ display: flex;
1191
+ justify-content: center;
1192
+ align-items: center;
1193
+ }
1194
+ .edge {
1195
+ fill: none;
1196
+ }
1197
+ .eventWrapper {
1198
+ filter: brightness(120%);
1199
+ }
1200
+ `;
1201
+ const styles = getStyles;
1202
+ const diagram = {
1203
+ db,
1204
+ renderer,
1205
+ parser: parser$1,
1206
+ styles
1207
+ };
1208
+ export {
1209
+ diagram
1210
+ };