UNPKG

117 kBJavaScriptView Raw
1import { s as setAccTitle, g as getAccTitle, a as getAccDescription, b as setAccDescription, c as getConfig, d as sanitizeText, m as mermaidAPI, e as common, f as assignWithDepth, h as calculateTextWidth, l as log, i as configureSvgSize, w as wrapLabel, j as calculateTextHeight } from "./mermaid-a953d906.js";
2import { select } from "d3";
3import { d as drawRect$1, g as getNoteRect } from "./svgDrawCommon-f26cad39.js";
4import { sanitizeUrl } from "@braintree/sanitize-url";
5import "ts-dedent";
6import "dayjs/esm/index.js";
7import "dompurify";
8import "khroma";
9import "lodash-es/memoize.js";
10import "stylis";
11import "lodash-es/isEmpty.js";
12var parser = function() {
13 var o = function(k, v, o2, l) {
14 for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
15 ;
16 return o2;
17 }, $V0 = [1, 6], $V1 = [1, 7], $V2 = [1, 8], $V3 = [1, 9], $V4 = [1, 16], $V5 = [1, 11], $V6 = [1, 12], $V7 = [1, 13], $V8 = [1, 14], $V9 = [1, 15], $Va = [1, 27], $Vb = [1, 33], $Vc = [1, 34], $Vd = [1, 35], $Ve = [1, 36], $Vf = [1, 37], $Vg = [1, 72], $Vh = [1, 73], $Vi = [1, 74], $Vj = [1, 75], $Vk = [1, 76], $Vl = [1, 77], $Vm = [1, 78], $Vn = [1, 38], $Vo = [1, 39], $Vp = [1, 40], $Vq = [1, 41], $Vr = [1, 42], $Vs = [1, 43], $Vt = [1, 44], $Vu = [1, 45], $Vv = [1, 46], $Vw = [1, 47], $Vx = [1, 48], $Vy = [1, 49], $Vz = [1, 50], $VA = [1, 51], $VB = [1, 52], $VC = [1, 53], $VD = [1, 54], $VE = [1, 55], $VF = [1, 56], $VG = [1, 57], $VH = [1, 59], $VI = [1, 60], $VJ = [1, 61], $VK = [1, 62], $VL = [1, 63], $VM = [1, 64], $VN = [1, 65], $VO = [1, 66], $VP = [1, 67], $VQ = [1, 68], $VR = [1, 69], $VS = [24, 52], $VT = [24, 44, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84], $VU = [15, 24, 44, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84], $VV = [1, 94], $VW = [1, 95], $VX = [1, 96], $VY = [1, 97], $VZ = [15, 24, 52], $V_ = [7, 8, 9, 10, 18, 22, 25, 26, 27, 28], $V$ = [15, 24, 43, 52], $V01 = [15, 24, 43, 52, 86, 87, 89, 90], $V11 = [15, 43], $V21 = [44, 46, 47, 48, 49, 50, 51, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84];
18 var parser2 = {
19 trace: function trace() {
20 },
21 yy: {},
22 symbols_: { "error": 2, "start": 3, "mermaidDoc": 4, "direction": 5, "directive": 6, "direction_tb": 7, "direction_bt": 8, "direction_rl": 9, "direction_lr": 10, "graphConfig": 11, "openDirective": 12, "typeDirective": 13, "closeDirective": 14, "NEWLINE": 15, ":": 16, "argDirective": 17, "open_directive": 18, "type_directive": 19, "arg_directive": 20, "close_directive": 21, "C4_CONTEXT": 22, "statements": 23, "EOF": 24, "C4_CONTAINER": 25, "C4_COMPONENT": 26, "C4_DYNAMIC": 27, "C4_DEPLOYMENT": 28, "otherStatements": 29, "diagramStatements": 30, "otherStatement": 31, "title": 32, "accDescription": 33, "acc_title": 34, "acc_title_value": 35, "acc_descr": 36, "acc_descr_value": 37, "acc_descr_multiline_value": 38, "boundaryStatement": 39, "boundaryStartStatement": 40, "boundaryStopStatement": 41, "boundaryStart": 42, "LBRACE": 43, "ENTERPRISE_BOUNDARY": 44, "attributes": 45, "SYSTEM_BOUNDARY": 46, "BOUNDARY": 47, "CONTAINER_BOUNDARY": 48, "NODE": 49, "NODE_L": 50, "NODE_R": 51, "RBRACE": 52, "diagramStatement": 53, "PERSON": 54, "PERSON_EXT": 55, "SYSTEM": 56, "SYSTEM_DB": 57, "SYSTEM_QUEUE": 58, "SYSTEM_EXT": 59, "SYSTEM_EXT_DB": 60, "SYSTEM_EXT_QUEUE": 61, "CONTAINER": 62, "CONTAINER_DB": 63, "CONTAINER_QUEUE": 64, "CONTAINER_EXT": 65, "CONTAINER_EXT_DB": 66, "CONTAINER_EXT_QUEUE": 67, "COMPONENT": 68, "COMPONENT_DB": 69, "COMPONENT_QUEUE": 70, "COMPONENT_EXT": 71, "COMPONENT_EXT_DB": 72, "COMPONENT_EXT_QUEUE": 73, "REL": 74, "BIREL": 75, "REL_U": 76, "REL_D": 77, "REL_L": 78, "REL_R": 79, "REL_B": 80, "REL_INDEX": 81, "UPDATE_EL_STYLE": 82, "UPDATE_REL_STYLE": 83, "UPDATE_LAYOUT_CONFIG": 84, "attribute": 85, "STR": 86, "STR_KEY": 87, "STR_VALUE": 88, "ATTRIBUTE": 89, "ATTRIBUTE_EMPTY": 90, "$accept": 0, "$end": 1 },
23 terminals_: { 2: "error", 7: "direction_tb", 8: "direction_bt", 9: "direction_rl", 10: "direction_lr", 15: "NEWLINE", 16: ":", 18: "open_directive", 19: "type_directive", 20: "arg_directive", 21: "close_directive", 22: "C4_CONTEXT", 24: "EOF", 25: "C4_CONTAINER", 26: "C4_COMPONENT", 27: "C4_DYNAMIC", 28: "C4_DEPLOYMENT", 32: "title", 33: "accDescription", 34: "acc_title", 35: "acc_title_value", 36: "acc_descr", 37: "acc_descr_value", 38: "acc_descr_multiline_value", 43: "LBRACE", 44: "ENTERPRISE_BOUNDARY", 46: "SYSTEM_BOUNDARY", 47: "BOUNDARY", 48: "CONTAINER_BOUNDARY", 49: "NODE", 50: "NODE_L", 51: "NODE_R", 52: "RBRACE", 54: "PERSON", 55: "PERSON_EXT", 56: "SYSTEM", 57: "SYSTEM_DB", 58: "SYSTEM_QUEUE", 59: "SYSTEM_EXT", 60: "SYSTEM_EXT_DB", 61: "SYSTEM_EXT_QUEUE", 62: "CONTAINER", 63: "CONTAINER_DB", 64: "CONTAINER_QUEUE", 65: "CONTAINER_EXT", 66: "CONTAINER_EXT_DB", 67: "CONTAINER_EXT_QUEUE", 68: "COMPONENT", 69: "COMPONENT_DB", 70: "COMPONENT_QUEUE", 71: "COMPONENT_EXT", 72: "COMPONENT_EXT_DB", 73: "COMPONENT_EXT_QUEUE", 74: "REL", 75: "BIREL", 76: "REL_U", 77: "REL_D", 78: "REL_L", 79: "REL_R", 80: "REL_B", 81: "REL_INDEX", 82: "UPDATE_EL_STYLE", 83: "UPDATE_REL_STYLE", 84: "UPDATE_LAYOUT_CONFIG", 86: "STR", 87: "STR_KEY", 88: "STR_VALUE", 89: "ATTRIBUTE", 90: "ATTRIBUTE_EMPTY" },
24 productions_: [0, [3, 1], [3, 1], [3, 2], [5, 1], [5, 1], [5, 1], [5, 1], [4, 1], [6, 4], [6, 6], [12, 1], [13, 1], [17, 1], [14, 1], [11, 4], [11, 4], [11, 4], [11, 4], [11, 4], [23, 1], [23, 1], [23, 2], [29, 1], [29, 2], [29, 3], [31, 1], [31, 1], [31, 2], [31, 2], [31, 1], [39, 3], [40, 3], [40, 3], [40, 4], [42, 2], [42, 2], [42, 2], [42, 2], [42, 2], [42, 2], [42, 2], [41, 1], [30, 1], [30, 2], [30, 3], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 1], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [45, 1], [45, 2], [85, 1], [85, 2], [85, 1], [85, 1]],
25 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
26 var $0 = $$.length - 1;
27 switch (yystate) {
28 case 4:
29 yy.setDirection("TB");
30 break;
31 case 5:
32 yy.setDirection("BT");
33 break;
34 case 6:
35 yy.setDirection("RL");
36 break;
37 case 7:
38 yy.setDirection("LR");
39 break;
40 case 11:
41 yy.parseDirective("%%{", "open_directive");
42 break;
43 case 12:
44 break;
45 case 13:
46 $$[$0] = $$[$0].trim().replace(/'/g, '"');
47 yy.parseDirective($$[$0], "arg_directive");
48 break;
49 case 14:
50 yy.parseDirective("}%%", "close_directive", "c4Context");
51 break;
52 case 15:
53 case 16:
54 case 17:
55 case 18:
56 case 19:
57 yy.setC4Type($$[$0 - 3]);
58 break;
59 case 26:
60 yy.setTitle($$[$0].substring(6));
61 this.$ = $$[$0].substring(6);
62 break;
63 case 27:
64 yy.setAccDescription($$[$0].substring(15));
65 this.$ = $$[$0].substring(15);
66 break;
67 case 28:
68 this.$ = $$[$0].trim();
69 yy.setTitle(this.$);
70 break;
71 case 29:
72 case 30:
73 this.$ = $$[$0].trim();
74 yy.setAccDescription(this.$);
75 break;
76 case 35:
77 case 36:
78 $$[$0].splice(2, 0, "ENTERPRISE");
79 yy.addPersonOrSystemBoundary(...$$[$0]);
80 this.$ = $$[$0];
81 break;
82 case 37:
83 yy.addPersonOrSystemBoundary(...$$[$0]);
84 this.$ = $$[$0];
85 break;
86 case 38:
87 $$[$0].splice(2, 0, "CONTAINER");
88 yy.addContainerBoundary(...$$[$0]);
89 this.$ = $$[$0];
90 break;
91 case 39:
92 yy.addDeploymentNode("node", ...$$[$0]);
93 this.$ = $$[$0];
94 break;
95 case 40:
96 yy.addDeploymentNode("nodeL", ...$$[$0]);
97 this.$ = $$[$0];
98 break;
99 case 41:
100 yy.addDeploymentNode("nodeR", ...$$[$0]);
101 this.$ = $$[$0];
102 break;
103 case 42:
104 yy.popBoundaryParseStack();
105 break;
106 case 46:
107 yy.addPersonOrSystem("person", ...$$[$0]);
108 this.$ = $$[$0];
109 break;
110 case 47:
111 yy.addPersonOrSystem("external_person", ...$$[$0]);
112 this.$ = $$[$0];
113 break;
114 case 48:
115 yy.addPersonOrSystem("system", ...$$[$0]);
116 this.$ = $$[$0];
117 break;
118 case 49:
119 yy.addPersonOrSystem("system_db", ...$$[$0]);
120 this.$ = $$[$0];
121 break;
122 case 50:
123 yy.addPersonOrSystem("system_queue", ...$$[$0]);
124 this.$ = $$[$0];
125 break;
126 case 51:
127 yy.addPersonOrSystem("external_system", ...$$[$0]);
128 this.$ = $$[$0];
129 break;
130 case 52:
131 yy.addPersonOrSystem("external_system_db", ...$$[$0]);
132 this.$ = $$[$0];
133 break;
134 case 53:
135 yy.addPersonOrSystem("external_system_queue", ...$$[$0]);
136 this.$ = $$[$0];
137 break;
138 case 54:
139 yy.addContainer("container", ...$$[$0]);
140 this.$ = $$[$0];
141 break;
142 case 55:
143 yy.addContainer("container_db", ...$$[$0]);
144 this.$ = $$[$0];
145 break;
146 case 56:
147 yy.addContainer("container_queue", ...$$[$0]);
148 this.$ = $$[$0];
149 break;
150 case 57:
151 yy.addContainer("external_container", ...$$[$0]);
152 this.$ = $$[$0];
153 break;
154 case 58:
155 yy.addContainer("external_container_db", ...$$[$0]);
156 this.$ = $$[$0];
157 break;
158 case 59:
159 yy.addContainer("external_container_queue", ...$$[$0]);
160 this.$ = $$[$0];
161 break;
162 case 60:
163 yy.addComponent("component", ...$$[$0]);
164 this.$ = $$[$0];
165 break;
166 case 61:
167 yy.addComponent("component_db", ...$$[$0]);
168 this.$ = $$[$0];
169 break;
170 case 62:
171 yy.addComponent("component_queue", ...$$[$0]);
172 this.$ = $$[$0];
173 break;
174 case 63:
175 yy.addComponent("external_component", ...$$[$0]);
176 this.$ = $$[$0];
177 break;
178 case 64:
179 yy.addComponent("external_component_db", ...$$[$0]);
180 this.$ = $$[$0];
181 break;
182 case 65:
183 yy.addComponent("external_component_queue", ...$$[$0]);
184 this.$ = $$[$0];
185 break;
186 case 67:
187 yy.addRel("rel", ...$$[$0]);
188 this.$ = $$[$0];
189 break;
190 case 68:
191 yy.addRel("birel", ...$$[$0]);
192 this.$ = $$[$0];
193 break;
194 case 69:
195 yy.addRel("rel_u", ...$$[$0]);
196 this.$ = $$[$0];
197 break;
198 case 70:
199 yy.addRel("rel_d", ...$$[$0]);
200 this.$ = $$[$0];
201 break;
202 case 71:
203 yy.addRel("rel_l", ...$$[$0]);
204 this.$ = $$[$0];
205 break;
206 case 72:
207 yy.addRel("rel_r", ...$$[$0]);
208 this.$ = $$[$0];
209 break;
210 case 73:
211 yy.addRel("rel_b", ...$$[$0]);
212 this.$ = $$[$0];
213 break;
214 case 74:
215 $$[$0].splice(0, 1);
216 yy.addRel("rel", ...$$[$0]);
217 this.$ = $$[$0];
218 break;
219 case 75:
220 yy.updateElStyle("update_el_style", ...$$[$0]);
221 this.$ = $$[$0];
222 break;
223 case 76:
224 yy.updateRelStyle("update_rel_style", ...$$[$0]);
225 this.$ = $$[$0];
226 break;
227 case 77:
228 yy.updateLayoutConfig("update_layout_config", ...$$[$0]);
229 this.$ = $$[$0];
230 break;
231 case 78:
232 this.$ = [$$[$0]];
233 break;
234 case 79:
235 $$[$0].unshift($$[$0 - 1]);
236 this.$ = $$[$0];
237 break;
238 case 80:
239 case 82:
240 this.$ = $$[$0].trim();
241 break;
242 case 81:
243 let kv = {};
244 kv[$$[$0 - 1].trim()] = $$[$0].trim();
245 this.$ = kv;
246 break;
247 case 83:
248 this.$ = "";
249 break;
250 }
251 },
252 table: [{ 3: 1, 4: 2, 5: 3, 6: 4, 7: $V0, 8: $V1, 9: $V2, 10: $V3, 11: 5, 12: 10, 18: $V4, 22: $V5, 25: $V6, 26: $V7, 27: $V8, 28: $V9 }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 3: 17, 4: 2, 5: 3, 6: 4, 7: $V0, 8: $V1, 9: $V2, 10: $V3, 11: 5, 12: 10, 18: $V4, 22: $V5, 25: $V6, 26: $V7, 27: $V8, 28: $V9 }, { 1: [2, 8] }, { 1: [2, 4] }, { 1: [2, 5] }, { 1: [2, 6] }, { 1: [2, 7] }, { 13: 18, 19: [1, 19] }, { 15: [1, 20] }, { 15: [1, 21] }, { 15: [1, 22] }, { 15: [1, 23] }, { 15: [1, 24] }, { 19: [2, 11] }, { 1: [2, 3] }, { 14: 25, 16: [1, 26], 21: $Va }, o([16, 21], [2, 12]), { 23: 28, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 23: 79, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 23: 80, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 23: 81, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 23: 82, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 15: [1, 83] }, { 17: 84, 20: [1, 85] }, { 15: [2, 14] }, { 24: [1, 86] }, o($VS, [2, 20], { 53: 32, 39: 58, 40: 70, 42: 71, 30: 87, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }), o($VS, [2, 21]), o($VT, [2, 23], { 15: [1, 88] }), o($VS, [2, 43], { 15: [1, 89] }), o($VU, [2, 26]), o($VU, [2, 27]), { 35: [1, 90] }, { 37: [1, 91] }, o($VU, [2, 30]), { 45: 92, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 98, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 99, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 100, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 101, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 102, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 103, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 104, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 105, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 106, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 107, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 108, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 109, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 110, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 111, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 112, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 113, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 114, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 115, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 116, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, o($VZ, [2, 66]), { 45: 117, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 118, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 119, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 120, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 121, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 122, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 123, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 124, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 125, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 126, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 127, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 30: 128, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 15: [1, 130], 43: [1, 129] }, { 45: 131, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 132, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 133, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 134, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 135, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 136, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 137, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 24: [1, 138] }, { 24: [1, 139] }, { 24: [1, 140] }, { 24: [1, 141] }, o($V_, [2, 9]), { 14: 142, 21: $Va }, { 21: [2, 13] }, { 1: [2, 15] }, o($VS, [2, 22]), o($VT, [2, 24], { 31: 31, 29: 143, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf }), o($VS, [2, 44], { 29: 29, 30: 30, 31: 31, 53: 32, 39: 58, 40: 70, 42: 71, 23: 144, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }), o($VU, [2, 28]), o($VU, [2, 29]), o($VZ, [2, 46]), o($V$, [2, 78], { 85: 93, 45: 145, 86: $VV, 87: $VW, 89: $VX, 90: $VY }), o($V01, [2, 80]), { 88: [1, 146] }, o($V01, [2, 82]), o($V01, [2, 83]), o($VZ, [2, 47]), o($VZ, [2, 48]), o($VZ, [2, 49]), o($VZ, [2, 50]), o($VZ, [2, 51]), o($VZ, [2, 52]), o($VZ, [2, 53]), o($VZ, [2, 54]), o($VZ, [2, 55]), o($VZ, [2, 56]), o($VZ, [2, 57]), o($VZ, [2, 58]), o($VZ, [2, 59]), o($VZ, [2, 60]), o($VZ, [2, 61]), o($VZ, [2, 62]), o($VZ, [2, 63]), o($VZ, [2, 64]), o($VZ, [2, 65]), o($VZ, [2, 67]), o($VZ, [2, 68]), o($VZ, [2, 69]), o($VZ, [2, 70]), o($VZ, [2, 71]), o($VZ, [2, 72]), o($VZ, [2, 73]), o($VZ, [2, 74]), o($VZ, [2, 75]), o($VZ, [2, 76]), o($VZ, [2, 77]), { 41: 147, 52: [1, 148] }, { 15: [1, 149] }, { 43: [1, 150] }, o($V11, [2, 35]), o($V11, [2, 36]), o($V11, [2, 37]), o($V11, [2, 38]), o($V11, [2, 39]), o($V11, [2, 40]), o($V11, [2, 41]), { 1: [2, 16] }, { 1: [2, 17] }, { 1: [2, 18] }, { 1: [2, 19] }, { 15: [1, 151] }, o($VT, [2, 25]), o($VS, [2, 45]), o($V$, [2, 79]), o($V01, [2, 81]), o($VZ, [2, 31]), o($VZ, [2, 42]), o($V21, [2, 32]), o($V21, [2, 33], { 15: [1, 152] }), o($V_, [2, 10]), o($V21, [2, 34])],
253 defaultActions: { 2: [2, 1], 3: [2, 2], 5: [2, 8], 6: [2, 4], 7: [2, 5], 8: [2, 6], 9: [2, 7], 16: [2, 11], 17: [2, 3], 27: [2, 14], 85: [2, 13], 86: [2, 15], 138: [2, 16], 139: [2, 17], 140: [2, 18], 141: [2, 19] },
254 parseError: function parseError(str, hash) {
255 if (hash.recoverable) {
256 this.trace(str);
257 } else {
258 var error = new Error(str);
259 error.hash = hash;
260 throw error;
261 }
262 },
263 parse: function parse(input) {
264 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
265 var args = lstack.slice.call(arguments, 1);
266 var lexer2 = Object.create(this.lexer);
267 var sharedState = { yy: {} };
268 for (var k in this.yy) {
269 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
270 sharedState.yy[k] = this.yy[k];
271 }
272 }
273 lexer2.setInput(input, sharedState.yy);
274 sharedState.yy.lexer = lexer2;
275 sharedState.yy.parser = this;
276 if (typeof lexer2.yylloc == "undefined") {
277 lexer2.yylloc = {};
278 }
279 var yyloc = lexer2.yylloc;
280 lstack.push(yyloc);
281 var ranges = lexer2.options && lexer2.options.ranges;
282 if (typeof sharedState.yy.parseError === "function") {
283 this.parseError = sharedState.yy.parseError;
284 } else {
285 this.parseError = Object.getPrototypeOf(this).parseError;
286 }
287 function lex() {
288 var token;
289 token = tstack.pop() || lexer2.lex() || EOF;
290 if (typeof token !== "number") {
291 if (token instanceof Array) {
292 tstack = token;
293 token = tstack.pop();
294 }
295 token = self.symbols_[token] || token;
296 }
297 return token;
298 }
299 var symbol, state, action, r, yyval = {}, p, len, newState, expected;
300 while (true) {
301 state = stack[stack.length - 1];
302 if (this.defaultActions[state]) {
303 action = this.defaultActions[state];
304 } else {
305 if (symbol === null || typeof symbol == "undefined") {
306 symbol = lex();
307 }
308 action = table[state] && table[state][symbol];
309 }
310 if (typeof action === "undefined" || !action.length || !action[0]) {
311 var errStr = "";
312 expected = [];
313 for (p in table[state]) {
314 if (this.terminals_[p] && p > TERROR) {
315 expected.push("'" + this.terminals_[p] + "'");
316 }
317 }
318 if (lexer2.showPosition) {
319 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
320 } else {
321 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
322 }
323 this.parseError(errStr, {
324 text: lexer2.match,
325 token: this.terminals_[symbol] || symbol,
326 line: lexer2.yylineno,
327 loc: yyloc,
328 expected
329 });
330 }
331 if (action[0] instanceof Array && action.length > 1) {
332 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
333 }
334 switch (action[0]) {
335 case 1:
336 stack.push(symbol);
337 vstack.push(lexer2.yytext);
338 lstack.push(lexer2.yylloc);
339 stack.push(action[1]);
340 symbol = null;
341 {
342 yyleng = lexer2.yyleng;
343 yytext = lexer2.yytext;
344 yylineno = lexer2.yylineno;
345 yyloc = lexer2.yylloc;
346 }
347 break;
348 case 2:
349 len = this.productions_[action[1]][1];
350 yyval.$ = vstack[vstack.length - len];
351 yyval._$ = {
352 first_line: lstack[lstack.length - (len || 1)].first_line,
353 last_line: lstack[lstack.length - 1].last_line,
354 first_column: lstack[lstack.length - (len || 1)].first_column,
355 last_column: lstack[lstack.length - 1].last_column
356 };
357 if (ranges) {
358 yyval._$.range = [
359 lstack[lstack.length - (len || 1)].range[0],
360 lstack[lstack.length - 1].range[1]
361 ];
362 }
363 r = this.performAction.apply(yyval, [
364 yytext,
365 yyleng,
366 yylineno,
367 sharedState.yy,
368 action[1],
369 vstack,
370 lstack
371 ].concat(args));
372 if (typeof r !== "undefined") {
373 return r;
374 }
375 if (len) {
376 stack = stack.slice(0, -1 * len * 2);
377 vstack = vstack.slice(0, -1 * len);
378 lstack = lstack.slice(0, -1 * len);
379 }
380 stack.push(this.productions_[action[1]][0]);
381 vstack.push(yyval.$);
382 lstack.push(yyval._$);
383 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
384 stack.push(newState);
385 break;
386 case 3:
387 return true;
388 }
389 }
390 return true;
391 }
392 };
393 var lexer = function() {
394 var lexer2 = {
395 EOF: 1,
396 parseError: function parseError(str, hash) {
397 if (this.yy.parser) {
398 this.yy.parser.parseError(str, hash);
399 } else {
400 throw new Error(str);
401 }
402 },
403 // resets the lexer, sets new input
404 setInput: function(input, yy) {
405 this.yy = yy || this.yy || {};
406 this._input = input;
407 this._more = this._backtrack = this.done = false;
408 this.yylineno = this.yyleng = 0;
409 this.yytext = this.matched = this.match = "";
410 this.conditionStack = ["INITIAL"];
411 this.yylloc = {
412 first_line: 1,
413 first_column: 0,
414 last_line: 1,
415 last_column: 0
416 };
417 if (this.options.ranges) {
418 this.yylloc.range = [0, 0];
419 }
420 this.offset = 0;
421 return this;
422 },
423 // consumes and returns one char from the input
424 input: function() {
425 var ch = this._input[0];
426 this.yytext += ch;
427 this.yyleng++;
428 this.offset++;
429 this.match += ch;
430 this.matched += ch;
431 var lines = ch.match(/(?:\r\n?|\n).*/g);
432 if (lines) {
433 this.yylineno++;
434 this.yylloc.last_line++;
435 } else {
436 this.yylloc.last_column++;
437 }
438 if (this.options.ranges) {
439 this.yylloc.range[1]++;
440 }
441 this._input = this._input.slice(1);
442 return ch;
443 },
444 // unshifts one char (or a string) into the input
445 unput: function(ch) {
446 var len = ch.length;
447 var lines = ch.split(/(?:\r\n?|\n)/g);
448 this._input = ch + this._input;
449 this.yytext = this.yytext.substr(0, this.yytext.length - len);
450 this.offset -= len;
451 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
452 this.match = this.match.substr(0, this.match.length - 1);
453 this.matched = this.matched.substr(0, this.matched.length - 1);
454 if (lines.length - 1) {
455 this.yylineno -= lines.length - 1;
456 }
457 var r = this.yylloc.range;
458 this.yylloc = {
459 first_line: this.yylloc.first_line,
460 last_line: this.yylineno + 1,
461 first_column: this.yylloc.first_column,
462 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
463 };
464 if (this.options.ranges) {
465 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
466 }
467 this.yyleng = this.yytext.length;
468 return this;
469 },
470 // When called from action, caches matched text and appends it on next action
471 more: function() {
472 this._more = true;
473 return this;
474 },
475 // 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.
476 reject: function() {
477 if (this.options.backtrack_lexer) {
478 this._backtrack = true;
479 } else {
480 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(), {
481 text: "",
482 token: null,
483 line: this.yylineno
484 });
485 }
486 return this;
487 },
488 // retain first n characters of the match
489 less: function(n) {
490 this.unput(this.match.slice(n));
491 },
492 // displays already matched input, i.e. for error messages
493 pastInput: function() {
494 var past = this.matched.substr(0, this.matched.length - this.match.length);
495 return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
496 },
497 // displays upcoming input, i.e. for error messages
498 upcomingInput: function() {
499 var next = this.match;
500 if (next.length < 20) {
501 next += this._input.substr(0, 20 - next.length);
502 }
503 return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
504 },
505 // displays the character position where the lexing error occurred, i.e. for error messages
506 showPosition: function() {
507 var pre = this.pastInput();
508 var c2 = new Array(pre.length + 1).join("-");
509 return pre + this.upcomingInput() + "\n" + c2 + "^";
510 },
511 // test the lexed token: return FALSE when not a match, otherwise return token
512 test_match: function(match, indexed_rule) {
513 var token, lines, backup;
514 if (this.options.backtrack_lexer) {
515 backup = {
516 yylineno: this.yylineno,
517 yylloc: {
518 first_line: this.yylloc.first_line,
519 last_line: this.last_line,
520 first_column: this.yylloc.first_column,
521 last_column: this.yylloc.last_column
522 },
523 yytext: this.yytext,
524 match: this.match,
525 matches: this.matches,
526 matched: this.matched,
527 yyleng: this.yyleng,
528 offset: this.offset,
529 _more: this._more,
530 _input: this._input,
531 yy: this.yy,
532 conditionStack: this.conditionStack.slice(0),
533 done: this.done
534 };
535 if (this.options.ranges) {
536 backup.yylloc.range = this.yylloc.range.slice(0);
537 }
538 }
539 lines = match[0].match(/(?:\r\n?|\n).*/g);
540 if (lines) {
541 this.yylineno += lines.length;
542 }
543 this.yylloc = {
544 first_line: this.yylloc.last_line,
545 last_line: this.yylineno + 1,
546 first_column: this.yylloc.last_column,
547 last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
548 };
549 this.yytext += match[0];
550 this.match += match[0];
551 this.matches = match;
552 this.yyleng = this.yytext.length;
553 if (this.options.ranges) {
554 this.yylloc.range = [this.offset, this.offset += this.yyleng];
555 }
556 this._more = false;
557 this._backtrack = false;
558 this._input = this._input.slice(match[0].length);
559 this.matched += match[0];
560 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
561 if (this.done && this._input) {
562 this.done = false;
563 }
564 if (token) {
565 return token;
566 } else if (this._backtrack) {
567 for (var k in backup) {
568 this[k] = backup[k];
569 }
570 return false;
571 }
572 return false;
573 },
574 // return next match in input
575 next: function() {
576 if (this.done) {
577 return this.EOF;
578 }
579 if (!this._input) {
580 this.done = true;
581 }
582 var token, match, tempMatch, index;
583 if (!this._more) {
584 this.yytext = "";
585 this.match = "";
586 }
587 var rules = this._currentRules();
588 for (var i = 0; i < rules.length; i++) {
589 tempMatch = this._input.match(this.rules[rules[i]]);
590 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
591 match = tempMatch;
592 index = i;
593 if (this.options.backtrack_lexer) {
594 token = this.test_match(tempMatch, rules[i]);
595 if (token !== false) {
596 return token;
597 } else if (this._backtrack) {
598 match = false;
599 continue;
600 } else {
601 return false;
602 }
603 } else if (!this.options.flex) {
604 break;
605 }
606 }
607 }
608 if (match) {
609 token = this.test_match(match, rules[index]);
610 if (token !== false) {
611 return token;
612 }
613 return false;
614 }
615 if (this._input === "") {
616 return this.EOF;
617 } else {
618 return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
619 text: "",
620 token: null,
621 line: this.yylineno
622 });
623 }
624 },
625 // return next match that has a token
626 lex: function lex() {
627 var r = this.next();
628 if (r) {
629 return r;
630 } else {
631 return this.lex();
632 }
633 },
634 // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
635 begin: function begin(condition) {
636 this.conditionStack.push(condition);
637 },
638 // pop the previously active lexer condition state off the condition stack
639 popState: function popState() {
640 var n = this.conditionStack.length - 1;
641 if (n > 0) {
642 return this.conditionStack.pop();
643 } else {
644 return this.conditionStack[0];
645 }
646 },
647 // produce the lexer rule set which is active for the currently active lexer condition state
648 _currentRules: function _currentRules() {
649 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
650 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
651 } else {
652 return this.conditions["INITIAL"].rules;
653 }
654 },
655 // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
656 topState: function topState(n) {
657 n = this.conditionStack.length - 1 - Math.abs(n || 0);
658 if (n >= 0) {
659 return this.conditionStack[n];
660 } else {
661 return "INITIAL";
662 }
663 },
664 // alias for begin(condition)
665 pushState: function pushState(condition) {
666 this.begin(condition);
667 },
668 // return the number of states currently on the stack
669 stateStackSize: function stateStackSize() {
670 return this.conditionStack.length;
671 },
672 options: {},
673 performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
674 switch ($avoiding_name_collisions) {
675 case 0:
676 this.begin("open_directive");
677 return 18;
678 case 1:
679 return 7;
680 case 2:
681 return 8;
682 case 3:
683 return 9;
684 case 4:
685 return 10;
686 case 5:
687 this.begin("type_directive");
688 return 19;
689 case 6:
690 this.popState();
691 this.begin("arg_directive");
692 return 16;
693 case 7:
694 this.popState();
695 this.popState();
696 return 21;
697 case 8:
698 return 20;
699 case 9:
700 return 32;
701 case 10:
702 return 33;
703 case 11:
704 this.begin("acc_title");
705 return 34;
706 case 12:
707 this.popState();
708 return "acc_title_value";
709 case 13:
710 this.begin("acc_descr");
711 return 36;
712 case 14:
713 this.popState();
714 return "acc_descr_value";
715 case 15:
716 this.begin("acc_descr_multiline");
717 break;
718 case 16:
719 this.popState();
720 break;
721 case 17:
722 return "acc_descr_multiline_value";
723 case 18:
724 break;
725 case 19:
726 c;
727 break;
728 case 20:
729 return 15;
730 case 21:
731 break;
732 case 22:
733 return 22;
734 case 23:
735 return 25;
736 case 24:
737 return 26;
738 case 25:
739 return 27;
740 case 26:
741 return 28;
742 case 27:
743 this.begin("person_ext");
744 return 55;
745 case 28:
746 this.begin("person");
747 return 54;
748 case 29:
749 this.begin("system_ext_queue");
750 return 61;
751 case 30:
752 this.begin("system_ext_db");
753 return 60;
754 case 31:
755 this.begin("system_ext");
756 return 59;
757 case 32:
758 this.begin("system_queue");
759 return 58;
760 case 33:
761 this.begin("system_db");
762 return 57;
763 case 34:
764 this.begin("system");
765 return 56;
766 case 35:
767 this.begin("boundary");
768 return 47;
769 case 36:
770 this.begin("enterprise_boundary");
771 return 44;
772 case 37:
773 this.begin("system_boundary");
774 return 46;
775 case 38:
776 this.begin("container_ext_queue");
777 return 67;
778 case 39:
779 this.begin("container_ext_db");
780 return 66;
781 case 40:
782 this.begin("container_ext");
783 return 65;
784 case 41:
785 this.begin("container_queue");
786 return 64;
787 case 42:
788 this.begin("container_db");
789 return 63;
790 case 43:
791 this.begin("container");
792 return 62;
793 case 44:
794 this.begin("container_boundary");
795 return 48;
796 case 45:
797 this.begin("component_ext_queue");
798 return 73;
799 case 46:
800 this.begin("component_ext_db");
801 return 72;
802 case 47:
803 this.begin("component_ext");
804 return 71;
805 case 48:
806 this.begin("component_queue");
807 return 70;
808 case 49:
809 this.begin("component_db");
810 return 69;
811 case 50:
812 this.begin("component");
813 return 68;
814 case 51:
815 this.begin("node");
816 return 49;
817 case 52:
818 this.begin("node");
819 return 49;
820 case 53:
821 this.begin("node_l");
822 return 50;
823 case 54:
824 this.begin("node_r");
825 return 51;
826 case 55:
827 this.begin("rel");
828 return 74;
829 case 56:
830 this.begin("birel");
831 return 75;
832 case 57:
833 this.begin("rel_u");
834 return 76;
835 case 58:
836 this.begin("rel_u");
837 return 76;
838 case 59:
839 this.begin("rel_d");
840 return 77;
841 case 60:
842 this.begin("rel_d");
843 return 77;
844 case 61:
845 this.begin("rel_l");
846 return 78;
847 case 62:
848 this.begin("rel_l");
849 return 78;
850 case 63:
851 this.begin("rel_r");
852 return 79;
853 case 64:
854 this.begin("rel_r");
855 return 79;
856 case 65:
857 this.begin("rel_b");
858 return 80;
859 case 66:
860 this.begin("rel_index");
861 return 81;
862 case 67:
863 this.begin("update_el_style");
864 return 82;
865 case 68:
866 this.begin("update_rel_style");
867 return 83;
868 case 69:
869 this.begin("update_layout_config");
870 return 84;
871 case 70:
872 return "EOF_IN_STRUCT";
873 case 71:
874 this.begin("attribute");
875 return "ATTRIBUTE_EMPTY";
876 case 72:
877 this.begin("attribute");
878 break;
879 case 73:
880 this.popState();
881 this.popState();
882 break;
883 case 74:
884 return 90;
885 case 75:
886 break;
887 case 76:
888 return 90;
889 case 77:
890 this.begin("string");
891 break;
892 case 78:
893 this.popState();
894 break;
895 case 79:
896 return "STR";
897 case 80:
898 this.begin("string_kv");
899 break;
900 case 81:
901 this.begin("string_kv_key");
902 return "STR_KEY";
903 case 82:
904 this.popState();
905 this.begin("string_kv_value");
906 break;
907 case 83:
908 return "STR_VALUE";
909 case 84:
910 this.popState();
911 this.popState();
912 break;
913 case 85:
914 return "STR";
915 case 86:
916 return "LBRACE";
917 case 87:
918 return "RBRACE";
919 case 88:
920 return "SPACE";
921 case 89:
922 return "EOL";
923 case 90:
924 return 24;
925 }
926 },
927 rules: [/^(?:%%\{)/, /^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:((?:(?!\}%%)[^:.])*))/, /^(?::)/, /^(?:\}%%)/, /^(?:((?:(?!\}%%).|\n)*))/, /^(?:title\s[^#\n;]+)/, /^(?:accDescription\s[^#\n;]+)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/, /^(?:%%[^\n]*(\r?\n)*)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:C4Context\b)/, /^(?:C4Container\b)/, /^(?:C4Component\b)/, /^(?:C4Dynamic\b)/, /^(?:C4Deployment\b)/, /^(?:Person_Ext\b)/, /^(?:Person\b)/, /^(?:SystemQueue_Ext\b)/, /^(?:SystemDb_Ext\b)/, /^(?:System_Ext\b)/, /^(?:SystemQueue\b)/, /^(?:SystemDb\b)/, /^(?:System\b)/, /^(?:Boundary\b)/, /^(?:Enterprise_Boundary\b)/, /^(?:System_Boundary\b)/, /^(?:ContainerQueue_Ext\b)/, /^(?:ContainerDb_Ext\b)/, /^(?:Container_Ext\b)/, /^(?:ContainerQueue\b)/, /^(?:ContainerDb\b)/, /^(?:Container\b)/, /^(?:Container_Boundary\b)/, /^(?:ComponentQueue_Ext\b)/, /^(?:ComponentDb_Ext\b)/, /^(?:Component_Ext\b)/, /^(?:ComponentQueue\b)/, /^(?:ComponentDb\b)/, /^(?:Component\b)/, /^(?:Deployment_Node\b)/, /^(?:Node\b)/, /^(?:Node_L\b)/, /^(?:Node_R\b)/, /^(?:Rel\b)/, /^(?:BiRel\b)/, /^(?:Rel_Up\b)/, /^(?:Rel_U\b)/, /^(?:Rel_Down\b)/, /^(?:Rel_D\b)/, /^(?:Rel_Left\b)/, /^(?:Rel_L\b)/, /^(?:Rel_Right\b)/, /^(?:Rel_R\b)/, /^(?:Rel_Back\b)/, /^(?:RelIndex\b)/, /^(?:UpdateElementStyle\b)/, /^(?:UpdateRelStyle\b)/, /^(?:UpdateLayoutConfig\b)/, /^(?:$)/, /^(?:[(][ ]*[,])/, /^(?:[(])/, /^(?:[)])/, /^(?:,,)/, /^(?:,)/, /^(?:[ ]*["]["])/, /^(?:[ ]*["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:[ ]*[\$])/, /^(?:[^=]*)/, /^(?:[=][ ]*["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:[^,]+)/, /^(?:\{)/, /^(?:\})/, /^(?:[\s]+)/, /^(?:[\n\r]+)/, /^(?:$)/],
928 conditions: { "acc_descr_multiline": { "rules": [16, 17], "inclusive": false }, "acc_descr": { "rules": [14], "inclusive": false }, "acc_title": { "rules": [12], "inclusive": false }, "close_directive": { "rules": [], "inclusive": false }, "arg_directive": { "rules": [7, 8], "inclusive": false }, "type_directive": { "rules": [6, 7], "inclusive": false }, "open_directive": { "rules": [5], "inclusive": false }, "string_kv_value": { "rules": [83, 84], "inclusive": false }, "string_kv_key": { "rules": [82], "inclusive": false }, "string_kv": { "rules": [81], "inclusive": false }, "string": { "rules": [78, 79], "inclusive": false }, "attribute": { "rules": [73, 74, 75, 76, 77, 80, 85], "inclusive": false }, "update_layout_config": { "rules": [70, 71, 72, 73], "inclusive": false }, "update_rel_style": { "rules": [70, 71, 72, 73], "inclusive": false }, "update_el_style": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_b": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_r": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_l": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_d": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_u": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_bi": { "rules": [], "inclusive": false }, "rel": { "rules": [70, 71, 72, 73], "inclusive": false }, "node_r": { "rules": [70, 71, 72, 73], "inclusive": false }, "node_l": { "rules": [70, 71, 72, 73], "inclusive": false }, "node": { "rules": [70, 71, 72, 73], "inclusive": false }, "index": { "rules": [], "inclusive": false }, "rel_index": { "rules": [70, 71, 72, 73], "inclusive": false }, "component_ext_queue": { "rules": [], "inclusive": false }, "component_ext_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "component_ext": { "rules": [70, 71, 72, 73], "inclusive": false }, "component_queue": { "rules": [70, 71, 72, 73], "inclusive": false }, "component_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "component": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_boundary": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_ext_queue": { "rules": [], "inclusive": false }, "container_ext_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_ext": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_queue": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "container": { "rules": [70, 71, 72, 73], "inclusive": false }, "birel": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_boundary": { "rules": [70, 71, 72, 73], "inclusive": false }, "enterprise_boundary": { "rules": [70, 71, 72, 73], "inclusive": false }, "boundary": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_ext_queue": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_ext_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_ext": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_queue": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "system": { "rules": [70, 71, 72, 73], "inclusive": false }, "person_ext": { "rules": [70, 71, 72, 73], "inclusive": false }, "person": { "rules": [70, 71, 72, 73], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 9, 10, 11, 13, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 86, 87, 88, 89, 90], "inclusive": true } }
929 };
930 return lexer2;
931 }();
932 parser2.lexer = lexer;
933 function Parser() {
934 this.yy = {};
935 }
936 Parser.prototype = parser2;
937 parser2.Parser = Parser;
938 return new Parser();
939}();
940parser.parser = parser;
941const c4Parser = parser;
942let c4ShapeArray = [];
943let boundaryParseStack = [""];
944let currentBoundaryParse = "global";
945let parentBoundaryParse = "";
946let boundarys = [
947 {
948 alias: "global",
949 label: { text: "global" },
950 type: { text: "global" },
951 tags: null,
952 link: null,
953 parentBoundary: ""
954 }
955];
956let rels = [];
957let title = "";
958let wrapEnabled = false;
959let c4ShapeInRow$1 = 4;
960let c4BoundaryInRow$1 = 2;
961var c4Type;
962const getC4Type = function() {
963 return c4Type;
964};
965const setC4Type = function(c4TypeParam) {
966 let sanitizedText = sanitizeText(c4TypeParam, getConfig());
967 c4Type = sanitizedText;
968};
969const parseDirective = function(statement, context, type) {
970 mermaidAPI.parseDirective(this, statement, context, type);
971};
972const addRel = function(type, from, to, label, techn, descr, sprite, tags, link) {
973 if (type === void 0 || type === null || from === void 0 || from === null || to === void 0 || to === null || label === void 0 || label === null) {
974 return;
975 }
976 let rel = {};
977 const old = rels.find((rel2) => rel2.from === from && rel2.to === to);
978 if (old) {
979 rel = old;
980 } else {
981 rels.push(rel);
982 }
983 rel.type = type;
984 rel.from = from;
985 rel.to = to;
986 rel.label = { text: label };
987 if (techn === void 0 || techn === null) {
988 rel.techn = { text: "" };
989 } else {
990 if (typeof techn === "object") {
991 let [key, value] = Object.entries(techn)[0];
992 rel[key] = { text: value };
993 } else {
994 rel.techn = { text: techn };
995 }
996 }
997 if (descr === void 0 || descr === null) {
998 rel.descr = { text: "" };
999 } else {
1000 if (typeof descr === "object") {
1001 let [key, value] = Object.entries(descr)[0];
1002 rel[key] = { text: value };
1003 } else {
1004 rel.descr = { text: descr };
1005 }
1006 }
1007 if (typeof sprite === "object") {
1008 let [key, value] = Object.entries(sprite)[0];
1009 rel[key] = value;
1010 } else {
1011 rel.sprite = sprite;
1012 }
1013 if (typeof tags === "object") {
1014 let [key, value] = Object.entries(tags)[0];
1015 rel[key] = value;
1016 } else {
1017 rel.tags = tags;
1018 }
1019 if (typeof link === "object") {
1020 let [key, value] = Object.entries(link)[0];
1021 rel[key] = value;
1022 } else {
1023 rel.link = link;
1024 }
1025 rel.wrap = autoWrap();
1026};
1027const addPersonOrSystem = function(typeC4Shape, alias, label, descr, sprite, tags, link) {
1028 if (alias === null || label === null) {
1029 return;
1030 }
1031 let personOrSystem = {};
1032 const old = c4ShapeArray.find((personOrSystem2) => personOrSystem2.alias === alias);
1033 if (old && alias === old.alias) {
1034 personOrSystem = old;
1035 } else {
1036 personOrSystem.alias = alias;
1037 c4ShapeArray.push(personOrSystem);
1038 }
1039 if (label === void 0 || label === null) {
1040 personOrSystem.label = { text: "" };
1041 } else {
1042 personOrSystem.label = { text: label };
1043 }
1044 if (descr === void 0 || descr === null) {
1045 personOrSystem.descr = { text: "" };
1046 } else {
1047 if (typeof descr === "object") {
1048 let [key, value] = Object.entries(descr)[0];
1049 personOrSystem[key] = { text: value };
1050 } else {
1051 personOrSystem.descr = { text: descr };
1052 }
1053 }
1054 if (typeof sprite === "object") {
1055 let [key, value] = Object.entries(sprite)[0];
1056 personOrSystem[key] = value;
1057 } else {
1058 personOrSystem.sprite = sprite;
1059 }
1060 if (typeof tags === "object") {
1061 let [key, value] = Object.entries(tags)[0];
1062 personOrSystem[key] = value;
1063 } else {
1064 personOrSystem.tags = tags;
1065 }
1066 if (typeof link === "object") {
1067 let [key, value] = Object.entries(link)[0];
1068 personOrSystem[key] = value;
1069 } else {
1070 personOrSystem.link = link;
1071 }
1072 personOrSystem.typeC4Shape = { text: typeC4Shape };
1073 personOrSystem.parentBoundary = currentBoundaryParse;
1074 personOrSystem.wrap = autoWrap();
1075};
1076const addContainer = function(typeC4Shape, alias, label, techn, descr, sprite, tags, link) {
1077 if (alias === null || label === null) {
1078 return;
1079 }
1080 let container = {};
1081 const old = c4ShapeArray.find((container2) => container2.alias === alias);
1082 if (old && alias === old.alias) {
1083 container = old;
1084 } else {
1085 container.alias = alias;
1086 c4ShapeArray.push(container);
1087 }
1088 if (label === void 0 || label === null) {
1089 container.label = { text: "" };
1090 } else {
1091 container.label = { text: label };
1092 }
1093 if (techn === void 0 || techn === null) {
1094 container.techn = { text: "" };
1095 } else {
1096 if (typeof techn === "object") {
1097 let [key, value] = Object.entries(techn)[0];
1098 container[key] = { text: value };
1099 } else {
1100 container.techn = { text: techn };
1101 }
1102 }
1103 if (descr === void 0 || descr === null) {
1104 container.descr = { text: "" };
1105 } else {
1106 if (typeof descr === "object") {
1107 let [key, value] = Object.entries(descr)[0];
1108 container[key] = { text: value };
1109 } else {
1110 container.descr = { text: descr };
1111 }
1112 }
1113 if (typeof sprite === "object") {
1114 let [key, value] = Object.entries(sprite)[0];
1115 container[key] = value;
1116 } else {
1117 container.sprite = sprite;
1118 }
1119 if (typeof tags === "object") {
1120 let [key, value] = Object.entries(tags)[0];
1121 container[key] = value;
1122 } else {
1123 container.tags = tags;
1124 }
1125 if (typeof link === "object") {
1126 let [key, value] = Object.entries(link)[0];
1127 container[key] = value;
1128 } else {
1129 container.link = link;
1130 }
1131 container.wrap = autoWrap();
1132 container.typeC4Shape = { text: typeC4Shape };
1133 container.parentBoundary = currentBoundaryParse;
1134};
1135const addComponent = function(typeC4Shape, alias, label, techn, descr, sprite, tags, link) {
1136 if (alias === null || label === null) {
1137 return;
1138 }
1139 let component = {};
1140 const old = c4ShapeArray.find((component2) => component2.alias === alias);
1141 if (old && alias === old.alias) {
1142 component = old;
1143 } else {
1144 component.alias = alias;
1145 c4ShapeArray.push(component);
1146 }
1147 if (label === void 0 || label === null) {
1148 component.label = { text: "" };
1149 } else {
1150 component.label = { text: label };
1151 }
1152 if (techn === void 0 || techn === null) {
1153 component.techn = { text: "" };
1154 } else {
1155 if (typeof techn === "object") {
1156 let [key, value] = Object.entries(techn)[0];
1157 component[key] = { text: value };
1158 } else {
1159 component.techn = { text: techn };
1160 }
1161 }
1162 if (descr === void 0 || descr === null) {
1163 component.descr = { text: "" };
1164 } else {
1165 if (typeof descr === "object") {
1166 let [key, value] = Object.entries(descr)[0];
1167 component[key] = { text: value };
1168 } else {
1169 component.descr = { text: descr };
1170 }
1171 }
1172 if (typeof sprite === "object") {
1173 let [key, value] = Object.entries(sprite)[0];
1174 component[key] = value;
1175 } else {
1176 component.sprite = sprite;
1177 }
1178 if (typeof tags === "object") {
1179 let [key, value] = Object.entries(tags)[0];
1180 component[key] = value;
1181 } else {
1182 component.tags = tags;
1183 }
1184 if (typeof link === "object") {
1185 let [key, value] = Object.entries(link)[0];
1186 component[key] = value;
1187 } else {
1188 component.link = link;
1189 }
1190 component.wrap = autoWrap();
1191 component.typeC4Shape = { text: typeC4Shape };
1192 component.parentBoundary = currentBoundaryParse;
1193};
1194const addPersonOrSystemBoundary = function(alias, label, type, tags, link) {
1195 if (alias === null || label === null) {
1196 return;
1197 }
1198 let boundary = {};
1199 const old = boundarys.find((boundary2) => boundary2.alias === alias);
1200 if (old && alias === old.alias) {
1201 boundary = old;
1202 } else {
1203 boundary.alias = alias;
1204 boundarys.push(boundary);
1205 }
1206 if (label === void 0 || label === null) {
1207 boundary.label = { text: "" };
1208 } else {
1209 boundary.label = { text: label };
1210 }
1211 if (type === void 0 || type === null) {
1212 boundary.type = { text: "system" };
1213 } else {
1214 if (typeof type === "object") {
1215 let [key, value] = Object.entries(type)[0];
1216 boundary[key] = { text: value };
1217 } else {
1218 boundary.type = { text: type };
1219 }
1220 }
1221 if (typeof tags === "object") {
1222 let [key, value] = Object.entries(tags)[0];
1223 boundary[key] = value;
1224 } else {
1225 boundary.tags = tags;
1226 }
1227 if (typeof link === "object") {
1228 let [key, value] = Object.entries(link)[0];
1229 boundary[key] = value;
1230 } else {
1231 boundary.link = link;
1232 }
1233 boundary.parentBoundary = currentBoundaryParse;
1234 boundary.wrap = autoWrap();
1235 parentBoundaryParse = currentBoundaryParse;
1236 currentBoundaryParse = alias;
1237 boundaryParseStack.push(parentBoundaryParse);
1238};
1239const addContainerBoundary = function(alias, label, type, tags, link) {
1240 if (alias === null || label === null) {
1241 return;
1242 }
1243 let boundary = {};
1244 const old = boundarys.find((boundary2) => boundary2.alias === alias);
1245 if (old && alias === old.alias) {
1246 boundary = old;
1247 } else {
1248 boundary.alias = alias;
1249 boundarys.push(boundary);
1250 }
1251 if (label === void 0 || label === null) {
1252 boundary.label = { text: "" };
1253 } else {
1254 boundary.label = { text: label };
1255 }
1256 if (type === void 0 || type === null) {
1257 boundary.type = { text: "container" };
1258 } else {
1259 if (typeof type === "object") {
1260 let [key, value] = Object.entries(type)[0];
1261 boundary[key] = { text: value };
1262 } else {
1263 boundary.type = { text: type };
1264 }
1265 }
1266 if (typeof tags === "object") {
1267 let [key, value] = Object.entries(tags)[0];
1268 boundary[key] = value;
1269 } else {
1270 boundary.tags = tags;
1271 }
1272 if (typeof link === "object") {
1273 let [key, value] = Object.entries(link)[0];
1274 boundary[key] = value;
1275 } else {
1276 boundary.link = link;
1277 }
1278 boundary.parentBoundary = currentBoundaryParse;
1279 boundary.wrap = autoWrap();
1280 parentBoundaryParse = currentBoundaryParse;
1281 currentBoundaryParse = alias;
1282 boundaryParseStack.push(parentBoundaryParse);
1283};
1284const addDeploymentNode = function(nodeType, alias, label, type, descr, sprite, tags, link) {
1285 if (alias === null || label === null) {
1286 return;
1287 }
1288 let boundary = {};
1289 const old = boundarys.find((boundary2) => boundary2.alias === alias);
1290 if (old && alias === old.alias) {
1291 boundary = old;
1292 } else {
1293 boundary.alias = alias;
1294 boundarys.push(boundary);
1295 }
1296 if (label === void 0 || label === null) {
1297 boundary.label = { text: "" };
1298 } else {
1299 boundary.label = { text: label };
1300 }
1301 if (type === void 0 || type === null) {
1302 boundary.type = { text: "node" };
1303 } else {
1304 if (typeof type === "object") {
1305 let [key, value] = Object.entries(type)[0];
1306 boundary[key] = { text: value };
1307 } else {
1308 boundary.type = { text: type };
1309 }
1310 }
1311 if (descr === void 0 || descr === null) {
1312 boundary.descr = { text: "" };
1313 } else {
1314 if (typeof descr === "object") {
1315 let [key, value] = Object.entries(descr)[0];
1316 boundary[key] = { text: value };
1317 } else {
1318 boundary.descr = { text: descr };
1319 }
1320 }
1321 if (typeof tags === "object") {
1322 let [key, value] = Object.entries(tags)[0];
1323 boundary[key] = value;
1324 } else {
1325 boundary.tags = tags;
1326 }
1327 if (typeof link === "object") {
1328 let [key, value] = Object.entries(link)[0];
1329 boundary[key] = value;
1330 } else {
1331 boundary.link = link;
1332 }
1333 boundary.nodeType = nodeType;
1334 boundary.parentBoundary = currentBoundaryParse;
1335 boundary.wrap = autoWrap();
1336 parentBoundaryParse = currentBoundaryParse;
1337 currentBoundaryParse = alias;
1338 boundaryParseStack.push(parentBoundaryParse);
1339};
1340const popBoundaryParseStack = function() {
1341 currentBoundaryParse = parentBoundaryParse;
1342 boundaryParseStack.pop();
1343 parentBoundaryParse = boundaryParseStack.pop();
1344 boundaryParseStack.push(parentBoundaryParse);
1345};
1346const updateElStyle = function(typeC4Shape, elementName, bgColor, fontColor, borderColor, shadowing, shape, sprite, techn, legendText, legendSprite) {
1347 let old = c4ShapeArray.find((element) => element.alias === elementName);
1348 if (old === void 0) {
1349 old = boundarys.find((element) => element.alias === elementName);
1350 if (old === void 0) {
1351 return;
1352 }
1353 }
1354 if (bgColor !== void 0 && bgColor !== null) {
1355 if (typeof bgColor === "object") {
1356 let [key, value] = Object.entries(bgColor)[0];
1357 old[key] = value;
1358 } else {
1359 old.bgColor = bgColor;
1360 }
1361 }
1362 if (fontColor !== void 0 && fontColor !== null) {
1363 if (typeof fontColor === "object") {
1364 let [key, value] = Object.entries(fontColor)[0];
1365 old[key] = value;
1366 } else {
1367 old.fontColor = fontColor;
1368 }
1369 }
1370 if (borderColor !== void 0 && borderColor !== null) {
1371 if (typeof borderColor === "object") {
1372 let [key, value] = Object.entries(borderColor)[0];
1373 old[key] = value;
1374 } else {
1375 old.borderColor = borderColor;
1376 }
1377 }
1378 if (shadowing !== void 0 && shadowing !== null) {
1379 if (typeof shadowing === "object") {
1380 let [key, value] = Object.entries(shadowing)[0];
1381 old[key] = value;
1382 } else {
1383 old.shadowing = shadowing;
1384 }
1385 }
1386 if (shape !== void 0 && shape !== null) {
1387 if (typeof shape === "object") {
1388 let [key, value] = Object.entries(shape)[0];
1389 old[key] = value;
1390 } else {
1391 old.shape = shape;
1392 }
1393 }
1394 if (sprite !== void 0 && sprite !== null) {
1395 if (typeof sprite === "object") {
1396 let [key, value] = Object.entries(sprite)[0];
1397 old[key] = value;
1398 } else {
1399 old.sprite = sprite;
1400 }
1401 }
1402 if (techn !== void 0 && techn !== null) {
1403 if (typeof techn === "object") {
1404 let [key, value] = Object.entries(techn)[0];
1405 old[key] = value;
1406 } else {
1407 old.techn = techn;
1408 }
1409 }
1410 if (legendText !== void 0 && legendText !== null) {
1411 if (typeof legendText === "object") {
1412 let [key, value] = Object.entries(legendText)[0];
1413 old[key] = value;
1414 } else {
1415 old.legendText = legendText;
1416 }
1417 }
1418 if (legendSprite !== void 0 && legendSprite !== null) {
1419 if (typeof legendSprite === "object") {
1420 let [key, value] = Object.entries(legendSprite)[0];
1421 old[key] = value;
1422 } else {
1423 old.legendSprite = legendSprite;
1424 }
1425 }
1426};
1427const updateRelStyle = function(typeC4Shape, from, to, textColor, lineColor, offsetX, offsetY) {
1428 const old = rels.find((rel) => rel.from === from && rel.to === to);
1429 if (old === void 0) {
1430 return;
1431 }
1432 if (textColor !== void 0 && textColor !== null) {
1433 if (typeof textColor === "object") {
1434 let [key, value] = Object.entries(textColor)[0];
1435 old[key] = value;
1436 } else {
1437 old.textColor = textColor;
1438 }
1439 }
1440 if (lineColor !== void 0 && lineColor !== null) {
1441 if (typeof lineColor === "object") {
1442 let [key, value] = Object.entries(lineColor)[0];
1443 old[key] = value;
1444 } else {
1445 old.lineColor = lineColor;
1446 }
1447 }
1448 if (offsetX !== void 0 && offsetX !== null) {
1449 if (typeof offsetX === "object") {
1450 let [key, value] = Object.entries(offsetX)[0];
1451 old[key] = parseInt(value);
1452 } else {
1453 old.offsetX = parseInt(offsetX);
1454 }
1455 }
1456 if (offsetY !== void 0 && offsetY !== null) {
1457 if (typeof offsetY === "object") {
1458 let [key, value] = Object.entries(offsetY)[0];
1459 old[key] = parseInt(value);
1460 } else {
1461 old.offsetY = parseInt(offsetY);
1462 }
1463 }
1464};
1465const updateLayoutConfig = function(typeC4Shape, c4ShapeInRowParam, c4BoundaryInRowParam) {
1466 let c4ShapeInRowValue = c4ShapeInRow$1;
1467 let c4BoundaryInRowValue = c4BoundaryInRow$1;
1468 if (typeof c4ShapeInRowParam === "object") {
1469 const value = Object.values(c4ShapeInRowParam)[0];
1470 c4ShapeInRowValue = parseInt(value);
1471 } else {
1472 c4ShapeInRowValue = parseInt(c4ShapeInRowParam);
1473 }
1474 if (typeof c4BoundaryInRowParam === "object") {
1475 const value = Object.values(c4BoundaryInRowParam)[0];
1476 c4BoundaryInRowValue = parseInt(value);
1477 } else {
1478 c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam);
1479 }
1480 if (c4ShapeInRowValue >= 1) {
1481 c4ShapeInRow$1 = c4ShapeInRowValue;
1482 }
1483 if (c4BoundaryInRowValue >= 1) {
1484 c4BoundaryInRow$1 = c4BoundaryInRowValue;
1485 }
1486};
1487const getC4ShapeInRow = function() {
1488 return c4ShapeInRow$1;
1489};
1490const getC4BoundaryInRow = function() {
1491 return c4BoundaryInRow$1;
1492};
1493const getCurrentBoundaryParse = function() {
1494 return currentBoundaryParse;
1495};
1496const getParentBoundaryParse = function() {
1497 return parentBoundaryParse;
1498};
1499const getC4ShapeArray = function(parentBoundary) {
1500 if (parentBoundary === void 0 || parentBoundary === null) {
1501 return c4ShapeArray;
1502 } else {
1503 return c4ShapeArray.filter((personOrSystem) => {
1504 return personOrSystem.parentBoundary === parentBoundary;
1505 });
1506 }
1507};
1508const getC4Shape = function(alias) {
1509 return c4ShapeArray.find((personOrSystem) => personOrSystem.alias === alias);
1510};
1511const getC4ShapeKeys = function(parentBoundary) {
1512 return Object.keys(getC4ShapeArray(parentBoundary));
1513};
1514const getBoundarys = function(parentBoundary) {
1515 if (parentBoundary === void 0 || parentBoundary === null) {
1516 return boundarys;
1517 } else {
1518 return boundarys.filter((boundary) => boundary.parentBoundary === parentBoundary);
1519 }
1520};
1521const getRels = function() {
1522 return rels;
1523};
1524const getTitle = function() {
1525 return title;
1526};
1527const setWrap = function(wrapSetting) {
1528 wrapEnabled = wrapSetting;
1529};
1530const autoWrap = function() {
1531 return wrapEnabled;
1532};
1533const clear = function() {
1534 c4ShapeArray = [];
1535 boundarys = [
1536 {
1537 alias: "global",
1538 label: { text: "global" },
1539 type: { text: "global" },
1540 tags: null,
1541 link: null,
1542 parentBoundary: ""
1543 }
1544 ];
1545 parentBoundaryParse = "";
1546 currentBoundaryParse = "global";
1547 boundaryParseStack = [""];
1548 rels = [];
1549 boundaryParseStack = [""];
1550 title = "";
1551 wrapEnabled = false;
1552 c4ShapeInRow$1 = 4;
1553 c4BoundaryInRow$1 = 2;
1554};
1555const LINETYPE = {
1556 SOLID: 0,
1557 DOTTED: 1,
1558 NOTE: 2,
1559 SOLID_CROSS: 3,
1560 DOTTED_CROSS: 4,
1561 SOLID_OPEN: 5,
1562 DOTTED_OPEN: 6,
1563 LOOP_START: 10,
1564 LOOP_END: 11,
1565 ALT_START: 12,
1566 ALT_ELSE: 13,
1567 ALT_END: 14,
1568 OPT_START: 15,
1569 OPT_END: 16,
1570 ACTIVE_START: 17,
1571 ACTIVE_END: 18,
1572 PAR_START: 19,
1573 PAR_AND: 20,
1574 PAR_END: 21,
1575 RECT_START: 22,
1576 RECT_END: 23,
1577 SOLID_POINT: 24,
1578 DOTTED_POINT: 25
1579};
1580const ARROWTYPE = {
1581 FILLED: 0,
1582 OPEN: 1
1583};
1584const PLACEMENT = {
1585 LEFTOF: 0,
1586 RIGHTOF: 1,
1587 OVER: 2
1588};
1589const setTitle = function(txt) {
1590 let sanitizedText = sanitizeText(txt, getConfig());
1591 title = sanitizedText;
1592};
1593const c4Db = {
1594 addPersonOrSystem,
1595 addPersonOrSystemBoundary,
1596 addContainer,
1597 addContainerBoundary,
1598 addComponent,
1599 addDeploymentNode,
1600 popBoundaryParseStack,
1601 addRel,
1602 updateElStyle,
1603 updateRelStyle,
1604 updateLayoutConfig,
1605 autoWrap,
1606 setWrap,
1607 getC4ShapeArray,
1608 getC4Shape,
1609 getC4ShapeKeys,
1610 getBoundarys,
1611 getCurrentBoundaryParse,
1612 getParentBoundaryParse,
1613 getRels,
1614 getTitle,
1615 getC4Type,
1616 getC4ShapeInRow,
1617 getC4BoundaryInRow,
1618 setAccTitle,
1619 getAccTitle,
1620 getAccDescription,
1621 setAccDescription,
1622 parseDirective,
1623 getConfig: () => getConfig().c4,
1624 clear,
1625 LINETYPE,
1626 ARROWTYPE,
1627 PLACEMENT,
1628 setTitle,
1629 setC4Type
1630 // apply,
1631};
1632const drawRect = function(elem, rectData) {
1633 return drawRect$1(elem, rectData);
1634};
1635const drawImage = function(elem, width, height, x, y, link) {
1636 const imageElem = elem.append("image");
1637 imageElem.attr("width", width);
1638 imageElem.attr("height", height);
1639 imageElem.attr("x", x);
1640 imageElem.attr("y", y);
1641 let sanitizedLink = link.startsWith("data:image/png;base64") ? link : sanitizeUrl(link);
1642 imageElem.attr("xlink:href", sanitizedLink);
1643};
1644const drawRels$1 = (elem, rels2, conf2) => {
1645 const relsElem = elem.append("g");
1646 let i = 0;
1647 for (let rel of rels2) {
1648 let textColor = rel.textColor ? rel.textColor : "#444444";
1649 let strokeColor = rel.lineColor ? rel.lineColor : "#444444";
1650 let offsetX = rel.offsetX ? parseInt(rel.offsetX) : 0;
1651 let offsetY = rel.offsetY ? parseInt(rel.offsetY) : 0;
1652 let url = "";
1653 if (i === 0) {
1654 let line = relsElem.append("line");
1655 line.attr("x1", rel.startPoint.x);
1656 line.attr("y1", rel.startPoint.y);
1657 line.attr("x2", rel.endPoint.x);
1658 line.attr("y2", rel.endPoint.y);
1659 line.attr("stroke-width", "1");
1660 line.attr("stroke", strokeColor);
1661 line.style("fill", "none");
1662 if (rel.type !== "rel_b") {
1663 line.attr("marker-end", "url(" + url + "#arrowhead)");
1664 }
1665 if (rel.type === "birel" || rel.type === "rel_b") {
1666 line.attr("marker-start", "url(" + url + "#arrowend)");
1667 }
1668 i = -1;
1669 } else {
1670 let line = relsElem.append("path");
1671 line.attr("fill", "none").attr("stroke-width", "1").attr("stroke", strokeColor).attr(
1672 "d",
1673 "Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx", rel.startPoint.x).replaceAll("starty", rel.startPoint.y).replaceAll(
1674 "controlx",
1675 rel.startPoint.x + (rel.endPoint.x - rel.startPoint.x) / 2 - (rel.endPoint.x - rel.startPoint.x) / 4
1676 ).replaceAll("controly", rel.startPoint.y + (rel.endPoint.y - rel.startPoint.y) / 2).replaceAll("stopx", rel.endPoint.x).replaceAll("stopy", rel.endPoint.y)
1677 );
1678 if (rel.type !== "rel_b") {
1679 line.attr("marker-end", "url(" + url + "#arrowhead)");
1680 }
1681 if (rel.type === "birel" || rel.type === "rel_b") {
1682 line.attr("marker-start", "url(" + url + "#arrowend)");
1683 }
1684 }
1685 let messageConf = conf2.messageFont();
1686 _drawTextCandidateFunc(conf2)(
1687 rel.label.text,
1688 relsElem,
1689 Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX,
1690 Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + offsetY,
1691 rel.label.width,
1692 rel.label.height,
1693 { fill: textColor },
1694 messageConf
1695 );
1696 if (rel.techn && rel.techn.text !== "") {
1697 messageConf = conf2.messageFont();
1698 _drawTextCandidateFunc(conf2)(
1699 "[" + rel.techn.text + "]",
1700 relsElem,
1701 Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX,
1702 Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + conf2.messageFontSize + 5 + offsetY,
1703 Math.max(rel.label.width, rel.techn.width),
1704 rel.techn.height,
1705 { fill: textColor, "font-style": "italic" },
1706 messageConf
1707 );
1708 }
1709 }
1710};
1711const drawBoundary$1 = function(elem, boundary, conf2) {
1712 const boundaryElem = elem.append("g");
1713 let fillColor = boundary.bgColor ? boundary.bgColor : "none";
1714 let strokeColor = boundary.borderColor ? boundary.borderColor : "#444444";
1715 let fontColor = boundary.fontColor ? boundary.fontColor : "black";
1716 let attrsValue = { "stroke-width": 1, "stroke-dasharray": "7.0,7.0" };
1717 if (boundary.nodeType) {
1718 attrsValue = { "stroke-width": 1 };
1719 }
1720 let rectData = {
1721 x: boundary.x,
1722 y: boundary.y,
1723 fill: fillColor,
1724 stroke: strokeColor,
1725 width: boundary.width,
1726 height: boundary.height,
1727 rx: 2.5,
1728 ry: 2.5,
1729 attrs: attrsValue
1730 };
1731 drawRect(boundaryElem, rectData);
1732 let boundaryConf = conf2.boundaryFont();
1733 boundaryConf.fontWeight = "bold";
1734 boundaryConf.fontSize = boundaryConf.fontSize + 2;
1735 boundaryConf.fontColor = fontColor;
1736 _drawTextCandidateFunc(conf2)(
1737 boundary.label.text,
1738 boundaryElem,
1739 boundary.x,
1740 boundary.y + boundary.label.Y,
1741 boundary.width,
1742 boundary.height,
1743 { fill: "#444444" },
1744 boundaryConf
1745 );
1746 if (boundary.type && boundary.type.text !== "") {
1747 boundaryConf = conf2.boundaryFont();
1748 boundaryConf.fontColor = fontColor;
1749 _drawTextCandidateFunc(conf2)(
1750 boundary.type.text,
1751 boundaryElem,
1752 boundary.x,
1753 boundary.y + boundary.type.Y,
1754 boundary.width,
1755 boundary.height,
1756 { fill: "#444444" },
1757 boundaryConf
1758 );
1759 }
1760 if (boundary.descr && boundary.descr.text !== "") {
1761 boundaryConf = conf2.boundaryFont();
1762 boundaryConf.fontSize = boundaryConf.fontSize - 2;
1763 boundaryConf.fontColor = fontColor;
1764 _drawTextCandidateFunc(conf2)(
1765 boundary.descr.text,
1766 boundaryElem,
1767 boundary.x,
1768 boundary.y + boundary.descr.Y,
1769 boundary.width,
1770 boundary.height,
1771 { fill: "#444444" },
1772 boundaryConf
1773 );
1774 }
1775};
1776const drawC4Shape = function(elem, c4Shape, conf2) {
1777 var _a;
1778 let fillColor = c4Shape.bgColor ? c4Shape.bgColor : conf2[c4Shape.typeC4Shape.text + "_bg_color"];
1779 let strokeColor = c4Shape.borderColor ? c4Shape.borderColor : conf2[c4Shape.typeC4Shape.text + "_border_color"];
1780 let fontColor = c4Shape.fontColor ? c4Shape.fontColor : "#FFFFFF";
1781 let personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";
1782 switch (c4Shape.typeC4Shape.text) {
1783 case "person":
1784 personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";
1785 break;
1786 case "external_person":
1787 personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=";
1788 break;
1789 }
1790 const c4ShapeElem = elem.append("g");
1791 c4ShapeElem.attr("class", "person-man");
1792 const rect = getNoteRect();
1793 switch (c4Shape.typeC4Shape.text) {
1794 case "person":
1795 case "external_person":
1796 case "system":
1797 case "external_system":
1798 case "container":
1799 case "external_container":
1800 case "component":
1801 case "external_component":
1802 rect.x = c4Shape.x;
1803 rect.y = c4Shape.y;
1804 rect.fill = fillColor;
1805 rect.width = c4Shape.width;
1806 rect.height = c4Shape.height;
1807 rect.stroke = strokeColor;
1808 rect.rx = 2.5;
1809 rect.ry = 2.5;
1810 rect.attrs = { "stroke-width": 0.5 };
1811 drawRect(c4ShapeElem, rect);
1812 break;
1813 case "system_db":
1814 case "external_system_db":
1815 case "container_db":
1816 case "external_container_db":
1817 case "component_db":
1818 case "external_component_db":
1819 c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).attr(
1820 "d",
1821 "Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2).replaceAll("height", c4Shape.height)
1822 );
1823 c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr(
1824 "d",
1825 "Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2)
1826 );
1827 break;
1828 case "system_queue":
1829 case "external_system_queue":
1830 case "container_queue":
1831 case "external_container_queue":
1832 case "component_queue":
1833 case "external_component_queue":
1834 c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).attr(
1835 "d",
1836 "Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("width", c4Shape.width).replaceAll("half", c4Shape.height / 2)
1837 );
1838 c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr(
1839 "d",
1840 "Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx", c4Shape.x + c4Shape.width).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.height / 2)
1841 );
1842 break;
1843 }
1844 let c4ShapeFontConf = getC4ShapeFont(conf2, c4Shape.typeC4Shape.text);
1845 c4ShapeElem.append("text").attr("fill", fontColor).attr("font-family", c4ShapeFontConf.fontFamily).attr("font-size", c4ShapeFontConf.fontSize - 2).attr("font-style", "italic").attr("lengthAdjust", "spacing").attr("textLength", c4Shape.typeC4Shape.width).attr("x", c4Shape.x + c4Shape.width / 2 - c4Shape.typeC4Shape.width / 2).attr("y", c4Shape.y + c4Shape.typeC4Shape.Y).text("<<" + c4Shape.typeC4Shape.text + ">>");
1846 switch (c4Shape.typeC4Shape.text) {
1847 case "person":
1848 case "external_person":
1849 drawImage(
1850 c4ShapeElem,
1851 48,
1852 48,
1853 c4Shape.x + c4Shape.width / 2 - 24,
1854 c4Shape.y + c4Shape.image.Y,
1855 personImg
1856 );
1857 break;
1858 }
1859 let textFontConf = conf2[c4Shape.typeC4Shape.text + "Font"]();
1860 textFontConf.fontWeight = "bold";
1861 textFontConf.fontSize = textFontConf.fontSize + 2;
1862 textFontConf.fontColor = fontColor;
1863 _drawTextCandidateFunc(conf2)(
1864 c4Shape.label.text,
1865 c4ShapeElem,
1866 c4Shape.x,
1867 c4Shape.y + c4Shape.label.Y,
1868 c4Shape.width,
1869 c4Shape.height,
1870 { fill: fontColor },
1871 textFontConf
1872 );
1873 textFontConf = conf2[c4Shape.typeC4Shape.text + "Font"]();
1874 textFontConf.fontColor = fontColor;
1875 if (c4Shape.techn && ((_a = c4Shape.techn) == null ? void 0 : _a.text) !== "") {
1876 _drawTextCandidateFunc(conf2)(
1877 c4Shape.techn.text,
1878 c4ShapeElem,
1879 c4Shape.x,
1880 c4Shape.y + c4Shape.techn.Y,
1881 c4Shape.width,
1882 c4Shape.height,
1883 { fill: fontColor, "font-style": "italic" },
1884 textFontConf
1885 );
1886 } else if (c4Shape.type && c4Shape.type.text !== "") {
1887 _drawTextCandidateFunc(conf2)(
1888 c4Shape.type.text,
1889 c4ShapeElem,
1890 c4Shape.x,
1891 c4Shape.y + c4Shape.type.Y,
1892 c4Shape.width,
1893 c4Shape.height,
1894 { fill: fontColor, "font-style": "italic" },
1895 textFontConf
1896 );
1897 }
1898 if (c4Shape.descr && c4Shape.descr.text !== "") {
1899 textFontConf = conf2.personFont();
1900 textFontConf.fontColor = fontColor;
1901 _drawTextCandidateFunc(conf2)(
1902 c4Shape.descr.text,
1903 c4ShapeElem,
1904 c4Shape.x,
1905 c4Shape.y + c4Shape.descr.Y,
1906 c4Shape.width,
1907 c4Shape.height,
1908 { fill: fontColor },
1909 textFontConf
1910 );
1911 }
1912 return c4Shape.height;
1913};
1914const insertDatabaseIcon = function(elem) {
1915 elem.append("defs").append("symbol").attr("id", "database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
1916 "d",
1917 "M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z"
1918 );
1919};
1920const insertComputerIcon = function(elem) {
1921 elem.append("defs").append("symbol").attr("id", "computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
1922 "d",
1923 "M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z"
1924 );
1925};
1926const insertClockIcon = function(elem) {
1927 elem.append("defs").append("symbol").attr("id", "clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
1928 "d",
1929 "M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z"
1930 );
1931};
1932const insertArrowHead = function(elem) {
1933 elem.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z");
1934};
1935const insertArrowEnd = function(elem) {
1936 elem.append("defs").append("marker").attr("id", "arrowend").attr("refX", 1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 z");
1937};
1938const insertArrowFilledHead = function(elem) {
1939 elem.append("defs").append("marker").attr("id", "filled-head").attr("refX", 18).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
1940};
1941const insertDynamicNumber = function(elem) {
1942 elem.append("defs").append("marker").attr("id", "sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6);
1943};
1944const insertArrowCrossHead = function(elem) {
1945 const defs = elem.append("defs");
1946 const marker = defs.append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 16).attr("refY", 4);
1947 marker.append("path").attr("fill", "black").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 9,2 V 6 L16,4 Z");
1948 marker.append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 0,1 L 6,7 M 6,1 L 0,7");
1949};
1950const getC4ShapeFont = (cnf, typeC4Shape) => {
1951 return {
1952 fontFamily: cnf[typeC4Shape + "FontFamily"],
1953 fontSize: cnf[typeC4Shape + "FontSize"],
1954 fontWeight: cnf[typeC4Shape + "FontWeight"]
1955 };
1956};
1957const _drawTextCandidateFunc = function() {
1958 function byText(content, g, x, y, width, height, textAttrs) {
1959 const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("text-anchor", "middle").text(content);
1960 _setTextAttrs(text, textAttrs);
1961 }
1962 function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
1963 const { fontSize, fontFamily, fontWeight } = conf2;
1964 const lines = content.split(common.lineBreakRegex);
1965 for (let i = 0; i < lines.length; i++) {
1966 const dy = i * fontSize - fontSize * (lines.length - 1) / 2;
1967 const text = g.append("text").attr("x", x + width / 2).attr("y", y).style("text-anchor", "middle").attr("dominant-baseline", "middle").style("font-size", fontSize).style("font-weight", fontWeight).style("font-family", fontFamily);
1968 text.append("tspan").attr("dy", dy).text(lines[i]).attr("alignment-baseline", "mathematical");
1969 _setTextAttrs(text, textAttrs);
1970 }
1971 }
1972 function byFo(content, g, x, y, width, height, textAttrs, conf2) {
1973 const s = g.append("switch");
1974 const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
1975 const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
1976 text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
1977 byTspan(content, s, x, y, width, height, textAttrs, conf2);
1978 _setTextAttrs(text, textAttrs);
1979 }
1980 function _setTextAttrs(toText, fromTextAttrsDict) {
1981 for (const key in fromTextAttrsDict) {
1982 if (fromTextAttrsDict.hasOwnProperty(key)) {
1983 toText.attr(key, fromTextAttrsDict[key]);
1984 }
1985 }
1986 }
1987 return function(conf2) {
1988 return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
1989 };
1990}();
1991const svgDraw = {
1992 drawRect,
1993 drawBoundary: drawBoundary$1,
1994 drawC4Shape,
1995 drawRels: drawRels$1,
1996 drawImage,
1997 insertArrowHead,
1998 insertArrowEnd,
1999 insertArrowFilledHead,
2000 insertDynamicNumber,
2001 insertArrowCrossHead,
2002 insertDatabaseIcon,
2003 insertComputerIcon,
2004 insertClockIcon
2005};
2006let globalBoundaryMaxX = 0, globalBoundaryMaxY = 0;
2007let c4ShapeInRow = 4;
2008let c4BoundaryInRow = 2;
2009parser.yy = c4Db;
2010let conf = {};
2011class Bounds {
2012 constructor(diagObj) {
2013 this.name = "";
2014 this.data = {};
2015 this.data.startx = void 0;
2016 this.data.stopx = void 0;
2017 this.data.starty = void 0;
2018 this.data.stopy = void 0;
2019 this.data.widthLimit = void 0;
2020 this.nextData = {};
2021 this.nextData.startx = void 0;
2022 this.nextData.stopx = void 0;
2023 this.nextData.starty = void 0;
2024 this.nextData.stopy = void 0;
2025 this.nextData.cnt = 0;
2026 setConf(diagObj.db.getConfig());
2027 }
2028 setData(startx, stopx, starty, stopy) {
2029 this.nextData.startx = this.data.startx = startx;
2030 this.nextData.stopx = this.data.stopx = stopx;
2031 this.nextData.starty = this.data.starty = starty;
2032 this.nextData.stopy = this.data.stopy = stopy;
2033 }
2034 updateVal(obj, key, val, fun) {
2035 if (obj[key] === void 0) {
2036 obj[key] = val;
2037 } else {
2038 obj[key] = fun(val, obj[key]);
2039 }
2040 }
2041 insert(c4Shape) {
2042 this.nextData.cnt = this.nextData.cnt + 1;
2043 let _startx = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + c4Shape.margin : this.nextData.stopx + c4Shape.margin * 2;
2044 let _stopx = _startx + c4Shape.width;
2045 let _starty = this.nextData.starty + c4Shape.margin * 2;
2046 let _stopy = _starty + c4Shape.height;
2047 if (_startx >= this.data.widthLimit || _stopx >= this.data.widthLimit || this.nextData.cnt > c4ShapeInRow) {
2048 _startx = this.nextData.startx + c4Shape.margin + conf.nextLinePaddingX;
2049 _starty = this.nextData.stopy + c4Shape.margin * 2;
2050 this.nextData.stopx = _stopx = _startx + c4Shape.width;
2051 this.nextData.starty = this.nextData.stopy;
2052 this.nextData.stopy = _stopy = _starty + c4Shape.height;
2053 this.nextData.cnt = 1;
2054 }
2055 c4Shape.x = _startx;
2056 c4Shape.y = _starty;
2057 this.updateVal(this.data, "startx", _startx, Math.min);
2058 this.updateVal(this.data, "starty", _starty, Math.min);
2059 this.updateVal(this.data, "stopx", _stopx, Math.max);
2060 this.updateVal(this.data, "stopy", _stopy, Math.max);
2061 this.updateVal(this.nextData, "startx", _startx, Math.min);
2062 this.updateVal(this.nextData, "starty", _starty, Math.min);
2063 this.updateVal(this.nextData, "stopx", _stopx, Math.max);
2064 this.updateVal(this.nextData, "stopy", _stopy, Math.max);
2065 }
2066 init(diagObj) {
2067 this.name = "";
2068 this.data = {
2069 startx: void 0,
2070 stopx: void 0,
2071 starty: void 0,
2072 stopy: void 0,
2073 widthLimit: void 0
2074 };
2075 this.nextData = {
2076 startx: void 0,
2077 stopx: void 0,
2078 starty: void 0,
2079 stopy: void 0,
2080 cnt: 0
2081 };
2082 setConf(diagObj.db.getConfig());
2083 }
2084 bumpLastMargin(margin) {
2085 this.data.stopx += margin;
2086 this.data.stopy += margin;
2087 }
2088}
2089const setConf = function(cnf) {
2090 assignWithDepth(conf, cnf);
2091 if (cnf.fontFamily) {
2092 conf.personFontFamily = conf.systemFontFamily = conf.messageFontFamily = cnf.fontFamily;
2093 }
2094 if (cnf.fontSize) {
2095 conf.personFontSize = conf.systemFontSize = conf.messageFontSize = cnf.fontSize;
2096 }
2097 if (cnf.fontWeight) {
2098 conf.personFontWeight = conf.systemFontWeight = conf.messageFontWeight = cnf.fontWeight;
2099 }
2100};
2101const c4ShapeFont = (cnf, typeC4Shape) => {
2102 return {
2103 fontFamily: cnf[typeC4Shape + "FontFamily"],
2104 fontSize: cnf[typeC4Shape + "FontSize"],
2105 fontWeight: cnf[typeC4Shape + "FontWeight"]
2106 };
2107};
2108const boundaryFont = (cnf) => {
2109 return {
2110 fontFamily: cnf.boundaryFontFamily,
2111 fontSize: cnf.boundaryFontSize,
2112 fontWeight: cnf.boundaryFontWeight
2113 };
2114};
2115const messageFont = (cnf) => {
2116 return {
2117 fontFamily: cnf.messageFontFamily,
2118 fontSize: cnf.messageFontSize,
2119 fontWeight: cnf.messageFontWeight
2120 };
2121};
2122function calcC4ShapeTextWH(textType, c4Shape, c4ShapeTextWrap, textConf, textLimitWidth) {
2123 if (!c4Shape[textType].width) {
2124 if (c4ShapeTextWrap) {
2125 c4Shape[textType].text = wrapLabel(c4Shape[textType].text, textLimitWidth, textConf);
2126 c4Shape[textType].textLines = c4Shape[textType].text.split(common.lineBreakRegex).length;
2127 c4Shape[textType].width = textLimitWidth;
2128 c4Shape[textType].height = calculateTextHeight(c4Shape[textType].text, textConf);
2129 } else {
2130 let lines = c4Shape[textType].text.split(common.lineBreakRegex);
2131 c4Shape[textType].textLines = lines.length;
2132 let lineHeight = 0;
2133 c4Shape[textType].height = 0;
2134 c4Shape[textType].width = 0;
2135 for (const line of lines) {
2136 c4Shape[textType].width = Math.max(
2137 calculateTextWidth(line, textConf),
2138 c4Shape[textType].width
2139 );
2140 lineHeight = calculateTextHeight(line, textConf);
2141 c4Shape[textType].height = c4Shape[textType].height + lineHeight;
2142 }
2143 }
2144 }
2145}
2146const drawBoundary = function(diagram2, boundary, bounds) {
2147 boundary.x = bounds.data.startx;
2148 boundary.y = bounds.data.starty;
2149 boundary.width = bounds.data.stopx - bounds.data.startx;
2150 boundary.height = bounds.data.stopy - bounds.data.starty;
2151 boundary.label.y = conf.c4ShapeMargin - 35;
2152 let boundaryTextWrap = boundary.wrap && conf.wrap;
2153 let boundaryLabelConf = boundaryFont(conf);
2154 boundaryLabelConf.fontSize = boundaryLabelConf.fontSize + 2;
2155 boundaryLabelConf.fontWeight = "bold";
2156 let textLimitWidth = calculateTextWidth(boundary.label.text, boundaryLabelConf);
2157 calcC4ShapeTextWH("label", boundary, boundaryTextWrap, boundaryLabelConf, textLimitWidth);
2158 svgDraw.drawBoundary(diagram2, boundary, conf);
2159};
2160const drawC4ShapeArray = function(currentBounds, diagram2, c4ShapeArray2, c4ShapeKeys) {
2161 let Y = 0;
2162 for (const c4ShapeKey of c4ShapeKeys) {
2163 Y = 0;
2164 const c4Shape = c4ShapeArray2[c4ShapeKey];
2165 let c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
2166 c4ShapeTypeConf.fontSize = c4ShapeTypeConf.fontSize - 2;
2167 c4Shape.typeC4Shape.width = calculateTextWidth(
2168 "<<" + c4Shape.typeC4Shape.text + ">>",
2169 c4ShapeTypeConf
2170 );
2171 c4Shape.typeC4Shape.height = c4ShapeTypeConf.fontSize + 2;
2172 c4Shape.typeC4Shape.Y = conf.c4ShapePadding;
2173 Y = c4Shape.typeC4Shape.Y + c4Shape.typeC4Shape.height - 4;
2174 c4Shape.image = { width: 0, height: 0, Y: 0 };
2175 switch (c4Shape.typeC4Shape.text) {
2176 case "person":
2177 case "external_person":
2178 c4Shape.image.width = 48;
2179 c4Shape.image.height = 48;
2180 c4Shape.image.Y = Y;
2181 Y = c4Shape.image.Y + c4Shape.image.height;
2182 break;
2183 }
2184 if (c4Shape.sprite) {
2185 c4Shape.image.width = 48;
2186 c4Shape.image.height = 48;
2187 c4Shape.image.Y = Y;
2188 Y = c4Shape.image.Y + c4Shape.image.height;
2189 }
2190 let c4ShapeTextWrap = c4Shape.wrap && conf.wrap;
2191 let textLimitWidth = conf.width - conf.c4ShapePadding * 2;
2192 let c4ShapeLabelConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
2193 c4ShapeLabelConf.fontSize = c4ShapeLabelConf.fontSize + 2;
2194 c4ShapeLabelConf.fontWeight = "bold";
2195 calcC4ShapeTextWH("label", c4Shape, c4ShapeTextWrap, c4ShapeLabelConf, textLimitWidth);
2196 c4Shape["label"].Y = Y + 8;
2197 Y = c4Shape["label"].Y + c4Shape["label"].height;
2198 if (c4Shape.type && c4Shape.type.text !== "") {
2199 c4Shape.type.text = "[" + c4Shape.type.text + "]";
2200 let c4ShapeTypeConf2 = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
2201 calcC4ShapeTextWH("type", c4Shape, c4ShapeTextWrap, c4ShapeTypeConf2, textLimitWidth);
2202 c4Shape["type"].Y = Y + 5;
2203 Y = c4Shape["type"].Y + c4Shape["type"].height;
2204 } else if (c4Shape.techn && c4Shape.techn.text !== "") {
2205 c4Shape.techn.text = "[" + c4Shape.techn.text + "]";
2206 let c4ShapeTechnConf = c4ShapeFont(conf, c4Shape.techn.text);
2207 calcC4ShapeTextWH("techn", c4Shape, c4ShapeTextWrap, c4ShapeTechnConf, textLimitWidth);
2208 c4Shape["techn"].Y = Y + 5;
2209 Y = c4Shape["techn"].Y + c4Shape["techn"].height;
2210 }
2211 let rectHeight = Y;
2212 let rectWidth = c4Shape.label.width;
2213 if (c4Shape.descr && c4Shape.descr.text !== "") {
2214 let c4ShapeDescrConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
2215 calcC4ShapeTextWH("descr", c4Shape, c4ShapeTextWrap, c4ShapeDescrConf, textLimitWidth);
2216 c4Shape["descr"].Y = Y + 20;
2217 Y = c4Shape["descr"].Y + c4Shape["descr"].height;
2218 rectWidth = Math.max(c4Shape.label.width, c4Shape.descr.width);
2219 rectHeight = Y - c4Shape["descr"].textLines * 5;
2220 }
2221 rectWidth = rectWidth + conf.c4ShapePadding;
2222 c4Shape.width = Math.max(c4Shape.width || conf.width, rectWidth, conf.width);
2223 c4Shape.height = Math.max(c4Shape.height || conf.height, rectHeight, conf.height);
2224 c4Shape.margin = c4Shape.margin || conf.c4ShapeMargin;
2225 currentBounds.insert(c4Shape);
2226 svgDraw.drawC4Shape(diagram2, c4Shape, conf);
2227 }
2228 currentBounds.bumpLastMargin(conf.c4ShapeMargin);
2229};
2230class Point {
2231 constructor(x, y) {
2232 this.x = x;
2233 this.y = y;
2234 }
2235}
2236let getIntersectPoint = function(fromNode, endPoint) {
2237 let x1 = fromNode.x;
2238 let y1 = fromNode.y;
2239 let x2 = endPoint.x;
2240 let y2 = endPoint.y;
2241 let fromCenterX = x1 + fromNode.width / 2;
2242 let fromCenterY = y1 + fromNode.height / 2;
2243 let dx = Math.abs(x1 - x2);
2244 let dy = Math.abs(y1 - y2);
2245 let tanDYX = dy / dx;
2246 let fromDYX = fromNode.height / fromNode.width;
2247 let returnPoint = null;
2248 if (y1 == y2 && x1 < x2) {
2249 returnPoint = new Point(x1 + fromNode.width, fromCenterY);
2250 } else if (y1 == y2 && x1 > x2) {
2251 returnPoint = new Point(x1, fromCenterY);
2252 } else if (x1 == x2 && y1 < y2) {
2253 returnPoint = new Point(fromCenterX, y1 + fromNode.height);
2254 } else if (x1 == x2 && y1 > y2) {
2255 returnPoint = new Point(fromCenterX, y1);
2256 }
2257 if (x1 > x2 && y1 < y2) {
2258 if (fromDYX >= tanDYX) {
2259 returnPoint = new Point(x1, fromCenterY + tanDYX * fromNode.width / 2);
2260 } else {
2261 returnPoint = new Point(
2262 fromCenterX - dx / dy * fromNode.height / 2,
2263 y1 + fromNode.height
2264 );
2265 }
2266 } else if (x1 < x2 && y1 < y2) {
2267 if (fromDYX >= tanDYX) {
2268 returnPoint = new Point(x1 + fromNode.width, fromCenterY + tanDYX * fromNode.width / 2);
2269 } else {
2270 returnPoint = new Point(
2271 fromCenterX + dx / dy * fromNode.height / 2,
2272 y1 + fromNode.height
2273 );
2274 }
2275 } else if (x1 < x2 && y1 > y2) {
2276 if (fromDYX >= tanDYX) {
2277 returnPoint = new Point(x1 + fromNode.width, fromCenterY - tanDYX * fromNode.width / 2);
2278 } else {
2279 returnPoint = new Point(fromCenterX + fromNode.height / 2 * dx / dy, y1);
2280 }
2281 } else if (x1 > x2 && y1 > y2) {
2282 if (fromDYX >= tanDYX) {
2283 returnPoint = new Point(x1, fromCenterY - fromNode.width / 2 * tanDYX);
2284 } else {
2285 returnPoint = new Point(fromCenterX - fromNode.height / 2 * dx / dy, y1);
2286 }
2287 }
2288 return returnPoint;
2289};
2290let getIntersectPoints = function(fromNode, endNode) {
2291 let endIntersectPoint = { x: 0, y: 0 };
2292 endIntersectPoint.x = endNode.x + endNode.width / 2;
2293 endIntersectPoint.y = endNode.y + endNode.height / 2;
2294 let startPoint = getIntersectPoint(fromNode, endIntersectPoint);
2295 endIntersectPoint.x = fromNode.x + fromNode.width / 2;
2296 endIntersectPoint.y = fromNode.y + fromNode.height / 2;
2297 let endPoint = getIntersectPoint(endNode, endIntersectPoint);
2298 return { startPoint, endPoint };
2299};
2300const drawRels = function(diagram2, rels2, getC4ShapeObj, diagObj) {
2301 let i = 0;
2302 for (let rel of rels2) {
2303 i = i + 1;
2304 let relTextWrap = rel.wrap && conf.wrap;
2305 let relConf = messageFont(conf);
2306 let diagramType = diagObj.db.getC4Type();
2307 if (diagramType === "C4Dynamic") {
2308 rel.label.text = i + ": " + rel.label.text;
2309 }
2310 let textLimitWidth = calculateTextWidth(rel.label.text, relConf);
2311 calcC4ShapeTextWH("label", rel, relTextWrap, relConf, textLimitWidth);
2312 if (rel.techn && rel.techn.text !== "") {
2313 textLimitWidth = calculateTextWidth(rel.techn.text, relConf);
2314 calcC4ShapeTextWH("techn", rel, relTextWrap, relConf, textLimitWidth);
2315 }
2316 if (rel.descr && rel.descr.text !== "") {
2317 textLimitWidth = calculateTextWidth(rel.descr.text, relConf);
2318 calcC4ShapeTextWH("descr", rel, relTextWrap, relConf, textLimitWidth);
2319 }
2320 let fromNode = getC4ShapeObj(rel.from);
2321 let endNode = getC4ShapeObj(rel.to);
2322 let points = getIntersectPoints(fromNode, endNode);
2323 rel.startPoint = points.startPoint;
2324 rel.endPoint = points.endPoint;
2325 }
2326 svgDraw.drawRels(diagram2, rels2, conf);
2327};
2328function drawInsideBoundary(diagram2, parentBoundaryAlias, parentBounds, currentBoundaries, diagObj) {
2329 let currentBounds = new Bounds(diagObj);
2330 currentBounds.data.widthLimit = parentBounds.data.widthLimit / Math.min(c4BoundaryInRow, currentBoundaries.length);
2331 for (let [i, currentBoundary] of currentBoundaries.entries()) {
2332 let Y = 0;
2333 currentBoundary.image = { width: 0, height: 0, Y: 0 };
2334 if (currentBoundary.sprite) {
2335 currentBoundary.image.width = 48;
2336 currentBoundary.image.height = 48;
2337 currentBoundary.image.Y = Y;
2338 Y = currentBoundary.image.Y + currentBoundary.image.height;
2339 }
2340 let currentBoundaryTextWrap = currentBoundary.wrap && conf.wrap;
2341 let currentBoundaryLabelConf = boundaryFont(conf);
2342 currentBoundaryLabelConf.fontSize = currentBoundaryLabelConf.fontSize + 2;
2343 currentBoundaryLabelConf.fontWeight = "bold";
2344 calcC4ShapeTextWH(
2345 "label",
2346 currentBoundary,
2347 currentBoundaryTextWrap,
2348 currentBoundaryLabelConf,
2349 currentBounds.data.widthLimit
2350 );
2351 currentBoundary["label"].Y = Y + 8;
2352 Y = currentBoundary["label"].Y + currentBoundary["label"].height;
2353 if (currentBoundary.type && currentBoundary.type.text !== "") {
2354 currentBoundary.type.text = "[" + currentBoundary.type.text + "]";
2355 let currentBoundaryTypeConf = boundaryFont(conf);
2356 calcC4ShapeTextWH(
2357 "type",
2358 currentBoundary,
2359 currentBoundaryTextWrap,
2360 currentBoundaryTypeConf,
2361 currentBounds.data.widthLimit
2362 );
2363 currentBoundary["type"].Y = Y + 5;
2364 Y = currentBoundary["type"].Y + currentBoundary["type"].height;
2365 }
2366 if (currentBoundary.descr && currentBoundary.descr.text !== "") {
2367 let currentBoundaryDescrConf = boundaryFont(conf);
2368 currentBoundaryDescrConf.fontSize = currentBoundaryDescrConf.fontSize - 2;
2369 calcC4ShapeTextWH(
2370 "descr",
2371 currentBoundary,
2372 currentBoundaryTextWrap,
2373 currentBoundaryDescrConf,
2374 currentBounds.data.widthLimit
2375 );
2376 currentBoundary["descr"].Y = Y + 20;
2377 Y = currentBoundary["descr"].Y + currentBoundary["descr"].height;
2378 }
2379 if (i == 0 || i % c4BoundaryInRow === 0) {
2380 let _x = parentBounds.data.startx + conf.diagramMarginX;
2381 let _y = parentBounds.data.stopy + conf.diagramMarginY + Y;
2382 currentBounds.setData(_x, _x, _y, _y);
2383 } else {
2384 let _x = currentBounds.data.stopx !== currentBounds.data.startx ? currentBounds.data.stopx + conf.diagramMarginX : currentBounds.data.startx;
2385 let _y = currentBounds.data.starty;
2386 currentBounds.setData(_x, _x, _y, _y);
2387 }
2388 currentBounds.name = currentBoundary.alias;
2389 let currentPersonOrSystemArray = diagObj.db.getC4ShapeArray(currentBoundary.alias);
2390 let currentPersonOrSystemKeys = diagObj.db.getC4ShapeKeys(currentBoundary.alias);
2391 if (currentPersonOrSystemKeys.length > 0) {
2392 drawC4ShapeArray(
2393 currentBounds,
2394 diagram2,
2395 currentPersonOrSystemArray,
2396 currentPersonOrSystemKeys
2397 );
2398 }
2399 parentBoundaryAlias = currentBoundary.alias;
2400 let nextCurrentBoundarys = diagObj.db.getBoundarys(parentBoundaryAlias);
2401 if (nextCurrentBoundarys.length > 0) {
2402 drawInsideBoundary(
2403 diagram2,
2404 parentBoundaryAlias,
2405 currentBounds,
2406 nextCurrentBoundarys,
2407 diagObj
2408 );
2409 }
2410 if (currentBoundary.alias !== "global") {
2411 drawBoundary(diagram2, currentBoundary, currentBounds);
2412 }
2413 parentBounds.data.stopy = Math.max(
2414 currentBounds.data.stopy + conf.c4ShapeMargin,
2415 parentBounds.data.stopy
2416 );
2417 parentBounds.data.stopx = Math.max(
2418 currentBounds.data.stopx + conf.c4ShapeMargin,
2419 parentBounds.data.stopx
2420 );
2421 globalBoundaryMaxX = Math.max(globalBoundaryMaxX, parentBounds.data.stopx);
2422 globalBoundaryMaxY = Math.max(globalBoundaryMaxY, parentBounds.data.stopy);
2423 }
2424}
2425const draw = function(_text, id, _version, diagObj) {
2426 conf = getConfig().c4;
2427 const securityLevel = getConfig().securityLevel;
2428 let sandboxElement;
2429 if (securityLevel === "sandbox") {
2430 sandboxElement = select("#i" + id);
2431 }
2432 const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
2433 let db = diagObj.db;
2434 diagObj.db.setWrap(conf.wrap);
2435 c4ShapeInRow = db.getC4ShapeInRow();
2436 c4BoundaryInRow = db.getC4BoundaryInRow();
2437 log.debug(`C:${JSON.stringify(conf, null, 2)}`);
2438 const diagram2 = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`);
2439 svgDraw.insertComputerIcon(diagram2);
2440 svgDraw.insertDatabaseIcon(diagram2);
2441 svgDraw.insertClockIcon(diagram2);
2442 let screenBounds = new Bounds(diagObj);
2443 screenBounds.setData(
2444 conf.diagramMarginX,
2445 conf.diagramMarginX,
2446 conf.diagramMarginY,
2447 conf.diagramMarginY
2448 );
2449 screenBounds.data.widthLimit = screen.availWidth;
2450 globalBoundaryMaxX = conf.diagramMarginX;
2451 globalBoundaryMaxY = conf.diagramMarginY;
2452 const title2 = diagObj.db.getTitle();
2453 let currentBoundaries = diagObj.db.getBoundarys("");
2454 drawInsideBoundary(diagram2, "", screenBounds, currentBoundaries, diagObj);
2455 svgDraw.insertArrowHead(diagram2);
2456 svgDraw.insertArrowEnd(diagram2);
2457 svgDraw.insertArrowCrossHead(diagram2);
2458 svgDraw.insertArrowFilledHead(diagram2);
2459 drawRels(diagram2, diagObj.db.getRels(), diagObj.db.getC4Shape, diagObj);
2460 screenBounds.data.stopx = globalBoundaryMaxX;
2461 screenBounds.data.stopy = globalBoundaryMaxY;
2462 const box = screenBounds.data;
2463 let boxHeight = box.stopy - box.starty;
2464 let height = boxHeight + 2 * conf.diagramMarginY;
2465 let boxWidth = box.stopx - box.startx;
2466 const width = boxWidth + 2 * conf.diagramMarginX;
2467 if (title2) {
2468 diagram2.append("text").text(title2).attr("x", (box.stopx - box.startx) / 2 - 4 * conf.diagramMarginX).attr("y", box.starty + conf.diagramMarginY);
2469 }
2470 configureSvgSize(diagram2, height, width, conf.useMaxWidth);
2471 const extraVertForTitle = title2 ? 60 : 0;
2472 diagram2.attr(
2473 "viewBox",
2474 box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width + " " + (height + extraVertForTitle)
2475 );
2476 log.debug(`models:`, box);
2477};
2478const c4Renderer = {
2479 drawPersonOrSystemArray: drawC4ShapeArray,
2480 drawBoundary,
2481 setConf,
2482 draw
2483};
2484const getStyles = (options) => `.person {
2485 stroke: ${options.personBorder};
2486 fill: ${options.personBkg};
2487 }
2488`;
2489const c4Styles = getStyles;
2490const diagram = {
2491 parser: c4Parser,
2492 db: c4Db,
2493 renderer: c4Renderer,
2494 styles: c4Styles,
2495 init: (cnf) => {
2496 c4Renderer.setConf(cnf.c4);
2497 }
2498};
2499export {
2500 diagram
2501};