@aidapt/caity-chat 3.0.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/README.md +73 -0
- package/dist/lib/_baseUniq-BVCT-t6P.js +477 -0
- package/dist/lib/arc-Kj6ZmwPS.js +83 -0
- package/dist/lib/architectureDiagram-Q4EWVU46-DA4kYaz_.js +4690 -0
- package/dist/lib/blockDiagram-DXYQGD6D-BWT5yya1.js +2295 -0
- package/dist/lib/c4Diagram-AHTNJAMY-BjY6DW3U.js +1577 -0
- package/dist/lib/caity-chat.tgz +0 -0
- package/dist/lib/channel-BjraetTo.js +5 -0
- package/dist/lib/chunk-4BX2VUAB-iSPZGgxQ.js +8 -0
- package/dist/lib/chunk-4TB4RGXK-DvnUcLoe.js +1465 -0
- package/dist/lib/chunk-55IACEB6-Mw25YX9j.js +8 -0
- package/dist/lib/chunk-EDXVE4YY-Dtbxz7df.js +19 -0
- package/dist/lib/chunk-FMBD7UC4-OCIy3top.js +19 -0
- package/dist/lib/chunk-OYMX7WX6-DFW9El2C.js +1383 -0
- package/dist/lib/chunk-QZHKN3VN-BYFTfk7k.js +15 -0
- package/dist/lib/chunk-YZCP3GAM-Cs-HTcyJ.js +68 -0
- package/dist/lib/classDiagram-6PBFFD2Q-CrDUlIYr.js +16 -0
- package/dist/lib/classDiagram-v2-HSJHXN6E-CrDUlIYr.js +16 -0
- package/dist/lib/clone-C0qEGPCz.js +8 -0
- package/dist/lib/cose-bilkent-S5V4N54A-H1-YbKvI.js +2609 -0
- package/dist/lib/cytoscape.esm-D_3MZVO6.js +18707 -0
- package/dist/lib/dagre-KV5264BT-DhEnTJ4D.js +443 -0
- package/dist/lib/defaultLocale-BgPVtth8.js +171 -0
- package/dist/lib/diagram-5BDNPKRD-CK6wgKxI.js +123 -0
- package/dist/lib/diagram-G4DWMVQ6-IhA_MJ0t.js +528 -0
- package/dist/lib/diagram-MMDJMWI5-DDuA1rYY.js +217 -0
- package/dist/lib/diagram-TYMM5635-_VI1en0S.js +142 -0
- package/dist/lib/erDiagram-SMLLAGMA-B1REwW7y.js +899 -0
- package/dist/lib/flowDiagram-DWJPFMVM-rWzOGDlg.js +1628 -0
- package/dist/lib/ganttDiagram-T4ZO3ILL-UhSvbAmM.js +2701 -0
- package/dist/lib/gitGraphDiagram-UUTBAWPF-DrsSMMoJ.js +815 -0
- package/dist/lib/graph-DMr8NrNW.js +738 -0
- package/dist/lib/index.d.ts +665 -0
- package/dist/lib/index.js +52 -0
- package/dist/lib/infoDiagram-42DDH7IO-CPF3XCNj.js +24 -0
- package/dist/lib/init-DjUOC4st.js +16 -0
- package/dist/lib/ishikawaDiagram-UXIWVN3A-B4Nt1TdW.js +621 -0
- package/dist/lib/journeyDiagram-VCZTEJTY-DW5yRsOM.js +834 -0
- package/dist/lib/kanban-definition-6JOO6SKY-5DmJRubo.js +724 -0
- package/dist/lib/layout-B00IQLgh.js +1441 -0
- package/dist/lib/linear-LLab47WO.js +259 -0
- package/dist/lib/main-C9dvh9CT.js +88771 -0
- package/dist/lib/mermaid.core-BrBkhL9h.js +15967 -0
- package/dist/lib/min-CJFyJhXg.js +38 -0
- package/dist/lib/mindmap-definition-QFDTVHPH-doqZCFNi.js +833 -0
- package/dist/lib/ordinal-B6-f3MAq.js +61 -0
- package/dist/lib/pieDiagram-DEJITSTG-DKi5GKup.js +163 -0
- package/dist/lib/quadrantDiagram-34T5L4WZ-COYWmEhy.js +1022 -0
- package/dist/lib/requirementDiagram-MS252O5E-D3odK6YH.js +882 -0
- package/dist/lib/sankeyDiagram-XADWPNL6-D36eaMCx.js +810 -0
- package/dist/lib/sequenceDiagram-FGHM5R23-NpESTwMk.js +2883 -0
- package/dist/lib/standalone.js +4 -0
- package/dist/lib/stateDiagram-FHFEXIEX-kXZ_Bn-a.js +263 -0
- package/dist/lib/stateDiagram-v2-QKLJ7IA2-B5xMdEuE.js +16 -0
- package/dist/lib/timeline-definition-GMOUNBTQ-DZDdcJwy.js +1055 -0
- package/dist/lib/vennDiagram-DHZGUBPP-Clhb6EGF.js +1557 -0
- package/dist/lib/wardley-RL74JXVD-CwSnyVu7.js +18396 -0
- package/dist/lib/wardleyDiagram-NUSXRM2D-DnXL4F04.js +594 -0
- package/dist/lib/xychartDiagram-5P7HB3ND-CweIkrg3.js +1342 -0
- package/package.json +95 -0
- package/src/types/caity-chat.d.ts +213 -0
- package/src/types/template-slots.d.ts +167 -0
|
@@ -0,0 +1,1557 @@
|
|
|
1
|
+
import { aD as Gt, s as Wt, g as Kt, q as Ht, p as Xt, a as Yt, b as Zt, _ as w, D as wt, I as Jt, d as ot, as as Qt, V as $t, W as te, X as ee, e as ne, z as se, F as ie, G as oe } from "./mermaid.core-BrBkhL9h.js";
|
|
2
|
+
const kt = (t, n) => Gt(t, "a", -n), _t = 1e-10;
|
|
3
|
+
function st(t, n) {
|
|
4
|
+
const s = ae(t), e = s.filter((c) => re(c, t));
|
|
5
|
+
let i = 0, o = 0;
|
|
6
|
+
const a = [];
|
|
7
|
+
if (e.length > 1) {
|
|
8
|
+
const c = Et(e);
|
|
9
|
+
for (let u = 0; u < e.length; ++u) {
|
|
10
|
+
const r = e[u];
|
|
11
|
+
r.angle = Math.atan2(r.x - c.x, r.y - c.y);
|
|
12
|
+
}
|
|
13
|
+
e.sort((u, r) => r.angle - u.angle);
|
|
14
|
+
let h = e[e.length - 1];
|
|
15
|
+
for (let u = 0; u < e.length; ++u) {
|
|
16
|
+
const r = e[u];
|
|
17
|
+
o += (h.x + r.x) * (r.y - h.y);
|
|
18
|
+
const y = { x: (r.x + h.x) / 2, y: (r.y + h.y) / 2 };
|
|
19
|
+
let d = null;
|
|
20
|
+
for (let b = 0; b < r.parentIndex.length; ++b)
|
|
21
|
+
if (h.parentIndex.includes(r.parentIndex[b])) {
|
|
22
|
+
const x = t[r.parentIndex[b]], M = Math.atan2(r.x - x.x, r.y - x.y), A = Math.atan2(h.x - x.x, h.y - x.y);
|
|
23
|
+
let T = A - M;
|
|
24
|
+
T < 0 && (T += 2 * Math.PI);
|
|
25
|
+
const S = A - T / 2;
|
|
26
|
+
let g = q(y, {
|
|
27
|
+
x: x.x + x.radius * Math.sin(S),
|
|
28
|
+
y: x.y + x.radius * Math.cos(S)
|
|
29
|
+
});
|
|
30
|
+
g > x.radius * 2 && (g = x.radius * 2), (d == null || d.width > g) && (d = { circle: x, width: g, p1: r, p2: h, large: g > x.radius, sweep: !0 });
|
|
31
|
+
}
|
|
32
|
+
d != null && (a.push(d), i += lt(d.circle.radius, d.width), h = r);
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
let c = t[0];
|
|
36
|
+
for (let u = 1; u < t.length; ++u)
|
|
37
|
+
t[u].radius < c.radius && (c = t[u]);
|
|
38
|
+
let h = !1;
|
|
39
|
+
for (let u = 0; u < t.length; ++u)
|
|
40
|
+
if (q(t[u], c) > Math.abs(c.radius - t[u].radius)) {
|
|
41
|
+
h = !0;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
h ? i = o = 0 : (i = c.radius * c.radius * Math.PI, a.push({
|
|
45
|
+
circle: c,
|
|
46
|
+
p1: { x: c.x, y: c.y + c.radius },
|
|
47
|
+
p2: { x: c.x - _t, y: c.y + c.radius },
|
|
48
|
+
width: c.radius * 2,
|
|
49
|
+
large: !0,
|
|
50
|
+
sweep: !0
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
return o /= 2, n && (n.area = i + o, n.arcArea = i, n.polygonArea = o, n.arcs = a, n.innerPoints = e, n.intersectionPoints = s), i + o;
|
|
54
|
+
}
|
|
55
|
+
function re(t, n) {
|
|
56
|
+
return n.every((s) => q(t, s) < s.radius + _t);
|
|
57
|
+
}
|
|
58
|
+
function ae(t) {
|
|
59
|
+
const n = [];
|
|
60
|
+
for (let s = 0; s < t.length; ++s)
|
|
61
|
+
for (let e = s + 1; e < t.length; ++e) {
|
|
62
|
+
const i = Tt(t[s], t[e]);
|
|
63
|
+
for (const o of i)
|
|
64
|
+
o.parentIndex = [s, e], n.push(o);
|
|
65
|
+
}
|
|
66
|
+
return n;
|
|
67
|
+
}
|
|
68
|
+
function lt(t, n) {
|
|
69
|
+
return t * t * Math.acos(1 - n / t) - (t - n) * Math.sqrt(n * (2 * t - n));
|
|
70
|
+
}
|
|
71
|
+
function q(t, n) {
|
|
72
|
+
return Math.sqrt((t.x - n.x) * (t.x - n.x) + (t.y - n.y) * (t.y - n.y));
|
|
73
|
+
}
|
|
74
|
+
function xt(t, n, s) {
|
|
75
|
+
if (s >= t + n)
|
|
76
|
+
return 0;
|
|
77
|
+
if (s <= Math.abs(t - n))
|
|
78
|
+
return Math.PI * Math.min(t, n) * Math.min(t, n);
|
|
79
|
+
const e = t - (s * s - n * n + t * t) / (2 * s), i = n - (s * s - t * t + n * n) / (2 * s);
|
|
80
|
+
return lt(t, e) + lt(n, i);
|
|
81
|
+
}
|
|
82
|
+
function Tt(t, n) {
|
|
83
|
+
const s = q(t, n), e = t.radius, i = n.radius;
|
|
84
|
+
if (s >= e + i || s <= Math.abs(e - i))
|
|
85
|
+
return [];
|
|
86
|
+
const o = (e * e - i * i + s * s) / (2 * s), a = Math.sqrt(e * e - o * o), c = t.x + o * (n.x - t.x) / s, h = t.y + o * (n.y - t.y) / s, u = -(n.y - t.y) * (a / s), r = -(n.x - t.x) * (a / s);
|
|
87
|
+
return [
|
|
88
|
+
{ x: c + u, y: h - r },
|
|
89
|
+
{ x: c - u, y: h + r }
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
function Et(t) {
|
|
93
|
+
const n = { x: 0, y: 0 };
|
|
94
|
+
for (const s of t)
|
|
95
|
+
n.x += s.x, n.y += s.y;
|
|
96
|
+
return n.x /= t.length, n.y /= t.length, n;
|
|
97
|
+
}
|
|
98
|
+
function le(t, n, s, e) {
|
|
99
|
+
e = e || {};
|
|
100
|
+
const i = e.maxIterations || 100, o = e.tolerance || 1e-10, a = t(n), c = t(s);
|
|
101
|
+
let h = s - n;
|
|
102
|
+
if (a * c > 0)
|
|
103
|
+
throw "Initial bisect points must have opposite signs";
|
|
104
|
+
if (a === 0) return n;
|
|
105
|
+
if (c === 0) return s;
|
|
106
|
+
for (let u = 0; u < i; ++u) {
|
|
107
|
+
h /= 2;
|
|
108
|
+
const r = n + h, y = t(r);
|
|
109
|
+
if (y * a >= 0 && (n = r), Math.abs(h) < o || y === 0)
|
|
110
|
+
return r;
|
|
111
|
+
}
|
|
112
|
+
return n + h;
|
|
113
|
+
}
|
|
114
|
+
function ct(t) {
|
|
115
|
+
const n = new Array(t);
|
|
116
|
+
for (let s = 0; s < t; ++s)
|
|
117
|
+
n[s] = 0;
|
|
118
|
+
return n;
|
|
119
|
+
}
|
|
120
|
+
function Mt(t, n) {
|
|
121
|
+
return ct(t).map(() => ct(n));
|
|
122
|
+
}
|
|
123
|
+
function $(t, n) {
|
|
124
|
+
let s = 0;
|
|
125
|
+
for (let e = 0; e < t.length; ++e)
|
|
126
|
+
s += t[e] * n[e];
|
|
127
|
+
return s;
|
|
128
|
+
}
|
|
129
|
+
function ut(t) {
|
|
130
|
+
return Math.sqrt($(t, t));
|
|
131
|
+
}
|
|
132
|
+
function ft(t, n, s) {
|
|
133
|
+
for (let e = 0; e < n.length; ++e)
|
|
134
|
+
t[e] = n[e] * s;
|
|
135
|
+
}
|
|
136
|
+
function J(t, n, s, e, i) {
|
|
137
|
+
for (let o = 0; o < t.length; ++o)
|
|
138
|
+
t[o] = n * s[o] + e * i[o];
|
|
139
|
+
}
|
|
140
|
+
function zt(t, n, s) {
|
|
141
|
+
s = s || {};
|
|
142
|
+
const e = s.maxIterations || n.length * 200, i = s.nonZeroDelta || 1.05, o = s.zeroDelta || 1e-3, a = s.minErrorDelta || 1e-6, c = s.minErrorDelta || 1e-5, h = s.rho !== void 0 ? s.rho : 1, u = s.chi !== void 0 ? s.chi : 2, r = s.psi !== void 0 ? s.psi : -0.5, y = s.sigma !== void 0 ? s.sigma : 0.5;
|
|
143
|
+
let d;
|
|
144
|
+
const b = n.length, x = new Array(b + 1);
|
|
145
|
+
x[0] = n, x[0].fx = t(n), x[0].id = 0;
|
|
146
|
+
for (let v = 0; v < b; ++v) {
|
|
147
|
+
const l = n.slice();
|
|
148
|
+
l[v] = l[v] ? l[v] * i : o, x[v + 1] = l, x[v + 1].fx = t(l), x[v + 1].id = v + 1;
|
|
149
|
+
}
|
|
150
|
+
function M(v) {
|
|
151
|
+
for (let l = 0; l < v.length; l++)
|
|
152
|
+
x[b][l] = v[l];
|
|
153
|
+
x[b].fx = v.fx;
|
|
154
|
+
}
|
|
155
|
+
const A = (v, l) => v.fx - l.fx, T = n.slice(), S = n.slice(), g = n.slice(), m = n.slice();
|
|
156
|
+
for (let v = 0; v < e; ++v) {
|
|
157
|
+
if (x.sort(A), s.history) {
|
|
158
|
+
const p = x.map((f) => {
|
|
159
|
+
const N = f.slice();
|
|
160
|
+
return N.fx = f.fx, N.id = f.id, N;
|
|
161
|
+
});
|
|
162
|
+
p.sort((f, N) => f.id - N.id), s.history.push({
|
|
163
|
+
x: x[0].slice(),
|
|
164
|
+
fx: x[0].fx,
|
|
165
|
+
simplex: p
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
d = 0;
|
|
169
|
+
for (let p = 0; p < b; ++p)
|
|
170
|
+
d = Math.max(d, Math.abs(x[0][p] - x[1][p]));
|
|
171
|
+
if (Math.abs(x[0].fx - x[b].fx) < a && d < c)
|
|
172
|
+
break;
|
|
173
|
+
for (let p = 0; p < b; ++p) {
|
|
174
|
+
T[p] = 0;
|
|
175
|
+
for (let f = 0; f < b; ++f)
|
|
176
|
+
T[p] += x[f][p];
|
|
177
|
+
T[p] /= b;
|
|
178
|
+
}
|
|
179
|
+
const l = x[b];
|
|
180
|
+
if (J(S, 1 + h, T, -h, l), S.fx = t(S), S.fx < x[0].fx)
|
|
181
|
+
J(m, 1 + u, T, -u, l), m.fx = t(m), m.fx < S.fx ? M(m) : M(S);
|
|
182
|
+
else if (S.fx >= x[b - 1].fx) {
|
|
183
|
+
let p = !1;
|
|
184
|
+
if (S.fx > l.fx ? (J(g, 1 + r, T, -r, l), g.fx = t(g), g.fx < l.fx ? M(g) : p = !0) : (J(g, 1 - r * h, T, r * h, l), g.fx = t(g), g.fx < S.fx ? M(g) : p = !0), p) {
|
|
185
|
+
if (y >= 1) break;
|
|
186
|
+
for (let f = 1; f < x.length; ++f)
|
|
187
|
+
J(x[f], 1 - y, x[0], y, x[f]), x[f].fx = t(x[f]);
|
|
188
|
+
}
|
|
189
|
+
} else
|
|
190
|
+
M(S);
|
|
191
|
+
}
|
|
192
|
+
return x.sort(A), { fx: x[0].fx, x: x[0] };
|
|
193
|
+
}
|
|
194
|
+
function ce(t, n, s, e, i, o, a) {
|
|
195
|
+
const c = s.fx, h = $(s.fxprime, n);
|
|
196
|
+
let u = c, r = c, y = h, d = 0;
|
|
197
|
+
i = i || 1, o = o || 1e-6, a = a || 0.1;
|
|
198
|
+
function b(x, M, A) {
|
|
199
|
+
for (let T = 0; T < 16; ++T)
|
|
200
|
+
if (i = (x + M) / 2, J(e.x, 1, s.x, i, n), u = e.fx = t(e.x, e.fxprime), y = $(e.fxprime, n), u > c + o * i * h || u >= A)
|
|
201
|
+
M = i;
|
|
202
|
+
else {
|
|
203
|
+
if (Math.abs(y) <= -a * h)
|
|
204
|
+
return i;
|
|
205
|
+
y * (M - x) >= 0 && (M = x), x = i, A = u;
|
|
206
|
+
}
|
|
207
|
+
return 0;
|
|
208
|
+
}
|
|
209
|
+
for (let x = 0; x < 10; ++x) {
|
|
210
|
+
if (J(e.x, 1, s.x, i, n), u = e.fx = t(e.x, e.fxprime), y = $(e.fxprime, n), u > c + o * i * h || x && u >= r)
|
|
211
|
+
return b(d, i, r);
|
|
212
|
+
if (Math.abs(y) <= -a * h)
|
|
213
|
+
return i;
|
|
214
|
+
if (y >= 0)
|
|
215
|
+
return b(i, d, u);
|
|
216
|
+
r = u, d = i, i *= 2;
|
|
217
|
+
}
|
|
218
|
+
return i;
|
|
219
|
+
}
|
|
220
|
+
function ue(t, n, s) {
|
|
221
|
+
let e = { x: n.slice(), fx: 0, fxprime: n.slice() }, i = { x: n.slice(), fx: 0, fxprime: n.slice() };
|
|
222
|
+
const o = n.slice();
|
|
223
|
+
let a, c, h = 1, u;
|
|
224
|
+
s = s || {}, u = s.maxIterations || n.length * 20, e.fx = t(e.x, e.fxprime), a = e.fxprime.slice(), ft(a, e.fxprime, -1);
|
|
225
|
+
for (let r = 0; r < u; ++r) {
|
|
226
|
+
if (h = ce(t, a, e, i, h), s.history && s.history.push({
|
|
227
|
+
x: e.x.slice(),
|
|
228
|
+
fx: e.fx,
|
|
229
|
+
fxprime: e.fxprime.slice(),
|
|
230
|
+
alpha: h
|
|
231
|
+
}), !h)
|
|
232
|
+
ft(a, e.fxprime, -1);
|
|
233
|
+
else {
|
|
234
|
+
J(o, 1, i.fxprime, -1, e.fxprime);
|
|
235
|
+
const y = $(e.fxprime, e.fxprime), d = Math.max(0, $(o, i.fxprime) / y);
|
|
236
|
+
J(a, d, a, -1, i.fxprime), c = e, e = i, i = c;
|
|
237
|
+
}
|
|
238
|
+
if (ut(e.fxprime) <= 1e-5)
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
return s.history && s.history.push({
|
|
242
|
+
x: e.x.slice(),
|
|
243
|
+
fx: e.fx,
|
|
244
|
+
fxprime: e.fxprime.slice(),
|
|
245
|
+
alpha: h
|
|
246
|
+
}), e;
|
|
247
|
+
}
|
|
248
|
+
function At(t, n = {}) {
|
|
249
|
+
n.maxIterations = n.maxIterations || 500;
|
|
250
|
+
const s = n.initialLayout || ge, e = n.lossFunction || tt, i = fe(t, n), o = s(i, n), a = Object.keys(o), c = [];
|
|
251
|
+
for (const r of a)
|
|
252
|
+
c.push(o[r].x), c.push(o[r].y);
|
|
253
|
+
const u = zt(
|
|
254
|
+
(r) => {
|
|
255
|
+
const y = {};
|
|
256
|
+
for (let d = 0; d < a.length; ++d) {
|
|
257
|
+
const b = a[d];
|
|
258
|
+
y[b] = {
|
|
259
|
+
x: r[2 * d],
|
|
260
|
+
y: r[2 * d + 1],
|
|
261
|
+
radius: o[b].radius
|
|
262
|
+
// size : circles[setid].size
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
return e(y, i);
|
|
266
|
+
},
|
|
267
|
+
c,
|
|
268
|
+
n
|
|
269
|
+
).x;
|
|
270
|
+
for (let r = 0; r < a.length; ++r) {
|
|
271
|
+
const y = a[r];
|
|
272
|
+
o[y].x = u[2 * r], o[y].y = u[2 * r + 1];
|
|
273
|
+
}
|
|
274
|
+
return o;
|
|
275
|
+
}
|
|
276
|
+
const Dt = 1e-10;
|
|
277
|
+
function ht(t, n, s) {
|
|
278
|
+
return Math.min(t, n) * Math.min(t, n) * Math.PI <= s + Dt ? Math.abs(t - n) : le((e) => xt(t, n, e) - s, 0, t + n);
|
|
279
|
+
}
|
|
280
|
+
function fe(t, n = {}) {
|
|
281
|
+
const s = n.distinct, e = t.map((c) => Object.assign({}, c));
|
|
282
|
+
function i(c) {
|
|
283
|
+
return c.join(";");
|
|
284
|
+
}
|
|
285
|
+
if (s) {
|
|
286
|
+
const c = /* @__PURE__ */ new Map();
|
|
287
|
+
for (const h of e)
|
|
288
|
+
for (let u = 0; u < h.sets.length; u++) {
|
|
289
|
+
const r = String(h.sets[u]);
|
|
290
|
+
c.set(r, h.size + (c.get(r) || 0));
|
|
291
|
+
for (let y = u + 1; y < h.sets.length; y++) {
|
|
292
|
+
const d = String(h.sets[y]), b = `${r};${d}`, x = `${d};${r}`;
|
|
293
|
+
c.set(b, h.size + (c.get(b) || 0)), c.set(x, h.size + (c.get(x) || 0));
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
for (const h of e)
|
|
297
|
+
h.sets.length < 3 && (h.size = c.get(i(h.sets)));
|
|
298
|
+
}
|
|
299
|
+
const o = [], a = /* @__PURE__ */ new Set();
|
|
300
|
+
for (const c of e)
|
|
301
|
+
if (c.sets.length === 1)
|
|
302
|
+
o.push(c.sets[0]);
|
|
303
|
+
else if (c.sets.length === 2) {
|
|
304
|
+
const h = c.sets[0], u = c.sets[1];
|
|
305
|
+
a.add(i(c.sets)), a.add(i([u, h]));
|
|
306
|
+
}
|
|
307
|
+
o.sort((c, h) => c === h ? 0 : c < h ? -1 : 1);
|
|
308
|
+
for (let c = 0; c < o.length; ++c) {
|
|
309
|
+
const h = o[c];
|
|
310
|
+
for (let u = c + 1; u < o.length; ++u) {
|
|
311
|
+
const r = o[u];
|
|
312
|
+
a.has(i([h, r])) || e.push({ sets: [h, r], size: 0 });
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return e;
|
|
316
|
+
}
|
|
317
|
+
function he(t, n, s) {
|
|
318
|
+
const e = Mt(n.length, n.length), i = Mt(n.length, n.length);
|
|
319
|
+
return t.filter((o) => o.sets.length === 2).forEach((o) => {
|
|
320
|
+
const a = s[o.sets[0]], c = s[o.sets[1]], h = Math.sqrt(n[a].size / Math.PI), u = Math.sqrt(n[c].size / Math.PI), r = ht(h, u, o.size);
|
|
321
|
+
e[a][c] = e[c][a] = r;
|
|
322
|
+
let y = 0;
|
|
323
|
+
o.size + 1e-10 >= Math.min(n[a].size, n[c].size) ? y = 1 : o.size <= 1e-10 && (y = -1), i[a][c] = i[c][a] = y;
|
|
324
|
+
}), { distances: e, constraints: i };
|
|
325
|
+
}
|
|
326
|
+
function de(t, n, s, e) {
|
|
327
|
+
for (let o = 0; o < n.length; ++o)
|
|
328
|
+
n[o] = 0;
|
|
329
|
+
let i = 0;
|
|
330
|
+
for (let o = 0; o < s.length; ++o) {
|
|
331
|
+
const a = t[2 * o], c = t[2 * o + 1];
|
|
332
|
+
for (let h = o + 1; h < s.length; ++h) {
|
|
333
|
+
const u = t[2 * h], r = t[2 * h + 1], y = s[o][h], d = e[o][h], b = (u - a) * (u - a) + (r - c) * (r - c), x = Math.sqrt(b), M = b - y * y;
|
|
334
|
+
d > 0 && x <= y || d < 0 && x >= y || (i += 2 * M * M, n[2 * o] += 4 * M * (a - u), n[2 * o + 1] += 4 * M * (c - r), n[2 * h] += 4 * M * (u - a), n[2 * h + 1] += 4 * M * (r - c));
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return i;
|
|
338
|
+
}
|
|
339
|
+
function ge(t, n = {}) {
|
|
340
|
+
let s = ye(t, n);
|
|
341
|
+
const e = n.lossFunction || tt;
|
|
342
|
+
if (t.length >= 8) {
|
|
343
|
+
const i = xe(t, n), o = e(i, t), a = e(s, t);
|
|
344
|
+
o + 1e-8 < a && (s = i);
|
|
345
|
+
}
|
|
346
|
+
return s;
|
|
347
|
+
}
|
|
348
|
+
function xe(t, n = {}) {
|
|
349
|
+
const s = n.restarts || 10, e = [], i = {};
|
|
350
|
+
for (const d of t)
|
|
351
|
+
d.sets.length === 1 && (i[d.sets[0]] = e.length, e.push(d));
|
|
352
|
+
let { distances: o, constraints: a } = he(t, e, i);
|
|
353
|
+
const c = ut(o.map(ut)) / o.length;
|
|
354
|
+
o = o.map((d) => d.map((b) => b / c));
|
|
355
|
+
const h = (d, b) => de(d, b, o, a);
|
|
356
|
+
let u = null;
|
|
357
|
+
for (let d = 0; d < s; ++d) {
|
|
358
|
+
const b = ct(o.length * 2).map(Math.random), x = ue(h, b, n);
|
|
359
|
+
(!u || x.fx < u.fx) && (u = x);
|
|
360
|
+
}
|
|
361
|
+
const r = u.x, y = {};
|
|
362
|
+
for (let d = 0; d < e.length; ++d) {
|
|
363
|
+
const b = e[d];
|
|
364
|
+
y[b.sets[0]] = {
|
|
365
|
+
x: r[2 * d] * c,
|
|
366
|
+
y: r[2 * d + 1] * c,
|
|
367
|
+
radius: Math.sqrt(b.size / Math.PI)
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
if (n.history)
|
|
371
|
+
for (const d of n.history)
|
|
372
|
+
ft(d.x, c);
|
|
373
|
+
return y;
|
|
374
|
+
}
|
|
375
|
+
function ye(t, n) {
|
|
376
|
+
const s = n && n.lossFunction ? n.lossFunction : tt, e = {}, i = {};
|
|
377
|
+
for (const y of t)
|
|
378
|
+
if (y.sets.length === 1) {
|
|
379
|
+
const d = y.sets[0];
|
|
380
|
+
e[d] = {
|
|
381
|
+
x: 1e10,
|
|
382
|
+
y: 1e10,
|
|
383
|
+
rowid: e.length,
|
|
384
|
+
size: y.size,
|
|
385
|
+
radius: Math.sqrt(y.size / Math.PI)
|
|
386
|
+
}, i[d] = [];
|
|
387
|
+
}
|
|
388
|
+
t = t.filter((y) => y.sets.length === 2);
|
|
389
|
+
for (const y of t) {
|
|
390
|
+
let d = y.weight != null ? y.weight : 1;
|
|
391
|
+
const b = y.sets[0], x = y.sets[1];
|
|
392
|
+
y.size + Dt >= Math.min(e[b].size, e[x].size) && (d = 0), i[b].push({ set: x, size: y.size, weight: d }), i[x].push({ set: b, size: y.size, weight: d });
|
|
393
|
+
}
|
|
394
|
+
const o = [];
|
|
395
|
+
Object.keys(i).forEach((y) => {
|
|
396
|
+
let d = 0;
|
|
397
|
+
for (let b = 0; b < i[y].length; ++b)
|
|
398
|
+
d += i[y][b].size * i[y][b].weight;
|
|
399
|
+
o.push({ set: y, size: d });
|
|
400
|
+
});
|
|
401
|
+
function a(y, d) {
|
|
402
|
+
return d.size - y.size;
|
|
403
|
+
}
|
|
404
|
+
o.sort(a);
|
|
405
|
+
const c = {};
|
|
406
|
+
function h(y) {
|
|
407
|
+
return y.set in c;
|
|
408
|
+
}
|
|
409
|
+
function u(y, d) {
|
|
410
|
+
e[d].x = y.x, e[d].y = y.y, c[d] = !0;
|
|
411
|
+
}
|
|
412
|
+
u({ x: 0, y: 0 }, o[0].set);
|
|
413
|
+
for (let y = 1; y < o.length; ++y) {
|
|
414
|
+
const d = o[y].set, b = i[d].filter(h), x = e[d];
|
|
415
|
+
if (b.sort(a), b.length === 0)
|
|
416
|
+
throw "ERROR: missing pairwise overlap information";
|
|
417
|
+
const M = [];
|
|
418
|
+
for (var r = 0; r < b.length; ++r) {
|
|
419
|
+
const S = e[b[r].set], g = ht(x.radius, S.radius, b[r].size);
|
|
420
|
+
M.push({ x: S.x + g, y: S.y }), M.push({ x: S.x - g, y: S.y }), M.push({ y: S.y + g, x: S.x }), M.push({ y: S.y - g, x: S.x });
|
|
421
|
+
for (let m = r + 1; m < b.length; ++m) {
|
|
422
|
+
const v = e[b[m].set], l = ht(x.radius, v.radius, b[m].size), p = Tt(
|
|
423
|
+
{ x: S.x, y: S.y, radius: g },
|
|
424
|
+
{ x: v.x, y: v.y, radius: l }
|
|
425
|
+
);
|
|
426
|
+
M.push(...p);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
let A = 1e50, T = M[0];
|
|
430
|
+
for (const S of M) {
|
|
431
|
+
e[d].x = S.x, e[d].y = S.y;
|
|
432
|
+
const g = s(e, t);
|
|
433
|
+
g < A && (A = g, T = S);
|
|
434
|
+
}
|
|
435
|
+
u(T, d);
|
|
436
|
+
}
|
|
437
|
+
return e;
|
|
438
|
+
}
|
|
439
|
+
function tt(t, n) {
|
|
440
|
+
let s = 0;
|
|
441
|
+
for (const e of n) {
|
|
442
|
+
if (e.sets.length === 1)
|
|
443
|
+
continue;
|
|
444
|
+
let i;
|
|
445
|
+
if (e.sets.length === 2) {
|
|
446
|
+
const a = t[e.sets[0]], c = t[e.sets[1]];
|
|
447
|
+
i = xt(a.radius, c.radius, q(a, c));
|
|
448
|
+
} else
|
|
449
|
+
i = st(e.sets.map((a) => t[a]));
|
|
450
|
+
const o = e.weight != null ? e.weight : 1;
|
|
451
|
+
s += o * (i - e.size) * (i - e.size);
|
|
452
|
+
}
|
|
453
|
+
return s;
|
|
454
|
+
}
|
|
455
|
+
function Rt(t, n) {
|
|
456
|
+
let s = 0;
|
|
457
|
+
for (const e of n) {
|
|
458
|
+
if (e.sets.length === 1)
|
|
459
|
+
continue;
|
|
460
|
+
let i;
|
|
461
|
+
if (e.sets.length === 2) {
|
|
462
|
+
const c = t[e.sets[0]], h = t[e.sets[1]];
|
|
463
|
+
i = xt(c.radius, h.radius, q(c, h));
|
|
464
|
+
} else
|
|
465
|
+
i = st(e.sets.map((c) => t[c]));
|
|
466
|
+
const o = e.weight != null ? e.weight : 1, a = Math.log((i + 1) / (e.size + 1));
|
|
467
|
+
s += o * a * a;
|
|
468
|
+
}
|
|
469
|
+
return s;
|
|
470
|
+
}
|
|
471
|
+
function pe(t, n, s) {
|
|
472
|
+
if (s == null ? t.sort((i, o) => o.radius - i.radius) : t.sort(s), t.length > 0) {
|
|
473
|
+
const i = t[0].x, o = t[0].y;
|
|
474
|
+
for (const a of t)
|
|
475
|
+
a.x -= i, a.y -= o;
|
|
476
|
+
}
|
|
477
|
+
if (t.length === 2 && q(t[0], t[1]) < Math.abs(t[1].radius - t[0].radius) && (t[1].x = t[0].x + t[0].radius - t[1].radius - 1e-10, t[1].y = t[0].y), t.length > 1) {
|
|
478
|
+
const i = Math.atan2(t[1].x, t[1].y) - n, o = Math.cos(i), a = Math.sin(i);
|
|
479
|
+
for (const c of t) {
|
|
480
|
+
const h = c.x, u = c.y;
|
|
481
|
+
c.x = o * h - a * u, c.y = a * h + o * u;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
if (t.length > 2) {
|
|
485
|
+
let i = Math.atan2(t[2].x, t[2].y) - n;
|
|
486
|
+
for (; i < 0; )
|
|
487
|
+
i += 2 * Math.PI;
|
|
488
|
+
for (; i > 2 * Math.PI; )
|
|
489
|
+
i -= 2 * Math.PI;
|
|
490
|
+
if (i > Math.PI) {
|
|
491
|
+
const o = t[1].y / (1e-10 + t[1].x);
|
|
492
|
+
for (const a of t) {
|
|
493
|
+
var e = (a.x + o * a.y) / (1 + o * o);
|
|
494
|
+
a.x = 2 * e - a.x, a.y = 2 * e * o - a.y;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
function me(t) {
|
|
500
|
+
t.forEach((i) => {
|
|
501
|
+
i.parent = i;
|
|
502
|
+
});
|
|
503
|
+
function n(i) {
|
|
504
|
+
return i.parent !== i && (i.parent = n(i.parent)), i.parent;
|
|
505
|
+
}
|
|
506
|
+
function s(i, o) {
|
|
507
|
+
const a = n(i), c = n(o);
|
|
508
|
+
a.parent = c;
|
|
509
|
+
}
|
|
510
|
+
for (let i = 0; i < t.length; ++i)
|
|
511
|
+
for (let o = i + 1; o < t.length; ++o) {
|
|
512
|
+
const a = t[i].radius + t[o].radius;
|
|
513
|
+
q(t[i], t[o]) + 1e-10 < a && s(t[o], t[i]);
|
|
514
|
+
}
|
|
515
|
+
const e = /* @__PURE__ */ new Map();
|
|
516
|
+
for (let i = 0; i < t.length; ++i) {
|
|
517
|
+
const o = n(t[i]).parent.setid;
|
|
518
|
+
e.has(o) || e.set(o, []), e.get(o).push(t[i]);
|
|
519
|
+
}
|
|
520
|
+
return t.forEach((i) => {
|
|
521
|
+
delete i.parent;
|
|
522
|
+
}), Array.from(e.values());
|
|
523
|
+
}
|
|
524
|
+
function dt(t) {
|
|
525
|
+
const n = (s) => {
|
|
526
|
+
const e = t.reduce((o, a) => Math.max(o, a[s] + a.radius), Number.NEGATIVE_INFINITY), i = t.reduce((o, a) => Math.min(o, a[s] - a.radius), Number.POSITIVE_INFINITY);
|
|
527
|
+
return { max: e, min: i };
|
|
528
|
+
};
|
|
529
|
+
return { xRange: n("x"), yRange: n("y") };
|
|
530
|
+
}
|
|
531
|
+
function Ct(t, n, s) {
|
|
532
|
+
n == null && (n = Math.PI / 2);
|
|
533
|
+
let e = Ft(t).map((u) => Object.assign({}, u));
|
|
534
|
+
const i = me(e);
|
|
535
|
+
for (const u of i) {
|
|
536
|
+
pe(u, n, s);
|
|
537
|
+
const r = dt(u);
|
|
538
|
+
u.size = (r.xRange.max - r.xRange.min) * (r.yRange.max - r.yRange.min), u.bounds = r;
|
|
539
|
+
}
|
|
540
|
+
i.sort((u, r) => r.size - u.size), e = i[0];
|
|
541
|
+
let o = e.bounds;
|
|
542
|
+
const a = (o.xRange.max - o.xRange.min) / 50;
|
|
543
|
+
function c(u, r, y) {
|
|
544
|
+
if (!u)
|
|
545
|
+
return;
|
|
546
|
+
const d = u.bounds;
|
|
547
|
+
let b, x;
|
|
548
|
+
if (r)
|
|
549
|
+
b = o.xRange.max - d.xRange.min + a;
|
|
550
|
+
else {
|
|
551
|
+
b = o.xRange.max - d.xRange.max;
|
|
552
|
+
const M = (d.xRange.max - d.xRange.min) / 2 - (o.xRange.max - o.xRange.min) / 2;
|
|
553
|
+
M < 0 && (b += M);
|
|
554
|
+
}
|
|
555
|
+
if (y)
|
|
556
|
+
x = o.yRange.max - d.yRange.min + a;
|
|
557
|
+
else {
|
|
558
|
+
x = o.yRange.max - d.yRange.max;
|
|
559
|
+
const M = (d.yRange.max - d.yRange.min) / 2 - (o.yRange.max - o.yRange.min) / 2;
|
|
560
|
+
M < 0 && (x += M);
|
|
561
|
+
}
|
|
562
|
+
for (const M of u)
|
|
563
|
+
M.x += b, M.y += x, e.push(M);
|
|
564
|
+
}
|
|
565
|
+
let h = 1;
|
|
566
|
+
for (; h < i.length; )
|
|
567
|
+
c(i[h], !0, !1), c(i[h + 1], !1, !0), c(i[h + 2], !0, !0), h += 3, o = dt(e);
|
|
568
|
+
return Ot(e);
|
|
569
|
+
}
|
|
570
|
+
function Nt(t, n, s, e, i) {
|
|
571
|
+
const o = Ft(t);
|
|
572
|
+
n -= 2 * e, s -= 2 * e;
|
|
573
|
+
const { xRange: a, yRange: c } = dt(o);
|
|
574
|
+
if (a.max === a.min || c.max === c.min)
|
|
575
|
+
return console.log("not scaling solution: zero size detected"), t;
|
|
576
|
+
let h, u;
|
|
577
|
+
if (i) {
|
|
578
|
+
const b = Math.sqrt(i / Math.PI) * 2;
|
|
579
|
+
h = n / b, u = s / b;
|
|
580
|
+
} else
|
|
581
|
+
h = n / (a.max - a.min), u = s / (c.max - c.min);
|
|
582
|
+
const r = Math.min(u, h), y = (n - (a.max - a.min) * r) / 2, d = (s - (c.max - c.min) * r) / 2;
|
|
583
|
+
return Ot(
|
|
584
|
+
o.map((b) => ({
|
|
585
|
+
radius: r * b.radius,
|
|
586
|
+
x: e + y + (b.x - a.min) * r,
|
|
587
|
+
y: e + d + (b.y - c.min) * r,
|
|
588
|
+
setid: b.setid
|
|
589
|
+
}))
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
function Ot(t) {
|
|
593
|
+
const n = {};
|
|
594
|
+
for (const s of t)
|
|
595
|
+
n[s.setid] = s;
|
|
596
|
+
return n;
|
|
597
|
+
}
|
|
598
|
+
function Ft(t) {
|
|
599
|
+
return Object.keys(t).map((s) => Object.assign(t[s], { setid: s }));
|
|
600
|
+
}
|
|
601
|
+
function be(t = {}) {
|
|
602
|
+
let n = !1, s = 600, e = 350, i = 15, o = 1e3, a = Math.PI / 2, c = !0, h = null, u = !0, r = !0, y = null, d = null, b = !1, x = null, M = t && t.symmetricalTextCentre ? t.symmetricalTextCentre : !1, A = {}, T = t && t.colourScheme ? t.colourScheme : t && t.colorScheme ? t.colorScheme : [
|
|
603
|
+
"#1f77b4",
|
|
604
|
+
"#ff7f0e",
|
|
605
|
+
"#2ca02c",
|
|
606
|
+
"#d62728",
|
|
607
|
+
"#9467bd",
|
|
608
|
+
"#8c564b",
|
|
609
|
+
"#e377c2",
|
|
610
|
+
"#7f7f7f",
|
|
611
|
+
"#bcbd22",
|
|
612
|
+
"#17becf"
|
|
613
|
+
], S = 0, g = function(p) {
|
|
614
|
+
if (p in A)
|
|
615
|
+
return A[p];
|
|
616
|
+
var f = A[p] = T[S];
|
|
617
|
+
return S += 1, S >= T.length && (S = 0), f;
|
|
618
|
+
}, m = At, v = tt;
|
|
619
|
+
function l(p) {
|
|
620
|
+
let f = p.datum();
|
|
621
|
+
const N = /* @__PURE__ */ new Set();
|
|
622
|
+
f.forEach((k) => {
|
|
623
|
+
k.size == 0 && k.sets.length == 1 && N.add(k.sets[0]);
|
|
624
|
+
}), f = f.filter((k) => !k.sets.some((F) => N.has(F)));
|
|
625
|
+
let I = {}, R = {};
|
|
626
|
+
if (f.length > 0) {
|
|
627
|
+
let k = m(f, { lossFunction: v, distinct: b });
|
|
628
|
+
c && (k = Ct(k, a, d)), I = Nt(k, s, e, i, h), R = jt(I, f, M);
|
|
629
|
+
}
|
|
630
|
+
const U = {};
|
|
631
|
+
f.forEach((k) => {
|
|
632
|
+
k.label && (U[k.sets] = k.label);
|
|
633
|
+
});
|
|
634
|
+
function j(k) {
|
|
635
|
+
if (k.sets in U)
|
|
636
|
+
return U[k.sets];
|
|
637
|
+
if (k.sets.length == 1)
|
|
638
|
+
return "" + k.sets[0];
|
|
639
|
+
}
|
|
640
|
+
p.selectAll("svg").data([I]).enter().append("svg");
|
|
641
|
+
const E = p.select("svg");
|
|
642
|
+
n ? E.attr("viewBox", `0 0 ${s} ${e}`) : E.attr("width", s).attr("height", e);
|
|
643
|
+
const D = {};
|
|
644
|
+
let _ = !1;
|
|
645
|
+
E.selectAll(".venn-area path").each(function(k) {
|
|
646
|
+
const F = this.getAttribute("d");
|
|
647
|
+
k.sets.length == 1 && F && !b && (_ = !0, D[k.sets[0]] = ke(F));
|
|
648
|
+
});
|
|
649
|
+
function P(k) {
|
|
650
|
+
return (F) => {
|
|
651
|
+
const H = k.sets.map((et) => {
|
|
652
|
+
let X = D[et], Z = I[et];
|
|
653
|
+
return X || (X = { x: s / 2, y: e / 2, radius: 1 }), Z || (Z = { x: s / 2, y: e / 2, radius: 1 }), {
|
|
654
|
+
x: X.x * (1 - F) + Z.x * F,
|
|
655
|
+
y: X.y * (1 - F) + Z.y * F,
|
|
656
|
+
radius: X.radius * (1 - F) + Z.radius * F
|
|
657
|
+
};
|
|
658
|
+
});
|
|
659
|
+
return St(H, x);
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
const V = E.selectAll(".venn-area").data(f, (k) => k.sets), O = V.enter().append("g").attr(
|
|
663
|
+
"class",
|
|
664
|
+
(k) => `venn-area venn-${k.sets.length == 1 ? "circle" : "intersection"}${k.colour || k.color ? " venn-coloured" : ""}`
|
|
665
|
+
).attr("data-venn-sets", (k) => k.sets.join("_")), B = O.append("path"), W = O.append("text").attr("class", "label").text((k) => j(k)).attr("text-anchor", "middle").attr("dy", ".35em").attr("x", s / 2).attr("y", e / 2);
|
|
666
|
+
r && (B.style("fill-opacity", "0").filter((k) => k.sets.length == 1).style("fill", (k) => k.colour ? k.colour : k.color ? k.color : g(k.sets)).style("fill-opacity", ".25"), W.style("fill", (k) => k.colour || k.color ? "#FFF" : t.textFill ? t.textFill : k.sets.length == 1 ? g(k.sets) : "#444"));
|
|
667
|
+
function K(k) {
|
|
668
|
+
return typeof k.transition == "function" ? k.transition("venn").duration(o) : k;
|
|
669
|
+
}
|
|
670
|
+
let z = p;
|
|
671
|
+
_ && typeof z.transition == "function" ? (z = K(p), z.selectAll("path").attrTween("d", P)) : z.selectAll("path").attr("d", (k) => St(k.sets.map((F) => I[F])), x);
|
|
672
|
+
const L = z.selectAll("text").filter((k) => k.sets in R).text((k) => j(k)).attr("x", (k) => Math.floor(R[k.sets].x)).attr("y", (k) => Math.floor(R[k.sets].y));
|
|
673
|
+
u && (_ ? "on" in L ? L.on("end", rt(I, j)) : L.each("end", rt(I, j)) : L.each(rt(I, j)));
|
|
674
|
+
const C = K(V.exit()).remove();
|
|
675
|
+
typeof V.transition == "function" && C.selectAll("path").attrTween("d", P);
|
|
676
|
+
const Y = C.selectAll("text").attr("x", s / 2).attr("y", e / 2);
|
|
677
|
+
return y !== null && (W.style("font-size", "0px"), L.style("font-size", y), Y.style("font-size", "0px")), { circles: I, textCentres: R, nodes: V, enter: O, update: z, exit: C };
|
|
678
|
+
}
|
|
679
|
+
return l.wrap = function(p) {
|
|
680
|
+
return arguments.length ? (u = p, l) : u;
|
|
681
|
+
}, l.useViewBox = function() {
|
|
682
|
+
return n = !0, l;
|
|
683
|
+
}, l.width = function(p) {
|
|
684
|
+
return arguments.length ? (s = p, l) : s;
|
|
685
|
+
}, l.height = function(p) {
|
|
686
|
+
return arguments.length ? (e = p, l) : e;
|
|
687
|
+
}, l.padding = function(p) {
|
|
688
|
+
return arguments.length ? (i = p, l) : i;
|
|
689
|
+
}, l.distinct = function(p) {
|
|
690
|
+
return arguments.length ? (b = p, l) : b;
|
|
691
|
+
}, l.colours = function(p) {
|
|
692
|
+
return arguments.length ? (g = p, l) : g;
|
|
693
|
+
}, l.colors = function(p) {
|
|
694
|
+
return arguments.length ? (g = p, l) : g;
|
|
695
|
+
}, l.fontSize = function(p) {
|
|
696
|
+
return arguments.length ? (y = p, l) : y;
|
|
697
|
+
}, l.round = function(p) {
|
|
698
|
+
return arguments.length ? (x = p, l) : x;
|
|
699
|
+
}, l.duration = function(p) {
|
|
700
|
+
return arguments.length ? (o = p, l) : o;
|
|
701
|
+
}, l.layoutFunction = function(p) {
|
|
702
|
+
return arguments.length ? (m = p, l) : m;
|
|
703
|
+
}, l.normalize = function(p) {
|
|
704
|
+
return arguments.length ? (c = p, l) : c;
|
|
705
|
+
}, l.scaleToFit = function(p) {
|
|
706
|
+
return arguments.length ? (h = p, l) : h;
|
|
707
|
+
}, l.styled = function(p) {
|
|
708
|
+
return arguments.length ? (r = p, l) : r;
|
|
709
|
+
}, l.orientation = function(p) {
|
|
710
|
+
return arguments.length ? (a = p, l) : a;
|
|
711
|
+
}, l.orientationOrder = function(p) {
|
|
712
|
+
return arguments.length ? (d = p, l) : d;
|
|
713
|
+
}, l.lossFunction = function(p) {
|
|
714
|
+
return arguments.length ? (v = p === "default" ? tt : p === "logRatio" ? Rt : p, l) : v;
|
|
715
|
+
}, l;
|
|
716
|
+
}
|
|
717
|
+
function rt(t, n) {
|
|
718
|
+
return function(s) {
|
|
719
|
+
const e = this, i = t[s.sets[0]].radius || 50, o = n(s) || "", a = o.split(/\s+/).reverse(), h = (o.length + a.length) / 3;
|
|
720
|
+
let u = a.pop(), r = [u], y = 0;
|
|
721
|
+
const d = 1.1;
|
|
722
|
+
e.textContent = null;
|
|
723
|
+
const b = [];
|
|
724
|
+
function x(g) {
|
|
725
|
+
const m = e.ownerDocument.createElementNS(e.namespaceURI, "tspan");
|
|
726
|
+
return m.textContent = g, b.push(m), e.append(m), m;
|
|
727
|
+
}
|
|
728
|
+
let M = x(u);
|
|
729
|
+
for (; u = a.pop(), !!u; ) {
|
|
730
|
+
r.push(u);
|
|
731
|
+
const g = r.join(" ");
|
|
732
|
+
M.textContent = g, g.length > h && M.getComputedTextLength() > i && (r.pop(), M.textContent = r.join(" "), r = [u], M = x(u), y++);
|
|
733
|
+
}
|
|
734
|
+
const A = 0.35 - y * d / 2, T = e.getAttribute("x"), S = e.getAttribute("y");
|
|
735
|
+
b.forEach((g, m) => {
|
|
736
|
+
g.setAttribute("x", T), g.setAttribute("y", S), g.setAttribute("dy", `${A + m * d}em`);
|
|
737
|
+
});
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
function at(t, n, s) {
|
|
741
|
+
let e = n[0].radius - q(n[0], t);
|
|
742
|
+
for (let i = 1; i < n.length; ++i) {
|
|
743
|
+
const o = n[i].radius - q(n[i], t);
|
|
744
|
+
o <= e && (e = o);
|
|
745
|
+
}
|
|
746
|
+
for (let i = 0; i < s.length; ++i) {
|
|
747
|
+
const o = q(s[i], t) - s[i].radius;
|
|
748
|
+
o <= e && (e = o);
|
|
749
|
+
}
|
|
750
|
+
return e;
|
|
751
|
+
}
|
|
752
|
+
function Lt(t, n, s) {
|
|
753
|
+
const e = [];
|
|
754
|
+
for (const r of t)
|
|
755
|
+
e.push({ x: r.x, y: r.y }), e.push({ x: r.x + r.radius / 2, y: r.y }), e.push({ x: r.x - r.radius / 2, y: r.y }), e.push({ x: r.x, y: r.y + r.radius / 2 }), e.push({ x: r.x, y: r.y - r.radius / 2 });
|
|
756
|
+
let i = e[0], o = at(e[0], t, n);
|
|
757
|
+
for (let r = 1; r < e.length; ++r) {
|
|
758
|
+
const y = at(e[r], t, n);
|
|
759
|
+
y >= o && (i = e[r], o = y);
|
|
760
|
+
}
|
|
761
|
+
const a = zt(
|
|
762
|
+
(r) => -1 * at({ x: r[0], y: r[1] }, t, n),
|
|
763
|
+
[i.x, i.y],
|
|
764
|
+
{ maxIterations: 500, minErrorDelta: 1e-10 }
|
|
765
|
+
).x, c = { x: s ? 0 : a[0], y: a[1] };
|
|
766
|
+
let h = !0;
|
|
767
|
+
for (const r of t)
|
|
768
|
+
if (q(c, r) > r.radius) {
|
|
769
|
+
h = !1;
|
|
770
|
+
break;
|
|
771
|
+
}
|
|
772
|
+
for (const r of n)
|
|
773
|
+
if (q(c, r) < r.radius) {
|
|
774
|
+
h = !1;
|
|
775
|
+
break;
|
|
776
|
+
}
|
|
777
|
+
if (h)
|
|
778
|
+
return c;
|
|
779
|
+
if (t.length == 1)
|
|
780
|
+
return { x: t[0].x, y: t[0].y };
|
|
781
|
+
const u = {};
|
|
782
|
+
return st(t, u), u.arcs.length === 0 ? { x: 0, y: -1e3, disjoint: !0 } : u.arcs.length == 1 ? { x: u.arcs[0].circle.x, y: u.arcs[0].circle.y } : n.length ? Lt(t, []) : Et(u.arcs.map((r) => r.p1));
|
|
783
|
+
}
|
|
784
|
+
function ve(t) {
|
|
785
|
+
const n = {}, s = Object.keys(t);
|
|
786
|
+
for (const e of s)
|
|
787
|
+
n[e] = [];
|
|
788
|
+
for (let e = 0; e < s.length; e++) {
|
|
789
|
+
const i = s[e], o = t[i];
|
|
790
|
+
for (let a = e + 1; a < s.length; ++a) {
|
|
791
|
+
const c = s[a], h = t[c], u = q(o, h);
|
|
792
|
+
u + h.radius <= o.radius + 1e-10 ? n[c].push(i) : u + o.radius <= h.radius + 1e-10 && n[i].push(c);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
return n;
|
|
796
|
+
}
|
|
797
|
+
function jt(t, n, s) {
|
|
798
|
+
const e = {}, i = ve(t);
|
|
799
|
+
for (let o = 0; o < n.length; ++o) {
|
|
800
|
+
const a = n[o].sets, c = {}, h = {};
|
|
801
|
+
for (let d = 0; d < a.length; ++d) {
|
|
802
|
+
c[a[d]] = !0;
|
|
803
|
+
const b = i[a[d]];
|
|
804
|
+
for (let x = 0; x < b.length; ++x)
|
|
805
|
+
h[b[x]] = !0;
|
|
806
|
+
}
|
|
807
|
+
const u = [], r = [];
|
|
808
|
+
for (let d in t)
|
|
809
|
+
d in c ? u.push(t[d]) : d in h || r.push(t[d]);
|
|
810
|
+
const y = Lt(u, r, s);
|
|
811
|
+
e[a] = y, y.disjoint && n[o].size > 0 && console.log("WARNING: area " + a + " not represented on screen");
|
|
812
|
+
}
|
|
813
|
+
return e;
|
|
814
|
+
}
|
|
815
|
+
function Ie(t, n, s) {
|
|
816
|
+
const e = [];
|
|
817
|
+
return e.push(`
|
|
818
|
+
M`, t, n), e.push(`
|
|
819
|
+
m`, -s, 0), e.push(`
|
|
820
|
+
a`, s, s, 0, 1, 0, s * 2, 0), e.push(`
|
|
821
|
+
a`, s, s, 0, 1, 0, -s * 2, 0), e.join(" ");
|
|
822
|
+
}
|
|
823
|
+
function ke(t) {
|
|
824
|
+
const n = t.split(" ");
|
|
825
|
+
return { x: Number.parseFloat(n[1]), y: Number.parseFloat(n[2]), radius: -Number.parseFloat(n[4]) };
|
|
826
|
+
}
|
|
827
|
+
function Pt(t) {
|
|
828
|
+
if (t.length === 0)
|
|
829
|
+
return [];
|
|
830
|
+
const n = {};
|
|
831
|
+
return st(t, n), n.arcs;
|
|
832
|
+
}
|
|
833
|
+
function Vt(t, n) {
|
|
834
|
+
if (t.length === 0)
|
|
835
|
+
return "M 0 0";
|
|
836
|
+
const s = Math.pow(10, n || 0), e = n != null ? (o) => Math.round(o * s) / s : (o) => o;
|
|
837
|
+
if (t.length == 1) {
|
|
838
|
+
const o = t[0].circle;
|
|
839
|
+
return Ie(e(o.x), e(o.y), e(o.radius));
|
|
840
|
+
}
|
|
841
|
+
const i = [`
|
|
842
|
+
M`, e(t[0].p2.x), e(t[0].p2.y)];
|
|
843
|
+
for (const o of t) {
|
|
844
|
+
const a = e(o.circle.radius);
|
|
845
|
+
i.push(`
|
|
846
|
+
A`, a, a, 0, o.large ? 1 : 0, o.sweep ? 1 : 0, e(o.p1.x), e(o.p1.y));
|
|
847
|
+
}
|
|
848
|
+
return i.join(" ");
|
|
849
|
+
}
|
|
850
|
+
function St(t, n) {
|
|
851
|
+
return Vt(Pt(t), n);
|
|
852
|
+
}
|
|
853
|
+
function Me(t, n = {}) {
|
|
854
|
+
const {
|
|
855
|
+
lossFunction: s,
|
|
856
|
+
layoutFunction: e = At,
|
|
857
|
+
normalize: i = !0,
|
|
858
|
+
orientation: o = Math.PI / 2,
|
|
859
|
+
orientationOrder: a,
|
|
860
|
+
width: c = 600,
|
|
861
|
+
height: h = 350,
|
|
862
|
+
padding: u = 15,
|
|
863
|
+
scaleToFit: r = !1,
|
|
864
|
+
symmetricalTextCentre: y = !1,
|
|
865
|
+
distinct: d,
|
|
866
|
+
round: b = 2
|
|
867
|
+
} = n;
|
|
868
|
+
let x = e(t, {
|
|
869
|
+
lossFunction: s === "default" || !s ? tt : s === "logRatio" ? Rt : s,
|
|
870
|
+
distinct: d
|
|
871
|
+
});
|
|
872
|
+
i && (x = Ct(x, o, a));
|
|
873
|
+
const M = Nt(x, c, h, u, r), A = jt(M, t, y), T = new Map(
|
|
874
|
+
Object.keys(M).map((m) => [
|
|
875
|
+
m,
|
|
876
|
+
{
|
|
877
|
+
set: m,
|
|
878
|
+
x: M[m].x,
|
|
879
|
+
y: M[m].y,
|
|
880
|
+
radius: M[m].radius
|
|
881
|
+
}
|
|
882
|
+
])
|
|
883
|
+
), S = t.map((m) => {
|
|
884
|
+
const v = m.sets.map((f) => T.get(f)), l = Pt(v), p = Vt(l, b);
|
|
885
|
+
return { circles: v, arcs: l, path: p, area: m, has: new Set(m.sets) };
|
|
886
|
+
});
|
|
887
|
+
function g(m) {
|
|
888
|
+
let v = "";
|
|
889
|
+
for (const l of S)
|
|
890
|
+
l.has.size > m.length && m.every((p) => l.has.has(p)) && (v += " " + l.path);
|
|
891
|
+
return v;
|
|
892
|
+
}
|
|
893
|
+
return S.map(({ circles: m, arcs: v, path: l, area: p }) => ({
|
|
894
|
+
data: p,
|
|
895
|
+
text: A[p.sets],
|
|
896
|
+
circles: m,
|
|
897
|
+
arcs: v,
|
|
898
|
+
path: l,
|
|
899
|
+
distinctPath: l + g(p.sets)
|
|
900
|
+
}));
|
|
901
|
+
}
|
|
902
|
+
var gt = (function() {
|
|
903
|
+
var t = /* @__PURE__ */ w(function(S, g, m, v) {
|
|
904
|
+
for (m = m || {}, v = S.length; v--; m[S[v]] = g) ;
|
|
905
|
+
return m;
|
|
906
|
+
}, "o"), n = [5, 8], s = [7, 8, 11, 12, 17, 19, 22, 24], e = [1, 17], i = [1, 18], o = [7, 8, 11, 12, 14, 15, 16, 17, 19, 20, 21, 22, 24, 27], a = [1, 31], c = [1, 39], h = [7, 8, 11, 12, 17, 19, 22, 24, 27], u = [1, 57], r = [1, 56], y = [1, 58], d = [1, 59], b = [1, 60], x = [7, 8, 11, 12, 16, 17, 19, 20, 22, 24, 27, 31, 32, 33], M = {
|
|
907
|
+
trace: /* @__PURE__ */ w(function() {
|
|
908
|
+
}, "trace"),
|
|
909
|
+
yy: {},
|
|
910
|
+
symbols_: { error: 2, start: 3, optNewlines: 4, VENN: 5, document: 6, EOF: 7, NEWLINE: 8, line: 9, statement: 10, TITLE: 11, SET: 12, identifier: 13, BRACKET_LABEL: 14, COLON: 15, NUMERIC: 16, UNION: 17, identifierList: 18, TEXT: 19, IDENTIFIER: 20, STRING: 21, INDENT_TEXT: 22, indentedTextTail: 23, STYLE: 24, stylesOpt: 25, styleField: 26, COMMA: 27, styleValue: 28, valueTokens: 29, valueToken: 30, HEXCOLOR: 31, RGBCOLOR: 32, RGBACOLOR: 33, $accept: 0, $end: 1 },
|
|
911
|
+
terminals_: { 2: "error", 5: "VENN", 7: "EOF", 8: "NEWLINE", 11: "TITLE", 12: "SET", 14: "BRACKET_LABEL", 15: "COLON", 16: "NUMERIC", 17: "UNION", 19: "TEXT", 20: "IDENTIFIER", 21: "STRING", 22: "INDENT_TEXT", 24: "STYLE", 27: "COMMA", 31: "HEXCOLOR", 32: "RGBCOLOR", 33: "RGBACOLOR" },
|
|
912
|
+
productions_: [0, [3, 4], [4, 0], [4, 2], [6, 0], [6, 2], [9, 1], [9, 1], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 2], [10, 3], [10, 4], [10, 5], [10, 3], [10, 3], [10, 3], [10, 4], [10, 4], [10, 2], [10, 3], [23, 1], [23, 1], [23, 1], [23, 2], [23, 2], [25, 1], [25, 3], [26, 3], [28, 1], [28, 1], [29, 1], [29, 2], [30, 1], [30, 1], [30, 1], [30, 1], [30, 1], [18, 1], [18, 3], [13, 1], [13, 1]],
|
|
913
|
+
performAction: /* @__PURE__ */ w(function(g, m, v, l, p, f, N) {
|
|
914
|
+
var I = f.length - 1;
|
|
915
|
+
switch (p) {
|
|
916
|
+
case 1:
|
|
917
|
+
return f[I - 1];
|
|
918
|
+
case 2:
|
|
919
|
+
case 3:
|
|
920
|
+
case 4:
|
|
921
|
+
this.$ = [];
|
|
922
|
+
break;
|
|
923
|
+
case 5:
|
|
924
|
+
f[I - 1].push(f[I]), this.$ = f[I - 1];
|
|
925
|
+
break;
|
|
926
|
+
case 6:
|
|
927
|
+
this.$ = [];
|
|
928
|
+
break;
|
|
929
|
+
case 7:
|
|
930
|
+
case 22:
|
|
931
|
+
case 32:
|
|
932
|
+
case 36:
|
|
933
|
+
case 37:
|
|
934
|
+
case 38:
|
|
935
|
+
case 39:
|
|
936
|
+
case 40:
|
|
937
|
+
this.$ = f[I];
|
|
938
|
+
break;
|
|
939
|
+
case 8:
|
|
940
|
+
l.setDiagramTitle(f[I].substr(6)), this.$ = f[I].substr(6);
|
|
941
|
+
break;
|
|
942
|
+
case 9:
|
|
943
|
+
l.addSubsetData([f[I]], void 0, void 0), l.setIndentMode && l.setIndentMode(!0);
|
|
944
|
+
break;
|
|
945
|
+
case 10:
|
|
946
|
+
l.addSubsetData([f[I - 1]], f[I], void 0), l.setIndentMode && l.setIndentMode(!0);
|
|
947
|
+
break;
|
|
948
|
+
case 11:
|
|
949
|
+
l.addSubsetData([f[I - 2]], void 0, parseFloat(f[I])), l.setIndentMode && l.setIndentMode(!0);
|
|
950
|
+
break;
|
|
951
|
+
case 12:
|
|
952
|
+
l.addSubsetData([f[I - 3]], f[I - 2], parseFloat(f[I])), l.setIndentMode && l.setIndentMode(!0);
|
|
953
|
+
break;
|
|
954
|
+
case 13:
|
|
955
|
+
if (f[I].length < 2)
|
|
956
|
+
throw new Error("union requires multiple identifiers");
|
|
957
|
+
l.validateUnionIdentifiers && l.validateUnionIdentifiers(f[I]), l.addSubsetData(f[I], void 0, void 0), l.setIndentMode && l.setIndentMode(!0);
|
|
958
|
+
break;
|
|
959
|
+
case 14:
|
|
960
|
+
if (f[I - 1].length < 2)
|
|
961
|
+
throw new Error("union requires multiple identifiers");
|
|
962
|
+
l.validateUnionIdentifiers && l.validateUnionIdentifiers(f[I - 1]), l.addSubsetData(f[I - 1], f[I], void 0), l.setIndentMode && l.setIndentMode(!0);
|
|
963
|
+
break;
|
|
964
|
+
case 15:
|
|
965
|
+
if (f[I - 2].length < 2)
|
|
966
|
+
throw new Error("union requires multiple identifiers");
|
|
967
|
+
l.validateUnionIdentifiers && l.validateUnionIdentifiers(f[I - 2]), l.addSubsetData(f[I - 2], void 0, parseFloat(f[I])), l.setIndentMode && l.setIndentMode(!0);
|
|
968
|
+
break;
|
|
969
|
+
case 16:
|
|
970
|
+
if (f[I - 3].length < 2)
|
|
971
|
+
throw new Error("union requires multiple identifiers");
|
|
972
|
+
l.validateUnionIdentifiers && l.validateUnionIdentifiers(f[I - 3]), l.addSubsetData(f[I - 3], f[I - 2], parseFloat(f[I])), l.setIndentMode && l.setIndentMode(!0);
|
|
973
|
+
break;
|
|
974
|
+
case 17:
|
|
975
|
+
case 18:
|
|
976
|
+
case 19:
|
|
977
|
+
l.addTextData(f[I - 1], f[I], void 0);
|
|
978
|
+
break;
|
|
979
|
+
case 20:
|
|
980
|
+
case 21:
|
|
981
|
+
l.addTextData(f[I - 2], f[I - 1], f[I]);
|
|
982
|
+
break;
|
|
983
|
+
case 23:
|
|
984
|
+
l.addStyleData(f[I - 1], f[I]);
|
|
985
|
+
break;
|
|
986
|
+
case 24:
|
|
987
|
+
case 25:
|
|
988
|
+
case 26:
|
|
989
|
+
var R = l.getCurrentSets();
|
|
990
|
+
if (!R) throw new Error("text requires set");
|
|
991
|
+
l.addTextData(R, f[I], void 0);
|
|
992
|
+
break;
|
|
993
|
+
case 27:
|
|
994
|
+
case 28:
|
|
995
|
+
var R = l.getCurrentSets();
|
|
996
|
+
if (!R) throw new Error("text requires set");
|
|
997
|
+
l.addTextData(R, f[I - 1], f[I]);
|
|
998
|
+
break;
|
|
999
|
+
case 29:
|
|
1000
|
+
case 41:
|
|
1001
|
+
this.$ = [f[I]];
|
|
1002
|
+
break;
|
|
1003
|
+
case 30:
|
|
1004
|
+
case 42:
|
|
1005
|
+
this.$ = [...f[I - 2], f[I]];
|
|
1006
|
+
break;
|
|
1007
|
+
case 31:
|
|
1008
|
+
this.$ = [f[I - 2], f[I]];
|
|
1009
|
+
break;
|
|
1010
|
+
case 33:
|
|
1011
|
+
this.$ = f[I].join(" ");
|
|
1012
|
+
break;
|
|
1013
|
+
case 34:
|
|
1014
|
+
this.$ = [f[I]];
|
|
1015
|
+
break;
|
|
1016
|
+
case 35:
|
|
1017
|
+
f[I - 1].push(f[I]), this.$ = f[I - 1];
|
|
1018
|
+
break;
|
|
1019
|
+
case 43:
|
|
1020
|
+
case 44:
|
|
1021
|
+
this.$ = f[I];
|
|
1022
|
+
break;
|
|
1023
|
+
}
|
|
1024
|
+
}, "anonymous"),
|
|
1025
|
+
table: [t(n, [2, 2], { 3: 1, 4: 2 }), { 1: [3] }, { 5: [1, 3], 8: [1, 4] }, t(s, [2, 4], { 6: 5 }), t(n, [2, 3]), { 7: [1, 6], 8: [1, 8], 9: 7, 10: 9, 11: [1, 10], 12: [1, 11], 17: [1, 12], 19: [1, 13], 22: [1, 14], 24: [1, 15] }, { 1: [2, 1] }, t(s, [2, 5]), t(s, [2, 6]), t(s, [2, 7]), t(s, [2, 8]), { 13: 16, 20: e, 21: i }, { 13: 20, 18: 19, 20: e, 21: i }, { 13: 20, 18: 21, 20: e, 21: i }, { 16: [1, 25], 20: [1, 23], 21: [1, 24], 23: 22 }, { 13: 20, 18: 26, 20: e, 21: i }, t(s, [2, 9], { 14: [1, 27], 15: [1, 28] }), t(o, [2, 43]), t(o, [2, 44]), t(s, [2, 13], { 14: [1, 29], 15: [1, 30], 27: a }), t(o, [2, 41]), { 16: [1, 34], 20: [1, 32], 21: [1, 33], 27: a }, t(s, [2, 22]), t(s, [2, 24], { 14: [1, 35] }), t(s, [2, 25], { 14: [1, 36] }), t(s, [2, 26]), { 20: c, 25: 37, 26: 38, 27: a }, t(s, [2, 10], { 15: [1, 40] }), { 16: [1, 41] }, t(s, [2, 14], { 15: [1, 42] }), { 16: [1, 43] }, { 13: 44, 20: e, 21: i }, t(s, [2, 17], { 14: [1, 45] }), t(s, [2, 18], { 14: [1, 46] }), t(s, [2, 19]), t(s, [2, 27]), t(s, [2, 28]), t(s, [2, 23], { 27: [1, 47] }), t(h, [2, 29]), { 15: [1, 48] }, { 16: [1, 49] }, t(s, [2, 11]), { 16: [1, 50] }, t(s, [2, 15]), t(o, [2, 42]), t(s, [2, 20]), t(s, [2, 21]), { 20: c, 26: 51 }, { 16: u, 20: r, 21: [1, 53], 28: 52, 29: 54, 30: 55, 31: y, 32: d, 33: b }, t(s, [2, 12]), t(s, [2, 16]), t(h, [2, 30]), t(h, [2, 31]), t(h, [2, 32]), t(h, [2, 33], { 30: 61, 16: u, 20: r, 31: y, 32: d, 33: b }), t(x, [2, 34]), t(x, [2, 36]), t(x, [2, 37]), t(x, [2, 38]), t(x, [2, 39]), t(x, [2, 40]), t(x, [2, 35])],
|
|
1026
|
+
defaultActions: { 6: [2, 1] },
|
|
1027
|
+
parseError: /* @__PURE__ */ w(function(g, m) {
|
|
1028
|
+
if (m.recoverable)
|
|
1029
|
+
this.trace(g);
|
|
1030
|
+
else {
|
|
1031
|
+
var v = new Error(g);
|
|
1032
|
+
throw v.hash = m, v;
|
|
1033
|
+
}
|
|
1034
|
+
}, "parseError"),
|
|
1035
|
+
parse: /* @__PURE__ */ w(function(g) {
|
|
1036
|
+
var m = this, v = [0], l = [], p = [null], f = [], N = this.table, I = "", R = 0, U = 0, j = 2, E = 1, D = f.slice.call(arguments, 1), _ = Object.create(this.lexer), P = { yy: {} };
|
|
1037
|
+
for (var V in this.yy)
|
|
1038
|
+
Object.prototype.hasOwnProperty.call(this.yy, V) && (P.yy[V] = this.yy[V]);
|
|
1039
|
+
_.setInput(g, P.yy), P.yy.lexer = _, P.yy.parser = this, typeof _.yylloc > "u" && (_.yylloc = {});
|
|
1040
|
+
var O = _.yylloc;
|
|
1041
|
+
f.push(O);
|
|
1042
|
+
var B = _.options && _.options.ranges;
|
|
1043
|
+
typeof P.yy.parseError == "function" ? this.parseError = P.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
|
|
1044
|
+
function W(G) {
|
|
1045
|
+
v.length = v.length - 2 * G, p.length = p.length - G, f.length = f.length - G;
|
|
1046
|
+
}
|
|
1047
|
+
w(W, "popStack");
|
|
1048
|
+
function K() {
|
|
1049
|
+
var G;
|
|
1050
|
+
return G = l.pop() || _.lex() || E, typeof G != "number" && (G instanceof Array && (l = G, G = l.pop()), G = m.symbols_[G] || G), G;
|
|
1051
|
+
}
|
|
1052
|
+
w(K, "lex");
|
|
1053
|
+
for (var z, L, C, Y, k = {}, F, H, et, X; ; ) {
|
|
1054
|
+
if (L = v[v.length - 1], this.defaultActions[L] ? C = this.defaultActions[L] : ((z === null || typeof z > "u") && (z = K()), C = N[L] && N[L][z]), typeof C > "u" || !C.length || !C[0]) {
|
|
1055
|
+
var Z = "";
|
|
1056
|
+
X = [];
|
|
1057
|
+
for (F in N[L])
|
|
1058
|
+
this.terminals_[F] && F > j && X.push("'" + this.terminals_[F] + "'");
|
|
1059
|
+
_.showPosition ? Z = "Parse error on line " + (R + 1) + `:
|
|
1060
|
+
` + _.showPosition() + `
|
|
1061
|
+
Expecting ` + X.join(", ") + ", got '" + (this.terminals_[z] || z) + "'" : Z = "Parse error on line " + (R + 1) + ": Unexpected " + (z == E ? "end of input" : "'" + (this.terminals_[z] || z) + "'"), this.parseError(Z, {
|
|
1062
|
+
text: _.match,
|
|
1063
|
+
token: this.terminals_[z] || z,
|
|
1064
|
+
line: _.yylineno,
|
|
1065
|
+
loc: O,
|
|
1066
|
+
expected: X
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
if (C[0] instanceof Array && C.length > 1)
|
|
1070
|
+
throw new Error("Parse Error: multiple actions possible at state: " + L + ", token: " + z);
|
|
1071
|
+
switch (C[0]) {
|
|
1072
|
+
case 1:
|
|
1073
|
+
v.push(z), p.push(_.yytext), f.push(_.yylloc), v.push(C[1]), z = null, U = _.yyleng, I = _.yytext, R = _.yylineno, O = _.yylloc;
|
|
1074
|
+
break;
|
|
1075
|
+
case 2:
|
|
1076
|
+
if (H = this.productions_[C[1]][1], k.$ = p[p.length - H], k._$ = {
|
|
1077
|
+
first_line: f[f.length - (H || 1)].first_line,
|
|
1078
|
+
last_line: f[f.length - 1].last_line,
|
|
1079
|
+
first_column: f[f.length - (H || 1)].first_column,
|
|
1080
|
+
last_column: f[f.length - 1].last_column
|
|
1081
|
+
}, B && (k._$.range = [
|
|
1082
|
+
f[f.length - (H || 1)].range[0],
|
|
1083
|
+
f[f.length - 1].range[1]
|
|
1084
|
+
]), Y = this.performAction.apply(k, [
|
|
1085
|
+
I,
|
|
1086
|
+
U,
|
|
1087
|
+
R,
|
|
1088
|
+
P.yy,
|
|
1089
|
+
C[1],
|
|
1090
|
+
p,
|
|
1091
|
+
f
|
|
1092
|
+
].concat(D)), typeof Y < "u")
|
|
1093
|
+
return Y;
|
|
1094
|
+
H && (v = v.slice(0, -1 * H * 2), p = p.slice(0, -1 * H), f = f.slice(0, -1 * H)), v.push(this.productions_[C[1]][0]), p.push(k.$), f.push(k._$), et = N[v[v.length - 2]][v[v.length - 1]], v.push(et);
|
|
1095
|
+
break;
|
|
1096
|
+
case 3:
|
|
1097
|
+
return !0;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
return !0;
|
|
1101
|
+
}, "parse")
|
|
1102
|
+
}, A = /* @__PURE__ */ (function() {
|
|
1103
|
+
var S = {
|
|
1104
|
+
EOF: 1,
|
|
1105
|
+
parseError: /* @__PURE__ */ w(function(m, v) {
|
|
1106
|
+
if (this.yy.parser)
|
|
1107
|
+
this.yy.parser.parseError(m, v);
|
|
1108
|
+
else
|
|
1109
|
+
throw new Error(m);
|
|
1110
|
+
}, "parseError"),
|
|
1111
|
+
// resets the lexer, sets new input
|
|
1112
|
+
setInput: /* @__PURE__ */ w(function(g, m) {
|
|
1113
|
+
return this.yy = m || this.yy || {}, this._input = g, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
|
|
1114
|
+
first_line: 1,
|
|
1115
|
+
first_column: 0,
|
|
1116
|
+
last_line: 1,
|
|
1117
|
+
last_column: 0
|
|
1118
|
+
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
|
|
1119
|
+
}, "setInput"),
|
|
1120
|
+
// consumes and returns one char from the input
|
|
1121
|
+
input: /* @__PURE__ */ w(function() {
|
|
1122
|
+
var g = this._input[0];
|
|
1123
|
+
this.yytext += g, this.yyleng++, this.offset++, this.match += g, this.matched += g;
|
|
1124
|
+
var m = g.match(/(?:\r\n?|\n).*/g);
|
|
1125
|
+
return m ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), g;
|
|
1126
|
+
}, "input"),
|
|
1127
|
+
// unshifts one char (or a string) into the input
|
|
1128
|
+
unput: /* @__PURE__ */ w(function(g) {
|
|
1129
|
+
var m = g.length, v = g.split(/(?:\r\n?|\n)/g);
|
|
1130
|
+
this._input = g + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - m), this.offset -= m;
|
|
1131
|
+
var l = this.match.split(/(?:\r\n?|\n)/g);
|
|
1132
|
+
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), v.length - 1 && (this.yylineno -= v.length - 1);
|
|
1133
|
+
var p = this.yylloc.range;
|
|
1134
|
+
return this.yylloc = {
|
|
1135
|
+
first_line: this.yylloc.first_line,
|
|
1136
|
+
last_line: this.yylineno + 1,
|
|
1137
|
+
first_column: this.yylloc.first_column,
|
|
1138
|
+
last_column: v ? (v.length === l.length ? this.yylloc.first_column : 0) + l[l.length - v.length].length - v[0].length : this.yylloc.first_column - m
|
|
1139
|
+
}, this.options.ranges && (this.yylloc.range = [p[0], p[0] + this.yyleng - m]), this.yyleng = this.yytext.length, this;
|
|
1140
|
+
}, "unput"),
|
|
1141
|
+
// When called from action, caches matched text and appends it on next action
|
|
1142
|
+
more: /* @__PURE__ */ w(function() {
|
|
1143
|
+
return this._more = !0, this;
|
|
1144
|
+
}, "more"),
|
|
1145
|
+
// 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.
|
|
1146
|
+
reject: /* @__PURE__ */ w(function() {
|
|
1147
|
+
if (this.options.backtrack_lexer)
|
|
1148
|
+
this._backtrack = !0;
|
|
1149
|
+
else
|
|
1150
|
+
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).
|
|
1151
|
+
` + this.showPosition(), {
|
|
1152
|
+
text: "",
|
|
1153
|
+
token: null,
|
|
1154
|
+
line: this.yylineno
|
|
1155
|
+
});
|
|
1156
|
+
return this;
|
|
1157
|
+
}, "reject"),
|
|
1158
|
+
// retain first n characters of the match
|
|
1159
|
+
less: /* @__PURE__ */ w(function(g) {
|
|
1160
|
+
this.unput(this.match.slice(g));
|
|
1161
|
+
}, "less"),
|
|
1162
|
+
// displays already matched input, i.e. for error messages
|
|
1163
|
+
pastInput: /* @__PURE__ */ w(function() {
|
|
1164
|
+
var g = this.matched.substr(0, this.matched.length - this.match.length);
|
|
1165
|
+
return (g.length > 20 ? "..." : "") + g.substr(-20).replace(/\n/g, "");
|
|
1166
|
+
}, "pastInput"),
|
|
1167
|
+
// displays upcoming input, i.e. for error messages
|
|
1168
|
+
upcomingInput: /* @__PURE__ */ w(function() {
|
|
1169
|
+
var g = this.match;
|
|
1170
|
+
return g.length < 20 && (g += this._input.substr(0, 20 - g.length)), (g.substr(0, 20) + (g.length > 20 ? "..." : "")).replace(/\n/g, "");
|
|
1171
|
+
}, "upcomingInput"),
|
|
1172
|
+
// displays the character position where the lexing error occurred, i.e. for error messages
|
|
1173
|
+
showPosition: /* @__PURE__ */ w(function() {
|
|
1174
|
+
var g = this.pastInput(), m = new Array(g.length + 1).join("-");
|
|
1175
|
+
return g + this.upcomingInput() + `
|
|
1176
|
+
` + m + "^";
|
|
1177
|
+
}, "showPosition"),
|
|
1178
|
+
// test the lexed token: return FALSE when not a match, otherwise return token
|
|
1179
|
+
test_match: /* @__PURE__ */ w(function(g, m) {
|
|
1180
|
+
var v, l, p;
|
|
1181
|
+
if (this.options.backtrack_lexer && (p = {
|
|
1182
|
+
yylineno: this.yylineno,
|
|
1183
|
+
yylloc: {
|
|
1184
|
+
first_line: this.yylloc.first_line,
|
|
1185
|
+
last_line: this.last_line,
|
|
1186
|
+
first_column: this.yylloc.first_column,
|
|
1187
|
+
last_column: this.yylloc.last_column
|
|
1188
|
+
},
|
|
1189
|
+
yytext: this.yytext,
|
|
1190
|
+
match: this.match,
|
|
1191
|
+
matches: this.matches,
|
|
1192
|
+
matched: this.matched,
|
|
1193
|
+
yyleng: this.yyleng,
|
|
1194
|
+
offset: this.offset,
|
|
1195
|
+
_more: this._more,
|
|
1196
|
+
_input: this._input,
|
|
1197
|
+
yy: this.yy,
|
|
1198
|
+
conditionStack: this.conditionStack.slice(0),
|
|
1199
|
+
done: this.done
|
|
1200
|
+
}, this.options.ranges && (p.yylloc.range = this.yylloc.range.slice(0))), l = g[0].match(/(?:\r\n?|\n).*/g), l && (this.yylineno += l.length), this.yylloc = {
|
|
1201
|
+
first_line: this.yylloc.last_line,
|
|
1202
|
+
last_line: this.yylineno + 1,
|
|
1203
|
+
first_column: this.yylloc.last_column,
|
|
1204
|
+
last_column: l ? l[l.length - 1].length - l[l.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + g[0].length
|
|
1205
|
+
}, this.yytext += g[0], this.match += g[0], this.matches = g, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(g[0].length), this.matched += g[0], v = this.performAction.call(this, this.yy, this, m, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), v)
|
|
1206
|
+
return v;
|
|
1207
|
+
if (this._backtrack) {
|
|
1208
|
+
for (var f in p)
|
|
1209
|
+
this[f] = p[f];
|
|
1210
|
+
return !1;
|
|
1211
|
+
}
|
|
1212
|
+
return !1;
|
|
1213
|
+
}, "test_match"),
|
|
1214
|
+
// return next match in input
|
|
1215
|
+
next: /* @__PURE__ */ w(function() {
|
|
1216
|
+
if (this.done)
|
|
1217
|
+
return this.EOF;
|
|
1218
|
+
this._input || (this.done = !0);
|
|
1219
|
+
var g, m, v, l;
|
|
1220
|
+
this._more || (this.yytext = "", this.match = "");
|
|
1221
|
+
for (var p = this._currentRules(), f = 0; f < p.length; f++)
|
|
1222
|
+
if (v = this._input.match(this.rules[p[f]]), v && (!m || v[0].length > m[0].length)) {
|
|
1223
|
+
if (m = v, l = f, this.options.backtrack_lexer) {
|
|
1224
|
+
if (g = this.test_match(v, p[f]), g !== !1)
|
|
1225
|
+
return g;
|
|
1226
|
+
if (this._backtrack) {
|
|
1227
|
+
m = !1;
|
|
1228
|
+
continue;
|
|
1229
|
+
} else
|
|
1230
|
+
return !1;
|
|
1231
|
+
} else if (!this.options.flex)
|
|
1232
|
+
break;
|
|
1233
|
+
}
|
|
1234
|
+
return m ? (g = this.test_match(m, p[l]), g !== !1 ? g : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
|
|
1235
|
+
` + this.showPosition(), {
|
|
1236
|
+
text: "",
|
|
1237
|
+
token: null,
|
|
1238
|
+
line: this.yylineno
|
|
1239
|
+
});
|
|
1240
|
+
}, "next"),
|
|
1241
|
+
// return next match that has a token
|
|
1242
|
+
lex: /* @__PURE__ */ w(function() {
|
|
1243
|
+
var m = this.next();
|
|
1244
|
+
return m || this.lex();
|
|
1245
|
+
}, "lex"),
|
|
1246
|
+
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
|
1247
|
+
begin: /* @__PURE__ */ w(function(m) {
|
|
1248
|
+
this.conditionStack.push(m);
|
|
1249
|
+
}, "begin"),
|
|
1250
|
+
// pop the previously active lexer condition state off the condition stack
|
|
1251
|
+
popState: /* @__PURE__ */ w(function() {
|
|
1252
|
+
var m = this.conditionStack.length - 1;
|
|
1253
|
+
return m > 0 ? this.conditionStack.pop() : this.conditionStack[0];
|
|
1254
|
+
}, "popState"),
|
|
1255
|
+
// produce the lexer rule set which is active for the currently active lexer condition state
|
|
1256
|
+
_currentRules: /* @__PURE__ */ w(function() {
|
|
1257
|
+
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
|
|
1258
|
+
}, "_currentRules"),
|
|
1259
|
+
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
|
1260
|
+
topState: /* @__PURE__ */ w(function(m) {
|
|
1261
|
+
return m = this.conditionStack.length - 1 - Math.abs(m || 0), m >= 0 ? this.conditionStack[m] : "INITIAL";
|
|
1262
|
+
}, "topState"),
|
|
1263
|
+
// alias for begin(condition)
|
|
1264
|
+
pushState: /* @__PURE__ */ w(function(m) {
|
|
1265
|
+
this.begin(m);
|
|
1266
|
+
}, "pushState"),
|
|
1267
|
+
// return the number of states currently on the stack
|
|
1268
|
+
stateStackSize: /* @__PURE__ */ w(function() {
|
|
1269
|
+
return this.conditionStack.length;
|
|
1270
|
+
}, "stateStackSize"),
|
|
1271
|
+
options: { "case-insensitive": !0 },
|
|
1272
|
+
performAction: /* @__PURE__ */ w(function(m, v, l, p) {
|
|
1273
|
+
switch (l) {
|
|
1274
|
+
case 0:
|
|
1275
|
+
break;
|
|
1276
|
+
case 1:
|
|
1277
|
+
break;
|
|
1278
|
+
case 2:
|
|
1279
|
+
break;
|
|
1280
|
+
case 3:
|
|
1281
|
+
if (m.getIndentMode && m.getIndentMode())
|
|
1282
|
+
return m.consumeIndentText = !0, this.begin("INITIAL"), 22;
|
|
1283
|
+
break;
|
|
1284
|
+
case 4:
|
|
1285
|
+
break;
|
|
1286
|
+
case 5:
|
|
1287
|
+
m.setIndentMode && m.setIndentMode(!1), this.begin("INITIAL"), this.unput(v.yytext);
|
|
1288
|
+
break;
|
|
1289
|
+
case 6:
|
|
1290
|
+
return this.begin("bol"), 8;
|
|
1291
|
+
case 7:
|
|
1292
|
+
break;
|
|
1293
|
+
case 8:
|
|
1294
|
+
break;
|
|
1295
|
+
case 9:
|
|
1296
|
+
return 7;
|
|
1297
|
+
case 10:
|
|
1298
|
+
return 11;
|
|
1299
|
+
case 11:
|
|
1300
|
+
return 5;
|
|
1301
|
+
case 12:
|
|
1302
|
+
return 12;
|
|
1303
|
+
case 13:
|
|
1304
|
+
return 17;
|
|
1305
|
+
case 14:
|
|
1306
|
+
if (m.consumeIndentText)
|
|
1307
|
+
m.consumeIndentText = !1;
|
|
1308
|
+
else
|
|
1309
|
+
return 19;
|
|
1310
|
+
break;
|
|
1311
|
+
case 15:
|
|
1312
|
+
return 24;
|
|
1313
|
+
case 16:
|
|
1314
|
+
return v.yytext = v.yytext.slice(2, -2), 14;
|
|
1315
|
+
case 17:
|
|
1316
|
+
return v.yytext = v.yytext.slice(1, -1).trim(), 14;
|
|
1317
|
+
case 18:
|
|
1318
|
+
return 16;
|
|
1319
|
+
case 19:
|
|
1320
|
+
return 31;
|
|
1321
|
+
case 20:
|
|
1322
|
+
return 33;
|
|
1323
|
+
case 21:
|
|
1324
|
+
return 32;
|
|
1325
|
+
case 22:
|
|
1326
|
+
return 20;
|
|
1327
|
+
case 23:
|
|
1328
|
+
return 21;
|
|
1329
|
+
case 24:
|
|
1330
|
+
return 27;
|
|
1331
|
+
case 25:
|
|
1332
|
+
return 15;
|
|
1333
|
+
}
|
|
1334
|
+
}, "anonymous"),
|
|
1335
|
+
rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[ \t]+(?=[\n\r]))/i, /^(?:[ \t]+(?=text\b))/i, /^(?:[ \t]+)/i, /^(?:[^ \t\n\r])/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:[ \t]+)/i, /^(?:$)/i, /^(?:title\s[^#\n;]+)/i, /^(?:venn-beta\b)/i, /^(?:set\b)/i, /^(?:union\b)/i, /^(?:text\b)/i, /^(?:style\b)/i, /^(?:\["[^\"]*"\])/i, /^(?:\[[^\]\"]+\])/i, /^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i, /^(?:#[0-9a-fA-F]{3,8})/i, /^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i, /^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i, /^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i, /^(?:"[^\"]*")/i, /^(?:,)/i, /^(?::)/i],
|
|
1336
|
+
conditions: { bol: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], inclusive: !0 }, INITIAL: { rules: [0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], inclusive: !0 } }
|
|
1337
|
+
};
|
|
1338
|
+
return S;
|
|
1339
|
+
})();
|
|
1340
|
+
M.lexer = A;
|
|
1341
|
+
function T() {
|
|
1342
|
+
this.yy = {};
|
|
1343
|
+
}
|
|
1344
|
+
return w(T, "Parser"), T.prototype = M, M.Parser = T, new T();
|
|
1345
|
+
})();
|
|
1346
|
+
gt.parser = gt;
|
|
1347
|
+
var Se = gt, yt = [], pt = [], mt = [], bt = /* @__PURE__ */ new Set(), vt, It = !1, we = /* @__PURE__ */ w((t, n, s) => {
|
|
1348
|
+
const e = it(t).sort(), i = s ?? 10 / Math.pow(t.length, 2);
|
|
1349
|
+
vt = e, e.length === 1 && bt.add(e[0]), yt.push({
|
|
1350
|
+
sets: e,
|
|
1351
|
+
size: i,
|
|
1352
|
+
label: n ? nt(n) : void 0
|
|
1353
|
+
});
|
|
1354
|
+
}, "addSubsetData"), _e = /* @__PURE__ */ w(() => yt, "getSubsetData"), nt = /* @__PURE__ */ w((t) => {
|
|
1355
|
+
const n = t.trim();
|
|
1356
|
+
return n.length >= 2 && n.startsWith('"') && n.endsWith('"') ? n.slice(1, -1) : n;
|
|
1357
|
+
}, "normalizeText"), Te = /* @__PURE__ */ w((t) => t && nt(t), "normalizeStyleValue"), Ee = /* @__PURE__ */ w((t, n, s) => {
|
|
1358
|
+
const e = nt(n);
|
|
1359
|
+
pt.push({
|
|
1360
|
+
sets: it(t).sort(),
|
|
1361
|
+
id: e,
|
|
1362
|
+
label: s ? nt(s) : void 0
|
|
1363
|
+
});
|
|
1364
|
+
}, "addTextData"), ze = /* @__PURE__ */ w((t, n) => {
|
|
1365
|
+
const s = it(t).sort(), e = {};
|
|
1366
|
+
for (const [i, o] of n)
|
|
1367
|
+
e[i] = Te(o) ?? o;
|
|
1368
|
+
mt.push({ targets: s, styles: e });
|
|
1369
|
+
}, "addStyleData"), Ae = /* @__PURE__ */ w(() => mt, "getStyleData"), it = /* @__PURE__ */ w((t) => t.map((n) => nt(n)), "normalizeIdentifierList"), De = /* @__PURE__ */ w((t) => {
|
|
1370
|
+
const s = it(t).filter((e) => !bt.has(e));
|
|
1371
|
+
if (s.length > 0)
|
|
1372
|
+
throw new Error(`unknown set identifier: ${s.join(", ")}`);
|
|
1373
|
+
}, "validateUnionIdentifiers"), Re = /* @__PURE__ */ w(() => pt, "getTextData"), Ce = /* @__PURE__ */ w(() => vt, "getCurrentSets"), Ne = /* @__PURE__ */ w(() => It, "getIndentMode"), Oe = /* @__PURE__ */ w((t) => {
|
|
1374
|
+
It = t;
|
|
1375
|
+
}, "setIndentMode"), Fe = oe.venn;
|
|
1376
|
+
function Bt() {
|
|
1377
|
+
return ie(Fe, wt().venn);
|
|
1378
|
+
}
|
|
1379
|
+
w(Bt, "getConfig");
|
|
1380
|
+
var Le = /* @__PURE__ */ w(() => {
|
|
1381
|
+
se(), yt.length = 0, pt.length = 0, mt.length = 0, bt.clear(), vt = void 0, It = !1;
|
|
1382
|
+
}, "customClear"), je = {
|
|
1383
|
+
getConfig: Bt,
|
|
1384
|
+
clear: Le,
|
|
1385
|
+
setAccTitle: Zt,
|
|
1386
|
+
getAccTitle: Yt,
|
|
1387
|
+
setDiagramTitle: Xt,
|
|
1388
|
+
getDiagramTitle: Ht,
|
|
1389
|
+
getAccDescription: Kt,
|
|
1390
|
+
setAccDescription: Wt,
|
|
1391
|
+
addSubsetData: we,
|
|
1392
|
+
getSubsetData: _e,
|
|
1393
|
+
addTextData: Ee,
|
|
1394
|
+
addStyleData: ze,
|
|
1395
|
+
validateUnionIdentifiers: De,
|
|
1396
|
+
getTextData: Re,
|
|
1397
|
+
getStyleData: Ae,
|
|
1398
|
+
getCurrentSets: Ce,
|
|
1399
|
+
getIndentMode: Ne,
|
|
1400
|
+
setIndentMode: Oe
|
|
1401
|
+
}, Pe = /* @__PURE__ */ w((t) => `
|
|
1402
|
+
.venn-title {
|
|
1403
|
+
font-size: 32px;
|
|
1404
|
+
fill: ${t.vennTitleTextColor};
|
|
1405
|
+
font-family: ${t.fontFamily};
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
.venn-circle text {
|
|
1409
|
+
font-size: 48px;
|
|
1410
|
+
font-family: ${t.fontFamily};
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
.venn-intersection text {
|
|
1414
|
+
font-size: 48px;
|
|
1415
|
+
fill: ${t.vennSetTextColor};
|
|
1416
|
+
font-family: ${t.fontFamily};
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
.venn-text-node {
|
|
1420
|
+
font-family: ${t.fontFamily};
|
|
1421
|
+
color: ${t.vennSetTextColor};
|
|
1422
|
+
}
|
|
1423
|
+
`, "getStyles"), Ve = Pe;
|
|
1424
|
+
function qt(t) {
|
|
1425
|
+
const n = /* @__PURE__ */ new Map();
|
|
1426
|
+
for (const s of t) {
|
|
1427
|
+
const e = s.targets.join("|"), i = n.get(e);
|
|
1428
|
+
i ? Object.assign(i, s.styles) : n.set(e, { ...s.styles });
|
|
1429
|
+
}
|
|
1430
|
+
return n;
|
|
1431
|
+
}
|
|
1432
|
+
w(qt, "buildStyleByKey");
|
|
1433
|
+
var Be = /* @__PURE__ */ w((t, n, s, e) => {
|
|
1434
|
+
const i = e.db, o = i.getConfig?.(), { themeVariables: a, look: c, handDrawnSeed: h } = wt(), u = c === "handDrawn", r = [
|
|
1435
|
+
a.venn1,
|
|
1436
|
+
a.venn2,
|
|
1437
|
+
a.venn3,
|
|
1438
|
+
a.venn4,
|
|
1439
|
+
a.venn5,
|
|
1440
|
+
a.venn6,
|
|
1441
|
+
a.venn7,
|
|
1442
|
+
a.venn8
|
|
1443
|
+
].filter(Boolean), y = i.getDiagramTitle?.(), d = i.getSubsetData(), b = i.getTextData(), x = qt(i.getStyleData()), M = o?.width ?? 800, A = o?.height ?? 450, S = M / 1600, g = y ? 48 * S : 0, m = a.primaryTextColor ?? a.textColor, v = Jt(n);
|
|
1444
|
+
v.attr("viewBox", `0 0 ${M} ${A}`), y && v.append("text").text(y).attr("class", "venn-title").attr("font-size", `${32 * S}px`).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("x", "50%").attr("y", 32 * S).style("fill", a.vennTitleTextColor || a.titleColor);
|
|
1445
|
+
const l = ot(document.createElement("div")), p = be().width(M).height(A - g);
|
|
1446
|
+
l.datum(d).call(p);
|
|
1447
|
+
const f = u ? Qt.svg(l.select("svg").node()) : void 0, N = Me(d, {
|
|
1448
|
+
width: M,
|
|
1449
|
+
height: A - g,
|
|
1450
|
+
padding: o?.padding ?? 15
|
|
1451
|
+
}), I = /* @__PURE__ */ new Map();
|
|
1452
|
+
for (const E of N) {
|
|
1453
|
+
const D = Q([...E.data.sets].sort());
|
|
1454
|
+
I.set(D, E);
|
|
1455
|
+
}
|
|
1456
|
+
b.length > 0 && Ut(o, I, l, b, S, x);
|
|
1457
|
+
const R = $t(a.background || "#f4f4f4");
|
|
1458
|
+
l.selectAll(".venn-circle").each(function(E, D) {
|
|
1459
|
+
const _ = ot(this), V = Q([...E.sets].sort()), O = x.get(V), B = O?.fill || r[D % r.length] || a.primaryColor;
|
|
1460
|
+
_.classed(`venn-set-${D % 8}`, !0);
|
|
1461
|
+
const W = O?.["fill-opacity"] ?? 0.1, K = O?.stroke || B, z = O?.["stroke-width"] || `${5 * S}`;
|
|
1462
|
+
if (u && f) {
|
|
1463
|
+
const C = I.get(V);
|
|
1464
|
+
if (C && C.circles.length > 0) {
|
|
1465
|
+
const Y = C.circles[0], k = f.circle(Y.x, Y.y, Y.radius * 2, {
|
|
1466
|
+
roughness: 0.7,
|
|
1467
|
+
seed: h,
|
|
1468
|
+
fill: kt(B, 0.7),
|
|
1469
|
+
fillStyle: "hachure",
|
|
1470
|
+
fillWeight: 2,
|
|
1471
|
+
hachureGap: 8,
|
|
1472
|
+
hachureAngle: -41 + D * 60,
|
|
1473
|
+
stroke: K,
|
|
1474
|
+
strokeWidth: parseFloat(String(z))
|
|
1475
|
+
});
|
|
1476
|
+
_.select("path").remove(), _.node()?.insertBefore(k, _.select("text").node());
|
|
1477
|
+
}
|
|
1478
|
+
} else
|
|
1479
|
+
_.select("path").style("fill", B).style("fill-opacity", W).style("stroke", K).style("stroke-width", z).style("stroke-opacity", 0.95);
|
|
1480
|
+
const L = O?.color || (R ? te(B, 30) : ee(B, 30));
|
|
1481
|
+
_.select("text").style("font-size", `${48 * S}px`).style("fill", L);
|
|
1482
|
+
}), u && f ? l.selectAll(".venn-intersection").each(function(E) {
|
|
1483
|
+
const D = ot(this), P = Q([...E.sets].sort()), V = x.get(P), O = V?.fill;
|
|
1484
|
+
if (O) {
|
|
1485
|
+
const B = D.select("path"), W = B.attr("d");
|
|
1486
|
+
if (W) {
|
|
1487
|
+
const K = f.path(W, {
|
|
1488
|
+
roughness: 0.7,
|
|
1489
|
+
seed: h,
|
|
1490
|
+
fill: kt(O, 0.3),
|
|
1491
|
+
fillStyle: "cross-hatch",
|
|
1492
|
+
fillWeight: 2,
|
|
1493
|
+
hachureGap: 6,
|
|
1494
|
+
hachureAngle: 60,
|
|
1495
|
+
stroke: "none"
|
|
1496
|
+
}), z = B.node();
|
|
1497
|
+
z?.parentNode?.insertBefore(K, z), B.remove();
|
|
1498
|
+
}
|
|
1499
|
+
} else
|
|
1500
|
+
D.select("path").style("fill-opacity", 0);
|
|
1501
|
+
D.select("text").style("font-size", `${48 * S}px`).style("fill", V?.color ?? a.vennSetTextColor ?? m);
|
|
1502
|
+
}) : (l.selectAll(".venn-intersection text").style("font-size", `${48 * S}px`).style("fill", (E) => {
|
|
1503
|
+
const _ = Q([...E.sets].sort());
|
|
1504
|
+
return x.get(_)?.color ?? a.vennSetTextColor ?? m;
|
|
1505
|
+
}), l.selectAll(".venn-intersection path").style("fill-opacity", (E) => {
|
|
1506
|
+
const _ = Q([...E.sets].sort());
|
|
1507
|
+
return x.get(_)?.fill ? 1 : 0;
|
|
1508
|
+
}).style("fill", (E) => {
|
|
1509
|
+
const _ = Q([...E.sets].sort());
|
|
1510
|
+
return x.get(_)?.fill ?? "transparent";
|
|
1511
|
+
}));
|
|
1512
|
+
const U = v.append("g").attr("transform", `translate(0, ${g})`), j = l.select("svg").node();
|
|
1513
|
+
if (j && "childNodes" in j)
|
|
1514
|
+
for (const E of [...j.childNodes])
|
|
1515
|
+
U.node()?.appendChild(E);
|
|
1516
|
+
ne(v, A, M, o?.useMaxWidth ?? !0);
|
|
1517
|
+
}, "draw");
|
|
1518
|
+
function Q(t) {
|
|
1519
|
+
return t.join("|");
|
|
1520
|
+
}
|
|
1521
|
+
w(Q, "stableSetsKey");
|
|
1522
|
+
function Ut(t, n, s, e, i, o) {
|
|
1523
|
+
const a = t?.useDebugLayout ?? !1, h = s.select("svg").append("g").attr("class", "venn-text-nodes"), u = /* @__PURE__ */ new Map();
|
|
1524
|
+
for (const r of e) {
|
|
1525
|
+
const y = Q(r.sets), d = u.get(y);
|
|
1526
|
+
d ? d.push(r) : u.set(y, [r]);
|
|
1527
|
+
}
|
|
1528
|
+
for (const [r, y] of u.entries()) {
|
|
1529
|
+
const d = n.get(r);
|
|
1530
|
+
if (!d?.text)
|
|
1531
|
+
continue;
|
|
1532
|
+
const b = d.text.x, x = d.text.y, M = Math.min(...d.circles.map((E) => E.radius)), A = Math.min(
|
|
1533
|
+
...d.circles.map((E) => E.radius - Math.hypot(b - E.x, x - E.y))
|
|
1534
|
+
);
|
|
1535
|
+
let T = Number.isFinite(A) ? Math.max(0, A) : 0;
|
|
1536
|
+
T === 0 && Number.isFinite(M) && (T = M * 0.6);
|
|
1537
|
+
const S = h.append("g").attr("class", "venn-text-area").attr("font-size", `${40 * i}px`);
|
|
1538
|
+
a && S.append("circle").attr("class", "venn-text-debug-circle").attr("cx", b).attr("cy", x).attr("r", T).attr("fill", "none").attr("stroke", "purple").attr("stroke-width", 1.5 * i).attr("stroke-dasharray", `${6 * i} ${4 * i}`);
|
|
1539
|
+
const g = Math.max(80 * i, T * 2 * 0.95), m = Math.max(60 * i, T * 2 * 0.95), p = (d.data.label && d.data.label.length > 0 ? Math.min(32 * i, T * 0.25) : 0) + (y.length <= 2 ? 30 * i : 0), f = b - g / 2, N = x - m / 2 + p, I = Math.max(1, Math.ceil(Math.sqrt(y.length))), R = Math.max(1, Math.ceil(y.length / I)), U = g / I, j = m / R;
|
|
1540
|
+
for (const [E, D] of y.entries()) {
|
|
1541
|
+
const _ = E % I, P = Math.floor(E / I), V = f + U * (_ + 0.5), O = N + j * (P + 0.5);
|
|
1542
|
+
a && S.append("rect").attr("class", "venn-text-debug-cell").attr("x", f + U * _).attr("y", N + j * P).attr("width", U).attr("height", j).attr("fill", "none").attr("stroke", "teal").attr("stroke-width", 1 * i).attr("stroke-dasharray", `${4 * i} ${3 * i}`);
|
|
1543
|
+
const B = U * 0.9, W = j * 0.9, K = S.append("foreignObject").attr("class", "venn-text-node-fo").attr("width", B).attr("height", W).attr("x", V - B / 2).attr("y", O - W / 2).attr("overflow", "visible"), z = o.get(D.id)?.color, L = K.append("xhtml:span").attr("class", "venn-text-node").style("display", "flex").style("width", "100%").style("height", "100%").style("white-space", "normal").style("align-items", "center").style("justify-content", "center").style("text-align", "center").style("overflow-wrap", "normal").style("word-break", "normal").text(D.label ?? D.id);
|
|
1544
|
+
z && L.style("color", z);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
w(Ut, "renderTextNodes");
|
|
1549
|
+
var qe = { draw: Be }, Ge = {
|
|
1550
|
+
parser: Se,
|
|
1551
|
+
db: je,
|
|
1552
|
+
renderer: qe,
|
|
1553
|
+
styles: Ve
|
|
1554
|
+
};
|
|
1555
|
+
export {
|
|
1556
|
+
Ge as diagram
|
|
1557
|
+
};
|