@layers-app/editor 2.3.0 → 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.
Files changed (216) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.js +8 -8
  3. package/dist/{layers.B-knJAmg.js → layers.-Lu1Y8pE.js} +1 -1
  4. package/dist/{layers.A2b0zfpv.js → layers.-szWP3hz.js} +1 -1
  5. package/dist/{layers.DLsrdKEz.js → layers.07RX8yEb.js} +1 -1
  6. package/dist/{layers.DhUwAghN.js → layers.0b2KQv8V.js} +1 -1
  7. package/dist/{layers.CXsKBYuP.js → layers.0p7IoDBP.js} +1 -1
  8. package/dist/{layers.Bnozyuub.js → layers.1LdmAcFn.js} +1 -1
  9. package/dist/{layers.iJv3YGd2.js → layers.1QfkvGfu.js} +1 -1
  10. package/dist/{layers.DY8_UsFK.js → layers.1u37zniq.js} +1 -1
  11. package/dist/{layers.IutlLti9.js → layers.2YempUdR.js} +1 -1
  12. package/dist/{layers.B8XK-8I-.js → layers.2lHfCJig.js} +1 -1
  13. package/dist/{layers.BtXqThYa.js → layers.3NkYOlPc.js} +1 -1
  14. package/dist/{layers.BDQtN1aD.js → layers.5-nlHms-.js} +1 -1
  15. package/dist/{layers.B1YHDbg8.js → layers.7QEU54i7.js} +1 -1
  16. package/dist/{layers.CrRPE221.js → layers.9Ao_2noc.js} +1 -1
  17. package/dist/{layers.C1rqQip5.js → layers.B-SVhE6O.js} +1 -1
  18. package/dist/{layers.gG-4BCod.js → layers.B18cm1fP.js} +1 -1
  19. package/dist/{layers.visFusIB.js → layers.B1zVsm3v.js} +24 -24
  20. package/dist/{layers.BQy5VO07.js → layers.B3AzuO5j.js} +3 -3
  21. package/dist/{layers.CsN1TpE_.js → layers.B45uHJx5.js} +1 -1
  22. package/dist/layers.B4RgDHky.js +8 -0
  23. package/dist/{layers.C6LbKv-M.js → layers.B6BkvW61.js} +2 -2
  24. package/dist/{layers.9_5gtlo0.js → layers.B6eWq2PJ.js} +1 -1
  25. package/dist/{layers.C8Tfd7sP.js → layers.B7XmQLJK.js} +1 -1
  26. package/dist/layers.B7stR0tg.js +7 -0
  27. package/dist/{layers.Brsx_95a.js → layers.BA8DF0PO.js} +1 -1
  28. package/dist/{layers.XCBehSH1.js → layers.BApatZ6g.js} +1 -1
  29. package/dist/{layers.D5gltjTL.js → layers.BCIkvjT3.js} +82 -88
  30. package/dist/layers.BDBPcQmQ.js +6 -0
  31. package/dist/{layers.8aC_7H6s.js → layers.BGhbAdxW.js} +1 -1
  32. package/dist/{layers.Bs8dWBby.js → layers.BHSzaYhb.js} +1 -1
  33. package/dist/{layers.CZWgMRsn.js → layers.BJrXormV.js} +1 -1
  34. package/dist/{layers.Ca29Mcjy.js → layers.BKn-MzWR.js} +1 -1
  35. package/dist/{layers.Bj2_ntq3.js → layers.BNJSdCvt.js} +1 -1
  36. package/dist/{layers.Bptrc7aE.js → layers.BNWZu7ax.js} +2 -2
  37. package/dist/{layers.DNSrh1pA.js → layers.BSLmKXjv.js} +1 -1
  38. package/dist/{layers.HEL5QDoC.js → layers.BVgL-L5o.js} +1 -1
  39. package/dist/{layers.Bsr7C4ON.js → layers.BZVFfwPr.js} +1 -1
  40. package/dist/{layers.trRvrSLF.js → layers.B_D5rwSo.js} +1 -1
  41. package/dist/{layers.oeHgntpN.js → layers.B_TxnlNK.js} +1 -1
  42. package/dist/{layers.CgjZSo5b.js → layers.BaYNtgYj.js} +1 -1
  43. package/dist/{layers.DRoyt9-1.js → layers.BcFAMw4h.js} +1 -1
  44. package/dist/{layers.BatQCiGf.js → layers.BgfG0iAU.js} +1 -1
  45. package/dist/{layers.CQ7hsV-G.js → layers.Bi3TxQ-w.js} +1 -1
  46. package/dist/{layers.DbcVW57C.js → layers.Bk0YEHy0.js} +1 -1
  47. package/dist/{layers.CzSHWBJE.js → layers.Bl6nUUCL.js} +1 -1
  48. package/dist/{layers.D1q9XEqC.js → layers.BmHLBcUn.js} +1 -1
  49. package/dist/{layers.fpcqoFdd.js → layers.Bou1yCWs.js} +1 -1
  50. package/dist/{layers.B5R_HMQi.js → layers.BpdNScyT.js} +4 -4
  51. package/dist/{layers.wOUIpHWS.js → layers.BpzAh8uk.js} +1 -1
  52. package/dist/{layers.DcxJ1-U9.js → layers.BqB1S61a.js} +1 -1
  53. package/dist/{layers.WQRYkQdm.js → layers.Bqi5-M5H.js} +3 -3
  54. package/dist/{layers.DO1gXiNA.js → layers.Br59qLOa.js} +1 -1
  55. package/dist/{layers.C-78wB0V.js → layers.Br99nr8r.js} +3 -3
  56. package/dist/{layers.Ciq1sahM.js → layers.BsMr5tgs.js} +1 -1
  57. package/dist/{layers.LGDbkgsv.js → layers.BskjH0Pq.js} +4 -4
  58. package/dist/{layers.BD7kYiWS.js → layers.BvQ-SlEw.js} +1 -1
  59. package/dist/{layers.BccLIbKe.js → layers.BvVY8MIz.js} +1 -1
  60. package/dist/{layers.avpB9JpP.js → layers.Bw05_Vds.js} +1 -1
  61. package/dist/{layers.C71O9vAp.js → layers.Bxfnl5-h.js} +1 -1
  62. package/dist/{layers.BJkqxsDC.js → layers.C0C2_xj0.js} +1 -1
  63. package/dist/{layers.CmupXZHN.js → layers.C0mcLf6q.js} +1 -1
  64. package/dist/{layers.6nxhuUZS.js → layers.C3Rfjtv2.js} +1 -1
  65. package/dist/{layers.CbuDjZaw.js → layers.C3T10c7B.js} +1 -1
  66. package/dist/{layers.BKyKCEyP.js → layers.C438BOob.js} +33 -33
  67. package/dist/{layers.DP7UYubA.js → layers.C4Sae2dk.js} +1 -1
  68. package/dist/{layers.BWD2tONt.js → layers.C4ys15M1.js} +1 -1
  69. package/dist/{layers.CZVAUi9T.js → layers.C6L2IcKs.js} +1 -1
  70. package/dist/{layers.DIDIuUgi.js → layers.C8xyAF4H.js} +1 -1
  71. package/dist/{layers.Bgd7myyy.js → layers.C9ZkpW3f.js} +1 -1
  72. package/dist/{layers.B0c5OY_G.js → layers.CACM-S8f.js} +1 -1
  73. package/dist/{layers.CWkQixNL.js → layers.CBptEVEC.js} +1 -1
  74. package/dist/{layers.BKvhj3Jc.js → layers.CCO6z_Dk.js} +2 -2
  75. package/dist/{layers.pRgndjxw.js → layers.CD3hBq0O.js} +1 -1
  76. package/dist/{layers.ClDrIPRU.js → layers.CD6NTcVN.js} +1 -1
  77. package/dist/{layers.CacnnrTU.js → layers.CDcS1HVy.js} +1 -1
  78. package/dist/{layers.DBQznnML.js → layers.CFelVuJn.js} +1 -1
  79. package/dist/{layers.BaZ9oGNz.js → layers.CGrTICUV.js} +3 -3
  80. package/dist/{layers.BFreQdwW.js → layers.CHp6mCE4.js} +2 -2
  81. package/dist/{layers.xLIBX5yr.js → layers.CI5w6LTn.js} +1 -1
  82. package/dist/{layers.BExC2g6w.js → layers.CMmkXOIK.js} +1 -1
  83. package/dist/{layers.ywa822S7.js → layers.CNlly0q1.js} +1 -1
  84. package/dist/layers.COQskeW_.js +1 -0
  85. package/dist/{layers.DaLjgos9.js → layers.CPRLWAR-.js} +1 -1
  86. package/dist/{layers.cnMJlmUn.js → layers.CPTJ3alm.js} +1 -1
  87. package/dist/{layers.CRRnsu0U.js → layers.CQ6hARGk.js} +1 -1
  88. package/dist/{layers.Dodjwwv6.js → layers.CQSidsT8.js} +3 -3
  89. package/dist/{layers.oaAarQby.js → layers.CTUNcEKH.js} +1 -1
  90. package/dist/{layers.BtXZCoH_.js → layers.CUICXRX_.js} +2 -2
  91. package/dist/{layers.DLyk5obs.js → layers.CVoEUbsY.js} +2 -2
  92. package/dist/{layers.B7fR53su.js → layers.CVwlyScd.js} +1 -1
  93. package/dist/{layers.B4dgRxLi.js → layers.CWGbyc5i.js} +1 -1
  94. package/dist/{layers.DsWcmm1l.js → layers.CXP6VyC8.js} +1 -1
  95. package/dist/{layers.DohiIE20.js → layers.CYjAXUTT.js} +1 -1
  96. package/dist/{layers.DpKYGJRZ.js → layers.C_TU8VSm.js} +1 -1
  97. package/dist/{layers.Dn4qgJFc.js → layers.C_pPFp7r.js} +2 -2
  98. package/dist/{layers.DZqU-iL6.js → layers.CaMSFA8F.js} +31 -31
  99. package/dist/{layers.Zmw0un-f.js → layers.CcrUyw_4.js} +1 -1
  100. package/dist/{layers.U8mTjpv_.js → layers.CfdV11eO.js} +1 -1
  101. package/dist/{layers.77ToS0vJ.js → layers.Cgk-kwK1.js} +1 -1
  102. package/dist/{layers.DRN4BpGT.js → layers.CiGiXdW0.js} +1 -1
  103. package/dist/{layers.FzqiVsy_.js → layers.Ck5r7FLY.js} +1 -1
  104. package/dist/{layers.xFbuP3DI.js → layers.CkM48uS9.js} +1 -1
  105. package/dist/{layers.CvePRtuZ.js → layers.Cl9S-4Pe.js} +1 -1
  106. package/dist/{layers.Cn8CWsBB.js → layers.CoCas1TR.js} +1 -1
  107. package/dist/{layers.BC_YpOSp.js → layers.Cp0-bIRY.js} +1 -1
  108. package/dist/{layers.DyciwgGK.js → layers.CpxSB-RY.js} +1 -1
  109. package/dist/{layers.COTQMo6A.js → layers.Cs-91dHA.js} +1 -1
  110. package/dist/{layers.CwAI9EMJ.js → layers.Csa1VvEE.js} +3 -3
  111. package/dist/{layers.teIuFApS.js → layers.CslLaJk_.js} +1 -1
  112. package/dist/{layers.Bnjo7X5G.js → layers.CuR5VVPK.js} +1 -1
  113. package/dist/{layers.DZ-JaYP3.js → layers.CvEHURtU.js} +1 -1
  114. package/dist/{layers.aLsmNBld.js → layers.CvGS___n.js} +1 -1
  115. package/dist/{layers.CFAdy1gb.js → layers.CxUdn3NH.js} +1 -1
  116. package/dist/{layers.CztSiz59.js → layers.CydBhqPl.js} +1 -1
  117. package/dist/{layers.DIk_oySe.js → layers.CzuvYlVS.js} +1 -1
  118. package/dist/{layers.CxcPHDlk.js → layers.D3ETIEPw.js} +1 -1
  119. package/dist/{layers.Cr0gsM_j.js → layers.D5Y3jocj.js} +5 -5
  120. package/dist/{layers.DbdtbmtQ.js → layers.D6DW5vEY.js} +1 -1
  121. package/dist/{layers.BrPGpTKD.js → layers.D6G3COyk.js} +13560 -13476
  122. package/dist/{layers.tZA_LmJa.js → layers.D7jViIYU.js} +1 -1
  123. package/dist/{layers.LtQ1yaSI.js → layers.D8LVQ3ZY.js} +1 -1
  124. package/dist/{layers.CfUup9qJ.js → layers.D8tNGYAu.js} +1 -1
  125. package/dist/{layers.BSWJm3U8.js → layers.D98-ldv6.js} +1 -1
  126. package/dist/{layers.CIvcS__9.js → layers.DBF94XFg.js} +1 -1
  127. package/dist/{layers.C7b_RmTv.js → layers.DBFr2bUd.js} +1 -1
  128. package/dist/{layers.BBT4Tvg5.js → layers.DC8w8IZi.js} +1 -1
  129. package/dist/layers.DEGygGYH.js +1 -0
  130. package/dist/{layers.CCHvuvhF.js → layers.DG37kMJR.js} +1 -1
  131. package/dist/{layers.DxABmn5O.js → layers.DG8L4wIG.js} +1 -1
  132. package/dist/{layers.BhvmN99n.js → layers.DGcUMS0Y.js} +1 -1
  133. package/dist/{layers.DPlTEtvi.js → layers.DHj5lmQt.js} +1 -1
  134. package/dist/{layers.B0YPk_J2.js → layers.DIPLdCyl.js} +1 -1
  135. package/dist/{layers.DZDZ3CuA.js → layers.DJaA-u-I.js} +1 -1
  136. package/dist/{layers.CUV2M_pU.js → layers.DJs9wM3X.js} +1 -1
  137. package/dist/{layers.B1Asn8n_.js → layers.DKUdJiaR.js} +2 -2
  138. package/dist/{layers.Blhb8ubC.js → layers.DRlDj5iQ.js} +1 -1
  139. package/dist/{layers.CFL3W3X8.js → layers.DRxlnsz8.js} +1 -1
  140. package/dist/{layers.B4n7r8Ul.js → layers.DTz-KpDZ.js} +1 -1
  141. package/dist/{layers.AHmwp-MB.js → layers.DUcUGFmf.js} +1 -1
  142. package/dist/{layers.C9Lko7YH.js → layers.DUhN3YqR.js} +1 -1
  143. package/dist/{layers.U7NY32uM.js → layers.DVKcHQP4.js} +1 -1
  144. package/dist/{layers.Df3tBKAI.js → layers.DVntzq3z.js} +1 -1
  145. package/dist/{layers.mlObVGIf.js → layers.DW7LKZ0_.js} +1 -1
  146. package/dist/{layers.CkpDbJMJ.js → layers.DXfvADbO.js} +1 -1
  147. package/dist/layers.DZCT2Mg-.js +1314 -0
  148. package/dist/{layers.DaHHbgHM.js → layers.D_beONxk.js} +1 -1
  149. package/dist/{layers.z2kEcNVH.js → layers.Dbm3hiPL.js} +1 -1
  150. package/dist/{layers.Dvv8fKKk.js → layers.DcHhrRyA.js} +1 -1
  151. package/dist/{layers.BfWe9IcW.js → layers.Dd6kYaXy.js} +1 -1
  152. package/dist/{layers.CwLijGjy.js → layers.DdXWqMWK.js} +1 -1
  153. package/dist/{layers.DZZUeo4N.js → layers.DfiQKKL6.js} +1 -1
  154. package/dist/{layers.iXNkI0ZC.js → layers.DhPRmiMt.js} +1 -1
  155. package/dist/{layers.B5AMuW0E.js → layers.DhySCQVw.js} +1 -1
  156. package/dist/{layers.DwPIhine.js → layers.Di5OB7o7.js} +1 -1
  157. package/dist/{layers.CT2g1VRg.js → layers.Di82CoED.js} +1 -1
  158. package/dist/{layers.C53iq2Ma.js → layers.DiL6nhZW.js} +1 -1
  159. package/dist/{layers.CcwJpgwT.js → layers.Diyb97EX.js} +3 -3
  160. package/dist/{layers.Chpc9546.js → layers.DjZrXDXn.js} +1 -1
  161. package/dist/{layers.B9Xz7B4H.js → layers.DjjlhtCb.js} +1 -1
  162. package/dist/{layers.2VLsd23I.js → layers.DktiF6wI.js} +1 -1
  163. package/dist/{layers.B-EeOsPN.js → layers.Dlo3gmCf.js} +1 -1
  164. package/dist/{layers.Bx77WE5O.js → layers.Dngx99va.js} +1 -1
  165. package/dist/{layers.D2P7q6AR.js → layers.DrCegXS7.js} +1 -1
  166. package/dist/{layers.iT9k4umn.js → layers.Dsjwdeov.js} +1 -1
  167. package/dist/{layers.ehSnv8t3.js → layers.DuAKqNV4.js} +1 -1
  168. package/dist/{layers.-2KfQ6RG.js → layers.DvtOcWdD.js} +1 -1
  169. package/dist/{layers.D37qejd1.js → layers.Dx0gFI_8.js} +3 -3
  170. package/dist/{layers.dL8A7U4Q.js → layers.DyI1UB-M.js} +1 -1
  171. package/dist/{layers.Dj860md7.js → layers.Dywy71My.js} +1 -1
  172. package/dist/{layers.BPdavEfb.js → layers.EhSWkpTH.js} +1 -1
  173. package/dist/{layers.DeT0xAwz.js → layers.Hlsf4WAl.js} +1 -1
  174. package/dist/{layers.Bi4--lcT.js → layers.I-yaQKvi.js} +1 -1
  175. package/dist/{layers.DOK4tUdd.js → layers.IP5Q54QC.js} +4 -4
  176. package/dist/{layers.D1ALzL8l.js → layers.IUszdZkA.js} +1 -1
  177. package/dist/{layers.DLaija6u.js → layers.JJZGIQ_O.js} +1 -1
  178. package/dist/{layers.JZ7AxwMh.js → layers.JK4CPmb2.js} +1 -1
  179. package/dist/{layers.B1QlqLSe.js → layers.LU2ER-pA.js} +1 -1
  180. package/dist/{layers.DwS8V2Or.js → layers.M4pn2wm-.js} +1 -1
  181. package/dist/{layers.DQUdAZyr.js → layers.PLuaosLv.js} +3 -3
  182. package/dist/{layers.F57MyVA9.js → layers.PTKeHAhs.js} +1 -1
  183. package/dist/{layers.DvSTgxkV.js → layers.Pum1ALdT.js} +1 -1
  184. package/dist/{layers.CzQlolTW.js → layers.VUXyPQnV.js} +1 -1
  185. package/dist/{layers.D53pVbAt.js → layers.VyIOesty.js} +1 -1
  186. package/dist/{layers.eYOpCcnf.js → layers.Ze-wao45.js} +1 -1
  187. package/dist/{layers.C3_GElaJ.js → layers._dfPZGuq.js} +1 -1
  188. package/dist/{layers.CUGBlmw8.js → layers.aT2npTXt.js} +1 -1
  189. package/dist/{layers.HhdqZtv5.js → layers.ba2tniXd.js} +1 -1
  190. package/dist/{layers.SM9QTuDI.js → layers.bv5XSWTF.js} +3 -3
  191. package/dist/layers.c7P3mcxJ.js +1 -0
  192. package/dist/{layers.xI6XwkCk.js → layers.dDOcJyrx.js} +1 -1
  193. package/dist/{layers.C8WbGo3j.js → layers.eQTvi5Gi.js} +1 -1
  194. package/dist/{layers.CFcETIOb.js → layers.ezjomIHR.js} +1 -1
  195. package/dist/{layers.ZbGNGWJD.js → layers.gFANqZul.js} +2 -2
  196. package/dist/{layers.C6ueC3Z0.js → layers.gbsNfZYX.js} +1 -1
  197. package/dist/{layers.BQjo-s-b.js → layers.h_l-O4Ya.js} +1453 -1447
  198. package/dist/{layers.D8s5zGyA.js → layers.i4tkD9gF.js} +3 -3
  199. package/dist/{layers.DX9VTWiX.js → layers.iwts8VqI.js} +1 -1
  200. package/dist/{layers.7oPXw6se.js → layers.jASAtfrf.js} +1 -1
  201. package/dist/{layers.6fNZWRMy.js → layers.jC4CNUhM.js} +1 -1
  202. package/dist/{layers.ChRuHm3l.js → layers.khwx4QvE.js} +1 -1
  203. package/dist/{layers.CAFSzILX.js → layers.lTT2Z5W-.js} +3 -3
  204. package/dist/{layers.CyqBb3la.js → layers.mY4jXoD0.js} +1 -1
  205. package/dist/{layers.DkYYvaOJ.js → layers.maXwdOZO.js} +1 -1
  206. package/dist/{layers.5g-d1lPI.js → layers.oBoAHASG.js} +292 -304
  207. package/dist/{layers.DUrkRJKo.js → layers.v6OYKSou.js} +1 -1
  208. package/dist/{layers.y9CU_epE.js → layers.zaXLl66X.js} +1 -1
  209. package/package.json +7 -3
  210. package/dist/layers.3t60RULo.js +0 -1314
  211. package/dist/layers.B0aoB6yM.js +0 -1
  212. package/dist/layers.Bwc-8Isq.js +0 -6
  213. package/dist/layers.CSJKF8Yc.js +0 -1
  214. package/dist/layers.CyJLYOzo.js +0 -1
  215. package/dist/layers.DGptlsw9.js +0 -8
  216. package/dist/layers.DLBYO9Pf.js +0 -7
