@layers-app/editor 2.2.45 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.js +8 -8
- package/dist/{layers.sKO5wWzt.js → layers.-Lu1Y8pE.js} +1 -1
- package/dist/{layers.n-DYmU2Z.js → layers.-szWP3hz.js} +1 -1
- package/dist/{layers.t9b6t4Ii.js → layers.07RX8yEb.js} +1 -1
- package/dist/{layers.nXKHyTlo.js → layers.0b2KQv8V.js} +1 -1
- package/dist/{layers.CDc-JAN1.js → layers.0p7IoDBP.js} +1 -1
- package/dist/{layers.B5yZJBoB.js → layers.1LdmAcFn.js} +1 -1
- package/dist/{layers.DIYV_Qgp.js → layers.1QfkvGfu.js} +1 -1
- package/dist/{layers.D1OY3B-n.js → layers.1u37zniq.js} +137 -137
- package/dist/{layers.Dt-Xolan.js → layers.2YempUdR.js} +1 -1
- package/dist/{layers.DNqMXVNp.js → layers.2lHfCJig.js} +1 -1
- package/dist/{layers.DVZjfzxM.js → layers.3NkYOlPc.js} +1 -1
- package/dist/{layers.DveF4Taj.js → layers.5-nlHms-.js} +1 -1
- package/dist/{layers.BaVDbZc-.js → layers.7QEU54i7.js} +1 -1
- package/dist/{layers.BVrMVvbD.js → layers.9Ao_2noc.js} +1 -1
- package/dist/{layers.CuZ6oi1Y.js → layers.B-SVhE6O.js} +1 -1
- package/dist/{layers.CJzs0OdD.js → layers.B18cm1fP.js} +1 -1
- package/dist/{layers.C4W6rbDZ.js → layers.B1zVsm3v.js} +2982 -4133
- package/dist/{layers.DYK2Cc2v.js → layers.B3AzuO5j.js} +6 -6
- package/dist/{layers.DKpytb6w.js → layers.B45uHJx5.js} +1 -1
- package/dist/layers.B4RgDHky.js +8 -0
- package/dist/{layers.ByyJrMEp.js → layers.B6BkvW61.js} +2 -2
- package/dist/{layers.BKrToDbz.js → layers.B6eWq2PJ.js} +1 -1
- package/dist/{layers.C2pTMR38.js → layers.B7XmQLJK.js} +1 -1
- package/dist/layers.B7stR0tg.js +7 -0
- package/dist/{layers.BaMwv1jF.js → layers.BA8DF0PO.js} +1 -1
- package/dist/{layers.xMjrkzgP.js → layers.BApatZ6g.js} +1 -1
- package/dist/layers.BCIkvjT3.js +1157 -0
- package/dist/layers.BDBPcQmQ.js +6 -0
- package/dist/{layers.D2IuhDCQ.js → layers.BGhbAdxW.js} +1 -1
- package/dist/{layers.BqnQzZ9x.js → layers.BHSzaYhb.js} +1 -1
- package/dist/{layers.Cjk9bUrz.js → layers.BJrXormV.js} +1 -1
- package/dist/layers.BKn-MzWR.js +1 -0
- package/dist/{layers.DiA7fPFt.js → layers.BNJSdCvt.js} +3 -3
- package/dist/{layers.oXNzpBlK.js → layers.BNWZu7ax.js} +27 -27
- package/dist/{layers.CcfiG8Od.js → layers.BSLmKXjv.js} +1 -1
- package/dist/{layers.Cg39QOHR.js → layers.BVgL-L5o.js} +1 -1
- package/dist/{layers.BcfRIrYG.js → layers.BZVFfwPr.js} +1 -1
- package/dist/{layers.DWpAFgGF.js → layers.B_D5rwSo.js} +1 -1
- package/dist/{layers.Du37x8v3.js → layers.B_TxnlNK.js} +1 -1
- package/dist/{layers.vEoVIWoQ.js → layers.BaYNtgYj.js} +1 -1
- package/dist/{layers.BadeIJgG.js → layers.BcFAMw4h.js} +4 -4
- package/dist/layers.Bg7BQcmt.js +31 -0
- package/dist/{layers.DjG7qFHf.js → layers.BgfG0iAU.js} +11 -11
- package/dist/{layers.CtFiU_U-.js → layers.Bi3TxQ-w.js} +1 -1
- package/dist/{layers.ClSS_-JK.js → layers.Bk0YEHy0.js} +1 -1
- package/dist/{layers.BEdP6w5G.js → layers.Bl6nUUCL.js} +1 -1
- package/dist/{layers.9chn1oBm.js → layers.BmHLBcUn.js} +1 -1
- package/dist/{layers.DvfttTXQ.js → layers.Bou1yCWs.js} +1 -1
- package/dist/{layers.DinGcvYA.js → layers.BpdNScyT.js} +33 -33
- package/dist/{layers.VPQgHqCC.js → layers.BpzAh8uk.js} +1 -1
- package/dist/{layers.DheygGyD.js → layers.BqB1S61a.js} +1 -1
- package/dist/{layers.DJTqJuKz.js → layers.Bqi5-M5H.js} +15 -15
- package/dist/{layers.CABrQ2Zs.js → layers.Br59qLOa.js} +1 -1
- package/dist/{layers.CmSiqz4U.js → layers.Br99nr8r.js} +3 -3
- package/dist/{layers.DLiv2kEf.js → layers.BsMr5tgs.js} +1 -1
- package/dist/{layers.g-cZDg-J.js → layers.BskjH0Pq.js} +42 -42
- package/dist/{layers.QhZDFUq4.js → layers.BvQ-SlEw.js} +1 -1
- package/dist/{layers.BEIgYyne.js → layers.BvVY8MIz.js} +1 -1
- package/dist/{layers.vXZEDgHQ.js → layers.Bw05_Vds.js} +1 -1
- package/dist/{layers.Cof8D_jH.js → layers.Bxfnl5-h.js} +1 -1
- package/dist/{layers.BOkb4Kwr.js → layers.C0C2_xj0.js} +1 -1
- package/dist/{layers.CHqw81xe.js → layers.C0mcLf6q.js} +1 -1
- package/dist/{layers.cCd9G0s7.js → layers.C3Rfjtv2.js} +1 -1
- package/dist/{layers.CO180qeA.js → layers.C3T10c7B.js} +1 -1
- package/dist/{layers.CAs2-nlo.js → layers.C438BOob.js} +13 -13
- package/dist/{layers.a0ekgaAk.js → layers.C4Sae2dk.js} +1 -1
- package/dist/{layers.CGra3CE8.js → layers.C4ys15M1.js} +2 -2
- package/dist/{layers.Cx21Vx7C.js → layers.C6L2IcKs.js} +1 -1
- package/dist/{layers.B68ca-eU.js → layers.C8xyAF4H.js} +1 -1
- package/dist/{layers.BmnporKE.js → layers.C9ZkpW3f.js} +1 -1
- package/dist/{layers.BTBRVGFs.js → layers.CACM-S8f.js} +1 -1
- package/dist/{layers.CwiLAF0n.js → layers.CBptEVEC.js} +1 -1
- package/dist/{layers.CqFgGsQ4.js → layers.CCO6z_Dk.js} +3 -3
- package/dist/{layers.CFLly-Qe.js → layers.CD3hBq0O.js} +1 -1
- package/dist/{layers.DqCVQnl5.js → layers.CD6NTcVN.js} +1 -1
- package/dist/{layers.YdWr9xoX.js → layers.CDcS1HVy.js} +1 -1
- package/dist/{layers.C_M8g-oV.js → layers.CFelVuJn.js} +1 -1
- package/dist/{layers.wby51kRL.js → layers.CGrTICUV.js} +4 -4
- package/dist/{layers.B028_Pfk.js → layers.CHp6mCE4.js} +13 -13
- package/dist/{layers.C7y7h6VM.js → layers.CI5w6LTn.js} +1 -1
- package/dist/{layers.Du94jGQf.js → layers.CMmkXOIK.js} +1 -1
- package/dist/{layers.CM1BoU1E.js → layers.CNlly0q1.js} +1 -1
- package/dist/layers.COQskeW_.js +1 -0
- package/dist/{layers.DDTNqkEk.js → layers.CPRLWAR-.js} +1 -1
- package/dist/{layers.Cc98lCPt.js → layers.CPTJ3alm.js} +1 -1
- package/dist/{layers.Db7WC46z.js → layers.CQ6hARGk.js} +1 -1
- package/dist/{layers.B0sQe5D1.js → layers.CQSidsT8.js} +3 -3
- package/dist/{layers.D_LcSG5Y.js → layers.CTUNcEKH.js} +1 -1
- package/dist/{layers.bk9EcYJr.js → layers.CUICXRX_.js} +39 -39
- package/dist/{layers.DG26Vzsi.js → layers.CVoEUbsY.js} +3 -3
- package/dist/{layers.NEN1dVNO.js → layers.CVwlyScd.js} +1 -1
- package/dist/{layers.Dd_MQmMI.js → layers.CWGbyc5i.js} +8 -8
- package/dist/{layers.BfHX9frV.js → layers.CXP6VyC8.js} +1 -1
- package/dist/{layers.DvlQFVL_.js → layers.CYjAXUTT.js} +1 -1
- package/dist/{layers.Czx1TgLO.js → layers.C_TU8VSm.js} +2 -2
- package/dist/{layers.BJrL0_Rw.js → layers.C_pPFp7r.js} +2 -2
- package/dist/{layers.C9bqqwGA.js → layers.CaMSFA8F.js} +40 -40
- package/dist/{layers.C2izS29k.js → layers.CcrUyw_4.js} +1 -1
- package/dist/{layers.Ce54L6_R.js → layers.CfdV11eO.js} +1 -1
- package/dist/{layers.CKLSBcei.js → layers.Cgk-kwK1.js} +1 -1
- package/dist/{layers.CldflZpf.js → layers.CiGiXdW0.js} +1 -1
- package/dist/{layers.CEaPCwCe.js → layers.Ck5r7FLY.js} +1 -1
- package/dist/{layers.0KslT0iv.js → layers.CkM48uS9.js} +1 -1
- package/dist/{layers.DzgpLhqO.js → layers.Cl9S-4Pe.js} +1 -1
- package/dist/{layers.C7E3l-g_.js → layers.CoCas1TR.js} +2 -2
- package/dist/{layers.mHLeiSFC.js → layers.Cp0-bIRY.js} +1 -1
- package/dist/{layers.C53wglsE.js → layers.CpxSB-RY.js} +1 -1
- package/dist/{layers.CLP8NLxE.js → layers.Cs-91dHA.js} +1 -1
- package/dist/{layers.km8iRn1X.js → layers.Csa1VvEE.js} +95 -95
- package/dist/{layers.DQNE7pSr.js → layers.CslLaJk_.js} +1 -1
- package/dist/{layers.9PIBmdB5.js → layers.CuR5VVPK.js} +31 -31
- package/dist/{layers.Bex3-2F0.js → layers.CvEHURtU.js} +7 -7
- package/dist/{layers.C9O_XgoY.js → layers.CvGS___n.js} +3 -3
- package/dist/{layers.Bmw_ImFW.js → layers.CxUdn3NH.js} +1 -1
- package/dist/{layers.BDSMUwmt.js → layers.CydBhqPl.js} +1 -1
- package/dist/{layers.D53HW-OH.js → layers.CzuvYlVS.js} +1 -1
- package/dist/{layers.CiDAyBeD.js → layers.D3ETIEPw.js} +1 -1
- package/dist/{layers.BDmaTCfD.js → layers.D5Y3jocj.js} +6 -6
- package/dist/{layers.DQbonqH1.js → layers.D6DW5vEY.js} +1 -1
- package/dist/{layers.jg--vRcI.js → layers.D6G3COyk.js} +15952 -15775
- package/dist/{layers.Cyy4XziO.js → layers.D7jViIYU.js} +1 -1
- package/dist/{layers.DhROyrvJ.js → layers.D8LVQ3ZY.js} +1 -1
- package/dist/{layers.D-dncXMv.js → layers.D8tNGYAu.js} +1 -1
- package/dist/{layers.Bb6_oKs8.js → layers.D98-ldv6.js} +1 -1
- package/dist/{layers.CbG7bPrw.js → layers.DBF94XFg.js} +1 -1
- package/dist/{layers.C2CWUW0P.js → layers.DBFr2bUd.js} +1 -1
- package/dist/{layers.DvhAl2Y2.js → layers.DC8w8IZi.js} +1 -1
- package/dist/layers.DEGygGYH.js +1 -0
- package/dist/layers.DG37kMJR.js +8 -0
- package/dist/{layers.BVQVuKjJ.js → layers.DG8L4wIG.js} +1 -1
- package/dist/{layers.B7VPVY9m.js → layers.DGcUMS0Y.js} +1 -1
- package/dist/{layers.C5spre2i.js → layers.DHj5lmQt.js} +1 -1
- package/dist/{layers.CQESVhxO.js → layers.DIPLdCyl.js} +1 -1
- package/dist/{layers.QSp10MBY.js → layers.DJaA-u-I.js} +1 -1
- package/dist/{layers.DhOjjk4e.js → layers.DJs9wM3X.js} +1 -1
- package/dist/{layers.Dx2lhGzZ.js → layers.DKUdJiaR.js} +3 -3
- package/dist/{layers.bWZDlvmW.js → layers.DRlDj5iQ.js} +1 -1
- package/dist/{layers.BxaGfbS4.js → layers.DRxlnsz8.js} +2 -2
- package/dist/{layers.B22dcdRZ.js → layers.DTz-KpDZ.js} +1 -1
- package/dist/{layers.CmXdbn8_.js → layers.DUcUGFmf.js} +1 -1
- package/dist/{layers.BC7Cg5cy.js → layers.DUhN3YqR.js} +1 -1
- package/dist/{layers.B5HuEtfE.js → layers.DVKcHQP4.js} +1 -1
- package/dist/{layers.P39es0O4.js → layers.DVntzq3z.js} +1 -1
- package/dist/{layers.C7LxBBYp.js → layers.DW7LKZ0_.js} +5 -5
- package/dist/{layers.B5a2e-Mn.js → layers.DXfvADbO.js} +1 -1
- package/dist/layers.DZCT2Mg-.js +1314 -0
- package/dist/{layers.jcCRaKGd.js → layers.D_beONxk.js} +1 -1
- package/dist/layers.Dbm3hiPL.js +5 -0
- package/dist/{layers.B465LyPz.js → layers.DcHhrRyA.js} +1 -1
- package/dist/{layers.yftdzODL.js → layers.Dd6kYaXy.js} +1 -1
- package/dist/{layers.D2bgGfrE.js → layers.DdXWqMWK.js} +5 -5
- package/dist/{layers.DRNjIrAp.js → layers.DfiQKKL6.js} +1 -1
- package/dist/{layers.CIMF-Kx_.js → layers.DhPRmiMt.js} +1 -1
- package/dist/{layers.CP2x77Hz.js → layers.DhySCQVw.js} +1 -1
- package/dist/{layers.CsgsF5Ft.js → layers.Di5OB7o7.js} +1 -1
- package/dist/{layers.BkUV4peM.js → layers.Di82CoED.js} +1 -1
- package/dist/{layers.CZzgBinT.js → layers.DiL6nhZW.js} +1 -1
- package/dist/{layers.0O_y_PSM.js → layers.Diyb97EX.js} +4 -4
- package/dist/{layers.DxQF7DU5.js → layers.DjZrXDXn.js} +1 -1
- package/dist/{layers.CY17OEce.js → layers.DjjlhtCb.js} +1 -1
- package/dist/{layers.C-TQ4gDg.js → layers.DktiF6wI.js} +1 -1
- package/dist/{layers.CYW1WEKe.js → layers.Dlo3gmCf.js} +1 -1
- package/dist/{layers.CgtkYIke.js → layers.Dngx99va.js} +1 -1
- package/dist/{layers.CwazPZdq.js → layers.DrCegXS7.js} +2 -2
- package/dist/{layers.BpL4mYVq.js → layers.Dsjwdeov.js} +1 -1
- package/dist/{layers.VNPeSDc5.js → layers.DuAKqNV4.js} +1 -1
- package/dist/{layers.CSsCFhvL.js → layers.DvtOcWdD.js} +1 -1
- package/dist/{layers.DFxl_E74.js → layers.Dx0gFI_8.js} +4 -4
- package/dist/layers.Dxr2o7ON.js +1 -0
- package/dist/{layers.oNZW8UBG.js → layers.DyI1UB-M.js} +1 -1
- package/dist/{layers.DXbA6oVt.js → layers.Dywy71My.js} +1 -1
- package/dist/{layers.Co4l7_YV.js → layers.EhSWkpTH.js} +1 -1
- package/dist/layers.Hlsf4WAl.js +84 -0
- package/dist/{layers.j6LRzfso.js → layers.I-yaQKvi.js} +1 -1
- package/dist/layers.IP5Q54QC.js +90 -0
- package/dist/{layers.CT3XTF81.js → layers.IUszdZkA.js} +1 -1
- package/dist/{layers.BuPdI71w.js → layers.JJZGIQ_O.js} +1 -1
- package/dist/{layers.DnSDu3aj.js → layers.JK4CPmb2.js} +1 -1
- package/dist/{layers.DcYmpYNe.js → layers.LU2ER-pA.js} +1 -1
- package/dist/{layers.ia3f0EYv.js → layers.M4pn2wm-.js} +1 -1
- package/dist/{layers.BWWFQbUs.js → layers.PLuaosLv.js} +25 -25
- package/dist/{layers.Dvt-Szfl.js → layers.PTKeHAhs.js} +1 -1
- package/dist/{layers.CMB0mF82.js → layers.Pum1ALdT.js} +1 -1
- package/dist/layers.VUXyPQnV.js +1 -0
- package/dist/{layers.XAmXrnxl.js → layers.VyIOesty.js} +1 -1
- package/dist/{layers.DmmEgUMf.js → layers.Ze-wao45.js} +1 -1
- package/dist/{layers.JKpsQUa8.js → layers._dfPZGuq.js} +1 -1
- package/dist/{layers.DgBtq91i.js → layers.aT2npTXt.js} +1 -1
- package/dist/{layers.BunhC82l.js → layers.ba2tniXd.js} +1 -1
- package/dist/{layers.DUD000-v.js → layers.bv5XSWTF.js} +16 -16
- package/dist/layers.c7P3mcxJ.js +1 -0
- package/dist/{layers.CCQQxd5s.js → layers.dDOcJyrx.js} +1 -1
- package/dist/{layers.DuNmb6iV.js → layers.eQTvi5Gi.js} +1 -1
- package/dist/{layers.fnoJpR74.js → layers.ezjomIHR.js} +1 -1
- package/dist/{layers.Cw289Pgg.js → layers.gFANqZul.js} +12 -12
- package/dist/{layers.BUZ2pvws.js → layers.gbsNfZYX.js} +1 -1
- package/dist/{layers.Cvc8xBfw.js → layers.h_l-O4Ya.js} +4107 -4135
- package/dist/{layers.Bf3CS2lb.js → layers.i4tkD9gF.js} +4 -4
- package/dist/{layers.D5naed4X.js → layers.iwts8VqI.js} +1 -1
- package/dist/{layers.txhP70wF.js → layers.jASAtfrf.js} +1 -1
- package/dist/{layers.DGO5wxx-.js → layers.jC4CNUhM.js} +1 -1
- package/dist/{layers.BjDSCoZM.js → layers.khwx4QvE.js} +1 -1
- package/dist/{layers.NCy-p2UI.js → layers.lTT2Z5W-.js} +21 -21
- package/dist/{layers.rkrNrIQd.js → layers.mY4jXoD0.js} +1 -1
- package/dist/{layers.Cg-zHhDe.js → layers.maXwdOZO.js} +2 -2
- package/dist/{layers.0ohwJnJO.js → layers.oBoAHASG.js} +174 -167
- package/dist/{layers.DoceYQaZ.js → layers.v6OYKSou.js} +1 -1
- package/dist/{layers.AL_UvFa5.js → layers.zaXLl66X.js} +1 -1
- package/package.json +7 -2
- package/dist/layers.BX2zMMPD.js +0 -6
- package/dist/layers.CjUQRZCf.js +0 -1313
- package/dist/layers.DXT1JSUZ.js +0 -5
- package/dist/layers.Dele1d2B.js +0 -1
- package/dist/layers.DfHZkVTD.js +0 -1
- package/dist/layers.DrZOHzCc.js +0 -84
- package/dist/layers.OYg34Rse.js +0 -1
- package/dist/layers.SIpDBTUg.js +0 -96
- package/dist/layers.nIE5wUh9.js +0 -1
- package/dist/layers.rE1cepGv.js +0 -8
|
@@ -0,0 +1,1157 @@
|
|
|
1
|
+
import { J as N } from "./layers.h_l-O4Ya.js";
|
|
2
|
+
import { m as U } from "./layers.B1zVsm3v.js";
|
|
3
|
+
import "./layers.Bg7BQcmt.js";
|
|
4
|
+
import "lodash-es/memoize.js";
|
|
5
|
+
import "lodash-es/merge.js";
|
|
6
|
+
import "lodash-es/isEmpty.js";
|
|
7
|
+
const G = 20, ct = {
|
|
8
|
+
rect: "rectangle",
|
|
9
|
+
circle: "ellipse"
|
|
10
|
+
}, Z = {
|
|
11
|
+
startOnLoad: !1,
|
|
12
|
+
flowchart: { curve: "linear" },
|
|
13
|
+
themeVariables: {
|
|
14
|
+
// Multiplying by 1.25 to increase the font size by 25% and render correctly in Excalidraw
|
|
15
|
+
fontSize: `${G * 1.25}px`
|
|
16
|
+
},
|
|
17
|
+
maxEdges: 500,
|
|
18
|
+
maxTextSize: 5e4
|
|
19
|
+
};
|
|
20
|
+
class F {
|
|
21
|
+
constructor({ converter: e }) {
|
|
22
|
+
this.convert = (s, r) => this.converter(s, {
|
|
23
|
+
...r,
|
|
24
|
+
fontSize: r.fontSize || G
|
|
25
|
+
}), this.converter = e;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
var v;
|
|
29
|
+
(function(t) {
|
|
30
|
+
t.ROUND = "round", t.STADIUM = "stadium", t.DOUBLECIRCLE = "doublecircle", t.CIRCLE = "circle", t.DIAMOND = "diamond";
|
|
31
|
+
})(v || (v = {}));
|
|
32
|
+
var W;
|
|
33
|
+
(function(t) {
|
|
34
|
+
t.COLOR = "color";
|
|
35
|
+
})(W || (W = {}));
|
|
36
|
+
var X;
|
|
37
|
+
(function(t) {
|
|
38
|
+
t.FILL = "fill", t.STROKE = "stroke", t.STROKE_WIDTH = "stroke-width", t.STROKE_DASHARRAY = "stroke-dasharray";
|
|
39
|
+
})(X || (X = {}));
|
|
40
|
+
var $ = {}, J;
|
|
41
|
+
function it() {
|
|
42
|
+
if (J) return $;
|
|
43
|
+
J = 1, Object.defineProperty($, "__esModule", { value: !0 }), $.removeMarkdown = void 0;
|
|
44
|
+
var t = function(e, s) {
|
|
45
|
+
s === void 0 && (s = {
|
|
46
|
+
listUnicodeChar: ""
|
|
47
|
+
}), s = s || {}, s.listUnicodeChar = s.hasOwnProperty("listUnicodeChar") ? s.listUnicodeChar : !1, s.stripListLeaders = s.hasOwnProperty("stripListLeaders") ? s.stripListLeaders : !0, s.gfm = s.hasOwnProperty("gfm") ? s.gfm : !0, s.useImgAltText = s.hasOwnProperty("useImgAltText") ? s.useImgAltText : !0, s.preserveLinks = s.hasOwnProperty("preserveLinks") ? s.preserveLinks : !1;
|
|
48
|
+
var r = e || "";
|
|
49
|
+
r = r.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*$/gm, "");
|
|
50
|
+
try {
|
|
51
|
+
s.stripListLeaders && (s.listUnicodeChar ? r = r.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, s.listUnicodeChar + " $1") : r = r.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1")), s.gfm && (r = r.replace(/\n={2,}/g, `
|
|
52
|
+
`).replace(/~{3}.*\n/g, "").replace(/~~/g, "").replace(/`{3}.*\n/g, "")), s.preserveLinks && (r = r.replace(/\[(.*?)\][\[\(](.*?)[\]\)]/g, "$1 ($2)")), r = r.replace(/<[^>]*>/g, "").replace(/^[=\-]{2,}\s*$/g, "").replace(/\[\^.+?\](\: .*?$)?/g, "").replace(/\s{0,2}\[.*?\]: .*?$/g, "").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, s.useImgAltText ? "$1" : "").replace(/\[(.*?)\][\[\(].*?[\]\)]/g, "$1").replace(/^\s{0,3}>\s?/g, "").replace(/(^|\n)\s{0,3}>\s?/g, `
|
|
53
|
+
|
|
54
|
+
`).replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "").replace(/^(\n)?\s{0,}#{1,6}\s+| {0,}(\n)?\s{0,}#{0,} {0,}(\n)?\s{0,}$/gm, "$1$2$3").replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2").replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2").replace(/(`{3,})(.*?)\1/gm, "$2").replace(/`(.+?)`/g, "$1").replace(/\n{2,}/g, `
|
|
55
|
+
|
|
56
|
+
`);
|
|
57
|
+
} catch (o) {
|
|
58
|
+
return console.error(o), e;
|
|
59
|
+
}
|
|
60
|
+
return r;
|
|
61
|
+
};
|
|
62
|
+
return $.removeMarkdown = t, $;
|
|
63
|
+
}
|
|
64
|
+
var dt = it();
|
|
65
|
+
const lt = {
|
|
66
|
+
arrow_circle: {
|
|
67
|
+
endArrowhead: "dot"
|
|
68
|
+
},
|
|
69
|
+
arrow_cross: {
|
|
70
|
+
endArrowhead: "bar"
|
|
71
|
+
},
|
|
72
|
+
arrow_open: {
|
|
73
|
+
endArrowhead: null,
|
|
74
|
+
startArrowhead: null
|
|
75
|
+
},
|
|
76
|
+
double_arrow_circle: {
|
|
77
|
+
endArrowhead: "dot",
|
|
78
|
+
startArrowhead: "dot"
|
|
79
|
+
},
|
|
80
|
+
double_arrow_cross: {
|
|
81
|
+
endArrowhead: "bar",
|
|
82
|
+
startArrowhead: "bar"
|
|
83
|
+
},
|
|
84
|
+
double_arrow_point: {
|
|
85
|
+
endArrowhead: "arrow",
|
|
86
|
+
startArrowhead: "arrow"
|
|
87
|
+
}
|
|
88
|
+
}, ut = (t) => lt[t], B = (t) => {
|
|
89
|
+
let e = t.text;
|
|
90
|
+
return t.labelType === "markdown" && (e = dt.removeMarkdown(t.text)), ht(e);
|
|
91
|
+
}, ht = (t) => {
|
|
92
|
+
const e = /\s?(fa|fab):[a-zA-Z0-9-]+/g;
|
|
93
|
+
return t.replace(e, "");
|
|
94
|
+
}, ft = (t) => {
|
|
95
|
+
const e = {};
|
|
96
|
+
return Object.keys(t).forEach((s) => {
|
|
97
|
+
var r;
|
|
98
|
+
switch (s) {
|
|
99
|
+
case X.FILL: {
|
|
100
|
+
e.backgroundColor = t[s], e.fillStyle = "solid";
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
case X.STROKE: {
|
|
104
|
+
e.strokeColor = t[s];
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
case X.STROKE_WIDTH: {
|
|
108
|
+
e.strokeWidth = Number((r = t[s]) == null ? void 0 : r.split("px")[0]);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case X.STROKE_DASHARRAY: {
|
|
112
|
+
e.strokeStyle = "dashed";
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}), e;
|
|
117
|
+
}, gt = (t) => {
|
|
118
|
+
const e = {};
|
|
119
|
+
return Object.keys(t).forEach((s) => {
|
|
120
|
+
switch (s) {
|
|
121
|
+
case W.COLOR: {
|
|
122
|
+
e.strokeColor = t[s];
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}), e;
|
|
127
|
+
}, bt = (t) => {
|
|
128
|
+
const e = {};
|
|
129
|
+
t.subGraphs.map((r) => {
|
|
130
|
+
r.nodeIds.forEach((o) => {
|
|
131
|
+
e[r.id] = {
|
|
132
|
+
id: r.id,
|
|
133
|
+
parent: null,
|
|
134
|
+
isLeaf: !1
|
|
135
|
+
}, e[o] = {
|
|
136
|
+
id: o,
|
|
137
|
+
parent: r.id,
|
|
138
|
+
isLeaf: t.vertices[o] !== void 0
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
const s = {};
|
|
143
|
+
return [...Object.keys(t.vertices), ...t.subGraphs.map((r) => r.id)].forEach((r) => {
|
|
144
|
+
if (!e[r])
|
|
145
|
+
return;
|
|
146
|
+
let o = e[r];
|
|
147
|
+
const a = [];
|
|
148
|
+
for (o.isLeaf || a.push(`subgraph_group_${o.id}`); o.parent; )
|
|
149
|
+
a.push(`subgraph_group_${o.parent}`), o = e[o.parent];
|
|
150
|
+
s[r] = a;
|
|
151
|
+
}), {
|
|
152
|
+
getGroupIds: (r) => s[r] || [],
|
|
153
|
+
getParentId: (r) => e[r] ? e[r].parent : null
|
|
154
|
+
};
|
|
155
|
+
}, pt = new F({
|
|
156
|
+
converter: (t, e) => {
|
|
157
|
+
const s = [], r = e.fontSize, { getGroupIds: o, getParentId: a } = bt(t);
|
|
158
|
+
return t.subGraphs.reverse().forEach((n) => {
|
|
159
|
+
const c = o(n.id), i = {
|
|
160
|
+
id: n.id,
|
|
161
|
+
type: "rectangle",
|
|
162
|
+
groupIds: c,
|
|
163
|
+
x: n.x,
|
|
164
|
+
y: n.y,
|
|
165
|
+
width: n.width,
|
|
166
|
+
height: n.height,
|
|
167
|
+
label: {
|
|
168
|
+
groupIds: c,
|
|
169
|
+
text: B(n),
|
|
170
|
+
fontSize: r,
|
|
171
|
+
verticalAlign: "top"
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
s.push(i);
|
|
175
|
+
}), Object.values(t.vertices).forEach((n) => {
|
|
176
|
+
if (!n)
|
|
177
|
+
return;
|
|
178
|
+
const c = o(n.id), i = ft(n.containerStyle), d = gt(n.labelStyle);
|
|
179
|
+
let l = {
|
|
180
|
+
id: n.id,
|
|
181
|
+
type: "rectangle",
|
|
182
|
+
groupIds: c,
|
|
183
|
+
x: n.x,
|
|
184
|
+
y: n.y,
|
|
185
|
+
width: n.width,
|
|
186
|
+
height: n.height,
|
|
187
|
+
strokeWidth: 2,
|
|
188
|
+
label: {
|
|
189
|
+
groupIds: c,
|
|
190
|
+
text: B(n),
|
|
191
|
+
fontSize: r,
|
|
192
|
+
...d
|
|
193
|
+
},
|
|
194
|
+
link: n.link || null,
|
|
195
|
+
...i
|
|
196
|
+
};
|
|
197
|
+
switch (n.type) {
|
|
198
|
+
case v.STADIUM: {
|
|
199
|
+
l = { ...l, roundness: { type: 3 } };
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
case v.ROUND: {
|
|
203
|
+
l = { ...l, roundness: { type: 3 } };
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
case v.DOUBLECIRCLE: {
|
|
207
|
+
c.push(`doublecircle_${n.id}}`);
|
|
208
|
+
const u = {
|
|
209
|
+
type: "ellipse",
|
|
210
|
+
groupIds: c,
|
|
211
|
+
x: n.x + 5,
|
|
212
|
+
y: n.y + 5,
|
|
213
|
+
width: n.width - 10,
|
|
214
|
+
height: n.height - 10,
|
|
215
|
+
strokeWidth: 2,
|
|
216
|
+
roundness: { type: 3 },
|
|
217
|
+
label: {
|
|
218
|
+
groupIds: c,
|
|
219
|
+
text: B(n),
|
|
220
|
+
fontSize: r
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
l = { ...l, groupIds: c, type: "ellipse" }, s.push(u);
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
case v.CIRCLE: {
|
|
227
|
+
l.type = "ellipse";
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
case v.DIAMOND: {
|
|
231
|
+
l.type = "diamond";
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
s.push(l);
|
|
236
|
+
}), t.edges.forEach((n) => {
|
|
237
|
+
let c = [];
|
|
238
|
+
const i = a(n.start), d = a(n.end);
|
|
239
|
+
i && i === d && (c = o(i));
|
|
240
|
+
const { startX: l, startY: b, reflectionPoints: u } = n, p = u.map((x) => [
|
|
241
|
+
x.x - u[0].x,
|
|
242
|
+
x.y - u[0].y
|
|
243
|
+
]), g = ut(n.type), y = {
|
|
244
|
+
id: `${n.start}_${n.end}`,
|
|
245
|
+
type: "arrow",
|
|
246
|
+
groupIds: c,
|
|
247
|
+
x: l,
|
|
248
|
+
y: b,
|
|
249
|
+
// 4 and 2 are the Excalidraw's stroke width of thick and thin respectively
|
|
250
|
+
// TODO: use constant exported from Excalidraw package
|
|
251
|
+
strokeWidth: n.stroke === "thick" ? 4 : 2,
|
|
252
|
+
strokeStyle: n.stroke === "dotted" ? "dashed" : void 0,
|
|
253
|
+
points: p,
|
|
254
|
+
...n.text ? { label: { text: B(n), fontSize: r, groupIds: c } } : {},
|
|
255
|
+
roundness: {
|
|
256
|
+
type: 2
|
|
257
|
+
},
|
|
258
|
+
...g
|
|
259
|
+
}, S = s.find((x) => x.id === n.start), E = s.find((x) => x.id === n.end);
|
|
260
|
+
!S || !E || (y.start = {
|
|
261
|
+
id: S.id || ""
|
|
262
|
+
}, y.end = {
|
|
263
|
+
id: E.id || ""
|
|
264
|
+
}, s.push(y));
|
|
265
|
+
}), {
|
|
266
|
+
elements: s
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
}), mt = new F({
|
|
270
|
+
converter: (t) => {
|
|
271
|
+
const e = N(), { width: s, height: r } = t, o = {
|
|
272
|
+
type: "image",
|
|
273
|
+
x: 0,
|
|
274
|
+
y: 0,
|
|
275
|
+
width: s,
|
|
276
|
+
height: r,
|
|
277
|
+
status: "saved",
|
|
278
|
+
fileId: e
|
|
279
|
+
};
|
|
280
|
+
return { files: {
|
|
281
|
+
[e]: {
|
|
282
|
+
id: e,
|
|
283
|
+
mimeType: t.mimeType,
|
|
284
|
+
dataURL: t.dataURL
|
|
285
|
+
}
|
|
286
|
+
}, elements: [o] };
|
|
287
|
+
}
|
|
288
|
+
}), V = (t) => t.replace(/\\n/g, `
|
|
289
|
+
`), M = (t) => {
|
|
290
|
+
const e = {
|
|
291
|
+
type: "line",
|
|
292
|
+
x: t.startX,
|
|
293
|
+
y: t.startY,
|
|
294
|
+
points: [
|
|
295
|
+
[0, 0],
|
|
296
|
+
[t.endX - t.startX, t.endY - t.startY]
|
|
297
|
+
],
|
|
298
|
+
width: t.endX - t.startX,
|
|
299
|
+
height: t.endY - t.startY,
|
|
300
|
+
strokeStyle: t.strokeStyle || "solid",
|
|
301
|
+
strokeColor: t.strokeColor || "#000",
|
|
302
|
+
strokeWidth: t.strokeWidth || 1
|
|
303
|
+
};
|
|
304
|
+
return t.groupId && Object.assign(e, { groupIds: [t.groupId] }), t.id && Object.assign(e, { id: t.id }), e;
|
|
305
|
+
}, z = (t) => {
|
|
306
|
+
const e = {
|
|
307
|
+
type: "text",
|
|
308
|
+
x: t.x,
|
|
309
|
+
y: t.y,
|
|
310
|
+
width: t.width,
|
|
311
|
+
height: t.height,
|
|
312
|
+
text: V(t.text) || "",
|
|
313
|
+
fontSize: t.fontSize,
|
|
314
|
+
verticalAlign: "middle"
|
|
315
|
+
};
|
|
316
|
+
return t.groupId && Object.assign(e, { groupIds: [t.groupId] }), t.id && Object.assign(e, { id: t.id }), e;
|
|
317
|
+
}, P = (t) => {
|
|
318
|
+
var r, o, a, n;
|
|
319
|
+
let e = {};
|
|
320
|
+
t.type === "rectangle" && t.subtype === "activation" && (e = {
|
|
321
|
+
backgroundColor: "#e9ecef",
|
|
322
|
+
fillStyle: "solid"
|
|
323
|
+
});
|
|
324
|
+
const s = {
|
|
325
|
+
id: t.id,
|
|
326
|
+
type: t.type,
|
|
327
|
+
x: t.x,
|
|
328
|
+
y: t.y,
|
|
329
|
+
width: t.width,
|
|
330
|
+
height: t.height,
|
|
331
|
+
label: {
|
|
332
|
+
text: V(((r = t == null ? void 0 : t.label) == null ? void 0 : r.text) || ""),
|
|
333
|
+
fontSize: (o = t == null ? void 0 : t.label) == null ? void 0 : o.fontSize,
|
|
334
|
+
verticalAlign: ((a = t.label) == null ? void 0 : a.verticalAlign) || "middle",
|
|
335
|
+
strokeColor: ((n = t.label) == null ? void 0 : n.color) || "#000",
|
|
336
|
+
groupIds: t.groupId ? [t.groupId] : []
|
|
337
|
+
},
|
|
338
|
+
strokeStyle: t == null ? void 0 : t.strokeStyle,
|
|
339
|
+
strokeWidth: t == null ? void 0 : t.strokeWidth,
|
|
340
|
+
strokeColor: t == null ? void 0 : t.strokeColor,
|
|
341
|
+
backgroundColor: t == null ? void 0 : t.bgColor,
|
|
342
|
+
fillStyle: "solid",
|
|
343
|
+
...e
|
|
344
|
+
};
|
|
345
|
+
return t.groupId && Object.assign(s, { groupIds: [t.groupId] }), s;
|
|
346
|
+
}, st = (t) => {
|
|
347
|
+
var s;
|
|
348
|
+
const e = {
|
|
349
|
+
type: "arrow",
|
|
350
|
+
x: t.startX,
|
|
351
|
+
y: t.startY,
|
|
352
|
+
points: t.points || [
|
|
353
|
+
[0, 0],
|
|
354
|
+
[t.endX - t.startX, t.endY - t.startY]
|
|
355
|
+
],
|
|
356
|
+
width: t.endX - t.startX,
|
|
357
|
+
height: t.endY - t.startY,
|
|
358
|
+
strokeStyle: (t == null ? void 0 : t.strokeStyle) || "solid",
|
|
359
|
+
endArrowhead: (t == null ? void 0 : t.endArrowhead) || null,
|
|
360
|
+
startArrowhead: (t == null ? void 0 : t.startArrowhead) || null,
|
|
361
|
+
label: {
|
|
362
|
+
text: V(((s = t == null ? void 0 : t.label) == null ? void 0 : s.text) || ""),
|
|
363
|
+
fontSize: 16
|
|
364
|
+
},
|
|
365
|
+
roundness: {
|
|
366
|
+
type: 2
|
|
367
|
+
},
|
|
368
|
+
start: t.start,
|
|
369
|
+
end: t.end
|
|
370
|
+
};
|
|
371
|
+
return t.groupId && Object.assign(e, { groupIds: [t.groupId] }), e;
|
|
372
|
+
}, yt = new F({
|
|
373
|
+
converter: (t) => {
|
|
374
|
+
const e = [], s = [];
|
|
375
|
+
if (Object.values(t.nodes).forEach((r) => {
|
|
376
|
+
!r || !r.length || r.forEach((o) => {
|
|
377
|
+
let a;
|
|
378
|
+
switch (o.type) {
|
|
379
|
+
case "line":
|
|
380
|
+
a = M(o);
|
|
381
|
+
break;
|
|
382
|
+
case "rectangle":
|
|
383
|
+
case "ellipse":
|
|
384
|
+
a = P(o);
|
|
385
|
+
break;
|
|
386
|
+
case "text":
|
|
387
|
+
a = z(o);
|
|
388
|
+
break;
|
|
389
|
+
default:
|
|
390
|
+
throw `unknown type ${o.type}`;
|
|
391
|
+
}
|
|
392
|
+
o.type === "rectangle" && (o == null ? void 0 : o.subtype) === "activation" ? s.push(a) : e.push(a);
|
|
393
|
+
});
|
|
394
|
+
}), Object.values(t.lines).forEach((r) => {
|
|
395
|
+
r && e.push(M(r));
|
|
396
|
+
}), Object.values(t.arrows).forEach((r) => {
|
|
397
|
+
r && (e.push(st(r)), r.sequenceNumber && e.push(P(r.sequenceNumber)));
|
|
398
|
+
}), e.push(...s), t.loops) {
|
|
399
|
+
const { lines: r, texts: o, nodes: a } = t.loops;
|
|
400
|
+
r.forEach((n) => {
|
|
401
|
+
e.push(M(n));
|
|
402
|
+
}), o.forEach((n) => {
|
|
403
|
+
e.push(z(n));
|
|
404
|
+
}), a.forEach((n) => {
|
|
405
|
+
e.push(P(n));
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
return t.groups && t.groups.forEach((r) => {
|
|
409
|
+
const { actorKeys: o, name: a } = r;
|
|
410
|
+
let n = 1 / 0, c = 1 / 0, i = 0, d = 0;
|
|
411
|
+
if (!o.length)
|
|
412
|
+
return;
|
|
413
|
+
e.filter((f) => {
|
|
414
|
+
if (f.id) {
|
|
415
|
+
const C = f.id.indexOf("-"), I = f.id.substring(0, C);
|
|
416
|
+
return o.includes(I);
|
|
417
|
+
}
|
|
418
|
+
}).forEach((f) => {
|
|
419
|
+
if (f.x === void 0 || f.y === void 0 || f.width === void 0 || f.height === void 0)
|
|
420
|
+
throw new Error(`Actor attributes missing ${f}`);
|
|
421
|
+
n = Math.min(n, f.x), c = Math.min(c, f.y), i = Math.max(i, f.x + f.width), d = Math.max(d, f.y + f.height);
|
|
422
|
+
});
|
|
423
|
+
const b = 10, u = n - b, p = c - b, g = i - n + b * 2, m = d - c + b * 2, y = N(), S = P({
|
|
424
|
+
type: "rectangle",
|
|
425
|
+
x: u,
|
|
426
|
+
y: p,
|
|
427
|
+
width: g,
|
|
428
|
+
height: m,
|
|
429
|
+
bgColor: r.fill,
|
|
430
|
+
id: y
|
|
431
|
+
});
|
|
432
|
+
e.unshift(S);
|
|
433
|
+
const E = N(), x = [y];
|
|
434
|
+
e.forEach((f) => {
|
|
435
|
+
if (f.type !== "frame") {
|
|
436
|
+
if (f.x === void 0 || f.y === void 0 || f.width === void 0 || f.height === void 0)
|
|
437
|
+
throw new Error(`Element attributes missing ${f}`);
|
|
438
|
+
if (f.x >= n && f.x + f.width <= i && f.y >= c && f.y + f.height <= d) {
|
|
439
|
+
const C = f.id || N();
|
|
440
|
+
f.id || Object.assign(f, { id: C }), x.push(C);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
const h = {
|
|
445
|
+
type: "frame",
|
|
446
|
+
id: E,
|
|
447
|
+
name: a,
|
|
448
|
+
children: x
|
|
449
|
+
};
|
|
450
|
+
e.push(h);
|
|
451
|
+
}), { elements: e };
|
|
452
|
+
}
|
|
453
|
+
}), xt = new F({
|
|
454
|
+
converter: (t) => {
|
|
455
|
+
const e = [];
|
|
456
|
+
return Object.values(t.nodes).forEach((s) => {
|
|
457
|
+
!s || !s.length || s.forEach((r) => {
|
|
458
|
+
let o;
|
|
459
|
+
switch (r.type) {
|
|
460
|
+
case "line":
|
|
461
|
+
o = M(r);
|
|
462
|
+
break;
|
|
463
|
+
case "rectangle":
|
|
464
|
+
case "ellipse":
|
|
465
|
+
o = P(r);
|
|
466
|
+
break;
|
|
467
|
+
case "text":
|
|
468
|
+
o = z(r);
|
|
469
|
+
break;
|
|
470
|
+
default:
|
|
471
|
+
throw `unknown type ${r.type}`;
|
|
472
|
+
}
|
|
473
|
+
e.push(o);
|
|
474
|
+
});
|
|
475
|
+
}), Object.values(t.lines).forEach((s) => {
|
|
476
|
+
s && e.push(M(s));
|
|
477
|
+
}), Object.values(t.arrows).forEach((s) => {
|
|
478
|
+
if (!s)
|
|
479
|
+
return;
|
|
480
|
+
const r = st(s);
|
|
481
|
+
e.push(r);
|
|
482
|
+
}), Object.values(t.text).forEach((s) => {
|
|
483
|
+
const r = z(s);
|
|
484
|
+
e.push(r);
|
|
485
|
+
}), Object.values(t.namespaces).forEach((s) => {
|
|
486
|
+
const r = Object.keys(s.classes), o = [...r], a = [...t.lines, ...t.arrows, ...t.text];
|
|
487
|
+
r.forEach((c) => {
|
|
488
|
+
const i = a.filter((d) => d.metadata && d.metadata.classId === c).map((d) => d.id);
|
|
489
|
+
i.length && o.push(...i);
|
|
490
|
+
});
|
|
491
|
+
const n = {
|
|
492
|
+
type: "frame",
|
|
493
|
+
id: N(),
|
|
494
|
+
name: s.id,
|
|
495
|
+
children: o
|
|
496
|
+
};
|
|
497
|
+
e.push(n);
|
|
498
|
+
}), { elements: e };
|
|
499
|
+
}
|
|
500
|
+
}), Et = (t, e = {}) => {
|
|
501
|
+
switch (t.type) {
|
|
502
|
+
case "graphImage":
|
|
503
|
+
return mt.convert(t, e);
|
|
504
|
+
case "flowchart":
|
|
505
|
+
return pt.convert(t, e);
|
|
506
|
+
case "sequence":
|
|
507
|
+
return yt.convert(t, e);
|
|
508
|
+
case "class":
|
|
509
|
+
return xt.convert(t, e);
|
|
510
|
+
default:
|
|
511
|
+
throw new Error(`graphToExcalidraw: unknown graph type "${t.type}, only flowcharts are supported!"`);
|
|
512
|
+
}
|
|
513
|
+
}, R = (t) => {
|
|
514
|
+
t = wt(t);
|
|
515
|
+
const e = t.replace(/#(\d+);/g, "&#$1;").replace(/#([a-z]+);/g, "&$1;"), s = document.createElement("textarea");
|
|
516
|
+
return s.innerHTML = e, s.value;
|
|
517
|
+
}, _ = (t) => {
|
|
518
|
+
const e = t.getAttribute("transform"), s = e == null ? void 0 : e.match(/translate\(([ \d.-]+),\s*([\d.-]+)\)/);
|
|
519
|
+
let r = 0, o = 0;
|
|
520
|
+
return s && (r = Number(s[1]), o = Number(s[2])), { transformX: r, transformY: o };
|
|
521
|
+
}, St = (t) => {
|
|
522
|
+
let e = t;
|
|
523
|
+
return e = e.replace(/style.*:\S*#.*;/g, (s) => s.substring(0, s.length - 1)), e = e.replace(/classDef.*:\S*#.*;/g, (s) => s.substring(0, s.length - 1)), e = e.replace(/#\w+;/g, (s) => {
|
|
524
|
+
const r = s.substring(1, s.length - 1);
|
|
525
|
+
return /^\+?\d+$/.test(r) ? `fl°°${r}¶ß` : `fl°${r}¶ß`;
|
|
526
|
+
}), e;
|
|
527
|
+
}, wt = function(t) {
|
|
528
|
+
return t.replace(/fl°°/g, "#").replace(/fl°/g, "&").replace(/¶ß/g, ";");
|
|
529
|
+
}, nt = (t, e = { x: 0, y: 0 }) => {
|
|
530
|
+
if (t.tagName.toLowerCase() !== "path")
|
|
531
|
+
throw new Error(`Invalid input: Expected an HTMLElement of tag "path", got ${t.tagName}`);
|
|
532
|
+
const s = t.getAttribute("d");
|
|
533
|
+
if (!s)
|
|
534
|
+
throw new Error('Path element does not contain a "d" attribute');
|
|
535
|
+
const r = s.split(/(?=[LM])/), o = r[0].substring(1).split(",").map((c) => parseFloat(c)), a = r[r.length - 1].substring(1).split(",").map((c) => parseFloat(c)), n = r.map((c) => {
|
|
536
|
+
const i = c.substring(1).split(",").map((d) => parseFloat(d));
|
|
537
|
+
return { x: i[0], y: i[1] };
|
|
538
|
+
}).filter((c, i, d) => {
|
|
539
|
+
if (i === 0 || i === d.length - 1)
|
|
540
|
+
return !0;
|
|
541
|
+
if (c.x === d[i - 1].x && c.y === d[i - 1].y)
|
|
542
|
+
return !1;
|
|
543
|
+
if (i === d.length - 2 && (d[i - 1].x === c.x || d[i - 1].y === c.y)) {
|
|
544
|
+
const l = d[d.length - 1];
|
|
545
|
+
return Math.hypot(l.x - c.x, l.y - c.y) > 20;
|
|
546
|
+
}
|
|
547
|
+
return c.x !== d[i - 1].x || c.y !== d[i - 1].y;
|
|
548
|
+
}).map((c) => ({
|
|
549
|
+
x: c.x + e.x,
|
|
550
|
+
y: c.y + e.y
|
|
551
|
+
}));
|
|
552
|
+
return {
|
|
553
|
+
startX: o[0] + e.x,
|
|
554
|
+
startY: o[1] + e.y,
|
|
555
|
+
endX: a[0] + e.x,
|
|
556
|
+
endY: a[1] + e.y,
|
|
557
|
+
reflectionPoints: n
|
|
558
|
+
};
|
|
559
|
+
}, At = (t, e) => {
|
|
560
|
+
const s = t.nodes.map((c) => c.startsWith("flowchart-") ? c.split("-")[1] : c), r = e.querySelector(`[id='${t.id}']`);
|
|
561
|
+
if (!r)
|
|
562
|
+
throw new Error("SubGraph element not found");
|
|
563
|
+
const o = K(r, e), a = r.getBBox(), n = {
|
|
564
|
+
width: a.width,
|
|
565
|
+
height: a.height
|
|
566
|
+
};
|
|
567
|
+
return t.classes = void 0, t.dir = void 0, {
|
|
568
|
+
...t,
|
|
569
|
+
nodeIds: s,
|
|
570
|
+
...o,
|
|
571
|
+
...n,
|
|
572
|
+
text: R(t.title)
|
|
573
|
+
};
|
|
574
|
+
}, It = (t, e) => {
|
|
575
|
+
var b, u, p;
|
|
576
|
+
const s = e.querySelector(`[id*="flowchart-${t.id}-"]`);
|
|
577
|
+
if (!s)
|
|
578
|
+
return;
|
|
579
|
+
let r;
|
|
580
|
+
((b = s.parentElement) == null ? void 0 : b.tagName.toLowerCase()) === "a" && (r = s.parentElement.getAttribute("xlink:href"));
|
|
581
|
+
const o = K(r ? s.parentElement : s, e), a = s.getBBox(), n = {
|
|
582
|
+
width: a.width,
|
|
583
|
+
height: a.height
|
|
584
|
+
}, c = (u = s.querySelector(".label-container")) == null ? void 0 : u.getAttribute("style"), i = (p = s.querySelector(".label")) == null ? void 0 : p.getAttribute("style"), d = {};
|
|
585
|
+
c == null || c.split(";").forEach((g) => {
|
|
586
|
+
if (!g)
|
|
587
|
+
return;
|
|
588
|
+
const m = g.split(":")[0].trim(), y = g.split(":")[1].trim();
|
|
589
|
+
d[m] = y;
|
|
590
|
+
});
|
|
591
|
+
const l = {};
|
|
592
|
+
return i == null || i.split(";").forEach((g) => {
|
|
593
|
+
if (!g)
|
|
594
|
+
return;
|
|
595
|
+
const m = g.split(":")[0].trim(), y = g.split(":")[1].trim();
|
|
596
|
+
l[m] = y;
|
|
597
|
+
}), {
|
|
598
|
+
id: t.id,
|
|
599
|
+
labelType: t.labelType,
|
|
600
|
+
text: R(t.text),
|
|
601
|
+
type: t.type,
|
|
602
|
+
link: r || void 0,
|
|
603
|
+
...o,
|
|
604
|
+
...n,
|
|
605
|
+
containerStyle: d,
|
|
606
|
+
labelStyle: l
|
|
607
|
+
};
|
|
608
|
+
}, kt = (t, e, s) => {
|
|
609
|
+
const r = s.querySelector(`[id*="L-${t.start}-${t.end}-${e}"]`);
|
|
610
|
+
if (!r)
|
|
611
|
+
throw new Error("Edge element not found");
|
|
612
|
+
const o = K(r, s), a = nt(r, o);
|
|
613
|
+
return t.length = void 0, {
|
|
614
|
+
...t,
|
|
615
|
+
...a,
|
|
616
|
+
text: R(t.text)
|
|
617
|
+
};
|
|
618
|
+
}, K = (t, e) => {
|
|
619
|
+
var i;
|
|
620
|
+
if (!t)
|
|
621
|
+
throw new Error("Element not found");
|
|
622
|
+
let s = (i = t.parentElement) == null ? void 0 : i.parentElement;
|
|
623
|
+
const r = t.childNodes[0];
|
|
624
|
+
let o = { x: 0, y: 0 };
|
|
625
|
+
if (r) {
|
|
626
|
+
const { transformX: d, transformY: l } = _(r), b = r.getBBox();
|
|
627
|
+
o = {
|
|
628
|
+
x: Number(r.getAttribute("x")) || d + b.x || 0,
|
|
629
|
+
y: Number(r.getAttribute("y")) || l + b.y || 0
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
const { transformX: a, transformY: n } = _(t), c = {
|
|
633
|
+
x: a + o.x,
|
|
634
|
+
y: n + o.y
|
|
635
|
+
};
|
|
636
|
+
for (; s && s.id !== e.id; ) {
|
|
637
|
+
if (s.classList.value === "root" && s.hasAttribute("transform")) {
|
|
638
|
+
const { transformX: d, transformY: l } = _(s);
|
|
639
|
+
c.x += d, c.y += l;
|
|
640
|
+
}
|
|
641
|
+
s = s.parentElement;
|
|
642
|
+
}
|
|
643
|
+
return c;
|
|
644
|
+
}, Tt = (t, e) => {
|
|
645
|
+
t.parse();
|
|
646
|
+
const s = t.parser.yy, r = s.getVertices();
|
|
647
|
+
Object.keys(r).forEach((c) => {
|
|
648
|
+
r[c] = It(r[c], e);
|
|
649
|
+
});
|
|
650
|
+
const o = /* @__PURE__ */ new Map(), a = s.getEdges().filter((c) => e.querySelector(`[id*="L-${c.start}-${c.end}"]`)).map((c) => {
|
|
651
|
+
const i = `${c.start}-${c.end}`, d = o.get(i) || 0;
|
|
652
|
+
return o.set(i, d + 1), kt(c, d, e);
|
|
653
|
+
});
|
|
654
|
+
return {
|
|
655
|
+
type: "flowchart",
|
|
656
|
+
subGraphs: s.getSubGraphs().map((c) => At(c, e)),
|
|
657
|
+
vertices: r,
|
|
658
|
+
edges: a
|
|
659
|
+
};
|
|
660
|
+
}, Ot = (t, e) => {
|
|
661
|
+
const s = {};
|
|
662
|
+
e != null && e.label && (s.label = { text: R(e.label), fontSize: 16 });
|
|
663
|
+
const r = t.tagName;
|
|
664
|
+
if (r === "line")
|
|
665
|
+
s.startX = Number(t.getAttribute("x1")), s.startY = Number(t.getAttribute("y1")), s.endX = Number(t.getAttribute("x2")), s.endY = Number(t.getAttribute("y2"));
|
|
666
|
+
else if (r === "path") {
|
|
667
|
+
const o = t.getAttribute("d");
|
|
668
|
+
if (!o)
|
|
669
|
+
throw new Error('Path element does not contain a "d" attribute');
|
|
670
|
+
const a = o.split(/(?=[LC])/), n = a[0].substring(1).split(",").map((d) => parseFloat(d)), c = [];
|
|
671
|
+
a.forEach((d) => {
|
|
672
|
+
const l = d.substring(1).trim().split(" ").map((b) => {
|
|
673
|
+
const [u, p] = b.split(",");
|
|
674
|
+
return [
|
|
675
|
+
parseFloat(u) - n[0],
|
|
676
|
+
parseFloat(p) - n[1]
|
|
677
|
+
];
|
|
678
|
+
});
|
|
679
|
+
c.push(...l);
|
|
680
|
+
});
|
|
681
|
+
const i = c[c.length - 1];
|
|
682
|
+
s.startX = n[0], s.startY = n[1], s.endX = i[0], s.endY = i[1], s.points = c;
|
|
683
|
+
}
|
|
684
|
+
return e != null && e.label && (s.startY = s.startY - 10, s.endY = s.endY - 10), s.strokeColor = t.getAttribute("stroke"), s.strokeWidth = Number(t.getAttribute("stroke-width")), s.type = "arrow", s.strokeStyle = (e == null ? void 0 : e.strokeStyle) || "solid", s.startArrowhead = (e == null ? void 0 : e.startArrowhead) || null, s.endArrowhead = (e == null ? void 0 : e.endArrowhead) || null, s;
|
|
685
|
+
}, ot = (t, e, s, r, o) => {
|
|
686
|
+
const a = {};
|
|
687
|
+
return a.type = "arrow", a.startX = t, a.startY = e, a.endX = s, a.endY = r, Object.assign(a, { ...o }), a;
|
|
688
|
+
}, H = (t, e, s, r) => ({
|
|
689
|
+
type: "text",
|
|
690
|
+
x: t,
|
|
691
|
+
y: e,
|
|
692
|
+
text: s,
|
|
693
|
+
width: (r == null ? void 0 : r.width) || 20,
|
|
694
|
+
height: (r == null ? void 0 : r.height) || 20,
|
|
695
|
+
fontSize: (r == null ? void 0 : r.fontSize) || G,
|
|
696
|
+
id: r == null ? void 0 : r.id,
|
|
697
|
+
groupId: r == null ? void 0 : r.groupId,
|
|
698
|
+
metadata: r == null ? void 0 : r.metadata
|
|
699
|
+
}), at = (t, e, s) => {
|
|
700
|
+
const r = {}, o = Number(t.getAttribute("x")), a = Number(t.getAttribute("y"));
|
|
701
|
+
r.type = "text", r.text = R(e), s != null && s.id && (r.id = s.id), s != null && s.groupId && (r.groupId = s.groupId);
|
|
702
|
+
const n = t.getBBox();
|
|
703
|
+
r.width = n.width, r.height = n.height, r.x = o - n.width / 2, r.y = a;
|
|
704
|
+
const c = parseInt(getComputedStyle(t).fontSize);
|
|
705
|
+
return r.fontSize = c, r;
|
|
706
|
+
}, O = (t, e, s = {}) => {
|
|
707
|
+
const r = {};
|
|
708
|
+
r.type = e;
|
|
709
|
+
const { label: o, subtype: a, id: n, groupId: c } = s;
|
|
710
|
+
r.id = n, c && (r.groupId = c), o && (r.label = {
|
|
711
|
+
text: R(o.text),
|
|
712
|
+
fontSize: 16,
|
|
713
|
+
verticalAlign: o == null ? void 0 : o.verticalAlign
|
|
714
|
+
});
|
|
715
|
+
const i = t.getBBox();
|
|
716
|
+
switch (r.x = i.x, r.y = i.y, r.width = i.width, r.height = i.height, r.subtype = a, a) {
|
|
717
|
+
case "highlight":
|
|
718
|
+
const d = t.getAttribute("fill");
|
|
719
|
+
d && (r.bgColor = d);
|
|
720
|
+
break;
|
|
721
|
+
case "note":
|
|
722
|
+
r.strokeStyle = "dashed";
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
return r;
|
|
726
|
+
}, q = (t, e, s, r, o, a) => {
|
|
727
|
+
const n = {};
|
|
728
|
+
return n.startX = e, n.startY = s, n.endX = r, a != null && a.groupId && (n.groupId = a.groupId), a != null && a.id && (n.id = a.id), n.endY = o, n.strokeColor = t.getAttribute("stroke"), n.strokeWidth = Number(t.getAttribute("stroke-width")), n.type = "line", n;
|
|
729
|
+
}, Q = {
|
|
730
|
+
0: "SOLID",
|
|
731
|
+
1: "DOTTED",
|
|
732
|
+
3: "SOLID_CROSS",
|
|
733
|
+
4: "DOTTED_CROSS",
|
|
734
|
+
5: "SOLID_OPEN",
|
|
735
|
+
6: "DOTTED_OPEN",
|
|
736
|
+
24: "SOLID_POINT",
|
|
737
|
+
25: "DOTTED_POINT"
|
|
738
|
+
}, T = {
|
|
739
|
+
SOLID: 0,
|
|
740
|
+
DOTTED: 1,
|
|
741
|
+
NOTE: 2,
|
|
742
|
+
SOLID_CROSS: 3,
|
|
743
|
+
DOTTED_CROSS: 4,
|
|
744
|
+
SOLID_OPEN: 5,
|
|
745
|
+
DOTTED_OPEN: 6,
|
|
746
|
+
SOLID_POINT: 24,
|
|
747
|
+
DOTTED_POINT: 25,
|
|
748
|
+
CRITICAL_START: 27
|
|
749
|
+
}, Ct = (t) => {
|
|
750
|
+
let e;
|
|
751
|
+
switch (t) {
|
|
752
|
+
case T.SOLID:
|
|
753
|
+
case T.SOLID_CROSS:
|
|
754
|
+
case T.SOLID_OPEN:
|
|
755
|
+
case T.SOLID_POINT:
|
|
756
|
+
e = "solid";
|
|
757
|
+
break;
|
|
758
|
+
case T.DOTTED:
|
|
759
|
+
case T.DOTTED_CROSS:
|
|
760
|
+
case T.DOTTED_OPEN:
|
|
761
|
+
case T.DOTTED_POINT:
|
|
762
|
+
e = "dotted";
|
|
763
|
+
break;
|
|
764
|
+
default:
|
|
765
|
+
e = "solid";
|
|
766
|
+
break;
|
|
767
|
+
}
|
|
768
|
+
return e;
|
|
769
|
+
}, Nt = (t, e) => {
|
|
770
|
+
var r, o;
|
|
771
|
+
if (!!((r = t.nextElementSibling) != null && r.classList.contains("sequenceNumber"))) {
|
|
772
|
+
const a = (o = t.nextElementSibling) == null ? void 0 : o.textContent;
|
|
773
|
+
if (!a)
|
|
774
|
+
throw new Error("sequence number not present");
|
|
775
|
+
const n = 30, c = n / 2, d = {
|
|
776
|
+
type: "rectangle",
|
|
777
|
+
x: e.startX - 10,
|
|
778
|
+
y: e.startY - c,
|
|
779
|
+
label: { text: a, fontSize: 14 },
|
|
780
|
+
bgColor: "#e9ecef",
|
|
781
|
+
height: n,
|
|
782
|
+
subtype: "sequence"
|
|
783
|
+
};
|
|
784
|
+
Object.assign(e, { sequenceNumber: d });
|
|
785
|
+
}
|
|
786
|
+
}, tt = (t, e, s) => {
|
|
787
|
+
if (!t)
|
|
788
|
+
throw "root node not found";
|
|
789
|
+
const r = N(), o = Array.from(t.children), a = [];
|
|
790
|
+
return o.forEach((n, c) => {
|
|
791
|
+
const i = `${s == null ? void 0 : s.id}-${c}`;
|
|
792
|
+
let d;
|
|
793
|
+
switch (n.tagName) {
|
|
794
|
+
case "line":
|
|
795
|
+
const l = Number(n.getAttribute("x1")), b = Number(n.getAttribute("y1")), u = Number(n.getAttribute("x2")), p = Number(n.getAttribute("y2"));
|
|
796
|
+
d = q(n, l, b, u, p, { groupId: r, id: i });
|
|
797
|
+
break;
|
|
798
|
+
case "text":
|
|
799
|
+
d = at(n, e, {
|
|
800
|
+
groupId: r,
|
|
801
|
+
id: i
|
|
802
|
+
});
|
|
803
|
+
break;
|
|
804
|
+
case "circle":
|
|
805
|
+
d = O(n, "ellipse", {
|
|
806
|
+
label: n.textContent ? { text: n.textContent } : void 0,
|
|
807
|
+
groupId: r,
|
|
808
|
+
id: i
|
|
809
|
+
});
|
|
810
|
+
default:
|
|
811
|
+
d = O(n, ct[n.tagName], {
|
|
812
|
+
label: n.textContent ? { text: n.textContent } : void 0,
|
|
813
|
+
groupId: r,
|
|
814
|
+
id: i
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
a.push(d);
|
|
818
|
+
}), a;
|
|
819
|
+
}, Lt = (t, e) => {
|
|
820
|
+
const s = Array.from(e.querySelectorAll(".actor-top")), r = Array.from(e.querySelectorAll(".actor-bottom")), o = [], a = [];
|
|
821
|
+
return Object.values(t).forEach((n, c) => {
|
|
822
|
+
var b;
|
|
823
|
+
const i = s.find((u) => u.getAttribute("name") === n.name), d = r.find((u) => u.getAttribute("name") === n.name);
|
|
824
|
+
if (!i || !d)
|
|
825
|
+
throw "root not found";
|
|
826
|
+
const l = n.description;
|
|
827
|
+
if (n.type === "participant") {
|
|
828
|
+
const u = O(i, "rectangle", { id: `${n.name}-top`, label: { text: l }, subtype: "actor" });
|
|
829
|
+
if (!u)
|
|
830
|
+
throw "Top Node element not found!";
|
|
831
|
+
o.push([u]);
|
|
832
|
+
const p = O(d, "rectangle", { id: `${n.name}-bottom`, label: { text: l }, subtype: "actor" });
|
|
833
|
+
o.push([p]);
|
|
834
|
+
const g = (b = i == null ? void 0 : i.parentElement) == null ? void 0 : b.previousElementSibling;
|
|
835
|
+
if ((g == null ? void 0 : g.tagName) !== "line")
|
|
836
|
+
throw "Line not found";
|
|
837
|
+
const m = Number(g.getAttribute("x1"));
|
|
838
|
+
if (!u.height)
|
|
839
|
+
throw "Top node element height is null";
|
|
840
|
+
const y = u.y + u.height, S = p.y, E = Number(g.getAttribute("x2")), x = q(g, m, y, E, S);
|
|
841
|
+
a.push(x);
|
|
842
|
+
} else if (n.type === "actor") {
|
|
843
|
+
const u = tt(i, l, {
|
|
844
|
+
id: `${n.name}-top`
|
|
845
|
+
});
|
|
846
|
+
o.push(u);
|
|
847
|
+
const p = tt(d, l, {
|
|
848
|
+
id: `${n.name}-bottom`
|
|
849
|
+
});
|
|
850
|
+
o.push(p);
|
|
851
|
+
const g = i.previousElementSibling;
|
|
852
|
+
if ((g == null ? void 0 : g.tagName) !== "line")
|
|
853
|
+
throw "Line not found";
|
|
854
|
+
const m = Number(g.getAttribute("x1")), y = Number(g.getAttribute("y1")), S = Number(g.getAttribute("x2")), E = p.find((x) => x.type === "ellipse");
|
|
855
|
+
if (E) {
|
|
856
|
+
const x = E.y, h = q(g, m, y, S, x);
|
|
857
|
+
a.push(h);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
}), { nodes: o, lines: a };
|
|
861
|
+
}, Dt = (t, e) => {
|
|
862
|
+
const s = [], r = Array.from(e.querySelectorAll('[class*="messageLine"]')), o = Object.keys(Q), a = t.filter((n) => o.includes(n.type.toString()));
|
|
863
|
+
return r.forEach((n, c) => {
|
|
864
|
+
const i = a[c], d = Q[i.type], l = Ot(n, {
|
|
865
|
+
label: i == null ? void 0 : i.message,
|
|
866
|
+
strokeStyle: Ct(i.type),
|
|
867
|
+
endArrowhead: d === "SOLID_OPEN" || d === "DOTTED_OPEN" ? null : "arrow"
|
|
868
|
+
});
|
|
869
|
+
Nt(n, l), s.push(l);
|
|
870
|
+
}), s;
|
|
871
|
+
}, Yt = (t, e) => {
|
|
872
|
+
const s = Array.from(e.querySelectorAll(".note")).map((a) => a.parentElement), r = t.filter((a) => a.type === T.NOTE), o = [];
|
|
873
|
+
return s.forEach((a, n) => {
|
|
874
|
+
if (!a)
|
|
875
|
+
return;
|
|
876
|
+
const c = a.firstChild, i = r[n].message, d = O(c, "rectangle", {
|
|
877
|
+
label: { text: i },
|
|
878
|
+
subtype: "note"
|
|
879
|
+
});
|
|
880
|
+
o.push(d);
|
|
881
|
+
}), o;
|
|
882
|
+
}, vt = (t) => {
|
|
883
|
+
const e = Array.from(t.querySelectorAll("[class*=activation]")), s = [];
|
|
884
|
+
return e.forEach((r) => {
|
|
885
|
+
const o = O(r, "rectangle", {
|
|
886
|
+
label: { text: "" },
|
|
887
|
+
subtype: "activation"
|
|
888
|
+
});
|
|
889
|
+
s.push(o);
|
|
890
|
+
}), s;
|
|
891
|
+
}, Xt = (t, e) => {
|
|
892
|
+
const s = Array.from(e.querySelectorAll(".loopLine")), r = [], o = [], a = [];
|
|
893
|
+
s.forEach((l) => {
|
|
894
|
+
const b = Number(l.getAttribute("x1")), u = Number(l.getAttribute("y1")), p = Number(l.getAttribute("x2")), g = Number(l.getAttribute("y2")), m = q(l, b, u, p, g);
|
|
895
|
+
m.strokeStyle = "dotted", m.strokeColor = "#adb5bd", m.strokeWidth = 2, r.push(m);
|
|
896
|
+
});
|
|
897
|
+
const n = Array.from(e.querySelectorAll(".loopText")), c = t.filter((l) => l.type === T.CRITICAL_START).map((l) => l.message);
|
|
898
|
+
n.forEach((l) => {
|
|
899
|
+
var m;
|
|
900
|
+
const b = l.textContent || "", u = at(l, b), p = ((m = b.match(/\[(.*?)\]/)) == null ? void 0 : m[1]) || "";
|
|
901
|
+
c.includes(p) && (u.x += 16), o.push(u);
|
|
902
|
+
});
|
|
903
|
+
const i = Array.from(e == null ? void 0 : e.querySelectorAll(".labelBox")), d = Array.from(e == null ? void 0 : e.querySelectorAll(".labelText"));
|
|
904
|
+
return i.forEach((l, b) => {
|
|
905
|
+
var g;
|
|
906
|
+
const u = ((g = d[b]) == null ? void 0 : g.textContent) || "", p = O(l, "rectangle", {
|
|
907
|
+
label: { text: u }
|
|
908
|
+
});
|
|
909
|
+
p.strokeColor = "#adb5bd", p.bgColor = "#e9ecef", p.width = void 0, a.push(p);
|
|
910
|
+
}), { lines: r, texts: o, nodes: a };
|
|
911
|
+
}, _t = (t) => {
|
|
912
|
+
const e = Array.from(t.querySelectorAll(".rect")).filter((r) => {
|
|
913
|
+
var o;
|
|
914
|
+
return ((o = r.parentElement) == null ? void 0 : o.tagName) !== "g";
|
|
915
|
+
}), s = [];
|
|
916
|
+
return e.forEach((r) => {
|
|
917
|
+
const o = O(r, "rectangle", {
|
|
918
|
+
label: { text: "" },
|
|
919
|
+
subtype: "highlight"
|
|
920
|
+
});
|
|
921
|
+
s.push(o);
|
|
922
|
+
}), s;
|
|
923
|
+
}, Rt = (t, e) => {
|
|
924
|
+
t.parse();
|
|
925
|
+
const s = t.parser.yy, r = [], o = s.getBoxes(), a = _t(e), n = s.getActors(), { nodes: c, lines: i } = Lt(n, e), d = s.getMessages(), l = Dt(d, e), b = Yt(d, e), u = vt(e), p = Xt(d, e);
|
|
926
|
+
return r.push(a), r.push(...c), r.push(b), r.push(u), { type: "sequence", lines: i, arrows: l, nodes: r, loops: p, groups: o };
|
|
927
|
+
}, j = {
|
|
928
|
+
AGGREGATION: 0,
|
|
929
|
+
EXTENSION: 1,
|
|
930
|
+
COMPOSITION: 2,
|
|
931
|
+
DEPENDENCY: 3
|
|
932
|
+
}, et = {
|
|
933
|
+
LINE: 0,
|
|
934
|
+
DOTTED_LINE: 1
|
|
935
|
+
}, D = 16, $t = (t) => {
|
|
936
|
+
let e;
|
|
937
|
+
switch (t) {
|
|
938
|
+
case et.LINE:
|
|
939
|
+
e = "solid";
|
|
940
|
+
break;
|
|
941
|
+
case et.DOTTED_LINE:
|
|
942
|
+
e = "dotted";
|
|
943
|
+
break;
|
|
944
|
+
default:
|
|
945
|
+
e = "solid";
|
|
946
|
+
}
|
|
947
|
+
return e;
|
|
948
|
+
}, rt = (t) => {
|
|
949
|
+
let e;
|
|
950
|
+
switch (t) {
|
|
951
|
+
case j.AGGREGATION:
|
|
952
|
+
e = "diamond_outline";
|
|
953
|
+
break;
|
|
954
|
+
case j.COMPOSITION:
|
|
955
|
+
e = "diamond";
|
|
956
|
+
break;
|
|
957
|
+
case j.EXTENSION:
|
|
958
|
+
e = "triangle_outline";
|
|
959
|
+
break;
|
|
960
|
+
case "none":
|
|
961
|
+
e = null;
|
|
962
|
+
break;
|
|
963
|
+
case j.DEPENDENCY:
|
|
964
|
+
default:
|
|
965
|
+
e = "arrow";
|
|
966
|
+
break;
|
|
967
|
+
}
|
|
968
|
+
return e;
|
|
969
|
+
}, Pt = (t, e) => {
|
|
970
|
+
const s = [], r = [], o = [];
|
|
971
|
+
return Object.values(t).forEach((a) => {
|
|
972
|
+
var m;
|
|
973
|
+
const { domId: n, id: c } = a, i = N(), d = e.querySelector(`[data-id=${c}]`);
|
|
974
|
+
if (!d)
|
|
975
|
+
throw Error(`DOM Node with id ${n} not found`);
|
|
976
|
+
const { transformX: l, transformY: b } = _(d), u = O(d.firstChild, "rectangle", { id: c, groupId: i });
|
|
977
|
+
u.x += l, u.y += b, u.metadata = { classId: c }, s.push(u), Array.from(d.querySelectorAll(".divider")).forEach((y) => {
|
|
978
|
+
const S = Number(y.getAttribute("x1")), E = Number(y.getAttribute("y1")), x = Number(y.getAttribute("x2")), h = Number(y.getAttribute("y2")), f = q(y, S, E, x, h, {
|
|
979
|
+
groupId: i,
|
|
980
|
+
id: N()
|
|
981
|
+
});
|
|
982
|
+
f.startX += l, f.startY += b, f.endX += l, f.endY += b, f.metadata = { classId: c }, r.push(f);
|
|
983
|
+
});
|
|
984
|
+
const g = (m = d.querySelector(".label")) == null ? void 0 : m.children;
|
|
985
|
+
if (!g)
|
|
986
|
+
throw "label nodes not found";
|
|
987
|
+
Array.from(g).forEach((y) => {
|
|
988
|
+
const S = y.textContent;
|
|
989
|
+
if (!S)
|
|
990
|
+
return;
|
|
991
|
+
const E = N(), { transformX: x, transformY: h } = _(y), f = y.getBBox(), I = H(l + x, b + h + 10, S, {
|
|
992
|
+
width: f.width,
|
|
993
|
+
height: f.height,
|
|
994
|
+
id: E,
|
|
995
|
+
groupId: i,
|
|
996
|
+
metadata: { classId: c }
|
|
997
|
+
});
|
|
998
|
+
o.push(I);
|
|
999
|
+
});
|
|
1000
|
+
}), { nodes: s, lines: r, text: o };
|
|
1001
|
+
}, Mt = (t, e) => {
|
|
1002
|
+
const s = ["triangle_outline", "diamond", "diamond_outline"], r = e.startArrowhead && s.includes(e.startArrowhead), o = e.endArrowhead && s.includes(e.endArrowhead);
|
|
1003
|
+
return !o && !r || (r && (t === "LR" ? e.startX -= D : t === "RL" ? e.startX += D : t === "TB" ? e.startY -= D : t === "BT" && (e.startY += D)), o && (t === "LR" ? e.endX += D : t === "RL" ? e.endX -= D : t === "TB" ? e.endY += D : t === "BT" && (e.endY -= D))), e;
|
|
1004
|
+
}, qt = (t, e, s, r) => {
|
|
1005
|
+
var c;
|
|
1006
|
+
const o = (c = s.querySelector(".edgePaths")) == null ? void 0 : c.children;
|
|
1007
|
+
if (!o)
|
|
1008
|
+
throw new Error("No Edges found!");
|
|
1009
|
+
const a = [], n = [];
|
|
1010
|
+
return t.forEach((i, d) => {
|
|
1011
|
+
const { id1: l, id2: b, relation: u } = i, p = e.find((Y) => Y.id === l), g = e.find((Y) => Y.id === b), m = $t(u.lineType), y = rt(u.type1), S = rt(u.type2), E = nt(o[d]), x = ot(E.startX, E.startY, E.endX, E.endY, {
|
|
1012
|
+
strokeStyle: m,
|
|
1013
|
+
startArrowhead: y,
|
|
1014
|
+
endArrowhead: S,
|
|
1015
|
+
label: i.title ? { text: i.title } : void 0,
|
|
1016
|
+
start: { type: "rectangle", id: p.id },
|
|
1017
|
+
end: { type: "rectangle", id: g.id }
|
|
1018
|
+
}), h = Mt(r, x);
|
|
1019
|
+
a.push(h);
|
|
1020
|
+
const { relationTitle1: f, relationTitle2: C } = i, I = 20, k = 15, L = 15;
|
|
1021
|
+
let w, A;
|
|
1022
|
+
if (f && f !== "none") {
|
|
1023
|
+
switch (r) {
|
|
1024
|
+
case "TB":
|
|
1025
|
+
w = h.startX - I, h.endX < h.startX && (w -= L), A = h.startY + k;
|
|
1026
|
+
break;
|
|
1027
|
+
case "BT":
|
|
1028
|
+
w = h.startX + I, h.endX > h.startX && (w += L), A = h.startY - k;
|
|
1029
|
+
break;
|
|
1030
|
+
case "LR":
|
|
1031
|
+
w = h.startX + I, A = h.startY + k, h.endY > h.startY && (A += L);
|
|
1032
|
+
break;
|
|
1033
|
+
case "RL":
|
|
1034
|
+
w = h.startX - I, A = h.startY - k, h.startY > h.endY && (A -= L);
|
|
1035
|
+
break;
|
|
1036
|
+
default:
|
|
1037
|
+
w = h.startX - I, A = h.startY + k;
|
|
1038
|
+
}
|
|
1039
|
+
const Y = H(w, A, f, {
|
|
1040
|
+
fontSize: 16
|
|
1041
|
+
});
|
|
1042
|
+
n.push(Y);
|
|
1043
|
+
}
|
|
1044
|
+
if (C && C !== "none") {
|
|
1045
|
+
switch (r) {
|
|
1046
|
+
case "TB":
|
|
1047
|
+
w = h.endX + I, h.endX < h.startX && (w += L), A = h.endY - k;
|
|
1048
|
+
break;
|
|
1049
|
+
case "BT":
|
|
1050
|
+
w = h.endX - I, h.endX > h.startX && (w -= L), A = h.endY + k;
|
|
1051
|
+
break;
|
|
1052
|
+
case "LR":
|
|
1053
|
+
w = h.endX - I, A = h.endY - k, h.endY > h.startY && (A -= L);
|
|
1054
|
+
break;
|
|
1055
|
+
case "RL":
|
|
1056
|
+
w = h.endX + I, A = h.endY + k, h.startY > h.endY && (A += L);
|
|
1057
|
+
break;
|
|
1058
|
+
default:
|
|
1059
|
+
w = h.endX + I, A = h.endY - k;
|
|
1060
|
+
}
|
|
1061
|
+
const Y = H(w, A, C, {
|
|
1062
|
+
fontSize: 16
|
|
1063
|
+
});
|
|
1064
|
+
n.push(Y);
|
|
1065
|
+
}
|
|
1066
|
+
}), { arrows: a, text: n };
|
|
1067
|
+
}, Bt = (t, e, s) => {
|
|
1068
|
+
const r = [], o = [];
|
|
1069
|
+
return t.forEach((a) => {
|
|
1070
|
+
const { id: n, text: c, class: i } = a, d = e.querySelector(`#${n}`);
|
|
1071
|
+
if (!d)
|
|
1072
|
+
throw new Error(`Node with id ${n} not found!`);
|
|
1073
|
+
const { transformX: l, transformY: b } = _(d), u = d.firstChild, p = O(u, "rectangle", {
|
|
1074
|
+
id: n,
|
|
1075
|
+
subtype: "note",
|
|
1076
|
+
label: { text: c }
|
|
1077
|
+
});
|
|
1078
|
+
if (Object.assign(p, {
|
|
1079
|
+
x: p.x + l,
|
|
1080
|
+
y: p.y + b
|
|
1081
|
+
}), r.push(p), i) {
|
|
1082
|
+
const g = s.find((h) => h.id === i);
|
|
1083
|
+
if (!g)
|
|
1084
|
+
throw new Error(`class node with id ${i} not found!`);
|
|
1085
|
+
const m = p.x + (p.width || 0) / 2, y = p.y + (p.height || 0), S = m, E = g.y, x = ot(m, y, S, E, {
|
|
1086
|
+
strokeStyle: "dotted",
|
|
1087
|
+
startArrowhead: null,
|
|
1088
|
+
endArrowhead: null,
|
|
1089
|
+
start: { id: p.id, type: "rectangle" },
|
|
1090
|
+
end: { id: g.id, type: "rectangle" }
|
|
1091
|
+
});
|
|
1092
|
+
o.push(x);
|
|
1093
|
+
}
|
|
1094
|
+
}), { notes: r, connectors: o };
|
|
1095
|
+
}, jt = (t, e) => {
|
|
1096
|
+
t.parse();
|
|
1097
|
+
const s = t.parser.yy, r = s.getDirection(), o = [], a = [], n = [], c = [], i = s.getNamespaces(), d = s.getClasses();
|
|
1098
|
+
if (Object.keys(d).length) {
|
|
1099
|
+
const m = Pt(d, e);
|
|
1100
|
+
o.push(m.nodes), a.push(...m.lines), n.push(...m.text), c.push(...m.nodes);
|
|
1101
|
+
}
|
|
1102
|
+
const l = s.getRelations(), { arrows: b, text: u } = qt(l, c, e, r), { notes: p, connectors: g } = Bt(s.getNotes(), e, c);
|
|
1103
|
+
return o.push(p), b.push(...g), n.push(...u), { type: "class", nodes: o, lines: a, arrows: b, text: n, namespaces: i };
|
|
1104
|
+
}, zt = (t) => {
|
|
1105
|
+
const e = t.querySelector("svg");
|
|
1106
|
+
if (!e)
|
|
1107
|
+
throw new Error("SVG element not found");
|
|
1108
|
+
const s = e.getBoundingClientRect(), r = s.width, o = s.height;
|
|
1109
|
+
e.setAttribute("width", `${r}`), e.setAttribute("height", `${o}`);
|
|
1110
|
+
const a = "image/svg+xml", n = unescape(encodeURIComponent(e.outerHTML)), i = `data:image/svg+xml;base64,${btoa(n)}`;
|
|
1111
|
+
return {
|
|
1112
|
+
type: "graphImage",
|
|
1113
|
+
mimeType: a,
|
|
1114
|
+
dataURL: i,
|
|
1115
|
+
width: r,
|
|
1116
|
+
height: o
|
|
1117
|
+
};
|
|
1118
|
+
}, Gt = async (t, e = Z) => {
|
|
1119
|
+
U.initialize({ ...Z, ...e });
|
|
1120
|
+
const s = await U.mermaidAPI.getDiagramFromText(St(t)), { svg: r } = await U.render("mermaid-to-excalidraw", t), o = document.createElement("div");
|
|
1121
|
+
o.setAttribute("style", "opacity: 0; position: relative; z-index: -1;"), o.innerHTML = r, o.id = "mermaid-diagram", document.body.appendChild(o);
|
|
1122
|
+
let a;
|
|
1123
|
+
switch (s.type) {
|
|
1124
|
+
case "flowchart-v2": {
|
|
1125
|
+
a = Tt(s, o);
|
|
1126
|
+
break;
|
|
1127
|
+
}
|
|
1128
|
+
case "sequence": {
|
|
1129
|
+
a = Rt(s, o);
|
|
1130
|
+
break;
|
|
1131
|
+
}
|
|
1132
|
+
case "classDiagram": {
|
|
1133
|
+
a = jt(s, o);
|
|
1134
|
+
break;
|
|
1135
|
+
}
|
|
1136
|
+
// fallback to image if diagram type not-supported
|
|
1137
|
+
default:
|
|
1138
|
+
a = zt(o);
|
|
1139
|
+
}
|
|
1140
|
+
return o.remove(), a;
|
|
1141
|
+
}, Zt = async (t, e) => {
|
|
1142
|
+
var n;
|
|
1143
|
+
const s = e || {}, r = parseInt(((n = s.themeVariables) == null ? void 0 : n.fontSize) ?? "") || G, o = await Gt(t, {
|
|
1144
|
+
...s,
|
|
1145
|
+
themeVariables: {
|
|
1146
|
+
...s.themeVariables,
|
|
1147
|
+
// Multiplying by 1.25 to increase the font size by 25% and render correctly in Excalidraw
|
|
1148
|
+
fontSize: `${r * 1.25}px`
|
|
1149
|
+
}
|
|
1150
|
+
});
|
|
1151
|
+
return Et(o, {
|
|
1152
|
+
fontSize: r
|
|
1153
|
+
});
|
|
1154
|
+
};
|
|
1155
|
+
export {
|
|
1156
|
+
Zt as parseMermaidToExcalidraw
|
|
1157
|
+
};
|