@webskill/sdk 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
- package/dist/agent.d.ts +3 -3
- package/dist/agent.js +1174 -169
- package/dist/{approval-DwN2o2QG.js → approval-7CuZS3Z4.js} +104 -18
- package/dist/arc-8U_6NQWm.js +130 -0
- package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
- package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
- package/dist/array-DQfpQNY8.js +8 -0
- package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
- package/dist/browser.d.ts +455 -49
- package/dist/browser.js +2134 -138
- package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
- package/dist/channel-CZxxLrG7.js +9 -0
- package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
- package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
- package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
- package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
- package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
- package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
- package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
- package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
- package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
- package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
- package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
- package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
- package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
- package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
- package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
- package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
- package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
- package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
- package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
- package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
- package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
- package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
- package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
- package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
- package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
- package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
- package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
- package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
- package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
- package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
- package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
- package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
- package/dist/defaultLocale-B_EoOkSF.js +249 -0
- package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
- package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
- package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
- package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
- package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
- package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
- package/dist/dist-UajCDt3n.js +92 -0
- package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
- package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
- package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
- package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
- package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
- package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
- package/dist/{toolSource-C9oNuKmr.js → geometry-CRhuySKV.js} +169 -12
- package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
- package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
- package/dist/governance.d.ts +22 -4
- package/dist/governance.js +100 -10
- package/dist/graphlib-tk9gQYuN.js +4194 -0
- package/dist/{index-DHopiH_m.d.ts → index-7No55dRb.d.ts} +161 -11
- package/dist/{index-B8Tgmpwh.d.ts → index-ShvCB5I9.d.ts} +2 -2
- package/dist/{index-CYLt5u4L.d.ts → index-V76_OFj2.d.ts} +789 -21
- package/dist/index.d.ts +4 -4
- package/dist/index.js +11 -9
- package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
- package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
- package/dist/init-CMOIWdg-.js +16 -0
- package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
- package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
- package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
- package/dist/katex-BcRRvyh_.js +26465 -0
- package/dist/{kind-DaKqLX2F.js → kind-Dc8x0HWz.js} +54 -7
- package/dist/line-LgV8iVMV.js +48 -0
- package/dist/linear-BWKR0Tqd.js +393 -0
- package/dist/linkedDocument-CZZOl9cO.js +456 -0
- package/dist/mcp.d.ts +2 -2
- package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
- package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
- package/dist/mermaid.core-DMtwGCHy.js +1756 -0
- package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
- package/dist/node.d.ts +3 -3
- package/dist/node.js +12 -5
- package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
- package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
- package/dist/ordinal-CxA6GHQS.js +84 -0
- package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
- package/dist/path-C27Z2Bjv.js +106 -0
- package/dist/{pathSecurity-B1owvJAF.js → pathSecurity-CirkQwWP.js} +12 -1
- package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
- package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
- package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
- package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
- package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
- package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
- package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
- package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
- package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
- package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
- package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
- package/dist/rough.cjs-AmDd_NQk.js +1395 -0
- package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
- package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
- package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
- package/dist/{skill-CAJMsLod.js → skill-WSUDp6A1.js} +1 -1
- package/dist/{skillVersionStore-B24Jjjry-BkOk9wI_.d.ts → skillVersionStore-S4_HJ_Fl-Cvy9LqVu.d.ts} +35 -4
- package/dist/src-NkhI3UMl.js +2653 -0
- package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
- package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
- package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +1 -1
- package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
- package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
- package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
- package/dist/{types-BvTV_05--BW8zDuEk.d.ts → types-CpDRZ0rA-BiZBXGm4.d.ts} +66 -8
- package/dist/ui-react.d.ts +3 -3
- package/dist/ui-react.js +3746 -96
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +2 -2
- package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
- package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
- package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
- package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
- package/dist/{webSkillApi-Cib6G-94.js → webSkillApi-D5VMUnrv.js} +2 -2
- package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
- package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
- package/package.json +1 -1
- package/dist/linkedDocument-C0gj1sMq.js +0 -245
|
@@ -0,0 +1,975 @@
|
|
|
1
|
+
import { o as __toESM } from "./rolldown-runtime-BHkdefai.js";
|
|
2
|
+
import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
|
|
3
|
+
import "./src-NkhI3UMl.js";
|
|
4
|
+
import { H as setAccDescription, U as setAccTitle, a as clear, c as configureSvgSize, q as setDiagramTitle, s as common_default, v as getAccDescription, w as getDiagramTitle, x as getConfig2, y as getAccTitle } from "./chunk-O7XYJQB3-B6K0KOSL.js";
|
|
5
|
+
import { p as parseFontSize } from "./chunk-ZIGJFQKS-DqEFBuHR.js";
|
|
6
|
+
import { t as selectSvgElement } from "./chunk-6AEJRKK7-JXK89I-O.js";
|
|
7
|
+
import { t as require_rough_cjs } from "./rough.cjs-AmDd_NQk.js";
|
|
8
|
+
|
|
9
|
+
//#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-OU5B5YK6.mjs
|
|
10
|
+
var import_rough_cjs = /* @__PURE__ */ __toESM(require_rough_cjs(), 1);
|
|
11
|
+
var parser = (function() {
|
|
12
|
+
var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
|
|
13
|
+
for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v);
|
|
14
|
+
return o2;
|
|
15
|
+
}, "o"), $V0 = [1, 4], $V1 = [1, 14], $V2 = [1, 12], $V3 = [1, 13], $V4 = [
|
|
16
|
+
6,
|
|
17
|
+
7,
|
|
18
|
+
8
|
|
19
|
+
], $V5 = [1, 20], $V6 = [1, 18], $V7 = [1, 19], $V8 = [
|
|
20
|
+
6,
|
|
21
|
+
7,
|
|
22
|
+
11
|
|
23
|
+
], $V9 = [
|
|
24
|
+
1,
|
|
25
|
+
6,
|
|
26
|
+
13,
|
|
27
|
+
14
|
|
28
|
+
], $Va = [1, 23], $Vb = [1, 24], $Vc = [
|
|
29
|
+
1,
|
|
30
|
+
6,
|
|
31
|
+
7,
|
|
32
|
+
11,
|
|
33
|
+
13,
|
|
34
|
+
14
|
|
35
|
+
];
|
|
36
|
+
var parser2 = {
|
|
37
|
+
trace: /* @__PURE__ */ __name(function trace() {}, "trace"),
|
|
38
|
+
yy: {},
|
|
39
|
+
symbols_: {
|
|
40
|
+
"error": 2,
|
|
41
|
+
"start": 3,
|
|
42
|
+
"ishikawa": 4,
|
|
43
|
+
"spaceLines": 5,
|
|
44
|
+
"SPACELINE": 6,
|
|
45
|
+
"NL": 7,
|
|
46
|
+
"ISHIKAWA": 8,
|
|
47
|
+
"document": 9,
|
|
48
|
+
"stop": 10,
|
|
49
|
+
"EOF": 11,
|
|
50
|
+
"statement": 12,
|
|
51
|
+
"SPACELIST": 13,
|
|
52
|
+
"TEXT": 14,
|
|
53
|
+
"$accept": 0,
|
|
54
|
+
"$end": 1
|
|
55
|
+
},
|
|
56
|
+
terminals_: {
|
|
57
|
+
2: "error",
|
|
58
|
+
6: "SPACELINE",
|
|
59
|
+
7: "NL",
|
|
60
|
+
8: "ISHIKAWA",
|
|
61
|
+
11: "EOF",
|
|
62
|
+
13: "SPACELIST",
|
|
63
|
+
14: "TEXT"
|
|
64
|
+
},
|
|
65
|
+
productions_: [
|
|
66
|
+
0,
|
|
67
|
+
[3, 1],
|
|
68
|
+
[3, 2],
|
|
69
|
+
[5, 1],
|
|
70
|
+
[5, 2],
|
|
71
|
+
[5, 2],
|
|
72
|
+
[4, 2],
|
|
73
|
+
[4, 3],
|
|
74
|
+
[10, 1],
|
|
75
|
+
[10, 1],
|
|
76
|
+
[10, 1],
|
|
77
|
+
[10, 2],
|
|
78
|
+
[10, 2],
|
|
79
|
+
[9, 3],
|
|
80
|
+
[9, 2],
|
|
81
|
+
[12, 2],
|
|
82
|
+
[12, 1],
|
|
83
|
+
[12, 1],
|
|
84
|
+
[12, 1]
|
|
85
|
+
],
|
|
86
|
+
performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
|
|
87
|
+
var $0 = $$.length - 1;
|
|
88
|
+
switch (yystate) {
|
|
89
|
+
case 6:
|
|
90
|
+
case 7: return yy;
|
|
91
|
+
case 15:
|
|
92
|
+
yy.addNode($$[$0 - 1].length, $$[$0].trim());
|
|
93
|
+
break;
|
|
94
|
+
case 16:
|
|
95
|
+
yy.addNode(0, $$[$0].trim());
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}, "anonymous"),
|
|
99
|
+
table: [
|
|
100
|
+
{
|
|
101
|
+
3: 1,
|
|
102
|
+
4: 2,
|
|
103
|
+
5: 3,
|
|
104
|
+
6: [1, 5],
|
|
105
|
+
8: $V0
|
|
106
|
+
},
|
|
107
|
+
{ 1: [3] },
|
|
108
|
+
{ 1: [2, 1] },
|
|
109
|
+
{
|
|
110
|
+
4: 6,
|
|
111
|
+
6: [1, 7],
|
|
112
|
+
7: [1, 8],
|
|
113
|
+
8: $V0
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
6: $V1,
|
|
117
|
+
7: [1, 10],
|
|
118
|
+
9: 9,
|
|
119
|
+
12: 11,
|
|
120
|
+
13: $V2,
|
|
121
|
+
14: $V3
|
|
122
|
+
},
|
|
123
|
+
o($V4, [2, 3]),
|
|
124
|
+
{ 1: [2, 2] },
|
|
125
|
+
o($V4, [2, 4]),
|
|
126
|
+
o($V4, [2, 5]),
|
|
127
|
+
{
|
|
128
|
+
1: [2, 6],
|
|
129
|
+
6: $V1,
|
|
130
|
+
12: 15,
|
|
131
|
+
13: $V2,
|
|
132
|
+
14: $V3
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
6: $V1,
|
|
136
|
+
9: 16,
|
|
137
|
+
12: 11,
|
|
138
|
+
13: $V2,
|
|
139
|
+
14: $V3
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
6: $V5,
|
|
143
|
+
7: $V6,
|
|
144
|
+
10: 17,
|
|
145
|
+
11: $V7
|
|
146
|
+
},
|
|
147
|
+
o($V8, [2, 18], { 14: [1, 21] }),
|
|
148
|
+
o($V8, [2, 16]),
|
|
149
|
+
o($V8, [2, 17]),
|
|
150
|
+
{
|
|
151
|
+
6: $V5,
|
|
152
|
+
7: $V6,
|
|
153
|
+
10: 22,
|
|
154
|
+
11: $V7
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
1: [2, 7],
|
|
158
|
+
6: $V1,
|
|
159
|
+
12: 15,
|
|
160
|
+
13: $V2,
|
|
161
|
+
14: $V3
|
|
162
|
+
},
|
|
163
|
+
o($V9, [2, 14], {
|
|
164
|
+
7: $Va,
|
|
165
|
+
11: $Vb
|
|
166
|
+
}),
|
|
167
|
+
o($Vc, [2, 8]),
|
|
168
|
+
o($Vc, [2, 9]),
|
|
169
|
+
o($Vc, [2, 10]),
|
|
170
|
+
o($V8, [2, 15]),
|
|
171
|
+
o($V9, [2, 13], {
|
|
172
|
+
7: $Va,
|
|
173
|
+
11: $Vb
|
|
174
|
+
}),
|
|
175
|
+
o($Vc, [2, 11]),
|
|
176
|
+
o($Vc, [2, 12])
|
|
177
|
+
],
|
|
178
|
+
defaultActions: {
|
|
179
|
+
2: [2, 1],
|
|
180
|
+
6: [2, 2]
|
|
181
|
+
},
|
|
182
|
+
parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
|
|
183
|
+
if (hash.recoverable) this.trace(str);
|
|
184
|
+
else {
|
|
185
|
+
var error = new Error(str);
|
|
186
|
+
error.hash = hash;
|
|
187
|
+
throw error;
|
|
188
|
+
}
|
|
189
|
+
}, "parseError"),
|
|
190
|
+
parse: /* @__PURE__ */ __name(function parse(input) {
|
|
191
|
+
var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
|
192
|
+
var args = lstack.slice.call(arguments, 1);
|
|
193
|
+
var lexer2 = Object.create(this.lexer);
|
|
194
|
+
var sharedState = { yy: {} };
|
|
195
|
+
for (var k in this.yy) if (Object.prototype.hasOwnProperty.call(this.yy, k)) sharedState.yy[k] = this.yy[k];
|
|
196
|
+
lexer2.setInput(input, sharedState.yy);
|
|
197
|
+
sharedState.yy.lexer = lexer2;
|
|
198
|
+
sharedState.yy.parser = this;
|
|
199
|
+
if (typeof lexer2.yylloc == "undefined") lexer2.yylloc = {};
|
|
200
|
+
var yyloc = lexer2.yylloc;
|
|
201
|
+
lstack.push(yyloc);
|
|
202
|
+
var ranges = lexer2.options && lexer2.options.ranges;
|
|
203
|
+
if (typeof sharedState.yy.parseError === "function") this.parseError = sharedState.yy.parseError;
|
|
204
|
+
else this.parseError = Object.getPrototypeOf(this).parseError;
|
|
205
|
+
function popStack(n) {
|
|
206
|
+
stack.length = stack.length - 2 * n;
|
|
207
|
+
vstack.length = vstack.length - n;
|
|
208
|
+
lstack.length = lstack.length - n;
|
|
209
|
+
}
|
|
210
|
+
__name(popStack, "popStack");
|
|
211
|
+
function lex() {
|
|
212
|
+
var token = tstack.pop() || lexer2.lex() || EOF;
|
|
213
|
+
if (typeof token !== "number") {
|
|
214
|
+
if (token instanceof Array) {
|
|
215
|
+
tstack = token;
|
|
216
|
+
token = tstack.pop();
|
|
217
|
+
}
|
|
218
|
+
token = self.symbols_[token] || token;
|
|
219
|
+
}
|
|
220
|
+
return token;
|
|
221
|
+
}
|
|
222
|
+
__name(lex, "lex");
|
|
223
|
+
var symbol, preErrorSymbol, state, action, r, yyval = {}, p, len, newState, expected;
|
|
224
|
+
while (true) {
|
|
225
|
+
state = stack[stack.length - 1];
|
|
226
|
+
if (this.defaultActions[state]) action = this.defaultActions[state];
|
|
227
|
+
else {
|
|
228
|
+
if (symbol === null || typeof symbol == "undefined") symbol = lex();
|
|
229
|
+
action = table[state] && table[state][symbol];
|
|
230
|
+
}
|
|
231
|
+
if (typeof action === "undefined" || !action.length || !action[0]) {
|
|
232
|
+
var errStr = "";
|
|
233
|
+
expected = [];
|
|
234
|
+
for (p in table[state]) if (this.terminals_[p] && p > TERROR) expected.push("'" + this.terminals_[p] + "'");
|
|
235
|
+
if (lexer2.showPosition) errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
|
|
236
|
+
else errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
|
|
237
|
+
this.parseError(errStr, {
|
|
238
|
+
text: lexer2.match,
|
|
239
|
+
token: this.terminals_[symbol] || symbol,
|
|
240
|
+
line: lexer2.yylineno,
|
|
241
|
+
loc: yyloc,
|
|
242
|
+
expected
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
if (action[0] instanceof Array && action.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
|
|
246
|
+
switch (action[0]) {
|
|
247
|
+
case 1:
|
|
248
|
+
stack.push(symbol);
|
|
249
|
+
vstack.push(lexer2.yytext);
|
|
250
|
+
lstack.push(lexer2.yylloc);
|
|
251
|
+
stack.push(action[1]);
|
|
252
|
+
symbol = null;
|
|
253
|
+
if (!preErrorSymbol) {
|
|
254
|
+
yyleng = lexer2.yyleng;
|
|
255
|
+
yytext = lexer2.yytext;
|
|
256
|
+
yylineno = lexer2.yylineno;
|
|
257
|
+
yyloc = lexer2.yylloc;
|
|
258
|
+
if (recovering > 0) recovering--;
|
|
259
|
+
} else {
|
|
260
|
+
symbol = preErrorSymbol;
|
|
261
|
+
preErrorSymbol = null;
|
|
262
|
+
}
|
|
263
|
+
break;
|
|
264
|
+
case 2:
|
|
265
|
+
len = this.productions_[action[1]][1];
|
|
266
|
+
yyval.$ = vstack[vstack.length - len];
|
|
267
|
+
yyval._$ = {
|
|
268
|
+
first_line: lstack[lstack.length - (len || 1)].first_line,
|
|
269
|
+
last_line: lstack[lstack.length - 1].last_line,
|
|
270
|
+
first_column: lstack[lstack.length - (len || 1)].first_column,
|
|
271
|
+
last_column: lstack[lstack.length - 1].last_column
|
|
272
|
+
};
|
|
273
|
+
if (ranges) yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
|
|
274
|
+
r = this.performAction.apply(yyval, [
|
|
275
|
+
yytext,
|
|
276
|
+
yyleng,
|
|
277
|
+
yylineno,
|
|
278
|
+
sharedState.yy,
|
|
279
|
+
action[1],
|
|
280
|
+
vstack,
|
|
281
|
+
lstack
|
|
282
|
+
].concat(args));
|
|
283
|
+
if (typeof r !== "undefined") return r;
|
|
284
|
+
if (len) {
|
|
285
|
+
stack = stack.slice(0, -1 * len * 2);
|
|
286
|
+
vstack = vstack.slice(0, -1 * len);
|
|
287
|
+
lstack = lstack.slice(0, -1 * len);
|
|
288
|
+
}
|
|
289
|
+
stack.push(this.productions_[action[1]][0]);
|
|
290
|
+
vstack.push(yyval.$);
|
|
291
|
+
lstack.push(yyval._$);
|
|
292
|
+
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
|
293
|
+
stack.push(newState);
|
|
294
|
+
break;
|
|
295
|
+
case 3: return true;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return true;
|
|
299
|
+
}, "parse")
|
|
300
|
+
};
|
|
301
|
+
parser2.lexer = /* @__PURE__ */ (function() {
|
|
302
|
+
return {
|
|
303
|
+
EOF: 1,
|
|
304
|
+
parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
|
|
305
|
+
if (this.yy.parser) this.yy.parser.parseError(str, hash);
|
|
306
|
+
else throw new Error(str);
|
|
307
|
+
}, "parseError"),
|
|
308
|
+
setInput: /* @__PURE__ */ __name(function(input, yy) {
|
|
309
|
+
this.yy = yy || this.yy || {};
|
|
310
|
+
this._input = input;
|
|
311
|
+
this._more = this._backtrack = this.done = false;
|
|
312
|
+
this.yylineno = this.yyleng = 0;
|
|
313
|
+
this.yytext = this.matched = this.match = "";
|
|
314
|
+
this.conditionStack = ["INITIAL"];
|
|
315
|
+
this.yylloc = {
|
|
316
|
+
first_line: 1,
|
|
317
|
+
first_column: 0,
|
|
318
|
+
last_line: 1,
|
|
319
|
+
last_column: 0
|
|
320
|
+
};
|
|
321
|
+
if (this.options.ranges) this.yylloc.range = [0, 0];
|
|
322
|
+
this.offset = 0;
|
|
323
|
+
return this;
|
|
324
|
+
}, "setInput"),
|
|
325
|
+
input: /* @__PURE__ */ __name(function() {
|
|
326
|
+
var ch = this._input[0];
|
|
327
|
+
this.yytext += ch;
|
|
328
|
+
this.yyleng++;
|
|
329
|
+
this.offset++;
|
|
330
|
+
this.match += ch;
|
|
331
|
+
this.matched += ch;
|
|
332
|
+
if (ch.match(/(?:\r\n?|\n).*/g)) {
|
|
333
|
+
this.yylineno++;
|
|
334
|
+
this.yylloc.last_line++;
|
|
335
|
+
} else this.yylloc.last_column++;
|
|
336
|
+
if (this.options.ranges) this.yylloc.range[1]++;
|
|
337
|
+
this._input = this._input.slice(1);
|
|
338
|
+
return ch;
|
|
339
|
+
}, "input"),
|
|
340
|
+
unput: /* @__PURE__ */ __name(function(ch) {
|
|
341
|
+
var len = ch.length;
|
|
342
|
+
var lines = ch.split(/(?:\r\n?|\n)/g);
|
|
343
|
+
this._input = ch + this._input;
|
|
344
|
+
this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
|
345
|
+
this.offset -= len;
|
|
346
|
+
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
|
347
|
+
this.match = this.match.substr(0, this.match.length - 1);
|
|
348
|
+
this.matched = this.matched.substr(0, this.matched.length - 1);
|
|
349
|
+
if (lines.length - 1) this.yylineno -= lines.length - 1;
|
|
350
|
+
var r = this.yylloc.range;
|
|
351
|
+
this.yylloc = {
|
|
352
|
+
first_line: this.yylloc.first_line,
|
|
353
|
+
last_line: this.yylineno + 1,
|
|
354
|
+
first_column: this.yylloc.first_column,
|
|
355
|
+
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
|
|
356
|
+
};
|
|
357
|
+
if (this.options.ranges) this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
|
358
|
+
this.yyleng = this.yytext.length;
|
|
359
|
+
return this;
|
|
360
|
+
}, "unput"),
|
|
361
|
+
more: /* @__PURE__ */ __name(function() {
|
|
362
|
+
this._more = true;
|
|
363
|
+
return this;
|
|
364
|
+
}, "more"),
|
|
365
|
+
reject: /* @__PURE__ */ __name(function() {
|
|
366
|
+
if (this.options.backtrack_lexer) this._backtrack = true;
|
|
367
|
+
else 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(), {
|
|
368
|
+
text: "",
|
|
369
|
+
token: null,
|
|
370
|
+
line: this.yylineno
|
|
371
|
+
});
|
|
372
|
+
return this;
|
|
373
|
+
}, "reject"),
|
|
374
|
+
less: /* @__PURE__ */ __name(function(n) {
|
|
375
|
+
this.unput(this.match.slice(n));
|
|
376
|
+
}, "less"),
|
|
377
|
+
pastInput: /* @__PURE__ */ __name(function() {
|
|
378
|
+
var past = this.matched.substr(0, this.matched.length - this.match.length);
|
|
379
|
+
return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
|
|
380
|
+
}, "pastInput"),
|
|
381
|
+
upcomingInput: /* @__PURE__ */ __name(function() {
|
|
382
|
+
var next = this.match;
|
|
383
|
+
if (next.length < 20) next += this._input.substr(0, 20 - next.length);
|
|
384
|
+
return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
|
|
385
|
+
}, "upcomingInput"),
|
|
386
|
+
showPosition: /* @__PURE__ */ __name(function() {
|
|
387
|
+
var pre = this.pastInput();
|
|
388
|
+
var c = new Array(pre.length + 1).join("-");
|
|
389
|
+
return pre + this.upcomingInput() + "\n" + c + "^";
|
|
390
|
+
}, "showPosition"),
|
|
391
|
+
test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
|
|
392
|
+
var token, lines, backup;
|
|
393
|
+
if (this.options.backtrack_lexer) {
|
|
394
|
+
backup = {
|
|
395
|
+
yylineno: this.yylineno,
|
|
396
|
+
yylloc: {
|
|
397
|
+
first_line: this.yylloc.first_line,
|
|
398
|
+
last_line: this.last_line,
|
|
399
|
+
first_column: this.yylloc.first_column,
|
|
400
|
+
last_column: this.yylloc.last_column
|
|
401
|
+
},
|
|
402
|
+
yytext: this.yytext,
|
|
403
|
+
match: this.match,
|
|
404
|
+
matches: this.matches,
|
|
405
|
+
matched: this.matched,
|
|
406
|
+
yyleng: this.yyleng,
|
|
407
|
+
offset: this.offset,
|
|
408
|
+
_more: this._more,
|
|
409
|
+
_input: this._input,
|
|
410
|
+
yy: this.yy,
|
|
411
|
+
conditionStack: this.conditionStack.slice(0),
|
|
412
|
+
done: this.done
|
|
413
|
+
};
|
|
414
|
+
if (this.options.ranges) backup.yylloc.range = this.yylloc.range.slice(0);
|
|
415
|
+
}
|
|
416
|
+
lines = match[0].match(/(?:\r\n?|\n).*/g);
|
|
417
|
+
if (lines) this.yylineno += lines.length;
|
|
418
|
+
this.yylloc = {
|
|
419
|
+
first_line: this.yylloc.last_line,
|
|
420
|
+
last_line: this.yylineno + 1,
|
|
421
|
+
first_column: this.yylloc.last_column,
|
|
422
|
+
last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
|
|
423
|
+
};
|
|
424
|
+
this.yytext += match[0];
|
|
425
|
+
this.match += match[0];
|
|
426
|
+
this.matches = match;
|
|
427
|
+
this.yyleng = this.yytext.length;
|
|
428
|
+
if (this.options.ranges) this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
|
429
|
+
this._more = false;
|
|
430
|
+
this._backtrack = false;
|
|
431
|
+
this._input = this._input.slice(match[0].length);
|
|
432
|
+
this.matched += match[0];
|
|
433
|
+
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
|
434
|
+
if (this.done && this._input) this.done = false;
|
|
435
|
+
if (token) return token;
|
|
436
|
+
else if (this._backtrack) {
|
|
437
|
+
for (var k in backup) this[k] = backup[k];
|
|
438
|
+
return false;
|
|
439
|
+
}
|
|
440
|
+
return false;
|
|
441
|
+
}, "test_match"),
|
|
442
|
+
next: /* @__PURE__ */ __name(function() {
|
|
443
|
+
if (this.done) return this.EOF;
|
|
444
|
+
if (!this._input) this.done = true;
|
|
445
|
+
var token, match, tempMatch, index;
|
|
446
|
+
if (!this._more) {
|
|
447
|
+
this.yytext = "";
|
|
448
|
+
this.match = "";
|
|
449
|
+
}
|
|
450
|
+
var rules = this._currentRules();
|
|
451
|
+
for (var i = 0; i < rules.length; i++) {
|
|
452
|
+
tempMatch = this._input.match(this.rules[rules[i]]);
|
|
453
|
+
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
|
454
|
+
match = tempMatch;
|
|
455
|
+
index = i;
|
|
456
|
+
if (this.options.backtrack_lexer) {
|
|
457
|
+
token = this.test_match(tempMatch, rules[i]);
|
|
458
|
+
if (token !== false) return token;
|
|
459
|
+
else if (this._backtrack) {
|
|
460
|
+
match = false;
|
|
461
|
+
continue;
|
|
462
|
+
} else return false;
|
|
463
|
+
} else if (!this.options.flex) break;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
if (match) {
|
|
467
|
+
token = this.test_match(match, rules[index]);
|
|
468
|
+
if (token !== false) return token;
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
if (this._input === "") return this.EOF;
|
|
472
|
+
else return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
|
|
473
|
+
text: "",
|
|
474
|
+
token: null,
|
|
475
|
+
line: this.yylineno
|
|
476
|
+
});
|
|
477
|
+
}, "next"),
|
|
478
|
+
lex: /* @__PURE__ */ __name(function lex() {
|
|
479
|
+
var r = this.next();
|
|
480
|
+
if (r) return r;
|
|
481
|
+
else return this.lex();
|
|
482
|
+
}, "lex"),
|
|
483
|
+
begin: /* @__PURE__ */ __name(function begin(condition) {
|
|
484
|
+
this.conditionStack.push(condition);
|
|
485
|
+
}, "begin"),
|
|
486
|
+
popState: /* @__PURE__ */ __name(function popState() {
|
|
487
|
+
if (this.conditionStack.length - 1 > 0) return this.conditionStack.pop();
|
|
488
|
+
else return this.conditionStack[0];
|
|
489
|
+
}, "popState"),
|
|
490
|
+
_currentRules: /* @__PURE__ */ __name(function _currentRules() {
|
|
491
|
+
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
|
492
|
+
else return this.conditions["INITIAL"].rules;
|
|
493
|
+
}, "_currentRules"),
|
|
494
|
+
topState: /* @__PURE__ */ __name(function topState(n) {
|
|
495
|
+
n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
|
496
|
+
if (n >= 0) return this.conditionStack[n];
|
|
497
|
+
else return "INITIAL";
|
|
498
|
+
}, "topState"),
|
|
499
|
+
pushState: /* @__PURE__ */ __name(function pushState(condition) {
|
|
500
|
+
this.begin(condition);
|
|
501
|
+
}, "pushState"),
|
|
502
|
+
stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
|
|
503
|
+
return this.conditionStack.length;
|
|
504
|
+
}, "stateStackSize"),
|
|
505
|
+
options: { "case-insensitive": true },
|
|
506
|
+
performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
|
|
507
|
+
switch ($avoiding_name_collisions) {
|
|
508
|
+
case 0: return 6;
|
|
509
|
+
case 1: return 8;
|
|
510
|
+
case 2: return 8;
|
|
511
|
+
case 3: return 6;
|
|
512
|
+
case 4: return 7;
|
|
513
|
+
case 5: return 13;
|
|
514
|
+
case 6: return 14;
|
|
515
|
+
case 7: return 11;
|
|
516
|
+
}
|
|
517
|
+
}, "anonymous"),
|
|
518
|
+
rules: [
|
|
519
|
+
/^(?:\s*%%.*)/i,
|
|
520
|
+
/^(?:ishikawa-beta\b)/i,
|
|
521
|
+
/^(?:ishikawa\b)/i,
|
|
522
|
+
/^(?:[\s]+[\n])/i,
|
|
523
|
+
/^(?:[\n]+)/i,
|
|
524
|
+
/^(?:[\s]+)/i,
|
|
525
|
+
/^(?:[^\n]+)/i,
|
|
526
|
+
/^(?:$)/i
|
|
527
|
+
],
|
|
528
|
+
conditions: { "INITIAL": {
|
|
529
|
+
"rules": [
|
|
530
|
+
0,
|
|
531
|
+
1,
|
|
532
|
+
2,
|
|
533
|
+
3,
|
|
534
|
+
4,
|
|
535
|
+
5,
|
|
536
|
+
6,
|
|
537
|
+
7
|
|
538
|
+
],
|
|
539
|
+
"inclusive": true
|
|
540
|
+
} }
|
|
541
|
+
};
|
|
542
|
+
})();
|
|
543
|
+
function Parser() {
|
|
544
|
+
this.yy = {};
|
|
545
|
+
}
|
|
546
|
+
__name(Parser, "Parser");
|
|
547
|
+
Parser.prototype = parser2;
|
|
548
|
+
parser2.Parser = Parser;
|
|
549
|
+
return new Parser();
|
|
550
|
+
})();
|
|
551
|
+
parser.parser = parser;
|
|
552
|
+
var ishikawa_default = parser;
|
|
553
|
+
var IshikawaDB = class {
|
|
554
|
+
constructor() {
|
|
555
|
+
this.stack = [];
|
|
556
|
+
this.clear = this.clear.bind(this);
|
|
557
|
+
this.addNode = this.addNode.bind(this);
|
|
558
|
+
this.getRoot = this.getRoot.bind(this);
|
|
559
|
+
}
|
|
560
|
+
static {
|
|
561
|
+
__name(this, "IshikawaDB");
|
|
562
|
+
}
|
|
563
|
+
clear() {
|
|
564
|
+
this.root = void 0;
|
|
565
|
+
this.stack = [];
|
|
566
|
+
this.baseLevel = void 0;
|
|
567
|
+
clear();
|
|
568
|
+
}
|
|
569
|
+
getRoot() {
|
|
570
|
+
return this.root;
|
|
571
|
+
}
|
|
572
|
+
addNode(rawLevel, text) {
|
|
573
|
+
const label = common_default.sanitizeText(text, getConfig2());
|
|
574
|
+
if (!this.root) {
|
|
575
|
+
this.root = {
|
|
576
|
+
text: label,
|
|
577
|
+
children: []
|
|
578
|
+
};
|
|
579
|
+
this.stack = [{
|
|
580
|
+
level: 0,
|
|
581
|
+
node: this.root
|
|
582
|
+
}];
|
|
583
|
+
setDiagramTitle(label);
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
this.baseLevel ??= rawLevel;
|
|
587
|
+
let level = rawLevel - this.baseLevel + 1;
|
|
588
|
+
if (level <= 0) level = 1;
|
|
589
|
+
while (this.stack.length > 1 && this.stack[this.stack.length - 1].level >= level) this.stack.pop();
|
|
590
|
+
const parent = this.stack[this.stack.length - 1].node;
|
|
591
|
+
const node = {
|
|
592
|
+
text: label,
|
|
593
|
+
children: []
|
|
594
|
+
};
|
|
595
|
+
parent.children.push(node);
|
|
596
|
+
this.stack.push({
|
|
597
|
+
level,
|
|
598
|
+
node
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
getAccTitle() {
|
|
602
|
+
return getAccTitle();
|
|
603
|
+
}
|
|
604
|
+
setAccTitle(title) {
|
|
605
|
+
setAccTitle(title);
|
|
606
|
+
}
|
|
607
|
+
getAccDescription() {
|
|
608
|
+
return getAccDescription();
|
|
609
|
+
}
|
|
610
|
+
setAccDescription(description) {
|
|
611
|
+
setAccDescription(description);
|
|
612
|
+
}
|
|
613
|
+
getDiagramTitle() {
|
|
614
|
+
return getDiagramTitle();
|
|
615
|
+
}
|
|
616
|
+
setDiagramTitle(title) {
|
|
617
|
+
setDiagramTitle(title);
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
var FONT_SIZE_DEFAULT = 14;
|
|
621
|
+
var SPINE_BASE_LENGTH = 250;
|
|
622
|
+
var BONE_STUB = 30;
|
|
623
|
+
var BONE_BASE = 60;
|
|
624
|
+
var BONE_PER_CHILD = 5;
|
|
625
|
+
var ANGLE = 82 * Math.PI / 180;
|
|
626
|
+
var COS_A = Math.cos(ANGLE);
|
|
627
|
+
var SIN_A = Math.sin(ANGLE);
|
|
628
|
+
var applyPaddedViewBox = /* @__PURE__ */ __name((svgEl, pad, maxW) => {
|
|
629
|
+
const bbox = svgEl.node().getBBox();
|
|
630
|
+
const w = bbox.width + pad * 2;
|
|
631
|
+
const h = bbox.height + pad * 2;
|
|
632
|
+
configureSvgSize(svgEl, h, w, maxW);
|
|
633
|
+
svgEl.attr("viewBox", `${bbox.x - pad} ${bbox.y - pad} ${w} ${h}`);
|
|
634
|
+
}, "applyPaddedViewBox");
|
|
635
|
+
var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
|
|
636
|
+
const root = diagram2.db.getRoot();
|
|
637
|
+
if (!root) return;
|
|
638
|
+
const drawConfig = getConfig2();
|
|
639
|
+
const { look, handDrawnSeed, themeVariables } = drawConfig;
|
|
640
|
+
const fontSize = parseFontSize(drawConfig.fontSize)[0] ?? FONT_SIZE_DEFAULT;
|
|
641
|
+
const isHandDrawn = look === "handDrawn";
|
|
642
|
+
const causes = root.children ?? [];
|
|
643
|
+
const padding = drawConfig.ishikawa?.diagramPadding ?? 20;
|
|
644
|
+
const useMaxWidth = drawConfig.ishikawa?.useMaxWidth ?? false;
|
|
645
|
+
const svg = selectSvgElement(id);
|
|
646
|
+
const g = svg.append("g").attr("class", "ishikawa");
|
|
647
|
+
const roughSvg = isHandDrawn ? import_rough_cjs.default.svg(svg.node()) : void 0;
|
|
648
|
+
const roughContext = roughSvg ? {
|
|
649
|
+
roughSvg,
|
|
650
|
+
seed: handDrawnSeed ?? 0,
|
|
651
|
+
lineColor: themeVariables?.lineColor ?? "#333",
|
|
652
|
+
fillColor: themeVariables?.mainBkg ?? "#fff"
|
|
653
|
+
} : void 0;
|
|
654
|
+
const markerId = `ishikawa-arrow-${id}`;
|
|
655
|
+
if (!isHandDrawn) g.append("defs").append("marker").attr("id", markerId).attr("viewBox", "0 0 10 10").attr("refX", 0).attr("refY", 5).attr("markerWidth", 6).attr("markerHeight", 6).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 Z").attr("class", "ishikawa-arrow");
|
|
656
|
+
let spineX = 0;
|
|
657
|
+
let spineY = SPINE_BASE_LENGTH;
|
|
658
|
+
const spineLine = isHandDrawn ? void 0 : drawLine(g, spineX, spineY, spineX, spineY, "ishikawa-spine");
|
|
659
|
+
drawHead(g, spineX, spineY, root.text, fontSize, roughContext);
|
|
660
|
+
if (!causes.length) {
|
|
661
|
+
if (isHandDrawn) drawLine(g, spineX, spineY, spineX, spineY, "ishikawa-spine", roughContext);
|
|
662
|
+
applyPaddedViewBox(svg, padding, useMaxWidth);
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
spineX -= 20;
|
|
666
|
+
const upperCauses = causes.filter((_, i) => i % 2 === 0);
|
|
667
|
+
const lowerCauses = causes.filter((_, i) => i % 2 === 1);
|
|
668
|
+
const upperStats = sideStats(upperCauses);
|
|
669
|
+
const lowerStats = sideStats(lowerCauses);
|
|
670
|
+
const descendantTotal = upperStats.total + lowerStats.total;
|
|
671
|
+
let upperLen = SPINE_BASE_LENGTH;
|
|
672
|
+
let lowerLen = SPINE_BASE_LENGTH;
|
|
673
|
+
if (descendantTotal > 0) {
|
|
674
|
+
const pool = SPINE_BASE_LENGTH * 2;
|
|
675
|
+
const minLen = SPINE_BASE_LENGTH * .3;
|
|
676
|
+
upperLen = Math.max(minLen, pool * (upperStats.total / descendantTotal));
|
|
677
|
+
lowerLen = Math.max(minLen, pool * (lowerStats.total / descendantTotal));
|
|
678
|
+
}
|
|
679
|
+
const minSpacing = fontSize * 2;
|
|
680
|
+
upperLen = Math.max(upperLen, upperStats.max * minSpacing);
|
|
681
|
+
lowerLen = Math.max(lowerLen, lowerStats.max * minSpacing);
|
|
682
|
+
spineY = Math.max(upperLen, SPINE_BASE_LENGTH);
|
|
683
|
+
if (spineLine) spineLine.attr("y1", spineY).attr("y2", spineY);
|
|
684
|
+
g.select(".ishikawa-head-group").attr("transform", `translate(0,${spineY})`);
|
|
685
|
+
const pairCount = Math.ceil(causes.length / 2);
|
|
686
|
+
for (let p = 0; p < pairCount; p++) {
|
|
687
|
+
const pg = g.append("g").attr("class", "ishikawa-pair");
|
|
688
|
+
for (const [cause, dir, len] of [[
|
|
689
|
+
causes[p * 2],
|
|
690
|
+
-1,
|
|
691
|
+
upperLen
|
|
692
|
+
], [
|
|
693
|
+
causes[p * 2 + 1],
|
|
694
|
+
1,
|
|
695
|
+
lowerLen
|
|
696
|
+
]]) if (cause) drawBranch(pg, cause, spineX, spineY, dir, len, fontSize, roughContext);
|
|
697
|
+
spineX = pg.selectAll("text").nodes().reduce((left, n) => Math.min(left, n.getBBox().x), Infinity);
|
|
698
|
+
}
|
|
699
|
+
if (isHandDrawn) drawLine(g, spineX, spineY, 0, spineY, "ishikawa-spine", roughContext);
|
|
700
|
+
else {
|
|
701
|
+
spineLine.attr("x1", spineX);
|
|
702
|
+
const markerUrl = `url(#${markerId})`;
|
|
703
|
+
g.selectAll("line.ishikawa-branch, line.ishikawa-sub-branch").attr("marker-start", markerUrl);
|
|
704
|
+
}
|
|
705
|
+
applyPaddedViewBox(svg, padding, useMaxWidth);
|
|
706
|
+
}, "draw");
|
|
707
|
+
var sideStats = /* @__PURE__ */ __name((nodes) => {
|
|
708
|
+
const countDescendants = /* @__PURE__ */ __name((node) => node.children.reduce((sum, child) => sum + 1 + countDescendants(child), 0), "countDescendants");
|
|
709
|
+
return nodes.reduce((stats, node) => {
|
|
710
|
+
const descendants = countDescendants(node);
|
|
711
|
+
stats.total += descendants;
|
|
712
|
+
stats.max = Math.max(stats.max, descendants);
|
|
713
|
+
return stats;
|
|
714
|
+
}, {
|
|
715
|
+
total: 0,
|
|
716
|
+
max: 0
|
|
717
|
+
});
|
|
718
|
+
}, "sideStats");
|
|
719
|
+
var drawHead = /* @__PURE__ */ __name((svg, x, y, label, fontSize, roughContext) => {
|
|
720
|
+
const maxChars = Math.max(6, Math.floor(110 / (fontSize * .6)));
|
|
721
|
+
const headGroup = svg.append("g").attr("class", "ishikawa-head-group").attr("transform", `translate(${x},${y})`);
|
|
722
|
+
const textEl = drawMultilineText(headGroup, wrapText(label, maxChars), 0, 0, "ishikawa-head-label", "start", fontSize);
|
|
723
|
+
const tb = textEl.node().getBBox();
|
|
724
|
+
const w = Math.max(60, tb.width + 6);
|
|
725
|
+
const h = Math.max(40, tb.height * 2 + 40);
|
|
726
|
+
const headPath = `M 0 ${-h / 2} L 0 ${h / 2} Q ${w * 2.4} 0 0 ${-h / 2} Z`;
|
|
727
|
+
if (roughContext) {
|
|
728
|
+
const roughNode = roughContext.roughSvg.path(headPath, {
|
|
729
|
+
roughness: 1.5,
|
|
730
|
+
seed: roughContext.seed,
|
|
731
|
+
fill: roughContext.fillColor,
|
|
732
|
+
fillStyle: "hachure",
|
|
733
|
+
fillWeight: 2.5,
|
|
734
|
+
hachureGap: 5,
|
|
735
|
+
stroke: roughContext.lineColor,
|
|
736
|
+
strokeWidth: 2
|
|
737
|
+
});
|
|
738
|
+
headGroup.insert(() => roughNode, ":first-child").attr("class", "ishikawa-head");
|
|
739
|
+
} else headGroup.insert("path", ":first-child").attr("class", "ishikawa-head").attr("d", headPath);
|
|
740
|
+
textEl.attr("transform", `translate(${(w - tb.width) / 2 - tb.x + 3},${-tb.y - tb.height / 2})`);
|
|
741
|
+
}, "drawHead");
|
|
742
|
+
var flattenTree = /* @__PURE__ */ __name((children, direction) => {
|
|
743
|
+
const entries = [];
|
|
744
|
+
const yOrder = [];
|
|
745
|
+
const walk = /* @__PURE__ */ __name((nodes, pid, depth) => {
|
|
746
|
+
const ordered = direction === -1 ? [...nodes].reverse() : nodes;
|
|
747
|
+
for (const child of ordered) {
|
|
748
|
+
const idx = entries.length;
|
|
749
|
+
const gc = child.children ?? [];
|
|
750
|
+
entries.push({
|
|
751
|
+
depth,
|
|
752
|
+
text: wrapText(child.text, 15),
|
|
753
|
+
parentIndex: pid,
|
|
754
|
+
childCount: gc.length
|
|
755
|
+
});
|
|
756
|
+
if (depth % 2 === 0) {
|
|
757
|
+
yOrder.push(idx);
|
|
758
|
+
if (gc.length) walk(gc, idx, depth + 1);
|
|
759
|
+
} else {
|
|
760
|
+
if (gc.length) walk(gc, idx, depth + 1);
|
|
761
|
+
yOrder.push(idx);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}, "walk");
|
|
765
|
+
walk(children, -1, 2);
|
|
766
|
+
return {
|
|
767
|
+
entries,
|
|
768
|
+
yOrder
|
|
769
|
+
};
|
|
770
|
+
}, "flattenTree");
|
|
771
|
+
var drawCauseLabel = /* @__PURE__ */ __name((svg, text, x, y, direction, fontSize, roughContext) => {
|
|
772
|
+
const lg = svg.append("g").attr("class", "ishikawa-label-group");
|
|
773
|
+
const tb = drawMultilineText(lg, text, x, y + 11 * direction, "ishikawa-label cause", "middle", fontSize).node().getBBox();
|
|
774
|
+
if (roughContext) {
|
|
775
|
+
const roughNode = roughContext.roughSvg.rectangle(tb.x - 20, tb.y - 2, tb.width + 40, tb.height + 4, {
|
|
776
|
+
roughness: 1.5,
|
|
777
|
+
seed: roughContext.seed,
|
|
778
|
+
fill: roughContext.fillColor,
|
|
779
|
+
fillStyle: "hachure",
|
|
780
|
+
fillWeight: 2.5,
|
|
781
|
+
hachureGap: 5,
|
|
782
|
+
stroke: roughContext.lineColor,
|
|
783
|
+
strokeWidth: 2
|
|
784
|
+
});
|
|
785
|
+
lg.insert(() => roughNode, ":first-child").attr("class", "ishikawa-label-box");
|
|
786
|
+
} else lg.insert("rect", ":first-child").attr("class", "ishikawa-label-box").attr("x", tb.x - 20).attr("y", tb.y - 2).attr("width", tb.width + 40).attr("height", tb.height + 4);
|
|
787
|
+
}, "drawCauseLabel");
|
|
788
|
+
var drawArrowMarker = /* @__PURE__ */ __name((g, x, y, dx, dy, roughContext) => {
|
|
789
|
+
const len = Math.sqrt(dx * dx + dy * dy);
|
|
790
|
+
if (len === 0) return;
|
|
791
|
+
const ux = dx / len;
|
|
792
|
+
const uy = dy / len;
|
|
793
|
+
const s = 6;
|
|
794
|
+
const px = -uy * s;
|
|
795
|
+
const py = ux * s;
|
|
796
|
+
const tipX = x;
|
|
797
|
+
const tipY = y;
|
|
798
|
+
const d = `M ${tipX} ${tipY} L ${tipX - ux * s * 2 + px} ${tipY - uy * s * 2 + py} L ${tipX - ux * s * 2 - px} ${tipY - uy * s * 2 - py} Z`;
|
|
799
|
+
const roughNode = roughContext.roughSvg.path(d, {
|
|
800
|
+
roughness: 1,
|
|
801
|
+
seed: roughContext.seed,
|
|
802
|
+
fill: roughContext.lineColor,
|
|
803
|
+
fillStyle: "solid",
|
|
804
|
+
stroke: roughContext.lineColor,
|
|
805
|
+
strokeWidth: 1
|
|
806
|
+
});
|
|
807
|
+
g.append(() => roughNode);
|
|
808
|
+
}, "drawArrowMarker");
|
|
809
|
+
var drawBranch = /* @__PURE__ */ __name((svg, node, startX, startY, direction, length, fontSize, roughContext) => {
|
|
810
|
+
const children = node.children ?? [];
|
|
811
|
+
const lineLen = length * (children.length ? 1 : .2);
|
|
812
|
+
const dx = -COS_A * lineLen;
|
|
813
|
+
const dy = SIN_A * lineLen * direction;
|
|
814
|
+
const endX = startX + dx;
|
|
815
|
+
const endY = startY + dy;
|
|
816
|
+
drawLine(svg, startX, startY, endX, endY, "ishikawa-branch", roughContext);
|
|
817
|
+
if (roughContext) drawArrowMarker(svg, startX, startY, startX - endX, startY - endY, roughContext);
|
|
818
|
+
drawCauseLabel(svg, node.text, endX, endY, direction, fontSize, roughContext);
|
|
819
|
+
if (!children.length) return;
|
|
820
|
+
const { entries, yOrder } = flattenTree(children, direction);
|
|
821
|
+
const entryCount = entries.length;
|
|
822
|
+
const ys = new Array(entryCount);
|
|
823
|
+
for (const [slot, entryIdx] of yOrder.entries()) ys[entryIdx] = startY + dy * ((slot + 1) / (entryCount + 1));
|
|
824
|
+
const bones = /* @__PURE__ */ new Map();
|
|
825
|
+
bones.set(-1, {
|
|
826
|
+
x0: startX,
|
|
827
|
+
y0: startY,
|
|
828
|
+
x1: endX,
|
|
829
|
+
y1: endY,
|
|
830
|
+
childCount: children.length,
|
|
831
|
+
childrenDrawn: 0
|
|
832
|
+
});
|
|
833
|
+
const diagonalX = -COS_A;
|
|
834
|
+
const diagonalY = SIN_A * direction;
|
|
835
|
+
const oddLabel = direction < 0 ? "ishikawa-label up" : "ishikawa-label down";
|
|
836
|
+
for (const [i, e] of entries.entries()) {
|
|
837
|
+
const y = ys[i];
|
|
838
|
+
const par = bones.get(e.parentIndex);
|
|
839
|
+
const grp = svg.append("g").attr("class", "ishikawa-sub-group");
|
|
840
|
+
let bx0 = 0;
|
|
841
|
+
let by0 = 0;
|
|
842
|
+
let bx1 = 0;
|
|
843
|
+
if (e.depth % 2 === 0) {
|
|
844
|
+
const dyP = par.y1 - par.y0;
|
|
845
|
+
bx0 = lerp(par.x0, par.x1, dyP ? (y - par.y0) / dyP : .5);
|
|
846
|
+
by0 = y;
|
|
847
|
+
bx1 = bx0 - (e.childCount > 0 ? BONE_BASE + e.childCount * BONE_PER_CHILD : BONE_STUB);
|
|
848
|
+
drawLine(grp, bx0, y, bx1, y, "ishikawa-sub-branch", roughContext);
|
|
849
|
+
if (roughContext) drawArrowMarker(grp, bx0, y, 1, 0, roughContext);
|
|
850
|
+
drawMultilineText(grp, e.text, bx1, y, "ishikawa-label align", "end", fontSize);
|
|
851
|
+
} else {
|
|
852
|
+
const k = par.childrenDrawn++;
|
|
853
|
+
bx0 = lerp(par.x0, par.x1, (par.childCount - k) / (par.childCount + 1));
|
|
854
|
+
by0 = par.y0;
|
|
855
|
+
bx1 = bx0 + diagonalX * ((y - by0) / diagonalY);
|
|
856
|
+
drawLine(grp, bx0, by0, bx1, y, "ishikawa-sub-branch", roughContext);
|
|
857
|
+
if (roughContext) drawArrowMarker(grp, bx0, by0, bx0 - bx1, by0 - y, roughContext);
|
|
858
|
+
drawMultilineText(grp, e.text, bx1, y, oddLabel, "end", fontSize);
|
|
859
|
+
}
|
|
860
|
+
if (e.childCount > 0) bones.set(i, {
|
|
861
|
+
x0: bx0,
|
|
862
|
+
y0: by0,
|
|
863
|
+
x1: bx1,
|
|
864
|
+
y1: y,
|
|
865
|
+
childCount: e.childCount,
|
|
866
|
+
childrenDrawn: 0
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
}, "drawBranch");
|
|
870
|
+
var splitLines = /* @__PURE__ */ __name((text) => text.split(/<br\s*\/?>|\n/), "splitLines");
|
|
871
|
+
var wrapText = /* @__PURE__ */ __name((text, maxChars) => {
|
|
872
|
+
if (text.length <= maxChars) return text;
|
|
873
|
+
const lines = [];
|
|
874
|
+
for (const word of text.split(/\s+/)) {
|
|
875
|
+
const last = lines.length - 1;
|
|
876
|
+
if (last >= 0 && lines[last].length + 1 + word.length <= maxChars) lines[last] += " " + word;
|
|
877
|
+
else lines.push(word);
|
|
878
|
+
}
|
|
879
|
+
return lines.join("\n");
|
|
880
|
+
}, "wrapText");
|
|
881
|
+
var drawMultilineText = /* @__PURE__ */ __name((g, text, x, y, cls, anchor, fontSize) => {
|
|
882
|
+
const lines = splitLines(text);
|
|
883
|
+
const lh = fontSize * 1.05;
|
|
884
|
+
const el = g.append("text").attr("class", cls).attr("text-anchor", anchor).attr("x", x).attr("y", y - (lines.length - 1) * lh / 2);
|
|
885
|
+
for (const [i, line] of lines.entries()) el.append("tspan").attr("x", x).attr("dy", i === 0 ? 0 : lh).text(line);
|
|
886
|
+
return el;
|
|
887
|
+
}, "drawMultilineText");
|
|
888
|
+
var lerp = /* @__PURE__ */ __name((a, b, t) => a + (b - a) * t, "lerp");
|
|
889
|
+
var drawLine = /* @__PURE__ */ __name((g, x1, y1, x2, y2, cls, roughContext) => {
|
|
890
|
+
if (roughContext) {
|
|
891
|
+
const roughNode = roughContext.roughSvg.line(x1, y1, x2, y2, {
|
|
892
|
+
roughness: 1.5,
|
|
893
|
+
seed: roughContext.seed,
|
|
894
|
+
stroke: roughContext.lineColor,
|
|
895
|
+
strokeWidth: 2
|
|
896
|
+
});
|
|
897
|
+
g.append(() => roughNode).attr("class", cls);
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
return g.append("line").attr("class", cls).attr("x1", x1).attr("y1", y1).attr("x2", x2).attr("y2", y2);
|
|
901
|
+
}, "drawLine");
|
|
902
|
+
var diagram = {
|
|
903
|
+
parser: ishikawa_default,
|
|
904
|
+
get db() {
|
|
905
|
+
return new IshikawaDB();
|
|
906
|
+
},
|
|
907
|
+
renderer: { draw },
|
|
908
|
+
styles: /* @__PURE__ */ __name((options) => `
|
|
909
|
+
.ishikawa .ishikawa-spine,
|
|
910
|
+
.ishikawa .ishikawa-branch,
|
|
911
|
+
.ishikawa .ishikawa-sub-branch {
|
|
912
|
+
stroke: ${options.lineColor};
|
|
913
|
+
stroke-width: 2;
|
|
914
|
+
fill: none;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
.ishikawa .ishikawa-sub-branch {
|
|
918
|
+
stroke-width: 1;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
.ishikawa .ishikawa-arrow {
|
|
922
|
+
fill: ${options.lineColor};
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
.ishikawa .ishikawa-head {
|
|
926
|
+
fill: ${options.mainBkg};
|
|
927
|
+
stroke: ${options.lineColor};
|
|
928
|
+
stroke-width: 2;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
.ishikawa .ishikawa-label-box {
|
|
932
|
+
fill: ${options.mainBkg};
|
|
933
|
+
stroke: ${options.lineColor};
|
|
934
|
+
stroke-width: 2;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
.ishikawa text {
|
|
938
|
+
font-family: ${options.fontFamily};
|
|
939
|
+
font-size: ${options.fontSize};
|
|
940
|
+
fill: ${options.textColor};
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
.ishikawa .ishikawa-head-label {
|
|
944
|
+
font-weight: 600;
|
|
945
|
+
text-anchor: middle;
|
|
946
|
+
dominant-baseline: middle;
|
|
947
|
+
font-size: 14px;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
.ishikawa .ishikawa-label {
|
|
951
|
+
text-anchor: end;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
.ishikawa .ishikawa-label.cause {
|
|
955
|
+
text-anchor: middle;
|
|
956
|
+
dominant-baseline: middle;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
.ishikawa .ishikawa-label.align {
|
|
960
|
+
text-anchor: end;
|
|
961
|
+
dominant-baseline: middle;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
.ishikawa .ishikawa-label.up {
|
|
965
|
+
dominant-baseline: baseline;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
.ishikawa .ishikawa-label.down {
|
|
969
|
+
dominant-baseline: hanging;
|
|
970
|
+
}
|
|
971
|
+
`, "getStyles")
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
//#endregion
|
|
975
|
+
export { diagram };
|