@@ -1 +0,0 @@
1
- "use strict";const e=require("./layers.DOK4tUdd.js"),a=(n,r)=>e.Utils.lang.round(e.Color.parse(n)[r]);exports.channel=a;
@@ -1,6 +0,0 @@
1
- import { e as o, j as s, o as f } from "./layers.BQjo-s-b.js";
2
- export {
3
- o as default,
4
- s as en,
5
- f as kaa
6
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./layers.CUV2M_pU.js");require("./layers.DZqU-iL6.js");exports.Commands=e.CB;exports.subsetToBase64=e.QB;exports.subsetToBinary=e.NQ;exports.toBase64=e.AI;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),$=require("react-i18next"),z=require("@lexical/react/LexicalComposerContext"),x=require("@mantine/core"),N=require("lexical"),o=require("./layers.3t60RULo.js"),B=require("@layers-app/shared"),H=require("@lexical/react/useLexicalEditable"),R=require("@mantine/hooks");require("@lexical/react/LexicalDecoratorBlockNode");require("@lexical/utils");require("@lexical/mark");require("@lexical/code");require("@lexical/selection");require("react-dom");require("@lexical/react/LexicalErrorBoundary");require("@lexical/react/LexicalBlockWithAlignableContents");require("@mantine/notifications");function ke(e,r){const i=document.createElement("a");i.href=e,i.download=r,i.rel="noopener",document.body.appendChild(i),i.click(),i.remove()}function V(e){try{const i=new URL(e,window.location.origin).pathname.split("/").pop()||"image";return i.includes(".")?i:`${i}.png`}catch{return"image"}}async function G(e,r){const i=await fetch(e);if(!i.ok)throw new Error("fetch failed");const s=await i.blob(),l=URL.createObjectURL(s);try{ke(l,r)}finally{setTimeout(()=>URL.revokeObjectURL(l),0)}}function ve({editor:e,nodeKey:r,href:i,onClose:s}){const[l,c]=a.useState(()=>o.getLinkTypeFromUrl(i)),[d,u]=a.useState(()=>o.removeProtocol(i)),[I,v]=a.useState(!1),f=a.useCallback(g=>{c(g),v(!1)},[]),h=a.useCallback(g=>{u(g),v(!1)},[]),b=a.useCallback(()=>{const g=o.addProtocolIfNeeded(d.trim(),l);if(!g||!o.isValidUrl(g,l)){v(!0);return}o.$writeImageLinkToNode(e,r,o.sanitizeUrl(g)),s()},[e,r,d,l,s]),C=a.useCallback(()=>{o.$writeImageLinkToNode(e,r,""),s()},[e,r,s]),y=a.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),b()):g.key==="Escape"&&(g.preventDefault(),s())},[b,s]);return{linkType:l,linkUrl:d,error:I,onLinkTypeChange:f,onUrlInputChange:h,onUrlInputKeyDown:y,onSave:b,onRemove:C}}function X({editor:e,nodeKey:r,href:i,onClose:s,mobile:l}){const c=a.useRef(null),d=ve({editor:e,nodeKey:r,href:i,onClose:s});return a.useEffect(()=>{var u;(u=c.current)==null||u.focus({preventScroll:!0})},[]),t.jsx(o.CreateMode,{inputRef:c,linkUrl:d.linkUrl,linkType:d.linkType,error:d.error,mobile:l,onLinkTypeChange:d.onLinkTypeChange,onUrlInputChange:d.onUrlInputChange,onUrlInputKeyDown:d.onUrlInputKeyDown,onCancel:s,onSave:d.onSave,onRemove:i?d.onRemove:void 0})}function re({opened:e,onOpenChange:r,t:i,onDownload:s,onDelete:l,hasLink:c,onLinkAction:d}){return t.jsxs(x.Menu,{opened:e,onChange:r,transitionProps:o.animationMenu,shadow:"md",position:"bottom-start",offset:4,withinPortal:!0,closeOnItemClick:!0,children:[t.jsx(x.Menu.Target,{children:t.jsx(o.ActionIcon,{label:i("editor.toolbar.more"),icon:o.K1,iconColor:"var(--mantine-color-gray-text)","aria-label":i("editor.toolbar.more")})}),t.jsxs(x.Menu.Dropdown,{p:4,miw:164,w:"max-content",onMouseDown:u=>u.preventDefault(),children:[d&&t.jsx(x.Menu.Item,{leftSection:t.jsx(x.Flex,{align:"center",justify:"center",c:"gray.6",children:t.jsx(o.Icon,{name:"link",size:16})}),onClick:u=>{u.stopPropagation(),d()},children:i(c?"editor.link.editLink":"editor.link.addLink")}),t.jsx(x.Menu.Item,{leftSection:t.jsx(x.Flex,{align:"center",justify:"center",c:"gray.6",children:t.jsx(o.HugeiconsIcon,{icon:o.Tm,size:16})}),onClick:u=>{u.stopPropagation(),s()},children:i("editor.gallery.download")}),t.jsx(x.Menu.Item,{color:"red",leftSection:t.jsx(x.Flex,{align:"center",justify:"center",c:"red.6",children:t.jsx(o.HugeiconsIcon,{icon:o.lg,size:16})}),onClick:u=>{u.stopPropagation(),l()},children:i("editor.contextMenu.delete")})]})]})}const se=({t:e,src:r,setShown:i,id:s})=>{const[l,{open:c,close:d}]=R.useDisclosure(!1),u=o.useCanDownload(),I=a.useMemo(()=>[{id:!s||s==="0"?"":s,Url:r??"",contentType:"image/*",originalFileName:"",fileSize:0,storageType:"",storagePath:"",fileName:"",parentType:"",parentId:"",ownerId:"",createdAt:new Date,updatedAt:new Date,version:0,deleted:!1,deletedAt:new Date}],[r,s]),v=f=>{f?c():d()};return t.jsxs(t.Fragment,{children:[t.jsx(B.AttachmentsGalleryModal,{opened:l,onOpenChange:v,attachments:I,allowDownload:u}),t.jsx(o.ActionIcon,{label:e("editor.image.preview"),icon:o.gn,iconColor:"var(--mantine-color-gray-text)","aria-label":e("editor.image.preview"),onClick:()=>{i(!1),c()}})]})},ye=({nodeKey:e,src:r,href:i})=>{const[s]=z.useLexicalComposerContext(),l=H.useLexicalEditable(),[c,d]=a.useState(!1),[u,I]=a.useState(!1),[v,f]=a.useState(!1),{t:h}=$.useTranslation();a.useEffect(()=>{if(!v)return;const y=g=>{const k=g.target;k!=null&&k.closest(".floating-link-dropdown")||k!=null&&k.closest(".floating-link-type-combobox-dropdown")||f(!1)};return document.addEventListener("pointerdown",y,!0),()=>document.removeEventListener("pointerdown",y,!0)},[v]);const b=a.useCallback(()=>{s.update(()=>{const y=N.$getNodeByKey(e);o.$isImageNode(y)&&y.remove()})},[s,e]),C=a.useCallback(async()=>{if(r)try{await G(r,V(r))}catch{}},[r]);return t.jsxs(x.Popover,{opened:v,onChange:f,position:"bottom-end",offset:4,shadow:"md",radius:"md",withinPortal:!0,closeOnClickOutside:!1,children:[t.jsx(x.Popover.Target,{children:t.jsxs("div",{className:`media-actions ${l?"":"media-actions--readonly"}`,children:[t.jsx(se,{t:h,src:r,setShown:()=>{}}),l&&t.jsxs(t.Fragment,{children:[t.jsx(o.NodeAlignmentMenu,{opened:c,setOpened:d,t:h,editor:s,nodeKey:e,setShown:()=>{}}),t.jsx(re,{opened:u,onOpenChange:I,t:h,onDownload:()=>void C(),onDelete:b,hasLink:!!i,onLinkAction:()=>f(!0)})]})]})}),t.jsx(x.Popover.Dropdown,{className:`floating-link-dropdown floating-link-dropdown--${i?"edit":"create"}-mode`,"data-test-id":"floating-link-dropdown",children:t.jsx(X,{editor:s,nodeKey:e,href:i,onClose:()=>f(!1)})})]})},Ce=()=>{};function Ie({nodeKey:e,src:r,id:i,href:s}){const{t:l}=$.useTranslation(),[c]=z.useLexicalComposerContext(),d=H.useLexicalEditable(),[u,I]=a.useState(!1),[v,f]=a.useState(!1),[h,b]=a.useState(!1);a.useEffect(()=>{if(!h)return;const g=k=>{const p=k.target;p!=null&&p.closest(".floating-link-dropdown")||p!=null&&p.closest(".floating-link-type-combobox-dropdown")||b(!1)};return document.addEventListener("pointerdown",g,!0),()=>document.removeEventListener("pointerdown",g,!0)},[h]);const C=a.useCallback(()=>{f(!1),c.update(()=>{const g=N.$getNodeByKey(e);if(!o.$isImageNode(g))return;const k=g.getParent();o.$isImageOverlayWrapperNode(k)?k.remove():g.remove()})},[c,e]),y=a.useCallback(async()=>{if(r)try{await G(r,V(r))}catch{}},[r]);return t.jsxs(x.Popover,{opened:h,onChange:b,position:"bottom-end",offset:4,shadow:"md",radius:"md",withinPortal:!0,closeOnClickOutside:!1,children:[t.jsx(x.Popover.Target,{children:t.jsxs("div",{className:"media-actions visible",style:{position:"absolute",top:10,right:10,zIndex:10,pointerEvents:"auto",display:"flex",gap:4},onClick:g=>g.stopPropagation(),children:[t.jsx(se,{t:l,src:r,setShown:Ce,id:i}),d&&t.jsxs(t.Fragment,{children:[t.jsx(o.NodeAlignmentMenu,{opened:u,setOpened:I,t:l,editor:c,nodeKey:e}),t.jsx(re,{opened:v,onOpenChange:f,t:l,onDownload:()=>void y(),onDelete:C,hasLink:!!s,onLinkAction:()=>b(!0)})]})]})}),t.jsx(x.Popover.Dropdown,{className:`floating-link-dropdown floating-link-dropdown--${s?"edit":"create"}-mode`,"data-test-id":"floating-link-dropdown",children:t.jsx(X,{editor:c,nodeKey:e,href:s,onClose:()=>b(!1)})})]})}function je({nodeKey:e,src:r,id:i,href:s}){const{t:l}=$.useTranslation(),[c]=z.useLexicalComposerContext(),d=H.useLexicalEditable(),u=o.useCanDownload(),[I,{open:v,close:f}]=R.useDisclosure(!1),[h,{open:b,close:C}]=R.useDisclosure(!1),[y,{open:g,close:k}]=R.useDisclosure(!1),p=()=>{f(),g()},L=a.useMemo(()=>[{id:!i||i==="0"?"":i,Url:r??"",contentType:"image/*",originalFileName:"",fileSize:0,storageType:"",storagePath:"",fileName:"",parentType:"",parentId:"",ownerId:"",createdAt:new Date,updatedAt:new Date,version:0,deleted:!1,deletedAt:new Date}],[r,i]),E=()=>{f(),b()},D=a.useCallback(async()=>{if(f(),!!r)try{await G(r,V(r))}catch{}},[r,f]),T=a.useCallback(()=>{f(),c.update(()=>{const S=N.$getNodeByKey(e);o.$isImageNode(S)&&S.remove()})},[c,e,f]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"image-touch-actions",style:{position:"absolute",top:8,right:8,zIndex:10,pointerEvents:"auto"},onClick:S=>S.stopPropagation(),children:t.jsx(o.ActionIcon,{label:l("editor.toolbar.more"),icon:o.O1,iconColor:"var(--mantine-color-gray-text)","aria-label":l("editor.toolbar.more"),onClick:v})}),t.jsx(B.AttachmentsGalleryModal,{opened:h,onOpenChange:S=>S?b():C(),attachments:L,allowDownload:u}),t.jsx(o.MobileDrawer,{opened:I,onClose:f,title:l("editor.image.mobileActions"),children:t.jsxs(x.Stack,{gap:4,p:0,children:[t.jsx(x.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:E,leftSection:t.jsx(o.HugeiconsIcon,{icon:o.gn,size:16,color:"var(--mantine-color-dimmed)"}),children:l("editor.image.previewFullScreen")}),d&&t.jsx(x.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:p,leftSection:t.jsx(o.HugeiconsIcon,{icon:o.zz,size:16,color:"var(--mantine-color-dimmed)"}),children:l(s?"editor.link.editLink":"editor.link.addLink")}),u&&t.jsx(x.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:()=>void D(),leftSection:t.jsx(o.HugeiconsIcon,{icon:o.Tm,size:16,color:"var(--mantine-color-dimmed)"}),children:l("editor.gallery.download")}),d&&t.jsx(x.Button,{type:"button",variant:"subtle",color:"red",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:T,leftSection:t.jsx(o.HugeiconsIcon,{icon:o.lg,size:16,color:"var(--mantine-color-red-6)"}),children:l("editor.actions.delete")})]})}),t.jsx(o.MobileDrawer,{opened:y,onClose:k,title:l(s?"editor.link.editLink":"editor.link.addLink"),children:t.jsx(X,{editor:c,nodeKey:e,href:s,onClose:k,mobile:!0})})]})}const ae=e=>{const{width:r,height:i,isLoading:s,isError:l,src:c,id:d,altText:u,imageRef:I,maxWidth:v,aspectRatio:f,href:h}=e,b=a.useRef(null);return t.jsxs("div",{className:"media-wrapper","data-reserved-box":f?"":void 0,style:{width:r,height:f?"auto":i,aspectRatio:f||void 0,display:"inline-flex",position:"relative"},children:[t.jsx(x.LoadingOverlay,{visible:s,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),t.jsx("a",{className:"editor-image-link","data-link":h?"true":void 0,"data-href":h?o.sanitizeUrl(h):void 0,role:h?"link":void 0,rel:h?"noopener noreferrer":void 0,draggable:!1,onMouseDown:h?C=>{b.current={x:C.clientX,y:C.clientY}}:void 0,onClick:h?C=>{C.preventDefault();const y=b.current;b.current=null,!(y&&Math.hypot(C.clientX-y.x,C.clientY-y.y)>5)&&window.open(o.sanitizeUrl(h),"_blank","noopener,noreferrer")}:void 0,children:t.jsx(De,{className:null,src:c,altText:u,imageRef:I,width:"inherit",height:"inherit",maxWidth:v||"auto",id:d})}),o.IS_TOUCH_DEVICE&&t.jsx(je,{nodeKey:e.nodeKey,src:c,id:d,href:h}),o.IS_TOUCH_TABLET&&t.jsx(Ie,{nodeKey:e.nodeKey,src:c,id:d,href:h}),o.IS_HOVER_CAPABLE&&!o.IS_TOUCH_DEVICE&&!o.IS_TOUCH_TABLET&&t.jsx(ye,{nodeKey:e.nodeKey,src:c,href:h})]})};function De({altText:e,className:r,imageRef:i,src:s,width:l,height:c,maxWidth:d,id:u}){const[I,v]=a.useState(!1);return t.jsx("img",{className:`${r||void 0} ${I?"":"loading"}`,src:s,alt:e,ref:i,style:{height:c,maxWidth:d,width:l},onLoad:()=>{s.includes("splash")?setTimeout(()=>{v(!0)},100):v(!0)},draggable:"false","data-id":u})}function Ne(e){const{disable:r}=a.useContext(o.Context);return r&&o.ImageNode.isPlaceholderSrc(e.src)?null:t.jsx(Se,{...e})}function Se({src:e,altText:r,nodeKey:i,width:s,height:l,maxWidth:c,showCaption:d,caption:u,id:I,create:v,alignment:f,imagePickerTab:h,aspectRatio:b,href:C}){var oe,ne;const y=a.useRef(null),[g,k]=a.useState(!0),[p]=z.useLexicalComposerContext(),[L,E]=a.useState(!0),[D,T]=a.useState({width:0,height:0}),{start:S}=o.useCancelUpload(),[Le,W]=a.useState(0),{fetchUploadMedia:O,fetchDeleteMedia:Y,maxFileSize:Ee,imperativeHandleRef:M,disable:le}=a.useContext(o.Context),U=o.mediaMap.has(e)&&(((oe=o.mediaMap.get(e))==null?void 0:oe.mediaNodeKeys.length)===0||((ne=o.mediaMap.get(e))==null?void 0:ne.mediaNodeKeys.length)===void 0||e.trim()===""),{t:A}=$.useTranslation(),Z=n=>{if(typeof n=="number")return n>0?n:null;if(typeof n=="string"&&!n.includes("%")){const w=parseFloat(n);return Number.isFinite(w)&&w>0?w:null}return null},P=Z(s),J=Z(l),Q=P&&J?P/J:void 0,[de,ce]=a.useState(void 0),K=a.useMemo(()=>{try{const n=parseFloat(localStorage.getItem("layers-img-ratio:"+e)||"");return Number.isFinite(n)&&n>0?n:void 0}catch{return}},[e]),ue=Q??b??K??de,[ge,F]=a.useState(!1),pe=!ge&&!Q&&(b??K)!=null,[Te,me]=a.useState(0);a.useEffect(()=>p.registerDecoratorListener(()=>{me(n=>n+1)}),[U]),a.useEffect(()=>{const n=p.getElementByKey(i);n&&(n.style.removeProperty("aspect-ratio"),n.style.removeProperty("width"))},[p,i]),a.useEffect(()=>{if(!e||e.startsWith("data:image/")||!e.trim()){k(!1);return}const n=new Image;n.src=e,n.onload=()=>{if(k(!1),n.naturalWidth){const w=n.naturalWidth/n.naturalHeight;if(ce(w),n.naturalWidth>=100)try{localStorage.setItem("layers-img-ratio:"+e,String(w))}catch{}!b&&n.naturalWidth>=100&&p.update(()=>{const m=N.$getNodeByKey(i);o.$isImageNode(m)&&m.getAspectRatio()==null&&m.setAspectRatio(w)},{tag:"history-merge"})}},n.onerror=()=>{k(!1)}},[e,U]);const fe=(n,w)=>{p.update(()=>{N.$setSelection(null);const m=N.$getNodeByKey(i);o.$isImageNode(m)&&m.setWidthAndHeight(n,w)})},{historyState:ee}=o.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:te}}=o.useSettings();function he(n){return n.endsWith(".svg")||n.includes("image/svg+xml")}function we(n){if(!n.startsWith("data:"))return 0;try{const w=n.slice(n.indexOf(",")+1),m=n.includes(";base64,")?atob(w):decodeURIComponent(w),j=m.match(/viewBox\s*=\s*["']\s*[\d.eE+\-]+\s+[\d.eE+\-]+\s+([\d.eE+]+)\s+([\d.eE+]+)/i);if(j)return Math.round(parseFloat(j[1]));const ie=m.match(/\bwidth\s*=\s*["'](\d[\d.]*)(?:px)?["']/i);if(ie)return Math.round(parseFloat(ie[1]))}catch{}return 0}function xe(n){return new Promise((w,m)=>{if(he(n)){w(we(n));return}const j=new Image;j.src=n,j.onload=()=>{w(j.width)},j.onerror=()=>{m(new Error("Failed to load image"))}})}a.useEffect(()=>{let n=s,w=l,m=100;if((e.includes("unsplash")?e.trim():!U&&e.trim()||e.includes("upload-src-editor"))&&e!=="upload"){if(P!=null&&P>=m){E(!1),T({width:P,height:P}),F(!0);return}xe(e).then(j=>{typeof n=="number"&&n<m&&j<m?(E(!0),T({width:n,height:w})):j<m?(E(!0),T({width:"auto",height:"auto"})):(T({width:j,height:j}),E(!1)),F(!0)}).catch(j=>{F(!0),console.warn("Ошибка при загрузке изображения:",j.message)})}},[e,U]),a.useEffect(()=>{D.width&&D.height&&L&&p.update(()=>{const n=N.$getNodeByKey(i);o.$isImageNode(n)&&n.setWidthAndHeight(D.width,D.height)})},[D.width,D.height,L]);const be=a.useCallback(n=>o.$writeImagePickerTabToNode(p,i,n),[p,i]),_=a.useCallback((n,w)=>{k(!1),p.update(()=>{const m=N.$getNodeByKey(i);o.$isImageNode(m)&&(m.setSrc(n),m.setId(w))})},[p,i]),q=a.useCallback(n=>{k(!0);const w=S();O&&O(n[0],(m,j)=>{_(m,j),W(0)},m=>{m&&B.showErrorNotification({message:A("editor.gallery.errorFile")}),W(0),_(e.startsWith("blob:")?"upload":"","")},w,m=>{W(m)})},[O,S,A,_,e]);return a.useEffect(()=>p.registerCommand(o.UPLOAD_IMAGE_COMMAND,n=>!e.startsWith("blob:")&&e!=="upload"||n.targetNodeKey!==i?!1:(q(n.files),!0),N.COMMAND_PRIORITY_LOW),[p,q,i,e]),!e||e==="upload"?t.jsx(x.Box,{"data-editor-image-picker-drop-root":!0,w:"100%",children:t.jsx(o.ImagePicker,{inline:!0,nodeKey:i,defaultTabValue:h,onWriteTabToNode:be,uploading:!1,onUpload:n=>{!O||!n.length||q(n)},popoverProps:{opened:!0,position:"bottom",zIndex:o.EDITOR_UI_MIN_Z_INDEX},onChange:n=>{p.update(()=>{const w=N.$getNodeByKey(i);o.$isImageNode(w)&&w.setSrc(n)})}})}):L&&!pe?t.jsx(ae,{width:D.width,height:D.height,isLoading:g,isError:!1,isIcon:L,src:e,id:I,editor:p,nodeKey:i,fetchDeleteMedia:Y,altText:r,imageRef:y,maxWidth:c,showCaption:d,caption:u,isCollabActive:!1,historyState:ee,showNestedEditorTreeView:te,t:A,href:C}):t.jsx(o.ResizableContainer,{editor:p,isIcon:L,width:o.parseContainerSize(s),height:o.parseContainerSize(l),initialWidth:D.width||"",initialHeight:D.height||"",onResizeEnd:fe,alignment:f,disable:le,onRegisterDecoratorEnter:n=>{M!=null&&M.current&&(M.current.decoratorEnterAction=n)},onActivate:()=>p.dispatchCommand(o.ON_CHANGE_COMMAND,"show_menu"),children:t.jsx(ae,{width:"inherit",height:"inherit",aspectRatio:ue,isLoading:g,isError:!1,isIcon:L,src:e,id:I,editor:p,nodeKey:i,fetchDeleteMedia:Y,altText:r,imageRef:y,maxWidth:c,showCaption:d,caption:u,isCollabActive:!1,historyState:ee,showNestedEditorTreeView:te,t:A,href:C})})}exports.default=Ne;
@@ -1,8 +0,0 @@
1
- import { C as e, Q as t, N as m, A as r } from "./layers.Bs8dWBby.js";
2
- import "./layers.BQjo-s-b.js";
3
- export {
4
- e as Commands,
5
- t as subsetToBase64,
6
- m as subsetToBinary,
7
- r as toBase64
8
- };
@@ -1,7 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("./layers.DOK4tUdd.js");require("./layers.Dxr2o7ON.js");require("lodash-es/memoize.js");require("lodash-es/merge.js");require("lodash-es/isEmpty.js");const G=20,ct={rect:"rectangle",circle:"ellipse"},Z={startOnLoad:!1,flowchart:{curve:"linear"},themeVariables:{fontSize:`${G*1.25}px`},maxEdges:500,maxTextSize:5e4};class F{constructor({converter:e}){this.convert=(s,r)=>this.converter(s,{...r,fontSize:r.fontSize||G}),this.converter=e}}var v;(function(t){t.ROUND="round",t.STADIUM="stadium",t.DOUBLECIRCLE="doublecircle",t.CIRCLE="circle",t.DIAMOND="diamond"})(v||(v={}));var W;(function(t){t.COLOR="color"})(W||(W={}));var X;(function(t){t.FILL="fill",t.STROKE="stroke",t.STROKE_WIDTH="stroke-width",t.STROKE_DASHARRAY="stroke-dasharray"})(X||(X={}));var $={},Q;function it(){if(Q)return $;Q=1,Object.defineProperty($,"__esModule",{value:!0}),$.removeMarkdown=void 0;var t=function(e,s){s===void 0&&(s={listUnicodeChar:""}),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;var r=e||"";r=r.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*$/gm,"");try{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,`
2
- `).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,`
3
-
4
- `).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,`
5
-
6
- `)}catch(o){return console.error(o),e}return r};return $.removeMarkdown=t,$}var dt=it();const lt={arrow_circle:{endArrowhead:"dot"},arrow_cross:{endArrowhead:"bar"},arrow_open:{endArrowhead:null,startArrowhead:null},double_arrow_circle:{endArrowhead:"dot",startArrowhead:"dot"},double_arrow_cross:{endArrowhead:"bar",startArrowhead:"bar"},double_arrow_point:{endArrowhead:"arrow",startArrowhead:"arrow"}},ut=t=>lt[t],B=t=>{let e=t.text;return t.labelType==="markdown"&&(e=dt.removeMarkdown(t.text)),ht(e)},ht=t=>{const e=/\s?(fa|fab):[a-zA-Z0-9-]+/g;return t.replace(e,"")},ft=t=>{const e={};return Object.keys(t).forEach(s=>{var r;switch(s){case X.FILL:{e.backgroundColor=t[s],e.fillStyle="solid";break}case X.STROKE:{e.strokeColor=t[s];break}case X.STROKE_WIDTH:{e.strokeWidth=Number((r=t[s])==null?void 0:r.split("px")[0]);break}case X.STROKE_DASHARRAY:{e.strokeStyle="dashed";break}}}),e},gt=t=>{const e={};return Object.keys(t).forEach(s=>{switch(s){case W.COLOR:{e.strokeColor=t[s];break}}}),e},bt=t=>{const e={};t.subGraphs.map(r=>{r.nodeIds.forEach(o=>{e[r.id]={id:r.id,parent:null,isLeaf:!1},e[o]={id:o,parent:r.id,isLeaf:t.vertices[o]!==void 0}})});const s={};return[...Object.keys(t.vertices),...t.subGraphs.map(r=>r.id)].forEach(r=>{if(!e[r])return;let o=e[r];const a=[];for(o.isLeaf||a.push(`subgraph_group_${o.id}`);o.parent;)a.push(`subgraph_group_${o.parent}`),o=e[o.parent];s[r]=a}),{getGroupIds:r=>s[r]||[],getParentId:r=>e[r]?e[r].parent:null}},pt=new F({converter:(t,e)=>{const s=[],r=e.fontSize,{getGroupIds:o,getParentId:a}=bt(t);return t.subGraphs.reverse().forEach(n=>{const c=o(n.id),i={id:n.id,type:"rectangle",groupIds:c,x:n.x,y:n.y,width:n.width,height:n.height,label:{groupIds:c,text:B(n),fontSize:r,verticalAlign:"top"}};s.push(i)}),Object.values(t.vertices).forEach(n=>{if(!n)return;const c=o(n.id),i=ft(n.containerStyle),d=gt(n.labelStyle);let l={id:n.id,type:"rectangle",groupIds:c,x:n.x,y:n.y,width:n.width,height:n.height,strokeWidth:2,label:{groupIds:c,text:B(n),fontSize:r,...d},link:n.link||null,...i};switch(n.type){case v.STADIUM:{l={...l,roundness:{type:3}};break}case v.ROUND:{l={...l,roundness:{type:3}};break}case v.DOUBLECIRCLE:{c.push(`doublecircle_${n.id}}`);const u={type:"ellipse",groupIds:c,x:n.x+5,y:n.y+5,width:n.width-10,height:n.height-10,strokeWidth:2,roundness:{type:3},label:{groupIds:c,text:B(n),fontSize:r}};l={...l,groupIds:c,type:"ellipse"},s.push(u);break}case v.CIRCLE:{l.type="ellipse";break}case v.DIAMOND:{l.type="diamond";break}}s.push(l)}),t.edges.forEach(n=>{let c=[];const i=a(n.start),d=a(n.end);i&&i===d&&(c=o(i));const{startX:l,startY:b,reflectionPoints:u}=n,p=u.map(x=>[x.x-u[0].x,x.y-u[0].y]),g=ut(n.type),y={id:`${n.start}_${n.end}`,type:"arrow",groupIds:c,x:l,y:b,strokeWidth:n.stroke==="thick"?4:2,strokeStyle:n.stroke==="dotted"?"dashed":void 0,points:p,...n.text?{label:{text:B(n),fontSize:r,groupIds:c}}:{},roundness:{type:2},...g},S=s.find(x=>x.id===n.start),E=s.find(x=>x.id===n.end);!S||!E||(y.start={id:S.id||""},y.end={id:E.id||""},s.push(y))}),{elements:s}}}),mt="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let N=(t=21)=>{let e="",s=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=mt[s[t]&63];return e};const yt=new F({converter:t=>{const e=N(),{width:s,height:r}=t,o={type:"image",x:0,y:0,width:s,height:r,status:"saved",fileId:e};return{files:{[e]:{id:e,mimeType:t.mimeType,dataURL:t.dataURL}},elements:[o]}}}),V=t=>t.replace(/\\n/g,`
7
- `),M=t=>{const e={type:"line",x:t.startX,y:t.startY,points:[[0,0],[t.endX-t.startX,t.endY-t.startY]],width:t.endX-t.startX,height:t.endY-t.startY,strokeStyle:t.strokeStyle||"solid",strokeColor:t.strokeColor||"#000",strokeWidth:t.strokeWidth||1};return t.groupId&&Object.assign(e,{groupIds:[t.groupId]}),t.id&&Object.assign(e,{id:t.id}),e},z=t=>{const e={type:"text",x:t.x,y:t.y,width:t.width,height:t.height,text:V(t.text)||"",fontSize:t.fontSize,verticalAlign:"middle"};return t.groupId&&Object.assign(e,{groupIds:[t.groupId]}),t.id&&Object.assign(e,{id:t.id}),e},P=t=>{var r,o,a,n;let e={};t.type==="rectangle"&&t.subtype==="activation"&&(e={backgroundColor:"#e9ecef",fillStyle:"solid"});const s={id:t.id,type:t.type,x:t.x,y:t.y,width:t.width,height:t.height,label:{text:V(((r=t==null?void 0:t.label)==null?void 0:r.text)||""),fontSize:(o=t==null?void 0:t.label)==null?void 0:o.fontSize,verticalAlign:((a=t.label)==null?void 0:a.verticalAlign)||"middle",strokeColor:((n=t.label)==null?void 0:n.color)||"#000",groupIds:t.groupId?[t.groupId]:[]},strokeStyle:t==null?void 0:t.strokeStyle,strokeWidth:t==null?void 0:t.strokeWidth,strokeColor:t==null?void 0:t.strokeColor,backgroundColor:t==null?void 0:t.bgColor,fillStyle:"solid",...e};return t.groupId&&Object.assign(s,{groupIds:[t.groupId]}),s},st=t=>{var s;const e={type:"arrow",x:t.startX,y:t.startY,points:t.points||[[0,0],[t.endX-t.startX,t.endY-t.startY]],width:t.endX-t.startX,height:t.endY-t.startY,strokeStyle:(t==null?void 0:t.strokeStyle)||"solid",endArrowhead:(t==null?void 0:t.endArrowhead)||null,startArrowhead:(t==null?void 0:t.startArrowhead)||null,label:{text:V(((s=t==null?void 0:t.label)==null?void 0:s.text)||""),fontSize:16},roundness:{type:2},start:t.start,end:t.end};return t.groupId&&Object.assign(e,{groupIds:[t.groupId]}),e},xt=new F({converter:t=>{const e=[],s=[];if(Object.values(t.nodes).forEach(r=>{!r||!r.length||r.forEach(o=>{let a;switch(o.type){case"line":a=M(o);break;case"rectangle":case"ellipse":a=P(o);break;case"text":a=z(o);break;default:throw`unknown type ${o.type}`}o.type==="rectangle"&&(o==null?void 0:o.subtype)==="activation"?s.push(a):e.push(a)})}),Object.values(t.lines).forEach(r=>{r&&e.push(M(r))}),Object.values(t.arrows).forEach(r=>{r&&(e.push(st(r)),r.sequenceNumber&&e.push(P(r.sequenceNumber)))}),e.push(...s),t.loops){const{lines:r,texts:o,nodes:a}=t.loops;r.forEach(n=>{e.push(M(n))}),o.forEach(n=>{e.push(z(n))}),a.forEach(n=>{e.push(P(n))})}return t.groups&&t.groups.forEach(r=>{const{actorKeys:o,name:a}=r;let n=1/0,c=1/0,i=0,d=0;if(!o.length)return;e.filter(f=>{if(f.id){const C=f.id.indexOf("-"),I=f.id.substring(0,C);return o.includes(I)}}).forEach(f=>{if(f.x===void 0||f.y===void 0||f.width===void 0||f.height===void 0)throw new Error(`Actor attributes missing ${f}`);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)});const b=10,u=n-b,p=c-b,g=i-n+b*2,m=d-c+b*2,y=N(),S=P({type:"rectangle",x:u,y:p,width:g,height:m,bgColor:r.fill,id:y});e.unshift(S);const E=N(),x=[y];e.forEach(f=>{if(f.type!=="frame"){if(f.x===void 0||f.y===void 0||f.width===void 0||f.height===void 0)throw new Error(`Element attributes missing ${f}`);if(f.x>=n&&f.x+f.width<=i&&f.y>=c&&f.y+f.height<=d){const C=f.id||N();f.id||Object.assign(f,{id:C}),x.push(C)}}});const h={type:"frame",id:E,name:a,children:x};e.push(h)}),{elements:e}}}),Et=new F({converter:t=>{const e=[];return Object.values(t.nodes).forEach(s=>{!s||!s.length||s.forEach(r=>{let o;switch(r.type){case"line":o=M(r);break;case"rectangle":case"ellipse":o=P(r);break;case"text":o=z(r);break;default:throw`unknown type ${r.type}`}e.push(o)})}),Object.values(t.lines).forEach(s=>{s&&e.push(M(s))}),Object.values(t.arrows).forEach(s=>{if(!s)return;const r=st(s);e.push(r)}),Object.values(t.text).forEach(s=>{const r=z(s);e.push(r)}),Object.values(t.namespaces).forEach(s=>{const r=Object.keys(s.classes),o=[...r],a=[...t.lines,...t.arrows,...t.text];r.forEach(c=>{const i=a.filter(d=>d.metadata&&d.metadata.classId===c).map(d=>d.id);i.length&&o.push(...i)});const n={type:"frame",id:N(),name:s.id,children:o};e.push(n)}),{elements:e}}}),St=(t,e={})=>{switch(t.type){case"graphImage":return yt.convert(t,e);case"flowchart":return pt.convert(t,e);case"sequence":return xt.convert(t,e);case"class":return Et.convert(t,e);default:throw new Error(`graphToExcalidraw: unknown graph type "${t.type}, only flowcharts are supported!"`)}},R=t=>{t=At(t);const e=t.replace(/#(\d+);/g,"&#$1;").replace(/#([a-z]+);/g,"&$1;"),s=document.createElement("textarea");return s.innerHTML=e,s.value},_=t=>{const e=t.getAttribute("transform"),s=e==null?void 0:e.match(/translate\(([ \d.-]+),\s*([\d.-]+)\)/);let r=0,o=0;return s&&(r=Number(s[1]),o=Number(s[2])),{transformX:r,transformY:o}},wt=t=>{let e=t;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=>{const r=s.substring(1,s.length-1);return/^\+?\d+$/.test(r)?`fl°°${r}¶ß`:`fl°${r}¶ß`}),e},At=function(t){return t.replace(/fl°°/g,"#").replace(/fl°/g,"&").replace(/¶ß/g,";")},nt=(t,e={x:0,y:0})=>{if(t.tagName.toLowerCase()!=="path")throw new Error(`Invalid input: Expected an HTMLElement of tag "path", got ${t.tagName}`);const s=t.getAttribute("d");if(!s)throw new Error('Path element does not contain a "d" attribute');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=>{const i=c.substring(1).split(",").map(d=>parseFloat(d));return{x:i[0],y:i[1]}}).filter((c,i,d)=>{if(i===0||i===d.length-1)return!0;if(c.x===d[i-1].x&&c.y===d[i-1].y)return!1;if(i===d.length-2&&(d[i-1].x===c.x||d[i-1].y===c.y)){const l=d[d.length-1];return Math.hypot(l.x-c.x,l.y-c.y)>20}return c.x!==d[i-1].x||c.y!==d[i-1].y}).map(c=>({x:c.x+e.x,y:c.y+e.y}));return{startX:o[0]+e.x,startY:o[1]+e.y,endX:a[0]+e.x,endY:a[1]+e.y,reflectionPoints:n}},It=(t,e)=>{const s=t.nodes.map(c=>c.startsWith("flowchart-")?c.split("-")[1]:c),r=e.querySelector(`[id='${t.id}']`);if(!r)throw new Error("SubGraph element not found");const o=K(r,e),a=r.getBBox(),n={width:a.width,height:a.height};return t.classes=void 0,t.dir=void 0,{...t,nodeIds:s,...o,...n,text:R(t.title)}},kt=(t,e)=>{var b,u,p;const s=e.querySelector(`[id*="flowchart-${t.id}-"]`);if(!s)return;let r;((b=s.parentElement)==null?void 0:b.tagName.toLowerCase())==="a"&&(r=s.parentElement.getAttribute("xlink:href"));const o=K(r?s.parentElement:s,e),a=s.getBBox(),n={width:a.width,height:a.height},c=(u=s.querySelector(".label-container"))==null?void 0:u.getAttribute("style"),i=(p=s.querySelector(".label"))==null?void 0:p.getAttribute("style"),d={};c==null||c.split(";").forEach(g=>{if(!g)return;const m=g.split(":")[0].trim(),y=g.split(":")[1].trim();d[m]=y});const l={};return i==null||i.split(";").forEach(g=>{if(!g)return;const m=g.split(":")[0].trim(),y=g.split(":")[1].trim();l[m]=y}),{id:t.id,labelType:t.labelType,text:R(t.text),type:t.type,link:r||void 0,...o,...n,containerStyle:d,labelStyle:l}},Tt=(t,e,s)=>{const r=s.querySelector(`[id*="L-${t.start}-${t.end}-${e}"]`);if(!r)throw new Error("Edge element not found");const o=K(r,s),a=nt(r,o);return t.length=void 0,{...t,...a,text:R(t.text)}},K=(t,e)=>{var i;if(!t)throw new Error("Element not found");let s=(i=t.parentElement)==null?void 0:i.parentElement;const r=t.childNodes[0];let o={x:0,y:0};if(r){const{transformX:d,transformY:l}=_(r),b=r.getBBox();o={x:Number(r.getAttribute("x"))||d+b.x||0,y:Number(r.getAttribute("y"))||l+b.y||0}}const{transformX:a,transformY:n}=_(t),c={x:a+o.x,y:n+o.y};for(;s&&s.id!==e.id;){if(s.classList.value==="root"&&s.hasAttribute("transform")){const{transformX:d,transformY:l}=_(s);c.x+=d,c.y+=l}s=s.parentElement}return c},Ot=(t,e)=>{t.parse();const s=t.parser.yy,r=s.getVertices();Object.keys(r).forEach(c=>{r[c]=kt(r[c],e)});const o=new Map,a=s.getEdges().filter(c=>e.querySelector(`[id*="L-${c.start}-${c.end}"]`)).map(c=>{const i=`${c.start}-${c.end}`,d=o.get(i)||0;return o.set(i,d+1),Tt(c,d,e)});return{type:"flowchart",subGraphs:s.getSubGraphs().map(c=>It(c,e)),vertices:r,edges:a}},Ct=(t,e)=>{const s={};e!=null&&e.label&&(s.label={text:R(e.label),fontSize:16});const r=t.tagName;if(r==="line")s.startX=Number(t.getAttribute("x1")),s.startY=Number(t.getAttribute("y1")),s.endX=Number(t.getAttribute("x2")),s.endY=Number(t.getAttribute("y2"));else if(r==="path"){const o=t.getAttribute("d");if(!o)throw new Error('Path element does not contain a "d" attribute');const a=o.split(/(?=[LC])/),n=a[0].substring(1).split(",").map(d=>parseFloat(d)),c=[];a.forEach(d=>{const l=d.substring(1).trim().split(" ").map(b=>{const[u,p]=b.split(",");return[parseFloat(u)-n[0],parseFloat(p)-n[1]]});c.push(...l)});const i=c[c.length-1];s.startX=n[0],s.startY=n[1],s.endX=i[0],s.endY=i[1],s.points=c}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},ot=(t,e,s,r,o)=>{const a={};return a.type="arrow",a.startX=t,a.startY=e,a.endX=s,a.endY=r,Object.assign(a,{...o}),a},H=(t,e,s,r)=>({type:"text",x:t,y:e,text:s,width:(r==null?void 0:r.width)||20,height:(r==null?void 0:r.height)||20,fontSize:(r==null?void 0:r.fontSize)||G,id:r==null?void 0:r.id,groupId:r==null?void 0:r.groupId,metadata:r==null?void 0:r.metadata}),at=(t,e,s)=>{const r={},o=Number(t.getAttribute("x")),a=Number(t.getAttribute("y"));r.type="text",r.text=R(e),s!=null&&s.id&&(r.id=s.id),s!=null&&s.groupId&&(r.groupId=s.groupId);const n=t.getBBox();r.width=n.width,r.height=n.height,r.x=o-n.width/2,r.y=a;const c=parseInt(getComputedStyle(t).fontSize);return r.fontSize=c,r},O=(t,e,s={})=>{const r={};r.type=e;const{label:o,subtype:a,id:n,groupId:c}=s;r.id=n,c&&(r.groupId=c),o&&(r.label={text:R(o.text),fontSize:16,verticalAlign:o==null?void 0:o.verticalAlign});const i=t.getBBox();switch(r.x=i.x,r.y=i.y,r.width=i.width,r.height=i.height,r.subtype=a,a){case"highlight":const d=t.getAttribute("fill");d&&(r.bgColor=d);break;case"note":r.strokeStyle="dashed";break}return r},q=(t,e,s,r,o,a)=>{const n={};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},J={0:"SOLID",1:"DOTTED",3:"SOLID_CROSS",4:"DOTTED_CROSS",5:"SOLID_OPEN",6:"DOTTED_OPEN",24:"SOLID_POINT",25:"DOTTED_POINT"},T={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,SOLID_POINT:24,DOTTED_POINT:25,CRITICAL_START:27},Nt=t=>{let e;switch(t){case T.SOLID:case T.SOLID_CROSS:case T.SOLID_OPEN:case T.SOLID_POINT:e="solid";break;case T.DOTTED:case T.DOTTED_CROSS:case T.DOTTED_OPEN:case T.DOTTED_POINT:e="dotted";break;default:e="solid";break}return e},Lt=(t,e)=>{var r,o;if(!!((r=t.nextElementSibling)!=null&&r.classList.contains("sequenceNumber"))){const a=(o=t.nextElementSibling)==null?void 0:o.textContent;if(!a)throw new Error("sequence number not present");const n=30,c=n/2,d={type:"rectangle",x:e.startX-10,y:e.startY-c,label:{text:a,fontSize:14},bgColor:"#e9ecef",height:n,subtype:"sequence"};Object.assign(e,{sequenceNumber:d})}},tt=(t,e,s)=>{if(!t)throw"root node not found";const r=N(),o=Array.from(t.children),a=[];return o.forEach((n,c)=>{const i=`${s==null?void 0:s.id}-${c}`;let d;switch(n.tagName){case"line":const l=Number(n.getAttribute("x1")),b=Number(n.getAttribute("y1")),u=Number(n.getAttribute("x2")),p=Number(n.getAttribute("y2"));d=q(n,l,b,u,p,{groupId:r,id:i});break;case"text":d=at(n,e,{groupId:r,id:i});break;case"circle":d=O(n,"ellipse",{label:n.textContent?{text:n.textContent}:void 0,groupId:r,id:i});default:d=O(n,ct[n.tagName],{label:n.textContent?{text:n.textContent}:void 0,groupId:r,id:i})}a.push(d)}),a},Dt=(t,e)=>{const s=Array.from(e.querySelectorAll(".actor-top")),r=Array.from(e.querySelectorAll(".actor-bottom")),o=[],a=[];return Object.values(t).forEach((n,c)=>{var b;const i=s.find(u=>u.getAttribute("name")===n.name),d=r.find(u=>u.getAttribute("name")===n.name);if(!i||!d)throw"root not found";const l=n.description;if(n.type==="participant"){const u=O(i,"rectangle",{id:`${n.name}-top`,label:{text:l},subtype:"actor"});if(!u)throw"Top Node element not found!";o.push([u]);const p=O(d,"rectangle",{id:`${n.name}-bottom`,label:{text:l},subtype:"actor"});o.push([p]);const g=(b=i==null?void 0:i.parentElement)==null?void 0:b.previousElementSibling;if((g==null?void 0:g.tagName)!=="line")throw"Line not found";const m=Number(g.getAttribute("x1"));if(!u.height)throw"Top node element height is null";const y=u.y+u.height,S=p.y,E=Number(g.getAttribute("x2")),x=q(g,m,y,E,S);a.push(x)}else if(n.type==="actor"){const u=tt(i,l,{id:`${n.name}-top`});o.push(u);const p=tt(d,l,{id:`${n.name}-bottom`});o.push(p);const g=i.previousElementSibling;if((g==null?void 0:g.tagName)!=="line")throw"Line not found";const m=Number(g.getAttribute("x1")),y=Number(g.getAttribute("y1")),S=Number(g.getAttribute("x2")),E=p.find(x=>x.type==="ellipse");if(E){const x=E.y,h=q(g,m,y,S,x);a.push(h)}}}),{nodes:o,lines:a}},Yt=(t,e)=>{const s=[],r=Array.from(e.querySelectorAll('[class*="messageLine"]')),o=Object.keys(J),a=t.filter(n=>o.includes(n.type.toString()));return r.forEach((n,c)=>{const i=a[c],d=J[i.type],l=Ct(n,{label:i==null?void 0:i.message,strokeStyle:Nt(i.type),endArrowhead:d==="SOLID_OPEN"||d==="DOTTED_OPEN"?null:"arrow"});Lt(n,l),s.push(l)}),s},vt=(t,e)=>{const s=Array.from(e.querySelectorAll(".note")).map(a=>a.parentElement),r=t.filter(a=>a.type===T.NOTE),o=[];return s.forEach((a,n)=>{if(!a)return;const c=a.firstChild,i=r[n].message,d=O(c,"rectangle",{label:{text:i},subtype:"note"});o.push(d)}),o},Xt=t=>{const e=Array.from(t.querySelectorAll("[class*=activation]")),s=[];return e.forEach(r=>{const o=O(r,"rectangle",{label:{text:""},subtype:"activation"});s.push(o)}),s},_t=(t,e)=>{const s=Array.from(e.querySelectorAll(".loopLine")),r=[],o=[],a=[];s.forEach(l=>{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);m.strokeStyle="dotted",m.strokeColor="#adb5bd",m.strokeWidth=2,r.push(m)});const n=Array.from(e.querySelectorAll(".loopText")),c=t.filter(l=>l.type===T.CRITICAL_START).map(l=>l.message);n.forEach(l=>{var m;const b=l.textContent||"",u=at(l,b),p=((m=b.match(/\[(.*?)\]/))==null?void 0:m[1])||"";c.includes(p)&&(u.x+=16),o.push(u)});const i=Array.from(e==null?void 0:e.querySelectorAll(".labelBox")),d=Array.from(e==null?void 0:e.querySelectorAll(".labelText"));return i.forEach((l,b)=>{var g;const u=((g=d[b])==null?void 0:g.textContent)||"",p=O(l,"rectangle",{label:{text:u}});p.strokeColor="#adb5bd",p.bgColor="#e9ecef",p.width=void 0,a.push(p)}),{lines:r,texts:o,nodes:a}},Rt=t=>{const e=Array.from(t.querySelectorAll(".rect")).filter(r=>{var o;return((o=r.parentElement)==null?void 0:o.tagName)!=="g"}),s=[];return e.forEach(r=>{const o=O(r,"rectangle",{label:{text:""},subtype:"highlight"});s.push(o)}),s},$t=(t,e)=>{t.parse();const s=t.parser.yy,r=[],o=s.getBoxes(),a=Rt(e),n=s.getActors(),{nodes:c,lines:i}=Dt(n,e),d=s.getMessages(),l=Yt(d,e),b=vt(d,e),u=Xt(e),p=_t(d,e);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}},j={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3},et={LINE:0,DOTTED_LINE:1},D=16,Pt=t=>{let e;switch(t){case et.LINE:e="solid";break;case et.DOTTED_LINE:e="dotted";break;default:e="solid"}return e},rt=t=>{let e;switch(t){case j.AGGREGATION:e="diamond_outline";break;case j.COMPOSITION:e="diamond";break;case j.EXTENSION:e="triangle_outline";break;case"none":e=null;break;case j.DEPENDENCY:default:e="arrow";break}return e},Mt=(t,e)=>{const s=[],r=[],o=[];return Object.values(t).forEach(a=>{var m;const{domId:n,id:c}=a,i=N(),d=e.querySelector(`[data-id=${c}]`);if(!d)throw Error(`DOM Node with id ${n} not found`);const{transformX:l,transformY:b}=_(d),u=O(d.firstChild,"rectangle",{id:c,groupId:i});u.x+=l,u.y+=b,u.metadata={classId:c},s.push(u),Array.from(d.querySelectorAll(".divider")).forEach(y=>{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,{groupId:i,id:N()});f.startX+=l,f.startY+=b,f.endX+=l,f.endY+=b,f.metadata={classId:c},r.push(f)});const g=(m=d.querySelector(".label"))==null?void 0:m.children;if(!g)throw"label nodes not found";Array.from(g).forEach(y=>{const S=y.textContent;if(!S)return;const E=N(),{transformX:x,transformY:h}=_(y),f=y.getBBox(),I=H(l+x,b+h+10,S,{width:f.width,height:f.height,id:E,groupId:i,metadata:{classId:c}});o.push(I)})}),{nodes:s,lines:r,text:o}},qt=(t,e)=>{const s=["triangle_outline","diamond","diamond_outline"],r=e.startArrowhead&&s.includes(e.startArrowhead),o=e.endArrowhead&&s.includes(e.endArrowhead);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},Bt=(t,e,s,r)=>{var c;const o=(c=s.querySelector(".edgePaths"))==null?void 0:c.children;if(!o)throw new Error("No Edges found!");const a=[],n=[];return t.forEach((i,d)=>{const{id1:l,id2:b,relation:u}=i,p=e.find(Y=>Y.id===l),g=e.find(Y=>Y.id===b),m=Pt(u.lineType),y=rt(u.type1),S=rt(u.type2),E=nt(o[d]),x=ot(E.startX,E.startY,E.endX,E.endY,{strokeStyle:m,startArrowhead:y,endArrowhead:S,label:i.title?{text:i.title}:void 0,start:{type:"rectangle",id:p.id},end:{type:"rectangle",id:g.id}}),h=qt(r,x);a.push(h);const{relationTitle1:f,relationTitle2:C}=i,I=20,k=15,L=15;let w,A;if(f&&f!=="none"){switch(r){case"TB":w=h.startX-I,h.endX<h.startX&&(w-=L),A=h.startY+k;break;case"BT":w=h.startX+I,h.endX>h.startX&&(w+=L),A=h.startY-k;break;case"LR":w=h.startX+I,A=h.startY+k,h.endY>h.startY&&(A+=L);break;case"RL":w=h.startX-I,A=h.startY-k,h.startY>h.endY&&(A-=L);break;default:w=h.startX-I,A=h.startY+k}const Y=H(w,A,f,{fontSize:16});n.push(Y)}if(C&&C!=="none"){switch(r){case"TB":w=h.endX+I,h.endX<h.startX&&(w+=L),A=h.endY-k;break;case"BT":w=h.endX-I,h.endX>h.startX&&(w-=L),A=h.endY+k;break;case"LR":w=h.endX-I,A=h.endY-k,h.endY>h.startY&&(A-=L);break;case"RL":w=h.endX+I,A=h.endY+k,h.startY>h.endY&&(A+=L);break;default:w=h.endX+I,A=h.endY-k}const Y=H(w,A,C,{fontSize:16});n.push(Y)}}),{arrows:a,text:n}},jt=(t,e,s)=>{const r=[],o=[];return t.forEach(a=>{const{id:n,text:c,class:i}=a,d=e.querySelector(`#${n}`);if(!d)throw new Error(`Node with id ${n} not found!`);const{transformX:l,transformY:b}=_(d),u=d.firstChild,p=O(u,"rectangle",{id:n,subtype:"note",label:{text:c}});if(Object.assign(p,{x:p.x+l,y:p.y+b}),r.push(p),i){const g=s.find(h=>h.id===i);if(!g)throw new Error(`class node with id ${i} not found!`);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,{strokeStyle:"dotted",startArrowhead:null,endArrowhead:null,start:{id:p.id,type:"rectangle"},end:{id:g.id,type:"rectangle"}});o.push(x)}}),{notes:r,connectors:o}},zt=(t,e)=>{t.parse();const s=t.parser.yy,r=s.getDirection(),o=[],a=[],n=[],c=[],i=s.getNamespaces(),d=s.getClasses();if(Object.keys(d).length){const m=Mt(d,e);o.push(m.nodes),a.push(...m.lines),n.push(...m.text),c.push(...m.nodes)}const l=s.getRelations(),{arrows:b,text:u}=Bt(l,c,e,r),{notes:p,connectors:g}=jt(s.getNotes(),e,c);return o.push(p),b.push(...g),n.push(...u),{type:"class",nodes:o,lines:a,arrows:b,text:n,namespaces:i}},Gt=t=>{const e=t.querySelector("svg");if(!e)throw new Error("SVG element not found");const s=e.getBoundingClientRect(),r=s.width,o=s.height;e.setAttribute("width",`${r}`),e.setAttribute("height",`${o}`);const a="image/svg+xml",n=unescape(encodeURIComponent(e.outerHTML)),i=`data:image/svg+xml;base64,${btoa(n)}`;return{type:"graphImage",mimeType:a,dataURL:i,width:r,height:o}},Ft=async(t,e=Z)=>{U.mermaid.initialize({...Z,...e});const s=await U.mermaid.mermaidAPI.getDiagramFromText(wt(t)),{svg:r}=await U.mermaid.render("mermaid-to-excalidraw",t),o=document.createElement("div");o.setAttribute("style","opacity: 0; position: relative; z-index: -1;"),o.innerHTML=r,o.id="mermaid-diagram",document.body.appendChild(o);let a;switch(s.type){case"flowchart-v2":{a=Ot(s,o);break}case"sequence":{a=$t(s,o);break}case"classDiagram":{a=zt(s,o);break}default:a=Gt(o)}return o.remove(),a},Ut=async(t,e)=>{var n;const s=e||{},r=parseInt(((n=s.themeVariables)==null?void 0:n.fontSize)??"")||G,o=await Ft(t,{...s,themeVariables:{...s.themeVariables,fontSize:`${r*1.25}px`}});return St(o,{fontSize:r})};exports.parseMermaidToExcalidraw=Ut;