@dwelle/excalidraw 0.5.0-da1c822 → 0.5.0-e56eec7

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 (382) hide show
  1. package/CHANGELOG.md +13 -2
  2. package/dist/browser/dev/excalidraw-assets-dev/{blockDiagram-91b80b7a-RHODGCTM.js → blockDiagram-91b80b7a-NRABZKZA.js} +6 -6
  3. package/dist/browser/dev/excalidraw-assets-dev/{c4Diagram-b2a90758-W7NCR7LR.js → c4Diagram-b2a90758-56M32CJD.js} +4 -4
  4. package/dist/browser/dev/excalidraw-assets-dev/{chunk-TKRIVTWP.js → chunk-5EDB2FTV.js} +3 -3
  5. package/dist/browser/dev/excalidraw-assets-dev/{chunk-52OGG53V.js → chunk-6VTJEXQH.js} +3 -3
  6. package/dist/browser/dev/excalidraw-assets-dev/{chunk-J5HRUYQR.js → chunk-AKQDHN2W.js} +2 -2
  7. package/dist/browser/dev/excalidraw-assets-dev/chunk-AKQDHN2W.js.map +7 -0
  8. package/dist/browser/dev/excalidraw-assets-dev/{chunk-GF7VCOUM.js → chunk-C4OL7SRI.js} +3 -3
  9. package/dist/browser/dev/excalidraw-assets-dev/{chunk-BESQLMCW.js → chunk-E47I6Q7O.js} +5 -5
  10. package/dist/browser/dev/excalidraw-assets-dev/{chunk-UETNA2WX.js → chunk-KDIPICHB.js} +6377 -4340
  11. package/dist/browser/dev/excalidraw-assets-dev/chunk-KDIPICHB.js.map +7 -0
  12. package/dist/browser/dev/excalidraw-assets-dev/{chunk-5747M6KP.js → chunk-OH2YDYHX.js} +3 -3
  13. package/dist/browser/dev/excalidraw-assets-dev/{chunk-GPOYIZPX.js → chunk-PXBR5CBM.js} +28 -28
  14. package/dist/browser/dev/excalidraw-assets-dev/chunk-PXBR5CBM.js.map +7 -0
  15. package/dist/browser/dev/excalidraw-assets-dev/{chunk-GCA4S2OA.js → chunk-RTA6DTUV.js} +3 -3
  16. package/dist/browser/dev/excalidraw-assets-dev/{chunk-DQOPSCYA.js → chunk-TTH3BTHQ.js} +3 -3
  17. package/dist/browser/dev/excalidraw-assets-dev/{chunk-B2MHJWXZ.js → chunk-U4N7TEPH.js} +2 -2
  18. package/dist/browser/dev/excalidraw-assets-dev/{chunk-QFS4M5OJ.js → chunk-V3PA4IDR.js} +3 -3
  19. package/dist/browser/dev/excalidraw-assets-dev/{chunk-SLLUETBM.js → chunk-WFT6ZJE6.js} +7 -7
  20. package/dist/browser/dev/excalidraw-assets-dev/{chunk-PPHFJLL7.js → chunk-XZKEYTKS.js} +4 -4
  21. package/dist/browser/dev/excalidraw-assets-dev/{chunk-USLWOHUZ.js → chunk-YC6VTXEO.js} +4 -4
  22. package/dist/browser/dev/excalidraw-assets-dev/{classDiagram-30eddba6-GJGBT4TV.js → classDiagram-30eddba6-EZJVINS6.js} +6 -6
  23. package/dist/browser/dev/excalidraw-assets-dev/{classDiagram-v2-f2df5561-LYWTIPJA.js → classDiagram-v2-f2df5561-XSUIN44A.js} +9 -9
  24. package/dist/browser/dev/excalidraw-assets-dev/{directory-open-01563666-UREMLRIT.js → directory-open-01563666-KOK2HSB6.js} +2 -2
  25. package/dist/browser/dev/excalidraw-assets-dev/{directory-open-4ed118d0-UN3BUDZZ.js → directory-open-4ed118d0-P3Q3CLF3.js} +2 -2
  26. package/dist/browser/dev/excalidraw-assets-dev/dist-O6HOTHQF.js +10 -0
  27. package/dist/browser/dev/excalidraw-assets-dev/{en-UW5C5KGW.js → en-PSBMWL4S.js} +2 -2
  28. package/dist/browser/dev/excalidraw-assets-dev/{erDiagram-47591fe2-Z7U2XW2Y.js → erDiagram-47591fe2-U7FLWOG3.js} +5 -5
  29. package/dist/browser/dev/excalidraw-assets-dev/{file-open-002ab408-4QG336MG.js → file-open-002ab408-EQEHGU2J.js} +2 -2
  30. package/dist/browser/dev/excalidraw-assets-dev/{file-open-7c801643-3QI4ICCL.js → file-open-7c801643-QQT6O7P5.js} +2 -2
  31. package/dist/browser/dev/excalidraw-assets-dev/{file-save-3189631c-TNNERCWV.js → file-save-3189631c-YXX2C7C6.js} +2 -2
  32. package/dist/browser/dev/excalidraw-assets-dev/{file-save-745eba88-JFMH565P.js → file-save-745eba88-7G554KTZ.js} +2 -2
  33. package/dist/browser/dev/excalidraw-assets-dev/{flowDiagram-5540d9b9-PARVG263.js → flowDiagram-5540d9b9-F2VP4JAA.js} +10 -10
  34. package/dist/browser/dev/excalidraw-assets-dev/{flowDiagram-v2-3b53844e-ZJOPVRMB.js → flowDiagram-v2-3b53844e-2WQZZRND.js} +10 -10
  35. package/dist/browser/dev/excalidraw-assets-dev/{flowchart-elk-definition-5fe447d6-ULPNBSZX.js → flowchart-elk-definition-5fe447d6-IW6O2F6C.js} +6 -6
  36. package/dist/browser/dev/excalidraw-assets-dev/{ganttDiagram-9a3bba1f-ESSYVTJ4.js → ganttDiagram-9a3bba1f-B5RH7ZAO.js} +3 -3
  37. package/dist/browser/dev/excalidraw-assets-dev/{gitGraphDiagram-96e6b4ee-6V6VVNNP.js → gitGraphDiagram-96e6b4ee-INGQRNLZ.js} +3 -3
  38. package/dist/browser/dev/excalidraw-assets-dev/{image-ZNQQXS62.css → image-FDQLNM24.css} +39 -16
  39. package/dist/browser/dev/excalidraw-assets-dev/image-FDQLNM24.css.map +7 -0
  40. package/dist/browser/dev/excalidraw-assets-dev/{image-3LTGFHLF.js → image-GMAHLVER.js} +6 -6
  41. package/dist/browser/dev/excalidraw-assets-dev/{image-blob-reduce.esm-KTX27DAY.js → image-blob-reduce.esm-OX75MRP3.js} +2 -2
  42. package/dist/browser/dev/excalidraw-assets-dev/{infoDiagram-bcd20f53-I22FLFX3.js → infoDiagram-bcd20f53-43FMAUOR.js} +3 -3
  43. package/dist/browser/dev/excalidraw-assets-dev/{journeyDiagram-4fe6b3dc-WAO6F52C.js → journeyDiagram-4fe6b3dc-KFVOUX4I.js} +4 -4
  44. package/dist/browser/dev/excalidraw-assets-dev/{katex-NWA2YFOP.js → katex-A3GRORPB.js} +2 -2
  45. package/dist/browser/dev/excalidraw-assets-dev/{mindmap-definition-f354de21-K74IKX4Y.js → mindmap-definition-f354de21-D7S3CRQ4.js} +4 -4
  46. package/dist/browser/dev/excalidraw-assets-dev/{pica-3TH2EGXR.js → pica-ZAD7MTGA.js} +2 -2
  47. package/dist/browser/dev/excalidraw-assets-dev/{pieDiagram-79897490-DOB2LVE5.js → pieDiagram-79897490-OON2CRZ5.js} +3 -3
  48. package/dist/browser/dev/excalidraw-assets-dev/{quadrantDiagram-62f64e94-MJV2X7WI.js → quadrantDiagram-62f64e94-5APTNVVS.js} +3 -3
  49. package/dist/browser/dev/excalidraw-assets-dev/{requirementDiagram-05bf5f74-H4YM3XN7.js → requirementDiagram-05bf5f74-FM7WZVKU.js} +5 -5
  50. package/dist/browser/dev/excalidraw-assets-dev/{roundRect-4S3QV2NZ.js → roundRect-AYYHVX5X.js} +2 -2
  51. package/dist/browser/dev/excalidraw-assets-dev/{sankeyDiagram-97764748-7X74ABAN.js → sankeyDiagram-97764748-5HLEFFGY.js} +3 -3
  52. package/dist/browser/dev/excalidraw-assets-dev/{sequenceDiagram-acc0e65c-PPDIJFQP.js → sequenceDiagram-acc0e65c-4ZRSNGPV.js} +4 -4
  53. package/dist/browser/dev/excalidraw-assets-dev/{stateDiagram-0ff1cf1a-JVBR7N35.js → stateDiagram-0ff1cf1a-OLTPYRPP.js} +6 -6
  54. package/dist/browser/dev/excalidraw-assets-dev/{stateDiagram-v2-9a9d610d-QYAJLQJH.js → stateDiagram-v2-9a9d610d-N3XOTAEE.js} +9 -9
  55. package/dist/browser/dev/excalidraw-assets-dev/{timeline-definition-fea2a41d-GL7U3WDB.js → timeline-definition-fea2a41d-5PDFIYJQ.js} +3 -3
  56. package/dist/browser/dev/excalidraw-assets-dev/{xychartDiagram-ab372869-4U4JE4TW.js → xychartDiagram-ab372869-VIWBP45Y.js} +4 -4
  57. package/dist/browser/dev/index.css +38 -15
  58. package/dist/browser/dev/index.css.map +2 -2
  59. package/dist/browser/dev/index.js +9 -5
  60. package/dist/browser/prod/excalidraw-assets/ar-SA-JA6F2FMJ-MVAFRXH2.js +10 -0
  61. package/dist/browser/prod/excalidraw-assets/az-AZ-GVIENQVH-DULWV7IG.js +1 -0
  62. package/dist/browser/prod/excalidraw-assets/bg-BG-YFNNHCEP-TOMMDX7A.js +5 -0
  63. package/dist/browser/prod/excalidraw-assets/{blockDiagram-91b80b7a-BO7MW3VX.js → blockDiagram-91b80b7a-ZBW6LBXS.js} +1 -1
  64. package/dist/browser/prod/excalidraw-assets/bn-BD-LMEIWSRD-U6EPN6XJ.js +5 -0
  65. package/dist/browser/prod/excalidraw-assets/{c4Diagram-b2a90758-VCUPBVHR.js → c4Diagram-b2a90758-GET6IFET.js} +1 -1
  66. package/dist/browser/prod/excalidraw-assets/ca-ES-C2WGCLOT-4Q2376G3.js +8 -0
  67. package/dist/browser/prod/excalidraw-assets/{chunk-O77Z7CWL.js → chunk-2UGPV7X3.js} +1 -1
  68. package/dist/browser/prod/excalidraw-assets/{chunk-B7CDQVNY.js → chunk-364WSJPQ.js} +21 -21
  69. package/dist/browser/prod/excalidraw-assets/{chunk-NM5B2RBP.js → chunk-4FM7RPKW.js} +1 -1
  70. package/dist/browser/prod/excalidraw-assets/{chunk-CVEF66PS.js → chunk-4SHJFNCN.js} +1 -1
  71. package/dist/browser/prod/excalidraw-assets/{chunk-22FVL4I7.js → chunk-6TNDONBF.js} +1 -1
  72. package/dist/browser/prod/excalidraw-assets/{chunk-QLNFR4AJ.js → chunk-BJTCWAK5.js} +1 -1
  73. package/dist/browser/prod/excalidraw-assets/chunk-CKRG5LOX.js +335 -0
  74. package/dist/browser/prod/excalidraw-assets/{chunk-3HZHH3PT.js → chunk-IW42BK4V.js} +1 -1
  75. package/dist/browser/prod/excalidraw-assets/{chunk-4JYQ3563.js → chunk-MRQWXP64.js} +1 -1
  76. package/dist/browser/prod/excalidraw-assets/{chunk-VXFFPRP2.js → chunk-OG2UUKMT.js} +1 -1
  77. package/dist/browser/prod/excalidraw-assets/chunk-Q6QP4TRB.js +11 -0
  78. package/dist/browser/prod/excalidraw-assets/{chunk-V7HUISEN.js → chunk-QBYA3CCP.js} +1 -1
  79. package/dist/browser/prod/excalidraw-assets/{chunk-5PWM36DG.js → chunk-S3O7MXSU.js} +1 -1
  80. package/dist/browser/prod/excalidraw-assets/chunk-SJBOQTFA.js +1 -0
  81. package/dist/browser/prod/excalidraw-assets/{chunk-3VCRCP5J.js → chunk-T7MBBIYG.js} +1 -1
  82. package/dist/browser/prod/excalidraw-assets/{chunk-HPA5W5VE.js → chunk-X7R4RA7C.js} +1 -1
  83. package/dist/browser/prod/excalidraw-assets/{chunk-7UJZVYSR.js → chunk-Y3NNVSMP.js} +1 -1
  84. package/dist/browser/prod/excalidraw-assets/{classDiagram-30eddba6-VXGNM3LI.js → classDiagram-30eddba6-MJ5GZSCE.js} +1 -1
  85. package/dist/browser/prod/excalidraw-assets/{classDiagram-v2-f2df5561-YALTASVE.js → classDiagram-v2-f2df5561-FU5PRXDD.js} +1 -1
  86. package/dist/browser/prod/excalidraw-assets/cs-CZ-F2NDIQMB-4NMYRMO2.js +11 -0
  87. package/dist/browser/prod/excalidraw-assets/da-DK-WBEQB3CJ-6YAF4DNI.js +5 -0
  88. package/dist/browser/prod/excalidraw-assets/de-DE-VEIMCP7R-NSRLPHDI.js +8 -0
  89. package/dist/browser/prod/excalidraw-assets/{directory-open-01563666-JWXY2QSC.js → directory-open-01563666-UG2J4T6L.js} +1 -1
  90. package/dist/browser/prod/excalidraw-assets/{directory-open-4ed118d0-6AL5X37W.js → directory-open-4ed118d0-FGQD6TMW.js} +1 -1
  91. package/dist/browser/prod/excalidraw-assets/dist-LI3DBBWR.js +1 -0
  92. package/dist/browser/prod/excalidraw-assets/el-GR-TKRKG5GQ-6N4GY2DI.js +10 -0
  93. package/dist/browser/prod/excalidraw-assets/{en-CPU3UVKT.js → en-MPFDZHEH.js} +1 -1
  94. package/dist/browser/prod/excalidraw-assets/en-Q552WR7L-QAV42NF3.js +1 -0
  95. package/dist/browser/prod/excalidraw-assets/{erDiagram-47591fe2-GKYANCN7.js → erDiagram-47591fe2-YGAMNOK6.js} +1 -1
  96. package/dist/browser/prod/excalidraw-assets/es-ES-TOLWEZNW-ODY4LX7F.js +9 -0
  97. package/dist/browser/prod/excalidraw-assets/eu-ES-7CDRJQWJ-KF3KSB2X.js +11 -0
  98. package/dist/browser/prod/excalidraw-assets/fa-IR-527E2XGU-WLLGMWYR.js +8 -0
  99. package/dist/browser/prod/excalidraw-assets/fi-FI-NLQ7RQGZ-EZLGQEWF.js +6 -0
  100. package/dist/browser/prod/excalidraw-assets/{file-open-002ab408-3EPJOH45.js → file-open-002ab408-WLX7QPS6.js} +1 -1
  101. package/dist/browser/prod/excalidraw-assets/{file-open-7c801643-QIP6HK4D.js → file-open-7c801643-YB6IH3XI.js} +1 -1
  102. package/dist/browser/prod/excalidraw-assets/{file-save-3189631c-4TQJBQCS.js → file-save-3189631c-MRYCXU63.js} +1 -1
  103. package/dist/browser/prod/excalidraw-assets/{file-save-745eba88-C4L3ZGCC.js → file-save-745eba88-UZEDMFLR.js} +1 -1
  104. package/dist/browser/prod/excalidraw-assets/{flowDiagram-5540d9b9-QBRW5SLP.js → flowDiagram-5540d9b9-V23UQWYJ.js} +1 -1
  105. package/dist/browser/prod/excalidraw-assets/flowDiagram-v2-3b53844e-UDC2ZAFT.js +1 -0
  106. package/dist/browser/prod/excalidraw-assets/{flowchart-elk-definition-5fe447d6-YYO2EYKS.js → flowchart-elk-definition-5fe447d6-N3ISH6AG.js} +1 -1
  107. package/dist/browser/prod/excalidraw-assets/fr-FR-KUHO4FLU-2OW7FE5V.js +9 -0
  108. package/dist/browser/prod/excalidraw-assets/{ganttDiagram-9a3bba1f-3B2DUUUQ.js → ganttDiagram-9a3bba1f-7SAN2TXA.js} +1 -1
  109. package/dist/browser/prod/excalidraw-assets/{gitGraphDiagram-96e6b4ee-G6CKXXWQ.js → gitGraphDiagram-96e6b4ee-EXV6PWXL.js} +1 -1
  110. package/dist/browser/prod/excalidraw-assets/gl-ES-NEXX3VBB-TESFDR6O.js +10 -0
  111. package/dist/browser/prod/excalidraw-assets/he-IL-MED2VGBZ-N4VYRCHF.js +10 -0
  112. package/dist/browser/prod/excalidraw-assets/hi-IN-5V633W7V-4VXVQ6GE.js +4 -0
  113. package/dist/browser/prod/excalidraw-assets/hu-HU-2FOZGVGR-7CHHZRPD.js +7 -0
  114. package/dist/browser/prod/excalidraw-assets/id-ID-I6BOLXTF-ULJRGCTU.js +10 -0
  115. package/dist/browser/prod/excalidraw-assets/image-ZKACJTPS.js +1 -0
  116. package/dist/browser/prod/excalidraw-assets/{image-blob-reduce.esm-5DTGAOOI.js → image-blob-reduce.esm-GOFU5DPX.js} +1 -1
  117. package/dist/browser/prod/excalidraw-assets/{infoDiagram-bcd20f53-WJTZJERL.js → infoDiagram-bcd20f53-LJZ36XP5.js} +1 -1
  118. package/dist/browser/prod/excalidraw-assets/it-IT-WKPQOK4P-C3FTW2QG.js +11 -0
  119. package/dist/browser/prod/excalidraw-assets/ja-JP-VKA4ISRU-EBXFDMUP.js +8 -0
  120. package/dist/browser/prod/excalidraw-assets/{journeyDiagram-4fe6b3dc-JF22KXXQ.js → journeyDiagram-4fe6b3dc-TFRSU2KH.js} +1 -1
  121. package/dist/browser/prod/excalidraw-assets/kaa-IKPRSBNY-URJPWZZH.js +1 -0
  122. package/dist/browser/prod/excalidraw-assets/kab-KAB-IE4PHQTZ-OMISFOMM.js +8 -0
  123. package/dist/browser/prod/excalidraw-assets/{katex-N6R5DPQX.js → katex-HAQKNIIQ.js} +1 -1
  124. package/dist/browser/prod/excalidraw-assets/kk-KZ-MNJT6XSV-56OVE4EH.js +1 -0
  125. package/dist/browser/prod/excalidraw-assets/km-KH-LADGDFXV-KI7V2Z5A.js +11 -0
  126. package/dist/browser/prod/excalidraw-assets/ko-KR-XD7AVF2F-EFYGITKM.js +9 -0
  127. package/dist/browser/prod/excalidraw-assets/ku-TR-4XBHKDQA-U25XLPMW.js +9 -0
  128. package/dist/browser/prod/excalidraw-assets/lt-LT-QC35R4YH-6TDSRONI.js +3 -0
  129. package/dist/browser/prod/excalidraw-assets/lv-LV-GSD5D3BA-KMXM2FQ7.js +7 -0
  130. package/dist/browser/prod/excalidraw-assets/{mindmap-definition-f354de21-7SH5STU3.js → mindmap-definition-f354de21-J3C2WSJB.js} +1 -1
  131. package/dist/browser/prod/excalidraw-assets/mr-IN-KOLSWM7Y-NVYC6JCO.js +13 -0
  132. package/dist/browser/prod/excalidraw-assets/my-MM-M53KMUET-A2ORJJ2D.js +1 -0
  133. package/dist/browser/prod/excalidraw-assets/nb-NO-XXC6U37A-L4O4DGCC.js +10 -0
  134. package/dist/browser/prod/excalidraw-assets/nl-NL-HCCJQEUO-7Q2LV5NM.js +8 -0
  135. package/dist/browser/prod/excalidraw-assets/nn-NO-6P7Z2PI2-TUT2PFEE.js +8 -0
  136. package/dist/browser/prod/excalidraw-assets/oc-FR-JRJKPLNT-SBQHJH7X.js +8 -0
  137. package/dist/browser/prod/excalidraw-assets/pa-IN-LZWLEPIB-7NKOXI65.js +4 -0
  138. package/dist/browser/prod/excalidraw-assets/percentages-UCQDHIQF-Q4IM6ZEB.js +1 -0
  139. package/dist/browser/prod/excalidraw-assets/{pica-KWHN2PJ6.js → pica-ABPXE5C5.js} +1 -1
  140. package/dist/browser/prod/excalidraw-assets/{pieDiagram-79897490-5O5EBEQB.js → pieDiagram-79897490-FMJ3ZAF7.js} +1 -1
  141. package/dist/browser/prod/excalidraw-assets/pl-PL-3WBLCXI2-E2SMTIVM.js +9 -0
  142. package/dist/browser/prod/excalidraw-assets/pt-BR-O3ZPTUNW-RS7M7EKX.js +9 -0
  143. package/dist/browser/prod/excalidraw-assets/pt-PT-7AQTSAFO-AEANJ2UN.js +9 -0
  144. package/dist/browser/prod/excalidraw-assets/{quadrantDiagram-62f64e94-JTY6WOKB.js → quadrantDiagram-62f64e94-YI32TPUI.js} +1 -1
  145. package/dist/browser/prod/excalidraw-assets/{requirementDiagram-05bf5f74-TSFQFY5X.js → requirementDiagram-05bf5f74-UO2ATL3U.js} +1 -1
  146. package/dist/browser/prod/excalidraw-assets/ro-RO-HJ65JYWV-35XNZ4QJ.js +11 -0
  147. package/dist/browser/prod/excalidraw-assets/{roundRect-PUCZURYS.js → roundRect-UKQBLFKQ.js} +1 -1
  148. package/dist/browser/prod/excalidraw-assets/ru-RU-P7ROIYNC-ERPG3GJT.js +9 -0
  149. package/dist/browser/prod/excalidraw-assets/{sankeyDiagram-97764748-7G2R6W67.js → sankeyDiagram-97764748-3RR36435.js} +1 -1
  150. package/dist/browser/prod/excalidraw-assets/{sequenceDiagram-acc0e65c-CTANNZCO.js → sequenceDiagram-acc0e65c-G2Q6J4UN.js} +1 -1
  151. package/dist/browser/prod/excalidraw-assets/si-LK-7ZSWVION-YHKN25MU.js +1 -0
  152. package/dist/browser/prod/excalidraw-assets/sk-SK-NXVBGLYY-IKQZT26E.js +6 -0
  153. package/dist/browser/prod/excalidraw-assets/sl-SI-VFTWOYNP-UPLNMI3E.js +6 -0
  154. package/dist/browser/prod/excalidraw-assets/{stateDiagram-0ff1cf1a-I5COLKZ4.js → stateDiagram-0ff1cf1a-QEYVXCSB.js} +1 -1
  155. package/dist/browser/prod/excalidraw-assets/{stateDiagram-v2-9a9d610d-IIHI3AJN.js → stateDiagram-v2-9a9d610d-3VKD7UYK.js} +1 -1
  156. package/dist/browser/prod/excalidraw-assets/sv-SE-YONBLQNW-ZG4TE7PV.js +10 -0
  157. package/dist/browser/prod/excalidraw-assets/ta-IN-BSETPMLX-FC54FMQJ.js +9 -0
  158. package/dist/browser/prod/excalidraw-assets/th-TH-URTRDITB-K6QQ2PRO.js +2 -0
  159. package/dist/browser/prod/excalidraw-assets/{timeline-definition-fea2a41d-CXTGKWI4.js → timeline-definition-fea2a41d-H4D6IYVJ.js} +1 -1
  160. package/dist/browser/prod/excalidraw-assets/tr-TR-N5SCAVTB-HMUEG6DN.js +7 -0
  161. package/dist/browser/prod/excalidraw-assets/uk-UA-LBCYVSQZ-DEJZCNRZ.js +6 -0
  162. package/dist/browser/prod/excalidraw-assets/vi-VN-POZWLIUU-EY6QFLQV.js +5 -0
  163. package/dist/browser/prod/excalidraw-assets/{xychartDiagram-ab372869-QZGPPHJP.js → xychartDiagram-ab372869-SUXFHV53.js} +1 -1
  164. package/dist/browser/prod/excalidraw-assets/zh-CN-FUF5V3SC-5UIL2T3T.js +10 -0
  165. package/dist/browser/prod/excalidraw-assets/zh-HK-OB4VW42C-3ID2CCZJ.js +1 -0
  166. package/dist/browser/prod/excalidraw-assets/zh-TW-5JPVKOM7-VUPJBABS.js +9 -0
  167. package/dist/browser/prod/index.css +1 -1
  168. package/dist/browser/prod/index.js +128 -1
  169. package/dist/dev/{en-R7FEFJGC.json → en-Q552WR7L.json} +1 -1
  170. package/dist/dev/index.css +38 -15
  171. package/dist/dev/index.css.map +2 -2
  172. package/dist/dev/index.js +4575 -2598
  173. package/dist/dev/index.js.map +4 -4
  174. package/dist/excalidraw/actions/actionAddToLibrary.d.ts +4 -4
  175. package/dist/excalidraw/actions/actionAddToLibrary.js +4 -3
  176. package/dist/excalidraw/actions/actionAlign.d.ts +20 -20
  177. package/dist/excalidraw/actions/actionAlign.js +7 -6
  178. package/dist/excalidraw/actions/actionBoundText.d.ts +7 -7
  179. package/dist/excalidraw/actions/actionBoundText.js +8 -4
  180. package/dist/excalidraw/actions/actionCanvas.d.ts +49 -49
  181. package/dist/excalidraw/actions/actionCanvas.js +16 -13
  182. package/dist/excalidraw/actions/actionClipboard.d.ts +24 -24
  183. package/dist/excalidraw/actions/actionClipboard.js +14 -13
  184. package/dist/excalidraw/actions/actionDeleteSelected.d.ts +8 -8
  185. package/dist/excalidraw/actions/actionDeleteSelected.js +6 -3
  186. package/dist/excalidraw/actions/actionDistribute.d.ts +8 -8
  187. package/dist/excalidraw/actions/actionDistribute.js +3 -2
  188. package/dist/excalidraw/actions/actionDuplicateSelection.d.ts +5 -6
  189. package/dist/excalidraw/actions/actionDuplicateSelection.js +7 -3
  190. package/dist/excalidraw/actions/actionElementLock.d.ts +8 -8
  191. package/dist/excalidraw/actions/actionElementLock.js +3 -2
  192. package/dist/excalidraw/actions/actionExport.d.ts +36 -36
  193. package/dist/excalidraw/actions/actionExport.js +15 -11
  194. package/dist/excalidraw/actions/actionFinalize.d.ts +8 -8
  195. package/dist/excalidraw/actions/actionFinalize.js +9 -5
  196. package/dist/excalidraw/actions/actionFlip.d.ts +9 -9
  197. package/dist/excalidraw/actions/actionFlip.js +10 -9
  198. package/dist/excalidraw/actions/actionFrame.d.ts +14 -169
  199. package/dist/excalidraw/actions/actionFrame.js +7 -6
  200. package/dist/excalidraw/actions/actionGroup.d.ts +11 -321
  201. package/dist/excalidraw/actions/actionGroup.js +9 -11
  202. package/dist/excalidraw/actions/actionHistory.d.ts +3 -2
  203. package/dist/excalidraw/actions/actionHistory.js +27 -28
  204. package/dist/excalidraw/actions/actionLinearEditor.d.ts +2 -2
  205. package/dist/excalidraw/actions/actionLinearEditor.js +2 -1
  206. package/dist/excalidraw/actions/actionLink.d.ts +5 -5
  207. package/dist/excalidraw/actions/actionLink.js +2 -1
  208. package/dist/excalidraw/actions/actionMenu.d.ts +8 -8
  209. package/dist/excalidraw/actions/actionMenu.js +4 -3
  210. package/dist/excalidraw/actions/actionNavigate.d.ts +3 -3
  211. package/dist/excalidraw/actions/actionNavigate.js +3 -2
  212. package/dist/excalidraw/actions/actionProperties.d.ts +32 -32
  213. package/dist/excalidraw/actions/actionProperties.js +18 -13
  214. package/dist/excalidraw/actions/actionSelectAll.d.ts +4 -4
  215. package/dist/excalidraw/actions/actionSelectAll.js +2 -1
  216. package/dist/excalidraw/actions/actionStyles.d.ts +9 -12
  217. package/dist/excalidraw/actions/actionStyles.js +4 -3
  218. package/dist/excalidraw/actions/actionToggleGridMode.d.ts +6 -4
  219. package/dist/excalidraw/actions/actionToggleGridMode.js +6 -2
  220. package/dist/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +4 -4
  221. package/dist/excalidraw/actions/actionToggleObjectsSnapMode.js +2 -1
  222. package/dist/excalidraw/actions/actionToggleStats.d.ts +4 -4
  223. package/dist/excalidraw/actions/actionToggleStats.js +2 -1
  224. package/dist/excalidraw/actions/actionToggleViewMode.d.ts +4 -4
  225. package/dist/excalidraw/actions/actionToggleViewMode.js +2 -1
  226. package/dist/excalidraw/actions/actionToggleZenMode.d.ts +4 -4
  227. package/dist/excalidraw/actions/actionToggleZenMode.js +2 -1
  228. package/dist/excalidraw/actions/actionZindex.d.ts +19 -19
  229. package/dist/excalidraw/actions/actionZindex.js +5 -4
  230. package/dist/excalidraw/actions/manager.d.ts +3 -3
  231. package/dist/excalidraw/actions/types.d.ts +4 -4
  232. package/dist/excalidraw/appState.d.ts +5 -5
  233. package/dist/excalidraw/change.d.ts +191 -0
  234. package/dist/excalidraw/change.js +894 -0
  235. package/dist/excalidraw/components/App.d.ts +22 -7
  236. package/dist/excalidraw/components/App.js +340 -130
  237. package/dist/excalidraw/components/CommandPalette/CommandPalette.js +1 -0
  238. package/dist/excalidraw/components/HelpDialog.js +1 -1
  239. package/dist/excalidraw/components/Sidebar/Sidebar.d.ts +2 -2
  240. package/dist/excalidraw/components/Stack.d.ts +2 -2
  241. package/dist/excalidraw/components/ToolButton.d.ts +1 -0
  242. package/dist/excalidraw/components/ToolButton.js +1 -1
  243. package/dist/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -1
  244. package/dist/excalidraw/components/canvases/InteractiveCanvas.js +1 -0
  245. package/dist/excalidraw/components/hyperlink/Hyperlink.js +3 -3
  246. package/dist/excalidraw/components/hyperlink/helpers.js +2 -3
  247. package/dist/excalidraw/components/icons.d.ts +1 -0
  248. package/dist/excalidraw/components/icons.js +1 -0
  249. package/dist/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
  250. package/dist/excalidraw/constants.d.ts +3 -3
  251. package/dist/excalidraw/constants.js +6 -3
  252. package/dist/excalidraw/data/reconcile.d.ts +6 -0
  253. package/dist/excalidraw/data/reconcile.js +49 -0
  254. package/dist/excalidraw/data/restore.d.ts +3 -3
  255. package/dist/excalidraw/data/restore.js +6 -7
  256. package/dist/excalidraw/data/transform.d.ts +1 -1
  257. package/dist/excalidraw/data/transform.js +4 -3
  258. package/dist/excalidraw/data/url.d.ts +1 -0
  259. package/dist/excalidraw/data/url.js +4 -1
  260. package/dist/excalidraw/element/binding.d.ts +64 -9
  261. package/dist/excalidraw/element/binding.js +634 -96
  262. package/dist/excalidraw/element/bounds.d.ts +0 -1
  263. package/dist/excalidraw/element/bounds.js +0 -3
  264. package/dist/excalidraw/element/collision.d.ts +14 -19
  265. package/dist/excalidraw/element/collision.js +36 -713
  266. package/dist/excalidraw/element/embeddable.d.ts +7 -4
  267. package/dist/excalidraw/element/embeddable.js +88 -27
  268. package/dist/excalidraw/element/index.d.ts +0 -1
  269. package/dist/excalidraw/element/index.js +0 -1
  270. package/dist/excalidraw/element/linearElementEditor.d.ts +11 -11
  271. package/dist/excalidraw/element/linearElementEditor.js +7 -5
  272. package/dist/excalidraw/element/mutateElement.d.ts +1 -2
  273. package/dist/excalidraw/element/newElement.d.ts +1 -1
  274. package/dist/excalidraw/element/newElement.js +2 -1
  275. package/dist/excalidraw/element/resizeElements.d.ts +1 -1
  276. package/dist/excalidraw/element/resizeElements.js +110 -86
  277. package/dist/excalidraw/element/resizeTest.d.ts +4 -4
  278. package/dist/excalidraw/element/resizeTest.js +55 -8
  279. package/dist/excalidraw/element/sizeHelpers.js +3 -0
  280. package/dist/excalidraw/element/textElement.d.ts +1 -2
  281. package/dist/excalidraw/element/textElement.js +5 -34
  282. package/dist/excalidraw/element/transformHandles.d.ts +22 -4
  283. package/dist/excalidraw/element/transformHandles.js +24 -3
  284. package/dist/excalidraw/element/typeChecks.d.ts +2 -2
  285. package/dist/excalidraw/element/types.d.ts +19 -6
  286. package/dist/excalidraw/errors.d.ts +3 -0
  287. package/dist/excalidraw/errors.js +3 -0
  288. package/dist/excalidraw/fractionalIndex.d.ts +40 -0
  289. package/dist/excalidraw/fractionalIndex.js +241 -0
  290. package/dist/excalidraw/frame.d.ts +1 -1
  291. package/dist/excalidraw/groups.d.ts +2 -0
  292. package/dist/excalidraw/groups.js +17 -0
  293. package/dist/excalidraw/history.d.ts +34 -46
  294. package/dist/excalidraw/history.js +100 -167
  295. package/dist/excalidraw/hooks/useEmitter.d.ts +2 -0
  296. package/dist/excalidraw/hooks/useEmitter.js +13 -0
  297. package/dist/excalidraw/index.d.ts +2 -0
  298. package/dist/excalidraw/index.js +2 -0
  299. package/dist/excalidraw/locales/en.json +1 -1
  300. package/dist/excalidraw/renderer/interactiveScene.d.ts +1 -1
  301. package/dist/excalidraw/renderer/interactiveScene.js +8 -7
  302. package/dist/excalidraw/renderer/staticScene.js +14 -3
  303. package/dist/excalidraw/renderer/staticSvgScene.js +10 -0
  304. package/dist/excalidraw/scene/Scene.d.ts +7 -6
  305. package/dist/excalidraw/scene/Scene.js +31 -16
  306. package/dist/excalidraw/scene/export.js +2 -1
  307. package/dist/excalidraw/scene/types.d.ts +2 -1
  308. package/dist/excalidraw/store.d.ts +99 -0
  309. package/dist/excalidraw/store.js +269 -0
  310. package/dist/excalidraw/types.d.ts +18 -4
  311. package/dist/excalidraw/utils.d.ts +6 -0
  312. package/dist/excalidraw/utils.js +7 -0
  313. package/dist/excalidraw/zindex.d.ts +2 -2
  314. package/dist/excalidraw/zindex.js +9 -13
  315. package/dist/prod/{en-R7FEFJGC.json → en-Q552WR7L.json} +1 -1
  316. package/dist/prod/index.css +1 -1
  317. package/dist/prod/index.js +44 -44
  318. package/dist/utils/collision.d.ts +4 -0
  319. package/dist/utils/collision.js +48 -0
  320. package/dist/utils/geometry/geometry.d.ts +71 -0
  321. package/dist/utils/geometry/geometry.js +674 -0
  322. package/dist/utils/geometry/shape.d.ts +56 -0
  323. package/dist/utils/geometry/shape.js +168 -0
  324. package/history.ts +161 -216
  325. package/package.json +2 -1
  326. package/dist/browser/dev/excalidraw-assets-dev/chunk-GPOYIZPX.js.map +0 -7
  327. package/dist/browser/dev/excalidraw-assets-dev/chunk-J5HRUYQR.js.map +0 -7
  328. package/dist/browser/dev/excalidraw-assets-dev/chunk-UETNA2WX.js.map +0 -7
  329. package/dist/browser/dev/excalidraw-assets-dev/dist-Y7S5GOTG.js +0 -10
  330. package/dist/browser/dev/excalidraw-assets-dev/image-ZNQQXS62.css.map +0 -7
  331. package/dist/browser/prod/excalidraw-assets/chunk-EEN6AFMH.js +0 -269
  332. package/dist/browser/prod/excalidraw-assets/dist-7FHVDAZ2.js +0 -1
  333. package/dist/browser/prod/excalidraw-assets/flowDiagram-v2-3b53844e-CRHRHP7H.js +0 -1
  334. package/dist/browser/prod/excalidraw-assets/image-VXYNPVOG.js +0 -1
  335. package/dist/browser/prod/excalidraw-assets/image-WE6NA2G6.css +0 -1
  336. /package/dist/browser/dev/excalidraw-assets-dev/{blockDiagram-91b80b7a-RHODGCTM.js.map → blockDiagram-91b80b7a-NRABZKZA.js.map} +0 -0
  337. /package/dist/browser/dev/excalidraw-assets-dev/{c4Diagram-b2a90758-W7NCR7LR.js.map → c4Diagram-b2a90758-56M32CJD.js.map} +0 -0
  338. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-TKRIVTWP.js.map → chunk-5EDB2FTV.js.map} +0 -0
  339. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-52OGG53V.js.map → chunk-6VTJEXQH.js.map} +0 -0
  340. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-GF7VCOUM.js.map → chunk-C4OL7SRI.js.map} +0 -0
  341. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-BESQLMCW.js.map → chunk-E47I6Q7O.js.map} +0 -0
  342. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-5747M6KP.js.map → chunk-OH2YDYHX.js.map} +0 -0
  343. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-GCA4S2OA.js.map → chunk-RTA6DTUV.js.map} +0 -0
  344. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-DQOPSCYA.js.map → chunk-TTH3BTHQ.js.map} +0 -0
  345. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-B2MHJWXZ.js.map → chunk-U4N7TEPH.js.map} +0 -0
  346. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-QFS4M5OJ.js.map → chunk-V3PA4IDR.js.map} +0 -0
  347. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-SLLUETBM.js.map → chunk-WFT6ZJE6.js.map} +0 -0
  348. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-PPHFJLL7.js.map → chunk-XZKEYTKS.js.map} +0 -0
  349. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-USLWOHUZ.js.map → chunk-YC6VTXEO.js.map} +0 -0
  350. /package/dist/browser/dev/excalidraw-assets-dev/{classDiagram-30eddba6-GJGBT4TV.js.map → classDiagram-30eddba6-EZJVINS6.js.map} +0 -0
  351. /package/dist/browser/dev/excalidraw-assets-dev/{classDiagram-v2-f2df5561-LYWTIPJA.js.map → classDiagram-v2-f2df5561-XSUIN44A.js.map} +0 -0
  352. /package/dist/browser/dev/excalidraw-assets-dev/{directory-open-01563666-UREMLRIT.js.map → directory-open-01563666-KOK2HSB6.js.map} +0 -0
  353. /package/dist/browser/dev/excalidraw-assets-dev/{directory-open-4ed118d0-UN3BUDZZ.js.map → directory-open-4ed118d0-P3Q3CLF3.js.map} +0 -0
  354. /package/dist/browser/dev/excalidraw-assets-dev/{dist-Y7S5GOTG.js.map → dist-O6HOTHQF.js.map} +0 -0
  355. /package/dist/browser/dev/excalidraw-assets-dev/{en-UW5C5KGW.js.map → en-PSBMWL4S.js.map} +0 -0
  356. /package/dist/browser/dev/excalidraw-assets-dev/{erDiagram-47591fe2-Z7U2XW2Y.js.map → erDiagram-47591fe2-U7FLWOG3.js.map} +0 -0
  357. /package/dist/browser/dev/excalidraw-assets-dev/{file-open-002ab408-4QG336MG.js.map → file-open-002ab408-EQEHGU2J.js.map} +0 -0
  358. /package/dist/browser/dev/excalidraw-assets-dev/{file-open-7c801643-3QI4ICCL.js.map → file-open-7c801643-QQT6O7P5.js.map} +0 -0
  359. /package/dist/browser/dev/excalidraw-assets-dev/{file-save-3189631c-TNNERCWV.js.map → file-save-3189631c-YXX2C7C6.js.map} +0 -0
  360. /package/dist/browser/dev/excalidraw-assets-dev/{file-save-745eba88-JFMH565P.js.map → file-save-745eba88-7G554KTZ.js.map} +0 -0
  361. /package/dist/browser/dev/excalidraw-assets-dev/{flowDiagram-5540d9b9-PARVG263.js.map → flowDiagram-5540d9b9-F2VP4JAA.js.map} +0 -0
  362. /package/dist/browser/dev/excalidraw-assets-dev/{flowDiagram-v2-3b53844e-ZJOPVRMB.js.map → flowDiagram-v2-3b53844e-2WQZZRND.js.map} +0 -0
  363. /package/dist/browser/dev/excalidraw-assets-dev/{flowchart-elk-definition-5fe447d6-ULPNBSZX.js.map → flowchart-elk-definition-5fe447d6-IW6O2F6C.js.map} +0 -0
  364. /package/dist/browser/dev/excalidraw-assets-dev/{ganttDiagram-9a3bba1f-ESSYVTJ4.js.map → ganttDiagram-9a3bba1f-B5RH7ZAO.js.map} +0 -0
  365. /package/dist/browser/dev/excalidraw-assets-dev/{gitGraphDiagram-96e6b4ee-6V6VVNNP.js.map → gitGraphDiagram-96e6b4ee-INGQRNLZ.js.map} +0 -0
  366. /package/dist/browser/dev/excalidraw-assets-dev/{image-3LTGFHLF.js.map → image-GMAHLVER.js.map} +0 -0
  367. /package/dist/browser/dev/excalidraw-assets-dev/{image-blob-reduce.esm-KTX27DAY.js.map → image-blob-reduce.esm-OX75MRP3.js.map} +0 -0
  368. /package/dist/browser/dev/excalidraw-assets-dev/{infoDiagram-bcd20f53-I22FLFX3.js.map → infoDiagram-bcd20f53-43FMAUOR.js.map} +0 -0
  369. /package/dist/browser/dev/excalidraw-assets-dev/{journeyDiagram-4fe6b3dc-WAO6F52C.js.map → journeyDiagram-4fe6b3dc-KFVOUX4I.js.map} +0 -0
  370. /package/dist/browser/dev/excalidraw-assets-dev/{katex-NWA2YFOP.js.map → katex-A3GRORPB.js.map} +0 -0
  371. /package/dist/browser/dev/excalidraw-assets-dev/{mindmap-definition-f354de21-K74IKX4Y.js.map → mindmap-definition-f354de21-D7S3CRQ4.js.map} +0 -0
  372. /package/dist/browser/dev/excalidraw-assets-dev/{pica-3TH2EGXR.js.map → pica-ZAD7MTGA.js.map} +0 -0
  373. /package/dist/browser/dev/excalidraw-assets-dev/{pieDiagram-79897490-DOB2LVE5.js.map → pieDiagram-79897490-OON2CRZ5.js.map} +0 -0
  374. /package/dist/browser/dev/excalidraw-assets-dev/{quadrantDiagram-62f64e94-MJV2X7WI.js.map → quadrantDiagram-62f64e94-5APTNVVS.js.map} +0 -0
  375. /package/dist/browser/dev/excalidraw-assets-dev/{requirementDiagram-05bf5f74-H4YM3XN7.js.map → requirementDiagram-05bf5f74-FM7WZVKU.js.map} +0 -0
  376. /package/dist/browser/dev/excalidraw-assets-dev/{roundRect-4S3QV2NZ.js.map → roundRect-AYYHVX5X.js.map} +0 -0
  377. /package/dist/browser/dev/excalidraw-assets-dev/{sankeyDiagram-97764748-7X74ABAN.js.map → sankeyDiagram-97764748-5HLEFFGY.js.map} +0 -0
  378. /package/dist/browser/dev/excalidraw-assets-dev/{sequenceDiagram-acc0e65c-PPDIJFQP.js.map → sequenceDiagram-acc0e65c-4ZRSNGPV.js.map} +0 -0
  379. /package/dist/browser/dev/excalidraw-assets-dev/{stateDiagram-0ff1cf1a-JVBR7N35.js.map → stateDiagram-0ff1cf1a-OLTPYRPP.js.map} +0 -0
  380. /package/dist/browser/dev/excalidraw-assets-dev/{stateDiagram-v2-9a9d610d-QYAJLQJH.js.map → stateDiagram-v2-9a9d610d-N3XOTAEE.js.map} +0 -0
  381. /package/dist/browser/dev/excalidraw-assets-dev/{timeline-definition-fea2a41d-GL7U3WDB.js.map → timeline-definition-fea2a41d-5PDFIYJQ.js.map} +0 -0
  382. /package/dist/browser/dev/excalidraw-assets-dev/{xychartDiagram-ab372869-4U4JE4TW.js.map → xychartDiagram-ab372869-VIWBP45Y.js.map} +0 -0
@@ -0,0 +1,335 @@
1
+ import{E as xv}from"./chunk-Q6QP4TRB.js";import{aa as lk}from"./chunk-SJBOQTFA.js";import{a as S,b as L}from"./chunk-6TNDONBF.js";import{d as Je,f as _}from"./chunk-SXMPUQ6M.js";var Sv=Je(wv=>{S();var ck;(function(e){typeof DO_NOT_EXPORT_CRC>"u"?typeof wv=="object"?e(wv):typeof define=="function"&&define.amd?define(function(){var t={};return e(t),t}):e(ck={}):e(ck={})})(function(e){e.version="0.3.0";function t(){for(var l=0,c=new Array(256),d=0;d!=256;++d)l=d,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,c[d]=l;return typeof Int32Array<"u"?new Int32Array(c):c}var n=t(),r=typeof Buffer<"u";function i(l){if(l.length>32768&&r)return o(new Buffer(l));for(var c=-1,d=l.length-1,u=0;u<d;)c=n[(c^l.charCodeAt(u++))&255]^c>>>8,c=n[(c^l.charCodeAt(u++))&255]^c>>>8;return u===d&&(c=c>>>8^n[(c^l.charCodeAt(u))&255]),c^-1}function a(l){if(l.length>1e4)return o(l);for(var c=-1,d=0,u=l.length-3;d<u;)c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255];for(;d<u+3;)c=c>>>8^n[(c^l[d++])&255];return c^-1}function o(l){for(var c=-1,d=0,u=l.length-7;d<u;)c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255];for(;d<u+7;)c=c>>>8^n[(c^l[d++])&255];return c^-1}function s(l){for(var c=-1,d=0,u=l.length,h,m;d<u;)h=l.charCodeAt(d++),h<128?c=c>>>8^n[(c^h)&255]:h<2048?(c=c>>>8^n[(c^(192|h>>6&31))&255],c=c>>>8^n[(c^(128|h&63))&255]):h>=55296&&h<57344?(h=(h&1023)+64,m=l.charCodeAt(d++)&1023,c=c>>>8^n[(c^(240|h>>8&7))&255],c=c>>>8^n[(c^(128|h>>2&63))&255],c=c>>>8^n[(c^(128|m>>6&15|h&3))&255],c=c>>>8^n[(c^(128|m&63))&255]):(c=c>>>8^n[(c^(224|h>>12&15))&255],c=c>>>8^n[(c^(128|h>>6&63))&255],c=c>>>8^n[(c^(128|h&63))&255]);return c^-1}e.table=n,e.bstr=i,e.buf=a,e.str=s})});var Cv=Je((Ooe,dk)=>{S();var dY=Sv();dk.exports=mY;var za=new Uint8Array(4),uY=new Int32Array(za.buffer),hY=new Uint32Array(za.buffer);function mY(e){if(e[0]!==137)throw new Error("Invalid .png file header");if(e[1]!==80)throw new Error("Invalid .png file header");if(e[2]!==78)throw new Error("Invalid .png file header");if(e[3]!==71)throw new Error("Invalid .png file header");if(e[4]!==13)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");if(e[5]!==10)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");if(e[6]!==26)throw new Error("Invalid .png file header");if(e[7]!==10)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");for(var t=!1,n=[],r=8;r<e.length;){za[3]=e[r++],za[2]=e[r++],za[1]=e[r++],za[0]=e[r++];var i=hY[0]+4,a=new Uint8Array(i);a[0]=e[r++],a[1]=e[r++],a[2]=e[r++],a[3]=e[r++];var o=String.fromCharCode(a[0])+String.fromCharCode(a[1])+String.fromCharCode(a[2])+String.fromCharCode(a[3]);if(!n.length&&o!=="IHDR")throw new Error("IHDR header missing");if(o==="IEND"){t=!0,n.push({name:o,data:new Uint8Array(0)});break}for(var s=4;s<i;s++)a[s]=e[r++];za[3]=e[r++],za[2]=e[r++],za[1]=e[r++],za[0]=e[r++];var l=uY[0],c=dY.buf(a);if(c!==l)throw new Error("CRC values for "+o+" header do not match, PNG file is likely corrupted");var d=new Uint8Array(a.buffer.slice(4));n.push({name:o,data:d})}if(!t)throw new Error(".png file ended prematurely: no IEND header was found");return n}});var hk=Je(($oe,uk)=>{S();uk.exports=pY;function pY(e,t){if(e=String(e),t=String(t),!/^[\x00-\xFF]+$/.test(e)||!/^[\x00-\xFF]+$/.test(t))throw new Error("Only Latin-1 characters are permitted in PNG tEXt chunks. You might want to consider base64 encoding and/or zEXt compression");if(e.length>=80)throw new Error('Keyword "'+e+'" is longer than the 79-character limit imposed by the PNG specification');for(var n=e.length+t.length+1,r=new Uint8Array(n),i=0,a,o=0;o<e.length;o++){if(!(a=e.charCodeAt(o)))throw new Error("0x00 character is not permitted in tEXt keywords");r[i++]=a}r[i++]=0;for(var s=0;s<t.length;s++){if(!(a=t.charCodeAt(s)))throw new Error("0x00 character is not permitted in tEXt content");r[i++]=a}return{name:"tEXt",data:r}}});var pk=Je((Boe,mk)=>{S();mk.exports=fY;function fY(e){e.data&&e.name&&(e=e.data);for(var t=!0,n="",r="",i=0;i<e.length;i++){var a=e[i];if(t)a?r+=String.fromCharCode(a):t=!1;else if(a)n+=String.fromCharCode(a);else throw new Error("Invalid NULL character found. 0x00 character is not permitted in tEXt content")}return{keyword:r,text:n}}});var Iv=Je(Tv=>{S();Tv.encode=hk();Tv.decode=pk()});var gk=Je((Goe,fk)=>{S();fk.exports=function(e,t,n){var r=[],i=e.length;if(i===0)return r;var a=t<0?Math.max(0,t+i):t||0;for(n!==void 0&&(i=n<0?n+i:n);i-- >a;)r[i-a]=e[i];return r}});var Mv=Je((Woe,Ek)=>{S();var gY=gk(),EY=Sv();Ek.exports=vY;var Ha=new Uint8Array(4),bY=new Int32Array(Ha.buffer),yY=new Uint32Array(Ha.buffer);function vY(e){var t=8,n=t,r;for(r=0;r<e.length;r++)t+=e[r].data.length,t+=12;var i=new Uint8Array(t);for(i[0]=137,i[1]=80,i[2]=78,i[3]=71,i[4]=13,i[5]=10,i[6]=26,i[7]=10,r=0;r<e.length;r++){var a=e[r],o=a.name,s=a.data,l=s.length,c=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)];yY[0]=l,i[n++]=Ha[3],i[n++]=Ha[2],i[n++]=Ha[1],i[n++]=Ha[0],i[n++]=c[0],i[n++]=c[1],i[n++]=c[2],i[n++]=c[3];for(var d=0;d<l;)i[n++]=s[d++];var u=c.concat(gY(s)),h=EY.buf(u);bY[0]=h,i[n++]=Ha[3],i[n++]=Ha[2],i[n++]=Ha[1],i[n++]=Ha[0]}return i}});var Do=Je(vr=>{"use strict";S();var xY=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function wY(e,t){return Object.prototype.hasOwnProperty.call(e,t)}vr.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(var r in n)wY(n,r)&&(e[r]=n[r])}}return e};vr.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var SY={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray){e.set(t.subarray(n,n+r),i);return}for(var a=0;a<r;a++)e[i+a]=t[n+a]},flattenChunks:function(e){var t,n,r,i,a,o;for(r=0,t=0,n=e.length;t<n;t++)r+=e[t].length;for(o=new Uint8Array(r),i=0,t=0,n=e.length;t<n;t++)a=e[t],o.set(a,i),i+=a.length;return o}},CY={arraySet:function(e,t,n,r,i){for(var a=0;a<r;a++)e[i+a]=t[n+a]},flattenChunks:function(e){return[].concat.apply([],e)}};vr.setTyped=function(e){e?(vr.Buf8=Uint8Array,vr.Buf16=Uint16Array,vr.Buf32=Int32Array,vr.assign(vr,SY)):(vr.Buf8=Array,vr.Buf16=Array,vr.Buf32=Array,vr.assign(vr,CY))};vr.setTyped(xY)});var zk=Je(Ad=>{"use strict";S();var TY=Do(),IY=4,bk=0,yk=1,MY=2;function Md(e){for(var t=e.length;--t>=0;)e[t]=0}var AY=0,Tk=1,kY=2,PY=3,DY=258,Rv=29,rm=256,Jh=rm+1+Rv,Id=30,Ov=19,Ik=2*Jh+1,ec=15,Av=16,_Y=7,Nv=256,Mk=16,Ak=17,kk=18,_v=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],B1=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],LY=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Pk=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],RY=512,_o=new Array((Jh+2)*2);Md(_o);var Qh=new Array(Id*2);Md(Qh);var em=new Array(RY);Md(em);var tm=new Array(DY-PY+1);Md(tm);var $v=new Array(Rv);Md($v);var z1=new Array(Id);Md(z1);function kv(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}var Dk,_k,Lk;function Pv(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Rk(e){return e<256?em[e]:em[256+(e>>>7)]}function nm(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function Rr(e,t,n){e.bi_valid>Av-n?(e.bi_buf|=t<<e.bi_valid&65535,nm(e,e.bi_buf),e.bi_buf=t>>Av-e.bi_valid,e.bi_valid+=n-Av):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function Ua(e,t,n){Rr(e,n[t*2],n[t*2+1])}function Ok(e,t){var n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1}function OY(e){e.bi_valid===16?(nm(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function NY(e,t){var n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length,c,d,u,h,m,p,f=0;for(h=0;h<=ec;h++)e.bl_count[h]=0;for(n[e.heap[e.heap_max]*2+1]=0,c=e.heap_max+1;c<Ik;c++)d=e.heap[c],h=n[n[d*2+1]*2+1]+1,h>l&&(h=l,f++),n[d*2+1]=h,!(d>r)&&(e.bl_count[h]++,m=0,d>=s&&(m=o[d-s]),p=n[d*2],e.opt_len+=p*(h+m),a&&(e.static_len+=p*(i[d*2+1]+m)));if(f!==0){do{for(h=l-1;e.bl_count[h]===0;)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[l]--,f-=2}while(f>0);for(h=l;h!==0;h--)for(d=e.bl_count[h];d!==0;)u=e.heap[--c],!(u>r)&&(n[u*2+1]!==h&&(e.opt_len+=(h-n[u*2+1])*n[u*2],n[u*2+1]=h),d--)}}function Nk(e,t,n){var r=new Array(ec+1),i=0,a,o;for(a=1;a<=ec;a++)r[a]=i=i+n[a-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=Ok(r[s]++,s))}}function $Y(){var e,t,n,r,i,a=new Array(ec+1);for(n=0,r=0;r<Rv-1;r++)for($v[r]=n,e=0;e<1<<_v[r];e++)tm[n++]=r;for(tm[n-1]=r,i=0,r=0;r<16;r++)for(z1[r]=i,e=0;e<1<<B1[r];e++)em[i++]=r;for(i>>=7;r<Id;r++)for(z1[r]=i<<7,e=0;e<1<<B1[r]-7;e++)em[256+i++]=r;for(t=0;t<=ec;t++)a[t]=0;for(e=0;e<=143;)_o[e*2+1]=8,e++,a[8]++;for(;e<=255;)_o[e*2+1]=9,e++,a[9]++;for(;e<=279;)_o[e*2+1]=7,e++,a[7]++;for(;e<=287;)_o[e*2+1]=8,e++,a[8]++;for(Nk(_o,Jh+1,a),e=0;e<Id;e++)Qh[e*2+1]=5,Qh[e*2]=Ok(e,5);Dk=new kv(_o,_v,rm+1,Jh,ec),_k=new kv(Qh,B1,0,Id,ec),Lk=new kv(new Array(0),LY,0,Ov,_Y)}function $k(e){var t;for(t=0;t<Jh;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Id;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Ov;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Nv*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Fk(e){e.bi_valid>8?nm(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function FY(e,t,n,r){Fk(e),r&&(nm(e,n),nm(e,~n)),TY.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}function vk(e,t,n,r){var i=t*2,a=n*2;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]}function Dv(e,t,n){for(var r=e.heap[n],i=n<<1;i<=e.heap_len&&(i<e.heap_len&&vk(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!vk(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r}function xk(e,t,n){var r,i,a=0,o,s;if(e.last_lit!==0)do r=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1],i=e.pending_buf[e.l_buf+a],a++,r===0?Ua(e,i,t):(o=tm[i],Ua(e,o+rm+1,t),s=_v[o],s!==0&&(i-=$v[o],Rr(e,i,s)),r--,o=Rk(r),Ua(e,o,n),s=B1[o],s!==0&&(r-=z1[o],Rr(e,r,s)));while(a<e.last_lit);Ua(e,Nv,t)}function Lv(e,t){var n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,l=-1,c;for(e.heap_len=0,e.heap_max=Ik,o=0;o<a;o++)n[o*2]!==0?(e.heap[++e.heap_len]=l=o,e.depth[o]=0):n[o*2+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=l<2?++l:0,n[c*2]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=r[c*2+1]);for(t.max_code=l,o=e.heap_len>>1;o>=1;o--)Dv(e,n,o);c=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Dv(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[c*2]=n[o*2]+n[s*2],e.depth[c]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=c,e.heap[1]=c++,Dv(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],NY(e,t),Nk(n,l,e.bl_count)}function wk(e,t,n){var r,i=-1,a,o=t[0*2+1],s=0,l=7,c=4;for(o===0&&(l=138,c=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=t[(r+1)*2+1],!(++s<l&&a===o)&&(s<c?e.bl_tree[a*2]+=s:a!==0?(a!==i&&e.bl_tree[a*2]++,e.bl_tree[Mk*2]++):s<=10?e.bl_tree[Ak*2]++:e.bl_tree[kk*2]++,s=0,i=a,o===0?(l=138,c=3):a===o?(l=6,c=3):(l=7,c=4))}function Sk(e,t,n){var r,i=-1,a,o=t[0*2+1],s=0,l=7,c=4;for(o===0&&(l=138,c=3),r=0;r<=n;r++)if(a=o,o=t[(r+1)*2+1],!(++s<l&&a===o)){if(s<c)do Ua(e,a,e.bl_tree);while(--s!==0);else a!==0?(a!==i&&(Ua(e,a,e.bl_tree),s--),Ua(e,Mk,e.bl_tree),Rr(e,s-3,2)):s<=10?(Ua(e,Ak,e.bl_tree),Rr(e,s-3,3)):(Ua(e,kk,e.bl_tree),Rr(e,s-11,7));s=0,i=a,o===0?(l=138,c=3):a===o?(l=6,c=3):(l=7,c=4)}}function BY(e){var t;for(wk(e,e.dyn_ltree,e.l_desc.max_code),wk(e,e.dyn_dtree,e.d_desc.max_code),Lv(e,e.bl_desc),t=Ov-1;t>=3&&e.bl_tree[Pk[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function zY(e,t,n,r){var i;for(Rr(e,t-257,5),Rr(e,n-1,5),Rr(e,r-4,4),i=0;i<r;i++)Rr(e,e.bl_tree[Pk[i]*2+1],3);Sk(e,e.dyn_ltree,t-1),Sk(e,e.dyn_dtree,n-1)}function HY(e){var t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return bk;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return yk;for(n=32;n<rm;n++)if(e.dyn_ltree[n*2]!==0)return yk;return bk}var Ck=!1;function UY(e){Ck||($Y(),Ck=!0),e.l_desc=new Pv(e.dyn_ltree,Dk),e.d_desc=new Pv(e.dyn_dtree,_k),e.bl_desc=new Pv(e.bl_tree,Lk),e.bi_buf=0,e.bi_valid=0,$k(e)}function Bk(e,t,n,r){Rr(e,(AY<<1)+(r?1:0),3),FY(e,t,n,!0)}function GY(e){Rr(e,Tk<<1,3),Ua(e,Nv,_o),OY(e)}function jY(e,t,n,r){var i,a,o=0;e.level>0?(e.strm.data_type===MY&&(e.strm.data_type=HY(e)),Lv(e,e.l_desc),Lv(e,e.d_desc),o=BY(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&t!==-1?Bk(e,t,n,r):e.strategy===IY||a===i?(Rr(e,(Tk<<1)+(r?1:0),3),xk(e,_o,Qh)):(Rr(e,(kY<<1)+(r?1:0),3),zY(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),xk(e,e.dyn_ltree,e.dyn_dtree)),$k(e),r&&Fk(e)}function WY(e,t,n){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=n&255,e.last_lit++,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(tm[n]+rm+1)*2]++,e.dyn_dtree[Rk(t)*2]++),e.last_lit===e.lit_bufsize-1}Ad._tr_init=UY;Ad._tr_stored_block=Bk;Ad._tr_flush_block=jY;Ad._tr_tally=WY;Ad._tr_align=GY});var Fv=Je((qoe,Hk)=>{"use strict";S();function VY(e,t,n,r){for(var i=e&65535|0,a=e>>>16&65535|0,o=0;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0}Hk.exports=VY});var Bv=Je((Joe,Uk)=>{"use strict";S();function YY(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var ZY=YY();function KY(e,t,n,r){var i=ZY,a=r+n;e^=-1;for(var o=r;o<a;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}Uk.exports=KY});var H1=Je((tse,Gk)=>{"use strict";S();Gk.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Qk=Je(Wa=>{"use strict";S();var xr=Do(),Si=zk(),Yk=Fv(),Ns=Bv(),XY=H1(),ic=0,qY=1,QY=3,Hs=4,jk=5,ja=0,Wk=1,Ci=-2,JY=-3,zv=-5,eZ=-1,tZ=1,U1=2,nZ=3,rZ=4,iZ=0,aZ=2,V1=8,oZ=9,sZ=15,lZ=8,cZ=29,dZ=256,Uv=dZ+1+cZ,uZ=30,hZ=19,mZ=2*Uv+1,pZ=15,qe=3,Bs=258,qi=Bs+qe+1,fZ=32,Y1=42,Gv=69,G1=73,j1=91,W1=103,tc=113,am=666,Dn=1,om=2,nc=3,Dd=4,gZ=3;function zs(e,t){return e.msg=XY[t],t}function Vk(e){return(e<<1)-(e>4?9:0)}function Fs(e){for(var t=e.length;--t>=0;)e[t]=0}function $s(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(xr.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))}function Qn(e,t){Si._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,$s(e.strm)}function ot(e,t){e.pending_buf[e.pending++]=t}function im(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function EZ(e,t,n,r){var i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,xr.arraySet(t,e.input,e.next_in,i,n),e.state.wrap===1?e.adler=Yk(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Ns(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)}function Zk(e,t){var n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,l=e.strstart>e.w_size-qi?e.strstart-(e.w_size-qi):0,c=e.window,d=e.w_mask,u=e.prev,h=e.strstart+Bs,m=c[r+o-1],p=c[r+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(c[i+o]!==p||c[i+o-1]!==m||c[i]!==c[r]||c[++i]!==c[r+1])){r+=2,i++;do;while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&r<h);if(a=Bs-(h-r),r=h-Bs,a>o){if(e.match_start=t,o=a,a>=s)break;m=c[r+o-1],p=c[r+o]}}while((t=u[t&d])>l&&--n!==0);return o<=e.lookahead?o:e.lookahead}function rc(e){var t=e.w_size,n,r,i,a,o;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-qi)){xr.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,r=e.hash_size,n=r;do i=e.head[--n],e.head[n]=i>=t?i-t:0;while(--r);r=t,n=r;do i=e.prev[--n],e.prev[n]=i>=t?i-t:0;while(--r);a+=t}if(e.strm.avail_in===0)break;if(r=EZ(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=r,e.lookahead+e.insert>=qe)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+qe-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<qe)););}while(e.lookahead<qi&&e.strm.avail_in!==0)}function bZ(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(rc(e),e.lookahead===0&&t===ic)return Dn;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((e.strstart===0||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,Qn(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-qi&&(Qn(e,!1),e.strm.avail_out===0))return Dn}return e.insert=0,t===Hs?(Qn(e,!0),e.strm.avail_out===0?nc:Dd):(e.strstart>e.block_start&&(Qn(e,!1),e.strm.avail_out===0),Dn)}function Hv(e,t){for(var n,r;;){if(e.lookahead<qi){if(rc(e),e.lookahead<qi&&t===ic)return Dn;if(e.lookahead===0)break}if(n=0,e.lookahead>=qe&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+qe-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-qi&&(e.match_length=Zk(e,n)),e.match_length>=qe)if(r=Si._tr_tally(e,e.strstart-e.match_start,e.match_length-qe),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=qe){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+qe-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=Si._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Qn(e,!1),e.strm.avail_out===0))return Dn}return e.insert=e.strstart<qe-1?e.strstart:qe-1,t===Hs?(Qn(e,!0),e.strm.avail_out===0?nc:Dd):e.last_lit&&(Qn(e,!1),e.strm.avail_out===0)?Dn:om}function kd(e,t){for(var n,r,i;;){if(e.lookahead<qi){if(rc(e),e.lookahead<qi&&t===ic)return Dn;if(e.lookahead===0)break}if(n=0,e.lookahead>=qe&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+qe-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=qe-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-qi&&(e.match_length=Zk(e,n),e.match_length<=5&&(e.strategy===tZ||e.match_length===qe&&e.strstart-e.match_start>4096)&&(e.match_length=qe-1)),e.prev_length>=qe&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-qe,r=Si._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-qe),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+qe-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=qe-1,e.strstart++,r&&(Qn(e,!1),e.strm.avail_out===0))return Dn}else if(e.match_available){if(r=Si._tr_tally(e,0,e.window[e.strstart-1]),r&&Qn(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Dn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Si._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<qe-1?e.strstart:qe-1,t===Hs?(Qn(e,!0),e.strm.avail_out===0?nc:Dd):e.last_lit&&(Qn(e,!1),e.strm.avail_out===0)?Dn:om}function yZ(e,t){for(var n,r,i,a,o=e.window;;){if(e.lookahead<=Bs){if(rc(e),e.lookahead<=Bs&&t===ic)return Dn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=qe&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+Bs;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a);e.match_length=Bs-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=qe?(n=Si._tr_tally(e,1,e.match_length-qe),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Si._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Qn(e,!1),e.strm.avail_out===0))return Dn}return e.insert=0,t===Hs?(Qn(e,!0),e.strm.avail_out===0?nc:Dd):e.last_lit&&(Qn(e,!1),e.strm.avail_out===0)?Dn:om}function vZ(e,t){for(var n;;){if(e.lookahead===0&&(rc(e),e.lookahead===0)){if(t===ic)return Dn;break}if(e.match_length=0,n=Si._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Qn(e,!1),e.strm.avail_out===0))return Dn}return e.insert=0,t===Hs?(Qn(e,!0),e.strm.avail_out===0?nc:Dd):e.last_lit&&(Qn(e,!1),e.strm.avail_out===0)?Dn:om}function Ga(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}var Pd;Pd=[new Ga(0,0,0,0,bZ),new Ga(4,4,8,4,Hv),new Ga(4,5,16,8,Hv),new Ga(4,6,32,32,Hv),new Ga(4,4,16,16,kd),new Ga(8,16,32,32,kd),new Ga(8,16,128,128,kd),new Ga(8,32,128,256,kd),new Ga(32,128,258,1024,kd),new Ga(32,258,258,4096,kd)];function xZ(e){e.window_size=2*e.w_size,Fs(e.head),e.max_lazy_match=Pd[e.level].max_lazy,e.good_match=Pd[e.level].good_length,e.nice_match=Pd[e.level].nice_length,e.max_chain_length=Pd[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=qe-1,e.match_available=0,e.ins_h=0}function wZ(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=V1,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new xr.Buf16(mZ*2),this.dyn_dtree=new xr.Buf16((2*uZ+1)*2),this.bl_tree=new xr.Buf16((2*hZ+1)*2),Fs(this.dyn_ltree),Fs(this.dyn_dtree),Fs(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new xr.Buf16(pZ+1),this.heap=new xr.Buf16(2*Uv+1),Fs(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new xr.Buf16(2*Uv+1),Fs(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Kk(e){var t;return!e||!e.state?zs(e,Ci):(e.total_in=e.total_out=0,e.data_type=aZ,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Y1:tc,e.adler=t.wrap===2?0:1,t.last_flush=ic,Si._tr_init(t),ja)}function Xk(e){var t=Kk(e);return t===ja&&xZ(e.state),t}function SZ(e,t){return!e||!e.state||e.state.wrap!==2?Ci:(e.state.gzhead=t,ja)}function qk(e,t,n,r,i,a){if(!e)return Ci;var o=1;if(t===eZ&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>oZ||n!==V1||r<8||r>15||t<0||t>9||a<0||a>rZ)return zs(e,Ci);r===8&&(r=9);var s=new wZ;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+qe-1)/qe),s.window=new xr.Buf8(s.w_size*2),s.head=new xr.Buf16(s.hash_size),s.prev=new xr.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new xr.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=n,Xk(e)}function CZ(e,t){return qk(e,t,V1,sZ,lZ,iZ)}function TZ(e,t){var n,r,i,a;if(!e||!e.state||t>jk||t<0)return e?zs(e,Ci):Ci;if(r=e.state,!e.output||!e.input&&e.avail_in!==0||r.status===am&&t!==Hs)return zs(e,e.avail_out===0?zv:Ci);if(r.strm=e,n=r.last_flush,r.last_flush=t,r.status===Y1)if(r.wrap===2)e.adler=0,ot(r,31),ot(r,139),ot(r,8),r.gzhead?(ot(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ot(r,r.gzhead.time&255),ot(r,r.gzhead.time>>8&255),ot(r,r.gzhead.time>>16&255),ot(r,r.gzhead.time>>24&255),ot(r,r.level===9?2:r.strategy>=U1||r.level<2?4:0),ot(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(ot(r,r.gzhead.extra.length&255),ot(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=Ns(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Gv):(ot(r,0),ot(r,0),ot(r,0),ot(r,0),ot(r,0),ot(r,r.level===9?2:r.strategy>=U1||r.level<2?4:0),ot(r,gZ),r.status=tc);else{var o=V1+(r.w_bits-8<<4)<<8,s=-1;r.strategy>=U1||r.level<2?s=0:r.level<6?s=1:r.level===6?s=2:s=3,o|=s<<6,r.strstart!==0&&(o|=fZ),o+=31-o%31,r.status=tc,im(r,o),r.strstart!==0&&(im(r,e.adler>>>16),im(r,e.adler&65535)),e.adler=1}if(r.status===Gv)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=Ns(e.adler,r.pending_buf,r.pending-i,i)),$s(e),i=r.pending,r.pending===r.pending_buf_size));)ot(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(e.adler=Ns(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=G1)}else r.status=G1;if(r.status===G1)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=Ns(e.adler,r.pending_buf,r.pending-i,i)),$s(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}r.gzindex<r.gzhead.name.length?a=r.gzhead.name.charCodeAt(r.gzindex++)&255:a=0,ot(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(e.adler=Ns(e.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.gzindex=0,r.status=j1)}else r.status=j1;if(r.status===j1)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=Ns(e.adler,r.pending_buf,r.pending-i,i)),$s(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}r.gzindex<r.gzhead.comment.length?a=r.gzhead.comment.charCodeAt(r.gzindex++)&255:a=0,ot(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(e.adler=Ns(e.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.status=W1)}else r.status=W1;if(r.status===W1&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&$s(e),r.pending+2<=r.pending_buf_size&&(ot(r,e.adler&255),ot(r,e.adler>>8&255),e.adler=0,r.status=tc)):r.status=tc),r.pending!==0){if($s(e),e.avail_out===0)return r.last_flush=-1,ja}else if(e.avail_in===0&&Vk(t)<=Vk(n)&&t!==Hs)return zs(e,zv);if(r.status===am&&e.avail_in!==0)return zs(e,zv);if(e.avail_in!==0||r.lookahead!==0||t!==ic&&r.status!==am){var l=r.strategy===U1?vZ(r,t):r.strategy===nZ?yZ(r,t):Pd[r.level].func(r,t);if((l===nc||l===Dd)&&(r.status=am),l===Dn||l===nc)return e.avail_out===0&&(r.last_flush=-1),ja;if(l===om&&(t===qY?Si._tr_align(r):t!==jk&&(Si._tr_stored_block(r,0,0,!1),t===QY&&(Fs(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),$s(e),e.avail_out===0))return r.last_flush=-1,ja}return t!==Hs?ja:r.wrap<=0?Wk:(r.wrap===2?(ot(r,e.adler&255),ot(r,e.adler>>8&255),ot(r,e.adler>>16&255),ot(r,e.adler>>24&255),ot(r,e.total_in&255),ot(r,e.total_in>>8&255),ot(r,e.total_in>>16&255),ot(r,e.total_in>>24&255)):(im(r,e.adler>>>16),im(r,e.adler&65535)),$s(e),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?ja:Wk)}function IZ(e){var t;return!e||!e.state?Ci:(t=e.state.status,t!==Y1&&t!==Gv&&t!==G1&&t!==j1&&t!==W1&&t!==tc&&t!==am?zs(e,Ci):(e.state=null,t===tc?zs(e,JY):ja))}function MZ(e,t){var n=t.length,r,i,a,o,s,l,c,d;if(!e||!e.state||(r=e.state,o=r.wrap,o===2||o===1&&r.status!==Y1||r.lookahead))return Ci;for(o===1&&(e.adler=Yk(e.adler,t,n,0)),r.wrap=0,n>=r.w_size&&(o===0&&(Fs(r.head),r.strstart=0,r.block_start=0,r.insert=0),d=new xr.Buf8(r.w_size),xr.arraySet(d,t,n-r.w_size,r.w_size,0),t=d,n=r.w_size),s=e.avail_in,l=e.next_in,c=e.input,e.avail_in=n,e.next_in=0,e.input=t,rc(r);r.lookahead>=qe;){i=r.strstart,a=r.lookahead-(qe-1);do r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+qe-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++;while(--a);r.strstart=i,r.lookahead=qe-1,rc(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=qe-1,r.match_available=0,e.next_in=l,e.input=c,e.avail_in=s,r.wrap=o,ja}Wa.deflateInit=CZ;Wa.deflateInit2=qk;Wa.deflateReset=Xk;Wa.deflateResetKeep=Kk;Wa.deflateSetHeader=SZ;Wa.deflate=TZ;Wa.deflateEnd=IZ;Wa.deflateSetDictionary=MZ;Wa.deflateInfo="pako deflate (from Nodeca project)"});var jv=Je(_d=>{"use strict";S();var Z1=Do(),Jk=!0,e8=!0;try{String.fromCharCode.apply(null,[0])}catch{Jk=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{e8=!1}var sm=new Z1.Buf8(256);for(Lo=0;Lo<256;Lo++)sm[Lo]=Lo>=252?6:Lo>=248?5:Lo>=240?4:Lo>=224?3:Lo>=192?2:1;var Lo;sm[254]=sm[254]=1;_d.string2buf=function(e){var t,n,r,i,a,o=e.length,s=0;for(i=0;i<o;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<o&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Z1.Buf8(s),a=0,i=0;a<s;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<o&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t};function t8(e,t){if(t<65534&&(e.subarray&&e8||!e.subarray&&Jk))return String.fromCharCode.apply(null,Z1.shrinkBuf(e,t));for(var n="",r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n}_d.buf2binstring=function(e){return t8(e,e.length)};_d.binstring2buf=function(e){for(var t=new Z1.Buf8(e.length),n=0,r=t.length;n<r;n++)t[n]=e.charCodeAt(n);return t};_d.buf2string=function(e,t){var n,r,i,a,o=t||e.length,s=new Array(o*2);for(r=0,n=0;n<o;){if(i=e[n++],i<128){s[r++]=i;continue}if(a=sm[i],a>4){s[r++]=65533,n+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&n<o;)i=i<<6|e[n++]&63,a--;if(a>1){s[r++]=65533;continue}i<65536?s[r++]=i:(i-=65536,s[r++]=55296|i>>10&1023,s[r++]=56320|i&1023)}return t8(s,r)};_d.utf8border=function(e,t){var n;for(t=t||e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+sm[e[n]]>t?n:t}});var Wv=Je((sse,n8)=>{"use strict";S();function AZ(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}n8.exports=AZ});var o8=Je(dm=>{"use strict";S();var lm=Qk(),cm=Do(),Yv=jv(),Zv=H1(),kZ=Wv(),a8=Object.prototype.toString,PZ=0,Vv=4,Ld=0,r8=1,i8=2,DZ=-1,_Z=0,LZ=8;function ac(e){if(!(this instanceof ac))return new ac(e);this.options=cm.assign({level:DZ,method:LZ,chunkSize:16384,windowBits:15,memLevel:8,strategy:_Z,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new kZ,this.strm.avail_out=0;var n=lm.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Ld)throw new Error(Zv[n]);if(t.header&&lm.deflateSetHeader(this.strm,t.header),t.dictionary){var r;if(typeof t.dictionary=="string"?r=Yv.string2buf(t.dictionary):a8.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=lm.deflateSetDictionary(this.strm,r),n!==Ld)throw new Error(Zv[n]);this._dict_set=!0}}ac.prototype.push=function(e,t){var n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;a=t===~~t?t:t===!0?Vv:PZ,typeof e=="string"?n.input=Yv.string2buf(e):a8.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new cm.Buf8(r),n.next_out=0,n.avail_out=r),i=lm.deflate(n,a),i!==r8&&i!==Ld)return this.onEnd(i),this.ended=!0,!1;(n.avail_out===0||n.avail_in===0&&(a===Vv||a===i8))&&(this.options.to==="string"?this.onData(Yv.buf2binstring(cm.shrinkBuf(n.output,n.next_out))):this.onData(cm.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||n.avail_out===0)&&i!==r8);return a===Vv?(i=lm.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Ld):(a===i8&&(this.onEnd(Ld),n.avail_out=0),!0)};ac.prototype.onData=function(e){this.chunks.push(e)};ac.prototype.onEnd=function(e){e===Ld&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=cm.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Kv(e,t){var n=new ac(t);if(n.push(e,!0),n.err)throw n.msg||Zv[n.err];return n.result}function RZ(e,t){return t=t||{},t.raw=!0,Kv(e,t)}function OZ(e,t){return t=t||{},t.gzip=!0,Kv(e,t)}dm.Deflate=ac;dm.deflate=Kv;dm.deflateRaw=RZ;dm.gzip=OZ});var l8=Je((use,s8)=>{"use strict";S();var K1=30,NZ=12;s8.exports=function(t,n){var r,i,a,o,s,l,c,d,u,h,m,p,f,g,b,v,y,w,C,A,T,I,k,R,O;r=t.state,i=t.next_in,R=t.input,a=i+(t.avail_in-5),o=t.next_out,O=t.output,s=o-(n-t.avail_out),l=o+(t.avail_out-257),c=r.dmax,d=r.wsize,u=r.whave,h=r.wnext,m=r.window,p=r.hold,f=r.bits,g=r.lencode,b=r.distcode,v=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{f<15&&(p+=R[i++]<<f,f+=8,p+=R[i++]<<f,f+=8),w=g[p&v];t:for(;;){if(C=w>>>24,p>>>=C,f-=C,C=w>>>16&255,C===0)O[o++]=w&65535;else if(C&16){A=w&65535,C&=15,C&&(f<C&&(p+=R[i++]<<f,f+=8),A+=p&(1<<C)-1,p>>>=C,f-=C),f<15&&(p+=R[i++]<<f,f+=8,p+=R[i++]<<f,f+=8),w=b[p&y];n:for(;;){if(C=w>>>24,p>>>=C,f-=C,C=w>>>16&255,C&16){if(T=w&65535,C&=15,f<C&&(p+=R[i++]<<f,f+=8,f<C&&(p+=R[i++]<<f,f+=8)),T+=p&(1<<C)-1,T>c){t.msg="invalid distance too far back",r.mode=K1;break e}if(p>>>=C,f-=C,C=o-s,T>C){if(C=T-C,C>u&&r.sane){t.msg="invalid distance too far back",r.mode=K1;break e}if(I=0,k=m,h===0){if(I+=d-C,C<A){A-=C;do O[o++]=m[I++];while(--C);I=o-T,k=O}}else if(h<C){if(I+=d+h-C,C-=h,C<A){A-=C;do O[o++]=m[I++];while(--C);if(I=0,h<A){C=h,A-=C;do O[o++]=m[I++];while(--C);I=o-T,k=O}}}else if(I+=h-C,C<A){A-=C;do O[o++]=m[I++];while(--C);I=o-T,k=O}for(;A>2;)O[o++]=k[I++],O[o++]=k[I++],O[o++]=k[I++],A-=3;A&&(O[o++]=k[I++],A>1&&(O[o++]=k[I++]))}else{I=o-T;do O[o++]=O[I++],O[o++]=O[I++],O[o++]=O[I++],A-=3;while(A>2);A&&(O[o++]=O[I++],A>1&&(O[o++]=O[I++]))}}else if(C&64){t.msg="invalid distance code",r.mode=K1;break e}else{w=b[(w&65535)+(p&(1<<C)-1)];continue n}break}}else if(C&64)if(C&32){r.mode=NZ;break e}else{t.msg="invalid literal/length code",r.mode=K1;break e}else{w=g[(w&65535)+(p&(1<<C)-1)];continue t}break}}while(i<a&&o<l);A=f>>3,i-=A,f-=A<<3,p&=(1<<f)-1,t.next_in=i,t.next_out=o,t.avail_in=i<a?5+(a-i):5-(i-a),t.avail_out=o<l?257+(l-o):257-(o-l),r.hold=p,r.bits=f}});var f8=Je((mse,p8)=>{"use strict";S();var c8=Do(),Rd=15,d8=852,u8=592,h8=0,Xv=1,m8=2,$Z=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],FZ=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],BZ=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],zZ=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];p8.exports=function(t,n,r,i,a,o,s,l){var c=l.bits,d=0,u=0,h=0,m=0,p=0,f=0,g=0,b=0,v=0,y=0,w,C,A,T,I,k=null,R=0,O,P=new c8.Buf16(Rd+1),F=new c8.Buf16(Rd+1),Y=null,j=0,q,ne,H;for(d=0;d<=Rd;d++)P[d]=0;for(u=0;u<i;u++)P[n[r+u]]++;for(p=c,m=Rd;m>=1&&P[m]===0;m--);if(p>m&&(p=m),m===0)return a[o++]=1<<24|64<<16|0,a[o++]=1<<24|64<<16|0,l.bits=1,0;for(h=1;h<m&&P[h]===0;h++);for(p<h&&(p=h),b=1,d=1;d<=Rd;d++)if(b<<=1,b-=P[d],b<0)return-1;if(b>0&&(t===h8||m!==1))return-1;for(F[1]=0,d=1;d<Rd;d++)F[d+1]=F[d]+P[d];for(u=0;u<i;u++)n[r+u]!==0&&(s[F[n[r+u]]++]=u);if(t===h8?(k=Y=s,O=19):t===Xv?(k=$Z,R-=257,Y=FZ,j-=257,O=256):(k=BZ,Y=zZ,O=-1),y=0,u=0,d=h,I=o,f=p,g=0,A=-1,v=1<<p,T=v-1,t===Xv&&v>d8||t===m8&&v>u8)return 1;for(;;){q=d-g,s[u]<O?(ne=0,H=s[u]):s[u]>O?(ne=Y[j+s[u]],H=k[R+s[u]]):(ne=96,H=0),w=1<<d-g,C=1<<f,h=C;do C-=w,a[I+(y>>g)+C]=q<<24|ne<<16|H|0;while(C!==0);for(w=1<<d-1;y&w;)w>>=1;if(w!==0?(y&=w-1,y+=w):y=0,u++,--P[d]===0){if(d===m)break;d=n[r+s[u]]}if(d>p&&(y&T)!==A){for(g===0&&(g=p),I+=h,f=d-g,b=1<<f;f+g<m&&(b-=P[f+g],!(b<=0));)f++,b<<=1;if(v+=1<<f,t===Xv&&v>d8||t===m8&&v>u8)return 1;A=y&T,a[A]=p<<24|f<<16|I-o|0}}return y!==0&&(a[I+y]=d-g<<24|64<<16|0),l.bits=p,0}});var X8=Je(Qi=>{"use strict";S();var Xr=Do(),nx=Fv(),Va=Bv(),HZ=l8(),um=f8(),UZ=0,H8=1,U8=2,g8=4,GZ=5,X1=6,oc=0,jZ=1,WZ=2,Ti=-2,G8=-3,rx=-4,VZ=-5,E8=8,j8=1,b8=2,y8=3,v8=4,x8=5,w8=6,S8=7,C8=8,T8=9,I8=10,J1=11,Ro=12,qv=13,M8=14,Qv=15,A8=16,k8=17,P8=18,D8=19,q1=20,Q1=21,_8=22,L8=23,R8=24,O8=25,N8=26,Jv=27,$8=28,F8=29,Vt=30,ix=31,YZ=32,ZZ=852,KZ=592,XZ=15,qZ=XZ;function B8(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function QZ(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Xr.Buf16(320),this.work=new Xr.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function W8(e){var t;return!e||!e.state?Ti:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=j8,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Xr.Buf32(ZZ),t.distcode=t.distdyn=new Xr.Buf32(KZ),t.sane=1,t.back=-1,oc)}function V8(e){var t;return!e||!e.state?Ti:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,W8(e))}function Y8(e,t){var n,r;return!e||!e.state||(r=e.state,t<0?(n=0,t=-t):(n=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?Ti:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,V8(e))}function Z8(e,t){var n,r;return e?(r=new QZ,e.state=r,r.window=null,n=Y8(e,t),n!==oc&&(e.state=null),n):Ti}function JZ(e){return Z8(e,qZ)}var z8=!0,ex,tx;function eK(e){if(z8){var t;for(ex=new Xr.Buf32(512),tx=new Xr.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(um(H8,e.lens,0,288,ex,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;um(U8,e.lens,0,32,tx,0,e.work,{bits:5}),z8=!1}e.lencode=ex,e.lenbits=9,e.distcode=tx,e.distbits=5}function K8(e,t,n,r){var i,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Xr.Buf8(a.wsize)),r>=a.wsize?(Xr.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),Xr.arraySet(a.window,t,n-r,i,a.wnext),r-=i,r?(Xr.arraySet(a.window,t,n-r,r,0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0}function tK(e,t){var n,r,i,a,o,s,l,c,d,u,h,m,p,f,g=0,b,v,y,w,C,A,T,I,k=new Xr.Buf8(4),R,O,P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return Ti;n=e.state,n.mode===Ro&&(n.mode=qv),o=e.next_out,i=e.output,l=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,c=n.hold,d=n.bits,u=s,h=l,I=oc;e:for(;;)switch(n.mode){case j8:if(n.wrap===0){n.mode=qv;break}for(;d<16;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}if(n.wrap&2&&c===35615){n.check=0,k[0]=c&255,k[1]=c>>>8&255,n.check=Va(n.check,k,2,0),c=0,d=0,n.mode=b8;break}if(n.flags=0,n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=Vt;break}if((c&15)!==E8){e.msg="unknown compression method",n.mode=Vt;break}if(c>>>=4,d-=4,T=(c&15)+8,n.wbits===0)n.wbits=T;else if(T>n.wbits){e.msg="invalid window size",n.mode=Vt;break}n.dmax=1<<T,e.adler=n.check=1,n.mode=c&512?I8:Ro,c=0,d=0;break;case b8:for(;d<16;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}if(n.flags=c,(n.flags&255)!==E8){e.msg="unknown compression method",n.mode=Vt;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=Vt;break}n.head&&(n.head.text=c>>8&1),n.flags&512&&(k[0]=c&255,k[1]=c>>>8&255,n.check=Va(n.check,k,2,0)),c=0,d=0,n.mode=y8;case y8:for(;d<32;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}n.head&&(n.head.time=c),n.flags&512&&(k[0]=c&255,k[1]=c>>>8&255,k[2]=c>>>16&255,k[3]=c>>>24&255,n.check=Va(n.check,k,4,0)),c=0,d=0,n.mode=v8;case v8:for(;d<16;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}n.head&&(n.head.xflags=c&255,n.head.os=c>>8),n.flags&512&&(k[0]=c&255,k[1]=c>>>8&255,n.check=Va(n.check,k,2,0)),c=0,d=0,n.mode=x8;case x8:if(n.flags&1024){for(;d<16;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}n.length=c,n.head&&(n.head.extra_len=c),n.flags&512&&(k[0]=c&255,k[1]=c>>>8&255,n.check=Va(n.check,k,2,0)),c=0,d=0}else n.head&&(n.head.extra=null);n.mode=w8;case w8:if(n.flags&1024&&(m=n.length,m>s&&(m=s),m&&(n.head&&(T=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Xr.arraySet(n.head.extra,r,a,m,T)),n.flags&512&&(n.check=Va(n.check,r,m,a)),s-=m,a+=m,n.length-=m),n.length))break e;n.length=0,n.mode=S8;case S8:if(n.flags&2048){if(s===0)break e;m=0;do T=r[a+m++],n.head&&T&&n.length<65536&&(n.head.name+=String.fromCharCode(T));while(T&&m<s);if(n.flags&512&&(n.check=Va(n.check,r,m,a)),s-=m,a+=m,T)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=C8;case C8:if(n.flags&4096){if(s===0)break e;m=0;do T=r[a+m++],n.head&&T&&n.length<65536&&(n.head.comment+=String.fromCharCode(T));while(T&&m<s);if(n.flags&512&&(n.check=Va(n.check,r,m,a)),s-=m,a+=m,T)break e}else n.head&&(n.head.comment=null);n.mode=T8;case T8:if(n.flags&512){for(;d<16;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}if(c!==(n.check&65535)){e.msg="header crc mismatch",n.mode=Vt;break}c=0,d=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Ro;break;case I8:for(;d<32;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}e.adler=n.check=B8(c),c=0,d=0,n.mode=J1;case J1:if(n.havedict===0)return e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=d,WZ;e.adler=n.check=1,n.mode=Ro;case Ro:if(t===GZ||t===X1)break e;case qv:if(n.last){c>>>=d&7,d-=d&7,n.mode=Jv;break}for(;d<3;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}switch(n.last=c&1,c>>>=1,d-=1,c&3){case 0:n.mode=M8;break;case 1:if(eK(n),n.mode=q1,t===X1){c>>>=2,d-=2;break e}break;case 2:n.mode=k8;break;case 3:e.msg="invalid block type",n.mode=Vt}c>>>=2,d-=2;break;case M8:for(c>>>=d&7,d-=d&7;d<32;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}if((c&65535)!==(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=Vt;break}if(n.length=c&65535,c=0,d=0,n.mode=Qv,t===X1)break e;case Qv:n.mode=A8;case A8:if(m=n.length,m){if(m>s&&(m=s),m>l&&(m=l),m===0)break e;Xr.arraySet(i,r,a,m,o),s-=m,a+=m,l-=m,o+=m,n.length-=m;break}n.mode=Ro;break;case k8:for(;d<14;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}if(n.nlen=(c&31)+257,c>>>=5,d-=5,n.ndist=(c&31)+1,c>>>=5,d-=5,n.ncode=(c&15)+4,c>>>=4,d-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Vt;break}n.have=0,n.mode=P8;case P8:for(;n.have<n.ncode;){for(;d<3;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}n.lens[P[n.have++]]=c&7,c>>>=3,d-=3}for(;n.have<19;)n.lens[P[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,R={bits:n.lenbits},I=um(UZ,n.lens,0,19,n.lencode,0,n.work,R),n.lenbits=R.bits,I){e.msg="invalid code lengths set",n.mode=Vt;break}n.have=0,n.mode=D8;case D8:for(;n.have<n.nlen+n.ndist;){for(;g=n.lencode[c&(1<<n.lenbits)-1],b=g>>>24,v=g>>>16&255,y=g&65535,!(b<=d);){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}if(y<16)c>>>=b,d-=b,n.lens[n.have++]=y;else{if(y===16){for(O=b+2;d<O;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}if(c>>>=b,d-=b,n.have===0){e.msg="invalid bit length repeat",n.mode=Vt;break}T=n.lens[n.have-1],m=3+(c&3),c>>>=2,d-=2}else if(y===17){for(O=b+3;d<O;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}c>>>=b,d-=b,T=0,m=3+(c&7),c>>>=3,d-=3}else{for(O=b+7;d<O;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}c>>>=b,d-=b,T=0,m=11+(c&127),c>>>=7,d-=7}if(n.have+m>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Vt;break}for(;m--;)n.lens[n.have++]=T}}if(n.mode===Vt)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Vt;break}if(n.lenbits=9,R={bits:n.lenbits},I=um(H8,n.lens,0,n.nlen,n.lencode,0,n.work,R),n.lenbits=R.bits,I){e.msg="invalid literal/lengths set",n.mode=Vt;break}if(n.distbits=6,n.distcode=n.distdyn,R={bits:n.distbits},I=um(U8,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,R),n.distbits=R.bits,I){e.msg="invalid distances set",n.mode=Vt;break}if(n.mode=q1,t===X1)break e;case q1:n.mode=Q1;case Q1:if(s>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=d,HZ(e,h),o=e.next_out,i=e.output,l=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,c=n.hold,d=n.bits,n.mode===Ro&&(n.back=-1);break}for(n.back=0;g=n.lencode[c&(1<<n.lenbits)-1],b=g>>>24,v=g>>>16&255,y=g&65535,!(b<=d);){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}if(v&&!(v&240)){for(w=b,C=v,A=y;g=n.lencode[A+((c&(1<<w+C)-1)>>w)],b=g>>>24,v=g>>>16&255,y=g&65535,!(w+b<=d);){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}c>>>=w,d-=w,n.back+=w}if(c>>>=b,d-=b,n.back+=b,n.length=y,v===0){n.mode=N8;break}if(v&32){n.back=-1,n.mode=Ro;break}if(v&64){e.msg="invalid literal/length code",n.mode=Vt;break}n.extra=v&15,n.mode=_8;case _8:if(n.extra){for(O=n.extra;d<O;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=L8;case L8:for(;g=n.distcode[c&(1<<n.distbits)-1],b=g>>>24,v=g>>>16&255,y=g&65535,!(b<=d);){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}if(!(v&240)){for(w=b,C=v,A=y;g=n.distcode[A+((c&(1<<w+C)-1)>>w)],b=g>>>24,v=g>>>16&255,y=g&65535,!(w+b<=d);){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}c>>>=w,d-=w,n.back+=w}if(c>>>=b,d-=b,n.back+=b,v&64){e.msg="invalid distance code",n.mode=Vt;break}n.offset=y,n.extra=v&15,n.mode=R8;case R8:if(n.extra){for(O=n.extra;d<O;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Vt;break}n.mode=O8;case O8:if(l===0)break e;if(m=h-l,n.offset>m){if(m=n.offset-m,m>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Vt;break}m>n.wnext?(m-=n.wnext,p=n.wsize-m):p=n.wnext-m,m>n.length&&(m=n.length),f=n.window}else f=i,p=o-n.offset,m=n.length;m>l&&(m=l),l-=m,n.length-=m;do i[o++]=f[p++];while(--m);n.length===0&&(n.mode=Q1);break;case N8:if(l===0)break e;i[o++]=n.length,l--,n.mode=Q1;break;case Jv:if(n.wrap){for(;d<32;){if(s===0)break e;s--,c|=r[a++]<<d,d+=8}if(h-=l,e.total_out+=h,n.total+=h,h&&(e.adler=n.check=n.flags?Va(n.check,i,h,o-h):nx(n.check,i,h,o-h)),h=l,(n.flags?c:B8(c))!==n.check){e.msg="incorrect data check",n.mode=Vt;break}c=0,d=0}n.mode=$8;case $8:if(n.wrap&&n.flags){for(;d<32;){if(s===0)break e;s--,c+=r[a++]<<d,d+=8}if(c!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=Vt;break}c=0,d=0}n.mode=F8;case F8:I=jZ;break e;case Vt:I=G8;break e;case ix:return rx;case YZ:default:return Ti}return e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=d,(n.wsize||h!==e.avail_out&&n.mode<Vt&&(n.mode<Jv||t!==g8))&&K8(e,e.output,e.next_out,h-e.avail_out)?(n.mode=ix,rx):(u-=e.avail_in,h-=e.avail_out,e.total_in+=u,e.total_out+=h,n.total+=h,n.wrap&&h&&(e.adler=n.check=n.flags?Va(n.check,i,h,e.next_out-h):nx(n.check,i,h,e.next_out-h)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Ro?128:0)+(n.mode===q1||n.mode===Qv?256:0),(u===0&&h===0||t===g8)&&I===oc&&(I=VZ),I)}function nK(e){if(!e||!e.state)return Ti;var t=e.state;return t.window&&(t.window=null),e.state=null,oc}function rK(e,t){var n;return!e||!e.state||(n=e.state,!(n.wrap&2))?Ti:(n.head=t,t.done=!1,oc)}function iK(e,t){var n=t.length,r,i,a;return!e||!e.state||(r=e.state,r.wrap!==0&&r.mode!==J1)?Ti:r.mode===J1&&(i=1,i=nx(i,t,n,0),i!==r.check)?G8:(a=K8(e,t,n,n),a?(r.mode=ix,rx):(r.havedict=1,oc))}Qi.inflateReset=V8;Qi.inflateReset2=Y8;Qi.inflateResetKeep=W8;Qi.inflateInit=JZ;Qi.inflateInit2=Z8;Qi.inflate=tK;Qi.inflateEnd=nK;Qi.inflateGetHeader=rK;Qi.inflateSetDictionary=iK;Qi.inflateInfo="pako inflate (from Nodeca project)"});var ax=Je((Ese,q8)=>{"use strict";S();q8.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var J8=Je((yse,Q8)=>{"use strict";S();function aK(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}Q8.exports=aK});var t7=Je(mm=>{"use strict";S();var Od=X8(),hm=Do(),e0=jv(),pn=ax(),ox=H1(),oK=Wv(),sK=J8(),e7=Object.prototype.toString;function sc(e){if(!(this instanceof sc))return new sc(e);this.options=hm.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new oK,this.strm.avail_out=0;var n=Od.inflateInit2(this.strm,t.windowBits);if(n!==pn.Z_OK)throw new Error(ox[n]);if(this.header=new sK,Od.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=e0.string2buf(t.dictionary):e7.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Od.inflateSetDictionary(this.strm,t.dictionary),n!==pn.Z_OK)))throw new Error(ox[n])}sc.prototype.push=function(e,t){var n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,o,s,l,c,d=!1;if(this.ended)return!1;o=t===~~t?t:t===!0?pn.Z_FINISH:pn.Z_NO_FLUSH,typeof e=="string"?n.input=e0.binstring2buf(e):e7.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new hm.Buf8(r),n.next_out=0,n.avail_out=r),a=Od.inflate(n,pn.Z_NO_FLUSH),a===pn.Z_NEED_DICT&&i&&(a=Od.inflateSetDictionary(this.strm,i)),a===pn.Z_BUF_ERROR&&d===!0&&(a=pn.Z_OK,d=!1),a!==pn.Z_STREAM_END&&a!==pn.Z_OK)return this.onEnd(a),this.ended=!0,!1;n.next_out&&(n.avail_out===0||a===pn.Z_STREAM_END||n.avail_in===0&&(o===pn.Z_FINISH||o===pn.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=e0.utf8border(n.output,n.next_out),l=n.next_out-s,c=e0.buf2string(n.output,s),n.next_out=l,n.avail_out=r-l,l&&hm.arraySet(n.output,n.output,s,l,0),this.onData(c)):this.onData(hm.shrinkBuf(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(d=!0)}while((n.avail_in>0||n.avail_out===0)&&a!==pn.Z_STREAM_END);return a===pn.Z_STREAM_END&&(o=pn.Z_FINISH),o===pn.Z_FINISH?(a=Od.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===pn.Z_OK):(o===pn.Z_SYNC_FLUSH&&(this.onEnd(pn.Z_OK),n.avail_out=0),!0)};sc.prototype.onData=function(e){this.chunks.push(e)};sc.prototype.onEnd=function(e){e===pn.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=hm.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function sx(e,t){var n=new sc(t);if(n.push(e,!0),n.err)throw n.msg||ox[n.err];return n.result}function lK(e,t){return t=t||{},t.raw=!0,sx(e,t)}mm.Inflate=sc;mm.inflate=sx;mm.inflateRaw=lK;mm.ungzip=sx});var lx=Je((Sse,r7)=>{"use strict";S();var cK=Do().assign,dK=o8(),uK=t7(),hK=ax(),n7={};cK(n7,dK,uK,hK);r7.exports=n7});var xw=Je(Z0=>{"use strict";S();Object.defineProperty(Z0,"__esModule",{value:!0});Z0.sanitizeUrl=void 0;var Eq=/^([^\w]*)(javascript|data|vbscript)/im,bq=/&#(\w+)(^\w|;)?/g,yq=/&(newline|tab);/gi,vq=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,xq=/^.+(:|&colon;)/gim,wq=[".","/"];function Sq(e){return wq.indexOf(e[0])>-1}function Cq(e){return e.replace(bq,function(t,n){return String.fromCharCode(n)})}function Tq(e){var t=Cq(e||"").replace(yq,"").replace(vq,"").trim();if(!t)return"about:blank";if(Sq(t))return t;var n=t.match(xq);if(!n)return t;var r=n[0];return Eq.test(r)?"about:blank":t}Z0.sanitizeUrl=Tq});var J=Je((xge,C_)=>{S();C_.exports=React});var D_=Je(yg=>{"use strict";S();var $Q=J(),FQ=Symbol.for("react.element"),BQ=Symbol.for("react.fragment"),zQ=Object.prototype.hasOwnProperty,HQ=$Q.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,UQ={key:!0,ref:!0,__self:!0,__source:!0};function P_(e,t,n){var r,i={},a=null,o=null;n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)zQ.call(t,r)&&!UQ.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:FQ,type:e,key:a,ref:o,props:i,_owner:HQ.current}}yg.Fragment=BQ;yg.jsx=P_;yg.jsxs=P_});var W=Je((Pge,__)=>{"use strict";S();__.exports=D_()});var ao=Je((Rge,R_)=>{S();R_.exports=ReactDOM});var I3=Je((uye,fL)=>{S();var pL="Expected a function",hL=NaN,Eee="[object Symbol]",bee=/^\s+|\s+$/g,yee=/^[-+]0x[0-9a-f]+$/i,vee=/^0b[01]+$/i,xee=/^0o[0-7]+$/i,wee=parseInt,See=typeof global=="object"&&global&&global.Object===Object&&global,Cee=typeof self=="object"&&self&&self.Object===Object&&self,Tee=See||Cee||Function("return this")(),Iee=Object.prototype,Mee=Iee.toString,Aee=Math.max,kee=Math.min,T3=function(){return Tee.Date.now()};function Pee(e,t,n){var r,i,a,o,s,l,c=0,d=!1,u=!1,h=!0;if(typeof e!="function")throw new TypeError(pL);t=mL(t)||0,Gg(n)&&(d=!!n.leading,u="maxWait"in n,a=u?Aee(mL(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h);function m(A){var T=r,I=i;return r=i=void 0,c=A,o=e.apply(I,T),o}function p(A){return c=A,s=setTimeout(b,t),d?m(A):o}function f(A){var T=A-l,I=A-c,k=t-T;return u?kee(k,a-I):k}function g(A){var T=A-l,I=A-c;return l===void 0||T>=t||T<0||u&&I>=a}function b(){var A=T3();if(g(A))return v(A);s=setTimeout(b,f(A))}function v(A){return s=void 0,h&&r?m(A):(r=i=void 0,o)}function y(){s!==void 0&&clearTimeout(s),c=0,r=l=i=s=void 0}function w(){return s===void 0?o:v(T3())}function C(){var A=T3(),T=g(A);if(r=arguments,i=this,l=A,T){if(s===void 0)return p(l);if(u)return s=setTimeout(b,t),m(l)}return s===void 0&&(s=setTimeout(b,t)),o}return C.cancel=y,C.flush=w,C}function Dee(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(pL);return Gg(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Pee(e,t,{leading:r,maxWait:t,trailing:i})}function Gg(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function _ee(e){return!!e&&typeof e=="object"}function Lee(e){return typeof e=="symbol"||_ee(e)&&Mee.call(e)==Eee}function mL(e){if(typeof e=="number")return e;if(Lee(e))return hL;if(Gg(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Gg(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(bee,"");var n=vee.test(e);return n||xee.test(e)?wee(e.slice(2),n?2:8):yee.test(e)?hL:+e}fL.exports=Dee});var yL=Je(bL=>{"use strict";S();var yu=J();function Ree(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Oee=typeof Object.is=="function"?Object.is:Ree,Nee=yu.useState,$ee=yu.useEffect,Fee=yu.useLayoutEffect,Bee=yu.useDebugValue;function zee(e,t){var n=t(),r=Nee({inst:{value:n,getSnapshot:t}}),i=r[0].inst,a=r[1];return Fee(function(){i.value=n,i.getSnapshot=t,M3(i)&&a({inst:i})},[e,n,t]),$ee(function(){return M3(i)&&a({inst:i}),e(function(){M3(i)&&a({inst:i})})},[e]),Bee(n),n}function M3(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Oee(e,n)}catch{return!0}}function Hee(e,t){return t()}var Uee=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Hee:zee;bL.useSyncExternalStore=yu.useSyncExternalStore!==void 0?yu.useSyncExternalStore:Uee});var xL=Je((Eye,vL)=>{"use strict";S();vL.exports=yL()});var SL=Je(wL=>{"use strict";S();var jg=J(),Gee=xL();function jee(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Wee=typeof Object.is=="function"?Object.is:jee,Vee=Gee.useSyncExternalStore,Yee=jg.useRef,Zee=jg.useEffect,Kee=jg.useMemo,Xee=jg.useDebugValue;wL.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=Yee(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=Kee(function(){function l(m){if(!c){if(c=!0,d=m,m=r(m),i!==void 0&&o.hasValue){var p=o.value;if(i(p,m))return u=p}return u=m}if(p=u,Wee(d,m))return p;var f=r(m);return i!==void 0&&i(p,f)?p:(d=m,u=f)}var c=!1,d,u,h=n===void 0?null:n;return[function(){return l(t())},h===null?void 0:function(){return l(h())}]},[t,n,r,i]);var s=Vee(e,a[0],a[1]);return Zee(function(){o.hasValue=!0,o.value=s},[s]),Xee(s),s}});var TL=Je((xye,CL)=>{"use strict";S();CL.exports=SL()});var NL=Je((RL,OL)=>{S();(function(){var e=this,t={};typeof RL<"u"?OL.exports=t:e.fuzzy=t,t.simpleFilter=function(n,r){return r.filter(function(i){return t.test(n,i)})},t.test=function(n,r){return t.match(n,r)!==null},t.match=function(n,r,i){i=i||{};var a=0,o=[],s=r.length,l=0,c=0,d=i.pre||"",u=i.post||"",h=i.caseSensitive&&r||r.toLowerCase(),m;n=i.caseSensitive&&n||n.toLowerCase();for(var p=0;p<s;p++)m=r[p],h[p]===n[a]?(m=d+m+u,a+=1,c+=1+c):c=0,l+=c,o[o.length]=m;return a===n.length?(l=h===n?1/0:l,{rendered:o.join(""),score:l}):null},t.filter=function(n,r,i){return!r||r.length===0?[]:typeof n!="string"?r:(i=i||{},r.reduce(function(a,o,s,l){var c=o;i.extract&&(c=i.extract(o));var d=t.match(n,c,i);return d!=null&&(a[a.length]={string:d.rendered,score:d.score,index:s,original:o}),a},[]).sort(function(a,o){var s=o.score-a.score;return s||a.index-o.index}))}})()});S();var ak=_(Cv(),1),ok=_(Iv(),1),sY=_(Mv(),1);S();var vv=_(lx(),1);S();S();var t0=/Mac|iPod|iPhone|iPad/.test(navigator.platform),Tse=/^Win/.test(navigator.platform),i7=/\b(android)\b/i.test(navigator.userAgent),Ise="netscape"in window&&navigator.userAgent.indexOf("rv:")>1&&navigator.userAgent.indexOf("Gecko")>1,mK=navigator.userAgent.indexOf("Chrome")!==-1,Mse=!mK&&navigator.userAgent.indexOf("Safari")!==-1,a7=/iPad|iPhone/.test(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,Ase=()=>navigator.brave?.isBrave?.name==="isBrave",kse=typeof window<"u"&&"ResizeObserver"in window,Pse="Excalidraw",o7=10,s7=8,Dse=5,_se=1,Lse=30,Ya=Math.PI/12,Rse="red",n0={TEXT:"text",CROSSHAIR:"crosshair",GRABBING:"grabbing",GRAB:"grab",POINTER:"pointer",MOVE:"move",AUTO:""},Ose={MAIN:0,WHEEL:1,SECONDARY:2,TOUCH:-1,ERASER:5},Nse={enabled:"all",disabled:"none",inheritFromUI:"var(--ui-pointerEvents)"};var $se={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},Ji={TEST:"test"},Fse={SHAPE_ACTIONS_MENU:"App-menu__left"},_n={Virgil:1,Helvetica:2,Cascadia:3,Assistant:4},qr={LIGHT:"light",DARK:"dark"},jn={strokeColor:"#bbb",strokeWidth:2,strokeStyle:"solid",fillStyle:"solid",roughness:0,roundness:null,backgroundColor:"transparent",radius:8,nameOffsetY:3,nameColorLightTheme:"#999999",nameColorDarkTheme:"#7a7a7a",nameFontSize:14,nameLineHeight:1.25},cx="Segoe UI Emoji",r0=1,Za=20,ea=_n.Virgil,Nd="left",i0="top";var pm=2,a0=1,Us="#ffffff",$d="#1e1e1e",fm="transparent",o0=2*pm,pK=1e-5,Bse=2*o0-pK,zse="#a2f1a6";var Hse=20,dx={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",jfif:"image/jfif"},l7=["text/plain","text/html"],Te={json:"application/json",excalidraw:"application/vnd.excalidraw+json",excalidrawlib:"application/vnd.excalidrawlib+json","excalidraw.svg":"image/svg+xml","excalidraw.png":"image/png",binary:"application/octet-stream",...dx},Use={png:"png",svg:"svg",clipboard:"clipboard"},Or={excalidraw:"excalidraw",excalidrawClipboard:"excalidraw/clipboard",excalidrawLibrary:"excalidrawlib",excalidrawClipboardWithAPI:"excalidraw-api/clipboard"},ux=window.EXCALIDRAW_EXPORT_SOURCE||window.location.origin,Gse=500,jse=300,Wse=500;var Vse=100,Yse=.1,c7=.1,Zse=30,Kse=300;var s0="invert(93%) hue-rotate(180deg)",Xse={addLibrary:"addLibrary"},qse={addLibrary:"addLibrary"},Qse={canvasActions:{changeViewBackgroundColor:!0,clearCanvas:!0,export:{saveFileToDisk:!0},loadScene:!0,saveToActiveFile:!0,toggleTheme:null,saveAsImage:!0},tools:{image:!0}},Jse=800,ele=1e3,tle=500,nle=1229,rle=302,Fd=2,d7=[1,2,3],u7=10,ile=1440,ale=2*1024*1024,xt="http://www.w3.org/2000/svg";var hx={excalidraw:2,excalidrawLibrary:2},Ln=5,h7=.7,m7=11,Oo={TOP:"top",MIDDLE:"middle",BOTTOM:"bottom"},mx={LEFT:"left",CENTER:"center",RIGHT:"right"},p7=20,l0=.25,f7=32,Qr={LEGACY:1,PROPORTIONAL_RADIUS:2,ADAPTIVE_RADIUS:3},px={architect:0,artist:1,cartoonist:2},ole={thin:1,bold:2,extraBold:4},Ot={strokeColor:$d,backgroundColor:fm,fillStyle:"solid",strokeWidth:2,strokeStyle:"solid",roughness:px.artist,opacity:100,locked:!1},fK="library",g7={name:"default",defaultTab:fK},sle=new Set(["iframe","embeddable","image"]),lle={selection:"selection",rectangle:"rectangle",diamond:"diamond",ellipse:"ellipse",arrow:"arrow",line:"line",freedraw:"freedraw",text:"text",image:"image",eraser:"eraser",hand:"hand",frame:"frame",magicframe:"magicframe",embeddable:"embeddable",laser:"laser"},cle={OAI_API_KEY:"excalidraw-oai-api-key",MERMAID_TO_EXCALIDRAW:"mermaid-to-excalidraw",PUBLISH_LIBRARY:"publish-library-data"},E7="Untitled";S();S();S();var Ka=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");S();var gK=d7.includes(devicePixelRatio)?devicePixelRatio:1,Gs=()=>({showWelcomeScreen:!1,theme:qr.LIGHT,collaborators:new Map,currentChartType:"bar",currentItemBackgroundColor:Ot.backgroundColor,currentItemEndArrowhead:"arrow",currentItemFillStyle:Ot.fillStyle,currentItemFontFamily:ea,currentItemFontSize:Za,currentItemOpacity:Ot.opacity,currentItemRoughness:Ot.roughness,currentItemStartArrowhead:null,currentItemStrokeColor:Ot.strokeColor,currentItemRoundness:"round",currentItemStrokeStyle:Ot.strokeStyle,currentItemStrokeWidth:Ot.strokeWidth,currentItemTextAlign:Nd,cursorButton:"up",activeEmbeddable:null,draggingElement:null,editingElement:null,editingGroupId:null,editingLinearElement:null,activeTool:{type:"selection",customType:null,locked:Ot.locked,lastActiveTool:null},penMode:!1,penDetected:!1,errorMessage:null,exportBackground:!0,exportScale:gK,exportEmbedScene:!1,exportWithDarkMode:!1,fileHandle:null,gridSize:null,isBindingEnabled:!0,defaultSidebarDockedPreference:!1,isLoading:!1,isResizing:!1,isRotating:!1,lastPointerDownWith:"mouse",multiElement:null,name:null,contextMenu:null,openMenu:null,openPopup:null,openSidebar:null,openDialog:null,pasteDialog:{shown:!1,data:null},previousSelectedElementIds:{},resizingElement:null,scrolledOutside:!1,scrollX:0,scrollY:0,selectedElementIds:{},selectedGroupIds:{},selectedElementsAreBeingDragged:!1,selectionElement:null,shouldCacheIgnoreZoom:!1,showStats:!1,startBoundElement:null,suggestedBindings:[],frameRendering:{enabled:!0,clip:!0,name:!0,outline:!0},frameToHighlight:null,editingFrame:null,elementsToHighlight:null,toast:null,viewBackgroundColor:Us,zenModeEnabled:!1,zoom:{value:a0},viewModeEnabled:!1,pendingImageElementId:null,showHyperlinkPopup:!1,selectedLinearElement:null,snapLines:[],originSnapOffset:{x:0,y:0},objectsSnapModeEnabled:!1,userToFollow:null,followedBy:new Set}),EK=(e=>e)({showWelcomeScreen:{browser:!0,export:!1,server:!1},theme:{browser:!0,export:!1,server:!1},collaborators:{browser:!1,export:!1,server:!1},currentChartType:{browser:!0,export:!1,server:!1},currentItemBackgroundColor:{browser:!0,export:!1,server:!1},currentItemEndArrowhead:{browser:!0,export:!1,server:!1},currentItemFillStyle:{browser:!0,export:!1,server:!1},currentItemFontFamily:{browser:!0,export:!1,server:!1},currentItemFontSize:{browser:!0,export:!1,server:!1},currentItemRoundness:{browser:!0,export:!1,server:!1},currentItemOpacity:{browser:!0,export:!1,server:!1},currentItemRoughness:{browser:!0,export:!1,server:!1},currentItemStartArrowhead:{browser:!0,export:!1,server:!1},currentItemStrokeColor:{browser:!0,export:!1,server:!1},currentItemStrokeStyle:{browser:!0,export:!1,server:!1},currentItemStrokeWidth:{browser:!0,export:!1,server:!1},currentItemTextAlign:{browser:!0,export:!1,server:!1},cursorButton:{browser:!0,export:!1,server:!1},activeEmbeddable:{browser:!1,export:!1,server:!1},draggingElement:{browser:!1,export:!1,server:!1},editingElement:{browser:!1,export:!1,server:!1},editingGroupId:{browser:!0,export:!1,server:!1},editingLinearElement:{browser:!1,export:!1,server:!1},activeTool:{browser:!0,export:!1,server:!1},penMode:{browser:!0,export:!1,server:!1},penDetected:{browser:!0,export:!1,server:!1},errorMessage:{browser:!1,export:!1,server:!1},exportBackground:{browser:!0,export:!1,server:!1},exportEmbedScene:{browser:!0,export:!1,server:!1},exportScale:{browser:!0,export:!1,server:!1},exportWithDarkMode:{browser:!0,export:!1,server:!1},fileHandle:{browser:!1,export:!1,server:!1},gridSize:{browser:!0,export:!0,server:!0},height:{browser:!1,export:!1,server:!1},isBindingEnabled:{browser:!1,export:!1,server:!1},defaultSidebarDockedPreference:{browser:!0,export:!1,server:!1},isLoading:{browser:!1,export:!1,server:!1},isResizing:{browser:!1,export:!1,server:!1},isRotating:{browser:!1,export:!1,server:!1},lastPointerDownWith:{browser:!0,export:!1,server:!1},multiElement:{browser:!1,export:!1,server:!1},name:{browser:!0,export:!1,server:!1},offsetLeft:{browser:!1,export:!1,server:!1},offsetTop:{browser:!1,export:!1,server:!1},contextMenu:{browser:!1,export:!1,server:!1},openMenu:{browser:!0,export:!1,server:!1},openPopup:{browser:!1,export:!1,server:!1},openSidebar:{browser:!0,export:!1,server:!1},openDialog:{browser:!1,export:!1,server:!1},pasteDialog:{browser:!1,export:!1,server:!1},previousSelectedElementIds:{browser:!0,export:!1,server:!1},resizingElement:{browser:!1,export:!1,server:!1},scrolledOutside:{browser:!0,export:!1,server:!1},scrollX:{browser:!0,export:!1,server:!1},scrollY:{browser:!0,export:!1,server:!1},selectedElementIds:{browser:!0,export:!1,server:!1},selectedGroupIds:{browser:!0,export:!1,server:!1},selectedElementsAreBeingDragged:{browser:!1,export:!1,server:!1},selectionElement:{browser:!1,export:!1,server:!1},shouldCacheIgnoreZoom:{browser:!0,export:!1,server:!1},showStats:{browser:!0,export:!1,server:!1},startBoundElement:{browser:!1,export:!1,server:!1},suggestedBindings:{browser:!1,export:!1,server:!1},frameRendering:{browser:!1,export:!1,server:!1},frameToHighlight:{browser:!1,export:!1,server:!1},editingFrame:{browser:!1,export:!1,server:!1},elementsToHighlight:{browser:!1,export:!1,server:!1},toast:{browser:!1,export:!1,server:!1},viewBackgroundColor:{browser:!0,export:!0,server:!0},width:{browser:!1,export:!1,server:!1},zenModeEnabled:{browser:!0,export:!1,server:!1},zoom:{browser:!0,export:!1,server:!1},viewModeEnabled:{browser:!1,export:!1,server:!1},pendingImageElementId:{browser:!1,export:!1,server:!1},showHyperlinkPopup:{browser:!1,export:!1,server:!1},selectedLinearElement:{browser:!0,export:!1,server:!1},snapLines:{browser:!1,export:!1,server:!1},originSnapOffset:{browser:!1,export:!1,server:!1},objectsSnapModeEnabled:{browser:!0,export:!1,server:!1},userToFollow:{browser:!1,export:!1,server:!1},followedBy:{browser:!1,export:!1,server:!1}}),fx=(e,t)=>{let n={};for(let r of Object.keys(e))if(EK[r]?.[t]){let a=e[r];n[r]=a}return n},yle=e=>fx(e,"browser"),c0=e=>fx(e,"export"),b7=e=>fx(e,"server"),y7=({activeTool:e})=>e.type==="eraser",v7=({activeTool:e})=>e.type==="hand";S();S();S();S();S();S();var x7=null;var Tle=()=>{if(x7)return x7;let e=new Date,t=e.getFullYear(),n=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0"),i=`${e.getHours()}`.padStart(2,"0"),a=`${e.getMinutes()}`.padStart(2,"0");return`${t}-${n}-${r}-${i}${a}`},Ile=e=>e.charAt(0).toUpperCase()+e.slice(1),Mle=e=>e instanceof HTMLElement&&e.className.includes("ToolIcon"),bK=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,Ale=e=>bK(e)||e instanceof Element&&!!e.closest("label, button"),kle=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&(e.type==="text"||e.type==="number"||e.type==="password"),gx=({fontFamily:e})=>{for(let[t,n]of Object.entries(_n))if(n===e)return`${t}, ${cx}`;return cx},Rn=({fontSize:e,fontFamily:t})=>`${e}px ${gx({fontFamily:t})}`,C7=(e,t)=>{let n=0,r=null,i=(...a)=>{r=a,clearTimeout(n),n=window.setTimeout(()=>{r=null,e(...a)},t)};return i.flush=()=>{if(clearTimeout(n),r){let a=r;r=null,e(...a)}},i.cancel=()=>{r=null,clearTimeout(n)},i},T7=(e,t)=>{let n=null,r=null,i=null,a=s=>{n=window.requestAnimationFrame(()=>{n=null,e(...s),r=null,i&&(r=i,i=null,a(r))})},o=(...s)=>{if(L.MODE==="test"){e(...s);return}r=s,n===null?a(r):t?.trailing&&(i=s)};return o.flush=()=>{n!==null&&(cancelAnimationFrame(n),n=null),r&&(e(...i||r),r=i=null)},o.cancel=()=>{r=i=null,n!==null&&(cancelAnimationFrame(n),n=null)},o},I7=e=>1-Math.pow(1-e,4),w7=(e,t,n)=>(t-e)*I7(n)+e,Ple=({fromValues:e,toValues:t,onStep:n,duration:r=250,interpolateValue:i,onStart:a,onEnd:o,onCancel:s})=>{let l=!1,c=0,d;function u(h){if(l)return;d===void 0&&(d=h,a?.());let m=Math.min(h-d,r),p=I7(m/r),f={};if(Object.keys(e).forEach(g=>{let b=g,v=(t[b]-e[b])*p+e[b];f[b]=v}),n(f),m<r){let g=m/r,b={};Object.keys(e).forEach(v=>{let y=v,w=e[y],C=t[y],A;A=i?i(w,C,g,y):w7(w,C,g),A==null&&(A=w7(w,C,g)),b[y]=A}),n(b),c=window.requestAnimationFrame(u)}else n(t),o?.()}return c=window.requestAnimationFrame(u),()=>{s?.(),l=!0,window.cancelAnimationFrame(c)}},Dle=(e,t)=>{if(!e.length||t<1)return[];let n=0,r=0,i=Array(Math.ceil(e.length/t));for(;n<e.length;)i[r++]=e.slice(n,n+=t);return i};var Ii=(e,t)=>Math.abs(e-t),gm=(e,t)=>t.type==="custom"?{...e.activeTool,type:"custom",customType:t.customType,locked:t.locked??e.activeTool.locked}:{...e.activeTool,lastActiveTool:t.lastActiveToolBeforeEraser===void 0?e.activeTool.lastActiveTool:t.lastActiveToolBeforeEraser,type:t.type,customType:null,locked:t.locked??e.activeTool.locked};var _le=e=>(e=e.replace(/\bAlt\b/i,"Alt").replace(/\bShift\b/i,"Shift").replace(/\b(Enter|Return)\b/i,"Enter"),t0?e.replace(/\bCtrlOrCmd\b/gi,"Cmd").replace(/\bAlt\b/i,"Option"):e.replace(/\bCtrlOrCmd\b/gi,"Ctrl")),Em=({clientX:e,clientY:t},{zoom:n,offsetLeft:r,offsetTop:i,scrollX:a,scrollY:o})=>{let s=(e-r)/n.value-a,l=(t-i)/n.value-o;return{x:s,y:l}},Ex=({sceneX:e,sceneY:t},{zoom:n,offsetLeft:r,offsetTop:i,scrollX:a,scrollY:o})=>{let s=(e+a)*n.value+r,l=(t+o)*n.value+i;return{x:s,y:l}},Lle=e=>getComputedStyle(document.documentElement).getPropertyValue(`--${e}`),yK="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF",vK="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",xK=new RegExp(`^[^${yK}]*[${vK}]`),u0=e=>xK.test(e),Bd=e=>{let[t,n]=e;return{x:t,y:n}},Rle=e=>{if(e?.name==="AbortError"){console.warn(e);return}throw e},Ole=(e,t,n=0)=>{n<0&&(n=e.length+n),n=Math.min(e.length,Math.max(n,0));let r=n-1;for(;++r<e.length;)if(t(e[r],r,e))return r;return-1},Nle=(e,t,n=e.length-1)=>{n<0&&(n=e.length+n),n=Math.min(e.length-1,Math.max(n,0));let r=n+1;for(;--r>-1;)if(t(e[r],r,e))return r;return-1},js=e=>{let t=e.length===5&&e.substr(4,1)==="0",n=e.length===9&&e.substr(7,2)==="00";return t||n||e===fm},$le=()=>{let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n};var Fle=e=>{let t=e.parentElement;for(;t;){if(t===document.body)return document;let{overflowY:n}=window.getComputedStyle(t);if(t.scrollHeight>t.clientHeight&&(n==="auto"||n==="scroll"||n==="overlay"))return t;t=t.parentElement}return document},Ble=e=>{let t=e.parentElement;for(;t;){if(t.tabIndex>-1){t.focus();return}t=t.parentElement}},zle=e=>{e.preventDefault(),e.returnValue=""},M7=e=>Array.from(e).map(t=>`0${t.toString(16)}`.slice(-2)).join(""),No=()=>$o()?1:Date.now(),et=e=>e instanceof Map?e:e.reduce((t,n)=>(t.set(typeof n=="string"?n:n.id,n),t),new Map),Hle=e=>e.reduce((t,n,r)=>(t.set(n.id,[n,r]),t),new Map),Xa=(e,t)=>e.reduce((n,r)=>(n[t?t(r):String(r)]=r,n),{}),$o=()=>L.MODE==="test",Ule=()=>L.MODE==="development",Gle=(e,t)=>new CustomEvent(e,{detail:{nativeEvent:t},cancelable:!0}),jle=(e,t)=>{let n=!1;for(let r in t){let i=t[r];if(typeof i<"u"){if(e[r]===i&&(typeof i!="object"||i===null))continue;n=!0}}return n?{...e,...t}:e};var Wle=()=>{try{return window.self===window.top?"top":"iframe"}catch{return"iframe"}};var h0=e=>!!e&&typeof e=="object"&&"then"in e&&"catch"in e&&"finally"in e,Vle=e=>{let t=e?.querySelectorAll("button, a, input, select, textarea, div[tabindex], label[tabindex]");return t?Array.from(t).filter(n=>n.tabIndex>-1&&!n.disabled):[]},S7=(e,t)=>Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t,Fo=(e,t,n,r=!1)=>{let i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return r&&console.warn("%cisShallowEqual: objects don't have same properties ->","color: #8B4000",e,t),!1;if(n&&Array.isArray(n)){for(let o of n)if(!(e[o]===t[o]||S7(e[o],t[o])))return r&&console.warn(`%cisShallowEqual: ${o} not equal ->`,"color: #8B4000",e[o],t[o]),!1;return!0}return i.every(o=>{let s=n?.[o],l=s?s(e[o],t[o]):e[o]===t[o]||S7(e[o],t[o]);return!l&&r&&console.warn(`%cisShallowEqual: ${o} not equal ->`,"color: #8B4000",e[o],t[o]),l})},Yle=(e,t,{checkForDefaultPrevented:n=!0}={})=>function(i){if(e?.(i),!n||!i?.defaultPrevented)return t?.(i)},lc=(e,t,n)=>{if(!t)return e;if(n)return console.error(t),e;throw new Error(t)},Zle=e=>{let t,n,r=function(i){let a=Object.entries(i);if(t){let s=!0;for(let[l,c]of a)if(t.get(l)!==c){s=!1;break}if(s)return n}let o=e(i);return t=new Map(a),n=o,o};return r.clear=()=>{t=void 0,n=void 0},r},A7=(e,t)=>e instanceof Set||e instanceof Map?e.has(t):"includes"in e?e.includes(t):e.hasOwnProperty(t),Kle=e=>JSON.parse(JSON.stringify(e)),Xle=e=>typeof e=="number"&&Number.isFinite(e),qle=(e,t)=>Fo(e,t)?e:t;function Qle(e,t,n,r){return e?(e?.addEventListener?.(t,n,r),()=>{e?.removeEventListener?.(t,n,r)}):()=>{}}var d0=(e,t)=>(e+t)/2;function Jle(e,t=!0){let n=e.length;if(n<4)return"";let r=e[0],i=e[1],a=e[2],o=`M${r[0].toFixed(2)},${r[1].toFixed(2)} Q${i[0].toFixed(2)},${i[1].toFixed(2)} ${d0(i[0],a[0]).toFixed(2)},${d0(i[1],a[1]).toFixed(2)} T`;for(let s=2,l=n-1;s<l;s++)r=e[s],i=e[s+1],o+=`${d0(r[0],i[0]).toFixed(2)},${d0(r[1],i[1]).toFixed(2)} `;return t&&(o+="Z"),o}var k7=e=>e.replace(/\r?\n|\r/g,`
2
+ `),Bo=e=>e,ece=async(e,...t)=>new Promise(n=>{n(e(...t))}),P7=(e,t)=>t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{});var qa=e=>!!e&&e.type==="image"&&!!e.fileId,m0=e=>!!e&&e.type==="image",p0=e=>!!e&&e.type==="embeddable",bm=e=>!!e&&e.type==="iframe",ta=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),He=e=>e!=null&&e.type==="text",ym=e=>e!=null&&e.type==="frame",D7=e=>e!=null&&e.type==="magicframe",Mt=e=>e!=null&&(e.type==="frame"||e.type==="magicframe"),On=e=>e!=null&&wK(e.type),wK=e=>e==="freedraw",wt=e=>e!=null&&bx(e.type),pt=e=>e!=null&&e.type==="arrow",bx=e=>e==="arrow"||e==="line",zo=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&SK(e.type),SK=e=>e==="arrow",Ho=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),CK=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||pt(e)),yx=e=>{let t=e?.type;if(!t)return!1;switch(t){case"text":case"diamond":case"rectangle":case"iframe":case"embeddable":case"ellipse":case"arrow":case"freedraw":case"line":case"frame":case"magicframe":case"image":case"selection":return!0;default:return lc(t,null),!1}},zd=e=>CK(e)&&!!e.boundElements?.some(({type:t})=>t==="text"),ar=e=>e!==null&&"containerId"in e&&e.containerId!==null&&He(e),f0=e=>e==="rectangle"||e==="embeddable"||e==="iframe"||e==="image",_7=e=>e==="line"||e==="arrow"||e==="diamond",ace=(e,t)=>!!((e===Qr.ADAPTIVE_RADIUS||e===Qr.LEGACY)&&f0(t.type)||e===Qr.PROPORTIONAL_RADIUS&&_7(t.type)),oce=e=>_7(e.type)?{type:Qr.PROPORTIONAL_RADIUS}:f0(e.type)?{type:Qr.ADAPTIVE_RADIUS}:null;S();S();S();S();S();S();S();S();S();S();S();S();function vx(e,t,n){if(e&&e.length){let[r,i]=t,a=Math.PI/180*n,o=Math.cos(a),s=Math.sin(a);for(let l of e){let[c,d]=l;l[0]=(c-r)*o-(d-i)*s+r,l[1]=(c-r)*s+(d-i)*o+i}}}function TK(e,t,n){let r=[];e.forEach(i=>r.push(...i)),vx(r,t,n)}function IK(e,t){return e[0]===t[0]&&e[1]===t[1]}function L7(e,t,n,r=1){let i=n,a=Math.max(t,.1),o=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,s=[0,0];if(i)for(let c of o)vx(c,s,i);let l=MK(o,a,r);if(i){for(let c of o)vx(c,s,-i);TK(l,s,-i)}return l}function MK(e,t,n){let r=[];for(let c of e){let d=[...c];IK(d[0],d[d.length-1])||d.push([d[0][0],d[0][1]]),d.length>2&&r.push(d)}let i=[];t=Math.max(t,.1);let a=[];for(let c of r)for(let d=0;d<c.length-1;d++){let u=c[d],h=c[d+1];if(u[1]!==h[1]){let m=Math.min(u[1],h[1]);a.push({ymin:m,ymax:Math.max(u[1],h[1]),x:m===u[1]?u[0]:h[0],islope:(h[0]-u[0])/(h[1]-u[1])})}}if(a.sort((c,d)=>c.ymin<d.ymin?-1:c.ymin>d.ymin?1:c.x<d.x?-1:c.x>d.x?1:c.ymax===d.ymax?0:(c.ymax-d.ymax)/Math.abs(c.ymax-d.ymax)),!a.length)return i;let o=[],s=a[0].ymin,l=0;for(;o.length||a.length;){if(a.length){let c=-1;for(let u=0;u<a.length&&!(a[u].ymin>s);u++)c=u;a.splice(0,c+1).forEach(u=>{o.push({s,edge:u})})}if(o=o.filter(c=>!(c.edge.ymax<=s)),o.sort((c,d)=>c.edge.x===d.edge.x?0:(c.edge.x-d.edge.x)/Math.abs(c.edge.x-d.edge.x)),(n!==1||l%t===0)&&o.length>1)for(let c=0;c<o.length;c=c+2){let d=c+1;if(d>=o.length)break;let u=o[c].edge,h=o[d].edge;i.push([[Math.round(u.x),s],[Math.round(h.x),s]])}s+=n,o.forEach(c=>{c.edge.x=c.edge.x+n*c.edge.islope}),l++}return i}function Qa(e,t){var n;let r=t.hachureAngle+90,i=t.hachureGap;i<0&&(i=t.strokeWidth*4),i=Math.max(i,.1);let a=1;return t.roughness>=1&&(((n=t.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(a=i),L7(e,i,r,a||1)}var Ws=class{constructor(t){this.helper=t}fillPolygons(t,n){return this._fillPolygons(t,n)}_fillPolygons(t,n){let r=Qa(t,n);return{type:"fillSketch",ops:this.renderLines(r,n)}}renderLines(t,n){let r=[];for(let i of t)r.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],n));return r}};S();S();function Vs(e){let t=e[0],n=e[1];return Math.sqrt(Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2))}var g0=class extends Ws{fillPolygons(t,n){let r=n.hachureGap;r<0&&(r=n.strokeWidth*4),r=Math.max(r,.1);let i=Object.assign({},n,{hachureGap:r}),a=Qa(t,i),o=Math.PI/180*n.hachureAngle,s=[],l=r*.5*Math.cos(o),c=r*.5*Math.sin(o);for(let[u,h]of a)Vs([u,h])&&s.push([[u[0]-l,u[1]+c],[...h]],[[u[0]+l,u[1]-c],[...h]]);return{type:"fillSketch",ops:this.renderLines(s,n)}}};S();var E0=class extends Ws{fillPolygons(t,n){let r=this._fillPolygons(t,n),i=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),a=this._fillPolygons(t,i);return r.ops=r.ops.concat(a.ops),r}};S();var b0=class{constructor(t){this.helper=t}fillPolygons(t,n){n=Object.assign({},n,{hachureAngle:0});let r=Qa(t,n);return this.dotsOnLines(r,n)}dotsOnLines(t,n){let r=[],i=n.hachureGap;i<0&&(i=n.strokeWidth*4),i=Math.max(i,.1);let a=n.fillWeight;a<0&&(a=n.strokeWidth/2);let o=i/4;for(let s of t){let l=Vs(s),c=l/i,d=Math.ceil(c)-1,u=l-d*i,h=(s[0][0]+s[1][0])/2-i/4,m=Math.min(s[0][1],s[1][1]);for(let p=0;p<d;p++){let f=m+u+p*i,g=h-o+Math.random()*2*o,b=f-o+Math.random()*2*o,v=this.helper.ellipse(g,b,a,a,n);r.push(...v.ops)}}return{type:"fillSketch",ops:r}}};S();var y0=class{constructor(t){this.helper=t}fillPolygons(t,n){let r=Qa(t,n);return{type:"fillSketch",ops:this.dashedLine(r,n)}}dashedLine(t,n){let r=n.dashOffset<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashOffset,i=n.dashGap<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashGap,a=[];return t.forEach(o=>{let s=Vs(o),l=Math.floor(s/(r+i)),c=(s+i-l*(r+i))/2,d=o[0],u=o[1];d[0]>u[0]&&(d=o[1],u=o[0]);let h=Math.atan((u[1]-d[1])/(u[0]-d[0]));for(let m=0;m<l;m++){let p=m*(r+i),f=p+r,g=[d[0]+p*Math.cos(h)+c*Math.cos(h),d[1]+p*Math.sin(h)+c*Math.sin(h)],b=[d[0]+f*Math.cos(h)+c*Math.cos(h),d[1]+f*Math.sin(h)+c*Math.sin(h)];a.push(...this.helper.doubleLineOps(g[0],g[1],b[0],b[1],n))}}),a}};S();var v0=class{constructor(t){this.helper=t}fillPolygons(t,n){let r=n.hachureGap<0?n.strokeWidth*4:n.hachureGap,i=n.zigzagOffset<0?r:n.zigzagOffset;n=Object.assign({},n,{hachureGap:r+i});let a=Qa(t,n);return{type:"fillSketch",ops:this.zigzagLines(a,i,n)}}zigzagLines(t,n,r){let i=[];return t.forEach(a=>{let o=Vs(a),s=Math.round(o/(2*n)),l=a[0],c=a[1];l[0]>c[0]&&(l=a[1],c=a[0]);let d=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let u=0;u<s;u++){let h=u*2*n,m=(u+1)*2*n,p=Math.sqrt(2*Math.pow(n,2)),f=[l[0]+h*Math.cos(d),l[1]+h*Math.sin(d)],g=[l[0]+m*Math.cos(d),l[1]+m*Math.sin(d)],b=[f[0]+p*Math.cos(d+Math.PI/4),f[1]+p*Math.sin(d+Math.PI/4)];i.push(...this.helper.doubleLineOps(f[0],f[1],b[0],b[1],r),...this.helper.doubleLineOps(b[0],b[1],g[0],g[1],r))}}),i}};var Nr={};function R7(e,t){let n=e.fillStyle||"hachure";if(!Nr[n])switch(n){case"zigzag":Nr[n]||(Nr[n]=new g0(t));break;case"cross-hatch":Nr[n]||(Nr[n]=new E0(t));break;case"dots":Nr[n]||(Nr[n]=new b0(t));break;case"dashed":Nr[n]||(Nr[n]=new y0(t));break;case"zigzag-line":Nr[n]||(Nr[n]=new v0(t));break;case"hachure":default:n="hachure",Nr[n]||(Nr[n]=new Ws(t));break}return Nr[n]}S();function O7(){return Math.floor(Math.random()*2**31)}var Ys=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}};S();S();var x0={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function AK(e){let t=new Array;for(;e!=="";)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:0,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:1,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:2,text:""},t}function xx(e,t){return e.type===t}function Hd(e){let t=[],n=AK(e),r="BOD",i=0,a=n[i];for(;!xx(a,2);){let o=0,s=[];if(r==="BOD")if(a.text==="M"||a.text==="m")i++,o=x0[a.text],r=a.text;else return Hd("M0,0"+e);else xx(a,1)?o=x0[r]:(i++,o=x0[a.text],r=a.text);if(i+o<n.length){for(let l=i;l<i+o;l++){let c=n[l];if(xx(c,1))s[s.length]=+c.text;else throw new Error("Param not a number: "+r+","+c.text)}if(typeof x0[r]=="number"){let l={key:r,data:s};t.push(l),i+=o,a=n[i],r==="M"&&(r="L"),r==="m"&&(r="l")}else throw new Error("Bad segment: "+r)}else throw new Error("Path data ended short")}return t}S();function vm(e){let t=0,n=0,r=0,i=0,a=[];for(let{key:o,data:s}of e)switch(o){case"M":a.push({key:"M",data:[...s]}),[t,n]=s,[r,i]=s;break;case"m":t+=s[0],n+=s[1],a.push({key:"M",data:[t,n]}),r=t,i=n;break;case"L":a.push({key:"L",data:[...s]}),[t,n]=s;break;case"l":t+=s[0],n+=s[1],a.push({key:"L",data:[t,n]});break;case"C":a.push({key:"C",data:[...s]}),t=s[4],n=s[5];break;case"c":{let l=s.map((c,d)=>d%2?c+n:c+t);a.push({key:"C",data:l}),t=l[4],n=l[5];break}case"Q":a.push({key:"Q",data:[...s]}),t=s[2],n=s[3];break;case"q":{let l=s.map((c,d)=>d%2?c+n:c+t);a.push({key:"Q",data:l}),t=l[2],n=l[3];break}case"A":a.push({key:"A",data:[...s]}),t=s[5],n=s[6];break;case"a":t+=s[5],n+=s[6],a.push({key:"A",data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case"H":a.push({key:"H",data:[...s]}),t=s[0];break;case"h":t+=s[0],a.push({key:"H",data:[t]});break;case"V":a.push({key:"V",data:[...s]}),n=s[0];break;case"v":n+=s[0],a.push({key:"V",data:[n]});break;case"S":a.push({key:"S",data:[...s]}),t=s[2],n=s[3];break;case"s":{let l=s.map((c,d)=>d%2?c+n:c+t);a.push({key:"S",data:l}),t=l[2],n=l[3];break}case"T":a.push({key:"T",data:[...s]}),t=s[0],n=s[1];break;case"t":t+=s[0],n+=s[1],a.push({key:"T",data:[t,n]});break;case"Z":case"z":a.push({key:"Z",data:[]}),t=r,n=i;break}return a}S();function wm(e){let t=[],n="",r=0,i=0,a=0,o=0,s=0,l=0;for(let{key:c,data:d}of e){switch(c){case"M":t.push({key:"M",data:[...d]}),[r,i]=d,[a,o]=d;break;case"C":t.push({key:"C",data:[...d]}),r=d[4],i=d[5],s=d[2],l=d[3];break;case"L":t.push({key:"L",data:[...d]}),[r,i]=d;break;case"H":r=d[0],t.push({key:"L",data:[r,i]});break;case"V":i=d[0],t.push({key:"L",data:[r,i]});break;case"S":{let u=0,h=0;n==="C"||n==="S"?(u=r+(r-s),h=i+(i-l)):(u=r,h=i),t.push({key:"C",data:[u,h,...d]}),s=d[0],l=d[1],r=d[2],i=d[3];break}case"T":{let[u,h]=d,m=0,p=0;n==="Q"||n==="T"?(m=r+(r-s),p=i+(i-l)):(m=r,p=i);let f=r+2*(m-r)/3,g=i+2*(p-i)/3,b=u+2*(m-u)/3,v=h+2*(p-h)/3;t.push({key:"C",data:[f,g,b,v,u,h]}),s=m,l=p,r=u,i=h;break}case"Q":{let[u,h,m,p]=d,f=r+2*(u-r)/3,g=i+2*(h-i)/3,b=m+2*(u-m)/3,v=p+2*(h-p)/3;t.push({key:"C",data:[f,g,b,v,m,p]}),s=u,l=h,r=m,i=p;break}case"A":{let u=Math.abs(d[0]),h=Math.abs(d[1]),m=d[2],p=d[3],f=d[4],g=d[5],b=d[6];u===0||h===0?(t.push({key:"C",data:[r,i,g,b,g,b]}),r=g,i=b):(r!==g||i!==b)&&(N7(r,i,g,b,u,h,m,p,f).forEach(function(y){t.push({key:"C",data:y})}),r=g,i=b);break}case"Z":t.push({key:"Z",data:[]}),r=a,i=o;break}n=c}return t}function kK(e){return Math.PI*e/180}function xm(e,t,n){let r=e*Math.cos(n)-t*Math.sin(n),i=e*Math.sin(n)+t*Math.cos(n);return[r,i]}function N7(e,t,n,r,i,a,o,s,l,c){let d=kK(o),u=[],h=0,m=0,p=0,f=0;if(c)[h,m,p,f]=c;else{[e,t]=xm(e,t,-d),[n,r]=xm(n,r,-d);let P=(e-n)/2,F=(t-r)/2,Y=P*P/(i*i)+F*F/(a*a);Y>1&&(Y=Math.sqrt(Y),i=Y*i,a=Y*a);let j=s===l?-1:1,q=i*i,ne=a*a,H=q*ne-q*F*F-ne*P*P,V=q*F*F+ne*P*P,$=j*Math.sqrt(Math.abs(H/V));p=$*i*F/a+(e+n)/2,f=$*-a*P/i+(t+r)/2,h=Math.asin(parseFloat(((t-f)/a).toFixed(9))),m=Math.asin(parseFloat(((r-f)/a).toFixed(9))),e<p&&(h=Math.PI-h),n<p&&(m=Math.PI-m),h<0&&(h=Math.PI*2+h),m<0&&(m=Math.PI*2+m),l&&h>m&&(h=h-Math.PI*2),!l&&m>h&&(m=m-Math.PI*2)}let g=m-h;if(Math.abs(g)>Math.PI*120/180){let P=m,F=n,Y=r;l&&m>h?m=h+Math.PI*120/180*1:m=h+Math.PI*120/180*-1,n=p+i*Math.cos(m),r=f+a*Math.sin(m),u=N7(n,r,F,Y,i,a,o,0,l,[m,P,p,f])}g=m-h;let b=Math.cos(h),v=Math.sin(h),y=Math.cos(m),w=Math.sin(m),C=Math.tan(g/4),A=4/3*i*C,T=4/3*a*C,I=[e,t],k=[e+A*v,t-T*b],R=[n+A*w,r-T*y],O=[n,r];if(k[0]=2*I[0]-k[0],k[1]=2*I[1]-k[1],c)return[k,R,O].concat(u);{u=[k,R,O].concat(u);let P=[];for(let F=0;F<u.length;F+=3){let Y=xm(u[F][0],u[F][1],d),j=xm(u[F+1][0],u[F+1][1],d),q=xm(u[F+2][0],u[F+2][1],d);P.push([Y[0],Y[1],j[0],j[1],q[0],q[1]])}return P}}var PK={randOffset:LK,randOffsetWithRange:RK,ellipse:_K,doubleLineOps:OK};function wx(e,t,n,r,i){return{type:"path",ops:Uo(e,t,n,r,i)}}function Sm(e,t,n){let r=(e||[]).length;if(r>2){let i=[];for(let a=0;a<r-1;a++)i.push(...Uo(e[a][0],e[a][1],e[a+1][0],e[a+1][1],n));return t&&i.push(...Uo(e[r-1][0],e[r-1][1],e[0][0],e[0][1],n)),{type:"path",ops:i}}else if(r===2)return wx(e[0][0],e[0][1],e[1][0],e[1][1],n);return{type:"path",ops:[]}}function DK(e,t){return Sm(e,!0,t)}function H7(e,t,n,r,i){let a=[[e,t],[e+n,t],[e+n,t+r],[e,t+r]];return DK(a,i)}function Sx(e,t){let n=F7(e,1*(1+t.roughness*.2),t);if(!t.disableMultiStroke){let r=F7(e,1.5*(1+t.roughness*.22),NK(t));n=n.concat(r)}return{type:"path",ops:n}}function _K(e,t,n,r,i){let a=Cx(n,r,i);return C0(e,t,i,a).opset}function Cx(e,t,n){let r=Math.sqrt(Math.PI*2*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),a=Math.PI*2/i,o=Math.abs(e/2),s=Math.abs(t/2),l=1-n.curveFitting;return o+=Ie(o*l,n),s+=Ie(s*l,n),{increment:a,rx:o,ry:s}}function C0(e,t,n,r){let[i,a]=B7(r.increment,e,t,r.rx,r.ry,1,r.increment*w0(.1,w0(.4,1,n),n),n),o=S0(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[s]=B7(r.increment,e,t,r.rx,r.ry,1.5,0,n),l=S0(s,null,n);o=o.concat(l)}return{estimatedPoints:a,opset:{type:"path",ops:o}}}function Tx(e,t,n,r,i,a,o,s,l){let c=e,d=t,u=Math.abs(n/2),h=Math.abs(r/2);u+=Ie(u*.01,l),h+=Ie(h*.01,l);let m=i,p=a;for(;m<0;)m+=Math.PI*2,p+=Math.PI*2;p-m>Math.PI*2&&(m=0,p=Math.PI*2);let f=Math.PI*2/l.curveStepCount,g=Math.min(f/2,(p-m)/2),b=z7(g,c,d,u,h,m,p,1,l);if(!l.disableMultiStroke){let v=z7(g,c,d,u,h,m,p,1.5,l);b.push(...v)}return o&&(s?b.push(...Uo(c,d,c+u*Math.cos(m),d+h*Math.sin(m),l),...Uo(c,d,c+u*Math.cos(p),d+h*Math.sin(p),l)):b.push({op:"lineTo",data:[c,d]},{op:"lineTo",data:[c+u*Math.cos(m),d+h*Math.sin(m)]})),{type:"path",ops:b}}function Ix(e,t){let n=wm(vm(Hd(e))),r=[],i=[0,0],a=[0,0];for(let{key:o,data:s}of n)switch(o){case"M":{a=[s[0],s[1]],i=[s[0],s[1]];break}case"L":r.push(...Uo(a[0],a[1],s[0],s[1],t)),a=[s[0],s[1]];break;case"C":{let[l,c,d,u,h,m]=s;r.push(...$K(l,c,d,u,h,m,a,t)),a=[h,m];break}case"Z":r.push(...Uo(a[0],a[1],i[0],i[1],t)),a=[i[0],i[1]];break}return{type:"path",ops:r}}function T0(e,t){let n=[];for(let r of e)if(r.length){let i=t.maxRandomnessOffset||0,a=r.length;if(a>2){n.push({op:"move",data:[r[0][0]+Ie(i,t),r[0][1]+Ie(i,t)]});for(let o=1;o<a;o++)n.push({op:"lineTo",data:[r[o][0]+Ie(i,t),r[o][1]+Ie(i,t)]})}}return{type:"fillPath",ops:n}}function cc(e,t){return R7(t,PK).fillPolygons(e,t)}function U7(e,t,n,r,i,a,o){let s=e,l=t,c=Math.abs(n/2),d=Math.abs(r/2);c+=Ie(c*.01,o),d+=Ie(d*.01,o);let u=i,h=a;for(;u<0;)u+=Math.PI*2,h+=Math.PI*2;h-u>Math.PI*2&&(u=0,h=Math.PI*2);let m=(h-u)/o.curveStepCount,p=[];for(let f=u;f<=h;f=f+m)p.push([s+c*Math.cos(f),l+d*Math.sin(f)]);return p.push([s+c*Math.cos(h),l+d*Math.sin(h)]),p.push([s,l]),cc([p],o)}function LK(e,t){return Ie(e,t)}function RK(e,t,n){return w0(e,t,n)}function OK(e,t,n,r,i){return Uo(e,t,n,r,i,!0)}function NK(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function G7(e){return e.randomizer||(e.randomizer=new Ys(e.seed||0)),e.randomizer.next()}function w0(e,t,n,r=1){return n.roughness*r*(G7(n)*(t-e)+e)}function Ie(e,t,n=1){return w0(-e,e,t,n)}function Uo(e,t,n,r,i,a=!1){let o=a?i.disableMultiStrokeFill:i.disableMultiStroke,s=$7(e,t,n,r,i,!0,!1);if(o)return s;let l=$7(e,t,n,r,i,!0,!0);return s.concat(l)}function $7(e,t,n,r,i,a,o){let s=Math.pow(e-n,2)+Math.pow(t-r,2),l=Math.sqrt(s),c=1;l<200?c=1:l>500?c=.4:c=-.0016668*l+1.233334;let d=i.maxRandomnessOffset||0;d*d*100>s&&(d=l/10);let u=d/2,h=.2+G7(i)*.2,m=i.bowing*i.maxRandomnessOffset*(r-t)/200,p=i.bowing*i.maxRandomnessOffset*(e-n)/200;m=Ie(m,i,c),p=Ie(p,i,c);let f=[],g=()=>Ie(u,i,c),b=()=>Ie(d,i,c),v=i.preserveVertices;return a&&(o?f.push({op:"move",data:[e+(v?0:g()),t+(v?0:g())]}):f.push({op:"move",data:[e+(v?0:Ie(d,i,c)),t+(v?0:Ie(d,i,c))]})),o?f.push({op:"bcurveTo",data:[m+e+(n-e)*h+g(),p+t+(r-t)*h+g(),m+e+2*(n-e)*h+g(),p+t+2*(r-t)*h+g(),n+(v?0:g()),r+(v?0:g())]}):f.push({op:"bcurveTo",data:[m+e+(n-e)*h+b(),p+t+(r-t)*h+b(),m+e+2*(n-e)*h+b(),p+t+2*(r-t)*h+b(),n+(v?0:b()),r+(v?0:b())]}),f}function F7(e,t,n){let r=[];r.push([e[0][0]+Ie(t,n),e[0][1]+Ie(t,n)]),r.push([e[0][0]+Ie(t,n),e[0][1]+Ie(t,n)]);for(let i=1;i<e.length;i++)r.push([e[i][0]+Ie(t,n),e[i][1]+Ie(t,n)]),i===e.length-1&&r.push([e[i][0]+Ie(t,n),e[i][1]+Ie(t,n)]);return S0(r,null,n)}function S0(e,t,n){let r=e.length,i=[];if(r>3){let a=[],o=1-n.curveTightness;i.push({op:"move",data:[e[1][0],e[1][1]]});for(let s=1;s+2<r;s++){let l=e[s];a[0]=[l[0],l[1]],a[1]=[l[0]+(o*e[s+1][0]-o*e[s-1][0])/6,l[1]+(o*e[s+1][1]-o*e[s-1][1])/6],a[2]=[e[s+1][0]+(o*e[s][0]-o*e[s+2][0])/6,e[s+1][1]+(o*e[s][1]-o*e[s+2][1])/6],a[3]=[e[s+1][0],e[s+1][1]],i.push({op:"bcurveTo",data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(t&&t.length===2){let s=n.maxRandomnessOffset;i.push({op:"lineTo",data:[t[0]+Ie(s,n),t[1]+Ie(s,n)]})}}else r===3?(i.push({op:"move",data:[e[1][0],e[1][1]]}),i.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):r===2&&i.push(...Uo(e[0][0],e[0][1],e[1][0],e[1][1],n));return i}function B7(e,t,n,r,i,a,o,s){let l=s.roughness===0,c=[],d=[];if(l){e=e/4,d.push([t+r*Math.cos(-e),n+i*Math.sin(-e)]);for(let u=0;u<=Math.PI*2;u=u+e){let h=[t+r*Math.cos(u),n+i*Math.sin(u)];c.push(h),d.push(h)}d.push([t+r*Math.cos(0),n+i*Math.sin(0)]),d.push([t+r*Math.cos(e),n+i*Math.sin(e)])}else{let u=Ie(.5,s)-Math.PI/2;d.push([Ie(a,s)+t+.9*r*Math.cos(u-e),Ie(a,s)+n+.9*i*Math.sin(u-e)]);let h=Math.PI*2+u-.01;for(let m=u;m<h;m=m+e){let p=[Ie(a,s)+t+r*Math.cos(m),Ie(a,s)+n+i*Math.sin(m)];c.push(p),d.push(p)}d.push([Ie(a,s)+t+r*Math.cos(u+Math.PI*2+o*.5),Ie(a,s)+n+i*Math.sin(u+Math.PI*2+o*.5)]),d.push([Ie(a,s)+t+.98*r*Math.cos(u+o),Ie(a,s)+n+.98*i*Math.sin(u+o)]),d.push([Ie(a,s)+t+.9*r*Math.cos(u+o*.5),Ie(a,s)+n+.9*i*Math.sin(u+o*.5)])}return[d,c]}function z7(e,t,n,r,i,a,o,s,l){let c=a+Ie(.1,l),d=[];d.push([Ie(s,l)+t+.9*r*Math.cos(c-e),Ie(s,l)+n+.9*i*Math.sin(c-e)]);for(let u=c;u<=o;u=u+e)d.push([Ie(s,l)+t+r*Math.cos(u),Ie(s,l)+n+i*Math.sin(u)]);return d.push([t+r*Math.cos(o),n+i*Math.sin(o)]),d.push([t+r*Math.cos(o),n+i*Math.sin(o)]),S0(d,null,l)}function $K(e,t,n,r,i,a,o,s){let l=[],c=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],d=[0,0],u=s.disableMultiStroke?1:2,h=s.preserveVertices;for(let m=0;m<u;m++)m===0?l.push({op:"move",data:[o[0],o[1]]}):l.push({op:"move",data:[o[0]+(h?0:Ie(c[0],s)),o[1]+(h?0:Ie(c[0],s))]}),d=h?[i,a]:[i+Ie(c[m],s),a+Ie(c[m],s)],l.push({op:"bcurveTo",data:[e+Ie(c[m],s),t+Ie(c[m],s),n+Ie(c[m],s),r+Ie(c[m],s),d[0],d[1]]});return l}S();function Cm(e){return[...e]}function j7(e,t=0){let n=e.length;if(n<3)throw new Error("A curve must have at least three points.");let r=[];if(n===3)r.push(Cm(e[0]),Cm(e[1]),Cm(e[2]),Cm(e[2]));else{let i=[];i.push(e[0],e[0]);for(let s=1;s<e.length;s++)i.push(e[s]),s===e.length-1&&i.push(e[s]);let a=[],o=1-t;r.push(Cm(i[0]));for(let s=1;s+2<i.length;s++){let l=i[s];a[0]=[l[0],l[1]],a[1]=[l[0]+(o*i[s+1][0]-o*i[s-1][0])/6,l[1]+(o*i[s+1][1]-o*i[s-1][1])/6],a[2]=[i[s+1][0]+(o*i[s][0]-o*i[s+2][0])/6,i[s+1][1]+(o*i[s][1]-o*i[s+2][1])/6],a[3]=[i[s+1][0],i[s+1][1]],r.push(a[1],a[2],a[3])}}return r}S();function FK(e,t){return Math.sqrt(I0(e,t))}function I0(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function BK(e,t,n){let r=I0(t,n);if(r===0)return I0(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),I0(e,dc(t,n,i))}function dc(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function zK(e,t){let n=e[t+0],r=e[t+1],i=e[t+2],a=e[t+3],o=3*r[0]-2*n[0]-a[0];o*=o;let s=3*r[1]-2*n[1]-a[1];s*=s;let l=3*i[0]-2*a[0]-n[0];l*=l;let c=3*i[1]-2*a[1]-n[1];return c*=c,o<l&&(o=l),s<c&&(s=c),o+s}function Mx(e,t,n,r){let i=r||[];if(zK(e,t)<n){let a=e[t+0];i.length?FK(i[i.length-1],a)>1&&i.push(a):i.push(a),i.push(e[t+3])}else{let o=e[t+0],s=e[t+1],l=e[t+2],c=e[t+3],d=dc(o,s,.5),u=dc(s,l,.5),h=dc(l,c,.5),m=dc(d,u,.5),p=dc(u,h,.5),f=dc(m,p,.5);Mx([o,d,m,f],0,n,i),Mx([f,p,h,c],0,n,i)}return i}function W7(e,t){return M0(e,0,e.length,t)}function M0(e,t,n,r,i){let a=i||[],o=e[t],s=e[n-1],l=0,c=1;for(let d=t+1;d<n-1;++d){let u=BK(e[d],o,s);u>l&&(l=u,c=d)}return Math.sqrt(l)>r?(M0(e,t,c+1,r,a),M0(e,c,n,r,a)):(a.length||a.push(o),a.push(s)),a}function Ud(e,t=.15,n){let r=[],i=(e.length-1)/3;for(let a=0;a<i;a++){let o=a*3;Mx(e,o,t,r)}return n&&n>0?M0(r,0,r.length,n):r}S();function V7(e,t,n){let r=Hd(e),i=wm(vm(r)),a=[],o=[],s=[0,0],l=[],c=()=>{l.length>=4&&o.push(...Ud(l,t)),l=[]},d=()=>{c(),o.length&&(a.push(o),o=[])};for(let{key:h,data:m}of i)switch(h){case"M":d(),s=[m[0],m[1]],o.push(s);break;case"L":c(),o.push([m[0],m[1]]);break;case"C":if(!l.length){let p=o.length?o[o.length-1]:s;l.push([p[0],p[1]])}l.push([m[0],m[1]]),l.push([m[2],m[3]]),l.push([m[4],m[5]]);break;case"Z":c(),o.push([s[0],s[1]]);break}if(d(),!n)return a;let u=[];for(let h of a){let m=W7(h,n);m.length&&u.push(m)}return u}var Jr="none",ei=class{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return O7()}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,n,r){return{shape:t,sets:n||[],options:r||this.defaultOptions}}line(t,n,r,i,a){let o=this._o(a);return this._d("line",[wx(t,n,r,i,o)],o)}rectangle(t,n,r,i,a){let o=this._o(a),s=[],l=H7(t,n,r,i,o);if(o.fill){let c=[[t,n],[t+r,n],[t+r,n+i],[t,n+i]];o.fillStyle==="solid"?s.push(T0([c],o)):s.push(cc([c],o))}return o.stroke!==Jr&&s.push(l),this._d("rectangle",s,o)}ellipse(t,n,r,i,a){let o=this._o(a),s=[],l=Cx(r,i,o),c=C0(t,n,o,l);if(o.fill)if(o.fillStyle==="solid"){let d=C0(t,n,o,l).opset;d.type="fillPath",s.push(d)}else s.push(cc([c.estimatedPoints],o));return o.stroke!==Jr&&s.push(c.opset),this._d("ellipse",s,o)}circle(t,n,r,i){let a=this.ellipse(t,n,r,r,i);return a.shape="circle",a}linearPath(t,n){let r=this._o(n);return this._d("linearPath",[Sm(t,!1,r)],r)}arc(t,n,r,i,a,o,s=!1,l){let c=this._o(l),d=[],u=Tx(t,n,r,i,a,o,s,!0,c);if(s&&c.fill)if(c.fillStyle==="solid"){let h=Object.assign({},c);h.disableMultiStroke=!0;let m=Tx(t,n,r,i,a,o,!0,!1,h);m.type="fillPath",d.push(m)}else d.push(U7(t,n,r,i,a,o,c));return c.stroke!==Jr&&d.push(u),this._d("arc",d,c)}curve(t,n){let r=this._o(n),i=[],a=Sx(t,r);if(r.fill&&r.fill!==Jr&&t.length>=3)if(r.fillStyle==="solid"){let o=Sx(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(o.ops)})}else{let o=j7(t),s=Ud(o,10,(1+r.roughness)/2);i.push(cc([s],r))}return r.stroke!==Jr&&i.push(a),this._d("curve",i,r)}polygon(t,n){let r=this._o(n),i=[],a=Sm(t,!0,r);return r.fill&&(r.fillStyle==="solid"?i.push(T0([t],r)):i.push(cc([t],r))),r.stroke!==Jr&&i.push(a),this._d("polygon",i,r)}path(t,n){let r=this._o(n),i=[];if(!t)return this._d("path",i,r);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let a=r.fill&&r.fill!=="transparent"&&r.fill!==Jr,o=r.stroke!==Jr,s=!!(r.simplification&&r.simplification<1),l=s?4-4*(r.simplification||1):(1+r.roughness)/2,c=V7(t,1,l),d=Ix(t,r);if(a)if(r.fillStyle==="solid")if(c.length===1){let u=Ix(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(u.ops)})}else i.push(T0(c,r));else i.push(cc(c,r));return o&&(s?c.forEach(u=>{i.push(Sm(u,!1,r))}):i.push(d)),this._d("path",i,r)}opsToPath(t,n){let r="";for(let i of t.ops){let a=typeof n=="number"&&n>=0?i.data.map(o=>+o.toFixed(n)):i.data;switch(i.op){case"move":r+=`M${a[0]} ${a[1]} `;break;case"bcurveTo":r+=`C${a[0]} ${a[1]}, ${a[2]} ${a[3]}, ${a[4]} ${a[5]} `;break;case"lineTo":r+=`L${a[0]} ${a[1]} `;break}}return r.trim()}toPaths(t){let n=t.sets||[],r=t.options||this.defaultOptions,i=[];for(let a of n){let o=null;switch(a.type){case"path":o={d:this.opsToPath(a),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:Jr};break;case"fillPath":o={d:this.opsToPath(a),stroke:Jr,strokeWidth:0,fill:r.fill||Jr};break;case"fillSketch":o=this.fillSketch(a,r);break}o&&i.push(o)}return i}fillSketch(t,n){let r=n.fillWeight;return r<0&&(r=n.strokeWidth/2),{d:this.opsToPath(t),stroke:n.fill||Jr,strokeWidth:r,fill:Jr}}_mergedShape(t){return t.filter((n,r)=>r===0?!0:n.op!=="move")}};var A0=class{constructor(t,n){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new ei(n)}draw(t){let n=t.sets||[],r=t.options||this.getDefaultOptions(),i=this.ctx,a=t.options.fixedDecimalPlaceDigits;for(let o of n)switch(o.type){case"path":i.save(),i.strokeStyle=r.stroke==="none"?"transparent":r.stroke,i.lineWidth=r.strokeWidth,r.strokeLineDash&&i.setLineDash(r.strokeLineDash),r.strokeLineDashOffset&&(i.lineDashOffset=r.strokeLineDashOffset),this._drawToContext(i,o,a),i.restore();break;case"fillPath":{i.save(),i.fillStyle=r.fill||"";let s=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,o,a,s),i.restore();break}case"fillSketch":this.fillSketch(i,o,r);break}}fillSketch(t,n,r){let i=r.fillWeight;i<0&&(i=r.strokeWidth/2),t.save(),r.fillLineDash&&t.setLineDash(r.fillLineDash),r.fillLineDashOffset&&(t.lineDashOffset=r.fillLineDashOffset),t.strokeStyle=r.fill||"",t.lineWidth=i,this._drawToContext(t,n,r.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,n,r,i="nonzero"){t.beginPath();for(let a of n.ops){let o=typeof r=="number"&&r>=0?a.data.map(s=>+s.toFixed(r)):a.data;switch(a.op){case"move":t.moveTo(o[0],o[1]);break;case"bcurveTo":t.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"lineTo":t.lineTo(o[0],o[1]);break}}n.type==="fillPath"?t.fill(i):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,n,r,i,a){let o=this.gen.line(t,n,r,i,a);return this.draw(o),o}rectangle(t,n,r,i,a){let o=this.gen.rectangle(t,n,r,i,a);return this.draw(o),o}ellipse(t,n,r,i,a){let o=this.gen.ellipse(t,n,r,i,a);return this.draw(o),o}circle(t,n,r,i){let a=this.gen.circle(t,n,r,i);return this.draw(a),a}linearPath(t,n){let r=this.gen.linearPath(t,n);return this.draw(r),r}polygon(t,n){let r=this.gen.polygon(t,n);return this.draw(r),r}arc(t,n,r,i,a,o,s=!1,l){let c=this.gen.arc(t,n,r,i,a,o,s,l);return this.draw(c),c}curve(t,n){let r=this.gen.curve(t,n);return this.draw(r),r}path(t,n){let r=this.gen.path(t,n);return this.draw(r),r}};S();S();var Tm="http://www.w3.org/2000/svg";var k0=class{constructor(t,n){this.svg=t,this.gen=new ei(n)}draw(t){let n=t.sets||[],r=t.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,a=i.createElementNS(Tm,"g"),o=t.options.fixedDecimalPlaceDigits;for(let s of n){let l=null;switch(s.type){case"path":{l=i.createElementNS(Tm,"path"),l.setAttribute("d",this.opsToPath(s,o)),l.setAttribute("stroke",r.stroke),l.setAttribute("stroke-width",r.strokeWidth+""),l.setAttribute("fill","none"),r.strokeLineDash&&l.setAttribute("stroke-dasharray",r.strokeLineDash.join(" ").trim()),r.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${r.strokeLineDashOffset}`);break}case"fillPath":{l=i.createElementNS(Tm,"path"),l.setAttribute("d",this.opsToPath(s,o)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",r.fill||""),(t.shape==="curve"||t.shape==="polygon")&&l.setAttribute("fill-rule","evenodd");break}case"fillSketch":{l=this.fillSketch(i,s,r);break}}l&&a.appendChild(l)}return a}fillSketch(t,n,r){let i=r.fillWeight;i<0&&(i=r.strokeWidth/2);let a=t.createElementNS(Tm,"path");return a.setAttribute("d",this.opsToPath(n,r.fixedDecimalPlaceDigits)),a.setAttribute("stroke",r.fill||""),a.setAttribute("stroke-width",i+""),a.setAttribute("fill","none"),r.fillLineDash&&a.setAttribute("stroke-dasharray",r.fillLineDash.join(" ").trim()),r.fillLineDashOffset&&a.setAttribute("stroke-dashoffset",`${r.fillLineDashOffset}`),a}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,n){return this.gen.opsToPath(t,n)}line(t,n,r,i,a){let o=this.gen.line(t,n,r,i,a);return this.draw(o)}rectangle(t,n,r,i,a){let o=this.gen.rectangle(t,n,r,i,a);return this.draw(o)}ellipse(t,n,r,i,a){let o=this.gen.ellipse(t,n,r,i,a);return this.draw(o)}circle(t,n,r,i){let a=this.gen.circle(t,n,r,i);return this.draw(a)}linearPath(t,n){let r=this.gen.linearPath(t,n);return this.draw(r)}polygon(t,n){let r=this.gen.polygon(t,n);return this.draw(r)}arc(t,n,r,i,a,o,s=!1,l){let c=this.gen.arc(t,n,r,i,a,o,s,l);return this.draw(c)}curve(t,n){let r=this.gen.curve(t,n);return this.draw(r)}path(t,n){let r=this.gen.path(t,n);return this.draw(r)}};var nn={canvas(e,t){return new A0(e,t)},svg(e,t){return new k0(e,t)},generator(e){return new ei(e)},newSeed(){return ei.newSeed()}};S();S();S();function Y7(e,t,n,r=i=>i){return e*r(.5-t*(.5-n))}function HK(e){return[-e[0],-e[1]]}function ra(e,t){return[e[0]+t[0],e[1]+t[1]]}function Mi(e,t){return[e[0]-t[0],e[1]-t[1]]}function na(e,t){return[e[0]*t,e[1]*t]}function UK(e,t){return[e[0]/t,e[1]/t]}function Im(e){return[e[1],-e[0]]}function Z7(e,t){return e[0]*t[0]+e[1]*t[1]}function GK(e,t){return e[0]===t[0]&&e[1]===t[1]}function jK(e){return Math.hypot(e[0],e[1])}function WK(e){return e[0]*e[0]+e[1]*e[1]}function K7(e,t){return WK(Mi(e,t))}function Q7(e){return UK(e,jK(e))}function VK(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function Mm(e,t,n){let r=Math.sin(n),i=Math.cos(n),a=e[0]-t[0],o=e[1]-t[1],s=a*i-o*r,l=a*r+o*i;return[s+t[0],l+t[1]]}function Ax(e,t,n){return ra(e,na(Mi(t,e),n))}function X7(e,t,n){return ra(e,na(t,n))}var{min:Gd,PI:YK}=Math,q7=.275,Am=YK+1e-4;function ZK(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=ne=>ne,start:s={},end:l={},last:c=!1}=t,{cap:d=!0,easing:u=ne=>ne*(2-ne)}=s,{cap:h=!0,easing:m=ne=>--ne*ne*ne+1}=l;if(e.length===0||n<=0)return[];let p=e[e.length-1].runningLength,f=s.taper===!1?0:s.taper===!0?Math.max(n,p):s.taper,g=l.taper===!1?0:l.taper===!0?Math.max(n,p):l.taper,b=Math.pow(n*r,2),v=[],y=[],w=e.slice(0,10).reduce((ne,H)=>{let V=H.pressure;if(a){let $=Gd(1,H.distance/n),B=Gd(1,1-$);V=Gd(1,ne+(B-ne)*($*q7))}return(ne+V)/2},e[0].pressure),C=Y7(n,i,e[e.length-1].pressure,o),A,T=e[0].vector,I=e[0].point,k=I,R=I,O=k,P=!1;for(let ne=0;ne<e.length;ne++){let{pressure:H}=e[ne],{point:V,vector:$,distance:B,runningLength:G}=e[ne];if(ne<e.length-1&&p-G<3)continue;if(i){if(a){let Le=Gd(1,B/n),Pe=Gd(1,1-Le);H=Gd(1,w+(Pe-w)*(Le*q7))}C=Y7(n,i,H,o)}else C=n/2;A===void 0&&(A=C);let U=G<f?u(G/f):1,Q=p-G<g?m((p-G)/g):1;C=Math.max(.01,C*Math.min(U,Q));let re=(ne<e.length-1?e[ne+1]:e[ne]).vector,se=ne<e.length-1?Z7($,re):1,me=Z7($,T)<0&&!P,it=se!==null&&se<0;if(me||it){let Le=na(Im(T),C);for(let Pe=1/13,at=0;at<=1;at+=Pe)R=Mm(Mi(V,Le),V,Am*at),v.push(R),O=Mm(ra(V,Le),V,Am*-at),y.push(O);I=R,k=O,it&&(P=!0);continue}if(P=!1,ne===e.length-1){let Le=na(Im($),C);v.push(Mi(V,Le)),y.push(ra(V,Le));continue}let Qe=na(Im(Ax(re,$,se)),C);R=Mi(V,Qe),(ne<=1||K7(I,R)>b)&&(v.push(R),I=R),O=ra(V,Qe),(ne<=1||K7(k,O)>b)&&(y.push(O),k=O),w=H,T=$}let F=e[0].point.slice(0,2),Y=e.length>1?e[e.length-1].point.slice(0,2):ra(e[0].point,[1,1]),j=[],q=[];if(e.length===1){if(!(f||g)||c){let ne=X7(F,Q7(Im(Mi(F,Y))),-(A||C)),H=[];for(let V=1/13,$=V;$<=1;$+=V)H.push(Mm(ne,F,Am*2*$));return H}}else{if(!(f||g&&e.length===1))if(d)for(let H=1/13,V=H;V<=1;V+=H){let $=Mm(y[0],F,Am*V);j.push($)}else{let H=Mi(v[0],y[0]),V=na(H,.5),$=na(H,.51);j.push(Mi(F,V),Mi(F,$),ra(F,$),ra(F,V))}let ne=Im(HK(e[e.length-1].vector));if(g||f&&e.length===1)q.push(Y);else if(h){let H=X7(Y,ne,C);for(let V=1/29,$=V;$<1;$+=V)q.push(Mm(H,Y,Am*3*$))}else q.push(ra(Y,na(ne,C)),ra(Y,na(ne,C*.99)),Mi(Y,na(ne,C*.99)),Mi(Y,na(ne,C)))}return v.concat(q,y.reverse(),j)}function KK(e,t={}){var n;let{streamline:r=.5,size:i=16,last:a=!1}=t;if(e.length===0)return[];let o=.15+(1-r)*.85,s=Array.isArray(e[0])?e:e.map(({x:m,y:p,pressure:f=.5})=>[m,p,f]);if(s.length===2){let m=s[1];s=s.slice(0,-1);for(let p=1;p<5;p++)s.push(Ax(s[0],m,p/4))}s.length===1&&(s=[...s,[...ra(s[0],[1,1]),...s[0].slice(2)]]);let l=[{point:[s[0][0],s[0][1]],pressure:s[0][2]>=0?s[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],c=!1,d=0,u=l[0],h=s.length-1;for(let m=1;m<s.length;m++){let p=a&&m===h?s[m].slice(0,2):Ax(u.point,s[m],o);if(GK(u.point,p))continue;let f=VK(p,u.point);if(d+=f,m<h&&!c){if(d<i)continue;c=!0}u={point:p,pressure:s[m][2]>=0?s[m][2]:.5,vector:Q7(Mi(u.point,p)),distance:f,runningLength:d},l.push(u)}return l[0].vector=((n=l[1])==null?void 0:n.vector)||[0,0],l}function P0(e,t={}){return ZK(KK(e,t),t)}S();S();S();S();var or=(e,t)=>[0,0,0,0,t,e,1,0];var J7=(e,t)=>[0,0,0,0,t,e,0,0];var uc=(e=0,t=0)=>{let n=[0,0,0,0,0,0,0,0];if(t<0||t>7)throw new Error(`Expected \`index\` between 0 and 7, got \`${t}\``);return e!==0&&(n[t]=e),n};var jd=e=>[e[0],e[1],e[2],e[3],-e[4],-e[5],-e[6],-e[7]];var eP=(e,t)=>Lx(t)?[e[0]+t,e[1],e[2],e[3],e[4],e[5],e[6],e[7]]:[e[0]+t[0],e[1]+t[1],e[2]+t[2],e[3]+t[3],e[4]+t[4],e[5]+t[5],e[6]+t[6],e[7]+t[7]],kx=(e,t)=>Lx(t)?[e[0]-t,e[1],e[2],e[3],e[4],e[5],e[6],e[7]]:[e[0]-t[0],e[1]-t[1],e[2]-t[2],e[3]-t[3],e[4]-t[4],e[5]-t[5],e[6]-t[6],e[7]-t[7]],Zs=(e,t)=>Lx(t)?[e[0]*t,e[1]*t,e[2]*t,e[3]*t,e[4]*t,e[5]*t,e[6]*t,e[7]*t]:[XK(e,t),t[1]*e[0]+t[0]*e[1]-t[4]*e[2]+t[5]*e[3]+t[2]*e[4]-t[3]*e[5]-t[7]*e[6]-t[6]*e[7],t[2]*e[0]+t[0]*e[2]-t[6]*e[3]+t[3]*e[6],t[3]*e[0]+t[6]*e[2]+t[0]*e[3]-t[2]*e[6],t[4]*e[0]+t[2]*e[1]-t[1]*e[2]+t[7]*e[3]+t[0]*e[4]+t[6]*e[5]-t[5]*e[6]+t[3]*e[7],t[5]*e[0]-t[3]*e[1]+t[7]*e[2]+t[1]*e[3]-t[6]*e[4]+t[0]*e[5]+t[4]*e[6]+t[2]*e[7],t[6]*e[0]+t[3]*e[2]-t[2]*e[3]+t[0]*e[6],t[7]*e[0]+t[6]*e[1]+t[5]*e[2]+t[4]*e[3]+t[3]*e[4]+t[2]*e[5]+t[1]*e[6]+t[0]*e[7]],XK=(e,t)=>t[0]*e[0]+t[2]*e[2]+t[3]*e[3]-t[6]*e[6],Px=(e,t)=>[t[0]*e[0],t[1]*e[0]+t[0]*e[1],t[2]*e[0]+t[0]*e[2],t[3]*e[0]+t[0]*e[3],t[4]*e[0]+t[2]*e[1]-t[1]*e[2]+t[0]*e[4],t[5]*e[0]-t[3]*e[1]+t[1]*e[3]+t[0]*e[5],t[6]*e[0]+t[3]*e[2]-t[2]*e[3]+t[0]*e[6],t[7]*e[0]+t[6]*e[1]+t[5]*e[2]+t[4]*e[3]+t[3]*e[4]+t[2]*e[5]+t[1]*e[6]],D0=(e,t)=>[Dx(e,t),e[1]*t[7]+e[4]*t[5]-e[5]*t[4]+e[7]*t[1],e[2]*t[7]-e[4]*t[6]+e[6]*t[4]+e[7]*t[2],e[3]*t[7]+e[5]*t[6]-e[6]*t[5]+e[7]*t[3],e[4]*t[7]+e[7]*t[4],e[5]*t[7]+e[7]*t[5],e[6]*t[7]+e[7]*t[6],e[7]*t[7]],Dx=(e,t)=>e[0]*t[7]+e[1]*t[6]+e[2]*t[5]+e[3]*t[4]+e[4]*t[3]+e[5]*t[2]+e[6]*t[1]+e[7]*t[0],tP=(e,t)=>[t[0]*e[0]+t[2]*e[2]+t[3]*e[3]-t[6]*e[6],t[1]*e[0]+t[0]*e[1]-t[4]*e[2]+t[5]*e[3]+t[2]*e[4]-t[3]*e[5]-t[7]*e[6]-t[6]*e[7],t[2]*e[0]+t[0]*e[2]-t[6]*e[3]+t[3]*e[6],t[3]*e[0]+t[6]*e[2]+t[0]*e[3]-t[2]*e[6],t[4]*e[0]+t[7]*e[3]+t[0]*e[4]+t[3]*e[7],t[5]*e[0]+t[7]*e[2]+t[0]*e[5]+t[2]*e[7],t[6]*e[0]+t[0]*e[6],t[7]*e[0]+t[0]*e[7]],_x=e=>Math.sqrt(Math.abs(e[0]*e[0]-e[2]*e[2]-e[3]*e[3]+e[6]*e[6])),nP=e=>Math.sqrt(Math.abs(e[7]*e[7]-e[5]*e[5]-e[4]*e[4]+e[1]*e[1])),hc=e=>{let t=_x(e);if(t===0||t===1)return e;let n=e[6]<0?-1:1;return Zs(e,n/t)},rP=e=>{let t=nP(e);return t===0||t===1?e:Zs(e,1/t)},Lx=e=>typeof e=="number",Gde=uc(1,1),jde=uc(1,2),Wde=uc(1,3),Vde=uc(1,4),Yde=uc(1,5),Zde=uc(1,6),Kde=uc(1,7);S();S();var _0=(e,t,n)=>hc([0,n,e,t,0,0,0,0]),Wd=(e,t)=>hc(D0(t,e)),iP=(e,t)=>tP(e,t),aP=(e,t)=>iP(Wd(e,t),t);var oP=e=>Math.sign(e[1]);var mc=([e,t])=>[0,0,0,0,t,e,1,0],pc=e=>[e[5],e[4]],lP=e=>[0,0,0,0,Math.abs(e[4]),Math.abs(e[5]),1,0],cP=(e,t)=>hc(Px(e,t));var Rx=(e,t)=>_x(D0(e,t)),Ks=(e,t)=>Dx(e,t);S();var Ox=e=>[0,0,0,0,e[4],e[5],0,0],dP=(e,t)=>rP([0,0,0,0,t[4]-e[4],t[5]-e[5],0,0]);S();var Nx=(e,t)=>eP(Zs(e,Math.sin(t/2)),Math.cos(t/2)),hP=e=>[1,0,0,0,-(.5*e[5]),.5*e[4],0,0],mP=(e,t)=>{let n=.5*t;return[1,0,0,0,n*e[4],n*e[5],0,0]};var pP=(e,t)=>Zs(t,e),ia=(e,t)=>hc(Zs(Zs(e,t),jd(e)));S();S();var Vd=1e-4;var JK=e=>{let t=e[0],n=e[e.length-1];return t[0]===n[0]&&t[1]===n[1]},Yd=e=>JK(e)?e:[...e,e[0]],Ja=e=>e*180/Math.PI,eX=e=>e/180*Math.PI;var fP=(e,t)=>[e[0]*Math.cos(t)-e[1]*Math.sin(t),e[0]*Math.sin(t)+e[1]*Math.cos(t)],tX=e=>e[0]===0&&e[1]===0,rn=(e,t,n)=>{let r=eX(t);return!n||tX(n)?fP(e,r):fP(e.map((i,a)=>i-n[a]),r).map((i,a)=>i+n[a])};var nX=e=>[-e[0],-e[1]],$x=(e,t)=>[e[0]+t[0],e[1]+t[1]],rX=(e,t)=>ti(...e,...t);var gP=(e,t,n)=>{let r=$x(e,nX(t));return rn(r,-Ja(n))};var iX=(e,t)=>{let[n,r]=e,[[i,a],[o,s]]=t,l=n-i,c=r-a,d=o-i,u=s-a,h=l*d+c*u,m=d*d+u*u,p=-1;m!==0&&(p=h/m);let f,g;p<0?(f=i,g=a):p>1?(f=o,g=s):(f=i+p*d,g=a+p*u);let b=n-f,v=r-g;return Math.sqrt(b*b+v*v)},fc=(e,t,n=Vd)=>{let r=iX(e,t);return r===0?!0:r<n},Fx=(e,t,n=Vd)=>t.some(r=>fc(e,r,n));var aX=e=>{let[t,n,r,i]=e;return(a,o)=>Math.pow(1-a,3)*i[o]+3*a*Math.pow(1-a,2)*r[o]+3*Math.pow(a,2)*(1-a)*n[o]+t[o]*Math.pow(a,3)},oX=(e,t=10)=>{let n=aX(e),r=[n(0,0),n(0,1)],i=[],a=0,o=1/t;for(let s=0;s<t;s++)if(a+=o,a<=1){let l=[n(a,0),n(a,1)];i.push([r,l]),r=l}return i},Bx=(e,t,n=Vd)=>Fx(e,oX(t),n),EP=(e,t,n=Vd)=>t.some(r=>Bx(e,r,n)),zx=(e,t)=>{let n=e[0],r=e[1],i=!1;for(let a=0,o=t.length-1;a<t.length;o=a++){let s=t[a][0],l=t[a][1],c=t[o][0],d=t[o][1];(l>r&&d<=r||l<=r&&d>r)&&n<(c-s)*(r-l)/(d-l)+s&&(i=!i)}return i},bP=(e,t,n=Vd)=>{let r=!1,i=Yd(t);for(let a=0,o=i.length-1;a<o;a++)if(fc(e,[i[a],i[a+1]],n)){r=!0;break}return r};var sX=(e,t)=>{let{angle:n,halfWidth:r,halfHeight:i,center:a}=t,o=r,s=i,[l,c]=gP(e,a,n),d=Math.abs(l),u=Math.abs(c),h=.707,m=.707;for(let g=0;g<3;g++){let b=o*h,v=s*m,y=(o*o-s*s)*h**3/o,w=(s*s-o*o)*m**3/s,C=b-y,A=v-w,T=d-y,I=u-w,k=Math.hypot(A,C),R=Math.hypot(I,T);h=Math.min(1,Math.max(0,(T*k/R+y)/o)),m=Math.min(1,Math.max(0,(I*k/R+w)/s));let O=Math.hypot(m,h);h/=O,m/=O}let[p,f]=[o*h*Math.sign(l),s*m*Math.sign(c)];return rX([l,c],[p,f])},yP=(e,t,n=Vd)=>sX(e,t)<=n,vP=(e,t)=>{let{center:n,angle:r,halfWidth:i,halfHeight:a}=t,[o,s]=gP(e,n,r);return o/i*(o/i)+s/a*(s/a)<=1};var Pm=(e,t,n=0)=>{switch(t.type){case"polygon":return bP(e,t.data,n);case"ellipse":return yP(e,t.data,n);case"line":return fc(e,t.data,n);case"polyline":return Fx(e,t.data,n);case"curve":return Bx(e,t.data,n);case"polycurve":return EP(e,t.data,n);default:throw Error(`shape ${t} is not implemented`)}},L0=(e,t)=>{switch(t.type){case"polygon":return zx(e,t.data);case"line":return!1;case"curve":return!1;case"ellipse":return vP(e,t.data);case"polyline":{let n=Yd(t.data.flat());return zx(e,n)}case"polycurve":return!1;default:throw Error(`shape ${t} is not implemented`)}};S();S();var lX=(e,t)=>{let[n,r,i,a]=t,{x:o,y:s}=Ex({sceneX:n,sceneY:r},e),{x:l,y:c}=Ex({sceneX:i,sceneY:a},e);return l-o>e.width||c-s>e.height},cX=({scenePoint:e,viewportDimensions:t,zoom:n})=>({scrollX:t.width/2/n.value-e.x,scrollY:t.height/2/n.value-e.y}),Ux=(e,t)=>{if(e=xP(e),!e.length)return{scrollX:0,scrollY:0};let[n,r,i,a]=$r(e);lX(t,[n,r,i,a])&&([n,r,i,a]=Hx(e,Em({clientX:t.scrollX,clientY:t.scrollY},t)));let o=(n+i)/2,s=(r+a)/2;return cX({scenePoint:{x:o,y:s},viewportDimensions:{width:t.width,height:t.height},zoom:t.zoom})};S();var dX=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="line"||e==="freedraw",Eue=e=>e!=="image"&&e!=="frame"&&e!=="magicframe",uX=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line",hX=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="arrow"||e==="line",Gx=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="arrow"||e==="line"||e==="diamond"||e==="image",mX=e=>e==="arrow",jx=(e,t)=>{let n=null;for(let r=e.length-1;r>=0;--r){let i=e[r];if(!i.isDeleted&&t(i)){n=i;break}}return n};S();var pX=e=>Math.max(c7,Math.min(e,30)),xue=({viewportX:e,viewportY:t,nextZoom:n},r)=>{let i=e-r.offsetLeft,a=t-r.offsetTop,o=r.zoom.value,s=r.scrollX+(i-i/o),l=r.scrollY+(a-a/o),c=-(i-i/n),d=-(a-a/n);return{scrollX:s+c,scrollY:l+d,zoom:{value:n}}};S();var _ue={EQUAL:"Equal",MINUS:"Minus",NUM_ADD:"NumpadAdd",NUM_SUBTRACT:"NumpadSubtract",NUM_ZERO:"Numpad0",BRACKET_RIGHT:"BracketRight",BRACKET_LEFT:"BracketLeft",ONE:"Digit1",TWO:"Digit2",THREE:"Digit3",NINE:"Digit9",QUOTE:"Quote",ZERO:"Digit0",SLASH:"Slash",C:"KeyC",D:"KeyD",H:"KeyH",V:"KeyV",Z:"KeyZ",R:"KeyR",S:"KeyS"},ni={ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",BACKSPACE:"Backspace",ALT:"Alt",CTRL_OR_CMD:t0?"metaKey":"ctrlKey",DELETE:"Delete",ENTER:"Enter",ESCAPE:"Escape",QUESTION_MARK:"?",SPACE:" ",TAB:"Tab",CHEVRON_LEFT:"<",CHEVRON_RIGHT:">",PERIOD:".",COMMA:",",SUBTRACT:"-",SLASH:"/",A:"a",C:"c",D:"d",E:"e",F:"f",G:"g",H:"h",I:"i",L:"l",O:"o",P:"p",Q:"q",R:"r",S:"s",T:"t",V:"v",X:"x",Y:"y",Z:"z",K:"k",W:"w",0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9"},Lue=e=>e===ni.ARROW_LEFT||e===ni.ARROW_RIGHT||e===ni.ARROW_DOWN||e===ni.ARROW_UP,Rue=e=>e.altKey,Oue=e=>e.shiftKey,Wx=e=>e.shiftKey;var Kue=e=>!e[ni.CTRL_OR_CMD],Yx=e=>e.isBindingEnabled,bX=(e,t)=>{let n=[];return t.forEach(r=>{let i=e.getNonDeletedElement(r);i!=null&&n.push(i)}),n},Zd=(e,t,n,r)=>{let i=new Set,a=new Set;wP(e,t,n,"start",i,a,r),wP(e,n,t,"end",i,a,r);let o=Array.from(a).filter(s=>!i.has(s));bX(Go.getScene(e),o).forEach(s=>{Ce(s,{boundElements:s.boundElements?.filter(l=>l.type!=="arrow"||l.id!==e.id)})})},wP=(e,t,n,r,i,a,o)=>{if(t!=="keep")if(t!=null)(n==null||(n==="keep"?!Zx(e,t,r):r==="start"||n.id!==t.id))&&(Vx(e,t,r,o),i.add(t.id));else{let s=xX(e,r);s!=null&&a.add(s)}},Xue=(e,t)=>{e.forEach(n=>{zo(n)?Zd(n,O0(n,"start",t),O0(n,"end",t),t.scene.getNonDeletedElementsMap()):Ho(n)&&yX(n,t.scene.getNonDeletedElementsMap(),t)})},yX=(e,t,n)=>{MP(e,n).forEach(([r,i])=>Zd(r,i==="end"?"keep":e,i==="start"?"keep":e,t))},que=(e,t,n,r)=>{t.startBoundElement!=null&&Vx(e,t.startBoundElement,"start",r.scene.getNonDeletedElementsMap());let i=_m(n,r);i!=null&&!Zx(e,i,"end")&&Vx(e,i,"end",r.scene.getNonDeletedElementsMap())},Vx=(e,t,n,r)=>{Ce(e,{[n==="start"?"startBinding":"endBinding"]:{elementId:t.id,...wX(e,t,n,r)}}),et(t.boundElements||[]).has(e.id)||Ce(t,{boundElements:(t.boundElements||[]).concat({id:e.id,type:"arrow"})})},Zx=(e,t,n)=>{let r=e[n==="start"?"endBinding":"startBinding"];return vX(e,r?.elementId,t)},vX=(e,t,n)=>t===n.id&&e.points.length<3,Que=(e,t)=>{e.forEach(n=>{zo(n)&&(n.startBinding!==null&&n.endBinding!==null?Zd(n,null,null,t):Zd(n,n.startBinding?"keep":null,n.endBinding?"keep":null,t))})},xX=(e,t)=>{let n=t==="start"?"startBinding":"endBinding",r=e[n];return r==null?null:(Ce(e,{[n]:null}),r.elementId)},_m=(e,t)=>jx(t.scene.getNonDeletedElements(),r=>Ho(r,!1)&&AP(r,e,t)),wX=(e,t,n,r)=>{let i=n==="start"?-1:1,a=i===-1?0:e.points.length-1,o=a-i,s=st.getPointAtIndexGlobalCoordinates(e,a,r),l=st.getPointAtIndexGlobalCoordinates(e,o,r);return{focus:_X(t,l,s,r),gap:Math.max(1,MX(t,s,r))}},eo=(e,t,n)=>{let{newSize:r,simultaneouslyUpdated:i}=n??{},a=CX(i);Ho(e)&&N0(t,e,o=>{if(!wt(o)||o.isDeleted||!SX(o,e))return;let s={startBinding:SP(e,o.startBinding,r),endBinding:SP(e,o.endBinding,r)};if(a.has(o.id)){Ce(o,s);return}$0(t,o,(c,d)=>{c&&Ho(c)&&(d==="startBinding"||d==="endBinding")&&TX(o,d,s[d],c,t)});let l=ft(o,t);l&&!l.isDeleted&&gc(o,t,!1)})},SX=(e,t)=>e.startBinding?.elementId===t.id||e.endBinding?.elementId===t.id,CX=e=>new Set((e||[]).map(t=>t.id)),TX=(e,t,n,r,i)=>{if(n==null||n.elementId!==r.id&&e.points.length>2)return;let a=t==="startBinding"?-1:1,o=a===-1?0:e.points.length-1,s=o-a,l=st.getPointAtIndexGlobalCoordinates(e,s,i),c=LX(r,n.focus,l,i),d;if(n.gap===0)d=c;else{let u=RX(r,l,c,n.gap,i);u.length===0?d=c:d=u[0]}st.movePoints(e,[{index:o,point:st.pointFromAbsoluteCoords(e,d,i)}],{[t]:n})},SP=(e,t,n)=>{if(t==null||n==null)return t;let{gap:r,focus:i,elementId:a}=t,{width:o,height:s}=n,{width:l,height:c}=e,d=Math.max(1,Math.min(kP(e,o,s),r*(o<s?o/l:s/c)));return{elementId:a,gap:d,focus:i}},Jue=(e,t)=>{let n=new Set(e.map(({id:r})=>r));return e.flatMap(r=>zo(r,!1)?IX(r,t).filter(i=>!n.has(i.id)):Ho(r,!1)?MP(r,t).filter(i=>!n.has(i[0].id)):[])},IX=(e,t)=>[O0(e,"start",t),O0(e,"end",t)].filter(n=>n!=null),O0=(e,t,n)=>_m(IP(e,t,n.scene.getNonDeletedElementsMap()),n),IP=(e,t,n)=>{let r=t==="start"?0:-1;return Bd(st.getPointAtIndexGlobalCoordinates(e,r,n))},MP=(e,t)=>{let n=Go.getScene(e);return n.getNonDeletedElements().map(r=>{if(!zo(r,!1))return null;let i=CP(r,"start",e,n.getNonDeletedElementsMap(),t),a=CP(r,"end",e,n.getNonDeletedElementsMap(),t);return!i&&!a?null:[r,i&&a?"both":i?"start":"end",e]}).filter(r=>r!=null)},CP=(e,t,n,r,i)=>e[t==="start"?"startBinding":"endBinding"]==null&&!Zx(e,n,t)&&AP(n,IP(e,t,r),i),ehe=(e,t,n,r)=>{let i=new Set,a=new Set,o=r==="duplicatesServeAsOld";t.forEach(s=>{let{boundElements:l}=s;if(l!=null&&l.length>0&&(l.forEach(c=>{o&&!n.has(c.id)&&i.add(c.id)}),a.add(n.get(s.id))),zo(s)){if(s.startBinding!=null){let{elementId:c}=s.startBinding;o&&!n.has(c)&&a.add(c)}if(s.endBinding!=null){let{elementId:c}=s.endBinding;o&&!n.has(c)&&a.add(c)}(s.startBinding!=null||s.endBinding!=null)&&i.add(n.get(s.id))}}),e.filter(({id:s})=>i.has(s)).forEach(s=>{let{startBinding:l,endBinding:c}=s;Ce(s,{startBinding:TP(l,n),endBinding:TP(c,n)})}),e.filter(({id:s})=>a.has(s)).forEach(s=>{let{boundElements:l}=s;l!=null&&l.length>0&&Ce(s,{boundElements:l.map(c=>n.has(c.id)?{id:n.get(c.id),type:c.type}:c)})})},TP=(e,t)=>{if(e==null)return null;let{elementId:n,focus:r,gap:i}=e;return{focus:r,gap:i,elementId:t.get(n)??n}},the=(e,t)=>{let n=et(e);for(let r of t)Xs.unbindAffected(n,r,Ce),qs.unbindAffected(n,r,Ce)},Dm=(e,t,n=[])=>{if(!e)return null;let r=e.filter(i=>!t.has(i.id));return r.push(...n.map(i=>({id:i.id,type:i.type}))),r},AP=(e,{x:t,y:n},r)=>{let i=kP(e,e.width,e.height),a=r.getElementShape(e);return Pm([t,n],a,i)},kP=(e,t,n)=>{let i=(e.type==="diamond"?1/Math.sqrt(2):1)*Math.min(t,n);return Math.max(16,Math.min(.25*i,32))},MX=(e,t,n)=>{switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return AX(e,t,n);case"diamond":return kX(e,t,n);case"ellipse":return PX(e,t,n)}},AX=(e,t,n)=>{let[,r,i,a]=Kx(e,t,n);return Math.max(Ks(r,_0(0,1,-a)),Ks(r,_0(1,0,-i)))},kX=(e,t,n)=>{let[,r,i,a]=Kx(e,t,n),o=_0(a,i,-a*i);return Ks(r,o)},PX=(e,t,n)=>{let[r,i]=DX(e,t,n);return-oP(i)*Ks(r,i)},DX=(e,t,n)=>{let[,r,i,a]=Kx(e,t,n),[o,s]=pc(r),l=.707,c=.707,d=i,u=a;[0,1,2,3].forEach(p=>{let f=d*l,g=u*c,b=(d*d-u*u)*l**3/d,v=(u*u-d*d)*c**3/u,y=f-b,w=g-v,C=o-b,A=s-v,T=Math.hypot(w,y),I=Math.hypot(A,C);l=Math.min(1,Math.max(0,(C*T/I+b)/d)),c=Math.min(1,Math.max(0,(A*T/I+v)/u));let k=Math.hypot(c,l);l/=k,c/=k});let h=or(d*l,u*c),m=aP(r,h);return[r,m]},Kx=(e,t,n)=>{let r=mc(t),[i,a,o,s]=Me(e,n),l=qx(i,a,o,s),c=Nx(l,e.angle),d=ia(c,r),u=kx(d,Ox(l)),h=lP(u),m=J7(e.x,e.y),p=kx(d,m),f=(o-i)/2,g=(s-a)/2;return[p,h,f,g]},Xx=(e,t)=>{let[n,r,i,a]=Me(e,t),o=qx(n,r,i,a),s=Nx(o,e.angle),l=jd(hP(Ox(o)));return pP(s,l)},qx=(e,t,n,r)=>or((e+n)/2,(t+r)/2),_X=(e,t,n,r)=>{let i=Xx(e,r),a=ia(i,mc(t)),o=ia(i,mc(n)),s=Wd(a,o),l=e.height/e.width,c=e.width/2,d=e.height/2,u=s[2],h=s[3],m=s[1],p=Math.abs(h),f=Math.abs(u),g;switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":g=m/(c*(f+l*p));break;case"diamond":g=p<f?m/(f*c):m/(p*d);break;case"ellipse":g=m/(c*Math.sqrt(u**2+l**2*h**2));break}return g||0},LX=(e,t,n,r)=>{if(t===0){let[l,c,d,u]=Me(e,r),h=qx(l,c,d,u);return pc(h)}let i=Xx(e,r),a=ia(i,mc(n)),o=jd(i),s;switch(e.type){case"rectangle":case"image":case"text":case"diamond":case"iframe":case"embeddable":case"frame":case"magicframe":s=HX(e,t,a);break;case"ellipse":s=zX(e,t,a);break}return pc(ia(o,s))},RX=(e,t,n,r=0,i)=>{let a=Xx(e,i),o=ia(a,mc(t)),s=ia(a,mc(n)),l=Wd(o,s),c=jd(a);return OX(e,l,o,r).map(u=>pc(ia(c,u)))},OX=(e,t,n,r=0)=>{let i;switch(e.type){case"rectangle":case"image":case"text":case"diamond":case"iframe":case"embeddable":case"frame":case"magicframe":let o=PP(e);i=o.flatMap((s,l)=>{let c=[s,o[(l+1)%4]];return NX(t,$X(c,r))}).concat(o.flatMap(s=>BX(s,r,t)));break;case"ellipse":i=FX(e,r,t);break}if(i.length<2)return[];let a=i.sort((o,s)=>Rx(o,n)-Rx(s,n));return[a[0],a[a.length-1]]},PP=(e,t=1)=>{let n=t*e.width/2,r=t*e.height/2;switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return[or(n,r),or(n,-r),or(-n,-r),or(-n,r)];case"diamond":return[or(0,r),or(n,0),or(0,-r),or(-n,0)]}},NX=(e,t)=>{let[n,r]=t,i=Ks(n,e),a=Ks(r,e);return i*a>=0?[]:[cP(e,Wd(n,r))]},$X=(e,t)=>{let[n,r]=e,i=mP(dP(n,r),t);return[ia(i,n),ia(i,r)]},FX=(e,t,n)=>{let r=e.width/2+t,i=e.height/2+t,a=n[2],o=n[3],s=n[1],l=r*r*a*a+i*i*o*o,c=l-s*s;if(l===0||c<=0)return[];let d=Math.sqrt(c),u=-r*r*a*s,h=-i*i*o*s;return[or((u+r*i*o*d)/l,(h-r*i*a*d)/l),or((u-r*i*o*d)/l,(h+r*i*a*d)/l)]},BX=(e,t,n)=>{if(t===0)return Ks(n,e)===0?[e]:[];let r=n[2],i=n[3],a=n[1],[o,s]=pc(e),l=t,c=r*r+i*i,d=l*l*c-(r*o+i*s+a)**2;if(c===0||d<=0)return[];let u=Math.sqrt(d),h=o*i*i-s*r*i-r*a,m=s*r*r-o*r*i-i*a;return[or((h+i*u)/c,(m-r*u)/c),or((h-i*u)/c,(m+r*u)/c)]},zX=(e,t,n)=>{let r=Math.abs(t),i=e.width*r/2,a=e.height*r/2,o=Math.sign(t),[s,l]=pc(n),c=l===0?1e-4:l,d=s**2*a**2+c**2*i**2,u=(-s*a**2+o*c*Math.sqrt(Math.max(0,d-i**2*a**2)))/d,h=(-u*s-1)/c;h===0&&(h=(Object.is(h,-0)?-1:1)*.01);let m=-(i**2*u)/(h**2*a**2+u**2*i**2);return or(m,(-u*m-1)/h)},HX=(e,t,n)=>{let r=Math.abs(t),i=Math.sign(t),a=PP(e,r),o=0,s=null;return a.forEach(l=>{let c=i*Wd(n,l)[1];c>o&&(o=c,s=l)}),s},DP=new Set(["boundElements","frameId","containerId","startBinding","endBinding"]),N0=(e,t,n)=>{Ho(t)&&(t.boundElements?.slice()??[]).forEach(({id:i})=>{n(e.get(i),"boundElements",i)})},$0=(e,t,n)=>{if(t.frameId){let r=t.frameId;n(e.get(r),"frameId",r)}if(ar(t)){let r=t.containerId;n(e.get(r),"containerId",r)}if(pt(t)){if(t.startBinding){let r=t.startBinding.elementId;n(e.get(r),"startBinding",r)}if(t.endBinding){let r=t.endBinding.elementId;n(e.get(r),"endBinding",r)}}},Xs=class{static unbindAffected(t,n,r){n&&$0(t,n,i=>{!i||i.isDeleted||N0(t,i,(a,o,s)=>{s===n.id&&r(i,{boundElements:Dm(i.boundElements,new Set([s]))})})})}static rebindAffected=(t,n,r)=>{!n||n.isDeleted||$0(t,n,(i,a)=>{if(!i||i.isDeleted){r(n,{[a]:null});return}a!=="frameId"&&(i.boundElements?.find(o=>o.id===n.id)||(pt(n)&&r(i,{boundElements:Dm(i.boundElements,new Set,new Array(n))}),He(n)&&(i.boundElements?.find(o=>o.type==="text")?r(n,{[a]:null}):r(i,{boundElements:Dm(i.boundElements,new Set,new Array(n))}))))})}},qs=class{static unbindAffected(t,n,r){n&&N0(t,n,i=>{!i||i.isDeleted||$0(t,i,(a,o,s)=>{s===n.id&&r(i,{[o]:null})})})}static rebindAffected=(t,n,r)=>{!n||n.isDeleted||N0(t,n,(i,a,o)=>{if(!i||i.isDeleted){r(n,{boundElements:Dm(n.boundElements,new Set([o]))});return}He(i)&&((n.boundElements?.slice()??[]).reverse().find(l=>l.type==="text")?.id===i.id?i.containerId!==n.id&&r(i,{containerId:n.id}):(i.containerId!==null&&r(i,{containerId:null}),r(n,{boundElements:Dm(n.boundElements,new Set([i.id]))})))})}};S();S();var At={white:"#ffffff",black:"#000000",gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};var lhe=5,che=5,_P=4,F0=4,B0=1,oa=[0,2,4,6,8];var sa=(e,t)=>t.map(n=>At[e][n]),tt={transparent:fm,charcoal:$d,white:Us,gray:sa("gray",oa),red:sa("red",oa),pink:sa("pink",oa),grape:sa("grape",oa),violet:sa("violet",oa),blue:sa("blue",oa),cyan:sa("cyan",oa),teal:sa("teal",oa),green:sa("green",oa),yellow:sa("yellow",oa),orange:sa("orange",oa),bronze:["#f8f1ee","#eaddd7","#d2bab0","#a18072","#846358"]},LP=P7(tt,["cyan","blue","violet","grape","pink","green","teal","yellow","orange","red"]),dhe=[tt.charcoal,tt.red[F0],tt.green[F0],tt.blue[F0],tt.yellow[F0]],uhe=[tt.transparent,tt.red[B0],tt.green[B0],tt.blue[B0],tt.yellow[B0]],hhe=[tt.white,"#f8f9fa","#f5faff","#fffce8","#fdf8f6"],mhe={transparent:tt.transparent,white:tt.white,gray:tt.gray,charcoal:tt.charcoal,bronze:tt.bronze,...LP},phe={transparent:tt.transparent,white:tt.white,gray:tt.gray,charcoal:tt.charcoal,bronze:tt.bronze,...LP},RP=e=>[tt.cyan[e],tt.blue[e],tt.violet[e],tt.grape[e],tt.pink[e],tt.green[e],tt.teal[e],tt.yellow[e],tt.orange[e],tt.red[e]],fhe=(e,t,n)=>`#${((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}`;var an=class e{static rg=new ei;static cache=new WeakMap;static get=t=>e.cache.get(t);static set=(t,n)=>e.cache.set(t,n);static delete=t=>e.cache.delete(t);static destroy=()=>{e.cache=new WeakMap};static generateElementShape=(t,n)=>{let r=n?.isExporting?void 0:e.get(t);if(r!==void 0)return r;Lm.delete(t);let i=OP(t,e.rg,n||{isExporting:!1,canvasBackgroundColor:tt.white,embedsValidationStatus:null});return e.cache.set(t,i),i}};var jo={version:null,points:[],zoom:null},st=class e{elementId;selectedPointsIndices;pointerDownState;isDragging;lastUncommittedPoint;pointerOffset;startBindingElement;endBindingElement;hoverPointIndex;segmentMidPointHoveredCoords;constructor(t){this.elementId=t.id,e.normalizePoints(t),this.selectedPointsIndices=null,this.lastUncommittedPoint=null,this.isDragging=!1,this.pointerOffset={x:0,y:0},this.startBindingElement="keep",this.endBindingElement="keep",this.pointerDownState={prevSelectedPointsIndices:null,lastClickedPoint:-1,origin:null,segmentMidpoint:{value:null,index:null,added:!1}},this.hoverPointIndex=-1,this.segmentMidPointHoveredCoords=null}static POINT_HANDLE_SIZE=10;static getElement(t,n){let r=n.get(t);return r||null}static handleBoxSelection(t,n,r,i){if(!n.editingLinearElement||n.draggingElement?.type!=="selection")return!1;let{editingLinearElement:a}=n,{selectedPointsIndices:o,elementId:s}=a,l=e.getElement(s,i);if(!l)return!1;let[c,d,u,h]=Me(n.draggingElement,i),p=e.getPointsGlobalCoordinates(l,i).reduce((f,g,b)=>((g[0]>=c&&g[0]<=u&&g[1]>=d&&g[1]<=h||t.shiftKey&&o?.includes(b))&&f.push(b),f),[]);r({editingLinearElement:{...a,selectedPointsIndices:p.length?p:null}})}static handlePointDragging(t,n,r,i,a,o,s){if(!o)return!1;let{selectedPointsIndices:l,elementId:c}=o,d=e.getElement(c,s);if(!d)return!1;let u=d.points[o.pointerDownState.lastClickedPoint];if(l&&u){if(Wx(t)&&l.length===1&&d.points.length>1){let m=l[0],p=d.points[m===0?1:m-1],[f,g]=e._getShiftLockedDelta(d,s,p,[r,i],t[ni.CTRL_OR_CMD]?null:n.gridSize);e.movePoints(d,[{index:m,point:[f+p[0],g+p[1]],isDragging:m===o.pointerDownState.lastClickedPoint}])}else{let m=e.createPointAt(d,s,r-o.pointerOffset.x,i-o.pointerOffset.y,t[ni.CTRL_OR_CMD]?null:n.gridSize),p=m[0]-u[0],f=m[1]-u[1];e.movePoints(d,l.map(g=>{let b=g===o.pointerDownState.lastClickedPoint?e.createPointAt(d,s,r-o.pointerOffset.x,i-o.pointerOffset.y,t[ni.CTRL_OR_CMD]?null:n.gridSize):[d.points[g][0]+p,d.points[g][1]+f];return{index:g,point:b,isDragging:g===o.pointerDownState.lastClickedPoint}}))}if(ft(d,s)&&gc(d,s,!1),zo(d,!1)){let m=[];l[0]===0&&m.push(Bd(e.getPointGlobalCoordinates(d,d.points[0],s)));let f=l[l.length-1];f===d.points.length-1&&m.push(Bd(e.getPointGlobalCoordinates(d,d.points[f],s))),m.length&&a(d,m)}return!0}return!1}static handlePointerUp(t,n,r,i){let a=i.scene.getNonDeletedElementsMap(),{elementId:o,selectedPointsIndices:s,isDragging:l,pointerDownState:c}=n,d=e.getElement(o,a);if(!d)return n;let u={};if(l&&s){for(let h of s)if(h===0||h===d.points.length-1){to(d.points,r.zoom.value)&&e.movePoints(d,[{index:h,point:h===0?d.points[d.points.length-1]:d.points[0]}]);let m=Yx(r)?_m(Bd(e.getPointAtIndexGlobalCoordinates(d,h,a)),i):null;u[h===0?"startBindingElement":"endBindingElement"]=m}}return{...n,...u,selectedPointsIndices:l||t.shiftKey?!l&&t.shiftKey&&c.prevSelectedPointsIndices?.includes(c.lastClickedPoint)?s&&s.filter(h=>h!==c.lastClickedPoint):s:s?.includes(c.lastClickedPoint)?[c.lastClickedPoint]:s,isDragging:!1,pointerOffset:{x:0,y:0}}}static getEditorMidPoints=(t,n,r)=>{let i=ft(t,n);return!r.editingLinearElement&&t.points.length>2&&!i?[]:(jo.version===t.version&&jo.zoom===r.zoom.value||e.updateEditorMidPointsCache(t,n,r),jo.points)};static updateEditorMidPointsCache=(t,n,r)=>{let i=e.getPointsGlobalCoordinates(t,n),a=0,o=[];for(;a<i.length-1;){if(e.isSegmentTooShort(t,t.points[a],t.points[a+1],r.zoom)){o.push(null),a++;continue}let s=e.getSegmentMidPoint(t,i[a],i[a+1],a+1,n);o.push(s),a++}jo.points=o,jo.version=t.version,jo.zoom=r.zoom.value};static getSegmentMidpointHitCoords=(t,n,r,i)=>{let{elementId:a}=t,o=e.getElement(a,i);if(!o||e.getPointIndexUnderCursor(o,i,r.zoom,n.x,n.y)>=0||e.getPointsGlobalCoordinates(o,i).length>=3&&!r.editingLinearElement)return null;let c=e.POINT_HANDLE_SIZE/r.zoom.value,d=t.segmentMidPointHoveredCoords;if(d&&ti(d[0],d[1],n.x,n.y)<=c)return d;let u=0,h=e.getEditorMidPoints(o,i,r);for(;u<h.length;){if(h[u]!==null&&ti(h[u][0],h[u][1],n.x,n.y)<=c)return h[u];u++}return null};static isSegmentTooShort(t,n,r,i){let a=ti(n[0],n[1],r[0],r[1]);return t.points.length>2&&t.roundness&&(a=NP(t,r)),a*i.value<e.POINT_HANDLE_SIZE*4}static getSegmentMidPoint(t,n,r,i,a){let o=Rm(n,r);if(t.points.length>2&&t.roundness){let s=Jx(t,t.points[i]);if(s){let l=$P(t,t.points[i],.5),[c,d]=ew(s[0],s[1],s[2],s[3],l);o=e.getPointGlobalCoordinates(t,[c,d],a)}}return o}static getSegmentMidPointIndex(t,n,r,i){let a=e.getElement(t.elementId,i);if(!a)return-1;let o=e.getEditorMidPoints(a,i,n),s=0;for(;s<o.length;){if(e.arePointsEqual(r,o[s]))return s+1;s++}return-1}static handlePointerDown(t,n,r,i,a,o){let s=o.scene.getNonDeletedElementsMap(),l={didAddPoint:!1,hitElement:null,linearElementEditor:null};if(!a)return l;let{elementId:c}=a,d=e.getElement(c,s);if(!d)return l;let u=e.getSegmentMidpointHitCoords(a,i,n,s),h=null;if(u&&(h=e.getSegmentMidPointIndex(a,n,u,s)),t.altKey&&n.editingLinearElement)return a.lastUncommittedPoint==null&&(Ce(d,{points:[...d.points,e.createPointAt(d,s,i.x,i.y,t[ni.CTRL_OR_CMD]?null:n.gridSize)]}),l.didAddPoint=!0),r.shouldCaptureIncrement(),l.linearElementEditor={...a,pointerDownState:{prevSelectedPointsIndices:a.selectedPointsIndices,lastClickedPoint:-1,origin:{x:i.x,y:i.y},segmentMidpoint:{value:u,index:h,added:!1}},selectedPointsIndices:[d.points.length-1],lastUncommittedPoint:null,endBindingElement:_m(i,o)},l.didAddPoint=!0,l;let m=e.getPointIndexUnderCursor(d,s,n.zoom,i.x,i.y);if(m>=0||u)l.hitElement=d;else{let{startBindingElement:A,endBindingElement:T}=a;Yx(n)&&zo(d)&&Zd(d,A,T,s)}let[p,f,g,b]=Me(d,s),v=(p+g)/2,y=(f+b)/2,w=m>-1&&Fe(d.x+d.points[m][0],d.y+d.points[m][1],v,y,d.angle),C=m>-1||t.shiftKey?t.shiftKey||a.selectedPointsIndices?.includes(m)?GX([...a.selectedPointsIndices||[],m]):[m]:null;return l.linearElementEditor={...a,pointerDownState:{prevSelectedPointsIndices:a.selectedPointsIndices,lastClickedPoint:m,origin:{x:i.x,y:i.y},segmentMidpoint:{value:u,index:h,added:!1}},selectedPointsIndices:C,pointerOffset:w?{x:i.x-w[0],y:i.y-w[1]}:{x:0,y:0}},l}static arePointsEqual(t,n){return!t&&!n?!0:!t||!n?!1:tw(t,n)}static handlePointerMove(t,n,r,i,a){if(!i.editingLinearElement)return null;let{elementId:o,lastUncommittedPoint:s}=i.editingLinearElement,l=e.getElement(o,a);if(!l)return i.editingLinearElement;let{points:c}=l,d=c[c.length-1];if(!t.altKey)return d===s&&e.deletePoints(l,[c.length-1]),{...i.editingLinearElement,lastUncommittedPoint:null};let u;if(Wx(t)&&c.length>=2){let h=c[c.length-2],[m,p]=e._getShiftLockedDelta(l,a,h,[n,r],t[ni.CTRL_OR_CMD]?null:i.gridSize);u=[m+h[0],p+h[1]]}else u=e.createPointAt(l,a,n-i.editingLinearElement.pointerOffset.x,r-i.editingLinearElement.pointerOffset.y,t[ni.CTRL_OR_CMD]?null:i.gridSize);return d===s?e.movePoints(l,[{index:l.points.length-1,point:u}]):e.addPoints(l,i,[{point:u}]),{...i.editingLinearElement,lastUncommittedPoint:l.points[l.points.length-1]}}static getPointGlobalCoordinates(t,n,r){let[i,a,o,s]=Me(t,r),l=(i+o)/2,c=(a+s)/2,{x:d,y:u}=t;return[d,u]=Fe(d+n[0],u+n[1],l,c,t.angle),[d,u]}static getPointsGlobalCoordinates(t,n){let[r,i,a,o]=Me(t,n),s=(r+a)/2,l=(i+o)/2;return t.points.map(c=>{let{x:d,y:u}=t;return[d,u]=Fe(d+c[0],u+c[1],s,l,t.angle),[d,u]})}static getPointAtIndexGlobalCoordinates(t,n,r){let i=n<0?t.points.length+n:n,[a,o,s,l]=Me(t,r),c=(a+s)/2,d=(o+l)/2,u=t.points[i],{x:h,y:m}=t;return u?Fe(h+u[0],m+u[1],c,d,t.angle):Fe(h,m,c,d,t.angle)}static pointFromAbsoluteCoords(t,n,r){let[i,a,o,s]=Me(t,r),l=(i+o)/2,c=(a+s)/2,[d,u]=Fe(n[0],n[1],l,c,-t.angle);return[d-t.x,u-t.y]}static getPointIndexUnderCursor(t,n,r,i,a){let o=e.getPointsGlobalCoordinates(t,n),s=o.length;for(;--s>-1;){let l=o[s];if(ti(i,a,l[0],l[1])*r.value<e.POINT_HANDLE_SIZE+1)return s}return-1}static createPointAt(t,n,r,i,a){let o=Om(r,i,a),[s,l,c,d]=Me(t,n),u=(s+c)/2,h=(l+d)/2,[m,p]=Fe(o[0],o[1],u,h,-t.angle);return[m-t.x,p-t.y]}static getNormalizedPoints(t){let{points:n}=t,r=n[0][0],i=n[0][1];return{points:n.map((a,o)=>[a[0]-r,a[1]-i]),x:t.x+r,y:t.y+i}}static normalizePoints(t){Ce(t,e.getNormalizedPoints(t))}static duplicateSelectedPoints(t,n){if(!t.editingLinearElement)return!1;let{selectedPointsIndices:r,elementId:i}=t.editingLinearElement,a=e.getElement(i,n);if(!a||r===null)return!1;let{points:o}=a,s=[],l=!1,c=-1,d=o.reduce((u,h,m)=>{if(++c,u.push(h),r.includes(m)){let f=o[m+1];f||(l=!0),u.push(f?[(h[0]+f[0])/2,(h[1]+f[1])/2]:[h[0],h[1]]),s.push(c+1),++c}return u},[]);if(Ce(a,{points:d}),l){let u=a.points[a.points.length-1];e.movePoints(a,[{index:a.points.length-1,point:[u[0]+30,u[1]+30]}])}return{appState:{...t,editingLinearElement:{...t.editingLinearElement,selectedPointsIndices:s}}}}static deletePoints(t,n){let r=0,i=0;if(n.includes(0)){let s=t.points.find((l,c)=>!n.includes(c));s&&(r=s[0],i=s[1])}let o=t.points.reduce((s,l,c)=>(n.includes(c)||s.push(s.length?[l[0]-r,l[1]-i]:[0,0]),s),[]);e._updatePoints(t,o,r,i)}static addPoints(t,n,r){let o=[...t.points,...r.map(s=>s.point)];e._updatePoints(t,o,0,0)}static movePoints(t,n,r){let{points:i}=t,a=0,o=0,s=n.find(({index:c})=>c===0);s&&(a=s.point[0]+i[s.index][0],o=s.point[1]+i[s.index][1]);let l=i.map((c,d)=>{let u=n.find(h=>h.index===d);if(u){if(s)return c;let h=u.point[0]-i[u.index][0],m=u.point[1]-i[u.index][1];return[c[0]+h,c[1]+m]}return a||o?[c[0]-a,c[1]-o]:c});e._updatePoints(t,l,a,o,r)}static shouldAddMidpoint(t,n,r,i){if(!e.getElement(t.elementId,i))return!1;let{segmentMidpoint:o}=t.pointerDownState;if(o.added||o.value===null||o.index===null||t.pointerDownState.origin===null)return!1;let s=t.pointerDownState.origin,l=ti(s.x,s.y,n.x,n.y);return!(!r.editingLinearElement&&l<o7/r.zoom.value)}static addMidpoint(t,n,r,i,a){let o=e.getElement(t.elementId,a);if(!o)return;let{segmentMidpoint:s}=t.pointerDownState,l={pointerDownState:t.pointerDownState,selectedPointsIndices:t.selectedPointsIndices},c=e.createPointAt(o,a,n.x,n.y,i?r.gridSize:null),d=[...o.points.slice(0,s.index),c,...o.points.slice(s.index)];return Ce(o,{points:d}),l.pointerDownState={...t.pointerDownState,segmentMidpoint:{...t.pointerDownState.segmentMidpoint,added:!0},lastClickedPoint:s.index},l.selectedPointsIndices=[s.index],l}static _updatePoints(t,n,r,i,a){let o=Qx(t,n),s=Qx(t,t.points),l=(o[0]+o[2])/2,c=(o[1]+o[3])/2,d=(s[0]+s[2])/2,u=(s[1]+s[3])/2,h=d-l,m=u-c,p=Fe(r,i,h,m,t.angle);Ce(t,{...a,points:n,x:t.x+p[0],y:t.y+p[1]})}static _getShiftLockedDelta(t,n,r,i,a){let o=e.getPointGlobalCoordinates(t,r,n),[s,l]=Om(i[0],i[1],a),{width:c,height:d}=nw(o[0],o[1],s,l);return on([c,d],[0,0],-t.angle)}static getBoundTextElementPosition=(t,n,r)=>{let i=e.getPointsGlobalCoordinates(t,r);i.length<2&&Ce(n,{isDeleted:!0});let a=0,o=0;if(t.points.length%2===1){let s=Math.floor(t.points.length/2),l=e.getPointGlobalCoordinates(t,t.points[s],r);a=l[0]-n.width/2,o=l[1]-n.height/2}else{let s=t.points.length/2-1,l=jo.points[s];t.points.length===2&&(l=Rm(i[0],i[1])),(!l||jo.version!==t.version)&&(l=e.getSegmentMidPoint(t,i[s],i[s+1],s+1,r)),a=l[0]-n.width/2,o=l[1]-n.height/2}return{x:a,y:o}};static getMinMaxXYWithBoundText=(t,n,r,i)=>{let[a,o,s,l]=r,c=(a+s)/2,d=(o+l)/2,{x:u,y:h}=e.getBoundTextElementPosition(t,i,n),m=u+i.width,p=h+i.height,f=on([a,o],[c,d],t.angle),g=on([s,o],[c,d],t.angle),b=on([u,h],[c,d],-t.angle),v=on([m,h],[c,d],-t.angle),y=on([u,p],[c,d],-t.angle),w=on([m,p],[c,d],-t.angle);return f[0]<g[0]&&f[1]>=g[1]?(a=Math.min(a,y[0]),s=Math.max(s,Math.max(v[0],w[0])),o=Math.min(o,b[1]),l=Math.max(l,w[1])):f[0]>=g[0]&&f[1]>g[1]?(a=Math.min(a,w[0]),s=Math.max(s,Math.max(b[0],v[0])),o=Math.min(o,y[1]),l=Math.max(l,v[1])):f[0]>=g[0]?(a=Math.min(a,v[0]),s=Math.max(s,y[0]),o=Math.min(o,w[1]),l=Math.max(l,b[1])):f[1]<=g[1]&&(a=Math.min(a,Math.min(v[0],b[0])),s=Math.max(s,w[0]),o=Math.min(o,v[1]),l=Math.max(l,y[1])),[a,o,s,l,c,d]};static getElementAbsoluteCoords=(t,n,r=!1)=>{let i,a,o,s,l;if(t.points.length<2||!an.get(t)){let{minX:h,minY:m,maxX:p,maxY:f}=t.points.reduce((g,[b,v])=>(g.minY=Math.min(g.minY,v),g.minX=Math.min(g.minX,b),g.maxX=Math.max(g.maxX,b),g.maxY=Math.max(g.maxY,v),g),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});a=h+t.x,o=m+t.y,s=p+t.x,l=f+t.y}else{let h=an.generateElementShape(t,null),m=Qs(h[0]),[p,f,g,b]=Nm(m);a=p+t.x,o=f+t.y,s=g+t.x,l=b+t.y}let c=(a+s)/2,d=(o+l)/2;if(i=[a,o,s,l,c,d],!r)return i;let u=ft(t,n);return u&&(i=e.getMinMaxXYWithBoundText(t,n,[a,o,s,l],u)),i}},GX=e=>{let t=[...new Set(e.filter(n=>n!==null&&n!==-1))];return t=t.sort((n,r)=>n-r),t.length?t:null};S();var $m={},FP=(e,t)=>{let n=$m[e]||($m[e]={height:t});return n.height=t,n},BP=e=>{$m[e]&&delete $m[e]},Fhe=e=>$m[e]?.height??null;var ow=e=>k7(e).replace(/\t/g," "),sw=e=>ow(e).split(`
3
+ `),lw=(e,t,n,r=!0)=>{let i,a={x:e.x,y:e.y,text:e.text,width:e.width,height:e.height,angle:t?.angle??e.angle};a.text=e.text,t&&(i=la(t,e),a.text=Xd(e.originalText,Rn(e),i));let o=Ec(a.text,Rn(e),e.lineHeight);if(a.width=o.width,a.height=o.height,t){let s=Bm(t,e),l=la(t,e);if(!pt(t)&&o.height>s){let h=aw(o.height,t.type);Ce(t,{height:h},r),FP(t.id,h)}if(o.width>l){let h=aw(o.width,t.type);Ce(t,{width:h},r)}let c={...e,...a},{x:d,y:u}=HP(t,c,n);a.x=d,a.y=u}Ce(e,a,r)},Zhe=(e,t,n)=>{let r=et(e);t.forEach(i=>{let a=n.get(i.id),o=Wo(i);if(o){let s=n.get(o);if(s){let l=r.get(a);l&&Ce(l,{boundElements:(i.boundElements||[]).filter(d=>d.id!==s&&d.id!==o).concat({type:"text",id:s})});let c=r.get(s);c&&He(c)&&Ce(c,{containerId:l?a:null})}}})},gc=(e,t,n,r=!1)=>{if(!Wo(e))return;BP(e.id);let a=ft(e,t);if(a&&a.text){if(!e)return;let o=a.text,s=a.height,l=a.width,c=la(e,a),d=Bm(e,a),u=e.height;if(r||n!=="n"&&n!=="s"){o&&(o=Xd(a.originalText,Rn(a),c));let h=Ec(o,Rn(a),a.lineHeight);s=h.height,l=h.width}if(s>d){u=aw(s,e.type);let h=u-e.height,m=!pt(e)&&(n==="ne"||n==="nw"||n==="n")?e.y-h:e.y;Ce(e,{height:u,y:m})}Ce(a,{text:o,width:l,height:s}),pt(e)||Ce(a,HP(e,a,t))}},HP=(e,t,n)=>{if(pt(e))return st.getBoundTextElementPosition(e,t,n);let r=dw(e),i=Bm(e,t),a=la(e,t),o,s;return t.verticalAlign===Oo.TOP?s=r.y:t.verticalAlign===Oo.BOTTOM?s=r.y+(i-t.height):s=r.y+(i/2-t.height/2),t.textAlign===mx.LEFT?o=r.x:t.textAlign===mx.RIGHT?o=r.x+(a-t.width):o=r.x+(a/2-t.width/2),{x:o,y:s}},Ec=(e,t,n)=>{e=e.split(`
4
+ `).map(o=>o||" ").join(`
5
+ `);let r=parseFloat(t),i=jX(e,r,n);return{width:cw(e,t),height:i}},UP=e=>{let t=sw(e.text).length;return e.height/t/e.fontSize},Kd=(e,t)=>e*t,z0=(e,t,n)=>{let{unitsPerEm:r,ascender:i,descender:a}=zP[e]||zP[_n.Helvetica],o=t/r,s=n-o*i+o*a;return o*i+s},GP=(e,t)=>Kd(e,t)+Ln*2,rw,Fm=(e,t)=>{rw||(rw=document.createElement("canvas"));let n=rw.getContext("2d");n.font=t;let r=n.measureText(e).width;return $o()?r*10:r},cw=(e,t)=>{let n=sw(e),r=0;return n.forEach(i=>{r=Math.max(r,Fm(i,t))}),r},jX=(e,t,n)=>{let r=sw(e).length;return Kd(t,n)*r},WX=e=>{let t=e.split("-");return t.length>1&&t.forEach((n,r)=>{r!==t.length-1&&(t[r]=n+="-")}),t.join(" ").split(" ")},Xd=(e,t,n)=>{if(!Number.isFinite(n)||n<0)return e;let r=[],i=e.split(`
6
+ `),a=Fm(" ",t),o="",s=0,l=d=>{d.trim()&&r.push(d)},c=()=>{o="",s=0};return i.forEach(d=>{if(cw(d,t)<=n){r.push(d);return}let h=WX(d);c();let m=0;for(;m<h.length;){let p=Fm(h[m],t);if(p===n)l(h[m]),m++;else if(p>n){for(l(o),c();h[m].length>0;){let f=String.fromCodePoint(h[m].codePointAt(0)),g=jP.calculate(f,t);s+=g,h[m]=h[m].slice(f.length),s>=n?(l(o),o=f,s=g):o+=f}s+a>=n?(l(o),c()):o.endsWith("-")||(o+=" ",s+=a),m++}else for(;s<n&&m<h.length;){let f=h[m];if(s=Fm(o+f,t),s>n){l(o),c();break}m++;let g=!f.endsWith("-");if(o+=f,g&&(o+=" "),s+a>=n){g?r.push(o.slice(0,-1)):r.push(o),c();break}}}o.slice(-1)===" "&&(o=o.slice(0,-1),l(o))}),r.join(`
7
+ `)},jP=(()=>{let e={};return{calculate:(r,i)=>{let a=r.charCodeAt(0);if(e[i]||(e[i]=[]),!e[i][a]){let o=Fm(r,i);e[i][a]=o}return e[i][a]},getCache:r=>e[r]}})(),WP="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase(),VP=(e,t)=>{let n=VX(e);return n===0?Ec(WP.split("").join(`
8
+ `),e,t).width+Ln*2:n+Ln*2};var VX=e=>{let t=jP.getCache(e);if(!t)return 0;let n=t.filter(r=>r!==void 0);return Math.max(...n)};var Wo=e=>e?.boundElements?.length&&e?.boundElements?.filter(t=>t.type==="text")[0]?.id||null,ft=(e,t)=>{if(!e)return null;let n=Wo(e);return n&&t.get(n)||null},wr=(e,t)=>e&&e.containerId&&t.get(e.containerId)||null,Khe=(e,t,n)=>{if(!pt(e))return{x:e.x+e.width/2,y:e.y+e.height/2};let r=st.getPointsGlobalCoordinates(e,n);if(r.length%2===1){let o=Math.floor(e.points.length/2),s=st.getPointGlobalCoordinates(e,e.points[o],n);return{x:s[0],y:s[1]}}let i=e.points.length/2-1,a=st.getEditorMidPoints(e,n,t)[i];return a||(a=st.getSegmentMidPoint(e,r[i],r[i+1],i+1,n)),{x:a[0],y:a[1]}},dw=e=>{let t=Ln,n=Ln;return e.type==="ellipse"&&(t+=e.width/2*(1-Math.sqrt(2)/2),n+=e.height/2*(1-Math.sqrt(2)/2)),e.type==="diamond"&&(t+=e.width/4,n+=e.height/4),{x:e.x+t,y:e.y+n}},Xhe=(e,t)=>!t||pt(t)?e.angle:t.angle;var qhe=(e,t)=>e.some(n=>{if(ar(n)){let r=wr(n,t);return!pt(r)}return!1}),Qhe=(e,t)=>e.some(n=>{if(ar(n)){let r=wr(n,t);return!pt(r)}return He(n)}),YX=new Set(["rectangle","ellipse","diamond","arrow"]),Jhe=e=>YX.has(e.type),aw=(e,t)=>{e=Math.ceil(e);let n=Ln*2;return t==="ellipse"?Math.round((e+n)/Math.sqrt(2)*2):t==="arrow"?e+n*8:t==="diamond"?2*(e+n):e+n},la=(e,t)=>{let{width:n}=e;if(pt(e)){let r=(t?.fontSize??Za)*m7;return Math.max(h7*n,r)}return e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-Ln*2:e.type==="diamond"?Math.round(n/2)-Ln*2:n-Ln*2},Bm=(e,t)=>{let{height:n}=e;return pt(e)?n-Ln*8*2<=0?t.height:n:e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-Ln*2:e.type==="diamond"?Math.round(n/2)-Ln*2:n-Ln*2},eme=()=>cw(WP,Rn({fontSize:Za,fontFamily:ea}))>0,iw={[_n.Virgil]:1.25,[_n.Helvetica]:1.15,[_n.Cascadia]:1.2},zP={[_n.Virgil]:{unitsPerEm:1e3,ascender:886,descender:-374},[_n.Helvetica]:{unitsPerEm:2048,ascender:1577,descender:-471},[_n.Cascadia]:{unitsPerEm:2048,ascender:1977,descender:-480},[_n.Assistant]:{unitsPerEm:1e3,ascender:1021,descender:-287}},H0=e=>e in iw?iw[e]:iw[ea];var uw="invert(100%) hue-rotate(180deg) saturate(1.25)",ZX=Gs(),qP=(e,t)=>qa(e)&&!t.imageCache.has(e.fileId),QP=(e,t,n)=>n.theme===qr.DARK&&qa(e)&&!qP(e,t)&&t.imageCache.get(e.fileId)?.mimeType!==Te.svg,G0=e=>e.type==="freedraw"?e.strokeWidth*12:20,KX=(e,t,n)=>{let r=(t?.opacity??100)*e.opacity/1e4;return(n.has(e.id)||t&&n.has(t.id))&&(r*=p7/100),r},XX=(e,t,n)=>{let a=G0(e),[o,s,l,c]=Me(e,t),d=wt(e)||On(e)?Ii(o,l):e.width,u=wt(e)||On(e)?Ii(s,c):e.height,h=d*window.devicePixelRatio+a*2,m=u*window.devicePixelRatio+a*2,p=n.value;return(h*p>32767||m*p>32767)&&(p=Math.min(32767/h,32767/m)),h*m*p*p>16777216&&(p=Math.sqrt(16777216/(h*m))),h=Math.floor(h*p),m=Math.floor(m*p),{width:h,height:m,scale:p}},qX=(e,t,n,r,i)=>{let a=document.createElement("canvas"),o=a.getContext("2d"),s=G0(e),{width:l,height:c,scale:d}=XX(e,t,n);a.width=l,a.height=c;let u=0,h=0;if(wt(e)||On(e)){let[p,f]=Me(e,t);u=e.x>p?Ii(e.x,p)*window.devicePixelRatio*d:0,h=e.y>f?Ii(e.y,f)*window.devicePixelRatio*d:0,o.translate(u,h)}o.save(),o.translate(s*d,s*d),o.scale(window.devicePixelRatio*d,window.devicePixelRatio*d);let m=nn.canvas(a);return QP(e,r,i)&&(o.filter=uw),U0(e,m,o,r,i),o.restore(),{element:e,canvas:a,theme:i.theme,scale:d,zoomValue:n.value,canvasOffsetX:u,canvasOffsetY:h,boundTextElementVersion:ft(e,t)?.version||null,containingFrameOpacity:Fr(e,t)?.opacity||100}},JP=14,eD=document.createElement("img");eD.src=`data:${Te.svg},${encodeURIComponent('<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="image" class="svg-inline--fa fa-image fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#888" d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"></path></svg>')}`;var tD=document.createElement("img");tD.src=`data:${Te.svg},${encodeURIComponent('<svg viewBox="0 0 668 668" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48ZM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56ZM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.81709 0 0 .81709 124.825 145.825)"/><path d="M256 8C119.034 8 8 119.033 8 256c0 136.967 111.034 248 248 248s248-111.034 248-248S392.967 8 256 8Zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676ZM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.30366 0 0 .30366 506.822 60.065)"/></svg>')}`;var QX=(e,t,n)=>{t.fillStyle="#E7E7E7",t.fillRect(0,0,e.width,e.height);let r=Math.min(e.width,e.height),i=Math.min(r,Math.min(r*.4,100));t.drawImage(e.status==="error"?tD:eD,e.width/2-i/2,e.height/2-i/2,i,i)},U0=(e,t,n,r,i)=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":{n.lineJoin="round",n.lineCap="round",t.draw(an.get(e));break}case"arrow":case"line":{n.lineJoin="round",n.lineCap="round",an.get(e).forEach(a=>{t.draw(a)});break}case"freedraw":{n.save(),n.fillStyle=e.strokeColor;let a=JX(e),o=an.get(e);o&&t.draw(o),n.fillStyle=e.strokeColor,n.fill(a),n.restore();break}case"image":{let a=qa(e)?r.imageCache.get(e.fileId)?.image:void 0;a!=null&&!(a instanceof Promise)?(e.roundness&&n.roundRect&&(n.beginPath(),n.roundRect(0,0,e.width,e.height,Vo(Math.min(e.width,e.height),e)),n.clip()),n.drawImage(a,0,0,e.width,e.height)):QX(e,n,i.zoom.value);break}default:if(He(e)){let a=u0(e.text),o=a&&!n.canvas.isConnected;o&&document.body.appendChild(n.canvas),n.canvas.setAttribute("dir",a?"rtl":"ltr"),n.save(),n.font=Rn(e),n.fillStyle=e.strokeColor,n.textAlign=e.textAlign;let s=e.text.replace(/\r\n?/g,`
9
+ `).split(`
10
+ `),l=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,c=Kd(e.fontSize,e.lineHeight),d=z0(e.fontFamily,e.fontSize,c);for(let u=0;u<s.length;u++)n.fillText(s[u],l,u*c+d);n.restore(),o&&n.canvas.remove()}else throw new Error(`Unimplemented type ${e.type}`)}},Lm=new WeakMap,gme=()=>{Lm=new WeakMap,hw=new WeakMap},YP=(e,t,n,r)=>{let i=n?r.zoom:ZX.zoom,a=Lm.get(e),o=a&&a.zoomValue!==i.value&&!r?.shouldCacheIgnoreZoom,s=ft(e,t)?.version||null,l=Fr(e,t)?.opacity||100;if(!a||o||a.theme!==r.theme||a.boundTextElementVersion!==s||a.containingFrameOpacity!==l){let c=qX(e,t,i,n,r);return Lm.set(e,c),c}return a},ZP=(e,t,n,r,i)=>{let a=e.element,o=G0(a),s=e.scale,[l,c,d,u]=Me(a,i);On(a)&&(l=Math.floor(l),d=Math.ceil(d),c=Math.floor(c),u=Math.ceil(u));let h=((l+d)/2+r.scrollX)*window.devicePixelRatio,m=((c+u)/2+r.scrollY)*window.devicePixelRatio;t.save(),t.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);let p=ft(a,i);if(pt(a)&&p){let f=document.createElement("canvas"),g=f.getContext("2d"),b=Math.max(Ii(l,d),Ii(c,u));f.width=b*window.devicePixelRatio*s+o*e.scale*10,f.height=b*window.devicePixelRatio*s+o*e.scale*10;let v=(f.width-e.canvas.width)/2,y=(f.height-e.canvas.height)/2;g.translate(f.width/2,f.height/2),g.rotate(a.angle),g.drawImage(e.canvas,-e.canvas.width/2,-e.canvas.height/2,e.canvas.width,e.canvas.height);let[,,,,w,C]=Me(p,i);g.rotate(-a.angle);let A=f.width/2-(w-l)*window.devicePixelRatio*s-v-o*s,T=f.height/2-(C-c)*window.devicePixelRatio*s-y-o*s;g.translate(-A,-T),g.clearRect(-(p.width/2+Ln)*window.devicePixelRatio*s,-(p.height/2+Ln)*window.devicePixelRatio*s,(p.width+Ln*2)*window.devicePixelRatio*s,(p.height+Ln*2)*window.devicePixelRatio*s),t.translate(h,m),t.drawImage(f,-(d-l)/2*window.devicePixelRatio-v/s-o,-(u-c)/2*window.devicePixelRatio-y/s-o,f.width/s,f.height/s)}else if(t.translate(h,m),t.rotate(a.angle),"scale"in e.element&&!qP(a,n)&&t.scale(e.element.scale[0],e.element.scale[1]),t.translate(-h,-m),t.drawImage(e.canvas,(l+r.scrollX)*window.devicePixelRatio-o*e.scale/e.scale,(c+r.scrollY)*window.devicePixelRatio-o*e.scale/e.scale,e.canvas.width/e.scale,e.canvas.height/e.scale),L.VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX==="true"&&zd(a)){let f=ft(a,i),g=dw(a);t.strokeStyle="#c92a2a",t.lineWidth=3,t.strokeRect((g.x+r.scrollX)*window.devicePixelRatio,(g.y+r.scrollY)*window.devicePixelRatio,la(a,f)*window.devicePixelRatio,Bm(a,f)*window.devicePixelRatio)}t.restore()},Eme=(e,t,n)=>{t.save(),t.translate(e.x+n.scrollX,e.y+n.scrollY),t.fillStyle="rgba(0, 0, 200, 0.04)";let r=.5/n.zoom.value;t.fillRect(r,r,e.width,e.height),t.lineWidth=1/n.zoom.value,t.strokeStyle=" rgb(105, 101, 219)",t.strokeRect(r,r,e.width,e.height),t.restore()},qd=(e,t,n,r,i,a,o)=>{switch(i.globalAlpha=KX(e,Fr(e,t),a.elementsPendingErasure),e.type){case"magicframe":case"frame":{o.frameRendering.enabled&&o.frameRendering.outline&&(i.save(),i.translate(e.x+o.scrollX,e.y+o.scrollY),i.fillStyle="rgba(0, 0, 200, 0.04)",i.lineWidth=jn.strokeWidth/o.zoom.value,i.strokeStyle=jn.strokeColor,D7(e)&&(i.strokeStyle=o.theme===qr.LIGHT?"#7affd7":"#1d8264"),jn.radius&&i.roundRect?(i.beginPath(),i.roundRect(0,0,e.width,e.height,jn.radius/o.zoom.value),i.stroke(),i.closePath()):i.strokeRect(0,0,e.width,e.height),i.restore());break}case"freedraw":{if(an.generateElementShape(e,null),a.isExporting){let[s,l,c,d]=Me(e,t),u=(s+c)/2+o.scrollX,h=(l+d)/2+o.scrollY,m=(c-s)/2-(e.x-s),p=(d-l)/2-(e.y-l);i.save(),i.translate(u,h),i.rotate(e.angle),i.translate(-m,-p),U0(e,r,i,a,o),i.restore()}else{let s=YP(e,t,a,o);ZP(s,i,a,o,n)}break}case"rectangle":case"diamond":case"ellipse":case"line":case"arrow":case"image":case"text":case"iframe":case"embeddable":{if(an.generateElementShape(e,a),a.isExporting){let[s,l,c,d]=Me(e,t),u=(s+c)/2+o.scrollX,h=(l+d)/2+o.scrollY,m=(c-s)/2-(e.x-s),p=(d-l)/2-(e.y-l);if(He(e)){let g=wr(e,t);if(pt(g)){let b=st.getBoundTextElementPosition(g,e,t);m=(c-s)/2-(b.x-s),p=(d-l)/2-(b.y-l)}}i.save(),i.translate(u,h),QP(e,a,o)&&(i.filter="none");let f=ft(e,t);if(pt(e)&&f){let g=document.createElement("canvas"),b=g.getContext("2d"),v=Math.max(Ii(s,c),Ii(l,d)),y=G0(e);g.width=v*o.exportScale+y*10*o.exportScale,g.height=v*o.exportScale+y*10*o.exportScale,b.translate(g.width/2,g.height/2),b.scale(o.exportScale,o.exportScale),m=e.width/2-(e.x-s),p=e.height/2-(e.y-l),b.rotate(e.angle);let w=nn.canvas(g);b.translate(-m,-p),U0(e,w,b,a,o),b.translate(m,p),b.rotate(-e.angle);let[,,,,C,A]=Me(f,t),T=(s+c)/2-C,I=(l+d)/2-A;b.translate(-T,-I),b.clearRect(-f.width/2,-f.height/2,f.width,f.height),i.scale(1/o.exportScale,1/o.exportScale),i.drawImage(g,-g.width/2,-g.height/2,g.width,g.height)}else i.rotate(e.angle),e.type==="image"&&i.scale(e.scale[0],e.scale[1]),i.translate(-m,-p),U0(e,r,i,a,o);i.restore()}else{let s=YP(e,t,a,o),l=i.imageSmoothingEnabled;!o?.shouldCacheIgnoreZoom&&(!e.angle||XP(e.angle))&&(i.imageSmoothingEnabled=!1),ZP(s,i,a,o,n),i.imageSmoothingEnabled=l}break}default:throw new Error(`Unimplemented type ${e.type}`)}i.globalAlpha=1},hw=new WeakMap([]);function nD(e){let t=mw(e),n=new Path2D(t);return hw.set(e,n),n}function JX(e){return hw.get(e)}function mw(e){let t=e.simulatePressure?e.points:e.points.length?e.points.map(([r,i],a)=>[r,i,e.pressures[a]]):[[0,0,.5]],n={simulatePressure:e.simulatePressure,size:e.strokeWidth*4.25,thinning:.6,smoothing:.5,streamline:.5,easing:r=>Math.sin(r*Math.PI/2),last:!!e.lastCommittedPoint};return tq(P0(t,n))}function KP(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}var eq=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g;function tq(e){if(!e.length)return"";let t=e.length-1;return e.reduce((n,r,i,a)=>(i===t?n.push(r,KP(r,a[0]),"L",a[0],"Z"):n.push(r,KP(r,a[i+1])),n),["M",e[0],"Q"]).join(" ").replace(eq,"$1")}S();function nq(e,t){return Math.sqrt(j0(e,t))}function j0(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function rq(e,t,n){let r=j0(t,n);if(r===0)return j0(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),j0(e,bc(t,n,i))}function bc(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function iq(e,t){let n=e[t+0],r=e[t+1],i=e[t+2],a=e[t+3],o=3*r[0]-2*n[0]-a[0];o*=o;let s=3*r[1]-2*n[1]-a[1];s*=s;let l=3*i[0]-2*a[0]-n[0];l*=l;let c=3*i[1]-2*a[1]-n[1];return c*=c,o<l&&(o=l),s<c&&(s=c),o+s}function pw(e,t,n,r){let i=r||[];if(iq(e,t)<n){let a=e[t+0];i.length?nq(i[i.length-1],a)>1&&i.push(a):i.push(a),i.push(e[t+3])}else{let o=e[t+0],s=e[t+1],l=e[t+2],c=e[t+3],d=bc(o,s,.5),u=bc(s,l,.5),h=bc(l,c,.5),m=bc(d,u,.5),p=bc(u,h,.5),f=bc(m,p,.5);pw([o,d,m,f],0,n,i),pw([f,p,h,c],0,n,i)}return i}function V0(e,t){return W0(e,0,e.length,t)}function W0(e,t,n,r,i){let a=i||[],o=e[t],s=e[n-1],l=0,c=1;for(let d=t+1;d<n-1;++d){let u=rq(e[d],o,s);u>l&&(l=u,c=d)}return Math.sqrt(l)>r?(W0(e,t,c+1,r,a),W0(e,c,n,r,a)):(a.length||a.push(o),a.push(s)),a}function rD(e,t=.15,n){let r=[],i=(e.length-1)/3;for(let a=0;a<i;a++){let o=a*3;pw(e,o,t,r)}return n&&n>0?W0(r,0,r.length,n):r}var aq=e=>[8,8+e],oD=e=>[1.5,6+e];function oq(e){let t=e.roughness,n=Math.max(e.width,e.height),r=Math.min(e.width,e.height);return r>=20&&n>=50||r>=15&&e.roundness&&Gx(e.type)||wt(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}var ri=(e,t=!1)=>{let n={seed:e.seed,strokeLineDash:e.strokeStyle==="dashed"?aq(e.strokeWidth):e.strokeStyle==="dotted"?oD(e.strokeWidth):void 0,disableMultiStroke:e.strokeStyle!=="solid",strokeWidth:e.strokeStyle!=="solid"?e.strokeWidth+.5:e.strokeWidth,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,roughness:oq(e),stroke:e.strokeColor,preserveVertices:t||e.roughness<px.cartoonist};switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":return n.fillStyle=e.fillStyle,n.fill=js(e.backgroundColor)?void 0:e.backgroundColor,e.type==="ellipse"&&(n.curveFitting=1),n;case"line":case"freedraw":return to(e.points)&&(n.fillStyle=e.fillStyle,n.fill=e.backgroundColor==="transparent"?void 0:e.backgroundColor),n;case"arrow":return n;default:throw new Error(`Unimplemented type ${e.type}`)}},iD=(e,t,n)=>ta(e)&&(t||p0(e)&&n?.get(e.id)!==!0)&&js(e.backgroundColor)&&js(e.strokeColor)?{...e,roughness:0,backgroundColor:"#d3d3d3",fillStyle:"solid"}:bm(e)?{...e,strokeColor:js(e.strokeColor)?"#000000":e.strokeColor,backgroundColor:js(e.backgroundColor)?"#f4f4f6":e.backgroundColor}:e,aD=(e,t,n,r,i,a,o)=>{o=o||"transparent";let s=gw(e,t,n,r);if(s===null)return[];switch(r){case"dot":case"circle":case"circle_outline":{let[l,c,d]=s;return delete a.strokeLineDash,[i.circle(l,c,d,{...a,fill:r==="circle_outline"?o:e.strokeColor,fillStyle:"solid",stroke:e.strokeColor,roughness:Math.min(.5,a.roughness||0)})]}case"triangle":case"triangle_outline":{let[l,c,d,u,h,m]=s;return delete a.strokeLineDash,[i.polygon([[l,c],[d,u],[h,m],[l,c]],{...a,fill:r==="triangle_outline"?o:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,a.roughness||0)})]}case"diamond":case"diamond_outline":{let[l,c,d,u,h,m,p,f]=s;return delete a.strokeLineDash,[i.polygon([[l,c],[d,u],[h,m],[p,f],[l,c]],{...a,fill:r==="diamond_outline"?o:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,a.roughness||0)})]}case"bar":case"arrow":default:{let[l,c,d,u,h,m]=s;if(e.strokeStyle==="dotted"){let p=oD(e.strokeWidth-1);a.strokeLineDash=[p[0],p[1]-1]}else delete a.strokeLineDash;return a.roughness=Math.min(1,a.roughness||0),[i.line(d,u,l,c,a),i.line(h,m,l,c,a)]}}},OP=(e,t,{isExporting:n,canvasBackgroundColor:r,embedsValidationStatus:i})=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":{let a;if(e.roundness){let o=e.width,s=e.height,l=Vo(Math.min(o,s),e);a=t.path(`M ${l} 0 L ${o-l} 0 Q ${o} 0, ${o} ${l} L ${o} ${s-l} Q ${o} ${s}, ${o-l} ${s} L ${l} ${s} Q 0 ${s}, 0 ${s-l} L 0 ${l} Q 0 0, ${l} 0`,ri(iD(e,n,i),!0))}else a=t.rectangle(0,0,e.width,e.height,ri(iD(e,n,i),!1));return a}case"diamond":{let a,[o,s,l,c,d,u,h,m]=fw(e);if(e.roundness){let p=Vo(Math.abs(o-h),e),f=Vo(Math.abs(c-s),e);a=t.path(`M ${o+p} ${s+f} L ${l-p} ${c-f}
11
+ C ${l} ${c}, ${l} ${c}, ${l-p} ${c+f}
12
+ L ${d+p} ${u-f}
13
+ C ${d} ${u}, ${d} ${u}, ${d-p} ${u-f}
14
+ L ${h+p} ${m+f}
15
+ C ${h} ${m}, ${h} ${m}, ${h+p} ${m-f}
16
+ L ${o-p} ${s+f}
17
+ C ${o} ${s}, ${o} ${s}, ${o+p} ${s+f}`,ri(e,!0))}else a=t.polygon([[o,s],[l,c],[d,u],[h,m]],ri(e));return a}case"ellipse":return t.ellipse(e.width/2,e.height/2,e.width,e.height,ri(e));case"line":case"arrow":{let a,o=ri(e),s=e.points.length?e.points:[[0,0]];if(e.roundness?a=[t.curve(s,o)]:o.fill?a=[t.polygon(s,o)]:a=[t.linearPath(s,o)],e.type==="arrow"){let{startArrowhead:l=null,endArrowhead:c="arrow"}=e;if(l!==null){let d=aD(e,a,"start",l,t,o,r);a.push(...d)}if(c!==null){let d=aD(e,a,"end",c,t,o,r);a.push(...d)}}return a}case"freedraw":{let a;if(nD(e),to(e.points)){let o=V0(e.points,.75);a=t.curve(o,{...ri(e),stroke:"none"})}else a=null;return a}case"frame":case"magicframe":case"text":case"image":return null;default:return lc(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}};S();var sD=e=>{let t=e.map(r=>r[0]),n=e.map(r=>r[1]);return{width:Math.max(...t)-Math.min(...t),height:Math.max(...n)-Math.min(...n)}},Js=(e,t,n,r)=>{let i=n.map(m=>m[e]),a=Math.max(...i),o=Math.min(...i),s=a-o,l=s===0?1:t/s,c=1/0,d=n.map(m=>{let p=m[e]*l,f=[...m];return f[e]=p,p<c&&(c=p),f});if(!r||d.length===2)return d;let u=o-c;return d.map(m=>m.map((p,f)=>f===e?p+u:p))};var Ew=class e{static boundsCache=new WeakMap;static getBounds(t,n){let r=e.boundsCache.get(t);if(r?.version&&r.version===t.version&&!ar(t))return r.bounds;let i=e.calculateBounds(t,n);return e.boundsCache.set(t,{version:t.version,bounds:i}),i}static calculateBounds(t,n){let r,[i,a,o,s,l,c]=Me(t,n);if(On(t)){let[d,u,h,m]=yw(t.points.map(([p,f])=>Fe(p,f,l-t.x,c-t.y,t.angle)));return[d+t.x,u+t.y,h+t.x,m+t.y]}else if(wt(t))r=hq(t,l,c,n);else if(t.type==="diamond"){let[d,u]=Fe(l,a,l,c,t.angle),[h,m]=Fe(l,s,l,c,t.angle),[p,f]=Fe(i,c,l,c,t.angle),[g,b]=Fe(o,c,l,c,t.angle),v=Math.min(d,h,p,g),y=Math.min(u,m,f,b),w=Math.max(d,h,p,g),C=Math.max(u,m,f,b);r=[v,y,w,C]}else if(t.type==="ellipse"){let d=(o-i)/2,u=(s-a)/2,h=Math.cos(t.angle),m=Math.sin(t.angle),p=Math.hypot(d*h,u*m),f=Math.hypot(u*h,d*m);r=[l-p,c-f,l+p,c+f]}else{let[d,u]=Fe(i,a,l,c,t.angle),[h,m]=Fe(i,s,l,c,t.angle),[p,f]=Fe(o,s,l,c,t.angle),[g,b]=Fe(o,a,l,c,t.angle),v=Math.min(d,h,p,g),y=Math.min(u,m,f,b),w=Math.max(d,h,p,g),C=Math.max(u,m,f,b);r=[v,y,w,C]}return r}},Me=(e,t,n=!1)=>{if(On(e))return lq(e);if(wt(e))return st.getElementAbsoluteCoords(e,t,n);if(He(e)){let r=t?wr(e,t):null;if(pt(r)){let i=st.getBoundTextElementPosition(r,e,t);return[i.x,i.y,i.x+e.width,i.y+e.height,i.x+e.width/2,i.y+e.height/2]}}return[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2]},bw=(e,t)=>{let[n,r,i,a,o,s]=Me(e,t),l=[o,s];if(wt(e)||On(e)){let b=[],v=0;for(;v<e.points.length-1;)b.push([on([e.points[v][0]+e.x,e.points[v][1]+e.y],l,e.angle),on([e.points[v+1][0]+e.x,e.points[v+1][1]+e.y],l,e.angle)]),v++;return b}let[c,d,u,h,m,p,f,g]=[[n,r],[i,r],[n,a],[i,a],[o,r],[o,a],[n,s],[i,s]].map(b=>on(b,l,e.angle));return e.type==="diamond"?[[m,f],[m,g],[p,f],[p,g]]:e.type==="ellipse"?[[m,f],[m,g],[p,f],[p,g],[m,f],[m,g],[p,f],[p,g]]:[[c,d],[u,h],[c,u],[d,h],[c,g],[u,g],[d,f],[h,f]]};var fw=e=>{let t=Math.floor(e.width/2)+1,n=0,r=e.width,i=Math.floor(e.height/2)+1,a=t,o=e.height;return[t,n,r,i,a,o,0,i]},Qs=e=>{for(let t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},lD=(e,t,n,r,i)=>{let a=1-e;return Math.pow(a,3)*t+3*Math.pow(a,2)*e*n+3*a*Math.pow(e,2)*r+Math.pow(e,3)*i},cD=(e,t,n,r)=>{let i=t-e,a=n-t,o=r-n,s=3*i-6*a+3*o,l=6*a-6*i,c=3*i,d=l*l-4*s*c;if(!(d>=0))return!1;let h=null,m=null,p=1/0,f=1/0;return s===0?p=f=-c/l:(p=(-l+Math.sqrt(d))/(2*s),f=(-l-Math.sqrt(d))/(2*s)),p>=0&&p<=1&&(h=lD(p,e,t,n,r)),f>=0&&f<=1&&(m=lD(f,e,t,n,r)),[h,m]},sq=(e,t,n,r)=>{let i=cD(e[0],t[0],n[0],r[0]),a=cD(e[1],t[1],n[1],r[1]),o=Math.min(e[0],r[0]),s=Math.max(e[0],r[0]);if(i){let d=i.filter(u=>u!==null);o=Math.min(o,...d),s=Math.max(s,...d)}let l=Math.min(e[1],r[1]),c=Math.max(e[1],r[1]);if(a){let d=a.filter(u=>u!==null);l=Math.min(l,...d),c=Math.max(c,...d)}return[o,l,s,c]},Nm=(e,t)=>{let n=[0,0],{minX:r,minY:i,maxX:a,maxY:o}=e.reduce((s,{op:l,data:c})=>{if(l==="move")n=c;else if(l==="bcurveTo"){let d=[c[0],c[1]],u=[c[2],c[3]],h=[c[4],c[5]],m=t?t(...d):d,p=t?t(...u):u,f=t?t(...h):h,g=t?t(...n):n;n=h;let[b,v,y,w]=sq(g,m,p,f);s.minX=Math.min(s.minX,b),s.minY=Math.min(s.minY,v),s.maxX=Math.max(s.maxX,y),s.maxY=Math.max(s.maxY,w)}return s},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[r,i,a,o]},yw=e=>{let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let[a,o]of e)t=Math.min(t,a),n=Math.min(n,o),r=Math.max(r,a),i=Math.max(i,o);return[t,n,r,i]},lq=e=>{let[t,n,r,i]=yw(e.points),a=t+e.x,o=n+e.y,s=r+e.x,l=i+e.y;return[a,o,s,l,(a+s)/2,(o+l)/2]},cq=e=>{switch(e){case"arrow":return 25;case"diamond":case"diamond_outline":return 12;default:return 15}},dq=e=>{switch(e){case"bar":return 90;case"arrow":return 20;default:return 25}},gw=(e,t,n,r)=>{let i=Qs(t[0]);if(i.length<1)return null;let a=n==="start"?1:i.length-1,o=i[a].data,s=[o[4],o[5]],l=[o[2],o[3]],c=[o[0],o[1]],d=i[a-1],u=[0,0];d.op==="move"?u=d.data:d.op==="bcurveTo"&&(u=[d.data[4],d.data[5]]);let h=(j,q)=>Math.pow(1-j,3)*s[q]+3*j*Math.pow(1-j,2)*l[q]+3*Math.pow(j,2)*(1-j)*c[q]+u[q]*Math.pow(j,3),[m,p]=n==="start"?u:s,[f,g]=[h(.3,0),h(.3,1)],b=Math.hypot(m-f,p-g),v=(m-f)/b,y=(p-g)/b,w=cq(r),C=0;{let[j,q]=n==="end"?e.points[e.points.length-1]:e.points[0],[ne,H]=e.points.length>1?n==="end"?e.points[e.points.length-2]:e.points[1]:[0,0];C=Math.hypot(j-ne,q-H)}let T=Math.min(w,C*(r==="diamond"||r==="diamond_outline"?.25:.5)),I=m-v*T,k=p-y*T;if(r==="dot"||r==="circle"||r==="circle_outline"){let j=Math.hypot(k-p,I-m)+e.strokeWidth-2;return[m,p,j]}let R=dq(r),[O,P]=Fe(I,k,m,p,-R*Math.PI/180),[F,Y]=Fe(I,k,m,p,R*Math.PI/180);if(r==="diamond"||r==="diamond_outline"){let j,q;if(n==="start"){let[ne,H]=e.points.length>1?e.points[1]:[0,0];[j,q]=Fe(m+T*2,p,m,p,Math.atan2(H-p,ne-m))}else{let[ne,H]=e.points.length>1?e.points[e.points.length-2]:[0,0];[j,q]=Fe(m-T*2,p,m,p,Math.atan2(p-H,m-ne))}return[m,p,O,P,j,q,F,Y]}return[m,p,O,P,F,Y]},uq=e=>{let t=nn.generator(),n=ri(e),r=e.roundness?"curve":n.fill?"polygon":"linearPath";return t[r](e.points,n)},hq=(e,t,n,r)=>{let i=ft(e,r);if(e.points.length<2){let[u,h]=e.points[0],[m,p]=Fe(e.x+u,e.y+h,t,n,e.angle),f=[m,p,m,p];if(i){let g=st.getMinMaxXYWithBoundText(e,r,[m,p,m,p],i);f=[g[0],g[1],g[2],g[3]]}return f}let o=an.get(e)?.[0]??uq(e),s=Qs(o),c=Nm(s,(u,h)=>Fe(e.x+u,e.y+h,t,n,e.angle)),d=[c[0],c[1],c[2],c[3]];if(i){let u=st.getMinMaxXYWithBoundText(e,r,d,i);d=[u[0],u[1],u[2],u[3]]}return d},ii=(e,t)=>Ew.getBounds(e,t),$r=e=>{if(!e.length)return[0,0,0,0];let t=1/0,n=-1/0,r=1/0,i=-1/0,a=et(e);return e.forEach(o=>{let[s,l,c,d]=ii(o,a);t=Math.min(t,s),r=Math.min(r,l),n=Math.max(n,c),i=Math.max(i,d)}),[t,r,n,i]},Gme=(e,t)=>{let[n,r,i,a]=$r(e);return[n+t.x,r+t.y,i+t.x,a+t.y]},Qd=(e,t,n,r)=>{if(!(wt(e)||On(e)))return[e.x,e.y,e.x+t,e.y+n];let i=Js(0,t,Js(1,n,e.points,r),r),a;if(On(e))a=yw(i);else{let d=nn.generator(),u=e.roundness?d.curve(i,ri(e)):d.linearPath(i,ri(e)),h=Qs(u);a=Nm(h)}let[o,s,l,c]=a;return[o+e.x,s+e.y,l+e.x,c+e.y]},Qx=(e,t)=>{let n=nn.generator(),r=e.roundness==null?n.linearPath(t,ri(e)):n.curve(t,ri(e)),i=Qs(r),[a,o,s,l]=Nm(i);return[a+e.x,o+e.y,s+e.x,l+e.y]},Hx=(e,t)=>{if(!e.length)return[0,0,0,0];let n=1/0,r=e[0],i=et(e);return e.forEach(a=>{let[o,s,l,c]=ii(a,i),d=ti((o+l)/2,(s+c)/2,t.x,t.y);d<n&&(n=d,r=a)}),ii(r,i)},dD=e=>{let[t,n,r,i]=$r(e);return{minX:t,minY:n,maxX:r,maxY:i,width:r-t,height:i-n,midX:(t+r)/2,midY:(n+i)/2}},jme=({scrollX:e,scrollY:t,width:n,height:r,zoom:i})=>[-e,-t,-e+n/i.value,-t+r/i.value];var Fe=(e,t,n,r,i)=>[(e-n)*Math.cos(i)-(t-r)*Math.sin(i)+n,(e-n)*Math.sin(i)+(t-r)*Math.cos(i)+r],on=(e,t,n)=>Fe(e[0],e[1],t[0],t[1],n),uD=(e,t,n,r,i,a,o,s)=>{let l=Math.cos(r),c=Math.sin(r);return e.e&&e.w?t+=i+o:e.e?(t+=i*(1+l),n+=i*c,t+=o*(1-l),n+=o*-c):e.w&&(t+=i*(1-l),n+=i*-c,t+=o*(1+l),n+=o*c),e.n&&e.s?n+=a+s:e.n?(t+=a*c,n+=a*(1-l),t+=s*-c,n+=s*(1+l)):e.s&&(t+=a*-c,n+=a*(1+l),t+=s*c,n+=s*(1-l)),[t,n]};var ti=(e,t,n,r)=>{let i=n-e,a=r-t;return Math.hypot(i,a)},Rm=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],to=(e,t=1)=>{if(e.length>=3){let[n,r]=[e[0],e[e.length-1]];return ti(n[0],n[1],r[0],r[1])<=s7/t}return!1};var Y0=(e,t,n)=>t[0]<=Math.max(e[0],n[0])&&t[0]>=Math.min(e[0],n[0])&&t[1]<=Math.max(e[1],n[1])&&t[1]>=Math.min(e[1],n[1]);var Om=(e,t,n)=>n?[Math.round(e/n)*n,Math.round(t/n)*n]:[e,t],Vo=(e,t)=>{if(t.roundness?.type===Qr.PROPORTIONAL_RADIUS||t.roundness?.type===Qr.LEGACY)return e*l0;if(t.roundness?.type===Qr.ADAPTIVE_RADIUS){let n=t.roundness?.value??f7,r=n/l0;return e<=r?e*l0:n}return 0},Jx=(e,t)=>{let n=an.generateElementShape(e,null);if(!n)return null;let r=Qs(n[0]),i=[0,0],a=0,o=1/0,s=null;for(;a<r.length;){let{op:l,data:c}=r[a];if(l==="move"&&(i=c),l==="bcurveTo"){let d=i,u=[c[0],c[1]],h=[c[2],c[3]],m=[c[4],c[5]],p=ti(m[0],m[1],t[0],t[1]);p<o&&(o=p,s=[d,u,h,m]),i=m}a++}return s},ew=(e,t,n,r,i)=>{let a=(l,c)=>Math.pow(1-l,3)*r[c]+3*l*Math.pow(1-l,2)*n[c]+3*Math.pow(l,2)*(1-l)*t[c]+e[c]*Math.pow(l,3),o=a(i,0),s=a(i,1);return[o,s]},mq=(e,t)=>{let n=Jx(e,t);if(!n)return[];let r=[],i=1;for(;i>0;){let a=ew(n[0],n[1],n[2],n[3],i);r.push([a[0],a[1]]),i-=.05}return r.length&&tw(r.at(-1),t)&&r.push([t[0],t[1]]),r},hD=(e,t)=>{let n=[];n[0]=0;let r=mq(e,t),i=0,a=0;for(;i<r.length-1;){let o=ti(r[i][0],r[i][1],r[i+1][0],r[i+1][1]);a+=o,n.push(a),i++}return n},NP=(e,t)=>hD(e,t).at(-1),$P=(e,t,n)=>{let r=hD(e,t),i=r.length-1,a=r.at(-1),o=n*a,s=0,l=i,c=0;for(;s<l;)c=Math.floor(s+(l-s)/2),r[c]<o?s=c+1:l=c;return r[c]>o&&c--,r[c]===o?c/i:1-(c+(o-r[c])/(r[c+1]-r[c]))/i},tw=(e,t)=>e[0]===t[0]&&e[1]===t[1],XP=e=>Math.round(e/Math.PI*1e4)%5e3===0,Xme=([e,t],[n,r])=>e<=n?t>=n:e>=n?r>=e:!1,qme=(e,t)=>{let n=Math.max(e[0],t[0]),r=Math.min(e[1],t[1]);return n<=r?[n,r]:null},zm=(e,t,n)=>e>=t&&e<=n;S();var pq=(e,t,n)=>{let r=n.reduce((i,a)=>(a.groupIds.includes(e)&&(i[a.id]=!0),i),{});return Object.keys(r).length<2?t.selectedGroupIds[e]||t.editingGroupId===e?{selectedElementIds:t.selectedElementIds,selectedGroupIds:{...t.selectedGroupIds,[e]:!1},editingGroupId:null}:t:{editingGroupId:t.editingGroupId,selectedGroupIds:{...t.selectedGroupIds,[e]:!0},selectedElementIds:{...t.selectedElementIds,...r}}},rpe=function(){let e=null,t=null,n=null,r=(a,o,s,l)=>{if(n!==void 0&&o===t&&a===e&&s.editingGroupId===n?.editingGroupId)return n;let c={};for(let h of a){let m=h.groupIds;if(s.editingGroupId){let p=m.indexOf(s.editingGroupId);p>-1&&(m=m.slice(0,p))}if(m.length>0){let p=m[m.length-1];c[p]=!0}}let d={},u=o.reduce((h,m)=>{let p=m.groupIds.find(f=>c[f]);return p&&(h[m.id]=!0,Array.isArray(d[p])?d[p].push(m.id):d[p]=[m.id]),h},{});for(let h of Object.keys(d))d[h].length<2&&c[h]&&(c[h]=!1);return t=o,e=a,n={editingGroupId:s.editingGroupId,selectedGroupIds:c,selectedElementIds:vw({...s.selectedElementIds,...u},l)},n},i=(a,o,s,l)=>{let c=l?l.scene.getSelectedElements({selectedElementIds:a.selectedElementIds,elements:o}):aa(o,a);return c.length?r(c,o,a,s):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:vw(a.selectedElementIds,s)}};return i.clearCache=()=>{t=null,e=null,n=null},i}(),ipe=(e,t)=>fq(e,t)!=null,fq=(e,t)=>t.groupIds.filter(n=>n!==e.editingGroupId).find(n=>e.selectedGroupIds[n]),ape=e=>Object.entries(e.selectedGroupIds).filter(([t,n])=>n).map(([t,n])=>t),mD=(e,t)=>{let n={...t,selectedGroupIds:{}};for(let r of e){let i=r.groupIds;if(t.editingGroupId){let a=i.indexOf(t.editingGroupId);a>-1&&(i=i.slice(0,a))}if(i.length>0){let a=i[i.length-1];n={...n,...pq(a,n,e)}}}return n.selectedGroupIds},ope=(e,t)=>({...e,editingGroupId:t.groupIds.length?t.groupIds[0]:null,selectedGroupIds:{},selectedElementIds:{[t.id]:!0}}),gq=(e,t)=>e.groupIds.includes(t),Jd=(e,t)=>{let n=[];for(let r of e.values())gq(r,t)&&n.push(r);return n},spe=(e,t)=>e.groupIds.find(n=>t[n]),pD=(e,t,n)=>{let r=[...e],i=t?e.indexOf(t):-1,a=i>-1?i:e.length;for(let o=0;o<a;o++)r[o]=n(r[o]);return r},lpe=(e,t,n)=>{let r=[...e],i=n?r.indexOf(n):-1,a=i>-1?i:r.length;return r.splice(a,0,t),r},cpe=(e,t)=>e.filter(n=>!t[n]),dpe=(e,t)=>{let n=new Map;return e.forEach(r=>{let i=r.groupIds.length===0?r.id:r.groupIds[r.groupIds.length-1],a=n.get(i)||[],o=ft(r,t);o&&a.push(o),n.set(i,[...a,r])}),Array.from(n.values())},fD=e=>{let t=new Set;for(let[,n]of e)if(!n.isDeleted)for(let r of n.groupIds??[])t.add(r);return t};var gD=e=>e.groupIds.length>0;S();S();S();S();S();var ED=_(xw(),1),K0=e=>e.replace(/"/g,"&quot;"),eu=e=>(e=e.trim(),e&&(0,ED.sanitizeUrl)(K0(e))),fpe=e=>!!(e?.includes(location.origin)||e?.startsWith("/")),bD=e=>{if(e=eu(e),e.startsWith("/"))return`${location.origin}${e}`;try{new URL(e)}catch{return"about:blank"}return e};S();S();var yD=[],vD=e=>(yD=yD.concat(e),e);S();var wD='<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">',Iq='<path d="M6.164 11.755a5.314 5.314 0 0 1-4.932-5.298 5.314 5.314 0 0 1 5.311-5.311 5.314 5.314 0 0 1 5.307 5.113l8.773 8.773a3.322 3.322 0 0 1 0 4.696l-.895.895a3.322 3.322 0 0 1-4.696 0l-8.868-8.868Z" style="fill:#fff"/>',SD='<path stroke="#1b1b1f" fill="#fff" d="m7.868 11.113 7.773 7.774a2.359 2.359 0 0 0 1.667.691 2.368 2.368 0 0 0 2.357-2.358c0-.625-.248-1.225-.69-1.667L11.201 7.78 9.558 9.469l-1.69 1.643v.001Zm10.273 3.606-3.333 3.333m-3.25-6.583 2 2m-7-7 3 3M3.664 3.625l1 1M2.529 6.922l1.407-.144m5.735-2.932-1.118.866M4.285 9.823l.758-1.194m1.863-6.207-.13 1.408"/>',Mq=`data:${Te.svg},${encodeURIComponent(`${wD}${SD}</svg>`)}`,Aq=`data:${Te.svg},${encodeURIComponent(`${wD}${Iq}${SD}</svg>`)}`,kq=e=>{e&&(e.style.cursor="")},Pq=(e,t)=>{e&&(e.style.cursor=t)},no,xD,Dq=(e,t)=>{let r=()=>{let i=t===qr.DARK;no=document.createElement("canvas"),no.theme=t,no.height=20,no.width=20;let a=no.getContext("2d");a.lineWidth=1,a.beginPath(),a.arc(no.width/2,no.height/2,5,0,2*Math.PI),a.fillStyle=i?At.black:At.white,a.fill(),a.strokeStyle=i?At.white:At.black,a.stroke(),xD=no.toDataURL(Te.svg)};(!no||no.theme!==t)&&r(),Pq(e,`url(${xD}) ${20/2} ${20/2}, auto`)},CD=(e,t)=>{if(e)if(t.activeTool.type==="selection")kq(e);else if(v7(t))e.style.cursor=n0.GRAB;else if(y7(t))Dq(e,t.theme);else if(t.activeTool.type==="laser"){let n=t.theme===qr.LIGHT?Mq:Aq;e.style.cursor=`url(${n}), auto`}else if(!["image","custom"].includes(t.activeTool.type))e.style.cursor=n0.CROSSHAIR;else if(t.activeTool.type==="custom"&&t.activeTool.customType==="comment"){let n=`data:${Te.svg},${encodeURIComponent(`
18
+ <svg
19
+ width="24"
20
+ height="24"
21
+ viewBox="0 0 24 24"
22
+ xmlns="http://www.w3.org/2000/svg"
23
+ >
24
+ <path
25
+ d="M5.25 18A3.25 3.25 0 0 1 2 14.75v-8.5A3.25 3.25 0 0 1 5.25 3h13.5A3.25 3.25 0 0 1 22 6.25v8.5A3.25 3.25 0 0 1 18.75 18h-5.738L8 21.75a1.25 1.25 0 0 1-1.999-1V18h-.75Zm7.264-1.5h6.236a1.75 1.75 0 0 0 1.75-1.75v-8.5a1.75 1.75 0 0 0-1.75-1.75H5.25A1.75 1.75 0 0 0 3.5 6.25v8.5c0 .966.784 1.75 1.75 1.75h2.249v3.75l5.015-3.75Z"
26
+ fill="${t.theme===qr.LIGHT?"#000":"#fff"}"
27
+ />
28
+ </svg>
29
+ `)}`;e.style.cursor=`url(${n}) 5 20, auto`}else t.activeTool.type!=="image"&&(e.style.cursor=n0.AUTO)};S();S();var _q=new Ys(Date.now()),Lq=0,ro=()=>Math.floor(_q.next()*2**31);var ca=()=>$o()?`id${Lq++}`:Ka();var Yo=(e,{x:t,y:n,strokeColor:r=Ot.strokeColor,backgroundColor:i=Ot.backgroundColor,fillStyle:a=Ot.fillStyle,strokeWidth:o=Ot.strokeWidth,strokeStyle:s=Ot.strokeStyle,roughness:l=Ot.roughness,opacity:c=Ot.opacity,width:d=0,height:u=0,angle:h=0,groupIds:m=[],frameId:p=null,index:f=null,roundness:g=null,boundElements:b=null,link:v=null,locked:y=Ot.locked,...w})=>({id:w.id||ca(),type:e,x:t,y:n,width:d,height:u,angle:h,strokeColor:r,backgroundColor:i,fillStyle:a,strokeWidth:o,strokeStyle:s,roughness:l,opacity:c,groupIds:m,frameId:p,index:f,roundness:g,seed:w.seed??ro(),version:w.version||1,versionNonce:w.versionNonce??0,isDeleted:!1,boundElements:b,updated:No(),link:v,locked:y,customData:w.customData}),Hm=e=>Yo(e.type,e),Bpe=e=>Yo("embeddable",e),zpe=e=>({...Yo("iframe",e)}),Hpe=e=>Ai({...Yo("frame",e),type:"frame",name:e?.name||null},{}),Upe=e=>Ai({...Yo("magicframe",e),type:"magicframe",name:e?.name||null},{}),TD=(e,t)=>({x:e.textAlign==="center"?t.width/2:e.textAlign==="right"?t.width:0,y:e.verticalAlign==="middle"?t.height/2:0}),io=e=>{let t=e.fontFamily||ea,n=e.fontSize||Za,r=e.lineHeight||H0(t),i=ow(e.text),a=Ec(i,Rn({fontFamily:t,fontSize:n}),r),o=e.textAlign||Nd,s=e.verticalAlign||i0,l=TD({textAlign:o,verticalAlign:s},a);return Ai({...Yo("text",e),text:i,fontSize:n,fontFamily:t,textAlign:o,verticalAlign:s,x:e.x-l.x,y:e.y-l.y,width:a.width,height:a.height,containerId:e.containerId||null,originalText:i,lineHeight:r},{})},Rq=(e,t,n)=>{let{width:r,height:i}=Ec(n,Rn(e),e.lineHeight),{textAlign:a,verticalAlign:o}=e,s,l;if(a==="center"&&o===Oo.MIDDLE&&!e.containerId){let c=Ec(e.text,Rn(e),e.lineHeight),d=TD(e,{width:r-c.width,height:i-c.height});s=e.x-d.x,l=e.y-d.y}else{let[c,d,u,h]=Me(e,t),[m,p,f,g]=Qd(e,r,i,!1),b=(c-m)/2,v=(d-p)/2,y=(u-f)/2,w=(h-g)/2;[s,l]=uD({s:!0,e:a==="center"||a==="left",w:a==="center"||a==="right"},e.x,e.y,e.angle,b,v,y,w)}return{width:r,height:i,x:Number.isFinite(s)?s:e.x,y:Number.isFinite(l)?l:e.y}},Q0=(e,t,n,r=e.text)=>{if(e.isDeleted)return;t&&(r=Xd(r,Rn(e),la(t,e)));let i=Rq(e,n,r);return{text:r,...i}},Oq=(e,t,n,{text:r,isDeleted:i,originalText:a})=>Ai(e,{originalText:a,isDeleted:i??e.isDeleted,...Q0(e,t,n,a)}),Gpe=e=>({...Yo(e.type,e),points:e.points||[],pressures:[],simulatePressure:e.simulatePressure,lastCommittedPoint:null}),yc=e=>({...Yo(e.type,e),points:e.points||[],lastCommittedPoint:null,startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null}),Nq=e=>({...Yo("image",e),strokeColor:"transparent",status:e.status??"pending",fileId:e.fileId??null,scale:e.scale??[1,1]}),X0=(e,t=0)=>{if(e==null||typeof e!="object")return e;let n=Object.prototype.toString.call(e);if(n==="[object Object]"){let r=typeof e.constructor=="function"?Object.create(Object.getPrototypeOf(e)):{};for(let i in e)if(e.hasOwnProperty(i)){if(t===0&&(i==="shape"||i==="canvas"))continue;r[i]=X0(e[i],t+1)}return r}if(Array.isArray(e)){let r=e.length,i=new Array(r);for(;r--;)i[r]=X0(e[r],t+1);return i}return L.DEV&&n!=="[object Object]"&&n!=="[object Array]"&&n.startsWith("[object ")&&console.warn(`_deepCloneElement: unexpected object type ${n}. This value will not be cloned!`),e},Um=e=>X0(e),q0=e=>{if($o()&&e){let t=`${e}_copy`;return window.h?.app?.getSceneElementsIncludingDeleted().find(n=>n.id===t)&&(t+="_copy"),t}return ca()},$q=(e,t,n,r)=>{let i=Um(n);return i.id=q0(i.id),i.boundElements=null,i.updated=No(),i.seed=ro(),i.groupIds=pD(i.groupIds,e,a=>(t.has(a)||t.set(a,q0(a)),t.get(a))),r&&(i=Object.assign(i,r)),i},jpe=(e,t)=>{let n=[],r=et(e),i=new Map,a=s=>{if(i.has(s))return i.get(s);if(r.has(s)){let l=q0(s);return i.set(s,l),l}return null},o=new Map;for(let s of e){let l=X0(s);if(l.id=a(s.id),t?.randomizeSeed&&(l.seed=ro(),Gm(l)),l.groupIds&&(l.groupIds=l.groupIds.map(c=>(o.has(c)||o.set(c,q0(c)),o.get(c)))),"containerId"in l&&l.containerId){let c=a(l.containerId);l.containerId=c}if("boundElements"in l&&l.boundElements&&(l.boundElements=l.boundElements.reduce((c,d)=>{let u=a(d.id);return u&&c.push({...d,id:u}),c},[])),"endBinding"in l&&l.endBinding){let c=a(l.endBinding.elementId);l.endBinding=c?{...l.endBinding,elementId:c}:null}if("startBinding"in l&&l.startBinding){let c=a(l.startBinding.elementId);l.startBinding=c?{...l.startBinding,elementId:c}:null}l.frameId&&(l.frameId=a(l.frameId)),n.push(l)}return n};S();S();S();S();var AD="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function nu(e,t,n){let r=n[0];if(t!=null&&e>=t)throw new Error(e+" >= "+t);if(e.slice(-1)===r||t&&t.slice(-1)===r)throw new Error("trailing zero");if(t){let o=0;for(;(e[o]||r)===t[o];)o++;if(o>0)return t.slice(0,o)+nu(e.slice(o),t.slice(o),n)}let i=e?n.indexOf(e[0]):0,a=t!=null?n.indexOf(t[0]):n.length;if(a-i>1){let o=Math.round(.5*(i+a));return n[o]}else return t&&t.length>1?t.slice(0,1):n[i]+nu(e.slice(1),null,n)}function kD(e){if(e.length!==PD(e[0]))throw new Error("invalid integer part of order key: "+e)}function PD(e){if(e>="a"&&e<="z")return e.charCodeAt(0)-97+2;if(e>="A"&&e<="Z")return 90-e.charCodeAt(0)+2;throw new Error("invalid order key head: "+e)}function jm(e){let t=PD(e[0]);if(t>e.length)throw new Error("invalid order key: "+e);return e.slice(0,t)}function ID(e,t){if(e==="A"+t[0].repeat(26))throw new Error("invalid order key: "+e);let n=jm(e);if(e.slice(n.length).slice(-1)===t[0])throw new Error("invalid order key: "+e)}function MD(e,t){kD(e);let[n,...r]=e.split(""),i=!0;for(let a=r.length-1;i&&a>=0;a--){let o=t.indexOf(r[a])+1;o===t.length?r[a]=t[0]:(r[a]=t[o],i=!1)}if(i){if(n==="Z")return"a"+t[0];if(n==="z")return null;let a=String.fromCharCode(n.charCodeAt(0)+1);return a>"a"?r.push(t[0]):r.pop(),a+r.join("")}else return n+r.join("")}function Fq(e,t){kD(e);let[n,...r]=e.split(""),i=!0;for(let a=r.length-1;i&&a>=0;a--){let o=t.indexOf(r[a])-1;o===-1?r[a]=t.slice(-1):(r[a]=t[o],i=!1)}if(i){if(n==="a")return"Z"+t.slice(-1);if(n==="A")return null;let a=String.fromCharCode(n.charCodeAt(0)-1);return a<"Z"?r.push(t.slice(-1)):r.pop(),a+r.join("")}else return n+r.join("")}function tu(e,t,n=AD){if(e!=null&&ID(e,n),t!=null&&ID(t,n),e!=null&&t!=null&&e>=t)throw new Error(e+" >= "+t);if(e==null){if(t==null)return"a"+n[0];let l=jm(t),c=t.slice(l.length);if(l==="A"+n[0].repeat(26))return l+nu("",c,n);if(l<t)return l;let d=Fq(l,n);if(d==null)throw new Error("cannot decrement any more");return d}if(t==null){let l=jm(e),c=e.slice(l.length),d=MD(l,n);return d??l+nu(c,null,n)}let r=jm(e),i=e.slice(r.length),a=jm(t),o=t.slice(a.length);if(r===a)return r+nu(i,o,n);let s=MD(r,n);if(s==null)throw new Error("cannot increment any more");return s<t?s:r+nu(i,null,n)}function ru(e,t,n,r=AD){if(n===0)return[];if(n===1)return[tu(e,t,r)];if(t==null){let o=tu(e,t,r),s=[o];for(let l=0;l<n-1;l++)o=tu(o,t,r),s.push(o);return s}if(e==null){let o=tu(e,t,r),s=[o];for(let l=0;l<n-1;l++)o=tu(e,o,r),s.push(o);return s.reverse(),s}let i=Math.floor(n/2),a=tu(e,t,r);return[...ru(e,a,i,r),a,...ru(a,t,n-i-1,r)]}S();var J0=class extends Error{constructor(t="Couldn't export canvas.",n="CANVAS_ERROR"){super(),this.name=n,this.message=t}},eg=class extends DOMException{constructor(t="Request Aborted"){super(t,"AbortError")}},Zo=class extends Error{code;constructor(t="Image Scene Data Error",n="IMAGE_SCENE_DATA_ERROR"){super(t),this.name="EncodingError",this.code=n}},tg=class extends Error{code="ELEMENT_HAS_INVALID_INDEX"};var ww=e=>{for(let[t,n]of e.entries()){let r=e[t-1],i=e[t+1];if(!Wm(n,r,i))throw new tg(`Fractional indices invariant for element has been compromised - ["${r}", "${n}", "${i}"] [predecessor, current, successor]`)}},_D=e=>e.sort((t,n)=>DD(t)&&DD(n)?t.index<n.index?-1:t.index>n.index?1:t.id<n.id?-1:1:1),Vm=(e,t)=>{try{let n=Bq(e,t),r=LD(e,n);ww(e.map(i=>r.get(i)?.index||i.index));for(let[i,a]of r)Ce(i,a,!1)}catch{vc(e)}return e},vc=e=>{let t=zq(e),n=LD(e,t);for(let[r,i]of n)Ce(r,i,!1);return e},Bq=(e,t)=>{let n=[],r=0;for(;r<e.length;)if(t.has(e[r].id)&&!Wm(e[r]?.index,e[r-1]?.index,e[r+1]?.index)){let i=[r-1,r];for(;++r<e.length&&(t.has(e[r].id)&&!Wm(e[r]?.index,e[r-1]?.index,e[r+1]?.index));)i.push(r);i.push(r),n.push(i)}else r++;return n},zq=e=>{let t=[],n,r,i=-1,a=0,o=c=>{let d=e[i]?e[i].index:void 0,u=e[c-1]?.index;return!d&&u||d&&u&&u>d?[u,c-1]:[d,i]},s=c=>{let d=e[a]?e[a].index:void 0;if(d&&c<a)return[d,a];let u=a;for(;++u<e.length;){let h=e[u]?.index;if(!d&&h||d&&h&&h>d)return[h,u]}return[void 0,u]},l=0;for(;l<e.length;){let c=e[l].index;if([n,i]=o(l),[r,a]=s(l),Wm(c,n,r))l++;else{let d=[i,l];for(;++l<e.length;){let u=e[l].index,[h,m]=o(l),[p,f]=s(l);if(Wm(u,h,p))break;[n,i]=[h,m],[r,a]=[p,f],d.push(l)}d.push(a),t.push(d)}}return t},Wm=(e,t,n)=>e?t&&n?t<e&&e<n:!t&&n?e<n:t&&!n?t<e:!!e:!1,LD=(e,t)=>{let n=new Map;for(let r of t){let i=r.shift(),a=r.pop(),o=ru(e[i]?.index,e[a]?.index,r.length);for(let s=0;s<r.length;s++){let l=e[r[s]];n.set(l,{index:o[s]})}}return n},DD=e=>!!e.index;var Jt=class e{constructor(t,n){this.deleted=t;this.inserted=n}static create(t,n,r,i){let a=r&&i!=="inserted"?r(t):t,o=r&&i!=="deleted"?r(n):n;return new e(a,o)}static calculate(t,n,r,i){if(t===n)return e.empty();let a={},o={};for(let c of this.distinctKeysIterator("full",t,n))a[c]=t[c],o[c]=n[c];let[s,l]=i?i(a,o):[a,o];return e.create(s,l,r)}static empty(){return new e({},{})}static isEmpty(t){return!Object.keys(t.deleted).length&&!Object.keys(t.inserted).length}static mergeObjects(t,n,r){let i={...t};for(let a of Object.keys(r))delete i[a];return{...i,...n}}static mergeArrays(t,n,r,i){return Object.values(e.mergeObjects(Xa(t??[],i),Xa(n??[],i),Xa(r??[],i)))}static diffObjects(t,n,r,i){if(!(!t[r]&&!n[r])&&(typeof t[r]=="object"||typeof n[r]=="object")){let a=t[r]??{},o=n[r]??{},s=e.getLeftDifferences(a,o).reduce((c,d)=>(c[d]=i(a[d]),c),{}),l=e.getRightDifferences(a,o).reduce((c,d)=>(c[d]=i(o[d]),c),{});Object.keys(s).length||Object.keys(l).length?(Reflect.set(t,r,s),Reflect.set(n,r,l)):(Reflect.deleteProperty(t,r),Reflect.deleteProperty(n,r))}}static diffArrays(t,n,r,i){if(!(!t[r]&&!n[r])&&(Array.isArray(t[r])||Array.isArray(n[r]))){let a=Array.isArray(t[r])?t[r]:[],o=Array.isArray(n[r])?n[r]:[],s=Xa(e.getLeftDifferences(Xa(a,i),Xa(o,i))),l=Xa(e.getRightDifferences(Xa(a,i),Xa(o,i)));if(Object.keys(s).length||Object.keys(l).length){let c=a.filter(u=>s[i?i(u):String(u)]),d=o.filter(u=>l[i?i(u):String(u)]);Reflect.set(t,r,c),Reflect.set(n,r,d)}else Reflect.deleteProperty(t,r),Reflect.deleteProperty(n,r)}}static isLeftDifferent(t,n,r=!1){return!!this.distinctKeysIterator("left",t,n,r).next().value}static isRightDifferent(t,n,r=!1){return!!this.distinctKeysIterator("right",t,n,r).next().value}static getLeftDifferences(t,n,r=!1){return Array.from(this.distinctKeysIterator("left",t,n,r))}static getRightDifferences(t,n,r=!1){return Array.from(this.distinctKeysIterator("right",t,n,r))}static*distinctKeysIterator(t,n,r,i=!1){if(n===r)return;let a=[];t==="left"?a=Object.keys(n):t==="right"?a=Object.keys(r):t==="full"?a=Array.from(new Set([...Object.keys(n),...Object.keys(r)])):lc(t,`Unknown distinctKeysIterator's join param "${t}"`,!0);for(let o of a){let s=n[o],l=r[o];if(s!==l){if(!i&&typeof s=="object"&&typeof l=="object"&&s!==null&&l!==null&&Fo(s,l))continue;yield o}}}},Ym=class e{constructor(t){this.delta=t}static calculate(t,n){let r=Jt.calculate(t,n,void 0,e.postProcess);return new e(r)}static empty(){return new e(Jt.create({},{}))}inverse(){let t=Jt.create(this.delta.inserted,this.delta.deleted);return new e(t)}applyTo(t,n){try{let{selectedElementIds:r={},selectedGroupIds:i={}}=this.delta.deleted,{selectedElementIds:a={},selectedGroupIds:o={},selectedLinearElementId:s,editingLinearElementId:l,...c}=this.delta.inserted,d=Jt.mergeObjects(t.selectedElementIds,a,r),u=Jt.mergeObjects(t.selectedGroupIds,o,i),h=s&&n.has(s)?new st(n.get(s)):null,m=l&&n.has(l)?new st(n.get(l)):null,p={...t,...c,selectedElementIds:d,selectedGroupIds:u,selectedLinearElement:typeof s<"u"?h:t.selectedLinearElement,editingLinearElement:typeof l<"u"?m:t.editingLinearElement},f=this.filterInvisibleChanges(t,p,n);return[p,f]}catch(r){if(console.error("Couldn't apply appstate change",r),L.DEV||L.MODE===Ji.TEST)throw r;return[t,!1]}}isEmpty(){return Jt.isEmpty(this.delta)}static postProcess(t,n){try{Jt.diffObjects(t,n,"selectedElementIds",r=>!0),Jt.diffObjects(t,n,"selectedGroupIds",r=>r??!1)}catch(r){if(console.error("Couldn't postprocess appstate change deltas."),L.DEV||L.MODE===Ji.TEST)throw r}finally{return[t,n]}}filterInvisibleChanges(t,n,r){let i=Km(t),a=Km(n),o=Jt.isRightDifferent(e.stripElementsProps(i),e.stripElementsProps(a)),s=Jt.isRightDifferent(e.stripStandaloneProps(i),e.stripStandaloneProps(a));if(!o&&!s)return!1;let l={value:o};if(s){let c=Jt.getRightDifferences(e.stripStandaloneProps(i),e.stripStandaloneProps(a)),d=new Set;(c.includes("editingGroupId")||c.includes("selectedGroupIds"))&&(d=fD(r));for(let u of c)switch(u){case"selectedElementIds":n[u]=e.filterSelectedElements(n[u],r,l);break;case"selectedGroupIds":n[u]=e.filterSelectedGroups(n[u],d,l);break;case"editingGroupId":let h=n[u];h?d.has(h)?l.value=!0:n[u]=null:l.value=!0;break;case"selectedLinearElementId":case"editingLinearElementId":let m=e.convertToAppStateKey(u),p=n[m];if(!p)l.value=!0;else{let f=r.get(p.elementId);f&&!f.isDeleted?l.value=!0:n[m]=null}break;default:lc(u,`Unknown ObservedElementsAppState's key "${u}"`,!0)}}return l.value}static convertToAppStateKey(t){switch(t){case"selectedLinearElementId":return"selectedLinearElement";case"editingLinearElementId":return"editingLinearElement"}}static filterSelectedElements(t,n,r){let i=Object.keys(t);if(!i.length)return r.value=!0,t;let a={...t};for(let o of i){let s=n.get(o);s&&!s.isDeleted?r.value=!0:delete a[o]}return a}static filterSelectedGroups(t,n,r){if(!Object.keys(t).length)return r.value=!0,t;let a={...t};for(let o of Object.keys(a))n.has(o)?r.value=!0:delete a[o];return a}static stripElementsProps(t){let{editingGroupId:n,selectedGroupIds:r,selectedElementIds:i,editingLinearElementId:a,selectedLinearElementId:o,...s}=t;return s}static stripStandaloneProps(t){let{name:n,viewBackgroundColor:r,...i}=t;return i}},Zm=class e{constructor(t,n,r){this.added=t;this.removed=n;this.updated=r}static create(t,n,r,i={shouldRedistribute:!1}){let a;if(i.shouldRedistribute){let o=new Map,s=new Map,l=new Map,c=[...t,...n,...r];for(let[d,u]of c)this.satisfiesAddition(u)?o.set(d,u):this.satisfiesRemoval(u)?s.set(d,u):l.set(d,u);a=new e(o,s,l)}else a=new e(t,n,r);return(L.DEV||L.MODE===Ji.TEST)&&(e.validate(a,"added",this.satisfiesAddition),e.validate(a,"removed",this.satisfiesRemoval),e.validate(a,"updated",this.satisfiesUpdate)),a}static satisfiesAddition=({deleted:t,inserted:n})=>t.isDeleted===!0&&!n.isDeleted;static satisfiesRemoval=({deleted:t,inserted:n})=>!t.isDeleted&&n.isDeleted===!0;static satisfiesUpdate=({deleted:t,inserted:n})=>!!t.isDeleted==!!n.isDeleted;static validate(t,n,r){for(let[i,a]of t[n].entries())if(!r(a))throw console.error(`Broken invariant for "${n}" delta, element "${i}", delta:`,a),new Error(`ElementsChange invariant broken for element "${i}".`)}static calculate(t,n){if(t===n)return e.empty();let r=new Map,i=new Map,a=new Map;for(let o of t.values())if(!n.get(o.id)){let l={...o,isDeleted:!1},c={isDeleted:!0},d=Jt.create(l,c,e.stripIrrelevantProps);i.set(o.id,d)}for(let o of n.values()){let s=t.get(o.id);if(!s){let l={isDeleted:!0},c={...o,isDeleted:!1},d=Jt.create(l,c,e.stripIrrelevantProps);r.set(o.id,d);continue}if(s.versionNonce!==o.versionNonce){let l=Jt.calculate(s,o,e.stripIrrelevantProps,e.postProcess);if(typeof s.isDeleted=="boolean"&&typeof o.isDeleted=="boolean"&&s.isDeleted!==o.isDeleted){s.isDeleted&&!o.isDeleted?r.set(o.id,l):i.set(o.id,l);continue}Jt.isEmpty(l)||a.set(o.id,l)}}return e.create(r,i,a)}static empty(){return e.create(new Map,new Map,new Map)}inverse(){let t=a=>{let o=new Map;for(let[s,l]of a.entries())o.set(s,Jt.create(l.inserted,l.deleted));return o},n=t(this.added),r=t(this.removed),i=t(this.updated);return e.create(r,n,i)}isEmpty(){return this.added.size===0&&this.removed.size===0&&this.updated.size===0}applyLatestChanges(t){let n=s=>l=>{let c={};for(let d of Object.keys(l))switch(d){case"boundElements":c[d]=l[d];break;default:c[d]=s[d]}return c},r=s=>{let l=new Map;for(let[c,d]of s.entries()){let u=t.get(c);if(u){let h=Jt.create(d.deleted,d.inserted,n(u),"inserted");l.set(c,h)}else l.set(c,d)}return l},i=r(this.added),a=r(this.removed),o=r(this.updated);return e.create(i,a,o,{shouldRedistribute:!0})}applyTo(t,n){let r=Bo(new Map(t)),i,a={containsVisibleDifference:!1,containsZindexDifference:!1};try{let o=e.createApplier(r,n,a),s=o(this.added),l=o(this.removed),c=o(this.updated),d=this.resolveConflicts(t,r);i=new Map([...s,...l,...c,...d])}catch(o){if(console.error("Couldn't apply elements change",o),L.DEV||L.MODE===Ji.TEST)throw o;return[t,!0]}try{e.redrawTextBoundingBoxes(r,i),e.redrawBoundArrows(r,i),r=e.reorderElements(r,i,a)}catch(o){if(console.error("Couldn't mutate elements after applying elements change",o),L.DEV||L.MODE===Ji.TEST)throw o}finally{return[r,a.containsVisibleDifference]}}static createApplier=(t,n,r)=>{let i=e.createGetter(t,n,r);return a=>Array.from(a.entries()).reduce((o,[s,l])=>{let c=i(s,l.inserted);if(c){let d=e.applyDelta(c,l,r);t.set(d.id,d),o.set(d.id,d)}return o},new Map)};static createGetter=(t,n,r)=>(i,a)=>{let o=t.get(i);return o||(o=n.get(i),o&&(r.containsZindexDifference=!0,(a.isDeleted===!1||a.isDeleted!==!0&&o.isDeleted===!1)&&(r.containsVisibleDifference=!0))),o};static applyDelta(t,n,r={containsVisibleDifference:!0,containsZindexDifference:!0}){let{boundElements:i,...a}=n.inserted;if(n.deleted.boundElements?.length||n.inserted.boundElements?.length){let o=Jt.mergeArrays(t.boundElements,n.inserted.boundElements,n.deleted.boundElements,s=>s.id);Object.assign(a,{boundElements:o})}if(!r.containsVisibleDifference){let{index:o,...s}=a,l=e.checkForVisibleDifference(t,s);r.containsVisibleDifference=l}return r.containsZindexDifference||(r.containsZindexDifference=n.deleted.index!==n.inserted.index),Ai(t,a)}static checkForVisibleDifference(t,n){return t.isDeleted&&n.isDeleted!==!1?!1:t.isDeleted&&n.isDeleted===!1||t.isDeleted===!1&&n.isDeleted?!0:Jt.isRightDifferent(t,n)}resolveConflicts(t,n){let r=new Map,i=(c,d)=>{let u=n.get(c.id);if(!u)return;let h;t.get(c.id)===u?h=Ai(u,d):h=Ce(u,d),r.set(h.id,h),n.set(h.id,h)};for(let[c]of this.removed)e.unbindAffected(t,n,c,i);for(let[c]of this.added)e.rebindAffected(t,n,c,i);for(let[c]of Array.from(this.updated).filter(([d,u])=>Object.keys({...u.deleted,...u.inserted}).find(h=>DP.has(h)))){let d=n.get(c);!d||d.isDeleted||e.rebindAffected(t,n,c,i)}let a=new Map(Array.from(t).filter(([c])=>r.has(c))),{added:o,removed:s,updated:l}=e.calculate(a,r);for(let[c,d]of o)this.added.set(c,d);for(let[c,d]of s)this.removed.set(c,d);for(let[c,d]of l)this.updated.set(c,d);return r}static unbindAffected(t,n,r,i){let a=()=>t.get(r),o=()=>n.get(r);Xs.unbindAffected(n,a(),i),Xs.unbindAffected(n,o(),i),qs.unbindAffected(n,a(),i),qs.unbindAffected(n,o(),i)}static rebindAffected(t,n,r,i){let a=()=>t.get(r),o=()=>n.get(r);Xs.unbindAffected(n,a(),i),Xs.rebindAffected(n,o(),i),qs.unbindAffected(n,a(),(s,l)=>{He(s)&&i(s,l)}),qs.rebindAffected(n,o(),i)}static redrawTextBoundingBoxes(t,n){let r=new Map;for(let i of n.values()){if(ar(i)){let{containerId:a}=i,o=a?t.get(a):void 0;o&&r.set(o.id,{container:o,boundText:i})}if(zd(i)){let a=Wo(i),o=a?t.get(a):void 0;o&&r.set(i.id,{container:i,boundText:o})}}for(let{container:i,boundText:a}of r.values())i.isDeleted||a.isDeleted||lw(a,i,t,!1)}static redrawBoundArrows(t,n){for(let r of n.values())!r.isDeleted&&Ho(r)&&eo(r,t)}static reorderElements(t,n,r){if(!r.containsZindexDifference)return t;let i=Array.from(t.values()),a=_D([...i]);return!r.containsVisibleDifference&&Jt.isRightDifferent(i,a,!0)&&(r.containsVisibleDifference=!0),et(Vm(a,n))}static postProcess(t,n){try{Jt.diffArrays(t,n,"boundElements",r=>r.id)}catch(r){if(console.error("Couldn't postprocess elements change deltas."),L.DEV||L.MODE===Ji.TEST)throw r}finally{return[t,n]}}static stripIrrelevantProps(t){let{id:n,updated:r,version:i,versionNonce:a,seed:o,...s}=t;return s}};S();var ng=class{subscribers=[];on(...t){let n=t.flat().filter(r=>typeof r=="function");return this.subscribers.push(...n),()=>this.off(n)}once(...t){let n=t.flat().filter(i=>typeof i=="function");n.push(()=>r());let r=this.on(...n);return r}off(...t){let n=t.flat();this.subscribers=this.subscribers.filter(r=>!n.includes(r))}trigger(...t){for(let n of this.subscribers)n(...t);return this}clear(){this.subscribers=[]}};var OD="__observedAppState",Km=e=>{let t={name:e.name,editingGroupId:e.editingGroupId,viewBackgroundColor:e.viewBackgroundColor,selectedElementIds:e.selectedElementIds,selectedGroupIds:e.selectedGroupIds,editingLinearElementId:e.editingLinearElement?.elementId||null,selectedLinearElementId:e.selectedLinearElement?.elementId||null};return Reflect.defineProperty(t,OD,{value:!0,enumerable:!1}),t},Hq=e=>!!Reflect.get(e,OD),iu={CAPTURE:"capture",UPDATE:"update",NONE:"none"},Sw=class{constructor(t,n){this.elementsChange=t;this.appStateChange=n}},RD=class{onStoreIncrementEmitter=new ng;scheduledActions=new Set;_snapshot=rg.empty();get snapshot(){return this._snapshot}set snapshot(t){this._snapshot=t}shouldCaptureIncrement=()=>{this.scheduleAction(iu.CAPTURE)};shouldUpdateSnapshot=()=>{this.scheduleAction(iu.UPDATE)};scheduleAction=t=>{this.scheduledActions.add(t),this.satisfiesScheduledActionsInvariant()};commit=(t,n)=>{try{this.scheduledActions.has(iu.CAPTURE)?this.captureIncrement(t,n):this.scheduledActions.has(iu.UPDATE)&&this.updateSnapshot(t,n)}finally{this.satisfiesScheduledActionsInvariant(),this.scheduledActions=new Set}};captureIncrement=(t,n)=>{let r=this.snapshot,i=this.snapshot.maybeClone(t,n);if(r!==i){let a=i.meta.didElementsChange?Zm.calculate(r.elements,i.elements):Zm.empty(),o=i.meta.didAppStateChange?Ym.calculate(r.appState,i.appState):Ym.empty();(!a.isEmpty()||!o.isEmpty())&&this.onStoreIncrementEmitter.trigger(new Sw(a,o)),this.snapshot=i}};updateSnapshot=(t,n)=>{let r=this.snapshot.maybeClone(t,n);this.snapshot!==r&&(this.snapshot=r)};filterUncomittedElements=(t,n)=>{for(let[r,i]of t.entries()){if(!n.get(r))continue;let o=this.snapshot.elements.get(r);o?o.version<i.version&&n.set(r,o):n.delete(r)}return n};clear=()=>{this.snapshot=rg.empty(),this.scheduledActions=new Set};satisfiesScheduledActionsInvariant=()=>{if(!(this.scheduledActions.size>=0&&this.scheduledActions.size<=3)){let t=`There can be at most three store actions scheduled at the same time, but there are "${this.scheduledActions.size}".`;if(console.error(t,this.scheduledActions.values()),L.DEV||L.MODE===Ji.TEST)throw new Error(t)}}},rg=class e{constructor(t,n,r={didElementsChange:!1,didAppStateChange:!1,isEmpty:!1}){this.elements=t;this.appState=n;this.meta=r}static empty(){return new e(new Map,Km(Gs()),{didElementsChange:!1,didAppStateChange:!1,isEmpty:!0})}isEmpty(){return this.meta.isEmpty}maybeClone(t,n){let r=this.maybeCreateElementsSnapshot(t),i=this.maybeCreateAppStateSnapshot(n),a=!1,o=!1;return this.elements!==r&&(a=!0),this.appState!==i&&(o=!0),!a&&!o?this:new e(r,i,{didElementsChange:a,didAppStateChange:o})}maybeCreateAppStateSnapshot(t){if(!t)return this.appState;let n=Hq(t)?t:Km(t);return this.detectChangedAppState(n)?n:this.appState}detectChangedAppState(t){return!Fo(this.appState,t,{selectedElementIds:Fo,selectedGroupIds:Fo})}maybeCreateElementsSnapshot(t){return t?this.detectChangedElements(t)?this.createElementsSnapshot(t):this.elements:this.elements}detectChangedElements(t){if(this.elements===t)return!1;if(this.elements.size!==t.size)return!0;let n=Array.from(t.keys());for(let r=n.length-1;r>=0;r--){let i=this.elements.get(n[r]),a=t.get(n[r]);if(!i||!a||i.id!==a.id||i.versionNonce!==a.versionNonce)return!0}return!1}createElementsSnapshot(t){let n=new Map;for(let[r,i]of this.elements.entries())t.get(r)?n.set(r,i):n.set(r,Ai(i,{isDeleted:!0}));for(let[r,i]of t.entries()){let a=n.get(r);(!a||a&&a.versionNonce!==i.versionNonce)&&n.set(r,Um(i))}return n}};var Ko=new Map,Uq=/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)(?:\?t=|&t=|\?start=|&start=)?([a-zA-Z0-9_-]+)?[^\s]*$/,Gq=/^(?:http(?:s)?:\/\/)?(?:(?:w){3}\.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/,jq=/^https:\/\/(?:www\.)?figma\.com/,ND=/^https:\/\/gist\.github\.com\/([\w_-]+)\/([\w_-]+)/,Wq=/^<script[\s\S]*?\ssrc=["'](https:\/\/gist\.github\.com\/.*?)\.js["']/i,$D=/(?:https?:\/\/)?(?:(?:w){3}\.)?(?:twitter|x)\.com\/[^/]+\/status\/(\d+)/,Vq=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:twitter|x)\.com\/[^"']*)/i,Yq=/^https:\/\/(?:www\.)?val\.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/,Zq=/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i,FD=/giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/,Cw=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","figma.com","link.excalidraw.com","gist.github.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com","val.town","giphy.com"]),BD=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","figma.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com"]),zD=e=>`<html><body>${e}</body></html>`,HD=e=>{if(!e)return null;if(Ko.has(e))return Ko.get(e);let t=e,n=BD.has(Tw(e,BD)||""),r="generic",i={w:560,h:840},a=e.match(Uq);if(a?.[2]){let c=a[3]?`&start=${a[3]}`:"",d=e.includes("shorts");switch(r="video",a[1]){case"embed/":case"watch?v=":case"shorts/":e=`https://www.youtube.com/embed/${a[2]}?enablejsapi=1${c}`;break;case"playlist?list=":case"embed/videoseries?list=":e=`https://www.youtube.com/embed/videoseries?list=${a[2]}&enablejsapi=1${c}`;break;default:e=`https://www.youtube.com/embed/${a[2]}?enablejsapi=1${c}`;break}return i=d?{w:315,h:560}:{w:560,h:315},Ko.set(t,{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}}let o=e.match(Gq);if(o?.[1]){let c=o?.[1],d=/^\d+$/.test(c)?void 0:new URIError("Invalid embed link format");return r="video",e=`https://player.vimeo.com/video/${c}?api=1`,i={w:560,h:315},Ko.set(t,{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:r,error:d,sandbox:{allowSameOrigin:n}}}if(e.match(jq))return r="generic",e=`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(e)}`,i={w:550,h:550},Ko.set(t,{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}};let l=e.match(Yq);if(l)return e=l[1]==="embed"?l[0]:l[0].replace("/v","/embed"),Ko.set(t,{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}};if($D.test(e)){let c=e.match($D)[1],d=K0(`https://twitter.com/x/status/${c}`),u={type:"document",srcdoc:h=>zD(`<blockquote class="twitter-tweet" data-dnt="true" data-theme="${h}"><a href="${d}"></a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>`),intrinsicSize:{w:480,h:480},sandbox:{allowSameOrigin:n}};return Ko.set(t,u),u}if(ND.test(e)){let[,c,d]=e.match(ND),u=K0(`https://gist.github.com/${c}/${d}`),h={type:"document",srcdoc:()=>zD(`
30
+ <script src="${u}.js"><\/script>
31
+ <style type="text/css">
32
+ * { margin: 0px; }
33
+ table, .gist { height: 100%; }
34
+ .gist .gist-file { height: calc(100vh - 2px); padding: 0px; display: grid; grid-template-rows: 1fr auto; }
35
+ </style>
36
+ `),intrinsicSize:{w:550,h:720},sandbox:{allowSameOrigin:n}};return Ko.set(e,h),h}return Ko.set(e,{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}},ig=e=>{let t;bm(e)?t="IFrame element":t=!e.link||e?.link===""?"Empty Web-Embed":e.link;let n=Math.max(Math.min(e.width/2,e.width/t.length),e.width/30),r=_n.Helvetica,i=Rn({fontSize:n,fontFamily:r});return io({x:e.x+e.width/2,y:e.y+e.height/2,strokeColor:e.strokeColor!=="transparent"?e.strokeColor:"black",backgroundColor:"transparent",fontFamily:r,fontSize:n,text:Xd(t,i,e.width-20),textAlign:"center",verticalAlign:Oo.MIDDLE,angle:e.angle??0})},$fe=vD({name:"setEmbeddableAsActiveTool",trackEvent:{category:"toolbar"},target:"Tool",label:"toolBar.embeddable",perform:(e,t,n,r)=>{let i=gm(t,{type:"embeddable"});return CD(r.canvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:gm(t,{type:"embeddable"})},storeAction:iu.NONE}}}),Tw=(e,t)=>{try{let{hostname:n}=new URL(e),r=n.replace(/^www\./,"");if(t instanceof Set){if(Cw.has(r))return r;let a=r.replace(/^([^.]+)/,"*");return Cw.has(a)?a:null}let i=t.replace(/^www\./,"");if(r===i)return i}catch{}return null},Ffe=e=>{let t=e.match(Vq);if(t&&t.length===2)return t[1];let n=e.match(Wq);if(n&&n.length===2)return n[1];if(FD.test(e))return`https://giphy.com/embed/${FD.exec(e)[1]}`;let r=e.match(Zq);return r&&r.length===2?r[1]:e},Bfe=(e,t)=>{if(!e)return!1;if(t!=null)if(typeof t=="function"){let n=t(e);if(typeof n=="boolean")return n}else{if(typeof t=="boolean")return t;if(t instanceof RegExp)return t.test(e);if(Array.isArray(t)){for(let n of t)if(n instanceof RegExp){if(e.match(n))return!0}else if(Tw(e,n))return!0;return!1}}return!!Tw(e,Cw)};var Xm=(e,t,n)=>{if(typeof n>"u")return e.draw(t);let r={sets:t.sets,shape:t.shape,options:{...t.options,fixedDecimalPlaceDigits:n}};return e.draw(r)},qm=(e,t,n,r,i)=>{if(!r.enabled||!r.clip)return null;let a=Fr(e,i);if(a){let o=t.ownerDocument.createElementNS(xt,"g");return o.setAttributeNS(xt,"clip-path",`url(#${a.id})`),n.forEach(s=>o.appendChild(s)),o}return null},ag=(e,t,n,r,i,a,o,s)=>{let l={x:a,y:o},[c,d,u,h]=Me(e,t),m=(u-c)/2-(e.x-c),p=(h-d)/2-(e.y-d);if(He(e)){let y=wr(e,t);if(pt(y)){let[w,C,A,T]=Me(y,t),I=st.getBoundTextElementPosition(y,e,t);m=(A-w)/2-(I.x-w),p=(T-C)/2-(I.y-C),a=a+I.x-e.x,o=o+I.y-e.y}}let f=180*e.angle/Math.PI,g=r;if(e.link){let y=r.ownerDocument.createElementNS(xt,"a");y.setAttribute("href",eu(e.link)),g.appendChild(y),g=y}let b=(y,w)=>{$o()&&y.setAttribute("data-id",w.id),g.appendChild(y)},v=(Fr(e,t)?.opacity??100)*e.opacity/1e4;switch(e.type){case"selection":throw new Error("Selection rendering is not supported for SVG");case"rectangle":case"diamond":case"ellipse":{let y=an.generateElementShape(e,null),w=Xm(n,y,Fd);v!==1&&(w.setAttribute("stroke-opacity",`${v}`),w.setAttribute("fill-opacity",`${v}`)),w.setAttribute("stroke-linecap","round"),w.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`);let C=qm(e,g,[w],s.frameRendering,t);b(C||w,e);break}case"iframe":case"embeddable":{let y=an.generateElementShape(e,s),w=Xm(n,y,Fd),C=e.opacity/100;C!==1&&(w.setAttribute("stroke-opacity",`${C}`),w.setAttribute("fill-opacity",`${C}`)),w.setAttribute("stroke-linecap","round"),w.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`),b(w,e);let A=ig(e);ag(A,t,n,g,i,A.x+l.x-e.x,A.y+l.y-e.y,s);let T=Xm(n,y,Fd);for(T.setAttribute("stroke-linecap","round"),T.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`);T.firstChild;)T.removeChild(T.firstChild);let I=Vo(Math.min(e.width,e.height),e),k=HD(bD(e.link||""));if(s.renderEmbeddables===!1||k?.type==="document"){let R=r.ownerDocument.createElementNS(xt,"a");R.setAttribute("href",eu(e.link||"")),R.setAttribute("target","_blank"),R.setAttribute("rel","noopener noreferrer"),R.style.borderRadius=`${I}px`,T.appendChild(R)}else{let R=r.ownerDocument.createElementNS(xt,"foreignObject");R.style.width=`${e.width}px`,R.style.height=`${e.height}px`,R.style.border="none";let O=R.ownerDocument.createElementNS(xt,"div");O.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),O.style.width="100%",O.style.height="100%";let P=O.ownerDocument.createElement("iframe");P.src=k?.link??"",P.style.width="100%",P.style.height="100%",P.style.border="none",P.style.borderRadius=`${I}px`,P.style.top="0",P.style.left="0",P.allowFullscreen=!0,O.appendChild(P),R.appendChild(O),T.appendChild(R)}b(T,e);break}case"line":case"arrow":{let y=ft(e,t),w=r.ownerDocument.createElementNS(xt,"mask");if(y){w.setAttribute("id",`mask-${e.id}`);let I=r.ownerDocument.createElementNS(xt,"rect");a=a||0,o=o||0,I.setAttribute("x","0"),I.setAttribute("y","0"),I.setAttribute("fill","#fff"),I.setAttribute("width",`${e.width+100+a}`),I.setAttribute("height",`${e.height+100+o}`),w.appendChild(I);let k=r.ownerDocument.createElementNS(xt,"rect"),R=st.getBoundTextElementPosition(e,y,t),O=a+R.x-e.x,P=o+R.y-e.y;k.setAttribute("x",O.toString()),k.setAttribute("y",P.toString()),k.setAttribute("fill","#000"),k.setAttribute("width",`${y.width}`),k.setAttribute("height",`${y.height}`),k.setAttribute("opacity","1"),w.appendChild(k)}let C=r.ownerDocument.createElementNS(xt,"g");y&&C.setAttribute("mask",`url(#mask-${e.id})`),C.setAttribute("stroke-linecap","round"),an.generateElementShape(e,s).forEach(I=>{let k=Xm(n,I,Fd);v!==1&&(k.setAttribute("stroke-opacity",`${v}`),k.setAttribute("fill-opacity",`${v}`)),k.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`),e.type==="line"&&to(e.points)&&e.backgroundColor!=="transparent"&&k.setAttribute("fill-rule","evenodd"),C.appendChild(k)});let T=qm(e,g,[C,w],s.frameRendering,t);T?(b(T,e),g.appendChild(T)):(b(C,e),g.append(w));break}case"freedraw":{let y=an.generateElementShape(e,s),w=y?Xm(n,y,Fd):r.ownerDocument.createElementNS(xt,"g");v!==1&&(w.setAttribute("stroke-opacity",`${v}`),w.setAttribute("fill-opacity",`${v}`)),w.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`),w.setAttribute("stroke","none");let C=r.ownerDocument.createElementNS(xt,"path");C.setAttribute("fill",e.strokeColor),C.setAttribute("d",mw(e)),w.appendChild(C);let A=qm(e,g,[w],s.frameRendering,t);b(A||w,e);break}case"image":{let y=Math.round(e.width),w=Math.round(e.height),C=qa(e)&&i[e.fileId];if(C){let A=`image-${C.id}`,T=r.querySelector(`#${A}`);if(!T){T=r.ownerDocument.createElementNS(xt,"symbol"),T.id=A;let O=r.ownerDocument.createElementNS(xt,"image");O.setAttribute("width","100%"),O.setAttribute("height","100%"),O.setAttribute("href",C.dataURL),T.appendChild(O),g.prepend(T)}let I=r.ownerDocument.createElementNS(xt,"use");if(I.setAttribute("href",`#${A}`),s.exportWithDarkMode&&C.mimeType!==Te.svg&&I.setAttribute("filter",uw),I.setAttribute("width",`${y}`),I.setAttribute("height",`${w}`),I.setAttribute("opacity",`${v}`),e.scale[0]!==1||e.scale[1]!==1){let O=e.scale[0]!==1?-y:0,P=e.scale[1]!==1?-w:0;I.setAttribute("transform",`scale(${e.scale[0]}, ${e.scale[1]}) translate(${O} ${P})`)}let k=r.ownerDocument.createElementNS(xt,"g");if(k.appendChild(I),k.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`),e.roundness){let O=r.ownerDocument.createElementNS(xt,"clipPath");O.id=`image-clipPath-${e.id}`;let P=r.ownerDocument.createElementNS(xt,"rect"),F=Vo(Math.min(e.width,e.height),e);P.setAttribute("width",`${e.width}`),P.setAttribute("height",`${e.height}`),P.setAttribute("rx",`${F}`),P.setAttribute("ry",`${F}`),O.appendChild(P),b(O,e),k.setAttributeNS(xt,"clip-path",`url(#${O.id})`)}let R=qm(e,g,[k],s.frameRendering,t);b(R||k,e)}break}case"frame":case"magicframe":{if(s.frameRendering.enabled&&s.frameRendering.outline){let y=document.createElementNS(xt,"rect");y.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`),y.setAttribute("width",`${e.width}px`),y.setAttribute("height",`${e.height}px`),y.setAttribute("rx",jn.radius.toString()),y.setAttribute("ry",jn.radius.toString()),y.setAttribute("fill","none"),y.setAttribute("stroke",jn.strokeColor),y.setAttribute("stroke-width",jn.strokeWidth.toString()),b(y,e)}break}default:if(He(e)){let y=r.ownerDocument.createElementNS(xt,"g");v!==1&&(y.setAttribute("stroke-opacity",`${v}`),y.setAttribute("fill-opacity",`${v}`)),y.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`);let w=e.text.replace(/\r\n?/g,`
37
+ `).split(`
38
+ `),C=Kd(e.fontSize,e.lineHeight),A=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,T=z0(e.fontFamily,e.fontSize,C),I=u0(e.text)?"rtl":"ltr",k=e.textAlign==="center"?"middle":e.textAlign==="right"||I==="rtl"?"end":"start";for(let O=0;O<w.length;O++){let P=r.ownerDocument.createElementNS(xt,"text");P.textContent=w[O],P.setAttribute("x",`${A}`),P.setAttribute("y",`${O*C+T}`),P.setAttribute("font-family",gx(e)),P.setAttribute("font-size",`${e.fontSize}px`),P.setAttribute("fill",e.strokeColor),P.setAttribute("text-anchor",k),P.setAttribute("style","white-space: pre;"),P.setAttribute("direction",I),P.setAttribute("dominant-baseline","alphabetic"),y.appendChild(P)}let R=qm(e,g,[y],s.frameRendering,t);b(R||y,e)}else throw new Error(`Unimplemented type ${e.type}`)}},UD=(e,t,n,r,i,a)=>{r&&(e.filter(o=>!ta(o)).forEach(o=>{if(!o.isDeleted){if(He(o)&&o.containerId&&t.has(o.containerId))return;try{ag(o,t,n,r,i,o.x+a.offsetX,o.y+a.offsetY,a);let s=ft(o,t);s&&ag(s,t,n,r,i,s.x+a.offsetX,s.y+a.offsetY,a)}catch(s){console.error(s)}}}),e.filter(o=>ta(o)).forEach(o=>{if(!o.isDeleted)try{ag(o,t,n,r,i,o.x+a.offsetX,o.y+a.offsetY,a)}catch(s){console.error(s)}}))};S();S();S();var da=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{}catch{return!1}else if("showOpenFilePicker"in self)return"showOpenFilePicker";return!1})(),Kq=da?import("./file-open-002ab408-WLX7QPS6.js"):import("./file-open-7c801643-YB6IH3XI.js");async function og(...e){return(await Kq).default(...e)}var n1e=da?import("./directory-open-4ed118d0-FGQD6TMW.js"):import("./directory-open-01563666-UG2J4T6L.js");var Xq=da?import("./file-save-745eba88-UZEDMFLR.js"):import("./file-save-3189631c-MRYCXU63.js");async function sg(...e){return(await Xq).default(...e)}var GD=500,jD=e=>{let t=e.extensions?.reduce((r,i)=>(r.push(Te[i]),r),[]),n=e.extensions?.reduce((r,i)=>i==="jpg"?r.concat(".jpg",".jpeg"):r.concat(`.${i}`),[]);return og({description:e.description,extensions:n,mimeTypes:t,multiple:e.multiple??!1,legacySetup:(r,i,a)=>{let o=C7(i,GD),s=()=>{l(),document.addEventListener("keyup",o),document.addEventListener("pointerup",o),o()},l=()=>{if(a.files?.length){let d=e.multiple?[...a.files]:a.files[0];r(d)}};requestAnimationFrame(()=>{window.addEventListener("focus",s)});let c=window.setInterval(()=>{l()},GD);return d=>{clearInterval(c),o.cancel(),window.removeEventListener("focus",s),document.removeEventListener("keyup",o),document.removeEventListener("pointerup",o),d&&(console.warn("Opening the file was canceled (legacy-fs)."),d(new eg))}}})},Iw=(e,t)=>sg(e,{fileName:`${t.name}.${t.extension}`,description:t.description,extensions:[`.${t.extension}`]},t.fileHandle);var qq=(e,t)=>{let n={};for(let r of e)!r.isDeleted&&"fileId"in r&&r.fileId&&t[r.fileId]&&(n[r.fileId]=t[r.fileId]);return n},Qm=(e,t,n,r)=>{let i={type:Or.excalidraw,version:hx.excalidraw,source:ux,elements:r==="local"?lg(e):ZD(e),appState:r==="local"?c0(t):b7(t),files:r==="local"?qq(e,n):void 0};return JSON.stringify(i,null,2)},b1e=async(e,t,n,r=t.name||E7)=>{let i=Qm(e,t,n,"local"),a=new Blob([i],{type:Te.excalidraw});return{fileHandle:await Iw(a,{name:r,extension:"excalidraw",description:"Excalidraw file",fileHandle:WD(t.fileHandle)?null:t.fileHandle})}},y1e=async(e,t)=>{let n=await jD({description:"Excalidraw files"});return VD(await Mw(n),e,t,n.handle)},YD=e=>e?.type===Or.excalidraw&&(!e.elements||Array.isArray(e.elements)&&(!e.appState||typeof e.appState=="object")),Aw=e=>typeof e=="object"&&e&&e.type===Or.excalidrawLibrary&&(e.version===1||e.version===2),Qq=e=>{let t={type:Or.excalidrawLibrary,version:hx.excalidrawLibrary,source:ux,libraryItems:e};return JSON.stringify(t,null,2)},v1e=async e=>{let t=Qq(e);await Iw(new Blob([t],{type:Te.excalidrawlib}),{name:"library",extension:"excalidrawlib",description:"Excalidraw library file"})};S();var Jq=e=>new Promise((t,n)=>{let r=new Image;r.onload=()=>{t(r)},r.onerror=i=>{n(i)},r.src=e}),KD=async({fileIds:e,files:t,imageCache:n})=>{let r=new Map,i=new Map;return await Promise.all(e.reduce((a,o)=>{let s=t[o];return s&&!r.has(o)?(r.set(o,!0),a.concat((async()=>{try{if(s.mimeType===Te.binary)throw new Error("Only images can be added to ImageCache");let l=Jq(s.dataURL),c={image:l,mimeType:s.mimeType};n.set(o,c);let d=await l;n.set(o,{...c,image:d})}catch{i.set(o,!0)}})())):a},[])),{imageCache:n,updatedFiles:r,erroredFiles:i}},XD=e=>e.filter(t=>qa(t)),eQ=e=>e?.nodeName.toLowerCase()==="svg",T1e=async e=>{let t=new DOMParser().parseFromString(e,Te.svg),n=t.querySelector("svg");if(t.querySelector("parsererror")||!eQ(n))throw new Error("Invalid SVG");if(n.hasAttribute("xmlns")||n.setAttribute("xmlns",xt),!n.hasAttribute("width")||!n.hasAttribute("height")){let i=n.getAttribute("viewBox"),a=n.getAttribute("width")||"50",o=n.getAttribute("height")||"50";if(i){let s=i.match(/\d+ +\d+ +(\d+) +(\d+)/);s&&([,a,o]=s)}n.setAttribute("width",a),n.setAttribute("height",o)}return n.outerHTML};S();var tQ={selection:!0,text:!0,rectangle:!0,diamond:!0,ellipse:!0,line:!0,image:!0,arrow:!0,freedraw:!0,eraser:!1,custom:!0,frame:!0,embeddable:!0,hand:!0,laser:!1,magicframe:!1},nQ=e=>Object.keys(_n).includes(e)?_n[e]:ea,qD=e=>e?{...e,focus:e.focus||0}:null,au=(e,t)=>{let n={type:t.type||e.type,version:e.version||1,versionNonce:e.versionNonce??0,index:e.index??null,isDeleted:e.isDeleted??!1,id:e.id||ca(),fillStyle:e.fillStyle||Ot.fillStyle,strokeWidth:e.strokeWidth||Ot.strokeWidth,strokeStyle:e.strokeStyle??Ot.strokeStyle,roughness:e.roughness??Ot.roughness,opacity:e.opacity==null?Ot.opacity:e.opacity,angle:e.angle||0,x:t.x??e.x??0,y:t.y??e.y??0,strokeColor:e.strokeColor||Ot.strokeColor,backgroundColor:e.backgroundColor||Ot.backgroundColor,width:e.width||0,height:e.height||0,seed:e.seed??1,groupIds:e.groupIds??[],frameId:e.frameId??null,roundness:e.roundness?e.roundness:e.strokeSharpness==="round"?{type:f0(e.type)?Qr.LEGACY:Qr.PROPORTIONAL_RADIUS}:null,boundElements:e.boundElementIds?e.boundElementIds.map(r=>({type:"arrow",id:r})):e.boundElements??[],updated:e.updated??No(),link:e.link?eu(e.link):null,locked:e.locked??!1};return("customData"in e||"customData"in t)&&(n.customData="customData"in t?t.customData:e.customData),{...n,...Pw(n),...t}},rQ=e=>{switch(e.type){case"text":let t=e.fontSize,n=e.fontFamily;if("font"in e){let[a,o]=e.font.split(" ");t=parseFloat(a),n=nQ(o)}let r=typeof e.text=="string"&&e.text||"",i=e.lineHeight||(e.height?UP(e):H0(e.fontFamily));return e=au(e,{fontSize:t,fontFamily:n,text:r,textAlign:e.textAlign||Nd,verticalAlign:e.verticalAlign||i0,containerId:e.containerId??null,originalText:e.originalText||r,lineHeight:i}),!r&&!e.isDeleted&&(e={...e,originalText:r,isDeleted:!0},e=Gm(e)),e;case"freedraw":return au(e,{points:e.points,lastCommittedPoint:null,simulatePressure:e.simulatePressure,pressures:e.pressures});case"image":return au(e,{status:e.status||"pending",fileId:e.fileId,scale:e.scale||[1,1]});case"line":case"draw":case"arrow":{let{startArrowhead:a=null,endArrowhead:o=e.type==="arrow"?"arrow":null}=e,s=e.x,l=e.y,c=!Array.isArray(e.points)||e.points.length<2?[[0,0],[e.width,e.height]]:e.points;return(c[0][0]!==0||c[0][1]!==0)&&({points:c,x:s,y:l}=st.getNormalizedPoints(e)),au(e,{type:e.type==="draw"?"line":e.type,startBinding:qD(e.startBinding),endBinding:qD(e.endBinding),lastCommittedPoint:null,startArrowhead:a,endArrowhead:o,points:c,x:s,y:l})}case"ellipse":case"rectangle":case"diamond":case"iframe":case"embeddable":return au(e,{});case"magicframe":case"frame":return au(e,{name:e.name??null})}return null},iQ=(e,t)=>{if(e.boundElements){let n=e.boundElements.slice(),r=new Set;e.boundElements=n.reduce((i,a)=>{let o=t.get(a.id);if(o&&!r.has(a.id)){if(r.add(a.id),o.isDeleted)return i;i.push(a),He(o)&&!o.containerId&&(o.containerId=e.id)}return i},[])}},aQ=(e,t)=>{let n=e.containerId?t.get(e.containerId):null;if(!n){e.containerId=null;return}if(!e.isDeleted&&n.boundElements&&!n.boundElements.find(r=>r.id===e.id)){let r=(n.boundElements||(n.boundElements=[])).slice();r.push({type:"text",id:e.id}),n.boundElements=r}},oQ=(e,t)=>{e.frameId&&(t.get(e.frameId)||(e.frameId=null))},e_=(e,t,n)=>{let r=new Set,i=t?et(t):null,a=vc((e||[]).reduce((s,l)=>{if(l.type!=="selection"&&!Jm(l)){let c=rQ(l);if(c){let d=i?.get(l.id);d&&d.version>c.version&&(c=Gm(c,d.version)),r.has(c.id)&&(c={...c,id:ca()}),r.add(c.id),s.push(c)}}return s},[]));if(!n?.repairBindings)return a;let o=et(a);for(let s of a)s.frameId&&oQ(s,o),He(s)&&s.containerId?aQ(s,o):s.boundElements&&iQ(s,o),n.refreshDimensions&&He(s)&&Object.assign(s,Q0(s,wr(s,o),o));return a},sQ=(e,t,n)=>{let r=t[e];return r!==void 0?r:n[e]},QD={isSidebarDocked:(e,t)=>["defaultSidebarDockedPreference",e.isSidebarDocked??sQ("defaultSidebarDockedPreference",e,t)]},kw=(e,t)=>{e=e||{};let n=Gs(),r={};for(let i of Object.keys(QD))if(i in e){let[a,o]=QD[i](e,n);r[a]=o}for(let[i,a]of Object.entries(n)){let o=e[i],s=t?t[i]:void 0;r[i]=o!==void 0?o:s!==void 0?s:a}return{...r,cursorButton:t?.cursorButton||"up",penDetected:t?.penDetected??(e.penMode?e.penDetected??!1:!1),activeTool:{...gm(n,r.activeTool.type&&tQ[r.activeTool.type]?r.activeTool:{type:"selection"}),lastActiveTool:null,locked:r.activeTool.locked??!1},zoom:typeof e.zoom=="number"?{value:e.zoom}:e.zoom?.value?e.zoom:n.zoom,openSidebar:typeof e.openSidebar=="string"?{name:g7.name}:r.openSidebar}},cg=(e,t,n,r)=>({elements:e_(e?.elements,n,r),appState:kw(e?.appState,t||null),files:e?.files||{}}),JD=e=>{let t=e_(Dw(e.elements),null);return t.length?{...e,elements:t}:null},t_=(e=[],t)=>{let n=[];for(let r of e)if(Array.isArray(r)){let i=JD({status:t,elements:r,id:ca(),created:Date.now()});i&&n.push(i)}else{let i=r,a=JD({...i,id:i.id||ca(),status:i.status||t,created:i.created||Date.now()});a&&n.push(a)}return n};S();S();S();S();var n_=e=>{let{angle:t,width:n,height:r,x:i,y:a}=e,o=Ja(t),s=i+n/2,l=a+r/2,c=[s,l],d=[];return e.type==="diamond"?d=[rn([s,a],o,c),rn([i+n,l],o,c),rn([s,a+r],o,c),rn([i,l],o,c)]:d=[rn([i,a],o,c),rn([i+n,a],o,c),rn([i+n,a+r],o,c),rn([i,a+r],o,c)],{type:"polygon",data:d}},W1e=(e,t,n=10)=>{let[r,i,a,o,s,l]=Me(e,t,!0);r-=n,a+=n,i-=n,o+=n;let c=Ja(e.angle),d=[s,l],u=rn([r,i],c,d),h=rn([a,i],c,d),m=rn([r,o],c,d),p=rn([a,o],c,d);return{type:"polygon",data:[u,h,p,m]}},V1e=e=>{let{width:t,height:n,angle:r,x:i,y:a}=e;return{type:"ellipse",data:{center:[i+t/2,a+n/2],angle:r,halfWidth:t/2,halfHeight:n/2}}},r_=e=>{for(let t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},Y1e=(e,t=[0,0],n,r)=>{let i=l=>rn([l[0]+t[0],l[1]+t[1]],Ja(n),r),a=r_(e),o=[],s=[0,0];for(let l of a)if(l.op==="move"&&(s=i(l.data)),l.op==="bcurveTo"){let c=i([l.data[0],l.data[1]]),d=i([l.data[2],l.data[3]]),u=i([l.data[4],l.data[5]]);o.push([s,c,d,u]),s=u}return{type:"polycurve",data:o}},lQ=e=>{let t=e[0],n=[];for(let r=1;r<e.length;r++){let i=e[r];n.push([t,i]),t=i}return n},Z1e=(e,t,n=!1)=>{let r=Ja(e.angle),i=o=>rn($x(o,[e.x,e.y]),r,t),a=lQ(e.points.map(o=>i(o)));return n?{type:"polygon",data:Yd(a.flat())}:{type:"polyline",data:a}},K1e=(e,t,n=[0,0],r,i)=>{let a=d=>rn([d[0]+n[0],d[1]+n[1]],Ja(r),i);if(e.roundness===null)return{type:"polygon",data:Yd(e.points.map(d=>a(d)))};let o=r_(t),s=[],l=!1;for(let d of o)d.op==="move"?(l=!l,l&&s.push([d.data[0],d.data[1]])):d.op==="bcurveTo"?l&&(s.push([d.data[0],d.data[1]]),s.push([d.data[2],d.data[3]]),s.push([d.data[4],d.data[5]])):d.op==="lineTo"&&l&&s.push([d.data[0],d.data[1]]);return{type:"polygon",data:Ud(s,10,5).map(d=>a(d))}};var cQ=e=>{if(e.type==="arrow")return!1;let t=!js(e.backgroundColor)||zd(e)||ta(e)||He(e);return e.type==="line"?t&&to(e.points):e.type==="freedraw"?t&&to(e.points):t||m0(e)},dQ=({x:e,y:t,element:n,shape:r,threshold:i=10,frameNameBound:a=null})=>{let o=cQ(n)?L0([e,t],r)||Pm([e,t],r,i):Pm([e,t],r,i);return!o&&a&&(o=L0([e,t],{type:"polygon",data:n_(a).data})),o},_w=(e,t,n,r,i=0)=>{let[a,o,s,l]=ii(n,r);return a-=i,o-=i,s+=i,l+=i,Y0([a,o],[e,t],[s,l])},o0e=(e,t)=>!dQ(e)&&_w(e.x,e.y,e.element,t),s0e=(e,t,n)=>n&&L0([e,t],n);var Lw=document.createElement("img");Lw.src=`data:${Te.svg}, ${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1971c2" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>')}`;var Rw=([e,t,n,r],i,a)=>{let o=JP,s=o/a.zoom.value,l=o/a.zoom.value,c=o/a.zoom.value,d=(e+n)/2,u=(t+r)/2,h=(o-8)/(2*a.zoom.value),m=4/a.zoom.value,p=n+m-h,f=t-m-c+h,[g,b]=Fe(p+s/2,f+l/2,d,u,i);return[g-s/2,b-l/2,s,l]},uQ=(e,t,n,[r,i])=>{let a=4/n.zoom.value,[o,s,l,c]=Me(e,t),[d,u,h,m]=Rw([o,s,l,c],e.angle,n);return r>d-a&&r<d+a+h&&i>u-a&&i<u+m+a},g0e=(e,t,n,[r,i],a)=>!e.link||n.selectedElementIds[e.id]?!1:!a&&n.viewModeEnabled&&_w(r,i,e,t)?!0:uQ(e,t,n,[r,i]);S();var v0e=(e,t,n,r,i=!0)=>{e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill(),i&&e.stroke()},i_=(e,t)=>[e.width/t,e.height/t],a_=({canvas:e,scale:t,normalizedWidth:n,normalizedHeight:r,theme:i,isExporting:a,canvasBackgroundColor:o})=>{let s=e.getContext("2d");return s.setTransform(1,0,0,1,0,0),s.scale(t,t),a&&i===qr.DARK&&(s.filter=s0),typeof o=="string"?((o==="transparent"||o.length===5||o.length===9||/(hsla|rgba)\(/.test(o))&&s.clearRect(0,0,n,r),s.save(),s.fillStyle=o,s.fillRect(0,0,n,r),s.restore()):s.clearRect(0,0,n,r),s};var hQ=(e,t,n,r,i,a,o)=>{let l={Bold:"#cccccc",Regular:"#e5e5e5"},c=-Math.round(i.value/t)*t+n%t,d=-Math.round(i.value/t)*t+r%t,u=Math.min(1/i.value,1),h=1/i.value,m=[u*3,h+(u+h)];e.save(),e.lineWidth=u;for(let p=c;p<c+a+t*2;p+=t){let f=Math.round(p-n)%(5*t)===0;e.beginPath(),e.setLineDash(f?[]:m),e.strokeStyle=f?l.Bold:l.Regular,e.moveTo(p,d-t),e.lineTo(p,d+o+t*2),e.stroke()}for(let p=d;p<d+o+t*2;p+=t){let f=Math.round(p-r)%(5*t)===0;e.beginPath(),e.setLineDash(f?[]:m),e.strokeStyle=f?l.Bold:l.Regular,e.moveTo(c-t,p),e.lineTo(c+a+t*2,p),e.stroke()}e.restore()},o_=(e,t,n,r)=>{t.translate(e.x+r.scrollX,e.y+r.scrollY),t.beginPath(),t.roundRect?t.roundRect(0,0,e.width,e.height,jn.radius/r.zoom.value):t.rect(0,0,e.width,e.height),t.clip(),t.translate(-(e.x+r.scrollX),-(e.y+r.scrollY))},Xo,s_=(e,t,n,r)=>{if(e.link&&!n.selectedElementIds[e.id]){let[i,a,o,s]=Me(e,r),[l,c,d,u]=Rw([i,a,o,s],e.angle,n),h=l+d/2,m=c+u/2;if(t.save(),t.translate(n.scrollX+h,n.scrollY+m),t.rotate(e.angle),!Xo||Xo.zoom!==n.zoom.value){Xo=document.createElement("canvas"),Xo.zoom=n.zoom.value,Xo.width=d*window.devicePixelRatio*n.zoom.value,Xo.height=u*window.devicePixelRatio*n.zoom.value;let p=Xo.getContext("2d");p.scale(window.devicePixelRatio*n.zoom.value,window.devicePixelRatio*n.zoom.value),p.fillStyle="#fff",p.fillRect(0,0,d,u),p.drawImage(Lw,0,0,d,u),p.restore(),t.drawImage(Xo,l-h,c-m,d,u)}else t.drawImage(Xo,l-h,c-m,d,u);t.restore()}},l_=({canvas:e,rc:t,elementsMap:n,allElementsMap:r,visibleElements:i,scale:a,appState:o,renderConfig:s})=>{if(e===null)return;let{renderGrid:l=!0,isExporting:c}=s,[d,u]=i_(e,a),h=a_({canvas:e,scale:a,normalizedWidth:d,normalizedHeight:u,theme:o.theme,isExporting:c,canvasBackgroundColor:s.canvasBackgroundColor});h.scale(o.zoom.value,o.zoom.value),l&&o.gridSize&&hQ(h,o.gridSize,o.scrollX,o.scrollY,o.zoom,d/o.zoom.value,u/o.zoom.value);let m=new Set;i.forEach(p=>{p.groupIds.length>0&&o.frameToHighlight&&o.selectedElementIds[p.id]&&(el(p,o.frameToHighlight,n)||p.groupIds.find(f=>m.has(f)))&&p.groupIds.forEach(f=>m.add(f))}),i.filter(p=>!ta(p)).forEach(p=>{try{let f=p.frameId||o.frameToHighlight?.id;if(He(p)&&p.containerId&&n.has(p.containerId))return;if(h.save(),f&&o.frameRendering.enabled&&o.frameRendering.clip){let b=dg(p,n,o);b&&ug(p,n,o)&&o_(b,h,s,o),qd(p,n,r,t,h,s,o)}else qd(p,n,r,t,h,s,o);let g=ft(p,n);g&&qd(g,n,r,t,h,s,o),h.restore(),c||s_(p,h,o,n)}catch(f){console.error(f)}}),i.filter(p=>ta(p)).forEach(p=>{try{let f=()=>{if(qd(p,n,r,t,h,s,o),ta(p)&&(c||p0(p)&&s.embedsValidationStatus.get(p.id)!==!0)&&p.width&&p.height){let b=ig(p);qd(b,n,r,t,h,s,o)}c||s_(p,h,o,n)};if((p.frameId||o.frameToHighlight?.id)&&o.frameRendering.enabled&&o.frameRendering.clip){h.save();let b=dg(p,n,o);b&&ug(p,n,o)&&o_(b,h,s,o),f(),h.restore()}else f()}catch(f){console.error(f)}})},mQ=T7(e=>{l_(e)},{trailing:!0}),c_=(e,t)=>{if(t){mQ(e);return}l_(e)};var pQ="<!-- svg-source:excalidraw -->",fQ=(e,t)=>{if(e.width<=t)return e;let r=document.createElement("canvas").getContext("2d");r.font=Rn({fontFamily:e.fontFamily,fontSize:e.fontSize});let i=e.text;if(r.measureText(i).width>t)for(let o=i.length;o>0;o--){let s=`${i.slice(0,o)}...`;if(r.measureText(s).width<=t){i=s;break}}return Ai(e,{text:i,width:t})},gQ=(e,t)=>{let n=[],r=0,i=0;for(let a of e){if(Mt(a)){ym(a)?r++:i++;let o=io({x:a.x,y:a.y-jn.nameOffsetY,fontFamily:_n.Assistant,fontSize:jn.nameFontSize,lineHeight:jn.nameLineHeight,strokeColor:t.exportWithDarkMode?jn.nameColorDarkTheme:jn.nameColorLightTheme,text:p_(a,ym(a)?r:i)});o.y-=o.height,o=fQ(o,a.width),n.push(o)}n.push(a)}return n},d_=(e,t)=>(t=t||Gs().frameRendering,{enabled:e?!0:t.enabled,outline:e?!1:t.outline,name:e?!1:t.name,clip:e?!0:t.clip}),u_=({elements:e,exportingFrame:t,frameRendering:n,exportWithDarkMode:r})=>{let i;return t?i=f_(e,t):n.enabled&&n.name?i=gQ(e,{exportWithDarkMode:r}):i=e,i},Ow=async({data:e,config:t})=>{let n=Object.assign({},t),{files:r}=e,{exportingFrame:i}=n,a=e.elements,o=kw(e.appState,null),s=d_(i??null,o.frameRendering??null),l=u_({elements:a,exportingFrame:i,exportWithDarkMode:o.exportWithDarkMode,frameRendering:s});i&&(n.padding=0),n.fit=n.fit??(n.width!=null||n.height!=null||n.maxWidthOrHeight!=null||n.widthOrHeight!=null?"contain":"none");let c=n.fit==="contain";(n.x!=null||n.x!=null)&&(n.fit="none"),n.fit==="cover"&&(n.padding&&!L.PROD&&console.warn("`padding` is ignored when `fit` is set to `cover`"),n.padding=0),n.padding=n.padding??0,n.scale=n.scale??1,n.origin=n.origin??"canvas",n.position=n.position??"center",n.maxWidthOrHeight!=null&&n.widthOrHeight!=null&&(L.PROD||console.warn("`maxWidthOrHeight` is ignored when `widthOrHeight` is set"),n.maxWidthOrHeight=void 0),(n.maxWidthOrHeight!=null||n.width!=null||n.height!=null)&&n.getDimensions&&(L.PROD||console.warn("`getDimensions` is ignored when `width`, `height`, or `maxWidthOrHeight` is set"),n.getDimensions=void 0);let d=1,u=m_(i?[i]:$w(l)),[h,m,p,f]=u,[g,b,v,y]=u;if(n.width!=null?(v=n.width,n.padding&&c&&(v-=n.padding*2),n.height?(y=n.height,n.padding&&c&&(y-=n.padding*2)):y*=v/p):n.height!=null&&(y=n.height,n.padding&&c&&(y-=n.padding*2),v*=y/f),n.maxWidthOrHeight!=null||n.widthOrHeight!=null){c&&n.padding&&(n.maxWidthOrHeight!=null?n.maxWidthOrHeight-=n.padding*2:n.widthOrHeight!=null&&(n.widthOrHeight-=n.padding*2));let T=Math.max(v,y);n.widthOrHeight!=null?d=n.widthOrHeight/T:n.maxWidthOrHeight!=null&&(d=n.maxWidthOrHeight<T?n.maxWidthOrHeight/T:1),v*=d,y*=d}else if(n.getDimensions){let T=n.getDimensions(v,y);v=T.width,y=T.height,n.scale=T.scale??n.scale}else if(c&&n.padding&&n.width==null&&n.height==null){let T=v/y;v-=n.padding*2,y-=n.padding*2/T}if(n.fit==="contain"&&!n.maxWidthOrHeight||c&&n.padding)if(n.fit==="contain"){let T=v/p,I=y/f;d=Math.min(T,I)}else{let T=(v-n.padding*2)/v,I=(y-n.padding*2)/y;d=Math.min(T,I)}else if(n.fit==="cover"){let T=v/p,I=y/f;d=Math.max(T,I)}g=n.x??h,b=n.y??m,n.origin==="content"&&(n.x!=null&&(g+=h),n.y!=null&&(b+=m)),n.position==="center"&&(g-=v/d/2-(n.x==null?p:v+n.padding*2)/2,b-=y/d/2-(n.y==null?f:y+n.padding*2)/2);let w=n.createCanvas?n.createCanvas():document.createElement("canvas"),C=n.padding/d;d*=n.scale,v*=n.scale,y*=n.scale,w.width=v+n.padding*2*n.scale,w.height=y+n.padding*2*n.scale;let{imageCache:A}=await KD({imageCache:new Map,fileIds:XD(l).map(T=>T.fileId),files:r||{}});return c_({canvas:w,rc:nn.canvas(w),elementsMap:Bo(et(l)),allElementsMap:Bo(et(vc(a))),visibleElements:l,appState:{...o,frameRendering:s,width:v,height:y,offsetLeft:0,offsetTop:0,scrollX:-g+C,scrollY:-b+C,zoom:{value:a0},shouldCacheIgnoreZoom:!1,theme:n.theme||qr.LIGHT},scale:d,renderConfig:{canvasBackgroundColor:n.canvasBackgroundColor===!1?null:n.canvasBackgroundColor||o.viewBackgroundColor||Us,imageCache:A,renderGrid:!1,isExporting:!0,embedsValidationStatus:new Map,elementsPendingErasure:new Set}}),w},h_=async({data:e,config:t})=>{let n=Object.assign({},t);n.exportingFrame=n.exportingFrame??null;let r=e.elements,i=d_(n?.exportingFrame??null,e.appState.frameRendering??null),{exportPadding:a=u7,exportWithDarkMode:o=!1,viewBackgroundColor:s,exportScale:l=1,exportEmbedScene:c}=e.appState,d=u_({elements:r,exportingFrame:n.exportingFrame,exportWithDarkMode:o,frameRendering:i});n.exportingFrame&&(a=0);let u="";if(c)try{u=await(await import("./image-ZKACJTPS.js")).encodeSvgMetadata({text:Qm(r,e.appState,e.files||{},"local")})}catch(k){console.error(k)}let[h,m,p,f]=m_(n.exportingFrame?[n.exportingFrame]:$w(d));p+=a*2,f+=a*2;let g=document.createElementNS(xt,"svg");g.setAttribute("version","1.1"),g.setAttribute("xmlns",xt),g.setAttribute("viewBox",`0 0 ${p} ${f}`),g.setAttribute("width",`${p*l}`),g.setAttribute("height",`${f*l}`),o&&g.setAttribute("filter",s0);let b="https://excalidraw.com/";L.VITE_IS_EXCALIDRAW_NPM_PACKAGE&&(b=window.EXCALIDRAW_ASSET_PATH||`https://unpkg.com/${L.VITE_PKG_NAME}@${L.PKG_VERSION}`,b?.startsWith("/")&&(b=b.replace("/",`${window.location.origin}/`)),b=`${b}/dist/excalidraw-assets/`);let v=-h+a,y=-m+a,w=Nw(r),C="",A=et(r);for(let k of w){let[R,O,P,F]=Me(k,A),Y=(P-R)/2-(k.x-R),j=(F-O)/2-(k.y-O);C+=`<clipPath id=${k.id}>
39
+ <rect transform="translate(${k.x+v} ${k.y+y}) rotate(${k.angle} ${Y} ${j})"
40
+ width="${k.width}"
41
+ height="${k.height}"
42
+ >
43
+ </rect>
44
+ </clipPath>`}if(g.innerHTML=`
45
+ ${pQ}
46
+ ${u}
47
+ <defs>
48
+ <style class="style-fonts">
49
+ @font-face {
50
+ font-family: "Virgil";
51
+ src: url("https://excalidraw.com/Virgil.woff2");
52
+ }
53
+ @font-face {
54
+ font-family: "Cascadia";
55
+ src: url("https://excalidraw.com/Cascadia.woff2");
56
+ }
57
+ @font-face {
58
+ font-family: "Assistant";
59
+ src: url("${b}Assistant-Regular.woff2");
60
+ }
61
+ </style>
62
+ ${C}
63
+ </defs>
64
+ `,e.appState.exportBackground&&s){let k=g.ownerDocument.createElementNS(xt,"rect");k.setAttribute("x","0"),k.setAttribute("y","0"),k.setAttribute("width",`${p}`),k.setAttribute("height",`${f}`),k.setAttribute("fill",s),g.appendChild(k)}let T=nn.svg(g),I=n.renderEmbeddables??!1;return UD(d,Bo(et(d)),T,g,e.files||{},{offsetX:v,offsetY:y,isExporting:!0,exportWithDarkMode:o,renderEmbeddables:I,frameRendering:i,canvasBackgroundColor:s,embedsValidationStatus:I?new Map(d.filter(k=>Mt(k)).map(k=>[k.id,!0])):new Map}),g},m_=e=>{let[t,n,r,i]=$r(e),a=Ii(t,r),o=Ii(n,i);return[t,n,a,o]};S();S();var ua=32,kt=12,tl=256,E_=50,xc="NOT_SPREADSHEET",ou="VALID_SPREADSHEET",ep=e=>{let t=/^([-+]?)[$€£¥₩]?([-+]?)([\d.,]+)[%]?$/.exec(e);return t?parseFloat(`${(t[1]||t[2])+t[3]}`.replace(/,/g,"")):null},Fw=(e,t)=>e.slice(1).every(n=>ep(n[t])!==null),g_=e=>{let t=e[0].length;if(t>2)return{type:xc,reason:"More than 2 columns"};if(t===1){if(!Fw(e,0))return{type:xc,reason:"Value is not numeric"};let l=ep(e[0][0])===null,c=(l?e.slice(1):e).map(d=>ep(d[0]));return c.length<2?{type:xc,reason:"Less than two rows"}:{type:ou,spreadsheet:{title:l?e[0][0]:null,labels:null,values:c}}}let n=Fw(e,0),r=Fw(e,1);if(!n&&!r)return{type:xc,reason:"Value is not numeric"};let[i,a]=r?[0,1]:[1,0],o=ep(e[0][a])===null,s=o?e.slice(1):e;return s.length<2?{type:xc,reason:"Less than 2 rows"}:{type:ou,spreadsheet:{title:o?e[0][a]:null,labels:s.map(l=>l[i]),values:s.map(l=>ep(l[a]))}}},EQ=e=>{let t=[];for(let n=0;n<e[0].length;n++){let r=[];for(let i=0;i<e.length;i++)r.push(e[i][n]);t.push(r)}return t},b_=e=>{let t=e.trim().split(`
65
+ `).map(a=>a.trim().split(" "));if(t.length&&t[0].length!==2&&(t=e.trim().split(`
66
+ `).map(a=>a.trim().split(","))),t.length===0)return{type:xc,reason:"No values"};let n=t[0].length;if(!t.every(a=>a.length===n))return{type:xc,reason:"All rows don't have same number of columns"};let i=g_(t);if(i.type!==ou){let a=g_(EQ(t));if(a.type===ou)return a}return i},hg=RP(_P),ki={fillStyle:"hachure",fontFamily:ea,fontSize:Za,opacity:100,roughness:1,strokeColor:$d,roundness:null,strokeStyle:"solid",strokeWidth:1,verticalAlign:Oo.MIDDLE,locked:!1},y_=e=>{let t=(ua+kt)*e.values.length+kt,n=tl+kt*2;return{chartWidth:t,chartHeight:n}},bQ=(e,t,n,r,i)=>e.labels?.map((a,o)=>io({groupIds:[r],backgroundColor:i,...ki,text:a.length>8?`${a.slice(0,5)}...`:a,x:t+o*(ua+kt)+kt*2,y:n+kt/2,width:ua,angle:5.87,fontSize:16,textAlign:"center",verticalAlign:"top"}))||[],yQ=(e,t,n,r,i)=>{let a=io({groupIds:[r],backgroundColor:i,...ki,x:t-kt,y:n-kt,text:"0",textAlign:"right"}),o=io({groupIds:[r],backgroundColor:i,...ki,x:t-kt,y:n-tl-a.height/2,text:Math.max(...e.values).toLocaleString(),textAlign:"right"});return[a,o]},vQ=(e,t,n,r,i)=>{let{chartWidth:a,chartHeight:o}=y_(e),s=yc({backgroundColor:i,groupIds:[r],...ki,type:"line",x:t,y:n,startArrowhead:null,endArrowhead:null,width:a,points:[[0,0],[a,0]]}),l=yc({backgroundColor:i,groupIds:[r],...ki,type:"line",x:t,y:n,startArrowhead:null,endArrowhead:null,height:o,points:[[0,0],[0,-o]]}),c=yc({backgroundColor:i,groupIds:[r],...ki,type:"line",x:t,y:n-tl-kt,startArrowhead:null,endArrowhead:null,strokeStyle:"dotted",width:a,opacity:E_,points:[[0,0],[a,0]]});return[s,l,c]},v_=(e,t,n,r,i,a)=>{let{chartWidth:o,chartHeight:s}=y_(e),l=e.title?io({backgroundColor:i,groupIds:[r],...ki,text:e.title,x:t+o/2,y:n-tl-kt*2-Za,roundness:null,textAlign:"center"}):null,c=a?Hm({backgroundColor:i,groupIds:[r],...ki,type:"rectangle",x:t,y:n-s,width:o,height:s,strokeColor:$d,fillStyle:"solid",opacity:6}):null;return[...c?[c]:[],...l?[l]:[],...bQ(e,t,n,r,i),...yQ(e,t,n,r,i),...vQ(e,t,n,r,i)]},xQ=(e,t,n)=>{let r=Math.max(...e.values),i=ca(),a=hg[Math.floor(Math.random()*hg.length)];return[...e.values.map((s,l)=>{let c=s/r*tl;return Hm({backgroundColor:a,groupIds:[i],...ki,type:"rectangle",x:t+l*(ua+kt)+kt,y:n-c-kt,width:ua,height:c})}),...v_(e,t,n,i,a,L.DEV)]},wQ=(e,t,n)=>{let r=Math.max(...e.values),i=ca(),a=hg[Math.floor(Math.random()*hg.length)],o=0,s=[];for(let f of e.values){let g=o*(ua+kt),b=-(f/r)*tl;s.push([g,b]),o++}let l=Math.max(...s.map(f=>f[0])),c=Math.max(...s.map(f=>f[1])),d=Math.min(...s.map(f=>f[0])),u=Math.min(...s.map(f=>f[1])),h=yc({backgroundColor:a,groupIds:[i],...ki,type:"line",x:t+kt+ua/2,y:n-kt,startArrowhead:null,endArrowhead:null,height:c-u,width:l-d,strokeWidth:2,points:s}),m=e.values.map((f,g)=>{let b=g*(ua+kt)+kt/2,v=-(f/r)*tl+kt/2;return Hm({backgroundColor:a,groupIds:[i],...ki,fillStyle:"solid",strokeWidth:2,type:"ellipse",x:t+b+ua/2,y:n+v-kt*2,width:kt,height:kt})}),p=e.values.map((f,g)=>{let b=g*(ua+kt)+kt/2,v=f/r*tl+kt/2+kt;return yc({backgroundColor:a,groupIds:[i],...ki,type:"line",x:t+b+ua/2+kt/2,y:n-v,startArrowhead:null,endArrowhead:null,height:v,strokeStyle:"dotted",opacity:E_,points:[[0,0],[0,v]]})});return[...v_(e,t,n,i,a,L.DEV),h,...p,...m]},rge=(e,t,n,r)=>e==="line"?wQ(t,n,r):xQ(t,n,r);var pge="clipboard"in navigator&&"readText"in navigator.clipboard,SQ="clipboard"in navigator&&"writeText"in navigator.clipboard,fge="clipboard"in navigator&&"write"in navigator.clipboard&&"ClipboardItem"in window&&"toBlob"in HTMLCanvasElement.prototype,CQ=e=>!!([Or.excalidraw,Or.excalidrawClipboard,Or.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),gge=({types:e,files:t})=>{!e&&!t&&console.warn("createPasteEvent: no types or files provided");let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});if(e)for(let[r,i]of Object.entries(e))try{if(n.clipboardData?.setData(r,i),n.clipboardData?.getData(r)!==i)throw new Error(`Failed to set "${r}" as clipboardData item`)}catch(a){throw new Error(a.message)}if(t){let r=-1;for(let i of t){r++;try{if(n.clipboardData?.items.add(i),n.clipboardData?.files[r]!==i)throw new Error(`Failed to set file "${i.name}" as clipboardData item`)}catch(a){throw new Error(a.message)}}}return n},TQ=({elements:e,files:t})=>{let n=et(e),r=new Set(e.filter(s=>Mt(s))),i=!1,a=e.reduce((s,l)=>(qa(l)&&(i=!0,t&&t[l.fileId]&&(s[l.fileId]=t[l.fileId])),s),{});i&&!t&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");let o={type:Or.excalidrawClipboard,elements:e.map(s=>{if(Fr(s,n)&&!r.has(Fr(s,n))){let l=Um(s);return Ce(l,{frameId:null}),l}return s}),files:t?a:void 0};return JSON.stringify(o)},x_=async(e,t,n)=>{await Bw(TQ({elements:e,files:t}),n)},IQ=e=>{let t=b_(e);return t.type===ou?{spreadsheet:t.spreadsheet}:null};function w_(e){let t=[];for(let n of e.childNodes)if(n.nodeType===3){let r=n.textContent?.trim();r&&t.push({type:"text",value:r})}else if(n instanceof HTMLImageElement){let r=n.getAttribute("src");r&&r.startsWith("http")&&t.push({type:"imageUrl",value:r})}else t=t.concat(w_(n));return t}var MQ=e=>{let t=e.clipboardData?.getData("text/html");if(!t)return null;try{let n=new DOMParser().parseFromString(t,"text/html"),r=w_(n.body);if(r.length)return{type:"mixedContent",value:r}}catch(n){console.error(`error in parseHTMLFromPaste: ${n.message}`)}return null},Ege=async()=>{let e={};try{if(navigator.clipboard?.readText)return{"text/plain":await navigator.clipboard?.readText()}}catch(n){if(navigator.clipboard?.read)console.warn(`navigator.clipboard.readText() failed (${n.message}). Failling back to navigator.clipboard.read()`);else throw n}let t;try{t=await navigator.clipboard?.read()}catch(n){if(n.name==="DataError")return console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${n.message}`),e;throw n}for(let n of t)for(let r of n.types)if(A7(l7,r))try{e[r]=await(await n.getType(r)).text()}catch(i){console.warn(`Cannot retrieve ${r} from clipboardItem: ${i.message}`)}return Object.keys(e).length===0&&console.warn("No clipboard data found from clipboard.read()."),e},AQ=async(e,t=!1)=>{try{let n=!t&&e&&MQ(e);return n?n.value.every(i=>i.type==="text")?{type:"text",value:e.clipboardData?.getData("text/plain")||n.value.map(i=>i.value).join(`
67
+ `).trim()}:n:{type:"text",value:(e.clipboardData?.getData("text/plain")||"").trim()}}catch{return{type:"text",value:""}}},bge=async(e,t=!1)=>{let n=await AQ(e,t);if(n.type==="mixedContent")return{mixedContent:n.value};try{let r=!t&&IQ(n.value);if(r)return r}catch(r){console.error(r)}try{let r=JSON.parse(n.value),i=r.type===Or.excalidrawClipboardWithAPI;if(CQ(r))return{elements:r.elements,files:r.files,text:t?JSON.stringify(r.elements,null,2):void 0,programmaticAPI:i}}catch{}return{text:n.value}},S_=async e=>{try{await navigator.clipboard.write([new window.ClipboardItem({[Te.png]:e})])}catch(t){if(h0(e))await navigator.clipboard.write([new window.ClipboardItem({[Te.png]:await e})]);else throw t}},Bw=async(e,t)=>{if(SQ)try{await navigator.clipboard.writeText(e||"");return}catch(n){console.error(n)}try{if(t){if(t.clipboardData?.setData("text/plain",e||""),t.clipboardData?.getData("text/plain")!==e)throw new Error("Failed to setData on clipboardEvent");return}}catch(n){console.error(n)}if(!kQ(e))throw new Error("Error copying to clipboard.")},kQ=e=>{e||(e=" ");let t=document.documentElement.getAttribute("dir")==="rtl",n=document.createElement("textarea");n.style.border="0",n.style.padding="0",n.style.margin="0",n.style.position="absolute",n.style[t?"right":"left"]="-9999px";let r=window.pageYOffset||document.documentElement.scrollTop;n.style.top=`${r}px`,n.style.fontSize="12pt",n.setAttribute("readonly",""),n.value=e,document.body.appendChild(n);let i=!1;try{n.select(),n.setSelectionRange(0,n.value.length),i=document.execCommand("copy")}catch(a){console.error(a)}return n.remove(),i};S();S();var fn=_(J(),1);S();var PQ=0;function T_(e,t){let n=`atom${++PQ}`,r={toString:()=>n};return typeof e=="function"?r.read=e:(r.init=e,r.read=i=>i(r),r.write=(i,a,o)=>a(r,typeof o=="function"?o(i(r)):o)),t&&(r.write=t),r}var nl=Symbol(),Hw=e=>!!e[nl],mg=e=>!e[nl].c,tp=e=>{var t;let{b:n,c:r}=e[nl];r&&(r(),(t=_Q.get(n))==null||t())},fg=(e,t)=>{let n=e[nl].o,r=t[nl].o;return n===r||e===r||Hw(n)&&fg(n,t)},Uw=(e,t)=>{let n={b:e,o:t,c:null},r=new Promise(i=>{n.c=()=>{n.c=null,i()},t.finally(n.c)});return r[nl]=n,r},DQ=e=>Uw(e[nl].b,e[nl].o),_Q=new WeakMap;var pg=e=>"init"in e,np="r",gg="w",rp="c",Eg="s",I_="h",LQ="n",RQ="l",OQ="a",NQ="m",M_=e=>{let t=new WeakMap,n=new WeakMap,r=new Map,i,a;if((L&&L.MODE)!=="production"&&(i=new Set,a=new Set),e)for(let[$,B]of e){let G={v:B,r:0,y:!0,d:new Map};(L&&L.MODE)!=="production"&&(Object.freeze(G),pg($)||console.warn("Found initial value for derived atom which can cause unexpected behavior",$)),t.set($,G)}let o=new WeakMap,s=($,B,G)=>{let U=o.get(B);U||(U=new Map,o.set(B,U)),G.then(()=>{U.get($)===G&&(U.delete($),U.size||o.delete(B))}),U.set($,G)},l=$=>{let B=new Set,G=o.get($);return G&&(o.delete($),G.forEach((U,Q)=>{tp(U),B.add(Q)})),B},c=new WeakMap,d=$=>{let B=c.get($);return B||(B=new Map,c.set($,B)),B},u=($,B)=>{if($){let G=d($),U=G.get(B);return U||(U=u($.p,B),U&&"p"in U&&mg(U.p)&&(U=void 0),U&&G.set(B,U)),U}return t.get(B)},h=($,B,G)=>{if((L&&L.MODE)!=="production"&&Object.freeze(G),$)d($).set(B,G);else{let U=t.get(B);t.set(B,G),r.has(B)||r.set(B,U)}},m=($,B=new Map,G)=>{if(!G)return B;let U=new Map,Q=!1;return G.forEach(re=>{var se;let me=((se=u($,re))==null?void 0:se.r)||0;U.set(re,me),B.get(re)!==me&&(Q=!0)}),B.size===U.size&&!Q?B:U},p=($,B,G,U,Q)=>{let re=u($,B);if(re){if(Q&&(!("p"in re)||!fg(re.p,Q)))return re;"p"in re&&tp(re.p)}let se={v:G,r:re?.r||0,y:!0,d:m($,re?.d,U)},me=!re?.y;return!re||!("v"in re)||!Object.is(re.v,G)?(me=!0,++se.r,se.d.has(B)&&(se.d=new Map(se.d).set(B,se.r))):se.d!==re.d&&(se.d.size!==re.d.size||!Array.from(se.d.keys()).every(it=>re.d.has(it)))&&(me=!0,Promise.resolve().then(()=>{j($)})),re&&!me?re:(h($,B,se),se)},f=($,B,G,U,Q)=>{let re=u($,B);if(re){if(Q&&(!("p"in re)||!fg(re.p,Q)))return re;"p"in re&&tp(re.p)}let se={e:G,r:(re?.r||0)+1,y:!0,d:m($,re?.d,U)};return h($,B,se),se},g=($,B,G,U)=>{let Q=u($,B);if(Q&&"p"in Q){if(fg(Q.p,G)&&!mg(Q.p))return Q.y?Q:{...Q,y:!0};tp(Q.p)}s($,B,G);let re={p:G,r:(Q?.r||0)+1,y:!0,d:m($,Q?.d,U)};return h($,B,re),re},b=($,B,G,U)=>{if(G instanceof Promise){let Q=Uw(G,G.then(re=>{p($,B,re,U,Q)}).catch(re=>{if(re instanceof Promise)return Hw(re)?re.then(()=>{y($,B,!0)}):re;f($,B,re,U,Q)}));return g($,B,Q,U)}return p($,B,G,U)},v=($,B)=>{let G=u($,B);if(G){let U={...G,y:!1};h($,B,U)}else(L&&L.MODE)!=="production"&&console.warn("[Bug] could not invalidate non existing atom",B)},y=($,B,G)=>{if(!G){let Q=u($,B);if(Q){if(Q.y&&"p"in Q&&!mg(Q.p))return Q;if(Q.d.forEach((re,se)=>{if(se!==B)if(!n.has(se))y($,se);else{let me=u($,se);me&&!me.y&&y($,se)}}),Array.from(Q.d).every(([re,se])=>{let me=u($,re);return me&&!("p"in me)&&me.r===se}))return Q.y?Q:{...Q,y:!0}}}let U=new Set;try{let Q=B.read(re=>{U.add(re);let se=re===B?u($,re):y($,re);if(se){if("e"in se)throw se.e;if("p"in se)throw se.p;return se.v}if(pg(re))return re.init;throw new Error("no atom init")});return b($,B,Q,U)}catch(Q){if(Q instanceof Promise){let re=Hw(Q)&&mg(Q)?DQ(Q):Uw(Q,Q);return g($,B,re,U)}return f($,B,Q,U)}},w=($,B)=>y(B,$),C=($,B)=>{let G=n.get(B);return G||(G=P($,B)),G},A=($,B)=>!B.l.size&&(!B.t.size||B.t.size===1&&B.t.has($)),T=($,B)=>{let G=n.get(B);G&&A(B,G)&&F($,B)},I=($,B)=>{let G=n.get(B);G?.t.forEach(U=>{U!==B&&(v($,U),I($,U))})},k=($,B,G)=>{let U=!0,Q=(me,it)=>{let Qe=y($,me);if("e"in Qe)throw Qe.e;if("p"in Qe){if(it?.unstable_promise)return Qe.p.then(()=>{let Le=u($,me);return Le&&"p"in Le&&Le.p===Qe.p?new Promise(Pe=>setTimeout(Pe)).then(()=>Q(me,it)):Q(me,it)});throw(L&&L.MODE)!=="production"&&console.info("Reading pending atom state in write operation. We throw a promise for now.",me),Qe.p}if("v"in Qe)return Qe.v;throw(L&&L.MODE)!=="production"&&console.warn("[Bug] no value found while reading atom in write operation. This is probably a bug.",me),new Error("no value found")},re=(me,it)=>{let Qe;if(me===B){if(!pg(me))throw new Error("atom not writable");l(me).forEach(xn=>{xn!==$&&b(xn,me,it)});let Pe=u($,me),at=b($,me,it);Pe!==at&&I($,me)}else Qe=k($,me,it);return U||j($),Qe},se=B.write(Q,re,G);return U=!1,se},R=($,B,G)=>{let U=k(G,$,B);return j(G),U},O=$=>!!$.write,P=($,B,G)=>{let U={t:new Set(G&&[G]),l:new Set};if(n.set(B,U),(L&&L.MODE)!=="production"&&a.add(B),y(void 0,B).d.forEach((re,se)=>{let me=n.get(se);me?me.t.add(B):se!==B&&P($,se,B)}),O(B)&&B.onMount){let re=me=>R(B,me,$),se=B.onMount(re);$=void 0,se&&(U.u=se)}return U},F=($,B)=>{var G;let U=(G=n.get(B))==null?void 0:G.u;U&&U(),n.delete(B),(L&&L.MODE)!=="production"&&a.delete(B);let Q=u($,B);Q?("p"in Q&&tp(Q.p),Q.d.forEach((re,se)=>{if(se!==B){let me=n.get(se);me&&(me.t.delete(B),A(se,me)&&F($,se))}})):(L&&L.MODE)!=="production"&&console.warn("[Bug] could not find atom state to unmount",B)},Y=($,B,G,U)=>{let Q=new Set(G.d.keys());U?.forEach((re,se)=>{if(Q.has(se)){Q.delete(se);return}let me=n.get(se);me&&(me.t.delete(B),A(se,me)&&F($,se))}),Q.forEach(re=>{let se=n.get(re);se?se.t.add(B):n.has(B)&&P($,re,B)})},j=$=>{if($){d($).forEach((G,U)=>{let Q=t.get(U);if(G!==Q){let re=n.get(U);re?.l.forEach(se=>se($))}});return}for(;r.size;){let B=Array.from(r);r.clear(),B.forEach(([G,U])=>{let Q=u(void 0,G);if(Q&&Q.d!==U?.d&&Y(void 0,G,Q,U?.d),U&&!U.y&&Q?.y)return;let re=n.get(G);re?.l.forEach(se=>se())})}(L&&L.MODE)!=="production"&&i.forEach(B=>B())},q=$=>{d($).forEach((G,U)=>{let Q=t.get(U);(!Q||G.r>Q.r||G.y!==Q.y||G.r===Q.r&&G.d!==Q.d)&&(t.set(U,G),G.d!==Q?.d&&Y($,U,G,Q?.d))})},ne=($,B)=>{B&&q(B),j(void 0)},H=($,B,G)=>{let Q=C(G,$).l;return Q.add(B),()=>{Q.delete(B),T(G,$)}},V=($,B)=>{for(let[G,U]of $)pg(G)&&(b(B,G,U),I(B,G));j(B)};return(L&&L.MODE)!=="production"?{[np]:w,[gg]:R,[rp]:ne,[Eg]:H,[I_]:V,[LQ]:$=>(i.add($),()=>{i.delete($)}),[RQ]:()=>a.values(),[OQ]:$=>t.get($),[NQ]:$=>n.get($)}:{[np]:w,[gg]:R,[rp]:ne,[Eg]:H,[I_]:V}},A_=e=>{let t=M_(e),n=o=>{let s=t[np](o);if("e"in s)throw s.e;if(!("p"in s))return s.v},r=o=>new Promise((s,l)=>{let c=t[np](o);"e"in c?l(c.e):"p"in c?s(c.p.then(()=>r(o))):s(c.v)});return{get:n,asyncGet:r,set:(o,s)=>t[gg](o,s),sub:(o,s)=>t[Eg](o,s),SECRET_INTERNAL_store:t}},k_=(e,t)=>({s:t?t(e).SECRET_INTERNAL_store:M_(e)}),zw=new Map,Gw=e=>(zw.has(e)||zw.set(e,(0,fn.createContext)(k_())),zw.get(e)),bg=({children:e,initialValues:t,scope:n,unstable_createStore:r,unstable_enableVersionedWrite:i})=>{let[a,o]=(0,fn.useState)({});(0,fn.useEffect)(()=>{let c=s.current;c.w&&(c.s[rp](null,a),delete a.p,c.v=a)},[a]);let s=(0,fn.useRef)();if(!s.current){let c=k_(t,r);if(i){let d=0;c.w=u=>{o(h=>{let m=d?h:{p:h};return u(m),m})},c.v=a,c.r=u=>{++d,u(),--d}}s.current=c}let l=Gw(n);return(0,fn.createElement)(l.Provider,{value:s.current},e)};function _t(e,t){return T_(e,t)}function ip(e,t){let n=Gw(t),r=(0,fn.useContext)(n),{s:i,v:a}=r,o=h=>{let m=i[np](e,h);if((L&&L.MODE)!=="production"&&!m.y)throw new Error("should not be invalidated");if("e"in m)throw m.e;if("p"in m)throw m.p;if("v"in m)return m.v;throw new Error("no atom value")},[[s,l,c],d]=(0,fn.useReducer)((h,m)=>{let p=o(m);return Object.is(h[1],p)&&h[2]===e?h:[m,p,e]},a,h=>{let m=o(h);return[h,m,e]}),u=l;return c!==e&&(d(s),u=o(s)),(0,fn.useEffect)(()=>{let{v:h}=r;h&&i[rp](e,h);let m=i[Eg](e,d,h);return d(h),m},[i,e,r]),(0,fn.useEffect)(()=>{i[rp](e,s)}),(0,fn.useDebugValue)(u),u}function qo(e,t){let n=Gw(t),{s:r,w:i}=(0,fn.useContext)(n);return(0,fn.useCallback)(o=>{if((L&&L.MODE)!=="production"&&!("write"in e))throw new Error("not writable atom");let s=l=>r[gg](e,o,l);return i?i(s):s()},[r,i,e])}function Ze(e,t){return"scope"in e&&(console.warn("atom.scope is deprecated. Please do useAtom(atom, scope) instead."),t=e.scope),[ip(e,t),qo(e,t)]}var hve=_(J(),1);var UF=_(J(),1),V2=_(W(),1),Xb=_(J(),1);S();function L_(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=L_(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function X(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=L_(t))&&(r&&(r+=" "),r+=n);return r}var th=_(W(),1),qb=_(J(),1),mB=_(W(),1);var Tz=_(xw(),1);var ay=_(lx(),1),n4=_(Cv(),1),r4=_(Iv(),1),Rz=_(Mv(),1);var _a=_(J(),1);var Hi=_(W(),1),Tr=_(J(),1);var E=_(W(),1),lU=_(W(),1),Xp=_(W(),1),fU=_(W(),1);var lh=_(W(),1);var uE=_(W(),1);var yU=_(W(),1);var My=_(J(),1),ms=_(W(),1);var Ay=_(J(),1),ch=_(W(),1);var ky=_(J(),1),dh=_(W(),1),CU=_(W(),1),Hl=_(J(),1);var ui=_(W(),1),D4=_(J(),1),Xf=_(J(),1),AU=_(J(),1),kU=_(J(),1);var Dy=_(J(),1),PU=_(ao(),1),DU=_(W(),1),La=_(J(),1);var xo=_(W(),1);S();S();function Ue(){return Ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ue.apply(this,arguments)}var je=_(J());S();function Sn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}S();var O_=_(J());function GQ(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function jw(...e){return t=>e.forEach(n=>GQ(n,t))}function Jn(...e){return(0,O_.useCallback)(jw(...e),e)}S();var ha=_(J());function oo(e,t=[]){let n=[];function r(a,o){let s=(0,ha.createContext)(o),l=n.length;n=[...n,o];function c(u){let{scope:h,children:m,...p}=u,f=h?.[e][l]||s,g=(0,ha.useMemo)(()=>p,Object.values(p));return(0,ha.createElement)(f.Provider,{value:g},m)}function d(u,h){let m=h?.[e][l]||s,p=(0,ha.useContext)(m);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${a}\``)}return c.displayName=a+"Provider",[c,d]}let i=()=>{let a=n.map(o=>(0,ha.createContext)(o));return function(s){let l=s?.[e]||a;return(0,ha.useMemo)(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return i.scopeName=e,[r,jQ(i,...t)]}function jQ(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){let o=r.reduce((s,{useScope:l,scopeName:c})=>{let u=l(a)[`__scope${c}`];return{...s,...u}},{});return(0,ha.useMemo)(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}S();var gn=_(J());S();var su=_(J()),N_=_(ao());S();var en=_(J());var rl=(0,en.forwardRef)((e,t)=>{let{children:n,...r}=e,i=en.Children.toArray(n),a=i.find(VQ);if(a){let o=a.props.children,s=i.map(l=>l===a?en.Children.count(o)>1?en.Children.only(null):(0,en.isValidElement)(o)?o.props.children:null:l);return(0,en.createElement)(Ww,Ue({},r,{ref:t}),(0,en.isValidElement)(o)?(0,en.cloneElement)(o,void 0,s):null)}return(0,en.createElement)(Ww,Ue({},r,{ref:t}),n)});rl.displayName="Slot";var Ww=(0,en.forwardRef)((e,t)=>{let{children:n,...r}=e;return(0,en.isValidElement)(n)?(0,en.cloneElement)(n,{...YQ(r,n.props),ref:jw(t,n.ref)}):en.Children.count(n)>1?en.Children.only(null):null});Ww.displayName="SlotClone";var WQ=({children:e})=>(0,en.createElement)(en.Fragment,null,e);function VQ(e){return(0,en.isValidElement)(e)&&e.type===WQ}function YQ(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...s)=>{a(...s),i(...s)}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}var ZQ=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],sn=ZQ.reduce((e,t)=>{let n=(0,su.forwardRef)((r,i)=>{let{asChild:a,...o}=r,s=a?rl:t;return(0,su.useEffect)(()=>{window[Symbol.for("radix-ui")]=!0},[]),(0,su.createElement)(s,Ue({},o,{ref:i}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function $_(e,t){e&&(0,N_.flushSync)(()=>e.dispatchEvent(t))}S();var lu=_(J());function Sr(e){let t=(0,lu.useRef)(e);return(0,lu.useEffect)(()=>{t.current=e}),(0,lu.useMemo)(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}S();var F_=_(J());function B_(e,t=globalThis?.document){let n=Sr(e);(0,F_.useEffect)(()=>{let r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}var Vw="dismissableLayer.update",KQ="dismissableLayer.pointerDownOutside",XQ="dismissableLayer.focusOutside",z_,qQ=(0,gn.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),U_=(0,gn.forwardRef)((e,t)=>{var n;let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:l,...c}=e,d=(0,gn.useContext)(qQ),[u,h]=(0,gn.useState)(null),m=(n=u?.ownerDocument)!==null&&n!==void 0?n:globalThis?.document,[,p]=(0,gn.useState)({}),f=Jn(t,I=>h(I)),g=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(b),y=u?g.indexOf(u):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,C=y>=v,A=QQ(I=>{let k=I.target,R=[...d.branches].some(O=>O.contains(k));!C||R||(a?.(I),s?.(I),I.defaultPrevented||l?.())},m),T=JQ(I=>{let k=I.target;[...d.branches].some(O=>O.contains(k))||(o?.(I),s?.(I),I.defaultPrevented||l?.())},m);return B_(I=>{y===d.layers.size-1&&(i?.(I),!I.defaultPrevented&&l&&(I.preventDefault(),l()))},m),(0,gn.useEffect)(()=>{if(u)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(z_=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),H_(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=z_)}},[u,m,r,d]),(0,gn.useEffect)(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),H_())},[u,d]),(0,gn.useEffect)(()=>{let I=()=>p({});return document.addEventListener(Vw,I),()=>document.removeEventListener(Vw,I)},[]),(0,gn.createElement)(sn.div,Ue({},c,{ref:f,style:{pointerEvents:w?C?"auto":"none":void 0,...e.style},onFocusCapture:Sn(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Sn(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Sn(e.onPointerDownCapture,A.onPointerDownCapture)}))});function QQ(e,t=globalThis?.document){let n=Sr(e),r=(0,gn.useRef)(!1),i=(0,gn.useRef)(()=>{});return(0,gn.useEffect)(()=>{let a=s=>{if(s.target&&!r.current){let c=function(){G_(KQ,n,l,{discrete:!0})},l={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function JQ(e,t=globalThis?.document){let n=Sr(e),r=(0,gn.useRef)(!1);return(0,gn.useEffect)(()=>{let i=a=>{a.target&&!r.current&&G_(XQ,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function H_(){let e=new CustomEvent(Vw);document.dispatchEvent(e)}function G_(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?$_(i,a):i.dispatchEvent(a)}S();var W_=_(J()),Yw=0;function V_(){(0,W_.useEffect)(()=>{var e,t;let n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:j_()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:j_()),Yw++,()=>{Yw===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),Yw--}},[])}function j_(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}S();var Br=_(J());var Zw="focusScope.autoFocusOnMount",Kw="focusScope.autoFocusOnUnmount",Y_={bubbles:!1,cancelable:!0};var q_=(0,Br.forwardRef)((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,l]=(0,Br.useState)(null),c=Sr(i),d=Sr(a),u=(0,Br.useRef)(null),h=Jn(t,f=>l(f)),m=(0,Br.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,Br.useEffect)(()=>{if(r){let f=function(b){if(m.paused||!s)return;let v=b.target;s.contains(v)?u.current=v:wc(u.current,{select:!0})},g=function(b){m.paused||!s||s.contains(b.relatedTarget)||wc(u.current,{select:!0})};return document.addEventListener("focusin",f),document.addEventListener("focusout",g),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",g)}}},[r,s,m.paused]),(0,Br.useEffect)(()=>{if(s){K_.add(m);let f=document.activeElement;if(!s.contains(f)){let b=new CustomEvent(Zw,Y_);s.addEventListener(Zw,c),s.dispatchEvent(b),b.defaultPrevented||(eJ(aJ(Q_(s)),{select:!0}),document.activeElement===f&&wc(s))}return()=>{s.removeEventListener(Zw,c),setTimeout(()=>{let b=new CustomEvent(Kw,Y_);s.addEventListener(Kw,d),s.dispatchEvent(b),b.defaultPrevented||wc(f??document.body,{select:!0}),s.removeEventListener(Kw,d),K_.remove(m)},0)}}},[s,c,d,m]);let p=(0,Br.useCallback)(f=>{if(!n&&!r||m.paused)return;let g=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,b=document.activeElement;if(g&&b){let v=f.currentTarget,[y,w]=tJ(v);y&&w?!f.shiftKey&&b===w?(f.preventDefault(),n&&wc(y,{select:!0})):f.shiftKey&&b===y&&(f.preventDefault(),n&&wc(w,{select:!0})):b===v&&f.preventDefault()}},[n,r,m.paused]);return(0,Br.createElement)(sn.div,Ue({tabIndex:-1},o,{ref:h,onKeyDown:p}))});function eJ(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(wc(r,{select:t}),document.activeElement!==n)return}function tJ(e){let t=Q_(e),n=Z_(t,e),r=Z_(t.reverse(),e);return[n,r]}function Q_(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{let i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Z_(e,t){for(let n of e)if(!nJ(n,{upTo:t}))return n}function nJ(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function rJ(e){return e instanceof HTMLInputElement&&"select"in e}function wc(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&rJ(e)&&t&&e.select()}}var K_=iJ();function iJ(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=X_(e,t),e.unshift(t)},remove(t){var n;e=X_(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function X_(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function aJ(e){return e.filter(t=>t.tagName!=="A")}S();var vg=_(J());S();var J_=_(J()),Pi=globalThis?.document?J_.useLayoutEffect:()=>{};var oJ=vg.useId||(()=>{}),sJ=0;function cu(e){let[t,n]=vg.useState(oJ());return Pi(()=>{e||n(r=>r??String(sJ++))},[e]),e||(t?`radix-${t}`:"")}S();var zt=_(J());S();S();S();function Cc(e){return e.split("-")[0]}function op(e){return e.split("-")[1]}function uu(e){return["top","bottom"].includes(Cc(e))?"x":"y"}function qw(e){return e==="y"?"height":"width"}function e9(e,t,n){let{reference:r,floating:i}=e,a=r.x+r.width/2-i.width/2,o=r.y+r.height/2-i.height/2,s=uu(t),l=qw(s),c=r[l]/2-i[l]/2,d=s==="x",u;switch(Cc(t)){case"top":u={x:a,y:r.y-i.height};break;case"bottom":u={x:a,y:r.y+r.height};break;case"right":u={x:r.x+r.width,y:o};break;case"left":u={x:r.x-i.width,y:o};break;default:u={x:r.x,y:r.y}}switch(op(t)){case"start":u[s]-=c*(n&&d?-1:1);break;case"end":u[s]+=c*(n&&d?-1:1)}return u}var i9=async(e,t,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:o}=n,s=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:d}=e9(l,r,s),u=r,h={},m=0;for(let p=0;p<a.length;p++){let{name:f,fn:g}=a[p],{x:b,y:v,data:y,reset:w}=await g({x:c,y:d,initialPlacement:r,placement:u,strategy:i,middlewareData:h,rects:l,platform:o,elements:{reference:e,floating:t}});c=b??c,d=v??d,h={...h,[f]:{...h[f],...y}},w&&m<=50&&(m++,typeof w=="object"&&(w.placement&&(u=w.placement),w.rects&&(l=w.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):w.rects),{x:c,y:d}=e9(l,u,s)),p=-1)}return{x:c,y:d,placement:u,strategy:i,middlewareData:h}};function a9(e){return typeof e!="number"?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(e):{top:e,right:e,bottom:e,left:e}}function ap(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function du(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:h=!1,padding:m=0}=t,p=a9(m),f=s[h?u==="floating"?"reference":"floating":u],g=ap(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(f)))==null||n?f:f.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),b=ap(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({rect:u==="floating"?{...o.floating,x:r,y:i}:o.reference,offsetParent:await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),strategy:l}):o[u]);return{top:g.top-b.top+p.top,bottom:b.bottom-g.bottom+p.bottom,left:g.left-b.left+p.left,right:b.right-g.right+p.right}}var lJ=Math.min,Sc=Math.max;function Xw(e,t,n){return Sc(e,lJ(t,n))}var wg=e=>({name:"arrow",options:e,async fn(t){let{element:n,padding:r=0}=e??{},{x:i,y:a,placement:o,rects:s,platform:l}=t;if(n==null)return{};let c=a9(r),d={x:i,y:a},u=uu(o),h=op(o),m=qw(u),p=await l.getDimensions(n),f=u==="y"?"top":"left",g=u==="y"?"bottom":"right",b=s.reference[m]+s.reference[u]-d[u]-s.floating[m],v=d[u]-s.reference[u],y=await(l.getOffsetParent==null?void 0:l.getOffsetParent(n)),w=y?u==="y"?y.clientHeight||0:y.clientWidth||0:0;w===0&&(w=s.floating[m]);let C=b/2-v/2,A=c[f],T=w-p[m]-c[g],I=w/2-p[m]/2+C,k=Xw(A,I,T),R=(h==="start"?c[f]:c[g])>0&&I!==k&&s.reference[m]<=s.floating[m];return{[u]:d[u]-(R?I<A?A-I:T-I:0),data:{[u]:k,centerOffset:I-k}}}}),cJ={left:"right",right:"left",bottom:"top",top:"bottom"};function xg(e){return e.replace(/left|right|bottom|top/g,t=>cJ[t])}function dJ(e,t,n){n===void 0&&(n=!1);let r=op(e),i=uu(e),a=qw(i),o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=xg(o)),{main:o,cross:xg(o)}}var uJ={start:"end",end:"start"};function t9(e){return e.replace(/start|end/g,t=>uJ[t])}var o9=["top","right","bottom","left"],C2e=o9.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]);var Qw=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:l}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",flipAlignment:m=!0,...p}=e,f=Cc(r),g=u||(f===o||!m?[xg(o)]:function(I){let k=xg(I);return[t9(I),k,t9(k)]}(o)),b=[o,...g],v=await du(t,p),y=[],w=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&y.push(v[f]),d){let{main:I,cross:k}=dJ(r,a,await(s.isRTL==null?void 0:s.isRTL(l.floating)));y.push(v[I],v[k])}if(w=[...w,{placement:r,overflows:y}],!y.every(I=>I<=0)){var C,A;let I=((C=(A=i.flip)==null?void 0:A.index)!=null?C:0)+1,k=b[I];if(k)return{data:{index:I,overflows:w},reset:{placement:k}};let R="bottom";switch(h){case"bestFit":{var T;let O=(T=w.map(P=>[P,P.overflows.filter(F=>F>0).reduce((F,Y)=>F+Y,0)]).sort((P,F)=>P[1]-F[1])[0])==null?void 0:T[0].placement;O&&(R=O);break}case"initialPlacement":R=o}if(r!==R)return{reset:{placement:R}}}return{}}}};function n9(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function r9(e){return o9.some(t=>e[t]>=0)}var Jw=function(e){let{strategy:t="referenceHidden",...n}=e===void 0?{}:e;return{name:"hide",async fn(r){let{rects:i}=r;switch(t){case"referenceHidden":{let a=n9(await du(r,{...n,elementContext:"reference"}),i.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:r9(a)}}}case"escaped":{let a=n9(await du(r,{...n,altBoundary:!0}),i.floating);return{data:{escapedOffsets:a,escaped:r9(a)}}}default:return{}}}}},e3=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){let{x:n,y:r}=t,i=await async function(a,o){let{placement:s,platform:l,elements:c}=a,d=await(l.isRTL==null?void 0:l.isRTL(c.floating)),u=Cc(s),h=op(s),m=uu(s)==="x",p=["left","top"].includes(u)?-1:1,f=d&&m?-1:1,g=typeof o=="function"?o(a):o,{mainAxis:b,crossAxis:v,alignmentAxis:y}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...g};return h&&typeof y=="number"&&(v=h==="end"?-1*y:y),m?{x:v*f,y:b*p}:{x:b*p,y:v*f}}(t,e);return{x:n+i.x,y:r+i.y,data:i}}}};function s9(e){return e==="x"?"y":"x"}var t3=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:g=>{let{x:b,y:v}=g;return{x:b,y:v}}},...l}=e,c={x:n,y:r},d=await du(t,l),u=uu(Cc(i)),h=s9(u),m=c[u],p=c[h];if(a){let g=u==="y"?"bottom":"right";m=Xw(m+d[u==="y"?"top":"left"],m,m-d[g])}if(o){let g=h==="y"?"bottom":"right";p=Xw(p+d[h==="y"?"top":"left"],p,p-d[g])}let f=s.fn({...t,[u]:m,[h]:p});return{...f,data:{x:f.x-n,y:f.y-r}}}}},n3=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=e,d={x:n,y:r},u=uu(i),h=s9(u),m=d[u],p=d[h],f=typeof s=="function"?s({...a,placement:i}):s,g=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(l){let C=u==="y"?"height":"width",A=a.reference[u]-a.floating[C]+g.mainAxis,T=a.reference[u]+a.reference[C]-g.mainAxis;m<A?m=A:m>T&&(m=T)}if(c){var b,v,y,w;let C=u==="y"?"width":"height",A=["top","left"].includes(Cc(i)),T=a.reference[h]-a.floating[C]+(A&&(b=(v=o.offset)==null?void 0:v[h])!=null?b:0)+(A?0:g.crossAxis),I=a.reference[h]+a.reference[C]+(A?0:(y=(w=o.offset)==null?void 0:w[h])!=null?y:0)-(A?g.crossAxis:0);p<T?p=T:p>I&&(p=I)}return{[u]:m,[h]:p}}}},r3=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o,...s}=e,l=await du(t,s),c=Cc(n),d=op(n),u,h;c==="top"||c==="bottom"?(u=c,h=d===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(h=c,u=d==="end"?"top":"bottom");let m=Sc(l.left,0),p=Sc(l.right,0),f=Sc(l.top,0),g=Sc(l.bottom,0),b={availableHeight:r.floating.height-(["left","right"].includes(n)?2*(f!==0||g!==0?f+g:Sc(l.top,l.bottom)):l[u]),availableWidth:r.floating.width-(["top","bottom"].includes(n)?2*(m!==0||p!==0?m+p:Sc(l.left,l.right)):l[h])},v=await i.getDimensions(a.floating);o?.({...t,...b});let y=await i.getDimensions(a.floating);return v.width!==y.width||v.height!==y.height?{reset:{rects:!0}}:{}}}};function m9(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function es(e){if(e==null)return window;if(!m9(e)){let t=e.ownerDocument;return t&&t.defaultView||window}return e}function lp(e){return es(e).getComputedStyle(e)}function Qo(e){return m9(e)?"":e?(e.nodeName||"").toLowerCase():""}function p9(){let e=navigator.userAgentData;return e!=null&&e.brands?e.brands.map(t=>t.brand+"/"+t.version).join(" "):navigator.userAgent}function so(e){return e instanceof es(e).HTMLElement}function al(e){return e instanceof es(e).Element}function a3(e){return typeof ShadowRoot>"u"?!1:e instanceof es(e).ShadowRoot||e instanceof ShadowRoot}function Tg(e){let{overflow:t,overflowX:n,overflowY:r}=lp(e);return/auto|scroll|overlay|hidden/.test(t+r+n)}function hJ(e){return["table","td","th"].includes(Qo(e))}function l9(e){let t=/firefox/i.test(p9()),n=lp(e);return n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].includes(n.willChange)||t&&n.willChange==="filter"||t&&!!n.filter&&n.filter!=="none"}function f9(){return!/^((?!chrome|android).)*safari/i.test(p9())}var c9=Math.min,sp=Math.max,Sg=Math.round;function Jo(e,t,n){var r,i,a,o;t===void 0&&(t=!1),n===void 0&&(n=!1);let s=e.getBoundingClientRect(),l=1,c=1;t&&so(e)&&(l=e.offsetWidth>0&&Sg(s.width)/e.offsetWidth||1,c=e.offsetHeight>0&&Sg(s.height)/e.offsetHeight||1);let d=al(e)?es(e):window,u=!f9()&&n,h=(s.left+(u&&(r=(i=d.visualViewport)==null?void 0:i.offsetLeft)!=null?r:0))/l,m=(s.top+(u&&(a=(o=d.visualViewport)==null?void 0:o.offsetTop)!=null?a:0))/c,p=s.width/l,f=s.height/c;return{width:p,height:f,top:m,right:h+p,bottom:m+f,left:h,x:h,y:m}}function il(e){return(t=e,(t instanceof es(t).Node?e.ownerDocument:e.document)||window.document).documentElement;var t}function Ig(e){return al(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function g9(e){return Jo(il(e)).left+Ig(e).scrollLeft}function mJ(e,t,n){let r=so(t),i=il(t),a=Jo(e,r&&function(l){let c=Jo(l);return Sg(c.width)!==l.offsetWidth||Sg(c.height)!==l.offsetHeight}(t),n==="fixed"),o={scrollLeft:0,scrollTop:0},s={x:0,y:0};if(r||!r&&n!=="fixed")if((Qo(t)!=="body"||Tg(i))&&(o=Ig(t)),so(t)){let l=Jo(t,!0);s.x=l.x+t.clientLeft,s.y=l.y+t.clientTop}else i&&(s.x=g9(i));return{x:a.left+o.scrollLeft-s.x,y:a.top+o.scrollTop-s.y,width:a.width,height:a.height}}function E9(e){return Qo(e)==="html"?e:e.assignedSlot||e.parentNode||(a3(e)?e.host:null)||il(e)}function d9(e){return so(e)&&getComputedStyle(e).position!=="fixed"?e.offsetParent:null}function i3(e){let t=es(e),n=d9(e);for(;n&&hJ(n)&&getComputedStyle(n).position==="static";)n=d9(n);return n&&(Qo(n)==="html"||Qo(n)==="body"&&getComputedStyle(n).position==="static"&&!l9(n))?t:n||function(r){let i=E9(r);for(a3(i)&&(i=i.host);so(i)&&!["html","body"].includes(Qo(i));){if(l9(i))return i;i=i.parentNode}return null}(e)||t}function u9(e){if(so(e))return{width:e.offsetWidth,height:e.offsetHeight};let t=Jo(e);return{width:t.width,height:t.height}}function b9(e){let t=E9(e);return["html","body","#document"].includes(Qo(t))?e.ownerDocument.body:so(t)&&Tg(t)?t:b9(t)}function Cg(e,t){var n;t===void 0&&(t=[]);let r=b9(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),a=es(r),o=i?[a].concat(a.visualViewport||[],Tg(r)?r:[]):r,s=t.concat(o);return i?s:s.concat(Cg(o))}function h9(e,t,n){return t==="viewport"?ap(function(r,i){let a=es(r),o=il(r),s=a.visualViewport,l=o.clientWidth,c=o.clientHeight,d=0,u=0;if(s){l=s.width,c=s.height;let h=f9();(h||!h&&i==="fixed")&&(d=s.offsetLeft,u=s.offsetTop)}return{width:l,height:c,x:d,y:u}}(e,n)):al(t)?function(r,i){let a=Jo(r,!1,i==="fixed"),o=a.top+r.clientTop,s=a.left+r.clientLeft;return{top:o,left:s,x:s,y:o,right:s+r.clientWidth,bottom:o+r.clientHeight,width:r.clientWidth,height:r.clientHeight}}(t,n):ap(function(r){var i;let a=il(r),o=Ig(r),s=(i=r.ownerDocument)==null?void 0:i.body,l=sp(a.scrollWidth,a.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),c=sp(a.scrollHeight,a.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),d=-o.scrollLeft+g9(r),u=-o.scrollTop;return lp(s||a).direction==="rtl"&&(d+=sp(a.clientWidth,s?s.clientWidth:0)-l),{width:l,height:c,x:d,y:u}}(il(e)))}function pJ(e){let t=Cg(e),n=["absolute","fixed"].includes(lp(e).position)&&so(e)?i3(e):e;return al(n)?t.filter(r=>al(r)&&function(i,a){let o=a.getRootNode==null?void 0:a.getRootNode();if(i.contains(a))return!0;if(o&&a3(o)){let s=a;do{if(s&&i===s)return!0;s=s.parentNode||s.host}while(s)}return!1}(r,n)&&Qo(r)!=="body"):[]}var fJ={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n==="clippingAncestors"?pJ(t):[].concat(n),r],o=a[0],s=a.reduce((l,c)=>{let d=h9(t,c,i);return l.top=sp(d.top,l.top),l.right=c9(d.right,l.right),l.bottom=c9(d.bottom,l.bottom),l.left=sp(d.left,l.left),l},h9(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e,i=so(n),a=il(n);if(n===a)return t;let o={scrollLeft:0,scrollTop:0},s={x:0,y:0};if((i||!i&&r!=="fixed")&&((Qo(n)!=="body"||Tg(a))&&(o=Ig(n)),so(n))){let l=Jo(n,!0);s.x=l.x+n.clientLeft,s.y=l.y+n.clientTop}return{...t,x:t.x-o.scrollLeft+s.x,y:t.y-o.scrollTop+s.y}},isElement:al,getDimensions:u9,getOffsetParent:i3,getDocumentElement:il,getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:mJ(t,i3(n),r),floating:{...u9(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>lp(e).direction==="rtl"};function y9(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=!0,animationFrame:s=!1}=r,l=i&&!s,c=a&&!s,d=l||c?[...al(e)?Cg(e):[],...Cg(t)]:[];d.forEach(p=>{l&&p.addEventListener("scroll",n,{passive:!0}),c&&p.addEventListener("resize",n)});let u,h=null;if(o){let p=!0;h=new ResizeObserver(()=>{p||n(),p=!1}),al(e)&&!s&&h.observe(e),h.observe(t)}let m=s?Jo(e):null;return s&&function p(){let f=Jo(e);!m||f.x===m.x&&f.y===m.y&&f.width===m.width&&f.height===m.height||n(),m=f,u=requestAnimationFrame(p)}(),n(),()=>{var p;d.forEach(f=>{l&&f.removeEventListener("scroll",n),c&&f.removeEventListener("resize",n)}),(p=h)==null||p.disconnect(),h=null,s&&cancelAnimationFrame(u)}}var v9=(e,t,n)=>i9(e,t,{platform:fJ,...n});var er=_(J()),Mg=_(J()),x9=_(ao()),o3=typeof document<"u"?Mg.useLayoutEffect:Mg.useEffect;function s3(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!s3(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let a=i[r];if(!(a==="_owner"&&e.$$typeof)&&!s3(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function gJ(e){let t=er.useRef(e);return o3(()=>{t.current=e}),t}function w9(e){let{middleware:t,placement:n="bottom",strategy:r="absolute",whileElementsMounted:i}=e===void 0?{}:e,a=er.useRef(null),o=er.useRef(null),s=gJ(i),l=er.useRef(null),[c,d]=er.useState({x:null,y:null,strategy:r,placement:n,middlewareData:{}}),[u,h]=er.useState(t);s3(u?.map(y=>{let{options:w}=y;return w}),t?.map(y=>{let{options:w}=y;return w}))||h(t);let m=er.useCallback(()=>{!a.current||!o.current||v9(a.current,o.current,{middleware:u,placement:n,strategy:r}).then(y=>{p.current&&x9.flushSync(()=>{d(y)})})},[u,n,r]);o3(()=>{p.current&&m()},[m]);let p=er.useRef(!1);o3(()=>(p.current=!0,()=>{p.current=!1}),[]);let f=er.useCallback(()=>{if(typeof l.current=="function"&&(l.current(),l.current=null),a.current&&o.current)if(s.current){let y=s.current(a.current,o.current,m);l.current=y}else m()},[m,s]),g=er.useCallback(y=>{a.current=y,f()},[f]),b=er.useCallback(y=>{o.current=y,f()},[f]),v=er.useMemo(()=>({reference:a,floating:o}),[]);return er.useMemo(()=>({...c,update:m,refs:v,reference:g,floating:b}),[c,m,v,g,b])}var S9=e=>{let{element:t,padding:n}=e;function r(i){return Object.prototype.hasOwnProperty.call(i,"current")}return{name:"arrow",options:e,fn(i){return r(t)?t.current!=null?wg({element:t.current,padding:n}).fn(i):{}:t?wg({element:t,padding:n}).fn(i):{}}}};S();var cp=_(J());var EJ=(0,cp.forwardRef)((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,cp.createElement)(sn.svg,Ue({},a,{ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),e.asChild?n:(0,cp.createElement)("polygon",{points:"0,0 30,0 15,10"}))}),C9=EJ;S();var T9=_(J());function I9(e){let[t,n]=(0,T9.useState)(void 0);return Pi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;let a=i[0],o,s;if("borderBoxSize"in a){let l=a.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,s=c.blockSize}else o=e.offsetWidth,s=e.offsetHeight;n({width:o,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var M9="Popper",[l3,c3]=oo(M9),[bJ,A9]=l3(M9),yJ=e=>{let{__scopePopper:t,children:n}=e,[r,i]=(0,zt.useState)(null);return(0,zt.createElement)(bJ,{scope:t,anchor:r,onAnchorChange:i},n)},vJ="PopperAnchor",xJ=(0,zt.forwardRef)((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=A9(vJ,n),o=(0,zt.useRef)(null),s=Jn(t,o);return(0,zt.useEffect)(()=>{a.onAnchorChange(r?.current||o.current)}),r?null:(0,zt.createElement)(sn.div,Ue({},i,{ref:s}))}),Ag="PopperContent",[wJ,SJ]=l3(Ag),[CJ,TJ]=l3(Ag,{hasParent:!1,positionUpdateFns:new Set}),IJ=(0,zt.forwardRef)((e,t)=>{var n,r,i,a,o,s,l,c;let{__scopePopper:d,side:u="bottom",sideOffset:h=0,align:m="center",alignOffset:p=0,arrowPadding:f=0,collisionBoundary:g=[],collisionPadding:b=0,sticky:v="partial",hideWhenDetached:y=!1,avoidCollisions:w=!0,onPlaced:C,...A}=e,T=A9(Ag,d),[I,k]=(0,zt.useState)(null),R=Jn(t,Td=>k(Td)),[O,P]=(0,zt.useState)(null),F=I9(O),Y=(n=F?.width)!==null&&n!==void 0?n:0,j=(r=F?.height)!==null&&r!==void 0?r:0,q=u+(m!=="center"?"-"+m:""),ne=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},H=Array.isArray(g)?g:[g],V=H.length>0,$={padding:ne,boundary:H.filter(DJ),altBoundary:V},{reference:B,floating:G,strategy:U,x:Q,y:re,placement:se,middlewareData:me,update:it}=w9({strategy:"fixed",placement:q,whileElementsMounted:y9,middleware:[_J(),e3({mainAxis:h+j,alignmentAxis:p}),w?t3({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?n3():void 0,...$}):void 0,O?S9({element:O,padding:f}):void 0,w?Qw({...$}):void 0,r3({...$,apply:({elements:Td,availableWidth:lY,availableHeight:cY})=>{Td.floating.style.setProperty("--radix-popper-available-width",`${lY}px`),Td.floating.style.setProperty("--radix-popper-available-height",`${cY}px`)}}),LJ({arrowWidth:Y,arrowHeight:j}),y?Jw({strategy:"referenceHidden"}):void 0].filter(PJ)});Pi(()=>{B(T.anchor)},[B,T.anchor]);let Qe=Q!==null&&re!==null,[Le,Pe]=k9(se),at=Sr(C);Pi(()=>{Qe&&at?.()},[Qe,at]);let xn=(i=me.arrow)===null||i===void 0?void 0:i.x,qh=(a=me.arrow)===null||a===void 0?void 0:a.y,Ql=((o=me.arrow)===null||o===void 0?void 0:o.centerOffset)!==0,[Jl,Pn]=(0,zt.useState)();Pi(()=>{I&&Pn(window.getComputedStyle(I).zIndex)},[I]);let{hasParent:mt,positionUpdateFns:wn}=TJ(Ag,d),mn=!mt;(0,zt.useLayoutEffect)(()=>{if(!mn)return wn.add(it),()=>{wn.delete(it)}},[mn,wn,it]),Pi(()=>{mn&&Qe&&Array.from(wn).reverse().forEach(Td=>requestAnimationFrame(Td))},[mn,Qe,wn]);let sk={"data-side":Le,"data-align":Pe,...A,ref:R,style:{...A.style,animation:Qe?void 0:"none",opacity:(s=me.hide)!==null&&s!==void 0&&s.referenceHidden?0:void 0}};return(0,zt.createElement)("div",{ref:G,"data-radix-popper-content-wrapper":"",style:{position:U,left:0,top:0,transform:Qe?`translate3d(${Math.round(Q)}px, ${Math.round(re)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:Jl,"--radix-popper-transform-origin":[(l=me.transformOrigin)===null||l===void 0?void 0:l.x,(c=me.transformOrigin)===null||c===void 0?void 0:c.y].join(" ")},dir:e.dir},(0,zt.createElement)(wJ,{scope:d,placedSide:Le,onArrowChange:P,arrowX:xn,arrowY:qh,shouldHideArrow:Ql},mn?(0,zt.createElement)(CJ,{scope:d,hasParent:!0,positionUpdateFns:wn},(0,zt.createElement)(sn.div,sk)):(0,zt.createElement)(sn.div,sk)))}),MJ="PopperArrow",AJ={top:"bottom",right:"left",bottom:"top",left:"right"},kJ=(0,zt.forwardRef)(function(t,n){let{__scopePopper:r,...i}=t,a=SJ(MJ,r),o=AJ[a.placedSide];return(0,zt.createElement)("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0}},(0,zt.createElement)(C9,Ue({},i,{ref:n,style:{...i.style,display:"block"}})))});function PJ(e){return e!==void 0}function DJ(e){return e!==null}var _J=()=>({name:"anchorCssProperties",fn(e){let{rects:t,elements:n}=e,{width:r,height:i}=t.reference;return n.floating.style.setProperty("--radix-popper-anchor-width",`${r}px`),n.floating.style.setProperty("--radix-popper-anchor-height",`${i}px`),{}}}),LJ=e=>({name:"transformOrigin",options:e,fn(t){var n,r,i,a,o;let{placement:s,rects:l,middlewareData:c}=t,u=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,h=u?0:e.arrowWidth,m=u?0:e.arrowHeight,[p,f]=k9(s),g={start:"0%",center:"50%",end:"100%"}[f],b=((r=(i=c.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+h/2,v=((a=(o=c.arrow)===null||o===void 0?void 0:o.y)!==null&&a!==void 0?a:0)+m/2,y="",w="";return p==="bottom"?(y=u?g:`${b}px`,w=`${-m}px`):p==="top"?(y=u?g:`${b}px`,w=`${l.floating.height+m}px`):p==="right"?(y=`${-m}px`,w=u?g:`${v}px`):p==="left"&&(y=`${l.floating.width+m}px`,w=u?g:`${v}px`),{data:{x:y,y:w}}}});function k9(e){let[t,n="center"]=e.split("-");return[t,n]}var P9=yJ,D9=xJ,_9=IJ,L9=kJ;S();var kg=_(J()),R9=_(ao());var O9=(0,kg.forwardRef)((e,t)=>{var n;let{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...i}=e;return r?R9.default.createPortal((0,kg.createElement)(sn.div,Ue({},i,{ref:t})),r):null});S();var sr=_(J()),N9=_(ao());function RJ(e,t){return(0,sr.useReducer)((n,r)=>{let i=t[n][r];return i??n},e)}var hu=e=>{let{present:t,children:n}=e,r=OJ(t),i=typeof n=="function"?n({present:r.isPresent}):sr.Children.only(n),a=Jn(r.ref,i.ref);return typeof n=="function"||r.isPresent?(0,sr.cloneElement)(i,{ref:a}):null};hu.displayName="Presence";function OJ(e){let[t,n]=(0,sr.useState)(),r=(0,sr.useRef)({}),i=(0,sr.useRef)(e),a=(0,sr.useRef)("none"),o=e?"mounted":"unmounted",[s,l]=RJ(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,sr.useEffect)(()=>{let c=Pg(r.current);a.current=s==="mounted"?c:"none"},[s]),Pi(()=>{let c=r.current,d=i.current;if(d!==e){let h=a.current,m=Pg(c);e?l("MOUNT"):m==="none"||c?.display==="none"?l("UNMOUNT"):l(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Pi(()=>{if(t){let c=u=>{let m=Pg(r.current).includes(u.animationName);u.target===t&&m&&(0,N9.flushSync)(()=>l("ANIMATION_END"))},d=u=>{u.target===t&&(a.current=Pg(r.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:(0,sr.useCallback)(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Pg(e){return e?.animationName||"none"}S();var ol=_(J());function mu({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=NJ({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=Sr(n),l=(0,ol.useCallback)(c=>{if(a){let u=typeof c=="function"?c(e):c;u!==e&&s(u)}else i(c)},[a,e,i,s]);return[o,l]}function NJ({defaultProp:e,onChange:t}){let n=(0,ol.useState)(e),[r]=n,i=(0,ol.useRef)(r),a=Sr(t);return(0,ol.useEffect)(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}S();var $J=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},pu=new WeakMap,Dg=new WeakMap,_g={},d3=0,$9=function(e){return e&&(e.host||$9(e.parentNode))},FJ=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=$9(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},BJ=function(e,t,n,r){var i=FJ(t,Array.isArray(e)?e:[e]);_g[n]||(_g[n]=new WeakMap);var a=_g[n],o=[],s=new Set,l=new Set(i),c=function(u){!u||s.has(u)||(s.add(u),c(u.parentNode))};i.forEach(c);var d=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(h){if(s.has(h))d(h);else try{var m=h.getAttribute(r),p=m!==null&&m!=="false",f=(pu.get(h)||0)+1,g=(a.get(h)||0)+1;pu.set(h,f),a.set(h,g),o.push(h),f===1&&p&&Dg.set(h,!0),g===1&&h.setAttribute(n,"true"),p||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(t),s.clear(),d3++,function(){o.forEach(function(u){var h=pu.get(u)-1,m=a.get(u)-1;pu.set(u,h),a.set(u,m),h||(Dg.has(u)||u.removeAttribute(r),Dg.delete(u)),m||u.removeAttribute(n)}),d3--,d3||(pu=new WeakMap,pu=new WeakMap,Dg=new WeakMap,_g={})}},F9=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||$J(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),BJ(r,i,n,"aria-hidden")):function(){return null}};S();S();S();var zr=function(){return zr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},zr.apply(this,arguments)};function Lg(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function B9(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Fg=_(J());S();var lr=_(J());S();var Tc="right-scroll-bar-position",Ic="width-before-scroll-bar",u3="with-scroll-bars-hidden",h3="--removed-body-scroll-bar-size";S();S();function Rg(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}S();var z9=_(J());function H9(e,t){var n=(0,z9.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}S();var Og=_(J());var zJ=typeof window<"u"?Og.useLayoutEffect:Og.useEffect,U9=new WeakMap;function m3(e,t){var n=H9(t||null,function(r){return e.forEach(function(i){return Rg(i,r)})});return zJ(function(){var r=U9.get(n);if(r){var i=new Set(r),a=new Set(e),o=n.current;i.forEach(function(s){a.has(s)||Rg(s,null)}),a.forEach(function(s){i.has(s)||Rg(s,o)})}U9.set(n,e)},[e]),n}S();S();S();function HJ(e){return e}function UJ(e,t){t===void 0&&(t=HJ);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var o=t(a,r);return n.push(o),function(){n=n.filter(function(s){return s!==o})}},assignSyncMedium:function(a){for(r=!0;n.length;){var o=n;n=[],o.forEach(a)}n={push:function(s){return a(s)},filter:function(){return n}}},assignMedium:function(a){r=!0;var o=[];if(n.length){var s=n;n=[],s.forEach(a),o=n}var l=function(){var d=o;o=[],d.forEach(a)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){o.push(d),c()},filter:function(d){return o=o.filter(d),n}}}};return i}function p3(e){e===void 0&&(e={});var t=UJ(null);return t.options=zr({async:!0,ssr:!1},e),t}S();var G9=_(J()),j9=function(e){var t=e.sideCar,n=Lg(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return G9.createElement(r,zr({},n))};j9.isSideCarExport=!0;function f3(e,t){return e.useMedium(t),j9}var Ng=p3();var g3=function(){},dp=lr.forwardRef(function(e,t){var n=lr.useRef(null),r=lr.useState({onScrollCapture:g3,onWheelCapture:g3,onTouchMoveCapture:g3}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,l=e.className,c=e.removeScrollBar,d=e.enabled,u=e.shards,h=e.sideCar,m=e.noIsolation,p=e.inert,f=e.allowPinchZoom,g=e.as,b=g===void 0?"div":g,v=Lg(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),y=h,w=m3([n,t]),C=zr(zr({},v),i);return lr.createElement(lr.Fragment,null,d&&lr.createElement(y,{sideCar:Ng,removeScrollBar:c,shards:u,noIsolation:m,inert:p,setCallbacks:a,allowPinchZoom:!!f,lockRef:n}),o?lr.cloneElement(lr.Children.only(s),zr(zr({},C),{ref:w})):lr.createElement(b,zr({},C,{className:l,ref:w}),s))});dp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};dp.classNames={fullWidth:Ic,zeroRight:Tc};S();S();var Ht=_(J());S();S();var gu=_(J());S();S();S();var Y9=_(J());S();S();var W9;var V9=function(){if(W9)return W9;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function GJ(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=V9();return t&&e.setAttribute("nonce",t),e}function jJ(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function WJ(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var E3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=GJ())&&(jJ(t,n),WJ(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}};var b3=function(){var e=E3();return function(t,n){Y9.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}};var up=function(){var e=b3(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t};S();var VJ={left:0,top:0,right:0,gap:0},y3=function(e){return parseInt(e||"",10)||0},YJ=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[y3(n),y3(r),y3(i)]},v3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return VJ;var t=YJ(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}};var ZJ=up(),fu="data-scroll-locked",KJ=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n="margin"),`
68
+ .`.concat(u3,` {
69
+ overflow: hidden `).concat(r,`;
70
+ padding-right: `).concat(s,"px ").concat(r,`;
71
+ }
72
+ body[`).concat(fu,`] {
73
+ overflow: hidden `).concat(r,`;
74
+ overscroll-behavior: contain;
75
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
76
+ padding-left: `.concat(i,`px;
77
+ padding-top: `).concat(a,`px;
78
+ padding-right: `).concat(o,`px;
79
+ margin-left:0;
80
+ margin-top:0;
81
+ margin-right: `).concat(s,"px ").concat(r,`;
82
+ `),n==="padding"&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),`
83
+ }
84
+
85
+ .`).concat(Tc,` {
86
+ right: `).concat(s,"px ").concat(r,`;
87
+ }
88
+
89
+ .`).concat(Ic,` {
90
+ margin-right: `).concat(s,"px ").concat(r,`;
91
+ }
92
+
93
+ .`).concat(Tc," .").concat(Tc,` {
94
+ right: 0 `).concat(r,`;
95
+ }
96
+
97
+ .`).concat(Ic," .").concat(Ic,` {
98
+ margin-right: 0 `).concat(r,`;
99
+ }
100
+
101
+ body[`).concat(fu,`] {
102
+ `).concat(h3,": ").concat(s,`px;
103
+ }
104
+ `)},Z9=function(){var e=parseInt(document.body.getAttribute(fu)||"0",10);return isFinite(e)?e:0},XJ=function(){gu.useEffect(function(){return document.body.setAttribute(fu,(Z9()+1).toString()),function(){var e=Z9()-1;e<=0?document.body.removeAttribute(fu):document.body.setAttribute(fu,e.toString())}},[])},x3=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;XJ();var a=gu.useMemo(function(){return v3(i)},[i]);return gu.createElement(ZJ,{styles:KJ(a,!t,i,n?"":"!important")})};S();var w3=!1;if(typeof window<"u")try{hp=Object.defineProperty({},"passive",{get:function(){return w3=!0,!0}}),window.addEventListener("test",hp,hp),window.removeEventListener("test",hp,hp)}catch{w3=!1}var hp,Mc=w3?{passive:!1}:!1;S();var qJ=function(e){return e.tagName==="TEXTAREA"},K9=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!qJ(e)&&n[t]==="visible")},QJ=function(e){return K9(e,"overflowY")},JJ=function(e){return K9(e,"overflowX")},S3=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=X9(e,n);if(r){var i=q9(e,n),a=i[1],o=i[2];if(a>o)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},eee=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},tee=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},X9=function(e,t){return e==="v"?QJ(t):JJ(t)},q9=function(e,t){return e==="v"?eee(t):tee(t)},nee=function(e,t){return e==="h"&&t==="rtl"?-1:1},Q9=function(e,t,n,r,i){var a=nee(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,l=t.contains(s),c=!1,d=o>0,u=0,h=0;do{var m=q9(e,s),p=m[0],f=m[1],g=m[2],b=f-g-a*p;(p||b)&&X9(e,s)&&(u+=b,h+=p),s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(d&&(i&&u===0||!i&&o>u)||!d&&(i&&h===0||!i&&-o>h))&&(c=!0),c};var $g=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},J9=function(e){return[e.deltaX,e.deltaY]},eL=function(e){return e&&"current"in e?e.current:e},ree=function(e,t){return e[0]===t[0]&&e[1]===t[1]},iee=function(e){return`
105
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
106
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
107
+ `)},aee=0,Eu=[];function tL(e){var t=Ht.useRef([]),n=Ht.useRef([0,0]),r=Ht.useRef(),i=Ht.useState(aee++)[0],a=Ht.useState(function(){return up()})[0],o=Ht.useRef(e);Ht.useEffect(function(){o.current=e},[e]),Ht.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var f=B9([e.lockRef.current],(e.shards||[]).map(eL),!0).filter(Boolean);return f.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),f.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var s=Ht.useCallback(function(f,g){if("touches"in f&&f.touches.length===2)return!o.current.allowPinchZoom;var b=$g(f),v=n.current,y="deltaX"in f?f.deltaX:v[0]-b[0],w="deltaY"in f?f.deltaY:v[1]-b[1],C,A=f.target,T=Math.abs(y)>Math.abs(w)?"h":"v";if("touches"in f&&T==="h"&&A.type==="range")return!1;var I=S3(T,A);if(!I)return!0;if(I?C=T:(C=T==="v"?"h":"v",I=S3(T,A)),!I)return!1;if(!r.current&&"changedTouches"in f&&(y||w)&&(r.current=C),!C)return!0;var k=r.current||C;return Q9(k,g,f,k==="h"?y:w,!0)},[]),l=Ht.useCallback(function(f){var g=f;if(!(!Eu.length||Eu[Eu.length-1]!==a)){var b="deltaY"in g?J9(g):$g(g),v=t.current.filter(function(C){return C.name===g.type&&C.target===g.target&&ree(C.delta,b)})[0];if(v&&v.should){g.cancelable&&g.preventDefault();return}if(!v){var y=(o.current.shards||[]).map(eL).filter(Boolean).filter(function(C){return C.contains(g.target)}),w=y.length>0?s(g,y[0]):!o.current.noIsolation;w&&g.cancelable&&g.preventDefault()}}},[]),c=Ht.useCallback(function(f,g,b,v){var y={name:f,delta:g,target:b,should:v};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(w){return w!==y})},1)},[]),d=Ht.useCallback(function(f){n.current=$g(f),r.current=void 0},[]),u=Ht.useCallback(function(f){c(f.type,J9(f),f.target,s(f,e.lockRef.current))},[]),h=Ht.useCallback(function(f){c(f.type,$g(f),f.target,s(f,e.lockRef.current))},[]);Ht.useEffect(function(){return Eu.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Mc),document.addEventListener("touchmove",l,Mc),document.addEventListener("touchstart",d,Mc),function(){Eu=Eu.filter(function(f){return f!==a}),document.removeEventListener("wheel",l,Mc),document.removeEventListener("touchmove",l,Mc),document.removeEventListener("touchstart",d,Mc)}},[]);var m=e.removeScrollBar,p=e.inert;return Ht.createElement(Ht.Fragment,null,p?Ht.createElement(a,{styles:iee(i)}):null,m?Ht.createElement(x3,{gapMode:"margin"}):null)}var nL=f3(Ng,tL);var rL=Fg.forwardRef(function(e,t){return Fg.createElement(dp,zr({},e,{ref:t,sideCar:nL}))});rL.classNames=dp.classNames;var C3=rL;var iL="Popover",[aL,cye]=oo(iL,[c3]),Bg=c3(),[oee,bu]=aL(iL),see=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Bg(t),l=(0,je.useRef)(null),[c,d]=(0,je.useState)(!1),[u=!1,h]=mu({prop:r,defaultProp:i,onChange:a});return(0,je.createElement)(P9,s,(0,je.createElement)(oee,{scope:t,contentId:cu(),triggerRef:l,open:u,onOpenChange:h,onOpenToggle:(0,je.useCallback)(()=>h(m=>!m),[h]),hasCustomAnchor:c,onCustomAnchorAdd:(0,je.useCallback)(()=>d(!0),[]),onCustomAnchorRemove:(0,je.useCallback)(()=>d(!1),[]),modal:o},n))};var lee="PopoverTrigger",cee=(0,je.forwardRef)((e,t)=>{let{__scopePopover:n,...r}=e,i=bu(lee,n),a=Bg(n),o=Jn(t,i.triggerRef),s=(0,je.createElement)(sn.button,Ue({type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":lL(i.open)},r,{ref:o,onClick:Sn(e.onClick,i.onOpenToggle)}));return i.hasCustomAnchor?s:(0,je.createElement)(D9,Ue({asChild:!0},a),s)}),oL="PopoverPortal",[dee,uee]=aL(oL,{forceMount:void 0}),hee=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=bu(oL,t);return(0,je.createElement)(dee,{scope:t,forceMount:n},(0,je.createElement)(hu,{present:n||a.open},(0,je.createElement)(O9,{asChild:!0,container:i},r)))},mp="PopoverContent",mee=(0,je.forwardRef)((e,t)=>{let n=uee(mp,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=bu(mp,e.__scopePopover);return(0,je.createElement)(hu,{present:r||a.open},a.modal?(0,je.createElement)(pee,Ue({},i,{ref:t})):(0,je.createElement)(fee,Ue({},i,{ref:t})))}),pee=(0,je.forwardRef)((e,t)=>{let n=bu(mp,e.__scopePopover),r=(0,je.useRef)(null),i=Jn(t,r),a=(0,je.useRef)(!1);return(0,je.useEffect)(()=>{let o=r.current;if(o)return F9(o)},[]),(0,je.createElement)(C3,{as:rl,allowPinchZoom:!0},(0,je.createElement)(sL,Ue({},e,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Sn(e.onCloseAutoFocus,o=>{var s;o.preventDefault(),a.current||(s=n.triggerRef.current)===null||s===void 0||s.focus()}),onPointerDownOutside:Sn(e.onPointerDownOutside,o=>{let s=o.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0,c=s.button===2||l;a.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Sn(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})))}),fee=(0,je.forwardRef)((e,t)=>{let n=bu(mp,e.__scopePopover),r=(0,je.useRef)(!1);return(0,je.createElement)(sL,Ue({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var a;if((a=e.onCloseAutoFocus)===null||a===void 0||a.call(e,i),!i.defaultPrevented){var o;r.current||(o=n.triggerRef.current)===null||o===void 0||o.focus(),i.preventDefault()}r.current=!1},onInteractOutside:i=>{var a,o;(a=e.onInteractOutside)===null||a===void 0||a.call(e,i),i.defaultPrevented||(r.current=!0);let s=i.target;((o=n.triggerRef.current)===null||o===void 0?void 0:o.contains(s))&&i.preventDefault()}}))}),sL=(0,je.forwardRef)((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...u}=e,h=bu(mp,n),m=Bg(n);return V_(),(0,je.createElement)(q_,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a},(0,je.createElement)(U_,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1)},(0,je.createElement)(_9,Ue({"data-state":lL(h.open),role:"dialog",id:h.contentId},m,u,{ref:t,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)"}}))))});var gee=(0,je.forwardRef)((e,t)=>{let{__scopePopover:n,...r}=e,i=Bg(n);return(0,je.createElement)(L9,Ue({},i,r,{ref:t}))});function lL(e){return e?"open":"closed"}var zg=see;var Hg=cee,cL=hee,Ug=mee;var dL=gee;var RU=_(J(),1),Yn=_(W(),1),Ul=_(J(),1),NU=_(ao(),1),$U=_(W(),1),kl=_(J(),1);var Pr=_(W(),1),ye=_(W(),1),XU=_(J(),1),qU=_(W(),1),Xc=_(W(),1),nG=_(W(),1),rG=_(J(),1),qf=_(W(),1),Wu=_(W(),1);var e1=_(W(),1),Wr=_(W(),1),N4=_(W(),1),Bc=_(W(),1),pG=_(J(),1);var $4=_(W(),1);var mr=_(W(),1),zc=_(W(),1),B4=_(W(),1),Oa=_(J(),1);var ps=_(W(),1),RG=_(W(),1),Fy=_(J(),1),FG=_(J(),1);var BG=_(W(),1),zG=_(ao(),1);var HG=_(J(),1),a1=_(W(),1);var By=_(J(),1);var Oh=_(J(),1),j4=_(J(),1);var W4=_(W(),1),WG=_(W(),1);var Hy=_(W(),1),Jp=_(J(),1);var qc=_(W(),1);var Nh=_(W(),1),Ei=_(J(),1);var ge=_(W(),1);var qG=_(W(),1),Gy=_(J(),1),Nl=_(W(),1),hE=_(W(),1),tj=_(W(),1),jy=_(W(),1);var Wy=_(J(),1),ef=_(W(),1),Y4=_(W(),1),oj=_(W(),1),tf=_(J(),1),Vy=_(W(),1),ph=_(J(),1);var Tn=_(W(),1);var Kl=_(J(),1),Qc=_(W(),1),Zy=_(J(),1),Yh=_(J(),1),Jc=_(W(),1),mj=_(J(),1);var pj=_(I3(),1),gr=_(J(),1),Wt=_(W(),1),bi=_(J(),1);var $i=_(W(),1);var qy=_(J(),1);var wl=_(W(),1);var yj=_(W(),1),ko=_(J(),1);var od=_(W(),1),xj=_(W(),1),pE=_(J(),1);S();var pp=_(J());S();S();var gL=e=>{let t,n=new Set,r=(d,u)=>{let h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){let m=t;t=u??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(p=>p(t,m))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>c,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(L?L.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(r,i,l);return l},EL=e=>e?gL(e):gL;var AL=_(J(),1),kL=_(TL(),1),{useDebugValue:qee}=AL.default,{useSyncExternalStoreWithSelector:Qee}=kL.default,IL=!1,Jee=e=>e;function ete(e,t=Jee,n){(L?L.MODE:void 0)!=="production"&&n&&!IL&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),IL=!0);let r=Qee(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return qee(r),r}var ML=e=>{(L?L.MODE:void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let t=typeof e=="function"?EL(e):e,n=(r,i)=>ete(t,r,i);return Object.assign(n,t),n},PL=e=>e?ML(e):ML;var DL,_L,LL=typeof window<"u"&&((DL=window.document)!=null&&DL.createElement||((_L=window.navigator)==null?void 0:_L.product)==="ReactNative")?pp.default.useLayoutEffect:pp.default.useEffect;function ma(){let e=PL(t=>({current:new Array,version:0,set:t}));return{In:({children:t})=>{let n=e(i=>i.set),r=e(i=>i.version);return LL(()=>{n(i=>({version:i.version+1}))},[]),LL(()=>(n(({current:i})=>({current:[...i,t]})),()=>n(({current:i})=>({current:i.filter(a=>a!==t)}))),[t,r]),null},Out:()=>{let t=e(n=>n.current);return pp.default.createElement(pp.default.Fragment,null,t)}}}var Cj=_(J(),1);var be=_(W(),1),kj=_(J(),1);var Jy=_(W(),1),Wi=_(J(),1);var Lj=_(NL(),1);var Lt=_(W(),1),tv=_(J(),1),iC=_(W(),1),zj=_(W(),1);var Hj=_(J(),1),ls=_(W(),1),nv=_(J(),1),gh=_(W(),1);var l1=_(W(),1);var lC=_(W(),1),rv=_(J(),1);var Eh=_(W(),1),di=_(J(),1),Ke=_(W(),1);var Vj=_(W(),1),cC=_(W(),1);var c1=_(W(),1),gd=_(W(),1);var d1=_(W(),1),_e=_(W(),1);var eW=_(W(),1),EE=_(W(),1),ct=_(W(),1),Xl=_(J(),1),Sl=_(W(),1),aW=_(J(),1),ee=_(W(),1),Cl=_(J(),1);var tr=_(W(),1);var lW=_(W(),1),cW=_(J(),1),Nn=_(W(),1),uW=_(W(),1);var Mr=_(W(),1),pW=_(J(),1);var gW=_(J(),1),ld=_(W(),1);var cd=_(W(),1);S();var Wn=_(J());S();var Nt=_(J());S();var pa=_(J());function $L(e){let t=e+"CollectionProvider",[n,r]=oo(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=m=>{let{scope:p,children:f}=m,g=pa.default.useRef(null),b=pa.default.useRef(new Map).current;return pa.default.createElement(i,{scope:p,itemMap:b,collectionRef:g},f)},s=e+"CollectionSlot",l=pa.default.forwardRef((m,p)=>{let{scope:f,children:g}=m,b=a(s,f),v=Jn(p,b.collectionRef);return pa.default.createElement(rl,{ref:v},g)}),c=e+"CollectionItemSlot",d="data-radix-collection-item",u=pa.default.forwardRef((m,p)=>{let{scope:f,children:g,...b}=m,v=pa.default.useRef(null),y=Jn(p,v),w=a(c,f);return pa.default.useEffect(()=>(w.itemMap.set(v,{ref:v,...b}),()=>void w.itemMap.delete(v))),pa.default.createElement(rl,{[d]:"",ref:y},g)});function h(m){let p=a(e+"CollectionConsumer",m);return pa.default.useCallback(()=>{let g=p.collectionRef.current;if(!g)return[];let b=Array.from(g.querySelectorAll(`[${d}]`));return Array.from(p.itemMap.values()).sort((w,C)=>b.indexOf(w.ref.current)-b.indexOf(C.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:o,Slot:l,ItemSlot:u},h,r]}S();var fp=_(J()),tte=(0,fp.createContext)(void 0);function Wg(e){let t=(0,fp.useContext)(tte);return e||t||"ltr"}var A3="rovingFocusGroup.onEntryFocus",nte={bubbles:!1,cancelable:!0},P3="RovingFocusGroup",[k3,FL,rte]=$L(P3),[ite,D3]=oo(P3,[rte]),[ate,ote]=ite(P3),ste=(0,Nt.forwardRef)((e,t)=>(0,Nt.createElement)(k3.Provider,{scope:e.__scopeRovingFocusGroup},(0,Nt.createElement)(k3.Slot,{scope:e.__scopeRovingFocusGroup},(0,Nt.createElement)(lte,Ue({},e,{ref:t}))))),lte=(0,Nt.forwardRef)((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,...d}=e,u=(0,Nt.useRef)(null),h=Jn(t,u),m=Wg(a),[p=null,f]=mu({prop:o,defaultProp:s,onChange:l}),[g,b]=(0,Nt.useState)(!1),v=Sr(c),y=FL(n),w=(0,Nt.useRef)(!1),[C,A]=(0,Nt.useState)(0);return(0,Nt.useEffect)(()=>{let T=u.current;if(T)return T.addEventListener(A3,v),()=>T.removeEventListener(A3,v)},[v]),(0,Nt.createElement)(ate,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:p,onItemFocus:(0,Nt.useCallback)(T=>f(T),[f]),onItemShiftTab:(0,Nt.useCallback)(()=>b(!0),[]),onFocusableItemAdd:(0,Nt.useCallback)(()=>A(T=>T+1),[]),onFocusableItemRemove:(0,Nt.useCallback)(()=>A(T=>T-1),[])},(0,Nt.createElement)(sn.div,Ue({tabIndex:g||C===0?-1:0,"data-orientation":r},d,{ref:h,style:{outline:"none",...e.style},onMouseDown:Sn(e.onMouseDown,()=>{w.current=!0}),onFocus:Sn(e.onFocus,T=>{let I=!w.current;if(T.target===T.currentTarget&&I&&!g){let k=new CustomEvent(A3,nte);if(T.currentTarget.dispatchEvent(k),!k.defaultPrevented){let R=y().filter(j=>j.focusable),O=R.find(j=>j.active),P=R.find(j=>j.id===p),Y=[O,P,...R].filter(Boolean).map(j=>j.ref.current);BL(Y)}}w.current=!1}),onBlur:Sn(e.onBlur,()=>b(!1))})))}),cte="RovingFocusGroupItem",dte=(0,Nt.forwardRef)((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,...o}=e,s=cu(),l=a||s,c=ote(cte,n),d=c.currentTabStopId===l,u=FL(n),{onFocusableItemAdd:h,onFocusableItemRemove:m}=c;return(0,Nt.useEffect)(()=>{if(r)return h(),()=>m()},[r,h,m]),(0,Nt.createElement)(k3.ItemSlot,{scope:n,id:l,focusable:r,active:i},(0,Nt.createElement)(sn.span,Ue({tabIndex:d?0:-1,"data-orientation":c.orientation},o,{ref:t,onMouseDown:Sn(e.onMouseDown,p=>{r?c.onItemFocus(l):p.preventDefault()}),onFocus:Sn(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Sn(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){c.onItemShiftTab();return}if(p.target!==p.currentTarget)return;let f=mte(p,c.orientation,c.dir);if(f!==void 0){p.preventDefault();let b=u().filter(v=>v.focusable).map(v=>v.ref.current);if(f==="last")b.reverse();else if(f==="prev"||f==="next"){f==="prev"&&b.reverse();let v=b.indexOf(p.currentTarget);b=c.loop?pte(b,v+1):b.slice(v+1)}setTimeout(()=>BL(b))}})})))}),ute={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hte(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mte(e,t,n){let r=hte(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ute[r]}function BL(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function pte(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var zL=ste,HL=dte;var UL="Tabs",[fte,ave]=oo(UL,[D3]),GL=D3(),[gte,_3]=fte(UL),Ete=(0,Wn.forwardRef)((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:s,activationMode:l="automatic",...c}=e,d=Wg(s),[u,h]=mu({prop:r,onChange:i,defaultProp:a});return(0,Wn.createElement)(gte,{scope:n,baseId:cu(),value:u,onValueChange:h,orientation:o,dir:d,activationMode:l},(0,Wn.createElement)(sn.div,Ue({dir:d,"data-orientation":o},c,{ref:t})))}),bte="TabsList",yte=(0,Wn.forwardRef)((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=_3(bte,n),o=GL(n);return(0,Wn.createElement)(zL,Ue({asChild:!0},o,{orientation:a.orientation,dir:a.dir,loop:r}),(0,Wn.createElement)(sn.div,Ue({role:"tablist","aria-orientation":a.orientation},i,{ref:t})))}),vte="TabsTrigger",xte=(0,Wn.forwardRef)((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=_3(vte,n),s=GL(n),l=jL(o.baseId,r),c=WL(o.baseId,r),d=r===o.value;return(0,Wn.createElement)(HL,Ue({asChild:!0},s,{focusable:!i,active:d}),(0,Wn.createElement)(sn.button,Ue({type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l},a,{ref:t,onMouseDown:Sn(e.onMouseDown,u=>{!i&&u.button===0&&u.ctrlKey===!1?o.onValueChange(r):u.preventDefault()}),onKeyDown:Sn(e.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&o.onValueChange(r)}),onFocus:Sn(e.onFocus,()=>{let u=o.activationMode!=="manual";!d&&!i&&u&&o.onValueChange(r)})})))}),wte="TabsContent",Ste=(0,Wn.forwardRef)((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=_3(wte,n),l=jL(s.baseId,r),c=WL(s.baseId,r),d=r===s.value,u=(0,Wn.useRef)(d);return(0,Wn.useEffect)(()=>{let h=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(h)},[]),(0,Wn.createElement)(hu,{present:i||d},({present:h})=>(0,Wn.createElement)(sn.div,Ue({"data-state":d?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0},o,{ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0}}),h&&a))});function jL(e,t){return`${e}-trigger-${t}`}function WL(e,t){return`${e}-content-${t}`}var Vg=Ete,Yg=yte,Zg=xte,Kg=Ste;var EW=_(W(),1);var fC=_(W(),1);var bW=_(W(),1);var yW=_(W(),1),kn=_(J(),1);var yC=_(W(),1),vW=_(J(),1);var Ps=_(W(),1);var Yt=_(W(),1);var ov=_(J(),1),CW=_(W(),1),ws=_(W(),1),cs=_(W(),1);var Fi=_(W(),1);var Bi=_(W(),1),IW=_(J(),1);var u1=_(W(),1),kW=_(W(),1);var LC=_(J(),1),PW=_(W(),1);var _W=_(W(),1),RC=_(J(),1),bn=_(W(),1),NW=_(W(),1);var yo=_(W(),1),p1=_(J(),1),BW=_(W(),1),Pl=_(W(),1),f1=_(W(),1),Na=_(J(),1),pr=_(W(),1);var jW=_(W(),1);var NC=_(W(),1),ka=_(J(),1);var jt=_(W(),1);var YW=_(J(),1);var le=_(W(),1),Kh=_(J(),1),g1=_(W(),1),ur=_(W(),1),BC=_(ao(),1),lV=_(J(),1);var Xh=_(J(),1),hV=_(W(),1),Ed=_(J(),1),pV=_(W(),1),lv=_(J(),1),UC=_(W(),1),EV=_(W(),1);var E1=_(W(),1),dd=_(W(),1);S();function Cte(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}var Tte={};Cte(Tte,"LaserPointer",()=>Ep);function ln([e,t,n],[r,i,a]){return[e+r,t+i,n+a]}function gp([e,t,n],[r,i,a]){return[e-r,t-i,n-a]}function Cn([e,t,n],r){return[e*r,t*r,n*r]}function vu([e,t,n]){return[e/Math.sqrt(e**2+t**2),t/Math.sqrt(e**2+t**2),n]}function cr([e,t,n],r){return[Math.cos(r)*e-Math.sin(r)*t,Math.sin(r)*e+Math.cos(r)*t,n]}function Ite(e,t,n){return ln(e,Cn(gp(t,e),n))}function VL(e,t,n){return Math.atan2(n[1]-e[1],n[0]-e[0])-Math.atan2(t[1]-e[1],t[0]-e[0])}function YL(e){return Math.atan2(Math.sin(e),Math.cos(e))}function ZL([e,t]){return Math.sqrt(e**2+t**2)}function xu([e,t],[n,r]){return Math.sqrt((n-e)**2+(r-t)**2)}function Mte(e){if(e.length<2)return 0;let t=0;for(let n=1;n<=e.length-1;n++)t+=xu(e[n-1],e[n]);return t+=xu(e[e.length-2],e[e.length-1]),t}var Ate=(e,t,n)=>Math.max(t,Math.min(n,e));function kte(e,t,n){let r=xu(t,n);if(r===0)return xu(e,t);let i=Ate(((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r**2,0,1),a=[t[0]+i*(n[0]-t[0]),t[1]+i*(n[1]-t[1]),e[2]];return xu(a,e)}function Xg(e,t){if(t===0||e.length<=2)return e;let n=e[0],r=e[e.length-1],[i,a]=e.reduce(([o,s],l,c)=>{let d=kte(l,n,r);return d>o?[d,c]:[o,s]},[0,-1]);if(i>=t){let o=e[a];return[...Xg([n,...e.slice(1,a),o],t).slice(0,-1),o,...Xg([o,...e.slice(a,-1),r],t).slice(1)]}else return[n,r]}var Ep=class e{static{this.defaults={size:2,streamline:.45,simplify:.1,simplifyPhase:"output",keepHead:!1,sizeMapping:()=>1}}static{this.constants={cornerDetectionMaxAngle:75,cornerDetectionVariance:t=>t>35?.5:1,maxTailLength:50}}constructor(t){this.originalPoints=[],this.stablePoints=[],this.tailPoints=[],this.isFresh=!0,this.options=Object.assign({},e.defaults,t)}get lastPoint(){return this.tailPoints[this.tailPoints.length-1]??this.stablePoints[this.stablePoints.length-1]}addPoint(t){let n=this.originalPoints[this.originalPoints.length-1];if(!(n&&n[0]===t[0]&&n[1]===t[1])){if(this.originalPoints.push(t),this.isFresh){this.isFresh=!1,this.stablePoints.push(t);return}this.options.streamline>0&&(t=Ite(this.lastPoint,t,1-this.options.streamline)),this.tailPoints.push(t),Mte(this.tailPoints)>e.constants.maxTailLength&&this.stabilizeTail()}}close(){this.stabilizeTail()}stabilizeTail(){if(this.options.simplify>0&&this.options.simplifyPhase=="tail")throw new Error("Not implemented yet");this.stablePoints.push(...this.tailPoints),this.tailPoints=[]}getSize(t,n,r,i,a){return(t??this.options.size)*this.options.sizeMapping({pressure:n,runningLength:a,currentIndex:r,totalLength:i})}getStrokeOutline(t){if(this.isFresh)return[];let n=[...this.stablePoints,...this.tailPoints];this.options.simplify>0&&this.options.simplifyPhase==="input"&&(n=Xg(n,this.options.simplify));let r=n.length;if(r===0)return[];if(r===1){let T=n[0],I=this.getSize(t,T[2],0,r,0);if(I<.5)return[];let k=[];for(let R=0;R<=Math.PI*2;R+=Math.PI/16)k.push(ln(T,Cn(cr([1,0,0],R),I)));return k.push(ln(T,Cn([1,0,0],this.getSize(t,T[2],0,r,0)))),k}if(r===2){let T=n[0],I=n[1],k=this.getSize(t,T[2],0,r,0),R=this.getSize(t,I[2],0,r,0);if(k<.5||R<.5)return[];let O=[],P=VL(T,[T[0],T[1]-100,T[2]],I);for(let F=P;F<=Math.PI+P;F+=Math.PI/16)O.push(ln(T,Cn(cr([1,0,0],F),k)));for(let F=Math.PI+P;F<=Math.PI*2+P;F+=Math.PI/16)O.push(ln(I,Cn(cr([1,0,0],F),R)));return O.push(O[0]),O}let i=[],a=[],o=0,s=0,l=0,c=0;for(let T=1;T<r-1;T++){let I=n[T-1],k=n[T],R=n[T+1],O=k[2],P=xu(I,k);c+=P,o=s+(P-s)*.2;let F=this.getSize(t,O,T,r,c);if(F===0){l=T+1;continue}let Y=vu(gp(I,k)),j=vu(gp(R,k)),q=cr(Y,Math.PI/2),ne=cr(Y,-Math.PI/2),H=cr(j,Math.PI/2),V=cr(j,-Math.PI/2),$=ln(k,Cn(q,F)),B=ln(k,Cn(ne,F)),G=ln(k,Cn(H,F)),U=ln(k,Cn(V,F)),Q=ln(q,V),re=ln(ne,H),se=ln(k,Cn(ZL(Q)===0?Y:vu(Q),F)),me=ln(k,Cn(ZL(re)===0?j:vu(re),F)),it=YL(VL(k,I,R)),Qe=e.constants.cornerDetectionMaxAngle/180*Math.PI*e.constants.cornerDetectionVariance(o);if(Math.abs(it)<Qe){let Le=Math.abs(YL(Math.PI-it));if(Le===0)continue;if(it<0){a.push(B,me);for(let Pe=0;Pe<=Le;Pe+=Le/4)i.push(ln(k,cr(Cn(q,F),Pe)));for(let Pe=Le;Pe>=0;Pe-=Le/4)a.push(ln(k,cr(Cn(q,F),Pe)));a.push(me,G)}else{i.push($,se);for(let Pe=0;Pe<=Le;Pe+=Le/4)a.push(ln(k,cr(Cn(q,-F),-Pe)));for(let Pe=Le;Pe>=0;Pe-=Le/4)i.push(ln(k,cr(Cn(q,-F),-Pe)));i.push(se,U)}}else i.push(se),a.push(me);s=o}if(l>=r-2)if(this.options.keepHead){let T=n[r-1],I=[];for(let k=0;k<=Math.PI*2;k+=Math.PI/16)I.push(ln(T,Cn(cr([1,0,0],k),this.options.size)));return I.push(ln(T,Cn([1,0,0],this.options.size))),I}else return[];let d=n[l],u=n[l+1],h=n[r-2],m=n[r-1],p=vu(gp(u,d)),f=vu(gp(h,m)),g=cr(p,-Math.PI/2),b=cr(f,Math.PI/2),v=this.getSize(t,d[2],0,r,0),y=[],w=this.options.keepHead?this.options.size:this.getSize(t,h[2],r-2,r,c),C=[];if(v>1){for(let T=0;T<=Math.PI;T+=Math.PI/16)y.unshift(ln(d,cr(Cn(g,v),-T)));y.unshift(ln(d,Cn(g,-v)))}else y.push(d);for(let T=0;T<=Math.PI*3;T+=Math.PI/16)C.push(ln(m,cr(Cn(b,-w),-T)));let A=[...y,...i,...C.reverse(),...a.reverse()];return y.length>0&&A.push(y[0]),this.options.simplify>0&&this.options.simplifyPhase==="output"?Xg(A,this.options.simplify):A}};var Mn=_(J(),1),wE=_(ao(),1);var CV=_(I3(),1),We=_(W(),1);var jC=_(W(),1),zi=_(W(),1),Dt=_(W(),1),wa=_(W(),1),Ta=_(W(),1);var dv=_(W(),1),b1=_(W(),1),uv=_(J(),1);var SE=_(W(),1),Pte=Object.defineProperty,Dte=e=>t=>{var n=e[t];if(n)return n();throw new Error("Module not found in bundle: "+t)},M=(e,t)=>()=>(e&&(t=e(e=0)),t),y1=(e,t)=>{for(var n in t)Pte(e,n,{get:t[n],enumerable:!0})},Ne,D=M(()=>{Ne={NODE_ENV:"production",VITE_APP_BACKEND_V2_GET_URL:"https://json.excalidraw.com/api/v2/",VITE_APP_BACKEND_V2_POST_URL:"https://json.excalidraw.com/api/v2/post/",VITE_APP_LIBRARY_URL:"https://libraries.excalidraw.com",VITE_APP_LIBRARY_BACKEND:"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries",VITE_APP_PLUS_LP:"https://plus.excalidraw.com",VITE_APP_PLUS_APP:"https://app.excalidraw.com",VITE_APP_AI_BACKEND:"https://oss-ai.excalidraw.com",VITE_APP_WS_SERVER_URL:"https://oss-collab.excalidraw.com",VITE_APP_FIREBASE_CONFIG:'{"apiKey":"AIzaSyAd15pYlMci_xIp9ko6wkEsDzAAA0Dn0RU","authDomain":"excalidraw-room-persistence.firebaseapp.com","databaseURL":"https://excalidraw-room-persistence.firebaseio.com","projectId":"excalidraw-room-persistence","storageBucket":"excalidraw-room-persistence.appspot.com","messagingSenderId":"654800341332","appId":"1:654800341332:web:4a692de832b55bd57ce0c1"}',VITE_APP_DISABLE_TRACKING:"",VITE_PKG_NAME:"@excalidraw/excalidraw",VITE_PKG_VERSION:"0.5.0-e56eec7",VITE_IS_EXCALIDRAW_NPM_PACKAGE:!0,PROD:!0}}),Xn,Pa,Hn=M(()=>{"use strict";D(),Xn=Symbol(),Pa=A_()}),HF,_te=M(()=>{HF=Dte({"./locales/ar-SA.json":()=>import("./ar-SA-JA6F2FMJ-MVAFRXH2.js"),"./locales/az-AZ.json":()=>import("./az-AZ-GVIENQVH-DULWV7IG.js"),"./locales/bg-BG.json":()=>import("./bg-BG-YFNNHCEP-TOMMDX7A.js"),"./locales/bn-BD.json":()=>import("./bn-BD-LMEIWSRD-U6EPN6XJ.js"),"./locales/ca-ES.json":()=>import("./ca-ES-C2WGCLOT-4Q2376G3.js"),"./locales/cs-CZ.json":()=>import("./cs-CZ-F2NDIQMB-4NMYRMO2.js"),"./locales/da-DK.json":()=>import("./da-DK-WBEQB3CJ-6YAF4DNI.js"),"./locales/de-DE.json":()=>import("./de-DE-VEIMCP7R-NSRLPHDI.js"),"./locales/el-GR.json":()=>import("./el-GR-TKRKG5GQ-6N4GY2DI.js"),"./locales/en.json":()=>import("./en-Q552WR7L-QAV42NF3.js"),"./locales/es-ES.json":()=>import("./es-ES-TOLWEZNW-ODY4LX7F.js"),"./locales/eu-ES.json":()=>import("./eu-ES-7CDRJQWJ-KF3KSB2X.js"),"./locales/fa-IR.json":()=>import("./fa-IR-527E2XGU-WLLGMWYR.js"),"./locales/fi-FI.json":()=>import("./fi-FI-NLQ7RQGZ-EZLGQEWF.js"),"./locales/fr-FR.json":()=>import("./fr-FR-KUHO4FLU-2OW7FE5V.js"),"./locales/gl-ES.json":()=>import("./gl-ES-NEXX3VBB-TESFDR6O.js"),"./locales/he-IL.json":()=>import("./he-IL-MED2VGBZ-N4VYRCHF.js"),"./locales/hi-IN.json":()=>import("./hi-IN-5V633W7V-4VXVQ6GE.js"),"./locales/hu-HU.json":()=>import("./hu-HU-2FOZGVGR-7CHHZRPD.js"),"./locales/id-ID.json":()=>import("./id-ID-I6BOLXTF-ULJRGCTU.js"),"./locales/it-IT.json":()=>import("./it-IT-WKPQOK4P-C3FTW2QG.js"),"./locales/ja-JP.json":()=>import("./ja-JP-VKA4ISRU-EBXFDMUP.js"),"./locales/kaa.json":()=>import("./kaa-IKPRSBNY-URJPWZZH.js"),"./locales/kab-KAB.json":()=>import("./kab-KAB-IE4PHQTZ-OMISFOMM.js"),"./locales/kk-KZ.json":()=>import("./kk-KZ-MNJT6XSV-56OVE4EH.js"),"./locales/km-KH.json":()=>import("./km-KH-LADGDFXV-KI7V2Z5A.js"),"./locales/ko-KR.json":()=>import("./ko-KR-XD7AVF2F-EFYGITKM.js"),"./locales/ku-TR.json":()=>import("./ku-TR-4XBHKDQA-U25XLPMW.js"),"./locales/lt-LT.json":()=>import("./lt-LT-QC35R4YH-6TDSRONI.js"),"./locales/lv-LV.json":()=>import("./lv-LV-GSD5D3BA-KMXM2FQ7.js"),"./locales/mr-IN.json":()=>import("./mr-IN-KOLSWM7Y-NVYC6JCO.js"),"./locales/my-MM.json":()=>import("./my-MM-M53KMUET-A2ORJJ2D.js"),"./locales/nb-NO.json":()=>import("./nb-NO-XXC6U37A-L4O4DGCC.js"),"./locales/nl-NL.json":()=>import("./nl-NL-HCCJQEUO-7Q2LV5NM.js"),"./locales/nn-NO.json":()=>import("./nn-NO-6P7Z2PI2-TUT2PFEE.js"),"./locales/oc-FR.json":()=>import("./oc-FR-JRJKPLNT-SBQHJH7X.js"),"./locales/pa-IN.json":()=>import("./pa-IN-LZWLEPIB-7NKOXI65.js"),"./locales/percentages.json":()=>import("./percentages-UCQDHIQF-Q4IM6ZEB.js"),"./locales/pl-PL.json":()=>import("./pl-PL-3WBLCXI2-E2SMTIVM.js"),"./locales/pt-BR.json":()=>import("./pt-BR-O3ZPTUNW-RS7M7EKX.js"),"./locales/pt-PT.json":()=>import("./pt-PT-7AQTSAFO-AEANJ2UN.js"),"./locales/ro-RO.json":()=>import("./ro-RO-HJ65JYWV-35XNZ4QJ.js"),"./locales/ru-RU.json":()=>import("./ru-RU-P7ROIYNC-ERPG3GJT.js"),"./locales/si-LK.json":()=>import("./si-LK-7ZSWVION-YHKN25MU.js"),"./locales/sk-SK.json":()=>import("./sk-SK-NXVBGLYY-IKQZT26E.js"),"./locales/sl-SI.json":()=>import("./sl-SI-VFTWOYNP-UPLNMI3E.js"),"./locales/sv-SE.json":()=>import("./sv-SE-YONBLQNW-ZG4TE7PV.js"),"./locales/ta-IN.json":()=>import("./ta-IN-BSETPMLX-FC54FMQJ.js"),"./locales/th-TH.json":()=>import("./th-TH-URTRDITB-K6QQ2PRO.js"),"./locales/tr-TR.json":()=>import("./tr-TR-N5SCAVTB-HMUEG6DN.js"),"./locales/uk-UA.json":()=>import("./uk-UA-LBCYVSQZ-DEJZCNRZ.js"),"./locales/vi-VN.json":()=>import("./vi-VN-POZWLIUU-EY6QFLQV.js"),"./locales/zh-CN.json":()=>import("./zh-CN-FUF5V3SC-5UIL2T3T.js"),"./locales/zh-HK.json":()=>import("./zh-HK-OB4VW42C-3ID2CCZJ.js"),"./locales/zh-TW.json":()=>import("./zh-TW-5JPVKOM7-VUPJBABS.js")})}),KL,jc,CE,bp,Ac,yp,WC,zh,L3,x,R3,hr,de=M(()=>{"use strict";D(),Hn(),_te(),KL=85,jc={code:"en",label:"English"},CE=[jc,...[{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",rtl:!0},{code:"bg-BG",label:"\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438"},{code:"ca-ES",label:"Catal\xE0"},{code:"cs-CZ",label:"\u010Cesky"},{code:"de-DE",label:"Deutsch"},{code:"el-GR",label:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"},{code:"es-ES",label:"Espa\xF1ol"},{code:"eu-ES",label:"Euskara"},{code:"fa-IR",label:"\u0641\u0627\u0631\u0633\u06CC",rtl:!0},{code:"fi-FI",label:"Suomi"},{code:"fr-FR",label:"Fran\xE7ais"},{code:"gl-ES",label:"Galego"},{code:"he-IL",label:"\u05E2\u05D1\u05E8\u05D9\u05EA",rtl:!0},{code:"hi-IN",label:"\u0939\u093F\u0928\u094D\u0926\u0940"},{code:"hu-HU",label:"Magyar"},{code:"id-ID",label:"Bahasa Indonesia"},{code:"it-IT",label:"Italiano"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E"},{code:"kab-KAB",label:"Taqbaylit"},{code:"kk-KZ",label:"\u049A\u0430\u0437\u0430\u049B \u0442\u0456\u043B\u0456"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4"},{code:"ku-TR",label:"Kurd\xEE"},{code:"lt-LT",label:"Lietuvi\u0173"},{code:"lv-LV",label:"Latvie\u0161u"},{code:"my-MM",label:"Burmese"},{code:"nb-NO",label:"Norsk bokm\xE5l"},{code:"nl-NL",label:"Nederlands"},{code:"nn-NO",label:"Norsk nynorsk"},{code:"oc-FR",label:"Occitan"},{code:"pa-IN",label:"\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40"},{code:"pl-PL",label:"Polski"},{code:"pt-BR",label:"Portugu\xEAs Brasileiro"},{code:"pt-PT",label:"Portugu\xEAs"},{code:"ro-RO",label:"Rom\xE2n\u0103"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},{code:"sk-SK",label:"Sloven\u010Dina"},{code:"sv-SE",label:"Svenska"},{code:"sl-SI",label:"Sloven\u0161\u010Dina"},{code:"tr-TR",label:"T\xFCrk\xE7e"},{code:"uk-UA",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"},{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587"},{code:"vi-VN",label:"Ti\u1EBFng Vi\u1EC7t"},{code:"mr-IN",label:"\u092E\u0930\u093E\u0920\u0940"}].filter(e=>lk[e.code]>=KL).sort((e,t)=>e.label>t.label?1:-1)],bp="__test__",Ne.DEV&&CE.unshift({code:bp,label:"test language"},{code:`${bp}.rtl`,label:"\u202Atest language (rtl)\u202C",rtl:!0}),Ac=jc,yp={},WC=async e=>{if(Ac=e,document.documentElement.dir=Ac.rtl?"rtl":"ltr",document.documentElement.lang=Ac.code,e.code.startsWith(bp))yp={};else try{yp=await HF(`./locales/${Ac.code}.json`)}catch(t){console.error(`Failed to load language ${e.code}:`,t.message),yp=xv}Pa.set(R3,e.code)},zh=()=>Ac,L3=(e,t)=>{for(let n=0;n<t.length;++n){let r=t[n];if(e[r]===void 0)return;e=e[r]}if(typeof e=="string")return e},x=(e,t,n)=>{if(Ac.code.startsWith(bp))return`\u202A[[${t?`${e}(${JSON.stringify(t).slice(1,-1)})`:e}]]\u202C`;let r=e.split("."),i=L3(yp,r)||L3(xv,r)||n;if(i===void 0){let a=`Can't find translation for ${e}`;if(Ne.PROD)return console.warn(a),"";throw new Error(a)}if(t)for(let a in t)i=i.replace(`{{${a}}}`,String(t[a]));return i},R3=_t(jc.code),hr=()=>{let e=ip(R3,Xn);return{t:x,langCode:e}}}),Lte=M(()=>{}),XL,Co,jl=M(()=>{"use strict";D(),Lte(),XL=({size:e="1em",circleWidth:t=8,synchronized:n=!1})=>{let r=-(UF.default.useRef(Date.now()).current%1600);return(0,V2.jsx)("div",{className:"Spinner",children:(0,V2.jsx)("svg",{viewBox:"0 0 100 100",style:{width:e,height:e,"--spinner-delay":n?`${r}ms`:0},children:(0,V2.jsx)("circle",{cx:"50",cy:"50",r:50-t/2,strokeWidth:t,fill:"none",strokeMiterlimit:"10"})})})},Co=XL}),Ia,VC,GF,bh,qL,Rte,YC,jF,TE,IE,pl,af,WF,p5,VF,gs,YF,gt,ul,Rc,zp,xa,ZC,Zn,ze,Kt,f5,Y2,Vi,To,v1,Mf,ed,KC,Ui,yh,ME,AE,QL,ZF,KF,td,kE,XF,we,Z2,hi,PE,qF,QF,JF,eB,Yu,of,g5,tB,Zb,K2,X2,E5,nB,rB,iB,aB,oB,Bu,Kb,Hh,sB,b5,Pt,Af,In,lB,cB,Yr,vh,dB,q2,uB,Fn,y5,Q2,Zt,DE,Ss,XC,$n,Cs,qC,ae=M(()=>{"use strict";D(),Ia=/Mac|iPod|iPhone|iPad/.test(navigator.platform),VC=/^Win/.test(navigator.platform),GF=/\b(android)\b/i.test(navigator.userAgent),bh="netscape"in window&&navigator.userAgent.indexOf("rv:")>1&&navigator.userAgent.indexOf("Gecko")>1,qL=navigator.userAgent.indexOf("Chrome")!==-1,Rte=!qL&&navigator.userAgent.indexOf("Safari")!==-1,YC=/iPad|iPhone/.test(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,jF=()=>navigator.brave?.isBrave?.name==="isBrave",TE=typeof window<"u"&&"ResizeObserver"in window,IE="Excalidraw",pl=10,af=8,WF=5,p5=1,VF=30,gs=Math.PI/12,YF="red",gt={TEXT:"text",CROSSHAIR:"crosshair",GRABBING:"grabbing",GRAB:"grab",POINTER:"pointer",MOVE:"move",AUTO:""},ul={MAIN:0,WHEEL:1,SECONDARY:2,TOUCH:-1,ERASER:5},Rc={enabled:"all",disabled:"none",inheritFromUI:"var(--ui-pointerEvents)"},zp={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},xa={TEST:"test"},ZC={SHAPE_ACTIONS_MENU:"App-menu__left"},Zn={Virgil:1,Helvetica:2,Cascadia:3,Assistant:4},ze={LIGHT:"light",DARK:"dark"},Kt={strokeColor:"#bbb",strokeWidth:2,strokeStyle:"solid",fillStyle:"solid",roughness:0,roundness:null,backgroundColor:"transparent",radius:8,nameOffsetY:3,nameColorLightTheme:"#999999",nameColorDarkTheme:"#7a7a7a",nameFontSize:14,nameLineHeight:1.25},f5="Segoe UI Emoji",Y2=1,Vi=20,To=Zn.Virgil,v1="left",Mf="top",ed=2,KC=1,Ui="#ffffff",yh="#1e1e1e",ME="transparent",AE=2*ed,QL=1e-5,ZF=2*AE-QL,KF="#a2f1a6",td=20,kE={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",jfif:"image/jfif"},XF=["text/plain","text/html"],we={json:"application/json",excalidraw:"application/vnd.excalidraw+json",excalidrawlib:"application/vnd.excalidrawlib+json","excalidraw.svg":"image/svg+xml","excalidraw.png":"image/png",binary:"application/octet-stream",...kE},Z2={png:"png",svg:"svg",clipboard:"clipboard"},hi={excalidraw:"excalidraw",excalidrawClipboard:"excalidraw/clipboard",excalidrawLibrary:"excalidrawlib",excalidrawClipboardWithAPI:"excalidraw-api/clipboard"},PE=window.EXCALIDRAW_EXPORT_SOURCE||window.location.origin,qF=500,QF=300,JF=500,eB=100,Yu=.1,of=.1,g5=30,tB=300,Zb="invert(93%) hue-rotate(180deg)",K2={addLibrary:"addLibrary"},X2={addLibrary:"addLibrary"},E5={canvasActions:{changeViewBackgroundColor:!0,clearCanvas:!0,export:{saveFileToDisk:!0},loadScene:!0,saveToActiveFile:!0,toggleTheme:null,saveAsImage:!0},tools:{image:!0}},nB=800,rB=1e3,iB=500,aB=1229,oB=302,Bu=2,Kb=[1,2,3],Hh=10,sB=1440,b5=2*1024*1024,Pt="http://www.w3.org/2000/svg",Af={excalidraw:2,excalidrawLibrary:2},In=5,lB=.7,cB=11,Yr={TOP:"top",MIDDLE:"middle",BOTTOM:"bottom"},vh={LEFT:"left",CENTER:"center",RIGHT:"right"},dB=20,q2=.25,uB=32,Fn={LEGACY:1,PROPORTIONAL_RADIUS:2,ADAPTIVE_RADIUS:3},y5={architect:0,artist:1,cartoonist:2},Q2={thin:1,bold:2,extraBold:4},Zt={strokeColor:yh,backgroundColor:ME,fillStyle:"solid",strokeWidth:2,strokeStyle:"solid",roughness:y5.artist,opacity:100,locked:!1},DE="library",Ss={name:"default",defaultTab:DE},XC=new Set(["iframe","embeddable","image"]),$n={selection:"selection",rectangle:"rectangle",diamond:"diamond",ellipse:"ellipse",arrow:"arrow",line:"line",freedraw:"freedraw",text:"text",image:"image",eraser:"eraser",hand:"hand",frame:"frame",magicframe:"magicframe",embeddable:"embeddable",laser:"laser"},Cs={OAI_API_KEY:"excalidraw-oai-api-key",MERMAID_TO_EXCALIDRAW:"mermaid-to-excalidraw",PUBLISH_LIBRARY:"publish-library-data"},qC="Untitled"}),QC,hB=M(()=>{"use strict";D(),de(),jl(),ae(),QC=({delay:e,theme:t})=>{let[n,r]=(0,Xb.useState)(!!e);return(0,Xb.useEffect)(()=>{if(!e)return;let i=setTimeout(()=>{r(!1)},e);return()=>clearTimeout(i)},[e]),n?null:(0,th.jsxs)("div",{className:X("LoadingMessage",{"LoadingMessage--dark":t===ze.DARK}),children:[(0,th.jsx)("div",{children:(0,th.jsx)(Co,{})}),(0,th.jsx)("div",{className:"LoadingMessage-text",children:x("labels.loadingScene")})]})}}),pB,Ote=M(()=>{"use strict";D(),hB(),de(),pB=e=>{let[t,n]=(0,qb.useState)(!0);return(0,qb.useEffect)(()=>{let r=async()=>{await WC(i),n(!1)},i=CE.find(a=>a.code===e.langCode)||jc;r()},[e.langCode]),t?(0,mB.jsx)(QC,{theme:e.theme}):e.children}});function cn(e,t,n,r){return e?(e?.addEventListener?.(t,n,r),()=>{e?.removeEventListener?.(t,n,r)}):()=>{}}function Nte(e,t=!0){let n=e.length;if(n<4)return"";let r=e[0],i=e[1],a=e[2],o=`M${r[0].toFixed(2)},${r[1].toFixed(2)} Q${i[0].toFixed(2)},${i[1].toFixed(2)} ${Up(i[0],a[0]).toFixed(2)},${Up(i[1],a[1]).toFixed(2)} T`;for(let s=2,l=n-1;s<l;s++)r=e[s],i=e[s+1],o+=`${Up(r[0],i[0]).toFixed(2)},${Up(r[1],i[1]).toFixed(2)} `;return t&&(o+="Z"),o}var O3,v5,nd,fB,x5,gB,ds,kf,An,Pf,Qb,Dl,N3,EB,bB,nr,hn,K,Ft,Gi,Hp,JL,eR,tR,JC,Es,eT,w5,S5,Sa,tT,yB,vB,xB,wB,rd,ve,SB,po,$l,CB,nT,sf,TB,Uh,_E,$3,Bn,x1,_l,IB,LE,ud,C5,J2,Up,rT,Ts,RE,MB,te=M(()=>{"use strict";D(),ae(),O3=null,v5=()=>{if(O3)return O3;let e=new Date,t=e.getFullYear(),n=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0"),i=`${e.getHours()}`.padStart(2,"0"),a=`${e.getMinutes()}`.padStart(2,"0");return`${t}-${n}-${r}-${i}${a}`},nd=e=>e.charAt(0).toUpperCase()+e.slice(1),fB=e=>e instanceof HTMLElement&&e.className.includes("ToolIcon"),x5=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,gB=e=>x5(e)||e instanceof Element&&!!e.closest("label, button"),ds=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&(e.type==="text"||e.type==="number"||e.type==="password"),kf=({fontFamily:e})=>{for(let[t,n]of Object.entries(Zn))if(n===e)return`${t}, ${f5}`;return f5},An=({fontSize:e,fontFamily:t})=>`${e}px ${kf({fontFamily:t})}`,Pf=(e,t)=>{let n=0,r=null,i=(...a)=>{r=a,clearTimeout(n),n=window.setTimeout(()=>{r=null,e(...a)},t)};return i.flush=()=>{if(clearTimeout(n),r){let a=r;r=null,e(...a)}},i.cancel=()=>{r=null,clearTimeout(n)},i},Qb=(e,t)=>{let n=null,r=null,i=null,a=s=>{n=window.requestAnimationFrame(()=>{n=null,e(...s),r=null,i&&(r=i,i=null,a(r))})},o=(...s)=>{if(Ne.MODE==="test"){e(...s);return}r=s,n===null?a(r):t?.trailing&&(i=s)};return o.flush=()=>{n!==null&&(cancelAnimationFrame(n),n=null),r&&(e(...i||r),r=i=null)},o.cancel=()=>{r=i=null,n!==null&&(cancelAnimationFrame(n),n=null)},o},Dl=e=>1-Math.pow(1-e,4),N3=(e,t,n)=>(t-e)*Dl(n)+e,EB=({fromValues:e,toValues:t,onStep:n,duration:r=250,interpolateValue:i,onStart:a,onEnd:o,onCancel:s})=>{let l=!1,c=0,d;function u(h){if(l)return;d===void 0&&(d=h,a?.());let m=Math.min(h-d,r),p=Dl(m/r),f={};if(Object.keys(e).forEach(g=>{let b=g,v=(t[b]-e[b])*p+e[b];f[b]=v}),n(f),m<r){let g=m/r,b={};Object.keys(e).forEach(v=>{let y=v,w=e[y],C=t[y],A;A=i?i(w,C,g,y):N3(w,C,g),A==null&&(A=N3(w,C,g)),b[y]=A}),n(b),c=window.requestAnimationFrame(u)}else n(t),o?.()}return c=window.requestAnimationFrame(u),()=>{s?.(),l=!0,window.cancelAnimationFrame(c)}},bB=(e,t)=>{if(!e.length||t<1)return[];let n=0,r=0,i=Array(Math.ceil(e.length/t));for(;n<e.length;)i[r++]=e.slice(n,n+=t);return i},nr=(e,t)=>Math.abs(e-t),hn=(e,t)=>t.type==="custom"?{...e.activeTool,type:"custom",customType:t.customType,locked:t.locked??e.activeTool.locked}:{...e.activeTool,lastActiveTool:t.lastActiveToolBeforeEraser===void 0?e.activeTool.lastActiveTool:t.lastActiveToolBeforeEraser,type:t.type,customType:null,locked:t.locked??e.activeTool.locked},K=e=>(e=e.replace(/\bAlt\b/i,"Alt").replace(/\bShift\b/i,"Shift").replace(/\b(Enter|Return)\b/i,"Enter"),Ia?e.replace(/\bCtrlOrCmd\b/gi,"Cmd").replace(/\bAlt\b/i,"Option"):e.replace(/\bCtrlOrCmd\b/gi,"Ctrl")),Ft=({clientX:e,clientY:t},{zoom:n,offsetLeft:r,offsetTop:i,scrollX:a,scrollY:o})=>{let s=(e-r)/n.value-a,l=(t-i)/n.value-o;return{x:s,y:l}},Gi=({sceneX:e,sceneY:t},{zoom:n,offsetLeft:r,offsetTop:i,scrollX:a,scrollY:o})=>{let s=(e+a)*n.value+r,l=(t+o)*n.value+i;return{x:s,y:l}},Hp=e=>getComputedStyle(document.documentElement).getPropertyValue(`--${e}`),JL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF",eR="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",tR=new RegExp(`^[^${JL}]*[${eR}]`),JC=e=>tR.test(e),Es=e=>{let[t,n]=e;return{x:t,y:n}},eT=e=>{if(e?.name==="AbortError"){console.warn(e);return}throw e},w5=(e,t,n=0)=>{n<0&&(n=e.length+n),n=Math.min(e.length,Math.max(n,0));let r=n-1;for(;++r<e.length;)if(t(e[r],r,e))return r;return-1},S5=(e,t,n=e.length-1)=>{n<0&&(n=e.length+n),n=Math.min(e.length-1,Math.max(n,0));let r=n+1;for(;--r>-1;)if(t(e[r],r,e))return r;return-1},Sa=e=>{let t=e.length===5&&e.substr(4,1)==="0",n=e.length===9&&e.substr(7,2)==="00";return t||n||e===ME},tT=()=>{let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n},yB=e=>{let t=e.parentElement;for(;t;){if(t===document.body)return document;let{overflowY:n}=window.getComputedStyle(t);if(t.scrollHeight>t.clientHeight&&(n==="auto"||n==="scroll"||n==="overlay"))return t;t=t.parentElement}return document},vB=e=>{let t=e.parentElement;for(;t;){if(t.tabIndex>-1){t.focus();return}t=t.parentElement}},xB=e=>{e.preventDefault(),e.returnValue=""},wB=e=>Array.from(e).map(t=>`0${t.toString(16)}`.slice(-2)).join(""),rd=()=>$l()?1:Date.now(),ve=e=>e instanceof Map?e:e.reduce((t,n)=>(t.set(typeof n=="string"?n:n.id,n),t),new Map),SB=e=>e.reduce((t,n,r)=>(t.set(n.id,[n,r]),t),new Map),po=(e,t)=>e.reduce((n,r)=>(n[t?t(r):String(r)]=r,n),{}),$l=()=>Ne.MODE==="test",CB=()=>Ne.MODE==="development",nT=(e,t)=>new CustomEvent(e,{detail:{nativeEvent:t},cancelable:!0}),sf=(e,t)=>{let n=!1;for(let r in t){let i=t[r];if(typeof i<"u"){if(e[r]===i&&(typeof i!="object"||i===null))continue;n=!0}}return n?{...e,...t}:e},TB=()=>{try{return window.self===window.top?"top":"iframe"}catch{return"iframe"}},Uh=e=>!!e&&typeof e=="object"&&"then"in e&&"catch"in e&&"finally"in e,_E=e=>{let t=e?.querySelectorAll("button, a, input, select, textarea, div[tabindex], label[tabindex]");return t?Array.from(t).filter(n=>n.tabIndex>-1&&!n.disabled):[]},$3=(e,t)=>Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t,Bn=(e,t,n,r=!1)=>{let i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return r&&console.warn("%cisShallowEqual: objects don't have same properties ->","color: #8B4000",e,t),!1;if(n&&Array.isArray(n)){for(let o of n)if(!(e[o]===t[o]||$3(e[o],t[o])))return r&&console.warn(`%cisShallowEqual: ${o} not equal ->`,"color: #8B4000",e[o],t[o]),!1;return!0}return i.every(o=>{let s=n?.[o],l=s?s(e[o],t[o]):e[o]===t[o]||$3(e[o],t[o]);return!l&&r&&console.warn(`%cisShallowEqual: ${o} not equal ->`,"color: #8B4000",e[o],t[o]),l})},x1=(e,t,{checkForDefaultPrevented:n=!0}={})=>function(r){if(e?.(r),!n||!r?.defaultPrevented)return t?.(r)},_l=(e,t,n)=>{if(!t)return e;if(n)return console.error(t),e;throw new Error(t)},IB=e=>{let t,n,r=function(i){let a=Object.entries(i);if(t){let s=!0;for(let[l,c]of a)if(t.get(l)!==c){s=!1;break}if(s)return n}let o=e(i);return t=new Map(a),n=o,o};return r.clear=()=>{t=void 0,n=void 0},r},LE=(e,t)=>e instanceof Set||e instanceof Map?e.has(t):"includes"in e?e.includes(t):e.hasOwnProperty(t),ud=e=>JSON.parse(JSON.stringify(e)),C5=e=>typeof e=="number"&&Number.isFinite(e),J2=(e,t)=>Bn(e,t)?e:t,Up=(e,t)=>(e+t)/2,rT=e=>e.replace(/\r?\n|\r/g,`
108
+ `),Ts=e=>e,RE=async(e,...t)=>new Promise(n=>{n(e(...t))}),MB=(e,t)=>t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{})}),Ma,Ll,fr,ss,mi,he,xh,Zu,Ae,Ar,nR,Be,Et,OE,kr,T5,fl,Rl,iT,Io,tn,id,F3,AB,kB,Se=M(()=>{"use strict";D(),ae(),te(),Ma=e=>!!e&&e.type==="image"&&!!e.fileId,Ll=e=>!!e&&e.type==="image",fr=e=>!!e&&e.type==="embeddable",ss=e=>!!e&&e.type==="iframe",mi=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),he=e=>e!=null&&e.type==="text",xh=e=>e!=null&&e.type==="frame",Zu=e=>e!=null&&e.type==="magicframe",Ae=e=>e!=null&&(e.type==="frame"||e.type==="magicframe"),Ar=e=>e!=null&&nR(e.type),nR=e=>e==="freedraw",Be=e=>e!=null&&OE(e.type),Et=e=>e!=null&&e.type==="arrow",OE=e=>e==="arrow"||e==="line",kr=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&T5(e.type),T5=e=>e==="arrow",fl=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),Rl=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||Et(e)),iT=e=>{let t=e?.type;if(!t)return!1;switch(t){case"text":case"diamond":case"rectangle":case"iframe":case"embeddable":case"ellipse":case"arrow":case"freedraw":case"line":case"frame":case"magicframe":case"image":case"selection":return!0;default:return _l(t,null),!1}},Io=e=>Rl(e)&&!!e.boundElements?.some(({type:t})=>t==="text"),tn=e=>e!==null&&"containerId"in e&&e.containerId!==null&&he(e),id=e=>e==="rectangle"||e==="embeddable"||e==="iframe"||e==="image",F3=e=>e==="line"||e==="arrow"||e==="diamond",AB=(e,t)=>!!((e===Fn.ADAPTIVE_RADIUS||e===Fn.LEGACY)&&id(t.type)||e===Fn.PROPORTIONAL_RADIUS&&F3(t.type)),kB=e=>F3(e.type)?{type:Fn.PROPORTIONAL_RADIUS}:id(e.type)?{type:Fn.ADAPTIVE_RADIUS}:null}),rR,iR,Is,pi,Ao=M(()=>{"use strict";D(),te(),rR=new Ys(Date.now()),iR=0,Is=()=>Math.floor(rR.next()*2**31),pi=()=>$l()?`id${iR++}`:Ka()}),PB,w1,gl,DB,bd=M(()=>{"use strict";D(),PB=class extends Error{constructor(e="Couldn't export canvas.",t="CANVAS_ERROR"){super(),this.name=t,this.message=e}},w1=class extends DOMException{constructor(e="Request Aborted"){super(e,"AbortError")}},gl=class extends Error{code;constructor(e="Image Scene Data Error",t="IMAGE_SCENE_DATA_ERROR"){super(e),this.name="EncodingError",this.code=t}},DB=class extends Error{code="ELEMENT_HAS_INVALID_INDEX"}}),I5,aT,Yi,wo,aR,oR,wu,B3,z3,$a=M(()=>{"use strict";D(),vt(),bd(),I5=e=>{for(let[t,n]of e.entries()){let r=e[t-1],i=e[t+1];if(!wu(n,r,i))throw new DB(`Fractional indices invariant for element has been compromised - ["${r}", "${n}", "${i}"] [predecessor, current, successor]`)}},aT=e=>e.sort((t,n)=>z3(t)&&z3(n)?t.index<n.index?-1:t.index>n.index?1:t.id<n.id?-1:1:1),Yi=(e,t)=>{try{let n=aR(e,t),r=B3(e,n);I5(e.map(i=>r.get(i)?.index||i.index));for(let[i,a]of r)ie(i,a,!1)}catch{wo(e)}return e},wo=e=>{let t=oR(e),n=B3(e,t);for(let[r,i]of n)ie(r,i,!1);return e},aR=(e,t)=>{let n=[],r=0;for(;r<e.length;)if(t.has(e[r].id)&&!wu(e[r]?.index,e[r-1]?.index,e[r+1]?.index)){let i=[r-1,r];for(;++r<e.length&&t.has(e[r].id)&&!wu(e[r]?.index,e[r-1]?.index,e[r+1]?.index);)i.push(r);i.push(r),n.push(i)}else r++;return n},oR=e=>{let t=[],n,r,i=-1,a=0,o=c=>{let d=e[i]?e[i].index:void 0,u=e[c-1]?.index;return!d&&u||d&&u&&u>d?[u,c-1]:[d,i]},s=c=>{let d=e[a]?e[a].index:void 0;if(d&&c<a)return[d,a];let u=a;for(;++u<e.length;){let h=e[u]?.index;if(!d&&h||d&&h&&h>d)return[h,u]}return[void 0,u]},l=0;for(;l<e.length;){let c=e[l].index;if([n,i]=o(l),[r,a]=s(l),wu(c,n,r))l++;else{let d=[i,l];for(;++l<e.length;){let u=e[l].index,[h,m]=o(l),[p,f]=s(l);if(wu(u,h,p))break;[n,i]=[h,m],[r,a]=[p,f],d.push(l)}d.push(a),t.push(d)}}return t},wu=(e,t,n)=>e?t&&n?t<e&&e<n:!t&&n?e<n:t&&!n?t<e:!!e:!1,B3=(e,t)=>{let n=new Map;for(let r of t){let i=r.shift(),a=r.pop(),o=ru(e[i]?.index,e[a]?.index,r.length);for(let s=0;s<r.length;s++){let l=e[r[s]];n.set(l,{index:o[s]})}}return n},z3=e=>!!e.index}),H3,sR,U3,lR,_r,yd=M(()=>{"use strict";D(),Oe(),Se(),xd(),Ao(),$a(),te(),te(),ae(),H3=e=>{let t=new Map,n=[];for(let r of e)r.isDeleted||(n.push(r),t.set(r.id,r));return{elementsMap:t,elements:n}},sR=e=>{let t=["includeBoundTextElement","includeElementsInFrames"],n="";for(let r of t)n+=`${r}:${e[r]?"1":"0"}`;return n},U3=e=>typeof e=="string",lR=class eE{static sceneMapByElement=new WeakMap;static sceneMapById=new Map;static mapElementToScene(t,n){U3(t)?this.sceneMapById.set(t,n):(this.sceneMapByElement.set(t,n),this.sceneMapById.set(t.id,n))}static getScene(t){return U3(t)?this.sceneMapById.get(t)||null:this.sceneMapByElement.get(t)||null}callbacks=new Set;nonDeletedElements=[];nonDeletedElementsMap=Ts(new Map);elements=[];nonDeletedFramesLikes=[];frames=[];elementsMap=Ts(new Map);selectedElementsCache={selectedElementIds:null,elements:null,cache:new Map};versionNonce;getNonDeletedElementsMap(){return this.nonDeletedElementsMap}getElementsIncludingDeleted(){return this.elements}getElementsMapIncludingDeleted(){return this.elementsMap}getNonDeletedElements(){return this.nonDeletedElements}getFramesIncludingDeleted(){return this.frames}getSelectedElements(t){let n=sR(t),r=t?.elements||this.nonDeletedElements;if(this.selectedElementsCache.elements===r&&this.selectedElementsCache.selectedElementIds===t.selectedElementIds){let a=this.selectedElementsCache.cache.get(n);if(a)return a}else t?.elements==null&&this.selectedElementsCache.cache.clear();let i=bt(r,{selectedElementIds:t.selectedElementIds},t);return t?.elements==null&&(this.selectedElementsCache.selectedElementIds=t.selectedElementIds,this.selectedElementsCache.elements=this.nonDeletedElements,this.selectedElementsCache.cache.set(n,i)),i}getNonDeletedFramesLikes(){return this.nonDeletedFramesLikes}getElement(t){return this.elementsMap.get(t)||null}getVersionNonce(){return this.versionNonce}getNonDeletedElement(t){let n=this.getElement(t);return n&&ob(n)?n:null}mapElements(t){let n=!1,r=this.elements.map(i=>{let a=t(i);return a!==i&&(n=!0),a});return n&&this.replaceAllElements(r),n}replaceAllElements(t){let n=t instanceof Array?t:Array.from(t.values()),r=[];(Ne.DEV||Ne.MODE===xa.TEST)&&I5(n.map(a=>a.index)),this.elements=wo(n),this.elementsMap.clear(),this.elements.forEach(a=>{Ae(a)&&r.push(a),this.elementsMap.set(a.id,a),eE.mapElementToScene(a,this)});let i=H3(this.elements);this.nonDeletedElements=i.elements,this.nonDeletedElementsMap=i.elementsMap,this.frames=r,this.nonDeletedFramesLikes=H3(this.frames).elements,this.informMutation()}informMutation(){this.versionNonce=Is();for(let t of Array.from(this.callbacks))t()}addCallback(t){if(this.callbacks.has(t))throw new Error;return this.callbacks.add(t),()=>{if(!this.callbacks.has(t))throw new Error;this.callbacks.delete(t)}}destroy(){this.elements=[],this.nonDeletedElements=[],this.nonDeletedFramesLikes=[],this.frames=[],this.elementsMap.clear(),this.selectedElementsCache.selectedElementIds=null,this.selectedElementsCache.elements=null,this.selectedElementsCache.cache.clear(),eE.sceneMapById.forEach((t,n)=>{t===this&&eE.sceneMapById.delete(n)}),this.callbacks.clear()}insertElementAtIndex(t,n){if(!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");let r=[...this.elements.slice(0,n),t,...this.elements.slice(n)];Yi(r,ve([t])),this.replaceAllElements(r)}insertElementsAtIndex(t,n){if(!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");let r=[...this.elements.slice(0,n),...t,...this.elements.slice(n)];Yi(r,ve(t)),this.replaceAllElements(r)}insertElement=t=>{let n=t.frameId?this.getElementIndex(t.frameId):this.elements.length;this.insertElementAtIndex(t,n)};insertElements=t=>{let n=t[0].frameId?this.getElementIndex(t[0].frameId):this.elements.length;this.insertElementsAtIndex(t,n)};getElementIndex(t){return this.elements.findIndex(n=>n.id===t)}getContainerElement=t=>t&&t.containerId&&this.getElement(t.containerId)||null},_r=lR}),oT,Wc,Jb=M(()=>{"use strict";D(),oT=e=>{let t=e.map(r=>r[0]),n=e.map(r=>r[1]);return{width:Math.max(...t)-Math.min(...t),height:Math.max(...n)-Math.min(...n)}},Wc=(e,t,n,r)=>{let i=n.map(h=>h[e]),a=Math.max(...i),o=Math.min(...i),s=a-o,l=s===0?1:t/s,c=1/0,d=n.map(h=>{let m=h[e]*l,p=[...h];return p[e]=m,m<c&&(c=m),p});if(!r||d.length===2)return d;let u=o-c;return d.map(h=>h.map((m,p)=>p===e?m+u:m))}}),Ve,Rt,_B,Kn,NE,Mo,sT,Vn,Ol,M5,A5,cR,G3,LB,RB,k5,OB,Gp,jp,Wp,rr=M(()=>{"use strict";D(),ae(),Qt(),Ls(),Ve=(e,t,n,r,i)=>[(e-n)*Math.cos(i)-(t-r)*Math.sin(i)+n,(e-n)*Math.sin(i)+(t-r)*Math.cos(i)+r],Rt=(e,t,n)=>Ve(e[0],e[1],t[0],t[1],n),_B=(e,t,n,r,i,a,o,s)=>{let l=Math.cos(r),c=Math.sin(r);return e.e&&e.w?t+=i+o:e.e?(t+=i*(1+l),n+=i*c,t+=o*(1-l),n+=o*-c):e.w&&(t+=i*(1-l),n+=i*-c,t+=o*(1+l),n+=o*c),e.n&&e.s?n+=a+s:e.n?(t+=a*c,n+=a*(1-l),t+=s*-c,n+=s*(1+l)):e.s&&(t+=a*-c,n+=a*(1+l),t+=s*c,n+=s*(1-l)),[t,n]},Kn=(e,t,n,r)=>{let i=n-e,a=r-t;return Math.hypot(i,a)},NE=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],Mo=(e,t=1)=>{if(e.length>=3){let[n,r]=[e[0],e[e.length-1]];return Kn(n[0],n[1],r[0],r[1])<=af/t}return!1},sT=(e,t,n)=>t[0]<=Math.max(e[0],n[0])&&t[0]>=Math.min(e[0],n[0])&&t[1]<=Math.max(e[1],n[1])&&t[1]>=Math.min(e[1],n[1]),Vn=(e,t,n)=>n?[Math.round(e/n)*n,Math.round(t/n)*n]:[e,t],Ol=(e,t)=>{if(t.roundness?.type===Fn.PROPORTIONAL_RADIUS||t.roundness?.type===Fn.LEGACY)return e*q2;if(t.roundness?.type===Fn.ADAPTIVE_RADIUS){let n=t.roundness?.value??uB,r=n/q2;return e<=r?e*q2:n}return 0},M5=(e,t)=>{let n=Xt.generateElementShape(e,null);if(!n)return null;let r=Uc(n[0]),i=[0,0],a=0,o=1/0,s=null;for(;a<r.length;){let{op:l,data:c}=r[a];if(l==="move"&&(i=c),l==="bcurveTo"){let d=i,u=[c[0],c[1]],h=[c[2],c[3]],m=[c[4],c[5]],p=Kn(m[0],m[1],t[0],t[1]);p<o&&(o=p,s=[d,u,h,m]),i=m}a++}return s},A5=(e,t,n,r,i)=>{let a=(l,c)=>Math.pow(1-l,3)*r[c]+3*l*Math.pow(1-l,2)*n[c]+3*Math.pow(l,2)*(1-l)*t[c]+e[c]*Math.pow(l,3),o=a(i,0),s=a(i,1);return[o,s]},cR=(e,t)=>{let n=M5(e,t);if(!n)return[];let r=[],i=1;for(;i>0;){let a=A5(n[0],n[1],n[2],n[3],i);r.push([a[0],a[1]]),i-=.05}return r.length&&k5(r.at(-1),t)&&r.push([t[0],t[1]]),r},G3=(e,t)=>{let n=[];n[0]=0;let r=cR(e,t),i=0,a=0;for(;i<r.length-1;){let o=Kn(r[i][0],r[i][1],r[i+1][0],r[i+1][1]);a+=o,n.push(a),i++}return n},LB=(e,t)=>G3(e,t).at(-1),RB=(e,t,n)=>{let r=G3(e,t),i=r.length-1,a=r.at(-1),o=n*a,s=0,l=i,c=0;for(;s<l;)c=Math.floor(s+(l-s)/2),r[c]<o?s=c+1:l=c;return r[c]>o&&c--,r[c]===o?c/i:1-(c+(o-r[c])/(r[c+1]-r[c]))/i},k5=(e,t)=>e[0]===t[0]&&e[1]===t[1],OB=e=>Math.round(e/Math.PI*1e4)%5e3===0,Gp=([e,t],[n,r])=>e<=n?t>=n:e>=n?r>=e:!1,jp=(e,t)=>{let n=Math.max(e[0],t[0]),r=Math.min(e[1],t[1]);return n<=r?[n,r]:null},Wp=(e,t,n)=>e>=t&&e<=n}),Vc,$E,P5,D5,FE,Df,NB,ey=M(()=>{"use strict";D(),Se(),Vc=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="line"||e==="freedraw",$E=e=>e!=="image"&&e!=="frame"&&e!=="magicframe",P5=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line",D5=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="arrow"||e==="line",FE=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="arrow"||e==="line"||e==="diamond"||e==="image",Df=e=>e==="arrow",NB=(e,t)=>{let n=null;for(let r=e.length-1;r>=0;--r){let i=e[r];if(!i.isDeleted&&t(i)){n=i;break}}return n}});function $te(e){let t=e.roughness,n=Math.max(e.width,e.height),r=Math.min(e.width,e.height);return r>=20&&n>=50||r>=15&&e.roundness&&FE(e.type)||Be(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}var dR,j3,ci,W3,V3,$B,FB=M(()=>{"use strict";D(),Oe(),rr(),Ds(),te(),ae(),Se(),ey(),dR=e=>[8,8+e],j3=e=>[1.5,6+e],ci=(e,t=!1)=>{let n={seed:e.seed,strokeLineDash:e.strokeStyle==="dashed"?dR(e.strokeWidth):e.strokeStyle==="dotted"?j3(e.strokeWidth):void 0,disableMultiStroke:e.strokeStyle!=="solid",strokeWidth:e.strokeStyle!=="solid"?e.strokeWidth+.5:e.strokeWidth,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,roughness:$te(e),stroke:e.strokeColor,preserveVertices:t||e.roughness<y5.cartoonist};switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":return n.fillStyle=e.fillStyle,n.fill=Sa(e.backgroundColor)?void 0:e.backgroundColor,e.type==="ellipse"&&(n.curveFitting=1),n;case"line":case"freedraw":return Mo(e.points)&&(n.fillStyle=e.fillStyle,n.fill=e.backgroundColor==="transparent"?void 0:e.backgroundColor),n;case"arrow":return n;default:throw new Error(`Unimplemented type ${e.type}`)}},W3=(e,t,n)=>mi(e)&&(t||fr(e)&&n?.get(e.id)!==!0)&&Sa(e.backgroundColor)&&Sa(e.strokeColor)?{...e,roughness:0,backgroundColor:"#d3d3d3",fillStyle:"solid"}:ss(e)?{...e,strokeColor:Sa(e.strokeColor)?"#000000":e.strokeColor,backgroundColor:Sa(e.backgroundColor)?"#f4f4f6":e.backgroundColor}:e,V3=(e,t,n,r,i,a,o)=>{o=o||"transparent";let s=fz(e,t,n,r);if(s===null)return[];switch(r){case"dot":case"circle":case"circle_outline":{let[l,c,d]=s;return delete a.strokeLineDash,[i.circle(l,c,d,{...a,fill:r==="circle_outline"?o:e.strokeColor,fillStyle:"solid",stroke:e.strokeColor,roughness:Math.min(.5,a.roughness||0)})]}case"triangle":case"triangle_outline":{let[l,c,d,u,h,m]=s;return delete a.strokeLineDash,[i.polygon([[l,c],[d,u],[h,m],[l,c]],{...a,fill:r==="triangle_outline"?o:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,a.roughness||0)})]}case"diamond":case"diamond_outline":{let[l,c,d,u,h,m,p,f]=s;return delete a.strokeLineDash,[i.polygon([[l,c],[d,u],[h,m],[p,f],[l,c]],{...a,fill:r==="diamond_outline"?o:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,a.roughness||0)})]}case"bar":case"arrow":default:{let[l,c,d,u,h,m]=s;if(e.strokeStyle==="dotted"){let p=j3(e.strokeWidth-1);a.strokeLineDash=[p[0],p[1]-1]}else delete a.strokeLineDash;return a.roughness=Math.min(1,a.roughness||0),[i.line(d,u,l,c,a),i.line(h,m,l,c,a)]}}},$B=(e,t,{isExporting:n,canvasBackgroundColor:r,embedsValidationStatus:i})=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":{let a;if(e.roundness){let o=e.width,s=e.height,l=Ol(Math.min(o,s),e);a=t.path(`M ${l} 0 L ${o-l} 0 Q ${o} 0, ${o} ${l} L ${o} ${s-l} Q ${o} ${s}, ${o-l} ${s} L ${l} ${s} Q 0 ${s}, 0 ${s-l} L 0 ${l} Q 0 0, ${l} 0`,ci(W3(e,n,i),!0))}else a=t.rectangle(0,0,e.width,e.height,ci(W3(e,n,i),!1));return a}case"diamond":{let a,[o,s,l,c,d,u,h,m]=pz(e);if(e.roundness){let p=Ol(Math.abs(o-h),e),f=Ol(Math.abs(c-s),e);a=t.path(`M ${o+p} ${s+f} L ${l-p} ${c-f}
109
+ C ${l} ${c}, ${l} ${c}, ${l-p} ${c+f}
110
+ L ${d+p} ${u-f}
111
+ C ${d} ${u}, ${d} ${u}, ${d-p} ${u-f}
112
+ L ${h+p} ${m+f}
113
+ C ${h} ${m}, ${h} ${m}, ${h+p} ${m-f}
114
+ L ${o-p} ${s+f}
115
+ C ${o} ${s}, ${o} ${s}, ${o+p} ${s+f}`,ci(e,!0))}else a=t.polygon([[o,s],[l,c],[d,u],[h,m]],ci(e));return a}case"ellipse":return t.ellipse(e.width/2,e.height/2,e.width,e.height,ci(e));case"line":case"arrow":{let a,o=ci(e),s=e.points.length?e.points:[[0,0]];if(e.roundness?a=[t.curve(s,o)]:o.fill?a=[t.polygon(s,o)]:a=[t.linearPath(s,o)],e.type==="arrow"){let{startArrowhead:l=null,endArrowhead:c="arrow"}=e;if(l!==null){let d=V3(e,a,"start",l,t,o,r);a.push(...d)}if(c!==null){let d=V3(e,a,"end",c,t,o,r);a.push(...d)}}return a}case"freedraw":{let a;if(one(e),Mo(e.points)){let o=V0(e.points,.75);a=t.curve(o,{...ci(e),stroke:"none"})}else a=null;return a}case"frame":case"magicframe":case"text":case"image":return null;default:return _l(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}}}),dr,BB,ll,lf,zB,_5,Yc,uR,HB,lT,L5,UB,R5,hR,_f,GB,qg,Fte,Bte,zte,Hte,Ute,Gte,jte,wh=M(()=>{"use strict";D(),dr=(e,t)=>[0,0,0,0,t,e,1,0],BB=(e,t)=>[0,0,0,0,t,e,0,0],ll=(e=0,t=0)=>{let n=[0,0,0,0,0,0,0,0];if(t<0||t>7)throw new Error(`Expected \`index\` between 0 and 7, got \`${t}\``);return e!==0&&(n[t]=e),n},lf=e=>[e[0],e[1],e[2],e[3],-e[4],-e[5],-e[6],-e[7]],zB=(e,t)=>qg(t)?[e[0]+t,e[1],e[2],e[3],e[4],e[5],e[6],e[7]]:[e[0]+t[0],e[1]+t[1],e[2]+t[2],e[3]+t[3],e[4]+t[4],e[5]+t[5],e[6]+t[6],e[7]+t[7]],_5=(e,t)=>qg(t)?[e[0]-t,e[1],e[2],e[3],e[4],e[5],e[6],e[7]]:[e[0]-t[0],e[1]-t[1],e[2]-t[2],e[3]-t[3],e[4]-t[4],e[5]-t[5],e[6]-t[6],e[7]-t[7]],Yc=(e,t)=>qg(t)?[e[0]*t,e[1]*t,e[2]*t,e[3]*t,e[4]*t,e[5]*t,e[6]*t,e[7]*t]:[uR(e,t),t[1]*e[0]+t[0]*e[1]-t[4]*e[2]+t[5]*e[3]+t[2]*e[4]-t[3]*e[5]-t[7]*e[6]-t[6]*e[7],t[2]*e[0]+t[0]*e[2]-t[6]*e[3]+t[3]*e[6],t[3]*e[0]+t[6]*e[2]+t[0]*e[3]-t[2]*e[6],t[4]*e[0]+t[2]*e[1]-t[1]*e[2]+t[7]*e[3]+t[0]*e[4]+t[6]*e[5]-t[5]*e[6]+t[3]*e[7],t[5]*e[0]-t[3]*e[1]+t[7]*e[2]+t[1]*e[3]-t[6]*e[4]+t[0]*e[5]+t[4]*e[6]+t[2]*e[7],t[6]*e[0]+t[3]*e[2]-t[2]*e[3]+t[0]*e[6],t[7]*e[0]+t[6]*e[1]+t[5]*e[2]+t[4]*e[3]+t[3]*e[4]+t[2]*e[5]+t[1]*e[6]+t[0]*e[7]],uR=(e,t)=>t[0]*e[0]+t[2]*e[2]+t[3]*e[3]-t[6]*e[6],HB=(e,t)=>[t[0]*e[0],t[1]*e[0]+t[0]*e[1],t[2]*e[0]+t[0]*e[2],t[3]*e[0]+t[0]*e[3],t[4]*e[0]+t[2]*e[1]-t[1]*e[2]+t[0]*e[4],t[5]*e[0]-t[3]*e[1]+t[1]*e[3]+t[0]*e[5],t[6]*e[0]+t[3]*e[2]-t[2]*e[3]+t[0]*e[6],t[7]*e[0]+t[6]*e[1]+t[5]*e[2]+t[4]*e[3]+t[3]*e[4]+t[2]*e[5]+t[1]*e[6]],lT=(e,t)=>[L5(e,t),e[1]*t[7]+e[4]*t[5]-e[5]*t[4]+e[7]*t[1],e[2]*t[7]-e[4]*t[6]+e[6]*t[4]+e[7]*t[2],e[3]*t[7]+e[5]*t[6]-e[6]*t[5]+e[7]*t[3],e[4]*t[7]+e[7]*t[4],e[5]*t[7]+e[7]*t[5],e[6]*t[7]+e[7]*t[6],e[7]*t[7]],L5=(e,t)=>e[0]*t[7]+e[1]*t[6]+e[2]*t[5]+e[3]*t[4]+e[4]*t[3]+e[5]*t[2]+e[6]*t[1]+e[7]*t[0],UB=(e,t)=>[t[0]*e[0]+t[2]*e[2]+t[3]*e[3]-t[6]*e[6],t[1]*e[0]+t[0]*e[1]-t[4]*e[2]+t[5]*e[3]+t[2]*e[4]-t[3]*e[5]-t[7]*e[6]-t[6]*e[7],t[2]*e[0]+t[0]*e[2]-t[6]*e[3]+t[3]*e[6],t[3]*e[0]+t[6]*e[2]+t[0]*e[3]-t[2]*e[6],t[4]*e[0]+t[7]*e[3]+t[0]*e[4]+t[3]*e[7],t[5]*e[0]+t[7]*e[2]+t[0]*e[5]+t[2]*e[7],t[6]*e[0]+t[0]*e[6],t[7]*e[0]+t[0]*e[7]],R5=e=>Math.sqrt(Math.abs(e[0]*e[0]-e[2]*e[2]-e[3]*e[3]+e[6]*e[6])),hR=e=>Math.sqrt(Math.abs(e[7]*e[7]-e[5]*e[5]-e[4]*e[4]+e[1]*e[1])),_f=e=>{let t=R5(e);if(t===0||t===1)return e;let n=e[6]<0?-1:1;return Yc(e,n/t)},GB=e=>{let t=hR(e);return t===0||t===1?e:Yc(e,1/t)},qg=e=>typeof e=="number",Fte=ll(1,1),Bte=ll(1,2),zte=ll(1,3),Hte=ll(1,4),Ute=ll(1,5),Gte=ll(1,6),jte=ll(1,7)}),tE,Ku,mR,jB,WB,VB=M(()=>{"use strict";D(),wh(),tE=(e,t,n)=>_f([0,n,e,t,0,0,0,0]),Ku=(e,t)=>_f(lT(t,e)),mR=(e,t)=>UB(e,t),jB=(e,t)=>mR(Ku(e,t),t),WB=e=>Math.sign(e[1])}),Oc,Nc,YB,ZB,O5,hl,Wte=M(()=>{"use strict";D(),wh(),VB(),wh(),Oc=([e,t])=>[0,0,0,0,t,e,1,0],Nc=e=>[e[5],e[4]],YB=e=>[0,0,0,0,Math.abs(e[4]),Math.abs(e[5]),1,0],ZB=(e,t)=>_f(HB(e,t)),O5=(e,t)=>R5(lT(e,t)),hl=(e,t)=>L5(e,t)}),N5,KB,XB=M(()=>{"use strict";D(),wh(),N5=e=>[0,0,0,0,e[4],e[5],0,0],KB=(e,t)=>GB([0,0,0,0,t[4]-e[4],t[5]-e[5],0,0])}),$5,qB,QB,JB,fa,Vte=M(()=>{"use strict";D(),wh(),XB(),$5=(e,t)=>zB(Yc(e,Math.sin(t/2)),Math.cos(t/2)),qB=e=>[1,0,0,0,-(.5*e[5]),.5*e[4],0,0],QB=(e,t)=>{let n=.5*t;return[1,0,0,0,n*e[4],n*e[5],0,0]},JB=(e,t)=>Yc(t,e),fa=(e,t)=>_f(Yc(Yc(e,t),lf(e)))}),kc,pR,Lf,us,fR,Y3,gR,En,ER,F5,bR,Z3,yR,nh,B5,vR,xR,z5,ez,H5,tz,wR,nz,rz,cT=M(()=>{"use strict";D(),rr(),kc=1e-4,pR=e=>{let t=e[0],n=e[e.length-1];return t[0]===n[0]&&t[1]===n[1]},Lf=e=>pR(e)?e:[...e,e[0]],us=e=>e*180/Math.PI,fR=e=>e/180*Math.PI,Y3=(e,t)=>[e[0]*Math.cos(t)-e[1]*Math.sin(t),e[0]*Math.sin(t)+e[1]*Math.cos(t)],gR=e=>e[0]===0&&e[1]===0,En=(e,t,n)=>{let r=fR(t);return!n||gR(n)?Y3(e,r):Y3(e.map((i,a)=>i-n[a]),r).map((i,a)=>i+n[a])},ER=e=>[-e[0],-e[1]],F5=(e,t)=>[e[0]+t[0],e[1]+t[1]],bR=(e,t)=>Kn(...e,...t),Z3=(e,t,n)=>{let r=F5(e,ER(t));return En(r,-us(n))},yR=(e,t)=>{let[n,r]=e,[[i,a],[o,s]]=t,l=n-i,c=r-a,d=o-i,u=s-a,h=l*d+c*u,m=d*d+u*u,p=-1;m!==0&&(p=h/m);let f,g;p<0?(f=i,g=a):p>1?(f=o,g=s):(f=i+p*d,g=a+p*u);let b=n-f,v=r-g;return Math.sqrt(b*b+v*v)},nh=(e,t,n=kc)=>{let r=yR(e,t);return r===0?!0:r<n},B5=(e,t,n=kc)=>t.some(r=>nh(e,r,n)),vR=e=>{let[t,n,r,i]=e;return(a,o)=>Math.pow(1-a,3)*i[o]+3*a*Math.pow(1-a,2)*r[o]+3*Math.pow(a,2)*(1-a)*n[o]+t[o]*Math.pow(a,3)},xR=(e,t=10)=>{let n=vR(e),r=[n(0,0),n(0,1)],i=[],a=0,o=1/t;for(let s=0;s<t;s++)if(a+=o,a<=1){let l=[n(a,0),n(a,1)];i.push([r,l]),r=l}return i},z5=(e,t,n=kc)=>B5(e,xR(t),n),ez=(e,t,n=kc)=>t.some(r=>z5(e,r,n)),H5=(e,t)=>{let n=e[0],r=e[1],i=!1;for(let a=0,o=t.length-1;a<t.length;o=a++){let s=t[a][0],l=t[a][1],c=t[o][0],d=t[o][1];(l>r&&d<=r||l<=r&&d>r)&&n<(c-s)*(r-l)/(d-l)+s&&(i=!i)}return i},tz=(e,t,n=kc)=>{let r=!1,i=Lf(t);for(let a=0,o=i.length-1;a<o;a++)if(nh(e,[i[a],i[a+1]],n)){r=!0;break}return r},wR=(e,t)=>{let{angle:n,halfWidth:r,halfHeight:i,center:a}=t,o=r,s=i,[l,c]=Z3(e,a,n),d=Math.abs(l),u=Math.abs(c),h=.707,m=.707;for(let g=0;g<3;g++){let b=o*h,v=s*m,y=(o*o-s*s)*h**3/o,w=(s*s-o*o)*m**3/s,C=b-y,A=v-w,T=d-y,I=u-w,k=Math.hypot(A,C),R=Math.hypot(I,T);h=Math.min(1,Math.max(0,(T*k/R+y)/o)),m=Math.min(1,Math.max(0,(I*k/R+w)/s));let O=Math.hypot(m,h);h/=O,m/=O}let[p,f]=[o*h*Math.sign(l),s*m*Math.sign(c)];return bR([l,c],[p,f])},nz=(e,t,n=kc)=>wR(e,t)<=n,rz=(e,t)=>{let{center:n,angle:r,halfWidth:i,halfHeight:a}=t,[o,s]=Z3(e,n,r);return o/i*(o/i)+s/a*(s/a)<=1}}),BE,cf,dT=M(()=>{"use strict";D(),cT(),BE=(e,t,n=0)=>{switch(t.type){case"polygon":return tz(e,t.data,n);case"ellipse":return nz(e,t.data,n);case"line":return nh(e,t.data,n);case"polyline":return B5(e,t.data,n);case"curve":return z5(e,t.data,n);case"polycurve":return ez(e,t.data,n);default:throw Error(`shape ${t} is not implemented`)}},cf=(e,t)=>{switch(t.type){case"polygon":return H5(e,t.data);case"line":return!1;case"curve":return!1;case"ellipse":return rz(e,t.data);case"polyline":{let n=Lf(t.data.flat());return H5(e,n)}case"polycurve":return!1;default:throw Error(`shape ${t} is not implemented`)}}}),rt,N,df,nE,zu,rh,ke=M(()=>{"use strict";D(),ae(),rt={EQUAL:"Equal",MINUS:"Minus",NUM_ADD:"NumpadAdd",NUM_SUBTRACT:"NumpadSubtract",NUM_ZERO:"Numpad0",BRACKET_RIGHT:"BracketRight",BRACKET_LEFT:"BracketLeft",ONE:"Digit1",TWO:"Digit2",THREE:"Digit3",NINE:"Digit9",QUOTE:"Quote",ZERO:"Digit0",SLASH:"Slash",C:"KeyC",D:"KeyD",H:"KeyH",V:"KeyV",Z:"KeyZ",R:"KeyR",S:"KeyS"},N={ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",BACKSPACE:"Backspace",ALT:"Alt",CTRL_OR_CMD:Ia?"metaKey":"ctrlKey",DELETE:"Delete",ENTER:"Enter",ESCAPE:"Escape",QUESTION_MARK:"?",SPACE:" ",TAB:"Tab",CHEVRON_LEFT:"<",CHEVRON_RIGHT:">",PERIOD:".",COMMA:",",SUBTRACT:"-",SLASH:"/",A:"a",C:"c",D:"d",E:"e",F:"f",G:"g",H:"h",I:"i",L:"l",O:"o",P:"p",Q:"q",R:"r",S:"s",T:"t",V:"v",X:"x",Y:"y",Z:"z",K:"k",W:"w",0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9"},df=e=>e===N.ARROW_LEFT||e===N.ARROW_RIGHT||e===N.ARROW_DOWN||e===N.ARROW_UP,nE=e=>e.altKey,zu=e=>e.shiftKey,rh=e=>e.shiftKey}),iz,Tl,SR,yl,K3,zE,CR,HE,Xu,Qg,U5,UE,TR,bs,IR,bo,MR,AR,kR,X3,az,PR,vp,q3,Q3,J3,uT,e6,hT,Su,t6,uf,DR,_R,LR,RR,OR,Jg,e2,t2,NR,$R,FR,BR,n6,zR,HR,UR,GR,jR,WR,oz,xp,wp,qu,Qu,Fa=M(()=>{"use strict";D(),wh(),Wte(),XB(),VB(),Vte(),Qt(),dT(),It(),Se(),vt(),yd(),yr(),te(),ke(),qt(),iz=e=>!e[N.CTRL_OR_CMD],Tl=e=>e.isBindingEnabled,SR=(e,t)=>{let n=[];return t.forEach(r=>{let i=e.getNonDeletedElement(r);i!=null&&n.push(i)}),n},yl=(e,t,n,r)=>{let i=new Set,a=new Set;K3(e,t,n,"start",i,a,r),K3(e,n,t,"end",i,a,r);let o=Array.from(a).filter(s=>!i.has(s));SR(_r.getScene(e),o).forEach(s=>{ie(s,{boundElements:s.boundElements?.filter(l=>l.type!=="arrow"||l.id!==e.id)})})},K3=(e,t,n,r,i,a,o)=>{if(t!=="keep")if(t!=null)(n==null||(n==="keep"?!Qg(e,t,r):r==="start"||n.id!==t.id))&&(Xu(e,t,r,o),i.add(t.id));else{let s=TR(e,r);s!=null&&a.add(s)}},zE=(e,t)=>{e.forEach(n=>{kr(n)?yl(n,vp(n,"start",t),vp(n,"end",t),t.scene.getNonDeletedElementsMap()):fl(n)&&CR(n,t.scene.getNonDeletedElementsMap(),t)})},CR=(e,t,n)=>{Q3(e,n).forEach(([r,i])=>yl(r,i==="end"?"keep":e,i==="start"?"keep":e,t))},HE=(e,t,n,r)=>{t.startBoundElement!=null&&Xu(e,t.startBoundElement,"start",r.scene.getNonDeletedElementsMap());let i=bs(n,r);i!=null&&!Qg(e,i,"end")&&Xu(e,i,"end",r.scene.getNonDeletedElementsMap())},Xu=(e,t,n,r)=>{ie(e,{[n==="start"?"startBinding":"endBinding"]:{elementId:t.id,...IR(e,t,n,r)}}),ve(t.boundElements||[]).has(e.id)||ie(t,{boundElements:(t.boundElements||[]).concat({id:e.id,type:"arrow"})})},Qg=(e,t,n)=>{let r=e[n==="start"?"endBinding":"startBinding"];return U5(e,r?.elementId,t)},U5=(e,t,n)=>t===n.id&&e.points.length<3,UE=(e,t)=>{e.forEach(n=>{kr(n)&&(n.startBinding!==null&&n.endBinding!==null?yl(n,null,null,t):yl(n,n.startBinding?"keep":null,n.endBinding?"keep":null,t))})},TR=(e,t)=>{let n=t==="start"?"startBinding":"endBinding",r=e[n];return r==null?null:(ie(e,{[n]:null}),r.elementId)},bs=(e,t)=>NB(t.scene.getNonDeletedElements(),n=>fl(n,!1)&&t6(n,e,t)),IR=(e,t,n,r)=>{let i=n==="start"?-1:1,a=i===-1?0:e.points.length-1,o=a-i,s=fe.getPointAtIndexGlobalCoordinates(e,a,r),l=fe.getPointAtIndexGlobalCoordinates(e,o,r);return{focus:NR(t,l,s,r),gap:Math.max(1,DR(t,s,r))}},bo=(e,t,n)=>{let{newSize:r,simultaneouslyUpdated:i}=n??{},a=AR(i);fl(e)&&xp(t,e,o=>{if(!Be(o)||o.isDeleted||!MR(o,e))return;let s={startBinding:X3(e,o.startBinding,r),endBinding:X3(e,o.endBinding,r)};if(a.has(o.id)){ie(o,s);return}wp(t,o,(c,d)=>{c&&fl(c)&&(d==="startBinding"||d==="endBinding")&&kR(o,d,s[d],c,t)});let l=Ye(o,t);l&&!l.isDeleted&&Of(o,t,!1)})},MR=(e,t)=>e.startBinding?.elementId===t.id||e.endBinding?.elementId===t.id,AR=e=>new Set((e||[]).map(t=>t.id)),kR=(e,t,n,r,i)=>{if(n==null||n.elementId!==r.id&&e.points.length>2)return;let a=t==="startBinding"?-1:1,o=a===-1?0:e.points.length-1,s=o-a,l=fe.getPointAtIndexGlobalCoordinates(e,s,i),c=$R(r,n.focus,l,i),d;if(n.gap===0)d=c;else{let u=FR(r,l,c,n.gap,i);u.length===0?d=c:d=u[0]}fe.movePoints(e,[{index:o,point:fe.pointFromAbsoluteCoords(e,d,i)}],{[t]:n})},X3=(e,t,n)=>{if(t==null||n==null)return t;let{gap:r,focus:i,elementId:a}=t,{width:o,height:s}=n,{width:l,height:c}=e,d=Math.max(1,Math.min(uf(e,o,s),r*(o<s?o/l:s/c)));return{elementId:a,gap:d,focus:i}},az=(e,t)=>{let n=new Set(e.map(({id:r})=>r));return e.flatMap(r=>kr(r,!1)?PR(r,t).filter(i=>!n.has(i.id)):fl(r,!1)?Q3(r,t).filter(i=>!n.has(i[0].id)):[])},PR=(e,t)=>[vp(e,"start",t),vp(e,"end",t)].filter(n=>n!=null),vp=(e,t,n)=>bs(q3(e,t,n.scene.getNonDeletedElementsMap()),n),q3=(e,t,n)=>{let r=t==="start"?0:-1;return Es(fe.getPointAtIndexGlobalCoordinates(e,r,n))},Q3=(e,t)=>{let n=_r.getScene(e);return n.getNonDeletedElements().map(r=>{if(!kr(r,!1))return null;let i=J3(r,"start",e,n.getNonDeletedElementsMap(),t),a=J3(r,"end",e,n.getNonDeletedElementsMap(),t);return!i&&!a?null:[r,i&&a?"both":i?"start":"end",e]}).filter(r=>r!=null)},J3=(e,t,n,r,i)=>e[t==="start"?"startBinding":"endBinding"]==null&&!Qg(e,n,t)&&t6(n,q3(e,t,r),i),uT=(e,t,n,r)=>{let i=new Set,a=new Set,o=r==="duplicatesServeAsOld";t.forEach(s=>{let{boundElements:l}=s;if(l!=null&&l.length>0&&(l.forEach(c=>{o&&!n.has(c.id)&&i.add(c.id)}),a.add(n.get(s.id))),kr(s)){if(s.startBinding!=null){let{elementId:c}=s.startBinding;o&&!n.has(c)&&a.add(c)}if(s.endBinding!=null){let{elementId:c}=s.endBinding;o&&!n.has(c)&&a.add(c)}(s.startBinding!=null||s.endBinding!=null)&&i.add(n.get(s.id))}}),e.filter(({id:s})=>i.has(s)).forEach(s=>{let{startBinding:l,endBinding:c}=s;ie(s,{startBinding:e6(l,n),endBinding:e6(c,n)})}),e.filter(({id:s})=>a.has(s)).forEach(s=>{let{boundElements:l}=s;l!=null&&l.length>0&&ie(s,{boundElements:l.map(c=>n.has(c.id)?{id:n.get(c.id),type:c.type}:c)})})},e6=(e,t)=>{if(e==null)return null;let{elementId:n,focus:r,gap:i}=e;return{focus:r,gap:i,elementId:t.get(n)??n}},hT=(e,t)=>{let n=ve(e);for(let r of t)qu.unbindAffected(n,r,ie),Qu.unbindAffected(n,r,ie)},Su=(e,t,n=[])=>{if(!e)return null;let r=e.filter(i=>!t.has(i.id));return r.push(...n.map(i=>({id:i.id,type:i.type}))),r},t6=(e,{x:t,y:n},r)=>{let i=uf(e,e.width,e.height),a=r.getElementShape(e);return BE([t,n],a,i)},uf=(e,t,n)=>{let r=(e.type==="diamond"?1/Math.sqrt(2):1)*Math.min(t,n);return Math.max(16,Math.min(.25*r,32))},DR=(e,t,n)=>{switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return _R(e,t,n);case"diamond":return LR(e,t,n);case"ellipse":return RR(e,t,n)}},_R=(e,t,n)=>{let[,r,i,a]=Jg(e,t,n);return Math.max(hl(r,tE(0,1,-a)),hl(r,tE(1,0,-i)))},LR=(e,t,n)=>{let[,r,i,a]=Jg(e,t,n),o=tE(a,i,-a*i);return hl(r,o)},RR=(e,t,n)=>{let[r,i]=OR(e,t,n);return-WB(i)*hl(r,i)},OR=(e,t,n)=>{let[,r,i,a]=Jg(e,t,n),[o,s]=Nc(r),l=.707,c=.707,d=i,u=a;[0,1,2,3].forEach(p=>{let f=d*l,g=u*c,b=(d*d-u*u)*l**3/d,v=(u*u-d*d)*c**3/u,y=f-b,w=g-v,C=o-b,A=s-v,T=Math.hypot(w,y),I=Math.hypot(A,C);l=Math.min(1,Math.max(0,(C*T/I+b)/d)),c=Math.min(1,Math.max(0,(A*T/I+v)/u));let k=Math.hypot(c,l);l/=k,c/=k});let h=dr(d*l,u*c),m=jB(r,h);return[r,m]},Jg=(e,t,n)=>{let r=Oc(t),[i,a,o,s]=De(e,n),l=t2(i,a,o,s),c=$5(l,e.angle),d=fa(c,r),u=_5(d,N5(l)),h=YB(u),m=BB(e.x,e.y),p=_5(d,m),f=(o-i)/2,g=(s-a)/2;return[p,h,f,g]},e2=(e,t)=>{let[n,r,i,a]=De(e,t),o=t2(n,r,i,a),s=$5(o,e.angle),l=lf(qB(N5(o)));return JB(s,l)},t2=(e,t,n,r)=>dr((e+n)/2,(t+r)/2),NR=(e,t,n,r)=>{let i=e2(e,r),a=fa(i,Oc(t)),o=fa(i,Oc(n)),s=Ku(a,o),l=e.height/e.width,c=e.width/2,d=e.height/2,u=s[2],h=s[3],m=s[1],p=Math.abs(h),f=Math.abs(u),g;switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":g=m/(c*(f+l*p));break;case"diamond":g=p<f?m/(f*c):m/(p*d);break;case"ellipse":g=m/(c*Math.sqrt(u**2+l**2*h**2));break}return g||0},$R=(e,t,n,r)=>{if(t===0){let[l,c,d,u]=De(e,r),h=t2(l,c,d,u);return Nc(h)}let i=e2(e,r),a=fa(i,Oc(n)),o=lf(i),s;switch(e.type){case"rectangle":case"image":case"text":case"diamond":case"iframe":case"embeddable":case"frame":case"magicframe":s=WR(e,t,a);break;case"ellipse":s=jR(e,t,a);break}return Nc(fa(o,s))},FR=(e,t,n,r=0,i)=>{let a=e2(e,i),o=fa(a,Oc(t)),s=fa(a,Oc(n)),l=Ku(o,s),c=lf(a);return BR(e,l,o,r).map(d=>Nc(fa(c,d)))},BR=(e,t,n,r=0)=>{let i;switch(e.type){case"rectangle":case"image":case"text":case"diamond":case"iframe":case"embeddable":case"frame":case"magicframe":let o=n6(e);i=o.flatMap((s,l)=>{let c=[s,o[(l+1)%4]];return zR(t,HR(c,r))}).concat(o.flatMap(s=>GR(s,r,t)));break;case"ellipse":i=UR(e,r,t);break}if(i.length<2)return[];let a=i.sort((o,s)=>O5(o,n)-O5(s,n));return[a[0],a[a.length-1]]},n6=(e,t=1)=>{let n=t*e.width/2,r=t*e.height/2;switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return[dr(n,r),dr(n,-r),dr(-n,-r),dr(-n,r)];case"diamond":return[dr(0,r),dr(n,0),dr(0,-r),dr(-n,0)]}},zR=(e,t)=>{let[n,r]=t,i=hl(n,e),a=hl(r,e);return i*a>=0?[]:[ZB(e,Ku(n,r))]},HR=(e,t)=>{let[n,r]=e,i=QB(KB(n,r),t);return[fa(i,n),fa(i,r)]},UR=(e,t,n)=>{let r=e.width/2+t,i=e.height/2+t,a=n[2],o=n[3],s=n[1],l=r*r*a*a+i*i*o*o,c=l-s*s;if(l===0||c<=0)return[];let d=Math.sqrt(c),u=-r*r*a*s,h=-i*i*o*s;return[dr((u+r*i*o*d)/l,(h-r*i*a*d)/l),dr((u-r*i*o*d)/l,(h+r*i*a*d)/l)]},GR=(e,t,n)=>{if(t===0)return hl(n,e)===0?[e]:[];let r=n[2],i=n[3],a=n[1],[o,s]=Nc(e),l=t,c=r*r+i*i,d=l*l*c-(r*o+i*s+a)**2;if(c===0||d<=0)return[];let u=Math.sqrt(d),h=o*i*i-s*r*i-r*a,m=s*r*r-o*r*i-i*a;return[dr((h+i*u)/c,(m-r*u)/c),dr((h-i*u)/c,(m+r*u)/c)]},jR=(e,t,n)=>{let r=Math.abs(t),i=e.width*r/2,a=e.height*r/2,o=Math.sign(t),[s,l]=Nc(n),c=l===0?1e-4:l,d=s**2*a**2+c**2*i**2,u=(-s*a**2+o*c*Math.sqrt(Math.max(0,d-i**2*a**2)))/d,h=(-u*s-1)/c;h===0&&(h=(Object.is(h,-0)?-1:1)*.01);let m=-(i**2*u)/(h**2*a**2+u**2*i**2);return dr(m,(-u*m-1)/h)},WR=(e,t,n)=>{let r=Math.abs(t),i=Math.sign(t),a=n6(e,r),o=0,s=null;return a.forEach(l=>{let c=i*Ku(n,l)[1];c>o&&(o=c,s=l)}),s},oz=new Set(["boundElements","frameId","containerId","startBinding","endBinding"]),xp=(e,t,n)=>{fl(t)&&(t.boundElements?.slice()??[]).forEach(({id:r})=>{n(e.get(r),"boundElements",r)})},wp=(e,t,n)=>{if(t.frameId){let r=t.frameId;n(e.get(r),"frameId",r)}if(tn(t)){let r=t.containerId;n(e.get(r),"containerId",r)}if(Et(t)){if(t.startBinding){let r=t.startBinding.elementId;n(e.get(r),"startBinding",r)}if(t.endBinding){let r=t.endBinding.elementId;n(e.get(r),"endBinding",r)}}},qu=class{static unbindAffected(e,t,n){t&&wp(e,t,r=>{!r||r.isDeleted||xp(e,r,(i,a,o)=>{o===t.id&&n(r,{boundElements:Su(r.boundElements,new Set([o]))})})})}static rebindAffected=(e,t,n)=>{!t||t.isDeleted||wp(e,t,(r,i)=>{if(!r||r.isDeleted){n(t,{[i]:null});return}i!=="frameId"&&(r.boundElements?.find(a=>a.id===t.id)||(Et(t)&&n(r,{boundElements:Su(r.boundElements,new Set,new Array(t))}),he(t)&&(r.boundElements?.find(a=>a.type==="text")?n(t,{[i]:null}):n(r,{boundElements:Su(r.boundElements,new Set,new Array(t))}))))})}},Qu=class{static unbindAffected(e,t,n){t&&xp(e,t,r=>{!r||r.isDeleted||wp(e,r,(i,a,o)=>{o===t.id&&n(r,{[a]:null})})})}static rebindAffected=(e,t,n)=>{!t||t.isDeleted||xp(e,t,(r,i,a)=>{if(!r||r.isDeleted){n(t,{boundElements:Su(t.boundElements,new Set([a]))});return}he(r)&&((t.boundElements?.slice()??[]).reverse().find(o=>o.type==="text")?.id===r.id?r.containerId!==t.id&&n(r,{containerId:t.id}):(r.containerId!==null&&n(r,{containerId:null}),n(t,{boundElements:Su(t.boundElements,new Set([r.id]))})))})}}}),ts,fe,VR,yr=M(()=>{"use strict";D(),rr(),Oe(),Qt(),vt(),Fa(),te(),Se(),ke(),qt(),ae(),Ls(),ts={version:null,points:[],zoom:null},fe=class Ee{elementId;selectedPointsIndices;pointerDownState;isDragging;lastUncommittedPoint;pointerOffset;startBindingElement;endBindingElement;hoverPointIndex;segmentMidPointHoveredCoords;constructor(t){this.elementId=t.id,Ee.normalizePoints(t),this.selectedPointsIndices=null,this.lastUncommittedPoint=null,this.isDragging=!1,this.pointerOffset={x:0,y:0},this.startBindingElement="keep",this.endBindingElement="keep",this.pointerDownState={prevSelectedPointsIndices:null,lastClickedPoint:-1,origin:null,segmentMidpoint:{value:null,index:null,added:!1}},this.hoverPointIndex=-1,this.segmentMidPointHoveredCoords=null}static POINT_HANDLE_SIZE=10;static getElement(t,n){return n.get(t)||null}static handleBoxSelection(t,n,r,i){if(!n.editingLinearElement||n.draggingElement?.type!=="selection")return!1;let{editingLinearElement:a}=n,{selectedPointsIndices:o,elementId:s}=a,l=Ee.getElement(s,i);if(!l)return!1;let[c,d,u,h]=De(n.draggingElement,i),m=Ee.getPointsGlobalCoordinates(l,i).reduce((p,f,g)=>((f[0]>=c&&f[0]<=u&&f[1]>=d&&f[1]<=h||t.shiftKey&&o?.includes(g))&&p.push(g),p),[]);r({editingLinearElement:{...a,selectedPointsIndices:m.length?m:null}})}static handlePointDragging(t,n,r,i,a,o,s){if(!o)return!1;let{selectedPointsIndices:l,elementId:c}=o,d=Ee.getElement(c,s);if(!d)return!1;let u=d.points[o.pointerDownState.lastClickedPoint];if(l&&u){if(rh(t)&&l.length===1&&d.points.length>1){let h=l[0],m=d.points[h===0?1:h-1],[p,f]=Ee._getShiftLockedDelta(d,s,m,[r,i],t[N.CTRL_OR_CMD]?null:n.gridSize);Ee.movePoints(d,[{index:h,point:[p+m[0],f+m[1]],isDragging:h===o.pointerDownState.lastClickedPoint}])}else{let h=Ee.createPointAt(d,s,r-o.pointerOffset.x,i-o.pointerOffset.y,t[N.CTRL_OR_CMD]?null:n.gridSize),m=h[0]-u[0],p=h[1]-u[1];Ee.movePoints(d,l.map(f=>{let g=f===o.pointerDownState.lastClickedPoint?Ee.createPointAt(d,s,r-o.pointerOffset.x,i-o.pointerOffset.y,t[N.CTRL_OR_CMD]?null:n.gridSize):[d.points[f][0]+m,d.points[f][1]+p];return{index:f,point:g,isDragging:f===o.pointerDownState.lastClickedPoint}}))}if(Ye(d,s)&&Of(d,s,!1),kr(d,!1)){let h=[];l[0]===0&&h.push(Es(Ee.getPointGlobalCoordinates(d,d.points[0],s)));let m=l[l.length-1];m===d.points.length-1&&h.push(Es(Ee.getPointGlobalCoordinates(d,d.points[m],s))),h.length&&a(d,h)}return!0}return!1}static handlePointerUp(t,n,r,i){let a=i.scene.getNonDeletedElementsMap(),{elementId:o,selectedPointsIndices:s,isDragging:l,pointerDownState:c}=n,d=Ee.getElement(o,a);if(!d)return n;let u={};if(l&&s){for(let h of s)if(h===0||h===d.points.length-1){Mo(d.points,r.zoom.value)&&Ee.movePoints(d,[{index:h,point:h===0?d.points[d.points.length-1]:d.points[0]}]);let m=Tl(r)?bs(Es(Ee.getPointAtIndexGlobalCoordinates(d,h,a)),i):null;u[h===0?"startBindingElement":"endBindingElement"]=m}}return{...n,...u,selectedPointsIndices:l||t.shiftKey?!l&&t.shiftKey&&c.prevSelectedPointsIndices?.includes(c.lastClickedPoint)?s&&s.filter(h=>h!==c.lastClickedPoint):s:s?.includes(c.lastClickedPoint)?[c.lastClickedPoint]:s,isDragging:!1,pointerOffset:{x:0,y:0}}}static getEditorMidPoints=(t,n,r)=>{let i=Ye(t,n);return!r.editingLinearElement&&t.points.length>2&&!i?[]:(ts.version===t.version&&ts.zoom===r.zoom.value||Ee.updateEditorMidPointsCache(t,n,r),ts.points)};static updateEditorMidPointsCache=(t,n,r)=>{let i=Ee.getPointsGlobalCoordinates(t,n),a=0,o=[];for(;a<i.length-1;){if(Ee.isSegmentTooShort(t,t.points[a],t.points[a+1],r.zoom)){o.push(null),a++;continue}let s=Ee.getSegmentMidPoint(t,i[a],i[a+1],a+1,n);o.push(s),a++}ts.points=o,ts.version=t.version,ts.zoom=r.zoom.value};static getSegmentMidpointHitCoords=(t,n,r,i)=>{let{elementId:a}=t,o=Ee.getElement(a,i);if(!o||Ee.getPointIndexUnderCursor(o,i,r.zoom,n.x,n.y)>=0||Ee.getPointsGlobalCoordinates(o,i).length>=3&&!r.editingLinearElement)return null;let s=Ee.POINT_HANDLE_SIZE/r.zoom.value,l=t.segmentMidPointHoveredCoords;if(l&&Kn(l[0],l[1],n.x,n.y)<=s)return l;let c=0,d=Ee.getEditorMidPoints(o,i,r);for(;c<d.length;){if(d[c]!==null&&Kn(d[c][0],d[c][1],n.x,n.y)<=s)return d[c];c++}return null};static isSegmentTooShort(t,n,r,i){let a=Kn(n[0],n[1],r[0],r[1]);return t.points.length>2&&t.roundness&&(a=LB(t,r)),a*i.value<Ee.POINT_HANDLE_SIZE*4}static getSegmentMidPoint(t,n,r,i,a){let o=NE(n,r);if(t.points.length>2&&t.roundness){let s=M5(t,t.points[i]);if(s){let l=RB(t,t.points[i],.5),[c,d]=A5(s[0],s[1],s[2],s[3],l);o=Ee.getPointGlobalCoordinates(t,[c,d],a)}}return o}static getSegmentMidPointIndex(t,n,r,i){let a=Ee.getElement(t.elementId,i);if(!a)return-1;let o=Ee.getEditorMidPoints(a,i,n),s=0;for(;s<o.length;){if(Ee.arePointsEqual(r,o[s]))return s+1;s++}return-1}static handlePointerDown(t,n,r,i,a,o){let s=o.scene.getNonDeletedElementsMap(),l={didAddPoint:!1,hitElement:null,linearElementEditor:null};if(!a)return l;let{elementId:c}=a,d=Ee.getElement(c,s);if(!d)return l;let u=Ee.getSegmentMidpointHitCoords(a,i,n,s),h=null;if(u&&(h=Ee.getSegmentMidPointIndex(a,n,u,s)),t.altKey&&n.editingLinearElement)return a.lastUncommittedPoint==null&&(ie(d,{points:[...d.points,Ee.createPointAt(d,s,i.x,i.y,t[N.CTRL_OR_CMD]?null:n.gridSize)]}),l.didAddPoint=!0),r.shouldCaptureIncrement(),l.linearElementEditor={...a,pointerDownState:{prevSelectedPointsIndices:a.selectedPointsIndices,lastClickedPoint:-1,origin:{x:i.x,y:i.y},segmentMidpoint:{value:u,index:h,added:!1}},selectedPointsIndices:[d.points.length-1],lastUncommittedPoint:null,endBindingElement:bs(i,o)},l.didAddPoint=!0,l;let m=Ee.getPointIndexUnderCursor(d,s,n.zoom,i.x,i.y);if(m>=0||u)l.hitElement=d;else{let{startBindingElement:A,endBindingElement:T}=a;Tl(n)&&kr(d)&&yl(d,A,T,s)}let[p,f,g,b]=De(d,s),v=(p+g)/2,y=(f+b)/2,w=m>-1&&Ve(d.x+d.points[m][0],d.y+d.points[m][1],v,y,d.angle),C=m>-1||t.shiftKey?t.shiftKey||a.selectedPointsIndices?.includes(m)?VR([...a.selectedPointsIndices||[],m]):[m]:null;return l.linearElementEditor={...a,pointerDownState:{prevSelectedPointsIndices:a.selectedPointsIndices,lastClickedPoint:m,origin:{x:i.x,y:i.y},segmentMidpoint:{value:u,index:h,added:!1}},selectedPointsIndices:C,pointerOffset:w?{x:i.x-w[0],y:i.y-w[1]}:{x:0,y:0}},l}static arePointsEqual(t,n){return!t&&!n?!0:!t||!n?!1:k5(t,n)}static handlePointerMove(t,n,r,i,a){if(!i.editingLinearElement)return null;let{elementId:o,lastUncommittedPoint:s}=i.editingLinearElement,l=Ee.getElement(o,a);if(!l)return i.editingLinearElement;let{points:c}=l,d=c[c.length-1];if(!t.altKey)return d===s&&Ee.deletePoints(l,[c.length-1]),{...i.editingLinearElement,lastUncommittedPoint:null};let u;if(rh(t)&&c.length>=2){let h=c[c.length-2],[m,p]=Ee._getShiftLockedDelta(l,a,h,[n,r],t[N.CTRL_OR_CMD]?null:i.gridSize);u=[m+h[0],p+h[1]]}else u=Ee.createPointAt(l,a,n-i.editingLinearElement.pointerOffset.x,r-i.editingLinearElement.pointerOffset.y,t[N.CTRL_OR_CMD]?null:i.gridSize);return d===s?Ee.movePoints(l,[{index:l.points.length-1,point:u}]):Ee.addPoints(l,i,[{point:u}]),{...i.editingLinearElement,lastUncommittedPoint:l.points[l.points.length-1]}}static getPointGlobalCoordinates(t,n,r){let[i,a,o,s]=De(t,r),l=(i+o)/2,c=(a+s)/2,{x:d,y:u}=t;return[d,u]=Ve(d+n[0],u+n[1],l,c,t.angle),[d,u]}static getPointsGlobalCoordinates(t,n){let[r,i,a,o]=De(t,n),s=(r+a)/2,l=(i+o)/2;return t.points.map(c=>{let{x:d,y:u}=t;return[d,u]=Ve(d+c[0],u+c[1],s,l,t.angle),[d,u]})}static getPointAtIndexGlobalCoordinates(t,n,r){let i=n<0?t.points.length+n:n,[a,o,s,l]=De(t,r),c=(a+s)/2,d=(o+l)/2,u=t.points[i],{x:h,y:m}=t;return u?Ve(h+u[0],m+u[1],c,d,t.angle):Ve(h,m,c,d,t.angle)}static pointFromAbsoluteCoords(t,n,r){let[i,a,o,s]=De(t,r),l=(i+o)/2,c=(a+s)/2,[d,u]=Ve(n[0],n[1],l,c,-t.angle);return[d-t.x,u-t.y]}static getPointIndexUnderCursor(t,n,r,i,a){let o=Ee.getPointsGlobalCoordinates(t,n),s=o.length;for(;--s>-1;){let l=o[s];if(Kn(i,a,l[0],l[1])*r.value<Ee.POINT_HANDLE_SIZE+1)return s}return-1}static createPointAt(t,n,r,i,a){let o=Vn(r,i,a),[s,l,c,d]=De(t,n),u=(s+c)/2,h=(l+d)/2,[m,p]=Ve(o[0],o[1],u,h,-t.angle);return[m-t.x,p-t.y]}static getNormalizedPoints(t){let{points:n}=t,r=n[0][0],i=n[0][1];return{points:n.map((a,o)=>[a[0]-r,a[1]-i]),x:t.x+r,y:t.y+i}}static normalizePoints(t){ie(t,Ee.getNormalizedPoints(t))}static duplicateSelectedPoints(t,n){if(!t.editingLinearElement)return!1;let{selectedPointsIndices:r,elementId:i}=t.editingLinearElement,a=Ee.getElement(i,n);if(!a||r===null)return!1;let{points:o}=a,s=[],l=!1,c=-1,d=o.reduce((u,h,m)=>{if(++c,u.push(h),r.includes(m)){let p=o[m+1];p||(l=!0),u.push(p?[(h[0]+p[0])/2,(h[1]+p[1])/2]:[h[0],h[1]]),s.push(c+1),++c}return u},[]);if(ie(a,{points:d}),l){let u=a.points[a.points.length-1];Ee.movePoints(a,[{index:a.points.length-1,point:[u[0]+30,u[1]+30]}])}return{appState:{...t,editingLinearElement:{...t.editingLinearElement,selectedPointsIndices:s}}}}static deletePoints(t,n){let r=0,i=0;if(n.includes(0)){let o=t.points.find((s,l)=>!n.includes(l));o&&(r=o[0],i=o[1])}let a=t.points.reduce((o,s,l)=>(n.includes(l)||o.push(o.length?[s[0]-r,s[1]-i]:[0,0]),o),[]);Ee._updatePoints(t,a,r,i)}static addPoints(t,n,r){let i=[...t.points,...r.map(a=>a.point)];Ee._updatePoints(t,i,0,0)}static movePoints(t,n,r){let{points:i}=t,a=0,o=0,s=n.find(({index:c})=>c===0);s&&(a=s.point[0]+i[s.index][0],o=s.point[1]+i[s.index][1]);let l=i.map((c,d)=>{let u=n.find(h=>h.index===d);if(u){if(s)return c;let h=u.point[0]-i[u.index][0],m=u.point[1]-i[u.index][1];return[c[0]+h,c[1]+m]}return a||o?[c[0]-a,c[1]-o]:c});Ee._updatePoints(t,l,a,o,r)}static shouldAddMidpoint(t,n,r,i){if(!Ee.getElement(t.elementId,i))return!1;let{segmentMidpoint:a}=t.pointerDownState;if(a.added||a.value===null||a.index===null||t.pointerDownState.origin===null)return!1;let o=t.pointerDownState.origin,s=Kn(o.x,o.y,n.x,n.y);return!(!r.editingLinearElement&&s<pl/r.zoom.value)}static addMidpoint(t,n,r,i,a){let o=Ee.getElement(t.elementId,a);if(!o)return;let{segmentMidpoint:s}=t.pointerDownState,l={pointerDownState:t.pointerDownState,selectedPointsIndices:t.selectedPointsIndices},c=Ee.createPointAt(o,a,n.x,n.y,i?r.gridSize:null),d=[...o.points.slice(0,s.index),c,...o.points.slice(s.index)];return ie(o,{points:d}),l.pointerDownState={...t.pointerDownState,segmentMidpoint:{...t.pointerDownState.segmentMidpoint,added:!0},lastClickedPoint:s.index},l.selectedPointsIndices=[s.index],l}static _updatePoints(t,n,r,i,a){let o=W5(t,n),s=W5(t,t.points),l=(o[0]+o[2])/2,c=(o[1]+o[3])/2,d=(s[0]+s[2])/2,u=(s[1]+s[3])/2,h=d-l,m=u-c,p=Ve(r,i,h,m,t.angle);ie(t,{...a,points:n,x:t.x+p[0],y:t.y+p[1]})}static _getShiftLockedDelta(t,n,r,i,a){let o=Ee.getPointGlobalCoordinates(t,r,n),[s,l]=Vn(i[0],i[1],a),{width:c,height:d}=rb(o[0],o[1],s,l);return Rt([c,d],[0,0],-t.angle)}static getBoundTextElementPosition=(t,n,r)=>{let i=Ee.getPointsGlobalCoordinates(t,r);i.length<2&&ie(n,{isDeleted:!0});let a=0,o=0;if(t.points.length%2===1){let s=Math.floor(t.points.length/2),l=Ee.getPointGlobalCoordinates(t,t.points[s],r);a=l[0]-n.width/2,o=l[1]-n.height/2}else{let s=t.points.length/2-1,l=ts.points[s];t.points.length===2&&(l=NE(i[0],i[1])),(!l||ts.version!==t.version)&&(l=Ee.getSegmentMidPoint(t,i[s],i[s+1],s+1,r)),a=l[0]-n.width/2,o=l[1]-n.height/2}return{x:a,y:o}};static getMinMaxXYWithBoundText=(t,n,r,i)=>{let[a,o,s,l]=r,c=(a+s)/2,d=(o+l)/2,{x:u,y:h}=Ee.getBoundTextElementPosition(t,i,n),m=u+i.width,p=h+i.height,f=Rt([a,o],[c,d],t.angle),g=Rt([s,o],[c,d],t.angle),b=Rt([u,h],[c,d],-t.angle),v=Rt([m,h],[c,d],-t.angle),y=Rt([u,p],[c,d],-t.angle),w=Rt([m,p],[c,d],-t.angle);return f[0]<g[0]&&f[1]>=g[1]?(a=Math.min(a,y[0]),s=Math.max(s,Math.max(v[0],w[0])),o=Math.min(o,b[1]),l=Math.max(l,w[1])):f[0]>=g[0]&&f[1]>g[1]?(a=Math.min(a,w[0]),s=Math.max(s,Math.max(b[0],v[0])),o=Math.min(o,y[1]),l=Math.max(l,v[1])):f[0]>=g[0]?(a=Math.min(a,v[0]),s=Math.max(s,y[0]),o=Math.min(o,w[1]),l=Math.max(l,b[1])):f[1]<=g[1]&&(a=Math.min(a,Math.min(v[0],b[0])),s=Math.max(s,w[0]),o=Math.min(o,v[1]),l=Math.max(l,y[1])),[a,o,s,l,c,d]};static getElementAbsoluteCoords=(t,n,r=!1)=>{let i,a,o,s,l;if(t.points.length<2||!Xt.get(t)){let{minX:h,minY:m,maxX:p,maxY:f}=t.points.reduce((g,[b,v])=>(g.minY=Math.min(g.minY,v),g.minX=Math.min(g.minX,b),g.maxX=Math.max(g.maxX,b),g.maxY=Math.max(g.maxY,v),g),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});a=h+t.x,o=m+t.y,s=p+t.x,l=f+t.y}else{let h=Xt.generateElementShape(t,null),m=Uc(h[0]),[p,f,g,b]=Yp(m);a=p+t.x,o=f+t.y,s=g+t.x,l=b+t.y}let c=(a+s)/2,d=(o+l)/2;if(i=[a,o,s,l,c,d],!r)return i;let u=Ye(t,n);return u&&(i=Ee.getMinMaxXYWithBoundText(t,n,[a,o,s,l],u)),i}},VR=e=>{let t=[...new Set(e.filter(n=>n!==null&&n!==-1))];return t=t.sort((n,r)=>n-r),t.length?t:null}}),$c,Rf,mT,sz,pT=M(()=>{"use strict";D(),$c={},Rf=(e,t)=>{let n=$c[e]||($c[e]={height:t});return n.height=t,n},mT=e=>{$c[e]&&delete $c[e]},sz=e=>$c[e]?.height??null}),Sh,n2,ji,fT,Of,hf,ys,lz,ih,gT,ET,r6,Cu,Vp,YR,ZR,ah,i6,a6,bT,KR,vs,Ye,Er,rE,G5,cz,dz,uz,XR,hz,Il,Ca,Ju,mz,r2,o6,Fl,qt=M(()=>{"use strict";D(),te(),vt(),ae(),Oe(),Se(),yr(),pT(),Sh=e=>rT(e).replace(/\t/g," "),n2=e=>Sh(e).split(`
116
+ `),ji=(e,t,n,r=!0)=>{let i,a={x:e.x,y:e.y,text:e.text,width:e.width,height:e.height,angle:t?.angle??e.angle};a.text=e.text,t&&(i=Ca(t,e),a.text=ah(e.originalText,An(e),i));let o=ys(a.text,An(e),e.lineHeight);if(a.width=o.width,a.height=o.height,t){let s=Ju(t,e),l=Ca(t,e);if(!Et(t)&&o.height>s){let h=Il(o.height,t.type);ie(t,{height:h},r),Rf(t.id,h)}if(o.width>l){let h=Il(o.width,t.type);ie(t,{width:h},r)}let c={...e,...a},{x:d,y:u}=hf(t,c,n);a.x=d,a.y=u}ie(e,a,r)},fT=(e,t,n)=>{let r=ve(e);t.forEach(i=>{let a=n.get(i.id),o=vs(i);if(o){let s=n.get(o);if(s){let l=r.get(a);l&&ie(l,{boundElements:(i.boundElements||[]).filter(d=>d.id!==s&&d.id!==o).concat({type:"text",id:s})});let c=r.get(s);c&&he(c)&&ie(c,{containerId:l?a:null})}}})},Of=(e,t,n,r=!1)=>{if(!vs(e))return;mT(e.id);let i=Ye(e,t);if(i&&i.text){if(!e)return;let a=i.text,o=i.height,s=i.width,l=Ca(e,i),c=Ju(e,i),d=e.height;if(r||n!=="n"&&n!=="s"){a&&(a=ah(i.originalText,An(i),l));let u=ys(a,An(i),i.lineHeight);o=u.height,s=u.width}if(o>c){d=Il(o,e.type);let u=d-e.height,h=!Et(e)&&(n==="ne"||n==="nw"||n==="n")?e.y-u:e.y;ie(e,{height:d,y:h})}ie(i,{text:a,width:s,height:o}),Et(e)||ie(i,hf(e,i,t))}},hf=(e,t,n)=>{if(Et(e))return fe.getBoundTextElementPosition(e,t,n);let r=G5(e),i=Ju(e,t),a=Ca(e,t),o,s;return t.verticalAlign===Yr.TOP?s=r.y:t.verticalAlign===Yr.BOTTOM?s=r.y+(i-t.height):s=r.y+(i/2-t.height/2),t.textAlign===vh.LEFT?o=r.x:t.textAlign===vh.RIGHT?o=r.x+(a-t.width):o=r.x+(a/2-t.width/2),{x:o,y:s}},ys=(e,t,n)=>{e=e.split(`
117
+ `).map(a=>a||" ").join(`
118
+ `);let r=parseFloat(t),i=YR(e,r,n);return{width:Vp(e,t),height:i}},lz=e=>{let t=n2(e.text).length;return e.height/t/e.fontSize},ih=(e,t)=>e*t,gT=(e,t,n)=>{let{unitsPerEm:r,ascender:i,descender:a}=o6[e]||o6[Zn.Helvetica],o=t/r,s=n-o*i+o*a;return o*i+s},ET=(e,t)=>ih(e,t)+In*2,Cu=(e,t)=>{r6||(r6=document.createElement("canvas"));let n=r6.getContext("2d");n.font=t;let r=n.measureText(e).width;return $l()?r*10:r},Vp=(e,t)=>{let n=n2(e),r=0;return n.forEach(i=>{r=Math.max(r,Cu(i,t))}),r},YR=(e,t,n)=>{let r=n2(e).length;return ih(t,n)*r},ZR=e=>{let t=e.split("-");return t.length>1&&t.forEach((n,r)=>{r!==t.length-1&&(t[r]=n+="-")}),t.join(" ").split(" ")},ah=(e,t,n)=>{if(!Number.isFinite(n)||n<0)return e;let r=[],i=e.split(`
119
+ `),a=Cu(" ",t),o="",s=0,l=d=>{d.trim()&&r.push(d)},c=()=>{o="",s=0};return i.forEach(d=>{if(Vp(d,t)<=n){r.push(d);return}let u=ZR(d);c();let h=0;for(;h<u.length;){let m=Cu(u[h],t);if(m===n)l(u[h]),h++;else if(m>n){for(l(o),c();u[h].length>0;){let p=String.fromCodePoint(u[h].codePointAt(0)),f=i6.calculate(p,t);s+=f,u[h]=u[h].slice(p.length),s>=n?(l(o),o=p,s=f):o+=p}s+a>=n?(l(o),c()):o.endsWith("-")||(o+=" ",s+=a),h++}else for(;s<n&&h<u.length;){let p=u[h];if(s=Cu(o+p,t),s>n){l(o),c();break}h++;let f=!p.endsWith("-");if(o+=p,f&&(o+=" "),s+a>=n){f?r.push(o.slice(0,-1)):r.push(o),c();break}}}o.slice(-1)===" "&&(o=o.slice(0,-1),l(o))}),r.join(`
120
+ `)},i6=(()=>{let e={};return{calculate:(t,n)=>{let r=t.charCodeAt(0);if(e[n]||(e[n]=[]),!e[n][r]){let i=Cu(t,n);e[n][r]=i}return e[n][r]},getCache:t=>e[t]}})(),a6="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase(),bT=(e,t)=>{let n=KR(e);return n===0?ys(a6.split("").join(`
121
+ `),e,t).width+In*2:n+In*2},KR=e=>{let t=i6.getCache(e);if(!t)return 0;let n=t.filter(r=>r!==void 0);return Math.max(...n)},vs=e=>e?.boundElements?.length&&e?.boundElements?.filter(t=>t.type==="text")[0]?.id||null,Ye=(e,t)=>{if(!e)return null;let n=vs(e);return n&&t.get(n)||null},Er=(e,t)=>e&&e.containerId&&t.get(e.containerId)||null,rE=(e,t,n)=>{if(!Et(e))return{x:e.x+e.width/2,y:e.y+e.height/2};let r=fe.getPointsGlobalCoordinates(e,n);if(r.length%2===1){let o=Math.floor(e.points.length/2),s=fe.getPointGlobalCoordinates(e,e.points[o],n);return{x:s[0],y:s[1]}}let i=e.points.length/2-1,a=fe.getEditorMidPoints(e,n,t)[i];return a||(a=fe.getSegmentMidPoint(e,r[i],r[i+1],i+1,n)),{x:a[0],y:a[1]}},G5=e=>{let t=In,n=In;return e.type==="ellipse"&&(t+=e.width/2*(1-Math.sqrt(2)/2),n+=e.height/2*(1-Math.sqrt(2)/2)),e.type==="diamond"&&(t+=e.width/4,n+=e.height/4),{x:e.x+t,y:e.y+n}},cz=(e,t)=>!t||Et(t)?e.angle:t.angle,dz=(e,t)=>e.some(n=>{if(tn(n)){let r=Er(n,t);return!Et(r)}return!1}),uz=(e,t)=>e.some(n=>{if(tn(n)){let r=Er(n,t);return!Et(r)}return he(n)}),XR=new Set(["rectangle","ellipse","diamond","arrow"]),hz=e=>XR.has(e.type),Il=(e,t)=>{e=Math.ceil(e);let n=In*2;return t==="ellipse"?Math.round((e+n)/Math.sqrt(2)*2):t==="arrow"?e+n*8:t==="diamond"?2*(e+n):e+n},Ca=(e,t)=>{let{width:n}=e;if(Et(e)){let r=(t?.fontSize??Vi)*cB;return Math.max(lB*n,r)}return e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-In*2:e.type==="diamond"?Math.round(n/2)-In*2:n-In*2},Ju=(e,t)=>{let{height:n}=e;return Et(e)?n-In*8*2<=0?t.height:n:e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-In*2:e.type==="diamond"?Math.round(n/2)-In*2:n-In*2},mz=()=>Vp(a6,An({fontSize:Vi,fontFamily:To}))>0,r2={[Zn.Virgil]:1.25,[Zn.Helvetica]:1.15,[Zn.Cascadia]:1.2},o6={[Zn.Virgil]:{unitsPerEm:1e3,ascender:886,descender:-374},[Zn.Helvetica]:{unitsPerEm:2048,ascender:1577,descender:-471},[Zn.Cascadia]:{unitsPerEm:2048,ascender:1977,descender:-480},[Zn.Assistant]:{unitsPerEm:1e3,ascender:1021,descender:-287}},Fl=e=>e in r2?r2[e]:r2[To]}),qR,De,j5,pz,Uc,s6,l6,QR,Yp,i2,JR,eO,tO,fz,nO,rO,xs,Bt,iE,mf,W5,gz,So,Yte,Qt=M(()=>{"use strict";D(),rr(),FB(),Se(),Jb(),qt(),yr(),Ls(),te(),qR=class aE{static boundsCache=new WeakMap;static getBounds(t,n){let r=aE.boundsCache.get(t);if(r?.version&&r.version===t.version&&!tn(t))return r.bounds;let i=aE.calculateBounds(t,n);return aE.boundsCache.set(t,{version:t.version,bounds:i}),i}static calculateBounds(t,n){let r,[i,a,o,s,l,c]=De(t,n);if(Ar(t)){let[d,u,h,m]=i2(t.points.map(([p,f])=>Ve(p,f,l-t.x,c-t.y,t.angle)));return[d+t.x,u+t.y,h+t.x,m+t.y]}else if(Be(t))r=rO(t,l,c,n);else if(t.type==="diamond"){let[d,u]=Ve(l,a,l,c,t.angle),[h,m]=Ve(l,s,l,c,t.angle),[p,f]=Ve(i,c,l,c,t.angle),[g,b]=Ve(o,c,l,c,t.angle),v=Math.min(d,h,p,g),y=Math.min(u,m,f,b),w=Math.max(d,h,p,g),C=Math.max(u,m,f,b);r=[v,y,w,C]}else if(t.type==="ellipse"){let d=(o-i)/2,u=(s-a)/2,h=Math.cos(t.angle),m=Math.sin(t.angle),p=Math.hypot(d*h,u*m),f=Math.hypot(u*h,d*m);r=[l-p,c-f,l+p,c+f]}else{let[d,u]=Ve(i,a,l,c,t.angle),[h,m]=Ve(i,s,l,c,t.angle),[p,f]=Ve(o,s,l,c,t.angle),[g,b]=Ve(o,a,l,c,t.angle),v=Math.min(d,h,p,g),y=Math.min(u,m,f,b),w=Math.max(d,h,p,g),C=Math.max(u,m,f,b);r=[v,y,w,C]}return r}},De=(e,t,n=!1)=>{if(Ar(e))return JR(e);if(Be(e))return fe.getElementAbsoluteCoords(e,t,n);if(he(e)){let r=t?Er(e,t):null;if(Et(r)){let i=fe.getBoundTextElementPosition(r,e,t);return[i.x,i.y,i.x+e.width,i.y+e.height,i.x+e.width/2,i.y+e.height/2]}}return[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2]},j5=(e,t)=>{let[n,r,i,a,o,s]=De(e,t),l=[o,s];if(Be(e)||Ar(e)){let b=[],v=0;for(;v<e.points.length-1;)b.push([Rt([e.points[v][0]+e.x,e.points[v][1]+e.y],l,e.angle),Rt([e.points[v+1][0]+e.x,e.points[v+1][1]+e.y],l,e.angle)]),v++;return b}let[c,d,u,h,m,p,f,g]=[[n,r],[i,r],[n,a],[i,a],[o,r],[o,a],[n,s],[i,s]].map(b=>Rt(b,l,e.angle));return e.type==="diamond"?[[m,f],[m,g],[p,f],[p,g]]:e.type==="ellipse"?[[m,f],[m,g],[p,f],[p,g],[m,f],[m,g],[p,f],[p,g]]:[[c,d],[u,h],[c,u],[d,h],[c,g],[u,g],[d,f],[h,f]]},pz=e=>{let t=Math.floor(e.width/2)+1,n=0,r=e.width,i=Math.floor(e.height/2)+1,a=t,o=e.height;return[t,n,r,i,a,o,0,i]},Uc=e=>{for(let t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},s6=(e,t,n,r,i)=>{let a=1-e;return Math.pow(a,3)*t+3*Math.pow(a,2)*e*n+3*a*Math.pow(e,2)*r+Math.pow(e,3)*i},l6=(e,t,n,r)=>{let i=t-e,a=n-t,o=r-n,s=3*i-6*a+3*o,l=6*a-6*i,c=3*i,d=l*l-4*s*c;if(!(d>=0))return!1;let u=null,h=null,m=1/0,p=1/0;return s===0?m=p=-c/l:(m=(-l+Math.sqrt(d))/(2*s),p=(-l-Math.sqrt(d))/(2*s)),m>=0&&m<=1&&(u=s6(m,e,t,n,r)),p>=0&&p<=1&&(h=s6(p,e,t,n,r)),[u,h]},QR=(e,t,n,r)=>{let i=l6(e[0],t[0],n[0],r[0]),a=l6(e[1],t[1],n[1],r[1]),o=Math.min(e[0],r[0]),s=Math.max(e[0],r[0]);if(i){let d=i.filter(u=>u!==null);o=Math.min(o,...d),s=Math.max(s,...d)}let l=Math.min(e[1],r[1]),c=Math.max(e[1],r[1]);if(a){let d=a.filter(u=>u!==null);l=Math.min(l,...d),c=Math.max(c,...d)}return[o,l,s,c]},Yp=(e,t)=>{let n=[0,0],{minX:r,minY:i,maxX:a,maxY:o}=e.reduce((s,{op:l,data:c})=>{if(l==="move")n=c;else if(l==="bcurveTo"){let d=[c[0],c[1]],u=[c[2],c[3]],h=[c[4],c[5]],m=t?t(...d):d,p=t?t(...u):u,f=t?t(...h):h,g=t?t(...n):n;n=h;let[b,v,y,w]=QR(g,m,p,f);s.minX=Math.min(s.minX,b),s.minY=Math.min(s.minY,v),s.maxX=Math.max(s.maxX,y),s.maxY=Math.max(s.maxY,w)}return s},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[r,i,a,o]},i2=e=>{let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let[a,o]of e)t=Math.min(t,a),n=Math.min(n,o),r=Math.max(r,a),i=Math.max(i,o);return[t,n,r,i]},JR=e=>{let[t,n,r,i]=i2(e.points),a=t+e.x,o=n+e.y,s=r+e.x,l=i+e.y;return[a,o,s,l,(a+s)/2,(o+l)/2]},eO=e=>{switch(e){case"arrow":return 25;case"diamond":case"diamond_outline":return 12;default:return 15}},tO=e=>{switch(e){case"bar":return 90;case"arrow":return 20;default:return 25}},fz=(e,t,n,r)=>{let i=Uc(t[0]);if(i.length<1)return null;let a=n==="start"?1:i.length-1,o=i[a].data,s=[o[4],o[5]],l=[o[2],o[3]],c=[o[0],o[1]],d=i[a-1],u=[0,0];d.op==="move"?u=d.data:d.op==="bcurveTo"&&(u=[d.data[4],d.data[5]]);let h=(Y,j)=>Math.pow(1-Y,3)*s[j]+3*Y*Math.pow(1-Y,2)*l[j]+3*Math.pow(Y,2)*(1-Y)*c[j]+u[j]*Math.pow(Y,3),[m,p]=n==="start"?u:s,[f,g]=[h(.3,0),h(.3,1)],b=Math.hypot(m-f,p-g),v=(m-f)/b,y=(p-g)/b,w=eO(r),C=0;{let[Y,j]=n==="end"?e.points[e.points.length-1]:e.points[0],[q,ne]=e.points.length>1?n==="end"?e.points[e.points.length-2]:e.points[1]:[0,0];C=Math.hypot(Y-q,j-ne)}let A=Math.min(w,C*(r==="diamond"||r==="diamond_outline"?.25:.5)),T=m-v*A,I=p-y*A;if(r==="dot"||r==="circle"||r==="circle_outline"){let Y=Math.hypot(I-p,T-m)+e.strokeWidth-2;return[m,p,Y]}let k=tO(r),[R,O]=Ve(T,I,m,p,-k*Math.PI/180),[P,F]=Ve(T,I,m,p,k*Math.PI/180);if(r==="diamond"||r==="diamond_outline"){let Y,j;if(n==="start"){let[q,ne]=e.points.length>1?e.points[1]:[0,0];[Y,j]=Ve(m+A*2,p,m,p,Math.atan2(ne-p,q-m))}else{let[q,ne]=e.points.length>1?e.points[e.points.length-2]:[0,0];[Y,j]=Ve(m-A*2,p,m,p,Math.atan2(p-ne,m-q))}return[m,p,R,O,Y,j,P,F]}return[m,p,R,O,P,F]},nO=e=>{let t=nn.generator(),n=ci(e),r=e.roundness?"curve":n.fill?"polygon":"linearPath";return t[r](e.points,n)},rO=(e,t,n,r)=>{let i=Ye(e,r);if(e.points.length<2){let[c,d]=e.points[0],[u,h]=Ve(e.x+c,e.y+d,t,n,e.angle),m=[u,h,u,h];if(i){let p=fe.getMinMaxXYWithBoundText(e,r,[u,h,u,h],i);m=[p[0],p[1],p[2],p[3]]}return m}let a=Xt.get(e)?.[0]??nO(e),o=Uc(a),s=Yp(o,(c,d)=>Ve(e.x+c,e.y+d,t,n,e.angle)),l=[s[0],s[1],s[2],s[3]];if(i){let c=fe.getMinMaxXYWithBoundText(e,r,l,i);l=[c[0],c[1],c[2],c[3]]}return l},xs=(e,t)=>qR.getBounds(e,t),Bt=e=>{if(!e.length)return[0,0,0,0];let t=1/0,n=-1/0,r=1/0,i=-1/0,a=ve(e);return e.forEach(o=>{let[s,l,c,d]=xs(o,a);t=Math.min(t,s),r=Math.min(r,l),n=Math.max(n,c),i=Math.max(i,d)}),[t,r,n,i]},iE=(e,t)=>{let[n,r,i,a]=Bt(e);return[n+t.x,r+t.y,i+t.x,a+t.y]},mf=(e,t,n,r)=>{if(!(Be(e)||Ar(e)))return[e.x,e.y,e.x+t,e.y+n];let i=Wc(0,t,Wc(1,n,e.points,r),r),a;if(Ar(e))a=i2(i);else{let d=nn.generator(),u=e.roundness?d.curve(i,ci(e)):d.linearPath(i,ci(e)),h=Uc(u);a=Yp(h)}let[o,s,l,c]=a;return[o+e.x,s+e.y,l+e.x,c+e.y]},W5=(e,t)=>{let n=nn.generator(),r=e.roundness==null?n.linearPath(t,ci(e)):n.curve(t,ci(e)),i=Uc(r),[a,o,s,l]=Yp(i);return[a+e.x,o+e.y,s+e.x,l+e.y]},gz=(e,t)=>{if(!e.length)return[0,0,0,0];let n=1/0,r=e[0],i=ve(e);return e.forEach(a=>{let[o,s,l,c]=xs(a,i),d=Kn((o+l)/2,(s+c)/2,t.x,t.y);d<n&&(n=d,r=a)}),xs(r,i)},So=e=>{let[t,n,r,i]=Bt(e);return{minX:t,minY:n,maxX:r,maxY:i,width:r-t,height:i-n,midX:(t+r)/2,midY:(n+i)/2}},Yte=({scrollX:e,scrollY:t,width:n,height:r,zoom:i})=>[-e,-t,-e+n/i.value,-t+r/i.value]}),iO,Ms,aO,a2,Zte,yT,Ez,ya,hd,vi=M(()=>{"use strict";D(),ae(),iO=Kb.includes(devicePixelRatio)?devicePixelRatio:1,Ms=()=>({showWelcomeScreen:!1,theme:ze.LIGHT,collaborators:new Map,currentChartType:"bar",currentItemBackgroundColor:Zt.backgroundColor,currentItemEndArrowhead:"arrow",currentItemFillStyle:Zt.fillStyle,currentItemFontFamily:To,currentItemFontSize:Vi,currentItemOpacity:Zt.opacity,currentItemRoughness:Zt.roughness,currentItemStartArrowhead:null,currentItemStrokeColor:Zt.strokeColor,currentItemRoundness:"round",currentItemStrokeStyle:Zt.strokeStyle,currentItemStrokeWidth:Zt.strokeWidth,currentItemTextAlign:v1,cursorButton:"up",activeEmbeddable:null,draggingElement:null,editingElement:null,editingGroupId:null,editingLinearElement:null,activeTool:{type:"selection",customType:null,locked:Zt.locked,lastActiveTool:null},penMode:!1,penDetected:!1,errorMessage:null,exportBackground:!0,exportScale:iO,exportEmbedScene:!1,exportWithDarkMode:!1,fileHandle:null,gridSize:null,isBindingEnabled:!0,defaultSidebarDockedPreference:!1,isLoading:!1,isResizing:!1,isRotating:!1,lastPointerDownWith:"mouse",multiElement:null,name:null,contextMenu:null,openMenu:null,openPopup:null,openSidebar:null,openDialog:null,pasteDialog:{shown:!1,data:null},previousSelectedElementIds:{},resizingElement:null,scrolledOutside:!1,scrollX:0,scrollY:0,selectedElementIds:{},selectedGroupIds:{},selectedElementsAreBeingDragged:!1,selectionElement:null,shouldCacheIgnoreZoom:!1,showStats:!1,startBoundElement:null,suggestedBindings:[],frameRendering:{enabled:!0,clip:!0,name:!0,outline:!0},frameToHighlight:null,editingFrame:null,elementsToHighlight:null,toast:null,viewBackgroundColor:Ui,zenModeEnabled:!1,zoom:{value:KC},viewModeEnabled:!1,pendingImageElementId:null,showHyperlinkPopup:!1,selectedLinearElement:null,snapLines:[],originSnapOffset:{x:0,y:0},objectsSnapModeEnabled:!1,userToFollow:null,followedBy:new Set}),aO=(e=>e)({showWelcomeScreen:{browser:!0,export:!1,server:!1},theme:{browser:!0,export:!1,server:!1},collaborators:{browser:!1,export:!1,server:!1},currentChartType:{browser:!0,export:!1,server:!1},currentItemBackgroundColor:{browser:!0,export:!1,server:!1},currentItemEndArrowhead:{browser:!0,export:!1,server:!1},currentItemFillStyle:{browser:!0,export:!1,server:!1},currentItemFontFamily:{browser:!0,export:!1,server:!1},currentItemFontSize:{browser:!0,export:!1,server:!1},currentItemRoundness:{browser:!0,export:!1,server:!1},currentItemOpacity:{browser:!0,export:!1,server:!1},currentItemRoughness:{browser:!0,export:!1,server:!1},currentItemStartArrowhead:{browser:!0,export:!1,server:!1},currentItemStrokeColor:{browser:!0,export:!1,server:!1},currentItemStrokeStyle:{browser:!0,export:!1,server:!1},currentItemStrokeWidth:{browser:!0,export:!1,server:!1},currentItemTextAlign:{browser:!0,export:!1,server:!1},cursorButton:{browser:!0,export:!1,server:!1},activeEmbeddable:{browser:!1,export:!1,server:!1},draggingElement:{browser:!1,export:!1,server:!1},editingElement:{browser:!1,export:!1,server:!1},editingGroupId:{browser:!0,export:!1,server:!1},editingLinearElement:{browser:!1,export:!1,server:!1},activeTool:{browser:!0,export:!1,server:!1},penMode:{browser:!0,export:!1,server:!1},penDetected:{browser:!0,export:!1,server:!1},errorMessage:{browser:!1,export:!1,server:!1},exportBackground:{browser:!0,export:!1,server:!1},exportEmbedScene:{browser:!0,export:!1,server:!1},exportScale:{browser:!0,export:!1,server:!1},exportWithDarkMode:{browser:!0,export:!1,server:!1},fileHandle:{browser:!1,export:!1,server:!1},gridSize:{browser:!0,export:!0,server:!0},height:{browser:!1,export:!1,server:!1},isBindingEnabled:{browser:!1,export:!1,server:!1},defaultSidebarDockedPreference:{browser:!0,export:!1,server:!1},isLoading:{browser:!1,export:!1,server:!1},isResizing:{browser:!1,export:!1,server:!1},isRotating:{browser:!1,export:!1,server:!1},lastPointerDownWith:{browser:!0,export:!1,server:!1},multiElement:{browser:!1,export:!1,server:!1},name:{browser:!0,export:!1,server:!1},offsetLeft:{browser:!1,export:!1,server:!1},offsetTop:{browser:!1,export:!1,server:!1},contextMenu:{browser:!1,export:!1,server:!1},openMenu:{browser:!0,export:!1,server:!1},openPopup:{browser:!1,export:!1,server:!1},openSidebar:{browser:!0,export:!1,server:!1},openDialog:{browser:!1,export:!1,server:!1},pasteDialog:{browser:!1,export:!1,server:!1},previousSelectedElementIds:{browser:!0,export:!1,server:!1},resizingElement:{browser:!1,export:!1,server:!1},scrolledOutside:{browser:!0,export:!1,server:!1},scrollX:{browser:!0,export:!1,server:!1},scrollY:{browser:!0,export:!1,server:!1},selectedElementIds:{browser:!0,export:!1,server:!1},selectedGroupIds:{browser:!0,export:!1,server:!1},selectedElementsAreBeingDragged:{browser:!1,export:!1,server:!1},selectionElement:{browser:!1,export:!1,server:!1},shouldCacheIgnoreZoom:{browser:!0,export:!1,server:!1},showStats:{browser:!0,export:!1,server:!1},startBoundElement:{browser:!1,export:!1,server:!1},suggestedBindings:{browser:!1,export:!1,server:!1},frameRendering:{browser:!1,export:!1,server:!1},frameToHighlight:{browser:!1,export:!1,server:!1},editingFrame:{browser:!1,export:!1,server:!1},elementsToHighlight:{browser:!1,export:!1,server:!1},toast:{browser:!1,export:!1,server:!1},viewBackgroundColor:{browser:!0,export:!0,server:!0},width:{browser:!1,export:!1,server:!1},zenModeEnabled:{browser:!0,export:!1,server:!1},zoom:{browser:!0,export:!1,server:!1},viewModeEnabled:{browser:!1,export:!1,server:!1},pendingImageElementId:{browser:!1,export:!1,server:!1},showHyperlinkPopup:{browser:!1,export:!1,server:!1},selectedLinearElement:{browser:!0,export:!1,server:!1},snapLines:{browser:!1,export:!1,server:!1},originSnapOffset:{browser:!1,export:!1,server:!1},objectsSnapModeEnabled:{browser:!0,export:!1,server:!1},userToFollow:{browser:!1,export:!1,server:!1},followedBy:{browser:!1,export:!1,server:!1}}),a2=(e,t)=>{let n={};for(let r of Object.keys(e))if(aO[r]?.[t]){let i=e[r];n[r]=i}return n},Zte=e=>a2(e,"browser"),yT=e=>a2(e,"export"),Ez=e=>a2(e,"server"),ya=({activeTool:e})=>e.type==="eraser",hd=({activeTool:e})=>e.type==="hand"}),V5,jr,vT,Y5,Zc,xT,bz,Ch,yn,yz,vz,xz,wz,Nf,Sz,Cz,Kr=M(()=>{"use strict";D(),It(),qt(),xd(),V5=(e,t,n)=>{let r=n.reduce((i,a)=>(a.groupIds.includes(e)&&(i[a.id]=!0),i),{});return Object.keys(r).length<2?t.selectedGroupIds[e]||t.editingGroupId===e?{selectedElementIds:t.selectedElementIds,selectedGroupIds:{...t.selectedGroupIds,[e]:!1},editingGroupId:null}:t:{editingGroupId:t.editingGroupId,selectedGroupIds:{...t.selectedGroupIds,[e]:!0},selectedElementIds:{...t.selectedElementIds,...r}}},jr=function(){let e=null,t=null,n=null,r=(a,o,s,l)=>{if(n!==void 0&&o===t&&a===e&&s.editingGroupId===n?.editingGroupId)return n;let c={};for(let h of a){let m=h.groupIds;if(s.editingGroupId){let p=m.indexOf(s.editingGroupId);p>-1&&(m=m.slice(0,p))}if(m.length>0){let p=m[m.length-1];c[p]=!0}}let d={},u=o.reduce((h,m)=>{let p=m.groupIds.find(f=>c[f]);return p&&(h[m.id]=!0,Array.isArray(d[p])?d[p].push(m.id):d[p]=[m.id]),h},{});for(let h of Object.keys(d))d[h].length<2&&c[h]&&(c[h]=!1);return t=o,e=a,n={editingGroupId:s.editingGroupId,selectedGroupIds:c,selectedElementIds:lt({...s.selectedElementIds,...u},l)},n},i=(a,o,s,l)=>{let c=l?l.scene.getSelectedElements({selectedElementIds:a.selectedElementIds,elements:o}):bt(o,a);return c.length?r(c,o,a,s):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:lt(a.selectedElementIds,s)}};return i.clearCache=()=>{t=null,e=null,n=null},i}(),vT=(e,t)=>Y5(e,t)!=null,Y5=(e,t)=>t.groupIds.filter(n=>n!==e.editingGroupId).find(n=>e.selectedGroupIds[n]),Zc=e=>Object.entries(e.selectedGroupIds).filter(([t,n])=>n).map(([t,n])=>t),xT=(e,t)=>{let n={...t,selectedGroupIds:{}};for(let r of e){let i=r.groupIds;if(t.editingGroupId){let a=i.indexOf(t.editingGroupId);a>-1&&(i=i.slice(0,a))}if(i.length>0){let a=i[i.length-1];n={...n,...V5(a,n,e)}}}return n.selectedGroupIds},bz=(e,t)=>({...e,editingGroupId:t.groupIds.length?t.groupIds[0]:null,selectedGroupIds:{},selectedElementIds:{[t.id]:!0}}),Ch=(e,t)=>e.groupIds.includes(t),yn=(e,t)=>{let n=[];for(let r of e.values())Ch(r,t)&&n.push(r);return n},yz=(e,t)=>e.groupIds.find(n=>t[n]),vz=(e,t,n)=>{let r=[...e],i=t?e.indexOf(t):-1,a=i>-1?i:e.length;for(let o=0;o<a;o++)r[o]=n(r[o]);return r},xz=(e,t,n)=>{let r=[...e],i=n?r.indexOf(n):-1,a=i>-1?i:r.length;return r.splice(a,0,t),r},wz=(e,t)=>e.filter(n=>!t[n]),Nf=(e,t)=>{let n=new Map;return e.forEach(r=>{let i=r.groupIds.length===0?r.id:r.groupIds[r.groupIds.length-1],a=n.get(i)||[],o=Ye(r,t);o&&a.push(o),n.set(i,[...a,r])}),Array.from(n.values())},Sz=e=>{let t=new Set;for(let[,n]of e)if(!n.isDeleted)for(let r of n.groupIds??[])t.add(r);return t},Cz=e=>e.groupIds.length>0}),GE,Da,wT,ST,Gh=M(()=>{"use strict";D(),GE=e=>e.replace(/"/g,"&quot;"),Da=e=>(e=e.trim(),e&&(0,Tz.sanitizeUrl)(GE(e))),wT=e=>!!(e?.includes(location.origin)||e?.startsWith("/")),ST=e=>{if(e=Da(e),e.startsWith("/"))return`${location.origin}${e}`;try{new URL(e)}catch{return"about:blank"}return e}}),oE,oe,Tt=M(()=>{"use strict";D(),oE=[],oe=e=>(oE=oE.concat(e),e)}),c6,oO,d6,sO,lO,Ni,yt,lo,cO,Z5,Ea,S1=M(()=>{"use strict";D(),ae(),vi(),c6='<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">',oO='<path d="M6.164 11.755a5.314 5.314 0 0 1-4.932-5.298 5.314 5.314 0 0 1 5.311-5.311 5.314 5.314 0 0 1 5.307 5.113l8.773 8.773a3.322 3.322 0 0 1 0 4.696l-.895.895a3.322 3.322 0 0 1-4.696 0l-8.868-8.868Z" style="fill:#fff"/>',d6='<path stroke="#1b1b1f" fill="#fff" d="m7.868 11.113 7.773 7.774a2.359 2.359 0 0 0 1.667.691 2.368 2.368 0 0 0 2.357-2.358c0-.625-.248-1.225-.69-1.667L11.201 7.78 9.558 9.469l-1.69 1.643v.001Zm10.273 3.606-3.333 3.333m-3.25-6.583 2 2m-7-7 3 3M3.664 3.625l1 1M2.529 6.922l1.407-.144m5.735-2.932-1.118.866M4.285 9.823l.758-1.194m1.863-6.207-.13 1.408"/>',sO=`data:${we.svg},${encodeURIComponent(`${c6}${d6}</svg>`)}`,lO=`data:${we.svg},${encodeURIComponent(`${c6}${oO}${d6}</svg>`)}`,Ni=e=>{e&&(e.style.cursor="")},yt=(e,t)=>{e&&(e.style.cursor=t)},Z5=(e,t)=>{let n=()=>{let r=t===ze.DARK;lo=document.createElement("canvas"),lo.theme=t,lo.height=20,lo.width=20;let i=lo.getContext("2d");i.lineWidth=1,i.beginPath(),i.arc(lo.width/2,lo.height/2,5,0,2*Math.PI),i.fillStyle=r?At.black:At.white,i.fill(),i.strokeStyle=r?At.white:At.black,i.stroke(),cO=lo.toDataURL(we.svg)};(!lo||lo.theme!==t)&&n(),yt(e,`url(${cO}) ${20/2} ${20/2}, auto`)},Ea=(e,t)=>{if(e)if(t.activeTool.type==="selection")Ni(e);else if(hd(t))e.style.cursor=gt.GRAB;else if(ya(t))Z5(e,t.theme);else if(t.activeTool.type==="laser"){let n=t.theme===ze.LIGHT?sO:lO;e.style.cursor=`url(${n}), auto`}else if(!["image","custom"].includes(t.activeTool.type))e.style.cursor=gt.CROSSHAIR;else if(t.activeTool.type==="custom"&&t.activeTool.customType==="comment"){let n=`data:${we.svg},${encodeURIComponent(`
122
+ <svg
123
+ width="24"
124
+ height="24"
125
+ viewBox="0 0 24 24"
126
+ xmlns="http://www.w3.org/2000/svg"
127
+ >
128
+ <path
129
+ d="M5.25 18A3.25 3.25 0 0 1 2 14.75v-8.5A3.25 3.25 0 0 1 5.25 3h13.5A3.25 3.25 0 0 1 22 6.25v8.5A3.25 3.25 0 0 1 18.75 18h-5.738L8 21.75a1.25 1.25 0 0 1-1.999-1V18h-.75Zm7.264-1.5h6.236a1.75 1.75 0 0 0 1.75-1.75v-8.5a1.75 1.75 0 0 0-1.75-1.75H5.25A1.75 1.75 0 0 0 3.5 6.25v8.5c0 .966.784 1.75 1.75 1.75h2.249v3.75l5.015-3.75Z"
130
+ fill="${t.theme===ze.LIGHT?"#000":"#fff"}"
131
+ />
132
+ </svg>
133
+ `)}`;e.style.cursor=`url(${n}) 5 20, auto`}else t.activeTool.type!=="image"&&(e.style.cursor=gt.AUTO)}}),co,As,K5,Iz,CT,jE,u6,fi,dO,WE,Mz,Az,hs,TT,Sp,Th,Cp,IT,MT,_s=M(()=>{"use strict";D(),te(),Ao(),vt(),Kr(),Oe(),rr(),Qt(),qt(),ae(),co=(e,{x:t,y:n,strokeColor:r=Zt.strokeColor,backgroundColor:i=Zt.backgroundColor,fillStyle:a=Zt.fillStyle,strokeWidth:o=Zt.strokeWidth,strokeStyle:s=Zt.strokeStyle,roughness:l=Zt.roughness,opacity:c=Zt.opacity,width:d=0,height:u=0,angle:h=0,groupIds:m=[],frameId:p=null,index:f=null,roundness:g=null,boundElements:b=null,link:v=null,locked:y=Zt.locked,...w})=>({id:w.id||pi(),type:e,x:t,y:n,width:d,height:u,angle:h,strokeColor:r,backgroundColor:i,fillStyle:a,strokeWidth:o,strokeStyle:s,roughness:l,opacity:c,groupIds:m,frameId:p,index:f,roundness:g,seed:w.seed??Is(),version:w.version||1,versionNonce:w.versionNonce??0,isDeleted:!1,boundElements:b,updated:rd(),link:v,locked:y,customData:w.customData}),As=e=>co(e.type,e),K5=e=>co("embeddable",e),Iz=e=>({...co("iframe",e)}),CT=e=>Re({...co("frame",e),type:"frame",name:e?.name||null},{}),jE=e=>Re({...co("magicframe",e),type:"magicframe",name:e?.name||null},{}),u6=(e,t)=>({x:e.textAlign==="center"?t.width/2:e.textAlign==="right"?t.width:0,y:e.verticalAlign==="middle"?t.height/2:0}),fi=e=>{let t=e.fontFamily||To,n=e.fontSize||Vi,r=e.lineHeight||Fl(t),i=Sh(e.text),a=ys(i,An({fontFamily:t,fontSize:n}),r),o=e.textAlign||v1,s=e.verticalAlign||Mf,l=u6({textAlign:o,verticalAlign:s},a);return Re({...co("text",e),text:i,fontSize:n,fontFamily:t,textAlign:o,verticalAlign:s,x:e.x-l.x,y:e.y-l.y,width:a.width,height:a.height,containerId:e.containerId||null,originalText:i,lineHeight:r},{})},dO=(e,t,n)=>{let{width:r,height:i}=ys(n,An(e),e.lineHeight),{textAlign:a,verticalAlign:o}=e,s,l;if(a==="center"&&o===Yr.MIDDLE&&!e.containerId){let c=ys(e.text,An(e),e.lineHeight),d=u6(e,{width:r-c.width,height:i-c.height});s=e.x-d.x,l=e.y-d.y}else{let[c,d,u,h]=De(e,t),[m,p,f,g]=mf(e,r,i,!1),b=(c-m)/2,v=(d-p)/2,y=(u-f)/2,w=(h-g)/2;[s,l]=_B({s:!0,e:a==="center"||a==="left",w:a==="center"||a==="right"},e.x,e.y,e.angle,b,v,y,w)}return{width:r,height:i,x:Number.isFinite(s)?s:e.x,y:Number.isFinite(l)?l:e.y}},WE=(e,t,n,r=e.text)=>{if(e.isDeleted)return;t&&(r=ah(r,An(e),Ca(t,e)));let i=dO(e,n,r);return{text:r,...i}},Mz=(e,t,n,{text:r,isDeleted:i,originalText:a})=>Re(e,{originalText:a,isDeleted:i??e.isDeleted,...WE(e,t,n,a)}),Az=e=>({...co(e.type,e),points:e.points||[],pressures:[],simulatePressure:e.simulatePressure,lastCommittedPoint:null}),hs=e=>({...co(e.type,e),points:e.points||[],lastCommittedPoint:null,startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null}),TT=e=>({...co("image",e),strokeColor:"transparent",status:e.status??"pending",fileId:e.fileId??null,scale:e.scale??[1,1]}),Sp=(e,t=0)=>{if(e==null||typeof e!="object")return e;let n=Object.prototype.toString.call(e);if(n==="[object Object]"){let r=typeof e.constructor=="function"?Object.create(Object.getPrototypeOf(e)):{};for(let i in e)if(e.hasOwnProperty(i)){if(t===0&&(i==="shape"||i==="canvas"))continue;r[i]=Sp(e[i],t+1)}return r}if(Array.isArray(e)){let r=e.length,i=new Array(r);for(;r--;)i[r]=Sp(e[r],t+1);return i}return Ne.DEV&&n!=="[object Object]"&&n!=="[object Array]"&&n.startsWith("[object ")&&console.warn(`_deepCloneElement: unexpected object type ${n}. This value will not be cloned!`),e},Th=e=>Sp(e),Cp=e=>{if($l()&&e){let t=`${e}_copy`;return window.h?.app?.getSceneElementsIncludingDeleted().find(n=>n.id===t)&&(t+="_copy"),t}return pi()},IT=(e,t,n,r)=>{let i=Th(n);return i.id=Cp(i.id),i.boundElements=null,i.updated=rd(),i.seed=Is(),i.groupIds=vz(i.groupIds,e,a=>(t.has(a)||t.set(a,Cp(a)),t.get(a))),r&&(i=Object.assign(i,r)),i},MT=(e,t)=>{let n=[],r=ve(e),i=new Map,a=s=>{if(i.has(s))return i.get(s);if(r.has(s)){let l=Cp(s);return i.set(s,l),l}return null},o=new Map;for(let s of e){let l=Sp(s);if(l.id=a(s.id),t?.randomizeSeed&&(l.seed=Is(),Uf(l)),l.groupIds&&(l.groupIds=l.groupIds.map(c=>(o.has(c)||o.set(c,Cp(c)),o.get(c)))),"containerId"in l&&l.containerId){let c=a(l.containerId);l.containerId=c}if("boundElements"in l&&l.boundElements&&(l.boundElements=l.boundElements.reduce((c,d)=>{let u=a(d.id);return u&&c.push({...d,id:u}),c},[])),"endBinding"in l&&l.endBinding){let c=a(l.endBinding.elementId);l.endBinding=c?{...l.endBinding,elementId:c}:null}if("startBinding"in l&&l.startBinding){let c=a(l.startBinding.elementId);l.startBinding=c?{...l.startBinding,elementId:c}:null}l.frameId&&(l.frameId=a(l.frameId)),n.push(l)}return n}}),dn,X5,q5,Kte=M(()=>{"use strict";D(),ae(),Fa(),yr(),vt(),qt(),Se(),$a(),Kr(),ht(),te(),dn=class fo{constructor(t,n){this.deleted=t,this.inserted=n}static create(t,n,r,i){let a=r&&i!=="inserted"?r(t):t,o=r&&i!=="deleted"?r(n):n;return new fo(a,o)}static calculate(t,n,r,i){if(t===n)return fo.empty();let a={},o={};for(let c of this.distinctKeysIterator("full",t,n))a[c]=t[c],o[c]=n[c];let[s,l]=i?i(a,o):[a,o];return fo.create(s,l,r)}static empty(){return new fo({},{})}static isEmpty(t){return!Object.keys(t.deleted).length&&!Object.keys(t.inserted).length}static mergeObjects(t,n,r){let i={...t};for(let a of Object.keys(r))delete i[a];return{...i,...n}}static mergeArrays(t,n,r,i){return Object.values(fo.mergeObjects(po(t??[],i),po(n??[],i),po(r??[],i)))}static diffObjects(t,n,r,i){if(!(!t[r]&&!n[r])&&(typeof t[r]=="object"||typeof n[r]=="object")){let a=t[r]??{},o=n[r]??{},s=fo.getLeftDifferences(a,o).reduce((c,d)=>(c[d]=i(a[d]),c),{}),l=fo.getRightDifferences(a,o).reduce((c,d)=>(c[d]=i(o[d]),c),{});Object.keys(s).length||Object.keys(l).length?(Reflect.set(t,r,s),Reflect.set(n,r,l)):(Reflect.deleteProperty(t,r),Reflect.deleteProperty(n,r))}}static diffArrays(t,n,r,i){if(!(!t[r]&&!n[r])&&(Array.isArray(t[r])||Array.isArray(n[r]))){let a=Array.isArray(t[r])?t[r]:[],o=Array.isArray(n[r])?n[r]:[],s=po(fo.getLeftDifferences(po(a,i),po(o,i))),l=po(fo.getRightDifferences(po(a,i),po(o,i)));if(Object.keys(s).length||Object.keys(l).length){let c=a.filter(u=>s[i?i(u):String(u)]),d=o.filter(u=>l[i?i(u):String(u)]);Reflect.set(t,r,c),Reflect.set(n,r,d)}else Reflect.deleteProperty(t,r),Reflect.deleteProperty(n,r)}}static isLeftDifferent(t,n,r=!1){return!!this.distinctKeysIterator("left",t,n,r).next().value}static isRightDifferent(t,n,r=!1){return!!this.distinctKeysIterator("right",t,n,r).next().value}static getLeftDifferences(t,n,r=!1){return Array.from(this.distinctKeysIterator("left",t,n,r))}static getRightDifferences(t,n,r=!1){return Array.from(this.distinctKeysIterator("right",t,n,r))}static*distinctKeysIterator(t,n,r,i=!1){if(n===r)return;let a=[];t==="left"?a=Object.keys(n):t==="right"?a=Object.keys(r):t==="full"?a=Array.from(new Set([...Object.keys(n),...Object.keys(r)])):_l(t,`Unknown distinctKeysIterator's join param "${t}"`,!0);for(let o of a){let s=n[o],l=r[o];if(s!==l){if(!i&&typeof s=="object"&&typeof l=="object"&&s!==null&&l!==null&&Bn(s,l))continue;yield o}}}},X5=class Ur{constructor(t){this.delta=t}static calculate(t,n){let r=dn.calculate(t,n,void 0,Ur.postProcess);return new Ur(r)}static empty(){return new Ur(dn.create({},{}))}inverse(){let t=dn.create(this.delta.inserted,this.delta.deleted);return new Ur(t)}applyTo(t,n){try{let{selectedElementIds:r={},selectedGroupIds:i={}}=this.delta.deleted,{selectedElementIds:a={},selectedGroupIds:o={},selectedLinearElementId:s,editingLinearElementId:l,...c}=this.delta.inserted,d=dn.mergeObjects(t.selectedElementIds,a,r),u=dn.mergeObjects(t.selectedGroupIds,o,i),h=s&&n.has(s)?new fe(n.get(s)):null,m=l&&n.has(l)?new fe(n.get(l)):null,p={...t,...c,selectedElementIds:d,selectedGroupIds:u,selectedLinearElement:typeof s<"u"?h:t.selectedLinearElement,editingLinearElement:typeof l<"u"?m:t.editingLinearElement},f=this.filterInvisibleChanges(t,p,n);return[p,f]}catch(r){if(console.error("Couldn't apply appstate change",r),Ne.DEV||Ne.MODE===xa.TEST)throw r;return[t,!1]}}isEmpty(){return dn.isEmpty(this.delta)}static postProcess(t,n){try{dn.diffObjects(t,n,"selectedElementIds",r=>!0),dn.diffObjects(t,n,"selectedGroupIds",r=>r??!1)}catch(r){if(console.error("Couldn't postprocess appstate change deltas."),Ne.DEV||Ne.MODE===xa.TEST)throw r}finally{return[t,n]}}filterInvisibleChanges(t,n,r){let i=pf(t),a=pf(n),o=dn.isRightDifferent(Ur.stripElementsProps(i),Ur.stripElementsProps(a)),s=dn.isRightDifferent(Ur.stripStandaloneProps(i),Ur.stripStandaloneProps(a));if(!o&&!s)return!1;let l={value:o};if(s){let c=dn.getRightDifferences(Ur.stripStandaloneProps(i),Ur.stripStandaloneProps(a)),d=new Set;(c.includes("editingGroupId")||c.includes("selectedGroupIds"))&&(d=Sz(r));for(let u of c)switch(u){case"selectedElementIds":n[u]=Ur.filterSelectedElements(n[u],r,l);break;case"selectedGroupIds":n[u]=Ur.filterSelectedGroups(n[u],d,l);break;case"editingGroupId":let h=n[u];h?d.has(h)?l.value=!0:n[u]=null:l.value=!0;break;case"selectedLinearElementId":case"editingLinearElementId":let m=Ur.convertToAppStateKey(u),p=n[m];if(!p)l.value=!0;else{let f=r.get(p.elementId);f&&!f.isDeleted?l.value=!0:n[m]=null}break;default:_l(u,`Unknown ObservedElementsAppState's key "${u}"`,!0)}}return l.value}static convertToAppStateKey(t){switch(t){case"selectedLinearElementId":return"selectedLinearElement";case"editingLinearElementId":return"editingLinearElement"}}static filterSelectedElements(t,n,r){let i=Object.keys(t);if(!i.length)return r.value=!0,t;let a={...t};for(let o of i){let s=n.get(o);s&&!s.isDeleted?r.value=!0:delete a[o]}return a}static filterSelectedGroups(t,n,r){if(!Object.keys(t).length)return r.value=!0,t;let i={...t};for(let a of Object.keys(i))n.has(a)?r.value=!0:delete i[a];return i}static stripElementsProps(t){let{editingGroupId:n,selectedGroupIds:r,selectedElementIds:i,editingLinearElementId:a,selectedLinearElementId:o,...s}=t;return s}static stripStandaloneProps(t){let{name:n,viewBackgroundColor:r,...i}=t;return i}},q5=class $t{constructor(t,n,r){this.added=t,this.removed=n,this.updated=r}static create(t,n,r,i={shouldRedistribute:!1}){let a;if(i.shouldRedistribute){let o=new Map,s=new Map,l=new Map,c=[...t,...n,...r];for(let[d,u]of c)this.satisfiesAddition(u)?o.set(d,u):this.satisfiesRemoval(u)?s.set(d,u):l.set(d,u);a=new $t(o,s,l)}else a=new $t(t,n,r);return(Ne.DEV||Ne.MODE===xa.TEST)&&($t.validate(a,"added",this.satisfiesAddition),$t.validate(a,"removed",this.satisfiesRemoval),$t.validate(a,"updated",this.satisfiesUpdate)),a}static satisfiesAddition=({deleted:t,inserted:n})=>t.isDeleted===!0&&!n.isDeleted;static satisfiesRemoval=({deleted:t,inserted:n})=>!t.isDeleted&&n.isDeleted===!0;static satisfiesUpdate=({deleted:t,inserted:n})=>!!t.isDeleted==!!n.isDeleted;static validate(t,n,r){for(let[i,a]of t[n].entries())if(!r(a))throw console.error(`Broken invariant for "${n}" delta, element "${i}", delta:`,a),new Error(`ElementsChange invariant broken for element "${i}".`)}static calculate(t,n){if(t===n)return $t.empty();let r=new Map,i=new Map,a=new Map;for(let o of t.values())if(!n.get(o.id)){let s={...o,isDeleted:!1},l={isDeleted:!0},c=dn.create(s,l,$t.stripIrrelevantProps);i.set(o.id,c)}for(let o of n.values()){let s=t.get(o.id);if(!s){let l={isDeleted:!0},c={...o,isDeleted:!1},d=dn.create(l,c,$t.stripIrrelevantProps);r.set(o.id,d);continue}if(s.versionNonce!==o.versionNonce){let l=dn.calculate(s,o,$t.stripIrrelevantProps,$t.postProcess);if(typeof s.isDeleted=="boolean"&&typeof o.isDeleted=="boolean"&&s.isDeleted!==o.isDeleted){s.isDeleted&&!o.isDeleted?r.set(o.id,l):i.set(o.id,l);continue}dn.isEmpty(l)||a.set(o.id,l)}}return $t.create(r,i,a)}static empty(){return $t.create(new Map,new Map,new Map)}inverse(){let t=a=>{let o=new Map;for(let[s,l]of a.entries())o.set(s,dn.create(l.inserted,l.deleted));return o},n=t(this.added),r=t(this.removed),i=t(this.updated);return $t.create(r,n,i)}isEmpty(){return this.added.size===0&&this.removed.size===0&&this.updated.size===0}applyLatestChanges(t){let n=s=>l=>{let c={};for(let d of Object.keys(l))switch(d){case"boundElements":c[d]=l[d];break;default:c[d]=s[d]}return c},r=s=>{let l=new Map;for(let[c,d]of s.entries()){let u=t.get(c);if(u){let h=dn.create(d.deleted,d.inserted,n(u),"inserted");l.set(c,h)}else l.set(c,d)}return l},i=r(this.added),a=r(this.removed),o=r(this.updated);return $t.create(i,a,o,{shouldRedistribute:!0})}applyTo(t,n){let r=Ts(new Map(t)),i,a={containsVisibleDifference:!1,containsZindexDifference:!1};try{let o=$t.createApplier(r,n,a),s=o(this.added),l=o(this.removed),c=o(this.updated),d=this.resolveConflicts(t,r);i=new Map([...s,...l,...c,...d])}catch(o){if(console.error("Couldn't apply elements change",o),Ne.DEV||Ne.MODE===xa.TEST)throw o;return[t,!0]}try{$t.redrawTextBoundingBoxes(r,i),$t.redrawBoundArrows(r,i),r=$t.reorderElements(r,i,a)}catch(o){if(console.error("Couldn't mutate elements after applying elements change",o),Ne.DEV||Ne.MODE===xa.TEST)throw o}finally{return[r,a.containsVisibleDifference]}}static createApplier=(t,n,r)=>{let i=$t.createGetter(t,n,r);return a=>Array.from(a.entries()).reduce((o,[s,l])=>{let c=i(s,l.inserted);if(c){let d=$t.applyDelta(c,l,r);t.set(d.id,d),o.set(d.id,d)}return o},new Map)};static createGetter=(t,n,r)=>(i,a)=>{let o=t.get(i);return o||(o=n.get(i),o&&(r.containsZindexDifference=!0,(a.isDeleted===!1||a.isDeleted!==!0&&o.isDeleted===!1)&&(r.containsVisibleDifference=!0))),o};static applyDelta(t,n,r={containsVisibleDifference:!0,containsZindexDifference:!0}){let{boundElements:i,...a}=n.inserted;if(n.deleted.boundElements?.length||n.inserted.boundElements?.length){let o=dn.mergeArrays(t.boundElements,n.inserted.boundElements,n.deleted.boundElements,s=>s.id);Object.assign(a,{boundElements:o})}if(!r.containsVisibleDifference){let{index:o,...s}=a,l=$t.checkForVisibleDifference(t,s);r.containsVisibleDifference=l}return r.containsZindexDifference||(r.containsZindexDifference=n.deleted.index!==n.inserted.index),Re(t,a)}static checkForVisibleDifference(t,n){return t.isDeleted&&n.isDeleted!==!1?!1:t.isDeleted&&n.isDeleted===!1||t.isDeleted===!1&&n.isDeleted?!0:dn.isRightDifferent(t,n)}resolveConflicts(t,n){let r=new Map,i=(c,d)=>{let u=n.get(c.id);if(!u)return;let h;t.get(c.id)===u?h=Re(u,d):h=ie(u,d),r.set(h.id,h),n.set(h.id,h)};for(let[c]of this.removed)$t.unbindAffected(t,n,c,i);for(let[c]of this.added)$t.rebindAffected(t,n,c,i);for(let[c]of Array.from(this.updated).filter(([d,u])=>Object.keys({...u.deleted,...u.inserted}).find(h=>oz.has(h)))){let d=n.get(c);!d||d.isDeleted||$t.rebindAffected(t,n,c,i)}let a=new Map(Array.from(t).filter(([c])=>r.has(c))),{added:o,removed:s,updated:l}=$t.calculate(a,r);for(let[c,d]of o)this.added.set(c,d);for(let[c,d]of s)this.removed.set(c,d);for(let[c,d]of l)this.updated.set(c,d);return r}static unbindAffected(t,n,r,i){let a=()=>t.get(r),o=()=>n.get(r);qu.unbindAffected(n,a(),i),qu.unbindAffected(n,o(),i),Qu.unbindAffected(n,a(),i),Qu.unbindAffected(n,o(),i)}static rebindAffected(t,n,r,i){let a=()=>t.get(r),o=()=>n.get(r);qu.unbindAffected(n,a(),i),qu.rebindAffected(n,o(),i),Qu.unbindAffected(n,a(),(s,l)=>{he(s)&&i(s,l)}),Qu.rebindAffected(n,o(),i)}static redrawTextBoundingBoxes(t,n){let r=new Map;for(let i of n.values()){if(tn(i)){let{containerId:a}=i,o=a?t.get(a):void 0;o&&r.set(o.id,{container:o,boundText:i})}if(Io(i)){let a=vs(i),o=a?t.get(a):void 0;o&&r.set(i.id,{container:i,boundText:o})}}for(let{container:i,boundText:a}of r.values())i.isDeleted||a.isDeleted||ji(a,i,t,!1)}static redrawBoundArrows(t,n){for(let r of n.values())!r.isDeleted&&fl(r)&&bo(r,t)}static reorderElements(t,n,r){if(!r.containsZindexDifference)return t;let i=Array.from(t.values()),a=aT([...i]);return!r.containsVisibleDifference&&dn.isRightDifferent(i,a,!0)&&(r.containsVisibleDifference=!0),ve(Yi(a,n))}static postProcess(t,n){try{dn.diffArrays(t,n,"boundElements",r=>r.id)}catch(r){if(console.error("Couldn't postprocess elements change deltas."),Ne.DEV||Ne.MODE===xa.TEST)throw r}finally{return[t,n]}}static stripIrrelevantProps(t){let{id:n,updated:r,version:i,versionNonce:a,seed:o,...s}=t;return s}}}),va,ty=M(()=>{"use strict";D(),va=class{subscribers=[];on(...e){let t=e.flat().filter(n=>typeof n=="function");return this.subscribers.push(...t),()=>this.off(t)}once(...e){let t=e.flat().filter(r=>typeof r=="function");t.push(()=>n());let n=this.on(...t);return n}off(...e){let t=e.flat();this.subscribers=this.subscribers.filter(n=>!t.includes(n))}trigger(...e){for(let t of this.subscribers)t(...e);return this}clear(){this.subscribers=[]}}}),h6,pf,uO,Z,hO,kz,m6,ht=M(()=>{"use strict";D(),vi(),Kte(),ae(),vt(),_s(),ty(),te(),h6="__observedAppState",pf=e=>{let t={name:e.name,editingGroupId:e.editingGroupId,viewBackgroundColor:e.viewBackgroundColor,selectedElementIds:e.selectedElementIds,selectedGroupIds:e.selectedGroupIds,editingLinearElementId:e.editingLinearElement?.elementId||null,selectedLinearElementId:e.selectedLinearElement?.elementId||null};return Reflect.defineProperty(t,h6,{value:!0,enumerable:!1}),t},uO=e=>!!Reflect.get(e,h6),Z={CAPTURE:"capture",UPDATE:"update",NONE:"none"},hO=class{constructor(e,t){this.elementsChange=e,this.appStateChange=t}},kz=class{onStoreIncrementEmitter=new va;scheduledActions=new Set;_snapshot=m6.empty();get snapshot(){return this._snapshot}set snapshot(e){this._snapshot=e}shouldCaptureIncrement=()=>{this.scheduleAction(Z.CAPTURE)};shouldUpdateSnapshot=()=>{this.scheduleAction(Z.UPDATE)};scheduleAction=e=>{this.scheduledActions.add(e),this.satisfiesScheduledActionsInvariant()};commit=(e,t)=>{try{this.scheduledActions.has(Z.CAPTURE)?this.captureIncrement(e,t):this.scheduledActions.has(Z.UPDATE)&&this.updateSnapshot(e,t)}finally{this.satisfiesScheduledActionsInvariant(),this.scheduledActions=new Set}};captureIncrement=(e,t)=>{let n=this.snapshot,r=this.snapshot.maybeClone(e,t);if(n!==r){let i=r.meta.didElementsChange?q5.calculate(n.elements,r.elements):q5.empty(),a=r.meta.didAppStateChange?X5.calculate(n.appState,r.appState):X5.empty();(!i.isEmpty()||!a.isEmpty())&&this.onStoreIncrementEmitter.trigger(new hO(i,a)),this.snapshot=r}};updateSnapshot=(e,t)=>{let n=this.snapshot.maybeClone(e,t);this.snapshot!==n&&(this.snapshot=n)};filterUncomittedElements=(e,t)=>{for(let[n,r]of e.entries()){if(!t.get(n))continue;let i=this.snapshot.elements.get(n);i?i.version<r.version&&t.set(n,i):t.delete(n)}return t};clear=()=>{this.snapshot=m6.empty(),this.scheduledActions=new Set};satisfiesScheduledActionsInvariant=()=>{if(!(this.scheduledActions.size>=0&&this.scheduledActions.size<=3)){let e=`There can be at most three store actions scheduled at the same time, but there are "${this.scheduledActions.size}".`;if(console.error(e,this.scheduledActions.values()),Ne.DEV||Ne.MODE===xa.TEST)throw new Error(e)}}},m6=class Q5{constructor(t,n,r={didElementsChange:!1,didAppStateChange:!1,isEmpty:!1}){this.elements=t,this.appState=n,this.meta=r}static empty(){return new Q5(new Map,pf(Ms()),{didElementsChange:!1,didAppStateChange:!1,isEmpty:!0})}isEmpty(){return this.meta.isEmpty}maybeClone(t,n){let r=this.maybeCreateElementsSnapshot(t),i=this.maybeCreateAppStateSnapshot(n),a=!1,o=!1;return this.elements!==r&&(a=!0),this.appState!==i&&(o=!0),!a&&!o?this:new Q5(r,i,{didElementsChange:a,didAppStateChange:o})}maybeCreateAppStateSnapshot(t){if(!t)return this.appState;let n=uO(t)?t:pf(t);return this.detectChangedAppState(n)?n:this.appState}detectChangedAppState(t){return!Bn(this.appState,t,{selectedElementIds:Bn,selectedGroupIds:Bn})}maybeCreateElementsSnapshot(t){return t?this.detectChangedElements(t)?this.createElementsSnapshot(t):this.elements:this.elements}detectChangedElements(t){if(this.elements===t)return!1;if(this.elements.size!==t.size)return!0;let n=Array.from(t.keys());for(let r=n.length-1;r>=0;r--){let i=this.elements.get(n[r]),a=t.get(n[r]);if(!i||!a||i.id!==a.id||i.versionNonce!==a.versionNonce)return!0}return!1}createElementsSnapshot(t){let n=new Map;for(let[r,i]of this.elements.entries())t.get(r)?n.set(r,i):n.set(r,Re(i,{isDeleted:!0}));for(let[r,i]of t.entries()){let a=n.get(r);(!a||a&&a.versionNonce!==i.versionNonce)&&n.set(r,Th(i))}return n}}}),uo,mO,pO,fO,p6,gO,f6,EO,bO,yO,g6,o2,E6,ff,Kc,AT,Xte,s2,Pz,gf,ny=M(()=>{"use strict";D(),Tt(),ae(),te(),S1(),_s(),qt(),Se(),Gh(),ht(),uo=new Map,mO=/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)(?:\?t=|&t=|\?start=|&start=)?([a-zA-Z0-9_-]+)?[^\s]*$/,pO=/^(?:http(?:s)?:\/\/)?(?:(?:w){3}\.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/,fO=/^https:\/\/(?:www\.)?figma\.com/,p6=/^https:\/\/gist\.github\.com\/([\w_-]+)\/([\w_-]+)/,gO=/^<script[\s\S]*?\ssrc=["'](https:\/\/gist\.github\.com\/.*?)\.js["']/i,f6=/(?:https?:\/\/)?(?:(?:w){3}\.)?(?:twitter|x)\.com\/[^/]+\/status\/(\d+)/,EO=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:twitter|x)\.com\/[^"']*)/i,bO=/^https:\/\/(?:www\.)?val\.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/,yO=/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i,g6=/giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/,o2=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","figma.com","link.excalidraw.com","gist.github.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com","val.town","giphy.com"]),E6=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","figma.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com"]),ff=e=>`<html><body>${e}</body></html>`,Kc=e=>{if(!e)return null;if(uo.has(e))return uo.get(e);let t=e,n=E6.has(s2(e,E6)||""),r="generic",i={w:560,h:840},a=e.match(mO);if(a?.[2]){let l=a[3]?`&start=${a[3]}`:"",c=e.includes("shorts");switch(r="video",a[1]){case"embed/":case"watch?v=":case"shorts/":e=`https://www.youtube.com/embed/${a[2]}?enablejsapi=1${l}`;break;case"playlist?list=":case"embed/videoseries?list=":e=`https://www.youtube.com/embed/videoseries?list=${a[2]}&enablejsapi=1${l}`;break;default:e=`https://www.youtube.com/embed/${a[2]}?enablejsapi=1${l}`;break}return i=c?{w:315,h:560}:{w:560,h:315},uo.set(t,{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}}let o=e.match(pO);if(o?.[1]){let l=o?.[1],c=/^\d+$/.test(l)?void 0:new URIError("Invalid embed link format");return r="video",e=`https://player.vimeo.com/video/${l}?api=1`,i={w:560,h:315},uo.set(t,{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:r,error:c,sandbox:{allowSameOrigin:n}}}if(e.match(fO))return r="generic",e=`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(e)}`,i={w:550,h:550},uo.set(t,{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}};let s=e.match(bO);if(s)return e=s[1]==="embed"?s[0]:s[0].replace("/v","/embed"),uo.set(t,{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}};if(f6.test(e)){let l=e.match(f6)[1],c=GE(`https://twitter.com/x/status/${l}`),d={type:"document",srcdoc:u=>ff(`<blockquote class="twitter-tweet" data-dnt="true" data-theme="${u}"><a href="${c}"></a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>`),intrinsicSize:{w:480,h:480},sandbox:{allowSameOrigin:n}};return uo.set(t,d),d}if(p6.test(e)){let[,l,c]=e.match(p6),d=GE(`https://gist.github.com/${l}/${c}`),u={type:"document",srcdoc:()=>ff(`
134
+ <script src="${d}.js"><\/script>
135
+ <style type="text/css">
136
+ * { margin: 0px; }
137
+ table, .gist { height: 100%; }
138
+ .gist .gist-file { height: calc(100vh - 2px); padding: 0px; display: grid; grid-template-rows: 1fr auto; }
139
+ </style>
140
+ `),intrinsicSize:{w:550,h:720},sandbox:{allowSameOrigin:n}};return uo.set(e,u),u}return uo.set(e,{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:r,sandbox:{allowSameOrigin:n}}},AT=e=>{let t;ss(e)?t="IFrame element":t=!e.link||e?.link===""?"Empty Web-Embed":e.link;let n=Math.max(Math.min(e.width/2,e.width/t.length),e.width/30),r=Zn.Helvetica,i=An({fontSize:n,fontFamily:r});return fi({x:e.x+e.width/2,y:e.y+e.height/2,strokeColor:e.strokeColor!=="transparent"?e.strokeColor:"black",backgroundColor:"transparent",fontFamily:r,fontSize:n,text:ah(t,i,e.width-20),textAlign:"center",verticalAlign:Yr.MIDDLE,angle:e.angle??0})},Xte=oe({name:"setEmbeddableAsActiveTool",trackEvent:{category:"toolbar"},target:"Tool",label:"toolBar.embeddable",perform:(e,t,n,r)=>{let i=hn(t,{type:"embeddable"});return Ea(r.canvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:hn(t,{type:"embeddable"})},storeAction:Z.NONE}}}),s2=(e,t)=>{try{let{hostname:n}=new URL(e),r=n.replace(/^www\./,"");if(t instanceof Set){if(o2.has(r))return r;let a=r.replace(/^([^.]+)/,"*");return o2.has(a)?a:null}let i=t.replace(/^www\./,"");if(r===i)return i}catch{}return null},Pz=e=>{let t=e.match(EO);if(t&&t.length===2)return t[1];let n=e.match(gO);if(n&&n.length===2)return n[1];if(g6.test(e))return`https://giphy.com/embed/${g6.exec(e)[1]}`;let r=e.match(yO);return r&&r.length===2?r[1]:e},gf=(e,t)=>{if(!e)return!1;if(t!=null)if(typeof t=="function"){let n=t(e);if(typeof n=="boolean")return n}else{if(typeof t=="boolean")return t;if(t instanceof RegExp)return t.test(e);if(Array.isArray(t)){for(let n of t)if(n instanceof RegExp){if(e.match(n))return!0}else if(s2(e,n))return!0;return!1}}return!!s2(e,o2)}}),Tu,Iu,Tp,Dz,qte=M(()=>{"use strict";D(),ae(),Gh(),Oe(),ny(),yr(),qt(),Se(),Lr(),rr(),Ls(),te(),Ds(),Tu=(e,t,n)=>{if(typeof n>"u")return e.draw(t);let r={sets:t.sets,shape:t.shape,options:{...t.options,fixedDecimalPlaceDigits:n}};return e.draw(r)},Iu=(e,t,n,r,i)=>{if(!r.enabled||!r.clip)return null;let a=Zr(e,i);if(a){let o=t.ownerDocument.createElementNS(Pt,"g");return o.setAttributeNS(Pt,"clip-path",`url(#${a.id})`),n.forEach(s=>o.appendChild(s)),o}return null},Tp=(e,t,n,r,i,a,o,s)=>{let l={x:a,y:o},[c,d,u,h]=De(e,t),m=(u-c)/2-(e.x-c),p=(h-d)/2-(e.y-d);if(he(e)){let y=Er(e,t);if(Et(y)){let[w,C,A,T]=De(y,t),I=fe.getBoundTextElementPosition(y,e,t);m=(A-w)/2-(I.x-w),p=(T-C)/2-(I.y-C),a=a+I.x-e.x,o=o+I.y-e.y}}let f=180*e.angle/Math.PI,g=r;if(e.link){let y=r.ownerDocument.createElementNS(Pt,"a");y.setAttribute("href",Da(e.link)),g.appendChild(y),g=y}let b=(y,w)=>{$l()&&y.setAttribute("data-id",w.id),g.appendChild(y)},v=(Zr(e,t)?.opacity??100)*e.opacity/1e4;switch(e.type){case"selection":throw new Error("Selection rendering is not supported for SVG");case"rectangle":case"diamond":case"ellipse":{let y=Xt.generateElementShape(e,null),w=Tu(n,y,Bu);v!==1&&(w.setAttribute("stroke-opacity",`${v}`),w.setAttribute("fill-opacity",`${v}`)),w.setAttribute("stroke-linecap","round"),w.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`);let C=Iu(e,g,[w],s.frameRendering,t);b(C||w,e);break}case"iframe":case"embeddable":{let y=Xt.generateElementShape(e,s),w=Tu(n,y,Bu),C=e.opacity/100;C!==1&&(w.setAttribute("stroke-opacity",`${C}`),w.setAttribute("fill-opacity",`${C}`)),w.setAttribute("stroke-linecap","round"),w.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`),b(w,e);let A=AT(e);Tp(A,t,n,g,i,A.x+l.x-e.x,A.y+l.y-e.y,s);let T=Tu(n,y,Bu);for(T.setAttribute("stroke-linecap","round"),T.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`);T.firstChild;)T.removeChild(T.firstChild);let I=Ol(Math.min(e.width,e.height),e),k=Kc(ST(e.link||""));if(s.renderEmbeddables===!1||k?.type==="document"){let R=r.ownerDocument.createElementNS(Pt,"a");R.setAttribute("href",Da(e.link||"")),R.setAttribute("target","_blank"),R.setAttribute("rel","noopener noreferrer"),R.style.borderRadius=`${I}px`,T.appendChild(R)}else{let R=r.ownerDocument.createElementNS(Pt,"foreignObject");R.style.width=`${e.width}px`,R.style.height=`${e.height}px`,R.style.border="none";let O=R.ownerDocument.createElementNS(Pt,"div");O.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),O.style.width="100%",O.style.height="100%";let P=O.ownerDocument.createElement("iframe");P.src=k?.link??"",P.style.width="100%",P.style.height="100%",P.style.border="none",P.style.borderRadius=`${I}px`,P.style.top="0",P.style.left="0",P.allowFullscreen=!0,O.appendChild(P),R.appendChild(O),T.appendChild(R)}b(T,e);break}case"line":case"arrow":{let y=Ye(e,t),w=r.ownerDocument.createElementNS(Pt,"mask");if(y){w.setAttribute("id",`mask-${e.id}`);let T=r.ownerDocument.createElementNS(Pt,"rect");a=a||0,o=o||0,T.setAttribute("x","0"),T.setAttribute("y","0"),T.setAttribute("fill","#fff"),T.setAttribute("width",`${e.width+100+a}`),T.setAttribute("height",`${e.height+100+o}`),w.appendChild(T);let I=r.ownerDocument.createElementNS(Pt,"rect"),k=fe.getBoundTextElementPosition(e,y,t),R=a+k.x-e.x,O=o+k.y-e.y;I.setAttribute("x",R.toString()),I.setAttribute("y",O.toString()),I.setAttribute("fill","#000"),I.setAttribute("width",`${y.width}`),I.setAttribute("height",`${y.height}`),I.setAttribute("opacity","1"),w.appendChild(I)}let C=r.ownerDocument.createElementNS(Pt,"g");y&&C.setAttribute("mask",`url(#mask-${e.id})`),C.setAttribute("stroke-linecap","round"),Xt.generateElementShape(e,s).forEach(T=>{let I=Tu(n,T,Bu);v!==1&&(I.setAttribute("stroke-opacity",`${v}`),I.setAttribute("fill-opacity",`${v}`)),I.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`),e.type==="line"&&Mo(e.points)&&e.backgroundColor!=="transparent"&&I.setAttribute("fill-rule","evenodd"),C.appendChild(I)});let A=Iu(e,g,[C,w],s.frameRendering,t);A?(b(A,e),g.appendChild(A)):(b(C,e),g.append(w));break}case"freedraw":{let y=Xt.generateElementShape(e,s),w=y?Tu(n,y,Bu):r.ownerDocument.createElementNS(Pt,"g");v!==1&&(w.setAttribute("stroke-opacity",`${v}`),w.setAttribute("fill-opacity",`${v}`)),w.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`),w.setAttribute("stroke","none");let C=r.ownerDocument.createElementNS(Pt,"path");C.setAttribute("fill",e.strokeColor),C.setAttribute("d",SH(e)),w.appendChild(C);let A=Iu(e,g,[w],s.frameRendering,t);b(A||w,e);break}case"image":{let y=Math.round(e.width),w=Math.round(e.height),C=Ma(e)&&i[e.fileId];if(C){let A=`image-${C.id}`,T=r.querySelector(`#${A}`);if(!T){T=r.ownerDocument.createElementNS(Pt,"symbol"),T.id=A;let O=r.ownerDocument.createElementNS(Pt,"image");O.setAttribute("width","100%"),O.setAttribute("height","100%"),O.setAttribute("href",C.dataURL),T.appendChild(O),g.prepend(T)}let I=r.ownerDocument.createElementNS(Pt,"use");if(I.setAttribute("href",`#${A}`),s.exportWithDarkMode&&C.mimeType!==we.svg&&I.setAttribute("filter",v4),I.setAttribute("width",`${y}`),I.setAttribute("height",`${w}`),I.setAttribute("opacity",`${v}`),e.scale[0]!==1||e.scale[1]!==1){let O=e.scale[0]!==1?-y:0,P=e.scale[1]!==1?-w:0;I.setAttribute("transform",`scale(${e.scale[0]}, ${e.scale[1]}) translate(${O} ${P})`)}let k=r.ownerDocument.createElementNS(Pt,"g");if(k.appendChild(I),k.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`),e.roundness){let O=r.ownerDocument.createElementNS(Pt,"clipPath");O.id=`image-clipPath-${e.id}`;let P=r.ownerDocument.createElementNS(Pt,"rect"),F=Ol(Math.min(e.width,e.height),e);P.setAttribute("width",`${e.width}`),P.setAttribute("height",`${e.height}`),P.setAttribute("rx",`${F}`),P.setAttribute("ry",`${F}`),O.appendChild(P),b(O,e),k.setAttributeNS(Pt,"clip-path",`url(#${O.id})`)}let R=Iu(e,g,[k],s.frameRendering,t);b(R||k,e)}break}case"frame":case"magicframe":{if(s.frameRendering.enabled&&s.frameRendering.outline){let y=document.createElementNS(Pt,"rect");y.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`),y.setAttribute("width",`${e.width}px`),y.setAttribute("height",`${e.height}px`),y.setAttribute("rx",Kt.radius.toString()),y.setAttribute("ry",Kt.radius.toString()),y.setAttribute("fill","none"),y.setAttribute("stroke",Kt.strokeColor),y.setAttribute("stroke-width",Kt.strokeWidth.toString()),b(y,e)}break}default:if(he(e)){let y=r.ownerDocument.createElementNS(Pt,"g");v!==1&&(y.setAttribute("stroke-opacity",`${v}`),y.setAttribute("fill-opacity",`${v}`)),y.setAttribute("transform",`translate(${a||0} ${o||0}) rotate(${f} ${m} ${p})`);let w=e.text.replace(/\r\n?/g,`
141
+ `).split(`
142
+ `),C=ih(e.fontSize,e.lineHeight),A=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,T=gT(e.fontFamily,e.fontSize,C),I=JC(e.text)?"rtl":"ltr",k=e.textAlign==="center"?"middle":e.textAlign==="right"||I==="rtl"?"end":"start";for(let O=0;O<w.length;O++){let P=r.ownerDocument.createElementNS(Pt,"text");P.textContent=w[O],P.setAttribute("x",`${A}`),P.setAttribute("y",`${O*C+T}`),P.setAttribute("font-family",kf(e)),P.setAttribute("font-size",`${e.fontSize}px`),P.setAttribute("fill",e.strokeColor),P.setAttribute("text-anchor",k),P.setAttribute("style","white-space: pre;"),P.setAttribute("direction",I),P.setAttribute("dominant-baseline","alphabetic"),y.appendChild(P)}let R=Iu(e,g,[y],s.frameRendering,t);b(R||y,e)}else throw new Error(`Unimplemented type ${e.type}`)}},Dz=(e,t,n,r,i,a)=>{r&&(e.filter(o=>!mi(o)).forEach(o=>{if(!o.isDeleted){if(he(o)&&o.containerId&&t.has(o.containerId))return;try{Tp(o,t,n,r,i,o.x+a.offsetX,o.y+a.offsetY,a);let s=Ye(o,t);s&&Tp(s,t,n,r,i,s.x+a.offsetX,s.y+a.offsetY,a)}catch(s){console.error(s)}}}),e.filter(o=>mi(o)).forEach(o=>{if(!o.isDeleted)try{Tp(o,t,n,r,i,o.x+a.offsetX,o.y+a.offsetY,a)}catch(s){console.error(s)}}))}}),b6,ry,$f,Wl=M(()=>{"use strict";D(),ae(),bd(),te(),b6=500,ry=e=>{let t=e.extensions?.reduce((r,i)=>(r.push(we[i]),r),[]),n=e.extensions?.reduce((r,i)=>i==="jpg"?r.concat(".jpg",".jpeg"):r.concat(`.${i}`),[]);return og({description:e.description,extensions:n,mimeTypes:t,multiple:e.multiple??!1,legacySetup:(r,i,a)=>{let o=Pf(i,b6),s=()=>{l(),document.addEventListener("keyup",o),document.addEventListener("pointerup",o),o()},l=()=>{if(a.files?.length){let d=e.multiple?[...a.files]:a.files[0];r(d)}};requestAnimationFrame(()=>{window.addEventListener("focus",s)});let c=window.setInterval(()=>{l()},b6);return d=>{clearInterval(c),o.cancel(),window.removeEventListener("focus",s),document.removeEventListener("keyup",o),document.removeEventListener("pointerup",o),d&&(console.warn("Opening the file was canceled (legacy-fs)."),d(new w1))}}})},$f=(e,t)=>sg(e,{fileName:`${t.name}.${t.extension}`,description:t.description,extensions:[`.${t.extension}`]},t.fileHandle)}),vO,xO,y6,Pc,wO,SO,CO,TO,sE,IO,v6,J5,iy,x6,Ef,jh=M(()=>{"use strict";D(),Oe(),Se(),Ao(),ae(),vi(),yr(),vt(),te(),te(),qt(),Gh(),$a(),vO={selection:!0,text:!0,rectangle:!0,diamond:!0,ellipse:!0,line:!0,image:!0,arrow:!0,freedraw:!0,eraser:!1,custom:!0,frame:!0,embeddable:!0,hand:!0,laser:!1,magicframe:!1},xO=e=>Object.keys(Zn).includes(e)?Zn[e]:To,y6=e=>e?{...e,focus:e.focus||0}:null,Pc=(e,t)=>{let n={type:t.type||e.type,version:e.version||1,versionNonce:e.versionNonce??0,index:e.index??null,isDeleted:e.isDeleted??!1,id:e.id||pi(),fillStyle:e.fillStyle||Zt.fillStyle,strokeWidth:e.strokeWidth||Zt.strokeWidth,strokeStyle:e.strokeStyle??Zt.strokeStyle,roughness:e.roughness??Zt.roughness,opacity:e.opacity==null?Zt.opacity:e.opacity,angle:e.angle||0,x:t.x??e.x??0,y:t.y??e.y??0,strokeColor:e.strokeColor||Zt.strokeColor,backgroundColor:e.backgroundColor||Zt.backgroundColor,width:e.width||0,height:e.height||0,seed:e.seed??1,groupIds:e.groupIds??[],frameId:e.frameId??null,roundness:e.roundness?e.roundness:e.strokeSharpness==="round"?{type:id(e.type)?Fn.LEGACY:Fn.PROPORTIONAL_RADIUS}:null,boundElements:e.boundElementIds?e.boundElementIds.map(r=>({type:"arrow",id:r})):e.boundElements??[],updated:e.updated??rd(),link:e.link?Da(e.link):null,locked:e.locked??!1};return("customData"in e||"customData"in t)&&(n.customData="customData"in t?t.customData:e.customData),{...n,...XT(n),...t}},wO=e=>{switch(e.type){case"text":let t=e.fontSize,n=e.fontFamily;if("font"in e){let[a,o]=e.font.split(" ");t=parseFloat(a),n=xO(o)}let r=typeof e.text=="string"&&e.text||"",i=e.lineHeight||(e.height?lz(e):Fl(e.fontFamily));return e=Pc(e,{fontSize:t,fontFamily:n,text:r,textAlign:e.textAlign||v1,verticalAlign:e.verticalAlign||Mf,containerId:e.containerId??null,originalText:e.originalText||r,lineHeight:i}),!r&&!e.isDeleted&&(e={...e,originalText:r,isDeleted:!0},e=Uf(e)),e;case"freedraw":return Pc(e,{points:e.points,lastCommittedPoint:null,simulatePressure:e.simulatePressure,pressures:e.pressures});case"image":return Pc(e,{status:e.status||"pending",fileId:e.fileId,scale:e.scale||[1,1]});case"line":case"draw":case"arrow":{let{startArrowhead:a=null,endArrowhead:o=e.type==="arrow"?"arrow":null}=e,s=e.x,l=e.y,c=!Array.isArray(e.points)||e.points.length<2?[[0,0],[e.width,e.height]]:e.points;return(c[0][0]!==0||c[0][1]!==0)&&({points:c,x:s,y:l}=fe.getNormalizedPoints(e)),Pc(e,{type:e.type==="draw"?"line":e.type,startBinding:y6(e.startBinding),endBinding:y6(e.endBinding),lastCommittedPoint:null,startArrowhead:a,endArrowhead:o,points:c,x:s,y:l})}case"ellipse":case"rectangle":case"diamond":case"iframe":case"embeddable":return Pc(e,{});case"magicframe":case"frame":return Pc(e,{name:e.name??null})}return null},SO=(e,t)=>{if(e.boundElements){let n=e.boundElements.slice(),r=new Set;e.boundElements=n.reduce((i,a)=>{let o=t.get(a.id);if(o&&!r.has(a.id)){if(r.add(a.id),o.isDeleted)return i;i.push(a),he(o)&&!o.containerId&&(o.containerId=e.id)}return i},[])}},CO=(e,t)=>{let n=e.containerId?t.get(e.containerId):null;if(!n){e.containerId=null;return}if(!e.isDeleted&&n.boundElements&&!n.boundElements.find(r=>r.id===e.id)){let r=(n.boundElements||(n.boundElements=[])).slice();r.push({type:"text",id:e.id}),n.boundElements=r}},TO=(e,t)=>{e.frameId&&(t.get(e.frameId)||(e.frameId=null))},sE=(e,t,n)=>{let r=new Set,i=t?ve(t):null,a=wo((e||[]).reduce((s,l)=>{if(l.type!=="selection"&&!pd(l)){let c=wO(l);if(c){let d=i?.get(l.id);d&&d.version>c.version&&(c=Uf(c,d.version)),r.has(c.id)&&(c={...c,id:pi()}),r.add(c.id),s.push(c)}}return s},[]));if(!n?.repairBindings)return a;let o=ve(a);for(let s of a)s.frameId&&TO(s,o),he(s)&&s.containerId?CO(s,o):s.boundElements&&SO(s,o),n.refreshDimensions&&he(s)&&Object.assign(s,WE(s,Er(s,o),o));return a},IO=(e,t,n)=>{let r=t[e];return r!==void 0?r:n[e]},v6={isSidebarDocked:(e,t)=>["defaultSidebarDockedPreference",e.isSidebarDocked??IO("defaultSidebarDockedPreference",e,t)]},J5=(e,t)=>{e=e||{};let n=Ms(),r={};for(let i of Object.keys(v6))if(i in e){let[a,o]=v6[i](e,n);r[a]=o}for(let[i,a]of Object.entries(n)){let o=e[i],s=t?t[i]:void 0;r[i]=o!==void 0?o:s!==void 0?s:a}return{...r,cursorButton:t?.cursorButton||"up",penDetected:t?.penDetected??(e.penMode?e.penDetected??!1:!1),activeTool:{...hn(n,r.activeTool.type&&vO[r.activeTool.type]?r.activeTool:{type:"selection"}),lastActiveTool:null,locked:r.activeTool.locked??!1},zoom:typeof e.zoom=="number"?{value:e.zoom}:e.zoom?.value?e.zoom:n.zoom,openSidebar:typeof e.openSidebar=="string"?{name:Ss.name}:r.openSidebar}},iy=(e,t,n,r)=>({elements:sE(e?.elements,n,r),appState:J5(e?.appState,t||null),files:e?.files||{}}),x6=e=>{let t=sE(ut(e.elements),null);return t.length?{...e,elements:t}:null},Ef=(e=[],t)=>{let n=[];for(let r of e)if(Array.isArray(r)){let i=x6({status:t,elements:r,id:pi(),created:Date.now()});i&&n.push(i)}else{let i=r,a=x6({...i,id:i.id||pi(),status:i.status||t,created:i.created||Date.now()});a&&n.push(a)}return n}}),Qte=M(()=>{"use strict";D(),ae(),yi()}),l2,w6,S6,_z,Lz,e4,t4,Jte=M(()=>{"use strict";D(),Qte(),l2=e=>new Promise((t,n)=>{let r=typeof e=="string"?new Blob([new TextEncoder().encode(e)]):new Blob([e instanceof Uint8Array?e:new Uint8Array(e)]),i=new FileReader;i.onload=a=>{if(!a.target||typeof a.target.result!="string")return n(new Error("couldn't convert to byte string"));t(a.target.result)},i.readAsBinaryString(r)}),w6=e=>{let t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let r=0,i=e.length;r<i;r++)n[r]=e.charCodeAt(r);return t},S6=e=>new TextDecoder("utf-8").decode(w6(e)),_z=async(e,t=!1)=>t?window.btoa(e):window.btoa(await l2(e)),Lz=async(e,t=!1)=>t?window.atob(e):S6(window.atob(e)),e4=async({text:e,compress:t})=>{let n;if(t!==!1)try{n=await l2((0,ay.deflate)(e))}catch(r){console.error("encode: cannot deflate",r)}return{version:"1",encoding:"bstring",compressed:!!n,encoded:n||await l2(e)}},t4=async e=>{let t;switch(e.encoding){case"bstring":t=e.compressed?e.encoded:await S6(e.encoded);break;default:throw new Error(`decode: unknown encoding "${e.encoding}"`)}return e.compressed?(0,ay.inflate)(new Uint8Array(w6(t)),{to:"string"}):t}}),Ff={};y1(Ff,{decodePngMetadata:()=>Oz,decodeSvgMetadata:()=>$z,encodePngMetadata:()=>kT,encodeSvgMetadata:()=>Nz,getTEXtChunk:()=>i4});var i4,kT,Oz,Nz,$z,Bf=M(()=>{"use strict";D(),Jte(),ae(),yi(),i4=async e=>{let t=(0,n4.default)(new Uint8Array(await El(e))).find(n=>n.name==="tEXt");return t?r4.default.decode(t.data):null},kT=async({blob:e,metadata:t})=>{let n=(0,n4.default)(new Uint8Array(await El(e))),r=r4.default.encode(we.excalidraw,JSON.stringify(await e4({text:t,compress:!0})));return n.splice(-1,0,r),new Blob([(0,Rz.default)(n)],{type:we.png})},Oz=async e=>{let t=await i4(e);if(t?.keyword===we.excalidraw)try{let n=JSON.parse(t.text);if(!("encoded"in n)){if("type"in n&&n.type===hi.excalidraw)return t.text;throw new Error("FAILED")}return await t4(n)}catch(n){throw console.error(n),new Error("FAILED")}throw new Error("INVALID")},Nz=async({text:e})=>{let t=await _z(JSON.stringify(await e4({text:e})),!0),n="";return n+=`<!-- payload-type:${we.excalidraw} -->`,n+="<!-- payload-version:2 -->",n+="<!-- payload-start -->",n+=t,n+="<!-- payload-end -->",n},$z=async({svg:e})=>{if(e.includes(`payload-type:${we.excalidraw}`)){let t=e.match(/<!-- payload-start -->\s*(.+?)\s*<!-- payload-end -->/);if(!t)throw new Error("INVALID");let n=(e.match(/<!-- payload-version:(\d+) -->/)?.[1]||"1")!=="1";try{let r=await Lz(t[1],n),i=JSON.parse(r);if(!("encoded"in i)){if("type"in i&&i.type===hi.excalidraw)return r;throw new Error("FAILED")}return await t4(i)}catch(r){throw console.error(r),new Error("FAILED")}}throw new Error("INVALID")}}),C6,a4,Fz,oy,vl,o4,PT,s4,Bz,Ih,zz,lE,Hz,VE,l4,Uz,Gz,MO,T6,Ip,YE,El,yi=M(()=>{"use strict";D(),vi(),ae(),Oe(),bd(),It(),te(),Wl(),Bl(),jh(),C6=async e=>{let t;if(e.type===we.png)try{return await(await Promise.resolve().then(()=>(Bf(),Ff))).decodePngMetadata(e)}catch(n){throw n.message==="INVALID"?new gl("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):new gl("Error: cannot restore image")}else if("text"in Blob?t=await e.text():t=await new Promise(n=>{let r=new FileReader;r.readAsText(e,"utf8"),r.onloadend=()=>{r.readyState===FileReader.DONE&&n(r.result)}}),e.type===we.svg)try{return await(await Promise.resolve().then(()=>(Bf(),Ff))).decodeSvgMetadata({svg:t})}catch(n){throw n.message==="INVALID"?new gl("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):new gl("Error: cannot restore image")}return t},a4=e=>e&&e.name.match(/\.(json|excalidraw|png|svg)$/)?.[1]||null,Fz=e=>e==="png"||e==="svg",oy=e=>{let t=a4(e);return t==="png"||t==="svg"},vl=e=>{let{type:t}=e||{};return!!t&&Object.values(kE).includes(t)},o4=async(e,t,n,r)=>{let i=await C6(e),a;try{try{a=JSON.parse(i)}catch(o){throw vl(e)?new gl("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):o}if(Wz(a))return{type:we.excalidraw,data:iy({elements:JT(a.elements||[]),appState:{theme:t?.theme,fileHandle:r||e.handle||null,...yT(a.appState||{}),...t?Ph(a.elements||[],t):{}},files:a.files},t,n,{repairBindings:!0,refreshDimensions:!1})};if(d4(a))return{type:we.excalidrawlib,data:a};throw new Error("Error: invalid file")}catch(o){throw o instanceof gl?o:new Error("Error: invalid file")}},PT=async(e,t,n,r)=>{let i=await o4(e,t,n,r);if(i.type!==we.excalidraw)throw new Error("Error: invalid file");return i.data},s4=(e,t="unpublished")=>{let n=JSON.parse(e);if(!d4(n))throw new Error("Invalid library");let r=n.libraryItems||n.library;return Ef(r,t)},Bz=async(e,t="unpublished")=>s4(await C6(e),t),Ih=async e=>new Promise(async(t,n)=>{try{Uh(e)&&(e=await e),e.toBlob(r=>{if(!r)return n(new PB("Error: Canvas too big","CANVAS_POSSIBLY_TOO_BIG"));t(r)})}catch(r){n(r)}}),zz=async e=>{try{let t=await window.crypto.subtle.digest("SHA-1",await El(e));return wB(new Uint8Array(t))}catch(t){return console.error(t),Ka(40)}},lE=async e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let i=r.result;t(i)},r.onerror=i=>n(i),r.readAsDataURL(e)}),Hz=(e,t="")=>{let n=e.indexOf(","),r=atob(e.slice(n+1)),i=e.slice(0,n).split(":")[1].split(";")[0],a=new ArrayBuffer(r.length),o=new Uint8Array(a);for(let s=0;s<r.length;s++)o[s]=r.charCodeAt(s);return new File([a],t,{type:i})},VE=async(e,t)=>{if(e.type===we.svg)return e;let[n,r]=await Promise.all([import("./pica-ABPXE5C5.js").then(a=>a.default),import("./image-blob-reduce.esm-GOFU5DPX.js").then(a=>a.default)]),i=r({pica:n({features:["js","wasm"]})});if(t.outputType){let{outputType:a}=t;i._create_blob=function(o){return this.pica.toBlob(o.out_canvas,a,.8).then(s=>(o.out_blob=s,o))}}if(!vl(e))throw new Error("Error: unsupported file type",{cause:"UNSUPPORTED"});return new File([await i.toBlob(e,{max:t.maxWidthOrHeight})],e.name,{type:t.outputType||e.type})},l4=(e,t="")=>new File([new TextEncoder().encode(e)],t,{type:we.svg}),Uz=async(e,t="")=>{let n;try{n=await fetch(e)}catch{throw new Error("Error: failed to fetch image",{cause:"FETCH_ERROR"})}if(!n.ok)throw new Error("Error: failed to fetch image",{cause:"FETCH_ERROR"});let r=await n.blob();if(r.type&&vl(r)){let i=t||r.name||"";return new File([r],i,{type:r.type})}throw new Error("Error: unsupported file type",{cause:"UNSUPPORTED"})},Gz=async e=>{let t=e.dataTransfer.files.item(0),n=await MO(e);return{file:t?await YE(t):null,fileHandle:n}},MO=async e=>{if(da)try{return await e.dataTransfer.items[0].getAsFileSystemHandle()||null}catch(t){return console.warn(t.name,t.message),null}return null},T6=e=>{let t=null,n=`${[...new Uint8Array(e).slice(0,8)].join(" ")} `,r={png:"137 80 78 71 13 10 26 10 ",jpg:"255 216 255 ",gif:"71 73 70 56 57 97 "};return n===r.png?t=we.png:n.startsWith(r.jpg)?t=we.jpg:n.startsWith(r.gif)&&(t=we.gif),t},Ip=(e,t,n)=>new File([e],n||"",{type:t}),YE=async e=>{if(e.type){if(vl(e)){let t=await El(e),n=T6(t);n&&n!==e.type&&(e=Ip(t,n,e.name))}}else if(e?.name?.endsWith(".excalidrawlib"))e=Ip(await El(e),we.excalidrawlib,e.name);else if(e?.name?.endsWith(".excalidraw"))e=Ip(await El(e),we.excalidraw,e.name);else{let t=await El(e),n=T6(t);n&&(e=Ip(t,n,e.name))}return e},El=e=>"arrayBuffer"in e?e.arrayBuffer():new Promise((t,n)=>{let r=new FileReader;r.onload=i=>{if(!i.target?.result)return n(new Error("Couldn't convert blob to ArrayBuffer"));t(i.target.result)},r.readAsArrayBuffer(e)})}),AO,zf,c4,jz,Wz,d4,u4,Vz,Bl=M(()=>{"use strict";D(),Wl(),vi(),ae(),Oe(),yi(),AO=(e,t)=>{let n={};for(let r of e)!r.isDeleted&&"fileId"in r&&r.fileId&&t[r.fileId]&&(n[r.fileId]=t[r.fileId]);return n},zf=(e,t,n,r)=>{let i={type:hi.excalidraw,version:Af.excalidraw,source:PE,elements:r==="local"?JT(e):$H(e),appState:r==="local"?yT(t):Ez(t),files:r==="local"?AO(e,n):void 0};return JSON.stringify(i,null,2)},c4=async(e,t,n,r=t.name||qC)=>{let i=zf(e,t,n,"local"),a=new Blob([i],{type:we.excalidraw});return{fileHandle:await $f(a,{name:r,extension:"excalidraw",description:"Excalidraw file",fileHandle:oy(t.fileHandle)?null:t.fileHandle})}},jz=async(e,t)=>{let n=await ry({description:"Excalidraw files"});return PT(await YE(n),e,t,n.handle)},Wz=e=>e?.type===hi.excalidraw&&(!e.elements||Array.isArray(e.elements)&&(!e.appState||typeof e.appState=="object")),d4=e=>typeof e=="object"&&e&&e.type===hi.excalidrawLibrary&&(e.version===1||e.version===2),u4=e=>{let t={type:hi.excalidrawLibrary,version:Af.excalidrawLibrary,source:PE,libraryItems:e};return JSON.stringify(t,null,2)},Vz=async e=>{let t=u4(e);await $f(new Blob([t],{type:we.excalidrawlib}),{name:"library",extension:"excalidrawlib",description:"Excalidraw library file"})}}),h4,DT,_T,kO,Yz,Zz=M(()=>{"use strict";D(),ae(),Se(),h4=e=>new Promise((t,n)=>{let r=new Image;r.onload=()=>{t(r)},r.onerror=i=>{n(i)},r.src=e}),DT=async({fileIds:e,files:t,imageCache:n})=>{let r=new Map,i=new Map;return await Promise.all(e.reduce((a,o)=>{let s=t[o];return s&&!r.has(o)?(r.set(o,!0),a.concat((async()=>{try{if(s.mimeType===we.binary)throw new Error("Only images can be added to ImageCache");let l=h4(s.dataURL),c={image:l,mimeType:s.mimeType};n.set(o,c);let d=await l;n.set(o,{...c,image:d})}catch{i.set(o,!0)}})())):a},[])),{imageCache:n,updatedFiles:r,erroredFiles:i}},_T=e=>e.filter(t=>Ma(t)),kO=e=>e?.nodeName.toLowerCase()==="svg",Yz=async e=>{let t=new DOMParser().parseFromString(e,we.svg),n=t.querySelector("svg");if(t.querySelector("parsererror")||!kO(n))throw new Error("Invalid SVG");if(n.hasAttribute("xmlns")||n.setAttribute("xmlns",Pt),!n.hasAttribute("width")||!n.hasAttribute("height")){let r=n.getAttribute("viewBox"),i=n.getAttribute("width")||"50",a=n.getAttribute("height")||"50";if(r){let o=r.match(/\d+ +\d+ +(\d+) +(\d+)/);o&&([,i,a]=o)}n.setAttribute("width",i),n.setAttribute("height",a)}return n.outerHTML}}),LT,Kz,Xz,I6,qz,PO,Qz,Jz,eH=M(()=>{"use strict";D(),Oe(),cT(),LT=e=>{let{angle:t,width:n,height:r,x:i,y:a}=e,o=us(t),s=i+n/2,l=a+r/2,c=[s,l],d=[];return e.type==="diamond"?d=[En([s,a],o,c),En([i+n,l],o,c),En([s,a+r],o,c),En([i,l],o,c)]:d=[En([i,a],o,c),En([i+n,a],o,c),En([i+n,a+r],o,c),En([i,a+r],o,c)],{type:"polygon",data:d}},Kz=(e,t,n=10)=>{let[r,i,a,o,s,l]=De(e,t,!0);r-=n,a+=n,i-=n,o+=n;let c=us(e.angle),d=[s,l],u=En([r,i],c,d),h=En([a,i],c,d),m=En([r,o],c,d),p=En([a,o],c,d);return{type:"polygon",data:[u,h,p,m]}},Xz=e=>{let{width:t,height:n,angle:r,x:i,y:a}=e;return{type:"ellipse",data:{center:[i+t/2,a+n/2],angle:r,halfWidth:t/2,halfHeight:n/2}}},I6=e=>{for(let t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},qz=(e,t=[0,0],n,r)=>{let i=l=>En([l[0]+t[0],l[1]+t[1]],us(n),r),a=I6(e),o=[],s=[0,0];for(let l of a)if(l.op==="move"&&(s=i(l.data)),l.op==="bcurveTo"){let c=i([l.data[0],l.data[1]]),d=i([l.data[2],l.data[3]]),u=i([l.data[4],l.data[5]]);o.push([s,c,d,u]),s=u}return{type:"polycurve",data:o}},PO=e=>{let t=e[0],n=[];for(let r=1;r<e.length;r++){let i=e[r];n.push([t,i]),t=i}return n},Qz=(e,t,n=!1)=>{let r=us(e.angle),i=o=>En(F5(o,[e.x,e.y]),r,t),a=PO(e.points.map(o=>i(o)));return n?{type:"polygon",data:Lf(a.flat())}:{type:"polyline",data:a}},Jz=(e,t,n=[0,0],r,i)=>{let a=c=>En([c[0]+n[0],c[1]+n[1]],us(r),i);if(e.roundness===null)return{type:"polygon",data:Lf(e.points.map(c=>a(c)))};let o=I6(t),s=[],l=!1;for(let c of o)c.op==="move"?(l=!l,l&&s.push([c.data[0],c.data[1]])):c.op==="bcurveTo"?l&&(s.push([c.data[0],c.data[1]]),s.push([c.data[2],c.data[3]]),s.push([c.data[4],c.data[5]])):c.op==="lineTo"&&l&&s.push([c.data[0],c.data[1]]);return{type:"polygon",data:rD(s,10,5).map(c=>a(c))}}}),ZE,Gc,KE,tH,nH,RT=M(()=>{"use strict";D(),rr(),Qt(),eH(),dT(),te(),Se(),ZE=e=>{if(e.type==="arrow")return!1;let t=!Sa(e.backgroundColor)||Io(e)||mi(e)||he(e);return e.type==="line"||e.type==="freedraw"?t&&Mo(e.points):t||Ll(e)},Gc=({x:e,y:t,element:n,shape:r,threshold:i=10,frameNameBound:a=null})=>{let o=ZE(n)?cf([e,t],r)||BE([e,t],r,i):BE([e,t],r,i);return!o&&a&&(o=cf([e,t],{type:"polygon",data:LT(a).data})),o},KE=(e,t,n,r,i=0)=>{let[a,o,s,l]=xs(n,r);return a-=i,o-=i,s+=i,l+=i,sT([a,o],[e,t],[s,l])},tH=(e,t)=>!Gc(e)&&KE(e.x,e.y,e.element,t),nH=(e,t,n)=>n&&cf([e,t],n)}),m4,XE,p4,cE,OT=M(()=>{"use strict";D(),ae(),Qt(),RT(),rr(),Ds(),m4=document.createElement("img"),m4.src=`data:${we.svg}, ${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1971c2" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>')}`,XE=([e,t,n,r],i,a)=>{let o=CH,s=o/a.zoom.value,l=o/a.zoom.value,c=o/a.zoom.value,d=(e+n)/2,u=(t+r)/2,h=(o-8)/(2*a.zoom.value),m=4/a.zoom.value,p=n+m-h,f=t-m-c+h,[g,b]=Ve(p+s/2,f+l/2,d,u,i);return[g-s/2,b-l/2,s,l]},p4=(e,t,n,[r,i])=>{let a=4/n.zoom.value,[o,s,l,c]=De(e,t),[d,u,h,m]=XE([o,s,l,c],e.angle,n);return r>d-a&&r<d+a+h&&i>u-a&&i<u+m+a},cE=(e,t,n,[r,i],a)=>!e.link||n.selectedElementIds[e.id]?!1:!a&&n.viewModeEnabled&&KE(r,i,e,t)?!0:p4(e,t,n,[r,i])}),Zp,NT,$T,rH=M(()=>{"use strict";D(),ae(),Zp=(e,t,n,r,i=!0)=>{e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill(),i&&e.stroke()},NT=(e,t)=>[e.width/t,e.height/t],$T=({canvas:e,scale:t,normalizedWidth:n,normalizedHeight:r,theme:i,isExporting:a,canvasBackgroundColor:o})=>{let s=e.getContext("2d");return s.setTransform(1,0,0,1,0,0),s.scale(t,t),a&&i===ze.DARK&&(s.filter=Zb),typeof o=="string"?((o==="transparent"||o.length===5||o.length===9||/(hsla|rgba)\(/.test(o))&&s.clearRect(0,0,n,r),s.save(),s.fillStyle=o,s.fillRect(0,0,n,r),s.restore()):s.clearRect(0,0,n,r),s}}),DO,M6,ns,A6,k6,f4,FT,BT=M(()=>{"use strict";D(),ae(),Oe(),Lr(),Se(),Ds(),ny(),OT(),rH(),te(),qt(),DO=(e,t,n,r,i,a,o)=>{let s={Bold:"#cccccc",Regular:"#e5e5e5"},l=-Math.round(i.value/t)*t+n%t,c=-Math.round(i.value/t)*t+r%t,d=Math.min(1/i.value,1),u=1/i.value,h=[d*3,u+(d+u)];e.save(),e.lineWidth=d;for(let m=l;m<l+a+t*2;m+=t){let p=Math.round(m-n)%(5*t)===0;e.beginPath(),e.setLineDash(p?[]:h),e.strokeStyle=p?s.Bold:s.Regular,e.moveTo(m,c-t),e.lineTo(m,c+o+t*2),e.stroke()}for(let m=c;m<c+o+t*2;m+=t){let p=Math.round(m-r)%(5*t)===0;e.beginPath(),e.setLineDash(p?[]:h),e.strokeStyle=p?s.Bold:s.Regular,e.moveTo(l-t,m),e.lineTo(l+a+t*2,m),e.stroke()}e.restore()},M6=(e,t,n,r)=>{t.translate(e.x+r.scrollX,e.y+r.scrollY),t.beginPath(),t.roundRect?t.roundRect(0,0,e.width,e.height,Kt.radius/r.zoom.value):t.rect(0,0,e.width,e.height),t.clip(),t.translate(-(e.x+r.scrollX),-(e.y+r.scrollY))},A6=(e,t,n,r)=>{if(e.link&&!n.selectedElementIds[e.id]){let[i,a,o,s]=De(e,r),[l,c,d,u]=XE([i,a,o,s],e.angle,n),h=l+d/2,m=c+u/2;if(t.save(),t.translate(n.scrollX+h,n.scrollY+m),t.rotate(e.angle),!ns||ns.zoom!==n.zoom.value){ns=document.createElement("canvas"),ns.zoom=n.zoom.value,ns.width=d*window.devicePixelRatio*n.zoom.value,ns.height=u*window.devicePixelRatio*n.zoom.value;let p=ns.getContext("2d");p.scale(window.devicePixelRatio*n.zoom.value,window.devicePixelRatio*n.zoom.value),p.fillStyle="#fff",p.fillRect(0,0,d,u),p.drawImage(m4,0,0,d,u),p.restore(),t.drawImage(ns,l-h,c-m,d,u)}else t.drawImage(ns,l-h,c-m,d,u);t.restore()}},k6=({canvas:e,rc:t,elementsMap:n,allElementsMap:r,visibleElements:i,scale:a,appState:o,renderConfig:s})=>{if(e===null)return;let{renderGrid:l=!0,isExporting:c}=s,[d,u]=NT(e,a),h=$T({canvas:e,scale:a,normalizedWidth:d,normalizedHeight:u,theme:o.theme,isExporting:c,canvasBackgroundColor:s.canvasBackgroundColor});h.scale(o.zoom.value,o.zoom.value),l&&o.gridSize&&DO(h,o.gridSize,o.scrollX,o.scrollY,o.zoom,d/o.zoom.value,u/o.zoom.value);let m=new Set;i.forEach(p=>{p.groupIds.length>0&&o.frameToHighlight&&o.selectedElementIds[p.id]&&(xl(p,o.frameToHighlight,n)||p.groupIds.find(f=>m.has(f)))&&p.groupIds.forEach(f=>m.add(f))}),i.filter(p=>!mi(p)).forEach(p=>{try{let f=p.frameId||o.frameToHighlight?.id;if(he(p)&&p.containerId&&n.has(p.containerId))return;if(h.save(),f&&o.frameRendering.enabled&&o.frameRendering.clip){let b=tb(p,n,o);b&&Ah(p,n,o)&&M6(b,h,s,o),ju(p,n,r,t,h,s,o)}else ju(p,n,r,t,h,s,o);let g=Ye(p,n);g&&ju(g,n,r,t,h,s,o),h.restore(),c||A6(p,h,o,n)}catch(f){console.error(f)}}),i.filter(p=>mi(p)).forEach(p=>{try{let f=()=>{if(ju(p,n,r,t,h,s,o),mi(p)&&(c||fr(p)&&s.embedsValidationStatus.get(p.id)!==!0)&&p.width&&p.height){let g=AT(p);ju(g,n,r,t,h,s,o)}c||A6(p,h,o,n)};if((p.frameId||o.frameToHighlight?.id)&&o.frameRendering.enabled&&o.frameRendering.clip){h.save();let g=tb(p,n,o);g&&Ah(p,n,o)&&M6(g,h,s,o),f(),h.restore()}else f()}catch(f){console.error(f)}})},f4=Qb(e=>{k6(e)},{trailing:!0}),FT=(e,t)=>{if(t){f4(e);return}k6(e)}}),_O,LO,RO,P6,D6,Hf,sy,dE,C1=M(()=>{"use strict";D(),Qt(),qte(),te(),ae(),vi(),Bl(),Zz(),jh(),Lr(),Oe(),vt(),Se(),$a(),BT(),_O="<!-- svg-source:excalidraw -->",LO=(e,t)=>{if(e.width<=t)return e;let n=document.createElement("canvas").getContext("2d");n.font=An({fontFamily:e.fontFamily,fontSize:e.fontSize});let r=e.text;if(n.measureText(r).width>t)for(let i=r.length;i>0;i--){let a=`${r.slice(0,i)}...`;if(n.measureText(a).width<=t){r=a;break}}return Re(e,{text:r,width:t})},RO=(e,t)=>{let n=[],r=0,i=0;for(let a of e){if(Ae(a)){xh(a)?r++:i++;let o=fi({x:a.x,y:a.y-Kt.nameOffsetY,fontFamily:Zn.Assistant,fontSize:Kt.nameFontSize,lineHeight:Kt.nameLineHeight,strokeColor:t.exportWithDarkMode?Kt.nameColorDarkTheme:Kt.nameColorLightTheme,text:KT(a,xh(a)?r:i)});o.y-=o.height,o=LO(o,a.width),n.push(o)}n.push(a)}return n},P6=(e,t)=>(t=t||Ms().frameRendering,{enabled:e?!0:t.enabled,outline:e?!1:t.outline,name:e?!1:t.name,clip:e?!0:t.clip}),D6=({elements:e,exportingFrame:t,frameRendering:n,exportWithDarkMode:r})=>{let i;return t?i=cy(e,t):n.enabled&&n.name?i=RO(e,{exportWithDarkMode:r}):i=e,i},Hf=async({data:e,config:t})=>{let n=Object.assign({},t),{files:r}=e,{exportingFrame:i}=n,a=e.elements,o=J5(e.appState,null),s=P6(i??null,o.frameRendering??null),l=D6({elements:a,exportingFrame:i,exportWithDarkMode:o.exportWithDarkMode,frameRendering:s});i&&(n.padding=0),n.fit=n.fit??(n.width!=null||n.height!=null||n.maxWidthOrHeight!=null||n.widthOrHeight!=null?"contain":"none");let c=n.fit==="contain";(n.x!=null||n.x!=null)&&(n.fit="none"),n.fit==="cover"&&(n.padding&&!Ne.PROD&&console.warn("`padding` is ignored when `fit` is set to `cover`"),n.padding=0),n.padding=n.padding??0,n.scale=n.scale??1,n.origin=n.origin??"canvas",n.position=n.position??"center",n.maxWidthOrHeight!=null&&n.widthOrHeight!=null&&(Ne.PROD||console.warn("`maxWidthOrHeight` is ignored when `widthOrHeight` is set"),n.maxWidthOrHeight=void 0),(n.maxWidthOrHeight!=null||n.width!=null||n.height!=null)&&n.getDimensions&&(Ne.PROD||console.warn("`getDimensions` is ignored when `width`, `height`, or `maxWidthOrHeight` is set"),n.getDimensions=void 0);let d=1,u=dE(i?[i]:b4(l)),[h,m,p,f]=u,[g,b,v,y]=u;if(n.width!=null?(v=n.width,n.padding&&c&&(v-=n.padding*2),n.height?(y=n.height,n.padding&&c&&(y-=n.padding*2)):y*=v/p):n.height!=null&&(y=n.height,n.padding&&c&&(y-=n.padding*2),v*=y/f),n.maxWidthOrHeight!=null||n.widthOrHeight!=null){c&&n.padding&&(n.maxWidthOrHeight!=null?n.maxWidthOrHeight-=n.padding*2:n.widthOrHeight!=null&&(n.widthOrHeight-=n.padding*2));let T=Math.max(v,y);n.widthOrHeight!=null?d=n.widthOrHeight/T:n.maxWidthOrHeight!=null&&(d=n.maxWidthOrHeight<T?n.maxWidthOrHeight/T:1),v*=d,y*=d}else if(n.getDimensions){let T=n.getDimensions(v,y);v=T.width,y=T.height,n.scale=T.scale??n.scale}else if(c&&n.padding&&n.width==null&&n.height==null){let T=v/y;v-=n.padding*2,y-=n.padding*2/T}if(n.fit==="contain"&&!n.maxWidthOrHeight||c&&n.padding)if(n.fit==="contain"){let T=v/p,I=y/f;d=Math.min(T,I)}else{let T=(v-n.padding*2)/v,I=(y-n.padding*2)/y;d=Math.min(T,I)}else if(n.fit==="cover"){let T=v/p,I=y/f;d=Math.max(T,I)}g=n.x??h,b=n.y??m,n.origin==="content"&&(n.x!=null&&(g+=h),n.y!=null&&(b+=m)),n.position==="center"&&(g-=v/d/2-(n.x==null?p:v+n.padding*2)/2,b-=y/d/2-(n.y==null?f:y+n.padding*2)/2);let w=n.createCanvas?n.createCanvas():document.createElement("canvas"),C=n.padding/d;d*=n.scale,v*=n.scale,y*=n.scale,w.width=v+n.padding*2*n.scale,w.height=y+n.padding*2*n.scale;let{imageCache:A}=await DT({imageCache:new Map,fileIds:_T(l).map(T=>T.fileId),files:r||{}});return FT({canvas:w,rc:nn.canvas(w),elementsMap:Ts(ve(l)),allElementsMap:Ts(ve(wo(a))),visibleElements:l,appState:{...o,frameRendering:s,width:v,height:y,offsetLeft:0,offsetTop:0,scrollX:-g+C,scrollY:-b+C,zoom:{value:KC},shouldCacheIgnoreZoom:!1,theme:n.theme||ze.LIGHT},scale:d,renderConfig:{canvasBackgroundColor:n.canvasBackgroundColor===!1?null:n.canvasBackgroundColor||o.viewBackgroundColor||Ui,imageCache:A,renderGrid:!1,isExporting:!0,embedsValidationStatus:new Map,elementsPendingErasure:new Set}}),w},sy=async({data:e,config:t})=>{let n=Object.assign({},t);n.exportingFrame=n.exportingFrame??null;let r=e.elements,i=P6(n?.exportingFrame??null,e.appState.frameRendering??null),{exportPadding:a=Hh,exportWithDarkMode:o=!1,viewBackgroundColor:s,exportScale:l=1,exportEmbedScene:c}=e.appState,d=D6({elements:r,exportingFrame:n.exportingFrame,exportWithDarkMode:o,frameRendering:i});n.exportingFrame&&(a=0);let u="";if(c)try{u=await(await Promise.resolve().then(()=>(Bf(),Ff))).encodeSvgMetadata({text:zf(r,e.appState,e.files||{},"local")})}catch(k){console.error(k)}let[h,m,p,f]=dE(n.exportingFrame?[n.exportingFrame]:b4(d));p+=a*2,f+=a*2;let g=document.createElementNS(Pt,"svg");g.setAttribute("version","1.1"),g.setAttribute("xmlns",Pt),g.setAttribute("viewBox",`0 0 ${p} ${f}`),g.setAttribute("width",`${p*l}`),g.setAttribute("height",`${f*l}`),o&&g.setAttribute("filter",Zb);let b="https://excalidraw.com/";Ne.VITE_IS_EXCALIDRAW_NPM_PACKAGE&&(b=window.EXCALIDRAW_ASSET_PATH||`https://unpkg.com/${Ne.VITE_PKG_NAME}@${Ne.PKG_VERSION}`,b?.startsWith("/")&&(b=b.replace("/",`${window.location.origin}/`)),b=`${b}/dist/excalidraw-assets/`);let v=-h+a,y=-m+a,w=eb(r),C="",A=ve(r);for(let k of w){let[R,O,P,F]=De(k,A),Y=(P-R)/2-(k.x-R),j=(F-O)/2-(k.y-O);C+=`<clipPath id=${k.id}>
143
+ <rect transform="translate(${k.x+v} ${k.y+y}) rotate(${k.angle} ${Y} ${j})"
144
+ width="${k.width}"
145
+ height="${k.height}"
146
+ >
147
+ </rect>
148
+ </clipPath>`}if(g.innerHTML=`
149
+ ${_O}
150
+ ${u}
151
+ <defs>
152
+ <style class="style-fonts">
153
+ @font-face {
154
+ font-family: "Virgil";
155
+ src: url("https://excalidraw.com/Virgil.woff2");
156
+ }
157
+ @font-face {
158
+ font-family: "Cascadia";
159
+ src: url("https://excalidraw.com/Cascadia.woff2");
160
+ }
161
+ @font-face {
162
+ font-family: "Assistant";
163
+ src: url("${b}Assistant-Regular.woff2");
164
+ }
165
+ </style>
166
+ ${C}
167
+ </defs>
168
+ `,e.appState.exportBackground&&s){let k=g.ownerDocument.createElementNS(Pt,"rect");k.setAttribute("x","0"),k.setAttribute("y","0"),k.setAttribute("width",`${p}`),k.setAttribute("height",`${f}`),k.setAttribute("fill",s),g.appendChild(k)}let T=nn.svg(g),I=n.renderEmbeddables??!1;return Dz(d,Ts(ve(d)),T,g,e.files||{},{offsetX:v,offsetY:y,isExporting:!0,exportWithDarkMode:o,renderEmbeddables:I,frameRendering:i,canvasBackgroundColor:s,embedsValidationStatus:I?new Map(d.filter(k=>Ae(k)).map(k=>[k.id,!0])):new Map}),g},dE=e=>{let[t,n,r,i]=Bt(e),a=nr(t,r),o=nr(n,i);return[t,n,a,o]}}),iH,Fc,aH,Hu,Uu,Di,_i,Ge,_6,zT,HT,UT,oH,sH,lH,cH,Zi=M(()=>{"use strict";D(),ae(),te(),iH=5,Fc=5,aH=4,Hu=4,Uu=1,Di=[0,2,4,6,8],_i=(e,t)=>t.map(n=>At[e][n]),Ge={transparent:ME,charcoal:yh,white:Ui,gray:_i("gray",Di),red:_i("red",Di),pink:_i("pink",Di),grape:_i("grape",Di),violet:_i("violet",Di),blue:_i("blue",Di),cyan:_i("cyan",Di),teal:_i("teal",Di),green:_i("green",Di),yellow:_i("yellow",Di),orange:_i("orange",Di),bronze:["#f8f1ee","#eaddd7","#d2bab0","#a18072","#846358"]},_6=MB(Ge,["cyan","blue","violet","grape","pink","green","teal","yellow","orange","red"]),zT=[Ge.charcoal,Ge.red[Hu],Ge.green[Hu],Ge.blue[Hu],Ge.yellow[Hu]],HT=[Ge.transparent,Ge.red[Uu],Ge.green[Uu],Ge.blue[Uu],Ge.yellow[Uu]],UT=[Ge.white,"#f8f9fa","#f5faff","#fffce8","#fdf8f6"],oH={transparent:Ge.transparent,white:Ge.white,gray:Ge.gray,charcoal:Ge.charcoal,bronze:Ge.bronze,..._6},sH={transparent:Ge.transparent,white:Ge.white,gray:Ge.gray,charcoal:Ge.charcoal,bronze:Ge.bronze,..._6},lH=e=>[Ge.cyan[e],Ge.blue[e],Ge.violet[e],Ge.grape[e],Ge.pink[e],Ge.green[e],Ge.teal[e],Ge.yellow[e],Ge.orange[e],Ge.red[e]],cH=(e,t,n)=>`#${((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}`}),Li,St,rs,L6,cl,Gu,Mu,c2,R6,OO,dH,Mp,ai,O6,NO,$O,FO,N6,BO,zO,uH,hH=M(()=>{"use strict";D(),Zi(),ae(),Oe(),Ao(),Li=32,St=12,rs=256,L6=50,cl="NOT_SPREADSHEET",Gu="VALID_SPREADSHEET",Mu=e=>{let t=/^([-+]?)[$€£¥₩]?([-+]?)([\d.,]+)[%]?$/.exec(e);return t?parseFloat(`${(t[1]||t[2])+t[3]}`.replace(/,/g,"")):null},c2=(e,t)=>e.slice(1).every(n=>Mu(n[t])!==null),R6=e=>{let t=e[0].length;if(t>2)return{type:cl,reason:"More than 2 columns"};if(t===1){if(!c2(e,0))return{type:cl,reason:"Value is not numeric"};let l=Mu(e[0][0])===null,c=(l?e.slice(1):e).map(d=>Mu(d[0]));return c.length<2?{type:cl,reason:"Less than two rows"}:{type:Gu,spreadsheet:{title:l?e[0][0]:null,labels:null,values:c}}}let n=c2(e,0),r=c2(e,1);if(!n&&!r)return{type:cl,reason:"Value is not numeric"};let[i,a]=r?[0,1]:[1,0],o=Mu(e[0][a])===null,s=o?e.slice(1):e;return s.length<2?{type:cl,reason:"Less than 2 rows"}:{type:Gu,spreadsheet:{title:o?e[0][a]:null,labels:s.map(l=>l[i]),values:s.map(l=>Mu(l[a]))}}},OO=e=>{let t=[];for(let n=0;n<e[0].length;n++){let r=[];for(let i=0;i<e.length;i++)r.push(e[i][n]);t.push(r)}return t},dH=e=>{let t=e.trim().split(`
169
+ `).map(i=>i.trim().split(" "));if(t.length&&t[0].length!==2&&(t=e.trim().split(`
170
+ `).map(i=>i.trim().split(","))),t.length===0)return{type:cl,reason:"No values"};let n=t[0].length;if(!t.every(i=>i.length===n))return{type:cl,reason:"All rows don't have same number of columns"};let r=R6(t);if(r.type!==Gu){let i=R6(OO(t));if(i.type===Gu)return i}return r},Mp=lH(aH),ai={fillStyle:"hachure",fontFamily:To,fontSize:Vi,opacity:100,roughness:1,strokeColor:yh,roundness:null,strokeStyle:"solid",strokeWidth:1,verticalAlign:Yr.MIDDLE,locked:!1},O6=e=>{let t=(Li+St)*e.values.length+St,n=rs+St*2;return{chartWidth:t,chartHeight:n}},NO=(e,t,n,r,i)=>e.labels?.map((a,o)=>fi({groupIds:[r],backgroundColor:i,...ai,text:a.length>8?`${a.slice(0,5)}...`:a,x:t+o*(Li+St)+St*2,y:n+St/2,width:Li,angle:5.87,fontSize:16,textAlign:"center",verticalAlign:"top"}))||[],$O=(e,t,n,r,i)=>{let a=fi({groupIds:[r],backgroundColor:i,...ai,x:t-St,y:n-St,text:"0",textAlign:"right"}),o=fi({groupIds:[r],backgroundColor:i,...ai,x:t-St,y:n-rs-a.height/2,text:Math.max(...e.values).toLocaleString(),textAlign:"right"});return[a,o]},FO=(e,t,n,r,i)=>{let{chartWidth:a,chartHeight:o}=O6(e),s=hs({backgroundColor:i,groupIds:[r],...ai,type:"line",x:t,y:n,startArrowhead:null,endArrowhead:null,width:a,points:[[0,0],[a,0]]}),l=hs({backgroundColor:i,groupIds:[r],...ai,type:"line",x:t,y:n,startArrowhead:null,endArrowhead:null,height:o,points:[[0,0],[0,-o]]}),c=hs({backgroundColor:i,groupIds:[r],...ai,type:"line",x:t,y:n-rs-St,startArrowhead:null,endArrowhead:null,strokeStyle:"dotted",width:a,opacity:L6,points:[[0,0],[a,0]]});return[s,l,c]},N6=(e,t,n,r,i,a)=>{let{chartWidth:o,chartHeight:s}=O6(e),l=e.title?fi({backgroundColor:i,groupIds:[r],...ai,text:e.title,x:t+o/2,y:n-rs-St*2-Vi,roundness:null,textAlign:"center"}):null,c=a?As({backgroundColor:i,groupIds:[r],...ai,type:"rectangle",x:t,y:n-s,width:o,height:s,strokeColor:yh,fillStyle:"solid",opacity:6}):null;return[...c?[c]:[],...l?[l]:[],...NO(e,t,n,r,i),...$O(e,t,n,r,i),...FO(e,t,n,r,i)]},BO=(e,t,n)=>{let r=Math.max(...e.values),i=pi(),a=Mp[Math.floor(Math.random()*Mp.length)];return[...e.values.map((o,s)=>{let l=o/r*rs;return As({backgroundColor:a,groupIds:[i],...ai,type:"rectangle",x:t+s*(Li+St)+St,y:n-l-St,width:Li,height:l})}),...N6(e,t,n,i,a,Ne.DEV)]},zO=(e,t,n)=>{let r=Math.max(...e.values),i=pi(),a=Mp[Math.floor(Math.random()*Mp.length)],o=0,s=[];for(let f of e.values){let g=o*(Li+St),b=-(f/r)*rs;s.push([g,b]),o++}let l=Math.max(...s.map(f=>f[0])),c=Math.max(...s.map(f=>f[1])),d=Math.min(...s.map(f=>f[0])),u=Math.min(...s.map(f=>f[1])),h=hs({backgroundColor:a,groupIds:[i],...ai,type:"line",x:t+St+Li/2,y:n-St,startArrowhead:null,endArrowhead:null,height:c-u,width:l-d,strokeWidth:2,points:s}),m=e.values.map((f,g)=>{let b=g*(Li+St)+St/2,v=-(f/r)*rs+St/2;return As({backgroundColor:a,groupIds:[i],...ai,fillStyle:"solid",strokeWidth:2,type:"ellipse",x:t+b+Li/2,y:n+v-St*2,width:St,height:St})}),p=e.values.map((f,g)=>{let b=g*(Li+St)+St/2,v=f/r*rs+St/2+St;return hs({backgroundColor:a,groupIds:[i],...ai,type:"line",x:t+b+Li/2+St/2,y:n-v,startArrowhead:null,endArrowhead:null,height:v,strokeStyle:"dotted",opacity:L6,points:[[0,0],[0,v]]})});return[...N6(e,t,n,i,a,Ne.DEV),h,...p,...m]},uH=(e,t,n,r)=>e==="line"?zO(t,n,r):BO(t,n,r)});function mH(e){let t=[];for(let n of e.childNodes)if(n.nodeType===3){let r=n.textContent?.trim();r&&t.push({type:"text",value:r})}else if(n instanceof HTMLImageElement){let r=n.getAttribute("src");r&&r.startsWith("http")&&t.push({type:"imageUrl",value:r})}else t=t.concat(mH(n));return t}var ene,qE,ly,HO,pH,UO,GT,GO,jO,fH,WO,jT,WT,Mh,VO,vd=M(()=>{"use strict";D(),hH(),ae(),Se(),_s(),vt(),Lr(),te(),ene="clipboard"in navigator&&"readText"in navigator.clipboard,qE="clipboard"in navigator&&"writeText"in navigator.clipboard,ly="clipboard"in navigator&&"write"in navigator.clipboard&&"ClipboardItem"in window&&"toBlob"in HTMLCanvasElement.prototype,HO=e=>!!([hi.excalidraw,hi.excalidrawClipboard,hi.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),pH=({types:e,files:t})=>{!e&&!t&&console.warn("createPasteEvent: no types or files provided");let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});if(e)for(let[r,i]of Object.entries(e))try{if(n.clipboardData?.setData(r,i),n.clipboardData?.getData(r)!==i)throw new Error(`Failed to set "${r}" as clipboardData item`)}catch(a){throw new Error(a.message)}if(t){let r=-1;for(let i of t){r++;try{if(n.clipboardData?.items.add(i),n.clipboardData?.files[r]!==i)throw new Error(`Failed to set file "${i.name}" as clipboardData item`)}catch(a){throw new Error(a.message)}}}return n},UO=({elements:e,files:t})=>{let n=ve(e),r=new Set(e.filter(s=>Ae(s))),i=!1,a=e.reduce((s,l)=>(Ma(l)&&(i=!0,t&&t[l.fileId]&&(s[l.fileId]=t[l.fileId])),s),{});i&&!t&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");let o={type:hi.excalidrawClipboard,elements:e.map(s=>{if(Zr(s,n)&&!r.has(Zr(s,n))){let l=Th(s);return ie(l,{frameId:null}),l}return s}),files:t?a:void 0};return JSON.stringify(o)},GT=async(e,t,n)=>{await Mh(UO({elements:e,files:t}),n)},GO=e=>{let t=dH(e);return t.type===Gu?{spreadsheet:t.spreadsheet}:null},jO=e=>{let t=e.clipboardData?.getData("text/html");if(!t)return null;try{let n=new DOMParser().parseFromString(t,"text/html"),r=mH(n.body);if(r.length)return{type:"mixedContent",value:r}}catch(n){console.error(`error in parseHTMLFromPaste: ${n.message}`)}return null},fH=async()=>{let e={};try{if(navigator.clipboard?.readText)return{"text/plain":await navigator.clipboard?.readText()}}catch(n){if(navigator.clipboard?.read)console.warn(`navigator.clipboard.readText() failed (${n.message}). Failling back to navigator.clipboard.read()`);else throw n}let t;try{t=await navigator.clipboard?.read()}catch(n){if(n.name==="DataError")return console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${n.message}`),e;throw n}for(let n of t)for(let r of n.types)if(LE(XF,r))try{e[r]=await(await n.getType(r)).text()}catch(i){console.warn(`Cannot retrieve ${r} from clipboardItem: ${i.message}`)}return Object.keys(e).length===0&&console.warn("No clipboard data found from clipboard.read()."),e},WO=async(e,t=!1)=>{try{let n=!t&&e&&jO(e);return n?n.value.every(r=>r.type==="text")?{type:"text",value:e.clipboardData?.getData("text/plain")||n.value.map(r=>r.value).join(`
171
+ `).trim()}:n:{type:"text",value:(e.clipboardData?.getData("text/plain")||"").trim()}}catch{return{type:"text",value:""}}},jT=async(e,t=!1)=>{let n=await WO(e,t);if(n.type==="mixedContent")return{mixedContent:n.value};try{let r=!t&&GO(n.value);if(r)return r}catch(r){console.error(r)}try{let r=JSON.parse(n.value),i=r.type===hi.excalidrawClipboardWithAPI;if(HO(r))return{elements:r.elements,files:r.files,text:t?JSON.stringify(r.elements,null,2):void 0,programmaticAPI:i}}catch{}return{text:n.value}},WT=async e=>{try{await navigator.clipboard.write([new window.ClipboardItem({[we.png]:e})])}catch(t){if(Uh(e))await navigator.clipboard.write([new window.ClipboardItem({[we.png]:await e})]);else throw t}},Mh=async(e,t)=>{if(qE)try{await navigator.clipboard.writeText(e||"");return}catch(n){console.error(n)}try{if(t){if(t.clipboardData?.setData("text/plain",e||""),t.clipboardData?.getData("text/plain")!==e)throw new Error("Failed to setData on clipboardEvent");return}}catch(n){console.error(n)}if(!VO(e))throw new Error("Error copying to clipboard.")},VO=e=>{e||(e=" ");let t=document.documentElement.getAttribute("dir")==="rtl",n=document.createElement("textarea");n.style.border="0",n.style.padding="0",n.style.margin="0",n.style.position="absolute",n.style[t?"right":"left"]="-9999px";let r=window.pageYOffset||document.documentElement.scrollTop;n.style.top=`${r}px`,n.style.fontSize="12pt",n.setAttribute("readonly",""),n.value=e,document.body.appendChild(n);let i=!1;try{n.select(),n.setSelectionRange(0,n.value.length),i=document.execCommand("copy")}catch(a){console.error(a)}return n.remove(),i}}),VT,g4,QE,tne,Wh=M(()=>{"use strict";D(),C1(),jh(),ae(),Bf(),Bl(),vd(),YA(),VT=async({data:e,config:t})=>Hf({data:e,config:t}),g4=async({data:e,config:t})=>{let{mimeType:n=we.png,quality:r}=t||{};n===we.png&&typeof r=="number"&&console.warn(`"quality" will be ignored for "${we.png}" mimeType`),n==="image/jpg"&&(n=we.jpg),n===we.jpg&&t?.canvasBackgroundColor&&(console.warn(`Defaulting "exportBackground" to "true" for "${we.jpg}" mimeType`),t={...t,canvasBackgroundColor:e.appState?.viewBackgroundColor||Ui});let i=await Hf({data:e,config:t});return r=r||(/image\/jpe?g/.test(n)?.92:.8),new Promise((a,o)=>{i.toBlob(async s=>{if(!s)return o(new Error("couldn't export to blob"));s&&n===we.png&&e.appState?.exportEmbedScene&&(s=await kT({blob:s,metadata:zf(e.elements,e.appState,e.files||{},"local")})),a(s)},n,r)})},QE=async({data:e,config:t})=>{let{elements:n,appState:r}=iy({...e,files:e.files||{}},null,null),i={...r,exportPadding:t?.padding},a=ut(n),o=e.files||{};return sy({data:{elements:a,appState:i,files:o},config:{exportingFrame:t?.exportingFrame,renderEmbeddables:t?.renderEmbeddables}})},tne=async({type:e,data:t,config:n})=>{if(e==="svg"){let r=await QE({data:t,config:n});await Mh(r.outerHTML)}else if(e==="png")await WT(g4({data:t,config:n}));else if(e==="json")await GT(t.elements,t.files);else throw new Error("Invalid export type")}}),YO,ZO,$6,F6,B6,KO,gH,EH=M(()=>{"use strict";D(),Se(),rr(),Qt(),te(),YO=e=>e.type==="diamond"?[[e.width/2,0],[e.width,e.height/2],[e.width/2,e.height],[0,e.height/2]]:[[0,0],[0+e.width,0],[0+e.width,e.height],[0,e.height]],ZO=e=>Be(e)||Ar(e)?e.points:YO(e),$6=e=>{let t=e.reduce((n,[r,i])=>(n.minY=Math.min(n.minY,i),n.minX=Math.min(n.minX,r),n.maxX=Math.max(n.maxX,r),n.maxY=Math.max(n.maxY,i),n),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,cx:0,cy:0});return t.cx=(t.maxX+t.minX)/2,t.cy=(t.maxY+t.minY)/2,t},F6=e=>{let t=ZO(e),{cx:n,cy:r}=$6(t),i=[n,r],a=t.map(d=>Rt([d[0],d[1]],i,e.angle)),{minX:o,minY:s,maxX:l,maxY:c}=$6(a);return[o+e.x,s+e.y,l+e.x,c+e.y]},B6=(e,t,n=!1)=>{let r=F6(e),i=t[0]<=r[0]&&t[2]>=r[2]&&t[1]<=r[1]&&t[3]>=r[3];return n?i?!0:r[0]<=t[0]&&r[2]>=t[2]&&r[1]<=t[1]&&r[3]>=t[3]:i},KO=(e,t)=>{let n=F6(e);return(Wp(n[0],t[0],t[2])||Wp(t[0],n[0],n[2]))&&(Wp(n[1],t[1],t[3])||Wp(t[1],n[1],n[3]))},gH=({elements:e,bounds:t,type:n,errorMargin:r=0})=>{iT(t)&&(t=xs(t,ve(e)));let i=[t[0]-r,t[1]-r,t[2]+r,t[3]+r],a=new Set;for(let o of e)if(!a.has(o.id)&&(n==="overlap"?KO(o,i):n==="inside"?B6(o,i):B6(o,i,!0))){if(a.add(o.id),o.boundElements)for(let s of o.boundElements)a.add(s.id);he(o)&&o.containerId&&a.add(o.containerId),Et(o)&&(o.startBinding&&a.add(o.startBinding.elementId),o.endBinding&&a.add(o.endBinding?.elementId))}return e.filter(o=>a.has(o.id))}});function XO(e){return[Math.min(e[0][0],e[1][0]),Math.min(e[0][1],e[1][1]),Math.max(e[0][0],e[1][0]),Math.max(e[0][1],e[1][1])]}function bH(e,t){return e[0]*t[1]-t[0]*e[1]}function nne(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function JE(e,t){return[e[0]-t[0],e[1]-t[1]]}function qO(e,t){let n=JE(e[1],e[0]),r=JE(t,e[0]),i=bH(n,r);return Math.abs(i)<yH}function z6(e,t){let n=JE(e[1],e[0]),r=JE(t,e[0]);return bH(n,r)<0}function QO(e,t){return qO(e,t[0])||qO(e,t[1])||(z6(e,t[0])?!z6(e,t[1]):z6(e,t[1]))}function rne(e,t){return nne(XO(e),XO(t))&&QO(e,t)&&QO(t,e)}var yH,ine=M(()=>{"use strict";D(),yH=1e-6}),ane=M(()=>{"use strict";D(),Wh(),EH(),ine()});function JO(e,t,n){let r=j5(t,n),i=j5(e,n);return r.some(a=>i.some(o=>rne(a,o)))}var YT,H6,U6,G6,xl,E4,vH,vo,eb,b4,bf,xH,Zr,wH,yf,vf,y4,ZT,md,Ap,tb,Ah,KT,cy,Lr=M(()=>{"use strict";D(),Oe(),rr(),qt(),te(),vt(),It(),Kr(),Qt(),ane(),Se(),YT=(e,t,n)=>{let r=ve(e);for(let i of t)if(i.frameId){let a=n.get(i.id),o=n.get(i.frameId);if(a){let s=r.get(a);s&&ie(s,{frameId:o??i.frameId},!1)}}},H6=(e,t,n)=>Ap(sb(e,t,n,!1)).filter(r=>!Ae(r)&&!r.frameId||r.frameId===t.id),U6=(e,t,n,r)=>sb(e,t,r).some(i=>i.id===n.id),G6=(e,t,n)=>{let[r,i,a,o]=De(t,n),[s,l,c,d]=Bt(e);return r<=s&&i<=l&&a>=c&&o>=d},xl=(e,t,n)=>G6([e],t,n)||JO(e,t,n)||U6([t],e,t,n),E4=(e,t,n)=>{let[r,i,a,o]=De(t,n);return sT([r,i],[e.x,e.y],[a,o])},vH=e=>{let t=new Map;for(let n of e){let r=Ae(n)?n.id:n.frameId;r&&!t.has(r)&&t.set(r,vo(e,r))}return t},vo=(e,t)=>{let n=[];for(let r of e.values())r.frameId===t&&n.push(r);return n},eb=e=>e.filter(t=>Ae(t)),b4=e=>{let t=ve(eb(e));return e.filter(n=>t.has(n.id)||!n.frameId||!t.has(n.frameId))},bf=(e,t,n,r)=>{let i=vo(e,t.id),a=new Set(i),o=new Set([...H6(e,t,r),...i.filter(h=>U6(e,h,t,r))]),s=i.filter(h=>!o.has(h)),l=new Set(Array.from(o).flatMap(h=>h.groupIds));for(let h of s)if(!JO(h,t,r))h.groupIds.length===0&&a.delete(h);else if(h.groupIds.length>0)for(let m of h.groupIds)l.add(m);for(let h of s)if(h.groupIds.length>0){let m=!0;for(let p of h.groupIds)l.has(p)&&(m=!1);m&&a.delete(h)}let c=Array.from(o).filter(h=>h.groupIds.length===0);for(let h of c)a.add(h);let d=Array.from(o).filter(h=>h.groupIds.length>0),u=xT(d,n);for(let[h,m]of Object.entries(u))if(m){let p=yn(e,h);if(G6(p,t,r))for(let f of p)a.add(f)}return[...a].filter(h=>!(he(h)&&h.containerId))},xH=(e,t,n)=>Ap(e,H6(e,t,n)),Zr=(e,t)=>e.frameId&&t.get(e.frameId)||null,wH=(e,t)=>{let n=new Set,r=ve(e);e=Ap(e);for(let o of e)Ae(o)&&o.id!==t.id&&n.add(o.id);let i=new Set,a=[];for(let o of e)if(!(Ae(o)||o.frameId&&n.has(o.frameId)))if(o.groupIds.length){let s=o.groupIds.at(-1);if(!i.has(s)){i.add(s);let l=yn(e,s);if(l.some(c=>xl(c,t,r)))for(let c of l)a.push(c)}}else xl(o,t,r)&&a.push(o);return a},yf=(e,t,n)=>{let r=ve(e),i=new Map;for(let l of e.values())l.frameId===n.id&&i.set(l.id,!0);let a=new Set(t.map(l=>l.id)),o=[],s=new Set;for(let l of t)Ae(l)&&l.id!==n.id&&s.add(l.id);for(let l of Ap(e,t)){if(Ae(l)||l.frameId&&s.has(l.frameId))continue;i.has(l.id)||o.push(l);let c=Ye(l,r);c&&!a.has(c.id)&&!i.has(c.id)&&o.push(c)}for(let l of o)ie(l,{frameId:n.id},!1);return e},vf=(e,t)=>{let n=new Map,r=new Map;for(let i of e)if(i.frameId){n.set(i.id,i);let a=r.get(i.frameId)||[];a.push(i);let o=Ye(i,t);o&&(n.set(o.id,o),a.push(o)),r.set(i.frameId,a)}for(let[,i]of n)ie(i,{frameId:null},!1)},y4=(e,t)=>{let n=vo(e,t.id);return vf(n,ve(e)),e},ZT=(e,t,n,r)=>yf(y4(e,n),t,n).slice(),md=(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,elements:e}),i=new Set(r);if(t.editingGroupId)for(let s of r)s.groupIds.length===0?i.add(s):s.groupIds.flatMap(l=>yn(e,l)).forEach(l=>i.add(l));let a=new Set,o=ve(e);return i.forEach(s=>{s.frameId&&!Ae(s)&&!Ah(s,o,t)&&a.add(s)}),a.size>0&&vf(a,o),e},Ap=(e,t)=>{let n=new Set,r=t||e;for(let o of r.values()){let s=o.groupIds[o.groupIds.length-1];s&&n.add(s)}let i=new Set;for(let o of n)yn(e,o).some(s=>Ae(s))&&i.add(o);let a=[];for(let o of r.values())i.has(o.groupIds[o.groupIds.length-1])||a.push(o);return a},tb=(e,t,n)=>{let r=he(e)&&Er(e,t)||e;return n.selectedElementIds[r.id]&&n.selectedElementsAreBeingDragged?n.frameToHighlight:Zr(r,t)},Ah=(e,t,n)=>{let r=tb(e,t,n),i=he(e)&&Er(e,t)||e;if(r){if(!n.selectedElementIds[e.id]||!n.selectedElementsAreBeingDragged)return!0;if(i.groupIds.length===0)return xl(i,r,t);let a=new Set(i.groupIds.flatMap(o=>yn(t,o)));if(n.editingGroupId&&n.selectedElementsAreBeingDragged){let o=new Set(bt(t,n));if(n.frameToHighlight!==null)return!0;o.forEach(s=>{a.delete(s)})}for(let o of a)if(Ae(o))return!1;for(let o of a)if(xl(o,r,t))return!0}return!1},KT=(e,t)=>e.name===null?xh(e)?`Frame ${t}`:`AI Frame $${t}`:e.name,cy=(e,t)=>gH({elements:e,bounds:t,type:"overlap"}).filter(n=>!n.frameId||n.frameId===t.id)});function one(e){let t=SH(e),n=new Path2D(t);return nb.set(e,n),n}function sne(e){return nb.get(e)}function SH(e){let t=e.simulatePressure?e.points:e.points.length?e.points.map(([r,i],a)=>[r,i,e.pressures[a]]):[[0,0,.5]],n={simulatePressure:e.simulatePressure,size:e.strokeWidth*4.25,thinning:.6,smoothing:.5,streamline:.5,easing:r=>Math.sin(r*Math.PI/2),last:!!e.lastCommittedPoint};return lne(P0(t,n))}function eN(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function lne(e){if(!e.length)return"";let t=e.length-1;return e.reduce((n,r,i,a)=>(i===t?n.push(r,eN(r,a[0]),"L",a[0],"Z"):n.push(r,eN(r,a[i+1])),n),["M",e[0],"Q"]).join(" ").replace(MH,"$1")}var v4,tN,j6,W6,kp,x4,nN,rN,CH,V6,Y6,iN,Pp,Kp,TH,Z6,K6,IH,ju,nb,MH,Ds=M(()=>{"use strict";D(),Se(),Qt(),te(),rr(),vi(),ae(),qt(),yr(),Lr(),Ls(),v4="invert(100%) hue-rotate(180deg) saturate(1.25)",tN=Ms(),j6=(e,t)=>Ma(e)&&!t.imageCache.has(e.fileId),W6=(e,t,n)=>n.theme===ze.DARK&&Ma(e)&&!j6(e,t)&&t.imageCache.get(e.fileId)?.mimeType!==we.svg,kp=e=>e.type==="freedraw"?e.strokeWidth*12:20,x4=(e,t,n)=>{let r=(t?.opacity??100)*e.opacity/1e4;return(n.has(e.id)||t&&n.has(t.id))&&(r*=dB/100),r},nN=(e,t,n)=>{let r=kp(e),[i,a,o,s]=De(e,t),l=Be(e)||Ar(e)?nr(i,o):e.width,c=Be(e)||Ar(e)?nr(a,s):e.height,d=l*window.devicePixelRatio+r*2,u=c*window.devicePixelRatio+r*2,h=n.value;return(d*h>32767||u*h>32767)&&(h=Math.min(32767/d,32767/u)),d*u*h*h>16777216&&(h=Math.sqrt(16777216/(d*u))),d=Math.floor(d*h),u=Math.floor(u*h),{width:d,height:u,scale:h}},rN=(e,t,n,r,i)=>{let a=document.createElement("canvas"),o=a.getContext("2d"),s=kp(e),{width:l,height:c,scale:d}=nN(e,t,n);a.width=l,a.height=c;let u=0,h=0;if(Be(e)||Ar(e)){let[p,f]=De(e,t);u=e.x>p?nr(e.x,p)*window.devicePixelRatio*d:0,h=e.y>f?nr(e.y,f)*window.devicePixelRatio*d:0,o.translate(u,h)}o.save(),o.translate(s*d,s*d),o.scale(window.devicePixelRatio*d,window.devicePixelRatio*d);let m=nn.canvas(a);return W6(e,r,i)&&(o.filter=v4),Pp(e,m,o,r,i),o.restore(),{element:e,canvas:a,theme:i.theme,scale:d,zoomValue:n.value,canvasOffsetX:u,canvasOffsetY:h,boundTextElementVersion:Ye(e,t)?.version||null,containingFrameOpacity:Zr(e,t)?.opacity||100}},CH=14,V6=document.createElement("img"),V6.src=`data:${we.svg},${encodeURIComponent('<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="image" class="svg-inline--fa fa-image fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#888" d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"></path></svg>')}`,Y6=document.createElement("img"),Y6.src=`data:${we.svg},${encodeURIComponent('<svg viewBox="0 0 668 668" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48ZM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56ZM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.81709 0 0 .81709 124.825 145.825)"/><path d="M256 8C119.034 8 8 119.033 8 256c0 136.967 111.034 248 248 248s248-111.034 248-248S392.967 8 256 8Zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676ZM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.30366 0 0 .30366 506.822 60.065)"/></svg>')}`,iN=(e,t,n)=>{t.fillStyle="#E7E7E7",t.fillRect(0,0,e.width,e.height);let r=Math.min(e.width,e.height),i=Math.min(r,Math.min(r*.4,100));t.drawImage(e.status==="error"?Y6:V6,e.width/2-i/2,e.height/2-i/2,i,i)},Pp=(e,t,n,r,i)=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":{n.lineJoin="round",n.lineCap="round",t.draw(Xt.get(e));break}case"arrow":case"line":{n.lineJoin="round",n.lineCap="round",Xt.get(e).forEach(a=>{t.draw(a)});break}case"freedraw":{n.save(),n.fillStyle=e.strokeColor;let a=sne(e),o=Xt.get(e);o&&t.draw(o),n.fillStyle=e.strokeColor,n.fill(a),n.restore();break}case"image":{let a=Ma(e)?r.imageCache.get(e.fileId)?.image:void 0;a!=null&&!(a instanceof Promise)?(e.roundness&&n.roundRect&&(n.beginPath(),n.roundRect(0,0,e.width,e.height,Ol(Math.min(e.width,e.height),e)),n.clip()),n.drawImage(a,0,0,e.width,e.height)):iN(e,n,i.zoom.value);break}default:if(he(e)){let a=JC(e.text),o=a&&!n.canvas.isConnected;o&&document.body.appendChild(n.canvas),n.canvas.setAttribute("dir",a?"rtl":"ltr"),n.save(),n.font=An(e),n.fillStyle=e.strokeColor,n.textAlign=e.textAlign;let s=e.text.replace(/\r\n?/g,`
172
+ `).split(`
173
+ `),l=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,c=ih(e.fontSize,e.lineHeight),d=gT(e.fontFamily,e.fontSize,c);for(let u=0;u<s.length;u++)n.fillText(s[u],l,u*c+d);n.restore(),o&&n.canvas.remove()}else throw new Error(`Unimplemented type ${e.type}`)}},Kp=new WeakMap,TH=()=>{Kp=new WeakMap,nb=new WeakMap},Z6=(e,t,n,r)=>{let i=n?r.zoom:tN.zoom,a=Kp.get(e),o=a&&a.zoomValue!==i.value&&!r?.shouldCacheIgnoreZoom,s=Ye(e,t)?.version||null,l=Zr(e,t)?.opacity||100;if(!a||o||a.theme!==r.theme||a.boundTextElementVersion!==s||a.containingFrameOpacity!==l){let c=rN(e,t,i,n,r);return Kp.set(e,c),c}return a},K6=(e,t,n,r,i)=>{let a=e.element,o=kp(a),s=e.scale,[l,c,d,u]=De(a,i);Ar(a)&&(l=Math.floor(l),d=Math.ceil(d),c=Math.floor(c),u=Math.ceil(u));let h=((l+d)/2+r.scrollX)*window.devicePixelRatio,m=((c+u)/2+r.scrollY)*window.devicePixelRatio;t.save(),t.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);let p=Ye(a,i);if(Et(a)&&p){let f=document.createElement("canvas"),g=f.getContext("2d"),b=Math.max(nr(l,d),nr(c,u));f.width=b*window.devicePixelRatio*s+o*e.scale*10,f.height=b*window.devicePixelRatio*s+o*e.scale*10;let v=(f.width-e.canvas.width)/2,y=(f.height-e.canvas.height)/2;g.translate(f.width/2,f.height/2),g.rotate(a.angle),g.drawImage(e.canvas,-e.canvas.width/2,-e.canvas.height/2,e.canvas.width,e.canvas.height);let[,,,,w,C]=De(p,i);g.rotate(-a.angle);let A=f.width/2-(w-l)*window.devicePixelRatio*s-v-o*s,T=f.height/2-(C-c)*window.devicePixelRatio*s-y-o*s;g.translate(-A,-T),g.clearRect(-(p.width/2+In)*window.devicePixelRatio*s,-(p.height/2+In)*window.devicePixelRatio*s,(p.width+In*2)*window.devicePixelRatio*s,(p.height+In*2)*window.devicePixelRatio*s),t.translate(h,m),t.drawImage(f,-(d-l)/2*window.devicePixelRatio-v/s-o,-(u-c)/2*window.devicePixelRatio-y/s-o,f.width/s,f.height/s)}else if(t.translate(h,m),t.rotate(a.angle),"scale"in e.element&&!j6(a,n)&&t.scale(e.element.scale[0],e.element.scale[1]),t.translate(-h,-m),t.drawImage(e.canvas,(l+r.scrollX)*window.devicePixelRatio-o*e.scale/e.scale,(c+r.scrollY)*window.devicePixelRatio-o*e.scale/e.scale,e.canvas.width/e.scale,e.canvas.height/e.scale),Ne.VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX==="true"&&Io(a)){let f=Ye(a,i),g=G5(a);t.strokeStyle="#c92a2a",t.lineWidth=3,t.strokeRect((g.x+r.scrollX)*window.devicePixelRatio,(g.y+r.scrollY)*window.devicePixelRatio,Ca(a,f)*window.devicePixelRatio,Ju(a,f)*window.devicePixelRatio)}t.restore()},IH=(e,t,n)=>{t.save(),t.translate(e.x+n.scrollX,e.y+n.scrollY),t.fillStyle="rgba(0, 0, 200, 0.04)";let r=.5/n.zoom.value;t.fillRect(r,r,e.width,e.height),t.lineWidth=1/n.zoom.value,t.strokeStyle=" rgb(105, 101, 219)",t.strokeRect(r,r,e.width,e.height),t.restore()},ju=(e,t,n,r,i,a,o)=>{switch(i.globalAlpha=x4(e,Zr(e,t),a.elementsPendingErasure),e.type){case"magicframe":case"frame":{o.frameRendering.enabled&&o.frameRendering.outline&&(i.save(),i.translate(e.x+o.scrollX,e.y+o.scrollY),i.fillStyle="rgba(0, 0, 200, 0.04)",i.lineWidth=Kt.strokeWidth/o.zoom.value,i.strokeStyle=Kt.strokeColor,Zu(e)&&(i.strokeStyle=o.theme===ze.LIGHT?"#7affd7":"#1d8264"),Kt.radius&&i.roundRect?(i.beginPath(),i.roundRect(0,0,e.width,e.height,Kt.radius/o.zoom.value),i.stroke(),i.closePath()):i.strokeRect(0,0,e.width,e.height),i.restore());break}case"freedraw":{if(Xt.generateElementShape(e,null),a.isExporting){let[s,l,c,d]=De(e,t),u=(s+c)/2+o.scrollX,h=(l+d)/2+o.scrollY,m=(c-s)/2-(e.x-s),p=(d-l)/2-(e.y-l);i.save(),i.translate(u,h),i.rotate(e.angle),i.translate(-m,-p),Pp(e,r,i,a,o),i.restore()}else{let s=Z6(e,t,a,o);K6(s,i,a,o,n)}break}case"rectangle":case"diamond":case"ellipse":case"line":case"arrow":case"image":case"text":case"iframe":case"embeddable":{if(Xt.generateElementShape(e,a),a.isExporting){let[s,l,c,d]=De(e,t),u=(s+c)/2+o.scrollX,h=(l+d)/2+o.scrollY,m=(c-s)/2-(e.x-s),p=(d-l)/2-(e.y-l);if(he(e)){let g=Er(e,t);if(Et(g)){let b=fe.getBoundTextElementPosition(g,e,t);m=(c-s)/2-(b.x-s),p=(d-l)/2-(b.y-l)}}i.save(),i.translate(u,h),W6(e,a,o)&&(i.filter="none");let f=Ye(e,t);if(Et(e)&&f){let g=document.createElement("canvas"),b=g.getContext("2d"),v=Math.max(nr(s,c),nr(l,d)),y=kp(e);g.width=v*o.exportScale+y*10*o.exportScale,g.height=v*o.exportScale+y*10*o.exportScale,b.translate(g.width/2,g.height/2),b.scale(o.exportScale,o.exportScale),m=e.width/2-(e.x-s),p=e.height/2-(e.y-l),b.rotate(e.angle);let w=nn.canvas(g);b.translate(-m,-p),Pp(e,w,b,a,o),b.translate(m,p),b.rotate(-e.angle);let[,,,,C,A]=De(f,t),T=(s+c)/2-C,I=(l+d)/2-A;b.translate(-T,-I),b.clearRect(-f.width/2,-f.height/2,f.width,f.height),i.scale(1/o.exportScale,1/o.exportScale),i.drawImage(g,-g.width/2,-g.height/2,g.width,g.height)}else i.rotate(e.angle),e.type==="image"&&i.scale(e.scale[0],e.scale[1]),i.translate(-m,-p),Pp(e,r,i,a,o);i.restore()}else{let s=Z6(e,t,a,o),l=i.imageSmoothingEnabled;!o?.shouldCacheIgnoreZoom&&(!e.angle||OB(e.angle))&&(i.imageSmoothingEnabled=!1),K6(s,i,a,o,n),i.imageSmoothingEnabled=l}break}default:throw new Error(`Unimplemented type ${e.type}`)}i.globalAlpha=1},nb=new WeakMap([]),MH=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g}),Xt,Ls=M(()=>{"use strict";D(),Ds(),FB(),Zi(),Xt=class ml{static rg=new ei;static cache=new WeakMap;static get=t=>ml.cache.get(t);static set=(t,n)=>ml.cache.set(t,n);static delete=t=>ml.cache.delete(t);static destroy=()=>{ml.cache=new WeakMap};static generateElementShape=(t,n)=>{let r=n?.isExporting?void 0:ml.get(t);if(r!==void 0)return r;Kp.delete(t);let i=$B(t,ml.rg,n||{isExporting:!1,canvasBackgroundColor:Ge.white,embedsValidationStatus:null});return ml.cache.set(t,i),i}}}),ie,Re,Uf,vt=M(()=>{"use strict";D(),yd(),Jb(),Ao(),te(),Ls(),ie=(e,t,n=!0)=>{let r=!1,{points:i,fileId:a}=t;typeof i<"u"&&(t={...oT(i),...t});for(let o in t){let s=t[o];if(typeof s<"u"){if(e[o]===s&&(typeof s!="object"||s===null||o==="groupIds"||o==="scale"))continue;if(o==="scale"){let l=e[o],c=s;if(l[0]===c[0]&&l[1]===c[1])continue}else if(o==="points"){let l=e[o],c=s;if(l.length===c.length){let d=!1,u=l.length;for(;--u;){let h=l[u],m=c[u];if(h[0]!==m[0]||h[1]!==m[1]){d=!0;break}}if(!d)continue}}e[o]=s,r=!0}}return r&&((typeof t.height<"u"||typeof t.width<"u"||typeof a<"u"||typeof i<"u")&&Xt.delete(e),e.version++,e.versionNonce=Is(),e.updated=rd(),n&&_r.getScene(e)?.informMutation()),e},Re=(e,t)=>{let n=!1;for(let r in t){let i=t[r];if(typeof i<"u"){if(e[r]===i&&(typeof i!="object"||i===null))continue;n=!0}}return n?{...e,...t,updated:rd(),version:e.version+1,versionNonce:Is()}:e},Uf=(e,t)=>(e.version=(t??e.version)+1,e.versionNonce=Is(),e.updated=rd(),e)}),pd,Gf,w4,rb,XT,kh=M(()=>{"use strict";D(),vt(),Se(),ae(),Qt(),te(),pd=e=>Be(e)||Ar(e)?e.points.length<2:e.width===0&&e.height===0,Gf=(e,t,n,r,i)=>{let[a,o,s,l]=xs(e,i),c=Ft({clientX:r.offsetLeft,clientY:r.offsetTop},r),d=Ft({clientX:r.offsetLeft+t,clientY:r.offsetTop+n},r);return c.x<=s&&c.y<=l&&d.x>=a&&d.y>=o},w4=(e,t,n)=>{let r=Math.abs(t),i=Math.abs(n);if(e==="line"||e==="arrow"||e==="freedraw"){let a=Math.round(Math.atan(i/r)/gs)*gs;a===0?n=0:a===Math.PI/2?t=0:n=r*Math.tan(a)*Math.sign(n)||n}else e!=="selection"&&(n=r*Math.sign(n));return{width:t,height:n}},rb=(e,t,n,r)=>{let i=n-e,a=r-t,o=Math.round(Math.atan(a/i)/gs)*gs;if(o===0)a=0;else if(o===Math.PI/2)i=0;else{let s=Math.tan(o),l=-1,c=t-s*e,d=-1/s,u=-1,h=r-d*n,m=(l*h-u*c)/(s*u-d*l),p=(c*d-h*s)/(s*u-d*l);i=m-e,a=p-t}return{width:i,height:a}},XT=e=>{let t={width:e.width,height:e.height,x:e.x,y:e.y};if(e.width<0){let n=Math.abs(e.width);t.width=n,t.x=e.x-n}if(e.height<0){let n=Math.abs(e.height);t.height=n,t.y=e.y-n}return t}}),X6,aN,q6,oN,Q6,d2,ho,ib,oh,ab,qT,QT,dy=M(()=>{"use strict";D(),Qt(),rr(),Oe(),Se(),ae(),X6={mouse:8,pen:16,touch:28},aN=16,q6={e:!0,s:!0,n:!0,w:!0},oN={e:!0,s:!0,n:!0,w:!0},Q6={e:!0,s:!0,n:!0,w:!0,nw:!0,se:!0},d2={e:!0,s:!0,n:!0,w:!0},ho=(e,t,n,r,i,a,o)=>{let[s,l]=Ve(e+n/2,t+r/2,i,a,o);return[s-n/2,l-r/2,n,r]},ib=e=>!(e.viewport.isMobile||e.isTouchScreen&&(GF||YC)),oh=e=>ib(e)?q6:{},ab=([e,t,n,r,i,a],o,s,l,c={},d=4)=>{let u=X6[l],h=u/s.value,m=u/s.value,p=u/s.value,f=u/s.value,g=n-e,b=r-t,v=d/s.value,y=(u-ed*2)/(2*s.value),w={nw:c.nw?void 0:ho(e-v-p+y,t-v-f+y,h,m,i,a,o),ne:c.ne?void 0:ho(n+v-y,t-v-f+y,h,m,i,a,o),sw:c.sw?void 0:ho(e-v-p+y,r+v-y,h,m,i,a,o),se:c.se?void 0:ho(n+v-y,r+v-y,h,m,i,a,o),rotation:c.rotation?void 0:ho(e+g/2-h/2,t-v-f+y-aN/s.value,h,m,i,a,o)},C=5*X6.mouse/s.value;return Math.abs(g)>C&&(c.n||(w.n=ho(e+g/2-h/2,t-v-f+y,h,m,i,a,o)),c.s||(w.s=ho(e+g/2-h/2,r+v-y,h,m,i,a,o))),Math.abs(b)>C&&(c.w||(w.w=ho(e-v-p+y,t+b/2-m/2,h,m,i,a,o)),c.e||(w.e=ho(n+v-y,t+b/2-m/2,h,m,i,a,o))),w},qT=(e,t,n,r="mouse",i=q6)=>{if(e.locked)return{};if(e.type==="freedraw"||Be(e)){if(e.points.length===2){let[,o]=e.points;o[0]===0||o[1]===0?i=d2:o[0]>0&&o[1]<0?i=Q6:o[0]>0&&o[1]>0?i=d2:o[0]<0&&o[1]>0?i=Q6:o[0]<0&&o[1]<0&&(i=d2)}}else he(e)?i=oN:Ae(e)&&(i={...i,rotation:!0});let a=Be(e)?ed+8:ed;return ab(De(e,n,!0),e.angle,t,r,i,a)},QT=(e,t)=>{if(t.editingLinearElement)return!1;if(e.length>1)return!0;let n=e[0];return Be(n)?n.points.length>2:!0}}),u2,sN,S4,C4,h2,lN,T4,J6,cne=M(()=>{"use strict";D(),dy(),Qt(),ae(),cT(),Se(),u2=(e,t,n)=>t>=e[0]&&t<=e[0]+e[2]&&n>=e[1]&&n<=e[1]+e[3],sN=(e,t,n,r,i,a,o,s)=>{if(!n.selectedElementIds[e.id])return!1;let{rotation:l,...c}=qT(e,a,t,o,oh(s));if(l&&u2(l,r,i))return"rotation";let d=Object.keys(c).filter(u=>{let h=c[u];return h?u2(h,r,i):!1});if(d.length>0)return d[0];if(ib(s)){let[u,h,m,p,f,g]=De(e,t);if(e.type!=="text"&&!(Be(e)&&e.points.length<=2)){let b=AE/a.value,v=J6([u-b,h-b],[m+b,p+b],[f,g],us(e.angle));for(let[y,w]of Object.entries(v))if(nh([r,i],w,b))return y}}return!1},S4=(e,t,n,r,i,a,o,s)=>e.reduce((l,c)=>{if(l)return l;let d=sN(c,o,t,n,r,i,a,s);return d?{element:c,transformHandleType:d}:null},null),C4=([e,t,n,r],i,a,o,s,l)=>{let c=ab([e,t,n,r,(e+n)/2,(t+r)/2],0,o,s,oh(l)),d=Object.keys(c).find(u=>{let h=c[u];return h&&u2(h,i,a)});if(d)return d;if(ib(l)){let u=(e+n)/2,h=(t+r)/2,m=AE/o.value,p=J6([e-m,t-m],[n+m,r+m],[u,h],us(0));for(let[f,g]of Object.entries(p))if(nh([i,a],g,m))return f}return!1},h2=["ns","nesw","ew","nwse"],lN=(e,t)=>{let n=h2.indexOf(e);if(n>=0){let r=Math.round(t/(Math.PI/4));e=h2[(n+r)%h2.length]}return e},T4=e=>{let{element:t,transformHandleType:n}=e,r=t&&Math.sign(t.height)*Math.sign(t.width)===-1,i=null;switch(n){case"n":case"s":i="ns";break;case"w":case"e":i="ew";break;case"nw":case"se":r?i="nesw":i="nwse";break;case"ne":case"sw":r?i="nwse":i="nesw";break;case"rotation":return"grab"}return i&&t&&(i=lN(i,t.angle)),i?`${i}-resize`:""},J6=([e,t],[n,r],i,a)=>{let o=En([e,t],a,i),s=En([n,t],a,i),l=En([e,r],a,i),c=En([n,r],a,i);return{n:[o,s],e:[s,c],s:[c,l],w:[l,o]}}}),Dp,AH,cN,dN,m2,uN,hN,I4,mN,kH,PH,DH=M(()=>{"use strict";D(),ae(),Jb(),rr(),Qt(),Se(),vt(),te(),Fa(),yd(),qt(),yr(),Kr(),Dp=e=>e<0?e+2*Math.PI:e>=2*Math.PI?e-2*Math.PI:e,AH=(e,t,n,r,i,a,o,s,l,c,d)=>{if(n.length===1){let[u]=n;return t==="rotation"?(cN(u,r,s,l,i),bo(u,r)):he(u)&&(t==="nw"||t==="ne"||t==="sw"||t==="se")?(uN(u,r,t,a,s,l),bo(u,r)):t&&hN(e,o,u,r,t,a,s,l),!0}else if(n.length>1){if(t==="rotation")return mN(e,n,r,s,l,i,c,d),!0;if(t)return I4(e,n,r,t,a,o,s,l),!0}return!1},cN=(e,t,n,r,i)=>{let[a,o,s,l]=De(e,t),c=(a+s)/2,d=(o+l)/2,u;Ae(e)?u=0:(u=5*Math.PI/2+Math.atan2(r-d,n-c),i&&(u+=gs/2,u-=u%gs),u=Dp(u));let h=vs(e);if(ie(e,{angle:u}),h){let m=_r.getScene(e)?.getElement(h);m&&!Et(e)&&ie(m,{angle:u})}},dN=(e,t,n,r)=>Be(e)||Ar(e)?{points:Wc(0,t,Wc(1,n,e.points,r),r)}:{},m2=(e,t,n)=>{let r=e.width;if(tn(e)){let a=Er(e,t);a&&(r=Ca(a,e))}let i=e.fontSize*(n/r);return i<Y2?null:{size:i}},uN=(e,t,n,r,i,a)=>{let[o,s,l,c,d,u]=De(e,t),[h,m]=Ve(i,a,d,u,-e.angle),p=0,f=0;n.includes("e")&&(p=(h-o)/(l-o)),n.includes("w")&&(p=(l-h)/(l-o)),n.includes("n")&&(f=(c-m)/(c-s)),n.includes("s")&&(f=(m-s)/(c-s));let g=Math.max(p,f);if(g>0){let b=e.width*g,v=e.height*g,y=m2(e,t,b);if(y===null)return;let w=[o,s],C=[l,c],A=[d,u],T=[o,s];if(["n","w","nw"].includes(n)&&(T=[C[0]-Math.abs(b),C[1]-Math.abs(v)]),n==="ne"){let Y=[w[0],C[1]];T=[Y[0],Y[1]-Math.abs(v)]}if(n==="sw"){let Y=[C[0],w[1]];T=[Y[0]-Math.abs(b),Y[1]]}["s","n"].includes(n)&&(T[0]=A[0]-b/2),["e","w"].includes(n)&&(T[1]=A[1]-v/2),r&&(T[0]=A[0]-Math.abs(b)/2,T[1]=A[1]-Math.abs(v)/2);let I=e.angle,k=Rt(T,[d,u],I),R=[T[0]+Math.abs(b)/2,T[1]+Math.abs(v)/2],O=Rt(R,[d,u],I);T=Rt(k,O,-I);let[P,F]=T;ie(e,{fontSize:y.size,width:b,height:v,x:P,y:F})}},hN=(e,t,n,r,i,a,o,s)=>{let l=e.get(n.id),[c,d,u,h]=mf(l,l.width,l.height,!0),m=[c,d],p=[u,h],f=NE(m,p),g=Rt([o,s],f,-l.angle),[b,v,y,w]=mf(n,n.width,n.height,!0),C=y-b,A=w-v,T=p[0]-m[0],I=p[1]-m[1],k=T/C,R=I/A,O={},P=Ye(n,r);i.includes("e")&&(k=(g[0]-m[0])/C),i.includes("s")&&(R=(g[1]-m[1])/A),i.includes("w")&&(k=(p[0]-g[0])/C),i.includes("n")&&(R=(p[1]-g[1])/A);let F=l.width,Y=l.height,j=n.width*k,q=n.height*R;if(a&&(j=2*j-F,q=2*q-Y),t){let mt=Math.abs(j)/F,wn=Math.abs(q)/Y;if(i.length===1&&(q*=mt,j*=wn),i.length===2){let mn=Math.max(mt,wn);j=F*mn*Math.sign(j),q=Y*mn*Math.sign(q)}}if(P){let mt=e.get(P.id);if(mt&&(O={fontSize:mt.fontSize}),t){let wn={...n,width:j,height:q},mn=m2(P,r,Ca(wn,P));if(mn===null)return;O={fontSize:mn.size}}else{let wn=bT(An(P),P.lineHeight),mn=ET(P.fontSize,P.lineHeight);j=Math.max(j,wn),q=Math.max(q,mn)}}let[ne,H,V,$]=mf(l,j,q,!0),B=V-ne,G=$-H,U=[...m];if(["n","w","nw"].includes(i)&&(U=[p[0]-Math.abs(B),p[1]-Math.abs(G)]),i==="ne"){let mt=[m[0],p[1]];U=[mt[0],mt[1]-Math.abs(G)]}if(i==="sw"){let mt=[p[0],m[1]];U=[mt[0]-Math.abs(B),mt[1]]}t&&(["s","n"].includes(i)&&(U[0]=f[0]-B/2),["e","w"].includes(i)&&(U[1]=f[1]-G/2));let Q=j<0,re=q<0;Q&&(i.includes("e")&&(U[0]-=Math.abs(B)),i.includes("w")&&(U[0]+=Math.abs(B))),re&&(i.includes("s")&&(U[1]-=Math.abs(G)),i.includes("n")&&(U[1]+=Math.abs(G))),a&&(U[0]=f[0]-Math.abs(B)/2,U[1]=f[1]-Math.abs(G)/2);let se=l.angle,me=Rt(U,f,se),it=[U[0]+Math.abs(B)/2,U[1]+Math.abs(G)/2],Qe=Rt(it,f,se);U=Rt(me,Qe,-se);let Le=[...U],Pe=l.x-ne,at=l.y-H;Le[0]+=Pe,Le[1]+=at;let xn=Le[0],qh=Le[1],Ql,Jl;(Be(n)||Ar(n))&&(Ql=Wc(1,q,l.points,!0),Jl=Wc(0,j,Ql,!0));let Pn={width:Math.abs(j),height:Math.abs(q),x:xn,y:qh,points:Jl};if("scale"in n&&"scale"in l&&ie(n,{scale:[(Math.sign(V-l.x)||l.scale[0])*l.scale[0],(Math.sign($-l.y)||l.scale[1])*l.scale[1]]}),Et(n)&&P&&t){let mt=Pn.width/n.width*P.fontSize;if(mt<Y2)return;O.fontSize=mt}Pn.width!==0&&Pn.height!==0&&Number.isFinite(Pn.x)&&Number.isFinite(Pn.y)&&(ie(n,Pn),bo(n,r,{newSize:{width:Pn.width,height:Pn.height}}),P&&O!=null&&ie(P,{fontSize:O.fontSize}),Of(n,r,i,t))},I4=(e,t,n,r,i,a,o,s)=>{let l=t.reduce((H,V)=>{let $=e.get(V.id);return $&&H.push({orig:$,latest:V}),H},[]),c=l.reduce((H,{orig:V})=>{if(!Be(V))return H;let $=vs(V);if(!$)return H;let B=e.get($)??null;if(!tn(B))return H;let G=fe.getBoundTextElementPosition(V,B,n);return[...H,{...B,...G}]},[]),{minX:d,minY:u,maxX:h,maxY:m,midX:p,midY:f}=So(l.map(({orig:H})=>H).concat(c)),g=h-d,b=m-u,v=r,y={ne:[d,m],se:[d,u],sw:[h,u],nw:[h,m],e:[d,u+b/2],w:[h,u+b/2],n:[d+g/2,m],s:[d+g/2,u]},[w,C]=i?[p,f]:y[v],A=i?2:1,T=Math.max(Math.abs(o-w)/g||0,Math.abs(s-C)/b||0)*A;if(T===0)return;let I=v.includes("e")||v.includes("w")?Math.abs(o-w)/g*A:1,k=v.includes("n")||v.includes("s")?Math.abs(s-C)/b*A:1,R=a||l.some(H=>H.latest.angle!==0||he(H.latest)||Cz(H.latest));R&&(I=T,k=T);let O={ne:[o<w,s>C],se:[o<w,s<C],sw:[o>w,s<C],nw:[o>w,s>C],e:[o<w,!1],w:[o>w,!1],n:[!1,s>C],s:[!1,s<C]},[P,F]=O[v].map(H=>H?-1:1),Y=P<0,j=F<0,q=[];for(let{orig:H,latest:V}of l){if(he(H)&&tn(H))continue;let $=H.width*I,B=H.height*k,G=Dp(H.angle*P*F),U=Be(H)||Ar(H),Q=H.x-w,re=H.y-C,se=Y&&!U?$:0,me=j&&!U?B:0,it=w+P*(Q*I+se),Qe=C+F*(re*k+me),Le=dN(H,$*P,B*F,!1),Pe={x:it,y:Qe,width:$,height:B,angle:G,...Le};if(Ll(H)&&(Pe.scale=[H.scale[0]*P,H.scale[1]*F]),he(H)){let xn=m2(H,n,$);if(!xn)return;Pe.fontSize=xn.size}let at=e.get(vs(H)??"");if(at)if(R){let xn=at.fontSize*T;if(xn<Y2)return;Pe.boundTextFontSize=xn}else Pe.boundTextFontSize=at.fontSize;q.push({element:V,update:Pe})}let ne=q.map(({element:H})=>H);for(let{element:H,update:{boundTextFontSize:V,...$}}of q){let{width:B,height:G,angle:U}=$;ie(H,$,!1),bo(H,n,{simultaneouslyUpdated:ne,newSize:{width:B,height:G}});let Q=Ye(H,n);Q&&V&&(ie(Q,{fontSize:V,angle:Be(H)?void 0:U},!1),Of(H,n,r,!0))}_r.getScene(q[0].element)?.informMutation()},mN=(e,t,n,r,i,a,o,s)=>{let l=5*Math.PI/2+Math.atan2(i-s,r-o);a&&(l+=gs/2,l-=l%gs),t.filter(c=>!Ae(c)).forEach(c=>{let[d,u,h,m]=De(c,n),p=(d+h)/2,f=(u+m)/2,g=e.get(c.id)?.angle??c.angle,[b,v]=Ve(p,f,o,s,l+g-c.angle);ie(c,{x:c.x+(b-p),y:c.y+(v-f),angle:Dp(l+g)},!1),bo(c,n,{simultaneouslyUpdated:t});let y=Ye(c,n);y&&!Et(c)&&ie(y,{x:y.x+(b-p),y:y.y+(v-f),angle:Dp(l+g)},!1)}),_r.getScene(t[0])?.informMutation()},kH=(e,t,n,r,i)=>{let[a,o,s,l]=t.length===1?De(t[0],n):Bt(t),c=(a+s)/2,d=(o+l)/2,u=t.length===1?t[0].angle:0;switch([r,i]=Ve(r,i,c,d,-u),e){case"n":return Ve(r-(a+s)/2,i-o,0,0,u);case"s":return Ve(r-(a+s)/2,i-l,0,0,u);case"w":return Ve(r-a,i-(o+l)/2,0,0,u);case"e":return Ve(r-s,i-(o+l)/2,0,0,u);case"nw":return Ve(r-a,i-o,0,0,u);case"ne":return Ve(r-s,i-o,0,0,u);case"sw":return Ve(r-a,i-l,0,0,u);case"se":return Ve(r-s,i-l,0,0,u);default:return[0,0]}},PH=(e,t)=>{let[,[n,r]]=t.points;return e==="nw"&&(n<0||r<0)||e==="ne"&&n>=0||e==="sw"&&n<=0||e==="se"&&(n>0||r>0)?"end":"origin"}}),_H,pN,eS,LH,M4,dne=M(()=>{"use strict";D(),Fa(),Qt(),vt(),kh(),qt(),rr(),Se(),_H=(e,t,n,r,i,a,o)=>{let s=new Set(t),l=t.filter(u=>Ae(u)).map(u=>u.id);if(l.length>0)for(let u of i.getNonDeletedElements())u.frameId!==null&&l.includes(u.frameId)&&s.add(u);let c=Bt(Array.from(s).map(u=>e.originalElements.get(u.id)??u)),d=pN(c,n,a,o);s.forEach(u=>{if(eS(e,u,d),!Et(u)){let h=Ye(u,i.getNonDeletedElementsMap());h&&eS(e,h,d)}bo(u,i.getElementsMapIncludingDeleted(),{simultaneouslyUpdated:Array.from(s)})})},pN=(e,t,n,r)=>{let[i,a]=e,o=i+t.x+n.x,s=a+t.y+n.y;if(n.x===0||n.y===0){let[l,c]=Vn(i+t.x,a+t.y,r);n.x===0&&(o=l),n.y===0&&(s=c)}return{x:o-i,y:s-a}},eS=(e,t,n)=>{let r=e.originalElements.get(t.id)??t,i=r.x+n.x,a=r.y+n.y;ie(t,{x:i,y:a})},LH=(e,t,n)=>{let[r,i]=Bt(e);return[t-r,n-i]},M4=(e,t,n,r,i,a,o,s,l,c,d,u=null)=>{l&&e.type!=="selection"&&(d?s=o/d:(Math.abs(a-r)>Math.abs(i-n)?{width:o,height:s}=w4(t,s,i<n?-o:o):{width:o,height:s}=w4(t,o,a<r?-s:s),s<0&&(s=-s)));let h=i<n?n-o:n,m=a<r?r-s:r;c&&(o+=o,s+=s,h=n-o/2,m=r-s/2),o!==0&&s!==0&&ie(e,{x:h+(u?.x??0),y:m+(u?.y??0),width:o,height:s})}}),uy,une=M(()=>{"use strict";D(),It(),uy=(e,t)=>!!(!e.viewModeEnabled&&(e.activeTool.type!=="custom"&&(e.editingElement||e.activeTool.type!=="selection"&&e.activeTool.type!=="eraser"&&e.activeTool.type!=="hand"&&e.activeTool.type!=="laser")||bt(t,e).length))}),hne,RH,OH,NH,ut,ob,tS,$H,JT,Oe=M(()=>{"use strict";D(),kh(),Se(),_s(),Qt(),dy(),cne(),DH(),dne(),Se(),qt(),kh(),une(),hne=e=>e.reduce((t,n)=>t+n.version,0),RH=e=>{let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e[n].versionNonce;return t>>>0},OH=e=>{let t=5381;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)+t+r}return t>>>0},NH=e=>e.filter(t=>!t.isDeleted&&!pd(t)),ut=e=>e.filter(t=>!t.isDeleted),ob=e=>!e.isDeleted,tS=e=>ut(e).map(t=>OE(t.type)?{...t,lastCommittedPoint:null}:t),$H=e=>tS(e),JT=e=>tS(e)}),jf,sb,A4,vn,FH,bt,hy,lt,xd=M(()=>{"use strict";D(),Oe(),Se(),Lr(),te(),kh(),jf=e=>{let t=new Set;return e.forEach(n=>{Ae(n)&&t.add(n.id)}),e.filter(n=>!(n.frameId&&t.has(n.frameId)))},sb=(e,t,n,r=!0)=>{let[i,a,o,s]=De(t,n),l=e.filter(c=>{let[d,u,h,m]=xs(c,n),p=Zr(c,n);if(p){let[f,g,b,v]=xs(p,n);d=Math.max(f,d),u=Math.max(g,u),h=Math.min(b,h),m=Math.min(v,m)}return c.locked===!1&&c.type!=="selection"&&!tn(c)&&i<=d&&a<=u&&o>=h&&s>=m});return l=r?jf(l):l,l=l.filter(c=>{let d=Zr(c,n);return d?xl(c,d,n):!0}),l},A4=(e,t,n,r)=>{let i=new Set(t.map(a=>a.id));return e.filter(a=>{let o=Gf(a,n.width,n.height,n,r);return!i.has(a.id)&&o})},vn=function(){let e=null,t=null,n=null,r=(i,a)=>(n!=null&&i===e&&a.selectedElementIds===t||(n=i.some(o=>a.selectedElementIds[o.id]),e=i,t=a.selectedElementIds),n);return r.clearCache=()=>{e=null,t=null,n=null},r}(),FH=(e,t,n)=>{let r=Array.from(new Set(bt(e,t).map(i=>n(i))));return r.length===1?r[0]:null},bt=(e,t,n)=>{let r=[];for(let i of e.values()){if(t.selectedElementIds[i.id]){r.push(i);continue}if(n?.includeBoundTextElement&&tn(i)&&t.selectedElementIds[i?.containerId]){r.push(i);continue}}if(n?.includeElementsInFrames){let i=[];return r.forEach(a=>{Ae(a)&&vo(e,a.id).forEach(o=>i.push(o)),i.push(a)}),i}return r},hy=(e,t)=>t.editingElement?[t.editingElement]:bt(e,t,{includeBoundTextElement:!0}),lt=(e,t)=>Bn(t.selectedElementIds,e)?t.selectedElementIds:e}),fN,k4,Ph,BH=M(()=>{"use strict";D(),Oe(),te(),fN=(e,t)=>{let[n,r,i,a]=t,{x:o,y:s}=Gi({sceneX:n,sceneY:r},e),{x:l,y:c}=Gi({sceneX:i,sceneY:a},e);return l-o>e.width||c-s>e.height},k4=({scenePoint:e,viewportDimensions:t,zoom:n})=>({scrollX:t.width/2/n.value-e.x,scrollY:t.height/2/n.value-e.y}),Ph=(e,t)=>{if(e=NH(e),!e.length)return{scrollX:0,scrollY:0};let[n,r,i,a]=Bt(e);fN(t,[n,r,i,a])&&([n,r,i,a]=gz(e,Ft({clientX:t.scrollX,clientY:t.scrollY},t)));let o=(n+i)/2,s=(r+a)/2;return k4({scenePoint:{x:o,y:s},viewportDimensions:{width:t.width,height:t.height},zoom:t.zoom})}}),Ml,Al,eI=M(()=>{"use strict";D(),ae(),Ml=e=>Math.max(of,Math.min(e,30)),Al=({viewportX:e,viewportY:t,nextZoom:n},r)=>{let i=e-r.offsetLeft,a=t-r.offsetTop,o=r.zoom.value,s=r.scrollX+(i-i/o),l=r.scrollY+(a-a/o),c=-(i-i/n),d=-(a-a/n);return{scrollX:s+c,scrollY:l+d,zoom:{value:n}}}}),It=M(()=>{"use strict";D(),xd(),BH(),ey(),eI()}),Vl=M(()=>{}),Xe,Gn=M(()=>{"use strict";D(),Vl(),$e(),bd(),jl(),te(),Xe=_a.default.forwardRef((e,t)=>{let{id:n}=Po(),r=_a.default.useRef(null);_a.default.useImperativeHandle(t,()=>r.current);let i=`ToolIcon_size_${e.size}`,[a,o]=(0,_a.useState)(!1),s=(0,_a.useRef)(!0),l=async d=>{let u="onClick"in e&&e.onClick?.(d);if(Uh(u))try{o(!0),await u}catch(h){if(h instanceof w1)console.warn(h);else throw h}finally{s.current&&o(!1)}};(0,_a.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let c=(0,_a.useRef)(null);if(e.type==="button"||e.type==="icon"||e.type==="submit"){let d=e.type==="icon"?"button":e.type;return(0,Hi.jsxs)("button",{className:X("ToolIcon_type_button",i,e.className,e.visible&&!e.hidden?"ToolIcon_type_button--show":"ToolIcon_type_button--hide",{ToolIcon:!e.hidden,"ToolIcon--selected":e.selected,"ToolIcon--plain":e.type==="icon"}),style:e.style,"data-testid":e["data-testid"],hidden:e.hidden,title:e.title,"aria-label":e["aria-label"],type:d,onClick:l,ref:r,disabled:a||e.isLoading||!!e.disabled,children:[(e.icon||e.label)&&(0,Hi.jsxs)("div",{className:"ToolIcon__icon","aria-hidden":"true","aria-disabled":!!e.disabled,children:[e.icon||e.label,e.keyBindingLabel&&(0,Hi.jsx)("span",{className:"ToolIcon__keybinding",children:e.keyBindingLabel}),e.isLoading&&(0,Hi.jsx)(Co,{})]}),e.showAriaLabel&&(0,Hi.jsxs)("div",{className:"ToolIcon__label",children:[e["aria-label"]," ",a&&(0,Hi.jsx)(Co,{})]}),e.children]})}return(0,Hi.jsxs)("label",{className:X("ToolIcon",e.className),title:e.title,onPointerDown:d=>{c.current=d.pointerType||null,e.onPointerDown?.({pointerType:d.pointerType||null})},onPointerUp:()=>{requestAnimationFrame(()=>{c.current=null})},children:[(0,Hi.jsx)("input",{className:`ToolIcon_type_radio ${i}`,type:"radio",name:e.name,"aria-label":e["aria-label"],"aria-keyshortcuts":e["aria-keyshortcuts"],"data-testid":e["data-testid"],id:`${n}-${e.id}`,onChange:()=>{e.onChange?.({pointerType:c.current})},checked:e.checked,ref:r}),(0,Hi.jsxs)("div",{className:"ToolIcon__icon",children:[e.icon,e.keyBindingLabel&&(0,Hi.jsx)("span",{className:"ToolIcon__keybinding",children:e.keyBindingLabel})]})]})}),Xe.defaultProps={visible:!0,className:"",size:"medium"},Xe.displayName="ToolButton"}),mne={};y1(mne,{AlignBottomIcon:()=>bb,AlignLeftIcon:()=>yb,AlignRightIcon:()=>vb,AlignTopIcon:()=>Eb,ArrowIcon:()=>hI,ArrowRightIcon:()=>sh,ArrowheadArrowIcon:()=>YI,ArrowheadBarIcon:()=>KI,ArrowheadCircleIcon:()=>Ib,ArrowheadCircleOutlineIcon:()=>ZI,ArrowheadDiamondIcon:()=>QI,ArrowheadDiamondOutlineIcon:()=>JI,ArrowheadNoneIcon:()=>VI,ArrowheadTriangleIcon:()=>XI,ArrowheadTriangleOutlineIcon:()=>qI,BringForwardIcon:()=>mb,BringToFrontIcon:()=>fb,CenterHorizontallyIcon:()=>wb,CenterVerticallyIcon:()=>xb,CloseIcon:()=>Yl,DeviceDesktopIcon:()=>LM,DiamondIcon:()=>dI,DiscordIcon:()=>xI,DistributeHorizontallyIcon:()=>DI,DistributeVerticallyIcon:()=>_I,DotsIcon:()=>rI,DuplicateIcon:()=>Wf,EdgeRoundIcon:()=>WI,EdgeSharpIcon:()=>jI,EllipseIcon:()=>uI,EmbedIcon:()=>yI,EraserIcon:()=>EI,ExcalLogo:()=>zH,ExportIcon:()=>_h,ExportImageIcon:()=>gy,ExternalLinkIcon:()=>db,FillCrossHatchIcon:()=>OI,FillHachureIcon:()=>RI,FillSolidIcon:()=>NI,FillZigZagIcon:()=>LI,FontFamilyCodeIcon:()=>aM,FontFamilyNormalIcon:()=>iM,FontSizeExtraLargeIcon:()=>rM,FontSizeLargeIcon:()=>nM,FontSizeMediumIcon:()=>tM,FontSizeSmallIcon:()=>eM,FreedrawIcon:()=>I1,GithubIcon:()=>fy,GroupIcon:()=>Sb,HamburgerMenuIcon:()=>py,HelpIcon:()=>M1,HelpIconThin:()=>vI,HomeIcon:()=>tI,ImageIcon:()=>gI,LibraryIcon:()=>my,LineIcon:()=>mI,LinkIcon:()=>Zf,LoadIcon:()=>A1,LockedIcon:()=>T1,MagicIcon:()=>k1,MagicIconThin:()=>oU,MoonIcon:()=>Vf,OpenAIIcon:()=>Kf,PenModeIcon:()=>pI,PinIcon:()=>iI,PlusIcon:()=>nI,RectangleIcon:()=>cI,RedoIcon:()=>hb,SelectionIcon:()=>lI,SendBackwardIcon:()=>pb,SendToBackIcon:()=>gb,SloppinessArchitectIcon:()=>HI,SloppinessArtistIcon:()=>UI,SloppinessCartoonistIcon:()=>GI,StrokeStyleDashedIcon:()=>BI,StrokeStyleDottedIcon:()=>zI,StrokeStyleSolidIcon:()=>tU,StrokeWidthBaseIcon:()=>Tb,StrokeWidthBoldIcon:()=>$I,StrokeWidthExtraBoldIcon:()=>FI,SunIcon:()=>Yf,TextAlignBottomIcon:()=>dM,TextAlignCenterIcon:()=>sM,TextAlignLeftIcon:()=>oM,TextAlignMiddleIcon:()=>uM,TextAlignRightIcon:()=>lM,TextAlignTopIcon:()=>cM,TextIcon:()=>fI,TrashIcon:()=>zl,UndoIcon:()=>ub,UngroupIcon:()=>Cb,UnlockedIcon:()=>Dh,WelcomeScreenHelpArrow:()=>oI,WelcomeScreenMenuArrow:()=>aI,WelcomeScreenTopToolbarArrow:()=>sI,XBrandIcon:()=>wI,ZoomInIcon:()=>lb,ZoomOutIcon:()=>cb,ZoomResetIcon:()=>bI,abacusIcon:()=>IM,alertTriangleIcon:()=>fM,arrowBarToLeftIcon:()=>sU,boltIcon:()=>Cy,brainIcon:()=>vM,brainIconThin:()=>xM,bucketFillIcon:()=>xf,checkIcon:()=>SI,clipboard:()=>HH,clockIcon:()=>wM,clone:()=>QH,coffeeIcon:()=>_M,copyIcon:()=>yy,createIcon:()=>z,cutIcon:()=>mM,done:()=>AI,downloadIcon:()=>Ab,eraser:()=>nU,exportToFileIcon:()=>MI,exportToPlus:()=>YH,extraToolsIcon:()=>EM,eyeClosedIcon:()=>yM,eyeDropperIcon:()=>gM,eyeIcon:()=>P1,file:()=>eU,flipHorizontal:()=>AM,flipVertical:()=>MM,fontSizeIcon:()=>Mb,frameToolIcon:()=>vy,fullscreenIcon:()=>bM,gridIcon:()=>OM,handIcon:()=>by,helpIcon:()=>pM,iconFillColor:()=>li,laserPointerToolIcon:()=>wy,magnetIcon:()=>DM,menu:()=>jH,mermaidLogoIcon:()=>xy,microphoneIcon:()=>SM,microphoneMutedIcon:()=>CM,paintIcon:()=>kb,palette:()=>II,playerPlayIcon:()=>rU,playerStopFilledIcon:()=>iU,pngIcon:()=>PM,publishIcon:()=>hM,questionCircle:()=>kI,resetZoom:()=>KH,save:()=>CI,saveAs:()=>TI,searchIcon:()=>Sy,selectAllIcon:()=>TM,share:()=>PI,shareIOS:()=>VH,shareWindows:()=>ZH,shield:()=>JH,start:()=>XH,stop:()=>qH,svgIcon:()=>kM,tablerCheckIcon:()=>aU,usersIcon:()=>Ey,warning:()=>WH,youtubeIcon:()=>RM,zoomAreaIcon:()=>wf,zoomIn:()=>UH,zoomOut:()=>GH});var li,nS,z,ue,xe,tI,my,nI,rI,iI,Dh,T1,aI,oI,sI,zH,lI,cI,dI,uI,hI,mI,pI,I1,fI,gI,EI,lb,cb,bI,zl,yI,Wf,Vf,Yf,py,_h,M1,vI,db,fy,xI,wI,SI,Zf,CI,TI,A1,HH,II,xf,gy,MI,UH,GH,AI,jH,ub,hb,kI,PI,WH,VH,YH,ZH,KH,mb,pb,fb,gb,Eb,bb,yb,vb,DI,_I,xb,wb,Ey,XH,qH,Yl,QH,JH,eU,Sb,Cb,LI,RI,OI,NI,Tb,$I,FI,tU,BI,zI,HI,UI,GI,jI,WI,VI,YI,Ib,ZI,KI,XI,qI,QI,JI,eM,tM,nM,rM,Mb,iM,aM,oM,sM,lM,cM,dM,uM,hM,nU,by,Ab,yy,mM,pM,rU,iU,aU,fM,gM,EM,vy,xy,sh,wy,k1,oU,Kf,bM,P1,yM,vM,xM,Sy,wM,SM,CM,Cy,TM,IM,MM,AM,kb,wf,kM,PM,DM,_M,LM,sU,RM,OM,pe=M(()=>{"use strict";D(),ae(),li=e=>"var(--icon-fill-color)",nS=e=>e===ze.LIGHT?At.white:"#1e1e1e",z=(e,t=512)=>{let{width:n=512,height:r=n,mirror:i,style:a,...o}=typeof t=="number"?{width:t}:t;return(0,E.jsx)("svg",{"aria-hidden":"true",focusable:"false",role:"img",viewBox:`0 0 ${n} ${r}`,className:X({"rtl-mirror":i}),style:a,...o,children:typeof e=="string"?(0,E.jsx)("path",{fill:"currentColor",d:e}):e})},ue={width:24,height:24,fill:"none",strokeWidth:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},xe={width:20,height:20,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},tI=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("polyline",{points:"5 12 3 12 12 3 21 12 19 12"}),(0,E.jsx)("path",{d:"M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7"}),(0,E.jsx)("path",{d:"M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6"})]}),ue),my=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),(0,E.jsx)("path",{d:"M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),(0,E.jsx)("line",{x1:"3",y1:"6",x2:"3",y2:"19"}),(0,E.jsx)("line",{x1:"12",y1:"6",x2:"12",y2:"19"}),(0,E.jsx)("line",{x1:"21",y1:"6",x2:"21",y2:"19"})]}),ue),nI=z((0,E.jsxs)("svg",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,E.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),ue),rI=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,E.jsx)("circle",{cx:"12",cy:"19",r:"1"}),(0,E.jsx)("circle",{cx:"12",cy:"5",r:"1"})]}),ue),iI=z((0,E.jsxs)("svg",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M9 4v6l-2 4v2h10v-2l-2 -4v-6"}),(0,E.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"21"}),(0,E.jsx)("line",{x1:"8",y1:"4",x2:"16",y2:"4"})]}),ue),Dh=z((0,E.jsxs)("g",{children:[(0,E.jsx)("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,E.jsx)("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,E.jsx)("mask",{id:"UnlockedIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:6,y:1,width:9,height:9,children:(0,E.jsx)("path",{stroke:"none",d:"M6.399 9.561V5.175c0-.93.401-1.823 1.116-2.48a3.981 3.981 0 0 1 2.693-1.028c1.01 0 1.98.37 2.694 1.027.715.658 1.116 1.55 1.116 2.481",fill:"#fff"})}),(0,E.jsx)("g",{mask:"url(#UnlockedIcon)",children:(0,E.jsx)("path",{stroke:"none",d:"M5.149 9.561v1.25h2.5v-1.25h-2.5Zm5.06-7.894V.417v1.25Zm2.559 3.508v1.25h2.5v-1.25h-2.5ZM7.648 8.51V5.175h-2.5V8.51h2.5Zm0-3.334c0-.564.243-1.128.713-1.561L6.668 1.775c-.959.883-1.52 2.104-1.52 3.4h2.5Zm.713-1.561a2.732 2.732 0 0 1 1.847-.697v-2.5c-1.31 0-2.585.478-3.54 1.358L8.36 3.614Zm1.847-.697c.71 0 1.374.26 1.847.697l1.694-1.839a5.231 5.231 0 0 0-3.54-1.358v2.5Zm1.847.697c.47.433.713.997.713 1.561h2.5c0-1.296-.56-2.517-1.52-3.4l-1.693 1.839Z",fill:"currentColor"})})]}),xe),T1=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z"}),(0,E.jsx)("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z"}),(0,E.jsx)("path",{d:"M6.667 8.333V5.417C6.667 3.806 8.159 2.5 10 2.5c1.841 0 3.333 1.306 3.333 2.917v2.916"})]}),xe),aI=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{d:"M38.5 83.5c-14-2-17.833-10.473-21-22.5C14.333 48.984 12 22 12 12.5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),(0,E.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M12.005 10.478c1.92 3.495 3.838 7 7.905 14.423m-7.905-14.423c3.11 5.683 6.23 11.368 7.905 14.423m0 0c-3.68.226-7.35.455-13.91.85m13.91-.85c-5.279.33-10.566.647-13.91.85m0 0c1.936-4.931 3.882-9.86 6.005-15.273M6 25.75c2.069-5.257 4.135-10.505 6.005-15.272",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:41,height:94,fill:"none"}),oI=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{d:"M18.026 1.232c-5.268 13.125-5.548 33.555 3.285 42.311 8.823 8.75 33.31 12.304 42.422 13.523",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),(0,E.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m72.181 59.247-13.058-10-2.948 13.62 16.006-3.62Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M72.181 59.247c-3.163-2.429-6.337-4.856-13.058-10m13.058 10c-5.145-3.936-10.292-7.882-13.058-10m0 0c-.78 3.603-1.563 7.196-2.948 13.62m2.948-13.62c-1.126 5.168-2.24 10.346-2.948 13.62m0 0c5.168-1.166 10.334-2.343 16.006-3.62m-16.006 3.62c5.51-1.248 11.01-2.495 16.006-3.62",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:85,height:71,fill:"none"}),sI=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{d:"M1 77c14-2 31.833-11.973 35-24 3.167-12.016-6-35-9.5-43.5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),(0,E.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m24.165 1.093-2.132 16.309 13.27-4.258-11.138-12.05Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M24.165 1.093c-.522 3.953-1.037 7.916-2.132 16.309m2.131-16.309c-.835 6.424-1.68 12.854-2.13 16.308m0 0c3.51-1.125 7.013-2.243 13.27-4.257m-13.27 4.257c5.038-1.608 10.08-3.232 13.27-4.257m0 0c-3.595-3.892-7.197-7.777-11.14-12.05m11.14 12.05c-3.837-4.148-7.667-8.287-11.14-12.05",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:38,height:78,fill:"none"}),zH=z((0,E.jsx)("g",{fill:"currentColor",children:(0,E.jsx)("path",{d:"M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z",fill:"currentColor"})}),{width:40,height:40,fill:"none"}),lI=z((0,E.jsxs)("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M6 6l4.153 11.793a0.365 .365 0 0 0 .331 .207a0.366 .366 0 0 0 .332 -.207l2.184 -4.793l4.787 -1.994a0.355 .355 0 0 0 .213 -.323a0.355 .355 0 0 0 -.213 -.323l-11.787 -4.36z"}),(0,E.jsx)("path",{d:"M13.5 13.5l4.5 4.5"})]}),{fill:"none",width:22,height:22,strokeWidth:1.25}),cI=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})]}),ue),dI=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M10.5 20.4l-6.9 -6.9c-.781 -.781 -.781 -2.219 0 -3l6.9 -6.9c.781 -.781 2.219 -.781 3 0l6.9 6.9c.781 .781 .781 2.219 0 3l-6.9 6.9c-.781 .781 -2.219 .781 -3 0z"})]}),ue),uI=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("circle",{cx:"12",cy:"12",r:"9"})]}),ue),hI=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,E.jsx)("line",{x1:"15",y1:"16",x2:"19",y2:"12"}),(0,E.jsx)("line",{x1:"15",y1:"8",x2:"19",y2:"12"})]}),ue),mI=z((0,E.jsx)("path",{d:"M4.167 10h11.666",strokeWidth:"1.5"}),xe),pI=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z"}),(0,E.jsx)("path",{d:"M16 7h4"}),(0,E.jsx)("path",{d:"M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3"})]}),ue),I1=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{clipRule:"evenodd",d:"m7.643 15.69 7.774-7.773a2.357 2.357 0 1 0-3.334-3.334L4.31 12.357a3.333 3.333 0 0 0-.977 2.357v1.953h1.953c.884 0 1.732-.352 2.357-.977Z"}),(0,E.jsx)("path",{d:"m11.25 5.417 3.333 3.333"})]}),xe),fI=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"20",x2:"7",y2:"20"}),(0,E.jsx)("line",{x1:"14",y1:"20",x2:"21",y2:"20"}),(0,E.jsx)("line",{x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,E.jsx)("line",{x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,E.jsx)("polyline",{points:"5 20 11 4 13 4 20 20"})]}),ue),gI=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M12.5 6.667h.01"}),(0,E.jsx)("path",{d:"M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z"}),(0,E.jsx)("path",{d:"m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166"}),(0,E.jsx)("path",{d:"m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667"})]}),xe),EI=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3"}),(0,E.jsx)("path",{d:"M18 13.3l-6.3 -6.3"})]}),ue),lb=z((0,E.jsx)("path",{strokeWidth:"1.25",d:"M10 4.167v11.666M4.167 10h11.666"}),xe),cb=z((0,E.jsx)("path",{d:"M5 10h10",strokeWidth:"1.25"}),xe),bI=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M21 21l-6 -6"}),(0,E.jsx)("path",{d:"M3.268 12.043a7.017 7.017 0 0 0 6.634 4.957a7.012 7.012 0 0 0 7.043 -6.131a7 7 0 0 0 -5.314 -7.672a7.021 7.021 0 0 0 -8.241 4.403"}),(0,E.jsx)("path",{d:"M3 4v4h4"})]}),ue),zl=z((0,E.jsx)("path",{strokeWidth:"1.25",d:"M3.333 5.833h13.334M8.333 9.167v5M11.667 9.167v5M4.167 5.833l.833 10c0 .92.746 1.667 1.667 1.667h6.666c.92 0 1.667-.746 1.667-1.667l.833-10M7.5 5.833v-2.5c0-.46.373-.833.833-.833h3.334c.46 0 .833.373.833.833v2.5"}),xe),yI=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("polyline",{points:"12 16 18 10 12 4"}),(0,E.jsx)("polyline",{points:"8 4 2 10 8 16"})]}),xe),Wf=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M14.375 6.458H8.958a2.5 2.5 0 0 0-2.5 2.5v5.417a2.5 2.5 0 0 0 2.5 2.5h5.417a2.5 2.5 0 0 0 2.5-2.5V8.958a2.5 2.5 0 0 0-2.5-2.5Z"}),(0,E.jsx)("path",{clipRule:"evenodd",d:"M11.667 3.125c.517 0 .986.21 1.325.55.34.338.55.807.55 1.325v1.458H8.333c-.485 0-.927.185-1.26.487-.343.312-.57.75-.609 1.24l-.005 5.357H5a1.87 1.87 0 0 1-1.326-.55 1.87 1.87 0 0 1-.549-1.325V5c0-.518.21-.987.55-1.326.338-.34.807-.549 1.325-.549h6.667Z"})]}),xe),Vf=z((0,E.jsx)("path",{clipRule:"evenodd",d:"M10 2.5h.328a6.25 6.25 0 0 0 6.6 10.372A7.5 7.5 0 1 1 10 2.493V2.5Z",stroke:"currentColor"}),xe),Yf=z((0,E.jsx)("g",{stroke:"currentColor",strokeLinejoin:"round",children:(0,E.jsx)("path",{d:"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM10 4.167V2.5M14.167 5.833l1.166-1.166M15.833 10H17.5M14.167 14.167l1.166 1.166M10 15.833V17.5M5.833 14.167l-1.166 1.166M5 10H3.333M5.833 5.833 4.667 4.667"})}),{...xe,strokeWidth:1.5}),py=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),(0,E.jsx)("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),(0,E.jsx)("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]}),ue),_h=z((0,E.jsx)("path",{strokeWidth:"1.25",d:"M3.333 14.167v1.666c0 .92.747 1.667 1.667 1.667h10c.92 0 1.667-.746 1.667-1.667v-1.666M5.833 9.167 10 13.333l4.167-4.166M10 3.333v10"}),xe),M1=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,E.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),(0,E.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),ue),vI=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,E.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),(0,E.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),ue),db=z((0,E.jsx)("path",{strokeWidth:"1.25",d:"M9.167 5.833H5.833c-1.254 0-2.5 1.282-2.5 2.5v5.834c0 1.283 1.252 2.5 2.5 2.5h5.834c1.251 0 2.5-1.25 2.5-2.5v-3.334M8.333 11.667l8.334-8.334M12.5 3.333h4.167V7.5"}),xe),fy=z((0,E.jsx)("path",{d:"M7.5 15.833c-3.583 1.167-3.583-2.083-5-2.5m10 4.167v-2.917c0-.833.083-1.166-.417-1.666 2.334-.25 4.584-1.167 4.584-5a3.833 3.833 0 0 0-1.084-2.667 3.5 3.5 0 0 0-.083-2.667s-.917-.25-2.917 1.084a10.25 10.25 0 0 0-5.166 0C5.417 2.333 4.5 2.583 4.5 2.583a3.5 3.5 0 0 0-.083 2.667 3.833 3.833 0 0 0-1.084 2.667c0 3.833 2.25 4.75 4.584 5-.5.5-.5 1-.417 1.666V17.5",strokeWidth:"1.25"}),xe),xI=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M7.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM12.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM6.25 6.25c2.917-.833 4.583-.833 7.5 0M5.833 13.75c2.917.833 5.417.833 8.334 0"}),(0,E.jsx)("path",{d:"M12.917 14.167c0 .833 1.25 2.5 1.666 2.5 1.25 0 2.361-1.39 2.917-2.5.556-1.39.417-4.861-1.25-9.584-1.214-.846-2.5-1.116-3.75-1.25l-.833 2.084M7.083 14.167c0 .833-1.13 2.5-1.526 2.5-1.191 0-2.249-1.39-2.778-2.5-.529-1.39-.397-4.861 1.19-9.584 1.157-.846 2.318-1.116 3.531-1.25l.833 2.084"})]}),xe),wI=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 4l11.733 16h4.267l-11.733 -16z"}),(0,E.jsx)("path",{d:"M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772"})]}),ue),SI=z((0,E.jsx)("polyline",{fill:"none",stroke:"currentColor",points:"20 6 9 17 4 12"}),{width:24,height:24}),Zf=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M8.333 11.667a2.917 2.917 0 0 0 4.167 0l3.333-3.334a2.946 2.946 0 1 0-4.166-4.166l-.417.416"}),(0,E.jsx)("path",{d:"M11.667 8.333a2.917 2.917 0 0 0-4.167 0l-3.333 3.334a2.946 2.946 0 0 0 4.166 4.166l.417-.416"})]}),xe),CI=z("M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z",{width:448,height:512}),TI=z("M252 54L203 8a28 27 0 00-20-8H28C12 0 0 12 0 27v195c0 15 12 26 28 26h204c15 0 28-11 28-26V73a28 27 0 00-8-19zM130 213c-21 0-37-16-37-36 0-19 16-35 37-35 20 0 37 16 37 35 0 20-17 36-37 36zm56-169v56c0 4-4 6-7 6H44c-4 0-7-2-7-6V42c0-4 3-7 7-7h133l4 2 3 2a7 7 0 012 5z M296 201l87 95-188 205-78 9c-10 1-19-8-18-20l9-84zm141-14l-41-44a31 31 0 00-46 0l-38 41 87 95 38-42c13-14 13-36 0-50z",{width:448,height:512}),A1=z((0,E.jsx)("path",{d:"m9.257 6.351.183.183H15.819c.34 0 .727.182 1.051.506.323.323.505.708.505 1.05v5.819c0 .316-.183.7-.52 1.035-.337.338-.723.522-1.037.522H4.182c-.352 0-.74-.181-1.058-.5-.318-.318-.499-.705-.499-1.057V5.182c0-.351.181-.736.5-1.054.32-.321.71-.503 1.057-.503H6.53l2.726 2.726Z",strokeWidth:"1.25"}),xe),HH=z("M384 112v352c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h80c0-35.29 28.71-64 64-64s64 28.71 64 64h80c26.51 0 48 21.49 48 48zM192 40c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24m96 114v-20a6 6 0 0 0-6-6H102a6 6 0 0 0-6 6v20a6 6 0 0 0 6 6h180a6 6 0 0 0 6-6z",{width:384,height:512}),II=z("M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"),xf=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z"}),(0,E.jsx)("path",{d:"M13.737 9.737c2.299 -2.3 3.23 -5.095 2.081 -6.245c-1.15 -1.15 -3.945 -.217 -6.244 2.082c-2.3 2.299 -3.231 5.095 -2.082 6.244c1.15 1.15 3.946 .218 6.245 -2.081z"}),(0,E.jsx)("path",{d:"M7.492 11.818c.362 .362 .768 .676 1.208 .934l6.895 4.047c1.078 .557 2.255 -.075 3.692 -1.512c1.437 -1.437 2.07 -2.614 1.512 -3.692c-.372 -.718 -1.72 -3.017 -4.047 -6.895a6.015 6.015 0 0 0 -.934 -1.208"})]}),ue),gy=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M15 8h.01"}),(0,E.jsx)("path",{d:"M12 20h-5a3 3 0 0 1 -3 -3v-10a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v5"}),(0,E.jsx)("path",{d:"M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4"}),(0,E.jsx)("path",{d:"M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598"}),(0,E.jsx)("path",{d:"M19 16v6"}),(0,E.jsx)("path",{d:"M22 19l-3 3l-3 -3"})]}),ue),MI=z("M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z",{width:512,height:512}),UH=z("M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512}),GH=z("M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512}),AI=z("M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"),jH=z("M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"),ub=z((0,E.jsx)("path",{d:"M7.5 10.833 4.167 7.5 7.5 4.167M4.167 7.5h9.166a3.333 3.333 0 0 1 0 6.667H12.5",strokeWidth:"1.25"}),xe),hb=z((0,E.jsx)("path",{d:"M12.5 10.833 15.833 7.5 12.5 4.167M15.833 7.5H6.667a3.333 3.333 0 1 0 0 6.667H7.5",strokeWidth:"1.25"}),xe),kI=z("M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z",{mirror:!0}),PI=z((0,E.jsx)("path",{d:"M5 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 7.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 17.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM7.25 8.917l5.5-2.834M7.25 11.083l5.5 2.834",strokeWidth:"1.5"}),xe),WH=z("M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"),VH=z("M16 5l-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z",{width:24,height:24}),YH=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1"}),(0,E.jsx)("path",{d:"M12 14v-11"}),(0,E.jsx)("path",{d:"M9 6l3 -3l3 3"})]}),ue),ZH=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{fill:"currentColor",d:"M40 5.6v6.1l-4.1.7c-8.9 1.4-16.5 6.9-20.6 15C13 32 10.9 43 12.4 43c.4 0 2.4-1.3 4.4-3 5-3.9 12.1-7 18.2-7.7l5-.6v12.8l11.2-11.3L62.5 22 51.2 10.8 40-.5v6.1zm10.2 22.6L44 34.5v-6.8l-6.9.6c-3.9.3-9.8 1.7-13.2 3.1-3.5 1.4-6.5 2.4-6.7 2.2-.9-1 3-7.5 6.4-10.8C28 18.6 34.4 16 40.1 16c3.7 0 3.9-.1 3.9-3.2V9.5l6.2 6.3 6.3 6.2-6.3 6.2z"}),(0,E.jsx)("path",{stroke:"currentColor",fill:"currentColor",d:"M0 36v20h48v-6.2c0-6 0-6.1-2-4.3-1.1 1-2 2.9-2 4.2V52H4V34c0-17.3-.1-18-2-18s-2 .7-2 20z"})]}),{width:64,height:64}),KH=z((0,E.jsx)("path",{stroke:"currentColor",strokeWidth:"40",fill:"currentColor",d:"M148 560a318 318 0 0 0 522 110 316 316 0 0 0 0-450 316 316 0 0 0-450 0c-11 11-21 22-30 34v4h47c25 0 46 21 46 46s-21 45-46 45H90c-13 0-25-6-33-14-9-9-14-20-14-33V156c0-25 20-45 45-45s45 20 45 45v32l1 1a401 401 0 0 1 623 509l212 212a42 42 0 0 1-59 59L698 757A401 401 0 0 1 65 570a42 42 0 0 1 83-10z"}),{width:1024}),mb=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{d:"M13.889 4.167H8.333c-.767 0-1.389.622-1.389 1.389v5.555c0 .767.622 1.389 1.39 1.389h5.555c.767 0 1.389-.622 1.389-1.389V5.556c0-.767-.622-1.39-1.39-1.39Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M12.5 12.5v1.389a1.389 1.389 0 0 1-1.389 1.389H5.556a1.389 1.389 0 0 1-1.39-1.39V8.334a1.389 1.389 0 0 1 1.39-1.389h1.388"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),pb=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.944 12.5H12.5v1.389a1.389 1.389 0 0 1-1.389 1.389H5.556a1.389 1.389 0 0 1-1.39-1.39V8.334a1.389 1.389 0 0 1 1.39-1.389h1.388",fill:"currentColor"}),(0,E.jsx)("path",{d:"M13.889 4.167H8.333c-.767 0-1.389.621-1.389 1.389v5.555c0 .767.622 1.389 1.39 1.389h5.555c.767 0 1.389-.622 1.389-1.389V5.556c0-.768-.622-1.39-1.39-1.39Z"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),fb=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M8.775 6.458h2.45a2.316 2.316 0 0 1 2.317 2.316v2.452a2.316 2.316 0 0 1-2.316 2.316H8.774a2.316 2.316 0 0 1-2.317-2.316V8.774a2.316 2.316 0 0 1 2.317-2.316Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M5.441 9.792h2.451a2.316 2.316 0 0 1 2.316 2.316v2.45a2.316 2.316 0 0 1-2.316 2.317h-2.45a2.316 2.316 0 0 1-2.317-2.316v-2.451a2.316 2.316 0 0 1 2.316-2.316ZM12.108 3.125h2.45a2.316 2.316 0 0 1 2.317 2.316v2.451a2.316 2.316 0 0 1-2.316 2.316h-2.451a2.316 2.316 0 0 1-2.316-2.316v-2.45a2.316 2.316 0 0 1 2.316-2.317Z"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),gb=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",children:[(0,E.jsx)("path",{d:"M5.441 9.792h2.451a2.316 2.316 0 0 1 2.316 2.316v2.45a2.316 2.316 0 0 1-2.316 2.317h-2.45a2.316 2.316 0 0 1-2.317-2.316v-2.451a2.316 2.316 0 0 1 2.316-2.316Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,E.jsx)("path",{d:"M5.441 9.792h2.451a2.316 2.316 0 0 1 2.316 2.316v2.45a2.316 2.316 0 0 1-2.316 2.317h-2.45a2.316 2.316 0 0 1-2.317-2.316v-2.451a2.316 2.316 0 0 1 2.316-2.316Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,E.jsx)("mask",{id:"SendToBackIcon",fill:"#fff",children:(0,E.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.167 5.833v2.06a2.941 2.941 0 0 0 2.94 2.94h2.06v.393a2.941 2.941 0 0 1-2.941 2.94h-.393v-2.058a2.941 2.941 0 0 0-2.94-2.941h-2.06v-.393a2.941 2.941 0 0 1 2.942-2.94h.392Z"})}),(0,E.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.167 5.833v2.06a2.941 2.941 0 0 0 2.94 2.94h2.06v.393a2.941 2.941 0 0 1-2.941 2.94h-.393v-2.058a2.941 2.941 0 0 0-2.94-2.941h-2.06v-.393a2.941 2.941 0 0 1 2.942-2.94h.392Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M9.167 5.833h1.25v-1.25h-1.25v1.25Zm5 5h1.25v-1.25h-1.25v1.25Zm-3.334 3.334h-1.25v1.25h1.25v-1.25Zm-5-5h-1.25v1.25h1.25v-1.25Zm2.084-3.334v2.06h2.5v-2.06h-2.5Zm0 2.06a4.191 4.191 0 0 0 4.19 4.19v-2.5a1.691 1.691 0 0 1-1.69-1.69h-2.5Zm4.19 4.19h2.06v-2.5h-2.06v2.5Zm.81-1.25v.393h2.5v-.393h-2.5Zm0 .393c0 .933-.758 1.69-1.691 1.69v2.5a4.191 4.191 0 0 0 4.19-4.19h-2.5Zm-1.691 1.69h-.393v2.5h.393v-2.5Zm.857 1.25v-2.058h-2.5v2.059h2.5Zm0-2.058a4.191 4.191 0 0 0-4.19-4.191v2.5c.933 0 1.69.757 1.69 1.69h2.5Zm-4.19-4.191h-2.06v2.5h2.06v-2.5Zm-.81 1.25v-.393h-2.5v.393h2.5Zm0-.393c0-.934.758-1.69 1.692-1.69v-2.5a4.191 4.191 0 0 0-4.192 4.19h2.5Zm1.692-1.69h.392v-2.5h-.392v2.5Z",fill:"currentColor",mask:"url(#SendToBackIcon)"}),(0,E.jsx)("path",{d:"M12.108 3.125h2.45a2.316 2.316 0 0 1 2.317 2.316v2.451a2.316 2.316 0 0 1-2.316 2.316h-2.451a2.316 2.316 0 0 1-2.316-2.316v-2.45a2.316 2.316 0 0 1 2.316-2.317Z",stroke:"currentColor",strokeWidth:"1.25"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),Eb=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M3.333 3.333h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v7.083c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V8.125c0-.92-.746-1.667-1.666-1.667ZM6.875 6.458h-.417c-.92 0-1.666.747-1.666 1.667v3.75c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667v-3.75c0-.92-.747-1.667-1.667-1.667Z"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),bb=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M6.875 3.125h-.417c-.92 0-1.666.746-1.666 1.667v7.083c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667V4.792c0-.92-.747-1.667-1.667-1.667ZM13.542 5.817h-.417c-.92 0-1.667.747-1.667 1.667v4.391c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V7.484c0-.92-.746-1.667-1.666-1.667Z"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),yb=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M15.208 4.792H8.125c-.92 0-1.667.746-1.667 1.666v.417c0 .92.747 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM12.516 11.458H8.125c-.92 0-1.667.746-1.667 1.667v.417c0 .92.747 1.666 1.667 1.666h4.391c.92 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.667-1.667Z"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),vb=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M16.667 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M11.875 4.792H4.792c-.92 0-1.667.746-1.667 1.666v.417c0 .92.746 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM11.683 11.458H7.292c-.92 0-1.667.746-1.667 1.667v.417c0 .92.746 1.666 1.667 1.666h4.39c.921 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.666-1.667Z"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),DI=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M16.667 3.333v13.334M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M14.375 10.208v-.416c0-.92-.746-1.667-1.667-1.667H7.292c-.92 0-1.667.746-1.667 1.667v.416c0 .92.746 1.667 1.667 1.667h5.416c.92 0 1.667-.746 1.667-1.667Z"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),_I=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M3.333 3.333h13.334M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M10.208 5.625h-.416c-.92 0-1.667.746-1.667 1.667v5.416c0 .92.746 1.667 1.667 1.667h.416c.92 0 1.667-.746 1.667-1.667V7.292c0-.92-.746-1.667-1.667-1.667Z"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),xb=z((0,E.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M1.667 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M8.333 10h3.334",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M15.417 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M6.875 4.792h-.417c-.92 0-1.666.746-1.666 1.666v7.084c0 .92.746 1.666 1.666 1.666h.417c.92 0 1.667-.746 1.667-1.666V6.458c0-.92-.747-1.666-1.667-1.666ZM13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v3.75c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667v-3.75c0-.92-.746-1.667-1.666-1.667Z"})]}),xe),wb=z((0,E.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M10 18.333v-2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M10 11.667V8.333",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M10 4.583V1.667",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M4.792 13.125v.417c0 .92.746 1.666 1.666 1.666h7.084c.92 0 1.666-.746 1.666-1.666v-.417c0-.92-.746-1.667-1.666-1.667H6.458c-.92 0-1.666.746-1.666 1.667ZM6.458 6.458v.417c0 .92.747 1.667 1.667 1.667h3.75c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666h-3.75c-.92 0-1.667.746-1.667 1.666Z"})]}),xe),Ey=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,E.jsx)("path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"}),(0,E.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"}),(0,E.jsx)("path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85"})]}),ue),XH=z("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z"),qH=z("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z"),Yl=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,E.jsx)("path",{d:"M15 5 5 15M5 5l10 10"})}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),QH=z("M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z",{mirror:!0}),JH=z("M11.553 22.894a.998.998 0 00.894 0s3.037-1.516 5.465-4.097C19.616 16.987 21 14.663 21 12V5a1 1 0 00-.649-.936l-8-3a.998.998 0 00-.702 0l-8 3A1 1 0 003 5v7c0 2.663 1.384 4.987 3.088 6.797 2.428 2.581 5.465 4.097 5.465 4.097zm-1.303-8.481l6.644-6.644a.856.856 0 111.212 1.212l-7.25 7.25a.856.856 0 01-1.212 0l-3.75-3.75a.856.856 0 111.212-1.212l3.144 3.144z",{width:24}),eU=z("M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm32-48h224V288l-23.5-23.5c-4.7-4.7-12.3-4.7-17 0L176 352l-39.5-39.5c-4.7-4.7-12.3-4.7-17 0L80 352v64zm48-240c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z",{width:384,height:512}),Sb=Tr.default.memo(({theme:e})=>z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{d:"M25 26H111V111H25",fill:li(e)}),(0,E.jsx)("path",{d:"M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z",stroke:li(e),strokeWidth:"2"}),(0,E.jsx)("path",{d:"M100 100H160V160H100",fill:li(e)}),(0,E.jsx)("path",{d:"M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z",stroke:li(e),strokeWidth:"2"}),(0,E.jsxs)("g",{fill:nS(e),stroke:li(e),strokeWidth:"6",children:[(0,E.jsx)("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"2.5",y:"149.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"147.5",y:"2.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),Cb=Tr.default.memo(({theme:e})=>z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{d:"M25 26H111V111H25",fill:li(e)}),(0,E.jsx)("path",{d:"M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z",stroke:li(e),strokeWidth:"2"}),(0,E.jsx)("path",{d:"M100 100H160V160H100",fill:li(e)}),(0,E.jsx)("path",{d:"M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z",stroke:li(e),strokeWidth:"2"}),(0,E.jsxs)("g",{fill:nS(e),stroke:li(e),strokeWidth:"6",children:[(0,E.jsx)("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"78.5",y:"149.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"147.5",y:"78.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"105.5",y:"2.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"2.5",y:"102.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),LI=z((0,E.jsx)("g",{strokeWidth:1.25,children:(0,E.jsx)("path",{d:"M5.879 2.625h8.242a3.27 3.27 0 0 1 3.254 3.254v8.242a3.27 3.27 0 0 1-3.254 3.254H5.88a3.27 3.27 0 0 1-3.254-3.254V5.88A3.27 3.27 0 0 1 5.88 2.626l-.001-.001ZM4.518 16.118l7.608-12.83m.198 13.934 5.051-9.897M2.778 9.675l9.348-6.387m-7.608 12.83 12.857-8.793"})}),xe),RI=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,E.jsx)("mask",{id:"FillHachureIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:2,y:2,width:16,height:16,children:(0,E.jsx)("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.25"})}),(0,E.jsx)("g",{mask:"url(#FillHachureIcon)",children:(0,E.jsx)("path",{d:"M2.258 15.156 15.156 2.258M7.324 20.222 20.222 7.325m-20.444 5.35L12.675-.222m-8.157 18.34L17.416 5.22",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})]}),xe),OI=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",children:[(0,E.jsx)("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,E.jsx)("mask",{id:"FillCrossHatchIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:-1,y:-1,width:22,height:22,children:(0,E.jsx)("path",{d:"M2.426 15.044 15.044 2.426M7.383 20 20 7.383M0 12.617 12.617 0m-7.98 17.941L17.256 5.324m-2.211 12.25L2.426 4.956M20 12.617 7.383 0m5.234 20L0 7.383m17.941 7.98L5.324 2.745",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,E.jsx)("g",{mask:"url(#FillCrossHatchIcon)",children:(0,E.jsx)("path",{d:"M14.121 2H5.88A3.879 3.879 0 0 0 2 5.879v8.242A3.879 3.879 0 0 0 5.879 18h8.242A3.879 3.879 0 0 0 18 14.121V5.88A3.879 3.879 0 0 0 14.121 2Z",fill:"currentColor"})})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),NI=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("g",{clipPath:"url(#a)",children:(0,E.jsx)("path",{d:"M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z",stroke:"currentColor",strokeWidth:"1.25"})}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),{...xe,fill:"currentColor"}),Tb=z((0,E.jsx)(E.Fragment,{children:(0,E.jsx)("path",{d:"M4.167 10h11.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),xe),$I=z((0,E.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),xe),FI=z((0,E.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"3.75",strokeLinecap:"round",strokeLinejoin:"round"}),xe),tU=Tr.default.memo(({theme:e})=>z((0,E.jsx)("path",{d:"M6 10H34",stroke:li(e),strokeWidth:2,fill:"none",strokeLinecap:"round"}),{width:40,height:20})),BI=z((0,E.jsxs)("g",{strokeWidth:"2",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M5 12h2"}),(0,E.jsx)("path",{d:"M17 12h2"}),(0,E.jsx)("path",{d:"M11 12h2"})]}),ue),zI=z((0,E.jsxs)("g",{strokeWidth:"2",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 12v.01"}),(0,E.jsx)("path",{d:"M8 12v.01"}),(0,E.jsx)("path",{d:"M12 12v.01"}),(0,E.jsx)("path",{d:"M16 12v.01"}),(0,E.jsx)("path",{d:"M20 12v.01"})]}),ue),HI=z((0,E.jsx)("path",{d:"M2.5 12.038c1.655-.885 5.9-3.292 8.568-4.354 2.668-1.063.101 2.821 1.32 3.104 1.218.283 5.112-1.814 5.112-1.814",strokeWidth:"1.25"}),xe),UI=z((0,E.jsx)("path",{d:"M2.5 12.563c1.655-.886 5.9-3.293 8.568-4.355 2.668-1.062.101 2.822 1.32 3.105 1.218.283 5.112-1.814 5.112-1.814m-13.469 2.23c2.963-1.586 6.13-5.62 7.468-4.998 1.338.623-1.153 4.11-.132 5.595 1.02 1.487 6.133-1.43 6.133-1.43",strokeWidth:"1.25"}),xe),GI=z((0,E.jsx)("path",{d:"M2.5 11.936c1.737-.879 8.627-5.346 10.42-5.268 1.795.078-.418 5.138.345 5.736.763.598 3.53-1.789 4.235-2.147M2.929 9.788c1.164-.519 5.47-3.28 6.987-3.114 1.519.165 1 3.827 2.121 4.109 1.122.281 3.839-2.016 4.606-2.42",strokeWidth:"1.25"}),xe),jI=z((0,E.jsxs)("svg",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{d:"M3.33334 9.99998V6.66665C3.33334 6.04326 3.33403 4.9332 3.33539 3.33646C4.95233 3.33436 6.06276 3.33331 6.66668 3.33331H10"}),(0,E.jsx)("path",{d:"M13.3333 3.33331V3.34331"}),(0,E.jsx)("path",{d:"M16.6667 3.33331V3.34331"}),(0,E.jsx)("path",{d:"M16.6667 6.66669V6.67669"}),(0,E.jsx)("path",{d:"M16.6667 10V10.01"}),(0,E.jsx)("path",{d:"M3.33334 13.3333V13.3433"}),(0,E.jsx)("path",{d:"M16.6667 13.3333V13.3433"}),(0,E.jsx)("path",{d:"M3.33334 16.6667V16.6767"}),(0,E.jsx)("path",{d:"M6.66666 16.6667V16.6767"}),(0,E.jsx)("path",{d:"M10 16.6667V16.6767"}),(0,E.jsx)("path",{d:"M13.3333 16.6667V16.6767"}),(0,E.jsx)("path",{d:"M16.6667 16.6667V16.6767"})]}),xe),WI=z((0,E.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 12v-4a4 4 0 0 1 4 -4h4"}),(0,E.jsx)("line",{x1:"16",y1:"4",x2:"16",y2:"4.01"}),(0,E.jsx)("line",{x1:"20",y1:"4",x2:"20",y2:"4.01"}),(0,E.jsx)("line",{x1:"20",y1:"8",x2:"20",y2:"8.01"}),(0,E.jsx)("line",{x1:"20",y1:"12",x2:"20",y2:"12.01"}),(0,E.jsx)("line",{x1:"4",y1:"16",x2:"4",y2:"16.01"}),(0,E.jsx)("line",{x1:"20",y1:"16",x2:"20",y2:"16.01"}),(0,E.jsx)("line",{x1:"4",y1:"20",x2:"4",y2:"20.01"}),(0,E.jsx)("line",{x1:"8",y1:"20",x2:"8",y2:"20.01"}),(0,E.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"20.01"}),(0,E.jsx)("line",{x1:"16",y1:"20",x2:"16",y2:"20.01"}),(0,E.jsx)("line",{x1:"20",y1:"20",x2:"20",y2:"20.01"})]}),ue),VI=z((0,E.jsx)("path",{d:"M6 10H34",stroke:"currentColor",strokeWidth:2,fill:"none"}),{width:40,height:20}),YI=Tr.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",strokeWidth:2,fill:"none",children:[(0,E.jsx)("path",{d:"M34 10H6M34 10L27 5M34 10L27 15"}),(0,E.jsx)("path",{d:"M27.5 5L34.5 10L27.5 15"})]}),{width:40,height:20})),Ib=Tr.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",children:[(0,E.jsx)("path",{d:"M32 10L6 10",strokeWidth:2}),(0,E.jsx)("circle",{r:"4",transform:"matrix(-1 0 0 1 30 10)"})]}),{width:40,height:20})),ZI=Tr.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,children:[(0,E.jsx)("path",{d:"M26 10L6 10"}),(0,E.jsx)("circle",{r:"4",transform:"matrix(-1 0 0 1 30 10)"})]}),{width:40,height:20})),KI=Tr.default.memo(({flip:e=!1})=>z((0,E.jsx)("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",children:(0,E.jsx)("path",{d:"M34 10H5.99996M34 10L34 5M34 10L34 15",stroke:"currentColor",strokeWidth:2,fill:"none"})}),{width:40,height:20})),XI=Tr.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",children:[(0,E.jsx)("path",{d:"M32 10L6 10",strokeWidth:2}),(0,E.jsx)("path",{d:"M27.5 5.5L34.5 10L27.5 14.5L27.5 5.5"})]}),{width:40,height:20})),qI=Tr.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,strokeLinejoin:"round",children:[(0,E.jsx)("path",{d:"M6,9.5H27"}),(0,E.jsx)("path",{d:"M27,5L34,10L27,14Z",fill:"none"})]}),{width:40,height:20})),QI=Tr.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",strokeWidth:2,children:[(0,E.jsx)("path",{d:"M6,9.5H20"}),(0,E.jsx)("path",{d:"M27,5L34,10L27,14L20,9.5Z"})]}),{width:40,height:20})),JI=Tr.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",strokeWidth:2,children:[(0,E.jsx)("path",{d:"M6,9.5H20"}),(0,E.jsx)("path",{d:"M27,5L34,10L27,14L20,9.5Z"})]}),{width:40,height:20})),eM=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("g",{clipPath:"url(#a)",children:(0,E.jsx)("path",{d:"M14.167 6.667a3.333 3.333 0 0 0-3.334-3.334H9.167a3.333 3.333 0 0 0 0 6.667h1.666a3.333 3.333 0 0 1 0 6.667H9.167a3.333 3.333 0 0 1-3.334-3.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),tM=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("g",{clipPath:"url(#a)",children:(0,E.jsx)("path",{d:"M5 16.667V3.333L10 15l5-11.667v13.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),nM=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("g",{clipPath:"url(#a)",children:(0,E.jsx)("path",{d:"M5.833 3.333v13.334h8.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),rM=z((0,E.jsx)(E.Fragment,{children:(0,E.jsx)("path",{d:"m1.667 3.333 6.666 13.334M8.333 3.333 1.667 16.667M11.667 3.333v13.334h6.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),xe),Mb=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M3 7v-2h13v2"}),(0,E.jsx)("path",{d:"M10 5v14"}),(0,E.jsx)("path",{d:"M12 19h-4"}),(0,E.jsx)("path",{d:"M15 13v-1h6v1"}),(0,E.jsx)("path",{d:"M18 12v7"}),(0,E.jsx)("path",{d:"M17 19h2"})]}),ue),iM=z((0,E.jsx)(E.Fragment,{children:(0,E.jsx)("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,E.jsx)("path",{d:"M5.833 16.667v-10a3.333 3.333 0 0 1 3.334-3.334h1.666a3.333 3.333 0 0 1 3.334 3.334v10M5.833 10.833h8.334"})})}),xe),aM=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,E.jsx)("path",{d:"M5.833 6.667 2.5 10l3.333 3.333M14.167 6.667 17.5 10l-3.333 3.333M11.667 3.333 8.333 16.667"})}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),oM=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,E.jsx)("line",{x1:"4",y1:"12",x2:"12",y2:"12"}),(0,E.jsx)("line",{x1:"4",y1:"16",x2:"16",y2:"16"})]}),ue),sM=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,E.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),(0,E.jsx)("line",{x1:"6",y1:"16",x2:"18",y2:"16"})]}),ue),lM=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,E.jsx)("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),(0,E.jsx)("line",{x1:"8",y1:"16",x2:"20",y2:"16"})]}),ue),cM=Tr.default.memo(({theme:e})=>z((0,E.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"4",x2:"20",y2:"4"}),(0,E.jsx)("rect",{x:"9",y:"8",width:"6",height:"12",rx:"2"})]}),ue)),dM=Tr.default.memo(({theme:e})=>z((0,E.jsxs)("g",{strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"20",x2:"20",y2:"20"}),(0,E.jsx)("rect",{x:"9",y:"4",width:"6",height:"12",rx:"2"})]}),ue)),uM=Tr.default.memo(({theme:e})=>z((0,E.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"12",x2:"9",y2:"12"}),(0,E.jsx)("line",{x1:"15",y1:"12",x2:"20",y2:"12"}),(0,E.jsx)("rect",{x:"9",y:"6",width:"6",height:"12",rx:"2"})]}),ue)),hM=z((0,E.jsx)("path",{d:"M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z",fill:"currentColor"}),{width:640,height:512}),nU=z((0,E.jsx)("path",{d:"M480 416C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H150.6C133.7 480 117.4 473.3 105.4 461.3L25.37 381.3C.3786 356.3 .3786 315.7 25.37 290.7L258.7 57.37C283.7 32.38 324.3 32.38 349.3 57.37L486.6 194.7C511.6 219.7 511.6 260.3 486.6 285.3L355.9 416H480zM265.4 416L332.7 348.7L195.3 211.3L70.63 336L150.6 416L265.4 416z"})),by=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5"}),(0,E.jsx)("path",{d:"M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5"}),(0,E.jsx)("path",{d:"M14 5.5a1.5 1.5 0 0 1 3 0v6.5"}),(0,E.jsx)("path",{d:"M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47"})]}),ue),Ab=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),(0,E.jsx)("path",{d:"M7 11l5 5l5 -5"}),(0,E.jsx)("path",{d:"M12 4l0 12"})]}),ue),yy=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"}),(0,E.jsx)("path",{d:"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"})]}),ue),mM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M7 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,E.jsx)("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,E.jsx)("path",{d:"M9.15 14.85l8.85 -10.85"}),(0,E.jsx)("path",{d:"M6 4l8.85 10.85"})]}),ue),pM=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),(0,E.jsx)("path",{d:"M12 17l0 .01"}),(0,E.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),ue),rU=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M7 4v16l13 -8z"})]}),ue),iU=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z",strokeWidth:"0",fill:"currentColor"})]}),ue),aU=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M5 12l5 5l10 -10"})]}),ue),fM=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z"}),(0,E.jsx)("path",{d:"M12 9v4"}),(0,E.jsx)("path",{d:"M12 17h.01"})]}),ue),gM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M11 7l6 6"}),(0,E.jsx)("path",{d:"M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z"})]}),ue),EM=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M12 3l-4 7h8z"}),(0,E.jsx)("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,E.jsx)("path",{d:"M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"})]}),ue),vy=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 7l16 0"}),(0,E.jsx)("path",{d:"M4 17l16 0"}),(0,E.jsx)("path",{d:"M7 4l0 16"}),(0,E.jsx)("path",{d:"M17 4l0 16"})]}),ue),xy=z((0,E.jsx)("path",{fill:"currentColor",d:"M407.48,111.18C335.587,108.103 269.573,152.338 245.08,220C220.587,152.338 154.573,108.103 82.68,111.18C80.285,168.229 107.577,222.632 154.74,254.82C178.908,271.419 193.35,298.951 193.27,328.27L193.27,379.13L296.9,379.13L296.9,328.27C296.816,298.953 311.255,271.42 335.42,254.82C382.596,222.644 409.892,168.233 407.48,111.18Z"})),sh=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M4.16602 10H15.8327"}),(0,E.jsx)("path",{d:"M12.5 13.3333L15.8333 10"}),(0,E.jsx)("path",{d:"M12.5 6.66666L15.8333 9.99999"})]}),xe),wy=z((0,E.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",transform:"rotate(90 10 10)",children:[(0,E.jsx)("path",{clipRule:"evenodd",d:"m9.644 13.69 7.774-7.773a2.357 2.357 0 0 0-3.334-3.334l-7.773 7.774L8 12l1.643 1.69Z"}),(0,E.jsx)("path",{d:"m13.25 3.417 3.333 3.333M10 10l2-2M5 15l3-3M2.156 17.894l1-1M5.453 19.029l-.144-1.407M2.377 11.887l.866 1.118M8.354 17.273l-1.194-.758M.953 14.652l1.408.13"})]}),20),k1=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z"}),(0,E.jsx)("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),(0,E.jsx)("path",{d:"M15 6l3 3"}),(0,E.jsx)("path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"}),(0,E.jsx)("path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"})]}),ue),oU=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z"}),(0,E.jsx)("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),(0,E.jsx)("path",{d:"M15 6l3 3"}),(0,E.jsx)("path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"}),(0,E.jsx)("path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"})]}),ue),Kf=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35"}),(0,E.jsx)("path",{d:"M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946"}),(0,E.jsx)("path",{d:"M6 7.63c-1.391 -.236 -2.787 .395 -3.534 1.689a3.474 3.474 0 0 0 1.271 4.745l4.263 2.514l6 -3.348"}),(0,E.jsx)("path",{d:"M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45"}),(0,E.jsx)("path",{d:"M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946"}),(0,E.jsx)("path",{d:"M18 16.302c1.391 .236 2.787 -.395 3.534 -1.689a3.474 3.474 0 0 0 -1.271 -4.745l-4.308 -2.514l-5.955 3.42"})]}),ue),bM=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2"}),(0,E.jsx)("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),(0,E.jsx)("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),(0,E.jsx)("path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2"})]}),ue),P1=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"}),(0,E.jsx)("path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"})]}),ue),yM=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828"}),(0,E.jsx)("path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"}),(0,E.jsx)("path",{d:"M3 3l18 18"})]}),ue),vM=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8"}),(0,E.jsx)("path",{d:"M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8"}),(0,E.jsx)("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),(0,E.jsx)("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),(0,E.jsx)("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),(0,E.jsx)("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),ue),xM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8"}),(0,E.jsx)("path",{d:"M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8"}),(0,E.jsx)("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),(0,E.jsx)("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),(0,E.jsx)("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),(0,E.jsx)("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),ue),Sy=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),(0,E.jsx)("path",{d:"M21 21l-6 -6"})]}),ue),wM=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M20.984 12.53a9 9 0 1 0 -7.552 8.355"}),(0,E.jsx)("path",{d:"M12 7v5l3 3"}),(0,E.jsx)("path",{d:"M19 16l-2 3h4l-2 3"})]}),ue),SM=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M9 2m0 3a3 3 0 0 1 3 -3h0a3 3 0 0 1 3 3v5a3 3 0 0 1 -3 3h0a3 3 0 0 1 -3 -3z"}),(0,E.jsx)("path",{d:"M5 10a7 7 0 0 0 14 0"}),(0,E.jsx)("path",{d:"M8 21l8 0"}),(0,E.jsx)("path",{d:"M12 17l0 4"})]}),ue),CM=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M3 3l18 18"}),(0,E.jsx)("path",{d:"M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1 -.13 .874m-2 2a3 3 0 0 1 -3.87 -2.872v-1"}),(0,E.jsx)("path",{d:"M5 10a7 7 0 0 0 10.846 5.85m2 -2a6.967 6.967 0 0 0 1.152 -3.85"}),(0,E.jsx)("path",{d:"M8 21l8 0"}),(0,E.jsx)("path",{d:"M12 17l0 4"})]}),ue),Cy=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11"})]}),ue),TM=z((0,E.jsxs)("g",{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M8 8m0 1a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1z"}),(0,E.jsx)("path",{d:"M12 20v.01"}),(0,E.jsx)("path",{d:"M16 20v.01"}),(0,E.jsx)("path",{d:"M8 20v.01"}),(0,E.jsx)("path",{d:"M4 20v.01"}),(0,E.jsx)("path",{d:"M4 16v.01"}),(0,E.jsx)("path",{d:"M4 12v.01"}),(0,E.jsx)("path",{d:"M4 8v.01"}),(0,E.jsx)("path",{d:"M4 4v.01"}),(0,E.jsx)("path",{d:"M8 4v.01"}),(0,E.jsx)("path",{d:"M12 4v.01"}),(0,E.jsx)("path",{d:"M16 4v.01"}),(0,E.jsx)("path",{d:"M20 4v.01"}),(0,E.jsx)("path",{d:"M20 8v.01"}),(0,E.jsx)("path",{d:"M20 12v.01"}),(0,E.jsx)("path",{d:"M20 16v.01"}),(0,E.jsx)("path",{d:"M20 20v.01"})]}),ue),IM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M5 3v18"}),(0,E.jsx)("path",{d:"M19 21v-18"}),(0,E.jsx)("path",{d:"M5 7h14"}),(0,E.jsx)("path",{d:"M5 15h14"}),(0,E.jsx)("path",{d:"M8 13v4"}),(0,E.jsx)("path",{d:"M11 13v4"}),(0,E.jsx)("path",{d:"M16 13v4"}),(0,E.jsx)("path",{d:"M14 5v4"}),(0,E.jsx)("path",{d:"M11 5v4"}),(0,E.jsx)("path",{d:"M8 5v4"}),(0,E.jsx)("path",{d:"M3 21h18"})]}),ue),MM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M3 12l18 0"}),(0,E.jsx)("path",{d:"M7 16l10 0l-10 5l0 -5"}),(0,E.jsx)("path",{d:"M7 8l10 0l-10 -5l0 5"})]}),ue),AM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M12 3l0 18"}),(0,E.jsx)("path",{d:"M16 7l0 10l5 0l-5 -10"}),(0,E.jsx)("path",{d:"M8 7l0 10l-5 0l5 -10"})]}),ue),kb=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M5 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z"}),(0,E.jsx)("path",{d:"M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2"}),(0,E.jsx)("path",{d:"M10 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"})]}),ue),wf=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0"}),(0,E.jsx)("path",{d:"M22 22l-3 -3"}),(0,E.jsx)("path",{d:"M6 18h-1a2 2 0 0 1 -2 -2v-1"}),(0,E.jsx)("path",{d:"M3 11v-1"}),(0,E.jsx)("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),(0,E.jsx)("path",{d:"M10 3h1"}),(0,E.jsx)("path",{d:"M15 3h1a2 2 0 0 1 2 2v1"})]}),ue),kM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),(0,E.jsx)("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),(0,E.jsx)("path",{d:"M4 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75"}),(0,E.jsx)("path",{d:"M10 15l2 6l2 -6"}),(0,E.jsx)("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"})]}),ue),PM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),(0,E.jsx)("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),(0,E.jsx)("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"}),(0,E.jsx)("path",{d:"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6"}),(0,E.jsx)("path",{d:"M11 21v-6l3 6v-6"})]}),ue),DM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 13v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a2 2 0 0 0 6 0v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a8 8 0 0 1 -16 0"}),(0,E.jsx)("path",{d:"M4 8l5 0"}),(0,E.jsx)("path",{d:"M15 8l4 0"})]}),ue),_M=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M3 14c.83 .642 2.077 1.017 3.5 1c1.423 .017 2.67 -.358 3.5 -1c.83 -.642 2.077 -1.017 3.5 -1c1.423 -.017 2.67 .358 3.5 1"}),(0,E.jsx)("path",{d:"M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),(0,E.jsx)("path",{d:"M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),(0,E.jsx)("path",{d:"M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z"}),(0,E.jsx)("path",{d:"M16.746 16.726a3 3 0 1 0 .252 -5.555"})]}),ue),LM=z((0,E.jsxs)("g",{stroke:"currentColor",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M3 5a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-16a1 1 0 0 1-1-1v-10zM7 20h10M9 16v4M15 16v4"})]}),{...ue,strokeWidth:1.5}),sU=z((0,E.jsxs)("g",{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M10 12l10 0"}),(0,E.jsx)("path",{d:"M10 12l4 4"}),(0,E.jsx)("path",{d:"M10 12l4 -4"}),(0,E.jsx)("path",{d:"M4 4l0 16"})]}),ue),RM=z((0,E.jsxs)("g",{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z"}),(0,E.jsx)("path",{d:"M10 9l5 3l-5 3z"})]}),ue),OM=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M3 6h18"}),(0,E.jsx)("path",{d:"M3 12h18"}),(0,E.jsx)("path",{d:"M3 18h18"}),(0,E.jsx)("path",{d:"M6 3v18"}),(0,E.jsx)("path",{d:"M12 3v18"}),(0,E.jsx)("path",{d:"M18 3v18"})]}),ue)}),gN,rS,Ty,cU=M(()=>{"use strict";D(),It(),ke(),Gn(),de(),Tt(),Oe(),vt(),Kr(),yr(),Fa(),Se(),te(),pe(),ht(),gN=(e,t)=>{let n=new Set(bt(e.filter(r=>Ae(r)),t).map(r=>r.id));return{elements:e.map(r=>t.selectedElementIds[r.id]?Re(r,{isDeleted:!0}):r.frameId&&n.has(r.frameId)?Re(r,{isDeleted:!0}):tn(r)&&t.selectedElementIds[r.containerId]?Re(r,{isDeleted:!0}):r),appState:{...t,selectedElementIds:{},selectedGroupIds:{}}}},rS=(e,t)=>{if(e.editingGroupId){let n=yn(ut(t),e.editingGroupId);if(n.length)return{...e,selectedElementIds:{[n[0].id]:!0}}}return e},Ty=oe({name:"deleteSelectedElements",label:"labels.delete",icon:zl,trackEvent:{category:"element",action:"delete"},perform:(e,t,n,r)=>{if(t.editingLinearElement){let{elementId:o,selectedPointsIndices:s,startBindingElement:l,endBindingElement:c}=t.editingLinearElement,d=r.scene.getNonDeletedElementsMap(),u=fe.getElement(o,d);if(!u||s==null)return!1;if(u.points.length<2){let m=e.map(f=>f.id===u.id?Re(f,{isDeleted:!0}):f),p=rS(t,m);return{elements:m,appState:{...p,editingLinearElement:null},storeAction:Z.CAPTURE}}let h={startBindingElement:s?.includes(0)?null:l,endBindingElement:s?.includes(u.points.length-1)?null:c};return fe.deletePoints(u,s),{elements:e,appState:{...t,editingLinearElement:{...t.editingLinearElement,...h,selectedPointsIndices:s?.[0]>0?[s[0]-1]:[0]}},storeAction:Z.CAPTURE}}let{elements:i,appState:a}=gN(e,t);return hT(i,e.filter(({id:o})=>t.selectedElementIds[o])),a=rS(a,i),{elements:i,appState:{...a,activeTool:hn(t,{type:"selection"}),multiElement:null,activeEmbeddable:null},storeAction:vn(ut(e),t)?Z.CAPTURE:Z.NONE}},keyTest:(e,t,n)=>(e.key===N.BACKSPACE||e.key===N.DELETE)&&!e[N.CTRL_OR_CMD],PanelComponent:({elements:e,appState:t,updateData:n})=>(0,lU.jsx)(Xe,{type:"button",icon:zl,title:x("labels.delete"),"aria-label":x("labels.delete"),onClick:()=>n(null),visible:vn(ut(e),t)})})});function EN(e,t,n,r){let i=ve(bt(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),a={regularElements:[],frameChildren:new Map},o=new Set;for(let c of e)i.has(c.id)&&Ae(c)&&o.add(c.id);for(let c of e)if(i.has(c.id))if(Ae(c)||c.frameId&&o.has(c.frameId))a.regularElements.push(c);else if(!c.frameId)a.regularElements.push(c);else{let d=a.frameChildren.get(c.frameId)||[];d.push(c),a.frameChildren.set(c.frameId,d)}let s=e,l=Array.from(a.frameChildren.entries());for(let[c,d]of l)s=r(e,t,n,c,d);return r(s,t,n,null,a.regularElements)}var p2,iS,bN,aS,yN,vN,oS,sS,lS,dU,uU,hU,mU,pne=M(()=>{"use strict";D(),Se(),$a(),Kr(),It(),yd(),te(),p2=(e,t)=>e.frameId===t||e.id===t,iS=(e,t,n)=>{let r=[],i=[],a=null,o=-1,s=ve(n||bt(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0}));for(;++o<e.length;){let l=e[o];s.get(l.id)?(i.length&&(r=r.concat(i),i=[]),r.push(o),a=o+1):l.isDeleted&&a===o?(a=o+1,i.push(o)):i=[]}return r},bN=e=>{let t=0;return e.reduce((n,r,i)=>(i>0&&e[i-1]!==r-1&&(t=++t),(n[t]||(n[t]=[])).push(r),n),[])},aS=(e,t,n)=>{if("containerId"in e&&e.containerId)if(n==="left"){let r=_r.getScene(e).getElement(e.containerId);if(r)return t.indexOf(r)}else return t.indexOf(e);else{let r=e.boundElements?.find(i=>i.type!=="arrow")?.id;if(r){if(n==="left")return t.indexOf(e);let i=_r.getScene(e).getElement(r);if(i)return t.indexOf(i)}}},yN=(e,t)=>{let n=-1,r=-1;return e.forEach((i,a)=>{p2(i,t)&&(n===-1&&(n=a),r=a)}),n===-1?[]:e.slice(n,r+1)},vN=(e,t,n,r,i)=>{let a=t[n],o=u=>u.isDeleted?!1:i?u.frameId===i:e.editingGroupId?u.groupIds.includes(e.editingGroupId):!0,s=r==="left"?S5(t,u=>o(u),Math.max(0,n-1)):w5(t,u=>o(u),n+1),l=t[s];if(!l)return-1;if(e.editingGroupId){if(a?.groupIds.join("")===l?.groupIds.join(""))return aS(l,t,r)??s;if(!l?.groupIds.includes(e.editingGroupId))return-1}if(!i&&(l.frameId||Ae(l))){let u=yN(t,l.frameId||l.id);return r==="left"?t.indexOf(u[0]):t.indexOf(u[u.length-1])}if(!l.groupIds.length)return aS(l,t,r)??s;let c=e.editingGroupId?l.groupIds[l.groupIds.indexOf(e.editingGroupId)-1]:l.groupIds[l.groupIds.length-1],d=yn(t,c);return d.length?r==="left"?t.indexOf(d[0]):t.indexOf(d[d.length-1]):s},oS=(e,t)=>t.reduce((n,r)=>{let i=e[r];return n.set(i.id,i),n},new Map),sS=(e,t,n)=>{let r=iS(e,t),i=oS(e,r),a=bN(r);n==="right"&&(a=a.reverse());let o=new Set(r.filter(s=>Ae(e[s])).map(s=>e[s].id));return a.forEach((s,l)=>{let c=s[0],d=s[s.length-1],u=n==="left"?c:d,h=s.some(v=>{let y=e[v];return y.frameId&&o.has(y.frameId)})?null:e[u]?.frameId,m=vN(t,e,u,n,h);if(m===-1||u===m)return;let p=n==="left"?e.slice(0,m):e.slice(0,c),f=e.slice(c,d+1),g=n==="left"?e.slice(m,c):e.slice(d+1,m+1),b=n==="left"?e.slice(d+1):e.slice(m+1);e=n==="left"?[...p,...f,...g,...b]:[...p,...g,...f,...b]}),Yi(e,i),e},lS=(e,t,n,r,i)=>{let a=iS(e,t,i),o=oS(e,a),s=[],l,c;if(n==="left"){if(r)l=w5(e,p=>p2(p,r));else if(t.editingGroupId){let p=yn(e,t.editingGroupId);if(!p.length)return e;l=e.indexOf(p[0])}else l=0;c=a[a.length-1]}else{if(r)c=S5(e,p=>p2(p,r));else if(t.editingGroupId){let p=yn(e,t.editingGroupId);if(!p.length)return e;c=e.indexOf(p[p.length-1])}else c=e.length-1;l=a[0]}l===-1&&(l=0);for(let p=l;p<c+1;p++)a.includes(p)||s.push(e[p]);let d=Array.from(o.values()),u=e.slice(0,l),h=e.slice(c+1),m=n==="left"?[...u,...d,...s,...h]:[...u,...s,...d,...h];return Yi(m,o),m},dU=(e,t)=>sS(e,t,"left"),uU=(e,t)=>sS(e,t,"right"),hU=(e,t)=>EN(e,t,"left",lS),mU=(e,t)=>EN(e,t,"right",lS)}),NM,$M,FM,BM,fne=M(()=>{"use strict";D(),pne(),ke(),de(),te(),Tt(),pe(),ae(),ht(),NM=oe({name:"sendBackward",label:"labels.sendBackward",icon:pb,trackEvent:{category:"element"},perform:(e,t)=>({elements:dU(e,t),appState:t,storeAction:Z.CAPTURE}),keyPriority:40,keyTest:e=>e[N.CTRL_OR_CMD]&&!e.shiftKey&&e.code===rt.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,Xp.jsx)("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${x("labels.sendBackward")} \u2014 ${K("CtrlOrCmd+[")}`,children:pb})}),$M=oe({name:"bringForward",label:"labels.bringForward",icon:mb,trackEvent:{category:"element"},perform:(e,t)=>({elements:uU(e,t),appState:t,storeAction:Z.CAPTURE}),keyPriority:40,keyTest:e=>e[N.CTRL_OR_CMD]&&!e.shiftKey&&e.code===rt.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,Xp.jsx)("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${x("labels.bringForward")} \u2014 ${K("CtrlOrCmd+]")}`,children:mb})}),FM=oe({name:"sendToBack",label:"labels.sendToBack",icon:gb,trackEvent:{category:"element"},perform:(e,t)=>({elements:hU(e,t),appState:t,storeAction:Z.CAPTURE}),keyTest:e=>Ia?e[N.CTRL_OR_CMD]&&e.altKey&&e.code===rt.BRACKET_LEFT:e[N.CTRL_OR_CMD]&&e.shiftKey&&e.code===rt.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,Xp.jsx)("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${x("labels.sendToBack")} \u2014 ${K(Ia?"CtrlOrCmd+Alt+[":"CtrlOrCmd+Shift+[")}`,children:gb})}),BM=oe({name:"bringToFront",label:"labels.bringToFront",icon:fb,trackEvent:{category:"element"},perform:(e,t)=>({elements:mU(e,t),appState:t,storeAction:Z.CAPTURE}),keyTest:e=>Ia?e[N.CTRL_OR_CMD]&&e.altKey&&e.code===rt.BRACKET_RIGHT:e[N.CTRL_OR_CMD]&&e.shiftKey&&e.code===rt.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,Xp.jsx)("button",{type:"button",className:"zIndexButton",onClick:n=>e(null),title:`${x("labels.bringToFront")} \u2014 ${K(Ia?"CtrlOrCmd+Alt+]":"CtrlOrCmd+Shift+]")}`,children:fb})})}),zM,gne=M(()=>{"use strict";D(),ke(),Tt(),Kr(),Oe(),Se(),yr(),xd(),pe(),ht(),zM=oe({name:"selectAll",label:"labels.selectAll",icon:TM,trackEvent:{category:"canvas"},viewMode:!1,perform:(e,t,n,r)=>{if(t.editingLinearElement)return!1;let i=jf(e.filter(a=>!a.isDeleted&&!(he(a)&&a.containerId)&&!a.locked)).reduce((a,o)=>(a[o.id]=!0,a),{});return{appState:{...t,...jr({editingGroupId:null,selectedElementIds:i},ut(e),t,r),selectedLinearElement:Object.keys(i).length===1&&Be(e[0])?new fe(e[0]):null},storeAction:Z.CAPTURE}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.A})}),xN,wN,pU,Ene=M(()=>{"use strict";D(),te(),xN=e=>{let t=e.slice(),n=new Set,r=a=>{let o=a[0]?.groupIds?.join(""),s=[a[0]],l=[];for(let c of a.slice(1))c.groupIds?.join("")===o?s.push(c):l.push(c);return l.length?[...s,...r(l)]:s},i=new Map;return t.forEach((a,o)=>{if(!i.has(a.id))if(a.groupIds?.length){let s=a.groupIds[a.groupIds.length-1],l=t.slice(o).filter(c=>{let d=c?.groupIds?.some(u=>u===s);return d&&i.set(c.id,!0),d});for(let c of r(l))n.add(c)}else n.add(a)}),n.size!==e.length?(console.error("normalizeGroupElementOrder: lost some elements... bailing!"),e):[...n]},wN=e=>{let t=SB(e),n=e.slice(),r=new Set;return n.forEach((i,a)=>{i&&(i.boundElements?.length?(r.add(i),n[a]=null,i.boundElements.forEach(o=>{let s=t.get(o.id);s&&o.type==="text"&&(r.add(s[0]),n[s[1]]=null)})):i.type==="text"&&i.containerId&&t.get(i.containerId)?.[0].boundElements?.find(o=>o.id===i.id)||(r.add(i),n[a]=null))}),r.size!==e.length?(console.error("normalizeBoundElementsOrder: lost some elements... bailing!"),e):[...r]},pU=e=>wN(xN(e))}),HM,SN,bne=M(()=>{"use strict";D(),ke(),Tt(),Oe(),It(),Gn(),de(),te(),yr(),Kr(),Fa(),ae(),qt(),Se(),Ene(),pe(),Lr(),xd(),$a(),ht(),HM=oe({name:"duplicateSelection",label:"labels.duplicateSelection",icon:Wf,trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=r.scene.getNonDeletedElementsMap();if(t.editingLinearElement){let a=fe.duplicateSelectedPoints(t,i);return a?{elements:e,appState:a.appState,storeAction:Z.CAPTURE}:!1}return{...SN(e,t),storeAction:Z.CAPTURE}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.D,PanelComponent:({elements:e,appState:t,updateData:n})=>(0,fU.jsx)(Xe,{type:"button",icon:Wf,title:`${x("labels.duplicateSelection")} \u2014 ${K("CtrlOrCmd+D")}`,"aria-label":x("labels.duplicateSelection"),onClick:()=>n(null),visible:vn(ut(e),t)})}),SN=(e,t)=>{let n=pU(e),r=new Map,i=[],a=[],o=new Map,s=new Map,l=v=>{let y=IT(t.editingGroupId,r,v,{x:v.x+td/2,y:v.y+td/2});return s.set(y.id,y),o.set(v.id,y.id),a.push(v),i.push(y),y},c=ve(bt(n,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),d=new Map,u=v=>{for(let y of v)d.set(y.id,!0);return v},h=[],m=-1;for(;++m<n.length;){let v=n[m];if(d.get(v.id))continue;let y=Ye(v,ve(e)),w=Ae(v);if(c.get(v.id)){if(v.groupIds.length||y||w){let C=Y5(t,v);if(C){let A=yn(n,C).flatMap(T=>Ae(T)?[...vo(e,T.id),T]:[T]);h.push(...u([...A,...A.map(T=>l(T))]));continue}if(y){h.push(...u([v,y,l(v),l(y)]));continue}if(w){let A=vo(n,v.id);h.push(...u([...A,v,...A.map(T=>l(T)),l(v)]));continue}}(!v.frameId||!c.has(v.frameId))&&h.push(...u([v,l(v)]))}else h.push(...u([v]))}let p=[],f=new Map;for(m=h.length;--m>=0;){let v=h[m];f.get(v.id)||(f.set(v.id,!0),p.push(v))}let g=Yi(p.reverse(),ve(i));fT(h,a,o),uT(h,a,o),YT(g,a,o);let b=jf(i);return{elements:g,appState:{...t,...jr({editingGroupId:t.editingGroupId,selectedElementIds:b.reduce((v,y)=>(tn(y)||(v[y.id]=!0),v),{})},ut(g),t,null)}}}}),CN,dt,xi=M(()=>{"use strict";D(),CN=["ai","command_palette"],dt=(e,t,n,r)=>{try{if(typeof window>"u"||Ne.VITE_WORKER_ID||Ne.PROD||!CN.includes(e))return;Ne.PROD||console.info("trackEvent",{category:e,action:t,label:n,value:r}),window.sa_event&&window.sa_event(t,{category:e,label:n,value:r})}catch(i){console.error("error during analytics",i)}}}),go,yne=M(()=>{"use strict";D(),go=e=>(0,lh.jsx)("div",{className:"buttonList buttonListIcon",children:e.options.map(t=>e.type==="button"?(0,lh.jsx)("button",{onClick:n=>e.onClick(t.value,n),className:X({active:t.active??e.value===t.value}),"data-testid":t.testId,title:t.text,children:t.icon},t.text):(0,lh.jsxs)("label",{className:X({active:e.value===t.value}),title:t.text,children:[(0,lh.jsx)("input",{type:"radio",name:e.group,onChange:()=>e.onChange(t.value),checked:e.value===t.value,"data-testid":t.testId}),t.icon]},t.text))})}),gU,vne=M(()=>{"use strict";D(),Zi(),gU=({onChange:e,type:t,activeColor:n,topPicks:r})=>{let i;return t==="elementStroke"&&(i=zT),t==="elementBackground"&&(i=HT),t==="canvasBackground"&&(i=UT),r&&(i=r),i?(0,uE.jsx)("div",{className:"color-picker__top-picks",children:i.map(a=>(0,uE.jsx)("button",{className:X("color-picker__button",{active:a===n,"is-transparent":a==="transparent"||!a}),style:{"--swatch-color":a},type:"button",title:a,onClick:()=>e(a),"data-testid":`color-top-pick-${a}`,children:(0,uE.jsx)("div",{className:"color-picker__button-outline"})},a))}):(console.error("Invalid type for TopPicks"),null)}}),D1,Pb,P4,EU,wd,cS,bU,Zl=M(()=>{"use strict";D(),Zi(),D1=({palette:e,color:t})=>{for(let[n,r]of Object.entries(e))if(Array.isArray(r)){let i=r.indexOf(t);if(i>-1)return{colorName:n,shade:i}}else if(r===t)return{colorName:n,shade:null};return null},Pb=[["q","w","e","r","t"],["a","s","d","f","g"],["z","x","c","v","b"]].flat(),P4=({color:e,palette:t})=>!Object.values(t).flat().includes(e),EU=(e,t,n)=>{let r={elementBackground:"backgroundColor",elementStroke:"strokeColor"},i=e.filter(o=>{if(o.isDeleted)return!1;let s=o[r[t]];return P4({color:s,palette:n})}),a=new Map;return i.forEach(o=>{let s=o[r[t]];a.has(s)?a.set(s,a.get(s)+1):a.set(s,1)}),[...a.entries()].sort((o,s)=>s[1]-o[1]).map(o=>o[0]).slice(0,iH)},wd=_t(null),cS=(e,t,n)=>(e*299+t*587+n*114)/1e3>=160?"black":"white",bU=(e,t)=>{if(t){let a=new Option().style;if(a.color=e,a.color){let o=a.color.replace(/^(rgb|rgba)\(/,"").replace(/\)$/,"").replace(/\s/g,"").split(","),s=parseInt(o[0]),l=parseInt(o[1]),c=parseInt(o[2]);return cS(s,l,c)}}if(e==="transparent")return"black";let n=parseInt(e.substring(1,3),16),r=parseInt(e.substring(3,5),16),i=parseInt(e.substring(5,7),16);return cS(n,r,i)}}),TN,Iy,UM=M(()=>{"use strict";D(),Zl(),TN=({color:e,keyLabel:t,isCustomColor:n=!1,isShade:r=!1})=>(0,yU.jsxs)("div",{className:"color-picker__button__hotkey-label",style:{color:bU(e,n)},children:[r&&"\u21E7",t]}),Iy=TN}),vU,xne=M(()=>{"use strict";D(),Zl(),UM(),de(),vU=({hex:e,onChange:t,palette:n})=>{let r=D1({color:e||"transparent",palette:n}),[i,a]=Ze(wd),o=(0,My.useRef)(null);if((0,My.useEffect)(()=>{o.current&&i==="shades"&&o.current.focus()},[r,i]),r){let{colorName:s,shade:l}=r,c=n[s];if(Array.isArray(c))return(0,ms.jsx)("div",{className:"color-picker-content--default shades",children:c.map((d,u)=>(0,ms.jsxs)("button",{ref:u===l&&i==="shades"?o:void 0,tabIndex:-1,type:"button",className:X("color-picker__button color-picker__button--large",{active:u===l}),"aria-label":"Shade",title:`${s} - ${u+1}`,style:d?{"--swatch-color":d}:void 0,onClick:()=>{t(d),a("shades")},children:[(0,ms.jsx)("div",{className:"color-picker__button-outline"}),(0,ms.jsx)(Iy,{color:d,keyLabel:u+1,isShade:!0})]},u))})}return(0,ms.jsxs)("div",{className:"color-picker-content--default",style:{position:"relative"},tabIndex:-1,children:[(0,ms.jsx)("button",{type:"button",tabIndex:-1,className:"color-picker__button color-picker__button--large color-picker__button--no-focus-visible"}),(0,ms.jsx)("div",{tabIndex:-1,style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",fontSize:"0.75rem"},children:x("colorPicker.noShades")})]})}}),IN,xU,wne=M(()=>{"use strict";D(),Zl(),UM(),de(),IN=({palette:e,color:t,onChange:n,label:r,activeShade:i})=>{let a=D1({color:t||"transparent",palette:e}),[o,s]=Ze(wd),l=(0,Ay.useRef)(null);return(0,Ay.useEffect)(()=>{l.current&&o==="baseColors"&&l.current.focus()},[a?.colorName,o]),(0,ch.jsx)("div",{className:"color-picker-content--default",children:Object.entries(e).map(([c,d],u)=>{let h=(Array.isArray(d)?d[i]:d)||"transparent",m=Pb[u],p=x(`colors.${c.replace(/\d+/,"")}`,null,"");return(0,ch.jsxs)("button",{ref:a?.colorName===c?l:void 0,tabIndex:-1,type:"button",className:X("color-picker__button color-picker__button--large",{active:a?.colorName===c,"is-transparent":h==="transparent"||!h}),onClick:()=>{n(h),s("baseColors")},title:`${p}${h.startsWith("#")?` ${h}`:""} \u2014 ${m}`,"aria-label":`${p} \u2014 ${m}`,style:h?{"--swatch-color":h}:void 0,"data-testid":`color-${c}`,children:[(0,ch.jsx)("div",{className:"color-picker__button-outline"}),(0,ch.jsx)(Iy,{color:h,keyLabel:m})]},c)})})},xU=IN}),wU,Sne=M(()=>{"use strict";D(),Zl(),UM(),wU=({colors:e,color:t,onChange:n,label:r})=>{let[i,a]=Ze(wd),o=(0,ky.useRef)(null);return(0,ky.useEffect)(()=>{o.current&&o.current.focus()},[t,i]),(0,dh.jsx)("div",{className:"color-picker-content--default",children:e.map((s,l)=>(0,dh.jsxs)("button",{ref:t===s?o:void 0,tabIndex:-1,type:"button",className:X("color-picker__button color-picker__button--large",{active:t===s,"is-transparent":s==="transparent"||!s}),onClick:()=>{n(s),a("custom")},title:s,"aria-label":r,style:{"--swatch-color":s},children:[(0,dh.jsx)("div",{className:"color-picker__button-outline"}),(0,dh.jsx)(Iy,{color:s,keyLabel:l+1,isCustomColor:!0})]},l))})}}),f2,MN,SU,Cne=M(()=>{"use strict";D(),ke(),Zi(),Zl(),f2=(e,t,n)=>{let r=Math.ceil(n/Fc);switch(t=t??-1,e){case"ArrowLeft":{let i=t-1;return i<0?n-1:i}case"ArrowRight":return(t+1)%n;case"ArrowDown":{let i=t+Fc;return i>=n?t%Fc:i}case"ArrowUp":{let i=t-Fc,a=i<0?Fc*r+i:i;return a>=n?void 0:a}}},MN=({e,colorObj:t,onChange:n,palette:r,customColors:i,setActiveColorPickerSection:a,activeShade:o})=>{if(t?.shade!=null&&["Digit1","Digit2","Digit3","Digit4","Digit5"].includes(e.code)&&e.shiftKey){let s=Number(e.code.slice(-1))-1;return n(r[t.colorName][s]),a("shades"),!0}if(["1","2","3","4","5"].includes(e.key)&&i[Number(e.key)-1])return n(i[Number(e.key)-1]),a("custom"),!0;if(Pb.includes(e.key)){let s=Pb.indexOf(e.key),l=Object.keys(r)[s],c=r[l],d=Array.isArray(c)?c[o]:c;return n(d),a("baseColors"),!0}return!1},SU=({event:e,activeColorPickerSection:t,palette:n,color:r,onChange:i,customColors:a,setActiveColorPickerSection:o,updateData:s,activeShade:l,onEyeDropperToggle:c,onEscape:d})=>{if(e[N.CTRL_OR_CMD])return!1;if(e.key===N.ESCAPE)return d(e),!0;if(e.key===N.ALT)return c(!0),!0;if(e.key===N.I)return c(),!0;let u=D1({color:r,palette:n});if(e.key===N.TAB){let h={custom:!!a.length,baseColors:!0,shades:u?.shade!=null,hex:!0},m=Object.entries(h).reduce((v,[y,w])=>(w&&v.push(y),v),[]),p=m.indexOf(t),f=e.shiftKey?-1:1,g=p+f>m.length-1?0:p+f<0?m.length-1:p+f,b=m[g];return b&&o(b),b==="custom"?i(a[0]):b==="baseColors"&&(Object.entries(n).find(([v,y])=>Array.isArray(y)?y.includes(r):y===r?v:null)||i(Ge.charcoal)),e.preventDefault(),e.stopPropagation(),!0}if(MN({e,colorObj:u,onChange:i,palette:n,customColors:a,setActiveColorPickerSection:o,activeShade:l}))return!0;if(t==="shades"&&u){let{shade:h}=u,m=f2(e.key,h,Fc);if(m!==void 0)return i(n[u.colorName][m]),!0}if(t==="baseColors"&&u){let{colorName:h}=u,m=Object.keys(n),p=m.indexOf(h),f=f2(e.key,p,m.length);if(f!==void 0){let g=m[f],b=n[g];return i(Array.isArray(b)?b[l]:b),!0}}if(t==="custom"){let h=a.indexOf(r),m=f2(e.key,h,a.length);if(m!==void 0){let p=a[m];return i(p),!0}}return!1}}),AN,Sf,TU=M(()=>{"use strict";D(),AN=({children:e})=>(0,CU.jsx)("div",{className:"color-picker__heading",children:e}),Sf=AN}),IU,Tne=M(()=>{"use strict";D(),de(),xne(),wne(),Sne(),Cne(),TU(),Zl(),Zi(),ke(),ae(),IU=({color:e,onChange:t,label:n,type:r,elements:i,palette:a,updateData:o,children:s,onEyeDropperToggle:l,onEscape:c})=>{let[d]=Hl.default.useState(()=>r==="canvasBackground"?[]:EU(i,r,a)),[u,h]=Ze(wd),m=D1({color:e,palette:a});(0,Hl.useEffect)(()=>{if(!u){let b=P4({color:e,palette:a}),v=b&&!d.includes(e);h(v?"hex":b?"custom":m?.shade!=null?"shades":"baseColors")}},[u,e,a,h,m,d]);let[p,f]=(0,Hl.useState)(m?.shade??(r==="elementBackground"?Uu:Hu));(0,Hl.useEffect)(()=>{m?.shade!=null&&f(m.shade);let b=v=>{v.key===N.ALT&&l(!1)};return document.addEventListener("keyup",b,{capture:!0}),()=>{document.removeEventListener("keyup",b,{capture:!0})}},[m,l]);let g=Hl.default.useRef(null);return(0,ui.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":x("labels.colorPicker"),children:(0,ui.jsxs)("div",{ref:g,onKeyDown:b=>{SU({event:b,activeColorPickerSection:u,palette:a,color:e,onChange:t,onEyeDropperToggle:l,customColors:d,setActiveColorPickerSection:h,updateData:o,activeShade:p,onEscape:c})&&(b.preventDefault(),b.stopPropagation())},className:"color-picker-content",tabIndex:-1,children:[!!d.length&&(0,ui.jsxs)("div",{children:[(0,ui.jsx)(Sf,{children:x("colorPicker.mostUsedCustomColors")}),(0,ui.jsx)(wU,{colors:d,color:e,label:x("colorPicker.mostUsedCustomColors"),onChange:t})]}),(0,ui.jsxs)("div",{children:[(0,ui.jsx)(Sf,{children:x("colorPicker.colors")}),(0,ui.jsx)(xU,{color:e,label:n,palette:a,onChange:t,activeShade:p})]}),(0,ui.jsxs)("div",{children:[(0,ui.jsx)(Sf,{children:x("colorPicker.shades")}),(0,ui.jsx)(vU,{hex:e,onChange:t,palette:a})]}),s]})})}}),_4,Un,ir=M(()=>{"use strict";D(),_4=D4.default.createContext(null),Un=()=>D4.default.useContext(_4)}),GM,MU=M(()=>{"use strict";D(),$e(),ae(),ir(),GM=e=>{let[t,n]=(0,Xf.useState)(null),r=qn(),{theme:i}=Un(),{container:a}=Po();return(0,Xf.useLayoutEffect)(()=>{t&&(t.className="",t.classList.add("excalidraw",...e?.className?.split(/\s+/)||[]),t.classList.toggle("excalidraw--mobile",r.editor.isMobile),t.classList.toggle("theme--dark",i===ze.DARK))},[t,i,r.editor.isMobile,e?.className]),(0,Xf.useLayoutEffect)(()=>{let o=e?.parentSelector?a?.querySelector(e.parentSelector):document.body;if(!o)return;let s=document.createElement("div");return o.appendChild(s),n(s),()=>{o.removeChild(s)}},[a,e?.parentSelector]),t}});function jM(e,t,n){(0,AU.useEffect)(()=>{function r(i){let a=i;if(!e.current)return;let o=n?.(a,e.current);if(o!==!0){if(o===!1)return t(a);e.current.contains(a.target)||!document.documentElement.contains(a.target)||a.target.closest("[data-radix-portal]")||a.target===document.documentElement&&document.body.style.pointerEvents==="none"||a.target.closest("[data-prevent-outside-click]")||t(a)}}return document.addEventListener("pointerdown",r),document.addEventListener("touchstart",r),()=>{document.removeEventListener("pointerdown",r),document.removeEventListener("touchstart",r)}},[e,t,n])}var WM=M(()=>{"use strict";D(),ae()}),Py,VM=M(()=>{"use strict";D(),Py=e=>{let t=(0,kU.useRef)(e);return Object.assign(t.current,e),t.current}}),Ine=M(()=>{}),_1,_U,_y=M(()=>{"use strict";D(),Zi(),ae(),ir(),MU(),WM(),ke(),It(),$e(),VM(),Ine(),_1=_t(null),_U=({onCancel:e,onChange:t,onSelect:n,colorPickerType:r})=>{let i=GM({className:"excalidraw-eye-dropper-backdrop",parentSelector:".excalidraw-eye-dropper-container"}),a=Un(),o=$1(),s=ql(),l=bt(o,a),c=Py({app:s,onCancel:e,onChange:t,onSelect:n,selectedElements:l}),{container:d}=Po();(0,Dy.useEffect)(()=>{let h=u.current;if(!h||!s.canvas||!i)return;let m=!1,p=s.canvas.getContext("2d"),f=({clientX:A,clientY:T})=>{let I=p.getImageData((A-a.offsetLeft)*window.devicePixelRatio,(T-a.offsetTop)*window.devicePixelRatio,1,1).data;return cH(I[0],I[1],I[2])},g=({clientX:A,clientY:T,altKey:I})=>{h.style.top=`${T+20}px`,h.style.left=`${A+20}px`;let k=f({clientX:A,clientY:T});m&&c.onChange(r,k,c.selectedElements,{altKey:I}),h.style.background=k},b=()=>{c.onCancel()},v=(A,T)=>{c.onSelect(A,T)},y=A=>{m=!0,A.stopImmediatePropagation()},w=A=>{m=!1,d?.focus(),A.stopImmediatePropagation(),A.preventDefault(),v(f(A),A)},C=A=>{A.key===N.ESCAPE&&(A.preventDefault(),A.stopImmediatePropagation(),b())};return i.tabIndex=-1,i.focus(),g({clientX:c.app.lastViewportPosition.x,clientY:c.app.lastViewportPosition.y,altKey:!1}),i.addEventListener("keydown",C),i.addEventListener("pointerdown",y),i.addEventListener("pointerup",w),window.addEventListener("pointermove",g,{passive:!0}),window.addEventListener("blur",b),()=>{m=!1,i.removeEventListener("keydown",C),i.removeEventListener("pointerdown",y),i.removeEventListener("pointerup",w),window.removeEventListener("pointermove",g),window.removeEventListener("blur",b)}},[c,s.canvas,i,r,d,a.offsetLeft,a.offsetTop]);let u=(0,Dy.useRef)(null);return jM(u,()=>{e()},h=>!!h.target.closest(".excalidraw-eye-dropper-trigger, .excalidraw-eye-dropper-backdrop")),i?(0,PU.createPortal)((0,DU.jsx)("div",{ref:u,className:"excalidraw-eye-dropper-preview"}),i):null}}),LU,Mne=M(()=>{"use strict";D(),YM(),Zl(),pe(),Hn(),ke(),_y(),de(),$e(),te(),LU=({color:e,onChange:t,label:n,colorPickerType:r})=>{let i=qn(),[a,o]=(0,La.useState)(e),[s,l]=Ze(wd);(0,La.useEffect)(()=>{o(e)},[e]);let c=(0,La.useCallback)(p=>{let f=p.toLowerCase(),g=OU(f);g&&t(g),o(f)},[t]),d=(0,La.useRef)(null),u=(0,La.useRef)(null);(0,La.useEffect)(()=>{d.current&&d.current.focus()},[s]);let[h,m]=Ze(_1,Xn);return(0,La.useEffect)(()=>()=>{m(null)},[m]),(0,xo.jsxs)("div",{className:"color-picker__input-label",children:[(0,xo.jsx)("div",{className:"color-picker__input-hash",children:"#"}),(0,xo.jsx)("input",{ref:s==="hex"?d:void 0,style:{border:0,padding:0},spellCheck:!1,className:"color-picker-input","aria-label":n,onChange:p=>{c(p.target.value)},value:(a||"").replace(/^#/,""),onBlur:()=>{o(e)},tabIndex:-1,onFocus:()=>l("hex"),onKeyDown:p=>{p.key!==N.TAB&&(p.key===N.ESCAPE&&u.current?.focus(),p.stopPropagation())}}),!i.editor.isMobile&&(0,xo.jsxs)(xo.Fragment,{children:[(0,xo.jsx)("div",{style:{width:"1px",height:"1.25rem",backgroundColor:"var(--default-border-color)"}}),(0,xo.jsx)("div",{ref:u,className:X("excalidraw-eye-dropper-trigger",{selected:h}),onClick:()=>m(p=>p?null:{keepOpenOnAlt:!1,onSelect:f=>t(f),colorPickerType:r}),title:`${x("labels.eyeDropper")} \u2014 ${N.I.toLocaleUpperCase()} or ${K("Alt")} `,children:gM})]})]})}}),Ane=M(()=>{}),dS,OU,kN,PN,Db,YM=M(()=>{"use strict";D(),te(),vne(),Tne(),Zl(),$e(),Zi(),TU(),de(),Hn(),Mne(),_y(),Ane(),dS=e=>{let t=new Option().style;return t.color=e,!!t.color},OU=e=>Sa(e)?e:dS(`#${e}`)?`#${e}`:dS(e)?e:null,kN=({type:e,color:t,onChange:n,label:r,elements:i,palette:a=Ge,updateData:o})=>{let[,s]=Ze(wd),[l,c]=Ze(_1,Xn),{container:d}=Po(),u=qn(),h=(0,Yn.jsxs)("div",{children:[(0,Yn.jsx)(Sf,{children:x("colorPicker.hexCode")}),(0,Yn.jsx)(LU,{color:t,label:r,onChange:f=>{n(f)},colorPickerType:e})]}),m=(0,RU.useRef)(null),p=()=>{m.current?.querySelector(".color-picker-content")?.focus()};return(0,Yn.jsx)(cL,{container:d,children:(0,Yn.jsxs)(Ug,{ref:m,className:"focus-visible-none","data-prevent-outside-click":!0,onFocusOutside:f=>{p(),f.preventDefault()},onPointerDownOutside:f=>{l&&f.preventDefault()},onCloseAutoFocus:f=>{f.stopPropagation(),f.preventDefault(),d&&!gB(document.activeElement)&&d.focus(),o({openPopup:null}),s(null)},side:u.editor.isMobile&&!u.viewport.isLandscape?"bottom":"right",align:u.editor.isMobile&&!u.viewport.isLandscape?"center":"start",alignOffset:-16,sideOffset:20,style:{zIndex:"var(--zIndex-layerUI)",backgroundColor:"var(--popup-bg-color)",maxWidth:"208px",maxHeight:window.innerHeight,padding:"12px",borderRadius:"8px",boxSizing:"border-box",overflowY:"auto",boxShadow:"0px 7px 14px rgba(0, 0, 0, 0.05), 0px 0px 3.12708px rgba(0, 0, 0, 0.0798), 0px 0px 0.931014px rgba(0, 0, 0, 0.1702)"},children:[a?(0,Yn.jsx)(IU,{palette:a,color:t,onChange:f=>{n(f)},onEyeDropperToggle:f=>{c(g=>f?(g=g||{keepOpenOnAlt:!0,onSelect:n,colorPickerType:e},g.keepOpenOnAlt=!0,g):f===!1||g?null:{keepOpenOnAlt:!1,onSelect:n,colorPickerType:e})},onEscape:f=>{l?c(null):ds(f.target)?p():o({openPopup:null})},label:r,type:e,elements:i,updateData:o,children:h}):h,(0,Yn.jsx)(dL,{width:20,height:10,style:{fill:"var(--popup-bg-color)",filter:"drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)"}})]})})},PN=({label:e,color:t,type:n})=>(0,Yn.jsx)(Hg,{type:"button",className:X("color-picker__button active-color",{"is-transparent":t==="transparent"||!t}),"aria-label":e,style:t?{"--swatch-color":t}:void 0,title:x(n==="elementStroke"?"labels.showStroke":"labels.showBackground"),children:(0,Yn.jsx)("div",{className:"color-picker__button-outline"})}),Db=({type:e,color:t,onChange:n,label:r,elements:i,palette:a=Ge,topPicks:o,updateData:s,appState:l})=>(0,Yn.jsx)("div",{children:(0,Yn.jsxs)("div",{role:"dialog","aria-modal":"true",className:"color-picker-container",children:[(0,Yn.jsx)(gU,{activeColor:t,onChange:n,type:e,topPicks:o}),(0,Yn.jsx)("div",{style:{width:1,height:"100%",backgroundColor:"var(--default-border-color)",margin:"0 auto"}}),(0,Yn.jsxs)(zg,{open:l.openPopup===e,onOpenChange:c=>{s({openPopup:c?e:null})},children:[(0,Yn.jsx)(PN,{color:t,label:r,type:e}),l.openPopup===e&&(0,Yn.jsx)(kN,{type:e,color:t,onChange:n,label:r,elements:i,palette:a,updateData:s})]})]})})}),kne=M(()=>{}),ZM,FU=M(()=>{"use strict";D(),kne(),te(),ke(),ZM=({children:e,left:t,top:n,onCloseRequest:r,fitInViewport:i=!1,offsetLeft:a=0,offsetTop:o=0,viewportWidth:s=window.innerWidth,viewportHeight:l=window.innerHeight})=>{let c=(0,Ul.useRef)(null);(0,Ul.useEffect)(()=>{let u=c.current;if(!u)return;u.contains(document.activeElement)||u.focus();let h=m=>{if(m.key===N.TAB){let p=_E(u),{activeElement:f}=document,g=p.findIndex(b=>b===f);f===u?(m.shiftKey?p[p.length-1]?.focus():p[0].focus(),m.preventDefault(),m.stopImmediatePropagation()):g===0&&m.shiftKey?(p[p.length-1]?.focus(),m.preventDefault(),m.stopImmediatePropagation()):g===p.length-1&&!m.shiftKey&&(p[0]?.focus(),m.preventDefault(),m.stopImmediatePropagation())}};return u.addEventListener("keydown",h),()=>u.removeEventListener("keydown",h)},[]);let d=(0,Ul.useRef)(null);return(0,Ul.useLayoutEffect)(()=>{if(i&&c.current&&n!=null&&t!=null){let u=c.current,{width:h,height:m}=u.getBoundingClientRect();if(d.current?.top===n&&d.current?.left===t)return;d.current={top:n,left:t},h>=s?(u.style.width=`${s}px`,u.style.left="0px",u.style.overflowX="scroll"):t+h-a>s?u.style.left=`${s-h-10}px`:u.style.left=`${t}px`,m>=l?(u.style.height=`${l-20}px`,u.style.top="10px",u.style.overflowY="scroll"):n+m-o>l?u.style.top=`${l-m}px`:u.style.top=`${n}px`}},[n,t,i,s,l,a,o]),(0,Ul.useEffect)(()=>{if(r){let u=h=>{c.current?.contains(h.target)||(0,NU.unstable_batchedUpdates)(()=>r(h))};return document.addEventListener("pointerdown",u,!1),()=>document.removeEventListener("pointerdown",u,!1)}},[r]),(0,$U.jsx)("div",{className:"popover",ref:c,tabIndex:-1,children:e})}}),Pne=M(()=>{});function Dne({options:e,value:t,label:n,onChange:r,onClose:i}){let a=kl.default.useRef(),o=kl.default.useRef(),s=kl.default.useRef(null);return kl.default.useEffect(()=>{o.current?o.current.focus():s.current&&s.current.focus()},[]),(0,Pr.jsx)("div",{className:"picker",role:"dialog","aria-modal":"true","aria-label":n,onKeyDown:l=>{let c=e.find(d=>d.keyBinding===l.key.toLowerCase());if(!(l.metaKey||l.altKey||l.ctrlKey)&&c){let d=e.indexOf(c);s.current.children[d].focus(),l.preventDefault()}else if(l.key===N.TAB)setTimeout(()=>{let d=o.current,u=document.activeElement;d!==u&&i()},0);else if(df(l.key)){let{activeElement:d}=document,u=zh().rtl,h=Array.prototype.indexOf.call(s.current.children,d);if(h!==-1){let m=e.length,p=h;switch(l.key){case(u?N.ARROW_LEFT:N.ARROW_RIGHT):case N.ARROW_DOWN:{p=(h+1)%m;break}case(u?N.ARROW_RIGHT:N.ARROW_LEFT):case N.ARROW_UP:{p=(m+h-1)%m;break}}s.current.children[p].focus()}l.preventDefault()}else(l.key===N.ESCAPE||l.key===N.ENTER)&&(l.preventDefault(),i());l.nativeEvent.stopImmediatePropagation(),l.stopPropagation()},children:(0,Pr.jsx)("div",{className:"picker-content",ref:s,children:e.map((l,c)=>(0,Pr.jsxs)("button",{className:X("picker-option",{active:t===l.value}),onClick:d=>{d.currentTarget.focus(),r(l.value)},title:`${l.text} ${l.keyBinding&&`\u2014 ${l.keyBinding.toUpperCase()}`}`,"aria-label":l.text||"none","aria-keyshortcuts":l.keyBinding||void 0,ref:d=>{d&&c===0&&(a.current=d),d&&l.value===t&&(o.current=d)},onFocus:()=>{r(l.value)},children:[l.icon,l.keyBinding&&(0,Pr.jsx)("span",{className:"picker-keybinding",children:l.keyBinding})]},l.text))})})}function DN({value:e,label:t,options:n,onChange:r,group:i=""}){let[a,o]=kl.default.useState(!1),s=kl.default.useRef(null),l=zh().rtl;return(0,Pr.jsxs)("div",{children:[(0,Pr.jsx)("button",{name:i,className:a?"active":"","aria-label":t,onClick:()=>o(!a),ref:s,children:n.find(c=>c.value===e)?.icon}),(0,Pr.jsx)(kl.default.Suspense,{fallback:"",children:a?(0,Pr.jsxs)(Pr.Fragment,{children:[(0,Pr.jsx)(ZM,{onCloseRequest:c=>c.target!==s.current&&o(!1),...l?{right:5.5}:{left:-5.5},children:(0,Pr.jsx)(Dne,{options:n.filter(c=>c.showInPicker!==!1),value:e,label:t,onChange:r,onClose:()=>{o(!1),s.current?.focus()}})}),(0,Pr.jsx)("div",{className:"picker-triangle"})]}):null})]})}var _ne=M(()=>{"use strict";D(),FU(),Pne(),ke(),de()}),uS,Hr,Cr,_N,g2,BU,zU,HU,UU,GU,Lne,jU,WU,L4,R4,VU,YU,ZU,Rne,hS,One,KU=M(()=>{"use strict";D(),Zi(),xi(),yne(),YM(),_ne(),pe(),ae(),Oe(),vt(),qt(),Se(),de(),ke(),Ao(),It(),ey(),te(),Tt(),ht(),uS=.1,Hr=(e,t,n,r=!1)=>{let i=ve(bt(e,t,{includeBoundTextElement:r}));return e.map(a=>i.get(a.id)||a.id===t.editingElement?.id?n(a):a)},Cr=function(e,t,n,r,i){let a=t.editingElement,o=ut(e),s=null;return a&&(s=n(a)),s||(vn(o,t)?s=FH(r===!0?o:o.filter(l=>r(l)),t,n)??(typeof i=="function"?i(!0):i):s=typeof i=="function"?i(!1):i),s},_N=(e,t)=>tn(t)?t:ie(t,{x:e.textAlign==="left"?e.x:e.x+(e.width-t.width)/(e.textAlign==="center"?2:1),y:e.y+(e.height-t.height)/2},!1),g2=(e,t,n,r,i)=>{let a=new Set;return{elements:Hr(e,t,o=>{if(he(o)){let s=r(o);a.add(s);let l=Re(o,{fontSize:s});return ji(l,n.scene.getContainerElement(o),n.scene.getNonDeletedElementsMap()),l=_N(o,l),l}return o},!0),appState:{...t,currentItemFontSize:a.size===1?[...a][0]:i??t.currentItemFontSize},storeAction:Z.CAPTURE}},BU=oe({name:"changeStrokeColor",label:"labels.stroke",trackEvent:!1,perform:(e,t,n)=>({...n.currentItemStrokeColor&&{elements:Hr(e,t,r=>$E(r.type)?Re(r,{strokeColor:n.currentItemStrokeColor}):r,!0)},appState:{...t,...n},storeAction:n.currentItemStrokeColor?Z.CAPTURE:Z.NONE}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:r})=>(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsx)("h3",{"aria-hidden":"true",children:x("labels.stroke")}),(0,ye.jsx)(Db,{topPicks:zT,palette:oH,type:"elementStroke",label:x("labels.stroke"),color:Cr(e,t,i=>i.strokeColor,!0,t.currentItemStrokeColor),onChange:i=>n({currentItemStrokeColor:i}),elements:e,appState:t,updateData:n})]})}),zU=oe({name:"changeBackgroundColor",label:"labels.changeBackground",trackEvent:!1,perform:(e,t,n)=>({...n.currentItemBackgroundColor&&{elements:Hr(e,t,r=>Re(r,{backgroundColor:n.currentItemBackgroundColor}))},appState:{...t,...n},storeAction:n.currentItemBackgroundColor?Z.CAPTURE:Z.NONE}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:r})=>(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsx)("h3",{"aria-hidden":"true",children:x("labels.background")}),(0,ye.jsx)(Db,{topPicks:HT,palette:sH,type:"elementBackground",label:x("labels.background"),color:Cr(e,t,i=>i.backgroundColor,!0,t.currentItemBackgroundColor),onChange:i=>n({currentItemBackgroundColor:i}),elements:e,appState:t,updateData:n})]})}),HU=oe({name:"changeFillStyle",label:"labels.fill",trackEvent:!1,perform:(e,t,n,r)=>(dt("element","changeFillStyle",`${n} (${r.device.editor.isMobile?"mobile":"desktop"})`),{elements:Hr(e,t,i=>Re(i,{fillStyle:n})),appState:{...t,currentItemFillStyle:n},storeAction:Z.CAPTURE}),PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=bt(e,t),i=r.length>0&&r.every(a=>a.fillStyle==="zigzag");return(0,ye.jsxs)("fieldset",{children:[(0,ye.jsx)("legend",{children:x("labels.fill")}),(0,ye.jsx)(go,{type:"button",options:[{value:"hachure",text:`${x(i?"labels.zigzag":"labels.hachure")} (${K("Alt-Click")})`,icon:i?LI:RI,active:i?!0:void 0,testId:"fill-hachure"},{value:"cross-hatch",text:x("labels.crossHatch"),icon:OI,testId:"fill-cross-hatch"},{value:"solid",text:x("labels.solid"),icon:NI,testId:"fill-solid"}],value:Cr(e,t,a=>a.fillStyle,a=>a.hasOwnProperty("fillStyle"),a=>a?null:t.currentItemFillStyle),onClick:(a,o)=>{let s=o.altKey&&a==="hachure"&&r.every(l=>l.fillStyle==="hachure")?"zigzag":a;n(s)}})]})}}),UU=oe({name:"changeStrokeWidth",label:"labels.strokeWidth",trackEvent:!1,perform:(e,t,n)=>({elements:Hr(e,t,r=>Re(r,{strokeWidth:n})),appState:{...t,currentItemStrokeWidth:n},storeAction:Z.CAPTURE}),PanelComponent:({elements:e,appState:t,updateData:n})=>(0,ye.jsxs)("fieldset",{children:[(0,ye.jsx)("legend",{children:x("labels.strokeWidth")}),(0,ye.jsx)(go,{group:"stroke-width",options:[{value:Q2.thin,text:x("labels.thin"),icon:Tb,testId:"strokeWidth-thin"},{value:Q2.bold,text:x("labels.bold"),icon:$I,testId:"strokeWidth-bold"},{value:Q2.extraBold,text:x("labels.extraBold"),icon:FI,testId:"strokeWidth-extraBold"}],value:Cr(e,t,r=>r.strokeWidth,r=>r.hasOwnProperty("strokeWidth"),r=>r?null:t.currentItemStrokeWidth),onChange:r=>n(r)})]})}),GU=oe({name:"changeSloppiness",label:"labels.sloppiness",trackEvent:!1,perform:(e,t,n)=>({elements:Hr(e,t,r=>Re(r,{seed:Is(),roughness:n})),appState:{...t,currentItemRoughness:n},storeAction:Z.CAPTURE}),PanelComponent:({elements:e,appState:t,updateData:n})=>(0,ye.jsxs)("fieldset",{children:[(0,ye.jsx)("legend",{children:x("labels.sloppiness")}),(0,ye.jsx)(go,{group:"sloppiness",options:[{value:0,text:x("labels.architect"),icon:HI},{value:1,text:x("labels.artist"),icon:UI},{value:2,text:x("labels.cartoonist"),icon:GI}],value:Cr(e,t,r=>r.roughness,r=>r.hasOwnProperty("roughness"),r=>r?null:t.currentItemRoughness),onChange:r=>n(r)})]})}),Lne=oe({name:"changeStrokeStyle",label:"labels.strokeStyle",trackEvent:!1,perform:(e,t,n)=>({elements:Hr(e,t,r=>Re(r,{strokeStyle:n})),appState:{...t,currentItemStrokeStyle:n},storeAction:Z.CAPTURE}),PanelComponent:({elements:e,appState:t,updateData:n})=>(0,ye.jsxs)("fieldset",{children:[(0,ye.jsx)("legend",{children:x("labels.strokeStyle")}),(0,ye.jsx)(go,{group:"strokeStyle",options:[{value:"solid",text:x("labels.strokeStyle_solid"),icon:Tb},{value:"dashed",text:x("labels.strokeStyle_dashed"),icon:BI},{value:"dotted",text:x("labels.strokeStyle_dotted"),icon:zI}],value:Cr(e,t,r=>r.strokeStyle,r=>r.hasOwnProperty("strokeStyle"),r=>r?null:t.currentItemStrokeStyle),onChange:r=>n(r)})]})}),jU=oe({name:"changeOpacity",label:"labels.opacity",trackEvent:!1,perform:(e,t,n)=>({elements:Hr(e,t,r=>Re(r,{opacity:n}),!0),appState:{...t,currentItemOpacity:n},storeAction:Z.CAPTURE}),PanelComponent:({elements:e,appState:t,updateData:n})=>(0,ye.jsxs)("label",{className:"control-label",children:[x("labels.opacity"),(0,ye.jsx)("input",{type:"range",min:"0",max:"100",step:"10",onChange:r=>n(+r.target.value),value:Cr(e,t,r=>r.opacity,!0,t.currentItemOpacity)??void 0})]})}),WU=oe({name:"changeFontSize",label:"labels.fontSize",trackEvent:!1,perform:(e,t,n,r)=>g2(e,t,r,()=>n,n),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,ye.jsxs)("fieldset",{children:[(0,ye.jsx)("legend",{children:x("labels.fontSize")}),(0,ye.jsx)(go,{group:"font-size",options:[{value:16,text:x("labels.small"),icon:eM,testId:"fontSize-small"},{value:20,text:x("labels.medium"),icon:tM,testId:"fontSize-medium"},{value:28,text:x("labels.large"),icon:nM,testId:"fontSize-large"},{value:36,text:x("labels.veryLarge"),icon:rM,testId:"fontSize-veryLarge"}],value:Cr(e,t,i=>{if(he(i))return i.fontSize;let a=Ye(i,r.scene.getNonDeletedElementsMap());return a?a.fontSize:null},i=>he(i)||Ye(i,r.scene.getNonDeletedElementsMap())!==null,i=>i?null:t.currentItemFontSize||Vi),onChange:i=>n(i)})]})}),L4=oe({name:"decreaseFontSize",label:"labels.decreaseFontSize",icon:Mb,trackEvent:!1,perform:(e,t,n,r)=>g2(e,t,r,i=>Math.round(1/(1+uS)*i.fontSize)),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&(e.key===N.CHEVRON_LEFT||e.key===N.COMMA)}),R4=oe({name:"increaseFontSize",label:"labels.increaseFontSize",icon:Mb,trackEvent:!1,perform:(e,t,n,r)=>g2(e,t,r,i=>Math.round(i.fontSize*(1+uS))),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&(e.key===N.CHEVRON_RIGHT||e.key===N.PERIOD)}),VU=oe({name:"changeFontFamily",label:"labels.fontFamily",trackEvent:!1,perform:(e,t,n,r)=>({elements:Hr(e,t,i=>{if(he(i)){let a=Re(i,{fontFamily:n,lineHeight:Fl(n)});return ji(a,r.scene.getContainerElement(i),r.scene.getNonDeletedElementsMap()),a}return i},!0),appState:{...t,currentItemFontFamily:n},storeAction:Z.CAPTURE}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=[{value:Zn.Virgil,text:x("labels.handDrawn"),icon:I1,testId:"font-family-virgil"},{value:Zn.Helvetica,text:x("labels.normal"),icon:iM,testId:"font-family-normal"},{value:Zn.Cascadia,text:x("labels.code"),icon:aM,testId:"font-family-code"}];return(0,ye.jsxs)("fieldset",{children:[(0,ye.jsx)("legend",{children:x("labels.fontFamily")}),(0,ye.jsx)(go,{group:"font-family",options:i,value:Cr(e,t,a=>{if(he(a))return a.fontFamily;let o=Ye(a,r.scene.getNonDeletedElementsMap());return o?o.fontFamily:null},a=>he(a)||Ye(a,r.scene.getNonDeletedElementsMap())!==null,a=>a?null:t.currentItemFontFamily||To),onChange:a=>n(a)})]})}}),YU=oe({name:"changeTextAlign",label:"Change text alignment",trackEvent:!1,perform:(e,t,n,r)=>({elements:Hr(e,t,i=>{if(he(i)){let a=Re(i,{textAlign:n});return ji(a,r.scene.getContainerElement(i),r.scene.getNonDeletedElementsMap()),a}return i},!0),appState:{...t,currentItemTextAlign:n},storeAction:Z.CAPTURE}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=r.scene.getNonDeletedElementsMap();return(0,ye.jsxs)("fieldset",{children:[(0,ye.jsx)("legend",{children:x("labels.textAlign")}),(0,ye.jsx)(go,{group:"text-align",options:[{value:"left",text:x("labels.left"),icon:oM,testId:"align-left"},{value:"center",text:x("labels.center"),icon:sM,testId:"align-horizontal-center"},{value:"right",text:x("labels.right"),icon:lM,testId:"align-right"}],value:Cr(e,t,a=>{if(he(a))return a.textAlign;let o=Ye(a,i);return o?o.textAlign:null},a=>he(a)||Ye(a,i)!==null,a=>a?null:t.currentItemTextAlign),onChange:a=>n(a)})]})}}),ZU=oe({name:"changeVerticalAlign",label:"Change vertical alignment",trackEvent:{category:"element"},perform:(e,t,n,r)=>({elements:Hr(e,t,i=>{if(he(i)){let a=Re(i,{verticalAlign:n});return ji(a,r.scene.getContainerElement(i),r.scene.getNonDeletedElementsMap()),a}return i},!0),appState:{...t},storeAction:Z.CAPTURE}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,ye.jsx)("fieldset",{children:(0,ye.jsx)(go,{group:"text-align",options:[{value:Yr.TOP,text:x("labels.alignTop"),icon:(0,ye.jsx)(cM,{theme:t.theme}),testId:"align-top"},{value:Yr.MIDDLE,text:x("labels.centerVertically"),icon:(0,ye.jsx)(uM,{theme:t.theme}),testId:"align-middle"},{value:Yr.BOTTOM,text:x("labels.alignBottom"),icon:(0,ye.jsx)(dM,{theme:t.theme}),testId:"align-bottom"}],value:Cr(e,t,i=>{if(he(i)&&i.containerId)return i.verticalAlign;let a=Ye(i,r.scene.getNonDeletedElementsMap());return a?a.verticalAlign:null},i=>he(i)||Ye(i,r.scene.getNonDeletedElementsMap())!==null,i=>i?null:Yr.MIDDLE),onChange:i=>n(i)})})}),Rne=oe({name:"changeRoundness",label:"Change edge roundness",trackEvent:!1,perform:(e,t,n)=>({elements:Hr(e,t,r=>Re(r,{roundness:n==="round"?{type:id(r.type)?Fn.ADAPTIVE_RADIUS:Fn.PROPORTIONAL_RADIUS}:null})),appState:{...t,currentItemRoundness:n},storeAction:Z.CAPTURE}),PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=hy(ut(e),t).some(i=>i.roundness?.type===Fn.LEGACY);return(0,ye.jsxs)("fieldset",{children:[(0,ye.jsx)("legend",{children:x("labels.edges")}),(0,ye.jsx)(go,{group:"edges",options:[{value:"sharp",text:x("labels.sharp"),icon:jI},{value:"round",text:x("labels.round"),icon:WI}],value:Cr(e,t,i=>r?null:i.roundness?"round":"sharp",i=>i.hasOwnProperty("roundness"),i=>i?null:t.currentItemRoundness),onChange:i=>n(i)})]})}}),hS=e=>[{value:null,text:x("labels.arrowhead_none"),keyBinding:"q",icon:VI},{value:"arrow",text:x("labels.arrowhead_arrow"),keyBinding:"w",icon:(0,ye.jsx)(YI,{flip:e})},{value:"bar",text:x("labels.arrowhead_bar"),keyBinding:"e",icon:(0,ye.jsx)(KI,{flip:e})},{value:"dot",text:x("labels.arrowhead_circle"),keyBinding:null,icon:(0,ye.jsx)(Ib,{flip:e}),showInPicker:!1},{value:"circle",text:x("labels.arrowhead_circle"),keyBinding:"r",icon:(0,ye.jsx)(Ib,{flip:e}),showInPicker:!1},{value:"circle_outline",text:x("labels.arrowhead_circle_outline"),keyBinding:null,icon:(0,ye.jsx)(ZI,{flip:e}),showInPicker:!1},{value:"triangle",text:x("labels.arrowhead_triangle"),icon:(0,ye.jsx)(XI,{flip:e}),keyBinding:"t"},{value:"triangle_outline",text:x("labels.arrowhead_triangle_outline"),icon:(0,ye.jsx)(qI,{flip:e}),keyBinding:null,showInPicker:!1},{value:"diamond",text:x("labels.arrowhead_diamond"),icon:(0,ye.jsx)(QI,{flip:e}),keyBinding:null,showInPicker:!1},{value:"diamond_outline",text:x("labels.arrowhead_diamond_outline"),icon:(0,ye.jsx)(JI,{flip:e}),keyBinding:null,showInPicker:!1}],One=oe({name:"changeArrowhead",label:"Change arrowheads",trackEvent:!1,perform:(e,t,n)=>({elements:Hr(e,t,r=>{if(Be(r)){let{position:i,type:a}=n;if(i==="start")return Re(r,{startArrowhead:a});if(i==="end")return Re(r,{endArrowhead:a})}return r}),appState:{...t,[n.position==="start"?"currentItemStartArrowhead":"currentItemEndArrowhead"]:n.type},storeAction:Z.CAPTURE}),PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=zh().rtl;return(0,ye.jsxs)("fieldset",{children:[(0,ye.jsx)("legend",{children:x("labels.arrowheads")}),(0,ye.jsxs)("div",{className:"iconSelectList buttonList",children:[(0,ye.jsx)(DN,{label:"arrowhead_start",options:hS(!r),value:Cr(e,t,i=>Be(i)&&Df(i.type)?i.startArrowhead:t.currentItemStartArrowhead,!0,t.currentItemStartArrowhead),onChange:i=>n({position:"start",type:i})}),(0,ye.jsx)(DN,{label:"arrowhead_end",group:"arrowheads",options:hS(!!r),value:Cr(e,t,i=>Be(i)&&Df(i.type)?i.endArrowhead:t.currentItemEndArrowhead,!0,t.currentItemEndArrowhead),onChange:i=>n({position:"end",type:i})})]})]})}})}),Nne=M(()=>{}),eh,O4,LN,Gl,Sd=M(()=>{"use strict";D(),Nne(),eh=()=>{let e=document.querySelector(".excalidraw-tooltip");if(e)return e;let t=document.createElement("div");return document.body.appendChild(t),t.classList.add("excalidraw-tooltip"),t},O4=(e,t,n="bottom")=>{let r=e.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=5,s=t.left+t.width/2-r.width/2;s<0?s=o:s+r.width>=i&&(s=i-r.width-o);let l;n==="bottom"?(l=t.top+t.height+o,l+r.height>=a&&(l=t.top-r.height-o)):(l=t.top-r.height-o,l<0&&(l=t.top+t.height+o)),Object.assign(e.style,{top:`${l}px`,left:`${s}px`})},LN=(e,t,n,r)=>{t.classList.add("excalidraw-tooltip--visible"),t.style.minWidth=r?"50ch":"10ch",t.style.maxWidth=r?"50ch":"15ch",t.textContent=n;let i=e.getBoundingClientRect();O4(t,i)},Gl=({children:e,label:t,long:n=!1,style:r,disabled:i})=>((0,XU.useEffect)(()=>()=>eh().classList.remove("excalidraw-tooltip--visible"),[]),i?null:(0,qU.jsx)("div",{className:"excalidraw-tooltip-wrapper",onPointerEnter:a=>LN(a.currentTarget,eh(),t,n),onPointerLeave:()=>eh().classList.remove("excalidraw-tooltip--visible"),style:r,children:e}))}),QU,ad,_b,Lb,JU,RN,ON,qp,$ne,Fne,eG,Lh,Bne,tG,Ly=M(()=>{"use strict";D(),YM(),pe(),Gn(),ae(),Oe(),de(),ke(),It(),BH(),eI(),te(),Tt(),Sd(),vt(),vi(),Zi(),S1(),ht(),QU=oe({name:"changeViewBackgroundColor",label:"labels.canvasBackground",paletteName:"Change canvas background color",trackEvent:!1,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.changeViewBackgroundColor&&!t.viewModeEnabled,perform:(e,t,n)=>({appState:{...t,...n},storeAction:n.viewBackgroundColor?Z.CAPTURE:Z.NONE}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:r})=>(0,Xc.jsx)(Db,{palette:null,topPicks:UT,label:x("labels.canvasBackground"),type:"canvasBackground",color:t.viewBackgroundColor,onChange:i=>n({viewBackgroundColor:i}),"data-testid":"canvas-background-picker",elements:e,appState:t,updateData:n})}),ad=oe({name:"clearCanvas",label:"labels.clearCanvas",paletteName:"Clear canvas",icon:zl,trackEvent:{category:"canvas"},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.clearCanvas&&!t.viewModeEnabled,perform:(e,t,n,r)=>(r.imageCache.clear(),{elements:e.map(i=>Re(i,{isDeleted:!0})),appState:{...Ms(),files:{},theme:t.theme,penMode:t.penMode,penDetected:t.penDetected,exportBackground:t.exportBackground,exportEmbedScene:t.exportEmbedScene,gridSize:t.gridSize,showStats:t.showStats,pasteDialog:t.pasteDialog,activeTool:t.activeTool.type==="image"?{...t.activeTool,type:"selection"}:t.activeTool},storeAction:Z.CAPTURE})}),_b=oe({name:"zoomIn",label:"buttons.zoomIn",viewMode:!0,icon:lb,trackEvent:{category:"canvas"},perform:(e,t,n,r)=>({appState:{...t,...Al({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:Ml(t.zoom.value+Yu)},t),userToFollow:null},storeAction:Z.NONE}),PanelComponent:({updateData:e,appState:t})=>(0,Xc.jsx)(Xe,{type:"button",className:"zoom-in-button zoom-button",icon:lb,title:`${x("buttons.zoomIn")} \u2014 ${K("CtrlOrCmd++")}`,"aria-label":x("buttons.zoomIn"),disabled:t.zoom.value>=g5,onClick:()=>{e(null)}}),keyTest:e=>(e.code===rt.EQUAL||e.code===rt.NUM_ADD)&&(e[N.CTRL_OR_CMD]||e.shiftKey)}),Lb=oe({name:"zoomOut",label:"buttons.zoomOut",icon:cb,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,n,r)=>({appState:{...t,...Al({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:Ml(t.zoom.value-Yu)},t),userToFollow:null},storeAction:Z.NONE}),PanelComponent:({updateData:e,appState:t})=>(0,Xc.jsx)(Xe,{type:"button",className:"zoom-out-button zoom-button",icon:cb,title:`${x("buttons.zoomOut")} \u2014 ${K("CtrlOrCmd+-")}`,"aria-label":x("buttons.zoomOut"),disabled:t.zoom.value<=of,onClick:()=>{e(null)}}),keyTest:e=>(e.code===rt.MINUS||e.code===rt.NUM_SUBTRACT)&&(e[N.CTRL_OR_CMD]||e.shiftKey)}),JU=oe({name:"resetZoom",label:"buttons.resetZoom",icon:bI,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,n,r)=>({appState:{...t,...Al({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:Ml(1)},t),userToFollow:null},storeAction:Z.NONE}),PanelComponent:({updateData:e,appState:t})=>(0,Xc.jsx)(Gl,{label:x("buttons.resetZoom"),style:{height:"100%"},children:(0,Xc.jsxs)(Xe,{type:"button",className:"reset-zoom-button zoom-button",title:x("buttons.resetZoom"),"aria-label":x("buttons.resetZoom"),onClick:()=>{e(null)},children:[(t.zoom.value*100).toFixed(0),"%"]})}),keyTest:e=>(e.code===rt.ZERO||e.code===rt.NUM_ZERO)&&(e[N.CTRL_OR_CMD]||e.shiftKey)}),RN=(e,t)=>{let[n,r,i,a]=e,o=i-n,s=t.width/o,l=a-r,c=t.height/l,d=Math.min(s,c),u=Math.floor(d/Yu)*Yu;return Math.min(Math.max(u,of),1)},ON=({bounds:e,appState:t,fitToViewport:n=!1,viewportZoomFactor:r=.7})=>{let[i,a,o,s]=e,l=(i+o)/2,c=(a+s)/2,d,u,h;if(n){let m=o-i,p=s-a;d=Math.min(t.width/m,t.height/p)*Math.min(1,Math.max(r,.1)),d=Math.min(Math.max(d,of),g5);let f=t.width;if(t.openSidebar){let g=document.querySelector(".sidebar")?.offsetWidth??0;f=document.documentElement.getAttribute("dir")==="rtl"?t.width+g:t.width-g}u=f/2*(1/d)-l,h=t.height/2*(1/d)-c}else{d=RN(e,{width:t.width,height:t.height});let m=k4({scenePoint:{x:l,y:c},viewportDimensions:{width:t.width,height:t.height},zoom:{value:d}});u=m.scrollX,h=m.scrollY}return{appState:{...t,scrollX:u,scrollY:h,zoom:{value:d}},storeAction:Z.NONE}},qp=({targetElements:e,appState:t,fitToViewport:n,viewportZoomFactor:r})=>{let i=Bt(ut(e));return ON({bounds:i,appState:t,fitToViewport:n,viewportZoomFactor:r})},$ne=oe({name:"zoomToFitSelectionInViewport",label:"labels.zoomToFitViewport",icon:wf,trackEvent:{category:"canvas"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return qp({targetElements:i.length?i:e,appState:{...t,userToFollow:null},fitToViewport:!1})},keyTest:e=>e.code===rt.TWO&&e.shiftKey&&!e.altKey&&!e[N.CTRL_OR_CMD]}),Fne=oe({name:"zoomToFitSelection",label:"helpDialog.zoomToSelection",icon:wf,trackEvent:{category:"canvas"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return qp({targetElements:i.length?i:e,appState:{...t,userToFollow:null},fitToViewport:!0})},keyTest:e=>e.code===rt.THREE&&e.shiftKey&&!e.altKey&&!e[N.CTRL_OR_CMD]}),eG=oe({name:"zoomToFit",label:"helpDialog.zoomToFit",icon:wf,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t)=>qp({targetElements:e,appState:{...t,userToFollow:null},fitToViewport:!1}),keyTest:e=>e.code===rt.ONE&&e.shiftKey&&!e.altKey&&!e[N.CTRL_OR_CMD]}),Lh=oe({name:"toggleTheme",label:(e,t)=>t.theme===ze.DARK?"buttons.lightMode":"buttons.darkMode",keywords:["toggle","dark","light","mode","theme"],icon:e=>e.theme===ze.LIGHT?Vf:Yf,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,n)=>({appState:{...t,theme:n||(t.theme===ze.LIGHT?ze.DARK:ze.LIGHT)},storeAction:Z.NONE}),keyTest:e=>e.altKey&&e.shiftKey&&e.code===rt.D,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.toggleTheme}),Bne=oe({name:"toggleEraserTool",label:"toolBar.eraser",trackEvent:{category:"toolbar"},perform:(e,t)=>{let n;return ya(t)?n=hn(t,{...t.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):n=hn(t,{type:"eraser",lastActiveToolBeforeEraser:t.activeTool}),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:n},storeAction:Z.CAPTURE}},keyTest:e=>e.key===N.E}),tG=oe({name:"toggleHandTool",label:"toolBar.hand",paletteName:"Toggle hand tool",trackEvent:{category:"toolbar"},icon:by,viewMode:!1,perform:(e,t,n,r)=>{let i;return hd(t)?i=hn(t,{...t.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):(i=hn(t,{type:"hand",lastActiveToolBeforeEraser:t.activeTool}),yt(r.interactiveCanvas,gt.GRAB)),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},storeAction:Z.CAPTURE}},keyTest:e=>!e.altKey&&!e[N.CTRL_OR_CMD]&&e.key===N.H})}),Ri,zne=M(()=>{"use strict";D(),ke(),Oe(),te(),Gn(),pe(),de(),Tt(),vt(),rr(),yr(),Fa(),Se(),S1(),ht(),Ri=oe({name:"finalize",label:"",trackEvent:!1,perform:(e,t,n,r)=>{let{interactiveCanvas:i,focusContainer:a,scene:o}=r,s=o.getNonDeletedElementsMap();if(t.editingLinearElement){let{elementId:h,startBindingElement:m,endBindingElement:p}=t.editingLinearElement,f=fe.getElement(h,s);if(f)return kr(f)&&yl(f,m,p,s),{elements:f.points.length<2||pd(f)?e.filter(g=>g.id!==f.id):void 0,appState:{...t,cursorButton:"up",editingLinearElement:null,selectedLinearElement:null},storeAction:Z.CAPTURE}}let l=e,c=t.pendingImageElementId&&o.getElement(t.pendingImageElementId);c&&ie(c,{isDeleted:!0},!1),window.document.activeElement instanceof HTMLElement&&a();let d=t.multiElement?t.multiElement:t.editingElement?.type==="freedraw"?t.editingElement:null;if(d){if(d.type!=="freedraw"&&t.lastPointerDownWith!=="touch"){let{points:m,lastCommittedPoint:p}=d;(!p||m[m.length-1]!==p)&&ie(d,{points:d.points.slice(0,-1)})}pd(d)&&(l=l.filter(m=>m.id!==d.id));let h=Mo(d.points,t.zoom.value);if((d.type==="line"||d.type==="freedraw")&&h){let m=d.points,p=m[0];ie(d,{points:m.map((f,g)=>g===m.length-1?[p[0],p[1]]:f)})}if(kr(d)&&!h&&d.points.length>1){let[m,p]=fe.getPointAtIndexGlobalCoordinates(d,-1,ve(e));HE(d,t,{x:m,y:p},r)}}(!t.activeTool.locked&&t.activeTool.type!=="freedraw"||!d)&&Ni(i);let u;return t.activeTool.type==="eraser"?u=hn(t,{...t.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):u=hn(t,{type:"selection"}),{elements:l,appState:{...t,cursorButton:"up",activeTool:(t.activeTool.locked||t.activeTool.type==="freedraw")&&d?t.activeTool:u,activeEmbeddable:null,draggingElement:null,multiElement:null,editingElement:null,startBoundElement:null,suggestedBindings:[],selectedElementIds:d&&!t.activeTool.locked&&t.activeTool.type!=="freedraw"?{...t.selectedElementIds,[d.id]:!0}:t.selectedElementIds,selectedLinearElement:d&&Be(d)?new fe(d):t.selectedLinearElement,pendingImageElementId:null},storeAction:Z.CAPTURE}},keyTest:(e,t)=>e.key===N.ESCAPE&&(t.editingLinearElement!==null||!t.draggingElement&&t.multiElement===null)||(e.key===N.ESCAPE||e.key===N.ENTER)&&t.multiElement!==null,PanelComponent:({appState:e,updateData:t,data:n})=>(0,nG.jsx)(Xe,{type:"button",icon:AI,title:x("buttons.done"),"aria-label":x("buttons.done"),onClick:t,visible:e.multiElement!=null,size:n?.size||"medium"})})}),Hne=M(()=>{}),Une=M(()=>{}),iG,Gne=M(()=>{"use strict";D(),Hne(),te(),Une(),$e(),ke(),iG=e=>{let{id:t}=Po(),[n,r]=(0,rG.useState)(e.value),i=o=>{e.ignoreFocus||vB(o.target);let s=o.target.value;s!==e.value&&e.onChange(s)},a=o=>{if(o.key===N.ENTER){if(o.preventDefault(),o.nativeEvent.isComposing||o.keyCode===229)return;o.currentTarget.blur()}};return(0,qf.jsxs)("div",{className:"ProjectName",children:[(0,qf.jsx)("label",{className:"ProjectName-label",htmlFor:"filename",children:`${e.label}:`}),(0,qf.jsx)("input",{type:"text",className:"TextInput",onBlur:i,onKeyDown:a,id:`${t}-filename`,value:n,onChange:o=>r(o.target.value)})]})}}),aG,mS,jne=M(()=>{"use strict";D(),Vl(),de(),Gn(),ae(),aG=e=>{let t=e.title||(e.value===ze.DARK?x("buttons.lightMode"):x("buttons.darkMode"));return(0,Wu.jsx)(Xe,{type:"icon",icon:e.value===ze.LIGHT?mS.MOON:mS.SUN,title:t,"aria-label":t,onClick:()=>e.onChange(e.value===ze.DARK?ze.LIGHT:ze.DARK),"data-testid":"toggle-dark-mode"})},mS={SUN:(0,Wu.jsx)("svg",{width:"512",height:"512",className:"rtl-mirror",viewBox:"0 0 512 512",children:(0,Wu.jsx)("path",{fill:"currentColor",d:"M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z"})}),MOON:(0,Wu.jsx)("svg",{width:"512",height:"512",className:"rtl-mirror",viewBox:"0 0 512 512",children:(0,Wu.jsx)("path",{fill:"currentColor",d:"M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"})})}}),Qf,Jf,fd=M(()=>{"use strict";D(),vd(),ae(),Oe(),Se(),de(),It(),C1(),te(),yi(),Wl(),Bl(),Lr(),yi(),Bl(),Qf=(e,{selectedElementIds:t},n)=>{e=ut(e);let r=n&&vn(e,{selectedElementIds:t}),i=null,a=r?bt(e,{selectedElementIds:t},{includeBoundTextElement:!0}):e;return r&&(a.length===1&&Ae(a[0])?(i=a[0],a=cy(e,i)):a.length>1&&(a=bt(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}))),{exportingFrame:i,exportedElements:ud(a)}},Jf=async({type:e,data:t,config:n})=>{let r=Object.assign({},n);if(r.padding=r.padding??Hh,r.fileHandle=r.fileHandle??null,r.exportingFrame=r.exportingFrame??null,r.name=r.name||qC,t.elements.length===0)throw new Error(x("alerts.cannotExportEmptyCanvas"));if(e==="svg"||e==="clipboard-svg"){let a=sy({data:{elements:t.elements,appState:{exportBackground:r.exportBackground,exportWithDarkMode:t.appState.exportWithDarkMode,viewBackgroundColor:t.appState.viewBackgroundColor,exportPadding:r.padding,exportScale:t.appState.exportScale,exportEmbedScene:t.appState.exportEmbedScene&&e==="svg"},files:t.files},config:{exportingFrame:r.exportingFrame}});if(e==="svg")return $f(a.then(o=>new Blob([o.outerHTML],{type:we.svg})),{description:"Export to SVG",name:r.name,extension:t.appState.exportEmbedScene?"excalidraw.svg":"svg",fileHandle:r.fileHandle});if(e==="clipboard-svg"){let o=await a.then(s=>s.outerHTML);try{await Mh(o)}catch{throw new Error(x("errors.copyToSystemClipboardFailed"))}return}}let i=Hf({data:t,config:{canvasBackgroundColor:r.exportBackground?r.viewBackgroundColor:!1,padding:r.padding,theme:t.appState.exportWithDarkMode?"dark":"light",scale:t.appState.exportScale,fit:"none",exportingFrame:r.exportingFrame}});if(e==="png"){let a=Ih(i);return t.appState.exportEmbedScene&&a.then(o=>Promise.resolve().then(()=>(Bf(),Ff)).then(({encodePngMetadata:s})=>s({blob:o,metadata:zf(t.elements,t.appState,t.files,"local")}))),$f(a,{description:"Export to PNG",name:r.name,extension:"png",fileHandle:r.fileHandle})}else if(e==="clipboard")try{let a=Ih(i);await WT(a)}catch(a){throw console.warn(a),a.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(x("canvasError.canvasTooBig")):bh&&a.name==="TypeError"?new Error(`${x("alerts.couldNotCopyToClipboard")}
174
+
175
+ ${x("hints.firefox_clipboard_write")}`):new Error(x("alerts.couldNotCopyToClipboard"))}else throw new Error("Unsupported export type")}}),oG,Wne=M(()=>{"use strict";D(),fd(),fd(),yi(),oG=async(e,t,n,r)=>{let{exportBackground:i,viewBackgroundColor:a,fileHandle:o}=t,s=a4(o);if(!o||!Fz(s))throw new Error("fileHandle should exist and should be of type svg or png when resaving");t={...t,exportEmbedScene:!0};let{exportedElements:l,exportingFrame:c}=Qf(e,t,!1);return await Jf({type:s,data:{elements:l,appState:t,files:n},config:{exportBackground:i,viewBackgroundColor:a,name:r,fileHandle:o,exportingFrame:c}}),{fileHandle:o}}}),Vne=M(()=>{}),t1,KM=M(()=>{"use strict";D(),pe(),Vne(),t1=({children:e,checked:t,onChange:n,className:r})=>(0,e1.jsxs)("div",{className:X("Checkbox",r,{"is-checked":t}),onClick:i=>{n(!t,i),i.currentTarget.querySelector(".Checkbox-box").focus()},children:[(0,e1.jsx)("button",{className:"Checkbox-box",role:"checkbox","aria-checked":t,children:SI}),(0,e1.jsx)("div",{className:"Checkbox-label",children:e})]})}),XM,sG,qM,QM,Rb,Ry,n1,lG,Oy=M(()=>{"use strict";D(),pe(),Gne(),Gn(),Sd(),jne(),fd(),Wne(),de(),$e(),ke(),Tt(),KM(),C1(),ae(),It(),Oe(),yi(),Wl(),Vl(),ht(),XM=oe({name:"changeProjectName",label:"labels.fileTitle",trackEvent:!1,perform:(e,t,n)=>({appState:{...t,name:n},storeAction:Z.NONE}),PanelComponent:({appState:e,updateData:t,appProps:n,data:r,app:i})=>(0,Wr.jsx)(iG,{label:x("labels.fileTitle"),value:i.getName(),onChange:a=>t(a),ignoreFocus:r?.ignoreFocus??!1})}),sG=oe({name:"changeExportScale",label:"imageExportDialog.scale",trackEvent:{category:"export",action:"scale"},perform:(e,t,n)=>({appState:{...t,exportScale:n},storeAction:Z.NONE}),PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=ut(e),i=vn(r,t)?bt(r,t):r,a=(o,s,l)=>{let[,,c,d]=dE(o).map(u=>Math.trunc(u*l));return[c+s*2,d+s*2]};return(0,Wr.jsx)(Wr.Fragment,{children:Kb.map(o=>{let[s,l]=a(i,Hh,o),c=`${x("imageExportDialog.label.scale")} ${o}x (${s}x${l})`;return(0,Wr.jsx)(Xe,{size:"small",type:"radio",icon:`${o}x`,name:"export-canvas-scale",title:c,"aria-label":c,id:"export-canvas-scale",checked:o===t.exportScale,onChange:()=>n(o)},o)})})}}),qM=oe({name:"changeExportBackground",label:"imageExportDialog.label.withBackground",trackEvent:{category:"export",action:"toggleBackground"},perform:(e,t,n)=>({appState:{...t,exportBackground:n},storeAction:Z.NONE}),PanelComponent:({appState:e,updateData:t})=>(0,Wr.jsx)(t1,{checked:e.exportBackground,onChange:n=>t(n),children:x("imageExportDialog.label.withBackground")})}),QM=oe({name:"changeExportEmbedScene",label:"imageExportDialog.tooltip.embedScene",trackEvent:{category:"export",action:"embedScene"},perform:(e,t,n)=>({appState:{...t,exportEmbedScene:n},storeAction:Z.NONE}),PanelComponent:({appState:e,updateData:t})=>(0,Wr.jsxs)(t1,{checked:e.exportEmbedScene,onChange:n=>t(n),children:[x("imageExportDialog.label.embedScene"),(0,Wr.jsx)(Gl,{label:x("imageExportDialog.tooltip.embedScene"),long:!0,children:(0,Wr.jsx)("div",{className:"excalidraw-tooltip-icon",children:kI})})]})}),Rb=oe({name:"saveToActiveFile",label:"buttons.save",icon:_h,trackEvent:{category:"export"},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.saveToActiveFile&&!!t.fileHandle&&!t.viewModeEnabled,perform:async(e,t,n,r)=>{let i=!!t.fileHandle;try{let{fileHandle:a}=oy(t.fileHandle)?await oG(e,t,r.files,r.getName()):await c4(e,t,r.files,r.getName());return{storeAction:Z.NONE,appState:{...t,fileHandle:a,toast:i?{message:a?.name?x("toast.fileSavedToFilename").replace("{filename}",`"${a.name}"`):x("toast.fileSaved")}:null}}}catch(a){return a?.name!=="AbortError"?console.error(a):console.warn(a),{storeAction:Z.NONE}}},keyTest:e=>e.key===N.S&&e[N.CTRL_OR_CMD]&&!e.shiftKey}),Ry=oe({name:"saveFileToDisk",label:"exportDialog.disk_title",icon:_h,viewMode:!0,trackEvent:{category:"export"},perform:async(e,t,n,r)=>{try{let{fileHandle:i}=await c4(e,{...t,fileHandle:null},r.files,r.getName());return{storeAction:Z.NONE,appState:{...t,openDialog:null,fileHandle:i,toast:{message:x("toast.fileSaved")}}}}catch(i){return i?.name!=="AbortError"?console.error(i):console.warn(i),{storeAction:Z.NONE}}},keyTest:e=>e.key===N.S&&e.shiftKey&&e[N.CTRL_OR_CMD],PanelComponent:({updateData:e})=>(0,Wr.jsx)(Xe,{type:"button",icon:TI,title:x("buttons.saveAs"),"aria-label":x("buttons.saveAs"),showAriaLabel:qn().editor.isMobile,hidden:!da,onClick:()=>e(null),"data-testid":"save-as-button"})}),n1=oe({name:"loadScene",label:"buttons.load",trackEvent:{category:"export"},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.loadScene&&!t.viewModeEnabled,perform:async(e,t,n,r)=>{try{let{elements:i,appState:a,files:o}=await jz(t,e);return{elements:i,appState:a,files:o,storeAction:Z.CAPTURE}}catch(i){return i?.name==="AbortError"?(console.warn(i),!1):{elements:e,appState:{...t,errorMessage:i.message},files:r.files,storeAction:Z.NONE}}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.O}),lG=oe({name:"exportWithDarkMode",label:"imageExportDialog.label.darkMode",trackEvent:{category:"export",action:"toggleTheme"},perform:(e,t,n)=>({appState:{...t,exportWithDarkMode:n},storeAction:Z.NONE}),PanelComponent:({appState:e,updateData:t})=>(0,Wr.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"-45px",marginBottom:"10px"},children:(0,Wr.jsx)(aG,{value:e.exportWithDarkMode?ze.DARK:ze.LIGHT,onChange:n=>{t(n===ze.DARK)},title:x("imageExportDialog.label.darkMode")})})})}),pS,JM,eA,Yne=M(()=>{"use strict";D(),Oe(),ke(),de(),Tt(),vt(),ae(),qt(),Se(),It(),pe(),ht(),pS="{}",JM=oe({name:"copyStyles",label:"labels.copyStyles",icon:kb,trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=[],a=e.find(o=>t.selectedElementIds[o.id]);if(i.push(a),a&&Io(a)){let o=Ye(a,r.scene.getNonDeletedElementsMap());i.push(o)}return a&&(pS=JSON.stringify(i)),{appState:{...t,toast:{message:x("toast.copyStyles")}},storeAction:Z.NONE}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.altKey&&e.code===rt.C}),eA=oe({name:"pasteStyles",label:"labels.pasteStyles",icon:kb,trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=JSON.parse(pS),a=i[0],o=i[1];if(!iT(a))return{elements:e,storeAction:Z.NONE};let s=bt(e,t,{includeBoundTextElement:!0}),l=s.map(c=>c.id);return{elements:e.map(c=>{if(l.includes(c.id)){let d=a;if(he(c)&&c.containerId&&(d=o),!d)return c;let u=Re(c,{backgroundColor:d?.backgroundColor,strokeWidth:d?.strokeWidth,strokeColor:d?.strokeColor,strokeStyle:d?.strokeStyle,fillStyle:d?.fillStyle,opacity:d?.opacity,roughness:d?.roughness,roundness:d.roundness?AB(d.roundness.type,c)?d.roundness:kB(c):null});if(he(u)){let h=d.fontSize||Vi,m=d.fontFamily||To;u=Re(u,{fontSize:h,fontFamily:m,textAlign:d.textAlign||v1,lineHeight:d.lineHeight||Fl(m)});let p=null;u.containerId&&(p=s.find(f=>he(u)&&f.id===u.containerId)||null),ji(u,p,r.scene.getNonDeletedElementsMap())}return u.type==="arrow"&&Et(d)&&(u=Re(u,{startArrowhead:d.startArrowhead,endArrowhead:d.endArrowhead})),Ae(c)&&(u=Re(u,{roundness:null,backgroundColor:"transparent"})),u}return c}),storeAction:Z.CAPTURE}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.altKey&&e.code===rt.V})}),cG,dG,L1,Zne=M(()=>{"use strict";D(),pe(),Gn(),de(),Oe(),Tt(),ke(),ht(),cG=oe({name:"toggleCanvasMenu",label:"buttons.menu",trackEvent:{category:"menu"},perform:(e,t)=>({appState:{...t,openMenu:t.openMenu==="canvas"?null:"canvas"},storeAction:Z.NONE}),PanelComponent:({appState:e,updateData:t})=>(0,N4.jsx)(Xe,{type:"button",icon:py,"aria-label":x("buttons.menu"),onClick:t,selected:e.openMenu==="canvas"})}),dG=oe({name:"toggleEditMenu",label:"buttons.edit",trackEvent:{category:"menu"},perform:(e,t)=>({appState:{...t,openMenu:t.openMenu==="shape"?null:"shape"},storeAction:Z.NONE}),PanelComponent:({elements:e,appState:t,updateData:n})=>(0,N4.jsx)(Xe,{visible:uy(t,ut(e)),type:"button",icon:II,"aria-label":x("buttons.edit"),onClick:n,selected:t.openMenu==="shape"})}),L1=oe({name:"toggleShortcuts",label:"welcomeScreen.defaults.helpHint",icon:vI,viewMode:!0,trackEvent:{category:"menu",action:"toggleHelpDialog"},perform:(e,t,n,{focusContainer:r})=>(t.openDialog?.name==="help"&&r(),{appState:{...t,openDialog:t.openDialog?.name==="help"?null:{name:"help"}},storeAction:Z.NONE}),keyTest:e=>e.key===N.QUESTION_MARK})}),NN,fS,tA,nA,Kne=M(()=>{"use strict";D(),ke(),de(),te(),Tt(),pe(),vt(),It(),Kr(),Oe(),Ao(),Gn(),Se(),Lr(),$a(),ht(),NN=e=>{if(e.length>=2){let t=e[0].groupIds;for(let n of t)if(e.reduce((r,i)=>r&&Ch(i,n),!0))return!0}return!1},fS=(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});return r.length>=2&&!NN(r)},tA=oe({name:"group",label:"labels.group",icon:e=>(0,Bc.jsx)(Sb,{theme:e.theme}),trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});if(i.length<2)return{appState:t,elements:e,storeAction:Z.NONE};let a=Zc(t);if(a.length===1){let f=a[0],g=new Set(yn(e,f).map(v=>v.id)),b=new Set(i.map(v=>v.id));if(new Set([...Array.from(g),...Array.from(b)]).size===g.size)return{appState:t,elements:e,storeAction:Z.NONE}}let o=[...e];new Set(i.map(f=>f.frameId)).size>1&&vH(i).forEach((f,g)=>{vf(f,r.scene.getNonDeletedElementsMap())});let s=pi(),l=ve(i);o=o.map(f=>l.get(f.id)?Re(f,{groupIds:xz(f.groupIds,s,t.editingGroupId)}):f);let c=yn(o,s),d=c[c.length-1],u=o.lastIndexOf(d),h=o.slice(u+1),m=o.slice(0,u).filter(f=>!Ch(f,s)),p=Yi([...m,...c,...h],ve(c));return{appState:{...t,...V5(s,{...t,selectedGroupIds:{}},ut(o))},elements:p,storeAction:Z.CAPTURE}},predicate:(e,t,n,r)=>fS(e,t,r),keyTest:e=>!e.shiftKey&&e[N.CTRL_OR_CMD]&&e.key===N.G,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,Bc.jsx)(Xe,{hidden:!fS(e,t,r),type:"button",icon:(0,Bc.jsx)(Sb,{theme:t.theme}),onClick:()=>n(null),title:`${x("labels.group")} \u2014 ${K("CtrlOrCmd+G")}`,"aria-label":x("labels.group"),visible:vn(ut(e),t)})}),nA=oe({name:"ungroup",label:"labels.ungroup",icon:e=>(0,Bc.jsx)(Cb,{theme:e.theme}),trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=Zc(t),a=ve(e);if(i.length===0)return{appState:t,elements:e,storeAction:Z.NONE};let o=[...e],s=[];o=o.map(u=>{tn(u)&&s.push(u.id);let h=wz(u.groupIds,t.selectedGroupIds);return h.length===u.groupIds.length?u:Re(u,{groupIds:h})});let l=jr(t,ut(o),t,null),c=r.scene.getSelectedElements(t),d=new Set(c.filter(u=>u.frameId).map(u=>u.frameId));return eb(e).filter(u=>d.has(u.id)).forEach(u=>{u&&(o=ZT(o,bf(o,u,t,a),u,r))}),l.selectedElementIds=Object.entries(l.selectedElementIds).reduce((u,[h,m])=>(m&&!s.includes(h)&&(u[h]=!0),u),{}),{appState:{...t,...l},elements:o,storeAction:Z.CAPTURE}},keyTest:e=>e.shiftKey&&e[N.CTRL_OR_CMD]&&e.key===N.G.toUpperCase(),predicate:(e,t)=>Zc(t).length>0,PanelComponent:({elements:e,appState:t,updateData:n})=>(0,Bc.jsx)(Xe,{type:"button",hidden:Zc(t).length===0,icon:(0,Bc.jsx)(Cb,{theme:t.theme}),onClick:()=>n(null),title:`${x("labels.ungroup")} \u2014 ${K("CtrlOrCmd+Shift+G")}`,"aria-label":x("labels.ungroup"),visible:vn(ut(e),t)})})}),rA,uG=M(()=>{"use strict";D(),rA=(e,t,n,r,i,a,o)=>{e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),e.fill(),o&&(e.strokeStyle=o),e.stroke()}}),Xne=M(()=>{"use strict";D()});function qne(e){let t=0;if(e.length===0)return t;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r}return t}var r1,hG,mG,Ny=M(()=>{"use strict";D(),ae(),uG(),Xne(),r1=(e,t)=>`hsl(${Math.abs(qne(t?.id||e))%37*10}, 100%, 83%)`,hG=e=>{let t=e?.trim()?.codePointAt(0);return(t?String.fromCodePoint(t):"?").toUpperCase()},mG=({context:e,renderConfig:t,appState:n,normalizedWidth:r,normalizedHeight:i})=>{for(let[a,o]of t.remotePointerViewportCoords){let{x:s,y:l}=o,c=n.collaborators.get(a);s-=n.offsetLeft,l-=n.offsetTop;let d=11,u=14,h=s<0||s>r-d||l<0||l>i-u;s=Math.max(s,0),s=Math.min(s,r-d),l=Math.max(l,0),l=Math.min(l,i-u);let m=r1(a,c);e.save(),e.strokeStyle=m,e.fillStyle=m;let p=t.remotePointerUserStates.get(a),f=h||p==="idle"||p==="away";f&&(e.globalAlpha=.3),t.remotePointerButton.get(a)==="down"&&(e.beginPath(),e.arc(s,l,15,0,2*Math.PI,!1),e.lineWidth=3,e.strokeStyle="#ffffff88",e.stroke(),e.closePath(),e.beginPath(),e.arc(s,l,15,0,2*Math.PI,!1),e.lineWidth=1,e.strokeStyle=m,e.stroke(),e.closePath());let g=n.theme===ze.DARK?"#2f6330":KF,b=c?.isSpeaking;b&&(e.fillStyle=g,e.strokeStyle=g,e.lineWidth=10,e.lineJoin="round",e.beginPath(),e.moveTo(s,l),e.lineTo(s+0,l+14),e.lineTo(s+4,l+9),e.lineTo(s+11,l+8),e.closePath(),e.stroke(),e.fill()),e.fillStyle=Ui,e.strokeStyle=Ui,e.lineWidth=6,e.lineJoin="round",e.beginPath(),e.moveTo(s,l),e.lineTo(s+0,l+14),e.lineTo(s+4,l+9),e.lineTo(s+11,l+8),e.closePath(),e.stroke(),e.fill(),e.fillStyle=m,e.strokeStyle=m,e.lineWidth=2,e.lineJoin="round",e.beginPath(),f?(e.moveTo(s-1,l-1),e.lineTo(s-1,l+15),e.lineTo(s+5,l+10),e.lineTo(s+12,l+9),e.closePath(),e.fill()):(e.moveTo(s,l),e.lineTo(s+0,l+14),e.lineTo(s+4,l+9),e.lineTo(s+11,l+8),e.closePath(),e.fill(),e.stroke());let v=t.remotePointerUsernames.get(a)||"";if(!h&&v){e.font="600 12px sans-serif";let y=(b?s+0:s)+d/2,w=(b?l+0:l)+u+2,C=5,A=3,T=e.measureText(v),I=T.actualBoundingBoxDescent+T.actualBoundingBoxAscent,k=Math.max(I,12),R=y-1,O=w-1,P=T.width+2+C*2+2,F=k+2+A*2+2;if(e.roundRect?(e.beginPath(),e.roundRect(R,O,P,F,8),e.fillStyle=m,e.fill(),e.strokeStyle=Ui,e.stroke(),b&&(e.beginPath(),e.roundRect(R-2,O-2,P+4,F+4,8),e.strokeStyle=g,e.stroke())):rA(e,R,O,P,F,8,Ui),e.fillStyle=yh,e.fillText(v,y+C+1,w+A+T.actualBoundingBoxAscent+Math.floor((k-I)/2)+2),b){e.fillStyle=g;let Y=8,j=8,q=5;e.fillRect(R+P+j,O+(F/2-Y/2),2,Y),e.fillRect(R+P+j+q,O+(F/2-Y*2/2),2,Y*2),e.fillRect(R+P+j+q*2,O+(F/2-Y/2),2,Y)}}e.restore(),e.closePath()}}}),Qne=M(()=>{}),F4,Jne=M(()=>{"use strict";D(),Qne(),Ny(),F4=({color:e,onClick:t,name:n,src:r,className:i})=>{let a=hG(n),[o,s]=(0,pG.useState)(!1),l=!o&&r,c=l?void 0:{background:e};return(0,$4.jsx)("div",{className:X("Avatar",i),style:c,onClick:t,children:l?(0,$4.jsx)("img",{className:"Avatar-img",src:r,alt:a,referrerPolicy:"no-referrer",onError:()=>s(!0)}):a})}}),fG,ere=M(()=>{"use strict";D(),Ny(),Jne(),pe(),de(),ht(),Tt(),fG=oe({name:"goToCollaborator",label:"Go to a collaborator",viewMode:!0,trackEvent:{category:"collab"},perform:(e,t,n)=>!n.socketId||t.userToFollow?.socketId===n.socketId||n.isCurrentUser?{appState:{...t,userToFollow:null},storeAction:Z.NONE}:{appState:{...t,userToFollow:{socketId:n.socketId,username:n.username||""},openMenu:t.openMenu==="canvas"?null:t.openMenu},storeAction:Z.NONE},PanelComponent:({updateData:e,data:t,appState:n})=>{let{socketId:r,collaborator:i,withName:a,isBeingFollowed:o}=t,s=r1(r,i),l=X({"is-followed":o,"is-current-user":i.isCurrentUser===!0,"is-speaking":i.isSpeaking,"is-in-call":i.isInCall,"is-muted":i.isMuted}),c=i.isInCall?i.isSpeaking?(0,mr.jsxs)("div",{className:"UserList__collaborator-status-icon-speaking-indicator",title:x("userList.hint.isSpeaking"),children:[(0,mr.jsx)("div",{}),(0,mr.jsx)("div",{}),(0,mr.jsx)("div",{})]}):i.isMuted?(0,mr.jsx)("div",{className:"UserList__collaborator-status-icon-microphone-muted",title:x("userList.hint.micMuted"),children:CM}):(0,mr.jsx)("div",{title:x("userList.hint.inCall"),children:SM}):null;return a?(0,mr.jsxs)("div",{className:`dropdown-menu-item dropdown-menu-item-base UserList__collaborator ${l}`,style:{"--avatar-size":"1.5rem"},onClick:()=>e(i),children:[(0,mr.jsx)(F4,{color:s,onClick:()=>{},name:i.username||"",src:i.avatarUrl,className:l}),(0,mr.jsx)("div",{className:"UserList__collaborator-name",children:i.username}),(0,mr.jsxs)("div",{className:"UserList__collaborator-status-icons","aria-hidden":!0,children:[o&&(0,mr.jsx)("div",{className:"UserList__collaborator-status-icon-is-followed",title:x("userList.hint.followStatus"),children:P1}),c]})]}):(0,mr.jsxs)("div",{className:`UserList__collaborator UserList__collaborator--avatar-only ${l}`,children:[(0,mr.jsx)(F4,{color:s,onClick:()=>{e(i)},name:i.username||"",src:i.avatarUrl,className:l}),c&&(0,mr.jsx)("div",{className:"UserList__collaborator-status-icon",children:c})]})}})}),iA,tre=M(()=>{"use strict";D(),Tt(),_s(),Ao(),de(),ae(),ht(),iA=oe({name:"addToLibrary",trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});for(let a of XC)if(i.some(o=>o.type===a))return{storeAction:Z.NONE,appState:{...t,errorMessage:x(`errors.libraryElementTypeError.${a}`)}};return r.library.getLatestLibrary().then(a=>r.library.setLibrary([{id:pi(),status:"unpublished",elements:i.map(Th),created:Date.now()},...a])).then(()=>({storeAction:Z.NONE,appState:{...t,toast:{message:x("toast.addedToLibrary")}}})).catch(a=>({storeAction:Z.NONE,appState:{...t,errorMessage:a.message}}))},label:"labels.addToLibrary"})}),gG,$N,nre=M(()=>{"use strict";D(),vt(),Qt(),Kr(),gG=(e,t,n)=>{let r=Nf(e,t),i=So(e);return r.flatMap(a=>{let o=$N(a,i,n);return a.map(s=>Re(s,{x:s.x+o.x,y:s.y+o.y}))})},$N=(e,t,{axis:n,position:r})=>{let i=So(e),[a,o]=n==="x"?["minX","maxX"]:["minY","maxY"],s={x:0,y:0};return r==="start"?{...s,[n]:t[a]-i[a]}:r==="end"?{...s,[n]:t[o]-i[o]}:{...s,[n]:(t[a]+t[o])/2-(i[a]+i[o])/2}}}),oi,Dc,EG,bG,yG,vG,xG,wG,rre=M(()=>{"use strict";D(),nre(),pe(),Gn(),Oe(),Se(),Lr(),de(),ke(),It(),ht(),te(),Tt(),oi=(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return i.length>1&&!i.some(a=>Ae(a))},Dc=(e,t,n,r)=>{let i=n.scene.getSelectedElements(t),a=ve(e),o=gG(i,a,r),s=ve(o);return md(e.map(l=>s.get(l.id)||l),t,n)},EG=oe({name:"alignTop",label:"labels.alignTop",icon:Eb,trackEvent:{category:"element"},predicate:oi,perform:(e,t,n,r)=>({appState:t,elements:Dc(e,t,r,{position:"start",axis:"y"}),storeAction:Z.CAPTURE}),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key===N.ARROW_UP,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,zc.jsx)(Xe,{hidden:!oi(e,t,null,r),type:"button",icon:Eb,onClick:()=>n(null),title:`${x("labels.alignTop")} \u2014 ${K("CtrlOrCmd+Shift+Up")}`,"aria-label":x("labels.alignTop"),visible:vn(ut(e),t)})}),bG=oe({name:"alignBottom",label:"labels.alignBottom",icon:bb,trackEvent:{category:"element"},predicate:oi,perform:(e,t,n,r)=>({appState:t,elements:Dc(e,t,r,{position:"end",axis:"y"}),storeAction:Z.CAPTURE}),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key===N.ARROW_DOWN,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,zc.jsx)(Xe,{hidden:!oi(e,t,null,r),type:"button",icon:bb,onClick:()=>n(null),title:`${x("labels.alignBottom")} \u2014 ${K("CtrlOrCmd+Shift+Down")}`,"aria-label":x("labels.alignBottom"),visible:vn(ut(e),t)})}),yG=oe({name:"alignLeft",label:"labels.alignLeft",icon:yb,trackEvent:{category:"element"},predicate:oi,perform:(e,t,n,r)=>({appState:t,elements:Dc(e,t,r,{position:"start",axis:"x"}),storeAction:Z.CAPTURE}),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key===N.ARROW_LEFT,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,zc.jsx)(Xe,{hidden:!oi(e,t,null,r),type:"button",icon:yb,onClick:()=>n(null),title:`${x("labels.alignLeft")} \u2014 ${K("CtrlOrCmd+Shift+Left")}`,"aria-label":x("labels.alignLeft"),visible:vn(ut(e),t)})}),vG=oe({name:"alignRight",label:"labels.alignRight",icon:vb,trackEvent:{category:"element"},predicate:oi,perform:(e,t,n,r)=>({appState:t,elements:Dc(e,t,r,{position:"end",axis:"x"}),storeAction:Z.CAPTURE}),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key===N.ARROW_RIGHT,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,zc.jsx)(Xe,{hidden:!oi(e,t,null,r),type:"button",icon:vb,onClick:()=>n(null),title:`${x("labels.alignRight")} \u2014 ${K("CtrlOrCmd+Shift+Right")}`,"aria-label":x("labels.alignRight"),visible:vn(ut(e),t)})}),xG=oe({name:"alignVerticallyCentered",label:"labels.centerVertically",icon:xb,trackEvent:{category:"element"},predicate:oi,perform:(e,t,n,r)=>({appState:t,elements:Dc(e,t,r,{position:"center",axis:"y"}),storeAction:Z.CAPTURE}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,zc.jsx)(Xe,{hidden:!oi(e,t,null,r),type:"button",icon:xb,onClick:()=>n(null),title:x("labels.centerVertically"),"aria-label":x("labels.centerVertically"),visible:vn(ut(e),t)})}),wG=oe({name:"alignHorizontallyCentered",label:"labels.centerHorizontally",icon:wb,trackEvent:{category:"element"},predicate:oi,perform:(e,t,n,r)=>({appState:t,elements:Dc(e,t,r,{position:"center",axis:"x"}),storeAction:Z.CAPTURE}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,zc.jsx)(Xe,{hidden:!oi(e,t,null,r),type:"button",icon:wb,onClick:()=>n(null),title:x("labels.centerHorizontally"),"aria-label":x("labels.centerHorizontally"),visible:vn(ut(e),t)})})}),SG,ire=M(()=>{"use strict";D(),vt(),Kr(),Qt(),SG=(e,t,n)=>{let[r,i,a,o]=n.axis==="x"?["minX","midX","maxX","width"]:["minY","midY","maxY","height"],s=So(e),l=Nf(e,t).map(h=>[h,So(h)]).sort((h,m)=>h[1][i]-m[1][i]),c=0;for(let h of l)c+=h[1][o];let d=(s[o]-c)/(l.length-1);if(d<0){let h=l.findIndex(g=>g[1][r]===s[r]),m=l.findIndex(g=>g[1][a]===s[a]),p=(l[m][1][i]-l[h][1][i])/(l.length-1),f=l[h][1][i];return l.flatMap(([g,b],v)=>{let y={x:0,y:0};return v!==h&&v!==m&&(f+=p,y[n.axis]=f-b[i]),g.map(w=>Re(w,{x:w.x+y.x,y:w.y+y.y}))})}let u=s[r];return l.flatMap(([h,m])=>{let p={x:0,y:0};return p[n.axis]=u-m[r],u+=d,u+=m[o],h.map(f=>Re(f,{x:f.x+p.x,y:f.y+p.y}))})}}),gS,ES,CG,TG,are=M(()=>{"use strict";D(),pe(),Gn(),ire(),Oe(),Se(),Lr(),de(),ke(),It(),ht(),te(),Tt(),gS=(e,t)=>{let n=t.scene.getSelectedElements(e);return n.length>1&&!n.some(r=>Ae(r))},ES=(e,t,n,r)=>{let i=n.scene.getSelectedElements(t),a=SG(i,n.scene.getNonDeletedElementsMap(),r),o=ve(a);return md(e.map(s=>o.get(s.id)||s),t,n)},CG=oe({name:"distributeHorizontally",label:"labels.distributeHorizontally",trackEvent:{category:"element"},perform:(e,t,n,r)=>({appState:t,elements:ES(e,t,r,{space:"between",axis:"x"}),storeAction:Z.CAPTURE}),keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===rt.H,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,B4.jsx)(Xe,{hidden:!gS(t,r),type:"button",icon:DI,onClick:()=>n(null),title:`${x("labels.distributeHorizontally")} \u2014 ${K("Alt+H")}`,"aria-label":x("labels.distributeHorizontally"),visible:vn(ut(e),t)})}),TG=oe({name:"distributeVertically",label:"labels.distributeVertically",trackEvent:{category:"element"},perform:(e,t,n,r)=>({appState:t,elements:ES(e,t,r,{space:"between",axis:"y"}),storeAction:Z.CAPTURE}),keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===rt.V,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,B4.jsx)(Xe,{hidden:!gS(t,r),type:"button",icon:_I,onClick:()=>n(null),title:`${x("labels.distributeVertically")} \u2014 ${K("Alt+V")}`,"aria-label":x("labels.distributeVertically"),visible:vn(ut(e),t)})})}),aA,oA,bS,FN,ore=M(()=>{"use strict";D(),Tt(),It(),Oe(),DH(),te(),ke(),Qt(),Fa(),Lr(),pe(),ht(),aA=oe({name:"flipHorizontal",label:"labels.flipHorizontal",icon:AM,trackEvent:{category:"element"},perform:(e,t,n,r)=>({elements:md(bS(e,r.scene.getNonDeletedElementsMap(),t,"horizontal",r),t,r),appState:t,storeAction:Z.CAPTURE}),keyTest:e=>e.shiftKey&&e.code===rt.H}),oA=oe({name:"flipVertical",label:"labels.flipVertical",icon:MM,trackEvent:{category:"element"},perform:(e,t,n,r)=>({elements:md(bS(e,r.scene.getNonDeletedElementsMap(),t,"vertical",r),t,r),appState:t,storeAction:Z.CAPTURE}),keyTest:e=>e.shiftKey&&e.code===rt.V&&!e[N.CTRL_OR_CMD]}),bS=(e,t,n,r,i)=>{let a=bt(ut(e),n,{includeBoundTextElement:!0,includeElementsInFrames:!0}),o=FN(a,e,t,n,r,i),s=ve(o);return e.map(l=>s.get(l.id)||l)},FN=(e,t,n,r,i,a)=>{let{minX:o,minY:s,maxX:l,maxY:c}=So(e);return I4(n,e,n,"nw",!0,!0,i==="horizontal"?l:o,i==="horizontal"?s:c),Tl(r)?zE(e,a):UE(e,n),e}}),uh,z4,Ob,Nb,$b,Fb,IG=M(()=>{"use strict";D(),ke(),Tt(),vd(),cU(),fd(),Oe(),fd(),de(),ae(),pe(),ht(),uh=oe({name:"copy",label:"labels.copy",icon:Wf,trackEvent:{category:"element"},perform:async(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});try{await GT(i,r.files,n)}catch(a){return{storeAction:Z.NONE,appState:{...t,errorMessage:a.message}}}return{storeAction:Z.NONE}},keyTest:void 0}),z4=oe({name:"paste",label:"labels.paste",trackEvent:{category:"element"},perform:async(e,t,n,r)=>{let i;try{i=await fH()}catch(a){return a.name==="AbortError"||a.name==="NotAllowedError"?!1:(console.error(`actionPaste ${a.name}: ${a.message}`),bh?{storeAction:Z.NONE,appState:{...t,errorMessage:x("hints.firefox_clipboard_write")}}:{storeAction:Z.NONE,appState:{...t,errorMessage:x("errors.asyncPasteFailedOnRead")}})}try{r.pasteFromClipboard(pH({types:i}))}catch(a){return console.error(a),{storeAction:Z.NONE,appState:{...t,errorMessage:x("errors.asyncPasteFailedOnParse")}}}return{storeAction:Z.NONE}},keyTest:void 0}),Ob=oe({name:"cut",label:"labels.cut",icon:mM,trackEvent:{category:"element"},perform:(e,t,n,r)=>(uh.perform(e,t,n,r),Ty.perform(e,t,null,r)),keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.X}),Nb=oe({name:"copyAsSvg",label:"labels.copyAsSvg",icon:kM,trackEvent:{category:"element"},perform:async(e,t,n,r)=>{if(!r.canvas)return{storeAction:Z.NONE};let{exportedElements:i,exportingFrame:a}=Qf(e,t,!0);try{return await Jf({type:"clipboard-svg",data:{elements:i,appState:t,files:r.files},config:{...t,exportingFrame:a,name:r.getName()}}),{storeAction:Z.NONE}}catch(o){return console.error(o),{appState:{...t,errorMessage:o.message},storeAction:Z.NONE}}},predicate:e=>qE&&e.length>0,keywords:["svg","clipboard","copy"]}),$b=oe({name:"copyAsPng",label:"labels.copyAsPng",icon:PM,trackEvent:{category:"element"},perform:async(e,t,n,r)=>{if(!r.canvas)return{storeAction:Z.NONE};let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),{exportedElements:a,exportingFrame:o}=Qf(e,t,!0);try{return await Jf({type:"clipboard",data:{elements:a,appState:t,files:r.files},config:{...t,exportingFrame:o,name:t.name||r.getName()}}),{appState:{...t,toast:{message:x("toast.copyToClipboardAsPng",{exportSelection:i.length?x("toast.selection"):x("toast.canvas"),exportColorScheme:t.exportWithDarkMode?x("buttons.darkMode"):x("buttons.lightMode")})}},storeAction:Z.NONE}}catch(s){return console.error(s),{appState:{...t,errorMessage:s.message},storeAction:Z.NONE}}},predicate:e=>ly&&e.length>0,keyTest:e=>e.code===rt.C&&e.altKey&&e.shiftKey,keywords:["png","clipboard","copy"]}),Fb=oe({name:"copyText",label:"labels.copyText",trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}).reduce((a,o)=>(he(o)&&a.push(o.text),a),[]).join(`
176
+
177
+ `);try{Mh(i)}catch{throw new Error(x("errors.copyToSystemClipboardFailed"))}return{storeAction:Z.NONE}},predicate:(e,t,n,r)=>qE&&r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}).some(he),keywords:["text","clipboard","copy"]})}),Bb,sre=M(()=>{"use strict";D(),ke(),Tt(),ae(),pe(),ht(),Bb=oe({name:"gridMode",icon:OM,keywords:["snap"],label:"labels.toggleGrid",viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.gridSize},perform(e,t){return{appState:{...t,gridSize:this.checked(t)?null:td,objectsSnapModeEnabled:!1},storeAction:Z.NONE}},checked:e=>e.gridSize!==null,predicate:(e,t,n)=>typeof n.gridModeEnabled>"u",keyTest:e=>e[N.CTRL_OR_CMD]&&e.code===rt.QUOTE})}),i1,lre=M(()=>{"use strict";D(),pe(),ke(),ht(),Tt(),i1=oe({name:"zenMode",label:"buttons.zenMode",icon:_M,paletteName:"Toggle zen mode",viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.zenModeEnabled},perform(e,t){return{appState:{...t,zenModeEnabled:!this.checked(t)},storeAction:Z.NONE}},checked:e=>e.zenModeEnabled,predicate:(e,t,n)=>typeof n.zenModeEnabled>"u",keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===rt.Z})}),sA,cre=M(()=>{"use strict";D(),pe(),ke(),ht(),Tt(),sA=oe({name:"objectsSnapMode",label:"buttons.objectsSnapMode",icon:DM,viewMode:!1,trackEvent:{category:"canvas",predicate:e=>!e.objectsSnapModeEnabled},perform(e,t){return{appState:{...t,objectsSnapModeEnabled:!this.checked(t),gridSize:null},storeAction:Z.NONE}},checked:e=>e.objectsSnapModeEnabled,predicate:(e,t,n)=>typeof n.objectsSnapModeEnabled>"u",keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===rt.S})}),Rh,MG=M(()=>{"use strict";D(),Tt(),ke(),pe(),ht(),Rh=oe({name:"stats",label:"stats.title",icon:IM,paletteName:"Toggle stats",viewMode:!0,trackEvent:{category:"menu"},perform(e,t){return{appState:{...t,showStats:!this.checked(t)},storeAction:Z.NONE}},checked:e=>e.showStats,keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===rt.SLASH})}),lA,cA,BN,zN,AG,kG=M(()=>{"use strict";D(),ae(),Oe(),vt(),qt(),pT(),Se(),te(),Tt(),$a(),ht(),lA=oe({name:"unbindText",label:"labels.unbindText",trackEvent:{category:"element"},predicate:(e,t,n,r)=>r.scene.getSelectedElements(t).some(i=>Io(i)),perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=r.scene.getNonDeletedElementsMap();return i.forEach(o=>{let s=Ye(o,a);if(s){let{width:l,height:c}=ys(s.originalText,An(s),s.lineHeight),d=sz(o.id);mT(o.id);let{x:u,y:h}=hf(o,s,a);ie(s,{containerId:null,width:l,height:c,text:s.originalText,x:u,y:h}),ie(o,{boundElements:o.boundElements?.filter(m=>m.id!==s.id),height:d||o.height})}}),{elements:e,appState:t,storeAction:Z.CAPTURE}}}),cA=oe({name:"bindText",label:"labels.bindText",trackEvent:{category:"element"},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);if(i.length===2){let a=he(i[0])||he(i[1]),o;if(Rl(i[0])?o=i[0]:Rl(i[1])&&(o=i[1]),a&&o&&Ye(o,r.scene.getNonDeletedElementsMap())===null)return!0}return!1},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a,o;he(i[0])&&Rl(i[1])?(a=i[0],o=i[1]):(a=i[1],o=i[0]),ie(a,{containerId:o.id,verticalAlign:Yr.MIDDLE,textAlign:vh.CENTER}),ie(o,{boundElements:(o.boundElements||[]).concat({type:"text",id:a.id})});let s=o.height;return ji(a,o,r.scene.getNonDeletedElementsMap()),Rf(o.id,s),{elements:BN(e,o,a),appState:{...t,selectedElementIds:{[o.id]:!0}},storeAction:Z.CAPTURE}}}),BN=(e,t,n)=>{let r=e.slice(),i=r.findIndex(o=>o.id===n.id);r.splice(i,1);let a=r.findIndex(o=>o.id===t.id);return r.splice(a+1,0,n),Yi(r,ve([t,n])),r},zN=(e,t,n)=>{let r=e.slice(),i=r.findIndex(o=>o.id===t.id);r.splice(i,1);let a=r.findIndex(o=>o.id===n.id);return r.splice(a,0,t),Yi(r,ve([t,n])),r},AG=oe({name:"wrapTextInContainer",label:"labels.createContainerFromText",trackEvent:{category:"element"},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=i.every(o=>he(o));return i.length>0&&a},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=e.slice(),o={};for(let s of i)if(he(s)){let l=As({type:"rectangle",backgroundColor:t.currentItemBackgroundColor,boundElements:[...s.boundElements||[],{id:s.id,type:"text"}],angle:s.angle,fillStyle:t.currentItemFillStyle,strokeColor:t.currentItemStrokeColor,roughness:t.currentItemRoughness,strokeWidth:t.currentItemStrokeWidth,strokeStyle:t.currentItemStrokeStyle,roundness:t.currentItemRoundness==="round"?{type:id("rectangle")?Fn.ADAPTIVE_RADIUS:Fn.PROPORTIONAL_RADIUS}:null,opacity:100,locked:!1,x:s.x-In,y:s.y-In,width:Il(s.width,"rectangle"),height:Il(s.height,"rectangle"),groupIds:s.groupIds,frameId:s.frameId});if(s.boundElements?.length){let c=s.boundElements.filter(d=>d.type==="arrow").map(d=>d.id);a.filter(d=>c.includes(d.id)).forEach(d=>{let u=d.startBinding,h=d.endBinding;u?.elementId===s.id&&(u={...u,elementId:l.id}),h?.elementId===s.id&&(h={...h,elementId:l.id}),(u||h)&&ie(d,{startBinding:u,endBinding:h},!1)})}ie(s,{containerId:l.id,verticalAlign:Yr.MIDDLE,boundElements:null,textAlign:vh.CENTER},!1),ji(s,l,r.scene.getNonDeletedElementsMap()),a=zN([...a,l],l,s),o[l.id]=!0}return{elements:a,appState:{...t,selectedElementIds:o},storeAction:Z.CAPTURE}}})}),dre=M(()=>{}),E2,yS,b2,HN,UN,y2,_p,PG,vS,H4,Au,DG,GN,_G,jN,LG=M(()=>{"use strict";D(),te(),ny(),vt(),Gn(),pe(),de(),ke(),ae(),Qt(),Sd(),It(),RT(),Gh(),dre(),xi(),$e(),Se(),OT(),E2=320,yS=85,b2=5,HN=42,UN=500,y2=!1,_p=new Map,PG=({element:e,elementsMap:t,setAppState:n,onLinkOpen:r,setToast:i,updateEmbedValidationStatus:a})=>{let o=cv(),s=N1(),l=e.link||"",[c,d]=(0,Oa.useState)(l),u=(0,Oa.useRef)(null),h=o.showHyperlinkPopup==="editor",m=(0,Oa.useCallback)(()=>{if(!u.current)return;let v=Da(u.current.value)||null;if(!e.link&&v&&dt("hyperlink","create"),fr(e)){if(o.activeEmbeddable?.element===e&&n({activeEmbeddable:null}),!v){ie(e,{link:null}),a(e,!1);return}if(!gf(v,s.validateEmbeddable))v&&i({message:x("toast.unableToEmbed"),closable:!0}),e.link&&_p.set(e.id,e.link),ie(e,{link:v}),a(e,!1);else{let{width:y,height:w}=e,C=Kc(v);C?.error instanceof URIError&&i({message:x("toast.unrecognizedLinkFormat"),closable:!0});let A=C?C.intrinsicSize.w/C.intrinsicSize.h:1,T=_p.get(e.id)!==e.link;ie(e,{...T?{width:C?.type==="video"?y>w?y:w*A:y,height:C?.type==="video"&&y>w?y/A:w}:{},link:v}),a(e,!0),_p.has(e.id)&&_p.delete(e.id)}}else ie(e,{link:v})},[e,i,s.validateEmbeddable,o.activeEmbeddable,n,a]);(0,Oa.useLayoutEffect)(()=>()=>{m()},[m]),(0,Oa.useEffect)(()=>{let v=null,y=w=>{h||(v&&clearTimeout(v),jN(e,t,o,[w.clientX,w.clientY])&&(v=window.setTimeout(()=>{n({showHyperlinkPopup:!1})},UN)))};return window.addEventListener("pointermove",y,!1),()=>{window.removeEventListener("pointermove",y,!1),v&&clearTimeout(v)}},[o,e,h,n,t]);let p=(0,Oa.useCallback)(()=>{dt("hyperlink","delete"),ie(e,{link:null}),h&&(u.current.value=""),n({showHyperlinkPopup:!1})},[n,e,h]),f=()=>{dt("hyperlink","edit","popup-ui"),n({showHyperlinkPopup:"editor"})},{x:g,y:b}=vS(e,o,t);return o.contextMenu||o.draggingElement||o.resizingElement||o.isRotating||o.openMenu||o.viewModeEnabled?null:(0,ps.jsxs)("div",{className:"excalidraw-hyperlinkContainer",style:{top:`${b}px`,left:`${g}px`,width:E2,padding:b2},onClick:()=>{!e.link&&!h&&n({showHyperlinkPopup:"editor"})},children:[h?(0,ps.jsx)("input",{className:X("excalidraw-hyperlinkContainer-input"),placeholder:"Type or paste your link here",ref:u,value:c,onChange:v=>d(v.target.value),autoFocus:!0,onKeyDown:v=>{v.stopPropagation(),v[N.CTRL_OR_CMD]&&v.key===N.K&&v.preventDefault(),(v.key===N.ENTER||v.key===N.ESCAPE)&&(m(),n({showHyperlinkPopup:"info"}))}}):e.link?(0,ps.jsx)("a",{href:Da(e.link||""),className:"excalidraw-hyperlinkContainer-link",target:wT(e.link)?"_self":"_blank",onClick:v=>{if(e.link&&r){let y=nT("excalidraw-link",v.nativeEvent);r({...e,link:Da(e.link)},y),y.defaultPrevented&&v.preventDefault()}},rel:"noopener noreferrer",children:e.link}):(0,ps.jsx)("div",{className:"excalidraw-hyperlinkContainer-link",children:x("labels.link.empty")}),(0,ps.jsxs)("div",{className:"excalidraw-hyperlinkContainer__buttons",children:[!h&&(0,ps.jsx)(Xe,{type:"button",title:x("buttons.edit"),"aria-label":x("buttons.edit"),label:x("buttons.edit"),onClick:f,className:"excalidraw-hyperlinkContainer--edit",icon:I1}),l&&!fr(e)&&(0,ps.jsx)(Xe,{type:"button",title:x("buttons.remove"),"aria-label":x("buttons.remove"),label:x("buttons.remove"),onClick:p,className:"excalidraw-hyperlinkContainer--remove",icon:zl})]})]})},vS=(e,t,n)=>{let[r,i]=De(e,n),{x:a,y:o}=Gi({sceneX:r+e.width/2,sceneY:i},t),s=a-t.offsetLeft-E2/2,l=o-t.offsetTop-yS;return{x:s,y:l}},H4=(e,t)=>{let n=bt(e,t);return n[0]?.link?fr(n[0])?"labels.link.editEmbed":"labels.link.edit":fr(n[0])?"labels.link.createEmbed":"labels.link.create"},Au=null,DG=(e,t,n)=>{Au&&clearTimeout(Au),Au=window.setTimeout(()=>GN(e,t,n),tB)},GN=(e,t,n)=>{if(!e.link)return;let r=eh();r.classList.add("excalidraw-tooltip--visible"),r.style.maxWidth="20rem",r.textContent=e.link;let[i,a,o,s]=De(e,n),[l,c,d,u]=XE([i,a,o,s],e.angle,t),h=Gi({sceneX:l,sceneY:c},t);O4(r,{left:h.x,top:h.y,width:d,height:u},"top"),dt("hyperlink","tooltip","link-icon"),y2=!0},_G=()=>{Au&&clearTimeout(Au),y2&&(y2=!1,eh().classList.remove("excalidraw-tooltip--visible"))},jN=(e,t,n,[r,i])=>{let{x:a,y:o}=Ft({clientX:r,clientY:i},n),s=15/n.zoom.value;if(KE(a,o,e,t))return!1;let[l,c,d]=De(e,t);if(a>=l&&a<=d&&o>=c-yS&&o<=c)return!1;let{x:u,y:h}=vS(e,n,t);return!(r>=u-s&&r<=u+E2+b2*2+s&&i>=h-s&&i<=h+s+b2*2+HN)}}),$y,ure=M(()=>{"use strict";D(),LG(),pe(),Gn(),Se(),de(),ke(),It(),ht(),te(),Tt(),$y=oe({name:"hyperlink",label:(e,t)=>H4(e,t),icon:Zf,perform:(e,t)=>t.showHyperlinkPopup==="editor"?!1:{elements:e,appState:{...t,showHyperlinkPopup:"editor",openMenu:null},storeAction:Z.CAPTURE},trackEvent:{category:"hyperlink",action:"click"},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.K,predicate:(e,t)=>bt(e,t).length===1,PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=bt(e,t);return(0,RG.jsx)(Xe,{type:"button",icon:Zf,"aria-label":x(H4(e,t)),title:`${fr(e[0])?x("labels.link.labelEmbed"):x("labels.link.label")} - ${K("CtrlOrCmd+K")}`,onClick:()=>n(null),selected:r.length===1&&!!r[0].link})}})}),v2,dA,OG,NG=M(()=>{"use strict";D(),pe(),vt(),Se(),ke(),It(),ht(),te(),Tt(),v2=e=>e.every(t=>!t.locked),dA=oe({name:"toggleElementLock",label:(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1});return r.length===1&&!Ae(r[0])?r[0].locked?"labels.elementLock.unlock":"labels.elementLock.lock":v2(r)?"labels.elementLock.lockAll":"labels.elementLock.unlockAll"},icon:(e,t)=>{let n=bt(t,e);return v2(n)?T1:Dh},trackEvent:{category:"element"},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return i.length>0&&!i.some(a=>a.locked&&a.frameId)},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});if(!i.length)return!1;let a=v2(i),o=ve(i);return{elements:e.map(s=>o.has(s.id)?Re(s,{locked:a}):s),appState:{...t,selectedLinearElement:a?null:t.selectedLinearElement},storeAction:Z.CAPTURE}},keyTest:(e,t,n,r)=>e.key.toLocaleLowerCase()===N.L&&e[N.CTRL_OR_CMD]&&e.shiftKey&&r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}).length>0}),OG=oe({name:"unlockAllElements",paletteName:"Unlock all elements",trackEvent:{category:"canvas"},viewMode:!1,icon:Dh,predicate:(e,t)=>bt(e,t).length===0&&e.some(n=>n.locked),perform:(e,t)=>{let n=e.filter(r=>r.locked);return{elements:e.map(r=>r.locked?Re(r,{locked:!1}):r),appState:{...t,selectedElementIds:Object.fromEntries(n.map(r=>[r.id,!0]))},storeAction:Z.CAPTURE}},label:"labels.elementLock.unlockAll"})}),$G,hre=M(()=>{"use strict";D(),$G=()=>{let[e,t]=(0,Fy.useState)(null),n=(0,Fy.useCallback)(r=>t(r),[]);return[e,n]}}),mre=M(()=>{}),pre=M(()=>{}),Ra,Cd=M(()=>{"use strict";D(),pre(),Ra=FG.default.forwardRef(({children:e,padding:t,className:n,style:r},i)=>(0,BG.jsx)("div",{className:X("Island",n),style:{"--padding":t,...r},ref:i,children:e}))}),fre=M(()=>{}),UG,gre=M(()=>{"use strict";D(),fre(),ke(),MU(),UG=e=>{let{closeOnClickOutside:t=!0}=e,n=GM({className:"excalidraw-modal-container"}),r=(0,HG.useRef)(document.body.classList.contains("excalidraw-animations-disabled"));if(!n)return null;let i=a=>{a.key===N.ESCAPE&&(a.nativeEvent.stopImmediatePropagation(),a.stopPropagation(),e.onCloseRequest())};return(0,zG.createPortal)((0,a1.jsxs)("div",{className:X("Modal",e.className,{"animations-disabled":r.current}),role:"dialog","aria-modal":"true",onKeyDown:i,"aria-labelledby":e.labelledBy,"data-prevent-outside-click":!0,children:[(0,a1.jsx)("div",{className:"Modal__background",onClick:t?e.onCloseRequest:void 0}),(0,a1.jsx)("div",{className:"Modal__content",style:{"--max-width":`${e.maxWidth}px`},tabIndex:0,children:e.children})]}),n)}}),U4,xS,GG,uA,zy=M(()=>{"use strict";D(),Zi(),Hn(),Wh(),U4=_t(new Map),xS=async e=>await QE({data:{elements:e,appState:{exportBackground:!1,viewBackgroundColor:Ge.white},files:null},config:{}}),GG=(e,t,n)=>{let[r,i]=(0,By.useState)();return(0,By.useEffect)(()=>{if(t)if(e){let a=n.get(e);a?i(a):(async()=>{let o=await xS(t);o.querySelector(".style-fonts")?.remove(),o&&(n.set(e,o),i(o))})()}else(async()=>{let a=await xS(t);i(a)})()},[e,t,n,i]),r},uA=()=>{let[e]=Ze(U4,Xn);return{clearLibraryCache:()=>e.clear(),deleteItemsFromLibraryCache:t=>{t.forEach(n=>e.delete(n))},svgCache:e}}}),jG,Ere=M(()=>{"use strict";D(),te(),jG=class{jobs=[];running=!1;tick(){if(this.running)return;let e=this.jobs.shift();e?(this.running=!0,e.promise.resolve(RE(e.jobFactory,...e.args).finally(()=>{this.running=!1,this.tick()}))):this.running=!1}push(e,...t){let n=tT();return this.jobs.push({jobFactory:e,promise:n,args:t}),this.tick(),n}}}),wS,hh,ku,WN,VN,SS,YN,G4,hA,CS,Lp,Pu,Rp,x2,TS,bre,mh=M(()=>{"use strict";D(),yi(),jh(),Hn(),Qt(),bd(),de(),ae(),zy(),te(),ty(),Ere(),Oe(),wS=new va,hh=_t({status:"loaded",isInitialized:!1,libraryItems:[]}),ku=e=>ud(e),WN=(e,t)=>!e.find(n=>n.elements.length!==t.elements.length?!1:n.elements.every((r,i)=>r.id===t.elements[i].id&&r.versionNonce===t.elements[i].versionNonce)),VN=(e,t)=>{let n=[];for(let r of t)WN(e,r)&&n.push(r);return[...n,...e]},SS=(e,t)=>{let n=ve(t),r={deletedItems:new Map,addedItems:new Map};for(let a of e)n.has(a.id)||r.deletedItems.set(a.id,a);let i=ve(e);for(let a of t)i.has(a.id)||r.addedItems.set(a.id,a);return r},YN=class{currLibraryItems=[];prevLibraryItems=ku(this.currLibraryItems);app;constructor(e){this.app=e}updateQueue=[];getLastUpdateTask=()=>this.updateQueue[this.updateQueue.length-1];notifyListeners=()=>{if(this.updateQueue.length>0)Pa.set(hh,e=>({status:"loading",libraryItems:this.currLibraryItems,isInitialized:e.isInitialized}));else{Pa.set(hh,{status:"loaded",libraryItems:this.currLibraryItems,isInitialized:!0});try{let e=this.prevLibraryItems;this.prevLibraryItems=ku(this.currLibraryItems);let t=ku(this.currLibraryItems);this.app.props.onLibraryChange?.(t),wS.trigger(SS(e,t),t)}catch(e){console.error(e)}}};destroy=()=>{this.updateQueue=[],this.currLibraryItems=[],Pa.set(U4,new Map)};resetLibrary=()=>this.setLibrary([]);getLatestLibrary=()=>new Promise(async e=>{try{let t=await(this.getLastUpdateTask()||this.currLibraryItems);this.updateQueue.length>0?e(this.getLatestLibrary()):e(ku(t))}catch{return e(this.currLibraryItems)}});updateLibrary=async({libraryItems:e,prompt:t=!1,merge:n=!1,openLibraryMenu:r=!1,defaultStatus:i="unpublished"})=>(r&&this.app.setState({openSidebar:{name:Ss.name,tab:DE}}),this.setLibrary(()=>new Promise(async(a,o)=>{try{let s=await(typeof e=="function"&&!(e instanceof Blob)?e(this.currLibraryItems):e),l;s instanceof Blob?l=await Bz(s,i):l=Ef(s,i),!t||window.confirm(x("alerts.confirmAddLibrary",{numShapes:l.length}))?(t&&this.app.focusContainer(),a(n?VN(this.currLibraryItems,l):l)):o(new w1)}catch(s){o(s)}})));setLibrary=e=>{let t=new Promise(async(n,r)=>{try{await this.getLastUpdateTask(),typeof e=="function"&&(e=e(this.currLibraryItems)),this.currLibraryItems=ku(await e),n(this.currLibraryItems)}catch(i){r(i)}}).catch(n=>{if(n.name==="AbortError")return console.warn("Library update aborted by user"),this.currLibraryItems;throw n}).finally(()=>{this.updateQueue=this.updateQueue.filter(n=>n!==t),this.notifyListeners()});return this.updateQueue.push(t),this.notifyListeners(),t}},G4=YN,hA=e=>{let t=Math.ceil(Math.sqrt(e.length)),n=[],r=h=>e.slice(h*t,h*t+t).reduce((m,p)=>{let{height:f}=So(p.elements);return Math.max(m,f)},0),i=h=>{let m=0,p=0,f=0;for(let g of e){if(m%t===0&&(p=0),p===h){let{width:b}=So(g.elements);f=Math.max(f,b)}m++,p++}return f},a=0,o=0,s=0,l=0,c=0,d=0,u=0;for(let h of e){c&&c%t===0&&(o+=s+50,a=0,d=0,u++),d===0&&(s=r(u)),l=i(d);let{minX:m,minY:p,width:f,height:g}=So(h.elements),b=(l-f)/2,v=(s-g)/2;n.push(...h.elements.map(y=>({...y,x:y.x+a+b-m,y:y.y+o+v-p}))),a+=l+50,c++,d++}return n},CS=()=>{let e=new URLSearchParams(window.location.hash.slice(1)).get(X2.addLibrary)||new URLSearchParams(window.location.search).get(K2.addLibrary),t=e?new URLSearchParams(window.location.hash.slice(1)).get("token"):null;return e?{libraryUrl:e,idToken:t}:null},Lp=class Qp{static queue=new jG;static async getLibraryItems(t,n,r=!0){let i=()=>new Promise(async(a,o)=>{try{let s=await t.load({source:n});a(Ef(s?.libraryItems||[],"published"))}catch(s){o(s)}});return r?Qp.queue.push(i):i()}static run=async(t,n)=>{let r=new Qp(t);return Qp.queue.push(()=>n(r))};adapter;constructor(t){this.adapter=t}getLibraryItems(t){return Qp.getLibraryItems(this.adapter,t,!1)}},Pu=0,Rp=0,x2=e=>OH(e.map(t=>`${t.id}:${RH(t.elements)}`).sort().join()),TS=async(e,t)=>{try{return Rp++,await Lp.run(e,async n=>{let r=ve(await n.getLibraryItems("save"));for(let[s]of t.deletedItems)r.delete(s);let i=[];for(let[s,l]of t.addedItems)r.has(s)?r.set(s,l):i.push(l);let a=i.concat(Array.from(r.values())),o=x2(a);return o!==Pu&&await e.save({libraryItems:a}),Pu=o,a})}finally{Rp--}},bre=e=>{let{excalidrawAPI:t}=e,n=(0,Oh.useRef)(e);n.current=e;let r=(0,Oh.useRef)(!1);(0,Oh.useEffect)(()=>{if(!t)return;r.current=!1;let i=async({libraryUrl:s,idToken:l})=>{let c=new Promise(async(u,h)=>{try{let m=await(await fetch(decodeURIComponent(s))).blob();u(m)}catch(m){h(m)}}),d=l!==t.id;await(d&&document.hidden?new Promise(u=>{window.addEventListener("focus",()=>u(),{once:!0})}):null);try{await t.updateLibrary({libraryItems:c,prompt:d,merge:!0,defaultStatus:"published",openLibraryMenu:!0})}catch(u){throw u}finally{if(window.location.hash.includes(X2.addLibrary)){let u=new URLSearchParams(window.location.hash.slice(1));u.delete(X2.addLibrary),window.history.replaceState({},IE,`#${u.toString()}`)}else if(window.location.search.includes(K2.addLibrary)){let u=new URLSearchParams(window.location.search);u.delete(K2.addLibrary),window.history.replaceState({},IE,`?${u.toString()}`)}}},a=s=>{s.preventDefault();let l=CS();l&&(s.stopImmediatePropagation(),window.history.replaceState({},"",s.oldURL),i(l))},o=CS();if(o&&i(o),"getInitialLibraryItems"in n.current&&n.current.getInitialLibraryItems&&(console.warn("useHandleLibrar `opts.getInitialLibraryItems` is deprecated. Use `opts.adapter` instead."),Promise.resolve(n.current.getInitialLibraryItems()).then(s=>{t.updateLibrary({libraryItems:s,merge:!0})}).catch(s=>{console.error(`UseHandeLibrary getInitialLibraryItems failed: ${s?.message}`)})),"adapter"in n.current&&n.current.adapter){let s=n.current.adapter,l=n.current.migrationAdapter,c=tT();l?c.resolve(RE(l.load).then(async d=>{let u=null;try{if(!d)return Lp.getLibraryItems(s,"load");u=Ef(d.libraryItems||[],"published");let h=await TS(s,SS([],u));try{await l.clear()}catch(m){console.error(`couldn't delete legacy library data: ${m.message}`)}return h}catch(h){return console.error(`couldn't migrate legacy library data: ${h.message}`),u}}).catch(d=>(console.error(`error during library migration: ${d.message}`),Lp.getLibraryItems(s,"load")))):c.resolve(RE(Lp.getLibraryItems,s,"load")),t.updateLibrary({libraryItems:c.then(d=>{let u=d||[];return Pu=x2(u),u}),merge:!0}).finally(()=>{r.current=!0})}return window.addEventListener("hashchange",a),()=>{window.removeEventListener("hashchange",a)}},[t]),(0,Oh.useEffect)(()=>{let i=wS.on(async(o,s)=>{let l=r.current,c="adapter"in n.current&&n.current.adapter||null;try{c&&Pu!==x2(s)&&await TS(c,o)}catch(d){console.error(`couldn't persist library update: ${d.message}`,o),l&&n.current.excalidrawAPI&&n.current.excalidrawAPI.updateScene({appState:{errorMessage:x("errors.saveLibraryError")}})}}),a=o=>{Rp&&xB(o)};return window.addEventListener("beforeunload",a),()=>{window.removeEventListener("beforeunload",a),i(),Pu=0,Rp=0}},[])}}),yre=M(()=>{}),ZN,KN,gi,Vh=M(()=>{"use strict";D(),yre(),ZN=(0,j4.forwardRef)(({children:e,gap:t,align:n,justifyContent:r,className:i,style:a},o)=>(0,W4.jsx)("div",{className:X("Stack Stack_horizontal",i),style:{"--gap":t,alignItems:n,justifyContent:r,...a},ref:o,children:e})),KN=(0,j4.forwardRef)(({children:e,gap:t,align:n,justifyContent:r,className:i,style:a},o)=>(0,W4.jsx)("div",{className:X("Stack Stack_vertical",i),style:{"--gap":t,justifyItems:n,justifyContent:r,...a},ref:o,children:e})),gi={Row:ZN,Col:KN}}),XN,VG,vre=M(()=>{"use strict";D(),ae(),de(),XN=({theme:e,id:t,libraryReturnUrl:n})=>{let r=n||window.location.origin+window.location.pathname;return(0,WG.jsx)("a",{className:"library-menu-browse-button",href:`${Ne.VITE_APP_LIBRARY_URL}?target=${window.name||"_blank"}&referrer=${r}&useHash=true&token=${t}&theme=${e}&version=${Af.excalidrawLibrary}`,target:"_excalidraw_libraries",children:x("labels.libraries")})},VG=XN}),mA,YG=M(()=>{"use strict";D(),vre(),mA=({libraryReturnUrl:e,theme:t,id:n,style:r,children:i,className:a})=>(0,Hy.jsxs)("div",{className:X("library-menu-control-buttons",a),style:r,children:[(0,Hy.jsx)(VG,{id:n,libraryReturnUrl:e,theme:t}),i]})}),qN,QN,JN,e$,t$,n$,Aa,R1=M(()=>{"use strict";D(),de(),qN=/({{[\w-]+}})|(<[\w-]+>)|(<\/[\w-]+>)/g,QN=/{{([\w-]+)}}/,JN=/<([\w-]+)>/,e$=/<\/([\w-]+)>/,t$=(e,t)=>{let n=[{name:"",children:[]}];return e.split(qN).filter(Boolean).forEach(r=>{let i=r.match(JN),a=r.match(e$),o=r.match(QN);if(i!==null){let s=i[1];t.hasOwnProperty(s)?n.push({name:s,children:[]}):console.warn(`Trans: missed to pass in prop ${s} for interpolating ${e}`)}else if(a!==null)if(a[1]===n[n.length-1].name){let s=n.pop(),l=Jp.default.createElement(Jp.default.Fragment,{},...s.children),c=t[s.name];typeof c=="function"&&n[n.length-1].children.push(c(l))}else console.warn(`Trans: unexpected end tag ${r} for interpolating ${e}`);else if(o!==null){let s=o[1];t.hasOwnProperty(s)?n[n.length-1].children.push(t[s]):console.warn(`Trans: key ${s} not in props for interpolating ${e}`)}else n[n.length-1].children.push(r)}),n.length!==1&&console.warn(`Trans: stack not empty for interpolating ${e}`),n[0].children},n$=({i18nKey:e,children:t,...n})=>{let{t:r}=hr();return Jp.default.createElement(Jp.default.Fragment,{},...t$(r(e),n))},Aa=n$}),xre=M(()=>{}),wre=M(()=>{}),r$,o1,ZG=M(()=>{"use strict";D(),wre(),jl(),r$=({label:e,onClick:t,className:n,children:r,actionType:i,type:a="button",isLoading:o,...s})=>{let l=i?`Dialog__action-button--${i}`:"";return(0,qc.jsxs)("button",{className:X("Dialog__action-button",l,n),type:a,"aria-label":e,onClick:t,...s,children:[r&&(0,qc.jsx)("div",{style:o?{visibility:"hidden"}:{},children:r}),(0,qc.jsx)("div",{style:o?{visibility:"hidden"}:{},children:e}),o&&(0,qc.jsx)("div",{style:{position:"absolute",inset:0},children:(0,qc.jsx)(Co,{})})]})},o1=r$}),i$,pA,KG=M(()=>{"use strict";D(),de(),Ki(),xre(),ZG(),Xy(),$e(),Hn(),i$=e=>{let{onConfirm:t,onCancel:n,children:r,confirmText:i=x("buttons.confirm"),cancelText:a=x("buttons.cancel"),className:o="",...s}=e,l=zn(),c=qo(Ky,Xn),{container:d}=Po();return(0,Nh.jsxs)(wi,{onCloseRequest:n,size:"small",...s,className:`confirm-dialog ${o}`,children:[r,(0,Nh.jsxs)("div",{className:"confirm-dialog-buttons",children:[(0,Nh.jsx)(o1,{label:a,onClick:()=>{l({openMenu:null}),c(!1),n(),d?.focus()}}),(0,Nh.jsx)(o1,{label:i,onClick:()=>{l({openMenu:null}),c(!1),t(),d?.focus()},actionType:"danger"})]})]})},pA=i$}),ks,Uy=M(()=>{"use strict";D(),ks=class{static has(e){try{return!!window.localStorage.getItem(e)}catch(t){return console.warn(`localStorage.getItem error: ${t.message}`),!1}}static get(e){try{let t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch(t){return console.warn(`localStorage.getItem error: ${t.message}`),null}}static set=(e,t)=>{try{return window.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){return console.warn(`localStorage.setItem error: ${n.message}`),!1}};static delete=e=>{try{window.localStorage.removeItem(e)}catch(t){console.warn(`localStorage.removeItem error: ${t.message}`)}}}}),Sre=M(()=>{}),a$,o$,s$,XG,Cre=M(()=>{"use strict";D(),Ki(),de(),R1(),Wh(),ae(),yi(),te(),ZG(),pe(),Gn(),Uy(),Sre(),a$=async e=>{let t=Math.round(8),n=Math.max(Math.round(128/64),2),r=bB(e,6),i=document.createElement("canvas");i.width=r[0].length*128+(r[0].length+1)*(t*2)-t*2,i.height=r.length*128+(r.length+1)*(t*2)-t*2;let a=i.getContext("2d");a.fillStyle=Ui,a.fillRect(0,0,i.width,i.height);for(let[o,s]of e.entries()){let l=await VT({data:{elements:s.elements,files:null},config:{maxWidthOrHeight:128}}),{width:c,height:d}=l,u=Math.floor(o/6)*(128+t*2),h=o%6*(128+t*2);a.drawImage(l,h+(128-c)/2+t,u+(128-d)/2+t),a.lineWidth=n,a.strokeStyle=At.gray[4],a.strokeRect(h+t/2,u+t/2,128+t,128+t)}return await VE(new File([await Ih(i)],"preview",{type:we.png}),{outputType:we.jpg,maxWidthOrHeight:5e3})},o$=({libItem:e,appState:t,index:n,onChange:r,onRemove:i})=>{let a=(0,Ei.useRef)(null),o=(0,Ei.useRef)(null);return(0,Ei.useEffect)(()=>{let s=a.current;s&&(async()=>{let l=await QE({data:{elements:e.elements,appState:{...t,viewBackgroundColor:Ui,exportBackground:!0},files:null}});s.innerHTML=l.outerHTML})()},[e.elements,t]),(0,ge.jsxs)("div",{className:"single-library-item",children:[e.status==="published"&&(0,ge.jsx)("span",{className:"single-library-item-status",children:x("labels.statusPublished")}),(0,ge.jsx)("div",{ref:a,className:"single-library-item__svg"}),(0,ge.jsx)(Xe,{"aria-label":x("buttons.remove"),type:"button",icon:Yl,className:"single-library-item--remove",onClick:i.bind(null,e.id),title:x("buttons.remove")}),(0,ge.jsxs)("div",{style:{display:"flex",margin:"0.8rem 0",width:"100%",fontSize:"14px",fontWeight:500,flexDirection:"column"},children:[(0,ge.jsxs)("label",{style:{display:"flex",justifyContent:"space-between",flexDirection:"column"},children:[(0,ge.jsxs)("div",{style:{padding:"0.5em 0"},children:[(0,ge.jsx)("span",{style:{fontWeight:500,color:At.gray[6]},children:x("publishDialog.itemName")}),(0,ge.jsx)("span",{"aria-hidden":"true",className:"required",children:"*"})]}),(0,ge.jsx)("input",{type:"text",ref:o,style:{width:"80%",padding:"0.2rem"},defaultValue:e.name,placeholder:"Item name",onChange:s=>{r(s.target.value,n)}})]}),(0,ge.jsx)("span",{className:"error",children:e.error})]})]})},s$=({onClose:e,libraryItems:t,appState:n,onSuccess:r,onError:i,updateItemsInStorage:a,onRemove:o})=>{let[s,l]=(0,Ei.useState)({authorName:"",githubHandle:"",name:"",description:"",twitterHandle:"",website:""}),[c,d]=(0,Ei.useState)(!1);(0,Ei.useEffect)(()=>{let y=ks.get(Cs.PUBLISH_LIBRARY);y&&l(y)},[]);let[u,h]=(0,Ei.useState)(t.slice());(0,Ei.useEffect)(()=>{h(t.slice())},[t]);let m=y=>{l({...s,[y.target.name]:y.target.value})},p=async y=>{y.preventDefault(),d(!0);let w=[],C=!1;if(u.forEach(O=>{let P="";O.name||(P=x("publishDialog.errors.required"),C=!0),w.push({...O,error:P})}),C){h(w),d(!1);return}let A=await a$(u),T={type:hi.excalidrawLibrary,version:Af.excalidrawLibrary,source:PE,libraryItems:u},I=JSON.stringify(T,null,2),k=new Blob([I],{type:"application/json"}),R=new FormData;R.append("excalidrawLib",k),R.append("previewImage",A),R.append("previewImageType",A.type),R.append("title",s.name),R.append("authorName",s.authorName),R.append("githubHandle",s.githubHandle),R.append("name",s.name),R.append("description",s.description),R.append("twitterHandle",s.twitterHandle),R.append("website",s.website),fetch(`${Ne.VITE_APP_LIBRARY_BACKEND}/submit`,{method:"post",body:R}).then(O=>O.ok?O.json().then(({url:P})=>{ks.delete(Cs.PUBLISH_LIBRARY),r({url:P,authorName:s.authorName,items:u})}):O.json().catch(()=>{throw new Error(O.statusText||"something went wrong")}).then(P=>{throw new Error(P.message||O.statusText||"something went wrong")}),O=>{console.error(O),i(O),d(!1)}).catch(O=>{console.error(O),i(O),d(!1)})},f=()=>{let y=[];return u.forEach((w,C)=>{y.push((0,ge.jsx)("div",{className:"single-library-item-wrapper",children:(0,ge.jsx)(o$,{libItem:w,appState:n,index:C,onChange:(A,T)=>{let I=u.slice();I[T].name=A,h(I)},onRemove:o})},C))}),(0,ge.jsx)("div",{className:"selected-library-items",children:y})},g=(0,Ei.useCallback)(()=>{a(u),ks.set(Cs.PUBLISH_LIBRARY,s),e()},[u,e,a,s]),b=!!t.length,v=t.some(y=>y.status==="published");return(0,ge.jsx)(wi,{onCloseRequest:g,title:x("publishDialog.title"),className:"publish-library",children:b?(0,ge.jsxs)("form",{onSubmit:p,children:[(0,ge.jsx)("div",{className:"publish-library-note",children:(0,ge.jsx)(Aa,{i18nKey:"publishDialog.noteDescription",link:y=>(0,ge.jsx)("a",{href:"https://libraries.excalidraw.com",target:"_blank",rel:"noopener noreferrer",children:y})})}),(0,ge.jsx)("span",{className:"publish-library-note",children:(0,ge.jsx)(Aa,{i18nKey:"publishDialog.noteGuidelines",link:y=>(0,ge.jsx)("a",{href:"https://github.com/excalidraw/excalidraw-libraries#guidelines",target:"_blank",rel:"noopener noreferrer",children:y})})}),(0,ge.jsx)("div",{className:"publish-library-note",children:x("publishDialog.noteItems")}),v&&(0,ge.jsx)("span",{className:"publish-library-note publish-library-warning",children:x("publishDialog.republishWarning")}),f(),(0,ge.jsxs)("div",{className:"publish-library__fields",children:[(0,ge.jsxs)("label",{children:[(0,ge.jsxs)("div",{children:[(0,ge.jsx)("span",{children:x("publishDialog.libraryName")}),(0,ge.jsx)("span",{"aria-hidden":"true",className:"required",children:"*"})]}),(0,ge.jsx)("input",{type:"text",name:"name",required:!0,value:s.name,onChange:m,placeholder:x("publishDialog.placeholder.libraryName")})]}),(0,ge.jsxs)("label",{style:{alignItems:"flex-start"},children:[(0,ge.jsxs)("div",{children:[(0,ge.jsx)("span",{children:x("publishDialog.libraryDesc")}),(0,ge.jsx)("span",{"aria-hidden":"true",className:"required",children:"*"})]}),(0,ge.jsx)("textarea",{name:"description",rows:4,required:!0,value:s.description,onChange:m,placeholder:x("publishDialog.placeholder.libraryDesc")})]}),(0,ge.jsxs)("label",{children:[(0,ge.jsxs)("div",{children:[(0,ge.jsx)("span",{children:x("publishDialog.authorName")}),(0,ge.jsx)("span",{"aria-hidden":"true",className:"required",children:"*"})]}),(0,ge.jsx)("input",{type:"text",name:"authorName",required:!0,value:s.authorName,onChange:m,placeholder:x("publishDialog.placeholder.authorName")})]}),(0,ge.jsxs)("label",{children:[(0,ge.jsx)("span",{children:x("publishDialog.githubUsername")}),(0,ge.jsx)("input",{type:"text",name:"githubHandle",value:s.githubHandle,onChange:m,placeholder:x("publishDialog.placeholder.githubHandle")})]}),(0,ge.jsxs)("label",{children:[(0,ge.jsx)("span",{children:x("publishDialog.twitterUsername")}),(0,ge.jsx)("input",{type:"text",name:"twitterHandle",value:s.twitterHandle,onChange:m,placeholder:x("publishDialog.placeholder.twitterHandle")})]}),(0,ge.jsxs)("label",{children:[(0,ge.jsx)("span",{children:x("publishDialog.website")}),(0,ge.jsx)("input",{type:"text",name:"website",pattern:"https?://.+",title:x("publishDialog.errors.website"),value:s.website,onChange:m,placeholder:x("publishDialog.placeholder.website")})]}),(0,ge.jsx)("span",{className:"publish-library-note",children:(0,ge.jsx)(Aa,{i18nKey:"publishDialog.noteLicense",link:y=>(0,ge.jsx)("a",{href:"https://github.com/excalidraw/excalidraw-libraries/blob/main/LICENSE",target:"_blank",rel:"noopener noreferrer",children:y})})})]}),(0,ge.jsxs)("div",{className:"publish-library__buttons",children:[(0,ge.jsx)(o1,{label:x("buttons.cancel"),onClick:g,"data-testid":"cancel-clear-canvas-button"}),(0,ge.jsx)(o1,{type:"submit",label:x("buttons.submit"),actionType:"primary",isLoading:c})]})]}):(0,ge.jsx)("p",{style:{padding:"1em",textAlign:"center",fontWeight:500},children:x("publishDialog.atleastOneLibItem")})})},XG=s$}),IS,QG,Tre=M(()=>{"use strict";D(),$e(),IS=({className:e="",children:t,onToggle:n,title:r,...i})=>{let a=qn(),o=X(`dropdown-menu-button ${e}`,"zen-mode-transition",{"dropdown-menu-button--mobile":a.editor.isMobile}).trim();return(0,qG.jsx)("button",{"data-prevent-outside-click":!0,className:o,onClick:n,type:"button","data-testid":"dropdown-menu-button",title:r,...i,children:t})},QG=IS,IS.displayName="DropdownMenuTrigger"}),V4,fA,gA,EA=M(()=>{"use strict";D(),ae(),te(),V4=Gy.default.createContext({}),fA=(e="",t=!1)=>`dropdown-menu-item dropdown-menu-item-base ${e} ${t?"dropdown-menu-item--selected":""}`.trim(),gA=(e,t)=>{let n=(0,Gy.useContext)(V4);return x1(e,r=>{let i=new CustomEvent("menu.itemSelect",{bubbles:!0,cancelable:!0});t?.(i),i.defaultPrevented||n.onSelect?.(i)})}}),l$,bA,JG=M(()=>{"use strict";D(),$e(),l$=({icon:e,shortcut:t,children:n})=>{let r=qn();return(0,Nl.jsxs)(Nl.Fragment,{children:[(0,Nl.jsx)("div",{className:"dropdown-menu-item__icon",children:e}),(0,Nl.jsx)("div",{className:"dropdown-menu-item__text",children:n}),t&&!r.editor.isMobile&&(0,Nl.jsx)("div",{className:"dropdown-menu-item__shortcut",children:t})]})},bA=l$}),w2,MS,ga,ej=M(()=>{"use strict";D(),EA(),JG(),w2=({icon:e,onSelect:t,children:n,shortcut:r,className:i,selected:a,...o})=>{let s=gA(o.onClick,t);return(0,hE.jsx)("button",{...o,onClick:s,type:"button",className:fA(i,a),title:o.title??o["aria-label"],children:(0,hE.jsx)(bA,{icon:e,shortcut:r,children:n})})},w2.displayName="DropdownMenuItem",MS=({children:e})=>(0,hE.jsx)("div",{style:{display:"inline-flex",marginLeft:"auto",padding:"2px 4px",background:"pink",borderRadius:6,fontSize:9,color:"black",fontFamily:"Cascadia, monospace"},children:e}),MS.displayName="DropdownMenuItemBadge",w2.Badge=MS,ga=w2}),AS,nj,Ire=M(()=>{"use strict";D(),AS=()=>(0,tj.jsx)("div",{style:{height:"1px",backgroundColor:"var(--default-border-color)",margin:".5rem 0"}}),nj=AS,AS.displayName="DropdownMenuSeparator"}),kS,rj,Mre=M(()=>{"use strict";D(),kS=({children:e,className:t="",style:n,title:r})=>(0,jy.jsxs)("div",{className:`dropdown-menu-group ${t}`,style:n,children:[r&&(0,jy.jsx)("p",{className:"dropdown-menu-group-title",children:r}),e]}),rj=kS,kS.displayName="DropdownMenuGroup"}),PS,ij,Are=M(()=>{"use strict";D(),Cd(),$e(),Vh(),EA(),WM(),ke(),ae(),VM(),PS=({children:e,onClickOutside:t,className:n="",onSelect:r,style:i})=>{let a=qn(),o=(0,Wy.useRef)(null),s=Py({onClickOutside:t});jM(o,()=>{s.onClickOutside?.()}),(0,Wy.useEffect)(()=>{let c=u=>{u.key===N.ESCAPE&&(u.stopImmediatePropagation(),s.onClickOutside?.())},d={capture:!0};return document.addEventListener("keydown",c,d),()=>{document.removeEventListener("keydown",c,d)}},[s]);let l=X(`dropdown-menu ${n}`,{"dropdown-menu--mobile":a.editor.isMobile}).trim();return(0,ef.jsx)(V4.Provider,{value:{onSelect:r},children:(0,ef.jsx)("div",{ref:o,className:l,style:i,"data-testid":"dropdown-menu",children:a.editor.isMobile?(0,ef.jsx)(gi.Col,{className:"dropdown-menu-container",children:e}):(0,ef.jsx)(Ra,{className:"dropdown-menu-container",padding:2,style:{zIndex:2},children:e})})})},PS.displayName="DropdownMenuContent",ij=PS}),DS,Cf,aj=M(()=>{"use strict";D(),JG(),EA(),DS=({icon:e,shortcut:t,href:n,children:r,onSelect:i,className:a="",selected:o,...s})=>{let l=gA(s.onClick,i);return(0,Y4.jsx)("a",{...s,href:n,target:"_blank",rel:"noreferrer",className:fA(a,o),title:s.title??s["aria-label"],onClick:l,children:(0,Y4.jsx)(bA,{icon:e,shortcut:t,children:r})})},Cf=DS,DS.displayName="DropdownMenuItemLink"}),c$,sj,kre=M(()=>{"use strict";D(),c$=({children:e,className:t="",selected:n,...r})=>(0,oj.jsx)("div",{...r,className:`dropdown-menu-item-base dropdown-menu-item-custom ${t} ${n?"dropdown-menu-item--selected":""}`.trim(),children:e}),sj=c$}),lj,cj,Pre=M(()=>{"use strict";D(),lj=e=>tf.default.Children.toArray(e).find(n=>tf.default.isValidElement(n)&&typeof n.type!="string"&&n?.type.displayName&&n.type.displayName==="DropdownMenuTrigger")||null,cj=e=>tf.default.Children.toArray(e).find(n=>tf.default.isValidElement(n)&&typeof n.type!="string"&&n?.type.displayName&&n.type.displayName==="DropdownMenuContent")||null}),Dre=M(()=>{}),mo,Ct,Yy=M(()=>{"use strict";D(),Tre(),ej(),Ire(),Mre(),Are(),aj(),kre(),Pre(),Dre(),mo=({children:e,open:t})=>{let n=lj(e),r=cj(e);return(0,Vy.jsxs)(Vy.Fragment,{children:[n,t&&r]})},mo.Trigger=QG,mo.Content=ij,mo.Item=ga,mo.ItemLink=Cf,mo.ItemCustom=sj,mo.Group=rj,mo.Separator=nj,Ct=mo,mo.displayName="DropdownMenu"}),d$,u$,Z4,_re=M(()=>{"use strict";D(),de(),R1(),Hn(),$e(),Bl(),mh(),pe(),Gn(),Wl(),te(),KG(),Cre(),Ki(),Yy(),Xy(),ir(),zy(),d$=(e,t)=>e.filter(n=>t.includes(n.id)),u$=({setAppState:e,selectedItems:t,library:n,onRemoveFromLibrary:r,resetLibrary:i,onSelectItems:a,appState:o,className:s})=>{let[l]=Ze(hh,Xn),[c,d]=Ze(Ky,Xn),u=()=>{let R=t.length?x("alerts.removeItemsFromsLibrary",{count:t.length}):x("alerts.resetLibrary"),O=t.length?x("confirmDialog.removeItemsFromLib"):x("confirmDialog.resetLibrary");return(0,Tn.jsx)(pA,{onConfirm:()=>{t.length?r():i(),m(!1)},onCancel:()=>{m(!1)},title:O,children:(0,Tn.jsx)("p",{children:R})})},[h,m]=(0,ph.useState)(!1),p=!!t.length,f=p?l.libraryItems.filter(R=>t.includes(R.id)):l.libraryItems,g=x(p?"buttons.remove":"buttons.resetLibrary"),[b,v]=(0,ph.useState)(!1),[y,w]=(0,ph.useState)(null),C=(0,ph.useCallback)(()=>(0,Tn.jsxs)(wi,{onCloseRequest:()=>w(null),title:x("publishSuccessDialog.title"),className:"publish-library-success",size:"small",children:[(0,Tn.jsx)("p",{children:(0,Tn.jsx)(Aa,{i18nKey:"publishSuccessDialog.content",authorName:y.authorName,link:R=>(0,Tn.jsx)("a",{href:y?.url,target:"_blank",rel:"noopener noreferrer",children:R})})}),(0,Tn.jsx)(Xe,{type:"button",title:x("buttons.close"),"aria-label":x("buttons.close"),label:x("buttons.close"),onClick:()=>w(null),"data-testid":"publish-library-success-close",className:"publish-library-success-close"})]}),[w,y]),A=(R,O)=>{v(!1),w({url:R.url,authorName:R.authorName});let P=O.slice();P.forEach(F=>{t.includes(F.id)&&(F.status="published")}),n.setLibrary(P)},T=async()=>{try{await n.updateLibrary({libraryItems:ry({description:"Excalidraw library files"}),merge:!0,openLibraryMenu:!0})}catch(R){if(R?.name==="AbortError"){console.warn(R);return}e({errorMessage:x("errors.importLibraryError")})}},I=async()=>{let R=p?f:await n.getLatestLibrary();Vz(R).catch(eT).catch(O=>{e({errorMessage:O.message})})},k=()=>(0,Tn.jsxs)(Ct,{open:c,children:[(0,Tn.jsx)(Ct.Trigger,{onToggle:()=>d(!c),children:rI}),(0,Tn.jsxs)(Ct.Content,{onClickOutside:()=>d(!1),onSelect:()=>d(!1),className:"library-menu",children:[!p&&(0,Tn.jsx)(Ct.Item,{onSelect:T,icon:A1,"data-testid":"lib-dropdown--load",children:x("buttons.load")}),!!f.length&&(0,Tn.jsx)(Ct.Item,{onSelect:I,icon:_h,"data-testid":"lib-dropdown--export",children:x("buttons.export")}),!!f.length&&(0,Tn.jsx)(Ct.Item,{onSelect:()=>m(!0),icon:zl,children:g}),p&&(0,Tn.jsx)(Ct.Item,{icon:hM,onSelect:()=>v(!0),"data-testid":"lib-dropdown--remove",children:x("buttons.publishLibrary")})]})]});return(0,Tn.jsxs)("div",{className:X("library-menu-dropdown-container",s),children:[k(),t.length>0&&(0,Tn.jsx)("div",{className:"library-actions-counter",children:t.length}),h&&u(),b&&(0,Tn.jsx)(XG,{onClose:()=>v(!1),libraryItems:d$(l.libraryItems,t),appState:o,onSuccess:R=>A(R,l.libraryItems),onError:R=>window.alert(R),updateItemsInStorage:()=>n.setLibrary(l.libraryItems),onRemove:R=>a(t.filter(O=>O!==R))}),y&&C()]})},Z4=({selectedItems:e,onSelectItems:t,className:n})=>{let{library:r}=ql(),{clearLibraryCache:i,deleteItemsFromLibraryCache:a}=uA(),o=Un(),s=zn(),[l]=Ze(hh,Xn),c=async d=>{let u=d.filter(h=>!e.includes(h.id));r.setLibrary(u).catch(()=>{s({errorMessage:x("alerts.errorRemovingFromLibrary")})}),a(e),t([])};return(0,Tn.jsx)(u$,{appState:o,setAppState:s,selectedItems:e,onSelectItems:t,library:r,onRemoveFromLibrary:()=>c(l.libraryItems),resetLibrary:()=>{r.resetLibrary(),i()},className:n})}}),Lre=M(()=>{}),dj,uj,Rre=M(()=>{"use strict";D(),$e(),Lre(),KM(),pe(),zy(),dj=(0,Kl.memo)(({id:e,elements:t,isPending:n,onClick:r,selected:i,onToggle:a,onDrag:o,svgCache:s})=>{let l=(0,Kl.useRef)(null),c=GG(e,t,s);(0,Kl.useEffect)(()=>{let p=l.current;if(p)return c&&(p.innerHTML=c.outerHTML),()=>{p.innerHTML=""}},[c]);let[d,u]=(0,Kl.useState)(!1),h=qn().editor.isMobile,m=n&&(0,Qc.jsx)("div",{className:"library-unit__adder",children:nI});return(0,Qc.jsxs)("div",{className:X("library-unit",{"library-unit__active":t,"library-unit--hover":t&&d,"library-unit--selected":i,"library-unit--skeleton":!c}),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[(0,Qc.jsx)("div",{className:X("library-unit__dragger",{"library-unit__pulse":!!n}),ref:l,draggable:!!t,onClick:t||n?p=>{e&&p.shiftKey?a(e,p):r(e)}:void 0,onDragStart:p=>{if(!e){p.preventDefault();return}u(!1),o(e,p)}}),m,e&&t&&(d||h||i)&&(0,Qc.jsx)(t1,{checked:i,onChange:(p,f)=>a(e,f),className:"library-unit__checkbox"})]})}),uj=()=>(0,Qc.jsx)("div",{className:"library-unit library-unit--skeleton"})});function Ore(){return[!1,(0,Zy.useCallback)(e=>e(),[])]}var hj,Nre=M(()=>{"use strict";D(),hj=Zy.default.useTransition||Ore}),K4,mE,$re=M(()=>{"use strict";D(),Rre(),Nre(),K4=({children:e})=>(0,Jc.jsx)("div",{className:"library-menu-items-container__grid",children:e}),mE=(0,Yh.memo)(({items:e,onItemSelectToggle:t,onItemDrag:n,isItemSelected:r,onClick:i,svgCache:a,itemsRenderedPerBatch:o})=>{let[,s]=hj(),[l,c]=(0,Yh.useState)(0);return(0,Yh.useEffect)(()=>{l<e.length&&s(()=>{c(l+o)})},[l,e.length,s,o]),(0,Jc.jsx)(Jc.Fragment,{children:e.map((d,u)=>u<l?(0,Jc.jsx)(dj,{elements:d?.elements,isPending:!d?.id&&!!d?.elements,onClick:i,svgCache:a,id:d?.id,selected:r(d.id),onToggle:t,onDrag:n},d?.id??u):(0,Jc.jsx)(uj,{},u))})})}),h$,fj,Fre=M(()=>{"use strict";D(),h$=_t(0),fj=e=>{let[t,n]=Ze(h$);return(0,mj.useEffect)(()=>{let{current:r}=e;if(!r)return;let i=(0,pj.default)(()=>{let{scrollTop:a}=r;n(a)},200);return r.addEventListener("scroll",i),()=>{i.cancel(),r.removeEventListener("scroll",i)}},[e,n]),t}}),Bre=M(()=>{});function zre({isLoading:e,libraryItems:t,onAddToLibrary:n,onInsertLibraryItems:r,pendingElements:i,theme:a,id:o,libraryReturnUrl:s,onSelectItems:l,selectedItems:c}){let d=(0,gr.useRef)(null),u=fj(d);(0,gr.useEffect)(()=>{u>0&&d.current?.scrollTo(0,u)},[]);let{svgCache:h}=uA(),m=(0,gr.useMemo)(()=>t.filter(R=>R.status!=="published"),[t]),p=(0,gr.useMemo)(()=>t.filter(R=>R.status==="published"),[t]),f=!t.length&&!i.length,g=!i.length&&!m.length&&!p.length,[b,v]=(0,gr.useState)(null),y=(0,gr.useCallback)((R,O)=>{let P=!c.includes(R),F=[...m,...p];if(P){if(O.shiftKey&&b){let Y=F.findIndex(H=>H.id===b),j=F.findIndex(H=>H.id===R);if(Y===-1||j===-1){l([...c,R]);return}let q=ve(c),ne=F.reduce((H,V,$)=>(($>=Y&&$<=j||q.has(V.id))&&H.push(V.id),H),[]);l(ne)}else l([...c,R]);v(R)}else v(null),l(c.filter(Y=>Y!==R))},[b,l,p,c,m]),w=(0,gr.useCallback)(R=>{let O;return c.includes(R)?O=t.filter(P=>c.includes(P.id)):O=t.filter(P=>P.id===R),O.map(P=>({...P,elements:MT(P.elements,{randomizeSeed:!0})}))},[t,c]),C=(0,gr.useCallback)((R,O)=>{O.dataTransfer.setData(we.excalidrawlib,u4(w(R)))},[w]),A=(0,gr.useCallback)(R=>R?c.includes(R):!1,[c]),T=(0,gr.useCallback)(()=>{n(i)},[i,n]),I=(0,gr.useCallback)(R=>{R&&r(w(R))},[w,r]),k=h.size>=t.length?Ej:gj;return(0,Wt.jsxs)("div",{className:"library-menu-items-container",style:i.length||m.length||p.length?{justifyContent:"flex-start"}:{borderBottom:0},children:[!g&&(0,Wt.jsx)(Z4,{selectedItems:c,onSelectItems:l,className:"library-menu-dropdown-container--in-heading"}),(0,Wt.jsxs)(gi.Col,{className:"library-menu-items-container__items",align:"start",gap:1,style:{flex:p.length>0?1:"0 1 auto",marginBottom:0},ref:d,children:[(0,Wt.jsxs)(Wt.Fragment,{children:[!g&&(0,Wt.jsx)("div",{className:"library-menu-items-container__header",children:x("labels.personalLib")}),e&&(0,Wt.jsx)("div",{style:{position:"absolute",top:"var(--container-padding-y)",right:"var(--container-padding-x)",transform:"translateY(50%)"},children:(0,Wt.jsx)(Co,{})}),!i.length&&!m.length?(0,Wt.jsxs)("div",{className:"library-menu-items__no-items",children:[(0,Wt.jsx)("div",{className:"library-menu-items__no-items__label",children:x("library.noItems")}),(0,Wt.jsx)("div",{className:"library-menu-items__no-items__hint",children:p.length>0?x("library.hint_emptyPrivateLibrary"):x("library.hint_emptyLibrary")})]}):(0,Wt.jsxs)(K4,{children:[i.length>0&&(0,Wt.jsx)(mE,{itemsRenderedPerBatch:k,items:[{id:null,elements:i}],onItemSelectToggle:y,onItemDrag:C,onClick:T,isItemSelected:A,svgCache:h}),(0,Wt.jsx)(mE,{itemsRenderedPerBatch:k,items:m,onItemSelectToggle:y,onItemDrag:C,onClick:I,isItemSelected:A,svgCache:h})]})]}),(0,Wt.jsxs)(Wt.Fragment,{children:[(p.length>0||i.length>0||m.length>0)&&(0,Wt.jsx)("div",{className:"library-menu-items-container__header library-menu-items-container__header--excal",children:x("labels.excalidrawLib")}),p.length>0?(0,Wt.jsx)(K4,{children:(0,Wt.jsx)(mE,{itemsRenderedPerBatch:k,items:p,onItemSelectToggle:y,onItemDrag:C,onClick:I,isItemSelected:A,svgCache:h})}):m.length>0?(0,Wt.jsx)("div",{style:{margin:"1rem 0",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",fontSize:".9rem"},children:x("library.noItems")}):null]}),f&&(0,Wt.jsx)(mA,{style:{padding:"16px 0",width:"100%"},id:o,libraryReturnUrl:s,theme:a,children:(0,Wt.jsx)(Z4,{selectedItems:c,onSelectItems:l})})]})]})}var gj,Ej,Hre=M(()=>{"use strict";D(),Bl(),de(),te(),Vh(),ae(),jl(),_s(),YG(),_re(),$re(),Fre(),zy(),Bre(),gj=17,Ej=64}),Ure=M(()=>{}),Ky,_S,m$,p$,bj,Xy=M(()=>{"use strict";D(),mh(),de(),Ao(),Hre(),xi(),Hn(),jl(),$e(),It(),ir(),Ure(),YG(),te(),ae(),Ky=_t(!1),_S=({children:e})=>(0,$i.jsx)("div",{className:"layer-ui__library",children:e}),m$=({onInsertLibraryItems:e,pendingElements:t,onAddToLibrary:n,setAppState:r,libraryReturnUrl:i,library:a,id:o,theme:s,selectedItems:l,onSelectItems:c})=>{let[d]=Ze(hh,Xn),u=(0,bi.useCallback)(p=>{(async(f,g)=>{dt("element","addToLibrary","ui");for(let v of XC)if(f.some(y=>y.type===v))return r({errorMessage:x(`errors.libraryElementTypeError.${v}`)});let b=[{status:"unpublished",elements:f,id:pi(),created:Date.now()},...g];n(),a.setLibrary(b).catch(()=>{r({errorMessage:x("alerts.errorAddingToLibrary")})})})(p,d.libraryItems)},[n,a,r,d.libraryItems]),h=(0,bi.useMemo)(()=>d.libraryItems,[d]);if(d.status==="loading"&&!d.isInitialized)return(0,$i.jsx)(_S,{children:(0,$i.jsx)("div",{className:"layer-ui__library-message",children:(0,$i.jsxs)("div",{children:[(0,$i.jsx)(Co,{size:"2em"}),(0,$i.jsx)("span",{children:x("labels.libraryLoadingMessage")})]})})});let m=d.libraryItems.length>0||t.length>0;return(0,$i.jsxs)(_S,{children:[(0,$i.jsx)(zre,{isLoading:d.status==="loading",libraryItems:h,onAddToLibrary:u,onInsertLibraryItems:e,pendingElements:t,id:o,libraryReturnUrl:i,theme:s,onSelectItems:c,selectedItems:l}),m&&(0,$i.jsx)(mA,{className:"library-menu-control-buttons--at-bottom",style:{padding:"16px 12px 0 12px"},id:o,libraryReturnUrl:i,theme:s})]})},p$=(e,t)=>{let n=()=>bt(t,e,{includeBoundTextElement:!0,includeElementsInFrames:!0}),r=(0,bi.useRef)(n()),i=(0,bi.useRef)(e),a=(0,bi.useRef)(t);return(!Bn(e.selectedElementIds,i.current.selectedElementIds)||!Bn(t,a.current))&&(r.current=n(),i.current=e,a.current=t),r.current},bj=()=>{let{library:e,id:t,onInsertElements:n}=ql(),r=N1(),i=Un(),a=zn(),o=$1(),[s,l]=(0,bi.useState)([]),c=(0,bi.useMemo)(()=>e,[e]),d=p$(i,o),u=(0,bi.useCallback)(m=>{n(hA(m))},[n]),h=(0,bi.useCallback)(()=>{a({selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null})},[a]);return(0,$i.jsx)(m$,{pendingElements:d,onInsertLibraryItems:u,onAddToLibrary:h,setAppState:a,libraryReturnUrl:r.libraryReturnUrl,library:c,id:t,theme:i.theme,selectedItems:s,onSelectItems:l})}});function Gre(e){if(e&&typeof e=="number")return e;switch(e){case"small":return 550;case"wide":return 1024;case"regular":default:return 800}}var wi,Ki=M(()=>{"use strict";D(),hre(),$e(),ke(),mre(),Cd(),gre(),te(),Xy(),Hn(),de(),pe(),wi=e=>{let[t,n]=$G(),[r]=(0,qy.useState)(document.activeElement),{id:i}=Po(),a=qn().viewport.isMobile;(0,qy.useEffect)(()=>{if(!t)return;let c=_E(t);setTimeout(()=>{c.length>0&&e.autofocus!==!1&&(c[1]||c[0]).focus()});let d=u=>{if(u.key===N.TAB){let h=_E(t),{activeElement:m}=document,p=h.findIndex(f=>f===m);p===0&&u.shiftKey?(h[h.length-1].focus(),u.preventDefault()):p===h.length-1&&!u.shiftKey&&(h[0].focus(),u.preventDefault())}};return t.addEventListener("keydown",d),()=>t.removeEventListener("keydown",d)},[t,e.autofocus]);let o=zn(),s=qo(Ky,Xn),l=()=>{o({openMenu:null}),s(!1),r.focus(),e.onCloseRequest()};return(0,wl.jsx)(UG,{className:X("Dialog",e.className,{"Dialog--fullscreen":a}),labelledBy:"dialog-title",maxWidth:Gre(e.size),onCloseRequest:l,closeOnClickOutside:e.closeOnClickOutside,children:(0,wl.jsxs)(Ra,{ref:n,children:[e.title&&(0,wl.jsx)("h2",{id:`${i}-dialog-title`,className:"Dialog__title",children:(0,wl.jsx)("span",{className:"Dialog__titleContent",children:e.title})}),a&&(0,wl.jsx)("button",{className:"Dialog__close",onClick:l,title:x("buttons.close"),"aria-label":x("buttons.close"),children:Yl}),(0,wl.jsx)("div",{className:"Dialog__content",children:e.children})]})})}}),jre=M(()=>{}),Wre=M(()=>{}),$h,O1=M(()=>{"use strict";D(),te(),Wre(),$h=({type:e="button",onSelect:t,selected:n,children:r,className:i="",...a})=>(0,yj.jsx)("button",{onClick:x1(a.onClick,o=>{t()}),type:e,className:X("excalidraw-button",i,{selected:n}),...a,children:r})}),yA,vj=M(()=>{"use strict";D(),jre(),O1(),pe(),yA=(0,ko.forwardRef)(({onChange:e,label:t,fullWidth:n,placeholder:r,readonly:i,selectOnRender:a,onKeyDown:o,isRedacted:s=!1,...l},c)=>{let d=(0,ko.useRef)(null);(0,ko.useImperativeHandle)(c,()=>d.current),(0,ko.useLayoutEffect)(()=>{a&&d.current?.select()},[a]);let[u,h]=(0,ko.useState)(!1);return(0,od.jsxs)("div",{className:X("ExcTextField",{"ExcTextField--fullWidth":n}),onClick:()=>{d.current?.focus()},children:[(0,od.jsx)("div",{className:"ExcTextField__label",children:t}),(0,od.jsxs)("div",{className:X("ExcTextField__input",{"ExcTextField__input--readonly":i}),children:[(0,od.jsx)("input",{className:X({"is-redacted":"value"in l&&l.value&&s&&!u}),readOnly:i,value:"value"in l?l.value:void 0,defaultValue:"defaultValue"in l?l.defaultValue:void 0,placeholder:r,ref:d,onChange:m=>e?.(m.target.value),onKeyDown:o}),s&&(0,od.jsx)($h,{onSelect:()=>h(!u),style:{border:0,userSelect:"none"},children:u?yM:P1})]})]})})}),f$,Dr,Zh=M(()=>{"use strict";D(),ae(),de(),te(),f$={toggleTheme:[K("Shift+Alt+D")],saveScene:[K("CtrlOrCmd+S")],loadScene:[K("CtrlOrCmd+O")],clearCanvas:[K("CtrlOrCmd+Delete")],imageExport:[K("CtrlOrCmd+Shift+E")],commandPalette:[K("CtrlOrCmd+/"),K("CtrlOrCmd+Shift+P")],cut:[K("CtrlOrCmd+X")],copy:[K("CtrlOrCmd+C")],paste:[K("CtrlOrCmd+V")],copyStyles:[K("CtrlOrCmd+Alt+C")],pasteStyles:[K("CtrlOrCmd+Alt+V")],selectAll:[K("CtrlOrCmd+A")],deleteSelectedElements:[K("Delete")],duplicateSelection:[K("CtrlOrCmd+D"),K(`Alt+${x("helpDialog.drag")}`)],sendBackward:[K("CtrlOrCmd+[")],bringForward:[K("CtrlOrCmd+]")],sendToBack:[K(Ia?"CtrlOrCmd+Alt+[":"CtrlOrCmd+Shift+[")],bringToFront:[K(Ia?"CtrlOrCmd+Alt+]":"CtrlOrCmd+Shift+]")],copyAsPng:[K("Shift+Alt+C")],copyAsSvg:[],group:[K("CtrlOrCmd+G")],ungroup:[K("CtrlOrCmd+Shift+G")],gridMode:[K("CtrlOrCmd+'")],zenMode:[K("Alt+Z")],objectsSnapMode:[K("Alt+S")],stats:[K("Alt+/")],addToLibrary:[],flipHorizontal:[K("Shift+H")],flipVertical:[K("Shift+V")],viewMode:[K("Alt+R")],hyperlink:[K("CtrlOrCmd+K")],toggleElementLock:[K("CtrlOrCmd+Shift+L")],resetZoom:[K("CtrlOrCmd+0")],zoomOut:[K("CtrlOrCmd+-")],zoomIn:[K("CtrlOrCmd++")],zoomToFitSelection:[K("Shift+3")],zoomToFit:[K("Shift+1")],zoomToFitSelectionInViewport:[K("Shift+2")],toggleEraserTool:[K("E")],toggleHandTool:[K("H")],setFrameAsActiveTool:[K("F")],saveFileToDisk:[K("CtrlOrCmd+S")],saveToActiveFile:[K("CtrlOrCmd+S")],toggleShortcuts:[K("?")]},Dr=(e,t=0)=>{let n=f$[e];return n&&n.length>0?n[t]||n[0]:""}}),g$,E$,b$,y$,v$,x$,w$,S$,X4,Vre=M(()=>{"use strict";D(),g$="\\u0300-\\u036f",E$="\\ufe20-\\ufe2f",b$="\\u20d0-\\u20ff",y$=g$+E$+b$,v$=`[${y$}]`,x$=RegExp(v$,"g"),w$=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,S$={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"E",\u00E6:"e",\u00DE:"T",\u00FE:"t",\u00DF:"s",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"I",\u0133:"i",\u0152:"E",\u0153:"e",\u0149:"n",\u017F:"s"},X4=e=>e.replace(w$,t=>S$[t]||t).replace(x$,"")}),fh,vA=M(()=>{"use strict";D(),fh=({icon:e})=>(0,xj.jsx)("span",{style:{width:"1em",margin:"0 0.5ex 0 0.5ex",display:"inline-block",lineHeight:0,verticalAlign:"middle"},children:e})}),zb,wj,xA=M(()=>{"use strict";D(),pe(),ke(),zb=[{icon:lI,value:"selection",key:N.V,numericKey:N[1],fillable:!0},{icon:cI,value:"rectangle",key:N.R,numericKey:N[2],fillable:!0},{icon:dI,value:"diamond",key:N.D,numericKey:N[3],fillable:!0},{icon:uI,value:"ellipse",key:N.O,numericKey:N[4],fillable:!0},{icon:hI,value:"arrow",key:N.A,numericKey:N[5],fillable:!0},{icon:mI,value:"line",key:N.L,numericKey:N[6],fillable:!0},{icon:I1,value:"freedraw",key:[N.P,N.X],numericKey:N[7],fillable:!1},{icon:fI,value:"text",key:N.T,numericKey:N[8],fillable:!1},{icon:gI,value:"image",key:null,numericKey:N[9],fillable:!1},{icon:EI,value:"eraser",key:N.E,numericKey:N[0],fillable:!1}],wj=e=>zb.find((t,n)=>t.numericKey!=null&&e===t.numericKey.toString()||t.key&&(typeof t.key=="string"?t.key===e:t.key.includes(e)))?.value||null}),Yre=M(()=>{}),q4,br,Sj,Xi=M(()=>{"use strict";D(),q4=pE.default.createContext(null),br=()=>pE.default.useContext(q4),Sj=()=>pE.default.useMemo(()=>({MainMenuTunnel:ma(),WelcomeScreenMenuHintTunnel:ma(),WelcomeScreenToolbarHintTunnel:ma(),WelcomeScreenHelpHintTunnel:ma(),WelcomeScreenCenterTunnel:ma(),FooterCenterTunnel:ma(),DefaultSidebarTriggerTunnel:ma(),DefaultSidebarTabTriggersTunnel:ma(),OverwriteConfirmDialogTunnel:ma(),TTDDialogTriggerTunnel:ma(),jotaiScope:Symbol()}),[])}),Q4,J4,wA,SA,Tj,Ij,Mj,Aj,Qy=M(()=>{"use strict";D(),de(),$e(),It(),xA(),te(),Vh(),Gn(),ey(),xi(),Se(),Ba(),Sd(),qt(),Yre(),Yy(),pe(),ke(),Xi(),Q4=(e,t)=>{let n=t[0]?.type||null;for(let r of t)if(r.type!==n){n=null;break}return $E(e.activeTool.type)&&e.activeTool.type!=="image"&&n!=="image"&&n!=="frame"&&n!=="magicframe"||t.some(r=>$E(r.type))},J4=(e,t)=>Vc(e.activeTool.type)||t.some(n=>Vc(n.type)),wA=({appState:e,elementsMap:t,renderAction:n})=>{let r=hy(t,e),i=!1;r.length===2&&(Io(r[0])||Io(r[1]))&&(i=!0);let a=!!e.editingElement,o=qn(),s=document.documentElement.getAttribute("dir")==="rtl",l=Vc(e.activeTool.type)&&!Sa(e.currentItemBackgroundColor)||r.some(d=>Vc(d.type)&&!Sa(d.backgroundColor)),c=r.length===1||i;return(0,be.jsxs)("div",{className:"panelColumn",children:[(0,be.jsx)("div",{children:Q4(e,r)&&n("changeStrokeColor")}),J4(e,r)&&(0,be.jsx)("div",{children:n("changeBackgroundColor")}),l&&n("changeFillStyle"),(P5(e.activeTool.type)||r.some(d=>P5(d.type)))&&n("changeStrokeWidth"),(e.activeTool.type==="freedraw"||r.some(d=>d.type==="freedraw"))&&n("changeStrokeShape"),(D5(e.activeTool.type)||r.some(d=>D5(d.type)))&&(0,be.jsxs)(be.Fragment,{children:[n("changeStrokeStyle"),n("changeSloppiness")]}),(FE(e.activeTool.type)||r.some(d=>FE(d.type)))&&(0,be.jsx)(be.Fragment,{children:n("changeRoundness")}),(e.activeTool.type==="text"||r.some(he))&&(0,be.jsxs)(be.Fragment,{children:[n("changeFontSize"),n("changeFontFamily"),(e.activeTool.type==="text"||uz(r,t))&&n("changeTextAlign")]}),dz(r,t)&&n("changeVerticalAlign"),(Df(e.activeTool.type)||r.some(d=>Df(d.type)))&&(0,be.jsx)(be.Fragment,{children:n("changeArrowhead")}),n("changeOpacity"),(0,be.jsxs)("fieldset",{children:[(0,be.jsx)("legend",{children:x("labels.layers")}),(0,be.jsxs)("div",{className:"buttonList",children:[n("sendToBack"),n("sendBackward"),n("bringToFront"),n("bringForward")]})]}),r.length>1&&!i&&(0,be.jsxs)("fieldset",{children:[(0,be.jsx)("legend",{children:x("labels.align")}),(0,be.jsxs)("div",{className:"buttonList",children:[s?(0,be.jsxs)(be.Fragment,{children:[n("alignRight"),n("alignHorizontallyCentered"),n("alignLeft")]}):(0,be.jsxs)(be.Fragment,{children:[n("alignLeft"),n("alignHorizontallyCentered"),n("alignRight")]}),r.length>2&&n("distributeHorizontally"),(0,be.jsx)("div",{style:{flexBasis:"100%",height:0}}),(0,be.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:".5rem",marginTop:"-0.5rem"},children:[n("alignTop"),n("alignVerticallyCentered"),n("alignBottom"),r.length>2&&n("distributeVertically")]})]})]}),!a&&r.length>0&&(0,be.jsxs)("fieldset",{children:[(0,be.jsx)("legend",{children:x("labels.actions")}),(0,be.jsxs)("div",{className:"buttonList",children:[!o.editor.isMobile&&n("duplicateSelection"),!o.editor.isMobile&&n("deleteSelectedElements"),n("group"),n("ungroup"),c&&n("hyperlink")]})]})]})},SA=({activeTool:e,appState:t,app:n,UIOptions:r})=>{let[i,a]=(0,Cj.useState)(!1),o=e.type==="frame",s=e.type==="laser",l=e.type==="embeddable",{TTDDialogTriggerTunnel:c}=br();return(0,be.jsxs)(be.Fragment,{children:[zb.map(({value:d,icon:u,key:h,numericKey:m,fillable:p},f)=>{if(r.tools?.[d]===!1)return null;let g=x(`toolBar.${d}`),b=h&&nd(typeof h=="string"?h:h[0]),v=b?`${b} ${x("helpDialog.or")} ${m}`:`${m}`;return(0,be.jsx)(Xe,{className:X("Shape",{fillable:p}),type:"radio",icon:u,checked:e.type===d,name:"editor-current-shape",title:`${nd(g)} \u2014 ${v}`,keyBindingLabel:m||b,"aria-label":nd(g),"aria-keyshortcuts":v,"data-testid":`toolbar-${d}`,onPointerDown:({pointerType:y})=>{!t.penDetected&&y==="pen"&&n.togglePenMode(!0)},onChange:({pointerType:y})=>{t.activeTool.type!==d&&dt("toolbar",d,"ui"),d==="image"?n.setActiveTool({type:d,insertOnCanvasDirectly:y!=="mouse"}):n.setActiveTool({type:d})}},d)}),(0,be.jsx)("div",{className:"App-toolbar__divider"}),(0,be.jsxs)(Ct,{open:i,children:[(0,be.jsxs)(Ct.Trigger,{className:X("App-toolbar__extra-tools-trigger",{"App-toolbar__extra-tools-trigger--selected":o||l||s&&!n.props.isCollaborating}),onToggle:()=>a(!i),title:x("toolBar.extraTools"),children:[EM,n.props.aiEnabled!==!1&&(0,be.jsx)("div",{style:{display:"inline-flex",marginLeft:"auto",padding:"2px 4px",borderRadius:6,fontSize:8,fontFamily:"Cascadia, monospace",position:"absolute",background:"pink",color:"black",bottom:3,right:4},children:"AI"})]}),(0,be.jsxs)(Ct.Content,{onClickOutside:()=>a(!1),onSelect:()=>a(!1),className:"App-toolbar__extra-tools-dropdown",children:[(0,be.jsx)(Ct.Item,{onSelect:()=>n.setActiveTool({type:"frame"}),icon:vy,shortcut:N.F.toLocaleUpperCase(),"data-testid":"toolbar-frame",selected:o,children:x("toolBar.frame")}),(0,be.jsx)(Ct.Item,{onSelect:()=>n.setActiveTool({type:"embeddable"}),icon:yI,"data-testid":"toolbar-embeddable",selected:l,children:x("toolBar.embeddable")}),(0,be.jsx)(Ct.Item,{onSelect:()=>n.setActiveTool({type:"laser"}),icon:wy,"data-testid":"toolbar-laser",selected:s,shortcut:N.K.toLocaleUpperCase(),children:x("toolBar.laser")}),(0,be.jsx)("div",{style:{margin:"6px 0",fontSize:14,fontWeight:600},children:"Generate"}),n.props.aiEnabled!==!1&&(0,be.jsx)(c.Out,{}),(0,be.jsx)(Ct.Item,{onSelect:()=>n.setOpenDialog({name:"ttd",tab:"mermaid"}),icon:xy,"data-testid":"toolbar-embeddable",children:x("toolBar.mermaidToExcalidraw")}),n.props.aiEnabled!==!1&&(0,be.jsxs)(be.Fragment,{children:[(0,be.jsxs)(Ct.Item,{onSelect:()=>n.onMagicframeToolSelect(),icon:k1,"data-testid":"toolbar-magicframe",children:[x("toolBar.magicframe"),(0,be.jsx)(Ct.Item.Badge,{children:"AI"})]}),(0,be.jsx)(Ct.Item,{onSelect:()=>{dt("ai","open-settings","d2c"),n.setOpenDialog({name:"settings",source:"settings",tab:"diagram-to-code"})},icon:Kf,"data-testid":"toolbar-magicSettings",children:x("toolBar.magicSettings")})]})]})]})]})},Tj=({renderAction:e,zoom:t})=>(0,be.jsx)(gi.Col,{gap:1,className:"zoom-actions",children:(0,be.jsxs)(gi.Row,{align:"center",children:[e("zoomOut"),e("resetZoom"),e("zoomIn")]})}),Ij=({renderAction:e,className:t})=>(0,be.jsxs)("div",{className:`undo-redo-buttons ${t}`,children:[(0,be.jsx)("div",{className:"undo-button-container",children:(0,be.jsx)(Gl,{label:x("buttons.undo"),children:e("undo")})}),(0,be.jsx)("div",{className:"redo-button-container",children:(0,be.jsxs)(Gl,{label:x("buttons.redo"),children:[" ",e("redo")]})})]}),Mj=({actionManager:e,showExitZenModeBtn:t})=>(0,be.jsx)("button",{className:X("disable-zen-mode",{"disable-zen-mode--visible":t}),onClick:()=>e.executeAction(i1),children:x("buttons.exitZenMode")}),Aj=({renderAction:e,className:t})=>(0,be.jsx)("div",{className:`finalize-button ${t}`,children:e("finalize",{size:"small"})})}),eC,Zre=M(()=>{"use strict";D(),eC=e=>{let t=(0,kj.useRef)({userFn:e});return t.current.userFn=e,t.current.stableFn||(t.current.stableFn=(...n)=>t.current.userFn(...n)),t.current.stableFn}}),s1,Pj,ev=M(()=>{"use strict";D(),Ba(),de(),Hn(),$e(),KG(),s1=_t(null),Pj=()=>{let[e,t]=Ze(s1,Xn),n=Vr();return e&&e==="clearCanvas"?(0,Jy.jsx)(pA,{onConfirm:()=>{n.executeAction(ad),t(null)},onCancel:()=>t(null),title:x("clearCanvasDialog.title"),children:(0,Jy.jsxs)("p",{className:"clear-canvas__content",children:[" ",x("alerts.clearReset")]})}):null}}),Dj={};y1(Dj,{toggleTheme:()=>_j});var _j,Kre=M(()=>{"use strict";D(),Ba(),_j={...Lh,category:"App",label:"Toggle theme",perform:({actionManager:e})=>{e.executeAction(Lh,"commandPalette")}}}),Xre=M(()=>{});function qre({customCommandPaletteItems:e}){let t=ql(),n=Un(),r=zn(),i=N1(),a=Vr(),[o,s]=Ze(Rj),[l,c]=(0,Wi.useState)(null),d=(0,Wi.useRef)(null),u=Py({uiAppState:n,customCommandPaletteItems:e,appProps:i});(0,Wi.useEffect)(()=>{let{uiAppState:A,customCommandPaletteItems:T,appProps:I}=u,k=F=>{let Y="";return F.label&&(typeof F.label=="function"?Y=x(F.label(t.scene.getNonDeletedElements(),A,t)):Y=x(F.label)),Y},R=F=>typeof F.icon=="function"?F.icon(A,t.scene.getNonDeletedElements()):F.icon,O=[],P=(F,Y,j)=>{let q={label:k(F),icon:R(F),category:Y,shortcut:Dr(F.name),keywords:F.keywords,predicate:F.predicate,viewMode:F.viewMode,perform:()=>{a.executeAction(F,"commandPalette")}};return j?j(q,F):q};if(A&&t.scene&&a){let F=[a.actions.group,a.actions.ungroup,a.actions.cut,a.actions.copy,a.actions.deleteSelectedElements,a.actions.copyStyles,a.actions.pasteStyles,a.actions.sendBackward,a.actions.sendToBack,a.actions.bringForward,a.actions.bringToFront,a.actions.alignTop,a.actions.alignBottom,a.actions.alignLeft,a.actions.alignRight,a.actions.alignVerticallyCentered,a.actions.alignHorizontallyCentered,a.actions.duplicateSelection,a.actions.flipHorizontal,a.actions.flipVertical,a.actions.zoomToFitSelection,a.actions.zoomToFitSelectionInViewport,a.actions.increaseFontSize,a.actions.decreaseFontSize,a.actions.toggleLinearEditor,$y].map(V=>P(V,un.elements,($,B)=>({...$,predicate:B.predicate?B.predicate:(G,U,Q,re)=>bt(G,U).length>0}))),Y=[a.actions.toggleHandTool,a.actions.setFrameAsActiveTool].map(V=>P(V,un.tools)),j=[a.actions.undo,a.actions.redo,a.actions.zoomIn,a.actions.zoomOut,a.actions.resetZoom,a.actions.zoomToFit,a.actions.zenMode,a.actions.viewMode,a.actions.gridMode,a.actions.objectsSnapMode,a.actions.toggleShortcuts,a.actions.selectAll,a.actions.toggleElementLock,a.actions.unlockAllElements,a.actions.stats].map(V=>P(V,un.editor)),q=[a.actions.saveToActiveFile,a.actions.saveFileToDisk,a.actions.copyAsPng,a.actions.copyAsSvg].map(V=>P(V,un.export));O=[...F,...j,{label:k(ad),icon:R(ad),shortcut:Dr(ad.name),category:un.editor,keywords:["delete","destroy"],viewMode:!1,perform:()=>{Pa.set(s1,"clearCanvas")}},{label:x("buttons.exportImage"),category:un.export,icon:gy,shortcut:Dr("imageExport"),keywords:["export","image","png","jpeg","svg","clipboard","picture"],perform:()=>{r({openDialog:{name:"imageExport"}})}},...q];let ne=[{label:x("toolBar.library"),category:un.app,icon:my,viewMode:!1,perform:()=>{A.openSidebar?r({openSidebar:null}):r({openSidebar:{name:Ss.name,tab:Ss.defaultTab}})}},{label:x("labels.changeStroke"),keywords:["color","outline"],category:un.elements,icon:xf,viewMode:!1,predicate:(V,$)=>{let B=bt(V,$);return B.length>0&&Q4($,B)},perform:()=>{r(V=>({openMenu:V.openMenu==="shape"?null:"shape",openPopup:"elementStroke"}))}},{label:x("labels.changeBackground"),keywords:["color","fill"],icon:xf,category:un.elements,viewMode:!1,predicate:(V,$)=>{let B=bt(V,$);return B.length>0&&J4($,B)},perform:()=>{r(V=>({openMenu:V.openMenu==="shape"?null:"shape",openPopup:"elementBackground"}))}},{label:x("labels.canvasBackground"),keywords:["color"],icon:xf,category:un.editor,viewMode:!1,perform:()=>{r(V=>({openMenu:V.openMenu==="canvas"?null:"canvas",openPopup:"canvasBackground"}))}},...zb.reduce((V,$)=>{let{value:B,icon:G,key:U,numericKey:Q}=$;if(I.UIOptions.tools?.[B]===!1)return V;let re=U&&nd(typeof U=="string"?U:U[0])||Q,se={label:x(`toolBar.${B}`),category:un.tools,shortcut:re,icon:G,keywords:["toolbar"],viewMode:!1,perform:({event:me})=>{B==="image"?t.setActiveTool({type:B,insertOnCanvasDirectly:me.type==="keydown"}):t.setActiveTool({type:B})}};return V.push(se),V},[]),...Y,{label:x("toolBar.lock"),category:un.tools,icon:A.activeTool.locked?T1:Dh,shortcut:N.Q.toLocaleUpperCase(),viewMode:!1,perform:()=>{t.toggleLock()}},{label:`${x("labels.textToDiagram")}...`,category:un.tools,icon:xM,viewMode:!1,predicate:I.aiEnabled,perform:()=>{r(V=>({...V,openDialog:{name:"ttd",tab:"text-to-diagram"}}))}},{label:`${x("toolBar.mermaidToExcalidraw")}...`,category:un.tools,icon:xy,viewMode:!1,predicate:I.aiEnabled,perform:()=>{r(V=>({...V,openDialog:{name:"ttd",tab:"mermaid"}}))}}],H=[...O,...ne,...T||[]].map(V=>({...V,icon:V.icon||Cy,order:V.order??Oj(V.category),haystack:`${X4(V.label)} ${V.keywords?.join(" ")||""}`}));c(H),s(H.find(V=>V.label===o?.label)??null)}},[u,t,a,c,o?.label,s,r]);let[h,m]=(0,Wi.useState)(""),[p,f]=(0,Wi.useState)(null),[g,b]=(0,Wi.useState)({}),v=A=>{r({openDialog:null},A),m("")},y=(A,T)=>{n.openDialog?.name==="commandPalette"&&(T.stopPropagation(),T.preventDefault(),document.body.classList.add("excalidraw-animations-disabled"),v(()=>{A.perform({actionManager:a,event:T}),s(A),requestAnimationFrame(()=>{document.body.classList.remove("excalidraw-animations-disabled")})}))},w=eC(A=>A.viewMode===!1&&n.viewModeEnabled?!1:typeof A.predicate=="function"?A.predicate(t.scene.getNonDeletedElements(),n,i,t):A.predicate===void 0||A.predicate),C=eC(A=>{let T=ds(A.target)||tC(A)||A.key===N.ESCAPE;if(T&&A.key!==N.ARROW_UP&&A.key!==N.ARROW_DOWN&&A.key!==N.ENTER)return;let I=Object.values(g).flat(),k=o&&!h&&w(o);if(A.key===N.ARROW_UP){A.preventDefault();let R=I.findIndex(F=>F.label===p?.label);if(k){if(R===0){f(o);return}if(p===o){let F=I[I.length-1];F&&f(F);return}}let O;R===-1?O=I.length-1:O=R===0?I.length-1:(R-1)%I.length;let P=I[O];P&&f(P);return}if(A.key===N.ARROW_DOWN){A.preventDefault();let R=I.findIndex(F=>F.label===p?.label);if(k){if(!p||R===I.length-1){f(o);return}if(p===o){let F=I[0];F&&f(F);return}}let O=(R+1)%I.length,P=I[O];P&&f(P);return}if(A.key===N.ENTER&&p&&setTimeout(()=>{y(p,A)}),!T){if(A.stopPropagation(),/^[a-zA-Z0-9]$/.test(A.key)){d?.current?.focus();return}A.preventDefault()}});return(0,Wi.useEffect)(()=>(window.addEventListener("keydown",C,{capture:!0}),()=>window.removeEventListener("keydown",C,{capture:!0})),[C]),(0,Wi.useEffect)(()=>{if(!l)return;let A=R=>{let O={};for(let P of R)O[P.category]?O[P.category].push(P):O[P.category]=[P];return O},T=l.filter(w).sort((R,O)=>R.order-O.order),I=!h&&o&&w(o);if(!h){b(A(I?T.filter(R=>R.label!==o?.label):T)),f(I?o:T[0]||null);return}let k=X4(h.replace(/[<>-_| ]/g,""));T=Lj.default.filter(k,T,{extract:R=>R.haystack}).sort((R,O)=>O.score-R.score).map(R=>R.original),b(A(T)),f(T[0]??null)},[h,l,w,o]),(0,Lt.jsxs)(wi,{onCloseRequest:()=>v(),closeOnClickOutside:!0,title:!1,size:720,autofocus:!0,className:"command-palette-dialog",children:[(0,Lt.jsx)(yA,{value:h,placeholder:x("commandPalette.search.placeholder"),onChange:A=>{m(A)},selectOnRender:!0,ref:d}),!t.device.viewport.isMobile&&(0,Lt.jsxs)("div",{className:"shortcuts-wrapper",children:[(0,Lt.jsx)(Tf,{shortcut:"\u2191\u2193",children:x("commandPalette.shortcuts.select")}),(0,Lt.jsx)(Tf,{shortcut:"\u21B5",children:x("commandPalette.shortcuts.confirm")}),(0,Lt.jsx)(Tf,{shortcut:K("Esc"),children:x("commandPalette.shortcuts.close")})]}),(0,Lt.jsxs)("div",{className:"commands",children:[o&&!h&&(0,Lt.jsxs)("div",{className:"command-category",children:[(0,Lt.jsxs)("div",{className:"command-category-title",children:[x("commandPalette.recents"),(0,Lt.jsx)("div",{className:"icon",style:{marginLeft:"6px"},children:wM})]}),(0,Lt.jsx)(nC,{command:o,isSelected:o.label===p?.label,onClick:A=>y(o,A),disabled:!w(o),onMouseMove:()=>f(o),showShortcut:!t.device.viewport.isMobile,appState:n})]}),Object.keys(g).length>0?Object.keys(g).map((A,T)=>(0,Lt.jsxs)("div",{className:"command-category",children:[(0,Lt.jsx)("div",{className:"command-category-title",children:A}),g[A].map(I=>(0,Lt.jsx)(nC,{command:I,isSelected:I.label===p?.label,onClick:k=>y(I,k),onMouseMove:()=>f(I),showShortcut:!t.device.viewport.isMobile,appState:n},I.label))]},A)):l?(0,Lt.jsxs)("div",{className:"no-match",children:[(0,Lt.jsx)("div",{className:"icon",children:Sy})," ",x("commandPalette.search.noMatch")]}):null]})]})}var Rj,un,Oj,Tf,tC,Qre,nC,Nj=M(()=>{"use strict";D(),$e(),ke(),Ki(),vj(),It(),de(),Zh(),ae(),pe(),ir(),te(),Vre(),vA(),xA(),Qy(),Zre(),Ba(),Hn(),ev(),Kre(),xi(),VM(),Xre(),Rj=_t(null),un={app:"App",export:"Export",tools:"Tools",editor:"Editor",elements:"Elements",links:"Links"},Oj=e=>{switch(e){case un.app:return 1;case un.export:return 2;case un.editor:return 3;case un.tools:return 4;case un.elements:return 5;case un.links:return 6;default:return 10}},Tf=({shortcut:e,className:t,children:n})=>{let r=e.replace("++","+$").split("+");return(0,Lt.jsxs)("div",{className:X("shortcut",t),children:[r.map((i,a)=>(0,Lt.jsx)("div",{className:"shortcut-wrapper",children:(0,Lt.jsx)("div",{className:"shortcut-key",children:i==="$"?"+":i})},i)),(0,Lt.jsx)("div",{className:"shortcut-desc",children:n})]})},tC=e=>!e.altKey&&e[N.CTRL_OR_CMD]&&(e.shiftKey&&e.key.toLowerCase()===N.P||e.key===N.SLASH),Qre=Object.assign(e=>{let t=Un(),n=zn();return(0,Wi.useEffect)(()=>{let r=i=>{tC(i)&&(i.preventDefault(),i.stopPropagation(),n(a=>{let o=a.openDialog?.name==="commandPalette"?null:{name:"commandPalette"};return o&&dt("command_palette","open","shortcut"),{openDialog:o}}))};return window.addEventListener("keydown",r,{capture:!0}),()=>window.removeEventListener("keydown",r,{capture:!0})},[n]),t.openDialog?.name!=="commandPalette"?null:(0,Lt.jsx)(qre,{...e})},{defaultItems:Dj}),nC=({command:e,isSelected:t,disabled:n,onMouseMove:r,onClick:i,showShortcut:a,appState:o})=>{let s=()=>{};return(0,Lt.jsxs)("div",{className:X("command-item",{"item-selected":t,"item-disabled":n}),ref:l=>{t&&!n&&l?.scrollIntoView?.({block:"nearest"})},onClick:n?s:i,onMouseMove:n?s:r,title:n?x("commandPalette.itemNotAvailable"):"",children:[(0,Lt.jsxs)("div",{className:"name",children:[e.icon&&(0,Lt.jsx)(fh,{icon:typeof e.icon=="function"?e.icon(o):e.icon}),e.label]}),a&&e.shortcut&&(0,Lt.jsx)(Tf,{shortcut:e.shortcut})]})}}),CA,Jre=M(()=>{"use strict";D(),Nj(),yr(),Se(),ht(),Tt(),CA=oe({name:"toggleLinearEditor",category:un.elements,label:(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0];return t.editingLinearElement?.elementId===r?.id?"labels.lineEditor.exit":"labels.lineEditor.edit"},trackEvent:{category:"element"},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return!!(i.length===1&&Be(i[0]))},perform(e,t,n,r){let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0],a=t.editingLinearElement?.elementId===i.id?null:new fe(i);return{appState:{...t,editingLinearElement:a},storeAction:Z.CAPTURE}}})}),eie={};y1(eie,{actionAddToLibrary:()=>iA,actionAlignBottom:()=>bG,actionAlignHorizontallyCentered:()=>wG,actionAlignLeft:()=>yG,actionAlignRight:()=>vG,actionAlignTop:()=>EG,actionAlignVerticallyCentered:()=>xG,actionBindText:()=>cA,actionBringForward:()=>$M,actionBringToFront:()=>BM,actionChangeBackgroundColor:()=>zU,actionChangeExportBackground:()=>qM,actionChangeFillStyle:()=>HU,actionChangeFontFamily:()=>VU,actionChangeFontSize:()=>WU,actionChangeOpacity:()=>jU,actionChangeProjectName:()=>XM,actionChangeSloppiness:()=>GU,actionChangeStrokeColor:()=>BU,actionChangeStrokeWidth:()=>UU,actionChangeTextAlign:()=>YU,actionChangeVerticalAlign:()=>ZU,actionChangeViewBackgroundColor:()=>QU,actionClearCanvas:()=>ad,actionCopy:()=>uh,actionCopyAsPng:()=>$b,actionCopyAsSvg:()=>Nb,actionCopyStyles:()=>JM,actionCut:()=>Ob,actionDeleteSelected:()=>Ty,actionDuplicateSelection:()=>HM,actionFinalize:()=>Ri,actionFlipHorizontal:()=>aA,actionFlipVertical:()=>oA,actionGoToCollaborator:()=>fG,actionGroup:()=>tA,actionLink:()=>$y,actionLoadScene:()=>n1,actionPasteStyles:()=>eA,actionResetZoom:()=>JU,actionSaveFileToDisk:()=>Ry,actionSaveToActiveFile:()=>Rb,actionSelectAll:()=>zM,actionSendBackward:()=>NM,actionSendToBack:()=>FM,actionShortcuts:()=>L1,actionToggleCanvasMenu:()=>cG,actionToggleEditMenu:()=>dG,actionToggleElementLock:()=>dA,actionToggleGridMode:()=>Bb,actionToggleLinearEditor:()=>CA,actionToggleObjectsSnapMode:()=>sA,actionToggleStats:()=>Rh,actionToggleTheme:()=>Lh,actionToggleZenMode:()=>i1,actionUnbindText:()=>lA,actionUngroup:()=>nA,actionZoomIn:()=>_b,actionZoomOut:()=>Lb,actionZoomToFit:()=>eG,copyText:()=>Fb,distributeHorizontally:()=>CG,distributeVertically:()=>TG});var Ba=M(()=>{"use strict";D(),cU(),fne(),gne(),bne(),KU(),Ly(),zne(),Oy(),Yne(),Zne(),Kne(),ere(),tre(),rre(),are(),ore(),IG(),sre(),lre(),cre(),MG(),kG(),ure(),NG(),Jre()}),If,fE,C$,$j=M(()=>{"use strict";D(),ty(),If=class{constructor(e=!0,t=!0){this.isUndoStackEmpty=e,this.isRedoStackEmpty=t}},fE=class nf{onHistoryChangedEmitter=new va;undoStack=[];redoStack=[];get isUndoStackEmpty(){return this.undoStack.length===0}get isRedoStackEmpty(){return this.redoStack.length===0}clear(){this.undoStack.length=0,this.redoStack.length=0}record(t,n){let r=C$.create(n,t);r.isEmpty()||(this.undoStack.push(r.inverse()),r.elementsChange.isEmpty()||(this.redoStack.length=0),this.onHistoryChangedEmitter.trigger(new If(this.isUndoStackEmpty,this.isRedoStackEmpty)))}undo(t,n,r){return this.perform(t,n,r,()=>nf.pop(this.undoStack),i=>nf.push(this.redoStack,i,t))}redo(t,n,r){return this.perform(t,n,r,()=>nf.pop(this.redoStack),i=>nf.push(this.undoStack,i,t))}perform(t,n,r,i,a){try{let o=i();if(o===null)return;let s=t,l=n,c=!1;for(;o;){try{[s,l,c]=o.applyTo(s,l,r)}finally{a(o)}if(c)break;o=i()}return[s,l]}finally{this.onHistoryChangedEmitter.trigger(new If(this.isUndoStackEmpty,this.isRedoStackEmpty))}}static pop(t){if(!t.length)return null;let n=t.pop();return n!==void 0?n:null}static push(t,n,r){let i=n.inverse().applyLatestChanges(r);return t.push(i)}},C$=class gE{constructor(t,n){this.appStateChange=t,this.elementsChange=n}static create(t,n){return new gE(t,n)}inverse(){return new gE(this.appStateChange.inverse(),this.elementsChange.inverse())}applyTo(t,n,r){let[i,a]=this.elementsChange.applyTo(t,r.elements),[o,s]=this.appStateChange.applyTo(n,i);return[i,o,a||s]}applyLatestChanges(t){let n=this.elementsChange.applyLatestChanges(t);return gE.create(this.appStateChange,n)}isEmpty(){return this.appStateChange.isEmpty()&&this.elementsChange.isEmpty()}}}),rC,tie=M(()=>{"use strict";D(),rC=(e,t)=>{let[n,r]=(0,tv.useState)(t);return(0,tv.useEffect)(()=>{let i=e.on(a=>{r(a)});return()=>{i()}},[e]),n}}),LS,Fj,Bj,nie=M(()=>{"use strict";D(),pe(),Gn(),de(),$j(),ke(),te(),ae(),ht(),tie(),LS=(e,t)=>{if(!e.multiElement&&!e.resizingElement&&!e.editingElement&&!e.draggingElement){let n=t();if(!n)return{storeAction:Z.NONE};let[r,i]=n,a=Array.from(r.values());return{appState:i,elements:a,storeAction:Z.UPDATE}}return{storeAction:Z.NONE}},Fj=(e,t)=>({name:"undo",label:"buttons.undo",icon:ub,trackEvent:{category:"history"},viewMode:!1,perform:(n,r)=>LS(r,()=>e.undo(ve(n),r,t.snapshot)),keyTest:n=>n[N.CTRL_OR_CMD]&&n.key.toLowerCase()===N.Z&&!n.shiftKey,PanelComponent:({updateData:n,data:r})=>{let{isUndoStackEmpty:i}=rC(e.onHistoryChangedEmitter,new If);return(0,iC.jsx)(Xe,{type:"button",icon:ub,"aria-label":x("buttons.undo"),onClick:n,size:r?.size||"medium",disabled:i})}}),Bj=(e,t)=>({name:"redo",label:"buttons.redo",icon:hb,trackEvent:{category:"history"},viewMode:!1,perform:(n,r)=>LS(r,()=>e.redo(ve(n),r,t.snapshot)),keyTest:n=>n[N.CTRL_OR_CMD]&&n.shiftKey&&n.key.toLowerCase()===N.Z||VC&&n.ctrlKey&&!n.shiftKey&&n.key===N.Y,PanelComponent:({updateData:n,data:r})=>{let{isRedoStackEmpty:i}=rC(e.onHistoryChangedEmitter,new If);return(0,iC.jsx)(Xe,{type:"button",icon:hb,"aria-label":x("buttons.redo"),onClick:n,size:r?.size||"medium",disabled:i})}})}),S2,aC,rie=M(()=>{"use strict";D(),xi(),te(),S2=(e,t,n,r,i,a)=>{if(e.trackEvent)try{typeof e.trackEvent=="object"&&(!e.trackEvent.predicate||e.trackEvent.predicate(n,r,a))&&dt(e.trackEvent.category,e.trackEvent.action||e.name,`${t} (${i.device.editor.isMobile?"mobile":"desktop"})`)}catch(o){console.error("error while logging action:",o)}},aC=class{actions={};updater;getAppState;getElementsIncludingDeleted;app;constructor(e,t,n,r){this.updater=i=>{if(Uh(i))i.then(a=>e(a));else return e(i)},this.getAppState=t,this.getElementsIncludingDeleted=n,this.app=r}registerAction(e){this.actions[e.name]=e}registerAll(e){e.forEach(t=>this.registerAction(t))}handleKeyDown(e){let t=this.app.props.UIOptions.canvasActions,n=Object.values(this.actions).sort((s,l)=>(l.keyPriority||0)-(s.keyPriority||0)).filter(s=>(s.name in t?t[s.name]:!0)&&s.keyTest&&s.keyTest(e,this.getAppState(),this.getElementsIncludingDeleted(),this.app));if(n.length!==1)return n.length>1&&console.warn("Canceling as multiple actions match this shortcut",n),!1;let r=n[0];if(this.getAppState().viewModeEnabled&&r.viewMode!==!0)return!1;let i=this.getElementsIncludingDeleted(),a=this.getAppState(),o=null;return S2(r,"keyboard",a,i,this.app,null),e.preventDefault(),e.stopPropagation(),this.updater(n[0].perform(i,a,o,this.app)),!0}executeAction(e,t="api",n=null){let r=this.getElementsIncludingDeleted(),i=this.getAppState();S2(e,t,i,r,this.app,n),this.updater(e.perform(r,i,n,this.app))}renderAction=(e,t)=>{let n=this.app.props.UIOptions.canvasActions;if(this.actions[e]&&"PanelComponent"in this.actions[e]&&(!(e in n)||n[e])){let r=this.actions[e],i=r.PanelComponent;i.displayName="PanelComponent";let a=this.getElementsIncludingDeleted(),o=this.getAppState(),s=l=>{S2(r,"ui",o,a,this.app,l),this.updater(r.perform(this.getElementsIncludingDeleted(),this.getAppState(),l,this.app))};return(0,zj.jsx)(i,{elements:this.getElementsIncludingDeleted(),appState:this.getAppState(),updateData:s,appProps:this.app.props,app:this.app,data:t})}return null};isActionEnabled=e=>{let t=this.getElementsIncludingDeleted(),n=this.getAppState();return!e.predicate||e.predicate(t,n,this.app.props,this.app)}}}),oC,sC,RS,iie=M(()=>{"use strict";D(),oC=e=>{let t=Array.from(e.values());return{x:RS(t,n=>n.x)/t.length,y:RS(t,n=>n.y)/t.length}},sC=([e,t])=>Math.hypot(e.x-t.x,e.y-t.y),RS=(e,t)=>e.reduce((n,r)=>n+t(r),0)}),aie=M(()=>{}),Ir,Uj,oie=M(()=>{"use strict";D(),FU(),de(),aie(),Zh(),$e(),Ir="separator",Uj=Hj.default.memo(({actionManager:e,items:t,top:n,left:r,onClose:i})=>{let a=cv(),o=$1(),s=t.reduce((l,c)=>(c&&(c===Ir||!c.predicate||c.predicate(o,a,e.app.props,e.app))&&l.push(c),l),[]);return(0,ls.jsx)(ZM,{onCloseRequest:()=>{i()},top:n,left:r,fitInViewport:!0,offsetLeft:a.offsetLeft,offsetTop:a.offsetTop,viewportWidth:a.width,viewportHeight:a.height,children:(0,ls.jsx)("ul",{className:"context-menu",onContextMenu:l=>l.preventDefault(),children:s.map((l,c)=>{if(l===Ir)return!s[c-1]||s[c-1]===Ir?null:(0,ls.jsx)("hr",{className:"context-menu-item-separator"},c);let d=l.name,u="";return l.label&&(typeof l.label=="function"?u=x(l.label(o,a,e.app)):u=x(l.label)),(0,ls.jsx)("li",{"data-testid":d,onClick:()=>{i(()=>{e.executeAction(l,"contextMenu")})},children:(0,ls.jsxs)("button",{className:X("context-menu-item",{dangerous:d==="deleteSelectedElements",checkmark:l.checked?.(a)}),children:[(0,ls.jsx)("div",{className:"context-menu-item__label",children:u}),(0,ls.jsx)("kbd",{className:"context-menu-item__shortcut",children:d?Dr(d):""})]})},c)})})})})}),Gj,sie=M(()=>{"use strict";D(),de(),Ki(),$e(),Gj=({children:e,onClose:t})=>{let[n,r]=(0,nv.useState)(!!e),{container:i}=Po(),a=nv.default.useCallback(()=>{r(!1),t&&t(),i?.focus()},[t,i]);return(0,gh.jsx)(gh.Fragment,{children:n&&(0,gh.jsx)(wi,{size:"small",onCloseRequest:a,title:x("errorDialog.title"),children:(0,gh.jsx)("div",{style:{whiteSpace:"pre-wrap"},children:e})})})}}),lie=M(()=>{}),TA,jj=M(()=>{"use strict";D(),lie(),TA=function({onChange:e,value:t,choices:n,name:r}){return(0,l1.jsx)("div",{className:"RadioGroup",children:n.map(i=>(0,l1.jsxs)("div",{className:X("RadioGroup__choice",{active:i.value===t}),title:i.ariaLabel,children:[(0,l1.jsx)("input",{name:r,type:"radio",checked:i.value===t,onChange:()=>e(i.value),"aria-label":i.ariaLabel}),i.label]},String(i.value)))})}}),cie=M(()=>{}),rf,die=M(()=>{"use strict";D(),cie(),rf=({title:e,name:t,checked:n,onChange:r,disabled:i=!1})=>(0,lC.jsx)("div",{className:X("Switch",{toggled:n,disabled:i}),children:(0,lC.jsx)("input",{name:t,id:t,title:e,type:"checkbox",checked:n,disabled:i,onChange:()=>r(!n),onKeyDown:a=>{a.key===" "&&r(!n)}})})}),uie=M(()=>{}),hie=M(()=>{}),sd,iv=M(()=>{"use strict";D(),hie(),bd(),jl(),te(),sd=(0,rv.forwardRef)(({children:e,icon:t,onClick:n,label:r,variant:i="filled",color:a="primary",size:o="medium",fullWidth:s,className:l},c)=>{let[d,u]=(0,rv.useState)(!1),h=async m=>{let p=n?.(m);if(Uh(p))try{u(!0),await p}catch(f){if(f instanceof w1)console.warn(f);else throw f}finally{u(!1)}};return(0,Eh.jsx)("button",{className:X("ExcButton",`ExcButton--color-${a}`,`ExcButton--variant-${i}`,`ExcButton--size-${o}`,{"ExcButton--fullWidth":s},l),onClick:h,type:"button","aria-label":r,ref:c,disabled:d,children:(0,Eh.jsxs)("div",{className:"ExcButton__contents",children:[d&&(0,Eh.jsx)(Co,{}),t&&(0,Eh.jsx)("div",{className:"ExcButton__icon","aria-hidden":!0,children:t}),i!=="icon"&&(e??r)]})})})}),T$,I$,M$,Du,Wj,mie=M(()=>{"use strict";D(),Oy(),vd(),ae(),yi(),Wl(),de(),It(),Wh(),pe(),Ki(),jj(),die(),Sd(),uie(),iv(),te(),fd(),T$="filter"in document.createElement("canvas").getContext("2d"),I$=()=>(0,Ke.jsxs)("div",{children:[(0,Ke.jsx)("h3",{children:x("canvasError.cannotShowPreview")}),(0,Ke.jsx)("p",{children:(0,Ke.jsx)("span",{children:x("canvasError.canvasTooBig")})}),(0,Ke.jsxs)("em",{children:["(",x("canvasError.canvasTooBigTip"),")"]})]}),M$=({appStateSnapshot:e,elementsSnapshot:t,files:n,actionManager:r,onExportImage:i,name:a})=>{let o=vn(t,e),[s,l]=(0,di.useState)(a),[c,d]=(0,di.useState)(o),[u,h]=(0,di.useState)(e.exportBackground),[m,p]=(0,di.useState)(e.exportWithDarkMode),[f,g]=(0,di.useState)(e.exportEmbedScene),[b,v]=(0,di.useState)(e.exportScale),y=(0,di.useRef)(null),[w,C]=(0,di.useState)(null),{exportedElements:A,exportingFrame:T}=Qf(t,e,c);return(0,di.useEffect)(()=>{let I=y.current;if(!I)return;let k=I.offsetWidth,R=I.offsetHeight;k&&VT({data:{elements:A,appState:{...e,name:s,exportEmbedScene:f},files:n},config:{canvasBackgroundColor:u?e.viewBackgroundColor:!1,padding:Hh,theme:m?"dark":"light",scale:b,maxWidthOrHeight:Math.max(k,R),exportingFrame:T}}).then(O=>(C(null),Ih(O).then(()=>{I.replaceChildren(O)}).catch(P=>{throw P.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(x("canvasError.canvasTooBig")):P}))).catch(O=>{console.error(O),C(O)})},[e,n,A,T,s,u,m,b,f]),(0,Ke.jsxs)("div",{className:"ImageExportModal",children:[(0,Ke.jsx)("h3",{children:x("imageExportDialog.header")}),(0,Ke.jsxs)("div",{className:"ImageExportModal__preview",children:[(0,Ke.jsx)("div",{className:"ImageExportModal__preview__canvas",ref:y,children:w&&(0,Ke.jsx)(I$,{})}),(0,Ke.jsx)("div",{className:"ImageExportModal__preview__filename",children:!da&&(0,Ke.jsx)("input",{type:"text",className:"TextInput",value:s,style:{width:"30ch"},onChange:I=>{l(I.target.value),r.executeAction(XM,"ui",I.target.value)}})})]}),(0,Ke.jsxs)("div",{className:"ImageExportModal__settings",children:[(0,Ke.jsx)("h3",{children:x("imageExportDialog.header")}),o&&(0,Ke.jsx)(Du,{label:x("imageExportDialog.label.onlySelected"),name:"exportOnlySelected",children:(0,Ke.jsx)(rf,{name:"exportOnlySelected",checked:c,onChange:I=>{d(I)}})}),(0,Ke.jsx)(Du,{label:x("imageExportDialog.label.withBackground"),name:"exportBackgroundSwitch",children:(0,Ke.jsx)(rf,{name:"exportBackgroundSwitch",checked:u,onChange:I=>{h(I),r.executeAction(qM,"ui",I)}})}),T$&&(0,Ke.jsx)(Du,{label:x("imageExportDialog.label.darkMode"),name:"exportDarkModeSwitch",children:(0,Ke.jsx)(rf,{name:"exportDarkModeSwitch",checked:m,onChange:I=>{p(I),r.executeAction(lG,"ui",I)}})}),(0,Ke.jsx)(Du,{label:x("imageExportDialog.label.embedScene"),tooltip:x("imageExportDialog.tooltip.embedScene"),name:"exportEmbedSwitch",children:(0,Ke.jsx)(rf,{name:"exportEmbedSwitch",checked:f,onChange:I=>{g(I),r.executeAction(QM,"ui",I)}})}),(0,Ke.jsx)(Du,{label:x("imageExportDialog.label.scale"),name:"exportScale",children:(0,Ke.jsx)(TA,{name:"exportScale",value:b,onChange:I=>{v(I),r.executeAction(sG,"ui",I)},choices:Kb.map(I=>({value:I,label:`${I}\xD7`}))})}),(0,Ke.jsxs)("div",{className:"ImageExportModal__settings__buttons",children:[(0,Ke.jsx)(sd,{className:"ImageExportModal__settings__buttons__button",label:x("imageExportDialog.title.exportToPng"),onClick:()=>i(Z2.png,A,{exportingFrame:T}),icon:Ab,children:x("imageExportDialog.button.exportToPng")}),(0,Ke.jsx)(sd,{className:"ImageExportModal__settings__buttons__button",label:x("imageExportDialog.title.exportToSvg"),onClick:()=>i(Z2.svg,A,{exportingFrame:T}),icon:Ab,children:x("imageExportDialog.button.exportToSvg")}),(ly||bh)&&(0,Ke.jsx)(sd,{className:"ImageExportModal__settings__buttons__button",label:x("imageExportDialog.title.copyPngToClipboard"),onClick:()=>i(Z2.clipboard,A,{exportingFrame:T}),icon:yy,children:x("imageExportDialog.button.copyPngToClipboard")})]})]})]})},Du=({label:e,children:t,tooltip:n,name:r})=>(0,Ke.jsxs)("div",{className:"ImageExportModal__settings__setting",title:e,children:[(0,Ke.jsxs)("label",{htmlFor:r,className:"ImageExportModal__settings__setting__label",children:[e,n&&(0,Ke.jsx)(Gl,{label:n,long:!0,children:pM})]}),(0,Ke.jsx)("div",{className:"ImageExportModal__settings__setting__content",children:t})]}),Wj=({elements:e,appState:t,files:n,actionManager:r,onExportImage:i,onCloseRequest:a,name:o})=>{let[{appStateSnapshot:s,elementsSnapshot:l}]=(0,di.useState)(()=>({appStateSnapshot:ud(t),elementsSnapshot:ud(e)}));return(0,Ke.jsx)(wi,{onCloseRequest:a,size:"wide",title:!1,children:(0,Ke.jsx)(M$,{elementsSnapshot:l,appStateSnapshot:s,files:n,actionManager:r,onExportImage:i,name:o})})}}),pie=M(()=>{}),IA,Yj=M(()=>{"use strict";D(),pie(),IA=({children:e,side:t,className:n})=>(0,Vj.jsx)("div",{className:X("FixedSideContainer",`FixedSideContainer_side_${t}`,n),children:e})}),fie=M(()=>{}),A$,MA,Zj=M(()=>{"use strict";D(),de(),Se(),te(),vi(),fie(),A$=({appState:e,isMobile:t,device:n,app:r})=>{let{activeTool:i,isResizing:a,isRotating:o,lastPointerDownWith:s}=e,l=e.multiElement!==null;if(e.openSidebar&&!n.editor.canFitSidebar)return null;if(ya(e))return x("hints.eraserRevert");if(i.type==="arrow"||i.type==="line")return x(l?"hints.linearElementMulti":"hints.linearElement");if(i.type==="freedraw")return x("hints.freeDraw");if(i.type==="text")return x("hints.text");if(i.type==="embeddable")return x("hints.embeddable");if(e.activeTool.type==="image"&&e.pendingImageElementId)return x("hints.placeImage");let c=r.scene.getSelectedElements(e);if(a&&s==="mouse"&&c.length===1){let d=c[0];return Be(d)&&d.points.length===2?x("hints.lockAngle"):Ll(d)?x("hints.resizeImage"):x("hints.resize")}if(o&&s==="mouse")return x("hints.rotate");if(c.length===1&&he(c[0]))return x("hints.text_selected");if(e.editingElement&&he(e.editingElement))return x("hints.text_editing");if(i.type==="selection"){if(e.draggingElement?.type==="selection"&&!c.length&&!e.editingElement&&!e.editingLinearElement)return x("hints.deepBoxSelect");if(e.gridSize&&e.draggingElement)return x("hints.disableSnapping");if(!c.length&&!t)return x("hints.canvasPanning");if(c.length===1){if(Be(c[0]))return e.editingLinearElement?e.editingLinearElement.selectedPointsIndices?x("hints.lineEditor_pointSelected"):x("hints.lineEditor_nothingSelected"):x("hints.lineEditor_info");if(!e.draggingElement&&Rl(c[0]))return x("hints.bindTextToElement")}}return null},MA=({appState:e,isMobile:t,device:n,app:r})=>{let i=A$({appState:e,isMobile:t,device:n,app:r});return i?(i=K(i),(0,cC.jsx)("div",{className:"HintViewer",children:(0,cC.jsx)("span",{children:i})})):null}}),k$,OS,AA,Kj=M(()=>{"use strict";D(),Vl(),pe(),k$="medium",OS={CHECKED:T1,UNCHECKED:Dh},AA=e=>(0,c1.jsxs)("label",{className:X("ToolIcon ToolIcon__lock",`ToolIcon_size_${k$}`,{"is-mobile":e.isMobile}),title:`${e.title} \u2014 Q`,children:[(0,c1.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":"toolbar-lock"}),(0,c1.jsx)("div",{className:"ToolIcon__icon",children:e.checked?OS.CHECKED:OS.UNCHECKED})]})}),Fh,kA=M(()=>{"use strict";D(),de(),$e(),Fh=({heading:e,children:t,...n})=>{let{id:r}=Po(),i=(0,gd.jsx)("h2",{className:"visually-hidden",id:`${r}-${e}-title`,children:x(`headings.${e}`)});return(0,gd.jsx)("section",{...n,"aria-labelledby":`${r}-${e}-title`,children:typeof t=="function"?t(i):(0,gd.jsxs)(gd.Fragment,{children:[i,t]})})}}),ba,fs,Xj,qj,dC,PA=M(()=>{"use strict";D(),Oe(),te(),de(),ba=4,fs=6,Xj="rgba(0,0,0,0.3)",qj=(e,t,n,r)=>{if(!e.length)return{horizontal:null,vertical:null};let[i,a,o,s]=Bt(e),l=t/r.zoom.value,c=n/r.zoom.value,d=t-l,u=n-c,h={top:parseInt(Hp("sat"))||0,bottom:parseInt(Hp("sab"))||0,left:parseInt(Hp("sal"))||0,right:parseInt(Hp("sar"))||0},m=zh().rtl,p=-r.scrollX+d/2+h.left,f=-r.scrollY+u/2+h.top,g=p+l-h.right,b=f+c-h.bottom,v=Math.min(i,p),y=Math.min(a,f),w=Math.max(o,g),C=Math.max(s,b);return{horizontal:p===v&&g===w?null:{x:Math.max(h.left,ba)+(p-v)/(w-v)*t,y:n-fs-Math.max(ba,h.bottom),width:(g-p)/(w-v)*t-Math.max(ba*2,h.left+h.right),height:fs},vertical:f===y&&b===C?null:{x:m?Math.max(h.left,ba):t-fs-Math.max(h.right,ba),y:(f-y)/(C-y)*n+Math.max(h.top,ba),width:fs,height:(b-f)/(C-y)*n-Math.max(ba*2,h.top+h.bottom)}}},dC=(e,t,n)=>{let[r,i]=[e.horizontal,e.vertical].map(a=>a!=null&&a.x<=t&&t<=a.x+a.width&&a.y<=n&&n<=a.y+a.height);return{isOverEither:r||i,isOverHorizontal:r,isOverVertical:i}}}),P$,DA,Qj=M(()=>{"use strict";D(),Vl(),pe(),P$="medium",DA=e=>e.penDetected?(0,d1.jsxs)("label",{className:X("ToolIcon ToolIcon__penMode",`ToolIcon_size_${P$}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,d1.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,d1.jsx)("div",{className:"ToolIcon__icon",children:pI})]}):null}),gie=M(()=>{}),_A,Jj=M(()=>{"use strict";D(),Qt(),de(),It(),pe(),Cd(),gie(),_A=e=>{let t=Bt(e.elements),n=hy(e.elements,e.appState),r=Bt(n);return(0,_e.jsx)("div",{className:"Stats",children:(0,_e.jsxs)(Ra,{padding:2,children:[(0,_e.jsx)("div",{className:"close",onClick:e.onClose,children:Yl}),(0,_e.jsx)("h3",{children:x("stats.title")}),(0,_e.jsx)("table",{children:(0,_e.jsxs)("tbody",{children:[(0,_e.jsx)("tr",{children:(0,_e.jsx)("th",{colSpan:2,children:x("stats.scene")})}),(0,_e.jsxs)("tr",{children:[(0,_e.jsx)("td",{children:x("stats.elements")}),(0,_e.jsx)("td",{children:e.elements.length})]}),(0,_e.jsxs)("tr",{children:[(0,_e.jsx)("td",{children:x("stats.width")}),(0,_e.jsx)("td",{children:Math.round(t[2])-Math.round(t[0])})]}),(0,_e.jsxs)("tr",{children:[(0,_e.jsx)("td",{children:x("stats.height")}),(0,_e.jsx)("td",{children:Math.round(t[3])-Math.round(t[1])})]}),n.length===1&&(0,_e.jsx)("tr",{children:(0,_e.jsx)("th",{colSpan:2,children:x("stats.element")})}),n.length>1&&(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsx)("tr",{children:(0,_e.jsx)("th",{colSpan:2,children:x("stats.selected")})}),(0,_e.jsxs)("tr",{children:[(0,_e.jsx)("td",{children:x("stats.elements")}),(0,_e.jsx)("td",{children:n.length})]})]}),n.length>0&&(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsxs)("tr",{children:[(0,_e.jsx)("td",{children:"x"}),(0,_e.jsx)("td",{children:Math.round(r[0])})]}),(0,_e.jsxs)("tr",{children:[(0,_e.jsx)("td",{children:"y"}),(0,_e.jsx)("td",{children:Math.round(r[1])})]}),(0,_e.jsxs)("tr",{children:[(0,_e.jsx)("td",{children:x("stats.width")}),(0,_e.jsx)("td",{children:Math.round(r[2]-r[0])})]}),(0,_e.jsxs)("tr",{children:[(0,_e.jsx)("td",{children:x("stats.height")}),(0,_e.jsx)("td",{children:Math.round(r[3]-r[1])})]})]}),n.length===1&&(0,_e.jsxs)("tr",{children:[(0,_e.jsx)("td",{children:x("stats.angle")}),(0,_e.jsx)("td",{children:`${Math.round(n[0].angle*180/Math.PI)}\xB0`})]}),e.renderCustomStats?.(e.elements,e.appState)]})})]})})}}),LA,tW=M(()=>{"use strict";D(),Vl(),Gn(),pe(),ke(),LA=e=>(0,eW.jsx)(Xe,{className:X("Shape",{fillable:!1}),type:"radio",icon:by,name:"editor-current-shape",checked:e.checked,title:`${e.title} \u2014 H`,keyBindingLabel:e.isMobile?void 0:N.H.toLocaleUpperCase(),"aria-label":`${e.title} \u2014 H`,"aria-keyshortcuts":N.H,"data-testid":"toolbar-hand",onChange:()=>e.onChange?.()})}),Eie=M(()=>{}),nW,bie=M(()=>{"use strict";D(),de(),te(),pe(),Eie(),nW=({onHomeButtonClick:e})=>(0,EE.jsx)("label",{title:`${nd(x("toolBar.library"))} \u2014 0`,children:(0,EE.jsx)("div",{className:"library-button",onClick:e,children:(0,EE.jsx)("div",{children:tI})})})}),rW,yie=M(()=>{"use strict";D(),de(),Vh(),Oe(),Yj(),Cd(),Zj(),It(),Qy(),kA(),PA(),Kj(),Qj(),Jj(),Ba(),tW(),vi(),Xi(),bie(),rW=({appState:e,elements:t,actionManager:n,setAppState:r,onLockToggle:i,onHandToolToggle:a,onPenModeToggle:o,renderTopRightUI:s,renderCustomStats:l,renderSidebars:c,device:d,renderWelcomeScreen:u,UIOptions:h,app:m,onHomeButtonClick:p})=>{let{WelcomeScreenCenterTunnel:f,MainMenuTunnel:g,DefaultSidebarTriggerTunnel:b}=br(),v=()=>(0,ct.jsxs)(IA,{side:"top",className:"App-top-bar",children:[u&&(0,ct.jsx)(f.Out,{}),(0,ct.jsx)(Fh,{heading:"shapes",children:w=>(0,ct.jsx)(gi.Col,{gap:4,align:"center",children:(0,ct.jsxs)(gi.Row,{gap:1,className:"App-toolbar-container",children:[(0,ct.jsxs)(Ra,{padding:1,className:"App-toolbar App-toolbar--mobile",children:[w,(0,ct.jsx)(gi.Row,{gap:1,children:(0,ct.jsx)(SA,{appState:e,activeTool:e.activeTool,UIOptions:h,app:m})})]}),s&&s(!0,e),(0,ct.jsxs)("div",{className:"mobile-misc-tools-container",children:[!e.viewModeEnabled&&(0,ct.jsx)(b.Out,{}),(0,ct.jsx)(DA,{checked:e.penMode,onChange:()=>o(null),title:x("toolBar.penMode"),isMobile:!0,penDetected:e.penDetected}),(0,ct.jsx)(AA,{checked:e.activeTool.locked,onChange:i,title:x("toolBar.lock"),isMobile:!0}),(0,ct.jsx)(LA,{checked:hd(e),onChange:()=>a(),title:x("toolBar.hand"),isMobile:!0})]}),(0,ct.jsx)("div",{className:"mobile-misc-tools-container-left",children:(0,ct.jsx)(nW,{onHomeButtonClick:p})})]})})}),(0,ct.jsx)(MA,{appState:e,isMobile:!0,device:d,app:m})]}),y=()=>e.viewModeEnabled?(0,ct.jsx)("div",{className:"App-toolbar-content",children:(0,ct.jsx)(g.Out,{})}):(0,ct.jsxs)("div",{className:"App-toolbar-content",children:[(0,ct.jsx)(g.Out,{}),n.renderAction("toggleEditMenu"),n.renderAction("undo"),n.renderAction("redo"),n.renderAction(e.multiElement?"finalize":"duplicateSelection"),n.renderAction("deleteSelectedElements")]});return(0,ct.jsxs)(ct.Fragment,{children:[c(),!e.viewModeEnabled&&v(),!e.openMenu&&e.showStats&&(0,ct.jsx)(_A,{appState:e,setAppState:r,elements:t,onClose:()=>{n.executeAction(Rh)},renderCustomStats:l}),(0,ct.jsx)("div",{className:"App-bottom-bar",style:{marginBottom:fs+ba*2,marginLeft:fs+ba*2,marginRight:fs+ba*2},children:(0,ct.jsxs)(Ra,{padding:0,children:[e.openMenu==="shape"&&!e.viewModeEnabled&&uy(e,t)?(0,ct.jsx)(Fh,{className:"App-mobile-menu",heading:"selectedShapeActions",children:(0,ct.jsx)(wA,{appState:e,elementsMap:m.scene.getNonDeletedElementsMap(),renderAction:n.renderAction})}):null,(0,ct.jsxs)("footer",{className:"App-toolbar",children:[y(),e.scrolledOutside&&!e.openMenu&&!e.openSidebar&&(0,ct.jsx)("button",{className:"scroll-back-to-content",onClick:()=>{r(w=>({...Ph(t,w)}))},children:x("buttons.scrollBackToContent")})]})]})})]})}}),vie=M(()=>{}),NS,iW,xie=M(()=>{"use strict";D(),xi(),hH(),ae(),de(),C1(),$e(),Ki(),vie(),NS=e=>{let t=(0,Xl.useRef)(null),[n,r]=(0,Xl.useState)(null);return(0,Xl.useLayoutEffect)(()=>{if(!e.spreadsheet)return;let i=uH(e.chartType,e.spreadsheet,0,0);r(i);let a,o=t.current;return(async()=>(a=await sy({data:{elements:i,appState:{exportBackground:!1,viewBackgroundColor:Ui},files:null}}),a.querySelector(".style-fonts")?.remove(),o.replaceChildren(),o.appendChild(a),e.selected&&o.parentNode.focus()))(),()=>{o.replaceChildren()}},[e.spreadsheet,e.chartType,e.selected]),(0,Sl.jsx)("button",{className:"ChartPreview",onClick:()=>{n&&e.onClick(e.chartType,n)},children:(0,Sl.jsx)("div",{ref:t})})},iW=({setAppState:e,appState:t,onClose:n})=>{let{onInsertElements:r}=ql(),i=Xl.default.useCallback(()=>{n&&n()},[n]),a=(o,s)=>{r(s),dt("paste","chart",o),e({currentChartType:o,pasteDialog:{shown:!1,data:null}})};return(0,Sl.jsx)(wi,{size:"small",onCloseRequest:i,title:x("labels.pasteCharts"),className:"PasteChartDialog",autofocus:!1,children:(0,Sl.jsxs)("div",{className:"container",children:[(0,Sl.jsx)(NS,{chartType:"bar",spreadsheet:t.pasteDialog.data,selected:t.currentChartType==="bar",onClick:a}),(0,Sl.jsx)(NS,{chartType:"line",spreadsheet:t.pasteDialog.data,selected:t.currentChartType==="line",onClick:a})]})})}}),wie=M(()=>{});function*Sie(e,t){let n=!0;for(let r of e)n||(yield t),n=!1,yield r}var D$,_$,C2,L$,ce,R$,oW,Cie=M(()=>{"use strict";D(),de(),ke(),Ki(),te(),wie(),pe(),vd(),ae(),Zh(),D$=()=>(0,ee.jsxs)("div",{className:"HelpDialog__header",children:[(0,ee.jsxs)("a",{className:"HelpDialog__btn",href:"https://docs.excalidraw.com",target:"_blank",rel:"noopener noreferrer",children:[(0,ee.jsx)("div",{className:"HelpDialog__link-icon",children:db}),x("helpDialog.documentation")]}),(0,ee.jsxs)("a",{className:"HelpDialog__btn",href:"https://blog.excalidraw.com",target:"_blank",rel:"noopener noreferrer",children:[(0,ee.jsx)("div",{className:"HelpDialog__link-icon",children:db}),x("helpDialog.blog")]}),(0,ee.jsxs)("a",{className:"HelpDialog__btn",href:"https://github.com/excalidraw/excalidraw/issues",target:"_blank",rel:"noopener noreferrer",children:[(0,ee.jsx)("div",{className:"HelpDialog__link-icon",children:fy}),x("helpDialog.github")]}),(0,ee.jsxs)("a",{className:"HelpDialog__btn",href:"https://youtube.com/@excalidraw",target:"_blank",rel:"noopener noreferrer",children:[(0,ee.jsx)("div",{className:"HelpDialog__link-icon",children:RM}),"YouTube"]})]}),_$=e=>(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsx)("h3",{children:e.title}),(0,ee.jsx)("div",{className:"HelpDialog__islands-container",children:e.children})]}),C2=e=>(0,ee.jsxs)("div",{className:`HelpDialog__island ${e.className}`,children:[(0,ee.jsx)("h4",{className:"HelpDialog__island-title",children:e.caption}),(0,ee.jsx)("div",{className:"HelpDialog__island-content",children:e.children})]}),L$=e=>e.replace(/\b[a-z]\b/,t=>t.toUpperCase()),ce=({label:e,shortcuts:t,isOr:n=!0})=>{let r=t.map(i=>(i.endsWith("++")?[...i.slice(0,-2).split("+"),"+"]:i.split("+")).map(a=>(0,ee.jsx)(R$,{children:L$(a)},a)));return(0,ee.jsxs)("div",{className:"HelpDialog__shortcut",children:[(0,ee.jsx)("div",{children:e}),(0,ee.jsx)("div",{className:"HelpDialog__key-container",children:[...Sie(r,n?x("helpDialog.or"):null)]})]})},R$=e=>(0,ee.jsx)("kbd",{className:"HelpDialog__key",...e}),oW=({onClose:e})=>{let t=aW.default.useCallback(()=>{e&&e()},[e]);return(0,ee.jsx)(ee.Fragment,{children:(0,ee.jsxs)(wi,{onCloseRequest:t,title:x("helpDialog.title"),className:"HelpDialog",children:[(0,ee.jsx)(D$,{}),(0,ee.jsxs)(_$,{title:x("helpDialog.shortcuts"),children:[(0,ee.jsxs)(C2,{className:"HelpDialog__island--tools",caption:x("helpDialog.tools"),children:[(0,ee.jsx)(ce,{label:x("toolBar.hand"),shortcuts:[N.H]}),(0,ee.jsx)(ce,{label:x("toolBar.selection"),shortcuts:[N.V,N[1]]}),(0,ee.jsx)(ce,{label:x("toolBar.rectangle"),shortcuts:[N.R,N[2]]}),(0,ee.jsx)(ce,{label:x("toolBar.diamond"),shortcuts:[N.D,N[3]]}),(0,ee.jsx)(ce,{label:x("toolBar.ellipse"),shortcuts:[N.O,N[4]]}),(0,ee.jsx)(ce,{label:x("toolBar.arrow"),shortcuts:[N.A,N[5]]}),(0,ee.jsx)(ce,{label:x("toolBar.line"),shortcuts:[N.L,N[6]]}),(0,ee.jsx)(ce,{label:x("toolBar.freedraw"),shortcuts:[N.P,N[7]]}),(0,ee.jsx)(ce,{label:x("toolBar.text"),shortcuts:[N.T,N[8]]}),(0,ee.jsx)(ce,{label:x("toolBar.image"),shortcuts:[N[9]]}),(0,ee.jsx)(ce,{label:x("toolBar.eraser"),shortcuts:[N.E,N[0]]}),(0,ee.jsx)(ce,{label:x("toolBar.frame"),shortcuts:[N.F]}),(0,ee.jsx)(ce,{label:x("toolBar.laser"),shortcuts:[N.K]}),(0,ee.jsx)(ce,{label:x("labels.eyeDropper"),shortcuts:[N.I,"Shift+S","Shift+G"]}),(0,ee.jsx)(ce,{label:x("helpDialog.editLineArrowPoints"),shortcuts:[K("CtrlOrCmd+Enter")]}),(0,ee.jsx)(ce,{label:x("helpDialog.editText"),shortcuts:[K("Enter")]}),(0,ee.jsx)(ce,{label:x("helpDialog.textNewLine"),shortcuts:[K("Enter"),K("Shift+Enter")]}),(0,ee.jsx)(ce,{label:x("helpDialog.textFinish"),shortcuts:[K("Esc"),K("CtrlOrCmd+Enter")]}),(0,ee.jsx)(ce,{label:x("helpDialog.curvedArrow"),shortcuts:["A",x("helpDialog.click"),x("helpDialog.click"),x("helpDialog.click")],isOr:!1}),(0,ee.jsx)(ce,{label:x("helpDialog.curvedLine"),shortcuts:["L",x("helpDialog.click"),x("helpDialog.click"),x("helpDialog.click")],isOr:!1}),(0,ee.jsx)(ce,{label:x("toolBar.lock"),shortcuts:[N.Q]}),(0,ee.jsx)(ce,{label:x("helpDialog.preventBinding"),shortcuts:[K("CtrlOrCmd")]}),(0,ee.jsx)(ce,{label:x("toolBar.link"),shortcuts:[K("CtrlOrCmd+K")]})]}),(0,ee.jsxs)(C2,{className:"HelpDialog__island--view",caption:x("helpDialog.view"),children:[(0,ee.jsx)(ce,{label:x("buttons.zoomIn"),shortcuts:[K("CtrlOrCmd++")]}),(0,ee.jsx)(ce,{label:x("buttons.zoomOut"),shortcuts:[K("CtrlOrCmd+-")]}),(0,ee.jsx)(ce,{label:x("buttons.resetZoom"),shortcuts:[K("CtrlOrCmd+0")]}),(0,ee.jsx)(ce,{label:x("helpDialog.zoomToFit"),shortcuts:["Shift+1"]}),(0,ee.jsx)(ce,{label:x("helpDialog.zoomToSelection"),shortcuts:["Shift+2"]}),(0,ee.jsx)(ce,{label:x("helpDialog.movePageUpDown"),shortcuts:["PgUp/PgDn"]}),(0,ee.jsx)(ce,{label:x("helpDialog.movePageLeftRight"),shortcuts:["Shift+PgUp/PgDn"]}),(0,ee.jsx)(ce,{label:x("buttons.zenMode"),shortcuts:[K("Alt+Z")]}),(0,ee.jsx)(ce,{label:x("buttons.objectsSnapMode"),shortcuts:[K("Alt+S")]}),(0,ee.jsx)(ce,{label:x("labels.toggleGrid"),shortcuts:[K("CtrlOrCmd+'")]}),(0,ee.jsx)(ce,{label:x("labels.viewMode"),shortcuts:[K("Alt+R")]}),(0,ee.jsx)(ce,{label:x("labels.toggleTheme"),shortcuts:[K("Alt+Shift+D")]}),(0,ee.jsx)(ce,{label:x("stats.title"),shortcuts:[K("Alt+/")]}),(0,ee.jsx)(ce,{label:x("commandPalette.title"),shortcuts:bh?[Dr("commandPalette")]:[Dr("commandPalette"),Dr("commandPalette",1)]})]}),(0,ee.jsxs)(C2,{className:"HelpDialog__island--editor",caption:x("helpDialog.editor"),children:[(0,ee.jsx)(ce,{label:x("labels.moveCanvas"),shortcuts:[K(`Space+${x("helpDialog.drag")}`),K(`Wheel+${x("helpDialog.drag")}`)],isOr:!0}),(0,ee.jsx)(ce,{label:x("buttons.clearReset"),shortcuts:[K("CtrlOrCmd+Delete")]}),(0,ee.jsx)(ce,{label:x("labels.delete"),shortcuts:[K("Delete")]}),(0,ee.jsx)(ce,{label:x("labels.cut"),shortcuts:[K("CtrlOrCmd+X")]}),(0,ee.jsx)(ce,{label:x("labels.copy"),shortcuts:[K("CtrlOrCmd+C")]}),(0,ee.jsx)(ce,{label:x("labels.paste"),shortcuts:[K("CtrlOrCmd+V")]}),(0,ee.jsx)(ce,{label:x("labels.pasteAsPlaintext"),shortcuts:[K("CtrlOrCmd+Shift+V")]}),(0,ee.jsx)(ce,{label:x("labels.selectAll"),shortcuts:[K("CtrlOrCmd+A")]}),(0,ee.jsx)(ce,{label:x("labels.multiSelect"),shortcuts:[K(`Shift+${x("helpDialog.click")}`)]}),(0,ee.jsx)(ce,{label:x("helpDialog.deepSelect"),shortcuts:[K(`CtrlOrCmd+${x("helpDialog.click")}`)]}),(0,ee.jsx)(ce,{label:x("helpDialog.deepBoxSelect"),shortcuts:[K(`CtrlOrCmd+${x("helpDialog.drag")}`)]}),(ly||bh)&&(0,ee.jsx)(ce,{label:x("labels.copyAsPng"),shortcuts:[K("Shift+Alt+C")]}),(0,ee.jsx)(ce,{label:x("labels.copyStyles"),shortcuts:[K("CtrlOrCmd+Alt+C")]}),(0,ee.jsx)(ce,{label:x("labels.pasteStyles"),shortcuts:[K("CtrlOrCmd+Alt+V")]}),(0,ee.jsx)(ce,{label:x("labels.sendToBack"),shortcuts:[K(Ia?"CtrlOrCmd+Alt+[":"CtrlOrCmd+Shift+[")]}),(0,ee.jsx)(ce,{label:x("labels.bringToFront"),shortcuts:[K(Ia?"CtrlOrCmd+Alt+]":"CtrlOrCmd+Shift+]")]}),(0,ee.jsx)(ce,{label:x("labels.sendBackward"),shortcuts:[K("CtrlOrCmd+[")]}),(0,ee.jsx)(ce,{label:x("labels.bringForward"),shortcuts:[K("CtrlOrCmd+]")]}),(0,ee.jsx)(ce,{label:x("labels.alignTop"),shortcuts:[K("CtrlOrCmd+Shift+Up")]}),(0,ee.jsx)(ce,{label:x("labels.alignBottom"),shortcuts:[K("CtrlOrCmd+Shift+Down")]}),(0,ee.jsx)(ce,{label:x("labels.alignLeft"),shortcuts:[K("CtrlOrCmd+Shift+Left")]}),(0,ee.jsx)(ce,{label:x("labels.alignRight"),shortcuts:[K("CtrlOrCmd+Shift+Right")]}),(0,ee.jsx)(ce,{label:x("labels.duplicateSelection"),shortcuts:[K("CtrlOrCmd+D"),K(`Alt+${x("helpDialog.drag")}`)]}),(0,ee.jsx)(ce,{label:x("helpDialog.toggleElementLock"),shortcuts:[K("CtrlOrCmd+Shift+L")]}),(0,ee.jsx)(ce,{label:x("buttons.undo"),shortcuts:[K("CtrlOrCmd+Z")]}),(0,ee.jsx)(ce,{label:x("buttons.redo"),shortcuts:VC?[K("CtrlOrCmd+Y"),K("CtrlOrCmd+Shift+Z")]:[K("CtrlOrCmd+Shift+Z")]}),(0,ee.jsx)(ce,{label:x("labels.group"),shortcuts:[K("CtrlOrCmd+G")]}),(0,ee.jsx)(ce,{label:x("labels.ungroup"),shortcuts:[K("CtrlOrCmd+Shift+G")]}),(0,ee.jsx)(ce,{label:x("labels.flipHorizontal"),shortcuts:[K("Shift+H")]}),(0,ee.jsx)(ce,{label:x("labels.flipVertical"),shortcuts:[K("Shift+V")]}),(0,ee.jsx)(ce,{label:x("labels.showStroke"),shortcuts:[K("S")]}),(0,ee.jsx)(ce,{label:x("labels.showBackground"),shortcuts:[K("G")]}),(0,ee.jsx)(ce,{label:x("labels.decreaseFontSize"),shortcuts:[K("CtrlOrCmd+Shift+<")]}),(0,ee.jsx)(ce,{label:x("labels.increaseFontSize"),shortcuts:[K("CtrlOrCmd+Shift+>")]})]})]})]})})}}),Tie=M(()=>{}),O$,N$,$$,T2,F$,RA,sW=M(()=>{"use strict";D(),Tie(),Sd(),$e(),Cd(),pe(),de(),te(),ae(),O$=4,N$=8,$$=({shouldWrap:e,children:t,username:n})=>e?(0,tr.jsx)(Gl,{label:n||"Unknown user",children:t}):(0,tr.jsx)(Cl.default.Fragment,{children:t}),T2=({actionManager:e,collaborator:t,socketId:n,withName:r=!1,shouldWrapWithTooltip:i=!1,isBeingFollowed:a})=>{let o={socketId:n,collaborator:t,withName:r,isBeingFollowed:a},s=e.renderAction("goToCollaborator",o);return(0,tr.jsx)($$,{username:t.username,shouldWrap:i,children:s},n)},F$=["avatarUrl","id","socketId","username","isInCall","isSpeaking","isMuted"],RA=Cl.default.memo(({className:e,mobile:t,collaborators:n,userToFollow:r})=>{let i=Vr(),a=new Map;n.forEach((p,f)=>{let g=p.id||f;a.set(g,{...p,socketId:f})});let o=Array.from(a.values()).filter(p=>p.username?.trim()),[s,l]=Cl.default.useState(""),c=Cl.default.useRef(null);(0,Cl.useLayoutEffect)(()=>{if(c.current){let p=g=>{let b=Math.max(1,Math.min(8,Math.floor(g/38)));u(b)};if(p(c.current.clientWidth),!TE)return;let f=new ResizeObserver(g=>{for(let b of g){let{width:v}=b.contentRect;p(v)}});return f.observe(c.current),()=>{f.disconnect()}}},[]);let[d,u]=Cl.default.useState(O$),h=s.trim().toLowerCase()?o.filter(p=>p.username?.toLowerCase().includes(s)):o,m=o.slice(0,d-1).map(p=>T2({actionManager:i,collaborator:p,socketId:p.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:p.socketId===r}));return t?(0,tr.jsx)("div",{className:X("UserList UserList_mobile",e),children:o.map(p=>T2({actionManager:i,collaborator:p,socketId:p.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:p.socketId===r}))}):(0,tr.jsx)("div",{className:"UserList-wrapper",ref:c,children:(0,tr.jsxs)("div",{className:X("UserList",e),style:{"--max-avatars":d},children:[m,o.length>d-1&&(0,tr.jsxs)(zg,{onOpenChange:p=>{p||l("")},children:[(0,tr.jsxs)(Hg,{className:"UserList__more",children:["+",o.length-d+1]}),(0,tr.jsx)(Ug,{style:{zIndex:2,width:"15rem",textAlign:"left"},align:"end",sideOffset:10,children:(0,tr.jsxs)(Ra,{style:{overflow:"hidden"},children:[o.length>=N$&&(0,tr.jsxs)("div",{className:"UserList__search-wrapper",children:[Sy,(0,tr.jsx)("input",{className:"UserList__search",type:"text",placeholder:x("userList.search.placeholder"),value:s,onChange:p=>{l(p.target.value)}})]}),(0,tr.jsxs)("div",{className:"dropdown-menu UserList__collaborators",children:[h.length===0&&(0,tr.jsx)("div",{className:"UserList__collaborators__empty",children:x("userList.search.empty")}),(0,tr.jsx)("div",{className:"UserList__hint",children:x("userList.hint.text")}),h.map(p=>T2({actionManager:i,collaborator:p,socketId:p.socketId,withName:!0,isBeingFollowed:p.socketId===r}))]})]})})]})]})})},(e,t)=>{if(e.collaborators.size!==t.collaborators.size||e.mobile!==t.mobile||e.className!==t.className||e.userToFollow!==t.userToFollow)return!1;let n=t.collaborators.keys();for(let[r,i]of e.collaborators){let a=t.collaborators.get(r);if(!a||r!==n.next().value||!Bn(i,a,F$))return!1}return!0})}),Iie=M(()=>{}),uC,Mie=M(()=>{"use strict";D(),Iie(),uC=({children:e,color:t})=>(0,lW.jsx)("div",{className:"Card",style:{"--card-color":t==="primary"?"var(--color-primary)":At[t][7],"--card-color-darker":t==="primary"?"var(--color-primary-darker)":At[t][8],"--card-color-darkest":t==="primary"?"var(--color-primary-darkest)":At[t][9]},children:e})}),Aie=M(()=>{}),B$,dW,kie=M(()=>{"use strict";D(),de(),Ki(),pe(),Gn(),Oy(),Mie(),Aie(),Wl(),xi(),te(),B$=({elements:e,appState:t,setAppState:n,files:r,actionManager:i,exportOpts:a,canvas:o,onCloseRequest:s})=>{let{onExportToBackend:l}=a;return(0,Nn.jsx)("div",{className:"ExportDialog ExportDialog--json",children:(0,Nn.jsxs)("div",{className:"ExportDialog-cards",children:[a.saveFileToDisk&&(0,Nn.jsxs)(uC,{color:"lime",children:[(0,Nn.jsx)("div",{className:"Card-icon",children:MI}),(0,Nn.jsx)("h2",{children:x("exportDialog.disk_title")}),(0,Nn.jsxs)("div",{className:"Card-details",children:[x("exportDialog.disk_details"),!da&&i.renderAction("changeProjectName")]}),(0,Nn.jsx)(Xe,{className:"Card-button",type:"button",title:x("exportDialog.disk_button"),"aria-label":x("exportDialog.disk_button"),showAriaLabel:!0,onClick:()=>{i.executeAction(Ry,"ui")}})]}),l&&(0,Nn.jsxs)(uC,{color:"pink",children:[(0,Nn.jsx)("div",{className:"Card-icon",children:Zf}),(0,Nn.jsx)("h2",{children:x("exportDialog.link_title")}),(0,Nn.jsx)("div",{className:"Card-details",children:x("exportDialog.link_details")}),(0,Nn.jsx)(Xe,{className:"Card-button",type:"button",title:x("exportDialog.link_button"),"aria-label":x("exportDialog.link_button"),showAriaLabel:!0,onClick:async()=>{try{dt("export","link",`ui (${TB()})`),await l(e,t,r),s()}catch(c){n({errorMessage:c.message})}}})]}),a.renderCustomUI&&a.renderCustomUI(e,t,r,o)]})})},dW=({elements:e,appState:t,files:n,actionManager:r,exportOpts:i,canvas:a,setAppState:o})=>{let s=cW.default.useCallback(()=>{o({openDialog:null})},[o]);return(0,Nn.jsx)(Nn.Fragment,{children:t.openDialog?.name==="jsonExport"&&(0,Nn.jsx)(wi,{onCloseRequest:s,title:x("buttons.export"),children:(0,Nn.jsx)(B$,{elements:e,appState:t,setAppState:o,files:n,actionManager:r,onCloseRequest:s,exportOpts:i,canvas:a})})})}}),hW,Pie=M(()=>{"use strict";D(),de(),pe(),hW=e=>(0,uW.jsx)("button",{className:"help-icon",onClick:e.onClick,type:"button",title:`${x("helpDialog.title")} \u2014 ?`,"aria-label":x("helpDialog.title"),children:M1})}),$S,mW,Die=M(()=>{"use strict";D(),Ba(),Qy(),$e(),Xi(),Pie(),kA(),Vh(),$S=({appState:e,actionManager:t,showExitZenModeBtn:n,renderWelcomeScreen:r})=>{let{FooterCenterTunnel:i,WelcomeScreenHelpHintTunnel:a}=br(),o=qn(),s=!e.viewModeEnabled&&e.multiElement&&o.isTouchScreen;return(0,Mr.jsxs)("footer",{role:"contentinfo",className:"layer-ui__wrapper__footer App-menu App-menu_bottom",children:[(0,Mr.jsx)("div",{className:X("layer-ui__wrapper__footer-left zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled}),children:(0,Mr.jsx)(gi.Col,{gap:2,children:(0,Mr.jsxs)(Fh,{heading:"canvasActions",children:[(0,Mr.jsx)(Tj,{renderAction:t.renderAction,zoom:e.zoom}),!e.viewModeEnabled&&(0,Mr.jsx)(Ij,{renderAction:t.renderAction,className:X("zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-bottom":e.zenModeEnabled})}),s&&(0,Mr.jsx)(Aj,{renderAction:t.renderAction,className:X("zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled})})]})})}),(0,Mr.jsx)(i.Out,{}),(0,Mr.jsx)("div",{className:X("layer-ui__wrapper__footer-right zen-mode-transition",{"transition-right":e.zenModeEnabled}),children:(0,Mr.jsxs)("div",{style:{position:"relative"},children:[r&&(0,Mr.jsx)(a.Out,{}),(0,Mr.jsx)(hW,{onClick:()=>t.executeAction(L1)})]})}),(0,Mr.jsx)(Mj,{actionManager:t,showExitZenModeBtn:n})]})},mW=$S,$S.displayName="Footer"}),OA,fW=M(()=>{"use strict";D(),OA=pW.default.createContext({})}),hC,_ie=M(()=>{"use strict";D(),de(),$e(),fW(),pe(),Sd(),O1(),hC=({children:e,className:t})=>{let n=qn(),r=(0,gW.useContext)(OA),i=!!(n.editor.canFitSidebar&&r.shouldRenderDockButton);return(0,ld.jsxs)("div",{className:X("sidebar__header",t),"data-testid":"sidebar-header",children:[e,(0,ld.jsxs)("div",{className:"sidebar__header__buttons",children:[i&&(0,ld.jsx)(Gl,{label:x("labels.sidebarLock"),children:(0,ld.jsx)($h,{onSelect:()=>r.onDock?.(!r.docked),selected:!!r.docked,className:"sidebar__dock","data-testid":"sidebar-dock","aria-label":x("labels.sidebarLock"),children:iI})}),(0,ld.jsx)($h,{"data-testid":"sidebar-close",className:"sidebar__close",onSelect:r.onCloseRequest,"aria-label":x("buttons.close"),children:Yl})]})]})},hC.displayName="SidebarHeader"}),Lie=M(()=>{}),mC,Rie=M(()=>{"use strict";D(),$e(),ir(),Lie(),mC=({name:e,tab:t,icon:n,title:r,children:i,onToggle:a,className:o,style:s})=>{let l=zn(),c=Un();return(0,cd.jsxs)("label",{title:r,className:"sidebar-trigger__label-element",children:[(0,cd.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",onChange:d=>{document.querySelector(".layer-ui__wrapper")?.classList.remove("animate");let u=d.target.checked;l({openSidebar:u?{name:e,tab:t}:null}),a?.(u)},checked:c.openSidebar?.name===e,"aria-label":r,"aria-keyshortcuts":"0"}),(0,cd.jsxs)("div",{className:X("sidebar-trigger",o),style:s,children:[n&&(0,cd.jsx)("div",{children:n}),i&&(0,cd.jsx)("div",{className:"sidebar-trigger__label",children:i})]})]})},mC.displayName="SidebarTrigger"}),pC,Oie=M(()=>{"use strict";D(),pC=({children:e,...t})=>(0,EW.jsx)(Yg,{className:"sidebar-triggers",...t,children:e}),pC.displayName="SidebarTabTriggers"}),gC,Nie=M(()=>{"use strict";D(),gC=({children:e,tab:t,onSelect:n,...r})=>(0,fC.jsx)(Zg,{value:t,asChild:!0,onSelect:n,children:(0,fC.jsx)("button",{type:"button",className:"excalidraw-button sidebar-tab-trigger",...r,children:e})}),gC.displayName="SidebarTabTrigger"}),EC,$ie=M(()=>{"use strict";D(),ir(),$e(),EC=({children:e,...t})=>{let n=Un(),r=zn();if(!n.openSidebar)return null;let{name:i}=n.openSidebar;return(0,bW.jsx)(Vg,{className:"sidebar-tabs-root",value:n.openSidebar.tab,onValueChange:a=>r(o=>({...o,openSidebar:{...o.openSidebar,name:i,tab:a}})),...t,children:e})},EC.displayName="SidebarTabs"}),bC,Fie=M(()=>{"use strict";D(),bC=({tab:e,children:t,...n})=>(0,yW.jsx)(Kg,{...n,value:e,"data-testid":e,children:t}),bC.displayName="SidebarTab"}),Bie=M(()=>{}),Hb,FS,bl,av=M(()=>{"use strict";D(),Cd(),Hn(),fW(),_ie(),$e(),te(),ke(),ae(),Rie(),Oie(),Nie(),$ie(),Fie(),ir(),WM(),Bie(),Hb=_t(!1),FS=(0,kn.forwardRef)(({name:e,children:t,onDock:n,docked:r,className:i,...a},o)=>{Ne.DEV&&n&&r==null&&console.warn("Sidebar: `docked` must be set when `onDock` is supplied for the sidebar to be user-dockable. To hide this message, either pass `docked` or remove `onDock`");let s=zn(),l=qo(Hb,Xn);(0,kn.useLayoutEffect)(()=>(l(!!r),()=>{l(!1)}),[l,r]);let c=(0,kn.useRef)({});c.current.onCloseRequest=()=>{s({openSidebar:null})},c.current.onDock=m=>n?.(m),c.current=sf(c.current,{docked:r,shouldRenderDockButton:!!n&&r!=null});let d=(0,kn.useRef)(null);(0,kn.useImperativeHandle)(o,()=>d.current);let u=qn(),h=(0,kn.useCallback)(()=>{document.querySelector(".Dialog")||s({openSidebar:null})},[s]);return jM(d,(0,kn.useCallback)(m=>{m.target.closest(".sidebar-trigger")||(!r||!u.editor.canFitSidebar)&&h()},[h,r,u.editor.canFitSidebar])),(0,kn.useEffect)(()=>{let m=p=>{p.key===N.ESCAPE&&(!r||!u.editor.canFitSidebar)&&h()};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[h,r,u.editor.canFitSidebar]),(0,yC.jsx)(Ra,{...a,className:X("sidebar",{"sidebar--docked":r},i),ref:d,children:(0,yC.jsx)(OA.Provider,{value:c.current,children:t})})}),FS.displayName="SidebarInner",bl=Object.assign((0,kn.forwardRef)((e,t)=>{let n=Un(),{onStateChange:r}=e,i=(0,kn.useRef)(n.openSidebar);(0,kn.useEffect)(()=>{(!n.openSidebar&&i?.current?.name===e.name||n.openSidebar?.name===e.name&&i?.current?.name!==e.name||i.current?.name===e.name)&&n.openSidebar!==i.current&&r?.(n.openSidebar?.name!==e.name?null:n.openSidebar),i.current=n.openSidebar},[n.openSidebar,r,e.name]);let[a,o]=(0,kn.useState)(!1);return(0,kn.useLayoutEffect)(()=>(o(!0),()=>o(!1)),[]),a&&n.openSidebar?.name===e.name?(0,vW.createElement)(FS,{...e,ref:t,key:e.name}):null}),{Header:hC,TabTriggers:pC,TabTrigger:gC,Tabs:EC,Tab:bC,Trigger:mC}),bl.displayName="Sidebar"});async function zie({title:e,description:t,actionLabel:n,color:r}){return new Promise(i=>{Pa.set(NA,{active:!0,onConfirm:()=>i(!0),onClose:()=>i(!1),onReject:()=>i(!1),title:e,description:t,actionLabel:n,color:r})})}var NA,xW=M(()=>{"use strict";D(),Hn(),NA=_t({active:!1})}),BS,wW,Hie=M(()=>{"use strict";D(),$e(),jj(),BS=({value:e,shortcut:t,onChange:n,choices:r,children:i,name:a})=>{let o=qn();return(0,Ps.jsxs)(Ps.Fragment,{children:[(0,Ps.jsxs)("div",{className:"dropdown-menu-item-base dropdown-menu-item-bare",children:[(0,Ps.jsx)("label",{className:"dropdown-menu-item__text",htmlFor:a,children:i}),(0,Ps.jsx)(TA,{name:a,value:e,onChange:n,choices:r})]}),t&&!o.editor.isMobile&&(0,Ps.jsx)("div",{className:"dropdown-menu-item__shortcut dropdown-menu-item__shortcut--orphaned",children:t})]})},BS.displayName="DropdownMenuItemContentRadio",wW=BS}),Uie=M(()=>{}),SW={};y1(SW,{ChangeCanvasBackground:()=>MC,ClearCanvas:()=>TC,CommandPalette:()=>SC,Export:()=>AC,Help:()=>CC,LiveCollaborationTrigger:()=>PC,LoadScene:()=>vC,SaveAsImage:()=>wC,SaveToActiveFile:()=>xC,Socials:()=>kC,ToggleTheme:()=>IC});var vC,xC,wC,SC,CC,TC,IC,MC,AC,kC,PC,Gie=M(()=>{"use strict";D(),Zh(),de(),$e(),pe(),pe(),ej(),aj(),Ba(),ev(),Hn(),ir(),xW(),R1(),Hie(),ae(),xi(),Uie(),vC=()=>{let{t:e}=hr(),t=Vr(),n=$1();return t.isActionEnabled(n1)?(0,Yt.jsx)(ga,{icon:A1,onSelect:async()=>{(!n.length||await zie({title:e("overwriteConfirm.modal.loadFromFile.title"),actionLabel:e("overwriteConfirm.modal.loadFromFile.button"),color:"warning",description:(0,Yt.jsx)(Aa,{i18nKey:"overwriteConfirm.modal.loadFromFile.description",bold:r=>(0,Yt.jsx)("strong",{children:r}),br:()=>(0,Yt.jsx)("br",{})})}))&&t.executeAction(n1)},"data-testid":"load-button",shortcut:Dr("loadScene"),"aria-label":e("buttons.load"),children:e("buttons.load")}):null},vC.displayName="LoadScene",xC=()=>{let{t:e}=hr(),t=Vr();return t.isActionEnabled(Rb)?(0,Yt.jsx)(ga,{shortcut:Dr("saveScene"),"data-testid":"save-button",onSelect:()=>t.executeAction(Rb),icon:CI,"aria-label":`${e("buttons.save")}`,children:`${e("buttons.save")}`}):null},xC.displayName="SaveToActiveFile",wC=()=>{let e=zn(),{t}=hr();return(0,Yt.jsx)(ga,{icon:gy,"data-testid":"image-export-button",onSelect:()=>e({openDialog:{name:"imageExport"}}),shortcut:Dr("imageExport"),"aria-label":t("buttons.exportImage"),children:t("buttons.exportImage")})},wC.displayName="SaveAsImage",SC=e=>{let t=zn(),{t:n}=hr();return(0,Yt.jsx)(ga,{icon:Cy,"data-testid":"command-palette-button",onSelect:()=>{dt("command_palette","open","menu"),t({openDialog:{name:"commandPalette"}})},shortcut:Dr("commandPalette"),"aria-label":n("commandPalette.title"),className:e?.className,children:n("commandPalette.title")})},SC.displayName="CommandPalette",CC=()=>{let{t:e}=hr(),t=Vr();return(0,Yt.jsx)(ga,{"data-testid":"help-menu-item",icon:M1,onSelect:()=>t.executeAction(L1),shortcut:"?","aria-label":e("helpDialog.title"),children:e("helpDialog.title")})},CC.displayName="Help",TC=()=>{let{t:e}=hr(),t=qo(s1,Xn);return Vr().isActionEnabled(ad)?(0,Yt.jsx)(ga,{icon:zl,onSelect:()=>t("clearCanvas"),"data-testid":"clear-canvas-button","aria-label":e("buttons.clearReset"),children:e("buttons.clearReset")}):null},TC.displayName="ClearCanvas",IC=e=>{let{t}=hr(),n=Un(),r=Vr(),i=Dr("toggleTheme");return r.isActionEnabled(Lh)?e?.allowSystemTheme?(0,Yt.jsx)(wW,{name:"theme",value:e.theme,onChange:a=>e.onSelect(a),choices:[{value:ze.LIGHT,label:Yf,ariaLabel:`${t("buttons.lightMode")} - ${i}`},{value:ze.DARK,label:Vf,ariaLabel:`${t("buttons.darkMode")} - ${i}`},{value:"system",label:LM,ariaLabel:t("buttons.systemMode")}],children:t("labels.theme")}):(0,Yt.jsx)(ga,{onSelect:a=>{if(a.preventDefault(),e?.onSelect)e.onSelect(n.theme===ze.DARK?ze.LIGHT:ze.DARK);else return r.executeAction(Lh)},icon:n.theme===ze.DARK?Yf:Vf,"data-testid":"toggle-dark-mode",shortcut:i,"aria-label":n.theme===ze.DARK?t("buttons.lightMode"):t("buttons.darkMode"),children:n.theme===ze.DARK?t("buttons.lightMode"):t("buttons.darkMode")}):null},IC.displayName="ToggleTheme",MC=()=>{let{t:e}=hr(),t=Un(),n=Vr(),r=N1();return t.viewModeEnabled||!r.UIOptions.canvasActions.changeViewBackgroundColor?null:(0,Yt.jsxs)("div",{style:{marginTop:"0.5rem"},children:[(0,Yt.jsx)("div",{"data-testid":"canvas-background-label",style:{fontSize:".75rem",marginBottom:".5rem"},children:e("labels.canvasBackground")}),(0,Yt.jsx)("div",{style:{padding:"0 0.625rem"},children:n.renderAction("changeViewBackgroundColor")})]})},MC.displayName="ChangeCanvasBackground",AC=()=>{let{t:e}=hr(),t=zn();return(0,Yt.jsx)(ga,{icon:_h,onSelect:()=>{t({openDialog:{name:"jsonExport"}})},"data-testid":"json-export-button","aria-label":e("buttons.export"),children:e("buttons.export")})},AC.displayName="Export",kC=()=>{let{t:e}=hr();return(0,Yt.jsxs)(Yt.Fragment,{children:[(0,Yt.jsx)(Cf,{icon:fy,href:"https://github.com/excalidraw/excalidraw","aria-label":"GitHub",children:"GitHub"}),(0,Yt.jsx)(Cf,{icon:wI,href:"https://x.com/excalidraw","aria-label":"X",children:e("labels.followUs")}),(0,Yt.jsx)(Cf,{icon:xI,href:"https://discord.gg/UexuTaE","aria-label":"Discord",children:e("labels.discordChat")})]})},kC.displayName="Socials",PC=({onSelect:e,isCollaborating:t})=>{let{t:n}=hr();return(0,Yt.jsx)(ga,{"data-testid":"collab-button",icon:Ey,className:X({"active-collab":t}),onSelect:e,children:n("labels.liveCollaboration")})},PC.displayName="LiveCollaborationTrigger"}),Bh,sv=M(()=>{"use strict";D(),Xi(),Bh=(e,t)=>{let n=_t(0),r=i=>{let{jotaiScope:a}=br(),[,o]=Ze(n,a),s=(0,ov.useRef)({preferHost:!1,counter:0});return(0,ov.useLayoutEffect)(()=>{let l=s.current;return o(c=>{let d=c+1;return l.counter=d,d}),()=>{o(c=>{let d=c-1;return l.counter=d,d||(l.preferHost=!1),d})}},[o]),i.__fallback||(s.current.preferHost=!0),!s.current.counter&&i.__fallback&&s.current.preferHost||s.current.counter>1&&i.__fallback?null:(0,CW.jsx)(t,{...i})};return r.displayName=e,r}}),z$,Gr,TW=M(()=>{"use strict";D(),$e(),Yy(),Gie(),sW(),de(),pe(),sv(),te(),Xi(),ir(),z$=Object.assign(Bh("MainMenu",({children:e,onSelect:t})=>{let{MainMenuTunnel:n}=br(),r=qn(),i=Un(),a=zn(),o=r.editor.isMobile?void 0:()=>a({openMenu:null});return(0,ws.jsx)(n.In,{children:(0,ws.jsxs)(Ct,{open:i.openMenu==="canvas",children:[(0,ws.jsx)(Ct.Trigger,{onToggle:()=>{a({openMenu:i.openMenu==="canvas"?null:"canvas"})},"data-testid":"main-menu-trigger",className:"main-menu-trigger",children:py}),(0,ws.jsxs)(Ct.Content,{onClickOutside:o,onSelect:x1(t,()=>{a({openMenu:null})}),children:[e,r.editor.isMobile&&i.collaborators.size>0&&(0,ws.jsxs)("fieldset",{className:"UserList-Wrapper",children:[(0,ws.jsx)("legend",{children:x("labels.collaborators")}),(0,ws.jsx)(RA,{mobile:!0,collaborators:i.collaborators,userToFollow:i.userToFollow?.socketId||null})]})]})]})})}),{Trigger:Ct.Trigger,Item:Ct.Item,ItemLink:Ct.ItemLink,ItemCustom:Ct.ItemCustom,Group:Ct.Group,Separator:Ct.Separator,DefaultItems:SW}),Gr=z$}),bE,H$,U$,DC,jie=M(()=>{"use strict";D(),iv(),$e(),Ba(),de(),Oy(),bE=({title:e,children:t,actionLabel:n,onClick:r})=>(0,cs.jsxs)("div",{className:"OverwriteConfirm__Actions__Action",children:[(0,cs.jsx)("h4",{children:e}),(0,cs.jsx)("div",{className:"OverwriteConfirm__Actions__Action__content",children:t}),(0,cs.jsx)(sd,{variant:"outlined",color:"muted",label:n,size:"large",fullWidth:!0,onClick:r})]}),H$=()=>{let{t:e}=hr(),t=Vr(),n=zn();return(0,cs.jsx)(bE,{title:e("overwriteConfirm.action.exportToImage.title"),actionLabel:e("overwriteConfirm.action.exportToImage.button"),onClick:()=>{t.executeAction(QM,"ui",!0),n({openDialog:{name:"imageExport"}})},children:e("overwriteConfirm.action.exportToImage.description")})},U$=()=>{let{t:e}=hr(),t=Vr();return(0,cs.jsx)(bE,{title:e("overwriteConfirm.action.saveToDisk.title"),actionLabel:e("overwriteConfirm.action.saveToDisk.button"),onClick:()=>{t.executeAction(Ry,"ui")},children:e("overwriteConfirm.action.saveToDisk.description")})},DC=Object.assign(({children:e})=>(0,cs.jsx)("div",{className:"OverwriteConfirm__Actions",children:e}),{ExportToImage:H$,SaveToDisk:U$})}),Wie=M(()=>{}),yE,Vie=M(()=>{"use strict";D(),Xi(),Hn(),Ki(),sv(),xW(),iv(),pe(),jie(),Wie(),yE=Object.assign(Bh("OverwriteConfirmDialog",({children:e})=>{let{OverwriteConfirmDialogTunnel:t}=br(),[n,r]=Ze(NA,Xn);if(!n.active)return null;let i=()=>{n.onClose(),r(o=>({...o,active:!1}))},a=()=>{n.onConfirm(),r(o=>({...o,active:!1}))};return(0,Fi.jsx)(t.In,{children:(0,Fi.jsx)(wi,{onCloseRequest:i,title:!1,size:916,children:(0,Fi.jsxs)("div",{className:"OverwriteConfirm",children:[(0,Fi.jsx)("h3",{children:n.title}),(0,Fi.jsxs)("div",{className:`OverwriteConfirm__Description OverwriteConfirm__Description--color-${n.color}`,children:[(0,Fi.jsx)("div",{className:"OverwriteConfirm__Description__icon",children:fM}),(0,Fi.jsx)("div",{children:n.description}),(0,Fi.jsx)("div",{className:"OverwriteConfirm__Description__spacer"}),(0,Fi.jsx)(sd,{color:n.color,size:"large",label:n.actionLabel,onClick:a})]}),(0,Fi.jsx)(DC,{children:e})]})})})}),{Actions:DC,Action:bE})}),zS,HS,_C,MW=M(()=>{"use strict";D(),ae(),Xi(),ir(),de(),te(),$e(),sv(),Xy(),av(),zS=Bh("DefaultSidebarTrigger",e=>{let{DefaultSidebarTriggerTunnel:t}=br();return(0,Bi.jsx)(t.In,{children:(0,Bi.jsx)(bl.Trigger,{...e,className:"default-sidebar-trigger",name:Ss.name})})}),zS.displayName="DefaultSidebarTrigger",HS=({children:e,...t})=>{let{DefaultSidebarTabTriggersTunnel:n}=br();return(0,Bi.jsx)(n.In,{children:(0,Bi.jsx)(bl.TabTriggers,{...t,children:e})})},HS.displayName="DefaultTabTriggers",_C=Object.assign(Bh("DefaultSidebar",({children:e,className:t,onDock:n,docked:r,...i})=>{let a=Un(),o=zn(),{DefaultSidebarTabTriggersTunnel:s}=br();return(0,IW.createElement)(bl,{...i,name:"default",key:"default",className:X("default-sidebar",t),docked:r??a.defaultSidebarDockedPreference,onDock:n===!1||!n&&r!=null?void 0:x1(n,l=>{o({defaultSidebarDockedPreference:l})})},(0,Bi.jsxs)(bl.Tabs,{children:[(0,Bi.jsxs)(bl.Header,{children:[i.__fallback&&(0,Bi.jsx)("div",{style:{color:"var(--color-primary)",fontSize:"1.2em",fontWeight:"bold",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",paddingRight:"1em"},children:x("toolBar.library")}),(0,Bi.jsx)(s.Out,{})]}),(0,Bi.jsx)(bl.Tab,{tab:DE,children:(0,Bi.jsx)(bj,{})}),e]}))}),{Trigger:zS,TabTriggers:HS})}),Yie=M(()=>{}),Zie=M(()=>{}),G$,AW,Kie=M(()=>{"use strict";D(),Vl(),pe(),G$="small",AW=e=>(0,u1.jsxs)("label",{className:X("ToolIcon ToolIcon__LaserPointer",`ToolIcon_size_${G$}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,u1.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":"toolbar-LaserPointer"}),(0,u1.jsx)("div",{className:"ToolIcon__icon",children:wy})]})}),Vu,Xie=M(()=>{"use strict";D(),Vu=e=>(0,kW.jsx)("p",{className:"excalidraw__paragraph",style:e.style,children:e.children})}),qie=M(()=>{}),US,$A,DW=M(()=>{"use strict";D(),$e(),te(),US=e=>{let t=zn(),n=(0,LC.useRef)(null),r=(0,LC.useRef)(0);return(0,PW.jsx)(Vg,{ref:n,className:"ttd-dialog-tabs-root",value:e.tab,onValueChange:i=>{if(!i)return;let a=n.current?.closest(".Modal__content");if(a){let o=a.offsetHeight||0;o>r.current&&(r.current=o,a.style.minHeight=`min(${r.current}px, 100%)`)}e.dialog==="settings"&&LE(["text-to-diagram","diagram-to-code"],i)?t({openDialog:{name:e.dialog,tab:i,source:"settings"}}):e.dialog==="ttd"&&LE(["text-to-diagram","mermaid"],i)&&t({openDialog:{name:e.dialog,tab:i}})},children:e.children})},US.displayName="TTDDialogTabs",$A=US}),h1,LW=M(()=>{"use strict";D(),h1=({tab:e,children:t,...n})=>(0,_W.jsx)(Kg,{...n,value:e,children:t}),h1.displayName="TTDDialogTab"}),RW,Qie=M(()=>{"use strict";D(),Ki(),vj(),pe(),iv(),KM(),ke(),ir(),vA(),Xie(),qie(),DW(),LW(),RW=e=>{let[t,n]=(0,RC.useState)(e.openAIKey||""),[r,i]=(0,RC.useState)(e.isPersisted),a=Un(),o=()=>{e.onConfirm(t.trim(),r)};return a.openDialog?.name!=="settings"?null:(0,bn.jsx)(wi,{onCloseRequest:()=>{e.onClose(),e.onConfirm(t.trim(),r)},title:(0,bn.jsxs)("div",{style:{display:"flex"},children:["Wireframe to Code (AI)"," ",(0,bn.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"0.1rem 0.5rem",marginLeft:"1rem",fontSize:14,borderRadius:"12px",color:"#000",background:"pink"},children:"Experimental"})]}),className:"MagicSettings",autofocus:!1,children:(0,bn.jsx)($A,{dialog:"settings",tab:a.openDialog.tab,children:(0,bn.jsxs)(h1,{tab:"diagram-to-code",children:[(0,bn.jsxs)(Vu,{children:["For the diagram-to-code feature we use"," ",(0,bn.jsx)(fh,{icon:Kf}),"OpenAI."]}),(0,bn.jsxs)(Vu,{children:["While the OpenAI API is in beta, its use is strictly limited \u2014 as such we require you use your own API key. You can create an"," ",(0,bn.jsx)("a",{href:"https://platform.openai.com/login?launch",rel:"noopener noreferrer",target:"_blank",children:"OpenAI account"}),", add a small credit (5 USD minimum), and"," ",(0,bn.jsx)("a",{href:"https://platform.openai.com/api-keys",rel:"noopener noreferrer",target:"_blank",children:"generate your own API key"}),"."]}),(0,bn.jsx)(Vu,{children:"Your OpenAI key does not leave the browser, and you can also set your own limit in your OpenAI account dashboard if needed."}),(0,bn.jsx)(yA,{isRedacted:!0,value:t,placeholder:"Paste your API key here",label:"OpenAI API key",onChange:s=>{n(s),e.onChange(s.trim(),r)},selectOnRender:!0,onKeyDown:s=>s.key===N.ENTER&&o()}),(0,bn.jsx)(Vu,{children:"By default, your API token is not persisted anywhere so you'll need to insert it again after reload. But, you can persist locally in your browser below."}),(0,bn.jsx)(t1,{checked:r,onChange:i,children:"Persist API key in browser storage"}),(0,bn.jsxs)(Vu,{children:["Once API key is set, you can use the ",(0,bn.jsx)(fh,{icon:k1})," ","tool to wrap your elements in a frame that will then allow you to turn it into code. This dialog can be accessed using the"," ",(0,bn.jsx)("b",{children:"AI Settings"})," ",(0,bn.jsx)(fh,{icon:Kf}),"."]}),(0,bn.jsx)(sd,{className:"MagicSettings__confirm",size:"large",label:"Confirm",onClick:o})]})})})}}),Jie=M(()=>{}),j$,FA,Ub,BA,OW=M(()=>{"use strict";D(),ae(),YA(),yi(),Uy(),de(),j$=({canvasRef:e,setError:t})=>{let n=e.current;if(!n)return;let r=n.parentElement;r&&(r.style.background="",t(null),n.replaceChildren())},FA=async({canvasRef:e,mermaidToExcalidrawLib:t,mermaidDefinition:n,setError:r,data:i})=>{let a=e.current,o=a?.parentElement;if(!(!a||!o)){if(!n){j$({canvasRef:e,setError:r});return}try{let s=await t.api,l;try{l=await s.parseMermaidToExcalidraw(n,{fontSize:Vi})}catch{l=await s.parseMermaidToExcalidraw(n.replace(/"/g,"'"),{fontSize:Vi})}let{elements:c,files:d}=l;r(null),i.current={elements:jA(c,{regenerateIds:!0}),files:d};let u=await Hf({data:{elements:i.current.elements,files:i.current.files},config:{padding:Hh,maxWidthOrHeight:Math.max(o.offsetWidth,o.offsetHeight)*window.devicePixelRatio}});try{await Ih(u)}catch(h){throw h.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(x("canvasError.canvasTooBig")):h}o.style.background="var(--default-bg-color)",a.replaceChildren(u)}catch(s){throw o.style.background="var(--default-bg-color)",n&&r(s),s}}},Ub=e=>{ks.set(Cs.MERMAID_TO_EXCALIDRAW,e)},BA=({app:e,data:t,text:n,shouldSaveMermaidDataToStorage:r})=>{let{elements:i,files:a}=t.current;i.length&&(e.addElementsFromPasteOrLibrary({elements:i,files:a,position:"center",fitToContent:!0}),e.setOpenDialog(null),r&&n&&Ub(n))}}),zA,$W=M(()=>{"use strict";D(),zA=({children:e})=>(0,NW.jsx)("div",{className:"ttd-dialog-panels",children:e})}),m1,FW=M(()=>{"use strict";D(),O1(),jl(),m1=({label:e,children:t,panelAction:n,panelActionDisabled:r=!1,onTextSubmitInProgess:i,renderTopRight:a,renderSubmitShortcut:o,renderBottomRight:s})=>(0,yo.jsxs)("div",{className:"ttd-dialog-panel",children:[(0,yo.jsxs)("div",{className:"ttd-dialog-panel__header",children:[(0,yo.jsx)("label",{children:e}),a?.()]}),t,(0,yo.jsxs)("div",{className:X("ttd-dialog-panel-button-container",{invisible:!n}),style:{display:"flex",alignItems:"center"},children:[(0,yo.jsxs)($h,{className:"ttd-dialog-panel-button",onSelect:n?n.action:()=>{},disabled:r||i,children:[(0,yo.jsxs)("div",{className:X({invisible:i}),children:[n?.label,n?.icon&&(0,yo.jsx)("span",{children:n.icon})]}),i&&(0,yo.jsx)(Co,{})]}),!r&&!i&&o?.(),s?.()]})]})}),HA,zW=M(()=>{"use strict";D(),ae(),ke(),HA=({input:e,placeholder:t,onChange:n,onKeyboardSubmit:r})=>{let i=(0,p1.useRef)(null),a=(0,p1.useRef)(r);return a.current=r,(0,p1.useEffect)(()=>{if(!a.current)return;let o=i.current;if(o){let s=l=>{l[N.CTRL_OR_CMD]&&l.key===N.ENTER&&(l.preventDefault(),a.current?.())};return o.addEventListener("keydown",s),()=>{o.removeEventListener("keydown",s)}}},[]),(0,BW.jsx)("textarea",{className:"ttd-dialog-input",onChange:n,value:e,placeholder:t,autoFocus:!0,ref:i})}}),W$,UA,HW=M(()=>{"use strict";D(),jl(),W$=({error:e})=>(0,Pl.jsxs)("div",{"data-testid":"ttd-dialog-output-error",className:"ttd-dialog-output-error",children:["Error! ",(0,Pl.jsx)("p",{children:e})]}),UA=({error:e,canvasRef:t,loaded:n})=>(0,Pl.jsxs)("div",{className:"ttd-dialog-output-wrapper",children:[e&&(0,Pl.jsx)(W$,{error:e.message}),n?(0,Pl.jsx)("div",{ref:t,style:{opacity:e?"0.15":1},className:"ttd-dialog-output-canvas-container"}):(0,Pl.jsx)(Co,{size:"2rem"})]})}),GA,UW=M(()=>{"use strict";D(),te(),GA=()=>(0,f1.jsxs)("div",{className:"ttd-dialog-submit-shortcut",children:[(0,f1.jsx)("div",{className:"ttd-dialog-submit-shortcut__key",children:K("CtrlOrCmd")}),(0,f1.jsx)("div",{className:"ttd-dialog-submit-shortcut__key",children:K("Enter")})]})}),V$,GS,Y$,GW,eae=M(()=>{"use strict";D(),$e(),pe(),Jie(),de(),R1(),OW(),$W(),FW(),zW(),HW(),Uy(),ae(),te(),UW(),V$=`flowchart TD
178
+ A[Christmas] -->|Get money| B(Go shopping)
179
+ B --> C{Let me think}
180
+ C -->|One| D[Laptop]
181
+ C -->|Two| E[iPhone]
182
+ C -->|Three| F[Car]`,GS=Pf(Ub,300),Y$=({mermaidToExcalidrawLib:e})=>{let[t,n]=(0,Na.useState)(()=>ks.get(Cs.MERMAID_TO_EXCALIDRAW)||V$),r=(0,Na.useDeferredValue)(t.trim()),[i,a]=(0,Na.useState)(null),o=(0,Na.useRef)(null),s=(0,Na.useRef)({elements:[],files:null}),l=ql();(0,Na.useEffect)(()=>{FA({canvasRef:o,data:s,mermaidToExcalidrawLib:e,setError:a,mermaidDefinition:r}).catch(d=>{CB()&&console.error("Failed to parse mermaid definition",d)}),GS(r)},[r,e]),(0,Na.useEffect)(()=>()=>{GS.flush()},[]);let c=()=>{BA({app:l,data:s,text:t,shouldSaveMermaidDataToStorage:!0})};return(0,pr.jsxs)(pr.Fragment,{children:[(0,pr.jsx)("div",{className:"ttd-dialog-desc",children:(0,pr.jsx)(Aa,{i18nKey:"mermaid.description",flowchartLink:d=>(0,pr.jsx)("a",{href:"https://mermaid.js.org/syntax/flowchart.html",children:d}),sequenceLink:d=>(0,pr.jsx)("a",{href:"https://mermaid.js.org/syntax/sequenceDiagram.html",children:d}),classLink:d=>(0,pr.jsx)("a",{href:"https://mermaid.js.org/syntax/classDiagram.html",children:d})})}),(0,pr.jsxs)(zA,{children:[(0,pr.jsx)(m1,{label:x("mermaid.syntax"),children:(0,pr.jsx)(HA,{input:t,placeholder:"Write Mermaid diagram defintion here...",onChange:d=>n(d.target.value),onKeyboardSubmit:()=>{c()}})}),(0,pr.jsx)(m1,{label:x("mermaid.preview"),panelAction:{action:()=>{c()},label:x("mermaid.button"),icon:sh},renderSubmitShortcut:()=>(0,pr.jsx)(GA,{}),children:(0,pr.jsx)(UA,{canvasRef:o,loaded:e.loaded,error:i})})]})]})},GW=Y$}),OC,tae=M(()=>{"use strict";D(),OC=({children:e,...t})=>(0,jW.jsx)(Yg,{className:"ttd-dialog-triggers",...t,children:e}),OC.displayName="TTDDialogTabTriggers"}),Gb,nae=M(()=>{"use strict";D(),Gb=({children:e,tab:t,onSelect:n,...r})=>(0,NC.jsx)(Zg,{value:t,asChild:!0,onSelect:n,children:(0,NC.jsx)("button",{type:"button",className:"ttd-dialog-tab-trigger",...r,children:e})}),Gb.displayName="TTDDialogTabTrigger"}),rae=M(()=>{}),I2,_c,Z$,K$,WW,X$,VW=M(()=>{"use strict";D(),Ki(),$e(),eae(),DW(),ir(),sv(),tae(),nae(),LW(),de(),zW(),HW(),FW(),$W(),OW(),pe(),rae(),te(),xi(),vA(),UW(),I2=3,_c=1e3,Z$=_t(null),K$=_t(null),WW=e=>{let t=Un();return t.openDialog?.name!=="ttd"?null:(0,jt.jsx)(X$,{...e,tab:t.openDialog.tab})},X$=Bh("TTDDialogBase",({tab:e,...t})=>{let n=ql(),r=zn(),i=(0,ka.useRef)(null),[a,o]=Ze(K$),[s,l]=(0,ka.useState)(a?.prompt??""),c=s.trim(),d=A=>{l(A.target.value),o(T=>({generatedResponse:T?.generatedResponse??null,prompt:A.target.value}))},[u,h]=(0,ka.useState)(!1),[m,p]=Ze(Z$),f=async()=>{if(c.length>_c||c.length<I2||u||m?.rateLimitRemaining===0||"__fallback"in t){c.length<I2&&C(new Error(`Prompt is too short (min ${I2} characters)`)),c.length>_c&&C(new Error(`Prompt is too long (max ${_c} characters)`));return}try{h(!0),dt("ai","generate","ttd");let{generatedResponse:A,error:T,rateLimit:I,rateLimitRemaining:k}=await t.onTextSubmit(c);if(typeof A=="string"&&o(R=>({generatedResponse:A,prompt:R?.prompt??null})),C5(I)&&C5(k)&&p({rateLimit:I,rateLimitRemaining:k}),T){C(T);return}if(!A){C(new Error("Generation failed"));return}try{await FA({canvasRef:i,data:y,mermaidToExcalidrawLib:b,setError:C,mermaidDefinition:A}),dt("ai","mermaid parse success","ttd")}catch(R){console.info(`%cTTD mermaid render errror: ${R.message}`,"color: red"),console.info(`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
183
+ TTD mermaid definition render errror: ${R.message}`,"color: yellow"),dt("ai","mermaid parse failed","ttd"),C(new Error("Generated an invalid diagram :(. You may also try a different prompt."))}}catch(A){let T=A.message;(!T||T==="Failed to fetch")&&(T="Request failed"),C(new Error(T))}finally{h(!1)}},g=(0,ka.useRef)(f);g.current=f;let[b,v]=(0,ka.useState)({loaded:!1,api:import("./dist-LI3DBBWR.js")});(0,ka.useEffect)(()=>{(async()=>(await b.api,v(A=>({...A,loaded:!0}))))()},[b.api]);let y=(0,ka.useRef)({elements:[],files:null}),[w,C]=(0,ka.useState)(null);return(0,jt.jsx)(wi,{className:"ttd-dialog",onCloseRequest:()=>{n.setOpenDialog(null)},size:1200,title:!1,...t,autofocus:!1,children:(0,jt.jsxs)($A,{dialog:"ttd",tab:e,children:["__fallback"in t&&t.__fallback?(0,jt.jsx)("p",{className:"dialog-mermaid-title",children:x("mermaid.title")}):(0,jt.jsxs)(OC,{children:[(0,jt.jsx)(Gb,{tab:"text-to-diagram",children:(0,jt.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[x("labels.textToDiagram"),(0,jt.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"1px 6px",marginLeft:"10px",fontSize:10,borderRadius:"12px",background:"pink",color:"#000"},children:"AI Beta"})]})}),(0,jt.jsx)(Gb,{tab:"mermaid",children:"Mermaid"})]}),(0,jt.jsx)(h1,{className:"ttd-dialog-content",tab:"mermaid",children:(0,jt.jsx)(GW,{mermaidToExcalidrawLib:b})}),!("__fallback"in t)&&(0,jt.jsxs)(h1,{className:"ttd-dialog-content",tab:"text-to-diagram",children:[(0,jt.jsx)("div",{className:"ttd-dialog-desc",children:"Currently we use Mermaid as a middle step, so you'll get best results if you describe a diagram, workflow, flow chart, and similar."}),(0,jt.jsxs)(zA,{children:[(0,jt.jsx)(m1,{label:x("labels.prompt"),panelAction:{action:f,label:"Generate",icon:sh},onTextSubmitInProgess:u,panelActionDisabled:c.length>_c||m?.rateLimitRemaining===0,renderTopRight:()=>m?(0,jt.jsxs)("div",{className:"ttd-dialog-rate-limit",style:{fontSize:12,marginLeft:"auto",color:m.rateLimitRemaining===0?"var(--color-danger)":void 0},children:[m.rateLimitRemaining," requests left today"]}):null,renderSubmitShortcut:()=>(0,jt.jsx)(GA,{}),renderBottomRight:()=>{if(typeof a?.generatedResponse=="string")return(0,jt.jsxs)("div",{className:"excalidraw-link",style:{marginLeft:"auto",fontSize:14},onClick:()=>{typeof a?.generatedResponse=="string"&&(Ub(a.generatedResponse),r({openDialog:{name:"ttd",tab:"mermaid"}}))},children:["View as Mermaid",(0,jt.jsx)(fh,{icon:sh})]});let A=c.length/_c;return A>.8?(0,jt.jsxs)("div",{style:{marginLeft:"auto",fontSize:12,fontFamily:"monospace",color:A>1?"var(--color-danger)":void 0},children:["Length: ",c.length,"/",_c]}):null},children:(0,jt.jsx)(HA,{onChange:d,input:s,placeholder:"Describe what you want to see...",onKeyboardSubmit:()=>{g.current()}})}),(0,jt.jsx)(m1,{label:"Preview",panelAction:{action:()=>{console.info("Panel action clicked"),BA({app:n,data:y})},label:"Insert",icon:sh},children:(0,jt.jsx)(UA,{canvasRef:i,error:w,loaded:b.loaded})})]})]})]})})})}),q$,Q$,J$,jS,eF,ZW,iae=M(()=>{"use strict";D(),ae(),Oe(),de(),It(),te(),Qy(),sie(),mie(),Yj(),Zj(),Cd(),hB(),Kj(),yie(),xie(),kA(),Cie(),Vh(),sW(),kie(),Qj(),xi(),$e(),Jj(),MG(),Die(),av(),Hn(),TW(),ev(),Vie(),tW(),vi(),Xi(),pe(),ir(),MW(),_y(),Yie(),Zie(),vt(),Ls(),yd(),Kie(),Qie(),VW(),q$=({UIOptions:e})=>(0,le.jsxs)(Gr,{__fallback:!0,children:[(0,le.jsx)(Gr.DefaultItems.LoadScene,{}),(0,le.jsx)(Gr.DefaultItems.SaveToActiveFile,{}),e.canvasActions.export&&(0,le.jsx)(Gr.DefaultItems.Export,{}),e.canvasActions.saveAsImage&&(0,le.jsx)(Gr.DefaultItems.SaveAsImage,{}),(0,le.jsx)(Gr.DefaultItems.Help,{}),(0,le.jsx)(Gr.DefaultItems.ClearCanvas,{}),(0,le.jsx)(Gr.Separator,{}),(0,le.jsx)(Gr.Group,{title:"Excalidraw links",children:(0,le.jsx)(Gr.DefaultItems.Socials,{})}),(0,le.jsx)(Gr.Separator,{}),(0,le.jsx)(Gr.DefaultItems.ToggleTheme,{}),(0,le.jsx)(Gr.DefaultItems.ChangeCanvasBackground,{})]}),Q$=()=>(0,le.jsxs)(yE,{__fallback:!0,children:[(0,le.jsx)(yE.Actions.SaveToDisk,{}),(0,le.jsx)(yE.Actions.ExportToImage,{})]}),J$=({actionManager:e,appState:t,files:n,setAppState:r,elements:i,canvas:a,onLockToggle:o,onHandToolToggle:s,onPenModeToggle:l,showExitZenModeBtn:c,renderTopRightUI:d,renderCustomStats:u,UIOptions:h,onExportImage:m,renderWelcomeScreen:p,onHomeButtonClick:f,children:g,app:b,isCollaborating:v,openAIKey:y,isOpenAIKeyPersisted:w,onOpenAIAPIKeyChange:C,onMagicSettingsConfirm:A,uiDisabled:T})=>{let I=qn(),k=Sj(),[R,O]=Ze(_1,Xn),P=()=>h.canvasActions.export?(0,le.jsx)(dW,{elements:i,appState:t,files:n,actionManager:e,exportOpts:h.canvasActions.export,canvas:a,setAppState:r}):null,F=()=>!h.canvasActions.saveAsImage||t.openDialog?.name!=="imageExport"?null:(0,le.jsx)(Wj,{elements:i,appState:t,files:n,actionManager:e,onExportImage:m,onCloseRequest:()=>r({openDialog:null}),name:b.getName()}),Y=()=>(0,le.jsxs)("div",{style:{position:"relative"},children:[(0,le.jsx)(k.MainMenuTunnel.Out,{}),p&&(0,le.jsx)(k.WelcomeScreenMenuHintTunnel.Out,{})]}),j=()=>(0,le.jsx)(Fh,{heading:"selectedShapeActions",className:X("selected-shape-actions zen-mode-transition",{"transition-left":t.zenModeEnabled}),children:(0,le.jsx)(Ra,{className:ZC.SHAPE_ACTIONS_MENU,padding:2,style:{maxHeight:`${t.height-166}px`},children:(0,le.jsx)(wA,{appState:t,elementsMap:b.scene.getNonDeletedElementsMap(),renderAction:e.renderAction})})}),q=()=>{let $=uy(t,i);return(0,le.jsx)(IA,{side:"top",children:(0,le.jsxs)("div",{className:"App-menu App-menu_top",children:[(0,le.jsxs)(gi.Col,{gap:6,className:X("App-menu_top__left"),children:[Y(),$&&j()]}),!t.viewModeEnabled&&(0,le.jsx)(Fh,{heading:"shapes",className:"shapes-section",children:B=>(0,le.jsxs)("div",{style:{position:"relative"},children:[p&&(0,le.jsx)(k.WelcomeScreenToolbarHintTunnel.Out,{}),(0,le.jsx)(gi.Col,{gap:4,align:"start",children:(0,le.jsxs)(gi.Row,{gap:1,className:X("App-toolbar-container",{"zen-mode":t.zenModeEnabled}),children:[(0,le.jsxs)(Ra,{padding:1,className:X("App-toolbar",{"zen-mode":t.zenModeEnabled}),children:[(0,le.jsx)(MA,{appState:t,isMobile:I.editor.isMobile,device:I,app:b}),B,(0,le.jsxs)(gi.Row,{gap:1,children:[(0,le.jsx)(DA,{zenModeEnabled:t.zenModeEnabled,checked:t.penMode,onChange:()=>l(null),title:x("toolBar.penMode"),penDetected:t.penDetected}),(0,le.jsx)(AA,{checked:t.activeTool.locked,onChange:o,title:x("toolBar.lock")}),(0,le.jsx)("div",{className:"App-toolbar__divider"}),(0,le.jsx)(LA,{checked:hd(t),onChange:()=>s(),title:x("toolBar.hand"),isMobile:!0}),(0,le.jsx)(SA,{appState:t,activeTool:t.activeTool,UIOptions:h,app:b})]})]}),v&&(0,le.jsx)(Ra,{style:{marginLeft:8,alignSelf:"center",height:"fit-content"},children:(0,le.jsx)(AW,{title:x("toolBar.laser"),checked:t.activeTool.type===$n.laser,onChange:()=>b.setActiveTool({type:$n.laser}),isMobile:!0})})]})})]})}),(0,le.jsxs)("div",{className:X("layer-ui__wrapper__top-right zen-mode-transition",{"transition-right":t.zenModeEnabled}),children:[t.collaborators.size>0&&(0,le.jsx)(RA,{collaborators:t.collaborators,userToFollow:t.userToFollow?.socketId||null}),d?.(I.editor.isMobile,t),!t.viewModeEnabled&&(!H||t.openSidebar?.name!==Ss.name)&&(0,le.jsx)(k.DefaultSidebarTriggerTunnel.Out,{})]})]})})},ne=()=>(0,le.jsx)(_C,{__fallback:!0,onDock:$=>{dt("sidebar",`toggleDock (${$?"dock":"undock"})`,`(${I.editor.isMobile?"mobile":"desktop"})`)}}),H=ip(Hb,Xn);if(T)return null;let V=(0,le.jsxs)(le.Fragment,{children:[g,(0,le.jsx)(q$,{UIOptions:h}),(0,le.jsx)(_C.Trigger,{__fallback:!0,icon:my,title:nd(x("toolBar.library")),onToggle:$=>{$&&dt("sidebar",`${Ss.name} (open)`,`button (${I.editor.isMobile?"mobile":"desktop"})`)},tab:Ss.defaultTab,children:x("toolBar.library")}),(0,le.jsx)(Q$,{}),t.openDialog?.name==="ttd"&&(0,le.jsx)(WW,{__fallback:!0}),t.isLoading&&(0,le.jsx)(QC,{delay:250}),t.errorMessage&&(0,le.jsx)(Gj,{onClose:()=>r({errorMessage:null}),children:t.errorMessage}),R&&!I.editor.isMobile&&(0,le.jsx)(_U,{colorPickerType:R.colorPickerType,onCancel:()=>{O(null)},onChange:($,B,G,{altKey:U})=>{if(!($!=="elementBackground"&&$!=="elementStroke"))if(G.length){for(let Q of G)ie(Q,{[U&&R.swapPreviewOnAlt?$==="elementBackground"?"strokeColor":"backgroundColor":$==="elementBackground"?"backgroundColor":"strokeColor"]:B},!1),Xt.delete(Q);_r.getScene(G[0])?.informMutation()}else r($==="elementBackground"?{currentItemBackgroundColor:B}:{currentItemStrokeColor:B})},onSelect:($,B)=>{O(G=>G?.keepOpenOnAlt&&B.altKey?G:null),R?.onSelect?.($,B)}}),t.openDialog?.name==="help"&&(0,le.jsx)(oW,{onClose:()=>{r({openDialog:null})}}),t.openDialog?.name==="settings"&&(0,le.jsx)(RW,{openAIKey:y,isPersisted:w,onChange:C,onConfirm:($,B)=>{let G=t.openDialog?.name==="settings"?t.openDialog?.source:"settings";r({openDialog:null},()=>{A($,B,G)})},onClose:()=>{r({openDialog:null})}}),(0,le.jsx)(Pj,{}),(0,le.jsx)(k.OverwriteConfirmDialogTunnel.Out,{}),F(),P(),t.pasteDialog.shown&&(0,le.jsx)(iW,{setAppState:r,appState:t,onClose:()=>r({pasteDialog:{shown:!1,data:null}})}),I.editor.isMobile&&(0,le.jsx)(rW,{app:b,onHomeButtonClick:f,appState:t,elements:i,actionManager:e,renderJSONExportDialog:P,renderImageExportDialog:F,setAppState:r,onLockToggle:o,onHandToolToggle:s,onPenModeToggle:l,renderTopRightUI:d,renderCustomStats:u,renderSidebars:ne,device:I,renderWelcomeScreen:p,UIOptions:h}),!I.editor.isMobile&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)("div",{className:"layer-ui__wrapper",style:t.openSidebar&&H&&I.editor.canFitSidebar?{width:`calc(100% - ${oB}px)`}:{},children:[p&&(0,le.jsx)(k.WelcomeScreenCenterTunnel.Out,{}),q(),(0,le.jsx)(mW,{appState:t,actionManager:e,showExitZenModeBtn:c,renderWelcomeScreen:p}),t.showStats&&(0,le.jsx)(_A,{appState:t,setAppState:r,elements:i,onClose:()=>{e.executeAction(Rh)},renderCustomStats:u}),t.scrolledOutside&&(0,le.jsx)("button",{className:"scroll-back-to-content",onClick:()=>{r($=>({...Ph(i,$)}))},children:x("buttons.scrollBackToContent")})]}),ne()]})]});return(0,le.jsx)(_4.Provider,{value:t,children:(0,le.jsx)(bg,{scope:k.jotaiScope,children:(0,le.jsx)(q4.Provider,{value:k,children:V})})})},jS=e=>{let{suggestedBindings:t,startBoundElement:n,cursorButton:r,scrollX:i,scrollY:a,...o}=e;return o},eF=(e,t)=>{if(e.children!==t.children)return!1;let{canvas:n,appState:r,...i}=e,{canvas:a,appState:o,...s}=t;return Bn(jS(r),jS(o),{selectedElementIds:Bn,selectedGroupIds:Bn})&&Bn(i,s)},ZW=YW.default.memo(J$,eF)}),aae=M(()=>{}),tF,KW,oae=M(()=>{"use strict";D(),pe(),aae(),Gn(),tF=5e3,KW=({message:e,onClose:t,closable:n=!1,duration:r=tF,style:i})=>{let a=(0,Kh.useRef)(0),o=r!==1/0,s=(0,Kh.useCallback)(()=>{o&&(a.current=window.setTimeout(()=>t(),r))},[t,r,o]);return(0,Kh.useEffect)(()=>{if(o)return s(),()=>clearTimeout(a.current)},[s,e,r,o]),(0,g1.jsxs)("div",{className:"Toast",onMouseEnter:o?()=>clearTimeout(a?.current):void 0,onMouseLeave:o?s:void 0,style:i,children:[(0,g1.jsx)("p",{className:"Toast__message",children:e}),n&&(0,g1.jsx)(Xe,{icon:Yl,"aria-label":"close",type:"icon",onClick:t,className:"close"})]})}}),$C,sae=M(()=>{"use strict";D(),pe(),ke(),ht(),Tt(),$C=oe({name:"viewMode",label:"labels.viewMode",paletteName:"Toggle view mode",icon:P1,viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.viewModeEnabled},perform(e,t){return{appState:{...t,viewModeEnabled:!this.checked(t)},storeAction:Z.NONE}},checked:e=>e.viewModeEnabled,predicate:(e,t,n)=>typeof n.viewModeEnabled>"u",keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===rt.R})}),XW,lae=M(()=>{"use strict";D(),Oe(),vt(),qt(),Se(),te(),Ls(),XW=class FC{scene;onSceneUpdated;constructor({scene:t,onSceneUpdated:n}){this.scene=t,this.onSceneUpdated=n}static loadedFontFaces=new Set;onFontsLoaded=t=>{if(t.every(r=>{let i=`${r.family}-${r.style}-${r.weight}`;return FC.loadedFontFaces.has(i)?!0:(FC.loadedFontFaces.add(i),!1)}))return!1;let n=!1;this.scene.mapElements(r=>he(r)&&!tn(r)?(Xt.delete(r),n=!0,Re(r,{...WE(r,Er(r,this.scene.getNonDeletedElementsMap()),this.scene.getNonDeletedElementsMap())})):r),n&&this.onSceneUpdated()};loadFontsForElements=async t=>{let n=await Promise.all([...new Set(t.filter(r=>he(r)).map(r=>r.fontFamily))].map(r=>{let i=An({fontFamily:r,fontSize:16});if(!document.fonts?.check?.(i))return document.fonts?.load?.(i)}));this.onFontsLoaded(n.flat().filter(Boolean))}}}),WS,qW,QW,cae,dae,uae=M(()=>{"use strict";D(),Oe(),Lr(),Lr(),ke(),te(),S1(),Tt(),Se(),pe(),ht(),WS=(e,t)=>{let n=t.scene.getSelectedElements(e);return n.length===1&&Ae(n[0])},qW=oe({name:"selectAllElementsInFrame",label:"labels.selectAllElementsInFrame",trackEvent:{category:"canvas"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t).at(0)||null;if(Ae(i)){let a=vo(ut(e),i.id).filter(o=>!(o.type==="text"&&o.containerId));return{elements:e,appState:{...t,selectedElementIds:a.reduce((o,s)=>(o[s.id]=!0,o),{})},storeAction:Z.CAPTURE}}return{elements:e,appState:t,storeAction:Z.NONE}},predicate:(e,t,n,r)=>WS(t,r)}),QW=oe({name:"removeAllElementsFromFrame",label:"labels.removeAllElementsFromFrame",trackEvent:{category:"history"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t).at(0)||null;return Ae(i)?{elements:y4(e,i),appState:{...t,selectedElementIds:{[i.id]:!0}},storeAction:Z.CAPTURE}:{elements:e,appState:t,storeAction:Z.NONE}},predicate:(e,t,n,r)=>WS(t,r)}),cae=oe({name:"updateFrameRendering",label:"labels.updateFrameRendering",viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t)=>({elements:e,appState:{...t,frameRendering:{...t.frameRendering,enabled:!t.frameRendering.enabled}},storeAction:Z.NONE}),checked:e=>e.frameRendering.enabled}),dae=oe({name:"setFrameAsActiveTool",label:"toolBar.frame",trackEvent:{category:"toolbar"},icon:vy,viewMode:!1,perform:(e,t,n,r)=>{let i=hn(t,{type:"frame"});return Ea(r.interactiveCanvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:hn(t,{type:"frame"})},storeAction:Z.NONE}},keyTest:e=>!e[N.CTRL_OR_CMD]&&!e.shiftKey&&!e.altKey&&e.key.toLocaleLowerCase()===N.F})}),nF,VS,Op,Eo,os,rF,_u,YS,JW,ZS,eV,Lc,tV,Ut,KS,M2,iF,aF,nV,rV,iV,aV,hae=M(()=>{"use strict";D(),ae(),Qt(),Se(),Kr(),ke(),rr(),xd(),nF=8,VS=99999,Op=e=>nF/e,Eo=class Hc{static referenceSnapPoints=null;static visibleGaps=null;static setReferenceSnapPoints=t=>{Hc.referenceSnapPoints=t};static getReferenceSnapPoints=()=>Hc.referenceSnapPoints;static setVisibleGaps=t=>{Hc.visibleGaps=t};static getVisibleGaps=()=>Hc.visibleGaps;static destroy=()=>{Hc.referenceSnapPoints=null,Hc.visibleGaps=null}},os=({event:e,appState:t,selectedElements:n})=>e?t.objectsSnapModeEnabled&&!e[N.CTRL_OR_CMD]||!t.objectsSnapModeEnabled&&e[N.CTRL_OR_CMD]&&t.gridSize===null:n.length===1&&n[0].type==="arrow"?!1:t.objectsSnapModeEnabled,rF=(e,t,n=.01)=>Math.abs(e-t)<=n,_u=(e,t,{omitCenter:n,boundingBoxCorners:r,dragOffset:i}={omitCenter:!1,boundingBoxCorners:!1})=>{let a=[];if(e.length===1){let o=e[0],[s,l,c,d,u,h]=De(o,t);i&&(s+=i.x,c+=i.x,u+=i.x,l+=i.y,d+=i.y,h+=i.y);let m=(c-s)/2,p=(d-l)/2;if((o.type==="diamond"||o.type==="ellipse")&&!r){let f=Rt([s,l+p],[u,h],o.angle),g=Rt([s+m,l],[u,h],o.angle),b=Rt([c,l+p],[u,h],o.angle),v=Rt([s+m,d],[u,h],o.angle);a=n?[f,g,b,v]:[f,g,b,v,[u,h]]}else{let f=Rt([s,l],[u,h],o.angle),g=Rt([c,l],[u,h],o.angle),b=Rt([s,d],[u,h],o.angle),v=Rt([c,d],[u,h],o.angle);a=n?[f,g,b,v]:[f,g,b,v,[u,h]]}}else if(e.length>1){let[o,s,l,c]=iE(e,i??{x:0,y:0}),d=l-o,u=c-s,h=[o,s],m=[l,s],p=[o,c],f=[l,c],g=[o+d/2,s+u/2];a=n?[h,m,p,f]:[h,m,p,f,g]}return a.map(o=>[Ut(o[0]),Ut(o[1])])},YS=(e,t,n,r)=>{let i=t.filter(a=>Ae(a)).map(a=>a.id);return A4(e,t,n,r).filter(a=>!(a.frameId&&i.includes(a.frameId)))},JW=(e,t,n,r)=>{let i=YS(e,t,n,r),a=Nf(i,r).filter(u=>!(u.length===1&&tn(u[0]))).map(u=>Bt(u).map(h=>Ut(h))),o=a.sort((u,h)=>u[0]-h[0]),s=[],l=0;e:for(let u=0;u<o.length;u++){let h=o[u];for(let m=u+1;m<o.length;m++){if(++l>VS)break e;let p=o[m],[,f,g,b]=h,[v,y,,w]=p;g<v&&Gp([f,b],[y,w])&&s.push({startBounds:h,endBounds:p,startSide:[[g,f],[g,b]],endSide:[[v,y],[v,w]],length:v-g,overlap:jp([f,b],[y,w])})}}let c=a.sort((u,h)=>u[1]-h[1]),d=[];l=0;e:for(let u=0;u<c.length;u++){let h=c[u];for(let m=u+1;m<c.length;m++){if(++l>VS)break e;let p=c[m],[f,,g,b]=h,[v,y,w]=p;b<y&&Gp([f,g],[v,w])&&d.push({startBounds:h,endBounds:p,startSide:[[f,b],[g,b]],endSide:[[v,y],[w,y]],length:y-b,overlap:jp([f,g],[v,w])})}}return{horizontalGaps:s,verticalGaps:d}},ZS=(e,t,n,r,i,a,o)=>{if(!os({appState:n,event:r,selectedElements:e}))return[];if(e.length===0)return[];let s=Eo.getVisibleGaps();if(s){let{horizontalGaps:l,verticalGaps:c}=s,[d,u,h,m]=iE(e,t).map(g=>Ut(g)),p=(d+h)/2,f=(u+m)/2;for(let g of l){if(!Gp([u,m],g.overlap))continue;let b=g.startSide[0][0]+g.length/2,v=Ut(b-p);if(g.length>h-d&&Math.abs(v)<=o.x){Math.abs(v)<o.x&&(i.length=0),o.x=Math.abs(v);let k={type:"gap",direction:"center_horizontal",gap:g,offset:v};i.push(k);continue}let[,,y]=g.endBounds,w=d-y,C=Ut(g.length-w);if(Math.abs(C)<=o.x){Math.abs(C)<o.x&&(i.length=0),o.x=Math.abs(C);let k={type:"gap",direction:"side_right",gap:g,offset:C};i.push(k);continue}let[A,,,]=g.startBounds,T=A-h,I=Ut(T-g.length);if(Math.abs(I)<=o.x){Math.abs(I)<o.x&&(i.length=0),o.x=Math.abs(I);let k={type:"gap",direction:"side_left",gap:g,offset:I};i.push(k);continue}}for(let g of c){if(!Gp([d,h],g.overlap))continue;let b=g.startSide[0][1]+g.length/2,v=Ut(b-f);if(g.length>m-u&&Math.abs(v)<=o.y){Math.abs(v)<o.y&&(a.length=0),o.y=Math.abs(v);let k={type:"gap",direction:"center_vertical",gap:g,offset:v};a.push(k);continue}let[,y,,]=g.startBounds,w=y-m,C=Ut(w-g.length);if(Math.abs(C)<=o.y){Math.abs(C)<o.y&&(a.length=0),o.y=Math.abs(C);let k={type:"gap",direction:"side_top",gap:g,offset:C};a.push(k);continue}let[,,,A]=g.endBounds,T=Ut(u-A),I=g.length-T;if(Math.abs(I)<=o.y){Math.abs(I)<o.y&&(a.length=0),o.y=Math.abs(I);let k={type:"gap",direction:"side_bottom",gap:g,offset:I};a.push(k);continue}}}},eV=(e,t,n,r)=>{let i=YS(e,t,n,r);return Nf(i,r).filter(a=>!(a.length===1&&tn(a[0]))).flatMap(a=>_u(a,r))},Lc=(e,t,n,r,i,a,o)=>{if(!os({appState:n,event:r,selectedElements:e})||e.length===0&&t.length===0)return[];let s=Eo.getReferenceSnapPoints();if(s)for(let l of t)for(let c of s){let d=c[0]-l[0],u=c[1]-l[1];Math.abs(d)<=o.x&&(Math.abs(d)<o.x&&(i.length=0),i.push({type:"point",points:[l,c],offset:d}),o.x=Math.abs(d)),Math.abs(u)<=o.y&&(Math.abs(u)<o.y&&(a.length=0),a.push({type:"point",points:[l,c],offset:u}),o.y=Math.abs(u))}},tV=(e,t,n,r,i)=>{let a=bt(e,n);if(!os({appState:n,event:r,selectedElements:a})||a.length===0)return{snapOffset:{x:0,y:0},snapLines:[]};t.x=Ut(t.x),t.y=Ut(t.y);let o=[],s=[],l=Op(n.zoom.value),c={x:l,y:l},d=_u(a,i,{dragOffset:t});Lc(a,d,n,r,o,s,c),ZS(a,t,n,r,o,s,c);let u={x:o[0]?.offset??0,y:s[0]?.offset??0};c.x=0,c.y=0,o.length=0,s.length=0;let h={x:Ut(t.x+u.x),y:Ut(t.y+u.y)};Lc(a,_u(a,i,{dragOffset:h}),n,r,o,s,c),ZS(a,h,n,r,o,s,c);let m=M2(o,s),p=aF(a,h,[...o,...s].filter(f=>f.type==="gap"));return{snapOffset:u,snapLines:[...m,...p]}},Ut=e=>Math.round(e*10**6)/10**6,KS=e=>{let t=new Map;for(let n of e){let r=n.join(",");t.has(r)||t.set(r,n)}return Array.from(t.values())},M2=(e,t)=>{let n={},r={};if(e.length>0){for(let i of e)if(i.type==="point"){let a=Ut(i.points[0][0]);n[a]||(n[a]=[]),n[a].push(...i.points.map(o=>[Ut(o[0]),Ut(o[1])]))}}if(t.length>0){for(let i of t)if(i.type==="point"){let a=Ut(i.points[0][1]);r[a]||(r[a]=[]),r[a].push(...i.points.map(o=>[Ut(o[0]),Ut(o[1])]))}}return Object.entries(n).map(([i,a])=>({type:"points",points:KS(a.map(o=>[Number(i),o[1]]).sort((o,s)=>o[1]-s[1]))})).concat(Object.entries(r).map(([i,a])=>({type:"points",points:KS(a.map(o=>[o[0],Number(i)]).sort((o,s)=>o[0]-s[0]))})))},iF=e=>{let t=new Map;for(let n of e){let r=n.points.flat().map(i=>[Ut(i)]).join(",");t.has(r)||t.set(r,n)}return Array.from(t.values())},aF=(e,t,n)=>{let[r,i,a,o]=iE(e,t),s=[];for(let l of n){let[c,d,u,h]=l.gap.startBounds,[m,p,f,g]=l.gap.endBounds,b=jp([i,o],l.gap.overlap),v=jp([r,a],l.gap.overlap);switch(l.direction){case"center_horizontal":{if(b){let y=(b[0]+b[1])/2;s.push({type:"gap",direction:"horizontal",points:[[l.gap.startSide[0][0],y],[r,y]]},{type:"gap",direction:"horizontal",points:[[a,y],[l.gap.endSide[0][0],y]]})}break}case"center_vertical":{if(v){let y=(v[0]+v[1])/2;s.push({type:"gap",direction:"vertical",points:[[y,l.gap.startSide[0][1]],[y,i]]},{type:"gap",direction:"vertical",points:[[y,o],[y,l.gap.endSide[0][1]]]})}break}case"side_right":{if(b){let y=(b[0]+b[1])/2;s.push({type:"gap",direction:"horizontal",points:[[u,y],[m,y]]},{type:"gap",direction:"horizontal",points:[[f,y],[r,y]]})}break}case"side_left":{if(b){let y=(b[0]+b[1])/2;s.push({type:"gap",direction:"horizontal",points:[[a,y],[c,y]]},{type:"gap",direction:"horizontal",points:[[u,y],[m,y]]})}break}case"side_top":{if(v){let y=(v[0]+v[1])/2;s.push({type:"gap",direction:"vertical",points:[[y,o],[y,d]]},{type:"gap",direction:"vertical",points:[[y,h],[y,p]]})}break}case"side_bottom":{if(v){let y=(v[0]+v[1])/2;s.push({type:"gap",direction:"vertical",points:[[y,h],[y,p]]},{type:"gap",direction:"vertical",points:[[y,g],[y,i]]})}break}}}return iF(s.map(l=>({...l,points:l.points.map(c=>[Ut(c[0]),Ut(c[1])])})))},nV=(e,t,n,r,i,a)=>{if(!os({event:r,selectedElements:e,appState:n})||e.length===0||e.length===1&&!rF(e[0].angle,0))return{snapOffset:{x:0,y:0},snapLines:[]};let[o,s,l,c]=Bt(t);a&&(a.includes("e")?l+=i.x:a.includes("w")&&(o+=i.x),a.includes("n")?s+=i.y:a.includes("s")&&(c+=i.y));let d=[];if(a)switch(a){case"e":{d.push([l,s],[l,c]);break}case"w":{d.push([o,s],[o,c]);break}case"n":{d.push([o,s],[l,s]);break}case"s":{d.push([o,c],[l,c]);break}case"ne":{d.push([l,s]);break}case"nw":{d.push([o,s]);break}case"se":{d.push([l,c]);break}case"sw":{d.push([o,c]);break}}let u=Op(n.zoom.value),h={x:u,y:u},m=[],p=[];Lc(t,d,n,r,m,p,h);let f={x:m[0]?.offset??0,y:p[0]?.offset??0};h.x=0,h.y=0,m.length=0,p.length=0;let[g,b,v,y]=Bt(e).map(C=>Ut(C));Lc(e,[[g,b],[g,y],[v,b],[v,y]],n,r,m,p,h);let w=M2(m,p);return{snapOffset:f,snapLines:w}},rV=(e,t,n,r,i,a)=>{if(!os({event:n,selectedElements:[e],appState:t}))return{snapOffset:{x:0,y:0},snapLines:[]};let o=[[r.x+i.x,r.y+i.y]],s=Op(t.zoom.value),l={x:s,y:s},c=[],d=[];Lc([e],o,t,n,c,d,l);let u={x:c[0]?.offset??0,y:d[0]?.offset??0};l.x=0,l.y=0,c.length=0,d.length=0;let h=_u([e],a,{boundingBoxCorners:!0,omitCenter:!0});Lc([e],h,t,n,c,d,l);let m=M2(c,d);return{snapOffset:u,snapLines:m}},iV=(e,t,n,r,i)=>{if(!os({event:r,selectedElements:[],appState:t}))return{originOffset:{x:0,y:0},snapLines:[]};let a=A4(e,[],t,i),o=Op(t.zoom.value),s={x:o,y:o},l=[],c=[];for(let d of a){let u=_u([d],i);for(let h of u){let m=h[0]-n.x;Math.abs(m)<=Math.abs(s.x)&&(Math.abs(m)<Math.abs(s.x)&&(c.length=0),c.push({type:"pointer",points:[h,[h[0],n.y]],direction:"vertical"}),s.x=m);let p=h[1]-n.y;Math.abs(p)<=Math.abs(s.y)&&(Math.abs(p)<Math.abs(s.y)&&(l.length=0),l.push({type:"pointer",points:[h,[n.x,h[1]]],direction:"horizontal"}),s.y=p)}}return{originOffset:{x:c.length>0?c[0].points[0][0]-n.x:0,y:l.length>0?l[0].points[0][1]-n.y:0},snapLines:[...c,...l]}},aV=e=>e===$n.rectangle||e===$n.ellipse||e===$n.diamond||e===$n.frame||e===$n.magicframe||e===$n.image}),oF,oV,mae=M(()=>{"use strict";D(),R1(),oF=()=>(0,ur.jsxs)("div",{"data-testid":"brave-measure-text-error",children:[(0,ur.jsx)("p",{children:(0,ur.jsx)(Aa,{i18nKey:"errors.brave_measure_text_error.line1",bold:e=>(0,ur.jsx)("span",{style:{fontWeight:600},children:e})})}),(0,ur.jsx)("p",{children:(0,ur.jsx)(Aa,{i18nKey:"errors.brave_measure_text_error.line2",bold:e=>(0,ur.jsx)("span",{style:{fontWeight:600},children:e})})}),(0,ur.jsx)("p",{children:(0,ur.jsx)(Aa,{i18nKey:"errors.brave_measure_text_error.line3",link:e=>(0,ur.jsx)("a",{href:"http://docs.excalidraw.com/docs/@excalidraw/excalidraw/faq#turning-off-aggresive-block-fingerprinting-in-brave-browser",children:e})})}),(0,ur.jsx)("p",{children:(0,ur.jsx)(Aa,{i18nKey:"errors.brave_measure_text_error.line4",issueLink:e=>(0,ur.jsx)("a",{href:"https://github.com/excalidraw/excalidraw/issues/new",children:e}),discordLink:e=>(0,ur.jsxs)("a",{href:"https://discord.gg/UexuTaE",children:[e,"."]})})})]}),oV=oF}),Np,is,sF,XS,lF,jA,sV=M(()=>{"use strict";D(),ae(),Oe(),Fa(),_s(),qt(),te(),Jb(),Ao(),$a(),Np={width:100,height:0},is=100,sF=(e,t,n)=>{let r=fi({x:0,y:0,textAlign:vh.CENTER,verticalAlign:Yr.MIDDLE,...t,containerId:e.id,strokeColor:t.strokeColor||e.strokeColor});return Object.assign(e,{boundElements:(e.boundElements||[]).concat({type:"text",id:r.id})}),ji(r,e,n),[e,r]},XS=(e,t,n,r,i)=>{let a,o;if(Object.assign(e,{startBinding:e?.startBinding||null,endBinding:e.endBinding||null}),t){let d=t?.width??is,u=t?.height??is,h;t.id&&(h=r.getElement(t.id),h||console.error(`No element for start binding with id ${t.id} found`));let m=t.x||e.x-d,p=t.y||e.y-u/2,f=h?h.type:t.type;if(f){if(f==="text"){let g="";h&&h.type==="text"?g=h.text:t.type==="text"&&(g=t.text),g||console.error(`No text found for start binding text element for ${e.id}`),a=fi({x:m,y:p,type:"text",...h,...t,text:g}),Object.assign(a,{x:t.x||e.x-a.width,y:t.y||e.y-a.height/2})}else switch(f){case"rectangle":case"ellipse":case"diamond":{a=As({x:m,y:p,width:d,height:u,...h,...t,type:f});break}default:_l(e,`Unhandled element start type "${t.type}"`,!0)}Xu(e,a,"start",i)}}if(n){let d=n?.height??is,u=n?.width??is,h;n.id&&(h=r.getElement(n.id),h||console.error(`No element for end binding with id ${n.id} found`));let m=n.x||e.x+e.width,p=n.y||e.y-d/2,f=h?h.type:n.type;if(f){if(f==="text"){let g="";h&&h.type==="text"?g=h.text:n.type==="text"&&(g=n.text),g||console.error(`No text found for end binding text element for ${e.id}`),o=fi({x:m,y:p,type:"text",...h,...n,text:g}),Object.assign(o,{y:n.y||e.y-o.height/2})}else switch(f){case"rectangle":case"ellipse":case"diamond":{o=As({x:m,y:p,width:u,height:d,...h,...n,type:f});break}default:_l(e,`Unhandled element end type "${f}"`,!0)}Xu(e,o,"end",i)}}if(e.points.length<2)return{linearElement:e,startBoundElement:a,endBoundElement:o};let s=e.points.length-1,l=.5,c=ud(e.points);return e.points[s][0]>e.points[s-1][0]&&(c[0][0]=l,c[s][0]-=l),e.points[s][0]<e.points[s-1][0]&&(c[0][0]=-l,c[s][0]+=l),e.points[s][1]>e.points[s-1][1]&&(c[0][1]=l,c[s][1]-=l),e.points[s][1]<e.points[s-1][1]&&(c[0][1]=-l,c[s][1]+=l),Object.assign(e,{points:c}),{linearElement:e,startBoundElement:a,endBoundElement:o}},lF=class{excalidrawElements=new Map;add=e=>{e&&this.excalidrawElements.set(e.id,e)};getElements=()=>wo(Array.from(this.excalidrawElements.values()));getElementsMap=()=>Ts(ve(this.getElements()));getElement=e=>this.excalidrawElements.get(e)},jA=(e,t)=>{if(!e)return[];let n=ud(e),r=new lF,i=new Map,a=new Map;for(let s of n){let l,c=s.id;switch(t?.regenerateIds!==!1&&Object.assign(s,{id:pi()}),s.type){case"rectangle":case"ellipse":case"diamond":{let d=s?.label?.text&&s.width===void 0?0:s?.width||is,u=s?.label?.text&&s.height===void 0?0:s?.height||is;l=As({...s,width:d,height:u});break}case"line":{let d=s.width||Np.width,u=s.height||Np.height;l=hs({width:d,height:u,points:[[0,0],[d,u]],...s});break}case"arrow":{let d=s.width||Np.width,u=s.height||Np.height;l=hs({width:d,height:u,endArrowhead:"arrow",points:[[0,0],[d,u]],...s}),Object.assign(l,oT(l.points));break}case"text":{let d=s?.fontFamily||To,u=s?.fontSize||Vi,h=s?.lineHeight||Fl(d),m=s.text??"",p=Sh(m),f=ys(p,An({fontFamily:d,fontSize:u}),h);l=fi({width:f.width,height:f.height,fontFamily:d,fontSize:u,...s});break}case"image":{l=TT({width:s?.width||is,height:s?.height||is,...s});break}case"frame":{l=CT({x:0,y:0,...s});break}case"magicframe":{l=jE({x:0,y:0,...s});break}case"freedraw":case"iframe":case"embeddable":{l=s;break}default:l=s,_l(s,`Unhandled element type "${s.type}"`,!0)}r.getElement(l.id)?console.error(`Duplicate id found for ${l.id}`):(r.add(l),i.set(l.id,s),c&&a.set(c,l.id))}let o=r.getElementsMap();for(let[s,l]of i){let c=r.getElement(s);switch(l.type){case"rectangle":case"ellipse":case"diamond":case"arrow":{if(l.label?.text){let[d,u]=sF(c,l?.label,o);if(r.add(d),r.add(u),d.type==="arrow"){let h=l.type==="arrow"?l?.start:void 0,m=l.type==="arrow"?l?.end:void 0;if(h&&h.id){let b=a.get(h.id);b&&Object.assign(h,{id:b})}if(m&&m.id){let b=a.get(m.id);b&&Object.assign(m,{id:b})}let{linearElement:p,startBoundElement:f,endBoundElement:g}=XS(d,h,m,r,o);d=p,r.add(p),r.add(f),r.add(g)}}else switch(l.type){case"arrow":{let{start:d,end:u}=l;if(d&&d.id){let f=a.get(d.id);Object.assign(d,{id:f})}if(u&&u.id){let f=a.get(u.id);Object.assign(u,{id:f})}let{linearElement:h,startBoundElement:m,endBoundElement:p}=XS(c,d,u,r,o);r.add(h),r.add(m),r.add(p);break}}break}}}for(let[s,l]of i){if(l.type!=="frame"&&l.type!=="magicframe")continue;let c=r.getElement(s);if(!c)throw new Error(`Excalidraw element with id ${s} doesn't exist`);let d=[];l.children.forEach(v=>{let y=a.get(v);if(!y)throw new Error(`Element with ${v} wasn't mapped correctly`);let w=r.getElement(y);if(!w)throw new Error(`Frame element with id ${y} doesn't exist`);Object.assign(w,{frameId:c.id}),w?.boundElements?.forEach(C=>{let A=r.getElement(C.id);if(!A)throw new Error(`Bound element with id ${C.id} doesn't exist`);Object.assign(A,{frameId:c.id}),d.push(A)}),d.push(w)});let[u,h,m,p]=Bt(d),f=10;u=u-f,h=h-f,m=m+f,p=p+f;let g=Math.max(c?.width,m-u),b=Math.max(c?.height,p-h);Object.assign(c,{x:u,y:h,width:g,height:b})}return r.getElements()}}),Gt,vE,WA,VA=M(()=>{"use strict";D(),te(),Gt=e=>t=>{(0,BC.unstable_batchedUpdates)(e,t)},vE=e=>Qb(t=>{(0,BC.unstable_batchedUpdates)(e,t)}),WA=(()=>{let e;try{let n=lV.version.split(".");e=Number(n[0])>17}catch{e=!1}let t=!1;return()=>window.EXCALIDRAW_THROTTLE_RENDER===!0?e?!0:(t||(t=!0,console.warn("Excalidraw: render throttling is disabled on React versions < 18.")),!1):!1})()}),cF,dF,qS,QS,cV,uF,hF,JS,si,mF,pae=M(()=>{"use strict";D(),ae(),cF="#ff6b6b",dF="#ff0000",qS=1,QS=2,cV=(e,t)=>{if(!t.snapLines.length)return;let n=t.theme===ze.LIGHT||t.zenModeEnabled?cF:dF,r=(t.zenModeEnabled?qS*1.5:qS)/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY);for(let i of t.snapLines)i.type==="pointer"?(e.lineWidth=r,e.strokeStyle=n,hF(i,e,t)):i.type==="gap"?(e.lineWidth=r,e.strokeStyle=n,mF(i.points[0],i.points[1],i.direction,t,e)):i.type==="points"&&(e.lineWidth=r,e.strokeStyle=n,uF(i,e,t));e.restore()},uF=(e,t,n)=>{if(!n.zenModeEnabled){let r=e.points[0],i=e.points[e.points.length-1];si(r,i,t)}for(let r of e.points)JS(r,n,t)},hF=(e,t,n)=>{JS(e.points[0],n,t),n.zenModeEnabled||si(e.points[0],e.points[1],t)},JS=([e,t],n,r)=>{r.save();let i=(n.zenModeEnabled?QS*1.5:QS)/n.zoom.value;r.beginPath(),r.moveTo(e-i,t-i),r.lineTo(e+i,t+i),r.moveTo(e+i,t-i),r.lineTo(e-i,t+i),r.stroke(),r.restore()},si=(e,t,n)=>{n.beginPath(),n.lineTo(...e),n.lineTo(...t),n.stroke()},mF=(e,t,n,r,i)=>{let a=8/r.zoom.value,o=a/2,s=a/4;if(n==="horizontal"){let l=[(e[0]+t[0])/2,e[1]];r.zenModeEnabled||si([e[0],e[1]-a],[e[0],e[1]+a],i),si([l[0]-s,l[1]-o],[l[0]-s,l[1]+o],i),si([l[0]+s,l[1]-o],[l[0]+s,l[1]+o],i),r.zenModeEnabled||(si([t[0],t[1]-a],[t[0],t[1]+a],i),si(e,t,i))}else{let l=[e[0],(e[1]+t[1])/2];r.zenModeEnabled||si([e[0]-a,e[1]],[e[0]+a,e[1]],i),si([l[0]-o,l[1]-s],[l[0]+o,l[1]-s],i),si([l[0]-o,l[1]+s],[l[0]+o,l[1]+s],i),r.zenModeEnabled||(si([t[0]-a,t[1]],[t[0]+a,t[1]],i),si(e,t,i))}}}),pF,A2,Lu,fF,$p,gF,EF,bF,e5,yF,vF,xF,k2,t5,n5,zC,dV,uV=M(()=>{"use strict";D(),Oe(),uG(),PA(),Ds(),Ny(),Kr(),dy(),te(),ae(),pae(),Fa(),yr(),rH(),Se(),pF=(e,t,n)=>{let{elementId:r,hoverPointIndex:i}=t.selectedLinearElement;if(t.editingLinearElement?.selectedPointsIndices?.includes(i))return;let a=fe.getElement(r,n);if(!a)return;let o=fe.getPointAtIndexGlobalCoordinates(a,i,n);e.save(),e.translate(t.scrollX,t.scrollY),A2(o,e,t),e.restore()},A2=(e,t,n)=>{t.fillStyle="rgba(105, 101, 219, 0.4)",Zp(t,e[0],e[1],fe.POINT_HANDLE_SIZE/n.zoom.value,!1)},Lu=(e,t,n,r,i,a,o,s,l=!1,c=0)=>{e.save(),e.translate(a,o),e.rotate(s),l&&e.fillRect(t-a,n-o,r,i),c&&e.roundRect?(e.beginPath(),e.roundRect(t-a,n-o,r,i,c),e.stroke(),e.closePath()):e.strokeRect(t-a,n-o,r,i),e.restore()},fF=(e,t,n,r,i,a)=>{e.save(),e.translate(r,i),e.rotate(a),e.beginPath(),e.moveTo(0,n/2),e.lineTo(t/2,0),e.lineTo(0,-n/2),e.lineTo(-t/2,0),e.closePath(),e.stroke(),e.restore()},$p=(e,t,n,r,i,a=!1)=>{e.strokeStyle="#5e5ad8",e.setLineDash([]),e.fillStyle="rgba(255, 255, 255, 0.9)",i?e.fillStyle="rgba(134, 131, 226, 0.9)":a&&(e.fillStyle="rgba(177, 151, 252, 0.7)"),Zp(e,n[0],n[1],r/t.zoom.value,!a)},gF=(e,t,n,r,i,a)=>{e.beginPath(),e.ellipse(r,i,t/2,n/2,a,0,Math.PI*2),e.stroke()},EF=(e,t,n)=>{let[r,i,a,o]=De(t,n),s=a-r,l=o-i,c=uf(t,s,l),d=4;e.strokeStyle="rgba(0,0,0,.05)",e.lineWidth=c-d;let u=d/2+c/2;switch(t.type){case"rectangle":case"text":case"image":case"iframe":case"embeddable":case"frame":case"magicframe":Lu(e,r-u,i-u,s+u*2,l+u*2,r+s/2,i+l/2,t.angle);break;case"diamond":let h=Math.hypot(s,l),m=u*h/l,p=u*h/s;fF(e,s+m*2,l+p*2,r+s/2,i+l/2,t.angle);break;case"ellipse":gF(e,s+u*2,l+u*2,r+s/2,i+l/2,t.angle);break}},bF=(e,t,n)=>{let[r,i,a]=t,o=uf(a,a.width,a.height);e.strokeStyle="rgba(0,0,0,0)",e.fillStyle="rgba(0,0,0,.05)",(i==="both"?[0,-1]:i==="start"?[0]:[-1]).forEach(s=>{let[l,c]=fe.getPointAtIndexGlobalCoordinates(r,s,n);Zp(e,l,c,o)})},e5=(e,t,n,r=ed*2)=>{let{angle:i,elementX1:a,elementY1:o,elementX2:s,elementY2:l,selectionColors:c,cx:d,cy:u,dashed:h,activeEmbeddable:m}=n,p=s-a,f=l-o,g=r/t.zoom.value,b=8/t.zoom.value,v=4/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=(m?4:1)/t.zoom.value;let y=c.length;for(let w=0;w<y;++w)e.strokeStyle=c[w],h&&e.setLineDash([b,v+(b+v)*(y-1)]),e.lineDashOffset=(b+v)*w,Lu(e,a-g,o-g,p+g*2,f+g*2,d,u,i);e.restore()},yF=(e,t,n,r)=>{let i=Array.isArray(n)?bF:EF;e.save(),e.translate(t.scrollX,t.scrollY),i(e,n,r),e.restore()},vF=(e,t,n,r)=>{let[i,a,o,s]=De(n,r),l=o-i,c=s-a;e.strokeStyle="rgb(0,118,255)",e.lineWidth=Kt.strokeWidth/t.zoom.value,e.save(),e.translate(t.scrollX,t.scrollY),Lu(e,i,a,l,c,i+l/2,a+c/2,n.angle,!1,Kt.radius/t.zoom.value),e.restore()},xF=(e,t,n)=>{let r=n.filter(s=>s.groupIds.length===0),i=n.filter(s=>s.groupIds.length>0),a=s=>{let[l,c,d,u]=Bt(s);return{angle:0,elementX1:l,elementX2:d,elementY1:c,elementY2:u,selectionColors:["rgb(0,118,255)"],dashed:!1,cx:l+(d-l)/2,cy:c+(u-c)/2,activeEmbeddable:!1}},o=s=>{let l=yn(n,s);return a(l)};Object.entries(xT(i,t)).filter(([s,l])=>l).map(([s,l])=>s).map(s=>o(s)).concat(r.map(s=>a([s]))).forEach(s=>e5(e,t,s))},k2=(e,t,n,r)=>{if(!t.selectedLinearElement)return;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=1/t.zoom.value;let i=fe.getPointsGlobalCoordinates(n,r),{POINT_HANDLE_SIZE:a}=fe,o=t.editingLinearElement?a:a/2;i.forEach((s,l)=>{let c=!!t.editingLinearElement?.selectedPointsIndices?.includes(l);$p(e,t,s,o,c)}),fe.getEditorMidPoints(n,r,t).filter(s=>s!==null).forEach(s=>{t?.selectedLinearElement?.segmentMidPointHoveredCoords&&fe.arePointsEqual(s,t.selectedLinearElement.segmentMidPointHoveredCoords)?t.editingLinearElement?($p(e,t,s,o,!1),A2(s,e,t)):(A2(s,e,t),$p(e,t,s,o,!1)):(t.editingLinearElement||i.length===2)&&$p(e,t,s,a/2,!1,!0)}),e.restore()},t5=(e,t,n,r,i)=>{Object.keys(r).forEach(a=>{let o=r[a];if(o!==void 0){let[s,l,c,d]=o;e.save(),e.lineWidth=1/n.zoom.value,t.selectionColor&&(e.strokeStyle=t.selectionColor),a==="rotation"?Zp(e,s+c/2,l+d/2,c/2):e.roundRect?(e.beginPath(),e.roundRect(s,l,c,d,2/n.zoom.value),e.fill(),e.stroke()):Lu(e,s,l,c,d,s+c/2,l+d/2,i,!0),e.restore()}})},n5=({canvas:e,elementsMap:t,visibleElements:n,selectedElements:r,scale:i,appState:a,renderConfig:o,device:s})=>{if(e===null)return{atLeastOneVisibleElement:!1,elementsMap:t};let[l,c]=NT(e,i),d=$T({canvas:e,scale:i,normalizedWidth:l,normalizedHeight:c});d.save(),d.scale(a.zoom.value,a.zoom.value);let u;if(n.forEach(p=>{a.editingLinearElement?.elementId===p.id&&p&&(u=p)}),u&&k2(d,a,u,t),a.selectionElement)try{IH(a.selectionElement,d,a)}catch(p){console.error(p)}a.isBindingEnabled&&a.suggestedBindings.filter(p=>p!=null).forEach(p=>{yF(d,a,p,t)}),a.frameToHighlight&&vF(d,a,a.frameToHighlight,t),a.elementsToHighlight&&xF(d,a,a.elementsToHighlight);let h=r.some(p=>Ae(p));if(r.length===1&&a.editingLinearElement?.elementId===r[0].id&&k2(d,a,r[0],t),a.selectedLinearElement&&a.selectedLinearElement.hoverPointIndex>=0&&pF(d,a,t),!a.multiElement&&!a.editingLinearElement){let p=QT(r,a);r.length===1&&Be(r[0])&&a.selectedLinearElement?.elementId===r[0].id&&!r[0].locked&&k2(d,a,r[0],t);let f=o.selectionColor||At.black;if(p){let g=ve(r),b=[];for(let y of t.values()){let w=[];g.has(y.id)&&!vT(a,y)&&w.push(f);let C=o.remoteSelectedElementIds.get(y.id);if(C&&w.push(...C.map(A=>r1(A,a.collaborators.get(A)))),w.length){let[A,T,I,k,R,O]=De(y,t,!0);b.push({angle:y.angle,elementX1:A,elementY1:T,elementX2:I,elementY2:k,selectionColors:w,dashed:!!C,cx:R,cy:O,activeEmbeddable:a.activeEmbeddable?.element===y&&a.activeEmbeddable.state==="active"})}}let v=y=>{let w=yn(t,y),[C,A,T,I]=Bt(w);b.push({angle:0,elementX1:C,elementX2:T,elementY1:A,elementY2:I,selectionColors:[At.black],dashed:!0,cx:C+(T-C)/2,cy:A+(I-A)/2,activeEmbeddable:!1})};for(let y of Zc(a))v(y);a.editingGroupId&&v(a.editingGroupId),b.forEach(y=>e5(d,a,y))}if(d.save(),d.translate(a.scrollX,a.scrollY),r.length===1){d.fillStyle=At.white;let g=qT(r[0],a.zoom,t,"mouse",oh(s));!a.viewModeEnabled&&p&&t5(d,o,a,g,r[0].angle)}else if(r.length>1&&!a.isRotating){let g=ed*2/a.zoom.value;d.fillStyle=At.white;let[b,v,y,w]=Bt(r),C=d.getLineDash();d.setLineDash([2/a.zoom.value]);let A=d.lineWidth;d.lineWidth=1/a.zoom.value,d.strokeStyle=f,Lu(d,b-g,v-g,y-b+g*2,w-v+g*2,(b+y)/2,(v+w)/2,0),d.lineWidth=A,d.setLineDash(C);let T=ab([b,v,y,w,(b+y)/2,(v+w)/2],0,a.zoom,"mouse",h?{...oh(s),rotation:!0}:oh(s));r.some(I=>!I.locked)&&t5(d,o,a,T,0)}d.restore()}cV(d,a),d.restore(),mG({context:d,renderConfig:o,appState:a,normalizedWidth:l,normalizedHeight:c});let m;return o.renderScrollbars&&(m=qj(n,l,c,a),d.save(),d.fillStyle=Xj,d.strokeStyle="rgba(255,255,255,0.8)",[m.horizontal,m.vertical].forEach(p=>{p&&rA(d,p.x,p.y,p.width,p.height,fs/2)}),d.restore()),{scrollBars:m,atLeastOneVisibleElement:n.length>0,elementsMap:t}},zC=Qb(e=>{let t=n5(e);e.callback?.(t)},{trailing:!0}),dV=(e,t)=>{if(t){zC(e);return}let n=n5(e);return e.callback(n),n}}),wF,r5,SF,mV,fae=M(()=>{"use strict";D(),te(),ae(),de(),VA(),uV(),wF=e=>{let t=(0,Xh.useRef)(!1);return(0,Xh.useEffect)(()=>{if(!t.current){t.current=!0;return}let n=new Map,r=new Map,i=new Map,a=new Map,o=new Map;e.appState.collaborators.forEach((l,c)=>{if(l.selectedElementIds)for(let d of Object.keys(l.selectedElementIds))i.has(d)||i.set(d,[]),i.get(d).push(c);!l.pointer||l.pointer.renderCursor===!1||(l.username&&a.set(c,l.username),l.userState&&o.set(c,l.userState),r.set(c,Gi({sceneX:l.pointer.x,sceneY:l.pointer.y},e.appState)),n.set(c,l.button))});let s=e.containerRef?.current&&getComputedStyle(e.containerRef.current).getPropertyValue("--color-selection")||"#6965db";dV({canvas:e.canvas,elementsMap:e.elementsMap,visibleElements:e.visibleElements,selectedElements:e.selectedElements,scale:window.devicePixelRatio,appState:e.appState,renderConfig:{remotePointerViewportCoords:r,remotePointerButton:n,remoteSelectedElementIds:i,remotePointerUsernames:a,remotePointerUserStates:o,selectionColor:s,renderScrollbars:!1},device:e.device,callback:e.renderInteractiveSceneCallback},WA())}),(0,hV.jsx)("canvas",{className:"excalidraw__canvas interactive",style:{width:e.appState.width,height:e.appState.height,cursor:e.appState.viewModeEnabled?gt.GRAB:gt.AUTO},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:e.handleCanvasRef,onContextMenu:e.onContextMenu,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onPointerCancel:e.onPointerCancel,onTouchMove:e.onTouchMove,onPointerDown:e.onPointerDown,onDoubleClick:e.appState.viewModeEnabled?void 0:e.onDoubleClick,children:x("labels.drawingCanvas")})},r5=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,editingGroupId:e.editingGroupId,editingLinearElement:e.editingLinearElement,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,pendingImageElementId:e.pendingImageElementId,selectionElement:e.selectionElement,selectedGroupIds:e.selectedGroupIds,selectedLinearElement:e.selectedLinearElement,multiElement:e.multiElement,isBindingEnabled:e.isBindingEnabled,suggestedBindings:e.suggestedBindings,isRotating:e.isRotating,elementsToHighlight:e.elementsToHighlight,collaborators:e.collaborators,activeEmbeddable:e.activeEmbeddable,snapLines:e.snapLines,zenModeEnabled:e.zenModeEnabled}),SF=(e,t)=>e.selectionNonce!==t.selectionNonce||e.versionNonce!==t.versionNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements||e.selectedElements!==t.selectedElements?!1:Bn(r5(e.appState),r5(t.appState)),mV=Xh.default.memo(wF,SF)}),CF,i5,TF,fV,gae=M(()=>{"use strict";D(),BT(),te(),VA(),CF=e=>{let t=(0,Ed.useRef)(null),n=(0,Ed.useRef)(!1);return(0,Ed.useEffect)(()=>{let r=t.current;if(!r)return;let i=e.canvas;n.current||(n.current=!0,r.replaceChildren(i),i.classList.add("excalidraw__canvas","static"));let a=`${e.appState.width}px`,o=`${e.appState.height}px`;i.style.width!==a&&(i.style.width=a),i.style.height!==o&&(i.style.height=o);let s=e.appState.width*e.scale,l=e.appState.height*e.scale;i.width!==s&&(i.width=s),i.height!==l&&(i.height=l),FT({canvas:i,rc:e.rc,scale:e.scale,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,visibleElements:e.visibleElements,appState:e.appState,renderConfig:e.renderConfig},WA())}),(0,pV.jsx)("div",{className:"excalidraw__canvas-wrapper",ref:t})},i5=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,pendingImageElementId:e.pendingImageElementId,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,exportScale:e.exportScale,selectedElementsAreBeingDragged:e.selectedElementsAreBeingDragged,gridSize:e.gridSize,frameRendering:e.frameRendering,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,editingGroupId:e.editingGroupId}),TF=(e,t)=>e.versionNonce!==t.versionNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements?!1:Bn(i5(e.appState),i5(t.appState))&&Bn(e.renderConfig,t.renderConfig),fV=Ed.default.memo(CF,TF)}),Eae=M(()=>{"use strict";D(),fae(),gae()}),HC,bae=M(()=>{"use strict";D(),kh(),Se(),uV(),BT(),te(),HC=class{scene;constructor(e){this.scene=e}getRenderableElements=(()=>{let e=({elementsMap:n,zoom:r,offsetLeft:i,offsetTop:a,scrollX:o,scrollY:s,height:l,width:c})=>{let d=[];for(let u of n.values())Gf(u,c,l,{zoom:r,offsetLeft:i,offsetTop:a,scrollX:o,scrollY:s},n)&&d.push(u);return d},t=({elements:n,editingElement:r,pendingImageElementId:i})=>{let a=Ts(new Map);for(let o of n)Ll(o)&&i===o.id||(!r||r.type!=="text"||o.id!==r.id)&&a.set(o.id,o);return a};return IB(({zoom:n,offsetLeft:r,offsetTop:i,scrollX:a,scrollY:o,height:s,width:l,editingElement:c,pendingImageElementId:d,versionNonce:u})=>{let h=this.scene.getNonDeletedElements(),m=t({elements:h,editingElement:c,pendingImageElementId:d}),p=e({elementsMap:m,zoom:n,offsetLeft:r,offsetTop:i,scrollX:a,scrollY:o,height:s,width:l});return{elementsMap:m,visibleElements:p}})})();destroy(){zC.cancel(),f4.cancel(),this.getRenderableElements.clear()}}}),yae=M(()=>{}),gV,vae=M(()=>{"use strict";D(),yae(),gV=({trails:e})=>{let t=(0,lv.useRef)(null);return(0,lv.useEffect)(()=>{if(t.current)for(let n of e)n.start(t.current);return()=>{for(let n of e)n.stop()}},e),(0,UC.jsx)("div",{className:"SVGLayer",children:(0,UC.jsx)("svg",{ref:t})})}}),xae=M(()=>{}),IF,MF,GC,wae=M(()=>{"use strict";D(),te(),Oe(),$e(),xae(),IF=5,MF=(e,t,n)=>{let[r,i]=De(e,n),{x:a,y:o}=Gi({sceneX:r+e.width,sceneY:i},t),s=a-t.offsetLeft+10,l=o-t.offsetTop;return{x:s,y:l}},GC=({children:e,element:t,elementsMap:n})=>{let r=cv();if(r.contextMenu||r.draggingElement||r.resizingElement||r.isRotating||r.openMenu||r.viewModeEnabled)return null;let{x:i,y:a}=MF(t,r,n);return(0,EV.jsx)("div",{className:"excalidraw-canvas-buttons",style:{top:`${a}px`,left:`${i}px`,padding:IF},children:e})}});async function Sae({image:e,apiKey:t,text:n,theme:r=ze.LIGHT}){let i={model:"gpt-4-vision-preview",max_tokens:4096,temperature:.1,messages:[{role:"system",content:bV},{role:"user",content:[{type:"image_url",image_url:{url:e,detail:"high"}},{type:"text",text:`Above is the reference wireframe. Please make a new website based on these and return just the HTML file. Also, please make it for the ${r} theme. What follows are the wireframe's text annotations (if any)...`},{type:"text",text:n}]}]},a,o=await fetch("https://api.openai.com/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(i)});return o.ok?a={...await o.json(),ok:!0}:a={...await o.json(),ok:!1},a}var bV,Cae=M(()=>{"use strict";D(),ae(),bV=`You are a skilled front-end developer who builds interactive prototypes from wireframes, and is an expert at CSS Grid and Flex design.
184
+ Your role is to transform low-fidelity wireframes into working front-end HTML code.
185
+
186
+ YOU MUST FOLLOW FOLLOWING RULES:
187
+
188
+ - Use HTML, CSS, JavaScript to build a responsive, accessible, polished prototype
189
+ - Leverage Tailwind for styling and layout (import as script <script src="https://cdn.tailwindcss.com"><\/script>)
190
+ - Inline JavaScript when needed
191
+ - Fetch dependencies from CDNs when needed (using unpkg or skypack)
192
+ - Source images from Unsplash or create applicable placeholders
193
+ - Interpret annotations as intended vs literal UI
194
+ - Fill gaps using your expertise in UX and business logic
195
+ - generate primarily for desktop UI, but make it responsive.
196
+ - Use grid and flexbox wherever applicable.
197
+ - Convert the wireframe in its entirety, don't omit elements if possible.
198
+
199
+ If the wireframes, diagrams, or text is unclear or unreadable, refer to provided text for clarification.
200
+
201
+ Your goal is a production-ready prototype that brings the wireframes to life.
202
+
203
+ Please output JUST THE HTML file containing your best attempt at implementing the provided wireframes.`}),AF,xE,Tae=M(()=>{"use strict";D(),Vl(),AF="small",xE=e=>(0,E1.jsxs)("label",{className:X("ToolIcon ToolIcon__MagicButton",`ToolIcon_size_${AF}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,E1.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,E1.jsx)("div",{className:"ToolIcon__icon",children:e.icon})]})}),Iae=M(()=>{}),kF,yV,Mae=M(()=>{"use strict";D(),pe(),Iae(),kF=({height:e,width:t,userToFollow:n,onDisconnect:r})=>(0,dd.jsx)("div",{className:"follow-mode",style:{width:t,height:e},children:(0,dd.jsxs)("div",{className:"follow-mode__badge",children:[(0,dd.jsxs)("div",{className:"follow-mode__badge__label",children:["Following"," ",(0,dd.jsx)("span",{className:"follow-mode__badge__username",title:n.username,children:n.username})]}),(0,dd.jsx)("button",{onClick:r,className:"follow-mode__disconnect-btn",children:Yl})]})}),yV=kF}),vV,Aae=M(()=>{"use strict";D(),vV=class{targets=new WeakMap;rafIds=new WeakMap;register(e,t){this.targets.set(e,{callback:t,stopped:!0})}start(e){let t=this.targets.get(e);t&&(this.rafIds.has(e)||(this.targets.set(e,{...t,stopped:!1}),this.scheduleFrame(e)))}stop(e){let t=this.targets.get(e);t&&!t.stopped&&this.targets.set(e,{...t,stopped:!0}),this.cancelFrame(e)}constructFrame(e){return t=>{let n=this.targets.get(e);if(!n)return;let r=this.onFrame(n,t);!n.stopped&&!r?this.scheduleFrame(e):this.cancelFrame(e)}}scheduleFrame(e){let t=requestAnimationFrame(this.constructFrame(e));this.rafIds.set(e,t)}cancelFrame(e){if(this.rafIds.has(e)){let t=this.rafIds.get(e);cancelAnimationFrame(t)}this.rafIds.delete(e)}onFrame(e,t){return e.callback(t)??!1}}}),jb,xV=M(()=>{"use strict";D(),te(),ae(),jb=class{constructor(e,t,n){this.animationFrameHandler=e,this.app=t,this.options=n,this.animationFrameHandler.register(this,this.onFrame.bind(this)),this.trailElement=document.createElementNS(Pt,"path")}currentTrail;pastTrails=[];container;trailElement;get hasCurrentTrail(){return!!this.currentTrail}hasLastPoint(e,t){if(this.currentTrail){let n=this.currentTrail.originalPoints.length;return this.currentTrail.originalPoints[n-1][0]===e&&this.currentTrail.originalPoints[n-1][1]===t}return!1}start(e){e&&(this.container=e),this.trailElement.parentNode!==this.container&&this.container&&this.container.appendChild(this.trailElement),this.animationFrameHandler.start(this)}stop(){this.animationFrameHandler.stop(this),this.trailElement.parentNode===this.container&&this.container?.removeChild(this.trailElement)}startPath(e,t){this.currentTrail=new Ep(this.options),this.currentTrail.addPoint([e,t,performance.now()]),this.update()}addPointToPath(e,t){this.currentTrail&&(this.currentTrail.addPoint([e,t,performance.now()]),this.update())}endPath(){this.currentTrail&&(this.currentTrail.close(),this.currentTrail.options.keepHead=!1,this.pastTrails.push(this.currentTrail),this.currentTrail=void 0,this.update())}update(){this.start()}onFrame(){let e=[];for(let n of this.pastTrails)e.push(this.drawTrail(n,this.app.state));if(this.currentTrail){let n=this.drawTrail(this.currentTrail,this.app.state);e.push(n)}this.pastTrails=this.pastTrails.filter(n=>n.getStrokeOutline().length!==0),e.length===0&&this.stop();let t=e.join(" ").trim();this.trailElement.setAttribute("d",t),this.trailElement.setAttribute("fill",(this.options.fill??(()=>"black"))(this))}drawTrail(e,t){let n=e.getStrokeOutline(e.options.size/t.zoom.value).map(([r,i])=>{let a=Gi({sceneX:r,sceneY:i},t);return[a.x,a.y]});return Nte(n,!0)}}}),wV,kae=M(()=>{"use strict";D(),xV(),te(),Ny(),ae(),wV=class{constructor(e,t){this.animationFrameHandler=e,this.app=t,this.animationFrameHandler.register(this,this.onFrame.bind(this)),this.localTrail=new jb(e,t,{...this.getTrailOptions(),fill:()=>YF})}localTrail;collabTrails=new Map;container;getTrailOptions(){return{simplify:0,streamline:.4,sizeMapping:e=>{let t=Math.max(0,1-(performance.now()-e.pressure)/1e3),n=(50-Math.min(50,e.totalLength-e.currentIndex))/50;return Math.min(Dl(n),Dl(t))}}}startPath(e,t){this.localTrail.startPath(e,t)}addPointToPath(e,t){this.localTrail.addPointToPath(e,t)}endPath(){this.localTrail.endPath()}start(e){this.container=e,this.animationFrameHandler.start(this),this.localTrail.start(e)}stop(){this.animationFrameHandler.stop(this),this.localTrail.stop()}onFrame(){this.updateCollabTrails()}updateCollabTrails(){if(!(!this.container||this.app.state.collaborators.size===0)){for(let[e,t]of this.app.state.collaborators.entries()){let n;this.collabTrails.has(e)?n=this.collabTrails.get(e):(n=new jb(this.animationFrameHandler,this.app,{...this.getTrailOptions(),fill:()=>t.pointer?.laserColor||r1(e,t)}),n.start(this.container),this.collabTrails.set(e,n)),t.pointer&&t.pointer.tool==="laser"&&(t.button==="down"&&!n.hasCurrentTrail&&n.startPath(t.pointer.x,t.pointer.y),t.button==="down"&&n.hasCurrentTrail&&!n.hasLastPoint(t.pointer.x,t.pointer.y)&&n.addPointToPath(t.pointer.x,t.pointer.y),t.button==="up"&&n.hasCurrentTrail&&(n.addPointToPath(t.pointer.x,t.pointer.y),n.endPath()))}for(let e of this.collabTrails.keys())this.app.state.collaborators.has(e)||(this.collabTrails.get(e).stop(),this.collabTrails.delete(e))}}}}),PF,SV,Pae=M(()=>{"use strict";D(),ke(),te(),yd(),Se(),ae(),vt(),qt(),KU(),Ly(),yr(),vd(),pT(),PF=(e,t,n,r,i,a)=>{let{zoom:o}=r,s=180*n/Math.PI,l=e*(o.value-1)/2,c=t*(o.value-1)/2;return e>i&&o.value!==1&&(l=i*(o.value-1)/2),t>a&&o.value!==1&&(c=a*(o.value-1)/2),`translate(${l}px, ${c}px) scale(${o.value}) rotate(${s}deg)`},SV=({id:e,onChange:t,onSubmit:n,getViewportCoords:r,element:i,canvas:a,excalidrawContainer:o,app:s})=>{let l=(P,F)=>{if(!F.style.fontFamily||!F.style.fontSize)return!1;let Y=F.style.fontFamily.replace(/"/g,"");return kf({fontFamily:P.fontFamily})!==Y||`${P.fontSize}px`!==F.style.fontSize},c=()=>{let P=s.state,F=_r.getScene(i)?.getElement(e);if(!F)return;let{textAlign:Y,verticalAlign:j}=F,q=s.scene.getNonDeletedElementsMap();if(F&&he(F)){let ne=F.x,H=F.y,V=Er(F,s.scene.getNonDeletedElementsMap()),$=F.width,B=F.height,G=F.width,U=F.height;if(V&&F.containerId){if(Et(V)){let at=fe.getBoundTextElementPosition(V,F,q);ne=at.x,H=at.y}let Le=l(F,d),Pe;if(Le?Pe=Rf(V.id,V.height):(Pe=$c[V.id],Pe||(Pe=Rf(V.id,V.height))),$=Ca(V,F),B=Ju(V,F),!Et(V)&&U>B){let at=Il(U,V.type);ie(V,{height:at});return}else if(!Et(V)&&V.height>Pe.height&&U<B){let at=Il(U,V.type);ie(V,{height:at})}else{let{y:at}=hf(V,F,q);H=at}}let[Q,re]=r(ne,H),se=d.selectionStart,me=d.selectionEnd,it=d.value.length;if(se===me&&me!==it){let Le=it-me;d.selectionStart=d.value.length-Le,d.selectionEnd=d.value.length-Le}V||($=(P.width-8-Q)/P.zoom.value,G=Math.min(G,$));let Qe=(P.height-re)/P.zoom.value;Object.assign(d.style,{font:An(F),lineHeight:F.lineHeight,width:`${G}px`,height:`${U}px`,left:`${Q}px`,top:`${re}px`,transform:PF(G,U,cz(F,V),P,$,Qe),textAlign:Y,verticalAlign:j,color:F.strokeColor,opacity:F.opacity/100,filter:"var(--theme-filter)",maxHeight:`${Qe}px`}),d.scrollTop=0,$l()&&(d.style.fontFamily=kf(F)),ie(F,{x:ne,y:H})}},d=document.createElement("textarea");d.dir="auto",d.tabIndex=0,d.dataset.type="wysiwyg",d.wrap="off",d.classList.add("excalidraw-wysiwyg");let u="pre",h="normal";tn(i)&&(u="pre-wrap",h="break-word"),Object.assign(d.style,{position:"absolute",display:"inline-block",minHeight:"1em",backfaceVisibility:"hidden",margin:0,padding:0,border:0,outline:0,resize:"none",background:"transparent",overflow:"hidden",zIndex:"var(--zIndex-wysiwyg)",wordBreak:h,whiteSpace:u,overflowWrap:"break-word",boxSizing:"content-box"}),d.value=i.originalText,c(),t&&(d.onpaste=async P=>{let F=await jT(P,!0);if(!F.text)return;let Y=Sh(F.text);if(!Y)return;let j=Er(i,s.scene.getNonDeletedElementsMap()),q=An({fontSize:s.state.currentItemFontSize,fontFamily:s.state.currentItemFontFamily});if(j){let ne=Ye(j,s.scene.getNonDeletedElementsMap()),H=ah(`${d.value}${Y}`,q,Ca(j,ne)),V=Vp(H,q);d.style.width=`${V}px`}},d.oninput=()=>{t(Sh(d.value))}),d.onkeydown=P=>{if(!P.shiftKey&&_b.keyTest(P))P.preventDefault(),s.actionManager.executeAction(_b),c();else if(!P.shiftKey&&Lb.keyTest(P))P.preventDefault(),s.actionManager.executeAction(Lb),c();else if(L4.keyTest(P))s.actionManager.executeAction(L4);else if(R4.keyTest(P))s.actionManager.executeAction(R4);else if(P.key===N.ESCAPE)P.preventDefault(),w=!0,C();else if(P.key===N.ENTER&&P[N.CTRL_OR_CMD]){if(P.preventDefault(),P.isComposing||P.keyCode===229)return;w=!0,C()}else if(P.key===N.TAB||P[N.CTRL_OR_CMD]&&(P.code===rt.BRACKET_LEFT||P.code===rt.BRACKET_RIGHT)){if(P.preventDefault(),P.isComposing)return;P.shiftKey||P.code===rt.BRACKET_LEFT?b():g(),d.dispatchEvent(new Event("input"))}};let m=4,p=" ".repeat(m),f=new RegExp(`^ {1,${m}}`),g=()=>{let{selectionStart:P,selectionEnd:F}=d,Y=v(),j=d.value;Y.forEach(q=>{let ne=j.slice(0,q),H=j.slice(q);j=`${ne}${p}${H}`}),d.value=j,d.selectionStart=P+m,d.selectionEnd=F+m*Y.length},b=()=>{let{selectionStart:P,selectionEnd:F}=d,Y=v(),j=[],q=d.value;Y.forEach(ne=>{let H=q.slice(ne,ne+m).match(f);if(H){let V=q.slice(0,ne),$=q.slice(ne+H[0].length);q=`${V}${$}`,j.push(ne)}}),d.value=q,j.length&&(P>j[j.length-1]?d.selectionStart=Math.max(P-m,j[j.length-1]):d.selectionStart=P,d.selectionEnd=Math.max(d.selectionStart,F-m*j.length))},v=()=>{let{selectionStart:P,selectionEnd:F,value:Y}=d,j=Y.slice(0,P).match(/[^\n]*$/)[0].length;return P=P-j,Y.slice(P,F).split(`
204
+ `).reduce((q,ne,H,V)=>q.concat(H?q[H-1]+V[H-1].length+1:P),[]).reverse()},y=P=>{P.preventDefault(),P.stopPropagation()},w=!1,C=()=>{A();let P=_r.getScene(i)?.getElement(i.id);if(!P)return;let F=d.value,Y=Er(P,s.scene.getNonDeletedElementsMap());if(Y){if(F=P.text,d.value.trim()){let j=vs(Y);!j||j!==i.id?ie(Y,{boundElements:(Y.boundElements||[]).concat({type:"text",id:i.id})}):Et(Y)&&Uf(Y)}else ie(Y,{boundElements:Y.boundElements?.filter(j=>!he(j))});ji(P,Y,s.scene.getNonDeletedElementsMap())}n({text:F,viaKeyboard:w,originalText:d.value})},A=()=>{R||(R=!0,d.onblur=null,d.oninput=null,d.onkeydown=null,O&&O.disconnect(),window.removeEventListener("resize",c),window.removeEventListener("wheel",y,!0),window.removeEventListener("pointerdown",I),window.removeEventListener("pointerup",T),window.removeEventListener("blur",C),window.removeEventListener("beforeunload",C),k(),d.remove())},T=P=>{window.removeEventListener("pointerup",T);let F=P?.target,Y=F instanceof HTMLElement&&F.classList.contains("active-color");setTimeout(()=>{if(d.onblur=C,Y){let j=(q,ne)=>{q.find(H=>H.removedNodes.length>0&&H.removedNodes[0].dataset?.radixPopperContentWrapper!==void 0)&&(setTimeout(()=>{d.focus()}),ne.disconnect())};new MutationObserver(j).observe(document.querySelector(".excalidraw-container"),{childList:!0})}Y||d.focus()})},I=P=>{let F=P.target instanceof HTMLElement&&P.target.classList.contains("active-color");((P.target instanceof HTMLElement||P.target instanceof SVGElement)&&P.target.closest(`.${ZC.SHAPE_ACTIONS_MENU}`)&&!ds(P.target)||F)&&(d.onblur=null,window.addEventListener("pointerup",T),window.addEventListener("blur",C))},k=_r.getScene(i).addCallback(()=>{c(),document.activeElement?.closest(".color-picker-content")||d.focus()}),R=!1;d.select(),T();let O=null;a&&"ResizeObserver"in window?(O=new window.ResizeObserver(()=>{c()}),O.observe(a)):window.addEventListener("resize",c),window.addEventListener("pointerdown",I),window.addEventListener("wheel",y,{passive:!1,capture:!0}),window.addEventListener("beforeunload",C),o?.querySelector(".excalidraw-textEditorContainer").appendChild(d)}}),a5,o5,s5,P2,D2,_2,L2,R2,O2,ql,N1,qn,Po,$1,cv,zn,Vr,Ru,N2,dl,Ou,$2,F2,as,Nu,B2,Fp,l5,c5,$u,nt,DF,_F,TV,$e=M(()=>{"use strict";D(),Ba(),nie(),rie(),Tt(),xi(),vi(),vd(),ae(),fd(),mh(),jh(),Oe(),Fa(),yr(),vt(),_s(),Se(),iie(),Kr(),$j(),de(),ke(),kh(),rr(),Ds(),It(),yd(),eI(),xA(),eH(),dT(),te(),ny(),oie(),iae(),oae(),sae(),yi(),Zz(),Wl(),qt(),LG(),Gh(),dy(),NG(),lae(),Lr(),xd(),IG(),uae(),Ly(),Hn(),ev(),bd(),hae(),kG(),mae(),_y(),sV(),av(),Eae(),bae(),Ls(),vae(),S1(),ty(),wae(),Cae(),Wh(),Zi(),Tae(),pe(),Uy(),Mae(),ht(),Aae(),xV(),kae(),VA(),Ds(),RT(),Pae(),PA(),$a(),OT(),Zh(),a5=Mn.default.createContext(null),o5=Mn.default.createContext(null),s5={viewport:{isMobile:!1,isLandscape:!1},editor:{isMobile:!1,canFitSidebar:!1},isTouchScreen:!1},P2=Mn.default.createContext(s5),P2.displayName="DeviceContext",D2=Mn.default.createContext({container:null,id:null}),D2.displayName="ExcalidrawContainerContext",_2=Mn.default.createContext([]),_2.displayName="ExcalidrawElementsContext",L2=Mn.default.createContext({...Ms(),width:0,height:0,offsetLeft:0,offsetTop:0}),L2.displayName="ExcalidrawAppStateContext",R2=Mn.default.createContext(()=>{console.warn("Uninitialized ExcalidrawSetAppStateContext context!")}),R2.displayName="ExcalidrawSetAppStateContext",O2=Mn.default.createContext(null),O2.displayName="ExcalidrawActionManagerContext",ql=()=>(0,Mn.useContext)(a5),N1=()=>(0,Mn.useContext)(o5),qn=()=>(0,Mn.useContext)(P2),Po=()=>(0,Mn.useContext)(D2),$1=()=>(0,Mn.useContext)(_2),cv=()=>(0,Mn.useContext)(L2),zn=()=>(0,Mn.useContext)(R2),Vr=()=>(0,Mn.useContext)(O2),Ru=!1,N2=0,dl=!1,Ou=!1,$2=!1,F2={horizontal:null,vertical:null},as=0,Nu=!1,B2=new Map,Fp=!1,l5=0,c5=!1,$u=null,nt={pointers:new Map,lastCenter:null,initialDistance:null,initialScale:null},DF=class IV extends Mn.default.Component{canvas;interactiveCanvas=null;rc;unmounted=!1;actionManager;device=s5;excalidrawContainerRef=Mn.default.createRef();scene;renderer;fonts;resizeObserver;nearestScrollableContainer;library;libraryItemsFromStorage;id;store;history;excalidrawContainerValue;files={};imageCache=new Map;iFrameRefs=new Map;embedsValidationStatus=new Map;initializedEmbeds=new Set;elementsPendingErasure=new Set;hitLinkElement;lastPointerDownEvent=null;lastPointerUpEvent=null;lastPointerMoveEvent=null;lastViewportPosition={x:0,y:0};animationFrameHandler=new vV;laserTrails=new wV(this.animationFrameHandler,this);eraserTrail=new jb(this.animationFrameHandler,this,{streamline:.2,size:5,keepHead:!0,sizeMapping:t=>{let n=Math.max(0,1-(performance.now()-t.pressure)/200),r=(10-Math.min(10,t.totalLength-t.currentIndex))/10;return Math.min(Dl(r),Dl(n))},fill:()=>this.state.theme===ze.LIGHT?"rgba(0, 0, 0, 0.2)":"rgba(255, 255, 255, 0.2)"});onChangeEmitter=new va;onPointerDownEmitter=new va;onPointerUpEmitter=new va;onUserFollowEmitter=new va;onScrollChangeEmitter=new va;missingPointerEventCleanupEmitter=new va;onRemoveEventListenersEmitter=new va;constructor(t){super(t);let n=Ms(),{excalidrawAPI:r,viewModeEnabled:i=!1,zenModeEnabled:a=!1,gridModeEnabled:o=!1,objectsSnapModeEnabled:s=!1,theme:l=n.theme,name:c=`${x("labels.untitled")}-${v5()}`}=t;if(this.state={...n,theme:l,isLoading:!0,...this.getCanvasOffsets(),viewModeEnabled:i,zenModeEnabled:a,objectsSnapModeEnabled:s,gridSize:o?td:null,name:c,width:window.innerWidth,height:window.innerHeight},this.id=Ka(),this.library=new G4(this),this.actionManager=new aC(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.scene=new _r,this.canvas=document.createElement("canvas"),this.rc=nn.canvas(this.canvas),this.renderer=new HC(this.scene),this.store=new kz,this.history=new fE,r){let d={updateScene:this.updateScene,updateLibrary:this.library.updateLibrary,addFiles:this.addFiles,resetScene:this.resetScene,getSceneElementsIncludingDeleted:this.getSceneElementsIncludingDeleted,history:{clear:this.resetHistory},scrollToContent:this.scrollToContent,getSceneElements:this.getSceneElements,getAppState:()=>this.state,getFiles:()=>this.files,getName:this.getName,registerAction:u=>{this.actionManager.registerAction(u)},refresh:this.refresh,setToast:this.setToast,id:this.id,setActiveTool:this.setActiveTool,setCursor:this.setCursor,resetCursor:this.resetCursor,updateFrameRendering:this.updateFrameRendering,toggleSidebar:this.toggleSidebar,app:this,onChange:u=>this.onChangeEmitter.on(u),onPointerDown:u=>this.onPointerDownEmitter.on(u),onPointerUp:u=>this.onPointerUpEmitter.on(u),onScrollChange:u=>this.onScrollChangeEmitter.on(u),onUserFollow:u=>this.onUserFollowEmitter.on(u)};typeof r=="function"?r(d):console.error("excalidrawAPI should be a function!")}this.excalidrawContainerValue={container:this.excalidrawContainerRef.current,id:this.id},this.fonts=new XW({scene:this.scene,onSceneUpdated:this.onSceneUpdated}),this.history=new fE,this.actionManager.registerAll(oE),this.actionManager.registerAction(Fj(this.history,this.store)),this.actionManager.registerAction(Bj(this.history,this.store))}onWindowMessage(t){if(t.origin!=="https://player.vimeo.com"&&t.origin!=="https://www.youtube.com")return;let n=null;try{n=JSON.parse(t.data)}catch{}if(n)switch(t.origin){case"https://player.vimeo.com":if(n.method==="paused"){let r=null,i=document.body.querySelectorAll("iframe.excalidraw__embeddable");if(!i)break;for(let a of i)a.contentWindow===t.source&&(r=a.contentWindow);r?.postMessage(JSON.stringify({method:n.value?"play":"pause",value:!0}),"*")}break;case"https://www.youtube.com":if(n.event==="infoDelivery"&&n.info&&n.id&&typeof n.info.playerState=="number"){let r=n.id,i=n.info.playerState;Object.values(zp).includes(i)&&B2.set(r,i)}break}}cacheEmbeddableRef(t,n){n&&this.iFrameRefs.set(t.id,n)}getHTMLIFrameElement(t){return this.iFrameRefs.get(t.id)}handleEmbeddableCenterClick(t){if(this.state.activeEmbeddable?.element===t&&this.state.activeEmbeddable?.state==="active"||(setTimeout(()=>{this.setState({activeEmbeddable:{element:t,state:"active"},selectedElementIds:{[t.id]:!0},draggingElement:null,selectionElement:null})},100),ss(t)))return;let n=this.getHTMLIFrameElement(t);if(n?.contentWindow){if(n.src.includes("youtube")){let r=B2.get(t.id);switch(r||(B2.set(t.id,zp.UNSTARTED),n.contentWindow.postMessage(JSON.stringify({event:"listening",id:t.id}),"*")),r){case zp.PLAYING:case zp.BUFFERING:n.contentWindow?.postMessage(JSON.stringify({event:"command",func:"pauseVideo",args:""}),"*");break;default:n.contentWindow?.postMessage(JSON.stringify({event:"command",func:"playVideo",args:""}),"*")}}n.src.includes("player.vimeo.com")&&n.contentWindow.postMessage(JSON.stringify({method:"paused"}),"*")}}isIframeLikeElementCenter(t,n,r,i){return t&&!n.altKey&&!n.shiftKey&&!n.metaKey&&!n.ctrlKey&&(this.state.activeEmbeddable?.element!==t||this.state.activeEmbeddable?.state==="hover"||!this.state.activeEmbeddable)&&r>=t.x+t.width/3&&r<=t.x+2*t.width/3&&i>=t.y+t.height/3&&i<=t.y+2*t.height/3}updateEmbedValidationStatus=(t,n)=>{this.embedsValidationStatus.set(t.id,n),Xt.delete(t)};updateEmbeddables=()=>{let t=new Set,n=!1;this.scene.getNonDeletedElements().filter(r=>{if(fr(r)){if(t.add(r.id),!this.embedsValidationStatus.has(r.id)){n=!0;let i=gf(r.link,this.props.validateEmbeddable);this.updateEmbedValidationStatus(r,i)}}else ss(r)&&t.add(r.id);return!1}),n&&this.scene.informMutation(),this.iFrameRefs.forEach((r,i)=>{t.has(i)||this.iFrameRefs.delete(i)})};renderEmbeddables(){let t=this.state.zoom.value,n=this.state.width,r=this.state.height,i=this.scene.getNonDeletedElements().filter(a=>fr(a)&&this.embedsValidationStatus.get(a.id)===!0||ss(a));return(0,We.jsx)(We.Fragment,{children:i.map(a=>{let{x:o,y:s}=Gi({sceneX:a.x,sceneY:a.y},this.state),l=Gf(a,n,r,this.state,this.scene.getNonDeletedElementsMap()),c=this.initializedEmbeds.has(a.id);if(l&&!c&&this.initializedEmbeds.add(a.id),!(l||c))return null;let d;if(ss(a)){d=null;let m=(a.customData?.generationData??this.magicGenerations.get(a.id))||{status:"error",message:"No generation data",code:"ERR_NO_GENERATION_DATA"};if(m.status==="done"){let p=m.html;d={intrinsicSize:{w:a.width,h:a.height},type:"document",srcdoc:()=>p}}else if(m.status==="pending")d={intrinsicSize:{w:a.width,h:a.height},type:"document",srcdoc:()=>ff(`
205
+ <style>
206
+ html, body {
207
+ width: 100%;
208
+ height: 100%;
209
+ color: ${this.state.theme===ze.DARK?"white":"black"};
210
+ }
211
+ body {
212
+ display: flex;
213
+ align-items: center;
214
+ justify-content: center;
215
+ flex-direction: column;
216
+ gap: 1rem;
217
+ }
218
+
219
+ .Spinner {
220
+ display: flex;
221
+ align-items: center;
222
+ justify-content: center;
223
+ margin-left: auto;
224
+ margin-right: auto;
225
+ }
226
+
227
+ .Spinner svg {
228
+ animation: rotate 1.6s linear infinite;
229
+ transform-origin: center center;
230
+ width: 40px;
231
+ height: 40px;
232
+ }
233
+
234
+ .Spinner circle {
235
+ stroke: currentColor;
236
+ animation: dash 1.6s linear 0s infinite;
237
+ stroke-linecap: round;
238
+ }
239
+
240
+ @keyframes rotate {
241
+ 100% {
242
+ transform: rotate(360deg);
243
+ }
244
+ }
245
+
246
+ @keyframes dash {
247
+ 0% {
248
+ stroke-dasharray: 1, 300;
249
+ stroke-dashoffset: 0;
250
+ }
251
+ 50% {
252
+ stroke-dasharray: 150, 300;
253
+ stroke-dashoffset: -200;
254
+ }
255
+ 100% {
256
+ stroke-dasharray: 1, 300;
257
+ stroke-dashoffset: -280;
258
+ }
259
+ }
260
+ </style>
261
+ <div class="Spinner">
262
+ <svg
263
+ viewBox="0 0 100 100"
264
+ >
265
+ <circle
266
+ cx="50"
267
+ cy="50"
268
+ r="46"
269
+ stroke-width="8"
270
+ fill="none"
271
+ stroke-miter-limit="10"
272
+ />
273
+ </svg>
274
+ </div>
275
+ <div>Generating...</div>
276
+ `)};else{let p;m.code==="ERR_GENERATION_INTERRUPTED"?p="Generation was interrupted...":p=m.message||"Generation failed",d={intrinsicSize:{w:a.width,h:a.height},type:"document",srcdoc:()=>ff(`
277
+ <style>
278
+ html, body {
279
+ height: 100%;
280
+ }
281
+ body {
282
+ display: flex;
283
+ flex-direction: column;
284
+ align-items: center;
285
+ justify-content: center;
286
+ color: ${Ge.red[3]};
287
+ }
288
+ h1, h3 {
289
+ margin-top: 0;
290
+ margin-bottom: 0.5rem;
291
+ }
292
+ </style>
293
+ <h1>Error!</h1>
294
+ <h3>${p}</h3>
295
+ `)}}}else d=Kc(ST(a.link||""));let u=this.state.activeEmbeddable?.element===a&&this.state.activeEmbeddable?.state==="active",h=this.state.activeEmbeddable?.element===a&&this.state.activeEmbeddable?.state==="hover";return(0,We.jsx)("div",{className:X("excalidraw__embeddable-container",{"is-hovered":h}),style:{transform:l?`translate(${o-this.state.offsetLeft}px, ${s-this.state.offsetTop}px) scale(${t})`:"none",display:l?"block":"none",opacity:x4(a,Zr(a,this.scene.getNonDeletedElementsMap()),this.elementsPendingErasure),"--embeddable-radius":`${Ol(Math.min(a.width,a.height),a)}px`},children:(0,We.jsxs)("div",{className:"excalidraw__embeddable-container__inner",style:{width:l?`${a.width}px`:0,height:l?`${a.height}px`:0,transform:l?`rotate(${a.angle}rad)`:"none",pointerEvents:u?Rc.enabled:Rc.disabled},children:[h&&(0,We.jsx)("div",{className:"excalidraw__embeddable-hint",children:x("buttons.embeddableInteractionButton")}),(0,We.jsx)("div",{className:"excalidraw__embeddable__outer",style:{padding:`${a.strokeWidth}px`},children:(fr(a)?this.props.renderEmbeddable?.(a,this.state):null)??(0,We.jsx)("iframe",{ref:m=>this.cacheEmbeddableRef(a,m),className:"excalidraw__embeddable",srcDoc:d?.type==="document"?d.srcdoc(this.state.theme):void 0,src:d?.type!=="document"?d?.link??"":void 0,scrolling:"no",referrerPolicy:"no-referrer-when-downgrade",title:"Excalidraw Embedded Content",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,sandbox:`${d?.sandbox?.allowSameOrigin?"allow-same-origin":""} allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads`})})]})},a.id)})})}getFrameNameDOMId=t=>`${this.id}-frame-name-${t.id}`;frameNameBoundsCache={get:t=>{let n=this.frameNameBoundsCache._cache.get(t.id);if(!n||n.zoom!==this.state.zoom.value||n.versionNonce!==t.versionNonce){let r=document.getElementById(this.getFrameNameDOMId(t));if(r){let i=r.getBoundingClientRect(),a=Ft({clientX:i.x,clientY:i.y},this.state),o=Ft({clientX:i.right,clientY:i.bottom},this.state);return n={x:a.x,y:a.y,width:o.x-a.x,height:o.y-a.y,angle:0,zoom:this.state.zoom.value,versionNonce:t.versionNonce},this.frameNameBoundsCache._cache.set(t.id,n),n}return null}return n},_cache:new Map};renderFrameNames=()=>{if(!this.state.frameRendering.enabled||!this.state.frameRendering.name)return null;let t=this.state.theme===ze.DARK,n=0,r=0;return this.scene.getNonDeletedFramesLikes().map(i=>{if(xh(i)?n++:r++,!Gf(i,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap()))return null;let{x:a,y:o}=Gi({sceneX:i.x,sceneY:i.y},this.state),s=6,l=()=>{ie(i,{name:i.name?.trim()||null}),this.setState({editingFrame:null})},c,d=KT(i,xh(i)?n:r);if(i.id===this.state.editingFrame){let u=d;c=(0,We.jsx)("input",{autoFocus:!0,value:u,onChange:h=>{ie(i,{name:h.target.value})},onFocus:h=>h.target.select(),onBlur:()=>l(),onKeyDown:h=>{(h.key===N.ESCAPE||h.key===N.ENTER)&&l()},style:{background:this.state.viewBackgroundColor,filter:t?Zb:"none",zIndex:2,border:"none",display:"block",padding:`${s}px`,borderRadius:4,boxShadow:"inset 0 0 0 1px var(--color-primary)",fontFamily:"Assistant",fontSize:"14px",transform:`translate(-${s}px, ${s}px)`,color:"var(--color-gray-80)",overflow:"hidden",maxWidth:`${document.body.clientWidth-a-s}px`},size:u.length+1||1,dir:"auto",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off"})}else c=d;return(0,We.jsx)("div",{id:this.getFrameNameDOMId(i),style:{position:"absolute",bottom:`${this.state.height+Kt.nameOffsetY-o+this.state.offsetTop}px`,left:`${a-this.state.offsetLeft}px`,zIndex:2,fontSize:Kt.nameFontSize,color:t?Kt.nameColorDarkTheme:Kt.nameColorLightTheme,lineHeight:Kt.nameLineHeight,width:"max-content",maxWidth:`${i.width}px`,overflow:i.id===this.state.editingFrame?"visible":"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",cursor:gt.MOVE,pointerEvents:this.state.viewModeEnabled?Rc.disabled:Rc.enabled},onPointerDown:u=>this.handleCanvasPointerDown(u),onWheel:u=>this.handleWheel(u),onContextMenu:this.handleCanvasContextMenu,onDoubleClick:()=>{this.setState({editingFrame:i.id})},children:c},i.id)})};toggleOverscrollBehavior(t){document.documentElement.style.overscrollBehaviorX=t.type==="pointerenter"?"none":"auto"}render(){let t=this.scene.getSelectedElements(this.state),{renderTopRightUI:n,renderCustomStats:r}=this.props,i=this.scene.getVersionNonce(),{elementsMap:a,visibleElements:o}=this.renderer.getRenderableElements({versionNonce:i,zoom:this.state.zoom,offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,height:this.state.height,width:this.state.width,editingElement:this.state.editingElement,pendingImageElementId:this.state.pendingImageElementId}),s=this.scene.getNonDeletedElementsMap(),l=!(this.state.editingElement&&Be(this.state.editingElement))&&(this.state.selectionElement||this.state.draggingElement||this.state.resizingElement||this.state.activeTool.type==="laser"&&this.state.cursorButton==="down"||this.state.editingElement&&!he(this.state.editingElement)),c=t[0];return(0,We.jsx)("div",{className:X("excalidraw excalidraw-container",{"excalidraw--view-mode":this.state.viewModeEnabled,"excalidraw--mobile":this.device.editor.isMobile,"excalidraw--zen-mode":this.state.zenModeEnabled}),style:{"--ui-pointerEvents":l?Rc.disabled:Rc.enabled},ref:this.excalidrawContainerRef,onDrop:this.handleAppOnDrop,tabIndex:0,onKeyDown:this.props.handleKeyboardGlobally?void 0:this.onKeyDown,onPointerEnter:this.toggleOverscrollBehavior,onPointerLeave:this.toggleOverscrollBehavior,children:(0,We.jsx)(a5.Provider,{value:this,children:(0,We.jsx)(o5.Provider,{value:this.props,children:(0,We.jsx)(D2.Provider,{value:this.excalidrawContainerValue,children:(0,We.jsx)(P2.Provider,{value:this.device,children:(0,We.jsx)(R2.Provider,{value:this.setAppState,children:(0,We.jsx)(L2.Provider,{value:this.state,children:(0,We.jsxs)(_2.Provider,{value:this.scene.getNonDeletedElements(),children:[(0,We.jsxs)(O2.Provider,{value:this.actionManager,children:[(0,We.jsx)(ZW,{onHomeButtonClick:this.props.onHomeButtonClick||(()=>{}),canvas:this.canvas,appState:this.state,files:this.files,setAppState:this.setAppState,actionManager:this.actionManager,elements:this.scene.getNonDeletedElements(),onLockToggle:this.toggleLock,onPenModeToggle:this.togglePenMode,onHandToolToggle:this.onHandToolToggle,langCode:zh().code,renderCustomStats:r,showExitZenModeBtn:typeof this.props?.zenModeEnabled>"u"&&this.state.zenModeEnabled,UIOptions:this.props.UIOptions,onExportImage:this.onExportImage,renderWelcomeScreen:!this.state.isLoading&&this.state.showWelcomeScreen&&this.state.activeTool.type==="selection"&&!this.state.zenModeEnabled&&!this.scene.getElementsIncludingDeleted().length,app:this,isCollaborating:this.props.isCollaborating,openAIKey:this.OPENAI_KEY,isOpenAIKeyPersisted:this.OPENAI_KEY_IS_PERSISTED,onOpenAIAPIKeyChange:this.onOpenAIKeyChange,onMagicSettingsConfirm:this.onMagicSettingsConfirm,renderTopRightUI:n,uiDisabled:this.props.ui===!1,children:this.props.children}),(0,We.jsx)("div",{className:"excalidraw-textEditorContainer"}),(0,We.jsx)("div",{className:"excalidraw-contextMenuContainer"}),(0,We.jsx)("div",{className:"excalidraw-eye-dropper-container"}),(0,We.jsx)(gV,{trails:[this.laserTrails,this.eraserTrail]}),t.length===1&&this.state.showHyperlinkPopup&&(0,We.jsx)(PG,{element:c,elementsMap:s,setAppState:this.setAppState,onLinkOpen:this.props.onLinkOpen,setToast:this.setToast,updateEmbedValidationStatus:this.updateEmbedValidationStatus},c.id),this.props.aiEnabled!==!1&&t.length===1&&Zu(c)&&(0,We.jsx)(GC,{element:c,elementsMap:a,children:(0,We.jsx)(xE,{title:x("labels.convertToCode"),icon:k1,checked:!1,onChange:()=>this.onMagicFrameGenerate(c,"button")})}),t.length===1&&ss(c)&&c.customData?.generationData?.status==="done"&&(0,We.jsxs)(GC,{element:c,elementsMap:a,children:[(0,We.jsx)(xE,{title:x("labels.copySource"),icon:yy,checked:!1,onChange:()=>this.onIframeSrcCopy(c)}),(0,We.jsx)(xE,{title:"Enter fullscreen",icon:bM,checked:!1,onChange:()=>{let d=this.getHTMLIFrameElement(c);if(d)try{d.requestFullscreen(),this.setState({activeEmbeddable:{element:c,state:"active"},selectedElementIds:{[c.id]:!0},draggingElement:null,selectionElement:null})}catch(u){console.warn(u),this.setState({errorMessage:"Couldn't enter fullscreen"})}}})]}),this.state.toast!==null&&(0,We.jsx)(KW,{message:this.state.toast.message,onClose:()=>this.setToast(null),duration:this.state.toast.duration,closable:this.state.toast.closable}),this.state.contextMenu&&this.props.interactive!==!1&&this.props.ui!==!1&&(0,We.jsx)(Uj,{items:this.state.contextMenu.items,top:this.state.contextMenu.top,left:this.state.contextMenu.left,actionManager:this.actionManager,onClose:d=>{this.setState({contextMenu:null},()=>{this.focusContainer(),d?.()})}}),(0,We.jsx)(fV,{canvas:this.canvas,rc:this.rc,elementsMap:a,allElementsMap:s,visibleElements:o,versionNonce:i,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:!0,canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure}}),(0,We.jsx)(mV,{containerRef:this.excalidrawContainerRef,canvas:this.interactiveCanvas,elementsMap:a,visibleElements:o,selectedElements:t,versionNonce:i,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,device:this.device,renderInteractiveSceneCallback:this.renderInteractiveSceneCallback,handleCanvasRef:this.handleInteractiveCanvasRef,onContextMenu:this.handleCanvasContextMenu,onPointerMove:this.handleCanvasPointerMove,onPointerUp:this.handleCanvasPointerUp,onPointerCancel:this.removePointer,onTouchMove:this.handleTouchMove,onPointerDown:this.handleCanvasPointerDown,onDoubleClick:this.handleCanvasDoubleClick}),this.state.userToFollow&&(0,We.jsx)(yV,{width:this.state.width,height:this.state.height,userToFollow:this.state.userToFollow,onDisconnect:this.maybeUnfollowRemoteUser}),this.renderFrameNames()]}),this.renderEmbeddables()]})})})})})})})})}focusContainer=()=>{this.excalidrawContainerRef.current?.focus()};getSceneElementsIncludingDeleted=()=>this.scene.getElementsIncludingDeleted();getSceneElements=()=>this.scene.getNonDeletedElements();onInsertElements=t=>{this.addElementsFromPasteOrLibrary({elements:t,position:"center",files:null})};onExportImage=async(t,n,r)=>{dt("export",t,"ui");let i=await Jf({type:t,data:{elements:n,appState:this.state,files:this.files},config:{exportBackground:this.state.exportBackground,name:this.getName(),viewBackgroundColor:this.state.viewBackgroundColor,exportingFrame:r.exportingFrame}}).catch(eT).catch(a=>{console.error(a),this.setState({errorMessage:a.message})});this.state.exportEmbedScene&&i&&oy(i)&&this.setState({fileHandle:i})};magicGenerations=new Map;updateMagicGeneration=({frameElement:t,data:n})=>{n.status==="pending"?ie(t,{customData:{generationData:void 0}},!1):ie(t,{customData:{generationData:n}},!1),this.magicGenerations.set(t.id,n),this.onSceneUpdated()};getTextFromElements(t){return t.reduce((n,r)=>(he(r)&&n.push(r.text),n),[]).join(`
296
+
297
+ `)}async onMagicFrameGenerate(t,n){if(!this.OPENAI_KEY){this.setState({openDialog:{name:"settings",tab:"diagram-to-code",source:"generation"}}),dt("ai","generate (missing key)","d2c");return}let r=cy(this.scene.getNonDeletedElements(),t).filter(u=>!Zu(u));if(!r.length){n==="button"?(this.setState({errorMessage:"Cannot generate from an empty frame"}),dt("ai","generate (no-children)","d2c")):this.setActiveTool({type:"magicframe"});return}let i=this.insertIframeElement({sceneX:t.x+t.width+30,sceneY:t.y,width:t.width,height:t.height});if(!i)return;this.updateMagicGeneration({frameElement:i,data:{status:"pending"}}),this.setState({selectedElementIds:{[i.id]:!0}});let a=await g4({data:{elements:this.scene.getNonDeletedElements(),appState:{...this.state,exportBackground:!0,viewBackgroundColor:this.state.viewBackgroundColor},files:this.files},config:{exportingFrame:t}}),o=await lE(a),s=this.getTextFromElements(r);dt("ai","generate (start)","d2c");let l=await Sae({image:o,apiKey:this.OPENAI_KEY,text:s,theme:this.state.theme});if(!l.ok){dt("ai","generate (failed)","d2c"),console.error(l.error),this.updateMagicGeneration({frameElement:i,data:{status:"error",code:"ERR_OAI",message:l.error?.message||"Unknown error during generation"}});return}if(dt("ai","generate (success)","d2c"),l.choices[0].message.content==null){this.updateMagicGeneration({frameElement:i,data:{status:"error",code:"ERR_OAI",message:"Nothing genereated :("}});return}let c=l.choices[0].message.content,d=c.slice(c.indexOf("<!DOCTYPE html>"),c.indexOf("</html>")+7);this.updateMagicGeneration({frameElement:i,data:{status:"done",html:d}})}onIframeSrcCopy(t){t.customData?.generationData?.status==="done"&&(Mh(t.customData.generationData.html),this.setToast({message:"copied to clipboard",closable:!1,duration:1500}))}OPENAI_KEY=ks.get(Cs.OAI_API_KEY);OPENAI_KEY_IS_PERSISTED=ks.has(Cs.OAI_API_KEY)||!1;onOpenAIKeyChange=(t,n)=>{if(this.OPENAI_KEY=t||null,n){let r=ks.set(Cs.OAI_API_KEY,t);this.OPENAI_KEY_IS_PERSISTED=r}else this.OPENAI_KEY_IS_PERSISTED=!1};onMagicSettingsConfirm=(t,n,r)=>{if(this.OPENAI_KEY=t||null,this.onOpenAIKeyChange(this.OPENAI_KEY,n),r==="settings")return;let i=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});t?i.length?this.onMagicframeToolSelect():this.setActiveTool({type:"magicframe"}):Zu(i[0])||this.setActiveTool({type:"magicframe"})};onMagicframeToolSelect=()=>{if(!this.OPENAI_KEY){this.setState({openDialog:{name:"settings",tab:"diagram-to-code",source:"tool"}}),dt("ai","tool-select (missing key)","d2c");return}let t=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});if(t.length===0)this.setActiveTool({type:$n.magicframe}),dt("ai","tool-select (empty-selection)","d2c");else{let n=t.length===1&&Zu(t[0])&&t[0];if(!n&&t.some(i=>Ae(i)||i.frameId)){this.setActiveTool({type:$n.magicframe});return}dt("ai","tool-select (existing selection)","d2c");let r;if(n)r=n;else{let[i,a,o,s]=Bt(t),l=50;r=jE({...Kt,x:i-l,y:a-l,width:o-i+l*2,height:s-a+l*2,opacity:100,locked:!1}),this.scene.insertElement(r);for(let c of t)ie(c,{frameId:r.id});this.setState({selectedElementIds:{[r.id]:!0}})}this.onMagicFrameGenerate(r,"upstream")}};openEyeDropper=({type:t})=>{Pa.set(_1,{swapPreviewOnAlt:!0,colorPickerType:t==="stroke"?"elementStroke":"elementBackground",onSelect:(n,r)=>{let i=t==="background"&&r.altKey||t==="stroke"&&!r.altKey;!this.scene.getSelectedElements(this.state).length||this.state.activeTool.type!=="selection"?i?this.syncActionResult({appState:{...this.state,currentItemStrokeColor:n},storeAction:Z.CAPTURE}):this.syncActionResult({appState:{...this.state,currentItemBackgroundColor:n},storeAction:Z.CAPTURE}):this.updateScene({elements:this.scene.getElementsIncludingDeleted().map(a=>this.state.selectedElementIds[a.id]?Re(a,{[i?"strokeColor":"backgroundColor"]:n}):a),storeAction:Z.CAPTURE})},keepOpenOnAlt:!1})};syncActionResult=Gt(t=>{if(this.unmounted||t===!1)return;let n=null;if(t.elements&&(t.elements.forEach(r=>{this.state.editingElement?.id===r.id&&this.state.editingElement!==r&&ob(r)&&(n=r)}),t.storeAction===Z.UPDATE?this.store.shouldUpdateSnapshot():t.storeAction===Z.CAPTURE&&this.store.shouldCaptureIncrement(),this.scene.replaceAllElements(t.elements)),t.files&&(this.files=t.replaceFiles?t.files:{...this.files,...t.files},this.addNewImagesToImageCache()),t.appState||n||this.state.contextMenu){t.storeAction===Z.UPDATE?this.store.shouldUpdateSnapshot():t.storeAction===Z.CAPTURE&&this.store.shouldCaptureIncrement();let r=t?.appState?.viewModeEnabled||!1,i=t?.appState?.zenModeEnabled||!1,a=t?.appState?.gridSize||null,o=t?.appState?.theme||this.props.theme||ze.LIGHT,s=t?.appState?.name??this.state.name,l=t?.appState?.errorMessage??this.state.errorMessage;typeof this.props.viewModeEnabled<"u"&&(r=this.props.viewModeEnabled),typeof this.props.zenModeEnabled<"u"&&(i=this.props.zenModeEnabled),typeof this.props.gridModeEnabled<"u"&&(a=this.props.gridModeEnabled?td:null),n=n||t.appState?.editingElement||null,n?.isDeleted&&(n=null),this.setState(c=>Object.assign(t.appState||{},{contextMenu:null,editingElement:n,viewModeEnabled:r,zenModeEnabled:i,gridSize:a,theme:o,name:s,errorMessage:l}))}});onBlur=Gt(()=>{dl=!1,this.setState({isBindingEnabled:!0})});onUnload=()=>{this.onBlur()};disableEvent=t=>{t.preventDefault()};resetHistory=()=>{this.history.clear()};resetStore=()=>{this.store.clear()};resetScene=Gt(t=>{this.scene.replaceAllElements([]),this.setState(n=>({...Ms(),isLoading:t?.resetLoadingState?!1:n.isLoading,theme:this.state.theme})),this.resetStore(),this.resetHistory()});initializeScene=async()=>{"launchQueue"in window&&"LaunchParams"in window&&window.launchQueue.setConsumer(async r=>{if(!r.files.length)return;let i=r.files[0],a=await i.getFile();this.loadFileToCanvas(new File([a],a.name||"",{type:a.type}),i)}),this.props.theme&&this.setState({theme:this.props.theme}),this.state.isLoading||this.setState({isLoading:!0});let t=null;try{t=await this.props.initialData||null,t?.libraryItems&&this.library.updateLibrary({libraryItems:t.libraryItems,merge:!0}).catch(r=>{console.error(r)})}catch(r){console.error(r),t={appState:{errorMessage:r.message||"Encountered an error during importing or restoring scene data"}}}let n=iy(t,null,null,{repairBindings:!0});n.appState={...n.appState,theme:this.props.theme||n.appState.theme,openSidebar:n.appState?.openSidebar||this.state.openSidebar,activeTool:n.appState.activeTool.type==="image"?{...n.appState.activeTool,type:"selection"}:n.appState.activeTool,isLoading:!1,toast:this.state.toast},t?.scrollToContent&&(n.appState={...n.appState,...Ph(n.elements,{...n.appState,width:this.state.width,height:this.state.height,offsetTop:this.state.offsetTop,offsetLeft:this.state.offsetLeft})}),this.fonts.loadFontsForElements(n.elements),this.resetStore(),t?.scrollX!=null&&(n.appState.scrollX=t.scrollX),t?.scrollY!=null&&(n.appState.scrollY=t.scrollY),this.resetHistory(),this.syncActionResult({...n,storeAction:Z.UPDATE})};isMobileBreakpoint=(t,n)=>t<nB||n<iB&&t<rB;refreshViewportBreakpoints=()=>{if(!this.excalidrawContainerRef.current)return;let{clientWidth:t,clientHeight:n}=document.body,r=this.device.viewport,i=sf(r,{isLandscape:t>n,isMobile:this.isMobileBreakpoint(t,n)});return r!==i?(this.device={...this.device,viewport:i},!0):!1};refreshEditorBreakpoints=()=>{let t=this.excalidrawContainerRef.current;if(!t)return;let{width:n,height:r}=t.getBoundingClientRect(),i=this.props.UIOptions.dockedSidebarBreakpoint!=null?this.props.UIOptions.dockedSidebarBreakpoint:aB,a=this.device.editor,o=sf(a,{isMobile:this.isMobileBreakpoint(n,r),canFitSidebar:n>i});return a!==o?(this.device={...this.device,editor:o},!0):!1};async componentDidMount(){if(this.unmounted=!1,this.excalidrawContainerValue.container=this.excalidrawContainerRef.current,Ne.MODE===xa.TEST||Ne.DEV){let t=this.setState.bind(this);Object.defineProperties(window.h,{state:{configurable:!0,get:()=>this.state},setState:{configurable:!0,value:(...n)=>this.setState(...n)},app:{configurable:!0,value:this},history:{configurable:!0,value:this.history},store:{configurable:!0,value:this.store}})}this.store.onStoreIncrementEmitter.on(t=>{this.history.record(t.elementsChange,t.appStateChange)}),this.scene.addCallback(this.onSceneUpdated),this.addEventListeners(),this.props.autoFocus&&this.excalidrawContainerRef.current&&this.focusContainer(),$l()||(this.refreshViewportBreakpoints(),this.refreshEditorBreakpoints()),TE&&this.excalidrawContainerRef.current&&(this.resizeObserver=new ResizeObserver(()=>{this.refreshEditorBreakpoints(),this.updateDOMRect()}),this.resizeObserver?.observe(this.excalidrawContainerRef.current)),new URLSearchParams(window.location.search.slice(1)).has("web-share-target")?this.restoreFileFromShare():this.updateDOMRect(this.initializeScene),jF()&&!mz()&&this.setState({errorMessage:(0,We.jsx)(oV,{})})}componentWillUnmount(){this.renderer.destroy(),this.scene=new _r,this.renderer=new HC(this.scene),this.files={},this.imageCache.clear(),this.resizeObserver?.disconnect(),this.unmounted=!0,this.removeEventListeners(),this.scene.destroy(),this.library.destroy(),this.laserTrails.stop(),this.eraserTrail.stop(),this.onChangeEmitter.clear(),this.store.onStoreIncrementEmitter.clear(),Xt.destroy(),Eo.destroy(),TH(),this.onChangeEmitter.clear(),Ne.PROD&&(this.history=new fE,this.library=new G4(this),this.actionManager=new aC(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.canvas=null,this.interactiveCanvas=null,this.rc=null,this.excalidrawContainerRef.current=void 0,this.nearestScrollableContainer=void 0,this.excalidrawContainerValue={container:null,id:"unmounted"}),clearTimeout(as),vn.clearCache(),jr.clearCache(),as=0,document.documentElement.style.overscrollBehaviorX=""}onResize=Gt(()=>{this.scene.getElementsIncludingDeleted().forEach(t=>Xt.delete(t)),this.refreshViewportBreakpoints(),this.updateDOMRect(),TE||this.refreshEditorBreakpoints(),this.setState({})});onFullscreenChange=()=>{!document.fullscreenElement&&this.state.activeEmbeddable?.state==="active"&&this.setState({activeEmbeddable:null})};removeEventListeners(){this.onRemoveEventListenersEmitter.trigger()}addEventListeners(){this.removeEventListeners(),this.props.handleKeyboardGlobally&&this.onRemoveEventListenersEmitter.once(cn(document,"keydown",this.onKeyDown,!1)),this.onRemoveEventListenersEmitter.once(cn(this.excalidrawContainerRef.current,"wheel",this.onWheel,{passive:!1}),cn(window,"message",this.onWindowMessage,!1),cn(document,"pointerup",this.removePointer),cn(document,"copy",this.onCopy),cn(document,"keyup",this.onKeyUp,{passive:!0}),cn(document,"mousemove",this.updateCurrentCursorPosition),cn(document.fonts,"loadingdone",t=>{let n=t.fontfaces;this.fonts.onFontsLoaded(n)}),cn(document,"gesturestart",this.onGestureStart,!1),cn(document,"gesturechange",this.onGestureChange,!1),cn(document,"gestureend",this.onGestureEnd,!1),cn(window,"focus",()=>{this.maybeCleanupAfterMissingPointerUp(null)})),!this.state.viewModeEnabled&&(this.onRemoveEventListenersEmitter.once(cn(document,"fullscreenchange",this.onFullscreenChange),cn(document,"paste",this.pasteFromClipboard),cn(document,"cut",this.onCut),cn(window,"resize",this.onResize,!1),cn(window,"unload",this.onUnload,!1),cn(window,"blur",this.onBlur,!1),cn(this.excalidrawContainerRef.current,"dragover",this.disableEvent,!1),cn(this.excalidrawContainerRef.current,"drop",this.disableEvent,!1)),this.props.detectScroll&&this.onRemoveEventListenersEmitter.once(cn(yB(this.excalidrawContainerRef.current),"scroll",this.onScroll)))}componentDidUpdate(t,n){this.updateEmbeddables();let r=this.scene.getElementsIncludingDeleted(),i=this.scene.getElementsMapIncludingDeleted(),a=this.scene.getNonDeletedElementsMap();!this.state.showWelcomeScreen&&!r.length&&this.setState({showWelcomeScreen:!0}),t.UIOptions.dockedSidebarBreakpoint!==this.props.UIOptions.dockedSidebarBreakpoint&&this.refreshEditorBreakpoints(),n.userToFollow&&!this.state.collaborators.has(n.userToFollow.socketId)&&this.maybeUnfollowRemoteUser(),this.props.activeTool&&this.props.activeTool.type!==this.state.activeTool.type&&this.setActiveTool(this.props.activeTool),(n.zoom.value!==this.state.zoom.value||n.scrollX!==this.state.scrollX||n.scrollY!==this.state.scrollY)&&(this.props?.onScrollChange?.(this.state.scrollX,this.state.scrollY,this.state.zoom),this.onScrollChangeEmitter.trigger(this.state.scrollX,this.state.scrollY,this.state.zoom)),n.userToFollow!==this.state.userToFollow&&(n.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:n.userToFollow,action:"UNFOLLOW"}),this.state.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:this.state.userToFollow,action:"FOLLOW"})),Object.keys(this.state.selectedElementIds).length&&ya(this.state)&&this.setState({activeTool:hn(this.state,{type:"selection"})}),this.state.activeTool.type==="eraser"&&n.theme!==this.state.theme&&Z5(this.interactiveCanvas,this.state.theme),n.activeTool.type==="selection"&&this.state.activeTool.type!=="selection"&&this.state.showHyperlinkPopup&&this.setState({showHyperlinkPopup:!1}),t.langCode!==this.props.langCode&&this.updateLanguage(),ya(n)&&!ya(this.state)&&this.eraserTrail.endPath(),t.viewModeEnabled!==this.props.viewModeEnabled&&this.setState({viewModeEnabled:!!this.props.viewModeEnabled}),n.viewModeEnabled!==this.state.viewModeEnabled&&(this.addEventListeners(),this.deselectElements()),t.zenModeEnabled!==this.props.zenModeEnabled&&this.setState({zenModeEnabled:!!this.props.zenModeEnabled}),t.theme!==this.props.theme&&this.props.theme&&this.setState({theme:this.props.theme}),t.gridModeEnabled!==this.props.gridModeEnabled&&this.setState({gridSize:this.props.gridModeEnabled?td:null}),!this.props.UIOptions.canvasActions&&this.state.openMenu==="canvas"&&this.setState({openMenu:null}),this.excalidrawContainerRef.current?.classList.toggle("theme--dark",this.state.theme===ze.DARK),this.state.editingLinearElement&&!this.state.selectedElementIds[this.state.editingLinearElement.elementId]&&setTimeout(()=>{this.state.editingLinearElement&&this.actionManager.executeAction(Ri)}),this.state.editingElement?.isDeleted&&this.setState({editingElement:null}),this.state.selectedLinearElement&&!this.state.selectedElementIds[this.state.selectedLinearElement.elementId]&&this.setState({selectedLinearElement:null});let{multiElement:o}=n;n.activeTool!==this.state.activeTool&&o!=null&&Tl(this.state)&&kr(o,!1)&&HE(o,this.state,Es(fe.getPointAtIndexGlobalCoordinates(o,-1,a)),this),this.store.commit(i,this.state),this.state.isLoading||(this.props.onChange?.(r,this.state,this.files,this.props.id),this.onChangeEmitter.trigger(r,this.state,this.files))}renderInteractiveSceneCallback=({atLeastOneVisibleElement:t,scrollBars:n,elementsMap:r})=>{n&&(F2=n);let i=he(this.state.editingElement)?!1:!t&&r.size>0;this.state.scrolledOutside!==i&&this.setState({scrolledOutside:i}),this.scheduleImageRefresh()};onScroll=Pf(()=>{let{offsetTop:t,offsetLeft:n}=this.getCanvasOffsets();this.setState(r=>r.offsetLeft===n&&r.offsetTop===t?null:{offsetTop:t,offsetLeft:n})},eB);onCut=Gt(t=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||ds(t.target)||(this.actionManager.executeAction(Ob,"keyboard",t),t.preventDefault(),t.stopPropagation())});onCopy=Gt(t=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||ds(t.target)||(this.actionManager.executeAction(uh,"keyboard",t),t.preventDefault(),t.stopPropagation())});static resetTapTwice(){Ru=!1}onTouchStart=t=>{if(YC&&t.preventDefault(),this.props.interactive!==!1){if(!Ru){Ru=!0,clearTimeout(N2),N2=window.setTimeout(IV.resetTapTwice,QF);return}if(Ru&&t.touches.length===1){let n=t.touches[0];this.handleCanvasDoubleClick({clientX:n.clientX,clientY:n.clientY}),Ru=!1,clearTimeout(N2)}t.touches.length===2&&this.setState({selectedElementIds:lt({},this.state),activeEmbeddable:null})}};onTouchEnd=t=>{this.props.interactive!==!1&&(this.resetContextMenuTimer(),t.touches.length>0?this.setState({previousSelectedElementIds:{},selectedElementIds:lt(this.state.previousSelectedElementIds,this.state)}):nt.pointers.clear())};pasteFromClipboard=Gt(async t=>{if(this.props.interactive===!1)return;let n=!!Fp,r=document.activeElement,i=this.excalidrawContainerRef.current?.contains(r);if(t&&!i)return;let a=document.elementFromPoint(this.lastViewportPosition.x,this.lastViewportPosition.y);if(t&&(!(a instanceof HTMLCanvasElement)||ds(r)))return;let{x:o,y:s}=Ft({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state),l=t?.clipboardData?.files[0],c=await jT(t,n);if(!l&&!n){if(c.mixedContent)return this.addElementsFromMixedContentPaste(c.mixedContent,{isPlainPaste:n,sceneX:o,sceneY:s});if(c.text){let d=c.text.trim();d.startsWith("<svg")&&d.endsWith("</svg>")&&(l=l4(d))}}if(vl(l)&&!c.spreadsheet){if(!this.isToolSupported("image")){this.setState({errorMessage:x("errors.imageToolNotSupported")});return}let d=this.createImageElement({sceneX:o,sceneY:s});this.insertImageElement(d,l),this.initializeImageDimensions(d),this.setState({selectedElementIds:lt({[d.id]:!0},this.state)});return}if(this.props.onPaste)try{if(await this.props.onPaste(c,t)===!1)return}catch(d){console.error(d)}if(c.errorMessage)this.setState({errorMessage:c.errorMessage});else if(c.spreadsheet&&!n)this.setState({pasteDialog:{data:c.spreadsheet,shown:!0}});else if(c.elements){let d=c.programmaticAPI?jA(c.elements):c.elements;this.addElementsFromPasteOrLibrary({elements:d,files:c.files||null,position:"cursor",retainSeed:n})}else if(c.text){let d=rT(c.text).split(/\n+/).map(h=>h.trim()).filter(Boolean),u=d.map(h=>Pz(h)).filter(h=>gf(h,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(h)||Kc(h)?.type==="video"));if(!Fp&&u.length>0&&u.length===d.length){let h=[];for(let m of u){let p=h[h.length-1],f=this.insertEmbeddableElement({sceneX:p?p.x+p.width+20:o,sceneY:s,link:Da(m)});f&&h.push(f)}h.length&&this.setState({selectedElementIds:Object.fromEntries(h.map(m=>[m.id,!0]))});return}this.addTextFromPaste(c.text,n)}this.setActiveTool({type:"selection"}),t?.preventDefault()});addElementsFromPasteOrLibrary=t=>{let n=sE(t.elements,null,void 0),[r,i,a,o]=Bt(n),s=nr(r,a)/2,l=nr(i,o)/2,c=typeof t.position=="object"?t.position.clientX:t.position==="cursor"?this.lastViewportPosition.x:this.state.width/2+this.state.offsetLeft,d=typeof t.position=="object"?t.position.clientY:t.position==="cursor"?this.lastViewportPosition.y:this.state.height/2+this.state.offsetTop,{x:u,y:h}=Ft({clientX:c,clientY:d},this.state),m=u-s,p=h-l,[f,g]=Vn(m,p,this.state.gridSize),b=MT(n.map(C=>Re(C,{x:C.x+f-r,y:C.y+g-i})),{randomizeSeed:!t.retainSeed}),v=[...this.scene.getElementsIncludingDeleted(),...b];Yi(v,ve(b));let y=this.getTopLayerFrameAtSceneCoords({x:u,y:h});if(y){let C=wH(b,y);yf(v,C,y)}this.scene.replaceAllElements(v),b.forEach(C=>{if(he(C)&&tn(C)){let A=Er(C,this.scene.getElementsMapIncludingDeleted());ji(C,A,this.scene.getElementsMapIncludingDeleted())}}),t.files&&(this.files={...this.files,...t.files}),this.store.shouldCaptureIncrement();let w=jf(b);this.setState({...this.state,openSidebar:this.state.openSidebar&&this.device.editor.canFitSidebar&&Pa.get(Hb)?this.state.openSidebar:null,...jr({editingGroupId:null,selectedElementIds:w.reduce((C,A)=>(tn(A)||(C[A.id]=!0),C),{})},this.scene.getNonDeletedElements(),this.state,this)},()=>{t.files&&this.addNewImagesToImageCache()}),this.setActiveTool({type:"selection"}),t.fitToContent&&this.scrollToContent(b,{fitToContent:!0})};async addElementsFromMixedContentPaste(t,{isPlainPaste:n,sceneX:r,sceneY:i}){if(!n&&t.some(a=>a.type==="imageUrl")&&this.isToolSupported("image")){let a=t.filter(u=>u.type==="imageUrl").map(u=>u.value),o=await Promise.all(a.map(async u=>{try{return{file:await Uz(u)}}catch(h){let m=h.message;return h.cause==="FETCH_ERROR"?m=x("errors.failedToFetchImage"):h.cause==="UNSUPPORTED"&&(m=x("errors.unsupportedFileType")),{errorMessage:m}}})),s=i,l=!1,c={};for(let u of o)if(u.file){let h=this.createImageElement({sceneX:r,sceneY:s}),m=await this.insertImageElement(h,u.file);m&&(l||(l=!0,s-=m.height/2),ie(m,{y:s},!1),s=h.y+h.height+25,c[h.id]=!0)}this.setState({selectedElementIds:lt(c,this.state)});let d=o.find(u=>!!u.errorMessage);d&&d.errorMessage&&this.setState({errorMessage:d.errorMessage})}else{let a=t.filter(o=>o.type==="text");a.length&&this.addTextFromPaste(a.map(o=>o.value).join(`
298
+
299
+ `),n)}}addTextFromPaste(t,n=!1){let{x:r,y:i}=Ft({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state),a={x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roundness:null,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:t,fontSize:this.state.currentItemFontSize,fontFamily:this.state.currentItemFontFamily,textAlign:this.state.currentItemTextAlign,verticalAlign:Mf,locked:!1},o=10,s=i,l=n?[t]:t.split(`
300
+ `),c=l.reduce((d,u,h)=>{let m=u.trim(),p=Fl(a.fontFamily);if(m.length){let f=this.getTopLayerFrameAtSceneCoords({x:r,y:s}),g=fi({...a,x:r,y:s,text:m,lineHeight:p,frameId:f?f.id:null});d.push(g),s+=g.height+o}else l[h-1]?.trim()&&(s+=ih(a.fontSize,p)+o);return d},[]);c.length!==0&&(this.scene.insertElements(c),this.setState({selectedElementIds:lt(Object.fromEntries(c.map(d=>[d.id,!0])),this.state)}),!n&&c.length>1&&c5===!1&&!this.device.editor.isMobile&&(this.setToast({message:x("toast.pasteAsSingleElement",{shortcut:K("CtrlOrCmd+Shift+V")}),duration:5e3}),c5=!0),this.store.shouldCaptureIncrement())}setAppState=(t,n)=>{this.setState(t,n)};removePointer=t=>{as&&this.resetContextMenuTimer(),nt.pointers.delete(t.pointerId)};toggleLock=(t="ui")=>{this.state.activeTool.locked||dt("toolbar","toggleLock",`${t} (${this.device.editor.isMobile?"mobile":"desktop"})`),this.setState(n=>({activeTool:{...n.activeTool,...hn(this.state,n.activeTool.locked?{type:"selection"}:n.activeTool),locked:!n.activeTool.locked}}))};updateFrameRendering=t=>{this.setState(n=>{let r=typeof t=="function"?t(n.frameRendering):t;return{frameRendering:{enabled:r?.enabled??n.frameRendering.enabled,clip:r?.clip??n.frameRendering.clip,name:r?.name??n.frameRendering.name,outline:r?.outline??n.frameRendering.outline}}})};togglePenMode=t=>{this.setState(n=>({penMode:t??!n.penMode,penDetected:!0}))};onHandToolToggle=()=>{this.actionManager.executeAction(tG)};zoomCanvas=t=>{this.setState({...Al({viewportX:this.state.width/2+this.state.offsetLeft,viewportY:this.state.height/2+this.state.offsetTop,nextZoom:Ml(t)},this.state)})};cancelInProgressAnimation=null;scrollToContent=(t=this.scene.getNonDeletedElements(),n)=>{this.cancelInProgressAnimation?.();let r=Array.isArray(t)?t:[t],i=this.state.zoom,a=this.state.scrollX,o=this.state.scrollY;if(n?.fitToContent||n?.fitToViewport){let{appState:s}=qp({targetElements:r,appState:this.state,fitToViewport:!!n?.fitToViewport,viewportZoomFactor:n?.viewportZoomFactor});i=s.zoom,a=s.scrollX,o=s.scrollY}else{let s=Ph(r,this.state);a=s.scrollX,o=s.scrollY}if(n?.animate){let s=this.state.scrollX,l=this.state.scrollY,c=this.state.zoom.value,d=EB({fromValues:{scrollX:s,scrollY:l,zoom:c},toValues:{scrollX:a,scrollY:o,zoom:i.value},interpolateValue:(u,h,m,p)=>{if(p==="zoom")return u*Math.pow(h/u,Dl(m))},onStep:({scrollX:u,scrollY:h,zoom:m})=>{this.setState({scrollX:u,scrollY:h,zoom:{value:m}})},onStart:()=>{this.setState({shouldCacheIgnoreZoom:!0})},onEnd:()=>{this.setState({shouldCacheIgnoreZoom:!1})},onCancel:()=>{this.setState({shouldCacheIgnoreZoom:!1})},duration:n?.duration??500});this.cancelInProgressAnimation=()=>{d(),this.cancelInProgressAnimation=null}}else this.setState({scrollX:a,scrollY:o,zoom:i})};maybeUnfollowRemoteUser=()=>{this.state.userToFollow&&this.setState({userToFollow:null})};translateCanvas=t=>{this.cancelInProgressAnimation?.(),this.maybeUnfollowRemoteUser(),this.setState(t)};setToast=t=>{this.setState({toast:t})};restoreFileFromShare=async()=>{try{let t=await caches.open("web-share-target"),n=await t.match("shared-file");if(n){let r=await n.blob(),i=new File([r],r.name||"",{type:r.type});this.loadFileToCanvas(i,null),await t.delete("shared-file"),window.history.replaceState(null,IE,window.location.pathname)}}catch(t){this.setState({errorMessage:t.message})}};addFiles=Gt(t=>{let n=t.reduce((r,i)=>(r.set(i.id,i),r),new Map);this.files={...this.files,...Object.fromEntries(n)},this.scene.getNonDeletedElements().forEach(r=>{Ma(r)&&n.has(r.fileId)&&(this.imageCache.delete(r.fileId),Xt.delete(r))}),this.scene.informMutation(),this.addNewImagesToImageCache()});updateScene=Gt(t=>{let n=wo(t.elements??[]);if(t.storeAction&&t.storeAction!==Z.NONE){let r=this.store.snapshot.appState,i=this.store.snapshot.elements,a=t.appState?Object.assign({},r,t.appState):r,o=t.elements?this.store.filterUncomittedElements(this.scene.getElementsMapIncludingDeleted(),ve(n)):i;t.storeAction===Z.CAPTURE?this.store.captureIncrement(o,a):t.storeAction===Z.UPDATE&&this.store.updateSnapshot(o,a)}t.appState&&this.setState(t.appState),t.elements&&this.scene.replaceAllElements(n),t.collaborators&&this.setState({collaborators:t.collaborators})});onSceneUpdated=()=>{this.setState({})};toggleSidebar=({name:t,tab:n,force:r})=>{let i;r===void 0?i=this.state.openSidebar?.name===t&&this.state.openSidebar?.tab===n?null:t:i=r?t:null;let a=i?{name:i}:null;return a&&n&&(a.tab=n),this.setState({openSidebar:a}),!!i};updateCurrentCursorPosition=Gt(t=>{this.lastViewportPosition.x=t.clientX,this.lastViewportPosition.y=t.clientY});onKeyDown=Gt(t=>{if("Proxy"in window&&(!t.shiftKey&&/^[A-Z]$/.test(t.key)||t.shiftKey&&/^[a-z]$/.test(t.key))&&(t=new Proxy(t,{get(a,o){let s=a[o];return typeof s=="function"?s.bind(a):o==="key"?t.shiftKey?a.key.toUpperCase():a.key.toLowerCase():s}})),t[N.CTRL_OR_CMD]&&t.key===N.P&&!t.shiftKey&&!t.altKey){this.setToast({message:x("commandPalette.shortcutHint",{shortcut:Dr("commandPalette")})}),t.preventDefault();return}if(t[N.CTRL_OR_CMD]&&t.key.toLowerCase()===N.V&&(Fp=t.shiftKey,clearTimeout(l5),l5=window.setTimeout(()=>{Fp=!1},100)),t[N.CTRL_OR_CMD]&&ds(t.target)&&(t.code===rt.MINUS||t.code===rt.EQUAL)){t.preventDefault();return}if(ds(t.target)&&t.key!==N.ESCAPE||df(t.key)&&x5(t.target))return;if(t.key===N.QUESTION_MARK){this.setState({openDialog:{name:"help"}});return}else if(t.key.toLowerCase()===N.E&&t.shiftKey&&t[N.CTRL_OR_CMD]){t.preventDefault(),this.setState({openDialog:{name:"imageExport"}});return}if(t.key===N.PAGE_UP||t.key===N.PAGE_DOWN){let a=(t.shiftKey?this.state.width:this.state.height)/this.state.zoom.value;t.key===N.PAGE_DOWN&&(a=-a),t.shiftKey?this.translateCanvas(o=>({scrollX:o.scrollX+a})):this.translateCanvas(o=>({scrollY:o.scrollY+a}))}if(this.actionManager.handleKeyDown(t)||this.state.viewModeEnabled)return;if(t[N.CTRL_OR_CMD]&&this.state.isBindingEnabled&&this.setState({isBindingEnabled:!1}),df(t.key)){let a=this.state.gridSize&&(t.shiftKey?p5:this.state.gridSize)||(t.shiftKey?WF:p5),o=0,s=0;t.key===N.ARROW_LEFT?o=-a:t.key===N.ARROW_RIGHT?o=a:t.key===N.ARROW_UP?s=-a:t.key===N.ARROW_DOWN&&(s=a);let l=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});l.forEach(c=>{ie(c,{x:c.x+o,y:c.y+s}),bo(c,this.scene.getNonDeletedElementsMap(),{simultaneouslyUpdated:l})}),this.maybeSuggestBindingForAll(l),t.preventDefault()}else if(t.key===N.ENTER){let a=this.scene.getSelectedElements(this.state);if(a.length===1){let o=a[0];if(t[N.CTRL_OR_CMD])Be(o)&&(!this.state.editingLinearElement||this.state.editingLinearElement.elementId!==a[0].id)&&(this.store.shouldCaptureIncrement(),this.setState({editingLinearElement:new fe(o)}));else if(he(o)||hz(o)){let s;he(o)||(s=o);let l=rE(o,this.state,this.scene.getNonDeletedElementsMap()),c=l.x,d=l.y;this.startTextEditing({sceneX:c,sceneY:d,container:s}),t.preventDefault();return}else Ae(o)&&this.setState({editingFrame:o.id})}}else if(!t.ctrlKey&&!t.altKey&&!t.metaKey&&this.state.draggingElement===null){let a=wj(t.key);a?(this.state.activeTool.type!==a&&dt("toolbar",a,`keyboard (${this.device.editor.isMobile?"mobile":"desktop"})`),this.setActiveTool({type:a}),t.stopPropagation()):t.key===N.Q&&(this.toggleLock("keyboard"),t.stopPropagation())}if(t.key===N.SPACE&&nt.pointers.size===0&&(dl=!0,yt(this.interactiveCanvas,gt.GRAB),t.preventDefault()),(t.key===N.G||t.key===N.S)&&!t.altKey&&!t[N.CTRL_OR_CMD]){let a=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type==="selection"&&!a.length)return;t.key===N.G&&(Vc(this.state.activeTool.type)||a.some(o=>Vc(o.type)))&&(this.setState({openPopup:"elementBackground"}),t.stopPropagation()),t.key===N.S&&(this.setState({openPopup:"elementStroke"}),t.stopPropagation())}if(t.key===N.K&&!t.altKey&&!t[N.CTRL_OR_CMD]){this.state.activeTool.type==="laser"?this.setActiveTool({type:"selection"}):this.setActiveTool({type:"laser"});return}t[N.CTRL_OR_CMD]&&(t.key===N.BACKSPACE||t.key===N.DELETE)&&Pa.set(s1,"clearCanvas");let n=t.key.toLocaleLowerCase(),r=n===N.S&&t.shiftKey,i=t.key===N.I||n===N.G&&t.shiftKey;(r||i)&&this.openEyeDropper({type:r?"stroke":"background"})});onWheel=Gt(t=>{!(t.target instanceof HTMLCanvasElement)&&t.ctrlKey&&t.preventDefault()});onKeyUp=Gt(t=>{if(t.key===N.SPACE&&(this.state.viewModeEnabled?yt(this.interactiveCanvas,gt.GRAB):this.state.activeTool.type==="selection"?Ni(this.interactiveCanvas):(Ea(this.interactiveCanvas,this.state),this.setState({selectedElementIds:lt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})),dl=!1),!t[N.CTRL_OR_CMD]&&!this.state.isBindingEnabled&&this.setState({isBindingEnabled:!0}),df(t.key)){let n=this.scene.getSelectedElements(this.state),r=this.scene.getNonDeletedElementsMap();Tl(this.state)?zE(n,this):UE(n,r),this.setState({suggestedBindings:[]})}});isToolSupported=t=>this.props.UIOptions.tools?.[t]!==!1;setActiveTool=t=>{if(!this.isToolSupported(t.type)){console.warn(`"${t.type}" tool is disabled via "UIOptions.canvasActions.tools.${t.type}"`);return}let n=hn(this.state,t);fB(document.activeElement)&&this.focusContainer(),OE(n.type)||this.setState({suggestedBindings:[]}),n.type==="image"&&this.onImageAction({insertOnCanvasDirectly:(t.type==="image"&&t.insertOnCanvasDirectly)??!1}),this.setState(r=>{let i={snapLines:r.snapLines.length?[]:r.snapLines,originSnapOffset:null,activeEmbeddable:null};n.type==="freedraw"&&this.store.shouldCaptureIncrement();let a;return n.type!=="selection"?a={...r,activeTool:n,selectedElementIds:lt({},r),selectedGroupIds:lt({},r),editingGroupId:null,multiElement:null,...i}:a={...r,activeTool:n,...i},n.type==="hand"?yt(this.interactiveCanvas,gt.GRAB):dl||Ea(this.interactiveCanvas,a),a})};setOpenDialog=t=>{this.setState({openDialog:t})};setCursor=t=>{yt(this.interactiveCanvas,t)};resetCursor=()=>{Ni(this.interactiveCanvas)};isTouchScreenMultiTouchGesture=()=>nt.pointers.size>=2;getName=()=>this.state.name||this.props.name||`${x("labels.untitled")}-${v5()}`;onGestureStart=Gt(t=>{if(t.preventDefault(),this.props.interactive===!1)return!1;this.isTouchScreenMultiTouchGesture()&&this.setState({selectedElementIds:lt({},this.state),activeEmbeddable:null}),nt.initialScale=this.state.zoom.value});onGestureChange=Gt(t=>{if(t.preventDefault(),this.props.interactive===!1)return!1;if(this.isTouchScreenMultiTouchGesture())return;let n=nt.initialScale;n&&this.setState(r=>({...Al({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:Ml(n*t.scale)},r)}))});onGestureEnd=Gt(t=>{if(t.preventDefault(),this.props.interactive===!1)return!1;this.isTouchScreenMultiTouchGesture()&&this.setState({previousSelectedElementIds:{},selectedElementIds:lt(this.state.previousSelectedElementIds,this.state)}),nt.initialScale=null});handleTextWysiwyg(t,{isExistingElement:n=!1}){let r=this.scene.getElementsMapIncludingDeleted(),i=(a,o,s)=>{this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map(l=>l.id===t.id&&he(l)?Mz(l,Er(l,r),r,{text:a,isDeleted:s,originalText:o}):l)])};SV({id:t.id,canvas:this.canvas,getViewportCoords:(a,o)=>{let{x:s,y:l}=Gi({sceneX:a,sceneY:o},this.state);return[s-this.state.offsetLeft,l-this.state.offsetTop]},onChange:Gt(a=>{i(a,a,!1),ob(t)&&bo(t,r)}),onSubmit:Gt(({text:a,viaKeyboard:o,originalText:s})=>{let l=!a.trim();if(i(a,s,l),!l&&o){let c=t.containerId?t.containerId:t.id;this.setState(d=>({selectedElementIds:lt({...d.selectedElementIds,[c]:!0},d)}))}l&&hT(this.scene.getNonDeletedElements(),[t]),(!l||n)&&this.store.shouldCaptureIncrement(),this.setState({draggingElement:null,editingElement:null}),this.state.activeTool.locked&&Ea(this.interactiveCanvas,this.state),this.focusContainer()}),element:t,excalidrawContainer:this.excalidrawContainerRef.current,app:this}),this.deselectElements(),i(t.text,t.originalText,!1)}deselectElements(){this.setState({selectedElementIds:lt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}getTextElementAtPosition(t,n){let r=this.getElementAtPosition(t,n,{includeBoundTextElement:!0});return r&&he(r)&&!r.isDeleted?r:null}getElementShape(t){switch(t.type){case"rectangle":case"diamond":case"frame":case"magicframe":case"embeddable":case"image":case"iframe":case"text":case"selection":return LT(t);case"arrow":case"line":{let n=Xt.get(t)?.[0]??Xt.generateElementShape(t,null)[0],[,,,,r,i]=De(t,this.scene.getNonDeletedElementsMap());return ZE(t)?Jz(t,n,[t.x,t.y],t.angle,[r,i]):qz(n,[t.x,t.y],t.angle,[r,i])}case"ellipse":return Xz(t);case"freedraw":{let[,,,,n,r]=De(t,this.scene.getNonDeletedElementsMap());return Qz(t,[n,r],ZE(t))}}}getBoundTextShape(t){let n=Ye(t,this.scene.getNonDeletedElementsMap());return n?t.type==="arrow"?this.getElementShape({...n,...fe.getBoundTextElementPosition(t,n,this.scene.getNonDeletedElementsMap())}):this.getElementShape(n):null}getElementAtPosition(t,n,r){let i=this.getElementsAtPosition(t,n,r?.includeBoundTextElement,r?.includeLockedElements);if(i.length>1){if(r?.preferSelected){for(let o=i.length-1;o>-1;o--)if(this.state.selectedElementIds[i[o].id])return i[o]}let a=i[i.length-1];return Gc({x:t,y:n,element:a,shape:this.getElementShape(a),threshold:this.getElementHitThreshold()/2,frameNameBound:Ae(a)?this.frameNameBoundsCache.get(a):null})?a:i[i.length-2]}return i.length===1?i[0]:null}getElementsAtPosition(t,n,r=!1,i=!1){let a=[],o=this.scene.getNonDeletedElementsMap();return(r&&i?this.scene.getNonDeletedElements():this.scene.getNonDeletedElements().filter(s=>(i||!s.locked)&&(r||!(he(s)&&s.containerId)))).filter(s=>this.hitElement(t,n,s)).filter(s=>{let l=Zr(s,o);return l&&this.state.frameRendering.enabled&&this.state.frameRendering.clip?E4({x:t,y:n},l,o):!0}).filter(s=>ss(s)?(a.push(s),!1):!0).concat(a)}getElementHitThreshold(){return ZF/this.state.zoom.value}hitElement(t,n,r,i=!0){if(i&&this.state.selectedElementIds[r.id]&&QT([r],this.state)){let a=Kz(r,this.scene.getNonDeletedElementsMap(),this.getElementHitThreshold());return cf([t,n],a)}return nH(t,n,this.getBoundTextShape(r))?!0:Gc({x:t,y:n,element:r,shape:this.getElementShape(r),threshold:this.getElementHitThreshold(),frameNameBound:Ae(r)?this.frameNameBoundsCache.get(r):null})}getTextBindableContainerAtPosition(t,n){let r=this.scene.getNonDeletedElements(),i=this.scene.getSelectedElements(this.state);if(i.length===1)return Rl(i[0],!1)?i[0]:null;let a=null;for(let o=r.length-1;o>=0;--o){if(r[o].isDeleted)continue;let[s,l,c,d]=De(r[o],this.scene.getNonDeletedElementsMap());if(Et(r[o])&&Gc({x:t,y:n,element:r[o],shape:this.getElementShape(r[o]),threshold:this.getElementHitThreshold()})){a=r[o];break}else if(s<t&&t<c&&l<n&&n<d){a=r[o];break}}return Rl(a,!1)?a:null}startTextEditing=({sceneX:t,sceneY:n,insertAtParentCenter:r=!0,container:i})=>{let a=!1,o=r&&this.getTextWysiwygSnappedToCenterPosition(t,n,this.state,i);i&&o&&(Ye(i,this.scene.getNonDeletedElementsMap())||(a=!0));let s=null,l=this.scene.getSelectedElements(this.state);l.length===1?he(l[0])?s=l[0]:i?s=Ye(l[0],this.scene.getNonDeletedElementsMap()):s=this.getTextElementAtPosition(t,n):s=this.getTextElementAtPosition(t,n);let c=s?.fontFamily||this.state.currentItemFontFamily,d=s?.lineHeight||Fl(c),u=this.state.currentItemFontSize;if(!s&&a&&i&&!Et(i)){let p=bT(An({fontSize:u,fontFamily:c}),d),f=ET(u,d),g=Math.max(i.height,f),b=Math.max(i.width,p);ie(i,{height:g,width:b}),t=i.x+b/2,n=i.y+g/2,o&&(o=this.getTextWysiwygSnappedToCenterPosition(t,n,this.state,i))}let h=this.getTopLayerFrameAtSceneCoords({x:t,y:n}),m=s||fi({x:o?o.elementCenterX:t,y:o?o.elementCenterY:n,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:"",fontSize:u,fontFamily:c,textAlign:o?"center":this.state.currentItemTextAlign,verticalAlign:o?Yr.MIDDLE:Mf,containerId:a?i?.id:void 0,groupIds:i?.groupIds??[],lineHeight:d,angle:i?.angle??0,frameId:h?h.id:null});if(!s&&a&&i&&ie(i,{boundElements:(i.boundElements||[]).concat({type:"text",id:m.id})}),this.setState({editingElement:m}),!s)if(i&&a){let p=this.scene.getElementIndex(i.id);this.scene.insertElementAtIndex(m,p+1)}else this.scene.insertElement(m);this.setState({editingElement:m}),this.handleTextWysiwyg(m,{isExistingElement:!!s})};handleCanvasDoubleClick=t=>{if(this.state.multiElement||this.state.activeTool.type!=="selection")return;let n=this.scene.getSelectedElements(this.state);if(n.length===1&&Be(n[0])&&t[N.CTRL_OR_CMD]&&(!this.state.editingLinearElement||this.state.editingLinearElement.elementId!==n[0].id)){this.store.shouldCaptureIncrement(),this.setState({editingLinearElement:new fe(n[0])});return}Ni(this.interactiveCanvas);let{x:r,y:i}=Ft(t,this.state);if(Zc(this.state).length>0){let a=this.getElementAtPosition(r,i),o=a&&yz(a,this.state.selectedGroupIds);if(o){this.store.shouldCaptureIncrement(),this.setState(s=>({...s,...jr({editingGroupId:o,selectedElementIds:{[a.id]:!0}},this.scene.getNonDeletedElements(),s,this)}));return}}if(Ni(this.interactiveCanvas),!t[N.CTRL_OR_CMD]&&!this.state.viewModeEnabled){let a=this.getElementAtPosition(r,i);if(mi(a)){this.setState({activeEmbeddable:{element:a,state:"active"}});return}let o=this.getTextBindableContainerAtPosition(r,i);if(o&&(Io(o)||!Sa(o.backgroundColor)||Gc({x:r,y:i,element:o,shape:this.getElementShape(o),threshold:this.getElementHitThreshold()}))){let s=rE(o,this.state,this.scene.getNonDeletedElementsMap());r=s.x,i=s.y}this.startTextEditing({sceneX:r,sceneY:i,insertAtParentCenter:!t.altKey,container:o})}};getElementLinkAtPosition=(t,n)=>{let r=this.scene.getNonDeletedElements().slice().reverse(),i=1/0;return r.find((a,o)=>(n&&a.id===n.id&&(i=o),a.link&&o<=i&&cE(a,this.scene.getNonDeletedElementsMap(),this.state,[t.x,t.y],this.device.editor.isMobile)))};redirectToLink=(t,n)=>{let r=Kn(this.lastPointerDownEvent.clientX,this.lastPointerDownEvent.clientY,this.lastPointerUpEvent.clientX,this.lastPointerUpEvent.clientY);if(!this.hitLinkElement||n&&r>pl||!n&&r!==0)return;let i=Ft(this.lastPointerDownEvent,this.state),a=this.scene.getNonDeletedElementsMap(),o=cE(this.hitLinkElement,a,this.state,[i.x,i.y],this.device.editor.isMobile),s=Ft(this.lastPointerUpEvent,this.state),l=cE(this.hitLinkElement,a,this.state,[s.x,s.y],this.device.editor.isMobile);if(o&&l){let c=this.hitLinkElement.link;if(c){c=Da(c);let d;if(this.props.onLinkOpen&&(d=nT("excalidraw-link",t.nativeEvent),this.props.onLinkOpen({...this.hitLinkElement,link:c},d)),!d?.defaultPrevented){let u=wT(c)?"_self":"_blank",h=window.open(void 0,u);h&&(h.opener=null,h.location=c)}}}};getTopLayerFrameAtSceneCoords=t=>{let n=this.scene.getNonDeletedElementsMap(),r=this.scene.getNonDeletedFramesLikes().filter(i=>E4(t,i,n));return r.length?r[r.length-1]:null};handleCanvasPointerMove=t=>{if(this.props.interactive===!1)return!1;this.savePointer(t.clientX,t.clientY,this.state.cursorButton),this.lastPointerMoveEvent=t.nativeEvent,nt.pointers.has(t.pointerId)&&nt.pointers.set(t.pointerId,{x:t.clientX,y:t.clientY});let n=nt.initialScale;if(nt.pointers.size===2&&nt.lastCenter&&n&&nt.initialDistance){let d=oC(nt.pointers),u=d.x-nt.lastCenter.x,h=d.y-nt.lastCenter.y;nt.lastCenter=d;let m=sC(Array.from(nt.pointers.values())),p=this.state.activeTool.type==="freedraw"&&this.state.penMode?1:m/nt.initialDistance,f=p?Ml(n*p):this.state.zoom.value;this.setState(g=>{let b=Al({viewportX:d.x,viewportY:d.y,nextZoom:f},g);this.translateCanvas({zoom:b.zoom,scrollX:b.scrollX+u/f,scrollY:b.scrollY+h/f,shouldCacheIgnoreZoom:!0})}),this.resetShouldCacheIgnoreZoomDebounced()}else nt.lastCenter=nt.initialDistance=nt.initialScale=null;if(dl||Ou||$2||hd(this.state))return;let r=dC(F2,t.clientX-this.state.offsetLeft,t.clientY-this.state.offsetTop).isOverEither;!this.state.draggingElement&&!this.state.multiElement&&(r?Ni(this.interactiveCanvas):Ea(this.interactiveCanvas,this.state));let i=Ft(t,this.state),{x:a,y:o}=i;if(!this.state.draggingElement&&aV(this.state.activeTool.type)){let{originOffset:d,snapLines:u}=iV(this.scene.getNonDeletedElements(),this.state,{x:a,y:o},t,this.scene.getNonDeletedElementsMap());this.setState(h=>{let m=J2(h.snapLines,u),p=h.originSnapOffset?J2(h.originSnapOffset,d):d;return h.snapLines===m&&h.originSnapOffset===p?null:{snapLines:m,originSnapOffset:p}})}else this.state.draggingElement||this.setState(d=>d.snapLines.length?{snapLines:[]}:null);if(this.state.editingLinearElement&&!this.state.editingLinearElement.isDragging){let d=fe.handlePointerMove(t,a,o,this.state,this.scene.getNonDeletedElementsMap());d&&d!==this.state.editingLinearElement&&(0,wE.flushSync)(()=>{this.setState({editingLinearElement:d})}),d?.lastUncommittedPoint!=null?this.maybeSuggestBindingAtCursor(i):(0,wE.flushSync)(()=>{this.setState({suggestedBindings:[]})})}if(T5(this.state.activeTool.type)){let{draggingElement:d}=this.state;kr(d,!1)?this.maybeSuggestBindingsForLinearElementAtCoords(d,[i],this.state.startBoundElement):this.maybeSuggestBindingAtCursor(i)}if(this.state.multiElement){let{multiElement:d}=this.state,{x:u,y:h}=d,{points:m,lastCommittedPoint:p}=d,f=m[m.length-1];if(Ea(this.interactiveCanvas,this.state),f===p)Kn(a-u,o-h,f[0],f[1])>=af?ie(d,{points:[...m,[a-u,o-h]]}):yt(this.interactiveCanvas,gt.POINTER);else if(m.length>2&&p&&Kn(a-u,o-h,p[0],p[1])<af)yt(this.interactiveCanvas,gt.POINTER),ie(d,{points:m.slice(0,-1)});else{let[g,b]=Vn(a,o,t[N.CTRL_OR_CMD]?null:this.state.gridSize),[v,y]=d?.lastCommittedPoint??[0,0],w=g-u-v,C=b-h-y;rh(t)&&({width:w,height:C}=rb(v+u,y+h,g,b)),Mo(m,this.state.zoom.value)&&yt(this.interactiveCanvas,gt.POINTER),ie(d,{points:[...m.slice(0,-1),[v+w,y+C]]})}return}if(t.buttons||this.state.activeTool.type!=="selection"&&this.state.activeTool.type!=="text"&&this.state.activeTool.type!=="eraser")return;let s=this.scene.getNonDeletedElements(),l=this.scene.getSelectedElements(this.state);if(l.length===1&&!r&&!this.state.editingLinearElement){if(this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,a,o),!this.state.selectedLinearElement||this.state.selectedLinearElement.hoverPointIndex===-1){let d=S4(s,this.state,a,o,this.state.zoom,t.pointerType,this.scene.getNonDeletedElementsMap(),this.device);if(d&&d.transformHandleType){yt(this.interactiveCanvas,T4(d));return}}}else if(l.length>1&&!r){let d=C4(Bt(l),a,o,this.state.zoom,t.pointerType,this.device);if(d){yt(this.interactiveCanvas,T4({transformHandleType:d}));return}}let c=this.getElementAtPosition(i.x,i.y);this.hitLinkElement=this.getElementLinkAtPosition(i,c),!ya(this.state)&&(this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?(yt(this.interactiveCanvas,gt.POINTER),DG(this.hitLinkElement,this.state,this.scene.getNonDeletedElementsMap())):(_G(),c&&(c.link||fr(c))&&this.state.selectedElementIds[c.id]&&!this.state.contextMenu&&!this.state.showHyperlinkPopup?this.setState({showHyperlinkPopup:"info"}):this.state.activeTool.type==="text"?yt(this.interactiveCanvas,he(c)?gt.TEXT:gt.CROSSHAIR):this.state.viewModeEnabled?yt(this.interactiveCanvas,gt.GRAB):r?yt(this.interactiveCanvas,gt.AUTO):this.state.selectedLinearElement?this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,a,o):t[N.CTRL_OR_CMD]?yt(this.interactiveCanvas,gt.AUTO):(c||this.isHittingCommonBoundingBoxOfSelectedElements(i,l))&&!c?.locked&&(c&&mi(c)&&this.isIframeLikeElementCenter(c,t,a,o)?(yt(this.interactiveCanvas,gt.POINTER),this.setState({activeEmbeddable:{element:c,state:"hover"}})):(yt(this.interactiveCanvas,gt.MOVE),this.state.activeEmbeddable?.state==="hover"&&this.setState({activeEmbeddable:null})))))};handleEraser=(t,n,r)=>{this.eraserTrail.addPointToPath(r.x,r.y);let i=!1,a=new Set,o=this.scene.getNonDeletedElements(),s=h=>{for(let m of h){if(m.locked)return;if(t.altKey?this.elementsPendingErasure.delete(m.id)&&(i=!0):this.elementsPendingErasure.has(m.id)||(i=!0,this.elementsPendingErasure.add(m.id)),i&&m.groupIds?.length){let p=m.groupIds.at(-1);if(!a.has(p)){a.add(p);let f=yn(o,p);for(let g of f)t.altKey?this.elementsPendingErasure.delete(g.id):this.elementsPendingErasure.add(g.id)}}}},l=Kn(n.lastCoords.x,n.lastCoords.y,r.x,r.y),c=this.getElementHitThreshold(),d={...n.lastCoords},u=0;for(;u<=l;){let h=this.getElementsAtPosition(d.x,d.y);if(s(h),u===l)break;u=Math.min(u+c,l);let m=u/l,p=(1-m)*d.x+m*r.x,f=(1-m)*d.y+m*r.y;d.x=p,d.y=f}if(n.lastCoords.x=r.x,n.lastCoords.y=r.y,i){for(let h of this.scene.getNonDeletedElements())tn(h)&&(this.elementsPendingErasure.has(h.id)||this.elementsPendingErasure.has(h.containerId))&&(t.altKey?(this.elementsPendingErasure.delete(h.id),this.elementsPendingErasure.delete(h.containerId)):(this.elementsPendingErasure.add(h.id),this.elementsPendingErasure.add(h.containerId)));this.elementsPendingErasure=new Set(this.elementsPendingErasure),this.onSceneUpdated()}};handleTouchMove=t=>{Nu=!0};handleHoverSelectedLinearElement(t,n,r){let i=this.scene.getNonDeletedElementsMap(),a=fe.getElement(t.elementId,i);if(a)if(this.state.selectedLinearElement){let o=-1,s=null;Gc({x:n,y:r,element:a,shape:this.getElementShape(a)})?(o=fe.getPointIndexUnderCursor(a,i,this.state.zoom,n,r),s=fe.getSegmentMidpointHitCoords(t,{x:n,y:r},this.state,this.scene.getNonDeletedElementsMap()),o>=0||s?yt(this.interactiveCanvas,gt.POINTER):this.hitElement(n,r,a)&&yt(this.interactiveCanvas,gt.MOVE)):this.hitElement(n,r,a)&&yt(this.interactiveCanvas,gt.MOVE),this.state.selectedLinearElement.hoverPointIndex!==o&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,hoverPointIndex:o}}),fe.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords,s)||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,segmentMidPointHoveredCoords:s}})}else yt(this.interactiveCanvas,gt.AUTO)}handleCanvasPointerDown=t=>{if(this.maybeCleanupAfterMissingPointerUp(t.nativeEvent),this.maybeUnfollowRemoteUser(),this.state.contextMenu&&this.setState({contextMenu:null}),this.state.snapLines&&this.setAppState({snapLines:[]}),this.updateGestureOnPointerDown(t),t.pointerType==="touch"&&this.state.draggingElement&&this.state.draggingElement.type==="freedraw"){let l=this.state.draggingElement;this.updateScene({...l.points.length<10?{elements:this.scene.getElementsIncludingDeleted().filter(c=>c.id!==l.id)}:{},appState:{draggingElement:null,editingElement:null,startBoundElement:null,suggestedBindings:[],selectedElementIds:lt(Object.keys(this.state.selectedElementIds).filter(c=>c!==l.id).reduce((c,d)=>(c[d]=this.state.selectedElementIds[d],c),{}),this.state)},storeAction:Z.UPDATE});return}let n=document.getSelection();if(n?.anchorNode&&n.removeAllRanges(),this.maybeOpenContextMenuAfterPointerDownOnTouchDevices(t),!this.state.penDetected&&t.pointerType==="pen"&&this.setState(l=>({penMode:!0,penDetected:!0})),!this.device.isTouchScreen&&["pen","touch"].includes(t.pointerType)&&(this.device=sf(this.device,{isTouchScreen:!0})),Ou||(this.lastPointerDownEvent=t,this.props.interactive!==!1&&this.handleCanvasPanUsingWheelOrSpaceDrag(t)))return;if(this.setState({lastPointerDownWith:t.pointerType,cursorButton:"down"}),this.savePointer(t.clientX,t.clientY,"down"),t.button===ul.ERASER&&this.state.activeTool.type!==$n.eraser){this.setState({activeTool:hn(this.state,{type:$n.eraser,lastActiveToolBeforeEraser:this.state.activeTool})},()=>{this.handleCanvasPointerDown(t);let l=()=>{c(),d?.(),ya(this.state)&&this.setState({activeTool:hn(this.state,{...this.state.activeTool.lastActiveTool||{type:$n.selection},lastActiveToolBeforeEraser:null})})},c=cn(window,"pointerup",l,{once:!0}),d;requestAnimationFrame(()=>{d=this.missingPointerEventCleanupEmitter.once(l)})});return}if(t.button!==ul.MAIN&&t.button!==ul.TOUCH&&t.button!==ul.ERASER||nt.pointers.size>1)return;let r=this.initialPointerDownState(t);if(this.setState({selectedElementsAreBeingDragged:!1}),this.props.interactive!==!1&&this.handleDraggingScrollBar(t,r)||(this.clearSelectionIfNotUsingSelection(),this.updateBindingEnabledOnPointerMove(t),this.props.interactive!==!1&&this.handleSelectionOnPointerDown(t,r))||!(!this.state.penMode||t.pointerType!=="touch"||this.state.activeTool.type==="selection"||this.state.activeTool.type==="text"||this.state.activeTool.type==="image"))return;if(this.state.activeTool.type==="text"){this.handleTextOnPointerDown(t,r);return}else if(this.state.activeTool.type==="arrow"||this.state.activeTool.type==="line")this.handleLinearElementOnPointerDown(t,this.state.activeTool.type,r);else if(this.state.activeTool.type==="image"){yt(this.interactiveCanvas,gt.CROSSHAIR);let l=this.state.pendingImageElementId&&this.scene.getElement(this.state.pendingImageElementId);if(!l)return;this.setState({draggingElement:l,editingElement:l,pendingImageElementId:null,multiElement:null});let{x:c,y:d}=Ft(t,this.state),u=this.getTopLayerFrameAtSceneCoords({x:c,y:d});ie(l,{x:c,y:d,frameId:u?u.id:null})}else this.state.activeTool.type==="freedraw"?this.handleFreeDrawElementOnPointerDown(t,this.state.activeTool.type,r):this.state.activeTool.type==="custom"?Ea(this.interactiveCanvas,this.state):this.state.activeTool.type===$n.frame||this.state.activeTool.type===$n.magicframe?this.createFrameElementOnPointerDown(r,this.state.activeTool.type):this.state.activeTool.type==="laser"?this.laserTrails.startPath(r.lastCoords.x,r.lastCoords.y):this.state.activeTool.type!=="eraser"&&this.state.activeTool.type!=="hand"&&this.createGenericElementOnPointerDown(this.state.activeTool.type,r);this.props?.onPointerDown?.(this.state.activeTool,r),this.onPointerDownEmitter.trigger(this.state.activeTool,r,t),this.state.activeTool.type==="eraser"&&this.eraserTrail.startPath(r.lastCoords.x,r.lastCoords.y);let i=this.onPointerMoveFromPointerDownHandler(r),a=this.onPointerUpFromPointerDownHandler(r),o=this.onKeyDownFromPointerDownHandler(r),s=this.onKeyUpFromPointerDownHandler(r);this.missingPointerEventCleanupEmitter.once(l=>a(l||t.nativeEvent)),(!this.state.viewModeEnabled||this.state.activeTool.type==="laser")&&(window.addEventListener("pointermove",i),window.addEventListener("pointerup",a),window.addEventListener("keydown",o),window.addEventListener("keyup",s),r.eventListeners.onMove=i,r.eventListeners.onUp=a,r.eventListeners.onKeyUp=s,r.eventListeners.onKeyDown=o)};handleCanvasPointerUp=t=>{this.removePointer(t),this.lastPointerUpEvent=t;let n=Ft({clientX:t.clientX,clientY:t.clientY},this.state),r=t.timeStamp-(this.lastPointerDownEvent?.timeStamp??0);if(this.device.editor.isMobile&&r<300){let i=this.getElementAtPosition(n.x,n.y);if(mi(i)&&this.isIframeLikeElementCenter(i,t,n.x,n.y)){this.handleEmbeddableCenterClick(i);return}}if(this.device.isTouchScreen){let i=this.getElementAtPosition(n.x,n.y);this.hitLinkElement=this.getElementLinkAtPosition(n,i)}this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?r<300&&mi(this.hitLinkElement)&&!p4(this.hitLinkElement,this.scene.getNonDeletedElementsMap(),this.state,[n.x,n.y])?this.handleEmbeddableCenterClick(this.hitLinkElement):this.redirectToLink(t,this.device.isTouchScreen):this.state.viewModeEnabled&&this.setState({activeEmbeddable:null,selectedElementIds:{}})};maybeOpenContextMenuAfterPointerDownOnTouchDevices=t=>{t.pointerType==="touch"&&(Nu=!1,as?Nu=!0:as=window.setTimeout(()=>{as=0,Nu||this.handleCanvasContextMenu(t)},JF))};resetContextMenuTimer=()=>{clearTimeout(as),as=0,Nu=!1};maybeCleanupAfterMissingPointerUp=t=>{$u?.(),this.missingPointerEventCleanupEmitter.trigger(t).clear()};handleCanvasPanUsingWheelOrSpaceDrag=t=>{if(!(nt.pointers.size<=1&&(t.button===ul.WHEEL||t.button===ul.MAIN&&dl||hd(this.state)||this.state.viewModeEnabled))||he(this.state.editingElement))return!1;Ou=!0,t.preventDefault();let n=!1,r=typeof window===void 0?!1:/Linux/.test(window.navigator.platform);yt(this.interactiveCanvas,gt.GRABBING);let{clientX:i,clientY:a}=t,o=vE(l=>{let c=i-l.clientX,d=a-l.clientY;if(i=l.clientX,a=l.clientY,r&&!n&&(Math.abs(c)>1||Math.abs(d)>1)){n=!0;let u=m=>{document.body.removeEventListener("paste",u),m.stopPropagation()},h=()=>{setTimeout(()=>{document.body.removeEventListener("paste",u),window.removeEventListener("pointerup",h)},100)};document.body.addEventListener("paste",u),window.addEventListener("pointerup",h)}this.translateCanvas({scrollX:this.state.scrollX-c/this.state.zoom.value,scrollY:this.state.scrollY-d/this.state.zoom.value})}),s=Gt($u=()=>{$u=null,Ou=!1,dl||(this.state.viewModeEnabled?yt(this.interactiveCanvas,gt.GRAB):Ea(this.interactiveCanvas,this.state)),this.setState({cursorButton:"up"}),this.savePointer(t.clientX,t.clientY,"up"),window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",s),window.removeEventListener("blur",s),o.flush()});return window.addEventListener("blur",s),window.addEventListener("pointermove",o,{passive:!0}),window.addEventListener("pointerup",s),!0};updateGestureOnPointerDown(t){nt.pointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),nt.pointers.size===2&&(nt.lastCenter=oC(nt.pointers),nt.initialScale=this.state.zoom.value,nt.initialDistance=sC(Array.from(nt.pointers.values())))}initialPointerDownState(t){let n=Ft(t,this.state),r=this.scene.getSelectedElements(this.state),[i,a,o,s]=Bt(r);return{origin:n,withCmdOrCtrl:t[N.CTRL_OR_CMD],originInGrid:Es(Vn(n.x,n.y,t[N.CTRL_OR_CMD]?null:this.state.gridSize)),scrollbars:dC(F2,t.clientX-this.state.offsetLeft,t.clientY-this.state.offsetTop),lastCoords:{...n},originalElements:this.scene.getNonDeletedElements().reduce((l,c)=>(l.set(c.id,Th(c)),l),new Map),resize:{handleType:!1,isResizing:!1,offset:{x:0,y:0},arrowDirection:"origin",center:{x:(o+i)/2,y:(s+a)/2}},hit:{element:null,allHitElements:[],wasAddedToSelection:!1,hasBeenDuplicated:!1,hasHitCommonBoundingBoxOfSelectedElements:this.isHittingCommonBoundingBoxOfSelectedElements(n,r)},drag:{hasOccurred:!1,offset:null},eventListeners:{onMove:null,onUp:null,onKeyUp:null,onKeyDown:null},boxSelection:{hasOccurred:!1}}}handleDraggingScrollBar(t,n){if(!(n.scrollbars.isOverEither&&!this.state.multiElement))return!1;$2=!0,n.lastCoords.x=t.clientX,n.lastCoords.y=t.clientY;let r=vE(a=>{a.target instanceof HTMLElement&&this.handlePointerMoveOverScrollbars(a,n)}),i=Gt(()=>{$u=null,$2=!1,Ea(this.interactiveCanvas,this.state),this.setState({cursorButton:"up"}),this.savePointer(t.clientX,t.clientY,"up"),window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",i),r.flush()});return $u=i,window.addEventListener("pointermove",r),window.addEventListener("pointerup",i),!0}clearSelectionIfNotUsingSelection=()=>{this.state.activeTool.type!=="selection"&&this.setState({selectedElementIds:lt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})};handleSelectionOnPointerDown=(t,n)=>{if(this.state.activeTool.type==="selection"){let r=this.scene.getNonDeletedElements(),i=this.scene.getNonDeletedElementsMap(),a=this.scene.getSelectedElements(this.state);if(a.length===1&&!this.state.editingLinearElement&&!(this.state.selectedLinearElement&&this.state.selectedLinearElement.hoverPointIndex!==-1)){let o=S4(r,this.state,n.origin.x,n.origin.y,this.state.zoom,t.pointerType,this.scene.getNonDeletedElementsMap(),this.device);o!=null&&(this.setState({resizingElement:o.element}),n.resize.handleType=o.transformHandleType)}else a.length>1&&(n.resize.handleType=C4(Bt(a),n.origin.x,n.origin.y,this.state.zoom,t.pointerType,this.device));if(n.resize.handleType)n.resize.isResizing=!0,n.resize.offset=Es(kH(n.resize.handleType,a,i,n.origin.x,n.origin.y)),a.length===1&&Be(a[0])&&a[0].points.length===2&&(n.resize.arrowDirection=PH(n.resize.handleType,a[0]));else{if(this.state.selectedLinearElement){let l=this.state.editingLinearElement||this.state.selectedLinearElement,c=fe.handlePointerDown(t,this.state,this.store,n.origin,l,this);if(c.hitElement&&(n.hit.element=c.hitElement),c.linearElementEditor&&(this.setState({selectedLinearElement:c.linearElementEditor}),this.state.editingLinearElement&&this.setState({editingLinearElement:c.linearElementEditor})),c.didAddPoint)return!0}if(n.hit.element=n.hit.element??this.getElementAtPosition(n.origin.x,n.origin.y),n.hit.element&&this.getElementLinkAtPosition({x:n.origin.x,y:n.origin.y},n.hit.element))return!1;n.hit.allHitElements=this.getElementsAtPosition(n.origin.x,n.origin.y);let o=n.hit.element,s=n.hit.allHitElements.some(l=>this.isASelectedElement(l));if((o===null||!s)&&!t.shiftKey&&!n.hit.hasHitCommonBoundingBoxOfSelectedElements&&this.clearSelection(o),this.state.editingLinearElement)this.setState({selectedElementIds:lt({[this.state.editingLinearElement.elementId]:!0},this.state)});else if(o!=null){if(t[N.CTRL_OR_CMD])return this.state.selectedElementIds[o.id]||(n.hit.wasAddedToSelection=!0),this.setState(l=>({...bz(l,o),previousSelectedElementIds:this.state.selectedElementIds})),!1;this.state.selectedElementIds[o.id]||(this.state.editingGroupId&&!Ch(o,this.state.editingGroupId)&&this.setState({selectedElementIds:lt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),!s&&!n.hit.hasHitCommonBoundingBoxOfSelectedElements&&(this.setState(l=>{let c={...l.selectedElementIds,[o.id]:!0},d=[];if(Object.keys(l.selectedElementIds).forEach(u=>{let h=this.scene.getElement(u);h&&d.push(h)}),Ae(o))vo(d,o.id).forEach(u=>{delete c[u.id]});else if(o.frameId)c[o.frameId]&&delete c[o.id];else{let u=o.groupIds,h=new Set(u.flatMap(m=>yn(this.scene.getNonDeletedElements(),m)).filter(m=>Ae(m)).map(m=>m.id));h.size>0&&d.forEach(m=>{m.frameId&&h.has(m.frameId)&&(delete c[m.id],m.groupIds.flatMap(p=>yn(this.scene.getNonDeletedElements(),p)).forEach(p=>{delete c[p.id]}))})}return{...jr({editingGroupId:l.editingGroupId,selectedElementIds:c},this.scene.getNonDeletedElements(),l,this),showHyperlinkPopup:o.link||fr(o)?"info":!1}}),n.hit.wasAddedToSelection=!0))}this.setState({previousSelectedElementIds:this.state.selectedElementIds})}}return!1};isASelectedElement(t){return t!=null&&this.state.selectedElementIds[t.id]}isHittingCommonBoundingBoxOfSelectedElements(t,n){if(n.length<2)return!1;let r=this.getElementHitThreshold(),[i,a,o,s]=Bt(n);return t.x>i-r&&t.x<o+r&&t.y>a-r&&t.y<s+r}handleTextOnPointerDown=(t,n)=>{if(he(this.state.editingElement))return;let r=n.origin.x,i=n.origin.y,a=this.getElementAtPosition(r,i,{includeBoundTextElement:!0}),o=this.getTextBindableContainerAtPosition(r,i);Io(a)&&(o=a,r=a.x+a.width/2,i=a.y+a.height/2),this.startTextEditing({sceneX:r,sceneY:i,insertAtParentCenter:!t.altKey,container:o}),Ni(this.interactiveCanvas),this.state.activeTool.locked||this.setState({activeTool:hn(this.state,{type:"selection"})})};handleFreeDrawElementOnPointerDown=(t,n,r)=>{let[i,a]=Vn(r.origin.x,r.origin.y,null),o=this.getTopLayerFrameAtSceneCoords({x:i,y:a}),s=Az({type:n,x:i,y:a,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:null,simulatePressure:t.pressure===.5,locked:!1,frameId:o?o.id:null});this.setState(d=>{let u={...d.selectedElementIds};return delete u[s.id],{selectedElementIds:lt(u,d)}});let l=s.simulatePressure?s.pressures:[...s.pressures,t.pressure];ie(s,{points:[[0,0]],pressures:l});let c=bs(r.origin,this);this.scene.insertElement(s),this.setState({draggingElement:s,editingElement:s,startBoundElement:c,suggestedBindings:[]})};insertIframeElement=({sceneX:t,sceneY:n,width:r,height:i})=>{let[a,o]=Vn(t,n,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.state.gridSize),s=Iz({type:"iframe",x:a,y:o,strokeColor:"transparent",backgroundColor:"transparent",fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness("iframe"),opacity:this.state.currentItemOpacity,locked:!1,width:r,height:i});return this.scene.insertElement(s),s};insertEmbeddableElement=({sceneX:t,sceneY:n,link:r})=>{let[i,a]=Vn(t,n,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.state.gridSize),o=Kc(r);if(!o)return;o.error instanceof URIError&&this.setToast({message:x("toast.unrecognizedLinkFormat"),closable:!0});let s=K5({type:"embeddable",x:i,y:a,strokeColor:"transparent",backgroundColor:"transparent",fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness("embeddable"),opacity:this.state.currentItemOpacity,locked:!1,width:o.intrinsicSize.w,height:o.intrinsicSize.h,link:r});return this.scene.insertElement(s),s};createImageElement=({sceneX:t,sceneY:n,addToFrameUnderCursor:r=!0})=>{let[i,a]=Vn(t,n,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.state.gridSize),o=r?this.getTopLayerFrameAtSceneCoords({x:i,y:a}):null;return TT({type:"image",x:i,y:a,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:null,opacity:this.state.currentItemOpacity,locked:!1,frameId:o?o.id:null})};handleLinearElementOnPointerDown=(t,n,r)=>{if(this.state.multiElement){let{multiElement:i}=this.state;if(i.type==="line"&&Mo(i.points,this.state.zoom.value)){ie(i,{lastCommittedPoint:i.points[i.points.length-1]}),this.actionManager.executeAction(Ri);return}let{x:a,y:o,lastCommittedPoint:s}=i;if(i.points.length>1&&s&&Kn(r.origin.x-a,r.origin.y-o,s[0],s[1])<af){this.actionManager.executeAction(Ri);return}this.setState(l=>({selectedElementIds:lt({...l.selectedElementIds,[i.id]:!0},l)})),ie(i,{lastCommittedPoint:i.points[i.points.length-1]}),yt(this.interactiveCanvas,gt.POINTER)}else{let[i,a]=Vn(r.origin.x,r.origin.y,t[N.CTRL_OR_CMD]?null:this.state.gridSize),o=this.getTopLayerFrameAtSceneCoords({x:i,y:a}),{currentItemStartArrowhead:s,currentItemEndArrowhead:l}=this.state,[c,d]=n==="arrow"?[s,l]:[null,null],u=hs({type:n,x:i,y:a,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemRoundness==="round"?{type:Fn.PROPORTIONAL_RADIUS}:null,startArrowhead:c,endArrowhead:d,locked:!1,frameId:o?o.id:null});this.setState(m=>{let p={...m.selectedElementIds};return delete p[u.id],{selectedElementIds:lt(p,m)}}),ie(u,{points:[...u.points,[0,0]]});let h=bs(r.origin,this);this.scene.insertElement(u),this.setState({draggingElement:u,editingElement:u,startBoundElement:h,suggestedBindings:[]})}};getCurrentItemRoundness(t){return this.state.currentItemRoundness==="round"?{type:id(t)?Fn.ADAPTIVE_RADIUS:Fn.PROPORTIONAL_RADIUS}:null}createGenericElementOnPointerDown=(t,n)=>{let[r,i]=Vn(n.origin.x,n.origin.y,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.state.gridSize),a=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),o={x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.getCurrentItemRoundness(t),locked:!1,frameId:a?a.id:null},s;t==="embeddable"?s=K5({type:"embeddable",...o}):s=As({type:t,...o}),s.type==="selection"?this.setState({selectionElement:s,draggingElement:s}):(this.scene.insertElement(s),this.setState({multiElement:null,draggingElement:s,editingElement:s}))};createFrameElementOnPointerDown=(t,n)=>{let[r,i]=Vn(t.origin.x,t.origin.y,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.state.gridSize),a={x:r,y:i,opacity:this.state.currentItemOpacity,locked:!1,...Kt},o=n===$n.magicframe?jE(a):CT(a);this.scene.insertElement(o),this.setState({multiElement:null,draggingElement:o,editingElement:o})};maybeCacheReferenceSnapPoints(t,n,r=!1){os({event:t,appState:this.state,selectedElements:n})&&(r||!Eo.getReferenceSnapPoints())&&Eo.setReferenceSnapPoints(eV(this.scene.getNonDeletedElements(),n,this.state,this.scene.getNonDeletedElementsMap()))}maybeCacheVisibleGaps(t,n,r=!1){os({event:t,appState:this.state,selectedElements:n})&&(r||!Eo.getVisibleGaps())&&Eo.setVisibleGaps(JW(this.scene.getNonDeletedElements(),n,this.state,this.scene.getNonDeletedElementsMap()))}onKeyDownFromPointerDownHandler(t){return Gt(n=>{this.maybeHandleResize(t,n)||this.maybeDragNewGenericElement(t,n)})}onKeyUpFromPointerDownHandler(t){return Gt(n=>{n.key===N.ALT&&n.preventDefault(),!this.maybeHandleResize(t,n)&&this.maybeDragNewGenericElement(t,n)})}onPointerMoveFromPointerDownHandler(t){return vE(n=>{if(t.drag.offset===null&&(t.drag.offset=Es(LH(this.scene.getSelectedElements(this.state),t.origin.x,t.origin.y))),!(n.target instanceof HTMLElement)||this.handlePointerMoveOverScrollbars(n,t))return;let r=Ft(n,this.state);if(ya(this.state)){this.handleEraser(n,t,r);return}this.state.activeTool.type==="laser"&&this.laserTrails.addPointToPath(r.x,r.y);let[i,a]=Vn(r.x,r.y,n[N.CTRL_OR_CMD]?null:this.state.gridSize);if(!t.drag.hasOccurred&&(this.state.activeTool.type==="arrow"||this.state.activeTool.type==="line")&&Kn(r.x,r.y,t.origin.x,t.origin.y)<pl)return;if(t.resize.isResizing&&(t.lastCoords.x=r.x,t.lastCoords.y=r.y,this.maybeHandleResize(t,n)))return!0;let o=this.scene.getNonDeletedElementsMap();if(this.state.selectedLinearElement){let d=this.state.editingLinearElement||this.state.selectedLinearElement;if(fe.shouldAddMidpoint(this.state.selectedLinearElement,r,this.state,o)){let u=fe.addMidpoint(this.state.selectedLinearElement,r,this.state,!n[N.CTRL_OR_CMD],o);if(!u)return;(0,wE.flushSync)(()=>{this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,pointerDownState:u.pointerDownState,selectedPointsIndices:u.selectedPointsIndices}}),this.state.editingLinearElement&&this.setState({editingLinearElement:{...this.state.editingLinearElement,pointerDownState:u.pointerDownState,selectedPointsIndices:u.selectedPointsIndices}})});return}else if(d.pointerDownState.segmentMidpoint.value!==null&&!d.pointerDownState.segmentMidpoint.added)return;if(fe.handlePointDragging(n,this.state,r.x,r.y,(u,h)=>{this.maybeSuggestBindingsForLinearElementAtCoords(u,h)},d,this.scene.getNonDeletedElementsMap())){t.lastCoords.x=r.x,t.lastCoords.y=r.y,t.drag.hasOccurred=!0,this.state.editingLinearElement&&!this.state.editingLinearElement.isDragging&&this.setState({editingLinearElement:{...this.state.editingLinearElement,isDragging:!0}}),this.state.selectedLinearElement.isDragging||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!0}});return}}let s=t.hit.allHitElements.some(d=>this.isASelectedElement(d)),l=this.state.editingLinearElement&&n.shiftKey&&this.state.editingLinearElement.elementId===t.hit.element?.id;if((s||t.hit.hasHitCommonBoundingBoxOfSelectedElements)&&!l){let d=this.scene.getSelectedElements(this.state);if(d.every(m=>m.locked))return;let u=d.find(m=>Ae(m)),h=this.getTopLayerFrameAtSceneCoords(r);if(this.setState({frameToHighlight:h&&!u?h:null}),t.drag.hasOccurred=!0,this.setState({selectedElementsAreBeingDragged:!0}),d.length>0&&!t.withCmdOrCtrl&&!this.state.editingElement&&this.state.activeEmbeddable?.state!=="active"){let m={x:r.x-t.origin.x,y:r.y-t.origin.y},p=[...t.originalElements.values()],f=n.shiftKey;if(f){let v=Math.abs(m.x),y=Math.abs(m.y),w=f&&v<y,C=f&&v>y;w&&(m.x=0),C&&(m.y=0)}this.maybeCacheVisibleGaps(n,d),this.maybeCacheReferenceSnapPoints(n,d);let{snapOffset:g,snapLines:b}=tV(p,m,this.state,n,this.scene.getNonDeletedElementsMap());if(this.setState({snapLines:b}),!this.state.editingFrame&&_H(t,d,m,this.state,this.scene,g,n[N.CTRL_OR_CMD]?null:this.state.gridSize),this.maybeSuggestBindingForAll(d),n.altKey&&!t.hit.hasBeenDuplicated){t.hit.hasBeenDuplicated=!0;let v=[],y=[],w=new Map,C=new Map,A=t.hit.element,T=new Set(this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}).map(R=>R.id)),I=this.scene.getElementsIncludingDeleted();for(let R of I)if(T.has(R.id)||R.id===A?.id&&t.hit.wasAddedToSelection){let O=IT(this.state.editingGroupId,w,R),P=t.originalElements.get(R.id);ie(O,{x:P.x,y:P.y}),t.originalElements.set(O.id,O),v.push(O),y.push(R),C.set(R.id,O.id)}else v.push(R);let k=[...v,...y];Yi(k,ve(y)),fT(v,y,C),uT(k,y,C,"duplicatesServeAsOld"),YT(k,y,C),this.scene.replaceAllElements(k),this.maybeCacheVisibleGaps(n,d,!0),this.maybeCacheReferenceSnapPoints(n,d,!0)}return}}let c=this.state.draggingElement;if(c){if(c.type==="freedraw"){let d=c.points,u=r.x-c.x,h=r.y-c.y,m=d.length>0&&d[d.length-1];if(!(m&&m[0]===u&&m[1]===h)){let p=c.simulatePressure?c.pressures:[...c.pressures,n.pressure];ie(c,{points:[...d,[u,h]],pressures:p})}}else if(Be(c)){t.drag.hasOccurred=!0,this.setState({selectedElementsAreBeingDragged:!0});let d=c.points,u=i-c.x,h=a-c.y;rh(n)&&d.length===2&&({width:u,height:h}=rb(c.x,c.y,r.x,r.y)),d.length===1?ie(c,{points:[...d,[u,h]]}):d.length===2&&ie(c,{points:[...d.slice(0,-1),[u,h]]}),kr(c,!1)&&this.maybeSuggestBindingsForLinearElementAtCoords(c,[r],this.state.startBoundElement)}else t.lastCoords.x=r.x,t.lastCoords.y=r.y,this.maybeDragNewGenericElement(t,n);if(this.state.activeTool.type==="selection"){t.boxSelection.hasOccurred=!0;let d=this.scene.getNonDeletedElements();if(this.state.editingLinearElement)fe.handleBoxSelection(n,this.state,this.setState.bind(this),this.scene.getNonDeletedElementsMap());else{let u=!0;!n.shiftKey&&vn(d,this.state)&&(t.withCmdOrCtrl&&t.hit.element?this.setState(m=>jr({...m,selectedElementIds:{[t.hit.element.id]:!0}},this.scene.getNonDeletedElements(),m,this)):u=!1);let h=sb(d,c,this.scene.getNonDeletedElementsMap());this.setState(m=>{let p={...u&&m.selectedElementIds,...h.reduce((f,g)=>(f[g.id]=!0,f),{})};return t.hit.element&&(h.length?delete p[t.hit.element.id]:p[t.hit.element.id]=!0),m=u?m:{...m,selectedGroupIds:{},editingGroupId:null},{...jr({editingGroupId:m.editingGroupId,selectedElementIds:p},this.scene.getNonDeletedElements(),m,this),selectedLinearElement:h.length===1&&Be(h[0])?new fe(h[0]):null,showHyperlinkPopup:h.length===1&&(h[0].link||fr(h[0]))?"info":!1}})}}}})}handlePointerMoveOverScrollbars(t,n){if(n.scrollbars.isOverHorizontal){let r=t.clientX,i=r-n.lastCoords.x;return this.translateCanvas({scrollX:this.state.scrollX-i/this.state.zoom.value}),n.lastCoords.x=r,!0}if(n.scrollbars.isOverVertical){let r=t.clientY,i=r-n.lastCoords.y;return this.translateCanvas({scrollY:this.state.scrollY-i/this.state.zoom.value}),n.lastCoords.y=r,!0}return!1}onPointerUpFromPointerDownHandler(t){return Gt(n=>{this.removePointer(n),t.eventListeners.onMove&&t.eventListeners.onMove.flush();let{draggingElement:r,resizingElement:i,multiElement:a,activeTool:o,isResizing:s,isRotating:l}=this.state;this.setState(m=>({isResizing:!1,isRotating:!1,resizingElement:null,selectionElement:null,frameToHighlight:null,elementsToHighlight:null,cursorButton:"up",editingElement:a||he(this.state.editingElement)?this.state.editingElement:null,snapLines:J2(m.snapLines,[]),originSnapOffset:null})),Eo.setReferenceSnapPoints(null),Eo.setVisibleGaps(null),this.savePointer(n.clientX,n.clientY,"up"),this.setState({selectedElementsAreBeingDragged:!1}),this.onPointerUpEmitter.trigger(this.state.activeTool,t,n);let c=this.scene.getNonDeletedElementsMap();if(this.state.editingLinearElement)if(!t.boxSelection.hasOccurred&&t.hit?.element?.id!==this.state.editingLinearElement.elementId)this.actionManager.executeAction(Ri);else{let m=fe.handlePointerUp(n,this.state.editingLinearElement,this.state,this);m!==this.state.editingLinearElement&&this.setState({editingLinearElement:m,suggestedBindings:[]})}else if(this.state.selectedLinearElement)if(t.hit?.element?.id!==this.state.selectedLinearElement.elementId)this.scene.getSelectedElements(this.state).length>1&&this.setState({selectedLinearElement:null});else{let m=fe.handlePointerUp(n,this.state.selectedLinearElement,this.state,this),{startBindingElement:p,endBindingElement:f}=m,g=this.scene.getElement(m.elementId);kr(g)&&yl(g,p,f,c),m!==this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...m,selectedPointsIndices:null},suggestedBindings:[]})}if(this.missingPointerEventCleanupEmitter.clear(),window.removeEventListener("pointermove",t.eventListeners.onMove),window.removeEventListener("pointerup",t.eventListeners.onUp),window.removeEventListener("keydown",t.eventListeners.onKeyDown),window.removeEventListener("keyup",t.eventListeners.onKeyUp),this.state.pendingImageElementId&&this.setState({pendingImageElementId:null}),this.props?.onPointerUp?.(o,t),this.onPointerUpEmitter.trigger(this.state.activeTool,t,n),r?.type==="freedraw"){let m=Ft(n,this.state),p=r.points,f=m.x-r.x,g=m.y-r.y;f===p[0][0]&&g===p[0][1]&&(g+=1e-4,f+=1e-4);let b=r.simulatePressure?[]:[...r.pressures,n.pressure];ie(r,{points:[...p,[f,g]],pressures:b,lastCommittedPoint:[f,g]}),this.actionManager.executeAction(Ri);return}if(Ll(r)){let m=r;try{this.initializeImageDimensions(m),this.setState({selectedElementIds:lt({[m.id]:!0},this.state)},()=>{this.actionManager.executeAction(Ri)})}catch(p){console.error(p),this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().filter(f=>f.id!==m.id)),this.actionManager.executeAction(Ri)}return}if(Be(r)){r.points.length>1&&this.store.shouldCaptureIncrement();let m=Ft(n,this.state);!t.drag.hasOccurred&&r&&!a?(ie(r,{points:[...r.points,[m.x-r.x,m.y-r.y]]}),this.setState({multiElement:r,editingElement:this.state.draggingElement})):t.drag.hasOccurred&&!a&&(Tl(this.state)&&kr(r,!1)&&HE(r,this.state,m,this),this.setState({suggestedBindings:[],startBoundElement:null}),o.locked?this.setState(p=>({draggingElement:null})):(Ni(this.interactiveCanvas),this.setState(p=>({draggingElement:null,activeTool:hn(this.state,{type:"selection"}),selectedElementIds:lt({...p.selectedElementIds,[r.id]:!0},p),selectedLinearElement:new fe(r)}))));return}if(o.type!=="selection"&&r&&pd(r)){this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(m=>m.id!==r.id),appState:{draggingElement:null},storeAction:Z.UPDATE});return}if(r){if(t.drag.hasOccurred){let m=Ft(n,this.state);if(this.state.selectedLinearElement&&this.state.selectedLinearElement.isDragging){let p=this.scene.getElement(this.state.selectedLinearElement.elementId);if(p?.frameId){let f=Zr(p,c);f&&p&&(xl(p,f,this.scene.getNonDeletedElementsMap())||(ie(p,{groupIds:[]}),vf([p],this.scene.getNonDeletedElementsMap()),this.scene.informMutation()))}}else{let p=this.getTopLayerFrameAtSceneCoords(m),f=this.scene.getSelectedElements(this.state),g=this.scene.getElementsMapIncludingDeleted(),b=v=>{if(v.length>0){for(let y of v){let w=y.groupIds.indexOf(this.state.editingGroupId);ie(y,{groupIds:y.groupIds.slice(0,w)},!1)}g.forEach(y=>{y.groupIds.length&&yn(g,y.groupIds[y.groupIds.length-1]).length<2&&ie(y,{groupIds:[]},!1)}),this.setState({editingGroupId:null})}};if(p&&!this.state.selectedElementIds[p.id]){let v=f.filter(y=>y.frameId!==p.id&&Ah(y,g,this.state));this.state.editingGroupId&&b(v),g=yf(g,v,p)}else if(!p&&this.state.editingGroupId){let v=f.filter(y=>y.frameId&&!Ah(y,g,this.state));b(v)}g=md(g,this.state,this),this.scene.replaceAllElements(g)}}if(Ae(r)){let m=xH(this.scene.getElementsIncludingDeleted(),r,this.scene.getNonDeletedElementsMap());this.scene.replaceAllElements(yf(this.scene.getElementsMapIncludingDeleted(),m,r))}ie(r,XT(r))}if(i&&this.store.shouldCaptureIncrement(),i&&pd(i)&&this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(m=>m.id!==i.id),storeAction:Z.UPDATE}),t.resize.isResizing){let m=md(this.scene.getElementsIncludingDeleted(),this.state,this),p=this.scene.getSelectedElements(this.state).filter(f=>Ae(f));for(let f of p)m=ZT(m,bf(this.scene.getElementsIncludingDeleted(),f,this.state,c),f,this);this.scene.replaceAllElements(m)}let d=t.hit.element;this.state.selectedLinearElement?.elementId!==d?.id&&Be(d)&&this.scene.getSelectedElements(this.state).length===1&&this.setState({selectedLinearElement:new fe(d)});let u=this.lastPointerDownEvent,h=this.lastPointerUpEvent||this.lastPointerMoveEvent;if(ya(this.state)&&u&&h){if(this.eraserTrail.endPath(),Kn(u.clientX,u.clientY,h.clientX,h.clientY)===0){let m=Ft({clientX:h.clientX,clientY:h.clientY},this.state);this.getElementsAtPosition(m.x,m.y).forEach(p=>this.elementsPendingErasure.add(p.id))}this.eraseElements();return}else this.elementsPendingErasure.size&&this.restoreReadyToEraseElements();if(d&&!t.drag.hasOccurred&&!t.hit.wasAddedToSelection&&(!this.state.editingLinearElement||!t.boxSelection.hasOccurred)&&(n.shiftKey&&!this.state.editingLinearElement?this.state.selectedElementIds[d.id]?vT(this.state,d)?this.setState(m=>{let p={...m.selectedElementIds};for(let f of d.groupIds.flatMap(g=>yn(this.scene.getNonDeletedElements(),g)))delete p[f.id];return{selectedGroupIds:{...m.selectedElementIds,...d.groupIds.map(f=>({[f]:!1})).reduce((f,g)=>({...f,...g}),{})},selectedElementIds:lt(p,m)}}):this.state.selectedLinearElement?.isDragging||this.setState(m=>{let p={...m.selectedElementIds};delete p[d.id];let f=bt(this.scene.getNonDeletedElements(),{selectedElementIds:p});return{...jr({editingGroupId:m.editingGroupId,selectedElementIds:p},this.scene.getNonDeletedElements(),m,this),selectedLinearElement:f.length===1&&Be(f[0])?new fe(f[0]):m.selectedLinearElement}}):d.frameId&&this.state.selectedElementIds[d.frameId]?this.setState(m=>{let p={...m.selectedElementIds,[d.id]:!0};return delete p[d.frameId],(this.scene.getElement(d.frameId)?.groupIds??[]).flatMap(f=>yn(this.scene.getNonDeletedElements(),f)).forEach(f=>{delete p[f.id]}),{...jr({editingGroupId:m.editingGroupId,selectedElementIds:p},this.scene.getNonDeletedElements(),m,this),showHyperlinkPopup:d.link||fr(d)?"info":!1}}):this.setState(m=>({selectedElementIds:lt({...m.selectedElementIds,[d.id]:!0},m)})):this.setState(m=>({...jr({editingGroupId:m.editingGroupId,selectedElementIds:{[d.id]:!0}},this.scene.getNonDeletedElements(),m,this),selectedLinearElement:Be(d)&&m.selectedLinearElement?.elementId!==d.id?new fe(d):m.selectedLinearElement}))),!t.drag.hasOccurred&&!this.state.isResizing&&(d&&tH({x:t.origin.x,y:t.origin.y,element:d,shape:this.getElementShape(d),threshold:this.getElementHitThreshold(),frameNameBound:Ae(d)?this.frameNameBoundsCache.get(d):null},c)||!d&&t.hit.hasHitCommonBoundingBoxOfSelectedElements)){this.state.editingLinearElement?this.setState({editingLinearElement:null}):this.setState({selectedElementIds:lt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),yt(this.interactiveCanvas,gt.AUTO);return}if(!o.locked&&o.type!=="freedraw"&&r&&r.type!=="selection"&&this.setState(m=>({selectedElementIds:lt({...m.selectedElementIds,[r.id]:!0},m),showHyperlinkPopup:fr(r)&&!r.link?"editor":m.showHyperlinkPopup})),(o.type!=="selection"||vn(this.scene.getNonDeletedElements(),this.state)||!Bn(this.state.previousSelectedElementIds,this.state.selectedElementIds))&&this.store.shouldCaptureIncrement(),(t.drag.hasOccurred||s||l)&&(Tl(this.state)?zE(this.scene.getSelectedElements(this.state),this):UE(this.scene.getSelectedElements(this.state),c)),o.type==="laser"){this.laserTrails.endPath();return}!o.locked&&o.type!=="freedraw"?(Ni(this.interactiveCanvas),this.setState({draggingElement:null,suggestedBindings:[],activeTool:hn(this.state,{type:"selection"})})):this.setState({draggingElement:null,suggestedBindings:[]}),d&&this.lastPointerUpEvent&&this.lastPointerDownEvent&&this.lastPointerUpEvent.timeStamp-this.lastPointerDownEvent.timeStamp<300&&nt.pointers.size<=1&&mi(d)&&this.isIframeLikeElementCenter(d,this.lastPointerUpEvent,t.origin.x,t.origin.y)&&this.handleEmbeddableCenterClick(d)})}restoreReadyToEraseElements=()=>{this.elementsPendingErasure=new Set,this.onSceneUpdated()};eraseElements=()=>{let t=!1,n=this.scene.getElementsIncludingDeleted().map(r=>this.elementsPendingErasure.has(r.id)||r.frameId&&this.elementsPendingErasure.has(r.frameId)||tn(r)&&this.elementsPendingErasure.has(r.containerId)?(t=!0,Re(r,{isDeleted:!0})):r);this.elementsPendingErasure=new Set,t&&(this.store.shouldCaptureIncrement(),this.scene.replaceAllElements(n))};initializeImage=async({imageFile:t,imageElement:n,showCursorImagePreview:r=!1})=>{if(!vl(t))throw new Error(x("errors.unsupportedFileType"));let i=t.type;if(yt(this.interactiveCanvas,"wait"),i===we.svg)try{t=l4(await Yz(await t.text()),t.name)}catch(l){throw console.warn(l),new Error(x("errors.svgImageInsertError"))}let a=await(this.props.generateIdForFile?.(t)||zz(t));if(!a)throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."),new Error(x("errors.imageInsertError"));if(!this.files[a]?.dataURL){try{t=await VE(t,{maxWidthOrHeight:sB})}catch(l){console.error("Error trying to resizing image file on insertion",l)}if(t.size>b5)throw new Error(x("errors.fileTooBig",{maxSize:`${Math.trunc(b5/1024/1024)}MB`}))}if(r){let l=this.files[a]?.dataURL,c=l&&Hz(l);this.setImagePreviewCursor(c||t)}let o=this.files[a]?.dataURL||await lE(t),s=ie(n,{fileId:a},!1);return new Promise(async(l,c)=>{try{this.files={...this.files,[a]:{mimeType:i,id:a,dataURL:o,created:Date.now(),lastRetrieved:Date.now()}};let d=this.imageCache.get(a);d||(this.addNewImagesToImageCache(),await this.updateImageCache([s])),d?.image instanceof Promise&&await d.image,this.state.pendingImageElementId!==s.id&&this.state.draggingElement?.id!==s.id&&this.initializeImageDimensions(s,!0),l(s)}catch(d){console.error(d),c(new Error(x("errors.imageInsertError")))}finally{r||Ni(this.interactiveCanvas)}})};insertImageElement=async(t,n,r)=>{if(!this.isToolSupported("image")){this.setState({errorMessage:x("errors.imageToolNotSupported")});return}this.scene.insertElement(t);try{return await this.initializeImage({imageFile:n,imageElement:t,showCursorImagePreview:r})}catch(i){return ie(t,{isDeleted:!0}),this.actionManager.executeAction(Ri),this.setState({errorMessage:i.message||x("errors.imageInsertError")}),null}};setImagePreviewCursor=async t=>{let n;try{n=await VE(t,{maxWidthOrHeight:96})}catch(i){throw i.cause==="UNSUPPORTED"?new Error(x("errors.unsupportedFileType")):i}let r=await lE(n);if(t.type===we.svg){let i=await h4(r),a=Math.min(i.height,96),o=a*(i.width/i.height);o>96&&(o=96,a=o*(i.height/i.width));let s=document.createElement("canvas");s.height=a,s.width=o,s.getContext("2d").drawImage(i,0,0,o,a),r=s.toDataURL(we.svg)}this.state.pendingImageElementId&&yt(this.interactiveCanvas,`url(${r}) 4 4, auto`)};onImageAction=async({insertOnCanvasDirectly:t})=>{try{let n=this.state.width/2+this.state.offsetLeft,r=this.state.height/2+this.state.offsetTop,{x:i,y:a}=Ft({clientX:n,clientY:r},this.state),o=await ry({description:"Image",extensions:Object.keys(kE)}),s=this.createImageElement({sceneX:i,sceneY:a,addToFrameUnderCursor:!1});t?(this.insertImageElement(s,o),this.initializeImageDimensions(s),this.setState({selectedElementIds:lt({[s.id]:!0},this.state)},()=>{this.actionManager.executeAction(Ri)})):this.setState({pendingImageElementId:s.id},()=>{this.insertImageElement(s,o,!0)})}catch(n){n.name!=="AbortError"?console.error(n):console.warn(n),this.setState({pendingImageElementId:null,editingElement:null,activeTool:hn(this.state,{type:"selection"})},()=>{this.actionManager.executeAction(Ri)})}};initializeImageDimensions=(t,n=!1)=>{let r=Ma(t)&&this.imageCache.get(t.fileId)?.image;if(!r||r instanceof Promise){if(t.width<pl/this.state.zoom.value&&t.height<pl/this.state.zoom.value){let i=100/this.state.zoom.value;ie(t,{x:t.x-i/2,y:t.y-i/2,width:i,height:i})}return}if(n||t.width<pl/this.state.zoom.value&&t.height<pl/this.state.zoom.value){let i=Math.max(this.state.height-120,160),a=Math.min(i,Math.floor(this.state.height*.5)/this.state.zoom.value),o=Math.min(r.naturalHeight,a),s=o*(r.naturalWidth/r.naturalHeight),l=t.x+t.width/2-s/2,c=t.y+t.height/2-o/2;ie(t,{x:l,y:c,width:s,height:o})}};updateImageCache=async(t,n=this.files)=>{let{updatedFiles:r,erroredFiles:i}=await DT({imageCache:this.imageCache,fileIds:t.map(a=>a.fileId),files:n});if(r.size||i.size)for(let a of t)r.has(a.fileId)&&Xt.delete(a);return i.size&&this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map(a=>Ma(a)&&i.has(a.fileId)?Re(a,{status:"error"}):a)),{updatedFiles:r,erroredFiles:i}};addNewImagesToImageCache=async(t=_T(this.scene.getNonDeletedElements()),n=this.files)=>{let r=t.filter(i=>!i.isDeleted&&!this.imageCache.has(i.fileId));if(r.length){let{updatedFiles:i}=await this.updateImageCache(r,n);i.size&&this.scene.informMutation()}};scheduleImageRefresh=(0,CV.default)(()=>{this.addNewImagesToImageCache()},qF);updateBindingEnabledOnPointerMove=t=>{let n=iz(t);this.state.isBindingEnabled!==n&&this.setState({isBindingEnabled:n})};maybeSuggestBindingAtCursor=t=>{let n=bs(t,this);this.setState({suggestedBindings:n!=null?[n]:[]})};maybeSuggestBindingsForLinearElementAtCoords=(t,n,r)=>{if(!n.length)return;let i=n.reduce((a,o)=>{let s=bs(o,this);return s!=null&&!U5(t,r?.id,s)&&a.push(s),a},[]);this.setState({suggestedBindings:i})};maybeSuggestBindingForAll(t){if(t.length>50)return;let n=az(t,this);this.setState({suggestedBindings:n})}clearSelection(t){this.setState(n=>({selectedElementIds:lt({},n),activeEmbeddable:null,selectedGroupIds:{},editingGroupId:n.editingGroupId&&t!=null&&Ch(t,n.editingGroupId)?n.editingGroupId:null})),this.setState({selectedElementIds:lt({},this.state),activeEmbeddable:null,previousSelectedElementIds:this.state.selectedElementIds})}handleInteractiveCanvasRef=t=>{t!==null?(this.interactiveCanvas=t,this.interactiveCanvas.addEventListener("wheel",this.handleWheel),this.interactiveCanvas.addEventListener("touchstart",this.onTouchStart),this.interactiveCanvas.addEventListener("touchend",this.onTouchEnd)):(this.interactiveCanvas?.removeEventListener("wheel",this.handleWheel),this.interactiveCanvas?.removeEventListener("touchstart",this.onTouchStart),this.interactiveCanvas?.removeEventListener("touchend",this.onTouchEnd))};handleAppOnDrop=async t=>{let{file:n,fileHandle:r}=await Gz(t),{x:i,y:a}=Ft(t,this.state);try{if(vl(n)&&this.isToolSupported("image")){if(n?.type===we.png||n?.type===we.svg)try{let l=await PT(n,this.state,this.scene.getElementsIncludingDeleted(),r);this.syncActionResult({...l,appState:{...l.appState||this.state,isLoading:!1},replaceFiles:!0,storeAction:Z.CAPTURE});return}catch(l){if(l.name!=="EncodingError")throw new Error(x("alerts.couldNotLoadInvalidFile"))}let s=this.createImageElement({sceneX:i,sceneY:a});this.insertImageElement(s,n),this.initializeImageDimensions(s),this.setState({selectedElementIds:lt({[s.id]:!0},this.state)});return}}catch(s){return this.setState({isLoading:!1,errorMessage:s.message})}let o=t.dataTransfer.getData(we.excalidrawlib);if(o&&typeof o=="string"){try{let s=s4(o);this.addElementsFromPasteOrLibrary({elements:hA(s),position:t,files:null})}catch(s){this.setState({errorMessage:s.message})}return}if(n&&await this.loadFileToCanvas(n,r),t.dataTransfer?.types?.includes("text/plain")){let s=t.dataTransfer?.getData("text");if(s&&gf(s,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(s)||Kc(s)?.type==="video")){let l=this.insertEmbeddableElement({sceneX:i,sceneY:a,link:Da(s)});l&&this.setState({selectedElementIds:{[l.id]:!0}})}}};loadFileToCanvas=async(t,n)=>{t=await YE(t);try{let r=this.scene.getElementsIncludingDeleted(),i;try{i=await o4(t,this.state,r,n)}catch(a){let o=a instanceof gl;if(o&&a.code==="IMAGE_NOT_CONTAINS_SCENE_DATA"&&!this.isToolSupported("image")){this.setState({isLoading:!1,errorMessage:x("errors.imageToolNotSupported")});return}let s=x(o?"alerts.cannotRestoreFromImage":"alerts.couldNotLoadInvalidFile");this.setState({isLoading:!1,errorMessage:s})}if(!i)return;i.type===we.excalidraw?(wo(r.concat(i.data.elements)),this.store.updateSnapshot(ve(r),this.state),this.setState({isLoading:!0}),this.syncActionResult({...i.data,appState:{...i.data.appState||this.state,isLoading:!1},replaceFiles:!0,storeAction:Z.CAPTURE})):i.type===we.excalidrawlib&&await this.library.updateLibrary({libraryItems:t,merge:!0,openLibraryMenu:!0}).catch(a=>{console.error(a),this.setState({errorMessage:x("errors.importLibraryError")})})}catch(r){this.setState({isLoading:!1,errorMessage:r.message})}};handleCanvasContextMenu=t=>{if(t.preventDefault(),this.props.interactive===!1||("pointerType"in t.nativeEvent&&t.nativeEvent.pointerType==="touch"||"pointerType"in t.nativeEvent&&t.nativeEvent.pointerType==="pen"&&t.button!==ul.SECONDARY)&&this.state.activeTool.type!=="selection")return;let{x:n,y:r}=Ft(t,this.state),i=this.getElementAtPosition(n,r,{preferSelected:!0,includeLockedElements:!0}),a=this.scene.getSelectedElements(this.state),o=this.isHittingCommonBoundingBoxOfSelectedElements({x:n,y:r},a),s=i||o?"element":"canvas",l=this.excalidrawContainerRef.current,{top:c,left:d}=l.getBoundingClientRect(),u=t.clientX-d,h=t.clientY-c;dt("contextMenu","openContextMenu",s),this.setState({...i&&!this.state.selectedElementIds[i.id]?{...this.state,...jr({editingGroupId:this.state.editingGroupId,selectedElementIds:{[i.id]:!0}},this.scene.getNonDeletedElements(),this.state,this),selectedLinearElement:Be(i)?new fe(i):null}:this.state,showHyperlinkPopup:!1},()=>{this.setState({contextMenu:{top:h,left:u,items:this.getContextMenuItems(s)}})})};maybeDragNewGenericElement=(t,n)=>{let r=this.state.draggingElement,i=t.lastCoords;if(r)if(r.type==="selection"&&this.state.activeTool.type!=="eraser")M4(r,this.state.activeTool.type,t.origin.x,t.origin.y,i.x,i.y,nr(t.origin.x,i.x),nr(t.origin.y,i.y),zu(n),nE(n));else{let[a,o]=Vn(i.x,i.y,n[N.CTRL_OR_CMD]?null:this.state.gridSize),s=Ma(r)&&this.imageCache.get(r.fileId)?.image,l=s&&!(s instanceof Promise)?s.width/s.height:null;this.maybeCacheReferenceSnapPoints(n,[r]);let{snapOffset:c,snapLines:d}=rV(r,this.state,n,{x:t.originInGrid.x+(this.state.originSnapOffset?.x??0),y:t.originInGrid.y+(this.state.originSnapOffset?.y??0)},{x:a-t.originInGrid.x,y:o-t.originInGrid.y},this.scene.getNonDeletedElementsMap());a+=c.x,o+=c.y,this.setState({snapLines:d}),M4(r,this.state.activeTool.type,t.originInGrid.x,t.originInGrid.y,a,o,nr(t.originInGrid.x,a),nr(t.originInGrid.y,o),Ll(r)?!zu(n):zu(n),nE(n),l,this.state.originSnapOffset),this.maybeSuggestBindingForAll([r]),(this.state.activeTool.type===$n.frame||this.state.activeTool.type===$n.magicframe)&&this.setState({elementsToHighlight:bf(this.scene.getNonDeletedElements(),r,this.state,this.scene.getNonDeletedElementsMap())})}};maybeHandleResize=(t,n)=>{let r=this.scene.getSelectedElements(this.state),i=r.filter(d=>Ae(d)),a=t.resize.handleType;if(i.length>0&&a==="rotation")return!1;this.setState({isResizing:a&&a!=="rotation",isRotating:a==="rotation",activeEmbeddable:null});let o=t.lastCoords,[s,l]=Vn(o.x-t.resize.offset.x,o.y-t.resize.offset.y,n[N.CTRL_OR_CMD]?null:this.state.gridSize),c=new Map;if(i.forEach(d=>{vo(this.scene.getNonDeletedElements(),d.id).forEach(u=>{c.set(d.id+u.id,{x:u.x-d.x,y:u.y-d.y})})}),!this.state.selectedElementsAreBeingDragged){let[d,u]=Vn(o.x,o.y,n[N.CTRL_OR_CMD]?null:this.state.gridSize),h={x:d-t.originInGrid.x,y:u-t.originInGrid.y},m=[...t.originalElements.values()];this.maybeCacheReferenceSnapPoints(n,r);let{snapOffset:p,snapLines:f}=nV(r,bt(m,this.state),this.state,n,h,a);s+=p.x,l+=p.y,this.setState({snapLines:f})}if(AH(t.originalElements,a,r,this.scene.getElementsMapIncludingDeleted(),rh(n),nE(n),r.some(d=>Ll(d))?!zu(n):zu(n),s,l,t.resize.center.x,t.resize.center.y)){this.maybeSuggestBindingForAll(r);let d=new Set;return i.forEach(u=>{bf(this.scene.getNonDeletedElements(),u,this.state,this.scene.getNonDeletedElementsMap()).forEach(h=>d.add(h))}),this.setState({elementsToHighlight:[...d]}),!0}return!1};getContextMenuItems=t=>{let n=[];return n.push($b,Nb),t==="canvas"?this.state.viewModeEnabled?[...n,Bb,i1,$C,Rh]:[z4,Ir,$b,Nb,Fb,Ir,zM,OG,Ir,Bb,sA,i1,$C,Rh]:(n.push(Fb),this.state.viewModeEnabled?[uh,...n]:[Ob,uh,z4,qW,QW,Ir,...n,Ir,JM,eA,Ir,tA,lA,cA,AG,nA,Ir,iA,Ir,NM,$M,FM,BM,Ir,aA,oA,Ir,CA,$y,HM,dA,Ir,Ty])};handleWheel=Gt(t=>{if(t.preventDefault(),Ou||this.props.interactive===!1)return;let{deltaX:n,deltaY:r}=t;if(t.metaKey||t.ctrlKey){let i=Math.sign(r),a=Yu*100,o=Math.abs(r),s=r;o>a&&(s=a*i);let l=this.state.zoom.value-s/100;l+=Math.log10(Math.max(1,this.state.zoom.value))*-i*Math.min(1,o/20),this.translateCanvas(c=>({...Al({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:Ml(l)},c),shouldCacheIgnoreZoom:!0})),this.resetShouldCacheIgnoreZoomDebounced();return}if(t.shiftKey){this.translateCanvas(({zoom:i,scrollX:a})=>({scrollX:a-(r||n)/i.value}));return}this.translateCanvas(({zoom:i,scrollX:a,scrollY:o})=>({scrollX:a-n/i.value,scrollY:o-r/i.value}))});getTextWysiwygSnappedToCenterPosition(t,n,r,i){if(i){let a=i.x+i.width/2,o=i.y+i.height/2,s=rE(i,r,this.scene.getNonDeletedElementsMap());if(s&&(a=s.x,o=s.y),Math.hypot(t-a,n-o)<VF){let{x:l,y:c}=Gi({sceneX:a,sceneY:o},r);return{viewportX:l,viewportY:c,elementCenterX:a,elementCenterY:o}}}}savePointer=(t,n,r)=>{if(!t||!n)return;let{x:i,y:a}=Ft({clientX:t,clientY:n},this.state);isNaN(i)||isNaN(a);let o={x:i,y:a,tool:this.state.activeTool.type==="laser"?"laser":"pointer"};this.props.onPointerUpdate?.({pointer:o,button:r,pointersMap:nt.pointers})};resetShouldCacheIgnoreZoomDebounced=Pf(()=>{this.unmounted||this.setState({shouldCacheIgnoreZoom:!1})},300);updateDOMRect=t=>{if(this.excalidrawContainerRef?.current){let n=this.excalidrawContainerRef.current,{width:r,height:i,left:a,top:o}=n.getBoundingClientRect(),{width:s,height:l,offsetTop:c,offsetLeft:d}=this.state;if(r===s&&i===l&&a===d&&o===c){t&&t();return}this.setState({width:r,height:i,offsetLeft:a,offsetTop:o},()=>{t&&t()})}};refresh=()=>{this.setState({...this.getCanvasOffsets()})};getCanvasOffsets(){if(this.excalidrawContainerRef?.current){let t=this.excalidrawContainerRef.current,{left:n,top:r}=t.getBoundingClientRect();return{offsetLeft:n,offsetTop:r}}return{offsetLeft:0,offsetTop:0}}async updateLanguage(){let t=CE.find(n=>n.code===this.props.langCode)||jc;await WC(t),this.setAppState({})}},_F=()=>{(Ne.MODE===xa.TEST||Ne.DEV)&&(window.h=window.h||{},Object.defineProperties(window.h,{elements:{configurable:!0,get(){return this.app?.scene.getElementsIncludingDeleted()},set(e){return this.app?.scene.replaceAllElements(wo(e))}}}))},_F(),TV=DF}),Dae=M(()=>{}),_ae=M(()=>{}),Lae=M(()=>{}),LF,MV,Rae=M(()=>{"use strict";D(),LF=()=>{Array.prototype.at||Object.defineProperty(Array.prototype,"at",{value:function(e){if(e=Math.trunc(e)||0,e<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]},writable:!0,enumerable:!1,configurable:!0}),Element.prototype.replaceChildren||(Element.prototype.replaceChildren=function(...e){this.innerHTML="",this.append(...e)})},MV=LF}),Oae=M(()=>{}),d5,Nae,$ae=M(()=>{"use strict";D(),Xi(),Oae(),ir(),d5=({children:e})=>{let{FooterCenterTunnel:t}=br(),n=Un();return(0,jC.jsx)(t.In,{children:(0,jC.jsx)("div",{className:X("footer-center zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-bottom":n.zenModeEnabled}),children:e})})},Nae=d5,d5.displayName="FooterCenter"}),Fae=M(()=>{}),RF,OF,AV,Bae=M(()=>{"use strict";D(),Fae(),RF=()=>(0,zi.jsx)("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"ExcalidrawLogo-icon",children:(0,zi.jsx)("path",{d:"M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z",fill:"currentColor"})}),OF=()=>(0,zi.jsxs)("svg",{viewBox:"0 0 450 55",xmlns:"http://www.w3.org/2000/svg",fill:"none",className:"ExcalidrawLogo-text",children:[(0,zi.jsx)("path",{d:"M429.27 96.74c2.47-1.39 4.78-3.02 6.83-4.95 1.43-1.35 2.73-2.86 3.81-4.51-.66.9-1.4 1.77-2.23 2.59-2.91 2.84-5.72 5.09-8.42 6.87h.01ZM343.6 69.36c.33 3.13.58 6.27.79 9.4.09 1.37.18 2.75.25 4.12-.12-4.46-.27-8.93-.5-13.39-.11-2.08-.24-4.16-.4-6.24-.06 1.79-.11 3.85-.13 6.11h-.01ZM378.47 98.34c.01-.37.07-1.13.01-6.51-.11 1.9-.22 3.81-.31 5.71-.07 1.42-.22 2.91-.16 4.35.39.03.78.07 1.17.1-.92-.85-.76-2.01-.72-3.66l.01.01ZM344.09 86.12c-.09-2.41-.22-4.83-.39-7.24v12.21c.15-.05.32-.09.47-.14.05-1.61-.03-3.23-.09-4.83h.01ZM440.69 66.79c-.22-.34-.45-.67-.69-.99-3.71-4.87-9.91-7.14-15.65-8.55-1.05-.26-2.12-.49-3.18-.71 2.29.59 4.48 1.26 6.64 2.02 7.19 2.54 10.57 5.41 12.88 8.23ZM305.09 72.46l1.2 3.6c.84 2.53 1.67 5.06 2.46 7.61.24.78.5 1.57.73 2.36.22-.04.44-.08.67-.12a776.9 776.9 0 0 1-5.01-13.57c-.02.04-.03.09-.05.13v-.01ZM345.49 90.25v.31c1.48-.42 3.05-.83 4.66-1.2-1.56.25-3.12.52-4.66.89ZM371.02 90.22c0-.57-.04-1.14-.11-1.71-.06-.02-.12-.04-.19-.05-.21-.05-.43-.08-.65-.11.42.16.74.88.95 1.87ZM398.93 54.23c-.13 0-.27-.01-.4-.02l.03.4c.11-.15.23-.27.37-.38ZM401.57 62.28v-.15c-1.22-.24-2.86-.61-3.23-1.25-.09-.15-.18-.51-.27-.98-.09.37-.2.73-.33 1.09 1.24.56 2.52.98 3.83 1.29ZM421.73 88.68c-2.97 1.65-6.28 3.12-9.69 3.68v.18c4.72-.14 11.63-3.85 16.33-8.38-2.04 1.75-4.33 3.24-6.63 4.53l-.01-.01ZM411.28 80.92c-.05-1.2-.09-2.4-.15-3.6-.21 5.66-.46 11.38-.47 14.51.24-.02.48-.04.71-.07.15-3.61.05-7.23-.09-10.83v-.01Z",transform:"translate(-144.023 -51.76)"}),(0,zi.jsx)("path",{d:"M425.38 67.41c-3.5-1.45-7.19-2.57-14.06-3.62.09 1.97.06 4.88-.03 8.12.03.04.06.09.06.15.19 1.36.28 2.73.37 4.1.25 3.77.39 7.55.41 11.33 0 1.38-.01 2.76-.07 4.13 1.4-.25 2.78-.65 4.12-1.15 4.07-1.5 7.94-3.78 11.28-6.54 2.33-1.92 5.13-4.49 5.88-7.58.63-3.53-2.45-6.68-7.97-8.96l.01.02ZM411.35 92.53v-.06l-.34.03c.11.01.22.03.34.03ZM314.26 64.06c-.23-.59-.47-1.17-.7-1.75.57 1.62 1.11 3.25 1.6 4.9l.15.54 2.35 6.05c.32.82.66 1.64.98 2.46-1.38-4.1-2.83-8.17-4.39-12.2h.01ZM156.82 103.07c-.18.13-.38.23-.58.33 1.32-.03 2.66-.2 3.93-.34.86-.09 1.72-.22 2.58-.33-2.12.1-4.12.17-5.94.34h.01ZM210.14 68.88s.03.04.05.07c.18-.31.39-.64.58-.96-.21.3-.42.6-.64.89h.01ZM201.65 82.8c-.5.77-1.02 1.56-1.49 2.37 1.11-1.55 2.21-3.1 3.2-4.59-.23.23-.49.51-.75.79-.32.47-.65.95-.96 1.43ZM194.03 98.66c-.33-.4-.65-.84-1.05-1.17-.24-.2-.07-.49.17-.56-.23-.26-.42-.5-.63-.75 1.51-2.55 3.93-5.87 6.4-9.28-.17-.08-.29-.28-.2-.49.04-.09.09-.17.13-.26-1.21 1.78-2.42 3.55-3.61 5.33-.87 1.31-1.74 2.64-2.54 4-.29.5-.63 1.04-.87 1.61.81.65 1.63 1.27 2.47 1.88-.09-.11-.18-.21-.27-.32v.01ZM307.79 82.93c-1-3.17-2.05-6.32-3.1-9.48-1.62 4.08-3.69 9.17-6.16 15.19 3.32-1.04 6.77-1.87 10.27-2.5-.32-1.08-.67-2.15-1.01-3.21ZM149.5 80.7c.05-1.71.04-3.43 0-5.14-.1 2.26-.16 4.51-.22 6.77-.02.73-.03 1.46-.04 2.19.14-1.27.2-2.55.24-3.82h.02ZM228.98 98.3c.39 1.25.91 3.03.94 3.91.06-.03.12-.07.17-.1.08-1.29-.55-2.65-1.11-3.81ZM307.72 53.36c.81.5 1.53 1.04 2.07 1.49-.38-.8-.78-1.58-1.21-2.35-.17.03-.34.06-.51.11-.43.12-.86.26-1.29.41.35-.01.53.1.94.34ZM283.69 96.14c3.91-7.25 6.89-13.35 8.88-18.15l1.1-2.66c-1.27 2.64-2.56 5.27-3.83 7.9-1.53 3.15-3.06 6.31-4.58 9.47-.87 1.81-1.76 3.62-2.54 5.47.04.02.07.04.11.07.05.05.1.09.15.14.05-.73.27-1.48.71-2.24ZM289.92 103.23s-.04.01-.05.03c0-.02.04-.03.05-.04.05-.05.11-.1.16-.15l.21-.21c-.55 0-1.5-.27-2.55-.72.4.26.8.51 1.22.74.24.13.48.26.73.37.05.02.1.03.14.05a.27.27 0 0 1 .08-.07h.01ZM269.23 68.49c-.39-.19-.82-.48-1.33-.87-3.06-1.56-6.31-2.78-9.36-2.35-3.5.49-5.7 1.11-7.74 2.44 5.71-2.6 12.82-2.07 18.44.79l-.01-.01ZM177.87 53.69l1.06.03c-.96-.22-2-.25-2.89-.3-4.95-.26-9.99.33-14.86 1.19-2.44.43-4.88.95-7.28 1.59 9.09-1.76 15.69-2.77 23.97-2.51ZM219.85 55.51c-.18.12-.36.27-.56.45-.45.53-.86 1.11-1.26 1.66-1.91 2.61-3.71 5.31-5.57 7.95l-.12.18 8.05-10.11c-.18-.05-.36-.1-.55-.13h.01ZM510.71 54.1c.12-.15.29-.3.53-.45.69-.4 3.72-.63 5.87-.74-.36-.02-.73-.04-1.09-.05-1.84-.03-3.67.09-5.49.35.05.3.12.59.18.88v.01ZM510.76 86.02c1.37-3.07 2.49-6.27 3.57-9.46.55-1.64 1.12-3.3 1.6-4.97-1.59 4.01-3.67 9.14-6.2 15.3.24-.08.5-.14.74-.22.1-.22.19-.44.29-.65ZM566.95 75.76c.11-.02.23.03.31.11-.05-.13-.09-.26-.14-.39-.05.09-.11.18-.17.28ZM511.33 86.41c3.08-.89 6.24-1.62 9.46-2.14-1.51-3.98-2.98-7.96-4.39-11.87-.05.15-.09.31-.14.46-1.02 3.32-2.15 6.61-3.39 9.85-.48 1.25-.98 2.49-1.53 3.7h-.01ZM578.24 74.45c.11-.44.23-.87.35-1.31-.31.7-.64 1.39-.97 2.08.09.21.19.4.28.61.12-.46.23-.92.35-1.38h-.01ZM520.62 53.11c-.09 0-.18-.01-.28-.02.38.34.29 1.08.93 2.53l6.65 17.15c2.2 5.68 4.69 11.36 7.41 16.87l1.06 2.17c-2.95-7.05-5.92-14.08-8.87-21.13-1.58-3.79-3.16-7.59-4.7-11.4-.78-1.92-1.73-3.89-2.25-5.91-.03-.1 0-.19.04-.26h.01ZM578.78 77.87c1.45-5.77 3.07-10.43 3.58-13.36.05-.34.16-.88.31-1.55-.67 1.79-1.37 3.56-2.08 5.33-.12.43-.23.86-.35 1.29-.65 2.43-1.29 4.86-1.9 7.3.14.33.29.65.43 1l.01-.01ZM545.3 94.66c.02-.44.03-.83.05-1.12.02-1.01.05-2.02.11-3.02.03-6.66-.46-14.33-1.46-22.8-.13-.42-.27-1.24-.56-2.89 0-.02 0-.04-.01-.06.62 6.61.95 13.25 1.32 19.87.17 3.08.33 6.16.52 9.23.02.25.03.52.04.78l-.01.01ZM580.77 102.81c.13.2.27.38.37.49.27-.11.53-.22.8-.32-.43.09-.82.05-1.17-.16v-.01ZM530.48 104.07h.33c-.36-.13-.71-.32-1.04-.56.14.24.3.47.45.7.06-.08.14-.13.26-.13v-.01ZM542.63 58.82c.06.23.11.47.15.71.14-.33.36-.62.7-.86-.28.05-.57.11-.85.15ZM583.81 57.87c.15-.7.29-1.41.42-2.11-.14.45-.28.9-.42 1.34-.46 1.44-.89 2.89-1.31 4.34.44-1.19.88-2.37 1.31-3.57ZM523.62 91.48c-4.66 1.17-9.05 2.89-14.02 5.27 4.65-1.84 9.48-3.29 14.28-4.63-.09-.22-.17-.41-.26-.64ZM460.64 78.3c-.04-2.9-.11-5.81-.28-8.71-.1-1.68-.17-3.43-.5-5.09-.07.02-.14.03-.2.05.3 6.54.45 12.17.51 17.12.17-.07.34-.14.51-.2 0-1.06-.01-2.11-.03-3.17h-.01ZM470.63 63.24c-3.38-.26-6.81.32-10.1 1.1.41 2.01.47 4.14.57 6.18.18 3.55.25 7.11.27 10.67 3.31-1.38 6.5-3.12 9.3-5.35 1.96-1.56 3.86-3.41 5.02-5.66.73-1.41 1.19-3.22.26-4.65-1.09-1.7-3.46-2.14-5.32-2.29ZM460.29 63.68c1-.24 2.01-.46 3.04-.65-1.15.16-2.37.38-3.71.69v.13c.07-.02.15-.04.22-.05.11-.13.3-.18.45-.11v-.01ZM457.24 100.96c.43-.03.86-.07 1.29-.11.14-.49.27-.99.38-1.49-.44.7-1 1.23-1.67 1.6ZM482.88 104.98c-.18.23-.36.38-.55.47.14.09.27.19.4.28a70.76 70.76 0 0 0 4.37-4.63c.76-.89 1.52-1.81 2.19-2.77-.3-.27-.61-.53-.92-.79-.07 1.94-4.62 6.32-5.49 7.45v-.01Z",transform:"translate(-144.023 -51.76)"}),(0,zi.jsx)("path",{d:"M474.36 63.31c-.4-.16-.84-.27-1.29-.37 1.56.42 3.08 1.22 3.76 2.74.62 1.4.32 2.95-.28 4.32.7-1.22.94-2.34.74-3.47-.24-1.33-1.19-2.54-2.93-3.21v-.01ZM477.34 89.18c-1.2-.81-2.4-1.62-3.6-2.42-.14.1-.26.19-.4.29 1.4.67 2.73 1.39 4 2.13ZM465.88 93.85c.37.25.74.5 1.1.75.46.32.92.65 1.38.97-1.57-1.2-2.01-1.61-2.49-1.72h.01ZM574.92 90.06c-2.28-5.21-4.93-11.13-5.67-12.26-.1-.15-1.57-3.01-1.63-3.08 0 0-.01.02-.02.02.4 1.37 1.09 2.69 1.65 3.99 2.14 4.95 4.36 9.86 6.67 14.73.6 1.26 1.21 2.52 1.83 3.78-.75-2.01-1.64-4.45-2.83-7.18ZM448.73 65.29c.1.2.22.38.34.57.22-.02.43-.06.65-.08v-.08c-.14-.05-.25 0-.99-.41ZM460.16 94.81c-.02.31-.06.59-.1.89-.03 1.71-.33 3.43-.79 5.07.15-.02.3-.03.45-.05.01-.04.02-.08.03-.11.09-.34.15-.69.2-1.03.17-1.07.25-2.16.33-3.24.05-.69.08-1.39.12-2.08-.27.1-.27.26-.24.57v-.02Z",transform:"translate(-144.023 -51.76)"}),(0,zi.jsx)("path",{d:"m328.67 98.12-3.22-6.58c-1.29-2.63-2.53-5.29-3.72-7.97-.25-.85-.52-1.69-.79-2.53-.81-2.57-1.67-5.12-2.55-7.67-1.92-5.53-3.9-11.08-6.32-16.41-.72-1.58-1.46-3.44-2.63-4.79-.03-.17-.16-.29-.34-.36a.282.282 0 0 0-.23-.04c-.06-.01-.12 0-.18.01-.74.06-1.5.38-2.19.61-2.22.77-4.4 1.64-6.63 2.38-.03-.08-.06-.16-.09-.25-.15-.42-.82-.24-.67.19.03.09.07.19.1.28l-.18.06c-.36.11-.28.6 0 .68.18 1.18.63 2.36.98 3.49.03.09.06.17.08.26-.08.23-.17.46-.24.64-.37.98-.79 1.94-1.21 2.9-1.27 2.89-2.62 5.75-3.98 8.6-3.18 6.67-6.44 13.31-9.64 19.97-1.08 2.25-2.2 4.5-3.15 6.81-.13.32.24.5.5.37 1.34 1.33 2.84 2.5 4.4 3.57.65.44 1.31.87 2.01 1.24.4.22.86.48 1.33.5.24.01.35-.19.33-.37.11-.1.21-.21.28-.28.41-.41.81-.84 1.2-1.26.85-.92 1.69-1.87 2.5-2.84 6.31-2.34 12.6-4.31 18.71-5.84 2.14 5.3 3.43 8.43 3.97 9.58.55 1.05 1.15 1.88 1.82 2.52 1.32.56 6.96-.03 9.23-1.96.87-1.28 1.19-2.67.93-4.15-.09-.5-.22-.95-.4-1.33l-.01-.03Zm-20.09-45.61c.43.77.83 1.56 1.21 2.35-.54-.45-1.27-.99-2.07-1.49-.42-.24-.6-.35-.94-.34.43-.15.85-.29 1.29-.41.17-.05.34-.08.51-.11Zm-25.86 45.66c.78-1.85 1.67-3.66 2.54-5.47 1.51-3.16 3.05-6.31 4.58-9.47 1.28-2.63 2.56-5.26 3.83-7.9l-1.1 2.66c-1.99 4.79-4.97 10.9-8.88 18.15-.43.76-.66 1.51-.71 2.24-.05-.05-.1-.09-.15-.14a.259.259 0 0 0-.11-.07Zm6.24 4.71c-.42-.23-.82-.48-1.22-.74 1.05.45 2 .72 2.55.72l-.21.21c-.05.05-.11.1-.16.15-.01.01-.04.03-.05.04 0-.02.03-.02.05-.03a.27.27 0 0 0-.08.07c-.05-.02-.1-.03-.14-.05-.25-.1-.49-.24-.73-.37h-.01Zm15.73-29.43c1.05 3.15 2.1 6.31 3.1 9.48.34 1.06.69 2.13 1.01 3.21-3.5.63-6.95 1.46-10.27 2.5 2.48-6.03 4.54-11.11 6.16-15.19Zm4.79 12.57c-.23-.79-.49-1.58-.73-2.36-.79-2.54-1.63-5.08-2.46-7.61l-1.2-3.6c.02-.04.04-.09.05-.13 1.6 4.45 3.28 9 5.01 13.57l-.67.12v.01Zm5.83-18.27-.15-.54c-.49-1.64-1.03-3.28-1.6-4.9.23.58.47 1.17.7 1.75 1.56 4.03 3.01 8.1 4.39 12.2-.33-.82-.67-1.64-.98-2.46l-2.35-6.05h-.01ZM390.43 79.37c-.13-10.43-.22-17.5-.24-19.97-.24-1.6.21-2.88-.65-3.65-.14-.13-.32-.23-.52-.32h.03c.45 0 .45-.69 0-.7-1.75-.03-3.5-.04-5.25-.14-1.38-.08-2.76-.21-4.15-.31-.07 0-.12.01-.17.04-.21-.07-.47.03-.45.31l.03.45c-.11.14-.19.3-.22.5-.21 1.26-.32 13.67-.36 23.59-.32 5.79-.67 11.57-.97 17.36-.09 1.73-.29 3.54-.21 5.3-.39.02-.38.64.04.69v.12c.05.44.74.45.7 0v-.06c1.1.09 2.2.21 3.3.3 1.14.19 2.44.2 3.29.17 1.73-.05 2.92-.05 3.8-.37.45-.05.9-.11 1.35-.17.44-.06.25-.73-.19-.67h-.01c.24-.32.45-.72.62-1.25.66-1.84.41-6.36.34-11.33l-.13-9.9.02.01Zm-12.26 18.17c.09-1.91.2-3.81.31-5.71.06 5.38 0 6.14-.01 6.51-.05 1.65-.21 2.81.72 3.66-.39-.04-.78-.07-1.17-.1-.06-1.44.09-2.93.16-4.35l-.01-.01ZM588.97 53.85c-2.06-.25-3.17-.51-3.76-.6a.3.3 0 0 1 .04-.08c.22-.39-.39-.75-.6-.35-.56 1.02-.9 2.19-1.26 3.29-.61 1.88-1.17 3.78-1.72 5.68-.63 2.19-1.24 4.39-1.83 6.59-.81 2.03-1.67 4.05-2.61 6.03-1.7-3.64-3.11-6.04-4.03-7.57-2.26-3.74-2.85-5.48-3.57-6.08l.31-.09c.43-.12.25-.8-.19-.67-1.06.3-2.12.6-3.17.95-.93.32-1.85.69-2.76 1.07-.13.05-.19.16-.22.27-.04.02-.08.05-.11.07-.04-.06-.07-.12-.11-.18a.354.354 0 0 0-.48-.12c-.16.09-.22.32-.13.48l.33.54c0 .09.02.18.06.28.51 1.16.78 1.38.72 1.47-2.42 3.44-5.41 7.86-6.2 9.1-1.27 1.97-2.01 3.14-2.45 3.84l-.91-6.56-.43-4.1c-.19-1.85-.37-3.23-.53-4.13-.19-1.1-.3-2.15-.45-3.16-.2-1.36-.29-2.06-.47-2.42h.04c.45.02.45-.68 0-.7-3.43-.16-6.81.94-10.17 1.48-.24-.22-.73-.04-.58.32.24.59.33 1.25.43 1.87.17 1.06.29 2.13.4 3.2.32 3.09.53 6.2.74 9.3.44 6.75.77 13.51 1.17 20.26.11 1.95.13 3.96.46 5.89.05.3.37.31.55.14.74 1.71 2.87 1.27 6.13 1.27 1.34 0 2.39.04 2.99-.11.02.32.48.53.63.18 3.61-8.26 7.41-16.46 12.05-24.2.03-.05.04-.1.05-.15.3.73.64 1.45.94 2.16.97 2.26 1.97 4.52 2.98 6.76 2.26 5.03 4.54 10.07 7.09 14.96.47.9.94 1.79 1.47 2.65.2.32.4.67.66.96-.18.25 0 .68.34.54.91-.38 1.82-.75 2.76-1.07 1.04-.35 2.11-.65 3.17-.95.39-.11.28-.66-.07-.68.62-.4.95-.96.87-1.91-.3-3.34.72-7.47.86-8.52l2.14-11.43c1.75-10.74 3.13-17.51 3.23-20.86.02-.49.08-2.84.13-3.24.17-1.25.48-1-4.96-1.65l.03-.02Zm-46.19 5.67c-.04-.24-.09-.48-.15-.71l.85-.15c-.34.24-.56.53-.7.86Zm1.95 25.12c-.36-6.63-.7-13.26-1.32-19.87 0 .02 0 .04.01.06.29 1.65.44 2.47.56 2.89 1 8.46 1.5 16.14 1.46 22.8-.06.99-.1 2-.11 3.02-.01.29-.03.68-.05 1.12-.01-.26-.03-.53-.04-.78-.19-3.08-.35-6.16-.52-9.23l.01-.01Zm36.4 18.66c-.11-.11-.24-.29-.37-.49.35.21.74.26 1.17.16-.27.11-.53.22-.8.32v.01Zm-.89-33.72c.12-.43.23-.86.35-1.29.71-1.77 1.41-3.55 2.08-5.33-.15.68-.26 1.22-.31 1.55-.5 2.94-2.13 7.59-3.58 13.36-.15-.35-.29-.66-.43-1 .61-2.44 1.25-4.87 1.9-7.3l-.01.01Zm3.56-12.48c.14-.44.28-.89.42-1.34-.13.7-.27 1.41-.42 2.11-.43 1.19-.86 2.38-1.31 3.57.42-1.45.85-2.9 1.31-4.34Zm-5.22 16.05c-.11.44-.23.87-.35 1.31-.12.46-.23.92-.35 1.38-.1-.22-.19-.4-.28-.61.34-.69.66-1.38.97-2.08h.01Zm-11.64 2.62c.06-.1.12-.19.17-.28.05.13.09.26.14.39a.398.398 0 0 0-.31-.11Zm2.3 2.98c-.56-1.3-1.25-2.63-1.65-3.99 0 0 .01-.02.02-.02.06.08 1.52 2.93 1.63 3.08.73 1.13 3.38 7.04 5.67 12.26 1.2 2.73 2.08 5.17 2.83 7.18-.62-1.25-1.23-2.51-1.83-3.78-2.31-4.87-4.53-9.78-6.67-14.73ZM275.92 87.03c-1.06-2.18-1.13-3.45-2.44-2.93-1.52.57-2.94 1.3-4.5 2.1-1.4.72-2.68 1.44-3.92 2.12.01-.25-.24-.5-.51-.34-4.8 2.93-12.41 4.7-17.28 1.31-1.98-1.77-3.32-4.15-3.97-5.78-.29-.95-.49-1.94-.63-2.93-.14-3.34 1.58-6.53 3.9-9.12.8-.79 1.68-1.51 2.66-2.12 3.7-2.3 8.22-3.07 12.51-2.51 2.71.35 5.32 1.24 7.71 2.55.39.22.75-.39.35-.6-.18-.1-.37-.18-.55-.27.56.27 1.03.33 1.51.19l-.48.39c-.15.11-.23.3-.13.48.09.15.33.24.48.13 1.3-.97 2.46-2.09 3.45-3.37.37-.29.64-.6.65-.97v-.02c.08-.33-.03-.7-.21-1.08-.31-.87-.98-2.01-2.19-3.26-2.43-2.52-3.79-3.45-5.68-4.26-1.14-.49-3.12-1.06-4.42-1.23-3.28-.42-10.64-1.21-18.18 4.11-7.74 5.46-11.94 12.3-12.23 20.61-.08 2.06.04 3.98.34 5.71.74 4.18 2.57 8 5.44 11.34 4.26 4.99 9.76 7.52 16.34 7.52 4.85 0 9.69-1.77 14.89-4.62.23-.12.45-.23.68-.35 2.19-1.1 4.37-2.23 6.46-3.5.49-.3 1.03-.61 1.5-.98 1.47-.87 1.11-1.12.49-2.95-.39-1.14-.76-2.7-2.06-5.36l.02-.01Zm-17.38-21.76c3.05-.42 6.31.79 9.36 2.35.51.39.94.68 1.33.87-5.61-2.86-12.72-3.39-18.44-.79 2.05-1.33 4.24-1.95 7.74-2.44l.01.01ZM443.67 72.67c-.4-2.2-1.15-4.33-2.37-6.22-1.49-2.32-3.58-4.19-5.91-5.64-6.17-3.81-13.75-5.11-20.83-6.01-3.23-.41-6.47-.69-9.72-.92l-1.39-.12c-.85-.07-1.52-.1-2.05-.1-1.08-.06-2.17-.12-3.25-.17-.08 0-.14.02-.19.05-.1.05-.18.14-.16.3.27 2.55-.01 5.12-.92 7.52-.15.38.4.56.62.28 1.32.59 2.68 1.05 4.08 1.37 0 2.78-.14 7.58-.33 12.91 0 0 0 .02-.01.03-.61 3.66-.79 7.42-1 11.12-.23 4.01-.43 8.03-.44 12.05 0 .64 0 1.28.03 1.93.02.31 0 .68.15.96.06.11.14.16.24.17-.2.17-.21.54.11.59 3.83.67 7.78.71 11.68.25 2.3-.19 4.87-.65 7.65-1.56 1.85-.54 3.67-1.18 5.43-1.91 7.2-3.02 14.31-8.07 17.35-15.53.76-1.86 1.17-3.8 1.31-5.75.3-1.93.28-3.82-.09-5.58l.01-.02Zm-19.32-15.42c5.74 1.41 11.94 3.68 15.65 8.55.25.32.47.65.69.99-2.3-2.82-5.68-5.69-12.88-8.23-2.16-.76-4.35-1.43-6.64-2.02 1.06.21 2.13.45 3.18.71Zm-25.82-3.04c.13 0 .27.01.4.02-.14.1-.26.23-.37.38 0-.13-.02-.26-.03-.4Zm34.82 22.17c-.75 3.09-3.55 5.66-5.88 7.58-3.35 2.76-7.21 5.03-11.28 6.54-1.33.49-2.71.9-4.12 1.15.06-1.38.08-2.76.07-4.13-.02-3.78-.16-7.56-.41-11.33-.09-1.37-.18-2.74-.37-4.1 0-.06-.03-.11-.06-.15.09-3.25.12-6.16.03-8.12 6.86 1.05 10.56 2.17 14.06 3.62 5.52 2.28 8.59 5.44 7.97 8.96l-.01-.02Zm-22 16.15c-.12 0-.23-.02-.34-.03l.34-.03v.06Zm-.69-.7c0-3.13.26-8.84.47-14.51.06 1.2.11 2.41.15 3.6.15 3.6.25 7.23.09 10.83-.24.03-.48.05-.71.07v.01Zm-12.33-30.94c.37.63 2.01 1.01 3.23 1.25v.15c-1.31-.31-2.59-.73-3.83-1.29.12-.36.23-.72.33-1.09.08.48.18.84.27.98Zm13.7 31.65v-.18c3.41-.56 6.71-2.02 9.69-3.68 2.31-1.28 4.59-2.78 6.63-4.53-4.69 4.53-11.61 8.24-16.33 8.38l.01.01Zm24.07-.75c-2.05 1.93-4.37 3.56-6.83 4.95 2.7-1.78 5.52-4.03 8.42-6.87.82-.82 1.56-1.69 2.23-2.59-1.08 1.65-2.38 3.16-3.81 4.51h-.01ZM187.16 92.14c-.79-2.47-2.1-7.12-3.1-6.87-.19-.01-2.09.77-4.08 1.54-3.06 1.18-5.91 2.13-10.09 2.82-2.74.42-5.87 1.01-10.61 1.06.04-3.34.05-6.01.05-7.99 7.97-.65 12.33-2.11 16.37-3.55 1.11-.39 2.69-1.01 2.63-1.8-.08-.35-.55-1.39-1.17-2.61-.47-1.16-.98-2.31-1.61-3.38-.42-.71-1.04-1.69-1.86-2.06-.11-.08-.22-.13-.29-.12-.02 0-.04 0-.07.01-.19-.04-.39-.05-.6-.01-.17.03-.24.15-.25.28-.04.02-.09.04-.14.05-4.33 1.48-8.85 2.33-13.24 3.61a499.1 499.1 0 0 0-.31-8.19c4.51-.99 8.88-1.38 13.11-1.82 3.68-.38 6.28.12 7.47.34.59.11.9.16 1.16.18h.1c-.1.37.44.66.62.28.02-.04.03-.08.05-.13.15.2.53.22.62-.1.17-.58.19-1.21.21-1.81v-.36c.03-.15.05-.3.07-.45.52-2.47.33-5.09-.64-7.44-.11-.27-.44-.28-.6-.14-.08-.21-.15-.42-.24-.62-.19-.41-.79-.05-.6.35.03.07.05.15.09.22-.98-.42-2.15-.54-3.17-.63-2.17-.19-4.37-.14-6.54 0-5.7.35-11.4 1.3-16.91 2.79-2.08.56-4.13 1.22-6.14 2-4.54 1.05-3.79 1.51-2.17 6.07.18.51.46 1.68.54 1.94.82 2.47 1.08 2.13 3.1 2.13s0 .05 0 .08h.52c-.48 2.66-.51 5.45-.62 8.13-.15 3.48-.22 6.96-.28 10.45 0 .41-.01.82-.02 1.23-.16.29-.33.57-.51.85-.05.38-.09.77-.14 1.18-.42 3.52-.59 6.48-.52 8.8v.34c.02.47.05.76.06.87.16 1.57-.26 3.47 1.35 3.79 1.61.32 3.5.55 4.85.55.11 0 .22-.02.33-.02 1.79.24 3.67.05 5.45-.12 2.85-.28 5.69-.7 8.51-1.19 3.03-.53 6.05-1.14 9.04-1.86 2.4-.58 4.82-1.19 7.13-2.06.51-.19 1.73-.57 2.46-1.14 1.81-.68 2.18-1 1.57-2.67-.23-.62-.48-1.49-.91-2.78l-.03-.02Zm-11.12-38.71c.89.05 1.93.08 2.89.3-.33 0-.68-.02-1.06-.03-8.28-.26-14.88.75-23.97 2.51 2.41-.64 4.85-1.16 7.28-1.59 4.87-.86 9.91-1.45 14.86-1.19Zm-26.53 22.13c.03 1.71.04 3.43 0 5.14-.04 1.27-.11 2.55-.24 3.82 0-.73.02-1.46.04-2.19.05-2.26.12-4.51.22-6.77h-.02Zm6.73 27.85c.2-.1.4-.21.58-.33 1.82-.17 3.82-.24 5.94-.34-.86.11-1.72.24-2.58.33-1.27.14-2.61.31-3.93.34h-.01ZM534.48 85.44c-3.52-8.38-7.07-16.75-10.5-25.17-.63-1.54-1.25-3.09-1.86-4.65-.31-.8-.65-1.6-.87-2.43-.04-.17-.17-.24-.31-.25.1-.2 0-.51-.29-.53-1.59-.08-3.18-.22-4.78-.25-1.96-.03-3.91.13-5.84.42-.31.05-.31.38-.13.56-.03.06-.05.14-.04.22.23 1.54.63 3.06 1.16 4.53.13.35.27.7.41 1.06l-2.68 6.18c-.11.03-.2.09-.25.22-.67 1.9-1.52 3.73-2.34 5.56a536.85 536.85 0 0 1-3.9 8.45c-2.64 5.64-5.34 11.25-7.91 16.93-.44.97-.88 1.94-1.29 2.93-.2.48-.47 1-.55 1.52v.05c-.02.12.02.26.16.34 1.19.73 2.41 1.41 3.66 2.05 1.2.62 2.45 1.25 3.76 1.61.43.12.62-.55.19-.67-1.13-.31-2.2-.83-3.24-1.36 1.09.36 2.1.69 2.75.93 2.82 1.01 2.38 1.1 4.3-3.75 2.1-1.09 4.34-1.96 6.53-2.79 4.35-1.64 8.8-3.03 13.27-4.29.82 2.01 1.77 3.97 2.72 5.92.35.83.62 1.45.79 1.82.22.42.45.8.69 1.15.17.33.33.67.5 1 .42.8.84 1.63 1.4 2.35.23.29.6 0 .55-.31 1.53-.02 3.06-.07 4.58-.27.92-.12 1.82-.32 2.71-.54 1.39-.27 3.85-1.11 3.74-1.42-.67-1.96-1.55-3.87-2.34-5.78-1.57-3.78-3.16-7.56-4.75-11.33v-.01Zm-11.65-26.16c1.54 3.81 3.12 7.6 4.7 11.4 2.94 7.05 5.91 14.09 8.87 21.13l-1.06-2.17c-2.71-5.51-5.2-11.19-7.41-16.87l-6.65-17.15c-.65-1.45-.55-2.19-.93-2.53.09 0 .18.01.28.02a.29.29 0 0 0-.04.26c.52 2.02 1.47 3.98 2.25 5.91h-.01Zm-6.58 13.58c.05-.15.09-.31.14-.46 1.41 3.92 2.88 7.9 4.39 11.87-3.22.52-6.38 1.25-9.46 2.14.55-1.22 1.05-2.46 1.53-3.7 1.24-3.24 2.37-6.53 3.39-9.85h.01Zm-.23-20c.36 0 .73.03 1.09.05-2.15.1-5.18.33-5.87.74-.24.15-.41.3-.53.45-.06-.29-.13-.58-.18-.88 1.82-.26 3.65-.39 5.49-.35v-.01Zm-.09 18.72c-.49 1.67-1.05 3.33-1.6 4.97-1.07 3.19-2.19 6.38-3.57 9.46-.09.21-.19.43-.29.65-.25.07-.5.14-.74.22 2.53-6.16 4.61-11.29 6.2-15.3Zm-6.34 25.16c4.97-2.38 9.37-4.1 14.02-5.27l.26.64c-4.8 1.35-9.63 2.8-14.28 4.63Zm20.17 6.76c.33.23.68.42 1.04.56h-.33c-.12 0-.21.06-.26.13-.15-.23-.31-.45-.45-.7v.01ZM226.57 91.75c-3.55-4.74-6.68-9.11-9.31-12.99 9.2-15.25 10.05-17.81 10.35-18.38.17-.34 1.09-2.27.64-2.53-1.13-.65-1.03-.65-2.97-1.71-1.19-.65-3.04-1.61-4.53-2.12-1.71-.59-1.24-.36-3 2.77-.06.1-.11.2-.17.3-.75 1.02-1.48 2.05-2.2 3.09-1.88 2.71-3.73 5.45-5.69 8.1-3.68-4.91-6.88-8.76-9.51-11.43-.15-.15-.3-.29-.46-.42-1.27-1.28-7.24 3.53-7.93 5.58-.09.09-.19.16-.28.25-.27.26.03.64.33.58.19.65.5 1.29.94 1.91 3.85 5.06 7.19 9.76 9.94 14-1.23 2.61-3.06 5-4.67 7.38l-2.28 3.33c-.5.66-.93 1.23-1.29 1.69-.67.93-2.09 2.61-2.3 3.87-.51.85-1.16 1.84-1.29 2.83-.06.44.61.63.67.19.01-.08.04-.15.06-.22 1.36 1.08 2.76 2.11 4.19 3.11 1.3.91 2.62 1.85 4.04 2.56.21.1.4 0 .48-.17.24.07.48.14.72.2.44.1.62-.57.19-.67-2.02-.48-3.77-1.57-5.23-3.02-.47-.46-.9-.96-1.32-1.46 1.74 1.35 4.2 2.89 5.89 4.14 1.39 1.03 2.85-2.27 4.22-4.2 1.86-2.64 3.96-5.86 5.52-8.29l10.39 14.51c.67.81 1.14 1.21 1.57 1.36-.05.24.12.51.41.4 1.53-.58 3.05-1.19 4.54-1.87 1.52-.69 3.06-1.45 4.36-2.5a.28.28 0 0 0 .12-.23c1.66-1.1.81-1.74-1.41-4.91-1.13-1.58-1.71-2.36-3.7-5.01l-.03-.02Zm2.41 6.54c.56 1.15 1.19 2.52 1.11 3.81-.06.04-.12.07-.17.1-.03-.88-.55-2.66-.94-3.91Zm-16.51-32.73c1.86-2.65 3.65-5.35 5.57-7.95.4-.55.81-1.13 1.26-1.66.19-.18.38-.33.56-.45.18.03.36.08.55.13l-8.05 10.11.12-.18h-.01ZM192.7 95.48c.79-1.37 1.66-2.69 2.54-4 1.19-1.79 2.4-3.56 3.61-5.33-.04.09-.09.17-.13.26-.1.22.03.41.2.49-2.47 3.42-4.89 6.73-6.4 9.28.21.24.4.48.63.75-.24.07-.4.36-.17.56.4.33.72.77 1.05 1.17.09.11.18.21.27.32-.84-.61-1.66-1.24-2.47-1.88.24-.57.58-1.11.87-1.61v-.01Zm7.46-10.32c.47-.81.98-1.59 1.49-2.37.31-.48.64-.95.96-1.43.26-.29.52-.56.75-.79-.99 1.48-2.09 3.03-3.2 4.59Zm10.03-16.22s-.03-.05-.05-.07c.22-.29.43-.59.64-.89-.2.32-.4.65-.58.96h-.01ZM371.54 87.96c-.01-.08-.01-.16-.03-.23-.06-.38-.58-.29-.66.03-.3-.05-.6-.08-.81-.11-1.14-.15-2.29-.19-3.44-.2 1.04-.09 2.09-.18 3.14-.23.45-.02.45-.72 0-.7-6.57.35-13.14 1.23-19.65 2.11-1.53.21-3.05.42-4.57.68-.01 0-.02.01-.04.01-.04-3.33-.13-6.66-.24-9.99-.19-5.7-.4-11.41-.88-17.1-.13-1.51-.23-3.07-.49-4.58 0-.25 0-.48-.02-.68-.06-1.19-.04-2.61-.68-2.78-.16-.07-.72-.16-1.5-.24.22-.17.16-.62-.2-.63-1.19-.04-2.39.09-3.57.23-1.2.14-2.41.32-3.59.6-.16-.1-.41-.06-.5.12-.06.02-.13.03-.19.05-.35.1-.29.55-.03.66-.26.6-.19 2.27-.21 3-.02.66-.66 33.73-.9 40.3-.03.65.06 1.12.04 1.45-.16 3.05.87 4.96 6.34 3.93 1.09-.08 2.75-.77 5.36-1.43 4.13-1.04 5.78-1.52 6.2-1.65 6.43-1.69 6.78-1.97 11.72-2.43.55-.05 4.8-.38 6.03-.3.64.04 1.19.07 1.65.1.09 0 .16-.03.24-.05.1.27.56.33.66-.02.39-1.32.61-2.71.78-4.08.2-1.61.29-3.24.15-4.86.24.03.52-.23.38-.53-.09-.2-.27-.33-.49-.43v-.02Zm-.63.56c.07.57.11 1.14.11 1.71-.21-.99-.53-1.71-.95-1.87.22.03.44.06.65.11.06.01.12.04.19.05Zm-25.41 1.73c1.54-.36 3.1-.64 4.66-.89-1.61.37-3.18.77-4.66 1.2v-.31Zm-.86-7.37c-.07-1.37-.16-2.75-.25-4.12-.21-3.13-.45-6.27-.79-9.4.02-2.25.08-4.31.13-6.11.16 2.08.29 4.16.4 6.24.23 4.46.38 8.93.5 13.39h.01Zm-.94-4c.16 2.41.29 4.83.39 7.24.06 1.6.14 3.22.09 4.83-.15.05-.32.09-.47.14V78.88h-.01ZM483.72 92.83c-3.05-2.28-6.22-4.4-9.38-6.51 8.86-6.49 13.49-12.95 13.73-19.23.04-.76 0-1.5-.13-2.2-.67-3.82-3.5-6.68-8.39-8.48.13.04.27.08.4.13 3.92 1.39 7.74 4.23 8.5 8.56.34 1.95-.05 3.96-.98 5.69-.21.4.39.75.6.35 1.86-3.46 1.46-7.55-.97-10.63-3.53-4.47-9.76-5.88-15.16-6.16-2.32-.12-4.64-.04-6.95.19-6 .32-12.71 1.68-17.63 3.21-.37.11-.67.23-.92.35-.2-.17-.62.02-.57.37v.03c-.64.68-.18 1.64.48 3.21.38.91.67 1.89 1.15 2.58.32.76.68 1.51 1.13 2.19.14.21.38.19.53.07.19-.02.38-.05.57-.08v1.57c-.06.06-.1.13-.11.23-.27 4.18-.34 8.38-.48 12.57l-.3 9.03c-.24 3.91-.44 6.77-.46 7.26-.05.88-.11 1.95.07 2.81-.01.22-.02.43-.04.65 0 .11-.02.23-.03.35 0 .05-.03.27-.01.16-.05.4.5.59.64.28.05.04.12.08.2.08 1.75.13 3.5.28 5.25.3 1.69.02 3.38-.12 5.06-.32.08.23.36.39.55.15.06-.08.11-.17.16-.26.18-.09.24-.32.18-.48.05-.2.1-.4.13-.6.16-.86.25-1.74.33-2.62.11-1.17.17-2.34.23-3.51.15-.01.32-.03.52-.04.36-.03 1.73-.15 2.06-.15.39 0 .7-.02.95-.04 1.76 1.11 3.45 2.35 5.14 3.55 2.83 2.01 5.64 4.04 8.47 6.04 1.42 1 2.85 2 4.29 2.97.1.06.19.07.27.04.08 0 .17-.02.25-.1 1.61-1.56 3.15-3.18 4.6-4.88.75-.88 1.49-1.78 2.15-2.73.01.01.03.02.04.03.34.3.83-.2.49-.49-2.16-1.9-4.34-3.76-6.64-5.48l.03-.01Zm-6.38-3.65a55.72 55.72 0 0 0-4-2.13c.14-.1.26-.19.4-.29 1.2.81 2.4 1.61 3.6 2.42Zm-20.1 11.78c.67-.37 1.23-.91 1.67-1.6-.11.5-.24 1-.38 1.49-.43.04-.86.08-1.29.11Zm2.38-37.24c1.34-.31 2.56-.52 3.71-.69-1.03.19-2.04.41-3.04.65-.14-.07-.34-.02-.45.11-.07.02-.15.04-.22.05v-.13.01Zm.04.84c.07-.02.14-.03.2-.05.34 1.66.41 3.41.5 5.09.17 2.9.24 5.81.28 8.71l.03 3.17c-.17.07-.34.14-.51.2-.06-4.96-.21-10.58-.51-17.12h.01Zm16.04 5.62c-1.16 2.25-3.06 4.1-5.02 5.66-2.8 2.23-5.99 3.97-9.3 5.35-.01-3.56-.09-7.12-.27-10.67-.1-2.04-.16-4.16-.57-6.18 3.3-.78 6.72-1.36 10.1-1.1 1.85.14 4.23.59 5.32 2.29.92 1.43.46 3.24-.26 4.65Zm.85-.18c.6-1.37.9-2.92.28-4.32-.67-1.52-2.2-2.32-3.76-2.74.46.1.89.21 1.29.37 1.74.67 2.69 1.88 2.93 3.21.2 1.13-.05 2.25-.74 3.47V70Zm-27.47-4.14c-.12-.19-.23-.38-.34-.57.74.42.85.36.99.41v.08c-.22.03-.43.06-.65.08Zm11.21 30.46c-.08 1.08-.16 2.17-.33 3.24-.05.35-.11.69-.2 1.03 0 .04-.02.07-.03.11-.15.02-.3.04-.45.05.45-1.64.76-3.36.79-5.07.03-.29.08-.57.1-.89-.03-.31-.03-.47.24-.57-.04.69-.07 1.39-.12 2.08v.02Zm5.6-2.47c.48.11.92.52 2.49 1.72-.46-.32-.92-.65-1.38-.97-.37-.25-.73-.5-1.1-.75h-.01Zm21.23 7.24a70.76 70.76 0 0 1-4.37 4.63c-.14-.09-.27-.19-.4-.28.19-.09.37-.24.55-.47.87-1.14 5.43-5.51 5.49-7.45.31.26.62.53.92.79-.67.97-1.42 1.88-2.19 2.77v.01Z",fill:"currentColor",transform:"translate(-144.023 -51.76)"})]}),AV=({style:e,size:t="small",withText:n})=>(0,zi.jsxs)("div",{className:`ExcalidrawLogo is-${t}`,style:e,children:[(0,zi.jsx)(RF,{}),n&&(0,zi.jsx)(OF,{})]})}),z2,Fu,u5,Oi,H2,U2,G2,j2,W2,h5,zae=M(()=>{"use strict";D(),Ba(),Zh(),de(),$e(),Xi(),pe(),ir(),Bae(),z2=({icon:e,shortcut:t,children:n})=>{let r=qn();return(0,Dt.jsxs)(Dt.Fragment,{children:[(0,Dt.jsx)("div",{className:"welcome-screen-menu-item__icon",children:e}),(0,Dt.jsx)("div",{className:"welcome-screen-menu-item__text",children:n}),t&&!r.editor.isMobile&&(0,Dt.jsx)("div",{className:"welcome-screen-menu-item__shortcut",children:t})]})},z2.displayName="WelcomeScreenMenuItemContent",Fu=({onSelect:e,children:t,icon:n,shortcut:r,className:i="",...a})=>(0,Dt.jsx)("button",{...a,type:"button",className:`welcome-screen-menu-item ${i}`,onClick:e,children:(0,Dt.jsx)(z2,{icon:n,shortcut:r,children:t})}),Fu.displayName="WelcomeScreenMenuItem",u5=({children:e,href:t,icon:n,shortcut:r,className:i="",...a})=>(0,Dt.jsx)("a",{...a,className:`welcome-screen-menu-item ${i}`,href:t,target:"_blank",rel:"noreferrer",children:(0,Dt.jsx)(z2,{icon:n,shortcut:r,children:e})}),u5.displayName="WelcomeScreenMenuItemLink",Oi=({children:e})=>{let{WelcomeScreenCenterTunnel:t}=br();return(0,Dt.jsx)(t.In,{children:(0,Dt.jsx)("div",{className:"welcome-screen-center",children:e||(0,Dt.jsxs)(Dt.Fragment,{children:[(0,Dt.jsx)(H2,{}),(0,Dt.jsx)(U2,{children:x("welcomeScreen.defaults.center_heading")}),(0,Dt.jsxs)(G2,{children:[(0,Dt.jsx)(W2,{}),(0,Dt.jsx)(j2,{})]})]})})})},Oi.displayName="Center",H2=({children:e})=>(0,Dt.jsx)("div",{className:"welcome-screen-center__logo virgil welcome-screen-decor",children:e||(0,Dt.jsx)(AV,{withText:!0})}),H2.displayName="Logo",U2=({children:e})=>(0,Dt.jsx)("div",{className:"welcome-screen-center__heading welcome-screen-decor virgil",children:e}),U2.displayName="Heading",G2=({children:e})=>(0,Dt.jsx)("div",{className:"welcome-screen-menu",children:e}),G2.displayName="Menu",j2=()=>{let e=Vr();return(0,Dt.jsx)(Fu,{onSelect:()=>e.executeAction(L1),shortcut:"?",icon:M1,children:x("helpDialog.title")})},j2.displayName="MenuItemHelp",W2=()=>{let e=Un(),t=Vr();return e.viewModeEnabled?null:(0,Dt.jsx)(Fu,{onSelect:()=>t.executeAction(n1),shortcut:Dr("loadScene"),icon:A1,children:x("buttons.load")})},W2.displayName="MenuItemLoadScene",h5=({onSelect:e})=>{let{t}=hr();return(0,Dt.jsx)(Fu,{shortcut:null,onSelect:e,icon:Ey,children:t("labels.liveCollaboration")})},h5.displayName="MenuItemLiveCollaborationTrigger",Oi.Logo=H2,Oi.Heading=U2,Oi.Menu=G2,Oi.MenuItem=Fu,Oi.MenuItemLink=u5,Oi.MenuItemHelp=j2,Oi.MenuItemLoadScene=W2,Oi.MenuItemLiveCollaborationTrigger=h5}),Wb,Vb,Yb,Hae=M(()=>{"use strict";D(),de(),Xi(),pe(),Wb=({children:e})=>{let{WelcomeScreenMenuHintTunnel:t}=br();return(0,wa.jsx)(t.In,{children:(0,wa.jsxs)("div",{className:"virgil welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--menu",children:[aI,(0,wa.jsx)("div",{className:"welcome-screen-decor-hint__label",children:e||x("welcomeScreen.defaults.menuHint")})]})})},Wb.displayName="MenuHint",Vb=({children:e})=>{let{WelcomeScreenToolbarHintTunnel:t}=br();return(0,wa.jsx)(t.In,{children:(0,wa.jsxs)("div",{className:"virgil welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--toolbar",children:[(0,wa.jsx)("div",{className:"welcome-screen-decor-hint__label",children:e||x("welcomeScreen.defaults.toolbarHint")}),sI]})})},Vb.displayName="ToolbarHint",Yb=({children:e})=>{let{WelcomeScreenHelpHintTunnel:t}=br();return(0,wa.jsx)(t.In,{children:(0,wa.jsxs)("div",{className:"virgil welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--help",children:[(0,wa.jsx)("div",{children:e||x("welcomeScreen.defaults.helpHint")}),oI]})})},Yb.displayName="HelpHint"}),Uae=M(()=>{}),Bp,Gae,jae=M(()=>{"use strict";D(),zae(),Hae(),Uae(),Bp=e=>(0,Ta.jsx)(Ta.Fragment,{children:e.children||(0,Ta.jsxs)(Ta.Fragment,{children:[(0,Ta.jsx)(Oi,{}),(0,Ta.jsx)(Wb,{}),(0,Ta.jsx)(Vb,{}),(0,Ta.jsx)(Yb,{})]})}),Bp.displayName="WelcomeScreen",Bp.Center=Oi,Bp.Hints={MenuHint:Wb,ToolbarHint:Vb,HelpHint:Yb},Gae=Bp}),Wae=M(()=>{}),m5,Vae,Yae=M(()=>{"use strict";D(),de(),pe(),O1(),Wae(),ir(),m5=({isCollaborating:e,onSelect:t,...n})=>{let r=Un(),i=r.width<830;return(0,dv.jsxs)($h,{...n,className:X("collab-button",{active:e}),type:"button",onSelect:t,style:{position:"relative",width:i?void 0:"auto"},title:x("labels.liveCollaboration"),children:[i?PI:x("labels.share"),r.collaborators.size>0&&(0,dv.jsx)("div",{className:"CollabButton-collaborators",children:r.collaborators.size})]})},Vae=m5,m5.displayName="LiveCollaborationTrigger"}),NF,Zae,Kae=M(()=>{"use strict";D(),$a(),te(),NF=(e,t,n)=>!!(t&&(t.id===e.editingElement?.id||t.id===e.resizingElement?.id||t.id===e.draggingElement?.id||t.version>n.version||t.version===n.version&&t.versionNonce<n.versionNonce)),Zae=(e,t,n)=>{let r=ve(e),i=[],a=new Set;for(let s of t)if(!a.has(s.id)){let l=r.get(s.id),c=NF(n,l,s);l&&c?(i.push(l),a.add(l.id)):(i.push(s),a.add(s.id))}for(let s of e)a.has(s.id)||(i.push(s),a.add(s.id));let o=aT(i);return wo(o),o}}),$F,Xae=M(()=>{"use strict";D(),Xi(),Yy(),$e(),pe(),de(),xi(),$F=({children:e,icon:t})=>{let{TTDDialogTriggerTunnel:n}=br(),r=zn();return(0,b1.jsx)(n.In,{children:(0,b1.jsxs)(Ct.Item,{onSelect:()=>{dt("ai","dialog open","ttd"),r({openDialog:{name:"ttd",tab:"text-to-diagram"}})},icon:t??vM,children:[e??x("labels.textToDiagram"),(0,b1.jsx)(Ct.Item.Badge,{children:"AI"})]})})},$F.displayName="TTDDialogTrigger"}),FF,BF,zF,YA=M(()=>{D(),Ote(),$e(),te(),Dae(),_ae(),Lae(),Rae(),de(),ae(),Hn(),$ae(),TW(),jae(),Yae(),Oe(),de(),jh(),Kae(),Wh(),Bl(),yi(),Ds(),mh(),Se(),ae(),vt(),ht(),mh(),te(),av(),O1(),$e(),C1(),MW(),VW(),Xae(),Gh(),Ly(),sV(),Qt(),EH(),vi(),Hn(),mh(),pe(),Ba(),_s(),Nj(),MV(),FF=e=>{let{onChange:t,initialData:n,excalidrawAPI:r,isCollaborating:i=!1,onPointerUpdate:a,renderTopRightUI:o,langCode:s=jc.code,viewModeEnabled:l,zenModeEnabled:c,gridModeEnabled:d,libraryReturnUrl:u,theme:h,name:m,renderCustomStats:p,onPaste:f,detectScroll:g=!0,handleKeyboardGlobally:b=!1,onLibraryChange:v,autoFocus:y=!1,generateIdForFile:w,onLinkOpen:C,onPointerDown:A,onPointerUp:T,onScrollChange:I,id:k,onHomeButtonClick:R,children:O,validateEmbeddable:P,renderEmbeddable:F,aiEnabled:Y,ui:j,interactive:q,activeTool:ne}=e,H=e.UIOptions?.canvasActions,V={...e.UIOptions,canvasActions:{...E5.canvasActions,...H},tools:{image:e.UIOptions?.tools?.image??!0}};return H?.export&&(V.canvasActions.export.saveFileToDisk=H.export?.saveFileToDisk??E5.canvasActions.export.saveFileToDisk),V.canvasActions.toggleTheme===null&&typeof h>"u"&&(V.canvasActions.toggleTheme=!0),(0,uv.useEffect)(()=>{(async()=>await import("./roundRect-UKQBLFKQ.js"))();let $=B=>{typeof B.scale=="number"&&B.scale!==1&&B.preventDefault()};return document.addEventListener("touchmove",$,{passive:!1}),()=>{document.removeEventListener("touchmove",$)}},[]),(0,SE.jsx)(bg,{unstable_createStore:()=>Pa,scope:Xn,children:(0,SE.jsx)(pB,{langCode:s,theme:h,children:(0,SE.jsx)(TV,{id:k,onChange:t,initialData:n,excalidrawAPI:r,isCollaborating:i,onPointerUpdate:a,renderTopRightUI:o,langCode:s,viewModeEnabled:q===!1?!0:l,zenModeEnabled:c,gridModeEnabled:d,libraryReturnUrl:u,theme:h,name:m,renderCustomStats:p,UIOptions:V,onPaste:f,detectScroll:g,handleKeyboardGlobally:b,onLibraryChange:v,autoFocus:y,generateIdForFile:w,onLinkOpen:C,onPointerDown:A,onPointerUp:T,onScrollChange:I,validateEmbeddable:P,renderEmbeddable:F,aiEnabled:Y!==!1,onHomeButtonClick:R,ui:j,interactive:q,activeTool:ne,children:O})})})},BF=(e,t)=>{if(e.children!==t.children)return!1;let{initialData:n,UIOptions:r={},...i}=e,{initialData:a,UIOptions:o={},...s}=t,l=Object.keys(r),c=Object.keys(o);return l.length!==c.length?!1:l.every(d=>d==="canvasActions"?Object.keys(r.canvasActions).every(u=>u==="export"&&r?.canvasActions?.export&&o?.canvasActions?.export?r.canvasActions.export.saveFileToDisk===o.canvasActions.export.saveFileToDisk:r?.canvasActions?.[u]===o?.canvasActions?.[u]):r[d]===o[d])&&Bn(i,s)},zF=uv.default.memo(FF,BF),zF.displayName="Excalidraw"});YA();var Fwe=async({data:e,config:t})=>Ow({data:e,config:t}),qae=async({data:e,config:t})=>{let{mimeType:n=Te.png,quality:r}=t||{};n===Te.png&&typeof r=="number"&&console.warn(`"quality" will be ignored for "${Te.png}" mimeType`),n==="image/jpg"&&(n=Te.jpg),n===Te.jpg&&t?.canvasBackgroundColor&&(console.warn(`Defaulting "exportBackground" to "true" for "${Te.jpg}" mimeType`),t={...t,canvasBackgroundColor:e.appState?.viewBackgroundColor||Us});let i=await Ow({data:e,config:t});return r=r||(/image\/jpe?g/.test(n)?.92:.8),new Promise((a,o)=>{i.toBlob(async s=>{if(!s)return o(new Error("couldn't export to blob"));s&&n===Te.png&&e.appState?.exportEmbedScene&&(s=await kV({blob:s,metadata:Qm(e.elements,e.appState,e.files||{},"local")})),a(s)},n,r)})},Qae=async({data:e,config:t})=>{let{elements:n,appState:r}=cg({...e,files:e.files||{}},null,null),i={...r,exportPadding:t?.padding},a=ut(n),o=e.files||{};return h_({data:{elements:a,appState:i,files:o},config:{exportingFrame:t?.exportingFrame,renderEmbeddables:t?.renderEmbeddables}})},Bwe=async({type:e,data:t,config:n})=>{if(e==="svg"){let r=await Qae({data:t,config:n});await Bw(r.outerHTML)}else if(e==="png")await S_(qae({data:t,config:n}));else if(e==="json")await x_(t.elements,t.files);else throw new Error("Invalid export type")};S();var Jae=e=>e.type==="diamond"?[[e.width/2,0],[e.width,e.height/2],[e.width/2,e.height],[0,e.height/2]]:[[0,0],[0+e.width,0],[0+e.width,e.height],[0,e.height]],eoe=e=>wt(e)||On(e)?e.points:Jae(e),PV=e=>{let t=e.reduce((n,[r,i])=>(n.minY=Math.min(n.minY,i),n.minX=Math.min(n.minX,r),n.maxX=Math.max(n.maxX,r),n.maxY=Math.max(n.maxY,i),n),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,cx:0,cy:0});return t.cx=(t.maxX+t.minX)/2,t.cy=(t.maxY+t.minY)/2,t},_V=e=>{let t=eoe(e),{cx:n,cy:r}=PV(t),i=[n,r],a=t.map(d=>on([d[0],d[1]],i,e.angle)),{minX:o,minY:s,maxX:l,maxY:c}=PV(a);return[o+e.x,s+e.y,l+e.x,c+e.y]},DV=(e,t,n=!1)=>{let r=_V(e),i=t[0]<=r[0]&&t[2]>=r[2]&&t[1]<=r[1]&&t[3]>=r[3];return n?i?!0:r[0]<=t[0]&&r[2]>=t[2]&&r[1]<=t[1]&&r[3]>=t[3]:i},toe=(e,t)=>{let n=_V(e);return(zm(n[0],t[0],t[2])||zm(t[0],n[0],n[2]))&&(zm(n[1],t[1],t[3])||zm(t[1],n[1],n[3]))},LV=({elements:e,bounds:t,type:n,errorMargin:r=0})=>{yx(t)&&(t=ii(t,et(e)));let i=[t[0]-r,t[1]-r,t[2]+r,t[3]+r],a=new Set;for(let o of e){if(a.has(o.id))continue;if(n==="overlap"?toe(o,i):n==="inside"?DV(o,i):DV(o,i,!0)){if(a.add(o.id),o.boundElements)for(let l of o.boundElements)a.add(l.id);He(o)&&o.containerId&&a.add(o.containerId),pt(o)&&(o.startBinding&&a.add(o.startBinding.elementId),o.endBinding&&a.add(o.endBinding?.elementId))}}return e.filter(o=>a.has(o.id))};S();function RV(e){return[Math.min(e[0][0],e[1][0]),Math.min(e[0][1],e[1][1]),Math.max(e[0][0],e[1][0]),Math.max(e[0][1],e[1][1])]}function $V(e,t){return e[0]*t[1]-t[0]*e[1]}function noe(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function hv(e,t){return[e[0]-t[0],e[1]-t[1]]}var roe=1e-6;function OV(e,t){let n=hv(e[1],e[0]),r=hv(t,e[0]),i=$V(n,r);return Math.abs(i)<roe}function ZA(e,t){let n=hv(e[1],e[0]),r=hv(t,e[0]);return $V(n,r)<0}function NV(e,t){return OV(e,t[0])||OV(e,t[1])||(ZA(e,t[0])?!ZA(e,t[1]):ZA(e,t[1]))}function FV(e,t){return noe(RV(e),RV(t))&&NV(e,t)&&NV(t,e)}var h3e=(e,t,n)=>{let r=et(e);for(let i of t)if(i.frameId){let a=n.get(i.id),o=n.get(i.frameId);if(a){let s=r.get(a);s&&Ce(s,{frameId:o??i.frameId},!1)}}};function BV(e,t,n){let r=bw(t,n),i=bw(e,n);return r.some(o=>i.some(s=>FV(o,s)))}var zV=(e,t,n)=>mv(R0(e,t,n,!1)).filter(r=>!Mt(r)&&!r.frameId||r.frameId===t.id),HV=(e,t,n,r)=>R0(e,t,r).some(i=>i.id===n.id);var UV=(e,t,n)=>{let[r,i,a,o]=Me(t,n),[s,l,c,d]=$r(e);return r<=s&&i<=l&&a>=c&&o>=d},el=(e,t,n)=>UV([e],t,n)||BV(e,t,n)||HV([t],e,t,n),m3e=(e,t,n)=>{let[r,i,a,o]=Me(t,n);return Y0([r,i],[e.x,e.y],[a,o])};var p3e=e=>{let t=new Map;for(let n of e){let r=Mt(n)?n.id:n.frameId;r&&!t.has(r)&&t.set(r,F1(e,r))}return t},F1=(e,t)=>{let n=[];for(let r of e.values())r.frameId===t&&n.push(r);return n},Nw=e=>e.filter(t=>Mt(t)),$w=e=>{let t=et(Nw(e));return e.filter(n=>t.has(n.id)||!n.frameId||!t.has(n.frameId))},f3e=(e,t,n,r)=>{let i=F1(e,t.id),a=new Set(i),o=new Set([...zV(e,t,r),...i.filter(h=>HV(e,h,t,r))]),s=i.filter(h=>!o.has(h)),l=new Set(Array.from(o).flatMap(h=>h.groupIds));for(let h of s)if(!BV(h,t,r))h.groupIds.length===0&&a.delete(h);else if(h.groupIds.length>0)for(let m of h.groupIds)l.add(m);for(let h of s)if(h.groupIds.length>0){let m=!0;for(let p of h.groupIds)l.has(p)&&(m=!1);m&&a.delete(h)}let c=Array.from(o).filter(h=>h.groupIds.length===0);for(let h of c)a.add(h);let d=Array.from(o).filter(h=>h.groupIds.length>0),u=mD(d,n);for(let[h,m]of Object.entries(u))if(m){let p=Jd(e,h);if(UV(p,t,r))for(let f of p)a.add(f)}return[...a].filter(h=>!(He(h)&&h.containerId))},g3e=(e,t,n)=>mv(e,zV(e,t,n)),Fr=(e,t)=>e.frameId&&t.get(e.frameId)||null,E3e=(e,t)=>{let n=new Set,r=et(e);e=mv(e);for(let o of e)Mt(o)&&o.id!==t.id&&n.add(o.id);let i=new Set,a=[];for(let o of e)if(!(Mt(o)||o.frameId&&n.has(o.frameId)))if(o.groupIds.length){let s=o.groupIds.at(-1);if(!i.has(s)){i.add(s);let l=Jd(e,s);if(l.some(c=>el(c,t,r)))for(let c of l)a.push(c)}}else el(o,t,r)&&a.push(o);return a},ioe=(e,t,n)=>{let r=et(e),i=new Map;for(let l of e.values())l.frameId===n.id&&i.set(l.id,!0);let a=new Set(t.map(l=>l.id)),o=[],s=new Set;for(let l of t)Mt(l)&&l.id!==n.id&&s.add(l.id);for(let l of mv(e,t)){if(Mt(l)||l.frameId&&s.has(l.frameId))continue;i.has(l.id)||o.push(l);let c=ft(l,r);c&&!a.has(c.id)&&!i.has(c.id)&&o.push(c)}for(let l of o)Ce(l,{frameId:n.id},!1);return e},GV=(e,t)=>{let n=new Map,r=new Map;for(let i of e)if(i.frameId){n.set(i.id,i);let a=r.get(i.frameId)||[];a.push(i);let o=ft(i,t);o&&(n.set(o.id,o),a.push(o)),r.set(i.frameId,a)}for(let[,i]of n)Ce(i,{frameId:null},!1)},aoe=(e,t)=>{let n=F1(e,t.id);return GV(n,et(e)),e},b3e=(e,t,n,r)=>ioe(aoe(e,n),t,n).slice(),y3e=(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,elements:e}),i=new Set(r);if(t.editingGroupId)for(let s of r)s.groupIds.length===0?i.add(s):s.groupIds.flatMap(l=>Jd(e,l)).forEach(l=>i.add(l));let a=new Set,o=et(e);return i.forEach(s=>{s.frameId&&!Mt(s)&&!ug(s,o,t)&&a.add(s)}),a.size>0&&GV(a,o),e},mv=(e,t)=>{let n=new Set,r=t||e;for(let o of r.values()){let s=o.groupIds[o.groupIds.length-1];s&&n.add(s)}let i=new Set;for(let o of n)Jd(e,o).some(s=>Mt(s))&&i.add(o);let a=[];for(let o of r.values())i.has(o.groupIds[o.groupIds.length-1])||a.push(o);return a},dg=(e,t,n)=>{let r=He(e)&&wr(e,t)||e;return n.selectedElementIds[r.id]&&n.selectedElementsAreBeingDragged?n.frameToHighlight:Fr(r,t)},ug=(e,t,n)=>{let r=dg(e,t,n),i=He(e)&&wr(e,t)||e;if(r){if(!n.selectedElementIds[e.id]||!n.selectedElementsAreBeingDragged)return!0;if(i.groupIds.length===0)return el(i,r,t);let a=new Set(i.groupIds.flatMap(o=>Jd(t,o)));if(n.editingGroupId&&n.selectedElementsAreBeingDragged){let o=new Set(aa(t,n));if(n.frameToHighlight!==null)return!0;o.forEach(l=>{a.delete(l)})}for(let o of a)if(Mt(o))return!1;for(let o of a)if(el(o,r,t))return!0}return!1},p_=(e,t)=>e.name===null?ym(e)?`Frame ${t}`:`AI Frame $${t}`:e.name,f_=(e,t)=>LV({elements:e,bounds:t,type:"overlap"}).filter(n=>!n.frameId||n.frameId===t.id);var ooe=e=>{let t=new Set;return e.forEach(n=>{Mt(n)&&t.add(n.id)}),e.filter(n=>!(n.frameId&&t.has(n.frameId)))},R0=(e,t,n,r=!0)=>{let[i,a,o,s]=Me(t,n),l=e.filter(c=>{let[d,u,h,m]=ii(c,n),p=Fr(c,n);if(p){let[f,g,b,v]=ii(p,n);d=Math.max(f,d),u=Math.max(g,u),h=Math.min(b,h),m=Math.min(v,m)}return c.locked===!1&&c.type!=="selection"&&!ar(c)&&i<=d&&a<=u&&o>=h&&s>=m});return l=r?ooe(l):l,l=l.filter(c=>{let d=Fr(c,n);return d?el(c,d,n):!0}),l},M3e=(e,t,n,r)=>{let i=new Set(t.map(a=>a.id));return e.filter(a=>{let o=jV(a,n.width,n.height,n,r);return!i.has(a.id)&&o})},fX=function(){let e=null,t=null,n=null,r=(i,a)=>(n!=null&&i===e&&a.selectedElementIds===t||(n=i.some(o=>a.selectedElementIds[o.id]),e=i,t=a.selectedElementIds),n);return r.clearCache=()=>{e=null,t=null,n=null},r}(),gX=(e,t,n)=>{let r=Array.from(new Set(aa(e,t).map(i=>n(i))));return r.length===1?r[0]:null},aa=(e,t,n)=>{let r=[];for(let i of e.values()){if(t.selectedElementIds[i.id]){r.push(i);continue}if(n?.includeBoundTextElement&&ar(i)&&t.selectedElementIds[i?.containerId]){r.push(i);continue}}if(n?.includeElementsInFrames){let i=[];return r.forEach(a=>{Mt(a)&&F1(e,a.id).forEach(o=>i.push(o)),i.push(a)}),i}return r},EX=(e,t)=>t.editingElement?[t.editingElement]:aa(e,t,{includeBoundTextElement:!0}),vw=(e,t)=>Fo(t.selectedElementIds,e)?t.selectedElementIds:e;var WV=e=>{let t=new Map,n=[];for(let r of e)r.isDeleted||(n.push(r),t.set(r.id,r));return{elementsMap:t,elements:n}},soe=e=>{let t=["includeBoundTextElement","includeElementsInFrames"],n="";for(let r of t)n+=`${r}:${e[r]?"1":"0"}`;return n},VV=e=>typeof e=="string",KA=class e{static sceneMapByElement=new WeakMap;static sceneMapById=new Map;static mapElementToScene(t,n){VV(t)?this.sceneMapById.set(t,n):(this.sceneMapByElement.set(t,n),this.sceneMapById.set(t.id,n))}static getScene(t){return VV(t)?this.sceneMapById.get(t)||null:this.sceneMapByElement.get(t)||null}callbacks=new Set;nonDeletedElements=[];nonDeletedElementsMap=Bo(new Map);elements=[];nonDeletedFramesLikes=[];frames=[];elementsMap=Bo(new Map);selectedElementsCache={selectedElementIds:null,elements:null,cache:new Map};versionNonce;getNonDeletedElementsMap(){return this.nonDeletedElementsMap}getElementsIncludingDeleted(){return this.elements}getElementsMapIncludingDeleted(){return this.elementsMap}getNonDeletedElements(){return this.nonDeletedElements}getFramesIncludingDeleted(){return this.frames}getSelectedElements(t){let n=soe(t),r=t?.elements||this.nonDeletedElements;if(this.selectedElementsCache.elements===r&&this.selectedElementsCache.selectedElementIds===t.selectedElementIds){let a=this.selectedElementsCache.cache.get(n);if(a)return a}else t?.elements==null&&this.selectedElementsCache.cache.clear();let i=aa(r,{selectedElementIds:t.selectedElementIds},t);return t?.elements==null&&(this.selectedElementsCache.selectedElementIds=t.selectedElementIds,this.selectedElementsCache.elements=this.nonDeletedElements,this.selectedElementsCache.cache.set(n,i)),i}getNonDeletedFramesLikes(){return this.nonDeletedFramesLikes}getElement(t){return this.elementsMap.get(t)||null}getVersionNonce(){return this.versionNonce}getNonDeletedElement(t){let n=this.getElement(t);return n&&YV(n)?n:null}mapElements(t){let n=!1,r=this.elements.map(i=>{let a=t(i);return a!==i&&(n=!0),a});return n&&this.replaceAllElements(r),n}replaceAllElements(t){let n=t instanceof Array?t:Array.from(t.values()),r=[];(L.DEV||L.MODE===Ji.TEST)&&ww(n.map(a=>a.index)),this.elements=vc(n),this.elementsMap.clear(),this.elements.forEach(a=>{Mt(a)&&r.push(a),this.elementsMap.set(a.id,a),e.mapElementToScene(a,this)});let i=WV(this.elements);this.nonDeletedElements=i.elements,this.nonDeletedElementsMap=i.elementsMap,this.frames=r,this.nonDeletedFramesLikes=WV(this.frames).elements,this.informMutation()}informMutation(){this.versionNonce=ro();for(let t of Array.from(this.callbacks))t()}addCallback(t){if(this.callbacks.has(t))throw new Error;return this.callbacks.add(t),()=>{if(!this.callbacks.has(t))throw new Error;this.callbacks.delete(t)}}destroy(){this.elements=[],this.nonDeletedElements=[],this.nonDeletedFramesLikes=[],this.frames=[],this.elementsMap.clear(),this.selectedElementsCache.selectedElementIds=null,this.selectedElementsCache.elements=null,this.selectedElementsCache.cache.clear(),e.sceneMapById.forEach((t,n)=>{t===this&&e.sceneMapById.delete(n)}),this.callbacks.clear()}insertElementAtIndex(t,n){if(!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");let r=[...this.elements.slice(0,n),t,...this.elements.slice(n)];Vm(r,et([t])),this.replaceAllElements(r)}insertElementsAtIndex(t,n){if(!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");let r=[...this.elements.slice(0,n),...t,...this.elements.slice(n)];Vm(r,et(t)),this.replaceAllElements(r)}insertElement=t=>{let n=t.frameId?this.getElementIndex(t.frameId):this.elements.length;this.insertElementAtIndex(t,n)};insertElements=t=>{let n=t[0].frameId?this.getElementIndex(t[0].frameId):this.elements.length;this.insertElementsAtIndex(t,n)};getElementIndex(t){return this.elements.findIndex(n=>n.id===t)}getContainerElement=t=>t&&t.containerId&&this.getElement(t.containerId)||null},Go=KA;var Ce=(e,t,n=!0)=>{let r=!1,{points:i,fileId:a}=t;typeof i<"u"&&(t={...sD(i),...t});for(let o in t){let s=t[o];if(typeof s<"u"){if(e[o]===s&&(typeof s!="object"||s===null||o==="groupIds"||o==="scale"))continue;if(o==="scale"){let l=e[o],c=s;if(l[0]===c[0]&&l[1]===c[1])continue}else if(o==="points"){let l=e[o],c=s;if(l.length===c.length){let d=!1,u=l.length;for(;--u;){let h=l[u],m=c[u];if(h[0]!==m[0]||h[1]!==m[1]){d=!0;break}}if(!d)continue}}e[o]=s,r=!0}}return r&&((typeof t.height<"u"||typeof t.width<"u"||typeof a<"u"||typeof i<"u")&&an.delete(e),e.version++,e.versionNonce=ro(),e.updated=No(),n&&Go.getScene(e)?.informMutation()),e},Ai=(e,t)=>{let n=!1;for(let r in t){let i=t[r];if(typeof i<"u"){if(e[r]===i&&(typeof i!="object"||i===null))continue;n=!0}}return n?{...e,...t,updated:No(),version:e.version+1,versionNonce:ro()}:e},Gm=(e,t)=>(e.version=(t??e.version)+1,e.versionNonce=ro(),e.updated=No(),e);var Jm=e=>wt(e)||On(e)?e.points.length<2:e.width===0&&e.height===0,jV=(e,t,n,r,i)=>{let[a,o,s,l]=ii(e,i),c=Em({clientX:r.offsetLeft,clientY:r.offsetTop},r),d=Em({clientX:r.offsetLeft+t,clientY:r.offsetTop+n},r);return c.x<=s&&c.y<=l&&d.x>=a&&d.y>=o},pv=(e,t,n)=>{let r=Math.abs(t),i=Math.abs(n);if(e==="line"||e==="arrow"||e==="freedraw"){let a=Math.round(Math.atan(i/r)/Ya)*Ya;a===0?n=0:a===Math.PI/2?t=0:n=r*Math.tan(a)*Math.sign(n)||n}else e!=="selection"&&(n=r*Math.sign(n));return{width:t,height:n}},nw=(e,t,n,r)=>{let i=n-e,a=r-t,o=Math.round(Math.atan(a/i)/Ya)*Ya;if(o===0)a=0;else if(o===Math.PI/2)i=0;else{let s=Math.tan(o),l=-1,c=t-s*e,d=-1/s,u=-1,h=r-d*n,m=(l*h-u*c)/(s*u-d*l),p=(c*d-h*s)/(s*u-d*l);i=m-e,a=p-t}return{width:i,height:a}};var Pw=e=>{let t={width:e.width,height:e.height,x:e.x,y:e.y};if(e.width<0){let n=Math.abs(e.width);t.width=n,t.x=e.x-n}if(e.height<0){let n=Math.abs(e.height);t.height=n,t.y=e.y-n}return t};S();var ZV={mouse:8,pen:16,touch:28},loe=16,XV={e:!0,s:!0,n:!0,w:!0};var coe={e:!0,s:!0,n:!0,w:!0},KV={e:!0,s:!0,n:!0,w:!0,nw:!0,se:!0},XA={e:!0,s:!0,n:!0,w:!0},Rs=(e,t,n,r,i,a,o)=>{let[s,l]=Fe(e+n/2,t+r/2,i,a,o);return[s-n/2,l-r/2,n,r]},fv=e=>!(e.viewport.isMobile||e.isTouchScreen&&(i7||a7)),qA=e=>fv(e)?XV:{},gv=([e,t,n,r,i,a],o,s,l,c={},d=4)=>{let u=ZV[l],h=u/s.value,m=u/s.value,p=u/s.value,f=u/s.value,g=n-e,b=r-t,v=d/s.value,y=(u-pm*2)/(2*s.value),w={nw:c.nw?void 0:Rs(e-v-p+y,t-v-f+y,h,m,i,a,o),ne:c.ne?void 0:Rs(n+v-y,t-v-f+y,h,m,i,a,o),sw:c.sw?void 0:Rs(e-v-p+y,r+v-y,h,m,i,a,o),se:c.se?void 0:Rs(n+v-y,r+v-y,h,m,i,a,o),rotation:c.rotation?void 0:Rs(e+g/2-h/2,t-v-f+y-loe/s.value,h,m,i,a,o)},C=5*ZV.mouse/s.value;return Math.abs(g)>C&&(c.n||(w.n=Rs(e+g/2-h/2,t-v-f+y,h,m,i,a,o)),c.s||(w.s=Rs(e+g/2-h/2,r+v-y,h,m,i,a,o))),Math.abs(b)>C&&(c.w||(w.w=Rs(e-v-p+y,t+b/2-m/2,h,m,i,a,o)),c.e||(w.e=Rs(n+v-y,t+b/2-m/2,h,m,i,a,o))),w},QA=(e,t,n,r="mouse",i=XV)=>{if(e.locked)return{};if(e.type==="freedraw"||wt(e)){if(e.points.length===2){let[,o]=e.points;o[0]===0||o[1]===0?i=XA:o[0]>0&&o[1]<0?i=KV:o[0]>0&&o[1]>0?i=XA:o[0]<0&&o[1]>0?i=KV:o[0]<0&&o[1]<0&&(i=XA)}}else He(e)?i=coe:Mt(e)&&(i={...i,rotation:!0});let a=wt(e)?pm+8:pm;return gv(Me(e,n,!0),e.angle,t,r,i,a)},o6e=(e,t)=>{if(t.editingLinearElement)return!1;if(e.length>1)return!0;let n=e[0];return wt(n)?n.points.length>2:!0};S();var ek=(e,t,n)=>t>=e[0]&&t<=e[0]+e[2]&&n>=e[1]&&n<=e[1]+e[3],qV=(e,t,n,r,i,a,o,s)=>{if(!n.selectedElementIds[e.id])return!1;let{rotation:l,...c}=QA(e,a,t,o,qA(s));if(l&&ek(l,r,i))return"rotation";let d=Object.keys(c).filter(u=>{let h=c[u];return h?ek(h,r,i):!1});if(d.length>0)return d[0];if(fv(s)){let[u,h,m,p,f,g]=Me(e,t);if(e.type!=="text"&&!(wt(e)&&e.points.length<=2)){let b=o0/a.value,v=QV([u-b,h-b],[m+b,p+b],[f,g],Ja(e.angle));for(let[y,w]of Object.entries(v))if(fc([r,i],w,b))return y}}return!1},doe=(e,t,n,r,i,a,o,s)=>e.reduce((l,c)=>{if(l)return l;let d=qV(c,o,t,n,r,i,a,s);return d?{element:c,transformHandleType:d}:null},null),uoe=([e,t,n,r],i,a,o,s,l)=>{let c=gv([e,t,n,r,(e+n)/2,(t+r)/2],0,o,s,qA(l)),d=Object.keys(c).find(u=>{let h=c[u];return h&&ek(h,i,a)});if(d)return d;if(fv(l)){let u=(e+n)/2,h=(t+r)/2,m=o0/o.value,p=QV([e-m,t-m],[n+m,r+m],[u,h],Ja(0));for(let[f,g]of Object.entries(p))if(fc([i,a],g,m))return f}return!1},JA=["ns","nesw","ew","nwse"],hoe=(e,t)=>{let n=JA.indexOf(e);if(n>=0){let r=Math.round(t/(Math.PI/4));e=JA[(n+r)%JA.length]}return e},moe=e=>{let{element:t,transformHandleType:n}=e,r=t&&Math.sign(t.height)*Math.sign(t.width)===-1,i=null;switch(n){case"n":case"s":i="ns";break;case"w":case"e":i="ew";break;case"nw":case"se":r?i="nesw":i="nwse";break;case"ne":case"sw":r?i="nwse":i="nesw";break;case"rotation":return"grab"}return i&&t&&(i=hoe(i,t.angle)),i?`${i}-resize`:""},QV=([e,t],[n,r],i,a)=>{let o=rn([e,t],a,i),s=rn([n,t],a,i),l=rn([e,r],a,i),c=rn([n,r],a,i);return{n:[o,s],e:[s,c],s:[c,l],w:[l,o]}};S();var Ev=e=>e<0?e+2*Math.PI:e>=2*Math.PI?e-2*Math.PI:e,poe=(e,t,n,r,i,a,o,s,l,c,d)=>{if(n.length===1){let[u]=n;return t==="rotation"?(foe(u,r,s,l,i),eo(u,r)):He(u)&&(t==="nw"||t==="ne"||t==="sw"||t==="se")?(Eoe(u,r,t,a,s,l),eo(u,r)):t&&boe(e,o,u,r,t,a,s,l),!0}else if(n.length>1){if(t==="rotation")return voe(e,n,r,s,l,i,c,d),!0;if(t)return yoe(e,n,r,t,a,o,s,l),!0}return!1},foe=(e,t,n,r,i)=>{let[a,o,s,l]=Me(e,t),c=(a+s)/2,d=(o+l)/2,u;Mt(e)?u=0:(u=5*Math.PI/2+Math.atan2(r-d,n-c),i&&(u+=Ya/2,u-=u%Ya),u=Ev(u));let h=Wo(e);if(Ce(e,{angle:u}),h){let m=Go.getScene(e)?.getElement(h);m&&!pt(e)&&Ce(m,{angle:u})}},goe=(e,t,n,r)=>wt(e)||On(e)?{points:Js(0,t,Js(1,n,e.points,r),r)}:{},tk=(e,t,n)=>{let r=e.width;if(ar(e)){let o=wr(e,t);o&&(r=la(o,e))}let a=e.fontSize*(n/r);return a<r0?null:{size:a}},Eoe=(e,t,n,r,i,a)=>{let[o,s,l,c,d,u]=Me(e,t),[h,m]=Fe(i,a,d,u,-e.angle),p=0,f=0;n.includes("e")&&(p=(h-o)/(l-o)),n.includes("w")&&(p=(l-h)/(l-o)),n.includes("n")&&(f=(c-m)/(c-s)),n.includes("s")&&(f=(m-s)/(c-s));let g=Math.max(p,f);if(g>0){let b=e.width*g,v=e.height*g,y=tk(e,t,b);if(y===null)return;let w=[o,s],C=[l,c],A=[d,u],T=[o,s];if(["n","w","nw"].includes(n)&&(T=[C[0]-Math.abs(b),C[1]-Math.abs(v)]),n==="ne"){let Y=[w[0],C[1]];T=[Y[0],Y[1]-Math.abs(v)]}if(n==="sw"){let Y=[C[0],w[1]];T=[Y[0]-Math.abs(b),Y[1]]}["s","n"].includes(n)&&(T[0]=A[0]-b/2),["e","w"].includes(n)&&(T[1]=A[1]-v/2),r&&(T[0]=A[0]-Math.abs(b)/2,T[1]=A[1]-Math.abs(v)/2);let I=e.angle,k=on(T,[d,u],I),R=[T[0]+Math.abs(b)/2,T[1]+Math.abs(v)/2],O=on(R,[d,u],I);T=on(k,O,-I);let[P,F]=T;Ce(e,{fontSize:y.size,width:b,height:v,x:P,y:F})}},boe=(e,t,n,r,i,a,o,s)=>{let l=e.get(n.id),[c,d,u,h]=Qd(l,l.width,l.height,!0),m=[c,d],p=[u,h],f=Rm(m,p),g=on([o,s],f,-l.angle),[b,v,y,w]=Qd(n,n.width,n.height,!0),C=y-b,A=w-v,T=p[0]-m[0],I=p[1]-m[1],k=T/C,R=I/A,O={},P=ft(n,r);i.includes("e")&&(k=(g[0]-m[0])/C),i.includes("s")&&(R=(g[1]-m[1])/A),i.includes("w")&&(k=(p[0]-g[0])/C),i.includes("n")&&(R=(p[1]-g[1])/A);let F=l.width,Y=l.height,j=n.width*k,q=n.height*R;if(a&&(j=2*j-F,q=2*q-Y),t){let mt=Math.abs(j)/F,wn=Math.abs(q)/Y;if(i.length===1&&(q*=mt,j*=wn),i.length===2){let mn=Math.max(mt,wn);j=F*mn*Math.sign(j),q=Y*mn*Math.sign(q)}}if(P){let mt=e.get(P.id);if(mt&&(O={fontSize:mt.fontSize}),t){let wn={...n,width:j,height:q},mn=tk(P,r,la(wn,P));if(mn===null)return;O={fontSize:mn.size}}else{let wn=VP(Rn(P),P.lineHeight),mn=GP(P.fontSize,P.lineHeight);j=Math.max(j,wn),q=Math.max(q,mn)}}let[ne,H,V,$]=Qd(l,j,q,!0),B=V-ne,G=$-H,U=[...m];if(["n","w","nw"].includes(i)&&(U=[p[0]-Math.abs(B),p[1]-Math.abs(G)]),i==="ne"){let mt=[m[0],p[1]];U=[mt[0],mt[1]-Math.abs(G)]}if(i==="sw"){let mt=[p[0],m[1]];U=[mt[0]-Math.abs(B),mt[1]]}t&&(["s","n"].includes(i)&&(U[0]=f[0]-B/2),["e","w"].includes(i)&&(U[1]=f[1]-G/2));let Q=j<0,re=q<0;Q&&(i.includes("e")&&(U[0]-=Math.abs(B)),i.includes("w")&&(U[0]+=Math.abs(B))),re&&(i.includes("s")&&(U[1]-=Math.abs(G)),i.includes("n")&&(U[1]+=Math.abs(G))),a&&(U[0]=f[0]-Math.abs(B)/2,U[1]=f[1]-Math.abs(G)/2);let se=l.angle,me=on(U,f,se),it=[U[0]+Math.abs(B)/2,U[1]+Math.abs(G)/2],Qe=on(it,f,se);U=on(me,Qe,-se);let Le=[...U],Pe=l.x-ne,at=l.y-H;Le[0]+=Pe,Le[1]+=at;let xn=Le[0],qh=Le[1],Ql,Jl;(wt(n)||On(n))&&(Ql=Js(1,q,l.points,!0),Jl=Js(0,j,Ql,!0));let Pn={width:Math.abs(j),height:Math.abs(q),x:xn,y:qh,points:Jl};if("scale"in n&&"scale"in l&&Ce(n,{scale:[(Math.sign(V-l.x)||l.scale[0])*l.scale[0],(Math.sign($-l.y)||l.scale[1])*l.scale[1]]}),pt(n)&&P&&t){let mt=Pn.width/n.width*P.fontSize;if(mt<r0)return;O.fontSize=mt}Pn.width!==0&&Pn.height!==0&&Number.isFinite(Pn.x)&&Number.isFinite(Pn.y)&&(Ce(n,Pn),eo(n,r,{newSize:{width:Pn.width,height:Pn.height}}),P&&O!=null&&Ce(P,{fontSize:O.fontSize}),gc(n,r,i,t))},yoe=(e,t,n,r,i,a,o,s)=>{let l=t.reduce((H,V)=>{let $=e.get(V.id);return $&&H.push({orig:$,latest:V}),H},[]),c=l.reduce((H,{orig:V})=>{if(!wt(V))return H;let $=Wo(V);if(!$)return H;let B=e.get($)??null;if(!ar(B))return H;let G=st.getBoundTextElementPosition(V,B,n);return[...H,{...B,...G}]},[]),{minX:d,minY:u,maxX:h,maxY:m,midX:p,midY:f}=dD(l.map(({orig:H})=>H).concat(c)),g=h-d,b=m-u,v=r,y={ne:[d,m],se:[d,u],sw:[h,u],nw:[h,m],e:[d,u+b/2],w:[h,u+b/2],n:[d+g/2,m],s:[d+g/2,u]},[w,C]=i?[p,f]:y[v],A=i?2:1,T=Math.max(Math.abs(o-w)/g||0,Math.abs(s-C)/b||0)*A;if(T===0)return;let I=v.includes("e")||v.includes("w")?Math.abs(o-w)/g*A:1,k=v.includes("n")||v.includes("s")?Math.abs(s-C)/b*A:1,R=a||l.some(H=>H.latest.angle!==0||He(H.latest)||gD(H.latest));R&&(I=T,k=T);let O={ne:[o<w,s>C],se:[o<w,s<C],sw:[o>w,s<C],nw:[o>w,s>C],e:[o<w,!1],w:[o>w,!1],n:[!1,s>C],s:[!1,s<C]},[P,F]=O[v].map(H=>H?-1:1),Y=P<0,j=F<0,q=[];for(let{orig:H,latest:V}of l){if(He(H)&&ar(H))continue;let $=H.width*I,B=H.height*k,G=Ev(H.angle*P*F),U=wt(H)||On(H),Q=H.x-w,re=H.y-C,se=Y&&!U?$:0,me=j&&!U?B:0,it=w+P*(Q*I+se),Qe=C+F*(re*k+me),Le=goe(H,$*P,B*F,!1),Pe={x:it,y:Qe,width:$,height:B,angle:G,...Le};if(m0(H)&&(Pe.scale=[H.scale[0]*P,H.scale[1]*F]),He(H)){let xn=tk(H,n,$);if(!xn)return;Pe.fontSize=xn.size}let at=e.get(Wo(H)??"");if(at)if(R){let xn=at.fontSize*T;if(xn<r0)return;Pe.boundTextFontSize=xn}else Pe.boundTextFontSize=at.fontSize;q.push({element:V,update:Pe})}let ne=q.map(({element:H})=>H);for(let{element:H,update:{boundTextFontSize:V,...$}}of q){let{width:B,height:G,angle:U}=$;Ce(H,$,!1),eo(H,n,{simultaneouslyUpdated:ne,newSize:{width:B,height:G}});let Q=ft(H,n);Q&&V&&(Ce(Q,{fontSize:V,angle:wt(H)?void 0:U},!1),gc(H,n,r,!0))}Go.getScene(q[0].element)?.informMutation()},voe=(e,t,n,r,i,a,o,s)=>{let l=5*Math.PI/2+Math.atan2(i-s,r-o);a&&(l+=Ya/2,l-=l%Ya),t.filter(c=>!Mt(c)).forEach(c=>{let[d,u,h,m]=Me(c,n),p=(d+h)/2,f=(u+m)/2,g=e.get(c.id)?.angle??c.angle,[b,v]=Fe(p,f,o,s,l+g-c.angle);Ce(c,{x:c.x+(b-p),y:c.y+(v-f),angle:Ev(l+g)},!1),eo(c,n,{simultaneouslyUpdated:t});let y=ft(c,n);y&&!pt(c)&&Ce(y,{x:y.x+(b-p),y:y.y+(v-f),angle:Ev(l+g)},!1)}),Go.getScene(t[0])?.informMutation()},xoe=(e,t,n,r,i)=>{let[a,o,s,l]=t.length===1?Me(t[0],n):$r(t),c=(a+s)/2,d=(o+l)/2,u=t.length===1?t[0].angle:0;switch([r,i]=Fe(r,i,c,d,-u),e){case"n":return Fe(r-(a+s)/2,i-o,0,0,u);case"s":return Fe(r-(a+s)/2,i-l,0,0,u);case"w":return Fe(r-a,i-(o+l)/2,0,0,u);case"e":return Fe(r-s,i-(o+l)/2,0,0,u);case"nw":return Fe(r-a,i-o,0,0,u);case"ne":return Fe(r-s,i-o,0,0,u);case"sw":return Fe(r-a,i-l,0,0,u);case"se":return Fe(r-s,i-l,0,0,u);default:return[0,0]}},woe=(e,t)=>{let[,[n,r]]=t.points;return e==="nw"&&(n<0||r<0)||e==="ne"&&n>=0||e==="sw"&&n<=0||e==="se"&&(n>0||r>0)?"end":"origin"};S();var Soe=(e,t,n,r,i,a,o)=>{let s=new Set(t),l=t.filter(u=>Mt(u)).map(u=>u.id);if(l.length>0)for(let u of i.getNonDeletedElements())u.frameId!==null&&l.includes(u.frameId)&&s.add(u);let c=$r(Array.from(s).map(u=>e.originalElements.get(u.id)??u)),d=Coe(c,n,a,o);s.forEach(u=>{if(JV(e,u,d),!pt(u)){let h=ft(u,i.getNonDeletedElementsMap());h&&JV(e,h,d)}eo(u,i.getElementsMapIncludingDeleted(),{simultaneouslyUpdated:Array.from(s)})})},Coe=(e,t,n,r)=>{let[i,a]=e,o=i+t.x+n.x,s=a+t.y+n.y;if(n.x===0||n.y===0){let[l,c]=Om(i+t.x,a+t.y,r);n.x===0&&(o=l),n.y===0&&(s=c)}return{x:o-i,y:s-a}},JV=(e,t,n)=>{let r=e.originalElements.get(t.id)??t,i=r.x+n.x,a=r.y+n.y;Ce(t,{x:i,y:a})},Toe=(e,t,n)=>{let[r,i]=$r(e);return[t-r,n-i]},Ioe=(e,t,n,r,i,a,o,s,l,c,d,u=null)=>{l&&e.type!=="selection"&&(d?s=o/d:(Math.abs(a-r)>Math.abs(i-n)?{width:o,height:s}=pv(t,s,i<n?-o:o):{width:o,height:s}=pv(t,o,a<r?-s:s),s<0&&(s=-s)));let h=i<n?n-o:n,m=a<r?r-s:r;c&&(o+=o,s+=s,h=n-o/2,m=r-s/2),o!==0&&s!==0&&Ce(e,{x:h+(u?.x??0),y:m+(u?.y??0),width:o,height:s})};S();var Moe=(e,t)=>!!(!e.viewModeEnabled&&(e.activeTool.type!=="custom"&&(e.editingElement||e.activeTool.type!=="selection"&&e.activeTool.type!=="eraser"&&e.activeTool.type!=="hand"&&e.activeTool.type!=="laser")||aa(t,e).length));var q6e=e=>e.reduce((t,n)=>t+n.version,0),Q6e=e=>{let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e[n].versionNonce;return t>>>0},J6e=e=>{let t=5381;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)+t+r}return t>>>0},xP=e=>e.filter(t=>!t.isDeleted&&!Jm(t)),Dw=e=>e.filter(t=>!t.isDeleted),YV=e=>!e.isDeleted,eY=e=>Dw(e).map(t=>bx(t.type)?{...t,lastCommittedPoint:null}:t),ZD=e=>eY(e),lg=e=>eY(e);var nY=async e=>{let t;if(e.type===Te.png)try{return await(await import("./image-ZKACJTPS.js")).decodePngMetadata(e)}catch(n){throw n.message==="INVALID"?new Zo("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):new Zo("Error: cannot restore image")}else if("text"in Blob?t=await e.text():t=await new Promise(n=>{let r=new FileReader;r.readAsText(e,"utf8"),r.onloadend=()=>{r.readyState===FileReader.DONE&&n(r.result)}}),e.type===Te.svg)try{return await(await import("./image-ZKACJTPS.js")).decodeSvgMetadata({svg:t})}catch(n){throw n.message==="INVALID"?new Zo("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):new Zo("Error: cannot restore image")}return t};var Aoe=e=>e&&e.name.match(/\.(json|excalidraw|png|svg)$/)?.[1]||null,SSe=e=>e==="png"||e==="svg",WD=e=>{let t=Aoe(e);return t==="png"||t==="svg"},yv=e=>{let{type:t}=e||{};return!!t&&Object.values(dx).includes(t)},koe=async(e,t,n,r)=>{let i=await nY(e),a;try{try{a=JSON.parse(i)}catch(o){throw yv(e)?new Zo("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):o}if(YD(a))return{type:Te.excalidraw,data:cg({elements:lg(a.elements||[]),appState:{theme:t?.theme,fileHandle:r||e.handle||null,...c0(a.appState||{}),...t?Ux(a.elements||[],t):{}},files:a.files},t,n,{repairBindings:!0,refreshDimensions:!1})};if(Aw(a))return{type:Te.excalidrawlib,data:a};throw new Error("Error: invalid file")}catch(o){throw o instanceof Zo?o:new Error("Error: invalid file")}},VD=async(e,t,n,r)=>{let i=await koe(e,t,n,r);if(i.type!==Te.excalidraw)throw new Error("Error: invalid file");return i.data},Poe=(e,t="unpublished")=>{let n=JSON.parse(e);if(!Aw(n))throw new Error("Invalid library");let r=n.libraryItems||n.library;return t_(r,t)},CSe=async(e,t="unpublished")=>Poe(await nY(e),t),TSe=async e=>new Promise(async(t,n)=>{try{h0(e)&&(e=await e),e.toBlob(r=>{if(!r)return n(new J0("Error: Canvas too big","CANVAS_POSSIBLY_TOO_BIG"));t(r)})}catch(r){n(r)}}),ISe=async e=>{try{let t=await window.crypto.subtle.digest("SHA-1",await Os(e));return M7(new Uint8Array(t))}catch(t){return console.error(t),Ka(40)}},MSe=async e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let i=r.result;t(i)},r.onerror=i=>n(i),r.readAsDataURL(e)}),ASe=(e,t="")=>{let n=e.indexOf(","),r=atob(e.slice(n+1)),i=e.slice(0,n).split(":")[1].split(";")[0],a=new ArrayBuffer(r.length),o=new Uint8Array(a);for(let s=0;s<r.length;s++)o[s]=r.charCodeAt(s);return new File([a],t,{type:i})},kSe=async(e,t)=>{if(e.type===Te.svg)return e;let[n,r]=await Promise.all([import("./pica-ABPXE5C5.js").then(a=>a.default),import("./image-blob-reduce.esm-GOFU5DPX.js").then(a=>a.default)]),i=r({pica:n({features:["js","wasm"]})});if(t.outputType){let{outputType:a}=t;i._create_blob=function(o){return this.pica.toBlob(o.out_canvas,a,.8).then(s=>(o.out_blob=s,o))}}if(!yv(e))throw new Error("Error: unsupported file type",{cause:"UNSUPPORTED"});return new File([await i.toBlob(e,{max:t.maxWidthOrHeight})],e.name,{type:t.outputType||e.type})},PSe=(e,t="")=>new File([new TextEncoder().encode(e)],t,{type:Te.svg}),DSe=async(e,t="")=>{let n;try{n=await fetch(e)}catch{throw new Error("Error: failed to fetch image",{cause:"FETCH_ERROR"})}if(!n.ok)throw new Error("Error: failed to fetch image",{cause:"FETCH_ERROR"});let r=await n.blob();if(r.type&&yv(r)){let i=t||r.name||"";return new File([r],i,{type:r.type})}throw new Error("Error: unsupported file type",{cause:"UNSUPPORTED"})},_Se=async e=>{let t=e.dataTransfer.files.item(0),n=await Doe(e);return{file:t?await Mw(t):null,fileHandle:n}},Doe=async e=>{if(da)try{return await e.dataTransfer.items[0].getAsFileSystemHandle()||null}catch(t){return console.warn(t.name,t.message),null}return null},tY=e=>{let t=null,n=`${[...new Uint8Array(e).slice(0,8)].join(" ")} `,r={png:"137 80 78 71 13 10 26 10 ",jpg:"255 216 255 ",gif:"71 73 70 56 57 97 "};return n===r.png?t=Te.png:n.startsWith(r.jpg)?t=Te.jpg:n.startsWith(r.gif)&&(t=Te.gif),t},bv=(e,t,n)=>new File([e],n||"",{type:t}),Mw=async e=>{if(e.type){if(yv(e)){let t=await Os(e),n=tY(t);n&&n!==e.type&&(e=bv(t,n,e.name))}}else if(e?.name?.endsWith(".excalidrawlib"))e=bv(await Os(e),Te.excalidrawlib,e.name);else if(e?.name?.endsWith(".excalidraw"))e=bv(await Os(e),Te.excalidraw,e.name);else{let t=await Os(e),n=tY(t);n&&(e=bv(t,n,e.name))}return e},Os=e=>"arrayBuffer"in e?e.arrayBuffer():new Promise((t,n)=>{let r=new FileReader;r.onload=i=>{if(!i.target?.result)return n(new Error("Couldn't convert blob to ArrayBuffer"));t(i.target.result)},r.readAsArrayBuffer(e)});var nk=e=>new Promise((t,n)=>{let r=typeof e=="string"?new Blob([new TextEncoder().encode(e)]):new Blob([e instanceof Uint8Array?e:new Uint8Array(e)]),i=new FileReader;i.onload=a=>{if(!a.target||typeof a.target.result!="string")return n(new Error("couldn't convert to byte string"));t(a.target.result)},i.readAsBinaryString(r)}),rY=e=>{let t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let r=0,i=e.length;r<i;r++)n[r]=e.charCodeAt(r);return t},iY=e=>new TextDecoder("utf-8").decode(rY(e)),aY=async(e,t=!1)=>t?window.btoa(e):window.btoa(await nk(e)),oY=async(e,t=!1)=>t?window.atob(e):iY(window.atob(e)),rk=async({text:e,compress:t})=>{let n;if(t!==!1)try{n=await nk((0,vv.deflate)(e))}catch(r){console.error("encode: cannot deflate",r)}return{version:"1",encoding:"bstring",compressed:!!n,encoded:n||await nk(e)}},ik=async e=>{let t;switch(e.encoding){case"bstring":t=e.compressed?e.encoded:await iY(e.encoded);break;default:throw new Error(`decode: unknown encoding "${e.encoding}"`)}return e.compressed?(0,vv.inflate)(new Uint8Array(rY(t)),{to:"string"}):t};var _oe=async e=>{let n=(0,ak.default)(new Uint8Array(await Os(e))).find(r=>r.name==="tEXt");return n?ok.default.decode(n.data):null},kV=async({blob:e,metadata:t})=>{let n=(0,ak.default)(new Uint8Array(await Os(e))),r=ok.default.encode(Te.excalidraw,JSON.stringify(await rk({text:t,compress:!0})));return n.splice(-1,0,r),new Blob([(0,sY.default)(n)],{type:Te.png})},ZSe=async e=>{let t=await _oe(e);if(t?.keyword===Te.excalidraw)try{let n=JSON.parse(t.text);if(!("encoded"in n)){if("type"in n&&n.type===Or.excalidraw)return t.text;throw new Error("FAILED")}return await ik(n)}catch(n){throw console.error(n),new Error("FAILED")}throw new Error("INVALID")},KSe=async({text:e})=>{let t=await aY(JSON.stringify(await rk({text:e})),!0),n="";return n+=`<!-- payload-type:${Te.excalidraw} -->`,n+="<!-- payload-version:2 -->",n+="<!-- payload-start -->",n+=t,n+="<!-- payload-end -->",n},XSe=async({svg:e})=>{if(e.includes(`payload-type:${Te.excalidraw}`)){let t=e.match(/<!-- payload-start -->\s*(.+?)\s*<!-- payload-end -->/);if(!t)throw new Error("INVALID");let i=(e.match(/<!-- payload-version:(\d+) -->/)?.[1]||"1")!=="1";try{let a=await oY(t[1],i),o=JSON.parse(a);if(!("encoded"in o)){if("type"in o&&o.type===Or.excalidraw)return a;throw new Error("FAILED")}return await ik(o)}catch(a){throw console.error(a),new Error("FAILED")}}throw new Error("INVALID")};export{J as a,A_ as b,bg as c,_t as d,ip as e,qo as f,Ze as g,W as h,X as i,t0 as j,Tse as k,Ise as l,a7 as m,Ase as n,kse as o,Pse as p,o7 as q,s7 as r,Dse as s,_se as t,Lse as u,Rse as v,n0 as w,Ose as x,Nse as y,$se as z,Ji as A,Fse as B,_n as C,qr as D,jn as E,Za as F,ea as G,Nd as H,i0 as I,pm as J,Us as K,$d as L,Bse as M,zse as N,Hse as O,dx as P,Te as Q,Use as R,Or as S,ux as T,Gse as U,jse as V,Wse as W,Vse as X,Yse as Y,c7 as Z,Zse as _,Kse as $,s0 as aa,Xse as ba,qse as ca,Qse as da,Jse as ea,ele as fa,tle as ga,nle as ha,rle as ia,d7 as ja,u7 as ka,ile as la,ale as ma,xt as na,hx as oa,Ln as pa,Oo as qa,mx as ra,Qr as sa,ole as ta,fK as ua,g7 as va,sle as wa,lle as xa,cle as ya,E7 as za,ao as Aa,nn as Ba,Ka as Ca,Tle as Da,Ile as Ea,Mle as Fa,bK as Ga,Ale as Ha,kle as Ia,gx as Ja,Rn as Ka,C7 as La,T7 as Ma,I7 as Na,Ple as Oa,Dle as Pa,Ii as Qa,gm as Ra,_le as Sa,Em as Ta,Ex as Ua,Lle as Va,Bd as Wa,Rle as Xa,Ole as Ya,Nle as Za,js as _a,$le as $a,Fle as ab,Ble as bb,zle as cb,et as db,Hle as eb,$o as fb,Ule as gb,Gle as hb,jle as ib,Wle as jb,h0 as kb,Vle as lb,Fo as mb,Yle as nb,lc as ob,Zle as pb,A7 as qb,Kle as rb,Xle as sb,qle as tb,Qle as ub,Jle as vb,k7 as wb,Bo as xb,ece as yb,qa as zb,m0 as Ab,p0 as Bb,bm as Cb,ta as Db,He as Eb,ym as Fb,D7 as Gb,Mt as Hb,wt as Ib,pt as Jb,bx as Kb,zo as Lb,SK as Mb,CK as Nb,yx as Ob,zd as Pb,ar as Qb,f0 as Rb,ace as Sb,oce as Tb,ro as Ub,ca as Vb,eg as Wb,Zo as Xb,_D as Yb,Vm as Zb,vc as _b,Go as $b,sD as ac,on as bc,ti as cc,to as dc,Om as ec,Vo as fc,Xme as gc,qme as hc,dX as ic,Eue as jc,uX as kc,hX as lc,Gx as mc,mX as nc,L0 as oc,_ue as pc,ni as qc,Lue as rc,Rue as sc,Oue as tc,Wx as uc,Kue as vc,Yx as wc,Zd as xc,Xue as yc,que as zc,Vx as Ac,vX as Bc,Que as Cc,_m as Dc,eo as Ec,Jue as Fc,ehe as Gc,the as Hc,kP as Ic,st as Jc,$m as Kc,FP as Lc,BP as Mc,Fhe as Nc,ow as Oc,lw as Pc,Zhe as Qc,HP as Rc,Ec as Sc,Kd as Tc,GP as Uc,cw as Vc,Xd as Wc,VP as Xc,Wo as Yc,ft as Zc,wr as _c,Khe as $c,Xhe as ad,qhe as bd,Qhe as cd,Jhe as dd,aw as ed,la as fd,Bm as gd,eme as hd,H0 as id,Me as jd,$r as kd,Gme as ld,dD as md,jme as nd,Gs as od,yle as pd,c0 as qd,y7 as rd,v7 as sd,pq as td,rpe as ud,ipe as vd,fq as wd,ape as xd,mD as yd,ope as zd,gq as Ad,Jd as Bd,spe as Cd,lpe as Dd,cpe as Ed,dpe as Fd,eu as Gd,fpe as Hd,bD as Id,yD as Jd,vD as Kd,At as Ld,kq as Md,Pq as Nd,Dq as Od,CD as Pd,Hm as Qd,Bpe as Rd,zpe as Sd,Hpe as Td,Upe as Ud,io as Vd,Q0 as Wd,Oq as Xd,Gpe as Yd,yc as Zd,Nq as _d,Um as $d,$q as ae,jpe as be,ng as ce,iu as de,RD as ee,zD as fe,HD as ge,Ffe as he,Bfe as ie,da as je,jD as ke,Iw as le,e_ as me,kw as ne,cg as oe,t_ as pe,_oe as qe,kV as re,ZSe as se,KSe as te,XSe as ue,Aoe as ve,SSe as we,WD as xe,yv as ye,koe as ze,VD as Ae,Poe as Be,CSe as Ce,TSe as De,ISe as Ee,MSe as Fe,ASe as Ge,kSe as He,PSe as Ie,DSe as Je,_Se as Ke,Mw as Le,Qm as Me,b1e as Ne,y1e as Oe,Qq as Pe,v1e as Qe,Jq as Re,KD as Se,XD as Te,T1e as Ue,n_ as Ve,W1e as We,V1e as Xe,Y1e as Ye,Z1e as Ze,K1e as _e,cQ as $e,dQ as af,_w as bf,o0e as cf,s0e as df,Rw as ef,uQ as ff,g0e as gf,v0e as hf,i_ as if,a_ as jf,mQ as kf,c_ as lf,Ow as mf,h_ as nf,m_ as of,lhe as pf,che as qf,F0 as rf,B0 as sf,tt as tf,dhe as uf,uhe as vf,hhe as wf,mhe as xf,phe as yf,fhe as zf,rge as Af,SQ as Bf,fge as Cf,gge as Df,x_ as Ef,Ege as Ff,bge as Gf,S_ as Hf,Bw as If,zg as Jf,Hg as Kf,cL as Lf,Ug as Mf,dL as Nf,I3 as Of,ma as Pf,NL as Qf,Vg as Rf,Yg as Sf,Zg as Tf,Kg as Uf,Ep as Vf,Fwe as Wf,qae as Xf,Qae as Yf,Bwe as Zf,DV as _f,toe as $f,LV as ag,h3e as bg,el as cg,m3e as dg,p3e as eg,F1 as fg,Nw as gg,f3e as hg,g3e as ig,Fr as jg,E3e as kg,ioe as lg,GV as mg,aoe as ng,b3e as og,y3e as pg,ug as qg,p_ as rg,f_ as sg,KX as tg,gme as ug,Eme as vg,mw as wg,an as xg,Ce as yg,Ai as zg,Gm as Ag,Jm as Bg,jV as Cg,nw as Dg,Pw as Eg,qA as Fg,gv as Gg,QA as Hg,o6e as Ig,doe as Jg,uoe as Kg,moe as Lg,poe as Mg,yoe as Ng,xoe as Og,woe as Pg,Soe as Qg,Toe as Rg,Ioe as Sg,Moe as Tg,q6e as Ug,Q6e as Vg,J6e as Wg,Dw as Xg,YV as Yg,ooe as Zg,R0 as _g,M3e as $g,fX as ah,gX as bh,aa as ch,EX as dh,vw as eh,cX as fh,Ux as gh,pX as hh,xue as ih};
301
+ /*! Bundled license information:
302
+
303
+ react/cjs/react-jsx-runtime.production.min.js:
304
+ (**
305
+ * @license React
306
+ * react-jsx-runtime.production.min.js
307
+ *
308
+ * Copyright (c) Facebook, Inc. and its affiliates.
309
+ *
310
+ * This source code is licensed under the MIT license found in the
311
+ * LICENSE file in the root directory of this source tree.
312
+ *)
313
+
314
+ use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js:
315
+ (**
316
+ * @license React
317
+ * use-sync-external-store-shim.production.min.js
318
+ *
319
+ * Copyright (c) Facebook, Inc. and its affiliates.
320
+ *
321
+ * This source code is licensed under the MIT license found in the
322
+ * LICENSE file in the root directory of this source tree.
323
+ *)
324
+
325
+ use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js:
326
+ (**
327
+ * @license React
328
+ * use-sync-external-store-shim/with-selector.production.min.js
329
+ *
330
+ * Copyright (c) Facebook, Inc. and its affiliates.
331
+ *
332
+ * This source code is licensed under the MIT license found in the
333
+ * LICENSE file in the root directory of this source tree.
334
+ *)
335
+ */