@aiquants/markdown 6.0.0 → 6.2.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 +142 -7
- package/dist/{abnfDiagram-VRR7QNED-D7Rp9EaV.js → abnfDiagram-VRR7QNED-Csrzuwyl.js} +3 -3
- package/dist/{abnfDiagram-VRR7QNED-KTGT9TWM.cjs → abnfDiagram-VRR7QNED-DX6eyf4O.cjs} +1 -1
- package/dist/arc-Gw7Urszo.js +83 -0
- package/dist/{arc-D5T_urCC.cjs → arc-ZAQ3z7kr.cjs} +1 -1
- package/dist/{architectureDiagram-ZJ3FMSHR-DLrGYTYy.js → architectureDiagram-ZJ3FMSHR-Coy6_Fcg.js} +2 -2
- package/dist/{architectureDiagram-ZJ3FMSHR-BOo3y9aD.cjs → architectureDiagram-ZJ3FMSHR-DxzMbkp1.cjs} +1 -1
- package/dist/{blockDiagram-677ZJIJ3-B60l5Fpl.js → blockDiagram-677ZJIJ3-CbR-wn2x.js} +3 -3
- package/dist/{blockDiagram-677ZJIJ3-DnjCjo0a.cjs → blockDiagram-677ZJIJ3-THmR4OyE.cjs} +1 -1
- package/dist/{c4Diagram-LMCZKHZV-bd8fWQ1F.cjs → c4Diagram-LMCZKHZV-BcJpuXK1.cjs} +1 -1
- package/dist/{c4Diagram-LMCZKHZV-BmbplKCu.js → c4Diagram-LMCZKHZV-DHMqNO9p.js} +2 -2
- package/dist/{channel-B3oXm84X.js → channel-CfC4eqki.js} +1 -1
- package/dist/{channel-DJ_PyD9w.cjs → channel-Cryph4zI.cjs} +1 -1
- package/dist/{chunk-2Q5K7J3B-C0hbxO3D.js → chunk-2Q5K7J3B-C3BIc3MH.js} +1 -1
- package/dist/{chunk-2Q5K7J3B-CWLCO342.cjs → chunk-2Q5K7J3B-CxWyY331.cjs} +1 -1
- package/dist/{chunk-32BRIVSS-DUWtkDEY.js → chunk-32BRIVSS-C37ccuiX.js} +1 -1
- package/dist/{chunk-32BRIVSS-Cb9nTxqN.cjs → chunk-32BRIVSS-C3w_aYfI.cjs} +1 -1
- package/dist/{chunk-5VM5RSS4-DHA5n_Ls.cjs → chunk-5VM5RSS4-Cbt79-V5.cjs} +1 -1
- package/dist/{chunk-5VM5RSS4-C3mSh-gE.js → chunk-5VM5RSS4-DVLmkcyq.js} +1 -1
- package/dist/{chunk-EX3LRPZG-ByY6_kep.cjs → chunk-EX3LRPZG-BZOxrSRn.cjs} +1 -1
- package/dist/{chunk-EX3LRPZG-DCF1zjtT.js → chunk-EX3LRPZG-Co0Bql0-.js} +37 -37
- package/dist/{chunk-JWPE2WC7-CUBzYD4G.cjs → chunk-JWPE2WC7-Cvt_ToFU.cjs} +1 -1
- package/dist/{chunk-JWPE2WC7-CPLOunIL.js → chunk-JWPE2WC7-DUndc3Wb.js} +1 -1
- package/dist/{chunk-MOJQB5TN-P8-yb3-j.cjs → chunk-MOJQB5TN-AAMW2q8N.cjs} +1 -1
- package/dist/{chunk-MOJQB5TN-CmOhW6SK.js → chunk-MOJQB5TN-aTSDPliR.js} +11 -11
- package/dist/{chunk-PUDLZKDR-pKdIELvz.cjs → chunk-PUDLZKDR-CzCdcyAN.cjs} +1 -1
- package/dist/{chunk-PUDLZKDR-DH7B7ZTK.js → chunk-PUDLZKDR-Q5QzbDtY.js} +11 -11
- package/dist/{chunk-RYQCIY6F-DcvQCEoc.cjs → chunk-RYQCIY6F-DbjhsOnH.cjs} +1 -1
- package/dist/{chunk-RYQCIY6F-C7ytn_QX.js → chunk-RYQCIY6F-O6wbIIFF.js} +10 -10
- package/dist/{chunk-V7JOEXUC-CtXgqODy.cjs → chunk-V7JOEXUC-B6Qc5ABc.cjs} +1 -1
- package/dist/{chunk-V7JOEXUC-BgLcssUF.js → chunk-V7JOEXUC-OTS1fN7j.js} +10 -10
- package/dist/{chunk-VR4S4FIN-BK6xeIQk.js → chunk-VR4S4FIN-D4tY80kq.js} +1 -1
- package/dist/{chunk-VR4S4FIN-Cc4GDi2Z.cjs → chunk-VR4S4FIN-DlneMFEg.cjs} +1 -1
- package/dist/{chunk-XXDRQBXY-COtZ25Ez.js → chunk-XXDRQBXY-58rTAwvh.js} +1 -1
- package/dist/{chunk-XXDRQBXY-D1OixGzR.cjs → chunk-XXDRQBXY-CvhBfnFQ.cjs} +1 -1
- package/dist/{classDiagram-OUVF2IWQ-DDLmqaG6.cjs → classDiagram-OUVF2IWQ-C0S2HAJU.cjs} +1 -1
- package/dist/{classDiagram-v2-EOCWNBFH-Jc-IwOm0.js → classDiagram-OUVF2IWQ-hcuKRiyp.js} +2 -2
- package/dist/{classDiagram-v2-EOCWNBFH-DDLmqaG6.cjs → classDiagram-v2-EOCWNBFH-C0S2HAJU.cjs} +1 -1
- package/dist/{classDiagram-OUVF2IWQ-Jc-IwOm0.js → classDiagram-v2-EOCWNBFH-hcuKRiyp.js} +2 -2
- package/dist/components/HostedScrollArea.d.ts +15 -0
- package/dist/components/MarkdownViewer.d.ts +3 -1
- package/dist/components/embeds/LinkCard.d.ts +14 -3
- package/dist/components/mermaidInteraction.d.ts +1 -0
- package/dist/{cose-bilkent-JH36ORCC-DaucPocG.js → cose-bilkent-JH36ORCC-BwltbHKG.js} +5 -5
- package/dist/{cose-bilkent-JH36ORCC-OwiXHdQY.cjs → cose-bilkent-JH36ORCC-DVZVn03H.cjs} +1 -1
- package/dist/{cynefinDiagram-TSTJHNR4-Ag-HcuUm.cjs → cynefinDiagram-TSTJHNR4-DYCBxaEi.cjs} +1 -1
- package/dist/{cynefinDiagram-TSTJHNR4-Dkmz7gDw.js → cynefinDiagram-TSTJHNR4-ogTeIoNY.js} +28 -28
- package/dist/{dagre-VKFMJZFB-BHGdcjt3.js → dagre-VKFMJZFB-BfNdgMHQ.js} +9 -9
- package/dist/{dagre-VKFMJZFB-Q4CcAQ09.cjs → dagre-VKFMJZFB-DJW9o9XX.cjs} +1 -1
- package/dist/{diagram-FQU43EPY-jWCrN_AW.cjs → diagram-FQU43EPY-BRpNVpgn.cjs} +1 -1
- package/dist/{diagram-FQU43EPY-DBASKnKu.js → diagram-FQU43EPY-CJf3yD8h.js} +25 -25
- package/dist/{diagram-G47NLZAW-B4XMStX7.cjs → diagram-G47NLZAW-5rZfUeWV.cjs} +1 -1
- package/dist/{diagram-G47NLZAW-BY1mmnYA.js → diagram-G47NLZAW-D0-6oupP.js} +25 -25
- package/dist/{diagram-NH7WQ7WH-BXFvYRtm.js → diagram-NH7WQ7WH-BwrWWWZJ.js} +19 -19
- package/dist/{diagram-NH7WQ7WH-BS1eEa9R.cjs → diagram-NH7WQ7WH-g7m8p5fK.cjs} +1 -1
- package/dist/{diagram-OA4YK3LP-DgGrzezu.js → diagram-OA4YK3LP-BBqA1m8s.js} +13 -13
- package/dist/{diagram-OA4YK3LP-CTaL_2Nc.cjs → diagram-OA4YK3LP-BxP8KUna.cjs} +1 -1
- package/dist/{diagram-WEI45ONY-BHxWKH3v.js → diagram-WEI45ONY-CMexm2GN.js} +35 -35
- package/dist/{diagram-WEI45ONY-DX7BGSMI.cjs → diagram-WEI45ONY-DgJyq1w0.cjs} +1 -1
- package/dist/{ebnfDiagram-CCIWWBDH-BUK_anpV.js → ebnfDiagram-CCIWWBDH-DvLr_8nV.js} +3 -3
- package/dist/{ebnfDiagram-CCIWWBDH-BpDmVVJY.cjs → ebnfDiagram-CCIWWBDH-sfiWOXCW.cjs} +1 -1
- package/dist/embeds/linkCards.d.ts +32 -0
- package/dist/embeds/testing.cjs +1 -1
- package/dist/embeds/testing.js +1 -1
- package/dist/embeds.cjs +1 -1
- package/dist/embeds.d.ts +1 -1
- package/dist/embeds.js +53 -74
- package/dist/{erDiagram-Q63AITRT-Cd9H9BtP.cjs → erDiagram-Q63AITRT-B11THykZ.cjs} +1 -1
- package/dist/{erDiagram-Q63AITRT-Qb2bmkNp.js → erDiagram-Q63AITRT-D6U6Ng3Y.js} +4 -4
- package/dist/{extractHeadings-B2pUyEPa.js → extractHeadings-CdLPwHlC.js} +4882 -4827
- package/dist/extractHeadings-DRUBnhbi.cjs +311 -0
- package/dist/flowDiagram-23GEKE2U-CDscoQ9F.cjs +1 -0
- package/dist/flowDiagram-23GEKE2U-CLibi_u4.js +7 -0
- package/dist/{ganttDiagram-NO4QXBWP-C6-ExcDz.cjs → ganttDiagram-NO4QXBWP-BLlXK3zo.cjs} +1 -1
- package/dist/{ganttDiagram-NO4QXBWP-BVISsrzr.js → ganttDiagram-NO4QXBWP-CGCdgj0K.js} +2 -2
- package/dist/{gitGraphDiagram-IHSO6WYX-DLzPc702.cjs → gitGraphDiagram-IHSO6WYX-BHOyibqH.cjs} +1 -1
- package/dist/{gitGraphDiagram-IHSO6WYX-BDVA2TFP.js → gitGraphDiagram-IHSO6WYX-Bib3c0C6.js} +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.client.cjs +1 -1
- package/dist/index.client.d.ts +1 -0
- package/dist/index.client.js +33 -32
- package/dist/index.js +33 -32
- package/dist/index.server.cjs +1 -1
- package/dist/index.server.d.ts +1 -0
- package/dist/index.server.js +598 -151
- package/dist/{infoDiagram-FWYZ7A6U-D31UwqjR.js → infoDiagram-FWYZ7A6U-BUqDBIaP.js} +3 -3
- package/dist/{infoDiagram-FWYZ7A6U-DMF_wb2h.cjs → infoDiagram-FWYZ7A6U-BcDp6g1Y.cjs} +1 -1
- package/dist/{ishikawaDiagram-FXEZZL3T-DUlnwraq.cjs → ishikawaDiagram-FXEZZL3T-C3QHQ1ia.cjs} +1 -1
- package/dist/{ishikawaDiagram-FXEZZL3T-XA6-gyHY.js → ishikawaDiagram-FXEZZL3T-CcPh4nuP.js} +18 -18
- package/dist/{journeyDiagram-5HDEW3XC-CwQyFcYa.cjs → journeyDiagram-5HDEW3XC-B17v98Wb.cjs} +1 -1
- package/dist/{journeyDiagram-5HDEW3XC-B8sfsWpu.js → journeyDiagram-5HDEW3XC-MdxndgF1.js} +30 -30
- package/dist/{kanban-definition-HUTT4EX6-BjPlt2-E.cjs → kanban-definition-HUTT4EX6-BApVXeVQ.cjs} +1 -1
- package/dist/{kanban-definition-HUTT4EX6-FTrTBare.js → kanban-definition-HUTT4EX6-JhfZ6Qik.js} +120 -120
- package/dist/{linear-D3AJM3sY.cjs → linear-CIVwb13z.cjs} +1 -1
- package/dist/{linear-DI9P_z72.js → linear-dbOUbGpD.js} +8 -8
- package/dist/linkCardServer/addressGuard.server.d.ts +25 -0
- package/dist/linkCardServer/htmlEncoding.server.d.ts +6 -0
- package/dist/linkCardServer/linkCardHandler.server.d.ts +7 -0
- package/dist/linkCardServer/metadataCache.server.d.ts +5 -0
- package/dist/linkCardServer/pageFetch.server.d.ts +37 -0
- package/dist/linkCardServer/pageMetadata.server.d.ts +11 -0
- package/dist/linkCards-1JxY8wdm.js +48 -0
- package/dist/linkCards-Bjd_vW39.cjs +1 -0
- package/dist/markdown.css +1 -1
- package/dist/{mindmap-definition-LN4V7U3C-CxgWZidl.cjs → mindmap-definition-LN4V7U3C-BUbo0u-Y.cjs} +1 -1
- package/dist/{mindmap-definition-LN4V7U3C-YW4YcL9x.js → mindmap-definition-LN4V7U3C-gNTBga2z.js} +16 -16
- package/dist/{pegDiagram-2B236MQR-sJjLKeF3.js → pegDiagram-2B236MQR-BqjpbNkG.js} +3 -3
- package/dist/{pegDiagram-2B236MQR-CUo7q5bl.cjs → pegDiagram-2B236MQR-DZiQVxu1.cjs} +1 -1
- package/dist/{pieDiagram-ENE6RG2P-D4VanIOv.js → pieDiagram-ENE6RG2P-C1Gr48CK.js} +60 -60
- package/dist/{pieDiagram-ENE6RG2P-Cy_sUuLQ.cjs → pieDiagram-ENE6RG2P-D2nxDVFV.cjs} +1 -1
- package/dist/providers-BO7J62-7.cjs +1 -0
- package/dist/{providers-Drq7MT_K.js → providers-L5RM3KgR.js} +23 -23
- package/dist/{quadrantDiagram-ABIIQ3AL-D3c8xLpt.cjs → quadrantDiagram-ABIIQ3AL-C855tL3K.cjs} +1 -1
- package/dist/{quadrantDiagram-ABIIQ3AL-ubxphjb_.js → quadrantDiagram-ABIIQ3AL-DuD9ZdUQ.js} +18 -18
- package/dist/{railroadDiagram-RFXS5EU6-_Q4W5hB-.cjs → railroadDiagram-RFXS5EU6-BZsnhaQd.cjs} +1 -1
- package/dist/{railroadDiagram-RFXS5EU6-DvpD4C_A.js → railroadDiagram-RFXS5EU6-xx1d3Md8.js} +3 -3
- package/dist/{requirementDiagram-TGXJPOKE-Dk_6BuX9.js → requirementDiagram-TGXJPOKE-CCu1UYFH.js} +3 -3
- package/dist/{requirementDiagram-TGXJPOKE-DdYIO-wU.cjs → requirementDiagram-TGXJPOKE-D_NbFRkb.cjs} +1 -1
- package/dist/{sankeyDiagram-HTMAVEWB-zuYg6LTg.cjs → sankeyDiagram-HTMAVEWB-Dn2Ta-XX.cjs} +1 -1
- package/dist/{sankeyDiagram-HTMAVEWB-s3Kd7T8n.js → sankeyDiagram-HTMAVEWB-QGzXzczJ.js} +1 -1
- package/dist/{sequenceDiagram-DBY2YBRQ-BvNPCevg.cjs → sequenceDiagram-DBY2YBRQ-BA3Oc4pz.cjs} +1 -1
- package/dist/{sequenceDiagram-DBY2YBRQ-YQic4wxL.js → sequenceDiagram-DBY2YBRQ-CjnUnaw9.js} +3 -3
- package/dist/simple-logger-9yf7ypyB.cjs +1 -0
- package/dist/simple-logger-DwH1YQvq.js +103 -0
- package/dist/{sizeCapture-X5ZJPWSS-BqrdzzsI.cjs → sizeCapture-X5ZJPWSS-BPQhVBe0.cjs} +1 -1
- package/dist/{sizeCapture-X5ZJPWSS-qMsWGfjy.js → sizeCapture-X5ZJPWSS-nb9uU-BE.js} +1 -1
- package/dist/{stateDiagram-2N3HPSRC-D1Ub8LYq.js → stateDiagram-2N3HPSRC-Byg3E1AA.js} +11 -11
- package/dist/{stateDiagram-2N3HPSRC-Ds8f-scd.cjs → stateDiagram-2N3HPSRC-DSqLqSY5.cjs} +1 -1
- package/dist/{stateDiagram-v2-6OUMAXLB-PmrsPXuZ.cjs → stateDiagram-v2-6OUMAXLB-VRhXyf-C.cjs} +1 -1
- package/dist/{stateDiagram-v2-6OUMAXLB-DW8wjtk3.js → stateDiagram-v2-6OUMAXLB-hKcuYy9t.js} +2 -2
- package/dist/styles/markdown.css +1 -1
- package/dist/{swimlanes-5IMT3BWC-jZhcesRT.cjs → swimlanes-5IMT3BWC-CVnOKNcb.cjs} +1 -1
- package/dist/{swimlanes-5IMT3BWC-C8P8vU0w.js → swimlanes-5IMT3BWC-DyIDdThc.js} +3 -3
- package/dist/{swimlanesDiagram-G3AALYLV-B9FKeJRf.js → swimlanesDiagram-G3AALYLV-BF1ofRjP.js} +2 -2
- package/dist/{swimlanesDiagram-G3AALYLV-M5Cg2MHU.cjs → swimlanesDiagram-G3AALYLV-C3U5wLlX.cjs} +1 -1
- package/dist/{timeline-definition-FHXFAJF6-Ch-He--D.js → timeline-definition-FHXFAJF6-DBmE_qU3.js} +38 -38
- package/dist/{timeline-definition-FHXFAJF6-DZm1-KlQ.cjs → timeline-definition-FHXFAJF6-KUETCXLT.cjs} +1 -1
- package/dist/utils/simple-logger.d.ts +1 -0
- package/dist/{vennDiagram-L72KCM5P-CaoPscCM.js → vennDiagram-L72KCM5P-C6j4k5X-.js} +102 -102
- package/dist/{vennDiagram-L72KCM5P-mUSI238J.cjs → vennDiagram-L72KCM5P-DkSV3dIE.cjs} +1 -1
- package/dist/{wardleyDiagram-EHGQE667-CSAqF366.js → wardleyDiagram-EHGQE667-BaG6Cf_u.js} +18 -18
- package/dist/{wardleyDiagram-EHGQE667-CkKP97H-.cjs → wardleyDiagram-EHGQE667-uWMTMxL-.cjs} +1 -1
- package/dist/{xychartDiagram-FW5EYKEG-OEsTD_k4.js → xychartDiagram-FW5EYKEG-BPl5BnMB.js} +27 -27
- package/dist/{xychartDiagram-FW5EYKEG-BivGpkVk.cjs → xychartDiagram-FW5EYKEG-QAFE-xqg.cjs} +1 -1
- package/package.json +12 -8
- package/dist/arc-DzZml7Bc.js +0 -83
- package/dist/extractHeadings-DgefF9l1.cjs +0 -311
- package/dist/flowDiagram-23GEKE2U-BOmNlv7X.cjs +0 -1
- package/dist/flowDiagram-23GEKE2U-DMZnRz-6.js +0 -7
- package/dist/providers-Bxr2Wb-j.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const kt = (t, n) =>
|
|
1
|
+
import { bJ as Wt, z as Kt, A as Ht, a7 as Yt, a6 as Xt, G as Zt, J as Jt, _ as w, ag as wt, al as Qt, O as ot, a_ as $t, ay as te, az as ee, aA as ne, R as se, ac as ie, ai as oe, aj as re } from "./extractHeadings-CdLPwHlC.js";
|
|
2
|
+
const kt = (t, n) => Wt(t, "a", -n), _t = 1e-10;
|
|
3
3
|
function st(t, n) {
|
|
4
4
|
const s = le(t), e = s.filter((l) => ae(l, t));
|
|
5
5
|
let i = 0, o = 0;
|
|
@@ -133,7 +133,7 @@ function ft(t, n, s) {
|
|
|
133
133
|
for (let e = 0; e < n.length; ++e)
|
|
134
134
|
t[e] = n[e] * s;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function J(t, n, s, e, i) {
|
|
137
137
|
for (let o = 0; o < t.length; ++o)
|
|
138
138
|
t[o] = n * s[o] + e * i[o];
|
|
139
139
|
}
|
|
@@ -177,14 +177,14 @@ function zt(t, n, s) {
|
|
|
177
177
|
_[x] /= b;
|
|
178
178
|
}
|
|
179
179
|
const c = p[b];
|
|
180
|
-
if (
|
|
181
|
-
|
|
180
|
+
if (J(S, 1 + f, _, -f, c), S.fx = t(S), S.fx < p[0].fx)
|
|
181
|
+
J(m, 1 + u, _, -u, c), m.fx = t(m), m.fx < S.fx ? M(m) : M(S);
|
|
182
182
|
else if (S.fx >= p[b - 1].fx) {
|
|
183
183
|
let x = !1;
|
|
184
|
-
if (S.fx > c.fx ? (
|
|
184
|
+
if (S.fx > c.fx ? (J(g, 1 + a, _, -a, c), g.fx = t(g), g.fx < c.fx ? M(g) : x = !0) : (J(g, 1 - a * f, _, a * f, c), g.fx = t(g), g.fx < S.fx ? M(g) : x = !0), x) {
|
|
185
185
|
if (y >= 1) break;
|
|
186
186
|
for (let d = 1; d < p.length; ++d)
|
|
187
|
-
|
|
187
|
+
J(p[d], 1 - y, p[0], y, p[d]), p[d].fx = t(p[d]);
|
|
188
188
|
}
|
|
189
189
|
} else
|
|
190
190
|
M(S);
|
|
@@ -197,7 +197,7 @@ function ue(t, n, s, e, i, o, r) {
|
|
|
197
197
|
i = i || 1, o = o || 1e-6, r = r || 0.1;
|
|
198
198
|
function b(p, M, E) {
|
|
199
199
|
for (let _ = 0; _ < 16; ++_)
|
|
200
|
-
if (i = (p + M) / 2,
|
|
200
|
+
if (i = (p + M) / 2, J(e.x, 1, s.x, i, n), u = e.fx = t(e.x, e.fxprime), y = $(e.fxprime, n), u > l + o * i * f || u >= E)
|
|
201
201
|
M = i;
|
|
202
202
|
else {
|
|
203
203
|
if (Math.abs(y) <= -r * f)
|
|
@@ -207,7 +207,7 @@ function ue(t, n, s, e, i, o, r) {
|
|
|
207
207
|
return 0;
|
|
208
208
|
}
|
|
209
209
|
for (let p = 0; p < 10; ++p) {
|
|
210
|
-
if (
|
|
210
|
+
if (J(e.x, 1, s.x, i, n), u = e.fx = t(e.x, e.fxprime), y = $(e.fxprime, n), u > l + o * i * f || p && u >= a)
|
|
211
211
|
return b(h, i, a);
|
|
212
212
|
if (Math.abs(y) <= -r * f)
|
|
213
213
|
return i;
|
|
@@ -231,9 +231,9 @@ function fe(t, n, s) {
|
|
|
231
231
|
}), !f)
|
|
232
232
|
ft(r, e.fxprime, -1);
|
|
233
233
|
else {
|
|
234
|
-
|
|
234
|
+
J(o, 1, i.fxprime, -1, e.fxprime);
|
|
235
235
|
const y = $(e.fxprime, e.fxprime), h = Math.max(0, $(o, i.fxprime) / y);
|
|
236
|
-
|
|
236
|
+
J(r, h, r, -1, i.fxprime), l = e, e = i, i = l;
|
|
237
237
|
}
|
|
238
238
|
if (ut(e.fxprime) <= 1e-5)
|
|
239
239
|
break;
|
|
@@ -530,7 +530,7 @@ function dt(t) {
|
|
|
530
530
|
}
|
|
531
531
|
function Dt(t, n, s) {
|
|
532
532
|
n == null && (n = Math.PI / 2);
|
|
533
|
-
let e =
|
|
533
|
+
let e = jt(t).map((u) => Object.assign({}, u));
|
|
534
534
|
const i = be(e);
|
|
535
535
|
for (const u of i) {
|
|
536
536
|
me(u, n, s);
|
|
@@ -565,10 +565,10 @@ function Dt(t, n, s) {
|
|
|
565
565
|
let f = 1;
|
|
566
566
|
for (; f < i.length; )
|
|
567
567
|
l(i[f], !0, !1), l(i[f + 1], !1, !0), l(i[f + 2], !0, !0), f += 3, o = dt(e);
|
|
568
|
-
return
|
|
568
|
+
return Nt(e);
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
const o =
|
|
570
|
+
function Ot(t, n, s, e, i) {
|
|
571
|
+
const o = jt(t);
|
|
572
572
|
n -= 2 * e, s -= 2 * e;
|
|
573
573
|
const { xRange: r, yRange: l } = dt(o);
|
|
574
574
|
if (r.max === r.min || l.max === l.min)
|
|
@@ -580,7 +580,7 @@ function Nt(t, n, s, e, i) {
|
|
|
580
580
|
} else
|
|
581
581
|
f = n / (r.max - r.min), u = s / (l.max - l.min);
|
|
582
582
|
const a = Math.min(u, f), y = (n - (r.max - r.min) * a) / 2, h = (s - (l.max - l.min) * a) / 2;
|
|
583
|
-
return
|
|
583
|
+
return Nt(
|
|
584
584
|
o.map((b) => ({
|
|
585
585
|
radius: a * b.radius,
|
|
586
586
|
x: e + y + (b.x - r.min) * a,
|
|
@@ -589,13 +589,13 @@ function Nt(t, n, s, e, i) {
|
|
|
589
589
|
}))
|
|
590
590
|
);
|
|
591
591
|
}
|
|
592
|
-
function
|
|
592
|
+
function Nt(t) {
|
|
593
593
|
const n = {};
|
|
594
594
|
for (const s of t)
|
|
595
595
|
n[s.setid] = s;
|
|
596
596
|
return n;
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function jt(t) {
|
|
599
599
|
return Object.keys(t).map((s) => Object.assign(t[s], { setid: s }));
|
|
600
600
|
}
|
|
601
601
|
function ve(t = {}) {
|
|
@@ -621,11 +621,11 @@ function ve(t = {}) {
|
|
|
621
621
|
const C = /* @__PURE__ */ new Set();
|
|
622
622
|
d.forEach((k) => {
|
|
623
623
|
k.size == 0 && k.sets.length == 1 && C.add(k.sets[0]);
|
|
624
|
-
}), d = d.filter((k) => !k.sets.some((
|
|
624
|
+
}), d = d.filter((k) => !k.sets.some((j) => C.has(j)));
|
|
625
625
|
let I = {}, D = {};
|
|
626
626
|
if (d.length > 0) {
|
|
627
627
|
let k = m(d, { lossFunction: v, distinct: b });
|
|
628
|
-
l && (k = Dt(k, r, h)), I =
|
|
628
|
+
l && (k = Dt(k, r, h)), I = Ot(k, s, e, i, f), D = Lt(I, d, M);
|
|
629
629
|
}
|
|
630
630
|
const U = {};
|
|
631
631
|
d.forEach((k) => {
|
|
@@ -638,43 +638,43 @@ function ve(t = {}) {
|
|
|
638
638
|
return "" + k.sets[0];
|
|
639
639
|
}
|
|
640
640
|
x.selectAll("svg").data([I]).enter().append("svg");
|
|
641
|
-
const
|
|
642
|
-
n ?
|
|
641
|
+
const N = x.select("svg");
|
|
642
|
+
n ? N.attr("viewBox", `0 0 ${s} ${e}`) : N.attr("width", s).attr("height", e);
|
|
643
643
|
const R = {};
|
|
644
644
|
let T = !1;
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
k.sets.length == 1 &&
|
|
645
|
+
N.selectAll(".venn-area path").each(function(k) {
|
|
646
|
+
const j = this.getAttribute("d");
|
|
647
|
+
k.sets.length == 1 && j && !b && (T = !0, R[k.sets[0]] = Me(j));
|
|
648
648
|
});
|
|
649
649
|
function A(k) {
|
|
650
|
-
return (
|
|
650
|
+
return (j) => {
|
|
651
651
|
const H = k.sets.map((et) => {
|
|
652
652
|
let Y = R[et], Z = I[et];
|
|
653
653
|
return Y || (Y = { x: s / 2, y: e / 2, radius: 1 }), Z || (Z = { x: s / 2, y: e / 2, radius: 1 }), {
|
|
654
|
-
x: Y.x * (1 -
|
|
655
|
-
y: Y.y * (1 -
|
|
656
|
-
radius: Y.radius * (1 -
|
|
654
|
+
x: Y.x * (1 - j) + Z.x * j,
|
|
655
|
+
y: Y.y * (1 - j) + Z.y * j,
|
|
656
|
+
radius: Y.radius * (1 - j) + Z.radius * j
|
|
657
657
|
};
|
|
658
658
|
});
|
|
659
659
|
return St(H, p);
|
|
660
660
|
};
|
|
661
661
|
}
|
|
662
|
-
const G =
|
|
662
|
+
const G = N.selectAll(".venn-area").data(d, (k) => k.sets), P = G.enter().append("g").attr(
|
|
663
663
|
"class",
|
|
664
664
|
(k) => `venn-area venn-${k.sets.length == 1 ? "circle" : "intersection"}${k.colour || k.color ? " venn-coloured" : ""}`
|
|
665
665
|
).attr("data-venn-sets", (k) => k.sets.join("_")), B = P.append("path"), L = P.append("text").attr("class", "label").text((k) => V(k)).attr("text-anchor", "middle").attr("dy", ".35em").attr("x", s / 2).attr("y", e / 2);
|
|
666
666
|
a && (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"), L.style("fill", (k) => k.colour || k.color ? "#FFF" : t.textFill ? t.textFill : k.sets.length == 1 ? g(k.sets) : "#444"));
|
|
667
|
-
function
|
|
667
|
+
function K(k) {
|
|
668
668
|
return typeof k.transition == "function" ? k.transition("venn").duration(o) : k;
|
|
669
669
|
}
|
|
670
670
|
let z = x;
|
|
671
|
-
T && typeof z.transition == "function" ? (z =
|
|
672
|
-
const
|
|
673
|
-
u && (T ? "on" in
|
|
674
|
-
const
|
|
675
|
-
typeof G.transition == "function" &&
|
|
676
|
-
const X =
|
|
677
|
-
return y !== null && (L.style("font-size", "0px"),
|
|
671
|
+
T && typeof z.transition == "function" ? (z = K(x), z.selectAll("path").attrTween("d", A)) : z.selectAll("path").attr("d", (k) => St(k.sets.map((j) => I[j])), p);
|
|
672
|
+
const O = z.selectAll("text").filter((k) => k.sets in D).text((k) => V(k)).attr("x", (k) => Math.floor(D[k.sets].x)).attr("y", (k) => Math.floor(D[k.sets].y));
|
|
673
|
+
u && (T ? "on" in O ? O.on("end", rt(I, V)) : O.each("end", rt(I, V)) : O.each(rt(I, V)));
|
|
674
|
+
const F = K(G.exit()).remove();
|
|
675
|
+
typeof G.transition == "function" && F.selectAll("path").attrTween("d", A);
|
|
676
|
+
const X = F.selectAll("text").attr("x", s / 2).attr("y", e / 2);
|
|
677
|
+
return y !== null && (L.style("font-size", "0px"), O.style("font-size", y), X.style("font-size", "0px")), { circles: I, textCentres: D, nodes: G, enter: P, update: z, exit: F };
|
|
678
678
|
}
|
|
679
679
|
return c.wrap = function(x) {
|
|
680
680
|
return arguments.length ? (u = x, c) : u;
|
|
@@ -749,7 +749,7 @@ function at(t, n, s) {
|
|
|
749
749
|
}
|
|
750
750
|
return e;
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function Ft(t, n, s) {
|
|
753
753
|
const e = [];
|
|
754
754
|
for (const a of t)
|
|
755
755
|
e.push({ x: a.x, y: a.y }), e.push({ x: a.x + a.radius / 2, y: a.y }), e.push({ x: a.x - a.radius / 2, y: a.y }), e.push({ x: a.x, y: a.y + a.radius / 2 }), e.push({ x: a.x, y: a.y - a.radius / 2 });
|
|
@@ -779,7 +779,7 @@ function jt(t, n, s) {
|
|
|
779
779
|
if (t.length == 1)
|
|
780
780
|
return { x: t[0].x, y: t[0].y };
|
|
781
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 ?
|
|
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 ? Ft(t, []) : Et(u.arcs.map((a) => a.p1));
|
|
783
783
|
}
|
|
784
784
|
function Ie(t) {
|
|
785
785
|
const n = {}, s = Object.keys(t);
|
|
@@ -807,7 +807,7 @@ function Lt(t, n, s) {
|
|
|
807
807
|
const u = [], a = [];
|
|
808
808
|
for (let h in t)
|
|
809
809
|
h in l ? u.push(t[h]) : h in f || a.push(t[h]);
|
|
810
|
-
const y =
|
|
810
|
+
const y = Ft(u, a, s);
|
|
811
811
|
e[r] = y, y.disjoint && n[o].size > 0 && console.log("WARNING: area " + r + " not represented on screen");
|
|
812
812
|
}
|
|
813
813
|
return e;
|
|
@@ -870,7 +870,7 @@ function Se(t, n = {}) {
|
|
|
870
870
|
distinct: h
|
|
871
871
|
});
|
|
872
872
|
i && (p = Dt(p, o, r));
|
|
873
|
-
const M =
|
|
873
|
+
const M = Ot(p, l, f, u, a), E = Lt(M, t, y), _ = new Map(
|
|
874
874
|
Object.keys(M).map((m) => [
|
|
875
875
|
m,
|
|
876
876
|
{
|
|
@@ -1033,7 +1033,7 @@ var gt = (function() {
|
|
|
1033
1033
|
}
|
|
1034
1034
|
}, "parseError"),
|
|
1035
1035
|
parse: /* @__PURE__ */ w(function(g) {
|
|
1036
|
-
var m = this, v = [0], c = [], x = [null], d = [], C = this.table, I = "", D = 0, U = 0, V = 2,
|
|
1036
|
+
var m = this, v = [0], c = [], x = [null], d = [], C = this.table, I = "", D = 0, U = 0, V = 2, N = 1, R = d.slice.call(arguments, 1), T = Object.create(this.lexer), A = { yy: {} };
|
|
1037
1037
|
for (var G in this.yy)
|
|
1038
1038
|
Object.prototype.hasOwnProperty.call(this.yy, G) && (A.yy[G] = this.yy[G]);
|
|
1039
1039
|
T.setInput(g, A.yy), A.yy.lexer = T, A.yy.parser = this, typeof T.yylloc > "u" && (T.yylloc = {});
|
|
@@ -1041,24 +1041,24 @@ var gt = (function() {
|
|
|
1041
1041
|
d.push(P);
|
|
1042
1042
|
var B = T.options && T.options.ranges;
|
|
1043
1043
|
typeof A.yy.parseError == "function" ? this.parseError = A.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
|
|
1044
|
-
function L(
|
|
1045
|
-
v.length = v.length - 2 *
|
|
1044
|
+
function L(W) {
|
|
1045
|
+
v.length = v.length - 2 * W, x.length = x.length - W, d.length = d.length - W;
|
|
1046
1046
|
}
|
|
1047
1047
|
w(L, "popStack");
|
|
1048
|
-
function
|
|
1049
|
-
var
|
|
1050
|
-
return
|
|
1048
|
+
function K() {
|
|
1049
|
+
var W;
|
|
1050
|
+
return W = c.pop() || T.lex() || N, typeof W != "number" && (W instanceof Array && (c = W, W = c.pop()), W = m.symbols_[W] || W), W;
|
|
1051
1051
|
}
|
|
1052
|
-
w(
|
|
1053
|
-
for (var z,
|
|
1054
|
-
if (
|
|
1052
|
+
w(K, "lex");
|
|
1053
|
+
for (var z, O, F, X, k = {}, j, H, et, Y; ; ) {
|
|
1054
|
+
if (O = v[v.length - 1], this.defaultActions[O] ? F = this.defaultActions[O] : ((z === null || typeof z > "u") && (z = K()), F = C[O] && C[O][z]), typeof F > "u" || !F.length || !F[0]) {
|
|
1055
1055
|
var Z = "";
|
|
1056
1056
|
Y = [];
|
|
1057
|
-
for (
|
|
1058
|
-
this.terminals_[
|
|
1057
|
+
for (j in C[O])
|
|
1058
|
+
this.terminals_[j] && j > V && Y.push("'" + this.terminals_[j] + "'");
|
|
1059
1059
|
T.showPosition ? Z = "Parse error on line " + (D + 1) + `:
|
|
1060
1060
|
` + T.showPosition() + `
|
|
1061
|
-
Expecting ` + Y.join(", ") + ", got '" + (this.terminals_[z] || z) + "'" : Z = "Parse error on line " + (D + 1) + ": Unexpected " + (z ==
|
|
1061
|
+
Expecting ` + Y.join(", ") + ", got '" + (this.terminals_[z] || z) + "'" : Z = "Parse error on line " + (D + 1) + ": Unexpected " + (z == N ? "end of input" : "'" + (this.terminals_[z] || z) + "'"), this.parseError(Z, {
|
|
1062
1062
|
text: T.match,
|
|
1063
1063
|
token: this.terminals_[z] || z,
|
|
1064
1064
|
line: T.yylineno,
|
|
@@ -1066,14 +1066,14 @@ Expecting ` + Y.join(", ") + ", got '" + (this.terminals_[z] || z) + "'" : Z = "
|
|
|
1066
1066
|
expected: Y
|
|
1067
1067
|
});
|
|
1068
1068
|
}
|
|
1069
|
-
if (
|
|
1070
|
-
throw new Error("Parse Error: multiple actions possible at state: " +
|
|
1071
|
-
switch (
|
|
1069
|
+
if (F[0] instanceof Array && F.length > 1)
|
|
1070
|
+
throw new Error("Parse Error: multiple actions possible at state: " + O + ", token: " + z);
|
|
1071
|
+
switch (F[0]) {
|
|
1072
1072
|
case 1:
|
|
1073
|
-
v.push(z), x.push(T.yytext), d.push(T.yylloc), v.push(
|
|
1073
|
+
v.push(z), x.push(T.yytext), d.push(T.yylloc), v.push(F[1]), z = null, U = T.yyleng, I = T.yytext, D = T.yylineno, P = T.yylloc;
|
|
1074
1074
|
break;
|
|
1075
1075
|
case 2:
|
|
1076
|
-
if (H = this.productions_[
|
|
1076
|
+
if (H = this.productions_[F[1]][1], k.$ = x[x.length - H], k._$ = {
|
|
1077
1077
|
first_line: d[d.length - (H || 1)].first_line,
|
|
1078
1078
|
last_line: d[d.length - 1].last_line,
|
|
1079
1079
|
first_column: d[d.length - (H || 1)].first_column,
|
|
@@ -1086,12 +1086,12 @@ Expecting ` + Y.join(", ") + ", got '" + (this.terminals_[z] || z) + "'" : Z = "
|
|
|
1086
1086
|
U,
|
|
1087
1087
|
D,
|
|
1088
1088
|
A.yy,
|
|
1089
|
-
|
|
1089
|
+
F[1],
|
|
1090
1090
|
x,
|
|
1091
1091
|
d
|
|
1092
1092
|
].concat(R)), typeof X < "u")
|
|
1093
1093
|
return X;
|
|
1094
|
-
H && (v = v.slice(0, -1 * H * 2), x = x.slice(0, -1 * H), d = d.slice(0, -1 * H)), v.push(this.productions_[
|
|
1094
|
+
H && (v = v.slice(0, -1 * H * 2), x = x.slice(0, -1 * H), d = d.slice(0, -1 * H)), v.push(this.productions_[F[1]][0]), x.push(k.$), d.push(k._$), et = C[v[v.length - 2]][v[v.length - 1]], v.push(et);
|
|
1095
1095
|
break;
|
|
1096
1096
|
case 3:
|
|
1097
1097
|
return !0;
|
|
@@ -1370,11 +1370,11 @@ var we = gt, yt = [], pt = [], mt = [], bt = /* @__PURE__ */ new Set(), vt, It =
|
|
|
1370
1370
|
const s = it(t).filter((e) => !bt.has(e));
|
|
1371
1371
|
if (s.length > 0)
|
|
1372
1372
|
throw new Error(`unknown set identifier: ${s.join(", ")}`);
|
|
1373
|
-
}, "validateUnionIdentifiers"), De = /* @__PURE__ */ w(() => pt, "getTextData"),
|
|
1373
|
+
}, "validateUnionIdentifiers"), De = /* @__PURE__ */ w(() => pt, "getTextData"), Oe = /* @__PURE__ */ w(() => vt, "getCurrentSets"), Ne = /* @__PURE__ */ w(() => It, "getIndentMode"), je = /* @__PURE__ */ w((t) => {
|
|
1374
1374
|
It = t;
|
|
1375
|
-
}, "setIndentMode"),
|
|
1375
|
+
}, "setIndentMode"), Fe = re.venn;
|
|
1376
1376
|
function Vt() {
|
|
1377
|
-
return oe(
|
|
1377
|
+
return oe(Fe, wt().venn);
|
|
1378
1378
|
}
|
|
1379
1379
|
w(Vt, "getConfig");
|
|
1380
1380
|
var Le = /* @__PURE__ */ w(() => {
|
|
@@ -1382,12 +1382,12 @@ var Le = /* @__PURE__ */ w(() => {
|
|
|
1382
1382
|
}, "customClear"), Pe = {
|
|
1383
1383
|
getConfig: Vt,
|
|
1384
1384
|
clear: Le,
|
|
1385
|
-
setAccTitle:
|
|
1385
|
+
setAccTitle: Jt,
|
|
1386
1386
|
getAccTitle: Zt,
|
|
1387
1387
|
setDiagramTitle: Xt,
|
|
1388
1388
|
getDiagramTitle: Yt,
|
|
1389
1389
|
getAccDescription: Ht,
|
|
1390
|
-
setAccDescription:
|
|
1390
|
+
setAccDescription: Kt,
|
|
1391
1391
|
addSubsetData: _e,
|
|
1392
1392
|
getSubsetData: Te,
|
|
1393
1393
|
addTextData: ze,
|
|
@@ -1395,9 +1395,9 @@ var Le = /* @__PURE__ */ w(() => {
|
|
|
1395
1395
|
validateUnionIdentifiers: Ce,
|
|
1396
1396
|
getTextData: De,
|
|
1397
1397
|
getStyleData: Re,
|
|
1398
|
-
getCurrentSets:
|
|
1399
|
-
getIndentMode:
|
|
1400
|
-
setIndentMode:
|
|
1398
|
+
getCurrentSets: Oe,
|
|
1399
|
+
getIndentMode: Ne,
|
|
1400
|
+
setIndentMode: je
|
|
1401
1401
|
}, Be = /* @__PURE__ */ w((t) => `
|
|
1402
1402
|
.venn-title {
|
|
1403
1403
|
font-size: 32px;
|
|
@@ -1440,7 +1440,7 @@ var qe = /* @__PURE__ */ w((t, n, s, e) => {
|
|
|
1440
1440
|
r.venn6,
|
|
1441
1441
|
r.venn7,
|
|
1442
1442
|
r.venn8
|
|
1443
|
-
].filter(Boolean), y = i.getDiagramTitle?.(), h = i.getSubsetData(), b = i.getTextData(), p = qt(i.getStyleData()), M = Gt(h), E = o?.width ?? 800, _ = o?.height ?? 450, g = E / 1600, m = y ? 48 * g : 0, v = r.primaryTextColor ?? r.textColor, c =
|
|
1443
|
+
].filter(Boolean), y = i.getDiagramTitle?.(), h = i.getSubsetData(), b = i.getTextData(), p = qt(i.getStyleData()), M = Gt(h), E = o?.width ?? 800, _ = o?.height ?? 450, g = E / 1600, m = y ? 48 * g : 0, v = r.primaryTextColor ?? r.textColor, c = Qt(n);
|
|
1444
1444
|
c.attr("viewBox", `0 0 ${E} ${_}`), y && c.append("text").text(y).attr("class", "venn-title").attr("font-size", `${32 * g}px`).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("x", "50%").attr("y", 32 * g).style("fill", r.vennTitleTextColor || r.titleColor);
|
|
1445
1445
|
const x = ot(document.createElement("div")), d = ve().width(E).height(_ - m);
|
|
1446
1446
|
x.datum(M).call(d);
|
|
@@ -1450,19 +1450,19 @@ var qe = /* @__PURE__ */ w((t, n, s, e) => {
|
|
|
1450
1450
|
padding: o?.padding ?? 15
|
|
1451
1451
|
}), D = /* @__PURE__ */ new Map();
|
|
1452
1452
|
for (const R of I) {
|
|
1453
|
-
const T =
|
|
1453
|
+
const T = Q([...R.data.sets].sort());
|
|
1454
1454
|
D.set(T, R);
|
|
1455
1455
|
}
|
|
1456
1456
|
b.length > 0 && Ut(o, D, x, b, g, p);
|
|
1457
1457
|
const U = te(r.background || "#f4f4f4");
|
|
1458
1458
|
x.selectAll(".venn-circle").each(function(R, T) {
|
|
1459
|
-
const A = ot(this), P =
|
|
1459
|
+
const A = ot(this), P = Q([...R.sets].sort()), B = p.get(P), L = B?.fill || a[T % a.length] || r.primaryColor;
|
|
1460
1460
|
A.classed(`venn-set-${T % 8}`, !0);
|
|
1461
|
-
const
|
|
1461
|
+
const K = B?.["fill-opacity"] ?? 0.1, z = B?.stroke || L, O = B?.["stroke-width"] || `${5 * g}`;
|
|
1462
1462
|
if (u && C) {
|
|
1463
1463
|
const X = D.get(P);
|
|
1464
1464
|
if (X && X.circles.length > 0) {
|
|
1465
|
-
const k = X.circles[0],
|
|
1465
|
+
const k = X.circles[0], j = C.circle(k.x, k.y, k.radius * 2, {
|
|
1466
1466
|
roughness: 0.7,
|
|
1467
1467
|
seed: f,
|
|
1468
1468
|
fill: kt(L, 0.7),
|
|
@@ -1471,20 +1471,20 @@ var qe = /* @__PURE__ */ w((t, n, s, e) => {
|
|
|
1471
1471
|
hachureGap: 8,
|
|
1472
1472
|
hachureAngle: -41 + T * 60,
|
|
1473
1473
|
stroke: z,
|
|
1474
|
-
strokeWidth: parseFloat(String(
|
|
1474
|
+
strokeWidth: parseFloat(String(O))
|
|
1475
1475
|
});
|
|
1476
|
-
A.select("path").remove(), A.node()?.insertBefore(
|
|
1476
|
+
A.select("path").remove(), A.node()?.insertBefore(j, A.select("text").node());
|
|
1477
1477
|
}
|
|
1478
1478
|
} else
|
|
1479
|
-
A.select("path").style("fill", L).style("fill-opacity",
|
|
1480
|
-
const
|
|
1481
|
-
A.select("text").style("font-size", `${48 * g}px`).style("fill",
|
|
1479
|
+
A.select("path").style("fill", L).style("fill-opacity", K).style("stroke", z).style("stroke-width", O).style("stroke-opacity", 0.95);
|
|
1480
|
+
const F = B?.color || (U ? ee(L, 30) : ne(L, 30));
|
|
1481
|
+
A.select("text").style("font-size", `${48 * g}px`).style("fill", F);
|
|
1482
1482
|
}), u && C ? x.selectAll(".venn-intersection").each(function(R) {
|
|
1483
|
-
const T = ot(this), G =
|
|
1483
|
+
const T = ot(this), G = Q([...R.sets].sort()), P = p.get(G), B = P?.fill;
|
|
1484
1484
|
if (B) {
|
|
1485
|
-
const L = T.select("path"),
|
|
1486
|
-
if (
|
|
1487
|
-
const z = C.path(
|
|
1485
|
+
const L = T.select("path"), K = L.attr("d");
|
|
1486
|
+
if (K) {
|
|
1487
|
+
const z = C.path(K, {
|
|
1488
1488
|
roughness: 0.7,
|
|
1489
1489
|
seed: f,
|
|
1490
1490
|
fill: kt(B, 0.3),
|
|
@@ -1493,55 +1493,55 @@ var qe = /* @__PURE__ */ w((t, n, s, e) => {
|
|
|
1493
1493
|
hachureGap: 6,
|
|
1494
1494
|
hachureAngle: 60,
|
|
1495
1495
|
stroke: "none"
|
|
1496
|
-
}),
|
|
1497
|
-
|
|
1496
|
+
}), O = L.node();
|
|
1497
|
+
O?.parentNode?.insertBefore(z, O), L.remove();
|
|
1498
1498
|
}
|
|
1499
1499
|
} else
|
|
1500
1500
|
T.select("path").style("fill-opacity", 0);
|
|
1501
1501
|
T.select("text").style("font-size", `${48 * g}px`).style("fill", P?.color ?? r.vennSetTextColor ?? v);
|
|
1502
1502
|
}) : (x.selectAll(".venn-intersection text").style("font-size", `${48 * g}px`).style("fill", (R) => {
|
|
1503
|
-
const A =
|
|
1503
|
+
const A = Q([...R.sets].sort());
|
|
1504
1504
|
return p.get(A)?.color ?? r.vennSetTextColor ?? v;
|
|
1505
1505
|
}), x.selectAll(".venn-intersection path").style("fill-opacity", (R) => {
|
|
1506
|
-
const A =
|
|
1506
|
+
const A = Q([...R.sets].sort());
|
|
1507
1507
|
return p.get(A)?.fill ? 1 : 0;
|
|
1508
1508
|
}).style("fill", (R) => {
|
|
1509
|
-
const A =
|
|
1509
|
+
const A = Q([...R.sets].sort());
|
|
1510
1510
|
return p.get(A)?.fill ?? "transparent";
|
|
1511
1511
|
}));
|
|
1512
|
-
const V = c.append("g").attr("transform", `translate(0, ${m})`),
|
|
1513
|
-
if (
|
|
1514
|
-
for (const R of [...
|
|
1512
|
+
const V = c.append("g").attr("transform", `translate(0, ${m})`), N = x.select("svg").node();
|
|
1513
|
+
if (N && "childNodes" in N)
|
|
1514
|
+
for (const R of [...N.childNodes])
|
|
1515
1515
|
V.node()?.appendChild(R);
|
|
1516
1516
|
se(c, _, E, o?.useMaxWidth ?? !0);
|
|
1517
1517
|
}, "draw");
|
|
1518
|
-
function
|
|
1518
|
+
function Q(t) {
|
|
1519
1519
|
return t.join("|");
|
|
1520
1520
|
}
|
|
1521
|
-
w(
|
|
1521
|
+
w(Q, "stableSetsKey");
|
|
1522
1522
|
function Ut(t, n, s, e, i, o) {
|
|
1523
1523
|
const r = t?.useDebugLayout ?? !1, f = s.select("svg").append("g").attr("class", "venn-text-nodes"), u = /* @__PURE__ */ new Map();
|
|
1524
1524
|
for (const a of e) {
|
|
1525
|
-
const y =
|
|
1525
|
+
const y = Q(a.sets), h = u.get(y);
|
|
1526
1526
|
h ? h.push(a) : u.set(y, [a]);
|
|
1527
1527
|
}
|
|
1528
1528
|
for (const [a, y] of u.entries()) {
|
|
1529
1529
|
const h = n.get(a);
|
|
1530
1530
|
if (!h?.text)
|
|
1531
1531
|
continue;
|
|
1532
|
-
const b = h.text.x, p = h.text.y, M = Math.min(...h.circles.map((
|
|
1533
|
-
...h.circles.map((
|
|
1532
|
+
const b = h.text.x, p = h.text.y, M = Math.min(...h.circles.map((N) => N.radius)), E = Math.min(
|
|
1533
|
+
...h.circles.map((N) => N.radius - Math.hypot(b - N.x, p - N.y))
|
|
1534
1534
|
);
|
|
1535
1535
|
let _ = Number.isFinite(E) ? Math.max(0, E) : 0;
|
|
1536
1536
|
_ === 0 && Number.isFinite(M) && (_ = M * 0.6);
|
|
1537
1537
|
const S = f.append("g").attr("class", "venn-text-area").attr("font-size", `${40 * i}px`);
|
|
1538
1538
|
r && S.append("circle").attr("class", "venn-text-debug-circle").attr("cx", b).attr("cy", p).attr("r", _).attr("fill", "none").attr("stroke", "purple").attr("stroke-width", 1.5 * i).attr("stroke-dasharray", `${6 * i} ${4 * i}`);
|
|
1539
1539
|
const g = Math.max(80 * i, _ * 2 * 0.95), m = Math.max(60 * i, _ * 2 * 0.95), x = (h.data.label && h.data.label.length > 0 ? Math.min(32 * i, _ * 0.25) : 0) + (y.length <= 2 ? 30 * i : 0), d = b - g / 2, C = p - m / 2 + x, I = Math.max(1, Math.ceil(Math.sqrt(y.length))), D = Math.max(1, Math.ceil(y.length / I)), U = g / I, V = m / D;
|
|
1540
|
-
for (const [
|
|
1541
|
-
const T =
|
|
1540
|
+
for (const [N, R] of y.entries()) {
|
|
1541
|
+
const T = N % I, A = Math.floor(N / I), G = d + U * (T + 0.5), P = C + V * (A + 0.5);
|
|
1542
1542
|
r && S.append("rect").attr("class", "venn-text-debug-cell").attr("x", d + U * T).attr("y", C + V * A).attr("width", U).attr("height", V).attr("fill", "none").attr("stroke", "teal").attr("stroke-width", 1 * i).attr("stroke-dasharray", `${4 * i} ${3 * i}`);
|
|
1543
|
-
const B = U * 0.9, L = V * 0.9,
|
|
1544
|
-
z &&
|
|
1543
|
+
const B = U * 0.9, L = V * 0.9, K = S.append("foreignObject").attr("class", "venn-text-node-fo").attr("width", B).attr("height", L).attr("x", G - B / 2).attr("y", P - L / 2).attr("overflow", "visible"), z = o.get(R.id)?.color, O = 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(R.label ?? R.id);
|
|
1544
|
+
z && O.style("color", z);
|
|
1545
1545
|
}
|
|
1546
1546
|
}
|
|
1547
1547
|
}
|
|
@@ -1567,12 +1567,12 @@ function Gt(t) {
|
|
|
1567
1567
|
return e.length > 0 ? [...t, ...e] : t;
|
|
1568
1568
|
}
|
|
1569
1569
|
w(Gt, "ensurePairwiseSubsets");
|
|
1570
|
-
var Ue = { draw: qe },
|
|
1570
|
+
var Ue = { draw: qe }, We = {
|
|
1571
1571
|
parser: we,
|
|
1572
1572
|
db: Pe,
|
|
1573
1573
|
renderer: Ue,
|
|
1574
1574
|
styles: Ve
|
|
1575
1575
|
};
|
|
1576
1576
|
export {
|
|
1577
|
-
|
|
1577
|
+
We as diagram
|
|
1578
1578
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./extractHeadings-DgefF9l1.cjs"),vt=(t,n)=>k.adjustChannel(t,"a",-n),Mt=1e-10;function st(t,n){const s=Gt(t),e=s.filter(l=>Ut(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=wt(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];o+=(f.x+a.x)*(a.y-f.y);const x={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let h=null;for(let b=0;b<a.parentIndex.length;++b)if(f.parentIndex.includes(a.parentIndex[b])){const p=t[a.parentIndex[b]],M=Math.atan2(a.x-p.x,a.y-p.y),E=Math.atan2(f.x-p.x,f.y-p.y);let w=E-M;w<0&&(w+=2*Math.PI);const S=E-w/2;let g=q(x,{x:p.x+p.radius*Math.sin(S),y:p.y+p.radius*Math.cos(S)});g>p.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=at(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(q(t[u],l)>Math.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-Mt,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function Ut(t,n){return n.every(s=>q(t,s)<s.radius+Mt)}function Gt(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=St(t[s],t[e]);for(const o of i)o.parentIndex=[s,e],n.push(o)}return n}function at(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function q(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function gt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return at(t,e)+at(n,i)}function St(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function wt(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function Wt(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,x=t(a);if(x*r>=0&&(n=a),Math.abs(f)<o||x===0)return a}return n+f}function lt(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function It(t,n){return lt(t).map(()=>lt(n))}function $(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ct(t){return Math.sqrt($(t,t))}function ut(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function J(t,n,s,e,i){for(let o=0;o<t.length;++o)t[o]=n*s[o]+e*i[o]}function Tt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,o=s.zeroDelta||.001,r=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,x=s.sigma!==void 0?s.sigma:.5;let h;const b=n.length,p=new Array(b+1);p[0]=n,p[0].fx=t(n),p[0].id=0;for(let _=0;_<b;++_){const c=n.slice();c[_]=c[_]?c[_]*i:o,p[_+1]=c,p[_+1].fx=t(c),p[_+1].id=_+1}function M(_){for(let c=0;c<_.length;c++)p[b][c]=_[c];p[b].fx=_.fx}const E=(_,c)=>_.fx-c.fx,w=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let _=0;_<e;++_){if(p.sort(E),s.history){const y=p.map(d=>{const R=d.slice();return R.fx=d.fx,R.id=d.id,R});y.sort((d,R)=>d.id-R.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:y})}h=0;for(let y=0;y<b;++y)h=Math.max(h,Math.abs(p[0][y]-p[1][y]));if(Math.abs(p[0].fx-p[b].fx)<r&&h<l)break;for(let y=0;y<b;++y){w[y]=0;for(let d=0;d<b;++d)w[y]+=p[d][y];w[y]/=b}const c=p[b];if(J(S,1+f,w,-f,c),S.fx=t(S),S.fx<p[0].fx)J(m,1+u,w,-u,c),m.fx=t(m),m.fx<S.fx?M(m):M(S);else if(S.fx>=p[b-1].fx){let y=!1;if(S.fx>c.fx?(J(g,1+a,w,-a,c),g.fx=t(g),g.fx<c.fx?M(g):y=!0):(J(g,1-a*f,w,a*f,c),g.fx=t(g),g.fx<S.fx?M(g):y=!0),y){if(x>=1)break;for(let d=1;d<p.length;++d)J(p[d],1-x,p[0],x,p[d]),p[d].fx=t(p[d])}}else M(S)}return p.sort(E),{fx:p[0].fx,x:p[0]}}function Kt(t,n,s,e,i,o,r){const l=s.fx,f=$(s.fxprime,n);let u=l,a=l,x=f,h=0;i=i||1,o=o||1e-6,r=r||.1;function b(p,M,E){for(let w=0;w<16;++w)if(i=(p+M)/2,J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),x=$(e.fxprime,n),u>l+o*i*f||u>=E)M=i;else{if(Math.abs(x)<=-r*f)return i;x*(M-p)>=0&&(M=p),p=i,E=u}return 0}for(let p=0;p<10;++p){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),x=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(x)<=-r*f)return i;if(x>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function Ht(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ut(r,e.fxprime,-1);for(let a=0;a<u;++a){if(f=Kt(t,r,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ut(r,e.fxprime,-1);else{J(o,1,i.fxprime,-1,e.fxprime);const x=$(e.fxprime,e.fxprime),h=Math.max(0,$(o,i.fxprime)/x);J(r,h,r,-1,i.fxprime),l=e,e=i,i=l}if(ct(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function Et(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||Jt,e=n.lossFunction||tt,i=Yt(t,n),o=s(i,n),r=Object.keys(o),l=[];for(const a of r)l.push(o[a].x),l.push(o[a].y);const u=Tt(a=>{const x={};for(let h=0;h<r.length;++h){const b=r[h];x[b]={x:a[2*h],y:a[2*h+1],radius:o[b].radius}}return e(x,i)},l,n).x;for(let a=0;a<r.length;++a){const x=r[a];o[x].x=u[2*a],o[x].y=u[2*a+1]}return o}const zt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+zt?Math.abs(t-n):Wt(e=>gt(t,n,e)-s,0,t+n)}function Yt(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);l.set(a,f.size+(l.get(a)||0));for(let x=u+1;x<f.sets.length;x++){const h=String(f.sets[x]),b=`${a};${h}`,p=`${h};${a}`;l.set(b,f.size+(l.get(b)||0)),l.set(p,f.size+(l.get(p)||0))}}for(const f of e)f.sets.length<3&&(f.size=l.get(i(f.sets)))}const o=[],r=new Set;for(const l of e)if(l.sets.length===1)o.push(l.sets[0]);else if(l.sets.length===2){const f=l.sets[0],u=l.sets[1];r.add(i(l.sets)),r.add(i([u,f]))}o.sort((l,f)=>l===f?0:l<f?-1:1);for(let l=0;l<o.length;++l){const f=o[l];for(let u=l+1;u<o.length;++u){const a=o[u];r.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function Xt(t,n,s){const e=It(n.length,n.length),i=It(n.length,n.length);return t.filter(o=>o.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(f,u,o.size);e[r][l]=e[l][r]=a;let x=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?x=1:o.size<=1e-10&&(x=-1),i[r][l]=i[l][r]=x}),{distances:e,constraints:i}}function Zt(t,n,s,e){for(let o=0;o<n.length;++o)n[o]=0;let i=0;for(let o=0;o<s.length;++o){const r=t[2*o],l=t[2*o+1];for(let f=o+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],x=s[o][f],h=e[o][f],b=(u-r)*(u-r)+(a-l)*(a-l),p=Math.sqrt(b),M=b-x*x;h>0&&p<=x||h<0&&p>=x||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function Jt(t,n={}){let s=$t(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=Qt(t,n),o=e(i,t),r=e(s,t);o+1e-8<r&&(s=i)}return s}function Qt(t,n={}){const s=n.restarts||10,e=[],i={};for(const h of t)h.sets.length===1&&(i[h.sets[0]]=e.length,e.push(h));let{distances:o,constraints:r}=Xt(t,e,i);const l=ct(o.map(ct))/o.length;o=o.map(h=>h.map(b=>b/l));const f=(h,b)=>Zt(h,b,o,r);let u=null;for(let h=0;h<s;++h){const b=lt(o.length*2).map(Math.random),p=Ht(f,b,n);(!u||p.fx<u.fx)&&(u=p)}const a=u.x,x={};for(let h=0;h<e.length;++h){const b=e[h];x[b.sets[0]]={x:a[2*h]*l,y:a[2*h+1]*l,radius:Math.sqrt(b.size/Math.PI)}}if(n.history)for(const h of n.history)ut(h.x,l);return x}function $t(t,n){const s=n&&n.lossFunction?n.lossFunction:tt,e={},i={};for(const x of t)if(x.sets.length===1){const h=x.sets[0];e[h]={x:1e10,y:1e10,rowid:e.length,size:x.size,radius:Math.sqrt(x.size/Math.PI)},i[h]=[]}t=t.filter(x=>x.sets.length===2);for(const x of t){let h=x.weight!=null?x.weight:1;const b=x.sets[0],p=x.sets[1];x.size+zt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:x.size,weight:h}),i[p].push({set:b,size:x.size,weight:h})}const o=[];Object.keys(i).forEach(x=>{let h=0;for(let b=0;b<i[x].length;++b)h+=i[x][b].size*i[x][b].weight;o.push({set:x,size:h})});function r(x,h){return h.size-x.size}o.sort(r);const l={};function f(x){return x.set in l}function u(x,h){e[h].x=x.x,e[h].y=x.y,l[h]=!0}u({x:0,y:0},o[0].set);for(let x=1;x<o.length;++x){const h=o[x].set,b=i[h].filter(f),p=e[h];if(b.sort(r),b.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<b.length;++a){const S=e[b[a].set],g=ft(p.radius,S.radius,b[a].size);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});for(let m=a+1;m<b.length;++m){const _=e[b[m].set],c=ft(p.radius,_.radius,b[m].size),y=St({x:S.x,y:S.y,radius:g},{x:_.x,y:_.y,radius:c});M.push(...y)}}let E=1e50,w=M[0];for(const S of M){e[h].x=S.x,e[h].y=S.y;const g=s(e,t);g<E&&(E=g,w=S)}u(w,h)}return e}function tt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const r=t[e.sets[0]],l=t[e.sets[1]];i=gt(r.radius,l.radius,q(r,l))}else i=st(e.sets.map(r=>t[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function At(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=gt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function te(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}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){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function ee(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i<t.length;++i)for(let o=i+1;o<t.length;++o){const r=t[i].radius+t[o].radius;q(t[i],t[o])+1e-10<r&&s(t[o],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const o=n(t[i]).parent.setid;e.has(o)||e.set(o,[]),e.get(o).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function ht(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ot(t).map(u=>Object.assign({},u));const i=ee(e);for(const u of i){te(u,n,s);const a=ht(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,x){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(x)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f<i.length;)l(i[f],!0,!1),l(i[f+1],!1,!0),l(i[f+2],!0,!0),f+=3,o=ht(e);return Ct(e)}function Rt(t,n,s,e,i){const o=Ot(t);n-=2*e,s-=2*e;const{xRange:r,yRange:l}=ht(o);if(r.max===r.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const b=Math.sqrt(i/Math.PI)*2;f=n/b,u=s/b}else f=n/(r.max-r.min),u=s/(l.max-l.min);const a=Math.min(u,f),x=(n-(r.max-r.min)*a)/2,h=(s-(l.max-l.min)*a)/2;return Ct(o.map(b=>({radius:a*b.radius,x:e+x+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Ct(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ot(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ne(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,x=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},w=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(y){if(y in E)return E[y];var d=E[y]=w[S];return S+=1,S>=w.length&&(S=0),d},m=Et,_=tt;function c(y){let d=y.datum();const R=new Set;d.forEach(I=>{I.size==0&&I.sets.length==1&&R.add(I.sets[0])}),d=d.filter(I=>!I.sets.some(j=>R.has(j)));let v={},C={};if(d.length>0){let I=m(d,{lossFunction:_,distinct:b});l&&(I=Dt(I,r,h)),v=Rt(I,s,e,i,f),C=jt(v,d,M)}const U={};d.forEach(I=>{I.label&&(U[I.sets]=I.label)});function V(I){if(I.sets in U)return U[I.sets];if(I.sets.length==1)return""+I.sets[0]}y.selectAll("svg").data([v]).enter().append("svg");const N=y.select("svg");n?N.attr("viewBox",`0 0 ${s} ${e}`):N.attr("width",s).attr("height",e);const D={};let T=!1;N.selectAll(".venn-area path").each(function(I){const j=this.getAttribute("d");I.sets.length==1&&j&&!b&&(T=!0,D[I.sets[0]]=oe(j))});function A(I){return j=>{const H=I.sets.map(et=>{let Y=D[et],Z=v[et];return Y||(Y={x:s/2,y:e/2,radius:1}),Z||(Z={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-j)+Z.x*j,y:Y.y*(1-j)+Z.y*j,radius:Y.radius*(1-j)+Z.radius*j}});return kt(H,p)}}const G=N.selectAll(".venn-area").data(d,I=>I.sets),L=G.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),B=L.append("path"),P=L.append("text").attr("class","label").text(I=>V(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),P.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function K(I){return typeof I.transition=="function"?I.transition("venn").duration(o):I}let z=y;T&&typeof z.transition=="function"?(z=K(y),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",I=>kt(I.sets.map(j=>v[j])),p);const O=z.selectAll("text").filter(I=>I.sets in C).text(I=>V(I)).attr("x",I=>Math.floor(C[I.sets].x)).attr("y",I=>Math.floor(C[I.sets].y));u&&(T?"on"in O?O.on("end",ot(v,V)):O.each("end",ot(v,V)):O.each(ot(v,V)));const F=K(G.exit()).remove();typeof G.transition=="function"&&F.selectAll("path").attrTween("d",A);const X=F.selectAll("text").attr("x",s/2).attr("y",e/2);return x!==null&&(P.style("font-size","0px"),O.style("font-size",x),X.style("font-size","0px")),{circles:v,textCentres:C,nodes:G,enter:L,update:z,exit:F}}return c.wrap=function(y){return arguments.length?(u=y,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(y){return arguments.length?(s=y,c):s},c.height=function(y){return arguments.length?(e=y,c):e},c.padding=function(y){return arguments.length?(i=y,c):i},c.distinct=function(y){return arguments.length?(b=y,c):b},c.colours=function(y){return arguments.length?(g=y,c):g},c.colors=function(y){return arguments.length?(g=y,c):g},c.fontSize=function(y){return arguments.length?(x=y,c):x},c.round=function(y){return arguments.length?(p=y,c):p},c.duration=function(y){return arguments.length?(o=y,c):o},c.layoutFunction=function(y){return arguments.length?(m=y,c):m},c.normalize=function(y){return arguments.length?(l=y,c):l},c.scaleToFit=function(y){return arguments.length?(f=y,c):f},c.styled=function(y){return arguments.length?(a=y,c):a},c.orientation=function(y){return arguments.length?(r=y,c):r},c.orientationOrder=function(y){return arguments.length?(h=y,c):h},c.lossFunction=function(y){return arguments.length?(_=y==="default"?tt:y==="logRatio"?At:y,c):_},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],x=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),x++)}const E=.35-x*h/2,w=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",w),g.setAttribute("y",S),g.setAttribute("dy",`${E+m*h}em`)})}}function rt(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i<n.length;++i){const o=n[i].radius-q(n[i],t);o<=e&&(e=o)}for(let i=0;i<s.length;++i){const o=q(s[i],t)-s[i].radius;o<=e&&(e=o)}return e}function Nt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],o=rt(e[0],t,n);for(let a=1;a<e.length;++a){const x=rt(e[a],t,n);x>=o&&(i=e[a],o=x)}const r=Tt(a=>-1*rt({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)<a.radius){f=!1;break}if(f)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};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?Nt(t,[]):wt(u.arcs.map(a=>a.p1))}function se(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],o=t[i];for(let r=e+1;r<s.length;++r){const l=s[r],f=t[l],u=q(o,f);u+f.radius<=o.radius+1e-10?n[l].push(i):u+o.radius<=f.radius+1e-10&&n[i].push(l)}}return n}function jt(t,n,s){const e={},i=se(t);for(let o=0;o<n.length;++o){const r=n[o].sets,l={},f={};for(let h=0;h<r.length;++h){l[r[h]]=!0;const b=i[r[h]];for(let p=0;p<b.length;++p)f[b[p]]=!0}const u=[],a=[];for(let h in t)h in l?u.push(t[h]):h in f||a.push(t[h]);const x=Nt(u,a,s);e[r]=x,x.disjoint&&n[o].size>0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function ie(t,n,s){const e=[];return e.push(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./extractHeadings-DRUBnhbi.cjs"),vt=(t,n)=>k.adjustChannel(t,"a",-n),Mt=1e-10;function st(t,n){const s=Gt(t),e=s.filter(l=>Ut(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=wt(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];o+=(f.x+a.x)*(a.y-f.y);const x={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let h=null;for(let b=0;b<a.parentIndex.length;++b)if(f.parentIndex.includes(a.parentIndex[b])){const p=t[a.parentIndex[b]],M=Math.atan2(a.x-p.x,a.y-p.y),E=Math.atan2(f.x-p.x,f.y-p.y);let w=E-M;w<0&&(w+=2*Math.PI);const S=E-w/2;let g=q(x,{x:p.x+p.radius*Math.sin(S),y:p.y+p.radius*Math.cos(S)});g>p.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=at(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(q(t[u],l)>Math.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-Mt,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function Ut(t,n){return n.every(s=>q(t,s)<s.radius+Mt)}function Gt(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=St(t[s],t[e]);for(const o of i)o.parentIndex=[s,e],n.push(o)}return n}function at(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function q(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function gt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return at(t,e)+at(n,i)}function St(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function wt(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function Wt(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,x=t(a);if(x*r>=0&&(n=a),Math.abs(f)<o||x===0)return a}return n+f}function lt(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function It(t,n){return lt(t).map(()=>lt(n))}function $(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ct(t){return Math.sqrt($(t,t))}function ut(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function J(t,n,s,e,i){for(let o=0;o<t.length;++o)t[o]=n*s[o]+e*i[o]}function Tt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,o=s.zeroDelta||.001,r=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,x=s.sigma!==void 0?s.sigma:.5;let h;const b=n.length,p=new Array(b+1);p[0]=n,p[0].fx=t(n),p[0].id=0;for(let _=0;_<b;++_){const c=n.slice();c[_]=c[_]?c[_]*i:o,p[_+1]=c,p[_+1].fx=t(c),p[_+1].id=_+1}function M(_){for(let c=0;c<_.length;c++)p[b][c]=_[c];p[b].fx=_.fx}const E=(_,c)=>_.fx-c.fx,w=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let _=0;_<e;++_){if(p.sort(E),s.history){const y=p.map(d=>{const R=d.slice();return R.fx=d.fx,R.id=d.id,R});y.sort((d,R)=>d.id-R.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:y})}h=0;for(let y=0;y<b;++y)h=Math.max(h,Math.abs(p[0][y]-p[1][y]));if(Math.abs(p[0].fx-p[b].fx)<r&&h<l)break;for(let y=0;y<b;++y){w[y]=0;for(let d=0;d<b;++d)w[y]+=p[d][y];w[y]/=b}const c=p[b];if(J(S,1+f,w,-f,c),S.fx=t(S),S.fx<p[0].fx)J(m,1+u,w,-u,c),m.fx=t(m),m.fx<S.fx?M(m):M(S);else if(S.fx>=p[b-1].fx){let y=!1;if(S.fx>c.fx?(J(g,1+a,w,-a,c),g.fx=t(g),g.fx<c.fx?M(g):y=!0):(J(g,1-a*f,w,a*f,c),g.fx=t(g),g.fx<S.fx?M(g):y=!0),y){if(x>=1)break;for(let d=1;d<p.length;++d)J(p[d],1-x,p[0],x,p[d]),p[d].fx=t(p[d])}}else M(S)}return p.sort(E),{fx:p[0].fx,x:p[0]}}function Kt(t,n,s,e,i,o,r){const l=s.fx,f=$(s.fxprime,n);let u=l,a=l,x=f,h=0;i=i||1,o=o||1e-6,r=r||.1;function b(p,M,E){for(let w=0;w<16;++w)if(i=(p+M)/2,J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),x=$(e.fxprime,n),u>l+o*i*f||u>=E)M=i;else{if(Math.abs(x)<=-r*f)return i;x*(M-p)>=0&&(M=p),p=i,E=u}return 0}for(let p=0;p<10;++p){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),x=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(x)<=-r*f)return i;if(x>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function Ht(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ut(r,e.fxprime,-1);for(let a=0;a<u;++a){if(f=Kt(t,r,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ut(r,e.fxprime,-1);else{J(o,1,i.fxprime,-1,e.fxprime);const x=$(e.fxprime,e.fxprime),h=Math.max(0,$(o,i.fxprime)/x);J(r,h,r,-1,i.fxprime),l=e,e=i,i=l}if(ct(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function Et(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||Jt,e=n.lossFunction||tt,i=Yt(t,n),o=s(i,n),r=Object.keys(o),l=[];for(const a of r)l.push(o[a].x),l.push(o[a].y);const u=Tt(a=>{const x={};for(let h=0;h<r.length;++h){const b=r[h];x[b]={x:a[2*h],y:a[2*h+1],radius:o[b].radius}}return e(x,i)},l,n).x;for(let a=0;a<r.length;++a){const x=r[a];o[x].x=u[2*a],o[x].y=u[2*a+1]}return o}const zt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+zt?Math.abs(t-n):Wt(e=>gt(t,n,e)-s,0,t+n)}function Yt(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);l.set(a,f.size+(l.get(a)||0));for(let x=u+1;x<f.sets.length;x++){const h=String(f.sets[x]),b=`${a};${h}`,p=`${h};${a}`;l.set(b,f.size+(l.get(b)||0)),l.set(p,f.size+(l.get(p)||0))}}for(const f of e)f.sets.length<3&&(f.size=l.get(i(f.sets)))}const o=[],r=new Set;for(const l of e)if(l.sets.length===1)o.push(l.sets[0]);else if(l.sets.length===2){const f=l.sets[0],u=l.sets[1];r.add(i(l.sets)),r.add(i([u,f]))}o.sort((l,f)=>l===f?0:l<f?-1:1);for(let l=0;l<o.length;++l){const f=o[l];for(let u=l+1;u<o.length;++u){const a=o[u];r.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function Xt(t,n,s){const e=It(n.length,n.length),i=It(n.length,n.length);return t.filter(o=>o.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(f,u,o.size);e[r][l]=e[l][r]=a;let x=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?x=1:o.size<=1e-10&&(x=-1),i[r][l]=i[l][r]=x}),{distances:e,constraints:i}}function Zt(t,n,s,e){for(let o=0;o<n.length;++o)n[o]=0;let i=0;for(let o=0;o<s.length;++o){const r=t[2*o],l=t[2*o+1];for(let f=o+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],x=s[o][f],h=e[o][f],b=(u-r)*(u-r)+(a-l)*(a-l),p=Math.sqrt(b),M=b-x*x;h>0&&p<=x||h<0&&p>=x||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function Jt(t,n={}){let s=$t(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=Qt(t,n),o=e(i,t),r=e(s,t);o+1e-8<r&&(s=i)}return s}function Qt(t,n={}){const s=n.restarts||10,e=[],i={};for(const h of t)h.sets.length===1&&(i[h.sets[0]]=e.length,e.push(h));let{distances:o,constraints:r}=Xt(t,e,i);const l=ct(o.map(ct))/o.length;o=o.map(h=>h.map(b=>b/l));const f=(h,b)=>Zt(h,b,o,r);let u=null;for(let h=0;h<s;++h){const b=lt(o.length*2).map(Math.random),p=Ht(f,b,n);(!u||p.fx<u.fx)&&(u=p)}const a=u.x,x={};for(let h=0;h<e.length;++h){const b=e[h];x[b.sets[0]]={x:a[2*h]*l,y:a[2*h+1]*l,radius:Math.sqrt(b.size/Math.PI)}}if(n.history)for(const h of n.history)ut(h.x,l);return x}function $t(t,n){const s=n&&n.lossFunction?n.lossFunction:tt,e={},i={};for(const x of t)if(x.sets.length===1){const h=x.sets[0];e[h]={x:1e10,y:1e10,rowid:e.length,size:x.size,radius:Math.sqrt(x.size/Math.PI)},i[h]=[]}t=t.filter(x=>x.sets.length===2);for(const x of t){let h=x.weight!=null?x.weight:1;const b=x.sets[0],p=x.sets[1];x.size+zt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:x.size,weight:h}),i[p].push({set:b,size:x.size,weight:h})}const o=[];Object.keys(i).forEach(x=>{let h=0;for(let b=0;b<i[x].length;++b)h+=i[x][b].size*i[x][b].weight;o.push({set:x,size:h})});function r(x,h){return h.size-x.size}o.sort(r);const l={};function f(x){return x.set in l}function u(x,h){e[h].x=x.x,e[h].y=x.y,l[h]=!0}u({x:0,y:0},o[0].set);for(let x=1;x<o.length;++x){const h=o[x].set,b=i[h].filter(f),p=e[h];if(b.sort(r),b.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<b.length;++a){const S=e[b[a].set],g=ft(p.radius,S.radius,b[a].size);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});for(let m=a+1;m<b.length;++m){const _=e[b[m].set],c=ft(p.radius,_.radius,b[m].size),y=St({x:S.x,y:S.y,radius:g},{x:_.x,y:_.y,radius:c});M.push(...y)}}let E=1e50,w=M[0];for(const S of M){e[h].x=S.x,e[h].y=S.y;const g=s(e,t);g<E&&(E=g,w=S)}u(w,h)}return e}function tt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const r=t[e.sets[0]],l=t[e.sets[1]];i=gt(r.radius,l.radius,q(r,l))}else i=st(e.sets.map(r=>t[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function At(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=gt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function te(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}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){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function ee(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i<t.length;++i)for(let o=i+1;o<t.length;++o){const r=t[i].radius+t[o].radius;q(t[i],t[o])+1e-10<r&&s(t[o],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const o=n(t[i]).parent.setid;e.has(o)||e.set(o,[]),e.get(o).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function ht(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ot(t).map(u=>Object.assign({},u));const i=ee(e);for(const u of i){te(u,n,s);const a=ht(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,x){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(x)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f<i.length;)l(i[f],!0,!1),l(i[f+1],!1,!0),l(i[f+2],!0,!0),f+=3,o=ht(e);return Ct(e)}function Rt(t,n,s,e,i){const o=Ot(t);n-=2*e,s-=2*e;const{xRange:r,yRange:l}=ht(o);if(r.max===r.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const b=Math.sqrt(i/Math.PI)*2;f=n/b,u=s/b}else f=n/(r.max-r.min),u=s/(l.max-l.min);const a=Math.min(u,f),x=(n-(r.max-r.min)*a)/2,h=(s-(l.max-l.min)*a)/2;return Ct(o.map(b=>({radius:a*b.radius,x:e+x+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Ct(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ot(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ne(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,x=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},w=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(y){if(y in E)return E[y];var d=E[y]=w[S];return S+=1,S>=w.length&&(S=0),d},m=Et,_=tt;function c(y){let d=y.datum();const R=new Set;d.forEach(I=>{I.size==0&&I.sets.length==1&&R.add(I.sets[0])}),d=d.filter(I=>!I.sets.some(j=>R.has(j)));let v={},C={};if(d.length>0){let I=m(d,{lossFunction:_,distinct:b});l&&(I=Dt(I,r,h)),v=Rt(I,s,e,i,f),C=jt(v,d,M)}const U={};d.forEach(I=>{I.label&&(U[I.sets]=I.label)});function V(I){if(I.sets in U)return U[I.sets];if(I.sets.length==1)return""+I.sets[0]}y.selectAll("svg").data([v]).enter().append("svg");const N=y.select("svg");n?N.attr("viewBox",`0 0 ${s} ${e}`):N.attr("width",s).attr("height",e);const D={};let T=!1;N.selectAll(".venn-area path").each(function(I){const j=this.getAttribute("d");I.sets.length==1&&j&&!b&&(T=!0,D[I.sets[0]]=oe(j))});function A(I){return j=>{const H=I.sets.map(et=>{let Y=D[et],Z=v[et];return Y||(Y={x:s/2,y:e/2,radius:1}),Z||(Z={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-j)+Z.x*j,y:Y.y*(1-j)+Z.y*j,radius:Y.radius*(1-j)+Z.radius*j}});return kt(H,p)}}const G=N.selectAll(".venn-area").data(d,I=>I.sets),L=G.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),B=L.append("path"),P=L.append("text").attr("class","label").text(I=>V(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),P.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function K(I){return typeof I.transition=="function"?I.transition("venn").duration(o):I}let z=y;T&&typeof z.transition=="function"?(z=K(y),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",I=>kt(I.sets.map(j=>v[j])),p);const O=z.selectAll("text").filter(I=>I.sets in C).text(I=>V(I)).attr("x",I=>Math.floor(C[I.sets].x)).attr("y",I=>Math.floor(C[I.sets].y));u&&(T?"on"in O?O.on("end",ot(v,V)):O.each("end",ot(v,V)):O.each(ot(v,V)));const F=K(G.exit()).remove();typeof G.transition=="function"&&F.selectAll("path").attrTween("d",A);const X=F.selectAll("text").attr("x",s/2).attr("y",e/2);return x!==null&&(P.style("font-size","0px"),O.style("font-size",x),X.style("font-size","0px")),{circles:v,textCentres:C,nodes:G,enter:L,update:z,exit:F}}return c.wrap=function(y){return arguments.length?(u=y,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(y){return arguments.length?(s=y,c):s},c.height=function(y){return arguments.length?(e=y,c):e},c.padding=function(y){return arguments.length?(i=y,c):i},c.distinct=function(y){return arguments.length?(b=y,c):b},c.colours=function(y){return arguments.length?(g=y,c):g},c.colors=function(y){return arguments.length?(g=y,c):g},c.fontSize=function(y){return arguments.length?(x=y,c):x},c.round=function(y){return arguments.length?(p=y,c):p},c.duration=function(y){return arguments.length?(o=y,c):o},c.layoutFunction=function(y){return arguments.length?(m=y,c):m},c.normalize=function(y){return arguments.length?(l=y,c):l},c.scaleToFit=function(y){return arguments.length?(f=y,c):f},c.styled=function(y){return arguments.length?(a=y,c):a},c.orientation=function(y){return arguments.length?(r=y,c):r},c.orientationOrder=function(y){return arguments.length?(h=y,c):h},c.lossFunction=function(y){return arguments.length?(_=y==="default"?tt:y==="logRatio"?At:y,c):_},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],x=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),x++)}const E=.35-x*h/2,w=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",w),g.setAttribute("y",S),g.setAttribute("dy",`${E+m*h}em`)})}}function rt(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i<n.length;++i){const o=n[i].radius-q(n[i],t);o<=e&&(e=o)}for(let i=0;i<s.length;++i){const o=q(s[i],t)-s[i].radius;o<=e&&(e=o)}return e}function Nt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],o=rt(e[0],t,n);for(let a=1;a<e.length;++a){const x=rt(e[a],t,n);x>=o&&(i=e[a],o=x)}const r=Tt(a=>-1*rt({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)<a.radius){f=!1;break}if(f)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};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?Nt(t,[]):wt(u.arcs.map(a=>a.p1))}function se(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],o=t[i];for(let r=e+1;r<s.length;++r){const l=s[r],f=t[l],u=q(o,f);u+f.radius<=o.radius+1e-10?n[l].push(i):u+o.radius<=f.radius+1e-10&&n[i].push(l)}}return n}function jt(t,n,s){const e={},i=se(t);for(let o=0;o<n.length;++o){const r=n[o].sets,l={},f={};for(let h=0;h<r.length;++h){l[r[h]]=!0;const b=i[r[h]];for(let p=0;p<b.length;++p)f[b[p]]=!0}const u=[],a=[];for(let h in t)h in l?u.push(t[h]):h in f||a.push(t[h]);const x=Nt(u,a,s);e[r]=x,x.disjoint&&n[o].size>0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function ie(t,n,s){const e=[];return e.push(`
|
|
2
2
|
M`,t,n),e.push(`
|
|
3
3
|
m`,-s,0),e.push(`
|
|
4
4
|
a`,s,s,0,1,0,s*2,0),e.push(`
|