lowcoder-comps 0.0.8 → 0.0.9

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.
@@ -1,847 +0,0 @@
1
- import { c as V, v as gt, x as mt, s as xt, g as _t, b as kt, a as vt, m as bt, z as wt, h as Z, i as Tt } from "./2b3ab1e4.js";
2
- import { a as st } from "./4bc1082b.js";
3
- import "./e0f479f3.js";
4
- var K = function() {
5
- var e = function(_, n, a, h) {
6
- for (a = a || {}, h = _.length; h--; a[_[h]] = n)
7
- ;
8
- return a;
9
- }, t = [1, 2], i = [1, 5], r = [6, 9, 11, 17, 18, 20, 22, 23, 24, 26], s = [1, 15], o = [1, 16], l = [1, 17], y = [1, 18], u = [1, 19], x = [1, 20], g = [1, 24], f = [4, 6, 9, 11, 17, 18, 20, 22, 23, 24, 26], p = {
10
- trace: function() {
11
- },
12
- yy: {},
13
- symbols_: { error: 2, start: 3, journey: 4, document: 5, EOF: 6, directive: 7, line: 8, SPACE: 9, statement: 10, NEWLINE: 11, openDirective: 12, typeDirective: 13, closeDirective: 14, ":": 15, argDirective: 16, title: 17, acc_title: 18, acc_title_value: 19, acc_descr: 20, acc_descr_value: 21, acc_descr_multiline_value: 22, section: 23, taskName: 24, taskData: 25, open_directive: 26, type_directive: 27, arg_directive: 28, close_directive: 29, $accept: 0, $end: 1 },
14
- terminals_: { 2: "error", 4: "journey", 6: "EOF", 9: "SPACE", 11: "NEWLINE", 15: ":", 17: "title", 18: "acc_title", 19: "acc_title_value", 20: "acc_descr", 21: "acc_descr_value", 22: "acc_descr_multiline_value", 23: "section", 24: "taskName", 25: "taskData", 26: "open_directive", 27: "type_directive", 28: "arg_directive", 29: "close_directive" },
15
- productions_: [0, [3, 3], [3, 2], [5, 0], [5, 2], [8, 2], [8, 1], [8, 1], [8, 1], [7, 4], [7, 6], [10, 1], [10, 2], [10, 2], [10, 1], [10, 1], [10, 2], [10, 1], [12, 1], [13, 1], [16, 1], [14, 1]],
16
- performAction: function(n, a, h, d, m, c, R) {
17
- var k = c.length - 1;
18
- switch (m) {
19
- case 1:
20
- return c[k - 1];
21
- case 3:
22
- this.$ = [];
23
- break;
24
- case 4:
25
- c[k - 1].push(c[k]), this.$ = c[k - 1];
26
- break;
27
- case 5:
28
- case 6:
29
- this.$ = c[k];
30
- break;
31
- case 7:
32
- case 8:
33
- this.$ = [];
34
- break;
35
- case 11:
36
- d.setDiagramTitle(c[k].substr(6)), this.$ = c[k].substr(6);
37
- break;
38
- case 12:
39
- this.$ = c[k].trim(), d.setAccTitle(this.$);
40
- break;
41
- case 13:
42
- case 14:
43
- this.$ = c[k].trim(), d.setAccDescription(this.$);
44
- break;
45
- case 15:
46
- d.addSection(c[k].substr(8)), this.$ = c[k].substr(8);
47
- break;
48
- case 16:
49
- d.addTask(c[k - 1], c[k]), this.$ = "task";
50
- break;
51
- case 18:
52
- d.parseDirective("%%{", "open_directive");
53
- break;
54
- case 19:
55
- d.parseDirective(c[k], "type_directive");
56
- break;
57
- case 20:
58
- c[k] = c[k].trim().replace(/'/g, '"'), d.parseDirective(c[k], "arg_directive");
59
- break;
60
- case 21:
61
- d.parseDirective("}%%", "close_directive", "journey");
62
- break;
63
- }
64
- },
65
- table: [{ 3: 1, 4: t, 7: 3, 12: 4, 26: i }, { 1: [3] }, e(r, [2, 3], { 5: 6 }), { 3: 7, 4: t, 7: 3, 12: 4, 26: i }, { 13: 8, 27: [1, 9] }, { 27: [2, 18] }, { 6: [1, 10], 7: 21, 8: 11, 9: [1, 12], 10: 13, 11: [1, 14], 12: 4, 17: s, 18: o, 20: l, 22: y, 23: u, 24: x, 26: i }, { 1: [2, 2] }, { 14: 22, 15: [1, 23], 29: g }, e([15, 29], [2, 19]), e(r, [2, 8], { 1: [2, 1] }), e(r, [2, 4]), { 7: 21, 10: 25, 12: 4, 17: s, 18: o, 20: l, 22: y, 23: u, 24: x, 26: i }, e(r, [2, 6]), e(r, [2, 7]), e(r, [2, 11]), { 19: [1, 26] }, { 21: [1, 27] }, e(r, [2, 14]), e(r, [2, 15]), { 25: [1, 28] }, e(r, [2, 17]), { 11: [1, 29] }, { 16: 30, 28: [1, 31] }, { 11: [2, 21] }, e(r, [2, 5]), e(r, [2, 12]), e(r, [2, 13]), e(r, [2, 16]), e(f, [2, 9]), { 14: 32, 29: g }, { 29: [2, 20] }, { 11: [1, 33] }, e(f, [2, 10])],
66
- defaultActions: { 5: [2, 18], 7: [2, 2], 24: [2, 21], 31: [2, 20] },
67
- parseError: function(n, a) {
68
- if (a.recoverable)
69
- this.trace(n);
70
- else {
71
- var h = new Error(n);
72
- throw h.hash = a, h;
73
- }
74
- },
75
- parse: function(n) {
76
- var a = this, h = [0], d = [], m = [null], c = [], R = this.table, k = "", z = 0, tt = 0, yt = 2, et = 1, pt = c.slice.call(arguments, 1), b = Object.create(this.lexer), I = { yy: {} };
77
- for (var X in this.yy)
78
- Object.prototype.hasOwnProperty.call(this.yy, X) && (I.yy[X] = this.yy[X]);
79
- b.setInput(n, I.yy), I.yy.lexer = b, I.yy.parser = this, typeof b.yylloc == "undefined" && (b.yylloc = {});
80
- var G = b.yylloc;
81
- c.push(G);
82
- var dt = b.options && b.options.ranges;
83
- typeof I.yy.parseError == "function" ? this.parseError = I.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
84
- function ft() {
85
- var E;
86
- return E = d.pop() || b.lex() || et, typeof E != "number" && (E instanceof Array && (d = E, E = d.pop()), E = a.symbols_[E] || E), E;
87
- }
88
- for (var w, A, M, H, F = {}, Y, $, it, q; ; ) {
89
- if (A = h[h.length - 1], this.defaultActions[A] ? M = this.defaultActions[A] : ((w === null || typeof w == "undefined") && (w = ft()), M = R[A] && R[A][w]), typeof M == "undefined" || !M.length || !M[0]) {
90
- var U = "";
91
- q = [];
92
- for (Y in R[A])
93
- this.terminals_[Y] && Y > yt && q.push("'" + this.terminals_[Y] + "'");
94
- b.showPosition ? U = "Parse error on line " + (z + 1) + `:
95
- ` + b.showPosition() + `
96
- Expecting ` + q.join(", ") + ", got '" + (this.terminals_[w] || w) + "'" : U = "Parse error on line " + (z + 1) + ": Unexpected " + (w == et ? "end of input" : "'" + (this.terminals_[w] || w) + "'"), this.parseError(U, {
97
- text: b.match,
98
- token: this.terminals_[w] || w,
99
- line: b.yylineno,
100
- loc: G,
101
- expected: q
102
- });
103
- }
104
- if (M[0] instanceof Array && M.length > 1)
105
- throw new Error("Parse Error: multiple actions possible at state: " + A + ", token: " + w);
106
- switch (M[0]) {
107
- case 1:
108
- h.push(w), m.push(b.yytext), c.push(b.yylloc), h.push(M[1]), w = null, tt = b.yyleng, k = b.yytext, z = b.yylineno, G = b.yylloc;
109
- break;
110
- case 2:
111
- if ($ = this.productions_[M[1]][1], F.$ = m[m.length - $], F._$ = {
112
- first_line: c[c.length - ($ || 1)].first_line,
113
- last_line: c[c.length - 1].last_line,
114
- first_column: c[c.length - ($ || 1)].first_column,
115
- last_column: c[c.length - 1].last_column
116
- }, dt && (F._$.range = [
117
- c[c.length - ($ || 1)].range[0],
118
- c[c.length - 1].range[1]
119
- ]), H = this.performAction.apply(F, [
120
- k,
121
- tt,
122
- z,
123
- I.yy,
124
- M[1],
125
- m,
126
- c
127
- ].concat(pt)), typeof H != "undefined")
128
- return H;
129
- $ && (h = h.slice(0, -1 * $ * 2), m = m.slice(0, -1 * $), c = c.slice(0, -1 * $)), h.push(this.productions_[M[1]][0]), m.push(F.$), c.push(F._$), it = R[h[h.length - 2]][h[h.length - 1]], h.push(it);
130
- break;
131
- case 3:
132
- return !0;
133
- }
134
- }
135
- return !0;
136
- }
137
- }, T = function() {
138
- var _ = {
139
- EOF: 1,
140
- parseError: function(a, h) {
141
- if (this.yy.parser)
142
- this.yy.parser.parseError(a, h);
143
- else
144
- throw new Error(a);
145
- },
146
- setInput: function(n, a) {
147
- return this.yy = a || this.yy || {}, this._input = n, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
148
- first_line: 1,
149
- first_column: 0,
150
- last_line: 1,
151
- last_column: 0
152
- }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
153
- },
154
- input: function() {
155
- var n = this._input[0];
156
- this.yytext += n, this.yyleng++, this.offset++, this.match += n, this.matched += n;
157
- var a = n.match(/(?:\r\n?|\n).*/g);
158
- return a ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), n;
159
- },
160
- unput: function(n) {
161
- var a = n.length, h = n.split(/(?:\r\n?|\n)/g);
162
- this._input = n + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - a), this.offset -= a;
163
- var d = this.match.split(/(?:\r\n?|\n)/g);
164
- this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), h.length - 1 && (this.yylineno -= h.length - 1);
165
- var m = this.yylloc.range;
166
- return this.yylloc = {
167
- first_line: this.yylloc.first_line,
168
- last_line: this.yylineno + 1,
169
- first_column: this.yylloc.first_column,
170
- last_column: h ? (h.length === d.length ? this.yylloc.first_column : 0) + d[d.length - h.length].length - h[0].length : this.yylloc.first_column - a
171
- }, this.options.ranges && (this.yylloc.range = [m[0], m[0] + this.yyleng - a]), this.yyleng = this.yytext.length, this;
172
- },
173
- more: function() {
174
- return this._more = !0, this;
175
- },
176
- reject: function() {
177
- if (this.options.backtrack_lexer)
178
- this._backtrack = !0;
179
- else
180
- 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).
181
- ` + this.showPosition(), {
182
- text: "",
183
- token: null,
184
- line: this.yylineno
185
- });
186
- return this;
187
- },
188
- less: function(n) {
189
- this.unput(this.match.slice(n));
190
- },
191
- pastInput: function() {
192
- var n = this.matched.substr(0, this.matched.length - this.match.length);
193
- return (n.length > 20 ? "..." : "") + n.substr(-20).replace(/\n/g, "");
194
- },
195
- upcomingInput: function() {
196
- var n = this.match;
197
- return n.length < 20 && (n += this._input.substr(0, 20 - n.length)), (n.substr(0, 20) + (n.length > 20 ? "..." : "")).replace(/\n/g, "");
198
- },
199
- showPosition: function() {
200
- var n = this.pastInput(), a = new Array(n.length + 1).join("-");
201
- return n + this.upcomingInput() + `
202
- ` + a + "^";
203
- },
204
- test_match: function(n, a) {
205
- var h, d, m;
206
- if (this.options.backtrack_lexer && (m = {
207
- yylineno: this.yylineno,
208
- yylloc: {
209
- first_line: this.yylloc.first_line,
210
- last_line: this.last_line,
211
- first_column: this.yylloc.first_column,
212
- last_column: this.yylloc.last_column
213
- },
214
- yytext: this.yytext,
215
- match: this.match,
216
- matches: this.matches,
217
- matched: this.matched,
218
- yyleng: this.yyleng,
219
- offset: this.offset,
220
- _more: this._more,
221
- _input: this._input,
222
- yy: this.yy,
223
- conditionStack: this.conditionStack.slice(0),
224
- done: this.done
225
- }, this.options.ranges && (m.yylloc.range = this.yylloc.range.slice(0))), d = n[0].match(/(?:\r\n?|\n).*/g), d && (this.yylineno += d.length), this.yylloc = {
226
- first_line: this.yylloc.last_line,
227
- last_line: this.yylineno + 1,
228
- first_column: this.yylloc.last_column,
229
- last_column: d ? d[d.length - 1].length - d[d.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + n[0].length
230
- }, this.yytext += n[0], this.match += n[0], this.matches = n, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(n[0].length), this.matched += n[0], h = this.performAction.call(this, this.yy, this, a, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), h)
231
- return h;
232
- if (this._backtrack) {
233
- for (var c in m)
234
- this[c] = m[c];
235
- return !1;
236
- }
237
- return !1;
238
- },
239
- next: function() {
240
- if (this.done)
241
- return this.EOF;
242
- this._input || (this.done = !0);
243
- var n, a, h, d;
244
- this._more || (this.yytext = "", this.match = "");
245
- for (var m = this._currentRules(), c = 0; c < m.length; c++)
246
- if (h = this._input.match(this.rules[m[c]]), h && (!a || h[0].length > a[0].length)) {
247
- if (a = h, d = c, this.options.backtrack_lexer) {
248
- if (n = this.test_match(h, m[c]), n !== !1)
249
- return n;
250
- if (this._backtrack) {
251
- a = !1;
252
- continue;
253
- } else
254
- return !1;
255
- } else if (!this.options.flex)
256
- break;
257
- }
258
- return a ? (n = this.test_match(a, m[d]), n !== !1 ? n : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
259
- ` + this.showPosition(), {
260
- text: "",
261
- token: null,
262
- line: this.yylineno
263
- });
264
- },
265
- lex: function() {
266
- var a = this.next();
267
- return a || this.lex();
268
- },
269
- begin: function(a) {
270
- this.conditionStack.push(a);
271
- },
272
- popState: function() {
273
- var a = this.conditionStack.length - 1;
274
- return a > 0 ? this.conditionStack.pop() : this.conditionStack[0];
275
- },
276
- _currentRules: function() {
277
- return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
278
- },
279
- topState: function(a) {
280
- return a = this.conditionStack.length - 1 - Math.abs(a || 0), a >= 0 ? this.conditionStack[a] : "INITIAL";
281
- },
282
- pushState: function(a) {
283
- this.begin(a);
284
- },
285
- stateStackSize: function() {
286
- return this.conditionStack.length;
287
- },
288
- options: { "case-insensitive": !0 },
289
- performAction: function(a, h, d, m) {
290
- switch (d) {
291
- case 0:
292
- return this.begin("open_directive"), 26;
293
- case 1:
294
- return this.begin("type_directive"), 27;
295
- case 2:
296
- return this.popState(), this.begin("arg_directive"), 15;
297
- case 3:
298
- return this.popState(), this.popState(), 29;
299
- case 4:
300
- return 28;
301
- case 5:
302
- break;
303
- case 6:
304
- break;
305
- case 7:
306
- return 11;
307
- case 8:
308
- break;
309
- case 9:
310
- break;
311
- case 10:
312
- return 4;
313
- case 11:
314
- return 17;
315
- case 12:
316
- return this.begin("acc_title"), 18;
317
- case 13:
318
- return this.popState(), "acc_title_value";
319
- case 14:
320
- return this.begin("acc_descr"), 20;
321
- case 15:
322
- return this.popState(), "acc_descr_value";
323
- case 16:
324
- this.begin("acc_descr_multiline");
325
- break;
326
- case 17:
327
- this.popState();
328
- break;
329
- case 18:
330
- return "acc_descr_multiline_value";
331
- case 19:
332
- return 23;
333
- case 20:
334
- return 24;
335
- case 21:
336
- return 25;
337
- case 22:
338
- return 15;
339
- case 23:
340
- return 6;
341
- case 24:
342
- return "INVALID";
343
- }
344
- },
345
- rules: [/^(?:%%\{)/i, /^(?:((?:(?!\}%%)[^:.])*))/i, /^(?::)/i, /^(?:\}%%)/i, /^(?:((?:(?!\}%%).|\n)*))/i, /^(?:%(?!\{)[^\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],
346
- conditions: { open_directive: { rules: [1], inclusive: !1 }, type_directive: { rules: [2, 3], inclusive: !1 }, arg_directive: { rules: [3, 4], inclusive: !1 }, acc_descr_multiline: { rules: [17, 18], inclusive: !1 }, acc_descr: { rules: [15], inclusive: !1 }, acc_title: { rules: [13], inclusive: !1 }, INITIAL: { rules: [0, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 19, 20, 21, 22, 23, 24], inclusive: !0 } }
347
- };
348
- return _;
349
- }();
350
- p.lexer = T;
351
- function v() {
352
- this.yy = {};
353
- }
354
- return v.prototype = p, p.Parser = v, new v();
355
- }();
356
- K.parser = K;
357
- const Mt = K;
358
- let L = "";
359
- const Q = [], N = [], B = [], St = function(e, t, i) {
360
- bt.parseDirective(this, e, t, i);
361
- }, $t = function() {
362
- Q.length = 0, N.length = 0, L = "", B.length = 0, wt();
363
- }, Et = function(e) {
364
- L = e, Q.push(e);
365
- }, Pt = function() {
366
- return Q;
367
- }, It = function() {
368
- let e = rt();
369
- const t = 100;
370
- let i = 0;
371
- for (; !e && i < t; )
372
- e = rt(), i++;
373
- return N.push(...B), N;
374
- }, At = function() {
375
- const e = [];
376
- return N.forEach((i) => {
377
- i.people && e.push(...i.people);
378
- }), [...new Set(e)].sort();
379
- }, Ct = function(e, t) {
380
- const i = t.substr(1).split(":");
381
- let r = 0, s = [];
382
- i.length === 1 ? (r = Number(i[0]), s = []) : (r = Number(i[0]), s = i[1].split(","));
383
- const o = s.map((y) => y.trim()), l = {
384
- section: L,
385
- type: L,
386
- people: o,
387
- task: e,
388
- score: r
389
- };
390
- B.push(l);
391
- }, Vt = function(e) {
392
- const t = {
393
- section: L,
394
- type: L,
395
- description: e,
396
- task: e,
397
- classes: []
398
- };
399
- N.push(t);
400
- }, rt = function() {
401
- const e = function(i) {
402
- return B[i].processed;
403
- };
404
- let t = !0;
405
- for (const [i, r] of B.entries())
406
- e(i), t = t && r.processed;
407
- return t;
408
- }, Ft = function() {
409
- return At();
410
- }, nt = {
411
- parseDirective: St,
412
- getConfig: () => V().journey,
413
- clear: $t,
414
- setDiagramTitle: gt,
415
- getDiagramTitle: mt,
416
- setAccTitle: xt,
417
- getAccTitle: _t,
418
- setAccDescription: kt,
419
- getAccDescription: vt,
420
- addSection: Et,
421
- getSections: Pt,
422
- getTasks: It,
423
- addTask: Ct,
424
- addTaskOrg: Vt,
425
- getActors: Ft
426
- }, Lt = (e) => `.label {
427
- font-family: 'trebuchet ms', verdana, arial, sans-serif;
428
- font-family: var(--mermaid-font-family);
429
- color: ${e.textColor};
430
- }
431
- .mouth {
432
- stroke: #666;
433
- }
434
-
435
- line {
436
- stroke: ${e.textColor}
437
- }
438
-
439
- .legend {
440
- fill: ${e.textColor};
441
- }
442
-
443
- .label text {
444
- fill: #333;
445
- }
446
- .label {
447
- color: ${e.textColor}
448
- }
449
-
450
- .face {
451
- ${e.faceColor ? `fill: ${e.faceColor}` : "fill: #FFF8DC"};
452
- stroke: #999;
453
- }
454
-
455
- .node rect,
456
- .node circle,
457
- .node ellipse,
458
- .node polygon,
459
- .node path {
460
- fill: ${e.mainBkg};
461
- stroke: ${e.nodeBorder};
462
- stroke-width: 1px;
463
- }
464
-
465
- .node .label {
466
- text-align: center;
467
- }
468
- .node.clickable {
469
- cursor: pointer;
470
- }
471
-
472
- .arrowheadPath {
473
- fill: ${e.arrowheadColor};
474
- }
475
-
476
- .edgePath .path {
477
- stroke: ${e.lineColor};
478
- stroke-width: 1.5px;
479
- }
480
-
481
- .flowchart-link {
482
- stroke: ${e.lineColor};
483
- fill: none;
484
- }
485
-
486
- .edgeLabel {
487
- background-color: ${e.edgeLabelBackground};
488
- rect {
489
- opacity: 0.5;
490
- }
491
- text-align: center;
492
- }
493
-
494
- .cluster rect {
495
- }
496
-
497
- .cluster text {
498
- fill: ${e.titleColor};
499
- }
500
-
501
- div.mermaidTooltip {
502
- position: absolute;
503
- text-align: center;
504
- max-width: 200px;
505
- padding: 2px;
506
- font-family: 'trebuchet ms', verdana, arial, sans-serif;
507
- font-family: var(--mermaid-font-family);
508
- font-size: 12px;
509
- background: ${e.tertiaryColor};
510
- border: 1px solid ${e.border2};
511
- border-radius: 2px;
512
- pointer-events: none;
513
- z-index: 100;
514
- }
515
-
516
- .task-type-0, .section-type-0 {
517
- ${e.fillType0 ? `fill: ${e.fillType0}` : ""};
518
- }
519
- .task-type-1, .section-type-1 {
520
- ${e.fillType0 ? `fill: ${e.fillType1}` : ""};
521
- }
522
- .task-type-2, .section-type-2 {
523
- ${e.fillType0 ? `fill: ${e.fillType2}` : ""};
524
- }
525
- .task-type-3, .section-type-3 {
526
- ${e.fillType0 ? `fill: ${e.fillType3}` : ""};
527
- }
528
- .task-type-4, .section-type-4 {
529
- ${e.fillType0 ? `fill: ${e.fillType4}` : ""};
530
- }
531
- .task-type-5, .section-type-5 {
532
- ${e.fillType0 ? `fill: ${e.fillType5}` : ""};
533
- }
534
- .task-type-6, .section-type-6 {
535
- ${e.fillType0 ? `fill: ${e.fillType6}` : ""};
536
- }
537
- .task-type-7, .section-type-7 {
538
- ${e.fillType0 ? `fill: ${e.fillType7}` : ""};
539
- }
540
-
541
- .actor-0 {
542
- ${e.actor0 ? `fill: ${e.actor0}` : ""};
543
- }
544
- .actor-1 {
545
- ${e.actor1 ? `fill: ${e.actor1}` : ""};
546
- }
547
- .actor-2 {
548
- ${e.actor2 ? `fill: ${e.actor2}` : ""};
549
- }
550
- .actor-3 {
551
- ${e.actor3 ? `fill: ${e.actor3}` : ""};
552
- }
553
- .actor-4 {
554
- ${e.actor4 ? `fill: ${e.actor4}` : ""};
555
- }
556
- .actor-5 {
557
- ${e.actor5 ? `fill: ${e.actor5}` : ""};
558
- }
559
- `, Rt = Lt, O = function(e, t) {
560
- const i = e.append("rect");
561
- return i.attr("x", t.x), i.attr("y", t.y), i.attr("fill", t.fill), i.attr("stroke", t.stroke), i.attr("width", t.width), i.attr("height", t.height), i.attr("rx", t.rx), i.attr("ry", t.ry), t.class !== void 0 && i.attr("class", t.class), i;
562
- }, Nt = function(e, t) {
563
- const r = e.append("circle").attr("cx", t.cx).attr("cy", t.cy).attr("class", "face").attr("r", 15).attr("stroke-width", 2).attr("overflow", "visible"), s = e.append("g");
564
- s.append("circle").attr("cx", t.cx - 15 / 3).attr("cy", t.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"), s.append("circle").attr("cx", t.cx + 15 / 3).attr("cy", t.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
565
- function o(u) {
566
- const x = st().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
567
- u.append("path").attr("class", "mouth").attr("d", x).attr("transform", "translate(" + t.cx + "," + (t.cy + 2) + ")");
568
- }
569
- function l(u) {
570
- const x = st().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
571
- u.append("path").attr("class", "mouth").attr("d", x).attr("transform", "translate(" + t.cx + "," + (t.cy + 7) + ")");
572
- }
573
- function y(u) {
574
- u.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", t.cx - 5).attr("y1", t.cy + 7).attr("x2", t.cx + 5).attr("y2", t.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
575
- }
576
- return t.score > 3 ? o(s) : t.score < 3 ? l(s) : y(s), r;
577
- }, ot = function(e, t) {
578
- const i = e.append("circle");
579
- return i.attr("cx", t.cx), i.attr("cy", t.cy), i.attr("class", "actor-" + t.pos), i.attr("fill", t.fill), i.attr("stroke", t.stroke), i.attr("r", t.r), i.class !== void 0 && i.attr("class", i.class), t.title !== void 0 && i.append("title").text(t.title), i;
580
- }, ht = function(e, t) {
581
- const i = t.text.replace(/<br\s*\/?>/gi, " "), r = e.append("text");
582
- r.attr("x", t.x), r.attr("y", t.y), r.attr("class", "legend"), r.style("text-anchor", t.anchor), t.class !== void 0 && r.attr("class", t.class);
583
- const s = r.append("tspan");
584
- return s.attr("x", t.x + t.textMargin * 2), s.text(i), r;
585
- }, Bt = function(e, t) {
586
- function i(s, o, l, y, u) {
587
- return s + "," + o + " " + (s + l) + "," + o + " " + (s + l) + "," + (o + y - u) + " " + (s + l - u * 1.2) + "," + (o + y) + " " + s + "," + (o + y);
588
- }
589
- const r = e.append("polygon");
590
- r.attr("points", i(t.x, t.y, 50, 20, 7)), r.attr("class", "labelBox"), t.y = t.y + t.labelMargin, t.x = t.x + 0.5 * t.labelMargin, ht(e, t);
591
- }, jt = function(e, t, i) {
592
- const r = e.append("g"), s = D();
593
- s.x = t.x, s.y = t.y, s.fill = t.fill, s.width = i.width * t.taskCount + i.diagramMarginX * (t.taskCount - 1), s.height = i.height, s.class = "journey-section section-type-" + t.num, s.rx = 3, s.ry = 3, O(r, s), ut(i)(
594
- t.text,
595
- r,
596
- s.x,
597
- s.y,
598
- s.width,
599
- s.height,
600
- { class: "journey-section section-type-" + t.num },
601
- i,
602
- t.colour
603
- );
604
- };
605
- let at = -1;
606
- const zt = function(e, t, i) {
607
- const r = t.x + i.width / 2, s = e.append("g");
608
- at++;
609
- const o = 300 + 5 * 30;
610
- s.append("line").attr("id", "task" + at).attr("x1", r).attr("y1", t.y).attr("x2", r).attr("y2", o).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"), Nt(s, {
611
- cx: r,
612
- cy: 300 + (5 - t.score) * 30,
613
- score: t.score
614
- });
615
- const l = D();
616
- l.x = t.x, l.y = t.y, l.fill = t.fill, l.width = i.width, l.height = i.height, l.class = "task task-type-" + t.num, l.rx = 3, l.ry = 3, O(s, l);
617
- let y = t.x + 14;
618
- t.people.forEach((u) => {
619
- const x = t.actors[u].color, g = {
620
- cx: y,
621
- cy: t.y,
622
- r: 7,
623
- fill: x,
624
- stroke: "#000",
625
- title: u,
626
- pos: t.actors[u].position
627
- };
628
- ot(s, g), y += 10;
629
- }), ut(i)(
630
- t.task,
631
- s,
632
- l.x,
633
- l.y,
634
- l.width,
635
- l.height,
636
- { class: "task" },
637
- i,
638
- t.colour
639
- );
640
- }, Yt = function(e, t) {
641
- O(e, {
642
- x: t.startx,
643
- y: t.starty,
644
- width: t.stopx - t.startx,
645
- height: t.stopy - t.starty,
646
- fill: t.fill,
647
- class: "rect"
648
- }).lower();
649
- }, qt = function() {
650
- return {
651
- x: 0,
652
- y: 0,
653
- fill: void 0,
654
- "text-anchor": "start",
655
- width: 100,
656
- height: 100,
657
- textMargin: 0,
658
- rx: 0,
659
- ry: 0
660
- };
661
- }, D = function() {
662
- return {
663
- x: 0,
664
- y: 0,
665
- width: 100,
666
- anchor: "start",
667
- height: 100,
668
- rx: 0,
669
- ry: 0
670
- };
671
- }, ut = function() {
672
- function e(s, o, l, y, u, x, g, f) {
673
- const p = o.append("text").attr("x", l + u / 2).attr("y", y + x / 2 + 5).style("font-color", f).style("text-anchor", "middle").text(s);
674
- r(p, g);
675
- }
676
- function t(s, o, l, y, u, x, g, f, p) {
677
- const { taskFontSize: T, taskFontFamily: v } = f, _ = s.split(/<br\s*\/?>/gi);
678
- for (let n = 0; n < _.length; n++) {
679
- const a = n * T - T * (_.length - 1) / 2, h = o.append("text").attr("x", l + u / 2).attr("y", y).attr("fill", p).style("text-anchor", "middle").style("font-size", T).style("font-family", v);
680
- h.append("tspan").attr("x", l + u / 2).attr("dy", a).text(_[n]), h.attr("y", y + x / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), r(h, g);
681
- }
682
- }
683
- function i(s, o, l, y, u, x, g, f) {
684
- const p = o.append("switch"), v = p.append("foreignObject").attr("x", l).attr("y", y).attr("width", u).attr("height", x).attr("position", "fixed").append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
685
- v.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(s), t(s, p, l, y, u, x, g, f), r(v, g);
686
- }
687
- function r(s, o) {
688
- for (const l in o)
689
- l in o && s.attr(l, o[l]);
690
- }
691
- return function(s) {
692
- return s.textPlacement === "fo" ? i : s.textPlacement === "old" ? e : t;
693
- };
694
- }(), Ot = function(e) {
695
- e.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");
696
- }, j = {
697
- drawRect: O,
698
- drawCircle: ot,
699
- drawSection: jt,
700
- drawText: ht,
701
- drawLabel: Bt,
702
- drawTask: zt,
703
- drawBackgroundRect: Yt,
704
- getTextObj: qt,
705
- getNoteRect: D,
706
- initGraphics: Ot
707
- }, Wt = function(e) {
708
- Object.keys(e).forEach(function(i) {
709
- W[i] = e[i];
710
- });
711
- }, P = {};
712
- function Xt(e) {
713
- const t = V().journey;
714
- let i = 60;
715
- Object.keys(P).forEach((r) => {
716
- const s = P[r].color, o = {
717
- cx: 20,
718
- cy: i,
719
- r: 7,
720
- fill: s,
721
- stroke: "#000",
722
- pos: P[r].position
723
- };
724
- j.drawCircle(e, o);
725
- const l = {
726
- x: 40,
727
- y: i + 7,
728
- fill: "#666",
729
- text: r,
730
- textMargin: t.boxTextMargin | 5
731
- };
732
- j.drawText(e, l), i += 20;
733
- });
734
- }
735
- const W = V().journey, C = W.leftMargin, Gt = function(e, t, i, r) {
736
- const s = V().journey;
737
- r.db.clear(), r.parser.parse(e + `
738
- `);
739
- const o = V().securityLevel;
740
- let l;
741
- o === "sandbox" && (l = Z("#i" + t));
742
- const y = o === "sandbox" ? Z(l.nodes()[0].contentDocument.body) : Z("body");
743
- S.init();
744
- const u = y.select("#" + t);
745
- j.initGraphics(u);
746
- const x = r.db.getTasks(), g = r.db.getDiagramTitle(), f = r.db.getActors();
747
- for (const a in P)
748
- delete P[a];
749
- let p = 0;
750
- f.forEach((a) => {
751
- P[a] = {
752
- color: s.actorColours[p % s.actorColours.length],
753
- position: p
754
- }, p++;
755
- }), Xt(u), S.insert(0, 0, C, Object.keys(P).length * 50), Ht(u, x, 0);
756
- const T = S.getBounds();
757
- g && u.append("text").text(g).attr("x", C).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 25);
758
- const v = T.stopy - T.starty + 2 * s.diagramMarginY, _ = C + T.stopx + 2 * s.diagramMarginX;
759
- Tt(u, v, _, s.useMaxWidth), u.append("line").attr("x1", C).attr("y1", s.height * 4).attr("x2", _ - C - 4).attr("y2", s.height * 4).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)");
760
- const n = g ? 70 : 0;
761
- u.attr("viewBox", `${T.startx} -25 ${_} ${v + n}`), u.attr("preserveAspectRatio", "xMinYMin meet"), u.attr("height", v + n + 25);
762
- }, S = {
763
- data: {
764
- startx: void 0,
765
- stopx: void 0,
766
- starty: void 0,
767
- stopy: void 0
768
- },
769
- verticalPos: 0,
770
- sequenceItems: [],
771
- init: function() {
772
- this.sequenceItems = [], this.data = {
773
- startx: void 0,
774
- stopx: void 0,
775
- starty: void 0,
776
- stopy: void 0
777
- }, this.verticalPos = 0;
778
- },
779
- updateVal: function(e, t, i, r) {
780
- e[t] === void 0 ? e[t] = i : e[t] = r(i, e[t]);
781
- },
782
- updateBounds: function(e, t, i, r) {
783
- const s = V().journey, o = this;
784
- let l = 0;
785
- function y(u) {
786
- return function(g) {
787
- l++;
788
- const f = o.sequenceItems.length - l + 1;
789
- o.updateVal(g, "starty", t - f * s.boxMargin, Math.min), o.updateVal(g, "stopy", r + f * s.boxMargin, Math.max), o.updateVal(S.data, "startx", e - f * s.boxMargin, Math.min), o.updateVal(S.data, "stopx", i + f * s.boxMargin, Math.max), u !== "activation" && (o.updateVal(g, "startx", e - f * s.boxMargin, Math.min), o.updateVal(g, "stopx", i + f * s.boxMargin, Math.max), o.updateVal(S.data, "starty", t - f * s.boxMargin, Math.min), o.updateVal(S.data, "stopy", r + f * s.boxMargin, Math.max));
790
- };
791
- }
792
- this.sequenceItems.forEach(y());
793
- },
794
- insert: function(e, t, i, r) {
795
- const s = Math.min(e, i), o = Math.max(e, i), l = Math.min(t, r), y = Math.max(t, r);
796
- this.updateVal(S.data, "startx", s, Math.min), this.updateVal(S.data, "starty", l, Math.min), this.updateVal(S.data, "stopx", o, Math.max), this.updateVal(S.data, "stopy", y, Math.max), this.updateBounds(s, l, o, y);
797
- },
798
- bumpVerticalPos: function(e) {
799
- this.verticalPos = this.verticalPos + e, this.data.stopy = this.verticalPos;
800
- },
801
- getVerticalPos: function() {
802
- return this.verticalPos;
803
- },
804
- getBounds: function() {
805
- return this.data;
806
- }
807
- }, J = W.sectionFills, lt = W.sectionColours, Ht = function(e, t, i) {
808
- const r = V().journey;
809
- let s = "";
810
- const o = r.height * 2 + r.diagramMarginY, l = i + o;
811
- let y = 0, u = "#CCC", x = "black", g = 0;
812
- for (const [f, p] of t.entries()) {
813
- if (s !== p.section) {
814
- u = J[y % J.length], g = y % J.length, x = lt[y % lt.length];
815
- let v = 0;
816
- const _ = p.section;
817
- for (let a = f; a < t.length && t[a].section == _; a++)
818
- v = v + 1;
819
- const n = {
820
- x: f * r.taskMargin + f * r.width + C,
821
- y: 50,
822
- text: p.section,
823
- fill: u,
824
- num: g,
825
- colour: x,
826
- taskCount: v
827
- };
828
- j.drawSection(e, n, r), s = p.section, y++;
829
- }
830
- const T = p.people.reduce((v, _) => (P[_] && (v[_] = P[_]), v), {});
831
- p.x = f * r.taskMargin + f * r.width + C, p.y = l, p.width = r.diagramMarginX, p.height = r.diagramMarginY, p.colour = x, p.fill = u, p.num = g, p.actors = T, j.drawTask(e, p, r), S.insert(p.x, p.y, p.x + p.width + r.taskMargin, 300 + 5 * 30);
832
- }
833
- }, ct = {
834
- setConf: Wt,
835
- draw: Gt
836
- }, Kt = {
837
- parser: Mt,
838
- db: nt,
839
- renderer: ct,
840
- styles: Rt,
841
- init: (e) => {
842
- ct.setConf(e.journey), nt.clear();
843
- }
844
- };
845
- export {
846
- Kt as diagram
847
- };