collabmd 0.1.40 → 0.1.42

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 (634) hide show
  1. package/README.md +68 -0
  2. package/dist/client/assets/CodeMirrorEditor-UCMRAMCV-Fb3TgxXK.js +1 -0
  3. package/dist/client/assets/abnfDiagram-VRR7QNED-C-CM0mGi.js +1 -0
  4. package/dist/client/assets/{apl-C1JYSI8J.js → apl-gfMMiTNf.js} +1 -1
  5. package/dist/client/assets/ar-SA-YLAB6A27-B9ogj_Jh.js +8 -0
  6. package/dist/client/assets/{arc-B59iLcOr.js → arc-DqK6O3qL.js} +1 -1
  7. package/dist/client/assets/architecture-TIHT7OUA-BWqzHezU.js +1 -0
  8. package/dist/client/assets/architectureDiagram-ZJ3FMSHR-DL35gHTu.js +36 -0
  9. package/dist/client/assets/az-AZ-5JXPK2I2-C6Se5-4R.js +1 -0
  10. package/dist/client/assets/bases-preview-controller-CBHDzzot.js +143 -0
  11. package/dist/client/assets/bg-BG-NIQ2RVNG-xrf33IaO.js +5 -0
  12. package/dist/client/assets/blockDiagram-677ZJIJ3-BLomrZyt.js +132 -0
  13. package/dist/client/assets/bn-BD-BN65R3DE-YVZWNN-c.js +3 -0
  14. package/dist/client/assets/bn-IN-2YT4KVKB-YVZWNN-c.js +3 -0
  15. package/dist/client/assets/button-2ZnWQkWV.js +1 -0
  16. package/dist/client/assets/{c4Diagram-AAUBKEIU-DMK9WIWS.js → c4Diagram-LMCZKHZV-al3Umu1D.js} +6 -6
  17. package/dist/client/assets/ca-ES-KSERGC3M-CoMtV4dM.js +8 -0
  18. package/dist/client/assets/channel-XzBGGMWh.js +1 -0
  19. package/dist/client/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  20. package/dist/client/assets/chunk-32BRIVSS-BD6LQmvI.js +1 -0
  21. package/dist/client/assets/chunk-52WLFC77-BjzXVnqm.js +10 -0
  22. package/dist/client/assets/chunk-5FCAYU7R-DNtJmW0j.js +1 -0
  23. package/dist/client/assets/chunk-5HE753X5-o8-OCfIL.js +1 -0
  24. package/dist/client/assets/{chunk-N66VUXT2-CZ58QOjk.js → chunk-5JV3BV7I-DKfYBAeY.js} +1 -1
  25. package/dist/client/assets/chunk-5TONJI2A-DOX2waSJ.js +2 -0
  26. package/dist/client/assets/{chunk-FMBD7UC4-DD6CIukb.js → chunk-5VM5RSS4-ZNzvKenW.js} +1 -1
  27. package/dist/client/assets/chunk-6GK3VUBP-ChzWImvX.js +41 -0
  28. package/dist/client/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
  29. package/dist/client/assets/chunk-BIQX33UG-CuPbkyWp.js +1 -0
  30. package/dist/client/assets/chunk-C7G6YPKG-C97QUAKv.js +1 -0
  31. package/dist/client/assets/chunk-CJTDIR4C-DvUbqeGR.js +1 -0
  32. package/dist/client/assets/chunk-CQNSW5MT-BbEh_krl.js +1 -0
  33. package/dist/client/assets/chunk-CYSBUYHQ-CbOq7Rc1.js +1 -0
  34. package/dist/client/assets/chunk-EMLP6XTP-BoneA0Uo.js +1 -0
  35. package/dist/client/assets/chunk-EX3LRPZG-DNVm3Wj1.js +231 -0
  36. package/dist/client/assets/chunk-FWX5IMBZ-Ch9_j2qF.js +2 -0
  37. package/dist/client/assets/chunk-HOUHSVGY-DX1huN9x.js +1 -0
  38. package/dist/client/assets/chunk-ICXQ74PX-DGYhuP6g.js +2 -0
  39. package/dist/client/assets/chunk-JG7HCLWE-Dk4_aECj.js +2 -0
  40. package/dist/client/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  41. package/dist/client/assets/chunk-KEIR6QF5-Dj-OpFgW.js +161 -0
  42. package/dist/client/assets/chunk-MOJQB5TN-BEEcDvmL.js +88 -0
  43. package/dist/client/assets/chunk-MOZMSUNE-BgA8jCvb.js +1 -0
  44. package/dist/client/assets/chunk-OGEWGWER-Xh5bvoYs.js +1 -0
  45. package/dist/client/assets/chunk-OSBZ3O6U-CX9EQ5t2.js +1 -0
  46. package/dist/client/assets/chunk-PUDLZKDR-C-JwZaMh.js +156 -0
  47. package/dist/client/assets/{chunk-O5CBEL6O-BFgstMja.js → chunk-Q4XR5HBZ-Dyewsidf.js} +17 -17
  48. package/dist/client/assets/chunk-QBLGF6JB-C9zGMqvP.js +1 -0
  49. package/dist/client/assets/chunk-R7FJI6CG-BpBhcF6R.js +1 -0
  50. package/dist/client/assets/chunk-RYQCIY6F-Dtr3kkSR.js +1 -0
  51. package/dist/client/assets/chunk-SRAX5OIU-Bpn6XoyU.js +1 -0
  52. package/dist/client/assets/chunk-U6XO7XAA-CR0BSRFR.js +2 -0
  53. package/dist/client/assets/{chunk-727SXJPM-DNANnyAn.js → chunk-V7JOEXUC-Bo_5WqHt.js} +6 -6
  54. package/dist/client/assets/chunk-VAUOI2AC-EcvKeBKU.js +1 -0
  55. package/dist/client/assets/chunk-VR4S4FIN-uXjSaaA7.js +1 -0
  56. package/dist/client/assets/chunk-WYO6CB5R-HgTPu1OL.js +127 -0
  57. package/dist/client/assets/chunk-XXDRQBXY-Bq6zMMOx.js +1 -0
  58. package/dist/client/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  59. package/dist/client/assets/chunk-YOTPTUD7-CjHV8V6f.js +1 -0
  60. package/dist/client/assets/{chunk-LOOWOR4L-C5BUwXgZ.js → chunk-Z24UKHUO-BQ6-bK37.js} +3 -3
  61. package/dist/client/assets/{chunk-Z5NKEFVG-GcpeeLo6.js → chunk-Z5NKEFVG-DC2Lcs-4.js} +7 -7
  62. package/dist/client/assets/chunk-ZGVPDNZ5-Bmet6b46.js +62 -0
  63. package/dist/client/assets/{chunk-XPW4576I-D5FnFhOk.js → chunk-ZIRB5QZD-C6fEPe3t.js} +2 -2
  64. package/dist/client/assets/classDiagram-OUVF2IWQ-vy5bnN3c.js +1 -0
  65. package/dist/client/assets/classDiagram-v2-EOCWNBFH-vy5bnN3c.js +1 -0
  66. package/dist/client/assets/clike-CVjTFI47.js +1 -0
  67. package/dist/client/assets/cobol-DHLQUbN7.js +1 -0
  68. package/dist/client/assets/controls-LYQrRFSF.css +1 -0
  69. package/dist/client/assets/cose-bilkent-JH36ORCC-ClqQrHIF.js +1 -0
  70. package/dist/client/assets/cs-CZ-EOMS3IHD-Bo0hDCLX.js +7 -0
  71. package/dist/client/assets/cynefin-VYW2F7L2-4m18BxUG.js +1 -0
  72. package/dist/client/assets/cynefinDiagram-TSTJHNR4-BNlZcGFF.js +62 -0
  73. package/dist/client/assets/cytoscape.esm-CQFVGiJu.js +321 -0
  74. package/dist/client/assets/da-DK-AVL3DJQK-s5-TpkxN.js +2 -0
  75. package/dist/client/assets/dagre-VKFMJZFB-CSQjHsP2.js +4 -0
  76. package/dist/client/assets/dagre-dpRSp0QF.js +1 -0
  77. package/dist/client/assets/de-CH-M25HCZK4-B0r4rx6B.js +7 -0
  78. package/dist/client/assets/de-DE-BEN6XGXY-B0r4rx6B.js +7 -0
  79. package/dist/client/assets/diagram-FQU43EPY-D0RPbiE5.js +3 -0
  80. package/dist/client/assets/diagram-G47NLZAW-XriksZQN.js +24 -0
  81. package/dist/client/assets/diagram-NH7WQ7WH-CaTayrXM.js +24 -0
  82. package/dist/client/assets/diagram-OA4YK3LP-ruJmRhl8.js +30 -0
  83. package/dist/client/assets/diagram-WEI45ONY-C18MNAQv.js +41 -0
  84. package/dist/client/assets/diagram-action-icons-aa_KOv9h.js +36 -0
  85. package/dist/client/assets/{dist-CJMPm6rd.js → dist-0x9D2TFD.js} +1 -1
  86. package/dist/client/assets/{dist-BsTc7qjG.js → dist-B0NFuQC3.js} +1 -1
  87. package/dist/client/assets/{dist-DSehUDUA.js → dist-BA633xb4.js} +1 -1
  88. package/dist/client/assets/{dist-D5hPoFa5.js → dist-BUxzPC-Q.js} +4 -4
  89. package/dist/client/assets/dist-Bx-T__Lj.js +1 -0
  90. package/dist/client/assets/dist-ByYtm-FJ.js +1 -0
  91. package/dist/client/assets/{dist-CAlqrzaF.js → dist-CCrwHjeP.js} +1 -1
  92. package/dist/client/assets/dist-CHJCI2AN.js +1 -0
  93. package/dist/client/assets/dist-CHokDUN_.js +1 -0
  94. package/dist/client/assets/dist-CI1X-CJ2.js +9 -0
  95. package/dist/client/assets/{dist-BOA6xeuH.js → dist-CPim1xdZ.js} +1 -1
  96. package/dist/client/assets/{dist-q3smPWAL.js → dist-CQTo4Y46.js} +1 -1
  97. package/dist/client/assets/{dist-wA96SVn6.js → dist-CZG184W2.js} +1 -1
  98. package/dist/client/assets/{dist-D5BVeoD4.js → dist-C__bPRpd.js} +1 -1
  99. package/dist/client/assets/{dist-BBsYBvEp.js → dist-Cd1BXkVC.js} +1 -1
  100. package/dist/client/assets/dist-CeEU6QwA.js +2 -0
  101. package/dist/client/assets/{dist-CDsAhnoa.js → dist-CzNyYE-S.js} +1 -1
  102. package/dist/client/assets/{dist-x4M0Qd0y.js → dist-D1W8XQvM.js} +1 -1
  103. package/dist/client/assets/{dist-CtHMYO6t.js → dist-D3Tmtejd.js} +1 -1
  104. package/dist/client/assets/{dist-Dv_PLWtE.js → dist-D4MWz_rC.js} +1 -1
  105. package/dist/client/assets/{dist-DCqHC6ts.js → dist-D7-13adP.js} +1 -1
  106. package/dist/client/assets/{dist-Bhn_Fiol.js → dist-DG2HpWvu.js} +1 -1
  107. package/dist/client/assets/dist-DUj7Xwud.js +13 -0
  108. package/dist/client/assets/{dist-DFzJ8okV.js → dist-DXTgEdvE.js} +1 -1
  109. package/dist/client/assets/{dist-U35xPXYU.js → dist-DnbVQL2z.js} +1 -1
  110. package/dist/client/assets/dist-QiKOmE2-.js +1 -0
  111. package/dist/client/assets/{dist-Dx8yU-RA.js → dist-YCtFk_v0.js} +1 -1
  112. package/dist/client/assets/dist-du6QqIs42.js +1 -0
  113. package/dist/client/assets/dist-gGmuzNio.js +1 -0
  114. package/dist/client/assets/dist-qx0Iv9vM.js +1 -0
  115. package/dist/client/assets/dist-snK6kYA_.js +1 -0
  116. package/dist/client/assets/{dockerfile-D8_6_FRV.js → dockerfile-BLkNEvjs.js} +1 -1
  117. package/dist/client/assets/drawio-editor-Z2u5UkLg.js +9 -0
  118. package/dist/client/assets/drawio-embed-controller-BtzURctK.js +1 -0
  119. package/dist/client/assets/drawio-room-yBUzk-vg.js +1 -0
  120. package/dist/client/assets/drawioEditor-B_kenUdu.js +2 -0
  121. package/dist/client/assets/ebnfDiagram-CCIWWBDH-exNgBUy6.js +1 -0
  122. package/dist/client/assets/editor-session-MbnP-AVK.js +16 -0
  123. package/dist/client/assets/el-GR-UBGIF2NW-DRoYAN8w.js +7 -0
  124. package/dist/client/assets/embedded-editor-base-DziW8fkY.css +1 -0
  125. package/dist/client/assets/{en-CMP6EMR6-Bfz_MnNa.js → en-PCJ7LJZ2-1SKiH5y3.js} +1 -1
  126. package/dist/client/assets/erDiagram-Q63AITRT-CoYS49kY.js +85 -0
  127. package/dist/client/assets/es-ES-SQEM5MNY-D5EtY06q.js +7 -0
  128. package/dist/client/assets/eu-ES-YG5N2JAG-CZ0xKIU4.js +7 -0
  129. package/dist/client/assets/eventmodeling-45OFAUF4-Dp0gpjhg.js +1 -0
  130. package/dist/client/assets/excalidraw-editor-CN3Wpa0D.css +1 -0
  131. package/dist/client/assets/{excalidraw-editor-DzL1T9D9.js → excalidraw-editor-kQEbzoXi.js} +4 -4
  132. package/dist/client/assets/excalidraw-embed-controller-BKx05cjZ.js +1 -0
  133. package/dist/client/assets/excalidraw-embed-reconciler-DGiagExg.js +1 -0
  134. package/dist/client/assets/{excalidraw-mermaid-stub-B5sWezsO.js → excalidraw-mermaid-stub-DE5FTiZB.js} +1 -1
  135. package/dist/client/assets/excalidraw-scene-qiXFUZvq.js +176 -0
  136. package/dist/client/assets/excalidrawEditor-fUB8lhQG.js +2 -0
  137. package/dist/client/assets/{export-page-BkCqT_2s.js → export-page-CbIrJ_oK.js} +4 -4
  138. package/dist/client/assets/exportDocument-DdfKM4AY.js +2 -0
  139. package/dist/client/assets/exportDocument-cl8dlTx1.css +1 -0
  140. package/dist/client/assets/fa-IR-EVNM7MAJ-olht-LEH.js +9 -0
  141. package/dist/client/assets/{factor-Cz-hzBGH.js → factor-D7LVTn2l.js} +1 -1
  142. package/dist/client/assets/fi-FI-MW7ZEZ64-D1PIXbLy.js +6 -0
  143. package/dist/client/assets/file-history-view-controller-CK3oHDCT.js +112 -0
  144. package/dist/client/assets/flowDiagram-23GEKE2U-DgaZtMXJ.js +1 -0
  145. package/dist/client/assets/fr-FR-Q7ZPXBDE-B0DjjyfT.js +12 -0
  146. package/dist/client/assets/ganttDiagram-NO4QXBWP-DaBgmYw5.js +292 -0
  147. package/dist/client/assets/git-diff-view-controller-qorJ_Quo.js +150 -0
  148. package/dist/client/assets/git-panel-controller-CzgJWqbB.js +207 -0
  149. package/dist/client/assets/gitGraph-TEB2WS4Q-Do0SQOtM.js +1 -0
  150. package/dist/client/assets/gitGraphDiagram-IHSO6WYX-x3NetpXU.js +106 -0
  151. package/dist/client/assets/gl-ES-O5B74VQL-DH5u_ADp.js +6 -0
  152. package/dist/client/assets/{graphlib-Dduz6oB8.js → graphlib-DS17s2tU.js} +1 -1
  153. package/dist/client/assets/{haxe-CcPA1xnA.js → haxe-DjVOVvNP.js} +1 -1
  154. package/dist/client/assets/he-IL-QGC2WXJA-BSBR1RcG.js +8 -0
  155. package/dist/client/assets/hi-IN-DEZ33NMQ-CorD0_d0.js +3 -0
  156. package/dist/client/assets/hu-HU-2ZPNVYSC-BlqNXhNG.js +3 -0
  157. package/dist/client/assets/id-ID-W65WM5EO-SkLgeJLx.js +8 -0
  158. package/dist/client/assets/image-QEDDDPDB-DtzL4Wgr.js +1 -0
  159. package/dist/client/assets/{image-blob-reduce.esm-CRyv8pnU.js → image-blob-reduce.esm-DLFdRAwc.js} +1 -1
  160. package/dist/client/assets/index-Burthu48.js +2 -0
  161. package/dist/client/assets/index-CYVmRVJX.css +1 -0
  162. package/dist/client/assets/info-DKCQHKI2-DIc7uC4I.js +1 -0
  163. package/dist/client/assets/infoDiagram-FWYZ7A6U-DyfGrH8z.js +2 -0
  164. package/dist/client/assets/input-CXk9Zxz9.js +1 -0
  165. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-BPqURwBR.js → ishikawaDiagram-FXEZZL3T-BOts527_.js} +2 -2
  166. package/dist/client/assets/it-IT-GAWJM2XW-CDZugsE0.js +12 -0
  167. package/dist/client/assets/ja-JP-FOAUPTH5-DkKXnwj8.js +12 -0
  168. package/dist/client/assets/{javascript-gTK9fxz6.js → javascript-B9TABJff.js} +1 -1
  169. package/dist/client/assets/javascript-BRzqD9BA.js +1 -0
  170. package/dist/client/assets/{journeyDiagram-JHISSGLW-CvxY2Fte.js → journeyDiagram-5HDEW3XC-DF37OVrZ.js} +3 -3
  171. package/dist/client/assets/jsx-runtime-DKdBMi_L.js +1 -0
  172. package/dist/client/assets/kaa-UEDB54S7-C0Sv0drM.js +1 -0
  173. package/dist/client/assets/kab-KAB-CTLMBVE3-QfxUgzL5.js +4 -0
  174. package/dist/client/assets/{kanban-definition-UN3LZRKU-Ex7702dO.js → kanban-definition-HUTT4EX6-nCjbm1T6.js} +24 -24
  175. package/dist/client/assets/katex-B7rAX3Vi.js +257 -0
  176. package/dist/client/assets/keyboard-shortcuts-CLixkZxp.css +1 -0
  177. package/dist/client/assets/keyboard-shortcuts-CLyuDeFZ.js +1 -0
  178. package/dist/client/assets/kk-KZ-XZK63ADD-CMZObxxP.js +1 -0
  179. package/dist/client/assets/km-KH-PBSJLZ2M-Bh1DsarT.js +7 -0
  180. package/dist/client/assets/ko-KR-YNTPN6WQ-DPBaHnwT.js +5 -0
  181. package/dist/client/assets/ku-TR-XUD5BUEU-75pMUQoD.js +6 -0
  182. package/dist/client/assets/{line-DRJILpPI.js → line-h44YiLOQ.js} +1 -1
  183. package/dist/client/assets/{linear-rFRiXd2u.js → linear-DhAcoVP9.js} +1 -1
  184. package/dist/client/assets/lt-LT-LYCDYH7O-BeKUsKuy.js +3 -0
  185. package/dist/client/assets/lv-LV-7ROPDEEI-CrA6QOtq.js +4 -0
  186. package/dist/client/assets/main-DdqVKzQ4.js +813 -0
  187. package/dist/client/assets/map-BaFkSB1l.js +1 -0
  188. package/dist/client/assets/mermaid-parser.core-ygm3cZ_w.js +4 -0
  189. package/dist/client/assets/mermaid-runtime-2fJoRo49.js +11 -0
  190. package/dist/client/assets/{mindmap-definition-RKZ34NQL-D4pwLdMH.js → mindmap-definition-LN4V7U3C-CTpHMYFE.js} +8 -8
  191. package/dist/client/assets/mr-IN-TU6BXRKP-mIvXG0bt.js +9 -0
  192. package/dist/client/assets/my-MM-SJ3RWIEQ-CeEN5n4z.js +1 -0
  193. package/dist/client/assets/navigation-ChYBdSlq.css +1 -0
  194. package/dist/client/assets/nb-NO-GONF2AKR-IChp6OiI.js +8 -0
  195. package/dist/client/assets/nl-NL-UZF6UEKB-DfPPXXjo.js +13 -0
  196. package/dist/client/assets/nn-NO-ZVFRXEEO-BtpjNSGp.js +4 -0
  197. package/dist/client/assets/{nsis-QPGhLAeY.js → nsis-AQ_alPln.js} +1 -1
  198. package/dist/client/assets/oc-FR-MBF2Z56W-CBl14QBM.js +4 -0
  199. package/dist/client/assets/{ordinal-De-qfORd.js → ordinal-hYBb2elL.js} +1 -1
  200. package/dist/client/assets/pa-IN-3JCDVKKL-D95A1XFb.js +4 -0
  201. package/dist/client/assets/packet-7NZHBO7P-D2duWGIK.js +1 -0
  202. package/dist/client/assets/pegDiagram-2B236MQR-Bq9qITsk.js +1 -0
  203. package/dist/client/assets/percentages-WBIPKLEE-bhlTAhiB.js +1 -0
  204. package/dist/client/assets/pica-D0pwGKw7.js +2 -0
  205. package/dist/client/assets/pie-RZYD4A2V-CynqTUkZ.js +1 -0
  206. package/dist/client/assets/pieDiagram-ENE6RG2P--ax2FUc8.js +39 -0
  207. package/dist/client/assets/pl-PL-EERMMCTN-dIzrbxJt.js +12 -0
  208. package/dist/client/assets/preload-helper-HclGiUj8.js +1 -0
  209. package/dist/client/assets/preview-diagram-utils-BPaXsmlV.js +1 -0
  210. package/dist/client/assets/preview-render-compiler-C8wbmTyE.js +1 -0
  211. package/dist/client/assets/preview-render-compiler-CrQBxqqa.js +35 -0
  212. package/dist/client/assets/preview-render-profile-C89_PyT3.js +23 -0
  213. package/dist/client/assets/preview-render-worker-D84F1vpn.js +59 -0
  214. package/dist/client/assets/pt-BR-W4AF5QMX-DIJs8D4M.js +6 -0
  215. package/dist/client/assets/pt-PT-GNPUWAHX-BopN284Y.js +8 -0
  216. package/dist/client/assets/{pug-lkTEco3G.js → pug-Ck0YjsGM.js} +1 -1
  217. package/dist/client/assets/python-2zlmcyof.js +1 -0
  218. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-CD77Rny0.js → quadrantDiagram-ABIIQ3AL-f0PUv7DH.js} +6 -6
  219. package/dist/client/assets/{quick-switcher-controller-CVJBt6V9.js → quick-switcher-controller-CVRUPEKp.js} +1 -1
  220. package/dist/client/assets/radar-I7S5WNFK-fIKE12aT.js +1 -0
  221. package/dist/client/assets/railroad-3IZDKUUU-Bgx8HJTj.js +1 -0
  222. package/dist/client/assets/railroad-abnf-AHOZXSZD-Nh6k60mH.js +1 -0
  223. package/dist/client/assets/railroad-ebnf-EBAXGLYW-C74h3s_I.js +1 -0
  224. package/dist/client/assets/railroad-peg-LSFZ7HO6-0hT-lN-u.js +1 -0
  225. package/dist/client/assets/railroadDiagram-RFXS5EU6-CZD_9g-4.js +1 -0
  226. package/dist/client/assets/react-lCSYwAWP.js +1 -0
  227. package/dist/client/assets/{requirementDiagram-4Y6WPE33-DdKM6ZWI.js → requirementDiagram-TGXJPOKE-C4Jwr3TE.js} +7 -7
  228. package/dist/client/assets/ro-RO-DXHP33S5-PGxfl-ng.js +12 -0
  229. package/dist/client/assets/{room-Cha55fQg.js → room-BhC-3iml.js} +1 -1
  230. package/dist/client/assets/ru-RU-TTW2P7NF-Dwnn0sc5.js +10 -0
  231. package/dist/client/assets/runtime-config-CDgeuPWN.js +1 -0
  232. package/dist/client/assets/runtime-paths-DvpihCEq.js +1 -0
  233. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-BH3_LNkI.js → sankeyDiagram-HTMAVEWB-B2B2mdB6.js} +2 -2
  234. package/dist/client/assets/scheme-tChLYBuY.js +1 -0
  235. package/dist/client/assets/segmented-control-DhUkW6ro.js +1 -0
  236. package/dist/client/assets/sequenceDiagram-DBY2YBRQ-DonUqDnp.js +162 -0
  237. package/dist/client/assets/si-LK-BE6O7LVF-QO9nybVB.js +1 -0
  238. package/dist/client/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
  239. package/dist/client/assets/sk-SK-OI3KJLWQ-BAKIEIig.js +7 -0
  240. package/dist/client/assets/sl-SI-HF74RBGV-CnS5z7V_.js +6 -0
  241. package/dist/client/assets/src-UMNXGZaF.js +1 -0
  242. package/dist/client/assets/stateDiagram-2N3HPSRC-B1niwAq-.js +1 -0
  243. package/dist/client/assets/stateDiagram-v2-6OUMAXLB-C4YrlXQg.js +1 -0
  244. package/dist/client/assets/states-DYMshUe2.css +1 -0
  245. package/dist/client/assets/subset-shared.chunk-D3olxosN.js +1 -0
  246. package/dist/client/assets/{subset-worker.chunk-BW_EF59g.js → subset-worker.chunk-Cuw2UvhD.js} +1 -1
  247. package/dist/client/assets/sv-SE-TXR2SQGA-CNgv7xeJ.js +8 -0
  248. package/dist/client/assets/swimlanes-5IMT3BWC-DP1GREXh.js +2 -0
  249. package/dist/client/assets/swimlanesDiagram-G3AALYLV-CN_iOXin.js +8 -0
  250. package/dist/client/assets/ta-IN-Y2DOZGBR-DYzsfax7.js +6 -0
  251. package/dist/client/assets/textile-CyzeGT9J.js +1 -0
  252. package/dist/client/assets/th-TH-JUAISFQR-BAZHUCM7.js +1 -0
  253. package/dist/client/assets/timeline-definition-FHXFAJF6-C-QK9sME.js +120 -0
  254. package/dist/client/assets/tr-TR-U3HGKQXH-DTYupb_4.js +4 -0
  255. package/dist/client/assets/treeView-QDETBFTQ-CygwzEgj.js +1 -0
  256. package/dist/client/assets/treemap-6X3UGDF4-BbCXbaXr.js +1 -0
  257. package/dist/client/assets/turtle-Cx3rYX2g.js +1 -0
  258. package/dist/client/assets/uk-UA-FP2TKAFK-Bcxd6wgd.js +6 -0
  259. package/dist/client/assets/uz-UZ-WY5QKWXJ-B5N6xPud.js +1 -0
  260. package/dist/client/assets/vault-api-client-BPVNCJZC.js +1 -0
  261. package/dist/client/assets/vault-api-client-VAfZ8okg.js +1 -0
  262. package/dist/client/assets/{vault-utils-BbJUHPCf.js → vault-utils-kIbqyWPm.js} +1 -1
  263. package/dist/client/assets/vennDiagram-L72KCM5P-DPQ9kbN2.js +34 -0
  264. package/dist/client/assets/{verilog-DSARZZPc.js → verilog-BKSQ5RMB.js} +1 -1
  265. package/dist/client/assets/vhdl-CBDDcIJ_.js +1 -0
  266. package/dist/client/assets/vi-VN-DE5I4H6K-BdlcTH5l.js +7 -0
  267. package/dist/client/assets/wardley-OPB4EBWU-BjXxCRf_.js +1 -0
  268. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-EdTzLQiR.js → wardleyDiagram-EHGQE667-5VW6_Csg.js} +3 -3
  269. package/dist/client/assets/{xquery-CEDTd8qs.js → xquery-Cda5K8Gy.js} +1 -1
  270. package/dist/client/assets/xychartDiagram-FW5EYKEG-Bj0UwltS.js +7 -0
  271. package/dist/client/assets/{yjs-provider-reset-guard-CNmMf4Qd.js → yjs-provider-reset-guard-DSfwdXS9.js} +2 -2
  272. package/dist/client/assets/zh-CN-VWHOHS7G-b12eD2L4.js +11 -0
  273. package/dist/client/assets/zh-HK-KQF7FW7H-Bvr6xExo.js +1 -0
  274. package/dist/client/assets/zh-TW-6VHVWZKW-B-KCOPyt.js +13 -0
  275. package/dist/client/drawio-editor.html +3 -3
  276. package/dist/client/excalidraw-editor.html +3 -3
  277. package/dist/client/export-document.html +5 -5
  278. package/dist/client/index.html +5 -5
  279. package/package.json +25 -25
  280. package/src/client/application/app-shell/chat-feature.js +2 -2
  281. package/src/client/application/app-shell/comments-feature.js +108 -0
  282. package/src/client/application/app-shell/git-feature.js +6 -1
  283. package/src/client/application/app-shell/presence-feature.js +4 -1
  284. package/src/client/application/app-shell/ui-feature-shell.js +11 -4
  285. package/src/client/application/app-shell/ui-feature-sidebar.js +22 -4
  286. package/src/client/application/app-shell-elements.js +3 -0
  287. package/src/client/application/diagram-chrome.js +708 -0
  288. package/src/client/application/markdown-frontmatter.js +2 -2
  289. package/src/client/application/mermaid-preview-hydrator.js +30 -528
  290. package/src/client/application/plantuml-preview-hydrator.js +22 -518
  291. package/src/client/application/preview-renderer.js +15 -4
  292. package/src/client/application/workspace-route-controller.js +11 -1
  293. package/src/client/bootstrap/app-shell-feature-surface.js +67 -0
  294. package/src/client/bootstrap/collabmd-app-shell.js +111 -356
  295. package/src/client/bootstrap/lazy-controller-feature.js +434 -0
  296. package/src/client/infrastructure/vault-api-client.js +5 -0
  297. package/src/client/presentation/app-shell-template.js +64 -27
  298. package/src/client/presentation/bases-preview-controller.js +33 -16
  299. package/src/client/presentation/comment-overview-controller.js +263 -0
  300. package/src/client/presentation/comment-ui/comment-ui-state.js +23 -0
  301. package/src/client/presentation/file-explorer-controller.js +9 -0
  302. package/src/client/presentation/file-explorer-view.js +11 -1
  303. package/src/client/presentation/git-panel-controller.js +5 -1
  304. package/src/client/presentation/outline-controller.js +4 -0
  305. package/src/client/styles/components/feedback.css +4 -4
  306. package/src/client/styles/components/navigation.css +50 -11
  307. package/src/client/styles/components/scrollbars.css +5 -0
  308. package/src/client/styles/components/states.css +39 -1
  309. package/src/client/styles/components/surfaces.css +5 -2
  310. package/src/client/styles/features/auth-gate.css +5 -5
  311. package/src/client/styles/features/backlinks.css +12 -12
  312. package/src/client/styles/features/collaboration-chat.css +7 -8
  313. package/src/client/styles/features/collaboration-dialogs.css +6 -5
  314. package/src/client/styles/features/collaboration-presence.css +7 -7
  315. package/src/client/styles/features/comment-card.css +12 -10
  316. package/src/client/styles/features/comment-overview.css +193 -0
  317. package/src/client/styles/features/comments-drawer.css +14 -18
  318. package/src/client/styles/features/comments.css +1 -0
  319. package/src/client/styles/features/diagram-preview.css +4 -4
  320. package/src/client/styles/features/diff-commit.css +15 -16
  321. package/src/client/styles/features/diff-toolbar.css +4 -5
  322. package/src/client/styles/features/git-branch.css +1 -1
  323. package/src/client/styles/features/git-files.css +2 -2
  324. package/src/client/styles/features/git-history.css +23 -26
  325. package/src/client/styles/features/media-lightbox.css +5 -5
  326. package/src/client/styles/features/outline.css +13 -2
  327. package/src/client/styles/features/quick-switcher.css +77 -20
  328. package/src/client/styles/foundation/themes.css +79 -78
  329. package/src/client/styles/foundation/tokens.css +5 -4
  330. package/src/client/styles/layout/editor-page.css +49 -16
  331. package/src/client/styles/layout/overlays.css +2 -2
  332. package/src/client/styles/layout/responsive.css +25 -6
  333. package/src/client/styles/layout/shell.css +5 -5
  334. package/src/client/styles/layout/sidebar.css +34 -13
  335. package/src/client/styles/layout/view-modes.css +1 -1
  336. package/src/client/styles/primitives/controls.css +17 -9
  337. package/src/domain/yaml-frontmatter.js +2 -3
  338. package/src/server/application/workspace-reconciliation.js +446 -0
  339. package/src/server/config/env.js +73 -0
  340. package/src/server/create-app-server.js +39 -32
  341. package/src/server/domain/bases/base-definition.js +12 -3
  342. package/src/server/domain/bases/base-expression-runtime.js +183 -147
  343. package/src/server/domain/bases/base-index-snapshot-store.js +53 -2
  344. package/src/server/domain/bases/base-query-service.js +55 -38
  345. package/src/server/domain/bases/base-transform.js +4 -3
  346. package/src/server/domain/collaboration/collaboration-document-store.js +6 -2
  347. package/src/server/domain/collaboration/collaboration-room.js +66 -2
  348. package/src/server/domain/comment-overview.js +108 -0
  349. package/src/server/domain/hosted-workspace-contract.js +18 -0
  350. package/src/server/domain/hosted-workspace.js +744 -0
  351. package/src/server/domain/workspace-state.js +848 -2
  352. package/src/server/infrastructure/github/github-app-client.js +205 -0
  353. package/src/server/infrastructure/github/github-setup-flow.js +86 -0
  354. package/src/server/infrastructure/http/create-git-api-command-handler.js +1 -1
  355. package/src/server/infrastructure/http/create-hosted-api-handler.js +200 -0
  356. package/src/server/infrastructure/http/create-request-handler.js +20 -0
  357. package/src/server/infrastructure/http/create-static-handler.js +4 -0
  358. package/src/server/infrastructure/http/create-vault-api-command-handler.js +44 -119
  359. package/src/server/infrastructure/http/create-vault-api-query-handler.js +18 -33
  360. package/src/server/infrastructure/http/request-body.js +12 -2
  361. package/src/server/infrastructure/persistence/hosted-metadata-store.js +500 -0
  362. package/src/server/infrastructure/persistence/sidecar-store.js +53 -2
  363. package/src/server/infrastructure/persistence/vault-content-adapter.js +8 -8
  364. package/src/server/infrastructure/persistence/vault-file-store.js +64 -135
  365. package/src/server/infrastructure/websocket/attach-collaboration-gateway.js +49 -5
  366. package/src/server/infrastructure/workspace/file-system-sync-service.js +24 -411
  367. package/src/server/infrastructure/workspace/workspace-mutation-coordinator.js +13 -621
  368. package/src/server/infrastructure/workspace/workspace-state-file-system-adapter.js +37 -0
  369. package/dist/client/assets/CodeMirrorEditor-UCMRAMCV-CjJV4GGp.js +0 -1
  370. package/dist/client/assets/ar-SA-NXDWD63E-BfWwfLiP.js +0 -8
  371. package/dist/client/assets/architecture-7EHR7CIX-M1SFnuBJ.js +0 -1
  372. package/dist/client/assets/architectureDiagram-3BPJPVTR-Cs4u0ty-.js +0 -36
  373. package/dist/client/assets/az-AZ-MXSORGZV-D3w9H6nC.js +0 -1
  374. package/dist/client/assets/bg-BG-O6MV2KSF-CqITeIE6.js +0 -5
  375. package/dist/client/assets/blockDiagram-GPEHLZMM-C4RLg7wo.js +0 -132
  376. package/dist/client/assets/bn-BD-T2VJNT7N-DRxwOMG_.js +0 -3
  377. package/dist/client/assets/bn-IN-MMW2ORAC-BZcsVFhS.js +0 -3
  378. package/dist/client/assets/ca-ES-MKBCGNOG-D2cujUJ7.js +0 -8
  379. package/dist/client/assets/channel-E9SBQ9z6.js +0 -1
  380. package/dist/client/assets/chunk-2J33WTMH-Beqll06X.js +0 -1
  381. package/dist/client/assets/chunk-3OPIFGDE-Kf30X6bZ.js +0 -62
  382. package/dist/client/assets/chunk-3PELD44J-DymL2rGq.js +0 -1
  383. package/dist/client/assets/chunk-4BX2VUAB-BVNkn9EH.js +0 -1
  384. package/dist/client/assets/chunk-4EGX6M5U-6L36_8q8.js +0 -1
  385. package/dist/client/assets/chunk-55IACEB6-CaPPZbdp.js +0 -1
  386. package/dist/client/assets/chunk-5DO6E6H7-BpgUf0HE.js +0 -1
  387. package/dist/client/assets/chunk-5ZQYHXKU-BJyABJSy.js +0 -2
  388. package/dist/client/assets/chunk-A66AFZZU-BFHL744F.js +0 -7
  389. package/dist/client/assets/chunk-AQP2D5EJ-D-ou9vaq.js +0 -231
  390. package/dist/client/assets/chunk-BR22UD5L-CHoFxkAQ.js +0 -1
  391. package/dist/client/assets/chunk-BSJP7CBP-AmT6zI00.js +0 -1
  392. package/dist/client/assets/chunk-CSCIHK7Q-BIoF4mTy.js +0 -123
  393. package/dist/client/assets/chunk-FHYWG6QK-qLbgayZT.js +0 -1
  394. package/dist/client/assets/chunk-KSCS5N6A-DSHzBB4H.js +0 -10
  395. package/dist/client/assets/chunk-L5ZTLDWV-Ca0loQr2.js +0 -1
  396. package/dist/client/assets/chunk-LZXEDZCA-D4QboL2E.js +0 -2
  397. package/dist/client/assets/chunk-MPE355IW-BGGMthoR.js +0 -1
  398. package/dist/client/assets/chunk-MZUSXYTE-CXyCvcyW.js +0 -1
  399. package/dist/client/assets/chunk-ND2GUHAM-3Xs0Awks.js +0 -1
  400. package/dist/client/assets/chunk-NNHCCRGN--8l6bbR-.js +0 -159
  401. package/dist/client/assets/chunk-NZK2D7GU-w2jXiKa6.js +0 -1
  402. package/dist/client/assets/chunk-PUPMXCY4-JvkUXyIj.js +0 -1
  403. package/dist/client/assets/chunk-QZHKN3VN-9NMPSwDX.js +0 -1
  404. package/dist/client/assets/chunk-SRAX5OIU-C_UPA-vt.js +0 -1
  405. package/dist/client/assets/chunk-UIBZB4QT-B4OybPy_.js +0 -1
  406. package/dist/client/assets/chunk-WCWK7LTN-BOL8a2ua.js +0 -1
  407. package/dist/client/assets/chunk-WMDFGAFD-EzVSth95.js +0 -35
  408. package/dist/client/assets/chunk-WU5MYG2G-Bl8VQmZH.js +0 -1
  409. package/dist/client/assets/classDiagram-4FO5ZUOK-D7YhYDLZ.js +0 -1
  410. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-COI4atGv.js +0 -1
  411. package/dist/client/assets/clike-BFTLRaGS.js +0 -1
  412. package/dist/client/assets/cobol-DP4QggbL.js +0 -1
  413. package/dist/client/assets/controls-CLpueX2m.css +0 -1
  414. package/dist/client/assets/cose-bilkent-S5V4N54A-Cx3Qt7pR.js +0 -1
  415. package/dist/client/assets/cs-CZ-V77HGUP7-BXqhmWZb.js +0 -7
  416. package/dist/client/assets/cytoscape.esm-B_ygTtvl.js +0 -321
  417. package/dist/client/assets/da-DK-I5RFNTM4-raD_lQnT.js +0 -2
  418. package/dist/client/assets/dagre-BM42HDAG-BpURvxT4.js +0 -4
  419. package/dist/client/assets/dagre-BcZLxzJJ.js +0 -1
  420. package/dist/client/assets/de-CH-WLRDEVBV-CyNG_YAO.js +0 -7
  421. package/dist/client/assets/de-DE-DTI4WUSC-BAnqlByT.js +0 -7
  422. package/dist/client/assets/diagram-2AECGRRQ-DJH0JVlq.js +0 -43
  423. package/dist/client/assets/diagram-5GNKFQAL-DQG4Q1eS.js +0 -10
  424. package/dist/client/assets/diagram-KO2AKTUF-hx21Lv-5.js +0 -3
  425. package/dist/client/assets/diagram-LMA3HP47--QODJMa9.js +0 -24
  426. package/dist/client/assets/diagram-OG6HWLK6-CB30hX1a.js +0 -24
  427. package/dist/client/assets/dist-6oqNX0NJ.js +0 -1
  428. package/dist/client/assets/dist-B0U2pnHE.js +0 -1
  429. package/dist/client/assets/dist-B1BRR2vO.js +0 -1
  430. package/dist/client/assets/dist-B48_21rM.js +0 -1
  431. package/dist/client/assets/dist-BNDWUlMx.js +0 -9
  432. package/dist/client/assets/dist-BQuic6-d.js +0 -1
  433. package/dist/client/assets/dist-BoCYrsTA.js +0 -1
  434. package/dist/client/assets/dist-C-W89K9S.js +0 -1
  435. package/dist/client/assets/dist-CBTadfRi2.js +0 -1
  436. package/dist/client/assets/dist-D4DGyOvV.js +0 -1
  437. package/dist/client/assets/dist-UnjH15yg.js +0 -13
  438. package/dist/client/assets/dist-ihRjPW1T.js +0 -2
  439. package/dist/client/assets/drawio-editor-BHYoSlR7.js +0 -9
  440. package/dist/client/assets/drawio-room-DrZ-gy4N.js +0 -1
  441. package/dist/client/assets/drawioEditor-B-Ssnq_p.js +0 -2
  442. package/dist/client/assets/editor-session-BTPe8PEu.js +0 -16
  443. package/dist/client/assets/el-GR-ZXDJ2OS4-De6xlnXD.js +0 -7
  444. package/dist/client/assets/embedded-editor-base-Bb8ywn1e.css +0 -1
  445. package/dist/client/assets/erDiagram-TEJ5UH35-BvMeaml9.js +0 -85
  446. package/dist/client/assets/es-ES-DYQHAD43-EVQAeFTZ.js +0 -7
  447. package/dist/client/assets/eu-ES-QDSYU5Y3-O5XEQp0x.js +0 -7
  448. package/dist/client/assets/eventmodeling-FCH6USID-DKkN-EFL.js +0 -1
  449. package/dist/client/assets/excalidraw-editor-mKBCIvNR.css +0 -1
  450. package/dist/client/assets/excalidraw-scene-i7oBzgH8.js +0 -176
  451. package/dist/client/assets/excalidrawEditor-DRxzpbJ-.js +0 -2
  452. package/dist/client/assets/exportDocument-BAqaHlIn.css +0 -1
  453. package/dist/client/assets/exportDocument-Dj7w1hDJ.js +0 -2
  454. package/dist/client/assets/fa-IR-26LZG4PM-BlqI3v_N.js +0 -9
  455. package/dist/client/assets/fi-FI-6YS4KDE4-af5Lkv-j.js +0 -6
  456. package/dist/client/assets/flowDiagram-I6XJVG4X-DgXXcK8y.js +0 -162
  457. package/dist/client/assets/fr-FR-BRLLPTZC-CwQyur9E.js +0 -12
  458. package/dist/client/assets/ganttDiagram-6RSMTGT7-BMpbo3vT.js +0 -292
  459. package/dist/client/assets/gitGraph-WXDBUCRP-BIQYiPEj.js +0 -1
  460. package/dist/client/assets/gitGraphDiagram-PVQCEYII-CCdpTNJZ.js +0 -106
  461. package/dist/client/assets/gl-ES-OKUZTLYG-BNEoLCI4.js +0 -6
  462. package/dist/client/assets/he-IL-26MGYIU7-WnVF9HP3.js +0 -8
  463. package/dist/client/assets/hi-IN-Q4ZOGTP2-DcU7ec07.js +0 -3
  464. package/dist/client/assets/hu-HU-P2OXPSN5-wmJyK1Wq.js +0 -3
  465. package/dist/client/assets/id-ID-2EIKXYN6-BTvn0aFf.js +0 -8
  466. package/dist/client/assets/image-KGGK4BDN-BtStV6c9.js +0 -1
  467. package/dist/client/assets/index-Cnyy977t.css +0 -1
  468. package/dist/client/assets/index-DxQmPZ_f.js +0 -2
  469. package/dist/client/assets/info-J43DQDTF-CO2Z2J7J.js +0 -1
  470. package/dist/client/assets/infoDiagram-5YYISTIA-oYw2qnNY.js +0 -2
  471. package/dist/client/assets/it-IT-4CFKVXI2-CC_iQxXu.js +0 -12
  472. package/dist/client/assets/ja-JP-MAND2Z4V-ConJI8GA.js +0 -7
  473. package/dist/client/assets/javascript-qUBHINSy.js +0 -1
  474. package/dist/client/assets/jsx-runtime-IB1e1gmy.js +0 -1
  475. package/dist/client/assets/kaa-HQRTCXTJ-Caqwh_Qr.js +0 -1
  476. package/dist/client/assets/kab-KAB-JKIKKTGH-DQBmYNc9.js +0 -4
  477. package/dist/client/assets/katex-Beiidjxi.js +0 -261
  478. package/dist/client/assets/kk-KZ-HXQ63ZFC-O5qp74q-.js +0 -1
  479. package/dist/client/assets/km-KH-PKL3LSGX-2wUYTyyo.js +0 -7
  480. package/dist/client/assets/ko-KR-KXLREZX3-CYtUnW5t.js +0 -5
  481. package/dist/client/assets/ku-TR-MJ4IER3X-DtEKOAU3.js +0 -6
  482. package/dist/client/assets/lt-LT-H6WFQ6FJ-Cs17Ppdf.js +0 -3
  483. package/dist/client/assets/lv-LV-GOCK6SJW-DYuTyosz.js +0 -4
  484. package/dist/client/assets/main-iuYcGt-A.js +0 -1414
  485. package/dist/client/assets/mermaid-parser.core-BD_OCbyj.js +0 -4
  486. package/dist/client/assets/mermaid-runtime-CEgpdpwB.js +0 -9
  487. package/dist/client/assets/mr-IN-IXVLDMEQ-CIJFnklt.js +0 -9
  488. package/dist/client/assets/my-MM-YG6MYTTD-em_7TGWX.js +0 -1
  489. package/dist/client/assets/navigation-Du6CLhvs.css +0 -1
  490. package/dist/client/assets/nb-NO-XGWJISD2-BLNgPVDj.js +0 -8
  491. package/dist/client/assets/nl-NL-XVDVCPNC-CComxzvg.js +0 -13
  492. package/dist/client/assets/nn-NO-EMX5MJX5-Cekj8s_-.js +0 -4
  493. package/dist/client/assets/oc-FR-ROEINTVO-DW-kHJ81.js +0 -4
  494. package/dist/client/assets/pa-IN-ZYN6SUDY-CnhULOGp.js +0 -4
  495. package/dist/client/assets/packet-YPE3B663-VxGcYggl.js +0 -1
  496. package/dist/client/assets/percentages-5DKR754L-Ug3UfchV.js +0 -1
  497. package/dist/client/assets/pica-DcQ1xKp1.js +0 -2
  498. package/dist/client/assets/pie-LRSECV5Y-7RrvmmEk.js +0 -1
  499. package/dist/client/assets/pieDiagram-4H26LBE5-C6MCExtR.js +0 -30
  500. package/dist/client/assets/pl-PL-6VTG7PHC-C9rBsz9v.js +0 -12
  501. package/dist/client/assets/preload-helper-Bo9GmnuQ.js +0 -1
  502. package/dist/client/assets/preview-diagram-utils-D94KrSQH.js +0 -1
  503. package/dist/client/assets/preview-render-compiler-CSggyCbw.js +0 -35
  504. package/dist/client/assets/preview-render-compiler-TPMesM_L.js +0 -1
  505. package/dist/client/assets/preview-render-profile-CQR0o67h.js +0 -23
  506. package/dist/client/assets/preview-render-worker-CifbXdlx.js +0 -59
  507. package/dist/client/assets/pt-BR-5YFKRR5G-BVyxOCjg.js +0 -6
  508. package/dist/client/assets/pt-PT-GEIXXZ67-5CbVaVay.js +0 -8
  509. package/dist/client/assets/python-BUyhM0Ew.js +0 -1
  510. package/dist/client/assets/radar-GUYGQ44K-2SBnfFng.js +0 -1
  511. package/dist/client/assets/ro-RO-E2P6TFZI-DANwkfep.js +0 -12
  512. package/dist/client/assets/ru-RU-YBIIY43T-BWZSxhA5.js +0 -10
  513. package/dist/client/assets/runtime-config-CM_2pVYD.js +0 -1
  514. package/dist/client/assets/scheme-C3elI80V.js +0 -1
  515. package/dist/client/assets/sequenceDiagram-3UESZ5HK-CCGL7FMW.js +0 -162
  516. package/dist/client/assets/si-LK-673C2CI2-Bqr808AJ.js +0 -1
  517. package/dist/client/assets/sk-SK-CKZHQ4AP-B2PvXXeU.js +0 -7
  518. package/dist/client/assets/sl-SI-557H2GWM-IPVDhzgb.js +0 -6
  519. package/dist/client/assets/src-BshjqEL2.js +0 -1
  520. package/dist/client/assets/stateDiagram-AJRCARHV-ljJcYRX4.js +0 -1
  521. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-DXm0ynOB.js +0 -1
  522. package/dist/client/assets/states-P2LsGDDn.css +0 -1
  523. package/dist/client/assets/subset-shared.chunk-C9mEHUfV.js +0 -1
  524. package/dist/client/assets/sv-SE-XOPKKDWS-CQipq9Nf.js +0 -8
  525. package/dist/client/assets/ta-IN-XBH7DQI3-Cj2o89vS.js +0 -6
  526. package/dist/client/assets/textile-C48beRus.js +0 -1
  527. package/dist/client/assets/th-TH-TOCWH3R4-IOX-l13w.js +0 -1
  528. package/dist/client/assets/timeline-definition-PNZ67QCA-CUVPem2o.js +0 -120
  529. package/dist/client/assets/tr-TR-GXW6CYY5-DBVLEsZg.js +0 -4
  530. package/dist/client/assets/treeView-BLDUP644-DItqHrxu.js +0 -1
  531. package/dist/client/assets/treemap-LRROVOQU-DD1ESKp7.js +0 -1
  532. package/dist/client/assets/turtle-BkP3ExOG.js +0 -1
  533. package/dist/client/assets/uk-UA-IJKTNUDG-C5kaymku.js +0 -6
  534. package/dist/client/assets/uz-UZ-TBZZEA4V-lMna4tx1.js +0 -1
  535. package/dist/client/assets/vault-api-client-D7Ck0CvR.css +0 -1
  536. package/dist/client/assets/vault-api-client-Fa51l2lE.js +0 -1
  537. package/dist/client/assets/vennDiagram-CIIHVFJN-Bb1KSPKA.js +0 -34
  538. package/dist/client/assets/vhdl-CnYyYTpa.js +0 -1
  539. package/dist/client/assets/vi-VN-MULSGNVB-BAcoCjsz.js +0 -7
  540. package/dist/client/assets/wardley-L42UT6IY-BoSI-SvR.js +0 -1
  541. package/dist/client/assets/xychartDiagram-2RQKCTM6-BoQFrGlt.js +0 -7
  542. package/dist/client/assets/zh-CN-MVX3E32U-sW-DCFHP.js +0 -11
  543. package/dist/client/assets/zh-HK-JNU5RLIE-Duqu8EG_.js +0 -1
  544. package/dist/client/assets/zh-TW-LENVCA6T-BHC0OLnd.js +0 -9
  545. /package/dist/client/assets/{array-7rJMcyYQ.js → array-BifhSqXX.js} +0 -0
  546. /package/dist/client/assets/{asciiarmor-DHW75j1s.js → asciiarmor-qTkVPQu6.js} +0 -0
  547. /package/dist/client/assets/{asn1-CQiG40kG.js → asn1-Dr8qZg38.js} +0 -0
  548. /package/dist/client/assets/{asterisk-BWExh0n4.js → asterisk-Bja0s6e1.js} +0 -0
  549. /package/dist/client/assets/{base-h1uscjTi.js → base-CxPEiHuy.js} +0 -0
  550. /package/dist/client/assets/{brainfuck-CTNFyOLg.js → brainfuck-D5EjA2JK.js} +0 -0
  551. /package/dist/client/assets/{clojure-D-DYVqu7.js → clojure-BflJGmDX.js} +0 -0
  552. /package/dist/client/assets/{cmake-DtGL-Unu.js → cmake-CyVbuzPu.js} +0 -0
  553. /package/dist/client/assets/{coffeescript-B7GZajzV.js → coffeescript-B2pKbFk8.js} +0 -0
  554. /package/dist/client/assets/{commonlisp-COlJYiQT.js → commonlisp-CcllspGY.js} +0 -0
  555. /package/dist/client/assets/{crystal-I_dE9xG-.js → crystal-M5-qzICs.js} +0 -0
  556. /package/dist/client/assets/{css-CmhPNxBE.js → css-CYpP4FRV.js} +0 -0
  557. /package/dist/client/assets/{cypher-DEGl2llJ.js → cypher-p9eYesGn.js} +0 -0
  558. /package/dist/client/assets/{d-BspB0dox.js → d-BhMjBjQP.js} +0 -0
  559. /package/dist/client/assets/{defaultLocale-DKHHE2Ij.js → defaultLocale-C8Fc0cco.js} +0 -0
  560. /package/dist/client/assets/{diff-BWuPUsEo.js → diff-ChtP43wD.js} +0 -0
  561. /package/dist/client/assets/{dtd-C6brJFPg.js → dtd-DTF72YNO.js} +0 -0
  562. /package/dist/client/assets/{dylan-Bft86ZSB.js → dylan-C6jEEEk-.js} +0 -0
  563. /package/dist/client/assets/{ebnf-D6ifG44A.js → ebnf-D4c0_ac3.js} +0 -0
  564. /package/dist/client/assets/{ecl-D9rhJ9-u.js → ecl-BSZaIHnp.js} +0 -0
  565. /package/dist/client/assets/{eiffel-DwxtewZF.js → eiffel-BEjRio4Q.js} +0 -0
  566. /package/dist/client/assets/{elm-B1TncobV.js → elm-Cshzl8qu.js} +0 -0
  567. /package/dist/client/assets/{erlang-BDJZNtt8.js → erlang-DaB2Rkuy.js} +0 -0
  568. /package/dist/client/assets/{excalidraw-mermaid-stub-Co4Okjfg.js → excalidraw-mermaid-stub-BNckbX2n.js} +0 -0
  569. /package/dist/client/assets/{fcl-CUXJFJn1.js → fcl-ClOhbFR7.js} +0 -0
  570. /package/dist/client/assets/{file-kind-DLz-bCzA.js → file-kind-BKPOIRPE.js} +0 -0
  571. /package/dist/client/assets/{forth-nvhcMz63.js → forth-Cezjo90N.js} +0 -0
  572. /package/dist/client/assets/{fortran-BZID-z10.js → fortran-Bt6PBEDR.js} +0 -0
  573. /package/dist/client/assets/{gas-DjQsZDGE.js → gas-BHEdbvp9.js} +0 -0
  574. /package/dist/client/assets/{gherkin-S0kHlzux.js → gherkin-oBAE_ms0.js} +0 -0
  575. /package/dist/client/assets/{groovy-Di--Vb9Z.js → groovy-BC3IOsC8.js} +0 -0
  576. /package/dist/client/assets/{haskell-C6qH3-aI.js → haskell-BRsoo5mP.js} +0 -0
  577. /package/dist/client/assets/{http-DG1Y9fpK.js → http-CLVgA2GD.js} +0 -0
  578. /package/dist/client/assets/{idl-B64p3NTJ.js → idl-BUZw3wgd.js} +0 -0
  579. /package/dist/client/assets/{init-EmgYNkpL.js → init-D6jRqBbL.js} +0 -0
  580. /package/dist/client/assets/{julia-B22G9Bym.js → julia-CQfgDRfP.js} +0 -0
  581. /package/dist/client/assets/{livescript-CkcuHqeS.js → livescript-BXxG0Yva.js} +0 -0
  582. /package/dist/client/assets/{lua-Cg0FqIlO.js → lua-CL1SqxuB.js} +0 -0
  583. /package/dist/client/assets/{mathematica-CKVhKnoY.js → mathematica-u8YMmbU0.js} +0 -0
  584. /package/dist/client/assets/{mbox-DANyzFJ2.js → mbox-BEMVcqjs.js} +0 -0
  585. /package/dist/client/assets/{mirc-BVG2S5rO.js → mirc-C9zpzAZU.js} +0 -0
  586. /package/dist/client/assets/{mllike-C0p7lv48.js → mllike-B45xgp2S.js} +0 -0
  587. /package/dist/client/assets/{modelica-vJ-Qa9jV.js → modelica-CqHI_q-D.js} +0 -0
  588. /package/dist/client/assets/{mscgen-vUD-SWGJ.js → mscgen-qgSLujhx.js} +0 -0
  589. /package/dist/client/assets/{mumps-D0KfUTSd.js → mumps-CW_TBmxz.js} +0 -0
  590. /package/dist/client/assets/{nginx-DkVceJrH.js → nginx-BMaDbqW3.js} +0 -0
  591. /package/dist/client/assets/{ntriples-BBuCIfS0.js → ntriples-d28e9m0E.js} +0 -0
  592. /package/dist/client/assets/{octave-BTv2CqSQ.js → octave-D2Q8cUp1.js} +0 -0
  593. /package/dist/client/assets/{oz-D8SjVDNU.js → oz-BwTct_5T.js} +0 -0
  594. /package/dist/client/assets/{pascal-T-tfhVyx.js → pascal-Dp_KdFgX.js} +0 -0
  595. /package/dist/client/assets/{path-vqW-z8T-.js → path-BWPyau1x.js} +0 -0
  596. /package/dist/client/assets/{perl-BDrCkHRd.js → perl-CdEHsPfU.js} +0 -0
  597. /package/dist/client/assets/{pig-BEyI4fPq.js → pig-AF4Hwhju.js} +0 -0
  598. /package/dist/client/assets/{powershell-DtnFc6GG.js → powershell-CzG71I4L.js} +0 -0
  599. /package/dist/client/assets/{properties-DWUvbxV9.js → properties-C357ku5U.js} +0 -0
  600. /package/dist/client/assets/{protobuf-CQGoYyfE.js → protobuf-D1ij_kNL.js} +0 -0
  601. /package/dist/client/assets/{puppet-Dd-qWO3p.js → puppet-B4hC2X4m.js} +0 -0
  602. /package/dist/client/assets/{q-Dls1OX0D.js → q-B9NhS7L_.js} +0 -0
  603. /package/dist/client/assets/{r-DeZ8Mdev.js → r-DADKenSm.js} +0 -0
  604. /package/dist/client/assets/{chunk-tBc3Ke6Z.js → rolldown-runtime-aKtaBQYM.js} +0 -0
  605. /package/dist/client/assets/{rough.esm-DE_lJ5Ge.js → rough.esm-CSKSodPl.js} +0 -0
  606. /package/dist/client/assets/{roundRect-BMsJLtvm.js → roundRect-D01gJrlt.js} +0 -0
  607. /package/dist/client/assets/{rpm-CjWxLM68.js → rpm-gpDK5sbt.js} +0 -0
  608. /package/dist/client/assets/{ruby-CB34f2Gf.js → ruby-DsYpTuWg.js} +0 -0
  609. /package/dist/client/assets/{runtime-config-loader-_D2KZKn-.js → runtime-config-loader-BUK56BZz.js} +0 -0
  610. /package/dist/client/assets/{sas-Bji4HDQq.js → sas-C2OyD2Y6.js} +0 -0
  611. /package/dist/client/assets/{shell-DUveK2Hb.js → shell-Du5Qg9im.js} +0 -0
  612. /package/dist/client/assets/{sieve-2ogwMVx4.js → sieve-BAxa3IjF.js} +0 -0
  613. /package/dist/client/assets/{simple-mode-pOKc0mfx.js → simple-mode-DRpGK0lJ.js} +0 -0
  614. /package/dist/client/assets/{smalltalk-BuGhc6lW.js → smalltalk-BLp5-jwC.js} +0 -0
  615. /package/dist/client/assets/{solr-DTxshpm8.js → solr-BBopId9w.js} +0 -0
  616. /package/dist/client/assets/{sparql-vm8qNO8J.js → sparql-Dz-mlCAC.js} +0 -0
  617. /package/dist/client/assets/{spreadsheet-C6Vbtl9-.js → spreadsheet-CTIncYxj.js} +0 -0
  618. /package/dist/client/assets/{sql-GL7dVWcd.js → sql-DcCJ9jop.js} +0 -0
  619. /package/dist/client/assets/{stex-CEwW0Q_0.js → stex-sDrdk2BW.js} +0 -0
  620. /package/dist/client/assets/{stylus-D1SZIMDs.js → stylus-DLLZ8dgm.js} +0 -0
  621. /package/dist/client/assets/{swift-CKcKnWv9.js → swift-DKB6_1j6.js} +0 -0
  622. /package/dist/client/assets/{tcl-SPk7uiDB.js → tcl-BGfruO1u.js} +0 -0
  623. /package/dist/client/assets/{tiddlywiki-CiImjFLN.js → tiddlywiki-VlUiK86J.js} +0 -0
  624. /package/dist/client/assets/{tiki-HkXZ4BIW.js → tiki-CxVlf5KZ.js} +0 -0
  625. /package/dist/client/assets/{toml-BmfpMy1_.js → toml-LvoKBwCs.js} +0 -0
  626. /package/dist/client/assets/{troff-BjbEOT5E.js → troff-C2dAgh7P.js} +0 -0
  627. /package/dist/client/assets/{ttcn-NA-V4KnY.js → ttcn-BePYh-hG.js} +0 -0
  628. /package/dist/client/assets/{ttcn-cfg-TPHncdGN.js → ttcn-cfg-CY0aot7Q.js} +0 -0
  629. /package/dist/client/assets/{vb-C19AQWqO.js → vb-BthdM_4N.js} +0 -0
  630. /package/dist/client/assets/{vbscript-CHJk3s95.js → vbscript-D9f6rSsU.js} +0 -0
  631. /package/dist/client/assets/{velocity-Ya0P4sQU.js → velocity-CqftRsjg.js} +0 -0
  632. /package/dist/client/assets/{webidl-DttrYZRT.js → webidl-D5jiJvOU.js} +0 -0
  633. /package/dist/client/assets/{yacas-C7dxlPB0.js → yacas-CXXgtw0p.js} +0 -0
  634. /package/dist/client/assets/{z80-BqEfFSnA.js → z80-CL1naaMV.js} +0 -0
@@ -0,0 +1,176 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ar-SA-YLAB6A27-B9ogj_Jh.js","./chunk-SRAX5OIU-Bpn6XoyU.js","./rolldown-runtime-aKtaBQYM.js","./az-AZ-5JXPK2I2-C6Se5-4R.js","./bg-BG-NIQ2RVNG-xrf33IaO.js","./bn-BD-BN65R3DE-YVZWNN-c.js","./bn-IN-2YT4KVKB-YVZWNN-c.js","./ca-ES-KSERGC3M-CoMtV4dM.js","./cs-CZ-EOMS3IHD-Bo0hDCLX.js","./da-DK-AVL3DJQK-s5-TpkxN.js","./de-CH-M25HCZK4-B0r4rx6B.js","./de-DE-BEN6XGXY-B0r4rx6B.js","./el-GR-UBGIF2NW-DRoYAN8w.js","./en-PCJ7LJZ2-1SKiH5y3.js","./chunk-Z24UKHUO-BQ6-bK37.js","./es-ES-SQEM5MNY-D5EtY06q.js","./eu-ES-YG5N2JAG-CZ0xKIU4.js","./fa-IR-EVNM7MAJ-olht-LEH.js","./fi-FI-MW7ZEZ64-D1PIXbLy.js","./fr-FR-Q7ZPXBDE-B0DjjyfT.js","./gl-ES-O5B74VQL-DH5u_ADp.js","./he-IL-QGC2WXJA-BSBR1RcG.js","./hi-IN-DEZ33NMQ-CorD0_d0.js","./hu-HU-2ZPNVYSC-BlqNXhNG.js","./id-ID-W65WM5EO-SkLgeJLx.js","./it-IT-GAWJM2XW-CDZugsE0.js","./ja-JP-FOAUPTH5-DkKXnwj8.js","./kaa-UEDB54S7-C0Sv0drM.js","./kab-KAB-CTLMBVE3-QfxUgzL5.js","./kk-KZ-XZK63ADD-CMZObxxP.js","./km-KH-PBSJLZ2M-Bh1DsarT.js","./ko-KR-YNTPN6WQ-DPBaHnwT.js","./ku-TR-XUD5BUEU-75pMUQoD.js","./lt-LT-LYCDYH7O-BeKUsKuy.js","./lv-LV-7ROPDEEI-CrA6QOtq.js","./mr-IN-TU6BXRKP-mIvXG0bt.js","./my-MM-SJ3RWIEQ-CeEN5n4z.js","./nb-NO-GONF2AKR-IChp6OiI.js","./nl-NL-UZF6UEKB-DfPPXXjo.js","./nn-NO-ZVFRXEEO-BtpjNSGp.js","./oc-FR-MBF2Z56W-CBl14QBM.js","./pa-IN-3JCDVKKL-D95A1XFb.js","./percentages-WBIPKLEE-bhlTAhiB.js","./chunk-CJTDIR4C-DvUbqeGR.js","./pl-PL-EERMMCTN-dIzrbxJt.js","./pt-BR-W4AF5QMX-DIJs8D4M.js","./pt-PT-GNPUWAHX-BopN284Y.js","./ro-RO-DXHP33S5-PGxfl-ng.js","./ru-RU-TTW2P7NF-Dwnn0sc5.js","./si-LK-BE6O7LVF-QO9nybVB.js","./sk-SK-OI3KJLWQ-BAKIEIig.js","./sl-SI-HF74RBGV-CnS5z7V_.js","./sv-SE-TXR2SQGA-CNgv7xeJ.js","./ta-IN-Y2DOZGBR-DYzsfax7.js","./th-TH-JUAISFQR-BAZHUCM7.js","./tr-TR-U3HGKQXH-DTYupb_4.js","./uk-UA-FP2TKAFK-Bcxd6wgd.js","./uz-UZ-WY5QKWXJ-B5N6xPud.js","./vi-VN-DE5I4H6K-BdlcTH5l.js","./zh-CN-VWHOHS7G-b12eD2L4.js","./zh-HK-KQF7FW7H-Bvr6xExo.js","./zh-TW-6VHVWZKW-B-KCOPyt.js","./image-QEDDDPDB-DtzL4Wgr.js","./chunk-6GK3VUBP-ChzWImvX.js","./preload-helper-HclGiUj8.js","./react-lCSYwAWP.js","./CodeMirrorEditor-UCMRAMCV-Fb3TgxXK.js","./dist-DUj7Xwud.js","./dist-snK6kYA_.js","./jsx-runtime-DKdBMi_L.js","./excalidraw-mermaid-stub-DE5FTiZB.js","./excalidraw-mermaid-stub-BNckbX2n.js"])))=>i.map(i=>d[i]);
2
+ import{i as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{t as n}from"./preload-helper-HclGiUj8.js";import{$ as r,$a as i,$c as a,$i as o,$n as s,$o as c,$r as l,$s as u,$t as d,A as f,Aa as p,Ac as m,Ai as h,An as g,Ao as _,Ar as v,As as y,At as b,B as x,Ba as S,Bc as C,Bi as w,Bn as T,Bo as E,Br as D,Bs as O,Bt as ee,C as k,Ca as A,Cc as te,Ci as ne,Cn as re,Co as ie,Cr as ae,Cs as oe,Ct as se,D as ce,Da as le,Dc as ue,Di as de,Dn as fe,Do as pe,Dr as me,Ds as he,Dt as ge,Ea as _e,Ec as ve,Ei as j,En as ye,Eo as be,Er as xe,Es as Se,Et as Ce,F as we,Fa as Te,Fc as Ee,Fi as De,Fn as Oe,Fo as ke,Fr as Ae,Fs as je,Ft as Me,G as Ne,Ga as Pe,Gc as Fe,Gi as Ie,Gn as Le,Go as M,Gr as Re,Gs as ze,Gt as Be,H as Ve,Ha as He,Hc as Ue,Hi as We,Hn as Ge,Ho as Ke,Hr as qe,Hs as Je,Ht as Ye,I as Xe,Ia as Ze,Ic as Qe,Ii as $e,In as et,Io as tt,Ir as nt,It as rt,J as it,Ja as at,Jc as ot,Ji as N,Jn as st,Jo as ct,Jr as lt,Js as ut,Jt as dt,K as ft,Ka as pt,Kc as mt,Ki as ht,Kn as gt,Ko as _t,Kr as vt,Ks as yt,Kt as bt,L as xt,La as St,Lc as Ct,Li as wt,Ln as Tt,Lo as Et,Lr as Dt,Ls as Ot,Lt as kt,M as At,Ma as jt,Mc as Mt,Mi as Nt,Mn as Pt,Mo as Ft,Mr as It,Ms as Lt,Mt as Rt,N as zt,Na as Bt,Nc as Vt,Ni as Ht,Nn as Ut,No as Wt,Nr as Gt,Ns as Kt,Nt as qt,O as Jt,Oa as Yt,Oc as Xt,Oi as Zt,On as Qt,Oo as $t,Or as en,Os as tn,Ot as nn,P as rn,Pa as an,Pc as on,Pi as sn,Pn as cn,Po as ln,Pr as un,Ps as dn,Pt as fn,Q as pn,Qa as mn,Qc as hn,Qi as gn,Qn as _n,Qo as vn,Qr as yn,Qs as bn,Qt as xn,R as Sn,Ra as Cn,Rc as wn,Ri as Tn,Rn as En,Ro as Dn,Rr as On,Rs as kn,Rt as An,S as jn,Sa as Mn,Sc as Nn,Si as Pn,Sn as Fn,So as In,Sr as Ln,Ss as Rn,St as zn,T as Bn,Ta as Vn,Tc as Hn,Ti as Un,Tn as Wn,To as Gn,Tr as Kn,Ts as qn,Tt as Jn,U as Yn,Ua as Xn,Uc as Zn,Ui as Qn,Un as $n,Uo as er,Ur as tr,Us as nr,Ut as rr,V as ir,Va as ar,Vc as or,Vi as sr,Vn as cr,Vo as lr,Vr as ur,Vs as dr,Vt as fr,W as pr,Wa as mr,Wc as hr,Wi as gr,Wn as _r,Wo as vr,Wr as yr,Ws as br,Wt as xr,X as Sr,Xa as Cr,Xc as wr,Xi as P,Xn as Tr,Xo as Er,Xr as Dr,Xs as F,Xt as I,Y as Or,Ya as kr,Yc as Ar,Yi as jr,Yn as Mr,Yo as Nr,Yr as Pr,Ys as Fr,Yt as Ir,Z as Lr,Za as Rr,Zc as zr,Zi as Br,Zn as Vr,Zo as Hr,Zr as Ur,Zs as Wr,Zt as Gr,_ as Kr,_a as qr,_c as Jr,_i as Yr,_n as Xr,_o as Zr,_r as Qr,_s as $r,_t as ei,a as ti,aa as ni,ac as ri,ai as ii,an as ai,ao as oi,ar as si,as as ci,at as li,b as ui,ba as di,bc as fi,bi as pi,bn as mi,bo as hi,br as gi,bs as _i,bt as vi,c as yi,ca as bi,cc as xi,ci as Si,cn as Ci,co as wi,cr as Ti,cs as Ei,ct as Di,d as Oi,da as ki,dc as Ai,di as ji,dn as Mi,do as Ni,dr as Pi,ds as Fi,dt as Ii,ea as Li,ec as Ri,ei as zi,el as Bi,en as Vi,eo as Hi,er as Ui,et as Wi,f as Gi,fa as Ki,fc as qi,fi as Ji,fn as Yi,fo as Xi,fr as Zi,fs as Qi,ft as $i,g as ea,ga as ta,gc as na,gi as ra,gn as ia,go as aa,gr as oa,gs as sa,gt as ca,h as la,ha as ua,hc as da,hi as fa,hn as pa,ho as ma,hr as ha,hs as ga,ht as _a,i as va,ia as ya,ic as ba,ii as xa,in as Sa,io as Ca,ir as wa,is as Ta,it as Ea,j as Da,ja as Oa,jc as ka,ji as Aa,jn as ja,jo as Ma,jr as Na,js as Pa,jt as Fa,k as Ia,ka as La,kc as Ra,ki as za,kn as Ba,ko as L,kr as Va,ks as Ha,kt as Ua,l as Wa,la as Ga,lc as Ka,li as qa,ln as Ja,lo as Ya,lr as Xa,ls as Za,lt as Qa,m as $a,ma as eo,mc as to,mi as no,mn as ro,mo as io,mr as ao,ms as oo,mt as so,n as co,na as lo,nc as uo,ni as fo,nn as po,no as mo,nr as ho,ns as go,nt as _o,o as vo,oa as yo,oc as bo,oi as xo,on as So,oo as Co,or as wo,os as To,ot as Eo,pa as Do,pc as Oo,pi as ko,pn as Ao,po as jo,pr as Mo,ps as No,pt as Po,q as Fo,qa as Io,qc as Lo,qi as Ro,qn as zo,qo as Bo,qr as Vo,qs as Ho,qt as Uo,ra as Wo,rc as Go,ri as Ko,rn as qo,ro as Jo,rr as Yo,rs as Xo,rt as Zo,s as Qo,sa as $o,sc as es,si as ts,sn as ns,so as rs,sr as is,ss as as,st as os,t as ss,ta as cs,tc as ls,ti as us,tl as ds,tn as fs,to as ps,tr as ms,ts as hs,tt as gs,u as _s,ua as vs,uc as ys,ui as bs,un as R,uo as xs,ur as Ss,us as Cs,ut as ws,v as Ts,va as Es,vc as Ds,vi as Os,vn as ks,vo as As,vr as js,vs as Ms,vt as Ns,w as Ps,wa as Fs,wc as Is,wi as Ls,wn as Rs,wo as zs,wr as Bs,ws as Vs,wt as Hs,x as Us,xa as Ws,xc as Gs,xi as Ks,xn as qs,xo as Js,xr as Ys,xt as Xs,y as Zs,ya as Qs,yc as $s,yi as ec,yn as tc,yo as nc,yr as rc,ys as ic,yt as ac,z as oc,za as sc,zc as cc,zi as lc,zn as uc,zo as dc,zr as fc,zs as pc,zt as mc}from"./chunk-6GK3VUBP-ChzWImvX.js";import{i as z,n as hc,r as gc}from"./chunk-SRAX5OIU-Bpn6XoyU.js";import{t as _c}from"./react-lCSYwAWP.js";import{t as vc}from"./jsx-runtime-DKdBMi_L.js";import{_ as yc}from"./chunk-Z24UKHUO-BQ6-bK37.js";import{r as bc}from"./chunk-CJTDIR4C-DvUbqeGR.js";import{n as xc}from"./excalidraw-mermaid-stub-BNckbX2n.js";var B=e(_c(),1),V=vc(),Sc=e(_a(),1);function Cc(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=Cc(e[t]))&&(r&&(r+=` `),r+=n);else for(t in e)e[t]&&(r&&(r+=` `),r+=t);return r}function H(){for(var e=0,t,n,r=``;e<arguments.length;)(t=arguments[e++])&&(n=Cc(t))&&(r&&(r+=` `),r+=n);return r}var wc=e(t(((e,t)=>{var n=`Expected a function`,r=NaN,i=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,c=parseInt,l=typeof global==`object`&&global&&global.Object===Object&&global,u=typeof self==`object`&&self&&self.Object===Object&&self,d=l||u||Function(`return this`)(),f=Object.prototype.toString,p=Math.max,m=Math.min,h=function(){return d.Date.now()};function g(e,t,r){var i,a,o,s,c,l,u=0,d=!1,f=!1,g=!0;if(typeof e!=`function`)throw TypeError(n);t=x(t)||0,v(r)&&(d=!!r.leading,f=`maxWait`in r,o=f?p(x(r.maxWait)||0,t):o,g=`trailing`in r?!!r.trailing:g);function _(t){var n=i,r=a;return i=a=void 0,u=t,s=e.apply(r,n),s}function y(e){return u=e,c=setTimeout(C,t),d?_(e):s}function b(e){var n=e-l,r=e-u,i=t-n;return f?m(i,o-r):i}function S(e){var n=e-l,r=e-u;return l===void 0||n>=t||n<0||f&&r>=o}function C(){var e=h();if(S(e))return w(e);c=setTimeout(C,b(e))}function w(e){return c=void 0,g&&i?_(e):(i=a=void 0,s)}function T(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function E(){return c===void 0?s:w(h())}function D(){var e=h(),n=S(e);if(i=arguments,a=this,l=e,n){if(c===void 0)return y(l);if(f)return c=setTimeout(C,t),_(l)}return c===void 0&&(c=setTimeout(C,t)),s}return D.cancel=T,D.flush=E,D}function _(e,t,r){var i=!0,a=!0;if(typeof e!=`function`)throw TypeError(n);return v(r)&&(i=`leading`in r?!!r.leading:i,a=`trailing`in r?!!r.trailing:a),g(e,t,{leading:i,maxWait:t,trailing:a})}function v(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function y(e){return!!e&&typeof e==`object`}function b(e){return typeof e==`symbol`||y(e)&&f.call(e)==`[object Symbol]`}function x(e){if(typeof e==`number`)return e;if(b(e))return r;if(v(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=v(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(i,``);var n=o.test(e);return n||s.test(e)?c(e.slice(2),n?2:8):a.test(e)?r:+e}t.exports=_}))(),1),Tc=0;function Ec(e,t){let n=`atom${++Tc}`,r={toString(){return n}};return typeof e==`function`?r.read=e:(r.init=e,r.read=Dc,r.write=Oc),t&&(r.write=t),r}function Dc(e){return e(this)}function Oc(e,t,n){return t(this,typeof n==`function`?n(e(this)):n)}var kc=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,Ac=e=>`init`in e,jc=e=>!!e.write,Mc=new WeakMap,Nc=e=>Ic(e)&&!Mc.get(e)?.[1],Pc=(e,t)=>{let n=Mc.get(e);n&&(n[1]=!0,n[0].forEach(e=>e(t)))},Fc=e=>{if(Mc.has(e))return;let t=[new Set,!1];Mc.set(e,t);let n=()=>{t[1]=!0};e.then(n,n),e.onCancel=e=>{t[0].add(e)}},Ic=e=>typeof e?.then==`function`,Lc=e=>`v`in e||`e`in e,Rc=e=>{if(`e`in e)throw e.e;return e.v},zc=(e,t,n)=>{n.p.has(e)||(n.p.add(e),t.then(()=>{n.p.delete(e)},()=>{n.p.delete(e)}))},Bc=(e,t,n,r,i)=>{var a;n.d.set(r,i.n),Nc(n.v)&&zc(t,n.v,i),(a=i.m)==null||a.t.add(t),e&&Wc(e,r,t)},Vc=()=>({D:new Map,H:new Set,M:new Set,L:new Set}),Hc=(e,t,n)=>{e[t].add(n)},Uc=(e,t,n)=>{e.D.has(t)||(e.D.set(t,new Set),Hc(e,`M`,()=>{var t;(t=n.m)==null||t.l.forEach(t=>Hc(e,`M`,t))}))},Wc=(e,t,n)=>{let r=e.D.get(t);r&&r.add(n)},Gc=(e,t)=>e.D.get(t),Kc=e=>{let t,n=!1,r=e=>{try{e()}catch(e){n||=(t=e,!0)}};for(;e.H.size||e.M.size||e.L.size;)e.D.clear(),e.H.forEach(r),e.H.clear(),e.M.forEach(r),e.M.clear(),e.L.forEach(r),e.L.clear();if(n)throw t},qc=(...[e,t,n,r])=>{let i=(t,n,r)=>{let i=`v`in n,a=n.v,o=Nc(n.v)?n.v:null;if(Ic(r)){Fc(r);for(let i of n.d.keys())zc(t,r,e(i));n.v=r}else n.v=r;delete n.e,delete n.x,(!i||!Object.is(a,n.v))&&(++n.n,o&&Pc(o,r))},a=(n,r)=>{var o;let s=e(r);if(Lc(s)&&(s.m&&!s.x||Array.from(s.d).every(([e,t])=>a(n,e).n===t)))return s;s.d.clear();let c=!0,l=t=>{if(kc(r,t)){let n=e(t);if(!Lc(n))if(Ac(t))i(t,n,t.init);else throw Error(`no atom init`);return Rc(n)}let o=a(n,t);try{return Rc(o)}finally{if(c)Bc(n,r,s,t,o);else{let e=Vc();Bc(e,r,s,t,o),d(e,r,s),Kc(e)}}},f,p,m={get signal(){return f||=new AbortController,f.signal},get setSelf(){return!p&&jc(r)&&(p=(...e)=>{if(!c)return u(r,...e)}),p}};try{let e=t(r,l,m);if(i(r,s,e),Ic(e)){(o=e.onCancel)==null||o.call(e,()=>f?.abort());let t=()=>{if(s.m){let e=Vc();d(e,r,s),Kc(e)}};e.then(t,t)}return s}catch(e){return delete s.v,s.e=e,delete s.x,++s.n,s}finally{c=!1}},o=e=>Rc(a(void 0,e)),s=(t,n,r)=>{var i;let a=new Map;for(let t of r.m?.t||[]){let n=e(t);n.m&&a.set(t,n)}for(let t of r.p)a.set(t,e(t));return(i=Gc(t,n))==null||i.forEach(t=>{a.set(t,e(t))}),a},c=(e,t,n)=>{let r=[],i=new Set,o=new Set,c=[[t,n]];for(;c.length>0;){let[t,n]=c[c.length-1];if(o.has(t)){c.pop();continue}if(i.has(t)){r.push([t,n,n.n]),o.add(t),n.x=!0,c.pop();continue}i.add(t);for(let[r,a]of s(e,t,n))t!==r&&!i.has(r)&&c.push([r,a])}Hc(e,`H`,()=>{let n=new Set([t]);for(let t=r.length-1;t>=0;--t){let[i,o,s]=r[t],c=!1;for(let e of o.d.keys())if(e!==i&&n.has(e)){c=!0;break}c&&(a(e,i),d(e,i,o),s!==o.n&&(Uc(e,i,o),n.add(i))),delete o.x}})},l=(t,r,...o)=>{let s=!0,u=e=>Rc(a(t,e)),f=(n,...a)=>{let o=e(n);try{if(kc(r,n)){if(!Ac(n))throw Error(`atom not writable`);let e=o.n,r=a[0];i(n,o,r),d(t,n,o),e!==o.n&&(Uc(t,n,o),c(t,n,o));return}else return l(t,n,...a)}finally{s||Kc(t)}};try{return n(r,u,f,...o)}finally{s=!1}},u=(e,...t)=>{let n=Vc();try{return l(n,e,...t)}finally{Kc(n)}},d=(t,n,r)=>{if(r.m&&!Nc(r.v)){for(let i of r.d.keys())r.m.d.has(i)||(f(t,i,e(i)).t.add(n),r.m.d.add(i));for(let i of r.m.d||[])r.d.has(i)||(r.m.d.delete(i),p(t,i,e(i))?.t.delete(n))}},f=(t,n,i)=>{if(!i.m){a(t,n);for(let r of i.d.keys())f(t,r,e(r)).t.add(n);if(i.m={l:new Set,d:new Set(i.d.keys()),t:new Set},jc(n)){let e=i.m,a,o=(e,t)=>{let r=!0;a=(...t)=>{try{return l(e,n,...t)}finally{r||Kc(e)}};try{return t()}finally{r=!1}};Hc(t,`L`,()=>{let i=o(t,()=>r(n,(...e)=>a(...e)));i&&(e.u=e=>o(e,i))})}}return i.m},p=(t,n,r)=>{if(r.m&&!r.m.l.size&&!Array.from(r.m.t).some(t=>e(t).m?.d.has(n))){let i=r.m.u;i&&Hc(t,`L`,()=>i(t)),delete r.m;for(let i of r.d.keys())p(t,i,e(i))?.t.delete(n);return}return r.m};return{get:o,set:u,sub:(t,n)=>{let r=Vc(),i=e(t),a=f(r,t,i).l;return a.add(n),Kc(r),()=>{a.delete(n);let e=Vc();p(e,t,i),Kc(e)}},unstable_derive:i=>qc(...i(e,t,n,r))}},Jc=()=>{let e=new WeakMap;return qc(t=>{let n=e.get(t);return n||(n={d:new Map,p:new Set,n:0},e.set(t,n)),n},(e,...t)=>e.read(...t),(e,...t)=>e.write(...t),(e,...t)=>e.onMount?.call(e,...t))},Yc,Xc=()=>(Yc||=Jc(),Yc),Zc=(0,B.createContext)(void 0),Qc=e=>{let t=(0,B.useContext)(Zc);return e?.store||t||Xc()},$c=e=>typeof e?.then==`function`,el=e=>{e.status=`pending`,e.then(t=>{e.status=`fulfilled`,e.value=t},t=>{e.status=`rejected`,e.reason=t})},tl=B.use||(e=>{if(e.status===`pending`)throw e;if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:(el(e),e)}),nl=new WeakMap,rl=e=>{let t=nl.get(e);return t||(t=new Promise((n,r)=>{let i=e,a=e=>t=>{i===e&&n(t)},o=e=>t=>{i===e&&r(t)},s=e=>{`onCancel`in e&&typeof e.onCancel==`function`&&e.onCancel(e=>{$c(e)?(nl.set(e,t),i=e,e.then(a(e),o(e)),s(e)):n(e)})};e.then(a(e),o(e)),s(e)}),nl.set(e,t)),t};function il(e,t){let n=Qc(t),[[r,i,a],o]=(0,B.useReducer)(t=>{let r=n.get(e);return Object.is(t[0],r)&&t[1]===n&&t[2]===e?t:[r,n,e]},void 0,()=>[n.get(e),n,e]),s=r;(i!==n||a!==e)&&(o(),s=n.get(e));let c=t?.delay;return(0,B.useEffect)(()=>{let t=n.sub(e,()=>{if(typeof c==`number`){let t=n.get(e);$c(t)&&el(rl(t)),setTimeout(o,c);return}o()});return o(),t},[n,e,c]),(0,B.useDebugValue)(s),$c(s)?tl(rl(s)):s}function al(e,t){let n=Qc(t);return(0,B.useCallback)((...t)=>n.set(e,...t),[n,e])}function ol(e,t){return[il(e,t),al(e,t)]}var sl=new WeakMap;function cl(e,t){let n=Qc(t),r=ll(n);for(let[i,a]of e)(!r.has(i)||t?.dangerouslyForceHydrate)&&(r.add(i),n.set(i,a))}var ll=e=>{let t=sl.get(e);return t||(t=new WeakSet,sl.set(e,t)),t};function ul(){return ul=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},ul.apply(this,arguments)}function dl(){let e=(0,B.createContext)(null);function t({store:t,initialValues:n=[],children:r}){let i=(0,B.useRef)(t);return i.current||=Jc(),cl(n,{store:i.current}),(0,V.jsx)(e.Provider,{value:i.current,children:r})}let n=t=>{let n=(0,B.useContext)(e);if(!n)throw Error(`Missing Provider from createIsolation`);return Qc(ul({store:n},t))};return{Provider:t,useStore:n,useAtom:(e,t)=>{let r=n();return ol(e,ul({store:r},t))},useAtomValue:(e,t)=>{let r=n();return il(e,ul({store:r},t))},useSetAtom:(e,t)=>{let r=n();return al(e,ul({store:r},t))}}}var{read:fl,write:pl}=Ec(null);(0,B.createContext)({scope:void 0,baseStore:void 0});function ml(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function hl(...e){return t=>{let n=!1,r=e.map(e=>{let r=ml(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():ml(e[t],null)}}}}function gl(...e){return B.useCallback(hl(...e),e)}function _l(e){let t=vl(e),n=B.forwardRef((e,n)=>{let{children:r,...i}=e,a=B.Children.toArray(r),o=a.find(bl);if(o){let e=o.props.children,r=a.map(t=>t===o?B.Children.count(e)>1?B.Children.only(null):B.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:B.isValidElement(e)?B.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function vl(e){let t=B.forwardRef((e,t)=>{let{children:n,...r}=e;if(B.isValidElement(n)){let e=Sl(n),i=xl(r,n.props);return n.type!==B.Fragment&&(i.ref=t?hl(t,e):e),B.cloneElement(n,i)}return B.Children.count(n)>1?B.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yl=Symbol(`radix.slottable`);function bl(e){return B.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===yl}function xl(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]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Sl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Cl=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=_l(`Primitive.${t}`),r=B.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function wl(e,t){e&&Sc.flushSync(()=>e.dispatchEvent(t))}function Tl(e,t=[]){let n=[];function r(t,r){let i=B.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=B.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=B.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>B.createContext(e));return function(n){let r=n?.[e]||t;return B.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,El(i,...t)]}function El(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function Dl(e){let t=e+`CollectionProvider`,[n,r]=Tl(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=B.useRef(null),a=B.useRef(new Map).current;return(0,V.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=_l(s),l=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=gl(t,a(s,n).collectionRef);return(0,V.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=_l(u),p=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),s=gl(t,o),c=a(u,n);return B.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,V.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return B.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}typeof window<`u`&&window.document&&window.document.createElement;function U(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var Ol=globalThis?.document?B.useLayoutEffect:()=>{},kl=B.useInsertionEffect||Ol;function Al({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=jl({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=B.useRef(e!==void 0);B.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,B.useCallback(t=>{if(s){let n=Ml(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function jl({defaultProp:e,onChange:t}){let[n,r]=B.useState(e),i=B.useRef(n),a=B.useRef(t);return kl(()=>{a.current=t},[t]),B.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Ml(e){return typeof e==`function`}function Nl(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}var Pl=e=>{let{present:t,children:n}=e,r=Fl(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=gl(r.ref,Ll(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null};Pl.displayName=`Presence`;function Fl(e){let[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),a=B.useRef(`none`),[o,s]=Nl(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return B.useEffect(()=>{let e=Il(r.current);a.current=o===`mounted`?e:`none`},[o]),Ol(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Il(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Ol(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Il(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Il(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:B.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Il(e){return e?.animationName||`none`}function Ll(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Rl=B.useId||(()=>void 0),zl=0;function Bl(e){let[t,n]=B.useState(Rl());return Ol(()=>{e||n(e=>e??String(zl++))},[e]),e||(t?`radix-${t}`:``)}var Vl=B.createContext(void 0);function Hl(e){let t=B.useContext(Vl);return e||t||`ltr`}function Ul(e){let t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>(...e)=>t.current?.(...e),[])}function Wl(e,t=globalThis?.document){let n=Ul(e);B.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Gl=`DismissableLayer`,Kl=`dismissableLayer.update`,ql=`dismissableLayer.pointerDownOutside`,Jl=`dismissableLayer.focusOutside`,Yl,Xl=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Zl=B.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=B.useContext(Xl),[u,d]=B.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=B.useState({}),m=gl(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=eu(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=tu(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Wl(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),B.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Yl=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),nu(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Yl)}},[u,f,n,l]),B.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),nu())},[u,l]),B.useEffect(()=>{let e=()=>p({});return document.addEventListener(Kl,e),()=>document.removeEventListener(Kl,e)},[]),(0,V.jsx)(Cl.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:U(e.onFocusCapture,S.onFocusCapture),onBlurCapture:U(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:U(e.onPointerDownCapture,x.onPointerDownCapture)})});Zl.displayName=Gl;var Ql=`DismissableLayerBranch`,$l=B.forwardRef((e,t)=>{let n=B.useContext(Xl),r=B.useRef(null),i=gl(t,r);return B.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(Cl.div,{...e,ref:i})});$l.displayName=Ql;function eu(e,t=globalThis?.document){let n=Ul(e),r=B.useRef(!1),i=B.useRef(()=>{});return B.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){ru(ql,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function tu(e,t=globalThis?.document){let n=Ul(e),r=B.useRef(!1);return B.useEffect(()=>{let e=e=>{e.target&&!r.current&&ru(Jl,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function nu(){let e=new CustomEvent(Kl);document.dispatchEvent(e)}function ru(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?wl(i,a):i.dispatchEvent(a)}var iu=`focusScope.autoFocusOnMount`,au=`focusScope.autoFocusOnUnmount`,ou={bubbles:!1,cancelable:!0},su=`FocusScope`,cu=B.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=Ul(i),u=Ul(a),d=B.useRef(null),f=gl(t,e=>c(e)),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:hu(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||hu(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&hu(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),B.useEffect(()=>{if(s){gu.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(iu,ou);s.addEventListener(iu,l),s.dispatchEvent(t),t.defaultPrevented||(lu(yu(du(s)),{select:!0}),document.activeElement===e&&hu(s))}return()=>{s.removeEventListener(iu,l),setTimeout(()=>{let t=new CustomEvent(au,ou);s.addEventListener(au,u),s.dispatchEvent(t),t.defaultPrevented||hu(e??document.body,{select:!0}),s.removeEventListener(au,u),gu.remove(p)},0)}}},[s,l,u,p]);let m=B.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=uu(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&hu(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&hu(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(Cl.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});cu.displayName=su;function lu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(hu(r,{select:t}),document.activeElement!==n)return}function uu(e){let t=du(e);return[fu(t,e),fu(t.reverse(),e)]}function du(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function fu(e,t){for(let n of e)if(!pu(n,{upTo:t}))return n}function pu(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 mu(e){return e instanceof HTMLInputElement&&`select`in e}function hu(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mu(e)&&t&&e.select()}}var gu=_u();function _u(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=vu(e,t),e.unshift(t)},remove(t){e=vu(e,t),e[0]?.resume()}}}function vu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function yu(e){return e.filter(e=>e.tagName!==`A`)}var bu=`Portal`,xu=B.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=B.useState(!1);Ol(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Sc.createPortal((0,V.jsx)(Cl.div,{...r,ref:t}),o):null});xu.displayName=bu;var Su=0;function Cu(){B.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??wu()),document.body.insertAdjacentElement(`beforeend`,e[1]??wu()),Su++,()=>{Su===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Su--}},[])}function wu(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Tu=function(){return Tu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Tu.apply(this,arguments)};function Eu(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 Du(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Ou=`right-scroll-bar-position`,ku=`width-before-scroll-bar`,Au=`with-scroll-bars-hidden`,ju=`--removed-body-scroll-bar-size`;function Mu(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Nu(e,t){var n=(0,B.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Pu=typeof window<`u`?B.useLayoutEffect:B.useEffect,Fu=new WeakMap;function Iu(e,t){var n=Nu(t||null,function(t){return e.forEach(function(e){return Mu(e,t)})});return Pu(function(){var t=Fu.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Mu(e,null)}),i.forEach(function(e){r.has(e)||Mu(e,a)})}Fu.set(n,e)},[e]),n}function Lu(e){return e}function Ru(e,t){t===void 0&&(t=Lu);var n=[],r=!1;return{read:function(){if(r)throw 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(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function zu(e){e===void 0&&(e={});var t=Ru(null);return t.options=Tu({async:!0,ssr:!1},e),t}var Bu=function(e){var t=e.sideCar,n=Eu(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return B.createElement(r,Tu({},n))};Bu.isSideCarExport=!0;function Vu(e,t){return e.useMedium(t),Bu}var Hu=zu(),Uu=function(){},Wu=B.forwardRef(function(e,t){var n=B.useRef(null),r=B.useState({onScrollCapture:Uu,onWheelCapture:Uu,onTouchMoveCapture:Uu}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Eu(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Iu([n,t]),C=Tu(Tu({},b),i);return B.createElement(B.Fragment,null,u&&B.createElement(x,{sideCar:Hu,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?B.cloneElement(B.Children.only(s),Tu(Tu({},C),{ref:S})):B.createElement(v,Tu({},C,{className:c,ref:S}),s))});Wu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Wu.classNames={fullWidth:ku,zeroRight:Ou};var Gu,Ku=function(){if(Gu)return Gu;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function qu(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Ku();return t&&e.setAttribute(`nonce`,t),e}function Ju(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Yu(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Xu=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qu())&&(Ju(t,n),Yu(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Zu=function(){var e=Xu();return function(t,n){B.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Qu=function(){var e=Zu();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},$u={left:0,top:0,right:0,gap:0},ed=function(e){return parseInt(e||``,10)||0},td=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[ed(n),ed(r),ed(i)]},nd=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return $u;var t=td(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])}},rd=Qu(),id=`data-scroll-locked`,ad=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
3
+ .${Au} {
4
+ overflow: hidden ${r};
5
+ padding-right: ${s}px ${r};
6
+ }
7
+ body[${id}] {
8
+ overflow: hidden ${r};
9
+ overscroll-behavior: contain;
10
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
11
+ padding-left: ${i}px;
12
+ padding-top: ${a}px;
13
+ padding-right: ${o}px;
14
+ margin-left:0;
15
+ margin-top:0;
16
+ margin-right: ${s}px ${r};
17
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
18
+ }
19
+
20
+ .${Ou} {
21
+ right: ${s}px ${r};
22
+ }
23
+
24
+ .${ku} {
25
+ margin-right: ${s}px ${r};
26
+ }
27
+
28
+ .${Ou} .${Ou} {
29
+ right: 0 ${r};
30
+ }
31
+
32
+ .${ku} .${ku} {
33
+ margin-right: 0 ${r};
34
+ }
35
+
36
+ body[${id}] {
37
+ ${ju}: ${s}px;
38
+ }
39
+ `},od=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},sd=function(){B.useEffect(function(){return document.body.setAttribute(id,(od()+1).toString()),function(){var e=od()-1;e<=0?document.body.removeAttribute(id):document.body.setAttribute(id,e.toString())}},[])},cd=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;sd();var a=B.useMemo(function(){return nd(i)},[i]);return B.createElement(rd,{styles:ad(a,!t,i,n?``:`!important`)})},ld=!1;if(typeof window<`u`)try{var ud=Object.defineProperty({},"passive",{get:function(){return ld=!0,!0}});window.addEventListener(`test`,ud,ud),window.removeEventListener(`test`,ud,ud)}catch{ld=!1}var dd=ld?{passive:!1}:!1,fd=function(e){return e.tagName===`TEXTAREA`},pd=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!fd(e)&&n[t]===`visible`)},md=function(e){return pd(e,`overflowY`)},hd=function(e){return pd(e,`overflowX`)},gd=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),yd(e,r)){var i=bd(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},_d=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},vd=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},yd=function(e,t){return e===`v`?md(t):hd(t)},bd=function(e,t){return e===`v`?_d(t):vd(t)},xd=function(e,t){return e===`h`&&t===`rtl`?-1:1},Sd=function(e,t,n,r,i){var a=xd(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=bd(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&yd(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Cd=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},wd=function(e){return[e.deltaX,e.deltaY]},Td=function(e){return e&&`current`in e?e.current:e},Ed=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Dd=function(e){return`
40
+ .block-interactivity-${e} {pointer-events: none;}
41
+ .allow-interactivity-${e} {pointer-events: all;}
42
+ `},Od=0,kd=[];function Ad(e){var t=B.useRef([]),n=B.useRef([0,0]),r=B.useRef(),i=B.useState(Od++)[0],a=B.useState(Qu)[0],o=B.useRef(e);B.useEffect(function(){o.current=e},[e]),B.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Du([e.lockRef.current],(e.shards||[]).map(Td),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=B.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Cd(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=gd(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=gd(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Sd(h,t,e,h===`h`?s:c,!0)},[]),c=B.useCallback(function(e){var n=e;if(!(!kd.length||kd[kd.length-1]!==a)){var r=`deltaY`in n?wd(n):Cd(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Ed(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Td).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=B.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:jd(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=B.useCallback(function(e){n.current=Cd(e),r.current=void 0},[]),d=B.useCallback(function(t){l(t.type,wd(t),t.target,s(t,e.lockRef.current))},[]),f=B.useCallback(function(t){l(t.type,Cd(t),t.target,s(t,e.lockRef.current))},[]);B.useEffect(function(){return kd.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,dd),document.addEventListener(`touchmove`,c,dd),document.addEventListener(`touchstart`,u,dd),function(){kd=kd.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,dd),document.removeEventListener(`touchmove`,c,dd),document.removeEventListener(`touchstart`,u,dd)}},[]);var p=e.removeScrollBar,m=e.inert;return B.createElement(B.Fragment,null,m?B.createElement(a,{styles:Dd(i)}):null,p?B.createElement(cd,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function jd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Md=Vu(Hu,Ad),Nd=B.forwardRef(function(e,t){return B.createElement(Wu,Tu({},e,{ref:t,sideCar:Md}))});Nd.classNames=Wu.classNames;var Pd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Fd=new WeakMap,Id=new WeakMap,Ld={},Rd=0,zd=function(e){return e&&(e.host||zd(e.parentNode))},Bd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=zd(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Vd=function(e,t,n,r){var i=Bd(t,Array.isArray(e)?e:[e]);Ld[n]||(Ld[n]=new WeakMap);var a=Ld[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Fd.get(e)||0)+1,l=(a.get(e)||0)+1;Fd.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Id.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Rd++,function(){o.forEach(function(e){var t=Fd.get(e)-1,i=a.get(e)-1;Fd.set(e,t),a.set(e,i),t||(Id.has(e)||e.removeAttribute(r),Id.delete(e)),i||e.removeAttribute(n)}),Rd--,Rd||(Fd=new WeakMap,Fd=new WeakMap,Id=new WeakMap,Ld={})}},Hd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Pd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Vd(r,i,n,`aria-hidden`)):function(){return null}},Ud=t((e=>{var t=_c();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Wd=t(((e,t)=>{t.exports=Ud()}));function Gd(e){let[t,n]=B.useState(void 0);return Ol(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Kd=[`top`,`right`,`bottom`,`left`],qd=Math.min,Jd=Math.max,Yd=Math.round,Xd=Math.floor,Zd=e=>({x:e,y:e}),Qd={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function $d(e,t,n){return Jd(e,qd(t,n))}function ef(e,t){return typeof e==`function`?e(t):e}function tf(e){return e.split(`-`)[0]}function nf(e){return e.split(`-`)[1]}function rf(e){return e===`x`?`y`:`x`}function af(e){return e===`y`?`height`:`width`}function of(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function sf(e){return rf(of(e))}function cf(e,t,n){n===void 0&&(n=!1);let r=nf(e),i=sf(e),a=af(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=_f(o)),[o,_f(o)]}function lf(e){let t=_f(e);return[uf(e),t,uf(t)]}function uf(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var df=[`left`,`right`],ff=[`right`,`left`],pf=[`top`,`bottom`],mf=[`bottom`,`top`];function hf(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ff:df:t?df:ff;case`left`:case`right`:return t?pf:mf;default:return[]}}function gf(e,t,n,r){let i=nf(e),a=hf(tf(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(uf)))),a}function _f(e){let t=tf(e);return Qd[t]+e.slice(t.length)}function vf(e){return{top:0,right:0,bottom:0,left:0,...e}}function yf(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:vf(e)}function bf(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function xf(e,t,n){let{reference:r,floating:i}=e,a=of(t),o=sf(t),s=af(o),c=tf(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(nf(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Sf(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=ef(t,e),p=yf(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=bf(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=bf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Cf=50,wf=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Sf},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=xf(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Cf&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=xf(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Tf=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=ef(e,t)||{};if(l==null)return{};let d=yf(u),f={x:n,y:r},p=sf(i),m=af(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=qd(d[_],T),D=qd(d[v],T),O=E,ee=C-h[m]-D,k=C/2-h[m]/2+w,A=$d(O,k,ee),te=!c.arrow&&nf(i)!=null&&k!==A&&a.reference[m]/2-(k<O?E:D)-h[m]/2<0,ne=te?k<O?k-O:k-ee:0;return{[p]:f[p]+ne,data:{[p]:A,centerOffset:k-A-ne,...te&&{alignmentOffset:ne}},reset:te}}}),Ef=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:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=ef(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=tf(r),_=of(o),v=tf(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[_f(o)]:lf(o)),x=p!==`none`;!d&&x&&b.push(...gf(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=cf(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==of(t))||T.every(e=>of(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=of(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Df(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Of(e){return Kd.some(t=>e[t]>=0)}var kf=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=ef(e,t);switch(i){case`referenceHidden`:{let e=Df(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Of(e)}}}case`escaped`:{let e=Df(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Of(e)}}}default:return{}}}}},Af=new Set([`left`,`top`]);async function jf(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=tf(n),s=nf(n),c=of(n)===`y`,l=Af.has(o)?-1:1,u=a&&c?-1:1,d=ef(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Mf=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await jf(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Nf=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ef(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=of(tf(i)),p=rf(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=$d(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=$d(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Pf=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:c=!0,crossAxis:l=!0}=ef(e,t),u={x:n,y:r},d=of(i),f=rf(d),p=u[f],m=u[d],h=ef(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Af.has(tf(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ff=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=ef(e,t),u=await o.detectOverflow(t,l),d=tf(i),f=nf(i),p=of(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=qd(h-u[g],v),x=qd(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Jd(u.left,0),t=Jd(u.right,0),n=Jd(u.top,0),r=Jd(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Jd(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Jd(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function If(){return typeof window<`u`}function Lf(e){return Bf(e)?(e.nodeName||``).toLowerCase():`#document`}function Rf(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function zf(e){return((Bf(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Bf(e){return If()?e instanceof Node||e instanceof Rf(e).Node:!1}function Vf(e){return If()?e instanceof Element||e instanceof Rf(e).Element:!1}function Hf(e){return If()?e instanceof HTMLElement||e instanceof Rf(e).HTMLElement:!1}function Uf(e){return!If()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Rf(e).ShadowRoot}function Wf(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=tp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Gf(e){return/^(table|td|th)$/.test(Lf(e))}function Kf(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var qf=/transform|translate|scale|rotate|perspective|filter/,Jf=/paint|layout|strict|content/,Yf=e=>!!e&&e!==`none`,Xf;function Zf(e){let t=Vf(e)?tp(e):e;return Yf(t.transform)||Yf(t.translate)||Yf(t.scale)||Yf(t.rotate)||Yf(t.perspective)||!$f()&&(Yf(t.backdropFilter)||Yf(t.filter))||qf.test(t.willChange||``)||Jf.test(t.contain||``)}function Qf(e){let t=rp(e);for(;Hf(t)&&!ep(t);){if(Zf(t))return t;if(Kf(t))return null;t=rp(t)}return null}function $f(){return Xf??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Xf}function ep(e){return/^(html|body|#document)$/.test(Lf(e))}function tp(e){return Rf(e).getComputedStyle(e)}function np(e){return Vf(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rp(e){if(Lf(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Uf(e)&&e.host||zf(e);return Uf(t)?t.host:t}function ip(e){let t=rp(e);return ep(t)?e.ownerDocument?e.ownerDocument.body:e.body:Hf(t)&&Wf(t)?t:ip(t)}function ap(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ip(e),i=r===e.ownerDocument?.body,a=Rf(r);if(i){let e=op(a);return t.concat(a,a.visualViewport||[],Wf(r)?r:[],e&&n?ap(e):[])}else return t.concat(r,ap(r,[],n))}function op(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function sp(e){let t=tp(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Hf(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Yd(n)!==a||Yd(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function cp(e){return Vf(e)?e:e.contextElement}function lp(e){let t=cp(e);if(!Hf(t))return Zd(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=sp(t),o=(a?Yd(n.width):n.width)/r,s=(a?Yd(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var up=Zd(0);function dp(e){let t=Rf(e);return!$f()||!t.visualViewport?up:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function fp(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Rf(e)?!1:t}function pp(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=cp(e),o=Zd(1);t&&(r?Vf(r)&&(o=lp(r)):o=lp(e));let s=fp(a,n,r)?dp(a):Zd(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Rf(a),t=r&&Vf(r)?Rf(r):r,n=e,i=op(n);for(;i&&r&&t!==n;){let e=lp(i),t=i.getBoundingClientRect(),r=tp(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Rf(i),i=op(n)}}return bf({width:u,height:d,x:c,y:l})}function mp(e,t){let n=np(e).scrollLeft;return t?t.left+n:pp(zf(e)).left+n}function hp(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-mp(e,n),y:n.top+t.scrollTop}}function gp(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=zf(r),s=t?Kf(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Zd(1),u=Zd(0),d=Hf(r);if((d||!d&&!a)&&((Lf(r)!==`body`||Wf(o))&&(c=np(r)),d)){let e=pp(r);l=lp(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?hp(o,c):Zd(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function _p(e){return Array.from(e.getClientRects())}function vp(e){let t=zf(e),n=np(e),r=e.ownerDocument.body,i=Jd(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Jd(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+mp(e),s=-n.scrollTop;return tp(r).direction===`rtl`&&(o+=Jd(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var yp=25;function bp(e,t){let n=Rf(e),r=zf(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=$f();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=mp(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=yp&&(a-=o)}else l<=yp&&(a+=l);return{width:a,height:o,x:s,y:c}}function xp(e,t){let n=pp(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Hf(e)?lp(e):Zd(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Sp(e,t,n){let r;if(t===`viewport`)r=bp(e,n);else if(t===`document`)r=vp(zf(e));else if(Vf(t))r=xp(t,n);else{let n=dp(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return bf(r)}function Cp(e,t){let n=rp(e);return n===t||!Vf(n)||ep(n)?!1:tp(n).position===`fixed`||Cp(n,t)}function wp(e,t){let n=t.get(e);if(n)return n;let r=ap(e,[],!1).filter(e=>Vf(e)&&Lf(e)!==`body`),i=null,a=tp(e).position===`fixed`,o=a?rp(e):e;for(;Vf(o)&&!ep(o);){let t=tp(o),n=Zf(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Wf(o)&&!n&&Cp(e,o))?r=r.filter(e=>e!==o):i=t,o=rp(o)}return t.set(e,r),r}function Tp(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Kf(t)?[]:wp(t,this._c):[].concat(n),r],o=Sp(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Sp(t,a[e],i);s=Jd(n.top,s),c=qd(n.right,c),l=qd(n.bottom,l),u=Jd(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ep(e){let{width:t,height:n}=sp(e);return{width:t,height:n}}function Dp(e,t,n){let r=Hf(t),i=zf(t),a=n===`fixed`,o=pp(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Zd(0);function l(){c.x=mp(i)}if(r||!r&&!a)if((Lf(t)!==`body`||Wf(i))&&(s=np(t)),r){let e=pp(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?hp(i,s):Zd(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Op(e){return tp(e).position===`static`}function kp(e,t){if(!Hf(e)||tp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return zf(e)===n&&(n=n.ownerDocument.body),n}function Ap(e,t){let n=Rf(e);if(Kf(e))return n;if(!Hf(e)){let t=rp(e);for(;t&&!ep(t);){if(Vf(t)&&!Op(t))return t;t=rp(t)}return n}let r=kp(e,t);for(;r&&Gf(r)&&Op(r);)r=kp(r,t);return r&&ep(r)&&Op(r)&&!Zf(r)?n:r||Qf(e)||n}var jp=async function(e){let t=this.getOffsetParent||Ap,n=this.getDimensions,r=await n(e.floating);return{reference:Dp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Mp(e){return tp(e).direction===`rtl`}var Np={convertOffsetParentRelativeRectToViewportRelativeRect:gp,getDocumentElement:zf,getClippingRect:Tp,getOffsetParent:Ap,getElementRects:jp,getClientRects:_p,getDimensions:Ep,getScale:lp,isElement:Vf,isRTL:Mp};function Pp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Fp(e,t){let n=null,r,i=zf(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Xd(d),h=Xd(i.clientWidth-(u+f)),g=Xd(i.clientHeight-(d+p)),_=Xd(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Jd(0,qd(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Pp(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Ip(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=cp(e),u=i||a?[...l?ap(l):[],...t?ap(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Fp(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?pp(e):null;c&&g();function g(){let t=pp(e);h&&!Pp(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Lp=Mf,Rp=Nf,zp=Ef,Bp=Ff,Vp=kf,Hp=Tf,Up=Pf,Wp=(e,t,n)=>{let r=new Map,i={platform:Np,...n},a={...i.platform,_c:r};return wf(e,t,{...i,platform:a})},Gp=typeof document<`u`?B.useLayoutEffect:function(){};function Kp(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(!Kp(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(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Kp(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function qp(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jp(e,t){let n=qp(e);return Math.round(t*n)/n}function Yp(e){let t=B.useRef(e);return Gp(()=>{t.current=e}),t}function Xp(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=B.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=B.useState(r);Kp(f,r)||p(r);let[m,h]=B.useState(null),[g,_]=B.useState(null),v=B.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=B.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=B.useRef(null),C=B.useRef(null),w=B.useRef(u),T=c!=null,E=Yp(c),D=Yp(i),O=Yp(l),ee=B.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Wp(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};k.current&&!Kp(w.current,t)&&(w.current=t,Sc.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Gp(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let k=B.useRef(!1);Gp(()=>(k.current=!0,()=>{k.current=!1}),[]),Gp(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,ee);ee()}},[b,x,ee,E,T]);let A=B.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),te=B.useMemo(()=>({reference:b,floating:x}),[b,x]),ne=B.useMemo(()=>{let e={position:n,left:0,top:0};if(!te.floating)return e;let t=Jp(te.floating,u.x),r=Jp(te.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...qp(te.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,te.floating,u.x,u.y]);return B.useMemo(()=>({...u,update:ee,refs:A,elements:te,floatingStyles:ne}),[u,ee,A,te,ne])}var Zp=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Hp({element:r.current,padding:i}).fn(n):r?Hp({element:r,padding:i}).fn(n):{}}}},Qp=(e,t)=>{let n=Lp(e);return{name:n.name,fn:n.fn,options:[e,t]}},$p=(e,t)=>{let n=Rp(e);return{name:n.name,fn:n.fn,options:[e,t]}},em=(e,t)=>({fn:Up(e).fn,options:[e,t]}),tm=(e,t)=>{let n=zp(e);return{name:n.name,fn:n.fn,options:[e,t]}},nm=(e,t)=>{let n=Bp(e);return{name:n.name,fn:n.fn,options:[e,t]}},rm=(e,t)=>{let n=Vp(e);return{name:n.name,fn:n.fn,options:[e,t]}},im=(e,t)=>{let n=Zp(e);return{name:n.name,fn:n.fn,options:[e,t]}},am=`Arrow`,om=B.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,V.jsx)(Cl.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,V.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});om.displayName=am;var sm=om,cm=`Popper`,[lm,um]=Tl(cm),[dm,fm]=lm(cm),pm=e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null);return(0,V.jsx)(dm,{scope:t,anchor:r,onAnchorChange:i,children:n})};pm.displayName=cm;var mm=`PopperAnchor`,hm=B.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=fm(mm,n),o=B.useRef(null),s=gl(t,o),c=B.useRef(null);return B.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,V.jsx)(Cl.div,{...i,ref:s})});hm.displayName=mm;var gm=`PopperContent`,[_m,vm]=lm(gm),ym=B.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=fm(gm,n),[_,v]=B.useState(null),y=gl(t,e=>v(e)),[b,x]=B.useState(null),S=Gd(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,ee={padding:E,boundary:D.filter(Cm),altBoundary:O},{refs:k,floatingStyles:A,placement:te,isPositioned:ne,middlewareData:re}=Xp({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>Ip(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Qp({mainAxis:i+w,alignmentAxis:o}),c&&$p({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?em():void 0,...ee}),c&&tm({...ee}),nm({...ee,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&im({element:b,padding:s}),wm({arrowWidth:C,arrowHeight:w}),f&&rm({strategy:`referenceHidden`,...ee})]}),[ie,ae]=Tm(te),oe=Ul(m);Ol(()=>{ne&&oe?.()},[ne,oe]);let se=re.arrow?.x,ce=re.arrow?.y,le=re.arrow?.centerOffset!==0,[ue,de]=B.useState();return Ol(()=>{_&&de(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:k.setFloating,"data-radix-popper-content-wrapper":``,style:{...A,transform:ne?A.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ue,"--radix-popper-transform-origin":[re.transformOrigin?.x,re.transformOrigin?.y].join(` `),...re.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(_m,{scope:n,placedSide:ie,onArrowChange:x,arrowX:se,arrowY:ce,shouldHideArrow:le,children:(0,V.jsx)(Cl.div,{"data-side":ie,"data-align":ae,...h,ref:y,style:{...h.style,animation:ne?void 0:`none`}})})})});ym.displayName=gm;var bm=`PopperArrow`,xm={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Sm=B.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=vm(bm,n),a=xm[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(sm,{...r,ref:t,style:{...r.style,display:`block`}})})});Sm.displayName=bm;function Cm(e){return e!==null}var wm=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Tm(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Tm(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Em=pm,Dm=hm,Om=ym,km=Sm,Am=`rovingFocusGroup.onEntryFocus`,jm={bubbles:!1,cancelable:!0},Mm=`RovingFocusGroup`,[Nm,Pm,Fm]=Dl(Mm),[Im,Lm]=Tl(Mm,[Fm]),[Rm,zm]=Im(Mm),Bm=B.forwardRef((e,t)=>(0,V.jsx)(Nm.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(Nm.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(Vm,{...e,ref:t})})}));Bm.displayName=Mm;var Vm=B.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=B.useRef(null),p=gl(t,f),m=Hl(a),[h,g]=Al({prop:o,defaultProp:s??null,onChange:c,caller:Mm}),[_,v]=B.useState(!1),y=Ul(l),b=Pm(n),x=B.useRef(!1),[S,C]=B.useState(0);return B.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Am,y),()=>e.removeEventListener(Am,y)},[y]),(0,V.jsx)(Rm,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:B.useCallback(e=>g(e),[g]),onItemShiftTab:B.useCallback(()=>v(!0),[]),onFocusableItemAdd:B.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:B.useCallback(()=>C(e=>e-1),[]),children:(0,V.jsx)(Cl.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:U(e.onMouseDown,()=>{x.current=!0}),onFocus:U(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Am,jm);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);qm([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:U(e.onBlur,()=>v(!1))})})}),Hm=`RovingFocusGroupItem`,Um=B.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Bl(),l=a||c,u=zm(Hm,n),d=u.currentTabStopId===l,f=Pm(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return B.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,V.jsx)(Nm.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(Cl.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:U(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:U(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:U(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Km(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Jm(n,r+1):n.slice(r+1)}setTimeout(()=>qm(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Um.displayName=Hm;var Wm={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Gm(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Km(e,t,n){let r=Gm(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Wm[r]}function qm(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Jm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ym=Bm,Xm=Um,Zm=[`Enter`,` `],Qm=[`ArrowDown`,`PageUp`,`Home`],$m=[`ArrowUp`,`PageDown`,`End`],eh=[...Qm,...$m],th={ltr:[...Zm,`ArrowRight`],rtl:[...Zm,`ArrowLeft`]},nh={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},rh=`Menu`,[ih,ah,oh]=Dl(rh),[sh,ch]=Tl(rh,[oh,um,Lm]),lh=um(),uh=Lm(),[dh,fh]=sh(rh),[ph,mh]=sh(rh),hh=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=lh(t),[c,l]=B.useState(null),u=B.useRef(!1),d=Ul(a),f=Hl(i);return B.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,V.jsx)(Em,{...s,children:(0,V.jsx)(dh,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,V.jsx)(ph,{scope:t,onClose:B.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};hh.displayName=rh;var gh=`MenuAnchor`,_h=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=lh(n);return(0,V.jsx)(Dm,{...i,...r,ref:t})});_h.displayName=gh;var vh=`MenuPortal`,[yh,bh]=sh(vh,{forceMount:void 0}),xh=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=fh(vh,t);return(0,V.jsx)(yh,{scope:t,forceMount:n,children:(0,V.jsx)(Pl,{present:n||a.open,children:(0,V.jsx)(xu,{asChild:!0,container:i,children:r})})})};xh.displayName=vh;var Sh=`MenuContent`,[Ch,wh]=sh(Sh),Th=B.forwardRef((e,t)=>{let n=bh(Sh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=fh(Sh,e.__scopeMenu),o=mh(Sh,e.__scopeMenu);return(0,V.jsx)(ih.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(Pl,{present:r||a.open,children:(0,V.jsx)(ih.Slot,{scope:e.__scopeMenu,children:o.modal?(0,V.jsx)(Eh,{...i,ref:t}):(0,V.jsx)(Dh,{...i,ref:t})})})})}),Eh=B.forwardRef((e,t)=>{let n=fh(Sh,e.__scopeMenu),r=B.useRef(null),i=gl(t,r);return B.useEffect(()=>{let e=r.current;if(e)return Hd(e)},[]),(0,V.jsx)(kh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:U(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Dh=B.forwardRef((e,t)=>{let n=fh(Sh,e.__scopeMenu);return(0,V.jsx)(kh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Oh=_l(`MenuContent.ScrollLock`),kh=B.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=fh(Sh,n),_=mh(Sh,n),v=lh(n),y=uh(n),b=ah(n),[x,S]=B.useState(null),C=B.useRef(null),w=gl(t,C,g.onContentChange),T=B.useRef(0),E=B.useRef(``),D=B.useRef(0),O=B.useRef(null),ee=B.useRef(`right`),k=B.useRef(0),A=m?Nd:B.Fragment,te=m?{as:Oh,allowPinchZoom:!0}:void 0,ne=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=pg(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};B.useEffect(()=>()=>window.clearTimeout(T.current),[]),Cu();let re=B.useCallback(e=>ee.current===O.current?.side&&hg(e,O.current?.area),[]);return(0,V.jsx)(Ch,{scope:n,searchRef:E,onItemEnter:B.useCallback(e=>{re(e)&&e.preventDefault()},[re]),onItemLeave:B.useCallback(e=>{re(e)||(C.current?.focus(),S(null))},[re]),onTriggerLeave:B.useCallback(e=>{re(e)&&e.preventDefault()},[re]),pointerGraceTimerRef:D,onPointerGraceIntentChange:B.useCallback(e=>{O.current=e},[]),children:(0,V.jsx)(A,{...te,children:(0,V.jsx)(cu,{asChild:!0,trapped:i,onMountAutoFocus:U(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,V.jsx)(Zl,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,V.jsx)(Ym,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:U(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,V.jsx)(Om,{role:`menu`,"aria-orientation":`vertical`,"data-state":cg(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:U(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ne(e.key));let i=C.current;if(e.target!==i||!eh.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);$m.includes(e.key)&&a.reverse(),dg(a)}),onBlur:U(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:U(e.onPointerMove,gg(e=>{let t=e.target,n=k.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>k.current?`right`:`left`;ee.current=t,k.current=e.clientX}}))})})})})})})});Th.displayName=Sh;var Ah=`MenuGroup`,jh=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(Cl.div,{role:`group`,...r,ref:t})});jh.displayName=Ah;var Mh=`MenuLabel`,Nh=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(Cl.div,{...r,ref:t})});Nh.displayName=Mh;var Ph=`MenuItem`,Fh=`menu.itemSelect`,Ih=B.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=B.useRef(null),o=mh(Ph,e.__scopeMenu),s=wh(Ph,e.__scopeMenu),c=gl(t,a),l=B.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Fh,{bubbles:!0,cancelable:!0});e.addEventListener(Fh,e=>r?.(e),{once:!0}),wl(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,V.jsx)(Lh,{...i,ref:c,disabled:n,onClick:U(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:U(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:U(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Zm.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Ih.displayName=Ph;var Lh=B.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=wh(Ph,n),s=uh(n),c=B.useRef(null),l=gl(t,c),[u,d]=B.useState(!1),[f,p]=B.useState(``);return B.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,V.jsx)(ih.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,V.jsx)(Xm,{asChild:!0,...s,focusable:!r,children:(0,V.jsx)(Cl.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:U(e.onPointerMove,gg(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:U(e.onPointerLeave,gg(e=>o.onItemLeave(e))),onFocus:U(e.onFocus,()=>d(!0)),onBlur:U(e.onBlur,()=>d(!1))})})})}),Rh=`MenuCheckboxItem`,zh=B.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,V.jsx)(qh,{scope:e.__scopeMenu,checked:n,children:(0,V.jsx)(Ih,{role:`menuitemcheckbox`,"aria-checked":lg(n)?`mixed`:n,...i,ref:t,"data-state":ug(n),onSelect:U(i.onSelect,()=>r?.(lg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});zh.displayName=Rh;var Bh=`MenuRadioGroup`,[Vh,Hh]=sh(Bh,{value:void 0,onValueChange:()=>{}}),Uh=B.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Ul(r);return(0,V.jsx)(Vh,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,V.jsx)(jh,{...i,ref:t})})});Uh.displayName=Bh;var Wh=`MenuRadioItem`,Gh=B.forwardRef((e,t)=>{let{value:n,...r}=e,i=Hh(Wh,e.__scopeMenu),a=n===i.value;return(0,V.jsx)(qh,{scope:e.__scopeMenu,checked:a,children:(0,V.jsx)(Ih,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":ug(a),onSelect:U(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Gh.displayName=Wh;var Kh=`MenuItemIndicator`,[qh,Jh]=sh(Kh,{checked:!1}),Yh=B.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Jh(Kh,n);return(0,V.jsx)(Pl,{present:r||lg(a.checked)||a.checked===!0,children:(0,V.jsx)(Cl.span,{...i,ref:t,"data-state":ug(a.checked)})})});Yh.displayName=Kh;var Xh=`MenuSeparator`,Zh=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(Cl.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Zh.displayName=Xh;var Qh=`MenuArrow`,$h=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=lh(n);return(0,V.jsx)(km,{...i,...r,ref:t})});$h.displayName=Qh;var eg=`MenuSub`,[tg,ng]=sh(eg),rg=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=fh(eg,t),o=lh(t),[s,c]=B.useState(null),[l,u]=B.useState(null),d=Ul(i);return B.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,V.jsx)(Em,{...o,children:(0,V.jsx)(dh,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,V.jsx)(tg,{scope:t,contentId:Bl(),triggerId:Bl(),trigger:s,onTriggerChange:c,children:n})})})};rg.displayName=eg;var ig=`MenuSubTrigger`,ag=B.forwardRef((e,t)=>{let n=fh(ig,e.__scopeMenu),r=mh(ig,e.__scopeMenu),i=ng(ig,e.__scopeMenu),a=wh(ig,e.__scopeMenu),o=B.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=B.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return B.useEffect(()=>u,[u]),B.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,V.jsx)(_h,{asChild:!0,...l,children:(0,V.jsx)(Lh,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":cg(n.open),...e,ref:hl(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:U(e.onPointerMove,gg(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:U(e.onPointerLeave,gg(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:U(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||th[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});ag.displayName=ig;var og=`MenuSubContent`,sg=B.forwardRef((e,t)=>{let n=bh(Sh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=fh(Sh,e.__scopeMenu),o=mh(Sh,e.__scopeMenu),s=ng(og,e.__scopeMenu),c=B.useRef(null),l=gl(t,c);return(0,V.jsx)(ih.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(Pl,{present:r||a.open,children:(0,V.jsx)(ih.Slot,{scope:e.__scopeMenu,children:(0,V.jsx)(kh,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:U(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:U(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:U(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=nh[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});sg.displayName=og;function cg(e){return e?`open`:`closed`}function lg(e){return e===`indeterminate`}function ug(e){return lg(e)?`indeterminate`:e?`checked`:`unchecked`}function dg(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function fg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function pg(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=fg(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function mg(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function hg(e,t){return t?mg({x:e.clientX,y:e.clientY},t):!1}function gg(e){return t=>t.pointerType===`mouse`?e(t):void 0}var _g=hh,vg=_h,yg=xh,bg=Th,xg=jh,Sg=Nh,Cg=Ih,wg=zh,Tg=Uh,Eg=Gh,Dg=Yh,Og=Zh,kg=$h,Ag=rg,jg=ag,Mg=sg,Ng=`DropdownMenu`,[Pg,Fg]=Tl(Ng,[ch]),Ig=ch(),[Lg,Rg]=Pg(Ng),zg=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Ig(t),l=B.useRef(null),[u,d]=Al({prop:i,defaultProp:a??!1,onChange:o,caller:Ng});return(0,V.jsx)(Lg,{scope:t,triggerId:Bl(),triggerRef:l,contentId:Bl(),open:u,onOpenChange:d,onOpenToggle:B.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,V.jsx)(_g,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};zg.displayName=Ng;var Bg=`DropdownMenuTrigger`,Vg=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Rg(Bg,n),o=Ig(n);return(0,V.jsx)(vg,{asChild:!0,...o,children:(0,V.jsx)(Cl.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:hl(t,a.triggerRef),onPointerDown:U(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:U(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Vg.displayName=Bg;var Hg=`DropdownMenuPortal`,Ug=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Ig(t);return(0,V.jsx)(yg,{...r,...n})};Ug.displayName=Hg;var Wg=`DropdownMenuContent`,Gg=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Rg(Wg,n),a=Ig(n),o=B.useRef(!1);return(0,V.jsx)(bg,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:U(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:U(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Gg.displayName=Wg;var Kg=`DropdownMenuGroup`,qg=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ig(n);return(0,V.jsx)(xg,{...i,...r,ref:t})});qg.displayName=Kg;var Jg=`DropdownMenuLabel`,Yg=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ig(n);return(0,V.jsx)(Sg,{...i,...r,ref:t})});Yg.displayName=Jg;var Xg=`DropdownMenuItem`,Zg=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ig(n);return(0,V.jsx)(Cg,{...i,...r,ref:t})});Zg.displayName=Xg;var Qg=`DropdownMenuCheckboxItem`,$g=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ig(n);return(0,V.jsx)(wg,{...i,...r,ref:t})});$g.displayName=Qg;var e_=`DropdownMenuRadioGroup`,t_=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ig(n);return(0,V.jsx)(Tg,{...i,...r,ref:t})});t_.displayName=e_;var n_=`DropdownMenuRadioItem`,r_=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ig(n);return(0,V.jsx)(Eg,{...i,...r,ref:t})});r_.displayName=n_;var i_=`DropdownMenuItemIndicator`,a_=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ig(n);return(0,V.jsx)(Dg,{...i,...r,ref:t})});a_.displayName=i_;var o_=`DropdownMenuSeparator`,s_=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ig(n);return(0,V.jsx)(Og,{...i,...r,ref:t})});s_.displayName=o_;var c_=`DropdownMenuArrow`,l_=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ig(n);return(0,V.jsx)(kg,{...i,...r,ref:t})});l_.displayName=c_;var u_=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Ig(t),[s,c]=Al({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,V.jsx)(Ag,{...o,open:s,onOpenChange:c,children:n})},d_=`DropdownMenuSubTrigger`,f_=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ig(n);return(0,V.jsx)(jg,{...i,...r,ref:t})});f_.displayName=d_;var p_=`DropdownMenuSubContent`,m_=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ig(n);return(0,V.jsx)(Mg,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});m_.displayName=p_;var h_=zg,g_=Vg,__=Gg,v_=Zg,y_=u_,b_=f_,x_=m_,S_=`Popover`,[C_,w_]=Tl(S_,[um]),T_=um(),[E_,D_]=C_(S_),O_=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=T_(t),c=B.useRef(null),[l,u]=B.useState(!1),[d,f]=Al({prop:r,defaultProp:i??!1,onChange:a,caller:S_});return(0,V.jsx)(Em,{...s,children:(0,V.jsx)(E_,{scope:t,contentId:Bl(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:B.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:B.useCallback(()=>u(!0),[]),onCustomAnchorRemove:B.useCallback(()=>u(!1),[]),modal:o,children:n})})};O_.displayName=S_;var k_=`PopoverAnchor`,A_=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=D_(k_,n),a=T_(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return B.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(Dm,{...a,...r,ref:t})});A_.displayName=k_;var j_=`PopoverTrigger`,M_=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=D_(j_,n),a=T_(n),o=gl(t,i.triggerRef),s=(0,V.jsx)(Cl.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":q_(i.open),...r,ref:o,onClick:U(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(Dm,{asChild:!0,...a,children:s})});M_.displayName=j_;var N_=`PopoverPortal`,[P_,F_]=C_(N_,{forceMount:void 0}),I_=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=D_(N_,t);return(0,V.jsx)(P_,{scope:t,forceMount:n,children:(0,V.jsx)(Pl,{present:n||a.open,children:(0,V.jsx)(xu,{asChild:!0,container:i,children:r})})})};I_.displayName=N_;var L_=`PopoverContent`,R_=B.forwardRef((e,t)=>{let n=F_(L_,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=D_(L_,e.__scopePopover);return(0,V.jsx)(Pl,{present:r||a.open,children:a.modal?(0,V.jsx)(B_,{...i,ref:t}):(0,V.jsx)(V_,{...i,ref:t})})});R_.displayName=L_;var z_=_l(`PopoverContent.RemoveScroll`),B_=B.forwardRef((e,t)=>{let n=D_(L_,e.__scopePopover),r=B.useRef(null),i=gl(t,r),a=B.useRef(!1);return B.useEffect(()=>{let e=r.current;if(e)return Hd(e)},[]),(0,V.jsx)(Nd,{as:z_,allowPinchZoom:!0,children:(0,V.jsx)(H_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:U(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:U(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:U(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),V_=B.forwardRef((e,t)=>{let n=D_(L_,e.__scopePopover),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(H_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),H_=B.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=D_(L_,n),p=T_(n);return Cu(),(0,V.jsx)(cu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(Zl,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,V.jsx)(Om,{"data-state":q_(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),U_=`PopoverClose`,W_=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=D_(U_,n);return(0,V.jsx)(Cl.button,{type:`button`,...r,ref:t,onClick:U(e.onClick,()=>i.onOpenChange(!1))})});W_.displayName=U_;var G_=`PopoverArrow`,K_=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=T_(n);return(0,V.jsx)(km,{...i,...r,ref:t})});K_.displayName=G_;function q_(e){return e?`open`:`closed`}var J_=O_,Y_=M_,X_=I_,Z_=R_,Q_=K_,$_=`Tabs`,[ev,tv]=Tl($_,[Lm]),nv=Lm(),[rv,iv]=ev($_),av=B.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Hl(s),[d,f]=Al({prop:r,onChange:i,defaultProp:a??``,caller:$_});return(0,V.jsx)(rv,{scope:n,baseId:Bl(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,V.jsx)(Cl.div,{dir:u,"data-orientation":o,...l,ref:t})})});av.displayName=$_;var ov=`TabsList`,sv=B.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=iv(ov,n),o=nv(n);return(0,V.jsx)(Ym,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,V.jsx)(Cl.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});sv.displayName=ov;var cv=`TabsTrigger`,lv=B.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=iv(cv,n),s=nv(n),c=fv(o.baseId,r),l=pv(o.baseId,r),u=r===o.value;return(0,V.jsx)(Xm,{asChild:!0,...s,focusable:!i,active:u,children:(0,V.jsx)(Cl.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:U(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:U(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:U(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});lv.displayName=cv;var uv=`TabsContent`,dv=B.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=iv(uv,n),c=fv(s.baseId,r),l=pv(s.baseId,r),u=r===s.value,d=B.useRef(u);return B.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,V.jsx)(Pl,{present:i||u,children:({present:n})=>(0,V.jsx)(Cl.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});dv.displayName=uv;function fv(e,t){return`${e}-trigger-${t}`}function pv(e,t){return`${e}-content-${t}`}var mv=av,hv=sv,gv=lv,_v=dv,vv=e(t(((e,t)=>{(function(){var n=this,r={};e===void 0?n.fuzzy=r:t.exports=r,r.simpleFilter=function(e,t){return t.filter(function(t){return r.test(e,t)})},r.test=function(e,t){return r.match(e,t)!==null},r.match=function(e,t,n){n||={};var r=0,i=[],a=t.length,o=0,s=0,c=n.pre||``,l=n.post||``,u=n.caseSensitive&&t||t.toLowerCase(),d;e=n.caseSensitive&&e||e.toLowerCase();for(var f=0;f<a;f++)d=t[f],u[f]===e[r]?(d=c+d+l,r+=1,s+=1+s):s=0,o+=s,i[i.length]=d;return r===e.length?(o=u===e?1/0:o,{rendered:i.join(``),score:o}):null},r.filter=function(e,t,n){return!t||t.length===0?[]:typeof e==`string`?(n||={},t.reduce(function(t,i,a,o){var s=i;n.extract&&(s=n.extract(i));var c=r.match(e,s,n);return c!=null&&(t[t.length]={string:c.rendered,score:c.score,index:a,original:i}),t},[]).sort(function(e,t){return t.score-e.score||e.index-t.index})):t}})()}))(),1);function yv(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2}function bv(e,t,n){let r=yv(t,n);if(r===0)return yv(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)),yv(e,xv(t,n,i))}function xv(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function Sv(e,t){return Cv(e,0,e.length,t)}function Cv(e,t,n,r,i){let a=i||[],o=e[t],s=e[n-1],c=0,l=1;for(let r=t+1;r<n-1;++r){let t=bv(e[r],o,s);t>c&&(c=t,l=r)}return Math.sqrt(c)>r?(Cv(e,t,l+1,r,a),Cv(e,l,n,r,a)):(a.length||a.push(o),a.push(s)),a}function wv(e,t,n,r=e=>e){return e*r(.5-t*(.5-n))}function Tv(e){return[-e[0],-e[1]]}function Ev(e,t){return[e[0]+t[0],e[1]+t[1]]}function Dv(e,t){return[e[0]-t[0],e[1]-t[1]]}function Ov(e,t){return[e[0]*t,e[1]*t]}function kv(e,t){return[e[0]/t,e[1]/t]}function Av(e){return[e[1],-e[0]]}function jv(e,t){return e[0]*t[0]+e[1]*t[1]}function Mv(e,t){return e[0]===t[0]&&e[1]===t[1]}function Nv(e){return Math.hypot(e[0],e[1])}function Pv(e){return e[0]*e[0]+e[1]*e[1]}function Fv(e,t){return Pv(Dv(e,t))}function Iv(e){return kv(e,Nv(e))}function Lv(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function Rv(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,c=a*r+o*i;return[s+t[0],c+t[1]]}function zv(e,t,n){return Ev(e,Ov(Dv(t,e),n))}function Bv(e,t,n){return Ev(e,Ov(t,n))}var{min:Vv,PI:Hv}=Math,Uv=.275,Wv=Hv+1e-4;function Gv(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=e=>e,start:s={},end:c={},last:l=!1}=t,{cap:u=!0,easing:d=e=>e*(2-e)}=s,{cap:f=!0,easing:p=e=>--e*e*e+1}=c;if(e.length===0||n<=0)return[];let m=e[e.length-1].runningLength,h=s.taper===!1?0:s.taper===!0?Math.max(n,m):s.taper,g=c.taper===!1?0:c.taper===!0?Math.max(n,m):c.taper,_=(n*r)**2,v=[],y=[],b=e.slice(0,10).reduce((e,t)=>{let r=t.pressure;if(a){let i=Vv(1,t.distance/n);r=Vv(1,e+(Vv(1,1-i)-e)*(i*Uv))}return(e+r)/2},e[0].pressure),x=wv(n,i,e[e.length-1].pressure,o),S,C=e[0].vector,w=e[0].point,T=w,E=w,D=T,O=!1;for(let t=0;t<e.length;t++){let{pressure:r}=e[t],{point:s,vector:c,distance:l,runningLength:u}=e[t];if(t<e.length-1&&m-u<3)continue;if(i){if(a){let e=Vv(1,l/n),t=Vv(1,1-e);r=Vv(1,b+(t-b)*(e*Uv))}x=wv(n,i,r,o)}else x=n/2;S===void 0&&(S=x);let f=u<h?d(u/h):1,ee=m-u<g?p((m-u)/g):1;x=Math.max(.01,x*Math.min(f,ee));let k=(t<e.length-1?e[t+1]:e[t]).vector,A=t<e.length-1?jv(c,k):1,te=jv(c,C)<0&&!O,ne=A!==null&&A<0;if(te||ne){let e=Ov(Av(C),x);for(let t=0;t<=1;t+=.07692307692307693)E=Rv(Dv(s,e),s,Wv*t),v.push(E),D=Rv(Ev(s,e),s,Wv*-t),y.push(D);w=E,T=D,ne&&(O=!0);continue}if(O=!1,t===e.length-1){let e=Ov(Av(c),x);v.push(Dv(s,e)),y.push(Ev(s,e));continue}let re=Ov(Av(zv(k,c,A)),x);E=Dv(s,re),(t<=1||Fv(w,E)>_)&&(v.push(E),w=E),D=Ev(s,re),(t<=1||Fv(T,D)>_)&&(y.push(D),T=D),b=r,C=c}let ee=e[0].point.slice(0,2),k=e.length>1?e[e.length-1].point.slice(0,2):Ev(e[0].point,[1,1]),A=[],te=[];if(e.length===1){if(!(h||g)||l){let e=Bv(ee,Iv(Av(Dv(ee,k))),-(S||x)),t=[];for(let n=1/13,r=n;r<=1;r+=n)t.push(Rv(e,ee,Wv*2*r));return t}}else{if(!(h||g&&e.length===1))if(u)for(let e=1/13,t=e;t<=1;t+=e){let e=Rv(y[0],ee,Wv*t);A.push(e)}else{let e=Dv(v[0],y[0]),t=Ov(e,.5),n=Ov(e,.51);A.push(Dv(ee,t),Dv(ee,n),Ev(ee,n),Ev(ee,t))}let t=Av(Tv(e[e.length-1].vector));if(g||h&&e.length===1)te.push(k);else if(f){let e=Bv(k,t,x);for(let t=1/29,n=t;n<1;n+=t)te.push(Rv(e,k,Wv*3*n))}else te.push(Ev(k,Ov(t,x)),Ev(k,Ov(t,x*.99)),Dv(k,Ov(t,x*.99)),Dv(k,Ov(t,x)))}return v.concat(te,y.reverse(),A)}function Kv(e,t={}){let{streamline:n=.5,size:r=16,last:i=!1}=t;if(e.length===0)return[];let a=.15+(1-n)*.85,o=Array.isArray(e[0])?e:e.map(({x:e,y:t,pressure:n=.5})=>[e,t,n]);if(o.length===2){let e=o[1];o=o.slice(0,-1);for(let t=1;t<5;t++)o.push(zv(o[0],e,t/4))}o.length===1&&(o=[...o,[...Ev(o[0],[1,1]),...o[0].slice(2)]]);let s=[{point:[o[0][0],o[0][1]],pressure:o[0][2]>=0?o[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],c=!1,l=0,u=s[0],d=o.length-1;for(let e=1;e<o.length;e++){let t=i&&e===d?o[e].slice(0,2):zv(u.point,o[e],a);if(Mv(u.point,t))continue;let n=Lv(t,u.point);if(l+=n,e<d&&!c){if(l<r)continue;c=!0}u={point:t,pressure:o[e][2]>=0?o[e][2]:.5,vector:Iv(Dv(u.point,t)),distance:n,runningLength:l},s.push(u)}return s[0].vector=s[1]?.vector||[0,0],s}function qv(e,t={}){return Gv(Kv(e,t),t)}var Jv=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},Yv=e=>e?Jv(e):Jv,Xv=t((e=>{var t=_c(),n=Wd();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Zv=e(t(((e,t)=>{t.exports=Xv()}))(),1),{useDebugValue:Qv}=B.default,{useSyncExternalStoreWithSelector:$v}=Zv.default,ey=e=>e;function ty(e,t=ey,n){let r=$v(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Qv(r),r}var ny=e=>{let t=typeof e==`function`?Yv(e):e,n=(e,n)=>ty(t,e,n);return Object.assign(n,t),n},ry=e=>e?ny(e):ny,iy,ay=typeof window<`u`&&((iy=window.document)!=null&&iy.createElement||window.navigator?.product===`ReactNative`)?B.useLayoutEffect:B.useEffect;function oy(){let e=ry(e=>({current:[],version:0,set:e}));return{In:({children:t})=>{let n=e(e=>e.set),r=e(e=>e.version);return ay(()=>{n(e=>({version:e.version+1}))},[]),ay(()=>(n(({current:e})=>({current:[...e,t]})),()=>n(({current:e})=>({current:e.filter(e=>e!==t)}))),[t,r]),null},Out:()=>{let t=e(e=>e.current);return B.createElement(B.Fragment,null,t)}}}var sy=e(t(((e,t)=>{var n=NaN,r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,c=typeof global==`object`&&global&&global.Object===Object&&global,l=typeof self==`object`&&self&&self.Object===Object&&self,u=c||l||Function(`return this`)(),d=Object.prototype.toString,f=Math.max,p=Math.min,m=function(){return u.Date.now()};function h(e,t,n){var r,i,a,o,s,c,l=0,u=!1,d=!1,h=!0;if(typeof e!=`function`)throw TypeError(`Expected a function`);t=y(t)||0,g(n)&&(u=!!n.leading,d=`maxWait`in n,a=d?f(y(n.maxWait)||0,t):a,h=`trailing`in n?!!n.trailing:h);function _(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function v(e){return l=e,s=setTimeout(S,t),u?_(e):o}function b(e){var n=e-c,r=e-l,i=t-n;return d?p(i,a-r):i}function x(e){var n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function S(){var e=m();if(x(e))return C(e);s=setTimeout(S,b(e))}function C(e){return s=void 0,h&&r?_(e):(r=i=void 0,o)}function w(){s!==void 0&&clearTimeout(s),l=0,r=c=i=s=void 0}function T(){return s===void 0?o:C(m())}function E(){var e=m(),n=x(e);if(r=arguments,i=this,c=e,n){if(s===void 0)return v(c);if(d)return s=setTimeout(S,t),_(c)}return s===void 0&&(s=setTimeout(S,t)),o}return E.cancel=w,E.flush=T,E}function g(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function _(e){return!!e&&typeof e==`object`}function v(e){return typeof e==`symbol`||_(e)&&d.call(e)==`[object Symbol]`}function y(e){if(typeof e==`number`)return e;if(v(e))return n;if(g(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=g(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(r,``);var c=a.test(e);return c||o.test(e)?s(e.slice(2),c?2:8):i.test(e)?n:+e}t.exports=h}))(),1),cy=dl(),{useAtom:W,useSetAtom:ly,useAtomValue:uy,useStore:dy}=cy,fy=cy.Provider,py=Jc(),my=hc({"./locales/ar-SA.json":()=>n(()=>import(`./ar-SA-YLAB6A27-B9ogj_Jh.js`),__vite__mapDeps([0,1,2]),import.meta.url),"./locales/az-AZ.json":()=>n(()=>import(`./az-AZ-5JXPK2I2-C6Se5-4R.js`),__vite__mapDeps([3,1,2]),import.meta.url),"./locales/bg-BG.json":()=>n(()=>import(`./bg-BG-NIQ2RVNG-xrf33IaO.js`),__vite__mapDeps([4,1,2]),import.meta.url),"./locales/bn-BD.json":()=>n(()=>import(`./bn-BD-BN65R3DE-YVZWNN-c.js`),__vite__mapDeps([5,1,2]),import.meta.url),"./locales/bn-IN.json":()=>n(()=>import(`./bn-IN-2YT4KVKB-YVZWNN-c.js`),__vite__mapDeps([6,1,2]),import.meta.url),"./locales/ca-ES.json":()=>n(()=>import(`./ca-ES-KSERGC3M-CoMtV4dM.js`),__vite__mapDeps([7,1,2]),import.meta.url),"./locales/cs-CZ.json":()=>n(()=>import(`./cs-CZ-EOMS3IHD-Bo0hDCLX.js`),__vite__mapDeps([8,1,2]),import.meta.url),"./locales/da-DK.json":()=>n(()=>import(`./da-DK-AVL3DJQK-s5-TpkxN.js`),__vite__mapDeps([9,1,2]),import.meta.url),"./locales/de-CH.json":()=>n(()=>import(`./de-CH-M25HCZK4-B0r4rx6B.js`),__vite__mapDeps([10,1,2]),import.meta.url),"./locales/de-DE.json":()=>n(()=>import(`./de-DE-BEN6XGXY-B0r4rx6B.js`),__vite__mapDeps([11,1,2]),import.meta.url),"./locales/el-GR.json":()=>n(()=>import(`./el-GR-UBGIF2NW-DRoYAN8w.js`),__vite__mapDeps([12,1,2]),import.meta.url),"./locales/en.json":()=>n(()=>import(`./en-PCJ7LJZ2-1SKiH5y3.js`),__vite__mapDeps([13,1,2,14]),import.meta.url),"./locales/es-ES.json":()=>n(()=>import(`./es-ES-SQEM5MNY-D5EtY06q.js`),__vite__mapDeps([15,1,2]),import.meta.url),"./locales/eu-ES.json":()=>n(()=>import(`./eu-ES-YG5N2JAG-CZ0xKIU4.js`),__vite__mapDeps([16,1,2]),import.meta.url),"./locales/fa-IR.json":()=>n(()=>import(`./fa-IR-EVNM7MAJ-olht-LEH.js`),__vite__mapDeps([17,1,2]),import.meta.url),"./locales/fi-FI.json":()=>n(()=>import(`./fi-FI-MW7ZEZ64-D1PIXbLy.js`),__vite__mapDeps([18,1,2]),import.meta.url),"./locales/fr-FR.json":()=>n(()=>import(`./fr-FR-Q7ZPXBDE-B0DjjyfT.js`),__vite__mapDeps([19,1,2]),import.meta.url),"./locales/gl-ES.json":()=>n(()=>import(`./gl-ES-O5B74VQL-DH5u_ADp.js`),__vite__mapDeps([20,1,2]),import.meta.url),"./locales/he-IL.json":()=>n(()=>import(`./he-IL-QGC2WXJA-BSBR1RcG.js`),__vite__mapDeps([21,1,2]),import.meta.url),"./locales/hi-IN.json":()=>n(()=>import(`./hi-IN-DEZ33NMQ-CorD0_d0.js`),__vite__mapDeps([22,1,2]),import.meta.url),"./locales/hu-HU.json":()=>n(()=>import(`./hu-HU-2ZPNVYSC-BlqNXhNG.js`),__vite__mapDeps([23,1,2]),import.meta.url),"./locales/id-ID.json":()=>n(()=>import(`./id-ID-W65WM5EO-SkLgeJLx.js`),__vite__mapDeps([24,1,2]),import.meta.url),"./locales/it-IT.json":()=>n(()=>import(`./it-IT-GAWJM2XW-CDZugsE0.js`),__vite__mapDeps([25,1,2]),import.meta.url),"./locales/ja-JP.json":()=>n(()=>import(`./ja-JP-FOAUPTH5-DkKXnwj8.js`),__vite__mapDeps([26,1,2]),import.meta.url),"./locales/kaa.json":()=>n(()=>import(`./kaa-UEDB54S7-C0Sv0drM.js`),__vite__mapDeps([27,1,2]),import.meta.url),"./locales/kab-KAB.json":()=>n(()=>import(`./kab-KAB-CTLMBVE3-QfxUgzL5.js`),__vite__mapDeps([28,1,2]),import.meta.url),"./locales/kk-KZ.json":()=>n(()=>import(`./kk-KZ-XZK63ADD-CMZObxxP.js`),__vite__mapDeps([29,1,2]),import.meta.url),"./locales/km-KH.json":()=>n(()=>import(`./km-KH-PBSJLZ2M-Bh1DsarT.js`),__vite__mapDeps([30,1,2]),import.meta.url),"./locales/ko-KR.json":()=>n(()=>import(`./ko-KR-YNTPN6WQ-DPBaHnwT.js`),__vite__mapDeps([31,1,2]),import.meta.url),"./locales/ku-TR.json":()=>n(()=>import(`./ku-TR-XUD5BUEU-75pMUQoD.js`),__vite__mapDeps([32,1,2]),import.meta.url),"./locales/lt-LT.json":()=>n(()=>import(`./lt-LT-LYCDYH7O-BeKUsKuy.js`),__vite__mapDeps([33,1,2]),import.meta.url),"./locales/lv-LV.json":()=>n(()=>import(`./lv-LV-7ROPDEEI-CrA6QOtq.js`),__vite__mapDeps([34,1,2]),import.meta.url),"./locales/mr-IN.json":()=>n(()=>import(`./mr-IN-TU6BXRKP-mIvXG0bt.js`),__vite__mapDeps([35,1,2]),import.meta.url),"./locales/my-MM.json":()=>n(()=>import(`./my-MM-SJ3RWIEQ-CeEN5n4z.js`),__vite__mapDeps([36,1,2]),import.meta.url),"./locales/nb-NO.json":()=>n(()=>import(`./nb-NO-GONF2AKR-IChp6OiI.js`),__vite__mapDeps([37,1,2]),import.meta.url),"./locales/nl-NL.json":()=>n(()=>import(`./nl-NL-UZF6UEKB-DfPPXXjo.js`),__vite__mapDeps([38,1,2]),import.meta.url),"./locales/nn-NO.json":()=>n(()=>import(`./nn-NO-ZVFRXEEO-BtpjNSGp.js`),__vite__mapDeps([39,1,2]),import.meta.url),"./locales/oc-FR.json":()=>n(()=>import(`./oc-FR-MBF2Z56W-CBl14QBM.js`),__vite__mapDeps([40,1,2]),import.meta.url),"./locales/pa-IN.json":()=>n(()=>import(`./pa-IN-3JCDVKKL-D95A1XFb.js`),__vite__mapDeps([41,1,2]),import.meta.url),"./locales/percentages.json":()=>n(()=>import(`./percentages-WBIPKLEE-bhlTAhiB.js`),__vite__mapDeps([42,1,2,43]),import.meta.url),"./locales/pl-PL.json":()=>n(()=>import(`./pl-PL-EERMMCTN-dIzrbxJt.js`),__vite__mapDeps([44,1,2]),import.meta.url),"./locales/pt-BR.json":()=>n(()=>import(`./pt-BR-W4AF5QMX-DIJs8D4M.js`),__vite__mapDeps([45,1,2]),import.meta.url),"./locales/pt-PT.json":()=>n(()=>import(`./pt-PT-GNPUWAHX-BopN284Y.js`),__vite__mapDeps([46,1,2]),import.meta.url),"./locales/ro-RO.json":()=>n(()=>import(`./ro-RO-DXHP33S5-PGxfl-ng.js`),__vite__mapDeps([47,1,2]),import.meta.url),"./locales/ru-RU.json":()=>n(()=>import(`./ru-RU-TTW2P7NF-Dwnn0sc5.js`),__vite__mapDeps([48,1,2]),import.meta.url),"./locales/si-LK.json":()=>n(()=>import(`./si-LK-BE6O7LVF-QO9nybVB.js`),__vite__mapDeps([49,1,2]),import.meta.url),"./locales/sk-SK.json":()=>n(()=>import(`./sk-SK-OI3KJLWQ-BAKIEIig.js`),__vite__mapDeps([50,1,2]),import.meta.url),"./locales/sl-SI.json":()=>n(()=>import(`./sl-SI-HF74RBGV-CnS5z7V_.js`),__vite__mapDeps([51,1,2]),import.meta.url),"./locales/sv-SE.json":()=>n(()=>import(`./sv-SE-TXR2SQGA-CNgv7xeJ.js`),__vite__mapDeps([52,1,2]),import.meta.url),"./locales/ta-IN.json":()=>n(()=>import(`./ta-IN-Y2DOZGBR-DYzsfax7.js`),__vite__mapDeps([53,1,2]),import.meta.url),"./locales/th-TH.json":()=>n(()=>import(`./th-TH-JUAISFQR-BAZHUCM7.js`),__vite__mapDeps([54,1,2]),import.meta.url),"./locales/tr-TR.json":()=>n(()=>import(`./tr-TR-U3HGKQXH-DTYupb_4.js`),__vite__mapDeps([55,1,2]),import.meta.url),"./locales/uk-UA.json":()=>n(()=>import(`./uk-UA-FP2TKAFK-Bcxd6wgd.js`),__vite__mapDeps([56,1,2]),import.meta.url),"./locales/uz-UZ.json":()=>n(()=>import(`./uz-UZ-WY5QKWXJ-B5N6xPud.js`),__vite__mapDeps([57,1,2]),import.meta.url),"./locales/vi-VN.json":()=>n(()=>import(`./vi-VN-DE5I4H6K-BdlcTH5l.js`),__vite__mapDeps([58,1,2]),import.meta.url),"./locales/zh-CN.json":()=>n(()=>import(`./zh-CN-VWHOHS7G-b12eD2L4.js`),__vite__mapDeps([59,1,2]),import.meta.url),"./locales/zh-HK.json":()=>n(()=>import(`./zh-HK-KQF7FW7H-Bvr6xExo.js`),__vite__mapDeps([60,1,2]),import.meta.url),"./locales/zh-TW.json":()=>n(()=>import(`./zh-TW-6VHVWZKW-B-KCOPyt.js`),__vite__mapDeps([61,1,2]),import.meta.url)}),hy=85,gy={code:`en`,label:`English`},_y=[gy,...[{code:`ar-SA`,label:`العربية`,rtl:!0},{code:`bg-BG`,label:`Български`},{code:`ca-ES`,label:`Català`},{code:`cs-CZ`,label:`Česky`},{code:`de-DE`,label:`Deutsch`},{code:`el-GR`,label:`Ελληνικά`},{code:`es-ES`,label:`Español`},{code:`eu-ES`,label:`Euskara`},{code:`fa-IR`,label:`فارسی`,rtl:!0},{code:`fi-FI`,label:`Suomi`},{code:`fr-FR`,label:`Français`},{code:`gl-ES`,label:`Galego`},{code:`he-IL`,label:`עברית`,rtl:!0},{code:`hi-IN`,label:`हिन्दी`},{code:`hu-HU`,label:`Magyar`},{code:`id-ID`,label:`Bahasa Indonesia`},{code:`it-IT`,label:`Italiano`},{code:`ja-JP`,label:`日本語`},{code:`kab-KAB`,label:`Taqbaylit`},{code:`kk-KZ`,label:`Қазақ тілі`},{code:`ko-KR`,label:`한국어`},{code:`ku-TR`,label:`Kurdî`},{code:`lt-LT`,label:`Lietuvių`},{code:`lv-LV`,label:`Latviešu`},{code:`my-MM`,label:`Burmese`},{code:`nb-NO`,label:`Norsk bokmål`},{code:`nl-NL`,label:`Nederlands`},{code:`nn-NO`,label:`Norsk nynorsk`},{code:`oc-FR`,label:`Occitan`},{code:`pa-IN`,label:`ਪੰਜਾਬੀ`},{code:`pl-PL`,label:`Polski`},{code:`pt-BR`,label:`Português Brasileiro`},{code:`pt-PT`,label:`Português`},{code:`ro-RO`,label:`Română`},{code:`ru-RU`,label:`Русский`},{code:`sk-SK`,label:`Slovenčina`},{code:`sv-SE`,label:`Svenska`},{code:`sl-SI`,label:`Slovenščina`},{code:`tr-TR`,label:`Türkçe`},{code:`uk-UA`,label:`Українська`},{code:`zh-CN`,label:`简体中文`},{code:`zh-TW`,label:`繁體中文`},{code:`vi-VN`,label:`Tiếng Việt`},{code:`mr-IN`,label:`मराठी`}].filter(e=>bc[e.code]>=hy).sort((e,t)=>e.label>t.label?1:-1)],vy=`__test__`;Ms()&&_y.unshift({code:vy,label:`test language`},{code:`${vy}.rtl`,label:`‪test language (rtl)‬`,rtl:!0});var yy=gy,by={},xy=async e=>{if(yy=e,document.documentElement.dir=yy.rtl?`rtl`:`ltr`,document.documentElement.lang=yy.code,e.code.startsWith(vy))by={};else try{by=await my(`./locales/${yy.code}.json`)}catch(t){console.error(`Failed to load language ${e.code}:`,t.message),by=yc}py.set(wy,e.code)},Sy=()=>yy,Cy=(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},G=(e,t,n)=>{if(yy.code.startsWith(vy))return`\u202A[[${t?`${e}(${JSON.stringify(t).slice(1,-1)})`:e}]]\u202C`;let r=e.split(`.`),i=Cy(by,r)||Cy(yc,r)||n;if(i===void 0){let t=`Can't find translation for ${e}`;if(ds.PROD)return console.warn(t),``;throw Error(t)}if(t)for(let e in t)i=i.replace(`{{${e}}}`,String(t[e]));return i},wy=Ec(gy.code),Ty=()=>({t:G,langCode:uy(wy)}),Ey=e=>`var(--icon-fill-color)`,Dy=e=>e===F.LIGHT?`#fff`:`#1e1e1e`,K=(e,t=512)=>{let{width:n=512,height:r=n,mirror:i,style:a,...o}=typeof t==`number`?{width:t}:t;return(0,V.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,role:`img`,viewBox:`0 0 ${n} ${r}`,className:H({"rtl-mirror":i}),style:a,...o,children:typeof e==`string`?(0,V.jsx)(`path`,{fill:`currentColor`,d:e}):e})},q={width:24,height:24,fill:`none`,strokeWidth:2,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`},J={width:20,height:20,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`},Oy={width:40,height:20};K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`rect`,{x:3,y:8,width:18,height:4,rx:1}),(0,V.jsx)(`line`,{x1:12,y1:8,x2:12,y2:21}),(0,V.jsx)(`path`,{d:`M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7`}),(0,V.jsx)(`path`,{d:`M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5`})]}),q);var ky=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0`}),(0,V.jsx)(`path`,{d:`M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0`}),(0,V.jsx)(`line`,{x1:`3`,y1:`6`,x2:`3`,y2:`19`}),(0,V.jsx)(`line`,{x1:`12`,y1:`6`,x2:`12`,y2:`19`}),(0,V.jsx)(`line`,{x1:`21`,y1:`6`,x2:`21`,y2:`19`})]}),q),Ay=K((0,V.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,V.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),q),jy=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,V.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1`}),(0,V.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1`})]}),q),My=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,V.jsx)(`path`,{d:`M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,V.jsx)(`path`,{d:`M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`})]}),q),Ny=K((0,V.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M9 4v6l-2 4v2h10v-2l-2 -4v-6`}),(0,V.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`21`}),(0,V.jsx)(`line`,{x1:`8`,y1:`4`,x2:`16`,y2:`4`})]}),q),Py=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M6.5 9.5l3.5 -3`}),(0,V.jsx)(`path`,{d:`M14 5.5l3 1.5`}),(0,V.jsx)(`path`,{d:`M18.5 10l-2.5 7`}),(0,V.jsx)(`path`,{d:`M13.5 17.5l-7 -5`})]}),q),Fy=K((0,V.jsxs)(`g`,{children:[(0,V.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,V.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,V.jsx)(`mask`,{id:`UnlockedIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:6,y:1,width:9,height:9,children:(0,V.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,V.jsx)(`g`,{mask:`url(#UnlockedIcon)`,children:(0,V.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`})})]}),J),Iy=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.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,V.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,V.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`})]}),J),Ly=K((0,V.jsx)(`g`,{fill:`currentColor`,children:(0,V.jsx)(`path`,{d:`M12 2a5 5 0 0 1 5 5v3a3 3 0 0 1 3 3v6a3 3 0 0 1 -3 3h-10a3 3 0 0 1 -3 -3v-6a3 3 0 0 1 3 -3v-3a5 5 0 0 1 5 -5m0 12a2 2 0 0 0 -1.995 1.85l-.005 .15a2 2 0 1 0 2 -2m0 -10a3 3 0 0 0 -3 3v3h6v-3a3 3 0 0 0 -3 -3`})}),{width:24,height:24}),Ry=K((0,V.jsxs)(V.Fragment,{children:[(0,V.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,V.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z`,fill:`currentColor`}),(0,V.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`}),zy=K((0,V.jsxs)(V.Fragment,{children:[(0,V.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,V.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,V.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`}),By=K((0,V.jsxs)(V.Fragment,{children:[(0,V.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,V.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,V.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`});K((0,V.jsx)(`g`,{fill:`currentColor`,children:(0,V.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`});var Vy=K((0,V.jsxs)(`g`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.jsx)(`path`,{d:`M13.5 13.5l4.5 4.5`})]}),{fill:`none`,width:22,height:22,strokeWidth:1.25}),Hy=K((0,V.jsxs)(`g`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.5,children:[(0,V.jsx)(`path`,{d:`M4.028 13.252c-.657 -.972 -1.028 -2.078 -1.028 -3.252c0 -3.866 4.03 -7 9 -7s9 3.134 9 7s-4.03 7 -9 7c-1.913 0 -3.686 -.464 -5.144 -1.255`}),(0,V.jsx)(`path`,{d:`M5 15m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M5 17c0 1.42 .316 2.805 1 4`})]}),{fill:`none`,width:22,height:22,strokeWidth:1.25}),Uy=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})]}),q),Wy=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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`})]}),q),Gy=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})]}),q),Ky=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,V.jsx)(`line`,{x1:`15`,y1:`16`,x2:`19`,y2:`12`}),(0,V.jsx)(`line`,{x1:`15`,y1:`8`,x2:`19`,y2:`12`})]}),q),qy=K((0,V.jsx)(`path`,{d:`M4.167 10h11.666`,strokeWidth:`1.5`}),J),Jy=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z`}),(0,V.jsx)(`path`,{d:`M16 7h4`}),(0,V.jsx)(`path`,{d:`M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3`})]}),q),Yy=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.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,V.jsx)(`path`,{d:`m11.25 5.417 3.333 3.333`})]}),J),Xy=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`line`,{x1:`4`,y1:`20`,x2:`7`,y2:`20`}),(0,V.jsx)(`line`,{x1:`14`,y1:`20`,x2:`21`,y2:`20`}),(0,V.jsx)(`line`,{x1:`6.9`,y1:`15`,x2:`13.8`,y2:`15`}),(0,V.jsx)(`line`,{x1:`10.2`,y1:`6.3`,x2:`16`,y2:`20`}),(0,V.jsx)(`polyline`,{points:`5 20 11 4 13 4 20 20`})]}),q),Zy=K((0,V.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M3 7v-2h13v2`}),(0,V.jsx)(`path`,{d:`M10 5v14`}),(0,V.jsx)(`path`,{d:`M12 19h-4`}),(0,V.jsx)(`path`,{d:`M15 13v-1h6v1`}),(0,V.jsx)(`path`,{d:`M18 12v7`}),(0,V.jsx)(`path`,{d:`M17 19h2`})]}),q),Qy=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{d:`M12.5 6.667h.01`}),(0,V.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,V.jsx)(`path`,{d:`m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166`}),(0,V.jsx)(`path`,{d:`m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667`})]}),J),$y=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.jsx)(`path`,{d:`M18 13.3l-6.3 -6.3`})]}),q),eb=K((0,V.jsx)(`path`,{strokeWidth:`1.25`,d:`M10 4.167v11.666M4.167 10h11.666`}),J),tb=K((0,V.jsx)(`path`,{d:`M5 10h10`,strokeWidth:`1.25`}),J),nb=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M21 21l-6 -6`}),(0,V.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,V.jsx)(`path`,{d:`M3 4v4h4`})]}),q),rb=K((0,V.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`}),J),ib=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`polyline`,{points:`12 16 18 10 12 4`}),(0,V.jsx)(`polyline`,{points:`8 4 2 10 8 16`})]}),J),ab=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.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,V.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`})]}),J),ob=K((0,V.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`}),J),sb=K((0,V.jsx)(`g`,{stroke:`currentColor`,strokeLinejoin:`round`,children:(0,V.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`})}),{...J,strokeWidth:1.5}),cb=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`line`,{x1:`4`,y1:`6`,x2:`20`,y2:`6`}),(0,V.jsx)(`line`,{x1:`4`,y1:`12`,x2:`20`,y2:`12`}),(0,V.jsx)(`line`,{x1:`4`,y1:`18`,x2:`20`,y2:`18`})]}),q),lb=K((0,V.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`}),J),ub=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,V.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12`,y2:`17.01`}),(0,V.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),q),db=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,V.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12`,y2:`17.01`}),(0,V.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),q),fb=K((0,V.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`}),J),pb=K((0,V.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`}),J),mb=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.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,V.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`})]}),J),hb=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M4 4l11.733 16h4.267l-11.733 -16z`}),(0,V.jsx)(`path`,{d:`M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772`})]}),q),gb=K((0,V.jsx)(`polyline`,{fill:`none`,stroke:`currentColor`,points:`20 6 9 17 4 12`}),{width:24,height:24}),_b=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.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,V.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`})]}),J),vb=K(`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}),yb=K(`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}),bb=K((0,V.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`}),J);K(`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}),K(`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`);var xb=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z`}),(0,V.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,V.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`})]}),q),Sb=K((0,V.jsx)(`g`,{strokeWidth:1.5,children:(0,V.jsx)(`path`,{d:`M6 18l12 -12`})}),q),Cb=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M15 8h.01`}),(0,V.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,V.jsx)(`path`,{d:`M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4`}),(0,V.jsx)(`path`,{d:`M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598`}),(0,V.jsx)(`path`,{d:`M19 16v6`}),(0,V.jsx)(`path`,{d:`M22 19l-3 3l-3 -3`})]}),q),wb=K(`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});K(`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}),K(`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});var Tb=K(`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`);K(`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`);var Eb=K((0,V.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`}),J),Db=K((0,V.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`}),J),Ob=K(`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}),kb=K((0,V.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`}),J);K(`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`),K(`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}),K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.jsx)(`path`,{d:`M12 14v-11`}),(0,V.jsx)(`path`,{d:`M9 6l3 -3l3 3`})]}),q),K((0,V.jsxs)(V.Fragment,{children:[(0,V.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,V.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}),K((0,V.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});var Ab=(0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M12 10l0 10`}),(0,V.jsx)(`path`,{d:`M12 10l4 4`}),(0,V.jsx)(`path`,{d:`M12 10l-4 4`}),(0,V.jsx)(`path`,{d:`M4 4l16 0`})]}),jb=(0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M12 5l0 14`}),(0,V.jsx)(`path`,{d:`M16 9l-4 -4`}),(0,V.jsx)(`path`,{d:`M8 9l4 -4`})]}),Mb=K(jb,q),Nb=K(jb,{...q,style:{transform:`rotate(180deg)`}}),Pb=K(Ab,q),Fb=K(Ab,{...q,style:{transform:`rotate(180deg)`}}),Ib=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{d:`M3.333 3.333h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.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,V.jsx)(`defs`,{children:(0,V.jsx)(`clipPath`,{id:`a`,children:(0,V.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Lb=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{d:`M3.333 16.667h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.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,V.jsx)(`defs`,{children:(0,V.jsx)(`clipPath`,{id:`a`,children:(0,V.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Rb=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{d:`M3.333 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.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,V.jsx)(`defs`,{children:(0,V.jsx)(`clipPath`,{id:`a`,children:(0,V.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),zb=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{d:`M16.667 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.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,V.jsx)(`defs`,{children:(0,V.jsx)(`clipPath`,{id:`a`,children:(0,V.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Bb=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{d:`M16.667 3.333v13.334M3.333 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.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,V.jsx)(`defs`,{children:(0,V.jsx)(`clipPath`,{id:`a`,children:(0,V.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Vb=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{d:`M3.333 3.333h13.334M3.333 16.667h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.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,V.jsx)(`defs`,{children:(0,V.jsx)(`clipPath`,{id:`a`,children:(0,V.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Hb=K((0,V.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{d:`M1.667 10h2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.jsx)(`path`,{d:`M8.333 10h3.334`,strokeLinejoin:`round`}),(0,V.jsx)(`path`,{d:`M15.417 10h2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.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`})]}),J),Ub=K((0,V.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{d:`M10 18.333v-2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.jsx)(`path`,{d:`M10 11.667V8.333`,strokeLinejoin:`round`}),(0,V.jsx)(`path`,{d:`M10 4.583V1.667`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.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`})]}),J),Wb=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`circle`,{cx:`9`,cy:`7`,r:`4`}),(0,V.jsx)(`path`,{d:`M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`}),(0,V.jsx)(`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`}),(0,V.jsx)(`path`,{d:`M21 21v-2a4 4 0 0 0 -3 -3.85`})]}),q);K(`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`);var Gb=K(`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`),Kb=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,V.jsx)(`path`,{d:`M15 5 5 15M5 5l10 10`})}),(0,V.jsx)(`defs`,{children:(0,V.jsx)(`clipPath`,{id:`a`,children:(0,V.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J);K(`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}),K(`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}),K(`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});var qb=B.memo(({theme:e})=>K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`path`,{d:`M25 26H111V111H25`,fill:Ey(e)}),(0,V.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:Ey(e),strokeWidth:`2`}),(0,V.jsx)(`path`,{d:`M100 100H160V160H100`,fill:Ey(e)}),(0,V.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:Ey(e),strokeWidth:`2`}),(0,V.jsxs)(`g`,{fill:Dy(e),stroke:Ey(e),strokeWidth:`6`,children:[(0,V.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`30`,height:`30`}),(0,V.jsx)(`rect`,{x:`2.5`,y:`149.5`,width:`30`,height:`30`}),(0,V.jsx)(`rect`,{x:`147.5`,y:`149.5`,width:`30`,height:`30`}),(0,V.jsx)(`rect`,{x:`147.5`,y:`2.5`,width:`30`,height:`30`})]})]}),{width:182,height:182,mirror:!0})),Jb=B.memo(({theme:e})=>K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`path`,{d:`M25 26H111V111H25`,fill:Ey(e)}),(0,V.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:Ey(e),strokeWidth:`2`}),(0,V.jsx)(`path`,{d:`M100 100H160V160H100`,fill:Ey(e)}),(0,V.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:Ey(e),strokeWidth:`2`}),(0,V.jsxs)(`g`,{fill:Dy(e),stroke:Ey(e),strokeWidth:`6`,children:[(0,V.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`30`,height:`30`}),(0,V.jsx)(`rect`,{x:`78.5`,y:`149.5`,width:`30`,height:`30`}),(0,V.jsx)(`rect`,{x:`147.5`,y:`149.5`,width:`30`,height:`30`}),(0,V.jsx)(`rect`,{x:`147.5`,y:`78.5`,width:`30`,height:`30`}),(0,V.jsx)(`rect`,{x:`105.5`,y:`2.5`,width:`30`,height:`30`}),(0,V.jsx)(`rect`,{x:`2.5`,y:`102.5`,width:`30`,height:`30`})]})]}),{width:182,height:182,mirror:!0})),Yb=K((0,V.jsx)(`g`,{strokeWidth:1.25,children:(0,V.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`})}),J),Xb=K((0,V.jsxs)(V.Fragment,{children:[(0,V.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,V.jsx)(`mask`,{id:`FillHachureIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:2,y:2,width:16,height:16,children:(0,V.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,V.jsx)(`g`,{mask:`url(#FillHachureIcon)`,children:(0,V.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`})})]}),J),Zb=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`g`,{clipPath:`url(#a)`,children:[(0,V.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,V.jsx)(`mask`,{id:`FillCrossHatchIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:-1,y:-1,width:22,height:22,children:(0,V.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,V.jsx)(`g`,{mask:`url(#FillCrossHatchIcon)`,children:(0,V.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,V.jsx)(`defs`,{children:(0,V.jsx)(`clipPath`,{id:`a`,children:(0,V.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Qb=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`g`,{clipPath:`url(#a)`,children:(0,V.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,V.jsx)(`defs`,{children:(0,V.jsx)(`clipPath`,{id:`a`,children:(0,V.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),{...J,fill:`currentColor`}),$b=K((0,V.jsx)(V.Fragment,{children:(0,V.jsx)(`path`,{d:`M4.167 10h11.666`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),J),ex=K((0,V.jsx)(`path`,{d:`M5 10h10`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),J),tx=K((0,V.jsx)(`path`,{d:`M5 10h10`,stroke:`currentColor`,strokeWidth:`3.75`,strokeLinecap:`round`,strokeLinejoin:`round`}),J);B.memo(({theme:e})=>K((0,V.jsx)(`path`,{d:`M6 10H34`,stroke:Ey(e),strokeWidth:2,fill:`none`,strokeLinecap:`round`}),{width:40,height:20}));var nx=K((0,V.jsxs)(`g`,{strokeWidth:`2`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M5 12h2`}),(0,V.jsx)(`path`,{d:`M17 12h2`}),(0,V.jsx)(`path`,{d:`M11 12h2`})]}),q),rx=K((0,V.jsxs)(`g`,{strokeWidth:`2`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M4 12v.01`}),(0,V.jsx)(`path`,{d:`M8 12v.01`}),(0,V.jsx)(`path`,{d:`M12 12v.01`}),(0,V.jsx)(`path`,{d:`M16 12v.01`}),(0,V.jsx)(`path`,{d:`M20 12v.01`})]}),q),ix=K((0,V.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`}),J),ax=K((0,V.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`}),J),ox=K((0,V.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`}),J),sx=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{d:`M4 12 C 5 8, 6 8, 8 12`,fill:`none`,strokeWidth:`1`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.jsx)(`path`,{d:`M8 12 C 9 16, 10 16, 12 12`,fill:`none`,strokeWidth:`1`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.jsx)(`path`,{d:`M12 12 C 14 8, 15 8, 16 12`,fill:`none`,strokeWidth:`1`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.jsx)(`path`,{d:`M16 12 C 17 16, 18 16, 19 12`,fill:`none`,strokeWidth:`1`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),q),cx=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{d:`M4 12 C 5 8, 6 8, 8 12`,fill:`none`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.jsx)(`path`,{d:`M8 12 C 9 16, 10 16, 12 12`,fill:`none`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.jsx)(`path`,{d:`M12 12 C 14 8, 15 8, 16 12`,fill:`none`,strokeWidth:`2.75`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.jsx)(`path`,{d:`M16 12 C 17 16, 18 16, 19 12`,fill:`none`,strokeWidth:`3.25`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),q),lx=K((0,V.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,V.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,V.jsx)(`path`,{d:`M13.3333 3.33331V3.34331`}),(0,V.jsx)(`path`,{d:`M16.6667 3.33331V3.34331`}),(0,V.jsx)(`path`,{d:`M16.6667 6.66669V6.67669`}),(0,V.jsx)(`path`,{d:`M16.6667 10V10.01`}),(0,V.jsx)(`path`,{d:`M3.33334 13.3333V13.3433`}),(0,V.jsx)(`path`,{d:`M16.6667 13.3333V13.3433`}),(0,V.jsx)(`path`,{d:`M3.33334 16.6667V16.6767`}),(0,V.jsx)(`path`,{d:`M6.66666 16.6667V16.6767`}),(0,V.jsx)(`path`,{d:`M10 16.6667V16.6767`}),(0,V.jsx)(`path`,{d:`M13.3333 16.6667V16.6767`}),(0,V.jsx)(`path`,{d:`M16.6667 16.6667V16.6767`})]}),J),ux=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M4 12v-4a4 4 0 0 1 4 -4h4`}),(0,V.jsx)(`line`,{x1:`16`,y1:`4`,x2:`16`,y2:`4.01`}),(0,V.jsx)(`line`,{x1:`20`,y1:`4`,x2:`20`,y2:`4.01`}),(0,V.jsx)(`line`,{x1:`20`,y1:`8`,x2:`20`,y2:`8.01`}),(0,V.jsx)(`line`,{x1:`20`,y1:`12`,x2:`20`,y2:`12.01`}),(0,V.jsx)(`line`,{x1:`4`,y1:`16`,x2:`4`,y2:`16.01`}),(0,V.jsx)(`line`,{x1:`20`,y1:`16`,x2:`20`,y2:`16.01`}),(0,V.jsx)(`line`,{x1:`4`,y1:`20`,x2:`4`,y2:`20.01`}),(0,V.jsx)(`line`,{x1:`8`,y1:`20`,x2:`8`,y2:`20.01`}),(0,V.jsx)(`line`,{x1:`12`,y1:`20`,x2:`12`,y2:`20.01`}),(0,V.jsx)(`line`,{x1:`16`,y1:`20`,x2:`16`,y2:`20.01`}),(0,V.jsx)(`line`,{x1:`20`,y1:`20`,x2:`20`,y2:`20.01`})]}),q),dx=B.memo(({flip:e=!1})=>K((0,V.jsxs)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,opacity:.3,strokeWidth:2,fill:`none`,strokeLinecap:`round`,children:[(0,V.jsx)(`path`,{d:`M7,11 H19`}),(0,V.jsx)(`path`,{d:`M25,6 L33,16 M33,6 L25,16`})]}),Oy)),fx=B.memo(({flip:e=!1})=>K((0,V.jsx)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,strokeWidth:2,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,V.jsx)(`path`,{d:`M7,11 H33 M23,5 L33,11 L23,17`})}),Oy)),px=B.memo(({flip:e=!1})=>K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{d:`M7,11 H23`,strokeWidth:2,strokeLinecap:`round`}),(0,V.jsx)(`path`,{d:`M23,5 L35,11 L23,17 Z`})]}),Oy)),mx=B.memo(({flip:e=!1})=>K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeWidth:2,strokeLinejoin:`round`,strokeLinecap:`round`,children:[(0,V.jsx)(`path`,{d:`M7,11 H23`}),(0,V.jsx)(`path`,{d:`M23,5 L35,11 L23,17 Z`})]}),Oy)),hx=B.memo(({flip:e=!1})=>K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,children:[(0,V.jsx)(`path`,{d:`M7,11 H25`,strokeWidth:2,strokeLinecap:`round`}),(0,V.jsx)(`circle`,{cx:`29`,cy:`11`,r:`4`})]}),Oy)),gx=B.memo(({flip:e=!1})=>K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeWidth:2,children:[(0,V.jsx)(`path`,{d:`M7,11 H25`,strokeLinecap:`round`}),(0,V.jsx)(`circle`,{cx:`29`,cy:`11`,r:`4`})]}),Oy)),_x=B.memo(({flip:e=!1})=>K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{d:`M7,11 H21`,strokeWidth:2,strokeLinecap:`round`}),(0,V.jsx)(`path`,{d:`M21,11 L28,5 L35,11 L28,17 Z`})]}),Oy)),vx=B.memo(({flip:e=!1})=>K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,strokeWidth:2,strokeLinecap:`round`,children:[(0,V.jsx)(`path`,{d:`M7,11 H21`}),(0,V.jsx)(`path`,{d:`M21,11 L28,5 L35,11 L28,17 Z`})]}),Oy)),yx=B.memo(({flip:e=!1})=>K((0,V.jsx)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,strokeWidth:2,fill:`none`,strokeLinecap:`round`,children:(0,V.jsx)(`path`,{d:`M11,11 H31 M31,5 V17`})}),Oy)),bx=B.memo(({flip:e=!1})=>K((0,V.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,V.jsx)(`path`,{d:`M35,11 H7 M15,5 V17`})}),Oy)),xx=B.memo(({flip:e=!1})=>K((0,V.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,V.jsx)(`path`,{d:`M35,11 H7 M15,11 L7,5 M15,11 L7,17`})}),Oy)),Sx=B.memo(({flip:e=!1})=>K((0,V.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,V.jsx)(`path`,{d:`M35,11 H7 M23,5 V17 M15,11 L7,5 M15,11 L7,17`})}),Oy)),Cx=B.memo(({flip:e=!1})=>K((0,V.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,V.jsx)(`path`,{d:`M35,11 H7 M15,5 V17 M7,5 V17`})}),Oy)),wx=B.memo(({flip:e=!1})=>K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,V.jsx)(`path`,{d:`M35,11 H19 M11,11 H7 M7,5 V17`}),(0,V.jsx)(`circle`,{cx:`15`,cy:`11`,r:`4`})]}),Oy)),Tx=B.memo(({flip:e=!1})=>K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,V.jsx)(`path`,{d:`M35,11 H27 M19,11 H7 M15,11 L7,5 M15,11 L7,17`}),(0,V.jsx)(`circle`,{cx:`23`,cy:`11`,r:`4`})]}),Oy)),Ex=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`g`,{clipPath:`url(#a)`,children:(0,V.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,V.jsx)(`defs`,{children:(0,V.jsx)(`clipPath`,{id:`a`,children:(0,V.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Dx=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`g`,{clipPath:`url(#a)`,children:(0,V.jsx)(`path`,{d:`M5 16.667V3.333L10 15l5-11.667v13.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,V.jsx)(`defs`,{children:(0,V.jsx)(`clipPath`,{id:`a`,children:(0,V.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Ox=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`g`,{clipPath:`url(#a)`,children:(0,V.jsx)(`path`,{d:`M5.833 3.333v13.334h8.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,V.jsx)(`defs`,{children:(0,V.jsx)(`clipPath`,{id:`a`,children:(0,V.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),kx=K((0,V.jsx)(V.Fragment,{children:(0,V.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`})}),J),Ax=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M3 7v-2h13v2`}),(0,V.jsx)(`path`,{d:`M10 5v14`}),(0,V.jsx)(`path`,{d:`M12 19h-4`}),(0,V.jsx)(`path`,{d:`M15 13v-1h6v1`}),(0,V.jsx)(`path`,{d:`M18 12v7`}),(0,V.jsx)(`path`,{d:`M17 19h2`})]}),q),jx=K((0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M7 12h10`}),(0,V.jsx)(`path`,{d:`M7 5v14`}),(0,V.jsx)(`path`,{d:`M17 5v14`}),(0,V.jsx)(`path`,{d:`M15 19h4`}),(0,V.jsx)(`path`,{d:`M15 5h4`}),(0,V.jsx)(`path`,{d:`M5 19h4`}),(0,V.jsx)(`path`,{d:`M5 5h4`})]})}),q),Mx=K((0,V.jsx)(V.Fragment,{children:(0,V.jsx)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,V.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`})})}),J),Nx=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M7 8l-4 4l4 4`}),(0,V.jsx)(`path`,{d:`M17 8l4 4l-4 4`}),(0,V.jsx)(`path`,{d:`M14 4l-4 16`})]}),q),Px=Nx,Fx=K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,V.jsx)(`line`,{x1:`4`,y1:`12`,x2:`12`,y2:`12`}),(0,V.jsx)(`line`,{x1:`4`,y1:`16`,x2:`16`,y2:`16`})]}),q),Ix=K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,V.jsx)(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`}),(0,V.jsx)(`line`,{x1:`6`,y1:`16`,x2:`18`,y2:`16`})]}),q),Lx=K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,V.jsx)(`line`,{x1:`10`,y1:`12`,x2:`20`,y2:`12`}),(0,V.jsx)(`line`,{x1:`8`,y1:`16`,x2:`20`,y2:`16`})]}),q),Rx=B.memo(({theme:e})=>K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`line`,{x1:`4`,y1:`4`,x2:`20`,y2:`4`}),(0,V.jsx)(`rect`,{x:`9`,y:`8`,width:`6`,height:`12`,rx:`2`})]}),q)),zx=B.memo(({theme:e})=>K((0,V.jsxs)(`g`,{strokeWidth:`2`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`line`,{x1:`4`,y1:`20`,x2:`20`,y2:`20`}),(0,V.jsx)(`rect`,{x:`9`,y:`4`,width:`6`,height:`12`,rx:`2`})]}),q)),Bx=B.memo(({theme:e})=>K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`line`,{x1:`4`,y1:`12`,x2:`9`,y2:`12`}),(0,V.jsx)(`line`,{x1:`15`,y1:`12`,x2:`20`,y2:`12`}),(0,V.jsx)(`rect`,{x:`9`,y:`6`,width:`6`,height:`12`,rx:`2`})]}),q)),Vx=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M21 19h-18l9 -15`}),(0,V.jsx)(`path`,{d:`M20.615 15.171h.015`}),(0,V.jsx)(`path`,{d:`M19.515 11.771h.015`}),(0,V.jsx)(`path`,{d:`M17.715 8.671h.015`}),(0,V.jsx)(`path`,{d:`M15.415 5.971h.015`})]}),q),Hx=K((0,V.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});K((0,V.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`}));var Ux=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5`}),(0,V.jsx)(`path`,{d:`M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5`}),(0,V.jsx)(`path`,{d:`M14 5.5a1.5 1.5 0 0 1 3 0v6.5`}),(0,V.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`})]}),q),Wx=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2`}),(0,V.jsx)(`path`,{d:`M7 11l5 5l5 -5`}),(0,V.jsx)(`path`,{d:`M12 4l0 12`})]}),q),Gx=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.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`})]}),q),Kx=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M7 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,V.jsx)(`path`,{d:`M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,V.jsx)(`path`,{d:`M9.15 14.85l8.85 -10.85`}),(0,V.jsx)(`path`,{d:`M6 4l8.85 10.85`})]}),q),qx=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`}),(0,V.jsx)(`path`,{d:`M12 17l0 .01`}),(0,V.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),q);K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M7 4v16l13 -8z`})]}),q),K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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`})]}),q);var Jx=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M5 12l5 5l10 -10`})]}),q),Yx=K((0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.jsx)(`path`,{d:`M12 9v4`}),(0,V.jsx)(`path`,{d:`M12 17h.01`})]}),q),Xx=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M11 7l6 6`}),(0,V.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`})]}),q),Zx=K((0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M12 3l-4 7h8z`}),(0,V.jsx)(`path`,{d:`M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,V.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`})]}),q),Qx=K((0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M4 7l16 0`}),(0,V.jsx)(`path`,{d:`M4 17l16 0`}),(0,V.jsx)(`path`,{d:`M7 4l0 16`}),(0,V.jsx)(`path`,{d:`M17 4l0 16`})]}),q),$x=K((0,V.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`})),eS=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4`}),(0,V.jsx)(`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`})]}),q),tS=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M6 10l-2 1l8 4l8 -4l-2 -1`}),(0,V.jsx)(`path`,{d:`M4 15l8 4l8 -4`}),(0,V.jsx)(`path`,{d:`M12 4v7`}),(0,V.jsx)(`path`,{d:`M15 8l-3 3l-3 -3`})]}),q),nS=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{d:`M4.16602 10H15.8327`}),(0,V.jsx)(`path`,{d:`M12.5 13.3333L15.8333 10`}),(0,V.jsx)(`path`,{d:`M12.5 6.66666L15.8333 9.99999`})]}),J),rS=K((0,V.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,transform:`rotate(90 10 10)`,children:[(0,V.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,V.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),iS=K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`}),(0,V.jsx)(`path`,{d:`M6 21l15 -15l-3 -3l-15 15l3 3`}),(0,V.jsx)(`path`,{d:`M15 6l3 3`}),(0,V.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,V.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`})]}),q);K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`}),(0,V.jsx)(`path`,{d:`M6 21l15 -15l-3 -3l-15 15l3 3`}),(0,V.jsx)(`path`,{d:`M15 6l3 3`}),(0,V.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,V.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`})]}),q),K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35`}),(0,V.jsx)(`path`,{d:`M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946`}),(0,V.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,V.jsx)(`path`,{d:`M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45`}),(0,V.jsx)(`path`,{d:`M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946`}),(0,V.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`})]}),q);var aS=K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M4 8v-2a2 2 0 0 1 2 -2h2`}),(0,V.jsx)(`path`,{d:`M4 16v2a2 2 0 0 0 2 2h2`}),(0,V.jsx)(`path`,{d:`M16 4h2a2 2 0 0 1 2 2v2`}),(0,V.jsx)(`path`,{d:`M16 20h2a2 2 0 0 0 2 -2v-2`})]}),q),oS=K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0`}),(0,V.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`})]}),q),sS=K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M10.585 10.587a2 2 0 0 0 2.829 2.828`}),(0,V.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,V.jsx)(`path`,{d:`M3 3l18 18`})]}),q),cS=K((0,V.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.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,V.jsx)(`path`,{d:`M17.5 16a3.5 3.5 0 0 0 0 -7h-.5`}),(0,V.jsx)(`path`,{d:`M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0`}),(0,V.jsx)(`path`,{d:`M6.5 16a3.5 3.5 0 0 1 0 -7h.5`}),(0,V.jsx)(`path`,{d:`M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10`})]}),q),lS=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.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,V.jsx)(`path`,{d:`M17.5 16a3.5 3.5 0 0 0 0 -7h-.5`}),(0,V.jsx)(`path`,{d:`M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0`}),(0,V.jsx)(`path`,{d:`M6.5 16a3.5 3.5 0 0 1 0 -7h.5`}),(0,V.jsx)(`path`,{d:`M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10`})]}),q),uS=K((0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`}),(0,V.jsx)(`path`,{d:`M21 21l-6 -6`})]}),q),dS=K((0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M20.984 12.53a9 9 0 1 0 -7.552 8.355`}),(0,V.jsx)(`path`,{d:`M12 7v5l3 3`}),(0,V.jsx)(`path`,{d:`M19 16l-2 3h4l-2 3`})]}),q),fS=K((0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M12 8l0 4l2 2`}),(0,V.jsx)(`path`,{d:`M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5`})]}),q),pS=K((0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.jsx)(`path`,{d:`M5 10a7 7 0 0 0 14 0`}),(0,V.jsx)(`path`,{d:`M8 21l8 0`}),(0,V.jsx)(`path`,{d:`M12 17l0 4`})]}),q),mS=K((0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M3 3l18 18`}),(0,V.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,V.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,V.jsx)(`path`,{d:`M8 21l8 0`}),(0,V.jsx)(`path`,{d:`M12 17l0 4`})]}),q),hS=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11`})]}),q),gS=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.jsx)(`path`,{d:`M12 20v.01`}),(0,V.jsx)(`path`,{d:`M16 20v.01`}),(0,V.jsx)(`path`,{d:`M8 20v.01`}),(0,V.jsx)(`path`,{d:`M4 20v.01`}),(0,V.jsx)(`path`,{d:`M4 16v.01`}),(0,V.jsx)(`path`,{d:`M4 12v.01`}),(0,V.jsx)(`path`,{d:`M4 8v.01`}),(0,V.jsx)(`path`,{d:`M4 4v.01`}),(0,V.jsx)(`path`,{d:`M8 4v.01`}),(0,V.jsx)(`path`,{d:`M12 4v.01`}),(0,V.jsx)(`path`,{d:`M16 4v.01`}),(0,V.jsx)(`path`,{d:`M20 4v.01`}),(0,V.jsx)(`path`,{d:`M20 8v.01`}),(0,V.jsx)(`path`,{d:`M20 12v.01`}),(0,V.jsx)(`path`,{d:`M20 16v.01`}),(0,V.jsx)(`path`,{d:`M20 20v.01`})]}),q),_S=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M5 3v18`}),(0,V.jsx)(`path`,{d:`M19 21v-18`}),(0,V.jsx)(`path`,{d:`M5 7h14`}),(0,V.jsx)(`path`,{d:`M5 15h14`}),(0,V.jsx)(`path`,{d:`M8 13v4`}),(0,V.jsx)(`path`,{d:`M11 13v4`}),(0,V.jsx)(`path`,{d:`M16 13v4`}),(0,V.jsx)(`path`,{d:`M14 5v4`}),(0,V.jsx)(`path`,{d:`M11 5v4`}),(0,V.jsx)(`path`,{d:`M8 5v4`}),(0,V.jsx)(`path`,{d:`M3 21h18`})]}),q),vS=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M3 12l18 0`}),(0,V.jsx)(`path`,{d:`M7 16l10 0l-10 5l0 -5`}),(0,V.jsx)(`path`,{d:`M7 8l10 0l-10 -5l0 5`})]}),q),yS=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M12 3l0 18`}),(0,V.jsx)(`path`,{d:`M16 7l0 10l5 0l-5 -10`}),(0,V.jsx)(`path`,{d:`M8 7l0 10l-5 0l5 -10`})]}),q),bS=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.jsx)(`path`,{d:`M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2`}),(0,V.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`})]}),q),xS=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0`}),(0,V.jsx)(`path`,{d:`M22 22l-3 -3`}),(0,V.jsx)(`path`,{d:`M6 18h-1a2 2 0 0 1 -2 -2v-1`}),(0,V.jsx)(`path`,{d:`M3 11v-1`}),(0,V.jsx)(`path`,{d:`M3 6v-1a2 2 0 0 1 2 -2h1`}),(0,V.jsx)(`path`,{d:`M10 3h1`}),(0,V.jsx)(`path`,{d:`M15 3h1a2 2 0 0 1 2 2v1`})]}),q),SS=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),(0,V.jsx)(`path`,{d:`M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4`}),(0,V.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,V.jsx)(`path`,{d:`M10 15l2 6l2 -6`}),(0,V.jsx)(`path`,{d:`M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3`})]}),q),CS=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),(0,V.jsx)(`path`,{d:`M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4`}),(0,V.jsx)(`path`,{d:`M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3`}),(0,V.jsx)(`path`,{d:`M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6`}),(0,V.jsx)(`path`,{d:`M11 21v-6l3 6v-6`})]}),q),wS=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.jsx)(`path`,{d:`M4 8l5 0`}),(0,V.jsx)(`path`,{d:`M15 8l4 0`})]}),q),TS=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.jsx)(`path`,{d:`M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2`}),(0,V.jsx)(`path`,{d:`M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2`}),(0,V.jsx)(`path`,{d:`M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z`}),(0,V.jsx)(`path`,{d:`M16.746 16.726a3 3 0 1 0 .252 -5.555`})]}),q),ES=K((0,V.jsxs)(`g`,{stroke:`currentColor`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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`})]}),{...q,strokeWidth:1.5});K((0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M15 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2`}),(0,V.jsx)(`path`,{d:`M21 12h-13l3 -3`}),(0,V.jsx)(`path`,{d:`M11 15l-3 -3`})]}),q);var DS=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.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,V.jsx)(`path`,{d:`M10 9l5 3l-5 3z`})]}),q),OS=K((0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M3 6h18`}),(0,V.jsx)(`path`,{d:`M3 12h18`}),(0,V.jsx)(`path`,{d:`M3 18h18`}),(0,V.jsx)(`path`,{d:`M6 3v18`}),(0,V.jsx)(`path`,{d:`M12 3v18`}),(0,V.jsx)(`path`,{d:`M18 3v18`})]}),q),kS=K((0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M17 3m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z`}),(0,V.jsx)(`path`,{d:`M3 17m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z`}),(0,V.jsx)(`path`,{d:`M17 5c-6.627 0 -12 5.373 -12 12`})]}),q),AS=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M6 18l12 -12`}),(0,V.jsx)(`path`,{d:`M18 10v-4h-4`})]}),q),jS=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M4,19L10,19C11.097,19 12,18.097 12,17L12,9C12,7.903 12.903,7 14,7L21,7`}),(0,V.jsx)(`path`,{d:`M18 4l3 3l-3 3`})]}),q),MS=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{d:`M16,12L20,9L16,6`}),(0,V.jsx)(`path`,{d:`M6 20c0 -6.075 4.925 -11 11 -11h3`})]}),q),NS=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M6 9l6 6l6 -6`})]}),q),PS=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M6 15l6 -6l6 6`})]}),q),FS=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M6 15l6 -6l6 6`})]}),q),IS=K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M8 5v10a1 1 0 0 0 1 1h10`}),(0,V.jsx)(`path`,{d:`M5 8h10a1 1 0 0 1 1 1v10`})]}),q),LS=K((0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M5 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M19 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M5 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M19 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M5 7l0 10`}),(0,V.jsx)(`path`,{d:`M7 5l10 0`}),(0,V.jsx)(`path`,{d:`M7 19l10 0`}),(0,V.jsx)(`path`,{d:`M19 7l0 10`})]}),q);K((0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M4 11v8a1 1 0 0 0 1 1h8m-9 -14v-1a1 1 0 0 1 1 -1h1m5 0h2m5 0h1a1 1 0 0 1 1 1v1m0 5v2m0 5v1a1 1 0 0 1 -1 1h-1`}),(0,V.jsx)(`path`,{d:`M4 12h7a1 1 0 0 1 1 1v7`})]}),q);var RS=K((0,V.jsxs)(`g`,{strokeWidth:1.5,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M4 6l8 0`}),(0,V.jsx)(`path`,{d:`M16 6l4 0`}),(0,V.jsx)(`path`,{d:`M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M4 12l2 0`}),(0,V.jsx)(`path`,{d:`M10 12l10 0`}),(0,V.jsx)(`path`,{d:`M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M4 18l11 0`}),(0,V.jsx)(`path`,{d:`M19 18l1 0`})]}),q),zS=K((0,V.jsxs)(`g`,{strokeWidth:1,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M6 10l4 -4 L6 14l8 -8 L6 18l12 -12 L10 18l8 -8 L14 18l4 -4`})]}),q),BS=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4`}),(0,V.jsx)(`path`,{d:`M13.5 6.5l4 4`})]}),q);K((0,V.jsxs)(`g`,{strokeWidth:1,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M11 7l-5 5l5 5`}),(0,V.jsx)(`path`,{d:`M17 7l-5 5l5 5`})]}),q);var VS=K((0,V.jsxs)(`g`,{strokeWidth:`1.75`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z`}),(0,V.jsx)(`path`,{d:`M15 4l0 16`})]}),q);K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M3 20l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c3.255 2.777 3.695 7.266 1.029 10.501c-2.666 3.235 -7.615 4.215 -11.574 2.293l-4.7 1`})]}),q),K((0,V.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M3 4l18 0`}),(0,V.jsx)(`path`,{d:`M4 4v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-10`}),(0,V.jsx)(`path`,{d:`M12 16l0 4`}),(0,V.jsx)(`path`,{d:`M9 20l6 0`}),(0,V.jsx)(`path`,{d:`M8 12l3 -3l2 2l3 -3`})]}),q);var HS=(0,V.jsx)(`div`,{style:{width:`1rem`,height:`1rem`}}),US=K((0,V.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`polyline`,{points:`9 6 15 12 9 18`})]}),q),WS=K((0,V.jsxs)(`g`,{strokeWidth:1.25,children:[(0,V.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,V.jsx)(`path`,{d:`M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M4 6l8 0`}),(0,V.jsx)(`path`,{d:`M16 6l4 0`}),(0,V.jsx)(`path`,{d:`M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M4 12l2 0`}),(0,V.jsx)(`path`,{d:`M10 12l10 0`}),(0,V.jsx)(`path`,{d:`M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,V.jsx)(`path`,{d:`M4 18l11 0`}),(0,V.jsx)(`path`,{d:`M19 18l1 0`})]}),q),GS=({size:e=`1em`,circleWidth:t=8,synchronized:n=!1,className:r=``})=>{let i=-(B.useRef(Date.now()).current%1600);return(0,V.jsx)(`div`,{className:`Spinner ${r}`,children:(0,V.jsx)(`svg`,{viewBox:`0 0 100 100`,style:{width:e,height:e,"--spinner-delay":n?`${i}ms`:0},children:(0,V.jsx)(`circle`,{cx:`50`,cy:`50`,r:50-t/2,strokeWidth:t,fill:`none`,strokeMiterlimit:`10`})})})},Y=B.forwardRef(({size:e=`medium`,visible:t=!0,className:n=``,...r},i)=>{let a=B.useRef(null);B.useImperativeHandle(i,()=>a.current);let o=`ToolIcon_size_${e}`,[s,c]=(0,B.useState)(!1),l=(0,B.useRef)(!0),u=async e=>{let t=`onClick`in r&&r.onClick?.(e);if(Gs(t))try{c(!0),await t}catch(e){if(e instanceof Qa)console.warn(e);else throw e}finally{l.current&&c(!1)}};(0,B.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]);let d=(0,B.useRef)(null);return r.type===`button`||r.type===`icon`?(0,V.jsxs)(`button`,{className:H(`ToolIcon_type_button`,o,n,t&&!r.hidden?`ToolIcon_type_button--show`:`ToolIcon_type_button--hide`,{ToolIcon:!r.hidden,"ToolIcon--plain":r.type===`icon`}),style:r.style,"data-testid":r[`data-testid`],hidden:r.hidden,title:r.title,"aria-label":r[`aria-label`],type:`button`,onClick:u,ref:a,disabled:s||r.isLoading||!!r.disabled,children:[(r.icon||r.label)&&(0,V.jsxs)(`div`,{className:`ToolIcon__icon`,"aria-hidden":`true`,"aria-disabled":!!r.disabled,children:[r.icon||r.label,r.keyBindingLabel&&(0,V.jsx)(`span`,{className:`ToolIcon__keybinding`,children:r.keyBindingLabel}),r.isLoading&&(0,V.jsx)(GS,{})]}),r.showAriaLabel&&(0,V.jsxs)(`div`,{className:`ToolIcon__label`,children:[r[`aria-label`],` `,s&&(0,V.jsx)(GS,{})]}),r.children]}):(0,V.jsx)(`button`,{className:H(`ToolIcon`,`ToolIcon_type_toggle`,o,n,{"ToolIcon--checked":r.checked}),type:`button`,style:r.style,title:r.title,"aria-label":r[`aria-label`],"aria-keyshortcuts":r[`aria-keyshortcuts`],"aria-pressed":r.checked,"data-testid":r[`data-testid`],onPointerDown:e=>{d.current=e.pointerType||null},onPointerUp:()=>{requestAnimationFrame(()=>{d.current=null})},onClick:()=>{r.onSelect?.({pointerType:d.current})},ref:a,children:(0,V.jsxs)(`div`,{className:`ToolIcon__icon`,children:[r.icon,r.keyBindingLabel&&(0,V.jsx)(`span`,{className:`ToolIcon__keybinding`,children:r.keyBindingLabel})]})})});Y.displayName=`IconButton`;var KS=[],X=e=>(KS=KS.concat(e),e),qS=(e,t,n)=>{let r=new Set(An(e.filter(e=>N(e)),t).map(e=>e.id)),i={},a=n.scene.getNonDeletedElementsMap(),o=new Set;for(let t of r){let n=D(e,t);for(let e of n)if(!o.has(e.id)){if(xo(e)){let t=rt(e,a);t&&(i[t.id]=!0)}else i[e.id]=!0;o.add(e.id)}}let s=!0,c=e.map(e=>{if(t.selectedElementIds[e.id]){let t=xo(e)?rt(e,a):null;return e.frameId&&r.has(e.frameId)?(s=!1,i[e.id]=!0,e):t?.frameId&&r.has(t?.frameId)?e:(e.boundElements&&e.boundElements.forEach(t=>{let r=n.scene.getNonDeletedElementsMap().get(t.id);r&&Ti(r)&&n.scene.mutateElement(r,{startBinding:e.id===r.startBinding?.elementId?null:r.startBinding,endBinding:e.id===r.endBinding?.elementId?null:r.endBinding})}),j(e,{isDeleted:!0}))}return e.frameId&&r.has(e.frameId)?(s=!1,xo(e)||(i[e.id]=!0),j(e,{frameId:null})):xo(e)&&t.selectedElementIds[e.containerId]?j(e,{isDeleted:!0}):e}),l=t.editingGroupId;if(s&&t.editingGroupId){let e=Tt(c,t.editingGroupId).filter(e=>!e.isDeleted);if(e.length>1)e[0]&&(i[e[0].id]=!0);else{l=null,e[0]&&(i[e[0].id]=!0);let n=e[0];if(n){let e=n.groupIds.findIndex(e=>e===t.editingGroupId),r=n.groupIds[e+1];if(r){let e=Tt(c,r).filter(e=>!e.isDeleted);e.length>1&&(l=r,e.forEach(e=>{i[e.id]=!0}))}}}}return{elements:c,appState:{...t,...tr({selectedElementIds:i,editingGroupId:l},Sa(c),t,null)}}},JS=(e,t)=>{if(e.editingGroupId){let n=Tt(Sa(t),e.editingGroupId);if(n.length)return{...e,selectedElementIds:{[n[0].id]:!0}}}return e},YS=X({name:`deleteSelectedElements`,label:`labels.delete`,icon:rb,trackEvent:{category:`element`,action:`delete`},perform:(e,t,n,r)=>{if(t.selectedLinearElement?.isEditing){let{elementId:n,selectedPointsIndices:i}=t.selectedLinearElement,a=r.scene.getNonDeletedElementsMap(),o=I.getElement(n,a);if(!o||i==null)return!1;if(i.length>=o.points.length){let n=e.map(e=>e.id===o.id?j(e,{isDeleted:!0}):e);return{elements:n,appState:{...JS(t,n),selectedLinearElement:null},captureUpdate:P.IMMEDIATELY}}return I.deletePoints(o,r,i),{elements:e,appState:{...t,selectedLinearElement:{...t.selectedLinearElement,selectedPointsIndices:i?.[0]>0?[i[0]-1]:[0]}},captureUpdate:P.IMMEDIATELY}}let{elements:i,appState:a}=qS(e,t,r);return Zt(i,i.filter(e=>e.isDeleted)),a=JS(a,i),{elements:i,appState:{...a,activeTool:kr(t,{type:r.state.preferredSelectionTool.type}),multiElement:null,newElement:null,activeEmbeddable:null,selectedLinearElement:null},captureUpdate:ha(Sa(e),t)?P.IMMEDIATELY:P.EVENTUALLY}},keyTest:(e,t,n)=>(e.key===M.BACKSPACE||e.key===M.DELETE)&&!e[M.CTRL_OR_CMD],PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=$z()===`mobile`;return(0,V.jsx)(Y,{type:`button`,icon:rb,title:G(`labels.delete`),"aria-label":G(`labels.delete`),onClick:()=>n(null),disabled:!ha(Sa(e),t),style:{...i&&t.openPopup!==`compactOtherProperties`?te:{}}})}}),Z=e=>e.replace(/\b(Opt(?:ion)?|Alt)\b/i,G(Nn?`keys.option`:`keys.alt`)).replace(/\bShift\b/i,G(`keys.shift`)).replace(/\b(Enter|Return)\b/i,G(`keys.enter`)).replace(/\b(Ctrl|Cmd|Command|CtrlOrCmd)\b/gi,G(Nn?`keys.cmd`:`keys.ctrl`)).replace(/\b(Esc(?:ape)?)\b/i,G(`keys.escape`)).replace(/\b(Space(?:bar)?)\b/i,G(`keys.spacebar`)).replace(/\b(Del(?:ete)?)\b/i,G(`keys.delete`)),XS=X({name:`sendBackward`,label:`labels.sendBackward`,keywords:[`move down`,`zindex`,`layer`],icon:Nb,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:no(e,t,r.scene),appState:t,captureUpdate:P.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[M.CTRL_OR_CMD]&&!e.shiftKey&&e.code===vr.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,V.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${G(`labels.sendBackward`)} \u2014 ${Z(`CtrlOrCmd+[`)}`,children:Nb})}),ZS=X({name:`bringForward`,label:`labels.bringForward`,keywords:[`move up`,`zindex`,`layer`],icon:Mb,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:sr(e,t,r.scene),appState:t,captureUpdate:P.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[M.CTRL_OR_CMD]&&!e.shiftKey&&e.code===vr.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,V.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${G(`labels.bringForward`)} \u2014 ${Z(`CtrlOrCmd+]`)}`,children:Mb})}),QS=X({name:`sendToBack`,label:`labels.sendToBack`,keywords:[`move down`,`zindex`,`layer`],icon:Fb,trackEvent:{category:`element`},perform:(e,t)=>({elements:gn(e,t),appState:t,captureUpdate:P.IMMEDIATELY}),keyTest:e=>Nn?e[M.CTRL_OR_CMD]&&e.altKey&&e.code===vr.BRACKET_LEFT:e[M.CTRL_OR_CMD]&&e.shiftKey&&e.code===vr.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,V.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${G(`labels.sendToBack`)} \u2014 ${Z(Nn?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)}`,children:Fb})}),$S=X({name:`bringToFront`,label:`labels.bringToFront`,keywords:[`move up`,`zindex`,`layer`],icon:Pb,trackEvent:{category:`element`},perform:(e,t)=>({elements:ni(e,t),appState:t,captureUpdate:P.IMMEDIATELY}),keyTest:e=>Nn?e[M.CTRL_OR_CMD]&&e.altKey&&e.code===vr.BRACKET_RIGHT:e[M.CTRL_OR_CMD]&&e.shiftKey&&e.code===vr.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,V.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:t=>e(null),title:`${G(`labels.bringToFront`)} \u2014 ${Z(Nn?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)}`,children:Pb})}),eC=X({name:`selectAll`,label:`labels.selectAll`,icon:gS,trackEvent:{category:`canvas`},viewMode:!1,perform:(e,t,n,r)=>{if(t.selectedLinearElement?.isEditing)return!1;let i=e.filter(e=>!e.isDeleted&&!(R(e)&&e.containerId)&&!e.locked).reduce((e,t)=>(e[t.id]=!0,e),{});return{appState:{...t,...tr({editingGroupId:null,selectedElementIds:i},Sa(e),t,r),selectedLinearElement:Object.keys(i).length===1&&ja(e[0])?new I(e[0],Pa(e)):null},captureUpdate:P.IMMEDIATELY}},keyTest:e=>e[M.CTRL_OR_CMD]&&e.key===M.A}),tC=X({name:`duplicateSelection`,label:`labels.duplicateSelection`,icon:ab,trackEvent:{category:`element`},perform:(e,t,n,r)=>{if(t.selectedElementsAreBeingDragged)return!1;if(t.selectedLinearElement?.isEditing)try{return{elements:e,appState:I.duplicateSelectedPoints(t,r.scene),captureUpdate:P.IMMEDIATELY}}catch{return!1}let{duplicatedElements:i,elementsWithDuplicates:a}=w({type:`in-place`,elements:e,idsOfElementsToDuplicate:Pa(An(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),appState:t,randomizeSeed:!0,overrides:({origElement:e,origIdToDuplicateId:t})=>{let n=e.frameId&&t.get(e.frameId);return{x:e.x+20/2,y:e.y+20/2,frameId:n??e.frameId}}});if(r.props.onDuplicate&&a){let t=r.props.onDuplicate(a,e);t&&(a=t)}return{elements:wo(a,Pa(i)),appState:{...t,...Mo(i,Sa(a),t)},captureUpdate:P.IMMEDIATELY}},keyTest:e=>e[M.CTRL_OR_CMD]&&e.key===M.D,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=$z()===`mobile`;return(0,V.jsx)(Y,{type:`button`,icon:ab,title:`${G(`labels.duplicateSelection`)} \u2014 ${Z(`CtrlOrCmd+D`)}`,"aria-label":G(`labels.duplicateSelection`),onClick:()=>n(null),disabled:!ha(Sa(e),t),style:{...i&&t.openPopup!==`compactOtherProperties`?te:{}}})}}),nC=new Set([`command_palette`,`export`]),rC=(e,t,n,r)=>{try{if(typeof window>`u`||ds.VITE_WORKER_ID||ds.VITE_APP_ENABLE_TRACKING!==`true`||!nC.has(e)||Ms())return;ds.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(e){console.error(`error during analytics`,e)}},iC=(0,B.forwardRef)((e,t)=>{let{title:n,className:r,testId:i,active:a,icon:o,onClick:s}=e;return(0,V.jsx)(`button`,{type:`button`,ref:t,title:n,"data-testid":i,className:H(r,{active:a}),onClick:s,style:e.style,children:o},n)}),aC=e=>(0,V.jsx)(V.Fragment,{children:e.options.map(t=>e.type===`button`?(0,V.jsx)(iC,{icon:t.icon,title:t.text,testId:t.testId,active:t.active??e.value===t.value,onClick:n=>e.onClick(t.value,n)},t.text):(0,V.jsxs)(`label`,{className:H({active:e.value===t.value}),title:t.text,children:[(0,V.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))}),oC=()=>(0,V.jsx)(`div`,{style:{width:1,height:`1rem`,backgroundColor:`var(--default-border-color)`,margin:`0 auto`}}),sC=B.createContext(null),cC=()=>B.useContext(sC),lC=e=>{let[t,n]=(0,B.useState)(null),r=Qz(),{theme:i}=cC(),{container:a}=eB();return(0,B.useLayoutEffect)(()=>{t&&(t.className=``,t.classList.add(`excalidraw`,...e?.className?.split(/\s+/)||[]),t.classList.toggle(`excalidraw--mobile`,r.formFactor===`phone`),t.classList.toggle(`theme--dark`,i===F.DARK))},[t,i,r.formFactor,e?.className]),(0,B.useLayoutEffect)(()=>{let t=e?.parentSelector?a?.querySelector(e.parentSelector):document.body;if(!t)return;let r=document.createElement(`div`);return t.appendChild(r),n(r),()=>{t.removeChild(r)}},[a,e?.parentSelector]),t};function uC(e,t,n){(0,B.useEffect)(()=>{function r(r){let i=r;if(!e.current)return;let a=n?.(i,e.current);if(a!==!0){if(a===!1)return t(i);e.current.contains(i.target)||!document.documentElement.contains(i.target)||i.target.closest(`[data-radix-portal]`)||i.target===document.documentElement&&document.body.style.pointerEvents===`none`||i.target.closest(`[data-prevent-outside-click]`)||t(i)}}return document.addEventListener(L.POINTER_DOWN,r),document.addEventListener(L.TOUCH_START,r),()=>{document.removeEventListener(L.POINTER_DOWN,r),document.removeEventListener(L.TOUCH_START,r)}},[e,t,n])}var dC=e=>{let t=(0,B.useRef)(e);return Object.assign(t.current,e),t.current},fC=Ec(null),pC=({onCancel:e,onChange:t,onSelect:n,colorPickerType:r})=>{let i=lC({className:`excalidraw-eye-dropper-backdrop`,parentSelector:`.excalidraw-eye-dropper-container`}),a=cC(),o=tB(),s=Xz(),c=dC({app:s,onCancel:e,onChange:t,onSelect:n,selectedElements:An(o,a)}),{container:l}=eB();(0,B.useEffect)(()=>{let e=u.current;if(!e||!s.canvas||!i)return;let t=!1,n=s.canvas.getContext(`2d`),o=({clientX:e,clientY:t})=>{let r=n.getImageData((e-a.offsetLeft)*window.devicePixelRatio,(t-a.offsetTop)*window.devicePixelRatio,1,1).data;return Ds(r[0],r[1],r[2])},d=({clientX:n,clientY:i,altKey:a})=>{e.style.top=`${i+20}px`,e.style.left=`${n+20}px`;let s=o({clientX:n,clientY:i});t&&c.onChange(r,s,c.selectedElements,{altKey:a}),e.style.background=s},f=()=>{c.onCancel()},p=(e,t)=>{c.onSelect(e,t)},m=e=>{t=!0,e.stopImmediatePropagation()},h=e=>{t=!1,l?.focus(),e.stopImmediatePropagation(),e.preventDefault(),p(o(e),e)},g=e=>{e.key===M.ESCAPE&&(e.preventDefault(),e.stopImmediatePropagation(),f())};return i.tabIndex=-1,i.focus(),d({clientX:c.app.lastViewportPosition.x,clientY:c.app.lastViewportPosition.y,altKey:!1}),i.addEventListener(L.KEYDOWN,g),i.addEventListener(L.POINTER_DOWN,m),i.addEventListener(L.POINTER_UP,h),window.addEventListener(`pointermove`,d,{passive:!0}),window.addEventListener(L.BLUR,f),()=>{t=!1,i.removeEventListener(L.KEYDOWN,g),i.removeEventListener(L.POINTER_DOWN,m),i.removeEventListener(L.POINTER_UP,h),window.removeEventListener(`pointermove`,d),window.removeEventListener(L.BLUR,f)}},[c,s.canvas,i,r,l,a.offsetLeft,a.offsetTop]);let u=(0,B.useRef)(null);return uC(u,()=>{e()},e=>!!e.target.closest(`.excalidraw-eye-dropper-trigger, .excalidraw-eye-dropper-backdrop`)),i?(0,Sc.createPortal)((0,V.jsx)(`div`,{ref:u,className:`excalidraw-eye-dropper-preview`}),i):null},mC=B.forwardRef(({children:e,padding:t,className:n,style:r,"data-viewport-ui":i,"data-viewport-ui-name":a},o)=>(0,V.jsx)(`div`,{className:H(`Island`,n),style:{"--padding":t,...r},"data-viewport-ui":i,"data-viewport-ui-name":a,ref:o,children:e})),hC=B.forwardRef(({className:e,container:t,children:n,style:r,onClose:i,onKeyDown:a,onFocusOutside:o,onPointerLeave:s,onPointerDownOutside:c,preventAutoFocusOnTouch:l=!1},u)=>{let d=Qz(),f=d.formFactor===`phone`&&!d.isLandscape;return(0,V.jsx)(X_,{container:t,children:(0,V.jsxs)(Z_,{ref:u,className:H(`focus-visible-none`,e),"data-prevent-outside-click":!0,side:f?`bottom`:`right`,align:f?`center`:`start`,alignOffset:-16,sideOffset:20,collisionBoundary:t??void 0,style:{zIndex:`var(--zIndex-ui-styles-popup)`,marginLeft:d.formFactor===`phone`?`0.5rem`:void 0},onPointerLeave:s,onKeyDown:a,onFocusOutside:o,onPointerDownOutside:c,onOpenAutoFocus:e=>{l&&d.isTouchScreen&&e.preventDefault()},onCloseAutoFocus:e=>{e.stopPropagation(),e.preventDefault(),t&&!E(document.activeElement)&&t.focus(),i()},children:[(0,V.jsx)(mC,{padding:3,style:r,children:n}),(0,V.jsx)(Q_,{width:20,height:10,style:{fill:`var(--popup-bg-color)`,filter:`drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)`}})]})})}),gC=()=>document.querySelector(`.excalidraw-wysiwyg`),_C=()=>{let e=gC();return e?{start:e.selectionStart,end:e.selectionEnd}:null},vC=e=>{setTimeout(()=>{let t=gC();t&&(t.focus(),e&&(t.selectionStart=e.start,t.selectionEnd=e.end))},0)},yC=(e,t,n,r)=>{t&&r&&r();let i=t&&n?_C():null;e(),t&&n&&vC(i)},bC=()=>{let[e,t]=(0,B.useState)(null);return{saveCaretPosition:(0,B.useCallback)(()=>{let e=_C();t(e)},[]),restoreCaretPosition:(0,B.useCallback)(()=>{setTimeout(()=>{let n=gC();n&&(n.focus(),e&&(n.selectionStart=e.start,n.selectionEnd=e.end,t(null)))},0)},[e]),clearSavedPosition:(0,B.useCallback)(()=>{t(null)},[]),hasSavedPosition:!!e}},xC=(e=100)=>{let t=gC();if(t){let n=t.onblur;t.onblur=null,setTimeout(()=>{t.onblur=n},e)}},SC=({palette:e,color:t})=>{if(!t)return null;for(let[n,r]of Object.entries(e))if(Array.isArray(r)){let e=r.indexOf(t);if(e>-1)return{colorName:n,shade:e}}else if(r===t)return{colorName:n,shade:null};return null},CC=[[`q`,`w`,`e`,`r`,`t`],[`a`,`s`,`d`,`f`,`g`],[`z`,`x`,`c`,`v`,`b`]].flat(),wC=({color:e,palette:t})=>!Object.values(t).flat().includes(e),TC=(e,t,n)=>{let r={elementBackground:`backgroundColor`,elementStroke:`strokeColor`},i=e.filter(e=>{if(e.isDeleted)return!1;let i=e[r[t]];return wC({color:i,palette:n})}),a=new Map;return i.forEach(e=>{let n=e[r[t]];a.has(n)?a.set(n,a.get(n)+1):a.set(n,1)}),[...a.entries()].sort((e,t)=>t[1]-e[1]).map(e=>e[0]).slice(0,5)},EC=Ec(null),DC=({color:e,onChange:t,label:n,colorPickerType:r,placeholder:i})=>{let a=Qz(),[o,s]=(0,B.useState)(e),[c,l]=W(EC);(0,B.useEffect)(()=>{s(e)},[e]);let u=(0,B.useCallback)(e=>{let n=e.toLowerCase(),r=Rr(n);r&&t(r),s(n)},[t]),d=(0,B.useRef)(null),f=(0,B.useRef)(null);(0,B.useEffect)(()=>{d.current&&d.current.focus()},[c]);let[p,m]=W(fC);return(0,B.useEffect)(()=>()=>{m(null)},[m]),(0,V.jsxs)(`div`,{className:`color-picker__input-label`,children:[(0,V.jsx)(`div`,{className:`color-picker__input-hash`,children:`#`}),(0,V.jsx)(`input`,{ref:c===`hex`?d:void 0,style:{border:0,padding:0},spellCheck:!1,className:`color-picker-input`,"aria-label":n,onChange:e=>{u(e.target.value)},value:(o||``).replace(/^#/,``),onBlur:()=>{s(e)},tabIndex:-1,onFocus:()=>l(`hex`),onKeyDown:e=>{e.key!==M.TAB&&(e.key===M.ESCAPE&&f.current?.focus(),e.stopPropagation())},placeholder:i}),a.formFactor!==`phone`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{style:{width:`1px`,height:`1.25rem`,backgroundColor:`var(--default-border-color)`}}),(0,V.jsx)(`div`,{ref:f,className:H(`excalidraw-eye-dropper-trigger`,{selected:p}),onClick:()=>m(e=>e?null:{keepOpenOnAlt:!1,onSelect:e=>t(e),colorPickerType:r}),title:`${G(`labels.eyeDropper`)} \u2014 ${M.I.toLocaleUpperCase()} or ${Z(`Alt`)} `,children:Xx})]})]})},OC=({color:e,keyLabel:t,isShade:n=!1})=>(0,V.jsxs)(`div`,{className:`color-picker__button__hotkey-label`,style:{color:aa(e)?`#fff`:`#000`},children:[n&&`⇧`,t]}),kC=({colors:e,color:t,onChange:n,label:r})=>{let[i,a]=W(EC),o=(0,B.useRef)(null);return(0,B.useEffect)(()=>{o.current&&o.current.focus()},[t,i]),(0,V.jsx)(`div`,{className:`color-picker-content--default`,children:e.map((e,i)=>(0,V.jsxs)(`button`,{ref:t===e?o:void 0,tabIndex:-1,type:`button`,className:H(`color-picker__button color-picker__button--large has-outline`,{active:t===e,"is-transparent":e===`transparent`||!e}),onClick:()=>{n(e),a(`custom`)},title:e,"aria-label":r,style:{"--swatch-color":e},children:[(0,V.jsx)(`div`,{className:`color-picker__button-outline`}),(0,V.jsx)(OC,{color:e,keyLabel:i+1})]},i))})},AC=({palette:e,color:t,onChange:n,activeShade:r,showHotKey:i=!0})=>{let a=SC({color:t,palette:e}),[o,s]=W(EC),c=(0,B.useRef)(null);return(0,B.useEffect)(()=>{c.current&&o===`baseColors`&&c.current.focus()},[a?.colorName,o]),(0,V.jsx)(`div`,{className:`color-picker-content--default`,children:Object.entries(e).map(([e,t],o)=>{let l=(Array.isArray(t)?t[r]:t)||`transparent`,u=CC[o],d=G(`colors.${e.replace(/\d+/,``)}`,null,``);return(0,V.jsxs)(`button`,{ref:a?.colorName===e?c:void 0,tabIndex:-1,type:`button`,className:H(`color-picker__button color-picker__button--large has-outline`,{active:a?.colorName===e,"is-transparent":l===`transparent`||!l}),onClick:()=>{n(l),s(`baseColors`)},title:`${d}${l.startsWith(`#`)?` ${l}`:``} \u2014 ${u}`,"aria-label":`${d} \u2014 ${u}`,style:l?{"--swatch-color":l}:void 0,"data-testid":`color-${e}`,children:[(0,V.jsx)(`div`,{className:`color-picker__button-outline`}),i&&(0,V.jsx)(OC,{color:l,keyLabel:u})]},e)})})},jC=({children:e})=>(0,V.jsx)(`div`,{className:`color-picker__heading`,children:e}),MC=({color:e,onChange:t,palette:n,showHotKey:r})=>{let i=SC({color:e||`transparent`,palette:n}),[a,o]=W(EC),s=(0,B.useRef)(null);if((0,B.useEffect)(()=>{s.current&&a===`shades`&&s.current.focus()},[i,a]),i){let{colorName:e,shade:c}=i,l=n[e];if(Array.isArray(l))return(0,V.jsx)(`div`,{className:`color-picker-content--default shades`,children:l.map((n,i)=>(0,V.jsxs)(`button`,{ref:i===c&&a===`shades`?s:void 0,tabIndex:-1,type:`button`,className:H(`color-picker__button color-picker__button--large has-outline`,{active:i===c}),"aria-label":`Shade`,title:`${e} - ${i+1}`,style:n?{"--swatch-color":n}:void 0,onClick:()=>{t(n),o(`shades`)},children:[(0,V.jsx)(`div`,{className:`color-picker__button-outline`}),r&&(0,V.jsx)(OC,{color:n,keyLabel:i+1,isShade:!0})]},i))})}return(0,V.jsxs)(`div`,{className:`color-picker-content--default`,style:{position:`relative`},tabIndex:-1,children:[(0,V.jsx)(`button`,{type:`button`,tabIndex:-1,className:`color-picker__button color-picker__button--large color-picker__button--no-focus-visible`}),(0,V.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:G(`colorPicker.noShades`)})]})},NC=(e,t,n)=>{let r=Math.ceil(n/5);switch(t??=-1,e){case`ArrowLeft`:{let e=t-1;return e<0?n-1:e}case`ArrowRight`:return(t+1)%n;case`ArrowDown`:{let e=t+5;return e>=n?t%5:e}case`ArrowUp`:{let e=t-5,i=e<0?5*r+e:e;return i>=n?void 0:i}}},PC=({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 i=Number(e.code.slice(-1))-1;return n(r[t.colorName][i]),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(CC.includes(e.key)){let t=CC.indexOf(e.key),i=r[Object.keys(r)[t]];return n(Array.isArray(i)?i[o]:i),a(`baseColors`),!0}return!1},FC=({event:e,activeColorPickerSection:t,palette:n,color:r,onChange:i,customColors:a,setActiveColorPickerSection:o,updateData:s,activeShade:c,onEyeDropperToggle:l,onEscape:u})=>{if(e[M.CTRL_OR_CMD])return!1;if(e.key===M.ESCAPE)return u(e),!0;if(e.key===M.ALT)return l(!0),!0;if(e.key===M.I)return l(),!0;let d=SC({color:r,palette:n});if(e.key===M.TAB){let s={custom:!!a.length,baseColors:!0,shades:d?.shade!=null,hex:!0},c=Object.entries(s).reduce((e,[t,n])=>(n&&e.push(t),e),[]),l=c.indexOf(t),u=e.shiftKey?-1:1,f=c[l+u>c.length-1?0:l+u<0?c.length-1:l+u];return f&&o(f),f===`custom`?i(a[0]):f===`baseColors`&&(Object.entries(n).find(([e,t])=>Array.isArray(t)?t.includes(r):t===r?e:null)||i(Vs.black)),e.preventDefault(),e.stopPropagation(),!0}if(PC({e,colorObj:d,onChange:i,palette:n,customColors:a,setActiveColorPickerSection:o,activeShade:c}))return!0;if(t===`shades`&&d){let{shade:t}=d,r=NC(e.key,t,5);if(r!==void 0)return i(n[d.colorName][r]),!0}if(t===`baseColors`&&d){let{colorName:t}=d,r=Object.keys(n),a=r.indexOf(t),o=NC(e.key,a,r.length);if(o!==void 0){let e=n[r[o]];return i(Array.isArray(e)?e[c]:e),!0}}if(t===`custom`){let t=r==null?0:a.indexOf(r),n=NC(e.key,t,a.length);if(n!==void 0){let e=a[n];return i(e),!0}}return!1},IC=B.forwardRef(({color:e,onChange:t,type:n,elements:r,palette:i,updateData:a,children:o,showTitle:s,onEyeDropperToggle:c,onEscape:l,showHotKey:u=!0},d)=>{let f=s?n===`elementStroke`?G(`labels.stroke`):n===`elementBackground`?G(`labels.background`):null:null,[p]=B.useState(()=>n===`canvasBackground`?[]:TC(r,n,i)),[m,h]=W(EC),g=SC({color:e,palette:i});(0,B.useEffect)(()=>{if(!m){let t=!!e&&wC({color:e,palette:i}),n=t&&!p.includes(e);h(n?null:t?`custom`:g?.shade==null?`baseColors`:`shades`)}},[m,e,i,h,g,p]);let[_,v]=(0,B.useState)(g?.shade??(n===`elementBackground`?1:4));(0,B.useEffect)(()=>{g?.shade!=null&&v(g.shade);let e=e=>{e.key===M.ALT&&c(!1)};return document.addEventListener(L.KEYUP,e,{capture:!0}),()=>{document.removeEventListener(L.KEYUP,e,{capture:!0})}},[g,c]);let y=B.useRef(null);return(0,B.useImperativeHandle)(d,()=>y.current),(0,B.useEffect)(()=>{y?.current?.focus()},[]),(0,V.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":G(`labels.colorPicker`),children:(0,V.jsxs)(`div`,{ref:y,onKeyDown:n=>{FC({event:n,activeColorPickerSection:m,palette:i,color:e,onChange:t,onEyeDropperToggle:c,customColors:p,setActiveColorPickerSection:h,updateData:a,activeShade:_,onEscape:l})&&(n.preventDefault(),n.stopPropagation())},className:`color-picker-content properties-content`,tabIndex:-1,children:[f&&(0,V.jsx)(`div`,{className:`color-picker__title`,children:f}),!!p.length&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(jC,{children:G(`colorPicker.mostUsedCustomColors`)}),(0,V.jsx)(kC,{colors:p,color:e,label:G(`colorPicker.mostUsedCustomColors`),onChange:t})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(jC,{children:G(`colorPicker.colors`)}),(0,V.jsx)(AC,{color:e,palette:i,onChange:t,activeShade:_,showHotKey:u})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(jC,{children:G(`colorPicker.shades`)}),(0,V.jsx)(MC,{color:e,onChange:t,palette:i,showHotKey:u})]}),o]})})}),LC=({onChange:e,type:t,activeColor:n,topPicks:r})=>{let i;return t===`elementStroke`&&(i=Js),t===`elementBackground`&&(i=ps),t===`canvasBackground`&&(i=Dn),r&&(i=r),i?(0,V.jsx)(`div`,{className:`color-picker__top-picks`,children:i.map(t=>(0,V.jsx)(`button`,{className:H(`color-picker__button`,{active:t===n,"is-transparent":t===`transparent`||!t,"has-outline":!aa(t,240)}),style:{"--swatch-color":t},type:`button`,title:t,onClick:()=>e(t),"data-testid":`color-top-pick-${t}`,children:(0,V.jsx)(`div`,{className:`color-picker__button-outline`})},t))}):(console.error(`Invalid type for TopPicks`),null)},RC=({type:e,color:t,onChange:n,label:r,elements:i,palette:a=Vs,updateData:o,getOpenPopup:s,appState:c})=>{let{container:l}=eB(),u=$z(),d=u!==`full`,f=u===`mobile`,[,p]=W(EC),[m,h]=W(fC),g=(0,V.jsxs)(`div`,{children:[(0,V.jsx)(jC,{children:G(`colorPicker.hexCode`)}),(0,V.jsx)(DC,{color:t||``,label:r,onChange:e=>{n(e)},colorPickerType:e,placeholder:G(`colorPicker.color`)})]}),_=(0,B.useRef)(null),v=()=>{_.current?.focus()};return(0,V.jsx)(hC,{container:l,style:{maxWidth:`13rem`},preventAutoFocusOnTouch:!!c.editingTextElement,onFocusOutside:e=>{wi(e.target)||v(),e.preventDefault()},onPointerDownOutside:e=>{m&&e.preventDefault()},onClose:()=>{s()===e&&o({openPopup:null}),p(null),c.editingTextElement&&setTimeout(()=>{let e=document.querySelector(`.excalidraw-wysiwyg`);e&&e.focus()},0)},children:a?(0,V.jsx)(IC,{ref:_,palette:a,color:t,onChange:e=>{let t=c.editingTextElement?_C():null;n(e),c.editingTextElement&&t&&vC(t)},onEyeDropperToggle:t=>{h(r=>t?(r||={keepOpenOnAlt:!0,onSelect:n,colorPickerType:e},r.keepOpenOnAlt=!0,r):t===!1||r?null:{keepOpenOnAlt:!1,onSelect:n,colorPickerType:e})},onEscape:e=>{m?h(null):o({openPopup:null})},type:e,elements:i,updateData:o,showTitle:d,showHotKey:!f,children:g}):g})},zC=({label:e,color:t,type:n,mode:r=`background`,onToggle:i,editingTextElement:a})=>{let o=$z(),s=o!==`full`,c=o===`mobile`;return(0,V.jsxs)(Y_,{type:`button`,className:H(`color-picker__button active-color properties-trigger`,{"is-transparent":!t||t===`transparent`,"has-outline":!t||!aa(t,240),"compact-sizing":s,"mobile-border":c}),"aria-label":e,style:t?{"--swatch-color":t}:void 0,title:G(n===`elementStroke`?`labels.showStroke`:`labels.showBackground`),"data-openpopup":n,onClick:e=>{e.preventDefault(),e.stopPropagation(),a&&xC(),i()},children:[(0,V.jsx)(`div`,{className:`color-picker__button-outline`,children:!t&&Sb}),s&&t&&r===`stroke`&&(0,V.jsx)(`div`,{className:`color-picker__button-background`,children:(0,V.jsx)(`span`,{style:{color:t&&aa(t,240)?`#fff`:`#111`},children:zS})})]})},BC=({type:e,color:t,onChange:n,label:r,elements:i,palette:a=Vs,topPicks:o,updateData:s,appState:c})=>{let l=(0,B.useRef)(c.openPopup);(0,B.useEffect)(()=>{l.current=c.openPopup},[c.openPopup]);let u=$z()!==`full`;return(0,V.jsx)(`div`,{children:(0,V.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:H(`color-picker-container`,{"color-picker-container--no-top-picks":u}),children:[!u&&(0,V.jsx)(LC,{activeColor:t,onChange:n,type:e,topPicks:o}),!u&&(0,V.jsx)(oC,{}),(0,V.jsxs)(J_,{open:c.openPopup===e,onOpenChange:t=>{t&&s({openPopup:e})},children:[(0,V.jsx)(zC,{color:t,label:r,type:e,mode:e===`elementStroke`?`stroke`:`background`,editingTextElement:!!c.editingTextElement,onToggle:()=>{c.openPopup===e?s({openPopup:null}):(c.openPopup,s({openPopup:e}))}}),c.openPopup===e&&(0,V.jsx)(RC,{type:e,color:t,onChange:n,label:r,elements:i,palette:a,updateData:s,getOpenPopup:()=>l.current,appState:c})]})]})})},VC=B.forwardRef(({className:e,placeholder:t,onChange:n},r)=>(0,V.jsxs)(`div`,{className:H(`QuickSearch__wrapper`,e),children:[uS,(0,V.jsx)(`input`,{ref:r,className:`QuickSearch__input`,type:`text`,placeholder:t,onChange:e=>n(e.target.value.trim().toLowerCase())})]})),HC=({className:e,placeholder:t,children:n})=>{let r=!B.Children.count(n);return(0,V.jsx)(`div`,{className:H(`ScrollableList__wrapper`,e),role:`menu`,children:r?(0,V.jsx)(`div`,{className:`empty`,children:t}):n})},UC=({children:e,className:t=``,style:n,title:r})=>(0,V.jsxs)(`div`,{className:`dropdown-menu-group ${t}`,style:n,children:[r&&(0,V.jsx)(`p`,{className:`dropdown-menu-group-title`,children:r}),e]}),WC=UC;UC.displayName=`DropdownMenuGroup`;var GC=B.createContext({}),KC=(e=``,t=!1,n=!1)=>`dropdown-menu-item dropdown-menu-item-base ${e} ${t?`dropdown-menu-item--selected`:``} ${n?`dropdown-menu-item--hovered`:``}`.trim(),qC=e=>{let t=(0,B.useContext)(GC);return _(e,e=>{t.onSelect?.(e)})},JC=({children:e,...t})=>(0,V.jsx)(`span`,{...t,style:{textOverflow:`ellipsis`,overflow:`hidden`,whiteSpace:`nowrap`,...t.style},children:e}),YC=({textStyle:e,icon:t,shortcut:n,children:r,badge:i})=>{let a=Qz();return(0,V.jsxs)(V.Fragment,{children:[t&&(0,V.jsx)(`div`,{className:`dropdown-menu-item__icon`,children:t}),(0,V.jsx)(`div`,{style:e,className:`dropdown-menu-item__text`,children:(0,V.jsx)(JC,{children:r})}),i&&(0,V.jsx)(`div`,{className:`dropdown-menu-item__badge`,children:i}),n&&a.formFactor!==`phone`&&(0,V.jsx)(`div`,{className:`dropdown-menu-item__shortcut`,children:n})]})},XC=({icon:e,badge:t,value:n,children:r,shortcut:i,className:a,selected:o,onSelect:s,...c})=>{let l=qC(s);return(0,V.jsx)(v_,{className:`radix-menu-item`,onSelect:l,asChild:!0,children:(0,V.jsx)(`button`,{...c,value:n,className:KC(a,o),title:c.title??c[`aria-label`],children:(0,V.jsx)(YC,{icon:e,shortcut:i,badge:t,children:r})})})};XC.displayName=`DropdownMenuItem`;var ZC={GREEN:`green`,RED:`red`,BLUE:`blue`},QC=({type:e=ZC.BLUE,children:t})=>{let{theme:n}=nB(),r={display:`inline-flex`,marginLeft:`auto`,padding:`2px 4px`,borderRadius:6,fontSize:9,fontFamily:`Cascadia, monospace`,border:n===F.LIGHT?`1.5px solid white`:`none`};switch(e){case ZC.GREEN:Object.assign(r,{backgroundColor:`var(--background-color-badge)`,color:`var(--color-badge)`});break;case ZC.RED:Object.assign(r,{backgroundColor:`pink`,color:`darkred`});break;case ZC.BLUE:default:Object.assign(r,{background:`var(--color-promo)`,color:`var(--color-surface-lowest)`})}return(0,V.jsx)(`div`,{className:`DropDownMenuItemBadge`,style:r,children:t})};QC.displayName=`DropdownMenuItemBadge`,XC.Badge=QC;var $C=XC,ew=({event:e,inputRef:t,hoveredFont:n,filteredFonts:r,onClose:i,onSelect:a,onHover:o})=>{if(!e[M.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===M.F)return t.current?.focus(),!0;if(e.key===M.ESCAPE)return i(),!0;if(e.key===M.ENTER)return n?.value&&a(n.value),!0;if(e.key===M.ARROW_DOWN)return n?.next?o(n.next.value):r[0]?.value&&o(r[0].value),!0;if(e.key===M.ARROW_UP)return n?.prev?o(n.prev.value):r[r.length-1]?.value&&o(r[r.length-1].value),!0},tw=e=>{switch(e){case Nr.Excalifont:case Nr.Virgil:return Yy;case Nr.Nunito:case Nr.Helvetica:return Mx;case Nr[`Lilita One`]:return jx;case Nr[`Comic Shanns`]:case Nr.Cascadia:return Px;default:return Mx}},nw=(e,t)=>Object.entries(Nr).find(([,t])=>t===e)?.[0]??t[0]?.fontFace?.family??`Unknown`,rw=B.memo(({selectedFontFamily:e,hoveredFontFamily:t,onSelect:n,onHover:r,onLeave:i,onOpen:a,onClose:o})=>{let{container:s}=eB(),c=Xz(),{fonts:l}=c,{showDeprecatedFonts:u}=Zz(),d=$z(),[f,p]=(0,B.useState)(``),m=(0,B.useRef)(null),h=(0,B.useMemo)(()=>Array.from(Ve.registered.entries()).filter(([e,{metadata:t}])=>!t.private&&!t.fallback).map(([e,{metadata:t,fontFaces:n}])=>{let r={value:e,icon:tw(e),text:nw(e,n)};return t.deprecated&&Object.assign(r,{deprecated:t.deprecated,badge:{type:ZC.RED,placeholder:G(`fontList.badge.old`)}}),r}).sort((e,t)=>e.text.toLowerCase()>t.text.toLowerCase()?1:-1),[]),g=(0,B.useMemo)(()=>new Set(l.getSceneFamilies()),[e]),_=(0,B.useMemo)(()=>h.filter(e=>g.has(e.value)),[h,g]),v=(0,B.useMemo)(()=>h.filter(e=>!g.has(e.value)&&(u||!e.deprecated)),[h,g,u]),y=(0,B.useMemo)(()=>xs([..._,...v].filter(e=>e.text?.toLowerCase().includes(f))),[_,v,f]),b=(0,B.useMemo)(()=>{let n;return t?n=y.find(e=>e.value===t):e&&(n=y.find(t=>t.value===e)),!n&&f&&(y[0]?.value?r(y[0].value):i()),n},[t,e,f,y,r,i]),x=(0,B.useCallback)(e=>{let t=null;if(c.state.editingTextElement){let e=document.querySelector(`.excalidraw-wysiwyg`);e&&(t={start:e.selectionStart,end:e.selectionEnd})}n(e),c.state.editingTextElement&&t&&setTimeout(()=>{let e=document.querySelector(`.excalidraw-wysiwyg`);e&&t&&(e.focus(),e.selectionStart=t.start,e.selectionEnd=t.end)},0)},[n,c.state.editingTextElement]),S=(0,B.useCallback)(e=>{ew({event:e,inputRef:m,hoveredFont:b,filteredFonts:y,onSelect:x,onHover:r,onClose:o})&&(e.preventDefault(),e.stopPropagation())},[b,y,x,r,o]);(0,B.useEffect)(()=>(a(),()=>{o()}),[]);let C=(0,B.useMemo)(()=>y.filter(e=>g.has(e.value)),[y,g]),w=(0,B.useMemo)(()=>y.filter(e=>!g.has(e.value)),[y,g]),T=({font:t,order:n})=>{let i=(0,B.useRef)(null),a=t.value===b?.value,o=t.value===e;return(0,B.useEffect)(()=>{a&&(n===0?i.current?.scrollIntoView?.({block:`end`}):i.current?.scrollIntoView?.({block:`nearest`}))},[a,n]),(0,V.jsx)(`button`,{ref:i,type:`button`,value:t.value,className:KC(``,o,a),title:t.text,tabIndex:o?0:-1,onClick:e=>{x(Number(e.currentTarget.value))},onMouseMove:()=>{b?.value!==t.value&&r(t.value)},children:(0,V.jsx)(YC,{icon:t.icon,badge:t.badge&&(0,V.jsx)(QC,{type:t.badge.type,children:t.badge.placeholder}),textStyle:{fontFamily:br({fontFamily:t.value})},children:t.text})})},E=[];return C.length&&E.push((0,V.jsx)(WC,{title:G(`fontList.sceneFonts`),children:C.map((e,t)=>(0,V.jsx)(T,{font:e,order:t},e.value))},`group_1`)),w.length&&E.push((0,V.jsx)(WC,{title:G(`fontList.availableFonts`),children:w.map((e,t)=>(0,V.jsx)(T,{font:e,order:t+C.length},e.value))},`group_2`)),(0,V.jsxs)(hC,{className:`properties-content`,container:s,style:{width:`15rem`},onClose:()=>{o(),c.state.editingTextElement&&setTimeout(()=>{let e=document.querySelector(`.excalidraw-wysiwyg`);e&&e.focus()},0)},onPointerLeave:i,onKeyDown:S,preventAutoFocusOnTouch:!!c.state.editingTextElement,children:[d===`full`&&(0,V.jsx)(VC,{ref:m,placeholder:G(`quickSearch.placeholder`),onChange:ln(p,20)}),(0,V.jsx)(HC,{className:`dropdown-menu fonts manual-hover`,placeholder:G(`fontList.empty`),children:E.length?E:null})]})},(e,t)=>e.selectedFontFamily===t.selectedFontFamily&&e.hoveredFontFamily===t.hoveredFontFamily),iw=({selectedFontFamily:e,isOpened:t=!1,compactMode:n=!1})=>{let r=rB(),i=n?{...te,width:`2rem`,height:`2rem`}:{};return(0,V.jsx)(Y_,{asChild:!0,children:(0,V.jsx)(`div`,{"data-openpopup":`fontFamily`,className:`properties-trigger`,children:(0,V.jsx)(Y,{type:`toggle`,icon:Xy,title:G(`labels.showFonts`),"aria-label":G(`labels.showFonts`),className:`standalone properties-trigger`,"data-testid":`font-family-show-fonts`,checked:t,onSelect:()=>{r(e=>({openPopup:e.openPopup===`fontFamily`?null:e.openPopup}))},style:{border:`none`,...i}})})})},aw=[{value:Nr.Excalifont,icon:Yy,text:G(`labels.handDrawn`),testId:`font-family-hand-drawn`},{value:Nr.Nunito,icon:Mx,text:G(`labels.normal`),testId:`font-family-normal`},{value:Nr[`Comic Shanns`],icon:Px,text:G(`labels.code`),testId:`font-family-code`}];new Set(aw.map(e=>e.value));var ow=B.memo(({isOpened:e,selectedFontFamily:t,hoveredFontFamily:n,onSelect:r,onHover:i,onLeave:a,onPopupChange:o,compactMode:s=!1})=>{let c=(0,B.useMemo)(()=>aw,[]),l=(0,B.useCallback)(e=>{e&&r(e)},[r]);return(0,V.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:H(`FontPicker__container`,{"FontPicker__container--compact":s}),children:[!s&&(0,V.jsx)(`div`,{className:`buttonList`,children:(0,V.jsx)(aC,{type:`button`,options:c,value:t,onClick:l})}),!s&&(0,V.jsx)(oC,{}),(0,V.jsxs)(J_,{open:e,onOpenChange:o,children:[(0,V.jsx)(iw,{selectedFontFamily:t,isOpened:e,compactMode:s}),e&&(0,V.jsx)(rw,{selectedFontFamily:t,hoveredFontFamily:n,onSelect:l,onHover:i,onLeave:a,onOpen:()=>o(!0),onClose:()=>o(!1)})]})]})},(e,t)=>e.isOpened===t.isOpened&&e.selectedFontFamily===t.selectedFontFamily&&e.hoveredFontFamily===t.hoveredFontFamily),sw=({className:e,icon:t,size:n=`1em`})=>(0,V.jsx)(`span`,{className:e,style:{width:n,height:`100%`,margin:`0 0.5ex 0 0.5ex`,display:`inline-flex`,lineHeight:0,verticalAlign:`middle`,flex:`0 0 auto`},children:t}),cw=({label:e,open:t,openTrigger:n,children:r,className:i,showCollapsedIcon:a=!0})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{style:{cursor:`pointer`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},className:i,onClick:n,children:[e,a&&(0,V.jsx)(sw,{icon:t?PS:NS})]}),t&&(0,V.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`},children:r})]}),lw=Ec(!1),uw=4,dw=`default`,fw=e=>e.flatMap(e=>e.options),pw=(e,t)=>{for(let n of e){let e=n.options.find(t);if(e)return e}return null},mw=(e,t)=>e.some(e=>e.options.some(t)),hw=e=>e.flatMap(e=>Array.from({length:Math.ceil(e.options.length/uw)},(t,n)=>e.options.slice(n*uw,n*uw+uw)));function gw({visibleSections:e,hiddenSections:t=[],value:n,label:r,onChange:i,onClose:a}){let{container:o}=eB(),[s,c]=W(lw),l=fw([...e,...t]),u=hw([...e,...s?t:[]]),d=e=>{let t=l.find(t=>t.keyBinding===e.key.toLowerCase());if(!(e.metaKey||e.altKey||e.ctrlKey)&&t)i(t.value),e.preventDefault();else if(e.key===M.TAB){let t=l.findIndex(e=>e.value===n),r=e.shiftKey?(l.length+t-1)%l.length:(t+1)%l.length;i(l[r].value)}else if(da(e.key)){let t=Sy().rtl,r=l.findIndex(e=>e.value===n);if(r!==-1){let a=l.length,o=r;switch(e.key){case t?M.ARROW_LEFT:M.ARROW_RIGHT:o=(r+1)%a;break;case t?M.ARROW_RIGHT:M.ARROW_LEFT:o=(a+r-1)%a;break;case M.ARROW_DOWN:{let t=u.findIndex(e=>e.some(e=>e.value===n)),a=u[t];if(t!==-1&&a){let o=a.findIndex(e=>e.value===n),s=u[(t+1)%u.length];i((s[Math.min(o,s.length-1)]??l[r]).value),e.preventDefault(),e.nativeEvent.stopImmediatePropagation(),e.stopPropagation();return}break}case M.ARROW_UP:{let t=u.findIndex(e=>e.some(e=>e.value===n)),a=u[t];if(t!==-1&&a){let o=a.findIndex(e=>e.value===n),s=u[(u.length+t-1)%u.length];i((s[Math.min(o,s.length-1)]??l[r]).value),e.preventDefault(),e.nativeEvent.stopImmediatePropagation(),e.stopPropagation();return}break}}i(l[o].value)}e.preventDefault()}else(e.key===M.ESCAPE||e.key===M.ENTER)&&(e.preventDefault(),a());e.nativeEvent.stopImmediatePropagation(),e.stopPropagation()};(0,B.useEffect)(()=>{mw(t,e=>e.value===n)&&c(!0)},[n,t,c]);let f=e=>(0,V.jsx)(`div`,{className:`picker-content`,children:e.map(e=>(0,V.jsxs)(`button`,{type:`button`,className:H(`picker-option`,{active:n===e.value}),onClick:()=>{i(e.value)},title:e.keyBinding?`${e.text} \u2014 ${e.keyBinding.toUpperCase()}`:e.text,"aria-label":e.text||`none`,"aria-keyshortcuts":e.keyBinding||void 0,ref:t=>{n===e.value&&setTimeout(()=>{t?.focus()},0)},children:[e.icon,e.keyBinding&&(0,V.jsx)(`span`,{className:`picker-keybinding`,children:e.keyBinding})]},e.text))}),p=e=>e.map((e,t)=>e.name===dw?(0,V.jsx)(B.Fragment,{children:f(e.options)},`${e.name}-${t}`):(0,V.jsxs)(`div`,{className:`picker-section`,children:[(0,V.jsx)(`div`,{className:`picker-section-label`,children:e.name}),f(e.options)]},`${e.name}-${t}`));return(0,V.jsx)(Z_,{className:`picker`,role:`dialog`,"aria-modal":`true`,"aria-label":r,side:`bottom`,align:`start`,sideOffset:12,alignOffset:12,style:{zIndex:`var(--zIndex-ui-styles-popup)`},onKeyDown:d,collisionBoundary:o??void 0,children:(0,V.jsxs)(`div`,{className:`picker-sections`,children:[p(e),t.length>0&&(0,V.jsx)(cw,{label:G(`labels.more_options`),open:s,openTrigger:()=>{c(e=>!e)},className:`picker-collapsible`,children:(0,V.jsx)(`div`,{className:`picker-sections`,children:p(t)})})]})})}function _w({value:e,label:t,visibleSections:n,hiddenSections:r,onChange:i}){let[a,o]=B.useState(!1),s=(0,B.useMemo)(()=>pw(n,t=>t.value===e)??pw(r??[],t=>t.value===e),[n,r,e]);return(0,V.jsx)(`div`,{children:(0,V.jsxs)(J_,{open:a,onOpenChange:e=>o(e),children:[(0,V.jsx)(Y_,{type:`button`,"aria-label":t,onClick:()=>o(!a),className:a?`active`:``,children:s?.icon}),a&&(0,V.jsx)(gw,{visibleSections:n,hiddenSections:r,value:e,label:t,onChange:i,onClose:()=>{o(!1)}})]})})}var vw=({label:e,value:t,onChange:n,min:r=0,max:i=100,step:a=10,minLabel:o=r,hasCommonValue:s=!0,testId:c})=>{let l=B.useRef(null),u=B.useRef(null);return(0,B.useEffect)(()=>{if(l.current&&u.current){let e=l.current,n=u.current,a=e.offsetWidth,o=parseFloat(getComputedStyle(e).getPropertyValue(`--slider-thumb-size`))||16,s=(t-r)/(i-r||1)*100,c=s/100*(a-o)+o/2;n.style.left=`${c}px`,e.style.background=`linear-gradient(to right, var(--color-slider-track) 0%, var(--color-slider-track) ${s}%, var(--button-bg) ${s}%, var(--button-bg) 100%)`}},[i,r,t]),(0,V.jsxs)(`label`,{className:`control-label`,children:[e,(0,V.jsxs)(`div`,{className:`range-wrapper`,children:[(0,V.jsx)(`input`,{style:{"--color-slider-track":s?void 0:`var(--button-bg)`},ref:l,type:`range`,min:r,max:i,step:a,onChange:e=>{n(+e.target.value)},value:t,className:`range-input`,"data-testid":c}),(0,V.jsx)(`div`,{className:`value-bubble`,ref:u,children:t===r?null:t}),(0,V.jsx)(`div`,{className:`zero-label`,children:o})]})]})},yw=.1,bw=e=>{let t=Fi(e.editorInterface);return{stylesPanelMode:t,isCompact:t!==`full`,isMobile:t===`mobile`}},xw=(e,t,n,r=!1)=>{let i=Pa(An(e,t,{includeBoundTextElement:r}));return e.map(e=>i.get(e.id)||e.id===t.editingTextElement?.id?(ko(e)||console.error(`[NONDELETED][INVARIANT] changeProperty(): skipping deleted selected/editing element`),n(e)):e)},Sw=function(e,t,n,r,i){let a=t.state.editingTextElement,o=Sa(e),s=null;if(a&&(s=n(a)),!s)if(ha(o,t.state)){let e=t.scene.getSelectedElements(t.state);s=ma(r===!0?e:e.filter(e=>r(e)),n)??(typeof i==`function`?i(!0):i)}else s=typeof i==`function`?i(!1):i;return s},Cw=(e,t,n)=>xo(t)||!t.autoResize?t:n.mutateElement(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}),ww=(e,t,n,r,i)=>{let a=new Set,o=xw(e,t,e=>{if(R(e)){let t=r(e);a.add(t);let i=j(e,{fontSize:t});return Fn(i,n.scene.getContainerElement(e),n.scene),i=Cw(e,i,n.scene),i}return e},!0);return An(e,t,{includeBoundTextElement:!0}).forEach(e=>{R(e)&&Rs(e,n.scene)}),{elements:o,appState:{...t,currentItemFontSize:a.size===1?[...a][0]:i??t.currentItemFontSize},captureUpdate:P.IMMEDIATELY}};X({name:`changeStrokeColor`,label:`labels.stroke`,trackEvent:!1,perform:(e,t,n)=>({...n?.currentItemStrokeColor&&{elements:xw(e,t,e=>Do(e.type)?j(e,{strokeColor:n.currentItemStrokeColor}):e,!0)},appState:{...t,...n},captureUpdate:n?.currentItemStrokeColor?P.IMMEDIATELY:P.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{stylesPanelMode:a}=bw(r);return(0,V.jsxs)(V.Fragment,{children:[a===`full`&&(0,V.jsx)(`h3`,{"aria-hidden":`true`,children:G(`labels.stroke`)}),(0,V.jsx)(BC,{topPicks:Js,palette:rs,type:`elementStroke`,label:G(`labels.stroke`),color:Sw(e,r,e=>e.strokeColor,!0,e=>e?null:t.currentItemStrokeColor),onChange:e=>n({currentItemStrokeColor:e}),elements:e,appState:t,updateData:n})]})}}),X({name:`changeBackgroundColor`,label:`labels.changeBackground`,trackEvent:!1,perform:(e,t,n,r)=>{if(!n?.currentItemBackgroundColor)return{appState:{...t,...n},captureUpdate:P.EVENTUALLY};let i,a=r.scene.getSelectedElements(t);if(!bo(n.currentItemBackgroundColor)&&a.every(e=>mr(e)&&Ut(e.points))){let t=Pa(a);i=e.map(e=>t.has(e.id)&&mr(e)?j(e,{backgroundColor:n.currentItemBackgroundColor,...h(e,!0)}):e)}else i=xw(e,t,e=>j(e,{backgroundColor:n.currentItemBackgroundColor}));return{elements:i,appState:{...t,...n},captureUpdate:P.IMMEDIATELY}},PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{stylesPanelMode:a}=bw(r);return(0,V.jsxs)(V.Fragment,{children:[a===`full`&&(0,V.jsx)(`h3`,{"aria-hidden":`true`,children:G(`labels.background`)}),(0,V.jsx)(BC,{topPicks:ps,palette:yt,type:`elementBackground`,label:G(`labels.background`),color:Sw(e,r,e=>e.backgroundColor,!0,e=>e?null:t.currentItemBackgroundColor),onChange:e=>n({currentItemBackgroundColor:e}),elements:e,appState:t,updateData:n})]})}}),X({name:`changeFillStyle`,label:`labels.fill`,trackEvent:!1,perform:(e,t,n,r)=>(rC(`element`,`changeFillStyle`,`${n} (${r.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),{elements:xw(e,t,e=>j(e,{fillStyle:n})),appState:{...t,currentItemFillStyle:n},captureUpdate:P.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=An(e,t),a=i.length>0&&i.every(e=>e.fillStyle===`zigzag`);return(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.fill`)}),(0,V.jsx)(`div`,{className:`buttonList`,children:(0,V.jsx)(aC,{type:`button`,options:[{value:`hachure`,text:`${G(a?`labels.zigzag`:`labels.hachure`)} (${Z(`Alt-Click`)})`,icon:a?Yb:Xb,active:a?!0:void 0,testId:`fill-hachure`},{value:`cross-hatch`,text:G(`labels.crossHatch`),icon:Zb,testId:`fill-cross-hatch`},{value:`solid`,text:G(`labels.solid`),icon:Qb,testId:`fill-solid`}],value:Sw(e,r,e=>e.fillStyle,e=>e.hasOwnProperty(`fillStyle`),e=>e?null:t.currentItemFillStyle),onClick:(e,t)=>{n(t.altKey&&e===`hachure`&&i.every(e=>e.fillStyle===`hachure`)?`zigzag`:e)}})})]})}});var Tw=e=>Oo.find(t=>ga(e.type,t)===e.strokeWidth)??null,Ew=(e,t)=>ga(e.type,t);X({name:`changeStrokeWidth`,label:`labels.strokeWidth`,trackEvent:!1,perform:(e,t,n)=>(pe(n,`actionChangeStrokeWidth: value must be defined`),{elements:xw(e,t,e=>j(e,{strokeWidth:Ew(e,n)})),appState:{...t,currentItemStrokeWidthKey:n},captureUpdate:P.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.strokeWidth`)}),(0,V.jsx)(`div`,{className:`buttonList`,children:(0,V.jsx)(aC,{group:`stroke-width`,options:[{value:`thin`,text:G(`labels.thin`),icon:$b,testId:`strokeWidth-thin`},{value:`medium`,text:G(`labels.medium`),icon:ex,testId:`strokeWidth-medium`},{value:`bold`,text:G(`labels.bold`),icon:tx,testId:`strokeWidth-bold`}],value:Sw(e,r,Tw,e=>e.hasOwnProperty(`strokeWidth`),e=>e?null:t.currentItemStrokeWidthKey),onChange:e=>n(e)})})]})}),X({name:`changeSloppiness`,label:`labels.sloppiness`,trackEvent:!1,perform:(e,t,n)=>({elements:xw(e,t,e=>j(e,{seed:dr(),roughness:n})),appState:{...t,currentItemRoughness:n},captureUpdate:P.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.sloppiness`)}),(0,V.jsx)(`div`,{className:`buttonList`,children:(0,V.jsx)(aC,{group:`sloppiness`,options:[{value:0,text:G(`labels.architect`),icon:ix},{value:1,text:G(`labels.artist`),icon:ax},{value:2,text:G(`labels.cartoonist`),icon:ox}],value:Sw(e,r,e=>e.roughness,e=>e.hasOwnProperty(`roughness`),e=>e?null:t.currentItemRoughness),onChange:e=>n(e)})})]})}),X({name:`changeFreedrawMode`,label:`labels.pressure`,trackEvent:!1,perform:(e,t,n)=>{let r=n||`constant`;return{elements:xw(e,t,e=>e.type===`freedraw`?j(e,{strokeOptions:{...e.strokeOptions,variability:r}}):e),appState:{...t,currentItemStrokeVariability:r},captureUpdate:P.IMMEDIATELY}},PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let a=Sw(e,r,e=>e.strokeOptions?.variability,e=>e.type===`freedraw`,e=>e?null:t.currentItemStrokeVariability)??t.currentItemStrokeVariability;if(i?.cycle){let e=a===`variable`;return(0,V.jsx)(Y,{type:`button`,icon:e?cx:sx,title:G(`labels.pressure`),"aria-label":G(`labels.pressure`),onClick:()=>n(e?`constant`:`variable`)})}return(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.pressure`)}),(0,V.jsx)(`div`,{className:`buttonList`,children:(0,V.jsx)(aC,{group:`strokeOptions.variability`,options:[{value:`constant`,text:G(`labels.pressure_constant`),icon:sx},{value:`variable`,text:G(`labels.pressure_variable`),icon:cx}],value:a,onChange:e=>n(e)})})]})}}),X({name:`changeStrokeStyle`,label:`labels.strokeStyle`,trackEvent:!1,perform:(e,t,n)=>({elements:xw(e,t,e=>j(e,{strokeStyle:n})),appState:{...t,currentItemStrokeStyle:n},captureUpdate:P.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.strokeStyle`)}),(0,V.jsx)(`div`,{className:`buttonList`,children:(0,V.jsx)(aC,{group:`strokeStyle`,options:[{value:`solid`,text:G(`labels.strokeStyle_solid`),icon:$b},{value:`dashed`,text:G(`labels.strokeStyle_dashed`),icon:nx},{value:`dotted`,text:G(`labels.strokeStyle_dotted`),icon:rx}],value:Sw(e,r,e=>e.strokeStyle,e=>e.hasOwnProperty(`strokeStyle`),e=>e?null:t.currentItemStrokeStyle),onChange:e=>n(e)})})]})}),X({name:`changeOpacity`,label:`labels.opacity`,trackEvent:!1,perform:(e,t,n)=>({elements:xw(e,t,e=>j(e,{opacity:n}),!0),appState:{...t,currentItemOpacity:n},captureUpdate:P.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,app:n,updateData:r})=>{let i=Sw(e,n,e=>e.opacity,!0,e=>e?null:t.currentItemOpacity);return(0,V.jsx)(vw,{label:G(`labels.opacity`),value:i??t.currentItemOpacity,hasCommonValue:i!==null,onChange:r,min:0,max:100,step:10,testId:`opacity`})}}),X({name:`changeFontSize`,label:`labels.fontSize`,trackEvent:!1,perform:(e,t,n,r)=>ww(e,t,r,()=>(pe(n,`actionChangeFontSize: Expected a font size value`),n),n),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{isCompact:a}=bw(r);return(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.fontSize`)}),(0,V.jsx)(`div`,{className:`buttonList`,children:(0,V.jsx)(aC,{group:`font-size`,options:[{value:pc.sm,text:G(`labels.small`),icon:Ex,testId:`fontSize-small`},{value:pc.md,text:G(`labels.medium`),icon:Dx,testId:`fontSize-medium`},{value:pc.lg,text:G(`labels.large`),icon:Ox,testId:`fontSize-large`},{value:pc.xl,text:G(`labels.veryLarge`),icon:kx,testId:`fontSize-veryLarge`}],value:Sw(e,r,e=>{if(R(e))return e.fontSize;let t=So(e,r.scene.getNonDeletedElementsMap());return t?t.fontSize:null},e=>R(e)||So(e,r.scene.getNonDeletedElementsMap())!==null,e=>e?null:t.currentItemFontSize||20),onChange:e=>{yC(()=>n(e),a,!!t.editingTextElement,i?.onPreventClose)}})})]})}});var Dw=X({name:`decreaseFontSize`,label:`labels.decreaseFontSize`,icon:Ax,trackEvent:!1,perform:(e,t,n,r)=>ww(e,t,r,e=>Math.round(1/(1+yw)*e.fontSize)),keyTest:e=>e[M.CTRL_OR_CMD]&&e.shiftKey&&(e.key===M.CHEVRON_LEFT||e.key===M.COMMA)}),Ow=X({name:`increaseFontSize`,label:`labels.increaseFontSize`,icon:Ax,trackEvent:!1,perform:(e,t,n,r)=>ww(e,t,r,e=>Math.round(e.fontSize*(1+yw))),keyTest:e=>e[M.CTRL_OR_CMD]&&e.shiftKey&&(e.key===M.CHEVRON_RIGHT||e.key===M.PERIOD)});X({name:`changeFontFamily`,label:`labels.fontFamily`,trackEvent:!1,perform:(e,t,n,r)=>{let{cachedElements:i,resetAll:a,resetContainers:o,...s}=n;if(a)return{elements:xw(e,t,e=>{let t=i?.get(e.id);return t?j(e,{...t}):e},!0),appState:{...t,...s},captureUpdate:P.NEVER};pe(n,`actionChangeFontFamily: value must be defined`);let{currentItemFontFamily:c,currentHoveredFontFamily:l}=n,u=P.EVENTUALLY,d,f=!1;if(c)d=c,u=P.IMMEDIATELY;else if(l){d=l,u=P.EVENTUALLY;let n=An(e,t,{includeBoundTextElement:!0}).filter(e=>R(e));if(n.length>200)f=!0;else{let e=0,t=0;for(;e<n.length&&t<5e3;){let r=n[e];t+=r?.originalText.length||0,e++}t>5e3&&(f=!0)}}let p={appState:{...t,...s},captureUpdate:u};if(d&&!f){let n=new Map,a=new Set,s=!1,u=Array.from(Ve.loadedFontsCache.values()),f=Object.entries(Nr).find(([e,t])=>t===d)?.[0];l&&f&&u.some(e=>e.startsWith(f))&&(s=!0),Object.assign(p,{elements:xw(e,t,e=>{if(R(e)&&(e.fontFamily!==d||c)){let t=j(e,{fontFamily:d,lineHeight:mo(d)}),c=i?.get(e.containerId||``)||{},l=r.scene.getContainerElement(e);return o&&l&&c&&r.scene.mutateElement(l,{...c}),s||(a=new Set([...a,...Array.from(t.originalText)])),n.set(t,l),t}return e},!0)});let m=`10px ${br({fontFamily:d})}`,h=Array.from(a.values()).join();if(s||window.document.fonts.check(m,h))for(let[e,t]of n)Fn(e,t,r.scene);else window.document.fonts.load(m,h).then(e=>{for(let[e,t]of n){let n=r.scene.getElement(e.id),i=t?r.scene.getElement(t.id):null;n&&Fn(n,i,r.scene)}r.fonts.onLoaded(e)})}return p},PanelComponent:({elements:e,appState:t,app:n,updateData:r})=>{let i=(0,B.useRef)(new Map),a=(0,B.useRef)(null),[o,s]=(0,B.useState)({}),c=(0,B.useRef)(!0),{stylesPanelMode:l,isCompact:u}=bw(n),d=(0,B.useMemo)(()=>{let r=(e,r)=>Sw(e,n,e=>{if(R(e))return e.fontFamily;let t=So(e,r);return t?t.fontFamily:null},e=>R(e)||So(e,r)!==null,e=>e?null:t.currentItemFontFamily||Kt);return o.openPopup===`fontFamily`&&t.openPopup===`fontFamily`?r(Array.from(i.current?.values()??[]),i.current):!o.openPopup&&t.openPopup!==`fontFamily`?r(e,n.scene.getNonDeletedElementsMap()):a.current},[o.openPopup,t,e,n]);return(0,B.useEffect)(()=>{a.current=d},[d]),(0,B.useEffect)(()=>{Object.keys(o).length&&(r(o),s({}))},[o]),(0,B.useEffect)(()=>(c.current=!1,()=>{c.current=!0}),[]),(0,V.jsxs)(V.Fragment,{children:[l===`full`&&(0,V.jsx)(`legend`,{children:G(`labels.fontFamily`)}),(0,V.jsx)(ow,{isOpened:t.openPopup===`fontFamily`,selectedFontFamily:d,hoveredFontFamily:t.currentHoveredFontFamily,compactMode:l!==`full`,onSelect:e=>{yC(()=>{s({openPopup:null,currentHoveredFontFamily:null,currentItemFontFamily:e}),i.current.clear()},u,!!t.editingTextElement)},onHover:e=>{s({currentHoveredFontFamily:e,cachedElements:new Map(i.current),resetContainers:!0})},onLeave:()=>{s({currentHoveredFontFamily:null,cachedElements:new Map(i.current),resetAll:!0})},onPopupChange:r=>{if(r){i.current.clear();let{editingTextElement:r}=t;if(r?.type===`text`){let e=n.scene.getElement(r.id);i.current.set(r.id,j(e||r,{},!0))}else{let n=An(e,t,{includeBoundTextElement:!0});for(let e of n)i.current.set(e.id,j(e,{},!0))}s({...o,openPopup:`fontFamily`})}else{let e={currentHoveredFontFamily:null,cachedElements:new Map(i.current),resetAll:!0};s({...e}),i.current.clear(),u&&t.editingTextElement&&vC(null)}}})]})}}),X({name:`changeTextAlign`,label:`Change text alignment`,trackEvent:!1,perform:(e,t,n,r)=>({elements:xw(e,t,e=>{if(R(e)){let t=j(e,{textAlign:n});return Fn(t,r.scene.getContainerElement(e),r.scene),t}return e},!0),appState:{...t,currentItemTextAlign:n},captureUpdate:P.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let a=r.scene.getNonDeletedElementsMap(),{isCompact:o}=bw(r);return(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.textAlign`)}),(0,V.jsx)(`div`,{className:`buttonList`,children:(0,V.jsx)(aC,{group:`text-align`,options:[{value:`left`,text:G(`labels.left`),icon:Fx,testId:`align-left`},{value:`center`,text:G(`labels.center`),icon:Ix,testId:`align-horizontal-center`},{value:`right`,text:G(`labels.right`),icon:Lx,testId:`align-right`}],value:Sw(e,r,e=>{if(R(e))return e.textAlign;let t=So(e,a);return t?t.textAlign:null},e=>R(e)||So(e,a)!==null,e=>e?null:t.currentItemTextAlign),onChange:e=>{yC(()=>n(e),o,!!t.editingTextElement,i?.onPreventClose)}})})]})}}),X({name:`changeVerticalAlign`,label:`Change vertical alignment`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:xw(e,t,e=>{if(R(e)){let t=j(e,{verticalAlign:n});return Fn(t,r.scene.getContainerElement(e),r.scene),t}return e},!0),appState:{...t},captureUpdate:P.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{isCompact:a}=bw(r);return(0,V.jsx)(`fieldset`,{children:(0,V.jsx)(`div`,{className:`buttonList`,children:(0,V.jsx)(aC,{group:`text-align`,options:[{value:zs.TOP,text:G(`labels.alignTop`),icon:(0,V.jsx)(Rx,{theme:t.theme}),testId:`align-top`},{value:zs.MIDDLE,text:G(`labels.centerVertically`),icon:(0,V.jsx)(Bx,{theme:t.theme}),testId:`align-middle`},{value:zs.BOTTOM,text:G(`labels.alignBottom`),icon:(0,V.jsx)(zx,{theme:t.theme}),testId:`align-bottom`}],value:Sw(e,r,e=>{if(R(e)&&e.containerId)return e.verticalAlign;let t=So(e,r.scene.getNonDeletedElementsMap());return t?t.verticalAlign:null},e=>R(e)||So(e,r.scene.getNonDeletedElementsMap())!==null,e=>e?null:zs.MIDDLE),onChange:e=>{yC(()=>n(e),a,!!t.editingTextElement,i?.onPreventClose)}})})})}}),X({name:`changeRoundness`,label:`Change edge roundness`,trackEvent:!1,perform:(e,t,n)=>({elements:xw(e,t,e=>Ti(e)?e:j(e,{roundness:n===`round`?{type:jr(e.type)?Go.ADAPTIVE_RADIUS:Go.PROPORTIONAL_RADIUS}:null})),appState:{...t,currentItemRoundness:n},captureUpdate:P.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,renderAction:i})=>{let a=ca(Sa(e),t).some(e=>e.roundness?.type===Go.LEGACY);return(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.edges`)}),(0,V.jsxs)(`div`,{className:`buttonList`,children:[(0,V.jsx)(aC,{group:`edges`,options:[{value:`sharp`,text:G(`labels.sharp`),icon:lx},{value:`round`,text:G(`labels.round`),icon:ux}],value:Sw(e,r,e=>a?null:e.roundness?`round`:`sharp`,e=>!Mr(e)&&e.hasOwnProperty(`roundness`),e=>e?null:t.currentItemRoundness),onChange:e=>n(e)}),i(`togglePolygon`)]})]})}});var kw=e=>({visibleSections:[{name:`default`,options:[{value:null,text:G(`labels.arrowhead_none`),keyBinding:`q`,icon:(0,V.jsx)(dx,{flip:e})},{value:`arrow`,text:G(`labels.arrowhead_arrow`),keyBinding:`w`,icon:(0,V.jsx)(fx,{flip:e})},{value:`triangle`,text:G(`labels.arrowhead_triangle`),icon:(0,V.jsx)(px,{flip:e}),keyBinding:`e`},{value:`triangle_outline`,text:G(`labels.arrowhead_triangle_outline`),icon:(0,V.jsx)(mx,{flip:e}),keyBinding:`r`}]}],hiddenSections:[{name:`default`,options:[{value:`circle`,text:G(`labels.arrowhead_circle`),keyBinding:`a`,icon:(0,V.jsx)(hx,{flip:e})},{value:`circle_outline`,text:G(`labels.arrowhead_circle_outline`),keyBinding:`s`,icon:(0,V.jsx)(gx,{flip:e})},{value:`diamond`,text:G(`labels.arrowhead_diamond`),icon:(0,V.jsx)(_x,{flip:e}),keyBinding:`d`},{value:`diamond_outline`,text:G(`labels.arrowhead_diamond_outline`),icon:(0,V.jsx)(vx,{flip:e}),keyBinding:`f`},{value:`bar`,text:G(`labels.arrowhead_bar`),keyBinding:`z`,icon:(0,V.jsx)(yx,{flip:e})}]},{name:G(`labels.cardinality`),options:[{value:`cardinality_one`,text:G(`labels.arrowhead_cardinality_one`),icon:(0,V.jsx)(bx,{flip:e}),keyBinding:`x`},{value:`cardinality_many`,text:G(`labels.arrowhead_cardinality_many`),icon:(0,V.jsx)(xx,{flip:e}),keyBinding:`c`},{value:`cardinality_one_or_many`,text:G(`labels.arrowhead_cardinality_one_or_many`),icon:(0,V.jsx)(Sx,{flip:e}),keyBinding:`v`},{value:`cardinality_exactly_one`,text:G(`labels.arrowhead_cardinality_exactly_one`),icon:(0,V.jsx)(Cx,{flip:e}),keyBinding:null},{value:`cardinality_zero_or_one`,text:G(`labels.arrowhead_cardinality_zero_or_one`),icon:(0,V.jsx)(wx,{flip:e}),keyBinding:null},{value:`cardinality_zero_or_many`,text:G(`labels.arrowhead_cardinality_zero_or_many`),icon:(0,V.jsx)(Tx,{flip:e}),keyBinding:null}]}]});X({name:`changeArrowhead`,label:`Change arrowheads`,trackEvent:!1,perform:(e,t,n)=>(pe(n,`actionChangeArrowhead: value must be defined`),{elements:xw(e,t,e=>{if(ja(e)){let{position:t,type:r}=n;if(t===`start`)return j(e,{startArrowhead:r});if(t===`end`)return j(e,{endArrowhead:r})}return e}),appState:{...t,[n.position===`start`?`currentItemStartArrowhead`:`currentItemEndArrowhead`]:n.type},captureUpdate:P.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=Sy().rtl,a=(0,B.useMemo)(()=>kw(!i),[i]),o=(0,B.useMemo)(()=>kw(!!i),[i]);return(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.arrowheads`)}),(0,V.jsxs)(`div`,{className:`iconSelectList buttonList`,children:[(0,V.jsx)(_w,{visibleSections:a.visibleSections,hiddenSections:a.hiddenSections,label:`arrowhead_start`,value:Sw(e,r,e=>ja(e)&&vs(e.type)?Un(e.startArrowhead):t.currentItemStartArrowhead,!0,e=>e?null:t.currentItemStartArrowhead),onChange:e=>n({position:`start`,type:e})}),(0,V.jsx)(_w,{visibleSections:o.visibleSections,hiddenSections:o.hiddenSections,label:`arrowhead_end`,value:Sw(e,r,e=>ja(e)&&vs(e.type)?Un(e.endArrowhead):t.currentItemEndArrowhead,!0,e=>e?null:t.currentItemEndArrowhead),onChange:e=>n({position:`end`,type:e})})]})]})}}),X({name:`changeArrowProperties`,label:`Change arrow properties`,trackEvent:!1,perform:(e,t,n,r)=>!1,PanelComponent:({elements:e,appState:t,updateData:n,app:r,renderAction:i})=>(0,V.jsxs)(`div`,{className:`selected-shape-actions`,children:[i(`changeArrowhead`),i(`changeArrowType`)]})}),X({name:`changeArrowType`,label:`Change arrow types`,trackEvent:!1,perform:(e,t,n,r)=>{let i=xw(e,t,e=>{if(!Mr(e))return e;let i=r.scene.getNonDeletedElementsMap(),o=I.getPointAtIndexGlobalCoordinates(e,0,i),s=I.getPointAtIndexGlobalCoordinates(e,-1,i),c=j(e,{x:n===Er.elbow?o[0]:e.x,y:n===Er.elbow?o[1]:e.y,roundness:n===Er.round?{type:Go.PROPORTIONAL_RADIUS}:null,elbowed:n===Er.elbow,angle:n===Er.elbow?0:e.angle,points:n===Er.elbow||e.elbowed?[I.pointFromAbsoluteCoords({...e,x:o[0],y:o[1],angle:0},o,i),I.pointFromAbsoluteCoords({...e,x:o[0],y:o[1],angle:0},s,i)]:e.points});if(Ti(c)){c.fixedSegments=null;let e=r.scene.getNonDeletedElementsMap();r.dismissLinearEditor();let n=I.getPointAtIndexGlobalCoordinates(c,0,e),i=I.getPointAtIndexGlobalCoordinates(c,-1,e),o=c.startBinding&&e.get(c.startBinding.elementId),s=c.endBinding&&e.get(c.endBinding.elementId),l=o&&c.startBinding?{...c.startBinding,...ao(c,o,`start`,e,t.isBindingEnabled)}:null,u=s&&c.endBinding?{...c.endBinding,...ao(c,s,`end`,e,t.isBindingEnabled)}:null;c={...c,startBinding:l,endBinding:u,...Nt(c,e,{points:[n,i].map(e=>a(e[0]-c.x,e[1]-c.y)),startBinding:l,endBinding:u,fixedSegments:null})}}else{let e=r.scene.getNonDeletedElementsMap();if(c.startBinding){let n=e.get(c.startBinding.elementId);n&&Xr(c,n,t.bindMode===`inside`?`inside`:`orbit`,`start`,r.scene)}if(c.endBinding){let n=e.get(c.endBinding.elementId);n&&Xr(c,n,t.bindMode===`inside`?`inside`:`orbit`,`end`,r.scene)}}return c}),o={...t,currentItemArrowType:n},s=t.selectedLinearElement?.elementId;if(s){let t=i.find(e=>e.id===s);t&&(o.selectedLinearElement=new I(t,Pa(e)))}return{elements:i,appState:o,captureUpdate:P.IMMEDIATELY}},PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.arrowtypes`)}),(0,V.jsx)(`div`,{className:`buttonList`,children:(0,V.jsx)(aC,{group:`arrowtypes`,options:[{value:Er.sharp,text:G(`labels.arrowtype_sharp`),icon:AS,testId:`sharp-arrow`},{value:Er.round,text:G(`labels.arrowtype_round`),icon:MS,testId:`round-arrow`},{value:Er.elbow,text:G(`labels.arrowtype_elbowed`),icon:jS,testId:`elbow-arrow`}],value:Sw(e,r,e=>Mr(e)?e.elbowed?Er.elbow:e.roundness?Er.round:Er.sharp:null,e=>Mr(e),e=>e?null:t.currentItemArrowType),onChange:e=>n(e)})})]})});var Aw=()=>{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},jw=(e,t,n=`bottom`)=>{let r=e.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=t.left+t.width/2-r.width/2;o<0?o=5:o+r.width>=i&&(o=i-r.width-5);let s;n===`bottom`?(s=t.top+t.height+5,s+r.height>=a&&(s=t.top-r.height-5)):(s=t.top-r.height-5,s<0&&(s=t.top+t.height+5)),Object.assign(e.style,{top:`${s}px`,left:`${o}px`})},Mw=(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,jw(t,e.getBoundingClientRect())},Nw=({children:e,label:t,long:n=!1,style:r,disabled:i})=>((0,B.useEffect)(()=>()=>Aw().classList.remove(`excalidraw-tooltip--visible`),[]),i?null:(0,V.jsx)(`div`,{className:`excalidraw-tooltip-wrapper`,onPointerEnter:e=>Mw(e.currentTarget,Aw(),t,n),onPointerLeave:()=>Aw().classList.remove(`excalidraw-tooltip--visible`),style:r,children:e})),Pw=(e,t)=>typeof t==`function`?t(e):Array.isArray(t)?e:e[t],Fw=(e,t,n)=>{if(e?.isDestroyed)return;let r=e?.getAppState();if(!r){if(!n)return;console.warn(`useAppStateValue: excalidrawAPI not defined yet for internal component while it should always be defined. Are you sure you're rendering inside of <Excalidraw/> component tree?`),r=Object.assign({width:0,height:0,offsetLeft:0,offsetTop:0},zt())}return Pw(r,t)};function Iw(e,t=!0){let n=aB(),[,r]=(0,B.useState)(0),i=(0,B.useRef)(null);return i.current||={selector:e,isInitialized:!!n,latestValue:Fw(n,e,t)},i.current.selector=e,!i.current.isInitialized&&n&&!n.isDestroyed&&(i.current.isInitialized=!0,i.current.latestValue=Fw(n,e,t)),(0,B.useEffect)(()=>{let e=i.current;if(!(!n||n.isDestroyed||!e))return n.onStateChange(e.selector,t=>{e.latestValue=t,r(e=>e+1)})},[n]),i.current.latestValue}var Lw=({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),c=r.scrollY+(a-a/o),l=-(i-i/n),u=-(a-a/n);return{scrollX:s+l,scrollY:c+u,zoom:{value:n}}};X({name:`changeViewBackgroundColor`,label:`labels.canvasBackground`,trackEvent:!1,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.changeViewBackgroundColor&&!t.viewModeEnabled,perform:(e,t,n)=>({appState:{...t,...n},captureUpdate:n?.viewBackgroundColor?P.IMMEDIATELY:P.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:r,data:i})=>(0,V.jsx)(BC,{palette:null,topPicks:Dn,label:G(`labels.canvasBackground`),type:`canvasBackground`,color:t.viewBackgroundColor,onChange:e=>n({viewBackgroundColor:e}),"data-testid":`canvas-background-picker`,elements:e,appState:t,updateData:n})});var Rw=X({name:`clearCanvas`,label:`labels.clearCanvas`,icon:rb,trackEvent:{category:`canvas`},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.clearCanvas&&!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`,perform:(e,t,n,r)=>(r.imageCache.clear(),{elements:e.map(e=>j(e,{isDeleted:!0})),appState:{...zt(),files:{},theme:t.theme,penMode:t.penMode,penDetected:t.penDetected,exportBackground:t.exportBackground,exportEmbedScene:t.exportEmbedScene,gridSize:t.gridSize,gridStep:t.gridStep,gridModeEnabled:t.gridModeEnabled,stats:t.stats,activeTool:t.activeTool.type===`image`?{...t.activeTool,type:r.state.preferredSelectionTool.type}:t.activeTool},captureUpdate:P.IMMEDIATELY})}),zw=X({name:`zoomIn`,label:`buttons.zoomIn`,viewMode:!0,icon:eb,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i={...t,...Lw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:it(t.zoom.value+Jo)},t),userToFollow:null};return{appState:{...i,...Ts(i)},captureUpdate:P.EVENTUALLY}},PanelComponent:({updateData:e})=>{let t=Iw(e=>e.zoom.value);return(0,V.jsx)(Y,{type:`button`,className:`zoom-in-button zoom-button`,icon:eb,title:`${G(`buttons.zoomIn`)} \u2014 ${Z(`CtrlOrCmd++`)}`,"aria-label":G(`buttons.zoomIn`),disabled:t>=30,onClick:()=>{e(null)}})},keyTest:e=>(e.code===vr.EQUAL||e.code===vr.NUM_ADD)&&(e[M.CTRL_OR_CMD]||e.shiftKey)}),Bw=X({name:`zoomOut`,label:`buttons.zoomOut`,icon:tb,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i={...t,...Lw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:it(t.zoom.value-Jo)},t),userToFollow:null};return{appState:{...i,...Ts(i)},captureUpdate:P.EVENTUALLY}},PanelComponent:({updateData:e})=>{let t=Iw(e=>e.zoom.value);return(0,V.jsx)(Y,{type:`button`,className:`zoom-out-button zoom-button`,icon:tb,title:`${G(`buttons.zoomOut`)} \u2014 ${Z(`CtrlOrCmd+-`)}`,"aria-label":G(`buttons.zoomOut`),disabled:t<=dc,onClick:()=>{e(null)}})},keyTest:e=>(e.code===vr.MINUS||e.code===vr.NUM_SUBTRACT)&&(e[M.CTRL_OR_CMD]||e.shiftKey)}),Vw=X({name:`resetZoom`,label:`buttons.resetZoom`,icon:nb,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=t.scrollConstraints?.lockZoom?t.scrollConstraints.zoom:1,a={...t,...Lw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:it(i)},t),userToFollow:null};return{appState:{...a,...Ts(a)},captureUpdate:P.EVENTUALLY}},PanelComponent:({updateData:e})=>{let t=Iw(e=>e.zoom.value);return(0,V.jsx)(Nw,{label:G(`buttons.resetZoom`),style:{height:`100%`},children:(0,V.jsxs)(Y,{type:`button`,className:`reset-zoom-button zoom-button`,title:G(`buttons.resetZoom`),"aria-label":G(`buttons.resetZoom`),onClick:()=>{e(null)},children:[(t*100).toFixed(0),`%`]})})},keyTest:e=>(e.code===vr.ZERO||e.code===vr.NUM_ZERO)&&(e[M.CTRL_OR_CMD]||e.shiftKey)});X({name:`zoomToFitSelectionInViewport`,label:`labels.zoomToFitViewport`,icon:xS,trackEvent:{category:`canvas`},predicate:(e,t)=>!t.scrollConstraints,perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return Or({bounds:He(Sa(i.length?i:e)),appState:{...t,userToFollow:null},fit:`scale-down`,canvasOffsets:r.getViewportOffsets()})},keyTest:(e,t)=>!t.scrollConstraints&&e.code===vr.TWO&&e.shiftKey&&!e.altKey&&!e[M.CTRL_OR_CMD]}),X({name:`zoomToFitSelection`,label:`helpDialog.zoomToSelection`,icon:xS,trackEvent:{category:`canvas`},predicate:(e,t)=>!t.scrollConstraints,perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return Or({bounds:He(Sa(i.length?i:e)),appState:{...t,userToFollow:null},fit:`contain`,canvasOffsets:r.getViewportOffsets()})},keyTest:(e,t)=>!t.scrollConstraints&&e.code===vr.THREE&&e.shiftKey&&!e.altKey&&!e[M.CTRL_OR_CMD]}),X({name:`zoomToFit`,label:`helpDialog.zoomToFit`,icon:xS,viewMode:!0,trackEvent:{category:`canvas`},predicate:(e,t)=>!t.scrollConstraints,perform:(e,t,n,r)=>Or({bounds:He(Sa(e)),appState:{...t,userToFollow:null},fit:`scale-down`,canvasOffsets:r.getViewportOffsets()}),keyTest:(e,t)=>!t.scrollConstraints&&e.code===vr.ONE&&e.shiftKey&&!e.altKey&&!e[M.CTRL_OR_CMD]});var Hw=X({name:`toggleTheme`,label:(e,t)=>t.theme===F.DARK?`buttons.lightMode`:`buttons.darkMode`,keywords:[`toggle`,`dark`,`light`,`mode`,`theme`],icon:(e,t)=>e.theme===F.LIGHT?ob:sb,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=n||(t.theme===F.LIGHT?F.DARK:F.LIGHT);return r.props.onThemeChange?(r.props.onThemeChange(i),!1):{appState:{...t,theme:i},captureUpdate:P.EVENTUALLY}},keyTest:e=>!e[M.CTRL_OR_CMD]&&e.altKey&&e.shiftKey&&e.code===vr.D,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.toggleTheme}),Uw=`<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">`,Ww=`<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"/>`,Gw=`<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"/>`,Kw=`data:${Se.svg},${encodeURIComponent(`${Uw}${Gw}</svg>`)}`,qw=`data:${Se.svg},${encodeURIComponent(`${Uw}${Ww}${Gw}</svg>`)}`,Jw=e=>{e&&(e.style.cursor=``)},Yw=(e,t)=>{e&&(e.style.cursor=t)},Xw,Zw,Qw=(e,t)=>{(!Xw||Xw.theme!==t)&&(()=>{let e=t===F.DARK;Xw=document.createElement(`canvas`),Xw.theme=t,Xw.height=20,Xw.width=20;let n=Xw.getContext(`2d`);n.lineWidth=1,n.beginPath(),n.arc(Xw.width/2,Xw.height/2,5,0,2*Math.PI),n.fillStyle=e?`#000`:`#fff`,n.fill(),n.strokeStyle=e?`#fff`:`#000`,n.stroke(),Zw=Xw.toDataURL(Se.svg)})(),Yw(e,`url(${Zw}) ${20/2} ${20/2}, auto`)},$w=(e,t)=>{if(e)if(t.activeTool.type===`selection`)Jw(e);else if(Bn(t))e.style.cursor=Ri.GRAB;else if(f(t))Qw(e,t.theme);else if(t.activeTool.type===`laser`){let n=t.theme===F.LIGHT?Kw:qw;e.style.cursor=`url(${n}), auto`}else[`image`,`custom`].includes(t.activeTool.type)?t.activeTool.type!==`image`&&(e.style.cursor=Ri.AUTO):e.style.cursor=Ri.CROSSHAIR},eT=({app:e,options:t,activeTool:n,defaultOption:r,"data-testid":i,onToolChange:a,displayedOption:o})=>{let[s,c]=(0,B.useState)(!1),l=n.type,u=o.type===l,{container:d}=eB();return!t.some(e=>e.type===l)&&s&&c(!1),(0,B.useEffect)(()=>{let t=e.onPointerDownEmitter.on(()=>{c(!1)});return()=>t?.()},[e]),(0,V.jsxs)(J_,{open:s,children:[(0,V.jsx)(Y_,{asChild:!0,children:(0,V.jsx)(Y,{className:H({fillable:o.fillable}),type:`toggle`,icon:o.icon,checked:u,title:In(o.title),"aria-label":In(o.title),"data-testid":i,onSelect:()=>{c(e=>!e),a(r)}})}),(0,V.jsx)(Z_,{className:`tool-popover-content`,sideOffset:26,collisionBoundary:d??void 0,children:t.map(({type:t,icon:n,title:r,fillable:i})=>(0,V.jsx)(Y,{className:H({fillable:i}),type:`toggle`,icon:n,checked:l===t,title:In(t),"aria-label":In(t),"data-testid":`toolbar-${t}`,onSelect:()=>{e.state.activeTool.type!==t&&(rC(`toolbar`,t,`ui`),e.setActiveTool({type:t}),a?.(t))}},t))})]})},tT=(e=>e)({hand:{icon:Ux,letterKey:M.H,toggle:!0},selection:{icon:Vy,letterKey:M.V,numericKey:M[1],fillable:!0},rectangle:{icon:Uy,letterKey:M.R,numericKey:M[2],fillable:!0},diamond:{icon:Wy,letterKey:M.D,numericKey:M[3],fillable:!0},ellipse:{icon:Gy,letterKey:M.O,numericKey:M[4],fillable:!0},arrow:{icon:Ky,letterKey:M.A,numericKey:M[5],fillable:!0},line:{icon:qy,letterKey:M.L,numericKey:M[6],fillable:!0},freedraw:{icon:Yy,letterKey:[M.P,M.X],numericKey:M[7]},text:{icon:Xy,letterKey:M.T,numericKey:M[8]},image:{icon:Qy,numericKey:M[9]},eraser:{icon:$y,letterKey:M.E,numericKey:M[0],toggle:!0},frame:{icon:Qx,letterKey:M.F},embeddable:{icon:ib},laser:{icon:rS,letterKey:M.K},lasso:{icon:Hy,fillable:!1}}),nT=Object.keys(tT).filter(e=>tT[e].toggle),rT=e=>{let{letterKey:t}=tT[e];return t&&In(typeof t==`string`?t:t[0])},iT=e=>{let t=rT(e),{numericKey:n}=tT[e];return t&&n!=null?`${t} ${G(`helpDialog.or`)} ${n}`:`${t||n}`},aT=(e,t)=>{let n=e.toLowerCase();for(let r of Object.keys(tT)){let{letterKey:i,numericKey:a}=tT[r];if(a!=null&&e===a||i&&(typeof i==`string`?i===n:i.includes(n)))return r===`selection`?t.state.preferredSelectionTool.type:r}return null},oT=(e,t)=>{let n=tT[e],r=t?.shortcutType??e,i=({app:i,activeTool:a,hideKeyBinding:o,hideShortcut:s})=>{let c=In(G(`toolBar.${e}`)),l=s?null:iT(r);return(0,V.jsx)(Y,{className:H({fillable:n.fillable}),type:`toggle`,icon:n.icon,checked:a.type===e,title:l?`${c} \u2014 ${l}`:c,keyBindingLabel:o||s?void 0:tT[r].numericKey||rT(r),"aria-label":c,"aria-keyshortcuts":l??void 0,"data-testid":`toolbar-${e}`,onSelect:({pointerType:n})=>{if(!i.state.penDetected&&n===`pen`&&i.togglePenMode(!0),t?.onSelect){t.onSelect(i,{pointerType:n});return}i.state.activeTool.type!==e&&(rC(`toolbar`,e,`ui`),i.setActiveTool({type:e}))}})};return i.displayName=`${In(e)}IconButton`,i},sT=oT(`hand`),cT=oT(`rectangle`),lT=oT(`diamond`),uT=oT(`ellipse`),dT=oT(`arrow`),fT=oT(`line`),pT=oT(`freedraw`),mT=oT(`text`),hT=oT(`image`),gT=oT(`eraser`),_T=oT(`frame`),vT=oT(`selection`,{onSelect:(e,{pointerType:t})=>{if(e.state.activeTool.type===`selection`&&t!==null){e.setActiveTool({type:`lasso`});return}e.state.activeTool.type!==`selection`&&(rC(`toolbar`,`selection`,`ui`),e.setActiveTool({type:`selection`}))}}),yT=oT(`lasso`,{shortcutType:`selection`}),bT=({app:e,activeTool:t,setAppState:n})=>{let r=[{type:`selection`,icon:tT.selection.icon,fillable:tT.selection.fillable,title:In(G(`toolBar.selection`))},{type:`lasso`,icon:tT.lasso.icon,fillable:tT.lasso.fillable,title:In(G(`toolBar.lasso`))}],i=r.find(t=>t.type===e.state.preferredSelectionTool.type)||r[0];return(0,V.jsx)(eT,{app:e,options:r,activeTool:t,defaultOption:e.state.preferredSelectionTool.type,"data-testid":`toolbar-selection`,onToolChange:t=>{(t===`selection`||t===`lasso`)&&(e.setActiveTool({type:t}),n({preferredSelectionTool:{type:t,initialized:!0}}))},displayedOption:i})},xT=X({name:`finalize`,label:``,trackEvent:!1,perform:(e,t,n,r)=>{let i=!0,o=e,{interactiveCanvas:s,focusContainer:c,scene:l}=r,u=l.getNonDeletedElementsMap();if(n&&t.selectedLinearElement){let{event:i,sceneCoords:a}=n,s=I.getElement(t.selectedLinearElement.elementId,u);pe(s,`Arrow element should exist if selectedLinearElement is set`),pe(a,`sceneCoords should be defined if actionFinalize is called with event`);let c=I.handlePointerUp(i,t.selectedLinearElement,t,r.scene);if(pa(s)&&!t.selectedLinearElement.segmentMidPointHoveredCoords){let e=!!t.newElement,n=e||!t.selectedLinearElement.selectedPointsIndices?[s.points.length-1]:t.selectedLinearElement.selectedPointsIndices,o=Wr(i),d=i[M.CTRL_OR_CMD]?null:r.getEffectiveGridSize();uc(s,n.reduce((e,t)=>(e.set(t,{point:o?s.points[t]:I.createPointAt(s,u,a.x-c.pointerOffset.x,a.y-c.pointerOffset.y,d)}),e),new Map)??new Map,a.x,a.y,l,t,{newArrow:e,altKey:i.altKey,angleLocked:o,gridSize:r.getEffectiveGridSize()})}else mr(s)&&t.selectedLinearElement?.isEditing&&!t.newElement&&!Tn(s.points)&&l.mutateElement(s,{polygon:!1});if(c!==t.selectedLinearElement){s&&si(s)&&(o=o.map(e=>e.id===s.id?j(e,{isDeleted:!0}):e));let n=t.activeTool?.locked;return{elements:s.points.length<2||si(s)?e.map(e=>e.id===s.id?j(e,{isDeleted:!0}):e):o,appState:{...t,cursorButton:`up`,selectedLinearElement:n?null:{...c,selectedPointsIndices:null,isEditing:!1,initialState:{...c.initialState,lastClickedPoint:-1},pointerOffset:{x:0,y:0}},selectionElement:null,suggestedBinding:null,newElement:null,multiElement:null},captureUpdate:P.IMMEDIATELY}}}window.document.activeElement instanceof HTMLElement&&c();let d=null;if(t.multiElement)d=t.multiElement;else if(t.newElement?.type===`freedraw`||pa(t.newElement))d=t.newElement;else if(Object.keys(t.selectedElementIds).length===1){let e=u.get(Object.keys(t.selectedElementIds)[0]);e&&(d=e)}if(d){if(t.selectedLinearElement&&t.multiElement&&d.type!==`freedraw`&&t.lastPointerDownWith!==`touch`){let{points:e}=d,{lastCommittedPoint:n}=t.selectedLinearElement;if((!n||e[e.length-1]!==n)&&(i=!1,l.mutateElement(d,{points:d.points.slice(0,-1)}),pa(d)&&d.endBinding&&d.points.length>1)){let e=!!t.newElement,n=new Map([[d.points.length-1,{point:d.points[d.points.length-1],isDragging:!1}]]),r=I.getPointAtIndexGlobalCoordinates(d,-1,u);uc(d,n,r[0],r[1],l,t,{newArrow:e})}}if(d&&si(d)&&(o=o.map(e=>e.id===d?.id?j(e,{isDeleted:!0}):e)),ja(d)||qo(d)){if(en(d.points,t.zoom.value)&&(mr(d)||qo(d))){let e=d.points,t=e[0],n=e.map((n,r)=>r===e.length-1?a(t[0],t[1]):n);mr(d)?l.mutateElement(d,{points:n,polygon:!0}):l.mutateElement(d,{points:n})}mr(d)&&!Tn(d.points)&&l.mutateElement(d,{polygon:!1})}}(!t.activeTool.locked&&t.activeTool.type!==`freedraw`||!d)&&Jw(s);let f;f=nT.includes(t.activeTool.type)?kr(t,{...t.activeTool.lastActiveTool||{type:r.state.preferredSelectionTool.type},lastActiveTool:null}):kr(t,{type:r.state.preferredSelectionTool.type});let p=d&&ja(d)?new I(d,Pa(o)):t.selectedLinearElement;return p&&={...p,isEditing:!t.newElement&&p.isEditing,initialState:{...p.initialState,lastClickedPoint:-1,origin:null}},{elements:o,appState:{...t,cursorButton:`up`,activeTool:(t.activeTool.locked||t.activeTool.type===`freedraw`)&&d?t.activeTool:f,activeEmbeddable:null,newElement:null,selectionElement:null,multiElement:null,editingTextElement:null,suggestedBinding:null,frameToHighlight:null,selectedElementIds:d&&!t.activeTool.locked&&t.activeTool.type!==`freedraw`?{...t.selectedElementIds,[d.id]:!0}:t.selectedElementIds,selectedLinearElement:p},captureUpdate:i?P.IMMEDIATELY:P.NEVER}},keyTest:(e,t)=>e.key===M.ESCAPE&&t.selectedLinearElement?.isEditing||(e.key===M.ESCAPE||e.key===M.ENTER)&&t.multiElement!==null,PanelComponent:({appState:e,updateData:t,data:n})=>(0,V.jsx)(Y,{type:`button`,icon:Tb,title:G(`buttons.done`),"aria-label":G(`buttons.done`),onClick:t,visible:e.multiElement!=null,size:n?.size||`medium`,style:{pointerEvents:`all`}})}),ST=(e,t)=>nT.includes(e.activeTool.type)?kr(e,{...e.activeTool.lastActiveTool||{type:t.state.preferredSelectionTool.type},lastActiveTool:null}):kr(e,{type:t.state.preferredSelectionTool.type}),CT=(e,t,n)=>{if(!e.editingGroupId)return null;let r=t.scene.getNonDeletedElements(),i=t.scene.getSelectedElements({selectedElementIds:n,elements:r}),a=i.length?i:Tt(r,e.editingGroupId);for(let t of a){let n=t.groupIds.indexOf(e.editingGroupId);if(n!==-1&&t.groupIds[n+1])return t.groupIds[n+1]}return null};X({name:`deselect`,label:``,trackEvent:!1,perform:(e,t,n,r)=>{let i=ST(t,r);if(t.editingGroupId){let e=r.scene.getNonDeletedElements(),n=Object.keys(t.selectedElementIds).length>0?t.selectedElementIds:Tt(e,t.editingGroupId).reduce((e,t)=>(e[t.id]=!0,e),{});return{appState:{...t,...tr({editingGroupId:CT(t,r,n),selectedElementIds:n},e,t,r),activeEmbeddable:null,activeTool:i,selectedLinearElement:null,selectionElement:null,showHyperlinkPopup:!1,suggestedBinding:null,frameToHighlight:null},captureUpdate:P.IMMEDIATELY}}return{appState:{...t,activeEmbeddable:null,activeTool:i,editingGroupId:null,selectedElementIds:Ji({},t),selectedGroupIds:{},selectedLinearElement:null,selectionElement:null,showHyperlinkPopup:!1,suggestedBinding:null,frameToHighlight:null},captureUpdate:P.IMMEDIATELY}},keyTest:(e,t,n,r)=>e.key!==M.ESCAPE||wi(e.target)?!1:!t.newElement&&t.multiElement===null&&!t.selectedLinearElement?.isEditing&&(t.activeEmbeddable!==null||t.activeTool.type!==r.state.preferredSelectionTool.type||!!t.editingGroupId||!!t.selectedLinearElement||ha(r.scene.getNonDeletedElements(),t))});var wT=({children:e,checked:t,onChange:n,className:r})=>(0,V.jsxs)(`div`,{className:H(`Checkbox`,r,{"is-checked":t}),onClick:e=>{n(!t,e),e.currentTarget.querySelector(`.Checkbox-box`).focus()},children:[(0,V.jsx)(`button`,{type:`button`,className:`Checkbox-box`,role:`checkbox`,"aria-checked":t,children:gb}),(0,V.jsx)(`div`,{className:`Checkbox-label`,children:e})]}),TT=e=>{let t=e.title||(e.value===F.DARK?G(`buttons.lightMode`):G(`buttons.darkMode`));return(0,V.jsx)(Y,{type:`icon`,icon:e.value===F.LIGHT?ET.MOON:ET.SUN,title:t,"aria-label":t,onClick:()=>e.onChange(e.value===F.DARK?F.LIGHT:F.DARK),"data-testid":`toggle-dark-mode`})},ET={SUN:(0,V.jsx)(`svg`,{width:`512`,height:`512`,className:`rtl-mirror`,viewBox:`0 0 512 512`,children:(0,V.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,V.jsx)(`svg`,{width:`512`,height:`512`,className:`rtl-mirror`,viewBox:`0 0 512 512`,children:(0,V.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`})})},DT=e=>{let{id:t}=eB(),[n,r]=(0,B.useState)(e.value);return(0,V.jsxs)(`div`,{className:`ProjectName`,children:[(0,V.jsx)(`label`,{className:`ProjectName-label`,htmlFor:`filename`,children:`${e.label}:`}),(0,V.jsx)(`input`,{type:`text`,className:`TextInput`,onBlur:t=>{e.ignoreFocus||Rn(t.target);let n=t.target.value;n!==e.value&&e.onChange(n)},onKeyDown:e=>{if(e.key===M.ENTER){if(e.preventDefault(),e.nativeEvent.isComposing||e.keyCode===229)return;e.currentTarget.blur()}},id:`${t}-filename`,value:n,onChange:e=>r(e.target.value)})]})},OT=5e3,kT=Object.assign(({message:e,onClose:t,closable:n=!1,duration:r=OT,style:i})=>{let a=(0,B.useRef)(0),o=r!==1/0,s=(0,B.useCallback)(()=>{o&&(a.current=window.setTimeout(()=>t(),r))},[t,r,o]);return(0,B.useEffect)(()=>{if(o)return s(),()=>clearTimeout(a.current)},[s,e,r,o]),(0,V.jsxs)(`div`,{className:`Toast`,role:`status`,onMouseEnter:o?()=>clearTimeout(a?.current):void 0,onMouseLeave:o?s:void 0,style:i,children:[(0,V.jsx)(`div`,{className:`Toast__message`,children:e}),n&&(0,V.jsx)(Y,{icon:Kb,"aria-label":`close`,type:`icon`,onClick:t,className:`close`})]})},{ProgressBar:({progress:e})=>(0,V.jsx)(`div`,{className:`Toast__progress-bar`,children:(0,V.jsx)(`div`,{className:`Toast__progress-bar-fill`,style:{width:`${Math.min(5,Math.round(e*100))}%`}})})});`clipboard`in navigator&&`readText`in navigator.clipboard;var AT=`clipboard`in navigator&&`writeText`in navigator.clipboard,jT=`clipboard`in navigator&&`write`in navigator.clipboard&&`ClipboardItem`in window&&`toBlob`in HTMLCanvasElement.prototype,MT=e=>!!([ct.excalidraw,ct.excalidrawClipboard,ct.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),NT=({types:e,files:t})=>{!e&&!t&&console.warn(`createPasteEvent: no types or files provided`);let n=new ClipboardEvent(L.PASTE,{clipboardData:new DataTransfer});if(e)for(let[r,i]of Object.entries(e)){if(typeof i!=`string`){t||=[],t.push(i);continue}try{if(n.clipboardData?.items.add(i,r),n.clipboardData?.getData(r)!==i)throw Error(`Failed to set "${r}" as clipboardData item`)}catch(e){throw Error(e.message)}}if(t){let e=-1;for(let r of t){e++;try{if(n.clipboardData?.items.add(r),n.clipboardData?.files[e]!==r)throw Error(`Failed to set file "${r.name}" as clipboardData item`)}catch(e){throw Error(e.message)}}}return n},PT=({elements:e,files:t})=>{let n=Pa(e),r=new Set(e.filter(e=>N(e))),i=!1,a=e.reduce((e,n)=>(Xn(n)&&(i=!0,t&&t[n.fileId]&&(e[n.fileId]=t[n.fileId])),e),{});i&&!t&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");let o={type:ct.excalidrawClipboard,elements:e.map(e=>{if(Cn(e,n)&&!r.has(Cn(e,n))){let t=cr(e);return Ye(t,n,{frameId:null}),t}return e}),files:t?a:void 0};return JSON.stringify(o)},FT=async(e,t,n)=>{let r=PT({elements:e,files:t});await qT({[Se.excalidrawClipboard]:r,[Se.text]:r},n)};function IT(e){let t=[];for(let n of e.childNodes)if(n.nodeType===3){let e=n.textContent?.trim();e&&t.push({type:`text`,value:e})}else if(n instanceof HTMLImageElement){let e=n.getAttribute(`src`);e&&e.startsWith(`http`)&&t.push({type:`imageUrl`,value:e})}else t=t.concat(IT(n));return t}var LT=e=>{let t=e.value;try{let e=IT(new DOMParser().parseFromString(t,Se.html).body);if(e.length)return{type:`mixedContent`,value:e}}catch(e){console.error(`error in parseHTMLFromPaste: ${e.message}`)}return null},RT=async()=>{let e={},t;try{t=await navigator.clipboard?.read()}catch(t){try{if(navigator.clipboard?.readText){console.warn(`navigator.clipboard.readText() failed (${t.message}). Failling back to navigator.clipboard.read()`);let e=await navigator.clipboard?.readText();if(e)return{[Se.text]:e}}}catch(t){if(navigator.clipboard?.read)console.warn(`navigator.clipboard.readText() failed (${t.message}). Failling back to navigator.clipboard.read()`);else{if(t.name===`DataError`)return console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${t.message}`),e;throw t}}throw t}for(let n of t)for(let t of n.types)if(Hn(ue,t))try{if(t===Se.text||t===Se.html)e[t]=await(await n.getType(t)).text();else if(k(t))e[t]=Ea(await n.getType(t),t,void 0);else throw new li(`Unsupported clipboard type: ${t}`)}catch(e){console.warn(e instanceof li?e.message:`Cannot retrieve ${t} from clipboardItem: ${e.message}`)}return Object.keys(e).length===0&&console.warn(`No clipboard data found from clipboard.read().`),e},zT=async(e,t=!1)=>{try{let n=e.findByType(Se.html),r=!t&&n&&LT(n);return r?r.value.every(e=>e.type===`text`)?{type:`text`,value:e.getData(Se.text)??r.value.map(e=>e.value).join(`
43
+ `).trim()}:r:{type:`text`,value:(e.getData(Se.text)||``).trim()}}catch{return{type:`text`,value:``}}},BT=function(e){return this.find(t=>t.type===e)||null},VT=function(e){return this.find(t=>t.type===e)?.value??null},HT=function(){return this.filter(e=>e.kind===`file`)},UT=e=>{let t;t=YT(e)?e.clipboardData?.items:e.dataTransfer?.items;let n=new Set;for(let e of Array.from(t||[]))n.has(e.type)||n.add(e.type);return n},WT=async e=>{let t;t=YT(e)?e.clipboardData?.items:e.dataTransfer?.items;let n=(await Promise.all(Array.from(t||[]).map(async t=>{if(t.kind===`file`){let e=t.getAsFile();if(e){let n=await Ne(t);return e=await $a(e),{type:e.type,kind:`file`,file:e,fileHandle:n}}}else if(t.kind===`string`){let{type:n}=t,r;return r=`clipboardData`in e&&e.clipboardData?e.clipboardData?.getData(n):await new Promise(e=>{t.getAsString(t=>e(t))}),{type:n,kind:`string`,value:r}}return null}))).filter(e=>e!=null);return Object.assign(n,{findByType:BT,getData:VT,getFiles:HT})},GT=async(e,t=!1)=>{let n=await zT(e,t);if(n.type===`mixedContent`)return{mixedContent:n.value};try{let e=JSON.parse(n.value),r=e.type===ct.excalidrawClipboardWithAPI;if(MT(e))return{elements:e.elements,files:e.files,text:t?JSON.stringify(e.elements,null,2):void 0,programmaticAPI:r}}catch{}return{text:n.value}},KT=async e=>{try{await navigator.clipboard.write([new ClipboardItem({[Se.png]:e})])}catch(t){if(Gs(e))await navigator.clipboard.write([new ClipboardItem({[Se.png]:await e})]);else throw t}},qT=async(e,t)=>{e||=``;let n=Object.entries(typeof e==`string`?{[Se.text]:e}:e);try{if(t){for(let[e,r]of n)if(t.clipboardData?.setData(e,r),t.clipboardData?.getData(e)!==r)throw Error(`Failed to setData on clipboardEvent`);return}}catch(e){console.error(e)}let r=n.find(([e])=>e===Se.text);if(AT&&r)try{await navigator.clipboard.writeText(r[1]);return}catch(e){console.error(e)}if(r&&!JT(r[1]))throw Error(`Error copying to clipboard.`)},JT=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(e){console.error(e)}return n.remove(),i},YT=e=>e.type===L.PASTE||e.type===L.COPY||e.type===L.CUT,XT=(e,{selectedElementIds:t},n)=>{let r=Sa(e),i=Pa(r),a=n&&ha(r,{selectedElementIds:t}),o=null,s=a?An(r,{selectedElementIds:t},{includeBoundTextElement:!0}):r;if(a){let e=s[0];s.length===1&&N(e)?(o=e,s=zo(r,e,i)):s.length>1&&(s=An(r,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}))}return{exportingFrame:o,exportedElements:Xi(s)}},ZT=async(e,t,r,i,{exportBackground:a,exportPadding:o=10,viewBackgroundColor:s,name:c=r.name||`Untitled`,fileHandle:l=null,exportingFrame:u=null})=>{if(t.length===0)throw Error(G(`alerts.cannotExportEmptyCanvas`));if(e===`svg`||e===`clipboard-svg`){let n=Sr(t,{exportBackground:a,exportWithDarkMode:r.exportWithDarkMode,viewBackgroundColor:s,exportPadding:o,exportScale:r.exportScale,exportEmbedScene:r.exportEmbedScene&&e===`svg`},i,{exportingFrame:u});if(e===`svg`)return ui(n.then(e=>new Blob([m+e.outerHTML],{type:Se.svg})),{description:`Export to SVG`,name:c,extension:r.exportEmbedScene?`excalidraw.svg`:`svg`,mimeTypes:[ic.svg],fileHandle:l});if(e===`clipboard-svg`){let e=await n.then(e=>e.outerHTML);try{await qT(e)}catch{throw Error(G(`errors.copyToSystemClipboardFailed`))}return}}let d=vo(t,r,i,{exportBackground:a,viewBackgroundColor:s,exportPadding:o,exportingFrame:u});if(e===`png`){let e=Wa(d);return r.exportEmbedScene&&(e=e.then(e=>n(async()=>{let{encodePngMetadata:e}=await import(`./image-QEDDDPDB-DtzL4Wgr.js`);return{encodePngMetadata:e}},__vite__mapDeps([62,63,2,64,1,65]),import.meta.url).then(({encodePngMetadata:n})=>n({blob:e,metadata:Da(t,r,i,`local`)})))),ui(e,{description:`Export to PNG`,name:c,extension:r.exportEmbedScene?`excalidraw.png`:`png`,mimeTypes:[ic.png],fileHandle:l})}else if(e===`clipboard`)try{await KT(Wa(d))}catch(e){throw console.warn(e),e.name===`CANVAS_POSSIBLY_TOO_BIG`?Error(G(`canvasError.canvasTooBig`)):Ra&&e.name===`TypeError`?Error(`${G(`alerts.couldNotCopyToClipboard`)}
44
+
45
+ ${G(`hints.firefox_clipboard_write`)}`):Error(G(`alerts.couldNotCopyToClipboard`))}else throw Error(`Unsupported export type`)},QT=async(e,t,n)=>{let r=os(t);if(!la(r))throw Error(`fileHandle should exist and should be of type svg or png when resaving`);let{elements:i,appState:a,files:o}=await e,{exportBackground:s,viewBackgroundColor:c}=a;a={...a,exportEmbedScene:!0};let{exportedElements:l,exportingFrame:u}=XT(i,a,!1);return await ZT(r,l,a,o,{exportBackground:s,viewBackgroundColor:c,name:n,fileHandle:t,exportingFrame:u}),{fileHandle:t}},$T=X({name:`changeProjectName`,label:`labels.fileTitle`,trackEvent:!1,perform:(e,t,n)=>({appState:{...t,name:n},captureUpdate:P.EVENTUALLY}),PanelComponent:({appState:e,updateData:t,appProps:n,data:r,app:i})=>(0,V.jsx)(DT,{label:G(`labels.fileTitle`),value:i.getName(),onChange:e=>t(e),ignoreFocus:r?.ignoreFocus??!1})}),eE=X({name:`changeExportScale`,label:`imageExportDialog.scale`,trackEvent:{category:`export`,action:`scale`},perform:(e,t,n)=>({appState:{...t,exportScale:n},captureUpdate:P.EVENTUALLY})}),tE=X({name:`changeExportBackground`,label:`imageExportDialog.label.withBackground`,trackEvent:{category:`export`,action:`toggleBackground`},perform:(e,t,n)=>({appState:{...t,exportBackground:n},captureUpdate:P.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>(0,V.jsx)(wT,{checked:e.exportBackground,onChange:e=>t(e),children:G(`imageExportDialog.label.withBackground`)})}),nE=X({name:`changeExportEmbedScene`,label:`imageExportDialog.tooltip.embedScene`,trackEvent:{category:`export`,action:`embedScene`},perform:(e,t,n)=>({appState:{...t,exportEmbedScene:n},captureUpdate:P.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>(0,V.jsxs)(wT,{checked:e.exportEmbedScene,onChange:e=>t(e),children:[G(`imageExportDialog.label.embedScene`),(0,V.jsx)(Nw,{label:G(`imageExportDialog.tooltip.embedScene`),long:!0,children:(0,V.jsx)(`div`,{className:`excalidraw-tooltip-icon`,children:Ob})})]})}),rE=!1,iE=(e,t)=>{let n=t.message??G(`progressDialog.defaultMessage`);e.setAppState({toast:{message:t.progress==null?n:(0,V.jsxs)(V.Fragment,{children:[n,(0,V.jsx)(kT.ProgressBar,{progress:t.progress})]}),duration:1/0}})};async function aE(e,t){if(t.app.state.isLoading&&(iE(t.app,{progress:null}),await t.app.onStateChange({predicate:e=>!e.isLoading})),typeof e==`object`&&e&&Symbol.asyncIterator in e){for await(let n of e){if(t.signal.aborted){e.return();return}if(n.type===`progress`)iE(t.app,{message:n.message,progress:n.progress??null});else if(n.type===`done`)return}return}e instanceof Promise&&(iE(t.app,{progress:null}),await e)}function oE(e,t,n,r){let i=new AbortController,a=i.signal;return{abortController:i,data:new Promise(async i=>{try{r.props.onExport&&await aE(r.props.onExport(`json`,{elements:e,appState:t,files:n},{signal:a}),{app:r,signal:a})}catch(e){e?.name===`AbortError`?console.warn(`onExport() aborted by host app (signal aborted: ${a.aborted})`):console.error(`Error during props.onExport() handling`,e)}i({elements:e,appState:t,files:r.files})})}}var sE=X({name:`saveToActiveFile`,label:`buttons.save`,icon:lb,trackEvent:{category:`export`},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.saveToActiveFile&&!!t.fileHandle&&!t.viewModeEnabled,perform:async(e,t,n,r)=>{if(rE)return!1;rE=!0;let i=t.fileHandle,a=r.getName(),{abortController:o,data:s}=oE(e,t,r.files,r);try{let{fileHandle:e}=Kr(i)?await QT(s,i,a):await we({data:s,filename:a,fileHandle:i});return{captureUpdate:P.NEVER,appState:{fileHandle:e,toast:{message:i&&e?.name?G(`toast.fileSavedToFilename`).replace(`{filename}`,`"${e.name}"`):G(`toast.fileSaved`),duration:1500}}}}catch(e){return o.abort(),e?.name===`AbortError`?console.warn(e):console.error(e),{captureUpdate:P.NEVER,appState:{toast:null}}}finally{rE=!1}},keyTest:e=>e.key===M.S&&e[M.CTRL_OR_CMD]&&!e.shiftKey}),cE=X({name:`saveFileToDisk`,label:`exportDialog.disk_title`,icon:lb,viewMode:!0,trackEvent:{category:`export`},perform:async(e,t,n,r)=>{if(rE)return!1;rE=!0;let{abortController:i,data:a}=oE(e,t,r.files,r);try{let{fileHandle:e}=await we({data:a,filename:r.getName(),fileHandle:null});return{captureUpdate:P.NEVER,appState:{openDialog:null,fileHandle:e,toast:{message:G(`toast.fileSaved`),duration:3e3}}}}catch(e){return i.abort(),e?.name===`AbortError`?console.warn(e):console.error(e),{captureUpdate:P.NEVER,appState:{toast:null}}}finally{rE=!1}},keyTest:e=>e.key.toLowerCase()===M.S&&e.shiftKey&&e[M.CTRL_OR_CMD],PanelComponent:({updateData:e})=>(0,V.jsx)(Y,{type:`button`,icon:yb,title:G(`buttons.saveAs`),"aria-label":G(`buttons.saveAs`),showAriaLabel:Qz().formFactor===`phone`,hidden:!$i,onClick:()=>e(null),"data-testid":`save-as-button`})}),lE=X({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,i)=>{try{let{elements:n,appState:i,files:a}=await r(t,e);return{elements:n,appState:i,files:a,captureUpdate:P.IMMEDIATELY}}catch(n){return n?.name===`AbortError`?(console.warn(n),!1):{elements:e,appState:{...t,errorMessage:n.message},files:i.files,captureUpdate:P.EVENTUALLY}}},keyTest:e=>e[M.CTRL_OR_CMD]&&e.key===M.O}),uE=X({name:`exportWithDarkMode`,label:`imageExportDialog.label.darkMode`,trackEvent:{category:`export`,action:`toggleTheme`},perform:(e,t,n,r)=>(r.sessionExportThemeOverride=n?F.DARK:F.LIGHT,{appState:{...t,exportWithDarkMode:n},captureUpdate:P.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>(0,V.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:`-45px`,marginBottom:`10px`},children:(0,V.jsx)(TT,{value:e.exportWithDarkMode?F.DARK:F.LIGHT,onChange:e=>{t(e===F.DARK)},title:G(`imageExportDialog.label.darkMode`)})})}),dE=`{}`,fE=X({name:`copyStyles`,label:`labels.copyStyles`,icon:bS,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=[],a=e.find(e=>t.selectedElementIds[e.id]);if(i.push(a),a&&ai(a)){let e=So(a,r.scene.getNonDeletedElementsMap());i.push(e)}return a&&(dE=JSON.stringify(i)),{appState:{...t,toast:{message:G(`toast.copyStyles`)}},captureUpdate:P.EVENTUALLY}},keyTest:e=>e[M.CTRL_OR_CMD]&&e.altKey&&e.code===vr.C}),pE=X({name:`pasteStyles`,label:`labels.pasteStyles`,icon:bS,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=JSON.parse(dE),a=i[0],o=i[1];if(!wa(a))return{elements:e,captureUpdate:P.EVENTUALLY};let s=An(e,t,{includeBoundTextElement:!0}),c=s.map(e=>e.id);return{elements:e.map(e=>{if(c.includes(e.id)){let t=a;if(R(e)&&e.containerId&&(t=o),!t)return e;let n=j(e,{backgroundColor:t?.backgroundColor,strokeWidth:t?.strokeWidth,strokeColor:t?.strokeColor,strokeStyle:t?.strokeStyle,fillStyle:t?.fillStyle,opacity:t?.opacity,roughness:t?.roughness,roundness:t.roundness?Ci(t.roundness.type,e)?t.roundness:zi(e):null});if(R(n)){let e=t.fontSize||20,i=t.fontFamily||Kt,a=j(n,{fontSize:e,fontFamily:i,textAlign:t.textAlign||`left`,lineHeight:t.lineHeight||mo(i)});n=a;let o=null;a.containerId&&(o=s.find(e=>e.id===a.containerId)||null),Fn(a,o,r.scene)}return n.type===`arrow`&&Mr(t)&&(n=j(n,{startArrowhead:t.startArrowhead,endArrowhead:t.endArrowhead})),N(e)&&(n=j(n,{roundness:null,backgroundColor:`transparent`})),n}return e}),captureUpdate:P.IMMEDIATELY}},keyTest:e=>e[M.CTRL_OR_CMD]&&e.altKey&&e.code===vr.V}),mE=X({name:`toggleShortcuts`,label:`welcomeScreen.defaults.helpHint`,icon:db,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`},openMenu:null,openPopup:null},captureUpdate:P.EVENTUALLY}),keyTest:e=>e.key===M.QUESTION_MARK}),hE=e=>{if(e.length>=2){let t=e[0].groupIds;for(let n of t)if(e.reduce((e,t)=>e&&ua(t,n),!0))return!0}return!1},gE=(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});return r.length>=2&&!hE(r)&&!ee(r)},_E=X({name:`group`,label:`labels.group`,icon:e=>(0,V.jsx)(qb,{theme:e.theme}),trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=Dt(r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}));if(i.length<2)return{appState:t,elements:e,captureUpdate:P.EVENTUALLY};let a=yr(t);if(a.length===1){let n=a[0],r=new Set(Tt(e,n).map(e=>e.id)),o=new Set(i.map(e=>e.id));if(new Set([...Array.from(r),...Array.from(o)]).size===r.size)return{appState:t,elements:e,captureUpdate:P.EVENTUALLY}}let o=[...e];new Set(i.map(e=>e.frameId)).size>1&&Yt(i).forEach((e,t)=>{mi(e,r.scene.getNonDeletedElementsMap())});let s=Cs(),c=Pa(i);o=o.map(e=>c.get(e.id)?j(e,{groupIds:Yi(e.groupIds,s,t.editingGroupId)}):e);let l=Tt(o,s),u=l[l.length-1],d=o.lastIndexOf(u),f=o.slice(d+1),p=wo([...o.slice(0,d).filter(e=>!ua(e,s)),...l,...f],Pa(l));return{appState:{...t,...Aa(s,{...t,selectedGroupIds:{}},Sa(o))},elements:p,captureUpdate:P.IMMEDIATELY}},predicate:(e,t,n,r)=>gE(e,t,r),keyTest:e=>!e.shiftKey&&e[M.CTRL_OR_CMD]&&e.key===M.G,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,V.jsx)(Y,{hidden:!gE(e,t,r),type:`button`,icon:(0,V.jsx)(qb,{theme:t.theme}),onClick:()=>n(null),title:`${G(`labels.group`)} \u2014 ${Z(`CtrlOrCmd+G`)}`,"aria-label":G(`labels.group`),visible:ha(Sa(e),t)})}),vE=X({name:`ungroup`,label:`labels.ungroup`,icon:e=>(0,V.jsx)(Jb,{theme:e.theme}),trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=yr(t),a=Pa(e);if(i.length===0)return{appState:t,elements:e,captureUpdate:P.EVENTUALLY};let o=[...e],s=[];o=o.map(e=>{xo(e)&&s.push(e.id);let n=fn(e.groupIds,t.selectedGroupIds);return n.length===e.groupIds.length?e:j(e,{groupIds:n})});let c=tr(t,Sa(o),t,null),l=r.scene.getSelectedElements(t),u=new Set(l.filter(e=>e.frameId).map(e=>e.frameId));return qs(e).filter(e=>u.has(e.id)).forEach(e=>{e&&(o=po(o,Ws(o,e,t,a),e))}),c.selectedElementIds=Object.entries(c.selectedElementIds).reduce((e,[t,n])=>(n&&!s.includes(t)&&(e[t]=!0),e),{}),{appState:{...t,...c},elements:o,captureUpdate:P.IMMEDIATELY}},keyTest:e=>e.shiftKey&&e[M.CTRL_OR_CMD]&&e.key===M.G.toUpperCase(),predicate:(e,t)=>yr(t).length>0,PanelComponent:({elements:e,appState:t,updateData:n})=>(0,V.jsx)(Y,{type:`button`,hidden:yr(t).length===0,icon:(0,V.jsx)(Jb,{theme:t.theme}),onClick:()=>n(null),title:`${G(`labels.ungroup`)} \u2014 ${Z(`CtrlOrCmd+Shift+G`)}`,"aria-label":G(`labels.ungroup`),visible:ha(Sa(e),t)})}),yE=(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()};function bE(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 xE=(e,t)=>`hsl(${Math.abs(bE(t?.id||e))%37*10}, 100%, 83%)`,SE=e=>{let t=e?.trim()?.codePointAt(0);return(t?String.fromCodePoint(t):`?`).toUpperCase()},CE=({context:e,renderConfig:t,appState:n,normalizedWidth:r,normalizedHeight:i})=>{for(let[a,o]of t.remotePointerViewportCoords){let{x:s,y:c}=o,l=n.collaborators.get(a);s-=n.offsetLeft,c-=n.offsetTop;let u=s<0||s>r-11||c<0||c>i-14;s=Math.max(s,0),s=Math.min(s,r-11),c=Math.max(c,0),c=Math.min(c,i-14);let d=xE(a,l);e.save(),e.strokeStyle=d,e.fillStyle=d;let f=t.remotePointerUserStates.get(a),p=u||f===nc.IDLE||f===nc.AWAY;p&&(e.globalAlpha=.3),t.remotePointerButton.get(a)===`down`&&(e.beginPath(),e.arc(s,c,15,0,2*Math.PI,!1),e.lineWidth=3,e.strokeStyle=`#ffffff88`,e.stroke(),e.closePath(),e.beginPath(),e.arc(s,c,15,0,2*Math.PI,!1),e.lineWidth=1,e.strokeStyle=d,e.stroke(),e.closePath());let m=n.theme===F.DARK?`#2f6330`:dn,h=l?.isSpeaking;h&&(e.fillStyle=m,e.strokeStyle=m,e.lineWidth=10,e.lineJoin=`round`,e.beginPath(),e.moveTo(s,c),e.lineTo(s+0,c+14),e.lineTo(s+4,c+9),e.lineTo(s+11,c+8),e.closePath(),e.stroke(),e.fill()),e.fillStyle=Hr,e.strokeStyle=Hr,e.lineWidth=6,e.lineJoin=`round`,e.beginPath(),e.moveTo(s,c),e.lineTo(s+0,c+14),e.lineTo(s+4,c+9),e.lineTo(s+11,c+8),e.closePath(),e.stroke(),e.fill(),e.fillStyle=d,e.strokeStyle=d,e.lineWidth=2,e.lineJoin=`round`,e.beginPath(),p?(e.moveTo(s-1,c-1),e.lineTo(s-1,c+15),e.lineTo(s+5,c+10),e.lineTo(s+12,c+9),e.closePath(),e.fill()):(e.moveTo(s,c),e.lineTo(s+0,c+14),e.lineTo(s+4,c+9),e.lineTo(s+11,c+8),e.closePath(),e.fill(),e.stroke());let g=t.remotePointerUsernames.get(a)||``;if(!u&&g){e.font=`600 12px sans-serif`;let t=(h?s+0:s)+11/2,n=(h?c+0:c)+14+2,r=e.measureText(g),i=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent,a=Math.max(i,12),o=t-1,l=n-1,u=r.width+2+10+2,f=a+2+6+2;e.roundRect?(e.beginPath(),e.roundRect(o,l,u,f,8),e.fillStyle=d,e.fill(),e.strokeStyle=`#ffffff`,e.stroke(),h&&(e.beginPath(),e.roundRect(o-2,l-2,u+4,f+4,8),e.strokeStyle=m,e.stroke())):yE(e,o,l,u,f,8,`#ffffff`),e.fillStyle=`#1e1e1e`,e.fillText(g,t+5+1,n+3+r.actualBoundingBoxAscent+Math.floor((a-i)/2)+2),h&&(e.fillStyle=m,e.fillRect(o+u+8,l+(f/2-8/2),2,8),e.fillRect(o+u+8+5,l+(f/2-16/2),2,16),e.fillRect(o+u+8+10,l+(f/2-8/2),2,8))}e.restore(),e.closePath()}},wE=({color:e,onClick:t,name:n,src:r,className:i})=>{let a=SE(n),[o,s]=(0,B.useState)(!1),c=!o&&r,l=c?void 0:{background:e};return(0,V.jsx)(`div`,{className:H(`Avatar`,i),style:l,onClick:t,children:c?(0,V.jsx)(`img`,{className:`Avatar-img`,src:r,alt:a,referrerPolicy:`no-referrer`,onError:()=>s(!0)}):a})};X({name:`goToCollaborator`,label:`Go to a collaborator`,viewMode:!0,trackEvent:{category:`collab`},perform:(e,t,n)=>(pe(n,`actionGoToCollaborator: collaborator should be defined when actionGoToCollaborator is called`),!n.socketId||t.userToFollow?.socketId===n.socketId||n.isCurrentUser?{appState:{...t,userToFollow:null},captureUpdate:P.EVENTUALLY}:{appState:{...t,userToFollow:{socketId:n.socketId,username:n.username||``},openMenu:t.openMenu===`canvas`?null:t.openMenu},captureUpdate:P.EVENTUALLY}),PanelComponent:({updateData:e,data:t,appState:n})=>{let{socketId:r,collaborator:i,withName:a,isBeingFollowed:o}=t,s=xE(r,i),c=H({"is-followed":o,"is-current-user":i.isCurrentUser===!0,"is-speaking":i.isSpeaking,"is-in-call":i.isInCall,"is-muted":i.isMuted}),l=i.isInCall?i.isSpeaking?(0,V.jsxs)(`div`,{className:`UserList__collaborator-status-icon-speaking-indicator`,title:G(`userList.hint.isSpeaking`),children:[(0,V.jsx)(`div`,{}),(0,V.jsx)(`div`,{}),(0,V.jsx)(`div`,{})]}):i.isMuted?(0,V.jsx)(`div`,{className:`UserList__collaborator-status-icon-microphone-muted`,title:G(`userList.hint.micMuted`),children:mS}):(0,V.jsx)(`div`,{title:G(`userList.hint.inCall`),children:pS}):null;return a?(0,V.jsxs)(`div`,{className:`dropdown-menu-item dropdown-menu-item-base UserList__collaborator ${c}`,style:{"--avatar-size":`1.5rem`},onClick:()=>e(i),children:[(0,V.jsx)(wE,{color:s,onClick:()=>{},name:i.username||``,src:i.avatarUrl,className:c}),(0,V.jsx)(`div`,{className:`UserList__collaborator-name`,children:i.username}),(0,V.jsxs)(`div`,{className:`UserList__collaborator-status-icons`,"aria-hidden":!0,children:[o&&(0,V.jsx)(`div`,{className:`UserList__collaborator-status-icon-is-followed`,title:G(`userList.hint.followStatus`),children:oS}),l]})]}):(0,V.jsxs)(`div`,{className:`UserList__collaborator UserList__collaborator--avatar-only ${c}`,children:[(0,V.jsx)(wE,{color:s,onClick:()=>{e(i)},name:i.username||``,src:i.avatarUrl,className:c}),l&&(0,V.jsx)(`div`,{className:`UserList__collaborator-status-icon`,children:l})]})}});var TE=X({name:`addToLibrary`,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});for(let e of $s)if(i.some(t=>t.type===e))return{captureUpdate:P.EVENTUALLY,appState:{...t,errorMessage:G(`errors.libraryElementTypeError.${e}`)}};return r.library.getLatestLibrary().then(e=>r.library.setLibrary([{id:Cs(),status:`unpublished`,elements:i.map(cr),created:Date.now()},...e])).then(()=>({captureUpdate:P.EVENTUALLY,appState:{...t,toast:{message:G(`toast.addedToLibrary`)}}})).catch(e=>({captureUpdate:P.EVENTUALLY,appState:{...t,errorMessage:e.message}}))},label:`labels.addToLibrary`}),EE=(e,t)=>{let n=t.scene.getSelectedElements(e);return Ui(n,t.scene.getNonDeletedElementsMap(),e).length>1&&!n.some(e=>N(e))},DE=(e,t,n,r)=>{let i=Pa(Tr(n.scene.getSelectedElements(t),r,n.scene,t));return $n(e.map(e=>i.get(e.id)||e),t,n)};X({name:`alignTop`,label:`labels.alignTop`,icon:Ib,trackEvent:{category:`element`},predicate:(e,t,n,r)=>EE(t,r),perform:(e,t,n,r)=>({appState:t,elements:DE(e,t,r,{position:`start`,axis:`y`}),captureUpdate:P.IMMEDIATELY}),keyTest:e=>e[M.CTRL_OR_CMD]&&e.shiftKey&&e.key===M.ARROW_UP,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,V.jsx)(Y,{hidden:!EE(t,r),type:`button`,icon:Ib,onClick:()=>n(null),title:`${G(`labels.alignTop`)} \u2014 ${Z(`CtrlOrCmd+Shift+Up`)}`,"aria-label":G(`labels.alignTop`),visible:ha(Sa(e),t)})}),X({name:`alignBottom`,label:`labels.alignBottom`,icon:Lb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>EE(t,r),perform:(e,t,n,r)=>({appState:t,elements:DE(e,t,r,{position:`end`,axis:`y`}),captureUpdate:P.IMMEDIATELY}),keyTest:e=>e[M.CTRL_OR_CMD]&&e.shiftKey&&e.key===M.ARROW_DOWN,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,V.jsx)(Y,{hidden:!EE(t,r),type:`button`,icon:Lb,onClick:()=>n(null),title:`${G(`labels.alignBottom`)} \u2014 ${Z(`CtrlOrCmd+Shift+Down`)}`,"aria-label":G(`labels.alignBottom`),visible:ha(Sa(e),t)})}),X({name:`alignLeft`,label:`labels.alignLeft`,icon:Rb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>EE(t,r),perform:(e,t,n,r)=>({appState:t,elements:DE(e,t,r,{position:`start`,axis:`x`}),captureUpdate:P.IMMEDIATELY}),keyTest:e=>e[M.CTRL_OR_CMD]&&e.shiftKey&&e.key===M.ARROW_LEFT,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,V.jsx)(Y,{hidden:!EE(t,r),type:`button`,icon:Rb,onClick:()=>n(null),title:`${G(`labels.alignLeft`)} \u2014 ${Z(`CtrlOrCmd+Shift+Left`)}`,"aria-label":G(`labels.alignLeft`),visible:ha(Sa(e),t)})}),X({name:`alignRight`,label:`labels.alignRight`,icon:zb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>EE(t,r),perform:(e,t,n,r)=>({appState:t,elements:DE(e,t,r,{position:`end`,axis:`x`}),captureUpdate:P.IMMEDIATELY}),keyTest:e=>e[M.CTRL_OR_CMD]&&e.shiftKey&&e.key===M.ARROW_RIGHT,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,V.jsx)(Y,{hidden:!EE(t,r),type:`button`,icon:zb,onClick:()=>n(null),title:`${G(`labels.alignRight`)} \u2014 ${Z(`CtrlOrCmd+Shift+Right`)}`,"aria-label":G(`labels.alignRight`),visible:ha(Sa(e),t)})}),X({name:`alignVerticallyCentered`,label:`labels.centerVertically`,icon:Hb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>EE(t,r),perform:(e,t,n,r)=>({appState:t,elements:DE(e,t,r,{position:`center`,axis:`y`}),captureUpdate:P.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,V.jsx)(Y,{hidden:!EE(t,r),type:`button`,icon:Hb,onClick:()=>n(null),title:G(`labels.centerVertically`),"aria-label":G(`labels.centerVertically`),visible:ha(Sa(e),t)})}),X({name:`alignHorizontallyCentered`,label:`labels.centerHorizontally`,icon:Ub,trackEvent:{category:`element`},predicate:(e,t,n,r)=>EE(t,r),perform:(e,t,n,r)=>({appState:t,elements:DE(e,t,r,{position:`center`,axis:`x`}),captureUpdate:P.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,V.jsx)(Y,{hidden:!EE(t,r),type:`button`,icon:Ub,onClick:()=>n(null),title:G(`labels.centerHorizontally`),"aria-label":G(`labels.centerHorizontally`),visible:ha(Sa(e),t)})});var OE=(e,t)=>{let n=t.scene.getSelectedElements(e);return Ui(n,t.scene.getNonDeletedElementsMap(),e).length>2&&!n.some(e=>N(e))},kE=(e,t,n,r)=>{let i=Pa(Xa(n.scene.getSelectedElements(t),n.scene.getNonDeletedElementsMap(),r,t,n.scene));return $n(e.map(e=>i.get(e.id)||e),t,n)};X({name:`distributeHorizontally`,label:`labels.distributeHorizontally`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({appState:t,elements:kE(e,t,r,{space:`between`,axis:`x`}),captureUpdate:P.IMMEDIATELY}),keyTest:e=>!e[M.CTRL_OR_CMD]&&e.altKey&&e.code===vr.H,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,V.jsx)(Y,{hidden:!OE(t,r),type:`button`,icon:Bb,onClick:()=>n(null),title:`${G(`labels.distributeHorizontally`)} \u2014 ${Z(`Alt+H`)}`,"aria-label":G(`labels.distributeHorizontally`),visible:ha(Sa(e),t)})}),X({name:`distributeVertically`,label:`labels.distributeVertically`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({appState:t,elements:kE(e,t,r,{space:`between`,axis:`y`}),captureUpdate:P.IMMEDIATELY}),keyTest:e=>!e[M.CTRL_OR_CMD]&&e.altKey&&e.code===vr.V,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,V.jsx)(Y,{hidden:!OE(t,r),type:`button`,icon:Vb,onClick:()=>n(null),title:`${G(`labels.distributeVertically`)} \u2014 ${Z(`Alt+V`)}`,"aria-label":G(`labels.distributeVertically`),visible:ha(Sa(e),t)})});var AE=X({name:`flipHorizontal`,label:`labels.flipHorizontal`,icon:yS,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:$n(ME(e,r.scene.getNonDeletedElementsMap(),t,`horizontal`,r),t,r),appState:t,captureUpdate:P.IMMEDIATELY}),keyTest:e=>e.shiftKey&&e.code===vr.H}),jE=X({name:`flipVertical`,label:`labels.flipVertical`,icon:vS,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:$n(ME(e,r.scene.getNonDeletedElementsMap(),t,`vertical`,r),t,r),appState:t,captureUpdate:P.IMMEDIATELY}),keyTest:e=>e.shiftKey&&e.code===vr.V&&!e[M.CTRL_OR_CMD]}),ME=(e,t,n,r,i)=>{let a=Pa(NE(An(Sa(e),n,{includeBoundTextElement:!0,includeElementsInFrames:!0}),t,r,i));return e.map(e=>a.get(e.id)||e)},NE=(e,t,n,r)=>{if(e.every(e=>Mr(e)&&(e.startBinding||e.endBinding)))return e.map(e=>{let t=e;return j(t,{startArrowhead:t.endArrowhead,endArrowhead:t.startArrowhead})});let{midX:i,midY:a}=et(e);Bt(e,t,`nw`,r.scene,new Map(Array.from(t.values()).map(e=>[e.id,cr(e)])),{flipByX:n===`horizontal`,flipByY:n===`vertical`,shouldResizeFromCenter:!0,shouldMaintainAspectRatio:!0}),ya(e.filter(Mr),r.scene,r.state);let{elbowArrows:o,otherElements:s}=e.reduce((e,t)=>Ti(t)?{...e,elbowArrows:e.elbowArrows.concat(t)}:{...e,otherElements:e.otherElements.concat(t)},{elbowArrows:[],otherElements:[]}),{midX:c,midY:l}=et(e),[u,d]=[i-c,a-l];return s.forEach(e=>r.scene.mutateElement(e,{x:e.x+u,y:e.y+d})),o.forEach(e=>r.scene.mutateElement(e,{x:e.x+u,y:e.y+d})),e},PE=X({name:`copy`,label:`labels.copy`,icon:ab,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});try{await FT(i,r.files,n)}catch(e){return{captureUpdate:P.EVENTUALLY,appState:{...t,errorMessage:e.message}}}return{captureUpdate:P.EVENTUALLY}},keyTest:void 0}),FE=X({name:`paste`,label:`labels.paste`,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{let i;try{i=await RT()}catch(e){return e.name===`AbortError`||e.name===`NotAllowedError`?!1:(console.error(`actionPaste ${e.name}: ${e.message}`),Ra?{captureUpdate:P.EVENTUALLY,appState:{...t,errorMessage:G(`hints.firefox_clipboard_write`)}}:{captureUpdate:P.EVENTUALLY,appState:{...t,errorMessage:G(`errors.asyncPasteFailedOnRead`)}})}try{r.pasteFromClipboard(NT({types:i}))}catch(e){return console.error(e),{captureUpdate:P.EVENTUALLY,appState:{...t,errorMessage:G(`errors.asyncPasteFailedOnParse`)}}}return{captureUpdate:P.EVENTUALLY}},keyTest:void 0}),IE=X({name:`cut`,label:`labels.cut`,icon:Kx,trackEvent:{category:`element`},perform:(e,t,n,r)=>(PE.perform(e,t,n,r),YS.perform(e,t,null,r)),keyTest:e=>e[M.CTRL_OR_CMD]&&e.key===M.X}),LE=X({name:`copyAsSvg`,label:`labels.copyAsSvg`,icon:SS,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{if(!r.canvas)return{captureUpdate:P.EVENTUALLY};let{exportedElements:i,exportingFrame:a}=XT(e,t,!0);try{return await ZT(`clipboard-svg`,i,t,r.files,{...t,exportingFrame:a,name:r.getName()}),{appState:{toast:{message:G(`toast.copyToClipboardAsSvg`,{exportSelection:r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}).length?G(`toast.selection`):G(`toast.canvas`),exportColorScheme:t.exportWithDarkMode?G(`buttons.darkMode`):G(`buttons.lightMode`)})}},captureUpdate:P.EVENTUALLY}}catch(e){return console.error(e),{appState:{errorMessage:e.message},captureUpdate:P.EVENTUALLY}}},predicate:e=>AT&&e.length>0,keywords:[`svg`,`clipboard`,`copy`]}),RE=X({name:`copyAsPng`,label:`labels.copyAsPng`,icon:CS,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{if(!r.canvas)return{captureUpdate:P.EVENTUALLY};let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),{exportedElements:a,exportingFrame:o}=XT(e,t,!0);try{return await ZT(`clipboard`,a,t,r.files,{...t,exportingFrame:o,name:r.getName()}),{appState:{...t,toast:{message:G(`toast.copyToClipboardAsPng`,{exportSelection:i.length?G(`toast.selection`):G(`toast.canvas`),exportColorScheme:t.exportWithDarkMode?G(`buttons.darkMode`):G(`buttons.lightMode`)})}},captureUpdate:P.EVENTUALLY}}catch(e){return console.error(e),{appState:{...t,errorMessage:e.message},captureUpdate:P.EVENTUALLY}}},predicate:e=>jT&&e.length>0,keyTest:e=>e.code===vr.C&&e.altKey&&e.shiftKey,keywords:[`png`,`clipboard`,`copy`]}),zE=X({name:`copyText`,label:`labels.copyText`,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});try{qT(zn(i))}catch{throw Error(G(`errors.copyToSystemClipboardFailed`))}return{captureUpdate:P.EVENTUALLY}},predicate:(e,t,n,r)=>AT&&r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}).some(R),keywords:[`text`,`clipboard`,`copy`]}),BE=X({name:`gridMode`,icon:OS,keywords:[`snap`],label:`labels.toggleGrid`,viewMode:!0,trackEvent:{category:`canvas`,predicate:e=>e.gridModeEnabled},perform(e,t){return{appState:{...t,gridModeEnabled:!this.checked(t),objectsSnapModeEnabled:!1},captureUpdate:P.EVENTUALLY}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>n.gridModeEnabled===void 0,keyTest:e=>e[M.CTRL_OR_CMD]&&e.code===vr.QUOTE}),VE=X({name:`zenMode`,label:`buttons.zenMode`,icon:TS,viewMode:!0,trackEvent:{category:`canvas`,predicate:e=>!e.zenModeEnabled},perform(e,t){return{appState:{...t,zenModeEnabled:!this.checked(t)},captureUpdate:P.EVENTUALLY}},checked:e=>e.zenModeEnabled,predicate:(e,t,n,r)=>r.editorInterface.formFactor!==`phone`&&typeof n.zenModeEnabled>`u`,keyTest:e=>!e[M.CTRL_OR_CMD]&&e.altKey&&e.code===vr.Z}),HE=X({name:`objectsSnapMode`,label:`buttons.objectsSnapMode`,icon:wS,viewMode:!1,trackEvent:{category:`canvas`,predicate:e=>!e.objectsSnapModeEnabled},perform(e,t){return{appState:{...t,objectsSnapModeEnabled:!this.checked(t),gridModeEnabled:!1},captureUpdate:P.EVENTUALLY}},checked:e=>e.objectsSnapModeEnabled,predicate:(e,t,n)=>typeof n.objectsSnapModeEnabled>`u`,keyTest:e=>!e[M.CTRL_OR_CMD]&&e.altKey&&e.code===vr.S}),UE=X({name:`arrowBinding`,label:`labels.arrowBinding`,viewMode:!1,trackEvent:{category:`canvas`,predicate:e=>e.bindingPreference===`disabled`},perform(e,t){let n=t.bindingPreference===`enabled`?`disabled`:`enabled`;return{appState:{...t,bindingPreference:n,isBindingEnabled:n===`enabled`},captureUpdate:P.NEVER}},checked:e=>e.bindingPreference===`enabled`}),WE=X({name:`midpointSnapping`,label:`labels.midpointSnapping`,viewMode:!1,trackEvent:{category:`canvas`,predicate:e=>!e.isMidpointSnappingEnabled},perform(e,t){return{appState:{...t,isMidpointSnappingEnabled:!this.checked(t)},captureUpdate:P.NEVER}},checked:e=>e.isMidpointSnappingEnabled}),GE=X({name:`stats`,label:`stats.fullTitle`,icon:_S,viewMode:!0,trackEvent:{category:`menu`},keywords:[`edit`,`attributes`,`customize`],perform(e,t){return{appState:{...t,stats:{...t.stats,open:!this.checked(t)}},captureUpdate:P.EVENTUALLY}},checked:e=>e.stats.open,keyTest:e=>!e[M.CTRL_OR_CMD]&&e.altKey&&e.code===vr.SLASH}),KE=X({name:`unbindText`,label:`labels.unbindText`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>r.scene.getSelectedElements(t).some(e=>ai(e)),perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=r.scene.getNonDeletedElementsMap();return i.forEach(e=>{let t=So(e,a);if(t){let{width:n,height:i}=Ja(t.originalText,Ho(t),t.lineHeight),o=dt(e.id);nt(e.id);let{x:s,y:c}=Ir(e,t,a);r.scene.mutateElement(t,{containerId:null,width:n,height:i,text:t.originalText,x:s,y:c}),r.scene.mutateElement(e,{boundElements:e.boundElements?.filter(e=>e.id!==t.id),height:o||e.height})}}),{elements:e,appState:t,captureUpdate:P.IMMEDIATELY}}}),qE=X({name:`bindText`,label:`labels.bindText`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);if(i.length===2){let e=R(i[0])||R(i[1]),t;if(bi(i[0])?t=i[0]:bi(i[1])&&(t=i[1]),e&&t&&So(t,r.scene.getNonDeletedElementsMap())===null)return!0}return!1},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a,o;R(i[0])&&bi(i[1])?(a=i[0],o=i[1]):(a=i[1],o=i[0]),r.scene.mutateElement(a,{containerId:o.id,verticalAlign:zs.MIDDLE,textAlign:Ha.CENTER,autoResize:!0,angle:Mr(o)?0:o?.angle??0}),r.scene.mutateElement(o,{boundElements:(o.boundElements||[]).concat({type:`text`,id:a.id})});let s=o.height;return Fn(a,o,r.scene),$o(o.id,s),{elements:JE(e,o,a),appState:{...t,selectedElementIds:{[o.id]:!0}},captureUpdate:P.IMMEDIATELY}}}),JE=(e,t,n)=>{let r=e.slice(),i=r.findIndex(e=>e.id===n.id);r.splice(i,1);let a=r.findIndex(e=>e.id===t.id);return r.splice(a+1,0,n),wo(r,Pa([t,n])),r},YE=(e,t,n)=>{let r=e.slice(),i=r.findIndex(e=>e.id===t.id);r.splice(i,1);let a=r.findIndex(e=>e.id===n.id);return r.splice(a,0,t),wo(r,Pa([t,n])),r},XE=X({name:`wrapTextInContainer`,label:`labels.createContainerFromText`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=i.some(e=>R(e)&&!xo(e));return i.length>0&&a},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=e.slice(),o={};for(let e of i)if(R(e)&&!xo(e)){let n=fc({type:`rectangle`,backgroundColor:t.currentItemBackgroundColor,boundElements:[...e.boundElements||[],{id:e.id,type:`text`}],angle:e.angle,fillStyle:t.currentItemFillStyle,strokeColor:t.currentItemStrokeColor,roughness:t.currentItemRoughness,strokeWidth:ga(`rectangle`,t.currentItemStrokeWidthKey),strokeStyle:t.currentItemStrokeStyle,roundness:t.currentItemRoundness===`round`?{type:jr(`rectangle`)?Go.ADAPTIVE_RADIUS:Go.PROPORTIONAL_RADIUS}:null,opacity:100,locked:!1,x:e.x-5,y:e.y-5,width:T(e.width,`rectangle`),height:T(e.height,`rectangle`),groupIds:e.groupIds,frameId:e.frameId});if(e.boundElements?.length){let t=e.boundElements.filter(e=>e.type===`arrow`).map(e=>e.id);a.filter(e=>t.includes(e.id)).forEach(t=>{let i=t.startBinding,a=t.endBinding;i?.elementId===e.id&&(i={...i,elementId:n.id}),a?.elementId===e.id&&(a={...a,elementId:n.id}),(i||a)&&r.scene.mutateElement(t,{startBinding:i,endBinding:a})})}r.scene.mutateElement(e,{containerId:n.id,verticalAlign:zs.MIDDLE,boundElements:null,textAlign:Ha.CENTER,autoResize:!0}),Fn(e,n,r.scene),a=YE([...a,n],n,e),o[n.id]=!0}return{elements:a,appState:{...t,selectedElementIds:o},captureUpdate:P.IMMEDIATELY}}}),ZE=380,QE=42,$E=5,eD=85,tD=500,nD=!1,rD=new Map,iD=({element:e,scene:t,setAppState:n,onLinkOpen:r,setToast:i,updateEmbedValidationStatus:o})=>{let s=t.getNonDeletedElementsMap(),c=nB(),l=Zz(),u=Qz(),d=e.link||``,[f,p]=(0,B.useState)(d),m=(0,B.useRef)(null),h=c.showHyperlinkPopup===`editor`,g=(0,B.useCallback)(()=>{if(!m.current)return;let r=je(m.current.value)||null;if(!e.link&&r&&rC(`hyperlink`,`create`),rc(e)){if(c.activeEmbeddable?.element===e&&n({activeEmbeddable:null}),!r){t.mutateElement(e,{link:null}),o(e,!1);return}if(!Ao(r,l.validateEmbeddable))r&&i({message:G(`toast.unableToEmbed`),closable:!0}),e.link&&rD.set(e.id,e.link),t.mutateElement(e,{link:r}),o(e,!1);else{let{width:n,height:a}=e,s=fr(r);s?.error instanceof URIError&&i({message:G(`toast.unrecognizedLinkFormat`),closable:!0});let c=s?s.intrinsicSize.w/s.intrinsicSize.h:1,l=rD.get(e.id)!==e.link;t.mutateElement(e,{...l?{width:s?.type===`video`?n>a?n:a*c:n,height:s?.type===`video`&&n>a?n/c:a}:{},link:r}),o(e,!0),rD.has(e.id)&&rD.delete(e.id)}}else t.mutateElement(e,{link:r})},[e,t,i,l.validateEmbeddable,c.activeEmbeddable,n,o]);(0,B.useLayoutEffect)(()=>()=>{g()},[g]),(0,B.useEffect)(()=>{h&&m?.current&&!(u.formFactor===`phone`||u.isTouchScreen)&&m.current.select()},[h,u.formFactor,u.isTouchScreen]),(0,B.useEffect)(()=>{let t=null,r=r=>{h||(t&&clearTimeout(t),dD(e,s,c,a(r.clientX,r.clientY))&&(t=window.setTimeout(()=>{n({showHyperlinkPopup:!1})},tD)))};return window.addEventListener(L.POINTER_MOVE,r,!1),()=>{window.removeEventListener(L.POINTER_MOVE,r,!1),t&&clearTimeout(t)}},[c,e,h,n,s]);let _=(0,B.useCallback)(()=>{rC(`hyperlink`,`delete`),t.mutateElement(e,{link:null}),n({showHyperlinkPopup:!1})},[n,e,t]),v=()=>{rC(`hyperlink`,`edit`,`popup-ui`),n({showHyperlinkPopup:`editor`})},{x:y,y:b}=aD(e,c,s);return c.contextMenu||c.selectedElementsAreBeingDragged||c.resizingElement||c.isRotating||c.openMenu||c.viewModeEnabled?null:(0,V.jsxs)(`div`,{className:`excalidraw-hyperlinkContainer`,style:{top:`${b}px`,left:`${y}px`,width:ZE,padding:$E},children:[h?(0,V.jsx)(`input`,{className:H(`excalidraw-hyperlinkContainer-input`),placeholder:G(`labels.link.hint`),ref:m,value:f,onChange:e=>p(e.target.value),autoFocus:!0,onKeyDown:e=>{e.stopPropagation(),e[M.CTRL_OR_CMD]&&e.key===M.K&&e.preventDefault(),(e.key===M.ENTER||e.key===M.ESCAPE)&&(g(),n({showHyperlinkPopup:`info`}))}}):e.link?(0,V.jsx)(`a`,{href:je(e.link||``),className:`excalidraw-hyperlinkContainer-link`,target:Ai(e.link)?`_self`:`_blank`,onClick:t=>{if(e.link&&r){let n=No(L.EXCALIDRAW_LINK,t.nativeEvent);r({...e,link:je(e.link)},n),n.defaultPrevented&&t.preventDefault()}},rel:`noopener noreferrer`,children:e.link}):(0,V.jsx)(`div`,{className:`excalidraw-hyperlinkContainer-link`,children:G(`labels.link.empty`)}),(0,V.jsxs)(`div`,{className:`excalidraw-hyperlinkContainer__buttons`,children:[!h&&(0,V.jsx)(Y,{type:`button`,title:G(`buttons.edit`),"aria-label":G(`buttons.edit`),label:G(`buttons.edit`),onClick:v,className:`excalidraw-hyperlinkContainer--edit`,icon:Yy}),(0,V.jsx)(Y,{type:`button`,title:G(`labels.linkToElement`),"aria-label":G(`labels.linkToElement`),label:G(`labels.linkToElement`),onClick:()=>{n({openDialog:{name:`elementLinkSelector`,sourceElementId:e.id}})},icon:LS}),d&&!rc(e)&&(0,V.jsx)(Y,{type:`button`,title:G(`buttons.remove`),"aria-label":G(`buttons.remove`),label:G(`buttons.remove`),onClick:_,className:`excalidraw-hyperlinkContainer--remove`,icon:rb})]})]})},aD=(e,t,n)=>{let[r,i]=Zi(e,n),{x:a,y:o}=Qi({sceneX:r+e.width/2,sceneY:i},t);return{x:a-t.offsetLeft-ZE/2,y:o-t.offsetTop-eD}},oD=(e,t)=>{let n=An(e,t);return rc(n[0])?`labels.link.editEmbed`:n[0]?.link?`labels.link.edit`:`labels.link.create`},sD=null,cD=(e,t,n)=>{sD&&clearTimeout(sD),sD=window.setTimeout(()=>lD(e,t,n),300)},lD=(e,t,n)=>{if(!e.link)return;let r=Aw();r.classList.add(`excalidraw-tooltip--visible`),r.style.maxWidth=`20rem`,r.textContent=Gt(e.link)?G(`labels.link.goToElement`):e.link;let[i,a,o,s]=Zi(e,n),[c,l,u,d]=Sn([i,a,o,s],e.angle,t),f=Qi({sceneX:c,sceneY:l},t);jw(r,{left:f.x,top:f.y,width:u,height:d},`top`),rC(`hyperlink`,`tooltip`,`link-icon`),nD=!0},uD=()=>{sD&&clearTimeout(sD),nD&&(nD=!1,Aw().classList.remove(`excalidraw-tooltip--visible`))},dD=(e,t,n,[r,i])=>{let{x:o,y:s}=Ka({clientX:r,clientY:i},n),c=15/n.zoom.value;if(lo(a(o,s),e,t))return!1;let[l,u,d]=Zi(e,t);if(o>=l&&o<=d&&s>=u-eD&&s<=u)return!1;let{x:f,y:p}=aD(e,n,t);return!(r>=f-c&&r<=f+ZE+$E*2+c&&i>=p-c&&i<=p+c+$E*2+QE)},fD=X({name:`hyperlink`,label:(e,t)=>oD(Sa(e),t),icon:_b,perform:(e,t)=>t.showHyperlinkPopup!==`editor`&&{elements:e,appState:{...t,showHyperlinkPopup:`editor`,openMenu:null},captureUpdate:P.IMMEDIATELY},trackEvent:{category:`hyperlink`,action:`click`},keyTest:e=>e[M.CTRL_OR_CMD]&&e.key===M.K,predicate:(e,t)=>An(e,t).length===1,PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=An(e,t);return(0,V.jsx)(Y,{type:`toggle`,icon:_b,"aria-label":G(oD(Sa(e),t)),title:`${rc(e[0])?G(`labels.link.labelEmbed`):G(`labels.link.label`)} - ${Z(`CtrlOrCmd+K`)}`,onSelect:()=>n(null),checked:r.length===1&&!!r[0].link})}}),pD=e=>e.every(e=>!e.locked),mD=X({name:`toggleElementLock`,label:(e,t,n)=>pD(n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}))?`labels.elementLock.lock`:`labels.elementLock.unlock`,icon:(e,t)=>pD(An(t,e))?Iy:Fy,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return i.length>0&&!i.some(e=>e.locked&&e.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=pD(i),o=Pa(i),s=i.length>1&&ht(i),c=i.length===1||s?null:Cs(),l={...t.lockedMultiSelections};if(a)l={...t.lockedMultiSelections,...c?{[c]:!0}:{}};else if(s){let e=i[0].groupIds.at(-1);delete l[e]}let u=e.map(e=>{if(!o.has(e.id))return e;let n=e.groupIds;return a?c&&(n=[...n,c]):n=n.filter(e=>!t.lockedMultiSelections[e]),j(e,{locked:a,groupIds:n.length===e.groupIds.length?e.groupIds:n})}),d=Pa(u),f=a?{}:Object.fromEntries(i.map(e=>[e.id,!0])),p=i.map(e=>d.get(e.id)||e),m=a?{}:eo(Sa(p),t),h=a?c||(s?i[0].groupIds.at(-1):i[0].id):null;return{elements:u,appState:{...t,selectedElementIds:f,selectedGroupIds:m,selectedLinearElement:a?null:t.selectedLinearElement,lockedMultiSelections:l,activeLockedId:h},captureUpdate:P.IMMEDIATELY}},keyTest:(e,t,n,r)=>e.key.toLocaleLowerCase()===M.L&&e[M.CTRL_OR_CMD]&&e.shiftKey&&r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}).length>0}),hD=X({name:`unlockAllElements`,trackEvent:{category:`canvas`},viewMode:!1,icon:Fy,predicate:(e,t)=>An(e,t).length===0&&e.some(e=>e.locked),perform:(e,t)=>{let n=e.filter(e=>e.locked),r=e.map(e=>{if(e.locked){let n=e.groupIds.filter(e=>!t.lockedMultiSelections[e]);return j(e,{locked:!1,groupIds:e.groupIds.length===n.length?e.groupIds:n})}return e}),i=Pa(r),a=Sa(n.map(e=>i.get(e.id)||e));return{elements:r,appState:{...t,selectedElementIds:Object.fromEntries(a.map(e=>[e.id,!0])),selectedGroupIds:eo(a,t),lockedMultiSelections:{},activeLockedId:null},captureUpdate:P.IMMEDIATELY}},label:`labels.elementLock.unlockAll`}),gD=8,_D=10,vD=[`rectangle`,`diamond`,`ellipse`],yD=[`line`,`sharpArrow`,`curvedArrow`,`elbowArrow`],bD=new Set(vD),xD=new Set(yD),SD=e=>bD.has(e),CD=e=>e===`arrow`||xD.has(e),wD=Ec(null),TD=new Map,ED=new Map,DD=({app:e})=>{let t=e.scene.getSelectedElements(e.state),n=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(t.length===0){e.updateEditorAtom(wD,null);return}let r=jD(t);r&&!n.current?n.current=r:(n.current&&!r||n.current&&r!==n.current)&&(e.updateEditorAtom(wD,null),n.current=null)},[t,e]),(0,B.useEffect)(()=>()=>{TD.clear(),ED.clear()},[]),(0,V.jsx)(OD,{app:e,elements:t})},OD=({app:e,elements:t})=>{let n=jD(t),r=(0,B.useMemo)(()=>n===`generic`?PD(t):[],[n,t]),i=(0,B.useMemo)(()=>n===`linear`?FD(t):[],[n,t]),o=n===`generic`?r.every(e=>e.type===r[0].type):n===`linear`&&i.every(e=>Ki(e)===Ki(i[0])),[s,c]=(0,B.useState)({x:0,y:0}),l=(0,B.useRef)(``),u=(0,B.useRef)(null);(0,B.useEffect)(()=>{let t=[...r,...i].sort((e,t)=>e.id.localeCompare(t.id)),n=`
46
+ ${e.state.scrollX}${e.state.scrollY}${e.state.offsetTop}${e.state.offsetLeft}${e.state.zoom.value}${t.map(e=>e.id).join(`,`)}`;if(n===l.current)return;l.current=n;let o;if(t.length===1){let[n,,,r,i,s]=Zi(t[0],e.scene.getNonDeletedElementsMap());o=ot(a(n,r),a(i,s),t[0].angle)}else{let{minX:e,maxY:n}=et(t);o=a(e,n)}let{x:s,y:u}=Qi({sceneX:o[0],sceneY:o[1]},e.state);c({x:s,y:u})},[r,i,e.scene,e.state]),(0,B.useEffect)(()=>{for(let e of i){let t=ND(e.id,WD(e));ED.has(t)||ED.set(t,e)}},[i]),(0,B.useEffect)(()=>{for(let t of r)if(!TD.has(t.id)){let n=So(t,e.scene.getNonDeletedElementsMap());n&&TD.set(t.id,{fontSize:n.fontSize})}},[r,e.scene]);let d=n===`linear`?[[`line`,qy],[`sharpArrow`,AS],[`curvedArrow`,MS],[`elbowArrow`,jS]]:n===`generic`?[[`rectangle`,Uy],[`diamond`,Wy],[`ellipse`,Gy]]:[];return(0,V.jsx)(`div`,{ref:u,tabIndex:-1,style:{position:`absolute`,top:`${s.y+(_D+8)*e.state.zoom.value-e.state.offsetTop}px`,left:`${s.x-e.state.offsetLeft-gD}px`,zIndex:2},className:sa.CONVERT_ELEMENT_TYPE_POPUP,children:d.map(([a,s])=>{let c=o&&(n===`generic`&&r[0].type===a||n===`linear`&&Ki(i[0])===a);return(0,V.jsx)(Y,{type:`toggle`,icon:s,checked:c,title:a,"aria-label":a,"data-testid":`toolbar-${a}`,onSelect:()=>{c||(e.state.activeTool.type!==a&&rC(`convertElementType`,a,`ui`),AD(e,{conversionType:n,nextType:a}),u.current?.focus())}},`${t[0].id}${t[0].version}_${a}`)})})},kD=(e,t,n)=>{let r=Ko(e,t),i=En(e,t),a=Ja(Pn(t.text,Ho(t),r),Ho(t),t.lineHeight),o=t.fontSize;for(;(a.width>r||a.height>i)&&o>0;){--o;let e={...t,fontSize:o};a=Ja(t.text,Ho(e),t.lineHeight)}Ye(t,n.getNonDeletedElementsMap(),{fontSize:o,width:a.width,height:a.height}),Fn(t,e,n)},AD=(e,{conversionType:t,nextType:n,direction:r=`right`})=>{if(!t)return!1;let i=e.scene.getSelectedElements(e.state),a=i.reduce((e,t)=>({...e,[t.id]:!0}),{}),o=r===`right`?1:-1;if(t===`generic`){let t=PD(i),r=t.every(e=>e.type===t[0].type)?vD.indexOf(t[0].type):-1;if(n??=vD[(r+vD.length+o)%vD.length],n&&SD(n)){let r={};for(let i of t){let t=HD(i,n,e);r[t.id]=t}let i=[];for(let t of e.scene.getElementsIncludingDeleted())r[t.id]?i.push(r[t.id]):i.push(t);e.scene.replaceAllElements(i);for(let t of Object.values(r)){let n=So(t,e.scene.getNonDeletedElementsMap());n&&(TD.get(t.id)&&Ye(n,e.scene.getNonDeletedElementsMap(),{fontSize:TD.get(t.id)?.fontSize??n.fontSize}),kD(t,n,e.scene))}e.setState(e=>({selectedElementIds:a,activeTool:kr(e,{type:`selection`})}))}}if(t===`linear`){let t=FD(i);if(!n){let e=ma(t,Ki);n=yD[((e?yD.indexOf(e):-1)+yD.length+o)%yD.length]}if(CD(n)){let r=[],i=e.scene.getElementsMapIncludingDeleted();for(let a of t){let t=ED.get(ND(a.id,n));if(t&&Ki(t)===n)i.set(t.id,t),r.push(t);else{let t=HD(a,n,e);i.set(t.id,t),r.push(t)}}e.scene.replaceAllElements(i);for(let t of r)if(ja(t))if(Ti(t)){let n=BD(t);if(n.length<2)continue;let r=[];for(let e=1;e<n.length-2;e++)r.push({start:n[e],end:n[e+1],index:e+1});let i=Nt(t,e.scene.getNonDeletedElementsMap(),{points:n,fixedSegments:r});Ye(t,e.scene.getNonDeletedElementsMap(),{...i,endArrowhead:`arrow`})}else{let n=ls([`line`,`sharpArrow`,`curvedArrow`],e=>ED.get(ND(t.id,e)));if(n){let r=n.points;e.scene.mutateElement(t,{points:r})}}}let r=FD(e.scene.getSelectedElements(e.state));e.setState(t=>({selectedElementIds:a,selectedLinearElement:r.length===1?new I(r[0],e.scene.getNonDeletedElementsMap()):null,activeTool:kr(t,{type:`selection`})}))}return!0},jD=e=>{if(e.length===0)return null;let t=!1;for(let n of e){if(SD(n.type))return`generic`;MD(n)&&(t=!0)}return t?`linear`:null},MD=e=>ja(e)&&(!Mr(e)||!cn(e)&&!ai(e)),ND=(e,t)=>`${e}:${t}`,PD=e=>e.filter(e=>SD(e.type)),FD=e=>e.filter(e=>MD(e)),ID=20,LD=(e,t)=>e[0]===t[0],RD=(e,t)=>e[1]===t[1],zD=(e,t)=>LD(e,t)?Math.abs(e[1]-t[1]):Math.abs(e[0]-t[0]),BD=e=>{let t=[e.points[0]],n=VD(e.points);for(let e=1;e<n.length;++e){let r=t[t.length-1],i=[...n[e]];Math.abs(i[0]-r[0])<ID?i[0]=r[0]:Math.abs(i[1]-r[1])<ID&&(i[1]=r[1]),LD(r,i)||RD(r,i)||t.push(a(r[0],i[1])),t.push(i)}let r=[t[0]];for(let e=1;e<t.length-1;++e)LD(t[e-1],t[e])&&LD(t[e],t[e+1])||RD(t[e-1],t[e])&&RD(t[e],t[e+1])||r.push(t[e]);r.push(t[t.length-1]);let i=[r[0]];for(let e=1;e<r.length-1;++e){let t=i[i.length-1],n=r[e],a=r[e+1],o=LD(t,n),s=LD(n,a);if(o!==s){let e=zD(t,n),r=zD(n,a);if(e<ID||r<ID){if(r<e)o?a[0]=t[0]:a[1]=t[1];else if(s)for(let e=i.length-1;e>=0&&i[e][0]===t[0];--e)i[e][0]=n[0];else for(let e=i.length-1;e>=0&&i[e][1]===t[1];--e)i[e][1]=n[1];continue}}i.push(n)}return i.push(r[r.length-1]),i},VD=e=>{if(e.length===0)return[];let t=[e[0]];for(let n=1;n<e.length;n++){let[r,i]=t[t.length-1],[a,o]=e[n];(r!==a||i!==o)&&t.push(e[n])}return t},HD=(e,t,n)=>{if(!UD(e.type,t)){if(!Co())throw Error(`Invalid conversion from ${e.type} to ${t}.`);return e}if(e.type===t)return e;if(wt.delete(e),SD(t)){let r=d(fc({...e,type:t,roundness:e.roundness?{type:jr(t)?Go.ADAPTIVE_RADIUS:Go.PROPORTIONAL_RADIUS}:e.roundness}));return It(r,n.scene,n.state),r}if(CD(t))switch(t){case`line`:return d(A({...e,type:`line`}));case`sharpArrow`:return d(ra({...e,type:`arrow`,elbowed:!1,roundness:null,startArrowhead:n.state.currentItemStartArrowhead,endArrowhead:n.state.currentItemEndArrowhead}));case`curvedArrow`:return d(ra({...e,type:`arrow`,elbowed:!1,roundness:{type:Go.PROPORTIONAL_RADIUS},startArrowhead:n.state.currentItemStartArrowhead,endArrowhead:n.state.currentItemEndArrowhead}));case`elbowArrow`:return d(ra({...e,type:`arrow`,elbowed:!0,fixedSegments:null,roundness:null}))}return er(t,`unhandled conversion type: ${t}`),e},UD=(e,t)=>!!(SD(e)&&SD(t)||CD(e)&&CD(t)),WD=e=>ja(e)?Ki(e):e.type,GD=DD,KD=X({name:`toggleShapeSwitch`,label:`labels.shapeSwitch`,icon:()=>null,viewMode:!0,trackEvent:{category:`shape_switch`,action:`toggle`},keywords:[`change`,`switch`,`swap`],perform(e,t,n,r){return py.set(wD,{type:`panel`}),{captureUpdate:P.NEVER}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>jD(e)!==null}),qD=X({name:`copyElementLink`,label:`labels.copyElementLink`,icon:Gx,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{let i=An(e,t);try{if(window.location){let n=yo(i,t);return n?(await qT(r.props.generateLinkForSelection?r.props.generateLinkForSelection(n.id,n.type):o(n.id,n.type)),{appState:{toast:{message:G(`toast.elementLinkCopied`),closable:!0}},captureUpdate:P.EVENTUALLY}):{appState:t,elements:e,app:r,captureUpdate:P.EVENTUALLY}}}catch(e){console.error(e)}return{appState:t,elements:e,app:r,captureUpdate:P.EVENTUALLY}},predicate:(e,t)=>_r(An(e,t))}),JD=X({name:`linkToElement`,label:`labels.linkToElement`,icon:LS,perform:(e,t,n,r)=>{let i=An(e,t);return i.length!==1||!_r(i)?{elements:e,appState:t,app:r,captureUpdate:P.EVENTUALLY}:{appState:{...t,openDialog:{name:`elementLinkSelector`,sourceElementId:An(e,t)[0].id}},captureUpdate:P.IMMEDIATELY}},predicate:(e,t,n,r)=>{let i=An(e,t);return t.openDialog?.name!==`elementLinkSelector`&&i.length===1&&_r(i)},trackEvent:!1}),YD={toggleTheme:[Z(`Shift+Alt+D`)],saveScene:[Z(`CtrlOrCmd+S`)],loadScene:[Z(`CtrlOrCmd+O`)],clearCanvas:[Z(`CtrlOrCmd+Delete`)],imageExport:[Z(`CtrlOrCmd+Shift+E`)],commandPalette:[Z(`CtrlOrCmd+/`),Z(`CtrlOrCmd+Shift+P`)],cut:[Z(`CtrlOrCmd+X`)],copy:[Z(`CtrlOrCmd+C`)],paste:[Z(`CtrlOrCmd+V`)],copyStyles:[Z(`CtrlOrCmd+Alt+C`)],pasteStyles:[Z(`CtrlOrCmd+Alt+V`)],selectAll:[Z(`CtrlOrCmd+A`)],deleteSelectedElements:[Z(`Delete`)],duplicateSelection:[Z(`CtrlOrCmd+D`),Z(`Alt+${G(`helpDialog.drag`)}`)],sendBackward:[Z(`CtrlOrCmd+[`)],bringForward:[Z(`CtrlOrCmd+]`)],sendToBack:[Z(Nn?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)],bringToFront:[Z(Nn?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)],copyAsPng:[Z(`Shift+Alt+C`)],group:[Z(`CtrlOrCmd+G`)],ungroup:[Z(`CtrlOrCmd+Shift+G`)],gridMode:[Z(`CtrlOrCmd+'`)],zenMode:[Z(`Alt+Z`)],objectsSnapMode:[Z(`Alt+S`)],stats:[Z(`Alt+/`)],addToLibrary:[],flipHorizontal:[Z(`Shift+H`)],flipVertical:[Z(`Shift+V`)],viewMode:[Z(`Alt+R`)],hyperlink:[Z(`CtrlOrCmd+K`)],toggleElementLock:[Z(`CtrlOrCmd+Shift+L`)],resetZoom:[Z(`CtrlOrCmd+0`)],zoomOut:[Z(`CtrlOrCmd+-`)],zoomIn:[Z(`CtrlOrCmd++`)],zoomToFitSelection:[Z(`Shift+3`)],zoomToFit:[Z(`Shift+1`)],zoomToFitSelectionInViewport:[Z(`Shift+2`)],saveFileToDisk:[Z(`CtrlOrCmd+S`)],saveToActiveFile:[Z(`CtrlOrCmd+S`)],toggleShortcuts:[Z(`?`)],searchMenu:[Z(`CtrlOrCmd+F`)],wrapSelectionInFrame:[],toolLock:[Z(`Q`)]},XD=(e,t=0)=>{let n=YD[e];return n&&n.length>0?n[t]||n[0]:``},ZD=RegExp(`[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]`,`g`),QD=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,$D={À:`A`,Á:`A`,Â:`A`,Ã:`A`,Ä:`A`,Å:`A`,à:`a`,á:`a`,â:`a`,ã:`a`,ä:`a`,å:`a`,Ç:`C`,ç:`c`,Ð:`D`,ð:`d`,È:`E`,É:`E`,Ê:`E`,Ë:`E`,è:`e`,é:`e`,ê:`e`,ë:`e`,Ì:`I`,Í:`I`,Î:`I`,Ï:`I`,ì:`i`,í:`i`,î:`i`,ï:`i`,Ñ:`N`,ñ:`n`,Ò:`O`,Ó:`O`,Ô:`O`,Õ:`O`,Ö:`O`,Ø:`O`,ò:`o`,ó:`o`,ô:`o`,õ:`o`,ö:`o`,ø:`o`,Ù:`U`,Ú:`U`,Û:`U`,Ü:`U`,ù:`u`,ú:`u`,û:`u`,ü:`u`,Ý:`Y`,ý:`y`,ÿ:`y`,Æ:`E`,æ:`e`,Þ:`T`,þ:`t`,ß:`s`,Ā:`A`,Ă:`A`,Ą:`A`,ā:`a`,ă:`a`,ą:`a`,Ć:`C`,Ĉ:`C`,Ċ:`C`,Č:`C`,ć:`c`,ĉ:`c`,ċ:`c`,č:`c`,Ď:`D`,Đ:`D`,ď:`d`,đ:`d`,Ē:`E`,Ĕ:`E`,Ė:`E`,Ę:`E`,Ě:`E`,ē:`e`,ĕ:`e`,ė:`e`,ę:`e`,ě:`e`,Ĝ:`G`,Ğ:`G`,Ġ:`G`,Ģ:`G`,ĝ:`g`,ğ:`g`,ġ:`g`,ģ:`g`,Ĥ:`H`,Ħ:`H`,ĥ:`h`,ħ:`h`,Ĩ:`I`,Ī:`I`,Ĭ:`I`,Į:`I`,İ:`I`,ĩ:`i`,ī:`i`,ĭ:`i`,į:`i`,ı:`i`,Ĵ:`J`,ĵ:`j`,Ķ:`K`,ķ:`k`,ĸ:`k`,Ĺ:`L`,Ļ:`L`,Ľ:`L`,Ŀ:`L`,Ł:`L`,ĺ:`l`,ļ:`l`,ľ:`l`,ŀ:`l`,ł:`l`,Ń:`N`,Ņ:`N`,Ň:`N`,Ŋ:`N`,ń:`n`,ņ:`n`,ň:`n`,ŋ:`n`,Ō:`O`,Ŏ:`O`,Ő:`O`,ō:`o`,ŏ:`o`,ő:`o`,Ŕ:`R`,Ŗ:`R`,Ř:`R`,ŕ:`r`,ŗ:`r`,ř:`r`,Ś:`S`,Ŝ:`S`,Ş:`S`,Š:`S`,ś:`s`,ŝ:`s`,ş:`s`,š:`s`,Ţ:`T`,Ť:`T`,Ŧ:`T`,ţ:`t`,ť:`t`,ŧ:`t`,Ũ:`U`,Ū:`U`,Ŭ:`U`,Ů:`U`,Ű:`U`,Ų:`U`,ũ:`u`,ū:`u`,ŭ:`u`,ů:`u`,ű:`u`,ų:`u`,Ŵ:`W`,ŵ:`w`,Ŷ:`Y`,ŷ:`y`,Ÿ:`Y`,Ź:`Z`,Ż:`Z`,Ž:`Z`,ź:`z`,ż:`z`,ž:`z`,IJ:`I`,ij:`i`,Œ:`E`,œ:`e`,ʼn:`n`,ſ:`s`},eO=e=>e.replace(QD,e=>$D[e]||e).replace(ZD,``),tO=()=>{let[e,t]=(0,B.useState)(null);return[e,(0,B.useCallback)(e=>t(e),[])]},nO=({elements:e,appState:t,files:n,maxWidthOrHeight:r,getDimensions:i,exportPadding:a,exportingFrame:o})=>{let s=Sa(Fo(e,null,{deleteInvisibleElements:!0})),c=Wi(t,null),{exportBackground:l,viewBackgroundColor:u}=c;return vo(s,{...c,offsetTop:0,offsetLeft:0,width:0,height:0},n||{},{exportBackground:l,exportPadding:a,viewBackgroundColor:u,exportingFrame:o},(e,n)=>{let a=document.createElement(`canvas`);if(r){typeof i==`function`&&console.warn("`getDimensions()` is ignored when `maxWidthOrHeight` is supplied.");let o=Math.max(e,n),s=r<o?r/o:t?.exportScale??1;return a.width=e*s,a.height=n*s,{canvas:a,scale:s}}let o=i?.(e,n)||{width:e,height:n};return a.width=o.width,a.height=o.height,{canvas:a,scale:o.scale??1}})},rO=async({elements:e,appState:t=zt(),files:n={},exportPadding:r,renderEmbeddables:i,exportingFrame:a,skipInliningFonts:o,reuseImages:s})=>Sr(Sa(Fo(e,null,{deleteInvisibleElements:!0})),{...Wi(t,null),exportPadding:r},n,{exportingFrame:a,renderEmbeddables:i,skipInliningFonts:o,reuseImages:s}),iO=Ec(new Map),aO=async e=>await rO({elements:e,appState:{exportBackground:!1,viewBackgroundColor:Vs.white},files:null,renderEmbeddables:!1,skipInliningFonts:!0}),oO=(e,t,n,r)=>{let[i,a]=(0,B.useState)();return(0,B.useEffect)(()=>{if(t)if(e){let r=n.get(e);r?a(r):(async()=>{let r=await aO(t);r.querySelector(`.style-fonts`)?.remove(),r&&(n.set(e,r),a(r))})()}else(async()=>{let e=await aO(t);a(e)})()},[e,t,n,a]),(0,B.useEffect)(()=>{let e=r.current;if(e)return i&&(e.innerHTML=i.outerHTML),()=>{e.innerHTML=``}},[i,r]),i},sO=()=>{let[e]=W(iO);return{clearLibraryCache:()=>e.clear(),deleteItemsFromLibraryCache:t=>{t.forEach(t=>e.delete(t))},svgCache:e}},cO=new io,lO=Ec({status:`loaded`,isInitialized:!1,libraryItems:[]}),uO=e=>Xi(e),dO=(e,t)=>!e.find(e=>e.elements.length===t.elements.length&&e.elements.every((e,n)=>e.id===t.elements[n].id&&e.versionNonce===t.elements[n].versionNonce)),fO=(e,t)=>{let n=[];for(let r of t)dO(e,r)&&n.push(r);return[...n,...e]},pO=(e,t)=>{let n=Pa(t),r={deletedItems:new Map,addedItems:new Map,updatedItems:new Map};for(let t of e)n.has(t.id)||r.deletedItems.set(t.id,t);let i=Pa(e);for(let e of t){let t=i.get(e.id);t?_O(t)!==_O(e)&&r.updatedItems.set(e.id,e):r.addedItems.set(e.id,e)}return r},mO=class{constructor(e){z(this,`currLibraryItems`,[]),z(this,`prevLibraryItems`,uO(this.currLibraryItems)),z(this,`app`),z(this,`updateQueue`,[]),z(this,`getLastUpdateTask`,()=>this.updateQueue[this.updateQueue.length-1]),z(this,`notifyListeners`,()=>{if(this.updateQueue.length>0)py.set(lO,e=>({status:`loading`,libraryItems:this.currLibraryItems,isInitialized:e.isInitialized}));else{py.set(lO,{status:`loaded`,libraryItems:this.currLibraryItems,isInitialized:!0});try{let e=this.prevLibraryItems;this.prevLibraryItems=uO(this.currLibraryItems);let t=uO(this.currLibraryItems);this.app.props.onLibraryChange?.(t),cO.trigger(pO(e,t),t)}catch(e){console.error(e)}}}),z(this,`destroy`,()=>{this.updateQueue=[],this.currLibraryItems=[],py.set(iO,new Map)}),z(this,`resetLibrary`,()=>this.setLibrary([])),z(this,`getLatestLibrary`,()=>new Promise(async e=>{try{let t=await(this.getLastUpdateTask()||this.currLibraryItems);this.updateQueue.length>0?e(this.getLatestLibrary()):e(uO(t))}catch{return e(this.currLibraryItems)}})),z(this,`updateLibrary`,async({libraryItems:e,prompt:t=!1,merge:n=!1,openLibraryMenu:r=!1,defaultStatus:i=`unpublished`})=>(r&&this.app.setState({openSidebar:{name:oe.name,tab:`library`}}),this.setLibrary(()=>new Promise(async(r,a)=>{try{let o=await(typeof e==`function`&&!(e instanceof Blob)?e(this.currLibraryItems):e),s;s=o instanceof Blob?await Qo(o,i):ir(o,i),!t||window.confirm(G(`alerts.confirmAddLibrary`,{numShapes:s.length}))?(t&&this.app.focusContainer(),r(n?fO(this.currLibraryItems,s):s)):a(new Qa)}catch(e){a(e)}})))),z(this,`setLibrary`,e=>{let t=new Promise(async(t,n)=>{try{await this.getLastUpdateTask(),typeof e==`function`&&(e=e(this.currLibraryItems)),this.currLibraryItems=uO(await e),t(this.currLibraryItems)}catch(e){n(e)}}).catch(e=>{if(e.name===`AbortError`)return console.warn(`Library update aborted by user`),this.currLibraryItems;throw e}).finally(()=>{this.updateQueue=this.updateQueue.filter(e=>e!==t),this.notifyListeners()});return this.updateQueue.push(t),this.notifyListeners(),t}),this.app=e}},hO=e=>{let t=Math.ceil(Math.sqrt(e.length)),n=[],r=n=>e.slice(n*t,n*t+t).reduce((e,t)=>{let{height:n}=et(t.elements);return Math.max(e,n)},0),i=n=>{let r=0,i=0,a=0;for(let o of e){if(r%t===0&&(i=0),i===n){let{width:e}=et(o.elements);a=Math.max(a,e)}r++,i++}return a},a=0,o=0,s=0,c=0,l=0,u=0,d=0;for(let f of e){l&&l%t===0&&(o+=s+50,a=0,u=0,d++),u===0&&(s=r(d)),c=i(u);let{minX:e,minY:p,width:m,height:h}=et(f.elements),g=(c-m)/2,_=(s-h)/2;n.push(...f.elements.map(t=>({...t,x:t.x+a+g-e,y:t.y+o+_-p}))),a+=c+50,l++,u++}return n},gO=class e{constructor(e){z(this,`adapter`),this.adapter=e}static async getLibraryItems(t,n,r=!0){let i=()=>new Promise(async(e,r)=>{try{e(ir((await t.load({source:n}))?.libraryItems||[],`published`))}catch(e){r(e)}});return r?e.queue.push(i):i()}getLibraryItems(t){return e.getLibraryItems(this.adapter,t,!1)}};z(gO,`queue`,new oo),z(gO,`run`,async(e,t)=>{let n=new gO(e);return gO.queue.push(()=>t(n))});var _O=e=>`${e.id}:${e.name||``}:${ki(e.elements)}`,vO=({theme:e,id:t,libraryReturnUrl:n})=>{let r=n||window.location.origin+window.location.pathname;return(0,V.jsx)(`a`,{className:`library-menu-browse-button`,href:`${ds.VITE_APP_LIBRARY_URL}?target=${window.name||`_blank`}&referrer=${r}&useHash=true&token=${t}&theme=${e}&version=${nr.excalidrawLibrary}`,target:`_excalidraw_libraries`,children:G(`labels.libraries`)})},yO=({libraryReturnUrl:e,theme:t,id:n,style:r,children:i,className:a})=>(0,V.jsxs)(`div`,{className:H(`library-menu-control-buttons`,a),style:r,children:[(0,V.jsx)(vO,{id:n,libraryReturnUrl:e,theme:t}),i]}),bO=Ec(0),xO=e=>{let[t,n]=W(bO);return(0,B.useEffect)(()=>{let{current:t}=e;if(!t)return;let r=(0,wc.default)(()=>{let{scrollTop:e}=t;n(e)},200);return t.addEventListener(`scroll`,r),()=>{r.cancel(),t.removeEventListener(`scroll`,r)}},[e,n]),t},SO=({label:e,onClick:t,className:n,children:r,actionType:i,type:a=`button`,isLoading:o,...s})=>(0,V.jsxs)(`button`,{className:H(`Dialog__action-button`,i?`Dialog__action-button--${i}`:``,n),type:a,"aria-label":e,onClick:t,...s,children:[r&&(0,V.jsx)(`div`,{style:o?{visibility:`hidden`}:{},children:r}),(0,V.jsx)(`div`,{style:o?{visibility:`hidden`}:{},children:e}),o&&(0,V.jsx)(`div`,{style:{position:`absolute`,inset:0},children:(0,V.jsx)(GS,{})})]}),CO=e=>{let{onConfirm:t,onCancel:n,children:r,confirmText:i=G(`buttons.confirm`),cancelText:a=G(`buttons.cancel`),className:o=``,...s}=e,c=rB(),l=ly(yk),{container:u}=eB();return(0,V.jsxs)(Dk,{onCloseRequest:n,size:`small`,...s,className:`confirm-dialog ${o}`,children:[r,(0,V.jsxs)(`div`,{className:`confirm-dialog-buttons`,children:[(0,V.jsx)(SO,{label:a,onClick:()=>{c({openMenu:null}),l(!1),(0,Sc.flushSync)(()=>{n()}),u?.focus()}}),(0,V.jsx)(SO,{label:i,onClick:()=>{c({openMenu:null}),l(!1),(0,Sc.flushSync)(()=>{t()}),u?.focus()},actionType:`danger`})]})]})},wO=class{static has(e){try{return!!window.localStorage.getItem(e)}catch(e){return console.warn(`localStorage.getItem error: ${e.message}`),!1}}static get(e){try{let t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return console.warn(`localStorage.getItem error: ${e.message}`),null}}};z(wO,`set`,(e,t)=>{try{return window.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){return console.warn(`localStorage.setItem error: ${e.message}`),!1}}),z(wO,`delete`,e=>{try{window.localStorage.removeItem(e)}catch(e){console.warn(`localStorage.removeItem error: ${e.message}`)}});var TO=/({{[\w-]+}})|(<[\w-]+>)|(<\/[\w-]+>)/g,EO=/{{([\w-]+)}}/,DO=/<([\w-]+)>/,OO=/<\/([\w-]+)>/,kO=(e,t)=>{let n=[{name:``,children:[]}];return e.split(TO).filter(Boolean).forEach(r=>{let i=r.match(DO),a=r.match(OO),o=r.match(EO);if(i!==null){let r=i[1];t.hasOwnProperty(r)?n.push({name:r,children:[]}):console.warn(`Trans: missed to pass in prop ${r} for interpolating ${e}`)}else if(a!==null)if(a[1]===n[n.length-1].name){let e=n.pop(),r=B.createElement(B.Fragment,{},...e.children),i=t[e.name];typeof i==`function`&&n[n.length-1].children.push(i(r))}else console.warn(`Trans: unexpected end tag ${r} for interpolating ${e}`);else if(o!==null){let r=o[1];t.hasOwnProperty(r)?n[n.length-1].children.push(t[r]):console.warn(`Trans: key ${r} 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},AO=({i18nKey:e,children:t,...n})=>{let{t:r}=Ty();return B.createElement(B.Fragment,{},...kO(r(e),n))},jO=async e=>{let t=i(e,6),n=document.createElement(`canvas`);n.width=t[0].length*128+(t[0].length+1)*16-16,n.height=t.length*128+(t.length+1)*16-16;let r=n.getContext(`2d`);r.fillStyle=`#fff`,r.fillRect(0,0,n.width,n.height);for(let[t,n]of e.entries()){let e=await nO({elements:n.elements,files:null,maxWidthOrHeight:128}),{width:i,height:a}=e,o=Math.floor(t/6)*144,s=t%6*144;r.drawImage(e,s+(128-i)/2+8,o+(128-a)/2+8),r.lineWidth=2,r.strokeStyle=`#ced4da`,r.strokeRect(s+8/2,o+8/2,136,136)}return await At(new File([await Wa(n)],`preview`,{type:Se.png}),{outputType:Se.jpg,maxWidthOrHeight:5e3})},MO=({libItem:e,appState:t,index:n,onChange:r,onRemove:i})=>{let a=(0,B.useRef)(null),o=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let n=a.current;n&&(async()=>{let r=await rO({elements:e.elements,appState:{...t,viewBackgroundColor:`#fff`,exportBackground:!0},files:null,skipInliningFonts:!0});n.innerHTML=r.outerHTML})()},[e.elements,t]),(0,V.jsxs)(`div`,{className:`single-library-item`,children:[e.status===`published`&&(0,V.jsx)(`span`,{className:`single-library-item-status`,children:G(`labels.statusPublished`)}),(0,V.jsx)(`div`,{ref:a,className:`single-library-item__svg`}),(0,V.jsx)(Y,{"aria-label":G(`buttons.remove`),type:`button`,icon:Kb,className:`single-library-item--remove`,onClick:i.bind(null,e.id),title:G(`buttons.remove`)}),(0,V.jsxs)(`div`,{style:{display:`flex`,margin:`0.8rem 0`,width:`100%`,fontSize:`14px`,fontWeight:500,flexDirection:`column`},children:[(0,V.jsxs)(`label`,{style:{display:`flex`,justifyContent:`space-between`,flexDirection:`column`},children:[(0,V.jsxs)(`div`,{style:{padding:`0.5em 0`},children:[(0,V.jsx)(`span`,{style:{fontWeight:500,color:`#868e96`},children:G(`publishDialog.itemName`)}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,V.jsx)(`input`,{type:`text`,ref:o,style:{width:`80%`,padding:`0.2rem`},defaultValue:e.name,placeholder:`Item name`,onChange:e=>{r(e.target.value,n)}})]}),(0,V.jsx)(`span`,{className:`error`,children:e.error})]})]})},NO=({onClose:e,libraryItems:t,appState:n,onSuccess:r,onError:i,updateItemsInStorage:a,onRemove:o})=>{let[s,c]=(0,B.useState)({authorName:``,githubHandle:``,name:``,description:``,twitterHandle:``,website:``}),[l,u]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=wO.get(Lt.PUBLISH_LIBRARY);e&&c(e)},[]);let[d,f]=(0,B.useState)(t.slice());(0,B.useEffect)(()=>{f(t.slice())},[t]);let p=e=>{c({...s,[e.target.name]:e.target.value})},m=async e=>{e.preventDefault(),u(!0);let t=[],n=!1;if(d.forEach(e=>{let r=``;e.name||(r=G(`publishDialog.errors.required`),n=!0),t.push({...e,error:r})}),n){f(t),u(!1);return}let a=await jO(d),o={type:ct.excalidrawLibrary,version:nr.excalidrawLibrary,source:Wt(),libraryItems:d},c=JSON.stringify(o,null,2),l=new Blob([c],{type:`application/json`}),p=new FormData;p.append(`excalidrawLib`,l),p.append(`previewImage`,a),p.append(`previewImageType`,a.type),p.append(`title`,s.name),p.append(`authorName`,s.authorName),p.append(`githubHandle`,s.githubHandle),p.append(`name`,s.name),p.append(`description`,s.description),p.append(`twitterHandle`,s.twitterHandle),p.append(`website`,s.website),fetch(`${ds.VITE_APP_LIBRARY_BACKEND}/submit`,{method:`post`,body:p}).then(e=>e.ok?e.json().then(({url:e})=>{wO.delete(Lt.PUBLISH_LIBRARY),r({url:e,authorName:s.authorName,items:d})}):e.json().catch(()=>{throw Error(e.statusText||`something went wrong`)}).then(t=>{throw Error(t.message||e.statusText||`something went wrong`)}),e=>{console.error(e),i(e),u(!1)}).catch(e=>{console.error(e),i(e),u(!1)})},h=()=>{let e=[];return d.forEach((t,r)=>{e.push((0,V.jsx)(`div`,{className:`single-library-item-wrapper`,children:(0,V.jsx)(MO,{libItem:t,appState:n,index:r,onChange:(e,t)=>{let n=d.slice();n[t].name=e,f(n)},onRemove:o})},r))}),(0,V.jsx)(`div`,{className:`selected-library-items`,children:e})},g=(0,B.useCallback)(()=>{a(d),wO.set(Lt.PUBLISH_LIBRARY,s),e()},[d,e,a,s]),_=!!t.length,v=t.some(e=>e.status===`published`);return(0,V.jsx)(Dk,{onCloseRequest:g,title:G(`publishDialog.title`),className:`publish-library`,children:_?(0,V.jsxs)(`form`,{onSubmit:m,children:[(0,V.jsx)(`div`,{className:`publish-library-note`,children:(0,V.jsx)(AO,{i18nKey:`publishDialog.noteDescription`,link:e=>(0,V.jsx)(`a`,{href:`https://libraries.excalidraw.com`,target:`_blank`,rel:`noopener`,children:e})})}),(0,V.jsx)(`span`,{className:`publish-library-note`,children:(0,V.jsx)(AO,{i18nKey:`publishDialog.noteGuidelines`,link:e=>(0,V.jsx)(`a`,{href:`https://github.com/excalidraw/excalidraw-libraries#guidelines`,target:`_blank`,rel:`noopener noreferrer`,children:e})})}),(0,V.jsx)(`div`,{className:`publish-library-note`,children:G(`publishDialog.noteItems`)}),v&&(0,V.jsx)(`span`,{className:`publish-library-note publish-library-warning`,children:G(`publishDialog.republishWarning`)}),h(),(0,V.jsxs)(`div`,{className:`publish-library__fields`,children:[(0,V.jsxs)(`label`,{children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{children:G(`publishDialog.libraryName`)}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,V.jsx)(`input`,{type:`text`,name:`name`,required:!0,value:s.name,onChange:p,placeholder:G(`publishDialog.placeholder.libraryName`)})]}),(0,V.jsxs)(`label`,{style:{alignItems:`flex-start`},children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{children:G(`publishDialog.libraryDesc`)}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,V.jsx)(`textarea`,{name:`description`,rows:4,required:!0,value:s.description,onChange:p,placeholder:G(`publishDialog.placeholder.libraryDesc`)})]}),(0,V.jsxs)(`label`,{children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{children:G(`publishDialog.authorName`)}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,V.jsx)(`input`,{type:`text`,name:`authorName`,required:!0,value:s.authorName,onChange:p,placeholder:G(`publishDialog.placeholder.authorName`)})]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`span`,{children:G(`publishDialog.githubUsername`)}),(0,V.jsx)(`input`,{type:`text`,name:`githubHandle`,value:s.githubHandle,onChange:p,placeholder:G(`publishDialog.placeholder.githubHandle`)})]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`span`,{children:G(`publishDialog.twitterUsername`)}),(0,V.jsx)(`input`,{type:`text`,name:`twitterHandle`,value:s.twitterHandle,onChange:p,placeholder:G(`publishDialog.placeholder.twitterHandle`)})]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`span`,{children:G(`publishDialog.website`)}),(0,V.jsx)(`input`,{type:`text`,name:`website`,pattern:`https?://.+`,title:G(`publishDialog.errors.website`),value:s.website,onChange:p,placeholder:G(`publishDialog.placeholder.website`)})]}),(0,V.jsx)(`span`,{className:`publish-library-note`,children:(0,V.jsx)(AO,{i18nKey:`publishDialog.noteLicense`,link:e=>(0,V.jsx)(`a`,{href:`https://github.com/excalidraw/excalidraw-libraries/blob/main/LICENSE`,target:`_blank`,rel:`noopener noreferrer`,children:e})})})]}),(0,V.jsxs)(`div`,{className:`publish-library__buttons`,children:[(0,V.jsx)(SO,{label:G(`buttons.saveLibNames`),onClick:g,"data-testid":`cancel-clear-canvas-button`}),(0,V.jsx)(SO,{type:`submit`,label:G(`buttons.submit`),actionType:`primary`,isLoading:l})]})]}):(0,V.jsx)(`p`,{style:{padding:`1em`,textAlign:`center`,fontWeight:500},children:G(`publishDialog.atleastOneLibItem`)})})},PO={Row:(0,B.forwardRef)(({children:e,gap:t,align:n,justifyContent:r,className:i,style:a},o)=>(0,V.jsx)(`div`,{className:H(`Stack Stack_horizontal`,i),style:{"--gap":t,alignItems:n,justifyContent:r,...a},ref:o,children:e})),Col:(0,B.forwardRef)(({children:e,gap:t,align:n,justifyContent:r,className:i,style:a},o)=>(0,V.jsx)(`div`,{className:H(`Stack Stack_vertical`,i),style:{"--gap":t,justifyItems:n,justifyContent:r,...a},ref:o,children:e}))},FO=({children:e,onClickOutside:t,className:n=``,onSelect:r,open:i=!0,align:a=`end`,style:o})=>{let s=Qz(),c=(0,B.useRef)(null),l=dC({onClickOutside:t});uC(c,(0,B.useCallback)(e=>{c.current?.closest(`.${sa.DROPDOWN_MENU_EVENT_WRAPPER}`)?.contains(e.target)||l.onClickOutside?.()},[l])),(0,B.useEffect)(()=>{if(!i)return;let e=e=>{e.key===M.ESCAPE&&(e.stopImmediatePropagation(),l.onClickOutside?.())},t={capture:!0};return document.addEventListener(L.KEYDOWN,e,t),()=>{document.removeEventListener(L.KEYDOWN,e,t)}},[l,i]);let u=H(`dropdown-menu ${n}`,{"dropdown-menu--mobile":s.formFactor===`phone`}).trim();return(0,V.jsx)(GC.Provider,{value:{onSelect:r},children:(0,V.jsx)(__,{ref:c,className:u,style:o,"data-testid":`dropdown-menu`,align:a,sideOffset:8,onCloseAutoFocus:e=>e.preventDefault(),children:s.formFactor===`phone`?(0,V.jsx)(PO.Col,{className:`dropdown-menu-container`,children:e}):(0,V.jsx)(mC,{className:`dropdown-menu-container`,padding:2,children:e})})})};FO.displayName=`DropdownMenuContent`;var IO=FO,LO=({children:e,className:t=``,selected:n,...r})=>(0,V.jsx)(`div`,{...r,className:`dropdown-menu-item-base dropdown-menu-item-custom ${t} ${n?`dropdown-menu-item--selected`:``}`.trim(),children:e}),RO=({icon:e,shortcut:t,href:n,children:r,onSelect:i,className:a=``,selected:o,rel:s=`noopener`,...c})=>{let l=qC(i);return(0,V.jsx)(v_,{className:`radix-menu-item`,onSelect:l,asChild:!0,children:(0,V.jsx)(`a`,{...c,href:n,target:`_blank`,rel:`noopener ${s}`,className:KC(a,o),title:c.title??c[`aria-label`],children:(0,V.jsx)(YC,{icon:e,shortcut:t,children:r})})})},zO=RO;RO.displayName=`DropdownMenuItemLink`;var BO=()=>(0,V.jsx)(`div`,{style:{height:`1px`,backgroundColor:`var(--default-border-color)`,margin:`6px 0`,flex:`0 0 auto`}}),VO=BO;BO.displayName=`DropdownMenuSeparator`;var HO=-4,UO=4,WO=({children:e,className:t})=>{let n=Qz(),r=H(`dropdown-menu dropdown-submenu ${t}`,{"dropdown-menu--mobile":n.formFactor===`phone`}).trim(),i=(0,B.useCallback)(e=>{if(e){let t=e.closest(`.dropdown-menu-container`)?.getBoundingClientRect();if(t){let n=e.getBoundingClientRect().width,r=window.innerWidth-t.right;r<n+20&&(o(r-n+HO),c(HO+8))}}},[]),[a,o]=(0,B.useState)(UO),[s,c]=(0,B.useState)(HO);return(0,V.jsx)(x_,{className:r,sideOffset:a,alignOffset:s,collisionPadding:8,ref:i,children:n.formFactor===`phone`?(0,V.jsx)(PO.Col,{className:`dropdown-menu-container`,children:e}):(0,V.jsx)(mC,{className:`dropdown-menu-container`,padding:2,style:{zIndex:1},children:e})})},GO=WO;WO.displayName=`DropdownMenuSubContent`;var KO=({children:e,icon:t,shortcut:n,className:r})=>(0,V.jsxs)(b_,{className:`${KC(r)} dropdown-menu__submenu-trigger`,children:[(0,V.jsx)(YC,{icon:t,shortcut:n,children:e}),(0,V.jsx)(`div`,{className:`dropdown-menu__submenu-trigger-icon`,children:US})]}),qO=KO;KO.displayName=`DropdownMenuSubTrigger`;var JO=e=>t=>B.Children.toArray(t).find(t=>B.isValidElement(t)&&typeof t.type!=`string`&&t?.type.displayName&&t.type.displayName===e)||null,YO=JO(`DropdownMenuTrigger`),XO=JO(`DropdownMenuContent`),ZO=JO(`DropdownMenuSubTrigger`),QO=JO(`DropdownMenuSubContent`),$O=({children:e})=>{let t=ZO(e),n=QO(e);return(0,V.jsxs)(y_,{children:[t,n]})};$O.Trigger=qO,$O.Content=GO,$O.displayName=`DropdownMenuSub`;var ek=$O,tk=({className:e=``,children:t,onToggle:n,title:r,...i})=>{let a=Qz(),o=H(`dropdown-menu-button ${e}`,`zen-mode-transition`,{"dropdown-menu-button--mobile":a.formFactor===`phone`}).trim();return(0,V.jsx)(g_,{className:o,onClick:n,type:`button`,"data-testid":`dropdown-menu-button`,title:r,...i,children:t})},nk=tk;tk.displayName=`DropdownMenuTrigger`;var rk=e=>(0,V.jsx)($C,{...e,icon:e.checked?gb:HS}),ik=({children:e,open:t})=>{let n=YO(e),r=XO(e),i=r&&B.isValidElement(r)?B.cloneElement(r,{open:t}):r;return(0,V.jsx)(h_,{open:t,modal:!1,children:(0,V.jsxs)(`div`,{className:sa.DROPDOWN_MENU_EVENT_WRAPPER,style:{display:`contents`},children:[n,i]})})};ik.Trigger=nk,ik.Content=IO,ik.Item=$C,ik.ItemCheckbox=rk,ik.ItemLink=zO,ik.ItemCustom=LO,ik.Group=WC,ik.Separator=VO,ik.Sub=ek;var Q=ik;ik.displayName=`DropdownMenu`;var ak=(e,t)=>e.filter(e=>t.includes(e.id)),ok=({setAppState:e,selectedItems:t,library:n,onRemoveFromLibrary:r,resetLibrary:i,onSelectItems:a,appState:o,className:s})=>{let[c]=W(lO),[l,u]=W(yk),d=()=>{let e=t.length?G(`alerts.removeItemsFromsLibrary`,{count:t.length}):G(`alerts.resetLibrary`);return(0,V.jsx)(CO,{onConfirm:()=>{t.length?r():i(),p(!1)},onCancel:()=>{p(!1)},title:t.length?G(`confirmDialog.removeItemsFromLib`):G(`confirmDialog.resetLibrary`),children:(0,V.jsx)(`p`,{children:e})})},[f,p]=(0,B.useState)(!1),m=!!t.length,h=m?c.libraryItems.filter(e=>t.includes(e.id)):c.libraryItems,g=G(m?`buttons.remove`:`buttons.resetLibrary`),[_,v]=(0,B.useState)(!1),[y,b]=(0,B.useState)(null),S=(0,B.useCallback)(()=>(0,V.jsxs)(Dk,{onCloseRequest:()=>b(null),title:G(`publishSuccessDialog.title`),className:`publish-library-success`,size:`small`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(AO,{i18nKey:`publishSuccessDialog.content`,authorName:y.authorName,link:e=>(0,V.jsx)(`a`,{href:y?.url,target:`_blank`,rel:`noopener noreferrer`,children:e})})}),(0,V.jsx)(Y,{type:`button`,title:G(`buttons.close`),"aria-label":G(`buttons.close`),label:G(`buttons.close`),onClick:()=>b(null),"data-testid":`publish-library-success-close`,className:`publish-library-success-close`})]}),[b,y]),C=(e,r)=>{v(!1),b({url:e.url,authorName:e.authorName});let i=r.slice();i.forEach(e=>{t.includes(e.id)&&(e.status=`published`)}),n.setLibrary(i)};return(0,V.jsxs)(`div`,{className:H(`library-menu-dropdown-container`,s),children:[(0,V.jsxs)(Q,{open:l,children:[(0,V.jsx)(Q.Trigger,{onToggle:()=>u(!l),children:jy}),(0,V.jsxs)(Q.Content,{onClickOutside:()=>u(!1),onSelect:()=>u(!1),className:`library-menu`,children:[!m&&(0,V.jsx)(Q.Item,{onSelect:async()=>{try{await n.updateLibrary({libraryItems:Oi({description:`Excalidraw library files`}),merge:!0,openLibraryMenu:!0})}catch(t){if(t?.name===`AbortError`){console.warn(t);return}e({errorMessage:G(`errors.importLibraryError`)})}},icon:bb,"data-testid":`lib-dropdown--load`,children:G(`buttons.load`)}),!!h.length&&(0,V.jsx)(Q.Item,{onSelect:async()=>{x(m?h:await n.getLatestLibrary()).catch(na).catch(t=>{e({errorMessage:t.message})})},icon:lb,"data-testid":`lib-dropdown--export`,children:G(`buttons.export`)}),m&&(0,V.jsx)(Q.Item,{icon:Hx,onSelect:()=>v(!0),"data-testid":`lib-dropdown--remove`,children:G(`buttons.publishLibrary`)}),!!h.length&&(0,V.jsx)(Q.Item,{onSelect:()=>p(!0),icon:rb,children:g})]})]}),t.length>0&&(0,V.jsx)(`div`,{className:`library-actions-counter`,children:t.length}),f&&d(),_&&(0,V.jsx)(NO,{onClose:()=>v(!1),libraryItems:ak(c.libraryItems,t),appState:o,onSuccess:e=>C(e,c.libraryItems),onError:e=>window.alert(e),updateItemsInStorage:()=>n.setLibrary(c.libraryItems),onRemove:e=>a(t.filter(t=>t!==e))}),y&&S()]})},sk=({selectedItems:e,onSelectItems:t,className:n})=>{let{library:r}=Xz(),{clearLibraryCache:i,deleteItemsFromLibraryCache:a}=sO(),o=cC(),s=rB(),[c]=W(lO),l=async n=>{let i=n.filter(t=>!e.includes(t.id));r.setLibrary(i).catch(()=>{s({errorMessage:G(`alerts.errorRemovingFromLibrary`)})}),a(e),t([])};return(0,V.jsx)(ok,{appState:o,setAppState:s,selectedItems:e,onSelectItems:t,library:r,onRemoveFromLibrary:()=>l(c.libraryItems),resetLibrary:()=>{r.resetLibrary(),i()},className:n})};function ck(){return[!1,(0,B.useCallback)(e=>e(),[])]}var lk=B.useTransition||ck,uk=(0,B.memo)(({id:e,elements:t,isPending:n,onClick:r,selected:i,onToggle:a,onDrag:o,svgCache:s})=>{let c=(0,B.useRef)(null),l=oO(e,t,s,c),[u,d]=(0,B.useState)(!1),f=Qz().formFactor===`phone`,p=n&&(0,V.jsx)(`div`,{className:`library-unit__adder`,children:Ay});return(0,V.jsxs)(`div`,{className:H(`library-unit`,{"library-unit__active":t,"library-unit--hover":t&&u,"library-unit--selected":i,"library-unit--skeleton":!l}),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[(0,V.jsx)(`div`,{className:H(`library-unit__dragger`,{"library-unit__pulse":!!n}),ref:c,draggable:!!t,onClick:t||n?t=>{e&&t.shiftKey?a(e,t):r(e)}:void 0,onDragStart:t=>{if(!e){t.preventDefault();return}d(!1),o(e,t)}}),p,e&&t&&(u||f||i)&&(0,V.jsx)(wT,{checked:i,onChange:(t,n)=>a(e,n),className:`library-unit__checkbox`})]})}),dk=()=>(0,V.jsx)(`div`,{className:`library-unit library-unit--skeleton`}),fk=({children:e})=>(0,V.jsx)(`div`,{className:`library-menu-items-container__grid`,children:e}),pk=(0,B.memo)(({items:e,onItemSelectToggle:t,onItemDrag:n,isItemSelected:r,onClick:i,svgCache:a,itemsRenderedPerBatch:o})=>{let[,s]=lk(),[c,l]=(0,B.useState)(0);return(0,B.useEffect)(()=>{c<e.length&&s(()=>{l(c+o)})},[c,e.length,s,o]),(0,V.jsx)(V.Fragment,{children:e.map((e,o)=>o<c?(0,V.jsx)(uk,{elements:e?.elements,isPending:!e?.id&&!!e?.elements,onClick:i,svgCache:a,id:e?.id,selected:r(e.id),onToggle:t,onDrag:n},e?.id??o):(0,V.jsx)(dk,{},o))})}),mk=({type:e=`button`,onSelect:t,selected:n,children:r,className:i=``,...a})=>(0,V.jsx)(`button`,{onClick:_(a.onClick,e=>{t()}),type:e,className:H(`excalidraw-button`,i,{selected:n}),...a,children:r}),hk=(0,B.forwardRef)(({onChange:e,label:t,fullWidth:n,placeholder:r,readonly:i,selectOnRender:a,onKeyDown:o,isRedacted:s=!1,icon:c,className:l,type:u,...d},f)=>{let p=(0,B.useRef)(null);(0,B.useImperativeHandle)(f,()=>p.current),(0,B.useLayoutEffect)(()=>{a&&(p.current?.focus(),p.current?.select())},[a]);let[m,h]=(0,B.useState)(!1);return(0,V.jsxs)(`div`,{className:H(`ExcTextField`,l,{"ExcTextField--fullWidth":n,"ExcTextField--hasIcon":!!c}),onClick:()=>{p.current?.focus()},children:[c,t&&(0,V.jsx)(`div`,{className:`ExcTextField__label`,children:t}),(0,V.jsxs)(`div`,{className:H(`ExcTextField__input`,{"ExcTextField__input--readonly":i}),children:[(0,V.jsx)(`input`,{className:H({"is-redacted":`value`in d&&d.value&&s&&!m}),readOnly:i,value:`value`in d?d.value:void 0,defaultValue:`defaultValue`in d?d.defaultValue:void 0,placeholder:r,ref:p,onChange:t=>e?.(t.target.value),onKeyDown:o,type:u}),s&&(0,V.jsx)(mk,{onSelect:()=>h(!m),style:{border:0,userSelect:`none`},children:m?sS:oS})]})]})}),gk=17,_k=64;function vk({isLoading:e,libraryItems:t,onAddToLibrary:n,onInsertLibraryItems:r,pendingElements:i,theme:a,id:o,libraryReturnUrl:s,onSelectItems:l,selectedItems:u}){let d=Qz(),f=(0,B.useRef)(null),p=xO(f);(0,B.useEffect)(()=>{p>0&&f.current?.scrollTo(0,p)},[]);let{svgCache:m}=sO(),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)(``),y=!t.length&&!i.length,b=!y&&!!_.trim(),x=(0,B.useMemo)(()=>{let e=eO(_.trim().toLowerCase());return e?t.filter(t=>{let n=t.name||``;return n.trim()&&eO(n.toLowerCase()).includes(e)}):[]},[t,_]),S=(0,B.useMemo)(()=>t.filter(e=>e.status!==`published`),[t]),C=(0,B.useMemo)(()=>t.filter(e=>e.status===`published`),[t]),T=(0,B.useCallback)((e,t)=>{let n=!u.includes(e),r=[...S,...C];if(n){if(t.shiftKey&&h){let t=r.findIndex(e=>e.id===h),n=r.findIndex(t=>t.id===e);if(t===-1||n===-1){l([...u,e]);return}let i=Pa(u),a=Math.min(t,n),o=Math.max(t,n);l(r.reduce((e,t,n)=>((n>=a&&n<=o||i.has(t.id))&&e.push(t.id),e),[]))}else l([...u,e]);g(e)}else g(null),l(u.filter(t=>t!==e))},[h,l,C,u,S]);(0,B.useEffect)(()=>{u.length||g(null)},[u]);let E=(0,B.useCallback)(e=>{let n;return n=u.includes(e)?t.filter(e=>u.includes(e.id)):t.filter(t=>t.id===e),n.map(e=>({...e,elements:w({type:`everything`,elements:e.elements,randomizeSeed:!0,preserveFrameChildrenOrder:!0}).duplicatedElements}))},[t,u]),D=(0,B.useCallback)((e,t)=>{let n={itemIds:u.includes(e)?u:[e]};t.dataTransfer.setData(Se.excalidrawlibIds,JSON.stringify(n))},[u]),O=(0,B.useCallback)(e=>e?u.includes(e):!1,[u]),ee=(0,B.useCallback)(()=>{n(i)},[i,n]),k=(0,B.useCallback)(e=>{e&&r(E(e))},[E,r]),A=m.size>=(x.length?x:t).length?_k:gk,te=(0,B.useRef)(null);(0,B.useEffect)(()=>{c(()=>{te.current?.focus()})},[]);let ne=!b&&(0,V.jsxs)(V.Fragment,{children:[!y&&(0,V.jsx)(`div`,{className:`library-menu-items-container__header`,children:G(`labels.personalLib`)}),!i.length&&!S.length?(0,V.jsxs)(`div`,{className:`library-menu-items__no-items`,children:[!C.length&&(0,V.jsx)(`div`,{className:`library-menu-items__no-items__label`,children:G(`library.noItems`)}),(0,V.jsx)(`div`,{className:`library-menu-items__no-items__hint`,children:C.length>0?G(`library.hint_emptyPrivateLibrary`):G(`library.hint_emptyLibrary`)})]}):(0,V.jsxs)(fk,{children:[i.length>0&&(0,V.jsx)(pk,{itemsRenderedPerBatch:A,items:[{id:null,elements:i}],onItemSelectToggle:T,onItemDrag:D,onClick:ee,isItemSelected:O,svgCache:m}),(0,V.jsx)(pk,{itemsRenderedPerBatch:A,items:S,onItemSelectToggle:T,onItemDrag:D,onClick:k,isItemSelected:O,svgCache:m})]}),C.length>0&&(0,V.jsx)(`div`,{className:`library-menu-items-container__header`,style:{marginTop:`0.75rem`},children:G(`labels.excalidrawLib`)}),C.length>0&&(0,V.jsx)(fk,{children:(0,V.jsx)(pk,{itemsRenderedPerBatch:A,items:C,onItemSelectToggle:T,onItemDrag:D,onClick:k,isItemSelected:O,svgCache:m})})]}),re=b&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`library-menu-items-container__header`,children:[G(`library.search.heading`),!e&&(0,V.jsxs)(`div`,{className:`library-menu-items-container__header__hint`,style:{cursor:`pointer`},onPointerDown:e=>e.preventDefault(),onClick:e=>{v(``)},children:[(0,V.jsx)(`kbd`,{children:`esc`}),` to clear`]})]}),x.length>0?(0,V.jsx)(fk,{children:(0,V.jsx)(pk,{itemsRenderedPerBatch:A,items:x,onItemSelectToggle:T,onItemDrag:D,onClick:k,isItemSelected:O,svgCache:m})}):(0,V.jsxs)(`div`,{className:`library-menu-items__no-items`,children:[(0,V.jsx)(`div`,{className:`library-menu-items__no-items__hint`,children:G(`library.search.noResults`)}),(0,V.jsx)(mk,{onPointerDown:e=>e.preventDefault(),onSelect:()=>{v(``)},style:{width:`auto`,marginTop:`1rem`},children:G(`library.search.clearSearch`)})]})]});return(0,V.jsxs)(`div`,{className:`library-menu-items-container`,style:i.length||S.length||C.length?{justifyContent:`flex-start`}:{borderBottom:0},children:[(0,V.jsxs)(`div`,{className:`library-menu-items-header`,children:[!y&&(0,V.jsx)(hk,{ref:te,type:`search`,className:H(`library-menu-items-container__search`,{hideCancelButton:d.formFactor!==`phone`}),placeholder:G(`library.search.inputPlaceholder`),value:_,onChange:e=>v(e)}),(0,V.jsx)(sk,{selectedItems:u,onSelectItems:l,className:`library-menu-dropdown-container--in-heading`})]}),(0,V.jsxs)(PO.Col,{className:`library-menu-items-container__items`,align:`start`,gap:1,style:{flex:C.length>0?1:`0 1 auto`,margin:y?`auto`:0},ref:f,children:[e&&(0,V.jsx)(`div`,{style:{position:`absolute`,top:`var(--container-padding-y)`,right:`var(--container-padding-x)`,transform:`translateY(50%)`},children:(0,V.jsx)(GS,{})}),ne,re,y&&(0,V.jsx)(yO,{style:{padding:`16px 0`,width:`100%`},id:o,libraryReturnUrl:s,theme:a})]})]})}var yk=Ec(!1),bk=({children:e})=>(0,V.jsx)(`div`,{className:`layer-ui__library`,children:e}),xk=(0,B.memo)(({onInsertLibraryItems:e,pendingElements:t,onAddToLibrary:n,setAppState:r,libraryReturnUrl:i,library:a,id:o,theme:s,selectedItems:c,onSelectItems:l})=>{let[u]=W(lO),d=(0,B.useCallback)(e=>{(async(e,t)=>{rC(`element`,`addToLibrary`,`ui`);for(let t of $s)if(e.some(e=>e.type===t))return r({errorMessage:G(`errors.libraryElementTypeError.${t}`)});let i=[{status:`unpublished`,elements:e,id:Cs(),created:Date.now()},...t];n(),a.setLibrary(i).catch(()=>{r({errorMessage:G(`alerts.errorAddingToLibrary`)})})})(e,u.libraryItems)},[n,a,r,u.libraryItems]),f=(0,B.useMemo)(()=>u.libraryItems,[u]);if(u.status===`loading`&&!u.isInitialized)return(0,V.jsx)(bk,{children:(0,V.jsx)(`div`,{className:`layer-ui__library-message`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(GS,{size:`2em`}),(0,V.jsx)(`span`,{children:G(`labels.libraryLoadingMessage`)})]})})});let p=u.libraryItems.length>0||t.length>0;return(0,V.jsxs)(bk,{children:[(0,V.jsx)(vk,{isLoading:u.status===`loading`,libraryItems:f,onAddToLibrary:d,onInsertLibraryItems:e,pendingElements:t,id:o,libraryReturnUrl:i,theme:s,onSelectItems:l,selectedItems:c}),p&&(0,V.jsx)(yO,{className:`library-menu-control-buttons--at-bottom`,style:{padding:`16px 12px 0 12px`},id:o,libraryReturnUrl:i,theme:s})]})}),Sk=(e,t)=>({elements:e,pending:An(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}),selectedElementIds:t}),Ck=(e,t)=>{let n=tB(),[r,i]=(0,B.useState)(()=>Sk(n,e.selectedElementIds)),a=(0,B.useRef)(new Map);return(0,B.useEffect)(()=>{for(let e of r.pending)a.current.set(e.id,e.version)},[r.pending]),(0,B.useEffect)(()=>{t.state.cursorButton===`up`&&t.state.activeTool.type===`selection`&&i(r=>{if(!Jr(r.selectedElementIds,e.selectedElementIds))return a.current.clear(),Sk(n,e.selectedElementIds);let i=t.scene.getNonDeletedElementsMap();for(let t of Object.keys(e.selectedElementIds)){let r=i.get(t)?.version;if(r&&r!==a.current.get(t))return Sk(n,e.selectedElementIds)}return r})},[t,t.state.cursorButton,t.state.activeTool.type,e.selectedElementIds,n]),r.pending},wk=(0,B.memo)(()=>{let e=Xz(),{onInsertElements:t}=e,n=Zz(),r=cC(),i=rB(),[a,o]=(0,B.useState)([]),s=(0,B.useMemo)(()=>e.library,[e.library]),c=Ck(r,e);return(0,B.useEffect)(()=>Hi(document,L.KEYDOWN,t=>{if(t.key===M.ESCAPE&&t.target instanceof HTMLElement){let n=t.target;if(n.closest(`.${sa.SIDEBAR}`))a.length>0?(t.stopPropagation(),o([])):wi(n)&&n instanceof HTMLInputElement&&!n.value&&(t.stopPropagation(),i({openSidebar:null}),e.focusContainer());else if(a.length>0){let{x:n,y:r}=e.lastViewportPosition;document.elementFromPoint(n,r)?.closest(`.${sa.SIDEBAR}`)&&(t.stopPropagation(),o([]))}}},{capture:!0}),[a,i,e]),(0,V.jsx)(xk,{pendingElements:c,onInsertLibraryItems:(0,B.useCallback)(n=>{t(hO(n)),e.focusContainer()},[t,e]),onAddToLibrary:(0,B.useCallback)(()=>{i({selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null})},[i]),setAppState:i,libraryReturnUrl:n.libraryReturnUrl,library:s,id:e.id,theme:r.theme,selectedItems:a,onSelectItems:o})}),Tk=e=>{let{closeOnClickOutside:t=!0}=e,n=lC({className:`excalidraw-modal-container`}),r=(0,B.useRef)(document.body.classList.contains(`excalidraw-animations-disabled`));return n?(0,Sc.createPortal)((0,V.jsxs)(`div`,{className:H(`Modal`,e.className,{"animations-disabled":r.current}),role:`dialog`,"aria-modal":`true`,onKeyDown:t=>{t.key===M.ESCAPE&&(t.nativeEvent.stopImmediatePropagation(),t.stopPropagation(),e.onCloseRequest())},"aria-labelledby":e.labelledBy,children:[(0,V.jsx)(`div`,{className:`Modal__background`,onClick:t?e.onCloseRequest:void 0}),(0,V.jsx)(`div`,{className:`Modal__content`,style:{"--max-width":`${e.maxWidth}px`},tabIndex:0,children:e.children})]}),n):null};function Ek(e){if(e&&typeof e==`number`)return e;switch(e){case`small`:return 550;case`wide`:return 1024;default:return 800}}var Dk=e=>{let[t,n]=tO(),[r]=(0,B.useState)(document.activeElement),{id:i}=eB(),a=Qz().formFactor===`phone`;(0,B.useEffect)(()=>{if(!t)return;let n=_t(t);setTimeout(()=>{n.length>0&&e.autofocus!==!1&&(n[1]||n[0]).focus()});let r=e=>{if(e.key===M.TAB){let n=_t(t),{activeElement:r}=document,i=n.findIndex(e=>e===r);i===0&&e.shiftKey?(n[n.length-1].focus(),e.preventDefault()):i===n.length-1&&!e.shiftKey&&(n[0].focus(),e.preventDefault())}};return t.addEventListener(`keydown`,r),()=>t.removeEventListener(`keydown`,r)},[t,e.autofocus]);let o=rB(),s=ly(yk),c=()=>{o({openMenu:null}),s(!1),r.focus(),e.onCloseRequest()};return(0,V.jsx)(Tk,{className:H(`Dialog`,e.className,{"Dialog--fullscreen":a}),labelledBy:`dialog-title`,maxWidth:Ek(e.size),onCloseRequest:c,closeOnClickOutside:e.closeOnClickOutside,children:(0,V.jsxs)(mC,{ref:n,children:[e.title&&(0,V.jsx)(`h2`,{id:`${i}-dialog-title`,className:`Dialog__title`,children:(0,V.jsx)(`span`,{className:`Dialog__titleContent`,children:e.title})}),a&&(0,V.jsx)(`button`,{className:`Dialog__close`,onClick:c,title:G(`buttons.close`),"aria-label":G(`buttons.close`),type:`button`,children:Kb}),(0,V.jsx)(`div`,{className:`Dialog__content`,children:e.children})]})})},Ok=X({name:`viewMode`,label:`labels.viewMode`,icon:oS,viewMode:!0,trackEvent:{category:`canvas`,predicate:e=>!e.viewModeEnabled},perform(e,t){return{appState:{...t,viewModeEnabled:!this.checked(t)},captureUpdate:P.EVENTUALLY}},checked:e=>e.viewModeEnabled,predicate:(e,t,n)=>typeof n.viewModeEnabled>`u`,keyTest:e=>!e[M.CTRL_OR_CMD]&&e.altKey&&e.code===vr.R}),kk=(e,t)=>{let n=t[0]?.type||null;for(let e of t)if(e.type!==n){n=null;break}return Do(e.activeTool.type)&&n!==`image`&&n!==`frame`&&n!==`magicframe`||t.some(e=>Do(e.type))},Ak=(e,t)=>ms(e.activeTool.type)||t.some(e=>ms(e.type)),jk=(e,t,n,r)=>{let i=e.activeTool.type,a=e=>e(i)||t.some(t=>e(t.type)),o=t.length===1,s=t.length===2&&(ai(t[0])||ai(t[1])),c=!!(e.editingTextElement||e.newElement),l=t.length>0;return{hasSelection:l,showExtraActions:l&&!c,strokeColor:kk(e,t),backgroundColor:Ak(e,t),fill:ms(i)&&!bo(e.currentItemBackgroundColor)||t.some(e=>ms(e.type)&&!bo(e.backgroundColor)),strokeWidth:a(lc),freedrawMode:a(Ie),strokeStyle:a(Os),roundness:a(bs),arrowType:a(Wo),arrowheads:a(vs),text:i===`text`||t.some(R),textAlign:i===`text`||ne(t,n),verticalAlign:ho(t,n),align:!s&&EE(e,r),distribute:t.length>2,link:o||s,linkSingleOnly:o,cropEditor:!e.croppingElementId&&o&&Ce(t[0]),lineEditor:!e.selectedLinearElement?.isEditing&&o&&ja(t[0])&&!Ti(t[0])}},Mk=H([sa.SHAPE_ACTIONS_THEME_SCOPE,`properties-content`]),Nk=({renderAction:e})=>(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.layers`)}),(0,V.jsxs)(`div`,{className:`buttonList`,children:[e(`sendToBack`),e(`sendBackward`),e(`bringForward`),e(`bringToFront`)]})]}),Pk=({renderAction:e,showDistribute:t})=>{let n=document.documentElement.getAttribute(`dir`)===`rtl`;return(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.align`)}),(0,V.jsxs)(`div`,{className:`buttonList`,children:[n?(0,V.jsxs)(V.Fragment,{children:[e(`alignRight`),e(`alignHorizontallyCentered`),e(`alignLeft`)]}):(0,V.jsxs)(V.Fragment,{children:[e(`alignLeft`),e(`alignHorizontallyCentered`),e(`alignRight`)]}),t&&e(`distributeHorizontally`),(0,V.jsx)(`div`,{style:{flexBasis:`100%`,height:0}}),(0,V.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:`.5rem`,marginTop:`-0.5rem`},children:[e(`alignTop`),e(`alignVerticallyCentered`),e(`alignBottom`),t&&e(`distributeVertically`)]})]})]})},Fk=({appState:e,elementsMap:t,renderAction:n,app:r})=>{let i=jk(e,ca(t,e),t,r);return(0,V.jsxs)(`div`,{className:`selected-shape-actions`,children:[(0,V.jsx)(`div`,{children:i.strokeColor&&n(`changeStrokeColor`)}),i.backgroundColor&&(0,V.jsx)(`div`,{children:n(`changeBackgroundColor`)}),i.fill&&n(`changeFillStyle`),i.strokeWidth&&n(`changeStrokeWidth`),i.freedrawMode&&n(`changeFreedrawMode`),i.strokeStyle&&(0,V.jsxs)(V.Fragment,{children:[n(`changeStrokeStyle`),n(`changeSloppiness`)]}),i.roundness&&(0,V.jsx)(V.Fragment,{children:n(`changeRoundness`)}),i.arrowType&&(0,V.jsx)(V.Fragment,{children:n(`changeArrowType`)}),i.text&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`fieldset`,{children:n(`changeFontFamily`)}),n(`changeFontSize`),i.textAlign&&n(`changeTextAlign`)]}),i.verticalAlign&&n(`changeVerticalAlign`),i.arrowheads&&(0,V.jsx)(V.Fragment,{children:n(`changeArrowhead`)}),n(`changeOpacity`),(0,V.jsx)(Nk,{renderAction:n}),i.align&&(0,V.jsx)(Pk,{renderAction:n,showDistribute:i.distribute}),i.showExtraActions&&(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.actions`)}),(0,V.jsxs)(`div`,{className:`buttonList`,children:[n(`duplicateSelection`),n(`deleteSelectedElements`),n(`group`),n(`ungroup`),i.link&&n(`hyperlink`),i.cropEditor&&n(`cropEditor`),i.lineEditor&&n(`toggleLinearEditor`)]})]})]})},Ik=({appState:e,renderAction:t,setAppState:n,predicates:r,container:i})=>{let a=r.hasSelection||e.activeTool.type!==`selection`&&e.activeTool.type!==`eraser`&&e.activeTool.type!==`hand`&&e.activeTool.type!==`laser`&&e.activeTool.type!==`lasso`,o=e.openPopup===`compactStrokeStyles`;return a?(0,V.jsx)(`div`,{className:`compact-action-item`,children:(0,V.jsxs)(J_,{open:o,onOpenChange:e=>{n(e?{openPopup:`compactStrokeStyles`}:{openPopup:null})},children:[(0,V.jsx)(Y_,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:H(`compact-action-button properties-trigger`,{active:o}),title:G(`labels.stroke`),onClick:e=>{e.preventDefault(),e.stopPropagation(),n({openPopup:o?null:`compactStrokeStyles`})},children:RS})}),o&&(0,V.jsx)(hC,{className:Mk,container:i,style:{maxWidth:`13rem`},onClose:()=>{},children:(0,V.jsxs)(`div`,{className:`selected-shape-actions`,children:[r.fill&&t(`changeFillStyle`),r.strokeWidth&&t(`changeStrokeWidth`),r.freedrawMode&&t(`changeFreedrawMode`),r.strokeStyle&&(0,V.jsxs)(V.Fragment,{children:[t(`changeStrokeStyle`),t(`changeSloppiness`)]}),r.roundness&&t(`changeRoundness`),t(`changeOpacity`)]})})]})}):null},Lk=({appState:e,renderAction:t,setAppState:n,targetElements:r,predicates:i,container:a,app:o})=>{let s=e.openPopup===`compactArrowProperties`;return i.arrowType?(0,V.jsx)(`div`,{className:`compact-action-item`,children:(0,V.jsxs)(J_,{open:s,onOpenChange:e=>{n(e?{openPopup:`compactArrowProperties`}:{openPopup:null})},children:[(0,V.jsx)(Y_,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:H(`compact-action-button properties-trigger`,{active:s}),title:G(`labels.arrowtypes`),onClick:e=>{e.preventDefault(),e.stopPropagation(),n({openPopup:s?null:`compactArrowProperties`})},children:(()=>{let t=Sw(r,o,e=>Mr(e)?e.elbowed?`elbow`:e.roundness?`round`:`sharp`:null,e=>Mr(e),t=>t?null:e.currentItemArrowType);return t===`elbow`?jS:t===`round`?MS:AS})()})}),s&&(0,V.jsx)(hC,{container:a,className:`properties-content`,style:{maxWidth:`13rem`},onClose:()=>{},children:t(`changeArrowProperties`)})]})}):null},Rk=({appState:e,renderAction:t,setAppState:n,predicates:r,container:i})=>{let{saveCaretPosition:a,restoreCaretPosition:o}=bC(),s=e.openPopup===`compactTextProperties`;return(0,V.jsx)(`div`,{className:`compact-action-item`,children:(0,V.jsxs)(J_,{open:s,onOpenChange:t=>{t?(e.editingTextElement&&a(),n({openPopup:`compactTextProperties`})):(n({openPopup:null}),e.editingTextElement&&o())},children:[(0,V.jsx)(Y_,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:H(`compact-action-button properties-trigger`,{active:s}),title:G(`labels.textAlign`),onClick:t=>{t.preventDefault(),t.stopPropagation(),s?n({openPopup:null}):(e.editingTextElement&&a(),n({openPopup:`compactTextProperties`}))},children:Zy})}),e.openPopup===`compactTextProperties`&&(0,V.jsx)(hC,{className:Mk,container:i,style:{maxWidth:`13rem`},preventAutoFocusOnTouch:!!e.editingTextElement,onClose:()=>{e.editingTextElement&&o()},children:(0,V.jsxs)(`div`,{className:`selected-shape-actions`,children:[r.text&&t(`changeFontSize`),r.textAlign&&t(`changeTextAlign`),r.verticalAlign&&t(`changeVerticalAlign`)]})})]})})},zk=({appState:e,renderAction:t,predicates:n,setAppState:r,container:i,showDuplicate:a,showDelete:o})=>{let s=e.openPopup===`compactOtherProperties`;return n.showExtraActions?(0,V.jsx)(`div`,{className:`compact-action-item`,children:(0,V.jsxs)(J_,{open:s,onOpenChange:e=>{r(e?{openPopup:`compactOtherProperties`}:{openPopup:null})},children:[(0,V.jsx)(Y_,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:H(`compact-action-button properties-trigger`,{active:s}),title:G(`labels.actions`),onClick:e=>{e.preventDefault(),e.stopPropagation(),r({openPopup:s?null:`compactOtherProperties`})},children:My})}),s&&(0,V.jsx)(hC,{className:Mk,container:i,style:{maxWidth:`12rem`,justifyContent:`center`,alignItems:`center`},onClose:()=>{},children:(0,V.jsxs)(`div`,{className:`selected-shape-actions`,children:[(0,V.jsx)(Nk,{renderAction:t}),n.align&&(0,V.jsx)(Pk,{renderAction:t,showDistribute:n.distribute}),(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{children:G(`labels.actions`)}),(0,V.jsxs)(`div`,{className:`buttonList`,children:[t(`group`),t(`ungroup`),n.linkSingleOnly&&t(`hyperlink`),n.cropEditor&&t(`cropEditor`),a&&t(`duplicateSelection`),o&&t(`deleteSelectedElements`)]})]})]})})]})}):null},Bk=({renderAction:e,predicates:t})=>t.lineEditor?(0,V.jsx)(`div`,{className:`compact-action-item`,children:e(`toggleLinearEditor`)}):null,Vk=({appState:e,elementsMap:t,renderAction:n,app:r,setAppState:i})=>{let a=ca(t,e),o=jk(e,a,t,r),{container:s}=eB();return(0,V.jsxs)(`div`,{className:`compact-shape-actions`,children:[o.strokeColor&&(0,V.jsx)(`div`,{className:H(`compact-action-item`),children:n(`changeStrokeColor`)}),o.backgroundColor&&(0,V.jsx)(`div`,{className:`compact-action-item`,children:n(`changeBackgroundColor`)}),o.freedrawMode&&(0,V.jsx)(`div`,{className:`compact-action-item`,children:n(`changeFreedrawMode`,{cycle:!0})}),(0,V.jsx)(Ik,{appState:e,renderAction:n,setAppState:i,predicates:o,container:s}),(0,V.jsx)(Lk,{appState:e,renderAction:n,setAppState:i,targetElements:a,predicates:o,container:s,app:r}),o.lineEditor&&(0,V.jsx)(`div`,{className:`compact-action-item`,children:n(`toggleLinearEditor`)}),o.text&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`compact-action-item`,children:n(`changeFontFamily`)}),(0,V.jsx)(Rk,{appState:e,renderAction:n,setAppState:i,predicates:o,container:s})]}),o.showExtraActions&&(0,V.jsx)(`div`,{className:`compact-action-item`,children:n(`duplicateSelection`)}),o.showExtraActions&&(0,V.jsx)(`div`,{className:`compact-action-item`,children:n(`deleteSelectedElements`)}),(0,V.jsx)(zk,{appState:e,renderAction:n,predicates:o,setAppState:i,container:s})]})},Hk=({appState:e,elementsMap:t,renderAction:n,app:r,setAppState:i})=>{let a=ca(t,e),o=jk(e,a,t,r),{container:s}=eB(),c=(0,B.useRef)(null),l=c.current?.getBoundingClientRect()?.width??0,u=l>=374,d=l>=412;return(0,V.jsxs)(mC,{className:`compact-shape-actions mobile-shape-actions`,style:{flexDirection:`row`,boxShadow:`none`,padding:0,zIndex:2,backgroundColor:`transparent`,height:32*1.35,marginBottom:4,alignItems:`center`,gap:6,pointerEvents:`none`},ref:c,children:[(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,gap:6,flex:1},children:[o.strokeColor&&(0,V.jsx)(`div`,{className:H(`compact-action-item`),children:n(`changeStrokeColor`)}),o.backgroundColor&&(0,V.jsx)(`div`,{className:`compact-action-item`,children:n(`changeBackgroundColor`)}),(0,V.jsx)(Ik,{appState:e,renderAction:n,setAppState:i,predicates:o,container:s}),(0,V.jsx)(Lk,{appState:e,renderAction:n,setAppState:i,targetElements:a,predicates:o,container:s,app:r}),(0,V.jsx)(Bk,{renderAction:n,predicates:o}),o.text&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`compact-action-item`,children:n(`changeFontFamily`)}),(0,V.jsx)(Rk,{appState:e,renderAction:n,setAppState:i,predicates:o,container:s})]}),(0,V.jsx)(zk,{appState:e,renderAction:n,predicates:o,setAppState:i,container:s,showDuplicate:!d,showDelete:!u})]}),(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,gap:6},children:[(0,V.jsx)(`div`,{className:`compact-action-item`,children:n(`undo`)}),(0,V.jsx)(`div`,{className:`compact-action-item`,children:n(`redo`)}),d&&(0,V.jsx)(`div`,{className:`compact-action-item`,children:n(`duplicateSelection`)}),u&&(0,V.jsx)(`div`,{className:`compact-action-item`,children:n(`deleteSelectedElements`)})]})]})},Uk=({renderAction:e})=>(0,V.jsx)(PO.Col,{gap:1,className:sa.ZOOM_ACTIONS,children:(0,V.jsxs)(PO.Row,{align:`center`,children:[e(`zoomOut`),e(`resetZoom`),e(`zoomIn`)]})}),Wk=({renderAction:e,className:t})=>(0,V.jsxs)(`div`,{className:`undo-redo-buttons ${t}`,children:[(0,V.jsx)(`div`,{className:`undo-button-container`,children:(0,V.jsx)(Nw,{label:G(`buttons.undo`),children:e(`undo`)})}),(0,V.jsx)(`div`,{className:`redo-button-container`,children:(0,V.jsxs)(Nw,{label:G(`buttons.redo`),children:[` `,e(`redo`)]})})]}),Gk=({actionManager:e,showExitZenModeBtn:t})=>(0,V.jsx)(`button`,{type:`button`,className:H(`disable-zen-mode`,{"disable-zen-mode--visible":t}),onClick:()=>e.executeAction(VE),children:G(`buttons.exitZenMode`)}),Kk=({actionManager:e})=>(0,V.jsx)(`button`,{type:`button`,className:`disable-view-mode`,onClick:()=>e.executeAction(Ok),children:BS}),qk=e=>{let t=(0,B.useRef)({userFn:e});return t.current.userFn=e,t.current.stableFn||(t.current.stableFn=(...e)=>t.current.userFn(...e)),t.current.stableFn},Jk=Ec(null),Yk=()=>{let[e,t]=W(Jk),n=iB();return e&&e===`clearCanvas`?(0,V.jsx)(CO,{onConfirm:()=>{n.executeAction(Rw),t(null)},onCancel:()=>t(null),title:G(`clearCanvasDialog.title`),children:(0,V.jsxs)(`p`,{className:`clear-canvas__content`,children:[` `,G(`alerts.clearReset`)]})}):null},Xk={},Zk=Ec(null),Qk={app:`App`,export:`Export`,tools:`Tools`,editor:`Editor`,elements:`Elements`,links:`Links`,library:`Library`},$k=e=>{switch(e){case Qk.app:return 1;case Qk.export:return 2;case Qk.editor:return 3;case Qk.tools:return 4;case Qk.elements:return 5;case Qk.links:return 6;default:return 10}},eA=({shortcut:e,className:t,children:n})=>{let r=e.replace(`++`,`+$`).split(`+`);return(0,V.jsxs)(`div`,{className:H(`shortcut`,t),children:[r.map((e,t)=>(0,V.jsx)(`div`,{className:`shortcut-wrapper`,children:(0,V.jsx)(`div`,{className:`shortcut-key`,children:e===`$`?`+`:e})},e)),(0,V.jsx)(`div`,{className:`shortcut-desc`,children:n})]})},tA=e=>!e.altKey&&e[M.CTRL_OR_CMD]&&(e.shiftKey&&e.key.toLowerCase()===M.P||e.key===M.SLASH);Object.assign(e=>{let t=cC(),n=rB();return(0,B.useEffect)(()=>{let e=e=>{tA(e)&&(e.preventDefault(),e.stopPropagation(),n(e=>{let t=e.openDialog?.name===`commandPalette`?null:{name:`commandPalette`};return t&&rC(`command_palette`,`open`,`shortcut`),{openDialog:t}}))};return window.addEventListener(L.KEYDOWN,e,{capture:!0}),()=>window.removeEventListener(L.KEYDOWN,e,{capture:!0})},[n]),t.openDialog?.name===`commandPalette`?(0,V.jsx)(nA,{...e}):null},{defaultItems:Xk});function nA({customCommandPaletteItems:e}){let t=Xz(),n=cC(),r=rB(),i=Zz(),a=iB(),[o,s]=W(Zk),[c,l]=(0,B.useState)(null),u=(0,B.useRef)(null),d=dC({uiAppState:n,customCommandPaletteItems:e,appProps:i}),[f]=W(lO),p=(0,B.useMemo)(()=>f.libraryItems?.filter(e=>!!e.name).map(e=>({label:e.name,icon:(0,V.jsx)(rA,{id:e.id,elements:e.elements}),category:`Library`,order:$k(`Library`),haystack:eO(e.name),perform:()=>{t.onInsertElements(hO([e]))}}))||[],[t,f.libraryItems]);(0,B.useEffect)(()=>{let{uiAppState:e,customCommandPaletteItems:n,appProps:i}=d,c=n=>{let r=``;return n.label&&(r=typeof n.label==`function`?G(n.label(t.scene.getNonDeletedElements(),e,t)):G(n.label)),r},u=n=>typeof n.icon==`function`?n.icon(e,t.scene.getNonDeletedElements()):n.icon,f=[],m=(e,t,n)=>{let r={label:c(e),icon:u(e),category:t,shortcut:XD(e.name),keywords:e.keywords,predicate:e.predicate,viewMode:e.viewMode,perform:()=>{a.executeAction(e,`commandPalette`)}};return n?n(r,e):r};if(e&&t.scene&&a){let d=[a.actions.group,a.actions.ungroup,a.actions.cut,a.actions.copy,a.actions.deleteSelectedElements,a.actions.wrapSelectionInFrame,a.actions.copyStyles,a.actions.pasteStyles,a.actions.bringToFront,a.actions.bringForward,a.actions.sendBackward,a.actions.sendToBack,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,a.actions.cropEditor,a.actions.togglePolygon,fD,qD,JD].map(e=>m(e,Qk.elements,(e,t)=>({...e,predicate:t.predicate?t.predicate:(e,t,n,r)=>An(e,t).length>0}))),h=[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(e=>m(e,Qk.editor)),g=[a.actions.saveToActiveFile,a.actions.saveFileToDisk,a.actions.copyAsPng,a.actions.copyAsSvg].map(e=>m(e,Qk.export));f=[...d,...h,{label:c(Rw),icon:u(Rw),shortcut:XD(Rw.name),category:Qk.editor,keywords:[`delete`,`destroy`],viewMode:!1,perform:()=>{py.set(Jk,`clearCanvas`)}},{label:G(`buttons.exportImage`),category:Qk.export,icon:Cb,shortcut:XD(`imageExport`),keywords:[`export`,`image`,`png`,`jpeg`,`svg`,`clipboard`,`picture`],perform:()=>{r({openDialog:{name:`imageExport`}})}},...g];let _=[m(Hw,Qk.app),{label:G(`toolBar.library`),category:Qk.app,icon:ky,viewMode:!1,perform:()=>{e.openSidebar?r({openSidebar:null}):r({openSidebar:{name:oe.name,tab:oe.defaultTab}})}},{label:G(`search.title`),category:Qk.app,icon:uS,viewMode:!0,perform:()=>{a.executeAction(kj)}},{label:G(`labels.shapeSwitch`),category:Qk.elements,icon:hS,perform:()=>{a.executeAction(KD)}},{label:G(`labels.changeStroke`),keywords:[`color`,`outline`],category:Qk.elements,icon:xb,viewMode:!1,predicate:(e,t)=>{let n=An(e,t);return n.length>0&&kk(t,n)},perform:()=>{r(e=>({openPopup:`elementStroke`}))}},{label:G(`labels.changeBackground`),keywords:[`color`,`fill`],icon:xb,category:Qk.elements,viewMode:!1,predicate:(e,t)=>{let n=An(e,t);return n.length>0&&Ak(t,n)},perform:()=>{r(e=>({openPopup:`elementBackground`}))}},{label:G(`labels.canvasBackground`),keywords:[`color`],icon:xb,category:Qk.editor,viewMode:!1,perform:()=>{r(e=>({openMenu:e.openMenu===`canvas`?null:`canvas`,openPopup:`canvasBackground`}))}},...Object.keys(tT).reduce((e,n)=>{let r=tT[n];if(i.UIOptions.tools?.[n]===!1)return e;let a=rT(n)||r.numericKey,o={label:G(`toolBar.${n}`),category:Qk.tools,shortcut:a,icon:r.icon,keywords:[`toolbar`],viewMode:!1,perform:()=>{t.setActiveTool({type:n},{toggle:!1})}};return e.push(o),e},[]),{label:G(`toolBar.lock`),category:Qk.tools,icon:e.activeTool.locked?Iy:Fy,shortcut:M.Q.toLocaleUpperCase(),viewMode:!1,perform:()=>{t.toggleLock()}},{label:`${G(`labels.textToDiagram`)}...`,category:Qk.tools,icon:lS,viewMode:!1,predicate:i.aiEnabled,perform:()=>{r(e=>({...e,openDialog:{name:`ttd`,tab:`text-to-diagram`}}))}},{label:`${G(`toolBar.mermaidToExcalidraw`)}...`,category:Qk.tools,icon:$x,viewMode:!1,predicate:i.aiEnabled,perform:()=>{r(e=>({...e,openDialog:{name:`ttd`,tab:`mermaid`}}))}}],v=[...f,..._,...n||[]].map(e=>({...e,icon:e.icon||hS,order:e.order??$k(e.category),haystack:`${eO(e.label.toLocaleLowerCase())} ${e.keywords?.join(` `)||``}`}));l(v),s([...v,...p].find(e=>e.label===o?.label)??null)}},[d,t,a,l,o?.label,s,r,p]);let[m,h]=(0,B.useState)(``),[g,_]=(0,B.useState)(null),[v,y]=(0,B.useState)({}),b=e=>{r({openDialog:null},e),h(``)},x=(e,t)=>{n.openDialog?.name===`commandPalette`&&(t.stopPropagation(),t.preventDefault(),document.body.classList.add(`excalidraw-animations-disabled`),b(()=>{e.perform({actionManager:a,event:t}),s(e),requestAnimationFrame(()=>{document.body.classList.remove(`excalidraw-animations-disabled`)})}))},S=qk(e=>e.viewMode===!1&&n.viewModeEnabled?!1:typeof e.predicate==`function`?e.predicate(t.scene.getNonDeletedElements(),n,i,t):e.predicate===void 0||e.predicate),C=qk(e=>{let t=wi(e.target)||tA(e)||e.key===M.ESCAPE;if(t&&e.key!==M.ARROW_UP&&e.key!==M.ARROW_DOWN&&e.key!==M.ENTER)return;let n=Object.values(v).flat(),r=o&&!m&&S(o);if(e.key===M.ARROW_UP){e.preventDefault();let t=n.findIndex(e=>e.label===g?.label);if(r){if(t===0){_(o);return}if(g===o){let e=n[n.length-1];e&&_(e);return}}let i;i=t===-1||t===0?n.length-1:(t-1)%n.length;let a=n[i];a&&_(a);return}if(e.key===M.ARROW_DOWN){e.preventDefault();let t=n.findIndex(e=>e.label===g?.label);if(r){if(!g||t===n.length-1){_(o);return}if(g===o){let e=n[0];e&&_(e);return}}let i=n[(t+1)%n.length];i&&_(i);return}if(e.key===M.ENTER&&g&&setTimeout(()=>{x(g,e)}),!t){if(e.stopPropagation(),/^[a-zA-Z0-9]$/.test(e.key)){u?.current?.focus();return}e.preventDefault()}});return(0,B.useEffect)(()=>(window.addEventListener(L.KEYDOWN,C,{capture:!0}),()=>window.removeEventListener(L.KEYDOWN,C,{capture:!0})),[C]),(0,B.useEffect)(()=>{if(!c)return;let e=e=>{let t={};for(let n of e)t[n.category]?t[n.category].push(n):t[n.category]=[n];return t},t=m?.length>1?[...c.filter(S).sort((e,t)=>e.order-t.order),...p]:c.filter(S).sort((e,t)=>e.order-t.order),n=!m&&o&&S(o);if(!m){y(e(n?t.filter(e=>e.label!==o?.label):t)),_(n?o:t[0]||null);return}let r=eO(m.toLocaleLowerCase().replace(/[<>_| -]/g,``));t=vv.default.filter(r,t,{extract:e=>e.haystack??``}).sort((e,t)=>t.score-e.score).map(e=>e.original),y(e(t)),_(t[0]??null)},[m,c,S,o,p]),(0,V.jsxs)(Dk,{onCloseRequest:()=>b(),closeOnClickOutside:!0,title:!1,size:720,autofocus:!0,className:`command-palette-dialog`,children:[(0,V.jsx)(hk,{value:m,placeholder:G(`commandPalette.search.placeholder`),onChange:e=>{h(e)},selectOnRender:!0,ref:u}),t.editorInterface.formFactor!==`phone`&&(0,V.jsxs)(`div`,{className:`shortcuts-wrapper`,children:[(0,V.jsx)(eA,{shortcut:`↑↓`,children:G(`commandPalette.shortcuts.select`)}),(0,V.jsx)(eA,{shortcut:`↵`,children:G(`commandPalette.shortcuts.confirm`)}),(0,V.jsx)(eA,{shortcut:Z(`Esc`),children:G(`commandPalette.shortcuts.close`)})]}),(0,V.jsxs)(`div`,{className:`commands`,children:[o&&!m&&(0,V.jsxs)(`div`,{className:`command-category`,children:[(0,V.jsxs)(`div`,{className:`command-category-title`,children:[G(`commandPalette.recents`),(0,V.jsx)(`div`,{className:`icon`,style:{marginLeft:`6px`},children:dS})]}),(0,V.jsx)(iA,{command:o,isSelected:o.label===g?.label,onClick:e=>x(o,e),disabled:!S(o),onMouseMove:()=>_(o),showShortcut:t.editorInterface.formFactor!==`phone`,appState:n})]}),Object.keys(v).length>0?Object.keys(v).map((e,r)=>(0,V.jsxs)(`div`,{className:`command-category`,children:[(0,V.jsx)(`div`,{className:`command-category-title`,children:e}),v[e].map(r=>(0,V.jsx)(iA,{command:r,isSelected:r.label===g?.label,onClick:e=>x(r,e),onMouseMove:()=>_(r),showShortcut:t.editorInterface.formFactor!==`phone`,appState:n,size:e===`Library`?`large`:`small`},r.label))]},e)):c?(0,V.jsxs)(`div`,{className:`no-match`,children:[(0,V.jsx)(`div`,{className:`icon`,children:uS}),` `,G(`commandPalette.search.noMatch`)]}):null]})]})}var rA=({id:e,elements:t})=>{let n=(0,B.useRef)(null),{svgCache:r}=sO();return oO(e,t,r,n),(0,V.jsx)(`div`,{className:`library-item-icon`,ref:n})},iA=({command:e,isSelected:t,disabled:n,onMouseMove:r,onClick:i,showShortcut:a,appState:o,size:s=`small`})=>{let c=()=>{};return(0,V.jsxs)(`div`,{className:H(`command-item`,{"item-selected":t,"item-disabled":n,"command-item-large":s===`large`}),ref:e=>{t&&!n&&e?.scrollIntoView?.({block:`nearest`})},onClick:n?c:i,onMouseMove:n?c:r,title:n?G(`commandPalette.itemNotAvailable`):``,children:[(0,V.jsxs)(`div`,{className:`name`,children:[e.icon&&(0,V.jsx)(sw,{className:`icon`,size:`var(--icon-size, 1rem)`,icon:typeof e.icon==`function`?e.icon(o,[]):e.icon}),(0,V.jsx)(JC,{children:e.label})]}),a&&e.shortcut&&(0,V.jsx)(eA,{shortcut:e.shortcut})]})};function aA([e,t,n],[r,i,a]){return[e+r,t+i,n+a]}function oA([e,t,n],[r,i,a]){return[e-r,t-i,n-a]}function sA([e,t,n],r){return[e*r,t*r,n*r]}function cA([e,t,n]){return[e/Math.sqrt(e**2+t**2),t/Math.sqrt(e**2+t**2),n]}function lA([e,t,n],r){return[Math.cos(r)*e-Math.sin(r)*t,Math.sin(r)*e+Math.cos(r)*t,n]}function uA(e,t,n){return aA(e,sA(oA(t,e),n))}function dA(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 fA(e){return Math.atan2(Math.sin(e),Math.cos(e))}function pA([e,t]){return Math.sqrt(e**2+t**2)}function mA([e,t],[n,r]){return Math.sqrt((n-e)**2+(r-t)**2)}function hA(e){if(e.length<2)return 0;let t=0;for(let n=1;n<=e.length-1;n++)t+=mA(e[n-1],e[n]);return t+=mA(e[e.length-2],e[e.length-1]),t}var gA=(e,t,n)=>Math.max(t,Math.min(n,e));function _A(e,t,n){let r=mA(t,n);if(r===0)return mA(e,t);let i=gA(((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r**2,0,1);return mA([t[0]+i*(n[0]-t[0]),t[1]+i*(n[1]-t[1]),e[2]],e)}function vA(e,t){if(t===0||e.length<=2)return e;let n=e[0],r=e[e.length-1],[i,a]=e.reduce(([e,t],i,a)=>{let o=_A(i,n,r);return o>e?[o,a]:[e,t]},[0,-1]);if(i>=t){let i=e[a];return[...vA([n,...e.slice(1,a),i],t).slice(0,-1),i,...vA([i,...e.slice(a,-1),r],t).slice(1)]}return[n,r]}var yA=class e{constructor(t){z(this,`options`),z(this,`originalPoints`,[]),z(this,`stablePoints`,[]),z(this,`tailPoints`,[]),z(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=uA(this.lastPoint,t,1-this.options.streamline)),this.tailPoints.push(t),hA(this.tailPoints)>e.constants.maxTailLength&&this.stabilizeTail()}}close(){this.stabilizeTail()}stabilizeTail(){if(this.options.simplify>0&&this.options.simplifyPhase===`tail`)throw Error(`Not implemented yet`);this.stablePoints.push(...this.tailPoints),this.tailPoints=[]}getSize(e,t,n,r,i){return(e??this.options.size)*this.options.sizeMapping({pressure:t,runningLength:i,currentIndex:n,totalLength:r})}getStrokeOutline(t){if(this.isFresh)return[];let n=[...this.stablePoints,...this.tailPoints];this.options.simplify>0&&this.options.simplifyPhase===`input`&&(n=vA(n,this.options.simplify));let r=n.length;if(r===0)return[];if(r===1){let e=n[0],i=this.getSize(t,e[2],0,r,0);if(i<.5)return[];let a=[];for(let t=0;t<=Math.PI*2;t+=Math.PI/16)a.push(aA(e,sA(lA([1,0,0],t),i)));return a.push(aA(e,sA([1,0,0],this.getSize(t,e[2],0,r,0)))),a}if(r===2){let e=n[0],i=n[1],a=this.getSize(t,e[2],0,r,0),o=this.getSize(t,i[2],0,r,0);if(a<.5||o<.5)return[];let s=[],c=dA(e,[e[0],e[1]-100,e[2]],i);for(let t=c;t<=Math.PI+c;t+=Math.PI/16)s.push(aA(e,sA(lA([1,0,0],t),a)));for(let e=Math.PI+c;e<=Math.PI*2+c;e+=Math.PI/16)s.push(aA(i,sA(lA([1,0,0],e),o)));return s.push(s[0]),s}let i=[],a=[],o=0,s=0,c=0,l=0;for(let u=1;u<r-1;u++){let d=n[u-1],f=n[u],p=n[u+1],m=f[2],h=mA(d,f);l+=h,o=s+(h-s)*.2;let g=this.getSize(t,m,u,r,l);if(g===0){c=u+1;continue}let _=cA(oA(d,f)),v=cA(oA(p,f)),y=lA(_,Math.PI/2),b=lA(_,-Math.PI/2),x=lA(v,Math.PI/2),S=lA(v,-Math.PI/2),C=aA(f,sA(y,g)),w=aA(f,sA(b,g)),T=aA(f,sA(x,g)),E=aA(f,sA(S,g)),D=aA(y,S),O=aA(b,x),ee=aA(f,sA(pA(D)===0?_:cA(D),g)),k=aA(f,sA(pA(O)===0?v:cA(O),g)),A=fA(dA(f,d,p)),te=e.constants.cornerDetectionMaxAngle/180*Math.PI*e.constants.cornerDetectionVariance(o);if(Math.abs(A)<te){let e=Math.abs(fA(Math.PI-A));if(e===0)continue;if(A<0){a.push(w,k);for(let t=0;t<=e;t+=e/4)i.push(aA(f,lA(sA(y,g),t)));for(let t=e;t>=0;t-=e/4)a.push(aA(f,lA(sA(y,g),t)));a.push(k,T)}else{i.push(C,ee);for(let t=0;t<=e;t+=e/4)a.push(aA(f,lA(sA(y,-g),-t)));for(let t=e;t>=0;t-=e/4)i.push(aA(f,lA(sA(y,-g),-t)));i.push(ee,E)}}else i.push(ee),a.push(k);s=o}if(c>=r-2){if(this.options.keepHead){let e=n[r-1],t=[];for(let n=0;n<=Math.PI*2;n+=Math.PI/16)t.push(aA(e,sA(lA([1,0,0],n),this.options.size)));return t.push(aA(e,sA([1,0,0],this.options.size))),t}return[]}let u=n[c],d=n[c+1],f=n[r-2],p=n[r-1],m=cA(oA(d,u)),h=cA(oA(f,p)),g=lA(m,-Math.PI/2),_=lA(h,Math.PI/2),v=this.getSize(t,u[2],0,r,0),y=[],b=this.options.keepHead?this.options.size:this.getSize(t,f[2],r-2,r,l),x=[];if(v>.1){for(let e=0;e<=Math.PI;e+=Math.PI/16)y.unshift(aA(u,lA(sA(g,v),-e)));y.unshift(aA(u,sA(g,-v)))}else y.push(u);for(let e=0;e<=Math.PI*3;e+=Math.PI/16)x.push(aA(p,lA(sA(_,-b),-e)));let S=[...y,...i,...x.reverse(),...a.reverse()];return y.length>0&&S.push(y[0]),this.options.simplify>0&&this.options.simplifyPhase===`output`?vA(S,this.options.simplify):S}};z(yA,`defaults`,{size:2,streamline:.45,simplify:.1,simplifyPhase:`output`,keepHead:!1,sizeMapping:()=>1}),z(yA,`constants`,{cornerDetectionMaxAngle:75,cornerDetectionVariance:e=>e>35?.5:1,maxTailLength:50});var bA=yA,xA=e=>{if(!e)return[];for(let t of e.sets)if(t.type===`path`)return t.ops;return e.sets[0].ops},SA=e=>!!e&&e.type===`embeddable`,CA=e=>!!e&&e.type===`iframe`,wA=e=>!!e&&(e.type===`iframe`||e.type===`embeddable`),TA=e=>e!=null&&e.type===`text`,EA=e=>e!=null&&(e.type===`frame`||e.type===`magicframe`),DA=e=>e!=null&&AA(e.type),OA=e=>e!=null&&e.type===`arrow`,kA=e=>OA(e)&&e.elbowed,AA=e=>e===`arrow`||e===`line`,jA=e=>e!==null&&`containerId`in e&&e.containerId!==null&&TA(e),MA=(e,t=1)=>{if(e.length>=3){let[n,r]=[e[0],e[e.length-1]];return hn(n,r)<=8/t}return!1},NA=(e,t)=>{if(t.roundness?.type===Go.PROPORTIONAL_RADIUS||t.roundness?.type===Go.LEGACY)return e*u;if(t.roundness?.type===Go.ADAPTIVE_RADIUS){let n=t.roundness?.value??32;return e<=n/.25?e*u:n}return 0};`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`.toLocaleUpperCase();var PA=(e,t)=>{let n=[];for(let r of e.values())r.frameId===t&&n.push(r);return n};(function(){let e=null,t=null,n=null,r=(r,i)=>(n!=null&&r===e&&i.selectedElementIds===t||(n=r.some(e=>i.selectedElementIds[e.id]),e=r,t=i.selectedElementIds),n);return r.clearCache=()=>{e=null,t=null,n=null},r})();var FA=(e,t,n)=>{let r=new Set,i=[];for(let a of e.values()){if(t.selectedElementIds[a.id]){qA(a)?(i.push(a),r.add(a.id)):console.error(`[NONDELETED][INVARIANT] getSelectedElements skipping deleted selected element which should not be in the selection`);continue}if(n?.includeBoundTextElement&&jA(a)&&t.selectedElementIds[a?.containerId]){i.push(a),r.add(a.id);continue}}if(n?.includeElementsInFrames){let t=[];return i.forEach(n=>{EA(n)&&PA(e,n.id).forEach(e=>!r.has(e.id)&&t.push(e)),t.push(n)}),t}return i},IA=(e,t)=>Jr(t.selectedElementIds,e)?t.selectedElementIds:e;(function(){let e=null,t=null,n=null,r=(r,i,a,o)=>{if(n!==void 0&&i===t&&r===e&&a.editingGroupId===n?.editingGroupId)return n;let s={};for(let e of r){let t=e.groupIds;if(a.editingGroupId){let e=t.indexOf(a.editingGroupId);e>-1&&(t=t.slice(0,e))}if(t.length>0){let e=t[t.length-1];s[e]=!0}}let c={},l=i.reduce((e,t)=>{if(t.isDeleted)return e;let n=t.groupIds.find(e=>s[e]);return n&&(e[t.id]=!0,Array.isArray(c[n])?c[n].push(t.id):c[n]=[t.id]),e},{});for(let e of Object.keys(c))c[e].length<2&&s[e]&&(s[e]=!1);return t=i,e=r,n={editingGroupId:a.editingGroupId,selectedGroupIds:s,selectedElementIds:IA({...a.selectedElementIds,...l},o)},n},i=(e,t,n,i)=>{let a=i?i.scene.getSelectedElements({selectedElementIds:e.selectedElementIds,elements:t}):FA(t,e);return a.length?r(a,t,e,n):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:IA(e.selectedElementIds,n)}};return i.clearCache=()=>{t=null,e=null,n=null},i})();var LA=e=>e===`rectangle`||e===`iframe`||e===`embeddable`||e===`line`||e===`diamond`||e===`image`;(0,wc.default)(e=>{(Ms()||Xt()||window?.DEBUG_FRACTIONAL_INDICES)&&St(e,{shouldThrow:Ms()||Xt(),includeBoundTextValidation:!0})},1e3*60,{leading:!0,trailing:!1});var RA=[1,0],zA=[0,1],BA=[-1,0],VA=[0,-1],HA=e=>{let[t,n]=e,r=Math.abs(t),i=Math.abs(n);return t>i?RA:t<=-i?BA:n>r?zA:VA},UA=(e,t)=>HA(mt(e,t)),WA=(e,t)=>KA(UA(e,t)),GA=(e,t)=>e[0]===t[0]&&e[1]===t[1],KA=e=>GA(e,RA)||GA(e,BA),qA=e=>!e.isDeleted,JA=e=>{let t=Math.floor(e.width/2)+1,n=e.width,r=Math.floor(e.height/2)+1;return[t,0,n,r,t,e.height,0,r]},YA=20,XA=15,ZA=e=>{switch(e){case`arrow`:return 25;case`diamond`:case`diamond_outline`:return 12;case`cardinality_many`:case`cardinality_one_or_many`:case`cardinality_zero_or_many`:return XA;case`cardinality_one`:case`cardinality_exactly_one`:case`cardinality_zero_or_one`:return YA;default:return 15}},QA=e=>{switch(e){case`bar`:return 90;case`arrow`:return 20;default:return 25}},$A=(e,t,n,r,i=0)=>{if(r===null||t.length<1)return null;let o=xA(t[0]);if(o.length<1)return null;let s=n===`start`?1:o.length-1,c=o[s].data;pe(c.length===6,`Op data length is not 6`);let l=a(c[4],c[5]),u=a(c[2],c[3]),d=a(c[0],c[1]),f=o[s-1],p=a(0,0);if(f.op===`move`){let e=cc(f.data);pe(e!=null,`Op data is not a point`),p=e}else f.op===`bcurveTo`&&(p=a(f.data[4],f.data[5]));let m=(e,t)=>(1-e)**3*l[t]+3*e*(1-e)**2*u[t]+3*e**2*(1-e)*d[t]+p[t]*e**3,[h,g]=n===`start`?p:l,[_,v]=[m(.3,0),m(.3,1)],y=Math.hypot(h-_,g-v),b=(h-_)/y,x=(g-v)/y,S=ZA(r),C=0;{let[t,r]=n===`end`?e.points[e.points.length-1]:e.points[0],[i,a]=e.points.length>1?n===`end`?e.points[e.points.length-2]:e.points[1]:[0,0];C=Math.hypot(t-i,r-a)}let w=Math.min(S,C*(r===`diamond`||r===`diamond_outline`?.25:.5)),T=h-b*w*i,E=g-x*w*i,D=T-b*w,O=E-x*w;if(r===`circle`||r===`circle_outline`)return[T,E,Math.hypot(O-E,D-T)+e.strokeWidth-2];let ee=QA(r);if(r===`cardinality_many`||r===`cardinality_one_or_many`){let[e,t]=ot(a(T,E),a(D,O),zr(-ee)),[n,r]=ot(a(T,E),a(D,O),zr(ee));return[D,O,e,t,n,r]}let[k,A]=ot(a(D,O),a(T,E),-ee*Math.PI/180),[te,ne]=ot(a(D,O),a(T,E),zr(ee));if(r===`diamond`||r===`diamond_outline`){let t,r;if(n===`start`){let[n,i]=e.points.length>1?e.points[1]:[0,0];[t,r]=ot(a(T+w*2,E),a(T,E),Math.atan2(i-E,n-T))}else{let[n,i]=e.points.length>1?e.points[e.points.length-2]:[0,0];[t,r]=ot(a(T-w*2,E),a(T,E),Math.atan2(E-i,T-n))}return[T,E,k,A,t,r,te,ne]}return[T,E,k,A,te,ne]},ej=typeof document<`u`?document.createElement(`img`):{src:``};ej.src=`data:${Se.svg},%3Csvg%20aria-hidden%3D%22true%22%20focusable%3D%22false%22%20data-prefix%3D%22fas%22%20data-icon%3D%22image%22%20class%3D%22svg-inline--fa%20fa-image%20fa-w-16%22%20role%3D%22img%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20512%20512%22%3E%3Cpath%20fill%3D%22%23888%22%20d%3D%22M464%20448H48c-26.51%200-48-21.49-48-48V112c0-26.51%2021.49-48%2048-48h416c26.51%200%2048%2021.49%2048%2048v288c0%2026.51-21.49%2048-48%2048zM112%20120c-30.928%200-56%2025.072-56%2056s25.072%2056%2056%2056%2056-25.072%2056-56-25.072-56-56-56zM64%20384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971%200L208%20320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971%200L64%20336v48z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E`;var tj=typeof document<`u`?document.createElement(`img`):{src:``};tj.src=`data:${Se.svg},%3Csvg%20viewBox%3D%220%200%20668%20668%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xml%3Aspace%3D%22preserve%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%22%3E%3Cpath%20d%3D%22M464%20448H48c-26.51%200-48-21.49-48-48V112c0-26.51%2021.49-48%2048-48h416c26.51%200%2048%2021.49%2048%2048v288c0%2026.51-21.49%2048-48%2048ZM112%20120c-30.928%200-56%2025.072-56%2056s25.072%2056%2056%2056%2056-25.072%2056-56-25.072-56-56-56ZM64%20384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971%200L208%20320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971%200L64%20336v48Z%22%20style%3D%22fill%3A%23888%3Bfill-rule%3Anonzero%22%20transform%3D%22matrix(.81709%200%200%20.81709%20124.825%20145.825)%22%2F%3E%3Cpath%20d%3D%22M256%208C119.034%208%208%20119.033%208%20256c0%20136.967%20111.034%20248%20248%20248s248-111.034%20248-248S392.967%208%20256%208Zm130.108%20117.892c65.448%2065.448%2070%20165.481%2020.677%20235.637L150.47%20105.216c70.204-49.356%20170.226-44.735%20235.638%2020.676ZM125.892%20386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53%20406.784c-70.203%2049.356-170.226%2044.736-235.638-20.676Z%22%20style%3D%22fill%3A%23888%3Bfill-rule%3Anonzero%22%20transform%3D%22matrix(.30366%200%200%20.30366%20506.822%2060.065)%22%2F%3E%3C%2Fsvg%3E`;var nj=new WeakMap,rj=class{};z(rj,`rg`,new so),z(rj,`cache`,new WeakMap),z(rj,`get`,(e,t)=>{let n=rj.cache.get(e);if(n&&(t===null||n.theme===t))return n.shape}),z(rj,`delete`,e=>{rj.cache.delete(e),nj.delete(e)}),z(rj,`destroy`,()=>{rj.cache=new WeakMap}),z(rj,`generateElementShape`,(e,t)=>{let n=t?.isExporting?void 0:rj.get(e,t?t.theme:null);if(n!==void 0)return n;nj.delete(e);let r=mj(e,rj.rg,t||{isExporting:!1,canvasBackgroundColor:Vs.white,embedsValidationStatus:null,theme:F.LIGHT});return t?.isExporting||rj.cache.set(e,{shape:r,theme:t?.theme||F.LIGHT}),r});var ij=e=>[8,8+e],aj=e=>[1.5,6+e];function oj(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&&LA(e.type)||DA(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}var sj=(e,t=!1,n=!1)=>{let r={seed:e.seed,strokeLineDash:e.strokeStyle===`dashed`?ij(e.strokeWidth):e.strokeStyle===`dotted`?aj(e.strokeWidth):void 0,disableMultiStroke:e.strokeStyle!==`solid`,strokeWidth:e.strokeStyle===`solid`?e.strokeWidth:e.strokeWidth+.5,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,roughness:oj(e),stroke:$t(e.strokeColor,n),preserveVertices:t||e.roughness<Ya.cartoonist};switch(e.type){case`rectangle`:case`iframe`:case`embeddable`:case`diamond`:case`ellipse`:return r.fillStyle=e.fillStyle,r.fill=bo(e.backgroundColor)?void 0:$t(e.backgroundColor,n),e.type===`ellipse`&&(r.curveFitting=1),r;case`line`:case`freedraw`:return MA(e.points)&&(r.fillStyle=e.fillStyle,r.fill=e.backgroundColor===`transparent`?void 0:$t(e.backgroundColor,n)),r;case`arrow`:return r;default:throw Error(`Unimplemented type ${e.type}`)}},cj=(e,t,n)=>wA(e)&&(t||SA(e)&&n?.get(e.id)!==!0)&&bo(e.backgroundColor)&&bo(e.strokeColor)?{...e,roughness:0,backgroundColor:`#d3d3d3`,fillStyle:`solid`}:CA(e)?{...e,strokeColor:bo(e.strokeColor)?`#000000`:e.strokeColor,backgroundColor:bo(e.backgroundColor)?`#f4f4f6`:e.backgroundColor}:e,lj=(e,t,n)=>{if(t===null)return[];let[,,r,i,a,o]=t;return[e.line(r,i,a,o,n)]},uj=(e,t,n)=>{if(t===null)return[];let[r,i,a,o,s,c]=t;return[e.line(a,o,r,i,n),e.line(s,c,r,i,n)]},dj=(e,t)=>{let n={...t};if(e.strokeStyle===`dotted`){let t=aj(e.strokeWidth-1);n.strokeLineDash=[t[0],t[1]-1]}else delete n.strokeLineDash;return n.roughness=Math.min(1,n.roughness||0),n},fj=(e,t,n,r,i,a=1)=>{if(r===null)return[];let[o,s,c]=r,l={...t,fill:i,fillStyle:`solid`,stroke:n,roughness:Math.min(.5,t.roughness||0)};return delete l.strokeLineDash,[e.circle(o,s,c*a,l)]},pj=(e,t,n,r,i,a,o,s)=>{if(r===null)return[];let c=$t(e.strokeColor,s),l=$t(o,s),u=.8;switch(r){case`circle`:case`circle_outline`:return fj(i,a,c,$A(e,t,n,r),r===`circle_outline`?l:c);case`triangle`:case`triangle_outline`:{let o=$A(e,t,n,r);if(o===null)return[];let[s,u,d,f,p,m]=o,h={...a,fill:r===`triangle_outline`?l:c,fillStyle:`solid`,roughness:Math.min(1,a.roughness||0)};return delete h.strokeLineDash,[i.polygon([[s,u],[d,f],[p,m],[s,u]],h)]}case`diamond`:case`diamond_outline`:{let o=$A(e,t,n,r);if(o===null)return[];let[s,u,d,f,p,m,h,g]=o,_={...a,fill:r===`diamond_outline`?l:c,fillStyle:`solid`,roughness:Math.min(1,a.roughness||0)};return delete _.strokeLineDash,[i.polygon([[s,u],[d,f],[p,m],[h,g],[s,u]],_)]}case`cardinality_one`:return lj(i,$A(e,t,n,r),dj(e,a));case`cardinality_many`:return uj(i,$A(e,t,n,r),dj(e,a));case`cardinality_one_or_many`:{let r=dj(e,a);return[...uj(i,$A(e,t,n,`cardinality_many`),r),...lj(i,$A(e,t,n,`cardinality_one`,-.25),r)]}case`cardinality_exactly_one`:{let r=dj(e,a);return[...lj(i,$A(e,t,n,`cardinality_one`,-.5),r),...lj(i,$A(e,t,n,`cardinality_one`),r)]}case`cardinality_zero_or_one`:{let r=dj(e,a);return[...fj(i,a,c,$A(e,t,n,`circle_outline`,1.5),l,u),...lj(i,$A(e,t,n,`cardinality_one`,-.5),r)]}case`cardinality_zero_or_many`:{let r=dj(e,a);return[...uj(i,$A(e,t,n,`cardinality_many`),r),...fj(i,a,c,$A(e,t,n,`circle_outline`,1.5),l,u)]}default:return uj(i,$A(e,t,n,r),dj(e,a))}},mj=(e,t,{isExporting:n,canvasBackgroundColor:r,embedsValidationStatus:i,theme:o})=>{let s=o===F.DARK;switch(e.type){case`rectangle`:case`iframe`:case`embeddable`:{let r;if(e.roundness){let a=e.width,o=e.height,c=NA(Math.min(a,o),e);r=t.path(`M ${c} 0 L ${a-c} 0 Q ${a} 0, ${a} ${c} L ${a} ${o-c} Q ${a} ${o}, ${a-c} ${o} L ${c} ${o} Q 0 ${o}, 0 ${o-c} L 0 ${c} Q 0 0, ${c} 0`,sj(cj(e,n,i),!0,s))}else r=t.rectangle(0,0,e.width,e.height,sj(cj(e,n,i),!1,s));return r}case`diamond`:{let n,[r,i,a,o,c,l,u,d]=JA(e);if(e.roundness){let f=NA(Math.abs(r-u),e),p=NA(Math.abs(o-i),e);n=t.path(`M ${r+f} ${i+p} L ${a-f} ${o-p}
47
+ C ${a} ${o}, ${a} ${o}, ${a-f} ${o+p}
48
+ L ${c+f} ${l-p}
49
+ C ${c} ${l}, ${c} ${l}, ${c-f} ${l-p}
50
+ L ${u+f} ${d+p}
51
+ C ${u} ${d}, ${u} ${d}, ${u+f} ${d-p}
52
+ L ${r-f} ${i+p}
53
+ C ${r} ${i}, ${r} ${i}, ${r+f} ${i+p}`,sj(e,!0,s))}else n=t.polygon([[r,i],[a,o],[c,l],[u,d]],sj(e,!1,s));return n}case`ellipse`:return t.ellipse(e.width/2,e.height/2,e.width,e.height,sj(e,!1,s));case`line`:case`arrow`:{let n,i=sj(e,!1,s),o=e.points.length?e.points:[a(0,0)];if(kA(e)?o.every(e=>Math.abs(e[0])<=1e6&&Math.abs(e[1])<=1e6)?n=[t.path(hj(o,16),sj(e,!0,s))]:(console.error(`Elbow arrow with extreme point positions detected. Arrow not rendered.`,e.id,JSON.stringify(o)),n=[]):n=e.roundness?[t.curve(o,i)]:i.fill?[t.polygon(o,i)]:[t.linearPath(o,i)],e.type===`arrow`){let{startArrowhead:a=null,endArrowhead:o=`arrow`}=e;if(a!==null){let o=pj(e,n,`start`,a,t,i,r,s);n.push(...o)}if(o!==null){let a=pj(e,n,`end`,o,t,i,r,s);n.push(...a)}}return n}case`freedraw`:{let n=[];if(MA(e.points)){let r=Sv(e.points,.75);n.push(t.curve(r,{...sj(e,!1,s),stroke:`none`}))}return n.push(gj(e)),n}case`frame`:case`magicframe`:case`text`:case`image`:return null;default:return er(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}},hj=(e,t)=>{let n=[];for(let r=1;r<e.length-1;r+=1){let i=e[r-1],a=e[r+1],o=e[r],s=WA(o,i),c=WA(a,o),l=Math.min(t,hn(e[r],a)/2,hn(e[r],i)/2);s?i[0]<o[0]?n.push([e[r][0]-l,e[r][1]]):n.push([e[r][0]+l,e[r][1]]):i[1]<o[1]?n.push([e[r][0],e[r][1]-l]):n.push([e[r][0],e[r][1]+l]),n.push(e[r]),c?a[0]<o[0]?n.push([e[r][0]-l,e[r][1]]):n.push([e[r][0]+l,e[r][1]]):a[1]<o[1]?n.push([e[r][0],e[r][1]-l]):n.push([e[r][0],e[r][1]+l])}let r=[`M ${e[0][0]} ${e[0][1]}`];for(let e=0;e<n.length;e+=3)r.push(`L ${n[e][0]} ${n[e][1]}`),r.push(`Q ${n[e+1][0]} ${n[e+1][1]}, ${n[e+2][0]} ${n[e+2][1]}`);return r.push(`L ${e[e.length-1][0]} ${e[e.length-1][1]}`),r.join(` `)},gj=e=>Ej(Cj(e)),_j={SIZE_FACTOR:4.25,THINNING:.6,SMOOTHING:.5},vj={SIZE_FACTOR:1.4},yj=e=>e.strokeOptions?.streamline??.5,bj=e=>qv(e.simulatePressure?e.points:e.points.length?e.points.map(([t,n],r)=>[t,n,e.pressures[r]]):[[0,0,.5]],{simulatePressure:e.simulatePressure,size:e.strokeWidth*_j.SIZE_FACTOR,thinning:_j.THINNING,smoothing:_j.SMOOTHING,streamline:yj(e),easing:e=>Math.sin(e*Math.PI/2),last:!0}),xj=e=>new bA({size:e.strokeWidth*vj.SIZE_FACTOR,streamline:yj(e),simplify:0,sizeMapping:e=>Math.max(.1,e.pressure)}),Sj=e=>{let t=xj(e);return e.points.map(([e,n])=>t.addPoint([e,n,1])),t.getStrokeOutline().map(([e,t])=>[e,t])},Cj=e=>e.strokeOptions?.variability===`constant`?Sj(e):bj(e),wj=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],Tj=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g,Ej=e=>{if(!e.length)return``;let t=e.length-1;return e.reduce((e,n,r,i)=>(r===t?e.push(n,wj(n,i[0]),`L`,i[0],`Z`):e.push(n,wj(n,i[r+1])),e),[`M`,e[0],`Q`]).join(` `).replace(Tj,`$1`)},Dj=(e,t,n=!1)=>{let r=!1;for(let n in t){let i=t[n];if(typeof i<`u`){if(e[n]===i&&(typeof i!=`object`||!i))continue;r=!0}}return!r&&!n?e:{...e,...t,version:t.version??e.version+1,versionNonce:t.versionNonce??dr(),updated:qn()}},Oj=X({name:`toggleLinearEditor`,category:Qk.elements,label:(e,t,n)=>n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds})[0]?.type===`arrow`?`labels.lineEditor.editArrow`:`labels.lineEditor.edit`,keywords:[`line`],trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return!!(!t.selectedLinearElement?.isEditing&&i.length===1&&ja(i[0])&&!Ti(i[0]))},perform(e,t,n,r){let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0];pe(i,`No selected element found`),pe(t.selectedLinearElement,`No selected linear element found`),pe(i.id===t.selectedLinearElement.elementId,`Selected element ID and linear editor elementId does not match`);let a={...t.selectedLinearElement,isEditing:!t.selectedLinearElement.isEditing};return{appState:{...t,selectedLinearElement:a},captureUpdate:P.IMMEDIATELY}},PanelComponent:({appState:e,updateData:t,app:n})=>{let r=n.scene.getSelectedElements({selectedElementIds:e.selectedElementIds})[0];if(!r)return null;let i=G(r.type===`arrow`?`labels.lineEditor.editArrow`:`labels.lineEditor.edit`);return(0,V.jsx)(Y,{type:`button`,icon:kS,title:i,"aria-label":i,onClick:()=>t(null)})}});X({name:`togglePolygon`,category:Qk.elements,icon:Py,keywords:[`loop`],label:(e,t,n)=>n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds}).some(e=>!mr(e)||!e.polygon)?`labels.polygon.convertToPolygon`:`labels.polygon.breakPolygon`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds});return i.length>0&&i.every(e=>mr(e)&&e.points.length>=4)},perform(e,t,n,r){let i=r.scene.getSelectedElements(t);if(i.some(e=>!mr(e)))return!1;let a=i,o=a.some(e=>!e.polygon),s=Pa(a);return{elements:e.map(e=>!s.has(e.id)||!mr(e)?e:Dj(e,{backgroundColor:o?e.backgroundColor:`transparent`,...h(e,o)})),appState:t,captureUpdate:P.IMMEDIATELY}},PanelComponent:({appState:e,updateData:t,app:n})=>{let r=n.scene.getSelectedElements({selectedElementIds:e.selectedElementIds});if(r.length===0||r.some(e=>!mr(e)||!e.polygon||e.points.length<3))return null;let i=r.every(e=>mr(e)&&e.polygon),a=G(i?`labels.polygon.breakPolygon`:`labels.polygon.convertToPolygon`);return(0,V.jsx)(Y,{type:`toggle`,icon:Py,title:a,"aria-label":a,checked:i,onSelect:()=>t(null),style:{marginLeft:`auto`}})}});var kj=X({name:`searchMenu`,icon:uS,keywords:[`search`,`find`],label:`search.title`,viewMode:!0,trackEvent:{category:`search_menu`,action:`toggle`,predicate:e=>e.gridModeEnabled},perform(e,t,n,r){if(t.openDialog)return!1;if(t.openSidebar?.name===oe.name&&t.openSidebar.tab===`search`){let e=r.excalidrawContainerValue.container?.querySelector(`.${sa.SEARCH_MENU_INPUT_WRAPPER} input`);return e?.focus(),e?.select(),!1}return{appState:{...t,openSidebar:{name:oe.name,tab:Fr},openDialog:null},captureUpdate:P.EVENTUALLY}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>n.gridModeEnabled===void 0,keyTest:e=>e[M.CTRL_OR_CMD]&&e.key===M.F}),Aj=X({name:`cropEditor`,label:`helpDialog.cropStart`,icon:IS,viewMode:!0,trackEvent:{category:`menu`},keywords:[`image`,`crop`],perform(e,t,n,r){let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0];return{appState:{...t,isCropping:!1,croppingElementId:i.id},captureUpdate:P.IMMEDIATELY}},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return!!(!t.croppingElementId&&i.length===1&&Ce(i[0]))},PanelComponent:({appState:e,updateData:t,app:n})=>{let r=G(`helpDialog.cropStart`);return(0,V.jsx)(Y,{type:`button`,icon:IS,title:r,"aria-label":r,onClick:()=>t(null)})}}),jj=(e,t)=>{let n=t.scene.getSelectedElements(e);return n.length===1&&N(n[0])},Mj=X({name:`selectAllElementsInFrame`,label:`labels.selectAllElementsInFrame`,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t).at(0)||null;if(N(i)){let n=D(Sa(e),i.id).filter(e=>!(e.type===`text`&&e.containerId));return{elements:e,appState:{...t,selectedElementIds:n.reduce((e,t)=>(e[t.id]=!0,e),{})},captureUpdate:P.IMMEDIATELY}}return{elements:e,appState:t,captureUpdate:P.EVENTUALLY}},predicate:(e,t,n,r)=>jj(t,r)}),Nj=X({name:`removeAllElementsFromFrame`,label:`labels.removeAllElementsFromFrame`,trackEvent:{category:`history`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t).at(0)||null;return N(i)?{elements:Rt(e,i),appState:{...t,selectedElementIds:{[i.id]:!0}},captureUpdate:P.IMMEDIATELY}:{elements:e,appState:t,captureUpdate:P.EVENTUALLY}},predicate:(e,t,n,r)=>jj(t,r)});X({name:`updateFrameRendering`,label:`labels.updateFrameRendering`,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t)=>({elements:e,appState:{...t,frameRendering:{...t.frameRendering,enabled:!t.frameRendering.enabled}},captureUpdate:P.EVENTUALLY}),checked:e=>e.frameRendering.enabled});var Pj=X({name:`wrapSelectionInFrame`,label:`labels.wrapSelectionInFrame`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=An(e,t);return i.length>0&&!i.some(e=>N(e))},perform:(e,t,n,r)=>{let i=An(e,t),a=r.scene.getNonDeletedElementsMap(),[o,s,c,l]=He(i,a),u=Be({x:o-16,y:s-16,width:c-o+32,height:l-s+32});if(t.editingGroupId){let e=Tt(i,t.editingGroupId);for(let n of e){let e=n.groupIds.indexOf(t.editingGroupId);Ye(n,a,{groupIds:n.groupIds.slice(0,e)})}}return{elements:di([...r.scene.getElementsIncludingDeleted(),u],i,u),appState:{selectedElementIds:{[u.id]:!0}},captureUpdate:P.IMMEDIATELY}}}),Fj=class extends Va{applyTo(e,t,n){let[r,i]=this.elements.applyTo(e,n.elements,{excludedProperties:new Set([`version`,`versionNonce`])}),[a,o]=this.appState.applyTo(t,r);return[r,a,i||o]}static calculate(e,t){return super.calculate(e,t)}static inverse(e){return super.inverse(e)}static applyLatestChanges(e,t,n,r){return super.applyLatestChanges(e,t,n,r)}},Ij=class{constructor(e=!0,t=!0){this.isUndoStackEmpty=e,this.isRedoStackEmpty=t}},Lj=class e{constructor(e){this.store=e,z(this,`onHistoryChangedEmitter`,new io),z(this,`undoStack`,[]),z(this,`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(e){if(e.isEmpty()||e instanceof Fj)return;let t=Fj.inverse(e);this.undoStack.push(t),t.elements.isEmpty()||(this.redoStack.length=0),this.onHistoryChangedEmitter.trigger(new Ij(this.isUndoStackEmpty,this.isRedoStackEmpty))}undo(t,n){return this.perform(t,n,()=>e.pop(this.undoStack),t=>e.push(this.redoStack,t))}redo(t,n){return this.perform(t,n,()=>e.pop(this.redoStack),t=>e.push(this.undoStack,t))}perform(e,t,n,r){try{let i=n();if(i===null)return;let a=P.IMMEDIATELY,o=this.store.snapshot,s=e,c=t,l=!1;for(;i;){try{[s,c,l]=i.applyTo(s,c,o);let e=o.elements,t=o.maybeClone(a,s,c),n=me.create(o,t),r=Fj.applyLatestChanges(i,e,s);r.isEmpty()||(this.store.scheduleMicroAction({action:a,change:n,delta:r}),i=r),o=t}finally{r(i)}if(l)break;i=n()}return[s,c]}finally{this.onHistoryChangedEmitter.trigger(new Ij(this.isUndoStackEmpty,this.isRedoStackEmpty))}}static pop(e){if(!e.length)return null;let t=e.pop();return t===void 0?null:t}static push(e,t){let n=Fj.inverse(t);return e.push(n)}},Rj=(e,t)=>{let[n,r]=(0,B.useState)(t);return(0,B.useEffect)(()=>{let t=e.on(e=>{r(e)});return()=>{t()}},[e]),n},zj=(e,t,n)=>{if(!t.multiElement&&!t.resizingElement&&!t.editingTextElement&&!t.newElement&&!t.selectedElementsAreBeingDragged&&!t.selectionElement&&!e.flowchart.isCreatingChart){let e=n();if(!e)return{captureUpdate:P.EVENTUALLY};let[t,r]=e;return{appState:r,elements:Fs(Array.from(t.values())),captureUpdate:P.NEVER}}return{captureUpdate:P.EVENTUALLY}},Bj=e=>({name:`undo`,label:`buttons.undo`,icon:Eb,trackEvent:{category:`history`},viewMode:!1,perform:(t,n,r,i)=>zj(i,n,()=>e.undo(Pa(t),n)),keyTest:e=>e[M.CTRL_OR_CMD]&&ri(e,M.Z)&&!e.shiftKey,PanelComponent:({appState:t,updateData:n,data:r,app:i})=>{let{isUndoStackEmpty:a}=Rj(e.onHistoryChangedEmitter,new Ij(e.isUndoStackEmpty,e.isRedoStackEmpty)),o=$z()===`mobile`;return(0,V.jsx)(Y,{type:`button`,icon:Eb,"aria-label":G(`buttons.undo`),onClick:n,size:r?.size||`medium`,disabled:a,"data-testid":`button-undo`,style:{...o?te:{}}})}}),Vj=e=>({name:`redo`,label:`buttons.redo`,icon:Db,trackEvent:{category:`history`},viewMode:!1,perform:(t,n,r,i)=>zj(i,n,()=>e.redo(Pa(t),n)),keyTest:e=>e[M.CTRL_OR_CMD]&&e.shiftKey&&ri(e,M.Z)||e[M.CTRL_OR_CMD]&&!e.shiftKey&&ri(e,M.Y),PanelComponent:({appState:t,updateData:n,data:r,app:i})=>{let{isRedoStackEmpty:a}=Rj(e.onHistoryChangedEmitter,new Ij(e.isUndoStackEmpty,e.isRedoStackEmpty)),o=$z()===`mobile`;return(0,V.jsx)(Y,{type:`button`,icon:Db,"aria-label":G(`buttons.redo`),onClick:n,size:r?.size||`medium`,disabled:a,"data-testid":`button-redo`,style:{...o?te:{}}})}}),Hj=X({name:`autoResize`,label:`labels.autoResize`,icon:null,trackEvent:{category:`element`},predicate:(e,t,n)=>{let r=An(e,t);return r.length===1&&R(r[0])&&!r[0].autoResize},perform:(e,t,n)=>{let r=An(e,t),i=wa(n)&&R(n)?n:r[0];return{appState:t,elements:e.map(e=>{if(e.id===i?.id&&R(e)){let t=Ja(e.originalText,Ho(e),e.lineHeight);return j(e,{autoResize:!0,width:t.width,height:t.height,text:e.originalText})}return e}),captureUpdate:P.IMMEDIATELY}}}),Uj=(e,t,n,r,i,a)=>{if(e.trackEvent)try{typeof e.trackEvent==`object`&&(!e.trackEvent.predicate||e.trackEvent.predicate(n,r,a))&&rC(e.trackEvent.category,e.trackEvent.action||e.name,`${t} (${i.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`)}catch(e){console.error(`error while logging action:`,e)}},Wj=class{constructor(e,t,n,r){z(this,`actions`,{}),z(this,`updater`),z(this,`getAppState`),z(this,`getElementsIncludingDeleted`),z(this,`app`),z(this,`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 n=this.actions[e],r=n.PanelComponent;r.displayName=`PanelComponent`;let i=this.getElementsIncludingDeleted(),a=this.getAppState();return(0,V.jsx)(r,{elements:this.getElementsIncludingDeleted(),appState:this.getAppState(),updateData:e=>{Uj(n,`ui`,a,i,this.app,e),this.updater(n.perform(this.getElementsIncludingDeleted(),this.getAppState(),e,this.app))},appProps:this.app.props,app:this.app,data:t,renderAction:this.renderAction})}return null}),z(this,`isActionEnabled`,e=>{let t=this.getElementsIncludingDeleted(),n=this.getAppState();return!e.predicate||e.predicate(t,n,this.app.props,this.app)}),this.updater=t=>{if(Gs(t))t.then(t=>e(t));else return e(t)},this.getAppState=t,this.getElementsIncludingDeleted=n,this.app=r}registerAction(e){this.actions[e.name]=e}registerAll(e){e.forEach(e=>this.registerAction(e))}handleKeyDown(e){let t=this.app.props.UIOptions.canvasActions,n=Object.values(this.actions).sort((e,t)=>(t.keyPriority||0)-(e.keyPriority||0)).filter(n=>(n.name in t?t[n.name]:!0)&&n.keyTest&&n.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();return Uj(r,`keyboard`,a,i,this.app,null),e.preventDefault(),e.stopPropagation(),this.updater(n[0].perform(i,a,null,this.app)),!0}executeAction(e,t=`api`,n=null){let r=this.getElementsIncludingDeleted(),i=this.getAppState();Uj(e,t,i,r,this.app,n),this.updater(e.perform(r,i,n,this.app))}},Gj=e=>{let t=Array.from(e.values());return{x:qj(t,e=>e.x)/t.length,y:qj(t,e=>e.y)/t.length}},Kj=([e,t])=>Math.hypot(e.x-t.x,e.y-t.y),qj=(e,t)=>e.reduce((e,n)=>e+t(n),0),Jj=8,Yj=99999,Xj=e=>Jj/e,Zj=class{};z(Zj,`referenceSnapPoints`,null),z(Zj,`visibleGaps`,null),z(Zj,`setReferenceSnapPoints`,e=>{Zj.referenceSnapPoints=e}),z(Zj,`getReferenceSnapPoints`,()=>Zj.referenceSnapPoints),z(Zj,`setVisibleGaps`,e=>{Zj.visibleGaps=e}),z(Zj,`getVisibleGaps`,()=>Zj.visibleGaps),z(Zj,`destroy`,()=>{Zj.referenceSnapPoints=null,Zj.visibleGaps=null});var Qj=Zj,$j=e=>e.props.gridModeEnabled??e.state.gridModeEnabled,eM=({event:e,app:t,selectedElements:n})=>{if(e){let n=t.state.activeTool.type===`lasso`&&t.state.selectedElementsAreBeingDragged;return(t.state.activeTool.type!==`lasso`||n)&&(t.state.objectsSnapModeEnabled&&!e[M.CTRL_OR_CMD]||!t.state.objectsSnapModeEnabled&&e[M.CTRL_OR_CMD]&&!$j(t))}return n.length===1&&n[0].type===`arrow`?!1:t.state.objectsSnapModeEnabled},tM=(e,t,n=.01)=>Math.abs(e-t)<=n,nM=(e,t,{omitCenter:n,boundingBoxCorners:r,dragOffset:i}={omitCenter:!1,boundingBoxCorners:!1})=>{let o=[];if(e.length===1){let s=e[0],[c,l,u,d,f,p]=Zi(s,t);i&&(c+=i.x,u+=i.x,f+=i.x,l+=i.y,d+=i.y,p+=i.y);let m=(u-c)/2,h=(d-l)/2;if((s.type===`diamond`||s.type===`ellipse`)&&!r){let e=ot(a(c,l+h),a(f,p),s.angle),t=ot(a(c+m,l),a(f,p),s.angle),r=ot(a(u,l+h),a(f,p),s.angle),i=ot(a(c+m,d),a(f,p),s.angle),g=a(f,p);o=n?[e,t,r,i]:[e,t,r,i,g]}else{let e=ot(a(c,l),a(f,p),s.angle),t=ot(a(u,l),a(f,p),s.angle),r=ot(a(c,d),a(f,p),s.angle),i=ot(a(u,d),a(f,p),s.angle),m=a(f,p);o=n?[e,t,r,i]:[e,t,r,i,m]}}else if(e.length>1){let[t,r,s,c]=se(e,i??{x:0,y:0}),l=s-t,u=c-r,d=a(t,r),f=a(s,r),p=a(t,c),m=a(s,c),h=a(t+l/2,r+u/2);o=n?[d,f,p,m]:[d,f,p,m,h]}return o.map(e=>a(lM(e[0]),lM(e[1])))},rM=(e,t,n,r)=>ec(e,t,n,r),iM=(e,t,n,r)=>{let i=Gr(rM(e,t,n,r),r).filter(e=>!(e.length===1&&xo(e[0]))).map(e=>He(e).map(e=>lM(e))),o=i.sort((e,t)=>e[0]-t[0]),s=[],c=0;e:for(let e=0;e<o.length;e++){let t=o[e];for(let n=e+1;n<o.length;n++){if(++c>Yj)break e;let e=o[n],[,r,i,l]=t,[u,d,,f]=e;i<u&&on(ka(r,l),ka(d,f))&&s.push({startBounds:t,endBounds:e,startSide:[a(i,r),a(i,l)],endSide:[a(u,d),a(u,f)],length:u-i,overlap:C(ka(r,l),ka(d,f))})}}let l=i.sort((e,t)=>e[1]-t[1]),u=[];c=0;e:for(let e=0;e<l.length;e++){let t=l[e];for(let n=e+1;n<l.length;n++){if(++c>Yj)break e;let e=l[n],[r,,i,o]=t,[s,d,f]=e;o<d&&on(ka(r,i),ka(s,f))&&u.push({startBounds:t,endBounds:e,startSide:[a(r,o),a(i,o)],endSide:[a(s,d),a(f,d)],length:d-o,overlap:C(ka(r,i),ka(s,f))})}}return{horizontalGaps:s,verticalGaps:u}},aM=(e,t,n,r,i,a,o)=>{if(!eM({app:n,event:r,selectedElements:e})||e.length===0)return[];let s=Qj.getVisibleGaps();if(s){let{horizontalGaps:n,verticalGaps:r}=s,[c,l,u,d]=se(e,t).map(e=>lM(e)),f=(c+u)/2,p=(l+d)/2;for(let e of n){if(!on(ka(l,d),e.overlap))continue;let t=lM(e.startSide[0][0]+e.length/2-f);if(e.length>u-c&&Math.abs(t)<=o.x){Math.abs(t)<o.x&&(i.length=0),o.x=Math.abs(t);let n={type:`gap`,direction:`center_horizontal`,gap:e,offset:t};i.push(n);continue}let[,,n]=e.endBounds,r=c-n,a=lM(e.length-r);if(Math.abs(a)<=o.x){Math.abs(a)<o.x&&(i.length=0),o.x=Math.abs(a);let t={type:`gap`,direction:`side_right`,gap:e,offset:a};i.push(t);continue}let[s,,,]=e.startBounds,p=lM(s-u-e.length);if(Math.abs(p)<=o.x){Math.abs(p)<o.x&&(i.length=0),o.x=Math.abs(p);let t={type:`gap`,direction:`side_left`,gap:e,offset:p};i.push(t);continue}}for(let e of r){if(!on(ka(c,u),e.overlap))continue;let t=lM(e.startSide[0][1]+e.length/2-p);if(e.length>d-l&&Math.abs(t)<=o.y){Math.abs(t)<o.y&&(a.length=0),o.y=Math.abs(t);let n={type:`gap`,direction:`center_vertical`,gap:e,offset:t};a.push(n);continue}let[,n,,]=e.startBounds,r=lM(n-d-e.length);if(Math.abs(r)<=o.y){Math.abs(r)<o.y&&(a.length=0),o.y=Math.abs(r);let t={type:`gap`,direction:`side_top`,gap:e,offset:r};a.push(t);continue}let[,,,i]=e.endBounds,s=lM(l-i),f=e.length-s;if(Math.abs(f)<=o.y){Math.abs(f)<o.y&&(a.length=0),o.y=Math.abs(f);let t={type:`gap`,direction:`side_bottom`,gap:e,offset:f};a.push(t);continue}}}},oM=(e,t,n,r)=>Gr(rM(e,t,n,r),r).filter(e=>!(e.length===1&&xo(e[0]))).flatMap(e=>nM(e,r)),sM=(e,t,n,r,i,a,o)=>{if(!eM({app:n,event:r,selectedElements:e})||e.length===0&&t.length===0)return[];let s=Qj.getReferenceSnapPoints();if(s)for(let e of t)for(let t of s){let n=t[0]-e[0],r=t[1]-e[1];Math.abs(n)<=o.x&&(Math.abs(n)<o.x&&(i.length=0),i.push({type:`point`,points:[e,t],offset:n}),o.x=Math.abs(n)),Math.abs(r)<=o.y&&(Math.abs(r)<o.y&&(a.length=0),a.push({type:`point`,points:[e,t],offset:r}),o.y=Math.abs(r))}},cM=(e,t,n,r,i)=>{let a=n.state,o=An(e,a);if(!eM({app:n,event:r,selectedElements:o})||o.length===0)return{snapOffset:{x:0,y:0},snapLines:[]};t.x=lM(t.x),t.y=lM(t.y);let s=[],c=[],l=Xj(a.zoom.value),u={x:l,y:l};sM(o,nM(o,i,{dragOffset:t}),n,r,s,c,u),aM(o,t,n,r,s,c,u);let d={x:s[0]?.offset??0,y:c[0]?.offset??0};u.x=0,u.y=0,s.length=0,c.length=0;let f={x:lM(t.x+d.x),y:lM(t.y+d.y)};sM(o,nM(o,i,{dragOffset:f}),n,r,s,c,u),aM(o,f,n,r,s,c,u);let p=dM(s,c),m=pM(o,f,[...s,...c].filter(e=>e.type===`gap`));return{snapOffset:d,snapLines:[...p,...m]}},lM=e=>Math.round(e*10**6)/10**6,uM=e=>{let t=new Map;for(let n of e){let e=n.join(`,`);t.has(e)||t.set(e,n)}return Array.from(t.values())},dM=(e,t)=>{let n={},r={};if(e.length>0){for(let t of e)if(t.type===`point`){let e=lM(t.points[0][0]);n[e]||(n[e]=[]),n[e].push(...t.points.map(e=>a(lM(e[0]),lM(e[1]))))}}if(t.length>0){for(let e of t)if(e.type===`point`){let t=lM(e.points[0][1]);r[t]||(r[t]=[]),r[t].push(...e.points.map(e=>a(lM(e[0]),lM(e[1]))))}}return Object.entries(n).map(([e,t])=>({type:`points`,points:uM(t.map(t=>a(Number(e),t[1])).sort((e,t)=>e[1]-t[1]))})).concat(Object.entries(r).map(([e,t])=>({type:`points`,points:uM(t.map(t=>a(t[0],Number(e))).sort((e,t)=>e[0]-t[0]))})))},fM=e=>{let t=new Map;for(let n of e){let e=n.points.flat().map(e=>[lM(e)]).join(`,`);t.has(e)||t.set(e,n)}return Array.from(t.values())},pM=(e,t,n)=>{let[r,i,o,s]=se(e,t),c=[];for(let e of n){let[t,n,l,u]=e.gap.startBounds,[d,f,p,m]=e.gap.endBounds,h=C(ka(i,s),e.gap.overlap),g=C(ka(r,o),e.gap.overlap);switch(e.direction){case`center_horizontal`:if(h){let t=(h[0]+h[1])/2;c.push({type:`gap`,direction:`horizontal`,points:[a(e.gap.startSide[0][0],t),a(r,t)]},{type:`gap`,direction:`horizontal`,points:[a(o,t),a(e.gap.endSide[0][0],t)]})}break;case`center_vertical`:if(g){let t=(g[0]+g[1])/2;c.push({type:`gap`,direction:`vertical`,points:[a(t,e.gap.startSide[0][1]),a(t,i)]},{type:`gap`,direction:`vertical`,points:[a(t,s),a(t,e.gap.endSide[0][1])]})}break;case`side_right`:if(h){let e=(h[0]+h[1])/2;c.push({type:`gap`,direction:`horizontal`,points:[a(l,e),a(d,e)]},{type:`gap`,direction:`horizontal`,points:[a(p,e),a(r,e)]})}break;case`side_left`:if(h){let e=(h[0]+h[1])/2;c.push({type:`gap`,direction:`horizontal`,points:[a(o,e),a(t,e)]},{type:`gap`,direction:`horizontal`,points:[a(l,e),a(d,e)]})}break;case`side_top`:if(g){let e=(g[0]+g[1])/2;c.push({type:`gap`,direction:`vertical`,points:[a(e,s),a(e,n)]},{type:`gap`,direction:`vertical`,points:[a(e,u),a(e,f)]})}break;case`side_bottom`:if(g){let e=(g[0]+g[1])/2;c.push({type:`gap`,direction:`vertical`,points:[a(e,u),a(e,f)]},{type:`gap`,direction:`vertical`,points:[a(e,m),a(e,i)]})}break}}return fM(c.map(e=>({...e,points:e.points.map(e=>a(lM(e[0]),lM(e[1])))})))},mM=(e,t,n,r,i,o)=>{if(!eM({event:r,selectedElements:e,app:n})||e.length===0||e.length===1&&!tM(e[0].angle,0))return{snapOffset:{x:0,y:0},snapLines:[]};let[s,c,l,u]=He(t);o&&(o.includes(`e`)?l+=i.x:o.includes(`w`)&&(s+=i.x),o.includes(`n`)?c+=i.y:o.includes(`s`)&&(u+=i.y));let d=[];if(o)switch(o){case`e`:d.push(a(l,c),a(l,u));break;case`w`:d.push(a(s,c),a(s,u));break;case`n`:d.push(a(s,c),a(l,c));break;case`s`:d.push(a(s,u),a(l,u));break;case`ne`:d.push(a(l,c));break;case`nw`:d.push(a(s,c));break;case`se`:d.push(a(l,u));break;case`sw`:d.push(a(s,u));break}let f=Xj(n.state.zoom.value),p={x:f,y:f},m=[],h=[];sM(t,d,n,r,m,h,p);let g={x:m[0]?.offset??0,y:h[0]?.offset??0};p.x=0,p.y=0,m.length=0,h.length=0;let[_,v,y,b]=He(e).map(e=>lM(e));return sM(e,[a(_,v),a(_,b),a(y,v),a(y,b)],n,r,m,h,p),{snapOffset:g,snapLines:dM(m,h)}},hM=(e,t,n,r,i,o)=>{if(!eM({event:n,selectedElements:[e],app:t}))return{snapOffset:{x:0,y:0},snapLines:[]};let s=[a(r.x+i.x,r.y+i.y)],c=Xj(t.state.zoom.value),l={x:c,y:c},u=[],d=[];sM([e],s,t,n,u,d,l);let f={x:u[0]?.offset??0,y:d[0]?.offset??0};l.x=0,l.y=0,u.length=0,d.length=0;let p=nM([e],o,{boundingBoxCorners:!0,omitCenter:!0});return sM([e],p,t,n,u,d,l),{snapOffset:f,snapLines:dM(u,d)}},gM=(e,t,n,r,i)=>{if(!eM({event:r,selectedElements:[],app:t}))return{originOffset:{x:0,y:0},snapLines:[]};let o=ec(e,[],t.state,i),s=Xj(t.state.zoom.value),c={x:s,y:s},l=[],u=[];for(let e of o){let t=nM([e],i);for(let e of t){let t=e[0]-n.x;Math.abs(t)<=Math.abs(c.x)&&(Math.abs(t)<Math.abs(c.x)&&(u.length=0),u.push({type:`pointer`,points:[e,a(e[0],n.y)],direction:`vertical`}),c.x=t);let r=e[1]-n.y;Math.abs(r)<=Math.abs(c.y)&&(Math.abs(r)<Math.abs(c.y)&&(l.length=0),l.push({type:`pointer`,points:[e,a(n.x,e[1])],direction:`horizontal`}),c.y=r)}}return{originOffset:{x:u.length>0?u[0].points[0][0]-n.x:0,y:l.length>0?l[0].points[0][1]-n.y:0},snapLines:[...u,...l]}},_M=e=>e===es.rectangle||e===es.ellipse||e===es.diamond||e===es.frame||e===es.magicframe||e===es.image||e===es.text,vM=class{constructor(e){z(this,`scene`),z(this,`_getRenderableElements`,tt(({canvasNonce:e,zoom:t,offsetLeft:n,offsetTop:r,scrollX:i,scrollY:a,height:o,width:s,editingTextElement:c,newElement:l})=>{let u=this.scene.getNonDeletedElements(),{elementsMap:d,newElementCanvasElement:f}=this.getRenderableElementsMap({elements:u,editingTextElement:c,newElement:l});return{elementsMap:d,visibleElements:this.getVisibleCanvasElements({elementsMap:d,zoom:t,offsetLeft:n,offsetTop:r,scrollX:i,scrollY:a,height:o,width:s}),newElementCanvasElement:f,canvasNonce:e}})),z(this,`getRenderableElements`,e=>{let{newElement:t}=e,n=`${this.scene.getSceneNonce()}${t?.frameId?`:${t.versionNonce}`:``}`,r=this._getRenderableElements({canvasNonce:n,zoom:e.zoom,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,scrollX:e.scrollX,scrollY:e.scrollY,height:e.height,width:e.width,editingTextElement:e.editingTextElement,newElement:e.newElement});if(e.frameToHighlight&&e.selectedElementsAreBeingDragged&&st(e.selectedElements)!==e.frameToHighlight.id){let t=this.sortSelectedElementsIntoHighlightedFrame({visibleElements:r.visibleElements,selectedElements:e.selectedElements,frameToHighlight:e.frameToHighlight});return{...r,visibleElements:t}}return r}),this.scene=e}getVisibleCanvasElements({elementsMap:e,zoom:t,offsetLeft:n,offsetTop:r,scrollX:i,scrollY:a,height:o,width:s}){let c=[];for(let l of e.values())Oa(l,s,o,{zoom:t,offsetLeft:n,offsetTop:r,scrollX:i,scrollY:a},e)&&c.push(l);return c}getRenderableElementsMap({elements:e,editingTextElement:t,newElement:n}){let r=ze(new Map),i=n?.frameId?null:n;for(let n of e)i?.id!==n.id&&(!t||t.type!==`text`||n.id!==t.id)&&r.set(n.id,n);return{elementsMap:r,newElementCanvasElement:i}}sortSelectedElementsIntoHighlightedFrame({visibleElements:e,selectedElements:t,frameToHighlight:n}){if(!t.length)return e;let r=Pa(t),i=e.filter(e=>!r.has(e.id)),a=rr(i,n.id);return a===null?e:[...i.slice(0,a),...t,...i.slice(a)]}destroy(){Yn.cancel(),this._getRenderableElements.clear()}},yM=5,bM=(e,t,n)=>{let[r,i]=Zi(e,n),{x:a,y:o}=Qi({sceneX:r+e.width,sceneY:i},t);return{x:a-t.offsetLeft+10,y:o-t.offsetTop}},xM=({children:e,element:t,elementsMap:n})=>{let r=nB();if(r.contextMenu||r.newElement||r.resizingElement||r.isRotating||r.openMenu||r.viewModeEnabled)return null;let{x:i,y:a}=bM(t,r,n);return(0,V.jsx)(`div`,{className:`excalidraw-canvas-buttons`,style:{top:`${a}px`,left:`${i}px`,padding:yM},children:e})},SM=class e{constructor(t,n){this.app=t,this.options=n,z(this,`currentTrail`),z(this,`pastTrails`,[]),z(this,`container`),z(this,`trailElement`),z(this,`trailAnimation`),z(this,`key`),this.key=`animated-trail-${e.counter++}`,this.trailElement=document.createElementNS(at,`path`),this.options.animateTrail&&(this.trailAnimation=document.createElementNS(`http://www.w3.org/2000/svg`,`animate`),this.trailAnimation.setAttribute(`attributeName`,`stroke-dashoffset`),this.trailElement.setAttribute(`stroke-dasharray`,`7 7`),this.trailElement.setAttribute(`stroke-dashoffset`,`10`),this.trailAnimation.setAttribute(`from`,`0`),this.trailAnimation.setAttribute(`to`,`-14`),this.trailAnimation.setAttribute(`dur`,`0.3s`),this.trailElement.appendChild(this.trailAnimation))}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}cleanup(){this.pastTrails=[],this.currentTrail=void 0,this.trailElement.parentNode===this.container&&this.container?.removeChild(this.trailElement)}start(e){e&&(this.container=e),this.trailElement.parentNode!==this.container&&this.container&&this.container.appendChild(this.trailElement),Xe.running(this.key)||Xe.start(this.key,()=>this.onFrame()?{keep:!0}:(this.cleanup(),null))}stop(){Xe.cancel(this.key),this.cleanup()}startPath(e,t){this.currentTrail=new bA(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())}getCurrentTrail(){return this.currentTrail}clearTrails(){this.pastTrails=[],this.currentTrail=void 0,this.update()}update(){this.start(),this.trailAnimation&&(this.trailAnimation.setAttribute(`begin`,`indefinite`),this.trailAnimation.setAttribute(`repeatCount`,`indefinite`))}onFrame(){let e=[];for(let t of this.pastTrails)e.push(this.drawTrail(t,this.app.state));if(this.currentTrail){let t=this.drawTrail(this.currentTrail,this.app.state);e.push(t)}if(this.pastTrails=this.pastTrails.filter(e=>e.getStrokeOutline(e.options.size/this.app.state.zoom.value).length!==0),e.length===0)return this.trailElement.setAttribute(`d`,``),!1;let t=e.join(` `).trim();return this.trailElement.setAttribute(`d`,t),this.trailAnimation?(this.trailElement.setAttribute(`fill`,(this.options.fill??(()=>`black`))(this)),this.trailElement.setAttribute(`stroke`,(this.options.stroke??(()=>`black`))(this))):this.trailElement.setAttribute(`fill`,(this.options.fill??(()=>`black`))(this)),!0}drawTrail(e,t){let n=e.getStrokeOutline(e.options.size/t.zoom.value).map(([e,n])=>{let r=Qi({sceneX:e,sceneY:n},t);return[r.x,r.y]});return Et(this.trailAnimation?n.slice(0,n.length/2):n,!0)}};z(SM,`counter`,0);var CM=SM,wM=class{constructor(e){this.app=e,z(this,`localTrail`),z(this,`collabTrails`,new Map),z(this,`container`),this.localTrail=new CM(e,{...this.getTrailOptions(),fill:()=>`red`})}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(Zr(n),Zr(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.localTrail.start(e)}stop(){this.localTrail.stop(),this.stopCollabTrails(),this.container=void 0}stopCollabTrails(e){for(let[t,n]of this.collabTrails)e?.get(t)||(n.stop(),this.collabTrails.delete(t))}updateCollabTrails(e){if(this.stopCollabTrails(e),!(!this.container||e.size===0))for(let[t,n]of e.entries()){if(n.isCurrentUser)continue;let e=this.collabTrails.get(t);if(e||(e=new CM(this.app,{...this.getTrailOptions(),fill:()=>n.pointer?.laserColor||xE(t,n)}),e.start(this.container),this.collabTrails.set(t,e)),n.pointer&&n.pointer.tool===`laser`){let t=n.button===`down`,r=n.button===`up`,i=e.hasCurrentTrail;t&&!i&&e.startPath(n.pointer.x,n.pointer.y);let a=!e.hasLastPoint(n.pointer.x,n.pointer.y);t&&a&&e.addPointToPath(n.pointer.x,n.pointer.y),r&&i&&(e.addPointToPath(n.pointer.x,n.pointer.y),e.endPath())}}}},TM=12,EM=16,DM=10,OM=EM+2,kM=.8,AM=e=>4/e,jM=(e,t,n)=>{if(n!==`desktop`||EM>e.height*t*kM)return null;let r=AM(t),i=TM/t,o=EM/t,s=a(e.x+e.width/2,e.y+e.height/2),c=ot(a(s[0]+e.width/2+r+i,s[1]),s,e.angle);return{center:c,start:ot(a(c[0],c[1]-o/2),c,e.angle),end:ot(a(c[0],c[1]+o/2),c,e.angle),hitboxWidth:DM/t,hitboxHeight:OM/t}},MM=(e,t,n,r)=>{let i=jM(t,n,r);if(!i)return!1;let o=ot(a(e.x,e.y),i.center,-t.angle);return Math.abs(o[0]-i.center[0])<=i.hitboxWidth/2&&Math.abs(o[1]-i.center[1])<=i.hitboxHeight/2},NM=(e,t,n,r,i,a)=>{let{zoom:o}=r,s=180*n/Math.PI,c=e*(o.value-1)/2,l=t*(o.value-1)/2;return e>i&&o.value!==1&&(c=i*(o.value-1)/2),t>a&&o.value!==1&&(l=a*(o.value-1)/2),`translate(${c}px, ${l}px) scale(${o.value}) rotate(${s}deg)`},PM=(e,t)=>{let n=e.lastIndexOf(`
54
+ `,Math.max(0,t-1))+1,r=e.indexOf(`
55
+ `,t);return Gn(e.slice(n,r===-1?e.length:r))?`rtl`:`ltr`},FM=e=>{let t=[0],n=0;for(let r of Array.from(e))n+=r.length,t.push(n);return t},IM=({text:e,font:t,lineHeightPx:n,direction:r,targetX:i})=>{if(!e||!document.body||typeof document.createRange!=`function`)return null;let a=FM(e),o=document.createElement(`div`),s=document.createTextNode(e),c=document.createRange(),l=[];o.dir=r,Object.assign(o.style,{position:`fixed`,top:`0`,left:`0`,margin:0,padding:0,border:0,opacity:`0`,pointerEvents:`none`,whiteSpace:`pre`,font:t,lineHeight:`${n}px`}),o.append(s),document.body.append(o);try{for(let e of a){c.setStart(s,e),c.setEnd(s,e);let t=c.getBoundingClientRect();if(!Number.isFinite(t.left))return null;l.push(t.left)}}catch{return null}finally{o.remove()}let u=Math.min(...l),d=a[0],f=1/0;for(let e=0;e<a.length;e++){let t=Math.abs(l[e]-u-i);t<f&&(f=t,d=a[e])}return d},LM=({onChange:e,onSubmit:t,getViewportCoords:n,element:r,canvas:i,excalidrawContainer:o,app:s,autoSelect:c=!0,initialCaretSceneCoords:l=null})=>{let u=null,f=(e,t)=>{if(!t.style.fontFamily||!t.style.fontSize)return!1;let n=t.style.fontFamily.replace(/"/g,``);return br({fontFamily:e.fontFamily})!==n||`${e.fontSize}px`!==t.style.fontSize},p=s.state.theme,m=()=>{p=s.state.theme;let e=s.state,t=s.scene.getElement(r.id);if(!t)return;let{textAlign:i,verticalAlign:a}=t,o=s.scene.getNonDeletedElementsMap();if(t&&R(t)){let r=t.x,c=t.y,l=rt(t,s.scene.getNonDeletedElementsMap()),d=t.width,p=t.height,m=t.width,g=t.height;if(l&&t.containerId){if(Mr(l)){let e=I.getBoundTextElementPosition(l,t,o);r=e.x,c=e.y}let e=f(t,h),n;if(e?n=$o(l.id,l.height):(n=Wn[l.id],n||=$o(l.id,l.height)),m=Ko(l,t),g=En(l,t),!Mr(l)&&p>g){let e=T(p,l.type);s.scene.mutateElement(l,{height:e}),Rs(l,s.scene);return}else if(!Mr(l)&&l.height>n.height&&p<g){let e=T(p,l.type);s.scene.mutateElement(l,{height:e}),Rs(l,s.scene)}else{let{x:e,y:n}=Ir(l,t,o);r=e,c=n}}let[_,v]=n(r,c);l?d+=.5:(m=(e.width-8-_)/e.zoom.value,d=Math.min(d,m)),p*=1.05;let y=Ho(t),b=Na(t,l),x=(e.height-v)/e.zoom.value;Object.assign(h.style,{font:y,lineHeight:t.lineHeight,width:`${d}px`,height:`${p}px`,left:`${_}px`,top:`${v}px`,transform:NM(d,p,b,e,m,x),textAlign:i,verticalAlign:a,color:$t(t.strokeColor,e.theme===F.DARK),opacity:t.opacity/100,maxHeight:`${x}px`}),u={angle:b,font:y,height:t.height,lineHeightPx:Ba(t.fontSize,t.lineHeight),textAlign:i,width:t.width,x:r,y:c},h.scrollTop=0,Xt()&&(h.style.fontFamily=br(t)),s.scene.mutateElement(t,{x:r,y:c})}},h=document.createElement(`textarea`);h.dir=`auto`,h.tabIndex=0,h.dataset.type=`wysiwyg`,h.wrap=`off`,h.classList.add(`excalidraw-wysiwyg`);let g=`pre`,_=`normal`;(xo(r)||!r.autoResize)&&(g=`pre-wrap`,_=`break-word`),Object.assign(h.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:_,whiteSpace:g,overflowWrap:`break-word`,boxSizing:`content-box`}),h.value=r.originalText,m();let v=()=>{if(!l||!u)return null;let e=u,t=a(e.x+e.width/2,e.y+e.height/2),[n,r]=ot(a(l.x,l.y),t,-e.angle),i=n-e.x,o=r-e.y,s=kt(h.value,e.font,g===`pre-wrap`?e.width:1/0),c=s[Math.max(0,Math.min(s.length-1,Math.floor(o/e.lineHeightPx)))],d=PM(h.value,c.start),f=Es(c.text,e.font),p=i-(e.textAlign===`center`?(e.width-f)/2:e.textAlign===`right`?e.width-f:0);if(!c.text)return c.start;let m=IM({text:c.text,font:e.font,lineHeightPx:e.lineHeightPx,direction:d,targetX:p});return c.start+(m||0)},y=(()=>{let e=v();return e===null?null:{start:e,end:e}})();e&&(h.onpaste=async e=>{let t=UT(e),n=null;if(t.has(Se.excalidrawClipboard)||t.has(Se.excalidraw)){e.preventDefault(),n=await WT(e);try{let e=await GT(n);if(e.elements){let t=zn(e.elements);if(t){let{selectionStart:e,selectionEnd:n,value:r}=h;h.value=r.slice(0,e)+t+r.slice(n);let i=e+t.length;h.selectionStart=h.selectionEnd=i,h.dispatchEvent(new Event(`input`))}}return}catch{console.warn(`failed to parse excalidraw clipboard data`)}}n||=await WT(e);let i=n.findByType(Se.text);if(!i)return;let a=de(i.value);if(!a)return;let o=rt(r,s.scene.getNonDeletedElementsMap()),c=Ho({fontSize:s.state.currentItemFontSize,fontFamily:s.state.currentItemFontFamily});if(o){let e=So(o,s.scene.getNonDeletedElementsMap()),t=qr(Pn(`${h.value}${a}`,c,Ko(o,e)),c);h.style.width=`${t}px`}},h.oninput=()=>{let t=de(h.value);if(h.value!==t){let e=h.selectionStart;h.value=t,h.selectionStart=e,h.selectionEnd=e}e(h.value)}),h.onkeydown=e=>{if(!e.shiftKey&&zw.keyTest(e))e.preventDefault(),s.actionManager.executeAction(zw),m();else if(!e.shiftKey&&Bw.keyTest(e))e.preventDefault(),s.actionManager.executeAction(Bw),m();else if(!e.shiftKey&&Vw.keyTest(e))e.preventDefault(),s.actionManager.executeAction(Vw),m();else if(Dw.keyTest(e))s.actionManager.executeAction(Dw);else if(Ow.keyTest(e))s.actionManager.executeAction(Ow);else if(e.key===M.ESCAPE)e.preventDefault(),D=!0,O();else if(sE.keyTest(e))e.preventDefault(),O(),s.actionManager.executeAction(sE);else if(e.key===M.ENTER&&e[M.CTRL_OR_CMD]){if(e.preventDefault(),e.isComposing||e.keyCode===229)return;D=!0,O()}else if(e.key===M.TAB||e[M.CTRL_OR_CMD]&&(e.code===vr.BRACKET_LEFT||e.code===vr.BRACKET_RIGHT)){if(e.preventDefault(),e.isComposing)return;e.shiftKey||e.code===vr.BRACKET_LEFT?C():S(),h.dispatchEvent(new Event(`input`))}};let b=` `.repeat(4),x=RegExp(`^ {1,4}`),S=()=>{let{selectionStart:e,selectionEnd:t}=h,n=w(),r=h.value;n.forEach(e=>{let t=r.slice(0,e),n=r.slice(e);r=`${t}${b}${n}`}),h.value=r,h.selectionStart=e+4,h.selectionEnd=t+4*n.length},C=()=>{let{selectionStart:e,selectionEnd:t}=h,n=w(),r=[],i=h.value;n.forEach(e=>{let t=i.slice(e,e+4).match(x);t&&(i=`${i.slice(0,e)}${i.slice(e+t[0].length)}`,r.push(e))}),h.value=i,r.length&&(e>r[r.length-1]?h.selectionStart=Math.max(e-4,r[r.length-1]):h.selectionStart=e,h.selectionEnd=Math.max(h.selectionStart,t-4*r.length))},w=()=>{let{selectionStart:e,selectionEnd:t,value:n}=h,r=n.slice(0,e).match(/[^\n]*$/)[0].length;return e-=r,n.slice(e,t).split(`
56
+ `).reduce((t,n,r,i)=>t.concat(r?t[r-1]+i[r-1].length+1:e),[]).reverse()},E=e=>{e.target instanceof HTMLCanvasElement&&(e.preventDefault(),e.stopPropagation())},D=!1,O=()=>{if(oe)return;oe=!0,ee();let e=s.scene.getElement(r.id);if(!e)return;let n=rt(e,s.scene.getNonDeletedElementsMap());if(n){if(h.value.trim()){let e=ae(n);!e||e!==r.id?s.scene.mutateElement(n,{boundElements:(n.boundElements||[]).concat({type:`text`,id:r.id})}):Mr(n)&&d(n)}else s.scene.mutateElement(n,{boundElements:n.boundElements?.filter(e=>!R(e))});Fn(e,n,s.scene)}t({viaKeyboard:D,nextOriginalText:h.value})},ee=()=>{h.onblur=null,h.oninput=null,h.onkeydown=null,se&&se.disconnect(),window.removeEventListener(`resize`,m),window.removeEventListener(`wheel`,E,!0),window.removeEventListener(`pointerdown`,te),window.removeEventListener(`pointerup`,k),window.removeEventListener(`blur`,O),window.removeEventListener(`beforeunload`,O),re(),ne(),ie(),h.remove()},k=e=>{window.removeEventListener(`pointerup`,k);let t=e?.target,n=t instanceof HTMLElement&&t.classList.contains(`properties-trigger`),r=(t instanceof HTMLElement||t instanceof SVGElement)&&!!t.closest(`.properties-content`),i=(t instanceof HTMLElement||t instanceof SVGElement)&&(!!t.closest(`.${sa.SHAPE_ACTIONS_MENU}`)||!!t.closest(`.compact-shape-actions-island`));setTimeout(()=>{i||n||r||(h.onblur=O,h.focus(),y&&=(h.setSelectionRange(y.start,y.end),null))})},A=()=>{h.onblur=null,window.addEventListener(`pointerup`,k),window.addEventListener(`blur`,O)},te=e=>{let t=e?.target;if(e.button===qi.WHEEL){t instanceof HTMLTextAreaElement&&(e.preventDefault(),s.handleCanvasPanUsingWheelOrSpaceDrag(e)),A();return}let n=t instanceof HTMLElement&&t.classList.contains(`properties-trigger`),r=(t instanceof HTMLElement||t instanceof SVGElement)&&!!t.closest(`.properties-content`);(e.target instanceof HTMLElement||e.target instanceof SVGElement)&&(e.target.closest(`.${sa.SHAPE_ACTIONS_MENU}, .${sa.ZOOM_ACTIONS}`)||e.target.closest(`.compact-shape-actions-island`))&&!wi(e.target)||n||r?A():e.target instanceof HTMLCanvasElement&&!Xt()&&requestAnimationFrame(()=>{O()})},ne=s.onChangeEmitter.on(e=>{s.state.theme!==p&&m()}),re=s.scene.onUpdate(()=>{m(),document.activeElement?.closest(`.properties-content`)||h.focus()}),ie=s.onScrollChangeEmitter.on(()=>{m()}),oe=!1;c&&!y&&h.select(),k();let se=null;return i&&`ResizeObserver`in window?(se=new window.ResizeObserver(()=>{m()}),se.observe(i)):window.addEventListener(`resize`,m),h.onpointerdown=e=>e.stopPropagation(),requestAnimationFrame(()=>{window.addEventListener(`pointerdown`,te,{capture:!0})}),window.addEventListener(`beforeunload`,O),o?.querySelector(`.excalidraw-textEditorContainer`).appendChild(h),O},RM=4,zM=6,BM=`rgba(0,0,0,0.3)`,VM=(e,t,n,r)=>{if(!e.size)return{horizontal:null,vertical:null};let[i,a,o,s]=He(e),c=t/r.zoom.value,l=n/r.zoom.value,u={top:parseInt(Ke(`sat`))||0,bottom:parseInt(Ke(`sab`))||0,left:parseInt(Ke(`sal`))||0,right:parseInt(Ke(`sar`))||0},d=Sy().rtl,f=-r.scrollX+u.left,p=-r.scrollY+u.top,m=f+c-u.right,h=p+l-u.bottom,g=Math.min(i,f),_=Math.min(a,p),v=Math.max(o,m),y=Math.max(s,h),b=o-i,x=s-a,S=v-g,C=y-_,w=Math.max(RM*2,u.left+u.right)+zM*2,T=c/S*t-w,E=Math.max(RM*2,u.top+u.bottom)+zM*2,D=l/C*n-E,O=S>b?S*r.zoom.value/(T+w):t/(T+w),ee=C>x?C*r.zoom.value/(D+E):n/(D+E);return{horizontal:f===g&&m===v?null:{x:Math.max(u.left,RM)+zM+(f-g)/S*t,y:n-zM-Math.max(RM,u.bottom),width:T,height:zM,deltaMultiplier:O},vertical:p===_&&h===y?null:{x:d?Math.max(u.left,RM):t-zM-Math.max(u.right,RM),y:Math.max(u.top,RM)+zM+(p-_)/C*n,width:zM,height:D,deltaMultiplier:ee}}},HM=(e,t,n)=>{let[r,i]=[e.horizontal,e.vertical].map(e=>e!=null&&e.x<=t&&t<=e.x+e.width&&e.y<=n&&n<=e.y+e.height);return{isOverEither:r||i,isOverHorizontal:r,isOverVertical:i}},UM=e=>RegExp(`^(?:%%{.*?}%%[\\s\\n]*)?\\b(?:${[`flowchart`,`graph`,`sequenceDiagram`,`classDiagram`,`stateDiagram`,`stateDiagram-v2`,`erDiagram`,`journey`,`gantt`,`pie`,`quadrantChart`,`requirementDiagram`,`gitGraph`,`C4Context`,`mindmap`,`timeline`,`zenuml`,`sankey`,`xychart`,`block`].map(e=>`\\s*${e}(-beta)?`).join(`|`)})\\b`).test(e.trim()),WM=e=>{let{lassoPath:t,elements:n,elementsMap:r,elementsSegments:i,intersectedElements:a,enclosedElements:o,simplifyDistance:s}=e,c=t;s&&(c=Sv(t,s));let l=n.filter(e=>!e.locked);o.clear(),a.clear();let u=t.reduce((e,t)=>[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[2],t[0]),Math.max(e[3],t[1])],[1/0,1/0,-1/0,-1/0]);for(let e of l)is(u,un(e,r))&&!a.has(e.id)&&!o.has(e.id)&&(GM(c,e,i)?o.add(e.id):KM(c,e,r)&&a.add(e.id));return{selectedElementIds:[...a,...o]}},GM=(e,t,n)=>{let r=or(e),i=n.get(t.id);return i?i.some(e=>e.some(e=>wn(e,r))):!1},KM=(e,t,n)=>{let r=e.slice(1).map((t,n)=>Mt(e[n],t)).concat([Mt(e[e.length-1],e[0])]),i=So(t,n);return r.some(e=>Ht(t,n,e,0,!0).length>0||!!i&&Ht({...i,...Ir(t,i,n)},n,e,0,!0).length>0)},qM=class extends CM{constructor(e){super(e,{animateTrail:!0,streamline:.4,sizeMapping:e=>{let t=Math.max(0,1-(performance.now()-e.pressure)/(1/0)),n=(5e3-Math.min(5e3,e.totalLength-e.currentIndex))/5e3;return Math.min(Zr(n),Zr(t))},fill:()=>`rgba(105,101,219,0.05)`,stroke:()=>`rgba(105,101,219)`}),z(this,`intersectedElements`,new Set),z(this,`enclosedElements`,new Set),z(this,`elementsSegments`,null),z(this,`canvasTranslate`,null),z(this,`keepPreviousSelection`,!1),z(this,`selectElementsFromIds`,e=>{this.app.setState(t=>{let n=e.reduce((e,t)=>(e[t]=!0,e),{});if(this.keepPreviousSelection)for(let e of Object.keys(t.selectedElementIds))n[e]=!0;for(let[e]of Object.entries(n)){let t=this.app.scene.getNonDeletedElement(e);if(t&&R(t)){let e=rt(t,this.app.scene.getNonDeletedElementsMap());e&&(n[e.id]=!0,delete n[t.id])}}for(let[e]of Object.entries(n)){let t=this.app.scene.getNonDeletedElement(e);if(t&&N(t)){let e=D(this.app.scene.getNonDeletedElementsMap(),t.id);for(let t of e)delete n[t.id]}}let r=tr({editingGroupId:t.editingGroupId,selectedElementIds:n},this.app.scene.getNonDeletedElements(),t,this.app),i=[...Object.keys(r.selectedElementIds)],a=[...Object.keys(r.selectedGroupIds)];return{selectedElementIds:r.selectedElementIds,selectedGroupIds:r.selectedGroupIds,selectedLinearElement:i.length===1&&!a.length&&ja(this.app.scene.getNonDeletedElement(i[0]))?new I(this.app.scene.getNonDeletedElement(i[0]),this.app.scene.getNonDeletedElementsMap()):null}})}),z(this,`addPointToPath`,(e,t,n=!1)=>{super.addPointToPath(e,t),this.keepPreviousSelection=n,this.updateSelection()}),z(this,`updateSelection`,()=>{let e=super.getCurrentTrail()?.originalPoints?.map(e=>a(e[0],e[1])),t={scrollX:this.app.state.scrollX,scrollY:this.app.state.scrollY,zoom:this.app.state.zoom.value};if(!this.elementsSegments||!Jr(t,this.canvasTranslate??{})){this.canvasTranslate=t,this.elementsSegments=new Map;let e=Pa(this.app.visibleElements);for(let t of this.app.visibleElements){let n=g(t,e);this.elementsSegments.set(t.id,n)}}if(e){let{selectedElementIds:t}=WM({lassoPath:e,elements:this.app.visibleElements,elementsMap:this.app.scene.getNonDeletedElementsMap(),elementsSegments:this.elementsSegments,intersectedElements:this.intersectedElements,enclosedElements:this.enclosedElements,simplifyDistance:5/this.app.state.zoom.value});this.selectElementsFromIds(t)}})}startPath(e,t,n=!1){this.endPath(),super.startPath(e,t),this.intersectedElements.clear(),this.enclosedElements.clear(),this.keepPreviousSelection=n,this.keepPreviousSelection||this.app.setState({selectedElementIds:{},selectedGroupIds:{},selectedLinearElement:null})}endPath(){super.endPath(),super.clearTrails(),this.intersectedElements.clear(),this.enclosedElements.clear(),this.elementsSegments=null}},JM=class extends CM{constructor(e){super(e,{streamline:.2,size:5,keepHead:!0,sizeMapping:e=>{let t=Math.max(0,1-(performance.now()-e.pressure)/200),n=(10-Math.min(10,e.totalLength-e.currentIndex))/10;return Math.min(Zr(n),Zr(t))},fill:()=>e.state.theme===F.LIGHT?`rgba(0, 0, 0, 0.2)`:`rgba(255, 255, 255, 0.2)`}),z(this,`elementsToErase`,new Set),z(this,`groupsToErase`,new Set)}startPath(e,t){this.endPath(),super.startPath(e,t),this.elementsToErase.clear()}addPointToPath(e,t,n=!1){return super.addPointToPath(e,t),this.updateElementsToBeErased(n)}updateElementsToBeErased(e){let t=super.getCurrentTrail()?.originalPoints?.map(e=>a(e[0],e[1]))||[];if(t.length<2)return[];let n=Mt(t[t.length-1],t[t.length-2]),r=this.app.visibleElements.filter(e=>!e.locked),i=Pa(r);for(let t of r)if(e&&this.elementsToErase.has(t.id)){if(YM(n,t,i,this.app.state.zoom.value)){let e=t.groupIds.at(-1);if(this.groupsToErase.has(e)){let t=Tt(this.app.scene.getNonDeletedElementsMap(),e);for(let e of t)this.elementsToErase.delete(e.id);this.groupsToErase.delete(e)}if(xo(t)&&this.elementsToErase.delete(t.containerId),ai(t)){let e=ae(t);e&&this.elementsToErase.delete(e)}this.elementsToErase.delete(t.id)}}else if(!e&&!this.elementsToErase.has(t.id)&&YM(n,t,i,this.app.state.zoom.value)){let e=t.groupIds.at(-1);if(!this.groupsToErase.has(e)){let t=Tt(this.app.scene.getNonDeletedElementsMap(),e);for(let e of t)this.elementsToErase.add(e.id);this.groupsToErase.add(e)}if(ai(t)){let e=ae(t);e&&this.elementsToErase.add(e)}xo(t)&&this.elementsToErase.add(t.containerId),this.elementsToErase.add(t.id)}return Array.from(this.elementsToErase)}endPath(){super.endPath(),super.clearTrails(),this.elementsToErase.clear(),this.groupsToErase.clear()}},YM=(e,t,n,r)=>{let i=e[1],o=qo(t)?15:t.strokeWidth/2,s=[Math.min(e[0][0],e[1][0])-o,Math.min(e[0][1],e[1][1])-o,Math.max(e[0][0],e[1][0])+o,Math.max(e[0][1],e[1][1])+o],c=un(t,n);if(!is(s,[c[0]-o,c[1]-o,c[2]+o,c[3]+o]))return!1;if(ge(t)&&Pi(i,t,n))return!0;if(qo(t)){let i=Ae(t),o=ei(t,i,n),s=Math.max(2.25,5/r);for(let t of o)if(Qe(t,e)<=s)return!0;let c=wr(...i.map(([e,n])=>a(t.x+e,t.y+n)));return!!wn(e[0],c)}let l=So(t,n);if(Mr(t)||mr(t)&&!t.polygon){let i=Math.max(t.strokeWidth,t.strokeWidth*2/r),a=g(t,n);for(let t of a)if(Qe(t,e)<=i)return!0;return!1}return Ht(t,n,e,0,!0).length>0||!!l&&Ht({...l,...Ir(t,l,n)},n,e,0,!0).length>0},XM=44,ZM=22,QM=66,$M=48,eN=14,tN=304,nN=320,rN=5.87,iN=28,aN=4,oN=2,sN=10,cN=10,lN=8,uN=12,dN=256,fN=10,pN=4,mN=uN*2,hN=uN*2,gN=100,_N=140,vN=.35,yN=uN/2,bN=20,xN=uN*2,SN=uN,CN={fillStyle:`hachure`,fontFamily:Kt,fontSize:20,opacity:100,roughness:1,strokeColor:Vs.black,roundness:null,strokeStyle:`solid`,strokeWidth:1,verticalAlign:zs.MIDDLE,locked:!1},wN=vn(4),TN=e=>e.labels?.length??e.series[0]?.values.length??0,EN=(e,t)=>{if(!e)return!1;let n=TN(e);return n<2?!1:t!==`radar`||n>=3},DN=(e,t)=>e+(t<=1?0:Math.min(QM,(t-1)*ZM)),ON=(e,t)=>{if(e===`line`){let e=DN($M,t);return{slotWidth:e,gap:eN,chartHeight:nN,xLabelMaxWidth:e+eN*3+sN}}let n=DN(XM,t);return{slotWidth:n,gap:eN,chartHeight:tN,xLabelMaxWidth:n+eN*3+sN}},kN=(e,t)=>({chartWidth:(t.slotWidth+t.gap)*e.series[0].values.length+t.gap,chartHeight:t.chartHeight+t.gap*2}),AN=()=>({chartWidth:dN+hN*2,chartHeight:dN+hN*2}),jN=(e,t,n)=>{let r=Math.abs(e-t);return Math.min(r,n-r)},MN=(e,t)=>{if(e<=0||wN.length===0)return[];let n=wN.length,r=(t%n+n)%n,i=[r],a=Math.min(e,n),o=new Set(Array.from({length:n},(e,t)=>t).filter(e=>e!==r));for(;i.length<a;){let e=-1,t=-1,r=-1;for(let a of o){let o=i.map(e=>jN(a,e,n)),s=Math.min(...o),c=o.reduce((e,t)=>e+t,0)/o.length;(s>t||s===t&&c>r)&&(e=a,t=s,r=c)}i.push(e),o.delete(e)}return Array.from({length:e},(e,t)=>wN[i[t%i.length]])},NN=e=>{if(wN.length===0)return 0;if(typeof e!=`number`||!Number.isFinite(e))return Math.floor(Math.random()*wN.length);let t=e.toString(),n=0;for(let e=0;e<t.length;e++)n=n*31+t.charCodeAt(e)|0;return Math.abs(n)%wN.length},PN=e=>wN[e],FN=(e,t)=>{let n=e.flatMap(e=>e.values.map(e=>Math.max(0,e))),r=n.filter(e=>e>0),i=Math.max(1,...n),a=r.length>0?Math.min(...r):1,o=e.length===1&&a>0&&i/a>=gN;return{renderSteps:!1,normalize:(e,t)=>{let n=Math.max(0,e);return o?Math.log10(n+1)/Math.log10(i+1):n/i}}},IN=e=>/\s/.test(e.trim()),LN=(e,t,n)=>IN(e)?Pn(e,t,n):e,RN=(e,t,n,r,i,a)=>{let o=Nr.Excalifont,s=pc.sm,c=mo(o),l=Ho({fontFamily:o,fontSize:s}),u=Math.min(_N,i*(e.length>8?.56:.72)),d=Pr(l,c),f=e.map((e,f)=>{let p=t[f],m=Math.max(0,...e.trim().split(/\s+/).filter(Boolean).map(e=>Ja(e,l,c).width)),h=LN(e,l,Math.max(d,u,m)),g=Ja(h,l,c),_=Math.cos(p),v=Math.sin(p),y=_>vN?`left`:_<-vN?`right`:`center`,b=y===`center`?g.width/2:0,x=mN+(Math.abs(_)*b+Math.abs(v)*(g.height/2))+yN,S=n+_*(i+x),C=r+v*(i+x),w=v>vN?uN/3:v<-vN?-uN/3:0;return Br({backgroundColor:a,...CN,text:h,originalText:e,x:S,y:C+w,fontFamily:o,fontSize:s,lineHeight:c,textAlign:y,verticalAlign:`middle`})});return{axisLabels:f,axisLabelTopY:Math.min(...f.map(e=>e.y)),axisLabelBottomY:Math.max(...f.map(e=>e.y+e.height))}},zN=(e,t,n,r,i,a)=>{if(e.length<=1)return[];let o=Nr[`Lilita One`],s=pc.lg,c=mo(o),l=Ho({fontFamily:o,fontSize:s}),u=e.map((e,n)=>{let r=e.title?.trim()||`Series ${n+1}`,i=LN(r,l,dN),a=Ja(i,l,c),o=bN+SN+a.width;return{label:r,displayLabel:i,color:t[n],width:o,height:a.height}}),d=Math.max(bN/2,...u.map(e=>e.height/2)),f=Math.max(i,r+d+mN),p=xN,m=bN*.6,h=u.reduce((e,t)=>e+t.width,0)+xN*Math.max(0,u.length-1),g=h+p*2,_=d*2+m*2,v=[];v.push(fc({...CN,backgroundColor:`transparent`,type:`rectangle`,fillStyle:`solid`,strokeColor:Vs.black,x:n-g/2,y:f-_/2,width:g,height:_,roughness:Ya.architect,roundness:{type:Go.PROPORTIONAL_RADIUS}}));let y=n-h/2;return u.forEach(e=>{v.push(fc({...CN,backgroundColor:e.color,type:`rectangle`,x:y,y:f-bN/2,width:bN,height:bN,fillStyle:`solid`,strokeColor:e.color,roughness:Ya.architect,roundness:{type:Go.PROPORTIONAL_RADIUS}})),v.push(Br({...CN,text:e.displayLabel,originalText:e.label,autoResize:!1,x:y+bN+SN,y:f,fontFamily:o,fontSize:s,lineHeight:c,textAlign:`left`,verticalAlign:`middle`})),y+=e.width+xN}),v},BN=(e,t,n,r)=>{if(Ja(e,n,r).width<=t)return e;let i=e.length;for(;i>1;){let a=`${e.slice(0,i)}...`;if(Ja(a,n,r).width<=t)return a;i--}return e[0]?`${e[0]}...`:e},VN=(e,t,n,r)=>{if(Ja(e,n,r).width<=t)return{wrapped:!1,text:e};let i=e.trim().split(/\s+/).filter(Boolean);return i.length>1&&!i.some(e=>Ja(e,n,r).width>t)&&t>=Pr(n,r)?{wrapped:!0,text:Pn(e,n,t)}:{wrapped:!1,text:BN(e,t,n,r)}},HN=(e,t,n)=>{let r=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n));return{width:e*r+t*i,height:e*i+t*r}},UN=e=>e.includes(`...`),WN=(e,t,n,r,i)=>{let a=Math.max(iN,Math.ceil(Pr(r,i))),o=Math.max(a,Math.floor(t)),s=[];for(let e=o;e>=a;e-=4)s.push(e);s[s.length-1]!==a&&s.push(a);let c=e=>({ellipsified:UN(e.text),visibleChars:e.text.replace(/\.\.\./g,``).replace(/\n/g,``).length,lineCount:e.text.split(`
57
+ `).length}),l=(e,t)=>{let n=c(e),r=c(t);return n.ellipsified===r.ellipsified?n.visibleChars===r.visibleChars?n.lineCount===r.lineCount?e.rotatedHeight<t.rotatedHeight:n.lineCount<r.lineCount:n.visibleChars>r.visibleChars:!n.ellipsified},u=null,d=null,f=null;for(let t of s){let{wrapped:a,text:o}=VN(e,t,r,i),s=Ja(o,r,i),c=HN(s.width,s.height,rN),p={originalText:e,text:o,metrics:s,rotatedWidth:c.width,rotatedHeight:c.height,wrapped:a},m=c.width-n;if(m<=0){(!u||l(p,u))&&(u=p);continue}(!d||m<d.overflow||m===d.overflow&&l(p,d.spec))&&(d={overflow:m,spec:p}),!UN(p.text)&&(!f||m<f.overflow||m===f.overflow&&l(p,f.spec))&&(f={overflow:m,spec:p})}return u||(f&&d&&f.overflow<=d.overflow+lN?f.spec:d.spec)},GN=e=>{if(e.type!==`text`)return e.y+e.height;let t=HN(e.width,e.height,e.angle);return e.y+e.height/2+t.height/2},KN=(e,t,n,r,i)=>{let a=CN.fontFamily,o=pc.sm,s=mo(a),c=Ho({fontFamily:a,fontSize:o}),l=Math.max(1,i.slotWidth+i.gap-aN*2+cN),u=n;return e.labels?.map((e,n)=>{let a=WN(e,i.xLabelMaxWidth,l,c,s),d=t+n*(i.slotWidth+i.gap)+i.gap+i.slotWidth/2,f=u+oN+(a.rotatedHeight-a.metrics.height)/2;return Br({backgroundColor:r,...CN,text:a.text,originalText:a.wrapped?e:a.text,autoResize:!a.wrapped,x:d,y:f,angle:rN,fontSize:o,lineHeight:s,textAlign:`center`,verticalAlign:`top`})})||[]},qN=(e,t,n,r,i,a=Math.max(...e.series[0].values))=>{let o=Br({backgroundColor:r,...CN,x:t-i.gap,y:n-i.gap,text:`0`,textAlign:`right`});return[o,Br({backgroundColor:r,...CN,x:t-i.gap,y:n-i.chartHeight-o.height/2,text:a.toLocaleString(),textAlign:`right`})]},JN=(e,t,n,r,i)=>{let{chartWidth:o,chartHeight:s}=kN(e,i);return[A({backgroundColor:r,...CN,type:`line`,x:t,y:n,width:o,points:[a(0,0),a(o,0)]}),A({backgroundColor:r,...CN,type:`line`,x:t,y:n,height:s,points:[a(0,0),a(0,-s)]}),A({backgroundColor:r,...CN,type:`line`,x:t,y:n-i.chartHeight-i.gap,strokeStyle:`dotted`,width:o,opacity:fN,points:[a(0,0),a(o,0)]})]},YN=(e,t,n,r,i,a=Math.max(...e.series[0].values),o)=>{let{chartWidth:s,chartHeight:c}=kN(e,i),l=e.title?Br({backgroundColor:r,...CN,text:e.title,x:t+s/2,y:n-i.chartHeight-i.gap*2-20,roundness:null,textAlign:`center`,fontSize:pc.xl,fontFamily:Nr[`Lilita One`]}):null,u=o?fc({backgroundColor:r,...CN,type:`rectangle`,x:t,y:n-c,width:s,height:c,strokeColor:Vs.black,fillStyle:`solid`,opacity:6}):null;return[...u?[u]:[],...l?[l]:[],...KN(e,t,n,r,i),...qN(e,t,n,r,i,a),...JN(e,t,n,r,i)]},XN=(e,t,n,r)=>{let i=e.series,a=ON(`bar`,i.length),o=Math.max(1,...i.flatMap(e=>e.values.map(e=>Math.max(0,e)))),s=NN(r),c=PN(s),l=MN(i.length,s),u=i.length>1?Math.max(1,Math.floor(a.gap/(i.length+1))):0,d=i.length>1?Math.max(2,(a.slotWidth-u*(i.length-1))/i.length):a.slotWidth,f=i.length*d+u*(i.length-1),p=(a.slotWidth-f)/2,m=i[0].values.flatMap((e,r)=>i.map((e,s)=>{let f=Math.max(0,e.values[r]??0)/o*a.chartHeight,m=i.length>1?l[s]:c;return fc({backgroundColor:m,...CN,type:`rectangle`,fillStyle:i.length>1?`solid`:CN.fillStyle,strokeColor:i.length>1?m:CN.strokeColor,x:t+r*(a.slotWidth+a.gap)+a.gap+p+s*(d+u),y:n-f-a.gap,width:d,height:f})})),h=YN(e,t,n,c,a,o,Ms()),g=KN(e,t,n,c,a),_=Math.max(n+a.gap/2,...g.map(e=>GN(e))),{chartWidth:v}=kN(e,a),y=zN(i,l,t+v/2,_,n+a.gap*5,c);return[...h,...m,...y]},ZN=(e,t,n,r)=>{let i=e.series,o=ON(`line`,i.length),s=Math.max(1,...i.flatMap(e=>e.values)),c=NN(r),l=PN(c),u=MN(i.length,c),d=i.map((e,r)=>{let i=e.values.map((e,t)=>a(t*(o.slotWidth+o.gap),-(e/s)*o.chartHeight)),c=Math.max(...i.map(e=>e[0])),l=Math.max(...i.map(e=>e[1])),d=Math.min(...i.map(e=>e[0])),f=Math.min(...i.map(e=>e[1]));return A({backgroundColor:`transparent`,...CN,type:`line`,x:t+o.gap+o.slotWidth/2,y:n-o.gap,height:l-f,width:c-d,strokeColor:u[r],strokeWidth:2,points:i})}),f=i.flatMap((e,r)=>e.values.map((e,i)=>{let a=i*(o.slotWidth+o.gap)+o.gap/2,c=-(e/s)*o.chartHeight+o.gap/2;return fc({backgroundColor:u[r],...CN,fillStyle:`solid`,strokeColor:u[r],strokeWidth:2,type:`ellipse`,x:t+a+o.slotWidth/2,y:n+c-o.gap*2,width:o.gap,height:o.gap})})),p=i[0].values.map((e,t)=>Math.max(0,...i.map(e=>e.values[t]??0))).map((e,r)=>{let i=r*(o.slotWidth+o.gap)+o.gap/2,c=e/s*o.chartHeight+o.gap/2+o.gap;return A({backgroundColor:l,...CN,type:`line`,x:t+i+o.slotWidth/2+o.gap/2,y:n-c,height:c,strokeStyle:`dotted`,opacity:fN,points:[a(0,0),a(0,c)]})}),m=YN(e,t,n,l,o,s,Ms()),h=KN(e,t,n,l,o),g=Math.max(n+o.gap/2,...h.map(e=>GN(e))),{chartWidth:_}=kN(e,o),v=zN(i,u,t+_/2,g,n+o.gap*5,l);return[...m,...d,...p,...f,...v]},QN=e=>{let t=/^([-+]?)[$\u20AC\u00A3\u00A5\u20A9]?([-+]?)([\d.,]+)[%]?$/.exec(e);return t?parseFloat(`${(t[1]||t[2])+t[3]}`.replace(/,/g,``)):null},$N=(e,t)=>e.slice(1).every(e=>QN(e[t])!==null),eP=e=>{let t=e[0].length;if(t>2){let n=e[0].every(e=>QN(e)===null),r=n?e.slice(1):e;if(r.length<1)return{ok:!1,reason:`No data rows`};if(r.some(e=>e.slice(1).some(e=>QN(e)===null)))return{ok:!1,reason:`Value is not numeric`};if(t-1>r.length){let t=n?e[0].slice(1).map(e=>e.trim()):null,i=r.map(e=>({title:e[0]?.trim()||null,values:e.slice(1).map(e=>QN(e))}));return{ok:!0,data:{title:i.length===1?i[0].title:n&&e[0][0].trim()||null,labels:t,series:i}}}let i=e[0].slice(1).map((e,t)=>{let i=t+1,a=`Series ${i}`;return{title:n&&e.trim()||a,values:r.map(e=>QN(e[i]))}});return{ok:!0,data:{title:n&&e[0][0].trim()||null,labels:r.map(e=>e[0]),series:i}}}if(t===1){if(!$N(e,0))return{ok:!1,reason:`Value is not numeric`};let t=QN(e[0][0])===null,n=t?e[0][0]:null,r=(t?e.slice(1):e).map(e=>QN(e[0]));return r.length<2?{ok:!1,reason:`Less than two rows`}:{ok:!0,data:{title:n,labels:null,series:[{title:n,values:r}]}}}let n=QN(e[0][1])===null,r=n?e.slice(1):e;if(r.length<2)return{ok:!1,reason:`Less than 2 rows`};if(r.some(e=>QN(e[1])===null))return{ok:!1,reason:`Value is not numeric`};let i=n?e[0][1]:null;return{ok:!0,data:{title:i,labels:r.map(e=>e[0]),series:[{title:i,values:r.map(e=>QN(e[1]))}]}}},tP=e=>{let t=t=>e.replace(/\r\n?/g,`
58
+ `).split(`
59
+ `).filter(e=>e.trim().length>0).map(e=>e.split(t).map(e=>e.trim())),n=[` `,`,`,`;`].map(e=>{let n=t(e),r=n[0]?.length??0;return{delimiter:e,parsed:n,numCols:r,isConsistent:n.length>0&&n.every(e=>e.length===r)}}),r=(n.find(e=>e.isConsistent&&e.numCols>1)??n.find(e=>e.isConsistent)??n[0]).parsed;if(r.length===0)return{ok:!1,reason:`No values`};let i=r[0].length;return r.every(e=>e.length===i)?eP(r):{ok:!1,reason:`All rows don't have same number of columns`}},nP=(e,t,n,r)=>{if(!EN(e,`radar`))return null;let i=e.labels??e.series[0].values.map((e,t)=>`Value ${t+1}`),o=e.series,{normalize:s,renderSteps:c}=FN(o,i.length),l=NN(r),u=PN(l),d=MN(o.length,l),{chartWidth:f,chartHeight:p}=AN(),m=t+f/2,h=n-p/2,g=dN/2,_=i.map((e,t)=>-Math.PI/2+Math.PI*2*t/i.length),{axisLabels:v,axisLabelTopY:y,axisLabelBottomY:b}=RN(i,_,m,h,g,u),x=Nr[`Lilita One`],S=pc.xl,C=mo(x),w=Ho({fontFamily:x,fontSize:S}),T=e.title?LN(e.title,w,f+mN*2):null,E=T?Ja(T,w,C):null,D=T?Br({backgroundColor:u,...CN,text:T,originalText:e.title??T,x:t+f/2,y:y-mN-E.height/2,fontFamily:x,fontSize:S,lineHeight:C,textAlign:`center`}):null,O=c?Array.from({length:pN},(e,t)=>{let n=(t+1)/pN,r=g*n,i=_.map(e=>a(Math.cos(e)*r,Math.sin(e)*r));return i.push(a(i[0][0],i[0][1])),A({backgroundColor:`transparent`,...CN,type:`line`,x:m,y:h,width:r*2,height:r*2,strokeStyle:`solid`,roughness:Ya.architect,opacity:fN,polygon:!0,points:i})}):[],ee=_.map(e=>{let t=Math.cos(e)*g,n=Math.sin(e)*g;return A({backgroundColor:`transparent`,...CN,type:`line`,x:m,y:h,width:Math.abs(t),height:Math.abs(n),strokeStyle:`solid`,roughness:Ya.architect,opacity:fN,points:[a(0,0),a(t,n)]})}),k=o.map((e,t)=>{let n=_.map((t,n)=>{let r=e.values[n]??0,i=s(r,n)*g;return a(Math.cos(t)*i,Math.sin(t)*i)});return n.push(a(n[0][0],n[0][1])),A({backgroundColor:`transparent`,...CN,type:`line`,x:m,y:h,width:g*2,height:g*2,strokeColor:d[t],strokeWidth:2,polygon:!0,points:n})}),te=zN(o,d,m,b,n+uN*5,u);return[...D?[D]:[],...v,...O,...ee,...k,...te]},rP=(e,t,n,r,i)=>e===`line`?ZN(t,n,r,i):e===`radar`?nP(t,n,r,i):XN(t,n,r,i),iP=class e{constructor(e){this.app=e,z(this,`creator`,new Me),z(this,`navigator`,new ro),z(this,`handleKeyEvent`,e=>{let t=this.resolveKeyboardEventToOperation(e);switch(t.type){case`none`:return!1;case`canceled`:return this.app.triggerRender(!0),!0;case`creating`:return e.preventDefault(),t.pending.length&&this.app.revealIfHidden(t.pending),!0;case`navigating`:{e.preventDefault();let n=t.nodeId&&this.app.scene.getNonDeletedElementsMap().get(t.nodeId);return n&&this.selectAndReveal(n),!0}case`committed`:{t.nodes.length&&this.app.insertNewElements(t.nodes);let e=t.nodes[0];return e&&this.selectAndReveal(e),this.captureUpdate(),!0}case`navigationEnded`:return this.captureUpdate(),!0}})}get pendingNodes(){return this.creator.pendingNodes}get isCreatingChart(){return this.creator.isCreatingChart}resolveKeyboardEventToOperation(t){let{creator:n,navigator:r,app:i}=this;if(t.type===`keydown`){if(t.key===M.ESCAPE&&n.isCreatingChart)return n.clear(),{type:`canceled`};if(!da(t.key))return{type:`none`};if(t[M.CTRL_OR_CMD]&&!t.shiftKey){let r=An(i.scene.getNonDeletedElementsMap(),i.state);return r.length===1&&Kn(r[0])&&n.createNodes(r[0],i.state,e.getLinkDirectionFromKey(t.key),i.scene),{type:`creating`,pending:n.pendingNodes??[]}}if(t.altKey){let n=i.scene.getNonDeletedElementsMap(),a=An(n,i.state);if(a.length===1)return{type:`navigating`,nodeId:r.exploreByDirection(a[0],n,e.getLinkDirectionFromKey(t.key))}}return{type:`none`}}let a=!t.altKey&&r.isExploring;if(a&&r.clear(),!t[M.CTRL_OR_CMD]&&n.isCreatingChart){let e=n.pendingNodes??[];return n.clear(),{type:`committed`,nodes:e}}return a?{type:`navigationEnded`}:{type:`none`}}selectAndReveal(e){this.app.setState(t=>({selectedElementIds:Ji({[e.id]:!0},t)})),this.app.revealIfHidden([e])}captureUpdate(){this.app.syncActionResult({captureUpdate:P.IMMEDIATELY})}static getLinkDirectionFromKey(e){switch(e){case M.ARROW_UP:return`up`;case M.ARROW_DOWN:return`down`;case M.ARROW_RIGHT:return`right`;case M.ARROW_LEFT:return`left`;default:return`right`}}},aP=()=>(0,V.jsxs)(`div`,{"data-testid":`brave-measure-text-error`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(AO,{i18nKey:`errors.brave_measure_text_error.line1`,bold:e=>(0,V.jsx)(`span`,{style:{fontWeight:600},children:e})})}),(0,V.jsx)(`p`,{children:(0,V.jsx)(AO,{i18nKey:`errors.brave_measure_text_error.line2`,bold:e=>(0,V.jsx)(`span`,{style:{fontWeight:600},children:e})})}),(0,V.jsx)(`p`,{children:(0,V.jsx)(AO,{i18nKey:`errors.brave_measure_text_error.line3`,link:e=>(0,V.jsx)(`a`,{href:`http://docs.excalidraw.com/docs/@excalidraw/excalidraw/faq#turning-off-aggresive-block-fingerprinting-in-brave-browser`,children:e})})}),(0,V.jsx)(`p`,{children:(0,V.jsx)(AO,{i18nKey:`errors.brave_measure_text_error.line4`,issueLink:e=>(0,V.jsx)(`a`,{href:`https://github.com/excalidraw/excalidraw/issues/new`,children:e}),discordLink:e=>(0,V.jsxs)(`a`,{href:`https://discord.gg/UexuTaE`,children:[e,`.`]})})})]}),oP=({children:e,left:t,top:n,onCloseRequest:r,fitInViewport:i=!1,offsetLeft:a=0,offsetTop:o=0,viewportWidth:s=window.innerWidth,viewportHeight:c=window.innerHeight,className:l})=>{let u=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=u.current;if(!e)return;e.contains(document.activeElement)||e.focus();let t=t=>{if(t.key===M.TAB){let n=_t(e),{activeElement:r}=document,i=n.findIndex(e=>e===r);r===e?(t.shiftKey?n[n.length-1]?.focus():n[0].focus(),t.preventDefault(),t.stopImmediatePropagation()):i===0&&t.shiftKey?(n[n.length-1]?.focus(),t.preventDefault(),t.stopImmediatePropagation()):i===n.length-1&&!t.shiftKey&&(n[0]?.focus(),t.preventDefault(),t.stopImmediatePropagation())}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[]);let d=(0,B.useRef)(null);return(0,B.useLayoutEffect)(()=>{if(i&&u.current&&n!=null&&t!=null){let e=u.current,{width:r,height:i}=e.getBoundingClientRect();if(d.current?.top===n&&d.current?.left===t)return;d.current={top:n,left:t},r>=s?(e.style.width=`${s}px`,e.style.left=`0px`,e.style.overflowX=`scroll`):t+r-a>s?e.style.left=`${s-r-10}px`:e.style.left=`${t}px`,i>=c?(e.style.height=`${c-20}px`,e.style.top=`10px`,e.style.overflowY=`scroll`):n+i-o>c?e.style.top=`${c-i}px`:e.style.top=`${n}px`}},[n,t,i,s,c,a,o]),(0,B.useEffect)(()=>{if(r){let e=e=>{u.current?.contains(e.target)||(0,Sc.unstable_batchedUpdates)(()=>r(e))};return document.addEventListener(`pointerdown`,e,!1),()=>document.removeEventListener(`pointerdown`,e,!1)}},[r]),(0,V.jsx)(`div`,{className:H(`popover`,l),ref:u,tabIndex:-1,children:e})},sP=`separator`,cP=B.memo(({actionManager:e,items:t,top:n,left:r,onClose:i})=>{let a=nB(),o=tB(),s=t.reduce((t,n)=>(n&&(n===sP||!n.predicate||n.predicate(o,a,e.app.props,e.app))&&t.push(n),t),[]);return(0,V.jsx)(oP,{onCloseRequest:()=>{i()},top:n,left:r,fitInViewport:!0,offsetLeft:a.offsetLeft,offsetTop:a.offsetTop,viewportWidth:a.width,viewportHeight:a.height,className:`context-menu-popover`,children:(0,V.jsx)(`ul`,{className:`context-menu`,onContextMenu:e=>e.preventDefault(),children:s.map((t,n)=>{if(t===sP)return!s[n-1]||s[n-1]===sP?null:(0,V.jsx)(`hr`,{className:`context-menu-item-separator`},n);let r=t.name,c=``;return t.label&&(c=typeof t.label==`function`?G(t.label(o,a,e.app)):G(t.label)),(0,V.jsx)(`li`,{"data-testid":r,onClick:()=>{i(()=>{e.executeAction(t,`contextMenu`)})},children:(0,V.jsxs)(`button`,{type:`button`,className:H(`context-menu-item`,{dangerous:r===`deleteSelectedElements`,checkmark:t.checked?.(a)}),children:[(0,V.jsx)(`div`,{className:`context-menu-item__label`,children:c}),(0,V.jsx)(`kbd`,{className:`context-menu-item__shortcut`,children:r?XD(r):``})]})},n)})})})}),lP=({height:e,width:t,userToFollow:n,onDisconnect:r})=>(0,V.jsx)(`div`,{className:`follow-mode`,style:{width:t,height:e},children:(0,V.jsxs)(`div`,{className:`follow-mode__badge`,children:[(0,V.jsxs)(`div`,{className:`follow-mode__badge__label`,children:[`Following`,` `,(0,V.jsx)(`span`,{className:`follow-mode__badge__username`,title:n.username,children:n.username})]}),(0,V.jsx)(`button`,{type:`button`,onClick:r,className:`follow-mode__disconnect-btn`,children:Kb})]})}),uP=B.createContext(null),dP=()=>B.useContext(uP),fP=dl(),pP=()=>B.useMemo(()=>({MainMenuTunnel:oy(),WelcomeScreenMenuHintTunnel:oy(),WelcomeScreenToolbarHintTunnel:oy(),WelcomeScreenHelpHintTunnel:oy(),WelcomeScreenCenterTunnel:oy(),FooterCenterTunnel:oy(),DefaultSidebarTriggerTunnel:oy(),DefaultSidebarTabTriggersTunnel:oy(),OverwriteConfirmDialogTunnel:oy(),TTDDialogTriggerTunnel:oy(),tunnelsJotai:fP}),[]),mP=({delay:e,theme:t})=>{let[n,r]=(0,B.useState)(!!e);return(0,B.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{r(!1)},e);return()=>clearTimeout(t)},[e]),n?null:(0,V.jsxs)(`div`,{className:H(`LoadingMessage`,{"LoadingMessage--dark":t===F.DARK}),children:[(0,V.jsx)(`div`,{children:(0,V.jsx)(GS,{})}),(0,V.jsx)(`div`,{className:`LoadingMessage-text`,children:G(`labels.loadingScene`)})]})},hP=({app:e,setAppState:t})=>{let n=e.state.activeTool,[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(`rectangle`),[s,c]=(0,B.useState)(`arrow`);(0,B.useEffect)(()=>{(n.type===`rectangle`||n.type===`diamond`||n.type===`ellipse`)&&o(n.type)},[n.type]),(0,B.useEffect)(()=>{(n.type===`arrow`||n.type===`line`)&&c(n.type)},[n.type]);let l=n.type===`frame`,u=n.type===`laser`,d=n.type===`embeddable`,{TTDDialogTriggerTunnel:f}=dP(),p=[`rectangle`,`diamond`,`ellipse`].map(e=>({type:e,icon:tT[e].icon,title:In(G(`toolBar.${e}`)),fillable:tT[e].fillable})),m=[`arrow`,`line`].map(e=>({type:e,icon:tT[e].icon,title:In(G(`toolBar.${e}`)),fillable:tT[e].fillable})),[h,g]=(0,B.useState)(0),_=h>=316,v=h>=356,y=h>=396,b=[`text`,`frame`,`embeddable`,`laser`,`magicframe`].filter(e=>!(_&&e===`text`||y&&e===`frame`)).includes(n.type),x=b?n.type===`text`?Xy:n.type===`image`?Qy:n.type===`frame`?Qx:n.type===`embeddable`?ib:n.type===`laser`?rS:n.type===`magicframe`?iS:Zx:Zx,S={app:e,activeTool:n};return(0,V.jsxs)(`div`,{className:`mobile-toolbar`,ref:e=>{e&&g(e.getBoundingClientRect().width)},children:[(0,V.jsx)(sT,{...S,hideKeyBinding:!0}),(0,V.jsx)(bT,{...S,setAppState:t}),(0,V.jsx)(pT,{...S,hideShortcut:!0}),(0,V.jsx)(gT,{...S,hideShortcut:!0}),(0,V.jsx)(eT,{app:e,options:p,activeTool:n,defaultOption:a,"data-testid":`toolbar-rectangle`,onToolChange:t=>{(t===`rectangle`||t===`diamond`||t===`ellipse`)&&(o(t),e.setActiveTool({type:t}))},displayedOption:p.find(e=>e.type===a)||p[0]}),(0,V.jsx)(eT,{app:e,options:m,activeTool:n,defaultOption:s,"data-testid":`toolbar-arrow`,onToolChange:t=>{(t===`arrow`||t===`line`)&&(c(t),e.setActiveTool({type:t}))},displayedOption:m.find(e=>e.type===s)||m[0]}),_&&(0,V.jsx)(mT,{...S,hideShortcut:!0}),v&&(0,V.jsx)(hT,{...S,hideShortcut:!0}),y&&(0,V.jsx)(_T,{...S,hideShortcut:!0}),(0,V.jsxs)(Q,{open:r,children:[(0,V.jsx)(Q.Trigger,{className:H(`App-toolbar__extra-tools-trigger App-toolbar__extra-tools-trigger--mobile`,{"App-toolbar__extra-tools-trigger--selected":b||r}),onToggle:()=>{i(!r),t({openMenu:null,openPopup:null})},title:G(`toolBar.extraTools`),style:{width:36,height:36,display:`flex`,alignItems:`center`,justifyContent:`center`},children:x}),(0,V.jsxs)(Q.Content,{onClickOutside:()=>i(!1),onSelect:()=>i(!1),className:`App-toolbar__extra-tools-dropdown`,align:`start`,children:[!_&&(0,V.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`text`}),icon:Xy,shortcut:M.T.toLocaleUpperCase(),"data-testid":`toolbar-text`,selected:n.type===`text`,children:G(`toolBar.text`)}),!v&&(0,V.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`image`}),icon:Qy,"data-testid":`toolbar-image`,selected:n.type===`image`,children:G(`toolBar.image`)}),!y&&(0,V.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`frame`}),icon:Qx,shortcut:M.F.toLocaleUpperCase(),"data-testid":`toolbar-frame`,selected:l,children:G(`toolBar.frame`)}),(0,V.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`embeddable`}),icon:ib,"data-testid":`toolbar-embeddable`,selected:d,children:G(`toolBar.embeddable`)}),(0,V.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`laser`}),icon:rS,"data-testid":`toolbar-laser`,selected:u,shortcut:M.K.toLocaleUpperCase(),children:G(`toolBar.laser`)}),(0,V.jsx)(`div`,{style:{margin:`6px 0`,fontSize:14,fontWeight:600},children:`Generate`}),e.props.aiEnabled!==!1&&(0,V.jsx)(f.Out,{}),(0,V.jsx)(Q.Item,{onSelect:()=>e.setOpenDialog({name:`ttd`,tab:`mermaid`}),icon:$x,"data-testid":`toolbar-embeddable`,children:G(`toolBar.mermaidToExcalidraw`)}),e.props.aiEnabled!==!1&&e.plugins.diagramToCode&&(0,V.jsx)(V.Fragment,{children:(0,V.jsx)(Q.Item,{onSelect:()=>e.onMagicframeToolSelect(),icon:iS,"data-testid":`toolbar-magicframe`,badge:(0,V.jsx)(Q.Item.Badge,{children:`AI`}),children:G(`toolBar.magicframe`)})})]})]})]})},gP=({children:e,side:t,className:n})=>(0,V.jsx)(`div`,{className:H(`FixedSideContainer`,`FixedSideContainer_side_${t}`,n),children:e}),_P=e=>e.penDetected?(0,V.jsx)(Y,{className:H(`ToolIcon__penMode`,{"is-mobile":e.isMobile}),type:`toggle`,icon:Jy,checked:e.checked,title:`${e.title}`,"aria-label":`${e.title}`,onSelect:()=>e.onChange?.()}):null,vP=({appState:e,elements:t,actionManager:n,setAppState:r,renderTopLeftUI:i,renderTopRightUI:a,renderSidebars:o,renderWelcomeScreen:s,UIOptions:c,app:l,onPenModeToggle:u})=>{let{WelcomeScreenCenterTunnel:d,MainMenuTunnel:f,DefaultSidebarTriggerTunnel:p}=dP();return(0,V.jsxs)(V.Fragment,{children:[o(),(0,V.jsx)(`div`,{className:`App-welcome-screen`,children:s&&(0,V.jsx)(d.Out,{})}),!e.viewModeEnabled&&(0,V.jsxs)(`div`,{className:`App-bottom-bar`,style:{marginBottom:zM+RM},"data-viewport-ui":`bottom`,children:[(0,V.jsx)(Hk,{appState:e,elementsMap:l.scene.getNonDeletedElementsMap(),renderAction:n.renderAction,app:l,setAppState:r}),(0,V.jsxs)(mC,{className:`App-toolbar`,children:[!e.viewModeEnabled&&e.openDialog?.name!==`elementLinkSelector`&&(0,V.jsx)(hP,{app:l,setAppState:r}),e.scrolledOutside&&!e.openMenu&&!e.openSidebar&&(0,V.jsx)(`button`,{type:`button`,className:`scroll-back-to-content`,onClick:()=>{r(e=>({...Jt(t,e)}))},children:G(`buttons.scrollBackToContent`)})]})]}),(0,V.jsx)(gP,{side:`top`,className:`App-top-bar`,children:(()=>{if(e.openDialog?.name===`elementLinkSelector`)return null;let t=(0,V.jsxs)(`div`,{className:`excalidraw-ui-top-right`,children:[a?.(!0,e)??(!e.viewModeEnabled&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(_P,{checked:e.penMode,onChange:()=>u(null),title:G(`toolBar.penMode`),isMobile:!0,penDetected:e.penDetected}),(0,V.jsx)(p.Out,{})]})),e.viewModeEnabled&&(0,V.jsx)(Kk,{actionManager:n})]});return(0,V.jsxs)(`div`,{className:`App-toolbar-content`,style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{className:`excalidraw-ui-top-left`,children:[i?.(!0,e),(0,V.jsx)(f.Out,{})]}),t]})})()})]})},yP=e=>{switch(e){case`bar`:return G(`labels.chartType_bar`);case`line`:return G(`labels.chartType_line`);case`radar`:return G(`labels.chartType_radar`);default:return e}},bP=e=>{let t=(0,B.useRef)(null),[n,r]=(0,B.useState)(null),{theme:i}=cC();(0,B.useLayoutEffect)(()=>{if(!e.spreadsheet){r(null);return}let n=rP(e.chartType,e.spreadsheet,0,0,e.colorSeed);if(!n){r(null),t.current?.replaceChildren();return}r(n);let a,o=t.current;return(async()=>(a=await Sr(n,{exportBackground:!1,viewBackgroundColor:`#fff`,exportWithDarkMode:i===`dark`},null,{skipInliningFonts:!0}),a.querySelector(`.style-fonts`)?.remove(),o.replaceChildren(),o.appendChild(a)))(),()=>{o.replaceChildren()}},[e.spreadsheet,e.chartType,e.colorSeed,i]);let a=yP(e.chartType);return(0,V.jsxs)(`button`,{type:`button`,className:`ChartPreview`,"aria-label":a,onClick:()=>{n&&e.onClick(e.chartType,n)},children:[(0,V.jsx)(`div`,{className:`ChartPreview__canvas`,ref:t}),(0,V.jsx)(`div`,{className:`ChartPreview__label`,children:a})]})},xP=e=>{let t=(0,B.useRef)(null),{theme:n}=cC();return(0,B.useLayoutEffect)(()=>{if(!e.rawText)return;let r=Br({text:e.rawText,x:0,y:0}),i=t.current;return(async()=>{let e=await Sr([r],{exportBackground:!1,viewBackgroundColor:`#fff`,exportWithDarkMode:n===`dark`},null,{skipInliningFonts:!0});e.querySelector(`.style-fonts`)?.remove(),i.replaceChildren(),i.appendChild(e)})(),()=>{i.replaceChildren()}},[e.rawText,n]),(0,V.jsxs)(`button`,{type:`button`,className:`ChartPreview`,"aria-label":G(`labels.chartType_plaintext`),onClick:()=>{e.onClick(e.rawText)},children:[(0,V.jsx)(`div`,{className:`ChartPreview__canvas`,ref:t}),(0,V.jsx)(`div`,{className:`ChartPreview__label`,children:G(`labels.chartType_plaintext`)})]})},SP=({data:e,rawText:t,onClose:n})=>{let{onInsertElements:r,focusContainer:i}=Xz(),[a,o]=(0,B.useState)(Math.random()),s=B.useCallback(()=>{o(Math.random())},[]),c=B.useCallback(()=>{n&&n()},[n]),l=(e,t)=>{r(t),rC(`paste`,`chart`,e),n(),i()};return(0,V.jsx)(Dk,{size:`regular`,onCloseRequest:c,title:(0,V.jsxs)(`div`,{className:`PasteChartDialog__title`,children:[(0,V.jsx)(`div`,{className:`PasteChartDialog__titleText`,children:G(`labels.pasteCharts`)}),(0,V.jsx)(`div`,{className:`PasteChartDialog__reshuffleBtn`,onClick:s,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())},children:xb})]}),className:`PasteChartDialog`,autofocus:!1,children:(0,V.jsxs)(`div`,{className:`container`,children:[[`bar`,`line`,`radar`].map(t=>EN(e,t)?(0,V.jsx)(bP,{chartType:t,spreadsheet:e,colorSeed:a,onClick:l},t):null),t&&(0,V.jsx)(xP,{rawText:t,onClick:e=>{let t=Br({text:e,x:0,y:0});r([t]),rC(`paste`,`chart`,`plaintext`),n(),i()}})]})})},CP=({heading:e,children:t,...n})=>{let{id:r}=eB(),i=(0,V.jsx)(`h2`,{className:`visually-hidden`,id:`${r}-${e}-title`,children:G(`headings.${e}`)});return(0,V.jsx)(`section`,{...n,"aria-labelledby":`${r}-${e}-title`,children:typeof t==`function`?t(i):(0,V.jsxs)(V.Fragment,{children:[i,t]})})},wP=4,TP=8,EP=({shouldWrap:e,children:t,username:n})=>e?(0,V.jsx)(Nw,{label:n||`Unknown user`,children:t}):(0,V.jsx)(V.Fragment,{children:t}),DP=({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,V.jsx)(EP,{username:t.username,shouldWrap:i,children:s},n)},OP=[`avatarUrl`,`id`,`socketId`,`username`,`isInCall`,`isSpeaking`,`isMuted`],kP=B.memo(({className:e,mobile:t,collaborators:n,userToFollow:r})=>{let i=iB(),a=new Map;n.forEach((e,t)=>{let n=e.id||t;a.set(n,{...e,socketId:t})});let o=Array.from(a.values()).filter(e=>e.username?.trim()),[s,c]=B.useState(``),l=o.filter(e=>e.username?.toLowerCase().includes(s)),u=B.useRef(null);(0,B.useLayoutEffect)(()=>{if(u.current){let e=e=>{let t=Math.max(1,Math.min(8,Math.floor(e/38)));f(t)};if(e(u.current.clientWidth),!To)return;let t=new ResizeObserver(t=>{for(let n of t){let{width:t}=n.contentRect;e(t)}});return t.observe(u.current),()=>{t.disconnect()}}},[]);let[d,f]=B.useState(wP),p=o.slice(0,d-1).map(e=>DP({actionManager:i,collaborator:e,socketId:e.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:e.socketId===r}));return t?(0,V.jsx)(`div`,{className:H(`UserList UserList_mobile`,e),children:o.map(e=>DP({actionManager:i,collaborator:e,socketId:e.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:e.socketId===r}))}):(0,V.jsx)(`div`,{className:`UserList__wrapper`,ref:u,children:(0,V.jsxs)(`div`,{className:H(`UserList`,e),style:{"--max-avatars":d},children:[p,o.length>d-1&&(0,V.jsxs)(J_,{children:[(0,V.jsxs)(Y_,{className:`UserList__more`,children:[`+`,o.length-d+1]}),(0,V.jsx)(Z_,{style:{zIndex:2,width:`15rem`,textAlign:`left`},align:`end`,sideOffset:10,children:(0,V.jsxs)(mC,{padding:2,children:[o.length>=TP&&(0,V.jsx)(VC,{placeholder:G(`quickSearch.placeholder`),onChange:c}),(0,V.jsx)(HC,{className:`dropdown-menu UserList__collaborators`,placeholder:G(`userList.empty`),children:l.length>0?[(0,V.jsx)(`div`,{className:`hint`,children:G(`userList.hint.text`)}),l.map(e=>DP({actionManager:i,collaborator:e,socketId:e.socketId,withName:!0,isBeingFollowed:e.socketId===r}))]:[]}),(0,V.jsx)(Q_,{width:20,height:10,style:{fill:`var(--popup-bg-color)`,filter:`drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)`}})]})})]})]})})},(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 e=t.collaborators.get(r);if(!e||r!==n.next().value||!Jr(i,e,OP))return!1}return!0}),AP=e=>(0,V.jsx)(`button`,{className:`help-icon`,onClick:e.onClick,type:`button`,title:`${G(`helpDialog.title`)} \u2014 ?`,"aria-label":G(`helpDialog.title`),children:ub}),jP=({appState:e,actionManager:t,showExitZenModeBtn:n,renderWelcomeScreen:r})=>{let{FooterCenterTunnel:i,WelcomeScreenHelpHintTunnel:a}=dP();return(0,V.jsxs)(`footer`,{role:`contentinfo`,className:`layer-ui__wrapper__footer App-menu App-menu_bottom`,children:[(0,V.jsx)(`div`,{className:H(`layer-ui__wrapper__footer-left zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled}),children:(0,V.jsx)(PO.Col,{gap:2,children:(0,V.jsxs)(CP,{heading:`canvasActions`,children:[(0,V.jsx)(Uk,{renderAction:t.renderAction}),!e.viewModeEnabled&&(0,V.jsx)(Wk,{renderAction:t.renderAction,className:H(`zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-bottom":e.zenModeEnabled})})]})})}),(0,V.jsx)(i.Out,{}),(0,V.jsx)(`div`,{className:H(`layer-ui__wrapper__footer-right zen-mode-transition`,{"transition-right":e.zenModeEnabled}),children:(0,V.jsxs)(`div`,{style:{position:`relative`},children:[r&&(0,V.jsx)(a.Out,{}),(0,V.jsx)(AP,{onClick:()=>t.executeAction(mE)})]})}),(0,V.jsx)(Gk,{actionManager:t,showExitZenModeBtn:n})]})},MP=jP;jP.displayName=`Footer`;var NP=B.createContext({}),PP=({children:e,className:t})=>{let n=Qz(),r=(0,B.useContext)(NP),i=!!(n.canFitSidebar&&r.shouldRenderDockButton);return(0,V.jsxs)(`div`,{className:H(`sidebar__header`,t),"data-testid":`sidebar-header`,children:[e,(0,V.jsxs)(`div`,{className:`sidebar__header__buttons`,children:[i&&(0,V.jsx)(Nw,{label:G(`labels.sidebarLock`),children:(0,V.jsx)(mk,{onSelect:()=>r.onDock?.(!r.docked),selected:!!r.docked,className:`sidebar__dock`,"data-testid":`sidebar-dock`,"aria-label":G(`labels.sidebarLock`),children:Ny})}),(0,V.jsx)(mk,{"data-testid":`sidebar-close`,className:`sidebar__close`,onSelect:r.onCloseRequest,"aria-label":G(`buttons.close`),children:Kb})]})]})};PP.displayName=`SidebarHeader`;var FP=({children:e,tab:t,onSelect:n,...r})=>(0,V.jsx)(gv,{value:t,asChild:!0,onSelect:n,children:(0,V.jsx)(`button`,{type:`button`,className:`excalidraw-button sidebar-tab-trigger`,...r,children:e})});FP.displayName=`SidebarTabTrigger`;var IP=({children:e,...t})=>(0,V.jsx)(hv,{className:`sidebar-triggers`,...t,children:e});IP.displayName=`SidebarTabTriggers`;var LP=({name:e,tab:t,icon:n,title:r,children:i,onToggle:a,className:o,style:s})=>{let c=rB(),l=cC().openSidebar?.name===e;return(0,V.jsx)(`button`,{type:`button`,title:r,className:`sidebar-trigger__label-element`,"aria-label":r,"aria-keyshortcuts":`0`,"aria-pressed":l,onClick:()=>{document.querySelector(`.layer-ui__wrapper`)?.classList.remove(`animate`);let n=!l;c({openSidebar:n?{name:e,tab:t}:null,openMenu:null,openPopup:null}),a?.(n)},children:(0,V.jsxs)(`div`,{className:H(`sidebar-trigger`,o),style:s,children:[n&&(0,V.jsx)(`div`,{children:n}),i&&(0,V.jsx)(`div`,{className:`sidebar-trigger__label`,children:i})]})})};LP.displayName=`SidebarTrigger`;var RP=({children:e,...t})=>{let n=cC(),r=rB();if(!n.openSidebar)return null;let{name:i}=n.openSidebar;return(0,V.jsx)(mv,{className:`sidebar-tabs-root`,value:n.openSidebar.tab,onValueChange:e=>r(t=>({...t,openSidebar:{...t.openSidebar,name:i,tab:e}})),...t,children:e})};RP.displayName=`SidebarTabs`;var zP=({tab:e,children:t,...n})=>(0,V.jsx)(_v,{...n,value:e,"data-testid":e,children:t});zP.displayName=`SidebarTab`;var BP=Ec(!1),VP=(0,B.forwardRef)(({name:e,children:t,onDock:n,docked:r,className:i,...a},o)=>{Ms()&&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=rB(),c=ly(BP);(0,B.useLayoutEffect)(()=>(c(!!r),()=>{c(!1)}),[c,r]);let l=(0,B.useRef)({});l.current.onCloseRequest=()=>{s({openSidebar:null})},l.current.onDock=e=>n?.(e),l.current=ve(l.current,{docked:r,shouldRenderDockButton:!!n&&r!=null});let u=(0,B.useRef)(null);(0,B.useImperativeHandle)(o,()=>u.current);let d=Qz(),f=(0,B.useCallback)(()=>{document.querySelector(`.Dialog`)||s({openSidebar:null})},[s]);return uC(u,(0,B.useCallback)(e=>{e.target.closest(`.sidebar-trigger`)||(!r||!d.canFitSidebar)&&f()},[f,r,d.canFitSidebar])),(0,B.useEffect)(()=>{let e=e=>{e.key===M.ESCAPE&&(!r||!d.canFitSidebar)&&f()};return document.addEventListener(L.KEYDOWN,e),()=>{document.removeEventListener(L.KEYDOWN,e)}},[f,r,d.canFitSidebar]),(0,V.jsx)(mC,{...a,className:H(sa.SIDEBAR,{"sidebar--docked":r},i),"data-viewport-ui":d.formFactor===`phone`?void 0:`side`,"data-viewport-ui-name":d.formFactor===`phone`?void 0:`sidebar`,ref:u,children:(0,V.jsx)(NP.Provider,{value:l.current,children:t})})});VP.displayName=`SidebarInner`;var HP=Object.assign((0,B.forwardRef)((e,t)=>{let n=cC(),{onStateChange:r}=e,i=(0,B.useRef)(n.openSidebar);(0,B.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?n.openSidebar:null),i.current=n.openSidebar},[n.openSidebar,r,e.name]);let[a,o]=(0,B.useState)(!1);return(0,B.useLayoutEffect)(()=>(o(!0),()=>o(!1)),[]),a&&n.openSidebar?.name===e.name?(0,B.createElement)(VP,{...e,ref:t,key:e.name}):null}),{Header:PP,TabTriggers:IP,TabTrigger:FP,Tabs:RP,Tab:zP,Trigger:LP});HP.displayName=`Sidebar`;var UP=(e,t)=>{let n=Ec(0),r=e=>{let{tunnelsJotai:{useAtom:r}}=dP(),[,i]=r(n),a=(0,B.useRef)({preferHost:!1,counter:0});return(0,B.useLayoutEffect)(()=>{let e=a.current;return i(t=>{let n=t+1;return e.counter=n,n}),()=>{i(t=>{let n=t-1;return e.counter=n,n||(e.preferHost=!1),n})}},[i]),e.__fallback||(a.current.preferHost=!0),!a.current.counter&&e.__fallback&&a.current.preferHost||a.current.counter>1&&e.__fallback?null:(0,V.jsx)(t,{...e})};return r.displayName=e,r},WP={};gc(WP,{ChangeCanvasBackground:()=>iF,ClearCanvas:()=>nF,CommandPalette:()=>$P,Export:()=>aF,Help:()=>tF,LiveCollaborationTrigger:()=>sF,LoadScene:()=>XP,Preferences:()=>_F,PreferencesToggleGridModeItem:()=>pF,PreferencesToggleZenModeItem:()=>mF,SaveAsImage:()=>QP,SaveToActiveFile:()=>ZP,SearchMenu:()=>eF,Socials:()=>oF,ToggleTheme:()=>rF});var GP=Ec({active:!1});async function KP({title:e,description:t,actionLabel:n,color:r}){return new Promise(i=>{py.set(GP,{active:!0,onConfirm:()=>i(!0),onClose:()=>i(!1),onReject:()=>i(!1),title:e,description:t,actionLabel:n,color:r})})}var qP=function({onChange:e,value:t,choices:n,name:r}){return(0,V.jsx)(`div`,{className:`RadioGroup`,children:n.map(n=>(0,V.jsxs)(`div`,{className:H(`RadioGroup__choice`,{active:n.value===t}),title:n.ariaLabel,children:[(0,V.jsx)(`input`,{name:r,type:`radio`,checked:n.value===t,onChange:()=>e(n.value),"aria-label":n.ariaLabel}),n.label]},String(n.value)))})},JP=({value:e,shortcut:t,onChange:n,choices:r,children:i,name:a,icon:o})=>{let s=Qz();return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`dropdown-menu-item-base dropdown-menu-item-bare`,children:[o&&(0,V.jsx)(`div`,{className:`dropdown-menu-item__icon`,children:o}),(0,V.jsx)(`label`,{className:`dropdown-menu-item__text`,children:(0,V.jsx)(JC,{children:i})}),(0,V.jsx)(qP,{name:a,value:e,onChange:n,choices:r})]}),t&&s.formFactor!==`phone`&&(0,V.jsx)(`div`,{className:`dropdown-menu-item__shortcut dropdown-menu-item__shortcut--orphaned`,children:t})]})};JP.displayName=`DropdownMenuItemContentRadio`;var YP=JP,XP=()=>{let{t:e}=Ty(),t=iB(),n=tB();return t.isActionEnabled(lE)?(0,V.jsx)($C,{icon:bb,onSelect:async()=>{(!n.length||await KP({title:e(`overwriteConfirm.modal.loadFromFile.title`),actionLabel:e(`overwriteConfirm.modal.loadFromFile.button`),color:`warning`,description:(0,V.jsx)(AO,{i18nKey:`overwriteConfirm.modal.loadFromFile.description`,bold:e=>(0,V.jsx)(`strong`,{children:e}),br:()=>(0,V.jsx)(`br`,{})})}))&&t.executeAction(lE)},"data-testid":`load-button`,shortcut:XD(`loadScene`),"aria-label":e(`buttons.load`),children:e(`buttons.load`)}):null};XP.displayName=`LoadScene`;var ZP=()=>{let{t:e}=Ty(),t=iB();return t.isActionEnabled(sE)?(0,V.jsx)($C,{shortcut:XD(`saveScene`),"data-testid":`save-button`,onSelect:()=>t.executeAction(sE),icon:vb,"aria-label":`${e(`buttons.save`)}`,children:`${e(`buttons.save`)}`}):null};ZP.displayName=`SaveToActiveFile`;var QP=()=>{let e=rB(),{t}=Ty();return(0,V.jsx)($C,{icon:Cb,"data-testid":`image-export-button`,onSelect:()=>e({openDialog:{name:`imageExport`}}),shortcut:XD(`imageExport`),"aria-label":t(`buttons.exportImage`),children:t(`buttons.exportImage`)})};QP.displayName=`SaveAsImage`;var $P=e=>{let t=rB(),{t:n}=Ty();return(0,V.jsx)($C,{icon:hS,"data-testid":`command-palette-button`,onSelect:()=>{rC(`command_palette`,`open`,`menu`),t({openDialog:{name:`commandPalette`}})},shortcut:XD(`commandPalette`),"aria-label":n(`commandPalette.title`),className:e?.className,children:n(`commandPalette.title`)})};$P.displayName=`CommandPalette`;var eF=e=>{let{t}=Ty(),n=iB();return(0,V.jsx)($C,{icon:uS,"data-testid":`search-menu-button`,onSelect:()=>{n.executeAction(kj)},shortcut:XD(`searchMenu`),"aria-label":t(`search.title`),className:e?.className,children:t(`search.title`)})};eF.displayName=`SearchMenu`;var tF=()=>{let{t:e}=Ty(),t=iB();return(0,V.jsx)($C,{"data-testid":`help-menu-item`,icon:ub,onSelect:()=>t.executeAction(mE),shortcut:`?`,"aria-label":e(`helpDialog.title`),children:e(`helpDialog.title`)})};tF.displayName=`Help`;var nF=()=>{let{t:e}=Ty(),t=ly(Jk);return iB().isActionEnabled(Rw)?(0,V.jsx)($C,{icon:rb,onSelect:()=>t(`clearCanvas`),"data-testid":`clear-canvas-button`,"aria-label":e(`buttons.clearReset`),children:e(`buttons.clearReset`)}):null};nF.displayName=`ClearCanvas`;var rF=e=>{let{t}=Ty(),n=cC(),r=iB(),i=XD(`toggleTheme`),a=Zz();return r.isActionEnabled(Hw)?e?.allowSystemTheme?(0,V.jsx)(YP,{name:`theme`,value:e.theme,onChange:e=>{if(a.onThemeChange){a.onThemeChange(e);return}console.warn("MainMenu.DefaultItems.ToggleTheme: `<Excalidraw/> props.onThemeChange` must be defined to use system theme selection.")},choices:[{value:F.LIGHT,label:sb,ariaLabel:`${t(`buttons.lightMode`)} - ${i}`},{value:F.DARK,label:ob,ariaLabel:`${t(`buttons.darkMode`)} - ${i}`},{value:`system`,label:ES,ariaLabel:t(`buttons.systemMode`)}],children:t(`labels.theme`)}):(0,V.jsx)($C,{onSelect:e=>{e.preventDefault(),r.executeAction(Hw)},icon:n.theme===F.DARK?sb:ob,"data-testid":`toggle-dark-mode`,shortcut:i,"aria-label":n.theme===F.DARK?t(`buttons.lightMode`):t(`buttons.darkMode`),children:n.theme===F.DARK?t(`buttons.lightMode`):t(`buttons.darkMode`)}):null};rF.displayName=`ToggleTheme`;var iF=()=>{let{t:e}=Ty(),t=cC(),n=iB(),r=Zz();return t.viewModeEnabled||!r.UIOptions.canvasActions.changeViewBackgroundColor?null:(0,V.jsxs)(`div`,{style:{marginTop:`0.75rem`},children:[(0,V.jsx)(`div`,{"data-testid":`canvas-background-label`,style:{fontSize:`0.875rem`,marginBottom:`0.25rem`,marginLeft:`0.5rem`},children:e(`labels.canvasBackground`)}),(0,V.jsx)(`div`,{style:{padding:`0 0.625rem`},children:n.renderAction(`changeViewBackgroundColor`)})]})};iF.displayName=`ChangeCanvasBackground`;var aF=()=>{let{t:e}=Ty(),t=rB();return(0,V.jsx)($C,{icon:lb,onSelect:()=>{t({openDialog:{name:`jsonExport`}})},"data-testid":`json-export-button`,"aria-label":e(`buttons.export`),children:e(`buttons.export`)})};aF.displayName=`Export`;var oF=()=>{let{t:e}=Ty();return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(zO,{icon:pb,href:`https://github.com/excalidraw/excalidraw`,"aria-label":`GitHub`,children:`GitHub`}),(0,V.jsx)(zO,{icon:hb,href:`https://x.com/excalidraw`,"aria-label":`X`,children:e(`labels.followUs`)}),(0,V.jsx)(zO,{icon:mb,href:`https://discord.gg/UexuTaE`,"aria-label":`Discord`,children:e(`labels.discordChat`)})]})};oF.displayName=`Socials`;var sF=({onSelect:e,isCollaborating:t})=>{let{t:n}=Ty();return(0,V.jsx)($C,{"data-testid":`collab-button`,icon:Wb,className:H({"active-collab":t}),onSelect:e,children:n(`labels.liveCollaboration`)})};sF.displayName=`LiveCollaborationTrigger`;var cF=()=>{let{t:e}=Ty(),t=Xz();return(0,V.jsx)(rk,{checked:cC().activeTool.locked,shortcut:XD(`toolLock`),onSelect:e=>{t.toggleLock(),e.preventDefault()},children:e(`labels.preferences_toolLock`)})},lF=()=>{let{t:e}=Ty(),t=cC(),n=rB();return(0,V.jsx)(YP,{name:`boxSelectionMode`,icon:HS,value:t.boxSelectionMode,onChange:e=>{n({boxSelectionMode:e})},choices:[{value:`contain`,label:e(`labels.boxSelectionContain`),ariaLabel:e(`labels.boxSelectionContain`)},{value:`overlap`,label:e(`labels.boxSelectionOverlap`),ariaLabel:e(`labels.boxSelectionOverlap`)}],children:e(`labels.boxSelectionMode`)})},uF=()=>{let{t:e}=Ty(),t=iB();return(0,V.jsx)(rk,{checked:cC().objectsSnapModeEnabled,shortcut:XD(`objectsSnapMode`),onSelect:e=>{t.executeAction(HE),e.preventDefault()},children:e(`buttons.objectsSnapMode`)})},dF=()=>{let{t:e}=Ty(),t=iB();return(0,V.jsx)(rk,{checked:cC().bindingPreference===`enabled`,onSelect:e=>{t.executeAction(UE),e.preventDefault()},children:e(`labels.arrowBinding`)})},fF=()=>{let{t:e}=Ty(),t=iB();return(0,V.jsx)(rk,{checked:cC().isMidpointSnappingEnabled,onSelect:e=>{t.executeAction(WE),e.preventDefault()},children:e(`labels.midpointSnapping`)})},pF=()=>{let{t:e}=Ty(),t=iB();return(0,V.jsx)(rk,{checked:cC().gridModeEnabled,shortcut:XD(`gridMode`),onSelect:e=>{t.executeAction(BE),e.preventDefault()},children:e(`labels.toggleGrid`)})},mF=()=>{let{t:e}=Ty(),t=iB();return(0,V.jsx)(rk,{checked:cC().zenModeEnabled,shortcut:XD(`zenMode`),onSelect:e=>{t.executeAction(VE),e.preventDefault()},children:e(`buttons.zenMode`)})},hF=()=>{let{t:e}=Ty(),t=iB();return(0,V.jsx)(rk,{checked:cC().viewModeEnabled,shortcut:XD(`viewMode`),onSelect:e=>{t.executeAction(Ok),e.preventDefault()},children:e(`labels.viewMode`)})},gF=()=>{let{t:e}=Ty(),t=iB();return(0,V.jsx)(rk,{checked:cC().stats.open,shortcut:XD(`stats`),onSelect:e=>{t.executeAction(GE),e.preventDefault()},children:e(`stats.fullTitle`)})},_F=({children:e,additionalItems:t})=>{let{t:n}=Ty();return(0,V.jsxs)(ek,{children:[(0,V.jsx)(ek.Trigger,{icon:WS,children:n(`labels.preferences`)}),(0,V.jsxs)(ek.Content,{className:`excalidraw-main-menu-preferences-submenu`,children:[e||(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(lF,{}),(0,V.jsx)(cF,{}),(0,V.jsx)(uF,{}),(0,V.jsx)(pF,{}),(0,V.jsx)(mF,{}),(0,V.jsx)(hF,{}),(0,V.jsx)(gF,{}),(0,V.jsx)(dF,{}),(0,V.jsx)(fF,{})]}),t]})]})};_F.ToggleToolLock=cF,_F.BoxSelectionMode=lF,_F.ToggleSnapMode=uF,_F.ToggleArrowBinding=dF,_F.ToggleMidpointSnapping=fF,_F.ToggleGridMode=pF,_F.ToggleZenMode=mF,_F.ToggleViewMode=hF,_F.ToggleElementProperties=gF,_F.displayName=`Preferences`;var vF=Object.assign(UP(`MainMenu`,({children:e,onSelect:t})=>{let{MainMenuTunnel:n}=dP(),r=Qz(),i=cC(),a=rB();return(0,V.jsx)(n.In,{children:(0,V.jsxs)(Q,{open:i.openMenu===`canvas`,children:[(0,V.jsx)(Q.Trigger,{onToggle:()=>{a({openMenu:i.openMenu===`canvas`?null:`canvas`,openPopup:null,openDialog:null})},"data-testid":`main-menu-trigger`,className:`main-menu-trigger`,children:cb}),(0,V.jsxs)(Q.Content,{onClickOutside:()=>a({openMenu:null}),onSelect:_(t,()=>{a({openMenu:null})}),className:`main-menu`,align:`start`,children:[e,r.formFactor===`phone`&&i.collaborators.size>0&&(0,V.jsxs)(`fieldset`,{className:`UserList-Wrapper`,children:[(0,V.jsx)(`legend`,{children:G(`labels.collaborators`)}),(0,V.jsx)(kP,{mobile:!0,collaborators:i.collaborators,userToFollow:i.userToFollow?.socketId||null})]})]})]})})}),{Trigger:Q.Trigger,Item:Q.Item,ItemLink:Q.ItemLink,ItemCustom:Q.ItemCustom,Group:Q.Group,Separator:Q.Separator,Sub:ek,DefaultItems:WP}),yF=(0,B.forwardRef)(({children:e,icon:t,onClick:n,label:r,variant:i=`filled`,color:a=`primary`,size:o=`medium`,fullWidth:s,className:c,status:l,disabled:u},d)=>{let[f,p]=(0,B.useState)(!1),m=async e=>{let t=n?.(e);if(Gs(t)){let e=window.setTimeout(()=>{p(!0)},50);try{await t}catch(e){if(e instanceof Qa)console.warn(e);else throw e}finally{clearTimeout(e),p(!1)}}},h=f?`loading`:l;return a=h===`success`?`success`:a,(0,V.jsx)(`button`,{className:H(`ExcButton`,`ExcButton--color-${a}`,`ExcButton--variant-${i}`,`ExcButton--size-${o}`,`ExcButton--status-${h}`,{"ExcButton--fullWidth":s},c),onClick:m,type:`button`,"aria-label":r,ref:d,disabled:u||h===`loading`||h===`success`,children:(0,V.jsxs)(`div`,{className:`ExcButton__contents`,children:[h===`loading`?(0,V.jsx)(GS,{className:`ExcButton__statusIcon`}):h===`success`&&(0,V.jsx)(`div`,{className:`ExcButton__statusIcon`,children:Jx}),t&&(0,V.jsx)(`div`,{className:`ExcButton__icon`,"aria-hidden":!0,children:t}),i!==`icon`&&(e??r)]})})}),bF=({title:e,children:t,actionLabel:n,onClick:r})=>(0,V.jsxs)(`div`,{className:`OverwriteConfirm__Actions__Action`,children:[(0,V.jsx)(`h4`,{children:e}),(0,V.jsx)(`div`,{className:`OverwriteConfirm__Actions__Action__content`,children:t}),(0,V.jsx)(yF,{variant:`outlined`,color:`muted`,label:n,size:`large`,fullWidth:!0,onClick:r})]}),xF=Object.assign(({children:e})=>(0,V.jsx)(`div`,{className:`OverwriteConfirm__Actions`,children:e}),{ExportToImage:()=>{let{t:e}=Ty(),t=iB(),n=rB();return(0,V.jsx)(bF,{title:e(`overwriteConfirm.action.exportToImage.title`),actionLabel:e(`overwriteConfirm.action.exportToImage.button`),onClick:()=>{t.executeAction(nE,`ui`,!0),n({openDialog:{name:`imageExport`}})},children:e(`overwriteConfirm.action.exportToImage.description`)})},SaveToDisk:()=>{let{t:e}=Ty(),t=iB();return(0,V.jsx)(bF,{title:e(`overwriteConfirm.action.saveToDisk.title`),actionLabel:e(`overwriteConfirm.action.saveToDisk.button`),onClick:()=>{t.executeAction(cE,`ui`)},children:e(`overwriteConfirm.action.saveToDisk.description`)})}}),SF=Object.assign(UP(`OverwriteConfirmDialog`,({children:e})=>{let{OverwriteConfirmDialogTunnel:t}=dP(),[n,r]=W(GP);return n.active?(0,V.jsx)(t.In,{children:(0,V.jsx)(Dk,{onCloseRequest:()=>{n.onClose(),r(e=>({...e,active:!1}))},title:!1,size:916,children:(0,V.jsxs)(`div`,{className:`OverwriteConfirm`,children:[(0,V.jsx)(`h3`,{children:n.title}),(0,V.jsxs)(`div`,{className:`OverwriteConfirm__Description OverwriteConfirm__Description--color-${n.color}`,children:[(0,V.jsx)(`div`,{className:`OverwriteConfirm__Description__icon`,children:Yx}),(0,V.jsx)(`div`,{children:n.description}),(0,V.jsx)(`div`,{className:`OverwriteConfirm__Description__spacer`}),(0,V.jsx)(yF,{color:n.color,size:`large`,label:n.actionLabel,onClick:()=>{n.onConfirm(),r(e=>({...e,active:!1}))}})]}),(0,V.jsx)(xF,{children:e})]})})}):null}),{Actions:xF,Action:bF}),CF=Ec(``),wF=Ec(null),TF=350,EF=()=>{let e=Xz(),t=rB(),n=(0,B.useRef)(null),[r,i]=W(CF),a=r.trim(),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)({nonce:null,items:[]}),u=(0,B.useRef)(null),d=(0,B.useRef)(void 0),[f,p]=W(wF);(0,B.useEffect)(()=>{o||(a!==u.current||e.scene.getSceneNonce()!==d.current)&&(u.current=null,PF(a,e,(n,r)=>{l({nonce:dr(),items:n}),u.current=a,d.current=e.scene.getSceneNonce(),t({searchMatches:n.length?{focusedId:null,matches:n.map(e=>({id:e.element.id,focus:!1,matchedLines:e.matchedLines}))}:null})}))},[o,a,e.scene.getNonDeletedElementsMap(),e,t,p,d]);let m=()=>{c.items.length>0&&p(e=>e===null?0:(e+1)%c.items.length)},h=()=>{c.items.length>0&&p(e=>e===null?0:e-1<0?c.items.length-1:e-1)};(0,B.useEffect)(()=>{t(e=>e.searchMatches?{searchMatches:{focusedId:f!==null&&e.searchMatches?.matches[f]?.id||null,matches:e.searchMatches.matches.map((e,t)=>t===f?{...e,focus:!0}:{...e,focus:!1})}}:null)},[f,t]),(0,B.useEffect)(()=>{if(c.items.length>0&&f!==null){let t=c.items[f];if(t){let n=e.state.zoom.value,r=Br({text:t.searchQuery,x:t.element.x+(t.matchedLines[0]?.offsetX??0),y:t.element.y+(t.matchedLines[0]?.offsetY??0),width:t.matchedLines[0]?.width,height:t.matchedLines[0]?.height,fontSize:N(t.element)?fi.nameFontSize:t.element.fontSize,fontFamily:N(t.element)?Nr.Assistant:t.element.fontFamily}),i=r.fontSize,a=i*n<14;if(!re([r],e.canvas.width/window.devicePixelRatio,e.canvas.height/window.devicePixelRatio,{offsetLeft:e.state.offsetLeft,offsetTop:e.state.offsetTop,scrollX:e.state.scrollX,scrollY:e.state.scrollY,zoom:e.state.zoom},e.scene.getNonDeletedElementsMap(),e.getViewportOffsets())||a){let t=a&&i<14?`contain`:`scale-down`;e.setViewport({target:He([r]),fit:t,animation:{duration:300},offsets:{ui:!0}})}}}},[f,c,e]),(0,B.useEffect)(()=>()=>{p(null),u.current=null,d.current=void 0,t({searchMatches:null}),s(!1)},[t,p]);let g=dC({goToNextItem:m,goToPreviousItem:h,searchMatches:c});(0,B.useEffect)(()=>Hi(window,L.KEYDOWN,r=>{if(r.key===M.ESCAPE&&!e.state.openDialog&&!e.state.openPopup){r.preventDefault(),r.stopPropagation(),t({openSidebar:null});return}if(r[M.CTRL_OR_CMD]&&r.key===M.F){if(r.preventDefault(),r.stopPropagation(),e.state.openDialog)return;n.current?.matches(`:focus`)||(e.state.openDialog&&t({openDialog:null}),n.current?.focus(),n.current?.select())}r.target instanceof HTMLElement&&r.target.closest(`.layer-ui__search`)&&g.searchMatches.items.length&&(r.key===M.ENTER&&(r.stopPropagation(),g.goToNextItem()),r.key===M.ARROW_UP?(r.stopPropagation(),g.goToPreviousItem()):r.key===M.ARROW_DOWN&&(r.stopPropagation(),g.goToNextItem()))},{capture:!0,passive:!1}),[t,g,e]);let _=`${c.items.length} ${c.items.length===1?G(`search.singleResult`):G(`search.multipleResults`)}`;return(0,V.jsxs)(`div`,{className:`layer-ui__search`,children:[(0,V.jsx)(`div`,{className:`layer-ui__search-header`,children:(0,V.jsx)(hk,{className:sa.SEARCH_MENU_INPUT_WRAPPER,value:r,ref:n,placeholder:G(`search.placeholder`),icon:uS,onChange:n=>{i(n),s(!0);let r=n.trim();PF(r,e,(n,i)=>{l({nonce:dr(),items:n}),p(i),u.current=r,d.current=e.scene.getSceneNonce(),t({searchMatches:n.length?{focusedId:null,matches:n.map(e=>({id:e.element.id,focus:!1,matchedLines:e.matchedLines}))}:null}),s(!1)})},selectOnRender:!0})}),(0,V.jsxs)(`div`,{className:`layer-ui__search-count`,children:[c.items.length>0&&(0,V.jsxs)(V.Fragment,{children:[f!==null&&f>-1?(0,V.jsxs)(`div`,{children:[f+1,` / `,_]}):(0,V.jsx)(`div`,{children:_}),(0,V.jsxs)(`div`,{className:`result-nav`,children:[(0,V.jsx)(mk,{onSelect:()=>{m()},className:`result-nav-btn`,children:NS}),(0,V.jsx)(mk,{onSelect:()=>{h()},className:`result-nav-btn`,children:FS})]})]}),c.items.length===0&&a&&u.current&&(0,V.jsx)(`div`,{style:{margin:`1rem auto`},children:G(`search.noMatch`)})]}),(0,V.jsx)(OF,{matches:c,onItemClick:p,focusIndex:f,searchQuery:a})]})},DF=e=>{let t=[e.preview.moreBefore?`...`:``,e.preview.previewText.slice(0,e.preview.indexInSearchQuery),e.preview.previewText.slice(e.preview.indexInSearchQuery,e.preview.indexInSearchQuery+e.searchQuery.length),e.preview.previewText.slice(e.preview.indexInSearchQuery+e.searchQuery.length),e.preview.moreAfter?`...`:``];return(0,V.jsx)(`div`,{tabIndex:-1,className:H(`layer-ui__result-item`,{active:e.highlighted}),onClick:e.onClick,ref:t=>{e.highlighted&&t?.scrollIntoView({behavior:`auto`,block:`nearest`})},children:(0,V.jsx)(`div`,{className:`preview-text`,children:t.flatMap((e,t)=>(0,V.jsx)(B.Fragment,{children:t===2?(0,V.jsx)(`b`,{children:e}):e},t))})})},OF=(0,B.memo)(e=>{let t=(0,B.useMemo)(()=>e.matches.items.filter(e=>N(e.element)),[e.matches]),n=(0,B.useMemo)(()=>e.matches.items.filter(e=>R(e.element)),[e.matches]);return(0,V.jsxs)(`div`,{children:[t.length>0&&(0,V.jsxs)(`div`,{className:`layer-ui__search-result-container`,children:[(0,V.jsxs)(`div`,{className:`layer-ui__search-result-title`,children:[(0,V.jsx)(`div`,{className:`title-icon`,children:Qx}),(0,V.jsx)(`div`,{children:G(`search.frames`)})]}),t.map((t,n)=>(0,V.jsx)(DF,{searchQuery:e.searchQuery,preview:t.preview,highlighted:n===e.focusIndex,onClick:()=>e.onItemClick(n)},t.element.id+t.index)),n.length>0&&(0,V.jsx)(`div`,{className:`layer-ui__divider`})]}),n.length>0&&(0,V.jsxs)(`div`,{className:`layer-ui__search-result-container`,children:[(0,V.jsxs)(`div`,{className:`layer-ui__search-result-title`,children:[(0,V.jsx)(`div`,{className:`title-icon`,children:Xy}),(0,V.jsx)(`div`,{children:G(`search.texts`)})]}),n.map((n,r)=>(0,V.jsx)(DF,{searchQuery:e.searchQuery,preview:n.preview,highlighted:r+t.length===e.focusIndex,onClick:()=>e.onItemClick(r+t.length)},n.element.id+n.index))]})]})},(e,t)=>e.matches.nonce===t.matches.nonce&&e.focusIndex===t.focusIndex),kF=(e,t,n)=>{let r=e.slice(0,t),i=r.split(/\s+/),a=r.endsWith(` `),o=i.length-2-1-!a,s=i.slice(o<=0?0:o).join(` `)+(a?` `:``);s=s.length>20?s.slice(-20):s;let c=e.slice(t+n.length),l=c.split(/\s+/),u=!c.startsWith(` `),d=u?6:5,f=(u?``:` `)+l.slice(0,d).join(` `);return{indexInSearchQuery:s.length,previewText:s+n+f,moreBefore:o>0,moreAfter:l.length>d}},AF=(e,t)=>{let n=e.split(`
60
+ `),r=[],i=0;for(let e=0;e<n.length;e++){let a=n[e],o=n[e+1];if(o){let e=t.indexOf(o,i);if(e>a.length+i){let t=e-(a.length+i);for(;t>0;)a+=` `,t--}}r.push(a),i+=a.length}return r.join(`
61
+ `)},jF=(e,t,n)=>{let r=AF(e.text,e.originalText).split(`
62
+ `),i=[],a=0,o=0;for(let e of r){let t=a,n=t+e.length-1;i.push({line:e,startIndex:t,endIndex:n,lineNumber:o}),a=n+1,o++}let s=n,c=e.originalText.slice(n,n+t.length),l=[];for(let t of i){if(c===``)break;if(s>=t.startIndex&&s<=t.endIndex){let n=t.endIndex+1-s,r=t.line.slice(0,s-t.startIndex),i=c.slice(0,n);c=c.slice(n);let a=Ja(r,Ho(e),e.lineHeight);if(r===``&&(a.width=0),e.textAlign!==`left`&&t.line.length>0){let n=Ja(t.line,Ho(e),e.lineHeight),r=e.textAlign===`center`?(e.width-n.width)/2:e.width-n.width;a.width+=r}let{width:o,height:u}=Ja(i,Ho(e),e.lineHeight),d=a.width,f=t.lineNumber*a.height;l.push({offsetX:d,offsetY:f,width:o,height:u,showOnCanvas:!0}),s+=n}}return l},MF=(e,t,n,r)=>{let i=e.name??fe(e),a=i.slice(n,n+t.length),o=i.slice(0,n),s=Ho({fontSize:fi.nameFontSize,fontFamily:Nr.Assistant}),c=mo(Nr.Assistant),l=Ja(o,s,c);o===``&&(l.width=0);let u=Ja(a,s,c),d=l.width,f=-l.height-fi.strokeWidth,p=u.width;return[{offsetX:d,offsetY:f,width:p,height:u.height,showOnCanvas:d+p<=e.width*r}]},NF=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,`\\$&`),PF=(0,sy.default)((e,t,n)=>{if(!e||e===``){n([],null);return}let r=t.scene.getNonDeletedElements(),i=r.filter(e=>R(e)),a=r.filter(e=>N(e));i.sort((e,t)=>e.y-t.y),a.sort((e,t)=>e.y-t.y);let o=[],s=new RegExp(NF(e),`gi`);for(let t of i){let n=null,r=t.originalText;for(;(n=s.exec(r))!==null;){let i=kF(r,n.index,e),a=jF(t,e,n.index);a.length>0&&o.push({element:t,searchQuery:e,preview:i,index:n.index,matchedLines:a})}}let c=[];for(let n of a){let r=null,i=n.name??fe(n);for(;(r=s.exec(i))!==null;){let a=kF(i,r.index,e),o=MF(n,e,r.index,t.state.zoom.value);o.length>0&&c.push({element:n,searchQuery:e,preview:a,index:r.index,matchedLines:o})}}let l=new Set(t.visibleElements.map(e=>e.id)),u=[...c,...o];n(u,u.findIndex(e=>l.has(e.element.id))??null)},TF),FF=UP(`DefaultSidebarTrigger`,e=>{let{DefaultSidebarTriggerTunnel:t}=dP();return(0,V.jsx)(t.In,{children:(0,V.jsx)(HP.Trigger,{...e,className:`default-sidebar-trigger`,name:oe.name})})});FF.displayName=`DefaultSidebarTrigger`;var IF=({children:e})=>{let{DefaultSidebarTabTriggersTunnel:t}=dP();return(0,V.jsx)(t.In,{children:e})};IF.displayName=`DefaultTabTriggers`;var LF=Object.assign(UP(`DefaultSidebar`,({children:e,className:t,onDock:n,docked:r,...i})=>{let a=cC(),o=rB(),{DefaultSidebarTabTriggersTunnel:s}=dP(),c=a.openSidebar?.tab===Fr;return(0,B.createElement)(HP,{...i,name:`default`,key:`default`,className:H(`default-sidebar`,t),docked:c||(r??a.defaultSidebarDockedPreference),onDock:c||n===!1||!n&&r!=null?void 0:_(n,e=>{o({defaultSidebarDockedPreference:e})})},(0,V.jsxs)(HP.Tabs,{children:[(0,V.jsx)(HP.Header,{children:(0,V.jsxs)(HP.TabTriggers,{children:[(0,V.jsx)(HP.TabTrigger,{tab:Fr,children:uS}),(0,V.jsx)(HP.TabTrigger,{tab:ke,children:ky}),(0,V.jsx)(s.Out,{})]})}),(0,V.jsx)(HP.Tab,{tab:ke,children:(0,V.jsx)(wk,{})}),(0,V.jsx)(HP.Tab,{tab:Fr,children:(0,V.jsx)(EF,{})}),e]}))}),{Trigger:FF,TabTriggers:IF}),RF=300,zF=({input:e,placeholder:t,onChange:r,onKeyboardSubmit:i,errorLine:a})=>{let o=(0,B.useRef)(null),s=(0,B.useRef)(i);s.current=i;let[c,l]=(0,B.useState)({type:`loading`}),[u,d]=(0,B.useState)(!1),{theme:f}=cC();if((0,B.useEffect)(()=>{let e=!1,t=setTimeout(()=>{e||d(!0)},RF);return n(()=>import(`./CodeMirrorEditor-UCMRAMCV-Fb3TgxXK.js`).then(t=>{e||l({type:`ready`,component:t.default})}),__vite__mapDeps([66,2,67,1,65,68,69]),import.meta.url).catch(()=>{e||l({type:`fallback`})}).finally(()=>{clearTimeout(t)}),()=>{e=!0,clearTimeout(t)}},[]),(0,B.useEffect)(()=>{if(c.type!==`fallback`||!s.current)return;let e=o.current;if(e){let t=e=>{e[M.CTRL_OR_CMD]&&e.key===M.ENTER&&(e.preventDefault(),s.current?.())};return e.focus(),e.addEventListener(L.KEYDOWN,t),()=>{e.removeEventListener(L.KEYDOWN,t)}}},[c.type]),c.type===`ready`){let n=c.component;return(0,V.jsx)(n,{value:e,onChange:r,onKeyboardSubmit:i,placeholder:t,theme:f,errorLine:a})}return c.type===`fallback`?(0,V.jsx)(`textarea`,{className:`ttd-dialog-input`,onChange:e=>r(e.target.value),value:e,placeholder:t,ref:o}):u?(0,V.jsx)(`div`,{className:`ttd-dialog-input ttd-dialog-input--loading`,children:(0,V.jsx)(GS,{})}):null},BF=/(?:Parse|Lexical) error on line (\d+)[.:]/i,VF=/Trying to inactivate an inactive participant \((.+)\)/i,HF=/^\s*-+\^\s*$/,UF=e=>BF.test(e),WF=e=>UF(e)||VF.test(e),GF=e=>HF.test(e),KF=e=>{let t=e.match(VF);return t?.[1]?t[1].trim():null},qF=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),JF=(e,t)=>{let n=KF(e);if(!n)return null;let r=RegExp(`^\\s*deactivate\\s+${qF(n)}(?:\\s+%%.*)?\\s*$`),i=t.split(/\r?\n/);for(let e=i.length-1;e>=0;e--)if(r.test(i[e]))return e+1;return null},YF=(e,t)=>{let n=e.match(BF);return n?Number.parseInt(n[1],10):t?JF(e,t):null},XF=(e,t)=>(e.match(t)||[]).length,ZF=(e,t)=>{if(!UF(e))return null;let n=YF(e,t),r=n?`Syntax error near line ${n}.`:`Syntax error in Mermaid diagram.`,i=[];return t&&(XF(t,/\[/g)!==XF(t,/\]/g)&&i.push(`Unbalanced square brackets in a node label.`),XF(t,/\(/g)!==XF(t,/\)/g)&&i.push(`Unbalanced parentheses in a node shape.`),XF(t,/\{/g)!==XF(t,/\}/g)&&i.push(`Unbalanced braces in a decision node.`),XF(t,/^\s*subgraph\b/gm)>XF(t,/^\s*end\s*$/gm)&&i.push("A block is missing an `end` statement.")),(/got 'NODE_STRING'/.test(e)||/got 'PS'/.test(e))&&i.push(`An extra character/token may appear after a node or label definition.`),i.length===0&&(i.push(`A node or edge line is malformed (missing/extra delimiters).`),i.push("A block (`subgraph`, `class`, etc.) may be incomplete.")),{summary:r,likelyCauses:[...new Set(i)]}},QF=e=>UF(e)?e.replace(/\n\s*Expecting[\s\S]*$/,``).trimEnd():e,$F=({error:e,canvasRef:t,loaded:n,hideErrorDetails:r,sourceText:i,autoFixAvailable:a,onApplyAutoFix:o})=>{let s=e?r?G(`chat.errors.mermaidParseError`):QF(e.message):null,c=e&&!r?ZF(e.message,i):null,l=!!a&&!!o&&!r,u=s?.split(/\r?\n/)??[];return(0,V.jsxs)(`div`,{className:`ttd-dialog-output-wrapper ${e?`ttd-dialog-output-wrapper--error`:``}`,children:[e&&(0,V.jsx)(`div`,{"data-testid":`ttd-dialog-output-error`,className:`ttd-dialog-output-error`,children:(0,V.jsxs)(`div`,{className:`ttd-dialog-output-error-content`,children:[(0,V.jsx)(`div`,{className:`ttd-dialog-output-error-icon`,children:Yx}),c&&(0,V.jsxs)(`div`,{className:`ttd-dialog-output-error-summary`,children:[(0,V.jsx)(`div`,{className:`ttd-dialog-output-error-summary__headline`,children:c.summary}),(0,V.jsx)(`div`,{className:`ttd-dialog-output-error-summary__label`,children:`Likely causes:`}),(0,V.jsx)(`ul`,{className:`ttd-dialog-output-error-summary__causes`,children:c.likelyCauses.map(e=>(0,V.jsx)(`li`,{children:e},e))})]}),(0,V.jsx)(`div`,{className:`ttd-dialog-output-error-message`,children:u.map((e,t)=>(0,V.jsxs)(`span`,{className:GF(e)?`ttd-dialog-output-error-message__caret`:void 0,children:[e,t<u.length-1?`
63
+ `:``]},`error-line-${t}`))}),!r&&(0,V.jsx)(`div`,{className:`ttd-dialog-output-error-autofix-slot`,children:l?(0,V.jsx)(mk,{className:`ttd-dialog-panel-button ttd-dialog-output-error-autofix`,onSelect:o,children:G(`mermaid.autoFixAvailable`)}):null})]})},`error`),n?(0,V.jsx)(`div`,{className:H(`ttd-dialog-output-canvas-container`,{invisible:!!e}),children:(0,V.jsx)(`div`,{ref:t,className:`ttd-dialog-output-canvas-content`})},`canvas`):(0,V.jsx)(GS,{size:`2rem`})]})},eI=({label:e,children:t,panelActions:n=[],onTextSubmitInProgess:r,renderTopRight:i,renderSubmitShortcut:a,className:o,panelActionJustifyContent:s=`flex-start`})=>{let c=e=>{if(e?.variant===`link`)return(0,V.jsxs)(`button`,{className:H(`ttd-dialog-panel-action-link`,e.className),onClick:e.action,disabled:e?.disabled||r,type:`button`,children:[e.label,e.icon&&(0,V.jsx)(`span`,{className:`ttd-dialog-panel-action-link__icon`,children:e.icon})]});if(e?.variant===`button`)return(0,V.jsxs)(mk,{className:H(`ttd-dialog-panel-button`,e.className),onSelect:e.action?e.action:()=>{},disabled:e?.disabled||r,children:[(0,V.jsxs)(`div`,{className:H({invisible:r}),children:[e?.label,e?.icon&&(0,V.jsx)(`span`,{children:e.icon})]}),r&&(0,V.jsx)(GS,{})]});if(e?.variant===`rateLimit`)return(0,V.jsx)(`div`,{className:H(`ttd-dialog-panel__rate-limit`,e.className),children:e.label})};return(0,V.jsxs)(`div`,{className:H(`ttd-dialog-panel`,o),children:[(e||i)&&(0,V.jsxs)(`div`,{className:`ttd-dialog-panel__header`,children:[typeof e==`string`?(0,V.jsx)(`label`,{children:e}):e,i?.()]}),t,(0,V.jsxs)(`div`,{className:H(`ttd-dialog-panel-button-container`,{invisible:!n.length}),style:{justifyContent:s},children:[n.filter(Boolean).map(e=>(0,V.jsx)(B.Fragment,{children:c(e)},e.label)),!r&&a?.()]})]})},tI=({children:e})=>(0,V.jsx)(`div`,{className:`ttd-dialog-panels`,children:e}),nI=()=>(0,V.jsxs)(`div`,{className:`ttd-dialog-submit-shortcut`,children:[(0,V.jsx)(`div`,{className:`ttd-dialog-submit-shortcut__key`,children:Z(`CtrlOrCmd`)}),(0,V.jsx)(`div`,{className:`ttd-dialog-submit-shortcut__key`,children:Z(`Enter`)})]}),rI=(e,t)=>{let n=YF(e,t);return n==null?null:n-1},iI=(e,t,n)=>{if(t<0||t>=e.length)return null;let r=n(e[t]);if(r===e[t])return null;let i=[...e];return i[t]=r,i.join(`
64
+ `)},aI=e=>{let t=e.match(/^(.*(?:\[[^\]]*]|\([^)]*\)|\{[^}]*}|"(?:[^"]*)"|'(?:[^']*)'))([A-Za-z]+)\s*$/);if(t)return t[1];let n=e.match(/^(.*(?:\[[^\]]*]|\([^)]*\)|\{[^}]*}|"(?:[^"]*)"|'(?:[^']*)'))([,;:])\s*$/);return n?n[1]:e},oI=e=>e.replace(/(\|[^|\n]+\|)\s*>\s*(?=[A-Za-z0-9_("[{'`])/g,`$1 `),sI=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),cI=(e,t)=>{let n=RegExp(`^\\s*deactivate\\s+${sI(t)}(?:\\s+%%.*)?\\s*$`),r=e.split(/\r?\n/);for(let e=r.length-1;e>=0;e--)if(n.test(r[e]))return r.filter((t,n)=>n!==e).join(`
65
+ `);return null},lI=(e,t)=>{let n=RegExp(`^\\s*deactivate\\s+${sI(t)}(?:\\s+%%.*)?\\s*$`),r=e.split(/\r?\n/),i=!1,a=r.filter(e=>n.test(e)?(i=!0,!1):!0);return i?a.join(`
66
+ `):null},uI=e=>{let t=(e.match(/^\s*subgraph\b/gm)||[]).length-(e.match(/^\s*end\s*$/gm)||[]).length;if(t<=0)return null;let n=Array.from({length:t},()=>`end`).join(`
67
+ `);return`${e.trimEnd()}
68
+ ${n}`},dI=e=>e.replace(/[“”]/g,`"`).replace(/[‘’]/g,`'`),fI=(e,t)=>{if(!WF(t)||!e.trim())return[];let n=[],r=new Set,i=t=>{!t||t===e||r.has(t)||(r.add(t),n.push(t))},a=KF(t);if(a&&(i(cI(e,a)),i(lI(e,a))),UF(t)){let n=e.split(/\r?\n/),r=rI(t,e),a=r==null?[]:[r,r-1,r+1];for(let e of a)i(iI(n,e,e=>aI(e))),i(iI(n,e,e=>oI(e)));i(oI(e)),i(uI(e));let o=dI(e);i(o===e?null:o)}return n},pI=({canvasRef:e,setError:t})=>{let n=e.current;if(!n)return;let r=n.parentElement;r&&(r.style.background=``,t(null),n.replaceChildren())},mI=async({canvasRef:e,mermaidToExcalidrawLib:t,mermaidDefinition:n,setError:r,data:i,theme:a})=>{let o=e.current,s=o?.parentElement;if(!o||!s)return{success:!1};if(!n)return pI({canvasRef:e,setError:r}),{success:!1};let c;try{let e=await t.api;try{c=await e.parseMermaidToExcalidraw(n)}catch(t){let r=t;if(!n.includes(`"`))return{success:!1,error:r};try{c=await e.parseMermaidToExcalidraw(n.replace(/"/g,`'`))}catch{return{success:!1,error:r}}}let{elements:l,files:u={}}=c;r(null),i.current={elements:mc(l,{regenerateIds:!0}),files:u};let d=await nO({elements:i.current.elements,files:i.current.files,exportPadding:10,maxWidthOrHeight:Math.max(s.offsetWidth,s.offsetHeight)*window.devicePixelRatio,appState:{exportWithDarkMode:a===F.DARK}});return s.style.background=`var(--default-bg-color)`,o.replaceChildren(d),{success:!0}}catch(e){return s.style.background=`var(--default-bg-color)`,n&&r(e),{success:!1,error:e}}},hI=e=>{wO.set(Lt.MERMAID_TO_EXCALIDRAW,e)},gI=({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`,fit:`scale-down`}),e.setOpenDialog(null),r&&n&&hI(n))},_I=`flowchart TD
69
+ A[Christmas] -->|Get money| B(Go shopping)
70
+ B --> C{Let me think}
71
+ C -->|One| D[Laptop]
72
+ C -->|Two| E[iPhone]
73
+ C -->|Three| F[Car]`,vI=ln(hI,300),yI=500,bI=4,xI=30,SI=e=>e instanceof Error?e.message:typeof e==`string`?e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`?e.message:``,CI=({mermaidToExcalidrawLib:e,isActive:t})=>{let[n,r]=(0,B.useState)(()=>wO.get(Lt.MERMAID_TO_EXCALIDRAW)||_I),i=(0,B.useDeferredValue)(n),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(null),l=a?.message?YF(a.message,i):null,u=(0,B.useRef)(null),d=(0,B.useRef)({elements:[],files:null}),f=Xz(),{theme:p}=cC();(0,B.useEffect)(()=>{t&&((async()=>{try{if(!i.trim()){pI({canvasRef:u,setError:o});return}let t=await mI({canvasRef:u,data:d,mermaidToExcalidrawLib:e,setError:o,mermaidDefinition:i,theme:p});if(!t.success){let e=t.error??Error(`Invalid mermaid definition`);o(e)}}catch(e){Ms()&&console.error(`Failed to parse mermaid definition`,e)}})(),vI(i))},[i,e,t,p]),(0,B.useEffect)(()=>()=>{vI.flush()},[]),(0,B.useEffect)(()=>{let n=a?.message??``,r=i;if(!(t&&WF(n)&&r.trim()&&e.loaded)){c(null);return}let o=fI(r,n);if(!o.length){c(null);return}let s=!1,l=setTimeout(async()=>{try{let t=await e.api,n=new Set([r]),i=o.map(e=>({text:e,depth:1})),a=0;for(;i.length>0&&a<xI;){let e=i.shift();if(!(!e||n.has(e.text))){n.add(e.text),a+=1;try{await t.parseMermaidToExcalidraw(e.text),s||c(e.text);return}catch(t){if(e.depth>=bI)continue;let r=SI(t);if(!r)continue;let a=fI(e.text,r);for(let t of a)n.has(t)||i.push({text:t,depth:e.depth+1})}}}}catch{}s||c(null)},yI);return()=>{s=!0,clearTimeout(l)}},[i,a?.message,t,e]);let m=()=>{gI({app:f,data:d,text:n,shouldSaveMermaidDataToStorage:!0})};return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`ttd-dialog-desc`,children:(0,V.jsx)(AO,{i18nKey:`mermaid.description`,flowchartLink:e=>(0,V.jsx)(`a`,{href:`https://mermaid.js.org/syntax/flowchart.html`,target:`_blank`,rel:`noreferrer`,children:e}),sequenceLink:e=>(0,V.jsx)(`a`,{href:`https://mermaid.js.org/syntax/sequenceDiagram.html`,target:`_blank`,rel:`noreferrer`,children:e}),classLink:e=>(0,V.jsx)(`a`,{href:`https://mermaid.js.org/syntax/classDiagram.html`,target:`_blank`,rel:`noreferrer`,children:e}),erdLink:e=>(0,V.jsx)(`a`,{href:`https://mermaid.js.org/syntax/entityRelationshipDiagram.html`,target:`_blank`,rel:`noreferrer`,children:e})})}),(0,V.jsxs)(tI,{children:[(0,V.jsx)(eI,{children:(0,V.jsx)(zF,{input:n,placeholder:G(`mermaid.inputPlaceholder`),onChange:e=>r(e),errorLine:l,onKeyboardSubmit:()=>{m()}})}),(0,V.jsx)(eI,{panelActions:[{action:()=>{m()},label:G(`mermaid.button`),icon:nS,variant:`button`}],renderSubmitShortcut:()=>(0,V.jsx)(nI,{}),children:(0,V.jsx)($F,{canvasRef:u,loaded:e.loaded,error:a,sourceText:n,autoFixAvailable:!!s,onApplyAutoFix:()=>{s&&r(s)}})})]})]})},wI=()=>(0,V.jsxs)(`div`,{className:`chat-interface__welcome-screen__welcome-message`,children:[(0,V.jsx)(`h3`,{children:G(`chat.placeholder.title`)}),(0,V.jsx)(`p`,{children:G(`chat.placeholder.description`)}),(0,V.jsx)(`p`,{children:G(`chat.placeholder.hint`)})]}),TI=({message:e,onMermaidTabClick:t,onAiRepairClick:n,onDeleteMessage:r,onInsertMessage:i,onRetry:a,rateLimitRemaining:o,isLastMessage:s,renderWarning:c,allowFixingParseError:l})=>{let[u,d]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(!e.error||!s)return;if(e.error&&!e.lastAttemptAt){d(!0);return}let t=Date.now()-e.lastAttemptAt,n=Math.max(0,5e3-t);if(n===0){d(!0);return}d(!1);let r=setTimeout(()=>{d(!0)},n);return()=>clearTimeout(r)},[e.error,e.lastAttemptAt,s]);let f=e=>e.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});if(e.type===`warning`){let t=c?.(e);return(0,V.jsx)(`div`,{className:`chat-message chat-message--system`,children:(0,V.jsxs)(`div`,{className:`chat-message__content`,children:[(0,V.jsxs)(`div`,{className:`chat-message__header`,children:[(0,V.jsx)(`span`,{className:`chat-message__role`,children:G(`chat.role.system`)}),(0,V.jsx)(`span`,{className:`chat-message__timestamp`,children:f(e.timestamp)})]}),(0,V.jsx)(`div`,{className:`chat-message__body`,children:(0,V.jsx)(`div`,{className:`chat-message__text`,children:t||(e.warningType===`messageLimitExceeded`?(0,V.jsxs)(V.Fragment,{children:[G(`chat.rateLimit.messageLimit`),(0,V.jsx)(`div`,{style:{marginTop:`10px`},children:(0,V.jsx)(yF,{onClick:()=>{window.open(`${ds.VITE_APP_PLUS_LP}/plus?utm_source=excalidraw&utm_medium=app&utm_content=ttdChatBanner#excalidraw-redirect`,`_blank`,`noopener`)},children:G(`chat.upsellBtnLabel`)})})]}):G(`chat.rateLimit.generalRateLimit`))})})]})})}return(0,V.jsxs)(`div`,{className:`chat-message chat-message--${e.type}`,children:[(0,V.jsxs)(`div`,{className:`chat-message__content`,children:[(0,V.jsxs)(`div`,{className:`chat-message__header`,children:[(0,V.jsx)(`span`,{className:`chat-message__role`,children:e.type===`user`?G(`chat.role.user`):G(`chat.role.assistant`)}),(0,V.jsx)(`span`,{className:`chat-message__timestamp`,children:f(e.timestamp)})]}),(0,V.jsx)(`div`,{className:`chat-message__body`,children:e.error?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`chat-message__error`,children:e.content}),e.errorType!==`parse`&&(0,V.jsxs)(`div`,{className:`chat-message__error_message`,children:[`Error: `,e.error||G(`chat.errors.generationFailed`)]}),e.errorType===`parse`&&l&&(0,V.jsxs)(`div`,{className:`chat-message__error_message`,children:[(0,V.jsx)(`p`,{children:G(`chat.errors.invalidDiagram`)}),(0,V.jsxs)(`div`,{className:`chat-message__error-actions`,children:[t&&(0,V.jsx)(`button`,{className:`chat-message__error-link`,onClick:()=>t(e),type:`button`,children:G(`chat.errors.fixInMermaid`)}),n&&(0,V.jsx)(`button`,{className:`chat-message__error-link`,onClick:()=>n(e),disabled:o===0,type:`button`,children:G(`chat.errors.aiRepair`)})]})]})]}):(0,V.jsxs)(`div`,{className:`chat-message__text`,children:[e.content,e.isGenerating&&(0,V.jsx)(`span`,{className:`chat-message__cursor`,children:`▋`})]})})]}),e.type===`assistant`&&!e.isGenerating&&(0,V.jsxs)(`div`,{className:`chat-message__actions`,children:[!e.error&&i&&(0,V.jsx)(`button`,{className:`chat-message__action`,onClick:()=>i(e),type:`button`,"aria-label":G(`chat.insert`),title:G(`chat.insert`),children:tS}),t&&e.content&&(0,V.jsx)(`button`,{className:`chat-message__action`,onClick:()=>t(e),type:`button`,"aria-label":G(`chat.viewAsMermaid`),title:G(`chat.viewAsMermaid`),children:Nx}),r&&e.errorType!==`network`&&(0,V.jsx)(`button`,{className:`chat-message__action chat-message__action--danger`,onClick:()=>r(e.id),type:`button`,"aria-label":G(`chat.deleteMessage`),title:G(`chat.deleteMessage`),children:rb}),e.errorType===`network`&&a&&s&&(0,V.jsx)(`button`,{className:H(`chat-message__action`,{invisible:!u}),onClick:()=>a(e),type:`button`,"aria-label":G(`chat.retry`),title:G(`chat.retry`),children:eS})]})]})},EI=({chatId:e,messages:t,currentPrompt:n,onPromptChange:r,onGenerate:i,isGenerating:a,rateLimits:o,onAbort:s,onMermaidTabClick:c,onAiRepairClick:l,onDeleteMessage:u,onInsertMessage:d,onRetry:f,renderWelcomeScreen:p,renderWarning:m})=>{let h=(0,B.useRef)(null),g=(0,B.useRef)(null);(0,B.useLayoutEffect)(()=>{h.current?.scrollIntoView()},[t]),(0,B.useEffect)(()=>{g.current&&g.current.focus()},[e]);let _=e=>{let t=e.target.value;r(t)},v=()=>{if(a&&s){s();return}let e=n.trim();e&&(i({prompt:e}),r(``))},y=e=>{e.key===M.ENTER&&!e.shiftKey&&(e.preventDefault(),a||v())},b=n.trim().length>3&&!a&&(o?.rateLimitRemaining??1)>0,x=a&&!!s;return(0,V.jsxs)(`div`,{className:`chat-interface`,children:[(0,V.jsxs)(`div`,{className:`chat-interface__messages`,children:[t.length===0?(0,V.jsx)(`div`,{className:`chat-interface__welcome-screen`,children:p?p({rateLimits:o??null}):(0,V.jsx)(wI,{})}):t.map((e,n)=>(0,V.jsx)(TI,{message:e,onMermaidTabClick:c,onAiRepairClick:l,onDeleteMessage:u,onInsertMessage:d,onRetry:f,rateLimitRemaining:o?.rateLimitRemaining,isLastMessage:n===t.length-1,renderWarning:m,allowFixingParseError:e.errorType===`parse`&&n===t.length-1},e.id)),(0,V.jsx)(`div`,{ref:h,id:`messages-end`})]}),(0,V.jsx)(`div`,{className:`chat-interface__input-container`,children:(0,V.jsx)(`div`,{className:`chat-interface__input-outer`,children:(0,V.jsxs)(`div`,{className:`chat-interface__input-wrapper`,style:{borderColor:a?`var(--dialog-border-color)`:void 0},children:[(0,V.jsx)(`textarea`,{ref:g,autoFocus:!0,className:`chat-interface__input`,value:n,onChange:_,onKeyDown:y,placeholder:a?G(`chat.generating`):o?.rateLimitRemaining===0?G(`chat.rateLimit.messageLimitInputPlaceholder`):t.length>0?G(`chat.inputPlaceholderWithMessages`):G(`chat.inputPlaceholder`,{shortcut:`Shift + Enter`}),disabled:o?.rateLimitRemaining===0,rows:1,cols:30,onInput:e=>{let t=e.target;t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,120)}px`}}),(0,V.jsx)(`button`,{className:`chat-interface__send-button`,onClick:v,disabled:!b&&!x,type:`button`,children:(0,V.jsx)(sw,{size:`1.5em`,icon:a?Gb:nS})})]})})})]})},DI=Ec(null),OI=Ec(!1),kI=Ec(null),AI=Ec({id:Cs(),messages:[],currentPrompt:``}),jI=(e,t)=>{let{messages:n}=e,r=ys(n,e=>e.type===`assistant`);if(r===-1)return e;let i=n[r],a=n.slice();return a[r]={...i,...t},{...e,messages:a}},MI=e=>{let{messages:t}=e;return t[ys(t,e=>e.type===`assistant`)]},NI=(e,t)=>{let n=t.map(e=>({...e,id:Cs(),timestamp:new Date}));return{...e,messages:[...e.messages,...n]}},PI=e=>{let t=ys(e.messages??[],e=>e.type===`assistant`);return t===-1?e:{...e,messages:e.messages.filter((e,n)=>n!==t)}},FI=e=>{let t=[];for(let n of e.messages)n.content&&(n.type===`user`||n.type===`assistant`)&&t.push({role:n.type,content:n.content});return t},II=()=>{let[e,t]=W(AI);return{addUserMessage:e=>{t(t=>NI(t,[{type:`user`,content:e}]))},addAssistantMessage:()=>{t(e=>NI(e,[{type:`assistant`,content:``,isGenerating:!0}]))},setAssistantError:(e,n=`other`,r)=>{let i=r?JSON.stringify({name:r instanceof Error?r.name:`Error`,message:r instanceof Error?r.message:String(r),stack:r instanceof Error?r.stack:void 0}):void 0;t(t=>jI(t,{isGenerating:!1,error:e,errorType:n,errorDetails:i}))},chatHistory:e,setChatHistory:t,setLastRetryAttempt:()=>{t(e=>jI(e,{lastAttemptAt:Date.now()}))}}},LI=e=>{let t=e.trim();return t.length<=50?t:`${t.substring(0,47)}...`},RI=Ec([]),zI=Ec(!1),BI=Ec(!1),VI=({persistenceAdapter:e})=>{let[t]=W(AI),[n,r]=W(RI),[i,a]=W(zI),[o,s]=W(BI),c=(0,B.useRef)(n);c.current=n;let l=t?.messages[t?.messages.length-1],u=(0,B.useCallback)(async()=>{if(!(o||i)){a(!0);try{let t=await e.loadChats();r(t),s(!0)}catch(e){console.warn(`Failed to load chats:`,e),r([]),s(!0)}finally{a(!1)}}},[o,i,r,a,s,e]);(0,B.useEffect)(()=>{u()},[]);let d=(0,B.useCallback)(async()=>{if(t.messages.length===0)return;let n=t.messages.find(e=>e.type===`user`);if(!n||typeof n.content!=`string`)return;let i=LI(n.content),a=c.current,o=a.find(e=>e.id===t.id),s=!o||o.messages.length!==t.messages.length||o.messages.some((e,n)=>e.id!==t.messages[n]?.id||e.content!==t.messages[n]?.content),l={id:t.id,title:i,messages:t.messages.filter(e=>e.type===`user`||e.type===`assistant`).map(e=>({...e,timestamp:e.timestamp instanceof Date?e.timestamp:new Date(e.timestamp)})),currentPrompt:t.currentPrompt,timestamp:s?Date.now():o?.timestamp??Date.now()},u=[...a.filter(e=>e.id!==t.id),l].sort((e,t)=>t.timestamp-e.timestamp).slice(0,10);r(u);try{await e.saveChats(u)}catch(e){console.warn(`Failed to save chats:`,e)}},[t,r,e]);return(0,B.useEffect)(()=>{l?.isGenerating||d()},[t.messages?.length,l?.id,l?.isGenerating]),{savedChats:n,saveCurrentChat:d,deleteChat:(0,B.useCallback)(async t=>{let n=c.current.filter(e=>e.id!==t);r(n);try{await e.saveChats(n)}catch(e){console.warn(`Failed to save after delete:`,e)}return n},[r,e]),restoreChat:(0,B.useCallback)(e=>e,[]),createNewChatId:(0,B.useCallback)(async()=>(await d(),Cs()),[d])}},HI=e=>{let t=e.trim();if(!t)return!1;let n=(t.match(/\[/g)||[]).length,r=(t.match(/\]/g)||[]).length,i=(t.match(/\{/g)||[]).length,a=(t.match(/\}/g)||[]).length,o=(t.match(/\(/g)||[]).length,s=(t.match(/\)/g)||[]).length;if(n!==r||i!==a||o!==s)return!1;let c=t.split(`
74
+ `).pop()?.trim()||``;return![/-->$/,/--$/,/-\.$/,/==>$/,/==$/,/~~$/,/::$/,/:$/,/\|$/,/&$/].some(e=>e.test(c))},UI=300,WI=3e3,GI=100,KI=100,qI=({mermaidToExcalidrawLib:e,canvasRef:t})=>{let[n]=W(AI),[,r]=W(kI),[i,a]=W(OI),o=(0,B.useRef)(!1),s=(0,B.useMemo)(()=>MI(n),[n]),c=(0,B.useRef)(s);(0,B.useEffect)(()=>{c.current=s},[s]);let l=(0,B.useRef)({elements:[],files:null}),u=(0,B.useRef)(0),d=(0,B.useRef)(null),f=(0,B.useRef)(!1),p=(0,B.useRef)(UI),{theme:m}=cC(),h=(0,B.useCallback)(async n=>{if(!n.trim()||!e.loaded||o.current)return!1;o.current=!0;let i=performance.now(),a=await mI({canvasRef:t,data:l,mermaidToExcalidrawLib:e,setError:r,mermaidDefinition:n,theme:m});return performance.now()-i<GI?p.current=UI:p.current=WI,o.current=!1,a.success},[t,e,r,m]),g=(0,B.useMemo)(()=>{let e=async e=>{let t=Date.now(),n=t-u.current,r=p.current;if(!HI(e)){f.current||=(u.current=Math.max(u.current,t-r+KI),!0),d.current=e;return}if(f.current=!1,n<r){d.current=e;return}d.current=null;let i=await h(e);u.current=Date.now(),i||(u.current=u.current-r+KI,f.current=!0)};return e.flush=async()=>{if(d.current){let e=d.current;d.current=null,await h(e),u.current=Date.now()}},e.cancel=()=>{d.current=null},e},[h]),_=(0,B.useCallback)(()=>{u.current=0,d.current=null,f.current=!1,p.current=UI},[]);return(0,B.useEffect)(()=>{s?.content&&s?.isGenerating?g(s.content):s?.isGenerating||(g.flush(),_(),s?.content&&g(s.content))},[_,g,s?.isGenerating,s?.content]),(0,B.useEffect)(()=>{let e=c.current;!e?.content||e.error||i&&h(e.content)},[n?.id,h,i]),(0,B.useEffect)(()=>{if(n.messages?.filter(e=>e.type===`assistant`).length)i||a(!0);else{let e=t.current;if(e){let t=e.parentElement;t&&(t.style.background=``,e.replaceChildren())}a(!1)}},[n.messages,a,t,i]),{data:l}},JI=3,YI=1e4,XI=({onTextSubmit:e})=>{let[,t]=W(kI),[n,r]=W(DI),[i,a]=W(AI),{addUserMessage:o,addAssistantMessage:s,setAssistantError:c}=II(),l=(0,B.useRef)(null),u=e=>e.length>YI||e.length<JI||n?.rateLimitRemaining===0?(e.length<JI&&t(Error(G(`chat.errors.promptTooShort`,{min:JI}))),e.length>YI&&t(Error(G(`chat.errors.promptTooLong`,{max:YI}))),!1):!0;return{onGenerate:async({prompt:n,isRepairFlow:d=!1})=>{if(!u(n))return;l.current&&l.current.abort(),t(null);let f=new AbortController;l.current=f,d?a(e=>jI(e,{isGenerating:!0,content:``,error:void 0,errorType:void 0,errorDetails:void 0})):(o(n),s());try{rC(`ai`,`generate`,`ttd`);let{generatedResponse:o,error:s,rateLimit:l,rateLimitRemaining:u}=await e({messages:[...FI(i).slice(-3),{role:`user`,content:n}],onStreamCreated:()=>{d&&a(e=>jI(e,{content:``,error:``,isGenerating:!0}))},onChunk:e=>{a(t=>jI(t,{content:MI(t).content+e}))},signal:f.signal});if(a(e=>jI(e,{isGenerating:!1})),Ue(l)&&Ue(u)&&r({rateLimit:l,rateLimitRemaining:u}),(s?.status===429||u===0)&&a(e=>(s?.status===429&&(e=PI(e)),e={...e,messages:e.messages.filter(e=>e.type!==`warning`||e.warningType===`rateLimitExceeded`||e.warningType===`messageLimitExceeded`)},NI(e,[{type:`warning`,warningType:u===0?`messageLimitExceeded`:`rateLimitExceeded`}]))),s){if(s.name===`AbortError`||s.message===`Aborted`||f.signal.aborted)return;let e=Error(s.message||G(`chat.errors.requestFailed`));s.status!==429&&c(e.message,`network`),t(e);return}try{await xc(o??``),rC(`ai`,`mermaid parse success`,`ttd`)}catch(e){rC(`ai`,`mermaid parse failed`,`ttd`);let n=Error(e.message||G(`chat.errors.mermaidParseError`));c(n.message,`parse`),t(n)}}catch(e){let n=Error(e.message||G(`chat.errors.generationFailed`));c(n.message,`other`),t(n)}finally{l.current=null}},handleAbort:()=>{l.current&&l.current.abort()}}},ZI=({persistenceAdapter:e})=>{let t=ly(kI),[n,r]=W(AI),[i,a]=(0,B.useState)(!1),{restoreChat:o,deleteChat:s,createNewChatId:c}=VI({persistenceAdapter:e}),l=(0,B.useCallback)(e=>{let n=e.messages.map(e=>({...e,timestamp:e.timestamp instanceof Date?e.timestamp:new Date(e.timestamp)})),i={id:e.id,messages:n,currentPrompt:``},a=MI(i);t(a?.error?Error(a?.error):null),r(i)},[t,r]),u=(0,B.useCallback)(async()=>{let e=await c();r({id:e,messages:[],currentPrompt:``}),t(null)},[c,r,t]);return{isMenuOpen:i,onRestoreChat:(0,B.useCallback)(e=>{let t=o(e);l(t),a(!1)},[o,l]),handleDeleteChat:(0,B.useCallback)(async(e,t)=>{t.stopPropagation();let r=e===n.id,i=await s(e);if(r)if(i.length>0){let e=i[0];l(e)}else await u()},[n.id,s,l,u]),handleNewChat:(0,B.useCallback)(async()=>{await u(),a(!1)},[u]),handleMenuToggle:(0,B.useCallback)(()=>{a(e=>!e)},[]),handleMenuClose:(0,B.useCallback)(()=>{a(!1)},[])}},QI=({isOpen:e,onToggle:t,onClose:n,onNewChat:r,onRestoreChat:i,onDeleteChat:a,isNewChatBtnVisible:o,savedChats:s,activeSessionId:c,disabled:l})=>(0,V.jsxs)(`div`,{className:`ttd-chat-history-menu`,children:[o&&(0,V.jsx)(yF,{onClick:r,disabled:l,children:G(`chat.newChat`)}),s.length>0&&(0,V.jsx)(`div`,{className:`ttd-dialog-panel__menu-wrapper`,children:(0,V.jsxs)(Q,{open:e,children:[(0,V.jsx)(Q.Trigger,{onToggle:t,className:`ttd-dialog-menu-trigger`,disabled:l,title:G(`chat.menu`),"aria-label":G(`chat.menu`),children:fS}),(0,V.jsx)(Q.Content,{onClickOutside:n,onSelect:n,children:(0,V.jsx)(V.Fragment,{children:s.map(e=>(0,V.jsxs)(Q.ItemCustom,{className:H(`ttd-chat-menu-item`,{"ttd-chat-menu-item--active":e.id===c}),onClick:()=>{i(e)},children:[(0,V.jsx)(`span`,{className:`ttd-chat-menu-item__title`,children:e.title}),(0,V.jsx)(`button`,{className:`ttd-chat-menu-item__delete`,onClick:t=>a(e.id,t),title:G(`chat.deleteChat`),"aria-label":G(`chat.deleteChat`),type:`button`,children:rb})]},e.id))})})]})})]}),$I=({chatId:e,messages:t,currentPrompt:n,onPromptChange:r,onGenerate:i,isGenerating:a,generatedResponse:o,isMenuOpen:s,onMenuToggle:c,onMenuClose:l,onNewChat:u,onRestoreChat:d,onDeleteChat:f,savedChats:p,activeSessionId:m,onAbort:h,onMermaidTabClick:g,onAiRepairClick:_,onDeleteMessage:v,onInsertMessage:y,onRetry:b,onViewAsMermaid:x,renderWelcomeScreen:S,renderWarning:C})=>{let[w]=W(DI),T=(()=>{let e=[];return w&&e.push({label:G(`chat.rateLimitRemaining`,{count:w.rateLimitRemaining}),variant:`rateLimit`,className:w.rateLimitRemaining<5?`ttd-dialog-panel__rate-limit--danger`:``}),o&&e.push({action:x,label:G(`chat.viewAsMermaid`),icon:(0,V.jsx)(sw,{icon:nS}),variant:`link`}),e})();return(0,V.jsx)(eI,{label:(0,V.jsxs)(`div`,{className:`ttd-dialog-panel__label-wrapper`,children:[(0,V.jsx)(`div`,{className:`ttd-dialog-panel__label-group`}),(0,V.jsx)(`div`,{className:`ttd-dialog-panel__header-right`,children:(0,V.jsx)(QI,{isNewChatBtnVisible:!!t.length,isOpen:s,onToggle:c,onClose:l,onNewChat:u,onRestoreChat:d,onDeleteChat:f,savedChats:p,activeSessionId:m,disabled:a})})]}),className:`ttd-dialog-chat-panel`,panelActionJustifyContent:T.length===2?`space-between`:T.length===1&&T[0].variant===`rateLimit`?`flex-start`:`flex-end`,panelActions:T,children:(0,V.jsx)(EI,{chatId:e,messages:t,currentPrompt:n,onPromptChange:r,onGenerate:i,isGenerating:a,generatedResponse:o,onAbort:h,onMermaidTabClick:g,onAiRepairClick:_,onDeleteMessage:v,onInsertMessage:y,onRetry:b,rateLimits:w,renderWelcomeScreen:S,renderWarning:C})})},eL=({canvasRef:e,error:t,loaded:n,onInsert:r,hideErrorDetails:i})=>(0,V.jsx)(eI,{panelActionJustifyContent:`flex-end`,panelActions:[{action:r,label:G(`chat.insert`),icon:nS,variant:`button`}],className:`ttd-dialog-preview-panel`,children:(0,V.jsx)($F,{canvasRef:e,error:t,loaded:n,hideErrorDetails:i})}),tL=({mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i})=>{let a=Xz(),o=rB(),s=(0,B.useRef)(null),[c,l]=W(kI),[u,d]=W(AI),f=uy(OI),{savedChats:p}=VI({persistenceAdapter:i}),m=MI(u),{setLastRetryAttempt:h}=II(),{data:g}=qI({canvasRef:s,mermaidToExcalidrawLib:e}),{onGenerate:_,handleAbort:v}=XI({onTextSubmit:t}),{isMenuOpen:y,onRestoreChat:b,handleDeleteChat:x,handleNewChat:S,handleMenuToggle:C,handleMenuClose:w}=ZI({persistenceAdapter:i});return(0,V.jsxs)(`div`,{className:`ttd-dialog-layout ${f?`ttd-dialog-layout--split`:`ttd-dialog-layout--chat-only`}`,children:[(0,V.jsx)($I,{chatId:u.id,messages:u.messages,currentPrompt:u.currentPrompt,onPromptChange:e=>{d(t=>({...t,currentPrompt:e}))},onGenerate:_,isGenerating:m?.isGenerating??!1,generatedResponse:m?.content,isMenuOpen:y,onMenuToggle:C,onMenuClose:w,onNewChat:S,onRestoreChat:b,onDeleteChat:x,savedChats:p,activeSessionId:u.id,onAbort:v,onMermaidTabClick:e=>{let t=e.content||``;t&&(hI(t),o({openDialog:{name:`ttd`,tab:`mermaid`}}))},onAiRepairClick:async e=>{let t=e.content||``,n=e.error||``;if(!t)return;let r=`Fix the error in this Mermaid diagram. The diagram is:
75
+
76
+ \`\`\`mermaid
77
+ ${t}
78
+ \`\`\`
79
+
80
+ The exception/error is: ${n}
81
+
82
+ Please fix the Mermaid syntax and regenerate a valid diagram.`;await _({prompt:r,isRepairFlow:!0})},onDeleteMessage:e=>{let t=u.messages.findIndex(t=>t.id===e&&t.type===`assistant`),n=u.messages.slice(0,t-1);d({...u,messages:n})},onInsertMessage:async t=>{let n=t.content||``;if(!n.trim()||!e.loaded)return;let r={current:{elements:[],files:null}};(await mI({canvasRef:s,data:r,mermaidToExcalidrawLib:e,setError:l,mermaidDefinition:n,theme:a.state.theme})).success&&gI({app:a,data:r,text:n,shouldSaveMermaidDataToStorage:!0})},onRetry:async e=>{let t=u.messages.findIndex(t=>t.id===e.id);if(t>0){let e=u.messages[t-1];e.type===`user`&&typeof e.content==`string`&&(h(),await _({prompt:e.content,isRepairFlow:!0}))}},onViewAsMermaid:()=>{typeof m?.content==`string`&&(hI(m.content),o({openDialog:{name:`ttd`,tab:`mermaid`}}))},renderWarning:r,renderWelcomeScreen:n}),f&&(0,V.jsx)(eL,{canvasRef:s,hideErrorDetails:m?.errorType===`parse`,error:c,loaded:e.loaded,onInsert:()=>{gI({app:a,data:g})}})]})},nL=({mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i})=>(0,V.jsx)(tL,{mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i}),rL=e=>{let t=rB(),n=(0,B.useRef)(null),r=(0,B.useRef)(0);return(0,V.jsx)(mv,{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 e=a.offsetHeight||0;e>r.current&&(r.current=e,a.style.minHeight=`min(${r.current}px, 100%)`)}e.dialog===`ttd`&&Hn([`text-to-diagram`,`mermaid`],i)&&t({openDialog:{name:e.dialog,tab:i}})},children:e.children})};rL.displayName=`TTDDialogTabs`;var iL=rL,aL=({children:e,...t})=>(0,V.jsx)(hv,{className:`ttd-dialog-triggers`,...t,children:e});aL.displayName=`TTDDialogTabTriggers`;var oL=({children:e,tab:t,onSelect:n,...r})=>(0,V.jsx)(gv,{value:t,asChild:!0,onSelect:n,children:(0,V.jsx)(`button`,{type:`button`,className:`ttd-dialog-tab-trigger`,...r,children:e})});oL.displayName=`TTDDialogTabTrigger`;var sL=({tab:e,children:t,...n})=>(0,V.jsx)(_v,{...n,value:e,children:t});sL.displayName=`TTDDialogTab`;var cL=e=>{let t=cC();return t.openDialog?.name===`ttd`?(0,V.jsx)(lL,{...e,tab:t.openDialog.tab}):null};cL.WelcomeMessage=wI;var lL=UP(`TTDDialogBase`,({tab:e,...t})=>{let r=Xz(),[i,a]=(0,B.useState)({loaded:!1,api:n(()=>import(`./excalidraw-mermaid-stub-DE5FTiZB.js`),__vite__mapDeps([70,71]),import.meta.url)});return(0,B.useEffect)(()=>{(async()=>{await i.api,a(e=>({...e,loaded:!0}))})()},[i.api]),(0,V.jsx)(Dk,{className:`ttd-dialog`,onCloseRequest:()=>{r.setOpenDialog(null)},size:1520,title:!1,...t,autofocus:!1,children:(0,V.jsxs)(iL,{dialog:`ttd`,tab:e,children:[`__fallback`in t&&t.__fallback?(0,V.jsx)(`p`,{className:`dialog-mermaid-title`,children:G(`mermaid.title`)}):(0,V.jsxs)(aL,{children:[(0,V.jsx)(oL,{tab:`text-to-diagram`,children:(0,V.jsxs)(`div`,{className:`ttd-dialog-tab-trigger__content`,children:[G(`labels.textToDiagram`),(0,V.jsx)(`div`,{className:`ttd-dialog-tab-trigger__badge`,children:G(`chat.aiBeta`)})]})}),(0,V.jsx)(oL,{tab:`mermaid`,children:G(`mermaid.label`)})]}),!(`__fallback`in t)&&(0,V.jsx)(sL,{className:`ttd-dialog-content`,tab:`text-to-diagram`,children:(0,V.jsx)(nL,{mermaidToExcalidrawLib:i,onTextSubmit:t.onTextSubmit,renderWelcomeScreen:t.renderWelcomeScreen,renderWarning:t.renderWarning,persistenceAdapter:t.persistenceAdapter})}),(0,V.jsx)(sL,{className:`ttd-dialog-content`,tab:`mermaid`,children:(0,V.jsx)(CI,{mermaidToExcalidrawLib:i,isActive:e===`mermaid`})})]})})}),uL=.01,dL=10,fL=(e,t)=>!(t===`angle`&&N(e)),pL=(e,t)=>{let n=e+t/2;return n-n%t},mL=(e,t,n)=>Object.keys(e).map(e=>({original:(n??t).get(e),latest:t.get(e)})).filter(e=>e.original!==void 0&&e.latest!==void 0),hL=(e,t,n,r,i,o,s=!0)=>{if(pa(n)&&(n.startBinding||n.endBinding)){if(Math.abs(e-n.x)<10&&Math.abs(t-n.y)<10)return;ye(n,`start`,r),ye(n,`end`,r)}let c=r.getNonDeletedElementsMap(),l=c.get(n.id);if(!l)return;let[u,d]=[n.x+n.width/2,n.y+n.height/2],[f,p]=ot(a(n.x,n.y),a(u,d),n.angle),m=e-f,h=t-p,[g,_]=ot(a(e,t),a(u+m,d+h),-n.angle);r.mutateElement(l,{x:g,y:_},{informMutation:s,isDragging:!1}),It(l,r,i);let v=So(n,o);if(v){let e=c.get(v.id);e&&r.mutateElement(e,{x:v.x+m,y:v.y+h},{informMutation:s,isDragging:!1})}if(N(n)){let e=D(o,n.id);e.forEach(t=>{let n=c.get(t.id);if(!n)return;let[o,l]=[t.x+t.width/2,t.y+t.height/2],[u,d]=ot(a(t.x,t.y),a(o,l),t.angle),[f,p]=ot(a(Math.round(u+m),Math.round(d+h)),a(o+m,l+h),-t.angle);r.mutateElement(n,{x:f,y:p},{informMutation:s,isDragging:!1}),It(n,r,i,{simultaneouslyUpdated:Sa(e)})})}},gL=(e,t)=>{let n=yr(t).map(t=>Tt(e,t).reduce((e,t)=>(e[t.id]=!0,e),{}));return e.filter(e=>!fo(e)).forEach(e=>{n.push({[e.id]:!0})}),n},_L=({label:e,icon:t,dragInputCallback:n,value:r,elements:i,editable:a=!0,shouldKeepAspectRatio:o,property:s,scene:c,appState:l,sensitivity:u=1,dragFinishedCallback:d})=>{let f=Xz(),p=rB(),m=(0,B.useRef)(null),h=(0,B.useRef)(null),[g,_]=(0,B.useState)(r.toString()),v=(0,B.useRef)(null);v.current||={originalAppState:Xi(l),originalElements:i,lastUpdatedValue:g,updatePending:!1},(0,B.useEffect)(()=>{let e=r.toString();_(e),v.current.lastUpdatedValue=e},[r]);let y=(e,t,i)=>{if(!v.current.updatePending)return!1;v.current.updatePending=!1;let a=Number(e);if(isNaN(a)){_(r.toString());return}let l=Number(a.toFixed(2)),u=Number(r);(isNaN(u)||Math.abs(l-u)>=uL)&&(v.current.lastUpdatedValue=e,n({accumulatedChange:0,instantChange:0,originalElements:t,originalElementsMap:f.scene.getNonDeletedElementsMap(),shouldKeepAspectRatio:o,shouldChangeByStepSize:!1,scene:c,nextValue:l,property:s,originalAppState:i,setInputValue:e=>_(String(e)),app:f,setAppState:p}),f.syncActionResult({captureUpdate:P.IMMEDIATELY}))},b=(0,B.useRef)({});return b.current.handleInputValue=y,(0,B.useEffect)(()=>{let e=m.current,t=b.current;return()=>{let n=e?.value;n&&t.handleInputValue?.(n,v.current.originalElements,v.current.originalAppState),window.removeEventListener(L.POINTER_MOVE,t.onPointerMove,!1),window.removeEventListener(L.POINTER_UP,t.onPointerUp,!1)}},[a]),a?(0,V.jsxs)(`div`,{className:H(`drag-input-container`,!a&&`disabled`),"data-testid":e,children:[(0,V.jsx)(`div`,{className:`drag-input-label`,ref:h,onPointerDown:e=>{if(m.current&&a){document.body.classList.add(`excalidraw-cursor-resize`);let e=Number(m.current.value);isNaN(e)&&(e=0);let t=null,r=f.scene.getNonDeletedElements().reduce((e,t)=>(e.set(t.id,cr(t)),e),new Map),a=i.map(e=>r.get(e.id)),h=Xi(l),g=0,v=0,y=e=>{if(t&&r!==null&&a!==null){let i=e.clientX-t.x;i!==0&&(v+=i,Math.abs(v)>=u&&(v=Math.sign(v)*Math.floor(Math.abs(v)/u),g+=v,n({accumulatedChange:g,instantChange:v,originalElements:a,originalElementsMap:r,shouldKeepAspectRatio:o,shouldChangeByStepSize:e.shiftKey,property:s,scene:c,originalAppState:h,setInputValue:e=>_(String(e)),app:f,setAppState:p}),v=0))}t={x:e.clientX,y:e.clientY}},x=()=>{window.removeEventListener(L.POINTER_MOVE,y,!1),f.syncActionResult({captureUpdate:P.IMMEDIATELY}),d?.({app:f,setAppState:p,originalElements:a,originalAppState:h}),t=null,g=0,v=0,a=null,r=null,document.body.classList.remove(`excalidraw-cursor-resize`),window.removeEventListener(L.POINTER_UP,x,!1)};b.current.onPointerMove=y,b.current.onPointerUp=x,window.addEventListener(L.POINTER_MOVE,y,!1),window.addEventListener(L.POINTER_UP,x,!1)}},onPointerEnter:()=>{h.current&&(h.current.style.cursor=`ew-resize`)},children:t?(0,V.jsx)(sw,{icon:t}):e}),(0,V.jsx)(`input`,{className:`drag-input`,autoComplete:`off`,spellCheck:`false`,onKeyDown:e=>{if(a){let t=e.target;t instanceof HTMLInputElement&&e.key===M.ENTER&&(y(t.value,i,l),f.focusContainer())}},ref:m,value:g,onChange:e=>{v.current.updatePending=!0,_(e.target.value)},onFocus:e=>{e.target.select(),v.current.originalElements=i,v.current.originalAppState=Xi(l)},onBlur:e=>{g?a&&y(e.target.value,v.current.originalElements,v.current.originalAppState):_(r.toString())},disabled:!a})]}):null},vL=15,yL=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i,app:a})=>{let o=i.getNonDeletedElementsMap(),s=t[0];if(s&&!Ti(s)){let t=o.get(s.id);if(!t)return;if(r!==void 0){let e=zr(r);i.mutateElement(t,{angle:e}),It(t,i,a.state);let n=So(t,o);n&&!Mr(t)&&i.mutateElement(n,{angle:e});return}let c=(Math.round(hr(s.angle)*100)/100+Math.round(e))%360;n&&(c=pL(c,vL)),c=c<0?c+360:c;let l=zr(c);i.mutateElement(t,{angle:l}),It(t,i,a.state);let u=So(t,o);u&&!Mr(t)&&i.mutateElement(u,{angle:l})}},bL=({element:e,scene:t,appState:n,property:r})=>(0,V.jsx)(_L,{label:`A`,icon:Vx,value:Math.round(hr(e.angle)%360*100)/100,elements:[e],dragInputCallback:yL,editable:fL(e,`angle`),scene:t,appState:n,property:r}),xL=5,SL=({property:e,scene:t,appState:n,setAppState:r})=>(0,V.jsx)(_L,{label:`Grid step`,sensitivity:8,elements:[],dragInputCallback:({nextValue:e,instantChange:t,shouldChangeByStepSize:n,setInputValue:i})=>{r(r=>{let a;return e?a=e:t&&(a=n?pL(r.gridStep+xL*Math.sign(t),xL):r.gridStep+t),a?(a=ti(a),i(a),{gridStep:a}):(i(r.gridStep),null)})},scene:t,value:n.gridStep,property:e,appState:n}),CL=10,wL=e=>e.type===`image`,TL=({accumulatedChange:e,originalElements:t,originalElementsMap:n,shouldKeepAspectRatio:r,shouldChangeByStepSize:i,nextValue:a,property:o,originalAppState:s,instantChange:c,scene:l,app:u,setAppState:d})=>{let f=l.getNonDeletedElementsMap(),p=t[0],m=f.get(p.id);if(p&&m){let t=r||wL(p),u=p.width/p.height;if(s.croppingElementId===p.id){let e=f.get(p.id);if(!e||!Ce(e)||!e.crop)return;let t=e.crop,n={...t},r=e.scale[0]===-1,i=e.scale[1]===-1,{width:s,height:u}=nn(e),d=t.naturalWidth/s,m=t.naturalHeight/u,h=r?t.width+t.x:t.naturalWidth-t.x,g=i?t.height+t.y:t.naturalHeight-t.y,_=10*d,v=10*m;if(a!==void 0){if(o===`width`){let e=Fe(a*d,_,h);n={...n,width:e,x:r?t.x+t.width-e:t.x}}else if(o===`height`){let e=Fe(a*m,v,g);n={...n,height:e,y:i?t.y+t.height-e:t.y}}l.mutateElement(e,{crop:n,width:n.width/(t.naturalWidth/s),height:n.height/(t.naturalHeight/u)});return}let y=o===`width`?c:0,b=o===`height`?c:0,x=Fe(t.width+y,_,h),S=Fe(t.height+b,_,g);n={...t,x:r?t.x+t.width-x:t.x,y:i?t.y+t.height-S:t.y,width:x,height:S},l.mutateElement(e,{crop:n,width:n.width/(t.naturalWidth/s),height:n.height/(t.naturalHeight/u)});return}if(a!==void 0){if(_e(Math.max(o===`width`?a:t?a*u:p.width,1),Math.max(o===`height`?a:t?a/u:p.height,1),m,p,n,l,o===`width`?`e`:`s`,{shouldMaintainAspectRatio:t}),N(m)){let e=Ws(l.getElementsIncludingDeleted(),m,s,l.getNonDeletedElementsMap()),t=po(l.getElementsIncludingDeleted(),e,m);l.replaceAllElements(t)}return}{let r=o===`width`?e:0,a=o===`height`?e:0,c=Math.max(0,p.width+r);o===`width`&&(c=i?pL(c,CL):Math.round(c));let f=Math.max(0,p.height+a);o===`height`&&(f=i?pL(f,CL):Math.round(f)),t&&(o===`width`?f=Math.round(c/u*100)/100:c=Math.round(f*u*100)/100),f=Math.max(1,f),c=Math.max(1,c),_e(c,f,m,p,n,l,o===`width`?`e`:`s`,{shouldMaintainAspectRatio:t}),N(m)&&d({elementsToHighlight:Sa(Ws(l.getElementsIncludingDeleted(),m,s,l.getNonDeletedElementsMap()))})}}},EL=({setAppState:e,app:t,originalElements:n,originalAppState:r})=>{let i=t.scene.getNonDeletedElementsMap(),a=n?.[0],o=a&&i.get(a.id);if(o&&N(o)){let n=Ws(t.scene.getElementsIncludingDeleted(),o,r,t.scene.getNonDeletedElementsMap()),i=po(t.scene.getElementsIncludingDeleted(),n,o);t.scene.replaceAllElements(i),e({elementsToHighlight:null})}},DL=({property:e,element:t,scene:n,appState:r})=>{let i=Lo(e===`width`?t.width:t.height,2);if(r.croppingElementId&&r.croppingElementId===t.id&&Ce(t)&&t.crop){let{width:n,height:r}=nn(t);if(e===`width`){let e=n/t.crop.naturalWidth;i=Lo(t.crop.width*e,2)}if(e===`height`){let e=r/t.crop.naturalHeight;i=Lo(t.crop.height*e,2)}}return(0,V.jsx)(_L,{label:e===`width`?`W`:`H`,elements:[t],dragInputCallback:TL,value:i,editable:fL(t,e),scene:n,appState:r,property:e,dragFinishedCallback:EL})},OL=4,kL=4,AL=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i})=>{let a=i.getNonDeletedElementsMap(),o=t[0];if(o){let t=a.get(o.id);if(!t||!R(t))return;let s;if(r!==void 0)s=Math.max(Math.round(r),OL);else if(o.type===`text`){let t=Math.round(o.fontSize);s=Math.max(t+Math.round(e),OL),n&&(s=pL(s,kL))}s&&(i.mutateElement(t,{fontSize:s}),Fn(t,i.getContainerElement(t),i))}},jL=({element:e,scene:t,appState:n,property:r})=>{let i=R(e)?e:ai(e)?So(e,t.getNonDeletedElementsMap()):null;return i?(0,V.jsx)(_L,{label:`F`,value:Math.round(i.fontSize*10)/10,elements:[i],dragInputCallback:AL,icon:Ax,appState:n,scene:t,property:r}):null},ML=15,NL=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,property:i,scene:a})=>{let o=a.getNonDeletedElementsMap(),s=t.map(e=>o.get(e.id)).filter(e=>e&&!fo(e)&&fL(e,i)),c=t.filter(e=>!fo(e)&&fL(e,i));if(r!==void 0){let e=zr(r);for(let t of s){if(!t)continue;a.mutateElement(t,{angle:e});let n=So(t,o);n&&!Mr(t)&&a.mutateElement(n,{angle:e})}a.triggerUpdate();return}for(let t=0;t<s.length;t++){let r=s[t];if(!r)continue;let i=c[t],l=(Math.round(hr(i.angle)*100)/100+Math.round(e))%360;n&&(l=pL(l,ML)),l=l<0?l+360:l;let u=zr(l);a.mutateElement(r,{angle:u});let d=So(r,o);d&&!Mr(r)&&a.mutateElement(d,{angle:u})}a.triggerUpdate()},PL=({elements:e,scene:t,appState:n,property:r})=>{let i=e.filter(e=>!fo(e)&&fL(e,`angle`)),a=i.map(e=>Math.round(hr(e.angle)%360*100)/100);return(0,V.jsx)(_L,{label:`A`,icon:Vx,value:new Set(a).size===1?a[0]:`Mixed`,elements:e,dragInputCallback:NL,editable:i.some(e=>fL(e,`angle`)),appState:n,scene:t,property:r})},FL=10,IL=(e,t,n,r)=>{let i=r.x-e,a=r.y-t,o=r.width*n,s=r.height*n;return{width:o,height:s,x:e+i*n,y:t+a*n,...xe(r,o,s,!1),...R(r)?{fontSize:r.fontSize*n}:{}}},LL=(e,t,n,r,i,a,o,c)=>{let l=c.getNonDeletedElementsMap(),u=IL(e,t,r,a);c.mutateElement(i,u);let d=So(a,o);if(d){let e=d.fontSize*r;Rs(i,c);let t=l.get(d.id);t&&R(t)&&(c.mutateElement(t,{fontSize:e}),s(i,c,n===`width`?`e`:`s`,!0))}},RL=(e,t,n,r,i,a,o,s,c,l)=>{a===`width`?t=Math.round(e/r*100)/100:e=Math.round(t*r*100)/100;let u=t/n;for(let e=0;e<s.length;e++){let t=s[e],n=o[e];LL(i[0],i[1],a,u,n,t,c,l)}},zL=({accumulatedChange:e,originalElements:t,originalElementsMap:n,originalAppState:r,shouldChangeByStepSize:i,nextValue:o,scene:s,property:c,setAppState:l,app:u})=>{let d=s.getNonDeletedElementsMap(),f=gL(t,r);if(o!==void 0){for(let e of f){let t=mL(e,d,n);if(t.length>1){let e=t.map(e=>e.latest),r=t.map(e=>e.original),[i,l,u,d]=He(r),f=u-i,p=d-l,m=f/p;RL(Math.max(1,c===`width`?Math.max(0,o):f),Math.max(1,c===`height`?Math.max(0,o):p),p,m,a(i,l),c,e,r,n,s)}else{let[e]=t,a=e?.latest,l=e?.original;if(a&&l&&fL(a,c)){let e=c===`width`?Math.max(0,o):a.width;c===`width`&&(e=i?pL(e,FL):Math.round(e));let t=c===`height`?Math.max(0,o):a.height;if(c===`height`&&(t=i?pL(t,FL):Math.round(t)),e=Math.max(1,e),t=Math.max(1,t),_e(e,t,a,l,n,s,c===`width`?`e`:`s`,{shouldInformMutation:!1}),N(a)){let e=Ws(s.getElementsIncludingDeleted(),a,r,s.getNonDeletedElementsMap()),t=po(s.getElementsIncludingDeleted(),e,a);s.replaceAllElements(t)}}}}s.triggerUpdate();return}let p=c===`width`?e:0,m=c===`height`?e:0,h=[];for(let e of f){let t=mL(e,d,n);if(t.length>1){let e=t.map(e=>e.latest),r=t.map(e=>e.original),[o,l,u,d]=He(r),f=u-o,h=d-l,g=f/h,_=Math.max(0,f+p);c===`width`&&(_=i?pL(_,FL):Math.round(_));let v=Math.max(0,h+m);c===`height`&&(v=i?pL(v,FL):Math.round(v)),_=Math.max(1,_),v=Math.max(1,v),RL(_,v,h,g,a(o,l),c,e,r,n,s)}else{let[e]=t,a=e?.latest,o=e?.original;if(a&&o&&fL(a,c)){let e=Math.max(0,o.width+p);c===`width`&&(e=i?pL(e,FL):Math.round(e));let t=Math.max(0,o.height+m);if(c===`height`&&(t=i?pL(t,FL):Math.round(t)),e=Math.max(1,e),t=Math.max(1,t),_e(e,t,a,o,n,s,c===`width`?`e`:`s`,{shouldInformMutation:!1}),N(a)){let e=Sa(Ws(s.getElementsIncludingDeleted(),a,r,s.getNonDeletedElementsMap()));h.push(...e)}}}}l({elementsToHighlight:h}),s.triggerUpdate()},BL=({setAppState:e,app:t,originalElements:n,originalAppState:r})=>{let i=t.scene.getNonDeletedElementsMap(),a=n?.[0],o=a&&i.get(a.id);if(o&&N(o)){let n=Ws(t.scene.getElementsIncludingDeleted(),o,r,t.scene.getNonDeletedElementsMap()),i=po(t.scene.getElementsIncludingDeleted(),n,o);t.scene.replaceAllElements(i),e({elementsToHighlight:null})}},VL=({property:e,elements:t,elementsMap:n,atomicUnits:r,scene:i,appState:a})=>{let o=(0,B.useMemo)(()=>r.map(t=>{let r=mL(t,n);if(r.length>1){let[t,n,i,a]=He(r.map(e=>e.latest));return Math.round((e===`width`?i-t:a-n)*100)/100}let[i]=r;return Math.round((e===`width`?i.latest.width:i.latest.height)*100)/100}),[n,r,e]),s=new Set(o).size===1?Math.round(o[0]*100)/100:`Mixed`,c=o.length>0;return(0,V.jsx)(_L,{label:e===`width`?`W`:`H`,elements:t,dragInputCallback:zL,value:s,editable:c,appState:a,property:e,scene:i,dragFinishedCallback:BL})},HL=4,UL=4,WL=(e,t)=>e.reduce((e,n)=>{if(!n||fo(n))return e;if(R(n))return e.push(n),e;if(ai(n)){let r=So(n,t);if(r)return e.push(r),e}return e},[]),GL=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i})=>{let a=i.getNonDeletedElementsMap(),o=t.map(e=>a.get(e.id)),s;if(r){s=Math.max(Math.round(r),HL);for(let e of o)i.mutateElement(e,{fontSize:s}),Fn(e,i.getContainerElement(e),i);i.triggerUpdate()}else{let r=t;for(let t=0;t<o.length;t++){let a=o[t],s=r[t],c=Math.round(s.fontSize),l=Math.max(c+Math.round(e),HL);n&&(l=pL(l,UL)),i.mutateElement(a,{fontSize:l}),Fn(a,i.getContainerElement(a),i)}i.triggerUpdate()}},KL=({elements:e,scene:t,appState:n,property:r,elementsMap:i})=>{let a=WL(e,i);if(!a.length)return null;let o=a.map(e=>Math.round(e.fontSize*10)/10);return(0,V.jsx)(_L,{label:`F`,icon:Ax,elements:a,dragInputCallback:GL,value:new Set(o).size===1?o[0]:`Mixed`,editable:o.length>0,scene:t,property:r,appState:n})},qL=(e,t,n,r,i,o,s)=>{for(let c=0;c<r.length;c++){let l=r[c],[u,d]=[l.x+l.width/2,l.y+l.height/2],[f,p]=ot(a(l.x,l.y),a(u,d),l.angle);hL(e===`x`?Math.round(f+t):f,e===`y`?Math.round(p+n):p,l,o,s,i,!1)}},JL=(e,t,n,r,i,o)=>{let s=i.getNonDeletedElementsMap(),[c,l,,]=He(n),u=e-c,d=t-l;for(let e=0;e<n.length;e++){let t=n[e],c=s.get(t.id);if(c&&(!R(c)||!c.containerId)){let[e,n]=[c.x+c.width/2,c.y+c.height/2],[s,l]=ot(a(c.x,c.y),a(e,n),c.angle);hL(s+u,l+d,t,i,o,r,!1)}}},YL=({accumulatedChange:e,originalElements:t,originalElementsMap:n,shouldChangeByStepSize:r,nextValue:i,property:o,scene:s,originalAppState:c,app:l})=>{let u=s.getNonDeletedElementsMap();if(i!==void 0){for(let e of gL(t,c)){let t=mL(e,u,n);if(t.length>1){let[e,r,,]=He(t.map(e=>e.latest));JL(o===`x`?i:e,o===`y`?i:r,t.map(e=>e.original),n,s,l.state)}else{let e=t[0]?.original,r=t[0]?.latest;if(e&&r&&fL(r,o)){let[t,r]=[e.x+e.width/2,e.y+e.height/2],[c,u]=ot(a(e.x,e.y),a(t,r),e.angle);hL(o===`x`?i:c,o===`y`?i:u,e,s,l.state,n,!1)}}}s.triggerUpdate();return}let d=r?pL(e,dL):e;qL(o,o===`x`?d:0,o===`y`?d:0,t,n,s,l.state),s.triggerUpdate()},XL=({property:e,elements:t,elementsMap:n,atomicUnits:r,scene:i,appState:o})=>{let s=(0,B.useMemo)(()=>r.map(t=>{let r=Object.keys(t).map(e=>n.get(e)).filter(e=>e!==void 0);if(r.length>1){let[t,n]=He(r);return Math.round((e===`x`?t:n)*100)/100}let[i]=r,[o,s]=[i.x+i.width/2,i.y+i.height/2],[c,l]=ot(a(i.x,i.y),a(o,s),i.angle);return Math.round((e===`x`?c:l)*100)/100}),[r,n,e]),c=new Set(s).size===1?s[0]:`Mixed`;return(0,V.jsx)(_L,{label:e===`x`?`X`:`Y`,elements:t,dragInputCallback:YL,value:c,property:e,scene:i,appState:o})},ZL=({accumulatedChange:e,instantChange:t,originalElements:n,originalElementsMap:r,shouldChangeByStepSize:i,nextValue:o,property:s,scene:c,originalAppState:l,app:u})=>{let d=c.getNonDeletedElementsMap(),f=n[0],[p,m]=[f.x+f.width/2,f.y+f.height/2],[h,g]=ot(a(f.x,f.y),a(p,m),f.angle);if(l.croppingElementId===f.id){let e=d.get(f.id);if(!e||!Ce(e)||!e.crop)return;let n=e.crop,r=n,i=e.scale[0]===-1,a=e.scale[1]===-1,{width:l,height:u}=nn(e);if(o!==void 0){if(s===`x`){let e=o*(n.naturalWidth/l);r=i?{...n,x:Fe(n.naturalWidth-e-n.width,0,n.naturalWidth-n.width)}:{...n,x:Fe(o*(n.naturalWidth/l),0,n.naturalWidth-n.width)}}s===`y`&&(r={...n,y:Fe(o*(n.naturalHeight/u),0,n.naturalHeight-n.height)}),c.mutateElement(e,{crop:r});return}let p=(s===`x`?t:0)*(i?-1:1),m=(s===`y`?t:0)*(a?-1:1);r={...n,x:Fe(n.x+p,0,n.naturalWidth-n.width),y:Fe(n.y+m,0,n.naturalHeight-n.height)},c.mutateElement(e,{crop:r});return}if(o!==void 0){hL(s===`x`?o:h,s===`y`?o:g,f,c,u.state,r);return}let _=s===`x`?e:0,v=s===`y`?e:0;hL(s===`x`?Math.round(i?pL(f.x+_,dL):h+_):h,s===`y`?Math.round(i?pL(f.y+v,dL):g+v):g,f,c,u.state,r)},QL=({property:e,element:t,scene:n,appState:r})=>{let[i,o]=ot(a(t.x,t.y),a(t.x+t.width/2,t.y+t.height/2),t.angle),s=Lo(e===`x`?i:o,2);if(r.croppingElementId===t.id&&Ce(t)&&t.crop){let n=ac(t);n&&(s=Lo(e===`x`?n.x:n.y,2))}return(0,V.jsx)(_L,{label:e===`x`?`X`:`Y`,elements:[t],dragInputCallback:ZL,scene:n,value:s,property:e,appState:r})},$L=50,eR=e=>{let t=nB(),n=e.app.scene.getSceneNonce()||1,r=e.app.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}),i=$j(e.app);return(0,V.jsx)(rR,{...e,appState:t,sceneNonce:n,selectedElements:r,gridModeEnabled:i})},tR=({children:e,columns:t=1,heading:n,style:r,...i})=>(0,V.jsx)(`div`,{className:H(`exc-stats__row`,{"exc-stats__row--heading":n}),style:{gridTemplateColumns:`repeat(${t}, 1fr)`,...r},...i,children:e});tR.displayName=`StatsRow`;var nR=({children:e,order:t,style:n,...r})=>(0,V.jsx)(`div`,{className:`exc-stats__rows`,style:{order:t,...n},...r,children:e});nR.displayName=`StatsRows`,eR.StatsRow=tR,eR.StatsRows=nR;var rR=(0,B.memo)(({app:e,onClose:t,renderCustomStats:n,selectedElements:r,appState:i,sceneNonce:a,gridModeEnabled:o})=>{let s=e.scene,c=s.getNonDeletedElements(),l=s.getNonDeletedElementsMap(),u=rB(),d=r.length===1?r[0]:null,f=r.length>1?r:null,p=i.croppingElementId&&Ce(d),m=p?nn(d):null,[h,g]=(0,B.useState)({width:0,height:0}),_=(0,B.useMemo)(()=>(0,wc.default)(e=>{let t=He(e);g({width:Math.round(t[2])-Math.round(t[0]),height:Math.round(t[3])-Math.round(t[1])})},$L),[]);(0,B.useEffect)(()=>{_(c)},[a,c,_]),(0,B.useEffect)(()=>()=>_.cancel(),[_]);let v=(0,B.useMemo)(()=>gL(r,i),[r,i]),y=(0,B.useMemo)(()=>ee(r),[r]);return(0,V.jsx)(`div`,{className:`exc-stats`,children:(0,V.jsxs)(mC,{padding:3,children:[(0,V.jsxs)(`div`,{className:`title`,children:[(0,V.jsx)(`h2`,{children:G(`stats.title`)}),(0,V.jsx)(`div`,{className:`close`,onClick:t,children:Kb})]}),(0,V.jsxs)(cw,{label:(0,V.jsx)(`h3`,{children:G(`stats.generalStats`)}),open:!!(i.stats.panels&bn.generalStats),openTrigger:()=>u(e=>({stats:{open:!0,panels:e.stats.panels^bn.generalStats}})),children:[(0,V.jsxs)(nR,{children:[(0,V.jsx)(tR,{heading:!0,children:G(`stats.scene`)}),(0,V.jsxs)(tR,{columns:2,children:[(0,V.jsx)(`div`,{children:G(`stats.shapes`)}),(0,V.jsx)(`div`,{children:c.length})]}),(0,V.jsxs)(tR,{columns:2,children:[(0,V.jsx)(`div`,{children:G(`stats.width`)}),(0,V.jsx)(`div`,{children:h.width})]}),(0,V.jsxs)(tR,{columns:2,children:[(0,V.jsx)(`div`,{children:G(`stats.height`)}),(0,V.jsx)(`div`,{children:h.height})]}),o&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(tR,{heading:!0,children:`Canvas`}),(0,V.jsx)(tR,{children:(0,V.jsx)(SL,{property:`gridStep`,scene:s,appState:i,setAppState:u})})]})]}),n?.(c,i)]}),!y&&r.length>0&&(0,V.jsx)(`div`,{id:`elementStats`,style:{marginTop:12},children:(0,V.jsx)(cw,{label:(0,V.jsx)(`h3`,{children:G(`stats.elementProperties`)}),open:!!(i.stats.panels&bn.elementProperties),openTrigger:()=>u(e=>({stats:{open:!0,panels:e.stats.panels^bn.elementProperties}})),children:(0,V.jsxs)(nR,{children:[d&&(0,V.jsxs)(V.Fragment,{children:[p&&(0,V.jsx)(tR,{heading:!0,children:G(`labels.unCroppedDimension`)}),i.croppingElementId&&Ce(d)&&m&&(0,V.jsxs)(tR,{columns:2,children:[(0,V.jsx)(`div`,{children:G(`stats.width`)}),(0,V.jsx)(`div`,{children:Lo(m.width,2)})]}),i.croppingElementId&&Ce(d)&&m&&(0,V.jsxs)(tR,{columns:2,children:[(0,V.jsx)(`div`,{children:G(`stats.height`)}),(0,V.jsx)(`div`,{children:Lo(m.height,2)})]}),(0,V.jsx)(tR,{heading:!0,"data-testid":`stats-element-type`,style:{margin:`0.3125rem 0`},children:i.croppingElementId?G(`labels.imageCropping`):G(`element.${d.type}`)}),(0,V.jsx)(tR,{children:(0,V.jsx)(QL,{element:d,property:`x`,elementsMap:l,scene:s,appState:i})}),(0,V.jsx)(tR,{children:(0,V.jsx)(QL,{element:d,property:`y`,elementsMap:l,scene:s,appState:i})}),(0,V.jsx)(tR,{children:(0,V.jsx)(DL,{property:`width`,element:d,scene:s,appState:i})}),(0,V.jsx)(tR,{children:(0,V.jsx)(DL,{property:`height`,element:d,scene:s,appState:i})}),(0,V.jsx)(tR,{children:(0,V.jsx)(bL,{property:`angle`,element:d,scene:s,appState:i})}),(0,V.jsx)(tR,{children:(0,V.jsx)(jL,{property:`fontSize`,element:d,scene:s,appState:i})})]}),f&&(0,V.jsxs)(V.Fragment,{children:[ht(f)&&(0,V.jsx)(tR,{heading:!0,children:G(`element.group`)}),(0,V.jsxs)(tR,{columns:2,style:{margin:`0.3125rem 0`},children:[(0,V.jsx)(`div`,{children:G(`stats.shapes`)}),(0,V.jsx)(`div`,{children:r.length})]}),(0,V.jsx)(tR,{children:(0,V.jsx)(XL,{property:`x`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,V.jsx)(tR,{children:(0,V.jsx)(XL,{property:`y`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,V.jsx)(tR,{children:(0,V.jsx)(VL,{property:`width`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,V.jsx)(tR,{children:(0,V.jsx)(VL,{property:`height`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,V.jsx)(tR,{children:(0,V.jsx)(PL,{property:`angle`,elements:f,scene:s,appState:i})}),(0,V.jsx)(tR,{children:(0,V.jsx)(KL,{property:`fontSize`,elements:f,scene:s,appState:i,elementsMap:l})})]})]})})})]})})},(e,t)=>e.sceneNonce===t.sceneNonce&&e.selectedElements===t.selectedElements&&e.appState.stats.panels===t.appState.stats.panels&&e.gridModeEnabled===t.gridModeEnabled&&e.appState.gridStep===t.appState.gridStep&&e.appState.croppingElementId===t.appState.croppingElementId),iR=({sourceElementId:e,onClose:t,appState:n,scene:r,generateLinkForSelection:i=o})=>{let a=r.getNonDeletedElementsMap(),s=a.get(e)?.link??null,[c,l]=(0,B.useState)(s),[u,d]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=An(a,n),t=s;if(e.length>0&&i){let r=yo(e,n);r&&(t=je(i(r.id,r.type)))}l(t)},[a,n,n.selectedElementIds,s,i]);let f=(0,B.useCallback)(()=>{if(c&&c!==a.get(e)?.link){let t=a.get(e);t&&r.mutateElement(t,{link:c})}if(!c&&u&&e){let t=a.get(e);t&&r.mutateElement(t,{link:null})}t?.()},[e,c,a,u,r,t]);return(0,B.useEffect)(()=>{let e=e=>{n.openDialog?.name===`elementLinkSelector`&&e.key===M.ENTER&&f(),n.openDialog?.name===`elementLinkSelector`&&e.key===M.ESCAPE&&t?.()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[n,t,f]),(0,V.jsxs)(`div`,{className:`ElementLinkDialog`,children:[(0,V.jsxs)(`div`,{className:`ElementLinkDialog__header`,children:[(0,V.jsx)(`h2`,{children:G(`elementLink.title`)}),(0,V.jsx)(`p`,{children:G(`elementLink.desc`)})]}),(0,V.jsxs)(`div`,{className:`ElementLinkDialog__input`,children:[(0,V.jsx)(hk,{value:c??``,onChange:e=>{u||d(!0),l(e)},onKeyDown:e=>{e.key===M.ENTER&&f()},className:`ElementLinkDialog__input-field`,selectOnRender:!0}),s&&c&&(0,V.jsx)(Y,{type:`button`,title:G(`buttons.remove`),"aria-label":G(`buttons.remove`),label:G(`buttons.remove`),onClick:()=>{l(null),d(!0)},className:`ElementLinkDialog__remove`,icon:rb})]}),(0,V.jsxs)(`div`,{className:`ElementLinkDialog__actions`,children:[(0,V.jsx)(SO,{label:G(`buttons.cancel`),onClick:()=>{t?.()},style:{marginRight:10}}),(0,V.jsx)(SO,{label:G(`buttons.confirm`),onClick:f,actionType:`primary`})]})]})},aR=({children:e,onClose:t})=>{let[n,r]=(0,B.useState)(!!e),{container:i}=eB(),a=B.useCallback(()=>{r(!1),t&&t(),i?.focus()},[t,i]);return(0,V.jsx)(V.Fragment,{children:n&&(0,V.jsx)(Dk,{size:`small`,onCloseRequest:a,title:G(`errorDialog.title`),children:(0,V.jsx)(`div`,{style:{whiteSpace:`pre-wrap`},children:e})})})},oR=()=>(0,V.jsxs)(`div`,{className:`HelpDialog__header`,children:[(0,V.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://docs.excalidraw.com`,target:`_blank`,rel:`noopener`,children:[(0,V.jsx)(`div`,{className:`HelpDialog__link-icon`,children:fb}),G(`helpDialog.documentation`)]}),(0,V.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://plus.excalidraw.com/blog`,target:`_blank`,rel:`noopener`,children:[(0,V.jsx)(`div`,{className:`HelpDialog__link-icon`,children:fb}),G(`helpDialog.blog`)]}),(0,V.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://github.com/excalidraw/excalidraw/issues`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,V.jsx)(`div`,{className:`HelpDialog__link-icon`,children:pb}),G(`helpDialog.github`)]}),(0,V.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://youtube.com/@excalidraw`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,V.jsx)(`div`,{className:`HelpDialog__link-icon`,children:DS}),`YouTube`]})]}),sR=e=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{children:e.title}),(0,V.jsx)(`div`,{className:`HelpDialog__islands-container`,children:e.children})]}),cR=e=>(0,V.jsxs)(`div`,{className:`HelpDialog__island ${e.className}`,children:[(0,V.jsx)(`h4`,{className:`HelpDialog__island-title`,children:e.caption}),(0,V.jsx)(`div`,{className:`HelpDialog__island-content`,children:e.children})]});function*lR(e,t){let n=!0;for(let r of e)n||(yield t),n=!1,yield r}var uR=e=>e.replace(/\b[a-z]\b/,e=>e.toUpperCase()),$=({label:e,shortcuts:t,isOr:n=!0})=>{let r=t.map(e=>(e.endsWith(`++`)?[...e.slice(0,-2).split(`+`),`+`]:e.split(`+`)).map(e=>(0,V.jsx)(dR,{children:uR(e)},e)));return(0,V.jsxs)(`div`,{className:`HelpDialog__shortcut`,children:[(0,V.jsx)(`div`,{children:e}),(0,V.jsx)(`div`,{className:`HelpDialog__key-container`,children:[...lR(r,n?G(`helpDialog.or`):``)]})]})},dR=e=>(0,V.jsx)(`kbd`,{className:`HelpDialog__key`,...e}),fR=({onClose:e})=>{let t=iB();return(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(Dk,{onCloseRequest:B.useCallback(()=>{e&&e()},[e]),title:G(`helpDialog.title`),className:`HelpDialog`,children:[(0,V.jsx)(oR,{}),(0,V.jsxs)(sR,{title:G(`helpDialog.shortcuts`),children:[(0,V.jsxs)(cR,{className:`HelpDialog__island--tools`,caption:G(`helpDialog.tools`),children:[(0,V.jsx)($,{label:G(`toolBar.hand`),shortcuts:[M.H]}),(0,V.jsx)($,{label:G(`toolBar.selection`),shortcuts:[M.V,M[1]]}),(0,V.jsx)($,{label:G(`toolBar.rectangle`),shortcuts:[M.R,M[2]]}),(0,V.jsx)($,{label:G(`toolBar.diamond`),shortcuts:[M.D,M[3]]}),(0,V.jsx)($,{label:G(`toolBar.ellipse`),shortcuts:[M.O,M[4]]}),(0,V.jsx)($,{label:G(`toolBar.arrow`),shortcuts:[M.A,M[5]]}),(0,V.jsx)($,{label:G(`toolBar.line`),shortcuts:[M.L,M[6]]}),(0,V.jsx)($,{label:G(`toolBar.freedraw`),shortcuts:[M.P,M[7]]}),(0,V.jsx)($,{label:G(`toolBar.text`),shortcuts:[M.T,M[8]]}),(0,V.jsx)($,{label:G(`toolBar.image`),shortcuts:[M[9]]}),(0,V.jsx)($,{label:G(`toolBar.eraser`),shortcuts:[M.E,M[0]]}),(0,V.jsx)($,{label:G(`toolBar.frame`),shortcuts:[M.F]}),(0,V.jsx)($,{label:G(`toolBar.laser`),shortcuts:[M.K]}),(0,V.jsx)($,{label:G(`labels.eyeDropper`),shortcuts:[M.I,`Shift+S`,`Shift+G`]}),(0,V.jsx)($,{label:G(`helpDialog.editLineArrowPoints`),shortcuts:[Z(`CtrlOrCmd+Enter`)]}),(0,V.jsx)($,{label:G(`helpDialog.editText`),shortcuts:[Z(`Enter`)]}),(0,V.jsx)($,{label:G(`helpDialog.textNewLine`),shortcuts:[Z(`Enter`),Z(`Shift+Enter`)]}),(0,V.jsx)($,{label:G(`helpDialog.textFinish`),shortcuts:[Z(`Esc`),Z(`CtrlOrCmd+Enter`)]}),(0,V.jsx)($,{label:G(`helpDialog.curvedArrow`),shortcuts:[`A`,G(`helpDialog.click`),G(`helpDialog.click`),G(`helpDialog.click`)],isOr:!1}),(0,V.jsx)($,{label:G(`helpDialog.curvedLine`),shortcuts:[`L`,G(`helpDialog.click`),G(`helpDialog.click`),G(`helpDialog.click`)],isOr:!1}),(0,V.jsx)($,{label:G(`helpDialog.cropStart`),shortcuts:[G(`helpDialog.doubleClick`),Z(`Enter`)],isOr:!0}),(0,V.jsx)($,{label:G(`helpDialog.cropFinish`),shortcuts:[Z(`Enter`),Z(`Escape`)],isOr:!0}),(0,V.jsx)($,{label:G(`toolBar.lock`),shortcuts:[M.Q]}),(0,V.jsx)($,{label:G(`helpDialog.preventBinding`),shortcuts:[Z(`CtrlOrCmd`)]}),(0,V.jsx)($,{label:G(`toolBar.link`),shortcuts:[Z(`CtrlOrCmd+K`)]}),(0,V.jsx)($,{label:G(`toolBar.convertElementType`),shortcuts:[`Tab`,`Shift+Tab`],isOr:!0})]}),(0,V.jsxs)(cR,{className:`HelpDialog__island--view`,caption:G(`helpDialog.view`),children:[(0,V.jsx)($,{label:G(`buttons.zoomIn`),shortcuts:[Z(`CtrlOrCmd++`)]}),(0,V.jsx)($,{label:G(`buttons.zoomOut`),shortcuts:[Z(`CtrlOrCmd+-`)]}),(0,V.jsx)($,{label:G(`buttons.resetZoom`),shortcuts:[Z(`CtrlOrCmd+0`)]}),(0,V.jsx)($,{label:G(`helpDialog.zoomToFit`),shortcuts:[`Shift+1`]}),(0,V.jsx)($,{label:G(`helpDialog.zoomToSelection`),shortcuts:[`Shift+2`]}),(0,V.jsx)($,{label:G(`helpDialog.movePageUpDown`),shortcuts:[`PgUp/PgDn`]}),(0,V.jsx)($,{label:G(`helpDialog.movePageLeftRight`),shortcuts:[`Shift+PgUp/PgDn`]}),(0,V.jsx)($,{label:G(`buttons.zenMode`),shortcuts:[Z(`Alt+Z`)]}),(0,V.jsx)($,{label:G(`buttons.objectsSnapMode`),shortcuts:[Z(`Alt+S`)]}),(0,V.jsx)($,{label:G(`labels.toggleGrid`),shortcuts:[Z(`CtrlOrCmd+'`)]}),(0,V.jsx)($,{label:G(`labels.viewMode`),shortcuts:[Z(`Alt+R`)]}),t.isActionEnabled(Hw)&&(0,V.jsx)($,{label:G(`labels.toggleTheme`),shortcuts:[Z(`Alt+Shift+D`)]}),(0,V.jsx)($,{label:G(`stats.fullTitle`),shortcuts:[Z(`Alt+/`)]}),(0,V.jsx)($,{label:G(`search.title`),shortcuts:[XD(`searchMenu`)]}),(0,V.jsx)($,{label:G(`commandPalette.title`),shortcuts:Ra?[XD(`commandPalette`)]:[XD(`commandPalette`),XD(`commandPalette`,1)]})]}),(0,V.jsxs)(cR,{className:`HelpDialog__island--editor`,caption:G(`helpDialog.editor`),children:[(0,V.jsx)($,{label:G(`helpDialog.createFlowchart`),shortcuts:[Z(`CtrlOrCmd+Arrow Key`)],isOr:!0}),(0,V.jsx)($,{label:G(`helpDialog.navigateFlowchart`),shortcuts:[Z(`Alt+Arrow Key`)],isOr:!0}),(0,V.jsx)($,{label:G(`labels.moveCanvas`),shortcuts:[Z(`Space+${G(`helpDialog.drag`)}`),Z(`Wheel+${G(`helpDialog.drag`)}`)],isOr:!0}),(0,V.jsx)($,{label:G(`buttons.clearReset`),shortcuts:[Z(`CtrlOrCmd+Delete`)]}),(0,V.jsx)($,{label:G(`labels.delete`),shortcuts:[Z(`Delete`)]}),(0,V.jsx)($,{label:G(`labels.cut`),shortcuts:[Z(`CtrlOrCmd+X`)]}),(0,V.jsx)($,{label:G(`labels.copy`),shortcuts:[Z(`CtrlOrCmd+C`)]}),(0,V.jsx)($,{label:G(`labels.paste`),shortcuts:[Z(`CtrlOrCmd+V`)]}),(0,V.jsx)($,{label:G(`labels.pasteAsPlaintext`),shortcuts:[Z(`CtrlOrCmd+Shift+V`)]}),(0,V.jsx)($,{label:G(`labels.selectAll`),shortcuts:[Z(`CtrlOrCmd+A`)]}),(0,V.jsx)($,{label:G(`labels.multiSelect`),shortcuts:[Z(`Shift+${G(`helpDialog.click`)}`)]}),(0,V.jsx)($,{label:G(`helpDialog.deepSelect`),shortcuts:[Z(`CtrlOrCmd+${G(`helpDialog.click`)}`)]}),(0,V.jsx)($,{label:G(`helpDialog.deepBoxSelect`),shortcuts:[Z(`CtrlOrCmd+${G(`helpDialog.drag`)}`)]}),(jT||Ra)&&(0,V.jsx)($,{label:G(`labels.copyAsPng`),shortcuts:[Z(`Shift+Alt+C`)]}),(0,V.jsx)($,{label:G(`labels.copyStyles`),shortcuts:[Z(`CtrlOrCmd+Alt+C`)]}),(0,V.jsx)($,{label:G(`labels.pasteStyles`),shortcuts:[Z(`CtrlOrCmd+Alt+V`)]}),(0,V.jsx)($,{label:G(`labels.sendToBack`),shortcuts:[Z(Nn?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)]}),(0,V.jsx)($,{label:G(`labels.bringToFront`),shortcuts:[Z(Nn?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)]}),(0,V.jsx)($,{label:G(`labels.sendBackward`),shortcuts:[Z(`CtrlOrCmd+[`)]}),(0,V.jsx)($,{label:G(`labels.bringForward`),shortcuts:[Z(`CtrlOrCmd+]`)]}),(0,V.jsx)($,{label:G(`labels.alignTop`),shortcuts:[Z(`CtrlOrCmd+Shift+Up`)]}),(0,V.jsx)($,{label:G(`labels.alignBottom`),shortcuts:[Z(`CtrlOrCmd+Shift+Down`)]}),(0,V.jsx)($,{label:G(`labels.alignLeft`),shortcuts:[Z(`CtrlOrCmd+Shift+Left`)]}),(0,V.jsx)($,{label:G(`labels.alignRight`),shortcuts:[Z(`CtrlOrCmd+Shift+Right`)]}),(0,V.jsx)($,{label:G(`labels.duplicateSelection`),shortcuts:[Z(`CtrlOrCmd+D`),Z(`Alt+${G(`helpDialog.drag`)}`)]}),(0,V.jsx)($,{label:G(`helpDialog.toggleElementLock`),shortcuts:[Z(`CtrlOrCmd+Shift+L`)]}),(0,V.jsx)($,{label:G(`buttons.undo`),shortcuts:[Z(`CtrlOrCmd+Z`)]}),(0,V.jsx)($,{label:G(`buttons.redo`),shortcuts:Io?[Z(`CtrlOrCmd+Y`),Z(`CtrlOrCmd+Shift+Z`)]:[Z(`CtrlOrCmd+Shift+Z`)]}),(0,V.jsx)($,{label:G(`labels.group`),shortcuts:[Z(`CtrlOrCmd+G`)]}),(0,V.jsx)($,{label:G(`labels.ungroup`),shortcuts:[Z(`CtrlOrCmd+Shift+G`)]}),(0,V.jsx)($,{label:G(`labels.flipHorizontal`),shortcuts:[Z(`Shift+H`)]}),(0,V.jsx)($,{label:G(`labels.flipVertical`),shortcuts:[Z(`Shift+V`)]}),(0,V.jsx)($,{label:G(`labels.showStroke`),shortcuts:[Z(`S`)]}),(0,V.jsx)($,{label:G(`labels.showBackground`),shortcuts:[Z(`G`)]}),(0,V.jsx)($,{label:G(`labels.showFonts`),shortcuts:[Z(`Shift+F`)]}),(0,V.jsx)($,{label:G(`labels.decreaseFontSize`),shortcuts:[Z(`CtrlOrCmd+Shift+<`)]}),(0,V.jsx)($,{label:G(`labels.increaseFontSize`),shortcuts:[Z(`CtrlOrCmd+Shift+>`)]})]})]})]})})},pR=2e3,mR=()=>{let[e,t]=(0,B.useState)(null),n=(0,B.useRef)(0);return{copyStatus:e,resetCopyStatus:(0,B.useCallback)(()=>{t(null)},[]),onCopy:()=>{clearTimeout(n.current),t(`success`),n.current=window.setTimeout(()=>{t(null)},pR)}}},hR=({title:e,name:t,checked:n,onChange:r,disabled:i=!1})=>(0,V.jsx)(`div`,{className:H(`Switch`,{toggled:n,disabled:i}),children:(0,V.jsx)(`input`,{name:t,id:t,title:e,type:`checkbox`,checked:n,disabled:i,onChange:()=>r(!n),onKeyDown:e=>{e.key===` `&&r(!n)}})}),gR=()=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{children:G(`canvasError.cannotShowPreview`)}),(0,V.jsx)(`p`,{children:(0,V.jsx)(`span`,{children:G(`canvasError.canvasTooBig`)})}),(0,V.jsxs)(`em`,{children:[`(`,G(`canvasError.canvasTooBigTip`),`)`]})]}),_R=({appStateSnapshot:e,elementsSnapshot:t,files:n,actionManager:r,onExportImage:i,name:a,exportWithDarkMode:o})=>{let s=ha(t,e),[c,l]=(0,B.useState)(a),[u,d]=(0,B.useState)(s),[f,p]=(0,B.useState)(e.exportBackground),[m,h]=(0,B.useState)(e.exportEmbedScene),[g,_]=(0,B.useState)(e.exportScale),v=(0,B.useRef)(null),y=(0,B.useRef)(0),[b,x]=(0,B.useState)(null),{onCopy:S,copyStatus:C,resetCopyStatus:w}=mR();(0,B.useEffect)(()=>{w()},[c,f,o,g,m,w]);let{exportedElements:T,exportingFrame:E}=XT(t,e,u);return(0,B.useEffect)(()=>{let t=v.current;if(!t)return;let r=t.offsetWidth,i=t.offsetHeight;if(!r)return;let a=++y.current,s=()=>a!==y.current;return nO({elements:T,appState:{...e,name:c,exportBackground:f,exportWithDarkMode:o,exportScale:g,exportEmbedScene:m},files:n,exportPadding:10,maxWidthOrHeight:Math.max(r,i),exportingFrame:E}).then(async e=>{if(!s()){try{await Wa(e)}catch(e){throw e.name===`CANVAS_POSSIBLY_TOO_BIG`?Error(G(`canvasError.canvasTooBig`)):e}s()||(x(null),t.replaceChildren(e))}}).catch(e=>{s()||(console.error(e),x(e))}),()=>{y.current+=1}},[e,n,T,E,c,f,o,g,m]),(0,V.jsxs)(`div`,{className:`ImageExportModal`,children:[(0,V.jsx)(`h3`,{children:G(`imageExportDialog.header`)}),(0,V.jsxs)(`div`,{className:`ImageExportModal__preview`,children:[(0,V.jsx)(`div`,{className:`ImageExportModal__preview__canvas`,ref:v,children:b&&(0,V.jsx)(gR,{})}),(0,V.jsx)(`div`,{className:`ImageExportModal__preview__filename`,children:!$i&&(0,V.jsx)(`input`,{type:`text`,className:`TextInput`,value:c,style:{width:`30ch`},onChange:e=>{l(e.target.value),r.executeAction($T,`ui`,e.target.value)}})})]}),(0,V.jsxs)(`div`,{className:`ImageExportModal__settings`,children:[(0,V.jsx)(`h3`,{children:G(`imageExportDialog.header`)}),s&&(0,V.jsx)(vR,{label:G(`imageExportDialog.label.onlySelected`),name:`exportOnlySelected`,children:(0,V.jsx)(hR,{name:`exportOnlySelected`,checked:u,onChange:e=>{d(e)}})}),(0,V.jsx)(vR,{label:G(`imageExportDialog.label.withBackground`),name:`exportBackgroundSwitch`,children:(0,V.jsx)(hR,{name:`exportBackgroundSwitch`,checked:f,onChange:e=>{p(e),r.executeAction(tE,`ui`,e)}})}),(0,V.jsx)(vR,{label:G(`imageExportDialog.label.darkMode`),name:`exportDarkModeSwitch`,children:(0,V.jsx)(hR,{name:`exportDarkModeSwitch`,checked:o,onChange:e=>{r.executeAction(uE,`ui`,e)}})}),(0,V.jsx)(vR,{label:G(`imageExportDialog.label.embedScene`),tooltip:G(`imageExportDialog.tooltip.embedScene`),name:`exportEmbedSwitch`,children:(0,V.jsx)(hR,{name:`exportEmbedSwitch`,checked:m,onChange:e=>{h(e),r.executeAction(nE,`ui`,e)}})}),(0,V.jsx)(vR,{label:G(`imageExportDialog.label.scale`),name:`exportScale`,children:(0,V.jsx)(qP,{name:`exportScale`,value:g,onChange:e=>{_(e),r.executeAction(eE,`ui`,e)},choices:Xo.map(e=>({value:e,label:`${e}\xD7`}))})}),(0,V.jsxs)(`div`,{className:`ImageExportModal__settings__buttons`,children:[(0,V.jsx)(yF,{className:`ImageExportModal__settings__buttons__button`,label:G(`imageExportDialog.title.exportToPng`),onClick:()=>i(Is.png,T,{exportingFrame:E}),icon:Wx,children:G(`imageExportDialog.button.exportToPng`)}),(0,V.jsx)(yF,{className:`ImageExportModal__settings__buttons__button`,label:G(`imageExportDialog.title.exportToSvg`),onClick:()=>i(Is.svg,T,{exportingFrame:E}),icon:Wx,children:G(`imageExportDialog.button.exportToSvg`)}),(jT||Ra)&&(0,V.jsx)(yF,{className:`ImageExportModal__settings__buttons__button`,label:G(`imageExportDialog.title.copyPngToClipboard`),status:C,onClick:async()=>{await i(Is.clipboard,T,{exportingFrame:E}),S()},icon:Gx,children:G(`imageExportDialog.button.copyPngToClipboard`)})]})]})]})},vR=({label:e,children:t,tooltip:n,name:r})=>(0,V.jsxs)(`div`,{className:`ImageExportModal__settings__setting`,title:e,children:[(0,V.jsxs)(`label`,{htmlFor:r,className:`ImageExportModal__settings__setting__label`,children:[e,n&&(0,V.jsx)(Nw,{label:n,long:!0,children:qx})]}),(0,V.jsx)(`div`,{className:`ImageExportModal__settings__setting__content`,children:t})]}),yR=({elements:e,appState:t,files:n,actionManager:r,onExportImage:i,onCloseRequest:a,name:o})=>{let[{appStateSnapshot:s,elementsSnapshot:c}]=(0,B.useState)(()=>({appStateSnapshot:Xi(t),elementsSnapshot:Xi(e)}));return(0,V.jsx)(Dk,{onCloseRequest:a,size:`wide`,title:!1,children:(0,V.jsx)(_R,{elementsSnapshot:c,appStateSnapshot:s,files:n,actionManager:r,onExportImage:i,name:o,exportWithDarkMode:t.exportWithDarkMode})})},bR={primary:{base:`var(--color-primary)`,darker:`var(--color-primary-darker)`,darkest:`var(--color-primary-darkest)`},lime:{base:`#74b816`,darker:`#66a80f`,darkest:`#5c940d`},pink:{base:`#d6336c`,darker:`#c2255c`,darkest:`#a61e4d`}},xR=({children:e,color:t})=>(0,V.jsx)(`div`,{className:`Card`,style:{"--card-color":bR[t].base,"--card-color-darker":bR[t].darker,"--card-color-darkest":bR[t].darkest},children:e}),SR=({elements:e,appState:t,setAppState:n,files:r,actionManager:i,exportOpts:a,canvas:o,onCloseRequest:s})=>{let{onExportToBackend:c}=a;return(0,V.jsx)(`div`,{className:`ExportDialog ExportDialog--json`,children:(0,V.jsxs)(`div`,{className:`ExportDialog-cards`,children:[a.saveFileToDisk&&(0,V.jsxs)(xR,{color:`lime`,children:[(0,V.jsx)(`div`,{className:`Card-icon`,children:wb}),(0,V.jsx)(`h2`,{children:G(`exportDialog.disk_title`)}),(0,V.jsxs)(`div`,{className:`Card-details`,children:[G(`exportDialog.disk_details`),!$i&&i.renderAction(`changeProjectName`)]}),(0,V.jsx)(Y,{className:`Card-button`,type:`button`,title:G(`exportDialog.disk_button`),"aria-label":G(`exportDialog.disk_button`),showAriaLabel:!0,onClick:()=>{i.executeAction(cE,`ui`)}})]}),c&&(0,V.jsxs)(xR,{color:`pink`,children:[(0,V.jsx)(`div`,{className:`Card-icon`,children:_b}),(0,V.jsx)(`h2`,{children:G(`exportDialog.link_title`)}),(0,V.jsx)(`div`,{className:`Card-details`,children:G(`exportDialog.link_details`)}),(0,V.jsx)(Y,{className:`Card-button`,type:`button`,title:G(`exportDialog.link_button`),"aria-label":G(`exportDialog.link_button`),showAriaLabel:!0,onClick:async()=>{try{rC(`export`,`link`,`ui (${tn()})`),await c(e,t,r),s()}catch(e){n({errorMessage:e.message})}}})]}),a.renderCustomUI&&a.renderCustomUI(e,t,r,o)]})})},CR=({elements:e,appState:t,files:n,actionManager:r,exportOpts:i,canvas:a,setAppState:o})=>{let s=B.useCallback(()=>{o({openDialog:null})},[o]);return(0,V.jsx)(V.Fragment,{children:t.openDialog?.name===`jsonExport`&&(0,V.jsx)(Dk,{onCloseRequest:s,title:G(`buttons.export`),children:(0,V.jsx)(SR,{elements:e,appState:t,setAppState:o,files:n,actionManager:r,onCloseRequest:s,exportOpts:i,canvas:a})})})},wR=e=>(0,V.jsx)(Y,{className:H(`ToolIcon__LaserPointer`,{"is-mobile":e.isMobile}),type:`toggle`,size:`small`,icon:rS,checked:e.checked,title:`${e.title}`,"aria-label":`${e.title}`,"data-testid":`toolbar-LaserPointer`,onSelect:()=>e.onChange?.()}),TR=e=>Array.isArray(e)?`<kbd>${e.map(Z).join(` + `)}</kbd>`:`<kbd>${Z(e)}</kbd>`,ER=({appState:e,isMobile:t,editorInterface:n,app:r})=>{let{activeTool:i,isResizing:a,isRotating:o,lastPointerDownWith:s}=e,c=e.multiElement!==null;if(e.openSidebar?.name===oe.name&&e.openSidebar.tab===`search`&&e.searchMatches?.matches.length)return G(`hints.dismissSearch`,{shortcut:TR(`Escape`)});if(e.openSidebar&&!n.canFitSidebar)return null;if(f(e))return G(`hints.eraserRevert`,{shortcut:TR(`Alt`)});let l=r.scene.getSelectedElements(e);if(e.selectedLinearElement?.isDragging&&l[0]?.type===`arrow`)return G(`hints.arrowBindModifiers`,{shortcut_1:TR(`Ctrl`),shortcut_2:TR(`Alt`)});if(i.type===`arrow`||i.type===`line`)return c?G(`hints.linearElementMulti`,{shortcut_1:TR(`Escape`),shortcut_2:TR(`Enter`)}):i.type===`arrow`?G(`hints.arrowTool`,{shortcut:TR(`A`)}):G(`hints.linearElement`);if(i.type===`freedraw`)return G(`hints.freeDraw`);if(i.type===`text`)return G(`hints.text`);if(i.type===`embeddable`)return G(`hints.embeddable`);if(a&&s===`mouse`&&l.length===1){let e=l[0];return ja(e)&&e.points.length===2?G(`hints.lockAngle`,{shortcut:TR(`Shift`)}):Ce(e)?G(`hints.resizeImage`,{shortcut_1:TR(`Shift`),shortcut_2:TR(`Alt`)}):G(`hints.resize`,{shortcut_1:TR(`Shift`),shortcut_2:TR(`Alt`)})}if(o&&s===`mouse`)return G(`hints.rotate`,{shortcut:TR(`Shift`)});if(l.length===1&&R(l[0]))return G(`hints.text_selected`,{shortcut:TR(`Enter`)});if(e.editingTextElement)return G(`hints.text_editing`,{shortcut_1:TR(`Escape`),shortcut_2:TR([`CtrlOrCmd`,`Enter`])});if(e.croppingElementId)return G(`hints.leaveCropEditor`,{shortcut_1:TR(`Enter`),shortcut_2:TR(`Escape`)});if(l.length===1&&Ce(l[0]))return G(`hints.enterCropEditor`,{shortcut:TR(`Enter`)});if(i.type===`selection`){if(e.selectionElement&&!l.length&&!e.editingTextElement&&!e.selectedLinearElement?.isEditing)return G(`hints.deepBoxSelect`,{shortcut:TR(`CtrlOrCmd`)});if($j(r)&&e.selectedElementsAreBeingDragged)return G(`hints.disableSnapping`,{shortcut:TR(`CtrlOrCmd`)});if(!l.length&&!t)return G(`hints.canvasPanning`,{shortcut_1:TR(G(`keys.mmb`)),shortcut_2:TR(`Space`)});if(l.length===1){if(ja(l[0]))return Mr(l[0])&&e.selectedLinearElement?.elementId===l[0].id&&(e.selectedLinearElement.hoverPointIndex===0||e.selectedLinearElement.hoverPointIndex===l[0].points.length-1)?G(`hints.toggleArrowhead`):e.selectedLinearElement?.isEditing?e.selectedLinearElement.selectedPointsIndices?G(`hints.lineEditor_pointSelected`,{shortcut_1:TR(`Delete`),shortcut_2:TR([`CtrlOrCmd`,`D`])}):G(`hints.lineEditor_nothingSelected`,{shortcut_1:TR(`Shift`),shortcut_2:TR(`Alt`)}):mr(l[0])?G(`hints.lineEditor_line_info`,{shortcut:TR(`Enter`)}):G(`hints.lineEditor_info`,{shortcut_1:TR(`CtrlOrCmd`),shortcut_2:TR([`CtrlOrCmd`,`Enter`])});if(!e.newElement&&!e.selectedElementsAreBeingDragged&&bi(l[0])){let e=G(`hints.bindTextToElement`,{shortcut:TR(`Enter`)}),t=G(`hints.createFlowchart`,{shortcut:TR([`CtrlOrCmd`,`↑↓`])});return Kn(l[0])?(js(l[0],r.scene.getNonDeletedElementsMap()),[e,t]):e}}}return null},DR=({appState:e,isMobile:t,editorInterface:n,app:r})=>{let i=ER({appState:e,isMobile:t,editorInterface:n,app:r});return i?(0,V.jsx)(`div`,{className:`HintViewer`,children:(0,V.jsx)(`span`,{children:(Array.isArray(i)?i.map(e=>e.replace(/\. ?$/,``)).join(`, `):i).split(/(<kbd>[^<]+<\/kbd>)/g).map((e,t)=>{if(t%2==1){let n=e[0]===`<`&&e.match(/^<kbd>([^<]+)<\/kbd>$/);return(0,V.jsx)(`kbd`,{children:n?n[1]:e},t)}return e})})}):null},OR=e=>(0,V.jsx)(Y,{className:H(`ToolIcon__lock`,{"is-mobile":e.isMobile}),type:`toggle`,icon:e.checked?Iy:Fy,checked:e.checked,title:`${e.title} \u2014 Q`,"aria-label":`${e.title}`,"data-testid":`toolbar-lock`,onSelect:()=>e.onChange?.()}),kR=({app:e,activeTool:t,setAppState:n})=>{let[r,i]=(0,B.useState)(!1),a=$z()===`full`,{TTDDialogTriggerTunnel:o}=dP(),s=t.type===`frame`,c=t.type===`laser`,l=a&&t.type===`lasso`&&e.state.preferredSelectionTool.type!==`lasso`,u=t.type===`embeddable`;return(0,V.jsxs)(Q,{open:r,children:[(0,V.jsx)(Q.Trigger,{className:H(`App-toolbar__extra-tools-trigger`,{"App-toolbar__extra-tools-trigger--selected":s||u||l||c&&!e.props.isCollaborating}),onToggle:()=>{i(!r),n({openMenu:null,openPopup:null})},title:G(`toolBar.extraTools`),children:s?Qx:u?ib:c&&!e.props.isCollaborating?rS:l?Hy:Zx}),(0,V.jsxs)(Q.Content,{onClickOutside:()=>i(!1),onSelect:()=>i(!1),className:`App-toolbar__extra-tools-dropdown`,children:[(0,V.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`frame`}),icon:Qx,shortcut:M.F.toLocaleUpperCase(),"data-testid":`toolbar-frame`,selected:s,children:G(`toolBar.frame`)}),(0,V.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`embeddable`}),icon:ib,"data-testid":`toolbar-embeddable`,selected:u,children:G(`toolBar.embeddable`)}),(0,V.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`laser`}),icon:rS,"data-testid":`toolbar-laser`,selected:c,shortcut:M.K.toLocaleUpperCase(),children:G(`toolBar.laser`)}),a&&(0,V.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`lasso`}),icon:Hy,"data-testid":`toolbar-lasso`,selected:l,children:G(`toolBar.lasso`)}),(0,V.jsx)(`div`,{style:{margin:`6px 0`,fontSize:14,fontWeight:600},children:`Generate`}),e.props.aiEnabled!==!1&&(0,V.jsx)(o.Out,{}),(0,V.jsx)(Q.Item,{onSelect:()=>e.setOpenDialog({name:`ttd`,tab:`mermaid`}),icon:$x,"data-testid":`toolbar-embeddable`,children:G(`toolBar.mermaidToExcalidraw`)}),e.props.aiEnabled!==!1&&e.plugins.diagramToCode&&(0,V.jsx)(Q.Item,{onSelect:()=>e.onMagicframeToolSelect(),icon:iS,"data-testid":`toolbar-magicframe`,badge:(0,V.jsx)(Q.Item.Badge,{children:`AI`}),children:G(`toolBar.magicframe`)})]})]})},AR=({app:e,appState:t,setAppState:n,UIOptions:r,onPenModeToggle:i,onLockToggle:a,heading:o})=>{let s=Qz(),c=$z()===`compact`,l=t.activeTool,u={app:e,activeTool:l};return(0,V.jsxs)(mC,{padding:1,className:H(`App-toolbar`,{"zen-mode":t.zenModeEnabled,"App-toolbar--compact":c}),"data-viewport-ui":`top`,children:[(0,V.jsx)(DR,{appState:t,isMobile:s.formFactor===`phone`,editorInterface:s,app:e}),o,(0,V.jsxs)(PO.Row,{gap:c?.5:1,children:[!c&&(0,V.jsx)(_P,{checked:t.penMode,onChange:()=>i(null),title:G(`toolBar.penMode`),penDetected:t.penDetected}),(0,V.jsx)(OR,{checked:t.activeTool.locked,onChange:a,title:G(`toolBar.lock`)}),(0,V.jsx)(`div`,{className:`App-toolbar__divider`}),(0,V.jsx)(sT,{...u,hideKeyBinding:!0}),c?(0,V.jsx)(bT,{...u,setAppState:n}):t.preferredSelectionTool.type===`lasso`?(0,V.jsx)(yT,{...u}):(0,V.jsx)(vT,{...u}),(0,V.jsx)(cT,{...u}),(0,V.jsx)(lT,{...u}),(0,V.jsx)(uT,{...u}),(0,V.jsx)(dT,{...u}),(0,V.jsx)(fT,{...u}),(0,V.jsx)(pT,{...u}),(0,V.jsx)(mT,{...u}),r.tools?.image!==!1&&(0,V.jsx)(hT,{...u}),(0,V.jsx)(gT,{...u}),(0,V.jsx)(`div`,{className:`App-toolbar__divider`}),(0,V.jsx)(kR,{app:e,activeTool:l,setAppState:n})]})]})},jR=({UIOptions:e})=>(0,V.jsxs)(vF,{__fallback:!0,children:[(0,V.jsx)(vF.DefaultItems.LoadScene,{}),(0,V.jsx)(vF.DefaultItems.SaveToActiveFile,{}),e.canvasActions.export&&(0,V.jsx)(vF.DefaultItems.Export,{}),e.canvasActions.saveAsImage&&(0,V.jsx)(vF.DefaultItems.SaveAsImage,{}),(0,V.jsx)(vF.DefaultItems.SearchMenu,{}),(0,V.jsx)(vF.DefaultItems.Help,{}),(0,V.jsx)(vF.DefaultItems.ClearCanvas,{}),(0,V.jsx)(vF.Separator,{}),(0,V.jsx)(vF.Group,{title:`Excalidraw links`,children:(0,V.jsx)(vF.DefaultItems.Socials,{})}),(0,V.jsx)(vF.Separator,{}),(0,V.jsx)(vF.DefaultItems.ToggleTheme,{allowSystemTheme:!1}),(0,V.jsx)(vF.DefaultItems.ChangeCanvasBackground,{})]}),MR=()=>(0,V.jsxs)(SF,{__fallback:!0,children:[(0,V.jsx)(SF.Actions.SaveToDisk,{}),(0,V.jsx)(SF.Actions.ExportToImage,{})]}),NR=({actionManager:e,appState:t,files:n,setAppState:r,elements:i,canvas:a,onLockToggle:o,onPenModeToggle:s,showExitZenModeBtn:c,renderTopLeftUI:l,renderTopRightUI:u,renderCustomStats:d,UIOptions:f,onExportImage:p,renderWelcomeScreen:m,children:h,app:g,isCollaborating:_,generateLinkForSelection:v})=>{let y=Qz(),b=$z()===`compact`,x=pP(),S=b?{menuTopGap:4,toolbarColGap:4,toolbarRowGap:1,toolbarInnerRowGap:.5,islandPadding:1,collabMarginLeft:8}:{menuTopGap:6,toolbarColGap:4,toolbarRowGap:1,toolbarInnerRowGap:1,islandPadding:1,collabMarginLeft:8},C=x.tunnelsJotai.Provider,[w,T]=W(fC),E=()=>f.canvasActions.export?(0,V.jsx)(CR,{elements:i,appState:t,files:n,actionManager:e,exportOpts:f.canvasActions.export,canvas:a,setAppState:r}):null,D=()=>!f.canvasActions.saveAsImage||t.openDialog?.name!==`imageExport`?null:(0,V.jsx)(yR,{elements:i,appState:t,files:n,actionManager:e,onExportImage:p,onCloseRequest:()=>r({openDialog:null}),name:g.getName()}),O=()=>(0,V.jsxs)(`div`,{style:{position:`relative`},children:[(0,V.jsx)(x.MainMenuTunnel.Out,{}),m&&(0,V.jsx)(x.WelcomeScreenMenuHintTunnel.Out,{})]}),ee=()=>(0,V.jsx)(CP,{heading:`selectedShapeActions`,className:H(`selected-shape-actions zen-mode-transition`,{"transition-left":t.zenModeEnabled}),children:b?(0,V.jsx)(mC,{className:H(`compact-shape-actions-island`),padding:0,"data-viewport-ui":`side`,"data-viewport-ui-name":`stylesPanel`,style:{maxHeight:`${t.height-166}px`},children:(0,V.jsx)(Vk,{appState:t,elementsMap:g.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:g,setAppState:r})}):(0,V.jsx)(mC,{className:sa.SHAPE_ACTIONS_MENU,padding:2,style:{maxHeight:`${t.height-166}px`},"data-viewport-ui":`side`,"data-viewport-ui-name":`stylesPanel`,children:(0,V.jsx)(Fk,{appState:t,elementsMap:g.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:g})})}),k=()=>{let n=us(t,i),a=t.stats.open&&!t.zenModeEnabled&&!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`;return(0,V.jsx)(gP,{side:`top`,children:(0,V.jsxs)(`div`,{className:`App-menu App-menu_top`,children:[(0,V.jsxs)(PO.Col,{gap:S.menuTopGap,className:H(`App-menu_top__left`),children:[O(),(0,V.jsx)(`div`,{className:H(`selected-shape-actions-container`,{"selected-shape-actions-container--compact":b}),children:n&&ee()}),b&&!t.viewModeEnabled&&n&&(0,V.jsx)(_P,{checked:t.penMode,onChange:()=>s(null),title:G(`toolBar.penMode`),isMobile:!0,penDetected:t.penDetected})]}),!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`&&(0,V.jsx)(CP,{heading:`shapes`,className:`shapes-section`,children:e=>(0,V.jsxs)(`div`,{style:{position:`relative`},children:[m&&(0,V.jsx)(x.WelcomeScreenToolbarHintTunnel.Out,{}),(0,V.jsx)(PO.Col,{gap:S.toolbarColGap,align:`start`,children:(0,V.jsxs)(PO.Row,{gap:S.toolbarRowGap,className:H(`App-toolbar-container`,{"zen-mode":t.zenModeEnabled}),children:[(0,V.jsx)(AR,{app:g,appState:t,setAppState:r,UIOptions:f,onPenModeToggle:s,onLockToggle:o,heading:e}),_&&(0,V.jsx)(mC,{style:{marginLeft:S.collabMarginLeft,alignSelf:`center`,height:`fit-content`},children:(0,V.jsx)(wR,{title:G(`toolBar.laser`),checked:t.activeTool.type===es.laser,onChange:()=>g.setActiveTool({type:es.laser}),isMobile:!0})})]})})]})}),(0,V.jsxs)(`div`,{className:H(`layer-ui__wrapper__top-right zen-mode-transition`,{"transition-right":t.zenModeEnabled,"layer-ui__wrapper__top-right--compact":b}),children:[t.collaborators.size>0&&(0,V.jsx)(kP,{collaborators:t.collaborators,userToFollow:t.userToFollow?.socketId||null}),u?.(y.formFactor===`phone`,t),!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`&&(!te||t.openSidebar?.name!==oe.name)&&(0,V.jsx)(x.DefaultSidebarTriggerTunnel.Out,{}),a&&(0,V.jsx)(eR,{app:g,onClose:()=>{e.executeAction(GE)},renderCustomStats:d})]})]})})},A=()=>(0,V.jsx)(LF,{__fallback:!0,onDock:e=>{rC(`sidebar`,`toggleDock (${e?`dock`:`undock`})`,`(${y.formFactor===`phone`?`mobile`:`desktop`})`)}}),te=uy(BP),ne=(0,V.jsxs)(V.Fragment,{children:[h,(0,V.jsx)(jR,{UIOptions:f}),(0,V.jsx)(LF.Trigger,{__fallback:!0,icon:VS,title:In(G(`toolBar.library`)),onToggle:e=>{e&&rC(`sidebar`,`${oe.name} (open)`,`button (${y.formFactor===`phone`?`mobile`:`desktop`})`)},tab:oe.defaultTab}),(0,V.jsx)(MR,{}),t.openDialog?.name===`ttd`&&(0,V.jsx)(cL,{__fallback:!0}),t.isLoading&&(0,V.jsx)(mP,{delay:250}),t.errorMessage&&(0,V.jsx)(aR,{onClose:()=>r({errorMessage:null}),children:t.errorMessage}),w&&y.formFactor!==`phone`&&(0,V.jsx)(pC,{colorPickerType:w.colorPickerType,onCancel:()=>{T(null)},onChange:(e,t,n,{altKey:a})=>{if(!(e!==`elementBackground`&&e!==`elementStroke`))if(n.length){for(let r of n)Ye(r,Pa(i),{[a&&w.swapPreviewOnAlt?e===`elementBackground`?`strokeColor`:`backgroundColor`:e===`elementBackground`?`backgroundColor`:`strokeColor`]:t}),wt.delete(r);g.scene.triggerUpdate()}else r(e===`elementBackground`?{currentItemBackgroundColor:t}:{currentItemStrokeColor:t})},onSelect:(e,t)=>{T(e=>e?.keepOpenOnAlt&&t.altKey?e:null),w?.onSelect?.(e,t)}}),t.openDialog?.name===`help`&&(0,V.jsx)(fR,{onClose:()=>{r({openDialog:null})}}),(0,V.jsx)(Yk,{}),t.openDialog?.name===`elementLinkSelector`&&(0,V.jsx)(iR,{sourceElementId:t.openDialog.sourceElementId,onClose:()=>{r({openDialog:null})},scene:g.scene,appState:t,generateLinkForSelection:v}),(0,V.jsx)(x.OverwriteConfirmDialogTunnel.Out,{}),D(),E(),t.openDialog?.name===`charts`&&(0,V.jsx)(SP,{data:t.openDialog.data,rawText:t.openDialog.rawText,onClose:()=>r({openDialog:null})}),y.formFactor===`phone`&&(0,V.jsx)(vP,{app:g,appState:t,elements:i,actionManager:e,renderJSONExportDialog:E,renderImageExportDialog:D,setAppState:r,onPenModeToggle:s,renderTopLeftUI:l,renderTopRightUI:u,renderSidebars:A,renderWelcomeScreen:m,UIOptions:f}),y.formFactor!==`phone`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`layer-ui__wrapper`,style:t.openSidebar&&te&&y.canFitSidebar?{width:`calc(100% - var(--right-sidebar-width))`}:{},children:[m&&(0,V.jsx)(x.WelcomeScreenCenterTunnel.Out,{}),k(),(0,V.jsx)(MP,{appState:t,actionManager:e,showExitZenModeBtn:c,renderWelcomeScreen:m}),(t.toast||t.scrolledOutside)&&(0,V.jsxs)(`div`,{className:`floating-status-stack`,children:[t.toast&&(0,V.jsx)(kT,{message:t.toast.message,onClose:()=>r({toast:null}),duration:t.toast.duration,closable:t.toast.closable}),!t.toast&&t.scrolledOutside&&(0,V.jsx)(`button`,{type:`button`,className:`scroll-back-to-content`,onClick:()=>{r(e=>({...Jt(i,e)}))},children:G(`buttons.scrollBackToContent`)})]})]}),A()]})]});return(0,V.jsx)(sC.Provider,{value:t,children:(0,V.jsx)(C,{children:(0,V.jsx)(uP.Provider,{value:x,children:ne})})})},PR=e=>{let{cursorButton:t,scrollX:n,scrollY:r,zoom:i,shouldCacheIgnoreZoom:a,snapLines:o,originSnapOffset:s,suggestedBinding:c,frameToHighlight:l,elementsToHighlight:u,...d}=e;return d},FR=B.memo(NR,(e,t)=>{if(e.children!==t.children)return!1;let{canvas:n,appState:r,...i}=e,{canvas:a,appState:o,...s}=t;return Jr(PR(r),PR(o),{selectedElementIds:Jr,selectedGroupIds:Jr})&&Jr(i,s)}),IR=e=>(0,V.jsx)(Y,{className:H(`ToolIcon__MagicButton`,{"is-mobile":e.isMobile}),type:`toggle`,size:`small`,icon:e.icon,checked:e.checked,title:`${e.title}`,"aria-label":`${e.title}`,onSelect:()=>e.onChange?.()}),LR=({trails:e})=>{let t=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(t.current)for(let n of e)n.start(t.current);return()=>{for(let t of e)t.stop()}},e),(0,V.jsx)(`div`,{className:`SVGLayer`,children:(0,V.jsx)(`svg`,{ref:t})})},RR=`#ff6b6b`,zR=`#ff0000`,BR=1,VR=2,HR=(e,t)=>{if(!t.snapLines.length)return;let n=t.theme===F.LIGHT||t.zenModeEnabled?RR:zR,r=(t.zenModeEnabled?BR*1.5:BR)/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,WR(i,e,t)):i.type===`gap`?(e.lineWidth=r,e.strokeStyle=n,qR(i.points[0],i.points[1],i.direction,t,e)):i.type===`points`&&(e.lineWidth=r,e.strokeStyle=n,UR(i,e,t));e.restore()},UR=(e,t,n)=>{if(!n.zenModeEnabled){let n=e.points[0],r=e.points[e.points.length-1];KR(n,r,t)}for(let r of e.points)GR(r,n,t)},WR=(e,t,n)=>{GR(e.points[0],n,t),n.zenModeEnabled||KR(e.points[0],e.points[1],t)},GR=([e,t],n,r)=>{r.save();let i=(n.zenModeEnabled?VR*1.5:VR)/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()},KR=(e,t,n)=>{n.beginPath(),n.lineTo(e[0],e[1]),n.lineTo(t[0],t[1]),n.stroke()},qR=(e,t,n,r,i)=>{let o=8/r.zoom.value,s=o/2,c=o/4;if(n===`horizontal`){let n=[(e[0]+t[0])/2,e[1]];r.zenModeEnabled||KR(a(e[0],e[1]-o),a(e[0],e[1]+o),i),KR(a(n[0]-c,n[1]-s),a(n[0]-c,n[1]+s),i),KR(a(n[0]+c,n[1]-s),a(n[0]+c,n[1]+s),i),r.zenModeEnabled||(KR(a(t[0],t[1]-o),a(t[0],t[1]+o),i),KR(e,t,i))}else{let n=[e[0],(e[1]+t[1])/2];r.zenModeEnabled||KR(a(e[0]-o,e[1]),a(e[0]+o,e[1]),i),KR(a(n[0]-s,n[1]-c),a(n[0]+s,n[1]-c),i),KR(a(n[0]-s,n[1]+c),a(n[0]+s,n[1]+c),i),r.zenModeEnabled||(KR(a(t[0]-o,t[1]),a(t[0]+o,t[1]),i),KR(e,t,i))}},JR=(e,t)=>{pe(t.selectedLinearElement,`selectedLinearElement is null`);let{segmentMidPointHoveredCoords:n}=t.selectedLinearElement;pe(n,`midPointCoords is null`),e.save(),e.translate(t.scrollX,t.scrollY),XR(n,e,t),e.restore()},YR=(e,t,n)=>{let{elementId:r,hoverPointIndex:i}=t.selectedLinearElement;if(t.selectedLinearElement?.isEditing&&t.selectedLinearElement?.selectedPointsIndices?.includes(i)||t.selectedLinearElement?.isDragging)return;let a=I.getElement(r,n);if(!a)return;let o=I.getPointAtIndexGlobalCoordinates(a,i,n);e.save(),e.translate(t.scrollX,t.scrollY),XR(o,e,t),e.restore()},XR=(e,t,n)=>{t.fillStyle=`rgba(105, 101, 219, 0.4)`,rn(t,e[0],e[1],I.POINT_HANDLE_SIZE/n.zoom.value,!1)},ZR=(e,t,n)=>{e.save(),e.translate(t.scrollX,t.scrollY),XR(n,e,t),e.restore()},QR=(e,t,n,r,i,a,o)=>{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)`),rn(e,n[0],n[1],(o?r*(t.selectedLinearElement?.isEditing?1.5:2):r)/t.zoom.value,!a,!o||i)},$R=(e,t,n,r,i,o=!1)=>{let s=t.element.frameId&&n.get(t.element.frameId);switch(s&&N(s)&&(e.translate(s.x,s.y),e.beginPath(),fi.radius&&e.roundRect?e.roundRect(-1,-1,s.width+1,s.height+1,fi.radius/r.zoom.value):e.rect(-1,-1,s.width+1,s.height+1),e.clip(),e.translate(-s.x,-s.y)),t.element.type){case`magicframe`:case`frame`:e.save(),e.translate(t.element.x,t.element.y),e.lineWidth=fi.strokeWidth/r.zoom.value,e.strokeStyle=r.theme===F.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,fi.radius&&e.roundRect?(e.beginPath(),e.roundRect(0,0,t.element.width,t.element.height,fi.radius/r.zoom.value),e.stroke(),e.closePath()):e.strokeRect(0,0,t.element.width,t.element.height),e.restore();break;default:e.save();let i=Li(t.element,n);switch(e.translate(i[0],i[1]),e.rotate(t.element.angle),e.translate(-i[0],-i[1]),e.translate(t.element.x,t.element.y),e.lineWidth=Fe(1.75,t.element.strokeWidth,4)/Math.max(.25,r.zoom.value),e.strokeStyle=r.theme===F.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,t.element.type){case`ellipse`:e.beginPath(),e.ellipse(t.element.width/2,t.element.height/2,t.element.width/2,t.element.height/2,0,0,2*Math.PI),e.closePath(),e.stroke();break;case`diamond`:{let[n,r]=vt(t.element);n.forEach(n=>{e.beginPath(),e.moveTo(n[0][0]-t.element.x,n[0][1]-t.element.y),e.lineTo(n[1][0]-t.element.x,n[1][1]-t.element.y),e.stroke()}),r.forEach(n=>{let[r,i,a,o]=n;e.beginPath(),e.moveTo(r[0]-t.element.x,r[1]-t.element.y),e.bezierCurveTo(i[0]-t.element.x,i[1]-t.element.y,a[0]-t.element.x,a[1]-t.element.y,o[0]-t.element.x,o[1]-t.element.y),e.stroke()})}break;default:{let[n,r]=Dr(t.element);n.forEach(n=>{e.beginPath(),e.moveTo(n[0][0]-t.element.x,n[0][1]-t.element.y),e.lineTo(n[1][0]-t.element.x,n[1][1]-t.element.y),e.stroke()}),r.forEach(n=>{let[r,i,a,o]=n;e.beginPath(),e.moveTo(r[0]-t.element.x,r[1]-t.element.y),e.bezierCurveTo(i[0]-t.element.x,i[1]-t.element.y,a[0]-t.element.x,a[1]-t.element.y,o[0]-t.element.x,o[1]-t.element.y),e.stroke()})}break}e.restore();break}if(r.isMidpointSnappingEnabled&&!r.gridModeEnabled&&!o&&(N(t.element)||sn(t.element))){let o=r.selectedLinearElement,s=o?.elementId&&I.getElement(o?.elementId,n),c=i&&Le({point:i,element:t.element,elementsMap:n,threshold:0,overrideShouldTestInside:!0}),l=s&&Ti(s)||r.activeTool.type===`arrow`&&r.currentItemArrowType===`elbow`;if(!c||l){e.save();let o=Li(t.element,n),s;if(t.element.type===`diamond`){let e=Li(t.element,n);s=We(t.element).map(n=>{let r=ot(Ee(n,.5),e,t.element.angle);return a(r[0],r[1])})}else s=[{x:t.element.width,y:t.element.height/2},{x:t.element.width/2,y:t.element.height},{x:0,y:t.element.height/2},{x:t.element.width/2,y:0}].map(e=>{let n=ot(a(e.x+t.element.x,e.y+t.element.y),o,t.element.angle);return a(n[0],n[1])});let u=i&&s.reduce((e,t,n)=>{let r=hn(t,i);return n===-1||r<e.distance?{idx:n,distance:r}:e},{idx:-1,distance:1/0}),d=4/r.zoom.value,f=Ro(r.zoom)+t.element.strokeWidth/2;s.forEach((t,n)=>{let i=(!c||l)&&u?.idx===n&&u.distance<=f,a=!i&&(l||n===u?.idx&&u.distance<=f*2);i?(e.fillStyle=r.theme===F.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,e.beginPath(),e.arc(t[0],t[1],d,0,2*Math.PI),e.fill()):a&&(e.fillStyle=r.theme===F.DARK?`rgba(0, 0, 0, 0.8)`:`rgba(65, 65, 65, 0.5)`,e.beginPath(),e.arc(t[0],t[1],d,0,2*Math.PI),e.fill())}),e.restore()}}},ez=(e,t,n,r,i,o,s)=>{let c=e.state.bindMode===`orbit`&&e.bindModeHandler!==null,l=700-(s?.runtime??(c?0:700)),u=Fe(1/700*l,1e-4,1),d=n.strokeWidth/2,f=n.frameId&&r.get(n.frameId);switch(f&&N(f)&&(t.translate(f.x,f.y),t.beginPath(),fi.radius&&t.roundRect?t.roundRect(-1,-1,f.width+1,f.height+1,fi.radius/i.zoom.value):t.rect(-1,-1,f.width+1,f.height+1),t.clip(),t.translate(-f.x,-f.y)),n.type){case`magicframe`:case`frame`:t.save(),t.translate(n.x,n.y),t.lineWidth=fi.strokeWidth/i.zoom.value,t.strokeStyle=i.theme===F.DARK?`rgba(3, 93, 161, ${u})`:`rgba(106, 189, 252, ${u})`,fi.radius&&t.roundRect?(t.beginPath(),t.roundRect(0,0,n.width,n.height,fi.radius/i.zoom.value),t.stroke(),t.closePath()):t.strokeRect(0,0,n.width,n.height),t.restore();break;default:t.save();let e=Li(n,r),a=e[0]+i.scrollX,o=e[1]+i.scrollY;switch(t.translate(a,o),t.rotate(n.angle),t.translate(-a,-o),t.translate(n.x+i.scrollX-d,n.y+i.scrollY-d),t.lineWidth=Fe(2.5,n.strokeWidth*1.75,4)/Math.max(.25,i.zoom.value),t.strokeStyle=i.theme===F.DARK?`rgba(3, 93, 161, ${u/2})`:`rgba(106, 189, 252, ${u/2})`,n.type){case`ellipse`:t.beginPath(),t.ellipse((n.width+d*2)/2,(n.height+d*2)/2,(n.width+d*2)/2,(n.height+d*2)/2,0,0,2*Math.PI),t.closePath(),t.stroke();break;case`diamond`:{let[e,r]=vt(n,d);e.forEach(e=>{t.beginPath(),t.moveTo(e[0][0]-n.x+d,e[0][1]-n.y+d),t.lineTo(e[1][0]-n.x+d,e[1][1]-n.y+d),t.stroke()}),r.forEach(e=>{let[r,i,a,o]=e;t.beginPath(),t.moveTo(r[0]-n.x+d,r[1]-n.y+d),t.bezierCurveTo(i[0]-n.x+d,i[1]-n.y+d,a[0]-n.x+d,a[1]-n.y+d,o[0]-n.x+d,o[1]-n.y+d),t.stroke()})}break;default:{let[e,r]=Dr(n,d);e.forEach(e=>{t.beginPath(),t.moveTo(e[0][0]-n.x+d,e[0][1]-n.y+d),t.lineTo(e[1][0]-n.x+d,e[1][1]-n.y+d),t.stroke()}),r.forEach(e=>{let[r,i,a,o]=e;t.beginPath(),t.moveTo(r[0]-n.x+d,r[1]-n.y+d),t.bezierCurveTo(i[0]-n.x+d,i[1]-n.y+d,a[0]-n.x+d,a[1]-n.y+d,o[0]-n.x+d,o[1]-n.y+d),t.stroke()})}break}t.restore();break}if(!c||(s?.runtime??0)>700)return;let p=.5*(Math.min(n.width,n.height)/2);if(!N(n)){t.save(),t.translate(n.x+i.scrollX,n.y+i.scrollY);let o=1/700*l;if(t.strokeStyle=`rgba(0, 0, 0, 0.2)`,t.lineWidth=1/i.zoom.value,t.setLineDash([4/i.zoom.value,4/i.zoom.value]),t.lineDashOffset=-o*10/i.zoom.value,t.beginPath(),t.ellipse(n.width/2,n.height/2,p,p,0,0,2*Math.PI),t.stroke(),t.fillStyle=`rgba(0, 0, 0, 0.04)`,t.beginPath(),t.ellipse(n.width/2,n.height/2,p*(1-u),p*(1-u),0,0,2*Math.PI),t.fill(),t.restore(),i.isMidpointSnappingEnabled&&!i.gridModeEnabled&&(!e.lastPointerMoveEvent||!Wr(e.lastPointerMoveEvent))){t.save(),t.translate(n.x+i.scrollX,n.y+i.scrollY);let e=5/i.zoom.value,o=e+5/i.zoom.value,s;if(n.type===`diamond`){let[,e]=vt(n),t=Li(n,r);s=e.map(e=>{let r=ot(Ee(e,.5),t,n.angle);return{x:r[0]-n.x,y:r[1]-n.y}})}else{let e=Li(n,r);s=[{x:n.width/2,y:0},{x:n.width,y:n.height/2},{x:n.width/2,y:n.height},{x:0,y:n.height/2}].map(t=>{let r=ot(a(t.x+n.x,t.y+n.y),e,n.angle);return{x:r[0]-n.x,y:r[1]-n.y}})}s.forEach(e=>{t.clearRect(e.x-o,e.y-o,o*2,o*2)}),t.fillStyle=i.theme===F.DARK?`rgba(3, 93, 161, ${u})`:`rgba(106, 189, 252, ${u})`,s.forEach(n=>{t.beginPath(),t.arc(n.x,n.y,e,0,2*Math.PI),t.fill()}),t.restore()}}return{runtime:(s?.runtime??0)+o}},tz=(e,t,n,r,i,o,s)=>{if(n!==null){if(Cr(`COMPLEX_BINDINGS`))return ez(e,t,n.element,r,i,o,s);t.save(),t.translate(i.scrollX,i.scrollY),$R(t,n,r,i,e.lastPointerMoveCoords?a(e.lastPointerMoveCoords.x,e.lastPointerMoveCoords.y):null,!!e.lastPointerMoveEvent&&Wr(e.lastPointerMoveEvent)),t.restore()}},nz=(e,t,n)=>{let{angle:r,x1:i,y1:a,x2:o,y2:s,selectionColors:c,cx:l,cy:u,dashed:d,activeEmbeddable:f}=n,p=o-i,m=s-a,h=(n.padding??4)/t.zoom.value,g=8/t.zoom.value,_=4/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=(f?4:1)/t.zoom.value;let v=c.length;for(let t=0;t<v;++t)e.strokeStyle=c[t],d&&e.setLineDash([g,_+(g+_)*(v-1)]),e.lineDashOffset=(g+_)*t,xt(e,i-h,a-h,p+h*2,m+h*2,l,u,r);e.restore()},rz=(e,t,n,r)=>{let[i,a,o,s]=Zi(n,r),c=o-i,l=s-a;e.strokeStyle=`rgb(0,118,255)`,e.lineWidth=fi.strokeWidth/t.zoom.value,e.save(),e.translate(t.scrollX,t.scrollY),xt(e,i,a,c,l,i+c/2,a+l/2,n.angle,!1,fi.radius/t.zoom.value),e.restore()},iz=(e,t,n,r)=>{let{colors:i=[`rgb(0,118,255)`],dashed:a=!1}=r||{},o=n.filter(e=>e.groupIds.length===0),s=n.filter(e=>e.groupIds.length>0),c=e=>{let[t,n,r,o]=He(e);return{angle:0,x1:t,x2:r,y1:n,y2:o,selectionColors:i,dashed:a,cx:t+(r-t)/2,cy:n+(o-n)/2,activeEmbeddable:!1}},l=e=>{let t=Tt(n,e);return c(t)};Object.entries(eo(s,t)).filter(([e,t])=>t).map(([e,t])=>e).map(e=>l(e)).concat(o.map(e=>c([e]))).forEach(n=>nz(e,t,n))},az=(e,t,n,r)=>{if(!t.selectedLinearElement)return;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=1/t.zoom.value;let i=I.getPointsGlobalCoordinates(n,r),{POINT_HANDLE_SIZE:o}=I,s=t.selectedLinearElement?.isEditing?o:o/2,c=Ti(n),l=mr(n);if(i.forEach((r,a)=>{if(c&&a!==0&&a!==i.length-1)return;let o=a>0&&(a!==i.length-1||!l||!n.polygon)&&Ar(r,a===i.length-1?i[0]:i[a-1],2/t.zoom.value),u=!!t.selectedLinearElement?.isEditing&&!!t.selectedLinearElement?.selectedPointsIndices?.includes(a);l&&n.polygon&&!u&&a===n.points.length-1&&t.selectedLinearElement?.isEditing&&t.selectedLinearElement?.selectedPointsIndices?.includes(0)&&(u=!0),QR(e,t,r,s,u,!1,o)}),Ti(n)){let s=n.fixedSegments?.map(e=>e.index)||[];i.slice(0,-1).forEach((c,l)=>{I.isSegmentTooShort(n,i[l+1],i[l],l,t.zoom,r)||QR(e,t,a((c[0]+i[l+1][0])/2,(c[1]+i[l+1][1])/2),o/2,!1,!s.includes(l+1),!1)})}else I.getEditorMidPoints(n,r,t).filter((e,t,r)=>e!==null&&!(Ti(n)&&(t===0||t===r.length-1))).forEach(n=>{(t.selectedLinearElement?.isEditing||i.length===2)&&QR(e,t,n,o/2,!1,!0,!1)});e.restore()},oz=(e,t,n,r)=>{e.save(),e.translate(t.scrollX,t.scrollY),e.strokeStyle=`rgba(134, 131, 226, 0.6)`,e.lineWidth=1/t.zoom.value,e.setLineDash([4/t.zoom.value,4/t.zoom.value]),e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(r[0],r[1]),e.stroke(),e.restore()},sz=(e,t,n,r,i)=>{e.save(),e.translate(t.scrollX,t.scrollY),e.strokeStyle=`rgba(134, 131, 226, 0.6)`,e.lineWidth=1/t.zoom.value,e.setLineDash([]),e.fillStyle=i?`rgba(134, 131, 226, 0.9)`:`rgba(255, 255, 255, 0.9)`,rn(e,n[0],n[1],r/t.zoom.value,!0,!0),e.restore()},cz=({arrow:e,appState:t,type:n,context:r,elementsMap:i})=>{let a=n===`start`?e.startBinding:e.endBinding,o=a?.elementId&&i.get(a.elementId);if(!o||!sn(o)||o.isDeleted)return;let s=Ss(a.fixedPoint,o,i);if(!gr(s,e,o,i,t,n))return;let c=t.selectedLinearElement,l=!!c?.isDragging,u=n===`start`?0:e.points.length-1,d=!!c?.selectedPointsIndices?.includes(u);if(c?.hoveredFocusPointBinding===n&&!c.draggedFocusPointBinding&&ZR(r,t,s),!(d&&l)){let s=Ss(a.fixedPoint,o,i),l=c?.hoveredFocusPointBinding===n;oz(r,t,I.getPointAtIndexGlobalCoordinates(e,u,i),s),sz(r,t,s,_n/1.5,l)}},lz=(e,t,n,r,i)=>{Object.keys(r).forEach(a=>{let o=r[a];if(o!==void 0){let[r,s,c,l]=o;e.save(),e.lineWidth=1/n.zoom.value,t.selectionColor&&(e.strokeStyle=t.selectionColor),a===`rotation`?rn(e,r+c/2,s+l/2,c/2,!0):e.roundRect?(e.beginPath(),e.roundRect(r,s,c,l,2/n.zoom.value),e.fill(),e.stroke()):xt(e,r,s,c,l,r+c/2,s+l/2,i,!0),e.restore()}})},uz=(e,t,n,r,i)=>{let[a,o,,,s,c]=Zi(r,i),l=3/n.zoom.value,u=l/2,d=s-a+l,f=c-o+l,p=Math.min(20/n.zoom.value,d),m=Math.min(20/n.zoom.value,f);e.save(),e.fillStyle=t.selectionColor,e.strokeStyle=t.selectionColor,e.lineWidth=l,[[[-d,-f],[0,u],[p,u],[u,0],[u,m]],[[d-u,-f],[u,u],[-p+u,u],[0,0],[0,m]],[[-d,f],[0,-u],[p,-u],[u,0],[u,-m]],[[d-u,f],[u,-u],[-p+u,-u],[0,0],[0,-m]]].forEach(t=>{let[[n,i],[a,o],[l,u],[d,f],[p,m]]=t;e.save(),e.translate(s,c),e.rotate(r.angle),e.beginPath(),e.moveTo(n+a,i+o),e.lineTo(n+l,i+u),e.stroke(),e.beginPath(),e.moveTo(n+d,i+f),e.lineTo(n+p,i+m),e.stroke(),e.restore()}),e.restore()},dz=(e,t,n,r)=>{t.save();let i=AM(n.zoom.value),a=e.width+i*2,o=e.height+i*2,s=e.x+e.width/2,c=e.y+e.height/2,l=-(e.width/2+i),u=-(e.height/2+i);t.translate(s+n.scrollX,c+n.scrollY),t.rotate(e.angle),t.lineWidth=1/n.zoom.value,t.strokeStyle=r,t.globalAlpha=.5,t.setLineDash([6/n.zoom.value,4/n.zoom.value]),t.strokeRect(l,u,a,o),t.restore()},fz=(e,t,n,r,i)=>{let a=jM(e,n.zoom.value,i);a&&(t.save(),t.globalAlpha=.5,t.lineWidth=1.5/n.zoom.value,t.lineCap=`round`,t.strokeStyle=r,t.beginPath(),t.moveTo(a.start[0]+n.scrollX,a.start[1]+n.scrollY),t.lineTo(a.end[0]+n.scrollX,a.end[1]+n.scrollY),t.stroke(),t.restore())},pz=({app:e,canvas:t,elementsMap:n,visibleElements:r,selectedElements:i,allElementsMap:a,scale:o,appState:s,renderConfig:c,editorInterface:u,animationState:d,deltaTime:f})=>{if(t===null)return{};let[p,m]=Zs(t,o),h=d,g=co({canvas:t,scale:o,normalizedWidth:p,normalizedHeight:m});g.save(),g.scale(s.zoom.value,s.zoom.value);let _;if(r.forEach(e=>{s.selectedLinearElement?.isEditing&&s.selectedLinearElement.elementId===e.id&&e&&(_=e)}),_&&az(g,s,_,n),s.selectionElement&&!s.isCropping)try{Ks(s.selectionElement,g,s,c.selectionColor)}catch(e){console.error(e)}let v=Yo(i,s);if(v&&!v.autoResize&&fz(v,g,s,c.selectionColor,u.formFactor),s.editingTextElement){let e=a.get(s.editingTextElement.id);e&&!e.autoResize&&dz(e,g,s,c.selectionColor)}if(h=s.isBindingEnabled&&s.suggestedBinding?{...d,bindingHighlight:tz(e,g,s.suggestedBinding,a,s,f,d?.bindingHighlight)}:{...d,bindingHighlight:void 0},s.frameToHighlight&&rz(g,s,s.frameToHighlight,n),s.elementsToHighlight&&iz(g,s,s.elementsToHighlight),s.activeLockedId){let e=a.get(s.activeLockedId);iz(g,s,e?[e]:Tt(a,s.activeLockedId),{colors:[`#ced4da`],dashed:!0})}let y=i.some(e=>N(e));i.length===1&&s.selectedLinearElement?.isEditing&&s.selectedLinearElement.elementId===i[0].id&&az(g,s,i[0],n);let b=s.selectedLinearElement,x=b&&I.getElement(b.elementId,a);if(x&&(s.selectedLinearElement.isDragging||(b.segmentMidPointHoveredCoords?JR(g,s):(Ti(x)?b.hoverPointIndex===0||b.hoverPointIndex===x.points.length-1:b.hoverPointIndex>=0)&&YR(g,s,n)),Mr(x)&&(cz({arrow:x,elementsMap:a,appState:s,context:g,type:`start`}),cz({arrow:x,elementsMap:a,appState:s,context:g,type:`end`}))),!s.multiElement&&!s.newElement&&!s.selectedLinearElement?.isEditing){let e=Ur(i,s,u),t=i.length===1&&ja(i[0]);t&&s.selectedLinearElement?.elementId===i[0].id&&!i[0].locked&&az(g,s,i[0],n);let r=c.selectionColor||`#000`;if(e){let e=Pa(i),a=[];for(let i of n.values()){let o=[],l=c.remoteSelectedElementIds.get(i.id);if(t&&Ti(i)&&(i.startBinding||i.endBinding)||(e.has(i.id)&&!lt(s,i)&&o.push(r),l&&o.push(...l.map(e=>xE(e,s.collaborators.get(e))))),o.length){let[e,t,r,c,u,d]=Zi(i,n,!0);a.push({angle:i.angle,x1:e,y1:t,x2:r,y2:c,selectionColors:i.locked?[`#ced4da`]:o,dashed:!!l||i.locked,cx:u,cy:d,activeEmbeddable:s.activeEmbeddable?.element===i&&s.activeEmbeddable.state===`active`,padding:i.id===s.croppingElementId||Ce(i)?0:void 0})}}let o=e=>{let t=Tt(n,e),[r,i,o,s]=He(t);a.push({angle:0,x1:r,x2:o,y1:i,y2:s,selectionColors:t.some(e=>e.locked)?[`#ced4da`]:[`#000`],dashed:!0,cx:r+(o-r)/2,cy:i+(s-i)/2,activeEmbeddable:!1})};for(let e of yr(s))o(e);s.editingGroupId&&o(s.editingGroupId),a.forEach(e=>nz(g,s,e))}if(g.save(),g.translate(s.scrollX,s.scrollY),i.length===1){g.fillStyle=`#fff`;let t=l(i[0],s.zoom,n,`mouse`,$e(u));if(!s.viewModeEnabled&&e&&!R(s.editingTextElement)&&!s.croppingElementId&&lz(g,c,s,t,i[0].angle),s.croppingElementId&&!s.isCropping){let e=n.get(s.croppingElementId);e&&Ce(e)&&uz(g,c,s,e,n)}}else if(i.length>1&&!s.isRotating&&!i.some(e=>e.locked)){let e=4/s.zoom.value;g.fillStyle=`#fff`;let[t,a,o,l]=He(i,n),d=g.getLineDash();g.setLineDash([2/s.zoom.value]);let f=g.lineWidth;g.lineWidth=1/s.zoom.value,g.strokeStyle=r,xt(g,t-e,a-e,o-t+e*2,l-a+e*2,(t+o)/2,(a+l)/2,0),g.lineWidth=f,g.setLineDash(d);let p=fa([t,a,o,l,(t+o)/2,(a+l)/2],0,s.zoom,`mouse`,y?{...$e(u),rotation:!0}:$e(u));i.some(e=>!e.locked)&&lz(g,c,s,p,0)}g.restore()}s.searchMatches?.matches.forEach(({id:e,focus:t,matchedLines:r})=>{let i=n.get(e);if(i){let[e,a,,,o,c]=Zi(i,n,!0);g.save(),s.theme===F.LIGHT?t?g.fillStyle=`rgba(255, 124, 0, 0.4)`:g.fillStyle=`rgba(255, 226, 0, 0.4)`:t?g.fillStyle=`rgba(229, 82, 0, 0.4)`:g.fillStyle=`rgba(99, 52, 0, 0.4)`;let l=N(i)?s.zoom.value:1;g.translate(s.scrollX,s.scrollY),g.translate(o,c),g.rotate(i.angle),r.forEach(n=>{(n.showOnCanvas||t)&&g.fillRect(e+n.offsetX/l-o,a+n.offsetY/l-c,n.width/l,n.height/l)}),g.restore()}}),HR(g,s),g.restore(),CE({context:g,renderConfig:c,appState:s,normalizedWidth:p,normalizedHeight:m});let S;return c.renderScrollbars&&(S=VM(n,p,m,s),g.save(),g.fillStyle=BM,g.strokeStyle=`rgba(255,255,255,0.8)`,[S.horizontal,S.vertical].forEach(e=>{e&&yE(g,e.x,e.y,e.width,e.height,zM/2)}),g.restore()),{scrollBars:S,animationState:h}},mz=e=>{let t=pz(e);return e.callback(t),t},hz=`animateInteractiveScene`,gz=e=>{let t=(0,B.useRef)(!1),n=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(!t.current){t.current=!0;return}let r=new Map,i=new Map,a=new Map,o=new Map,s=new Map;e.appState.collaborators.forEach((t,n)=>{if(t.selectedElementIds)for(let e of Object.keys(t.selectedElementIds))a.has(e)||a.set(e,[]),a.get(e).push(n);!t.pointer||t.pointer.renderCursor===!1||(t.username&&o.set(n,t.username),t.userState&&s.set(n,t.userState),i.set(n,Qi({sceneX:t.pointer.x,sceneY:t.pointer.y},e.appState)),r.set(n,t.button))});let c=e.containerRef?.current&&getComputedStyle(e.containerRef.current).getPropertyValue(`--color-selection`)||`#6965db`;n.current={app:e.app,canvas:e.canvas,elementsMap:e.elementsMap,visibleElements:e.visibleElements,selectedElements:e.selectedElements,allElementsMap:e.allElementsMap,scale:window.devicePixelRatio,appState:e.appState,renderConfig:{remotePointerViewportCoords:i,remotePointerButton:r,remoteSelectedElementIds:a,remotePointerUsernames:o,remotePointerUserStates:s,selectionColor:c,renderScrollbars:e.renderScrollbars,lastViewportPosition:e.app.lastViewportPosition},editorInterface:e.editorInterface,callback:e.renderInteractiveSceneCallback,animationState:{bindingHighlight:void 0},deltaTime:0},Xe.running(hz)||Xe.start(hz,({deltaTime:e,state:t})=>{let r=mz({...n.current,deltaTime:e,animationState:t}).animationState;if(r){for(let e in r)if(r[e]!==void 0)return r}})}),(0,V.jsx)(`canvas`,{className:`excalidraw__canvas interactive`,style:{width:e.appState.width,height:e.appState.height,cursor:e.appState.viewModeEnabled&&e.appState.activeTool.type!==`laser`?Ri.GRAB:Ri.AUTO},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:e.handleCanvasRef,onContextMenu:e.onContextMenu,onClick:e.onClick,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onPointerCancel:e.onPointerCancel,onTouchMove:e.onTouchMove,onPointerDown:e.onPointerDown,onDoubleClick:e.appState.viewModeEnabled?void 0:e.onDoubleClick,children:G(`labels.drawingCanvas`)})},_z=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,activeTool:e.activeTool,openDialog:e.openDialog,editingGroupId:e.editingGroupId,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,selectionElement:e.selectionElement,selectedGroupIds:e.selectedGroupIds,selectedLinearElement:e.selectedLinearElement,multiElement:e.multiElement,newElement:e.newElement,isBindingEnabled:e.isBindingEnabled,isMidpointSnappingEnabled:e.isMidpointSnappingEnabled,gridModeEnabled:e.gridModeEnabled,suggestedBinding:e.suggestedBinding,isRotating:e.isRotating,elementsToHighlight:e.elementsToHighlight,collaborators:e.collaborators,activeEmbeddable:e.activeEmbeddable,snapLines:e.snapLines,zenModeEnabled:e.zenModeEnabled,editingTextElement:e.editingTextElement,isCropping:e.isCropping,croppingElementId:e.croppingElementId,searchMatches:e.searchMatches,activeLockedId:e.activeLockedId,hoveredElementIds:e.hoveredElementIds,frameRendering:e.frameRendering,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,exportScale:e.exportScale,currentItemArrowType:e.currentItemArrowType}),vz=B.memo(gz,(e,t)=>e.selectionNonce!==t.selectionNonce||e.canvasNonce!==t.canvasNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements||e.selectedElements!==t.selectedElements||e.renderScrollbars!==t.renderScrollbars?!1:Jr(_z(e.appState),_z(t.appState))),yz=e=>{let t=(0,B.useRef)(null),n=(0,B.useRef)(!1);return(0,B.useEffect)(()=>{e.canvas.style.width=`${e.appState.width}px`,e.canvas.style.height=`${e.appState.height}px`,e.canvas.width=e.appState.width*e.scale,e.canvas.height=e.appState.height*e.scale},[e.appState.height,e.appState.width,e.canvas,e.scale]),(0,B.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`)),_o({canvas:i,rc:e.rc,scale:e.scale,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,visibleElements:e.visibleElements,appState:e.appState,renderConfig:e.renderConfig},ss())}),(0,V.jsx)(`div`,{className:`excalidraw__canvas-wrapper`,ref:t})},bz=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,openDialog:e.openDialog,hoveredElementIds:e.hoveredElementIds,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,viewBackgroundColor:e.viewBackgroundColor,exportScale:e.exportScale,selectedElementsAreBeingDragged:e.selectedElementsAreBeingDragged,gridSize:e.gridSize,gridStep:e.gridStep,frameRendering:e.frameRendering,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,editingGroupId:e.editingGroupId,currentHoveredFontFamily:e.currentHoveredFontFamily,croppingElementId:e.croppingElementId,suggestedBinding:e.suggestedBinding}),xz=B.memo(yz,(e,t)=>e.canvasNonce!==t.canvasNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements?!1:Jr(bz(e.appState),bz(t.appState))&&Jr(e.renderConfig,t.renderConfig)),Sz=({canvas:e,rc:t,newElement:n,elementsMap:r,allElementsMap:i,scale:a,appState:o,renderConfig:s})=>{if(e){let[c,l]=Zs(e,a),u=co({canvas:e,scale:a,normalizedWidth:c,normalizedHeight:l});if(u.save(),u.scale(o.zoom.value,o.zoom.value),n&&n.type!==`selection`){if(si(n))return;if((n.frameId||o.frameToHighlight?.id)&&o.frameRendering.enabled&&o.frameRendering.clip){let e=ia(n,r,o);e&&tc(n,e,o,r)&&Us(e,u,s,o)}Qr(n,r,i,t,u,s,o)}else u.clearRect(0,0,c,l);u.restore()}},Cz=As(e=>{Sz(e)}),wz=(e,t)=>{if(t){Cz(e);return}Sz(e)},Tz=e=>{let t=(0,B.useRef)(null);return(0,B.useEffect)(()=>{t.current&&wz({canvas:t.current,scale:e.scale,newElement:e.newElement,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,rc:e.rc,renderConfig:e.renderConfig,appState:e.appState},ss())}),(0,V.jsx)(`canvas`,{className:`excalidraw__canvas`,style:{width:e.appState.width,height:e.appState.height},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:t})},Ez=700,Dz=100,Oz=16,kz=300*1e3,Az=Ec(null),jz=e=>e===Er.elbow?jS:e===Er.round?MS:AS,Mz=class{constructor(e){z(this,`app`),z(this,`lastShownAt`,0),z(this,`show`,e=>{let{x:t,y:n}=this.app.lastViewportPosition;t===0&&n===0||(this.lastShownAt=Date.now(),this.app.updateEditorAtom(Az,{content:e,nonce:Math.random()}))}),z(this,`isOnCooldown`,()=>Date.now()-this.lastShownAt<kz),z(this,`onArrowTypeCycled`,e=>{this.show(jz(e))}),z(this,`onToolShortcut`,(e,t)=>{(t===`digit`||!this.isOnCooldown())&&this.show(e===`line`?qy:jz(this.app.state.currentItemArrowType))}),this.app=e}},Nz=()=>{let[e,t]=W(Az),n=Xz(),{container:r}=eB(),i=(0,B.useRef)(null),[a,o]=(0,B.useState)(!1),s=e?.nonce;return(0,B.useLayoutEffect)(()=>{if(s==null||!r)return;let e=(e,t)=>{let n=i.current;if(!n)return;let a=r.getBoundingClientRect(),o=e-a.left+Oz,s=t-a.top+Oz;o+n.offsetWidth>a.width&&(o=e-a.left-Oz-n.offsetWidth),s+n.offsetHeight>a.height&&(s=t-a.top-Oz-n.offsetHeight),n.style.transform=`translate(${o}px, ${s}px)`};e(n.lastViewportPosition.x,n.lastViewportPosition.y);let t=t=>{e(t.clientX,t.clientY)};return window.addEventListener(L.POINTER_MOVE,t),()=>{window.removeEventListener(L.POINTER_MOVE,t)}},[s,r,n]),(0,B.useEffect)(()=>()=>{t(null)},[t]),(0,B.useEffect)(()=>{if(s==null)return;o(!1);let e=window.setTimeout(()=>{o(!0)},Ez),n=window.setTimeout(()=>{t(null)},Ez+Dz),r=()=>{t(null)};return window.addEventListener(L.POINTER_DOWN,r,{capture:!0}),()=>{window.clearTimeout(e),window.clearTimeout(n),window.removeEventListener(L.POINTER_DOWN,r,{capture:!0})}},[s,t]),e?(0,V.jsx)(`div`,{ref:i,className:H(`CursorHint`,{"CursorHint--fade-out":a}),"data-testid":`cursor-hint`,children:e.content}):null},Pz=class{constructor(e){this.getState=e,z(this,`listeners`,[]),z(this,`onStateChange`,(e,t,n)=>{let{predicate:r,getValue:i,callback:a,once:o,matchesImmediately:s}=this.normalize(e,t,n);return a?s&&(queueMicrotask(()=>{let e=this.getState();a(i(e),e)}),o)?()=>{}:this.subscribe({predicate:r,getValue:i,callback:a,once:o}):s?Promise.resolve(i(this.getState())):new Promise(e=>{this.subscribe({predicate:r,getValue:i,callback:t=>e(t),once:!0})})})}isStateChangePredicateOptions(e){return typeof e==`object`&&!Array.isArray(e)&&`predicate`in e}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}normalize(e,t,n){let r,i,a=t,o=n?.once??!1,s=!1;if(this.isStateChangePredicateOptions(e)){let{predicate:t,callback:n,once:c}=e;r=t,i=e=>e,a=n?(e,t)=>n(t):void 0,o=c??!1,s=t(this.getState())}else if(typeof e==`function`){let t=e;r=(e,n)=>t(e)!==t(n),i=e=>t(e)}else if(Array.isArray(e)){let t=e;r=(e,n)=>t.some(t=>e[t]!==n[t]),i=e=>e}else{let t=e;r=(e,n)=>e[t]!==n[t],i=e=>e[t]}return{predicate:r,getValue:i,callback:a,once:o,matchesImmediately:s}}flush(e){if(!this.listeners.length)return;let t=this.getState(),n=[];for(let r of this.listeners)r.predicate(t,e)?(r.callback(r.getValue(t),t),r.once||n.push(r)):n.push(r);this.listeners=n}clear(){this.listeners=[]}},Fz=({app:e,activeLockedId:t})=>{let n=e.scene.getElement(t);n&&!ko(n)&&console.error(`[NONDELETED][INVARIANT] UnlockPopup: activeLockedId points to a deleted element`);let r=n&&ko(n)?n:null,i=r?[r]:Tt(e.scene.getNonDeletedElementsMap(),t);if(i.length===0)return null;let[a,o]=He(i),{x:s,y:c}=Qi({sceneX:a,sceneY:o},e.state);return(0,V.jsx)(`div`,{className:`UnlockPopup`,style:{bottom:`${e.state.height+12-c+e.state.offsetTop}px`,left:`${s-e.state.offsetLeft}px`},onClick:()=>{(0,Sc.flushSync)(()=>{let t=eo(i,e.state);e.setState({selectedElementIds:i.reduce((e,t)=>({...e,[t.id]:!0}),{}),selectedGroupIds:t,activeLockedId:null})}),e.actionManager.executeAction(mD)},title:G(`labels.elementLock.unlock`),children:Ly})},Iz=B.createContext(null),Lz=B.createContext(null),Rz=302,zz={full:216,compact:64},Bz={formFactor:`desktop`,desktopUIMode:`full`,userAgent:lr(typeof navigator<`u`?navigator.userAgent:``),isTouchScreen:!1,canFitSidebar:!1,isLandscape:!0},Vz=B.createContext(Bz);Vz.displayName=`EditorInterfaceContext`;var Hz={"editor:mount":{cardinality:`once`,replay:`last`},"editor:initialize":{cardinality:`once`,replay:`last`},"editor:unmount":{cardinality:`once`,replay:`last`}},Uz=B.createContext({container:null,id:null});Uz.displayName=`ExcalidrawContainerContext`;var Wz=B.createContext([]);Wz.displayName=`ExcalidrawElementsContext`;var Gz=B.createContext({...zt(),width:0,height:0,offsetLeft:0,offsetTop:0});Gz.displayName=`ExcalidrawAppStateContext`;var Kz=B.createContext(()=>{console.warn(`Uninitialized ExcalidrawSetAppStateContext context!`)});Kz.displayName=`ExcalidrawSetAppStateContext`;var qz=B.createContext(null);qz.displayName=`ExcalidrawActionManagerContext`;var Jz=B.createContext(null);Jz.displayName=`ExcalidrawAPIContext`;var Yz=B.createContext(null);Yz.displayName=`ExcalidrawAPISetContext`;var Xz=()=>(0,B.useContext)(Iz),Zz=()=>(0,B.useContext)(Lz),Qz=()=>(0,B.useContext)(Vz),$z=()=>Fi(Qz()),eB=()=>(0,B.useContext)(Uz),tB=()=>(0,B.useContext)(Wz),nB=()=>(0,B.useContext)(Gz),rB=()=>(0,B.useContext)(Kz),iB=()=>(0,B.useContext)(qz),aB=()=>(0,B.useContext)(Jz),oB=!1,sB=0,cB=null,lB=!1,uB=!1,dB=!1,fB={horizontal:null,vertical:null},pB=0,mB=!1,hB=new Map,gB=4,_B=200,vB=!1,yB=0,bB=!1,xB=null,SB={pointers:new Map,lastCenter:null,initialDistance:null,initialScale:null},CB=class e extends B.Component{constructor(t){super(t),z(this,`canvas`),z(this,`interactiveCanvas`,null),z(this,`sessionExportThemeOverride`),z(this,`rc`),z(this,`unmounted`,!1),z(this,`actionManager`),z(this,`editorInterface`,Bz),z(this,`stylesPanelMode`,Fi(Bz)),z(this,`viewportUILastMeasured`,new Map),z(this,`excalidrawContainerRef`,B.createRef()),z(this,`scene`),z(this,`fonts`),z(this,`renderer`),z(this,`visibleElements`),z(this,`hasRenderableElements`,!1),z(this,`resizeObserver`),z(this,`library`),z(this,`libraryItemsFromStorage`),z(this,`id`),z(this,`store`),z(this,`history`),z(this,`excalidrawContainerValue`),z(this,`files`,{}),z(this,`imageCache`,new Map),z(this,`iFrameRefs`,new Map),z(this,`embedsValidationStatus`,new Map),z(this,`initializedEmbeds`,new Set),z(this,`elementsPendingErasure`,new Set),z(this,`_initialized`,!1),z(this,`editorLifecycleEvents`,new be(Hz)),z(this,`onEvent`,this.editorLifecycleEvents.on.bind(this.editorLifecycleEvents)),z(this,`appStateObserver`,new Pz(()=>this.state)),z(this,`onStateChange`,this.appStateObserver.onStateChange),z(this,`flowchart`,new iP(this)),z(this,`bindModeHandler`,null),z(this,`hitLinkElement`),z(this,`lastPointerDownEvent`,null),z(this,`lastPointerUpEvent`,null),z(this,`lastPointerUpIsDoubleClick`,!1),z(this,`lastPointerMoveEvent`,null),z(this,`lastPointerMoveCoords`,null),z(this,`lastCompletedCanvasClicks`,[]),z(this,`removedArrowheads`,new Map),z(this,`previousPointerMoveCoords`,null),z(this,`lastViewportPosition`,{x:0,y:0}),z(this,`laserTrails`,new wM(this)),z(this,`eraserTrail`,new JM(this)),z(this,`lassoTrail`,new qM(this)),z(this,`cursorHints`,new Mz(this)),z(this,`onChangeEmitter`,new io),z(this,`onPointerDownEmitter`,new io),z(this,`onPointerUpEmitter`,new io),z(this,`onUserFollowEmitter`,new io),z(this,`onScrollChangeEmitter`,new io),z(this,`missingPointerEventCleanupEmitter`,new io),z(this,`onRemoveEventListenersEmitter`,new io),z(this,`api`),z(this,`updateEditorAtom`,(e,...t)=>{let n=py.set(e,...t);return this.triggerRender(),n}),z(this,`previousHoveredBindableElement`,null),z(this,`getEffectiveGridSize`,()=>$j(this)?this.state.gridSize:null),z(this,`getTextCreationGridPoint`,(e,t)=>{let n=this.getEffectiveGridSize();if(n===null)return null;let r=e=>Math.floor(e/n)*n;return{x:r(e),y:r(t)}}),z(this,`handleIframeLikeElementHover`,({hitElement:e,scenePointer:t,moveEvent:n})=>e&&Si(e)&&(this.state.viewModeEnabled||this.state.activeTool.type===`laser`||this.isIframeLikeElementCenter(e,n,t.x,t.y))?(Yw(this.interactiveCanvas,Ri.POINTER),this.setState({activeEmbeddable:{element:e,state:`hover`}}),!0):(this.state.activeEmbeddable?.state===`hover`&&this.setState({activeEmbeddable:null}),!1)),z(this,`isDoubleClick`,(e,t)=>e!=null&&t.timeStamp-e.timeStamp<=300),z(this,`updateEmbedValidationStatus`,(e,t)=>{this.embedsValidationStatus.set(e.id,t),wt.delete(e)}),z(this,`updateEmbeddables`,()=>{let e=new Set,t=!1;this.scene.getNonDeletedElements().filter(n=>{if(rc(n)){if(e.add(n.id),!this.embedsValidationStatus.has(n.id)){t=!0;let e=Ao(n.link,this.props.validateEmbeddable);this.updateEmbedValidationStatus(n,e)}}else ji(n)&&e.add(n.id);return!1}),t&&this.scene.triggerUpdate(),this.iFrameRefs.forEach((t,n)=>{e.has(n)||this.iFrameRefs.delete(n)})}),z(this,`getFrameNameDOMId`,e=>`${this.id}-frame-name-${e.id}`),z(this,`frameNameBoundsCache`,{get:e=>{let t=this.frameNameBoundsCache._cache.get(e.id);if(!t||t.zoom!==this.state.zoom.value||t.versionNonce!==e.versionNonce){let n=document.getElementById(this.getFrameNameDOMId(e));if(n){let r=n.getBoundingClientRect(),i=Ka({clientX:r.x,clientY:r.y},this.state),a=Ka({clientX:r.right,clientY:r.bottom},this.state);return t={x:i.x,y:i.y,width:a.x-i.x,height:a.y-i.y,zoom:this.state.zoom.value,versionNonce:e.versionNonce},this.frameNameBoundsCache._cache.set(e.id,t),t}return null}return t},_cache:new Map}),z(this,`resetEditingFrame`,e=>{e&&this.scene.mutateElement(e,{name:e.name?.trim()||null}),this.setState({editingFrame:null})}),z(this,`renderFrameNames`,()=>{if(!this.state.frameRendering.enabled||!this.state.frameRendering.name)return this.state.editingFrame&&this.resetEditingFrame(null),null;let e=this.state.theme===F.DARK,t=this.scene.getNonDeletedFramesLikes(),n=t.length>0&&this.state.searchMatches?.focusedId&&N(this.scene.getElement(this.state.searchMatches.focusedId))?this.state.searchMatches.matches.find(e=>e.focus):null;return t.map(t=>{if(!Oa(t,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 this.state.editingFrame===t.id&&this.resetEditingFrame(t),null;let{x:r,y:i}=Qi({sceneX:t.x,sceneY:t.y},this.state),a,o=Hs(t);if(t.id===this.state.editingFrame){let n=o;a=(0,V.jsx)(`input`,{autoFocus:!0,value:n,onChange:e=>{this.scene.mutateElement(t,{name:e.target.value})},onFocus:e=>e.target.select(),onBlur:()=>this.resetEditingFrame(t),onKeyDown:e=>{(e.key===M.ESCAPE||e.key===M.ENTER)&&this.resetEditingFrame(t)},style:{background:$t(this.state.viewBackgroundColor,e),zIndex:2,border:`none`,display:`block`,padding:`6px`,borderRadius:4,boxShadow:`inset 0 0 0 1px var(--color-primary)`,fontFamily:`Assistant`,fontSize:`${fi.nameFontSize}px`,transform:`translate(-6px, 6px)`,color:e?fi.nameColorDarkTheme:fi.nameColorLightTheme,overflow:`hidden`,maxWidth:`${document.body.clientWidth-r-6}px`},size:n.length+1||1,dir:`auto`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`})}else a=o;return(0,V.jsx)(`div`,{id:this.getFrameNameDOMId(t),className:sa.FRAME_NAME,style:{position:`absolute`,bottom:`${this.state.height+fi.nameOffsetY-i+this.state.offsetTop}px`,left:`${r-this.state.offsetLeft}px`,zIndex:2,fontSize:fi.nameFontSize,color:e?fi.nameColorDarkTheme:fi.nameColorLightTheme,lineHeight:fi.nameLineHeight,width:`max-content`,maxWidth:n?.id===t.id&&n?.focus?`none`:`${t.width*this.state.zoom.value}px`,overflow:t.id===this.state.editingFrame?`visible`:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,cursor:Ri.MOVE,pointerEvents:this.state.viewModeEnabled?ba.disabled:ba.enabled},onPointerDown:e=>this.handleCanvasPointerDown(e),onWheel:e=>this.handleWheel(e),onContextMenu:this.handleCanvasContextMenu,onDoubleClick:()=>{this.setState({editingFrame:t.id})},children:a},t.id)})}),z(this,`focusContainer`,()=>{this.excalidrawContainerRef.current?.focus()}),z(this,`getSceneElementsIncludingDeleted`,()=>this.scene.getElementsIncludingDeleted()),z(this,`getSceneElementsMapIncludingDeleted`,()=>this.scene.getElementsMapIncludingDeleted()),z(this,`getSceneElements`,()=>this.scene.getNonDeletedElements()),z(this,`onInsertElements`,e=>{this.addElementsFromPasteOrLibrary({elements:e,position:`center`,files:null})}),z(this,`onExportImage`,async(e,t,n)=>{rC(`export`,e,`ui`);let r=await ZT(e,t,this.state,this.files,{exportBackground:this.state.exportBackground,name:this.getName(),viewBackgroundColor:this.state.viewBackgroundColor,exportingFrame:n.exportingFrame}).catch(na).catch(e=>{console.error(e),this.setState({errorMessage:e.message})});this.state.exportEmbedScene&&r&&Kr(r)&&this.setState({fileHandle:r})}),z(this,`magicGenerations`,new Map),z(this,`updateMagicGeneration`,({frameElement:e,data:t})=>{t.status===`pending`?this.scene.mutateElement(e,{customData:{generationData:void 0}},{informMutation:!1,isDragging:!1}):this.scene.mutateElement(e,{customData:{generationData:t}},{informMutation:!1,isDragging:!1}),this.magicGenerations.set(e.id,t),this.triggerRender()}),z(this,`plugins`,{}),z(this,`onMagicframeToolSelect`,()=>{let e=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});if(e.length===0)this.setActiveTool({type:es.magicframe}),rC(`ai`,`tool-select (empty-selection)`,`d2c`);else{let t=e.length===1&&Ns(e[0])&&e[0];if(!t&&e.some(e=>N(e)||e.frameId)){this.setActiveTool({type:es.magicframe});return}rC(`ai`,`tool-select (existing selection)`,`d2c`);let n;if(t)n=t;else{let[t,r,i,a]=He(e);n=p({...fi,x:t-50,y:r-50,width:i-t+100,height:a-r+100,opacity:100,locked:!1}),this.insertNewElement(n);for(let t of e)this.scene.mutateElement(t,{frameId:n.id});this.setState({selectedElementIds:{[n.id]:!0}})}this.onMagicFrameGenerate(n,`upstream`)}}),z(this,`openEyeDropper`,({type:e})=>{this.updateEditorAtom(fC,{swapPreviewOnAlt:!0,colorPickerType:e===`stroke`?`elementStroke`:`elementBackground`,onSelect:(t,n)=>{let r=e===`background`&&n.altKey||e===`stroke`&&!n.altKey;!this.scene.getSelectedElements(this.state).length||this.state.activeTool.type!==`selection`?r?this.syncActionResult({appState:{...this.state,currentItemStrokeColor:t},captureUpdate:P.IMMEDIATELY}):this.syncActionResult({appState:{...this.state,currentItemBackgroundColor:t},captureUpdate:P.IMMEDIATELY}):this.updateScene({elements:this.scene.getElementsIncludingDeleted().map(e=>this.state.selectedElementIds[e.id]?j(e,{[r?`strokeColor`:`backgroundColor`]:t}):e),captureUpdate:P.IMMEDIATELY})},keepOpenOnAlt:!1})}),z(this,`dismissLinearEditor`,()=>{setTimeout(()=>{this.state.selectedLinearElement?.isEditing&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isEditing:!1}})})}),z(this,`syncActionResult`,oc(e=>{if(this.unmounted||e===!1)return;this.store.scheduleAction(e.captureUpdate);let t=!1,n=null;if(e.elements&&(this.scene.replaceAllElements(e.elements),t=!0),e.files&&(this.addMissingFiles(e.files,e.replaceFiles),this.addNewImagesToImageCache()),e.appState||n||this.state.contextMenu){let r=e?.appState?.viewModeEnabled||!1,i=e?.appState?.zenModeEnabled||!1,a=e?.appState?.theme||this.props.theme||F.LIGHT,o=e?.appState?.name??this.state.name,s=e?.appState?.errorMessage??this.state.errorMessage;typeof this.props.viewModeEnabled<`u`&&(r=this.props.viewModeEnabled),typeof this.props.zenModeEnabled<`u`&&(i=this.props.zenModeEnabled),n=e.appState?.editingTextElement||null,e.elements&&n&&e.elements.forEach(e=>{n?.id===e.id&&n!==e&&ko(e)&&R(e)&&(n=e)}),n?.isDeleted&&(n=null),this.setState(t=>{let c=e.appState||{};return{...t,...c,contextMenu:null,editingTextElement:n,viewModeEnabled:r,zenModeEnabled:i,theme:a,name:o,errorMessage:s}}),t=!0}t||this.scene.triggerUpdate()})),z(this,`onBlur`,oc(()=>{lB=!1,this.setState({isBindingEnabled:this.state.bindingPreference===`enabled`})})),z(this,`onUnload`,()=>{this.onBlur()}),z(this,`disableEvent`,e=>{e.preventDefault()}),z(this,`resetHistory`,()=>{this.history.clear()}),z(this,`resetStore`,()=>{this.store.clear()}),z(this,`resetScene`,oc(e=>{this.scene.replaceAllElements([]),this.setState(t=>({...zt(),isLoading:!e?.resetLoadingState&&t.isLoading,theme:this.state.theme})),this.resetStore(),this.resetHistory()})),z(this,`initializeScene`,async()=>{`launchQueue`in window&&`LaunchParams`in window&&window.launchQueue.setConsumer(async e=>{if(!e.files.length)return;let t=e.files[0],n=await t.getFile();this.loadFileToCanvas(new File([n],n.name||``,{type:n.type}),t)}),this.props.theme&&this.setState({theme:this.props.theme}),this.state.isLoading||this.setState({isLoading:!0});let e=null;try{e=typeof this.props.initialData==`function`?await this.props.initialData()||null:await this.props.initialData||null,e?.libraryItems&&this.library.updateLibrary({libraryItems:e.libraryItems,merge:!0}).catch(e=>{console.error(e)})}catch(t){console.error(t),e={appState:{errorMessage:t.message||`Encountered an error during importing or restoring scene data`}}}let t=Fo(e?.elements,null,{repairBindings:!0,deleteInvisibleElements:!0}),n=Wi(e?.appState,null),r=n.activeTool;n.preferredSelectionTool.initialized||(n.preferredSelectionTool={type:this.editorInterface.formFactor===`phone`?`lasso`:`selection`,initialized:!0}),n={...n,theme:this.props.theme||n.theme,openSidebar:n?.openSidebar||this.state.openSidebar,activeTool:r.type===`image`||r.type===`lasso`||r.type===`selection`?{...r,type:n.preferredSelectionTool.type}:n.activeTool,isLoading:!1,toast:this.state.toast};let i={...n,width:this.state.width,height:this.state.height,offsetTop:this.state.offsetTop,offsetLeft:this.state.offsetLeft},a=this.props.initialState?.viewport;if(a){let e=Pa(t.filter(e=>!e.isDeleted)),{bounds:r}=ws(a.target,e,i);r&&(n={...n,...Eo(i,r,{...a,offsets:this.resolveViewportOffsets(a.offsets)})})}else e?.scrollToContent&&(n={...n,...Jt(t,i)});this.resetStore(),this.resetHistory(),this.syncActionResult({elements:t,appState:n,files:e?.files,captureUpdate:P.NEVER}),this.clearImageShapeCache(),this.fonts.loadSceneFonts().then(e=>{this.fonts.onLoaded(e)}),Gt(window.location.href)&&this.setViewport({target:window.location.href,fit:`scale-down`,animation:!1})}),z(this,`getFormFactor`,(e,t)=>this.props.UIOptions.getFormFactor?.(e,t)??xi(e,t)),z(this,`refreshEditorInterface`,()=>{let e=this.excalidrawContainerRef.current;if(!e)return;let{width:t,height:n}=e.getBoundingClientRect(),r=ie(),i=lr(typeof navigator<`u`?navigator.userAgent:``),a=this.props.UIOptions.dockedSidebarBreakpoint==null?as:this.props.UIOptions.dockedSidebarBreakpoint,o=ve(this.editorInterface,{desktopUIMode:r??this.editorInterface.desktopUIMode,formFactor:this.getFormFactor(t,n),userAgent:i,canFitSidebar:t>a,isLandscape:t>n});this.editorInterface=o,this.reconcileStylesPanelMode(o)}),z(this,`reconcileStylesPanelMode`,e=>{let t=Fi(e);if(t===this.stylesPanelMode)return;let n=this.stylesPanelMode;this.stylesPanelMode=t,this.viewportUILastMeasured.delete(`stylesPanel`),n!==`full`&&t===`full`&&this.setState(e=>({preferredSelectionTool:{type:`selection`,initialized:!0}}))}),z(this,`setDesktopUIMode`,e=>{let t=y(e);this.editorInterface=ve(this.editorInterface,{desktopUIMode:t}),this.reconcileStylesPanelMode(this.editorInterface)}),z(this,`onResize`,oc(()=>{this.scene.getElementsIncludingDeleted().forEach(e=>wt.delete(e)),this.refreshEditorInterface(),this.updateDOMRect(),this.setState({})})),z(this,`onFullscreenChange`,()=>{!document.fullscreenElement&&this.state.activeEmbeddable?.state===`active`&&this.setState({activeEmbeddable:null})}),z(this,`renderInteractiveSceneCallback`,({scrollBars:e})=>{e&&(fB=e),this.scheduleImageRefresh()}),z(this,`onScroll`,ln(()=>{let{offsetTop:e,offsetLeft:t}=this.getCanvasOffsets();this.setState(n=>n.offsetLeft===t&&n.offsetTop===e?null:{offsetTop:e,offsetLeft:t})},100)),z(this,`onCut`,oc(e=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||wi(e.target)||(this.actionManager.executeAction(IE,`keyboard`,e),e.preventDefault(),e.stopPropagation())})),z(this,`onCopy`,oc(e=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||wi(e.target)||(this.actionManager.executeAction(PE,`keyboard`,e),e.preventDefault(),e.stopPropagation())})),z(this,`onTouchStart`,t=>{if(Ma&&t.preventDefault(),!oB){oB=!0,t.touches.length===1&&(cB={x:t.touches[0].clientX,y:t.touches[0].clientY}),clearTimeout(sB),sB=window.setTimeout(e.resetTapTwice,300);return}if(oB&&t.touches.length===1&&cB){let e=t.touches[0];hn(a(e.clientX,e.clientY),a(cB.x,cB.y))<=35&&(this.lassoTrail.endPath(),this.deselectElements(),this.handleCanvasDoubleClick({clientX:e.clientX,clientY:e.clientY,type:`touch`,altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1})),oB=!1,clearTimeout(sB)}t.touches.length===2&&this.setState({selectedElementIds:Ji({},this.state),activeEmbeddable:null})}),z(this,`onTouchEnd`,e=>{this.resetContextMenuTimer(),e.touches.length>0?this.setState({previousSelectedElementIds:{},selectedElementIds:Ji(this.state.previousSelectedElementIds,this.state)}):SB.pointers.clear()}),z(this,`pasteFromClipboard`,oc(async e=>{let t=!!vB,n=document.activeElement,r=this.excalidrawContainerRef.current?.contains(n);if(e&&!r)return;let i=document.elementFromPoint(this.lastViewportPosition.x,this.lastViewportPosition.y);if(e&&(!(i instanceof HTMLCanvasElement)||wi(n)))return;let a=await WT(e),o=a.getFiles(),s=await GT(a,t);if(this.props.onPaste)try{if(await this.props.onPaste(s,e)===!1)return}catch(e){console.error(e)}await this.insertClipboardContent(s,o,t),this.setActiveTool({type:this.state.preferredSelectionTool.type},{keepSelection:!0}),e?.preventDefault()})),z(this,`addElementsFromPasteOrLibrary`,e=>{let t=Fo(e.elements,null,{deleteInvisibleElements:!0}),[n,r,i,a]=He(t),o=hs(n,i)/2,s=hs(r,a)/2,{x:c,y:l}=Ka({clientX:typeof e.position==`object`?e.position.clientX:e.position===`cursor`?this.lastViewportPosition.x:this.state.width/2+this.state.offsetLeft,clientY:typeof e.position==`object`?e.position.clientY:e.position===`cursor`?this.lastViewportPosition.y:this.state.height/2+this.state.offsetTop},this.state),[u,d]=kn(c-o,l-s,this.getEffectiveGridSize()),{duplicatedElements:f}=w({type:`everything`,elements:t.map(e=>j(e,{x:e.x+u-n,y:e.y+d-r})),randomizeSeed:!e.retainSeed,preserveFrameChildrenOrder:e.preserveFrameChildrenOrder}),p=this.scene.getElementsIncludingDeleted(),m=[...p,...f];m=this.props.onDuplicate?.(m,p)||m,wo(m,Pa(f));let h=this.getTopLayerFrameAtSceneCoords({x:c,y:l});if(h){let e=Qt(f,h);m=di(m,e,h)}this.scene.replaceAllElements(m),f.forEach(e=>{R(e)&&xo(e)&&Fn(e,rt(e,this.scene.getElementsMapIncludingDeleted()),this.scene)}),Ta&&Ve.loadElementsFonts(f).then(e=>{this.fonts.onLoaded(e)}),e.files&&this.addMissingFiles(e.files);let g=bt(f);this.store.scheduleCapture(),this.setState({...this.state,openSidebar:this.state.openSidebar&&this.editorInterface.canFitSidebar&&py.get(BP)?this.state.openSidebar:null,...tr({editingGroupId:null,selectedElementIds:g.reduce((e,t)=>(xo(t)||(e[t.id]=!0),e),{})},this.scene.getNonDeletedElements(),this.state,this)},()=>{e.files&&this.addNewImagesToImageCache()}),this.setActiveTool({type:this.state.preferredSelectionTool.type},{keepSelection:!0}),e.fit&&this.setViewport({target:f,fit:e.fit,animation:!1,offsets:{ui:!0}})}),z(this,`setAppState`,(e,t)=>{this.setState(e,t)}),z(this,`removePointer`,e=>{pB&&this.resetContextMenuTimer();let t=SB.pointers.size>=2;SB.pointers.delete(e.pointerId),t&&SB.pointers.size<2&&this.state.scrollConstraints&&(this.snapBackToScrollConstraintsDebounced.cancel(),this.snapBackToScrollConstraints())}),z(this,`toggleLock`,(e=`ui`)=>{this.state.activeTool.locked||rC(`toolbar`,`toggleLock`,`${e} (${this.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),this.setState(e=>({activeTool:{...e.activeTool,...kr(this.state,e.activeTool.locked?{type:this.state.preferredSelectionTool.type}:e.activeTool),locked:!e.activeTool.locked}}))}),z(this,`updateFrameRendering`,e=>{this.setState(t=>{let n=typeof e==`function`?e(t.frameRendering):e;return{frameRendering:{enabled:n?.enabled??t.frameRendering.enabled,clip:n?.clip??t.frameRendering.clip,name:n?.name??t.frameRendering.name,outline:n?.outline??t.frameRendering.outline}}})}),z(this,`togglePenMode`,e=>{this.setState(t=>({penMode:e??!t.penMode,penDetected:!0,currentItemStrokeVariability:t.penDetected?t.currentItemStrokeVariability:`variable`}))}),z(this,`zoomCanvas`,e=>{this.setState(t=>{let n={...t,...Lw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:it(e)},t)};return{...n,...Ts(n)}})}),z(this,`resolveViewportOffsets`,e=>{if(!e)return e;let{ui:t,...n}=e;if(!t)return n;let r=this.getViewportOffsets(t===!0?void 0:t);return{top:n.top??r.top,right:n.right??r.right,bottom:n.bottom??r.bottom,left:n.left??r.left}}),z(this,`setViewport`,e=>{if(e===null){this.state.scrollConstraints&&this.setState({scrollConstraints:null});return}let{target:t,fit:n,lock:r,animation:i}=e,a=this.resolveViewportOffsets(e.offsets),{bounds:o,type:s}=ws(t,this.scene.getNonDeletedElementsMap(),this.state);if(!o){s===`link`&&this.setState({toast:{message:G(`elementLink.notFound`),duration:3e3,closable:!0}});return}let c=Eo(this.state,o,{fit:n,offsets:a,lock:r});yi(this.state,o,{fit:n,animation:i,offsets:a},this.setState.bind(this),()=>{!c.scrollConstraints&&!this.state.scrollConstraints||(0,Sc.flushSync)(()=>{this.setState(c)})})}),z(this,`revealIfHidden`,e=>{!e.length||re(e,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(),this.getViewportOffsets())||this.setViewport({target:He(e),fit:`scale-down`,animation:{duration:300},offsets:{ui:!0}})}),z(this,`maybeUnfollowRemoteUser`,()=>{this.state.userToFollow&&this.setState({userToFollow:null})}),z(this,`translateCanvas`,(e,t)=>{Xe.cancel(_s),this.setState({shouldCacheIgnoreZoom:!1}),this.maybeUnfollowRemoteUser();let n=this.state.zoom.value;this.setState(e),this.setState(e=>{if(!e.scrollConstraints)return null;let r=!t?.zoomPreConstrained&&e.zoom.value!==n?0:e.scrollConstraints.overscroll;return r>0&&this.snapBackToScrollConstraintsDebounced(),Ts(e,r)})}),z(this,`constrainViewportToScrollConstraints`,(e=0)=>{this.setState(t=>t.scrollConstraints?Ts(t,e):null)}),z(this,`snapBackToScrollConstraints`,()=>{this.unmounted||SB.pointers.size>=2||gs(this.state,e=>this.setState(e))}),z(this,`snapBackToScrollConstraintsDebounced`,ln(this.snapBackToScrollConstraints,_B)),z(this,`setToast`,e=>{this.setState({toast:e})}),z(this,`restoreFileFromShare`,async()=>{try{let e=await caches.open(`web-share-target`),t=await e.match(`shared-file`);if(t){let n=await t.blob(),r=new File([n],n.name||``,{type:n.type});this.loadFileToCanvas(r,null),await e.delete(`shared-file`),window.history.replaceState(null,pt,window.location.pathname)}}catch(e){this.setState({errorMessage:e.message})}}),z(this,`addFiles`,oc(e=>{let{addedFiles:t}=this.addMissingFiles(e);this.clearImageShapeCache(t),this.scene.triggerUpdate(),this.addNewImagesToImageCache()})),z(this,`addMissingFiles`,(e,t=!1)=>{let n=t?{}:{...this.files},r={},i=Array.isArray(e)?e:Object.values(e);for(let e of i)if(!n[e.id]&&(r[e.id]=e,n[e.id]=e,e.mimeType===Se.svg))try{let t=Ia(ks(Gi(e.dataURL)),Se.svg);e.dataURL!==t&&(e.version=(e.version??1)+1,e.dataURL=t)}catch(e){console.error(e)}return this.files=n,{addedFiles:r}}),z(this,`updateScene`,oc(e=>{let{elements:t,appState:n,collaborators:r,captureUpdate:i}=e;if(i){let e=t||void 0,r=n?Uo({...this.store.snapshot.appState,...n}):void 0;this.store.scheduleMicroAction({action:i,elements:e,appState:r})}n&&this.setState(n),t&&this.scene.replaceAllElements(t),r&&(this.laserTrails.updateCollabTrails(r),this.setState({collaborators:r}))})),z(this,`applyDeltas`,(e,t)=>{let n=Va.squash(...e),r={...this.state},i=new Map(this.scene.getElementsMapIncludingDeleted());return Va.applyTo(n,i,r,t)}),z(this,`mutateElement`,(e,t,n=!0)=>this.scene.mutateElement(e,t,{informMutation:n,isDragging:!1})),z(this,`triggerRender`,e=>{e===!0?this.scene.triggerUpdate():this.setState({})}),z(this,`toggleSidebar`,({name:e,tab:t,force:n})=>{let r;r=n===void 0?this.state.openSidebar?.name===e&&this.state.openSidebar?.tab===t?null:e:n?e:null;let i=r?{name:r}:null;return i&&t&&(i.tab=t),this.setState({openSidebar:i}),!!r}),z(this,`updateCurrentCursorPosition`,oc(e=>{this.lastViewportPosition.x=e.clientX,this.lastViewportPosition.y=e.clientY})),z(this,`getViewportOffsets`,e=>{let t=this.excalidrawContainerRef?.current,n=t?.getBoundingClientRect(),r=Sy().rtl,i={top:0,right:0,bottom:0,left:0},a=new Set;if(t&&n)for(let e of t.querySelectorAll(`[data-viewport-ui]`)){let t=e.getBoundingClientRect(),r={top:t.top-n.top,right:t.right-n.left,bottom:t.bottom-n.top,left:t.left-n.left,width:t.width};switch(e.dataset.viewportUi){case`top`:i.top=Math.max(i.top,r.bottom);break;case`bottom`:i.bottom=Math.max(i.bottom,this.state.height-r.top);break;case`side`:{let[t,n]=r.left+r.width/2<this.state.width/2?[`left`,r.right]:[`right`,this.state.width-r.left];i[t]=Math.max(i[t],n);let o=e.dataset.viewportUiName;o&&(a.add(o),n>0&&this.viewportUILastMeasured.set(o,{side:t,offset:n}));break}}}if(e?.reserve&&this.editorInterface.formFactor!==`phone`){let t=(e,t)=>{if(a.has(e))return;let{side:n,offset:r}=this.viewportUILastMeasured.get(e)??t;i[n]=Math.max(i[n],r)};e.reserve.stylesPanel&&t(`stylesPanel`,{side:r?`right`:`left`,offset:this.stylesPanelMode===`compact`?zz.compact:zz.full}),e.reserve.sidebar&&t(`sidebar`,{side:r?`left`:`right`,offset:Rz})}let o=e?.padding??24,s=e?.paddingTop??o,c=(r?e?.paddingLeft:e?.paddingRight)??o,l=e?.paddingBottom??o,u=(r?e?.paddingRight:e?.paddingLeft)??o,d={top:i.top+s,right:i.right+c,bottom:i.bottom+l,left:i.left+u};return{top:e?.top??d.top,right:(r?e?.left:e?.right)??d.right,bottom:e?.bottom??d.bottom,left:(r?e?.right:e?.left)??d.left}}),z(this,`onKeyDown`,oc(e=>{if(`Proxy`in window&&(!e.shiftKey&&/^[A-Z]$/.test(e.key)||e.shiftKey&&/^[a-z]$/.test(e.key))&&(e=new Proxy(e,{get(t,n){let r=t[n];return typeof r==`function`?r.bind(t):n===`key`?e.shiftKey?t.key.toUpperCase():t.key.toLowerCase():r}})),!ci(e.target)){if((e.key===M.ESCAPE||e.key===M.ENTER)&&this.state.croppingElementId){this.finishImageCropping();return}let t=An(this.scene.getNonDeletedElementsMap(),this.state);if(t.length===1&&Ce(t[0])&&e.key===M.ENTER){this.startImageCropping(t[0]);return}if(e.key===M.ESCAPE)this.updateEditorAtom(wD,null);else if(e.key===M.TAB&&(document.activeElement===this.excalidrawContainerRef?.current||document.activeElement?.classList.contains(sa.CONVERT_ELEMENT_TYPE_POPUP))){e.preventDefault();let n=jD(t);py.get(wD)?.type===`panel`&&AD(this,{conversionType:n,direction:e.shiftKey?`left`:`right`})&&this.store.scheduleCapture(),n&&this.updateEditorAtom(wD,{type:`panel`})}if(this.flowchart.handleKeyEvent(e))return}if(e[M.CTRL_OR_CMD]&&e.key===M.P&&!e.shiftKey&&!e.altKey){this.setToast({message:G(`commandPalette.shortcutHint`,{shortcut:XD(`commandPalette`)})}),e.preventDefault();return}if(e[M.CTRL_OR_CMD]&&e.key.toLowerCase()===M.V&&(vB=e.shiftKey,clearTimeout(yB),yB=window.setTimeout(()=>{vB=!1},100)),e[M.CTRL_OR_CMD]&&wi(e.target)&&(e.code===vr.MINUS||e.code===vr.EQUAL)){e.preventDefault();return}if(wi(e.target)&&e.key!==M.ESCAPE||da(e.key)&&ci(e.target))return;if(e.key===M.QUESTION_MARK){this.setState({openDialog:{name:`help`}});return}else if(e.key.toLowerCase()===M.E&&e.shiftKey&&e[M.CTRL_OR_CMD]){e.preventDefault(),this.setState({openDialog:{name:`imageExport`}});return}if(e.key===M.PAGE_UP||e.key===M.PAGE_DOWN){let t=(e.shiftKey?this.state.width:this.state.height)/this.state.zoom.value;e.key===M.PAGE_DOWN&&(t=-t),e.shiftKey?this.translateCanvas(e=>({scrollX:e.scrollX+t})):this.translateCanvas(e=>({scrollY:e.scrollY+t}))}if(this.state.openDialog?.name===`elementLinkSelector`||(e.key===M.ALT&&(Cr(`COMPLEX_BINDINGS`)?this.handleSkipBindMode():xn({app:this,event:e})),this.actionManager.handleKeyDown(e)))return;let t=this.props.viewModeEnabled===!0;if(!t&&this.state.viewModeEnabled&&e.key===M.ESCAPE){this.setActiveTool({type:`selection`});return}if(!t&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&!e.shiftKey&&!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged){let t=aT(e.key,this);if(this.state.viewModeEnabled&&!go(t,[`laser`,`hand`]))return;if(t){if(this.state.activeTool.type!==t&&rC(`toolbar`,t,`keyboard (${this.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),t===`arrow`&&this.state.activeTool.type===`arrow`){let e=this.state.currentItemArrowType===Er.sharp?Er.round:this.state.currentItemArrowType===Er.round?Er.elbow:Er.sharp;this.setState({currentItemArrowType:e}),this.cursorHints.onArrowTypeCycled(e)}else(t===`arrow`||t===`line`)&&this.cursorHints.onToolShortcut(t,/^\d$/.test(e.key)?`digit`:`letter`);t===`lasso`&&this.state.activeTool.type===`laser`?this.setActiveTool({type:this.state.preferredSelectionTool.type}):this.setActiveTool({type:t},{toggle:!0}),e.stopPropagation();return}else if(e.key===M.Q){this.toggleLock(`keyboard`),e.stopPropagation();return}}if(this.state.viewModeEnabled)return;if(e[M.CTRL_OR_CMD]&&!e.repeat&&(Cr(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),(0,Sc.flushSync)(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!==`enabled`})}),xn({app:this,event:e})),da(e.key)){let t=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),n=new Set;t.filter(e=>pa(e)).filter(e=>{let n=e.startBinding&&!t.some(t=>t.id===e.startBinding?.elementId),r=e.endBinding&&!t.some(t=>t.id===e.endBinding?.elementId);return n||r}).forEach(e=>n.add(e.id)),t=t.filter(e=>!n.has(e.id));let r=this.getEffectiveGridSize()&&(e.shiftKey?1:this.getEffectiveGridSize())||(e.shiftKey?5:1),i=0,a=0;e.key===M.ARROW_LEFT?i=-r:e.key===M.ARROW_RIGHT?i=r:e.key===M.ARROW_UP?a=-r:e.key===M.ARROW_DOWN&&(a=r),t.forEach(e=>{this.scene.mutateElement(e,{x:e.x+i,y:e.y+a},{informMutation:!1,isDragging:!1}),Rs(e,this.scene,{simultaneouslyUpdated:t})}),this.scene.triggerUpdate(),e.preventDefault()}else if(e.key===M.ENTER){let t=this.scene.getSelectedElements(this.state);if(t.length===1){let n=t[0];if(e[M.CTRL_OR_CMD]||mr(n))ja(n)&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==n.id)&&(this.store.scheduleCapture(),Ti(n)||this.actionManager.executeAction(Oj));else if(R(n)||Bs(n)){let t;R(n)||(t=n);let r=Vi(n,this.state,this.scene.getNonDeletedElementsMap()),i=r.x,a=r.y;this.startTextEditing({sceneX:i,sceneY:a,container:t}),e.preventDefault();return}else N(n)&&this.setState({editingFrame:n.id})}}if(e.key===M.SPACE&&SB.pointers.size===0&&(lB=!0,Yw(this.interactiveCanvas,Ri.GRAB),e.preventDefault()),(e.key===M.G||e.key===M.S)&&!e.altKey&&!e[M.CTRL_OR_CMD]){let t=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type===`selection`&&!t.length)return;e.key===M.G&&(ms(this.state.activeTool.type)||t.some(e=>ms(e.type)))&&(this.setState({openPopup:`elementBackground`}),e.stopPropagation()),e.key===M.S&&(this.setState({openPopup:`elementStroke`}),e.stopPropagation())}if(!e[M.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===M.F){let t=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type===`selection`&&!t.length)return;(this.state.activeTool.type===`text`||t.find(e=>R(e)||So(e,this.scene.getNonDeletedElementsMap())))&&(e.preventDefault(),this.setState({openPopup:`fontFamily`}))}e[M.CTRL_OR_CMD]&&(e.key===M.BACKSPACE||e.key===M.DELETE)&&this.updateEditorAtom(Jk,`clearCanvas`);let n=e.key.toLocaleLowerCase(),r=n===M.S&&e.shiftKey&&!e[M.CTRL_OR_CMD],i=e.key===M.I||n===M.G&&e.shiftKey;(r||i)&&this.openEyeDropper({type:r?`stroke`:`background`})})),z(this,`onKeyUp`,oc(e=>{if(e.key===M.SPACE&&(this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`||this.state.openDialog?.name===`elementLinkSelector`?Yw(this.interactiveCanvas,Ri.GRAB):Za(this.state.activeTool.type)?Jw(this.interactiveCanvas):($w(this.interactiveCanvas,this.state),this.setState({selectedElementIds:Ji({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})),lB=!1),e.key===M.ALT&&xn({app:this,event:e}),(e.key===M.ALT&&this.state.bindMode===`skip`||!e[M.CTRL_OR_CMD]&&!qt(this.state))&&(this.setState({bindMode:`orbit`}),this.lastPointerMoveEvent&&Cr(`COMPLEX_BINDINGS`))){let e=Ka({clientX:this.lastPointerMoveEvent.clientX,clientY:this.lastPointerMoveEvent.clientY},this.state),t=Xs(a(e.x,e.y),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(this.state.selectedLinearElement){let e=I.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());pa(e)&&this.handleDelayedBindModeChange(e,t)}}if(!e[M.CTRL_OR_CMD]){let t=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==t&&(0,Sc.flushSync)(()=>{this.setState({isBindingEnabled:t})}),xn({app:this,event:e})}if(da(e.key)){ya(this.scene.getSelectedElements(this.state).filter(Mr),this.scene,this.state);let e=this.scene.getNonDeletedElementsMap();this.scene.getSelectedElements(this.state).filter(Mi).forEach(t=>{t.startBinding&&this.scene.mutateElement(t,{startBinding:{...t.startBinding,...ta(t,e.get(t.startBinding.elementId),`start`,e)}}),t.endBinding&&this.scene.mutateElement(t,{endBinding:{...t.endBinding,...ta(t,e.get(t.endBinding.elementId),`end`,e)}})}),this.setState({suggestedBinding:null})}this.flowchart.handleKeyEvent(e)})),z(this,`isToolSupported`,e=>this.props.UIOptions.tools?.[e]!==!1),z(this,`setActiveTool`,(e,t={})=>{let{keepSelection:n=!1}=t;if(!this.isToolSupported(e.type)){console.warn(`"${e.type}" tool is disabled via "UIOptions.canvasActions.tools.${e.type}"`);return}let r=nT.includes(e.type),i=t.toggle===!0&&r&&this.state.activeTool.type===e.type?kr(this.state,{...this.state.activeTool.lastActiveTool||{type:this.state.preferredSelectionTool.type},lastActiveTool:null}):r&&this.state.activeTool.type!==e.type?kr(this.state,{...e,lastActiveTool:this.state.activeTool}):kr(this.state,e);i.type===`hand`?Yw(this.interactiveCanvas,Ri.GRAB):lB||$w(this.interactiveCanvas,{...this.state,activeTool:i}),Ca(document.activeElement)&&this.focusContainer(),Qn(i.type)||this.setState({suggestedBinding:null}),i.type===`image`&&this.onImageToolbarButtonClick(),this.setState(e=>{let t={snapLines:e.snapLines.length?[]:e.snapLines,originSnapOffset:null,activeEmbeddable:null,selectedLinearElement:Za(i.type)?e.selectedLinearElement:null,frameToHighlight:null};return i.type===`freedraw`&&this.store.scheduleCapture(),i.type===`lasso`?{...e,...t,activeTool:i,...n?{}:{selectedElementIds:Ji({},e),selectedGroupIds:Ji({},e),editingGroupId:null,multiElement:null}}:i.type===`selection`?{...e,...t,activeTool:i}:{...e,...t,activeTool:i,selectedElementIds:Ji({},e),selectedGroupIds:Ji({},e),editingGroupId:null,multiElement:null}})}),z(this,`setOpenDialog`,e=>{this.setState({openDialog:e})}),z(this,`setCursor`,e=>{Yw(this.interactiveCanvas,e)}),z(this,`resetCursor`,()=>{Jw(this.interactiveCanvas)}),z(this,`isTouchScreenMultiTouchGesture`,()=>SB.pointers.size>=2),z(this,`getName`,()=>this.state.name||this.props.name||`${G(`labels.untitled`)}-${jo()}`),z(this,`onGestureStart`,oc(e=>{e.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({selectedElementIds:Ji({},this.state),activeEmbeddable:null}),SB.initialScale=this.state.zoom.value})),z(this,`onGestureChange`,oc(e=>{if(e.preventDefault(),this.isTouchScreenMultiTouchGesture()||Lr(this.state))return;let t=SB.initialScale;t&&this.translateCanvas(n=>({...Lw({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:it(t*e.scale)},n)}))})),z(this,`onGestureEnd`,oc(e=>{e.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({previousSelectedElementIds:{},selectedElementIds:Ji(this.state.previousSelectedElementIds,this.state)}),SB.initialScale=null})),z(this,`isHittingTextAutoResizeHandle`,(e,t)=>{let n=Yo(e,this.state);return!!(n&&!n.isDeleted&&!n.autoResize&&MM(t,n,this.state.zoom.value,this.editorInterface.formFactor))}),z(this,`handleTextAutoResizeHandlePointerDown`,(e,t)=>{let n=Yo(e,this.state);return!n||!this.isHittingTextAutoResizeHandle(e,t)?!1:(this.actionManager.executeAction(Hj,`ui`,n),this.resetCursor(),!0)}),z(this,`startTextEditing`,({sceneX:e,sceneY:t,insertAtParentCenter:n=!0,container:r,autoEdit:i=!0,initialCaretSceneCoords:a})=>{let o=!1,s=n&&this.getTextWysiwygSnappedToCenterPosition(e,t,this.state,r);r&&s&&(So(r,this.scene.getNonDeletedElementsMap())||(o=!0));let c=this.getSelectedTextElement(r)||this.getTextElementAtPosition(e,t),l=c?.fontFamily||this.state.currentItemFontFamily,u=c?.lineHeight||mo(l),d=this.state.currentItemFontSize;if(!c&&o&&r&&!Mr(r)){let n=Pr(Ho({fontSize:d,fontFamily:l}),u),i=Re(d,u),a=Math.max(r.height,i),o=Math.max(r.width,n);this.scene.mutateElement(r,{height:a,width:o}),e=r.x+o/2,t=r.y+a/2,s&&=this.getTextWysiwygSnappedToCenterPosition(e,t,this.state,r)}let f=this.getTextCreationGridPoint(e,t),p=s?{x:s.elementCenterX,y:s.elementCenterY}:c?{x:e,y:t}:{x:f?.x??e,y:f===null?t-Ba(d,u)/2:f.y},m=this.getTopLayerFrameAtSceneCoords({x:p.x,y:p.y}),h=m&&(!o||!r||r.frameId===m.id)?m.id:null,g=c||Br({x:p.x,y:p.y,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.getCurrentItemStrokeWidth(`text`),strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:``,fontSize:d,fontFamily:l,textAlign:s?`center`:this.state.currentItemTextAlign,verticalAlign:s?zs.MIDDLE:`top`,containerId:o?r?.id:void 0,groupIds:r?.groupIds??[],lineHeight:u,angle:r?Mr(r)?0:r.angle:0,frameId:h});if(!c&&o&&r&&this.scene.mutateElement(r,{boundElements:(r.boundElements||[]).concat({type:`text`,id:g.id})}),this.setState({editingTextElement:g}),!c)if(r&&o){let e=this.scene.getElementIndex(r.id);this.scene.insertElementsAtIndex([g],e+1)}else this.insertNewElement(g);i||c||r?this.handleTextWysiwyg(g,{isExistingElement:!!c,initialCaretSceneCoords:c?a:null}):this.setState({newElement:g,multiElement:null})}),z(this,`startImageCropping`,e=>{this.store.scheduleCapture(),this.setState({croppingElementId:e.id})}),z(this,`finishImageCropping`,()=>{this.state.croppingElementId&&(this.store.scheduleCapture(),this.setState({croppingElementId:null}))}),z(this,`shouldHandleBrowserCanvasDoubleClick`,e=>{if(e===`touch`||this.lastCompletedCanvasClicks.length===0)return!0;if(this.lastCompletedCanvasClicks.length<2)return!1;let[t,n]=this.lastCompletedCanvasClicks;return hn(a(t.x,t.y),a(n.x,n.y))<=35}),z(this,`toggleArrowheadAtEndpoint`,(e,t)=>{let n=t===`start`?e.startArrowhead:e.endArrowhead;this.store.scheduleCapture();let r;if(n)this.removedArrowheads.set(`${e.id}:${t}`,n),r=t===`start`?{startArrowhead:null}:{endArrowhead:null};else{let n=this.removedArrowheads.get(`${e.id}:${t}`)??(t===`start`?this.state.currentItemStartArrowhead:this.state.currentItemEndArrowhead)??`arrow`;r=t===`start`?{startArrowhead:n}:{endArrowhead:n}}this.scene.mapElements(t=>t.id===e.id&&Mr(t)?j(t,r):t)}),z(this,`handleCanvasDoubleClick`,e=>{if(this.state.editingTextElement||!this.shouldHandleBrowserCanvasDoubleClick(e.type)||this.state.multiElement||this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let t=this.scene.getSelectedElements(this.state),{x:n,y:r}=Ka(e,this.state);if(t.length===1&&ja(t[0])){let i=t[0];if(!e[M.CTRL_OR_CMD]&&Mr(i)&&this.state.selectedLinearElement?.elementId===i.id){let e=I.getPointIndexUnderCursor(i,this.scene.getNonDeletedElementsMap(),this.state.zoom,n,r);if(e===0||e===i.points.length-1){this.toggleArrowheadAtEndpoint(i,e===0?`start`:`end`);return}}if((e[M.CTRL_OR_CMD]&&Mi(i)||mr(i))&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==i.id)){this.actionManager.executeAction(Oj);return}else if(this.state.selectedLinearElement&&Ti(t[0])){let e=I.getSegmentMidpointHitCoords(this.state.selectedLinearElement,{x:n,y:r},this.state,this.scene.getNonDeletedElementsMap()),i=e?I.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,e,this.scene.getNonDeletedElementsMap()):-1;if(i&&i>-1){this.store.scheduleCapture(),I.deleteFixedSegment(t[0],this.scene,i);let a=I.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:n,y:r},this.state,this.scene.getNonDeletedElementsMap()),o=a?I.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,a,this.scene.getNonDeletedElementsMap()):null;this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,segmentMidpoint:{index:o,value:e,added:!1}},segmentMidPointHoveredCoords:a}});return}}else if(this.state.selectedLinearElement?.isEditing&&this.state.selectedLinearElement.elementId===i.id&&mr(i))return}if(t.length===1&&Ce(t[0])){this.startImageCropping(t[0]);return}if(Jw(this.interactiveCanvas),yr(this.state).length>0){let e=this.getElementAtPosition(n,r),t=e&&De(e,this.state.selectedGroupIds);if(t){this.store.scheduleCapture(),this.setState(n=>({...n,...tr({editingGroupId:t,selectedElementIds:{[e.id]:!0}},this.scene.getNonDeletedElements(),n,this)}));return}}if(Jw(this.interactiveCanvas),!e[M.CTRL_OR_CMD]&&!this.state.viewModeEnabled){let t=this.getElementAtPosition(n,r);if(Si(t)){this.setState({activeEmbeddable:{element:t,state:`active`}});return}if(!this.state.selectedLinearElement?.isEditing){let t=this.getTextBindableContainerAtPosition(n,r);if(t&&(ai(t)||!bo(t.backgroundColor)||Le({point:a(n,r),element:t,elementsMap:this.scene.getNonDeletedElementsMap(),threshold:this.getElementHitThreshold(t)}))){let e=Vi(t,this.state,this.scene.getNonDeletedElementsMap());n=e.x,r=e.y}this.startTextEditing({sceneX:n,sceneY:r,insertAtParentCenter:!e.altKey,container:t})}}}),z(this,`handleCanvasClick`,e=>{if(e.button!==qi.MAIN){this.lastCompletedCanvasClicks=[];return}this.lastCompletedCanvasClicks=[...this.lastCompletedCanvasClicks.slice(-1),{x:e.clientX,y:e.clientY}]}),z(this,`getElementLinkAtPosition`,(e,t)=>{if(t&&t.locked)return;let n=this.scene.getNonDeletedElements(),r=-1;for(let i=n.length-1;i>=0;i--){let o=n[i];if(t&&o.id===t.id&&(r=i),o.link&&i>=r&&Ii(o,this.scene.getNonDeletedElementsMap(),this.state,a(e.x,e.y),this.editorInterface.formFactor===`phone`))return o}}),z(this,`handleElementLinkClick`,e=>{let t=hn(a(this.lastPointerDownEvent.clientX,this.lastPointerDownEvent.clientY),a(this.lastPointerUpEvent.clientX,this.lastPointerUpEvent.clientY));if(!this.hitLinkElement||t>10)return;let n=Ka(this.lastPointerDownEvent,this.state),r=this.scene.getNonDeletedElementsMap(),i=Ii(this.hitLinkElement,r,this.state,a(n.x,n.y),this.editorInterface.formFactor===`phone`),o=Ka(this.lastPointerUpEvent,this.state),s=Ii(this.hitLinkElement,r,this.state,a(o.x,o.y),this.editorInterface.formFactor===`phone`);if(i&&s){uD();let t=this.hitLinkElement.link;if(t){t=je(t);let n;if(this.props.onLinkOpen&&(n=No(L.EXCALIDRAW_LINK,e.nativeEvent),this.props.onLinkOpen({...this.hitLinkElement,link:t},n)),!n?.defaultPrevented){let e=Ai(t)?`_self`:`_blank`,n=window.open(void 0,e);n&&(n.opener=null,n.location=t)}}}}),z(this,`getTopLayerFrameAtSceneCoords`,(e,t)=>{let n=this.scene.getNonDeletedElementsMap(),r=this.scene.getNonDeletedFramesLikes().filter(t=>!t.locked&&qa(e,t,n));if(!r.length)return null;let i=r.at(-1),a=this.getElementsAtPosition(e.x,e.y,{includeLockedElements:!0}).findLast(e=>!t?.excludeElementIds?.[e.id]);if(a){if(N(a)&&!a.locked)return i;let e=this.scene.getElementIndex(a.id),n=this.scene.getElementIndex(i.id);return e!==-1&&n!==-1&&e<=n?i:(t?.currentFrameId?r.find(e=>e.id===t.currentFrameId)??null:null)||(a.frameId?r.find(e=>e.id===a.frameId)??null:null)}return i}),z(this,`updateFrameToHighlight`,e=>{this.state.frameToHighlight!==e&&this.setState({frameToHighlight:e})}),z(this,`maybeUpdateFrameToHighlightOnPointerMove`,(e,t)=>{this.state.newElement||this.state.multiElement||this.state.selectionElement||this.state.selectedElementsAreBeingDragged||this.updateFrameToHighlight(!t&&Yr(this.state.activeTool.type)?this.getTopLayerFrameAtSceneCoords(e):null)}),z(this,`insertNewElements`,e=>{if(!e.length)return;let t=[];for(let n of e){let e=t[t.length-1];e?.[0].frameId===n.frameId?e.push(n):t.push([n])}for(let e of t){let t=e[0].frameId,n=t?rr(this.scene.getElementsIncludingDeleted(),t):null;this.scene.insertElementsAtIndex(e,n)}}),z(this,`insertNewElement`,e=>{this.insertNewElements([e]);let t=e.frameId?this.scene.getNonDeletedElement(e.frameId):null;this.updateFrameToHighlight(t&&N(t)?t:null)}),z(this,`handleCanvasPointerMove`,e=>{this.savePointer(e.clientX,e.clientY,this.state.cursorButton),this.lastPointerMoveEvent=e.nativeEvent;let t=Ka(e,this.state),{x:n,y:r}=t;this.lastPointerMoveCoords={x:n,y:r},SB.pointers.has(e.pointerId)&&SB.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY});let i=SB.initialScale;if(SB.pointers.size===2&&SB.lastCenter&&i&&SB.initialDistance){let e=Gj(SB.pointers),t=e.x-SB.lastCenter.x,n=e.y-SB.lastCenter.y;SB.lastCenter=e;let r=Kj(Array.from(SB.pointers.values())),a=this.state.activeTool.type===`freedraw`&&this.state.penMode?1:r/SB.initialDistance,o=a?it(i*a):this.state.zoom.value;this.setState(r=>{let i=Ts(r),a=(r.scrollX-i.scrollX)*r.zoom.value,s=(r.scrollY-i.scrollY)*r.zoom.value,c=Lw({viewportX:e.x,viewportY:e.y,nextZoom:o},r),l=Ts({...r,...c}),u=l.zoom.value;return this.translateCanvas({zoom:l.zoom,scrollX:l.scrollX+(a+2*t)/u,scrollY:l.scrollY+(s+2*n)/u,shouldCacheIgnoreZoom:!0},{zoomPreConstrained:!0}),null}),this.resetShouldCacheIgnoreZoomDebounced()}else SB.lastCenter=SB.initialDistance=SB.initialScale=null;if(lB||uB||dB||Bn(this.state))return;let o=HM(fB,e.clientX-this.state.offsetLeft,e.clientY-this.state.offsetTop).isOverEither;if(!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.multiElement&&(o?Jw(this.interactiveCanvas):$w(this.interactiveCanvas,this.state)),this.maybeUpdateFrameToHighlightOnPointerMove({x:n,y:r},o),!this.state.newElement&&_M(this.state.activeTool.type)){let{originOffset:t,snapLines:i}=gM(this.scene.getNonDeletedElements(),this,{x:n,y:r},e,this.scene.getNonDeletedElementsMap());this.setState(e=>{let n=hi(e.snapLines,i),r=e.originSnapOffset?hi(e.originSnapOffset,t):t;return e.snapLines===n&&e.originSnapOffset===r?null:{snapLines:n,originSnapOffset:r}})}else!this.state.newElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.selectionElement&&this.setState(e=>e.snapLines.length?{snapLines:[]}:null);if(this.state.selectedLinearElement?.isEditing&&!this.state.selectedLinearElement.isDragging){let t=this.state.newElement?null:I.handlePointerMoveInEditMode(e,n,r,this);t&&t!==this.state.selectedLinearElement&&(0,Sc.flushSync)(()=>{this.setState({selectedLinearElement:t})})}if(cs(this.state.activeTool.type)){let{newElement:e}=this.state;if(!e&&qt(this.state)){let e=a(n,r),t=this.scene.getNonDeletedElementsMap(),i=Xs(e,this.scene.getNonDeletedElements(),t,Ro(this.state.zoom));i?this.setState({suggestedBinding:{element:i,midPoint:ts(e,i,t,this.state.zoom)}}):this.state.suggestedBinding&&this.setState({suggestedBinding:null})}}if(this.state.multiElement&&this.state.selectedLinearElement){let{multiElement:t,selectedLinearElement:i}=this.state,{x:o,y:s,points:c}=t,l=c[c.length-1],{lastCommittedPoint:u}=i;if($w(this.interactiveCanvas,this.state),l===u)hn(a(n-o,r-s),l)>=8?(this.store.scheduleCapture(),(0,Sc.flushSync)(()=>{pe(this.state.selectedLinearElement?.initialState,`initialState must be set`),this.setState({selectedLinearElement:{...this.state.selectedLinearElement,lastCommittedPoint:c[c.length-1],selectedPointsIndices:[t.points.length],initialState:{...this.state.selectedLinearElement.initialState,lastClickedPoint:t.points.length}}})}),this.scene.mutateElement(t,{points:[...c,a(n-o,r-s)]},{informMutation:!1,isDragging:!1})):Yw(this.interactiveCanvas,Ri.POINTER);else if(c.length>2&&u&&hn(a(n-o,r-s),u)<8){Yw(this.interactiveCanvas,Ri.POINTER),this.scene.mutateElement(t,{points:c.slice(0,-1)},{informMutation:!1,isDragging:!1});let e=t.points.length-1;this.setState({selectedLinearElement:{...i,selectedPointsIndices:i.selectedPointsIndices?[...new Set(i.selectedPointsIndices.map(t=>Math.min(t,e)))]:i.selectedPointsIndices,lastCommittedPoint:t.points[e],initialState:{...i.initialState,lastClickedPoint:e}}})}else{en(c,this.state.zoom.value)&&Yw(this.interactiveCanvas,Ri.POINTER);let i=this.scene.getNonDeletedElementsMap();if(Mi(t)){let e=Xs(a(n,r),this.scene.getNonDeletedElements(),i);Cr(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(t,e)}pe(this.state.selectedLinearElement,`Expected selectedLinearElement to be set to operate on a linear element`);let o=I.handlePointerMove(e.nativeEvent,this,n,r,this.state.selectedLinearElement);o&&this.setState(o)}return}if(this.state.activeTool.type===`arrow`&&!this.state.newElement){let e=a(n,r),t=Xs(e,this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),Ro(this.state.zoom)),i=this.scene.getNonDeletedElementsMap();t&&!Pi(e,t,i)&&this.setState({suggestedBinding:{element:t,midPoint:ts(e,t,i,this.state.zoom)}})}let s=!!e.buttons,c=this.state.activeTool.type===`laser`;if(s||!c&&this.state.activeTool.type!==`selection`&&this.state.activeTool.type!==`lasso`&&this.state.activeTool.type!==`text`&&this.state.activeTool.type!==`eraser`)return;let l=this.scene.getNonDeletedElements(),u=this.scene.getSelectedElements(this.state);if(this.isHittingTextAutoResizeHandle(u,t)){Yw(this.interactiveCanvas,Ri.POINTER);return}if(u.length===1&&!o&&!this.state.selectedLinearElement?.isEditing){if(this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,n,r),(!this.state.selectedLinearElement||this.state.selectedLinearElement.hoverPointIndex===-1)&&this.state.openDialog?.name!==`elementLinkSelector`&&!(u.length===1&&Ti(u[0]))&&!(ja(u[0])&&(this.editorInterface.userAgent.isMobileDevice||u[0].points.length===2))){let t=za(l,this.state,n,r,this.state.zoom,e.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);if(t&&t.transformHandleType){Yw(this.interactiveCanvas,qe(t));return}}}else if(u.length>1&&!o&&this.state.openDialog?.name!==`elementLinkSelector`){let t=Vo(He(u),n,r,this.state.zoom,e.pointerType,this.editorInterface);if(t){Yw(this.interactiveCanvas,qe({transformHandleType:t}));return}}if(f(this.state))return;let d=this.getElementAtPosition(n,r,{preferSelected:!0,includeLockedElements:!0}),p=null;if(p=d&&d.locked?null:d,this.handleIframeLikeElementHover({hitElement:p,scenePointer:t,moveEvent:e})||(this.hitLinkElement=this.getElementLinkAtPosition(t,d)),this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id])Yw(this.interactiveCanvas,Ri.POINTER),cD(this.hitLinkElement,this.state,this.scene.getNonDeletedElementsMap());else{if(uD(),c)return;p&&(p.link||rc(p))&&this.state.selectedElementIds[p.id]&&!this.state.contextMenu&&!this.state.showHyperlinkPopup?this.setState({showHyperlinkPopup:`info`}):this.state.activeTool.type===`text`?Yw(this.interactiveCanvas,R(p)?Ri.TEXT:Ri.CROSSHAIR):!e[M.CTRL_OR_CMD]&&this.isHittingCommonBoundingBoxOfSelectedElements(t,u)?Yw(this.interactiveCanvas,Ri.MOVE):this.state.viewModeEnabled?Yw(this.interactiveCanvas,Ri.GRAB):this.state.openDialog?.name===`elementLinkSelector`||o?Yw(this.interactiveCanvas,Ri.AUTO):!e[M.CTRL_OR_CMD]&&p?.id!==this.state.editingTextElement?.id?(p||this.isHittingCommonBoundingBoxOfSelectedElements(t,u))&&!p?.locked&&(!p||!Ti(p)||!(p.startBinding||p.endBinding))&&(this.state.activeTool.type!==`lasso`||u.length>0)&&Yw(this.interactiveCanvas,Ri.MOVE):Yw(this.interactiveCanvas,Ri.AUTO),this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,n,r)}this.state.openDialog?.name===`elementLinkSelector`&&p?this.setState(e=>({hoveredElementIds:hi(e.hoveredElementIds,tr({editingGroupId:e.editingGroupId,selectedElementIds:{[p.id]:!0}},this.scene.getNonDeletedElements(),e,this).selectedElementIds)})):this.state.openDialog?.name===`elementLinkSelector`&&!p&&this.setState(e=>({hoveredElementIds:hi(e.hoveredElementIds,{})}))}),z(this,`handleEraser`,(e,t)=>{let n=this.eraserTrail.addPointToPath(t.x,t.y,e.altKey);this.elementsPendingErasure=new Set(n),this.triggerRender()}),z(this,`handleTouchMove`,e=>{mB=!0}),z(this,`handleCanvasPointerDown`,e=>{let t=this.scene.getSelectedElements(this.state);if(!e.ctrlKey){let e=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==e&&this.setState({isBindingEnabled:e})}let{x:n,y:r}=Ka(e,this.state);this.lastPointerMoveCoords={x:n,y:r};let i=e.target;if(i.setPointerCapture&&i.setPointerCapture(e.pointerId),this.maybeCleanupAfterMissingPointerUp(e.nativeEvent),this.maybeUnfollowRemoteUser(),this.state.searchMatches&&(this.setState(e=>({searchMatches:e.searchMatches&&{focusedId:null,matches:e.searchMatches.matches.map(e=>({...e,focus:!1}))}})),this.updateEditorAtom(wF,null)),py.get(wD)&&this.updateEditorAtom(wD,null),this.state.contextMenu&&this.setState({contextMenu:null}),this.state.snapLines&&this.setAppState({snapLines:[]}),this.state.openPopup&&this.setState({openPopup:null}),this.updateGestureOnPointerDown(e),e.pointerType===`touch`&&this.state.newElement&&this.state.newElement.type===`freedraw`){let e=this.state.newElement;this.updateScene({...e.points.length<10?{elements:this.scene.getElementsIncludingDeleted().filter(t=>t.id!==e.id)}:{},appState:{newElement:null,editingTextElement:null,suggestedBinding:null,selectedElementIds:Ji(Object.keys(this.state.selectedElementIds).filter(t=>t!==e.id).reduce((e,t)=>(e[t]=this.state.selectedElementIds[t],e),{}),this.state)},captureUpdate:this.state.openDialog?.name===`elementLinkSelector`?P.EVENTUALLY:P.NEVER});return}let a=document.getSelection();if(a?.anchorNode&&a.removeAllRanges(),this.maybeOpenContextMenuAfterPointerDownOnTouchDevices(e),!this.state.penDetected&&e.pointerType===`pen`&&this.setState(e=>({penMode:!0,penDetected:!0,currentItemStrokeVariability:`variable`})),!this.editorInterface.isTouchScreen&&[`pen`,`touch`].includes(e.pointerType)&&(this.editorInterface=ve(this.editorInterface,{isTouchScreen:!0})),uB||(this.lastPointerDownEvent=e,this.handleCanvasPanUsingWheelOrSpaceDrag(e)))return;if(this.setState({lastPointerDownWith:e.pointerType,cursorButton:`down`}),this.savePointer(e.clientX,e.clientY,`down`),e.button===qi.ERASER&&this.state.activeTool.type!==es.eraser){this.setState({activeTool:kr(this.state,{type:es.eraser,lastActiveTool:this.state.activeTool})},()=>{this.handleCanvasPointerDown(e);let t=()=>{n(),r?.(),f(this.state)&&this.setState({activeTool:kr(this.state,{...this.state.activeTool.lastActiveTool||{type:es.selection},lastActiveTool:null})})},n=Hi(window,L.POINTER_UP,t,{once:!0}),r;requestAnimationFrame(()=>{r=this.missingPointerEventCleanupEmitter.once(t)})});return}if(e.button!==qi.MAIN&&e.button!==qi.TOUCH&&e.button!==qi.ERASER||SB.pointers.size>1)return;let o=this.initialPointerDownState(e);if(this.setState({selectedElementsAreBeingDragged:!1}),this.handleTextAutoResizeHandlePointerDown(t,o.origin)||this.handleDraggingScrollBar(e,o)||(this.clearSelectionIfNotUsingSelection(),this.handleSelectionOnPointerDown(e,o))||!(!this.state.penMode||e.pointerType!==`touch`||this.state.activeTool.type===`selection`||this.state.activeTool.type===`lasso`||this.state.activeTool.type===`text`||this.state.activeTool.type===`image`))return;if(this.state.activeTool.type===`lasso`){let t=o.hit.element&&this.isASelectedElement(o.hit.element);(e.altKey&&e[M.CTRL_OR_CMD]&&!o.resize.handleType||!o.hit.hasHitCommonBoundingBoxOfSelectedElements&&!o.resize.handleType&&!t)&&(this.lassoTrail.hasCurrentTrail||this.lassoTrail.startPath(o.origin.x,o.origin.y,e.shiftKey),o.drag.blockDragging=this.editorInterface.formFactor===`desktop`),this.editorInterface.formFactor!==`desktop`&&o.hit.element&&!t&&(this.setState(e=>{let t={...e.selectedElementIds,[o.hit.element.id]:!0},n=[];Object.keys(e.selectedElementIds).forEach(e=>{let t=this.scene.getElement(e);t&&n.push(t)});let r=o.hit.element;if(N(r))D(n,r.id).forEach(e=>{delete t[e.id]});else if(r.frameId)t[r.frameId]&&delete t[r.id];else{let e=r.groupIds,i=new Set(e.flatMap(e=>Tt(this.scene.getNonDeletedElements(),e)).filter(e=>N(e)).map(e=>e.id));i.size>0&&n.forEach(e=>{e.frameId&&i.has(e.frameId)&&(delete t[e.id],e.groupIds.flatMap(e=>Tt(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}))})}return{...tr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:r.link||rc(r)?`info`:!1}}),o.hit.wasAddedToSelection=!0)}else this.state.activeTool.type===`text`?this.handleTextOnPointerDown(e,o):this.state.activeTool.type===`arrow`||this.state.activeTool.type===`line`?this.handleLinearElementOnPointerDown(e,this.state.activeTool.type,o):this.state.activeTool.type===`freedraw`?this.handleFreeDrawElementOnPointerDown(e,this.state.activeTool.type,o):this.state.activeTool.type===`custom`?$w(this.interactiveCanvas,this.state):this.state.activeTool.type===es.frame||this.state.activeTool.type===es.magicframe?this.createFrameElementOnPointerDown(o,this.state.activeTool.type):this.state.activeTool.type===`laser`?this.laserTrails.startPath(o.lastCoords.x,o.lastCoords.y):this.state.activeTool.type!==`eraser`&&this.state.activeTool.type!==`hand`&&this.state.activeTool.type!==`image`&&this.createGenericElementOnPointerDown(this.state.activeTool.type,o);this.props?.onPointerDown?.(this.state.activeTool,o),this.onPointerDownEmitter.trigger(this.state.activeTool,o,e),this.state.activeTool.type===`eraser`&&this.eraserTrail.startPath(o.lastCoords.x,o.lastCoords.y);let s=this.onPointerMoveFromPointerDownHandler(o),c=this.onPointerUpFromPointerDownHandler(o),l=this.onKeyDownFromPointerDownHandler(o),u=this.onKeyUpFromPointerDownHandler(o);this.missingPointerEventCleanupEmitter.once(t=>c(t||e.nativeEvent)),(!this.state.viewModeEnabled||this.state.activeTool.type===`laser`)&&(window.addEventListener(L.POINTER_MOVE,s),window.addEventListener(L.POINTER_UP,c),window.addEventListener(L.KEYDOWN,l),window.addEventListener(L.KEYUP,u),o.eventListeners.onMove=s,o.eventListeners.onUp=c,o.eventListeners.onKeyUp=u,o.eventListeners.onKeyDown=l)}),z(this,`handleCanvasPointerUp`,e=>{if(Cr(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),this.removePointer(e),this.lastPointerUpIsDoubleClick=this.isDoubleClick(this.lastPointerUpEvent,e),this.lastPointerUpEvent=e,!e.ctrlKey){let e=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==e&&this.setState({isBindingEnabled:e})}let t=Ka({clientX:e.clientX,clientY:e.clientY},this.state),{x:n,y:r}=t;if(this.lastPointerMoveCoords={x:n,y:r},!this.handleIframeLikeCenterClick()){if(this.editorInterface.isTouchScreen){let e=this.getElementAtPosition(t.x,t.y,{includeLockedElements:!0});this.hitLinkElement=this.getElementLinkAtPosition(t,e)}this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?this.handleElementLinkClick(e):this.state.viewModeEnabled&&this.setState({activeEmbeddable:null,selectedElementIds:{}})}}),z(this,`maybeOpenContextMenuAfterPointerDownOnTouchDevices`,e=>{e.pointerType===`touch`&&(mB=!1,pB?mB=!0:pB=window.setTimeout(()=>{pB=0,mB||this.handleCanvasContextMenu(e)},500))}),z(this,`resetContextMenuTimer`,()=>{clearTimeout(pB),pB=0,mB=!1}),z(this,`maybeCleanupAfterMissingPointerUp`,e=>{xB?.(),this.missingPointerEventCleanupEmitter.trigger(e).clear()}),z(this,`handleCanvasPanUsingWheelOrSpaceDrag`,e=>{if(!(SB.pointers.size<=1&&(e.button===qi.WHEEL||e.button===qi.MAIN&&lB||Bn(this.state)||this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`)))return!1;uB=!0,this.focusContainer(),this.state.editingTextElement||e.preventDefault();let t=!1,n=/Linux/.test(window.navigator.platform);Yw(this.interactiveCanvas,Ri.GRABBING);let{clientX:r,clientY:i}=e,a=jn(e=>{let a=r-e.clientX,o=i-e.clientY;if(r=e.clientX,i=e.clientY,n&&!t&&(Math.abs(a)>1||Math.abs(o)>1)){t=!0;let e=t=>{document.body.removeEventListener(L.PASTE,e),t.stopPropagation()},n=()=>{setTimeout(()=>{document.body.removeEventListener(L.PASTE,e),window.removeEventListener(L.POINTER_UP,n)},100)};document.body.addEventListener(L.PASTE,e),window.addEventListener(L.POINTER_UP,n)}this.translateCanvas({scrollX:this.state.scrollX-a/this.state.zoom.value,scrollY:this.state.scrollY-o/this.state.zoom.value})}),o=oc(xB=()=>{xB=null,uB=!1,lB||(this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`?Yw(this.interactiveCanvas,Ri.GRAB):$w(this.interactiveCanvas,this.state)),this.setState({cursorButton:`up`}),this.savePointer(e.clientX,e.clientY,`up`),window.removeEventListener(L.POINTER_MOVE,a),window.removeEventListener(L.POINTER_UP,o),window.removeEventListener(L.BLUR,o),a.flush()});return window.addEventListener(L.BLUR,o),window.addEventListener(L.POINTER_MOVE,a,{passive:!0}),window.addEventListener(L.POINTER_UP,o),!0}),z(this,`clearSelectionIfNotUsingSelection`,()=>{Za(this.state.activeTool.type)||this.setState({selectedElementIds:Ji({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}),z(this,`handleSelectionOnPointerDown`,(e,t)=>{if(Za(this.state.activeTool.type)){let n=this.scene.getNonDeletedElements(),r=this.scene.getNonDeletedElementsMap(),i=this.scene.getSelectedElements(this.state);if(i.length===1&&!this.state.selectedLinearElement?.isEditing&&!Ti(i[0])&&!(ja(i[0])&&(this.editorInterface.userAgent.isMobileDevice||i[0].points.length===2))&&!(this.state.selectedLinearElement&&this.state.selectedLinearElement.hoverPointIndex!==-1)){let r=za(n,this.state,t.origin.x,t.origin.y,this.state.zoom,e.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);r!=null&&(r.transformHandleType===`rotation`?(this.setState({resizingElement:r.element}),t.resize.handleType=r.transformHandleType):(this.state.croppingElementId||this.setState({resizingElement:r.element}),t.resize.handleType=r.transformHandleType))}else i.length>1&&(t.resize.handleType=Vo(He(i),t.origin.x,t.origin.y,this.state.zoom,e.pointerType,this.editorInterface));if(t.resize.handleType)t.resize.isResizing=!0,t.resize.offset=he(pi(t.resize.handleType,i,r,t.origin.x,t.origin.y)),i.length===1&&ja(i[0])&&i[0].points.length===2&&(t.resize.arrowDirection=oa(t.resize.handleType,i[0]));else{if(this.state.selectedLinearElement){let n=this.state.selectedLinearElement,r=I.handlePointerDown(e,this,this.store,t.origin,n,this.scene);if(r.hitElement&&(t.hit.element=r.hitElement),r.linearElementEditor&&this.setState({selectedLinearElement:r.linearElementEditor}),r.didAddPoint)return!0;let i=this.scene.getNonDeletedElementsMap(),a=I.getElement(n.elementId,i);if(a&&pa(a)){let{hitFocusPoint:e,pointerOffset:r}=xa(a,t,i,this.state);if(e)return this.setState({selectedLinearElement:{...n,hoveredFocusPointBinding:e,draggedFocusPointBinding:e,pointerOffset:r}}),!1}}let n=this.getElementsAtPosition(t.origin.x,t.origin.y,{includeLockedElements:!0}),r=n.filter(e=>!e.locked),i=this.getElementAtPosition(t.origin.x,t.origin.y,{allHitElements:n});if((!i||i.id!==this.state.activeLockedId)&&this.setState({activeLockedId:null}),i&&i.locked&&!r.some(e=>this.state.selectedElementIds[e.id])?t.hit.element=null:t.hit.element=t.hit.element??this.getElementAtPosition(t.origin.x,t.origin.y),this.hitLinkElement=this.getElementLinkAtPosition(t.origin,i),this.hitLinkElement)return!0;if(this.state.croppingElementId&&t.hit.element?.id!==this.state.croppingElementId&&this.finishImageCropping(),t.hit.element&&this.getElementLinkAtPosition({x:t.origin.x,y:t.origin.y},t.hit.element))return!1;t.hit.allHitElements=r;let a=t.hit.element,o=t.hit.allHitElements.some(e=>this.isASelectedElement(e));if((a===null||!o)&&!e.shiftKey&&!t.hit.hasHitCommonBoundingBoxOfSelectedElements&&(!this.state.selectedLinearElement?.isEditing||a&&a?.id!==this.state.selectedLinearElement?.elementId)&&this.clearSelection(a),this.state.selectedLinearElement?.isEditing)this.setState(e=>({selectedLinearElement:e.selectedLinearElement?{...e.selectedLinearElement,isEditing:!!a&&a.id===this.state.selectedLinearElement?.elementId}:null,selectedElementIds:e.selectedLinearElement?Ji({[e.selectedLinearElement.elementId]:!0},this.state):Ji({},e)}));else if(a!=null){if(e[M.CTRL_OR_CMD])return e.altKey?(this.state.openDialog?.name===`elementLinkSelector`&&this.setOpenDialog(null),this.lassoTrail.startPath(t.origin.x,t.origin.y,e.shiftKey),this.setActiveTool({type:`lasso`,fromSelection:!0}),!1):(this.state.selectedElementIds[a.id]||(t.hit.wasAddedToSelection=!0),this.setState(e=>({...Ua(e,a),previousSelectedElementIds:this.state.selectedElementIds})),!1);this.state.selectedElementIds[a.id]||(this.state.editingGroupId&&!ua(a,this.state.editingGroupId)&&this.setState({selectedElementIds:Ji({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),!o&&!t.hit.hasHitCommonBoundingBoxOfSelectedElements&&(this.setState(e=>{let t={...e.selectedElementIds,[a.id]:!0},n=[];if(Object.keys(e.selectedElementIds).forEach(e=>{let t=this.scene.getElement(e);t&&n.push(t)}),N(a))D(n,a.id).forEach(e=>{delete t[e.id]});else if(a.frameId)t[a.frameId]&&delete t[a.id];else{let e=a.groupIds,r=new Set(e.flatMap(e=>Tt(this.scene.getNonDeletedElements(),e)).filter(e=>N(e)).map(e=>e.id));r.size>0&&n.forEach(e=>{e.frameId&&r.has(e.frameId)&&(delete t[e.id],e.groupIds.flatMap(e=>Tt(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}))})}return e.openDialog?.name===`elementLinkSelector`&&(a.groupIds.some(t=>e.selectedGroupIds[t])||(t={[a.id]:!0})),{...tr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:a.link||rc(a)?`info`:!1}}),t.hit.wasAddedToSelection=!0))}this.setState({previousSelectedElementIds:this.state.selectedElementIds})}}return!1}),z(this,`handleTextOnPointerDown`,(e,t)=>{if(this.state.editingTextElement)return;let n=t.origin.x,r=t.origin.y,i=this.getElementAtPosition(n,r,{includeBoundTextElement:!0}),a=this.getTextBindableContainerAtPosition(n,r);ai(i)&&(a=i,n=i.x+i.width/2,r=i.y+i.height/2),this.startTextEditing({sceneX:n,sceneY:r,insertAtParentCenter:!e.altKey,container:a,autoEdit:!1,initialCaretSceneCoords:{x:n,y:r}}),Jw(this.interactiveCanvas),this.state.activeTool.locked||this.setState({activeTool:kr(this.state,{type:this.state.preferredSelectionTool.type})})}),z(this,`handleFreeDrawElementOnPointerDown`,(e,t,n)=>{let[r,i]=kn(n.origin.x,n.origin.y,null),o=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),s=e.pressure===.5,c=this.state.currentItemStrokeVariability,l=Te({type:t,x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.getCurrentItemStrokeWidth(`freedraw`),strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:null,simulatePressure:s,strokeOptions:{variability:c,streamline:e.pointerType===`mouse`?Bo:Ft},locked:!1,frameId:o?o.id:null,points:[a(0,0)],pressures:s?[]:[e.pressure]});this.insertNewElement(l),this.setState(e=>{let t={...e.selectedElementIds};return delete t[l.id],{selectedElementIds:Ji(t,e)}}),this.setState({newElement:l,suggestedBinding:null})}),z(this,`insertIframeElement`,({sceneX:e,sceneY:t,width:n,height:r})=>{let[i,a]=kn(e,t,this.lastPointerDownEvent?.[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o=On({type:`iframe`,x:i,y:a,strokeColor:`transparent`,backgroundColor:`transparent`,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.getCurrentItemStrokeWidth(`iframe`),strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness(`iframe`),opacity:this.state.currentItemOpacity,locked:!1,width:n,height:r});return this.insertNewElement(o),o}),z(this,`insertEmbeddableElement`,({sceneX:e,sceneY:t,link:n})=>{let[r,i]=kn(e,t,this.lastPointerDownEvent?.[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=fr(n);if(!a)return;a.error instanceof URIError&&this.setToast({message:G(`toast.unrecognizedLinkFormat`),closable:!0});let o=La({type:`embeddable`,x:r,y:i,strokeColor:`transparent`,backgroundColor:`transparent`,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.getCurrentItemStrokeWidth(`embeddable`),strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness(`embeddable`),opacity:this.state.currentItemOpacity,locked:!1,width:a.intrinsicSize.w,height:a.intrinsicSize.h,link:n});return this.insertNewElement(o),o}),z(this,`newImagePlaceholder`,({sceneX:e,sceneY:t,addToFrameUnderCursor:n=!0})=>{let[r,i]=kn(e,t,this.lastPointerDownEvent?.[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=n?this.getTopLayerFrameAtSceneCoords({x:r,y:i}):null,o=100/this.state.zoom.value;return Ze({type:`image`,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.getCurrentItemStrokeWidth(`image`),strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:null,opacity:this.state.currentItemOpacity,locked:!1,frameId:a?a.id:null,x:r-o/2,y:i-o/2,width:o,height:o})}),z(this,`handleLinearElementOnPointerDown`,(e,t,n)=>{if(e.ctrlKey&&(0,Sc.flushSync)(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!==`enabled`})}),this.state.multiElement){let{multiElement:t,selectedLinearElement:r}=this.state;if(pe(r,`selectedLinearElement is expected to be set`),t.type===`line`&&en(t.points,this.state.zoom.value)){(0,Sc.flushSync)(()=>{this.setState({selectedLinearElement:{...r,lastCommittedPoint:t.points[t.points.length-1],initialState:{...r.initialState,lastClickedPoint:-1}}})}),this.actionManager.executeAction(xT);return}if(Ti(t)&&t.points.length>1){this.actionManager.executeAction(xT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n.origin.x,y:n.origin.y}});return}let{x:i,y:o}=t,{lastCommittedPoint:s}=r,c=Ka(e,this.state),{start:l,end:u}=pa(t)&&qt(this.state)?Qs(t,new Map([[t.points.length-1,{point:t.points[t.points.length-1],isDragging:!1}]]),c.x,c.y,this.scene.getNonDeletedElementsMap(),this.scene.getNonDeletedElements(),this.state,{newArrow:!!this.state.newElement,zoom:this.state.zoom}):{end:{mode:void 0}},d=this.scene.getNonDeletedElementsMap(),f=l?.mode!=null&&u.mode!=null&&l.element.id===u.element.id&&!Pi(u.focusPoint,u.element,d),p=u.mode===`orbit`&&t.startBinding?.elementId!==u.element?.id,m=s&&hn(a(n.origin.x-i,n.origin.y-o),s)<8;if(p||f||t.points.length>1&&m){this.actionManager.executeAction(xT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n.origin.x,y:n.origin.y}});return}this.setState(e=>({selectedElementIds:Ji({...e.selectedElementIds,[t.id]:!0},e)})),Yw(this.interactiveCanvas,Ri.POINTER)}else{let[r,i]=kn(n.origin.x,n.origin.y,e[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),{currentItemStartArrowhead:s,currentItemEndArrowhead:c}=this.state,[l,u]=t===`arrow`?[s,c]:[null,null],d=t===`arrow`?ra({type:t,x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.getCurrentItemStrokeWidth(t),strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemArrowType===Er.round?{type:Go.PROPORTIONAL_RADIUS}:null,startArrowhead:l,endArrowhead:u,locked:!1,frameId:o?o.id:null,elbowed:this.state.currentItemArrowType===Er.elbow,fixedSegments:this.state.currentItemArrowType===Er.elbow?[]:null}):A({type:t,x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.getCurrentItemStrokeWidth(t),strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemRoundness===`round`?{type:Go.PROPORTIONAL_RADIUS}:null,locked:!1,frameId:o?o.id:null}),f=a(n.origin.x,n.origin.y),p=this.scene.getNonDeletedElementsMap(),m=qt(this.state)?Xs(f,this.scene.getNonDeletedElements(),p):null;this.scene.mutateElement(d,{points:[a(0,0),a(0,0)]}),this.insertNewElement(d),pa(d)&&uc(d,new Map([[0,{point:a(0,0),isDragging:!1}]]),f[0],f[1],this.scene,this.state,{newArrow:!0,altKey:e.altKey,initialBinding:!0,angleLocked:Wr(e.nativeEvent)}),(0,Sc.flushSync)(()=>{this.setState(t=>{let r=null,i=t.selectedElementIds;if(ja(d)){r=new I(d,this.scene.getNonDeletedElementsMap());let t=d.points.length-1;r={...r,selectedPointsIndices:[t],initialState:{...r.initialState,arrowStartIsInside:e.altKey,lastClickedPoint:t,origin:a(n.origin.x,n.origin.y)}}}return i=this.state.activeTool.locked?t.selectedElementIds:Ji({[d.id]:!0},t),{...t,bindMode:`orbit`,newElement:d,suggestedBinding:m&&pa(d)?{element:m,midPoint:ts(f,m,p,this.state.zoom)}:null,selectedElementIds:i,selectedLinearElement:r}})}),pa(d)&&Cr(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(d,m)}}),z(this,`createGenericElementOnPointerDown`,(e,t)=>{let[n,r]=kn(t.origin.x,t.origin.y,this.lastPointerDownEvent?.[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i=this.getTopLayerFrameAtSceneCoords({x:n,y:r}),a={x:n,y:r,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.getCurrentItemStrokeWidth(e),strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.getCurrentItemRoundness(e),locked:!1,frameId:i?i.id:null},o;o=e===`embeddable`?La({type:`embeddable`,...a}):fc({type:e,...a}),o.type===`selection`?this.setState({selectionElement:o}):(this.insertNewElement(o),this.setState({multiElement:null,newElement:o}))}),z(this,`createFrameElementOnPointerDown`,(e,t)=>{let[n,r]=kn(e.origin.x,e.origin.y,this.lastPointerDownEvent?.[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i={x:n,y:r,opacity:this.state.currentItemOpacity,locked:!1,...fi},a=t===es.magicframe?p(i):Be(i);this.insertNewElement(a),this.setState({multiElement:null,newElement:a})}),z(this,`restoreReadyToEraseElements`,()=>{this.elementsPendingErasure=new Set,this.triggerRender()}),z(this,`eraseElements`,()=>{let e=!1;this.elementsPendingErasure.forEach(e=>{let t=this.scene.getElement(e);if(pa(t)){if(t.startBinding){let e=this.scene.getElement(t.startBinding.elementId);Ye(e,this.scene.getElementsMapIncludingDeleted(),{boundElements:e.boundElements.filter(e=>e.id!==t.id)})}if(t.endBinding){let e=this.scene.getElement(t.endBinding.elementId);Ye(e,this.scene.getElementsMapIncludingDeleted(),{boundElements:e.boundElements.filter(e=>e.id!==t.id)})}}else sn(t)&&t.boundElements?.forEach(e=>{if(e.type===`arrow`){let n=this.scene.getElement(e.id);n?.startBinding?.elementId===t.id&&Ye(n,this.scene.getElementsMapIncludingDeleted(),{startBinding:null}),n?.endBinding?.elementId===t.id&&Ye(n,this.scene.getElementsMapIncludingDeleted(),{endBinding:null})}})});let t=this.scene.getElementsIncludingDeleted().map(t=>this.elementsPendingErasure.has(t.id)||t.frameId&&this.elementsPendingErasure.has(t.frameId)||xo(t)&&this.elementsPendingErasure.has(t.containerId)?(e=!0,j(t,{isDeleted:!0})):t);this.elementsPendingErasure=new Set,e&&(this.store.scheduleCapture(),this.scene.replaceAllElements(t))}),z(this,`initializeImage`,async(e,t)=>{if(!pn(t))throw Error(G(`errors.unsupportedFileType`));let n=t.type;if(Yw(this.interactiveCanvas,`wait`),n===Se.svg)try{t=Di(ks(await t.text()),t.name)}catch(e){throw console.warn(e),Error(G(`errors.svgImageInsertError`))}let r=await(this.props.generateIdForFile?.(t)||Zo(t));if(!r)throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."),Error(G(`errors.imageInsertError`));if(!this.files[r]?.dataURL){let{maxWidthOrHeight:e,maxFileSizeBytes:n}=this.props.imageOptions;try{t=await At(t,{maxWidthOrHeight:e})}catch(e){console.error(`Error trying to resizing image file on insertion`,e)}if(t.size>n)throw Error(G(`errors.fileTooBig`,{maxSize:`${Math.trunc(n/1024/1024)}MB`}))}let i=this.files[r]?.dataURL||await ft(t);return new Promise(async(t,a)=>{try{let a=this.getLatestInitializedImageElement(e,r);if(this.addMissingFiles([{mimeType:n,id:r,dataURL:i,created:Date.now(),lastRetrieved:Date.now()}]),!this.imageCache.get(r)){this.addNewImagesToImageCache();let{erroredFiles:e}=await this.updateImageCache([a]);if(e.size)throw Error(`Image cache update resulted with an error.`)}let o=await this.imageCache.get(r)?.image;if(o&&this.state.newElement?.id!==a.id){a=this.getLatestInitializedImageElement(e,r);let t=this.getImageNaturalDimensions(a,o);Object.assign(a,t)}t(a)}catch(e){console.error(e),a(Error(G(`errors.imageInsertError`)))}})}),z(this,`getLatestInitializedImageElement`,(e,t)=>j(this.scene.getElement(e.id)??e,{fileId:t})),z(this,`onImageToolbarButtonClick`,async()=>{try{let{x:e,y:t}=Ka({clientX:this.state.width/2+this.state.offsetLeft,clientY:this.state.height/2+this.state.offsetTop},this.state),n=await Oi({description:`Image`,extensions:Object.keys(ic),multiple:!0});this.insertImages(n,e,t)}catch(e){e.name===`AbortError`?console.warn(e):console.error(e),this.setState({newElement:null,activeTool:kr(this.state,{type:this.state.preferredSelectionTool.type})},()=>{this.actionManager.executeAction(xT)})}}),z(this,`getImageNaturalDimensions`,(e,t)=>{let n=Math.max(this.state.height-120,160),r=Math.min(n,Math.floor(this.state.height*.5)/this.state.zoom.value),i=Math.min(t.naturalHeight,r),a=i*(t.naturalWidth/t.naturalHeight);return{x:e.x+e.width/2-a/2,y:e.y+e.height/2-i/2,width:a,height:i,crop:null}}),z(this,`updateImageCache`,async(e,t=this.files)=>{let{updatedFiles:n,erroredFiles:r}=await fs({imageCache:this.imageCache,fileIds:e.map(e=>e.fileId),files:t});return r.size&&(this.store.scheduleAction(P.NEVER),this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map(e=>Xn(e)&&r.has(e.fileId)?j(e,{status:`error`}):e))),{updatedFiles:n,erroredFiles:r}}),z(this,`addNewImagesToImageCache`,async(e=Ge(this.scene.getNonDeletedElements()),t=this.files)=>{let n=e.filter(e=>!e.isDeleted&&!this.imageCache.has(e.fileId));if(n.length){let{updatedFiles:e}=await this.updateImageCache(n,t);if(e.size)for(let t of n)e.has(t.fileId)&&wt.delete(t);e.size&&this.scene.triggerUpdate()}}),z(this,`scheduleImageRefresh`,(0,wc.default)(()=>{this.addNewImagesToImageCache()},500)),z(this,`handleInteractiveCanvasRef`,e=>{e===null?(this.interactiveCanvas?.removeEventListener(L.TOUCH_START,this.onTouchStart),this.interactiveCanvas?.removeEventListener(L.TOUCH_END,this.onTouchEnd)):(this.interactiveCanvas=e,this.interactiveCanvas.addEventListener(L.TOUCH_START,this.onTouchStart,{passive:!1}),this.interactiveCanvas.addEventListener(L.TOUCH_END,this.onTouchEnd))}),z(this,`insertImages`,async(e,t,n)=>{let r=50/this.state.zoom.value,i=b(e.map(()=>this.newImagePlaceholder({sceneX:t,sceneY:n})),t,n,r);this.insertNewElements(i);let a=await Promise.all(i.map(async(t,n)=>{try{return await this.initializeImage(t,await $a(e[n]))}catch(e){return this.setState({errorMessage:e.message||G(`errors.imageInsertError`)}),j(t,{isDeleted:!0})}})),o=Pa(a),s=b(a.filter(e=>!e.isDeleted),t,n,r),c=Pa(s),l=this.scene.getElementsIncludingDeleted().map(e=>c.get(e.id)??o.get(e.id)??e);this.updateScene({appState:{selectedElementIds:Ji(Object.fromEntries(s.map(e=>[e.id,!0])),this.state)},elements:l,captureUpdate:P.IMMEDIATELY}),this.setState({},()=>{this.actionManager.executeAction(xT)})}),z(this,`handleAppOnDrop`,async e=>{let{x:t,y:n}=Ka(e,this.state),r=await WT(e),i=r.getFiles();if(i.length===1){let{file:e,fileHandle:t}=i[0];if(e&&(e.type===Se.png||e.type===Se.svg))try{let n=await ce(e,this.state,this.scene.getElementsIncludingDeleted(),t);this.syncActionResult({...n,appState:{...n.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:P.IMMEDIATELY});return}catch(e){if(e.name!==`EncodingError`)throw Error(G(`alerts.couldNotLoadInvalidFile`))}}let a=i.map(e=>e.file).filter(e=>pn(e));if(a.length>0&&this.isToolSupported(`image`))return this.insertImages(a,t,n);let o=r.getData(Se.excalidrawlibIds),s=r.getData(Se.excalidrawlib);if(o||s){try{let t=null;if(o){let{itemIds:e}=JSON.parse(o);t=(await this.library.getLatestLibrary()).filter(t=>e.includes(t.id))}else s&&(t=ea(s));t?.length&&(t=t.map(e=>({...e,elements:w({type:`everything`,elements:e.elements,randomizeSeed:!0,preserveFrameChildrenOrder:!0}).duplicatedElements})),this.addElementsFromPasteOrLibrary({elements:hO(t),position:e,files:null}))}catch(e){this.setState({errorMessage:e.message})}return}if(i.length>0){let{file:e,fileHandle:t}=i[0];e&&await this.loadFileToCanvas(e,t)}let c=r.findByType(Se.text);if(c){let e=c.value;if(e&&Ao(e,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)||fr(e)?.type===`video`)){let r=this.insertEmbeddableElement({sceneX:t,sceneY:n,link:je(e)});r&&(this.store.scheduleCapture(),this.setState({selectedElementIds:{[r.id]:!0}}))}}}),z(this,`loadFileToCanvas`,async(e,t)=>{e=await $a(e);try{let n=this.scene.getElementsIncludingDeleted(),r;try{r=await pr(e,this.state,n,t)}catch(e){let t=e instanceof va;if(t&&e.code===`IMAGE_NOT_CONTAINS_SCENE_DATA`&&!this.isToolSupported(`image`)){this.setState({isLoading:!1,errorMessage:G(`errors.imageToolNotSupported`)});return}let n=G(t?`alerts.cannotRestoreFromImage`:`alerts.couldNotLoadInvalidFile`);this.setState({isLoading:!1,errorMessage:n})}if(!r)return;r.type===Se.excalidraw?(ur(n.concat(r.data.elements)),this.store.scheduleMicroAction({action:P.NEVER,elements:n,appState:void 0}),this.setState({isLoading:!0}),this.syncActionResult({...r.data,appState:{...r.data.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:P.IMMEDIATELY})):r.type===Se.excalidrawlib&&await this.library.updateLibrary({libraryItems:e,merge:!0,openLibraryMenu:!0}).catch(e=>{console.error(e),this.setState({errorMessage:G(`errors.importLibraryError`)})})}catch(e){this.setState({isLoading:!1,errorMessage:e.message})}}),z(this,`handleCanvasContextMenu`,e=>{if(e.preventDefault(),(`pointerType`in e.nativeEvent&&e.nativeEvent.pointerType===`touch`||`pointerType`in e.nativeEvent&&e.nativeEvent.pointerType===`pen`&&e.button!==qi.SECONDARY)&&this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let{x:t,y:n}=Ka(e,this.state),r=this.getElementAtPosition(t,n,{preferSelected:!0,includeLockedElements:!0}),i=this.scene.getSelectedElements(this.state),a=this.isHittingCommonBoundingBoxOfSelectedElements({x:t,y:n},i),o=r||a?`element`:`canvas`,{top:s,left:c}=this.excalidrawContainerRef.current.getBoundingClientRect(),l=e.clientX-c,u=e.clientY-s;rC(`contextMenu`,`openContextMenu`,o),this.setState({...r&&!this.state.selectedElementIds[r.id]?{...this.state,...tr({editingGroupId:this.state.editingGroupId,selectedElementIds:{[r.id]:!0}},this.scene.getNonDeletedElements(),this.state,this),selectedLinearElement:ja(r)?new I(r,this.scene.getNonDeletedElementsMap()):null}:this.state,showHyperlinkPopup:!1},()=>{this.setState({contextMenu:{top:u,left:l,items:this.getContextMenuItems(o)}})})}),z(this,`maybeDragNewGenericElement`,(e,t,n=!0)=>{let r=this.state.selectionElement,i=e.lastCoords;if(r&&e.boxSelection.hasOccurred&&this.state.activeTool.type!==`eraser`){yn({newElement:r,elementType:this.state.activeTool.type,originX:e.origin.x,originY:e.origin.y,x:i.x,y:i.y,width:hs(e.origin.x,i.x),height:hs(e.origin.y,i.y),shouldMaintainAspectRatio:O(t),shouldResizeFromCenter:!1,scene:this.scene,zoom:this.state.zoom.value,informMutation:!1});return}let a=this.state.newElement;if(!a)return;let[o,s]=kn(i.x,i.y,t[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),c=Xn(a)&&this.imageCache.get(a.fileId)?.image,l=c&&!(c instanceof Promise)?c.width/c.height:null;this.maybeCacheReferenceSnapPoints(t,[a]);let{snapOffset:u,snapLines:d}=hM(a,this,t,{x:e.originInGrid.x+(this.state.originSnapOffset?.x??0),y:e.originInGrid.y+(this.state.originSnapOffset?.y??0)},{x:o-e.originInGrid.x,y:s-e.originInGrid.y},this.scene.getNonDeletedElementsMap());o+=u.x,s+=u.y,this.setState({snapLines:d}),pa(a)||yn({newElement:a,elementType:this.state.activeTool.type,originX:e.originInGrid.x,originY:e.originInGrid.y,x:o,y:s,width:hs(e.originInGrid.x,o),height:hs(e.originInGrid.y,s),shouldMaintainAspectRatio:Ce(a)?!O(t):O(t),shouldResizeFromCenter:$r(t),zoom:this.state.zoom.value,scene:this.scene,widthAspectRatio:l,originOffset:this.state.originSnapOffset,informMutation:n}),this.setState({newElement:a}),(this.state.activeTool.type===es.frame||this.state.activeTool.type===es.magicframe)&&this.setState({elementsToHighlight:Ws(this.scene.getNonDeletedElements(),a,this.state,this.scene.getNonDeletedElementsMap())})}),z(this,`maybeHandleCrop`,(e,t)=>{if(!this.state.croppingElementId)return!1;let n=e.resize.handleType,r=e.lastCoords,[i,a]=kn(r.x-e.resize.offset.x,r.y-e.resize.offset.y,t[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(n&&o&&Ce(o)){let s=e.originalElements.get(o.id),c=Xn(o)&&this.imageCache.get(o.fileId)?.image;if(s&&Ce(s)&&c&&!(c instanceof Promise)){let[l,u]=kn(r.x,r.y,t[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),d={x:l-e.originInGrid.x,y:u-e.originInGrid.y};this.maybeCacheReferenceSnapPoints(t,[o]);let{snapOffset:f,snapLines:p}=mM([o],[s],this,t,d,n);this.scene.mutateElement(o,gi(o,this.scene.getNonDeletedElementsMap(),n,c.naturalWidth,c.naturalHeight,i+f.x,a+f.y,t.shiftKey?s.width/s.height:void 0)),Rs(o,this.scene),this.setState({isCropping:n&&n!==`rotation`,snapLines:p})}return!0}return!1}),z(this,`maybeHandleResize`,(e,t)=>{let n=this.scene.getSelectedElements(this.state),r=n.filter(N),i=e.resize.handleType;if(r.length>0&&i===`rotation`||n.length===1&&Ti(n[0])||this.state.croppingElementId)return!1;this.setState({isResizing:i&&i!==`rotation`,isRotating:i===`rotation`,activeEmbeddable:null});let a=e.lastCoords,[o,s]=kn(a.x-e.resize.offset.x,a.y-e.resize.offset.y,t[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),c=new Map;if(r.forEach(e=>{D(this.scene.getNonDeletedElements(),e.id).forEach(t=>{c.set(e.id+t.id,{x:t.x-e.x,y:t.y-e.y})})}),!this.state.selectedElementsAreBeingDragged){let[r,c]=kn(a.x,a.y,t[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),l={x:r-e.originInGrid.x,y:c-e.originInGrid.y},u=[...e.originalElements.values()];this.maybeCacheReferenceSnapPoints(t,n);let{snapOffset:d,snapLines:f}=mM(n,An(u,this.state),this,t,l,i);o+=d.x,s+=d.y,this.setState({snapLines:f})}if(Vr(e.originalElements,i,n,this.scene,Wr(t),$r(t),n.some(e=>Ce(e))?!O(t):O(t),o,s,e.resize.center.x,e.resize.center.y)){let e=new Set;return r.forEach(t=>{Ws(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()).forEach(t=>{ko(t)?e.add(t):console.error(`[NONDELETED][INVARIANT] Skipped highlighting deleted element in resizing frame`)})}),this.setState({elementsToHighlight:[...e]}),!0}return!1}),z(this,`getContextMenuItems`,e=>{let t=[];if(t.push(RE,LE),e===`canvas`)return this.state.viewModeEnabled?[...t,BE,VE,Ok,GE]:[FE,sP,RE,LE,zE,sP,eC,hD,sP,BE,HE,UE,WE,VE,Ok,GE];if(t.push(zE),this.state.viewModeEnabled)return[PE,...t];let n=this.editorInterface.formFactor===`desktop`?[sP,XS,ZS,QS,$S]:[];return[sP,IE,PE,FE,sP,Mj,Nj,Pj,sP,Aj,sP,...t,sP,fE,pE,sP,_E,Hj,KE,qE,XE,vE,sP,TE,...n,sP,AE,jE,sP,Oj,sP,fD,qD,sP,tC,mD,sP,YS]}),z(this,`handleWheel`,oc(e=>{if(!(e.target instanceof HTMLCanvasElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLIFrameElement||e.target instanceof HTMLElement&&e.target.classList.contains(sa.FRAME_NAME))){e[M.CTRL_OR_CMD]&&e.preventDefault();return}if(e.preventDefault(),uB)return;let{deltaX:t,deltaY:n}=e;if(e.metaKey||e.ctrlKey){if(Lr(this.state))return;let e=Math.sign(n),t=Jo*100,r=Math.abs(n),i=n;r>t&&(i=t*e);let a=this.state.zoom.value-i/100;a+=Math.log10(Math.max(1,this.state.zoom.value))*-e*Math.min(1,r/20);let o=this.state.scrollConstraints?.lockZoom?this.state.scrollConstraints.zoom:dc;a=Math.max(a,o),this.translateCanvas(e=>({...Lw({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:it(a)},e),shouldCacheIgnoreZoom:!0})),this.resetShouldCacheIgnoreZoomDebounced();return}if(e.shiftKey){this.translateCanvas(({zoom:e,scrollX:r})=>({scrollX:r-(n||t)/e.value}));return}this.translateCanvas(({zoom:e,scrollX:r,scrollY:i})=>({scrollX:r-t/e.value,scrollY:i-n/e.value}))})),z(this,`savePointer`,(e,t,n)=>{if(!e||!t)return;let{x:r,y:i}=Ka({clientX:e,clientY:t},this.state),a={x:r,y:i,tool:this.state.activeTool.type===`laser`?`laser`:`pointer`};this.props.onPointerUpdate?.({pointer:a,button:n,pointersMap:SB.pointers})}),z(this,`resetShouldCacheIgnoreZoomDebounced`,ln(()=>{this.unmounted||this.setState({shouldCacheIgnoreZoom:!1})},300)),z(this,`updateDOMRect`,e=>{if(this.excalidrawContainerRef?.current){let{width:t,height:n,left:r,top:i}=this.excalidrawContainerRef.current.getBoundingClientRect(),{width:a,height:o,offsetTop:s,offsetLeft:c}=this.state;if(t===a&&n===o&&r===c&&i===s){e&&e();return}this.setState({width:t,height:n,offsetLeft:r,offsetTop:i},()=>{e&&e()}),this.constrainViewportToScrollConstraints()}}),z(this,`refresh`,()=>{this.setState({...this.getCanvasOffsets()})}),z(this,`watchState`,()=>{});let n=zt(),{viewModeEnabled:r=!1,zenModeEnabled:i=!1,gridModeEnabled:o=!1,objectsSnapModeEnabled:s=!1,theme:c=n.theme,name:l=`${G(`labels.untitled`)}-${jo()}`}=t;this.state={...n,theme:c,exportWithDarkMode:c===F.DARK,isLoading:!0,...this.getCanvasOffsets(),viewModeEnabled:r,zenModeEnabled:i,objectsSnapModeEnabled:s,gridModeEnabled:o??n.gridModeEnabled,name:l,width:window.innerWidth,height:window.innerHeight},this.refreshEditorInterface(),this.stylesPanelMode=Fi(this.editorInterface),this.id=Pe(),this.library=new mO(this),this.actionManager=new Wj(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.scene=new jt,this.canvas=document.createElement(`canvas`),this.rc=Po.canvas(this.canvas),this.renderer=new vM(this.scene),this.visibleElements=[],this.store=new Oe(this),this.history=new Lj(this.store),this.excalidrawContainerValue={container:this.excalidrawContainerRef.current,id:this.id},this.fonts=new Ve(this.scene),this.history=new Lj(this.store),this.actionManager.registerAll(KS),this.actionManager.registerAction(Bj(this.history)),this.actionManager.registerAction(Vj(this.history)),this.api=this.createExcalidrawAPI()}createExcalidrawAPI(){return{isDestroyed:!1,updateScene:this.updateScene,applyDeltas:this.applyDeltas,mutateElement:this.mutateElement,updateLibrary:this.library.updateLibrary,addFiles:this.addFiles,resetScene:this.resetScene,getSceneElementsIncludingDeleted:this.getSceneElementsIncludingDeleted,getSceneElementsMapIncludingDeleted:this.getSceneElementsMapIncludingDeleted,history:{clear:this.resetHistory},setViewport:this.setViewport,getViewportOffsets:this.getViewportOffsets,getSceneElements:this.getSceneElements,getAppState:()=>this.state,getFiles:()=>this.files,getName:this.getName,registerAction:e=>{this.actionManager.registerAction(e)},refresh:this.refresh,setToast:this.setToast,id:this.id,setActiveTool:this.setActiveTool,setCursor:this.setCursor,resetCursor:this.resetCursor,getEditorInterface:()=>this.editorInterface,updateFrameRendering:this.updateFrameRendering,toggleSidebar:this.toggleSidebar,onChange:e=>this.onChangeEmitter.on(e),onIncrement:e=>this.store.onStoreIncrementEmitter.on(e),onPointerDown:e=>this.onPointerDownEmitter.on(e),onPointerUp:e=>this.onPointerUpEmitter.on(e),onScrollChange:e=>this.onScrollChangeEmitter.on(e),onUserFollow:e=>this.onUserFollowEmitter.on(e),onStateChange:this.onStateChange,onEvent:this.onEvent}}onWindowMessage(e){if(e.origin!==`https://player.vimeo.com`&&e.origin!==`https://www.youtube.com`)return;let t=null;try{t=JSON.parse(e.data)}catch{}if(t)switch(e.origin){case`https://player.vimeo.com`:if(t.method===`paused`){let n=null,r=document.body.querySelectorAll(`iframe.excalidraw__embeddable`);if(!r)break;for(let t of r)t.contentWindow===e.source&&(n=t.contentWindow);n?.postMessage(JSON.stringify({method:t.value?`play`:`pause`,value:!0}),`*`)}break;case`https://www.youtube.com`:if(t.event===`infoDelivery`&&t.info&&t.id&&typeof t.info.playerState==`number`){let e=t.id,n=t.info.playerState;Object.values(to).includes(n)&&hB.set(e,n)}break}}handleSkipBindMode(){if(this.state.selectedLinearElement?.initialState&&!this.state.selectedLinearElement.initialState.arrowStartIsInside){pe(this.lastPointerMoveCoords,`Missing last pointer move coords when changing bind skip mode for arrow start`);let e=this.scene.getNonDeletedElementsMap(),t=Xs(a(this.lastPointerMoveCoords.x,this.lastPointerMoveCoords.y),this.scene.getNonDeletedElements(),e),n=I.getElement(this.state.selectedLinearElement.elementId,e);n?.startBinding&&t?.id===n.startBinding.elementId&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,arrowStartIsInside:!0}}})}if(this.state.bindMode===`orbit`&&(this.bindModeHandler&&=(clearTimeout(this.bindModeHandler),null),(0,Sc.flushSync)(()=>{this.setState({bindMode:`skip`})}),this.lastPointerMoveCoords&&this.state.selectedLinearElement?.selectedPointsIndices&&this.state.selectedLinearElement?.selectedPointsIndices.length)){let{x:e,y:t}=this.lastPointerMoveCoords,n=this.lastPointerMoveEvent??this.lastPointerDownEvent?.nativeEvent;pe(n,`Last event must exist`);let r=e-this.state.selectedLinearElement.pointerOffset.x,i=t-this.state.selectedLinearElement.pointerOffset.y,a=this.state.multiElement?I.handlePointerMove(n,this,r,i,this.state.selectedLinearElement):I.handlePointDragging(n,this,r,i,this.state.selectedLinearElement);a&&this.setState(a)}}resetDelayedBindMode(){this.bindModeHandler&&=(clearTimeout(this.bindModeHandler),null),this.state.bindMode!==`orbit`&&setTimeout(()=>this.setState({bindMode:`orbit`}))}handleDelayedBindModeChange(e,t){if(e.isDeleted||Ti(e))return;let n=()=>{if(this.bindModeHandler=null,pe(this.lastPointerMoveCoords,`Expected lastPointerMoveCoords to be set`),!this.state.multiElement){if(!this.state.selectedLinearElement||!this.state.selectedLinearElement.selectedPointsIndices||!this.state.selectedLinearElement.selectedPointsIndices.length)return;let t=this.state.selectedLinearElement.selectedPointsIndices.includes(0),n=this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length-1);if(!t&&!n||t&&n)return}let{x:t,y:n}=this.lastPointerMoveCoords,r=Xs(a(t,n),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(r&&this.state.bindMode!==`skip`){pe(this.state.selectedLinearElement?.elementId===e.id,`The selectedLinearElement is expected to not change while a bind mode timeout is ticking`);let i=this.state.selectedLinearElement.initialState.arrowStartIsInside||e.startBinding?.elementId===r.id;(0,Sc.flushSync)(()=>{pe(this.state.selectedLinearElement,`this.state.selectedLinearElement must exist`),this.setState({bindMode:`inside`,selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,arrowStartIsInside:i}}})});let a=this.lastPointerMoveEvent??this.lastPointerDownEvent?.nativeEvent;pe(a,`Last event must exist`);let o=t-this.state.selectedLinearElement.pointerOffset.x,s=n-this.state.selectedLinearElement.pointerOffset.y,c=this.state.multiElement?I.handlePointerMove(a,this,o,s,this.state.selectedLinearElement):I.handlePointDragging(a,this,o,s,this.state.selectedLinearElement);c&&this.setState(c)}},r=!1;if(this.state.selectedLinearElement?.selectedPointsIndices){let n=this.scene.getNonDeletedElementsMap(),i=this.state.selectedLinearElement.selectedPointsIndices.includes(0),a=this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length-1),o=i?t:e.startBinding&&n.get(e.startBinding.elementId),s=a?t:e.endBinding&&n.get(e.endBinding.elementId),c=o&&un(o,n),l=s&&un(s,n);r=!!(c&&l&&o.id!==s.id&&is(c,l))}let i=this.state.selectedLinearElement?.selectedPointsIndices?.includes(0),o=this.state.selectedLinearElement?.selectedPointsIndices?.includes(e.points.length-1),s=i?`startBinding`:o?`endBinding`:null,c=i?`endBinding`:o?`startBinding`:null,l=c&&e[c]?.mode===`inside`&&e[c]?.elementId===t?.id||s&&e[s]?.mode===`inside`&&t?.id===e[s]?.elementId;s&&c&&e[s]?.mode===`inside`&&t?.id!==e[s]?.elementId&&e[c]?.elementId!==e[s]?.elementId&&this.scene.mutateElement(e,{[s]:{...e[s],mode:`orbit`}},{informMutation:!1,isDragging:!0}),!t||this.previousHoveredBindableElement&&t.id!==this.previousHoveredBindableElement.id?(this.bindModeHandler&&=(clearTimeout(this.bindModeHandler),null),this.state.bindMode===`inside`&&(0,Sc.flushSync)(()=>{this.setState({bindMode:`orbit`})}),this.previousHoveredBindableElement=null):!this.bindModeHandler&&(!this.state.newElement||!e.startBinding||r)&&!l&&(this.bindModeHandler=setTimeout(n,700)),this.previousHoveredBindableElement=t}cacheEmbeddableRef(e,t){t&&this.iFrameRefs.set(e.id,t)}getHTMLIFrameElement(e){return this.iFrameRefs.get(e.id)}handleIframeLikeCenterClick(){if(!this.lastPointerDownEvent||!this.lastPointerUpEvent||this.lastPointerDownEvent.button!==qi.MAIN||lB||!go(this.state.activeTool.type,[`laser`,`selection`,`lasso`]))return!1;let e=a(Ka({clientX:this.lastPointerDownEvent.clientX,clientY:this.lastPointerDownEvent.clientY},this.state)),t=a(Ka({clientX:this.lastPointerUpEvent.clientX,clientY:this.lastPointerUpEvent.clientY},this.state));if(hn(e,t)>10)return!1;let n=this.getElementAtPosition(e[0],e[1]);if(!(n&&this.lastPointerUpEvent.timeStamp-this.lastPointerDownEvent.timeStamp<=300&&SB.pointers.size<2&&Si(n)&&(this.state.viewModeEnabled||this.state.activeTool.type===`laser`||this.isIframeLikeElementCenter(n,this.lastPointerUpEvent,t[0],t[1]))))return!1;let r=n;if(this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state===`active`||(setTimeout(()=>{this.setState({activeEmbeddable:{element:r,state:`active`},selectedElementIds:{[r.id]:!0},newElement:null,selectionElement:null})},100),ji(r)))return!0;let i=this.getHTMLIFrameElement(r);if(!i?.contentWindow)return!0;if(i.src.includes(`youtube`)){let e=hB.get(r.id);switch(e||(hB.set(r.id,to.UNSTARTED),i.contentWindow.postMessage(JSON.stringify({event:`listening`,id:r.id}),`*`)),e){case to.PLAYING:case to.BUFFERING:i.contentWindow?.postMessage(JSON.stringify({event:`command`,func:`pauseVideo`,args:``}),`*`);break;default:i.contentWindow?.postMessage(JSON.stringify({event:`command`,func:`playVideo`,args:``}),`*`)}}return i.src.includes(`player.vimeo.com`)&&i.contentWindow.postMessage(JSON.stringify({method:`paused`}),`*`),!0}isIframeLikeElementCenter(e,t,n,r){return e&&!t.altKey&&!t.shiftKey&&!t.metaKey&&!t.ctrlKey&&(this.state.activeEmbeddable?.element!==e||this.state.activeEmbeddable?.state===`hover`||!this.state.activeEmbeddable)&&n>=e.x+e.width/3&&n<=e.x+2*e.width/3&&r>=e.y+e.height/3&&r<=e.y+2*e.height/3}renderEmbeddables(){let e=this.state.zoom.value,t=this.state.width,n=this.state.height;return(0,V.jsx)(V.Fragment,{children:this.scene.getNonDeletedElements().filter(e=>rc(e)&&this.embedsValidationStatus.get(e.id)===!0||ji(e)).map(r=>{let{x:i,y:a}=Qi({sceneX:r.x,sceneY:r.y},this.state),o=Oa(r,t,n,this.state,this.scene.getNonDeletedElementsMap()),s=this.initializedEmbeds.has(r.id);if(o&&!s&&this.initializedEmbeds.add(r.id),!(o||s))return null;let c;if(ji(r)){c=null;let e=(r.customData?.generationData??this.magicGenerations.get(r.id))||{status:`error`,message:`No generation data`,code:`ERR_NO_GENERATION_DATA`};if(e.status===`done`){let t=e.html;c={intrinsicSize:{w:r.width,h:r.height},type:`document`,srcdoc:()=>t}}else if(e.status===`pending`)c={intrinsicSize:{w:r.width,h:r.height},type:`document`,srcdoc:()=>Ln(`
83
+ <style>
84
+ html, body {
85
+ width: 100%;
86
+ height: 100%;
87
+ color: ${this.state.theme===F.DARK?`white`:`black`};
88
+ }
89
+ body {
90
+ display: flex;
91
+ align-items: center;
92
+ justify-content: center;
93
+ flex-direction: column;
94
+ gap: 1rem;
95
+ }
96
+
97
+ .Spinner {
98
+ display: flex;
99
+ align-items: center;
100
+ justify-content: center;
101
+ margin-left: auto;
102
+ margin-right: auto;
103
+ }
104
+
105
+ .Spinner svg {
106
+ animation: rotate 1.6s linear infinite;
107
+ transform-origin: center center;
108
+ width: 40px;
109
+ height: 40px;
110
+ }
111
+
112
+ .Spinner circle {
113
+ stroke: currentColor;
114
+ animation: dash 1.6s linear 0s infinite;
115
+ stroke-linecap: round;
116
+ }
117
+
118
+ @keyframes rotate {
119
+ 100% {
120
+ transform: rotate(360deg);
121
+ }
122
+ }
123
+
124
+ @keyframes dash {
125
+ 0% {
126
+ stroke-dasharray: 1, 300;
127
+ stroke-dashoffset: 0;
128
+ }
129
+ 50% {
130
+ stroke-dasharray: 150, 300;
131
+ stroke-dashoffset: -200;
132
+ }
133
+ 100% {
134
+ stroke-dasharray: 1, 300;
135
+ stroke-dashoffset: -280;
136
+ }
137
+ }
138
+ </style>
139
+ <div class="Spinner">
140
+ <svg
141
+ viewBox="0 0 100 100"
142
+ >
143
+ <circle
144
+ cx="50"
145
+ cy="50"
146
+ r="46"
147
+ stroke-width="8"
148
+ fill="none"
149
+ stroke-miter-limit="10"
150
+ />
151
+ </svg>
152
+ </div>
153
+ <div>Generating...</div>
154
+ `)};else{let t;t=e.code===`ERR_GENERATION_INTERRUPTED`?`Generation was interrupted...`:e.message||`Generation failed`,c={intrinsicSize:{w:r.width,h:r.height},type:`document`,srcdoc:()=>Ln(`
155
+ <style>
156
+ html, body {
157
+ height: 100%;
158
+ }
159
+ body {
160
+ display: flex;
161
+ flex-direction: column;
162
+ align-items: center;
163
+ justify-content: center;
164
+ color: ${Vs.red[3]};
165
+ }
166
+ h1, h3 {
167
+ margin-top: 0;
168
+ margin-bottom: 0.5rem;
169
+ }
170
+ </style>
171
+ <h1>Error!</h1>
172
+ <h3>${t}</h3>
173
+ `)}}}else c=fr(uo(r.link||``));let l=this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state===`active`,u=this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state===`hover`,d=Fe(c?.type===`video`?e:1,.75,gB);return(0,V.jsx)(`div`,{className:H(`excalidraw__embeddable-container`,{"is-hovered":u}),style:{transform:o?`translate(${i-this.state.offsetLeft}px, ${a-this.state.offsetTop}px) scale(${e})`:`none`,display:o?`block`:`none`,opacity:Ys(r,Cn(r,this.scene.getNonDeletedElementsMap()),this.elementsPendingErasure,null,this.state.openDialog?.name===`elementLinkSelector`?_i:1),"--embeddable-radius":`${v(Math.min(r.width,r.height),r)}px`},children:(0,V.jsxs)(`div`,{className:`excalidraw__embeddable-container__inner`,style:{width:o?`${r.width}px`:0,height:o?`${r.height}px`:0,transform:o?`rotate(${r.angle}rad)`:`none`,pointerEvents:l?ba.enabled:ba.disabled},children:[u&&(0,V.jsx)(`div`,{className:`excalidraw__embeddable-hint`,children:G(`buttons.embeddableInteractionButton`)}),(0,V.jsx)(`div`,{className:`excalidraw__embeddable__outer`,style:{padding:`${r.strokeWidth}px`},children:(0,V.jsx)(`div`,{className:`excalidraw__embeddable__content`,style:{width:`${d*100}%`,height:`${d*100}%`,transform:`scale(${1/d})`},children:(rc(r)?this.props.renderEmbeddable?.(r,this.state):null)??(0,V.jsx)(`iframe`,{ref:e=>this.cacheEmbeddableRef(r,e),className:`excalidraw__embeddable`,srcDoc:c?.type===`document`?c.srcdoc(this.state.theme):void 0,src:c?.type===`document`?void 0:c?.link??``,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:`${c?.sandbox?.allowSameOrigin?`allow-same-origin`:``} allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads`})})})]})},r.id)})})}toggleOverscrollBehavior(e){document.documentElement.style.overscrollBehaviorX=e.type===`pointerenter`?`none`:`auto`}render(){let e=this.scene.getSelectedElements(this.state),{renderTopRightUI:t,renderTopLeftUI:n,renderCustomStats:r}=this.props,{elementsMap:i,visibleElements:a,canvasNonce:o,newElementCanvasElement:s}=this.renderer.getRenderableElements({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,editingTextElement:this.state.editingTextElement,newElement:this.state.newElement,selectedElements:e,selectedElementsAreBeingDragged:this.state.selectedElementsAreBeingDragged,frameToHighlight:this.state.frameToHighlight});this.visibleElements=a,this.hasRenderableElements=i.size>0;let c=this.scene.getNonDeletedElementsMap(),l=`setPointerCapture`in HTMLElement.prototype?!1:this.state.selectionElement||this.state.newElement||this.state.selectedElementsAreBeingDragged||this.state.resizingElement||this.state.activeTool.type===`laser`&&this.state.cursorButton===`down`,u=e[0],d=py.get(wD)?.type===`panel`;return(0,V.jsx)(`div`,{translate:`no`,className:H(`excalidraw excalidraw-container notranslate`,{"excalidraw--view-mode":this.state.viewModeEnabled||this.state.openDialog?.name===`elementLinkSelector`,"excalidraw--mobile":this.editorInterface.formFactor===`phone`}),style:{"--ui-pointerEvents":l?ba.disabled:ba.enabled,"--right-sidebar-width":`${Rz}px`},ref:this.excalidrawContainerRef,onDrop:this.handleAppOnDrop,tabIndex:0,onKeyDown:this.props.handleKeyboardGlobally?void 0:this.onKeyDown,onPointerEnter:this.toggleOverscrollBehavior,onPointerLeave:this.toggleOverscrollBehavior,children:(0,V.jsx)(Jz.Provider,{value:this.api,children:(0,V.jsx)(Iz.Provider,{value:this,children:(0,V.jsx)(Lz.Provider,{value:this.props,children:(0,V.jsx)(Uz.Provider,{value:this.excalidrawContainerValue,children:(0,V.jsx)(Vz.Provider,{value:this.editorInterface,children:(0,V.jsx)(Kz.Provider,{value:this.setAppState,children:(0,V.jsx)(Gz.Provider,{value:this.state,children:(0,V.jsxs)(Wz.Provider,{value:this.scene.getNonDeletedElements(),children:[(0,V.jsxs)(qz.Provider,{value:this.actionManager,children:[(0,V.jsx)(FR,{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,langCode:Sy().code,renderTopLeftUI:n,renderTopRightUI:t,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===this.state.preferredSelectionTool.type&&!this.state.zenModeEnabled&&!this.scene.getElementsIncludingDeleted().length,app:this,isCollaborating:this.props.isCollaborating,generateLinkForSelection:this.props.generateLinkForSelection,children:this.props.children}),(0,V.jsx)(`div`,{className:`excalidraw-textEditorContainer`}),(0,V.jsx)(`div`,{className:`excalidraw-contextMenuContainer`}),(0,V.jsx)(`div`,{className:`excalidraw-eye-dropper-container`}),(0,V.jsx)(LR,{trails:[this.laserTrails,this.lassoTrail,this.eraserTrail]}),(0,V.jsx)(Nz,{}),e.length===1&&this.state.openDialog?.name!==`elementLinkSelector`&&this.state.showHyperlinkPopup&&(0,V.jsx)(iD,{element:u,scene:this.scene,setAppState:this.setAppState,onLinkOpen:this.props.onLinkOpen,setToast:this.setToast,updateEmbedValidationStatus:this.updateEmbedValidationStatus},u.id),this.props.aiEnabled!==!1&&e.length===1&&Ns(u)&&(0,V.jsx)(xM,{element:u,elementsMap:i,children:(0,V.jsx)(IR,{title:G(`labels.convertToCode`),icon:iS,checked:!1,onChange:()=>this.onMagicFrameGenerate(u,`button`)})}),e.length===1&&ji(u)&&u.customData?.generationData?.status===`done`&&(0,V.jsxs)(xM,{element:u,elementsMap:i,children:[(0,V.jsx)(IR,{title:G(`labels.copySource`),icon:Gx,checked:!1,onChange:()=>this.onIframeSrcCopy(u)}),(0,V.jsx)(IR,{title:`Enter fullscreen`,icon:aS,checked:!1,onChange:()=>{let e=this.getHTMLIFrameElement(u);if(e)try{e.requestFullscreen(),this.setState({activeEmbeddable:{element:u,state:`active`},selectedElementIds:{[u.id]:!0},newElement:null,selectionElement:null})}catch(e){console.warn(e),this.setState({errorMessage:`Couldn't enter fullscreen`})}}})]}),this.state.contextMenu&&(0,V.jsx)(cP,{items:this.state.contextMenu.items,top:this.state.contextMenu.top,left:this.state.contextMenu.left,actionManager:this.actionManager,onClose:e=>{this.setState({contextMenu:null},()=>{this.focusContainer(),e?.()})}}),(0,V.jsx)(xz,{canvas:this.canvas,rc:this.rc,elementsMap:i,allElementsMap:c,visibleElements:a,canvasNonce:o,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:$j(this),canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure,pendingFlowchartNodes:this.flowchart.pendingNodes,theme:this.state.theme}}),s&&(0,V.jsx)(Tz,{appState:this.state,newElement:s,scale:window.devicePixelRatio,rc:this.rc,elementsMap:i,allElementsMap:c,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:!1,canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure,pendingFlowchartNodes:null,theme:this.state.theme}}),(0,V.jsx)(vz,{app:this,containerRef:this.excalidrawContainerRef,canvas:this.interactiveCanvas,elementsMap:i,visibleElements:a,allElementsMap:c,selectedElements:e,canvasNonce:o,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderScrollbars:this.props.renderScrollbars===!0,editorInterface:this.editorInterface,renderInteractiveSceneCallback:this.renderInteractiveSceneCallback,handleCanvasRef:this.handleInteractiveCanvasRef,onContextMenu:this.handleCanvasContextMenu,onClick:this.handleCanvasClick,onPointerMove:this.handleCanvasPointerMove,onPointerUp:this.handleCanvasPointerUp,onPointerCancel:this.removePointer,onTouchMove:this.handleTouchMove,onPointerDown:this.handleCanvasPointerDown,onDoubleClick:this.handleCanvasDoubleClick}),this.state.userToFollow&&(0,V.jsx)(lP,{width:this.state.width,height:this.state.height,userToFollow:this.state.userToFollow,onDisconnect:this.maybeUnfollowRemoteUser}),this.renderFrameNames(),this.state.activeLockedId&&(0,V.jsx)(Fz,{app:this,activeLockedId:this.state.activeLockedId}),d&&(0,V.jsx)(GD,{app:this})]}),this.renderEmbeddables()]})})})})})})})})})}setPlugins(e){Object.assign(this.plugins,e)}async onMagicFrameGenerate(e,t){let n=this.plugins.diagramToCode?.generate;if(!n){this.setState({errorMessage:`No diagram to code plugin found`});return}let r=zo(this.scene.getNonDeletedElements(),e,this.scene.getNonDeletedElementsMap()).filter(e=>!Ns(e));if(!r.length){t===`button`?(this.setState({errorMessage:`Cannot generate from an empty frame`}),rC(`ai`,`generate (no-children)`,`d2c`)):this.setActiveTool({type:`magicframe`});return}let i=this.insertIframeElement({sceneX:e.x+e.width+30,sceneY:e.y,width:e.width,height:e.height});if(i){this.updateMagicGeneration({frameElement:i,data:{status:`pending`}}),this.setState({selectedElementIds:{[i.id]:!0}}),rC(`ai`,`generate (start)`,`d2c`);try{let{html:t}=await n({frame:e,children:r});if(rC(`ai`,`generate (success)`,`d2c`),!t.trim()){this.updateMagicGeneration({frameElement:i,data:{status:`error`,code:`ERR_OAI`,message:`Nothing genereated :(`}});return}let a=t.includes(`<!DOCTYPE html>`)&&t.includes(`</html>`)?t.slice(t.indexOf(`<!DOCTYPE html>`),t.indexOf(`</html>`)+7):t;this.updateMagicGeneration({frameElement:i,data:{status:`done`,html:a}})}catch(e){rC(`ai`,`generate (failed)`,`d2c`),this.updateMagicGeneration({frameElement:i,data:{status:`error`,code:`ERR_OAI`,message:e.message||`Unknown error during generation`}})}}}onIframeSrcCopy(e){e.customData?.generationData?.status===`done`&&(qT(e.customData.generationData.html),this.setToast({message:`copied to clipboard`,closable:!1,duration:1500}))}clearImageShapeCache(e){let t=e??this.files;this.scene.getNonDeletedElements().forEach(e=>{Xn(e)&&t[e.fileId]&&(this.imageCache.delete(e.fileId),wt.delete(e))})}async componentDidMount(){this.unmounted=!1,this.api=this.createExcalidrawAPI(),this.excalidrawContainerValue.container=this.excalidrawContainerRef.current,(Xt()||Ms())&&(this.setState.bind(this),Object.defineProperties(window.h,{state:{configurable:!0,get:()=>this.state},setState:{configurable:!0,value:(...e)=>this.setState(...e)},app:{configurable:!0,value:this},history:{configurable:!0,value:this.history},store:{configurable:!0,value:this.store},fonts:{configurable:!0,value:this.fonts}})),this.store.onDurableIncrementEmitter.on(e=>{this.history.record(e.delta)}),this.props.onIncrement&&this.store.onStoreIncrementEmitter.on(e=>{this.props.onIncrement?.(e)}),this.scene.onUpdate(this.triggerRender),this.addEventListeners(),this.props.autoFocus&&this.excalidrawContainerRef.current&&this.focusContainer(),To&&this.excalidrawContainerRef.current&&(this.resizeObserver=new ResizeObserver(()=>{this.refreshEditorInterface(),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),Je()&&!S()&&this.setState({errorMessage:(0,V.jsx)(aP,{})});let e={excalidrawAPI:this.api,container:this.excalidrawContainerRef.current};this.editorLifecycleEvents.emit(`editor:mount`,e),this.props.onMount?.(e),this.props.onExcalidrawAPI?.(this.api)}componentWillUnmount(){this.api={...this.api,isDestroyed:!0};for(let e of Object.keys(this.api))(e.startsWith(`get`)||e===`onStateChange`||e===`onEvent`)&&typeof this.api[e]==`function`&&(this.api[e]=()=>{throw Error("ExcalidrawAPI is no longer usable after the editor has been unmounted and will return invalid/empty data. You should check for `ExcalidrawAPI.isDestroyed` before calling get* methods on subscribing to state/event changes.")});this.editorLifecycleEvents.emit(`editor:unmount`),this.props.onUnmount?.(),this.props.onExcalidrawAPI?.(null),window.launchQueue?.setConsumer(()=>{}),this.renderer.destroy(),this.scene.destroy(),this.scene=new jt,this.fonts=new Ve(this.scene),this.renderer=new vM(this.scene),this.files={},this.imageCache.clear(),this.resizeObserver?.disconnect(),this.unmounted=!0,this.removeEventListeners(),this.library.destroy(),this.laserTrails.stop(),this.eraserTrail.stop(),this.onChangeEmitter.clear(),this.store.onStoreIncrementEmitter.clear(),this.store.onDurableIncrementEmitter.clear(),this.appStateObserver.clear(),this.editorLifecycleEvents.clear(),wt.destroy(),Qj.destroy(),clearTimeout(pB),ha.clearCache(),tr.clearCache(),pB=0,document.documentElement.style.overscrollBehaviorX=``}removeEventListeners(){this.onRemoveEventListenersEmitter.trigger()}addEventListeners(){this.removeEventListeners(),this.props.handleKeyboardGlobally&&this.onRemoveEventListenersEmitter.once(Hi(document,L.KEYDOWN,this.onKeyDown,!1)),this.onRemoveEventListenersEmitter.once(Hi(this.excalidrawContainerRef.current,L.WHEEL,this.handleWheel,{passive:!1}),Hi(window,L.MESSAGE,this.onWindowMessage,!1),Hi(document,L.POINTER_UP,this.removePointer,{passive:!1}),Hi(document,L.COPY,this.onCopy,{passive:!1}),Hi(document,L.KEYUP,this.onKeyUp,{passive:!0}),Hi(document,L.POINTER_MOVE,this.updateCurrentCursorPosition,{passive:!1}),Hi(document.fonts,`loadingdone`,e=>{let t=e.fontfaces;this.fonts.onLoaded(t)},{passive:!1}),Hi(document,L.GESTURE_START,this.onGestureStart,!1),Hi(document,L.GESTURE_CHANGE,this.onGestureChange,!1),Hi(document,L.GESTURE_END,this.onGestureEnd,!1),Hi(window,L.FOCUS,()=>{this.maybeCleanupAfterMissingPointerUp(null),this.triggerRender(!0)},{passive:!1})),!this.state.viewModeEnabled&&(this.onRemoveEventListenersEmitter.once(Hi(document,L.FULLSCREENCHANGE,this.onFullscreenChange,{passive:!1}),Hi(document,L.PASTE,this.pasteFromClipboard,{passive:!1}),Hi(document,L.CUT,this.onCut,{passive:!1}),Hi(window,L.RESIZE,this.onResize,!1),Hi(window,L.UNLOAD,this.onUnload,!1),Hi(window,L.BLUR,this.onBlur,!1),Hi(this.excalidrawContainerRef.current,L.WHEEL,this.handleWheel,{passive:!1}),Hi(this.excalidrawContainerRef.current,L.DRAG_OVER,this.disableEvent,!1),Hi(this.excalidrawContainerRef.current,L.DROP,this.disableEvent,!1)),this.props.detectScroll&&this.onRemoveEventListenersEmitter.once(Hi(ut(this.excalidrawContainerRef.current),L.SCROLL,this.onScroll,{passive:!1})))}componentDidUpdate(e,t){!this._initialized&&!this.state.isLoading&&(this._initialized=!0,this.editorLifecycleEvents.emit(`editor:initialize`,this.api),this.props.onInitialize?.(this.api)),this.appStateObserver.flush(t),this.updateEmbeddables();let n=this.scene.getElementsIncludingDeleted(),r=this.scene.getElementsMapIncludingDeleted(),i=(this.sessionExportThemeOverride??this.state.theme)===F.DARK;this.state.exportWithDarkMode!==i&&this.setState({exportWithDarkMode:i}),!this.state.showWelcomeScreen&&!n.length&&this.setState({showWelcomeScreen:!0}),t.userToFollow&&!this.state.collaborators.has(t.userToFollow.socketId)&&this.maybeUnfollowRemoteUser(),(t.zoom.value!==this.state.zoom.value||t.scrollX!==this.state.scrollX||t.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)),t.userToFollow!==this.state.userToFollow&&(t.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:t.userToFollow,action:`UNFOLLOW`}),this.state.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:this.state.userToFollow,action:`FOLLOW`})),Object.keys(this.state.selectedElementIds).length&&f(this.state)&&this.setState({activeTool:kr(this.state,{type:`selection`})}),this.state.activeTool.type===`eraser`&&t.theme!==this.state.theme&&Qw(this.interactiveCanvas,this.state.theme),t.activeTool.type===`selection`&&this.state.activeTool.type!==`selection`&&this.state.showHyperlinkPopup&&this.setState({showHyperlinkPopup:!1}),e.langCode!==this.props.langCode&&this.updateLanguage(),f(t)&&!f(this.state)&&this.eraserTrail.endPath(),e.viewModeEnabled!==this.props.viewModeEnabled&&this.setState({viewModeEnabled:!!this.props.viewModeEnabled}),t.viewModeEnabled!==this.state.viewModeEnabled&&(this.addEventListeners(),this.deselectElements()),(t.openDialog?.name===`elementLinkSelector`||this.state.openDialog?.name===`elementLinkSelector`)&&t.openDialog?.name!==this.state.openDialog?.name&&(this.deselectElements(),this.setState({hoveredElementIds:{}})),e.zenModeEnabled!==this.props.zenModeEnabled&&this.setState({zenModeEnabled:!!this.props.zenModeEnabled}),e.theme!==this.props.theme&&this.props.theme&&this.setState({theme:this.props.theme}),this.excalidrawContainerRef.current?.classList.toggle(`theme--dark`,this.state.theme===F.DARK),this.state.selectedLinearElement?.isEditing&&!this.state.selectedElementIds[this.state.selectedLinearElement.elementId]&&setTimeout(()=>{this.state.selectedLinearElement?.isEditing&&this.actionManager.executeAction(xT)}),this.state.editingTextElement?.isDeleted&&this.setState({editingTextElement:null});let a=this.state.editingTextElement||Xe.running(`animateScrollToContent`)?!1:!this.visibleElements.length&&this.hasRenderableElements;this.state.scrolledOutside!==a&&this.setState({scrolledOutside:a}),this.store.commit(r,this.state),this.state.isLoading||(this.props.onChange?.(n,this.state,this.files),this.onChangeEmitter.trigger(n,this.state,this.files))}static resetTapTwice(){oB=!1,cB=null}async insertClipboardContent(e,t,r){let{x:i,y:a}=Ka({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state);if(e.errorMessage){this.setState({errorMessage:e.errorMessage});return}if(t.length===0&&!r&&e.mixedContent){await this.addElementsFromMixedContentPaste(e.mixedContent,{isPlainPaste:r,sceneX:i,sceneY:a});return}if(!r&&e.text){let t=tP(e.text);if(t.ok){this.setState({openDialog:{name:`charts`,data:t.data,rawText:e.text}});return}}let o=t.map(e=>e.file);if(o.length===0&&e.text&&!r){let t=e.text.trim();t.startsWith(`<svg`)&&t.endsWith(`</svg>`)&&o.push(Di(t))}if(o.length>0){this.isToolSupported(`image`)?await this.insertImages(o,i,a):this.setState({errorMessage:G(`errors.imageToolNotSupported`)});return}if(e.elements){let t=e.programmaticAPI?mc(e.elements):e.elements;this.addElementsFromPasteOrLibrary({elements:t,files:e.files||null,position:this.editorInterface.formFactor===`desktop`?`cursor`:`center`,retainSeed:r,preserveFrameChildrenOrder:!0});return}if(!e.text)return;if(!r&&UM(e.text)){let t=await n(()=>import(`./excalidraw-mermaid-stub-DE5FTiZB.js`),__vite__mapDeps([70,71]),import.meta.url);try{let{elements:n,files:r={}}=await t.parseMermaidToExcalidraw(e.text),i=mc(n,{regenerateIds:!0});this.addElementsFromPasteOrLibrary({elements:i,files:r,position:this.editorInterface.formFactor===`desktop`?`cursor`:`center`});return}catch(e){console.warn(`parsing pasted text as mermaid definition failed: ${e.message}`)}}let s=oi(e.text).split(/\n+/).map(e=>e.trim()).filter(Boolean),c=s.map(e=>Fa(e)).filter(e=>Ao(e,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)||fr(e)?.type===`video`));if(!r&&c.length>0&&c.length===s.length){let e=[];for(let t of c){let n=e[e.length-1],r=this.insertEmbeddableElement({sceneX:n?n.x+n.width+20:i,sceneY:a,link:je(t)});r&&e.push(r)}e.length&&(this.store.scheduleCapture(),this.setState({selectedElementIds:Object.fromEntries(e.map(e=>[e.id,!0]))}));return}this.addTextFromPaste(e.text,r)}async addElementsFromMixedContentPaste(e,{isPlainPaste:t,sceneX:n,sceneY:r}){if(!t&&e.some(e=>e.type===`imageUrl`)&&this.isToolSupported(`image`)){let t=e.filter(e=>e.type===`imageUrl`).map(e=>e.value),i=await Promise.all(t.map(async e=>{try{return{file:await Ps(e)}}catch(e){let t=e.message;return e.cause===`FETCH_ERROR`?t=G(`errors.failedToFetchImage`):e.cause===`UNSUPPORTED`&&(t=G(`errors.unsupportedFileType`)),{errorMessage:t}}})),a=i.filter(e=>!!e.file).map(e=>e.file);await this.insertImages(a,n,r);let o=i.find(e=>!!e.errorMessage);o&&o.errorMessage&&this.setState({errorMessage:o.errorMessage})}else{let n=e.filter(e=>e.type===`text`);n.length&&this.addTextFromPaste(n.map(e=>e.value).join(`
174
+
175
+ `),t)}}addTextFromPaste(e,t=!1){let{x:n,y:r}=Ka({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state),i={x:n,y:r,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.getCurrentItemStrokeWidth(`text`),strokeStyle:this.state.currentItemStrokeStyle,roundness:null,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:e,fontSize:this.state.currentItemFontSize,fontFamily:this.state.currentItemFontFamily,textAlign:Ot,verticalAlign:`top`,locked:!1},a=Ho({fontSize:i.fontSize,fontFamily:i.fontFamily}),o=mo(i.fontFamily),[s,,c]=gt(this.state),l=Math.max(Math.min((c-s)*.5,800),200),u=r,d=t?[e]:e.split(`
176
+ `),f=d.reduce((e,t,r)=>{let s=de(t).trim();if(s.length){let t=this.getTopLayerFrameAtSceneCoords({x:n,y:u}),r=Ja(s,a,o),c=r.width>l,d=c?Pn(s,a,l):s;r=c?Ja(d,a,o):r;let f=n-r.width/2,p=u-r.height/2,m=Br({...i,x:f,y:p,text:d,originalText:s,lineHeight:o,autoResize:!c,frameId:t?t.id:null});e.push(m),u+=m.height+10}else d[r-1]?.trim()&&(u+=Ba(i.fontSize,o)+10);return e},[]);f.length!==0&&(this.insertNewElements(f),this.store.scheduleCapture(),this.setState({selectedElementIds:Ji(Object.fromEntries(f.map(e=>[e.id,!0])),this.state)}),!t&&f.length>1&&bB===!1&&this.editorInterface.formFactor!==`phone`&&(this.setToast({message:G(`toast.pasteAsSingleElement`,{shortcut:Z(`CtrlOrCmd+Shift+V`)}),duration:5e3}),bB=!0))}handleTextWysiwyg(e,{isExistingElement:t=!1,initialCaretSceneCoords:n=null}){let r=this.scene.getElementsMapIncludingDeleted(),i=(t,n)=>{this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map(i=>i.id===e.id&&R(i)?j(i,{originalText:t,isDeleted:n??i.isDeleted,...Mn(i,rt(i,r),r,t)}):i)])};LM({canvas:this.canvas,getViewportCoords:(e,t)=>{let{x:n,y:r}=Qi({sceneX:e,sceneY:t},this.state);return[n-this.state.offsetLeft,r-this.state.offsetTop]},onChange:oc(t=>{i(t,!1),ko(e)&&Rs(e,this.scene)}),onSubmit:oc(({viaKeyboard:n,nextOriginalText:r})=>{let a=!r.trim();i(r,a);let o=n?e.containerId||(a?null:e.id):null;o&&(0,Sc.flushSync)(()=>{this.setState(e=>({selectedElementIds:Ji({...e.selectedElementIds,[o]:!0},e)}))}),a&&Zt(this.scene.getNonDeletedElements(),[e]),(!a||t)&&this.store.scheduleCapture(),(0,Sc.flushSync)(()=>{this.setState({newElement:null,editingTextElement:null})}),this.state.activeTool.locked&&$w(this.interactiveCanvas,this.state),this.focusContainer()}),element:e,excalidrawContainer:this.excalidrawContainerRef.current,app:this,initialCaretSceneCoords:n,autoSelect:!this.editorInterface.isTouchScreen}),this.deselectElements(),i(e.originalText,!1)}deselectElements(){this.setState({selectedElementIds:Ji({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}getSelectedTextElement(e){let t=this.scene.getSelectedElements(this.state);if(t.length!==1)return null;let n=t[0];return R(n)?n:e?So(n,this.scene.getNonDeletedElementsMap()):null}getSelectedTextEditingContainerAtPosition(e,t){let n=this.scene.getSelectedElements(this.state);if(n.length!==1||!e||e.id!==n[0].id)return null;let r=n[0];if(R(r))return null;if(!Bs(r))return;let i=this.getSelectedTextElement(r),a=this.getTextElementAtPosition(t.x,t.y);if(!(!i||a?.id!==i.id))return r}getTextElementAtPosition(e,t){let n=this.getElementAtPosition(e,t,{includeBoundTextElement:!0});return n&&R(n)&&!n.isDeleted?n:null}getElementAtPosition(e,t,n){let r=[];if(r=n&&`allHitElements`in n?n?.allHitElements||[]:this.getElementsAtPosition(e,t,{includeBoundTextElement:n?.includeBoundTextElement,includeLockedElements:n?.includeLockedElements}),r.length>1){if(n?.preferSelected){for(let e=r.length-1;e>-1;e--)if(this.state.selectedElementIds[r[e].id])return r[e]}let i=r[r.length-1];return Le({point:a(e,t),element:i,threshold:this.getElementHitThreshold(i)/2,elementsMap:this.scene.getNonDeletedElementsMap(),frameNameBound:N(i)?this.frameNameBoundsCache.get(i):null})?i:r[r.length-2]}return r.length===1?r[0]:null}getElementsAtPosition(e,t,n){let r=[],i=this.scene.getNonDeletedElementsMap();return(n?.includeBoundTextElement&&n?.includeLockedElements?this.scene.getNonDeletedElements():this.scene.getNonDeletedElements().filter(e=>(n?.includeLockedElements||!e.locked)&&(n?.includeBoundTextElement||!(R(e)&&e.containerId)))).filter(n=>this.hitElement(e,t,n)).filter(n=>{let r=Cn(n,i);return r&&!ko(r)&&console.error(`[NONDELETED][INVARIANT] Containing frame is deleted`),r&&this.state.frameRendering.enabled&&this.state.frameRendering.clip?qa({x:e,y:t},r,i):!0}).filter(e=>ji(e)?(r.push(e),!1):!0).concat(r)}getElementHitThreshold(e){return Math.max(e.strokeWidth/2+.1,.85*(Ni/this.state.zoom.value))}hitElement(e,t,n,r=!0){return r&&this.state.selectedElementIds[n.id]&&Ur([n],this.state,this.editorInterface)&&lo(a(e,t),n,this.scene.getNonDeletedElementsMap(),this.getElementHitThreshold(n))||Ga(a(e,t),n,this.scene.getNonDeletedElementsMap())?!0:Le({point:a(e,t),element:n,threshold:this.getElementHitThreshold(n),elementsMap:this.scene.getNonDeletedElementsMap(),frameNameBound:N(n)?this.frameNameBoundsCache.get(n):null})}getTextBindableContainerAtPosition(e,t){let n=this.scene.getNonDeletedElements(),r=this.scene.getSelectedElements(this.state);if(r.length===1)return bi(r[0],!1)?r[0]:null;let i=null;for(let r=n.length-1;r>=0;--r){if(n[r].isDeleted)continue;let[o,s,c,l]=Zi(n[r],this.scene.getNonDeletedElementsMap());if(Mr(n[r])&&Le({point:a(e,t),element:n[r],elementsMap:this.scene.getNonDeletedElementsMap(),threshold:this.getElementHitThreshold(n[r])})){i=n[r];break}else if(o<e&&e<c&&s<t&&t<l){if(N(n[r]))continue;i=n[r];break}}return bi(i,!1)?i:null}handleHoverSelectedLinearElement(e,t,n){let r=this.scene.getNonDeletedElementsMap(),i=I.getElement(e.elementId,r);if(i)if(this.state.selectedLinearElement){let o=-1,s=null;Le({point:a(t,n),element:i,elementsMap:r,threshold:this.getElementHitThreshold(i)})?(o=I.getPointIndexUnderCursor(i,r,this.state.zoom,t,n),s=I.getSegmentMidpointHitCoords(e,{x:t,y:n},this.state,this.scene.getNonDeletedElementsMap()),(Ti(i)?o===0||o===i.points.length-1:o>=0)||s?Yw(this.interactiveCanvas,Ri.POINTER):this.hitElement(t,n,i)&&(!Ti(i)||!(i.startBinding||i.endBinding))&&(this.state.activeTool.type!==`lasso`||Object.keys(this.state.selectedElementIds).length>0)&&Yw(this.interactiveCanvas,Ri.MOVE)):this.hitElement(t,n,i)&&(!Ti(i)||!(i.startBinding||i.endBinding))&&(this.state.activeTool.type!==`lasso`||Object.keys(this.state.selectedElementIds).length>0)&&Yw(this.interactiveCanvas,Ri.MOVE),this.state.selectedLinearElement.hoverPointIndex!==o&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,hoverPointIndex:o}}),I.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords,s)||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,segmentMidPointHoveredCoords:s}});let c=null,l=i;(l.startBinding||l.endBinding)&&(c=le(i,t,n,this.scene,this.state)),this.state.selectedLinearElement.hoveredFocusPointBinding!==c&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!1,hoveredFocusPointBinding:c}}),c&&Yw(this.interactiveCanvas,Ri.POINTER)}else Yw(this.interactiveCanvas,Ri.AUTO)}updateGestureOnPointerDown(e){SB.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),SB.pointers.size===2&&(SB.lastCenter=Gj(SB.pointers),SB.initialScale=this.state.zoom.value,SB.initialDistance=Kj(Array.from(SB.pointers.values())))}initialPointerDownState(e){let t=Ka(e,this.state),n=this.scene.getSelectedElements(this.state),[r,i,a,o]=He(n),s=n.findIndex(Ti)===0;return{origin:t,withCmdOrCtrl:e[M.CTRL_OR_CMD],originInGrid:he(kn(t.x,t.y,e[M.CTRL_OR_CMD]||s?null:this.getEffectiveGridSize())),scrollbars:HM(fB,e.clientX-this.state.offsetLeft,e.clientY-this.state.offsetTop),lastCoords:{...t},originalElements:this.scene.getNonDeletedElements().reduce((e,t)=>(e.set(t.id,cr(t)),e),new Map),resize:{handleType:!1,isResizing:!1,offset:{x:0,y:0},arrowDirection:`origin`,center:{x:(a+r)/2,y:(o+i)/2}},hit:{element:null,allHitElements:[],wasAddedToSelection:!1,hasBeenDuplicated:!1,hasHitCommonBoundingBoxOfSelectedElements:this.isHittingCommonBoundingBoxOfSelectedElements(t,n)},drag:{hasOccurred:!1,offset:null,origin:{...t},blockDragging:!1},eventListeners:{onMove:null,onUp:null,onKeyUp:null,onKeyDown:null},boxSelection:{hasOccurred:!1}}}handleDraggingScrollBar(e,t){if(!(t.scrollbars.isOverEither&&!this.state.multiElement))return!1;dB=!0,t.lastCoords.x=e.clientX,t.lastCoords.y=e.clientY;let n=jn(e=>{e.target instanceof HTMLElement&&this.handlePointerMoveOverScrollbars(e,t)}),r=oc(()=>{xB=null,dB=!1,$w(this.interactiveCanvas,this.state),this.setState({cursorButton:`up`}),this.savePointer(e.clientX,e.clientY,`up`),window.removeEventListener(L.POINTER_MOVE,n),window.removeEventListener(L.POINTER_UP,r),n.flush()});return xB=r,window.addEventListener(L.POINTER_MOVE,n),window.addEventListener(L.POINTER_UP,r),!0}isASelectedElement(e){return e!=null&&this.state.selectedElementIds[e.id]}isHittingCommonBoundingBoxOfSelectedElements(e,t){if(t.length<2)return!1;let n=Math.max(Ni/this.state.zoom.value,1),r=4/this.state.zoom.value,[i,a,o,s]=He(t);return e.x>i-r-n&&e.x<o+r+n&&e.y>a-r-n&&e.y<s+r+n}getCurrentItemRoundness(e){return this.state.currentItemRoundness===`round`?{type:jr(e)?Go.ADAPTIVE_RADIUS:Go.PROPORTIONAL_RADIUS}:null}getCurrentItemStrokeWidth(e){return ga(e,this.state.currentItemStrokeWidthKey)}maybeCacheReferenceSnapPoints(e,t,n=!1){eM({event:e,app:this,selectedElements:t})&&(n||!Qj.getReferenceSnapPoints())&&Qj.setReferenceSnapPoints(oM(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()))}maybeCacheVisibleGaps(e,t,n=!1){eM({event:e,app:this,selectedElements:t})&&(n||!Qj.getVisibleGaps())&&Qj.setVisibleGaps(iM(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()))}onKeyDownFromPointerDownHandler(e){return oc(t=>{this.maybeHandleResize(e,t)||this.maybeDragNewGenericElement(e,t)})}onKeyUpFromPointerDownHandler(e){return oc(t=>{t.key===M.ALT&&t.preventDefault(),!this.maybeHandleResize(e,t)&&this.maybeDragNewGenericElement(e,t)})}onPointerMoveFromPointerDownHandler(e){return jn(t=>{if(this.state.openDialog?.name===`elementLinkSelector`)return;let n=Ka(t,this.state);if(this.state.activeLockedId&&this.setState({activeLockedId:null}),this.state.selectedLinearElement&&this.state.selectedLinearElement.elbowed&&this.state.selectedLinearElement.initialState.segmentMidpoint.index){let[e,r]=kn(n.x,n.y,t[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i=this.state.selectedLinearElement.initialState.segmentMidpoint.index;if(i<0){let t=I.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:e,y:r},this.state,this.scene.getNonDeletedElementsMap());i=t?I.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,t,this.scene.getNonDeletedElementsMap()):-1}let a=I.moveFixedSegment(this.state.selectedLinearElement,i,e,r,this.scene);this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!0,segmentMidPointHoveredCoords:a.segmentMidPointHoveredCoords,initialState:a.initialState}});return}let r=this.previousPointerMoveCoords??e.origin;if(this.previousPointerMoveCoords=n,e.drag.offset===null&&(e.drag.offset=he(ns(this.scene.getSelectedElements(this.state),e.origin.x,e.origin.y))),!(t.target instanceof HTMLElement)||this.handlePointerMoveOverScrollbars(t,e))return;if(f(this.state)){this.handleEraser(t,n);return}this.state.activeTool.type===`laser`&&this.laserTrails.addPointToPath(n.x,n.y);let[i,o]=kn(n.x,n.y,t[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize());if(e.resize.isResizing&&(e.lastCoords.x=n.x,e.lastCoords.y=n.y,this.maybeHandleCrop(e,t)||this.maybeHandleResize(e,t)))return!0;let s=this.scene.getNonDeletedElementsMap();if(this.state.selectedLinearElement){let r=this.state.selectedLinearElement;if(r.draggedFocusPointBinding){vi(r,s,n,this.scene,this.state,this.getEffectiveGridSize(),t.altKey),this.setState({selectedLinearElement:{...r,isDragging:!1,selectedPointsIndices:[],initialState:{...r.initialState,lastClickedPoint:-1}}});return}if(I.shouldAddMidpoint(this.state.selectedLinearElement,n,this.state,s)){let e=I.addMidpoint(this.state.selectedLinearElement,n,this,!t[M.CTRL_OR_CMD],this.scene);if(!e)return;(0,Sc.flushSync)(()=>{this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:e.pointerDownState,selectedPointsIndices:e.selectedPointsIndices,segmentMidPointHoveredCoords:null}})});return}else{if(r.initialState.segmentMidpoint.value!==null&&!r.initialState.segmentMidpoint.added)return;if(r.initialState.lastClickedPoint>-1){let i=I.getElement(r.elementId,s);if(i?.isDeleted)return;if(pa(i)){let e=Xs(a(n.x,n.y),this.scene.getNonDeletedElements(),s);Cr(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(i,e)}if(t.altKey&&!this.state.selectedLinearElement?.initialState?.arrowStartIsInside&&Cr(`COMPLEX_BINDINGS`)&&this.handleSkipBindMode(),r.initialState.lastClickedPoint===-1)return;let o=I.handlePointDragging(t,this,n.x,n.y,r);if(o){e.lastCoords.x=n.x,e.lastCoords.y=n.y,e.drag.hasOccurred=!0,(o.suggestedBinding!==this.state.suggestedBinding||!Jr(o.selectedLinearElement?.selectedPointsIndices??[],this.state.selectedLinearElement?.selectedPointsIndices??[])||o.selectedLinearElement?.hoverPointIndex!==this.state.selectedLinearElement?.hoverPointIndex||o.selectedLinearElement?.customLineAngle!==this.state.selectedLinearElement?.customLineAngle||this.state.selectedLinearElement.isDragging!==o.selectedLinearElement?.isDragging||this.state.selectedLinearElement?.initialState?.altFocusPoint!==o.selectedLinearElement?.initialState?.altFocusPoint)&&this.setState(o);return}}}}let c=e.hit.allHitElements.some(e=>this.isASelectedElement(e)),l=this.state.selectedLinearElement?.isEditing&&t.shiftKey&&this.state.selectedLinearElement.elementId===e.hit.element?.id;if((c||e.hit.hasHitCommonBoundingBoxOfSelectedElements)&&!l&&!e.drag.blockDragging){let i=this.scene.getSelectedElements(this.state);if(i.length>0&&i.every(e=>e.locked))return;let o=i.some(e=>N(e))?null:this.getTopLayerFrameAtSceneCoords(n,{currentFrameId:st(i),excludeElementIds:this.state.selectedElementIds});if(this.updateFrameToHighlight(o),e.drag.hasOccurred=!0,this.state.activeTool.type===`lasso`&&this.lassoTrail.hasCurrentTrail&&!(this.editorInterface.formFactor!==`desktop`&&e.hit.element)&&!this.state.activeTool.fromSelection)return;if(this.state.activeTool.type===`lasso`&&i.length>0&&e.drag.hasOccurred&&!this.state.activeTool.fromSelection&&this.lassoTrail.endPath(),i.length>0&&!e.withCmdOrCtrl&&!this.state.editingTextElement&&this.state.activeEmbeddable?.state!==`active`){let o={x:n.x-e.drag.origin.x,y:n.y-e.drag.origin.y},c=[...e.originalElements.values()],l=t.shiftKey;if(l){let e=Math.abs(o.x),t=Math.abs(o.y),n=l&&e<t,r=l&&e>t;n&&(o.x=0),r&&(o.y=0)}if(this.state.croppingElementId){let t=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(t&&Ce(t)&&t.crop!==null&&e.hit.element===t){let e=t.crop,i=Xn(t)&&this.imageCache.get(t.fileId)?.image;if(i&&!(i instanceof Promise)){let o=nn(t),c=Bi(n.x-r.x,n.y-r.y);c[0]*=i.naturalWidth/o.width,c[1]*=i.naturalHeight/o.height;let[l,u,d,f,p,m]=Zi(t,s),h=mt(ot(a(l,u),a(p,m),t.angle)),g=mt(ot(a(d,u),a(p,m),t.angle)),_=mt(ot(a(l,f),a(p,m),t.angle)),v=Vt(Zn(g,h)),y=Vt(Zn(_,h)),b=Bi(Ct(c,v),Ct(c,y)),x={...e,x:Fe(e.x-b[0]*Math.sign(t.scale[0]),0,i.naturalWidth-e.width),y:Fe(e.y-b[1]*Math.sign(t.scale[1]),0,i.naturalHeight-e.height)};this.scene.mutateElement(t,{crop:x});return}}}this.maybeCacheVisibleGaps(t,i),this.maybeCacheReferenceSnapPoints(t,i);let{snapOffset:u,snapLines:d}=cM(c,o,this,t,this.scene.getNonDeletedElementsMap());if(this.setState({snapLines:d}),this.state.editingFrame||Pt(e,i,o,this.scene,u,t[M.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),this.setState({selectedElementsAreBeingDragged:!0,selectionElement:null}),t.altKey&&!e.hit.hasBeenDuplicated){e.hit.hasBeenDuplicated=!0;let n=this.scene.getElementsIncludingDeleted(),r=e.hit.element,i=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});r&&e.hit.wasAddedToSelection&&!i.find(e=>e.id===r.id)&&i.push(r);let a=new Map(i.map(e=>[e.id,e])),{duplicatedElements:o,duplicateElementsMap:s,elementsWithDuplicates:c,origIdToDuplicateId:l}=w({type:`in-place`,elements:n,appState:this.state,randomizeSeed:!0,idsOfElementsToDuplicate:a,overrides:({duplicateElement:e,origElement:t})=>({frameId:e.frameId??t.frameId,seed:dr()})});o.forEach(t=>{e.originalElements.set(t.id,cr(t))});let u=c.map(t=>{if(a.has(t.id)){let n=e.originalElements.get(t.id);if(n)return j(t,{x:n.x,y:n.y})}return t}),d=this.props.onDuplicate?.(u,n),f=wo(d||u,Pa(o));(0,Sc.flushSync)(()=>{if(e.hit.element){let t=l.get(e.hit.element.id),n=t&&s.get(t);e.hit.element=n||null}e.hit.allHitElements=e.hit.allHitElements.reduce((e,t)=>{let n=l.get(t.id),r=n&&s.get(n);return r&&e.push(r),e},[]),e.drag.origin=Ka(t,this.state),this.setState(e=>({...Mo(o,this.scene.getNonDeletedElements(),e)})),this.scene.replaceAllElements(f),i.forEach(e=>{sn(e)&&e.boundElements?.some(e=>e.type===`arrow`)&&Rs(e,this.scene)}),this.maybeCacheVisibleGaps(t,i,!0),this.maybeCacheReferenceSnapPoints(t,i,!0)})}return}}if(this.state.selectionElement){if(e.lastCoords.x=n.x,e.lastCoords.y=n.y,t.altKey){this.setActiveTool({type:`lasso`,fromSelection:!0},{keepSelection:t.shiftKey}),this.lassoTrail.startPath(e.origin.x,e.origin.y,t.shiftKey),this.setAppState({selectionElement:null});return}this.maybeDragNewGenericElement(e,t)}else if(this.state.activeTool.type===`lasso`)!t.altKey&&this.state.activeTool.fromSelection?(this.setActiveTool({type:`selection`}),this.createGenericElementOnPointerDown(`selection`,e),e.lastCoords.x=n.x,e.lastCoords.y=n.y,this.maybeDragNewGenericElement(e,t),this.lassoTrail.endPath()):this.lassoTrail.addPointToPath(n.x,n.y,t.shiftKey);else{let r=this.state.newElement;if(!r)return;if(r.type===`freedraw`){let e=r.points,i=n.x-r.x,o=n.y-r.y,s=e.length>0&&e[e.length-1];if(!(s&&s[0]===i&&s[1]===o)){let n=r.simulatePressure?r.pressures:[...r.pressures,t.pressure];this.scene.mutateElement(r,{points:[...e,a(i,o)],pressures:n},{informMutation:!1,isDragging:!1}),this.setState({newElement:r})}}else if(ja(r)&&!r.isDeleted){e.drag.hasOccurred=!0;let n=r.points;pe(n.length>1,`Do not create linear elements with less than 2 points`);let a=this.state.selectedLinearElement;(!a||a.elementId!==r.id)&&(a=new I(r,this.scene.getNonDeletedElementsMap())),a&&(a.initialState.lastClickedPoint<0||a.initialState.lastClickedPoint>=n.length)&&(console.warn(`Last clicked point is out of bounds. Attempting to fix it.`),a={...a,selectedPointsIndices:[n.length-1],initialState:{...a.initialState,prevSelectedPointsIndices:null,lastClickedPoint:n.length-1},hoverPointIndex:n.length-1}),this.setState({newElement:r,...I.handlePointDragging(t,this,i,o,a)})}else e.lastCoords.x=n.x,e.lastCoords.y=n.y,this.maybeDragNewGenericElement(e,t,!1)}if(this.state.activeTool.type===`selection`){e.boxSelection.hasOccurred=!0;let n=this.scene.getNonDeletedElements();if(this.state.selectedLinearElement?.isEditing)I.handleBoxSelection(t,this.state,this.setState.bind(this),this.scene.getNonDeletedElementsMap());else{let r=!0;!t.shiftKey&&ha(n,this.state)&&(e.withCmdOrCtrl&&e.hit.element?this.setState(t=>tr({...t,selectedElementIds:{[e.hit.element.id]:!0}},this.scene.getNonDeletedElements(),t,this)):r=!1);let i=this.state.selectionElement?ii(n,this.state.selectionElement,this.scene.getNonDeletedElementsMap(),!1,this.state.boxSelectionMode):[];this.setState(t=>{let n={...r&&t.selectedElementIds,...i.reduce((e,t)=>(e[t.id]=!0,e),{})};return e.hit.element&&(i.length?delete n[e.hit.element.id]:n[e.hit.element.id]=!0),t=r?t:{...t,selectedGroupIds:{},editingGroupId:null},{...tr({editingGroupId:t.editingGroupId,selectedElementIds:n},this.scene.getNonDeletedElements(),t,this),selectedLinearElement:i.length===1&&ja(i[0])?new I(i[0],this.scene.getNonDeletedElementsMap()):null,showHyperlinkPopup:i.length===1&&(i[0].link||rc(i[0]))?`info`:!1}})}}})}handlePointerMoveOverScrollbars(e,t){if(t.scrollbars.isOverHorizontal){let n=e.clientX,r=n-t.lastCoords.x;return this.translateCanvas({scrollX:this.state.scrollX-r*(fB.horizontal?.deltaMultiplier||1)/this.state.zoom.value}),t.lastCoords.x=n,!0}if(t.scrollbars.isOverVertical){let n=e.clientY,r=n-t.lastCoords.y;return this.translateCanvas({scrollY:this.state.scrollY-r*(fB.vertical?.deltaMultiplier||1)/this.state.zoom.value}),t.lastCoords.y=n,!0}return!1}onPointerUpFromPointerDownHandler(e){return oc(t=>{let n=this.scene.getNonDeletedElementsMap();this.removePointer(t),e.drag.blockDragging=!1,e.eventListeners.onMove&&e.eventListeners.onMove.flush();let{newElement:r,resizingElement:i,croppingElementId:o,multiElement:s,activeTool:c,isResizing:l,isRotating:u,isCropping:d}=this.state;this.setState(e=>({isResizing:!1,isRotating:!1,isCropping:!1,resizingElement:null,selectionElement:null,frameToHighlight:null,elementsToHighlight:null,cursorButton:`up`,snapLines:hi(e.snapLines,[]),originSnapOffset:null})),this.lassoTrail.endPath(),this.previousPointerMoveCoords=null,Qj.setReferenceSnapPoints(null),Qj.setVisibleGaps(null),this.savePointer(t.clientX,t.clientY,`up`);let p=e.hit.allHitElements,m=Ka({clientX:t.clientX,clientY:t.clientY},this.state);if(this.state.activeTool.type===`selection`&&!e.boxSelection.hasOccurred&&!e.resize.isResizing&&!p.some(e=>this.state.selectedElementIds[e.id])){let e=this.getElementAtPosition(m.x,m.y,{includeLockedElements:!0});this.store.scheduleCapture(),e?.locked?this.setState({activeLockedId:e.groupIds.length>0?e.groupIds.at(-1)||``:e.id}):this.setState({activeLockedId:null})}else this.setState({activeLockedId:null});if(Cr(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),this.setState({selectedElementsAreBeingDragged:!1,bindMode:`orbit`}),e.drag.hasOccurred&&e.hit?.element?.id){let t=n.get(e.hit.element.id);sn(t)&&t.boundElements?.filter(e=>e.type===`arrow`).map(e=>n.get(e.id)).filter(e=>Ti(e)).forEach(e=>{e&&this.scene.mutateElement(e,{})})}if(this.state.selectedLinearElement?.isEditing&&!this.state.newElement&&this.state.selectedLinearElement.draggedFocusPointBinding===null)if(!e.boxSelection.hasOccurred&&e.hit?.element?.id!==this.state.selectedLinearElement.elementId&&this.state.selectedLinearElement.draggedFocusPointBinding===null)this.actionManager.executeAction(xT);else{let e=I.handlePointerUp(t,this.state.selectedLinearElement,this.state,this.scene);this.actionManager.executeAction(xT,`ui`,{event:t,sceneCoords:m}),e!==this.state.selectedLinearElement&&this.setState({selectedLinearElement:e,suggestedBinding:null})}else if(this.state.selectedLinearElement){if(this.state.selectedLinearElement.elbowed){let e=I.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());e&&this.scene.mutateElement(e,{})}if(this.state.selectedLinearElement.draggedFocusPointBinding?(xr(this.state.selectedLinearElement,this.scene),this.setState({selectedLinearElement:{...this.state.selectedLinearElement,draggedFocusPointBinding:null}})):e.hit?.element?.id===this.state.selectedLinearElement.elementId?this.state.selectedLinearElement.isDragging&&(this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!1}}),this.actionManager.executeAction(xT,`ui`,{event:t,sceneCoords:m})):this.scene.getSelectedElements(this.state).length>1&&this.setState({selectedLinearElement:null}),this.state.newElement&&this.state.multiElement&&ja(this.state.newElement)&&this.state.selectedLinearElement){let{multiElement:e}=this.state;this.setState({selectedLinearElement:{...this.state.selectedLinearElement,lastCommittedPoint:e.points[e.points.length-1]}})}}if(this.missingPointerEventCleanupEmitter.clear(),window.removeEventListener(L.POINTER_MOVE,e.eventListeners.onMove),window.removeEventListener(L.POINTER_UP,e.eventListeners.onUp),window.removeEventListener(L.KEYDOWN,e.eventListeners.onKeyDown),window.removeEventListener(L.KEYUP,e.eventListeners.onKeyUp),this.props?.onPointerUp?.(c,e),this.onPointerUpEmitter.trigger(this.state.activeTool,e,t),r?.type===`freedraw`){let e=Ka(t,this.state),n=r.points,i=e.x-r.x,o=e.y-r.y;i===n[0][0]&&o===n[0][1]&&(o+=1e-4,i+=1e-4);let s=r.simulatePressure?[]:[...r.pressures,t.pressure];this.scene.mutateElement(r,{points:[...n,a(i,o)],pressures:s}),this.actionManager.executeAction(xT);return}if(ja(r)){let n=Ka(t,this.state),i=hn(a(n.x,n.y),a(e.origin.x,e.origin.y))*this.state.zoom.value;if((!e.drag.hasOccurred||i<20)&&r&&!s)if(this.editorInterface.isTouchScreen){let e=Math.min(this.state.width*.7/this.state.zoom.value,100);this.scene.mutateElement(r,{x:r.x-e/2,points:[a(0,0),a(e,0)]},{informMutation:!1,isDragging:!1}),this.actionManager.executeAction(xT)}else this.setState({multiElement:r,newElement:r});else e.drag.hasOccurred&&!s&&(this.store.scheduleCapture(),ja(r)&&this.actionManager.executeAction(xT,`ui`,{event:t,sceneCoords:m}),this.setState({suggestedBinding:null}),c.locked?this.setState({newElement:null}):(Jw(this.interactiveCanvas),this.setState(e=>({newElement:null,activeTool:kr(this.state,{type:this.state.preferredSelectionTool.type}),selectedElementIds:Ji({...e.selectedElementIds,[r.id]:!0},e),selectedLinearElement:new I(r,this.scene.getNonDeletedElementsMap())}))),this.scene.triggerUpdate());return}if(R(r)){let e=sc(Ho({fontSize:r.fontSize,fontFamily:r.fontFamily}),r.lineHeight);r.width<e&&this.scene.mutateElement(r,{autoResize:!0}),this.resetCursor(),this.handleTextWysiwyg(r,{isExistingElement:!0})}if(c.type!==`selection`&&r&&si(r)){this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(e=>e.id!==r.id),appState:{newElement:null},captureUpdate:P.NEVER});return}if(N(r)){let e=an(this.scene.getElementsIncludingDeleted(),r,this.scene.getNonDeletedElementsMap());this.scene.replaceAllElements(di(this.scene.getElementsMapIncludingDeleted(),e,r))}if(r&&(this.scene.mutateElement(r,Ls(r),{informMutation:!1,isDragging:!1}),this.scene.triggerUpdate()),e.drag.hasOccurred){let e=Ka(t,this.state);if(this.state.selectedLinearElement&&this.state.selectedLinearElement.isDragging){let e=this.scene.getElement(this.state.selectedLinearElement.elementId);if(e?.frameId){let t=Cn(e,n);t&&e&&(Vn(e,t,this.scene.getNonDeletedElementsMap())||(this.scene.mutateElement(e,{groupIds:[]}),mi([e],this.scene.getNonDeletedElementsMap()),this.scene.triggerUpdate()))}}else{let t=this.scene.getSelectedElements(this.state),n=this.getTopLayerFrameAtSceneCoords(e,{currentFrameId:st(t),excludeElementIds:this.state.selectedElementIds}),r=this.scene.getElementsMapIncludingDeleted(),i=e=>{if(e.length>0){for(let t of e){let e=t.groupIds.indexOf(this.state.editingGroupId);this.scene.mutateElement(t,{groupIds:t.groupIds.slice(0,e)},{informMutation:!1,isDragging:!1})}r.forEach(e=>{e.groupIds.length&&Tt(r,e.groupIds[e.groupIds.length-1]).length<2&&this.scene.mutateElement(e,{groupIds:[]},{informMutation:!1,isDragging:!1})}),this.setState({editingGroupId:null})}};if(n&&!this.state.selectedElementIds[n.id]){let e=t.filter(e=>Jn(e,r,this.state));this.state.editingGroupId&&i(e),r=di(r,e,n)}else!n&&this.state.editingGroupId&&i(t.filter(e=>e.frameId&&!Jn(e,r,this.state)));r=$n(r,this.state,this),this.scene.replaceAllElements(r)}}if(i&&this.store.scheduleCapture(),i&&si(i)&&this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(e=>e.id!==i.id),captureUpdate:P.NEVER}),e.resize.isResizing){let e=$n(this.scene.getElementsIncludingDeleted(),this.state,this),t=this.scene.getSelectedElements(this.state).filter(N);for(let r of t)e=po(e,Ws(this.scene.getElementsIncludingDeleted(),r,this.state,n),r);this.scene.replaceAllElements(e)}let h=e.hit.element;this.state.selectedLinearElement?.elementId!==h?.id&&ja(h)&&this.scene.getSelectedElements(this.state).length===1&&this.setState({selectedLinearElement:new I(h,this.scene.getNonDeletedElementsMap())}),(!o||o&&(!h&&!d||h&&h.id!==o))&&this.finishImageCropping();let g=this.lastPointerDownEvent,_=this.lastPointerUpEvent||this.lastPointerMoveEvent;if(f(this.state)&&g&&_){if(this.eraserTrail.endPath(),hn(a(g.clientX,g.clientY),a(_.clientX,_.clientY))===0){let e=Ka({clientX:_.clientX,clientY:_.clientY},this.state);this.getElementsAtPosition(e.x,e.y).forEach(e=>this.elementsPendingErasure.add(e.id))}this.eraseElements();return}else this.elementsPendingErasure.size&&this.restoreReadyToEraseElements();if(h&&!e.drag.hasOccurred&&!e.hit.wasAddedToSelection&&(!this.state.selectedLinearElement?.isEditing||!e.boxSelection.hasOccurred)&&this.state.activeTool.type!==`lasso`&&(t.shiftKey&&!this.state.selectedLinearElement?.isEditing?this.state.selectedElementIds[h.id]?lt(this.state,h)?this.setState(e=>{let t={...e.selectedElementIds};for(let e of h.groupIds.flatMap(e=>Tt(this.scene.getNonDeletedElements(),e)))delete t[e.id];return{selectedGroupIds:{...e.selectedElementIds,...h.groupIds.map(e=>({[e]:!1})).reduce((e,t)=>({...e,...t}),{})},selectedElementIds:Ji(t,e)}}):this.state.selectedLinearElement?.isDragging||this.setState(e=>{let t={...e.selectedElementIds};delete t[h.id];let n=An(this.scene.getNonDeletedElements(),{selectedElementIds:t});return{...tr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),selectedLinearElement:n.length===1&&ja(n[0])?new I(n[0],this.scene.getNonDeletedElementsMap()):e.selectedLinearElement}}):h.frameId&&this.state.selectedElementIds[h.frameId]?this.setState(e=>{let t={...e.selectedElementIds,[h.id]:!0};return delete t[h.frameId],(this.scene.getElement(h.frameId)?.groupIds??[]).flatMap(e=>Tt(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}),{...tr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:h.link||rc(h)?`info`:!1}}):this.setState(e=>({selectedElementIds:Ji({...e.selectedElementIds,[h.id]:!0},e)})):this.setState(e=>({...tr({editingGroupId:e.editingGroupId,selectedElementIds:{[h.id]:!0}},this.scene.getNonDeletedElements(),e,this),selectedLinearElement:ja(h)&&e.selectedLinearElement?.elementId!==h.id?new I(h,this.scene.getNonDeletedElementsMap()):e.selectedLinearElement}))),this.state.activeTool.type!==`lasso`&&!(h&&Ti(h))&&!e.drag.hasOccurred&&!this.state.isResizing&&(h&&ar({point:a(e.origin.x,e.origin.y),element:h,elementsMap:n,threshold:this.getElementHitThreshold(h),frameNameBound:N(h)?this.frameNameBoundsCache.get(h):null},n)||!h&&e.hit.hasHitCommonBoundingBoxOfSelectedElements)){this.state.selectedLinearElement?.isEditing?this.actionManager.executeAction(Oj):this.setState({selectedElementIds:Ji({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),Yw(this.interactiveCanvas,Ri.AUTO);return}let v=this.getSelectedTextEditingContainerAtPosition(h,m);if(c.type===this.state.preferredSelectionTool.type&&!this.state.editingTextElement&&!e.drag.hasOccurred&&!e.hit.wasAddedToSelection&&!t.shiftKey&&!t[M.CTRL_OR_CMD]&&!t.altKey&&t.pointerType!==`touch`&&h&&(R(h)&&this.state.selectedElementIds[h.id]&&this.scene.getSelectedElements(this.state).length===1||v)){this.startTextEditing({sceneX:m.x,sceneY:m.y,container:v,initialCaretSceneCoords:this.lastPointerUpIsDoubleClick?void 0:m});return}if(!c.locked&&c.type!==`freedraw`&&r&&this.setState(e=>({selectedElementIds:Ji({...e.selectedElementIds,[r.id]:!0},e),showHyperlinkPopup:rc(r)&&!r.link?`editor`:e.showHyperlinkPopup})),(c.type!==`selection`||ha(this.scene.getNonDeletedElements(),this.state)||!Jr(this.state.previousSelectedElementIds,this.state.selectedElementIds))&&this.store.scheduleCapture(),(e.drag.hasOccurred&&!this.state.selectedLinearElement||l||u||d)&&ya(this.scene.getSelectedElements(this.state).filter(Mr),this.scene,this.state),c.type===`laser`){this.laserTrails.endPath();return}!c.locked&&c.type!==`freedraw`&&(c.type!==`lasso`||c.type===`lasso`&&c.fromSelection)?(Jw(this.interactiveCanvas),this.setState({newElement:null,suggestedBinding:null,activeTool:kr(this.state,{type:this.state.preferredSelectionTool.type})})):this.setState({newElement:null,suggestedBinding:null})})}clearSelection(e){this.setState(t=>({selectedElementIds:Ji({},t),activeEmbeddable:null,selectedGroupIds:{},editingGroupId:t.editingGroupId&&e!=null&&ua(e,t.editingGroupId)?t.editingGroupId:null})),this.setState({selectedElementIds:Ji({},this.state),activeEmbeddable:null,previousSelectedElementIds:this.state.selectedElementIds,selectedLinearElement:null})}getTextWysiwygSnappedToCenterPosition(e,t,n,r){if(r){let i=r.x+r.width/2,a=r.y+r.height/2,o=Vi(r,n,this.scene.getNonDeletedElementsMap());if(o&&(i=o.x,a=o.y),Math.hypot(e-i,t-a)<30){let{x:e,y:t}=Qi({sceneX:i,sceneY:a},n);return{viewportX:e,viewportY:t,elementCenterX:i,elementCenterY:a}}}}getCanvasOffsets(){if(this.excalidrawContainerRef?.current){let{left:e,top:t}=this.excalidrawContainerRef.current.getBoundingClientRect();return{offsetLeft:e,offsetTop:t}}return{offsetLeft:0,offsetTop:0}}async updateLanguage(){await xy(_y.find(e=>e.code===this.props.langCode)||gy),this.setAppState({})}};(Xt()||Ms())&&(window.h=window.h||{},Object.defineProperties(window.h,{elements:{configurable:!0,get(){return this.app?.scene.getElementsIncludingDeleted()},set(e){return this.app?.scene.replaceAllElements(ur(e))}},scene:{configurable:!0,get(){return this.app?.scene}}}));var wB=CB,TB=e=>{let[t,n]=(0,B.useState)(!0);return(0,B.useEffect)(()=>{let t=async()=>{await xy(r),n(!1)},r=_y.find(t=>t.code===e.langCode)||gy;t()},[e.langCode]),t?(0,V.jsx)(mP,{theme:e.theme}):e.children},EB=({children:e})=>{let{FooterCenterTunnel:t}=dP(),n=cC();return(0,V.jsx)(t.In,{children:(0,V.jsx)(`div`,{className:H(`footer-center zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-bottom":n.zenModeEnabled}),children:e})})};EB.displayName=`FooterCenter`;var DB=({isCollaborating:e,onSelect:t,editorInterface:n,...r})=>{let i=cC(),a=n?.formFactor!==`desktop`||i.width<1440;return(0,V.jsxs)(mk,{...r,className:H(`collab-button`,{active:e}),type:`button`,onSelect:t,style:{position:`relative`,width:a?void 0:`auto`},title:G(`labels.liveCollaboration`),children:[a?kb:G(`labels.share`),i.collaborators.size>0&&(0,V.jsx)(`div`,{className:`CollabButton-collaborators`,children:i.collaborators.size})]})};DB.displayName=`LiveCollaborationTrigger`;var OB=()=>(0,V.jsx)(`svg`,{viewBox:`0 0 40 40`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:`ExcalidrawLogo-icon`,children:(0,V.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`})}),kB=()=>(0,V.jsxs)(`svg`,{viewBox:`0 0 450 55`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,className:`ExcalidrawLogo-text`,children:[(0,V.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,V.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,V.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,V.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)`})]}),AB=({style:e,size:t=`small`,withText:n})=>(0,V.jsxs)(`div`,{className:`ExcalidrawLogo is-${t}`,style:e,children:[(0,V.jsx)(OB,{}),n&&(0,V.jsx)(kB,{})]}),jB=({icon:e,shortcut:t,children:n})=>{let r=Qz();return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`welcome-screen-menu-item__icon`,children:e}),(0,V.jsx)(`div`,{className:`welcome-screen-menu-item__text`,children:n}),t&&r.formFactor!==`phone`&&(0,V.jsx)(`div`,{className:`welcome-screen-menu-item__shortcut`,children:t})]})};jB.displayName=`WelcomeScreenMenuItemContent`;var MB=({onSelect:e,children:t,icon:n,shortcut:r,className:i=``,...a})=>(0,V.jsx)(`button`,{...a,type:`button`,className:`welcome-screen-menu-item ${i}`,onClick:e,children:(0,V.jsx)(jB,{icon:n,shortcut:r,children:t})});MB.displayName=`WelcomeScreenMenuItem`;var NB=({children:e,href:t,icon:n,shortcut:r,className:i=``,...a})=>(0,V.jsx)(`a`,{...a,className:`welcome-screen-menu-item ${i}`,href:t,target:`_blank`,rel:`noopener`,children:(0,V.jsx)(jB,{icon:n,shortcut:r,children:e})});NB.displayName=`WelcomeScreenMenuItemLink`;var PB=({children:e})=>{let{WelcomeScreenCenterTunnel:t}=dP();return(0,V.jsx)(t.In,{children:(0,V.jsx)(`div`,{className:`welcome-screen-center`,children:e||(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(FB,{}),(0,V.jsx)(IB,{children:G(`welcomeScreen.defaults.center_heading`)}),(0,V.jsxs)(LB,{children:[(0,V.jsx)(zB,{}),(0,V.jsx)(RB,{})]})]})})})};PB.displayName=`Center`;var FB=({children:e})=>(0,V.jsx)(`div`,{className:`welcome-screen-center__logo excalifont welcome-screen-decor`,children:e||(0,V.jsx)(AB,{withText:!0})});FB.displayName=`Logo`;var IB=({children:e})=>(0,V.jsx)(`div`,{className:`welcome-screen-center__heading welcome-screen-decor excalifont`,children:e});IB.displayName=`Heading`;var LB=({children:e})=>(0,V.jsx)(`div`,{className:`welcome-screen-menu`,children:e});LB.displayName=`Menu`;var RB=()=>{let e=iB();return(0,V.jsx)(MB,{onSelect:()=>e.executeAction(mE),shortcut:`?`,icon:ub,children:G(`helpDialog.title`)})};RB.displayName=`MenuItemHelp`;var zB=()=>{let e=cC(),t=iB();return e.viewModeEnabled?null:(0,V.jsx)(MB,{onSelect:()=>t.executeAction(lE),shortcut:XD(`loadScene`),icon:bb,children:G(`buttons.load`)})};zB.displayName=`MenuItemLoadScene`;var BB=({onSelect:e})=>{let{t}=Ty();return(0,V.jsx)(MB,{shortcut:null,onSelect:e,icon:Wb,children:t(`labels.liveCollaboration`)})};BB.displayName=`MenuItemLiveCollaborationTrigger`,PB.Logo=FB,PB.Heading=IB,PB.Menu=LB,PB.MenuItem=MB,PB.MenuItemLink=NB,PB.MenuItemHelp=RB,PB.MenuItemLoadScene=zB,PB.MenuItemLiveCollaborationTrigger=BB;var VB=({children:e})=>{let{WelcomeScreenMenuHintTunnel:t}=dP();return(0,V.jsx)(t.In,{children:(0,V.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--menu`,children:[Ry,(0,V.jsx)(`div`,{className:`welcome-screen-decor-hint__label`,children:e||G(`welcomeScreen.defaults.menuHint`)})]})})};VB.displayName=`MenuHint`;var HB=({children:e})=>{let{WelcomeScreenToolbarHintTunnel:t}=dP();return(0,V.jsx)(t.In,{children:(0,V.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--toolbar`,children:[(0,V.jsx)(`div`,{className:`welcome-screen-decor-hint__label`,children:e||G(`welcomeScreen.defaults.toolbarHint`)}),By]})})};HB.displayName=`ToolbarHint`;var UB=({children:e})=>{let{WelcomeScreenHelpHintTunnel:t}=dP();return(0,V.jsx)(t.In,{children:(0,V.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--help`,children:[(0,V.jsx)(`div`,{children:e||G(`welcomeScreen.defaults.helpHint`)}),zy]})})};UB.displayName=`HelpHint`;var WB=e=>(0,V.jsx)(V.Fragment,{children:e.children||(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(PB,{}),(0,V.jsx)(VB,{}),(0,V.jsx)(HB,{}),(0,V.jsx)(UB,{})]})});WB.displayName=`WelcomeScreen`,WB.Center=PB,WB.Hints={MenuHint:VB,ToolbarHint:HB,HelpHint:UB};var GB=()=>{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}),Array.prototype.findLast||Object.defineProperty(Array.prototype,"findLast",{value:function(e,t){return this.slice().reverse().find((n,r)=>e.call(t,n,this.length-r-1,this))},writable:!0,enumerable:!1,configurable:!0}),Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(e,t){for(let n=0;n<this.length;n++)if(e.call(t,this[n],n,this))return n;return-1},writable:!0,enumerable:!1,configurable:!0}),Array.prototype.findLastIndex||Object.defineProperty(Array.prototype,"findLastIndex",{value:function(e,t){let n=this.slice().reverse().findIndex((n,r)=>e.call(t,n,this.length-r-1,this));return n===-1?-1:this.length-n-1},writable:!0,enumerable:!1,configurable:!0}),Array.prototype.toReversed||Object.defineProperty(Array.prototype,"toReversed",{value:function(){return this.slice().reverse()},writable:!0,enumerable:!1,configurable:!0}),Array.prototype.toSorted||Object.defineProperty(Array.prototype,"toSorted",{value:function(e){return this.slice().sort(e)},writable:!0,enumerable:!1,configurable:!0}),Element.prototype.replaceChildren||(Element.prototype.replaceChildren=function(...e){this.innerHTML=``,this.append(...e)})},KB=(e,t,n)=>!!(t&&(t.id===e.editingTextElement?.id||t.id===e.resizingElement?.id||t.id===e.newElement?.id||t.version>n.version||t.version===n.version&&t.versionNonce<=n.versionNonce)),qB=(0,wc.default)((e,t,n)=>{(Ms()||Xt()||window?.DEBUG_FRACTIONAL_INDICES)&&St(ur(e.map(e=>({...e}))),{shouldThrow:Xt()||Ms(),includeBoundTextValidation:!0,reconciliationContext:{localElements:t,remoteElements:n}})},1e3*60,{leading:!0,trailing:!1}),JB=(e,t,n)=>{let r=Pa(e),i=[],a=new Set;for(let e of t)if(!a.has(e.id)){let t=r.get(e.id),o=KB(n,t,e);t&&o?(i.push(t),a.add(t.id)):(i.push(e),a.add(e.id))}for(let t of e)a.has(t.id)||(i.push(t),a.add(t.id));let o=Fs(i);return qB(o,e,t),ur(o),o},YB=({children:e,icon:t})=>{let{t:n}=Ty(),{TTDDialogTriggerTunnel:r}=dP(),i=rB();return(0,V.jsx)(r.In,{children:(0,V.jsx)(Q.Item,{onSelect:()=>{rC(`ai`,`dialog open`,`ttd`),i({openDialog:{name:`ttd`,tab:`text-to-diagram`}})},icon:t??cS,badge:(0,V.jsx)(Q.Item.Badge,{children:`AI`}),children:e??n(`labels.textToDiagram`)})})};YB.displayName=`TTDDialogTrigger`,GB();var XB=B.memo(e=>{let{onExport:t,onChange:r,onThemeChange:i,onIncrement:a,initialData:o,initialState:s,onExcalidrawAPI:c,onMount:l,onUnmount:u,onInitialize:d,isCollaborating:f=!1,onPointerUpdate:p,renderTopLeftUI:m,renderTopRightUI:h,langCode:g=gy.code,viewModeEnabled:_,zenModeEnabled:v,gridModeEnabled:y,libraryReturnUrl:b,theme:x,name:S,renderCustomStats:C,onPaste:w,detectScroll:T=!0,handleKeyboardGlobally:E=!1,onLibraryChange:D,autoFocus:O=!1,generateIdForFile:ee,onLinkOpen:k,generateLinkForSelection:A,onPointerDown:te,onPointerUp:ne,onScrollChange:re,onDuplicate:ie,children:ae,validateEmbeddable:oe,renderEmbeddable:se,aiEnabled:ce,showDeprecatedFonts:le,renderScrollbars:ue,imageOptions:de}=e,fe=e.UIOptions?.canvasActions,pe={...e.UIOptions,canvasActions:{...mn.canvasActions,...fe},tools:{image:e.UIOptions?.tools?.image??!0}};fe?.export&&(pe.canvasActions.export.saveFileToDisk=fe.export?.saveFileToDisk??mn.canvasActions.export.saveFileToDisk),pe.canvasActions.toggleTheme===null&&(x==null||i)&&(pe.canvasActions.toggleTheme=!0);let me={maxFileSizeBytes:de?.maxFileSizeBytes??Ei.maxFileSizeBytes,maxWidthOrHeight:de?.maxWidthOrHeight??Ei.maxWidthOrHeight},he=(0,B.useContext)(Yz),ge=(0,B.useRef)(c);ge.current=c;let _e=(0,B.useCallback)(e=>{he?.(e),ge.current?.(e)},[he]);return(0,B.useEffect)(()=>{(async()=>{await n(()=>import(`./roundRect-D01gJrlt.js`),[],import.meta.url)})();let e=e=>{typeof e.scale==`number`&&e.scale!==1&&e.preventDefault()};return document.addEventListener(`touchmove`,e,{passive:!1}),()=>{document.removeEventListener(`touchmove`,e)}},[]),(0,V.jsx)(fy,{store:py,children:(0,V.jsx)(TB,{langCode:g,theme:x,children:(0,V.jsx)(wB,{onExport:t,onChange:r,onThemeChange:i,onIncrement:a,initialData:o,initialState:s,onExcalidrawAPI:_e,onMount:l,onUnmount:u,onInitialize:d,isCollaborating:f,onPointerUpdate:p,renderTopLeftUI:m,renderTopRightUI:h,langCode:g,viewModeEnabled:_,zenModeEnabled:v,gridModeEnabled:y,libraryReturnUrl:b,theme:x,name:S,renderCustomStats:C,UIOptions:pe,onPaste:w,detectScroll:T,handleKeyboardGlobally:E,onLibraryChange:D,autoFocus:O,generateIdForFile:ee,onLinkOpen:k,generateLinkForSelection:A,onPointerDown:te,onPointerUp:ne,onScrollChange:re,onDuplicate:ie,validateEmbeddable:oe,renderEmbeddable:se,aiEnabled:ce!==!1,showDeprecatedFonts:le,renderScrollbars:ue,imageOptions:me,children:ae})})})},(e,t)=>{if(e.children!==t.children)return!1;let{initialData:n,UIOptions:r={},imageOptions:i,...a}=e,{initialData:o,UIOptions:s={},imageOptions:c,...l}=t,u=Object.keys(r),d=Object.keys(s);if(u.length!==d.length)return!1;let f=u.every(e=>e===`getFormFactor`?!0:e===`canvasActions`?Object.keys(r.canvasActions).every(e=>e===`export`&&r?.canvasActions?.export&&s?.canvasActions?.export?r.canvasActions.export.saveFileToDisk===s.canvasActions.export.saveFileToDisk:r?.canvasActions?.[e]===s?.canvasActions?.[e]):r[e]===s[e]),p=(i?.maxWidthOrHeight??Ei.maxWidthOrHeight)===(c?.maxWidthOrHeight??Ei.maxWidthOrHeight)&&(i?.maxFileSizeBytes??Ei.maxFileSizeBytes)===(c?.maxFileSizeBytes??Ei.maxFileSizeBytes);return f&&p&&Jr(a,l)});XB.displayName=`Excalidraw`;function ZB(e){let t=String(e||``).trim().replace(/\s+/g,` `);return t?t.slice(0,24):null}function QB(){return{type:`excalidraw`,version:2,source:`collabmd`,elements:[],appState:{gridSize:null,viewBackgroundColor:`#ffffff`},files:{}}}function $B(e){return!e||typeof e!=`object`?QB():{type:`excalidraw`,version:2,source:`collabmd`,elements:Array.isArray(e.elements)?e.elements:[],appState:{gridSize:e.appState?.gridSize??null,viewBackgroundColor:e.appState?.viewBackgroundColor??`#ffffff`},files:e.files&&typeof e.files==`object`?e.files:{}}}function eV(e){return tV(e)||QB()}function tV(e){if(!e)return null;try{return $B(JSON.parse(e))}catch{return null}}function nV(e,{theme:t=`dark`}={}){return{elements:e.elements||[],appState:{theme:t,viewBackgroundColor:e.appState?.viewBackgroundColor??`#ffffff`,gridSize:e.appState?.gridSize??null},files:e.files||{}}}function rV(e,t,n){return $B({elements:Array.isArray(e)?e:[],appState:{gridSize:t?.gridSize??null,viewBackgroundColor:t?.viewBackgroundColor??`#ffffff`},files:n||{}})}export{eV as a,XB as c,ZB as i,rO as l,QB as n,nV as o,$B as r,tV as s,rV as t,JB as u};