@excalidraw/excalidraw 0.17.1-7500-ac247a0 → 0.17.1-a38e82f

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 (251) hide show
  1. package/CHANGELOG.md +52 -2
  2. package/dist/browser/dev/excalidraw-assets-dev/chunk-5VWQDKDR.js +20279 -0
  3. package/dist/browser/dev/excalidraw-assets-dev/chunk-5VWQDKDR.js.map +7 -0
  4. package/dist/browser/dev/excalidraw-assets-dev/{chunk-2W5GQUR4.js → chunk-IM4WTX2M.js} +12 -6
  5. package/dist/browser/dev/excalidraw-assets-dev/chunk-IM4WTX2M.js.map +7 -0
  6. package/dist/browser/dev/excalidraw-assets-dev/{en-OC6JWP3X.js → en-IOBA4CS2.js} +4 -2
  7. package/dist/browser/dev/excalidraw-assets-dev/image-LK4UNFRZ.css +6 -0
  8. package/dist/browser/dev/excalidraw-assets-dev/image-LK4UNFRZ.css.map +7 -0
  9. package/dist/browser/dev/excalidraw-assets-dev/{image-5TVMINCA.js → image-VKDAL6BQ.js} +2 -4
  10. package/dist/browser/dev/excalidraw-assets-dev/roundRect-T5BX56ZF.js +161 -0
  11. package/dist/browser/dev/excalidraw-assets-dev/roundRect-T5BX56ZF.js.map +7 -0
  12. package/dist/browser/dev/index.css +189 -129
  13. package/dist/browser/dev/index.css.map +3 -3
  14. package/dist/browser/dev/index.js +34708 -37
  15. package/dist/browser/dev/index.js.map +4 -4
  16. package/dist/browser/prod/excalidraw-assets/chunk-LIG3S5TN.js +11 -0
  17. package/dist/browser/prod/excalidraw-assets/chunk-N2C5DK3B.js +55 -0
  18. package/dist/browser/prod/excalidraw-assets/en-WFZVQ7I6.js +1 -0
  19. package/dist/browser/prod/excalidraw-assets/image-4AT7LYMR.js +1 -0
  20. package/dist/browser/prod/excalidraw-assets/image-X66R2EM5.css +1 -0
  21. package/dist/browser/prod/excalidraw-assets/roundRect-2ACQK4DA.js +1 -0
  22. package/dist/browser/prod/index.css +1 -1
  23. package/dist/browser/prod/index.js +203 -1
  24. package/dist/{prod/en-RLIAOBCI.json → dev/en-TDNWCAOT.json} +9 -5
  25. package/dist/dev/index.css +189 -129
  26. package/dist/dev/index.css.map +3 -3
  27. package/dist/dev/index.js +39078 -40080
  28. package/dist/dev/index.js.map +4 -4
  29. package/dist/excalidraw/actions/actionAddToLibrary.d.ts +15 -15
  30. package/dist/excalidraw/actions/actionAlign.d.ts +6 -6
  31. package/dist/excalidraw/actions/actionAlign.js +2 -1
  32. package/dist/excalidraw/actions/actionBoundText.d.ts +10 -10
  33. package/dist/excalidraw/actions/actionBoundText.js +8 -8
  34. package/dist/excalidraw/actions/actionCanvas.d.ts +58 -58
  35. package/dist/excalidraw/actions/actionClipboard.d.ts +34 -34
  36. package/dist/excalidraw/actions/actionClipboard.js +9 -2
  37. package/dist/excalidraw/actions/actionDeleteSelected.d.ts +15 -15
  38. package/dist/excalidraw/actions/actionDeleteSelected.js +3 -2
  39. package/dist/excalidraw/actions/actionDistribute.d.ts +2 -2
  40. package/dist/excalidraw/actions/actionDistribute.js +1 -1
  41. package/dist/excalidraw/actions/actionDuplicateSelection.d.ts +1 -1
  42. package/dist/excalidraw/actions/actionDuplicateSelection.js +4 -3
  43. package/dist/excalidraw/actions/actionElementLock.d.ts +10 -10
  44. package/dist/excalidraw/actions/actionExport.d.ts +43 -43
  45. package/dist/excalidraw/actions/actionExport.js +4 -4
  46. package/dist/excalidraw/actions/actionFinalize.d.ts +9 -9
  47. package/dist/excalidraw/actions/actionFinalize.js +7 -6
  48. package/dist/excalidraw/actions/actionFlip.d.ts +2 -2
  49. package/dist/excalidraw/actions/actionFlip.js +11 -11
  50. package/dist/excalidraw/actions/actionFrame.d.ts +16 -16
  51. package/dist/excalidraw/actions/actionFrame.js +1 -1
  52. package/dist/excalidraw/actions/actionGroup.d.ts +10 -10
  53. package/dist/excalidraw/actions/actionGroup.js +3 -2
  54. package/dist/excalidraw/actions/actionLinearEditor.d.ts +5 -5
  55. package/dist/excalidraw/actions/actionLinearEditor.js +1 -1
  56. package/dist/excalidraw/{element/Hyperlink.d.ts → actions/actionLink.d.ts} +29 -51
  57. package/dist/excalidraw/actions/actionLink.js +40 -0
  58. package/dist/excalidraw/actions/actionMenu.d.ts +13 -13
  59. package/dist/excalidraw/actions/actionNavigate.d.ts +10 -10
  60. package/dist/excalidraw/actions/actionNavigate.js +1 -1
  61. package/dist/excalidraw/actions/actionProperties.d.ts +77 -77
  62. package/dist/excalidraw/actions/actionProperties.js +32 -27
  63. package/dist/excalidraw/actions/actionSelectAll.d.ts +5 -5
  64. package/dist/excalidraw/actions/actionSelectAll.js +1 -1
  65. package/dist/excalidraw/actions/actionStyles.d.ts +7 -7
  66. package/dist/excalidraw/actions/actionStyles.js +4 -4
  67. package/dist/excalidraw/actions/actionToggleGridMode.d.ts +5 -5
  68. package/dist/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +5 -5
  69. package/dist/excalidraw/actions/actionToggleStats.d.ts +5 -5
  70. package/dist/excalidraw/actions/actionToggleViewMode.d.ts +5 -5
  71. package/dist/excalidraw/actions/actionToggleZenMode.d.ts +5 -5
  72. package/dist/excalidraw/actions/index.d.ts +1 -1
  73. package/dist/excalidraw/actions/index.js +1 -1
  74. package/dist/excalidraw/actions/manager.js +2 -1
  75. package/dist/excalidraw/align.d.ts +2 -2
  76. package/dist/excalidraw/align.js +2 -2
  77. package/dist/excalidraw/animated-trail.d.ts +33 -0
  78. package/dist/excalidraw/animated-trail.js +96 -0
  79. package/dist/excalidraw/animation-frame-handler.d.ts +16 -0
  80. package/dist/excalidraw/animation-frame-handler.js +55 -0
  81. package/dist/excalidraw/appState.d.ts +1 -1
  82. package/dist/excalidraw/appState.js +1 -3
  83. package/dist/excalidraw/clipboard.js +5 -5
  84. package/dist/excalidraw/components/Actions.d.ts +3 -3
  85. package/dist/excalidraw/components/Actions.js +18 -7
  86. package/dist/excalidraw/components/App.d.ts +23 -16
  87. package/dist/excalidraw/components/App.js +387 -272
  88. package/dist/excalidraw/components/Button.d.ts +1 -1
  89. package/dist/excalidraw/components/FilledButton.d.ts +2 -2
  90. package/dist/excalidraw/components/FilledButton.js +27 -3
  91. package/dist/excalidraw/components/FollowMode/FollowMode.js +1 -1
  92. package/dist/excalidraw/components/ImageExportDialog.d.ts +2 -1
  93. package/dist/excalidraw/components/ImageExportDialog.js +17 -13
  94. package/dist/excalidraw/components/JSONExportDialog.js +1 -1
  95. package/dist/excalidraw/components/{LaserTool/LaserPointerButton.d.ts → LaserPointerButton.d.ts} +1 -1
  96. package/dist/excalidraw/components/{LaserTool/LaserPointerButton.js → LaserPointerButton.js} +2 -2
  97. package/dist/excalidraw/components/LayerUI.js +3 -3
  98. package/dist/excalidraw/components/MobileMenu.js +1 -1
  99. package/dist/excalidraw/components/ProjectName.d.ts +0 -1
  100. package/dist/excalidraw/components/ProjectName.js +1 -1
  101. package/dist/excalidraw/components/PublishLibrary.js +1 -1
  102. package/dist/excalidraw/components/SVGLayer.d.ts +8 -0
  103. package/dist/excalidraw/components/SVGLayer.js +20 -0
  104. package/dist/excalidraw/components/ShareableLinkDialog.js +10 -10
  105. package/dist/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
  106. package/dist/excalidraw/components/Stack.d.ts +2 -2
  107. package/dist/excalidraw/components/TTDDialog/common.js +10 -1
  108. package/dist/excalidraw/components/TextField.d.ts +5 -2
  109. package/dist/excalidraw/components/TextField.js +6 -3
  110. package/dist/excalidraw/components/Toast.d.ts +3 -2
  111. package/dist/excalidraw/components/Toast.js +2 -2
  112. package/dist/excalidraw/components/ToolButton.js +2 -1
  113. package/dist/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -2
  114. package/dist/excalidraw/components/canvases/InteractiveCanvas.js +6 -5
  115. package/dist/excalidraw/components/canvases/StaticCanvas.d.ts +4 -3
  116. package/dist/excalidraw/components/canvases/StaticCanvas.js +7 -5
  117. package/dist/excalidraw/components/dropdownMenu/DropdownMenuContent.js +22 -2
  118. package/dist/excalidraw/components/hyperlink/Hyperlink.d.ts +19 -0
  119. package/dist/excalidraw/{element → components/hyperlink}/Hyperlink.js +40 -115
  120. package/dist/excalidraw/components/hyperlink/helpers.d.ts +7 -0
  121. package/dist/excalidraw/components/hyperlink/helpers.js +49 -0
  122. package/dist/excalidraw/components/icons.d.ts +2 -1
  123. package/dist/excalidraw/components/icons.js +2 -1
  124. package/dist/excalidraw/components/live-collaboration/LiveCollaborationTrigger.js +3 -2
  125. package/dist/excalidraw/components/main-menu/DefaultItems.js +5 -2
  126. package/dist/excalidraw/constants.d.ts +6 -0
  127. package/dist/excalidraw/constants.js +6 -0
  128. package/dist/excalidraw/data/blob.js +13 -14
  129. package/dist/excalidraw/data/filesystem.d.ts +1 -1
  130. package/dist/excalidraw/data/index.d.ts +2 -1
  131. package/dist/excalidraw/data/index.js +20 -16
  132. package/dist/excalidraw/data/json.d.ts +1 -1
  133. package/dist/excalidraw/data/json.js +5 -3
  134. package/dist/excalidraw/data/resave.d.ts +1 -1
  135. package/dist/excalidraw/data/resave.js +2 -2
  136. package/dist/excalidraw/data/restore.js +8 -13
  137. package/dist/excalidraw/data/transform.js +13 -9
  138. package/dist/excalidraw/distribute.d.ts +2 -2
  139. package/dist/excalidraw/distribute.js +2 -2
  140. package/dist/excalidraw/element/ElementCanvasButtons.d.ts +3 -2
  141. package/dist/excalidraw/element/ElementCanvasButtons.js +4 -4
  142. package/dist/excalidraw/element/binding.d.ts +9 -9
  143. package/dist/excalidraw/element/binding.js +61 -59
  144. package/dist/excalidraw/element/bounds.d.ts +5 -5
  145. package/dist/excalidraw/element/bounds.js +29 -32
  146. package/dist/excalidraw/element/collision.d.ts +11 -11
  147. package/dist/excalidraw/element/collision.js +49 -46
  148. package/dist/excalidraw/element/containerCache.d.ts +11 -0
  149. package/dist/excalidraw/element/containerCache.js +14 -0
  150. package/dist/excalidraw/element/dragElements.js +10 -19
  151. package/dist/excalidraw/element/embeddable.d.ts +12 -13
  152. package/dist/excalidraw/element/embeddable.js +17 -27
  153. package/dist/excalidraw/element/image.js +1 -2
  154. package/dist/excalidraw/element/index.d.ts +0 -1
  155. package/dist/excalidraw/element/index.js +0 -1
  156. package/dist/excalidraw/element/linearElementEditor.d.ts +36 -36
  157. package/dist/excalidraw/element/linearElementEditor.js +79 -80
  158. package/dist/excalidraw/element/newElement.d.ts +4 -6
  159. package/dist/excalidraw/element/newElement.js +11 -16
  160. package/dist/excalidraw/element/resizeElements.d.ts +6 -6
  161. package/dist/excalidraw/element/resizeElements.js +40 -46
  162. package/dist/excalidraw/element/resizeTest.d.ts +3 -3
  163. package/dist/excalidraw/element/resizeTest.js +4 -4
  164. package/dist/excalidraw/element/sizeHelpers.d.ts +2 -2
  165. package/dist/excalidraw/element/sizeHelpers.js +2 -2
  166. package/dist/excalidraw/element/textElement.d.ts +18 -20
  167. package/dist/excalidraw/element/textElement.js +80 -111
  168. package/dist/excalidraw/element/textWysiwyg.d.ts +1 -6
  169. package/dist/excalidraw/element/textWysiwyg.js +15 -37
  170. package/dist/excalidraw/element/transformHandles.d.ts +4 -4
  171. package/dist/excalidraw/element/transformHandles.js +6 -6
  172. package/dist/excalidraw/element/typeChecks.js +4 -1
  173. package/dist/excalidraw/element/types.d.ts +24 -11
  174. package/dist/excalidraw/frame.d.ts +26 -20
  175. package/dist/excalidraw/frame.js +157 -84
  176. package/dist/excalidraw/groups.d.ts +3 -3
  177. package/dist/excalidraw/groups.js +11 -3
  178. package/dist/excalidraw/history.d.ts +1 -1
  179. package/dist/excalidraw/hooks/useLibraryItemSvg.js +1 -1
  180. package/dist/excalidraw/index.d.ts +8 -9
  181. package/dist/excalidraw/index.js +15 -11
  182. package/dist/excalidraw/laser-trails.d.ts +19 -0
  183. package/dist/excalidraw/laser-trails.js +95 -0
  184. package/dist/excalidraw/locales/en.json +9 -5
  185. package/dist/excalidraw/reactUtils.d.ts +14 -0
  186. package/dist/excalidraw/reactUtils.js +45 -0
  187. package/dist/excalidraw/renderer/helpers.d.ts +13 -0
  188. package/dist/excalidraw/renderer/helpers.js +39 -0
  189. package/dist/excalidraw/renderer/interactiveScene.d.ts +20 -0
  190. package/dist/excalidraw/renderer/{renderScene.js → interactiveScene.js} +199 -474
  191. package/dist/excalidraw/renderer/renderElement.d.ts +6 -6
  192. package/dist/excalidraw/renderer/renderElement.js +54 -366
  193. package/dist/excalidraw/renderer/staticScene.d.ts +11 -0
  194. package/dist/excalidraw/renderer/staticScene.js +205 -0
  195. package/dist/excalidraw/renderer/staticSvgScene.d.ts +5 -0
  196. package/dist/excalidraw/renderer/staticSvgScene.js +385 -0
  197. package/dist/excalidraw/scene/Fonts.js +2 -1
  198. package/dist/excalidraw/scene/Renderer.d.ts +1 -1
  199. package/dist/excalidraw/scene/Renderer.js +32 -20
  200. package/dist/excalidraw/scene/Scene.d.ts +10 -9
  201. package/dist/excalidraw/scene/Scene.js +45 -21
  202. package/dist/excalidraw/scene/Shape.d.ts +3 -1
  203. package/dist/excalidraw/scene/Shape.js +7 -5
  204. package/dist/excalidraw/scene/ShapeCache.d.ts +2 -1
  205. package/dist/excalidraw/scene/ShapeCache.js +1 -0
  206. package/dist/excalidraw/scene/comparisons.js +2 -1
  207. package/dist/excalidraw/scene/export.d.ts +3 -0
  208. package/dist/excalidraw/scene/export.js +20 -40
  209. package/dist/excalidraw/scene/index.d.ts +0 -1
  210. package/dist/excalidraw/scene/index.js +0 -1
  211. package/dist/excalidraw/scene/scrollbars.d.ts +1 -1
  212. package/dist/excalidraw/scene/scrollbars.js +1 -1
  213. package/dist/excalidraw/scene/selection.d.ts +5 -5
  214. package/dist/excalidraw/scene/selection.js +16 -14
  215. package/dist/excalidraw/scene/types.d.ts +11 -5
  216. package/dist/excalidraw/snapping.d.ts +7 -7
  217. package/dist/excalidraw/snapping.js +21 -20
  218. package/dist/excalidraw/types.d.ts +10 -11
  219. package/dist/excalidraw/utility-types.d.ts +5 -0
  220. package/dist/excalidraw/utils.d.ts +18 -15
  221. package/dist/excalidraw/utils.js +37 -45
  222. package/dist/{dev/en-RLIAOBCI.json → prod/en-TDNWCAOT.json} +9 -5
  223. package/dist/prod/index.css +1 -1
  224. package/dist/prod/index.js +42 -42
  225. package/dist/utils/bbox.d.ts +2 -2
  226. package/dist/utils/export.d.ts +3 -3
  227. package/dist/utils/export.js +3 -13
  228. package/dist/utils/index.d.ts +2 -2
  229. package/dist/utils/index.js +2 -2
  230. package/dist/utils/withinBounds.d.ts +1 -1
  231. package/dist/utils/withinBounds.js +5 -2
  232. package/package.json +4 -4
  233. package/dist/browser/dev/excalidraw-assets-dev/chunk-2W5GQUR4.js.map +0 -7
  234. package/dist/browser/dev/excalidraw-assets-dev/chunk-KGZXLFLR.js +0 -53497
  235. package/dist/browser/dev/excalidraw-assets-dev/chunk-KGZXLFLR.js.map +0 -7
  236. package/dist/browser/dev/excalidraw-assets-dev/image-3MFRCKYM.css +0 -5797
  237. package/dist/browser/dev/excalidraw-assets-dev/image-3MFRCKYM.css.map +0 -7
  238. package/dist/browser/prod/excalidraw-assets/chunk-4YN2HN3S.js +0 -257
  239. package/dist/browser/prod/excalidraw-assets/chunk-OWLL6VOG.js +0 -11
  240. package/dist/browser/prod/excalidraw-assets/en-ERQOR3OC.js +0 -1
  241. package/dist/browser/prod/excalidraw-assets/image-LTLHTTSE.js +0 -1
  242. package/dist/browser/prod/excalidraw-assets/image-QBL334OA.css +0 -1
  243. package/dist/excalidraw/components/LaserTool/LaserPathManager.d.ts +0 -28
  244. package/dist/excalidraw/components/LaserTool/LaserPathManager.js +0 -225
  245. package/dist/excalidraw/components/LaserTool/LaserTool.d.ts +0 -8
  246. package/dist/excalidraw/components/LaserTool/LaserTool.js +0 -15
  247. package/dist/excalidraw/renderer/renderScene.d.ts +0 -25
  248. package/dist/excalidraw/vite.config.d.mts +0 -2
  249. package/dist/excalidraw/vite.config.mjs +0 -13
  250. /package/dist/browser/dev/excalidraw-assets-dev/{en-OC6JWP3X.js.map → en-IOBA4CS2.js.map} +0 -0
  251. /package/dist/browser/dev/excalidraw-assets-dev/{image-5TVMINCA.js.map → image-VKDAL6BQ.js.map} +0 -0
@@ -1,257 +0,0 @@
1
- import{a as h,b as v}from"./chunk-M2JW2GFW.js";import{C as u0}from"./chunk-OWLL6VOG.js";import{aa as Uy}from"./chunk-V55EI3XA.js";import{b as Gy,d as We,e as IM,f as S}from"./chunk-SXMPUQ6M.js";var p0=We(m0=>{h();var Wy;(function(e){typeof DO_NOT_EXPORT_CRC>"u"?typeof m0=="object"?e(m0):typeof define=="function"&&define.amd?define(function(){var t={};return e(t),t}):e(Wy={}):e(Wy={})})(function(e){e.version="0.3.0";function t(){for(var c=0,l=new Array(256),d=0;d!=256;++d)c=d,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,l[d]=c;return typeof Int32Array<"u"?new Int32Array(l):l}var r=t(),o=typeof Buffer<"u";function n(c){if(c.length>32768&&o)return a(new Buffer(c));for(var l=-1,d=c.length-1,u=0;u<d;)l=r[(l^c.charCodeAt(u++))&255]^l>>>8,l=r[(l^c.charCodeAt(u++))&255]^l>>>8;return u===d&&(l=l>>>8^r[(l^c.charCodeAt(u))&255]),l^-1}function i(c){if(c.length>1e4)return a(c);for(var l=-1,d=0,u=c.length-3;d<u;)l=l>>>8^r[(l^c[d++])&255],l=l>>>8^r[(l^c[d++])&255],l=l>>>8^r[(l^c[d++])&255],l=l>>>8^r[(l^c[d++])&255];for(;d<u+3;)l=l>>>8^r[(l^c[d++])&255];return l^-1}function a(c){for(var l=-1,d=0,u=c.length-7;d<u;)l=l>>>8^r[(l^c[d++])&255],l=l>>>8^r[(l^c[d++])&255],l=l>>>8^r[(l^c[d++])&255],l=l>>>8^r[(l^c[d++])&255],l=l>>>8^r[(l^c[d++])&255],l=l>>>8^r[(l^c[d++])&255],l=l>>>8^r[(l^c[d++])&255],l=l>>>8^r[(l^c[d++])&255];for(;d<u+7;)l=l>>>8^r[(l^c[d++])&255];return l^-1}function s(c){for(var l=-1,d=0,u=c.length,m,p;d<u;)m=c.charCodeAt(d++),m<128?l=l>>>8^r[(l^m)&255]:m<2048?(l=l>>>8^r[(l^(192|m>>6&31))&255],l=l>>>8^r[(l^(128|m&63))&255]):m>=55296&&m<57344?(m=(m&1023)+64,p=c.charCodeAt(d++)&1023,l=l>>>8^r[(l^(240|m>>8&7))&255],l=l>>>8^r[(l^(128|m>>2&63))&255],l=l>>>8^r[(l^(128|p>>6&15|m&3))&255],l=l>>>8^r[(l^(128|p&63))&255]):(l=l>>>8^r[(l^(224|m>>12&15))&255],l=l>>>8^r[(l^(128|m>>6&63))&255],l=l>>>8^r[(l^(128|m&63))&255]);return l^-1}e.table=r,e.bstr=n,e.buf=i,e.str=s})});var Yy=We((vB,Vy)=>{h();var kM=p0();Vy.exports=MM;var An=new Uint8Array(4),_M=new Int32Array(An.buffer),AM=new Uint32Array(An.buffer);function MM(e){if(e[0]!==137)throw new Error("Invalid .png file header");if(e[1]!==80)throw new Error("Invalid .png file header");if(e[2]!==78)throw new Error("Invalid .png file header");if(e[3]!==71)throw new Error("Invalid .png file header");if(e[4]!==13)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");if(e[5]!==10)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");if(e[6]!==26)throw new Error("Invalid .png file header");if(e[7]!==10)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");for(var t=!1,r=[],o=8;o<e.length;){An[3]=e[o++],An[2]=e[o++],An[1]=e[o++],An[0]=e[o++];var n=AM[0]+4,i=new Uint8Array(n);i[0]=e[o++],i[1]=e[o++],i[2]=e[o++],i[3]=e[o++];var a=String.fromCharCode(i[0])+String.fromCharCode(i[1])+String.fromCharCode(i[2])+String.fromCharCode(i[3]);if(!r.length&&a!=="IHDR")throw new Error("IHDR header missing");if(a==="IEND"){t=!0,r.push({name:a,data:new Uint8Array(0)});break}for(var s=4;s<n;s++)i[s]=e[o++];An[3]=e[o++],An[2]=e[o++],An[1]=e[o++],An[0]=e[o++];var c=_M[0],l=kM.buf(i);if(l!==c)throw new Error("CRC values for "+a+" header do not match, PNG file is likely corrupted");var d=new Uint8Array(i.buffer.slice(4));r.push({name:a,data:d})}if(!t)throw new Error(".png file ended prematurely: no IEND header was found");return r}});var Zy=We((SB,Ky)=>{h();Ky.exports=PM;function PM(e,t){if(e=String(e),t=String(t),!/^[\x00-\xFF]+$/.test(e)||!/^[\x00-\xFF]+$/.test(t))throw new Error("Only Latin-1 characters are permitted in PNG tEXt chunks. You might want to consider base64 encoding and/or zEXt compression");if(e.length>=80)throw new Error('Keyword "'+e+'" is longer than the 79-character limit imposed by the PNG specification');for(var r=e.length+t.length+1,o=new Uint8Array(r),n=0,i,a=0;a<e.length;a++){if(!(i=e.charCodeAt(a)))throw new Error("0x00 character is not permitted in tEXt keywords");o[n++]=i}o[n++]=0;for(var s=0;s<t.length;s++){if(!(i=t.charCodeAt(s)))throw new Error("0x00 character is not permitted in tEXt content");o[n++]=i}return{name:"tEXt",data:o}}});var jy=We((IB,Xy)=>{h();Xy.exports=LM;function LM(e){e.data&&e.name&&(e=e.data);for(var t=!0,r="",o="",n=0;n<e.length;n++){var i=e[n];if(t)i?o+=String.fromCharCode(i):t=!1;else if(i)r+=String.fromCharCode(i);else throw new Error("Invalid NULL character found. 0x00 character is not permitted in tEXt content")}return{keyword:o,text:r}}});var qy=We(f0=>{h();f0.encode=Zy();f0.decode=jy()});var Qy=We((MB,Jy)=>{h();Jy.exports=function(e,t,r){var o=[],n=e.length;if(n===0)return o;var i=t<0?Math.max(0,t+n):t||0;for(r!==void 0&&(n=r<0?r+n:r);n-- >i;)o[n-i]=e[n];return o}});var tw=We((LB,ew)=>{h();var DM=Qy(),RM=p0();ew.exports=FM;var Mn=new Uint8Array(4),OM=new Int32Array(Mn.buffer),NM=new Uint32Array(Mn.buffer);function FM(e){var t=8,r=t,o;for(o=0;o<e.length;o++)t+=e[o].data.length,t+=12;var n=new Uint8Array(t);for(n[0]=137,n[1]=80,n[2]=78,n[3]=71,n[4]=13,n[5]=10,n[6]=26,n[7]=10,o=0;o<e.length;o++){var i=e[o],a=i.name,s=i.data,c=s.length,l=[a.charCodeAt(0),a.charCodeAt(1),a.charCodeAt(2),a.charCodeAt(3)];NM[0]=c,n[r++]=Mn[3],n[r++]=Mn[2],n[r++]=Mn[1],n[r++]=Mn[0],n[r++]=l[0],n[r++]=l[1],n[r++]=l[2],n[r++]=l[3];for(var d=0;d<c;)n[r++]=s[d++];var u=l.concat(DM(s)),m=RM.buf(u);OM[0]=m,n[r++]=Mn[3],n[r++]=Mn[2],n[r++]=Mn[1],n[r++]=Mn[0]}return n}});var ci=We(Pr=>{"use strict";h();var BM=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function zM(e,t){return Object.prototype.hasOwnProperty.call(e,t)}Pr.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var o in r)zM(r,o)&&(e[o]=r[o])}}return e};Pr.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var HM={arraySet:function(e,t,r,o,n){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+o),n);return}for(var i=0;i<o;i++)e[n+i]=t[r+i]},flattenChunks:function(e){var t,r,o,n,i,a;for(o=0,t=0,r=e.length;t<r;t++)o+=e[t].length;for(a=new Uint8Array(o),n=0,t=0,r=e.length;t<r;t++)i=e[t],a.set(i,n),n+=i.length;return a}},$M={arraySet:function(e,t,r,o,n){for(var i=0;i<o;i++)e[n+i]=t[r+i]},flattenChunks:function(e){return[].concat.apply([],e)}};Pr.setTyped=function(e){e?(Pr.Buf8=Uint8Array,Pr.Buf16=Uint16Array,Pr.Buf32=Int32Array,Pr.assign(Pr,HM)):(Pr.Buf8=Array,Pr.Buf16=Array,Pr.Buf32=Array,Pr.assign(Pr,$M))};Pr.setTyped(BM)});var Sw=We(sl=>{"use strict";h();var GM=ci(),UM=4,rw=0,ow=1,WM=2;function al(e){for(var t=e.length;--t>=0;)e[t]=0}var VM=0,cw=1,YM=2,KM=3,ZM=258,w0=29,fd=256,dd=fd+1+w0,il=30,v0=19,dw=2*dd+1,ja=15,h0=16,XM=7,T0=256,uw=16,mw=17,pw=18,E0=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Sm=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],jM=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],fw=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],qM=512,di=new Array((dd+2)*2);al(di);var cd=new Array(il*2);al(cd);var ud=new Array(qM);al(ud);var md=new Array(ZM-KM+1);al(md);var S0=new Array(w0);al(S0);var Cm=new Array(il);al(Cm);function g0(e,t,r,o,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=o,this.max_length=n,this.has_stree=e&&e.length}var hw,gw,bw;function b0(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function xw(e){return e<256?ud[e]:ud[256+(e>>>7)]}function pd(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function Yr(e,t,r){e.bi_valid>h0-r?(e.bi_buf|=t<<e.bi_valid&65535,pd(e,e.bi_buf),e.bi_buf=t>>h0-e.bi_valid,e.bi_valid+=r-h0):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function Pn(e,t,r){Yr(e,r[t*2],r[t*2+1])}function Ew(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function JM(e){e.bi_valid===16?(pd(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function QM(e,t){var r=t.dyn_tree,o=t.max_code,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,d,u,m,p,f,g=0;for(m=0;m<=ja;m++)e.bl_count[m]=0;for(r[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<dw;l++)d=e.heap[l],m=r[r[d*2+1]*2+1]+1,m>c&&(m=c,g++),r[d*2+1]=m,!(d>o)&&(e.bl_count[m]++,p=0,d>=s&&(p=a[d-s]),f=r[d*2],e.opt_len+=f*(m+p),i&&(e.static_len+=f*(n[d*2+1]+p)));if(g!==0){do{for(m=c-1;e.bl_count[m]===0;)m--;e.bl_count[m]--,e.bl_count[m+1]+=2,e.bl_count[c]--,g-=2}while(g>0);for(m=c;m!==0;m--)for(d=e.bl_count[m];d!==0;)u=e.heap[--l],!(u>o)&&(r[u*2+1]!==m&&(e.opt_len+=(m-r[u*2+1])*r[u*2],r[u*2+1]=m),d--)}}function yw(e,t,r){var o=new Array(ja+1),n=0,i,a;for(i=1;i<=ja;i++)o[i]=n=n+r[i-1]<<1;for(a=0;a<=t;a++){var s=e[a*2+1];s!==0&&(e[a*2]=Ew(o[s]++,s))}}function e8(){var e,t,r,o,n,i=new Array(ja+1);for(r=0,o=0;o<w0-1;o++)for(S0[o]=r,e=0;e<1<<E0[o];e++)md[r++]=o;for(md[r-1]=o,n=0,o=0;o<16;o++)for(Cm[o]=n,e=0;e<1<<Sm[o];e++)ud[n++]=o;for(n>>=7;o<il;o++)for(Cm[o]=n<<7,e=0;e<1<<Sm[o]-7;e++)ud[256+n++]=o;for(t=0;t<=ja;t++)i[t]=0;for(e=0;e<=143;)di[e*2+1]=8,e++,i[8]++;for(;e<=255;)di[e*2+1]=9,e++,i[9]++;for(;e<=279;)di[e*2+1]=7,e++,i[7]++;for(;e<=287;)di[e*2+1]=8,e++,i[8]++;for(yw(di,dd+1,i),e=0;e<il;e++)cd[e*2+1]=5,cd[e*2]=Ew(e,5);hw=new g0(di,E0,fd+1,dd,ja),gw=new g0(cd,Sm,0,il,ja),bw=new g0(new Array(0),jM,0,v0,XM)}function ww(e){var t;for(t=0;t<dd;t++)e.dyn_ltree[t*2]=0;for(t=0;t<il;t++)e.dyn_dtree[t*2]=0;for(t=0;t<v0;t++)e.bl_tree[t*2]=0;e.dyn_ltree[T0*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function vw(e){e.bi_valid>8?pd(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function t8(e,t,r,o){vw(e),o&&(pd(e,r),pd(e,~r)),GM.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function nw(e,t,r,o){var n=t*2,i=r*2;return e[n]<e[i]||e[n]===e[i]&&o[t]<=o[r]}function x0(e,t,r){for(var o=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&nw(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!nw(t,o,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=o}function iw(e,t,r){var o,n,i=0,a,s;if(e.last_lit!==0)do o=e.pending_buf[e.d_buf+i*2]<<8|e.pending_buf[e.d_buf+i*2+1],n=e.pending_buf[e.l_buf+i],i++,o===0?Pn(e,n,t):(a=md[n],Pn(e,a+fd+1,t),s=E0[a],s!==0&&(n-=S0[a],Yr(e,n,s)),o--,a=xw(o),Pn(e,a,r),s=Sm[a],s!==0&&(o-=Cm[a],Yr(e,o,s)));while(i<e.last_lit);Pn(e,T0,t)}function y0(e,t){var r=t.dyn_tree,o=t.stat_desc.static_tree,n=t.stat_desc.has_stree,i=t.stat_desc.elems,a,s,c=-1,l;for(e.heap_len=0,e.heap_max=dw,a=0;a<i;a++)r[a*2]!==0?(e.heap[++e.heap_len]=c=a,e.depth[a]=0):r[a*2+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,r[l*2]=1,e.depth[l]=0,e.opt_len--,n&&(e.static_len-=o[l*2+1]);for(t.max_code=c,a=e.heap_len>>1;a>=1;a--)x0(e,r,a);l=i;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],x0(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,r[l*2]=r[a*2]+r[s*2],e.depth[l]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,r[a*2+1]=r[s*2+1]=l,e.heap[1]=l++,x0(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],QM(e,t),yw(r,c,e.bl_count)}function aw(e,t,r){var o,n=-1,i,a=t[0*2+1],s=0,c=7,l=4;for(a===0&&(c=138,l=3),t[(r+1)*2+1]=65535,o=0;o<=r;o++)i=a,a=t[(o+1)*2+1],!(++s<c&&i===a)&&(s<l?e.bl_tree[i*2]+=s:i!==0?(i!==n&&e.bl_tree[i*2]++,e.bl_tree[uw*2]++):s<=10?e.bl_tree[mw*2]++:e.bl_tree[pw*2]++,s=0,n=i,a===0?(c=138,l=3):i===a?(c=6,l=3):(c=7,l=4))}function sw(e,t,r){var o,n=-1,i,a=t[0*2+1],s=0,c=7,l=4;for(a===0&&(c=138,l=3),o=0;o<=r;o++)if(i=a,a=t[(o+1)*2+1],!(++s<c&&i===a)){if(s<l)do Pn(e,i,e.bl_tree);while(--s!==0);else i!==0?(i!==n&&(Pn(e,i,e.bl_tree),s--),Pn(e,uw,e.bl_tree),Yr(e,s-3,2)):s<=10?(Pn(e,mw,e.bl_tree),Yr(e,s-3,3)):(Pn(e,pw,e.bl_tree),Yr(e,s-11,7));s=0,n=i,a===0?(c=138,l=3):i===a?(c=6,l=3):(c=7,l=4)}}function r8(e){var t;for(aw(e,e.dyn_ltree,e.l_desc.max_code),aw(e,e.dyn_dtree,e.d_desc.max_code),y0(e,e.bl_desc),t=v0-1;t>=3&&e.bl_tree[fw[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function o8(e,t,r,o){var n;for(Yr(e,t-257,5),Yr(e,r-1,5),Yr(e,o-4,4),n=0;n<o;n++)Yr(e,e.bl_tree[fw[n]*2+1],3);sw(e,e.dyn_ltree,t-1),sw(e,e.dyn_dtree,r-1)}function n8(e){var t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return rw;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return ow;for(r=32;r<fd;r++)if(e.dyn_ltree[r*2]!==0)return ow;return rw}var lw=!1;function i8(e){lw||(e8(),lw=!0),e.l_desc=new b0(e.dyn_ltree,hw),e.d_desc=new b0(e.dyn_dtree,gw),e.bl_desc=new b0(e.bl_tree,bw),e.bi_buf=0,e.bi_valid=0,ww(e)}function Tw(e,t,r,o){Yr(e,(VM<<1)+(o?1:0),3),t8(e,t,r,!0)}function a8(e){Yr(e,cw<<1,3),Pn(e,T0,di),JM(e)}function s8(e,t,r,o){var n,i,a=0;e.level>0?(e.strm.data_type===WM&&(e.strm.data_type=n8(e)),y0(e,e.l_desc),y0(e,e.d_desc),a=r8(e),n=e.opt_len+3+7>>>3,i=e.static_len+3+7>>>3,i<=n&&(n=i)):n=i=r+5,r+4<=n&&t!==-1?Tw(e,t,r,o):e.strategy===UM||i===n?(Yr(e,(cw<<1)+(o?1:0),3),iw(e,di,cd)):(Yr(e,(YM<<1)+(o?1:0),3),o8(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),iw(e,e.dyn_ltree,e.dyn_dtree)),ww(e),o&&vw(e)}function l8(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(md[r]+fd+1)*2]++,e.dyn_dtree[xw(t)*2]++),e.last_lit===e.lit_bufsize-1}sl._tr_init=i8;sl._tr_stored_block=Tw;sl._tr_flush_block=s8;sl._tr_tally=l8;sl._tr_align=a8});var C0=We((BB,Cw)=>{"use strict";h();function c8(e,t,r,o){for(var n=e&65535|0,i=e>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do n=n+t[o++]|0,i=i+n|0;while(--a);n%=65521,i%=65521}return n|i<<16|0}Cw.exports=c8});var I0=We((HB,Iw)=>{"use strict";h();function d8(){for(var e,t=[],r=0;r<256;r++){e=r;for(var o=0;o<8;o++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var u8=d8();function m8(e,t,r,o){var n=u8,i=o+r;e^=-1;for(var a=o;a<i;a++)e=e>>>8^n[(e^t[a])&255];return e^-1}Iw.exports=m8});var Im=We((GB,kw)=>{"use strict";h();kw.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Nw=We(Rn=>{"use strict";h();var Lr=ci(),wo=Sw(),Pw=C0(),Xi=I0(),p8=Im(),es=0,f8=1,h8=3,ea=4,_w=5,Dn=0,Aw=1,vo=-2,g8=-3,k0=-5,b8=-1,x8=1,km=2,E8=3,y8=4,w8=0,v8=2,Pm=8,T8=9,S8=15,C8=8,I8=29,k8=256,A0=k8+1+I8,_8=30,A8=19,M8=2*A0+1,P8=15,ze=3,Ji=258,Qo=Ji+ze+1,L8=32,Lm=42,M0=69,_m=73,Am=91,Mm=103,qa=113,gd=666,jt=1,bd=2,Ja=3,dl=4,D8=3;function Qi(e,t){return e.msg=p8[t],t}function Mw(e){return(e<<1)-(e>4?9:0)}function qi(e){for(var t=e.length;--t>=0;)e[t]=0}function ji(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(Lr.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function mr(e,t){wo._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ji(e.strm)}function Xe(e,t){e.pending_buf[e.pending++]=t}function hd(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function R8(e,t,r,o){var n=e.avail_in;return n>o&&(n=o),n===0?0:(e.avail_in-=n,Lr.arraySet(t,e.input,e.next_in,n,r),e.state.wrap===1?e.adler=Pw(e.adler,t,n,r):e.state.wrap===2&&(e.adler=Xi(e.adler,t,n,r)),e.next_in+=n,e.total_in+=n,n)}function Lw(e,t){var r=e.max_chain_length,o=e.strstart,n,i,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-Qo?e.strstart-(e.w_size-Qo):0,l=e.window,d=e.w_mask,u=e.prev,m=e.strstart+Ji,p=l[o+a-1],f=l[o+a];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do if(n=t,!(l[n+a]!==f||l[n+a-1]!==p||l[n]!==l[o]||l[++n]!==l[o+1])){o+=2,n++;do;while(l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&o<m);if(i=Ji-(m-o),o=m-Ji,i>a){if(e.match_start=t,a=i,i>=s)break;p=l[o+a-1],f=l[o+a]}}while((t=u[t&d])>c&&--r!==0);return a<=e.lookahead?a:e.lookahead}function Qa(e){var t=e.w_size,r,o,n,i,a;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Qo)){Lr.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,o=e.hash_size,r=o;do n=e.head[--r],e.head[r]=n>=t?n-t:0;while(--o);o=t,r=o;do n=e.prev[--r],e.prev[r]=n>=t?n-t:0;while(--o);i+=t}if(e.strm.avail_in===0)break;if(o=R8(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=o,e.lookahead+e.insert>=ze)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+ze-1])&e.hash_mask,e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<ze)););}while(e.lookahead<Qo&&e.strm.avail_in!==0)}function O8(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Qa(e),e.lookahead===0&&t===es)return jt;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var o=e.block_start+r;if((e.strstart===0||e.strstart>=o)&&(e.lookahead=e.strstart-o,e.strstart=o,mr(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Qo&&(mr(e,!1),e.strm.avail_out===0))return jt}return e.insert=0,t===ea?(mr(e,!0),e.strm.avail_out===0?Ja:dl):(e.strstart>e.block_start&&(mr(e,!1),e.strm.avail_out===0),jt)}function _0(e,t){for(var r,o;;){if(e.lookahead<Qo){if(Qa(e),e.lookahead<Qo&&t===es)return jt;if(e.lookahead===0)break}if(r=0,e.lookahead>=ze&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+ze-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-Qo&&(e.match_length=Lw(e,r)),e.match_length>=ze)if(o=wo._tr_tally(e,e.strstart-e.match_start,e.match_length-ze),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=ze){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+ze-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else o=wo._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(o&&(mr(e,!1),e.strm.avail_out===0))return jt}return e.insert=e.strstart<ze-1?e.strstart:ze-1,t===ea?(mr(e,!0),e.strm.avail_out===0?Ja:dl):e.last_lit&&(mr(e,!1),e.strm.avail_out===0)?jt:bd}function ll(e,t){for(var r,o,n;;){if(e.lookahead<Qo){if(Qa(e),e.lookahead<Qo&&t===es)return jt;if(e.lookahead===0)break}if(r=0,e.lookahead>=ze&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+ze-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=ze-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-Qo&&(e.match_length=Lw(e,r),e.match_length<=5&&(e.strategy===x8||e.match_length===ze&&e.strstart-e.match_start>4096)&&(e.match_length=ze-1)),e.prev_length>=ze&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-ze,o=wo._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-ze),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+ze-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=ze-1,e.strstart++,o&&(mr(e,!1),e.strm.avail_out===0))return jt}else if(e.match_available){if(o=wo._tr_tally(e,0,e.window[e.strstart-1]),o&&mr(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return jt}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(o=wo._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<ze-1?e.strstart:ze-1,t===ea?(mr(e,!0),e.strm.avail_out===0?Ja:dl):e.last_lit&&(mr(e,!1),e.strm.avail_out===0)?jt:bd}function N8(e,t){for(var r,o,n,i,a=e.window;;){if(e.lookahead<=Ji){if(Qa(e),e.lookahead<=Ji&&t===es)return jt;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=ze&&e.strstart>0&&(n=e.strstart-1,o=a[n],o===a[++n]&&o===a[++n]&&o===a[++n])){i=e.strstart+Ji;do;while(o===a[++n]&&o===a[++n]&&o===a[++n]&&o===a[++n]&&o===a[++n]&&o===a[++n]&&o===a[++n]&&o===a[++n]&&n<i);e.match_length=Ji-(i-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=ze?(r=wo._tr_tally(e,1,e.match_length-ze),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=wo._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(mr(e,!1),e.strm.avail_out===0))return jt}return e.insert=0,t===ea?(mr(e,!0),e.strm.avail_out===0?Ja:dl):e.last_lit&&(mr(e,!1),e.strm.avail_out===0)?jt:bd}function F8(e,t){for(var r;;){if(e.lookahead===0&&(Qa(e),e.lookahead===0)){if(t===es)return jt;break}if(e.match_length=0,r=wo._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(mr(e,!1),e.strm.avail_out===0))return jt}return e.insert=0,t===ea?(mr(e,!0),e.strm.avail_out===0?Ja:dl):e.last_lit&&(mr(e,!1),e.strm.avail_out===0)?jt:bd}function Ln(e,t,r,o,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=o,this.func=n}var cl;cl=[new Ln(0,0,0,0,O8),new Ln(4,4,8,4,_0),new Ln(4,5,16,8,_0),new Ln(4,6,32,32,_0),new Ln(4,4,16,16,ll),new Ln(8,16,32,32,ll),new Ln(8,16,128,128,ll),new Ln(8,32,128,256,ll),new Ln(32,128,258,1024,ll),new Ln(32,258,258,4096,ll)];function B8(e){e.window_size=2*e.w_size,qi(e.head),e.max_lazy_match=cl[e.level].max_lazy,e.good_match=cl[e.level].good_length,e.nice_match=cl[e.level].nice_length,e.max_chain_length=cl[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=ze-1,e.match_available=0,e.ins_h=0}function z8(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Pm,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Lr.Buf16(M8*2),this.dyn_dtree=new Lr.Buf16((2*_8+1)*2),this.bl_tree=new Lr.Buf16((2*A8+1)*2),qi(this.dyn_ltree),qi(this.dyn_dtree),qi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Lr.Buf16(P8+1),this.heap=new Lr.Buf16(2*A0+1),qi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Lr.Buf16(2*A0+1),qi(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Dw(e){var t;return!e||!e.state?Qi(e,vo):(e.total_in=e.total_out=0,e.data_type=v8,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Lm:qa,e.adler=t.wrap===2?0:1,t.last_flush=es,wo._tr_init(t),Dn)}function Rw(e){var t=Dw(e);return t===Dn&&B8(e.state),t}function H8(e,t){return!e||!e.state||e.state.wrap!==2?vo:(e.state.gzhead=t,Dn)}function Ow(e,t,r,o,n,i){if(!e)return vo;var a=1;if(t===b8&&(t=6),o<0?(a=0,o=-o):o>15&&(a=2,o-=16),n<1||n>T8||r!==Pm||o<8||o>15||t<0||t>9||i<0||i>y8)return Qi(e,vo);o===8&&(o=9);var s=new z8;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=o,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ze-1)/ze),s.window=new Lr.Buf8(s.w_size*2),s.head=new Lr.Buf16(s.hash_size),s.prev=new Lr.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Lr.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=i,s.method=r,Rw(e)}function $8(e,t){return Ow(e,t,Pm,S8,C8,w8)}function G8(e,t){var r,o,n,i;if(!e||!e.state||t>_w||t<0)return e?Qi(e,vo):vo;if(o=e.state,!e.output||!e.input&&e.avail_in!==0||o.status===gd&&t!==ea)return Qi(e,e.avail_out===0?k0:vo);if(o.strm=e,r=o.last_flush,o.last_flush=t,o.status===Lm)if(o.wrap===2)e.adler=0,Xe(o,31),Xe(o,139),Xe(o,8),o.gzhead?(Xe(o,(o.gzhead.text?1:0)+(o.gzhead.hcrc?2:0)+(o.gzhead.extra?4:0)+(o.gzhead.name?8:0)+(o.gzhead.comment?16:0)),Xe(o,o.gzhead.time&255),Xe(o,o.gzhead.time>>8&255),Xe(o,o.gzhead.time>>16&255),Xe(o,o.gzhead.time>>24&255),Xe(o,o.level===9?2:o.strategy>=km||o.level<2?4:0),Xe(o,o.gzhead.os&255),o.gzhead.extra&&o.gzhead.extra.length&&(Xe(o,o.gzhead.extra.length&255),Xe(o,o.gzhead.extra.length>>8&255)),o.gzhead.hcrc&&(e.adler=Xi(e.adler,o.pending_buf,o.pending,0)),o.gzindex=0,o.status=M0):(Xe(o,0),Xe(o,0),Xe(o,0),Xe(o,0),Xe(o,0),Xe(o,o.level===9?2:o.strategy>=km||o.level<2?4:0),Xe(o,D8),o.status=qa);else{var a=Pm+(o.w_bits-8<<4)<<8,s=-1;o.strategy>=km||o.level<2?s=0:o.level<6?s=1:o.level===6?s=2:s=3,a|=s<<6,o.strstart!==0&&(a|=L8),a+=31-a%31,o.status=qa,hd(o,a),o.strstart!==0&&(hd(o,e.adler>>>16),hd(o,e.adler&65535)),e.adler=1}if(o.status===M0)if(o.gzhead.extra){for(n=o.pending;o.gzindex<(o.gzhead.extra.length&65535)&&!(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>n&&(e.adler=Xi(e.adler,o.pending_buf,o.pending-n,n)),ji(e),n=o.pending,o.pending===o.pending_buf_size));)Xe(o,o.gzhead.extra[o.gzindex]&255),o.gzindex++;o.gzhead.hcrc&&o.pending>n&&(e.adler=Xi(e.adler,o.pending_buf,o.pending-n,n)),o.gzindex===o.gzhead.extra.length&&(o.gzindex=0,o.status=_m)}else o.status=_m;if(o.status===_m)if(o.gzhead.name){n=o.pending;do{if(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>n&&(e.adler=Xi(e.adler,o.pending_buf,o.pending-n,n)),ji(e),n=o.pending,o.pending===o.pending_buf_size)){i=1;break}o.gzindex<o.gzhead.name.length?i=o.gzhead.name.charCodeAt(o.gzindex++)&255:i=0,Xe(o,i)}while(i!==0);o.gzhead.hcrc&&o.pending>n&&(e.adler=Xi(e.adler,o.pending_buf,o.pending-n,n)),i===0&&(o.gzindex=0,o.status=Am)}else o.status=Am;if(o.status===Am)if(o.gzhead.comment){n=o.pending;do{if(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>n&&(e.adler=Xi(e.adler,o.pending_buf,o.pending-n,n)),ji(e),n=o.pending,o.pending===o.pending_buf_size)){i=1;break}o.gzindex<o.gzhead.comment.length?i=o.gzhead.comment.charCodeAt(o.gzindex++)&255:i=0,Xe(o,i)}while(i!==0);o.gzhead.hcrc&&o.pending>n&&(e.adler=Xi(e.adler,o.pending_buf,o.pending-n,n)),i===0&&(o.status=Mm)}else o.status=Mm;if(o.status===Mm&&(o.gzhead.hcrc?(o.pending+2>o.pending_buf_size&&ji(e),o.pending+2<=o.pending_buf_size&&(Xe(o,e.adler&255),Xe(o,e.adler>>8&255),e.adler=0,o.status=qa)):o.status=qa),o.pending!==0){if(ji(e),e.avail_out===0)return o.last_flush=-1,Dn}else if(e.avail_in===0&&Mw(t)<=Mw(r)&&t!==ea)return Qi(e,k0);if(o.status===gd&&e.avail_in!==0)return Qi(e,k0);if(e.avail_in!==0||o.lookahead!==0||t!==es&&o.status!==gd){var c=o.strategy===km?F8(o,t):o.strategy===E8?N8(o,t):cl[o.level].func(o,t);if((c===Ja||c===dl)&&(o.status=gd),c===jt||c===Ja)return e.avail_out===0&&(o.last_flush=-1),Dn;if(c===bd&&(t===f8?wo._tr_align(o):t!==_w&&(wo._tr_stored_block(o,0,0,!1),t===h8&&(qi(o.head),o.lookahead===0&&(o.strstart=0,o.block_start=0,o.insert=0))),ji(e),e.avail_out===0))return o.last_flush=-1,Dn}return t!==ea?Dn:o.wrap<=0?Aw:(o.wrap===2?(Xe(o,e.adler&255),Xe(o,e.adler>>8&255),Xe(o,e.adler>>16&255),Xe(o,e.adler>>24&255),Xe(o,e.total_in&255),Xe(o,e.total_in>>8&255),Xe(o,e.total_in>>16&255),Xe(o,e.total_in>>24&255)):(hd(o,e.adler>>>16),hd(o,e.adler&65535)),ji(e),o.wrap>0&&(o.wrap=-o.wrap),o.pending!==0?Dn:Aw)}function U8(e){var t;return!e||!e.state?vo:(t=e.state.status,t!==Lm&&t!==M0&&t!==_m&&t!==Am&&t!==Mm&&t!==qa&&t!==gd?Qi(e,vo):(e.state=null,t===qa?Qi(e,g8):Dn))}function W8(e,t){var r=t.length,o,n,i,a,s,c,l,d;if(!e||!e.state||(o=e.state,a=o.wrap,a===2||a===1&&o.status!==Lm||o.lookahead))return vo;for(a===1&&(e.adler=Pw(e.adler,t,r,0)),o.wrap=0,r>=o.w_size&&(a===0&&(qi(o.head),o.strstart=0,o.block_start=0,o.insert=0),d=new Lr.Buf8(o.w_size),Lr.arraySet(d,t,r-o.w_size,o.w_size,0),t=d,r=o.w_size),s=e.avail_in,c=e.next_in,l=e.input,e.avail_in=r,e.next_in=0,e.input=t,Qa(o);o.lookahead>=ze;){n=o.strstart,i=o.lookahead-(ze-1);do o.ins_h=(o.ins_h<<o.hash_shift^o.window[n+ze-1])&o.hash_mask,o.prev[n&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=n,n++;while(--i);o.strstart=n,o.lookahead=ze-1,Qa(o)}return o.strstart+=o.lookahead,o.block_start=o.strstart,o.insert=o.lookahead,o.lookahead=0,o.match_length=o.prev_length=ze-1,o.match_available=0,e.next_in=c,e.input=l,e.avail_in=s,o.wrap=a,Dn}Rn.deflateInit=$8;Rn.deflateInit2=Ow;Rn.deflateReset=Rw;Rn.deflateResetKeep=Dw;Rn.deflateSetHeader=H8;Rn.deflate=G8;Rn.deflateEnd=U8;Rn.deflateSetDictionary=W8;Rn.deflateInfo="pako deflate (from Nodeca project)"});var P0=We(ul=>{"use strict";h();var Dm=ci(),Fw=!0,Bw=!0;try{String.fromCharCode.apply(null,[0])}catch{Fw=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Bw=!1}var xd=new Dm.Buf8(256);for(ui=0;ui<256;ui++)xd[ui]=ui>=252?6:ui>=248?5:ui>=240?4:ui>=224?3:ui>=192?2:1;var ui;xd[254]=xd[254]=1;ul.string2buf=function(e){var t,r,o,n,i,a=e.length,s=0;for(n=0;n<a;n++)r=e.charCodeAt(n),(r&64512)===55296&&n+1<a&&(o=e.charCodeAt(n+1),(o&64512)===56320&&(r=65536+(r-55296<<10)+(o-56320),n++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Dm.Buf8(s),i=0,n=0;i<s;n++)r=e.charCodeAt(n),(r&64512)===55296&&n+1<a&&(o=e.charCodeAt(n+1),(o&64512)===56320&&(r=65536+(r-55296<<10)+(o-56320),n++)),r<128?t[i++]=r:r<2048?(t[i++]=192|r>>>6,t[i++]=128|r&63):r<65536?(t[i++]=224|r>>>12,t[i++]=128|r>>>6&63,t[i++]=128|r&63):(t[i++]=240|r>>>18,t[i++]=128|r>>>12&63,t[i++]=128|r>>>6&63,t[i++]=128|r&63);return t};function zw(e,t){if(t<65534&&(e.subarray&&Bw||!e.subarray&&Fw))return String.fromCharCode.apply(null,Dm.shrinkBuf(e,t));for(var r="",o=0;o<t;o++)r+=String.fromCharCode(e[o]);return r}ul.buf2binstring=function(e){return zw(e,e.length)};ul.binstring2buf=function(e){for(var t=new Dm.Buf8(e.length),r=0,o=t.length;r<o;r++)t[r]=e.charCodeAt(r);return t};ul.buf2string=function(e,t){var r,o,n,i,a=t||e.length,s=new Array(a*2);for(o=0,r=0;r<a;){if(n=e[r++],n<128){s[o++]=n;continue}if(i=xd[n],i>4){s[o++]=65533,r+=i-1;continue}for(n&=i===2?31:i===3?15:7;i>1&&r<a;)n=n<<6|e[r++]&63,i--;if(i>1){s[o++]=65533;continue}n<65536?s[o++]=n:(n-=65536,s[o++]=55296|n>>10&1023,s[o++]=56320|n&1023)}return zw(s,o)};ul.utf8border=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+xd[e[r]]>t?r:t}});var L0=We((ZB,Hw)=>{"use strict";h();function V8(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}Hw.exports=V8});var Ww=We(wd=>{"use strict";h();var Ed=Nw(),yd=ci(),R0=P0(),O0=Im(),Y8=L0(),Uw=Object.prototype.toString,K8=0,D0=4,ml=0,$w=1,Gw=2,Z8=-1,X8=0,j8=8;function ts(e){if(!(this instanceof ts))return new ts(e);this.options=yd.assign({level:Z8,method:j8,chunkSize:16384,windowBits:15,memLevel:8,strategy:X8,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Y8,this.strm.avail_out=0;var r=Ed.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==ml)throw new Error(O0[r]);if(t.header&&Ed.deflateSetHeader(this.strm,t.header),t.dictionary){var o;if(typeof t.dictionary=="string"?o=R0.string2buf(t.dictionary):Uw.call(t.dictionary)==="[object ArrayBuffer]"?o=new Uint8Array(t.dictionary):o=t.dictionary,r=Ed.deflateSetDictionary(this.strm,o),r!==ml)throw new Error(O0[r]);this._dict_set=!0}}ts.prototype.push=function(e,t){var r=this.strm,o=this.options.chunkSize,n,i;if(this.ended)return!1;i=t===~~t?t:t===!0?D0:K8,typeof e=="string"?r.input=R0.string2buf(e):Uw.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new yd.Buf8(o),r.next_out=0,r.avail_out=o),n=Ed.deflate(r,i),n!==$w&&n!==ml)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(i===D0||i===Gw))&&(this.options.to==="string"?this.onData(R0.buf2binstring(yd.shrinkBuf(r.output,r.next_out))):this.onData(yd.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==$w);return i===D0?(n=Ed.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ml):(i===Gw&&(this.onEnd(ml),r.avail_out=0),!0)};ts.prototype.onData=function(e){this.chunks.push(e)};ts.prototype.onEnd=function(e){e===ml&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=yd.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function N0(e,t){var r=new ts(t);if(r.push(e,!0),r.err)throw r.msg||O0[r.err];return r.result}function q8(e,t){return t=t||{},t.raw=!0,N0(e,t)}function J8(e,t){return t=t||{},t.gzip=!0,N0(e,t)}wd.Deflate=ts;wd.deflate=N0;wd.deflateRaw=q8;wd.gzip=J8});var Yw=We((JB,Vw)=>{"use strict";h();var Rm=30,Q8=12;Vw.exports=function(t,r){var o,n,i,a,s,c,l,d,u,m,p,f,g,x,y,w,T,C,I,A,P,L,D,M,R;o=t.state,n=t.next_in,M=t.input,i=n+(t.avail_in-5),a=t.next_out,R=t.output,s=a-(r-t.avail_out),c=a+(t.avail_out-257),l=o.dmax,d=o.wsize,u=o.whave,m=o.wnext,p=o.window,f=o.hold,g=o.bits,x=o.lencode,y=o.distcode,w=(1<<o.lenbits)-1,T=(1<<o.distbits)-1;e:do{g<15&&(f+=M[n++]<<g,g+=8,f+=M[n++]<<g,g+=8),C=x[f&w];t:for(;;){if(I=C>>>24,f>>>=I,g-=I,I=C>>>16&255,I===0)R[a++]=C&65535;else if(I&16){A=C&65535,I&=15,I&&(g<I&&(f+=M[n++]<<g,g+=8),A+=f&(1<<I)-1,f>>>=I,g-=I),g<15&&(f+=M[n++]<<g,g+=8,f+=M[n++]<<g,g+=8),C=y[f&T];r:for(;;){if(I=C>>>24,f>>>=I,g-=I,I=C>>>16&255,I&16){if(P=C&65535,I&=15,g<I&&(f+=M[n++]<<g,g+=8,g<I&&(f+=M[n++]<<g,g+=8)),P+=f&(1<<I)-1,P>l){t.msg="invalid distance too far back",o.mode=Rm;break e}if(f>>>=I,g-=I,I=a-s,P>I){if(I=P-I,I>u&&o.sane){t.msg="invalid distance too far back",o.mode=Rm;break e}if(L=0,D=p,m===0){if(L+=d-I,I<A){A-=I;do R[a++]=p[L++];while(--I);L=a-P,D=R}}else if(m<I){if(L+=d+m-I,I-=m,I<A){A-=I;do R[a++]=p[L++];while(--I);if(L=0,m<A){I=m,A-=I;do R[a++]=p[L++];while(--I);L=a-P,D=R}}}else if(L+=m-I,I<A){A-=I;do R[a++]=p[L++];while(--I);L=a-P,D=R}for(;A>2;)R[a++]=D[L++],R[a++]=D[L++],R[a++]=D[L++],A-=3;A&&(R[a++]=D[L++],A>1&&(R[a++]=D[L++]))}else{L=a-P;do R[a++]=R[L++],R[a++]=R[L++],R[a++]=R[L++],A-=3;while(A>2);A&&(R[a++]=R[L++],A>1&&(R[a++]=R[L++]))}}else if(I&64){t.msg="invalid distance code",o.mode=Rm;break e}else{C=y[(C&65535)+(f&(1<<I)-1)];continue r}break}}else if(I&64)if(I&32){o.mode=Q8;break e}else{t.msg="invalid literal/length code",o.mode=Rm;break e}else{C=x[(C&65535)+(f&(1<<I)-1)];continue t}break}}while(n<i&&a<c);A=g>>3,n-=A,g-=A<<3,f&=(1<<g)-1,t.next_in=n,t.next_out=a,t.avail_in=n<i?5+(i-n):5-(n-i),t.avail_out=a<c?257+(c-a):257-(a-c),o.hold=f,o.bits=g}});var Qw=We((ez,Jw)=>{"use strict";h();var Kw=ci(),pl=15,Zw=852,Xw=592,jw=0,F0=1,qw=2,eP=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],tP=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],rP=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],oP=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];Jw.exports=function(t,r,o,n,i,a,s,c){var l=c.bits,d=0,u=0,m=0,p=0,f=0,g=0,x=0,y=0,w=0,T=0,C,I,A,P,L,D=null,M=0,R,N=new Kw.Buf16(pl+1),B=new Kw.Buf16(pl+1),K=null,V=0,ne,Q,X;for(d=0;d<=pl;d++)N[d]=0;for(u=0;u<n;u++)N[r[o+u]]++;for(f=l,p=pl;p>=1&&N[p]===0;p--);if(f>p&&(f=p),p===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,c.bits=1,0;for(m=1;m<p&&N[m]===0;m++);for(f<m&&(f=m),y=1,d=1;d<=pl;d++)if(y<<=1,y-=N[d],y<0)return-1;if(y>0&&(t===jw||p!==1))return-1;for(B[1]=0,d=1;d<pl;d++)B[d+1]=B[d]+N[d];for(u=0;u<n;u++)r[o+u]!==0&&(s[B[r[o+u]]++]=u);if(t===jw?(D=K=s,R=19):t===F0?(D=eP,M-=257,K=tP,V-=257,R=256):(D=rP,K=oP,R=-1),T=0,u=0,d=m,L=a,g=f,x=0,A=-1,w=1<<f,P=w-1,t===F0&&w>Zw||t===qw&&w>Xw)return 1;for(;;){ne=d-x,s[u]<R?(Q=0,X=s[u]):s[u]>R?(Q=K[V+s[u]],X=D[M+s[u]]):(Q=96,X=0),C=1<<d-x,I=1<<g,m=I;do I-=C,i[L+(T>>x)+I]=ne<<24|Q<<16|X|0;while(I!==0);for(C=1<<d-1;T&C;)C>>=1;if(C!==0?(T&=C-1,T+=C):T=0,u++,--N[d]===0){if(d===p)break;d=r[o+s[u]]}if(d>f&&(T&P)!==A){for(x===0&&(x=f),L+=m,g=d-x,y=1<<g;g+x<p&&(y-=N[g+x],!(y<=0));)g++,y<<=1;if(w+=1<<g,t===F0&&w>Zw||t===qw&&w>Xw)return 1;A=T&P,i[A]=f<<24|g<<16|L-a|0}}return T!==0&&(i[L+T]=d-x<<24|64<<16|0),c.bits=f,0}});var Rv=We(en=>{"use strict";h();var no=ci(),U0=C0(),On=I0(),nP=Yw(),vd=Qw(),iP=0,Cv=1,Iv=2,ev=4,aP=5,Om=6,rs=0,sP=1,lP=2,To=-2,kv=-3,W0=-4,cP=-5,tv=8,_v=1,rv=2,ov=3,nv=4,iv=5,av=6,sv=7,lv=8,cv=9,dv=10,Bm=11,mi=12,B0=13,uv=14,z0=15,mv=16,pv=17,fv=18,hv=19,Nm=20,Fm=21,gv=22,bv=23,xv=24,Ev=25,yv=26,H0=27,wv=28,vv=29,St=30,V0=31,dP=32,uP=852,mP=592,pP=15,fP=pP;function Tv(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function hP(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new no.Buf16(320),this.work=new no.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Av(e){var t;return!e||!e.state?To:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=_v,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new no.Buf32(uP),t.distcode=t.distdyn=new no.Buf32(mP),t.sane=1,t.back=-1,rs)}function Mv(e){var t;return!e||!e.state?To:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Av(e))}function Pv(e,t){var r,o;return!e||!e.state||(o=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?To:(o.window!==null&&o.wbits!==t&&(o.window=null),o.wrap=r,o.wbits=t,Mv(e))}function Lv(e,t){var r,o;return e?(o=new hP,e.state=o,o.window=null,r=Pv(e,t),r!==rs&&(e.state=null),r):To}function gP(e){return Lv(e,fP)}var Sv=!0,$0,G0;function bP(e){if(Sv){var t;for($0=new no.Buf32(512),G0=new no.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(vd(Cv,e.lens,0,288,$0,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;vd(Iv,e.lens,0,32,G0,0,e.work,{bits:5}),Sv=!1}e.lencode=$0,e.lenbits=9,e.distcode=G0,e.distbits=5}function Dv(e,t,r,o){var n,i=e.state;return i.window===null&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new no.Buf8(i.wsize)),o>=i.wsize?(no.arraySet(i.window,t,r-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(n=i.wsize-i.wnext,n>o&&(n=o),no.arraySet(i.window,t,r-o,n,i.wnext),o-=n,o?(no.arraySet(i.window,t,r-o,o,0),i.wnext=o,i.whave=i.wsize):(i.wnext+=n,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=n))),0}function xP(e,t){var r,o,n,i,a,s,c,l,d,u,m,p,f,g,x=0,y,w,T,C,I,A,P,L,D=new no.Buf8(4),M,R,N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return To;r=e.state,r.mode===mi&&(r.mode=B0),a=e.next_out,n=e.output,c=e.avail_out,i=e.next_in,o=e.input,s=e.avail_in,l=r.hold,d=r.bits,u=s,m=c,L=rs;e:for(;;)switch(r.mode){case _v:if(r.wrap===0){r.mode=B0;break}for(;d<16;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}if(r.wrap&2&&l===35615){r.check=0,D[0]=l&255,D[1]=l>>>8&255,r.check=On(r.check,D,2,0),l=0,d=0,r.mode=rv;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg="incorrect header check",r.mode=St;break}if((l&15)!==tv){e.msg="unknown compression method",r.mode=St;break}if(l>>>=4,d-=4,P=(l&15)+8,r.wbits===0)r.wbits=P;else if(P>r.wbits){e.msg="invalid window size",r.mode=St;break}r.dmax=1<<P,e.adler=r.check=1,r.mode=l&512?dv:mi,l=0,d=0;break;case rv:for(;d<16;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}if(r.flags=l,(r.flags&255)!==tv){e.msg="unknown compression method",r.mode=St;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=St;break}r.head&&(r.head.text=l>>8&1),r.flags&512&&(D[0]=l&255,D[1]=l>>>8&255,r.check=On(r.check,D,2,0)),l=0,d=0,r.mode=ov;case ov:for(;d<32;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}r.head&&(r.head.time=l),r.flags&512&&(D[0]=l&255,D[1]=l>>>8&255,D[2]=l>>>16&255,D[3]=l>>>24&255,r.check=On(r.check,D,4,0)),l=0,d=0,r.mode=nv;case nv:for(;d<16;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}r.head&&(r.head.xflags=l&255,r.head.os=l>>8),r.flags&512&&(D[0]=l&255,D[1]=l>>>8&255,r.check=On(r.check,D,2,0)),l=0,d=0,r.mode=iv;case iv:if(r.flags&1024){for(;d<16;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}r.length=l,r.head&&(r.head.extra_len=l),r.flags&512&&(D[0]=l&255,D[1]=l>>>8&255,r.check=On(r.check,D,2,0)),l=0,d=0}else r.head&&(r.head.extra=null);r.mode=av;case av:if(r.flags&1024&&(p=r.length,p>s&&(p=s),p&&(r.head&&(P=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),no.arraySet(r.head.extra,o,i,p,P)),r.flags&512&&(r.check=On(r.check,o,p,i)),s-=p,i+=p,r.length-=p),r.length))break e;r.length=0,r.mode=sv;case sv:if(r.flags&2048){if(s===0)break e;p=0;do P=o[i+p++],r.head&&P&&r.length<65536&&(r.head.name+=String.fromCharCode(P));while(P&&p<s);if(r.flags&512&&(r.check=On(r.check,o,p,i)),s-=p,i+=p,P)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=lv;case lv:if(r.flags&4096){if(s===0)break e;p=0;do P=o[i+p++],r.head&&P&&r.length<65536&&(r.head.comment+=String.fromCharCode(P));while(P&&p<s);if(r.flags&512&&(r.check=On(r.check,o,p,i)),s-=p,i+=p,P)break e}else r.head&&(r.head.comment=null);r.mode=cv;case cv:if(r.flags&512){for(;d<16;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}if(l!==(r.check&65535)){e.msg="header crc mismatch",r.mode=St;break}l=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=mi;break;case dv:for(;d<32;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}e.adler=r.check=Tv(l),l=0,d=0,r.mode=Bm;case Bm:if(r.havedict===0)return e.next_out=a,e.avail_out=c,e.next_in=i,e.avail_in=s,r.hold=l,r.bits=d,lP;e.adler=r.check=1,r.mode=mi;case mi:if(t===aP||t===Om)break e;case B0:if(r.last){l>>>=d&7,d-=d&7,r.mode=H0;break}for(;d<3;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}switch(r.last=l&1,l>>>=1,d-=1,l&3){case 0:r.mode=uv;break;case 1:if(bP(r),r.mode=Nm,t===Om){l>>>=2,d-=2;break e}break;case 2:r.mode=pv;break;case 3:e.msg="invalid block type",r.mode=St}l>>>=2,d-=2;break;case uv:for(l>>>=d&7,d-=d&7;d<32;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}if((l&65535)!==(l>>>16^65535)){e.msg="invalid stored block lengths",r.mode=St;break}if(r.length=l&65535,l=0,d=0,r.mode=z0,t===Om)break e;case z0:r.mode=mv;case mv:if(p=r.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;no.arraySet(n,o,i,p,a),s-=p,i+=p,c-=p,a+=p,r.length-=p;break}r.mode=mi;break;case pv:for(;d<14;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}if(r.nlen=(l&31)+257,l>>>=5,d-=5,r.ndist=(l&31)+1,l>>>=5,d-=5,r.ncode=(l&15)+4,l>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=St;break}r.have=0,r.mode=fv;case fv:for(;r.have<r.ncode;){for(;d<3;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}r.lens[N[r.have++]]=l&7,l>>>=3,d-=3}for(;r.have<19;)r.lens[N[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,M={bits:r.lenbits},L=vd(iP,r.lens,0,19,r.lencode,0,r.work,M),r.lenbits=M.bits,L){e.msg="invalid code lengths set",r.mode=St;break}r.have=0,r.mode=hv;case hv:for(;r.have<r.nlen+r.ndist;){for(;x=r.lencode[l&(1<<r.lenbits)-1],y=x>>>24,w=x>>>16&255,T=x&65535,!(y<=d);){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}if(T<16)l>>>=y,d-=y,r.lens[r.have++]=T;else{if(T===16){for(R=y+2;d<R;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}if(l>>>=y,d-=y,r.have===0){e.msg="invalid bit length repeat",r.mode=St;break}P=r.lens[r.have-1],p=3+(l&3),l>>>=2,d-=2}else if(T===17){for(R=y+3;d<R;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}l>>>=y,d-=y,P=0,p=3+(l&7),l>>>=3,d-=3}else{for(R=y+7;d<R;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}l>>>=y,d-=y,P=0,p=11+(l&127),l>>>=7,d-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=St;break}for(;p--;)r.lens[r.have++]=P}}if(r.mode===St)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=St;break}if(r.lenbits=9,M={bits:r.lenbits},L=vd(Cv,r.lens,0,r.nlen,r.lencode,0,r.work,M),r.lenbits=M.bits,L){e.msg="invalid literal/lengths set",r.mode=St;break}if(r.distbits=6,r.distcode=r.distdyn,M={bits:r.distbits},L=vd(Iv,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,M),r.distbits=M.bits,L){e.msg="invalid distances set",r.mode=St;break}if(r.mode=Nm,t===Om)break e;case Nm:r.mode=Fm;case Fm:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=i,e.avail_in=s,r.hold=l,r.bits=d,nP(e,m),a=e.next_out,n=e.output,c=e.avail_out,i=e.next_in,o=e.input,s=e.avail_in,l=r.hold,d=r.bits,r.mode===mi&&(r.back=-1);break}for(r.back=0;x=r.lencode[l&(1<<r.lenbits)-1],y=x>>>24,w=x>>>16&255,T=x&65535,!(y<=d);){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}if(w&&!(w&240)){for(C=y,I=w,A=T;x=r.lencode[A+((l&(1<<C+I)-1)>>C)],y=x>>>24,w=x>>>16&255,T=x&65535,!(C+y<=d);){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}l>>>=C,d-=C,r.back+=C}if(l>>>=y,d-=y,r.back+=y,r.length=T,w===0){r.mode=yv;break}if(w&32){r.back=-1,r.mode=mi;break}if(w&64){e.msg="invalid literal/length code",r.mode=St;break}r.extra=w&15,r.mode=gv;case gv:if(r.extra){for(R=r.extra;d<R;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}r.length+=l&(1<<r.extra)-1,l>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=bv;case bv:for(;x=r.distcode[l&(1<<r.distbits)-1],y=x>>>24,w=x>>>16&255,T=x&65535,!(y<=d);){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}if(!(w&240)){for(C=y,I=w,A=T;x=r.distcode[A+((l&(1<<C+I)-1)>>C)],y=x>>>24,w=x>>>16&255,T=x&65535,!(C+y<=d);){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}l>>>=C,d-=C,r.back+=C}if(l>>>=y,d-=y,r.back+=y,w&64){e.msg="invalid distance code",r.mode=St;break}r.offset=T,r.extra=w&15,r.mode=xv;case xv:if(r.extra){for(R=r.extra;d<R;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}r.offset+=l&(1<<r.extra)-1,l>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=St;break}r.mode=Ev;case Ev:if(c===0)break e;if(p=m-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=St;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),g=r.window}else g=n,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do n[a++]=g[f++];while(--p);r.length===0&&(r.mode=Fm);break;case yv:if(c===0)break e;n[a++]=r.length,c--,r.mode=Fm;break;case H0:if(r.wrap){for(;d<32;){if(s===0)break e;s--,l|=o[i++]<<d,d+=8}if(m-=c,e.total_out+=m,r.total+=m,m&&(e.adler=r.check=r.flags?On(r.check,n,m,a-m):U0(r.check,n,m,a-m)),m=c,(r.flags?l:Tv(l))!==r.check){e.msg="incorrect data check",r.mode=St;break}l=0,d=0}r.mode=wv;case wv:if(r.wrap&&r.flags){for(;d<32;){if(s===0)break e;s--,l+=o[i++]<<d,d+=8}if(l!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=St;break}l=0,d=0}r.mode=vv;case vv:L=sP;break e;case St:L=kv;break e;case V0:return W0;case dP:default:return To}return e.next_out=a,e.avail_out=c,e.next_in=i,e.avail_in=s,r.hold=l,r.bits=d,(r.wsize||m!==e.avail_out&&r.mode<St&&(r.mode<H0||t!==ev))&&Dv(e,e.output,e.next_out,m-e.avail_out)?(r.mode=V0,W0):(u-=e.avail_in,m-=e.avail_out,e.total_in+=u,e.total_out+=m,r.total+=m,r.wrap&&m&&(e.adler=r.check=r.flags?On(r.check,n,m,e.next_out-m):U0(r.check,n,m,e.next_out-m)),e.data_type=r.bits+(r.last?64:0)+(r.mode===mi?128:0)+(r.mode===Nm||r.mode===z0?256:0),(u===0&&m===0||t===ev)&&L===rs&&(L=cP),L)}function EP(e){if(!e||!e.state)return To;var t=e.state;return t.window&&(t.window=null),e.state=null,rs}function yP(e,t){var r;return!e||!e.state||(r=e.state,!(r.wrap&2))?To:(r.head=t,t.done=!1,rs)}function wP(e,t){var r=t.length,o,n,i;return!e||!e.state||(o=e.state,o.wrap!==0&&o.mode!==Bm)?To:o.mode===Bm&&(n=1,n=U0(n,t,r,0),n!==o.check)?kv:(i=Dv(e,t,r,r),i?(o.mode=V0,W0):(o.havedict=1,rs))}en.inflateReset=Mv;en.inflateReset2=Pv;en.inflateResetKeep=Av;en.inflateInit=gP;en.inflateInit2=Lv;en.inflate=xP;en.inflateEnd=EP;en.inflateGetHeader=yP;en.inflateSetDictionary=wP;en.inflateInfo="pako inflate (from Nodeca project)"});var Y0=We((nz,Ov)=>{"use strict";h();Ov.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var Fv=We((az,Nv)=>{"use strict";h();function vP(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}Nv.exports=vP});var zv=We(Sd=>{"use strict";h();var fl=Rv(),Td=ci(),zm=P0(),Ot=Y0(),K0=Im(),TP=L0(),SP=Fv(),Bv=Object.prototype.toString;function os(e){if(!(this instanceof os))return new os(e);this.options=Td.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new TP,this.strm.avail_out=0;var r=fl.inflateInit2(this.strm,t.windowBits);if(r!==Ot.Z_OK)throw new Error(K0[r]);if(this.header=new SP,fl.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=zm.string2buf(t.dictionary):Bv.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=fl.inflateSetDictionary(this.strm,t.dictionary),r!==Ot.Z_OK)))throw new Error(K0[r])}os.prototype.push=function(e,t){var r=this.strm,o=this.options.chunkSize,n=this.options.dictionary,i,a,s,c,l,d=!1;if(this.ended)return!1;a=t===~~t?t:t===!0?Ot.Z_FINISH:Ot.Z_NO_FLUSH,typeof e=="string"?r.input=zm.binstring2buf(e):Bv.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Td.Buf8(o),r.next_out=0,r.avail_out=o),i=fl.inflate(r,Ot.Z_NO_FLUSH),i===Ot.Z_NEED_DICT&&n&&(i=fl.inflateSetDictionary(this.strm,n)),i===Ot.Z_BUF_ERROR&&d===!0&&(i=Ot.Z_OK,d=!1),i!==Ot.Z_STREAM_END&&i!==Ot.Z_OK)return this.onEnd(i),this.ended=!0,!1;r.next_out&&(r.avail_out===0||i===Ot.Z_STREAM_END||r.avail_in===0&&(a===Ot.Z_FINISH||a===Ot.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=zm.utf8border(r.output,r.next_out),c=r.next_out-s,l=zm.buf2string(r.output,s),r.next_out=c,r.avail_out=o-c,c&&Td.arraySet(r.output,r.output,s,c,0),this.onData(l)):this.onData(Td.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(d=!0)}while((r.avail_in>0||r.avail_out===0)&&i!==Ot.Z_STREAM_END);return i===Ot.Z_STREAM_END&&(a=Ot.Z_FINISH),a===Ot.Z_FINISH?(i=fl.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Ot.Z_OK):(a===Ot.Z_SYNC_FLUSH&&(this.onEnd(Ot.Z_OK),r.avail_out=0),!0)};os.prototype.onData=function(e){this.chunks.push(e)};os.prototype.onEnd=function(e){e===Ot.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Td.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Z0(e,t){var r=new os(t);if(r.push(e,!0),r.err)throw r.msg||K0[r.err];return r.result}function CP(e,t){return t=t||{},t.raw=!0,Z0(e,t)}Sd.Inflate=os;Sd.inflate=Z0;Sd.inflateRaw=CP;Sd.ungzip=Z0});var Gv=We((dz,$v)=>{"use strict";h();var IP=ci().assign,kP=Ww(),_P=zv(),AP=Y0(),Hv={};IP(Hv,kP,_P,AP);$v.exports=Hv});var W=We((_z,g2)=>{h();g2.exports=React});var zn=We((Zz,S2)=>{h();S2.exports=ReactDOM});var Z3=We(Jp=>{"use strict";h();var WL=W(),VL=Symbol.for("react.element"),YL=Symbol.for("react.fragment"),KL=Object.prototype.hasOwnProperty,ZL=WL.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,XL={key:!0,ref:!0,__self:!0,__source:!0};function K3(e,t,r){var o,n={},i=null,a=null;r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(o in t)KL.call(t,o)&&!XL.hasOwnProperty(o)&&(n[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps,t)n[o]===void 0&&(n[o]=t[o]);return{$$typeof:VL,type:e,key:i,ref:a,props:n,_owner:ZL.current}}Jp.Fragment=YL;Jp.jsx=K3;Jp.jsxs=K3});var _=We((DU,X3)=>{"use strict";h();X3.exports=Z3()});var RC=We(DC=>{"use strict";h();var bc=W();function hR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gR=typeof Object.is=="function"?Object.is:hR,bR=bc.useState,xR=bc.useEffect,ER=bc.useLayoutEffect,yR=bc.useDebugValue;function wR(e,t){var r=t(),o=bR({inst:{value:r,getSnapshot:t}}),n=o[0].inst,i=o[1];return ER(function(){n.value=r,n.getSnapshot=t,W1(n)&&i({inst:n})},[e,r,t]),xR(function(){return W1(n)&&i({inst:n}),e(function(){W1(n)&&i({inst:n})})},[e]),yR(r),r}function W1(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!gR(e,r)}catch{return!0}}function vR(e,t){return t()}var TR=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?vR:wR;DC.useSyncExternalStore=bc.useSyncExternalStore!==void 0?bc.useSyncExternalStore:TR});var NC=We((QQ,OC)=>{"use strict";h();OC.exports=RC()});var BC=We(FC=>{"use strict";h();var qf=W(),SR=NC();function CR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var IR=typeof Object.is=="function"?Object.is:CR,kR=SR.useSyncExternalStore,_R=qf.useRef,AR=qf.useEffect,MR=qf.useMemo,PR=qf.useDebugValue;FC.useSyncExternalStoreWithSelector=function(e,t,r,o,n){var i=_R(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=MR(function(){function c(p){if(!l){if(l=!0,d=p,p=o(p),n!==void 0&&a.hasValue){var f=a.value;if(n(f,p))return u=f}return u=p}if(f=u,IR(d,p))return f;var g=o(p);return n!==void 0&&n(f,g)?f:(d=p,u=g)}var l=!1,d,u,m=r===void 0?null:r;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,r,o,n]);var s=kR(e,i[0],i[1]);return AR(function(){a.hasValue=!0,a.value=s},[s]),PR(s),s}});var HC=We((oee,zC)=>{"use strict";h();zC.exports=BC()});var EI=We(sh=>{"use strict";h();Object.defineProperty(sh,"__esModule",{value:!0});sh.sanitizeUrl=void 0;var $R=/^([^\w]*)(javascript|data|vbscript)/im,GR=/&#(\w+)(^\w|;)?/g,UR=/&(newline|tab);/gi,WR=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,VR=/^.+(:|&colon;)/gim,YR=[".","/"];function KR(e){return YR.indexOf(e[0])>-1}function ZR(e){return e.replace(GR,function(t,r){return String.fromCharCode(r)})}function XR(e){var t=ZR(e||"").replace(UR,"").replace(WR,"").trim();if(!t)return"about:blank";if(KR(t))return t;var r=t.match(VR);if(!r)return t;var o=r[0];return $R.test(o)?"about:blank":t}sh.sanitizeUrl=XR});var cx=We((Ane,WI)=>{h();var UI="Expected a function",$I=NaN,v9="[object Symbol]",T9=/^\s+|\s+$/g,S9=/^[-+]0x[0-9a-f]+$/i,C9=/^0b[01]+$/i,I9=/^0o[0-7]+$/i,k9=parseInt,_9=typeof global=="object"&&global&&global.Object===Object&&global,A9=typeof self=="object"&&self&&self.Object===Object&&self,M9=_9||A9||Function("return this")(),P9=Object.prototype,L9=P9.toString,D9=Math.max,R9=Math.min,lx=function(){return M9.Date.now()};function O9(e,t,r){var o,n,i,a,s,c,l=0,d=!1,u=!1,m=!0;if(typeof e!="function")throw new TypeError(UI);t=GI(t)||0,Sh(r)&&(d=!!r.leading,u="maxWait"in r,i=u?D9(GI(r.maxWait)||0,t):i,m="trailing"in r?!!r.trailing:m);function p(A){var P=o,L=n;return o=n=void 0,l=A,a=e.apply(L,P),a}function f(A){return l=A,s=setTimeout(y,t),d?p(A):a}function g(A){var P=A-c,L=A-l,D=t-P;return u?R9(D,i-L):D}function x(A){var P=A-c,L=A-l;return c===void 0||P>=t||P<0||u&&L>=i}function y(){var A=lx();if(x(A))return w(A);s=setTimeout(y,g(A))}function w(A){return s=void 0,m&&o?p(A):(o=n=void 0,a)}function T(){s!==void 0&&clearTimeout(s),l=0,o=c=n=s=void 0}function C(){return s===void 0?a:w(lx())}function I(){var A=lx(),P=x(A);if(o=arguments,n=this,c=A,P){if(s===void 0)return f(c);if(u)return s=setTimeout(y,t),p(c)}return s===void 0&&(s=setTimeout(y,t)),a}return I.cancel=T,I.flush=C,I}function N9(e,t,r){var o=!0,n=!0;if(typeof e!="function")throw new TypeError(UI);return Sh(r)&&(o="leading"in r?!!r.leading:o,n="trailing"in r?!!r.trailing:n),O9(e,t,{leading:o,maxWait:t,trailing:n})}function Sh(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function F9(e){return!!e&&typeof e=="object"}function B9(e){return typeof e=="symbol"||F9(e)&&L9.call(e)==v9}function GI(e){if(typeof e=="number")return e;if(B9(e))return $I;if(Sh(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Sh(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(T9,"");var r=C9.test(e);return r||I9.test(e)?k9(e.slice(2),r?2:8):S9.test(e)?$I:+e}WI.exports=N9});h();var zy=S(Yy(),1),Hy=S(qy(),1),TM=S(tw(),1);h();var d0=S(Gv(),1);h();h();var X0={};h();var rt={white:"#ffffff",black:"#000000",gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};var LP=(e,t)=>t.reduce((r,o)=>(o in e&&(r[o]=e[o]),r),{}),Uv=5,ns=5,Wv=4,hl=4,gl=1,tn=[0,2,4,6,8];var rn=(e,t)=>t.map(r=>rt[e][r]),ge={transparent:"transparent",black:"#1e1e1e",white:"#ffffff",gray:rn("gray",tn),red:rn("red",tn),pink:rn("pink",tn),grape:rn("grape",tn),violet:rn("violet",tn),blue:rn("blue",tn),cyan:rn("cyan",tn),teal:rn("teal",tn),green:rn("green",tn),yellow:rn("yellow",tn),orange:rn("orange",tn),bronze:["#f8f1ee","#eaddd7","#d2bab0","#a18072","#846358"]},Vv=LP(ge,["cyan","blue","violet","grape","pink","green","teal","yellow","orange","red"]),Hm=[ge.black,ge.red[hl],ge.green[hl],ge.blue[hl],ge.yellow[hl]],$m=[ge.transparent,ge.red[gl],ge.green[gl],ge.blue[gl],ge.yellow[gl]],Gm=[ge.white,"#f8f9fa","#f5faff","#fffce8","#fdf8f6"],Yv={transparent:ge.transparent,white:ge.white,gray:ge.gray,black:ge.black,bronze:ge.bronze,...Vv},Kv={transparent:ge.transparent,white:ge.white,gray:ge.gray,black:ge.black,bronze:ge.bronze,...Vv},Zv=e=>[ge.cyan[e],ge.blue[e],ge.violet[e],ge.grape[e],ge.pink[e],ge.green[e],ge.teal[e],ge.yellow[e],ge.orange[e],ge.red[e]],Xv=(e,t,r)=>`#${((1<<24)+(e<<16)+(t<<8)+r).toString(16).slice(1)}`;var Dr=/Mac|iPod|iPhone|iPad/.test(navigator.platform),Um=/^Win/.test(navigator.platform),Ez=/\b(android)\b/i.test(navigator.userAgent),ta="netscape"in window&&navigator.userAgent.indexOf("rv:")>1&&navigator.userAgent.indexOf("Gecko")>1,DP=navigator.userAgent.indexOf("Chrome")!==-1,Wm=!DP&&navigator.userAgent.indexOf("Safari")!==-1,jv=/iPad|iPhone/.test(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,qv=()=>navigator.brave?.isBrave?.name==="isBrave",Cd="Excalidraw",pi=10,bl=8,Jv=5,j0=1,Qv=30,Nn=Math.PI/12,Ue={TEXT:"text",CROSSHAIR:"crosshair",GRABBING:"grabbing",GRAB:"grab",POINTER:"pointer",MOVE:"move",AUTO:""},ra={MAIN:0,WHEEL:1,SECONDARY:2,TOUCH:-1,ERASER:5},is={enabled:"all",disabled:"none",inheritFromUI:"var(--ui-pointerEvents)"};var Id={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},q0={TEST:"test",DEVELOPMENT:"development"},Vm={SHAPE_ACTIONS_MENU:"App-menu__left"},qt={Virgil:1,Helvetica:2,Cascadia:3,Assistant:4},gt={LIGHT:"light",DARK:"dark"},ut={strokeColor:"#bbb",strokeWidth:2,strokeStyle:"solid",fillStyle:"solid",roughness:0,roundness:null,backgroundColor:"transparent",radius:8,nameOffsetY:3,nameColorLightTheme:"#999999",nameColorDarkTheme:"#7a7a7a",nameFontSize:14,nameLineHeight:1.25},J0="Segoe UI Emoji",Ym=1,Jt=20,pr=qt.Virgil,oa="left",as="top";var fi=20,kd={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",jfif:"image/jfif"},e2=["text/plain","text/html"],ae={json:"application/json",excalidraw:"application/vnd.excalidraw+json",excalidrawlib:"application/vnd.excalidrawlib+json","excalidraw.svg":"image/svg+xml","excalidraw.png":"image/png",binary:"application/octet-stream",...kd},Km={png:"png",svg:"svg",clipboard:"clipboard"},yr={excalidraw:"excalidraw",excalidrawClipboard:"excalidraw/clipboard",excalidrawLibrary:"excalidrawlib",excalidrawClipboardWithAPI:"excalidraw-api/clipboard"},_d=window.EXCALIDRAW_EXPORT_SOURCE||window.location.origin,t2=500,r2=300,o2=500;var n2=100,ss=.1,Zm=.1,i2=300;var xl=X0.themeFilter,Xm={addLibrary:"addLibrary"},jm={addLibrary:"addLibrary"},Q0={canvasActions:{changeViewBackgroundColor:!0,clearCanvas:!0,export:{saveFileToDisk:!0},loadScene:!0,saveToActiveFile:!0,toggleTheme:null,saveAsImage:!0},tools:{image:!0}},a2=730,s2=1e3,l2=500,c2=1229,d2=parseInt(X0.rightSidebarWidth),El=2,yl=[1,2,3],on=10,u2=1440,eb=2*1024*1024,mt="http://www.w3.org/2000/svg";var ls={excalidraw:2,excalidrawLibrary:2},Pt=5,m2=.7,p2=11,Nt={TOP:"top",MIDDLE:"middle",BOTTOM:"bottom"},na={LEFT:"left",CENTER:"center",RIGHT:"right"},f2=20,qm=.25,h2=32,Ct={LEGACY:1,PROPORTIONAL_RADIUS:2,ADAPTIVE_RADIUS:3},Jm="__precedingElement__",tb={architect:0,artist:1,cartoonist:2},Qm={thin:1,bold:2,extraBold:4},pt={strokeColor:ge.black,backgroundColor:ge.transparent,fillStyle:"solid",strokeWidth:2,strokeStyle:"solid",roughness:tb.artist,opacity:100,locked:!1},Ad="library",Fn={name:"default",defaultTab:Ad},ep=new Set(["iframe","embeddable","image"]),Ft={selection:"selection",rectangle:"rectangle",diamond:"diamond",ellipse:"ellipse",arrow:"arrow",line:"line",freedraw:"freedraw",text:"text",image:"image",eraser:"eraser",hand:"hand",frame:"frame",magicframe:"magicframe",embeddable:"embeddable",laser:"laser"},So={OAI_API_KEY:"excalidraw-oai-api-key",MERMAID_TO_EXCALIDRAW:"mermaid-to-excalidraw",PUBLISH_LIBRARY:"publish-library-data"};h();h();h();var wl=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,r)=>(r&=63,r<36?t+=r.toString(36):r<62?t+=(r-26).toString(36).toUpperCase():r>62?t+="-":t+="_",t),"");h();h();h();h();var Bt=S(W(),1);h();var RP=0;function b2(e,t){let r=`atom${++RP}`,o={toString:()=>r};return typeof e=="function"?o.read=e:(o.init=e,o.read=n=>n(o),o.write=(n,i,a)=>i(o,typeof a=="function"?a(n(o)):a)),t&&(o.write=t),o}var ia=Symbol(),ob=e=>!!e[ia],tp=e=>!e[ia].c,Md=e=>{var t;let{b:r,c:o}=e[ia];o&&(o(),(t=NP.get(r))==null||t())},op=(e,t)=>{let r=e[ia].o,o=t[ia].o;return r===o||e===o||ob(r)&&op(r,t)},nb=(e,t)=>{let r={b:e,o:t,c:null},o=new Promise(n=>{r.c=()=>{r.c=null,n()},t.finally(r.c)});return o[ia]=r,o},OP=e=>nb(e[ia].b,e[ia].o),NP=new WeakMap;var rp=e=>"init"in e,Pd="r",np="w",Ld="c",ip="s",x2="h",FP="n",BP="l",zP="a",HP="m",E2=e=>{let t=new WeakMap,r=new WeakMap,o=new Map,n,i;if((v&&v.MODE)!=="production"&&(n=new Set,i=new Set),e)for(let[O,F]of e){let $={v:F,r:0,y:!0,d:new Map};(v&&v.MODE)!=="production"&&(Object.freeze($),rp(O)||console.warn("Found initial value for derived atom which can cause unexpected behavior",O)),t.set(O,$)}let a=new WeakMap,s=(O,F,$)=>{let j=a.get(F);j||(j=new Map,a.set(F,j)),$.then(()=>{j.get(O)===$&&(j.delete(O),j.size||a.delete(F))}),j.set(O,$)},c=O=>{let F=new Set,$=a.get(O);return $&&(a.delete(O),$.forEach((j,q)=>{Md(j),F.add(q)})),F},l=new WeakMap,d=O=>{let F=l.get(O);return F||(F=new Map,l.set(O,F)),F},u=(O,F)=>{if(O){let $=d(O),j=$.get(F);return j||(j=u(O.p,F),j&&"p"in j&&tp(j.p)&&(j=void 0),j&&$.set(F,j)),j}return t.get(F)},m=(O,F,$)=>{if((v&&v.MODE)!=="production"&&Object.freeze($),O)d(O).set(F,$);else{let j=t.get(F);t.set(F,$),o.has(F)||o.set(F,j)}},p=(O,F=new Map,$)=>{if(!$)return F;let j=new Map,q=!1;return $.forEach(J=>{var te;let ce=((te=u(O,J))==null?void 0:te.r)||0;j.set(J,ce),F.get(J)!==ce&&(q=!0)}),F.size===j.size&&!q?F:j},f=(O,F,$,j,q)=>{let J=u(O,F);if(J){if(q&&(!("p"in J)||!op(J.p,q)))return J;"p"in J&&Md(J.p)}let te={v:$,r:J?.r||0,y:!0,d:p(O,J?.d,j)},ce=!J?.y;return!J||!("v"in J)||!Object.is(J.v,$)?(ce=!0,++te.r,te.d.has(F)&&(te.d=new Map(te.d).set(F,te.r))):te.d!==J.d&&(te.d.size!==J.d.size||!Array.from(te.d.keys()).every(it=>J.d.has(it)))&&(ce=!0,Promise.resolve().then(()=>{V(O)})),J&&!ce?J:(m(O,F,te),te)},g=(O,F,$,j,q)=>{let J=u(O,F);if(J){if(q&&(!("p"in J)||!op(J.p,q)))return J;"p"in J&&Md(J.p)}let te={e:$,r:(J?.r||0)+1,y:!0,d:p(O,J?.d,j)};return m(O,F,te),te},x=(O,F,$,j)=>{let q=u(O,F);if(q&&"p"in q){if(op(q.p,$)&&!tp(q.p))return q.y?q:{...q,y:!0};Md(q.p)}s(O,F,$);let J={p:$,r:(q?.r||0)+1,y:!0,d:p(O,q?.d,j)};return m(O,F,J),J},y=(O,F,$,j)=>{if($ instanceof Promise){let q=nb($,$.then(J=>{f(O,F,J,j,q)}).catch(J=>{if(J instanceof Promise)return ob(J)?J.then(()=>{T(O,F,!0)}):J;g(O,F,J,j,q)}));return x(O,F,q,j)}return f(O,F,$,j)},w=(O,F)=>{let $=u(O,F);if($){let j={...$,y:!1};m(O,F,j)}else(v&&v.MODE)!=="production"&&console.warn("[Bug] could not invalidate non existing atom",F)},T=(O,F,$)=>{if(!$){let q=u(O,F);if(q){if(q.y&&"p"in q&&!tp(q.p))return q;if(q.d.forEach((J,te)=>{if(te!==F)if(!r.has(te))T(O,te);else{let ce=u(O,te);ce&&!ce.y&&T(O,te)}}),Array.from(q.d).every(([J,te])=>{let ce=u(O,J);return ce&&!("p"in ce)&&ce.r===te}))return q.y?q:{...q,y:!0}}}let j=new Set;try{let q=F.read(J=>{j.add(J);let te=J===F?u(O,J):T(O,J);if(te){if("e"in te)throw te.e;if("p"in te)throw te.p;return te.v}if(rp(J))return J.init;throw new Error("no atom init")});return y(O,F,q,j)}catch(q){if(q instanceof Promise){let J=ob(q)&&tp(q)?OP(q):nb(q,q);return x(O,F,J,j)}return g(O,F,q,j)}},C=(O,F)=>T(F,O),I=(O,F)=>{let $=r.get(F);return $||($=N(O,F)),$},A=(O,F)=>!F.l.size&&(!F.t.size||F.t.size===1&&F.t.has(O)),P=(O,F)=>{let $=r.get(F);$&&A(F,$)&&B(O,F)},L=(O,F)=>{let $=r.get(F);$?.t.forEach(j=>{j!==F&&(w(O,j),L(O,j))})},D=(O,F,$)=>{let j=!0,q=(ce,it)=>{let Ge=T(O,ce);if("e"in Ge)throw Ge.e;if("p"in Ge){if(it?.unstable_promise)return Ge.p.then(()=>{let Be=u(O,ce);return Be&&"p"in Be&&Be.p===Ge.p?new Promise(ke=>setTimeout(ke)).then(()=>q(ce,it)):q(ce,it)});throw(v&&v.MODE)!=="production"&&console.info("Reading pending atom state in write operation. We throw a promise for now.",ce),Ge.p}if("v"in Ge)return Ge.v;throw(v&&v.MODE)!=="production"&&console.warn("[Bug] no value found while reading atom in write operation. This is probably a bug.",ce),new Error("no value found")},J=(ce,it)=>{let Ge;if(ce===F){if(!rp(ce))throw new Error("atom not writable");c(ce).forEach(ol=>{ol!==O&&y(ol,ce,it)});let ke=u(O,ce),Mt=y(O,ce,it);ke!==Mt&&L(O,ce)}else Ge=D(O,ce,it);return j||V(O),Ge},te=F.write(q,J,$);return j=!1,te},M=(O,F,$)=>{let j=D($,O,F);return V($),j},R=O=>!!O.write,N=(O,F,$)=>{let j={t:new Set($&&[$]),l:new Set};if(r.set(F,j),(v&&v.MODE)!=="production"&&i.add(F),T(void 0,F).d.forEach((J,te)=>{let ce=r.get(te);ce?ce.t.add(F):te!==F&&N(O,te,F)}),R(F)&&F.onMount){let J=ce=>M(F,ce,O),te=F.onMount(J);O=void 0,te&&(j.u=te)}return j},B=(O,F)=>{var $;let j=($=r.get(F))==null?void 0:$.u;j&&j(),r.delete(F),(v&&v.MODE)!=="production"&&i.delete(F);let q=u(O,F);q?("p"in q&&Md(q.p),q.d.forEach((J,te)=>{if(te!==F){let ce=r.get(te);ce&&(ce.t.delete(F),A(te,ce)&&B(O,te))}})):(v&&v.MODE)!=="production"&&console.warn("[Bug] could not find atom state to unmount",F)},K=(O,F,$,j)=>{let q=new Set($.d.keys());j?.forEach((J,te)=>{if(q.has(te)){q.delete(te);return}let ce=r.get(te);ce&&(ce.t.delete(F),A(te,ce)&&B(O,te))}),q.forEach(J=>{let te=r.get(J);te?te.t.add(F):r.has(F)&&N(O,J,F)})},V=O=>{if(O){d(O).forEach(($,j)=>{let q=t.get(j);if($!==q){let J=r.get(j);J?.l.forEach(te=>te(O))}});return}for(;o.size;){let F=Array.from(o);o.clear(),F.forEach(([$,j])=>{let q=u(void 0,$);if(q&&q.d!==j?.d&&K(void 0,$,q,j?.d),j&&!j.y&&q?.y)return;let J=r.get($);J?.l.forEach(te=>te())})}(v&&v.MODE)!=="production"&&n.forEach(F=>F())},ne=O=>{d(O).forEach(($,j)=>{let q=t.get(j);(!q||$.r>q.r||$.y!==q.y||$.r===q.r&&$.d!==q.d)&&(t.set(j,$),$.d!==q?.d&&K(O,j,$,q?.d))})},Q=(O,F)=>{F&&ne(F),V(void 0)},X=(O,F,$)=>{let q=I($,O).l;return q.add(F),()=>{q.delete(F),P($,O)}},se=(O,F)=>{for(let[$,j]of O)rp($)&&(y(F,$,j),L(F,$));V(F)};return(v&&v.MODE)!=="production"?{[Pd]:C,[np]:M,[Ld]:Q,[ip]:X,[x2]:se,[FP]:O=>(n.add(O),()=>{n.delete(O)}),[BP]:()=>i.values(),[zP]:O=>t.get(O),[HP]:O=>r.get(O)}:{[Pd]:C,[np]:M,[Ld]:Q,[ip]:X,[x2]:se}},y2=e=>{let t=E2(e),r=a=>{let s=t[Pd](a);if("e"in s)throw s.e;if(!("p"in s))return s.v},o=a=>new Promise((s,c)=>{let l=t[Pd](a);"e"in l?c(l.e):"p"in l?s(l.p.then(()=>o(a))):s(l.v)});return{get:r,asyncGet:o,set:(a,s)=>t[np](a,s),sub:(a,s)=>t[ip](a,s),SECRET_INTERNAL_store:t}},w2=(e,t)=>({s:t?t(e).SECRET_INTERNAL_store:E2(e)}),rb=new Map,ib=e=>(rb.has(e)||rb.set(e,(0,Bt.createContext)(w2())),rb.get(e)),ap=({children:e,initialValues:t,scope:r,unstable_createStore:o,unstable_enableVersionedWrite:n})=>{let[i,a]=(0,Bt.useState)({});(0,Bt.useEffect)(()=>{let l=s.current;l.w&&(l.s[Ld](null,i),delete i.p,l.v=i)},[i]);let s=(0,Bt.useRef)();if(!s.current){let l=w2(t,o);if(n){let d=0;l.w=u=>{a(m=>{let p=d?m:{p:m};return u(p),p})},l.v=i,l.r=u=>{++d,u(),--d}}s.current=l}let c=ib(r);return(0,Bt.createElement)(c.Provider,{value:s.current},e)};function bt(e,t){return b2(e,t)}function Dd(e,t){let r=ib(t),o=(0,Bt.useContext)(r),{s:n,v:i}=o,a=m=>{let p=n[Pd](e,m);if((v&&v.MODE)!=="production"&&!p.y)throw new Error("should not be invalidated");if("e"in p)throw p.e;if("p"in p)throw p.p;if("v"in p)return p.v;throw new Error("no atom value")},[[s,c,l],d]=(0,Bt.useReducer)((m,p)=>{let f=a(p);return Object.is(m[1],f)&&m[2]===e?m:[p,f,e]},i,m=>{let p=a(m);return[m,p,e]}),u=c;return l!==e&&(d(s),u=a(s)),(0,Bt.useEffect)(()=>{let{v:m}=o;m&&n[Ld](e,m);let p=n[ip](e,d,m);return d(m),p},[n,e,o]),(0,Bt.useEffect)(()=>{n[Ld](e,s)}),(0,Bt.useDebugValue)(u),u}function hi(e,t){let r=ib(t),{s:o,w:n}=(0,Bt.useContext)(r);return(0,Bt.useCallback)(a=>{if((v&&v.MODE)!=="production"&&!("write"in e))throw new Error("not writable atom");let s=c=>o[np](e,a,c);return n?n(s):s()},[o,n,e])}function Ne(e,t){return"scope"in e&&(console.warn("atom.scope is deprecated. Please do useAtom(atom, scope) instead."),t=e.scope),[Dd(e,t),hi(e,t)]}var $P=S(W(),1),qe=Symbol(),Kr=y2();var GP=Gy({"./locales/ar-SA.json":()=>import("./ar-SA-MV5ZQ2W5.js"),"./locales/az-AZ.json":()=>import("./az-AZ-BK6PNAXT.js"),"./locales/bg-BG.json":()=>import("./bg-BG-GCTBXIHZ.js"),"./locales/bn-BD.json":()=>import("./bn-BD-QTMQMM2A.js"),"./locales/ca-ES.json":()=>import("./ca-ES-CJKR7U4D.js"),"./locales/cs-CZ.json":()=>import("./cs-CZ-E6RD7VRF.js"),"./locales/da-DK.json":()=>import("./da-DK-GA7WAOB4.js"),"./locales/de-DE.json":()=>import("./de-DE-WQGVYODE.js"),"./locales/el-GR.json":()=>import("./el-GR-JRKZ7DCA.js"),"./locales/en.json":()=>import("./en-ERQOR3OC.js"),"./locales/es-ES.json":()=>import("./es-ES-NNAEPTPN.js"),"./locales/eu-ES.json":()=>import("./eu-ES-UXVZRSMJ.js"),"./locales/fa-IR.json":()=>import("./fa-IR-FFXQODN6.js"),"./locales/fi-FI.json":()=>import("./fi-FI-FVRWY4PK.js"),"./locales/fr-FR.json":()=>import("./fr-FR-YRAHLNH4.js"),"./locales/gl-ES.json":()=>import("./gl-ES-O3MFXO2J.js"),"./locales/he-IL.json":()=>import("./he-IL-UQHONTOV.js"),"./locales/hi-IN.json":()=>import("./hi-IN-QGM3FMHS.js"),"./locales/hu-HU.json":()=>import("./hu-HU-FW4UHMDU.js"),"./locales/id-ID.json":()=>import("./id-ID-QOMISFYK.js"),"./locales/it-IT.json":()=>import("./it-IT-NXPSTWVC.js"),"./locales/ja-JP.json":()=>import("./ja-JP-Z7I24KT4.js"),"./locales/kaa.json":()=>import("./kaa-TXMSCJDQ.js"),"./locales/kab-KAB.json":()=>import("./kab-KAB-RJXRUTDO.js"),"./locales/kk-KZ.json":()=>import("./kk-KZ-JXPULSST.js"),"./locales/km-KH.json":()=>import("./km-KH-WRGO6AYW.js"),"./locales/ko-KR.json":()=>import("./ko-KR-GAYOVASS.js"),"./locales/ku-TR.json":()=>import("./ku-TR-DJF4NWRZ.js"),"./locales/lt-LT.json":()=>import("./lt-LT-QQGY3S4X.js"),"./locales/lv-LV.json":()=>import("./lv-LV-H55DY45V.js"),"./locales/mr-IN.json":()=>import("./mr-IN-QYT2ELER.js"),"./locales/my-MM.json":()=>import("./my-MM-RRPBSH5R.js"),"./locales/nb-NO.json":()=>import("./nb-NO-AMX3MAHH.js"),"./locales/nl-NL.json":()=>import("./nl-NL-LZSLKN37.js"),"./locales/nn-NO.json":()=>import("./nn-NO-WWXPMJY7.js"),"./locales/oc-FR.json":()=>import("./oc-FR-GPZCMCGX.js"),"./locales/pa-IN.json":()=>import("./pa-IN-L5H3H4OA.js"),"./locales/percentages.json":()=>import("./percentages-L6Y3A3ZS.js"),"./locales/pl-PL.json":()=>import("./pl-PL-SYTLCLU7.js"),"./locales/pt-BR.json":()=>import("./pt-BR-BJOSVXBP.js"),"./locales/pt-PT.json":()=>import("./pt-PT-QHWDKICL.js"),"./locales/ro-RO.json":()=>import("./ro-RO-AVSXCJHH.js"),"./locales/ru-RU.json":()=>import("./ru-RU-5Z6AY4FG.js"),"./locales/si-LK.json":()=>import("./si-LK-OMROCHR3.js"),"./locales/sk-SK.json":()=>import("./sk-SK-TLXIBWPH.js"),"./locales/sl-SI.json":()=>import("./sl-SI-JELDMWCI.js"),"./locales/sv-SE.json":()=>import("./sv-SE-2FAONS47.js"),"./locales/ta-IN.json":()=>import("./ta-IN-XN7DVSDK.js"),"./locales/th-TH.json":()=>import("./th-TH-VCIYWJPR.js"),"./locales/tr-TR.json":()=>import("./tr-TR-6QL6T7SM.js"),"./locales/uk-UA.json":()=>import("./uk-UA-Y6YRBHAO.js"),"./locales/vi-VN.json":()=>import("./vi-VN-34I6LTAE.js"),"./locales/zh-CN.json":()=>import("./zh-CN-IGKEMUHO.js"),"./locales/zh-HK.json":()=>import("./zh-HK-MDAU5TWB.js"),"./locales/zh-TW.json":()=>import("./zh-TW-DOGEFI3C.js")});var UP=85,Bn={code:"en",label:"English"},Tl=[Bn,...[{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",rtl:!0},{code:"bg-BG",label:"\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438"},{code:"ca-ES",label:"Catal\xE0"},{code:"cs-CZ",label:"\u010Cesky"},{code:"de-DE",label:"Deutsch"},{code:"el-GR",label:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"},{code:"es-ES",label:"Espa\xF1ol"},{code:"eu-ES",label:"Euskara"},{code:"fa-IR",label:"\u0641\u0627\u0631\u0633\u06CC",rtl:!0},{code:"fi-FI",label:"Suomi"},{code:"fr-FR",label:"Fran\xE7ais"},{code:"gl-ES",label:"Galego"},{code:"he-IL",label:"\u05E2\u05D1\u05E8\u05D9\u05EA",rtl:!0},{code:"hi-IN",label:"\u0939\u093F\u0928\u094D\u0926\u0940"},{code:"hu-HU",label:"Magyar"},{code:"id-ID",label:"Bahasa Indonesia"},{code:"it-IT",label:"Italiano"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E"},{code:"kab-KAB",label:"Taqbaylit"},{code:"kk-KZ",label:"\u049A\u0430\u0437\u0430\u049B \u0442\u0456\u043B\u0456"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4"},{code:"ku-TR",label:"Kurd\xEE"},{code:"lt-LT",label:"Lietuvi\u0173"},{code:"lv-LV",label:"Latvie\u0161u"},{code:"my-MM",label:"Burmese"},{code:"nb-NO",label:"Norsk bokm\xE5l"},{code:"nl-NL",label:"Nederlands"},{code:"nn-NO",label:"Norsk nynorsk"},{code:"oc-FR",label:"Occitan"},{code:"pa-IN",label:"\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40"},{code:"pl-PL",label:"Polski"},{code:"pt-BR",label:"Portugu\xEAs Brasileiro"},{code:"pt-PT",label:"Portugu\xEAs"},{code:"ro-RO",label:"Rom\xE2n\u0103"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},{code:"sk-SK",label:"Sloven\u010Dina"},{code:"sv-SE",label:"Svenska"},{code:"sl-SI",label:"Sloven\u0161\u010Dina"},{code:"tr-TR",label:"T\xFCrk\xE7e"},{code:"uk-UA",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"},{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587"},{code:"vi-VN",label:"Ti\u1EBFng Vi\u1EC7t"},{code:"mr-IN",label:"\u092E\u0930\u093E\u0920\u0940"}].filter(e=>Uy[e.code]>=UP).sort((e,t)=>e.label>t.label?1:-1)],lp="__test__";v.DEV&&Tl.unshift({code:lp,label:"test language"},{code:`${lp}.rtl`,label:"\u202Atest language (rtl)\u202C",rtl:!0});var vl=Bn,sp={},cp=async e=>{if(vl=e,document.documentElement.dir=vl.rtl?"rtl":"ltr",document.documentElement.lang=vl.code,e.code.startsWith(lp))sp={};else try{sp=await GP(`./locales/${vl.code}.json`)}catch(t){console.error(`Failed to load language ${e.code}:`,t.message),sp=u0}Kr.set(T2,e.code)},gi=()=>vl,v2=(e,t)=>{for(let r=0;r<t.length;++r){let o=t[r];if(e[o]===void 0)return;e=e[o]}if(typeof e=="string")return e},E=(e,t,r)=>{if(vl.code.startsWith(lp))return`\u202A[[${t?`${e}(${JSON.stringify(t).slice(1,-1)})`:e}]]\u202C`;let o=e.split("."),n=v2(sp,o)||v2(u0,o)||r;if(n===void 0){let i=`Can't find translation for ${e}`;if(v.PROD)return console.warn(i),"";throw new Error(i)}if(t)for(let i in t)n=n.replace(`{{${i}}}`,String(t[i]));return n},T2=bt(Bn.code),or=()=>{let e=Dd(T2,qe);return{t:E,langCode:e}};h();var ab=S(zn(),1),_2=S(W(),1),C2=null;var A2=()=>{if(C2)return C2;let e=new Date,t=e.getFullYear(),r=`${e.getMonth()+1}`.padStart(2,"0"),o=`${e.getDate()}`.padStart(2,"0"),n=`${e.getHours()}`.padStart(2,"0"),i=`${e.getMinutes()}`.padStart(2,"0");return`${t}-${r}-${o}-${n}${i}`},Sl=e=>e.charAt(0).toUpperCase()+e.slice(1),M2=e=>e instanceof HTMLElement&&e.className.includes("ToolIcon"),sb=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,P2=e=>sb(e)||e instanceof Element&&!!e.closest("label, button"),Hn=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&(e.type==="text"||e.type==="number"||e.type==="password"),Cl=({fontFamily:e})=>{for(let[t,r]of Object.entries(qt))if(r===e)return`${t}, ${J0}`;return J0},Ve=({fontSize:e,fontFamily:t})=>`${e}px ${Cl({fontFamily:t})}`,cs=(e,t)=>{let r=0,o=null,n=(...i)=>{o=i,clearTimeout(r),r=window.setTimeout(()=>{o=null,e(...i)},t)};return n.flush=()=>{if(clearTimeout(r),o){let i=o;o=null,e(...i)}},n.cancel=()=>{o=null,clearTimeout(r)},n},dp=(e,t)=>{let r=null,o=null,n=null,i=s=>{r=window.requestAnimationFrame(()=>{r=null,e(...s),o=null,n&&(o=n,n=null,i(o))})},a=(...s)=>{if(v.MODE==="test"){e(...s);return}o=s,r===null?i(o):t?.trailing&&(n=s)};return a.flush=()=>{r!==null&&(cancelAnimationFrame(r),r=null),o&&(e(...n||o),o=n=null)},a.cancel=()=>{o=n=null,r!==null&&(cancelAnimationFrame(r),r=null)},a},up=e=>1-Math.pow(1-e,4),I2=(e,t,r)=>(t-e)*up(r)+e,L2=({fromValues:e,toValues:t,onStep:r,duration:o=250,interpolateValue:n,onStart:i,onEnd:a,onCancel:s})=>{let c=!1,l=0,d;function u(m){if(c)return;d===void 0&&(d=m,i?.());let p=Math.min(m-d,o),f=up(p/o),g={};if(Object.keys(e).forEach(x=>{let y=x,w=(t[y]-e[y])*f+e[y];g[y]=w}),r(g),p<o){let x=p/o,y={};Object.keys(e).forEach(w=>{let T=w,C=e[T],I=t[T],A;A=n?n(C,I,x,T):I2(C,I,x),A==null&&(A=I2(C,I,x)),y[T]=A}),r(y),l=window.requestAnimationFrame(u)}else r(t),a?.()}return l=window.requestAnimationFrame(u),()=>{s?.(),c=!0,window.cancelAnimationFrame(l)}},D2=(e,t)=>{if(!e.length||t<1)return[];let r=0,o=0,n=Array(Math.ceil(e.length/t));for(;r<e.length;)n[o++]=e.slice(r,r+=t);return n};var Qt=(e,t)=>Math.abs(e-t),st=(e,t)=>t.type==="custom"?{...e.activeTool,type:"custom",customType:t.customType,locked:t.locked??e.activeTool.locked}:{...e.activeTool,lastActiveTool:t.lastActiveToolBeforeEraser===void 0?e.activeTool.lastActiveTool:t.lastActiveToolBeforeEraser,type:t.type,customType:null,locked:t.locked??e.activeTool.locked};var H=e=>(e=e.replace(/\bAlt\b/i,"Alt").replace(/\bShift\b/i,"Shift").replace(/\b(Enter|Return)\b/i,"Enter"),Dr?e.replace(/\bCtrlOrCmd\b/gi,"Cmd").replace(/\bAlt\b/i,"Option"):e.replace(/\bCtrlOrCmd\b/gi,"Ctrl")),ot=({clientX:e,clientY:t},{zoom:r,offsetLeft:o,offsetTop:n,scrollX:i,scrollY:a})=>{let s=(e-o)/r.value-i,c=(t-n)/r.value-a;return{x:s,y:c}},nr=({sceneX:e,sceneY:t},{zoom:r,offsetLeft:o,offsetTop:n,scrollX:i,scrollY:a})=>{let s=(e+i)*r.value+o,c=(t+a)*r.value+n;return{x:s,y:c}},Rd=e=>getComputedStyle(document.documentElement).getPropertyValue(`--${e}`),WP="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF",VP="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",YP=new RegExp(`^[^${WP}]*[${VP}]`),lb=e=>YP.test(e),nn=e=>{let[t,r]=e;return{x:t,y:r}},mp=e=>{if(e?.name==="AbortError"){console.warn(e);return}throw e},cb=(e,t,r=0)=>{r<0&&(r=e.length+r),r=Math.min(e.length,Math.max(r,0));let o=r-1;for(;++o<e.length;)if(t(e[o],o,e))return o;return-1},db=(e,t,r=e.length-1)=>{r<0&&(r=e.length+r),r=Math.min(e.length-1,Math.max(r,0));let o=r+1;for(;--o>-1;)if(t(e[o],o,e))return o;return-1},Rr=e=>{let t=e.length===5&&e.substr(4,1)==="0",r=e.length===9&&e.substr(7,2)==="00";return t||r||e===ge.transparent};var xt=e=>t=>{(0,ab.unstable_batchedUpdates)(e,t)},pp=e=>dp(t=>{(0,ab.unstable_batchedUpdates)(e,t)});var R2=e=>{let t=e.parentElement;for(;t;){if(t===document.body)return document;let{overflowY:r}=window.getComputedStyle(t);if(t.scrollHeight>t.clientHeight&&(r==="auto"||r==="scroll"||r==="overlay"))return t;t=t.parentElement}return document},O2=e=>{let t=e.parentElement;for(;t;){if(t.tabIndex>-1){t.focus();return}t=t.parentElement}};var N2=e=>Array.from(e).map(t=>`0${t.toString(16)}`.slice(-2)).join(""),bi=()=>io()?1:Date.now(),He=e=>e.reduce((t,r)=>(t.set(typeof r=="string"?r:r.id,r),t),new Map),F2=e=>e.reduce((t,r,o)=>(t.set(r.id,[r,o]),t),new Map),io=()=>v.MODE==="test",fp=(e,t)=>new CustomEvent(e,{detail:{nativeEvent:t},cancelable:!0}),Il=(e,t)=>{let r=!1;for(let o in t){let n=t[o];if(typeof n<"u"){if(e[o]===n&&(typeof n!="object"||n===null))continue;r=!0}}return r?{...e,...t}:e};var B2=()=>{try{return window.self===window.top?"top":"iframe"}catch{return"iframe"}};var hp=e=>!!e&&typeof e=="object"&&"then"in e&&"catch"in e&&"finally"in e,Od=e=>{let t=e?.querySelectorAll("button, a, input, select, textarea, div[tabindex], label[tabindex]");return t?Array.from(t).filter(r=>r.tabIndex>-1&&!r.disabled):[]},k2=(e,t)=>Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t,$t=(e,t,r,o=!1)=>{let n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;if(r&&Array.isArray(r)){for(let a of r)if(!(e[a]===t[a]||k2(e[a],t[a])))return o&&console.warn(`%cisShallowEqual: ${a} not equal ->`,"color: #8B4000",e[a],t[a]),!1;return!0}return n.every(a=>{let s=r?.[a],c=s?s(e[a],t[a]):e[a]===t[a]||k2(e[a],t[a]);return!c&&o&&console.warn(`%cisShallowEqual: ${a} not equal ->`,"color: #8B4000",e[a],t[a]),c})},aa=(e,t,{checkForDefaultPrevented:r=!0}={})=>function(n){if(e?.(n),!r||!n.defaultPrevented)return t?.(n)},sa=(e,t,r)=>{if(!t)return e;if(r)return console.error(t),e;throw new Error(t)},z2=e=>{let t,r,o=function(n){let i=Object.entries(n);if(t){let s=!0;for(let[c,l]of i)if(t.get(c)!==l){s=!1;break}if(s)return r}let a=e(n);return t=new Map(i),r=a,a};return o.clear=()=>{t=void 0,r=void 0},o},gp=(()=>{let e;try{let r=_2.default.version.split(".");e=Number(r[0])>17}catch{e=!1}let t=!1;return()=>window.EXCALIDRAW_THROTTLE_RENDER===!0?e?!0:(t||(t=!0,console.warn("Excalidraw: render throttling is disabled on React versions < 18.")),!1):!1})(),Nd=(e,t)=>e instanceof Set||e instanceof Map?e.has(t):"includes"in e?e.includes(t):e.hasOwnProperty(t),Co=e=>JSON.parse(JSON.stringify(e)),ub=e=>typeof e=="number"&&Number.isFinite(e),bp=(e,t)=>$t(e,t)?e:t;function _t(e,t,r,o){return e?(e?.addEventListener?.(t,r,o),()=>{e?.removeEventListener?.(t,r,o)}):()=>{}}var KP=yl.includes(devicePixelRatio)?devicePixelRatio:1,wr=()=>({showWelcomeScreen:!1,theme:gt.LIGHT,collaborators:new Map,currentChartType:"bar",currentItemBackgroundColor:pt.backgroundColor,currentItemEndArrowhead:"arrow",currentItemFillStyle:pt.fillStyle,currentItemFontFamily:pr,currentItemFontSize:Jt,currentItemOpacity:pt.opacity,currentItemRoughness:pt.roughness,currentItemStartArrowhead:null,currentItemStrokeColor:pt.strokeColor,currentItemRoundness:"round",currentItemStrokeStyle:pt.strokeStyle,currentItemStrokeWidth:pt.strokeWidth,currentItemTextAlign:oa,cursorButton:"up",activeEmbeddable:null,draggingElement:null,editingElement:null,editingGroupId:null,editingLinearElement:null,activeTool:{type:"selection",customType:null,locked:pt.locked,lastActiveTool:null},penMode:!1,penDetected:!1,errorMessage:null,exportBackground:!0,exportScale:KP,exportEmbedScene:!1,exportWithDarkMode:!1,fileHandle:null,gridSize:null,isBindingEnabled:!0,defaultSidebarDockedPreference:!1,isLoading:!1,isResizing:!1,isRotating:!1,lastPointerDownWith:"mouse",multiElement:null,name:`${E("labels.untitled")}-${A2()}`,contextMenu:null,openMenu:null,openPopup:null,openSidebar:null,openDialog:null,pasteDialog:{shown:!1,data:null},previousSelectedElementIds:{},resizingElement:null,scrolledOutside:!1,scrollX:0,scrollY:0,selectedElementIds:{},selectedGroupIds:{},selectedElementsAreBeingDragged:!1,selectionElement:null,shouldCacheIgnoreZoom:!1,showStats:!1,startBoundElement:null,suggestedBindings:[],frameRendering:{enabled:!0,clip:!0,name:!0,outline:!0},frameToHighlight:null,editingFrame:null,elementsToHighlight:null,toast:null,viewBackgroundColor:ge.white,zenModeEnabled:!1,zoom:{value:1},viewModeEnabled:!1,pendingImageElementId:null,showHyperlinkPopup:!1,selectedLinearElement:null,snapLines:[],originSnapOffset:{x:0,y:0},objectsSnapModeEnabled:!1,userToFollow:null,followedBy:new Set}),ZP=(e=>e)({showWelcomeScreen:{browser:!0,export:!1,server:!1},theme:{browser:!0,export:!1,server:!1},collaborators:{browser:!1,export:!1,server:!1},currentChartType:{browser:!0,export:!1,server:!1},currentItemBackgroundColor:{browser:!0,export:!1,server:!1},currentItemEndArrowhead:{browser:!0,export:!1,server:!1},currentItemFillStyle:{browser:!0,export:!1,server:!1},currentItemFontFamily:{browser:!0,export:!1,server:!1},currentItemFontSize:{browser:!0,export:!1,server:!1},currentItemRoundness:{browser:!0,export:!1,server:!1},currentItemOpacity:{browser:!0,export:!1,server:!1},currentItemRoughness:{browser:!0,export:!1,server:!1},currentItemStartArrowhead:{browser:!0,export:!1,server:!1},currentItemStrokeColor:{browser:!0,export:!1,server:!1},currentItemStrokeStyle:{browser:!0,export:!1,server:!1},currentItemStrokeWidth:{browser:!0,export:!1,server:!1},currentItemTextAlign:{browser:!0,export:!1,server:!1},cursorButton:{browser:!0,export:!1,server:!1},activeEmbeddable:{browser:!1,export:!1,server:!1},draggingElement:{browser:!1,export:!1,server:!1},editingElement:{browser:!1,export:!1,server:!1},editingGroupId:{browser:!0,export:!1,server:!1},editingLinearElement:{browser:!1,export:!1,server:!1},activeTool:{browser:!0,export:!1,server:!1},penMode:{browser:!0,export:!1,server:!1},penDetected:{browser:!0,export:!1,server:!1},errorMessage:{browser:!1,export:!1,server:!1},exportBackground:{browser:!0,export:!1,server:!1},exportEmbedScene:{browser:!0,export:!1,server:!1},exportScale:{browser:!0,export:!1,server:!1},exportWithDarkMode:{browser:!0,export:!1,server:!1},fileHandle:{browser:!1,export:!1,server:!1},gridSize:{browser:!0,export:!0,server:!0},height:{browser:!1,export:!1,server:!1},isBindingEnabled:{browser:!1,export:!1,server:!1},defaultSidebarDockedPreference:{browser:!0,export:!1,server:!1},isLoading:{browser:!1,export:!1,server:!1},isResizing:{browser:!1,export:!1,server:!1},isRotating:{browser:!1,export:!1,server:!1},lastPointerDownWith:{browser:!0,export:!1,server:!1},multiElement:{browser:!1,export:!1,server:!1},name:{browser:!0,export:!1,server:!1},offsetLeft:{browser:!1,export:!1,server:!1},offsetTop:{browser:!1,export:!1,server:!1},contextMenu:{browser:!1,export:!1,server:!1},openMenu:{browser:!0,export:!1,server:!1},openPopup:{browser:!1,export:!1,server:!1},openSidebar:{browser:!0,export:!1,server:!1},openDialog:{browser:!1,export:!1,server:!1},pasteDialog:{browser:!1,export:!1,server:!1},previousSelectedElementIds:{browser:!0,export:!1,server:!1},resizingElement:{browser:!1,export:!1,server:!1},scrolledOutside:{browser:!0,export:!1,server:!1},scrollX:{browser:!0,export:!1,server:!1},scrollY:{browser:!0,export:!1,server:!1},selectedElementIds:{browser:!0,export:!1,server:!1},selectedGroupIds:{browser:!0,export:!1,server:!1},selectedElementsAreBeingDragged:{browser:!1,export:!1,server:!1},selectionElement:{browser:!1,export:!1,server:!1},shouldCacheIgnoreZoom:{browser:!0,export:!1,server:!1},showStats:{browser:!0,export:!1,server:!1},startBoundElement:{browser:!1,export:!1,server:!1},suggestedBindings:{browser:!1,export:!1,server:!1},frameRendering:{browser:!1,export:!1,server:!1},frameToHighlight:{browser:!1,export:!1,server:!1},editingFrame:{browser:!1,export:!1,server:!1},elementsToHighlight:{browser:!1,export:!1,server:!1},toast:{browser:!1,export:!1,server:!1},viewBackgroundColor:{browser:!0,export:!0,server:!0},width:{browser:!1,export:!1,server:!1},zenModeEnabled:{browser:!0,export:!1,server:!1},zoom:{browser:!0,export:!1,server:!1},viewModeEnabled:{browser:!1,export:!1,server:!1},pendingImageElementId:{browser:!1,export:!1,server:!1},showHyperlinkPopup:{browser:!1,export:!1,server:!1},selectedLinearElement:{browser:!0,export:!1,server:!1},snapLines:{browser:!1,export:!1,server:!1},originSnapOffset:{browser:!1,export:!1,server:!1},objectsSnapModeEnabled:{browser:!0,export:!1,server:!1},userToFollow:{browser:!1,export:!1,server:!1},followedBy:{browser:!1,export:!1,server:!1}}),H2=(e,t)=>{let r={};for(let o of Object.keys(e))if(ZP[o]?.[t]){let i=e[o];r[o]=i}return r};var xp=e=>H2(e,"export"),$2=e=>H2(e,"server"),Io=({activeTool:e})=>e.type==="eraser",an=({activeTool:e})=>e.type==="hand";h();h();h();h();h();var Zr=e=>!!e&&e.type==="image"&&!!e.fileId,ko=e=>!!e&&e.type==="image",er=e=>!!e&&e.type==="embeddable",_o=e=>!!e&&e.type==="iframe",Or=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),ee=e=>e!=null&&e.type==="text",la=e=>e!=null&&e.type==="frame",ds=e=>e!=null&&e.type==="magicframe",le=e=>e!=null&&(e.type==="frame"||e.type==="magicframe"),Gt=e=>e!=null&&XP(e.type),XP=e=>e==="freedraw",me=e=>e!=null&&Fd(e.type),Le=e=>e!=null&&e.type==="arrow",Fd=e=>e==="arrow"||e==="line",Ut=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&mb(e.type),mb=e=>e==="arrow",kl=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),$n=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||Le(e)),_l=e=>{let t=e?.type;if(!t)return!1;switch(t){case"text":case"diamond":case"rectangle":case"iframe":case"embeddable":case"ellipse":case"arrow":case"freedraw":case"line":case"frame":case"magicframe":case"image":case"selection":return!0;default:return sa(t,null),!1}},Xr=e=>$n(e)&&!!e.boundElements?.some(({type:t})=>t==="text"),$e=e=>e!==null&&"containerId"in e&&e.containerId!==null&&ee(e),Gn=e=>e==="rectangle"||e==="embeddable"||e==="iframe",G2=e=>e==="line"||e==="arrow"||e==="diamond",U2=(e,t)=>!!((e===Ct.ADAPTIVE_RADIUS||e===Ct.LEGACY)&&Gn(t.type)||e===Ct.PROPORTIONAL_RADIUS&&G2(t.type)),W2=e=>G2(e.type)?{type:Ct.PROPORTIONAL_RADIUS}:Gn(e.type)?{type:Ct.ADAPTIVE_RADIUS}:null;h();h();h();h();h();h();h();h();h();h();h();h();function pb(e,t,r){if(e&&e.length){let[o,n]=t,i=Math.PI/180*r,a=Math.cos(i),s=Math.sin(i);for(let c of e){let[l,d]=c;c[0]=(l-o)*a-(d-n)*s+o,c[1]=(l-o)*s+(d-n)*a+n}}}function jP(e,t,r){let o=[];e.forEach(n=>o.push(...n)),pb(o,t,r)}function qP(e,t){return e[0]===t[0]&&e[1]===t[1]}function V2(e,t,r,o=1){let n=r,i=Math.max(t,.1),a=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,s=[0,0];if(n)for(let l of a)pb(l,s,n);let c=JP(a,i,o);if(n){for(let l of a)pb(l,s,-n);jP(c,s,-n)}return c}function JP(e,t,r){let o=[];for(let l of e){let d=[...l];qP(d[0],d[d.length-1])||d.push([d[0][0],d[0][1]]),d.length>2&&o.push(d)}let n=[];t=Math.max(t,.1);let i=[];for(let l of o)for(let d=0;d<l.length-1;d++){let u=l[d],m=l[d+1];if(u[1]!==m[1]){let p=Math.min(u[1],m[1]);i.push({ymin:p,ymax:Math.max(u[1],m[1]),x:p===u[1]?u[0]:m[0],islope:(m[0]-u[0])/(m[1]-u[1])})}}if(i.sort((l,d)=>l.ymin<d.ymin?-1:l.ymin>d.ymin?1:l.x<d.x?-1:l.x>d.x?1:l.ymax===d.ymax?0:(l.ymax-d.ymax)/Math.abs(l.ymax-d.ymax)),!i.length)return n;let a=[],s=i[0].ymin,c=0;for(;a.length||i.length;){if(i.length){let l=-1;for(let u=0;u<i.length&&!(i[u].ymin>s);u++)l=u;i.splice(0,l+1).forEach(u=>{a.push({s,edge:u})})}if(a=a.filter(l=>!(l.edge.ymax<=s)),a.sort((l,d)=>l.edge.x===d.edge.x?0:(l.edge.x-d.edge.x)/Math.abs(l.edge.x-d.edge.x)),(r!==1||c%t===0)&&a.length>1)for(let l=0;l<a.length;l=l+2){let d=l+1;if(d>=a.length)break;let u=a[l].edge,m=a[d].edge;n.push([[Math.round(u.x),s],[Math.round(m.x),s]])}s+=r,a.forEach(l=>{l.edge.x=l.edge.x+r*l.edge.islope}),c++}return n}function Un(e,t){var r;let o=t.hachureAngle+90,n=t.hachureGap;n<0&&(n=t.strokeWidth*4),n=Math.max(n,.1);let i=1;return t.roughness>=1&&(((r=t.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(i=n),V2(e,n,o,i||1)}var ca=class{constructor(t){this.helper=t}fillPolygons(t,r){return this._fillPolygons(t,r)}_fillPolygons(t,r){let o=Un(t,r);return{type:"fillSketch",ops:this.renderLines(o,r)}}renderLines(t,r){let o=[];for(let n of t)o.push(...this.helper.doubleLineOps(n[0][0],n[0][1],n[1][0],n[1][1],r));return o}};h();h();function da(e){let t=e[0],r=e[1];return Math.sqrt(Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2))}var Ep=class extends ca{fillPolygons(t,r){let o=r.hachureGap;o<0&&(o=r.strokeWidth*4),o=Math.max(o,.1);let n=Object.assign({},r,{hachureGap:o}),i=Un(t,n),a=Math.PI/180*r.hachureAngle,s=[],c=o*.5*Math.cos(a),l=o*.5*Math.sin(a);for(let[u,m]of i)da([u,m])&&s.push([[u[0]-c,u[1]+l],[...m]],[[u[0]+c,u[1]-l],[...m]]);return{type:"fillSketch",ops:this.renderLines(s,r)}}};h();var yp=class extends ca{fillPolygons(t,r){let o=this._fillPolygons(t,r),n=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),i=this._fillPolygons(t,n);return o.ops=o.ops.concat(i.ops),o}};h();var wp=class{constructor(t){this.helper=t}fillPolygons(t,r){r=Object.assign({},r,{hachureAngle:0});let o=Un(t,r);return this.dotsOnLines(o,r)}dotsOnLines(t,r){let o=[],n=r.hachureGap;n<0&&(n=r.strokeWidth*4),n=Math.max(n,.1);let i=r.fillWeight;i<0&&(i=r.strokeWidth/2);let a=n/4;for(let s of t){let c=da(s),l=c/n,d=Math.ceil(l)-1,u=c-d*n,m=(s[0][0]+s[1][0])/2-n/4,p=Math.min(s[0][1],s[1][1]);for(let f=0;f<d;f++){let g=p+u+f*n,x=m-a+Math.random()*2*a,y=g-a+Math.random()*2*a,w=this.helper.ellipse(x,y,i,i,r);o.push(...w.ops)}}return{type:"fillSketch",ops:o}}};h();var vp=class{constructor(t){this.helper=t}fillPolygons(t,r){let o=Un(t,r);return{type:"fillSketch",ops:this.dashedLine(o,r)}}dashedLine(t,r){let o=r.dashOffset<0?r.hachureGap<0?r.strokeWidth*4:r.hachureGap:r.dashOffset,n=r.dashGap<0?r.hachureGap<0?r.strokeWidth*4:r.hachureGap:r.dashGap,i=[];return t.forEach(a=>{let s=da(a),c=Math.floor(s/(o+n)),l=(s+n-c*(o+n))/2,d=a[0],u=a[1];d[0]>u[0]&&(d=a[1],u=a[0]);let m=Math.atan((u[1]-d[1])/(u[0]-d[0]));for(let p=0;p<c;p++){let f=p*(o+n),g=f+o,x=[d[0]+f*Math.cos(m)+l*Math.cos(m),d[1]+f*Math.sin(m)+l*Math.sin(m)],y=[d[0]+g*Math.cos(m)+l*Math.cos(m),d[1]+g*Math.sin(m)+l*Math.sin(m)];i.push(...this.helper.doubleLineOps(x[0],x[1],y[0],y[1],r))}}),i}};h();var Tp=class{constructor(t){this.helper=t}fillPolygons(t,r){let o=r.hachureGap<0?r.strokeWidth*4:r.hachureGap,n=r.zigzagOffset<0?o:r.zigzagOffset;r=Object.assign({},r,{hachureGap:o+n});let i=Un(t,r);return{type:"fillSketch",ops:this.zigzagLines(i,n,r)}}zigzagLines(t,r,o){let n=[];return t.forEach(i=>{let a=da(i),s=Math.round(a/(2*r)),c=i[0],l=i[1];c[0]>l[0]&&(c=i[1],l=i[0]);let d=Math.atan((l[1]-c[1])/(l[0]-c[0]));for(let u=0;u<s;u++){let m=u*2*r,p=(u+1)*2*r,f=Math.sqrt(2*Math.pow(r,2)),g=[c[0]+m*Math.cos(d),c[1]+m*Math.sin(d)],x=[c[0]+p*Math.cos(d),c[1]+p*Math.sin(d)],y=[g[0]+f*Math.cos(d+Math.PI/4),g[1]+f*Math.sin(d+Math.PI/4)];n.push(...this.helper.doubleLineOps(g[0],g[1],y[0],y[1],o),...this.helper.doubleLineOps(y[0],y[1],x[0],x[1],o))}}),n}};var jr={};function Y2(e,t){let r=e.fillStyle||"hachure";if(!jr[r])switch(r){case"zigzag":jr[r]||(jr[r]=new Ep(t));break;case"cross-hatch":jr[r]||(jr[r]=new yp(t));break;case"dots":jr[r]||(jr[r]=new wp(t));break;case"dashed":jr[r]||(jr[r]=new vp(t));break;case"zigzag-line":jr[r]||(jr[r]=new Tp(t));break;case"hachure":default:r="hachure",jr[r]||(jr[r]=new ca(t));break}return jr[r]}h();function K2(){return Math.floor(Math.random()*2**31)}var Al=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}};h();h();var Sp={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function QP(e){let t=new Array;for(;e!=="";)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:0,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:1,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:2,text:""},t}function fb(e,t){return e.type===t}function Ml(e){let t=[],r=QP(e),o="BOD",n=0,i=r[n];for(;!fb(i,2);){let a=0,s=[];if(o==="BOD")if(i.text==="M"||i.text==="m")n++,a=Sp[i.text],o=i.text;else return Ml("M0,0"+e);else fb(i,1)?a=Sp[o]:(n++,a=Sp[i.text],o=i.text);if(n+a<r.length){for(let c=n;c<n+a;c++){let l=r[c];if(fb(l,1))s[s.length]=+l.text;else throw new Error("Param not a number: "+o+","+l.text)}if(typeof Sp[o]=="number"){let c={key:o,data:s};t.push(c),n+=a,i=r[n],o==="M"&&(o="L"),o==="m"&&(o="l")}else throw new Error("Bad segment: "+o)}else throw new Error("Path data ended short")}return t}h();function Bd(e){let t=0,r=0,o=0,n=0,i=[];for(let{key:a,data:s}of e)switch(a){case"M":i.push({key:"M",data:[...s]}),[t,r]=s,[o,n]=s;break;case"m":t+=s[0],r+=s[1],i.push({key:"M",data:[t,r]}),o=t,n=r;break;case"L":i.push({key:"L",data:[...s]}),[t,r]=s;break;case"l":t+=s[0],r+=s[1],i.push({key:"L",data:[t,r]});break;case"C":i.push({key:"C",data:[...s]}),t=s[4],r=s[5];break;case"c":{let c=s.map((l,d)=>d%2?l+r:l+t);i.push({key:"C",data:c}),t=c[4],r=c[5];break}case"Q":i.push({key:"Q",data:[...s]}),t=s[2],r=s[3];break;case"q":{let c=s.map((l,d)=>d%2?l+r:l+t);i.push({key:"Q",data:c}),t=c[2],r=c[3];break}case"A":i.push({key:"A",data:[...s]}),t=s[5],r=s[6];break;case"a":t+=s[5],r+=s[6],i.push({key:"A",data:[s[0],s[1],s[2],s[3],s[4],t,r]});break;case"H":i.push({key:"H",data:[...s]}),t=s[0];break;case"h":t+=s[0],i.push({key:"H",data:[t]});break;case"V":i.push({key:"V",data:[...s]}),r=s[0];break;case"v":r+=s[0],i.push({key:"V",data:[r]});break;case"S":i.push({key:"S",data:[...s]}),t=s[2],r=s[3];break;case"s":{let c=s.map((l,d)=>d%2?l+r:l+t);i.push({key:"S",data:c}),t=c[2],r=c[3];break}case"T":i.push({key:"T",data:[...s]}),t=s[0],r=s[1];break;case"t":t+=s[0],r+=s[1],i.push({key:"T",data:[t,r]});break;case"Z":case"z":i.push({key:"Z",data:[]}),t=o,r=n;break}return i}h();function Hd(e){let t=[],r="",o=0,n=0,i=0,a=0,s=0,c=0;for(let{key:l,data:d}of e){switch(l){case"M":t.push({key:"M",data:[...d]}),[o,n]=d,[i,a]=d;break;case"C":t.push({key:"C",data:[...d]}),o=d[4],n=d[5],s=d[2],c=d[3];break;case"L":t.push({key:"L",data:[...d]}),[o,n]=d;break;case"H":o=d[0],t.push({key:"L",data:[o,n]});break;case"V":n=d[0],t.push({key:"L",data:[o,n]});break;case"S":{let u=0,m=0;r==="C"||r==="S"?(u=o+(o-s),m=n+(n-c)):(u=o,m=n),t.push({key:"C",data:[u,m,...d]}),s=d[0],c=d[1],o=d[2],n=d[3];break}case"T":{let[u,m]=d,p=0,f=0;r==="Q"||r==="T"?(p=o+(o-s),f=n+(n-c)):(p=o,f=n);let g=o+2*(p-o)/3,x=n+2*(f-n)/3,y=u+2*(p-u)/3,w=m+2*(f-m)/3;t.push({key:"C",data:[g,x,y,w,u,m]}),s=p,c=f,o=u,n=m;break}case"Q":{let[u,m,p,f]=d,g=o+2*(u-o)/3,x=n+2*(m-n)/3,y=p+2*(u-p)/3,w=f+2*(m-f)/3;t.push({key:"C",data:[g,x,y,w,p,f]}),s=u,c=m,o=p,n=f;break}case"A":{let u=Math.abs(d[0]),m=Math.abs(d[1]),p=d[2],f=d[3],g=d[4],x=d[5],y=d[6];u===0||m===0?(t.push({key:"C",data:[o,n,x,y,x,y]}),o=x,n=y):(o!==x||n!==y)&&(Z2(o,n,x,y,u,m,p,f,g).forEach(function(T){t.push({key:"C",data:T})}),o=x,n=y);break}case"Z":t.push({key:"Z",data:[]}),o=i,n=a;break}r=l}return t}function eL(e){return Math.PI*e/180}function zd(e,t,r){let o=e*Math.cos(r)-t*Math.sin(r),n=e*Math.sin(r)+t*Math.cos(r);return[o,n]}function Z2(e,t,r,o,n,i,a,s,c,l){let d=eL(a),u=[],m=0,p=0,f=0,g=0;if(l)[m,p,f,g]=l;else{[e,t]=zd(e,t,-d),[r,o]=zd(r,o,-d);let N=(e-r)/2,B=(t-o)/2,K=N*N/(n*n)+B*B/(i*i);K>1&&(K=Math.sqrt(K),n=K*n,i=K*i);let V=s===c?-1:1,ne=n*n,Q=i*i,X=ne*Q-ne*B*B-Q*N*N,se=ne*B*B+Q*N*N,O=V*Math.sqrt(Math.abs(X/se));f=O*n*B/i+(e+r)/2,g=O*-i*N/n+(t+o)/2,m=Math.asin(parseFloat(((t-g)/i).toFixed(9))),p=Math.asin(parseFloat(((o-g)/i).toFixed(9))),e<f&&(m=Math.PI-m),r<f&&(p=Math.PI-p),m<0&&(m=Math.PI*2+m),p<0&&(p=Math.PI*2+p),c&&m>p&&(m=m-Math.PI*2),!c&&p>m&&(p=p-Math.PI*2)}let x=p-m;if(Math.abs(x)>Math.PI*120/180){let N=p,B=r,K=o;c&&p>m?p=m+Math.PI*120/180*1:p=m+Math.PI*120/180*-1,r=f+n*Math.cos(p),o=g+i*Math.sin(p),u=Z2(r,o,B,K,n,i,a,0,c,[p,N,f,g])}x=p-m;let y=Math.cos(m),w=Math.sin(m),T=Math.cos(p),C=Math.sin(p),I=Math.tan(x/4),A=4/3*n*I,P=4/3*i*I,L=[e,t],D=[e+A*w,t-P*y],M=[r+A*C,o-P*T],R=[r,o];if(D[0]=2*L[0]-D[0],D[1]=2*L[1]-D[1],l)return[D,M,R].concat(u);{u=[D,M,R].concat(u);let N=[];for(let B=0;B<u.length;B+=3){let K=zd(u[B][0],u[B][1],d),V=zd(u[B+1][0],u[B+1][1],d),ne=zd(u[B+2][0],u[B+2][1],d);N.push([K[0],K[1],V[0],V[1],ne[0],ne[1]])}return N}}var tL={randOffset:nL,randOffsetWithRange:iL,ellipse:oL,doubleLineOps:aL};function hb(e,t,r,o,n){return{type:"path",ops:xi(e,t,r,o,n)}}function $d(e,t,r){let o=(e||[]).length;if(o>2){let n=[];for(let i=0;i<o-1;i++)n.push(...xi(e[i][0],e[i][1],e[i+1][0],e[i+1][1],r));return t&&n.push(...xi(e[o-1][0],e[o-1][1],e[0][0],e[0][1],r)),{type:"path",ops:n}}else if(o===2)return hb(e[0][0],e[0][1],e[1][0],e[1][1],r);return{type:"path",ops:[]}}function rL(e,t){return $d(e,!0,t)}function Q2(e,t,r,o,n){let i=[[e,t],[e+r,t],[e+r,t+o],[e,t+o]];return rL(i,n)}function gb(e,t){let r=j2(e,1*(1+t.roughness*.2),t);if(!t.disableMultiStroke){let o=j2(e,1.5*(1+t.roughness*.22),sL(t));r=r.concat(o)}return{type:"path",ops:r}}function oL(e,t,r,o,n){let i=bb(r,o,n);return kp(e,t,n,i).opset}function bb(e,t,r){let o=Math.sqrt(Math.PI*2*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),n=Math.ceil(Math.max(r.curveStepCount,r.curveStepCount/Math.sqrt(200)*o)),i=Math.PI*2/n,a=Math.abs(e/2),s=Math.abs(t/2),c=1-r.curveFitting;return a+=Ee(a*c,r),s+=Ee(s*c,r),{increment:i,rx:a,ry:s}}function kp(e,t,r,o){let[n,i]=q2(o.increment,e,t,o.rx,o.ry,1,o.increment*Cp(.1,Cp(.4,1,r),r),r),a=Ip(n,null,r);if(!r.disableMultiStroke&&r.roughness!==0){let[s]=q2(o.increment,e,t,o.rx,o.ry,1.5,0,r),c=Ip(s,null,r);a=a.concat(c)}return{estimatedPoints:i,opset:{type:"path",ops:a}}}function xb(e,t,r,o,n,i,a,s,c){let l=e,d=t,u=Math.abs(r/2),m=Math.abs(o/2);u+=Ee(u*.01,c),m+=Ee(m*.01,c);let p=n,f=i;for(;p<0;)p+=Math.PI*2,f+=Math.PI*2;f-p>Math.PI*2&&(p=0,f=Math.PI*2);let g=Math.PI*2/c.curveStepCount,x=Math.min(g/2,(f-p)/2),y=J2(x,l,d,u,m,p,f,1,c);if(!c.disableMultiStroke){let w=J2(x,l,d,u,m,p,f,1.5,c);y.push(...w)}return a&&(s?y.push(...xi(l,d,l+u*Math.cos(p),d+m*Math.sin(p),c),...xi(l,d,l+u*Math.cos(f),d+m*Math.sin(f),c)):y.push({op:"lineTo",data:[l,d]},{op:"lineTo",data:[l+u*Math.cos(p),d+m*Math.sin(p)]})),{type:"path",ops:y}}function Eb(e,t){let r=Hd(Bd(Ml(e))),o=[],n=[0,0],i=[0,0];for(let{key:a,data:s}of r)switch(a){case"M":{i=[s[0],s[1]],n=[s[0],s[1]];break}case"L":o.push(...xi(i[0],i[1],s[0],s[1],t)),i=[s[0],s[1]];break;case"C":{let[c,l,d,u,m,p]=s;o.push(...lL(c,l,d,u,m,p,i,t)),i=[m,p];break}case"Z":o.push(...xi(i[0],i[1],n[0],n[1],t)),i=[n[0],n[1]];break}return{type:"path",ops:o}}function _p(e,t){let r=[];for(let o of e)if(o.length){let n=t.maxRandomnessOffset||0,i=o.length;if(i>2){r.push({op:"move",data:[o[0][0]+Ee(n,t),o[0][1]+Ee(n,t)]});for(let a=1;a<i;a++)r.push({op:"lineTo",data:[o[a][0]+Ee(n,t),o[a][1]+Ee(n,t)]})}}return{type:"fillPath",ops:r}}function us(e,t){return Y2(t,tL).fillPolygons(e,t)}function e3(e,t,r,o,n,i,a){let s=e,c=t,l=Math.abs(r/2),d=Math.abs(o/2);l+=Ee(l*.01,a),d+=Ee(d*.01,a);let u=n,m=i;for(;u<0;)u+=Math.PI*2,m+=Math.PI*2;m-u>Math.PI*2&&(u=0,m=Math.PI*2);let p=(m-u)/a.curveStepCount,f=[];for(let g=u;g<=m;g=g+p)f.push([s+l*Math.cos(g),c+d*Math.sin(g)]);return f.push([s+l*Math.cos(m),c+d*Math.sin(m)]),f.push([s,c]),us([f],a)}function nL(e,t){return Ee(e,t)}function iL(e,t,r){return Cp(e,t,r)}function aL(e,t,r,o,n){return xi(e,t,r,o,n,!0)}function sL(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function t3(e){return e.randomizer||(e.randomizer=new Al(e.seed||0)),e.randomizer.next()}function Cp(e,t,r,o=1){return r.roughness*o*(t3(r)*(t-e)+e)}function Ee(e,t,r=1){return Cp(-e,e,t,r)}function xi(e,t,r,o,n,i=!1){let a=i?n.disableMultiStrokeFill:n.disableMultiStroke,s=X2(e,t,r,o,n,!0,!1);if(a)return s;let c=X2(e,t,r,o,n,!0,!0);return s.concat(c)}function X2(e,t,r,o,n,i,a){let s=Math.pow(e-r,2)+Math.pow(t-o,2),c=Math.sqrt(s),l=1;c<200?l=1:c>500?l=.4:l=-.0016668*c+1.233334;let d=n.maxRandomnessOffset||0;d*d*100>s&&(d=c/10);let u=d/2,m=.2+t3(n)*.2,p=n.bowing*n.maxRandomnessOffset*(o-t)/200,f=n.bowing*n.maxRandomnessOffset*(e-r)/200;p=Ee(p,n,l),f=Ee(f,n,l);let g=[],x=()=>Ee(u,n,l),y=()=>Ee(d,n,l),w=n.preserveVertices;return i&&(a?g.push({op:"move",data:[e+(w?0:x()),t+(w?0:x())]}):g.push({op:"move",data:[e+(w?0:Ee(d,n,l)),t+(w?0:Ee(d,n,l))]})),a?g.push({op:"bcurveTo",data:[p+e+(r-e)*m+x(),f+t+(o-t)*m+x(),p+e+2*(r-e)*m+x(),f+t+2*(o-t)*m+x(),r+(w?0:x()),o+(w?0:x())]}):g.push({op:"bcurveTo",data:[p+e+(r-e)*m+y(),f+t+(o-t)*m+y(),p+e+2*(r-e)*m+y(),f+t+2*(o-t)*m+y(),r+(w?0:y()),o+(w?0:y())]}),g}function j2(e,t,r){let o=[];o.push([e[0][0]+Ee(t,r),e[0][1]+Ee(t,r)]),o.push([e[0][0]+Ee(t,r),e[0][1]+Ee(t,r)]);for(let n=1;n<e.length;n++)o.push([e[n][0]+Ee(t,r),e[n][1]+Ee(t,r)]),n===e.length-1&&o.push([e[n][0]+Ee(t,r),e[n][1]+Ee(t,r)]);return Ip(o,null,r)}function Ip(e,t,r){let o=e.length,n=[];if(o>3){let i=[],a=1-r.curveTightness;n.push({op:"move",data:[e[1][0],e[1][1]]});for(let s=1;s+2<o;s++){let c=e[s];i[0]=[c[0],c[1]],i[1]=[c[0]+(a*e[s+1][0]-a*e[s-1][0])/6,c[1]+(a*e[s+1][1]-a*e[s-1][1])/6],i[2]=[e[s+1][0]+(a*e[s][0]-a*e[s+2][0])/6,e[s+1][1]+(a*e[s][1]-a*e[s+2][1])/6],i[3]=[e[s+1][0],e[s+1][1]],n.push({op:"bcurveTo",data:[i[1][0],i[1][1],i[2][0],i[2][1],i[3][0],i[3][1]]})}if(t&&t.length===2){let s=r.maxRandomnessOffset;n.push({op:"lineTo",data:[t[0]+Ee(s,r),t[1]+Ee(s,r)]})}}else o===3?(n.push({op:"move",data:[e[1][0],e[1][1]]}),n.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):o===2&&n.push(...xi(e[0][0],e[0][1],e[1][0],e[1][1],r));return n}function q2(e,t,r,o,n,i,a,s){let c=s.roughness===0,l=[],d=[];if(c){e=e/4,d.push([t+o*Math.cos(-e),r+n*Math.sin(-e)]);for(let u=0;u<=Math.PI*2;u=u+e){let m=[t+o*Math.cos(u),r+n*Math.sin(u)];l.push(m),d.push(m)}d.push([t+o*Math.cos(0),r+n*Math.sin(0)]),d.push([t+o*Math.cos(e),r+n*Math.sin(e)])}else{let u=Ee(.5,s)-Math.PI/2;d.push([Ee(i,s)+t+.9*o*Math.cos(u-e),Ee(i,s)+r+.9*n*Math.sin(u-e)]);let m=Math.PI*2+u-.01;for(let p=u;p<m;p=p+e){let f=[Ee(i,s)+t+o*Math.cos(p),Ee(i,s)+r+n*Math.sin(p)];l.push(f),d.push(f)}d.push([Ee(i,s)+t+o*Math.cos(u+Math.PI*2+a*.5),Ee(i,s)+r+n*Math.sin(u+Math.PI*2+a*.5)]),d.push([Ee(i,s)+t+.98*o*Math.cos(u+a),Ee(i,s)+r+.98*n*Math.sin(u+a)]),d.push([Ee(i,s)+t+.9*o*Math.cos(u+a*.5),Ee(i,s)+r+.9*n*Math.sin(u+a*.5)])}return[d,l]}function J2(e,t,r,o,n,i,a,s,c){let l=i+Ee(.1,c),d=[];d.push([Ee(s,c)+t+.9*o*Math.cos(l-e),Ee(s,c)+r+.9*n*Math.sin(l-e)]);for(let u=l;u<=a;u=u+e)d.push([Ee(s,c)+t+o*Math.cos(u),Ee(s,c)+r+n*Math.sin(u)]);return d.push([t+o*Math.cos(a),r+n*Math.sin(a)]),d.push([t+o*Math.cos(a),r+n*Math.sin(a)]),Ip(d,null,c)}function lL(e,t,r,o,n,i,a,s){let c=[],l=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],d=[0,0],u=s.disableMultiStroke?1:2,m=s.preserveVertices;for(let p=0;p<u;p++)p===0?c.push({op:"move",data:[a[0],a[1]]}):c.push({op:"move",data:[a[0]+(m?0:Ee(l[0],s)),a[1]+(m?0:Ee(l[0],s))]}),d=m?[n,i]:[n+Ee(l[p],s),i+Ee(l[p],s)],c.push({op:"bcurveTo",data:[e+Ee(l[p],s),t+Ee(l[p],s),r+Ee(l[p],s),o+Ee(l[p],s),d[0],d[1]]});return c}h();function Gd(e){return[...e]}function r3(e,t=0){let r=e.length;if(r<3)throw new Error("A curve must have at least three points.");let o=[];if(r===3)o.push(Gd(e[0]),Gd(e[1]),Gd(e[2]),Gd(e[2]));else{let n=[];n.push(e[0],e[0]);for(let s=1;s<e.length;s++)n.push(e[s]),s===e.length-1&&n.push(e[s]);let i=[],a=1-t;o.push(Gd(n[0]));for(let s=1;s+2<n.length;s++){let c=n[s];i[0]=[c[0],c[1]],i[1]=[c[0]+(a*n[s+1][0]-a*n[s-1][0])/6,c[1]+(a*n[s+1][1]-a*n[s-1][1])/6],i[2]=[n[s+1][0]+(a*n[s][0]-a*n[s+2][0])/6,n[s+1][1]+(a*n[s][1]-a*n[s+2][1])/6],i[3]=[n[s+1][0],n[s+1][1]],o.push(i[1],i[2],i[3])}}return o}h();function cL(e,t){return Math.sqrt(Ap(e,t))}function Ap(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function dL(e,t,r){let o=Ap(t,r);if(o===0)return Ap(e,t);let n=((e[0]-t[0])*(r[0]-t[0])+(e[1]-t[1])*(r[1]-t[1]))/o;return n=Math.max(0,Math.min(1,n)),Ap(e,ms(t,r,n))}function ms(e,t,r){return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function uL(e,t){let r=e[t+0],o=e[t+1],n=e[t+2],i=e[t+3],a=3*o[0]-2*r[0]-i[0];a*=a;let s=3*o[1]-2*r[1]-i[1];s*=s;let c=3*n[0]-2*i[0]-r[0];c*=c;let l=3*n[1]-2*i[1]-r[1];return l*=l,a<c&&(a=c),s<l&&(s=l),a+s}function yb(e,t,r,o){let n=o||[];if(uL(e,t)<r){let i=e[t+0];n.length?cL(n[n.length-1],i)>1&&n.push(i):n.push(i),n.push(e[t+3])}else{let a=e[t+0],s=e[t+1],c=e[t+2],l=e[t+3],d=ms(a,s,.5),u=ms(s,c,.5),m=ms(c,l,.5),p=ms(d,u,.5),f=ms(u,m,.5),g=ms(p,f,.5);yb([a,d,p,g],0,r,n),yb([g,f,m,l],0,r,n)}return n}function o3(e,t){return Mp(e,0,e.length,t)}function Mp(e,t,r,o,n){let i=n||[],a=e[t],s=e[r-1],c=0,l=1;for(let d=t+1;d<r-1;++d){let u=dL(e[d],a,s);u>c&&(c=u,l=d)}return Math.sqrt(c)>o?(Mp(e,t,l+1,o,i),Mp(e,l,r,o,i)):(i.length||i.push(a),i.push(s)),i}function Pp(e,t=.15,r){let o=[],n=(e.length-1)/3;for(let i=0;i<n;i++){let a=i*3;yb(e,a,t,o)}return r&&r>0?Mp(o,0,o.length,r):o}h();function n3(e,t,r){let o=Ml(e),n=Hd(Bd(o)),i=[],a=[],s=[0,0],c=[],l=()=>{c.length>=4&&a.push(...Pp(c,t)),c=[]},d=()=>{l(),a.length&&(i.push(a),a=[])};for(let{key:m,data:p}of n)switch(m){case"M":d(),s=[p[0],p[1]],a.push(s);break;case"L":l(),a.push([p[0],p[1]]);break;case"C":if(!c.length){let f=a.length?a[a.length-1]:s;c.push([f[0],f[1]])}c.push([p[0],p[1]]),c.push([p[2],p[3]]),c.push([p[4],p[5]]);break;case"Z":l(),a.push([s[0],s[1]]);break}if(d(),!r)return i;let u=[];for(let m of i){let p=o3(m,r);p.length&&u.push(p)}return u}var ao="none",sn=class{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return K2()}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,r,o){return{shape:t,sets:r||[],options:o||this.defaultOptions}}line(t,r,o,n,i){let a=this._o(i);return this._d("line",[hb(t,r,o,n,a)],a)}rectangle(t,r,o,n,i){let a=this._o(i),s=[],c=Q2(t,r,o,n,a);if(a.fill){let l=[[t,r],[t+o,r],[t+o,r+n],[t,r+n]];a.fillStyle==="solid"?s.push(_p([l],a)):s.push(us([l],a))}return a.stroke!==ao&&s.push(c),this._d("rectangle",s,a)}ellipse(t,r,o,n,i){let a=this._o(i),s=[],c=bb(o,n,a),l=kp(t,r,a,c);if(a.fill)if(a.fillStyle==="solid"){let d=kp(t,r,a,c).opset;d.type="fillPath",s.push(d)}else s.push(us([l.estimatedPoints],a));return a.stroke!==ao&&s.push(l.opset),this._d("ellipse",s,a)}circle(t,r,o,n){let i=this.ellipse(t,r,o,o,n);return i.shape="circle",i}linearPath(t,r){let o=this._o(r);return this._d("linearPath",[$d(t,!1,o)],o)}arc(t,r,o,n,i,a,s=!1,c){let l=this._o(c),d=[],u=xb(t,r,o,n,i,a,s,!0,l);if(s&&l.fill)if(l.fillStyle==="solid"){let m=Object.assign({},l);m.disableMultiStroke=!0;let p=xb(t,r,o,n,i,a,!0,!1,m);p.type="fillPath",d.push(p)}else d.push(e3(t,r,o,n,i,a,l));return l.stroke!==ao&&d.push(u),this._d("arc",d,l)}curve(t,r){let o=this._o(r),n=[],i=gb(t,o);if(o.fill&&o.fill!==ao&&t.length>=3)if(o.fillStyle==="solid"){let a=gb(t,Object.assign(Object.assign({},o),{disableMultiStroke:!0,roughness:o.roughness?o.roughness+o.fillShapeRoughnessGain:0}));n.push({type:"fillPath",ops:this._mergedShape(a.ops)})}else{let a=r3(t),s=Pp(a,10,(1+o.roughness)/2);n.push(us([s],o))}return o.stroke!==ao&&n.push(i),this._d("curve",n,o)}polygon(t,r){let o=this._o(r),n=[],i=$d(t,!0,o);return o.fill&&(o.fillStyle==="solid"?n.push(_p([t],o)):n.push(us([t],o))),o.stroke!==ao&&n.push(i),this._d("polygon",n,o)}path(t,r){let o=this._o(r),n=[];if(!t)return this._d("path",n,o);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let i=o.fill&&o.fill!=="transparent"&&o.fill!==ao,a=o.stroke!==ao,s=!!(o.simplification&&o.simplification<1),c=s?4-4*(o.simplification||1):(1+o.roughness)/2,l=n3(t,1,c),d=Eb(t,o);if(i)if(o.fillStyle==="solid")if(l.length===1){let u=Eb(t,Object.assign(Object.assign({},o),{disableMultiStroke:!0,roughness:o.roughness?o.roughness+o.fillShapeRoughnessGain:0}));n.push({type:"fillPath",ops:this._mergedShape(u.ops)})}else n.push(_p(l,o));else n.push(us(l,o));return a&&(s?l.forEach(u=>{n.push($d(u,!1,o))}):n.push(d)),this._d("path",n,o)}opsToPath(t,r){let o="";for(let n of t.ops){let i=typeof r=="number"&&r>=0?n.data.map(a=>+a.toFixed(r)):n.data;switch(n.op){case"move":o+=`M${i[0]} ${i[1]} `;break;case"bcurveTo":o+=`C${i[0]} ${i[1]}, ${i[2]} ${i[3]}, ${i[4]} ${i[5]} `;break;case"lineTo":o+=`L${i[0]} ${i[1]} `;break}}return o.trim()}toPaths(t){let r=t.sets||[],o=t.options||this.defaultOptions,n=[];for(let i of r){let a=null;switch(i.type){case"path":a={d:this.opsToPath(i),stroke:o.stroke,strokeWidth:o.strokeWidth,fill:ao};break;case"fillPath":a={d:this.opsToPath(i),stroke:ao,strokeWidth:0,fill:o.fill||ao};break;case"fillSketch":a=this.fillSketch(i,o);break}a&&n.push(a)}return n}fillSketch(t,r){let o=r.fillWeight;return o<0&&(o=r.strokeWidth/2),{d:this.opsToPath(t),stroke:r.fill||ao,strokeWidth:o,fill:ao}}_mergedShape(t){return t.filter((r,o)=>o===0?!0:r.op!=="move")}};var Lp=class{constructor(t,r){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new sn(r)}draw(t){let r=t.sets||[],o=t.options||this.getDefaultOptions(),n=this.ctx,i=t.options.fixedDecimalPlaceDigits;for(let a of r)switch(a.type){case"path":n.save(),n.strokeStyle=o.stroke==="none"?"transparent":o.stroke,n.lineWidth=o.strokeWidth,o.strokeLineDash&&n.setLineDash(o.strokeLineDash),o.strokeLineDashOffset&&(n.lineDashOffset=o.strokeLineDashOffset),this._drawToContext(n,a,i),n.restore();break;case"fillPath":{n.save(),n.fillStyle=o.fill||"";let s=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(n,a,i,s),n.restore();break}case"fillSketch":this.fillSketch(n,a,o);break}}fillSketch(t,r,o){let n=o.fillWeight;n<0&&(n=o.strokeWidth/2),t.save(),o.fillLineDash&&t.setLineDash(o.fillLineDash),o.fillLineDashOffset&&(t.lineDashOffset=o.fillLineDashOffset),t.strokeStyle=o.fill||"",t.lineWidth=n,this._drawToContext(t,r,o.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,r,o,n="nonzero"){t.beginPath();for(let i of r.ops){let a=typeof o=="number"&&o>=0?i.data.map(s=>+s.toFixed(o)):i.data;switch(i.op){case"move":t.moveTo(a[0],a[1]);break;case"bcurveTo":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"lineTo":t.lineTo(a[0],a[1]);break}}r.type==="fillPath"?t.fill(n):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,r,o,n,i){let a=this.gen.line(t,r,o,n,i);return this.draw(a),a}rectangle(t,r,o,n,i){let a=this.gen.rectangle(t,r,o,n,i);return this.draw(a),a}ellipse(t,r,o,n,i){let a=this.gen.ellipse(t,r,o,n,i);return this.draw(a),a}circle(t,r,o,n){let i=this.gen.circle(t,r,o,n);return this.draw(i),i}linearPath(t,r){let o=this.gen.linearPath(t,r);return this.draw(o),o}polygon(t,r){let o=this.gen.polygon(t,r);return this.draw(o),o}arc(t,r,o,n,i,a,s=!1,c){let l=this.gen.arc(t,r,o,n,i,a,s,c);return this.draw(l),l}curve(t,r){let o=this.gen.curve(t,r);return this.draw(o),o}path(t,r){let o=this.gen.path(t,r);return this.draw(o),o}};h();h();var Ud="http://www.w3.org/2000/svg";var Dp=class{constructor(t,r){this.svg=t,this.gen=new sn(r)}draw(t){let r=t.sets||[],o=t.options||this.getDefaultOptions(),n=this.svg.ownerDocument||window.document,i=n.createElementNS(Ud,"g"),a=t.options.fixedDecimalPlaceDigits;for(let s of r){let c=null;switch(s.type){case"path":{c=n.createElementNS(Ud,"path"),c.setAttribute("d",this.opsToPath(s,a)),c.setAttribute("stroke",o.stroke),c.setAttribute("stroke-width",o.strokeWidth+""),c.setAttribute("fill","none"),o.strokeLineDash&&c.setAttribute("stroke-dasharray",o.strokeLineDash.join(" ").trim()),o.strokeLineDashOffset&&c.setAttribute("stroke-dashoffset",`${o.strokeLineDashOffset}`);break}case"fillPath":{c=n.createElementNS(Ud,"path"),c.setAttribute("d",this.opsToPath(s,a)),c.setAttribute("stroke","none"),c.setAttribute("stroke-width","0"),c.setAttribute("fill",o.fill||""),(t.shape==="curve"||t.shape==="polygon")&&c.setAttribute("fill-rule","evenodd");break}case"fillSketch":{c=this.fillSketch(n,s,o);break}}c&&i.appendChild(c)}return i}fillSketch(t,r,o){let n=o.fillWeight;n<0&&(n=o.strokeWidth/2);let i=t.createElementNS(Ud,"path");return i.setAttribute("d",this.opsToPath(r,o.fixedDecimalPlaceDigits)),i.setAttribute("stroke",o.fill||""),i.setAttribute("stroke-width",n+""),i.setAttribute("fill","none"),o.fillLineDash&&i.setAttribute("stroke-dasharray",o.fillLineDash.join(" ").trim()),o.fillLineDashOffset&&i.setAttribute("stroke-dashoffset",`${o.fillLineDashOffset}`),i}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,r){return this.gen.opsToPath(t,r)}line(t,r,o,n,i){let a=this.gen.line(t,r,o,n,i);return this.draw(a)}rectangle(t,r,o,n,i){let a=this.gen.rectangle(t,r,o,n,i);return this.draw(a)}ellipse(t,r,o,n,i){let a=this.gen.ellipse(t,r,o,n,i);return this.draw(a)}circle(t,r,o,n){let i=this.gen.circle(t,r,o,n);return this.draw(i)}linearPath(t,r){let o=this.gen.linearPath(t,r);return this.draw(o)}polygon(t,r){let o=this.gen.polygon(t,r);return this.draw(o)}arc(t,r,o,n,i,a,s=!1,c){let l=this.gen.arc(t,r,o,n,i,a,s,c);return this.draw(l)}curve(t,r){let o=this.gen.curve(t,r);return this.draw(o)}path(t,r){let o=this.gen.path(t,r);return this.draw(o)}};var Ao={canvas(e,t){return new Lp(e,t)},svg(e,t){return new Dp(e,t)},generator(e){return new sn(e)},newSeed(){return sn.newSeed()}};h();h();h();function i3(e,t,r,o=n=>n){return e*o(.5-t*(.5-r))}function mL(e){return[-e[0],-e[1]]}function cn(e,t){return[e[0]+t[0],e[1]+t[1]]}function Mo(e,t){return[e[0]-t[0],e[1]-t[1]]}function ln(e,t){return[e[0]*t,e[1]*t]}function pL(e,t){return[e[0]/t,e[1]/t]}function Wd(e){return[e[1],-e[0]]}function a3(e,t){return e[0]*t[0]+e[1]*t[1]}function fL(e,t){return e[0]===t[0]&&e[1]===t[1]}function hL(e){return Math.hypot(e[0],e[1])}function gL(e){return e[0]*e[0]+e[1]*e[1]}function s3(e,t){return gL(Mo(e,t))}function d3(e){return pL(e,hL(e))}function bL(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function Vd(e,t,r){let o=Math.sin(r),n=Math.cos(r),i=e[0]-t[0],a=e[1]-t[1],s=i*n-a*o,c=i*o+a*n;return[s+t[0],c+t[1]]}function wb(e,t,r){return cn(e,ln(Mo(t,e),r))}function l3(e,t,r){return cn(e,ln(t,r))}var{min:Pl,PI:xL}=Math,c3=.275,Yd=xL+1e-4;function EL(e,t={}){let{size:r=16,smoothing:o=.5,thinning:n=.5,simulatePressure:i=!0,easing:a=Q=>Q,start:s={},end:c={},last:l=!1}=t,{cap:d=!0,easing:u=Q=>Q*(2-Q)}=s,{cap:m=!0,easing:p=Q=>--Q*Q*Q+1}=c;if(e.length===0||r<=0)return[];let f=e[e.length-1].runningLength,g=s.taper===!1?0:s.taper===!0?Math.max(r,f):s.taper,x=c.taper===!1?0:c.taper===!0?Math.max(r,f):c.taper,y=Math.pow(r*o,2),w=[],T=[],C=e.slice(0,10).reduce((Q,X)=>{let se=X.pressure;if(i){let O=Pl(1,X.distance/r),F=Pl(1,1-O);se=Pl(1,Q+(F-Q)*(O*c3))}return(Q+se)/2},e[0].pressure),I=i3(r,n,e[e.length-1].pressure,a),A,P=e[0].vector,L=e[0].point,D=L,M=L,R=D,N=!1;for(let Q=0;Q<e.length;Q++){let{pressure:X}=e[Q],{point:se,vector:O,distance:F,runningLength:$}=e[Q];if(Q<e.length-1&&f-$<3)continue;if(n){if(i){let Be=Pl(1,F/r),ke=Pl(1,1-Be);X=Pl(1,C+(ke-C)*(Be*c3))}I=i3(r,n,X,a)}else I=r/2;A===void 0&&(A=I);let j=$<g?u($/g):1,q=f-$<x?p((f-$)/x):1;I=Math.max(.01,I*Math.min(j,q));let J=(Q<e.length-1?e[Q+1]:e[Q]).vector,te=Q<e.length-1?a3(O,J):1,ce=a3(O,P)<0&&!N,it=te!==null&&te<0;if(ce||it){let Be=ln(Wd(P),I);for(let ke=1/13,Mt=0;Mt<=1;Mt+=ke)M=Vd(Mo(se,Be),se,Yd*Mt),w.push(M),R=Vd(cn(se,Be),se,Yd*-Mt),T.push(R);L=M,D=R,it&&(N=!0);continue}if(N=!1,Q===e.length-1){let Be=ln(Wd(O),I);w.push(Mo(se,Be)),T.push(cn(se,Be));continue}let Ge=ln(Wd(wb(J,O,te)),I);M=Mo(se,Ge),(Q<=1||s3(L,M)>y)&&(w.push(M),L=M),R=cn(se,Ge),(Q<=1||s3(D,R)>y)&&(T.push(R),D=R),C=X,P=O}let B=e[0].point.slice(0,2),K=e.length>1?e[e.length-1].point.slice(0,2):cn(e[0].point,[1,1]),V=[],ne=[];if(e.length===1){if(!(g||x)||l){let Q=l3(B,d3(Wd(Mo(B,K))),-(A||I)),X=[];for(let se=1/13,O=se;O<=1;O+=se)X.push(Vd(Q,B,Yd*2*O));return X}}else{if(!(g||x&&e.length===1))if(d)for(let X=1/13,se=X;se<=1;se+=X){let O=Vd(T[0],B,Yd*se);V.push(O)}else{let X=Mo(w[0],T[0]),se=ln(X,.5),O=ln(X,.51);V.push(Mo(B,se),Mo(B,O),cn(B,O),cn(B,se))}let Q=Wd(mL(e[e.length-1].vector));if(x||g&&e.length===1)ne.push(K);else if(m){let X=l3(K,Q,I);for(let se=1/29,O=se;O<1;O+=se)ne.push(Vd(X,K,Yd*3*O))}else ne.push(cn(K,ln(Q,I)),cn(K,ln(Q,I*.99)),Mo(K,ln(Q,I*.99)),Mo(K,ln(Q,I)))}return w.concat(ne,T.reverse(),V)}function yL(e,t={}){var r;let{streamline:o=.5,size:n=16,last:i=!1}=t;if(e.length===0)return[];let a=.15+(1-o)*.85,s=Array.isArray(e[0])?e:e.map(({x:p,y:f,pressure:g=.5})=>[p,f,g]);if(s.length===2){let p=s[1];s=s.slice(0,-1);for(let f=1;f<5;f++)s.push(wb(s[0],p,f/4))}s.length===1&&(s=[...s,[...cn(s[0],[1,1]),...s[0].slice(2)]]);let c=[{point:[s[0][0],s[0][1]],pressure:s[0][2]>=0?s[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],l=!1,d=0,u=c[0],m=s.length-1;for(let p=1;p<s.length;p++){let f=i&&p===m?s[p].slice(0,2):wb(u.point,s[p],a);if(fL(u.point,f))continue;let g=bL(f,u.point);if(d+=g,p<m&&!l){if(d<n)continue;l=!0}u={point:f,pressure:s[p][2]>=0?s[p][2]:.5,vector:d3(Mo(u.point,f)),distance:g,runningLength:d},c.push(u)}return c[0].vector=((r=c[1])==null?void 0:r.vector)||[0,0],c}function u3(e,t={}){return EL(yL(e,t),t)}h();h();h();h();h();var dn=4,Wn=6,m3="rgba(0,0,0,0.3)",p3=(e,t,r,o)=>{if(e.length===0)return{horizontal:null,vertical:null};let[n,i,a,s]=Me(e),c=t/o.zoom.value,l=r/o.zoom.value,d=t-c,u=r-l,m={top:parseInt(Rd("sat"))||0,bottom:parseInt(Rd("sab"))||0,left:parseInt(Rd("sal"))||0,right:parseInt(Rd("sar"))||0},p=gi().rtl,f=-o.scrollX+d/2+m.left,g=-o.scrollY+u/2+m.top,x=f+c-m.right,y=g+l-m.bottom,w=Math.min(n,f),T=Math.min(i,g),C=Math.max(a,x),I=Math.max(s,y);return{horizontal:f===w&&x===C?null:{x:Math.max(m.left,dn)+(f-w)/(C-w)*t,y:r-Wn-Math.max(dn,m.bottom),width:(x-f)/(C-w)*t-Math.max(dn*2,m.left+m.right),height:Wn},vertical:g===T&&y===I?null:{x:p?Math.max(m.left,dn):t-Wn-Math.max(m.right,dn),y:(g-T)/(I-T)*r+Math.max(m.top,dn),width:Wn,height:(y-g)/(I-T)*r-Math.max(dn*2,m.top+m.bottom)}}},Rp=(e,t,r)=>{let[o,n]=[e.horizontal,e.vertical].map(a=>a!=null&&a.x<=t&&t<=a.x+a.width&&a.y<=r&&r<=a.y+a.height);return{isOverEither:o||n,isOverHorizontal:o,isOverVertical:n}};h();var wL=(e,t)=>{let[r,o,n,i]=t,{x:a,y:s}=nr({sceneX:r,sceneY:o},e),{x:c,y:l}=nr({sceneX:n,sceneY:i},e);return c-a>e.width||l-s>e.height},vb=({scenePoint:e,viewportDimensions:t,zoom:r})=>({scrollX:t.width/2/r.value-e.x,scrollY:t.height/2/r.value-e.y}),Vn=(e,t)=>{if(e=f3(e),!e.length)return{scrollX:0,scrollY:0};let[r,o,n,i]=Me(e);wL(t,[r,o,n,i])&&([r,o,n,i]=Tb(e,ot({clientX:t.scrollX,clientY:t.scrollY},t)));let a=(r+n)/2,s=(o+i)/2;return vb({scenePoint:{x:a,y:s},viewportDimensions:{width:t.width,height:t.height},zoom:t.zoom})};h();var Ei=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="line"||e==="freedraw",Kd=e=>e!=="image"&&e!=="frame"&&e!=="magicframe",Op=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line",Np=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="arrow"||e==="line",Ll=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="arrow"||e==="line"||e==="diamond",ps=e=>e==="arrow",Sb=(e,t)=>{let r=null;for(let o=e.length-1;o>=0;--o){let n=e[o];if(!n.isDeleted&&t(n)){r=n;break}}return r},Cb=(e,t)=>{let r=[];return e.filter(n=>!n.isDeleted&&t(n)?_o(n)?(r.push(n),!1):!0:!1).concat(r)};h();var Yn=e=>Math.max(Zm,Math.min(e,30)),yi=({viewportX:e,viewportY:t,nextZoom:r},o)=>{let n=e-o.offsetLeft,i=t-o.offsetTop,a=o.zoom.value,s=o.scrollX+(n-n/a),c=o.scrollY+(i-i/a),l=-(n-n/r),d=-(i-i/r);return{scrollX:s+l,scrollY:c+d,zoom:{value:r}}};h();h();var vr=(e,t)=>[0,0,0,0,t,e,1,0];var kb=(e,t)=>[0,0,0,0,t,e,0,0];var hs=(e=0,t=0)=>{let r=[0,0,0,0,0,0,0,0];if(t<0||t>7)throw new Error(`Expected \`index\` between 0 and 7, got \`${t}\``);return e!==0&&(r[t]=e),r};var Rl=e=>[e[0],e[1],e[2],e[3],-e[4],-e[5],-e[6],-e[7]];var h3=(e,t)=>Pb(t)?[e[0]+t,e[1],e[2],e[3],e[4],e[5],e[6],e[7]]:[e[0]+t[0],e[1]+t[1],e[2]+t[2],e[3]+t[3],e[4]+t[4],e[5]+t[5],e[6]+t[6],e[7]+t[7]],Zd=(e,t)=>Pb(t)?[e[0]-t,e[1],e[2],e[3],e[4],e[5],e[6],e[7]]:[e[0]-t[0],e[1]-t[1],e[2]-t[2],e[3]-t[3],e[4]-t[4],e[5]-t[5],e[6]-t[6],e[7]-t[7]],ua=(e,t)=>Pb(t)?[e[0]*t,e[1]*t,e[2]*t,e[3]*t,e[4]*t,e[5]*t,e[6]*t,e[7]*t]:[vL(e,t),t[1]*e[0]+t[0]*e[1]-t[4]*e[2]+t[5]*e[3]+t[2]*e[4]-t[3]*e[5]-t[7]*e[6]-t[6]*e[7],t[2]*e[0]+t[0]*e[2]-t[6]*e[3]+t[3]*e[6],t[3]*e[0]+t[6]*e[2]+t[0]*e[3]-t[2]*e[6],t[4]*e[0]+t[2]*e[1]-t[1]*e[2]+t[7]*e[3]+t[0]*e[4]+t[6]*e[5]-t[5]*e[6]+t[3]*e[7],t[5]*e[0]-t[3]*e[1]+t[7]*e[2]+t[1]*e[3]-t[6]*e[4]+t[0]*e[5]+t[4]*e[6]+t[2]*e[7],t[6]*e[0]+t[3]*e[2]-t[2]*e[3]+t[0]*e[6],t[7]*e[0]+t[6]*e[1]+t[5]*e[2]+t[4]*e[3]+t[3]*e[4]+t[2]*e[5]+t[1]*e[6]+t[0]*e[7]],vL=(e,t)=>t[0]*e[0]+t[2]*e[2]+t[3]*e[3]-t[6]*e[6],_b=(e,t)=>[t[0]*e[0],t[1]*e[0]+t[0]*e[1],t[2]*e[0]+t[0]*e[2],t[3]*e[0]+t[0]*e[3],t[4]*e[0]+t[2]*e[1]-t[1]*e[2]+t[0]*e[4],t[5]*e[0]-t[3]*e[1]+t[1]*e[3]+t[0]*e[5],t[6]*e[0]+t[3]*e[2]-t[2]*e[3]+t[0]*e[6],t[7]*e[0]+t[6]*e[1]+t[5]*e[2]+t[4]*e[3]+t[3]*e[4]+t[2]*e[5]+t[1]*e[6]],Fp=(e,t)=>[Ab(e,t),e[1]*t[7]+e[4]*t[5]-e[5]*t[4]+e[7]*t[1],e[2]*t[7]-e[4]*t[6]+e[6]*t[4]+e[7]*t[2],e[3]*t[7]+e[5]*t[6]-e[6]*t[5]+e[7]*t[3],e[4]*t[7]+e[7]*t[4],e[5]*t[7]+e[7]*t[5],e[6]*t[7]+e[7]*t[6],e[7]*t[7]],Ab=(e,t)=>e[0]*t[7]+e[1]*t[6]+e[2]*t[5]+e[3]*t[4]+e[4]*t[3]+e[5]*t[2]+e[6]*t[1]+e[7]*t[0],g3=(e,t)=>[t[0]*e[0]+t[2]*e[2]+t[3]*e[3]-t[6]*e[6],t[1]*e[0]+t[0]*e[1]-t[4]*e[2]+t[5]*e[3]+t[2]*e[4]-t[3]*e[5]-t[7]*e[6]-t[6]*e[7],t[2]*e[0]+t[0]*e[2]-t[6]*e[3]+t[3]*e[6],t[3]*e[0]+t[6]*e[2]+t[0]*e[3]-t[2]*e[6],t[4]*e[0]+t[7]*e[3]+t[0]*e[4]+t[3]*e[7],t[5]*e[0]+t[7]*e[2]+t[0]*e[5]+t[2]*e[7],t[6]*e[0]+t[0]*e[6],t[7]*e[0]+t[0]*e[7]],Mb=e=>Math.sqrt(Math.abs(e[0]*e[0]-e[2]*e[2]-e[3]*e[3]+e[6]*e[6])),b3=e=>Math.sqrt(Math.abs(e[7]*e[7]-e[5]*e[5]-e[4]*e[4]+e[1]*e[1])),gs=e=>{let t=Mb(e);if(t===0||t===1)return e;let r=e[6]<0?-1:1;return ua(e,r/t)},x3=e=>{let t=b3(e);return t===0||t===1?e:ua(e,1/t)},Pb=e=>typeof e=="number",fG=hs(1,1),hG=hs(1,2),gG=hs(1,3),bG=hs(1,4),xG=hs(1,5),EG=hs(1,6),yG=hs(1,7);h();h();var ma=(e,t,r)=>gs([0,r,e,t,0,0,0,0]),Ol=(e,t)=>gs(Fp(t,e)),E3=(e,t)=>g3(e,t),y3=(e,t)=>E3(Ol(e,t),t);var w3=e=>Math.sign(e[1]);var pa=([e,t])=>[0,0,0,0,t,e,1,0],fa=e=>[e[5],e[4]],Lb=e=>[0,0,0,0,Math.abs(e[4]),Math.abs(e[5]),1,0],T3=(e,t)=>gs(_b(e,t));var Db=(e,t)=>Mb(Fp(e,t)),Po=(e,t)=>Ab(e,t);h();var Bp=e=>[0,0,0,0,e[4],e[5],0,0],S3=(e,t)=>x3([0,0,0,0,t[4]-e[4],t[5]-e[5],0,0]);h();var zp=(e,t)=>h3(ua(e,Math.sin(t/2)),Math.cos(t/2)),I3=e=>[1,0,0,0,-(.5*e[5]),.5*e[4],0,0],k3=(e,t)=>{let r=.5*t;return[1,0,0,0,r*e[4],r*e[5],0,0]};var _3=(e,t)=>ua(t,e),Lo=(e,t)=>gs(ua(ua(e,t),Rl(e)));h();function CL(e,t){return Math.sqrt(Hp(e,t))}function Hp(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function IL(e,t,r){let o=Hp(t,r);if(o===0)return Hp(e,t);let n=((e[0]-t[0])*(r[0]-t[0])+(e[1]-t[1])*(r[1]-t[1]))/o;return n=Math.max(0,Math.min(1,n)),Hp(e,bs(t,r,n))}function bs(e,t,r){return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function kL(e,t){let r=e[t+0],o=e[t+1],n=e[t+2],i=e[t+3],a=3*o[0]-2*r[0]-i[0];a*=a;let s=3*o[1]-2*r[1]-i[1];s*=s;let c=3*n[0]-2*i[0]-r[0];c*=c;let l=3*n[1]-2*i[1]-r[1];return l*=l,a<c&&(a=c),s<l&&(s=l),a+s}function Rb(e,t,r,o){let n=o||[];if(kL(e,t)<r){let i=e[t+0];n.length?CL(n[n.length-1],i)>1&&n.push(i):n.push(i),n.push(e[t+3])}else{let a=e[t+0],s=e[t+1],c=e[t+2],l=e[t+3],d=bs(a,s,.5),u=bs(s,c,.5),m=bs(c,l,.5),p=bs(d,u,.5),f=bs(u,m,.5),g=bs(p,f,.5);Rb([a,d,p,g],0,r,n),Rb([g,f,m,l],0,r,n)}return n}function A3(e,t){return $p(e,0,e.length,t)}function $p(e,t,r,o,n){let i=n||[],a=e[t],s=e[r-1],c=0,l=1;for(let d=t+1;d<r-1;++d){let u=IL(e[d],a,s);u>c&&(c=u,l=d)}return Math.sqrt(c)>o?($p(e,t,l+1,o,i),$p(e,l,r,o,i)):(i.length||i.push(a),i.push(s)),i}function M3(e,t=.15,r){let o=[],n=(e.length-1)/3;for(let i=0;i<n;i++){let a=i*3;Rb(e,a,t,o)}return r&&r>0?$p(o,0,o.length,r):o}h();h();h();var Ob=(e,t,r,o,n,i,a)=>{e.beginPath(),e.moveTo(t+i,r),e.lineTo(t+o-i,r),e.quadraticCurveTo(t+o,r,t+o,r+i),e.lineTo(t+o,r+n-i),e.quadraticCurveTo(t+o,r+n,t+o-i,r+n),e.lineTo(t+i,r+n),e.quadraticCurveTo(t,r+n,t,r+n-i),e.lineTo(t,r+i),e.quadraticCurveTo(t,r,t+i,r),e.closePath(),e.fill(),a&&(e.strokeStyle=a),e.stroke()};h();function _L(e){let t=0;if(e.length===0)return t;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);t=(t<<5)-t+o}return t}var xs=e=>`hsl(${Math.abs(_L(e))%37*10}, 100%, 83%)`,P3=e=>{let t=e?.trim()?.codePointAt(0);return(t?String.fromCodePoint(t):"?").toUpperCase()};h();var Nb=(e,t,r)=>{let o=r.reduce((n,i)=>(i.groupIds.includes(e)&&(n[i.id]=!0),n),{});return Object.keys(o).length<2?t.selectedGroupIds[e]||t.editingGroupId===e?{selectedElementIds:t.selectedElementIds,selectedGroupIds:{...t.selectedGroupIds,[e]:!1},editingGroupId:null}:t:{editingGroupId:t.editingGroupId,selectedGroupIds:{...t.selectedGroupIds,[e]:!0},selectedElementIds:{...t.selectedElementIds,...o}}},fr=function(){let e=null,t=null,r=null,o=(i,a,s,c)=>{if(r!==void 0&&a===t&&i===e&&s.editingGroupId===r?.editingGroupId)return r;let l={};for(let m of i){let p=m.groupIds;if(s.editingGroupId){let f=p.indexOf(s.editingGroupId);f>-1&&(p=p.slice(0,f))}if(p.length>0){let f=p[p.length-1];l[f]=!0}}let d={},u=a.reduce((m,p)=>{let f=p.groupIds.find(g=>l[g]);return f&&(m[p.id]=!0,Array.isArray(d[f])?d[f].push(p.id):d[f]=[p.id]),m},{});for(let m of Object.keys(d))d[m].length<2&&l[m]&&(l[m]=!1);return t=a,e=i,r={editingGroupId:s.editingGroupId,selectedGroupIds:l,selectedElementIds:Ye({...s.selectedElementIds,...u},c)},r},n=(i,a,s,c)=>{let l=c?c.scene.getSelectedElements({selectedElementIds:i.selectedElementIds,elements:a}):Se(a,i);return l.length?o(l,a,i,s):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:Ye(i.selectedElementIds,s)}};return n.clearCache=()=>{t=null,e=null,r=null},n}(),Nl=(e,t)=>Fb(e,t)!=null,Fb=(e,t)=>t.groupIds.filter(r=>r!==e.editingGroupId).find(r=>e.selectedGroupIds[r]),wi=e=>Object.entries(e.selectedGroupIds).filter(([t,r])=>r).map(([t,r])=>t),Gp=(e,t)=>{let r={...t,selectedGroupIds:{}};for(let o of e){let n=o.groupIds;if(t.editingGroupId){let i=n.indexOf(t.editingGroupId);i>-1&&(n=n.slice(0,i))}if(n.length>0){let i=n[n.length-1];r={...r,...Nb(i,r,e)}}}return r.selectedGroupIds},L3=(e,t)=>({...e,editingGroupId:t.groupIds.length?t.groupIds[0]:null,selectedGroupIds:{},selectedElementIds:{[t.id]:!0}}),Es=(e,t)=>e.groupIds.includes(t),Et=(e,t)=>e.filter(r=>Es(r,t)),D3=(e,t)=>e.groupIds.find(r=>t[r]),R3=(e,t,r)=>{let o=[...e],n=t?e.indexOf(t):-1,i=n>-1?n:e.length;for(let a=0;a<i;a++)o[a]=r(o[a]);return o},O3=(e,t,r)=>{let o=[...e],n=r?o.indexOf(r):-1,i=n>-1?n:o.length;return o.splice(i,0,t),o},N3=(e,t)=>e.filter(r=>!t[r]),ys=e=>{let t=new Map;return e.forEach(r=>{let o=r.groupIds.length===0?r.id:r.groupIds[r.groupIds.length-1],n=t.get(o)||[],i=ye(r);i&&n.push(i),t.set(o,[...n,r])}),Array.from(t.values())};h();h();h();h();var Up=[],U=e=>(Up=Up.concat(e),e);h();var B3='<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">',AL='<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"/>',z3='<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"/>',ML=`data:${ae.svg},${encodeURIComponent(`${B3}${z3}</svg>`)}`,PL=`data:${ae.svg},${encodeURIComponent(`${B3}${AL}${z3}</svg>`)}`,so=e=>{e&&(e.style.cursor="")},Qe=(e,t)=>{e&&(e.style.cursor=t)},Kn,F3,Bb=(e,t)=>{let o=()=>{let n=t===gt.DARK;Kn=document.createElement("canvas"),Kn.theme=t,Kn.height=20,Kn.width=20;let i=Kn.getContext("2d");i.lineWidth=1,i.beginPath(),i.arc(Kn.width/2,Kn.height/2,5,0,2*Math.PI),i.fillStyle=n?rt.black:rt.white,i.fill(),i.strokeStyle=n?rt.white:rt.black,i.stroke(),F3=Kn.toDataURL(ae.svg)};(!Kn||Kn.theme!==t)&&o(),Qe(e,`url(${F3}) ${20/2} ${20/2}, auto`)},lo=(e,t)=>{if(e)if(t.activeTool.type==="selection")so(e);else if(an(t))e.style.cursor=Ue.GRAB;else if(Io(t))Bb(e,t.theme);else if(t.activeTool.type==="laser"){let r=t.theme===gt.LIGHT?ML:PL;e.style.cursor=`url(${r}), auto`}else["image","custom"].includes(t.activeTool.type)?t.activeTool.type!=="image"&&(e.style.cursor=Ue.AUTO):e.style.cursor=Ue.CROSSHAIR};h();h();var LL=new Al(Date.now()),DL=0,Do=()=>Math.floor(LL.next()*2**31);var tr=()=>io()?`id${DL++}`:wl();var vi=(e,{x:t,y:r,strokeColor:o=pt.strokeColor,backgroundColor:n=pt.backgroundColor,fillStyle:i=pt.fillStyle,strokeWidth:a=pt.strokeWidth,strokeStyle:s=pt.strokeStyle,roughness:c=pt.roughness,opacity:l=pt.opacity,width:d=0,height:u=0,angle:m=0,groupIds:p=[],frameId:f=null,roundness:g=null,boundElements:x=null,link:y=null,locked:w=pt.locked,...T})=>({id:T.id||tr(),type:e,x:t,y:r,width:d,height:u,angle:m,strokeColor:o,backgroundColor:n,fillStyle:i,strokeWidth:a,strokeStyle:s,roughness:c,opacity:l,groupIds:p,frameId:f,roundness:g,seed:T.seed??Do(),version:T.version||1,versionNonce:T.versionNonce??0,isDeleted:!1,boundElements:x,updated:bi(),link:y,locked:w}),uo=e=>vi(e.type,e),zb=e=>({...vi("embeddable",e),validated:e.validated}),H3=e=>({...vi("iframe",e)}),Yp=e=>de({...vi("frame",e),type:"frame",name:e?.name||null},{}),jd=e=>de({...vi("magicframe",e),type:"magicframe",name:e?.name||null},{}),$3=(e,t)=>({x:e.textAlign==="center"?t.width/2:e.textAlign==="right"?t.width:0,y:e.verticalAlign==="middle"?t.height/2:0}),ir=e=>{let t=e.fontFamily||pr,r=e.fontSize||Jt,o=e.lineHeight||mo(t),n=ha(e.text),i=co(n,Ve({fontFamily:t,fontSize:r}),o),a=e.textAlign||oa,s=e.verticalAlign||as,c=$3({textAlign:a,verticalAlign:s},i);return de({...vi("text",e),text:n,fontSize:r,fontFamily:t,textAlign:a,verticalAlign:s,x:e.x-c.x,y:e.y-c.y,width:i.width,height:i.height,baseline:i.baseline,containerId:e.containerId||null,originalText:n,lineHeight:o},{})},RL=(e,t)=>{let{width:r,height:o,baseline:n}=co(t,Ve(e),e.lineHeight),{textAlign:i,verticalAlign:a}=e,s,c;if(i==="center"&&a===Nt.MIDDLE&&!e.containerId){let l=co(e.text,Ve(e),e.lineHeight),d=$3(e,{width:r-l.width,height:o-l.height});s=e.x-d.x,c=e.y-d.y}else{let[l,d,u,m]=ue(e),[p,f,g,x]=ws(e,r,o,!1),y=(l-p)/2,w=(d-f)/2,T=(u-g)/2,C=(m-x)/2;[s,c]=Zp({s:!0,e:i==="center"||i==="left",w:i==="center"||i==="right"},e.x,e.y,e.angle,y,w,T,C)}return{width:r,height:o,baseline:n,x:Number.isFinite(s)?s:e.x,y:Number.isFinite(c)?c:e.y}},Fl=(e,t=e.text)=>{if(e.isDeleted)return;let r=lt(e);r&&(t=ga(t,Ve(e),qr(r)));let o=RL(e,t);return{text:t,...o}},Hb=(e,{text:t,isDeleted:r,originalText:o})=>de(e,{originalText:o,isDeleted:r??e.isDeleted,...Fl(e,o)}),G3=e=>({...vi(e.type,e),points:e.points||[],pressures:[],simulatePressure:e.simulatePressure,lastCommittedPoint:null}),Ro=e=>({...vi(e.type,e),points:e.points||[],lastCommittedPoint:null,startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null}),qd=e=>({...vi("image",e),strokeColor:"transparent",status:e.status??"pending",fileId:e.fileId??null,scale:e.scale??[1,1]}),Wp=(e,t=0)=>{if(e==null||typeof e!="object")return e;let r=Object.prototype.toString.call(e);if(r==="[object Object]"){let o=typeof e.constructor=="function"?Object.create(Object.getPrototypeOf(e)):{};for(let n in e)if(e.hasOwnProperty(n)){if(t===0&&(n==="shape"||n==="canvas"))continue;o[n]=Wp(e[n],t+1)}return o}if(Array.isArray(e)){let o=e.length,n=new Array(o);for(;o--;)n[o]=Wp(e[o],t+1);return n}return v.DEV&&r!=="[object Object]"&&r!=="[object Array]"&&r.startsWith("[object ")&&console.warn(`_deepCloneElement: unexpected object type ${r}. This value will not be cloned!`),e},Ti=e=>Wp(e),Vp=e=>{if(io()&&e){let t=`${e}_copy`;return window.h?.app?.getSceneElementsIncludingDeleted().find(r=>r.id===t)&&(t+="_copy"),t}return tr()},Jd=(e,t,r,o)=>{let n=Ti(r);return n.id=Vp(n.id),n.boundElements=null,n.updated=bi(),n.seed=Do(),n.groupIds=R3(n.groupIds,e,i=>(t.has(i)||t.set(i,Vp(i)),t.get(i))),o&&(n=Object.assign(n,o)),n},Kp=(e,t)=>{let r=[],o=He(e),n=new Map,i=s=>{if(n.has(s))return n.get(s);if(o.has(s)){let c=Vp(s);return n.set(s,c),c}return null},a=new Map;for(let s of e){let c=Wp(s);if(c.id=i(s.id),t?.randomizeSeed&&(c.seed=Do(),un(c)),c.groupIds&&(c.groupIds=c.groupIds.map(l=>(a.has(l)||a.set(l,Vp(l)),a.get(l)))),"containerId"in c&&c.containerId){let l=i(c.containerId);c.containerId=l}if("boundElements"in c&&c.boundElements&&(c.boundElements=c.boundElements.reduce((l,d)=>{let u=i(d.id);return u&&l.push({...d,id:u}),l},[])),"endBinding"in c&&c.endBinding){let l=i(c.endBinding.elementId);c.endBinding=l?{...c.endBinding,elementId:l}:null}if("startBinding"in c&&c.startBinding){let l=i(c.startBinding.elementId);c.startBinding=l?{...c.startBinding,elementId:l}:null}c.frameId&&(c.frameId=i(c.frameId)),r.push(c)}return r};var Si=new Map,OL=/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)(?:\?t=|&t=|\?start=|&start=)?([a-zA-Z0-9_-]+)?[^\s]*$/,NL=/^(?:http(?:s)?:\/\/)?(?:(?:w){3}.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/,FL=/^https:\/\/(?:www\.)?figma\.com/,BL=/^https:\/\/gist\.github\.com/,zL=/^<script[\s\S]*?\ssrc=["'](https:\/\/gist.github.com\/.*?)\.js["']/i,HL=/(?:http(?:s)?:\/\/)?(?:(?:w){3}.)?twitter.com/,$L=/^<blockquote[\s\S]*?\shref=["'](https:\/\/twitter.com\/[^"']*)/i,GL=/^https:\/\/(?:www\.)?val.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/,UL=/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i,U3=/giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/,$b=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","figma.com","link.excalidraw.com","gist.github.com","twitter.com","*.simplepdf.eu","stackblitz.com","val.town","giphy.com","dddice.com"]),vs=e=>`<html><body>${e}</body></html>`,Ci=e=>{if(!e)return null;if(Si.has(e))return Si.get(e);let t=e,r="generic",o={w:560,h:840},n=e.match(OL);if(n?.[2]){let c=n[3]?`&start=${n[3]}`:"",l=e.includes("shorts");switch(r="video",n[1]){case"embed/":case"watch?v=":case"shorts/":e=`https://www.youtube.com/embed/${n[2]}?enablejsapi=1${c}`;break;case"playlist?list=":case"embed/videoseries?list=":e=`https://www.youtube.com/embed/videoseries?list=${n[2]}&enablejsapi=1${c}`;break;default:e=`https://www.youtube.com/embed/${n[2]}?enablejsapi=1${c}`;break}return o=l?{w:315,h:560}:{w:560,h:315},Si.set(t,{link:e,intrinsicSize:o,type:r}),{link:e,intrinsicSize:o,type:r}}let i=e.match(NL);if(i?.[1]){let c=i?.[1],l=/^\d+$/.test(c)?void 0:E("toast.unrecognizedLinkFormat");return r="video",e=`https://player.vimeo.com/video/${c}?api=1`,o={w:560,h:315},Si.set(t,{link:e,intrinsicSize:o,type:r}),{link:e,intrinsicSize:o,type:r,warning:l}}if(e.match(FL))return r="generic",e=`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(e)}`,o={w:550,h:550},Si.set(t,{link:e,intrinsicSize:o,type:r}),{link:e,intrinsicSize:o,type:r};let s=e.match(GL);if(s)return e=s[1]==="embed"?s[0]:s[0].replace("/v","/embed"),Si.set(t,{link:e,intrinsicSize:o,type:r}),{link:e,intrinsicSize:o,type:r};if(HL.test(e)){let c;if(/<blockquote/.test(e)){let l=vs(e);c={type:"document",srcdoc:()=>l,intrinsicSize:{w:480,h:480}}}else c={type:"document",srcdoc:l=>vs(`<blockquote class="twitter-tweet" data-dnt="true" data-theme="${l}"><a href="${e}"></a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>`),intrinsicSize:{w:480,h:480}};return Si.set(t,c),c}if(BL.test(e)){let c;if(/<script>/.test(e)){let l=vs(e);c={type:"document",srcdoc:()=>l,intrinsicSize:{w:550,h:720}}}else c={type:"document",srcdoc:()=>vs(`
2
- <script src="${e}.js"><\/script>
3
- <style type="text/css">
4
- * { margin: 0px; }
5
- table, .gist { height: 100%; }
6
- .gist .gist-file { height: calc(100vh - 2px); padding: 0px; display: grid; grid-template-rows: 1fr auto; }
7
- </style>
8
- `),intrinsicSize:{w:550,h:720}};return Si.set(e,c),c}return Si.set(e,{link:e,intrinsicSize:o,type:r}),{link:e,intrinsicSize:o,type:r}},Xp=e=>{if(Or(e))return!0;if(e.type==="text"){let t=lt(e);if(t&&le(t))return!0}return!1},jp=e=>{let t;_o(e)?t="IFrame element":t=!e.link||e?.link===""?"Empty Web-Embed":e.link;let r=Math.max(Math.min(e.width/2,e.width/t.length),e.width/30),o=qt.Helvetica,n=Ve({fontSize:r,fontFamily:o});return ir({x:e.x+e.width/2,y:e.y+e.height/2,strokeColor:e.strokeColor!=="transparent"?e.strokeColor:"black",backgroundColor:"transparent",fontFamily:o,fontSize:r,text:ga(t,n,e.width-20),textAlign:"center",verticalAlign:Nt.MIDDLE,angle:e.angle??0})},wU=U({name:"setEmbeddableAsActiveTool",trackEvent:{category:"toolbar"},perform:(e,t,r,o)=>{let n=st(t,{type:"embeddable"});return lo(o.canvas,{...t,activeTool:n}),{elements:e,appState:{...t,activeTool:st(t,{type:"embeddable"})},commitToHistory:!1}}}),W3=(e,t)=>{try{let{hostname:r}=new URL(e),o=r.replace(/^www\./,""),n=o.replace(/^([^.]+)/,"*");if(t instanceof Set)return $b.has(o)||$b.has(n);if(o===t.replace(/^www\./,""))return!0}catch{}return!1},V3=e=>{let t=e.match($L);if(t&&t.length===2)return t[1];let r=e.match(zL);if(r&&r.length===2)return r[1];if(U3.test(e))return`https://giphy.com/embed/${U3.exec(e)[1]}`;let o=e.match(UL);return o&&o.length===2?o[1]:e},Bl=(e,t)=>{if(!e)return!1;if(t!=null)if(typeof t=="function"){let r=t(e);if(typeof r=="boolean")return r}else{if(typeof t=="boolean")return t;if(t instanceof RegExp)return t.test(e);if(Array.isArray(t)){for(let r of t)if(r instanceof RegExp){if(e.match(r))return!0}else if(W3(e,r))return!0;return!1}}return W3(e,$b)};h();var Cn=S(W(),1);h();function Y3(e){var t,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=Y3(e[t]))&&(o&&(o+=" "),o+=r);else for(t in e)e[t]&&(o&&(o+=" "),o+=t);return o}function G(){for(var e=0,t,r,o="";e<arguments.length;)(t=arguments[e++])&&(r=Y3(t))&&(o&&(o+=" "),o+=r);return o}h();var Xt=S(W(),1),Wg=S(zn(),1);h();h();h();var ve={EQUAL:"Equal",MINUS:"Minus",NUM_ADD:"NumpadAdd",NUM_SUBTRACT:"NumpadSubtract",NUM_ZERO:"Numpad0",BRACKET_RIGHT:"BracketRight",BRACKET_LEFT:"BracketLeft",ONE:"Digit1",TWO:"Digit2",THREE:"Digit3",NINE:"Digit9",QUOTE:"Quote",ZERO:"Digit0",SLASH:"Slash",C:"KeyC",D:"KeyD",H:"KeyH",V:"KeyV",Z:"KeyZ",R:"KeyR",S:"KeyS"},k={ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",BACKSPACE:"Backspace",ALT:"Alt",CTRL_OR_CMD:Dr?"metaKey":"ctrlKey",DELETE:"Delete",ENTER:"Enter",ESCAPE:"Escape",QUESTION_MARK:"?",SPACE:" ",TAB:"Tab",CHEVRON_LEFT:"<",CHEVRON_RIGHT:">",PERIOD:".",COMMA:",",SUBTRACT:"-",A:"a",C:"c",D:"d",E:"e",F:"f",G:"g",H:"h",I:"i",L:"l",O:"o",P:"p",Q:"q",R:"r",S:"s",T:"t",V:"v",X:"x",Y:"y",Z:"z",K:"k",W:"w",0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9"},zl=e=>e===k.ARROW_LEFT||e===k.ARROW_RIGHT||e===k.ARROW_DOWN||e===k.ARROW_UP,qp=e=>e.altKey,Hl=e=>e.shiftKey,Ts=e=>e.shiftKey;h();var Nr=S(W(),1);var b=S(_(),1),mn=e=>"var(--icon-fill-color)",j3=e=>e===gt.LIGHT?rt.white:"#1e1e1e",z=(e,t=512)=>{let{width:r=512,height:o=r,mirror:n,style:i,...a}=typeof t=="number"?{width:t}:t;return(0,b.jsx)("svg",{"aria-hidden":"true",focusable:"false",role:"img",viewBox:`0 0 ${r} ${o}`,className:G({"rtl-mirror":n}),style:i,...a,children:typeof e=="string"?(0,b.jsx)("path",{fill:"currentColor",d:e}):e})},Ce={width:24,height:24,fill:"none",strokeWidth:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},xe={width:20,height:20,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},BU=z((0,b.jsxs)("g",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("rect",{x:3,y:8,width:18,height:4,rx:1}),(0,b.jsx)("line",{x1:12,y1:8,x2:12,y2:21}),(0,b.jsx)("path",{d:"M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7"}),(0,b.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"})]}),Ce),q3=z((0,b.jsxs)("g",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),(0,b.jsx)("path",{d:"M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),(0,b.jsx)("line",{x1:"3",y1:"6",x2:"3",y2:"19"}),(0,b.jsx)("line",{x1:"12",y1:"6",x2:"12",y2:"19"}),(0,b.jsx)("line",{x1:"21",y1:"6",x2:"21",y2:"19"})]}),Ce),J3=z((0,b.jsxs)("svg",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,b.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),Ce),Q3=z((0,b.jsxs)("g",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,b.jsx)("circle",{cx:"12",cy:"19",r:"1"}),(0,b.jsx)("circle",{cx:"12",cy:"5",r:"1"})]}),Ce),eT=z((0,b.jsxs)("svg",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M9 4v6l-2 4v2h10v-2l-2 -4v-6"}),(0,b.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"21"}),(0,b.jsx)("line",{x1:"8",y1:"4",x2:"16",y2:"4"})]}),Ce),tT=z((0,b.jsxs)("g",{children:[(0,b.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,b.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,b.jsx)("mask",{id:"UnlockedIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:6,y:1,width:9,height:9,children:(0,b.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,b.jsx)("g",{mask:"url(#UnlockedIcon)",children:(0,b.jsx)("path",{stroke:"none",d:"M5.149 9.561v1.25h2.5v-1.25h-2.5Zm5.06-7.894V.417v1.25Zm2.559 3.508v1.25h2.5v-1.25h-2.5ZM7.648 8.51V5.175h-2.5V8.51h2.5Zm0-3.334c0-.564.243-1.128.713-1.561L6.668 1.775c-.959.883-1.52 2.104-1.52 3.4h2.5Zm.713-1.561a2.732 2.732 0 0 1 1.847-.697v-2.5c-1.31 0-2.585.478-3.54 1.358L8.36 3.614Zm1.847-.697c.71 0 1.374.26 1.847.697l1.694-1.839a5.231 5.231 0 0 0-3.54-1.358v2.5Zm1.847.697c.47.433.713.997.713 1.561h2.5c0-1.296-.56-2.517-1.52-3.4l-1.693 1.839Z",fill:"currentColor"})})]}),xe),rT=z((0,b.jsxs)("g",{strokeWidth:"1.25",children:[(0,b.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,b.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,b.jsx)("path",{d:"M6.667 8.333V5.417C6.667 3.806 8.159 2.5 10 2.5c1.841 0 3.333 1.306 3.333 2.917v2.916"})]}),xe),oT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.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,b.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z",fill:"currentColor"}),(0,b.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"}),nT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.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,b.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,b.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"}),iT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.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,b.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,b.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"}),zU=z((0,b.jsx)("g",{fill:"currentColor",children:(0,b.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"}),aT=z((0,b.jsxs)("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.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,b.jsx)("path",{d:"M13.5 13.5l4.5 4.5"})]}),{fill:"none",width:22,height:22,strokeWidth:1.25}),sT=z((0,b.jsxs)("g",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})]}),Ce),lT=z((0,b.jsxs)("g",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.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"})]}),Ce),cT=z((0,b.jsxs)("g",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("circle",{cx:"12",cy:"12",r:"9"})]}),Ce),dT=z((0,b.jsxs)("g",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,b.jsx)("line",{x1:"15",y1:"16",x2:"19",y2:"12"}),(0,b.jsx)("line",{x1:"15",y1:"8",x2:"19",y2:"12"})]}),Ce),uT=z((0,b.jsx)("path",{d:"M4.167 10h11.666",strokeWidth:"1.5"}),xe),mT=z((0,b.jsxs)("g",{strokeWidth:"1.25",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z"}),(0,b.jsx)("path",{d:"M16 7h4"}),(0,b.jsx)("path",{d:"M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3"})]}),Ce),$l=z((0,b.jsxs)("g",{strokeWidth:"1.25",children:[(0,b.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,b.jsx)("path",{d:"m11.25 5.417 3.333 3.333"})]}),xe),pT=z((0,b.jsxs)("g",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("line",{x1:"4",y1:"20",x2:"7",y2:"20"}),(0,b.jsx)("line",{x1:"14",y1:"20",x2:"21",y2:"20"}),(0,b.jsx)("line",{x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,b.jsx)("line",{x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,b.jsx)("polyline",{points:"5 20 11 4 13 4 20 20"})]}),Ce),fT=z((0,b.jsxs)("g",{strokeWidth:"1.25",children:[(0,b.jsx)("path",{d:"M12.5 6.667h.01"}),(0,b.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,b.jsx)("path",{d:"m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166"}),(0,b.jsx)("path",{d:"m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667"})]}),xe),hT=z((0,b.jsxs)("g",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.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,b.jsx)("path",{d:"M18 13.3l-6.3 -6.3"})]}),Ce),gT=z((0,b.jsx)("path",{strokeWidth:"1.25",d:"M10 4.167v11.666M4.167 10h11.666"}),xe),bT=z((0,b.jsx)("path",{d:"M5 10h10",strokeWidth:"1.25"}),xe),ba=z((0,b.jsx)("path",{strokeWidth:"1.25",d:"M3.333 5.833h13.334M8.333 9.167v5M11.667 9.167v5M4.167 5.833l.833 10c0 .92.746 1.667 1.667 1.667h6.666c.92 0 1.667-.746 1.667-1.667l.833-10M7.5 5.833v-2.5c0-.46.373-.833.833-.833h3.334c.46 0 .833.373.833.833v2.5"}),xe),xT=z((0,b.jsxs)("g",{strokeWidth:"1.25",children:[(0,b.jsx)("polyline",{points:"12 16 18 10 12 4"}),(0,b.jsx)("polyline",{points:"8 4 2 10 8 16"})]}),xe),ET=z((0,b.jsxs)("g",{strokeWidth:"1.25",children:[(0,b.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,b.jsx)("path",{clipRule:"evenodd",d:"M11.667 3.125c.517 0 .986.21 1.325.55.34.338.55.807.55 1.325v1.458H8.333c-.485 0-.927.185-1.26.487-.343.312-.57.75-.609 1.24l-.005 5.357H5a1.87 1.87 0 0 1-1.326-.55 1.87 1.87 0 0 1-.549-1.325V5c0-.518.21-.987.55-1.326.338-.34.807-.549 1.325-.549h6.667Z"})]}),xe),yT=z((0,b.jsx)("path",{clipRule:"evenodd",d:"M10 2.5h.328a6.25 6.25 0 0 0 6.6 10.372A7.5 7.5 0 1 1 10 2.493V2.5Z",stroke:"currentColor"}),xe),wT=z((0,b.jsx)("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,b.jsx)("path",{d:"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM10 4.167V2.5M14.167 5.833l1.166-1.166M15.833 10H17.5M14.167 14.167l1.166 1.166M10 15.833V17.5M5.833 14.167l-1.166 1.166M5 10H3.333M5.833 5.833 4.667 4.667"})}),xe),Qp=z((0,b.jsxs)("g",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),(0,b.jsx)("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),(0,b.jsx)("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]}),Ce),ef=z((0,b.jsx)("path",{strokeWidth:"1.25",d:"M3.333 14.167v1.666c0 .92.747 1.667 1.667 1.667h10c.92 0 1.667-.746 1.667-1.667v-1.666M5.833 9.167 10 13.333l4.167-4.166M10 3.333v10"}),xe),Gl=z((0,b.jsxs)("g",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,b.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),(0,b.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),Ce),tf=z((0,b.jsx)("path",{strokeWidth:"1.25",d:"M9.167 5.833H5.833c-1.254 0-2.5 1.282-2.5 2.5v5.834c0 1.283 1.252 2.5 2.5 2.5h5.834c1.251 0 2.5-1.25 2.5-2.5v-3.334M8.333 11.667l8.334-8.334M12.5 3.333h4.167V7.5"}),xe),vT=z((0,b.jsx)("path",{d:"M7.5 15.833c-3.583 1.167-3.583-2.083-5-2.5m10 4.167v-2.917c0-.833.083-1.166-.417-1.666 2.334-.25 4.584-1.167 4.584-5a3.833 3.833 0 0 0-1.084-2.667 3.5 3.5 0 0 0-.083-2.667s-.917-.25-2.917 1.084a10.25 10.25 0 0 0-5.166 0C5.417 2.333 4.5 2.583 4.5 2.583a3.5 3.5 0 0 0-.083 2.667 3.833 3.833 0 0 0-1.084 2.667c0 3.833 2.25 4.75 4.584 5-.5.5-.5 1-.417 1.666V17.5",strokeWidth:"1.25"}),xe),TT=z((0,b.jsxs)("g",{strokeWidth:"1.25",children:[(0,b.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,b.jsx)("path",{d:"M12.917 14.167c0 .833 1.25 2.5 1.666 2.5 1.25 0 2.361-1.39 2.917-2.5.556-1.39.417-4.861-1.25-9.584-1.214-.846-2.5-1.116-3.75-1.25l-.833 2.084M7.083 14.167c0 .833-1.13 2.5-1.526 2.5-1.191 0-2.249-1.39-2.778-2.5-.529-1.39-.397-4.861 1.19-9.584 1.157-.846 2.318-1.116 3.531-1.25l.833 2.084"})]}),xe),ST=z((0,b.jsxs)("g",{strokeWidth:"1.25",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M22 4.01c-1 .49 -1.98 .689 -3 .99c-1.121 -1.265 -2.783 -1.335 -4.38 -.737s-2.643 2.06 -2.62 3.737v1c-3.245 .083 -6.135 -1.395 -8 -4c0 0 -4.182 7.433 4 11c-1.872 1.247 -3.739 2.088 -6 2c3.308 1.803 6.913 2.423 10.034 1.517c3.58 -1.04 6.522 -3.723 7.651 -7.742a13.84 13.84 0 0 0 .497 -3.753c-.002 -.249 1.51 -2.772 1.818 -4.013z"})]}),Ce),CT=z((0,b.jsx)("polyline",{fill:"none",stroke:"currentColor",points:"20 6 9 17 4 12"}),{width:24,height:24}),rf=z((0,b.jsxs)("g",{strokeWidth:"1.25",children:[(0,b.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,b.jsx)("path",{d:"M11.667 8.333a2.917 2.917 0 0 0-4.167 0l-3.333 3.334a2.946 2.946 0 0 0 4.166 4.166l.417-.416"})]}),xe),IT=z("M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z",{width:448,height:512}),kT=z("M252 54L203 8a28 27 0 00-20-8H28C12 0 0 12 0 27v195c0 15 12 26 28 26h204c15 0 28-11 28-26V73a28 27 0 00-8-19zM130 213c-21 0-37-16-37-36 0-19 16-35 37-35 20 0 37 16 37 35 0 20-17 36-37 36zm56-169v56c0 4-4 6-7 6H44c-4 0-7-2-7-6V42c0-4 3-7 7-7h133l4 2 3 2a7 7 0 012 5z M296 201l87 95-188 205-78 9c-10 1-19-8-18-20l9-84zm141-14l-41-44a31 31 0 00-46 0l-38 41 87 95 38-42c13-14 13-36 0-50z",{width:448,height:512}),Ul=z((0,b.jsx)("path",{d:"m9.257 6.351.183.183H15.819c.34 0 .727.182 1.051.506.323.323.505.708.505 1.05v5.819c0 .316-.183.7-.52 1.035-.337.338-.723.522-1.037.522H4.182c-.352 0-.74-.181-1.058-.5-.318-.318-.499-.705-.499-1.057V5.182c0-.351.181-.736.5-1.054.32-.321.71-.503 1.057-.503H6.53l2.726 2.726Z",strokeWidth:"1.25"}),xe),HU=z("M384 112v352c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h80c0-35.29 28.71-64 64-64s64 28.71 64 64h80c26.51 0 48 21.49 48 48zM192 40c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24m96 114v-20a6 6 0 0 0-6-6H102a6 6 0 0 0-6 6v20a6 6 0 0 0 6 6h180a6 6 0 0 0 6-6z",{width:384,height:512}),_T=z("M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"),AT=z((0,b.jsxs)("g",{strokeWidth:"1.25",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M15 8h.01"}),(0,b.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,b.jsx)("path",{d:"M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4"}),(0,b.jsx)("path",{d:"M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598"}),(0,b.jsx)("path",{d:"M19 16v6"}),(0,b.jsx)("path",{d:"M22 19l-3 3l-3 -3"})]}),Ce),MT=z("M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z",{width:512,height:512}),$U=z("M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512}),GU=z("M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512}),PT=z("M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"),UU=z("M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"),LT=z((0,b.jsx)("path",{d:"M7.5 10.833 4.167 7.5 7.5 4.167M4.167 7.5h9.166a3.333 3.333 0 0 1 0 6.667H12.5",strokeWidth:"1.25"}),xe),DT=z((0,b.jsx)("path",{d:"M12.5 10.833 15.833 7.5 12.5 4.167M15.833 7.5H6.667a3.333 3.333 0 1 0 0 6.667H7.5",strokeWidth:"1.25"}),xe),RT=z("M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z",{mirror:!0}),WU=z((0,b.jsx)("path",{d:"M5 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 7.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 17.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM7.25 8.917l5.5-2.834M7.25 11.083l5.5 2.834",strokeWidth:"1.5"}),xe),VU=z("M16 5l-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z",{width:24,height:24}),YU=z((0,b.jsxs)(b.Fragment,{children:[(0,b.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,b.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}),KU=z((0,b.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}),OT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("path",{d:"M13.889 4.167H8.333c-.767 0-1.389.622-1.389 1.389v5.555c0 .767.622 1.389 1.39 1.389h5.555c.767 0 1.389-.622 1.389-1.389V5.556c0-.767-.622-1.39-1.39-1.39Z",fill:"currentColor"}),(0,b.jsx)("path",{d:"M12.5 12.5v1.389a1.389 1.389 0 0 1-1.389 1.389H5.556a1.389 1.389 0 0 1-1.39-1.39V8.334a1.389 1.389 0 0 1 1.39-1.389h1.388"})]}),(0,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),NT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.944 12.5H12.5v1.389a1.389 1.389 0 0 1-1.389 1.389H5.556a1.389 1.389 0 0 1-1.39-1.39V8.334a1.389 1.389 0 0 1 1.39-1.389h1.388",fill:"currentColor"}),(0,b.jsx)("path",{d:"M13.889 4.167H8.333c-.767 0-1.389.621-1.389 1.389v5.555c0 .767.622 1.389 1.39 1.389h5.555c.767 0 1.389-.622 1.389-1.389V5.556c0-.768-.622-1.39-1.39-1.39Z"})]}),(0,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),FT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,b.jsx)("path",{d:"M8.775 6.458h2.45a2.316 2.316 0 0 1 2.317 2.316v2.452a2.316 2.316 0 0 1-2.316 2.316H8.774a2.316 2.316 0 0 1-2.317-2.316V8.774a2.316 2.316 0 0 1 2.317-2.316Z",fill:"currentColor"}),(0,b.jsx)("path",{d:"M5.441 9.792h2.451a2.316 2.316 0 0 1 2.316 2.316v2.45a2.316 2.316 0 0 1-2.316 2.317h-2.45a2.316 2.316 0 0 1-2.317-2.316v-2.451a2.316 2.316 0 0 1 2.316-2.316ZM12.108 3.125h2.45a2.316 2.316 0 0 1 2.317 2.316v2.451a2.316 2.316 0 0 1-2.316 2.316h-2.451a2.316 2.316 0 0 1-2.316-2.316v-2.45a2.316 2.316 0 0 1 2.316-2.317Z"})]}),(0,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),BT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{clipPath:"url(#a)",children:[(0,b.jsx)("path",{d:"M5.441 9.792h2.451a2.316 2.316 0 0 1 2.316 2.316v2.45a2.316 2.316 0 0 1-2.316 2.317h-2.45a2.316 2.316 0 0 1-2.317-2.316v-2.451a2.316 2.316 0 0 1 2.316-2.316Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,b.jsx)("path",{d:"M5.441 9.792h2.451a2.316 2.316 0 0 1 2.316 2.316v2.45a2.316 2.316 0 0 1-2.316 2.317h-2.45a2.316 2.316 0 0 1-2.317-2.316v-2.451a2.316 2.316 0 0 1 2.316-2.316Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,b.jsx)("mask",{id:"SendToBackIcon",fill:"#fff",children:(0,b.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.167 5.833v2.06a2.941 2.941 0 0 0 2.94 2.94h2.06v.393a2.941 2.941 0 0 1-2.941 2.94h-.393v-2.058a2.941 2.941 0 0 0-2.94-2.941h-2.06v-.393a2.941 2.941 0 0 1 2.942-2.94h.392Z"})}),(0,b.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.167 5.833v2.06a2.941 2.941 0 0 0 2.94 2.94h2.06v.393a2.941 2.941 0 0 1-2.941 2.94h-.393v-2.058a2.941 2.941 0 0 0-2.94-2.941h-2.06v-.393a2.941 2.941 0 0 1 2.942-2.94h.392Z",fill:"currentColor"}),(0,b.jsx)("path",{d:"M9.167 5.833h1.25v-1.25h-1.25v1.25Zm5 5h1.25v-1.25h-1.25v1.25Zm-3.334 3.334h-1.25v1.25h1.25v-1.25Zm-5-5h-1.25v1.25h1.25v-1.25Zm2.084-3.334v2.06h2.5v-2.06h-2.5Zm0 2.06a4.191 4.191 0 0 0 4.19 4.19v-2.5a1.691 1.691 0 0 1-1.69-1.69h-2.5Zm4.19 4.19h2.06v-2.5h-2.06v2.5Zm.81-1.25v.393h2.5v-.393h-2.5Zm0 .393c0 .933-.758 1.69-1.691 1.69v2.5a4.191 4.191 0 0 0 4.19-4.19h-2.5Zm-1.691 1.69h-.393v2.5h.393v-2.5Zm.857 1.25v-2.058h-2.5v2.059h2.5Zm0-2.058a4.191 4.191 0 0 0-4.19-4.191v2.5c.933 0 1.69.757 1.69 1.69h2.5Zm-4.19-4.191h-2.06v2.5h2.06v-2.5Zm-.81 1.25v-.393h-2.5v.393h2.5Zm0-.393c0-.934.758-1.69 1.692-1.69v-2.5a4.191 4.191 0 0 0-4.192 4.19h2.5Zm1.692-1.69h.392v-2.5h-.392v2.5Z",fill:"currentColor",mask:"url(#SendToBackIcon)"}),(0,b.jsx)("path",{d:"M12.108 3.125h2.45a2.316 2.316 0 0 1 2.317 2.316v2.451a2.316 2.316 0 0 1-2.316 2.316h-2.451a2.316 2.316 0 0 1-2.316-2.316v-2.45a2.316 2.316 0 0 1 2.316-2.317Z",stroke:"currentColor",strokeWidth:"1.25"})]}),(0,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),zT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,b.jsx)("path",{d:"M3.333 3.333h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,b.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,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),HT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,b.jsx)("path",{d:"M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,b.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,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),$T=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,b.jsx)("path",{d:"M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,b.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,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),GT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,b.jsx)("path",{d:"M16.667 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,b.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,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),UT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,b.jsx)("path",{d:"M16.667 3.333v13.334M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,b.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,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),WT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,b.jsx)("path",{d:"M3.333 3.333h13.334M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,b.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,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),VT=z((0,b.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.25",children:[(0,b.jsx)("path",{d:"M1.667 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,b.jsx)("path",{d:"M8.333 10h3.334",strokeLinejoin:"round"}),(0,b.jsx)("path",{d:"M15.417 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,b.jsx)("path",{d:"M6.875 4.792h-.417c-.92 0-1.666.746-1.666 1.666v7.084c0 .92.746 1.666 1.666 1.666h.417c.92 0 1.667-.746 1.667-1.666V6.458c0-.92-.747-1.666-1.667-1.666ZM13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v3.75c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667v-3.75c0-.92-.746-1.667-1.666-1.667Z"})]}),xe),YT=z((0,b.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.25",children:[(0,b.jsx)("path",{d:"M10 18.333v-2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,b.jsx)("path",{d:"M10 11.667V8.333",strokeLinejoin:"round"}),(0,b.jsx)("path",{d:"M10 4.583V1.667",strokeLinecap:"round",strokeLinejoin:"round"}),(0,b.jsx)("path",{d:"M4.792 13.125v.417c0 .92.746 1.666 1.666 1.666h7.084c.92 0 1.666-.746 1.666-1.666v-.417c0-.92-.746-1.667-1.666-1.667H6.458c-.92 0-1.666.746-1.666 1.667ZM6.458 6.458v.417c0 .92.747 1.667 1.667 1.667h3.75c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666h-3.75c-.92 0-1.667.746-1.667 1.666Z"})]}),xe),Wl=z((0,b.jsxs)("g",{strokeWidth:"1.5",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,b.jsx)("path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"}),(0,b.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"}),(0,b.jsx)("path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85"})]}),Ce),ZU=z("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z"),XU=z("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z"),Oo=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,b.jsx)("path",{d:"M15 5 5 15M5 5l10 10"})}),(0,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),KT=z("M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z",{width:320,height:512,style:{marginLeft:"-0.2rem"},mirror:!0}),jU=z("M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z",{mirror:!0}),qU=z("M11.553 22.894a.998.998 0 00.894 0s3.037-1.516 5.465-4.097C19.616 16.987 21 14.663 21 12V5a1 1 0 00-.649-.936l-8-3a.998.998 0 00-.702 0l-8 3A1 1 0 003 5v7c0 2.663 1.384 4.987 3.088 6.797 2.428 2.581 5.465 4.097 5.465 4.097zm-1.303-8.481l6.644-6.644a.856.856 0 111.212 1.212l-7.25 7.25a.856.856 0 01-1.212 0l-3.75-3.75a.856.856 0 111.212-1.212l3.144 3.144z",{width:24}),JU=z("M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm32-48h224V288l-23.5-23.5c-4.7-4.7-12.3-4.7-17 0L176 352l-39.5-39.5c-4.7-4.7-12.3-4.7-17 0L80 352v64zm48-240c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z",{width:384,height:512}),ZT=Nr.default.memo(({theme:e})=>z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("path",{d:"M25 26H111V111H25",fill:mn(e)}),(0,b.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:mn(e),strokeWidth:"2"}),(0,b.jsx)("path",{d:"M100 100H160V160H100",fill:mn(e)}),(0,b.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:mn(e),strokeWidth:"2"}),(0,b.jsxs)("g",{fill:j3(e),stroke:mn(e),strokeWidth:"6",children:[(0,b.jsx)("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),(0,b.jsx)("rect",{x:"2.5",y:"149.5",width:"30",height:"30"}),(0,b.jsx)("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),(0,b.jsx)("rect",{x:"147.5",y:"2.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),XT=Nr.default.memo(({theme:e})=>z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("path",{d:"M25 26H111V111H25",fill:mn(e)}),(0,b.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:mn(e),strokeWidth:"2"}),(0,b.jsx)("path",{d:"M100 100H160V160H100",fill:mn(e)}),(0,b.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:mn(e),strokeWidth:"2"}),(0,b.jsxs)("g",{fill:j3(e),stroke:mn(e),strokeWidth:"6",children:[(0,b.jsx)("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),(0,b.jsx)("rect",{x:"78.5",y:"149.5",width:"30",height:"30"}),(0,b.jsx)("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),(0,b.jsx)("rect",{x:"147.5",y:"78.5",width:"30",height:"30"}),(0,b.jsx)("rect",{x:"105.5",y:"2.5",width:"30",height:"30"}),(0,b.jsx)("rect",{x:"2.5",y:"102.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),jT=z((0,b.jsx)("g",{strokeWidth:1.25,children:(0,b.jsx)("path",{d:"M5.879 2.625h8.242a3.27 3.27 0 0 1 3.254 3.254v8.242a3.27 3.27 0 0 1-3.254 3.254H5.88a3.27 3.27 0 0 1-3.254-3.254V5.88A3.27 3.27 0 0 1 5.88 2.626l-.001-.001ZM4.518 16.118l7.608-12.83m.198 13.934 5.051-9.897M2.778 9.675l9.348-6.387m-7.608 12.83 12.857-8.793"})}),xe),qT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.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,b.jsx)("mask",{id:"FillHachureIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:2,y:2,width:16,height:16,children:(0,b.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,b.jsx)("g",{mask:"url(#FillHachureIcon)",children:(0,b.jsx)("path",{d:"M2.258 15.156 15.156 2.258M7.324 20.222 20.222 7.325m-20.444 5.35L12.675-.222m-8.157 18.34L17.416 5.22",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})]}),xe),JT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{clipPath:"url(#a)",children:[(0,b.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,b.jsx)("mask",{id:"FillCrossHatchIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:-1,y:-1,width:22,height:22,children:(0,b.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,b.jsx)("g",{mask:"url(#FillCrossHatchIcon)",children:(0,b.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,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),QT=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("g",{clipPath:"url(#a)",children:(0,b.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,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),{...xe,fill:"currentColor"}),Gb=z((0,b.jsx)(b.Fragment,{children:(0,b.jsx)("path",{d:"M4.167 10h11.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),xe),eS=z((0,b.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),xe),tS=z((0,b.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"3.75",strokeLinecap:"round",strokeLinejoin:"round"}),xe),QU=Nr.default.memo(({theme:e})=>z((0,b.jsx)("path",{d:"M6 10H34",stroke:mn(e),strokeWidth:2,fill:"none",strokeLinecap:"round"}),{width:40,height:20})),rS=z((0,b.jsxs)("g",{strokeWidth:"2",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M5 12h2"}),(0,b.jsx)("path",{d:"M17 12h2"}),(0,b.jsx)("path",{d:"M11 12h2"})]}),Ce),oS=z((0,b.jsxs)("g",{strokeWidth:"2",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M4 12v.01"}),(0,b.jsx)("path",{d:"M8 12v.01"}),(0,b.jsx)("path",{d:"M12 12v.01"}),(0,b.jsx)("path",{d:"M16 12v.01"}),(0,b.jsx)("path",{d:"M20 12v.01"})]}),Ce),nS=z((0,b.jsx)("path",{d:"M2.5 12.038c1.655-.885 5.9-3.292 8.568-4.354 2.668-1.063.101 2.821 1.32 3.104 1.218.283 5.112-1.814 5.112-1.814",strokeWidth:"1.25"}),xe),iS=z((0,b.jsx)("path",{d:"M2.5 12.563c1.655-.886 5.9-3.293 8.568-4.355 2.668-1.062.101 2.822 1.32 3.105 1.218.283 5.112-1.814 5.112-1.814m-13.469 2.23c2.963-1.586 6.13-5.62 7.468-4.998 1.338.623-1.153 4.11-.132 5.595 1.02 1.487 6.133-1.43 6.133-1.43",strokeWidth:"1.25"}),xe),aS=z((0,b.jsx)("path",{d:"M2.5 11.936c1.737-.879 8.627-5.346 10.42-5.268 1.795.078-.418 5.138.345 5.736.763.598 3.53-1.789 4.235-2.147M2.929 9.788c1.164-.519 5.47-3.28 6.987-3.114 1.519.165 1 3.827 2.121 4.109 1.122.281 3.839-2.016 4.606-2.42",strokeWidth:"1.25"}),xe),sS=z((0,b.jsxs)("svg",{strokeWidth:"1.5",children:[(0,b.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,b.jsx)("path",{d:"M13.3333 3.33331V3.34331"}),(0,b.jsx)("path",{d:"M16.6667 3.33331V3.34331"}),(0,b.jsx)("path",{d:"M16.6667 6.66669V6.67669"}),(0,b.jsx)("path",{d:"M16.6667 10V10.01"}),(0,b.jsx)("path",{d:"M3.33334 13.3333V13.3433"}),(0,b.jsx)("path",{d:"M16.6667 13.3333V13.3433"}),(0,b.jsx)("path",{d:"M3.33334 16.6667V16.6767"}),(0,b.jsx)("path",{d:"M6.66666 16.6667V16.6767"}),(0,b.jsx)("path",{d:"M10 16.6667V16.6767"}),(0,b.jsx)("path",{d:"M13.3333 16.6667V16.6767"}),(0,b.jsx)("path",{d:"M16.6667 16.6667V16.6767"})]}),xe),lS=z((0,b.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M4 12v-4a4 4 0 0 1 4 -4h4"}),(0,b.jsx)("line",{x1:"16",y1:"4",x2:"16",y2:"4.01"}),(0,b.jsx)("line",{x1:"20",y1:"4",x2:"20",y2:"4.01"}),(0,b.jsx)("line",{x1:"20",y1:"8",x2:"20",y2:"8.01"}),(0,b.jsx)("line",{x1:"20",y1:"12",x2:"20",y2:"12.01"}),(0,b.jsx)("line",{x1:"4",y1:"16",x2:"4",y2:"16.01"}),(0,b.jsx)("line",{x1:"20",y1:"16",x2:"20",y2:"16.01"}),(0,b.jsx)("line",{x1:"4",y1:"20",x2:"4",y2:"20.01"}),(0,b.jsx)("line",{x1:"8",y1:"20",x2:"8",y2:"20.01"}),(0,b.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"20.01"}),(0,b.jsx)("line",{x1:"16",y1:"20",x2:"16",y2:"20.01"}),(0,b.jsx)("line",{x1:"20",y1:"20",x2:"20",y2:"20.01"})]}),Ce),cS=z((0,b.jsx)("path",{d:"M6 10H34",stroke:"currentColor",strokeWidth:2,fill:"none"}),{width:40,height:20}),dS=Nr.default.memo(({flip:e=!1})=>z((0,b.jsxs)("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",strokeWidth:2,fill:"none",children:[(0,b.jsx)("path",{d:"M34 10H6M34 10L27 5M34 10L27 15"}),(0,b.jsx)("path",{d:"M27.5 5L34.5 10L27.5 15"})]}),{width:40,height:20})),Ub=Nr.default.memo(({flip:e=!1})=>z((0,b.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",children:[(0,b.jsx)("path",{d:"M32 10L6 10",strokeWidth:2}),(0,b.jsx)("circle",{r:"4",transform:"matrix(-1 0 0 1 30 10)"})]}),{width:40,height:20})),uS=Nr.default.memo(({flip:e=!1})=>z((0,b.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,children:[(0,b.jsx)("path",{d:"M26 10L6 10"}),(0,b.jsx)("circle",{r:"4",transform:"matrix(-1 0 0 1 30 10)"})]}),{width:40,height:20})),mS=Nr.default.memo(({flip:e=!1})=>z((0,b.jsx)("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",children:(0,b.jsx)("path",{d:"M34 10H5.99996M34 10L34 5M34 10L34 15",stroke:"currentColor",strokeWidth:2,fill:"none"})}),{width:40,height:20})),pS=Nr.default.memo(({flip:e=!1})=>z((0,b.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",children:[(0,b.jsx)("path",{d:"M32 10L6 10",strokeWidth:2}),(0,b.jsx)("path",{d:"M27.5 5.5L34.5 10L27.5 14.5L27.5 5.5"})]}),{width:40,height:20})),fS=Nr.default.memo(({flip:e=!1})=>z((0,b.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,strokeLinejoin:"round",children:[(0,b.jsx)("path",{d:"M6,9.5H27"}),(0,b.jsx)("path",{d:"M27,5L34,10L27,14Z",fill:"none"})]}),{width:40,height:20})),hS=Nr.default.memo(({flip:e=!1})=>z((0,b.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",strokeWidth:2,children:[(0,b.jsx)("path",{d:"M6,9.5H20"}),(0,b.jsx)("path",{d:"M27,5L34,10L27,14L20,9.5Z"})]}),{width:40,height:20})),gS=Nr.default.memo(({flip:e=!1})=>z((0,b.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",strokeWidth:2,children:[(0,b.jsx)("path",{d:"M6,9.5H20"}),(0,b.jsx)("path",{d:"M27,5L34,10L27,14L20,9.5Z"})]}),{width:40,height:20})),bS=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("g",{clipPath:"url(#a)",children:(0,b.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,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),xS=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("g",{clipPath:"url(#a)",children:(0,b.jsx)("path",{d:"M5 16.667V3.333L10 15l5-11.667v13.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),ES=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("g",{clipPath:"url(#a)",children:(0,b.jsx)("path",{d:"M5.833 3.333v13.334h8.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),yS=z((0,b.jsx)(b.Fragment,{children:(0,b.jsx)("path",{d:"m1.667 3.333 6.666 13.334M8.333 3.333 1.667 16.667M11.667 3.333v13.334h6.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),xe),wS=z((0,b.jsx)(b.Fragment,{children:(0,b.jsx)("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,b.jsx)("path",{d:"M5.833 16.667v-10a3.333 3.333 0 0 1 3.334-3.334h1.666a3.333 3.333 0 0 1 3.334 3.334v10M5.833 10.833h8.334"})})}),xe),vS=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,b.jsx)("path",{d:"M5.833 6.667 2.5 10l3.333 3.333M14.167 6.667 17.5 10l-3.333 3.333M11.667 3.333 8.333 16.667"})}),(0,b.jsx)("defs",{children:(0,b.jsx)("clipPath",{id:"a",children:(0,b.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),xe),TS=z((0,b.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,b.jsx)("line",{x1:"4",y1:"12",x2:"12",y2:"12"}),(0,b.jsx)("line",{x1:"4",y1:"16",x2:"16",y2:"16"})]}),Ce),SS=z((0,b.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,b.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),(0,b.jsx)("line",{x1:"6",y1:"16",x2:"18",y2:"16"})]}),Ce),CS=z((0,b.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,b.jsx)("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),(0,b.jsx)("line",{x1:"8",y1:"16",x2:"20",y2:"16"})]}),Ce),IS=Nr.default.memo(({theme:e})=>z((0,b.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("line",{x1:"4",y1:"4",x2:"20",y2:"4"}),(0,b.jsx)("rect",{x:"9",y:"8",width:"6",height:"12",rx:"2"})]}),Ce)),kS=Nr.default.memo(({theme:e})=>z((0,b.jsxs)("g",{strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("line",{x1:"4",y1:"20",x2:"20",y2:"20"}),(0,b.jsx)("rect",{x:"9",y:"4",width:"6",height:"12",rx:"2"})]}),Ce)),_S=Nr.default.memo(({theme:e})=>z((0,b.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("line",{x1:"4",y1:"12",x2:"9",y2:"12"}),(0,b.jsx)("line",{x1:"15",y1:"12",x2:"20",y2:"12"}),(0,b.jsx)("rect",{x:"9",y:"6",width:"6",height:"12",rx:"2"})]}),Ce)),AS=z((0,b.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}),eW=z((0,b.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"})),MS=z((0,b.jsxs)("g",{strokeWidth:1.25,children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5"}),(0,b.jsx)("path",{d:"M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5"}),(0,b.jsx)("path",{d:"M14 5.5a1.5 1.5 0 0 1 3 0v6.5"}),(0,b.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"})]}),Ce),Wb=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),(0,b.jsx)("path",{d:"M7 11l5 5l5 -5"}),(0,b.jsx)("path",{d:"M12 4l0 12"})]}),Ce),of=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.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,b.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"})]}),Ce),PS=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),(0,b.jsx)("path",{d:"M12 17l0 .01"}),(0,b.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),Ce),tW=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M7 4v16l13 -8z"})]}),Ce),rW=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.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"})]}),Ce),oW=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M5 12l5 5l10 -10"})]}),Ce),LS=z((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.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,b.jsx)("path",{d:"M12 9v4"}),(0,b.jsx)("path",{d:"M12 17h.01"})]}),Ce),DS=z((0,b.jsxs)("g",{strokeWidth:1.25,children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M11 7l6 6"}),(0,b.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"})]}),Ce),RS=z((0,b.jsxs)("g",{strokeWidth:1.5,children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M12 3l-4 7h8z"}),(0,b.jsx)("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,b.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"})]}),Ce),OS=z((0,b.jsxs)("g",{strokeWidth:1.5,children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M4 7l16 0"}),(0,b.jsx)("path",{d:"M4 17l16 0"}),(0,b.jsx)("path",{d:"M7 4l0 16"}),(0,b.jsx)("path",{d:"M17 4l0 16"})]}),Ce),NS=z((0,b.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"})),Vl=z((0,b.jsxs)("g",{strokeWidth:"1.25",children:[(0,b.jsx)("path",{d:"M4.16602 10H15.8327"}),(0,b.jsx)("path",{d:"M12.5 13.3333L15.8333 10"}),(0,b.jsx)("path",{d:"M12.5 6.66666L15.8333 9.99999"})]}),xe),nf=z((0,b.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",transform:"rotate(90 10 10)",children:[(0,b.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,b.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),Yl=z((0,b.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z"}),(0,b.jsx)("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),(0,b.jsx)("path",{d:"M15 6l3 3"}),(0,b.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,b.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"})]}),Ce),Qd=z((0,b.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35"}),(0,b.jsx)("path",{d:"M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946"}),(0,b.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,b.jsx)("path",{d:"M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45"}),(0,b.jsx)("path",{d:"M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946"}),(0,b.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"})]}),Ce),FS=z((0,b.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2"}),(0,b.jsx)("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),(0,b.jsx)("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),(0,b.jsx)("path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2"})]}),Ce),af=z((0,b.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"}),(0,b.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"})]}),Ce),BS=z((0,b.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828"}),(0,b.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,b.jsx)("path",{d:"M3 3l18 18"})]}),Ce),zS=z((0,b.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.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,b.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,b.jsx)("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),(0,b.jsx)("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),(0,b.jsx)("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),(0,b.jsx)("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),Ce),HS=z((0,b.jsxs)("g",{strokeWidth:1.5,children:[(0,b.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,b.jsx)("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),(0,b.jsx)("path",{d:"M21 21l-6 -6"})]}),Ce);var GS=S(_(),1),jL=(e,t)=>{let r=new Set(Se(e.filter(o=>le(o)),t).map(o=>o.id));return{elements:e.map(o=>t.selectedElementIds[o.id]?de(o,{isDeleted:!0}):o.frameId&&r.has(o.frameId)?de(o,{isDeleted:!0}):$e(o)&&t.selectedElementIds[o.containerId]?de(o,{isDeleted:!0}):o),appState:{...t,selectedElementIds:{},selectedGroupIds:{}}}},$S=(e,t)=>{if(e.editingGroupId){let r=Et(we(t),e.editingGroupId);if(r.length)return{...e,selectedElementIds:{[r[0].id]:!0}}}return e},eu=U({name:"deleteSelectedElements",trackEvent:{category:"element",action:"delete"},perform:(e,t)=>{if(t.editingLinearElement){let{elementId:n,selectedPointsIndices:i,startBindingElement:a,endBindingElement:s}=t.editingLinearElement,c=re.getElement(n);if(!c||i==null)return!1;if(c.points.length<2){let d=e.map(m=>m.id===c.id?de(m,{isDeleted:!0}):m),u=$S(t,d);return{elements:d,appState:{...u,editingLinearElement:null},commitToHistory:!1}}let l={startBindingElement:i?.includes(0)?null:a,endBindingElement:i?.includes(c.points.length-1)?null:s};return re.deletePoints(c,i),{elements:e,appState:{...t,editingLinearElement:{...t.editingLinearElement,...l,selectedPointsIndices:i?.[0]>0?[i[0]-1]:[0]}},commitToHistory:!0}}let{elements:r,appState:o}=jL(e,t);return Kl(r,e.filter(({id:n})=>t.selectedElementIds[n])),o=$S(o,r),{elements:r,appState:{...o,activeTool:st(t,{type:"selection"}),multiElement:null,activeEmbeddable:null},commitToHistory:Je(we(e),t)}},contextItemLabel:"labels.delete",keyTest:(e,t,r)=>(e.key===k.BACKSPACE||e.key===k.DELETE)&&!e[k.CTRL_OR_CMD],PanelComponent:({elements:e,appState:t,updateData:r})=>(0,GS.jsx)(be,{type:"button",icon:ba,title:E("labels.delete"),"aria-label":E("labels.delete"),onClick:()=>r(null),visible:Je(we(e),t)})});h();h();var Vb=(e,t)=>e.frameId===t||e.id===t,WS=(e,t,r)=>{let o=[],n=[],i=null,a=-1,s=He(r||Se(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0}));for(;++a<e.length;){let c=e[a];s.get(c.id)?(n.length&&(o=o.concat(n),n=[]),o.push(a),i=a+1):c.isDeleted&&i===a?(i=a+1,n.push(a)):n=[]}return o},qL=e=>{let t=0;return e.reduce((r,o,n)=>(n>0&&e[n-1]!==o-1&&(t=++t),(r[t]||(r[t]=[])).push(o),r),[])},US=(e,t,r)=>{if("containerId"in e&&e.containerId)if(r==="left"){let o=_e.getScene(e).getElement(e.containerId);if(o)return t.indexOf(o)}else return t.indexOf(e);else{let o=e.boundElements?.find(n=>n.type!=="arrow")?.id;if(o){if(r==="left")return t.indexOf(e);let n=_e.getScene(e).getElement(o);if(n)return t.indexOf(n)}}},JL=(e,t)=>{let r=-1,o=-1;return e.forEach((n,i)=>{Vb(n,t)&&(r===-1&&(r=i),o=i)}),r===-1?[]:e.slice(r,o+1)},QL=(e,t,r,o,n)=>{let i=t[r],a=u=>u.isDeleted?!1:n?u.frameId===n:e.editingGroupId?u.groupIds.includes(e.editingGroupId):!0,s=o==="left"?db(t,u=>a(u),Math.max(0,r-1)):cb(t,u=>a(u),r+1),c=t[s];if(!c)return-1;if(e.editingGroupId){if(i?.groupIds.join("")===c?.groupIds.join(""))return US(c,t,o)??s;if(!c?.groupIds.includes(e.editingGroupId))return-1}if(!n&&(c.frameId||le(c))){let u=JL(t,c.frameId||c.id);return o==="left"?t.indexOf(u[0]):t.indexOf(u[u.length-1])}if(!c.groupIds.length)return US(c,t,o)??s;let l=e.editingGroupId?c.groupIds[c.groupIds.indexOf(e.editingGroupId)-1]:c.groupIds[c.groupIds.length-1],d=Et(t,l);return d.length?o==="left"?t.indexOf(d[0]):t.indexOf(d[d.length-1]):s},VS=(e,t)=>t.reduce((r,o)=>{let n=e[o];return r[n.id]=n,r},{}),YS=(e,t,r)=>{let o=WS(e,t),n=VS(e,o),i=qL(o);r==="right"&&(i=i.reverse());let a=new Set(o.filter(s=>le(e[s])).map(s=>e[s].id));return i.forEach((s,c)=>{let l=s[0],d=s[s.length-1],u=r==="left"?l:d,m=s.some(w=>{let T=e[w];return T.frameId&&a.has(T.frameId)})?null:e[u]?.frameId,p=QL(t,e,u,r,m);if(p===-1||u===p)return;let f=r==="left"?e.slice(0,p):e.slice(0,l),g=e.slice(l,d+1),x=r==="left"?e.slice(p,l):e.slice(d+1,p+1),y=r==="left"?e.slice(d+1):e.slice(p+1);e=r==="left"?[...f,...g,...x,...y]:[...f,...x,...g,...y]}),e.map(s=>n[s.id]?un(s):s)},KS=(e,t,r,o,n)=>{let i=WS(e,t,n),a=VS(e,i),s=[],c,l;if(r==="left"){if(o)c=cb(e,p=>Vb(p,o));else if(t.editingGroupId){let p=Et(e,t.editingGroupId);if(!p.length)return e;c=e.indexOf(p[0])}else c=0;l=i[i.length-1]}else{if(o)l=db(e,p=>Vb(p,o));else if(t.editingGroupId){let p=Et(e,t.editingGroupId);if(!p.length)return e;l=e.indexOf(p[p.length-1])}else l=e.length-1;c=i[0]}c===-1&&(c=0);for(let p=c;p<l+1;p++)i.includes(p)||s.push(e[p]);let d=Object.values(a).map(p=>un(p)),u=e.slice(0,c),m=e.slice(l+1);return r==="left"?[...u,...d,...s,...m]:[...u,...s,...d,...m]};function ZS(e,t,r,o){let n=He(Se(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),i={regularElements:[],frameChildren:new Map},a=new Set;for(let l of e)n.has(l.id)&&le(l)&&a.add(l.id);for(let l of e)if(n.has(l.id))if(le(l)||l.frameId&&a.has(l.frameId))i.regularElements.push(l);else if(!l.frameId)i.regularElements.push(l);else{let d=i.frameChildren.get(l.frameId)||[];d.push(l),i.frameChildren.set(l.frameId,d)}let s=e,c=Array.from(i.frameChildren.entries());for(let[l,d]of c)s=o(e,t,r,l,d);return o(s,t,r,null,i.regularElements)}var XS=(e,t)=>YS(e,t,"left"),jS=(e,t)=>YS(e,t,"right"),qS=(e,t)=>ZS(e,t,"left",KS),JS=(e,t)=>ZS(e,t,"right",KS);var tu=S(_(),1),Yb=U({name:"sendBackward",trackEvent:{category:"element"},perform:(e,t)=>({elements:XS(e,t),appState:t,commitToHistory:!0}),contextItemLabel:"labels.sendBackward",keyPriority:40,keyTest:e=>e[k.CTRL_OR_CMD]&&!e.shiftKey&&e.code===ve.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,tu.jsx)("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${E("labels.sendBackward")} \u2014 ${H("CtrlOrCmd+[")}`,children:NT})}),Kb=U({name:"bringForward",trackEvent:{category:"element"},perform:(e,t)=>({elements:jS(e,t),appState:t,commitToHistory:!0}),contextItemLabel:"labels.bringForward",keyPriority:40,keyTest:e=>e[k.CTRL_OR_CMD]&&!e.shiftKey&&e.code===ve.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,tu.jsx)("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${E("labels.bringForward")} \u2014 ${H("CtrlOrCmd+]")}`,children:OT})}),Zb=U({name:"sendToBack",trackEvent:{category:"element"},perform:(e,t)=>({elements:qS(e,t),appState:t,commitToHistory:!0}),contextItemLabel:"labels.sendToBack",keyTest:e=>Dr?e[k.CTRL_OR_CMD]&&e.altKey&&e.code===ve.BRACKET_LEFT:e[k.CTRL_OR_CMD]&&e.shiftKey&&e.code===ve.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,tu.jsx)("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${E("labels.sendToBack")} \u2014 ${Dr?H("CtrlOrCmd+Alt+["):H("CtrlOrCmd+Shift+[")}`,children:BT})}),Xb=U({name:"bringToFront",trackEvent:{category:"element"},perform:(e,t)=>({elements:JS(e,t),appState:t,commitToHistory:!0}),contextItemLabel:"labels.bringToFront",keyTest:e=>Dr?e[k.CTRL_OR_CMD]&&e.altKey&&e.code===ve.BRACKET_RIGHT:e[k.CTRL_OR_CMD]&&e.shiftKey&&e.code===ve.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,tu.jsx)("button",{type:"button",className:"zIndexButton",onClick:r=>e(null),title:`${E("labels.bringToFront")} \u2014 ${Dr?H("CtrlOrCmd+Alt+]"):H("CtrlOrCmd+Shift+]")}`,children:FT})});h();var jb=U({name:"selectAll",trackEvent:{category:"canvas"},perform:(e,t,r,o)=>{if(t.editingLinearElement)return!1;let n=Ss(e.filter(i=>!i.isDeleted&&!(ee(i)&&i.containerId)&&!i.locked)).reduce((i,a)=>(i[a.id]=!0,i),{});return{appState:{...t,...fr({editingGroupId:null,selectedElementIds:n},we(e),t,o),selectedLinearElement:Object.keys(n).length===1&&me(e[0])?new re(e[0],o.scene):null},commitToHistory:!0}},contextItemLabel:"labels.selectAll",keyTest:e=>e[k.CTRL_OR_CMD]&&e.key===k.A});h();h();var e7=e=>{let t=e.slice(),r=new Set,o=i=>{let a=i[0]?.groupIds?.join(""),s=[i[0]],c=[];for(let l of i.slice(1))l.groupIds?.join("")===a?s.push(l):c.push(l);return c.length?[...s,...o(c)]:s},n=new Map;return t.forEach((i,a)=>{if(!n.has(i.id))if(i.groupIds?.length){let s=i.groupIds[i.groupIds.length-1],c=t.slice(a).filter(l=>{let d=l?.groupIds?.some(u=>u===s);return d&&n.set(l.id,!0),d});for(let l of o(c))r.add(l)}else r.add(i)}),r.size!==e.length?(console.error("normalizeGroupElementOrder: lost some elements... bailing!"),e):[...r]},t7=e=>{let t=F2(e),r=e.slice(),o=new Set;return r.forEach((n,i)=>{n&&(n.boundElements?.length?(o.add(n),r[i]=null,n.boundElements.forEach(a=>{let s=t.get(a.id);s&&a.type==="text"&&(o.add(s[0]),r[s[1]]=null)})):n.type==="text"&&n.containerId&&t.get(n.containerId)?.[0].boundElements?.find(s=>s.id===n.id)||(o.add(n),r[i]=null))}),o.size!==e.length?(console.error("normalizeBoundElementsOrder: lost some elements... bailing!"),e):[...o]},QS=e=>t7(e7(e));var e5=S(_(),1),qb=U({name:"duplicateSelection",trackEvent:{category:"element"},perform:(e,t)=>{if(t.editingLinearElement){let r=re.duplicateSelectedPoints(t);return r?{elements:e,appState:r.appState,commitToHistory:!0}:!1}return{...r7(e,t),commitToHistory:!0}},contextItemLabel:"labels.duplicateSelection",keyTest:e=>e[k.CTRL_OR_CMD]&&e.key===k.D,PanelComponent:({elements:e,appState:t,updateData:r})=>(0,e5.jsx)(be,{type:"button",icon:ET,title:`${E("labels.duplicateSelection")} \u2014 ${H("CtrlOrCmd+D")}`,"aria-label":E("labels.duplicateSelection"),onClick:()=>r(null),visible:Je(we(e),t)})}),r7=(e,t)=>{let r=QS(e),o=new Map,n=[],i=[],a=new Map,s=y=>{let w=Jd(t.editingGroupId,o,y,{x:y.x+fi/2,y:y.y+fi/2});return a.set(y.id,w.id),i.push(y),n.push(w),w},c=He(Se(r,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),l=new Map,d=y=>{for(let w of y)l.set(w.id,!0);return y},u=[],m=-1;for(;++m<r.length;){let y=r[m];if(l.get(y.id))continue;let w=ye(y),T=le(y);if(c.get(y.id)){if(y.groupIds.length||w||T){let C=Fb(t,y);if(C){let I=Et(r,C).flatMap(A=>le(A)?[...po(e,A.id),A]:[A]);u.push(...d([...I,...I.map(A=>s(A))]));continue}if(w){u.push(...d([y,w,s(y),s(w)]));continue}if(T){let I=po(r,y.id);u.push(...d([...I,y,...I.map(A=>s(A)),s(y)]));continue}}(!y.frameId||!c.has(y.frameId))&&u.push(...d([y,s(y)]))}else u.push(...d([y]))}let p=[],f=new Map;for(m=u.length;--m>=0;){let y=u[m];f.get(y.id)||(f.set(y.id,!0),p.push(y))}let g=p.reverse();lf(u,i,a),sf(u,i,a),cf(g,i,a);let x=Ss(n);return{elements:g,appState:{...t,...fr({editingGroupId:t.editingGroupId,selectedElementIds:x.reduce((y,w)=>($e(w)||(y[w.id]=!0),y),{})},we(g),t,null)}}};h();h();var o7=["ai"],Ae=(e,t,r,o)=>{try{if(typeof window>"u"||v.VITE_WORKER_ID||v.PROD||!o7.includes(e))return;v.PROD||console.info("trackEvent",{category:e,action:t,label:r,value:o}),window.sa_event&&window.sa_event(t,{category:e,label:r,value:o})}catch(n){console.error("error during analytics",n)}};h();var Zl=S(_(),1),Zn=e=>(0,Zl.jsx)("div",{className:"buttonList buttonListIcon",children:e.options.map(t=>e.type==="button"?(0,Zl.jsx)("button",{onClick:r=>e.onClick(t.value,r),className:G({active:t.active??e.value===t.value}),"data-testid":t.testId,title:t.text,children:t.icon},t.text):(0,Zl.jsxs)("label",{className:G({active:e.value===t.value}),title:t.text,children:[(0,Zl.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))});h();h();var df=S(_(),1),t5=({onChange:e,type:t,activeColor:r,topPicks:o})=>{let n;return t==="elementStroke"&&(n=Hm),t==="elementBackground"&&(n=$m),t==="canvasBackground"&&(n=Gm),o&&(n=o),n?(0,df.jsx)("div",{className:"color-picker__top-picks",children:n.map(i=>(0,df.jsx)("button",{className:G("color-picker__button",{active:i===r,"is-transparent":i==="transparent"||!i}),style:{"--swatch-color":i},type:"button",title:i,onClick:()=>e(i),"data-testid":`color-top-pick-${i}`,children:(0,df.jsx)("div",{className:"color-picker__button-outline"})},i))}):(console.error("Invalid type for TopPicks"),null)};h();var Ea=S(W(),1);h();var uf=S(W(),1);h();var xa=({palette:e,color:t})=>{for(let[r,o]of Object.entries(e))if(Array.isArray(o)){let n=o.indexOf(t);if(n>-1)return{colorName:r,shade:n}}else if(o===t)return{colorName:r,shade:null};return null},ru=[["q","w","e","r","t"],["a","s","d","f","g"],["z","x","c","v","b"]].flat(),Jb=({color:e,palette:t})=>!Object.values(t).flat().includes(e),o5=(e,t,r)=>{let o={elementBackground:"backgroundColor",elementStroke:"strokeColor"},n=e.filter(a=>{if(a.isDeleted)return!1;let s=a[o[t]];return Jb({color:s,palette:r})}),i=new Map;return n.forEach(a=>{let s=a[o[t]];i.has(s)?i.set(s,i.get(s)+1):i.set(s,1)}),[...i.entries()].sort((a,s)=>s[1]-a[1]).map(a=>a[0]).slice(0,Uv)},No=bt(null),r5=(e,t,r)=>(e*299+t*587+r*114)/1e3>=160?"black":"white",n5=(e,t)=>{if(t){let i=new Option().style;if(i.color=e,i.color){let a=i.color.replace(/^(rgb|rgba)\(/,"").replace(/\)$/,"").replace(/\s/g,"").split(","),s=parseInt(a[0]),c=parseInt(a[1]),l=parseInt(a[2]);return r5(s,c,l)}}if(e==="transparent")return"black";let r=parseInt(e.substring(1,3),16),o=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16);return r5(r,o,n)};h();var i5=S(_(),1),n7=({color:e,keyLabel:t,isCustomColor:r=!1,isShade:o=!1})=>(0,i5.jsxs)("div",{className:"color-picker__button__hotkey-label",style:{color:n5(e,r)},children:[o&&"\u21E7",t]}),Xl=n7;var Ii=S(_(),1),a5=({hex:e,onChange:t,palette:r})=>{let o=xa({color:e||"transparent",palette:r}),[n,i]=Ne(No),a=(0,uf.useRef)(null);if((0,uf.useEffect)(()=>{a.current&&n==="shades"&&a.current.focus()},[o,n]),o){let{colorName:s,shade:c}=o,l=r[s];if(Array.isArray(l))return(0,Ii.jsx)("div",{className:"color-picker-content--default shades",children:l.map((d,u)=>(0,Ii.jsxs)("button",{ref:u===c&&n==="shades"?a:void 0,tabIndex:-1,type:"button",className:G("color-picker__button color-picker__button--large",{active:u===c}),"aria-label":"Shade",title:`${s} - ${u+1}`,style:d?{"--swatch-color":d}:void 0,onClick:()=>{t(d),i("shades")},children:[(0,Ii.jsx)("div",{className:"color-picker__button-outline"}),(0,Ii.jsx)(Xl,{color:d,keyLabel:u+1,isShade:!0})]},u))})}return(0,Ii.jsxs)("div",{className:"color-picker-content--default",style:{position:"relative"},tabIndex:-1,children:[(0,Ii.jsx)("button",{type:"button",tabIndex:-1,className:"color-picker__button color-picker__button--large color-picker__button--no-focus-visible"}),(0,Ii.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:E("colorPicker.noShades")})]})};h();var mf=S(W(),1);var jl=S(_(),1),i7=({palette:e,color:t,onChange:r,label:o,activeShade:n})=>{let i=xa({color:t||"transparent",palette:e}),[a,s]=Ne(No),c=(0,mf.useRef)(null);return(0,mf.useEffect)(()=>{c.current&&a==="baseColors"&&c.current.focus()},[i?.colorName,a]),(0,jl.jsx)("div",{className:"color-picker-content--default",children:Object.entries(e).map(([l,d],u)=>{let m=(Array.isArray(d)?d[n]:d)||"transparent",p=ru[u],f=E(`colors.${l.replace(/\d+/,"")}`,null,"");return(0,jl.jsxs)("button",{ref:i?.colorName===l?c:void 0,tabIndex:-1,type:"button",className:G("color-picker__button color-picker__button--large",{active:i?.colorName===l,"is-transparent":m==="transparent"||!m}),onClick:()=>{r(m),s("baseColors")},title:`${f}${m.startsWith("#")?` ${m}`:""} \u2014 ${p}`,"aria-label":`${f} \u2014 ${p}`,style:m?{"--swatch-color":m}:void 0,"data-testid":`color-${l}`,children:[(0,jl.jsx)("div",{className:"color-picker__button-outline"}),(0,jl.jsx)(Xl,{color:m,keyLabel:p})]},l)})})},s5=i7;h();var pf=S(W(),1);var ql=S(_(),1),l5=({colors:e,color:t,onChange:r,label:o})=>{let[n,i]=Ne(No),a=(0,pf.useRef)(null);return(0,pf.useEffect)(()=>{a.current&&a.current.focus()},[t,n]),(0,ql.jsx)("div",{className:"color-picker-content--default",children:e.map((s,c)=>(0,ql.jsxs)("button",{ref:t===s?a:void 0,tabIndex:-1,type:"button",className:G("color-picker__button color-picker__button--large",{active:t===s,"is-transparent":s==="transparent"||!s}),onClick:()=>{r(s),i("custom")},title:s,"aria-label":o,style:{"--swatch-color":s},children:[(0,ql.jsx)("div",{className:"color-picker__button-outline"}),(0,ql.jsx)(Xl,{color:s,keyLabel:c+1,isCustomColor:!0})]},c))})};h();var Qb=(e,t,r)=>{let o=Math.ceil(r/ns);switch(t=t??-1,e){case"ArrowLeft":{let n=t-1;return n<0?r-1:n}case"ArrowRight":return(t+1)%r;case"ArrowDown":{let n=t+ns;return n>=r?t%ns:n}case"ArrowUp":{let n=t-ns,i=n<0?ns*o+n:n;return i>=r?void 0:i}}},a7=({e,colorObj:t,onChange:r,palette:o,customColors:n,setActiveColorPickerSection:i,activeShade:a})=>{if(t?.shade!=null&&["Digit1","Digit2","Digit3","Digit4","Digit5"].includes(e.code)&&e.shiftKey){let s=Number(e.code.slice(-1))-1;return r(o[t.colorName][s]),i("shades"),!0}if(["1","2","3","4","5"].includes(e.key)&&n[Number(e.key)-1])return r(n[Number(e.key)-1]),i("custom"),!0;if(ru.includes(e.key)){let s=ru.indexOf(e.key),c=Object.keys(o)[s],l=o[c],d=Array.isArray(l)?l[a]:l;return r(d),i("baseColors"),!0}return!1},c5=({event:e,activeColorPickerSection:t,palette:r,color:o,onChange:n,customColors:i,setActiveColorPickerSection:a,updateData:s,activeShade:c,onEyeDropperToggle:l,onEscape:d})=>{if(e[k.CTRL_OR_CMD])return!1;if(e.key===k.ESCAPE)return d(e),!0;if(e.key===k.ALT)return l(!0),!0;if(e.key===k.I)return l(),!0;let u=xa({color:o,palette:r});if(e.key===k.TAB){let m={custom:!!i.length,baseColors:!0,shades:u?.shade!=null,hex:!0},p=Object.entries(m).reduce((w,[T,C])=>(C&&w.push(T),w),[]),f=p.indexOf(t),g=e.shiftKey?-1:1,x=f+g>p.length-1?0:f+g<0?p.length-1:f+g,y=p[x];return y&&a(y),y==="custom"?n(i[0]):y==="baseColors"&&(Object.entries(r).find(([T,C])=>Array.isArray(C)?C.includes(o):C===o?T:null)||n(ge.black)),e.preventDefault(),e.stopPropagation(),!0}if(a7({e,colorObj:u,onChange:n,palette:r,customColors:i,setActiveColorPickerSection:a,activeShade:c}))return!0;if(t==="shades"&&u){let{shade:m}=u,p=Qb(e.key,m,ns);if(p!==void 0)return n(r[u.colorName][p]),!0}if(t==="baseColors"&&u){let{colorName:m}=u,p=Object.keys(r),f=p.indexOf(m),g=Qb(e.key,f,p.length);if(g!==void 0){let x=p[g],y=r[x];return n(Array.isArray(y)?y[c]:y),!0}}if(t==="custom"){let m=i.indexOf(o),p=Qb(e.key,m,i.length);if(p!==void 0){let f=i[p];return n(f),!0}}return!1};h();var d5=S(_(),1),s7=({children:e})=>(0,d5.jsx)("div",{className:"color-picker__heading",children:e}),Jl=s7;var fo=S(_(),1),u5=({color:e,onChange:t,label:r,type:o,elements:n,palette:i,updateData:a,children:s,onEyeDropperToggle:c,onEscape:l})=>{let[d]=Ea.default.useState(()=>o==="canvasBackground"?[]:o5(n,o,i)),[u,m]=Ne(No),p=xa({color:e,palette:i});(0,Ea.useEffect)(()=>{if(!u){let y=Jb({color:e,palette:i}),w=y&&!d.includes(e);m(w?"hex":y?"custom":p?.shade!=null?"shades":"baseColors")}},[u,e,i,m,p,d]);let[f,g]=(0,Ea.useState)(p?.shade??(o==="elementBackground"?gl:hl));(0,Ea.useEffect)(()=>{p?.shade!=null&&g(p.shade);let y=w=>{w.key===k.ALT&&c(!1)};return document.addEventListener("keyup",y,{capture:!0}),()=>{document.removeEventListener("keyup",y,{capture:!0})}},[p,c]);let x=Ea.default.useRef(null);return(0,fo.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":E("labels.colorPicker"),children:(0,fo.jsxs)("div",{ref:x,onKeyDown:y=>{c5({event:y,activeColorPickerSection:u,palette:i,color:e,onChange:t,onEyeDropperToggle:c,customColors:d,setActiveColorPickerSection:m,updateData:a,activeShade:f,onEscape:l})&&(y.preventDefault(),y.stopPropagation())},className:"color-picker-content",tabIndex:-1,children:[!!d.length&&(0,fo.jsxs)("div",{children:[(0,fo.jsx)(Jl,{children:E("colorPicker.mostUsedCustomColors")}),(0,fo.jsx)(l5,{colors:d,color:e,label:E("colorPicker.mostUsedCustomColors"),onChange:t})]}),(0,fo.jsxs)("div",{children:[(0,fo.jsx)(Jl,{children:E("colorPicker.colors")}),(0,fo.jsx)(s5,{color:e,label:r,palette:i,onChange:t,activeShade:f})]}),(0,fo.jsxs)("div",{children:[(0,fo.jsx)(Jl,{children:E("colorPicker.shades")}),(0,fo.jsx)(a5,{hex:e,onChange:t,palette:i})]}),s]})})};h();h();function Pe(){return Pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},Pe.apply(this,arguments)}var De=S(W());h();function Wt(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),r===!1||!n.defaultPrevented)return t?.(n)}}h();var m5=S(W());function l7(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function e1(...e){return t=>e.forEach(r=>l7(r,t))}function hr(...e){return(0,m5.useCallback)(e1(...e),e)}h();var pn=S(W());function Xn(e,t=[]){let r=[];function o(i,a){let s=(0,pn.createContext)(a),c=r.length;r=[...r,a];function l(u){let{scope:m,children:p,...f}=u,g=m?.[e][c]||s,x=(0,pn.useMemo)(()=>f,Object.values(f));return(0,pn.createElement)(g.Provider,{value:x},p)}function d(u,m){let p=m?.[e][c]||s,f=(0,pn.useContext)(p);if(f)return f;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,d]}let n=()=>{let i=r.map(a=>(0,pn.createContext)(a));return function(s){let c=s?.[e]||i;return(0,pn.useMemo)(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return n.scopeName=e,[o,c7(n,...t)]}function c7(...e){let t=e[0];if(e.length===1)return t;let r=()=>{let o=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(i){let a=o.reduce((s,{useScope:c,scopeName:l})=>{let u=c(i)[`__scope${l}`];return{...s,...u}},{});return(0,pn.useMemo)(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}h();var zt=S(W());h();var Ql=S(W()),p5=S(zn());h();var At=S(W());var ya=(0,At.forwardRef)((e,t)=>{let{children:r,...o}=e,n=At.Children.toArray(r),i=n.find(u7);if(i){let a=i.props.children,s=n.map(c=>c===i?At.Children.count(a)>1?At.Children.only(null):(0,At.isValidElement)(a)?a.props.children:null:c);return(0,At.createElement)(t1,Pe({},o,{ref:t}),(0,At.isValidElement)(a)?(0,At.cloneElement)(a,void 0,s):null)}return(0,At.createElement)(t1,Pe({},o,{ref:t}),r)});ya.displayName="Slot";var t1=(0,At.forwardRef)((e,t)=>{let{children:r,...o}=e;return(0,At.isValidElement)(r)?(0,At.cloneElement)(r,{...m7(o,r.props),ref:e1(t,r.ref)}):At.Children.count(r)>1?At.Children.only(null):null});t1.displayName="SlotClone";var d7=({children:e})=>(0,At.createElement)(At.Fragment,null,e);function u7(e){return(0,At.isValidElement)(e)&&e.type===d7}function m7(e,t){let r={...t};for(let o in t){let n=e[o],i=t[o];/^on[A-Z]/.test(o)?n&&i?r[o]=(...s)=>{i(...s),n(...s)}:n&&(r[o]=n):o==="style"?r[o]={...n,...i}:o==="className"&&(r[o]=[n,i].filter(Boolean).join(" "))}return{...e,...r}}var p7=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],Lt=p7.reduce((e,t)=>{let r=(0,Ql.forwardRef)((o,n)=>{let{asChild:i,...a}=o,s=i?ya:t;return(0,Ql.useEffect)(()=>{window[Symbol.for("radix-ui")]=!0},[]),(0,Ql.createElement)(s,Pe({},a,{ref:n}))});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function f5(e,t){e&&(0,p5.flushSync)(()=>e.dispatchEvent(t))}h();var ec=S(W());function Fr(e){let t=(0,ec.useRef)(e);return(0,ec.useEffect)(()=>{t.current=e}),(0,ec.useMemo)(()=>(...r)=>{var o;return(o=t.current)===null||o===void 0?void 0:o.call(t,...r)},[])}h();var h5=S(W());function g5(e,t=globalThis?.document){let r=Fr(e);(0,h5.useEffect)(()=>{let o=n=>{n.key==="Escape"&&r(n)};return t.addEventListener("keydown",o),()=>t.removeEventListener("keydown",o)},[r,t])}var r1="dismissableLayer.update",f7="dismissableLayer.pointerDownOutside",h7="dismissableLayer.focusOutside",b5,g7=(0,zt.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),E5=(0,zt.forwardRef)((e,t)=>{var r;let{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:s,onDismiss:c,...l}=e,d=(0,zt.useContext)(g7),[u,m]=(0,zt.useState)(null),p=(r=u?.ownerDocument)!==null&&r!==void 0?r:globalThis?.document,[,f]=(0,zt.useState)({}),g=hr(t,L=>m(L)),x=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),w=x.indexOf(y),T=u?x.indexOf(u):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,I=T>=w,A=b7(L=>{let D=L.target,M=[...d.branches].some(R=>R.contains(D));!I||M||(i?.(L),s?.(L),L.defaultPrevented||c?.())},p),P=x7(L=>{let D=L.target;[...d.branches].some(R=>R.contains(D))||(a?.(L),s?.(L),L.defaultPrevented||c?.())},p);return g5(L=>{T===d.layers.size-1&&(n?.(L),!L.defaultPrevented&&c&&(L.preventDefault(),c()))},p),(0,zt.useEffect)(()=>{if(u)return o&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(b5=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),x5(),()=>{o&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=b5)}},[u,p,o,d]),(0,zt.useEffect)(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),x5())},[u,d]),(0,zt.useEffect)(()=>{let L=()=>f({});return document.addEventListener(r1,L),()=>document.removeEventListener(r1,L)},[]),(0,zt.createElement)(Lt.div,Pe({},l,{ref:g,style:{pointerEvents:C?I?"auto":"none":void 0,...e.style},onFocusCapture:Wt(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Wt(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Wt(e.onPointerDownCapture,A.onPointerDownCapture)}))});function b7(e,t=globalThis?.document){let r=Fr(e),o=(0,zt.useRef)(!1),n=(0,zt.useRef)(()=>{});return(0,zt.useEffect)(()=>{let i=s=>{if(s.target&&!o.current){let l=function(){y5(f7,r,c,{discrete:!0})},c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",n.current),n.current=l,t.addEventListener("click",n.current,{once:!0})):l()}o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",n.current)}},[t,r]),{onPointerDownCapture:()=>o.current=!0}}function x7(e,t=globalThis?.document){let r=Fr(e),o=(0,zt.useRef)(!1);return(0,zt.useEffect)(()=>{let n=i=>{i.target&&!o.current&&y5(h7,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function x5(){let e=new CustomEvent(r1);document.dispatchEvent(e)}function y5(e,t,r,{discrete:o}){let n=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),o?f5(n,i):n.dispatchEvent(i)}h();var v5=S(W()),o1=0;function T5(){(0,v5.useEffect)(()=>{var e,t;let r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=r[0])!==null&&e!==void 0?e:w5()),document.body.insertAdjacentElement("beforeend",(t=r[1])!==null&&t!==void 0?t:w5()),o1++,()=>{o1===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(o=>o.remove()),o1--}},[])}function w5(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}h();var Jr=S(W());var n1="focusScope.autoFocusOnMount",i1="focusScope.autoFocusOnUnmount",S5={bubbles:!1,cancelable:!0};var _5=(0,Jr.forwardRef)((e,t)=>{let{loop:r=!1,trapped:o=!1,onMountAutoFocus:n,onUnmountAutoFocus:i,...a}=e,[s,c]=(0,Jr.useState)(null),l=Fr(n),d=Fr(i),u=(0,Jr.useRef)(null),m=hr(t,g=>c(g)),p=(0,Jr.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,Jr.useEffect)(()=>{if(o){let g=function(y){if(p.paused||!s)return;let w=y.target;s.contains(w)?u.current=w:Cs(u.current,{select:!0})},x=function(y){p.paused||!s||s.contains(y.relatedTarget)||Cs(u.current,{select:!0})};return document.addEventListener("focusin",g),document.addEventListener("focusout",x),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",x)}}},[o,s,p.paused]),(0,Jr.useEffect)(()=>{if(s){I5.add(p);let g=document.activeElement;if(!s.contains(g)){let y=new CustomEvent(n1,S5);s.addEventListener(n1,l),s.dispatchEvent(y),y.defaultPrevented||(E7(S7(A5(s)),{select:!0}),document.activeElement===g&&Cs(s))}return()=>{s.removeEventListener(n1,l),setTimeout(()=>{let y=new CustomEvent(i1,S5);s.addEventListener(i1,d),s.dispatchEvent(y),y.defaultPrevented||Cs(g??document.body,{select:!0}),s.removeEventListener(i1,d),I5.remove(p)},0)}}},[s,l,d,p]);let f=(0,Jr.useCallback)(g=>{if(!r&&!o||p.paused)return;let x=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,y=document.activeElement;if(x&&y){let w=g.currentTarget,[T,C]=y7(w);T&&C?!g.shiftKey&&y===C?(g.preventDefault(),r&&Cs(T,{select:!0})):g.shiftKey&&y===T&&(g.preventDefault(),r&&Cs(C,{select:!0})):y===w&&g.preventDefault()}},[r,o,p.paused]);return(0,Jr.createElement)(Lt.div,Pe({tabIndex:-1},a,{ref:m,onKeyDown:f}))});function E7(e,{select:t=!1}={}){let r=document.activeElement;for(let o of e)if(Cs(o,{select:t}),document.activeElement!==r)return}function y7(e){let t=A5(e),r=C5(t,e),o=C5(t.reverse(),e);return[r,o]}function A5(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{let n=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||n?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function C5(e,t){for(let r of e)if(!w7(r,{upTo:t}))return r}function w7(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 v7(e){return e instanceof HTMLInputElement&&"select"in e}function Cs(e,{select:t=!1}={}){if(e&&e.focus){let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&v7(e)&&t&&e.select()}}var I5=T7();function T7(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),e=k5(e,t),e.unshift(t)},remove(t){var r;e=k5(e,t),(r=e[0])===null||r===void 0||r.resume()}}}function k5(e,t){let r=[...e],o=r.indexOf(t);return o!==-1&&r.splice(o,1),r}function S7(e){return e.filter(t=>t.tagName!=="A")}h();var ff=S(W());h();var M5=S(W()),Fo=globalThis?.document?M5.useLayoutEffect:()=>{};var C7=ff.useId||(()=>{}),I7=0;function tc(e){let[t,r]=ff.useState(C7());return Fo(()=>{e||r(o=>o??String(I7++))},[e]),e||(t?`radix-${t}`:"")}h();var yt=S(W());h();h();h();function ks(e){return e.split("-")[0]}function nu(e){return e.split("-")[1]}function oc(e){return["top","bottom"].includes(ks(e))?"x":"y"}function s1(e){return e==="y"?"height":"width"}function P5(e,t,r){let{reference:o,floating:n}=e,i=o.x+o.width/2-n.width/2,a=o.y+o.height/2-n.height/2,s=oc(t),c=s1(s),l=o[c]/2-n[c]/2,d=s==="x",u;switch(ks(t)){case"top":u={x:i,y:o.y-n.height};break;case"bottom":u={x:i,y:o.y+o.height};break;case"right":u={x:o.x+o.width,y:a};break;case"left":u={x:o.x-n.width,y:a};break;default:u={x:o.x,y:o.y}}switch(nu(t)){case"start":u[s]-=l*(r&&d?-1:1);break;case"end":u[s]+=l*(r&&d?-1:1)}return u}var O5=async(e,t,r)=>{let{placement:o="bottom",strategy:n="absolute",middleware:i=[],platform:a}=r,s=await(a.isRTL==null?void 0:a.isRTL(t)),c=await a.getElementRects({reference:e,floating:t,strategy:n}),{x:l,y:d}=P5(c,o,s),u=o,m={},p=0;for(let f=0;f<i.length;f++){let{name:g,fn:x}=i[f],{x:y,y:w,data:T,reset:C}=await x({x:l,y:d,initialPlacement:o,placement:u,strategy:n,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});l=y??l,d=w??d,m={...m,[g]:{...m[g],...T}},C&&p<=50&&(p++,typeof C=="object"&&(C.placement&&(u=C.placement),C.rects&&(c=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:n}):C.rects),{x:l,y:d}=P5(c,u,s)),f=-1)}return{x:l,y:d,placement:u,strategy:n,middlewareData:m}};function N5(e){return typeof e!="number"?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(e):{top:e,right:e,bottom:e,left:e}}function ou(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function rc(e,t){var r;t===void 0&&(t={});let{x:o,y:n,platform:i,rects:a,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:m=!1,padding:p=0}=t,f=N5(p),g=s[m?u==="floating"?"reference":"floating":u],x=ou(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(g)))==null||r?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:d,strategy:c})),y=ou(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:u==="floating"?{...a.floating,x:o,y:n}:a.reference,offsetParent:await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),strategy:c}):a[u]);return{top:x.top-y.top+f.top,bottom:y.bottom-x.bottom+f.bottom,left:x.left-y.left+f.left,right:y.right-x.right+f.right}}var k7=Math.min,Is=Math.max;function a1(e,t,r){return Is(e,k7(t,r))}var gf=e=>({name:"arrow",options:e,async fn(t){let{element:r,padding:o=0}=e??{},{x:n,y:i,placement:a,rects:s,platform:c}=t;if(r==null)return{};let l=N5(o),d={x:n,y:i},u=oc(a),m=nu(a),p=s1(u),f=await c.getDimensions(r),g=u==="y"?"top":"left",x=u==="y"?"bottom":"right",y=s.reference[p]+s.reference[u]-d[u]-s.floating[p],w=d[u]-s.reference[u],T=await(c.getOffsetParent==null?void 0:c.getOffsetParent(r)),C=T?u==="y"?T.clientHeight||0:T.clientWidth||0:0;C===0&&(C=s.floating[p]);let I=y/2-w/2,A=l[g],P=C-f[p]-l[x],L=C/2-f[p]/2+I,D=a1(A,L,P),M=(m==="start"?l[g]:l[x])>0&&L!==D&&s.reference[p]<=s.floating[p];return{[u]:d[u]-(M?L<A?A-L:P-L:0),data:{[u]:D,centerOffset:L-D}}}}),_7={left:"right",right:"left",bottom:"top",top:"bottom"};function hf(e){return e.replace(/left|right|bottom|top/g,t=>_7[t])}function A7(e,t,r){r===void 0&&(r=!1);let o=nu(e),n=oc(e),i=s1(n),a=n==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=hf(a)),{main:a,cross:hf(a)}}var M7={start:"end",end:"start"};function L5(e){return e.replace(/start|end/g,t=>M7[t])}var F5=["top","right","bottom","left"],fK=F5.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]);var l1=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r;let{placement:o,middlewareData:n,rects:i,initialPlacement:a,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:u,fallbackStrategy:m="bestFit",flipAlignment:p=!0,...f}=e,g=ks(o),x=u||(g===a||!p?[hf(a)]:function(L){let D=hf(L);return[L5(L),D,L5(D)]}(a)),y=[a,...x],w=await rc(t,f),T=[],C=((r=n.flip)==null?void 0:r.overflows)||[];if(l&&T.push(w[g]),d){let{main:L,cross:D}=A7(o,i,await(s.isRTL==null?void 0:s.isRTL(c.floating)));T.push(w[L],w[D])}if(C=[...C,{placement:o,overflows:T}],!T.every(L=>L<=0)){var I,A;let L=((I=(A=n.flip)==null?void 0:A.index)!=null?I:0)+1,D=y[L];if(D)return{data:{index:L,overflows:C},reset:{placement:D}};let M="bottom";switch(m){case"bestFit":{var P;let R=(P=C.map(N=>[N,N.overflows.filter(B=>B>0).reduce((B,K)=>B+K,0)]).sort((N,B)=>N[1]-B[1])[0])==null?void 0:P[0].placement;R&&(M=R);break}case"initialPlacement":M=a}if(o!==M)return{reset:{placement:M}}}return{}}}};function D5(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function R5(e){return F5.some(t=>e[t]>=0)}var c1=function(e){let{strategy:t="referenceHidden",...r}=e===void 0?{}:e;return{name:"hide",async fn(o){let{rects:n}=o;switch(t){case"referenceHidden":{let i=D5(await rc(o,{...r,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:R5(i)}}}case"escaped":{let i=D5(await rc(o,{...r,altBoundary:!0}),n.floating);return{data:{escapedOffsets:i,escaped:R5(i)}}}default:return{}}}}},d1=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){let{x:r,y:o}=t,n=await async function(i,a){let{placement:s,platform:c,elements:l}=i,d=await(c.isRTL==null?void 0:c.isRTL(l.floating)),u=ks(s),m=nu(s),p=oc(s)==="x",f=["left","top"].includes(u)?-1:1,g=d&&p?-1:1,x=typeof a=="function"?a(i):a,{mainAxis:y,crossAxis:w,alignmentAxis:T}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...x};return m&&typeof T=="number"&&(w=m==="end"?-1*T:T),p?{x:w*g,y:y*f}:{x:y*f,y:w*g}}(t,e);return{x:r+n.x,y:o+n.y,data:n}}}};function B5(e){return e==="x"?"y":"x"}var u1=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:r,y:o,placement:n}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:x=>{let{x:y,y:w}=x;return{x:y,y:w}}},...c}=e,l={x:r,y:o},d=await rc(t,c),u=oc(ks(n)),m=B5(u),p=l[u],f=l[m];if(i){let x=u==="y"?"bottom":"right";p=a1(p+d[u==="y"?"top":"left"],p,p-d[x])}if(a){let x=m==="y"?"bottom":"right";f=a1(f+d[m==="y"?"top":"left"],f,f-d[x])}let g=s.fn({...t,[u]:p,[m]:f});return{...g,data:{x:g.x-r,y:g.y-o}}}}},m1=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:r,y:o,placement:n,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=e,d={x:r,y:o},u=oc(n),m=B5(u),p=d[u],f=d[m],g=typeof s=="function"?s({...i,placement:n}):s,x=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){let I=u==="y"?"height":"width",A=i.reference[u]-i.floating[I]+x.mainAxis,P=i.reference[u]+i.reference[I]-x.mainAxis;p<A?p=A:p>P&&(p=P)}if(l){var y,w,T,C;let I=u==="y"?"width":"height",A=["top","left"].includes(ks(n)),P=i.reference[m]-i.floating[I]+(A&&(y=(w=a.offset)==null?void 0:w[m])!=null?y:0)+(A?0:x.crossAxis),L=i.reference[m]+i.reference[I]+(A?0:(T=(C=a.offset)==null?void 0:C[m])!=null?T:0)-(A?x.crossAxis:0);f<P?f=P:f>L&&(f=L)}return{[u]:p,[m]:f}}}},p1=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){let{placement:r,rects:o,platform:n,elements:i}=t,{apply:a,...s}=e,c=await rc(t,s),l=ks(r),d=nu(r),u,m;l==="top"||l==="bottom"?(u=l,m=d===(await(n.isRTL==null?void 0:n.isRTL(i.floating))?"start":"end")?"left":"right"):(m=l,u=d==="end"?"top":"bottom");let p=Is(c.left,0),f=Is(c.right,0),g=Is(c.top,0),x=Is(c.bottom,0),y={availableHeight:o.floating.height-(["left","right"].includes(r)?2*(g!==0||x!==0?g+x:Is(c.top,c.bottom)):c[u]),availableWidth:o.floating.width-(["top","bottom"].includes(r)?2*(p!==0||f!==0?p+f:Is(c.left,c.right)):c[m])},w=await n.getDimensions(i.floating);a?.({...t,...y});let T=await n.getDimensions(i.floating);return w.width!==T.width||w.height!==T.height?{reset:{rects:!0}}:{}}}};function W5(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function Mi(e){if(e==null)return window;if(!W5(e)){let t=e.ownerDocument;return t&&t.defaultView||window}return e}function au(e){return Mi(e).getComputedStyle(e)}function _i(e){return W5(e)?"":e?(e.nodeName||"").toLowerCase():""}function V5(){let e=navigator.userAgentData;return e!=null&&e.brands?e.brands.map(t=>t.brand+"/"+t.version).join(" "):navigator.userAgent}function jn(e){return e instanceof Mi(e).HTMLElement}function va(e){return e instanceof Mi(e).Element}function h1(e){return typeof ShadowRoot>"u"?!1:e instanceof Mi(e).ShadowRoot||e instanceof ShadowRoot}function Ef(e){let{overflow:t,overflowX:r,overflowY:o}=au(e);return/auto|scroll|overlay|hidden/.test(t+o+r)}function P7(e){return["table","td","th"].includes(_i(e))}function z5(e){let t=/firefox/i.test(V5()),r=au(e);return r.transform!=="none"||r.perspective!=="none"||r.contain==="paint"||["transform","perspective"].includes(r.willChange)||t&&r.willChange==="filter"||t&&!!r.filter&&r.filter!=="none"}function Y5(){return!/^((?!chrome|android).)*safari/i.test(V5())}var H5=Math.min,iu=Math.max,bf=Math.round;function Ai(e,t,r){var o,n,i,a;t===void 0&&(t=!1),r===void 0&&(r=!1);let s=e.getBoundingClientRect(),c=1,l=1;t&&jn(e)&&(c=e.offsetWidth>0&&bf(s.width)/e.offsetWidth||1,l=e.offsetHeight>0&&bf(s.height)/e.offsetHeight||1);let d=va(e)?Mi(e):window,u=!Y5()&&r,m=(s.left+(u&&(o=(n=d.visualViewport)==null?void 0:n.offsetLeft)!=null?o:0))/c,p=(s.top+(u&&(i=(a=d.visualViewport)==null?void 0:a.offsetTop)!=null?i:0))/l,f=s.width/c,g=s.height/l;return{width:f,height:g,top:p,right:m+f,bottom:p+g,left:m,x:m,y:p}}function wa(e){return(t=e,(t instanceof Mi(t).Node?e.ownerDocument:e.document)||window.document).documentElement;var t}function yf(e){return va(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function K5(e){return Ai(wa(e)).left+yf(e).scrollLeft}function L7(e,t,r){let o=jn(t),n=wa(t),i=Ai(e,o&&function(c){let l=Ai(c);return bf(l.width)!==c.offsetWidth||bf(l.height)!==c.offsetHeight}(t),r==="fixed"),a={scrollLeft:0,scrollTop:0},s={x:0,y:0};if(o||!o&&r!=="fixed")if((_i(t)!=="body"||Ef(n))&&(a=yf(t)),jn(t)){let c=Ai(t,!0);s.x=c.x+t.clientLeft,s.y=c.y+t.clientTop}else n&&(s.x=K5(n));return{x:i.left+a.scrollLeft-s.x,y:i.top+a.scrollTop-s.y,width:i.width,height:i.height}}function Z5(e){return _i(e)==="html"?e:e.assignedSlot||e.parentNode||(h1(e)?e.host:null)||wa(e)}function $5(e){return jn(e)&&getComputedStyle(e).position!=="fixed"?e.offsetParent:null}function f1(e){let t=Mi(e),r=$5(e);for(;r&&P7(r)&&getComputedStyle(r).position==="static";)r=$5(r);return r&&(_i(r)==="html"||_i(r)==="body"&&getComputedStyle(r).position==="static"&&!z5(r))?t:r||function(o){let n=Z5(o);for(h1(n)&&(n=n.host);jn(n)&&!["html","body"].includes(_i(n));){if(z5(n))return n;n=n.parentNode}return null}(e)||t}function G5(e){if(jn(e))return{width:e.offsetWidth,height:e.offsetHeight};let t=Ai(e);return{width:t.width,height:t.height}}function X5(e){let t=Z5(e);return["html","body","#document"].includes(_i(t))?e.ownerDocument.body:jn(t)&&Ef(t)?t:X5(t)}function xf(e,t){var r;t===void 0&&(t=[]);let o=X5(e),n=o===((r=e.ownerDocument)==null?void 0:r.body),i=Mi(o),a=n?[i].concat(i.visualViewport||[],Ef(o)?o:[]):o,s=t.concat(a);return n?s:s.concat(xf(a))}function U5(e,t,r){return t==="viewport"?ou(function(o,n){let i=Mi(o),a=wa(o),s=i.visualViewport,c=a.clientWidth,l=a.clientHeight,d=0,u=0;if(s){c=s.width,l=s.height;let m=Y5();(m||!m&&n==="fixed")&&(d=s.offsetLeft,u=s.offsetTop)}return{width:c,height:l,x:d,y:u}}(e,r)):va(t)?function(o,n){let i=Ai(o,!1,n==="fixed"),a=i.top+o.clientTop,s=i.left+o.clientLeft;return{top:a,left:s,x:s,y:a,right:s+o.clientWidth,bottom:a+o.clientHeight,width:o.clientWidth,height:o.clientHeight}}(t,r):ou(function(o){var n;let i=wa(o),a=yf(o),s=(n=o.ownerDocument)==null?void 0:n.body,c=iu(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),l=iu(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),d=-a.scrollLeft+K5(o),u=-a.scrollTop;return au(s||i).direction==="rtl"&&(d+=iu(i.clientWidth,s?s.clientWidth:0)-c),{width:c,height:l,x:d,y:u}}(wa(e)))}function D7(e){let t=xf(e),r=["absolute","fixed"].includes(au(e).position)&&jn(e)?f1(e):e;return va(r)?t.filter(o=>va(o)&&function(n,i){let a=i.getRootNode==null?void 0:i.getRootNode();if(n.contains(i))return!0;if(a&&h1(a)){let s=i;do{if(s&&n===s)return!0;s=s.parentNode||s.host}while(s)}return!1}(o,r)&&_i(o)!=="body"):[]}var R7={getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:o,strategy:n}=e,i=[...r==="clippingAncestors"?D7(t):[].concat(r),o],a=i[0],s=i.reduce((c,l)=>{let d=U5(t,l,n);return c.top=iu(d.top,c.top),c.right=H5(d.right,c.right),c.bottom=H5(d.bottom,c.bottom),c.left=iu(d.left,c.left),c},U5(t,a,n));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:r,strategy:o}=e,n=jn(r),i=wa(r);if(r===i)return t;let a={scrollLeft:0,scrollTop:0},s={x:0,y:0};if((n||!n&&o!=="fixed")&&((_i(r)!=="body"||Ef(i))&&(a=yf(r)),jn(r))){let c=Ai(r,!0);s.x=c.x+r.clientLeft,s.y=c.y+r.clientTop}return{...t,x:t.x-a.scrollLeft+s.x,y:t.y-a.scrollTop+s.y}},isElement:va,getDimensions:G5,getOffsetParent:f1,getDocumentElement:wa,getElementRects:e=>{let{reference:t,floating:r,strategy:o}=e;return{reference:L7(t,f1(r),o),floating:{...G5(r),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>au(e).direction==="rtl"};function j5(e,t,r,o){o===void 0&&(o={});let{ancestorScroll:n=!0,ancestorResize:i=!0,elementResize:a=!0,animationFrame:s=!1}=o,c=n&&!s,l=i&&!s,d=c||l?[...va(e)?xf(e):[],...xf(t)]:[];d.forEach(f=>{c&&f.addEventListener("scroll",r,{passive:!0}),l&&f.addEventListener("resize",r)});let u,m=null;if(a){let f=!0;m=new ResizeObserver(()=>{f||r(),f=!1}),va(e)&&!s&&m.observe(e),m.observe(t)}let p=s?Ai(e):null;return s&&function f(){let g=Ai(e);!p||g.x===p.x&&g.y===p.y&&g.width===p.width&&g.height===p.height||r(),p=g,u=requestAnimationFrame(f)}(),r(),()=>{var f;d.forEach(g=>{c&&g.removeEventListener("scroll",r),l&&g.removeEventListener("resize",r)}),(f=m)==null||f.disconnect(),m=null,s&&cancelAnimationFrame(u)}}var q5=(e,t,r)=>O5(e,t,{platform:R7,...r});var gr=S(W()),wf=S(W()),J5=S(zn()),g1=typeof document<"u"?wf.useLayoutEffect:wf.useEffect;function b1(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 r,o,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(o=r;o--!==0;)if(!b1(e[o],t[o]))return!1;return!0}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(o=r;o--!==0;){let i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!b1(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function O7(e){let t=gr.useRef(e);return g1(()=>{t.current=e}),t}function Q5(e){let{middleware:t,placement:r="bottom",strategy:o="absolute",whileElementsMounted:n}=e===void 0?{}:e,i=gr.useRef(null),a=gr.useRef(null),s=O7(n),c=gr.useRef(null),[l,d]=gr.useState({x:null,y:null,strategy:o,placement:r,middlewareData:{}}),[u,m]=gr.useState(t);b1(u?.map(T=>{let{options:C}=T;return C}),t?.map(T=>{let{options:C}=T;return C}))||m(t);let p=gr.useCallback(()=>{!i.current||!a.current||q5(i.current,a.current,{middleware:u,placement:r,strategy:o}).then(T=>{f.current&&J5.flushSync(()=>{d(T)})})},[u,r,o]);g1(()=>{f.current&&p()},[p]);let f=gr.useRef(!1);g1(()=>(f.current=!0,()=>{f.current=!1}),[]);let g=gr.useCallback(()=>{if(typeof c.current=="function"&&(c.current(),c.current=null),i.current&&a.current)if(s.current){let T=s.current(i.current,a.current,p);c.current=T}else p()},[p,s]),x=gr.useCallback(T=>{i.current=T,g()},[g]),y=gr.useCallback(T=>{a.current=T,g()},[g]),w=gr.useMemo(()=>({reference:i,floating:a}),[]);return gr.useMemo(()=>({...l,update:p,refs:w,reference:x,floating:y}),[l,p,w,x,y])}var e6=e=>{let{element:t,padding:r}=e;function o(n){return Object.prototype.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){return o(t)?t.current!=null?gf({element:t.current,padding:r}).fn(n):{}:t?gf({element:t,padding:r}).fn(n):{}}}};h();var su=S(W());var N7=(0,su.forwardRef)((e,t)=>{let{children:r,width:o=10,height:n=5,...i}=e;return(0,su.createElement)(Lt.svg,Pe({},i,{ref:t,width:o,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),e.asChild?r:(0,su.createElement)("polygon",{points:"0,0 30,0 15,10"}))}),t6=N7;h();var r6=S(W());function o6(e){let[t,r]=(0,r6.useState)(void 0);return Fo(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let o=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;let i=n[0],a,s;if("borderBoxSize"in i){let c=i.borderBoxSize,l=Array.isArray(c)?c[0]:c;a=l.inlineSize,s=l.blockSize}else a=e.offsetWidth,s=e.offsetHeight;r({width:a,height:s})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else r(void 0)},[e]),t}var n6="Popper",[x1,E1]=Xn(n6),[F7,i6]=x1(n6),B7=e=>{let{__scopePopper:t,children:r}=e,[o,n]=(0,yt.useState)(null);return(0,yt.createElement)(F7,{scope:t,anchor:o,onAnchorChange:n},r)},z7="PopperAnchor",H7=(0,yt.forwardRef)((e,t)=>{let{__scopePopper:r,virtualRef:o,...n}=e,i=i6(z7,r),a=(0,yt.useRef)(null),s=hr(t,a);return(0,yt.useEffect)(()=>{i.onAnchorChange(o?.current||a.current)}),o?null:(0,yt.createElement)(Lt.div,Pe({},n,{ref:s}))}),vf="PopperContent",[$7,G7]=x1(vf),[U7,W7]=x1(vf,{hasParent:!1,positionUpdateFns:new Set}),V7=(0,yt.forwardRef)((e,t)=>{var r,o,n,i,a,s,c,l;let{__scopePopper:d,side:u="bottom",sideOffset:m=0,align:p="center",alignOffset:f=0,arrowPadding:g=0,collisionBoundary:x=[],collisionPadding:y=0,sticky:w="partial",hideWhenDetached:T=!1,avoidCollisions:C=!0,onPlaced:I,...A}=e,P=i6(vf,d),[L,D]=(0,yt.useState)(null),M=hr(t,nl=>D(nl)),[R,N]=(0,yt.useState)(null),B=o6(R),K=(r=B?.width)!==null&&r!==void 0?r:0,V=(o=B?.height)!==null&&o!==void 0?o:0,ne=u+(p!=="center"?"-"+p:""),Q=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},X=Array.isArray(x)?x:[x],se=X.length>0,O={padding:Q,boundary:X.filter(j7),altBoundary:se},{reference:F,floating:$,strategy:j,x:q,y:J,placement:te,middlewareData:ce,update:it}=Q5({strategy:"fixed",placement:ne,whileElementsMounted:j5,middleware:[q7(),d1({mainAxis:m+V,alignmentAxis:f}),C?u1({mainAxis:!0,crossAxis:!1,limiter:w==="partial"?m1():void 0,...O}):void 0,R?e6({element:R,padding:g}):void 0,C?l1({...O}):void 0,p1({...O,apply:({elements:nl,availableWidth:SM,availableHeight:CM})=>{nl.floating.style.setProperty("--radix-popper-available-width",`${SM}px`),nl.floating.style.setProperty("--radix-popper-available-height",`${CM}px`)}}),J7({arrowWidth:K,arrowHeight:V}),T?c1({strategy:"referenceHidden"}):void 0].filter(X7)});Fo(()=>{F(P.anchor)},[F,P.anchor]);let Ge=q!==null&&J!==null,[Be,ke]=a6(te),Mt=Fr(I);Fo(()=>{Ge&&Mt?.()},[Ge,Mt]);let ol=(n=ce.arrow)===null||n===void 0?void 0:n.x,vm=(i=ce.arrow)===null||i===void 0?void 0:i.y,Tm=((a=ce.arrow)===null||a===void 0?void 0:a.centerOffset)!==0,[_n,ur]=(0,yt.useState)();Fo(()=>{L&&ur(window.getComputedStyle(L).zIndex)},[L]);let{hasParent:li,positionUpdateFns:Mr}=W7(vf,d),ld=!li;(0,yt.useLayoutEffect)(()=>{if(!ld)return Mr.add(it),()=>{Mr.delete(it)}},[ld,Mr,it]),Fo(()=>{ld&&Ge&&Array.from(Mr).reverse().forEach(nl=>requestAnimationFrame(nl))},[ld,Ge,Mr]);let $y={"data-side":Be,"data-align":ke,...A,ref:M,style:{...A.style,animation:Ge?void 0:"none",opacity:(s=ce.hide)!==null&&s!==void 0&&s.referenceHidden?0:void 0}};return(0,yt.createElement)("div",{ref:$,"data-radix-popper-content-wrapper":"",style:{position:j,left:0,top:0,transform:Ge?`translate3d(${Math.round(q)}px, ${Math.round(J)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:_n,"--radix-popper-transform-origin":[(c=ce.transformOrigin)===null||c===void 0?void 0:c.x,(l=ce.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:e.dir},(0,yt.createElement)($7,{scope:d,placedSide:Be,onArrowChange:N,arrowX:ol,arrowY:vm,shouldHideArrow:Tm},ld?(0,yt.createElement)(U7,{scope:d,hasParent:!0,positionUpdateFns:Mr},(0,yt.createElement)(Lt.div,$y)):(0,yt.createElement)(Lt.div,$y)))}),Y7="PopperArrow",K7={top:"bottom",right:"left",bottom:"top",left:"right"},Z7=(0,yt.forwardRef)(function(t,r){let{__scopePopper:o,...n}=t,i=G7(Y7,o),a=K7[i.placedSide];return(0,yt.createElement)("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}},(0,yt.createElement)(t6,Pe({},n,{ref:r,style:{...n.style,display:"block"}})))});function X7(e){return e!==void 0}function j7(e){return e!==null}var q7=()=>({name:"anchorCssProperties",fn(e){let{rects:t,elements:r}=e,{width:o,height:n}=t.reference;return r.floating.style.setProperty("--radix-popper-anchor-width",`${o}px`),r.floating.style.setProperty("--radix-popper-anchor-height",`${n}px`),{}}}),J7=e=>({name:"transformOrigin",options:e,fn(t){var r,o,n,i,a;let{placement:s,rects:c,middlewareData:l}=t,u=((r=l.arrow)===null||r===void 0?void 0:r.centerOffset)!==0,m=u?0:e.arrowWidth,p=u?0:e.arrowHeight,[f,g]=a6(s),x={start:"0%",center:"50%",end:"100%"}[g],y=((o=(n=l.arrow)===null||n===void 0?void 0:n.x)!==null&&o!==void 0?o:0)+m/2,w=((i=(a=l.arrow)===null||a===void 0?void 0:a.y)!==null&&i!==void 0?i:0)+p/2,T="",C="";return f==="bottom"?(T=u?x:`${y}px`,C=`${-p}px`):f==="top"?(T=u?x:`${y}px`,C=`${c.floating.height+p}px`):f==="right"?(T=`${-p}px`,C=u?x:`${w}px`):f==="left"&&(T=`${c.floating.width+p}px`,C=u?x:`${w}px`),{data:{x:T,y:C}}}});function a6(e){let[t,r="center"]=e.split("-");return[t,r]}var s6=B7,l6=H7,c6=V7,d6=Z7;h();var Tf=S(W()),u6=S(zn());var m6=(0,Tf.forwardRef)((e,t)=>{var r;let{container:o=globalThis==null||(r=globalThis.document)===null||r===void 0?void 0:r.body,...n}=e;return o?u6.default.createPortal((0,Tf.createElement)(Lt.div,Pe({},n,{ref:t})),o):null});h();var Tr=S(W()),p6=S(zn());function Q7(e,t){return(0,Tr.useReducer)((r,o)=>{let n=t[r][o];return n??r},e)}var nc=e=>{let{present:t,children:r}=e,o=eD(t),n=typeof r=="function"?r({present:o.isPresent}):Tr.Children.only(r),i=hr(o.ref,n.ref);return typeof r=="function"||o.isPresent?(0,Tr.cloneElement)(n,{ref:i}):null};nc.displayName="Presence";function eD(e){let[t,r]=(0,Tr.useState)(),o=(0,Tr.useRef)({}),n=(0,Tr.useRef)(e),i=(0,Tr.useRef)("none"),a=e?"mounted":"unmounted",[s,c]=Q7(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,Tr.useEffect)(()=>{let l=Sf(o.current);i.current=s==="mounted"?l:"none"},[s]),Fo(()=>{let l=o.current,d=n.current;if(d!==e){let m=i.current,p=Sf(l);e?c("MOUNT"):p==="none"||l?.display==="none"?c("UNMOUNT"):c(d&&m!==p?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,c]),Fo(()=>{if(t){let l=u=>{let p=Sf(o.current).includes(u.animationName);u.target===t&&p&&(0,p6.flushSync)(()=>c("ANIMATION_END"))},d=u=>{u.target===t&&(i.current=Sf(o.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:(0,Tr.useCallback)(l=>{l&&(o.current=getComputedStyle(l)),r(l)},[])}}function Sf(e){return e?.animationName||"none"}h();var Ta=S(W());function ic({prop:e,defaultProp:t,onChange:r=()=>{}}){let[o,n]=tD({defaultProp:t,onChange:r}),i=e!==void 0,a=i?e:o,s=Fr(r),c=(0,Ta.useCallback)(l=>{if(i){let u=typeof l=="function"?l(e):l;u!==e&&s(u)}else n(l)},[i,e,n,s]);return[a,c]}function tD({defaultProp:e,onChange:t}){let r=(0,Ta.useState)(e),[o]=r,n=(0,Ta.useRef)(o),i=Fr(t);return(0,Ta.useEffect)(()=>{n.current!==o&&(i(o),n.current=o)},[o,n,i]),r}h();var rD=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ac=new WeakMap,Cf=new WeakMap,If={},y1=0,f6=function(e){return e&&(e.host||f6(e.parentNode))},oD=function(e,t){return t.map(function(r){if(e.contains(r))return r;var o=f6(r);return o&&e.contains(o)?o:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},nD=function(e,t,r,o){var n=oD(t,Array.isArray(e)?e:[e]);If[r]||(If[r]=new WeakMap);var i=If[r],a=[],s=new Set,c=new Set(n),l=function(u){!u||s.has(u)||(s.add(u),l(u.parentNode))};n.forEach(l);var d=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(m){if(s.has(m))d(m);else{var p=m.getAttribute(o),f=p!==null&&p!=="false",g=(ac.get(m)||0)+1,x=(i.get(m)||0)+1;ac.set(m,g),i.set(m,x),a.push(m),g===1&&f&&Cf.set(m,!0),x===1&&m.setAttribute(r,"true"),f||m.setAttribute(o,"true")}})};return d(t),s.clear(),y1++,function(){a.forEach(function(u){var m=ac.get(u)-1,p=i.get(u)-1;ac.set(u,m),i.set(u,p),m||(Cf.has(u)||u.removeAttribute(o),Cf.delete(u)),p||u.removeAttribute(r)}),y1--,y1||(ac=new WeakMap,ac=new WeakMap,Cf=new WeakMap,If={})}},h6=function(e,t,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),n=t||rD(e);return n?(o.push.apply(o,Array.from(n.querySelectorAll("[aria-live]"))),nD(o,n,r,"aria-hidden")):function(){return null}};h();h();h();var qn=function(){return qn=Object.assign||function(t){for(var r,o=1,n=arguments.length;o<n;o++){r=arguments[o];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},qn.apply(this,arguments)};function g6(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function b6(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}var Mf=S(W());h();var Sr=S(W());h();var _s="right-scroll-bar-position",As="width-before-scroll-bar",w1="with-scroll-bars-hidden",v1="--removed-body-scroll-bar-size";h();h();function x6(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}h();var E6=S(W());function y6(e,t){var r=(0,E6.useState)(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(o){var n=r.value;n!==o&&(r.value=o,r.callback(o,n))}}}})[0];return r.callback=t,r.facade}h();function T1(e,t){return y6(t||null,function(r){return e.forEach(function(o){return x6(o,r)})})}h();h();h();var sc=function(){return sc=Object.assign||function(t){for(var r,o=1,n=arguments.length;o<n;o++){r=arguments[o];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},sc.apply(this,arguments)};function w6(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}h();function iD(e){return e}function aD(e,t){t===void 0&&(t=iD);var r=[],o=!1,n={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(i){var a=t(i,o);return r.push(a),function(){r=r.filter(function(s){return s!==a})}},assignSyncMedium:function(i){for(o=!0;r.length;){var a=r;r=[],a.forEach(i)}r={push:function(s){return i(s)},filter:function(){return r}}},assignMedium:function(i){o=!0;var a=[];if(r.length){var s=r;r=[],s.forEach(i),a=r}var c=function(){var d=a;a=[],d.forEach(i)},l=function(){return Promise.resolve().then(c)};l(),r={push:function(d){a.push(d),l()},filter:function(d){return a=a.filter(d),r}}}};return n}function S1(e){e===void 0&&(e={});var t=aD(null);return t.options=sc({async:!0,ssr:!1},e),t}h();var v6=S(W()),T6=function(e){var t=e.sideCar,r=w6(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw new Error("Sidecar medium not found");return v6.createElement(o,sc({},r))};T6.isSideCarExport=!0;function C1(e,t){return e.useMedium(t),T6}var kf=S1();var I1=function(){},lu=Sr.forwardRef(function(e,t){var r=Sr.useRef(null),o=Sr.useState({onScrollCapture:I1,onWheelCapture:I1,onTouchMoveCapture:I1}),n=o[0],i=o[1],a=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,d=e.enabled,u=e.shards,m=e.sideCar,p=e.noIsolation,f=e.inert,g=e.allowPinchZoom,x=e.as,y=x===void 0?"div":x,w=g6(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),T=m,C=T1([r,t]),I=qn(qn({},w),n);return Sr.createElement(Sr.Fragment,null,d&&Sr.createElement(T,{sideCar:kf,removeScrollBar:l,shards:u,noIsolation:p,inert:f,setCallbacks:i,allowPinchZoom:!!g,lockRef:r}),a?Sr.cloneElement(Sr.Children.only(s),qn(qn({},I),{ref:C})):Sr.createElement(y,qn({},I,{className:c,ref:C}),s))});lu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};lu.classNames={fullWidth:As,zeroRight:_s};h();h();var wt=S(W());h();h();var _f=S(W());h();h();h();var I6=S(W());h();h();var S6;var C6=function(){if(S6)return S6;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function sD(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=C6();return t&&e.setAttribute("nonce",t),e}function lD(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function cD(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var k1=function(){var e=0,t=null;return{add:function(r){e==0&&(t=sD())&&(lD(t,r),cD(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}};var _1=function(){var e=k1();return function(t,r){I6.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}};var cu=function(){var e=_1(),t=function(r){var o=r.styles,n=r.dynamic;return e(o,n),null};return t};h();var dD={left:0,top:0,right:0,gap:0},A1=function(e){return parseInt(e||"",10)||0},uD=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],n=t[e==="padding"?"paddingRight":"marginRight"];return[A1(r),A1(o),A1(n)]},M1=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return dD;var t=uD(e),r=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-r+t[2]-t[0])}};var mD=cu(),pD=function(e,t,r,o){var n=e.left,i=e.top,a=e.right,s=e.gap;return r===void 0&&(r="margin"),`
9
- .`.concat(w1,` {
10
- overflow: hidden `).concat(o,`;
11
- padding-right: `).concat(s,"px ").concat(o,`;
12
- }
13
- body {
14
- overflow: hidden `).concat(o,`;
15
- overscroll-behavior: contain;
16
- `).concat([t&&"position: relative ".concat(o,";"),r==="margin"&&`
17
- padding-left: `.concat(n,`px;
18
- padding-top: `).concat(i,`px;
19
- padding-right: `).concat(a,`px;
20
- margin-left:0;
21
- margin-top:0;
22
- margin-right: `).concat(s,"px ").concat(o,`;
23
- `),r==="padding"&&"padding-right: ".concat(s,"px ").concat(o,";")].filter(Boolean).join(""),`
24
- }
25
-
26
- .`).concat(_s,` {
27
- right: `).concat(s,"px ").concat(o,`;
28
- }
29
-
30
- .`).concat(As,` {
31
- margin-right: `).concat(s,"px ").concat(o,`;
32
- }
33
-
34
- .`).concat(_s," .").concat(_s,` {
35
- right: 0 `).concat(o,`;
36
- }
37
-
38
- .`).concat(As," .").concat(As,` {
39
- margin-right: 0 `).concat(o,`;
40
- }
41
-
42
- body {
43
- `).concat(v1,": ").concat(s,`px;
44
- }
45
- `)},P1=function(e){var t=e.noRelative,r=e.noImportant,o=e.gapMode,n=o===void 0?"margin":o,i=_f.useMemo(function(){return M1(n)},[n]);return _f.createElement(mD,{styles:pD(i,!t,n,r?"":"!important")})};h();var L1=!1;if(typeof window<"u")try{du=Object.defineProperty({},"passive",{get:function(){return L1=!0,!0}}),window.addEventListener("test",du,du),window.removeEventListener("test",du,du)}catch{L1=!1}var du,Ms=L1?{passive:!1}:!1;h();var fD=function(e){return e.tagName==="TEXTAREA"},k6=function(e,t){var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!fD(e)&&r[t]==="visible")},hD=function(e){return k6(e,"overflowY")},gD=function(e){return k6(e,"overflowX")},D1=function(e,t){var r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=_6(e,r);if(o){var n=A6(e,r),i=n[1],a=n[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==document.body);return!1},bD=function(e){var t=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[t,r,o]},xD=function(e){var t=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[t,r,o]},_6=function(e,t){return e==="v"?hD(t):gD(t)},A6=function(e,t){return e==="v"?bD(t):xD(t)},ED=function(e,t){return e==="h"&&t==="rtl"?-1:1},M6=function(e,t,r,o,n){var i=ED(e,window.getComputedStyle(t).direction),a=i*o,s=r.target,c=t.contains(s),l=!1,d=a>0,u=0,m=0;do{var p=A6(e,s),f=p[0],g=p[1],x=p[2],y=g-x-i*f;(f||y)&&_6(e,s)&&(u+=y,m+=f),s=s.parentNode}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(d&&(n&&u===0||!n&&a>u)||!d&&(n&&m===0||!n&&-a>m))&&(l=!0),l};var Af=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},P6=function(e){return[e.deltaX,e.deltaY]},L6=function(e){return e&&"current"in e?e.current:e},yD=function(e,t){return e[0]===t[0]&&e[1]===t[1]},wD=function(e){return`
46
- .block-interactivity-`.concat(e,` {pointer-events: none;}
47
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
48
- `)},vD=0,lc=[];function D6(e){var t=wt.useRef([]),r=wt.useRef([0,0]),o=wt.useRef(),n=wt.useState(vD++)[0],i=wt.useState(function(){return cu()})[0],a=wt.useRef(e);wt.useEffect(function(){a.current=e},[e]),wt.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var g=b6([e.lockRef.current],(e.shards||[]).map(L6),!0).filter(Boolean);return g.forEach(function(x){return x.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),g.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var s=wt.useCallback(function(g,x){if("touches"in g&&g.touches.length===2)return!a.current.allowPinchZoom;var y=Af(g),w=r.current,T="deltaX"in g?g.deltaX:w[0]-y[0],C="deltaY"in g?g.deltaY:w[1]-y[1],I,A=g.target,P=Math.abs(T)>Math.abs(C)?"h":"v";if("touches"in g&&P==="h"&&A.type==="range")return!1;var L=D1(P,A);if(!L)return!0;if(L?I=P:(I=P==="v"?"h":"v",L=D1(P,A)),!L)return!1;if(!o.current&&"changedTouches"in g&&(T||C)&&(o.current=I),!I)return!0;var D=o.current||I;return M6(D,x,g,D==="h"?T:C,!0)},[]),c=wt.useCallback(function(g){var x=g;if(!(!lc.length||lc[lc.length-1]!==i)){var y="deltaY"in x?P6(x):Af(x),w=t.current.filter(function(I){return I.name===x.type&&I.target===x.target&&yD(I.delta,y)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var T=(a.current.shards||[]).map(L6).filter(Boolean).filter(function(I){return I.contains(x.target)}),C=T.length>0?s(x,T[0]):!a.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),l=wt.useCallback(function(g,x,y,w){var T={name:g,delta:x,target:y,should:w};t.current.push(T),setTimeout(function(){t.current=t.current.filter(function(C){return C!==T})},1)},[]),d=wt.useCallback(function(g){r.current=Af(g),o.current=void 0},[]),u=wt.useCallback(function(g){l(g.type,P6(g),g.target,s(g,e.lockRef.current))},[]),m=wt.useCallback(function(g){l(g.type,Af(g),g.target,s(g,e.lockRef.current))},[]);wt.useEffect(function(){return lc.push(i),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Ms),document.addEventListener("touchmove",c,Ms),document.addEventListener("touchstart",d,Ms),function(){lc=lc.filter(function(g){return g!==i}),document.removeEventListener("wheel",c,Ms),document.removeEventListener("touchmove",c,Ms),document.removeEventListener("touchstart",d,Ms)}},[]);var p=e.removeScrollBar,f=e.inert;return wt.createElement(wt.Fragment,null,f?wt.createElement(i,{styles:wD(n)}):null,p?wt.createElement(P1,{gapMode:"margin"}):null)}var R6=C1(kf,D6);var O6=Mf.forwardRef(function(e,t){return Mf.createElement(lu,qn({},e,{ref:t,sideCar:R6}))});O6.classNames=lu.classNames;var R1=O6;var N6="Popover",[F6,tj]=Xn(N6,[E1]),Pf=E1(),[TD,cc]=F6(N6),SD=e=>{let{__scopePopover:t,children:r,open:o,defaultOpen:n,onOpenChange:i,modal:a=!1}=e,s=Pf(t),c=(0,De.useRef)(null),[l,d]=(0,De.useState)(!1),[u=!1,m]=ic({prop:o,defaultProp:n,onChange:i});return(0,De.createElement)(s6,s,(0,De.createElement)(TD,{scope:t,contentId:tc(),triggerRef:c,open:u,onOpenChange:m,onOpenToggle:(0,De.useCallback)(()=>m(p=>!p),[m]),hasCustomAnchor:l,onCustomAnchorAdd:(0,De.useCallback)(()=>d(!0),[]),onCustomAnchorRemove:(0,De.useCallback)(()=>d(!1),[]),modal:a},r))};var CD="PopoverTrigger",ID=(0,De.forwardRef)((e,t)=>{let{__scopePopover:r,...o}=e,n=cc(CD,r),i=Pf(r),a=hr(t,n.triggerRef),s=(0,De.createElement)(Lt.button,Pe({type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":H6(n.open)},o,{ref:a,onClick:Wt(e.onClick,n.onOpenToggle)}));return n.hasCustomAnchor?s:(0,De.createElement)(l6,Pe({asChild:!0},i),s)}),B6="PopoverPortal",[kD,_D]=F6(B6,{forceMount:void 0}),AD=e=>{let{__scopePopover:t,forceMount:r,children:o,container:n}=e,i=cc(B6,t);return(0,De.createElement)(kD,{scope:t,forceMount:r},(0,De.createElement)(nc,{present:r||i.open},(0,De.createElement)(m6,{asChild:!0,container:n},o)))},uu="PopoverContent",MD=(0,De.forwardRef)((e,t)=>{let r=_D(uu,e.__scopePopover),{forceMount:o=r.forceMount,...n}=e,i=cc(uu,e.__scopePopover);return(0,De.createElement)(nc,{present:o||i.open},i.modal?(0,De.createElement)(PD,Pe({},n,{ref:t})):(0,De.createElement)(LD,Pe({},n,{ref:t})))}),PD=(0,De.forwardRef)((e,t)=>{let r=cc(uu,e.__scopePopover),o=(0,De.useRef)(null),n=hr(t,o),i=(0,De.useRef)(!1);return(0,De.useEffect)(()=>{let a=o.current;if(a)return h6(a)},[]),(0,De.createElement)(R1,{as:ya,allowPinchZoom:!0},(0,De.createElement)(z6,Pe({},e,{ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Wt(e.onCloseAutoFocus,a=>{var s;a.preventDefault(),i.current||(s=r.triggerRef.current)===null||s===void 0||s.focus()}),onPointerDownOutside:Wt(e.onPointerDownOutside,a=>{let s=a.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0,l=s.button===2||c;i.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:Wt(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})))}),LD=(0,De.forwardRef)((e,t)=>{let r=cc(uu,e.__scopePopover),o=(0,De.useRef)(!1);return(0,De.createElement)(z6,Pe({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:n=>{var i;if((i=e.onCloseAutoFocus)===null||i===void 0||i.call(e,n),!n.defaultPrevented){var a;o.current||(a=r.triggerRef.current)===null||a===void 0||a.focus(),n.preventDefault()}o.current=!1},onInteractOutside:n=>{var i,a;(i=e.onInteractOutside)===null||i===void 0||i.call(e,n),n.defaultPrevented||(o.current=!0);let s=n.target;((a=r.triggerRef.current)===null||a===void 0?void 0:a.contains(s))&&n.preventDefault()}}))}),z6=(0,De.forwardRef)((e,t)=>{let{__scopePopover:r,trapFocus:o,onOpenAutoFocus:n,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:d,...u}=e,m=cc(uu,r),p=Pf(r);return T5(),(0,De.createElement)(_5,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:n,onUnmountAutoFocus:i},(0,De.createElement)(E5,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>m.onOpenChange(!1)},(0,De.createElement)(c6,Pe({"data-state":H6(m.open),role:"dialog",id:m.contentId},p,u,{ref:t,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)"}}))))});var DD=(0,De.forwardRef)((e,t)=>{let{__scopePopover:r,...o}=e,n=Pf(r);return(0,De.createElement)(d6,Pe({},n,o,{ref:t}))});function H6(e){return e?"open":"closed"}var Lf=SD;var Df=ID,$6=AD,Rf=MD;var G6=DD;h();var fn=S(W(),1);h();var Nf=S(W(),1),K6=S(zn(),1);h();var O1=S(W(),1),N1=O1.default.createContext(null),et=()=>O1.default.useContext(N1);h();var mu=S(W(),1);var Of=e=>{let[t,r]=(0,mu.useState)(null),o=Ke(),{theme:n}=et(),{container:i}=ar();return(0,mu.useLayoutEffect)(()=>{t&&(t.className="",t.classList.add("excalidraw",...e?.className?.split(/\s+/)||[]),t.classList.toggle("excalidraw--mobile",o.editor.isMobile),t.classList.toggle("theme--dark",n==="dark"))},[t,n,o.editor.isMobile,e?.className]),(0,mu.useLayoutEffect)(()=>{let a=e?.parentSelector?i?.querySelector(e.parentSelector):document.body;if(!a)return;let s=document.createElement("div");return a.appendChild(s),r(s),()=>{a.removeChild(s)}},[i,e?.parentSelector]),t};h();var W6=S(W(),1);function dc(e,t,r){(0,W6.useEffect)(()=>{function o(n){let i=n;if(!e.current)return;let a=r?.(i,e.current);if(a===!0)return;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("pointerdown",o),document.addEventListener("touchstart",o),()=>{document.removeEventListener("pointerdown",o),document.removeEventListener("touchstart",o)}},[e,t,r])}h();var V6=S(W(),1),Y6=e=>{let t=(0,V6.useRef)(e);return Object.assign(t.current,e),t.current};var X6=S(_(),1),Sa=bt(null),Z6=({onCancel:e,onChange:t,onSelect:r,colorPickerType:o})=>{let n=Of({className:"excalidraw-eye-dropper-backdrop",parentSelector:".excalidraw-eye-dropper-container"}),i=et(),a=Ca(),s=Bo(),c=Se(a,i),l=Y6({app:s,onCancel:e,onChange:t,onSelect:r,selectedElements:c}),{container:d}=ar();(0,Nf.useEffect)(()=>{let m=u.current;if(!m||!s.canvas||!n)return;let p=!1,f=s.canvas.getContext("2d"),g=({clientX:A,clientY:P})=>{let L=f.getImageData((A-i.offsetLeft)*window.devicePixelRatio,(P-i.offsetTop)*window.devicePixelRatio,1,1).data;return Xv(L[0],L[1],L[2])},x=({clientX:A,clientY:P,altKey:L})=>{m.style.top=`${P+20}px`,m.style.left=`${A+20}px`;let D=g({clientX:A,clientY:P});p&&l.onChange(o,D,l.selectedElements,{altKey:L}),m.style.background=D},y=()=>{l.onCancel()},w=(A,P)=>{l.onSelect(A,P)},T=A=>{p=!0,A.stopImmediatePropagation()},C=A=>{p=!1,d?.focus(),A.stopImmediatePropagation(),A.preventDefault(),w(g(A),A)},I=A=>{A.key===k.ESCAPE&&(A.preventDefault(),A.stopImmediatePropagation(),y())};return n.tabIndex=-1,n.focus(),x({clientX:l.app.lastViewportPosition.x,clientY:l.app.lastViewportPosition.y,altKey:!1}),n.addEventListener("keydown",I),n.addEventListener("pointerdown",T),n.addEventListener("pointerup",C),window.addEventListener("pointermove",x,{passive:!0}),window.addEventListener("blur",y),()=>{p=!1,n.removeEventListener("keydown",I),n.removeEventListener("pointerdown",T),n.removeEventListener("pointerup",C),window.removeEventListener("pointermove",x),window.removeEventListener("blur",y)}},[l,s.canvas,n,o,d,i.offsetLeft,i.offsetTop]);let u=(0,Nf.useRef)(null);return dc(u,()=>{e()},m=>!!m.target.closest(".excalidraw-eye-dropper-trigger, .excalidraw-eye-dropper-backdrop")),n?(0,K6.createPortal)((0,X6.jsx)("div",{ref:u,className:"excalidraw-eye-dropper-preview"}),n):null};var Jn=S(_(),1),j6=({color:e,onChange:t,label:r,colorPickerType:o})=>{let n=Ke(),[i,a]=(0,fn.useState)(e),[s,c]=Ne(No);(0,fn.useEffect)(()=>{a(e)},[e]);let l=(0,fn.useCallback)(f=>{let g=f.toLowerCase(),x=q6(g);x&&t(x),a(g)},[t]),d=(0,fn.useRef)(null),u=(0,fn.useRef)(null);(0,fn.useEffect)(()=>{d.current&&d.current.focus()},[s]);let[m,p]=Ne(Sa,qe);return(0,fn.useEffect)(()=>()=>{p(null)},[p]),(0,Jn.jsxs)("div",{className:"color-picker__input-label",children:[(0,Jn.jsx)("div",{className:"color-picker__input-hash",children:"#"}),(0,Jn.jsx)("input",{ref:s==="hex"?d:void 0,style:{border:0,padding:0},spellCheck:!1,className:"color-picker-input","aria-label":r,onChange:f=>{l(f.target.value)},value:(i||"").replace(/^#/,""),onBlur:()=>{a(e)},tabIndex:-1,onFocus:()=>c("hex"),onKeyDown:f=>{f.key!==k.TAB&&(f.key===k.ESCAPE&&u.current?.focus(),f.stopPropagation())}}),!n.editor.isMobile&&(0,Jn.jsxs)(Jn.Fragment,{children:[(0,Jn.jsx)("div",{style:{width:"1px",height:"1.25rem",backgroundColor:"var(--default-border-color)"}}),(0,Jn.jsx)("div",{ref:u,className:G("excalidraw-eye-dropper-trigger",{selected:m}),onClick:()=>p(f=>f?null:{keepOpenOnAlt:!1,onSelect:g=>t(g),colorPickerType:o}),title:`${E("labels.eyeDropper")} \u2014 ${k.I.toLocaleUpperCase()} or ${H("Alt")} `,children:DS})]})]})};var Q6=S(W(),1);var sr=S(_(),1),J6=e=>{let t=new Option().style;return t.color=e,!!t.color},q6=e=>Rr(e)?e:J6(`#${e}`)?`#${e}`:J6(e)?e:null,RD=({type:e,color:t,onChange:r,label:o,elements:n,palette:i=ge,updateData:a})=>{let[,s]=Ne(No),[c,l]=Ne(Sa,qe),{container:d}=ar(),u=Ke(),m=(0,sr.jsxs)("div",{children:[(0,sr.jsx)(Jl,{children:E("colorPicker.hexCode")}),(0,sr.jsx)(j6,{color:t,label:o,onChange:g=>{r(g)},colorPickerType:e})]}),p=(0,Q6.useRef)(null),f=()=>{p.current?.querySelector(".color-picker-content")?.focus()};return(0,sr.jsx)($6,{container:d,children:(0,sr.jsxs)(Rf,{ref:p,className:"focus-visible-none","data-prevent-outside-click":!0,onFocusOutside:g=>{f(),g.preventDefault()},onPointerDownOutside:g=>{c&&g.preventDefault()},onCloseAutoFocus:g=>{g.stopPropagation(),g.preventDefault(),d&&!P2(document.activeElement)&&d.focus(),a({openPopup:null}),s(null)},side:u.editor.isMobile&&!u.viewport.isLandscape?"bottom":"right",align:u.editor.isMobile&&!u.viewport.isLandscape?"center":"start",alignOffset:-16,sideOffset:20,style:{zIndex:"var(--zIndex-layerUI)",backgroundColor:"var(--popup-bg-color)",maxWidth:"208px",maxHeight:window.innerHeight,padding:"12px",borderRadius:"8px",boxSizing:"border-box",overflowY:"auto",boxShadow:"0px 7px 14px rgba(0, 0, 0, 0.05), 0px 0px 3.12708px rgba(0, 0, 0, 0.0798), 0px 0px 0.931014px rgba(0, 0, 0, 0.1702)"},children:[i?(0,sr.jsx)(u5,{palette:i,color:t,onChange:g=>{r(g)},onEyeDropperToggle:g=>{l(x=>g?(x=x||{keepOpenOnAlt:!0,onSelect:r,colorPickerType:e},x.keepOpenOnAlt=!0,x):g===!1||x?null:{keepOpenOnAlt:!1,onSelect:r,colorPickerType:e})},onEscape:g=>{c?l(null):Hn(g.target)?f():a({openPopup:null})},label:o,type:e,elements:n,updateData:a,children:m}):m,(0,sr.jsx)(G6,{width:20,height:10,style:{fill:"var(--popup-bg-color)",filter:"drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)"}})]})})},OD=({label:e,color:t,type:r})=>(0,sr.jsx)(Df,{type:"button",className:G("color-picker__button active-color",{"is-transparent":t==="transparent"||!t}),"aria-label":e,style:t?{"--swatch-color":t}:void 0,title:r==="elementStroke"?E("labels.showStroke"):E("labels.showBackground"),children:(0,sr.jsx)("div",{className:"color-picker__button-outline"})}),pu=({type:e,color:t,onChange:r,label:o,elements:n,palette:i=ge,topPicks:a,updateData:s,appState:c})=>(0,sr.jsx)("div",{children:(0,sr.jsxs)("div",{role:"dialog","aria-modal":"true",className:"color-picker-container",children:[(0,sr.jsx)(t5,{activeColor:t,onChange:r,type:e,topPicks:a}),(0,sr.jsx)("div",{style:{width:1,height:"100%",backgroundColor:"var(--default-border-color)",margin:"0 auto"}}),(0,sr.jsxs)(Lf,{open:c.openPopup===e,onOpenChange:l=>{s({openPopup:l?e:null})},children:[(0,sr.jsx)(OD,{color:t,label:o,type:e}),c.openPopup===e&&(0,sr.jsx)(RD,{type:e,color:t,onChange:r,label:o,elements:n,palette:i,updateData:s})]})]})});h();var ka=S(W(),1);h();var Ia=S(W(),1);var eC=S(zn(),1);var tC=S(_(),1),Ff=({children:e,left:t,top:r,onCloseRequest:o,fitInViewport:n=!1,offsetLeft:i=0,offsetTop:a=0,viewportWidth:s=window.innerWidth,viewportHeight:c=window.innerHeight})=>{let l=(0,Ia.useRef)(null);(0,Ia.useEffect)(()=>{let u=l.current;if(!u)return;u.contains(document.activeElement)||u.focus();let m=p=>{if(p.key===k.TAB){let f=Od(u),{activeElement:g}=document,x=f.findIndex(y=>y===g);g===u?(p.shiftKey?f[f.length-1]?.focus():f[0].focus(),p.preventDefault(),p.stopImmediatePropagation()):x===0&&p.shiftKey?(f[f.length-1]?.focus(),p.preventDefault(),p.stopImmediatePropagation()):x===f.length-1&&!p.shiftKey&&(f[0]?.focus(),p.preventDefault(),p.stopImmediatePropagation())}};return u.addEventListener("keydown",m),()=>u.removeEventListener("keydown",m)},[]);let d=(0,Ia.useRef)(null);return(0,Ia.useLayoutEffect)(()=>{if(n&&l.current&&r!=null&&t!=null){let u=l.current,{width:m,height:p}=u.getBoundingClientRect();if(d.current?.top===r&&d.current?.left===t)return;d.current={top:r,left:t},m>=s?(u.style.width=`${s}px`,u.style.left="0px",u.style.overflowX="scroll"):t+m-i>s?u.style.left=`${s-m-10}px`:u.style.left=`${t}px`,p>=c?(u.style.height=`${c-20}px`,u.style.top="10px",u.style.overflowY="scroll"):r+p-a>c?u.style.top=`${c-p}px`:u.style.top=`${r}px`}},[r,t,n,s,c,i,a]),(0,Ia.useEffect)(()=>{if(o){let u=m=>{l.current?.contains(m.target)||(0,eC.unstable_batchedUpdates)(()=>o(m))};return document.addEventListener("pointerdown",u,!1),()=>document.removeEventListener("pointerdown",u,!1)}},[o]),(0,tC.jsx)("div",{className:"popover",ref:l,tabIndex:-1,children:e})};var Br=S(_(),1);function ND({options:e,value:t,label:r,onChange:o,onClose:n}){let i=ka.default.useRef(),a=ka.default.useRef(),s=ka.default.useRef(null);return ka.default.useEffect(()=>{a.current?a.current.focus():s.current&&s.current.focus()},[]),(0,Br.jsx)("div",{className:"picker",role:"dialog","aria-modal":"true","aria-label":r,onKeyDown:l=>{let d=e.find(u=>u.keyBinding===l.key.toLowerCase());if(!(l.metaKey||l.altKey||l.ctrlKey)&&d){let u=e.indexOf(d);s.current.children[u].focus(),l.preventDefault()}else if(l.key===k.TAB)setTimeout(()=>{let u=a.current,m=document.activeElement;u!==m&&n()},0);else if(zl(l.key)){let{activeElement:u}=document,m=gi().rtl,p=Array.prototype.indexOf.call(s.current.children,u);if(p!==-1){let f=e.length,g=p;switch(l.key){case(m?k.ARROW_LEFT:k.ARROW_RIGHT):case k.ARROW_DOWN:{g=(p+1)%f;break}case(m?k.ARROW_RIGHT:k.ARROW_LEFT):case k.ARROW_UP:{g=(f+p-1)%f;break}}s.current.children[g].focus()}l.preventDefault()}else(l.key===k.ESCAPE||l.key===k.ENTER)&&(l.preventDefault(),n());l.nativeEvent.stopImmediatePropagation(),l.stopPropagation()},children:(0,Br.jsx)("div",{className:"picker-content",ref:s,children:e.map((l,d)=>(0,Br.jsxs)("button",{className:G("picker-option",{active:t===l.value}),onClick:u=>{u.currentTarget.focus(),o(l.value)},title:`${l.text} ${l.keyBinding&&`\u2014 ${l.keyBinding.toUpperCase()}`}`,"aria-label":l.text||"none","aria-keyshortcuts":l.keyBinding||void 0,ref:u=>{u&&d===0&&(i.current=u),u&&l.value===t&&(a.current=u)},onFocus:()=>{o(l.value)},children:[l.icon,l.keyBinding&&(0,Br.jsx)("span",{className:"picker-keybinding",children:l.keyBinding})]},l.text))})})}function F1({value:e,label:t,options:r,onChange:o,group:n=""}){let[i,a]=ka.default.useState(!1),s=ka.default.useRef(null),c=gi().rtl;return(0,Br.jsxs)("div",{children:[(0,Br.jsx)("button",{name:n,className:i?"active":"","aria-label":t,onClick:()=>a(!i),ref:s,children:r.find(l=>l.value===e)?.icon}),(0,Br.jsx)(ka.default.Suspense,{fallback:"",children:i?(0,Br.jsxs)(Br.Fragment,{children:[(0,Br.jsx)(Ff,{onCloseRequest:l=>l.target!==s.current&&a(!1),...c?{right:5.5}:{left:-5.5},children:(0,Br.jsx)(ND,{options:r.filter(l=>l.showInPicker!==!1),value:e,label:t,onChange:o,onClose:()=>{a(!1),s.current?.focus()}})}),(0,Br.jsx)("div",{className:"picker-triangle"})]}):null})]})}var fe=S(_(),1),oC=.1,ho=(e,t,r,o=!1)=>{let n=He(Se(e,t,{includeBoundTextElement:o}));return e.map(i=>n.get(i.id)||i.id===t.editingElement?.id?r(i):i)},Qr=function(e,t,r,o,n){let i=t.editingElement,a=we(e),s=null;return i&&(s=r(i)),s||(Je(a,t)?s=Ib(o===!0?a:a.filter(l=>o(l)),t,r)??(typeof n=="function"?n(!0):n):s=typeof n=="function"?n(!1):n),s},FD=(e,t)=>$e(t)?t:Y(t,{x:e.textAlign==="left"?e.x:e.x+(e.width-t.width)/(e.textAlign==="center"?2:1),y:e.y+(e.height-t.height)/2},!1),B1=(e,t,r,o)=>{let n=new Set;return{elements:ho(e,t,i=>{if(ee(i)){let a=r(i);n.add(a);let s=de(i,{fontSize:a});return br(s,lt(i)),s=FD(i,s),s}return i},!0),appState:{...t,currentItemFontSize:n.size===1?[...n][0]:o??t.currentItemFontSize},commitToHistory:!0}},BD=U({name:"changeStrokeColor",trackEvent:!1,perform:(e,t,r)=>({...r.currentItemStrokeColor&&{elements:ho(e,t,o=>Kd(o.type)?de(o,{strokeColor:r.currentItemStrokeColor}):o,!0)},appState:{...t,...r},commitToHistory:!!r.currentItemStrokeColor}),PanelComponent:({elements:e,appState:t,updateData:r,appProps:o})=>(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)("h3",{"aria-hidden":"true",children:E("labels.stroke")}),(0,fe.jsx)(pu,{topPicks:Hm,palette:Yv,type:"elementStroke",label:E("labels.stroke"),color:Qr(e,t,n=>n.strokeColor,!0,t.currentItemStrokeColor),onChange:n=>r({currentItemStrokeColor:n}),elements:e,appState:t,updateData:r})]})}),zD=U({name:"changeBackgroundColor",trackEvent:!1,perform:(e,t,r)=>({...r.currentItemBackgroundColor&&{elements:ho(e,t,o=>de(o,{backgroundColor:r.currentItemBackgroundColor}))},appState:{...t,...r},commitToHistory:!!r.currentItemBackgroundColor}),PanelComponent:({elements:e,appState:t,updateData:r,appProps:o})=>(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)("h3",{"aria-hidden":"true",children:E("labels.background")}),(0,fe.jsx)(pu,{topPicks:$m,palette:Kv,type:"elementBackground",label:E("labels.background"),color:Qr(e,t,n=>n.backgroundColor,!0,t.currentItemBackgroundColor),onChange:n=>r({currentItemBackgroundColor:n}),elements:e,appState:t,updateData:r})]})}),HD=U({name:"changeFillStyle",trackEvent:!1,perform:(e,t,r,o)=>(Ae("element","changeFillStyle",`${r} (${o.device.editor.isMobile?"mobile":"desktop"})`),{elements:ho(e,t,n=>de(n,{fillStyle:r})),appState:{...t,currentItemFillStyle:r},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:r})=>{let o=Se(e,t),n=o.length>0&&o.every(i=>i.fillStyle==="zigzag");return(0,fe.jsxs)("fieldset",{children:[(0,fe.jsx)("legend",{children:E("labels.fill")}),(0,fe.jsx)(Zn,{type:"button",options:[{value:"hachure",text:`${n?E("labels.zigzag"):E("labels.hachure")} (${H("Alt-Click")})`,icon:n?jT:qT,active:n?!0:void 0,testId:"fill-hachure"},{value:"cross-hatch",text:E("labels.crossHatch"),icon:JT,testId:"fill-cross-hatch"},{value:"solid",text:E("labels.solid"),icon:QT,testId:"fill-solid"}],value:Qr(e,t,i=>i.fillStyle,i=>i.hasOwnProperty("fillStyle"),i=>i?null:t.currentItemFillStyle),onClick:(i,a)=>{let s=a.altKey&&i==="hachure"&&o.every(c=>c.fillStyle==="hachure")?"zigzag":i;r(s)}})]})}}),$D=U({name:"changeStrokeWidth",trackEvent:!1,perform:(e,t,r)=>({elements:ho(e,t,o=>de(o,{strokeWidth:r})),appState:{...t,currentItemStrokeWidth:r},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:r})=>(0,fe.jsxs)("fieldset",{children:[(0,fe.jsx)("legend",{children:E("labels.strokeWidth")}),(0,fe.jsx)(Zn,{group:"stroke-width",options:[{value:Qm.thin,text:E("labels.thin"),icon:Gb,testId:"strokeWidth-thin"},{value:Qm.bold,text:E("labels.bold"),icon:eS,testId:"strokeWidth-bold"},{value:Qm.extraBold,text:E("labels.extraBold"),icon:tS,testId:"strokeWidth-extraBold"}],value:Qr(e,t,o=>o.strokeWidth,o=>o.hasOwnProperty("strokeWidth"),o=>o?null:t.currentItemStrokeWidth),onChange:o=>r(o)})]})}),GD=U({name:"changeSloppiness",trackEvent:!1,perform:(e,t,r)=>({elements:ho(e,t,o=>de(o,{seed:Do(),roughness:r})),appState:{...t,currentItemRoughness:r},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:r})=>(0,fe.jsxs)("fieldset",{children:[(0,fe.jsx)("legend",{children:E("labels.sloppiness")}),(0,fe.jsx)(Zn,{group:"sloppiness",options:[{value:0,text:E("labels.architect"),icon:nS},{value:1,text:E("labels.artist"),icon:iS},{value:2,text:E("labels.cartoonist"),icon:aS}],value:Qr(e,t,o=>o.roughness,o=>o.hasOwnProperty("roughness"),o=>o?null:t.currentItemRoughness),onChange:o=>r(o)})]})}),Vq=U({name:"changeStrokeStyle",trackEvent:!1,perform:(e,t,r)=>({elements:ho(e,t,o=>de(o,{strokeStyle:r})),appState:{...t,currentItemStrokeStyle:r},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:r})=>(0,fe.jsxs)("fieldset",{children:[(0,fe.jsx)("legend",{children:E("labels.strokeStyle")}),(0,fe.jsx)(Zn,{group:"strokeStyle",options:[{value:"solid",text:E("labels.strokeStyle_solid"),icon:Gb},{value:"dashed",text:E("labels.strokeStyle_dashed"),icon:rS},{value:"dotted",text:E("labels.strokeStyle_dotted"),icon:oS}],value:Qr(e,t,o=>o.strokeStyle,o=>o.hasOwnProperty("strokeStyle"),o=>o?null:t.currentItemStrokeStyle),onChange:o=>r(o)})]})}),UD=U({name:"changeOpacity",trackEvent:!1,perform:(e,t,r)=>({elements:ho(e,t,o=>de(o,{opacity:r}),!0),appState:{...t,currentItemOpacity:r},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:r})=>(0,fe.jsxs)("label",{className:"control-label",children:[E("labels.opacity"),(0,fe.jsx)("input",{type:"range",min:"0",max:"100",step:"10",onChange:o=>r(+o.target.value),value:Qr(e,t,o=>o.opacity,!0,t.currentItemOpacity)??void 0})]})}),WD=U({name:"changeFontSize",trackEvent:!1,perform:(e,t,r)=>B1(e,t,()=>r,r),PanelComponent:({elements:e,appState:t,updateData:r})=>(0,fe.jsxs)("fieldset",{children:[(0,fe.jsx)("legend",{children:E("labels.fontSize")}),(0,fe.jsx)(Zn,{group:"font-size",options:[{value:16,text:E("labels.small"),icon:bS,testId:"fontSize-small"},{value:20,text:E("labels.medium"),icon:xS,testId:"fontSize-medium"},{value:28,text:E("labels.large"),icon:ES,testId:"fontSize-large"},{value:36,text:E("labels.veryLarge"),icon:yS,testId:"fontSize-veryLarge"}],value:Qr(e,t,o=>{if(ee(o))return o.fontSize;let n=ye(o);return n?n.fontSize:null},o=>ee(o)||ye(o)!==null,o=>o?null:t.currentItemFontSize||Jt),onChange:o=>r(o)})]})}),z1=U({name:"decreaseFontSize",trackEvent:!1,perform:(e,t,r)=>B1(e,t,o=>Math.round(1/(1+oC)*o.fontSize)),keyTest:e=>e[k.CTRL_OR_CMD]&&e.shiftKey&&(e.key===k.CHEVRON_LEFT||e.key===k.COMMA)}),H1=U({name:"increaseFontSize",trackEvent:!1,perform:(e,t,r)=>B1(e,t,o=>Math.round(o.fontSize*(1+oC))),keyTest:e=>e[k.CTRL_OR_CMD]&&e.shiftKey&&(e.key===k.CHEVRON_RIGHT||e.key===k.PERIOD)}),VD=U({name:"changeFontFamily",trackEvent:!1,perform:(e,t,r)=>({elements:ho(e,t,o=>{if(ee(o)){let n=de(o,{fontFamily:r,lineHeight:mo(r)});return br(n,lt(o)),n}return o},!0),appState:{...t,currentItemFontFamily:r},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:r})=>{let o=[{value:qt.Virgil,text:E("labels.handDrawn"),icon:$l,testId:"font-family-virgil"},{value:qt.Helvetica,text:E("labels.normal"),icon:wS,testId:"font-family-normal"},{value:qt.Cascadia,text:E("labels.code"),icon:vS,testId:"font-family-code"}];return(0,fe.jsxs)("fieldset",{children:[(0,fe.jsx)("legend",{children:E("labels.fontFamily")}),(0,fe.jsx)(Zn,{group:"font-family",options:o,value:Qr(e,t,n=>{if(ee(n))return n.fontFamily;let i=ye(n);return i?i.fontFamily:null},n=>ee(n)||ye(n)!==null,n=>n?null:t.currentItemFontFamily||pr),onChange:n=>r(n)})]})}}),YD=U({name:"changeTextAlign",trackEvent:!1,perform:(e,t,r)=>({elements:ho(e,t,o=>{if(ee(o)){let n=de(o,{textAlign:r});return br(n,lt(o)),n}return o},!0),appState:{...t,currentItemTextAlign:r},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:r})=>(0,fe.jsxs)("fieldset",{children:[(0,fe.jsx)("legend",{children:E("labels.textAlign")}),(0,fe.jsx)(Zn,{group:"text-align",options:[{value:"left",text:E("labels.left"),icon:TS,testId:"align-left"},{value:"center",text:E("labels.center"),icon:SS,testId:"align-horizontal-center"},{value:"right",text:E("labels.right"),icon:CS,testId:"align-right"}],value:Qr(e,t,o=>{if(ee(o))return o.textAlign;let n=ye(o);return n?n.textAlign:null},o=>ee(o)||ye(o)!==null,o=>o?null:t.currentItemTextAlign),onChange:o=>r(o)})]})}),KD=U({name:"changeVerticalAlign",trackEvent:{category:"element"},perform:(e,t,r)=>({elements:ho(e,t,o=>{if(ee(o)){let n=de(o,{verticalAlign:r});return br(n,lt(o)),n}return o},!0),appState:{...t},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:r})=>(0,fe.jsx)("fieldset",{children:(0,fe.jsx)(Zn,{group:"text-align",options:[{value:Nt.TOP,text:E("labels.alignTop"),icon:(0,fe.jsx)(IS,{theme:t.theme}),testId:"align-top"},{value:Nt.MIDDLE,text:E("labels.centerVertically"),icon:(0,fe.jsx)(_S,{theme:t.theme}),testId:"align-middle"},{value:Nt.BOTTOM,text:E("labels.alignBottom"),icon:(0,fe.jsx)(kS,{theme:t.theme}),testId:"align-bottom"}],value:Qr(e,t,o=>{if(ee(o)&&o.containerId)return o.verticalAlign;let n=ye(o);return n?n.verticalAlign:null},o=>ee(o)||ye(o)!==null,o=>o?null:Nt.MIDDLE),onChange:o=>r(o)})})}),Yq=U({name:"changeRoundness",trackEvent:!1,perform:(e,t,r)=>({elements:ho(e,t,o=>de(o,{roundness:r==="round"?{type:Gn(o.type)?Ct.ADAPTIVE_RADIUS:Ct.PROPORTIONAL_RADIUS}:null})),appState:{...t,currentItemRoundness:r},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:r})=>{let n=fs(we(e),t).some(i=>i.roundness?.type===Ct.LEGACY);return(0,fe.jsxs)("fieldset",{children:[(0,fe.jsx)("legend",{children:E("labels.edges")}),(0,fe.jsx)(Zn,{group:"edges",options:[{value:"sharp",text:E("labels.sharp"),icon:sS},{value:"round",text:E("labels.round"),icon:lS}],value:Qr(e,t,i=>n?null:i.roundness?"round":"sharp",i=>i.hasOwnProperty("roundness"),i=>i?null:t.currentItemRoundness),onChange:i=>r(i)})]})}}),rC=e=>[{value:null,text:E("labels.arrowhead_none"),keyBinding:"q",icon:cS},{value:"arrow",text:E("labels.arrowhead_arrow"),keyBinding:"w",icon:(0,fe.jsx)(dS,{flip:e})},{value:"bar",text:E("labels.arrowhead_bar"),keyBinding:"e",icon:(0,fe.jsx)(mS,{flip:e})},{value:"dot",text:E("labels.arrowhead_circle"),keyBinding:null,icon:(0,fe.jsx)(Ub,{flip:e}),showInPicker:!1},{value:"circle",text:E("labels.arrowhead_circle"),keyBinding:"r",icon:(0,fe.jsx)(Ub,{flip:e}),showInPicker:!1},{value:"circle_outline",text:E("labels.arrowhead_circle_outline"),keyBinding:null,icon:(0,fe.jsx)(uS,{flip:e}),showInPicker:!1},{value:"triangle",text:E("labels.arrowhead_triangle"),icon:(0,fe.jsx)(pS,{flip:e}),keyBinding:"t"},{value:"triangle_outline",text:E("labels.arrowhead_triangle_outline"),icon:(0,fe.jsx)(fS,{flip:e}),keyBinding:null,showInPicker:!1},{value:"diamond",text:E("labels.arrowhead_diamond"),icon:(0,fe.jsx)(hS,{flip:e}),keyBinding:null,showInPicker:!1},{value:"diamond_outline",text:E("labels.arrowhead_diamond_outline"),icon:(0,fe.jsx)(gS,{flip:e}),keyBinding:null,showInPicker:!1}],Kq=U({name:"changeArrowhead",trackEvent:!1,perform:(e,t,r)=>({elements:ho(e,t,o=>{if(me(o)){let{position:n,type:i}=r;if(n==="start")return de(o,{startArrowhead:i});if(n==="end")return de(o,{endArrowhead:i})}return o}),appState:{...t,[r.position==="start"?"currentItemStartArrowhead":"currentItemEndArrowhead"]:r.type},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:r})=>{let o=gi().rtl;return(0,fe.jsxs)("fieldset",{children:[(0,fe.jsx)("legend",{children:E("labels.arrowheads")}),(0,fe.jsxs)("div",{className:"iconSelectList buttonList",children:[(0,fe.jsx)(F1,{label:"arrowhead_start",options:rC(!o),value:Qr(e,t,n=>me(n)&&ps(n.type)?n.startArrowhead:t.currentItemStartArrowhead,!0,t.currentItemStartArrowhead),onChange:n=>r({position:"start",type:n})}),(0,fe.jsx)(F1,{label:"arrowhead_end",group:"arrowheads",options:rC(!!o),value:Qr(e,t,n=>me(n)&&ps(n.type)?n.endArrowhead:t.currentItemEndArrowhead,!0,t.currentItemEndArrowhead),onChange:n=>r({position:"end",type:n})})]})]})}});h();h();var nC=S(W(),1),iC=S(_(),1),uc=()=>{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},$1=(e,t,r="bottom")=>{let o=e.getBoundingClientRect(),n=window.innerWidth,i=window.innerHeight,a=5,s=t.left+t.width/2-o.width/2;s<0?s=a:s+o.width>=n&&(s=n-o.width-a);let c;r==="bottom"?(c=t.top+t.height+a,c+o.height>=i&&(c=t.top-o.height-a)):(c=t.top-o.height-a,c<0&&(c=t.top+t.height+a)),Object.assign(e.style,{top:`${c}px`,left:`${s}px`})},ZD=(e,t,r,o)=>{t.classList.add("excalidraw-tooltip--visible"),t.style.minWidth=o?"50ch":"10ch",t.style.maxWidth=o?"50ch":"15ch",t.textContent=r;let n=e.getBoundingClientRect();$1(t,n)},go=({children:e,label:t,long:r=!1,style:o,disabled:n})=>((0,nC.useEffect)(()=>()=>uc().classList.remove("excalidraw-tooltip--visible"),[]),n?null:(0,iC.jsx)("div",{className:"excalidraw-tooltip-wrapper",onPointerEnter:i=>ZD(i.currentTarget,uc(),t,r),onPointerLeave:()=>uc().classList.remove("excalidraw-tooltip--visible"),style:o,children:e}));var Ps=S(_(),1),XD=U({name:"changeViewBackgroundColor",trackEvent:!1,predicate:(e,t,r,o)=>!!o.props.UIOptions.canvasActions.changeViewBackgroundColor&&!t.viewModeEnabled,perform:(e,t,r)=>({appState:{...t,...r},commitToHistory:!!r.viewBackgroundColor}),PanelComponent:({elements:e,appState:t,updateData:r,appProps:o})=>(0,Ps.jsx)(pu,{palette:null,topPicks:Gm,label:E("labels.canvasBackground"),type:"canvasBackground",color:t.viewBackgroundColor,onChange:n=>r({viewBackgroundColor:n}),"data-testid":"canvas-background-picker",elements:e,appState:t,updateData:r})}),fu=U({name:"clearCanvas",trackEvent:{category:"canvas"},predicate:(e,t,r,o)=>!!o.props.UIOptions.canvasActions.clearCanvas&&!t.viewModeEnabled,perform:(e,t,r,o)=>(o.imageCache.clear(),{elements:e.map(n=>de(n,{isDeleted:!0})),appState:{...wr(),files:{},theme:t.theme,penMode:t.penMode,penDetected:t.penDetected,exportBackground:t.exportBackground,exportEmbedScene:t.exportEmbedScene,gridSize:t.gridSize,showStats:t.showStats,pasteDialog:t.pasteDialog,activeTool:t.activeTool.type==="image"?{...t.activeTool,type:"selection"}:t.activeTool},commitToHistory:!0})}),Bf=U({name:"zoomIn",viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,r,o)=>({appState:{...t,...yi({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:Yn(t.zoom.value+ss)},t),userToFollow:null},commitToHistory:!1}),PanelComponent:({updateData:e})=>(0,Ps.jsx)(be,{type:"button",className:"zoom-in-button zoom-button",icon:gT,title:`${E("buttons.zoomIn")} \u2014 ${H("CtrlOrCmd++")}`,"aria-label":E("buttons.zoomIn"),onClick:()=>{e(null)}}),keyTest:e=>(e.code===ve.EQUAL||e.code===ve.NUM_ADD)&&(e[k.CTRL_OR_CMD]||e.shiftKey)}),zf=U({name:"zoomOut",viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,r,o)=>({appState:{...t,...yi({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:Yn(t.zoom.value-ss)},t),userToFollow:null},commitToHistory:!1}),PanelComponent:({updateData:e})=>(0,Ps.jsx)(be,{type:"button",className:"zoom-out-button zoom-button",icon:bT,title:`${E("buttons.zoomOut")} \u2014 ${H("CtrlOrCmd+-")}`,"aria-label":E("buttons.zoomOut"),onClick:()=>{e(null)}}),keyTest:e=>(e.code===ve.MINUS||e.code===ve.NUM_SUBTRACT)&&(e[k.CTRL_OR_CMD]||e.shiftKey)}),jD=U({name:"resetZoom",viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,r,o)=>({appState:{...t,...yi({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:Yn(1)},t),userToFollow:null},commitToHistory:!1}),PanelComponent:({updateData:e,appState:t})=>(0,Ps.jsx)(go,{label:E("buttons.resetZoom"),style:{height:"100%"},children:(0,Ps.jsxs)(be,{type:"button",className:"reset-zoom-button zoom-button",title:E("buttons.resetZoom"),"aria-label":E("buttons.resetZoom"),onClick:()=>{e(null)},children:[(t.zoom.value*100).toFixed(0),"%"]})}),keyTest:e=>(e.code===ve.ZERO||e.code===ve.NUM_ZERO)&&(e[k.CTRL_OR_CMD]||e.shiftKey)}),qD=(e,t)=>{let[r,o,n,i]=e,a=n-r,s=t.width/a,c=i-o,l=t.height/c,d=Math.min(s,l),u=Math.floor(d/ss)*ss;return Math.min(Math.max(u,Zm),1)},aC=({bounds:e,appState:t,fitToViewport:r=!1,viewportZoomFactor:o=.7})=>{let[n,i,a,s]=e,c=(n+a)/2,l=(i+s)/2,d,u,m;if(r){let p=a-n,f=s-i;d=Math.min(t.width/p,t.height/f)*Math.min(1,Math.max(o,.1)),d=Math.min(Math.max(d,.1),30);let g=t.width;if(t.openSidebar){let y=document.querySelector(".sidebar")?.offsetWidth??0;g=document.documentElement.getAttribute("dir")==="rtl"?t.width+y:t.width-y}u=g/2*(1/d)-c,m=t.height/2*(1/d)-l}else{d=qD(e,{width:t.width,height:t.height});let p=vb({scenePoint:{x:c,y:l},viewportDimensions:{width:t.width,height:t.height},zoom:{value:d}});u=p.scrollX,m=p.scrollY}return{appState:{...t,scrollX:u,scrollY:m,zoom:{value:d}},commitToHistory:!1}},hu=({targetElements:e,appState:t,fitToViewport:r,viewportZoomFactor:o})=>{let n=Me(we(e));return aC({bounds:n,appState:t,fitToViewport:r,viewportZoomFactor:o})},EJ=U({name:"zoomToFitSelectionInViewport",trackEvent:{category:"canvas"},perform:(e,t,r,o)=>{let n=o.scene.getSelectedElements(t);return hu({targetElements:n.length?n:e,appState:{...t,userToFollow:null},fitToViewport:!1})},keyTest:e=>e.code===ve.TWO&&e.shiftKey&&!e.altKey&&!e[k.CTRL_OR_CMD]}),yJ=U({name:"zoomToFitSelection",trackEvent:{category:"canvas"},perform:(e,t,r,o)=>{let n=o.scene.getSelectedElements(t);return hu({targetElements:n.length?n:e,appState:{...t,userToFollow:null},fitToViewport:!0})},keyTest:e=>e.code===ve.THREE&&e.shiftKey&&!e.altKey&&!e[k.CTRL_OR_CMD]}),JD=U({name:"zoomToFit",viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t)=>hu({targetElements:e,appState:{...t,userToFollow:null},fitToViewport:!1}),keyTest:e=>e.code===ve.ONE&&e.shiftKey&&!e.altKey&&!e[k.CTRL_OR_CMD]}),Hf=U({name:"toggleTheme",viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,r)=>({appState:{...t,theme:r||(t.theme===gt.LIGHT?gt.DARK:gt.LIGHT)},commitToHistory:!1}),keyTest:e=>e.altKey&&e.shiftKey&&e.code===ve.D,predicate:(e,t,r,o)=>!!o.props.UIOptions.canvasActions.toggleTheme}),wJ=U({name:"toggleEraserTool",trackEvent:{category:"toolbar"},perform:(e,t)=>{let r;return Io(t)?r=st(t,{...t.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):r=st(t,{type:"eraser",lastActiveToolBeforeEraser:t.activeTool}),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:r},commitToHistory:!0}},keyTest:e=>e.key===k.E}),sC=U({name:"toggleHandTool",trackEvent:{category:"toolbar"},perform:(e,t,r,o)=>{let n;return an(t)?n=st(t,{...t.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):(n=st(t,{type:"hand",lastActiveToolBeforeEraser:t.activeTool}),Qe(o.interactiveCanvas,Ue.GRAB)),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:n},commitToHistory:!0}},keyTest:e=>!e.altKey&&!e[k.CTRL_OR_CMD]&&e.key===k.H});h();var lC=S(_(),1),Ho=U({name:"finalize",trackEvent:!1,perform:(e,t,r,{interactiveCanvas:o,focusContainer:n,scene:i})=>{if(t.editingLinearElement){let{elementId:d,startBindingElement:u,endBindingElement:m}=t.editingLinearElement,p=re.getElement(d);if(p)return Ut(p)&&Pi(p,u,m),{elements:p.points.length<2||zo(p)?e.filter(f=>f.id!==p.id):void 0,appState:{...t,cursorButton:"up",editingLinearElement:null},commitToHistory:!0}}let a=e,s=t.pendingImageElementId&&i.getElement(t.pendingImageElementId);s&&Y(s,{isDeleted:!0},!1),window.document.activeElement instanceof HTMLElement&&n();let c=t.multiElement?t.multiElement:t.editingElement?.type==="freedraw"?t.editingElement:null;if(c){if(c.type!=="freedraw"&&t.lastPointerDownWith!=="touch"){let{points:u,lastCommittedPoint:m}=c;(!m||u[u.length-1]!==m)&&Y(c,{points:c.points.slice(0,-1)})}zo(c)&&(a=a.filter(u=>u.id!==c.id));let d=eo(c.points,t.zoom.value);if((c.type==="line"||c.type==="freedraw")&&d){let u=c.points,m=u[0];Y(c,{points:u.map((p,f)=>f===u.length-1?[m[0],m[1]]:p)})}if(Ut(c)&&!d&&c.points.length>1){let[u,m]=re.getPointAtIndexGlobalCoordinates(c,-1);gu(c,t,_e.getScene(c),{x:u,y:m})}}(!t.activeTool.locked&&t.activeTool.type!=="freedraw"||!c)&&so(o);let l;return t.activeTool.type==="eraser"?l=st(t,{...t.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):l=st(t,{type:"selection"}),{elements:a,appState:{...t,cursorButton:"up",activeTool:(t.activeTool.locked||t.activeTool.type==="freedraw")&&c?t.activeTool:l,activeEmbeddable:null,draggingElement:null,multiElement:null,editingElement:null,startBoundElement:null,suggestedBindings:[],selectedElementIds:c&&!t.activeTool.locked&&t.activeTool.type!=="freedraw"?{...t.selectedElementIds,[c.id]:!0}:t.selectedElementIds,selectedLinearElement:c&&me(c)?new re(c,i):t.selectedLinearElement,pendingImageElementId:null},commitToHistory:t.activeTool.type==="freedraw"}},keyTest:(e,t)=>e.key===k.ESCAPE&&(t.editingLinearElement!==null||!t.draggingElement&&t.multiElement===null)||(e.key===k.ESCAPE||e.key===k.ENTER)&&t.multiElement!==null,PanelComponent:({appState:e,updateData:t,data:r})=>(0,lC.jsx)(be,{type:"button",icon:PT,title:E("buttons.done"),"aria-label":E("buttons.done"),onClick:t,visible:e.multiElement!=null,size:r?.size||"medium"})});h();h();var cC=S(W(),1);var mc=S(_(),1),dC=e=>{let{id:t}=ar(),[r,o]=(0,cC.useState)(e.value),n=a=>{e.ignoreFocus||O2(a.target);let s=a.target.value;s!==e.value&&e.onChange(s)},i=a=>{if(a.key===k.ENTER){if(a.preventDefault(),a.nativeEvent.isComposing||a.keyCode===229)return;a.currentTarget.blur()}};return(0,mc.jsxs)("div",{className:"ProjectName",children:[(0,mc.jsx)("label",{className:"ProjectName-label",htmlFor:"filename",children:`${e.label}${e.isNameEditable?"":":"}`}),e.isNameEditable?(0,mc.jsx)("input",{type:"text",className:"TextInput",onBlur:n,onKeyDown:i,id:`${t}-filename`,value:r,onChange:a=>o(a.target.value)}):(0,mc.jsx)("span",{className:"TextInput TextInput--readonly",id:`${t}-filename`,children:e.value})]})};h();var pc=S(_(),1),mC=e=>{let t=e.title||(e.value==="dark"?E("buttons.lightMode"):E("buttons.darkMode"));return(0,pc.jsx)(be,{type:"icon",icon:e.value===gt.LIGHT?uC.MOON:uC.SUN,title:t,"aria-label":t,onClick:()=>e.onChange(e.value===gt.DARK?gt.LIGHT:gt.DARK),"data-testid":"toggle-dark-mode"})},uC={SUN:(0,pc.jsx)("svg",{width:"512",height:"512",className:"rtl-mirror",viewBox:"0 0 512 512",children:(0,pc.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,pc.jsx)("svg",{width:"512",height:"512",className:"rtl-mirror",viewBox:"0 0 512 512",children:(0,pc.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"})})};h();h();h();var hn=32,ct=12,_a=256,fC=50,Ls="NOT_SPREADSHEET",fc="VALID_SPREADSHEET",bu=e=>{let t=/^([-+]?)[$€£¥₩]?([-+]?)([\d.,]+)[%]?$/.exec(e);return t?parseFloat(`${(t[1]||t[2])+t[3]}`.replace(/,/g,"")):null},G1=(e,t)=>e.slice(1).every(r=>bu(r[t])!==null),pC=e=>{let t=e[0].length;if(t>2)return{type:Ls,reason:"More than 2 columns"};if(t===1){if(!G1(e,0))return{type:Ls,reason:"Value is not numeric"};let c=bu(e[0][0])===null,l=(c?e.slice(1):e).map(d=>bu(d[0]));return l.length<2?{type:Ls,reason:"Less than two rows"}:{type:fc,spreadsheet:{title:c?e[0][0]:null,labels:null,values:l}}}let r=G1(e,0),o=G1(e,1);if(!r&&!o)return{type:Ls,reason:"Value is not numeric"};let[n,i]=o?[0,1]:[1,0],a=bu(e[0][i])===null,s=a?e.slice(1):e;return s.length<2?{type:Ls,reason:"Less than 2 rows"}:{type:fc,spreadsheet:{title:a?e[0][i]:null,labels:s.map(c=>c[n]),values:s.map(c=>bu(c[i]))}}},QD=e=>{let t=[];for(let r=0;r<e[0].length;r++){let o=[];for(let n=0;n<e.length;n++)o.push(e[n][r]);t.push(o)}return t},hC=e=>{let t=e.trim().split(`
49
- `).map(i=>i.trim().split(" "));if(t.length&&t[0].length!==2&&(t=e.trim().split(`
50
- `).map(i=>i.trim().split(","))),t.length===0)return{type:Ls,reason:"No values"};let r=t[0].length;if(!t.every(i=>i.length===r))return{type:Ls,reason:"All rows don't have same number of columns"};let n=pC(t);if(n.type!==fc){let i=pC(QD(t));if(i.type===fc)return i}return n},$f=Zv(Wv),$o={fillStyle:"hachure",fontFamily:pr,fontSize:Jt,opacity:100,roughness:1,strokeColor:ge.black,roundness:null,strokeStyle:"solid",strokeWidth:1,verticalAlign:Nt.MIDDLE,locked:!1},gC=e=>{let t=(hn+ct)*e.values.length+ct,r=_a+ct*2;return{chartWidth:t,chartHeight:r}},eR=(e,t,r,o,n)=>e.labels?.map((i,a)=>ir({groupIds:[o],backgroundColor:n,...$o,text:i.length>8?`${i.slice(0,5)}...`:i,x:t+a*(hn+ct)+ct*2,y:r+ct/2,width:hn,angle:5.87,fontSize:16,textAlign:"center",verticalAlign:"top"}))||[],tR=(e,t,r,o,n)=>{let i=ir({groupIds:[o],backgroundColor:n,...$o,x:t-ct,y:r-ct,text:"0",textAlign:"right"}),a=ir({groupIds:[o],backgroundColor:n,...$o,x:t-ct,y:r-_a-i.height/2,text:Math.max(...e.values).toLocaleString(),textAlign:"right"});return[i,a]},rR=(e,t,r,o,n)=>{let{chartWidth:i,chartHeight:a}=gC(e),s=Ro({backgroundColor:n,groupIds:[o],...$o,type:"line",x:t,y:r,startArrowhead:null,endArrowhead:null,width:i,points:[[0,0],[i,0]]}),c=Ro({backgroundColor:n,groupIds:[o],...$o,type:"line",x:t,y:r,startArrowhead:null,endArrowhead:null,height:a,points:[[0,0],[0,-a]]}),l=Ro({backgroundColor:n,groupIds:[o],...$o,type:"line",x:t,y:r-_a-ct,startArrowhead:null,endArrowhead:null,strokeStyle:"dotted",width:i,opacity:fC,points:[[0,0],[i,0]]});return[s,c,l]},bC=(e,t,r,o,n,i)=>{let{chartWidth:a,chartHeight:s}=gC(e),c=e.title?ir({backgroundColor:n,groupIds:[o],...$o,text:e.title,x:t+a/2,y:r-_a-ct*2-Jt,roundness:null,textAlign:"center"}):null,l=i?uo({backgroundColor:n,groupIds:[o],...$o,type:"rectangle",x:t,y:r-s,width:a,height:s,strokeColor:ge.black,fillStyle:"solid",opacity:6}):null;return[...l?[l]:[],...c?[c]:[],...eR(e,t,r,o,n),...tR(e,t,r,o,n),...rR(e,t,r,o,n)]},oR=(e,t,r)=>{let o=Math.max(...e.values),n=tr(),i=$f[Math.floor(Math.random()*$f.length)];return[...e.values.map((s,c)=>{let l=s/o*_a;return uo({backgroundColor:i,groupIds:[n],...$o,type:"rectangle",x:t+c*(hn+ct)+ct,y:r-l-ct,width:hn,height:l})}),...bC(e,t,r,n,i,v.DEV)]},nR=(e,t,r)=>{let o=Math.max(...e.values),n=tr(),i=$f[Math.floor(Math.random()*$f.length)],a=0,s=[];for(let g of e.values){let x=a*(hn+ct),y=-(g/o)*_a;s.push([x,y]),a++}let c=Math.max(...s.map(g=>g[0])),l=Math.max(...s.map(g=>g[1])),d=Math.min(...s.map(g=>g[0])),u=Math.min(...s.map(g=>g[1])),m=Ro({backgroundColor:i,groupIds:[n],...$o,type:"line",x:t+ct+hn/2,y:r-ct,startArrowhead:null,endArrowhead:null,height:l-u,width:c-d,strokeWidth:2,points:s}),p=e.values.map((g,x)=>{let y=x*(hn+ct)+ct/2,w=-(g/o)*_a+ct/2;return uo({backgroundColor:i,groupIds:[n],...$o,fillStyle:"solid",strokeWidth:2,type:"ellipse",x:t+y+hn/2,y:r+w-ct*2,width:ct,height:ct})}),f=e.values.map((g,x)=>{let y=x*(hn+ct)+ct/2,w=g/o*_a+ct/2+ct;return Ro({backgroundColor:i,groupIds:[n],...$o,type:"line",x:t+y+hn/2+ct/2,y:r-w,startArrowhead:null,endArrowhead:null,height:w,strokeStyle:"dotted",opacity:fC,points:[[0,0],[0,w]]})});return[...bC(e,t,r,n,i,v.DEV),m,...f,...p]},xC=(e,t,r,o)=>e==="line"?nR(t,r,o):oR(t,r,o);var EQ="clipboard"in navigator&&"readText"in navigator.clipboard,Gf="clipboard"in navigator&&"writeText"in navigator.clipboard,hc="clipboard"in navigator&&"write"in navigator.clipboard&&"ClipboardItem"in window&&"toBlob"in HTMLCanvasElement.prototype,iR=e=>!!([yr.excalidraw,yr.excalidrawClipboard,yr.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),EC=({types:e,files:t})=>{!e&&!t&&console.warn("createPasteEvent: no types or files provided");let r=new ClipboardEvent("paste",{clipboardData:new DataTransfer});if(e)for(let[o,n]of Object.entries(e))try{if(r.clipboardData?.setData(o,n),r.clipboardData?.getData(o)!==n)throw new Error(`Failed to set "${o}" as clipboardData item`)}catch(i){throw new Error(i.message)}if(t){let o=-1;for(let n of t){o++;try{if(r.clipboardData?.items.add(n),r.clipboardData?.files[o]!==n)throw new Error(`Failed to set file "${n.name}" as clipboardData item`)}catch(i){throw new Error(i.message)}}}return r},aR=({elements:e,files:t})=>{let r=new Set(e.filter(a=>le(a))),o=!1,n=e.reduce((a,s)=>(Zr(s)&&(o=!0,t&&t[s.fileId]&&(a[s.fileId]=t[s.fileId])),a),{});o&&!t&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");let i={type:yr.excalidrawClipboard,elements:e.map(a=>{if(Cr(a)&&!r.has(Cr(a))){let s=Ti(a);return Y(s,{frameId:null}),s}return a}),files:t?n:void 0};return JSON.stringify(i)},Uf=async(e,t,r)=>{await Li(aR({elements:e,files:t}),r)},sR=e=>{let t=hC(e);return t.type===fc?{spreadsheet:t.spreadsheet}:null};function yC(e){let t=[];for(let r of e.childNodes)if(r.nodeType===3){let o=r.textContent?.trim();o&&t.push({type:"text",value:o})}else if(r instanceof HTMLImageElement){let o=r.getAttribute("src");o&&o.startsWith("http")&&t.push({type:"imageUrl",value:o})}else t=t.concat(yC(r));return t}var lR=e=>{let t=e.clipboardData?.getData("text/html");if(!t)return null;try{let r=new DOMParser().parseFromString(t,"text/html"),o=yC(r.body);if(o.length)return{type:"mixedContent",value:o}}catch(r){console.error(`error in parseHTMLFromPaste: ${r.message}`)}return null},wC=async()=>{let e={};try{if(navigator.clipboard?.readText)return{"text/plain":await navigator.clipboard?.readText()}}catch(r){if(navigator.clipboard?.read)console.warn(`navigator.clipboard.readText() failed (${r.message}). Failling back to navigator.clipboard.read()`);else throw r}let t;try{t=await navigator.clipboard?.read()}catch(r){if(r.name==="DataError")return console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${r.message}`),e;throw r}for(let r of t)for(let o of r.types)if(Nd(e2,o))try{e[o]=await(await r.getType(o)).text()}catch(n){console.warn(`Cannot retrieve ${o} from clipboardItem: ${n.message}`)}return Object.keys(e).length===0&&console.warn("No clipboard data found from clipboard.read()."),e},cR=async(e,t=!1)=>{try{let r=!t&&e&&lR(e);return r?r.value.every(n=>n.type==="text")?{type:"text",value:e.clipboardData?.getData("text/plain")||r.value.map(n=>n.value).join(`
51
- `).trim()}:r:{type:"text",value:(e.clipboardData?.getData("text/plain")||"").trim()}}catch{return{type:"text",value:""}}},Wf=async(e,t=!1)=>{let r=await cR(e,t);if(r.type==="mixedContent")return{mixedContent:r.value};try{let o=!t&&sR(r.value);if(o)return o}catch(o){console.error(o)}try{let o=JSON.parse(r.value),n=o.type===yr.excalidrawClipboardWithAPI;if(iR(o))return{elements:o.elements,files:o.files,text:t?JSON.stringify(o.elements,null,2):void 0,programmaticAPI:n}}catch{}return{text:r.value}},Vf=async e=>{try{await navigator.clipboard.write([new window.ClipboardItem({[ae.png]:e})])}catch(t){if(hp(e))await navigator.clipboard.write([new window.ClipboardItem({[ae.png]:await e})]);else throw t}},Li=async(e,t)=>{if(Gf)try{await navigator.clipboard.writeText(e||"");return}catch(r){console.error(r)}try{if(t){if(t.clipboardData?.setData("text/plain",e||""),t.clipboardData?.getData("text/plain")!==e)throw new Error("Failed to setData on clipboardEvent");return}}catch(r){console.error(r)}if(!dR(e))throw new Error(E("errors.copyToSystemClipboardFailed"))},dR=e=>{e||(e=" ");let t=document.documentElement.getAttribute("dir")==="rtl",r=document.createElement("textarea");r.style.border="0",r.style.padding="0",r.style.margin="0",r.style.position="absolute",r.style[t?"right":"left"]="-9999px";let o=window.pageYOffset||document.documentElement.scrollTop;r.style.top=`${o}px`,r.style.fontSize="12pt",r.setAttribute("readonly",""),r.value=e,document.body.appendChild(r);let n=!1;try{r.select(),r.setSelectionRange(0,r.value.length),n=document.execCommand("copy")}catch(i){console.error(i)}return r.remove(),n};h();h();function vC(e){return[Math.min(e[0][0],e[1][0]),Math.min(e[0][1],e[1][1]),Math.max(e[0][0],e[1][0]),Math.max(e[0][1],e[1][1])]}function CC(e,t){return e[0]*t[1]-t[0]*e[1]}function uR(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function Yf(e,t){return[e[0]-t[0],e[1]-t[1]]}var mR=1e-6;function TC(e,t){let r=Yf(e[1],e[0]),o=Yf(t,e[0]),n=CC(r,o);return Math.abs(n)<mR}function U1(e,t){let r=Yf(e[1],e[0]),o=Yf(t,e[0]);return CC(r,o)<0}function SC(e,t){return TC(e,t[0])||TC(e,t[1])||(U1(e,t[0])?!U1(e,t[1]):U1(e,t[1]))}function IC(e,t){return uR(vC(e),vC(t))&&SC(e,t)&&SC(t,e)}h();h();var rg=S(W(),1);h();var jf=S(W(),1);h();var Zf=S(W(),1);h();var kC=S(W(),1);var Kf=S(_(),1),pR=({size:e="1em",circleWidth:t=8,synchronized:r=!1})=>{let n=-(kC.default.useRef(Date.now()).current%1600);return(0,Kf.jsx)("div",{className:"Spinner",children:(0,Kf.jsx)("svg",{viewBox:"0 0 100 100",style:{width:e,height:e,"--spinner-delay":r?`${n}ms`:0},children:(0,Kf.jsx)("circle",{cx:"50",cy:"50",r:50-t/2,strokeWidth:t,fill:"none",strokeMiterlimit:"10"})})})},zr=pR;var gc=S(_(),1),Xf=({delay:e,theme:t})=>{let[r,o]=(0,Zf.useState)(!!e);return(0,Zf.useEffect)(()=>{if(!e)return;let n=setTimeout(()=>{o(!1)},e);return()=>clearTimeout(n)},[e]),r?null:(0,gc.jsxs)("div",{className:G("LoadingMessage",{"LoadingMessage--dark":t===gt.DARK}),children:[(0,gc.jsx)("div",{children:(0,gc.jsx)(zr,{})}),(0,gc.jsx)("div",{className:"LoadingMessage-text",children:E("labels.loadingScene")})]})};var AC=S(_(),1),_C=e=>{let[t,r]=(0,jf.useState)(!0);return(0,jf.useEffect)(()=>{let o=async()=>{await cp(n),r(!1)},n=Tl.find(i=>i.code===e.langCode)||Bn;o()},[e.langCode]),t?(0,AC.jsx)(Xf,{theme:e.theme}):e.children};h();var fR=()=>{Array.prototype.at||Object.defineProperty(Array.prototype,"at",{value:function(e){if(e=Math.trunc(e)||0,e<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]},writable:!0,enumerable:!1,configurable:!0}),Element.prototype.replaceChildren||(Element.prototype.replaceChildren=function(...e){this.innerHTML="",this.append(...e)})},MC=fR;h();h();var Jf=S(W(),1);h();var xu=S(W());h();h();var PC=e=>{let t,r=new Set,o=(c,l)=>{let d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){let u=t;t=l??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(m=>m(t,u))}},n=()=>t,s={setState:o,getState:n,subscribe:c=>(r.add(c),()=>r.delete(c)),destroy:()=>{(v?v.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return t=e(o,n,s),s},LC=e=>e?PC(e):PC;var UC=S(W(),1),WC=S(HC(),1),{useDebugValue:LR}=UC.default,{useSyncExternalStoreWithSelector:DR}=WC.default,$C=!1;function RR(e,t=e.getState,r){(v?v.MODE:void 0)!=="production"&&r&&!$C&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),$C=!0);let o=DR(e.subscribe,e.getState,e.getServerState||e.getState,t,r);return LR(o),o}var GC=e=>{(v?v.MODE:void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let t=typeof e=="function"?LC(e):e,r=(o,n)=>RR(t,o,n);return Object.assign(r,t),r},VC=e=>e?GC(e):GC;var YC,KC,ZC=typeof window<"u"&&((YC=window.document)!=null&&YC.createElement||((KC=window.navigator)==null?void 0:KC.product)==="ReactNative")?xu.default.useLayoutEffect:xu.default.useEffect;function gn(){let e=VC(t=>({current:new Array,version:0,set:t}));return{In:({children:t})=>{let r=e(n=>n.set),o=e(n=>n.version);return ZC(()=>{r(n=>({version:n.version+1}))},[]),ZC(()=>(r(({current:n})=>({current:[...n,t]})),()=>r(({current:n})=>({current:n.filter(i=>i!==t)}))),[t,o]),null},Out:()=>{let t=e(r=>r.current);return xu.default.createElement(xu.default.Fragment,null,t)}}}var V1=Jf.default.createContext(null),ft=()=>Jf.default.useContext(V1),XC=()=>Jf.default.useMemo(()=>({MainMenuTunnel:gn(),WelcomeScreenMenuHintTunnel:gn(),WelcomeScreenToolbarHintTunnel:gn(),WelcomeScreenHelpHintTunnel:gn(),WelcomeScreenCenterTunnel:gn(),FooterCenterTunnel:gn(),DefaultSidebarTriggerTunnel:gn(),DefaultSidebarTabTriggersTunnel:gn(),OverwriteConfirmDialogTunnel:gn(),TTDDialogTriggerTunnel:gn(),jotaiScope:Symbol()}),[]);var Y1=S(_(),1),jC=({children:e})=>{let{FooterCenterTunnel:t}=ft(),r=et();return(0,Y1.jsx)(t.In,{children:(0,Y1.jsx)("div",{className:G("footer-center zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-bottom":r.zenModeEnabled}),children:e})})},OR=jC;jC.displayName="FooterCenter";h();h();h();var QC=S(_(),1),qC=({className:e="",children:t,onToggle:r,title:o,...n})=>{let i=Ke(),a=G(`dropdown-menu-button ${e}`,"zen-mode-transition",{"dropdown-menu-button--mobile":i.editor.isMobile}).trim();return(0,QC.jsx)("button",{"data-prevent-outside-click":!0,className:a,onClick:r,type:"button","data-testid":"dropdown-menu-button",title:o,...n,children:t})},JC=qC;qC.displayName="DropdownMenuTrigger";h();h();var Qf=S(W(),1);var K1=Qf.default.createContext({}),eh=(e="",t=!1)=>`dropdown-menu-item dropdown-menu-item-base ${e} ${t?"dropdown-menu-item--selected":""}`.trim(),th=(e,t)=>{let r=(0,Qf.useContext)(K1);return aa(e,o=>{let n=new CustomEvent("menu.itemSelect",{bubbles:!0,cancelable:!0});t?.(n),n.defaultPrevented||r.onSelect?.(n)})};h();var Aa=S(_(),1),NR=({icon:e,shortcut:t,children:r})=>{let o=Ke();return(0,Aa.jsxs)(Aa.Fragment,{children:[(0,Aa.jsx)("div",{className:"dropdown-menu-item__icon",children:e}),(0,Aa.jsx)("div",{className:"dropdown-menu-item__text",children:r}),t&&!o.editor.isMobile&&(0,Aa.jsx)("div",{className:"dropdown-menu-item__shortcut",children:t})]})},rh=NR;var oh=S(_(),1),Z1=({icon:e,onSelect:t,children:r,shortcut:o,className:n,selected:i,...a})=>{let s=th(a.onClick,t);return(0,oh.jsx)("button",{...a,onClick:s,type:"button",className:eh(n,i),title:a.title??a["aria-label"],children:(0,oh.jsx)(rh,{icon:e,shortcut:o,children:r})})};Z1.displayName="DropdownMenuItem";var eI=({children:e})=>(0,oh.jsx)("div",{style:{display:"inline-flex",marginLeft:"auto",padding:"2px 4px",background:"pink",borderRadius:6,fontSize:9,color:"black",fontFamily:"Cascadia, monospace"},children:e});eI.displayName="DropdownMenuItemBadge";Z1.Badge=eI;var bn=Z1;h();var oI=S(_(),1),tI=()=>(0,oI.jsx)("div",{style:{height:"1px",backgroundColor:"var(--default-border-color)",margin:".5rem 0"}}),rI=tI;tI.displayName="DropdownMenuSeparator";h();var nh=S(_(),1),nI=({children:e,className:t="",style:r,title:o})=>(0,nh.jsxs)("div",{className:`dropdown-menu-group ${t}`,style:r,children:[o&&(0,nh.jsx)("p",{className:"dropdown-menu-group-title",children:o}),e]}),iI=nI;nI.displayName="DropdownMenuGroup";h();h();var aI=S(W(),1);var sI=S(_(),1),xr=aI.default.forwardRef(({children:e,padding:t,className:r,style:o},n)=>(0,sI.jsx)("div",{className:G("Island",r),style:{"--padding":t,...o},ref:n,children:e}));h();var X1=S(W(),1);var j1=S(_(),1),FR=(0,X1.forwardRef)(({children:e,gap:t,align:r,justifyContent:o,className:n,style:i},a)=>(0,j1.jsx)("div",{className:G("Stack Stack_horizontal",n),style:{"--gap":t,alignItems:r,justifyContent:o,...i},ref:a,children:e})),BR=(0,X1.forwardRef)(({children:e,gap:t,align:r,justifyContent:o,className:n,style:i},a)=>(0,j1.jsx)("div",{className:G("Stack Stack_vertical",n),style:{"--gap":t,justifyItems:r,justifyContent:o,...i},ref:a,children:e})),lr={Row:FR,Col:BR};var lI=S(W(),1);var Eu=S(_(),1),cI=({children:e,onClickOutside:t,className:r="",onSelect:o,style:n})=>{let i=Ke(),a=(0,lI.useRef)(null);dc(a,()=>{t?.()});let s=G(`dropdown-menu ${r}`,{"dropdown-menu--mobile":i.editor.isMobile}).trim();return(0,Eu.jsx)(K1.Provider,{value:{onSelect:o},children:(0,Eu.jsx)("div",{ref:a,className:s,style:n,"data-testid":"dropdown-menu",children:i.editor.isMobile?(0,Eu.jsx)(lr.Col,{className:"dropdown-menu-container",children:e}):(0,Eu.jsx)(xr,{className:"dropdown-menu-container",padding:2,style:{zIndex:2},children:e})})})};cI.displayName="DropdownMenuContent";var dI=cI;h();var q1=S(_(),1),uI=({icon:e,shortcut:t,href:r,children:o,onSelect:n,className:i="",selected:a,...s})=>{let c=th(s.onClick,n);return(0,q1.jsx)("a",{...s,href:r,target:"_blank",rel:"noreferrer",className:eh(i,a),title:s.title??s["aria-label"],onClick:c,children:(0,q1.jsx)(rh,{icon:e,shortcut:t,children:o})})},xc=uI;uI.displayName="DropdownMenuItemLink";h();var pI=S(_(),1),zR=({children:e,className:t="",selected:r,...o})=>(0,pI.jsx)("div",{...o,className:`dropdown-menu-item-base dropdown-menu-item-custom ${t} ${r?"dropdown-menu-item--selected":""}`.trim(),children:e}),mI=zR;h();var yu=S(W(),1),fI=e=>{let t=yu.default.Children.toArray(e).find(r=>yu.default.isValidElement(r)&&typeof r.type!="string"&&r?.type.displayName&&r.type.displayName==="DropdownMenuTrigger");return t||null},hI=e=>{let t=yu.default.Children.toArray(e).find(r=>yu.default.isValidElement(r)&&typeof r.type!="string"&&r?.type.displayName&&r.type.displayName==="DropdownMenuContent");return t||null};var ih=S(_(),1),Di=({children:e,open:t})=>{let r=fI(e),o=hI(e);return(0,ih.jsxs)(ih.Fragment,{children:[r,t&&o]})};Di.Trigger=JC;Di.Content=dI;Di.Item=bn;Di.ItemLink=xc;Di.ItemCustom=mI;Di.Group=iI;Di.Separator=rI;var je=Di;Di.displayName="DropdownMenu";var mx={};IM(mx,{ChangeCanvasBackground:()=>n4,ClearCanvas:()=>r4,Export:()=>i4,Help:()=>t4,LiveCollaborationTrigger:()=>s4,LoadScene:()=>JI,SaveAsImage:()=>e4,SaveToActiveFile:()=>QI,Socials:()=>a4,ToggleTheme:()=>o4});h();h();var HR={toggleTheme:[H("Shift+Alt+D")],saveScene:[H("CtrlOrCmd+S")],loadScene:[H("CtrlOrCmd+O")],clearCanvas:[H("CtrlOrCmd+Delete")],imageExport:[H("CtrlOrCmd+Shift+E")],cut:[H("CtrlOrCmd+X")],copy:[H("CtrlOrCmd+C")],paste:[H("CtrlOrCmd+V")],copyStyles:[H("CtrlOrCmd+Alt+C")],pasteStyles:[H("CtrlOrCmd+Alt+V")],selectAll:[H("CtrlOrCmd+A")],deleteSelectedElements:[H("Delete")],duplicateSelection:[H("CtrlOrCmd+D"),H(`Alt+${E("helpDialog.drag")}`)],sendBackward:[H("CtrlOrCmd+[")],bringForward:[H("CtrlOrCmd+]")],sendToBack:[Dr?H("CtrlOrCmd+Alt+["):H("CtrlOrCmd+Shift+[")],bringToFront:[Dr?H("CtrlOrCmd+Alt+]"):H("CtrlOrCmd+Shift+]")],copyAsPng:[H("Shift+Alt+C")],copyAsSvg:[],group:[H("CtrlOrCmd+G")],ungroup:[H("CtrlOrCmd+Shift+G")],gridMode:[H("CtrlOrCmd+'")],zenMode:[H("Alt+Z")],objectsSnapMode:[H("Alt+S")],stats:[H("Alt+/")],addToLibrary:[],flipHorizontal:[H("Shift+H")],flipVertical:[H("Shift+V")],viewMode:[H("Alt+R")],hyperlink:[H("CtrlOrCmd+K")],toggleElementLock:[H("CtrlOrCmd+Shift+L")]},Ri=e=>{let t=HR[e];return t&&t.length>0?t[0]:""};h();h();h();var Ch=S(W(),1);h();var ah=S(W(),1),gI=()=>{let[e,t]=(0,ah.useState)(null),r=(0,ah.useCallback)(o=>t(o),[]);return[e,r]};h();var bI=S(zn(),1);var wu=S(_(),1),xI=e=>{let{closeOnClickOutside:t=!0}=e,r=Of({className:"excalidraw-modal-container"});if(!r)return null;let o=n=>{n.key===k.ESCAPE&&(n.nativeEvent.stopImmediatePropagation(),n.stopPropagation(),e.onCloseRequest())};return(0,bI.createPortal)((0,wu.jsxs)("div",{className:G("Modal",e.className),role:"dialog","aria-modal":"true",onKeyDown:o,"aria-labelledby":e.labelledBy,"data-prevent-outside-click":!0,children:[(0,wu.jsx)("div",{className:"Modal__background",onClick:t?e.onCloseRequest:void 0}),(0,wu.jsx)("div",{className:"Modal__content",style:{"--max-width":`${e.maxWidth}px`},tabIndex:0,children:e.children})]}),r)};h();var xo=S(W(),1);h();h();h();var yI=S(EI(),1),Hr=e=>(e=e.trim(),e&&(0,yI.sanitizeUrl)(e)),lh=e=>!!(e?.includes(location.origin)||e?.startsWith("/")),ch=e=>{if(e=Hr(e),e.startsWith("/"))return`${location.origin}${e}`;try{new URL(e)}catch{return"about:blank"}return e};var jR={selection:!0,text:!0,rectangle:!0,diamond:!0,ellipse:!0,line:!0,image:!0,arrow:!0,freedraw:!0,eraser:!1,custom:!0,frame:!0,embeddable:!0,hand:!0,laser:!1,magicframe:!1},qR=e=>Object.keys(qt).includes(e)?qt[e]:pr,wI=e=>e?{...e,focus:e.focus||0}:null,Ds=(e,t)=>{let r={type:t.type||e.type,version:e.version||1,versionNonce:e.versionNonce??0,isDeleted:e.isDeleted??!1,id:e.id||tr(),fillStyle:e.fillStyle||pt.fillStyle,strokeWidth:e.strokeWidth||pt.strokeWidth,strokeStyle:e.strokeStyle??pt.strokeStyle,roughness:e.roughness??pt.roughness,opacity:e.opacity==null?pt.opacity:e.opacity,angle:e.angle||0,x:t.x??e.x??0,y:t.y??e.y??0,strokeColor:e.strokeColor||pt.strokeColor,backgroundColor:e.backgroundColor||pt.backgroundColor,width:e.width||0,height:e.height||0,seed:e.seed??1,groupIds:e.groupIds??[],frameId:e.frameId??null,roundness:e.roundness?e.roundness:e.strokeSharpness==="round"?{type:Gn(e.type)?Ct.LEGACY:Ct.PROPORTIONAL_RADIUS}:null,boundElements:e.boundElementIds?e.boundElementIds.map(o=>({type:"arrow",id:o})):e.boundElements??[],updated:e.updated??bi(),link:e.link?Hr(e.link):null,locked:e.locked??!1};return("customData"in e||"customData"in t)&&(r.customData="customData"in t?t.customData:e.customData),Jm in e&&(r[Jm]=e[Jm]),{...r,...Su(r),...t}},JR=(e,t=!1)=>{switch(e.type){case"text":let r=e.fontSize,o=e.fontFamily;if("font"in e){let[s,c]=e.font.split(" ");r=parseFloat(s),o=qR(c)}let n=typeof e.text=="string"&&e.text||"",i=e.lineHeight||(e.height?dh(e):mo(e.fontFamily)),a=J1(e.text,Ve(e),i);return e=Ds(e,{fontSize:r,fontFamily:o,text:n,textAlign:e.textAlign||oa,verticalAlign:e.verticalAlign||as,containerId:e.containerId??null,originalText:e.originalText||n,lineHeight:i,baseline:a}),!n&&!e.isDeleted&&(e={...e,originalText:n,isDeleted:!0},e=un(e)),t&&(e={...e,...Fl(e)}),e;case"freedraw":return Ds(e,{points:e.points,lastCommittedPoint:null,simulatePressure:e.simulatePressure,pressures:e.pressures});case"image":return Ds(e,{status:e.status||"pending",fileId:e.fileId,scale:e.scale||[1,1]});case"line":case"draw":case"arrow":{let{startArrowhead:s=null,endArrowhead:c=e.type==="arrow"?"arrow":null}=e,l=e.x,d=e.y,u=!Array.isArray(e.points)||e.points.length<2?[[0,0],[e.width,e.height]]:e.points;return(u[0][0]!==0||u[0][1]!==0)&&({points:u,x:l,y:d}=re.getNormalizedPoints(e)),Ds(e,{type:e.type==="draw"?"line":e.type,startBinding:wI(e.startBinding),endBinding:wI(e.endBinding),lastCommittedPoint:null,startArrowhead:s,endArrowhead:c,points:u,x:l,y:d})}case"ellipse":case"rectangle":case"diamond":case"iframe":return Ds(e,{});case"embeddable":return Ds(e,{validated:null});case"magicframe":case"frame":return Ds(e,{name:e.name??null})}return null},QR=(e,t)=>{if(e.boundElements){let r=e.boundElements.slice(),o=new Set;e.boundElements=r.reduce((n,i)=>{let a=t.get(i.id);if(a&&!o.has(i.id)){if(o.add(i.id),a.isDeleted)return n;n.push(i),ee(a)&&!a.containerId&&(a.containerId=e.id)}return n},[])}},e9=(e,t)=>{let r=e.containerId?t.get(e.containerId):null;if(!r){e.containerId=null;return}if(!e.isDeleted&&r.boundElements&&!r.boundElements.find(o=>o.id===e.id)){let o=(r.boundElements||(r.boundElements=[])).slice();o.push({type:"text",id:e.id}),r.boundElements=o}},t9=(e,t)=>{e.frameId&&(t.get(e.frameId)||(e.frameId=null))},vu=(e,t,r)=>{let o=new Set,n=t?He(t):null,i=(e||[]).reduce((s,c)=>{if(c.type!=="selection"&&!zo(c)){let l=JR(c,r?.refreshDimensions);if(l){let d=n?.get(c.id);d&&d.version>l.version&&(l=un(l,d.version)),o.has(l.id)&&(l={...l,id:tr()}),o.add(l.id),s.push(l)}}return s},[]);if(!r?.repairBindings)return i;let a=He(i);for(let s of i)s.frameId&&t9(s,a),ee(s)&&s.containerId?e9(s,a):s.boundElements&&QR(s,a);return i},r9=(e,t,r)=>{let o=t[e];return o!==void 0?o:r[e]},vI={isSidebarDocked:(e,t)=>["defaultSidebarDockedPreference",e.isSidebarDocked??r9("defaultSidebarDockedPreference",e,t)]},SI=(e,t)=>{e=e||{};let r=wr(),o={};for(let n of Object.keys(vI))if(n in e){let[i,a]=vI[n](e,r);o[i]=a}for(let[n,i]of Object.entries(r)){let a=e[n],s=t?t[n]:void 0;o[n]=a!==void 0?a:s!==void 0?s:i}return{...o,cursorButton:t?.cursorButton||"up",penDetected:t?.penDetected??(e.penMode?e.penDetected??!1:!1),activeTool:{...st(r,o.activeTool.type&&jR[o.activeTool.type]?o.activeTool:{type:"selection"}),lastActiveTool:null,locked:o.activeTool.locked??!1},zoom:typeof e.zoom=="number"?{value:e.zoom}:e.zoom?.value?e.zoom:r.zoom,openSidebar:typeof e.openSidebar=="string"?{name:Fn.name}:o.openSidebar}},Ma=(e,t,r,o)=>({elements:vu(e?.elements,r,o),appState:SI(e?.appState,t||null),files:e?.files||{}}),TI=e=>{let t=vu(we(e.elements),null);return t.length?{...e,elements:t}:null},Tu=(e=[],t)=>{let r=[];for(let o of e)if(Array.isArray(o)){let n=TI({status:t,elements:o,id:tr(),created:Date.now()});n&&r.push(n)}else{let n=o,i=TI({...n,id:n.id||tr(),status:n.status||t,created:n.created||Date.now()});i&&r.push(i)}return r};h();var uh=class extends Error{constructor(t="Couldn't export canvas.",r="CANVAS_ERROR"){super(),this.name=r,this.message=t}},Pa=class extends DOMException{constructor(t="Request Aborted"){super(t,"AbortError")}},xn=class extends Error{code;constructor(t="Image Scene Data Error",r="IMAGE_SCENE_DATA_ERROR"){super(t),this.name="EncodingError",this.code=r}};var fh=S(W(),1);h();var mh=S(W(),1);var Q1=bt(new Map),CI=async e=>await Ec({elements:e,appState:{exportBackground:!1,viewBackgroundColor:ge.white},files:null,renderEmbeddables:!1}),II=(e,t,r)=>{let[o,n]=(0,mh.useState)();return(0,mh.useEffect)(()=>{if(t)if(e){let i=r.get(e);i?n(i):(async()=>{let a=await CI(t);a.querySelector(".style-fonts")?.remove(),a&&(r.set(e,a),n(a))})()}else(async()=>{let i=await CI(t);n(i)})()},[e,t,r,n]),o},ph=()=>{let[e]=Ne(Q1,qe);return{clearLibraryCache:()=>e.clear(),deleteItemsFromLibraryCache:o=>{o.forEach(n=>e.delete(n))},svgCache:e}};var Rs=bt({status:"loaded",isInitialized:!0,libraryItems:[]}),ex=e=>Co(e),o9=(e,t)=>!e.find(r=>r.elements.length!==t.elements.length?!1:r.elements.every((o,n)=>o.id===t.elements[n].id&&o.versionNonce===t.elements[n].versionNonce)),kI=(e,t)=>{let r=[];for(let o of t)o9(e,o)&&r.push(o);return[...r,...e]},tx=class{lastLibraryItems=[];isInitialized=!1;app;constructor(t){this.app=t}updateQueue=[];getLastUpdateTask=()=>this.updateQueue[this.updateQueue.length-1];notifyListeners=()=>{if(this.updateQueue.length>0)Kr.set(Rs,{status:"loading",libraryItems:this.lastLibraryItems,isInitialized:this.isInitialized});else{this.isInitialized=!0,Kr.set(Rs,{status:"loaded",libraryItems:this.lastLibraryItems,isInitialized:this.isInitialized});try{this.app.props.onLibraryChange?.(ex(this.lastLibraryItems))}catch(t){console.error(t)}}};destroy=()=>{this.isInitialized=!1,this.updateQueue=[],this.lastLibraryItems=[],Kr.set(Q1,new Map)};resetLibrary=()=>this.setLibrary([]);getLatestLibrary=()=>new Promise(async t=>{try{let r=await(this.getLastUpdateTask()||this.lastLibraryItems);this.updateQueue.length>0?t(this.getLatestLibrary()):t(ex(r))}catch{return t(this.lastLibraryItems)}});updateLibrary=async({libraryItems:t,prompt:r=!1,merge:o=!1,openLibraryMenu:n=!1,defaultStatus:i="unpublished"})=>(n&&this.app.setState({openSidebar:{name:Fn.name,tab:Ad}}),this.setLibrary(()=>new Promise(async(a,s)=>{try{let c=await(typeof t=="function"&&!(t instanceof Blob)?t(this.lastLibraryItems):t),l;c instanceof Blob?l=await ox(c,i):l=Tu(c,i),!r||window.confirm(E("alerts.confirmAddLibrary",{numShapes:l.length}))?(r&&this.app.focusContainer(),a(o?kI(this.lastLibraryItems,l):l)):s(new Pa)}catch(c){s(c)}})));setLibrary=t=>{let r=new Promise(async(o,n)=>{try{await this.getLastUpdateTask(),typeof t=="function"&&(t=t(this.lastLibraryItems)),this.lastLibraryItems=ex(await t),o(this.lastLibraryItems)}catch(i){n(i)}}).catch(o=>{if(o.name==="AbortError")return console.warn("Library update aborted by user"),this.lastLibraryItems;throw o}).finally(()=>{this.updateQueue=this.updateQueue.filter(o=>o!==r),this.notifyListeners()});return this.updateQueue.push(r),this.notifyListeners(),r}},_I=tx,hh=e=>{let r=Math.ceil(Math.sqrt(e.length)),o=[],n=p=>e.slice(p*r,p*r+r).reduce((g,x)=>{let{height:y}=to(x.elements);return Math.max(g,y)},0),i=p=>{let f=0,g=0,x=0;for(let y of e){if(f%r===0&&(g=0),g===p){let{width:w}=to(y.elements);x=Math.max(x,w)}f++,g++}return x},a=0,s=0,c=0,l=0,d=0,u=0,m=0;for(let p of e){d&&d%r===0&&(s+=c+50,a=0,u=0,m++),u===0&&(c=n(m)),l=i(u);let{minX:f,minY:g,width:x,height:y}=to(p.elements),w=(l-x)/2,T=(c-y)/2;o.push(...p.elements.map(C=>({...C,x:C.x+a+w-f,y:C.y+s+T-g}))),a+=l+50,d++,u++}return o},rx=()=>{let e=new URLSearchParams(window.location.hash.slice(1)).get(jm.addLibrary)||new URLSearchParams(window.location.search).get(Xm.addLibrary),t=e?new URLSearchParams(window.location.hash.slice(1)).get("token"):null;return e?{libraryUrl:e,idToken:t}:null},n9=({excalidrawAPI:e,getInitialLibraryItems:t})=>{let r=(0,fh.useRef)(t);(0,fh.useEffect)(()=>{if(!e)return;let o=async({libraryUrl:a,idToken:s})=>{let c=new Promise(async(d,u)=>{try{let p=await(await fetch(decodeURIComponent(a))).blob();d(p)}catch(m){u(m)}}),l=s!==e.id;await(l&&document.hidden?new Promise(d=>{window.addEventListener("focus",()=>d(),{once:!0})}):null);try{await e.updateLibrary({libraryItems:c,prompt:l,merge:!0,defaultStatus:"published",openLibraryMenu:!0})}catch(d){throw d}finally{if(window.location.hash.includes(jm.addLibrary)){let d=new URLSearchParams(window.location.hash.slice(1));d.delete(jm.addLibrary),window.history.replaceState({},Cd,`#${d.toString()}`)}else if(window.location.search.includes(Xm.addLibrary)){let d=new URLSearchParams(window.location.search);d.delete(Xm.addLibrary),window.history.replaceState({},Cd,`?${d.toString()}`)}}},n=a=>{a.preventDefault();let s=rx();s&&(a.stopImmediatePropagation(),window.history.replaceState({},"",a.oldURL),o(s))};r.current&&e.updateLibrary({libraryItems:r.current()});let i=rx();return i&&o(i),window.addEventListener("hashchange",n),()=>{window.removeEventListener("hashchange",n)}},[e])};h();var Ir=S(W(),1);h();h();h();var Go=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{}catch{return!1}else if("showOpenFilePicker"in self)return"showOpenFilePicker";return!1})(),i9=Go?import("./file-open-002ab408-MILJ6BM2.js"):import("./file-open-7c801643-BHFKUUBS.js");async function AI(...e){return(await i9).default(...e)}var Dre=Go?import("./directory-open-4ed118d0-57WBH3LL.js"):import("./directory-open-01563666-OLGZGYEQ.js");var a9=Go?import("./file-save-745eba88-CGSHK46Y.js"):import("./file-save-3189631c-IHOU4DOS.js");async function MI(...e){return(await a9).default(...e)}var PI=500,yc=e=>{let t=e.extensions?.reduce((o,n)=>(o.push(ae[n]),o),[]),r=e.extensions?.reduce((o,n)=>n==="jpg"?o.concat(".jpg",".jpeg"):o.concat(`.${n}`),[]);return AI({description:e.description,extensions:r,mimeTypes:t,multiple:e.multiple??!1,legacySetup:(o,n,i)=>{let a=cs(n,PI),s=()=>{c(),document.addEventListener("keyup",a),document.addEventListener("pointerup",a),a()},c=()=>{if(i.files?.length){let d=e.multiple?[...i.files]:i.files[0];o(d)}};requestAnimationFrame(()=>{window.addEventListener("focus",s)});let l=window.setInterval(()=>{c()},PI);return d=>{clearInterval(l),a.cancel(),window.removeEventListener("focus",s),document.removeEventListener("keyup",a),document.removeEventListener("pointerup",a),d&&(console.warn("Opening the file was canceled (legacy-fs)."),d(new Pa))}}})},wc=(e,t)=>MI(e,{fileName:`${t.name}.${t.extension}`,description:t.description,extensions:[`.${t.extension}`]},t.fileHandle);var s9=(e,t)=>{let r={};for(let o of e)!o.isDeleted&&"fileId"in o&&o.fileId&&t[o.fileId]&&(r[o.fileId]=t[o.fileId]);return r},La=(e,t,r,o)=>{let n={type:yr.excalidraw,version:ls.excalidraw,source:_d,elements:o==="local"?xh(e):RI(e),appState:o==="local"?xp(t):$2(t),files:o==="local"?s9(e,r):void 0};return JSON.stringify(n,null,2)},gh=async(e,t,r)=>{let o=La(e,t,r,"local"),n=new Blob([o],{type:ae.excalidraw});return{fileHandle:await wc(n,{name:t.name,extension:"excalidraw",description:"Excalidraw file",fileHandle:vc(t.fileHandle)?null:t.fileHandle})}},nx=async(e,t)=>{let r=await yc({description:"Excalidraw files"});return Tc(await Cu(r),e,t,r.handle)},LI=e=>e?.type===yr.excalidraw&&(!e.elements||Array.isArray(e.elements)&&(!e.appState||typeof e.appState=="object")),ix=e=>typeof e=="object"&&e&&e.type===yr.excalidrawLibrary&&(e.version===1||e.version===2),bh=e=>{let t={type:yr.excalidrawLibrary,version:ls.excalidrawLibrary,source:_d,libraryItems:e};return JSON.stringify(t,null,2)},DI=async e=>{let t=bh(e);await wc(new Blob([t],{type:ae.excalidrawlib}),{name:"library",extension:"excalidrawlib",description:"Excalidraw library file"})};h();h();var NI=S(_(),1),l9=({theme:e,id:t,libraryReturnUrl:r})=>{let o=r||window.location.origin+window.location.pathname;return(0,NI.jsx)("a",{className:"library-menu-browse-button",href:`${v.VITE_APP_LIBRARY_URL}?target=${window.name||"_blank"}&referrer=${o}&useHash=true&token=${t}&theme=${e}&version=${ls.excalidrawLibrary}`,target:"_excalidraw_libraries",children:E("labels.libraries")})},OI=l9;var yh=S(_(),1),Eh=({libraryReturnUrl:e,theme:t,id:r,style:o,children:n,className:i})=>(0,yh.jsxs)("div",{className:G("library-menu-control-buttons",i),style:o,children:[(0,yh.jsx)(OI,{id:r,libraryReturnUrl:e,theme:t}),n]});h();var Cc=S(W(),1);h();var Iu=S(W(),1);var c9=/({{[\w-]+}})|(<[\w-]+>)|(<\/[\w-]+>)/g,d9=/{{([\w-]+)}}/,u9=/<([\w-]+)>/,m9=/<\/([\w-]+)>/,p9=(e,t)=>{let r=[{name:"",children:[]}];return e.split(c9).filter(Boolean).forEach(o=>{let n=o.match(u9),i=o.match(m9),a=o.match(d9);if(n!==null){let s=n[1];t.hasOwnProperty(s)?r.push({name:s,children:[]}):console.warn(`Trans: missed to pass in prop ${s} for interpolating ${e}`)}else if(i!==null)if(i[1]===r[r.length-1].name){let c=r.pop(),l=Iu.default.createElement(Iu.default.Fragment,{},...c.children),d=t[c.name];typeof d=="function"&&r[r.length-1].children.push(d(l))}else console.warn(`Trans: unexpected end tag ${o} for interpolating ${e}`);else if(a!==null){let s=a[1];t.hasOwnProperty(s)?r[r.length-1].children.push(t[s]):console.warn(`Trans: key ${s} not in props for interpolating ${e}`)}else r[r.length-1].children.push(o)}),r.length!==1&&console.warn(`Trans: stack not empty for interpolating ${e}`),r[0].children},f9=({i18nKey:e,children:t,...r})=>{let{t:o}=or();return Iu.default.createElement(Iu.default.Fragment,{},...p9(o(e),r))},$r=f9;h();var bo=S(W(),1);h();var Os=S(_(),1),h9=({label:e,onClick:t,className:r,children:o,actionType:n,type:i="button",isLoading:a,...s})=>{let c=n?`Dialog__action-button--${n}`:"";return(0,Os.jsxs)("button",{className:G("Dialog__action-button",c,r),type:i,"aria-label":e,onClick:t,...s,children:[o&&(0,Os.jsx)("div",{style:a?{visibility:"hidden"}:{},children:o}),(0,Os.jsx)("div",{style:a?{visibility:"hidden"}:{},children:e}),a&&(0,Os.jsx)("div",{style:{position:"absolute",inset:0},children:(0,Os.jsx)(zr,{})})]})},Sc=h9;h();var ro=class{static has(t){try{return!!window.localStorage.getItem(t)}catch(r){return console.warn(`localStorage.getItem error: ${r.message}`),!1}}static get(t){try{let r=window.localStorage.getItem(t);return r?JSON.parse(r):null}catch(r){return console.warn(`localStorage.getItem error: ${r.message}`),null}}static set=(t,r)=>{try{return window.localStorage.setItem(t,JSON.stringify(r)),!0}catch(o){return console.warn(`localStorage.setItem error: ${o.message}`),!1}};static delete=t=>{try{window.localStorage.removeItem(t)}catch(r){console.warn(`localStorage.removeItem error: ${r.message}`)}}};var pe=S(_(),1),g9=async e=>{let o=Math.round(8),n=Math.max(Math.round(128/64),2),i=D2(e,6),a=document.createElement("canvas");a.width=i[0].length*128+(i[0].length+1)*(o*2)-o*2,a.height=i.length*128+(i.length+1)*(o*2)-o*2;let s=a.getContext("2d");s.fillStyle=rt.white,s.fillRect(0,0,a.width,a.height);for(let[c,l]of e.entries()){let d=await Da({elements:l.elements,files:null,maxWidthOrHeight:128}),{width:u,height:m}=d,p=Math.floor(c/6)*(128+o*2),f=c%6*(128+o*2);s.drawImage(d,f+(128-u)/2+o,p+(128-m)/2+o),s.lineWidth=n,s.strokeStyle=rt.gray[4],s.strokeRect(f+o/2,p+o/2,128+o,128+o)}return await ku(new File([await Oi(a)],"preview",{type:ae.png}),{outputType:ae.jpg,maxWidthOrHeight:5e3})},b9=({libItem:e,appState:t,index:r,onChange:o,onRemove:n})=>{let i=(0,bo.useRef)(null),a=(0,bo.useRef)(null);return(0,bo.useEffect)(()=>{let s=i.current;s&&(async()=>{let c=await Ec({elements:e.elements,appState:{...t,viewBackgroundColor:rt.white,exportBackground:!0},files:null});s.innerHTML=c.outerHTML})()},[e.elements,t]),(0,pe.jsxs)("div",{className:"single-library-item",children:[e.status==="published"&&(0,pe.jsx)("span",{className:"single-library-item-status",children:E("labels.statusPublished")}),(0,pe.jsx)("div",{ref:i,className:"single-library-item__svg"}),(0,pe.jsx)(be,{"aria-label":E("buttons.remove"),type:"button",icon:Oo,className:"single-library-item--remove",onClick:n.bind(null,e.id),title:E("buttons.remove")}),(0,pe.jsxs)("div",{style:{display:"flex",margin:"0.8rem 0",width:"100%",fontSize:"14px",fontWeight:500,flexDirection:"column"},children:[(0,pe.jsxs)("label",{style:{display:"flex",justifyContent:"space-between",flexDirection:"column"},children:[(0,pe.jsxs)("div",{style:{padding:"0.5em 0"},children:[(0,pe.jsx)("span",{style:{fontWeight:500,color:rt.gray[6]},children:E("publishDialog.itemName")}),(0,pe.jsx)("span",{"aria-hidden":"true",className:"required",children:"*"})]}),(0,pe.jsx)("input",{type:"text",ref:a,style:{width:"80%",padding:"0.2rem"},defaultValue:e.name,placeholder:"Item name",onChange:s=>{o(s.target.value,r)}})]}),(0,pe.jsx)("span",{className:"error",children:e.error})]})]})},x9=({onClose:e,libraryItems:t,appState:r,onSuccess:o,onError:n,updateItemsInStorage:i,onRemove:a})=>{let[s,c]=(0,bo.useState)({authorName:"",githubHandle:"",name:"",description:"",twitterHandle:"",website:""}),[l,d]=(0,bo.useState)(!1);(0,bo.useEffect)(()=>{let T=ro.get(So.PUBLISH_LIBRARY);T&&c(T)},[]);let[u,m]=(0,bo.useState)(t.slice());(0,bo.useEffect)(()=>{m(t.slice())},[t]);let p=T=>{c({...s,[T.target.name]:T.target.value})},f=async T=>{T.preventDefault(),d(!0);let C=[],I=!1;if(u.forEach(R=>{let N="";R.name||(N=E("publishDialog.errors.required"),I=!0),C.push({...R,error:N})}),I){m(C),d(!1);return}let A=await g9(u),P={type:yr.excalidrawLibrary,version:ls.excalidrawLibrary,source:_d,libraryItems:u},L=JSON.stringify(P,null,2),D=new Blob([L],{type:"application/json"}),M=new FormData;M.append("excalidrawLib",D),M.append("previewImage",A),M.append("previewImageType",A.type),M.append("title",s.name),M.append("authorName",s.authorName),M.append("githubHandle",s.githubHandle),M.append("name",s.name),M.append("description",s.description),M.append("twitterHandle",s.twitterHandle),M.append("website",s.website),fetch(`${v.VITE_APP_LIBRARY_BACKEND}/submit`,{method:"post",body:M}).then(R=>R.ok?R.json().then(({url:N})=>{ro.delete(So.PUBLISH_LIBRARY),o({url:N,authorName:s.authorName,items:u})}):R.json().catch(()=>{throw new Error(R.statusText||"something went wrong")}).then(N=>{throw new Error(N.message||R.statusText||"something went wrong")}),R=>{console.error(R),n(R),d(!1)}).catch(R=>{console.error(R),n(R),d(!1)})},g=()=>{let T=[];return u.forEach((C,I)=>{T.push((0,pe.jsx)("div",{className:"single-library-item-wrapper",children:(0,pe.jsx)(b9,{libItem:C,appState:r,index:I,onChange:(A,P)=>{let L=u.slice();L[P].name=A,m(L)},onRemove:a})},I))}),(0,pe.jsx)("div",{className:"selected-library-items",children:T})},x=(0,bo.useCallback)(()=>{i(u),ro.set(So.PUBLISH_LIBRARY,s),e()},[u,e,i,s]),y=!!t.length,w=t.some(T=>T.status==="published");return(0,pe.jsx)(Dt,{onCloseRequest:x,title:E("publishDialog.title"),className:"publish-library",children:y?(0,pe.jsxs)("form",{onSubmit:f,children:[(0,pe.jsx)("div",{className:"publish-library-note",children:(0,pe.jsx)($r,{i18nKey:"publishDialog.noteDescription",link:T=>(0,pe.jsx)("a",{href:"https://libraries.excalidraw.com",target:"_blank",rel:"noopener noreferrer",children:T})})}),(0,pe.jsx)("span",{className:"publish-library-note",children:(0,pe.jsx)($r,{i18nKey:"publishDialog.noteGuidelines",link:T=>(0,pe.jsx)("a",{href:"https://github.com/excalidraw/excalidraw-libraries#guidelines",target:"_blank",rel:"noopener noreferrer",children:T})})}),(0,pe.jsx)("div",{className:"publish-library-note",children:E("publishDialog.noteItems")}),w&&(0,pe.jsx)("span",{className:"publish-library-note publish-library-warning",children:E("publishDialog.republishWarning")}),g(),(0,pe.jsxs)("div",{className:"publish-library__fields",children:[(0,pe.jsxs)("label",{children:[(0,pe.jsxs)("div",{children:[(0,pe.jsx)("span",{children:E("publishDialog.libraryName")}),(0,pe.jsx)("span",{"aria-hidden":"true",className:"required",children:"*"})]}),(0,pe.jsx)("input",{type:"text",name:"name",required:!0,value:s.name,onChange:p,placeholder:E("publishDialog.placeholder.libraryName")})]}),(0,pe.jsxs)("label",{style:{alignItems:"flex-start"},children:[(0,pe.jsxs)("div",{children:[(0,pe.jsx)("span",{children:E("publishDialog.libraryDesc")}),(0,pe.jsx)("span",{"aria-hidden":"true",className:"required",children:"*"})]}),(0,pe.jsx)("textarea",{name:"description",rows:4,required:!0,value:s.description,onChange:p,placeholder:E("publishDialog.placeholder.libraryDesc")})]}),(0,pe.jsxs)("label",{children:[(0,pe.jsxs)("div",{children:[(0,pe.jsx)("span",{children:E("publishDialog.authorName")}),(0,pe.jsx)("span",{"aria-hidden":"true",className:"required",children:"*"})]}),(0,pe.jsx)("input",{type:"text",name:"authorName",required:!0,value:s.authorName,onChange:p,placeholder:E("publishDialog.placeholder.authorName")})]}),(0,pe.jsxs)("label",{children:[(0,pe.jsx)("span",{children:E("publishDialog.githubUsername")}),(0,pe.jsx)("input",{type:"text",name:"githubHandle",value:s.githubHandle,onChange:p,placeholder:E("publishDialog.placeholder.githubHandle")})]}),(0,pe.jsxs)("label",{children:[(0,pe.jsx)("span",{children:E("publishDialog.twitterUsername")}),(0,pe.jsx)("input",{type:"text",name:"twitterHandle",value:s.twitterHandle,onChange:p,placeholder:E("publishDialog.placeholder.twitterHandle")})]}),(0,pe.jsxs)("label",{children:[(0,pe.jsx)("span",{children:E("publishDialog.website")}),(0,pe.jsx)("input",{type:"text",name:"website",pattern:"https?://.+",title:E("publishDialog.errors.website"),value:s.website,onChange:p,placeholder:E("publishDialog.placeholder.website")})]}),(0,pe.jsx)("span",{className:"publish-library-note",children:(0,pe.jsx)($r,{i18nKey:"publishDialog.noteLicense",link:T=>(0,pe.jsx)("a",{href:"https://github.com/excalidraw/excalidraw-libraries/blob/main/LICENSE",target:"_blank",rel:"noopener noreferrer",children:T})})})]}),(0,pe.jsxs)("div",{className:"publish-library__buttons",children:[(0,pe.jsx)(Sc,{label:E("buttons.cancel"),onClick:x,"data-testid":"cancel-clear-canvas-button"}),(0,pe.jsx)(Sc,{type:"submit",label:E("buttons.submit"),actionType:"primary",isLoading:l})]})]}):(0,pe.jsx)("p",{style:{padding:"1em",textAlign:"center",fontWeight:500},children:E("publishDialog.atleastOneLibItem")})})},FI=x9;var Vt=S(_(),1),E9=(e,t)=>e.filter(r=>t.includes(r.id)),y9=({setAppState:e,selectedItems:t,library:r,onRemoveFromLibrary:o,resetLibrary:n,onSelectItems:i,appState:a,className:s})=>{let[c]=Ne(Rs,qe),[l,d]=Ne(Ic,qe),u=()=>{let M=t.length?E("alerts.removeItemsFromsLibrary",{count:t.length}):E("alerts.resetLibrary"),R=t.length?E("confirmDialog.removeItemsFromLib"):E("confirmDialog.resetLibrary");return(0,Vt.jsx)(wh,{onConfirm:()=>{t.length?o():n(),p(!1)},onCancel:()=>{p(!1)},title:R,children:(0,Vt.jsx)("p",{children:M})})},[m,p]=(0,Cc.useState)(!1),f=!!t.length,g=f?c.libraryItems.filter(M=>t.includes(M.id)):c.libraryItems,x=f?E("buttons.remove"):E("buttons.resetLibrary"),[y,w]=(0,Cc.useState)(!1),[T,C]=(0,Cc.useState)(null),I=(0,Cc.useCallback)(()=>(0,Vt.jsxs)(Dt,{onCloseRequest:()=>C(null),title:E("publishSuccessDialog.title"),className:"publish-library-success",size:"small",children:[(0,Vt.jsx)("p",{children:(0,Vt.jsx)($r,{i18nKey:"publishSuccessDialog.content",authorName:T.authorName,link:M=>(0,Vt.jsx)("a",{href:T?.url,target:"_blank",rel:"noopener noreferrer",children:M})})}),(0,Vt.jsx)(be,{type:"button",title:E("buttons.close"),"aria-label":E("buttons.close"),label:E("buttons.close"),onClick:()=>C(null),"data-testid":"publish-library-success-close",className:"publish-library-success-close"})]}),[C,T]),A=(M,R)=>{w(!1),C({url:M.url,authorName:M.authorName});let N=R.slice();N.forEach(B=>{t.includes(B.id)&&(B.status="published")}),r.setLibrary(N)},P=async()=>{try{await r.updateLibrary({libraryItems:yc({description:"Excalidraw library files"}),merge:!0,openLibraryMenu:!0})}catch(M){if(M?.name==="AbortError"){console.warn(M);return}e({errorMessage:E("errors.importLibraryError")})}},L=async()=>{let M=f?g:await r.getLatestLibrary();DI(M).catch(mp).catch(R=>{e({errorMessage:R.message})})},D=()=>(0,Vt.jsxs)(je,{open:l,children:[(0,Vt.jsx)(je.Trigger,{onToggle:()=>d(!l),children:Q3}),(0,Vt.jsxs)(je.Content,{onClickOutside:()=>d(!1),onSelect:()=>d(!1),className:"library-menu",children:[!f&&(0,Vt.jsx)(je.Item,{onSelect:P,icon:Ul,"data-testid":"lib-dropdown--load",children:E("buttons.load")}),!!g.length&&(0,Vt.jsx)(je.Item,{onSelect:L,icon:ef,"data-testid":"lib-dropdown--export",children:E("buttons.export")}),!!g.length&&(0,Vt.jsx)(je.Item,{onSelect:()=>p(!0),icon:ba,children:x}),f&&(0,Vt.jsx)(je.Item,{icon:AS,onSelect:()=>w(!0),"data-testid":"lib-dropdown--remove",children:E("buttons.publishLibrary")})]})]});return(0,Vt.jsxs)("div",{className:G("library-menu-dropdown-container",s),children:[D(),t.length>0&&(0,Vt.jsx)("div",{className:"library-actions-counter",children:t.length}),m&&u(),y&&(0,Vt.jsx)(FI,{onClose:()=>w(!1),libraryItems:E9(c.libraryItems,t),appState:a,onSuccess:M=>A(M,c.libraryItems),onError:M=>window.alert(M),updateItemsInStorage:()=>r.setLibrary(c.libraryItems),onRemove:M=>i(t.filter(R=>R!==M))}),T&&I()]})},ax=({selectedItems:e,onSelectItems:t,className:r})=>{let{library:o}=Bo(),{clearLibraryCache:n,deleteItemsFromLibraryCache:i}=ph(),a=et(),s=at(),[c]=Ne(Rs,qe),l=async u=>{let m=u.filter(p=>!e.includes(p.id));o.setLibrary(m).catch(()=>{s({errorMessage:E("alerts.errorRemovingFromLibrary")})}),i(e),t([])};return(0,Vt.jsx)(y9,{appState:a,setAppState:s,selectedItems:e,onSelectItems:t,library:o,onRemoveFromLibrary:()=>l(c.libraryItems),resetLibrary:()=>{o.resetLibrary(),n()},className:r})};h();var kc=S(W(),1);h();var Ra=S(W(),1);h();var _u=S(_(),1),Ns=({children:e,checked:t,onChange:r,className:o})=>(0,_u.jsxs)("div",{className:G("Checkbox",o,{"is-checked":t}),onClick:n=>{r(!t,n),n.currentTarget.querySelector(".Checkbox-box").focus()},children:[(0,_u.jsx)("button",{className:"Checkbox-box",role:"checkbox","aria-checked":t,children:CT}),(0,_u.jsx)("div",{className:"Checkbox-label",children:e})]});var Fs=S(_(),1),BI=(0,Ra.memo)(({id:e,elements:t,isPending:r,onClick:o,selected:n,onToggle:i,onDrag:a,svgCache:s})=>{let c=(0,Ra.useRef)(null),l=II(e,t,s);(0,Ra.useEffect)(()=>{let f=c.current;if(f)return l&&(f.innerHTML=l.outerHTML),()=>{f.innerHTML=""}},[l]);let[d,u]=(0,Ra.useState)(!1),m=Ke().editor.isMobile,p=r&&(0,Fs.jsx)("div",{className:"library-unit__adder",children:J3});return(0,Fs.jsxs)("div",{className:G("library-unit",{"library-unit__active":t,"library-unit--hover":t&&d,"library-unit--selected":n,"library-unit--skeleton":!l}),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[(0,Fs.jsx)("div",{className:G("library-unit__dragger",{"library-unit__pulse":!!r}),ref:c,draggable:!!t,onClick:t||r?f=>{e&&f.shiftKey?i(e,f):o(e)}:void 0,onDragStart:f=>{if(!e){f.preventDefault();return}u(!1),a(e,f)}}),p,e&&t&&(d||m||n)&&(0,Fs.jsx)(Ns,{checked:n,onChange:(f,g)=>i(e,g),className:"library-unit__checkbox"})]})}),zI=()=>(0,Fs.jsx)("div",{className:"library-unit library-unit--skeleton"});h();var vh=S(W(),1);function w9(){return[!1,(0,vh.useCallback)(t=>t(),[])]}var HI=vh.default.useTransition||w9;var Bs=S(_(),1),sx=({children:e})=>(0,Bs.jsx)("div",{className:"library-menu-items-container__grid",children:e}),Th=(0,kc.memo)(({items:e,onItemSelectToggle:t,onItemDrag:r,isItemSelected:o,onClick:n,svgCache:i,itemsRenderedPerBatch:a})=>{let[,s]=HI(),[c,l]=(0,kc.useState)(0);return(0,kc.useEffect)(()=>{c<e.length&&s(()=>{l(c+a)})},[c,e.length,s,a]),(0,Bs.jsx)(Bs.Fragment,{children:e.map((d,u)=>u<c?(0,Bs.jsx)(BI,{elements:d?.elements,isPending:!d?.id&&!!d?.elements,onClick:n,svgCache:i,id:d?.id,selected:o(d.id),onToggle:t,onDrag:r},d?.id??u):(0,Bs.jsx)(zI,{},u))})});h();var VI=S(W(),1);var YI=S(cx(),1),z9=bt(0),KI=e=>{let[t,r]=Ne(z9);return(0,VI.useEffect)(()=>{let{current:o}=e;if(!o)return;let n=(0,YI.default)(()=>{let{scrollTop:i}=o;r(i)},200);return o.addEventListener("scroll",n),()=>{n.cancel(),o.removeEventListener("scroll",n)}},[e,r]),t};var vt=S(_(),1),H9=17,$9=64;function dx({isLoading:e,libraryItems:t,onAddToLibrary:r,onInsertLibraryItems:o,pendingElements:n,theme:i,id:a,libraryReturnUrl:s,onSelectItems:c,selectedItems:l}){let d=(0,Ir.useRef)(null),u=KI(d);(0,Ir.useEffect)(()=>{u>0&&d.current?.scrollTo(0,u)},[]);let{svgCache:m}=ph(),p=(0,Ir.useMemo)(()=>t.filter(M=>M.status!=="published"),[t]),f=(0,Ir.useMemo)(()=>t.filter(M=>M.status==="published"),[t]),g=!t.length&&!n.length,x=!n.length&&!p.length&&!f.length,[y,w]=(0,Ir.useState)(null),T=(0,Ir.useCallback)((M,R)=>{let N=!l.includes(M),B=[...p,...f];if(N){if(R.shiftKey&&y){let K=B.findIndex(X=>X.id===y),V=B.findIndex(X=>X.id===M);if(K===-1||V===-1){c([...l,M]);return}let ne=He(l),Q=B.reduce((X,se,O)=>((O>=K&&O<=V||ne.has(se.id))&&X.push(se.id),X),[]);c(Q)}else c([...l,M]);w(M)}else w(null),c(l.filter(K=>K!==M))},[y,c,f,l,p]),C=(0,Ir.useCallback)(M=>{let R;return l.includes(M)?R=t.filter(N=>l.includes(N.id)):R=t.filter(N=>N.id===M),R.map(N=>({...N,elements:Kp(N.elements,{randomizeSeed:!0})}))},[t,l]),I=(0,Ir.useCallback)((M,R)=>{R.dataTransfer.setData(ae.excalidrawlib,bh(C(M)))},[C]),A=(0,Ir.useCallback)(M=>M?l.includes(M):!1,[l]),P=(0,Ir.useCallback)(()=>{r(n)},[n,r]),L=(0,Ir.useCallback)(M=>{M&&o(C(M))},[C,o]),D=m.size>=t.length?$9:H9;return(0,vt.jsxs)("div",{className:"library-menu-items-container",style:n.length||p.length||f.length?{justifyContent:"flex-start"}:{borderBottom:0},children:[!x&&(0,vt.jsx)(ax,{selectedItems:l,onSelectItems:c,className:"library-menu-dropdown-container--in-heading"}),(0,vt.jsxs)(lr.Col,{className:"library-menu-items-container__items",align:"start",gap:1,style:{flex:f.length>0?1:"0 1 auto",marginBottom:0},ref:d,children:[(0,vt.jsxs)(vt.Fragment,{children:[!x&&(0,vt.jsx)("div",{className:"library-menu-items-container__header",children:E("labels.personalLib")}),e&&(0,vt.jsx)("div",{style:{position:"absolute",top:"var(--container-padding-y)",right:"var(--container-padding-x)",transform:"translateY(50%)"},children:(0,vt.jsx)(zr,{})}),!n.length&&!p.length?(0,vt.jsxs)("div",{className:"library-menu-items__no-items",children:[(0,vt.jsx)("div",{className:"library-menu-items__no-items__label",children:E("library.noItems")}),(0,vt.jsx)("div",{className:"library-menu-items__no-items__hint",children:f.length>0?E("library.hint_emptyPrivateLibrary"):E("library.hint_emptyLibrary")})]}):(0,vt.jsxs)(sx,{children:[n.length>0&&(0,vt.jsx)(Th,{itemsRenderedPerBatch:D,items:[{id:null,elements:n}],onItemSelectToggle:T,onItemDrag:I,onClick:P,isItemSelected:A,svgCache:m}),(0,vt.jsx)(Th,{itemsRenderedPerBatch:D,items:p,onItemSelectToggle:T,onItemDrag:I,onClick:L,isItemSelected:A,svgCache:m})]})]}),(0,vt.jsxs)(vt.Fragment,{children:[(f.length>0||n.length>0||p.length>0)&&(0,vt.jsx)("div",{className:"library-menu-items-container__header library-menu-items-container__header--excal",children:E("labels.excalidrawLib")}),f.length>0?(0,vt.jsx)(sx,{children:(0,vt.jsx)(Th,{itemsRenderedPerBatch:D,items:f,onItemSelectToggle:T,onItemDrag:I,onClick:L,isItemSelected:A,svgCache:m})}):p.length>0?(0,vt.jsx)("div",{style:{margin:"1rem 0",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",fontSize:".9rem"},children:E("library.noItems")}):null]}),g&&(0,vt.jsx)(Eh,{style:{padding:"16px 0",width:"100%"},id:a,libraryReturnUrl:s,theme:i,children:(0,vt.jsx)(ax,{selectedItems:l,onSelectItems:c})})]})]})}var Uo=S(_(),1),Ic=bt(!1),ZI=({children:e})=>(0,Uo.jsx)("div",{className:"layer-ui__library",children:e}),G9=({onInsertLibraryItems:e,pendingElements:t,onAddToLibrary:r,setAppState:o,libraryReturnUrl:n,library:i,id:a,theme:s,selectedItems:c,onSelectItems:l})=>{let[d]=Ne(Rs,qe),u=(0,xo.useCallback)(f=>{(async(x,y)=>{Ae("element","addToLibrary","ui");for(let T of ep)if(x.some(C=>C.type===T))return o({errorMessage:E(`errors.libraryElementTypeError.${T}`)});let w=[{status:"unpublished",elements:x,id:tr(),created:Date.now()},...y];r(),i.setLibrary(w).catch(()=>{o({errorMessage:E("alerts.errorAddingToLibrary")})})})(f,d.libraryItems)},[r,i,o,d.libraryItems]),m=(0,xo.useMemo)(()=>d.libraryItems,[d]);if(d.status==="loading"&&!d.isInitialized)return(0,Uo.jsx)(ZI,{children:(0,Uo.jsx)("div",{className:"layer-ui__library-message",children:(0,Uo.jsxs)("div",{children:[(0,Uo.jsx)(zr,{size:"2em"}),(0,Uo.jsx)("span",{children:E("labels.libraryLoadingMessage")})]})})});let p=d.libraryItems.length>0||t.length>0;return(0,Uo.jsxs)(ZI,{children:[(0,Uo.jsx)(dx,{isLoading:d.status==="loading",libraryItems:m,onAddToLibrary:u,onInsertLibraryItems:e,pendingElements:t,id:a,libraryReturnUrl:n,theme:s,onSelectItems:l,selectedItems:c}),p&&(0,Uo.jsx)(Eh,{className:"library-menu-control-buttons--at-bottom",style:{padding:"16px 12px 0 12px"},id:a,libraryReturnUrl:n,theme:s})]})},U9=(e,t)=>{let r=()=>Se(t,e,{includeBoundTextElement:!0,includeElementsInFrames:!0}),o=(0,xo.useRef)(r()),n=(0,xo.useRef)(e),i=(0,xo.useRef)(t);return(!$t(e.selectedElementIds,n.current.selectedElementIds)||!$t(t,i.current))&&(o.current=r(),n.current=e,i.current=t),o.current},XI=()=>{let{library:e,id:t,onInsertElements:r}=Bo(),o=Oa(),n=et(),i=at(),a=Ca(),[s,c]=(0,xo.useState)([]),l=(0,xo.useMemo)(()=>e,[e]),d=U9(n,a),u=(0,xo.useCallback)(p=>{r(hh(p))},[r]),m=(0,xo.useCallback)(()=>{i({selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null})},[i]);return(0,Uo.jsx)(G9,{pendingElements:d,onInsertLibraryItems:u,onAddToLibrary:m,setAppState:i,libraryReturnUrl:o.libraryReturnUrl,library:l,id:t,theme:n.theme,selectedItems:s,onSelectItems:c})};var Na=S(_(),1);function W9(e){if(e&&typeof e=="number")return e;switch(e){case"small":return 550;case"wide":return 1024;case"regular":default:return 800}}var Dt=e=>{let[t,r]=gI(),[o]=(0,Ch.useState)(document.activeElement),{id:n}=ar(),i=Ke().viewport.isMobile;(0,Ch.useEffect)(()=>{if(!t)return;let l=Od(t);l.length>0&&e.autofocus!==!1&&(l[1]||l[0]).focus();let d=u=>{if(u.key===k.TAB){let m=Od(t),{activeElement:p}=document,f=m.findIndex(g=>g===p);f===0&&u.shiftKey?(m[m.length-1].focus(),u.preventDefault()):f===m.length-1&&!u.shiftKey&&(m[0].focus(),u.preventDefault())}};return t.addEventListener("keydown",d),()=>t.removeEventListener("keydown",d)},[t,e.autofocus]);let a=at(),s=hi(Ic,qe),c=()=>{a({openMenu:null}),s(!1),o.focus(),e.onCloseRequest()};return(0,Na.jsx)(xI,{className:G("Dialog",e.className,{"Dialog--fullscreen":i}),labelledBy:"dialog-title",maxWidth:W9(e.size),onCloseRequest:c,closeOnClickOutside:e.closeOnClickOutside,children:(0,Na.jsxs)(xr,{ref:r,children:[e.title&&(0,Na.jsx)("h2",{id:`${n}-dialog-title`,className:"Dialog__title",children:(0,Na.jsx)("span",{className:"Dialog__titleContent",children:e.title})}),(0,Na.jsx)("button",{className:"Dialog__close",onClick:c,title:E("buttons.close"),"aria-label":E("buttons.close"),children:i?KT:Oo}),(0,Na.jsx)("div",{className:"Dialog__content",children:e.children})]})})};var _c=S(_(),1),V9=e=>{let{onConfirm:t,onCancel:r,children:o,confirmText:n=E("buttons.confirm"),cancelText:i=E("buttons.cancel"),className:a="",...s}=e,c=at(),l=hi(Ic,qe),{container:d}=ar();return(0,_c.jsxs)(Dt,{onCloseRequest:r,size:"small",...s,className:`confirm-dialog ${a}`,children:[o,(0,_c.jsxs)("div",{className:"confirm-dialog-buttons",children:[(0,_c.jsx)(Sc,{label:i,onClick:()=>{c({openMenu:null}),l(!1),r(),d?.focus()}}),(0,_c.jsx)(Sc,{label:n,onClick:()=>{c({openMenu:null}),l(!1),t(),d?.focus()},actionType:"danger"})]})]})},wh=V9;var Ih=S(_(),1),Au=bt(null),jI=()=>{let[e,t]=Ne(Au,qe),r=Er();return e&&e==="clearCanvas"?(0,Ih.jsx)(wh,{onConfirm:()=>{r.executeAction(fu),t(null)},onCancel:()=>t(null),title:E("clearCanvasDialog.title"),children:(0,Ih.jsxs)("p",{className:"clear-canvas__content",children:[" ",E("alerts.clearReset")]})}):null};h();var ux=bt({active:!1});async function qI({title:e,description:t,actionLabel:r,color:o}){return new Promise(n=>{Kr.set(ux,{active:!0,onConfirm:()=>n(!0),onClose:()=>n(!1),onReject:()=>n(!1),title:e,description:t,actionLabel:r,color:o})})}var Rt=S(_(),1),JI=()=>{let{t:e}=or(),t=Er(),r=Ca();return t.isActionEnabled(Ac)?(0,Rt.jsx)(bn,{icon:Ul,onSelect:async()=>{(!r.length||await qI({title:e("overwriteConfirm.modal.loadFromFile.title"),actionLabel:e("overwriteConfirm.modal.loadFromFile.button"),color:"warning",description:(0,Rt.jsx)($r,{i18nKey:"overwriteConfirm.modal.loadFromFile.description",bold:n=>(0,Rt.jsx)("strong",{children:n}),br:()=>(0,Rt.jsx)("br",{})})}))&&t.executeAction(Ac)},"data-testid":"load-button",shortcut:Ri("loadScene"),"aria-label":e("buttons.load"),children:e("buttons.load")}):null};JI.displayName="LoadScene";var QI=()=>{let{t:e}=or(),t=Er();return t.isActionEnabled(kh)?(0,Rt.jsx)(bn,{shortcut:Ri("saveScene"),"data-testid":"save-button",onSelect:()=>t.executeAction(kh),icon:IT,"aria-label":`${e("buttons.save")}`,children:`${e("buttons.save")}`}):null};QI.displayName="SaveToActiveFile";var e4=()=>{let e=at(),{t}=or();return(0,Rt.jsx)(bn,{icon:AT,"data-testid":"image-export-button",onSelect:()=>e({openDialog:{name:"imageExport"}}),shortcut:Ri("imageExport"),"aria-label":t("buttons.exportImage"),children:t("buttons.exportImage")})};e4.displayName="SaveAsImage";var t4=()=>{let{t:e}=or(),t=Er();return(0,Rt.jsx)(bn,{"data-testid":"help-menu-item",icon:Gl,onSelect:()=>t.executeAction(zs),shortcut:"?","aria-label":e("helpDialog.title"),children:e("helpDialog.title")})};t4.displayName="Help";var r4=()=>{let{t:e}=or(),t=hi(Au,qe);return Er().isActionEnabled(fu)?(0,Rt.jsx)(bn,{icon:ba,onSelect:()=>t("clearCanvas"),"data-testid":"clear-canvas-button","aria-label":e("buttons.clearReset"),children:e("buttons.clearReset")}):null};r4.displayName="ClearCanvas";var o4=()=>{let{t:e}=or(),t=et(),r=Er();return r.isActionEnabled(Hf)?(0,Rt.jsx)(bn,{onSelect:o=>(o.preventDefault(),r.executeAction(Hf)),icon:t.theme==="dark"?wT:yT,"data-testid":"toggle-dark-mode",shortcut:Ri("toggleTheme"),"aria-label":t.theme==="dark"?e("buttons.lightMode"):e("buttons.darkMode"),children:t.theme==="dark"?e("buttons.lightMode"):e("buttons.darkMode")}):null};o4.displayName="ToggleTheme";var n4=()=>{let{t:e}=or(),t=et(),r=Er(),o=Oa();return t.viewModeEnabled||!o.UIOptions.canvasActions.changeViewBackgroundColor?null:(0,Rt.jsxs)("div",{style:{marginTop:"0.5rem"},children:[(0,Rt.jsx)("div",{"data-testid":"canvas-background-label",style:{fontSize:".75rem",marginBottom:".5rem"},children:e("labels.canvasBackground")}),(0,Rt.jsx)("div",{style:{padding:"0 0.625rem"},children:r.renderAction("changeViewBackgroundColor")})]})};n4.displayName="ChangeCanvasBackground";var i4=()=>{let{t:e}=or(),t=at();return(0,Rt.jsx)(bn,{icon:ef,onSelect:()=>{t({openDialog:{name:"jsonExport"}})},"data-testid":"json-export-button","aria-label":e("buttons.export"),children:e("buttons.export")})};i4.displayName="Export";var a4=()=>(0,Rt.jsxs)(Rt.Fragment,{children:[(0,Rt.jsx)(xc,{icon:vT,href:"https://github.com/excalidraw/excalidraw","aria-label":"GitHub",children:"GitHub"}),(0,Rt.jsx)(xc,{icon:TT,href:"https://discord.gg/UexuTaE","aria-label":"Discord",children:"Discord"}),(0,Rt.jsx)(xc,{icon:ST,href:"https://twitter.com/excalidraw","aria-label":"Twitter",children:"Twitter"})]});a4.displayName="Socials";var s4=({onSelect:e,isCollaborating:t})=>{let{t:r}=or();return(0,Rt.jsx)(bn,{"data-testid":"collab-button",icon:Wl,className:G({"active-collab":t}),onSelect:e,children:r("labels.liveCollaboration")})};s4.displayName="LiveCollaborationTrigger";h();var _h=S(W(),1);var kr=S(_(),1),px=3,Y9=8,K9=({shouldWrap:e,children:t,clientId:r,username:o})=>e?(0,kr.jsx)(go,{label:o||"Unknown user",children:t},r):(0,kr.jsx)(_h.default.Fragment,{children:t},r),fx=({actionManager:e,collaborator:t,clientId:r,withName:o=!1,shouldWrapWithTooltip:n=!1,isBeingFollowed:i})=>{let a={clientId:r,collaborator:t,withName:o,isBeingFollowed:i},s=e.renderAction("goToCollaborator",a);return(0,kr.jsx)(K9,{clientId:r,username:t.username,shouldWrap:n,children:s},r)},Z9=["avatarUrl","id","socketId","username"],Ah=_h.default.memo(({className:e,mobile:t,collaborators:r,userToFollow:o})=>{let n=Er(),i=new Map;r.forEach((p,f)=>{let g=p.id||f;i.set(g,{...p,socketId:f})});let a=Array.from(i).filter(([p,f])=>f.username?.trim()),[s,c]=_h.default.useState("");if(a.length===0)return null;let d=s.trim().toLowerCase()?a.filter(([,p])=>p.username?.toLowerCase().includes(s)):a,m=a.slice(0,px).map(([p,f])=>fx({actionManager:n,collaborator:f,clientId:p,shouldWrapWithTooltip:!0,isBeingFollowed:f.socketId===o}));return t?(0,kr.jsx)("div",{className:G("UserList UserList_mobile",e),children:a.map(([p,f])=>fx({actionManager:n,collaborator:f,clientId:p,shouldWrapWithTooltip:!0,isBeingFollowed:f.socketId===o}))}):(0,kr.jsxs)("div",{className:G("UserList",e),children:[m,a.length>px&&(0,kr.jsxs)(Lf,{onOpenChange:p=>{p||c("")},children:[(0,kr.jsxs)(Df,{className:"UserList__more",children:["+",a.length-px]}),(0,kr.jsx)(Rf,{style:{zIndex:2,width:"13rem",textAlign:"left"},align:"end",sideOffset:10,children:(0,kr.jsxs)(xr,{style:{overflow:"hidden"},children:[a.length>=Y9&&(0,kr.jsxs)("div",{className:"UserList__search-wrapper",children:[HS,(0,kr.jsx)("input",{className:"UserList__search",type:"text",placeholder:E("userList.search.placeholder"),value:s,onChange:p=>{c(p.target.value)}})]}),(0,kr.jsxs)("div",{className:"dropdown-menu UserList__collaborators",children:[d.length===0&&(0,kr.jsx)("div",{className:"UserList__collaborators__empty",children:E("userList.search.empty")}),(0,kr.jsx)("div",{className:"UserList__hint",children:E("userList.hint.text")}),d.map(([p,f])=>fx({actionManager:n,collaborator:f,clientId:p,withName:!0,isBeingFollowed:f.socketId===o}))]})]})})]})]})},(e,t)=>{if(e.collaborators.size!==t.collaborators.size||e.mobile!==t.mobile||e.className!==t.className||e.userToFollow!==t.userToFollow)return!1;for(let[r,o]of e.collaborators){let n=t.collaborators.get(r);if(!n||!$t(o,n,Z9))return!1}return!0});h();var Mh=S(W(),1);var l4=S(_(),1),Ni=(e,t)=>{let r=bt(0),o=n=>{let{jotaiScope:i}=ft(),[,a]=Ne(r,i),s=(0,Mh.useRef)({preferHost:!1,counter:0});return(0,Mh.useLayoutEffect)(()=>{let c=s.current;return a(l=>{let d=l+1;return c.counter=d,d}),()=>{a(l=>{let d=l-1;return c.counter=d,d||(c.preferHost=!1),d})}},[a]),n.__fallback||(s.current.preferHost=!0),!s.current.counter&&n.__fallback&&s.current.preferHost||s.current.counter>1&&n.__fallback?null:(0,l4.jsx)(t,{...n})};return o.displayName=e,o};var Fi=S(_(),1),X9=Object.assign(Ni("MainMenu",({children:e,onSelect:t})=>{let{MainMenuTunnel:r}=ft(),o=Ke(),n=et(),i=at(),a=o.editor.isMobile?void 0:()=>i({openMenu:null});return(0,Fi.jsx)(r.In,{children:(0,Fi.jsxs)(je,{open:n.openMenu==="canvas",children:[(0,Fi.jsx)(je.Trigger,{onToggle:()=>{i({openMenu:n.openMenu==="canvas"?null:"canvas"})},"data-testid":"main-menu-trigger",className:"main-menu-trigger",children:Qp}),(0,Fi.jsxs)(je.Content,{onClickOutside:a,onSelect:aa(t,()=>{i({openMenu:null})}),children:[e,o.editor.isMobile&&n.collaborators.size>0&&(0,Fi.jsxs)("fieldset",{className:"UserList-Wrapper",children:[(0,Fi.jsx)("legend",{children:E("labels.collaborators")}),(0,Fi.jsx)(Ah,{mobile:!0,collaborators:n.collaborators,userToFollow:n.userToFollow?.socketId||null})]})]})]})})}),{Trigger:je.Trigger,Item:je.Item,ItemLink:je.ItemLink,ItemCustom:je.ItemCustom,Group:je.Group,Separator:je.Separator,DefaultItems:mx}),Gr=X9;h();h();h();var Wo=S(_(),1),j9=()=>(0,Wo.jsx)("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"ExcalidrawLogo-icon",children:(0,Wo.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"})}),q9=()=>(0,Wo.jsxs)("svg",{viewBox:"0 0 450 55",xmlns:"http://www.w3.org/2000/svg",fill:"none",className:"ExcalidrawLogo-text",children:[(0,Wo.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,Wo.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,Wo.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,Wo.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)"})]}),c4=({style:e,size:t="small",withText:r})=>(0,Wo.jsxs)("div",{className:`ExcalidrawLogo is-${t}`,style:e,children:[(0,Wo.jsx)(j9,{}),r&&(0,Wo.jsx)(q9,{})]});var dt=S(_(),1),hx=({icon:e,shortcut:t,children:r})=>{let o=Ke();return(0,dt.jsxs)(dt.Fragment,{children:[(0,dt.jsx)("div",{className:"welcome-screen-menu-item__icon",children:e}),(0,dt.jsx)("div",{className:"welcome-screen-menu-item__text",children:r}),t&&!o.editor.isMobile&&(0,dt.jsx)("div",{className:"welcome-screen-menu-item__shortcut",children:t})]})};hx.displayName="WelcomeScreenMenuItemContent";var Mu=({onSelect:e,children:t,icon:r,shortcut:o,className:n="",...i})=>(0,dt.jsx)("button",{...i,type:"button",className:`welcome-screen-menu-item ${n}`,onClick:e,children:(0,dt.jsx)(hx,{icon:r,shortcut:o,children:t})});Mu.displayName="WelcomeScreenMenuItem";var d4=({children:e,href:t,icon:r,shortcut:o,className:n="",...i})=>(0,dt.jsx)("a",{...i,className:`welcome-screen-menu-item ${n}`,href:t,target:"_blank",rel:"noreferrer",children:(0,dt.jsx)(hx,{icon:r,shortcut:o,children:e})});d4.displayName="WelcomeScreenMenuItemLink";var Vo=({children:e})=>{let{WelcomeScreenCenterTunnel:t}=ft();return(0,dt.jsx)(t.In,{children:(0,dt.jsx)("div",{className:"welcome-screen-center",children:e||(0,dt.jsxs)(dt.Fragment,{children:[(0,dt.jsx)(gx,{}),(0,dt.jsx)(bx,{children:E("welcomeScreen.defaults.center_heading")}),(0,dt.jsxs)(xx,{children:[(0,dt.jsx)(yx,{}),(0,dt.jsx)(Ex,{})]})]})})})};Vo.displayName="Center";var gx=({children:e})=>(0,dt.jsx)("div",{className:"welcome-screen-center__logo virgil welcome-screen-decor",children:e||(0,dt.jsx)(c4,{withText:!0})});gx.displayName="Logo";var bx=({children:e})=>(0,dt.jsx)("div",{className:"welcome-screen-center__heading welcome-screen-decor virgil",children:e});bx.displayName="Heading";var xx=({children:e})=>(0,dt.jsx)("div",{className:"welcome-screen-menu",children:e});xx.displayName="Menu";var Ex=()=>{let e=Er();return(0,dt.jsx)(Mu,{onSelect:()=>e.executeAction(zs),shortcut:"?",icon:Gl,children:E("helpDialog.title")})};Ex.displayName="MenuItemHelp";var yx=()=>{let e=et(),t=Er();return e.viewModeEnabled?null:(0,dt.jsx)(Mu,{onSelect:()=>t.executeAction(Ac),shortcut:Ri("loadScene"),icon:Ul,children:E("buttons.load")})};yx.displayName="MenuItemLoadScene";var u4=({onSelect:e})=>{let{t}=or();return(0,dt.jsx)(Mu,{shortcut:null,onSelect:e,icon:Wl,children:t("labels.liveCollaboration")})};u4.displayName="MenuItemLiveCollaborationTrigger";Vo.Logo=gx;Vo.Heading=bx;Vo.Menu=xx;Vo.MenuItem=Mu;Vo.MenuItemLink=d4;Vo.MenuItemHelp=Ex;Vo.MenuItemLoadScene=yx;Vo.MenuItemLiveCollaborationTrigger=u4;h();var En=S(_(),1),Ph=({children:e})=>{let{WelcomeScreenMenuHintTunnel:t}=ft();return(0,En.jsx)(t.In,{children:(0,En.jsxs)("div",{className:"virgil welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--menu",children:[oT,(0,En.jsx)("div",{className:"welcome-screen-decor-hint__label",children:e||E("welcomeScreen.defaults.menuHint")})]})})};Ph.displayName="MenuHint";var Lh=({children:e})=>{let{WelcomeScreenToolbarHintTunnel:t}=ft();return(0,En.jsx)(t.In,{children:(0,En.jsxs)("div",{className:"virgil welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--toolbar",children:[(0,En.jsx)("div",{className:"welcome-screen-decor-hint__label",children:e||E("welcomeScreen.defaults.toolbarHint")}),iT]})})};Lh.displayName="ToolbarHint";var Dh=({children:e})=>{let{WelcomeScreenHelpHintTunnel:t}=ft();return(0,En.jsx)(t.In,{children:(0,En.jsxs)("div",{className:"virgil welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--help",children:[(0,En.jsx)("div",{children:e||E("welcomeScreen.defaults.helpHint")}),nT]})})};Dh.displayName="HelpHint";var yn=S(_(),1),Rh=e=>(0,yn.jsx)(yn.Fragment,{children:e.children||(0,yn.jsxs)(yn.Fragment,{children:[(0,yn.jsx)(Vo,{}),(0,yn.jsx)(Ph,{}),(0,yn.jsx)(Lh,{}),(0,yn.jsx)(Dh,{})]})});Rh.displayName="WelcomeScreen";Rh.Center=Vo;Rh.Hints={MenuHint:Ph,ToolbarHint:Lh,HelpHint:Dh};var J9=Rh;h();h();var m4=S(_(),1),Qn=({type:e="button",onSelect:t,selected:r,children:o,className:n="",...i})=>(0,m4.jsx)("button",{onClick:aa(i.onClick,a=>{t()}),type:e,className:G("excalidraw-button",n,{selected:r}),...i,children:o});var Oh=S(_(),1),p4=({isCollaborating:e,onSelect:t,...r})=>{let o=et();return(0,Oh.jsxs)(Qn,{...r,className:G("collab-button",{active:e}),type:"button",onSelect:t,style:{position:"relative"},title:E("labels.liveCollaboration"),children:[Wl,o.collaborators.size>0&&(0,Oh.jsx)("div",{className:"CollabButton-collaborators",children:o.collaborators.size})]})},Q9=p4;p4.displayName="LiveCollaborationTrigger";h();var Yt=S(W(),1);h();var f4=S(W(),1),Nh=f4.default.createContext({});h();var h4=S(W(),1);var Hs=S(_(),1),wx=({children:e,className:t})=>{let r=Ke(),o=(0,h4.useContext)(Nh),n=!!(r.editor.canFitSidebar&&o.shouldRenderDockButton);return(0,Hs.jsxs)("div",{className:G("sidebar__header",t),"data-testid":"sidebar-header",children:[e,(0,Hs.jsxs)("div",{className:"sidebar__header__buttons",children:[n&&(0,Hs.jsx)(go,{label:E("labels.sidebarLock"),children:(0,Hs.jsx)(Qn,{onSelect:()=>o.onDock?.(!o.docked),selected:!!o.docked,className:"sidebar__dock","data-testid":"sidebar-dock","aria-label":E("labels.sidebarLock"),children:eT})}),(0,Hs.jsx)(Qn,{"data-testid":"sidebar-close",className:"sidebar__close",onSelect:o.onCloseRequest,"aria-label":E("buttons.close"),children:Oo})]})]})};wx.displayName="SidebarHeader";h();var $s=S(_(),1),vx=({name:e,tab:t,icon:r,title:o,children:n,onToggle:i,className:a,style:s})=>{let c=at(),l=et();return(0,$s.jsxs)("label",{title:o,className:"sidebar-trigger__label-element",children:[(0,$s.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",onChange:d=>{document.querySelector(".layer-ui__wrapper")?.classList.remove("animate");let u=d.target.checked;c({openSidebar:u?{name:e,tab:t}:null}),i?.(u)},checked:l.openSidebar?.name===e,"aria-label":o,"aria-keyshortcuts":"0"}),(0,$s.jsxs)("div",{className:G("sidebar-trigger",a),style:s,children:[r&&(0,$s.jsx)("div",{children:r}),n&&(0,$s.jsx)("div",{className:"sidebar-trigger__label",children:n})]})]})};vx.displayName="SidebarTrigger";h();h();var cr=S(W());h();var ht=S(W());h();var wn=S(W());function g4(e){let t=e+"CollectionProvider",[r,o]=Xn(t),[n,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:f,children:g}=p,x=wn.default.useRef(null),y=wn.default.useRef(new Map).current;return wn.default.createElement(n,{scope:f,itemMap:y,collectionRef:x},g)},s=e+"CollectionSlot",c=wn.default.forwardRef((p,f)=>{let{scope:g,children:x}=p,y=i(s,g),w=hr(f,y.collectionRef);return wn.default.createElement(ya,{ref:w},x)}),l=e+"CollectionItemSlot",d="data-radix-collection-item",u=wn.default.forwardRef((p,f)=>{let{scope:g,children:x,...y}=p,w=wn.default.useRef(null),T=hr(f,w),C=i(l,g);return wn.default.useEffect(()=>(C.itemMap.set(w,{ref:w,...y}),()=>void C.itemMap.delete(w))),wn.default.createElement(ya,{[d]:"",ref:T},x)});function m(p){let f=i(e+"CollectionConsumer",p);return wn.default.useCallback(()=>{let x=f.collectionRef.current;if(!x)return[];let y=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(f.itemMap.values()).sort((C,I)=>y.indexOf(C.ref.current)-y.indexOf(I.ref.current))},[f.collectionRef,f.itemMap])}return[{Provider:a,Slot:c,ItemSlot:u},m,o]}h();var Pu=S(W()),eO=(0,Pu.createContext)(void 0);function Fh(e){let t=(0,Pu.useContext)(eO);return e||t||"ltr"}var Tx="rovingFocusGroup.onEntryFocus",tO={bubbles:!1,cancelable:!0},Cx="RovingFocusGroup",[Sx,b4,rO]=g4(Cx),[oO,Ix]=Xn(Cx,[rO]),[nO,iO]=oO(Cx),aO=(0,ht.forwardRef)((e,t)=>(0,ht.createElement)(Sx.Provider,{scope:e.__scopeRovingFocusGroup},(0,ht.createElement)(Sx.Slot,{scope:e.__scopeRovingFocusGroup},(0,ht.createElement)(sO,Pe({},e,{ref:t}))))),sO=(0,ht.forwardRef)((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:o,loop:n=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,...d}=e,u=(0,ht.useRef)(null),m=hr(t,u),p=Fh(i),[f=null,g]=ic({prop:a,defaultProp:s,onChange:c}),[x,y]=(0,ht.useState)(!1),w=Fr(l),T=b4(r),C=(0,ht.useRef)(!1),[I,A]=(0,ht.useState)(0);return(0,ht.useEffect)(()=>{let P=u.current;if(P)return P.addEventListener(Tx,w),()=>P.removeEventListener(Tx,w)},[w]),(0,ht.createElement)(nO,{scope:r,orientation:o,dir:p,loop:n,currentTabStopId:f,onItemFocus:(0,ht.useCallback)(P=>g(P),[g]),onItemShiftTab:(0,ht.useCallback)(()=>y(!0),[]),onFocusableItemAdd:(0,ht.useCallback)(()=>A(P=>P+1),[]),onFocusableItemRemove:(0,ht.useCallback)(()=>A(P=>P-1),[])},(0,ht.createElement)(Lt.div,Pe({tabIndex:x||I===0?-1:0,"data-orientation":o},d,{ref:m,style:{outline:"none",...e.style},onMouseDown:Wt(e.onMouseDown,()=>{C.current=!0}),onFocus:Wt(e.onFocus,P=>{let L=!C.current;if(P.target===P.currentTarget&&L&&!x){let D=new CustomEvent(Tx,tO);if(P.currentTarget.dispatchEvent(D),!D.defaultPrevented){let M=T().filter(V=>V.focusable),R=M.find(V=>V.active),N=M.find(V=>V.id===f),K=[R,N,...M].filter(Boolean).map(V=>V.ref.current);x4(K)}}C.current=!1}),onBlur:Wt(e.onBlur,()=>y(!1))})))}),lO="RovingFocusGroupItem",cO=(0,ht.forwardRef)((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:o=!0,active:n=!1,tabStopId:i,...a}=e,s=tc(),c=i||s,l=iO(lO,r),d=l.currentTabStopId===c,u=b4(r),{onFocusableItemAdd:m,onFocusableItemRemove:p}=l;return(0,ht.useEffect)(()=>{if(o)return m(),()=>p()},[o,m,p]),(0,ht.createElement)(Sx.ItemSlot,{scope:r,id:c,focusable:o,active:n},(0,ht.createElement)(Lt.span,Pe({tabIndex:d?0:-1,"data-orientation":l.orientation},a,{ref:t,onMouseDown:Wt(e.onMouseDown,f=>{o?l.onItemFocus(c):f.preventDefault()}),onFocus:Wt(e.onFocus,()=>l.onItemFocus(c)),onKeyDown:Wt(e.onKeyDown,f=>{if(f.key==="Tab"&&f.shiftKey){l.onItemShiftTab();return}if(f.target!==f.currentTarget)return;let g=mO(f,l.orientation,l.dir);if(g!==void 0){f.preventDefault();let y=u().filter(w=>w.focusable).map(w=>w.ref.current);if(g==="last")y.reverse();else if(g==="prev"||g==="next"){g==="prev"&&y.reverse();let w=y.indexOf(f.currentTarget);y=l.loop?pO(y,w+1):y.slice(w+1)}setTimeout(()=>x4(y))}})})))}),dO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function uO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mO(e,t,r){let o=uO(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return dO[o]}function x4(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function pO(e,t){return e.map((r,o)=>e[(t+o)%e.length])}var E4=aO,y4=cO;var w4="Tabs",[fO,Rle]=Xn(w4,[Ix]),v4=Ix(),[hO,kx]=fO(w4),gO=(0,cr.forwardRef)((e,t)=>{let{__scopeTabs:r,value:o,onValueChange:n,defaultValue:i,orientation:a="horizontal",dir:s,activationMode:c="automatic",...l}=e,d=Fh(s),[u,m]=ic({prop:o,onChange:n,defaultProp:i});return(0,cr.createElement)(hO,{scope:r,baseId:tc(),value:u,onValueChange:m,orientation:a,dir:d,activationMode:c},(0,cr.createElement)(Lt.div,Pe({dir:d,"data-orientation":a},l,{ref:t})))}),bO="TabsList",xO=(0,cr.forwardRef)((e,t)=>{let{__scopeTabs:r,loop:o=!0,...n}=e,i=kx(bO,r),a=v4(r);return(0,cr.createElement)(E4,Pe({asChild:!0},a,{orientation:i.orientation,dir:i.dir,loop:o}),(0,cr.createElement)(Lt.div,Pe({role:"tablist","aria-orientation":i.orientation},n,{ref:t})))}),EO="TabsTrigger",yO=(0,cr.forwardRef)((e,t)=>{let{__scopeTabs:r,value:o,disabled:n=!1,...i}=e,a=kx(EO,r),s=v4(r),c=T4(a.baseId,o),l=S4(a.baseId,o),d=o===a.value;return(0,cr.createElement)(y4,Pe({asChild:!0},s,{focusable:!n,active:d}),(0,cr.createElement)(Lt.button,Pe({type:"button",role:"tab","aria-selected":d,"aria-controls":l,"data-state":d?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:c},i,{ref:t,onMouseDown:Wt(e.onMouseDown,u=>{!n&&u.button===0&&u.ctrlKey===!1?a.onValueChange(o):u.preventDefault()}),onKeyDown:Wt(e.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&a.onValueChange(o)}),onFocus:Wt(e.onFocus,()=>{let u=a.activationMode!=="manual";!d&&!n&&u&&a.onValueChange(o)})})))}),wO="TabsContent",vO=(0,cr.forwardRef)((e,t)=>{let{__scopeTabs:r,value:o,forceMount:n,children:i,...a}=e,s=kx(wO,r),c=T4(s.baseId,o),l=S4(s.baseId,o),d=o===s.value,u=(0,cr.useRef)(d);return(0,cr.useEffect)(()=>{let m=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(m)},[]),(0,cr.createElement)(nc,{present:n||d},({present:m})=>(0,cr.createElement)(Lt.div,Pe({"data-state":d?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:l,tabIndex:0},a,{ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0}}),m&&i))});function T4(e,t){return`${e}-trigger-${t}`}function S4(e,t){return`${e}-content-${t}`}var Bh=gO,zh=xO,Hh=yO,$h=vO;var C4=S(_(),1),_x=({children:e,...t})=>(0,C4.jsx)(zh,{className:"sidebar-triggers",...t,children:e});_x.displayName="SidebarTabTriggers";h();var Ax=S(_(),1),Mx=({children:e,tab:t,onSelect:r,...o})=>(0,Ax.jsx)(Hh,{value:t,asChild:!0,onSelect:r,children:(0,Ax.jsx)("button",{type:"button",className:"excalidraw-button sidebar-tab-trigger",...o,children:e})});Mx.displayName="SidebarTabTrigger";h();var I4=S(_(),1),Px=({children:e,...t})=>{let r=et(),o=at();if(!r.openSidebar)return null;let{name:n}=r.openSidebar;return(0,I4.jsx)(Bh,{className:"sidebar-tabs-root",value:r.openSidebar.tab,onValueChange:i=>o(a=>({...a,openSidebar:{...a.openSidebar,name:n,tab:i}})),...t,children:e})};Px.displayName="SidebarTabs";h();var k4=S(_(),1),Lx=({tab:e,children:t,...r})=>(0,k4.jsx)($h,{...r,value:e,children:t});Lx.displayName="SidebarTab";var Dx=S(_(),1),A4=S(W(),1),Lu=bt(!1),_4=(0,Yt.forwardRef)(({name:e,children:t,onDock:r,docked:o,className:n,...i},a)=>{v.DEV&&r&&o==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=at(),c=hi(Lu,qe);(0,Yt.useLayoutEffect)(()=>(c(!!o),()=>{c(!1)}),[c,o]);let l=(0,Yt.useRef)({});l.current.onCloseRequest=()=>{s({openSidebar:null})},l.current.onDock=p=>r?.(p),l.current=Il(l.current,{docked:o,shouldRenderDockButton:!!r&&o!=null});let d=(0,Yt.useRef)(null);(0,Yt.useImperativeHandle)(a,()=>d.current);let u=Ke(),m=(0,Yt.useCallback)(()=>{document.querySelector(".Dialog")||s({openSidebar:null})},[s]);return dc(d,(0,Yt.useCallback)(p=>{p.target.closest(".sidebar-trigger")||(!o||!u.editor.canFitSidebar)&&m()},[m,o,u.editor.canFitSidebar])),(0,Yt.useEffect)(()=>{let p=f=>{f.key===k.ESCAPE&&(!o||!u.editor.canFitSidebar)&&m()};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p)}},[m,o,u.editor.canFitSidebar]),(0,Dx.jsx)(xr,{...i,className:G("sidebar",{"sidebar--docked":o},n),ref:d,children:(0,Dx.jsx)(Nh.Provider,{value:l.current,children:t})})});_4.displayName="SidebarInner";var Bi=Object.assign((0,Yt.forwardRef)((e,t)=>{let r=et(),{onStateChange:o}=e,n=(0,Yt.useRef)(r.openSidebar);(0,Yt.useEffect)(()=>{(!r.openSidebar&&n?.current?.name===e.name||r.openSidebar?.name===e.name&&n?.current?.name!==e.name||n.current?.name===e.name)&&r.openSidebar!==n.current&&o?.(r.openSidebar?.name!==e.name?null:r.openSidebar),n.current=r.openSidebar},[r.openSidebar,o,e.name]);let[i,a]=(0,Yt.useState)(!1);return(0,Yt.useLayoutEffect)(()=>(a(!0),()=>a(!1)),[]),i&&r.openSidebar?.name===e.name?(0,A4.createElement)(_4,{...e,ref:t,key:e.name}):null}),{Header:wx,TabTriggers:_x,TabTrigger:Mx,Tabs:Px,Tab:Lx,Trigger:vx});Bi.displayName="Sidebar";h();var Yo=S(_(),1),L4=S(W(),1),M4=Ni("DefaultSidebarTrigger",e=>{let{DefaultSidebarTriggerTunnel:t}=ft();return(0,Yo.jsx)(t.In,{children:(0,Yo.jsx)(Bi.Trigger,{...e,className:"default-sidebar-trigger",name:Fn.name})})});M4.displayName="DefaultSidebarTrigger";var P4=({children:e,...t})=>{let{DefaultSidebarTabTriggersTunnel:r}=ft();return(0,Yo.jsx)(r.In,{children:(0,Yo.jsx)(Bi.TabTriggers,{...t,children:e})})};P4.displayName="DefaultTabTriggers";var Gh=Object.assign(Ni("DefaultSidebar",({children:e,className:t,onDock:r,docked:o,...n})=>{let i=et(),a=at(),{DefaultSidebarTabTriggersTunnel:s}=ft();return(0,L4.createElement)(Bi,{...n,name:"default",key:"default",className:G("default-sidebar",t),docked:o??i.defaultSidebarDockedPreference,onDock:r===!1||!r&&o!=null?void 0:aa(r,c=>{a({defaultSidebarDockedPreference:c})})},(0,Yo.jsxs)(Bi.Tabs,{children:[(0,Yo.jsxs)(Bi.Header,{children:[n.__fallback&&(0,Yo.jsx)("div",{style:{color:"var(--color-primary)",fontSize:"1.2em",fontWeight:"bold",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",paddingRight:"1em"},children:E("toolBar.library")}),(0,Yo.jsx)(s.Out,{})]}),(0,Yo.jsx)(Bi.Tab,{tab:Ad,children:(0,Yo.jsx)(XI,{})}),e]}))}),{Trigger:M4,TabTriggers:P4});h();h();var vn=S(W(),1);h();var TO=({canvasRef:e,setError:t})=>{let r=e.current;if(!r)return;let o=r.parentElement;o&&(o.style.background="",t(null),r.replaceChildren())},Uh=async({canvasRef:e,mermaidToExcalidrawLib:t,mermaidDefinition:r,setError:o,data:n})=>{let i=e.current,a=i?.parentElement;if(!(!i||!a)){if(!r){TO({canvasRef:e,setError:o});return}try{let s=await t.api,c;try{c=await s.parseMermaidToExcalidraw(r,{fontSize:Jt})}catch{c=await s.parseMermaidToExcalidraw(r.replace(/"/g,"'"),{fontSize:Jt})}let{elements:l,files:d}=c;o(null),n.current={elements:Ru(l,{regenerateIds:!0}),files:d};let u=await Da({elements:n.current.elements,files:n.current.files,exportPadding:on,maxWidthOrHeight:Math.max(a.offsetWidth,a.offsetHeight)*window.devicePixelRatio});await Oi(u),a.style.background="var(--default-bg-color)",i.replaceChildren(u)}catch(s){throw a.style.background="var(--default-bg-color)",r&&o(s),s}}},Du=e=>{ro.set(So.MERMAID_TO_EXCALIDRAW,e)},Wh=({app:e,data:t,text:r,shouldSaveMermaidDataToStorage:o})=>{let{elements:n,files:i}=t.current;n.length&&(e.addElementsFromPasteOrLibrary({elements:n,files:i,position:"center",fitToContent:!0}),e.setOpenDialog(null),o&&r&&Du(r))};h();var D4=S(_(),1),Vh=({children:e})=>(0,D4.jsx)("div",{className:"ttd-dialog-panels",children:e});h();var ei=S(_(),1),Mc=({label:e,children:t,panelAction:r,panelActionDisabled:o=!1,onTextSubmitInProgess:n,renderTopRight:i,renderSubmitShortcut:a,renderBottomRight:s})=>(0,ei.jsxs)("div",{className:"ttd-dialog-panel",children:[(0,ei.jsxs)("div",{className:"ttd-dialog-panel__header",children:[(0,ei.jsx)("label",{children:e}),i?.()]}),t,(0,ei.jsxs)("div",{className:G("ttd-dialog-panel-button-container",{invisible:!r}),style:{display:"flex",alignItems:"center"},children:[(0,ei.jsxs)(Qn,{className:"ttd-dialog-panel-button",onSelect:r?r.action:()=>{},disabled:o||n,children:[(0,ei.jsxs)("div",{className:G({invisible:n}),children:[r?.label,r?.icon&&(0,ei.jsx)("span",{children:r.icon})]}),n&&(0,ei.jsx)(zr,{})]}),!o&&!n&&a?.(),s?.()]})]});h();var Ou=S(W(),1);var R4=S(_(),1),Yh=({input:e,placeholder:t,onChange:r,onKeyboardSubmit:o})=>{let n=(0,Ou.useRef)(null),i=(0,Ou.useRef)(o);return i.current=o,(0,Ou.useEffect)(()=>{if(!i.current)return;let a=n.current;if(a){let s=c=>{c[k.CTRL_OR_CMD]&&c.key===k.ENTER&&(c.preventDefault(),i.current?.())};return a.addEventListener("keydown",s),()=>{a.removeEventListener("keydown",s)}}},[]),(0,R4.jsx)("textarea",{className:"ttd-dialog-input",onChange:r,value:e,placeholder:t,autoFocus:!0,ref:n})};h();var Ba=S(_(),1),SO=({error:e})=>(0,Ba.jsxs)("div",{"data-testid":"ttd-dialog-output-error",className:"ttd-dialog-output-error",children:["Error! ",(0,Ba.jsx)("p",{children:e})]}),Kh=({error:e,canvasRef:t,loaded:r})=>(0,Ba.jsxs)("div",{className:"ttd-dialog-output-wrapper",children:[e&&(0,Ba.jsx)(SO,{error:e.message}),r?(0,Ba.jsx)("div",{ref:t,style:{opacity:e?"0.15":1},className:"ttd-dialog-output-canvas-container"}):(0,Ba.jsx)(zr,{size:"2rem"})]});h();var Nu=S(_(),1),Zh=()=>(0,Nu.jsxs)("div",{className:"ttd-dialog-submit-shortcut",children:[(0,Nu.jsx)("div",{className:"ttd-dialog-submit-shortcut__key",children:H("CtrlOrCmd")}),(0,Nu.jsx)("div",{className:"ttd-dialog-submit-shortcut__key",children:H("Enter")})]});var _r=S(_(),1),CO=`flowchart TD
52
- A[Christmas] -->|Get money| B(Go shopping)
53
- B --> C{Let me think}
54
- C -->|One| D[Laptop]
55
- C -->|Two| E[iPhone]
56
- C -->|Three| F[Car]`,O4=cs(Du,300),IO=({mermaidToExcalidrawLib:e})=>{let[t,r]=(0,vn.useState)(()=>ro.get(So.MERMAID_TO_EXCALIDRAW)||CO),o=(0,vn.useDeferredValue)(t.trim()),[n,i]=(0,vn.useState)(null),a=(0,vn.useRef)(null),s=(0,vn.useRef)({elements:[],files:null}),c=Bo();(0,vn.useEffect)(()=>{Uh({canvasRef:a,data:s,mermaidToExcalidrawLib:e,setError:i,mermaidDefinition:o}).catch(()=>{}),O4(o)},[o,e]),(0,vn.useEffect)(()=>()=>{O4.flush()},[]);let l=()=>{Wh({app:c,data:s,text:t,shouldSaveMermaidDataToStorage:!0})};return(0,_r.jsxs)(_r.Fragment,{children:[(0,_r.jsx)("div",{className:"ttd-dialog-desc",children:(0,_r.jsx)($r,{i18nKey:"mermaid.description",flowchartLink:d=>(0,_r.jsx)("a",{href:"https://mermaid.js.org/syntax/flowchart.html",children:d}),sequenceLink:d=>(0,_r.jsx)("a",{href:"https://mermaid.js.org/syntax/sequenceDiagram.html",children:d}),classLink:d=>(0,_r.jsx)("a",{href:"https://mermaid.js.org/syntax/classDiagram.html",children:d})})}),(0,_r.jsxs)(Vh,{children:[(0,_r.jsx)(Mc,{label:E("mermaid.syntax"),children:(0,_r.jsx)(Yh,{input:t,placeholder:"Write Mermaid diagram defintion here...",onChange:d=>r(d.target.value),onKeyboardSubmit:()=>{l()}})}),(0,_r.jsx)(Mc,{label:E("mermaid.preview"),panelAction:{action:()=>{l()},label:E("mermaid.button"),icon:Vl},renderSubmitShortcut:()=>(0,_r.jsx)(Zh,{}),children:(0,_r.jsx)(Kh,{canvasRef:a,loaded:e.loaded,error:n})})]})]})},N4=IO;h();var Rx=S(W(),1);var B4=S(_(),1),F4=e=>{let t=at(),r=(0,Rx.useRef)(null),o=(0,Rx.useRef)(0);return(0,B4.jsx)(Bh,{ref:r,className:"ttd-dialog-tabs-root",value:e.tab,onValueChange:n=>{if(!n)return;let i=r.current?.closest(".Modal__content");if(i){let a=i.offsetHeight||0;a>o.current&&(o.current=a,i.style.minHeight=`min(${o.current}px, 100%)`)}e.dialog==="settings"&&Nd(["text-to-diagram","diagram-to-code"],n)?t({openDialog:{name:e.dialog,tab:n,source:"settings"}}):e.dialog==="ttd"&&Nd(["text-to-diagram","mermaid"],n)&&t({openDialog:{name:e.dialog,tab:n}})},children:e.children})};F4.displayName="TTDDialogTabs";var Xh=F4;var Tn=S(W(),1);h();var z4=S(_(),1),Ox=({children:e,...t})=>(0,z4.jsx)(zh,{className:"ttd-dialog-triggers",...t,children:e});Ox.displayName="TTDDialogTabTriggers";h();var Nx=S(_(),1),jh=({children:e,tab:t,onSelect:r,...o})=>(0,Nx.jsx)(Hh,{value:t,asChild:!0,onSelect:r,children:(0,Nx.jsx)("button",{type:"button",className:"ttd-dialog-tab-trigger",...o,children:e})});jh.displayName="TTDDialogTabTrigger";h();var H4=S(_(),1),Pc=({tab:e,children:t,...r})=>(0,H4.jsx)($h,{...r,value:e,children:t});Pc.displayName="TTDDialogTab";h();var $4=S(_(),1),Lc=({icon:e})=>(0,$4.jsx)("span",{style:{width:"1em",margin:"0 0.5ex 0 0.5ex",display:"inline-block",lineHeight:0,verticalAlign:"middle"},children:e});var Tt=S(_(),1),Fx=3,Dc=1e3,kO=bt(null),_O=bt(null),Bx=e=>{let t=et();return t.openDialog?.name!=="ttd"?null:(0,Tt.jsx)(AO,{...e,tab:t.openDialog.tab})},AO=Ni("TTDDialogBase",({tab:e,...t})=>{let r=Bo(),o=at(),n=(0,Tn.useRef)(null),[i,a]=Ne(_O),[s,c]=(0,Tn.useState)(i?.prompt??""),l=s.trim(),d=A=>{c(A.target.value),a(P=>({generatedResponse:P?.generatedResponse??null,prompt:A.target.value}))},[u,m]=(0,Tn.useState)(!1),[p,f]=Ne(kO),g=async()=>{if(l.length>Dc||l.length<Fx||u||p?.rateLimitRemaining===0||"__fallback"in t){l.length<Fx&&I(new Error(`Prompt is too short (min ${Fx} characters)`)),l.length>Dc&&I(new Error(`Prompt is too long (max ${Dc} characters)`));return}try{m(!0),Ae("ai","generate","ttd");let{generatedResponse:A,error:P,rateLimit:L,rateLimitRemaining:D}=await t.onTextSubmit(l);if(typeof A=="string"&&a(M=>({generatedResponse:A,prompt:M?.prompt??null})),ub(L)&&ub(D)&&f({rateLimit:L,rateLimitRemaining:D}),P){I(P);return}if(!A){I(new Error("Generation failed"));return}try{await Uh({canvasRef:n,data:T,mermaidToExcalidrawLib:y,setError:I,mermaidDefinition:A}),Ae("ai","mermaid parse success","ttd")}catch(M){console.info(`%cTTD mermaid render errror: ${M.message}`,"color: red"),console.info(`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
57
- TTD mermaid definition render errror: ${M.message}`,"color: yellow"),Ae("ai","mermaid parse failed","ttd"),I(new Error("Generated an invalid diagram :(. You may also try a different prompt."))}}catch(A){let P=A.message;(!P||P==="Failed to fetch")&&(P="Request failed"),I(new Error(P))}finally{m(!1)}},x=(0,Tn.useRef)(g);x.current=g;let[y,w]=(0,Tn.useState)({loaded:!1,api:import("./dist-JVNEDNHF.js")});(0,Tn.useEffect)(()=>{(async()=>{await y.api,w(P=>({...P,loaded:!0}))})()},[y.api]);let T=(0,Tn.useRef)({elements:[],files:null}),[C,I]=(0,Tn.useState)(null);return(0,Tt.jsx)(Dt,{className:"ttd-dialog",onCloseRequest:()=>{r.setOpenDialog(null)},size:1200,title:!1,...t,autofocus:!1,children:(0,Tt.jsxs)(Xh,{dialog:"ttd",tab:e,children:["__fallback"in t&&t.__fallback?(0,Tt.jsx)("p",{className:"dialog-mermaid-title",children:E("mermaid.title")}):(0,Tt.jsxs)(Ox,{children:[(0,Tt.jsx)(jh,{tab:"text-to-diagram",children:(0,Tt.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[E("labels.textToDiagram"),(0,Tt.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"1px 6px",marginLeft:"10px",fontSize:10,borderRadius:"12px",background:"pink",color:"#000"},children:"AI Beta"})]})}),(0,Tt.jsx)(jh,{tab:"mermaid",children:"Mermaid"})]}),(0,Tt.jsx)(Pc,{className:"ttd-dialog-content",tab:"mermaid",children:(0,Tt.jsx)(N4,{mermaidToExcalidrawLib:y})}),!("__fallback"in t)&&(0,Tt.jsxs)(Pc,{className:"ttd-dialog-content",tab:"text-to-diagram",children:[(0,Tt.jsx)("div",{className:"ttd-dialog-desc",children:"Currently we use Mermaid as a middle step, so you'll get best results if you describe a diagram, workflow, flow chart, and similar."}),(0,Tt.jsxs)(Vh,{children:[(0,Tt.jsx)(Mc,{label:E("labels.prompt"),panelAction:{action:g,label:"Generate",icon:Vl},onTextSubmitInProgess:u,panelActionDisabled:l.length>Dc||p?.rateLimitRemaining===0,renderTopRight:()=>p?(0,Tt.jsxs)("div",{className:"ttd-dialog-rate-limit",style:{fontSize:12,marginLeft:"auto",color:p.rateLimitRemaining===0?"var(--color-danger)":void 0},children:[p.rateLimitRemaining," requests left today"]}):null,renderSubmitShortcut:()=>(0,Tt.jsx)(Zh,{}),renderBottomRight:()=>{if(typeof i?.generatedResponse=="string")return(0,Tt.jsxs)("div",{className:"excalidraw-link",style:{marginLeft:"auto",fontSize:14},onClick:()=>{typeof i?.generatedResponse=="string"&&(Du(i.generatedResponse),o({openDialog:{name:"ttd",tab:"mermaid"}}))},children:["View as Mermaid",(0,Tt.jsx)(Lc,{icon:Vl})]});let A=l.length/Dc;return A>.8?(0,Tt.jsxs)("div",{style:{marginLeft:"auto",fontSize:12,fontFamily:"monospace",color:A>1?"var(--color-danger)":void 0},children:["Length: ",l.length,"/",Dc]}):null},children:(0,Tt.jsx)(Yh,{onChange:d,input:s,placeholder:"Describe what you want to see...",onKeyboardSubmit:()=>{x.current()}})}),(0,Tt.jsx)(Mc,{label:"Preview",panelAction:{action:()=>{console.info("Panel action clicked"),Wh({app:r,data:T})},label:"Insert",icon:Vl},children:(0,Tt.jsx)(Kh,{canvasRef:n,error:C,loaded:y.loaded})})]})]})]})})});h();var Fu=S(_(),1),G4=({children:e,icon:t})=>{let{TTDDialogTriggerTunnel:r}=ft(),o=at();return(0,Fu.jsx)(r.In,{children:(0,Fu.jsxs)(je.Item,{onSelect:()=>{Ae("ai","dialog open","ttd"),o({openDialog:{name:"ttd",tab:"text-to-diagram"}})},icon:t??zS,children:[e??E("labels.textToDiagram"),(0,Fu.jsx)(je.Item.Badge,{children:"AI"})]})})};G4.displayName="TTDDialogTrigger";h();h();var qh=e=>{let t=e.map(o=>o[0]),r=e.map(o=>o[1]);return{width:Math.max(...t)-Math.min(...t),height:Math.max(...r)-Math.min(...r)}},za=(e,t,r,o)=>{let n=r.map(p=>p[e]),i=Math.max(...n),a=Math.min(...n),s=i-a,c=s===0?1:t/s,l=1/0,d=r.map(p=>{let f=p[e]*c,g=[...p];return g[e]=f,f<l&&(l=f),g});if(!o||d.length===2)return d;let u=a-l;return d.map(p=>p.map((f,g)=>g===e?f+u:f))};var Jh={width:100,height:0},Ha=100,MO=(e,t)=>{let r=ir({x:0,y:0,textAlign:na.CENTER,verticalAlign:Nt.MIDDLE,...t,containerId:e.id,strokeColor:t.strokeColor||e.strokeColor});return Object.assign(e,{boundElements:(e.boundElements||[]).concat({type:"text",id:r.id})}),br(r,e),[e,r]},U4=(e,t,r,o)=>{let n,i;if(Object.assign(e,{startBinding:e?.startBinding||null,endBinding:e.endBinding||null}),t){let l=t?.width??Ha,d=t?.height??Ha,u;t.id&&(u=o.getElement(t.id),u||console.error(`No element for start binding with id ${t.id} found`));let m=t.x||e.x-l,p=t.y||e.y-d/2,f=u?u.type:t.type;if(f){if(f==="text"){let g="";u&&u.type==="text"?g=u.text:t.type==="text"&&(g=t.text),g||console.error(`No text found for start binding text element for ${e.id}`),n=ir({x:m,y:p,type:"text",...u,...t,text:g}),Object.assign(n,{x:t.x||e.x-n.width,y:t.y||e.y-n.height/2})}else switch(f){case"rectangle":case"ellipse":case"diamond":{n=uo({x:m,y:p,width:l,height:d,...u,...t,type:f});break}default:sa(e,`Unhandled element start type "${t.type}"`,!0)}Rc(e,n,"start")}}if(r){let l=r?.height??Ha,d=r?.width??Ha,u;r.id&&(u=o.getElement(r.id),u||console.error(`No element for end binding with id ${r.id} found`));let m=r.x||e.x+e.width,p=r.y||e.y-l/2,f=u?u.type:r.type;if(f){if(f==="text"){let g="";u&&u.type==="text"?g=u.text:r.type==="text"&&(g=r.text),g||console.error(`No text found for end binding text element for ${e.id}`),i=ir({x:m,y:p,type:"text",...u,...r,text:g}),Object.assign(i,{y:r.y||e.y-i.height/2})}else switch(f){case"rectangle":case"ellipse":case"diamond":{i=uo({x:m,y:p,width:d,height:l,...u,...r,type:f});break}default:sa(e,`Unhandled element end type "${f}"`,!0)}Rc(e,i,"end")}}let a=e.points.length-1,s=.5,c=Co(e.points);return e.points[a][0]>e.points[a-1][0]&&(c[0][0]=s,c[a][0]-=s),e.points[a][0]<e.points[a-1][0]&&(c[0][0]=-s,c[a][0]+=s),e.points[a][1]>e.points[a-1][1]&&(c[0][1]=s,c[a][1]-=s),e.points[a][1]<e.points[a-1][1]&&(c[0][1]=-s,c[a][1]+=s),Object.assign(e,{points:c}),{linearElement:e,startBoundElement:n,endBoundElement:i}},zx=class{excalidrawElements=new Map;add=t=>{t&&this.excalidrawElements.set(t.id,t)};getElements=()=>Array.from(this.excalidrawElements.values());getElement=t=>this.excalidrawElements.get(t)},Ru=(e,t)=>{if(!e)return[];let r=Co(e),o=new zx,n=new Map,i=new Map;for(let a of r){let s,c=a.id;switch(t?.regenerateIds!==!1&&Object.assign(a,{id:tr()}),a.type){case"rectangle":case"ellipse":case"diamond":{let d=a?.label?.text&&a.width===void 0?0:a?.width||Ha,u=a?.label?.text&&a.height===void 0?0:a?.height||Ha;s=uo({...a,width:d,height:u});break}case"line":{let d=a.width||Jh.width,u=a.height||Jh.height;s=Ro({width:d,height:u,points:[[0,0],[d,u]],...a});break}case"arrow":{let d=a.width||Jh.width,u=a.height||Jh.height;s=Ro({width:d,height:u,endArrowhead:"arrow",points:[[0,0],[d,u]],...a}),Object.assign(s,qh(s.points));break}case"text":{let d=a?.fontFamily||pr,u=a?.fontSize||Jt,m=a?.lineHeight||mo(d),p=a.text??"",f=ha(p),g=co(f,Ve({fontFamily:d,fontSize:u}),m);s=ir({width:g.width,height:g.height,fontFamily:d,fontSize:u,...a});break}case"image":{s=qd({width:a?.width||Ha,height:a?.height||Ha,...a});break}case"frame":{s=Yp({x:0,y:0,...a});break}case"magicframe":{s=jd({x:0,y:0,...a});break}case"freedraw":case"iframe":case"embeddable":{s=a;break}default:s=a,sa(a,`Unhandled element type "${a.type}"`,!0)}o.getElement(s.id)?console.error(`Duplicate id found for ${s.id}`):(o.add(s),n.set(s.id,a),c&&i.set(c,s.id))}for(let[a,s]of n){let c=o.getElement(a);switch(s.type){case"rectangle":case"ellipse":case"diamond":case"arrow":{if(s.label?.text){let[l,d]=MO(c,s?.label);if(o.add(l),o.add(d),l.type==="arrow"){let u=s.type==="arrow"?s?.start:void 0,m=s.type==="arrow"?s?.end:void 0;if(u&&u.id){let x=i.get(u.id);x&&Object.assign(u,{id:x})}if(m&&m.id){let x=i.get(m.id);x&&Object.assign(m,{id:x})}let{linearElement:p,startBoundElement:f,endBoundElement:g}=U4(l,u,m,o);l=p,o.add(p),o.add(f),o.add(g)}}else switch(s.type){case"arrow":{let{start:l,end:d}=s;if(l&&l.id){let f=i.get(l.id);Object.assign(l,{id:f})}if(d&&d.id){let f=i.get(d.id);Object.assign(d,{id:f})}let{linearElement:u,startBoundElement:m,endBoundElement:p}=U4(c,l,d,o);o.add(u),o.add(m),o.add(p);break}}break}}}for(let[a,s]of n){if(s.type!=="frame"&&s.type!=="magicframe")continue;let c=o.getElement(a);if(!c)throw new Error(`Excalidraw element with id ${a} doesn't exist`);let l=[];s.children.forEach(y=>{let w=i.get(y);if(!w)throw new Error(`Element with ${y} wasn't mapped correctly`);let T=o.getElement(w);if(!T)throw new Error(`Frame element with id ${w} doesn't exist`);Object.assign(T,{frameId:c.id}),T?.boundElements?.forEach(C=>{let I=o.getElement(C.id);if(!I)throw new Error(`Bound element with id ${C.id} doesn't exist`);Object.assign(I,{frameId:c.id}),l.push(I)}),l.push(T)});let[d,u,m,p]=Me(l),f=10;d=d-f,u=u-f,m=m+f,p=p+f;let g=Math.max(c?.width,m-d),x=Math.max(c?.height,p-u);Object.assign(c,{x:d,y:u,width:g,height:x})}return o.getElements()};var Qh=S(_(),1);MC();var RO=e=>{let{onChange:t,initialData:r,excalidrawAPI:o,isCollaborating:n=!1,onPointerUpdate:i,renderTopRightUI:a,langCode:s=Bn.code,viewModeEnabled:c,zenModeEnabled:l,gridModeEnabled:d,libraryReturnUrl:u,theme:m,name:p,renderCustomStats:f,onPaste:g,detectScroll:x=!0,handleKeyboardGlobally:y=!1,onLibraryChange:w,autoFocus:T=!1,generateIdForFile:C,onLinkOpen:I,onPointerDown:A,onScrollChange:P,children:L,validateEmbeddable:D,renderEmbeddable:M,aiEnabled:R}=e,N=e.UIOptions?.canvasActions,B={...e.UIOptions,canvasActions:{...Q0.canvasActions,...N},tools:{image:e.UIOptions?.tools?.image??!0}};return N?.export&&(B.canvasActions.export.saveFileToDisk=N.export?.saveFileToDisk??Q0.canvasActions.export.saveFileToDisk),B.canvasActions.toggleTheme===null&&typeof m>"u"&&(B.canvasActions.toggleTheme=!0),(0,rg.useEffect)(()=>{let K=V=>{typeof V.scale=="number"&&V.scale!==1&&V.preventDefault()};return document.addEventListener("touchmove",K,{passive:!1}),()=>{document.removeEventListener("touchmove",K)}},[]),(0,Qh.jsx)(ap,{unstable_createStore:()=>Kr,scope:qe,children:(0,Qh.jsx)(_C,{langCode:s,theme:m,children:(0,Qh.jsx)(W4,{onChange:t,initialData:r,excalidrawAPI:o,isCollaborating:n,onPointerUpdate:i,renderTopRightUI:a,langCode:s,viewModeEnabled:c,zenModeEnabled:l,gridModeEnabled:d,libraryReturnUrl:u,theme:m,name:p,renderCustomStats:f,UIOptions:B,onPaste:g,detectScroll:x,handleKeyboardGlobally:y,onLibraryChange:w,autoFocus:T,generateIdForFile:C,onLinkOpen:I,onPointerDown:A,onScrollChange:P,validateEmbeddable:D,renderEmbeddable:M,aiEnabled:R!==!1,children:L})})})},OO=(e,t)=>{if(e.children!==t.children)return!1;let{initialData:r,UIOptions:o={},...n}=e,{initialData:i,UIOptions:a={},...s}=t,c=Object.keys(o),l=Object.keys(a);return c.length!==l.length?!1:c.every(u=>u==="canvasActions"?Object.keys(o.canvasActions).every(p=>p==="export"&&o?.canvasActions?.export&&a?.canvasActions?.export?o.canvasActions.export.saveFileToDisk===a.canvasActions.export.saveFileToDisk:o?.canvasActions?.[p]===a?.canvasActions?.[p]):o[u]===a[u])&&$t(n,s)},NO=rg.default.memo(RO,OO);NO.displayName="Excalidraw";var FO=e=>e.type==="diamond"?[[e.width/2,0],[e.width,e.height/2],[e.width/2,e.height],[0,e.height/2]]:[[0,0],[0+e.width,0],[0+e.width,e.height],[0,e.height]],BO=e=>me(e)||Gt(e)?e.points:FO(e),V4=e=>{let t=e.reduce((r,[o,n])=>(r.minY=Math.min(r.minY,n),r.minX=Math.min(r.minX,o),r.maxX=Math.max(r.maxX,o),r.maxY=Math.max(r.maxY,n),r),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,cx:0,cy:0});return t.cx=(t.maxX+t.minX)/2,t.cy=(t.maxY+t.minY)/2,t},Y4=e=>{let t=BO(e),{cx:r,cy:o}=V4(t),n=[r,o],i=t.map(d=>tt([d[0],d[1]],n,e.angle)),{minX:a,minY:s,maxX:c,maxY:l}=V4(i);return[a+e.x,s+e.y,c+e.x,l+e.y]},$x=(e,t,r=!1)=>{let o=Y4(e),n=t[0]<=o[0]&&t[2]>=o[2]&&t[1]<=o[1]&&t[3]>=o[3];return r?n?!0:o[0]<=t[0]&&o[2]>=t[2]&&o[1]<=t[1]&&o[3]>=t[3]:n},K4=(e,t)=>{let r=Y4(e);return(Oc(r[0],t[0],t[2])||Oc(t[0],r[0],r[2]))&&(Oc(r[1],t[1],t[3])||Oc(t[1],r[1],r[3]))},Gs=({elements:e,bounds:t,type:r,errorMargin:o=0})=>{_l(t)&&(t=Ko(t));let n=[t[0]-o,t[1]-o,t[2]+o,t[3]+o],i=new Set;for(let a of e){if(i.has(a.id))continue;if(r==="overlap"?K4(a,n):r==="inside"?$x(a,n):$x(a,n,!0)){if(i.add(a.id),a.boundElements)for(let c of a.boundElements)i.add(c.id);ee(a)&&a.containerId&&i.add(a.containerId),Le(a)&&(a.startBinding&&i.add(a.startBinding.elementId),a.endBinding&&i.add(a.endBinding?.elementId))}}return e.filter(a=>i.has(a.id))};h();h();h();var Gx=e=>new Promise((t,r)=>{let o=new Image;o.onload=()=>{t(o)},o.onerror=n=>{r(n)},o.src=e}),og=async({fileIds:e,files:t,imageCache:r})=>{let o=new Map,n=new Map;return await Promise.all(e.reduce((i,a)=>{let s=t[a];return s&&!o.has(a)?(o.set(a,!0),i.concat((async()=>{try{if(s.mimeType===ae.binary)throw new Error("Only images can be added to ImageCache");let c=Gx(s.dataURL),l={image:c,mimeType:s.mimeType};r.set(a,l);let d=await c;r.set(a,{...l,image:d})}catch{n.set(a,!0)}})())):i},[])),{imageCache:r,updatedFiles:o,erroredFiles:n}},ng=e=>e.filter(t=>Zr(t)),zO=e=>e?.nodeName.toLowerCase()==="svg",Z4=async e=>{let t=new DOMParser().parseFromString(e,ae.svg),r=t.querySelector("svg");if(t.querySelector("parsererror")||!zO(r))throw new Error(E("errors.invalidSVGString"));if(r.hasAttribute("xmlns")||r.setAttribute("xmlns",mt),!r.hasAttribute("width")||!r.hasAttribute("height")){let n=r.getAttribute("viewBox"),i=r.getAttribute("width")||"50",a=r.getAttribute("height")||"50";if(n){let s=n.match(/\d+ +\d+ +(\d+) +(\d+)/);s&&([,i,a]=s)}r.setAttribute("width",i),r.setAttribute("height",a)}return r.outerHTML};var HO="<!-- svg-source:excalidraw -->",j4=e=>{let t=new _e;return t.replaceAllElements(Co(e),!1),t},$O=(e,t)=>{if(e.width<=t)return e;let o=document.createElement("canvas").getContext("2d");o.font=Ve({fontFamily:e.fontFamily,fontSize:e.fontSize});let n=e.text;if(o.measureText(n).width>t)for(let a=n.length;a>0;a--){let s=`${n.slice(0,a)}...`;if(o.measureText(s).width<=t){n=s;break}}return de(e,{text:n,width:t})},GO=(e,t)=>{let r=[],o=0,n=0;for(let i of e){if(le(i)){la(i)?o++:n++;let a=ir({x:i.x,y:i.y-ut.nameOffsetY,fontFamily:qt.Assistant,fontSize:ut.nameFontSize,lineHeight:ut.nameLineHeight,strokeColor:t.exportWithDarkMode?ut.nameColorDarkTheme:ut.nameColorLightTheme,text:sg(i,la(i)?o:n)});a.y-=a.height,a=$O(a,i.width),r.push(a)}r.push(i)}return r},q4=(e,t)=>(t=t||wr().frameRendering,{enabled:e?!0:t.enabled,outline:e?!1:t.outline,name:e?!1:t.name,clip:e?!0:t.clip}),J4=({elements:e,exportingFrame:t,frameRendering:r,exportWithDarkMode:o})=>{let n;return t?n=Gs({elements:e,bounds:t,type:"overlap"}):r.enabled&&r.name?n=GO(e,{exportWithDarkMode:o}):n=e,n},ag=async(e,t,r,{exportBackground:o,exportPadding:n=on,viewBackgroundColor:i,exportingFrame:a},s=(c,l)=>{let d=document.createElement("canvas");return d.width=c*t.exportScale,d.height=l*t.exportScale,{canvas:d,scale:t.exportScale}})=>{let c=j4(e);e=c.getNonDeletedElements();let l=q4(a??null,t.frameRendering??null),d=J4({elements:e,exportingFrame:a,exportWithDarkMode:t.exportWithDarkMode,frameRendering:l});a&&(n=0);let[u,m,p,f]=Ux(a?[a]:Wx(d),n),{canvas:g,scale:x=1}=s(p,f),y=wr(),{imageCache:w}=await og({imageCache:new Map,fileIds:ng(d).map(T=>T.fileId),files:r});return ig({canvas:g,rc:Ao.canvas(g),elements:d,visibleElements:d,scale:x,appState:{...t,frameRendering:l,viewBackgroundColor:o?i:null,scrollX:-u+n,scrollY:-m+n,zoom:y.zoom,shouldCacheIgnoreZoom:!1,theme:t.exportWithDarkMode?"dark":"light"},renderConfig:{canvasBackgroundColor:i,imageCache:w,renderGrid:!1,isExporting:!0}}),c.destroy(),g},Nc=async(e,t,r,o)=>{let n=j4(e);e=n.getNonDeletedElements();let i=q4(o?.exportingFrame??null,t.frameRendering??null),{exportPadding:a=on,exportWithDarkMode:s=!1,viewBackgroundColor:c,exportScale:l=1,exportEmbedScene:d}=t,{exportingFrame:u=null}=o||{},m=J4({elements:e,exportingFrame:u,exportWithDarkMode:s,frameRendering:i});u&&(a=0);let p="";if(d)try{p=await(await import("./image-LTLHTTSE.js")).encodeSvgMetadata({text:La(e,t,r||{},"local")})}catch(D){console.error(D)}let[f,g,x,y]=Ux(u?[u]:Wx(m),a),w=document.createElementNS(mt,"svg");w.setAttribute("version","1.1"),w.setAttribute("xmlns",mt),w.setAttribute("viewBox",`0 0 ${x} ${y}`),w.setAttribute("width",`${x*l}`),w.setAttribute("height",`${y*l}`),s&&w.setAttribute("filter",xl);let T="https://excalidraw.com/";v.VITE_IS_EXCALIDRAW_NPM_PACKAGE&&(T=window.EXCALIDRAW_ASSET_PATH||`https://unpkg.com/${v.VITE_PKG_NAME}@${v.PKG_VERSION}`,T?.startsWith("/")&&(T=T.replace("/",`${window.location.origin}/`)),T=`${T}/dist/excalidraw-assets/`);let C=-f+a,I=-g+a,A=Bu(e),P="";for(let D of A){let[M,R,N,B]=ue(D),K=(N-M)/2-(D.x-M),V=(B-R)/2-(D.y-R);P+=`<clipPath id=${D.id}>
58
- <rect transform="translate(${D.x+C} ${D.y+I}) rotate(${D.angle} ${K} ${V})"
59
- width="${D.width}"
60
- height="${D.height}"
61
- >
62
- </rect>
63
- </clipPath>`}if(w.innerHTML=`
64
- ${HO}
65
- ${p}
66
- <defs>
67
- <style class="style-fonts">
68
- @font-face {
69
- font-family: "Virgil";
70
- src: url("${T}Virgil.woff2");
71
- }
72
- @font-face {
73
- font-family: "Cascadia";
74
- src: url("${T}Cascadia.woff2");
75
- }
76
- @font-face {
77
- font-family: "Assistant";
78
- src: url("${T}Assistant-Regular.woff2");
79
- }
80
- </style>
81
- ${P}
82
- </defs>
83
- `,t.exportBackground&&c){let D=w.ownerDocument.createElementNS(mt,"rect");D.setAttribute("x","0"),D.setAttribute("y","0"),D.setAttribute("width",`${x}`),D.setAttribute("height",`${y}`),D.setAttribute("fill",c),w.appendChild(D)}let L=Ao.svg(w);return X4(m,L,w,r||{},{offsetX:C,offsetY:I,isExporting:!0,exportWithDarkMode:s,renderEmbeddables:o?.renderEmbeddables??!1,frameRendering:i,canvasBackgroundColor:c}),n.destroy(),w},Ux=(e,t)=>{let[r,o,n,i]=Me(e),a=Qt(r,n)+t*2,s=Qt(o,i)+t*2;return[r,o,a,s]},Q4=(e,t,r)=>{let[,,o,n]=Ux(e,t).map(i=>Math.trunc(i*r));return[o,n]};var Da=({elements:e,appState:t,files:r,maxWidthOrHeight:o,getDimensions:n,exportPadding:i,exportingFrame:a})=>{let{elements:s,appState:c}=Ma({elements:e,appState:t},null,null),{exportBackground:l,viewBackgroundColor:d}=c;return ag(s,{...c,offsetTop:0,offsetLeft:0,width:0,height:0},r||{},{exportBackground:l,exportPadding:i,viewBackgroundColor:d,exportingFrame:a},(u,m)=>{let p=document.createElement("canvas");if(o){typeof n=="function"&&console.warn("`getDimensions()` is ignored when `maxWidthOrHeight` is supplied.");let g=Math.max(u,m),x=o<g?o/g:t?.exportScale??1;return p.width=u*x,p.height=m*x,{canvas:p,scale:x}}let f=n?.(u,m)||{width:u,height:m};return p.width=f.width,p.height=f.height,{canvas:p,scale:f.scale??1}})},tg=async e=>{let{mimeType:t=ae.png,quality:r}=e;t===ae.png&&typeof r=="number"&&console.warn(`"quality" will be ignored for "${ae.png}" mimeType`),t==="image/jpg"&&(t=ae.jpg),t===ae.jpg&&!e.appState?.exportBackground&&(console.warn(`Defaulting "exportBackground" to "true" for "${ae.jpg}" mimeType`),e={...e,appState:{...e.appState,exportBackground:!0}});let o=await Da(e);return r=r||(/image\/jpe?g/.test(t)?.92:.8),new Promise((n,i)=>{o.toBlob(async a=>{if(!a)return i(new Error("couldn't export to blob"));a&&t===ae.png&&e.appState?.exportEmbedScene&&(a=await ek({blob:a,metadata:La(e.elements,e.appState,e.files||{},"local")})),n(a)},t,r)})},Ec=async({elements:e,appState:t=wr(),files:r={},exportPadding:o,renderEmbeddables:n,exportingFrame:i})=>{let{elements:a,appState:s}=Ma({elements:e,appState:t},null,null),c={...s,exportPadding:o};return Nc(a,c,r,{exportingFrame:i,renderEmbeddables:n})},LO=async e=>{if(e.type==="svg"){let t=await Ec(e);await Li(t.outerHTML)}else if(e.type==="png")await Vf(tg(e));else if(e.type==="json")await Uf(e.elements,e.files);else throw new Error("Invalid export type")};var Us=(e,{selectedElementIds:t},r)=>{e=we(e);let o=r&&Je(e,{selectedElementIds:t}),n=null,i=o?Se(e,{selectedElementIds:t},{includeBoundTextElement:!0}):e;return o&&(i.length===1&&le(i[0])?(n=i[0],i=Gs({elements:e,bounds:n,type:"overlap"})):i.length>1&&(i=Se(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}))),{exportingFrame:n,exportedElements:Co(i)}},Ws=async(e,t,r,o,{exportBackground:n,exportPadding:i=on,viewBackgroundColor:a,name:s,fileHandle:c=null,exportingFrame:l=null})=>{if(t.length===0)throw new Error(E("alerts.cannotExportEmptyCanvas"));if(e==="svg"||e==="clipboard-svg"){let u=await Nc(t,{exportBackground:n,exportWithDarkMode:r.exportWithDarkMode,viewBackgroundColor:a,exportPadding:i,exportScale:r.exportScale,exportEmbedScene:r.exportEmbedScene&&e==="svg"},o,{exportingFrame:l});if(e==="svg")return await wc(new Blob([u.outerHTML],{type:ae.svg}),{description:"Export to SVG",name:s,extension:r.exportEmbedScene?"excalidraw.svg":"svg",fileHandle:c});if(e==="clipboard-svg"){await Li(u.outerHTML);return}}let d=ag(t,r,o,{exportBackground:n,viewBackgroundColor:a,exportPadding:i,exportingFrame:l});if(e==="png"){let u=await Oi(d);return r.exportEmbedScene&&(u=await(await import("./image-LTLHTTSE.js")).encodePngMetadata({blob:u,metadata:La(t,r,o,"local")})),await wc(u,{description:"Export to PNG",name:s,extension:"png",fileHandle:c})}else if(e==="clipboard")try{let u=Oi(d);await Vf(u)}catch(u){throw console.warn(u),u.name==="CANVAS_POSSIBLY_TOO_BIG"?u:ta&&u.name==="TypeError"?new Error(`${E("alerts.couldNotCopyToClipboard")}
84
-
85
- ${E("hints.firefox_clipboard_write")}`):new Error(E("alerts.couldNotCopyToClipboard"))}else throw new Error("Unsupported export type")};h();var rk=async(e,t,r)=>{let{exportBackground:o,viewBackgroundColor:n,name:i,fileHandle:a}=t,s=Vx(a);if(!a||!tk(s))throw new Error("fileHandle should exist and should be of type svg or png when resaving");t={...t,exportEmbedScene:!0};let{exportedElements:c,exportingFrame:l}=Us(e,t,!1);return await Ws(s,c,t,r,{exportBackground:o,viewBackgroundColor:n,name:i,fileHandle:a,exportingFrame:l}),{fileHandle:a}};var oo=S(_(),1),Yx=U({name:"changeProjectName",trackEvent:!1,perform:(e,t,r)=>({appState:{...t,name:r},commitToHistory:!1}),PanelComponent:({appState:e,updateData:t,appProps:r,data:o})=>(0,oo.jsx)(dC,{label:E("labels.fileTitle"),value:e.name||"Unnamed",onChange:n=>t(n),isNameEditable:typeof r.name>"u"&&!e.viewModeEnabled,ignoreFocus:o?.ignoreFocus??!1})}),ok=U({name:"changeExportScale",trackEvent:{category:"export",action:"scale"},perform:(e,t,r)=>({appState:{...t,exportScale:r},commitToHistory:!1}),PanelComponent:({elements:e,appState:t,updateData:r})=>{let o=we(e),i=Je(o,t)?Se(o,t):o;return(0,oo.jsx)(oo.Fragment,{children:yl.map(a=>{let[s,c]=Q4(i,on,a),l=`${E("imageExportDialog.label.scale")} ${a}x (${s}x${c})`;return(0,oo.jsx)(be,{size:"small",type:"radio",icon:`${a}x`,name:"export-canvas-scale",title:l,"aria-label":l,id:"export-canvas-scale",checked:a===t.exportScale,onChange:()=>r(a)},a)})})}}),Kx=U({name:"changeExportBackground",trackEvent:{category:"export",action:"toggleBackground"},perform:(e,t,r)=>({appState:{...t,exportBackground:r},commitToHistory:!1}),PanelComponent:({appState:e,updateData:t})=>(0,oo.jsx)(Ns,{checked:e.exportBackground,onChange:r=>t(r),children:E("imageExportDialog.label.withBackground")})}),lg=U({name:"changeExportEmbedScene",trackEvent:{category:"export",action:"embedScene"},perform:(e,t,r)=>({appState:{...t,exportEmbedScene:r},commitToHistory:!1}),PanelComponent:({appState:e,updateData:t})=>(0,oo.jsxs)(Ns,{checked:e.exportEmbedScene,onChange:r=>t(r),children:[E("imageExportDialog.label.embedScene"),(0,oo.jsx)(go,{label:E("imageExportDialog.tooltip.embedScene"),long:!0,children:(0,oo.jsx)("div",{className:"excalidraw-tooltip-icon",children:RT})})]})}),kh=U({name:"saveToActiveFile",trackEvent:{category:"export"},predicate:(e,t,r,o)=>!!o.props.UIOptions.canvasActions.saveToActiveFile&&!!t.fileHandle&&!t.viewModeEnabled,perform:async(e,t,r,o)=>{let n=!!t.fileHandle;try{let{fileHandle:i}=vc(t.fileHandle)?await rk(e,t,o.files):await gh(e,t,o.files);return{commitToHistory:!1,appState:{...t,fileHandle:i,toast:n?{message:i?.name?E("toast.fileSavedToFilename").replace("{filename}",`"${i.name}"`):E("toast.fileSaved")}:null}}}catch(i){return i?.name!=="AbortError"?console.error(i):console.warn(i),{commitToHistory:!1}}},keyTest:e=>e.key===k.S&&e[k.CTRL_OR_CMD]&&!e.shiftKey}),zu=U({name:"saveFileToDisk",viewMode:!0,trackEvent:{category:"export"},perform:async(e,t,r,o)=>{try{let{fileHandle:n}=await gh(e,{...t,fileHandle:null},o.files);return{commitToHistory:!1,appState:{...t,openDialog:null,fileHandle:n,toast:{message:E("toast.fileSaved")}}}}catch(n){return n?.name!=="AbortError"?console.error(n):console.warn(n),{commitToHistory:!1}}},keyTest:e=>e.key===k.S&&e.shiftKey&&e[k.CTRL_OR_CMD],PanelComponent:({updateData:e})=>(0,oo.jsx)(be,{type:"button",icon:kT,title:E("buttons.saveAs"),"aria-label":E("buttons.saveAs"),showAriaLabel:Ke().editor.isMobile,hidden:!Go,onClick:()=>e(null),"data-testid":"save-as-button"})}),Ac=U({name:"loadScene",trackEvent:{category:"export"},predicate:(e,t,r,o)=>!!o.props.UIOptions.canvasActions.loadScene&&!t.viewModeEnabled,perform:async(e,t,r,o)=>{try{let{elements:n,appState:i,files:a}=await nx(t,e);return{elements:n,appState:i,files:a,commitToHistory:!0}}catch(n){return n?.name==="AbortError"?(console.warn(n),!1):{elements:e,appState:{...t,errorMessage:n.message},files:o.files,commitToHistory:!1}}},keyTest:e=>e[k.CTRL_OR_CMD]&&e.key===k.O}),nk=U({name:"exportWithDarkMode",trackEvent:{category:"export",action:"toggleTheme"},perform:(e,t,r)=>({appState:{...t,exportWithDarkMode:r},commitToHistory:!1}),PanelComponent:({appState:e,updateData:t})=>(0,oo.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"-45px",marginBottom:"10px"},children:(0,oo.jsx)(mC,{value:e.exportWithDarkMode?gt.DARK:gt.LIGHT,onChange:r=>{t(r===gt.DARK)},title:E("imageExportDialog.label.darkMode")})})});h();var ik="{}",Zx=U({name:"copyStyles",trackEvent:{category:"element"},perform:(e,t)=>{let r=[],o=e.find(n=>t.selectedElementIds[n.id]);if(r.push(o),o&&Xr(o)){let n=ye(o);r.push(n)}return o&&(ik=JSON.stringify(r)),{appState:{...t,toast:{message:E("toast.copyStyles")}},commitToHistory:!1}},contextItemLabel:"labels.copyStyles",keyTest:e=>e[k.CTRL_OR_CMD]&&e.altKey&&e.code===ve.C}),Xx=U({name:"pasteStyles",trackEvent:{category:"element"},perform:(e,t)=>{let r=JSON.parse(ik),o=r[0],n=r[1];if(!_l(o))return{elements:e,commitToHistory:!1};let i=Se(e,t,{includeBoundTextElement:!0}),a=i.map(s=>s.id);return{elements:e.map(s=>{if(a.includes(s.id)){let c=o;if(ee(s)&&s.containerId&&(c=n),!c)return s;let l=de(s,{backgroundColor:c?.backgroundColor,strokeWidth:c?.strokeWidth,strokeColor:c?.strokeColor,strokeStyle:c?.strokeStyle,fillStyle:c?.fillStyle,opacity:c?.opacity,roughness:c?.roughness,roundness:c.roundness?U2(c.roundness.type,s)?c.roundness:W2(s):null});if(ee(l)){let d=c.fontSize||Jt,u=c.fontFamily||pr;l=de(l,{fontSize:d,fontFamily:u,textAlign:c.textAlign||oa,lineHeight:c.lineHeight||mo(u)});let m=null;l.containerId&&(m=i.find(p=>ee(l)&&p.id===l.containerId)||null),br(l,m)}return l.type==="arrow"&&Le(c)&&(l=de(l,{startArrowhead:c.startArrowhead,endArrowhead:c.endArrowhead})),le(s)&&(l=de(l,{roundness:null,backgroundColor:"transparent"})),l}return s}),commitToHistory:!0}},contextItemLabel:"labels.pasteStyles",keyTest:e=>e[k.CTRL_OR_CMD]&&e.altKey&&e.code===ve.V});h();var jx=S(_(),1),UO=U({name:"toggleCanvasMenu",trackEvent:{category:"menu"},perform:(e,t)=>({appState:{...t,openMenu:t.openMenu==="canvas"?null:"canvas"},commitToHistory:!1}),PanelComponent:({appState:e,updateData:t})=>(0,jx.jsx)(be,{type:"button",icon:Qp,"aria-label":E("buttons.menu"),onClick:t,selected:e.openMenu==="canvas"})}),WO=U({name:"toggleEditMenu",trackEvent:{category:"menu"},perform:(e,t)=>({appState:{...t,openMenu:t.openMenu==="shape"?null:"shape"},commitToHistory:!1}),PanelComponent:({elements:e,appState:t,updateData:r})=>(0,jx.jsx)(be,{visible:Vs(t,we(e)),type:"button",icon:_T,"aria-label":E("buttons.edit"),onClick:r,selected:t.openMenu==="shape"})}),zs=U({name:"toggleShortcuts",viewMode:!0,trackEvent:{category:"menu",action:"toggleHelpDialog"},perform:(e,t,r,{focusContainer:o})=>(t.openDialog?.name==="help"&&o(),{appState:{...t,openDialog:t.openDialog?.name==="help"?null:{name:"help"}},commitToHistory:!1}),keyTest:e=>e.key===k.QUESTION_MARK});h();var Hu=S(_(),1),VO=e=>{if(e.length>=2){let t=e[0].groupIds;for(let r of t)if(e.reduce((o,n)=>o&&Es(n,r),!0))return!0}return!1},ak=(e,t,r)=>{let o=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});return o.length>=2&&!VO(o)},qx=U({name:"group",trackEvent:{category:"element"},perform:(e,t,r,o)=>{let n=o.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});if(n.length<2)return{appState:t,elements:e,commitToHistory:!1};let i=wi(t);if(i.length===1){let g=i[0],x=new Set(Et(e,g).map(T=>T.id)),y=new Set(n.map(T=>T.id));if(new Set([...Array.from(x),...Array.from(y)]).size===x.size)return{appState:t,elements:e,commitToHistory:!1}}let a=[...e];new Set(n.map(g=>g.frameId)).size>1&&sk(n).forEach((x,y)=>{a=Bc(a,x,t)});let c=tr(),l=He(n);a=a.map(g=>l.get(g.id)?de(g,{groupIds:O3(g.groupIds,c,t.editingGroupId)}):g);let d=Et(a,c),u=d[d.length-1],m=a.lastIndexOf(u),p=a.slice(m+1);return a=[...a.slice(0,m).filter(g=>!Es(g,c)),...d,...p],{appState:{...t,...Nb(c,{...t,selectedGroupIds:{}},we(a))},elements:a,commitToHistory:!0}},contextItemLabel:"labels.group",predicate:(e,t,r,o)=>ak(e,t,o),keyTest:e=>!e.shiftKey&&e[k.CTRL_OR_CMD]&&e.key===k.G,PanelComponent:({elements:e,appState:t,updateData:r,app:o})=>(0,Hu.jsx)(be,{hidden:!ak(e,t,o),type:"button",icon:(0,Hu.jsx)(ZT,{theme:t.theme}),onClick:()=>r(null),title:`${E("labels.group")} \u2014 ${H("CtrlOrCmd+G")}`,"aria-label":E("labels.group"),visible:Je(we(e),t)})}),Jx=U({name:"ungroup",trackEvent:{category:"element"},perform:(e,t,r,o)=>{if(wi(t).length===0)return{appState:t,elements:e,commitToHistory:!1};let i=[...e],a=[];i=i.map(u=>{$e(u)&&a.push(u.id);let m=N3(u.groupIds,t.selectedGroupIds);return m.length===u.groupIds.length?u:de(u,{groupIds:m})});let s=fr(t,we(i),t,null),c=o.scene.getSelectedElements(t),l=new Set(c.filter(u=>u.frameId).map(u=>u.frameId));return Bu(e).filter(u=>l.has(u.id)).forEach(u=>{u&&(i=cg(i,Fc(i,u,t),u,t))}),s.selectedElementIds=Object.entries(s.selectedElementIds).reduce((u,[m,p])=>(p&&!a.includes(m)&&(u[m]=!0),u),{}),{appState:{...t,...s},elements:i,commitToHistory:!0}},keyTest:e=>e.shiftKey&&e[k.CTRL_OR_CMD]&&e.key===k.G.toUpperCase(),contextItemLabel:"labels.ungroup",predicate:(e,t)=>wi(t).length>0,PanelComponent:({elements:e,appState:t,updateData:r})=>(0,Hu.jsx)(be,{type:"button",hidden:wi(t).length===0,icon:(0,Hu.jsx)(XT,{theme:t.theme}),onClick:()=>r(null),title:`${E("labels.ungroup")} \u2014 ${H("CtrlOrCmd+Shift+G")}`,"aria-label":E("labels.ungroup"),visible:Je(we(e),t)})});h();h();var lk=S(W(),1);var Qx=S(_(),1),eE=({color:e,onClick:t,name:r,src:o,isBeingFollowed:n,isCurrentUser:i})=>{let a=P3(r),[s,c]=(0,lk.useState)(!1),l=!s&&o,d=l?void 0:{background:e};return(0,Qx.jsx)("div",{className:G("Avatar",{"Avatar--is-followed":n,"Avatar--is-current-user":i}),style:d,onClick:t,children:l?(0,Qx.jsx)("img",{className:"Avatar-img",src:o,alt:a,referrerPolicy:"no-referrer",onError:()=>c(!0)}):a})};var zc=S(_(),1),YO=U({name:"goToCollaborator",viewMode:!0,trackEvent:{category:"collab"},perform:(e,t,r)=>!r.socketId||t.userToFollow?.socketId===r.socketId||r.isCurrentUser?{appState:{...t,userToFollow:null},commitToHistory:!1}:{appState:{...t,userToFollow:{socketId:r.socketId,username:r.username||""},openMenu:t.openMenu==="canvas"?null:t.openMenu},commitToHistory:!1},PanelComponent:({updateData:e,data:t,appState:r})=>{let{clientId:o,collaborator:n,withName:i,isBeingFollowed:a}=t,s=xs(o);return i?(0,zc.jsxs)("div",{className:"dropdown-menu-item dropdown-menu-item-base UserList__collaborator",onClick:()=>e(n),children:[(0,zc.jsx)(eE,{color:s,onClick:()=>{},name:n.username||"",src:n.avatarUrl,isBeingFollowed:a,isCurrentUser:n.isCurrentUser===!0}),n.username,(0,zc.jsx)("div",{className:"UserList__collaborator-follow-status-icon",style:{visibility:a?"visible":"hidden"},title:a?E("userList.hint.followStatus"):void 0,"aria-hidden":!0,children:af})]}):(0,zc.jsx)(eE,{color:s,onClick:()=>{e(n)},name:n.username||"",src:n.avatarUrl,isBeingFollowed:a,isCurrentUser:n.isCurrentUser===!0})}});h();var tE=U({name:"addToLibrary",trackEvent:{category:"element"},perform:(e,t,r,o)=>{let n=o.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});for(let i of ep)if(n.some(a=>a.type===i))return{commitToHistory:!1,appState:{...t,errorMessage:E(`errors.libraryElementTypeError.${i}`)}};return o.library.getLatestLibrary().then(i=>o.library.setLibrary([{id:tr(),status:"unpublished",elements:n.map(Ti),created:Date.now()},...i])).then(()=>({commitToHistory:!1,appState:{...t,toast:{message:E("toast.addedToLibrary")}}})).catch(i=>({commitToHistory:!1,appState:{...t,errorMessage:i.message}}))},contextItemLabel:"labels.addToLibrary"});h();h();var ck=(e,t)=>{let r=ys(e),o=to(e);return r.flatMap(n=>{let i=KO(n,o,t);return n.map(a=>de(a,{x:a.x+i.x,y:a.y+i.y}))})},KO=(e,t,{axis:r,position:o})=>{let n=to(e),[i,a]=r==="x"?["minX","maxX"]:["minY","maxY"],s={x:0,y:0};return o==="start"?{...s,[r]:t[i]-n[i]}:o==="end"?{...s,[r]:t[a]-n[a]}:{...s,[r]:(t[i]+t[a])/2-(n[i]+n[a])/2}};var Ys=S(_(),1),Zo=(e,t,r,o)=>{let n=o.scene.getSelectedElements(t);return n.length>1&&!n.some(i=>le(i))},Hc=(e,t,r,o)=>{let n=r.scene.getSelectedElements(t),i=ck(n,o),a=He(i);return ti(e.map(s=>a.get(s.id)||s),t,r)},ZO=U({name:"alignTop",trackEvent:{category:"element"},predicate:Zo,perform:(e,t,r,o)=>({appState:t,elements:Hc(e,t,o,{position:"start",axis:"y"}),commitToHistory:!0}),keyTest:e=>e[k.CTRL_OR_CMD]&&e.shiftKey&&e.key===k.ARROW_UP,PanelComponent:({elements:e,appState:t,updateData:r,app:o})=>(0,Ys.jsx)(be,{hidden:!Zo(e,t,null,o),type:"button",icon:zT,onClick:()=>r(null),title:`${E("labels.alignTop")} \u2014 ${H("CtrlOrCmd+Shift+Up")}`,"aria-label":E("labels.alignTop"),visible:Je(we(e),t)})}),XO=U({name:"alignBottom",trackEvent:{category:"element"},predicate:Zo,perform:(e,t,r,o)=>({appState:t,elements:Hc(e,t,o,{position:"end",axis:"y"}),commitToHistory:!0}),keyTest:e=>e[k.CTRL_OR_CMD]&&e.shiftKey&&e.key===k.ARROW_DOWN,PanelComponent:({elements:e,appState:t,updateData:r,app:o})=>(0,Ys.jsx)(be,{hidden:!Zo(e,t,null,o),type:"button",icon:HT,onClick:()=>r(null),title:`${E("labels.alignBottom")} \u2014 ${H("CtrlOrCmd+Shift+Down")}`,"aria-label":E("labels.alignBottom"),visible:Je(we(e),t)})}),jO=U({name:"alignLeft",trackEvent:{category:"element"},predicate:Zo,perform:(e,t,r,o)=>({appState:t,elements:Hc(e,t,o,{position:"start",axis:"x"}),commitToHistory:!0}),keyTest:e=>e[k.CTRL_OR_CMD]&&e.shiftKey&&e.key===k.ARROW_LEFT,PanelComponent:({elements:e,appState:t,updateData:r,app:o})=>(0,Ys.jsx)(be,{hidden:!Zo(e,t,null,o),type:"button",icon:$T,onClick:()=>r(null),title:`${E("labels.alignLeft")} \u2014 ${H("CtrlOrCmd+Shift+Left")}`,"aria-label":E("labels.alignLeft"),visible:Je(we(e),t)})}),qO=U({name:"alignRight",trackEvent:{category:"element"},predicate:Zo,perform:(e,t,r,o)=>({appState:t,elements:Hc(e,t,o,{position:"end",axis:"x"}),commitToHistory:!0}),keyTest:e=>e[k.CTRL_OR_CMD]&&e.shiftKey&&e.key===k.ARROW_RIGHT,PanelComponent:({elements:e,appState:t,updateData:r,app:o})=>(0,Ys.jsx)(be,{hidden:!Zo(e,t,null,o),type:"button",icon:GT,onClick:()=>r(null),title:`${E("labels.alignRight")} \u2014 ${H("CtrlOrCmd+Shift+Right")}`,"aria-label":E("labels.alignRight"),visible:Je(we(e),t)})}),JO=U({name:"alignVerticallyCentered",trackEvent:{category:"element"},predicate:Zo,perform:(e,t,r,o)=>({appState:t,elements:Hc(e,t,o,{position:"center",axis:"y"}),commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:r,app:o})=>(0,Ys.jsx)(be,{hidden:!Zo(e,t,null,o),type:"button",icon:VT,onClick:()=>r(null),title:E("labels.centerVertically"),"aria-label":E("labels.centerVertically"),visible:Je(we(e),t)})}),QO=U({name:"alignHorizontallyCentered",trackEvent:{category:"element"},predicate:Zo,perform:(e,t,r,o)=>({appState:t,elements:Hc(e,t,o,{position:"center",axis:"x"}),commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:r,app:o})=>(0,Ys.jsx)(be,{hidden:!Zo(e,t,null,o),type:"button",icon:YT,onClick:()=>r(null),title:E("labels.centerHorizontally"),"aria-label":E("labels.centerHorizontally"),visible:Je(we(e),t)})});h();h();var dk=(e,t)=>{let[r,o,n,i]=t.axis==="x"?["minX","midX","maxX","width"]:["minY","midY","maxY","height"],a=to(e),s=ys(e).map(u=>[u,to(u)]).sort((u,m)=>u[1][o]-m[1][o]),c=0;for(let u of s)c+=u[1][i];let l=(a[i]-c)/(s.length-1);if(l<0){let u=s.findIndex(g=>g[1][r]===a[r]),m=s.findIndex(g=>g[1][n]===a[n]),p=(s[m][1][o]-s[u][1][o])/(s.length-1),f=s[u][1][o];return s.flatMap(([g,x],y)=>{let w={x:0,y:0};return y!==u&&y!==m&&(f+=p,w[t.axis]=f-x[o]),g.map(T=>de(T,{x:T.x+w.x,y:T.y+w.y}))})}let d=a[r];return s.flatMap(([u,m])=>{let p={x:0,y:0};return p[t.axis]=d-m[r],d+=l,d+=m[i],u.map(f=>de(f,{x:f.x+p.x,y:f.y+p.y}))})};var rE=S(_(),1),uk=(e,t)=>{let r=t.scene.getSelectedElements(e);return r.length>1&&!r.some(o=>le(o))},mk=(e,t,r,o)=>{let n=r.scene.getSelectedElements(t),i=dk(n,o),a=He(i);return ti(e.map(s=>a.get(s.id)||s),t,r)},eN=U({name:"distributeHorizontally",trackEvent:{category:"element"},perform:(e,t,r,o)=>({appState:t,elements:mk(e,t,o,{space:"between",axis:"x"}),commitToHistory:!0}),keyTest:e=>!e[k.CTRL_OR_CMD]&&e.altKey&&e.code===ve.H,PanelComponent:({elements:e,appState:t,updateData:r,app:o})=>(0,rE.jsx)(be,{hidden:!uk(t,o),type:"button",icon:UT,onClick:()=>r(null),title:`${E("labels.distributeHorizontally")} \u2014 ${H("Alt+H")}`,"aria-label":E("labels.distributeHorizontally"),visible:Je(we(e),t)})}),tN=U({name:"distributeVertically",trackEvent:{category:"element"},perform:(e,t,r,o)=>({appState:t,elements:mk(e,t,o,{space:"between",axis:"y"}),commitToHistory:!0}),keyTest:e=>!e[k.CTRL_OR_CMD]&&e.altKey&&e.code===ve.V,PanelComponent:({elements:e,appState:t,updateData:r,app:o})=>(0,rE.jsx)(be,{hidden:!uk(t,o),type:"button",icon:WT,onClick:()=>r(null),title:`${E("labels.distributeVertically")} \u2014 ${H("Alt+V")}`,"aria-label":E("labels.distributeVertically"),visible:Je(we(e),t)})});h();h();var dg=e=>e<0?e+2*Math.PI:e>=2*Math.PI?e-2*Math.PI:e,oE=(e,t,r,o,n,i,a,s,c,l,d,u)=>{if(r.length===1){let[m]=r;return t==="rotation"?(rN(m,s,c,n,e.originalElements),Sn(m)):ee(m)&&(t==="nw"||t==="ne"||t==="sw"||t==="se")?(iN(m,t,i,s,c),Sn(m)):t&&aN(e.originalElements,a,m,t,i,s,c),!0}else if(r.length>1){if(t==="rotation")return sN(e,r,s,c,n,l,d),!0;if(t==="nw"||t==="ne"||t==="sw"||t==="se")return iE(e,r,t,i,s,c),!0}return!1},rN=(e,t,r,o,n)=>{let[i,a,s,c]=ue(e),l=(i+s)/2,d=(a+c)/2,u;le(e)?u=0:(u=5*Math.PI/2+Math.atan2(r-d,t-l),o&&(u+=Nn/2,u-=u%Nn),u=dg(u));let m=zi(e);if(Y(e,{angle:u}),m){let p=_e.getScene(e)?.getElement(m);p&&!Le(e)&&Y(p,{angle:u})}},oN=(e,t,r,o)=>me(e)||Gt(e)?{points:za(0,t,za(1,r,e.points,o),o)}:{},nE=(e,t,r)=>{let o=e.width;if($e(e)){let s=lt(e);s&&(o=qr(s))}let i=e.fontSize*(t/o);if(i<Ym)return null;let a=co(e.text,Ve({fontSize:i,fontFamily:e.fontFamily}),e.lineHeight);return{size:i,baseline:a.baseline+(r-a.height)}},nN=(e,t)=>({n:/^(n|ne|nw)$/.test(e)||t&&/^(s|se|sw)$/.test(e),s:/^(s|se|sw)$/.test(e)||t&&/^(n|ne|nw)$/.test(e),w:/^(w|nw|sw)$/.test(e)||t&&/^(e|ne|se)$/.test(e),e:/^(e|ne|se)$/.test(e)||t&&/^(w|nw|sw)$/.test(e)}),iN=(e,t,r,o,n)=>{let[i,a,s,c]=ue(e),l=(i+s)/2,d=(a+c)/2,[u,m]=Ie(o,n,l,d,-e.angle),p;switch(t){case"se":p=Math.max((u-i)/(s-i),(m-a)/(c-a));break;case"nw":p=Math.max((s-u)/(s-i),(c-m)/(c-a));break;case"ne":p=Math.max((u-i)/(s-i),(c-m)/(c-a));break;case"sw":p=Math.max((s-u)/(s-i),(m-a)/(c-a));break}if(p>0){let f=e.width*p,g=e.height*p,x=nE(e,f,g);if(x===null)return;let[y,w,T,C]=ws(e,f,g,!1),I=(i-y)/2,A=(a-w)/2,P=(s-T)/2,L=(c-C)/2,[D,M]=Zp(nN(t,r),e.x,e.y,e.angle,I,A,P,L);Y(e,{fontSize:x.size,width:f,height:g,baseline:x.baseline,x:D,y:M})}},aN=(e,t,r,o,n,i,a)=>{let s=e.get(r.id),[c,l,d,u]=ws(s,s.width,s.height,!0),m=[c,l],p=[d,u],f=$u(m,p),g=tt([i,a],f,-s.angle),[x,y,w,T]=ws(r,r.width,r.height,!0),C=w-x,I=T-y,A=p[0]-m[0],P=p[1]-m[1],L=A/C,D=P/I,M={},R=ye(r);o.includes("e")&&(L=(g[0]-m[0])/C),o.includes("s")&&(D=(g[1]-m[1])/I),o.includes("w")&&(L=(p[0]-g[0])/C),o.includes("n")&&(D=(p[1]-g[1])/I);let N=s.width,B=s.height,K=r.width*L,V=r.height*D;if(n&&(K=2*K-N,V=2*V-B),t){let ur=Math.abs(K)/N,li=Math.abs(V)/B;if(o.length===1&&(V*=ur,K*=li),o.length===2){let Mr=Math.max(ur,li);K=N*Mr*Math.sign(K),V=B*Mr*Math.sign(V)}}if(R){let ur=e.get(R.id);if(ur&&(M={fontSize:ur.fontSize,baseline:ur.baseline}),t){let li={...r,width:K,height:V},Mr=nE(R,qr(li),Hi(li,R));if(Mr===null)return;M={fontSize:Mr.size,baseline:Mr.baseline}}else{let li=mg(Ve(R),R.lineHeight),Mr=ug(R.fontSize,R.lineHeight);K=Math.max(K,li),V=Math.max(V,Mr)}}let[ne,Q,X,se]=ws(s,K,V,!0),O=X-ne,F=se-Q,$=[...m];if(["n","w","nw"].includes(o)&&($=[p[0]-Math.abs(O),p[1]-Math.abs(F)]),o==="ne"){let ur=[m[0],p[1]];$=[ur[0],ur[1]-Math.abs(F)]}if(o==="sw"){let ur=[p[0],m[1]];$=[ur[0]-Math.abs(O),ur[1]]}t&&(["s","n"].includes(o)&&($[0]=f[0]-O/2),["e","w"].includes(o)&&($[1]=f[1]-F/2));let j=K<0,q=V<0;j&&(o.includes("e")&&($[0]-=Math.abs(O)),o.includes("w")&&($[0]+=Math.abs(O))),q&&(o.includes("s")&&($[1]-=Math.abs(F)),o.includes("n")&&($[1]+=Math.abs(F))),n&&($[0]=f[0]-Math.abs(O)/2,$[1]=f[1]-Math.abs(F)/2);let J=s.angle,te=tt($,f,J),ce=[$[0]+Math.abs(O)/2,$[1]+Math.abs(F)/2],it=tt(ce,f,J);$=tt(te,it,-J);let Ge=[...$],Be=s.x-ne,ke=s.y-Q;Ge[0]+=Be,Ge[1]+=ke;let Mt=Ge[0],ol=Ge[1],vm,Tm;(me(r)||Gt(r))&&(vm=za(1,V,s.points,!0),Tm=za(0,K,vm,!0));let _n={width:Math.abs(K),height:Math.abs(V),x:Mt,y:ol,points:Tm};if("scale"in r&&"scale"in s&&Y(r,{scale:[(Math.sign(X-s.x)||s.scale[0])*s.scale[0],(Math.sign(se-s.y)||s.scale[1])*s.scale[1]]}),Le(r)&&R&&t){let ur=_n.width/r.width*R.fontSize;if(ur<Ym)return;M.fontSize=ur}_n.width!==0&&_n.height!==0&&Number.isFinite(_n.x)&&Number.isFinite(_n.y)&&(Y(r,_n),Sn(r,{newSize:{width:_n.width,height:_n.height}}),R&&M!=null&&Y(R,{fontSize:M.fontSize,baseline:M.baseline}),Ks(r,o,t))},iE=(e,t,r,o,n,i)=>{let a=t.reduce((M,R)=>{let N=e.originalElements.get(R.id);return N&&M.push({orig:N,latest:R}),M},[]),s=a.reduce((M,{orig:R})=>{if(!me(R))return M;let N=zi(R);if(!N)return M;let B=e.originalElements.get(N)??null;if(!$e(B))return M;let K=re.getBoundTextElementPosition(R,B);return[...M,{...B,...K}]},[]),{minX:c,minY:l,maxX:d,maxY:u,midX:m,midY:p}=to(a.map(({orig:M})=>M).concat(s)),f=r,g={ne:[c,u],se:[c,l],sw:[d,l],nw:[d,u]},[x,y]=o?[m,p]:g[f],w=Math.max(Math.abs(n-x)/(d-c)||0,Math.abs(i-y)/(u-l)||0)*(o?2:1);if(w===0)return;let T={ne:[n>=x,i<=y],se:[n>=x,i>=y],sw:[n<=x,i>=y],nw:[n<=x,i<=y]},[C,I]=T[f].map(M=>M?1:-1),A=C<0,P=I<0,L=[];for(let{orig:M,latest:R}of a){if(ee(M)&&$e(M))continue;let N=M.width*w,B=M.height*w,K=dg(M.angle*C*I),V=me(M)||Gt(M),ne=M.x-x,Q=M.y-y,X=A&&!V?N:0,se=P&&!V?B:0,O=x+C*(ne*w+X),F=y+I*(Q*w+se),$=oN(M,N*C,B*I,!1),j={x:O,y:F,width:N,height:B,angle:K,...$};if(ko(M)&&a.length===1&&(j.scale=[M.scale[0]*C,M.scale[1]*I]),me(M)&&(A||P)){let J=$c(M,M.points),te=$c({...M,x:O,y:F},$.points),ce=[M.x,M.y],it=[O,F],Ge=Be=>{let ke=Be==="x"?0:1;return(te[ke+2]-it[ke]-(ce[ke]-J[ke])*w+(J[ke+2]-ce[ke])*w-(it[ke]-te[ke]))/2};A&&(j.x-=Ge("x")),P&&(j.y-=Ge("y"))}if(ee(M)){let J=nE(M,N,B);if(!J)return;j.fontSize=J.size,j.baseline=J.baseline}let q=e.originalElements.get(zi(M)??"");if(q){let J=q.fontSize*w;if(J<Ym)return;j.boundTextFontSize=J}L.push({element:R,update:j})}let D=L.map(({element:M})=>M);for(let{element:M,update:{boundTextFontSize:R,...N}}of L){let{width:B,height:K,angle:V}=N;Y(M,N,!1),Sn(M,{simultaneouslyUpdated:D,newSize:{width:B,height:K}});let ne=ye(M);ne&&R&&(Y(ne,{fontSize:R,angle:me(M)?void 0:V},!1),Ks(M,r,!0))}_e.getScene(L[0].element)?.informMutation()},sN=(e,t,r,o,n,i,a)=>{let s=5*Math.PI/2+Math.atan2(o-a,r-i);n&&(s+=Nn/2,s-=s%Nn),t.filter(c=>!le(c)).forEach(c=>{let[l,d,u,m]=ue(c),p=(l+u)/2,f=(d+m)/2,g=e.originalElements.get(c.id)?.angle??c.angle,[x,y]=Ie(p,f,i,a,s+g-c.angle);Y(c,{x:c.x+(x-p),y:c.y+(y-f),angle:dg(s+g)},!1),Sn(c,{simultaneouslyUpdated:t});let w=ye(c);w&&!Le(c)&&Y(w,{x:w.x+(x-p),y:w.y+(y-f),angle:dg(s+g)},!1)}),_e.getScene(t[0])?.informMutation()},aE=(e,t,r,o)=>{let[n,i,a,s]=t.length===1?ue(t[0]):Me(t),c=(n+a)/2,l=(i+s)/2,d=t.length===1?t[0].angle:0;switch([r,o]=Ie(r,o,c,l,-d),e){case"n":return Ie(r-(n+a)/2,o-i,0,0,d);case"s":return Ie(r-(n+a)/2,o-s,0,0,d);case"w":return Ie(r-n,o-(i+s)/2,0,0,d);case"e":return Ie(r-a,o-(i+s)/2,0,0,d);case"nw":return Ie(r-n,o-i,0,0,d);case"ne":return Ie(r-a,o-i,0,0,d);case"sw":return Ie(r-n,o-s,0,0,d);case"se":return Ie(r-a,o-s,0,0,d);default:return[0,0]}},sE=(e,t)=>{let[,[r,o]]=t.points;return e==="nw"&&(r<0||o<0)||e==="ne"&&r>=0||e==="sw"&&r<=0||e==="se"&&(r>0||o>0)?"end":"origin"};var lE=U({name:"flipHorizontal",trackEvent:{category:"element"},perform:(e,t,r,o)=>({elements:ti(pk(e,t,"horizontal"),t,o),appState:t,commitToHistory:!0}),keyTest:e=>e.shiftKey&&e.code===ve.H,contextItemLabel:"labels.flipHorizontal"}),cE=U({name:"flipVertical",trackEvent:{category:"element"},perform:(e,t,r,o)=>({elements:ti(pk(e,t,"vertical"),t,o),appState:t,commitToHistory:!0}),keyTest:e=>e.shiftKey&&e.code===ve.V&&!e[k.CTRL_OR_CMD],contextItemLabel:"labels.flipVertical"}),pk=(e,t,r)=>{let o=Se(we(e),t,{includeBoundTextElement:!0,includeElementsInFrames:!0}),n=lN(o,t,r),i=He(n);return e.map(a=>i.get(a.id)||a)},lN=(e,t,r)=>{let{minX:o,minY:n,maxX:i,maxY:a}=to(e);return iE({originalElements:He(e)},e,"nw",!0,r==="horizontal"?i:o,r==="horizontal"?n:a),(ri(t)?Gu:Uu)(e),e};h();var Gc=U({name:"copy",trackEvent:{category:"element"},perform:async(e,t,r,o)=>{let n=o.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});try{await Uf(n,o.files,r)}catch(i){return{commitToHistory:!1,appState:{...t,errorMessage:i.message}}}return{commitToHistory:!1}},contextItemLabel:"labels.copy",keyTest:void 0}),dE=U({name:"paste",trackEvent:{category:"element"},perform:async(e,t,r,o)=>{let n;try{n=await wC()}catch(i){return i.name==="AbortError"||i.name==="NotAllowedError"?!1:(console.error(`actionPaste ${i.name}: ${i.message}`),ta?{commitToHistory:!1,appState:{...t,errorMessage:E("hints.firefox_clipboard_write")}}:{commitToHistory:!1,appState:{...t,errorMessage:E("errors.asyncPasteFailedOnRead")}})}try{o.pasteFromClipboard(EC({types:n}))}catch(i){return console.error(i),{commitToHistory:!1,appState:{...t,errorMessage:E("errors.asyncPasteFailedOnParse")}}}return{commitToHistory:!1}},contextItemLabel:"labels.paste",keyTest:void 0}),pg=U({name:"cut",trackEvent:{category:"element"},perform:(e,t,r,o)=>(Gc.perform(e,t,r,o),eu.perform(e,t)),contextItemLabel:"labels.cut",keyTest:e=>e[k.CTRL_OR_CMD]&&e.key===k.X}),fg=U({name:"copyAsSvg",trackEvent:{category:"element"},perform:async(e,t,r,o)=>{if(!o.canvas)return{commitToHistory:!1};let{exportedElements:n,exportingFrame:i}=Us(e,t,!0);try{return await Ws("clipboard-svg",n,t,o.files,{...t,exportingFrame:i}),{commitToHistory:!1}}catch(a){return console.error(a),{appState:{...t,errorMessage:a.message},commitToHistory:!1}}},predicate:e=>Gf&&e.length>0,contextItemLabel:"labels.copyAsSvg"}),hg=U({name:"copyAsPng",trackEvent:{category:"element"},perform:async(e,t,r,o)=>{if(!o.canvas)return{commitToHistory:!1};let n=o.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),{exportedElements:i,exportingFrame:a}=Us(e,t,!0);try{return await Ws("clipboard",i,t,o.files,{...t,exportingFrame:a}),{appState:{...t,toast:{message:E("toast.copyToClipboardAsPng",{exportSelection:n.length?E("toast.selection"):E("toast.canvas"),exportColorScheme:t.exportWithDarkMode?E("buttons.darkMode"):E("buttons.lightMode")})}},commitToHistory:!1}}catch(s){return console.error(s),{appState:{...t,errorMessage:s.message},commitToHistory:!1}}},predicate:e=>hc&&e.length>0,contextItemLabel:"labels.copyAsPng",keyTest:e=>e.code===ve.C&&e.altKey&&e.shiftKey}),gg=U({name:"copyText",trackEvent:{category:"element"},perform:(e,t,r,o)=>{let i=o.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}).reduce((a,s)=>(ee(s)&&a.push(s.text),a),[]).join(`
86
-
87
- `);return Li(i),{commitToHistory:!1}},predicate:(e,t,r,o)=>Gf&&o.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}).some(ee),contextItemLabel:"labels.copyText"});h();var bg=U({name:"gridMode",viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.gridSize},perform(e,t){return{appState:{...t,gridSize:this.checked(t)?null:fi,objectsSnapModeEnabled:!1},commitToHistory:!1}},checked:e=>e.gridSize!==null,predicate:(e,t,r)=>typeof r.gridModeEnabled>"u",contextItemLabel:"labels.showGrid",keyTest:e=>e[k.CTRL_OR_CMD]&&e.code===ve.QUOTE});h();var Uc=U({name:"zenMode",viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.zenModeEnabled},perform(e,t){return{appState:{...t,zenModeEnabled:!this.checked(t)},commitToHistory:!1}},checked:e=>e.zenModeEnabled,predicate:(e,t,r)=>typeof r.zenModeEnabled>"u",contextItemLabel:"buttons.zenMode",keyTest:e=>!e[k.CTRL_OR_CMD]&&e.altKey&&e.code===ve.Z});h();var uE=U({name:"objectsSnapMode",viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.objectsSnapModeEnabled},perform(e,t){return{appState:{...t,objectsSnapModeEnabled:!this.checked(t),gridSize:null},commitToHistory:!1}},checked:e=>e.objectsSnapModeEnabled,predicate:(e,t,r)=>typeof r.objectsSnapModeEnabled>"u",contextItemLabel:"buttons.objectsSnapMode",keyTest:e=>!e[k.CTRL_OR_CMD]&&e.altKey&&e.code===ve.S});h();var $a=U({name:"stats",viewMode:!0,trackEvent:{category:"menu"},perform(e,t){return{appState:{...t,showStats:!this.checked(t)},commitToHistory:!1}},checked:e=>e.showStats,contextItemLabel:"stats.title",keyTest:e=>!e[k.CTRL_OR_CMD]&&e.altKey&&e.code===ve.SLASH});h();h();var cN=(e,t,r,o,n,i)=>{let{zoom:a}=o,s=180*r/Math.PI,c=e*(a.value-1)/2,l=t*(a.value-1)/2;return e>n&&a.value!==1&&(c=n*(a.value-1)/2),t>i&&a.value!==1&&(l=i*(a.value-1)/2),`translate(${c}px, ${l}px) scale(${a.value}) rotate(${s}deg)`},Wc={},Vc=(e,t)=>{let r=Wc[e]||(Wc[e]={height:t});return r.height=t,r},xg=e=>{Wc[e]&&delete Wc[e]},fk=e=>Wc[e]?.height??null,mE=({id:e,onChange:t,onSubmit:r,getViewportCoords:o,element:n,canvas:i,excalidrawContainer:a,app:s})=>{let c=(N,B)=>{if(!B.style.fontFamily||!B.style.fontSize)return!1;let K=B.style.fontFamily.replace(/"/g,"");return Cl({fontFamily:N.fontFamily})!==K||`${N.fontSize}px`!==B.style.fontSize},l=()=>{let N=s.state,B=_e.getScene(n)?.getElement(e);if(!B)return;let{textAlign:K,verticalAlign:V}=B;if(B&&ee(B)){let ne=B.x,Q=B.y,X=lt(B),se=B.width,O=B.height,F=B.width,$=B.height;if(X&&B.containerId){if(Le(X)){let Mt=re.getBoundTextElementPosition(X,B);ne=Mt.x,Q=Mt.y}let Be=c(B,d),ke;if(Be?ke=Vc(X.id,X.height):(ke=Wc[X.id],ke||(ke=Vc(X.id,X.height))),se=qr(X),O=Hi(X,B),!Le(X)&&$>O){let Mt=$i($,X.type);Y(X,{height:Mt});return}else if(!Le(X)&&X.height>ke.height&&$<O){let Mt=$i($,X.type);Y(X,{height:Mt})}else{let{y:Mt}=Yc(X,B);Q=Mt}}let[j,q]=o(ne,Q),J=d.selectionStart,te=d.selectionEnd,ce=d.value.length;if(J===te&&te!==ce){let Be=ce-te;d.selectionStart=d.value.length-Be,d.selectionEnd=d.value.length-Be}X?F+=.5:(se=(N.width-8-j)/N.zoom.value,F=Math.min(F,se));let it=B.lineHeight;Wm&&(it=dh({...B,fontSize:Math.round(B.fontSize)}));let Ge=(N.height-q)/N.zoom.value;Object.assign(d.style,{font:Ve(B),lineHeight:it,width:`${F}px`,height:`${$}px`,left:`${j}px`,top:`${q}px`,transform:cN(F,$,hk(B),N,se,Ge),textAlign:K,verticalAlign:V,color:B.strokeColor,opacity:B.opacity/100,filter:"var(--theme-filter)",maxHeight:`${Ge}px`}),d.scrollTop=0,io()&&(d.style.fontFamily=Cl(B)),Y(B,{x:ne,y:Q})}},d=document.createElement("textarea");d.dir="auto",d.tabIndex=0,d.dataset.type="wysiwyg",d.wrap="off",d.classList.add("excalidraw-wysiwyg");let u="pre",m="normal";$e(n)&&(u="pre-wrap",m="break-word"),Object.assign(d.style,{position:"absolute",display:"inline-block",minHeight:"1em",backfaceVisibility:"hidden",margin:0,padding:0,border:0,outline:0,resize:"none",background:"transparent",overflow:"hidden",zIndex:"var(--zIndex-wysiwyg)",wordBreak:m,whiteSpace:u,overflowWrap:"break-word",boxSizing:"content-box"}),d.value=n.originalText,l(),t&&(d.onpaste=async N=>{let B=await Wf(N,!0);if(!B.text)return;let K=ha(B.text);if(!K)return;let V=lt(n),ne=Ve({fontSize:s.state.currentItemFontSize,fontFamily:s.state.currentItemFontFamily});if(V){let Q=ga(`${d.value}${K}`,ne,qr(V)),X=Wu(Q,ne);d.style.width=`${X}px`}},d.oninput=()=>{t(ha(d.value))}),d.onkeydown=N=>{if(!N.shiftKey&&Bf.keyTest(N))N.preventDefault(),s.actionManager.executeAction(Bf),l();else if(!N.shiftKey&&zf.keyTest(N))N.preventDefault(),s.actionManager.executeAction(zf),l();else if(z1.keyTest(N))s.actionManager.executeAction(z1);else if(H1.keyTest(N))s.actionManager.executeAction(H1);else if(N.key===k.ESCAPE)N.preventDefault(),C=!0,I();else if(N.key===k.ENTER&&N[k.CTRL_OR_CMD]){if(N.preventDefault(),N.isComposing||N.keyCode===229)return;C=!0,I()}else if(N.key===k.TAB||N[k.CTRL_OR_CMD]&&(N.code===ve.BRACKET_LEFT||N.code===ve.BRACKET_RIGHT)){if(N.preventDefault(),N.isComposing)return;N.shiftKey||N.code===ve.BRACKET_LEFT?y():x(),d.dispatchEvent(new Event("input"))}};let p=4,f=" ".repeat(p),g=new RegExp(`^ {1,${p}}`),x=()=>{let{selectionStart:N,selectionEnd:B}=d,K=w(),V=d.value;K.forEach(ne=>{let Q=V.slice(0,ne),X=V.slice(ne);V=`${Q}${f}${X}`}),d.value=V,d.selectionStart=N+p,d.selectionEnd=B+p*K.length},y=()=>{let{selectionStart:N,selectionEnd:B}=d,K=w(),V=[],ne=d.value;K.forEach(Q=>{let X=ne.slice(Q,Q+p).match(g);if(X){let se=ne.slice(0,Q),O=ne.slice(Q+X[0].length);ne=`${se}${O}`,V.push(Q)}}),d.value=ne,V.length&&(N>V[V.length-1]?d.selectionStart=Math.max(N-p,V[V.length-1]):d.selectionStart=N,d.selectionEnd=Math.max(d.selectionStart,B-p*V.length))},w=()=>{let{selectionStart:N,selectionEnd:B,value:K}=d,V=K.slice(0,N).match(/[^\n]*$/)[0].length;return N=N-V,K.slice(N,B).split(`
88
- `).reduce((Q,X,se,O)=>Q.concat(se?Q[se-1]+O[se-1].length+1:N),[]).reverse()},T=N=>{N.preventDefault(),N.stopPropagation()},C=!1,I=()=>{A();let N=_e.getScene(n)?.getElement(n.id);if(!N)return;let B=d.value,K=lt(N);if(K){if(B=N.text,d.value.trim()){let V=zi(K);!V||V!==n.id?Y(K,{boundElements:(K.boundElements||[]).concat({type:"text",id:n.id})}):Le(K)&&un(K)}else Y(K,{boundElements:K.boundElements?.filter(V=>!ee(V))});br(N,K)}r({text:B,viaKeyboard:C,originalText:d.value})},A=()=>{M||(M=!0,d.onblur=null,d.oninput=null,d.onkeydown=null,R&&R.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("wheel",T,!0),window.removeEventListener("pointerdown",L),window.removeEventListener("pointerup",P),window.removeEventListener("blur",I),window.removeEventListener("beforeunload",I),D(),d.remove())},P=N=>{window.removeEventListener("pointerup",P);let B=N?.target,K=B instanceof HTMLElement&&B.classList.contains("active-color");setTimeout(()=>{if(d.onblur=I,K){let V=(Q,X)=>{Q.find(O=>O.removedNodes.length>0&&O.removedNodes[0].dataset?.radixPopperContentWrapper!==void 0)&&(setTimeout(()=>{d.focus()}),X.disconnect())};new MutationObserver(V).observe(document.querySelector(".excalidraw-container"),{childList:!0})}K||d.focus()})},L=N=>{let B=N.target instanceof HTMLElement&&N.target.classList.contains("active-color");((N.target instanceof HTMLElement||N.target instanceof SVGElement)&&N.target.closest(`.${Vm.SHAPE_ACTIONS_MENU}`)&&!Hn(N.target)||B)&&(d.onblur=null,window.addEventListener("pointerup",P),window.addEventListener("blur",I))},D=_e.getScene(n).addCallback(()=>{l(),!!document.activeElement?.closest(".color-picker-content")||d.focus()}),M=!1;d.select(),P();let R=null;i&&"ResizeObserver"in window?(R=new window.ResizeObserver(()=>{l()}),R.observe(i)):window.addEventListener("resize",l),window.addEventListener("pointerdown",L),window.addEventListener("wheel",T,{passive:!1,capture:!0}),window.addEventListener("beforeunload",I),a?.querySelector(".excalidraw-textEditorContainer").appendChild(d)};var pE=U({name:"unbindText",contextItemLabel:"labels.unbindText",trackEvent:{category:"element"},predicate:(e,t,r,o)=>o.scene.getSelectedElements(t).some(i=>Xr(i)),perform:(e,t,r,o)=>(o.scene.getSelectedElements(t).forEach(i=>{let a=ye(i);if(a){let{width:s,height:c,baseline:l}=co(a.originalText,Ve(a),a.lineHeight),d=fk(i.id);xg(i.id);let{x:u,y:m}=Yc(i,a);Y(a,{containerId:null,width:s,height:c,baseline:l,text:a.originalText,x:u,y:m}),Y(i,{boundElements:i.boundElements?.filter(p=>p.id!==a.id),height:d||i.height})}}),{elements:e,appState:t,commitToHistory:!0})}),fE=U({name:"bindText",contextItemLabel:"labels.bindText",trackEvent:{category:"element"},predicate:(e,t,r,o)=>{let n=o.scene.getSelectedElements(t);if(n.length===2){let i=ee(n[0])||ee(n[1]),a;if($n(n[0])?a=n[0]:$n(n[1])&&(a=n[1]),i&&a&&ye(a)===null)return!0}return!1},perform:(e,t,r,o)=>{let n=o.scene.getSelectedElements(t),i,a;ee(n[0])&&$n(n[1])?(i=n[0],a=n[1]):(i=n[1],a=n[0]),Y(i,{containerId:a.id,verticalAlign:Nt.MIDDLE,textAlign:na.CENTER}),Y(a,{boundElements:(a.boundElements||[]).concat({type:"text",id:i.id})});let s=a.height;return br(i,a),Vc(a.id,s),{elements:dN(e,a,i),appState:{...t,selectedElementIds:{[a.id]:!0}},commitToHistory:!0}}}),dN=(e,t,r)=>{let o=e.slice(),n=o.findIndex(a=>a.id===r.id);o.splice(n,1);let i=o.findIndex(a=>a.id===t.id);return o.splice(i+1,0,r),o},uN=(e,t,r)=>{let o=e.slice(),n=o.findIndex(a=>a.id===t.id);o.splice(n,1);let i=o.findIndex(a=>a.id===r.id);return o.splice(i,0,t),o},gk=U({name:"wrapTextInContainer",contextItemLabel:"labels.createContainerFromText",trackEvent:{category:"element"},predicate:(e,t,r,o)=>{let n=o.scene.getSelectedElements(t),i=n.every(a=>ee(a));return n.length>0&&i},perform:(e,t,r,o)=>{let n=o.scene.getSelectedElements(t),i=e.slice(),a={};for(let s of n)if(ee(s)){let c=uo({type:"rectangle",backgroundColor:t.currentItemBackgroundColor,boundElements:[...s.boundElements||[],{id:s.id,type:"text"}],angle:s.angle,fillStyle:t.currentItemFillStyle,strokeColor:t.currentItemStrokeColor,roughness:t.currentItemRoughness,strokeWidth:t.currentItemStrokeWidth,strokeStyle:t.currentItemStrokeStyle,roundness:t.currentItemRoundness==="round"?{type:Gn("rectangle")?Ct.ADAPTIVE_RADIUS:Ct.PROPORTIONAL_RADIUS}:null,opacity:100,locked:!1,x:s.x-Pt,y:s.y-Pt,width:$i(s.width,"rectangle"),height:$i(s.height,"rectangle"),groupIds:s.groupIds,frameId:s.frameId});if(s.boundElements?.length){let l=s.boundElements.filter(u=>u.type==="arrow").map(u=>u.id);i.filter(u=>l.includes(u.id)).forEach(u=>{let m=u.startBinding,p=u.endBinding;m?.elementId===s.id&&(m={...m,elementId:c.id}),p?.elementId===s.id&&(p={...p,elementId:c.id}),(m||p)&&Y(u,{startBinding:m,endBinding:p},!1)})}Y(s,{containerId:c.id,verticalAlign:Nt.MIDDLE,boundElements:null,textAlign:na.CENTER},!1),br(s,c),i=uN([...i,c],c,s),a[c.id]=!0}return{elements:i,appState:{...t,selectedElementIds:a},commitToHistory:!0}}});h();var bk=e=>e.every(t=>!t.locked),hE=U({name:"toggleElementLock",trackEvent:{category:"element"},predicate:(e,t,r,o)=>!o.scene.getSelectedElements(t).some(i=>i.locked&&i.frameId),perform:(e,t,r,o)=>{let n=o.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});if(!n.length)return!1;let i=bk(n),a=He(n);return{elements:e.map(s=>a.has(s.id)?de(s,{locked:i}):s),appState:{...t,selectedLinearElement:i?null:t.selectedLinearElement},commitToHistory:!0}},contextItemLabel:(e,t,r)=>{let o=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1});return o.length===1&&!le(o[0])?o[0].locked?"labels.elementLock.unlock":"labels.elementLock.lock":bk(o)?"labels.elementLock.lockAll":"labels.elementLock.unlockAll"},keyTest:(e,t,r,o)=>e.key.toLocaleLowerCase()===k.L&&e[k.CTRL_OR_CMD]&&e.shiftKey&&o.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}).length>0}),xk=U({name:"unlockAllElements",trackEvent:{category:"canvas"},viewMode:!1,predicate:e=>e.some(t=>t.locked),perform:(e,t)=>{let r=e.filter(o=>o.locked);return{elements:e.map(o=>o.locked?de(o,{locked:!1}):o),appState:{...t,selectedElementIds:Object.fromEntries(r.map(o=>[o.id,!0]))},commitToHistory:!0}},contextItemLabel:"labels.elementLock.unlockAll"});h();var gE=U({name:"toggleLinearEditor",trackEvent:{category:"element"},predicate:(e,t,r,o)=>{let n=o.scene.getSelectedElements(t);return!!(n.length===1&&me(n[0]))},perform(e,t,r,o){let n=o.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0],i=t.editingLinearElement?.elementId===n.id?null:new re(n,o.scene);return{appState:{...t,editingLinearElement:i},commitToHistory:!1}},contextItemLabel:(e,t,r)=>{let o=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0];return t.editingLinearElement?.elementId===o.id?"labels.lineEditor.exit":"labels.lineEditor.edit"}});h();var xE=S(_(),1),Ek=(e,t,r)=>{if(!t.multiElement&&!t.resizingElement&&!t.editingElement&&!t.draggingElement){let n=r();if(n===null)return{commitToHistory:!1};let i=He(e),a=n.elements,s=He(a),c=e.filter(d=>!s.has(d.id)),l=a.map(d=>de(i.get(d.id)||d,d)).concat(c.map(d=>de(d,{isDeleted:!0})));return Kl(l,c),{elements:l,appState:{...t,...n.appState},commitToHistory:!1,syncHistory:!0}}return{commitToHistory:!1}},yk=e=>({name:"undo",trackEvent:{category:"history"},perform:(t,r)=>Ek(t,r,()=>e.undoOnce()),keyTest:t=>t[k.CTRL_OR_CMD]&&t.key.toLowerCase()===k.Z&&!t.shiftKey,PanelComponent:({updateData:t,data:r})=>(0,xE.jsx)(be,{type:"button",icon:LT,"aria-label":E("buttons.undo"),onClick:t,size:r?.size||"medium"}),commitToHistory:()=>!1}),wk=e=>({name:"redo",trackEvent:{category:"history"},perform:(t,r)=>Ek(t,r,()=>e.redoOnce()),keyTest:t=>t[k.CTRL_OR_CMD]&&t.shiftKey&&t.key.toLowerCase()===k.Z||Um&&t.ctrlKey&&!t.shiftKey&&t.key===k.Y,PanelComponent:({updateData:t,data:r})=>(0,xE.jsx)(be,{type:"button",icon:DT,"aria-label":E("buttons.redo"),onClick:t,size:r?.size||"medium"}),commitToHistory:()=>!1});h();var vk=S(_(),1),EE=(e,t,r,o,n,i)=>{if(e.trackEvent)try{typeof e.trackEvent=="object"&&(!e.trackEvent.predicate||e.trackEvent.predicate(r,o,i))&&Ae(e.trackEvent.category,e.trackEvent.action||e.name,`${t} (${n.device.editor.isMobile?"mobile":"desktop"})`)}catch(a){console.error("error while logging action:",a)}},Eg=class{actions={};updater;getAppState;getElementsIncludingDeleted;app;constructor(t,r,o,n){this.updater=i=>{if(i&&"then"in i)i.then(a=>t(a));else return t(i)},this.getAppState=r,this.getElementsIncludingDeleted=o,this.app=n}registerAction(t){this.actions[t.name]=t}registerAll(t){t.forEach(r=>this.registerAction(r))}handleKeyDown(t){let r=this.app.props.UIOptions.canvasActions,o=Object.values(this.actions).sort((c,l)=>(l.keyPriority||0)-(c.keyPriority||0)).filter(c=>(c.name in r?r[c.name]:!0)&&c.keyTest&&c.keyTest(t,this.getAppState(),this.getElementsIncludingDeleted(),this.app));if(o.length!==1)return o.length>1&&console.warn("Canceling as multiple actions match this shortcut",o),!1;let n=o[0];if(this.getAppState().viewModeEnabled&&n.viewMode!==!0)return!1;let i=this.getElementsIncludingDeleted(),a=this.getAppState(),s=null;return EE(n,"keyboard",a,i,this.app,null),t.preventDefault(),t.stopPropagation(),this.updater(o[0].perform(i,a,s,this.app)),!0}executeAction(t,r="api",o=null){let n=this.getElementsIncludingDeleted(),i=this.getAppState();EE(t,r,i,n,this.app,o),this.updater(t.perform(n,i,o,this.app))}renderAction=(t,r)=>{let o=this.app.props.UIOptions.canvasActions;if(this.actions[t]&&"PanelComponent"in this.actions[t]&&(!(t in o)||o[t])){let n=this.actions[t],i=n.PanelComponent;i.displayName="PanelComponent";let a=this.getElementsIncludingDeleted(),s=this.getAppState(),c=l=>{EE(n,"ui",s,a,this.app,l),this.updater(n.perform(this.getElementsIncludingDeleted(),this.getAppState(),l,this.app))};return(0,vk.jsx)(i,{elements:this.getElementsIncludingDeleted(),appState:this.getAppState(),updateData:c,appProps:this.app.props,app:this.app,data:r})}return null};isActionEnabled=t=>{let r=this.getElementsIncludingDeleted(),o=this.getAppState();return!t.predicate||t.predicate(r,o,this.app.props,this.app)}};h();var yE=e=>{let t=Array.from(e.values());return{x:Tk(t,r=>r.x)/t.length,y:Tk(t,r=>r.y)/t.length}},wE=([e,t])=>Math.hypot(e.x-t.x,e.y-t.y),Tk=(e,t)=>e.reduce((r,o)=>r+t(o),0);h();var mN=e=>({selectedElementIds:e.selectedElementIds,selectedGroupIds:e.selectedGroupIds,viewBackgroundColor:e.viewBackgroundColor,editingLinearElement:e.editingLinearElement,editingGroupId:e.editingGroupId,name:e.name}),vE=class{elementCache=new Map;recording=!0;stateHistory=[];redoStack=[];lastEntry=null;hydrateHistoryEntry({appState:t,elements:r}){return{appState:JSON.parse(t),elements:r.map(o=>{let n=this.elementCache.get(o.id)?.get(o.versionNonce);if(!n)throw new Error(`Element not found: ${o.id}:${o.versionNonce}`);return n})}}dehydrateHistoryEntry({appState:t,elements:r}){return{appState:JSON.stringify(t),elements:r.map(o=>{this.elementCache.has(o.id)||this.elementCache.set(o.id,new Map);let n=this.elementCache.get(o.id);return n.has(o.versionNonce)||n.set(o.versionNonce,Ti(o)),{id:o.id,versionNonce:o.versionNonce}})}}getSnapshotForTest(){return{recording:this.recording,stateHistory:this.stateHistory.map(t=>this.hydrateHistoryEntry(t)),redoStack:this.redoStack.map(t=>this.hydrateHistoryEntry(t))}}clear(){this.stateHistory.length=0,this.redoStack.length=0,this.lastEntry=null,this.elementCache.clear()}generateEntry=(t,r)=>this.dehydrateHistoryEntry({appState:mN(t),elements:r.reduce((o,n)=>{if(me(n)&&t.multiElement&&t.multiElement.id===n.id){if(t.multiElement&&t.multiElement.id===n.id&&n.points.length<2)return o;o.push({...n,points:n.lastCommittedPoint!==n.points[n.points.length-1]?n.points.slice(0,-1):n.points})}else o.push(n);return o},[])});shouldCreateEntry(t){let{lastEntry:r}=this;if(!r||t.elements.length!==r.elements.length)return!0;for(let n=t.elements.length-1;n>-1;n--){let i=t.elements[n],a=r.elements[n];if(!i||!a||i.id!==a.id||i.versionNonce!==a.versionNonce)return!0}let o;for(o in t.appState)if(!(o==="editingLinearElement"&&t.appState[o]?.elementId===r.appState[o]?.elementId)&&!(o==="selectedElementIds"||o==="selectedGroupIds")&&t.appState[o]!==r.appState[o])return!0;return!1}pushEntry(t,r){let o=this.generateEntry(t,r),n=this.hydrateHistoryEntry(o);if(n){if(!this.shouldCreateEntry(n))return;this.stateHistory.push(o),this.lastEntry=n,this.clearRedoStack()}}clearRedoStack(){this.redoStack.splice(0,this.redoStack.length)}redoOnce(){if(this.redoStack.length===0)return null;let t=this.redoStack.pop();return t!==void 0?(this.stateHistory.push(t),this.hydrateHistoryEntry(t)):null}undoOnce(){if(this.stateHistory.length===1)return null;let t=this.stateHistory.pop(),r=this.stateHistory[this.stateHistory.length-1];return t!==void 0?(this.redoStack.push(t),this.hydrateHistoryEntry(r)):null}setCurrentState(t,r){this.lastEntry=this.hydrateHistoryEntry(this.generateEntry(t,r))}resumeRecording(){this.recording=!0}record(t,r){this.recording&&(this.pushEntry(t,r),this.recording=!1)}},Sk=vE;h();var TE=[{icon:aT,value:"selection",key:k.V,numericKey:k[1],fillable:!0},{icon:sT,value:"rectangle",key:k.R,numericKey:k[2],fillable:!0},{icon:lT,value:"diamond",key:k.D,numericKey:k[3],fillable:!0},{icon:cT,value:"ellipse",key:k.O,numericKey:k[4],fillable:!0},{icon:dT,value:"arrow",key:k.A,numericKey:k[5],fillable:!0},{icon:uT,value:"line",key:k.L,numericKey:k[6],fillable:!0},{icon:$l,value:"freedraw",key:[k.P,k.X],numericKey:k[7],fillable:!1},{icon:pT,value:"text",key:k.T,numericKey:k[8],fillable:!1},{icon:fT,value:"image",key:null,numericKey:k[9],fillable:!1},{icon:hT,value:"eraser",key:k.E,numericKey:k[0],fillable:!1}],Ck=e=>TE.find((r,o)=>r.numericKey!=null&&e===r.numericKey.toString()||r.key&&(typeof r.key=="string"?r.key===e:r.key.includes(e)))?.value||null;h();var Ik=S(W(),1),Gi=S(_(),1),Ur="separator",kk=Ik.default.memo(({actionManager:e,items:t,top:r,left:o,onClose:n})=>{let i=Kc(),a=Ca(),s=t.reduce((c,l)=>(l&&(l===Ur||!l.predicate||l.predicate(a,i,e.app.props,e.app))&&c.push(l),c),[]);return(0,Gi.jsx)(Ff,{onCloseRequest:()=>{n()},top:r,left:o,fitInViewport:!0,offsetLeft:i.offsetLeft,offsetTop:i.offsetTop,viewportWidth:i.width,viewportHeight:i.height,children:(0,Gi.jsx)("ul",{className:"context-menu",onContextMenu:c=>c.preventDefault(),children:s.map((c,l)=>{if(c===Ur)return!s[l-1]||s[l-1]===Ur?null:(0,Gi.jsx)("hr",{className:"context-menu-item-separator"},l);let d=c.name,u="";return c.contextItemLabel&&(typeof c.contextItemLabel=="function"?u=E(c.contextItemLabel(a,i,e.app)):u=E(c.contextItemLabel)),(0,Gi.jsx)("li",{"data-testid":d,onClick:()=>{n(()=>{e.executeAction(c,"contextMenu")})},children:(0,Gi.jsxs)("button",{className:G("context-menu-item",{dangerous:d==="deleteSelectedElements",checkmark:c.checked?.(i)}),children:[(0,Gi.jsx)("div",{className:"context-menu-item__label",children:u}),(0,Gi.jsx)("kbd",{className:"context-menu-item__shortcut",children:d?Ri(d):""})]})},l)})})})});h();var a_=S(W(),1);h();var Mk=S(W(),1);var he=S(_(),1),yg=({appState:e,elements:t,renderAction:r})=>{let o=fs(we(t),e),n=!1;o.length===2&&(Xr(o[0])||Xr(o[1]))&&(n=!0);let i=!!e.editingElement,a=Ke(),s=document.documentElement.getAttribute("dir")==="rtl",c=Ei(e.activeTool.type)&&!Rr(e.currentItemBackgroundColor)||o.some(m=>Ei(m.type)&&!Rr(m.backgroundColor)),l=Ei(e.activeTool.type)||o.some(m=>Ei(m.type)),d=o.length===1||n,u=o[0]?.type||null;for(let m of o)if(m.type!==u){u=null;break}return(0,he.jsxs)("div",{className:"panelColumn",children:[(0,he.jsx)("div",{children:(Kd(e.activeTool.type)&&e.activeTool.type!=="image"&&u!=="image"&&u!=="frame"&&u!=="magicframe"||o.some(m=>Kd(m.type)))&&r("changeStrokeColor")}),l&&(0,he.jsx)("div",{children:r("changeBackgroundColor")}),c&&r("changeFillStyle"),(Op(e.activeTool.type)||o.some(m=>Op(m.type)))&&r("changeStrokeWidth"),(e.activeTool.type==="freedraw"||o.some(m=>m.type==="freedraw"))&&r("changeStrokeShape"),(Np(e.activeTool.type)||o.some(m=>Np(m.type)))&&(0,he.jsxs)(he.Fragment,{children:[r("changeStrokeStyle"),r("changeSloppiness")]}),(Ll(e.activeTool.type)||o.some(m=>Ll(m.type)))&&(0,he.jsx)(he.Fragment,{children:r("changeRoundness")}),(e.activeTool.type==="text"||o.some(ee))&&(0,he.jsxs)(he.Fragment,{children:[r("changeFontSize"),r("changeFontFamily"),(e.activeTool.type==="text"||Ak(o))&&r("changeTextAlign")]}),_k(o)&&r("changeVerticalAlign"),(ps(e.activeTool.type)||o.some(m=>ps(m.type)))&&(0,he.jsx)(he.Fragment,{children:r("changeArrowhead")}),r("changeOpacity"),(0,he.jsxs)("fieldset",{children:[(0,he.jsx)("legend",{children:E("labels.layers")}),(0,he.jsxs)("div",{className:"buttonList",children:[r("sendToBack"),r("sendBackward"),r("bringToFront"),r("bringForward")]})]}),o.length>1&&!n&&(0,he.jsxs)("fieldset",{children:[(0,he.jsx)("legend",{children:E("labels.align")}),(0,he.jsxs)("div",{className:"buttonList",children:[s?(0,he.jsxs)(he.Fragment,{children:[r("alignRight"),r("alignHorizontallyCentered"),r("alignLeft")]}):(0,he.jsxs)(he.Fragment,{children:[r("alignLeft"),r("alignHorizontallyCentered"),r("alignRight")]}),o.length>2&&r("distributeHorizontally"),(0,he.jsx)("div",{style:{flexBasis:"100%",height:0}}),(0,he.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:".5rem",marginTop:"-0.5rem"},children:[r("alignTop"),r("alignVerticallyCentered"),r("alignBottom"),o.length>2&&r("distributeVertically")]})]})]}),!i&&o.length>0&&(0,he.jsxs)("fieldset",{children:[(0,he.jsx)("legend",{children:E("labels.actions")}),(0,he.jsxs)("div",{className:"buttonList",children:[!a.editor.isMobile&&r("duplicateSelection"),!a.editor.isMobile&&r("deleteSelectedElements"),r("group"),r("ungroup"),d&&r("hyperlink")]})]})]})},wg=({activeTool:e,appState:t,app:r,UIOptions:o})=>{let[n,i]=(0,Mk.useState)(!1),a=e.type==="frame",s=e.type==="laser",c=e.type==="embeddable",{TTDDialogTriggerTunnel:l}=ft();return(0,he.jsxs)(he.Fragment,{children:[TE.map(({value:d,icon:u,key:m,numericKey:p,fillable:f},g)=>{if(o.tools?.[d]===!1)return null;let x=E(`toolBar.${d}`),y=m&&Sl(typeof m=="string"?m:m[0]),w=y?`${y} ${E("helpDialog.or")} ${p}`:`${p}`;return(0,he.jsx)(be,{className:G("Shape",{fillable:f}),type:"radio",icon:u,checked:e.type===d,name:"editor-current-shape",title:`${Sl(x)} \u2014 ${w}`,keyBindingLabel:p||y,"aria-label":Sl(x),"aria-keyshortcuts":w,"data-testid":`toolbar-${d}`,onPointerDown:({pointerType:T})=>{!t.penDetected&&T==="pen"&&r.togglePenMode(!0)},onChange:({pointerType:T})=>{t.activeTool.type!==d&&Ae("toolbar",d,"ui"),d==="image"?r.setActiveTool({type:d,insertOnCanvasDirectly:T!=="mouse"}):r.setActiveTool({type:d})}},d)}),(0,he.jsx)("div",{className:"App-toolbar__divider"}),(0,he.jsxs)(je,{open:n,children:[(0,he.jsx)(je.Trigger,{className:G("App-toolbar__extra-tools-trigger",{"App-toolbar__extra-tools-trigger--selected":a||c||s&&!r.props.isCollaborating}),onToggle:()=>i(!n),title:E("toolBar.extraTools"),children:RS}),(0,he.jsxs)(je.Content,{onClickOutside:()=>i(!1),onSelect:()=>i(!1),className:"App-toolbar__extra-tools-dropdown",children:[(0,he.jsx)(je.Item,{onSelect:()=>r.setActiveTool({type:"frame"}),icon:OS,shortcut:k.F.toLocaleUpperCase(),"data-testid":"toolbar-frame",selected:a,children:E("toolBar.frame")}),(0,he.jsx)(je.Item,{onSelect:()=>r.setActiveTool({type:"embeddable"}),icon:xT,"data-testid":"toolbar-embeddable",selected:c,children:E("toolBar.embeddable")}),(0,he.jsx)(je.Item,{onSelect:()=>r.setActiveTool({type:"laser"}),icon:nf,"data-testid":"toolbar-laser",selected:s,shortcut:k.K.toLocaleUpperCase(),children:E("toolBar.laser")}),(0,he.jsx)("div",{style:{margin:"6px 0",fontSize:14,fontWeight:600},children:"Generate"}),r.props.aiEnabled!==!1&&(0,he.jsx)(l.Out,{}),(0,he.jsx)(je.Item,{onSelect:()=>r.setOpenDialog({name:"ttd",tab:"mermaid"}),icon:NS,"data-testid":"toolbar-embeddable",children:E("toolBar.mermaidToExcalidraw")}),r.props.aiEnabled!==!1&&(0,he.jsxs)(he.Fragment,{children:[(0,he.jsxs)(je.Item,{onSelect:()=>r.onMagicframeToolSelect(),icon:Yl,"data-testid":"toolbar-magicframe",children:[E("toolBar.magicframe"),(0,he.jsx)(je.Item.Badge,{children:"AI"})]}),(0,he.jsx)(je.Item,{onSelect:()=>{Ae("ai","open-settings","d2c"),r.setOpenDialog({name:"settings",source:"settings",tab:"diagram-to-code"})},icon:Qd,"data-testid":"toolbar-magicSettings",children:E("toolBar.magicSettings")})]})]})]})]})},Pk=({renderAction:e,zoom:t})=>(0,he.jsx)(lr.Col,{gap:1,className:"zoom-actions",children:(0,he.jsxs)(lr.Row,{align:"center",children:[e("zoomOut"),e("resetZoom"),e("zoomIn")]})}),Lk=({renderAction:e,className:t})=>(0,he.jsxs)("div",{className:`undo-redo-buttons ${t}`,children:[(0,he.jsx)("div",{className:"undo-button-container",children:(0,he.jsx)(go,{label:E("buttons.undo"),children:e("undo")})}),(0,he.jsx)("div",{className:"redo-button-container",children:(0,he.jsxs)(go,{label:E("buttons.redo"),children:[" ",e("redo")]})})]}),Dk=({actionManager:e,showExitZenModeBtn:t})=>(0,he.jsx)("button",{className:G("disable-zen-mode",{"disable-zen-mode--visible":t}),onClick:()=>e.executeAction(Uc),children:E("buttons.exitZenMode")}),Rk=({renderAction:e,className:t})=>(0,he.jsx)("div",{className:`finalize-button ${t}`,children:e("finalize",{size:"small"})});h();var vg=S(W(),1);var Zc=S(_(),1),Ok=({children:e,onClose:t})=>{let[r,o]=(0,vg.useState)(!!e),{container:n}=ar(),i=vg.default.useCallback(()=>{o(!1),t&&t(),n?.focus()},[t,n]);return(0,Zc.jsx)(Zc.Fragment,{children:r&&(0,Zc.jsx)(Dt,{size:"small",onCloseRequest:i,title:E("errorDialog.title"),children:(0,Zc.jsx)("div",{style:{whiteSpace:"pre-wrap"},children:e})})})};h();var Eo=S(W(),1);h();var Vu=S(_(),1),Nk=function({onChange:e,value:t,choices:r,name:o}){return(0,Vu.jsx)("div",{className:"RadioGroup",children:r.map(n=>(0,Vu.jsxs)("div",{className:G("RadioGroup__choice",{active:n.value===t}),children:[(0,Vu.jsx)("input",{name:o,type:"radio",checked:n.value===t,onChange:()=>e(n.value)}),n.label]},n.label))})};h();var SE=S(_(),1),Yu=({title:e,name:t,checked:r,onChange:o,disabled:n=!1})=>(0,SE.jsx)("div",{className:G("Switch",{toggled:r,disabled:n}),children:(0,SE.jsx)("input",{name:t,id:t,title:e,type:"checkbox",checked:r,disabled:n,onChange:()=>o(!r),onKeyDown:i=>{i.key===" "&&o(!r)}})});h();var Fk=S(W(),1);var Tg=S(_(),1),oi=(0,Fk.forwardRef)(({children:e,startIcon:t,onClick:r,label:o,variant:n="filled",color:i="primary",size:a="medium",fullWidth:s,className:c},l)=>(0,Tg.jsxs)("button",{className:G("ExcButton",`ExcButton--color-${i}`,`ExcButton--variant-${n}`,`ExcButton--size-${a}`,{"ExcButton--fullWidth":s},c),onClick:r,type:"button","aria-label":o,ref:l,children:[t&&(0,Tg.jsx)("div",{className:"ExcButton__icon","aria-hidden":!0,children:t}),n!=="icon"&&(e??o)]}));var Fe=S(_(),1),pN="filter"in document.createElement("canvas").getContext("2d"),fN=()=>(0,Fe.jsxs)("div",{children:[(0,Fe.jsx)("h3",{children:E("canvasError.cannotShowPreview")}),(0,Fe.jsx)("p",{children:(0,Fe.jsx)("span",{children:E("canvasError.canvasTooBig")})}),(0,Fe.jsxs)("em",{children:["(",E("canvasError.canvasTooBigTip"),")"]})]}),hN=({appStateSnapshot:e,elementsSnapshot:t,files:r,actionManager:o,onExportImage:n})=>{let i=Je(t,e),a=Oa(),[s,c]=(0,Eo.useState)(e.name),[l,d]=(0,Eo.useState)(i),[u,m]=(0,Eo.useState)(e.exportBackground),[p,f]=(0,Eo.useState)(e.exportWithDarkMode),[g,x]=(0,Eo.useState)(e.exportEmbedScene),[y,w]=(0,Eo.useState)(e.exportScale),T=(0,Eo.useRef)(null),[C,I]=(0,Eo.useState)(null),{exportedElements:A,exportingFrame:P}=Us(t,e,l);return(0,Eo.useEffect)(()=>{let L=T.current;if(!L)return;let D=L.offsetWidth,M=L.offsetHeight;D&&Da({elements:A,appState:{...e,name:s,exportBackground:u,exportWithDarkMode:p,exportScale:y,exportEmbedScene:g},files:r,exportPadding:on,maxWidthOrHeight:Math.max(D,M),exportingFrame:P}).then(R=>(I(null),Oi(R).then(()=>{L.replaceChildren(R)}))).catch(R=>{console.error(R),I(R)})},[e,r,A,P,s,u,p,y,g]),(0,Fe.jsxs)("div",{className:"ImageExportModal",children:[(0,Fe.jsx)("h3",{children:E("imageExportDialog.header")}),(0,Fe.jsxs)("div",{className:"ImageExportModal__preview",children:[(0,Fe.jsx)("div",{className:"ImageExportModal__preview__canvas",ref:T,children:C&&(0,Fe.jsx)(fN,{})}),(0,Fe.jsx)("div",{className:"ImageExportModal__preview__filename",children:!Go&&(0,Fe.jsx)("input",{type:"text",className:"TextInput",value:s,style:{width:"30ch"},disabled:typeof a.name<"u"||e.viewModeEnabled,onChange:L=>{c(L.target.value),o.executeAction(Yx,"ui",L.target.value)}})})]}),(0,Fe.jsxs)("div",{className:"ImageExportModal__settings",children:[(0,Fe.jsx)("h3",{children:E("imageExportDialog.header")}),i&&(0,Fe.jsx)(Ku,{label:E("imageExportDialog.label.onlySelected"),name:"exportOnlySelected",children:(0,Fe.jsx)(Yu,{name:"exportOnlySelected",checked:l,onChange:L=>{d(L)}})}),(0,Fe.jsx)(Ku,{label:E("imageExportDialog.label.withBackground"),name:"exportBackgroundSwitch",children:(0,Fe.jsx)(Yu,{name:"exportBackgroundSwitch",checked:u,onChange:L=>{m(L),o.executeAction(Kx,"ui",L)}})}),pN&&(0,Fe.jsx)(Ku,{label:E("imageExportDialog.label.darkMode"),name:"exportDarkModeSwitch",children:(0,Fe.jsx)(Yu,{name:"exportDarkModeSwitch",checked:p,onChange:L=>{f(L),o.executeAction(nk,"ui",L)}})}),(0,Fe.jsx)(Ku,{label:E("imageExportDialog.label.embedScene"),tooltip:E("imageExportDialog.tooltip.embedScene"),name:"exportEmbedSwitch",children:(0,Fe.jsx)(Yu,{name:"exportEmbedSwitch",checked:g,onChange:L=>{x(L),o.executeAction(lg,"ui",L)}})}),(0,Fe.jsx)(Ku,{label:E("imageExportDialog.label.scale"),name:"exportScale",children:(0,Fe.jsx)(Nk,{name:"exportScale",value:y,onChange:L=>{w(L),o.executeAction(ok,"ui",L)},choices:yl.map(L=>({value:L,label:`${L}\xD7`}))})}),(0,Fe.jsxs)("div",{className:"ImageExportModal__settings__buttons",children:[(0,Fe.jsx)(oi,{className:"ImageExportModal__settings__buttons__button",label:E("imageExportDialog.title.exportToPng"),onClick:()=>n(Km.png,A,{exportingFrame:P}),startIcon:Wb,children:E("imageExportDialog.button.exportToPng")}),(0,Fe.jsx)(oi,{className:"ImageExportModal__settings__buttons__button",label:E("imageExportDialog.title.exportToSvg"),onClick:()=>n(Km.svg,A,{exportingFrame:P}),startIcon:Wb,children:E("imageExportDialog.button.exportToSvg")}),(hc||ta)&&(0,Fe.jsx)(oi,{className:"ImageExportModal__settings__buttons__button",label:E("imageExportDialog.title.copyPngToClipboard"),onClick:()=>n(Km.clipboard,A,{exportingFrame:P}),startIcon:of,children:E("imageExportDialog.button.copyPngToClipboard")})]})]})]})},Ku=({label:e,children:t,tooltip:r,name:o})=>(0,Fe.jsxs)("div",{className:"ImageExportModal__settings__setting",title:e,children:[(0,Fe.jsxs)("label",{htmlFor:o,className:"ImageExportModal__settings__setting__label",children:[e,r&&(0,Fe.jsx)(go,{label:r,long:!0,children:PS})]}),(0,Fe.jsx)("div",{className:"ImageExportModal__settings__setting__content",children:t})]}),Bk=({elements:e,appState:t,files:r,actionManager:o,onExportImage:n,onCloseRequest:i})=>{let[{appStateSnapshot:a,elementsSnapshot:s}]=(0,Eo.useState)(()=>({appStateSnapshot:Co(t),elementsSnapshot:Co(e)}));return(0,Fe.jsx)(Dt,{onCloseRequest:i,size:"wide",title:!1,children:(0,Fe.jsx)(hN,{elementsSnapshot:s,appStateSnapshot:a,files:r,actionManager:o,onExportImage:n})})};h();var zk=S(_(),1),Sg=({children:e,side:t,className:r})=>(0,zk.jsx)("div",{className:G("FixedSideContainer",`FixedSideContainer_side_${t}`,r),children:e});h();var CE=S(_(),1),gN=({appState:e,isMobile:t,device:r,app:o})=>{let{activeTool:n,isResizing:i,isRotating:a,lastPointerDownWith:s}=e,c=e.multiElement!==null;if(e.openSidebar&&!r.editor.canFitSidebar)return null;if(Io(e))return E("hints.eraserRevert");if(n.type==="arrow"||n.type==="line")return c?E("hints.linearElementMulti"):E("hints.linearElement");if(n.type==="freedraw")return E("hints.freeDraw");if(n.type==="text")return E("hints.text");if(n.type==="embeddable")return E("hints.embeddable");if(e.activeTool.type==="image"&&e.pendingImageElementId)return E("hints.placeImage");let l=o.scene.getSelectedElements(e);if(i&&s==="mouse"&&l.length===1){let d=l[0];return me(d)&&d.points.length===2?E("hints.lockAngle"):ko(d)?E("hints.resizeImage"):E("hints.resize")}if(a&&s==="mouse")return E("hints.rotate");if(l.length===1&&ee(l[0]))return E("hints.text_selected");if(e.editingElement&&ee(e.editingElement))return E("hints.text_editing");if(n.type==="selection"){if(e.draggingElement?.type==="selection"&&!l.length&&!e.editingElement&&!e.editingLinearElement)return E("hints.deepBoxSelect");if(e.gridSize&&e.draggingElement)return E("hints.disableSnapping");if(!l.length&&!t)return E("hints.canvasPanning");if(l.length===1){if(me(l[0]))return e.editingLinearElement?e.editingLinearElement.selectedPointsIndices?E("hints.lineEditor_pointSelected"):E("hints.lineEditor_nothingSelected"):E("hints.lineEditor_info");if(!e.draggingElement&&$n(l[0]))return E("hints.bindTextToElement")}}return null},Cg=({appState:e,isMobile:t,device:r,app:o})=>{let n=gN({appState:e,isMobile:t,device:r,app:o});return n?(n=H(n),(0,CE.jsx)("div",{className:"HintViewer",children:(0,CE.jsx)("span",{children:n})})):null};h();var Zu=S(_(),1),bN="medium",Hk={CHECKED:rT,UNCHECKED:tT},Ig=e=>(0,Zu.jsxs)("label",{className:G("ToolIcon ToolIcon__lock",`ToolIcon_size_${bN}`,{"is-mobile":e.isMobile}),title:`${e.title} \u2014 Q`,children:[(0,Zu.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":"toolbar-lock"}),(0,Zu.jsx)("div",{className:"ToolIcon__icon",children:e.checked?Hk.CHECKED:Hk.UNCHECKED})]});h();h();var Zs=S(_(),1),Ga=({heading:e,children:t,...r})=>{let{id:o}=ar(),n=(0,Zs.jsx)("h2",{className:"visually-hidden",id:`${o}-${e}-title`,children:E(`headings.${e}`)});return(0,Zs.jsx)("section",{...r,"aria-labelledby":`${o}-${e}-title`,children:typeof t=="function"?t(n):(0,Zs.jsxs)(Zs.Fragment,{children:[n,t]})})};h();var Xu=S(_(),1),xN="medium",kg=e=>e.penDetected?(0,Xu.jsxs)("label",{className:G("ToolIcon ToolIcon__penMode",`ToolIcon_size_${xN}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,Xu.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,Xu.jsx)("div",{className:"ToolIcon__icon",children:mT})]}):null;h();var Te=S(_(),1),_g=e=>{let t=Me(e.elements),r=fs(e.elements,e.appState),o=Me(r);return(0,Te.jsx)("div",{className:"Stats",children:(0,Te.jsxs)(xr,{padding:2,children:[(0,Te.jsx)("div",{className:"close",onClick:e.onClose,children:Oo}),(0,Te.jsx)("h3",{children:E("stats.title")}),(0,Te.jsx)("table",{children:(0,Te.jsxs)("tbody",{children:[(0,Te.jsx)("tr",{children:(0,Te.jsx)("th",{colSpan:2,children:E("stats.scene")})}),(0,Te.jsxs)("tr",{children:[(0,Te.jsx)("td",{children:E("stats.elements")}),(0,Te.jsx)("td",{children:e.elements.length})]}),(0,Te.jsxs)("tr",{children:[(0,Te.jsx)("td",{children:E("stats.width")}),(0,Te.jsx)("td",{children:Math.round(t[2])-Math.round(t[0])})]}),(0,Te.jsxs)("tr",{children:[(0,Te.jsx)("td",{children:E("stats.height")}),(0,Te.jsx)("td",{children:Math.round(t[3])-Math.round(t[1])})]}),r.length===1&&(0,Te.jsx)("tr",{children:(0,Te.jsx)("th",{colSpan:2,children:E("stats.element")})}),r.length>1&&(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)("tr",{children:(0,Te.jsx)("th",{colSpan:2,children:E("stats.selected")})}),(0,Te.jsxs)("tr",{children:[(0,Te.jsx)("td",{children:E("stats.elements")}),(0,Te.jsx)("td",{children:r.length})]})]}),r.length>0&&(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsxs)("tr",{children:[(0,Te.jsx)("td",{children:"x"}),(0,Te.jsx)("td",{children:Math.round(o[0])})]}),(0,Te.jsxs)("tr",{children:[(0,Te.jsx)("td",{children:"y"}),(0,Te.jsx)("td",{children:Math.round(o[1])})]}),(0,Te.jsxs)("tr",{children:[(0,Te.jsx)("td",{children:E("stats.width")}),(0,Te.jsx)("td",{children:Math.round(o[2]-o[0])})]}),(0,Te.jsxs)("tr",{children:[(0,Te.jsx)("td",{children:E("stats.height")}),(0,Te.jsx)("td",{children:Math.round(o[3]-o[1])})]})]}),r.length===1&&(0,Te.jsxs)("tr",{children:[(0,Te.jsx)("td",{children:E("stats.angle")}),(0,Te.jsx)("td",{children:`${Math.round(r[0].angle*180/Math.PI)}\xB0`})]}),e.renderCustomStats?.(e.elements,e.appState)]})})]})})};h();var $k=S(_(),1),Ag=e=>(0,$k.jsx)(be,{className:G("Shape",{fillable:!1}),type:"radio",icon:MS,name:"editor-current-shape",checked:e.checked,title:`${e.title} \u2014 H`,keyBindingLabel:e.isMobile?void 0:k.H.toLocaleUpperCase(),"aria-label":`${e.title} \u2014 H`,"aria-keyshortcuts":k.H,"data-testid":"toolbar-hand",onChange:()=>e.onChange?.()});var nt=S(_(),1),Gk=({appState:e,elements:t,actionManager:r,setAppState:o,onLockToggle:n,onHandToolToggle:i,onPenModeToggle:a,renderTopRightUI:s,renderCustomStats:c,renderSidebars:l,device:d,renderWelcomeScreen:u,UIOptions:m,app:p})=>{let{WelcomeScreenCenterTunnel:f,MainMenuTunnel:g,DefaultSidebarTriggerTunnel:x}=ft(),y=()=>(0,nt.jsxs)(Sg,{side:"top",className:"App-top-bar",children:[u&&(0,nt.jsx)(f.Out,{}),(0,nt.jsx)(Ga,{heading:"shapes",children:T=>(0,nt.jsx)(lr.Col,{gap:4,align:"center",children:(0,nt.jsxs)(lr.Row,{gap:1,className:"App-toolbar-container",children:[(0,nt.jsxs)(xr,{padding:1,className:"App-toolbar App-toolbar--mobile",children:[T,(0,nt.jsx)(lr.Row,{gap:1,children:(0,nt.jsx)(wg,{appState:e,activeTool:e.activeTool,UIOptions:m,app:p})})]}),s&&s(!0,e),(0,nt.jsxs)("div",{className:"mobile-misc-tools-container",children:[!e.viewModeEnabled&&(0,nt.jsx)(x.Out,{}),(0,nt.jsx)(kg,{checked:e.penMode,onChange:()=>a(null),title:E("toolBar.penMode"),isMobile:!0,penDetected:e.penDetected}),(0,nt.jsx)(Ig,{checked:e.activeTool.locked,onChange:n,title:E("toolBar.lock"),isMobile:!0}),(0,nt.jsx)(Ag,{checked:an(e),onChange:()=>i(),title:E("toolBar.hand"),isMobile:!0})]})]})})}),(0,nt.jsx)(Cg,{appState:e,isMobile:!0,device:d,app:p})]}),w=()=>e.viewModeEnabled?(0,nt.jsx)("div",{className:"App-toolbar-content",children:(0,nt.jsx)(g.Out,{})}):(0,nt.jsxs)("div",{className:"App-toolbar-content",children:[(0,nt.jsx)(g.Out,{}),r.renderAction("toggleEditMenu"),r.renderAction("undo"),r.renderAction("redo"),r.renderAction(e.multiElement?"finalize":"duplicateSelection"),r.renderAction("deleteSelectedElements")]});return(0,nt.jsxs)(nt.Fragment,{children:[l(),!e.viewModeEnabled&&y(),!e.openMenu&&e.showStats&&(0,nt.jsx)(_g,{appState:e,setAppState:o,elements:t,onClose:()=>{r.executeAction($a)},renderCustomStats:c}),(0,nt.jsx)("div",{className:"App-bottom-bar",style:{marginBottom:Wn+dn*2,marginLeft:Wn+dn*2,marginRight:Wn+dn*2},children:(0,nt.jsxs)(xr,{padding:0,children:[e.openMenu==="shape"&&!e.viewModeEnabled&&Vs(e,t)?(0,nt.jsx)(Ga,{className:"App-mobile-menu",heading:"selectedShapeActions",children:(0,nt.jsx)(yg,{appState:e,elements:t,renderAction:r.renderAction})}):null,(0,nt.jsxs)("footer",{className:"App-toolbar",children:[w(),e.scrolledOutside&&!e.openMenu&&!e.openSidebar&&(0,nt.jsx)("button",{className:"scroll-back-to-content",onClick:()=>{o(T=>({...Vn(t,T)}))},children:E("buttons.scrollBackToContent")})]})]})})]})};h();var Wa=S(W(),1);var Ua=S(_(),1),Uk=e=>{let t=(0,Wa.useRef)(null),[r,o]=(0,Wa.useState)(null);return(0,Wa.useLayoutEffect)(()=>{if(!e.spreadsheet)return;let n=xC(e.chartType,e.spreadsheet,0,0);o(n);let i,a=t.current;return(async()=>(i=await Nc(n,{exportBackground:!1,viewBackgroundColor:rt.white},null),i.querySelector(".style-fonts")?.remove(),a.replaceChildren(),a.appendChild(i),e.selected&&a.parentNode.focus()))(),()=>{a.replaceChildren()}},[e.spreadsheet,e.chartType,e.selected]),(0,Ua.jsx)("button",{className:"ChartPreview",onClick:()=>{r&&e.onClick(e.chartType,r)},children:(0,Ua.jsx)("div",{ref:t})})},Wk=({setAppState:e,appState:t,onClose:r})=>{let{onInsertElements:o}=Bo(),n=Wa.default.useCallback(()=>{r&&r()},[r]),i=(a,s)=>{o(s),Ae("paste","chart",a),e({currentChartType:a,pasteDialog:{shown:!1,data:null}})};return(0,Ua.jsx)(Dt,{size:"small",onCloseRequest:n,title:E("labels.pasteCharts"),className:"PasteChartDialog",autofocus:!1,children:(0,Ua.jsxs)("div",{className:"container",children:[(0,Ua.jsx)(Uk,{chartType:"bar",spreadsheet:t.pasteDialog.data,selected:t.currentChartType==="bar",onClick:i}),(0,Ua.jsx)(Uk,{chartType:"line",spreadsheet:t.pasteDialog.data,selected:t.currentChartType==="line",onClick:i})]})})};h();var Vk=S(W(),1);var Z=S(_(),1),EN=()=>(0,Z.jsxs)("div",{className:"HelpDialog__header",children:[(0,Z.jsxs)("a",{className:"HelpDialog__btn",href:"https://docs.excalidraw.com",target:"_blank",rel:"noopener noreferrer",children:[E("helpDialog.documentation"),(0,Z.jsx)("div",{className:"HelpDialog__link-icon",children:tf})]}),(0,Z.jsxs)("a",{className:"HelpDialog__btn",href:"https://blog.excalidraw.com",target:"_blank",rel:"noopener noreferrer",children:[E("helpDialog.blog"),(0,Z.jsx)("div",{className:"HelpDialog__link-icon",children:tf})]}),(0,Z.jsxs)("a",{className:"HelpDialog__btn",href:"https://github.com/excalidraw/excalidraw/issues",target:"_blank",rel:"noopener noreferrer",children:[E("helpDialog.github"),(0,Z.jsx)("div",{className:"HelpDialog__link-icon",children:tf})]})]}),yN=e=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("h3",{children:e.title}),(0,Z.jsx)("div",{className:"HelpDialog__islands-container",children:e.children})]}),IE=e=>(0,Z.jsxs)("div",{className:`HelpDialog__island ${e.className}`,children:[(0,Z.jsx)("h4",{className:"HelpDialog__island-title",children:e.caption}),(0,Z.jsx)("div",{className:"HelpDialog__island-content",children:e.children})]});function*wN(e,t){let r=!0;for(let o of e)r||(yield t),r=!1,yield o}var vN=e=>e.replace(/\b[a-z]\b/,t=>t.toUpperCase()),ie=({label:e,shortcuts:t,isOr:r=!0})=>{let o=t.map(n=>(n.endsWith("++")?[...n.slice(0,-2).split("+"),"+"]:n.split("+")).map(a=>(0,Z.jsx)(TN,{children:vN(a)},a)));return(0,Z.jsxs)("div",{className:"HelpDialog__shortcut",children:[(0,Z.jsx)("div",{children:e}),(0,Z.jsx)("div",{className:"HelpDialog__key-container",children:[...wN(o,r?E("helpDialog.or"):null)]})]})},TN=e=>(0,Z.jsx)("kbd",{className:"HelpDialog__key",...e}),Yk=({onClose:e})=>{let t=Vk.default.useCallback(()=>{e&&e()},[e]);return(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsxs)(Dt,{onCloseRequest:t,title:E("helpDialog.title"),className:"HelpDialog",children:[(0,Z.jsx)(EN,{}),(0,Z.jsxs)(yN,{title:E("helpDialog.shortcuts"),children:[(0,Z.jsxs)(IE,{className:"HelpDialog__island--tools",caption:E("helpDialog.tools"),children:[(0,Z.jsx)(ie,{label:E("toolBar.hand"),shortcuts:[k.H]}),(0,Z.jsx)(ie,{label:E("toolBar.selection"),shortcuts:[k.V,k[1]]}),(0,Z.jsx)(ie,{label:E("toolBar.rectangle"),shortcuts:[k.R,k[2]]}),(0,Z.jsx)(ie,{label:E("toolBar.diamond"),shortcuts:[k.D,k[3]]}),(0,Z.jsx)(ie,{label:E("toolBar.ellipse"),shortcuts:[k.O,k[4]]}),(0,Z.jsx)(ie,{label:E("toolBar.arrow"),shortcuts:[k.A,k[5]]}),(0,Z.jsx)(ie,{label:E("toolBar.line"),shortcuts:[k.L,k[6]]}),(0,Z.jsx)(ie,{label:E("toolBar.freedraw"),shortcuts:[k.P,k[7]]}),(0,Z.jsx)(ie,{label:E("toolBar.text"),shortcuts:[k.T,k[8]]}),(0,Z.jsx)(ie,{label:E("toolBar.image"),shortcuts:[k[9]]}),(0,Z.jsx)(ie,{label:E("toolBar.eraser"),shortcuts:[k.E,k[0]]}),(0,Z.jsx)(ie,{label:E("toolBar.frame"),shortcuts:[k.F]}),(0,Z.jsx)(ie,{label:E("toolBar.laser"),shortcuts:[k.K]}),(0,Z.jsx)(ie,{label:E("labels.eyeDropper"),shortcuts:[k.I,"Shift+S","Shift+G"]}),(0,Z.jsx)(ie,{label:E("helpDialog.editLineArrowPoints"),shortcuts:[H("CtrlOrCmd+Enter")]}),(0,Z.jsx)(ie,{label:E("helpDialog.editText"),shortcuts:[H("Enter")]}),(0,Z.jsx)(ie,{label:E("helpDialog.textNewLine"),shortcuts:[H("Enter"),H("Shift+Enter")]}),(0,Z.jsx)(ie,{label:E("helpDialog.textFinish"),shortcuts:[H("Esc"),H("CtrlOrCmd+Enter")]}),(0,Z.jsx)(ie,{label:E("helpDialog.curvedArrow"),shortcuts:["A",E("helpDialog.click"),E("helpDialog.click"),E("helpDialog.click")],isOr:!1}),(0,Z.jsx)(ie,{label:E("helpDialog.curvedLine"),shortcuts:["L",E("helpDialog.click"),E("helpDialog.click"),E("helpDialog.click")],isOr:!1}),(0,Z.jsx)(ie,{label:E("toolBar.lock"),shortcuts:[k.Q]}),(0,Z.jsx)(ie,{label:E("helpDialog.preventBinding"),shortcuts:[H("CtrlOrCmd")]}),(0,Z.jsx)(ie,{label:E("toolBar.link"),shortcuts:[H("CtrlOrCmd+K")]})]}),(0,Z.jsxs)(IE,{className:"HelpDialog__island--view",caption:E("helpDialog.view"),children:[(0,Z.jsx)(ie,{label:E("buttons.zoomIn"),shortcuts:[H("CtrlOrCmd++")]}),(0,Z.jsx)(ie,{label:E("buttons.zoomOut"),shortcuts:[H("CtrlOrCmd+-")]}),(0,Z.jsx)(ie,{label:E("buttons.resetZoom"),shortcuts:[H("CtrlOrCmd+0")]}),(0,Z.jsx)(ie,{label:E("helpDialog.zoomToFit"),shortcuts:["Shift+1"]}),(0,Z.jsx)(ie,{label:E("helpDialog.zoomToSelection"),shortcuts:["Shift+2"]}),(0,Z.jsx)(ie,{label:E("helpDialog.movePageUpDown"),shortcuts:["PgUp/PgDn"]}),(0,Z.jsx)(ie,{label:E("helpDialog.movePageLeftRight"),shortcuts:["Shift+PgUp/PgDn"]}),(0,Z.jsx)(ie,{label:E("buttons.zenMode"),shortcuts:[H("Alt+Z")]}),(0,Z.jsx)(ie,{label:E("buttons.objectsSnapMode"),shortcuts:[H("Alt+S")]}),(0,Z.jsx)(ie,{label:E("labels.showGrid"),shortcuts:[H("CtrlOrCmd+'")]}),(0,Z.jsx)(ie,{label:E("labels.viewMode"),shortcuts:[H("Alt+R")]}),(0,Z.jsx)(ie,{label:E("labels.toggleTheme"),shortcuts:[H("Alt+Shift+D")]}),(0,Z.jsx)(ie,{label:E("stats.title"),shortcuts:[H("Alt+/")]})]}),(0,Z.jsxs)(IE,{className:"HelpDialog__island--editor",caption:E("helpDialog.editor"),children:[(0,Z.jsx)(ie,{label:E("labels.moveCanvas"),shortcuts:[H(`Space+${E("helpDialog.drag")}`),H(`Wheel+${E("helpDialog.drag")}`)],isOr:!0}),(0,Z.jsx)(ie,{label:E("buttons.clearReset"),shortcuts:[H("CtrlOrCmd+Delete")]}),(0,Z.jsx)(ie,{label:E("labels.delete"),shortcuts:[H("Delete")]}),(0,Z.jsx)(ie,{label:E("labels.cut"),shortcuts:[H("CtrlOrCmd+X")]}),(0,Z.jsx)(ie,{label:E("labels.copy"),shortcuts:[H("CtrlOrCmd+C")]}),(0,Z.jsx)(ie,{label:E("labels.paste"),shortcuts:[H("CtrlOrCmd+V")]}),(0,Z.jsx)(ie,{label:E("labels.pasteAsPlaintext"),shortcuts:[H("CtrlOrCmd+Shift+V")]}),(0,Z.jsx)(ie,{label:E("labels.selectAll"),shortcuts:[H("CtrlOrCmd+A")]}),(0,Z.jsx)(ie,{label:E("labels.multiSelect"),shortcuts:[H(`Shift+${E("helpDialog.click")}`)]}),(0,Z.jsx)(ie,{label:E("helpDialog.deepSelect"),shortcuts:[H(`CtrlOrCmd+${E("helpDialog.click")}`)]}),(0,Z.jsx)(ie,{label:E("helpDialog.deepBoxSelect"),shortcuts:[H(`CtrlOrCmd+${E("helpDialog.drag")}`)]}),(hc||ta)&&(0,Z.jsx)(ie,{label:E("labels.copyAsPng"),shortcuts:[H("Shift+Alt+C")]}),(0,Z.jsx)(ie,{label:E("labels.copyStyles"),shortcuts:[H("CtrlOrCmd+Alt+C")]}),(0,Z.jsx)(ie,{label:E("labels.pasteStyles"),shortcuts:[H("CtrlOrCmd+Alt+V")]}),(0,Z.jsx)(ie,{label:E("labels.sendToBack"),shortcuts:[Dr?H("CtrlOrCmd+Alt+["):H("CtrlOrCmd+Shift+[")]}),(0,Z.jsx)(ie,{label:E("labels.bringToFront"),shortcuts:[Dr?H("CtrlOrCmd+Alt+]"):H("CtrlOrCmd+Shift+]")]}),(0,Z.jsx)(ie,{label:E("labels.sendBackward"),shortcuts:[H("CtrlOrCmd+[")]}),(0,Z.jsx)(ie,{label:E("labels.bringForward"),shortcuts:[H("CtrlOrCmd+]")]}),(0,Z.jsx)(ie,{label:E("labels.alignTop"),shortcuts:[H("CtrlOrCmd+Shift+Up")]}),(0,Z.jsx)(ie,{label:E("labels.alignBottom"),shortcuts:[H("CtrlOrCmd+Shift+Down")]}),(0,Z.jsx)(ie,{label:E("labels.alignLeft"),shortcuts:[H("CtrlOrCmd+Shift+Left")]}),(0,Z.jsx)(ie,{label:E("labels.alignRight"),shortcuts:[H("CtrlOrCmd+Shift+Right")]}),(0,Z.jsx)(ie,{label:E("labels.duplicateSelection"),shortcuts:[H("CtrlOrCmd+D"),H(`Alt+${E("helpDialog.drag")}`)]}),(0,Z.jsx)(ie,{label:E("helpDialog.toggleElementLock"),shortcuts:[H("CtrlOrCmd+Shift+L")]}),(0,Z.jsx)(ie,{label:E("buttons.undo"),shortcuts:[H("CtrlOrCmd+Z")]}),(0,Z.jsx)(ie,{label:E("buttons.redo"),shortcuts:Um?[H("CtrlOrCmd+Y"),H("CtrlOrCmd+Shift+Z")]:[H("CtrlOrCmd+Shift+Z")]}),(0,Z.jsx)(ie,{label:E("labels.group"),shortcuts:[H("CtrlOrCmd+G")]}),(0,Z.jsx)(ie,{label:E("labels.ungroup"),shortcuts:[H("CtrlOrCmd+Shift+G")]}),(0,Z.jsx)(ie,{label:E("labels.flipHorizontal"),shortcuts:[H("Shift+H")]}),(0,Z.jsx)(ie,{label:E("labels.flipVertical"),shortcuts:[H("Shift+V")]}),(0,Z.jsx)(ie,{label:E("labels.showStroke"),shortcuts:[H("S")]}),(0,Z.jsx)(ie,{label:E("labels.showBackground"),shortcuts:[H("G")]}),(0,Z.jsx)(ie,{label:E("labels.decreaseFontSize"),shortcuts:[H("CtrlOrCmd+Shift+<")]}),(0,Z.jsx)(ie,{label:E("labels.increaseFontSize"),shortcuts:[H("CtrlOrCmd+Shift+>")]})]})]})]})})};h();var Zk=S(W(),1);h();var Kk=S(_(),1),kE=({children:e,color:t})=>(0,Kk.jsx)("div",{className:"Card",style:{"--card-color":t==="primary"?"var(--color-primary)":rt[t][7],"--card-color-darker":t==="primary"?"var(--color-primary-darker)":rt[t][8],"--card-color-darkest":t==="primary"?"var(--color-primary-darkest)":rt[t][9]},children:e});var rr=S(_(),1),SN=({elements:e,appState:t,setAppState:r,files:o,actionManager:n,exportOpts:i,canvas:a,onCloseRequest:s})=>{let{onExportToBackend:c}=i;return(0,rr.jsx)("div",{className:"ExportDialog ExportDialog--json",children:(0,rr.jsxs)("div",{className:"ExportDialog-cards",children:[i.saveFileToDisk&&(0,rr.jsxs)(kE,{color:"lime",children:[(0,rr.jsx)("div",{className:"Card-icon",children:MT}),(0,rr.jsx)("h2",{children:E("exportDialog.disk_title")}),(0,rr.jsxs)("div",{className:"Card-details",children:[E("exportDialog.disk_details"),!Go&&n.renderAction("changeProjectName")]}),(0,rr.jsx)(be,{className:"Card-button",type:"button",title:E("exportDialog.disk_button"),"aria-label":E("exportDialog.disk_button"),showAriaLabel:!0,onClick:()=>{n.executeAction(zu,"ui")}})]}),c&&(0,rr.jsxs)(kE,{color:"pink",children:[(0,rr.jsx)("div",{className:"Card-icon",children:rf}),(0,rr.jsx)("h2",{children:E("exportDialog.link_title")}),(0,rr.jsx)("div",{className:"Card-details",children:E("exportDialog.link_details")}),(0,rr.jsx)(be,{className:"Card-button",type:"button",title:E("exportDialog.link_button"),"aria-label":E("exportDialog.link_button"),showAriaLabel:!0,onClick:async()=>{try{Ae("export","link",`ui (${B2()})`),await c(e,t,o,a),s()}catch(l){r({errorMessage:l.message})}}})]}),i.renderCustomUI&&i.renderCustomUI(e,t,o,a)]})})},Xk=({elements:e,appState:t,files:r,actionManager:o,exportOpts:n,canvas:i,setAppState:a})=>{let s=Zk.default.useCallback(()=>{a({openDialog:null})},[a]);return(0,rr.jsx)(rr.Fragment,{children:t.openDialog?.name==="jsonExport"&&(0,rr.jsx)(Dt,{onCloseRequest:s,title:E("buttons.export"),children:(0,rr.jsx)(SN,{elements:e,appState:t,setAppState:a,files:r,actionManager:o,onCloseRequest:s,exportOpts:n,canvas:i})})})};h();h();var qk=S(_(),1),jk=e=>(0,qk.jsx)("button",{className:"help-icon",onClick:e.onClick,type:"button",title:`${E("helpDialog.title")} \u2014 ?`,"aria-label":E("helpDialog.title"),children:Gl});var Wr=S(_(),1),Jk=({appState:e,actionManager:t,showExitZenModeBtn:r,renderWelcomeScreen:o})=>{let{FooterCenterTunnel:n,WelcomeScreenHelpHintTunnel:i}=ft(),a=Ke(),s=!e.viewModeEnabled&&e.multiElement&&a.isTouchScreen;return(0,Wr.jsxs)("footer",{role:"contentinfo",className:"layer-ui__wrapper__footer App-menu App-menu_bottom",children:[(0,Wr.jsx)("div",{className:G("layer-ui__wrapper__footer-left zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled}),children:(0,Wr.jsx)(lr.Col,{gap:2,children:(0,Wr.jsxs)(Ga,{heading:"canvasActions",children:[(0,Wr.jsx)(Pk,{renderAction:t.renderAction,zoom:e.zoom}),!e.viewModeEnabled&&(0,Wr.jsx)(Lk,{renderAction:t.renderAction,className:G("zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-bottom":e.zenModeEnabled})}),s&&(0,Wr.jsx)(Rk,{renderAction:t.renderAction,className:G("zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled})})]})})}),(0,Wr.jsx)(n.Out,{}),(0,Wr.jsx)("div",{className:G("layer-ui__wrapper__footer-right zen-mode-transition",{"transition-right":e.zenModeEnabled}),children:(0,Wr.jsxs)("div",{style:{position:"relative"},children:[o&&(0,Wr.jsx)(i.Out,{}),(0,Wr.jsx)(jk,{onClick:()=>t.executeAction(zs)})]})}),(0,Wr.jsx)(Dk,{actionManager:t,showExitZenModeBtn:r})]})},Qk=Jk;Jk.displayName="Footer";h();h();var Ui=S(_(),1),Mg=({title:e,children:t,actionLabel:r,onClick:o})=>(0,Ui.jsxs)("div",{className:"OverwriteConfirm__Actions__Action",children:[(0,Ui.jsx)("h4",{children:e}),(0,Ui.jsx)("div",{className:"OverwriteConfirm__Actions__Action__content",children:t}),(0,Ui.jsx)(oi,{variant:"outlined",color:"muted",label:r,size:"large",fullWidth:!0,onClick:o})]}),CN=()=>{let{t:e}=or(),t=Er(),r=at();return(0,Ui.jsx)(Mg,{title:e("overwriteConfirm.action.exportToImage.title"),actionLabel:e("overwriteConfirm.action.exportToImage.button"),onClick:()=>{t.executeAction(lg,"ui",!0),r({openDialog:{name:"imageExport"}})},children:e("overwriteConfirm.action.exportToImage.description")})},IN=()=>{let{t:e}=or(),t=Er();return(0,Ui.jsx)(Mg,{title:e("overwriteConfirm.action.saveToDisk.title"),actionLabel:e("overwriteConfirm.action.saveToDisk.button"),onClick:()=>{t.executeAction(zu,"ui")},children:e("overwriteConfirm.action.saveToDisk.description")})},_E=Object.assign(({children:e})=>(0,Ui.jsx)("div",{className:"OverwriteConfirm__Actions",children:e}),{ExportToImage:CN,SaveToDisk:IN});var Xo=S(_(),1),Pg=Object.assign(Ni("OverwriteConfirmDialog",({children:e})=>{let{OverwriteConfirmDialogTunnel:t}=ft(),[r,o]=Ne(ux,qe);if(!r.active)return null;let n=()=>{r.onClose(),o(a=>({...a,active:!1}))},i=()=>{r.onConfirm(),o(a=>({...a,active:!1}))};return(0,Xo.jsx)(t.In,{children:(0,Xo.jsx)(Dt,{onCloseRequest:n,title:!1,size:916,children:(0,Xo.jsxs)("div",{className:"OverwriteConfirm",children:[(0,Xo.jsx)("h3",{children:r.title}),(0,Xo.jsxs)("div",{className:`OverwriteConfirm__Description OverwriteConfirm__Description--color-${r.color}`,children:[(0,Xo.jsx)("div",{className:"OverwriteConfirm__Description__icon",children:LS}),(0,Xo.jsx)("div",{children:r.description}),(0,Xo.jsx)("div",{className:"OverwriteConfirm__Description__spacer"}),(0,Xo.jsx)(oi,{color:r.color,size:"large",label:r.actionLabel,onClick:i})]}),(0,Xo.jsx)(_E,{children:e})]})})})}),{Actions:_E,Action:Mg});h();var Re=class e{static rg=new sn;static cache=new WeakMap;static get=t=>e.cache.get(t);static set=(t,r)=>e.cache.set(t,r);static delete=t=>e.cache.delete(t);static destroy=()=>{e.cache=new WeakMap};static generateElementShape=(t,r)=>{let o=r?.isExporting?void 0:e.get(t);if(o!==void 0)return o;Lg.delete(t);let n=e_(t,e.rg,r||{isExporting:!1,canvasBackgroundColor:ge.white});return e.cache.set(t,n),n}};h();var ju=S(_(),1),kN="small",t_=e=>(0,ju.jsxs)("label",{className:G("ToolIcon ToolIcon__LaserPointer",`ToolIcon_size_${kN}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,ju.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":"toolbar-LaserPointer"}),(0,ju.jsx)("div",{className:"ToolIcon__icon",children:nf})]});h();var AE=S(W(),1);h();var ni=S(W(),1);var Xs=S(_(),1),r_=(0,ni.forwardRef)(({value:e,onChange:t,label:r,fullWidth:o,placeholder:n,readonly:i,selectOnRender:a,onKeyDown:s,isRedacted:c=!1},l)=>{let d=(0,ni.useRef)(null);(0,ni.useImperativeHandle)(l,()=>d.current),(0,ni.useLayoutEffect)(()=>{a&&d.current?.select()},[a]);let[u,m]=(0,ni.useState)(!1);return(0,Xs.jsxs)("div",{className:G("ExcTextField",{"ExcTextField--fullWidth":o}),onClick:()=>{d.current?.focus()},children:[(0,Xs.jsx)("div",{className:"ExcTextField__label",children:r}),(0,Xs.jsxs)("div",{className:G("ExcTextField__input",{"ExcTextField__input--readonly":i}),children:[(0,Xs.jsx)("input",{className:G({"is-redacted":e&&c&&!u}),readOnly:i,value:e,placeholder:n,ref:d,onChange:p=>t?.(p.target.value),onKeyDown:s}),c&&(0,Xs.jsx)(Qn,{onSelect:()=>m(!u),style:{border:0,userSelect:"none"},children:u?BS:af})]})]})});h();var o_=S(_(),1),Xc=e=>(0,o_.jsx)("p",{className:"excalidraw__paragraph",style:e.style,children:e.children});var Ht=S(_(),1),n_=e=>{let[t,r]=(0,AE.useState)(e.openAIKey||""),[o,n]=(0,AE.useState)(e.isPersisted),i=et(),a=()=>{e.onConfirm(t.trim(),o)};return i.openDialog?.name!=="settings"?null:(0,Ht.jsx)(Dt,{onCloseRequest:()=>{e.onClose(),e.onConfirm(t.trim(),o)},title:(0,Ht.jsxs)("div",{style:{display:"flex"},children:["Wireframe to Code (AI)"," ",(0,Ht.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"0.1rem 0.5rem",marginLeft:"1rem",fontSize:14,borderRadius:"12px",color:"#000",background:"pink"},children:"Experimental"})]}),className:"MagicSettings",autofocus:!1,children:(0,Ht.jsx)(Xh,{dialog:"settings",tab:i.openDialog.tab,children:(0,Ht.jsxs)(Pc,{tab:"diagram-to-code",children:[(0,Ht.jsxs)(Xc,{children:["For the diagram-to-code feature we use"," ",(0,Ht.jsx)(Lc,{icon:Qd}),"OpenAI."]}),(0,Ht.jsxs)(Xc,{children:["While the OpenAI API is in beta, its use is strictly limited \u2014 as such we require you use your own API key. You can create an"," ",(0,Ht.jsx)("a",{href:"https://platform.openai.com/login?launch",rel:"noopener noreferrer",target:"_blank",children:"OpenAI account"}),", add a small credit (5 USD minimum), and"," ",(0,Ht.jsx)("a",{href:"https://platform.openai.com/api-keys",rel:"noopener noreferrer",target:"_blank",children:"generate your own API key"}),"."]}),(0,Ht.jsx)(Xc,{children:"Your OpenAI key does not leave the browser, and you can also set your own limit in your OpenAI account dashboard if needed."}),(0,Ht.jsx)(r_,{isRedacted:!0,value:t,placeholder:"Paste your API key here",label:"OpenAI API key",onChange:s=>{r(s),e.onChange(s.trim(),o)},selectOnRender:!0,onKeyDown:s=>s.key===k.ENTER&&a()}),(0,Ht.jsx)(Xc,{children:"By default, your API token is not persisted anywhere so you'll need to insert it again after reload. But, you can persist locally in your browser below."}),(0,Ht.jsx)(Ns,{checked:o,onChange:n,children:"Persist API key in browser storage"}),(0,Ht.jsxs)(Xc,{children:["Once API key is set, you can use the ",(0,Ht.jsx)(Lc,{icon:Yl})," ","tool to wrap your elements in a frame that will then allow you to turn it into code. This dialog can be accessed using the"," ",(0,Ht.jsx)("b",{children:"AI Settings"})," ",(0,Ht.jsx)(Lc,{icon:Qd}),"."]}),(0,Ht.jsx)(oi,{className:"MagicSettings__confirm",size:"large",label:"Confirm",onClick:a})]})})})};var oe=S(_(),1),_N=({UIOptions:e})=>(0,oe.jsxs)(Gr,{__fallback:!0,children:[(0,oe.jsx)(Gr.DefaultItems.LoadScene,{}),(0,oe.jsx)(Gr.DefaultItems.SaveToActiveFile,{}),e.canvasActions.export&&(0,oe.jsx)(Gr.DefaultItems.Export,{}),e.canvasActions.saveAsImage&&(0,oe.jsx)(Gr.DefaultItems.SaveAsImage,{}),(0,oe.jsx)(Gr.DefaultItems.Help,{}),(0,oe.jsx)(Gr.DefaultItems.ClearCanvas,{}),(0,oe.jsx)(Gr.Separator,{}),(0,oe.jsx)(Gr.Group,{title:"Excalidraw links",children:(0,oe.jsx)(Gr.DefaultItems.Socials,{})}),(0,oe.jsx)(Gr.Separator,{}),(0,oe.jsx)(Gr.DefaultItems.ToggleTheme,{}),(0,oe.jsx)(Gr.DefaultItems.ChangeCanvasBackground,{})]}),AN=()=>(0,oe.jsxs)(Pg,{__fallback:!0,children:[(0,oe.jsx)(Pg.Actions.SaveToDisk,{}),(0,oe.jsx)(Pg.Actions.ExportToImage,{})]}),MN=({actionManager:e,appState:t,files:r,setAppState:o,elements:n,canvas:i,onLockToggle:a,onHandToolToggle:s,onPenModeToggle:c,showExitZenModeBtn:l,renderTopRightUI:d,renderCustomStats:u,UIOptions:m,onExportImage:p,renderWelcomeScreen:f,children:g,app:x,isCollaborating:y,openAIKey:w,isOpenAIKeyPersisted:T,onOpenAIAPIKeyChange:C,onMagicSettingsConfirm:I})=>{let A=Ke(),P=XC(),[L,D]=Ne(Sa,qe),M=()=>m.canvasActions.export?(0,oe.jsx)(Xk,{elements:n,appState:t,files:r,actionManager:e,exportOpts:m.canvasActions.export,canvas:i,setAppState:o}):null,R=()=>!m.canvasActions.saveAsImage||t.openDialog?.name!=="imageExport"?null:(0,oe.jsx)(Bk,{elements:n,appState:t,files:r,actionManager:e,onExportImage:p,onCloseRequest:()=>o({openDialog:null})}),N=()=>(0,oe.jsxs)("div",{style:{position:"relative"},children:[(0,oe.jsx)(P.MainMenuTunnel.Out,{}),f&&(0,oe.jsx)(P.WelcomeScreenMenuHintTunnel.Out,{})]}),B=()=>(0,oe.jsx)(Ga,{heading:"selectedShapeActions",className:G("selected-shape-actions zen-mode-transition",{"transition-left":t.zenModeEnabled}),children:(0,oe.jsx)(xr,{className:Vm.SHAPE_ACTIONS_MENU,padding:2,style:{maxHeight:`${t.height-166}px`},children:(0,oe.jsx)(yg,{appState:t,elements:n,renderAction:e.renderAction})})}),K=()=>{let X=Vs(t,n);return(0,oe.jsx)(Sg,{side:"top",children:(0,oe.jsxs)("div",{className:"App-menu App-menu_top",children:[(0,oe.jsxs)(lr.Col,{gap:6,className:G("App-menu_top__left"),children:[N(),X&&B()]}),!t.viewModeEnabled&&(0,oe.jsx)(Ga,{heading:"shapes",className:"shapes-section",children:se=>(0,oe.jsxs)("div",{style:{position:"relative"},children:[f&&(0,oe.jsx)(P.WelcomeScreenToolbarHintTunnel.Out,{}),(0,oe.jsx)(lr.Col,{gap:4,align:"start",children:(0,oe.jsxs)(lr.Row,{gap:1,className:G("App-toolbar-container",{"zen-mode":t.zenModeEnabled}),children:[(0,oe.jsxs)(xr,{padding:1,className:G("App-toolbar",{"zen-mode":t.zenModeEnabled}),children:[(0,oe.jsx)(Cg,{appState:t,isMobile:A.editor.isMobile,device:A,app:x}),se,(0,oe.jsxs)(lr.Row,{gap:1,children:[(0,oe.jsx)(kg,{zenModeEnabled:t.zenModeEnabled,checked:t.penMode,onChange:()=>c(null),title:E("toolBar.penMode"),penDetected:t.penDetected}),(0,oe.jsx)(Ig,{checked:t.activeTool.locked,onChange:a,title:E("toolBar.lock")}),(0,oe.jsx)("div",{className:"App-toolbar__divider"}),(0,oe.jsx)(Ag,{checked:an(t),onChange:()=>s(),title:E("toolBar.hand"),isMobile:!0}),(0,oe.jsx)(wg,{appState:t,activeTool:t.activeTool,UIOptions:m,app:x})]})]}),y&&(0,oe.jsx)(xr,{style:{marginLeft:8,alignSelf:"center",height:"fit-content"},children:(0,oe.jsx)(t_,{title:E("toolBar.laser"),checked:t.activeTool.type===Ft.laser,onChange:()=>x.setActiveTool({type:Ft.laser}),isMobile:!0})})]})})]})}),(0,oe.jsxs)("div",{className:G("layer-ui__wrapper__top-right zen-mode-transition",{"transition-right":t.zenModeEnabled}),children:[t.collaborators.size>0&&(0,oe.jsx)(Ah,{collaborators:t.collaborators,userToFollow:t.userToFollow?.socketId||null}),d?.(A.editor.isMobile,t),!t.viewModeEnabled&&(!ne||t.openSidebar?.name!==Fn.name)&&(0,oe.jsx)(P.DefaultSidebarTriggerTunnel.Out,{})]})]})})},V=()=>(0,oe.jsx)(Gh,{__fallback:!0,onDock:X=>{Ae("sidebar",`toggleDock (${X?"dock":"undock"})`,`(${A.editor.isMobile?"mobile":"desktop"})`)}}),ne=Dd(Lu,qe),Q=(0,oe.jsxs)(oe.Fragment,{children:[g,(0,oe.jsx)(_N,{UIOptions:m}),(0,oe.jsx)(Gh.Trigger,{__fallback:!0,icon:q3,title:Sl(E("toolBar.library")),onToggle:X=>{X&&Ae("sidebar",`${Fn.name} (open)`,`button (${A.editor.isMobile?"mobile":"desktop"})`)},tab:Fn.defaultTab,children:E("toolBar.library")}),(0,oe.jsx)(AN,{}),t.openDialog?.name==="ttd"&&(0,oe.jsx)(Bx,{__fallback:!0}),t.isLoading&&(0,oe.jsx)(Xf,{delay:250}),t.errorMessage&&(0,oe.jsx)(Ok,{onClose:()=>o({errorMessage:null}),children:t.errorMessage}),L&&!A.editor.isMobile&&(0,oe.jsx)(Z6,{colorPickerType:L.colorPickerType,onCancel:()=>{D(null)},onChange:(X,se,O,{altKey:F})=>{if(!(X!=="elementBackground"&&X!=="elementStroke"))if(O.length){for(let $ of O)Y($,{[F&&L.swapPreviewOnAlt?X==="elementBackground"?"strokeColor":"backgroundColor":X==="elementBackground"?"backgroundColor":"strokeColor"]:se},!1),Re.delete($);_e.getScene(O[0])?.informMutation()}else o(X==="elementBackground"?{currentItemBackgroundColor:se}:{currentItemStrokeColor:se})},onSelect:(X,se)=>{D(O=>O?.keepOpenOnAlt&&se.altKey?O:null),L?.onSelect?.(X,se)}}),t.openDialog?.name==="help"&&(0,oe.jsx)(Yk,{onClose:()=>{o({openDialog:null})}}),t.openDialog?.name==="settings"&&(0,oe.jsx)(n_,{openAIKey:w,isPersisted:T,onChange:C,onConfirm:(X,se)=>{let O=t.openDialog?.name==="settings"?t.openDialog?.source:"settings";o({openDialog:null},()=>{I(X,se,O)})},onClose:()=>{o({openDialog:null})}}),(0,oe.jsx)(jI,{}),(0,oe.jsx)(P.OverwriteConfirmDialogTunnel.Out,{}),R(),M(),t.pasteDialog.shown&&(0,oe.jsx)(Wk,{setAppState:o,appState:t,onClose:()=>o({pasteDialog:{shown:!1,data:null}})}),A.editor.isMobile&&(0,oe.jsx)(Gk,{app:x,appState:t,elements:n,actionManager:e,renderJSONExportDialog:M,renderImageExportDialog:R,setAppState:o,onLockToggle:a,onHandToolToggle:s,onPenModeToggle:c,renderTopRightUI:d,renderCustomStats:u,renderSidebars:V,device:A,renderWelcomeScreen:f,UIOptions:m}),!A.editor.isMobile&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)("div",{className:"layer-ui__wrapper",style:t.openSidebar&&ne&&A.editor.canFitSidebar?{width:`calc(100% - ${d2}px)`}:{},children:[f&&(0,oe.jsx)(P.WelcomeScreenCenterTunnel.Out,{}),K(),(0,oe.jsx)(Qk,{appState:t,actionManager:e,showExitZenModeBtn:l,renderWelcomeScreen:f}),t.showStats&&(0,oe.jsx)(_g,{appState:t,setAppState:o,elements:n,onClose:()=>{e.executeAction($a)},renderCustomStats:u}),t.scrolledOutside&&(0,oe.jsx)("button",{className:"scroll-back-to-content",onClick:()=>{o(X=>({...Vn(n,X)}))},children:E("buttons.scrollBackToContent")})]}),V()]})]});return(0,oe.jsx)(N1.Provider,{value:t,children:(0,oe.jsx)(ap,{scope:P.jotaiScope,children:(0,oe.jsx)(V1.Provider,{value:P,children:Q})})})},i_=e=>{let{suggestedBindings:t,startBoundElement:r,cursorButton:o,scrollX:n,scrollY:i,...a}=e;return a},PN=(e,t)=>{if(e.children!==t.children)return!1;let{canvas:r,appState:o,...n}=e,{canvas:i,appState:a,...s}=t;return $t(i_(o),i_(a),{selectedElementIds:$t,selectedGroupIds:$t})&&$t(n,s)},s_=a_.default.memo(MN,PN);h();var jc=S(W(),1);var qu=S(_(),1),LN=5e3,l_=({message:e,onClose:t,closable:r=!1,duration:o=LN})=>{let n=(0,jc.useRef)(0),i=o!==1/0,a=(0,jc.useCallback)(()=>{i&&(n.current=window.setTimeout(()=>t(),o))},[t,o,i]);return(0,jc.useEffect)(()=>{if(i)return a(),()=>clearTimeout(n.current)},[a,e,o,i]),(0,qu.jsxs)("div",{className:"Toast",onMouseEnter:i?()=>clearTimeout(n?.current):void 0,onMouseLeave:i?a:void 0,children:[(0,qu.jsx)("p",{className:"Toast__message",children:e}),r&&(0,qu.jsx)(be,{icon:Oo,"aria-label":"close",type:"icon",onClick:t,className:"close"})]})};h();var ME=U({name:"viewMode",viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.viewModeEnabled},perform(e,t){return{appState:{...t,viewModeEnabled:!this.checked(t)},commitToHistory:!1}},checked:e=>e.viewModeEnabled,predicate:(e,t,r)=>typeof r.viewModeEnabled>"u",contextItemLabel:"labels.viewMode",keyTest:e=>!e[k.CTRL_OR_CMD]&&e.altKey&&e.code===ve.R});var eA=S(cx(),1);h();var Dg=class e{scene;onSceneUpdated;constructor({scene:t,onSceneUpdated:r}){this.scene=t,this.onSceneUpdated=r}static loadedFontFaces=new Set;onFontsLoaded=t=>{if(t.every(o=>{let n=`${o.family}-${o.style}-${o.weight}`;return e.loadedFontFaces.has(n)?!0:(e.loadedFontFaces.add(n),!1)}))return!1;let r=!1;this.scene.mapElements(o=>ee(o)&&!$e(o)?(Re.delete(o),r=!0,de(o,{...Fl(o)})):o),r&&this.onSceneUpdated()};loadFontsForElements=async t=>{let r=await Promise.all([...new Set(t.filter(o=>ee(o)).map(o=>o.fontFamily))].map(o=>{let n=Ve({fontFamily:o,fontSize:16});if(!document.fonts?.check?.(n))return document.fonts?.load?.(n)}));this.onFontsLoaded(r.flat().filter(Boolean))}};h();var c_=(e,t)=>{let r=t.scene.getSelectedElements(e);return r.length===1&&le(r[0])},d_=U({name:"selectAllElementsInFrame",trackEvent:{category:"canvas"},perform:(e,t,r,o)=>{let n=o.scene.getSelectedElements(t).at(0)||null;if(le(n)){let i=po(we(e),n.id).filter(a=>!(a.type==="text"&&a.containerId));return{elements:e,appState:{...t,selectedElementIds:i.reduce((a,s)=>(a[s.id]=!0,a),{})},commitToHistory:!1}}return{elements:e,appState:t,commitToHistory:!1}},contextItemLabel:"labels.selectAllElementsInFrame",predicate:(e,t,r,o)=>c_(t,o)}),u_=U({name:"removeAllElementsFromFrame",trackEvent:{category:"history"},perform:(e,t,r,o)=>{let n=o.scene.getSelectedElements(t).at(0)||null;return le(n)?{elements:PE(e,n,t),appState:{...t,selectedElementIds:{[n.id]:!0}},commitToHistory:!0}:{elements:e,appState:t,commitToHistory:!1}},contextItemLabel:"labels.removeAllElementsFromFrame",predicate:(e,t,r,o)=>c_(t,o)}),Cve=U({name:"updateFrameRendering",viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t)=>({elements:e,appState:{...t,frameRendering:{...t.frameRendering,enabled:!t.frameRendering.enabled}},commitToHistory:!1}),contextItemLabel:"labels.updateFrameRendering",checked:e=>e.frameRendering.enabled}),Ive=U({name:"setFrameAsActiveTool",trackEvent:{category:"toolbar"},perform:(e,t,r,o)=>{let n=st(t,{type:"frame"});return lo(o.interactiveCanvas,{...t,activeTool:n}),{elements:e,appState:{...t,activeTool:st(t,{type:"frame"})},commitToHistory:!1}},keyTest:e=>!e[k.CTRL_OR_CMD]&&!e.shiftKey&&!e.altKey&&e.key.toLocaleLowerCase()===k.F});h();var DN=8,m_=99999,Og=e=>DN/e,jo=class e{static referenceSnapPoints=null;static visibleGaps=null;static setReferenceSnapPoints=t=>{e.referenceSnapPoints=t};static getReferenceSnapPoints=()=>e.referenceSnapPoints;static setVisibleGaps=t=>{e.visibleGaps=t};static getVisibleGaps=()=>e.visibleGaps;static destroy=()=>{e.referenceSnapPoints=null,e.visibleGaps=null}},Wi=({event:e,appState:t,selectedElements:r})=>e?t.objectsSnapModeEnabled&&!e[k.CTRL_OR_CMD]||!t.objectsSnapModeEnabled&&e[k.CTRL_OR_CMD]&&t.gridSize===null:r.length===1&&r[0].type==="arrow"?!1:t.objectsSnapModeEnabled,RN=(e,t,r=.01)=>Math.abs(e-t)<=r,em=(e,{omitCenter:t,boundingBoxCorners:r,dragOffset:o}={omitCenter:!1,boundingBoxCorners:!1})=>{let n=[];if(e.length===1){let i=e[0],[a,s,c,l,d,u]=ue(i);o&&(a+=o.x,c+=o.x,d+=o.x,s+=o.y,l+=o.y,u+=o.y);let m=(c-a)/2,p=(l-s)/2;if((i.type==="diamond"||i.type==="ellipse")&&!r){let f=tt([a,s+p],[d,u],i.angle),g=tt([a+m,s],[d,u],i.angle),x=tt([c,s+p],[d,u],i.angle),y=tt([a+m,l],[d,u],i.angle);n=t?[f,g,x,y]:[f,g,x,y,[d,u]]}else{let f=tt([a,s],[d,u],i.angle),g=tt([c,s],[d,u],i.angle),x=tt([a,l],[d,u],i.angle),y=tt([c,l],[d,u],i.angle);n=t?[f,g,x,y]:[f,g,x,y,[d,u]]}}else if(e.length>1){let[i,a,s,c]=Rg(e,o??{x:0,y:0}),l=s-i,d=c-a,u=[i,a],m=[s,a],p=[i,c],f=[s,c],g=[i+l/2,a+d/2];n=t?[u,m,p,f]:[u,m,p,f,g]}return n.map(i=>[It(i[0]),It(i[1])])},h_=(e,t,r)=>{let o=t.filter(n=>le(n)).map(n=>n.id);return LE(e,t,r).filter(n=>!(n.frameId&&o.includes(n.frameId)))},g_=(e,t,r)=>{let o=h_(e,t,r),n=ys(o).filter(d=>!(d.length===1&&$e(d[0]))).map(d=>Me(d).map(u=>It(u))),i=n.sort((d,u)=>d[0]-u[0]),a=[],s=0;e:for(let d=0;d<i.length;d++){let u=i[d];for(let m=d+1;m<i.length;m++){if(++s>m_)break e;let p=i[m],[,f,g,x]=u,[y,w,,T]=p;g<y&&Ju([f,x],[w,T])&&a.push({startBounds:u,endBounds:p,startSide:[[g,f],[g,x]],endSide:[[y,w],[y,T]],length:y-g,overlap:Qu([f,x],[w,T])})}}let c=n.sort((d,u)=>d[1]-u[1]),l=[];s=0;e:for(let d=0;d<c.length;d++){let u=c[d];for(let m=d+1;m<c.length;m++){if(++s>m_)break e;let p=c[m],[f,,g,x]=u,[y,w,T]=p;x<w&&Ju([f,g],[y,T])&&l.push({startBounds:u,endBounds:p,startSide:[[f,x],[g,x]],endSide:[[y,w],[T,w]],length:w-x,overlap:Qu([f,g],[y,T])})}}return{horizontalGaps:a,verticalGaps:l}},p_=(e,t,r,o,n,i,a)=>{if(!Wi({appState:r,event:o,selectedElements:e}))return[];if(e.length===0)return[];let s=jo.getVisibleGaps();if(s){let{horizontalGaps:c,verticalGaps:l}=s,[d,u,m,p]=Rg(e,t).map(x=>It(x)),f=(d+m)/2,g=(u+p)/2;for(let x of c){if(!Ju([u,p],x.overlap))continue;let y=x.startSide[0][0]+x.length/2,w=It(y-f);if(x.length>m-d&&Math.abs(w)<=a.x){Math.abs(w)<a.x&&(n.length=0),a.x=Math.abs(w);let M={type:"gap",direction:"center_horizontal",gap:x,offset:w};n.push(M);continue}let[,,C]=x.endBounds,I=d-C,A=It(x.length-I);if(Math.abs(A)<=a.x){Math.abs(A)<a.x&&(n.length=0),a.x=Math.abs(A);let M={type:"gap",direction:"side_right",gap:x,offset:A};n.push(M);continue}let[P,,,]=x.startBounds,L=P-m,D=It(L-x.length);if(Math.abs(D)<=a.x){Math.abs(D)<a.x&&(n.length=0),a.x=Math.abs(D);let M={type:"gap",direction:"side_left",gap:x,offset:D};n.push(M);continue}}for(let x of l){if(!Ju([d,m],x.overlap))continue;let y=x.startSide[0][1]+x.length/2,w=It(y-g);if(x.length>p-u&&Math.abs(w)<=a.y){Math.abs(w)<a.y&&(i.length=0),a.y=Math.abs(w);let M={type:"gap",direction:"center_vertical",gap:x,offset:w};i.push(M);continue}let[,C,,]=x.startBounds,I=C-p,A=It(I-x.length);if(Math.abs(A)<=a.y){Math.abs(A)<a.y&&(i.length=0),a.y=Math.abs(A);let M={type:"gap",direction:"side_top",gap:x,offset:A};i.push(M);continue}let[,,,P]=x.endBounds,L=It(u-P),D=x.length-L;if(Math.abs(D)<=a.y){Math.abs(D)<a.y&&(i.length=0),a.y=Math.abs(D);let M={type:"gap",direction:"side_bottom",gap:x,offset:D};i.push(M);continue}}}},b_=(e,t,r)=>{let o=h_(e,t,r);return ys(o).filter(n=>!(n.length===1&&$e(n[0]))).flatMap(n=>em(n))},qc=(e,t,r,o,n,i,a)=>{if(!Wi({appState:r,event:o,selectedElements:e})||e.length===0&&t.length===0)return[];let s=jo.getReferenceSnapPoints();if(s)for(let c of t)for(let l of s){let d=l[0]-c[0],u=l[1]-c[1];Math.abs(d)<=a.x&&(Math.abs(d)<a.x&&(n.length=0),n.push({type:"point",points:[c,l],offset:d}),a.x=Math.abs(d)),Math.abs(u)<=a.y&&(Math.abs(u)<a.y&&(i.length=0),i.push({type:"point",points:[c,l],offset:u}),a.y=Math.abs(u))}},x_=(e,t,r,o)=>{if(!Wi({appState:r,event:o,selectedElements:e})||e.length===0)return{snapOffset:{x:0,y:0},snapLines:[]};t.x=It(t.x),t.y=It(t.y);let n=[],i=[],a=Og(r.zoom.value),s={x:a,y:a},c=em(e,{dragOffset:t});qc(e,c,r,o,n,i,s),p_(e,t,r,o,n,i,s);let l={x:n[0]?.offset??0,y:i[0]?.offset??0};s.x=0,s.y=0,n.length=0,i.length=0;let d={x:It(t.x+l.x),y:It(t.y+l.y)};qc(e,em(e,{dragOffset:d}),r,o,n,i,s),p_(e,d,r,o,n,i,s);let u=DE(n,i),m=NN(e,d,[...n,...i].filter(p=>p.type==="gap"));return{snapOffset:l,snapLines:[...u,...m]}},It=e=>Math.round(e*10**6)/10**6,f_=e=>{let t=new Map;for(let r of e){let o=r.join(",");t.has(o)||t.set(o,r)}return Array.from(t.values())},DE=(e,t)=>{let r={},o={};if(e.length>0){for(let n of e)if(n.type==="point"){let i=It(n.points[0][0]);r[i]||(r[i]=[]),r[i].push(...n.points.map(a=>[It(a[0]),It(a[1])]))}}if(t.length>0){for(let n of t)if(n.type==="point"){let i=It(n.points[0][1]);o[i]||(o[i]=[]),o[i].push(...n.points.map(a=>[It(a[0]),It(a[1])]))}}return Object.entries(r).map(([n,i])=>({type:"points",points:f_(i.map(a=>[Number(n),a[1]]).sort((a,s)=>a[1]-s[1]))})).concat(Object.entries(o).map(([n,i])=>({type:"points",points:f_(i.map(a=>[a[0],Number(n)]).sort((a,s)=>a[0]-s[0]))})))},ON=e=>{let t=new Map;for(let r of e){let o=r.points.flat().map(n=>[It(n)]).join(",");t.has(o)||t.set(o,r)}return Array.from(t.values())},NN=(e,t,r)=>{let[o,n,i,a]=Rg(e,t),s=[];for(let c of r){let[l,d,u,m]=c.gap.startBounds,[p,f,g,x]=c.gap.endBounds,y=Qu([n,a],c.gap.overlap),w=Qu([o,i],c.gap.overlap);switch(c.direction){case"center_horizontal":{if(y){let T=(y[0]+y[1])/2;s.push({type:"gap",direction:"horizontal",points:[[c.gap.startSide[0][0],T],[o,T]]},{type:"gap",direction:"horizontal",points:[[i,T],[c.gap.endSide[0][0],T]]})}break}case"center_vertical":{if(w){let T=(w[0]+w[1])/2;s.push({type:"gap",direction:"vertical",points:[[T,c.gap.startSide[0][1]],[T,n]]},{type:"gap",direction:"vertical",points:[[T,a],[T,c.gap.endSide[0][1]]]})}break}case"side_right":{if(y){let T=(y[0]+y[1])/2;s.push({type:"gap",direction:"horizontal",points:[[u,T],[p,T]]},{type:"gap",direction:"horizontal",points:[[g,T],[o,T]]})}break}case"side_left":{if(y){let T=(y[0]+y[1])/2;s.push({type:"gap",direction:"horizontal",points:[[i,T],[l,T]]},{type:"gap",direction:"horizontal",points:[[u,T],[p,T]]})}break}case"side_top":{if(w){let T=(w[0]+w[1])/2;s.push({type:"gap",direction:"vertical",points:[[T,a],[T,d]]},{type:"gap",direction:"vertical",points:[[T,m],[T,f]]})}break}case"side_bottom":{if(w){let T=(w[0]+w[1])/2;s.push({type:"gap",direction:"vertical",points:[[T,m],[T,f]]},{type:"gap",direction:"vertical",points:[[T,x],[T,n]]})}break}}}return ON(s.map(c=>({...c,points:c.points.map(l=>[It(l[0]),It(l[1])])})))},E_=(e,t,r,o,n,i)=>{if(!Wi({event:o,selectedElements:e,appState:r})||e.length===0||e.length===1&&!RN(e[0].angle,0))return{snapOffset:{x:0,y:0},snapLines:[]};let[a,s,c,l]=Me(t);i&&(i.includes("e")?c+=n.x:i.includes("w")&&(a+=n.x),i.includes("n")?s+=n.y:i.includes("s")&&(l+=n.y));let d=[];if(i)switch(i){case"e":{d.push([c,s],[c,l]);break}case"w":{d.push([a,s],[a,l]);break}case"n":{d.push([a,s],[c,s]);break}case"s":{d.push([a,l],[c,l]);break}case"ne":{d.push([c,s]);break}case"nw":{d.push([a,s]);break}case"se":{d.push([c,l]);break}case"sw":{d.push([a,l]);break}}let u=Og(r.zoom.value),m={x:u,y:u},p=[],f=[];qc(t,d,r,o,p,f,m);let g={x:p[0]?.offset??0,y:f[0]?.offset??0};m.x=0,m.y=0,p.length=0,f.length=0;let[x,y,w,T]=Me(e).map(A=>It(A));qc(e,[[x,y],[x,T],[w,y],[w,T]],r,o,p,f,m);let I=DE(p,f);return{snapOffset:g,snapLines:I}},y_=(e,t,r,o,n)=>{if(!Wi({event:r,selectedElements:[e],appState:t}))return{snapOffset:{x:0,y:0},snapLines:[]};let i=[[o.x+n.x,o.y+n.y]],a=Og(t.zoom.value),s={x:a,y:a},c=[],l=[];qc([e],i,t,r,c,l,s);let d={x:c[0]?.offset??0,y:l[0]?.offset??0};s.x=0,s.y=0,c.length=0,l.length=0;let u=em([e],{boundingBoxCorners:!0,omitCenter:!0});qc([e],u,t,r,c,l,s);let m=DE(c,l);return{snapOffset:d,snapLines:m}},w_=(e,t,r,o)=>{if(!Wi({event:o,selectedElements:[],appState:t}))return{originOffset:{x:0,y:0},snapLines:[]};let n=LE(e,[],t),i=Og(t.zoom.value),a={x:i,y:i},s=[],c=[];for(let l of n){let d=em([l]);for(let u of d){let m=u[0]-r.x;Math.abs(m)<=Math.abs(a.x)&&(Math.abs(m)<Math.abs(a.x)&&(c.length=0),c.push({type:"pointer",points:[u,[u[0],r.y]],direction:"vertical"}),a.x=m);let p=u[1]-r.y;Math.abs(p)<=Math.abs(a.y)&&(Math.abs(p)<Math.abs(a.y)&&(s.length=0),s.push({type:"pointer",points:[u,[r.x,u[1]]],direction:"horizontal"}),a.y=p)}}return{originOffset:{x:c.length>0?c[0].points[0][0]-r.x:0,y:s.length>0?s[0].points[0][1]-r.y:0},snapLines:[...c,...s]}},v_=e=>e===Ft.rectangle||e===Ft.ellipse||e===Ft.diamond||e===Ft.frame||e===Ft.magicframe||e===Ft.image;h();var Ar=S(_(),1),FN=()=>(0,Ar.jsxs)("div",{"data-testid":"brave-measure-text-error",children:[(0,Ar.jsx)("p",{children:(0,Ar.jsx)($r,{i18nKey:"errors.brave_measure_text_error.line1",bold:e=>(0,Ar.jsx)("span",{style:{fontWeight:600},children:e})})}),(0,Ar.jsx)("p",{children:(0,Ar.jsx)($r,{i18nKey:"errors.brave_measure_text_error.line2",bold:e=>(0,Ar.jsx)("span",{style:{fontWeight:600},children:e})})}),(0,Ar.jsx)("p",{children:(0,Ar.jsx)($r,{i18nKey:"errors.brave_measure_text_error.line3",link:e=>(0,Ar.jsx)("a",{href:"http://docs.excalidraw.com/docs/@excalidraw/excalidraw/faq#turning-off-aggresive-block-fingerprinting-in-brave-browser",children:e})})}),(0,Ar.jsx)("p",{children:(0,Ar.jsx)($r,{i18nKey:"errors.brave_measure_text_error.line4",issueLink:e=>(0,Ar.jsx)("a",{href:"https://github.com/excalidraw/excalidraw/issues/new",children:e}),discordLink:e=>(0,Ar.jsxs)("a",{href:"https://discord.gg/UexuTaE",children:[e,"."]})})})]}),T_=FN;h();h();var Jc=S(W(),1);var I_=S(_(),1),BN=e=>{let t=(0,Jc.useRef)(!1);return(0,Jc.useEffect)(()=>{if(!t.current){t.current=!0;return}let r={},o={},n={},i={},a={};e.appState.collaborators.forEach((c,l)=>{if(c.selectedElementIds)for(let d of Object.keys(c.selectedElementIds))d in n||(n[d]=[]),n[d].push(l);c.pointer&&(c.username&&(i[l]=c.username),c.userState&&(a[l]=c.userState),o[l]=nr({sceneX:c.pointer.x,sceneY:c.pointer.y},e.appState),r[l]=c.button)});let s=e.containerRef?.current&&getComputedStyle(e.containerRef.current).getPropertyValue("--color-selection")||"#6965db";C_({canvas:e.canvas,elements:e.elements,visibleElements:e.visibleElements,selectedElements:e.selectedElements,scale:window.devicePixelRatio,appState:e.appState,renderConfig:{remotePointerViewportCoords:o,remotePointerButton:r,remoteSelectedElementIds:n,remotePointerUsernames:i,remotePointerUserStates:a,selectionColor:s,renderScrollbars:!1},callback:e.renderInteractiveSceneCallback},gp())}),(0,I_.jsx)("canvas",{className:"excalidraw__canvas interactive",style:{width:e.appState.width,height:e.appState.height,cursor:e.appState.viewModeEnabled?Ue.GRAB:Ue.AUTO},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:e.handleCanvasRef,onContextMenu:e.onContextMenu,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onPointerCancel:e.onPointerCancel,onTouchMove:e.onTouchMove,onPointerDown:e.onPointerDown,onDoubleClick:e.appState.viewModeEnabled?void 0:e.onDoubleClick,children:E("labels.drawingCanvas")})},S_=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,editingGroupId:e.editingGroupId,editingLinearElement:e.editingLinearElement,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,pendingImageElementId:e.pendingImageElementId,selectionElement:e.selectionElement,selectedGroupIds:e.selectedGroupIds,selectedLinearElement:e.selectedLinearElement,multiElement:e.multiElement,isBindingEnabled:e.isBindingEnabled,suggestedBindings:e.suggestedBindings,isRotating:e.isRotating,elementsToHighlight:e.elementsToHighlight,collaborators:e.collaborators,activeEmbeddable:e.activeEmbeddable,snapLines:e.snapLines,zenModeEnabled:e.zenModeEnabled}),zN=(e,t)=>e.selectionNonce!==t.selectionNonce||e.versionNonce!==t.versionNonce||e.scale!==t.scale||e.elements!==t.elements||e.visibleElements!==t.visibleElements||e.selectedElements!==t.selectedElements?!1:$t(S_(e.appState),S_(t.appState)),RE=Jc.default.memo(BN,zN);h();var js=S(W(),1);var __=S(_(),1),HN=e=>{let t=(0,js.useRef)(null),r=(0,js.useRef)(!1);return(0,js.useEffect)(()=>{let o=t.current;if(!o)return;let n=e.canvas;r.current||(r.current=!0,o.replaceChildren(n),n.classList.add("excalidraw__canvas","static"));let i=`${e.appState.width}px`,a=`${e.appState.height}px`;n.style.width!==i&&(n.style.width=i),n.style.height!==a&&(n.style.height=a);let s=e.appState.width*e.scale,c=e.appState.height*e.scale;n.width!==s&&(n.width=s),n.height!==c&&(n.height=c),ig({canvas:n,rc:e.rc,scale:e.scale,elements:e.elements,visibleElements:e.visibleElements,appState:e.appState,renderConfig:e.renderConfig},gp())}),(0,__.jsx)("div",{className:"excalidraw__canvas-wrapper",ref:t})},k_=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,pendingImageElementId:e.pendingImageElementId,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,viewBackgroundColor:e.viewBackgroundColor,exportScale:e.exportScale,selectedElementsAreBeingDragged:e.selectedElementsAreBeingDragged,gridSize:e.gridSize,frameRendering:e.frameRendering,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,editingGroupId:e.editingGroupId}),$N=(e,t)=>e.versionNonce!==t.versionNonce||e.scale!==t.scale||e.elements!==t.elements||e.visibleElements!==t.visibleElements?!1:$t(k_(e.appState),k_(t.appState))&&$t(e.renderConfig,t.renderConfig),OE=js.default.memo(HN,$N);h();var tm=class{scene;constructor(t){this.scene=t}getRenderableElements=(()=>{let t=({elements:o,zoom:n,offsetLeft:i,offsetTop:a,scrollX:s,scrollY:c,height:l,width:d})=>o.filter(u=>qs(u,d,l,{zoom:n,offsetLeft:i,offsetTop:a,scrollX:s,scrollY:c})),r=({editingElement:o,elements:n,pendingImageElementId:i})=>n.filter(a=>ko(a)&&i===a.id?!1:!o||o.type!=="text"||a.id!==o.id);return z2(({zoom:o,offsetLeft:n,offsetTop:i,scrollX:a,scrollY:s,height:c,width:l,editingElement:d,pendingImageElementId:u,versionNonce:m})=>{let p=this.scene.getNonDeletedElements(),f=r({elements:p,editingElement:d,pendingImageElementId:u}),g=t({elements:f,zoom:o,offsetLeft:n,offsetTop:i,scrollX:a,scrollY:s,height:c,width:l});return{canvasElements:f,visibleElements:g}})})();destroy(){A_(),this.getRenderableElements.clear()}};h();var Ng=S(W(),1);var NE=S(_(),1),M_=({manager:e})=>{let t=(0,Ng.useRef)(null);return(0,Ng.useEffect)(()=>(t.current&&e.start(t.current),()=>{e.stop()}),[e]),(0,NE.jsx)("div",{className:"LaserToolOverlay",children:(0,NE.jsx)("svg",{ref:t,className:"LaserToolOverlayCanvas"})})};h();h();function GN(e,t,r,o){Object.defineProperty(e,t,{get:r,set:o,enumerable:!0,configurable:!0})}var UN={};GN(UN,"LaserPointer",()=>td);function Kt([e,t,r],[o,n,i]){return[e+o,t+n,r+i]}function rm([e,t,r],[o,n,i]){return[e-o,t-n,r-i]}function dr([e,t,r],o){return[e*o,t*o,r*o]}function Qc([e,t,r]){return[e/Math.sqrt(e**2+t**2),t/Math.sqrt(e**2+t**2),r]}function Vr([e,t,r],o){return[Math.cos(o)*e-Math.sin(o)*t,Math.sin(o)*e+Math.cos(o)*t,r]}function WN(e,t,r){return Kt(e,dr(rm(t,e),r))}function P_(e,t,r){return Math.atan2(r[1]-e[1],r[0]-e[0])-Math.atan2(t[1]-e[1],t[0]-e[0])}function L_(e){return Math.atan2(Math.sin(e),Math.cos(e))}function D_([e,t]){return Math.sqrt(e**2+t**2)}function ed([e,t],[r,o]){return Math.sqrt((r-e)**2+(o-t)**2)}function VN(e){if(e.length<2)return 0;let t=0;for(let r=1;r<=e.length-1;r++)t+=ed(e[r-1],e[r]);return t+=ed(e[e.length-2],e[e.length-1]),t}var YN=(e,t,r)=>Math.max(t,Math.min(r,e));function KN(e,t,r){let o=ed(t,r);if(o===0)return ed(e,t);let n=YN(((e[0]-t[0])*(r[0]-t[0])+(e[1]-t[1])*(r[1]-t[1]))/o**2,0,1),i=[t[0]+n*(r[0]-t[0]),t[1]+n*(r[1]-t[1]),e[2]];return ed(i,e)}function Fg(e,t){if(t===0||e.length<=2)return e;let r=e[0],o=e[e.length-1],[n,i]=e.reduce(([a,s],c,l)=>{let d=KN(c,r,o);return d>a?[d,l]:[a,s]},[0,-1]);if(n>=t){let a=e[i];return[...Fg([r,...e.slice(1,i),a],t).slice(0,-1),a,...Fg([a,...e.slice(i,-1),o],t).slice(1)]}else return[r,o]}var td=class e{static#e=(()=>{this.defaults={size:2,streamline:.45,simplify:.1,simplifyPhase:"output",sizeMapping:()=>1}})();static#t=(()=>{this.constants={cornerDetectionMaxAngle:120,cornerDetectionVariance:t=>t>35?.5:1,maxTailLength:50}})();constructor(t){this.originalPoints=[],this.stablePoints=[],this.tailPoints=[],this.isFresh=!0,this.options=Object.assign({},e.defaults,t)}get lastPoint(){return this.tailPoints[this.tailPoints.length-1]??this.stablePoints[this.stablePoints.length-1]}addPoint(t){let r=this.originalPoints[this.originalPoints.length-1];if(!(r&&r[0]===t[0]&&r[1]===t[1])){if(this.originalPoints.push(t),this.isFresh){this.isFresh=!1,this.stablePoints.push(t);return}this.options.streamline>0&&(t=WN(this.lastPoint,t,1-this.options.streamline)),this.tailPoints.push(t),VN(this.tailPoints)>e.constants.maxTailLength&&this.stabilizeTail()}}close(){this.stabilizeTail()}stabilizeTail(){if(this.options.simplify>0&&this.options.simplifyPhase=="tail")throw new Error("Not implemented yet");this.stablePoints.push(...this.tailPoints),this.tailPoints=[]}getSize(t,r,o,n,i){return(t??this.options.size)*this.options.sizeMapping({pressure:r,runningLength:i,currentIndex:o,totalLength:n})}getStrokeOutline(t){if(this.isFresh)return[];let r=[...this.stablePoints,...this.tailPoints];this.options.simplify>0&&this.options.simplifyPhase==="input"&&(r=Fg(r,this.options.simplify));let o=r.length;if(o===0)return[];if(o===1){let P=r[0],L=[];for(let D=0;D<=Math.PI*2;D+=Math.PI/16)L.push(Kt(P,dr(Vr([1,0,0],D),this.getSize(t,P[2],0,o,0))));return L.push(Kt(P,dr([1,0,0],this.getSize(t,P[2],0,o,0)))),L}if(o===2){let P=r[0],L=r[1],D=[],M=P_(P,[P[0],P[1]-100,P[2]],L);for(let R=M;R<=Math.PI+M;R+=Math.PI/16)D.push(Kt(P,dr(Vr([1,0,0],R),this.getSize(t,P[2],0,o,0))));for(let R=Math.PI+M;R<=Math.PI*2+M;R+=Math.PI/16)D.push(Kt(L,dr(Vr([1,0,0],R),this.getSize(t,L[2],0,o,0))));return D.push(D[0]),D}let n=[],i=[],a=0,s=0,c=0,l=0;for(let P=1;P<o-1;P++){let L=r[P-1],D=r[P],M=r[P+1],R=D[2],N=ed(L,D);l+=N,a=s+(N-s)*.2;let B=this.getSize(t,R,P,o,l);if(B===0){c=P+1;continue}let K=Qc(rm(L,D)),V=Qc(rm(M,D)),ne=Vr(K,Math.PI/2),Q=Vr(K,-Math.PI/2),X=Vr(V,Math.PI/2),se=Vr(V,-Math.PI/2),O=Kt(D,dr(ne,B)),F=Kt(D,dr(Q,B)),$=Kt(D,dr(X,B)),j=Kt(D,dr(se,B)),q=Kt(ne,se),J=Kt(Q,X),te=Kt(D,dr(D_(q)===0?K:Qc(q),B)),ce=Kt(D,dr(D_(J)===0?V:Qc(J),B)),it=L_(P_(D,L,M)),Ge=e.constants.cornerDetectionMaxAngle/180*Math.PI*e.constants.cornerDetectionVariance(a);if(Math.abs(it)<Ge){let Be=Math.abs(L_(Math.PI-it));if(Be===0)continue;if(it<0){i.push(F,ce);for(let ke=0;ke<=Be;ke+=Be/4)n.push(Kt(D,Vr(dr(ne,B),ke)));for(let ke=Be;ke>=0;ke-=Be/4)i.push(Kt(D,Vr(dr(ne,B),ke)));i.push(ce,$)}else{n.push(O,te);for(let ke=0;ke<=Be;ke+=Be/4)i.push(Kt(D,Vr(dr(ne,-B),-ke)));for(let ke=Be;ke>=0;ke-=Be/4)n.push(Kt(D,Vr(dr(ne,-B),-ke)));n.push(te,j)}}else n.push(te),i.push(ce);s=a}let d=r[c],u=r[c+1],m=r[o-2],p=r[o-1];if(c>=o-2)return[];let f=Qc(rm(u,d)),g=Qc(rm(m,p)),x=Vr(f,-Math.PI/2),y=Vr(g,Math.PI/2),w=this.getSize(t,d[2],0,o,0),T=[],C=this.getSize(t,m[2],o-2,o,l),I=[];for(let P=0;P<=Math.PI;P+=Math.PI/16)T.unshift(Kt(d,Vr(dr(x,w),-P)));T.unshift(Kt(d,dr(x,-w)));for(let P=0;P<=Math.PI;P+=Math.PI/16)I.push(Kt(p,Vr(dr(y,-C),-P)));let A=[...T,...n,...I.reverse(),...i.reverse()];return T.length>0&&A.push(T[0]),this.options.simplify>0&&this.options.simplifyPhase==="output"?Fg(A,this.options.simplify):A}};var BE=1e3,ZN=50,Bg=(e,t)=>(e+t)/2;function XN(e,t=!0){let r=e.length;if(r<4)return"";let o=e[0],n=e[1],i=e[2],a=`M${o[0].toFixed(2)},${o[1].toFixed(2)} Q${n[0].toFixed(2)},${n[1].toFixed(2)} ${Bg(n[0],i[0]).toFixed(2)},${Bg(n[1],i[1]).toFixed(2)} T`;for(let s=2,c=r-1;s<c;s++)o=e[s],n=e[s+1],a+=`${Bg(o[0],n[0]).toFixed(2)},${Bg(o[1],n[1]).toFixed(2)} `;return t&&(a+="Z"),a}function R_(e){return 1-Math.pow(1-e,3)}function FE(){return{currentPath:void 0,finishedPaths:[],lastPoint:[-1e4,-1e4],svg:document.createElementNS("http://www.w3.org/2000/svg","path")}}function O_(){return td.constants.cornerDetectionMaxAngle=70,new td({simplify:0,streamline:.4,sizeMapping:e=>{let t=BE,r=ZN,o=Math.max(0,1-(performance.now()-e.pressure)/t),n=(r-Math.min(r,e.totalLength-e.currentIndex))/r;return Math.min(R_(n),R_(o))}})}var zg=class{constructor(t){this.app=t;this.ownState=FE()}ownState;collaboratorsState=new Map;rafId;isDrawing=!1;container;destroy(){this.stop(),this.isDrawing=!1,this.ownState=FE(),this.collaboratorsState=new Map}startPath(t,r){this.ownState.currentPath=O_(),this.ownState.currentPath.addPoint([t,r,performance.now()]),this.updatePath(this.ownState)}addPointToPath(t,r){this.ownState.currentPath&&(this.ownState.currentPath?.addPoint([t,r,performance.now()]),this.updatePath(this.ownState))}endPath(){this.ownState.currentPath&&(this.ownState.currentPath.close(),this.ownState.finishedPaths.push(this.ownState.currentPath),this.updatePath(this.ownState))}updatePath(t){this.isDrawing=!0,this.isRunning||this.start()}isRunning=!1;start(t){t&&(this.container=t,this.container.appendChild(this.ownState.svg)),this.stop(),this.isRunning=!0,this.loop()}stop(){this.isRunning=!1,this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=void 0}loop(){this.rafId=requestAnimationFrame(this.loop.bind(this)),this.updateCollabolatorsState(),this.isDrawing?this.update():this.isRunning=!1}draw(t){let r=t.getStrokeOutline(t.options.size/this.app.state.zoom.value).map(([o,n])=>{let i=nr({sceneX:o,sceneY:n},this.app.state);return[i.x,i.y]});return XN(r,!0)}updateCollabolatorsState(){if(!(!this.container||!this.app.state.collaborators.size))for(let[t,r]of this.app.state.collaborators.entries()){if(!this.collaboratorsState.has(t)){let n=FE();this.container.appendChild(n.svg),this.collaboratorsState.set(t,n),this.updatePath(n)}let o=this.collaboratorsState.get(t);r.pointer&&r.pointer.tool==="laser"&&(r.button==="down"&&o.currentPath===void 0&&(o.lastPoint=[r.pointer.x,r.pointer.y],o.currentPath=O_(),o.currentPath.addPoint([r.pointer.x,r.pointer.y,performance.now()]),this.updatePath(o)),r.button==="down"&&o.currentPath!==void 0&&(r.pointer.x!==o.lastPoint[0]||r.pointer.y!==o.lastPoint[1])&&(o.lastPoint=[r.pointer.x,r.pointer.y],o.currentPath.addPoint([r.pointer.x,r.pointer.y,performance.now()]),this.updatePath(o)),r.button==="up"&&o.currentPath!==void 0&&(o.lastPoint=[r.pointer.x,r.pointer.y],o.currentPath.addPoint([r.pointer.x,r.pointer.y,performance.now()]),o.currentPath.close(),o.finishedPaths.push(o.currentPath),o.currentPath=void 0,this.updatePath(o)))}}update(){if(!this.container)return;let t=!1;for(let[o,n]of this.collaboratorsState.entries()){if(!this.app.state.collaborators.has(o)){n.svg.remove(),this.collaboratorsState.delete(o);continue}n.finishedPaths=n.finishedPaths.filter(a=>{let s=a.originalPoints[a.originalPoints.length-1];return!(s&&s[2]<performance.now()-BE)});let i=n.finishedPaths.map(a=>this.draw(a)).join(" ");n.currentPath&&(i+=` ${this.draw(n.currentPath)}`),i.trim()&&(t=!0),n.svg.setAttribute("d",i),n.svg.setAttribute("fill",xs(o))}this.ownState.finishedPaths=this.ownState.finishedPaths.filter(o=>{let n=o.originalPoints[o.originalPoints.length-1];return!(n&&n[2]<performance.now()-BE)});let r=this.ownState.finishedPaths.map(o=>this.draw(o)).join(" ");this.ownState.currentPath&&(r+=` ${this.draw(this.ownState.currentPath)}`),r=r.trim(),r&&(t=!0),this.ownState.svg.setAttribute("d",r),this.ownState.svg.setAttribute("fill","red"),t||(this.isDrawing=!1)}};h();var ii=class{subscribers=[];on(...t){let r=t.flat().filter(o=>typeof o=="function");return this.subscribers.push(...r),()=>this.off(r)}once(...t){let r=t.flat().filter(n=>typeof n=="function");r.push(()=>o());let o=this.on(...r);return o}off(...t){let r=t.flat();this.subscribers=this.subscribers.filter(o=>!r.includes(o))}trigger(...t){for(let r of this.subscribers)r(...t);return this}clear(){this.subscribers=[]}};h();var N_=S(_(),1),jN=5,qN=(e,t)=>{let[r,o]=ue(e),{x:n,y:i}=nr({sceneX:r+e.width,sceneY:o},t),a=n-t.offsetLeft+10,s=i-t.offsetTop;return{x:a,y:s}},zE=({children:e,element:t})=>{let r=Kc();if(r.contextMenu||r.draggingElement||r.resizingElement||r.isRotating||r.openMenu||r.viewModeEnabled)return null;let{x:o,y:n}=qN(t,r);return(0,N_.jsx)("div",{className:"excalidraw-canvas-buttons",style:{top:`${n}px`,left:`${o}px`,padding:jN},children:e})};h();var JN=`You are a skilled front-end developer who builds interactive prototypes from wireframes, and is an expert at CSS Grid and Flex design.
89
- Your role is to transform low-fidelity wireframes into working front-end HTML code.
90
-
91
- YOU MUST FOLLOW FOLLOWING RULES:
92
-
93
- - Use HTML, CSS, JavaScript to build a responsive, accessible, polished prototype
94
- - Leverage Tailwind for styling and layout (import as script <script src="https://cdn.tailwindcss.com"><\/script>)
95
- - Inline JavaScript when needed
96
- - Fetch dependencies from CDNs when needed (using unpkg or skypack)
97
- - Source images from Unsplash or create applicable placeholders
98
- - Interpret annotations as intended vs literal UI
99
- - Fill gaps using your expertise in UX and business logic
100
- - generate primarily for desktop UI, but make it responsive.
101
- - Use grid and flexbox wherever applicable.
102
- - Convert the wireframe in its entirety, don't omit elements if possible.
103
-
104
- If the wireframes, diagrams, or text is unclear or unreadable, refer to provided text for clarification.
105
-
106
- Your goal is a production-ready prototype that brings the wireframes to life.
107
-
108
- Please output JUST THE HTML file containing your best attempt at implementing the provided wireframes.`;async function F_({image:e,apiKey:t,text:r,theme:o="light"}){let n={model:"gpt-4-vision-preview",max_tokens:4096,temperature:.1,messages:[{role:"system",content:JN},{role:"user",content:[{type:"image_url",image_url:{url:e,detail:"high"}},{type:"text",text:`Above is the reference wireframe. Please make a new website based on these and return just the HTML file. Also, please make it for the ${o} theme. What follows are the wireframe's text annotations (if any)...`},{type:"text",text:r}]}]},i,a=await fetch("https://api.openai.com/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n)});return a.ok?i={...await a.json(),ok:!0}:i={...await a.json(),ok:!1},i}h();var om=S(_(),1),QN="small",Hg=e=>(0,om.jsxs)("label",{className:G("ToolIcon ToolIcon__MagicButton",`ToolIcon_size_${QN}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,om.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,om.jsx)("div",{className:"ToolIcon__icon",children:e.icon})]});h();var Va=S(_(),1),eF=({height:e,width:t,userToFollow:r,onDisconnect:o})=>(0,Va.jsx)("div",{style:{position:"relative"},children:(0,Va.jsx)("div",{className:"follow-mode",style:{width:t,height:e},children:(0,Va.jsxs)("div",{className:"follow-mode__badge",children:[(0,Va.jsxs)("div",{className:"follow-mode__badge__label",children:["Following"," ",(0,Va.jsx)("span",{className:"follow-mode__badge__username",title:r.username,children:r.username})]}),(0,Va.jsx)("button",{onClick:o,className:"follow-mode__disconnect-btn",children:Oo})]})})}),B_=eF;var Oe=S(_(),1),tA=Xt.default.createContext(null),rA=Xt.default.createContext(null),oA={viewport:{isMobile:!1,isLandscape:!1},editor:{isMobile:!1,canFitSidebar:!1},isTouchScreen:!1},ey=Xt.default.createContext(oA);ey.displayName="DeviceContext";var ty=Xt.default.createContext({container:null,id:null});ty.displayName="ExcalidrawContainerContext";var ry=Xt.default.createContext([]);ry.displayName="ExcalidrawElementsContext";var oy=Xt.default.createContext({...wr(),width:0,height:0,offsetLeft:0,offsetTop:0});oy.displayName="ExcalidrawAppStateContext";var ny=Xt.default.createContext(()=>{console.warn("Uninitialized ExcalidrawSetAppStateContext context!")});ny.displayName="ExcalidrawSetAppStateContext";var iy=Xt.default.createContext(null);iy.displayName="ExcalidrawActionManagerContext";var Bo=()=>(0,Xt.useContext)(tA),Oa=()=>(0,Xt.useContext)(rA),Ke=()=>(0,Xt.useContext)(ey),ar=()=>(0,Xt.useContext)(ty),Ca=()=>(0,Xt.useContext)(ry),Kc=()=>(0,Xt.useContext)(oy),at=()=>(0,Xt.useContext)(ny),Er=()=>(0,Xt.useContext)(iy),z_=typeof window<"u"&&"ResizeObserver"in window,nm=!1,HE=0,Js=!1,im=!1,$E=!1,GE={horizontal:null,vertical:null},Ya=0,am=!1,UE=new Map,WE=!1,H_=0,$_=!1,sm=null,Ze={pointers:new Map,lastCenter:null,initialDistance:null,initialScale:null},ZE=class e extends Xt.default.Component{canvas;interactiveCanvas=null;rc;unmounted=!1;actionManager;device=oA;excalidrawContainerRef=Xt.default.createRef();scene;renderer;fonts;resizeObserver;nearestScrollableContainer;library;libraryItemsFromStorage;id;history;excalidrawContainerValue;files={};imageCache=new Map;iFrameRefs=new Map;hitLinkElement;lastPointerDownEvent=null;lastPointerUpEvent=null;lastPointerMoveEvent=null;lastViewportPosition={x:0,y:0};laserPathManager=new zg(this);onChangeEmitter=new ii;onPointerDownEmitter=new ii;onPointerUpEmitter=new ii;onUserFollowEmitter=new ii;onScrollChangeEmitter=new ii;missingPointerEventCleanupEmitter=new ii;onRemoveEventListenersEmitter=new ii;constructor(t){super(t);let r=wr(),{excalidrawAPI:o,viewModeEnabled:n=!1,zenModeEnabled:i=!1,gridModeEnabled:a=!1,objectsSnapModeEnabled:s=!1,theme:c=r.theme,name:l=r.name}=t;if(this.state={...r,theme:c,isLoading:!0,...this.getCanvasOffsets(),viewModeEnabled:n,zenModeEnabled:i,objectsSnapModeEnabled:s,gridSize:a?fi:null,name:l,width:window.innerWidth,height:window.innerHeight},this.id=wl(),this.library=new _I(this),this.actionManager=new Eg(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.scene=new _e,this.canvas=document.createElement("canvas"),this.rc=Ao.canvas(this.canvas),this.renderer=new tm(this.scene),o){let d={updateScene:this.updateScene,updateLibrary:this.library.updateLibrary,addFiles:this.addFiles,resetScene:this.resetScene,getSceneElementsIncludingDeleted:this.getSceneElementsIncludingDeleted,history:{clear:this.resetHistory},scrollToContent:this.scrollToContent,getSceneElements:this.getSceneElements,getAppState:()=>this.state,getFiles:()=>this.files,registerAction:u=>{this.actionManager.registerAction(u)},refresh:this.refresh,setToast:this.setToast,id:this.id,setActiveTool:this.setActiveTool,setCursor:this.setCursor,resetCursor:this.resetCursor,updateFrameRendering:this.updateFrameRendering,toggleSidebar:this.toggleSidebar,onChange:u=>this.onChangeEmitter.on(u),onPointerDown:u=>this.onPointerDownEmitter.on(u),onPointerUp:u=>this.onPointerUpEmitter.on(u),onScrollChange:u=>this.onScrollChangeEmitter.on(u),onUserFollow:u=>this.onUserFollowEmitter.on(u)};typeof o=="function"?o(d):console.error("excalidrawAPI should be a function!")}this.excalidrawContainerValue={container:this.excalidrawContainerRef.current,id:this.id},this.fonts=new Dg({scene:this.scene,onSceneUpdated:this.onSceneUpdated}),this.history=new Sk,this.actionManager.registerAll(Up),this.actionManager.registerAction(yk(this.history)),this.actionManager.registerAction(wk(this.history))}onWindowMessage(t){if(t.origin!=="https://player.vimeo.com"&&t.origin!=="https://www.youtube.com")return;let r=null;try{r=JSON.parse(t.data)}catch{}if(r)switch(t.origin){case"https://player.vimeo.com":if(r.method==="paused"){let o=null,n=document.body.querySelectorAll("iframe.excalidraw__embeddable");if(!n)break;for(let i of n)i.contentWindow===t.source&&(o=i.contentWindow);o?.postMessage(JSON.stringify({method:r.value?"play":"pause",value:!0}),"*")}break;case"https://www.youtube.com":if(r.event==="infoDelivery"&&r.info&&r.id&&typeof r.info.playerState=="number"){let o=r.id,n=r.info.playerState;Object.values(Id).includes(n)&&UE.set(o,n)}break}}cacheEmbeddableRef(t,r){r&&this.iFrameRefs.set(t.id,r)}getHTMLIFrameElement(t){return this.iFrameRefs.get(t.id)}handleEmbeddableCenterClick(t){if(this.state.activeEmbeddable?.element===t&&this.state.activeEmbeddable?.state==="active"||(setTimeout(()=>{this.setState({activeEmbeddable:{element:t,state:"active"},selectedElementIds:{[t.id]:!0},draggingElement:null,selectionElement:null})},100),_o(t)))return;let r=this.getHTMLIFrameElement(t);if(r?.contentWindow){if(r.src.includes("youtube")){let o=UE.get(t.id);switch(o||(UE.set(t.id,Id.UNSTARTED),r.contentWindow.postMessage(JSON.stringify({event:"listening",id:t.id}),"*")),o){case Id.PLAYING:case Id.BUFFERING:r.contentWindow?.postMessage(JSON.stringify({event:"command",func:"pauseVideo",args:""}),"*");break;default:r.contentWindow?.postMessage(JSON.stringify({event:"command",func:"playVideo",args:""}),"*")}}r.src.includes("player.vimeo.com")&&r.contentWindow.postMessage(JSON.stringify({method:"paused"}),"*")}}isIframeLikeElementCenter(t,r,o,n){return t&&!r.altKey&&!r.shiftKey&&!r.metaKey&&!r.ctrlKey&&(this.state.activeEmbeddable?.element!==t||this.state.activeEmbeddable?.state==="hover"||!this.state.activeEmbeddable)&&o>=t.x+t.width/3&&o<=t.x+2*t.width/3&&n>=t.y+t.height/3&&n<=t.y+2*t.height/3}updateEmbeddables=()=>{let t=new Set,r=!1;this.scene.getNonDeletedElements().filter(o=>{if(er(o)){if(t.add(o.id),o.validated==null){r=!0;let n=Bl(o.link,this.props.validateEmbeddable);Y(o,{validated:n},!1),Re.delete(o)}}else _o(o)&&t.add(o.id);return!1}),r&&this.scene.informMutation(),this.iFrameRefs.forEach((o,n)=>{t.has(n)||this.iFrameRefs.delete(n)})};renderEmbeddables(){let t=this.state.zoom.value,r=this.state.width,o=this.state.height,n=this.scene.getNonDeletedElements().filter(i=>er(i)&&!!i.validated||_o(i));return(0,Oe.jsx)(Oe.Fragment,{children:n.map(i=>{let{x:a,y:s}=nr({sceneX:i.x,sceneY:i.y},this.state),c;if(_o(i)){c=null;let m=(i.customData?.generationData??this.magicGenerations.get(i.id))||{status:"error",message:"No generation data",code:"ERR_NO_GENERATION_DATA"};if(m.status==="done"){let p=m.html;c={intrinsicSize:{w:i.width,h:i.height},type:"document",srcdoc:()=>p}}else if(m.status==="pending")c={intrinsicSize:{w:i.width,h:i.height},type:"document",srcdoc:()=>vs(`
109
- <style>
110
- html, body {
111
- width: 100%;
112
- height: 100%;
113
- color: ${this.state.theme==="dark"?"white":"black"};
114
- }
115
- body {
116
- display: flex;
117
- align-items: center;
118
- justify-content: center;
119
- flex-direction: column;
120
- gap: 1rem;
121
- }
122
-
123
- .Spinner {
124
- display: flex;
125
- align-items: center;
126
- justify-content: center;
127
- margin-left: auto;
128
- margin-right: auto;
129
- }
130
-
131
- .Spinner svg {
132
- animation: rotate 1.6s linear infinite;
133
- transform-origin: center center;
134
- width: 40px;
135
- height: 40px;
136
- }
137
-
138
- .Spinner circle {
139
- stroke: currentColor;
140
- animation: dash 1.6s linear 0s infinite;
141
- stroke-linecap: round;
142
- }
143
-
144
- @keyframes rotate {
145
- 100% {
146
- transform: rotate(360deg);
147
- }
148
- }
149
-
150
- @keyframes dash {
151
- 0% {
152
- stroke-dasharray: 1, 300;
153
- stroke-dashoffset: 0;
154
- }
155
- 50% {
156
- stroke-dasharray: 150, 300;
157
- stroke-dashoffset: -200;
158
- }
159
- 100% {
160
- stroke-dasharray: 1, 300;
161
- stroke-dashoffset: -280;
162
- }
163
- }
164
- </style>
165
- <div class="Spinner">
166
- <svg
167
- viewBox="0 0 100 100"
168
- >
169
- <circle
170
- cx="50"
171
- cy="50"
172
- r="46"
173
- stroke-width="8"
174
- fill="none"
175
- stroke-miter-limit="10"
176
- />
177
- </svg>
178
- </div>
179
- <div>Generating...</div>
180
- `)};else{let p;m.code==="ERR_GENERATION_INTERRUPTED"?p="Generation was interrupted...":p=m.message||"Generation failed",c={intrinsicSize:{w:i.width,h:i.height},type:"document",srcdoc:()=>vs(`
181
- <style>
182
- html, body {
183
- height: 100%;
184
- }
185
- body {
186
- display: flex;
187
- flex-direction: column;
188
- align-items: center;
189
- justify-content: center;
190
- color: ${ge.red[3]};
191
- }
192
- h1, h3 {
193
- margin-top: 0;
194
- margin-bottom: 0.5rem;
195
- }
196
- </style>
197
- <h1>Error!</h1>
198
- <h3>${p}</h3>
199
- `)}}}else c=Ci(ch(i.link||""));let l=qs(i,r,o,this.state),d=this.state.activeEmbeddable?.element===i&&this.state.activeEmbeddable?.state==="active",u=this.state.activeEmbeddable?.element===i&&this.state.activeEmbeddable?.state==="hover";return(0,Oe.jsx)("div",{className:G("excalidraw__embeddable-container",{"is-hovered":u}),style:{transform:l?`translate(${a-this.state.offsetLeft}px, ${s-this.state.offsetTop}px) scale(${t})`:"none",display:l?"block":"none",opacity:i.opacity/100,"--embeddable-radius":`${Za(Math.min(i.width,i.height),i)}px`},children:(0,Oe.jsxs)("div",{className:"excalidraw__embeddable-container__inner",style:{width:l?`${i.width}px`:0,height:l?`${i.height}px`:0,transform:l?`rotate(${i.angle}rad)`:"none",pointerEvents:d?is.enabled:is.disabled},children:[u&&(0,Oe.jsx)("div",{className:"excalidraw__embeddable-hint",children:E("buttons.embeddableInteractionButton")}),(0,Oe.jsx)("div",{className:"excalidraw__embeddable__outer",style:{padding:`${i.strokeWidth}px`},children:(er(i)?this.props.renderEmbeddable?.(i,this.state):null)??(0,Oe.jsx)("iframe",{ref:m=>this.cacheEmbeddableRef(i,m),className:"excalidraw__embeddable",srcDoc:c?.type==="document"?c.srcdoc(this.state.theme):void 0,src:c?.type!=="document"?c?.link??"":void 0,scrolling:"no",referrerPolicy:"no-referrer-when-downgrade",title:"Excalidraw Embedded Content",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,sandbox:"allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads"})})]})},i.id)})})}getFrameNameDOMId=t=>`${this.id}-frame-name-${t.id}`;frameNameBoundsCache={get:t=>{let r=this.frameNameBoundsCache._cache.get(t.id);if(!r||r.zoom!==this.state.zoom.value||r.versionNonce!==t.versionNonce){let o=document.getElementById(this.getFrameNameDOMId(t));if(o){let n=o.getBoundingClientRect(),i=ot({clientX:n.x,clientY:n.y},this.state),a=ot({clientX:n.right,clientY:n.bottom},this.state);return r={x:i.x,y:i.y,width:a.x-i.x,height:a.y-i.y,angle:0,zoom:this.state.zoom.value,versionNonce:t.versionNonce},this.frameNameBoundsCache._cache.set(t.id,r),r}return null}return r},_cache:new Map};renderFrameNames=()=>{if(!this.state.frameRendering.enabled||!this.state.frameRendering.name)return null;let t=this.state.theme==="dark",r=0,o=0;return this.scene.getNonDeletedFramesLikes().map(n=>{if(la(n)?r++:o++,!qs(n,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}))return null;let{x:i,y:a}=nr({sceneX:n.x,sceneY:n.y},this.state),s=6,c=()=>{n.name?.trim()===""&&Y(n,{name:null}),this.setState({editingFrame:null})},l,d=sg(n,la(n)?r:o);if(n.id===this.state.editingFrame){let u=d;l=(0,Oe.jsx)("input",{autoFocus:!0,value:u,onChange:m=>{Y(n,{name:m.target.value})},onBlur:()=>c(),onKeyDown:m=>{(m.key===k.ESCAPE||m.key===k.ENTER)&&c()},style:{background:this.state.viewBackgroundColor,filter:t?xl:"none",zIndex:2,border:"none",display:"block",padding:`${s}px`,borderRadius:4,boxShadow:"inset 0 0 0 1px var(--color-primary)",fontFamily:"Assistant",fontSize:"14px",transform:`translate(-${s}px, ${s}px)`,color:"var(--color-gray-80)",overflow:"hidden",maxWidth:`${document.body.clientWidth-i-s}px`},size:u.length+1||1,dir:"auto",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off"})}else l=d;return(0,Oe.jsx)("div",{id:this.getFrameNameDOMId(n),style:{position:"absolute",bottom:`${this.state.height+ut.nameOffsetY-a+this.state.offsetTop}px`,left:`${i-this.state.offsetLeft}px`,zIndex:2,fontSize:ut.nameFontSize,color:t?ut.nameColorDarkTheme:ut.nameColorLightTheme,lineHeight:ut.nameLineHeight,width:"max-content",maxWidth:`${n.width}px`,overflow:n.id===this.state.editingFrame?"visible":"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",cursor:Ue.MOVE,pointerEvents:this.state.viewModeEnabled?is.disabled:is.enabled},onPointerDown:u=>this.handleCanvasPointerDown(u),onWheel:u=>this.handleWheel(u),onContextMenu:this.handleCanvasContextMenu,onDoubleClick:()=>{this.setState({editingFrame:n.id})},children:l},n.id)})};render(){let t=this.scene.getSelectedElements(this.state),{renderTopRightUI:r,renderCustomStats:o}=this.props,n=this.scene.getVersionNonce(),{canvasElements:i,visibleElements:a}=this.renderer.getRenderableElements({versionNonce:n,zoom:this.state.zoom,offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,height:this.state.height,width:this.state.width,editingElement:this.state.editingElement,pendingImageElementId:this.state.pendingImageElementId}),s=!(this.state.editingElement&&me(this.state.editingElement))&&(this.state.selectionElement||this.state.draggingElement||this.state.resizingElement||this.state.activeTool.type==="laser"&&this.state.cursorButton==="down"||this.state.editingElement&&!ee(this.state.editingElement)),c=t[0];return(0,Oe.jsx)("div",{className:G("excalidraw excalidraw-container",{"excalidraw--view-mode":this.state.viewModeEnabled,"excalidraw--mobile":this.device.editor.isMobile}),style:{"--ui-pointerEvents":s?is.disabled:is.enabled},ref:this.excalidrawContainerRef,onDrop:this.handleAppOnDrop,tabIndex:0,onKeyDown:this.props.handleKeyboardGlobally?void 0:this.onKeyDown,children:(0,Oe.jsx)(tA.Provider,{value:this,children:(0,Oe.jsx)(rA.Provider,{value:this.props,children:(0,Oe.jsx)(ty.Provider,{value:this.excalidrawContainerValue,children:(0,Oe.jsx)(ey.Provider,{value:this.device,children:(0,Oe.jsx)(ny.Provider,{value:this.setAppState,children:(0,Oe.jsx)(oy.Provider,{value:this.state,children:(0,Oe.jsxs)(ry.Provider,{value:this.scene.getNonDeletedElements(),children:[(0,Oe.jsxs)(iy.Provider,{value:this.actionManager,children:[(0,Oe.jsx)(s_,{canvas:this.canvas,appState:this.state,files:this.files,setAppState:this.setAppState,actionManager:this.actionManager,elements:this.scene.getNonDeletedElements(),onLockToggle:this.toggleLock,onPenModeToggle:this.togglePenMode,onHandToolToggle:this.onHandToolToggle,langCode:gi().code,renderTopRightUI:r,renderCustomStats:o,showExitZenModeBtn:typeof this.props?.zenModeEnabled>"u"&&this.state.zenModeEnabled,UIOptions:this.props.UIOptions,onExportImage:this.onExportImage,renderWelcomeScreen:!this.state.isLoading&&this.state.showWelcomeScreen&&this.state.activeTool.type==="selection"&&!this.state.zenModeEnabled&&!this.scene.getElementsIncludingDeleted().length,app:this,isCollaborating:this.props.isCollaborating,openAIKey:this.OPENAI_KEY,isOpenAIKeyPersisted:this.OPENAI_KEY_IS_PERSISTED,onOpenAIAPIKeyChange:this.onOpenAIKeyChange,onMagicSettingsConfirm:this.onMagicSettingsConfirm,children:this.props.children}),(0,Oe.jsx)("div",{className:"excalidraw-textEditorContainer"}),(0,Oe.jsx)("div",{className:"excalidraw-contextMenuContainer"}),(0,Oe.jsx)("div",{className:"excalidraw-eye-dropper-container"}),(0,Oe.jsx)(M_,{manager:this.laserPathManager}),t.length===1&&this.state.showHyperlinkPopup&&(0,Oe.jsx)(G_,{element:c,setAppState:this.setAppState,onLinkOpen:this.props.onLinkOpen,setToast:this.setToast},c.id),this.props.aiEnabled!==!1&&t.length===1&&ds(c)&&(0,Oe.jsx)(zE,{element:c,children:(0,Oe.jsx)(Hg,{title:E("labels.convertToCode"),icon:Yl,checked:!1,onChange:()=>this.onMagicFrameGenerate(c,"button")})}),t.length===1&&_o(c)&&c.customData?.generationData?.status==="done"&&(0,Oe.jsxs)(zE,{element:c,children:[(0,Oe.jsx)(Hg,{title:E("labels.copySource"),icon:of,checked:!1,onChange:()=>this.onIframeSrcCopy(c)}),(0,Oe.jsx)(Hg,{title:"Enter fullscreen",icon:FS,checked:!1,onChange:()=>{let l=this.getHTMLIFrameElement(c);if(l)try{l.requestFullscreen(),this.setState({activeEmbeddable:{element:c,state:"active"},selectedElementIds:{[c.id]:!0},draggingElement:null,selectionElement:null})}catch(d){console.warn(d),this.setState({errorMessage:"Couldn't enter fullscreen"})}}})]}),this.state.toast!==null&&(0,Oe.jsx)(l_,{message:this.state.toast.message,onClose:()=>this.setToast(null),duration:this.state.toast.duration,closable:this.state.toast.closable}),this.state.contextMenu&&(0,Oe.jsx)(kk,{items:this.state.contextMenu.items,top:this.state.contextMenu.top,left:this.state.contextMenu.left,actionManager:this.actionManager,onClose:l=>{this.setState({contextMenu:null},()=>{this.focusContainer(),l?.()})}}),(0,Oe.jsx)(OE,{canvas:this.canvas,rc:this.rc,elements:i,visibleElements:a,versionNonce:n,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:!0,canvasBackgroundColor:this.state.viewBackgroundColor}}),(0,Oe.jsx)(RE,{containerRef:this.excalidrawContainerRef,canvas:this.interactiveCanvas,elements:i,visibleElements:a,selectedElements:t,versionNonce:n,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderInteractiveSceneCallback:this.renderInteractiveSceneCallback,handleCanvasRef:this.handleInteractiveCanvasRef,onContextMenu:this.handleCanvasContextMenu,onPointerMove:this.handleCanvasPointerMove,onPointerUp:this.handleCanvasPointerUp,onPointerCancel:this.removePointer,onTouchMove:this.handleTouchMove,onPointerDown:this.handleCanvasPointerDown,onDoubleClick:this.handleCanvasDoubleClick}),this.state.userToFollow&&(0,Oe.jsx)(B_,{width:this.state.width,height:this.state.height,userToFollow:this.state.userToFollow,onDisconnect:this.maybeUnfollowRemoteUser}),this.renderFrameNames()]}),this.renderEmbeddables()]})})})})})})})})}focusContainer=()=>{this.excalidrawContainerRef.current?.focus()};getSceneElementsIncludingDeleted=()=>this.scene.getElementsIncludingDeleted();getSceneElements=()=>this.scene.getNonDeletedElements();onInsertElements=t=>{this.addElementsFromPasteOrLibrary({elements:t,position:"center",files:null})};onExportImage=async(t,r,o)=>{Ae("export",t,"ui");let n=await Ws(t,r,this.state,this.files,{exportBackground:this.state.exportBackground,name:this.state.name,viewBackgroundColor:this.state.viewBackgroundColor,exportingFrame:o.exportingFrame}).catch(mp).catch(i=>{console.error(i),this.setState({errorMessage:i.message})});this.state.exportEmbedScene&&n&&vc(n)&&this.setState({fileHandle:n})};magicGenerations=new Map;updateMagicGeneration=({frameElement:t,data:r})=>{r.status==="pending"?Y(t,{customData:{generationData:void 0}},!1):Y(t,{customData:{generationData:r}},!1),this.magicGenerations.set(t.id,r),this.onSceneUpdated()};getTextFromElements(t){return t.reduce((o,n)=>(ee(n)&&o.push(n.text),o),[]).join(`
200
-
201
- `)}async onMagicFrameGenerate(t,r){if(!this.OPENAI_KEY){this.setState({openDialog:{name:"settings",tab:"diagram-to-code",source:"generation"}}),Ae("ai","generate (missing key)","d2c");return}let o=Gs({elements:this.scene.getNonDeletedElements(),bounds:t,type:"overlap"}).filter(u=>!ds(u));if(!o.length){r==="button"?(this.setState({errorMessage:"Cannot generate from an empty frame"}),Ae("ai","generate (no-children)","d2c")):this.setActiveTool({type:"magicframe"});return}let n=this.insertIframeElement({sceneX:t.x+t.width+30,sceneY:t.y,width:t.width,height:t.height});if(!n)return;this.updateMagicGeneration({frameElement:n,data:{status:"pending"}}),this.setState({selectedElementIds:{[n.id]:!0}});let i=await tg({elements:this.scene.getNonDeletedElements(),appState:{...this.state,exportBackground:!0,viewBackgroundColor:this.state.viewBackgroundColor},exportingFrame:t,files:this.files}),a=await Ug(i),s=this.getTextFromElements(o);Ae("ai","generate (start)","d2c");let c=await F_({image:a,apiKey:this.OPENAI_KEY,text:s,theme:this.state.theme});if(!c.ok){Ae("ai","generate (failed)","d2c"),console.error(c.error),this.updateMagicGeneration({frameElement:n,data:{status:"error",code:"ERR_OAI",message:c.error?.message||"Unknown error during generation"}});return}if(Ae("ai","generate (success)","d2c"),c.choices[0].message.content==null){this.updateMagicGeneration({frameElement:n,data:{status:"error",code:"ERR_OAI",message:"Nothing genereated :("}});return}let l=c.choices[0].message.content,d=l.slice(l.indexOf("<!DOCTYPE html>"),l.indexOf("</html>")+7);this.updateMagicGeneration({frameElement:n,data:{status:"done",html:d}})}onIframeSrcCopy(t){t.customData?.generationData?.status==="done"&&(Li(t.customData.generationData.html),this.setToast({message:"copied to clipboard",closable:!1,duration:1500}))}OPENAI_KEY=ro.get(So.OAI_API_KEY);OPENAI_KEY_IS_PERSISTED=ro.has(So.OAI_API_KEY)||!1;onOpenAIKeyChange=(t,r)=>{if(this.OPENAI_KEY=t||null,r){let o=ro.set(So.OAI_API_KEY,t);this.OPENAI_KEY_IS_PERSISTED=o}else this.OPENAI_KEY_IS_PERSISTED=!1};onMagicSettingsConfirm=(t,r,o)=>{if(this.OPENAI_KEY=t||null,this.onOpenAIKeyChange(this.OPENAI_KEY,r),o==="settings")return;let n=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});t?n.length?this.onMagicframeToolSelect():this.setActiveTool({type:"magicframe"}):ds(n[0])||this.setActiveTool({type:"magicframe"})};onMagicframeToolSelect=()=>{if(!this.OPENAI_KEY){this.setState({openDialog:{name:"settings",tab:"diagram-to-code",source:"tool"}}),Ae("ai","tool-select (missing key)","d2c");return}let t=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});if(t.length===0)this.setActiveTool({type:Ft.magicframe}),Ae("ai","tool-select (empty-selection)","d2c");else{let r=t.length===1&&ds(t[0])&&t[0];if(!r&&t.some(n=>le(n)||n.frameId)){this.setActiveTool({type:Ft.magicframe});return}Ae("ai","tool-select (existing selection)","d2c");let o;if(r)o=r;else{let[n,i,a,s]=Me(t),c=50;o=jd({...ut,x:n-c,y:i-c,width:a-n+c*2,height:s-i+c*2,opacity:100,locked:!1}),this.scene.addNewElement(o);for(let l of t)Y(l,{frameId:o.id});this.setState({selectedElementIds:{[o.id]:!0}})}this.onMagicFrameGenerate(o,"upstream")}};openEyeDropper=({type:t})=>{Kr.set(Sa,{swapPreviewOnAlt:!0,colorPickerType:t==="stroke"?"elementStroke":"elementBackground",onSelect:(r,o)=>{let n=t==="background"&&o.altKey||t==="stroke"&&!o.altKey;!this.scene.getSelectedElements(this.state).length||this.state.activeTool.type!=="selection"?n?this.syncActionResult({appState:{...this.state,currentItemStrokeColor:r},commitToHistory:!0}):this.syncActionResult({appState:{...this.state,currentItemBackgroundColor:r},commitToHistory:!0}):this.updateScene({elements:this.scene.getElementsIncludingDeleted().map(a=>this.state.selectedElementIds[a.id]?de(a,{[n?"strokeColor":"backgroundColor"]:r}):a)})},keepOpenOnAlt:!1})};syncActionResult=xt(t=>{if(this.unmounted||t===!1)return;let r=null;if(t.elements&&(t.elements.forEach(o=>{this.state.editingElement?.id===o.id&&this.state.editingElement!==o&&cm(o)&&(r=o)}),this.scene.replaceAllElements(t.elements),t.commitToHistory&&this.history.resumeRecording()),t.files&&(this.files=t.replaceFiles?t.files:{...this.files,...t.files},this.addNewImagesToImageCache()),t.appState||r||this.state.contextMenu){t.commitToHistory&&this.history.resumeRecording();let o=t?.appState?.viewModeEnabled||!1,n=t?.appState?.zenModeEnabled||!1,i=t?.appState?.gridSize||null,a=t?.appState?.theme||this.props.theme||gt.LIGHT,s=t?.appState?.name??this.state.name,c=t?.appState?.errorMessage??this.state.errorMessage;typeof this.props.viewModeEnabled<"u"&&(o=this.props.viewModeEnabled),typeof this.props.zenModeEnabled<"u"&&(n=this.props.zenModeEnabled),typeof this.props.gridModeEnabled<"u"&&(i=this.props.gridModeEnabled?fi:null),typeof this.props.name<"u"&&(s=this.props.name),r=r||t.appState?.editingElement||null,r?.isDeleted&&(r=null),this.setState(l=>Object.assign(t.appState||{},{contextMenu:null,editingElement:r,viewModeEnabled:o,zenModeEnabled:n,gridSize:i,theme:a,name:s,errorMessage:c}),()=>{t.syncHistory&&this.history.setCurrentState(this.state,this.scene.getElementsIncludingDeleted())})}});onBlur=xt(()=>{Js=!1,this.setState({isBindingEnabled:!0})});onUnload=()=>{this.onBlur()};disableEvent=t=>{t.preventDefault()};resetHistory=()=>{this.history.clear()};resetScene=xt(t=>{this.scene.replaceAllElements([]),this.setState(r=>({...wr(),isLoading:t?.resetLoadingState?!1:r.isLoading,theme:this.state.theme})),this.resetHistory()});initializeScene=async()=>{"launchQueue"in window&&"LaunchParams"in window&&window.launchQueue.setConsumer(async o=>{if(!o.files.length)return;let n=o.files[0],i=await n.getFile();this.loadFileToCanvas(new File([i],i.name||"",{type:i.type}),n)}),this.props.theme&&this.setState({theme:this.props.theme}),this.state.isLoading||this.setState({isLoading:!0});let t=null;try{t=await this.props.initialData||null,t?.libraryItems&&this.library.updateLibrary({libraryItems:t.libraryItems,merge:!0}).catch(o=>{console.error(o)})}catch(o){console.error(o),t={appState:{errorMessage:o.message||"Encountered an error during importing or restoring scene data"}}}let r=Ma(t,null,null,{repairBindings:!0});r.appState={...r.appState,theme:this.props.theme||r.appState.theme,openSidebar:r.appState?.openSidebar||this.state.openSidebar,activeTool:r.appState.activeTool.type==="image"?{...r.appState.activeTool,type:"selection"}:r.appState.activeTool,isLoading:!1,toast:this.state.toast},t?.scrollToContent&&(r.appState={...r.appState,...Vn(r.elements,{...r.appState,width:this.state.width,height:this.state.height,offsetTop:this.state.offsetTop,offsetLeft:this.state.offsetLeft})}),this.fonts.loadFontsForElements(r.elements),this.resetHistory(),this.syncActionResult({...r,commitToHistory:!0})};isMobileBreakpoint=(t,r)=>t<a2||r<l2&&t<s2;refreshViewportBreakpoints=()=>{if(!this.excalidrawContainerRef.current)return;let{clientWidth:r,clientHeight:o}=document.body,n=this.device.viewport,i=Il(n,{isLandscape:r>o,isMobile:this.isMobileBreakpoint(r,o)});return n!==i?(this.device={...this.device,viewport:i},!0):!1};refreshEditorBreakpoints=()=>{let t=this.excalidrawContainerRef.current;if(!t)return;let{width:r,height:o}=t.getBoundingClientRect(),n=this.props.UIOptions.dockedSidebarBreakpoint!=null?this.props.UIOptions.dockedSidebarBreakpoint:c2,i=this.device.editor,a=Il(i,{isMobile:this.isMobileBreakpoint(r,o),canFitSidebar:r>n});return i!==a?(this.device={...this.device,editor:a},!0):!1};async componentDidMount(){if(console.log("HELLO IS"),this.unmounted=!1,this.excalidrawContainerValue.container=this.excalidrawContainerRef.current,v.MODE===q0.TEST||v.DEV){let r=this.setState.bind(this);Object.defineProperties(window.h,{state:{configurable:!0,get:()=>this.state},setState:{configurable:!0,value:(...o)=>this.setState(...o)},app:{configurable:!0,value:this},history:{configurable:!0,value:this.history}})}this.scene.addCallback(this.onSceneUpdated),this.addEventListeners(),this.props.autoFocus&&this.excalidrawContainerRef.current&&this.focusContainer(),io()||(this.refreshViewportBreakpoints(),this.refreshEditorBreakpoints()),z_&&this.excalidrawContainerRef.current&&(this.resizeObserver=new ResizeObserver(()=>{this.refreshEditorBreakpoints(),this.updateDOMRect()}),this.resizeObserver?.observe(this.excalidrawContainerRef.current)),new URLSearchParams(window.location.search.slice(1)).has("web-share-target")?this.restoreFileFromShare():this.updateDOMRect(this.initializeScene),qv()&&!Z_()&&this.setState({errorMessage:(0,Oe.jsx)(T_,{})})}componentWillUnmount(){this.renderer.destroy(),this.scene=new _e,this.renderer=new tm(this.scene),this.files={},this.imageCache.clear(),this.resizeObserver?.disconnect(),this.unmounted=!0,this.removeEventListeners(),this.scene.destroy(),this.library.destroy(),this.laserPathManager.destroy(),this.onChangeEmitter.clear(),Re.destroy(),jo.destroy(),clearTimeout(Ya),Je.clearCache(),fr.clearCache(),Ya=0}onResize=xt(()=>{this.scene.getElementsIncludingDeleted().forEach(t=>Re.delete(t)),this.refreshViewportBreakpoints(),this.updateDOMRect(),z_||this.refreshEditorBreakpoints(),this.setState({})});onFullscreenChange=()=>{!document.fullscreenElement&&this.state.activeEmbeddable?.state==="active"&&this.setState({activeEmbeddable:null})};removeEventListeners(){this.onRemoveEventListenersEmitter.trigger()}addEventListeners(){this.removeEventListeners(),this.props.handleKeyboardGlobally&&this.onRemoveEventListenersEmitter.once(_t(document,"keydown",this.onKeyDown,!1)),this.onRemoveEventListenersEmitter.once(_t(this.excalidrawContainerRef.current,"wheel",this.onWheel,{passive:!1}),_t(window,"message",this.onWindowMessage,!1),_t(document,"pointerup",this.removePointer),_t(document,"copy",this.onCopy),_t(document,"keyup",this.onKeyUp,{passive:!0}),_t(document,"mousemove",this.updateCurrentCursorPosition),_t(document.fonts,"loadingdone",t=>{let r=t.fontfaces;this.fonts.onFontsLoaded(r)}),_t(document,"gesturestart",this.onGestureStart,!1),_t(document,"gesturechange",this.onGestureChange,!1),_t(document,"gestureend",this.onGestureEnd,!1),_t(window,"focus",()=>{this.maybeCleanupAfterMissingPointerUp(null)})),!this.state.viewModeEnabled&&(this.onRemoveEventListenersEmitter.once(_t(document,"fullscreenchange",this.onFullscreenChange),_t(document,"paste",this.pasteFromClipboard),_t(document,"cut",this.onCut),_t(window,"resize",this.onResize,!1),_t(window,"unload",this.onUnload,!1),_t(window,"blur",this.onBlur,!1),_t(this.excalidrawContainerRef.current,"dragover",this.disableEvent,!1),_t(this.excalidrawContainerRef.current,"drop",this.disableEvent,!1)),this.props.detectScroll&&this.onRemoveEventListenersEmitter.once(_t(R2(this.excalidrawContainerRef.current),"scroll",this.onScroll)))}componentDidUpdate(t,r){this.updateEmbeddables(),!this.state.showWelcomeScreen&&!this.scene.getElementsIncludingDeleted().length&&this.setState({showWelcomeScreen:!0}),t.UIOptions.dockedSidebarBreakpoint!==this.props.UIOptions.dockedSidebarBreakpoint&&this.refreshEditorBreakpoints(),r.userToFollow&&!this.state.collaborators.has(r.userToFollow.socketId)&&this.maybeUnfollowRemoteUser(),(r.zoom.value!==this.state.zoom.value||r.scrollX!==this.state.scrollX||r.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)),r.userToFollow!==this.state.userToFollow&&(r.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:r.userToFollow,action:"UNFOLLOW"}),this.state.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:this.state.userToFollow,action:"FOLLOW"})),Object.keys(this.state.selectedElementIds).length&&Io(this.state)&&this.setState({activeTool:st(this.state,{type:"selection"})}),this.state.activeTool.type==="eraser"&&r.theme!==this.state.theme&&Bb(this.interactiveCanvas,this.state.theme),r.activeTool.type==="selection"&&this.state.activeTool.type!=="selection"&&this.state.showHyperlinkPopup&&this.setState({showHyperlinkPopup:!1}),t.langCode!==this.props.langCode&&this.updateLanguage(),t.viewModeEnabled!==this.props.viewModeEnabled&&this.setState({viewModeEnabled:!!this.props.viewModeEnabled}),r.viewModeEnabled!==this.state.viewModeEnabled&&(this.addEventListeners(),this.deselectElements()),t.zenModeEnabled!==this.props.zenModeEnabled&&this.setState({zenModeEnabled:!!this.props.zenModeEnabled}),t.theme!==this.props.theme&&this.props.theme&&this.setState({theme:this.props.theme}),t.gridModeEnabled!==this.props.gridModeEnabled&&this.setState({gridSize:this.props.gridModeEnabled?fi:null}),this.props.name&&t.name!==this.props.name&&this.setState({name:this.props.name}),this.excalidrawContainerRef.current?.classList.toggle("theme--dark",this.state.theme==="dark"),this.state.editingLinearElement&&!this.state.selectedElementIds[this.state.editingLinearElement.elementId]&&setTimeout(()=>{this.state.editingLinearElement&&this.actionManager.executeAction(Ho)}),this.state.editingElement?.isDeleted&&this.setState({editingElement:null}),this.state.selectedLinearElement&&!this.state.selectedElementIds[this.state.selectedLinearElement.elementId]&&this.setState({selectedLinearElement:null});let{multiElement:n}=r;r.activeTool!==this.state.activeTool&&n!=null&&ri(this.state)&&Ut(n,!1)&&gu(n,this.state,this.scene,nn(re.getPointAtIndexGlobalCoordinates(n,-1))),this.history.record(this.state,this.scene.getElementsIncludingDeleted()),this.state.isLoading||(this.props.onChange?.(this.scene.getElementsIncludingDeleted(),this.state,this.files),this.onChangeEmitter.trigger(this.scene.getElementsIncludingDeleted(),this.state,this.files))}renderInteractiveSceneCallback=({atLeastOneVisibleElement:t,scrollBars:r,elements:o})=>{r&&(GE=r);let n=ee(this.state.editingElement)?!1:!t&&o.length>0;this.state.scrolledOutside!==n&&this.setState({scrolledOutside:n}),this.scheduleImageRefresh()};onScroll=cs(()=>{let{offsetTop:t,offsetLeft:r}=this.getCanvasOffsets();this.setState(o=>o.offsetLeft===r&&o.offsetTop===t?null:{offsetTop:t,offsetLeft:r})},n2);onCut=xt(t=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||Hn(t.target)||(this.actionManager.executeAction(pg,"keyboard",t),t.preventDefault(),t.stopPropagation())});onCopy=xt(t=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||Hn(t.target)||(this.actionManager.executeAction(Gc,"keyboard",t),t.preventDefault(),t.stopPropagation())});static resetTapTwice(){nm=!1}onTouchStart=t=>{if(jv&&t.preventDefault(),!nm){nm=!0,clearTimeout(HE),HE=window.setTimeout(e.resetTapTwice,r2);return}if(nm&&t.touches.length===1){let r=t.touches[0];this.handleCanvasDoubleClick({clientX:r.clientX,clientY:r.clientY}),nm=!1,clearTimeout(HE)}t.touches.length===2&&this.setState({selectedElementIds:Ye({},this.state),activeEmbeddable:null})};onTouchEnd=t=>{this.resetContextMenuTimer(),t.touches.length>0?this.setState({previousSelectedElementIds:{},selectedElementIds:Ye(this.state.previousSelectedElementIds,this.state)}):Ze.pointers.clear()};pasteFromClipboard=xt(async t=>{let r=!!WE,o=document.activeElement,n=this.excalidrawContainerRef.current?.contains(o);if(t&&!n)return;let i=document.elementFromPoint(this.lastViewportPosition.x,this.lastViewportPosition.y);if(t&&(!(i instanceof HTMLCanvasElement)||Hn(o)))return;let{x:a,y:s}=ot({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state),c=t?.clipboardData?.files[0],l=await Wf(t,r);if(!c&&!r){if(l.mixedContent)return this.addElementsFromMixedContentPaste(l.mixedContent,{isPlainPaste:r,sceneX:a,sceneY:s});if(l.text){let d=l.text.trim();d.startsWith("<svg")&&d.endsWith("</svg>")&&(c=YE(d))}}if(Ka(c)&&!l.spreadsheet){if(!this.isToolSupported("image")){this.setState({errorMessage:E("errors.imageToolNotSupported")});return}let d=this.createImageElement({sceneX:a,sceneY:s});this.insertImageElement(d,c),this.initializeImageDimensions(d),this.setState({selectedElementIds:Ye({[d.id]:!0},this.state)});return}if(this.props.onPaste)try{if(await this.props.onPaste(l,t)===!1)return}catch(d){console.error(d)}if(l.errorMessage)this.setState({errorMessage:l.errorMessage});else if(l.spreadsheet&&!r)this.setState({pasteDialog:{data:l.spreadsheet,shown:!0}});else if(l.elements){let d=l.programmaticAPI?Ru(l.elements):l.elements;this.addElementsFromPasteOrLibrary({elements:d,files:l.files||null,position:"cursor",retainSeed:r})}else if(l.text){let d=V3(l.text);if(!r&&Bl(d,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(d)||Ci(d)?.type==="video")){let u=this.insertEmbeddableElement({sceneX:a,sceneY:s,link:Hr(d)});u&&this.setState({selectedElementIds:{[u.id]:!0}});return}this.addTextFromPaste(l.text,r)}this.setActiveTool({type:"selection"}),t?.preventDefault()});addElementsFromPasteOrLibrary=t=>{let r=vu(t.elements,null,void 0),[o,n,i,a]=Me(r),s=Qt(o,i)/2,c=Qt(n,a)/2,l=typeof t.position=="object"?t.position.clientX:t.position==="cursor"?this.lastViewportPosition.x:this.state.width/2+this.state.offsetLeft,d=typeof t.position=="object"?t.position.clientY:t.position==="cursor"?this.lastViewportPosition.y:this.state.height/2+this.state.offsetTop,{x:u,y:m}=ot({clientX:l,clientY:d},this.state),p=u-s,f=m-c,[g,x]=Zt(p,f,this.state.gridSize),y=Kp(r.map(C=>de(C,{x:C.x+g-o,y:C.y+x-n})),{randomizeSeed:!t.retainSeed}),w=[...this.scene.getElementsIncludingDeleted(),...y];this.scene.replaceAllElements(w),y.forEach(C=>{if(ee(C)&&$e(C)){let I=lt(C);br(C,I)}}),t.files&&(this.files={...this.files,...t.files}),this.history.resumeRecording();let T=Ss(y);this.setState({...this.state,openSidebar:this.state.openSidebar&&this.device.editor.canFitSidebar&&Kr.get(Lu)?this.state.openSidebar:null,...fr({editingGroupId:null,selectedElementIds:T.reduce((C,I)=>($e(I)||(C[I.id]=!0),C),{})},this.scene.getNonDeletedElements(),this.state,this)},()=>{t.files&&this.addNewImagesToImageCache()}),this.setActiveTool({type:"selection"}),t.fitToContent&&this.scrollToContent(y,{fitToContent:!0})};async addElementsFromMixedContentPaste(t,{isPlainPaste:r,sceneX:o,sceneY:n}){if(!r&&t.some(i=>i.type==="imageUrl")&&this.isToolSupported("image")){let i=t.filter(u=>u.type==="imageUrl").map(u=>u.value),a=await Promise.all(i.map(async u=>{try{return{file:await q_(u)}}catch(m){return{errorMessage:m.message}}})),s=n,c=!1,l={};for(let u of a)if(u.file){let m=this.createImageElement({sceneX:o,sceneY:s}),p=await this.insertImageElement(m,u.file);p&&(c||(c=!0,s-=p.height/2),Y(p,{y:s},!1),s=m.y+m.height+25,l[m.id]=!0)}this.setState({selectedElementIds:Ye(l,this.state)});let d=a.find(u=>!!u.errorMessage);d&&d.errorMessage&&this.setState({errorMessage:d.errorMessage})}else{let i=t.filter(a=>a.type==="text");i.length&&this.addTextFromPaste(i.map(a=>a.value).join(`
202
-
203
- `),r)}}addTextFromPaste(t,r=!1){let{x:o,y:n}=ot({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state),i={x:o,y:n,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roundness:null,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:t,fontSize:this.state.currentItemFontSize,fontFamily:this.state.currentItemFontFamily,textAlign:this.state.currentItemTextAlign,verticalAlign:as,locked:!1},a=10,s=n,c=r?[t]:t.split(`
204
- `),l=c.reduce((u,m,p)=>{let f=m.trim(),g=mo(i.fontFamily);if(f.length){let x=this.getTopLayerFrameAtSceneCoords({x:o,y:s}),y=ir({...i,x:o,y:s,text:f,lineHeight:g,frameId:x?x.id:null});u.push(y),s+=y.height+a}else c[p-1]?.trim()&&(s+=tl(i.fontSize,g)+a);return u},[]);if(l.length===0)return;let d=l[0].frameId;d?this.scene.insertElementsAtIndex(l,this.scene.getElementIndex(d)):this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted(),...l]),this.setState({selectedElementIds:Ye(Object.fromEntries(l.map(u=>[u.id,!0])),this.state)}),!r&&l.length>1&&$_===!1&&!this.device.editor.isMobile&&(this.setToast({message:E("toast.pasteAsSingleElement",{shortcut:H("CtrlOrCmd+Shift+V")}),duration:5e3}),$_=!0),this.history.resumeRecording()}setAppState=(t,r)=>{this.setState(t,r)};removePointer=t=>{Ya&&this.resetContextMenuTimer(),Ze.pointers.delete(t.pointerId)};toggleLock=(t="ui")=>{this.state.activeTool.locked||Ae("toolbar","toggleLock",`${t} (${this.device.editor.isMobile?"mobile":"desktop"})`),this.setState(r=>({activeTool:{...r.activeTool,...st(this.state,r.activeTool.locked?{type:"selection"}:r.activeTool),locked:!r.activeTool.locked}}))};updateFrameRendering=t=>{this.setState(r=>{let o=typeof t=="function"?t(r.frameRendering):t;return{frameRendering:{enabled:o?.enabled??r.frameRendering.enabled,clip:o?.clip??r.frameRendering.clip,name:o?.name??r.frameRendering.name,outline:o?.outline??r.frameRendering.outline}}})};togglePenMode=t=>{this.setState(r=>({penMode:t??!r.penMode,penDetected:!0}))};onHandToolToggle=()=>{this.actionManager.executeAction(sC)};zoomCanvas=t=>{this.setState({...yi({viewportX:this.state.width/2+this.state.offsetLeft,viewportY:this.state.height/2+this.state.offsetTop,nextZoom:Yn(t)},this.state)})};cancelInProgressAnimation=null;scrollToContent=(t=this.scene.getNonDeletedElements(),r)=>{this.cancelInProgressAnimation?.();let o=Array.isArray(t)?t:[t],n=this.state.zoom,i=this.state.scrollX,a=this.state.scrollY;if(r?.fitToContent||r?.fitToViewport){let{appState:s}=hu({targetElements:o,appState:this.state,fitToViewport:!!r?.fitToViewport,viewportZoomFactor:r?.viewportZoomFactor});n=s.zoom,i=s.scrollX,a=s.scrollY}else{let s=Vn(o,this.state);i=s.scrollX,a=s.scrollY}if(r?.animate){let s=this.state.scrollX,c=this.state.scrollY,l=this.state.zoom.value,d=L2({fromValues:{scrollX:s,scrollY:c,zoom:l},toValues:{scrollX:i,scrollY:a,zoom:n.value},interpolateValue:(u,m,p,f)=>{if(f==="zoom")return u*Math.pow(m/u,up(p))},onStep:({scrollX:u,scrollY:m,zoom:p})=>{this.setState({scrollX:u,scrollY:m,zoom:{value:p}})},onStart:()=>{this.setState({shouldCacheIgnoreZoom:!0})},onEnd:()=>{this.setState({shouldCacheIgnoreZoom:!1})},onCancel:()=>{this.setState({shouldCacheIgnoreZoom:!1})},duration:r?.duration??500});this.cancelInProgressAnimation=()=>{d(),this.cancelInProgressAnimation=null}}else this.setState({scrollX:i,scrollY:a,zoom:n})};maybeUnfollowRemoteUser=()=>{this.state.userToFollow&&this.setState({userToFollow:null})};translateCanvas=t=>{this.cancelInProgressAnimation?.(),this.maybeUnfollowRemoteUser(),this.setState(t)};setToast=t=>{this.setState({toast:t})};restoreFileFromShare=async()=>{try{let t=await caches.open("web-share-target"),r=await t.match("shared-file");if(r){let o=await r.blob(),n=new File([o],o.name||"",{type:o.type});this.loadFileToCanvas(n,null),await t.delete("shared-file"),window.history.replaceState(null,Cd,window.location.pathname)}}catch(t){this.setState({errorMessage:t.message})}};addFiles=xt(t=>{let r=t.reduce((o,n)=>(o.set(n.id,n),o),new Map);this.files={...this.files,...Object.fromEntries(r)},this.scene.getNonDeletedElements().forEach(o=>{Zr(o)&&r.has(o.fileId)&&(this.imageCache.delete(o.fileId),Re.delete(o))}),this.scene.informMutation(),this.addNewImagesToImageCache()});updateScene=xt(t=>{t.commitToHistory&&this.history.resumeRecording(),t.appState&&this.setState(t.appState),t.elements&&this.scene.replaceAllElements(t.elements),t.collaborators&&this.setState({collaborators:t.collaborators})});onSceneUpdated=()=>{this.setState({})};toggleSidebar=({name:t,tab:r,force:o})=>{let n;return o===void 0?n=this.state.openSidebar?.name===t?null:t:n=o?t:null,this.setState({openSidebar:n?{name:n,tab:r}:null}),!!n};updateCurrentCursorPosition=xt(t=>{this.lastViewportPosition.x=t.clientX,this.lastViewportPosition.y=t.clientY});onKeyDown=xt(t=>{if("Proxy"in window&&(!t.shiftKey&&/^[A-Z]$/.test(t.key)||t.shiftKey&&/^[a-z]$/.test(t.key))&&(t=new Proxy(t,{get(i,a){let s=i[a];return typeof s=="function"?s.bind(i):a==="key"?t.shiftKey?i.key.toUpperCase():i.key.toLowerCase():s}})),t[k.CTRL_OR_CMD]&&t.key.toLowerCase()===k.V&&(WE=t.shiftKey,clearTimeout(H_),H_=window.setTimeout(()=>{WE=!1},100)),t[k.CTRL_OR_CMD]&&Hn(t.target)&&(t.code===ve.MINUS||t.code===ve.EQUAL)){t.preventDefault();return}if(Hn(t.target)&&t.key!==k.ESCAPE||zl(t.key)&&sb(t.target))return;if(t.key===k.QUESTION_MARK){this.setState({openDialog:{name:"help"}});return}else if(t.key.toLowerCase()===k.E&&t.shiftKey&&t[k.CTRL_OR_CMD]){t.preventDefault(),this.setState({openDialog:{name:"imageExport"}});return}if(t.key===k.PAGE_UP||t.key===k.PAGE_DOWN){let i=(t.shiftKey?this.state.width:this.state.height)/this.state.zoom.value;t.key===k.PAGE_DOWN&&(i=-i),t.shiftKey?this.translateCanvas(a=>({scrollX:a.scrollX+i})):this.translateCanvas(a=>({scrollY:a.scrollY+i}))}if(this.actionManager.handleKeyDown(t)||this.state.viewModeEnabled)return;if(t[k.CTRL_OR_CMD]&&this.state.isBindingEnabled&&this.setState({isBindingEnabled:!1}),zl(t.key)){let i=this.state.gridSize&&(t.shiftKey?j0:this.state.gridSize)||(t.shiftKey?Jv:j0),a=0,s=0;t.key===k.ARROW_LEFT?a=-i:t.key===k.ARROW_RIGHT?a=i:t.key===k.ARROW_UP?s=-i:t.key===k.ARROW_DOWN&&(s=i);let c=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});c.forEach(l=>{Y(l,{x:l.x+a,y:l.y+s}),Sn(l,{simultaneouslyUpdated:c})}),this.maybeSuggestBindingForAll(c),t.preventDefault()}else if(t.key===k.ENTER){let i=this.scene.getSelectedElements(this.state);if(i.length===1){let a=i[0];if(t[k.CTRL_OR_CMD])me(a)&&(!this.state.editingLinearElement||this.state.editingLinearElement.elementId!==i[0].id)&&(this.history.resumeRecording(),this.setState({editingLinearElement:new re(a,this.scene)}));else if(ee(a)||K_(a)){let s;ee(a)||(s=a);let c=Gg(a,this.state),l=c.x,d=c.y;this.startTextEditing({sceneX:l,sceneY:d,container:s}),t.preventDefault();return}else le(a)&&this.setState({editingFrame:a.id})}}else if(!t.ctrlKey&&!t.altKey&&!t.metaKey&&this.state.draggingElement===null){let i=Ck(t.key);i?(this.state.activeTool.type!==i&&Ae("toolbar",i,`keyboard (${this.device.editor.isMobile?"mobile":"desktop"})`),this.setActiveTool({type:i}),t.stopPropagation()):t.key===k.Q&&(this.toggleLock("keyboard"),t.stopPropagation())}if(t.key===k.SPACE&&Ze.pointers.size===0&&(Js=!0,Qe(this.interactiveCanvas,Ue.GRAB),t.preventDefault()),(t.key===k.G||t.key===k.S)&&!t.altKey&&!t[k.CTRL_OR_CMD]){let i=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type==="selection"&&!i.length)return;t.key===k.G&&(Ei(this.state.activeTool.type)||i.some(a=>Ei(a.type)))&&(this.setState({openPopup:"elementBackground"}),t.stopPropagation()),t.key===k.S&&(this.setState({openPopup:"elementStroke"}),t.stopPropagation())}if(t.key===k.K&&!t.altKey&&!t[k.CTRL_OR_CMD]){this.state.activeTool.type==="laser"?this.setActiveTool({type:"selection"}):this.setActiveTool({type:"laser"});return}t[k.CTRL_OR_CMD]&&(t.key===k.BACKSPACE||t.key===k.DELETE)&&Kr.set(Au,"clearCanvas");let r=t.key.toLocaleLowerCase(),o=r===k.S&&t.shiftKey,n=t.key===k.I||r===k.G&&t.shiftKey;(o||n)&&this.openEyeDropper({type:o?"stroke":"background"})});onWheel=xt(t=>{!(t.target instanceof HTMLCanvasElement)&&t.ctrlKey&&t.preventDefault()});onKeyUp=xt(t=>{if(t.key===k.SPACE&&(this.state.viewModeEnabled?Qe(this.interactiveCanvas,Ue.GRAB):this.state.activeTool.type==="selection"?so(this.interactiveCanvas):(lo(this.interactiveCanvas,this.state),this.setState({selectedElementIds:Ye({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})),Js=!1),!t[k.CTRL_OR_CMD]&&!this.state.isBindingEnabled&&this.setState({isBindingEnabled:!0}),zl(t.key)){let r=this.scene.getSelectedElements(this.state);ri(this.state)?Gu(r):Uu(r),this.setState({suggestedBindings:[]})}});isToolSupported=t=>this.props.UIOptions.tools?.[t]!==!1;setActiveTool=t=>{if(!this.isToolSupported(t.type)){console.warn(`"${t.type}" tool is disabled via "UIOptions.canvasActions.tools.${t.type}"`);return}let r=st(this.state,t);r.type==="hand"?Qe(this.interactiveCanvas,Ue.GRAB):Js||lo(this.interactiveCanvas,this.state),M2(document.activeElement)&&this.focusContainer(),Fd(r.type)||this.setState({suggestedBindings:[]}),r.type==="image"&&this.onImageAction({insertOnCanvasDirectly:(t.type==="image"&&t.insertOnCanvasDirectly)??!1}),this.setState(o=>{let n={snapLines:o.snapLines.length?[]:o.snapLines,originSnapOffset:null,activeEmbeddable:null};return r.type!=="selection"?{...o,activeTool:r,selectedElementIds:Ye({},o),selectedGroupIds:Ye({},o),editingGroupId:null,multiElement:null,...n}:{...o,activeTool:r,...n}})};setOpenDialog=t=>{this.setState({openDialog:t})};setCursor=t=>{Qe(this.interactiveCanvas,t)};resetCursor=()=>{so(this.interactiveCanvas)};isTouchScreenMultiTouchGesture=()=>Ze.pointers.size>=2;onGestureStart=xt(t=>{t.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({selectedElementIds:Ye({},this.state),activeEmbeddable:null}),Ze.initialScale=this.state.zoom.value});onGestureChange=xt(t=>{if(t.preventDefault(),this.isTouchScreenMultiTouchGesture())return;let r=Ze.initialScale;r&&this.setState(o=>({...yi({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:Yn(r*t.scale)},o)}))});onGestureEnd=xt(t=>{t.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({previousSelectedElementIds:{},selectedElementIds:Ye(this.state.previousSelectedElementIds,this.state)}),Ze.initialScale=null});handleTextWysiwyg(t,{isExistingElement:r=!1}){let o=(n,i,a)=>{this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map(s=>s.id===t.id&&ee(s)?Hb(s,{text:n,isDeleted:a,originalText:i}):s)])};mE({id:t.id,canvas:this.canvas,getViewportCoords:(n,i)=>{let{x:a,y:s}=nr({sceneX:n,sceneY:i},this.state);return[a-this.state.offsetLeft,s-this.state.offsetTop]},onChange:xt(n=>{o(n,n,!1),cm(t)&&Sn(t)}),onSubmit:xt(({text:n,viaKeyboard:i,originalText:a})=>{let s=!n.trim();if(o(n,a,s),!s&&i){let c=t.containerId?t.containerId:t.id;this.setState(l=>({selectedElementIds:Ye({...l.selectedElementIds,[c]:!0},l)}))}s&&Kl(this.scene.getNonDeletedElements(),[t]),(!s||r)&&this.history.resumeRecording(),this.setState({draggingElement:null,editingElement:null}),this.state.activeTool.locked&&lo(this.interactiveCanvas,this.state),this.focusContainer()}),element:t,excalidrawContainer:this.excalidrawContainerRef.current,app:this}),this.deselectElements(),o(t.text,t.originalText,!1)}deselectElements(){this.setState({selectedElementIds:Ye({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}getTextElementAtPosition(t,r){let o=this.getElementAtPosition(t,r,{includeBoundTextElement:!0});return o&&ee(o)&&!o.isDeleted?o:null}getElementAtPosition(t,r,o){let n=this.getElementsAtPosition(t,r,o?.includeBoundTextElement,o?.includeLockedElements);if(n.length>1){if(o?.preferSelected){for(let a=n.length-1;a>-1;a--)if(this.state.selectedElementIds[n[a].id])return n[a]}let i=n[n.length-1];return lm(i,this.state,this.frameNameBoundsCache,t,r)?n[n.length-2]:i}return n.length===1?n[0]:null}getElementsAtPosition(t,r,o=!1,n=!1){let i=o&&n?this.scene.getNonDeletedElements():this.scene.getNonDeletedElements().filter(a=>(n||!a.locked)&&(o||!(ee(a)&&a.containerId)));return Cb(i,a=>rd(a,this.state,this.frameNameBoundsCache,t,r)).filter(a=>{let s=Cr(a);return s&&this.state.frameRendering.enabled&&this.state.frameRendering.clip?KE({x:t,y:r},s):!0})}startTextEditing=({sceneX:t,sceneY:r,insertAtParentCenter:o=!0,container:n})=>{let i=!1,a=o&&this.getTextWysiwygSnappedToCenterPosition(t,r,this.state,n);n&&a&&(ye(n)||(i=!0));let s=null,c=this.scene.getSelectedElements(this.state);c.length===1?ee(c[0])?s=c[0]:n?s=ye(c[0]):s=this.getTextElementAtPosition(t,r):s=this.getTextElementAtPosition(t,r);let l=s?.fontFamily||this.state.currentItemFontFamily,d=s?.lineHeight||mo(l),u=this.state.currentItemFontSize;if(!s&&i&&n&&!Le(n)){let g=mg(Ve({fontSize:u,fontFamily:l}),d),x=ug(u,d),y=Math.max(n.height,x),w=Math.max(n.width,g);Y(n,{height:y,width:w}),t=n.x+w/2,r=n.y+y/2,a&&(a=this.getTextWysiwygSnappedToCenterPosition(t,r,this.state,n))}let m=this.getTopLayerFrameAtSceneCoords({x:t,y:r}),p=s||ir({x:a?a.elementCenterX:t,y:a?a.elementCenterY:r,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:"",fontSize:u,fontFamily:l,textAlign:a?"center":this.state.currentItemTextAlign,verticalAlign:a?Nt.MIDDLE:as,containerId:i?n?.id:void 0,groupIds:n?.groupIds??[],lineHeight:d,angle:n?.angle??0,frameId:m?m.id:null});if(!s&&i&&n&&Y(n,{boundElements:(n.boundElements||[]).concat({type:"text",id:p.id})}),this.setState({editingElement:p}),!s)if(n&&i){let f=this.scene.getElementIndex(n.id);this.scene.insertElementAtIndex(p,f+1)}else this.scene.addNewElement(p);this.setState({editingElement:p}),this.handleTextWysiwyg(p,{isExistingElement:!!s})};handleCanvasDoubleClick=t=>{if(this.state.multiElement||this.state.activeTool.type!=="selection")return;let r=this.scene.getSelectedElements(this.state);if(r.length===1&&me(r[0])){if(t[k.CTRL_OR_CMD]&&(!this.state.editingLinearElement||this.state.editingLinearElement.elementId!==r[0].id)){this.history.resumeRecording(),this.setState({editingLinearElement:new re(r[0],this.scene)});return}else if(this.state.editingLinearElement&&this.state.editingLinearElement.elementId===r[0].id)return}so(this.interactiveCanvas);let{x:o,y:n}=ot(t,this.state);if(wi(this.state).length>0){let a=this.getElementAtPosition(o,n),s=a&&D3(a,this.state.selectedGroupIds);if(s){this.setState(c=>({...c,...fr({editingGroupId:s,selectedElementIds:{[a.id]:!0}},this.scene.getNonDeletedElements(),c,this)}));return}}if(so(this.interactiveCanvas),!t[k.CTRL_OR_CMD]&&!this.state.viewModeEnabled){let a=this.getElementAtPosition(o,n);if(Or(a)){this.setState({activeEmbeddable:{element:a,state:"active"}});return}let s=VE(this.scene.getNonDeletedElements(),this.state,o,n);if(s&&(Xr(s)||!Rr(s.backgroundColor)||Qs(s,this.state,this.frameNameBoundsCache,[o,n]))){let c=Gg(s,this.state);o=c.x,n=c.y}this.startTextEditing({sceneX:o,sceneY:n,insertAtParentCenter:!t.altKey,container:s})}};getElementLinkAtPosition=(t,r)=>{let o=this.scene.getNonDeletedElements().slice().reverse(),n=1/0;return o.find((i,a)=>(r&&i.id===r.id&&(n=a),i.link&&a<=n&&$g(i,this.state,[t.x,t.y],this.device.editor.isMobile)))};redirectToLink=(t,r)=>{let o=kt(this.lastPointerDownEvent.clientX,this.lastPointerDownEvent.clientY,this.lastPointerUpEvent.clientX,this.lastPointerUpEvent.clientY);if(!this.hitLinkElement||r&&o>pi||!r&&o!==0)return;let n=ot(this.lastPointerDownEvent,this.state),i=$g(this.hitLinkElement,this.state,[n.x,n.y],this.device.editor.isMobile),a=ot(this.lastPointerUpEvent,this.state),s=$g(this.hitLinkElement,this.state,[a.x,a.y],this.device.editor.isMobile);if(i&&s){let c=this.hitLinkElement.link;if(c){c=Hr(c);let l;if(this.props.onLinkOpen&&(l=fp("excalidraw-link",t.nativeEvent),this.props.onLinkOpen({...this.hitLinkElement,link:c},l)),!l?.defaultPrevented){let d=lh(c)?"_self":"_blank",u=window.open(void 0,d);u&&(u.opener=null,u.location=c)}}}};getTopLayerFrameAtSceneCoords=t=>{let r=this.scene.getNonDeletedFramesLikes().filter(o=>KE(t,o));return r.length?r[r.length-1]:null};handleCanvasPointerMove=t=>{this.savePointer(t.clientX,t.clientY,this.state.cursorButton),this.lastPointerMoveEvent=t.nativeEvent,Ze.pointers.has(t.pointerId)&&Ze.pointers.set(t.pointerId,{x:t.clientX,y:t.clientY});let r=Ze.initialScale;if(Ze.pointers.size===2&&Ze.lastCenter&&r&&Ze.initialDistance){let m=yE(Ze.pointers),p=m.x-Ze.lastCenter.x,f=m.y-Ze.lastCenter.y;Ze.lastCenter=m;let g=wE(Array.from(Ze.pointers.values())),x=this.state.activeTool.type==="freedraw"&&this.state.penMode?1:g/Ze.initialDistance,y=x?Yn(r*x):this.state.zoom.value;this.setState(w=>{let T=yi({viewportX:m.x,viewportY:m.y,nextZoom:y},w);this.translateCanvas({zoom:T.zoom,scrollX:T.scrollX+p/y,scrollY:T.scrollY+f/y,shouldCacheIgnoreZoom:!0})}),this.resetShouldCacheIgnoreZoomDebounced()}else Ze.lastCenter=Ze.initialDistance=Ze.initialScale=null;if(Js||im||$E||an(this.state))return;let n=Rp(GE,t.clientX-this.state.offsetLeft,t.clientY-this.state.offsetTop).isOverEither;!this.state.draggingElement&&!this.state.multiElement&&(n?so(this.interactiveCanvas):lo(this.interactiveCanvas,this.state));let i=ot(t,this.state),{x:a,y:s}=i;if(!this.state.draggingElement&&v_(this.state.activeTool.type)){let{originOffset:m,snapLines:p}=w_(this.scene.getNonDeletedElements(),this.state,{x:a,y:s},t);this.setState(f=>{let g=bp(f.snapLines,p),x=f.originSnapOffset?bp(f.originSnapOffset,m):m;return f.snapLines===g&&f.originSnapOffset===x?null:{snapLines:g,originSnapOffset:x}})}else this.state.draggingElement||this.setState(m=>m.snapLines.length?{snapLines:[]}:null);if(this.state.editingLinearElement&&!this.state.editingLinearElement.isDragging){let m=re.handlePointerMove(t,a,s,this.state);m&&m!==this.state.editingLinearElement&&(0,Wg.flushSync)(()=>{this.setState({editingLinearElement:m})}),m?.lastUncommittedPoint!=null?this.maybeSuggestBindingAtCursor(i):(0,Wg.flushSync)(()=>{this.setState({suggestedBindings:[]})})}if(mb(this.state.activeTool.type)){let{draggingElement:m}=this.state;Ut(m,!1)?this.maybeSuggestBindingsForLinearElementAtCoords(m,[i],this.state.startBoundElement):this.maybeSuggestBindingAtCursor(i)}if(this.state.multiElement){let{multiElement:m}=this.state,{x:p,y:f}=m,{points:g,lastCommittedPoint:x}=m,y=g[g.length-1];if(lo(this.interactiveCanvas,this.state),y===x)kt(a-p,s-f,y[0],y[1])>=bl?Y(m,{points:[...g,[a-p,s-f]]}):Qe(this.interactiveCanvas,Ue.POINTER);else if(g.length>2&&x&&kt(a-p,s-f,x[0],x[1])<bl)Qe(this.interactiveCanvas,Ue.POINTER),Y(m,{points:g.slice(0,-1)});else{let[w,T]=Zt(a,s,t[k.CTRL_OR_CMD]?null:this.state.gridSize),[C,I]=m?.lastCommittedPoint??[0,0],A=w-p-C,P=T-f-I;Ts(t)&&({width:A,height:P}=od(C+p,I+f,w,T)),eo(g,this.state.zoom.value)&&Qe(this.interactiveCanvas,Ue.POINTER),Y(m,{points:[...g.slice(0,-1),[C+A,I+P]]})}return}if(!!t.buttons||this.state.activeTool.type!=="selection"&&this.state.activeTool.type!=="text"&&this.state.activeTool.type!=="eraser")return;let l=this.scene.getNonDeletedElements(),d=this.scene.getSelectedElements(this.state);if(d.length===1&&!n&&!this.state.editingLinearElement){let m=Yg(l,this.state,a,s,this.state.zoom,t.pointerType);if(m&&m.transformHandleType){Qe(this.interactiveCanvas,Zg(m));return}}else if(d.length>1&&!n){let m=Kg(Me(d),a,s,this.state.zoom,t.pointerType);if(m){Qe(this.interactiveCanvas,Zg({transformHandleType:m}));return}}let u=this.getElementAtPosition(i.x,i.y);this.hitLinkElement=this.getElementLinkAtPosition(i,u),!Io(this.state)&&(this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?(Qe(this.interactiveCanvas,Ue.POINTER),U_(this.hitLinkElement,this.state)):(W_(),u&&(u.link||er(u))&&this.state.selectedElementIds[u.id]&&!this.state.contextMenu&&!this.state.showHyperlinkPopup?this.setState({showHyperlinkPopup:"info"}):this.state.activeTool.type==="text"?Qe(this.interactiveCanvas,ee(u)?Ue.TEXT:Ue.CROSSHAIR):this.state.viewModeEnabled?Qe(this.interactiveCanvas,Ue.GRAB):n?Qe(this.interactiveCanvas,Ue.AUTO):this.state.selectedLinearElement?this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,a,s):t[k.CTRL_OR_CMD]?Qe(this.interactiveCanvas,Ue.AUTO):(u||this.isHittingCommonBoundingBoxOfSelectedElements(i,d))&&!u?.locked&&(u&&Or(u)&&this.isIframeLikeElementCenter(u,t,a,s)?(Qe(this.interactiveCanvas,Ue.POINTER),this.setState({activeEmbeddable:{element:u,state:"hover"}})):(Qe(this.interactiveCanvas,Ue.MOVE),this.state.activeEmbeddable?.state==="hover"&&this.setState({activeEmbeddable:null})))))};handleEraser=(t,r,o)=>{let n=u=>{u.forEach(m=>{m.locked||(i.push(m.id),t.altKey?r.elementIdsToErase[m.id]&&r.elementIdsToErase[m.id].erase&&(r.elementIdsToErase[m.id].erase=!1):r.elementIdsToErase[m.id]||(r.elementIdsToErase[m.id]={erase:!0,opacity:m.opacity}))})},i=[],a=kt(r.lastCoords.x,r.lastCoords.y,o.x,o.y),s=10/this.state.zoom.value,c={...r.lastCoords},l=0;for(;l<=a;){let u=this.getElementsAtPosition(c.x,c.y);if(n(u),l===a)break;l=Math.min(l+s,a);let m=l/a,p=(1-m)*c.x+m*o.x,f=(1-m)*c.y+m*o.y;c.x=p,c.y=f}let d=this.scene.getElementsIncludingDeleted().map(u=>{let m=$e(u)&&i.includes(u.containerId)?u.containerId:u.id;if(i.includes(m))if(t.altKey){if(r.elementIdsToErase[m]&&r.elementIdsToErase[m].erase===!1)return de(u,{opacity:r.elementIdsToErase[m].opacity})}else return de(u,{opacity:f2});return u});this.scene.replaceAllElements(d),r.lastCoords.x=o.x,r.lastCoords.y=o.y};handleTouchMove=t=>{am=!0};handleHoverSelectedLinearElement(t,r,o){let n=re.getElement(t.elementId),i=ye(n);if(n)if(this.state.selectedLinearElement){let a=-1,s=null;Qs(n,this.state,this.frameNameBoundsCache,[r,o])?(a=re.getPointIndexUnderCursor(n,this.state.zoom,r,o),s=re.getSegmentMidpointHitCoords(t,{x:r,y:o},this.state),a>=0||s?Qe(this.interactiveCanvas,Ue.POINTER):Qe(this.interactiveCanvas,Ue.MOVE)):nd([n],this.state)&&lm(n,this.state,this.frameNameBoundsCache,r,o)?Qe(this.interactiveCanvas,Ue.MOVE):i&&rd(i,this.state,this.frameNameBoundsCache,r,o)&&Qe(this.interactiveCanvas,Ue.MOVE),this.state.selectedLinearElement.hoverPointIndex!==a&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,hoverPointIndex:a}}),re.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords,s)||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,segmentMidPointHoveredCoords:s}})}else Qe(this.interactiveCanvas,Ue.AUTO)}handleCanvasPointerDown=t=>{if(this.maybeCleanupAfterMissingPointerUp(t.nativeEvent),this.maybeUnfollowRemoteUser(),this.state.contextMenu&&this.setState({contextMenu:null}),this.state.snapLines&&this.setAppState({snapLines:[]}),this.updateGestureOnPointerDown(t),t.pointerType==="touch"&&this.state.draggingElement&&this.state.draggingElement.type==="freedraw"){let l=this.state.draggingElement;this.updateScene({...l.points.length<10?{elements:this.scene.getElementsIncludingDeleted().filter(d=>d.id!==l.id)}:{},appState:{draggingElement:null,editingElement:null,startBoundElement:null,suggestedBindings:[],selectedElementIds:Ye(Object.keys(this.state.selectedElementIds).filter(d=>d!==l.id).reduce((d,u)=>(d[u]=this.state.selectedElementIds[u],d),{}),this.state)}});return}let r=document.getSelection();if(r?.anchorNode&&r.removeAllRanges(),this.maybeOpenContextMenuAfterPointerDownOnTouchDevices(t),!this.state.penDetected&&t.pointerType==="pen"&&this.setState(l=>({penMode:!0,penDetected:!0})),!this.device.isTouchScreen&&["pen","touch"].includes(t.pointerType)&&(this.device=Il(this.device,{isTouchScreen:!0})),im||(this.lastPointerDownEvent=t,this.handleCanvasPanUsingWheelOrSpaceDrag(t)))return;if(this.setState({lastPointerDownWith:t.pointerType,cursorButton:"down"}),this.savePointer(t.clientX,t.clientY,"down"),t.button===ra.ERASER&&this.state.activeTool.type!==Ft.eraser){this.setState({activeTool:st(this.state,{type:Ft.eraser,lastActiveToolBeforeEraser:this.state.activeTool})},()=>{this.handleCanvasPointerDown(t);let l=()=>{d(),u?.(),Io(this.state)&&this.setState({activeTool:st(this.state,{...this.state.activeTool.lastActiveTool||{type:Ft.selection},lastActiveToolBeforeEraser:null})})},d=_t(window,"pointerup",l,{once:!0}),u;requestAnimationFrame(()=>{u=this.missingPointerEventCleanupEmitter.once(l)})});return}if(t.button!==ra.MAIN&&t.button!==ra.TOUCH&&t.button!==ra.ERASER||Ze.pointers.size>1)return;let o=this.initialPointerDownState(t);if(this.setState({selectedElementsAreBeingDragged:!1}),this.handleDraggingScrollBar(t,o)||(this.clearSelectionIfNotUsingSelection(),this.updateBindingEnabledOnPointerMove(t),this.handleSelectionOnPointerDown(t,o))||!(!this.state.penMode||t.pointerType!=="touch"||this.state.activeTool.type==="selection"||this.state.activeTool.type==="text"||this.state.activeTool.type==="image"))return;if(this.state.activeTool.type==="text"){this.handleTextOnPointerDown(t,o);return}else if(this.state.activeTool.type==="arrow"||this.state.activeTool.type==="line")this.handleLinearElementOnPointerDown(t,this.state.activeTool.type,o);else if(this.state.activeTool.type==="image"){Qe(this.interactiveCanvas,Ue.CROSSHAIR);let l=this.state.pendingImageElementId&&this.scene.getElement(this.state.pendingImageElementId);if(!l)return;this.setState({draggingElement:l,editingElement:l,pendingImageElementId:null,multiElement:null});let{x:d,y:u}=ot(t,this.state),m=this.getTopLayerFrameAtSceneCoords({x:d,y:u});Y(l,{x:d,y:u,frameId:m?m.id:null})}else this.state.activeTool.type==="freedraw"?this.handleFreeDrawElementOnPointerDown(t,this.state.activeTool.type,o):this.state.activeTool.type==="custom"?lo(this.interactiveCanvas,this.state):this.state.activeTool.type===Ft.frame||this.state.activeTool.type===Ft.magicframe?this.createFrameElementOnPointerDown(o,this.state.activeTool.type):this.state.activeTool.type==="laser"?this.laserPathManager.startPath(o.lastCoords.x,o.lastCoords.y):this.state.activeTool.type!=="eraser"&&this.state.activeTool.type!=="hand"&&this.createGenericElementOnPointerDown(this.state.activeTool.type,o);this.props?.onPointerDown?.(this.state.activeTool,o),this.onPointerDownEmitter.trigger(this.state.activeTool,o,t);let i=this.onPointerMoveFromPointerDownHandler(o),a=this.onPointerUpFromPointerDownHandler(o),s=this.onKeyDownFromPointerDownHandler(o),c=this.onKeyUpFromPointerDownHandler(o);this.missingPointerEventCleanupEmitter.once(l=>a(l||t.nativeEvent)),(!this.state.viewModeEnabled||this.state.activeTool.type==="laser")&&(window.addEventListener("pointermove",i),window.addEventListener("pointerup",a),window.addEventListener("keydown",s),window.addEventListener("keyup",c),o.eventListeners.onMove=i,o.eventListeners.onUp=a,o.eventListeners.onKeyUp=c,o.eventListeners.onKeyDown=s)};handleCanvasPointerUp=t=>{this.removePointer(t),this.lastPointerUpEvent=t;let r=ot({clientX:t.clientX,clientY:t.clientY},this.state),o=t.timeStamp-(this.lastPointerDownEvent?.timeStamp??0);if(this.device.editor.isMobile&&o<300){let n=this.getElementAtPosition(r.x,r.y);if(Or(n)&&this.isIframeLikeElementCenter(n,t,r.x,r.y)){this.handleEmbeddableCenterClick(n);return}}if(this.device.isTouchScreen){let n=this.getElementAtPosition(r.x,r.y);this.hitLinkElement=this.getElementLinkAtPosition(r,n)}this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?o<300&&Or(this.hitLinkElement)&&!XE(this.hitLinkElement,this.state,[r.x,r.y])?this.handleEmbeddableCenterClick(this.hitLinkElement):this.redirectToLink(t,this.device.isTouchScreen):this.state.viewModeEnabled&&this.setState({activeEmbeddable:null,selectedElementIds:{}})};maybeOpenContextMenuAfterPointerDownOnTouchDevices=t=>{t.pointerType==="touch"&&(am=!1,Ya?am=!0:Ya=window.setTimeout(()=>{Ya=0,am||this.handleCanvasContextMenu(t)},o2))};resetContextMenuTimer=()=>{clearTimeout(Ya),Ya=0,am=!1};maybeCleanupAfterMissingPointerUp=t=>{sm?.(),this.missingPointerEventCleanupEmitter.trigger(t).clear()};handleCanvasPanUsingWheelOrSpaceDrag=t=>{if(!(Ze.pointers.size<=1&&(t.button===ra.WHEEL||t.button===ra.MAIN&&Js||an(this.state)||this.state.viewModeEnabled))||ee(this.state.editingElement))return!1;im=!0,t.preventDefault();let r=!1,o=/Linux/.test(window.navigator.platform);Qe(this.interactiveCanvas,Ue.GRABBING);let{clientX:n,clientY:i}=t,a=pp(c=>{let l=n-c.clientX,d=i-c.clientY;if(n=c.clientX,i=c.clientY,o&&!r&&(Math.abs(l)>1||Math.abs(d)>1)){r=!0;let u=p=>{document.body.removeEventListener("paste",u),p.stopPropagation()},m=()=>{setTimeout(()=>{document.body.removeEventListener("paste",u),window.removeEventListener("pointerup",m)},100)};document.body.addEventListener("paste",u),window.addEventListener("pointerup",m)}this.translateCanvas({scrollX:this.state.scrollX-l/this.state.zoom.value,scrollY:this.state.scrollY-d/this.state.zoom.value})}),s=xt(sm=()=>{sm=null,im=!1,Js||(this.state.viewModeEnabled?Qe(this.interactiveCanvas,Ue.GRAB):lo(this.interactiveCanvas,this.state)),this.setState({cursorButton:"up"}),this.savePointer(t.clientX,t.clientY,"up"),window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",s),window.removeEventListener("blur",s),a.flush()});return window.addEventListener("blur",s),window.addEventListener("pointermove",a,{passive:!0}),window.addEventListener("pointerup",s),!0};updateGestureOnPointerDown(t){Ze.pointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),Ze.pointers.size===2&&(Ze.lastCenter=yE(Ze.pointers),Ze.initialScale=this.state.zoom.value,Ze.initialDistance=wE(Array.from(Ze.pointers.values())))}initialPointerDownState(t){let r=ot(t,this.state),o=this.scene.getSelectedElements(this.state),[n,i,a,s]=Me(o);return{origin:r,withCmdOrCtrl:t[k.CTRL_OR_CMD],originInGrid:nn(Zt(r.x,r.y,t[k.CTRL_OR_CMD]?null:this.state.gridSize)),scrollbars:Rp(GE,t.clientX-this.state.offsetLeft,t.clientY-this.state.offsetTop),lastCoords:{...r},originalElements:this.scene.getNonDeletedElements().reduce((c,l)=>(c.set(l.id,Ti(l)),c),new Map),resize:{handleType:!1,isResizing:!1,offset:{x:0,y:0},arrowDirection:"origin",center:{x:(a+n)/2,y:(s+i)/2}},hit:{element:null,allHitElements:[],wasAddedToSelection:!1,hasBeenDuplicated:!1,hasHitCommonBoundingBoxOfSelectedElements:this.isHittingCommonBoundingBoxOfSelectedElements(r,o)},drag:{hasOccurred:!1,offset:null},eventListeners:{onMove:null,onUp:null,onKeyUp:null,onKeyDown:null},boxSelection:{hasOccurred:!1},elementIdsToErase:{}}}handleDraggingScrollBar(t,r){if(!(r.scrollbars.isOverEither&&!this.state.multiElement))return!1;$E=!0,r.lastCoords.x=t.clientX,r.lastCoords.y=t.clientY;let o=pp(i=>{i.target instanceof HTMLElement&&this.handlePointerMoveOverScrollbars(i,r)}),n=xt(()=>{sm=null,$E=!1,lo(this.interactiveCanvas,this.state),this.setState({cursorButton:"up"}),this.savePointer(t.clientX,t.clientY,"up"),window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",n),o.flush()});return sm=n,window.addEventListener("pointermove",o),window.addEventListener("pointerup",n),!0}clearSelectionIfNotUsingSelection=()=>{this.state.activeTool.type!=="selection"&&this.setState({selectedElementIds:Ye({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})};handleSelectionOnPointerDown=(t,r)=>{if(this.state.activeTool.type==="selection"){let o=this.scene.getNonDeletedElements(),n=this.scene.getSelectedElements(this.state);if(n.length===1&&!this.state.editingLinearElement){let i=Yg(o,this.state,r.origin.x,r.origin.y,this.state.zoom,t.pointerType);i!=null&&(this.setState({resizingElement:i.element}),r.resize.handleType=i.transformHandleType)}else n.length>1&&(r.resize.handleType=Kg(Me(n),r.origin.x,r.origin.y,this.state.zoom,t.pointerType));if(r.resize.handleType)r.resize.isResizing=!0,r.resize.offset=nn(aE(r.resize.handleType,n,r.origin.x,r.origin.y)),n.length===1&&me(n[0])&&n[0].points.length===2&&(r.resize.arrowDirection=sE(r.resize.handleType,n[0]));else{if(this.state.selectedLinearElement){let s=this.state.editingLinearElement||this.state.selectedLinearElement,c=re.handlePointerDown(t,this.state,this.history,r.origin,s);if(c.hitElement&&(r.hit.element=c.hitElement),c.linearElementEditor&&(this.setState({selectedLinearElement:c.linearElementEditor}),this.state.editingLinearElement&&this.setState({editingLinearElement:c.linearElementEditor})),c.didAddPoint)return!0}if(r.hit.element=r.hit.element??this.getElementAtPosition(r.origin.x,r.origin.y),r.hit.element&&this.getElementLinkAtPosition({x:r.origin.x,y:r.origin.y},r.hit.element))return!1;r.hit.allHitElements=this.getElementsAtPosition(r.origin.x,r.origin.y);let i=r.hit.element,a=r.hit.allHitElements.some(s=>this.isASelectedElement(s));if((i===null||!a)&&!t.shiftKey&&!r.hit.hasHitCommonBoundingBoxOfSelectedElements&&this.clearSelection(i),this.state.editingLinearElement)this.setState({selectedElementIds:Ye({[this.state.editingLinearElement.elementId]:!0},this.state)});else if(i!=null){if(t[k.CTRL_OR_CMD])return this.state.selectedElementIds[i.id]||(r.hit.wasAddedToSelection=!0),this.setState(s=>({...L3(s,i),previousSelectedElementIds:this.state.selectedElementIds})),!1;this.state.selectedElementIds[i.id]||(this.state.editingGroupId&&!Es(i,this.state.editingGroupId)&&this.setState({selectedElementIds:Ye({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),!a&&!r.hit.hasHitCommonBoundingBoxOfSelectedElements&&(this.setState(s=>{let c={...s.selectedElementIds,[i.id]:!0},l=[];if(Object.keys(s.selectedElementIds).forEach(d=>{let u=this.scene.getElement(d);u&&l.push(u)}),le(i))po(l,i.id).forEach(d=>{delete c[d.id]});else if(i.frameId)c[i.frameId]&&delete c[i.id];else{let d=i.groupIds,u=new Set(d.flatMap(m=>Et(this.scene.getNonDeletedElements(),m)).filter(m=>le(m)).map(m=>m.id));u.size>0&&l.forEach(m=>{m.frameId&&u.has(m.frameId)&&(delete c[m.id],m.groupIds.flatMap(p=>Et(this.scene.getNonDeletedElements(),p)).forEach(p=>{delete c[p.id]}))})}return{...fr({editingGroupId:s.editingGroupId,selectedElementIds:c},this.scene.getNonDeletedElements(),s,this),showHyperlinkPopup:i.link||er(i)?"info":!1}}),r.hit.wasAddedToSelection=!0))}this.setState({previousSelectedElementIds:this.state.selectedElementIds})}}return!1};isASelectedElement(t){return t!=null&&this.state.selectedElementIds[t.id]}isHittingCommonBoundingBoxOfSelectedElements(t,r){if(r.length<2)return!1;let o=10/this.state.zoom.value,[n,i,a,s]=Me(r);return t.x>n-o&&t.x<a+o&&t.y>i-o&&t.y<s+o}handleTextOnPointerDown=(t,r)=>{if(ee(this.state.editingElement))return;let o=r.origin.x,n=r.origin.y,i=this.getElementAtPosition(o,n,{includeBoundTextElement:!0}),a=VE(this.scene.getNonDeletedElements(),this.state,o,n);Xr(i)&&(a=i,o=i.x+i.width/2,n=i.y+i.height/2),this.startTextEditing({sceneX:o,sceneY:n,insertAtParentCenter:!t.altKey,container:a}),so(this.interactiveCanvas),this.state.activeTool.locked||this.setState({activeTool:st(this.state,{type:"selection"})})};handleFreeDrawElementOnPointerDown=(t,r,o)=>{let[n,i]=Zt(o.origin.x,o.origin.y,null),a=this.getTopLayerFrameAtSceneCoords({x:n,y:i}),s=G3({type:r,x:n,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:null,simulatePressure:t.pressure===.5,locked:!1,frameId:a?a.id:null});this.setState(d=>{let u={...d.selectedElementIds};return delete u[s.id],{selectedElementIds:Ye(u,d)}});let c=s.simulatePressure?s.pressures:[...s.pressures,t.pressure];Y(s,{points:[[0,0]],pressures:c});let l=ai(o.origin,this.scene);this.scene.addNewElement(s),this.setState({draggingElement:s,editingElement:s,startBoundElement:l,suggestedBindings:[]})};insertIframeElement=({sceneX:t,sceneY:r,width:o,height:n})=>{let[i,a]=Zt(t,r,this.lastPointerDownEvent?.[k.CTRL_OR_CMD]?null:this.state.gridSize),s=H3({type:"iframe",x:i,y:a,strokeColor:"transparent",backgroundColor:"transparent",fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness("iframe"),opacity:this.state.currentItemOpacity,locked:!1,width:o,height:n});return this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted(),s]),s};insertEmbeddableElement=({sceneX:t,sceneY:r,link:o})=>{let[n,i]=Zt(t,r,this.lastPointerDownEvent?.[k.CTRL_OR_CMD]?null:this.state.gridSize),a=Ci(o);if(!a)return;a.warning&&this.setToast({message:a.warning,closable:!0});let s=zb({type:"embeddable",x:n,y:i,strokeColor:"transparent",backgroundColor:"transparent",fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness("embeddable"),opacity:this.state.currentItemOpacity,locked:!1,width:a.intrinsicSize.w,height:a.intrinsicSize.h,link:o,validated:null});return this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted(),s]),s};createImageElement=({sceneX:t,sceneY:r,addToFrameUnderCursor:o=!0})=>{let[n,i]=Zt(t,r,this.lastPointerDownEvent?.[k.CTRL_OR_CMD]?null:this.state.gridSize),a=o?this.getTopLayerFrameAtSceneCoords({x:n,y:i}):null;return qd({type:"image",x:n,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:null,opacity:this.state.currentItemOpacity,locked:!1,frameId:a?a.id:null})};handleLinearElementOnPointerDown=(t,r,o)=>{if(this.state.multiElement){let{multiElement:n}=this.state;if(n.type==="line"&&eo(n.points,this.state.zoom.value)){Y(n,{lastCommittedPoint:n.points[n.points.length-1]}),this.actionManager.executeAction(Ho);return}let{x:i,y:a,lastCommittedPoint:s}=n;if(n.points.length>1&&s&&kt(o.origin.x-i,o.origin.y-a,s[0],s[1])<bl){this.actionManager.executeAction(Ho);return}this.setState(c=>({selectedElementIds:Ye({...c.selectedElementIds,[n.id]:!0},c)})),Y(n,{lastCommittedPoint:n.points[n.points.length-1]}),Qe(this.interactiveCanvas,Ue.POINTER)}else{let[n,i]=Zt(o.origin.x,o.origin.y,t[k.CTRL_OR_CMD]?null:this.state.gridSize),a=this.getTopLayerFrameAtSceneCoords({x:n,y:i}),{currentItemStartArrowhead:s,currentItemEndArrowhead:c}=this.state,[l,d]=r==="arrow"?[s,c]:[null,null],u=Ro({type:r,x:n,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemRoundness==="round"?{type:Ct.PROPORTIONAL_RADIUS}:null,startArrowhead:l,endArrowhead:d,locked:!1,frameId:a?a.id:null});this.setState(p=>{let f={...p.selectedElementIds};return delete f[u.id],{selectedElementIds:Ye(f,p)}}),Y(u,{points:[...u.points,[0,0]]});let m=ai(o.origin,this.scene);this.scene.addNewElement(u),this.setState({draggingElement:u,editingElement:u,startBoundElement:m,suggestedBindings:[]})}};getCurrentItemRoundness(t){return this.state.currentItemRoundness==="round"?{type:Gn(t)?Ct.ADAPTIVE_RADIUS:Ct.PROPORTIONAL_RADIUS}:null}createGenericElementOnPointerDown=(t,r)=>{let[o,n]=Zt(r.origin.x,r.origin.y,this.lastPointerDownEvent?.[k.CTRL_OR_CMD]?null:this.state.gridSize),i=this.getTopLayerFrameAtSceneCoords({x:o,y:n}),a={x:o,y:n,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.getCurrentItemRoundness(t),locked:!1,frameId:i?i.id:null},s;t==="embeddable"?s=zb({type:"embeddable",validated:null,...a}):s=uo({type:t,...a}),s.type==="selection"?this.setState({selectionElement:s,draggingElement:s}):(this.scene.addNewElement(s),this.setState({multiElement:null,draggingElement:s,editingElement:s}))};createFrameElementOnPointerDown=(t,r)=>{let[o,n]=Zt(t.origin.x,t.origin.y,this.lastPointerDownEvent?.[k.CTRL_OR_CMD]?null:this.state.gridSize),i={x:o,y:n,opacity:this.state.currentItemOpacity,locked:!1,...ut},a=r===Ft.magicframe?jd(i):Yp(i);this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted(),a]),this.setState({multiElement:null,draggingElement:a,editingElement:a})};maybeCacheReferenceSnapPoints(t,r,o=!1){Wi({event:t,appState:this.state,selectedElements:r})&&(o||!jo.getReferenceSnapPoints())&&jo.setReferenceSnapPoints(b_(this.scene.getNonDeletedElements(),r,this.state))}maybeCacheVisibleGaps(t,r,o=!1){Wi({event:t,appState:this.state,selectedElements:r})&&(o||!jo.getVisibleGaps())&&jo.setVisibleGaps(g_(this.scene.getNonDeletedElements(),r,this.state))}onKeyDownFromPointerDownHandler(t){return xt(r=>{this.maybeHandleResize(t,r)||this.maybeDragNewGenericElement(t,r)})}onKeyUpFromPointerDownHandler(t){return xt(r=>{r.key===k.ALT&&r.preventDefault(),!this.maybeHandleResize(t,r)&&this.maybeDragNewGenericElement(t,r)})}onPointerMoveFromPointerDownHandler(t){return pp(r=>{if(t.drag.offset===null&&(t.drag.offset=nn(QE(this.scene.getSelectedElements(this.state),t.origin.x,t.origin.y))),!(r.target instanceof HTMLElement)||this.handlePointerMoveOverScrollbars(r,t))return;let n=ot(r,this.state);if(Io(this.state)){this.handleEraser(r,t,n);return}this.state.activeTool.type==="laser"&&this.laserPathManager.addPointToPath(n.x,n.y);let[i,a]=Zt(n.x,n.y,r[k.CTRL_OR_CMD]?null:this.state.gridSize);if(!t.drag.hasOccurred&&(this.state.activeTool.type==="arrow"||this.state.activeTool.type==="line")&&kt(n.x,n.y,t.origin.x,t.origin.y)<pi)return;if(t.resize.isResizing&&(t.lastCoords.x=n.x,t.lastCoords.y=n.y,this.maybeHandleResize(t,r)))return!0;if(this.state.selectedLinearElement){let d=this.state.editingLinearElement||this.state.selectedLinearElement;if(re.shouldAddMidpoint(this.state.selectedLinearElement,n,this.state)){let m=re.addMidpoint(this.state.selectedLinearElement,n,this.state,!r[k.CTRL_OR_CMD]);if(!m)return;(0,Wg.flushSync)(()=>{this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,pointerDownState:m.pointerDownState,selectedPointsIndices:m.selectedPointsIndices}}),this.state.editingLinearElement&&this.setState({editingLinearElement:{...this.state.editingLinearElement,pointerDownState:m.pointerDownState,selectedPointsIndices:m.selectedPointsIndices}})});return}else if(d.pointerDownState.segmentMidpoint.value!==null&&!d.pointerDownState.segmentMidpoint.added)return;if(re.handlePointDragging(r,this.state,n.x,n.y,(m,p)=>{this.maybeSuggestBindingsForLinearElementAtCoords(m,p)},d)){t.lastCoords.x=n.x,t.lastCoords.y=n.y,t.drag.hasOccurred=!0,this.state.editingLinearElement&&!this.state.editingLinearElement.isDragging&&this.setState({editingLinearElement:{...this.state.editingLinearElement,isDragging:!0}}),this.state.selectedLinearElement.isDragging||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!0}});return}}let s=t.hit.allHitElements.some(d=>this.isASelectedElement(d)),c=this.state.editingLinearElement&&r.shiftKey&&this.state.editingLinearElement.elementId===t.hit.element?.id;if((s||t.hit.hasHitCommonBoundingBoxOfSelectedElements)&&!c){let d=this.scene.getSelectedElements(this.state);if(d.every(p=>p.locked))return;let u=d.find(p=>le(p)),m=this.getTopLayerFrameAtSceneCoords(n);if(this.setState({frameToHighlight:m&&!u?m:null}),t.drag.hasOccurred=!0,this.setState({selectedElementsAreBeingDragged:!0}),d.length>0&&!t.withCmdOrCtrl&&!this.state.editingElement&&this.state.activeEmbeddable?.state!=="active"){let p={x:n.x-t.origin.x,y:n.y-t.origin.y},f=[...t.originalElements.values()],g=r.shiftKey;if(g){let w=Math.abs(p.x),T=Math.abs(p.y),C=g&&w<T,I=g&&w>T;C&&(p.x=0),I&&(p.y=0)}this.maybeCacheVisibleGaps(r,d),this.maybeCacheReferenceSnapPoints(r,d);let{snapOffset:x,snapLines:y}=x_(Se(f,this.state),p,this.state,r);if(this.setState({snapLines:y}),!this.state.editingFrame&&JE(t,d,p,this.state,this.scene,x,r[k.CTRL_OR_CMD]?null:this.state.gridSize),this.maybeSuggestBindingForAll(d),r.altKey&&!t.hit.hasBeenDuplicated){t.hit.hasBeenDuplicated=!0;let w=[],T=[],C=new Map,I=new Map,A=t.hit.element,P=new Set(this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}).map(M=>M.id)),L=this.scene.getElementsIncludingDeleted();for(let M of L)if(P.has(M.id)||M.id===A?.id&&t.hit.wasAddedToSelection){let R=Jd(this.state.editingGroupId,C,M),N=t.originalElements.get(M.id);Y(R,{x:N.x,y:N.y}),t.originalElements.set(R.id,R),w.push(R),T.push(M),I.set(M.id,R.id)}else w.push(M);let D=[...w,...T];lf(w,T,I),sf(D,T,I,"duplicatesServeAsOld"),cf(D,T,I),this.scene.replaceAllElements(D),this.maybeCacheVisibleGaps(r,d,!0),this.maybeCacheReferenceSnapPoints(r,d,!0)}return}}let l=this.state.draggingElement;if(l){if(l.type==="freedraw"){let d=l.points,u=n.x-l.x,m=n.y-l.y,p=d.length>0&&d[d.length-1];if(!(p&&p[0]===u&&p[1]===m)){let g=l.simulatePressure?l.pressures:[...l.pressures,r.pressure];Y(l,{points:[...d,[u,m]],pressures:g})}}else if(me(l)){t.drag.hasOccurred=!0,this.setState({selectedElementsAreBeingDragged:!0});let d=l.points,u=i-l.x,m=a-l.y;Ts(r)&&d.length===2&&({width:u,height:m}=od(l.x,l.y,n.x,n.y)),d.length===1?Y(l,{points:[...d,[u,m]]}):d.length===2&&Y(l,{points:[...d.slice(0,-1),[u,m]]}),Ut(l,!1)&&this.maybeSuggestBindingsForLinearElementAtCoords(l,[n],this.state.startBoundElement)}else t.lastCoords.x=n.x,t.lastCoords.y=n.y,this.maybeDragNewGenericElement(t,r);if(this.state.activeTool.type==="selection"){t.boxSelection.hasOccurred=!0;let d=this.scene.getNonDeletedElements();if(this.state.editingLinearElement)re.handleBoxSelection(r,this.state,this.setState.bind(this));else{let u=!0;!r.shiftKey&&Je(d,this.state)&&(t.withCmdOrCtrl&&t.hit.element?this.setState(p=>fr({...p,selectedElementIds:{[t.hit.element.id]:!0}},this.scene.getNonDeletedElements(),p,this)):u=!1);let m=Dl(d,l);this.setState(p=>{let f={...u&&p.selectedElementIds,...m.reduce((g,x)=>(g[x.id]=!0,g),{})};return t.hit.element&&(m.length?delete f[t.hit.element.id]:f[t.hit.element.id]=!0),p=u?p:{...p,selectedGroupIds:{},editingGroupId:null},{...fr({editingGroupId:p.editingGroupId,selectedElementIds:f},this.scene.getNonDeletedElements(),p,this),selectedLinearElement:m.length===1&&me(m[0])?new re(m[0],this.scene):null,showHyperlinkPopup:m.length===1&&(m[0].link||er(m[0]))?"info":!1}})}}}})}handlePointerMoveOverScrollbars(t,r){if(r.scrollbars.isOverHorizontal){let o=t.clientX,n=o-r.lastCoords.x;return this.translateCanvas({scrollX:this.state.scrollX-n/this.state.zoom.value}),r.lastCoords.x=o,!0}if(r.scrollbars.isOverVertical){let o=t.clientY,n=o-r.lastCoords.y;return this.translateCanvas({scrollY:this.state.scrollY-n/this.state.zoom.value}),r.lastCoords.y=o,!0}return!1}onPointerUpFromPointerDownHandler(t){return xt(r=>{this.removePointer(r),t.eventListeners.onMove&&t.eventListeners.onMove.flush();let{draggingElement:o,resizingElement:n,multiElement:i,activeTool:a,isResizing:s,isRotating:c}=this.state;if(this.setState(m=>({isResizing:!1,isRotating:!1,resizingElement:null,selectionElement:null,frameToHighlight:null,elementsToHighlight:null,cursorButton:"up",editingElement:i||ee(this.state.editingElement)?this.state.editingElement:null,snapLines:bp(m.snapLines,[]),originSnapOffset:null})),jo.setReferenceSnapPoints(null),jo.setVisibleGaps(null),this.savePointer(r.clientX,r.clientY,"up"),this.setState({selectedElementsAreBeingDragged:!1}),this.state.editingLinearElement)if(!t.boxSelection.hasOccurred&&t.hit?.element?.id!==this.state.editingLinearElement.elementId)this.actionManager.executeAction(Ho);else{let m=re.handlePointerUp(r,this.state.editingLinearElement,this.state);m!==this.state.editingLinearElement&&this.setState({editingLinearElement:m,suggestedBindings:[]})}else if(this.state.selectedLinearElement)if(t.hit?.element?.id!==this.state.selectedLinearElement.elementId)this.scene.getSelectedElements(this.state).length>1&&this.setState({selectedLinearElement:null});else{let m=re.handlePointerUp(r,this.state.selectedLinearElement,this.state),{startBindingElement:p,endBindingElement:f}=m,g=this.scene.getElement(m.elementId);Ut(g)&&Pi(g,p,f),m!==this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...m,selectedPointsIndices:null},suggestedBindings:[]})}if(this.missingPointerEventCleanupEmitter.clear(),window.removeEventListener("pointermove",t.eventListeners.onMove),window.removeEventListener("pointerup",t.eventListeners.onUp),window.removeEventListener("keydown",t.eventListeners.onKeyDown),window.removeEventListener("keyup",t.eventListeners.onKeyUp),this.state.pendingImageElementId&&this.setState({pendingImageElementId:null}),this.onPointerUpEmitter.trigger(this.state.activeTool,t,r),o?.type==="freedraw"){let m=ot(r,this.state),p=o.points,f=m.x-o.x,g=m.y-o.y;f===p[0][0]&&g===p[0][1]&&(g+=1e-4,f+=1e-4);let x=o.simulatePressure?[]:[...o.pressures,r.pressure];Y(o,{points:[...p,[f,g]],pressures:x,lastCommittedPoint:[f,g]}),this.actionManager.executeAction(Ho);return}if(ko(o)){let m=o;try{this.initializeImageDimensions(m),this.setState({selectedElementIds:Ye({[m.id]:!0},this.state)},()=>{this.actionManager.executeAction(Ho)})}catch(p){console.error(p),this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().filter(f=>f.id!==m.id)),this.actionManager.executeAction(Ho)}return}if(me(o)){o.points.length>1&&this.history.resumeRecording();let m=ot(r,this.state);!t.drag.hasOccurred&&o&&!i?(Y(o,{points:[...o.points,[m.x-o.x,m.y-o.y]]}),this.setState({multiElement:o,editingElement:this.state.draggingElement})):t.drag.hasOccurred&&!i&&(ri(this.state)&&Ut(o,!1)&&gu(o,this.state,this.scene,m),this.setState({suggestedBindings:[],startBoundElement:null}),a.locked?this.setState(p=>({draggingElement:null})):(so(this.interactiveCanvas),this.setState(p=>({draggingElement:null,activeTool:st(this.state,{type:"selection"}),selectedElementIds:Ye({...p.selectedElementIds,[o.id]:!0},p),selectedLinearElement:new re(o,this.scene)}))));return}if(a.type!=="selection"&&o&&zo(o)){this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().filter(m=>m.id!==o.id)),this.setState({draggingElement:null});return}if(o){if(t.drag.hasOccurred){let m=ot(r,this.state);if(this.state.selectedLinearElement&&this.state.selectedLinearElement.isDragging){let p=this.scene.getElement(this.state.selectedLinearElement.elementId);if(p?.frameId){let f=Cr(p);f&&p&&(Xa(p,f)||(Y(p,{groupIds:[]}),this.scene.replaceAllElements(Bc(this.scene.getElementsIncludingDeleted(),[p],this.state))))}}else{let p=this.getTopLayerFrameAtSceneCoords(m),f=this.scene.getSelectedElements(this.state),g=this.scene.getElementsIncludingDeleted(),x=y=>{if(y.length>0){for(let w of y){let T=w.groupIds.indexOf(this.state.editingGroupId);Y(w,{groupIds:w.groupIds.slice(0,T)},!1)}g.forEach(w=>{w.groupIds.length&&Et(g,w.groupIds[w.groupIds.length-1]).length<2&&Y(w,{groupIds:[]},!1)}),this.setState({editingGroupId:null})}};if(p&&!this.state.selectedElementIds[p.id]){let y=f.filter(w=>w.frameId!==p.id&&el(w,g,this.state));this.state.editingGroupId&&x(y),g=Vg(g,y,p)}else if(!p&&this.state.editingGroupId){let y=f.filter(w=>w.frameId&&!el(w,g,this.state));x(y)}g=ti(g,this.state,this),this.scene.replaceAllElements(g)}}if(le(o)){let m=Q_(this.scene.getElementsIncludingDeleted(),o);this.scene.replaceAllElements(Vg(this.scene.getElementsIncludingDeleted(),m,o))}Y(o,Su(o))}if(n&&this.history.resumeRecording(),n&&zo(n)&&this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().filter(m=>m.id!==n.id)),t.resize.isResizing){let m=ti(this.scene.getElementsIncludingDeleted(),this.state,this),p=this.scene.getSelectedElements(this.state).filter(f=>le(f));for(let f of p)m=cg(m,Fc(this.scene.getElementsIncludingDeleted(),f,this.state),f,this.state);this.scene.replaceAllElements(m)}let l=t.hit.element;this.state.selectedLinearElement?.elementId!==l?.id&&me(l)&&this.scene.getSelectedElements(this.state).length===1&&this.setState({selectedLinearElement:new re(l,this.scene)});let d=this.lastPointerDownEvent,u=this.lastPointerUpEvent||this.lastPointerMoveEvent;if(Io(this.state)&&d&&u){if(kt(d.clientX,d.clientY,u.clientX,u.clientY)===0){let p=ot({clientX:u.clientX,clientY:u.clientY},this.state);this.getElementsAtPosition(p.x,p.y).forEach(g=>t.elementIdsToErase[g.id]={erase:!0,opacity:g.opacity})}this.eraseElements(t);return}else Object.keys(t.elementIdsToErase).length&&this.restoreReadyToEraseElements(t);if(l&&!t.drag.hasOccurred&&!t.hit.wasAddedToSelection&&(!this.state.editingLinearElement||!t.boxSelection.hasOccurred)&&(r.shiftKey&&!this.state.editingLinearElement?this.state.selectedElementIds[l.id]?Nl(this.state,l)?this.setState(m=>{let p={...m.selectedElementIds};for(let f of l.groupIds.flatMap(g=>Et(this.scene.getNonDeletedElements(),g)))delete p[f.id];return{selectedGroupIds:{...m.selectedElementIds,...l.groupIds.map(f=>({[f]:!1})).reduce((f,g)=>({...f,...g}),{})},selectedElementIds:Ye(p,m)}}):this.state.selectedLinearElement?.isDragging||this.setState(m=>{let p={...m.selectedElementIds};delete p[l.id];let f=Se(this.scene.getNonDeletedElements(),{selectedElementIds:p});return{...fr({editingGroupId:m.editingGroupId,selectedElementIds:p},this.scene.getNonDeletedElements(),m,this),selectedLinearElement:f.length===1&&me(f[0])?new re(f[0],this.scene):m.selectedLinearElement}}):l.frameId&&this.state.selectedElementIds[l.frameId]?this.setState(m=>{let p={...m.selectedElementIds,[l.id]:!0};return delete p[l.frameId],(this.scene.getElement(l.frameId)?.groupIds??[]).flatMap(f=>Et(this.scene.getNonDeletedElements(),f)).forEach(f=>{delete p[f.id]}),{...fr({editingGroupId:m.editingGroupId,selectedElementIds:p},this.scene.getNonDeletedElements(),m,this),showHyperlinkPopup:l.link||er(l)?"info":!1}}):this.setState(m=>({selectedElementIds:Ye({...m.selectedElementIds,[l.id]:!0},m)})):this.setState(m=>({...fr({editingGroupId:m.editingGroupId,selectedElementIds:{[l.id]:!0}},this.scene.getNonDeletedElements(),m,this),selectedLinearElement:me(l)&&m.selectedLinearElement?.elementId!==l.id?new re(l,this.scene):m.selectedLinearElement}))),!t.drag.hasOccurred&&!this.state.isResizing&&(l&&lm(l,this.state,this.frameNameBoundsCache,t.origin.x,t.origin.y)||!l&&t.hit.hasHitCommonBoundingBoxOfSelectedElements)){this.state.editingLinearElement?this.setState({editingLinearElement:null}):this.setState({selectedElementIds:Ye({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null});return}if(!a.locked&&a.type!=="freedraw"&&o&&o.type!=="selection"&&this.setState(m=>({selectedElementIds:Ye({...m.selectedElementIds,[o.id]:!0},m),showHyperlinkPopup:er(o)&&!o.link?"editor":m.showHyperlinkPopup})),(a.type!=="selection"||Je(this.scene.getNonDeletedElements(),this.state))&&this.history.resumeRecording(),(t.drag.hasOccurred||s||c)&&(ri(this.state)?Gu:Uu)(this.scene.getSelectedElements(this.state)),a.type==="laser"){this.laserPathManager.endPath();return}!a.locked&&a.type!=="freedraw"?(so(this.interactiveCanvas),this.setState({draggingElement:null,suggestedBindings:[],activeTool:st(this.state,{type:"selection"})})):this.setState({draggingElement:null,suggestedBindings:[]}),l&&this.lastPointerUpEvent&&this.lastPointerDownEvent&&this.lastPointerUpEvent.timeStamp-this.lastPointerDownEvent.timeStamp<300&&Ze.pointers.size<=1&&Or(l)&&this.isIframeLikeElementCenter(l,this.lastPointerUpEvent,t.origin.x,t.origin.y)&&this.handleEmbeddableCenterClick(l)})}restoreReadyToEraseElements=t=>{let r=this.scene.getElementsIncludingDeleted().map(o=>t.elementIdsToErase[o.id]&&t.elementIdsToErase[o.id].erase?de(o,{opacity:t.elementIdsToErase[o.id].opacity}):$e(o)&&t.elementIdsToErase[o.containerId]&&t.elementIdsToErase[o.containerId].erase?de(o,{opacity:t.elementIdsToErase[o.containerId].opacity}):o.frameId&&t.elementIdsToErase[o.frameId]&&t.elementIdsToErase[o.frameId].erase?de(o,{opacity:t.elementIdsToErase[o.frameId].opacity}):o);this.scene.replaceAllElements(r)};eraseElements=t=>{let r=this.scene.getElementsIncludingDeleted().map(o=>t.elementIdsToErase[o.id]&&t.elementIdsToErase[o.id].erase?de(o,{isDeleted:!0}):$e(o)&&t.elementIdsToErase[o.containerId]&&t.elementIdsToErase[o.containerId].erase?de(o,{isDeleted:!0}):o.frameId&&t.elementIdsToErase[o.frameId]&&t.elementIdsToErase[o.frameId].erase?de(o,{isDeleted:!0}):o);this.history.resumeRecording(),this.scene.replaceAllElements(r)};initializeImage=async({imageFile:t,imageElement:r,showCursorImagePreview:o=!1})=>{if(!Ka(t))throw new Error(E("errors.unsupportedFileType"));let n=t.type;if(Qe(this.interactiveCanvas,"wait"),n===ae.svg)try{t=YE(await Z4(await t.text()),t.name)}catch(l){throw console.warn(l),new Error(E("errors.svgImageInsertError"))}let i=await(this.props.generateIdForFile?.(t)||X_(t));if(!i)throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."),new Error(E("errors.imageInsertError"));if(!this.files[i]?.dataURL){try{t=await ku(t,{maxWidthOrHeight:u2})}catch(l){console.error("Error trying to resizing image file on insertion",l)}if(t.size>eb)throw new Error(E("errors.fileTooBig",{maxSize:`${Math.trunc(eb/1024/1024)}MB`}))}if(o){let l=this.files[i]?.dataURL,d=l&&j_(l);this.setImagePreviewCursor(d||t)}let s=this.files[i]?.dataURL||await Ug(t),c=Y(r,{fileId:i},!1);return new Promise(async(l,d)=>{try{this.files={...this.files,[i]:{mimeType:n,id:i,dataURL:s,created:Date.now(),lastRetrieved:Date.now()}};let u=this.imageCache.get(i);u||(this.addNewImagesToImageCache(),await this.updateImageCache([c])),u?.image instanceof Promise&&await u.image,this.state.pendingImageElementId!==c.id&&this.state.draggingElement?.id!==c.id&&this.initializeImageDimensions(c,!0),l(c)}catch(u){console.error(u),d(new Error(E("errors.imageInsertError")))}finally{o||so(this.interactiveCanvas)}})};insertImageElement=async(t,r,o)=>{if(!this.isToolSupported("image")){this.setState({errorMessage:E("errors.imageToolNotSupported")});return}this.scene.addNewElement(t);try{return await this.initializeImage({imageFile:r,imageElement:t,showCursorImagePreview:o})}catch(n){return Y(t,{isDeleted:!0}),this.actionManager.executeAction(Ho),this.setState({errorMessage:n.message||E("errors.imageInsertError")}),null}};setImagePreviewCursor=async t=>{let o=await ku(t,{maxWidthOrHeight:96}),n=await Ug(o);if(t.type===ae.svg){let i=await Gx(n),a=Math.min(i.height,96),s=a*(i.width/i.height);s>96&&(s=96,a=s*(i.height/i.width));let c=document.createElement("canvas");c.height=a,c.width=s,c.getContext("2d").drawImage(i,0,0,s,a),n=c.toDataURL(ae.svg)}this.state.pendingImageElementId&&Qe(this.interactiveCanvas,`url(${n}) 4 4, auto`)};onImageAction=async({insertOnCanvasDirectly:t})=>{try{let r=this.state.width/2+this.state.offsetLeft,o=this.state.height/2+this.state.offsetTop,{x:n,y:i}=ot({clientX:r,clientY:o},this.state),a=await yc({description:"Image",extensions:Object.keys(kd)}),s=this.createImageElement({sceneX:n,sceneY:i,addToFrameUnderCursor:!1});t?(this.insertImageElement(s,a),this.initializeImageDimensions(s),this.setState({selectedElementIds:Ye({[s.id]:!0},this.state)},()=>{this.actionManager.executeAction(Ho)})):this.setState({pendingImageElementId:s.id},()=>{this.insertImageElement(s,a,!0)})}catch(r){r.name!=="AbortError"?console.error(r):console.warn(r),this.setState({pendingImageElementId:null,editingElement:null,activeTool:st(this.state,{type:"selection"})},()=>{this.actionManager.executeAction(Ho)})}};initializeImageDimensions=(t,r=!1)=>{let o=Zr(t)&&this.imageCache.get(t.fileId)?.image;if(!o||o instanceof Promise){if(t.width<pi/this.state.zoom.value&&t.height<pi/this.state.zoom.value){let n=100/this.state.zoom.value;Y(t,{x:t.x-n/2,y:t.y-n/2,width:n,height:n})}return}if(r||t.width<pi/this.state.zoom.value&&t.height<pi/this.state.zoom.value){let n=Math.max(this.state.height-120,160),i=Math.min(n,Math.floor(this.state.height*.5)/this.state.zoom.value),a=Math.min(o.naturalHeight,i),s=a*(o.naturalWidth/o.naturalHeight),c=t.x+t.width/2-s/2,l=t.y+t.height/2-a/2;Y(t,{x:c,y:l,width:s,height:a})}};updateImageCache=async(t,r=this.files)=>{let{updatedFiles:o,erroredFiles:n}=await og({imageCache:this.imageCache,fileIds:t.map(i=>i.fileId),files:r});if(o.size||n.size)for(let i of t)o.has(i.fileId)&&Re.delete(i);return n.size&&this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map(i=>Zr(i)&&n.has(i.fileId)?de(i,{status:"error"}):i)),{updatedFiles:o,erroredFiles:n}};addNewImagesToImageCache=async(t=ng(this.scene.getNonDeletedElements()),r=this.files)=>{let o=t.filter(n=>!n.isDeleted&&!this.imageCache.has(n.fileId));if(o.length){let{updatedFiles:n}=await this.updateImageCache(o,r);n.size&&this.scene.informMutation()}};scheduleImageRefresh=(0,eA.default)(()=>{this.addNewImagesToImageCache()},t2);updateBindingEnabledOnPointerMove=t=>{let r=V_(t);this.state.isBindingEnabled!==r&&this.setState({isBindingEnabled:r})};maybeSuggestBindingAtCursor=t=>{let r=ai(t,this.scene);this.setState({suggestedBindings:r!=null?[r]:[]})};maybeSuggestBindingsForLinearElementAtCoords=(t,r,o)=>{if(!r.length)return;let n=r.reduce((i,a)=>{let s=ai(a,this.scene);return s!=null&&!jE(t,o?.id,s)&&i.push(s),i},[]);this.setState({suggestedBindings:n})};maybeSuggestBindingForAll(t){if(t.length>50)return;let r=Y_(t);this.setState({suggestedBindings:r})}clearSelection(t){this.setState(r=>({selectedElementIds:Ye({},r),activeEmbeddable:null,selectedGroupIds:{},editingGroupId:r.editingGroupId&&t!=null&&Es(t,r.editingGroupId)?r.editingGroupId:null})),this.setState({selectedElementIds:Ye({},this.state),activeEmbeddable:null,previousSelectedElementIds:this.state.selectedElementIds})}handleInteractiveCanvasRef=t=>{t!==null?(this.interactiveCanvas=t,this.interactiveCanvas.addEventListener("wheel",this.handleWheel),this.interactiveCanvas.addEventListener("touchstart",this.onTouchStart),this.interactiveCanvas.addEventListener("touchend",this.onTouchEnd)):(this.interactiveCanvas?.removeEventListener("wheel",this.handleWheel),this.interactiveCanvas?.removeEventListener("touchstart",this.onTouchStart),this.interactiveCanvas?.removeEventListener("touchend",this.onTouchEnd))};handleAppOnDrop=async t=>{let{file:r,fileHandle:o}=await J_(t),{x:n,y:i}=ot(t,this.state);try{if(Ka(r)&&this.isToolSupported("image")){if(r?.type===ae.png||r?.type===ae.svg)try{let c=await Tc(r,this.state,this.scene.getElementsIncludingDeleted(),o);this.syncActionResult({...c,appState:{...c.appState||this.state,isLoading:!1},replaceFiles:!0,commitToHistory:!0});return}catch(c){if(c.name!=="EncodingError")throw c}let s=this.createImageElement({sceneX:n,sceneY:i});this.insertImageElement(s,r),this.initializeImageDimensions(s),this.setState({selectedElementIds:Ye({[s.id]:!0},this.state)});return}}catch(s){return this.setState({isLoading:!1,errorMessage:s.message})}let a=t.dataTransfer.getData(ae.excalidrawlib);if(a&&typeof a=="string"){try{let s=qE(a);this.addElementsFromPasteOrLibrary({elements:hh(s),position:t,files:null})}catch(s){this.setState({errorMessage:s.message})}return}if(r&&await this.loadFileToCanvas(r,o),t.dataTransfer?.types?.includes("text/plain")){let s=t.dataTransfer?.getData("text");if(s&&Bl(s,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(s)||Ci(s)?.type==="video")){let c=this.insertEmbeddableElement({sceneX:n,sceneY:i,link:Hr(s)});c&&this.setState({selectedElementIds:{[c.id]:!0}})}}};loadFileToCanvas=async(t,r)=>{t=await Cu(t);try{let o=await eg(t,this.state,this.scene.getElementsIncludingDeleted(),r);o.type===ae.excalidraw?(this.setState({isLoading:!0}),this.syncActionResult({...o.data,appState:{...o.data.appState||this.state,isLoading:!1},replaceFiles:!0,commitToHistory:!0})):o.type===ae.excalidrawlib&&await this.library.updateLibrary({libraryItems:t,merge:!0,openLibraryMenu:!0}).catch(n=>{console.error(n),this.setState({errorMessage:E("errors.importLibraryError")})})}catch(o){if(o instanceof xn&&o.code==="IMAGE_NOT_CONTAINS_SCENE_DATA"&&!this.isToolSupported("image")){this.setState({isLoading:!1,errorMessage:E("errors.imageToolNotSupported")});return}this.setState({isLoading:!1,errorMessage:o.message})}};handleCanvasContextMenu=t=>{if(t.preventDefault(),("pointerType"in t.nativeEvent&&t.nativeEvent.pointerType==="touch"||"pointerType"in t.nativeEvent&&t.nativeEvent.pointerType==="pen"&&t.button!==ra.SECONDARY)&&this.state.activeTool.type!=="selection")return;let{x:r,y:o}=ot(t,this.state),n=this.getElementAtPosition(r,o,{preferSelected:!0,includeLockedElements:!0}),i=this.scene.getSelectedElements(this.state),a=this.isHittingCommonBoundingBoxOfSelectedElements({x:r,y:o},i),s=n||a?"element":"canvas",c=this.excalidrawContainerRef.current,{top:l,left:d}=c.getBoundingClientRect(),u=t.clientX-d,m=t.clientY-l;Ae("contextMenu","openContextMenu",s),this.setState({...n&&!this.state.selectedElementIds[n.id]?{...this.state,...fr({editingGroupId:this.state.editingGroupId,selectedElementIds:{[n.id]:!0}},this.scene.getNonDeletedElements(),this.state,this),selectedLinearElement:me(n)?new re(n,this.scene):null}:this.state,showHyperlinkPopup:!1},()=>{this.setState({contextMenu:{top:m,left:u,items:this.getContextMenuItems(s)}})})};maybeDragNewGenericElement=(t,r)=>{let o=this.state.draggingElement,n=t.lastCoords;if(o)if(o.type==="selection"&&this.state.activeTool.type!=="eraser")Xg(o,this.state.activeTool.type,t.origin.x,t.origin.y,n.x,n.y,Qt(t.origin.x,n.x),Qt(t.origin.y,n.y),Hl(r),qp(r));else{let[i,a]=Zt(n.x,n.y,r[k.CTRL_OR_CMD]?null:this.state.gridSize),s=Zr(o)&&this.imageCache.get(o.fileId)?.image,c=s&&!(s instanceof Promise)?s.width/s.height:null;this.maybeCacheReferenceSnapPoints(r,[o]);let{snapOffset:l,snapLines:d}=y_(o,this.state,r,{x:t.originInGrid.x+(this.state.originSnapOffset?.x??0),y:t.originInGrid.y+(this.state.originSnapOffset?.y??0)},{x:i-t.originInGrid.x,y:a-t.originInGrid.y});i+=l.x,a+=l.y,this.setState({snapLines:d}),Xg(o,this.state.activeTool.type,t.originInGrid.x,t.originInGrid.y,i,a,Qt(t.originInGrid.x,i),Qt(t.originInGrid.y,a),ko(o)?!Hl(r):Hl(r),qp(r),c,this.state.originSnapOffset),this.maybeSuggestBindingForAll([o]),(this.state.activeTool.type===Ft.frame||this.state.activeTool.type===Ft.magicframe)&&this.setState({elementsToHighlight:Fc(this.scene.getNonDeletedElements(),o,this.state)})}};maybeHandleResize=(t,r)=>{let o=this.scene.getSelectedElements(this.state),n=o.filter(d=>le(d)),i=t.resize.handleType;if(n.length>0&&i==="rotation")return!1;this.setState({isResizing:i&&i!=="rotation",isRotating:i==="rotation",activeEmbeddable:null});let a=t.lastCoords,[s,c]=Zt(a.x-t.resize.offset.x,a.y-t.resize.offset.y,r[k.CTRL_OR_CMD]?null:this.state.gridSize),l=new Map;if(n.forEach(d=>{po(this.scene.getNonDeletedElements(),d.id).forEach(m=>{l.set(d.id+m.id,{x:m.x-d.x,y:m.y-d.y})})}),!this.state.selectedElementsAreBeingDragged){let[d,u]=Zt(a.x,a.y,r[k.CTRL_OR_CMD]?null:this.state.gridSize),m={x:d-t.originInGrid.x,y:u-t.originInGrid.y},p=[...t.originalElements.values()];this.maybeCacheReferenceSnapPoints(r,o);let{snapOffset:f,snapLines:g}=E_(o,Se(p,this.state),this.state,r,m,i);s+=f.x,c+=f.y,this.setState({snapLines:g})}if(oE(t,i,o,t.resize.arrowDirection,Ts(r),qp(r),o.length===1&&ko(o[0])?!Hl(r):Hl(r),s,c,t.resize.center.x,t.resize.center.y,this.state)){this.maybeSuggestBindingForAll(o);let d=new Set;return n.forEach(u=>{Fc(this.scene.getNonDeletedElements(),u,this.state).forEach(m=>d.add(m))}),this.setState({elementsToHighlight:[...d]}),!0}return!1};getContextMenuItems=t=>{let r=[];return r.push(hg,fg),t==="canvas"?this.state.viewModeEnabled?[...r,bg,Uc,ME,$a]:[dE,Ur,hg,fg,gg,Ur,jb,xk,Ur,bg,uE,Uc,ME,$a]:(r.push(gg),this.state.viewModeEnabled?[Gc,...r]:[pg,Gc,dE,d_,u_,Ur,...r,Ur,Zx,Xx,Ur,qx,pE,fE,gk,Jx,Ur,tE,Ur,Yb,Kb,Zb,Xb,Ur,lE,cE,Ur,gE,bE,qb,hE,Ur,eu])};handleWheel=xt(t=>{if(t.preventDefault(),im)return;let{deltaX:r,deltaY:o}=t;if(t.metaKey||t.ctrlKey){let n=Math.sign(o),i=ss*100,a=Math.abs(o),s=o;a>i&&(s=i*n);let c=this.state.zoom.value-s/100;c+=Math.log10(Math.max(1,this.state.zoom.value))*-n*Math.min(1,a/20),this.translateCanvas(l=>({...yi({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:Yn(c)},l),shouldCacheIgnoreZoom:!0})),this.resetShouldCacheIgnoreZoomDebounced();return}if(t.shiftKey){this.translateCanvas(({zoom:n,scrollX:i})=>({scrollX:i-(o||r)/n.value}));return}this.translateCanvas(({zoom:n,scrollX:i,scrollY:a})=>({scrollX:i-r/n.value,scrollY:a-o/n.value}))});getTextWysiwygSnappedToCenterPosition(t,r,o,n){if(n){let i=n.x+n.width/2,a=n.y+n.height/2,s=Gg(n,o);if(s&&(i=s.x,a=s.y),Math.hypot(t-i,r-a)<Qv){let{x:d,y:u}=nr({sceneX:i,sceneY:a},o);return{viewportX:d,viewportY:u,elementCenterX:i,elementCenterY:a}}}}savePointer=(t,r,o)=>{if(!t||!r)return;let{x:n,y:i}=ot({clientX:t,clientY:r},this.state);isNaN(n)||isNaN(i);let a={x:n,y:i,tool:this.state.activeTool.type==="laser"?"laser":"pointer"};this.props.onPointerUpdate?.({pointer:a,button:o,pointersMap:Ze.pointers})};resetShouldCacheIgnoreZoomDebounced=cs(()=>{this.unmounted||this.setState({shouldCacheIgnoreZoom:!1})},300);updateDOMRect=t=>{if(this.excalidrawContainerRef?.current){let r=this.excalidrawContainerRef.current,{width:o,height:n,left:i,top:a}=r.getBoundingClientRect(),{width:s,height:c,offsetTop:l,offsetLeft:d}=this.state;if(o===s&&n===c&&i===d&&a===l){t&&t();return}this.setState({width:o,height:n,offsetLeft:i,offsetTop:a},()=>{t&&t()})}};refresh=()=>{this.setState({...this.getCanvasOffsets()})};getCanvasOffsets(){if(this.excalidrawContainerRef?.current){let t=this.excalidrawContainerRef.current,{left:r,top:o}=t.getBoundingClientRect();return{offsetLeft:r,offsetTop:o}}return{offsetLeft:0,offsetTop:0}}async updateLanguage(){let t=Tl.find(r=>r.code===this.props.langCode)||Bn;await cp(t),this.setAppState({})}};(v.MODE===q0.TEST||v.DEV)&&(window.h=window.h||{},Object.defineProperties(window.h,{elements:{configurable:!0,get(){return this.app?.scene.getElementsIncludingDeleted()},set(e){return this.app?.scene.replaceAllElements(e)}}}));var W4=ZE;var qo=S(_(),1),be=Cn.default.forwardRef((e,t)=>{let{id:r}=ar(),o=Cn.default.useRef(null);Cn.default.useImperativeHandle(t,()=>o.current);let n=`ToolIcon_size_${e.size}`,[i,a]=(0,Cn.useState)(!1),s=(0,Cn.useRef)(!0),c=async d=>{let u="onClick"in e&&e.onClick?.(d);if(u&&"then"in u)try{a(!0),await u}catch(m){if(m instanceof Pa)console.warn(m);else throw m}finally{s.current&&a(!1)}};(0,Cn.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let l=(0,Cn.useRef)(null);if(e.type==="button"||e.type==="icon"||e.type==="submit"){let d=e.type==="icon"?"button":e.type;return(0,qo.jsxs)("button",{className:G("ToolIcon_type_button",n,e.className,e.visible&&!e.hidden?"ToolIcon_type_button--show":"ToolIcon_type_button--hide",{ToolIcon:!e.hidden,"ToolIcon--selected":e.selected,"ToolIcon--plain":e.type==="icon"}),style:e.style,"data-testid":e["data-testid"],hidden:e.hidden,title:e.title,"aria-label":e["aria-label"],type:d,onClick:c,ref:o,disabled:i||e.isLoading,children:[(e.icon||e.label)&&(0,qo.jsxs)("div",{className:"ToolIcon__icon","aria-hidden":"true",children:[e.icon||e.label,e.keyBindingLabel&&(0,qo.jsx)("span",{className:"ToolIcon__keybinding",children:e.keyBindingLabel}),e.isLoading&&(0,qo.jsx)(zr,{})]}),e.showAriaLabel&&(0,qo.jsxs)("div",{className:"ToolIcon__label",children:[e["aria-label"]," ",i&&(0,qo.jsx)(zr,{})]}),e.children]})}return(0,qo.jsxs)("label",{className:G("ToolIcon",e.className),title:e.title,onPointerDown:d=>{l.current=d.pointerType||null,e.onPointerDown?.({pointerType:d.pointerType||null})},onPointerUp:()=>{requestAnimationFrame(()=>{l.current=null})},children:[(0,qo.jsx)("input",{className:`ToolIcon_type_radio ${n}`,type:"radio",name:e.name,"aria-label":e["aria-label"],"aria-keyshortcuts":e["aria-keyshortcuts"],"data-testid":e["data-testid"],id:`${r}-${e.id}`,onChange:()=>{e.onChange?.({pointerType:l.current})},checked:e.checked,ref:o}),(0,qo.jsxs)("div",{className:"ToolIcon__icon",children:[e.icon,e.keyBindingLabel&&(0,qo.jsx)("span",{className:"ToolIcon__keybinding",children:e.keyBindingLabel})]})]})});be.defaultProps={visible:!0,className:"",size:"medium"};be.displayName="ToolButton";var In=S(W(),1);var si=S(_(),1),ly=320,iA=85,ay=5,tF=42,rF=500,cy=document.createElement("img");cy.src=`data:${ae.svg}, ${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1971c2" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>')}`;var sy=!1,jg=new Map,G_=({element:e,setAppState:t,onLinkOpen:r,setToast:o})=>{let n=Kc(),i=Oa(),a=e.link||"",[s,c]=(0,In.useState)(a),l=(0,In.useRef)(null),d=n.showHyperlinkPopup==="editor",u=(0,In.useCallback)(()=>{if(!l.current)return;let x=Hr(l.current.value)||null;if(!e.link&&x&&Ae("hyperlink","create"),er(e)){if(n.activeEmbeddable?.element===e&&t({activeEmbeddable:null}),!x){Y(e,{validated:!1,link:null});return}if(!Bl(x,i.validateEmbeddable))x&&o({message:E("toast.unableToEmbed"),closable:!0}),e.link&&jg.set(e.id,e.link),Y(e,{validated:!1,link:x}),Re.delete(e);else{let{width:y,height:w}=e,T=Ci(x);T?.warning&&o({message:T.warning,closable:!0});let C=T?T.intrinsicSize.w/T.intrinsicSize.h:1,I=jg.get(e.id)!==e.link;Y(e,{...I?{width:T?.type==="video"?y>w?y:w*C:y,height:T?.type==="video"&&y>w?y/C:w}:{},validated:!0,link:x}),Re.delete(e),jg.has(e.id)&&jg.delete(e.id)}}else Y(e,{link:x})},[e,o,i.validateEmbeddable,n.activeEmbeddable,t]);(0,In.useLayoutEffect)(()=>()=>{u()},[u]),(0,In.useEffect)(()=>{let x=null,y=w=>{if(d)return;x&&clearTimeout(x),nF(e,n,[w.clientX,w.clientY])&&(x=window.setTimeout(()=>{t({showHyperlinkPopup:!1})},rF))};return window.addEventListener("pointermove",y,!1),()=>{window.removeEventListener("pointermove",y,!1),x&&clearTimeout(x)}},[n,e,d,t]);let m=(0,In.useCallback)(()=>{Ae("hyperlink","delete"),Y(e,{link:null}),d&&(l.current.value=""),t({showHyperlinkPopup:!1})},[t,e,d]),p=()=>{Ae("hyperlink","edit","popup-ui"),t({showHyperlinkPopup:"editor"})},{x:f,y:g}=aA(e,n);return n.contextMenu||n.draggingElement||n.resizingElement||n.isRotating||n.openMenu||n.viewModeEnabled?null:(0,si.jsxs)("div",{className:"excalidraw-hyperlinkContainer",style:{top:`${g}px`,left:`${f}px`,width:ly,padding:ay},onClick:()=>{!e.link&&!d&&t({showHyperlinkPopup:"editor"})},children:[d?(0,si.jsx)("input",{className:G("excalidraw-hyperlinkContainer-input"),placeholder:"Type or paste your link here",ref:l,value:s,onChange:x=>c(x.target.value),autoFocus:!0,onKeyDown:x=>{x.stopPropagation(),x[k.CTRL_OR_CMD]&&x.key===k.K&&x.preventDefault(),(x.key===k.ENTER||x.key===k.ESCAPE)&&(u(),t({showHyperlinkPopup:"info"}))}}):e.link?(0,si.jsx)("a",{href:Hr(e.link||""),className:"excalidraw-hyperlinkContainer-link",target:lh(e.link)?"_self":"_blank",onClick:x=>{if(e.link&&r){let y=fp("excalidraw-link",x.nativeEvent);r({...e,link:Hr(e.link)},y),y.defaultPrevented&&x.preventDefault()}},rel:"noopener noreferrer",children:e.link}):(0,si.jsx)("div",{className:"excalidraw-hyperlinkContainer-link",children:E("labels.link.empty")}),(0,si.jsxs)("div",{className:"excalidraw-hyperlinkContainer__buttons",children:[!d&&(0,si.jsx)(be,{type:"button",title:E("buttons.edit"),"aria-label":E("buttons.edit"),label:E("buttons.edit"),onClick:p,className:"excalidraw-hyperlinkContainer--edit",icon:$l}),a&&!er(e)&&(0,si.jsx)(be,{type:"button",title:E("buttons.remove"),"aria-label":E("buttons.remove"),label:E("buttons.remove"),onClick:m,className:"excalidraw-hyperlinkContainer--remove",icon:ba})]})]})},aA=(e,t)=>{let[r,o]=ue(e),{x:n,y:i}=nr({sceneX:r+e.width/2,sceneY:o},t),a=n-t.offsetLeft-ly/2,s=i-t.offsetTop-iA;return{x:a,y:s}},bE=U({name:"hyperlink",perform:(e,t)=>t.showHyperlinkPopup==="editor"?!1:{elements:e,appState:{...t,showHyperlinkPopup:"editor",openMenu:null},commitToHistory:!0},trackEvent:{category:"hyperlink",action:"click"},keyTest:e=>e[k.CTRL_OR_CMD]&&e.key===k.K,contextItemLabel:(e,t)=>nA(e,t),predicate:(e,t)=>Se(e,t).length===1,PanelComponent:({elements:e,appState:t,updateData:r})=>{let o=Se(e,t);return(0,si.jsx)(be,{type:"button",icon:rf,"aria-label":E(nA(e,t)),title:`${er(e[0])?E("labels.link.labelEmbed"):E("labels.link.label")} - ${H("CtrlOrCmd+K")}`,onClick:()=>r(null),selected:o.length===1&&!!o[0].link})}}),nA=(e,t)=>{let r=Se(e,t);return r[0].link?er(r[0])?"labels.link.editEmbed":"labels.link.edit":er(r[0])?"labels.link.createEmbed":"labels.link.create"},qg=([e,t,r,o],n,i)=>{let a=sA,s=a/i.zoom.value,c=a/i.zoom.value,l=a/i.zoom.value,d=(e+r)/2,u=(t+o)/2,m=(a-8)/(2*i.zoom.value),p=4/i.zoom.value,f=r+p-m,g=t-p-l+m,[x,y]=Ie(f+s/2,g+c/2,d,u,n);return[x-s/2,y-c/2,s,c]},XE=(e,t,[r,o])=>{let n=4/t.zoom.value,[i,a,s,c]=ue(e),[l,d,u,m]=qg([i,a,s,c],e.angle,t);return r>l-n&&r<l+n+u&&o>d-n&&o<d+m+n},$g=(e,t,[r,o],n)=>{if(!e.link||t.selectedElementIds[e.id])return!1;let i=4/t.zoom.value;return!n&&t.viewModeEnabled&&um(e,[r,o],i,null)?!0:XE(e,t,[r,o])},dm=null,U_=(e,t)=>{dm&&clearTimeout(dm),dm=window.setTimeout(()=>oF(e,t),i2)},oF=(e,t)=>{if(!e.link)return;let r=uc();r.classList.add("excalidraw-tooltip--visible"),r.style.maxWidth="20rem",r.textContent=e.link;let[o,n,i,a]=ue(e),[s,c,l,d]=qg([o,n,i,a],e.angle,t),u=nr({sceneX:s,sceneY:c},t);$1(r,{left:u.x,top:u.y,width:l,height:d},"top"),Ae("hyperlink","tooltip","link-icon"),sy=!0},W_=()=>{dm&&clearTimeout(dm),sy&&(sy=!1,uc().classList.remove("excalidraw-tooltip--visible"))},nF=(e,t,[r,o])=>{let{x:n,y:i}=ot({clientX:r,clientY:o},t),a=15/t.zoom.value;if(um(e,[n,i],a,null))return!1;let[s,c,l]=ue(e);if(n>=s&&n<=l&&i>=c-iA&&i<=c)return!1;let{x:d,y:u}=aA(e,t);return!(r>=d-a&&r<=d+ly+ay*2+a&&o>=u-a&&o<=u+a+ay*2+tF)};h();var iF="#ff6b6b",aF="#ff0000",lA=1,cA=2,dA=(e,t)=>{if(!t.snapLines.length)return;let r=t.theme==="light"||t.zenModeEnabled?iF:aF,o=(t.zenModeEnabled?lA*1.5:lA)/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY);for(let n of t.snapLines)n.type==="pointer"?(e.lineWidth=o,e.strokeStyle=r,lF(n,e,t)):n.type==="gap"?(e.lineWidth=o,e.strokeStyle=r,cF(n.points[0],n.points[1],n.direction,t,e)):n.type==="points"&&(e.lineWidth=o,e.strokeStyle=r,sF(n,e,t));e.restore()},sF=(e,t,r)=>{if(!r.zenModeEnabled){let o=e.points[0],n=e.points[e.points.length-1];Jo(o,n,t)}for(let o of e.points)uA(o,r,t)},lF=(e,t,r)=>{uA(e.points[0],r,t),r.zenModeEnabled||Jo(e.points[0],e.points[1],t)},uA=([e,t],r,o)=>{o.save();let n=(r.zenModeEnabled?cA*1.5:cA)/r.zoom.value;o.beginPath(),o.moveTo(e-n,t-n),o.lineTo(e+n,t+n),o.moveTo(e+n,t-n),o.lineTo(e-n,t+n),o.stroke(),o.restore()},Jo=(e,t,r)=>{r.beginPath(),r.lineTo(...e),r.lineTo(...t),r.stroke()},cF=(e,t,r,o,n)=>{let i=8/o.zoom.value,a=i/2,s=i/4;if(r==="horizontal"){let c=[(e[0]+t[0])/2,e[1]];o.zenModeEnabled||Jo([e[0],e[1]-i],[e[0],e[1]+i],n),Jo([c[0]-s,c[1]-a],[c[0]-s,c[1]+a],n),Jo([c[0]+s,c[1]-a],[c[0]+s,c[1]+a],n),o.zenModeEnabled||(Jo([t[0],t[1]-i],[t[0],t[1]+i],n),Jo(e,t,n))}else{let c=[e[0],(e[1]+t[1])/2];o.zenModeEnabled||Jo([e[0]-i,e[1]],[e[0]+i,e[1]],n),Jo([c[0]-a,c[1]-s],[c[0]+a,c[1]-s],n),Jo([c[0]-a,c[1]+s],[c[0]+a,c[1]+s],n),o.zenModeEnabled||(Jo([t[0]-i,t[1]],[t[0]+i,t[1]],n),Jo(e,t,n))}};h();(()=>{"use strict";Path2D.prototype.roundRect??=e,globalThis.CanvasRenderingContext2D&&(globalThis.CanvasRenderingContext2D.prototype.roundRect??=e),globalThis.OffscreenCanvasRenderingContext2D&&(globalThis.OffscreenCanvasRenderingContext2D.prototype.roundRect??=e);function e(o,n,i,a,s){if(![o,n,i,a].every(C=>Number.isFinite(C)))return;s=x(s);let c,l,d,u;if(s.length===4)c=w(s[0]),l=w(s[1]),d=w(s[2]),u=w(s[3]);else if(s.length===3)c=w(s[0]),l=w(s[1]),u=w(s[1]),d=w(s[2]);else if(s.length===2)c=w(s[0]),d=w(s[0]),l=w(s[1]),u=w(s[1]);else if(s.length===1)c=w(s[0]),l=w(s[0]),d=w(s[0]),u=w(s[0]);else throw new RangeError(`${t(this)} ${s.length} is not a valid size for radii sequence.`);let m=[c,l,d,u],p=m.find(({x:C,y:I})=>C<0||I<0),f=p?.x<0?p.x:p?.y;if(m.some(({x:C,y:I})=>!Number.isFinite(C)||!Number.isFinite(I)))return;if(p)throw new RangeError(`${t(this)} Radius value ${p} is negative.`);T(m),i<0&&a<0?(this.moveTo(o-c.x,n),this.ellipse(o+i+l.x,n-l.y,l.x,l.y,0,-Math.PI*1.5,-Math.PI),this.ellipse(o+i+d.x,n+a+d.y,d.x,d.y,0,-Math.PI,-Math.PI/2),this.ellipse(o-u.x,n+a+u.y,u.x,u.y,0,-Math.PI/2,0),this.ellipse(o-c.x,n-c.y,c.x,c.y,0,0,-Math.PI/2)):i<0?(this.moveTo(o-c.x,n),this.ellipse(o+i+l.x,n+l.y,l.x,l.y,0,-Math.PI/2,-Math.PI,1),this.ellipse(o+i+d.x,n+a-d.y,d.x,d.y,0,-Math.PI,-Math.PI*1.5,1),this.ellipse(o-u.x,n+a-u.y,u.x,u.y,0,Math.PI/2,0,1),this.ellipse(o-c.x,n+c.y,c.x,c.y,0,0,-Math.PI/2,1)):a<0?(this.moveTo(o+c.x,n),this.ellipse(o+i-l.x,n-l.y,l.x,l.y,0,Math.PI/2,0,1),this.ellipse(o+i-d.x,n+a+d.y,d.x,d.y,0,0,-Math.PI/2,1),this.ellipse(o+u.x,n+a+u.y,u.x,u.y,0,-Math.PI/2,-Math.PI,1),this.ellipse(o+c.x,n-c.y,c.x,c.y,0,-Math.PI,-Math.PI*1.5,1)):(this.moveTo(o+c.x,n),this.ellipse(o+i-l.x,n+l.y,l.x,l.y,0,-Math.PI/2,0),this.ellipse(o+i-d.x,n+a-d.y,d.x,d.y,0,0,Math.PI/2),this.ellipse(o+u.x,n+a-u.y,u.x,u.y,0,Math.PI/2,Math.PI),this.ellipse(o+c.x,n+c.y,c.x,c.y,0,Math.PI,Math.PI*1.5)),this.closePath(),this.moveTo(o,n);function g(C){let{x:I,y:A,z:P,w:L}=C;return{x:I,y:A,z:P,w:L}}function x(C){let I=typeof C;return I==="undefined"||C===null?[0]:I==="function"?[NaN]:I==="object"?typeof C[Symbol.iterator]=="function"?[...C].map(A=>{let P=typeof A;return P==="undefined"||A===null?0:P==="function"?NaN:P==="object"?g(A):y(A)}):[g(C)]:[y(C)]}function y(C){return+C}function w(C){let I=y(C);return Number.isFinite(I)?{x:I,y:I}:Object(C)===C?{x:y(C.x??0),y:y(C.y??0)}:{x:NaN,y:NaN}}function T(C){let[I,A,P,L]=C,D=[Math.abs(i)/(I.x+A.x),Math.abs(a)/(A.y+P.y),Math.abs(i)/(P.x+L.x),Math.abs(a)/(I.y+L.y)],M=Math.min(...D);if(M<=1)for(let R of C)R.x*=M,R.y*=M}}function t(o){return`Failed to execute 'roundRect' on '${r(o)}':`}function r(o){return Object(o)===o&&o instanceof Path2D?"Path2D":o instanceof globalThis?.CanvasRenderingContext2D?"CanvasRenderingContext2D":o instanceof globalThis?.OffscreenCanvasRenderingContext2D?"OffscreenCanvasRenderingContext2D":o?.constructor.name||o}})();var id=2,pm=(e,t,r,o,n,i,a,s,c=!1,l=0)=>{e.save(),e.translate(i,a),e.rotate(s),c&&e.fillRect(t-i,r-a,o,n),l&&e.roundRect?(e.beginPath(),e.roundRect(t-i,r-a,o,n,l),e.stroke(),e.closePath()):e.strokeRect(t-i,r-a,o,n),e.restore()},dF=(e,t,r,o,n,i)=>{e.save(),e.translate(o,n),e.rotate(i),e.beginPath(),e.moveTo(0,r/2),e.lineTo(t/2,0),e.lineTo(0,-r/2),e.lineTo(-t/2,0),e.closePath(),e.stroke(),e.restore()},uF=(e,t,r,o,n,i)=>{e.beginPath(),e.ellipse(o,n,t/2,r/2,i,0,Math.PI*2),e.stroke()},t0=(e,t,r,o,n=!0)=>{e.beginPath(),e.arc(t,r,o,0,Math.PI*2),e.fill(),n&&e.stroke()},mF=(e,t,r,o,n,i,a)=>{let c;(x=>(x.Bold="#cccccc",x.Regular="#e5e5e5"))(c||={});let l=-Math.round(n.value/t)*t+r%t,d=-Math.round(n.value/t)*t+o%t,u=Math.min(1/n.value,1),m=1/n.value,p=[u*3,m+(u+m)];e.save(),e.lineWidth=u;for(let f=l;f<l+i+t*2;f+=t){let g=Math.round(f-r)%(5*t)===0;e.beginPath(),e.setLineDash(g?[]:p),e.strokeStyle=g?"#cccccc":"#e5e5e5",e.moveTo(f,d-t),e.lineTo(f,d+a+t*2),e.stroke()}for(let f=d;f<d+a+t*2;f+=t){let g=Math.round(f-o)%(5*t)===0;e.beginPath(),e.setLineDash(g?[]:p),e.strokeStyle=g?"#cccccc":"#e5e5e5",e.moveTo(l-t,f),e.lineTo(l+i+t*2,f),e.stroke()}e.restore()},Jg=(e,t,r,o,n,i=!1)=>{e.strokeStyle="#5e5ad8",e.setLineDash([]),e.fillStyle="rgba(255, 255, 255, 0.9)",n?e.fillStyle="rgba(134, 131, 226, 0.9)":i&&(e.fillStyle="rgba(177, 151, 252, 0.7)"),t0(e,r[0],r[1],o/t.zoom.value,!i)},dy=(e,t,r)=>{if(!t.selectedLinearElement)return;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=1/t.zoom.value;let o=re.getPointsGlobalCoordinates(r),{POINT_HANDLE_SIZE:n}=re,i=t.editingLinearElement?n:n/2;o.forEach((s,c)=>{let l=!!t.editingLinearElement?.selectedPointsIndices?.includes(c);Jg(e,t,s,i,l)}),re.getEditorMidPoints(r,t).filter(s=>s!==null).forEach(s=>{t?.selectedLinearElement?.segmentMidPointHoveredCoords&&re.arePointsEqual(s,t.selectedLinearElement.segmentMidPointHoveredCoords)?t.editingLinearElement?(Jg(e,t,s,i,!1),uy(s,e,t)):(uy(s,e,t),Jg(e,t,s,i,!1)):(t.editingLinearElement||o.length===2)&&Jg(e,t,s,n/2,!1,!0)}),e.restore()},uy=(e,t,r)=>{t.fillStyle="rgba(105, 101, 219, 0.4)",t0(t,e[0],e[1],re.POINT_HANDLE_SIZE/r.zoom.value,!1)},pF=(e,t)=>{let{elementId:r,hoverPointIndex:o}=t.selectedLinearElement;if(t.editingLinearElement?.selectedPointsIndices?.includes(o))return;let n=re.getElement(r);if(!n)return;let i=re.getPointAtIndexGlobalCoordinates(n,o);e.save(),e.translate(t.scrollX,t.scrollY),uy(i,e,t),e.restore()},mA=(e,t,r,o)=>{t.translate(e.x+o.scrollX,e.y+o.scrollY),t.beginPath(),t.roundRect?t.roundRect(0,0,e.width,e.height,ut.radius/o.zoom.value):t.rect(0,0,e.width,e.height),t.clip(),t.translate(-(e.x+o.scrollX),-(e.y+o.scrollY))},hA=(e,t)=>[e.width/t,e.height/t],gA=({canvas:e,scale:t,normalizedWidth:r,normalizedHeight:o,theme:n,isExporting:i,viewBackgroundColor:a})=>{let s=e.getContext("2d");return s.setTransform(1,0,0,1,0,0),s.scale(t,t),i&&n==="dark"&&(s.filter=xl),typeof a=="string"?((a==="transparent"||a.length===5||a.length===9||/(hsla|rgba)\(/.test(a))&&s.clearRect(0,0,r,o),s.save(),s.fillStyle=a,s.fillRect(0,0,r,o),s.restore()):s.clearRect(0,0,r,o),s},bA=({canvas:e,elements:t,visibleElements:r,selectedElements:o,scale:n,appState:i,renderConfig:a})=>{if(e===null)return{atLeastOneVisibleElement:!1,elements:t};let[s,c]=hA(e,n),l=gA({canvas:e,scale:n,normalizedWidth:s,normalizedHeight:c});l.save(),l.scale(i.zoom.value,i.zoom.value);let d;if(r.forEach(p=>{i.editingLinearElement?.elementId===p.id&&p&&(d=p)}),d&&dy(l,i,d),i.selectionElement)try{TA(i.selectionElement,l,i)}catch(p){console.error(p)}i.isBindingEnabled&&i.suggestedBindings.filter(p=>p!=null).forEach(p=>{fF(l,i,p)}),i.frameToHighlight&&gF(l,i,i.frameToHighlight),i.elementsToHighlight&&bF(l,i,i.elementsToHighlight);let u=o.some(p=>le(p));if(o.length===1&&i.editingLinearElement?.elementId===o[0].id&&dy(l,i,o[0]),i.selectedLinearElement&&i.selectedLinearElement.hoverPointIndex>=0&&pF(l,i),!i.multiElement&&!i.editingLinearElement){let p=nd(o,i);o.length===1&&me(o[0])&&i.selectedLinearElement?.elementId===o[0].id&&!o[0].locked&&dy(l,i,o[0]);let g=a.selectionColor||rt.black;if(p){let x=o.reduce((T,C)=>(T[C.id]=!0,T),{}),y=t.reduce((T,C)=>{let I=[];if(x[C.id]&&!Nl(i,C)&&I.push(g),a.remoteSelectedElementIds[C.id]&&I.push(...a.remoteSelectedElementIds[C.id].map(A=>xs(A))),I.length){let[A,P,L,D,M,R]=ue(C,!0);T.push({angle:C.angle,elementX1:A,elementY1:P,elementX2:L,elementY2:D,selectionColors:I,dashed:!!a.remoteSelectedElementIds[C.id],cx:M,cy:R,activeEmbeddable:i.activeEmbeddable?.element===C&&i.activeEmbeddable.state==="active"})}return T},[]),w=T=>{let C=Et(t,T),[I,A,P,L]=Me(C);y.push({angle:0,elementX1:I,elementX2:P,elementY1:A,elementY2:L,selectionColors:[rt.black],dashed:!0,cx:I+(P-I)/2,cy:A+(L-A)/2,activeEmbeddable:!1})};for(let T of wi(i))w(T);i.editingGroupId&&w(i.editingGroupId),y.forEach(T=>wA(l,i,T))}if(l.save(),l.translate(i.scrollX,i.scrollY),o.length===1){l.fillStyle=rt.white;let x=hm(o[0],i.zoom,"mouse");!i.viewModeEnabled&&p&&pA(l,a,i,x,o[0].angle)}else if(o.length>1&&!i.isRotating){let x=id*2/i.zoom.value;l.fillStyle=rt.white;let[y,w,T,C]=Me(o),I=l.getLineDash();l.setLineDash([2/i.zoom.value]);let A=l.lineWidth;l.lineWidth=1/i.zoom.value,l.strokeStyle=g,pm(l,y-x,w-x,T-y+x*2,C-w+x*2,(y+T)/2,(w+C)/2,0),l.lineWidth=A,l.setLineDash(I);let P=ad([y,w,T,C,(y+T)/2,(w+C)/2],0,i.zoom,"mouse",u?vA:fm);o.some(L=>!L.locked)&&pA(l,a,i,P,0)}l.restore()}dA(l,i),l.restore();for(let p in a.remotePointerViewportCoords){let{x:f,y:g}=a.remotePointerViewportCoords[p];f-=i.offsetLeft,g-=i.offsetTop;let x=11,y=14,w=f<0||f>s-x||g<0||g>c-y;f=Math.max(f,0),f=Math.min(f,s-x),g=Math.max(g,0),g=Math.min(g,c-y);let T=xs(p);l.save(),l.strokeStyle=T,l.fillStyle=T;let C=a.remotePointerUserStates[p],I=w||C==="idle"||C==="away";I&&(l.globalAlpha=.3),a.remotePointerButton&&a.remotePointerButton[p]==="down"&&(l.beginPath(),l.arc(f,g,15,0,2*Math.PI,!1),l.lineWidth=3,l.strokeStyle="#ffffff88",l.stroke(),l.closePath(),l.beginPath(),l.arc(f,g,15,0,2*Math.PI,!1),l.lineWidth=1,l.strokeStyle=T,l.stroke(),l.closePath()),l.fillStyle=rt.white,l.strokeStyle=rt.white,l.lineWidth=6,l.lineJoin="round",l.beginPath(),l.moveTo(f,g),l.lineTo(f+0,g+14),l.lineTo(f+4,g+9),l.lineTo(f+11,g+8),l.closePath(),l.stroke(),l.fill(),l.fillStyle=T,l.strokeStyle=T,l.lineWidth=2,l.lineJoin="round",l.beginPath(),I?(l.moveTo(f-1,g-1),l.lineTo(f-1,g+15),l.lineTo(f+5,g+10),l.lineTo(f+12,g+9),l.closePath(),l.fill()):(l.moveTo(f,g),l.lineTo(f+0,g+14),l.lineTo(f+4,g+9),l.lineTo(f+11,g+8),l.closePath(),l.fill(),l.stroke());let A=a.remotePointerUsernames[p]||"";if(!w&&A){l.font="600 12px sans-serif";let P=f+x/2,L=g+y+2,D=5,M=3,R=l.measureText(A),N=R.actualBoundingBoxDescent+R.actualBoundingBoxAscent,B=Math.max(N,12),K=P-1,V=L-1,ne=R.width+2+D*2+2,Q=B+2+M*2+2;l.roundRect?(l.beginPath(),l.roundRect(K,V,ne,Q,8),l.fillStyle=T,l.fill(),l.strokeStyle=rt.white,l.stroke()):Ob(l,K,V,ne,Q,8,rt.white),l.fillStyle=rt.black,l.fillText(A,P+D+1,L+M+R.actualBoundingBoxAscent+Math.floor((B-N)/2)+2)}l.restore(),l.closePath()}let m;return a.renderScrollbars&&(m=p3(t,s,c,i),l.save(),l.fillStyle=m3,l.strokeStyle="rgba(255,255,255,0.8)",[m.horizontal,m.vertical].forEach(p=>{p&&Ob(l,p.x,p.y,p.width,p.height,Wn/2)}),l.restore()),{scrollBars:m,atLeastOneVisibleElement:r.length>0,elements:t}},xA=({canvas:e,rc:t,elements:r,visibleElements:o,scale:n,appState:i,renderConfig:a})=>{if(e===null)return;let{renderGrid:s=!0,isExporting:c}=a,[l,d]=hA(e,n),u=gA({canvas:e,scale:n,normalizedWidth:l,normalizedHeight:d,theme:i.theme,isExporting:c,viewBackgroundColor:i.viewBackgroundColor});u.scale(i.zoom.value,i.zoom.value),s&&i.gridSize&&mF(u,i.gridSize,i.scrollX,i.scrollY,i.zoom,l/i.zoom.value,d/i.zoom.value);let m=new Set;o.forEach(p=>{p.groupIds.length>0&&i.frameToHighlight&&i.selectedElementIds[p.id]&&(Xa(p,i.frameToHighlight)||p.groupIds.find(f=>m.has(f)))&&p.groupIds.forEach(f=>m.add(f))}),o.filter(p=>!Xp(p)).forEach(p=>{try{if((p.frameId||i.frameToHighlight?.id)&&i.frameRendering.enabled&&i.frameRendering.clip){u.save();let g=e0(p,i);g&&el(p,r,i)&&mA(g,u,a,i),mm(p,t,u,a,i),u.restore()}else mm(p,t,u,a,i);c||fA(p,u,i)}catch(f){console.error(f)}}),o.filter(p=>Xp(p)).forEach(p=>{try{let f=()=>{if(mm(p,t,u,a,i),Or(p)&&(c||er(p)&&!p.validated)&&p.width&&p.height){let x=jp(p);mm(x,t,u,a,i)}c||fA(p,u,i)};if((p.frameId||i.frameToHighlight?.id)&&i.frameRendering.enabled&&i.frameRendering.clip){u.save();let x=e0(p,i);x&&el(p,r,i)&&mA(x,u,a,i),f(),u.restore()}else f()}catch(f){console.error(f)}})},EA=dp(e=>{let t=bA(e);e.callback?.(t)},{trailing:!0}),C_=(e,t)=>{if(t){EA(e);return}let r=bA(e);return e.callback(r),r},yA=dp(e=>{xA(e)},{trailing:!0}),ig=(e,t)=>{if(t){yA(e);return}xA(e)},A_=()=>{EA.cancel(),yA.cancel()},pA=(e,t,r,o,n)=>{Object.keys(o).forEach(i=>{let a=o[i];if(a!==void 0){let[s,c,l,d]=a;e.save(),e.lineWidth=1/r.zoom.value,t.selectionColor&&(e.strokeStyle=t.selectionColor),i==="rotation"?t0(e,s+l/2,c+d/2,l/2):e.roundRect?(e.beginPath(),e.roundRect(s,c,l,d,2/r.zoom.value),e.fill(),e.stroke()):pm(e,s,c,l,d,s+l/2,c+d/2,n,!0),e.restore()}})},wA=(e,t,r,o=id*2)=>{let{angle:n,elementX1:i,elementY1:a,elementX2:s,elementY2:c,selectionColors:l,cx:d,cy:u,dashed:m,activeEmbeddable:p}=r,f=s-i,g=c-a,x=o/t.zoom.value,y=8/t.zoom.value,w=4/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=(p?4:1)/t.zoom.value;let T=l.length;for(let C=0;C<T;++C)e.strokeStyle=l[C],m&&e.setLineDash([y,w+(y+w)*(T-1)]),e.lineDashOffset=(y+w)*C,pm(e,i-x,a-x,f+x*2,g+x*2,d,u,n);e.restore()},fF=(e,t,r)=>{let o=Array.isArray(r)?xF:hF;e.save(),e.translate(t.scrollX,t.scrollY),o(e,r),e.restore()},hF=(e,t)=>{let[r,o,n,i]=ue(t),a=n-r,s=i-o,c=sd(t,a,s),l=4;e.strokeStyle="rgba(0,0,0,.05)",e.lineWidth=c-l;let d=l/2+c/2;switch(t.type){case"rectangle":case"text":case"image":case"iframe":case"embeddable":case"frame":case"magicframe":pm(e,r-d,o-d,a+d*2,s+d*2,r+a/2,o+s/2,t.angle);break;case"diamond":let u=Math.hypot(a,s),m=d*u/s,p=d*u/a;dF(e,a+m*2,s+p*2,r+a/2,o+s/2,t.angle);break;case"ellipse":uF(e,a+d*2,s+d*2,r+a/2,o+s/2,t.angle);break}},gF=(e,t,r)=>{let[o,n,i,a]=ue(r),s=i-o,c=a-n;e.strokeStyle="rgb(0,118,255)",e.lineWidth=ut.strokeWidth/t.zoom.value,e.save(),e.translate(t.scrollX,t.scrollY),pm(e,o,n,s,c,o+s/2,n+c/2,r.angle,!1,ut.radius/t.zoom.value),e.restore()},bF=(e,t,r)=>{let o=r.filter(s=>s.groupIds.length===0),n=r.filter(s=>s.groupIds.length>0),i=s=>{let[c,l,d,u]=Me(s);return{angle:0,elementX1:c,elementX2:d,elementY1:l,elementY2:u,selectionColors:["rgb(0,118,255)"],dashed:!1,cx:c+(d-c)/2,cy:l+(u-l)/2,activeEmbeddable:!1}},a=s=>{let c=Et(r,s);return i(c)};Object.entries(Gp(n,t)).filter(([s,c])=>c).map(([s,c])=>s).map(s=>a(s)).concat(o.map(s=>i([s]))).forEach(s=>wA(e,t,s))},xF=(e,t)=>{let[r,o,n]=t,i=sd(n,n.width,n.height);e.strokeStyle="rgba(0,0,0,0)",e.fillStyle="rgba(0,0,0,.05)",(o==="both"?[0,-1]:o==="start"?[0]:[-1]).forEach(s=>{let[c,l]=re.getPointAtIndexGlobalCoordinates(r,s);t0(e,c,l,i)})},Vi,fA=(e,t,r)=>{if(e.link&&!r.selectedElementIds[e.id]){let[o,n,i,a]=ue(e),[s,c,l,d]=qg([o,n,i,a],e.angle,r),u=s+l/2,m=c+d/2;if(t.save(),t.translate(r.scrollX+u,r.scrollY+m),t.rotate(e.angle),!Vi||Vi.zoom!==r.zoom.value){Vi=document.createElement("canvas"),Vi.zoom=r.zoom.value,Vi.width=l*window.devicePixelRatio*r.zoom.value,Vi.height=d*window.devicePixelRatio*r.zoom.value;let p=Vi.getContext("2d");p.scale(window.devicePixelRatio*r.zoom.value,window.devicePixelRatio*r.zoom.value),p.fillStyle="#fff",p.fillRect(0,0,l,d),p.drawImage(cy,0,0,l,d),p.restore(),t.drawImage(Vi,s-u,c-m,l,d)}else t.drawImage(Vi,s-u,c-m,l,d);t.restore()}},X4=(e,t,r,o,n)=>{r&&(e.filter(i=>!Xp(i)).forEach(i=>{if(!i.isDeleted)try{Qg(i,t,r,o,i.x+n.offsetX,i.y+n.offsetY,n)}catch(a){console.error(a)}}),e.filter(i=>Or(i)).forEach(i=>{if(!i.isDeleted)try{Qg(i,t,r,o,i.x+n.offsetX,i.y+n.offsetY,n)}catch(a){console.error(a)}}))};var SA={mouse:8,pen:16,touch:28},EF=16,fm={e:!0,s:!0,n:!0,w:!0},vA={e:!0,s:!0,n:!0,w:!0,rotation:!0},yF={e:!0,s:!0,n:!0,w:!0},CA={e:!0,s:!0,n:!0,w:!0,nw:!0,se:!0},my={e:!0,s:!0,n:!0,w:!0},Yi=(e,t,r,o,n,i,a)=>{let[s,c]=Ie(e+r/2,t+o/2,n,i,a);return[s-r/2,c-o/2,r,o]},ad=([e,t,r,o,n,i],a,s,c,l={},d=4)=>{let u=SA[c],m=u/s.value,p=u/s.value,f=u/s.value,g=u/s.value,x=r-e,y=o-t,w=d/s.value,T=(u-id*2)/(2*s.value),C={nw:l.nw?void 0:Yi(e-w-f+T,t-w-g+T,m,p,n,i,a),ne:l.ne?void 0:Yi(r+w-T,t-w-g+T,m,p,n,i,a),sw:l.sw?void 0:Yi(e-w-f+T,o+w-T,m,p,n,i,a),se:l.se?void 0:Yi(r+w-T,o+w-T,m,p,n,i,a),rotation:l.rotation?void 0:Yi(e+x/2-m/2,t-w-g+T-EF/s.value,m,p,n,i,a)},I=5*SA.mouse/s.value;return Math.abs(x)>I&&(l.n||(C.n=Yi(e+x/2-m/2,t-w-g+T,m,p,n,i,a)),l.s||(C.s=Yi(e+x/2-m/2,o+w-T,m,p,n,i,a))),Math.abs(y)>I&&(l.w||(C.w=Yi(e-w-f+T,t+y/2-p/2,m,p,n,i,a)),l.e||(C.e=Yi(r+w-T,t+y/2-p/2,m,p,n,i,a))),C},hm=(e,t,r="mouse")=>{if(e.locked)return{};let o={};if(e.type==="freedraw"||me(e)){if(e.points.length===2){let[,i]=e.points;i[0]===0||i[1]===0?o=my:i[0]>0&&i[1]<0?o=CA:i[0]>0&&i[1]>0?o=my:i[0]<0&&i[1]>0?o=CA:i[0]<0&&i[1]<0&&(o=my)}}else ee(e)?o=yF:le(e)&&(o={rotation:!0});let n=me(e)?id+8:id;return ad(ue(e,!0),e.angle,t,r,o,n)},nd=(e,t)=>{if(t.editingLinearElement)return!1;if(e.length>1)return!0;let r=e[0];return me(r)?r.points.length>2:!0};var wF=e=>{if(e.type==="arrow")return!1;if(e.type==="freedraw")return!0;let t=!Rr(e.backgroundColor)||Xr(e)||Or(e);return e.type==="line"?t&&eo(e.points):t||ko(e)},rd=(e,t,r,o,n)=>{let i=10/t.zoom.value,a=[o,n];if(vF(t,e)&&nd([e],t))return um(e,a,i,r);let s=ye(e);return s&&rd(s,t,r,o,n)?!0:Qs(e,t,r,a)},lm=(e,t,r,o,n)=>{let i=10/t.zoom.value,a=ye(e);return a&&rd(a,t,r,o,n)?!1:!Qs(e,t,r,[o,n])&&um(e,[o,n],i,r)},Qs=(e,t,r,o)=>{let n=10/t.zoom.value,i=ee(e)?TF:wF(e)?gm:SF;return hy({element:e,point:o,threshold:n,check:i,frameNameBoundsCache:r})},vF=(e,t)=>e.selectedElementIds[t.id],um=(e,[t,r],o,n)=>{if(le(e))return hy({element:e,point:[t,r],threshold:o,check:gm,frameNameBoundsCache:n});let[i,a,s,c]=ue(e),l=(i+s)/2,d=(a+c)/2,[u,m]=Ie(t,r,l,d,-e.angle);return u>i-o&&u<s+o&&m>a-o&&m<c+o},fy=(e,{x:t,y:r})=>{let o=sd(e,e.width,e.height);return hy({element:e,point:[t,r],threshold:o,check:CF,frameNameBoundsCache:null})},sd=(e,t,r)=>{let n=(e.type==="diamond"?1/Math.sqrt(2):1)*Math.min(t,r);return Math.max(16,Math.min(.25*n,32))},hy=e=>{switch(e.element.type){case"rectangle":case"iframe":case"embeddable":case"image":case"text":case"diamond":case"ellipse":let t=r0(e.element,e.point);return e.check(t,e.threshold);case"freedraw":return e.check(IA(e.element,e.point),e.threshold)?MF(e.element,e.point,e.threshold):!1;case"arrow":case"line":return PF(e);case"selection":return console.warn("This should not happen, we need to investigate why it does."),!1;case"frame":case"magicframe":{if(e.check(r0(e.element,e.point),e.threshold))return!0;let r=e.frameNameBoundsCache?.get(e.element);return r?e.check(IF(r,e.point),e.threshold):!1}}},r0=(e,t)=>{switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return IA(e,t);case"diamond":return kF(e,t);case"ellipse":return _F(e,t)}},TF=(e,t)=>e<0,gm=(e,t)=>e<t,SF=(e,t)=>Math.abs(e)<t,CF=(e,t)=>0<=e&&e<t,IA=(e,t)=>{let[,r,o,n]=o0(e,t);return Math.max(Po(r,ma(0,1,-n)),Po(r,ma(1,0,-o)))},IF=(e,t)=>{let[,r,o,n]=LF(t,e);return Math.max(Po(r,ma(0,1,-n)),Po(r,ma(1,0,-o)))},kF=(e,t)=>{let[,r,o,n]=o0(e,t),i=ma(n,o,-n*o);return Po(r,i)},_F=(e,t)=>{let[r,o]=AF(e,t);return-w3(o)*Po(r,o)},AF=(e,t)=>{let[,r,o,n]=o0(e,t),[i,a]=fa(r),s=.707,c=.707,l=o,d=n;[0,1,2,3].forEach(p=>{let f=l*s,g=d*c,x=(l*l-d*d)*s**3/l,y=(d*d-l*l)*c**3/d,w=f-x,T=g-y,C=i-x,I=a-y,A=Math.hypot(T,w),P=Math.hypot(I,C);s=Math.min(1,Math.max(0,(C*A/P+x)/l)),c=Math.min(1,Math.max(0,(I*A/P+y)/d));let L=Math.hypot(c,s);s/=L,c/=L});let u=vr(l*s,d*c),m=y3(r,u);return[r,m]},MF=(e,t,r)=>{let o,n;if(e.angle===0)o=t[0]-e.x,n=t[1]-e.y;else{let[l,d,u,m]=ue(e),p=tt(t,[l+(u-l)/2,d+(m-d)/2],-e.angle);o=p[0]-e.x,n=p[1]-e.y}let[i,a]=e.points,s;if(kt(i[0],i[1],o,n)<r||kt(a[0],a[1],o,n)<r)return!0;for(let l=0;l<e.points.length;l++){let d=[a[0]-i[0],a[1]-i[1]],u=Math.hypot(d[1],d[0]),m=[d[0]/u,d[1]/u],p=[o-i[0],n-i[1]],f=(p[0]*m[0]+p[1]*m[1])/Math.hypot(m[1],m[0]);s=[i[0]+m[0]*f,i[1]+m[1]*f];let g=kt(s[0],s[1],i[0],i[1]),x=kt(s[0],s[1],a[0],a[1]);if(s=x<g&&g>u?a:g<x&&x>u?i:s,Math.hypot(n-s[1],o-s[0])<r)return!0;i=a,a=e.points[l+1]}let c=Re.get(e);return c&&c.sets.length?e.fillStyle==="solid"?by(c,o,n,"round"):PA(c,o,n,r):!1},PF=e=>{let{element:t,threshold:r}=e;if(!Re.get(t))return!1;let[o,n,i,a]=o0(e.element,e.point),s=ma(0,1,-a),c=ma(1,0,-i);if(!gm(Po(n,s),r)||!gm(Po(n,c),r))return!1;let[l,d]=fa(o),u=Re.get(t);return u?e.check===gm&&u.some(p=>by(p,l,d,t.roundness?"round":"sharp"))?!0:u.some(m=>PA(m,l,d,r)):!1},o0=(e,t)=>{let r=pa(t),[o,n,i,a]=ue(e),s=n0(o,n,i,a),c=zp(s,e.angle),l=Lo(c,r),d=Zd(l,Bp(s)),u=Lb(d),m=kb(e.x,e.y),p=Zd(l,m),f=(i-o)/2,g=(a-n)/2;return[p,u,f,g]},LF=(e,t)=>{let r=pa(e),[o,n,i,a]=LA(t),s=n0(o,n,i,a),c=zp(s,t.angle),l=Lo(c,r),d=Zd(l,Bp(s)),u=Lb(d),m=kb(t.x,t.y),p=Zd(l,m),f=(i-o)/2,g=(a-n)/2;return[p,u,f,g]};var gy=e=>{let[t,r,o,n]=ue(e),i=n0(t,r,o,n),a=zp(i,e.angle),s=Rl(I3(Bp(i)));return _3(a,s)},n0=(e,t,r,o)=>vr((e+r)/2,(t+o)/2),kA=(e,t,r)=>{let o=gy(e),n=Lo(o,pa(t)),i=Lo(o,pa(r)),a=Ol(n,i),s=e.height/e.width,c=e.width/2,l=e.height/2,d=a[2],u=a[3],m=a[1],p=Math.abs(u),f=Math.abs(d),g;switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":g=m/(c*(f+s*p));break;case"diamond":g=p<f?m/(f*c):m/(p*l);break;case"ellipse":g=m/(c*Math.sqrt(d**2+s**2*u**2));break}return g||0},_A=(e,t,r)=>{if(t===0){let[s,c,l,d]=ue(e),u=n0(s,c,l,d);return fa(u)}let o=gy(e),n=Lo(o,pa(r)),i=Rl(o),a;switch(e.type){case"rectangle":case"image":case"text":case"diamond":case"iframe":case"embeddable":case"frame":case"magicframe":a=zF(e,t,n);break;case"ellipse":a=BF(e,t,n);break}return fa(Lo(i,a))},AA=(e,t,r,o=0)=>{let n=gy(e),i=Lo(n,pa(t)),a=Lo(n,pa(r)),s=Ol(i,a),c=Rl(n);return DF(e,s,i,o).map(d=>fa(Lo(c,d)))},DF=(e,t,r,o=0)=>{let n;switch(e.type){case"rectangle":case"image":case"text":case"diamond":case"iframe":case"embeddable":case"frame":case"magicframe":let a=MA(e);n=a.flatMap((s,c)=>{let l=[s,a[(c+1)%4]];return RF(t,OF(l,o))}).concat(a.flatMap(s=>FF(s,o,t)));break;case"ellipse":n=NF(e,o,t);break}if(n.length<2)return[];let i=n.sort((a,s)=>Db(a,r)-Db(s,r));return[i[0],i[i.length-1]]},MA=(e,t=1)=>{let r=t*e.width/2,o=t*e.height/2;switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return[vr(r,o),vr(r,-o),vr(-r,-o),vr(-r,o)];case"diamond":return[vr(0,o),vr(r,0),vr(0,-o),vr(-r,0)]}},RF=(e,t)=>{let[r,o]=t,n=Po(r,e),i=Po(o,e);return n*i>=0?[]:[T3(e,Ol(r,o))]},OF=(e,t)=>{let[r,o]=e,n=k3(S3(r,o),t);return[Lo(n,r),Lo(n,o)]},NF=(e,t,r)=>{let o=e.width/2+t,n=e.height/2+t,i=r[2],a=r[3],s=r[1],c=o*o*i*i+n*n*a*a,l=c-s*s;if(c===0||l<=0)return[];let d=Math.sqrt(l),u=-o*o*i*s,m=-n*n*a*s;return[vr((u+o*n*a*d)/c,(m-o*n*i*d)/c),vr((u-o*n*a*d)/c,(m+o*n*i*d)/c)]},FF=(e,t,r)=>{if(t===0)return Po(r,e)===0?[e]:[];let o=r[2],n=r[3],i=r[1],[a,s]=fa(e),c=t,l=o*o+n*n,d=c*c*l-(o*a+n*s+i)**2;if(l===0||d<=0)return[];let u=Math.sqrt(d),m=a*n*n-s*o*n-o*i,p=s*o*o-a*o*n-n*i;return[vr((m+n*u)/l,(p-o*u)/l),vr((m-n*u)/l,(p+o*u)/l)]},BF=(e,t,r)=>{let o=Math.abs(t),n=e.width*o/2,i=e.height*o/2,a=Math.sign(t),[s,c]=fa(r),l=c===0?1e-4:c,d=s**2*i**2+l**2*n**2,u=(-s*i**2+a*l*Math.sqrt(Math.max(0,d-n**2*i**2)))/d,m=(-u*s-1)/l;m===0&&(m=(Object.is(m,-0)?-1:1)*.01);let p=-(n**2*u)/(m**2*i**2+u**2*n**2);return vr(p,(-u*p-1)/m)},zF=(e,t,r)=>{let o=Math.abs(t),n=Math.sign(t),i=MA(e,o),a=0,s=null;return i.forEach(c=>{let l=n*Ol(r,c)[1];l>a&&(a=l,s=c)}),s},HF=(e,t,r,o,[n,i],a)=>{let s=(l,d)=>Math.pow(1-l,3)*o[d]+3*l*Math.pow(1-l,2)*r[d]+3*Math.pow(l,2)*(1-l)*t[d]+e[d]*Math.pow(l,3),c=0;for(;c<=1;){let l=s(c,0),d=s(c,1);if(Math.sqrt(Math.pow(l-n,2)+Math.pow(d-i,2))<a)return!0;c+=.01}return!1},by=(e,t,r,o)=>{let n=kn(e),i=[],a=!1;for(let s of n)s.op==="move"?(a=!a,a&&i.push([s.data[0],s.data[1]])):s.op==="bcurveTo"?a&&(i.push([s.data[0],s.data[1]]),i.push([s.data[2],s.data[3]]),i.push([s.data[4],s.data[5]])):s.op==="lineTo"&&a&&i.push([s.data[0],s.data[1]]);if(i.length>=4){if(o==="sharp")return py(i,t,r);let s=M3(i,10,5);return py(s,t,r)}return!1},PA=(e,t,r,o)=>{let n=kn(e),i=[0,0];return n.some(({op:a,data:s},c)=>{if(a==="move")i=s;else if(a==="bcurveTo"){let l=[s[0],s[1]],d=[s[2],s[3]],u=[s[4],s[5]],m=i;return i=u,HF(m,l,d,u,[t,r],o)}else{if(a==="lineTo")return by(e,t,r,"sharp");a==="qcurveTo"&&console.warn("qcurveTo is not implemented yet")}return!1})};var V_=e=>!e[k.CTRL_OR_CMD],ri=e=>e.isBindingEnabled,zA=(e,t)=>{let r=[];return t.forEach(o=>{let n=e.getNonDeletedElement(o);n!=null&&r.push(n)}),r},Pi=(e,t,r)=>{let o=new Set,n=new Set;DA(e,t,r,"start",o,n),DA(e,r,t,"end",o,n);let i=Array.from(n).filter(a=>!o.has(a));zA(_e.getScene(e),i).forEach(a=>{Y(a,{boundElements:a.boundElements?.filter(s=>s.type!=="arrow"||s.id!==e.id)})})},DA=(e,t,r,o,n,i)=>{if(t!=="keep")if(t!=null)(r==null||(r==="keep"?!xy(e,t,o):o==="start"||r.id!==t.id))&&(Rc(e,t,o),n.add(t.id));else{let a=GF(e,o);a!=null&&i.add(a)}},Gu=e=>{e.forEach(t=>{Ut(t)?Pi(t,i0(t,"start"),i0(t,"end")):kl(t)&&$F(t)})},$F=e=>{$A(e).forEach(([t,r])=>Pi(t,r==="end"?"keep":e,r==="start"?"keep":e))},gu=(e,t,r,o)=>{t.startBoundElement!=null&&Rc(e,t.startBoundElement,"start");let n=ai(o,r);n!=null&&!xy(e,n,"end")&&Rc(e,n,"end")},Rc=(e,t,r)=>{Y(e,{[r==="start"?"startBinding":"endBinding"]:{elementId:t.id,...UF(e,t,r)}}),He(t.boundElements||[]).has(e.id)||Y(t,{boundElements:(t.boundElements||[]).concat({id:e.id,type:"arrow"})})},xy=(e,t,r)=>{let o=e[r==="start"?"endBinding":"startBinding"];return jE(e,o?.elementId,t)},jE=(e,t,r)=>t===r.id&&e.points.length<3,Uu=e=>{e.forEach(t=>{Ut(t)&&Pi(t,null,null)})},GF=(e,t)=>{let r=t==="start"?"startBinding":"endBinding",o=e[r];return o==null?null:(Y(e,{[r]:null}),o.elementId)},ai=(e,t)=>Sb(t.getNonDeletedElements(),o=>kl(o,!1)&&fy(o,e)),UF=(e,t,r)=>{let o=r==="start"?-1:1,n=o===-1?0:e.points.length-1,i=n-o,a=re.getPointAtIndexGlobalCoordinates(e,n),s=re.getPointAtIndexGlobalCoordinates(e,i);return{focus:kA(t,s,a),gap:Math.max(1,r0(t,a))}},Sn=(e,t)=>{let r=(e.boundElements??[]).filter(a=>a.type==="arrow");if(r.length===0)return;let{newSize:o,simultaneouslyUpdated:n}=t??{},i=VF(n);zA(_e.getScene(e),r.map(a=>a.id)).forEach(a=>{if(!me(a))return;let s=e;if(!WF(a,s))return;let c=OA(s,a.startBinding,o),l=OA(s,a.endBinding,o);if(i.has(a.id)){Y(a,{startBinding:c,endBinding:l});return}RA(a,"start",c,e),RA(a,"end",l,e),ye(a)&&Ks(a,!1)})},WF=(e,t)=>e.startBinding?.elementId===t.id||e.endBinding?.elementId===t.id,VF=e=>new Set((e||[]).map(t=>t.id)),RA=(e,t,r,o)=>{if(r==null||r.elementId!==o.id&&e.points.length>2)return;let n=_e.getScene(e).getElement(r.elementId);if(n==null)return;let i=t==="start"?-1:1,a=i===-1?0:e.points.length-1,s=a-i,c=re.getPointAtIndexGlobalCoordinates(e,s),l=_A(n,r.focus,c),d;if(r.gap===0)d=l;else{let u=AA(n,c,l,r.gap);u.length===0?d=l:d=u[0]}re.movePoints(e,[{index:a,point:re.pointFromAbsoluteCoords(e,d)}],{[t==="start"?"startBinding":"endBinding"]:r})},OA=(e,t,r)=>{if(t==null||r==null)return t;let{gap:o,focus:n,elementId:i}=t,{width:a,height:s}=r,{width:c,height:l}=e,d=Math.max(1,Math.min(sd(e,a,s),o*(a<s?a/c:s/l)));return{elementId:i,gap:d,focus:n}},Y_=e=>{let t=new Set(e.map(({id:r})=>r));return e.flatMap(r=>Ut(r,!1)?YF(r).filter(o=>!t.has(o.id)):kl(r,!1)?$A(r).filter(o=>!t.has(o[0].id)):[])},YF=e=>[i0(e,"start"),i0(e,"end")].filter(t=>t!=null),i0=(e,t)=>ai(HA(e,t),_e.getScene(e)),HA=(e,t)=>{let r=t==="start"?0:-1;return nn(re.getPointAtIndexGlobalCoordinates(e,r))},$A=e=>_e.getScene(e).getNonDeletedElements().map(t=>{if(!Ut(t,!1))return null;let r=NA(t,"start",e),o=NA(t,"end",e);return!r&&!o?null:[t,r&&o?"both":r?"start":"end",e]}).filter(t=>t!=null),NA=(e,t,r)=>e[t==="start"?"startBinding":"endBinding"]==null&&!xy(e,r,t)&&fy(r,HA(e,t)),sf=(e,t,r,o)=>{let n=new Set,i=new Set,a=o==="duplicatesServeAsOld";t.forEach(s=>{let{boundElements:c}=s;if(c!=null&&c.length>0&&(c.forEach(l=>{a&&!r.has(l.id)&&n.add(l.id)}),i.add(r.get(s.id))),Ut(s)){if(s.startBinding!=null){let{elementId:l}=s.startBinding;a&&!r.has(l)&&i.add(l)}if(s.endBinding!=null){let{elementId:l}=s.endBinding;a&&!r.has(l)&&i.add(l)}(s.startBinding!=null||s.endBinding!=null)&&n.add(r.get(s.id))}}),e.filter(({id:s})=>n.has(s)).forEach(s=>{let{startBinding:c,endBinding:l}=s;Y(s,{startBinding:FA(c,r),endBinding:FA(l,r)})}),e.filter(({id:s})=>i.has(s)).forEach(s=>{let{boundElements:c}=s;c!=null&&c.length>0&&Y(s,{boundElements:c.map(l=>r.has(l.id)?{id:r.get(l.id),type:l.type}:l)})})},FA=(e,t)=>{if(e==null)return null;let{elementId:r,focus:o,gap:n}=e;return{focus:o,gap:n,elementId:t.get(r)??r}},Kl=(e,t)=>{let r=new Set(t.map(n=>n.id)),o=new Set;t.forEach(n=>{kl(n)?n.boundElements?.forEach(i=>{r.has(i.id)||o.add(i.id)}):Ut(n)&&(n.startBinding&&o.add(n.startBinding.elementId),n.endBinding&&o.add(n.endBinding.elementId))}),e.filter(({id:n})=>o.has(n)).forEach(n=>{kl(n)?Y(n,{boundElements:KF(n.boundElements,r)}):Ut(n)&&Y(n,{startBinding:BA(n.startBinding,r),endBinding:BA(n.endBinding,r)})})},BA=(e,t)=>e==null||t.has(e.elementId)?null:e,KF=(e,t)=>e?e.filter(r=>!t.has(r.id)):null;var Ki={version:null,points:[],zoom:null},re=class e{elementId;selectedPointsIndices;pointerDownState;isDragging;lastUncommittedPoint;pointerOffset;startBindingElement;endBindingElement;hoverPointIndex;segmentMidPointHoveredCoords;constructor(t,r){this.elementId=t.id,_e.mapElementToScene(this.elementId,r),e.normalizePoints(t),this.selectedPointsIndices=null,this.lastUncommittedPoint=null,this.isDragging=!1,this.pointerOffset={x:0,y:0},this.startBindingElement="keep",this.endBindingElement="keep",this.pointerDownState={prevSelectedPointsIndices:null,lastClickedPoint:-1,origin:null,segmentMidpoint:{value:null,index:null,added:!1}},this.hoverPointIndex=-1,this.segmentMidPointHoveredCoords=null}static POINT_HANDLE_SIZE=10;static getElement(t){let r=_e.getScene(t)?.getNonDeletedElement(t);return r||null}static handleBoxSelection(t,r,o){if(!r.editingLinearElement||r.draggingElement?.type!=="selection")return!1;let{editingLinearElement:n}=r,{selectedPointsIndices:i,elementId:a}=n,s=e.getElement(a);if(!s)return!1;let[c,l,d,u]=ue(r.draggingElement),p=e.getPointsGlobalCoordinates(s).reduce((f,g,x)=>((g[0]>=c&&g[0]<=d&&g[1]>=l&&g[1]<=u||t.shiftKey&&i?.includes(x))&&f.push(x),f),[]);o({editingLinearElement:{...n,selectedPointsIndices:p.length?p:null}})}static handlePointDragging(t,r,o,n,i,a){if(!a)return!1;let{selectedPointsIndices:s,elementId:c}=a,l=e.getElement(c);if(!l)return!1;let d=l.points[a.pointerDownState.lastClickedPoint];if(s&&d){if(Ts(t)&&s.length===1&&l.points.length>1){let m=s[0],p=l.points[m===0?1:m-1],[f,g]=e._getShiftLockedDelta(l,p,[o,n],t[k.CTRL_OR_CMD]?null:r.gridSize);e.movePoints(l,[{index:m,point:[f+p[0],g+p[1]],isDragging:m===a.pointerDownState.lastClickedPoint}])}else{let m=e.createPointAt(l,o-a.pointerOffset.x,n-a.pointerOffset.y,t[k.CTRL_OR_CMD]?null:r.gridSize),p=m[0]-d[0],f=m[1]-d[1];e.movePoints(l,s.map(g=>{let x=g===a.pointerDownState.lastClickedPoint?e.createPointAt(l,o-a.pointerOffset.x,n-a.pointerOffset.y,t[k.CTRL_OR_CMD]?null:r.gridSize):[l.points[g][0]+p,l.points[g][1]+f];return{index:g,point:x,isDragging:g===a.pointerDownState.lastClickedPoint}}))}if(ye(l)&&Ks(l,!1),Ut(l,!1)){let m=[];s[0]===0&&m.push(nn(e.getPointGlobalCoordinates(l,l.points[0])));let f=s[s.length-1];f===l.points.length-1&&m.push(nn(e.getPointGlobalCoordinates(l,l.points[f]))),m.length&&i(l,m)}return!0}return!1}static handlePointerUp(t,r,o){let{elementId:n,selectedPointsIndices:i,isDragging:a,pointerDownState:s}=r,c=e.getElement(n);if(!c)return r;let l={};if(a&&i){for(let d of i)if(d===0||d===c.points.length-1){eo(c.points,o.zoom.value)&&e.movePoints(c,[{index:d,point:d===0?c.points[c.points.length-1]:c.points[0]}]);let u=ri(o)?ai(nn(e.getPointAtIndexGlobalCoordinates(c,d)),_e.getScene(c)):null;l[d===0?"startBindingElement":"endBindingElement"]=u}}return{...r,...l,selectedPointsIndices:a||t.shiftKey?!a&&t.shiftKey&&s.prevSelectedPointsIndices?.includes(s.lastClickedPoint)?i&&i.filter(d=>d!==s.lastClickedPoint):i:i?.includes(s.lastClickedPoint)?[s.lastClickedPoint]:i,isDragging:!1,pointerOffset:{x:0,y:0}}}static getEditorMidPoints=(t,r)=>{let o=ye(t);return!r.editingLinearElement&&t.points.length>2&&!o?[]:(Ki.version===t.version&&Ki.zoom===r.zoom.value||e.updateEditorMidPointsCache(t,r),Ki.points)};static updateEditorMidPointsCache=(t,r)=>{let o=e.getPointsGlobalCoordinates(t),n=0,i=[];for(;n<o.length-1;){if(e.isSegmentTooShort(t,t.points[n],t.points[n+1],r.zoom)){i.push(null),n++;continue}let a=e.getSegmentMidPoint(t,o[n],o[n+1],n+1);i.push(a),n++}Ki.points=i,Ki.version=t.version,Ki.zoom=r.zoom.value};static getSegmentMidpointHitCoords=(t,r,o)=>{let{elementId:n}=t,i=e.getElement(n);if(!i||e.getPointIndexUnderCursor(i,o.zoom,r.x,r.y)>=0||e.getPointsGlobalCoordinates(i).length>=3&&!o.editingLinearElement)return null;let c=e.POINT_HANDLE_SIZE/o.zoom.value,l=t.segmentMidPointHoveredCoords;if(l&&kt(l[0],l[1],r.x,r.y)<=c)return l;let d=0,u=e.getEditorMidPoints(i,o);for(;d<u.length;){if(u[d]!==null&&kt(u[d][0],u[d][1],r.x,r.y)<=c)return u[d];d++}return null};static isSegmentTooShort(t,r,o,n){let i=kt(r[0],r[1],o[0],o[1]);return t.points.length>2&&t.roundness&&(i=GA(t,o)),i*n.value<e.POINT_HANDLE_SIZE*4}static getSegmentMidPoint(t,r,o,n){let i=$u(r,o);if(t.points.length>2&&t.roundness){let a=Ey(t,t.points[n]);if(a){let s=UA(t,t.points[n],.5),[c,l]=yy(a[0],a[1],a[2],a[3],s);i=e.getPointGlobalCoordinates(t,[c,l])}}return i}static getSegmentMidPointIndex(t,r,o){let n=e.getElement(t.elementId);if(!n)return-1;let i=e.getEditorMidPoints(n,r),a=0;for(;a<i.length;){if(e.arePointsEqual(o,i[a]))return a+1;a++}return-1}static handlePointerDown(t,r,o,n,i){let a={didAddPoint:!1,hitElement:null,linearElementEditor:null};if(!i)return a;let{elementId:s}=i,c=e.getElement(s);if(!c)return a;let l=e.getSegmentMidpointHitCoords(i,n,r),d=null;if(l&&(d=e.getSegmentMidPointIndex(i,r,l)),t.altKey&&r.editingLinearElement)return i.lastUncommittedPoint==null&&(Y(c,{points:[...c.points,e.createPointAt(c,n.x,n.y,t[k.CTRL_OR_CMD]?null:r.gridSize)]}),a.didAddPoint=!0),o.resumeRecording(),a.linearElementEditor={...i,pointerDownState:{prevSelectedPointsIndices:i.selectedPointsIndices,lastClickedPoint:-1,origin:{x:n.x,y:n.y},segmentMidpoint:{value:l,index:d,added:!1}},selectedPointsIndices:[c.points.length-1],lastUncommittedPoint:null,endBindingElement:ai(n,_e.getScene(c))},a.didAddPoint=!0,a;let u=e.getPointIndexUnderCursor(c,r.zoom,n.x,n.y);if(u>=0||l)a.hitElement=c;else{let{startBindingElement:C,endBindingElement:I}=i;ri(r)&&Ut(c)&&Pi(c,C,I)}let[m,p,f,g]=ue(c),x=(m+f)/2,y=(p+g)/2,w=u>-1&&Ie(c.x+c.points[u][0],c.y+c.points[u][1],x,y,c.angle),T=u>-1||t.shiftKey?t.shiftKey||i.selectedPointsIndices?.includes(u)?ZF([...i.selectedPointsIndices||[],u]):[u]:null;return a.linearElementEditor={...i,pointerDownState:{prevSelectedPointsIndices:i.selectedPointsIndices,lastClickedPoint:u,origin:{x:n.x,y:n.y},segmentMidpoint:{value:l,index:d,added:!1}},selectedPointsIndices:T,pointerOffset:w?{x:n.x-w[0],y:n.y-w[1]}:{x:0,y:0}},a}static arePointsEqual(t,r){return!t&&!r?!0:!t||!r?!1:wy(t,r)}static handlePointerMove(t,r,o,n){if(!n.editingLinearElement)return null;let{elementId:i,lastUncommittedPoint:a}=n.editingLinearElement,s=e.getElement(i);if(!s)return n.editingLinearElement;let{points:c}=s,l=c[c.length-1];if(!t.altKey)return l===a&&e.deletePoints(s,[c.length-1]),{...n.editingLinearElement,lastUncommittedPoint:null};let d;if(Ts(t)&&c.length>=2){let u=c[c.length-2],[m,p]=e._getShiftLockedDelta(s,u,[r,o],t[k.CTRL_OR_CMD]?null:n.gridSize);d=[m+u[0],p+u[1]]}else d=e.createPointAt(s,r-n.editingLinearElement.pointerOffset.x,o-n.editingLinearElement.pointerOffset.y,t[k.CTRL_OR_CMD]?null:n.gridSize);return l===a?e.movePoints(s,[{index:s.points.length-1,point:d}]):e.addPoints(s,n,[{point:d}]),{...n.editingLinearElement,lastUncommittedPoint:s.points[s.points.length-1]}}static getPointGlobalCoordinates(t,r){let[o,n,i,a]=ue(t),s=(o+i)/2,c=(n+a)/2,{x:l,y:d}=t;return[l,d]=Ie(l+r[0],d+r[1],s,c,t.angle),[l,d]}static getPointsGlobalCoordinates(t){let[r,o,n,i]=ue(t),a=(r+n)/2,s=(o+i)/2;return t.points.map(c=>{let{x:l,y:d}=t;return[l,d]=Ie(l+c[0],d+c[1],a,s,t.angle),[l,d]})}static getPointAtIndexGlobalCoordinates(t,r){let o=r<0?t.points.length+r:r,[n,i,a,s]=ue(t),c=(n+a)/2,l=(i+s)/2,d=t.points[o],{x:u,y:m}=t;return d?Ie(u+d[0],m+d[1],c,l,t.angle):Ie(u,m,c,l,t.angle)}static pointFromAbsoluteCoords(t,r){let[o,n,i,a]=ue(t),s=(o+i)/2,c=(n+a)/2,[l,d]=Ie(r[0],r[1],s,c,-t.angle);return[l-t.x,d-t.y]}static getPointIndexUnderCursor(t,r,o,n){let i=e.getPointsGlobalCoordinates(t),a=i.length;for(;--a>-1;){let s=i[a];if(kt(o,n,s[0],s[1])*r.value<e.POINT_HANDLE_SIZE+1)return a}return-1}static createPointAt(t,r,o,n){let i=Zt(r,o,n),[a,s,c,l]=ue(t),d=(a+c)/2,u=(s+l)/2,[m,p]=Ie(i[0],i[1],d,u,-t.angle);return[m-t.x,p-t.y]}static getNormalizedPoints(t){let{points:r}=t,o=r[0][0],n=r[0][1];return{points:r.map((i,a)=>[i[0]-o,i[1]-n]),x:t.x+o,y:t.y+n}}static normalizePoints(t){Y(t,e.getNormalizedPoints(t))}static duplicateSelectedPoints(t){if(!t.editingLinearElement)return!1;let{selectedPointsIndices:r,elementId:o}=t.editingLinearElement,n=e.getElement(o);if(!n||r===null)return!1;let{points:i}=n,a=[],s=!1,c=-1,l=i.reduce((d,u,m)=>{if(++c,d.push(u),r.includes(m)){let f=i[m+1];f||(s=!0),d.push(f?[(u[0]+f[0])/2,(u[1]+f[1])/2]:[u[0],u[1]]),a.push(c+1),++c}return d},[]);if(Y(n,{points:l}),s){let d=n.points[n.points.length-1];e.movePoints(n,[{index:n.points.length-1,point:[d[0]+30,d[1]+30]}])}return{appState:{...t,editingLinearElement:{...t.editingLinearElement,selectedPointsIndices:a}}}}static deletePoints(t,r){let o=0,n=0;if(r.includes(0)){let s=t.points.find((c,l)=>!r.includes(l));s&&(o=s[0],n=s[1])}let a=t.points.reduce((s,c,l)=>(r.includes(l)||s.push(s.length?[c[0]-o,c[1]-n]:[0,0]),s),[]);e._updatePoints(t,a,o,n)}static addPoints(t,r,o){let a=[...t.points,...o.map(s=>s.point)];e._updatePoints(t,a,0,0)}static movePoints(t,r,o){let{points:n}=t,i=0,a=0,s=r.find(({index:l})=>l===0);s&&(i=s.point[0]+n[s.index][0],a=s.point[1]+n[s.index][1]);let c=n.map((l,d)=>{let u=r.find(m=>m.index===d);if(u){if(s)return l;let m=u.point[0]-n[u.index][0],p=u.point[1]-n[u.index][1];return[l[0]+m,l[1]+p]}return i||a?[l[0]-i,l[1]-a]:l});e._updatePoints(t,c,i,a,o)}static shouldAddMidpoint(t,r,o){if(!e.getElement(t.elementId))return!1;let{segmentMidpoint:i}=t.pointerDownState;if(i.added||i.value===null||i.index===null||t.pointerDownState.origin===null)return!1;let a=t.pointerDownState.origin,s=kt(a.x,a.y,r.x,r.y);return!(!o.editingLinearElement&&s<pi/o.zoom.value)}static addMidpoint(t,r,o,n){let i=e.getElement(t.elementId);if(!i)return;let{segmentMidpoint:a}=t.pointerDownState,s={pointerDownState:t.pointerDownState,selectedPointsIndices:t.selectedPointsIndices},c=e.createPointAt(i,r.x,r.y,n?o.gridSize:null),l=[...i.points.slice(0,a.index),c,...i.points.slice(a.index)];return Y(i,{points:l}),s.pointerDownState={...t.pointerDownState,segmentMidpoint:{...t.pointerDownState.segmentMidpoint,added:!0},lastClickedPoint:a.index},s.selectedPointsIndices=[a.index],s}static _updatePoints(t,r,o,n,i){let a=$c(t,r),s=$c(t,t.points),c=(a[0]+a[2])/2,l=(a[1]+a[3])/2,d=(s[0]+s[2])/2,u=(s[1]+s[3])/2,m=d-c,p=u-l,f=Ie(o,n,m,p,t.angle);Y(t,{...i,points:r,x:t.x+f[0],y:t.y+f[1]})}static _getShiftLockedDelta(t,r,o,n){let i=e.getPointGlobalCoordinates(t,r),[a,s]=Zt(o[0],o[1],n),{width:c,height:l}=od(i[0],i[1],a,s);return tt([c,l],[0,0],-t.angle)}static getBoundTextElementPosition=(t,r)=>{let o=e.getPointsGlobalCoordinates(t);o.length<2&&Y(r,{isDeleted:!0});let n=0,i=0;if(t.points.length%2===1){let a=Math.floor(t.points.length/2),s=e.getPointGlobalCoordinates(t,t.points[a]);n=s[0]-r.width/2,i=s[1]-r.height/2}else{let a=t.points.length/2-1,s=Ki.points[a];t.points.length===2&&(s=$u(o[0],o[1])),(!s||Ki.version!==t.version)&&(s=e.getSegmentMidPoint(t,o[a],o[a+1],a+1)),n=s[0]-r.width/2,i=s[1]-r.height/2}return{x:n,y:i}};static getMinMaxXYWithBoundText=(t,r,o)=>{let[n,i,a,s]=r,c=(n+a)/2,l=(i+s)/2,{x:d,y:u}=e.getBoundTextElementPosition(t,o),m=d+o.width,p=u+o.height,f=tt([n,i],[c,l],t.angle),g=tt([a,i],[c,l],t.angle),x=tt([d,u],[c,l],-t.angle),y=tt([m,u],[c,l],-t.angle),w=tt([d,p],[c,l],-t.angle),T=tt([m,p],[c,l],-t.angle);return f[0]<g[0]&&f[1]>=g[1]?(n=Math.min(n,w[0]),a=Math.max(a,Math.max(y[0],T[0])),i=Math.min(i,x[1]),s=Math.max(s,T[1])):f[0]>=g[0]&&f[1]>g[1]?(n=Math.min(n,T[0]),a=Math.max(a,Math.max(x[0],y[0])),i=Math.min(i,w[1]),s=Math.max(s,y[1])):f[0]>=g[0]?(n=Math.min(n,y[0]),a=Math.max(a,w[0]),i=Math.min(i,T[1]),s=Math.max(s,x[1])):f[1]<=g[1]&&(n=Math.min(n,Math.min(y[0],x[0])),a=Math.max(a,T[0]),i=Math.min(i,y[1]),s=Math.max(s,w[1])),[n,i,a,s,c,l]};static getElementAbsoluteCoords=(t,r=!1)=>{let o,n,i,a,s;if(t.points.length<2||!Re.get(t)){let{minX:u,minY:m,maxX:p,maxY:f}=t.points.reduce((g,[x,y])=>(g.minY=Math.min(g.minY,y),g.minX=Math.min(g.minX,x),g.maxX=Math.max(g.maxX,x),g.maxY=Math.max(g.maxY,y),g),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});n=u+t.x,i=m+t.y,a=p+t.x,s=f+t.y}else{let u=Re.generateElementShape(t,null),m=kn(u[0]),[p,f,g,x]=bm(m);n=p+t.x,i=f+t.y,a=g+t.x,s=x+t.y}let c=(n+a)/2,l=(i+s)/2;if(o=[n,i,a,s,c,l],!r)return o;let d=ye(t);return d&&(o=e.getMinMaxXYWithBoundText(t,[n,i,a,s],d)),o}},ZF=e=>{let t=[...new Set(e.filter(r=>r!==null&&r!==-1))];return t=t.sort((r,o)=>r-o),t.length?t:null};var ha=e=>e.replace(/\t/g," ").replace(/\r?\n|\r/g,`
205
- `),Cy=e=>ha(e).split(`
206
- `),br=(e,t)=>{let r,o={x:e.x,y:e.y,text:e.text,width:e.width,height:e.height,baseline:e.baseline};o.text=e.text,t&&(r=qr(t,e),o.text=ga(e.originalText,Ve(e),r));let n=co(o.text,Ve(e),e.lineHeight);if(o.width=n.width,o.height=n.height,o.baseline=n.baseline,t){let i=Hi(t,e),a=qr(t);if(!Le(t)&&n.height>i){let d=$i(n.height,t.type);Y(t,{height:d}),Vc(t.id,d)}if(n.width>a){let d=$i(n.width,t.type);Y(t,{width:d})}let s={...e,...o},{x:c,y:l}=Yc(t,s);o.x=c,o.y=l}Y(e,o)},lf=(e,t,r)=>{let o=He(e);t.forEach(n=>{let i=r.get(n.id),a=zi(n);if(a){let s=r.get(a);if(s){let c=o.get(i);c&&Y(c,{boundElements:(n.boundElements||[]).filter(d=>d.id!==s&&d.id!==a).concat({type:"text",id:s})});let l=o.get(s);l&&ee(l)&&Y(l,{containerId:c?i:null})}}})},Ks=(e,t,r=!1)=>{let o=zi(e);if(!o)return;xg(e.id);let n=_e.getScene(e).getElement(o);if(n&&n.text){if(!e)return;n=_e.getScene(e).getElement(o);let i=n.text,a=n.height,s=n.width,c=qr(e),l=Hi(e,n),d=e.height,u=n.baseline;if(r||t!=="n"&&t!=="s"){i&&(i=ga(n.originalText,Ve(n),c));let m=co(i,Ve(n),n.lineHeight);a=m.height,s=m.width,u=m.baseline}if(a>l){d=$i(a,e.type);let m=d-e.height,p=!Le(e)&&(t==="ne"||t==="nw"||t==="n")?e.y-m:e.y;Y(e,{height:d,y:p})}Y(n,{text:i,width:s,height:a,baseline:u}),Le(e)||Y(n,Yc(e,n))}},Yc=(e,t)=>{if(Le(e))return re.getBoundTextElementPosition(e,t);let r=Iy(e),o=Hi(e,t),n=qr(e),i,a;return t.verticalAlign===Nt.TOP?a=r.y:t.verticalAlign===Nt.BOTTOM?a=r.y+(o-t.height):a=r.y+(o/2-t.height/2),t.textAlign===na.LEFT?i=r.x:t.textAlign===na.RIGHT?i=r.x+(n-t.width):i=r.x+(n/2-t.width/2),{x:i,y:a}},co=(e,t,r)=>{e=e.split(`
207
- `).map(s=>s||" ").join(`
208
- `);let o=parseFloat(t),n=Sy(e,o,r),i=Wu(e,t),a=J1(e,t,r);return{width:i,height:n,baseline:a}},J1=(e,t,r,o)=>{let n=document.createElement("div");n.style.position="absolute",n.style.whiteSpace="pre",n.style.font=t,n.style.minHeight="1em",o&&(n.style.overflow="hidden",n.style.wordBreak="break-word",n.style.whiteSpace="pre-wrap"),n.style.lineHeight=String(r),n.innerText=e,document.body.appendChild(n);let i=document.createElement("span");i.style.display="inline-block",i.style.overflow="hidden",i.style.width="1px",i.style.height="1px",n.appendChild(i);let a=i.offsetTop+i.offsetHeight,s=n.offsetHeight;if(Wm){let c=Sy(e,parseFloat(t),r),l=parseFloat(t),d=Sy(e,Math.round(l),r);c>s&&(a+=c-d),s>c&&(a-=d-c)}return document.body.removeChild(n),a},dh=e=>{let t=Cy(e.text).length;return e.height/t/e.fontSize},tl=(e,t)=>e*t,ug=(e,t)=>tl(e,t)+Pt*2,vy,xm=(e,t)=>{vy||(vy=document.createElement("canvas"));let r=vy.getContext("2d");r.font=t;let o=r.measureText(e).width;return io()?o*10:o},Wu=(e,t)=>{let r=Cy(e),o=0;return r.forEach(n=>{o=Math.max(o,xm(n,t))}),o},Sy=(e,t,r)=>{let o=Cy(e).length;return tl(t,r)*o},XF=e=>{let t=e.split("-");return t.length>1&&t.forEach((r,o)=>{o!==t.length-1&&(t[o]=r+="-")}),t.join(" ").split(" ")},ga=(e,t,r)=>{if(!Number.isFinite(r)||r<0)return e;let o=[],n=e.split(`
209
- `),i=xm(" ",t),a="",s=0,c=d=>{d.trim()&&o.push(d)},l=()=>{a="",s=0};return n.forEach(d=>{if(Wu(d,t)<=r){o.push(d);return}let m=XF(d);l();let p=0;for(;p<m.length;){let f=xm(m[p],t);if(f===r)c(m[p]),p++;else if(f>r){for(c(a),l();m[p].length>0;){let g=String.fromCodePoint(m[p].codePointAt(0)),x=WA.calculate(g,t);s+=x,m[p]=m[p].slice(g.length),s>=r?(c(a),a=g,s=x):a+=g}s+i>=r?(c(a),l()):a.endsWith("-")||(a+=" ",s+=i),p++}else for(;s<r&&p<m.length;){let g=m[p];if(s=xm(a+g,t),s>r){c(a),l();break}p++;let x=!g.endsWith("-");if(a+=g,x&&(a+=" "),s+i>=r){x?o.push(a.slice(0,-1)):o.push(a),l();break}}}a.slice(-1)===" "&&(a=a.slice(0,-1),c(a))}),o.join(`
210
- `)},WA=(()=>{let e={};return{calculate:(o,n)=>{let i=o.charCodeAt(0);if(e[n]||(e[n]=[]),!e[n][i]){let a=xm(o,n);e[n][i]=a}return e[n][i]},getCache:o=>e[o]}})(),VA="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase(),mg=(e,t)=>{let r=jF(e);return r===0?co(VA.split("").join(`
211
- `),e,t).width+Pt*2:r+Pt*2};var jF=e=>{let t=WA.getCache(e);if(!t)return 0;let r=t.filter(o=>o!==void 0);return Math.max(...r)};var zi=e=>e?.boundElements?.length&&e?.boundElements?.filter(t=>t.type==="text")[0]?.id||null,ye=e=>{if(!e)return null;let t=zi(e);return t&&_e.getScene(e)?.getElement(t)||null},lt=e=>e&&e.containerId&&_e.getScene(e)?.getElement(e.containerId)||null,Gg=(e,t)=>{if(!Le(e))return{x:e.x+e.width/2,y:e.y+e.height/2};let r=re.getPointsGlobalCoordinates(e);if(r.length%2===1){let i=Math.floor(e.points.length/2),a=re.getPointGlobalCoordinates(e,e.points[i]);return{x:a[0],y:a[1]}}let o=e.points.length/2-1,n=re.getEditorMidPoints(e,t)[o];return n||(n=re.getSegmentMidPoint(e,r[o],r[o+1],o+1)),{x:n[0],y:n[1]}},Iy=e=>{let t=Pt,r=Pt;return e.type==="ellipse"&&(t+=e.width/2*(1-Math.sqrt(2)/2),r+=e.height/2*(1-Math.sqrt(2)/2)),e.type==="diamond"&&(t+=e.width/4,r+=e.height/4),{x:e.x+t,y:e.y+r}},hk=e=>{let t=lt(e);return!t||Le(t)?e.angle:t.angle};var _k=e=>e.some(t=>{if($e(t)){let o=lt(t);return!(ee(t)&&Le(o))}return!1}),Ak=e=>e.some(t=>{if($e(t)){let o=lt(t);return!(ee(t)&&Le(o))}return ee(t)}),VE=(e,t,r,o)=>{let n=Se(e,t);if(n.length===1)return $n(n[0],!1)?n[0]:null;let i=null;for(let a=e.length-1;a>=0;--a){if(e[a].isDeleted)continue;let[s,c,l,d]=ue(e[a]);if(Le(e[a])&&Qs(e[a],t,null,[r,o])){i=e[a];break}else if(s<r&&r<l&&c<o&&o<d){i=e[a];break}}return $n(i,!1)?i:null},qF=new Set(["rectangle","ellipse","diamond","arrow"]),K_=e=>qF.has(e.type),$i=(e,t)=>{e=Math.ceil(e);let r=Pt*2;return t==="ellipse"?Math.round((e+r)/Math.sqrt(2)*2):t==="arrow"?e+r*8:t==="diamond"?2*(e+r):e+r},qr=(e,t=ye(e))=>{let{width:r}=e;if(Le(e)){let o=(t?.fontSize??Jt)*p2;return Math.max(m2*r,o)}return e.type==="ellipse"?Math.round(r/2*Math.sqrt(2))-Pt*2:e.type==="diamond"?Math.round(r/2)-Pt*2:r-Pt*2},Hi=(e,t)=>{let{height:r}=e;return Le(e)?r-Pt*8*2<=0?t.height:r:e.type==="ellipse"?Math.round(r/2*Math.sqrt(2))-Pt*2:e.type==="diamond"?Math.round(r/2)-Pt*2:r-Pt*2},Z_=()=>Wu(VA,Ve({fontSize:Jt,fontFamily:pr}))>0,Ty={[qt.Virgil]:1.25,[qt.Helvetica]:1.15,[qt.Cascadia]:1.2},mo=e=>e in Ty?Ty[e]:Ty[pr];var XA="invert(100%) hue-rotate(180deg) saturate(1.25)",JF=wr(),jA=(e,t)=>Zr(e)&&!t.imageCache.has(e.fileId),qA=(e,t,r)=>r.theme==="dark"&&Zr(e)&&!jA(e,t)&&t.imageCache.get(e.fileId)?.mimeType!==ae.svg,s0=e=>e.type==="freedraw"?e.strokeWidth*12:20,QF=(e,t)=>{let n=s0(e),[i,a,s,c]=ue(e),l=me(e)||Gt(e)?Qt(i,s):e.width,d=me(e)||Gt(e)?Qt(a,c):e.height,u=l*window.devicePixelRatio+n*2,m=d*window.devicePixelRatio+n*2,p=t.value;return(u*p>32767||m*p>32767)&&(p=Math.min(32767/u,32767/m)),u*m*p*p>16777216&&(p=Math.sqrt(16777216/(u*m))),u=Math.floor(u*p),m=Math.floor(m*p),{width:u,height:m,scale:p}},eB=(e,t,r,o)=>{let n=document.createElement("canvas"),i=n.getContext("2d"),a=s0(e),{width:s,height:c,scale:l}=QF(e,t);n.width=s,n.height=c;let d=0,u=0;if(me(e)||Gt(e)){let[p,f]=ue(e);d=e.x>p?Qt(e.x,p)*window.devicePixelRatio*l:0,u=e.y>f?Qt(e.y,f)*window.devicePixelRatio*l:0,i.translate(d,u)}i.save(),i.translate(a*l,a*l),i.scale(window.devicePixelRatio*l,window.devicePixelRatio*l);let m=Ao.canvas(n);return qA(e,r,o)&&(i.filter=XA),a0(e,m,i,r,o),i.restore(),{element:e,canvas:n,theme:o.theme,scale:l,zoomValue:t.value,canvasOffsetX:d,canvasOffsetY:u,boundTextElementVersion:ye(e)?.version||null,containingFrameOpacity:Cr(e)?.opacity||100}},sA=14,JA=document.createElement("img");JA.src=`data:${ae.svg},${encodeURIComponent('<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="image" class="svg-inline--fa fa-image fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#888" d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"></path></svg>')}`;var QA=document.createElement("img");QA.src=`data:${ae.svg},${encodeURIComponent('<svg viewBox="0 0 668 668" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48ZM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56ZM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.81709 0 0 .81709 124.825 145.825)"/><path d="M256 8C119.034 8 8 119.033 8 256c0 136.967 111.034 248 248 248s248-111.034 248-248S392.967 8 256 8Zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676ZM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.30366 0 0 .30366 506.822 60.065)"/></svg>')}`;var tB=(e,t,r)=>{t.fillStyle="#E7E7E7",t.fillRect(0,0,e.width,e.height);let o=Math.min(e.width,e.height),n=Math.min(o,Math.min(o*.4,100));t.drawImage(e.status==="error"?QA:JA,e.width/2-n/2,e.height/2-n/2,n,n)},a0=(e,t,r,o,n)=>{switch(r.globalAlpha=(Cr(e)?.opacity??100)*e.opacity/1e4,e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":{r.lineJoin="round",r.lineCap="round",t.draw(Re.get(e));break}case"arrow":case"line":{r.lineJoin="round",r.lineCap="round",Re.get(e).forEach(i=>{t.draw(i)});break}case"freedraw":{r.save(),r.fillStyle=e.strokeColor;let i=rB(e),a=Re.get(e);a&&t.draw(a),r.fillStyle=e.strokeColor,r.fill(i),r.restore();break}case"image":{let i=Zr(e)?o.imageCache.get(e.fileId)?.image:void 0;i!=null&&!(i instanceof Promise)?r.drawImage(i,0,0,e.width,e.height):tB(e,r,n.zoom.value);break}default:if(ee(e)){let i=lb(e.text),a=i&&!r.canvas.isConnected;a&&document.body.appendChild(r.canvas),r.canvas.setAttribute("dir",i?"rtl":"ltr"),r.save(),r.font=Ve(e),r.fillStyle=e.strokeColor,r.textAlign=e.textAlign;let s=e.text.replace(/\r\n?/g,`
212
- `).split(`
213
- `),c=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,l=tl(e.fontSize,e.lineHeight),d=e.height-e.baseline;for(let u=0;u<s.length;u++)r.fillText(s[u],c,(u+1)*l-d);r.restore(),a&&r.canvas.remove()}else throw new Error(`Unimplemented type ${e.type}`)}r.globalAlpha=1},Lg=new WeakMap,YA=(e,t,r)=>{let o=t?r.zoom:JF.zoom,n=Lg.get(e),i=n&&n.zoomValue!==o.value&&!r?.shouldCacheIgnoreZoom,a=ye(e)?.version||null,s=Cr(e)?.opacity||100;if(!n||i||n.theme!==r.theme||n.boundTextElementVersion!==a||n.containingFrameOpacity!==s){let c=eB(e,o,t,r);return Lg.set(e,c),c}return n},KA=(e,t,r,o)=>{let n=e.element,i=s0(n),a=e.scale,[s,c,l,d]=ue(n);Gt(n)&&(s=Math.floor(s),l=Math.ceil(l),c=Math.floor(c),d=Math.ceil(d));let u=((s+l)/2+o.scrollX)*window.devicePixelRatio,m=((c+d)/2+o.scrollY)*window.devicePixelRatio;t.save(),t.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);let p=ye(n);if(Le(n)&&p){let f=document.createElement("canvas"),g=f.getContext("2d"),x=Math.max(Qt(s,l),Qt(c,d));f.width=x*window.devicePixelRatio*a+i*e.scale*10,f.height=x*window.devicePixelRatio*a+i*e.scale*10;let y=(f.width-e.canvas.width)/2,w=(f.height-e.canvas.height)/2;g.translate(f.width/2,f.height/2),g.rotate(n.angle),g.drawImage(e.canvas,-e.canvas.width/2,-e.canvas.height/2,e.canvas.width,e.canvas.height);let[,,,,T,C]=ue(p);g.rotate(-n.angle);let I=f.width/2-(T-s)*window.devicePixelRatio*a-y-i*a,A=f.height/2-(C-c)*window.devicePixelRatio*a-w-i*a;g.translate(-I,-A),g.clearRect(-(p.width/2+Pt)*window.devicePixelRatio*a,-(p.height/2+Pt)*window.devicePixelRatio*a,(p.width+Pt*2)*window.devicePixelRatio*a,(p.height+Pt*2)*window.devicePixelRatio*a),t.translate(u,m),t.drawImage(f,-(l-s)/2*window.devicePixelRatio-y/a-i,-(d-c)/2*window.devicePixelRatio-w/a-i,f.width/a,f.height/a)}else if(t.translate(u,m),t.rotate(n.angle),"scale"in e.element&&!jA(n,r)&&t.scale(e.element.scale[0],e.element.scale[1]),t.translate(-u,-m),t.drawImage(e.canvas,(s+o.scrollX)*window.devicePixelRatio-i*e.scale/e.scale,(c+o.scrollY)*window.devicePixelRatio-i*e.scale/e.scale,e.canvas.width/e.scale,e.canvas.height/e.scale),v.VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX==="true"&&Xr(n)){let f=ye(n),g=Iy(n);t.strokeStyle="#c92a2a",t.lineWidth=3,t.strokeRect((g.x+o.scrollX)*window.devicePixelRatio,(g.y+o.scrollY)*window.devicePixelRatio,qr(n)*window.devicePixelRatio,Hi(n,f)*window.devicePixelRatio)}t.restore()},TA=(e,t,r)=>{t.save(),t.translate(e.x+r.scrollX,e.y+r.scrollY),t.fillStyle="rgba(0, 0, 200, 0.04)";let o=.5/r.zoom.value;t.fillRect(o,o,e.width,e.height),t.lineWidth=1/r.zoom.value,t.strokeStyle=" rgb(105, 101, 219)",t.strokeRect(o,o,e.width,e.height),t.restore()},mm=(e,t,r,o,n)=>{switch(e.type){case"magicframe":case"frame":{n.frameRendering.enabled&&n.frameRendering.outline&&(r.save(),r.translate(e.x+n.scrollX,e.y+n.scrollY),r.fillStyle="rgba(0, 0, 200, 0.04)",r.lineWidth=ut.strokeWidth/n.zoom.value,r.strokeStyle=ut.strokeColor,ds(e)&&(r.strokeStyle=n.theme==="light"?"#7affd7":"#1d8264"),ut.radius&&r.roundRect?(r.beginPath(),r.roundRect(0,0,e.width,e.height,ut.radius/n.zoom.value),r.stroke(),r.closePath()):r.strokeRect(0,0,e.width,e.height),r.restore());break}case"freedraw":{if(Re.generateElementShape(e,null),o.isExporting){let[i,a,s,c]=ue(e),l=(i+s)/2+n.scrollX,d=(a+c)/2+n.scrollY,u=(s-i)/2-(e.x-i),m=(c-a)/2-(e.y-a);r.save(),r.translate(l,d),r.rotate(e.angle),r.translate(-u,-m),a0(e,t,r,o,n),r.restore()}else{let i=YA(e,o,n);KA(i,r,o,n)}break}case"rectangle":case"diamond":case"ellipse":case"line":case"arrow":case"image":case"text":case"iframe":case"embeddable":{if(Re.generateElementShape(e,o),o.isExporting){let[i,a,s,c]=ue(e),l=(i+s)/2+n.scrollX,d=(a+c)/2+n.scrollY,u=(s-i)/2-(e.x-i),m=(c-a)/2-(e.y-a);if(ee(e)){let f=lt(e);if(Le(f)){let g=re.getBoundTextElementPosition(f,e);u=(s-i)/2-(g.x-i),m=(c-a)/2-(g.y-a)}}r.save(),r.translate(l,d),qA(e,o,n)&&(r.filter="none");let p=ye(e);if(Le(e)&&p){let f=document.createElement("canvas"),g=f.getContext("2d"),x=Math.max(Qt(i,s),Qt(a,c)),y=s0(e);f.width=x*n.exportScale+y*10*n.exportScale,f.height=x*n.exportScale+y*10*n.exportScale,g.translate(f.width/2,f.height/2),g.scale(n.exportScale,n.exportScale),u=e.width/2-(e.x-i),m=e.height/2-(e.y-a),g.rotate(e.angle);let w=Ao.canvas(f);g.translate(-u,-m),a0(e,w,g,o,n),g.translate(u,m),g.rotate(-e.angle);let[,,,,T,C]=ue(p),I=(i+s)/2-T,A=(a+c)/2-C;g.translate(-I,-A),g.clearRect(-p.width/2,-p.height/2,p.width,p.height),r.scale(1/n.exportScale,1/n.exportScale),r.drawImage(f,-f.width/2,-f.height/2,f.width,f.height)}else r.rotate(e.angle),e.type==="image"&&r.scale(e.scale[0],e.scale[1]),r.translate(-u,-m),a0(e,t,r,o,n);r.restore()}else{let i=YA(e,o,n),a=r.imageSmoothingEnabled;!n?.shouldCacheIgnoreZoom&&(!e.angle||rM(e.angle))&&(r.imageSmoothingEnabled=!1),KA(i,r,o,n),r.imageSmoothingEnabled=a}break}default:throw new Error(`Unimplemented type ${e.type}`)}},Em=(e,t,r)=>{if(typeof r>"u")return e.draw(t);let o={sets:t.sets,shape:t.shape,options:{...t.options,fixedDecimalPlaceDigits:r}};return e.draw(o)},ym=(e,t,r,o)=>{if(!o.enabled||!o.clip)return null;let n=Cr(e);if(n){let i=t.ownerDocument.createElementNS(mt,"g");return i.setAttributeNS(mt,"clip-path",`url(#${n.id})`),r.forEach(a=>i.appendChild(a)),i}return null},Qg=(e,t,r,o,n,i,a)=>{let s={x:n,y:i},[c,l,d,u]=ue(e),m=(d-c)/2-(e.x-c),p=(u-l)/2-(e.y-l);if(ee(e)){let w=lt(e);if(Le(w)){let[T,C,I,A]=ue(w),P=re.getBoundTextElementPosition(w,e);m=(I-T)/2-(P.x-T),p=(A-C)/2-(P.y-C),n=n+P.x-e.x,i=i+P.y-e.y}}let f=180*e.angle/Math.PI,g=r;if(e.link){let w=r.ownerDocument.createElementNS(mt,"a");w.setAttribute("href",Hr(e.link)),g.appendChild(w),g=w}let x=(w,T)=>{io()&&w.setAttribute("data-id",T.id),g.appendChild(w)},y=(Cr(e)?.opacity??100)*e.opacity/1e4;switch(e.type){case"selection":throw new Error("Selection rendering is not supported for SVG");case"rectangle":case"diamond":case"ellipse":{let w=Re.generateElementShape(e,null),T=Em(t,w,El);y!==1&&(T.setAttribute("stroke-opacity",`${y}`),T.setAttribute("fill-opacity",`${y}`)),T.setAttribute("stroke-linecap","round"),T.setAttribute("transform",`translate(${n||0} ${i||0}) rotate(${f} ${m} ${p})`);let C=ym(e,g,[T],a.frameRendering);x(C||T,e);break}case"iframe":case"embeddable":{let w=Re.generateElementShape(e,a),T=Em(t,w,El),C=e.opacity/100;C!==1&&(T.setAttribute("stroke-opacity",`${C}`),T.setAttribute("fill-opacity",`${C}`)),T.setAttribute("stroke-linecap","round"),T.setAttribute("transform",`translate(${n||0} ${i||0}) rotate(${f} ${m} ${p})`),x(T,e);let I=jp(e);Qg(I,t,g,o,I.x+s.x-e.x,I.y+s.y-e.y,a);let A=Em(t,w,El);for(A.setAttribute("stroke-linecap","round"),A.setAttribute("transform",`translate(${n||0} ${i||0}) rotate(${f} ${m} ${p})`);A.firstChild;)A.removeChild(A.firstChild);let P=Za(Math.min(e.width,e.height),e),L=Ci(ch(e.link||""));if(a.renderEmbeddables===!1||L?.type==="document"){let D=r.ownerDocument.createElementNS(mt,"a");D.setAttribute("href",Hr(e.link||"")),D.setAttribute("target","_blank"),D.setAttribute("rel","noopener noreferrer"),D.style.borderRadius=`${P}px`,A.appendChild(D)}else{let D=r.ownerDocument.createElementNS(mt,"foreignObject");D.style.width=`${e.width}px`,D.style.height=`${e.height}px`,D.style.border="none";let M=D.ownerDocument.createElementNS(mt,"div");M.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),M.style.width="100%",M.style.height="100%";let R=M.ownerDocument.createElement("iframe");R.src=L?.link??"",R.style.width="100%",R.style.height="100%",R.style.border="none",R.style.borderRadius=`${P}px`,R.style.top="0",R.style.left="0",R.allowFullscreen=!0,M.appendChild(R),D.appendChild(M),A.appendChild(D)}x(A,e);break}case"line":case"arrow":{let w=ye(e),T=r.ownerDocument.createElementNS(mt,"mask");if(w){T.setAttribute("id",`mask-${e.id}`);let P=r.ownerDocument.createElementNS(mt,"rect");n=n||0,i=i||0,P.setAttribute("x","0"),P.setAttribute("y","0"),P.setAttribute("fill","#fff"),P.setAttribute("width",`${e.width+100+n}`),P.setAttribute("height",`${e.height+100+i}`),T.appendChild(P);let L=r.ownerDocument.createElementNS(mt,"rect"),D=re.getBoundTextElementPosition(e,w),M=n+D.x-e.x,R=i+D.y-e.y;L.setAttribute("x",M.toString()),L.setAttribute("y",R.toString()),L.setAttribute("fill","#000"),L.setAttribute("width",`${w.width}`),L.setAttribute("height",`${w.height}`),L.setAttribute("opacity","1"),T.appendChild(L)}let C=r.ownerDocument.createElementNS(mt,"g");w&&C.setAttribute("mask",`url(#mask-${e.id})`),C.setAttribute("stroke-linecap","round"),Re.generateElementShape(e,a).forEach(P=>{let L=Em(t,P,El);y!==1&&(L.setAttribute("stroke-opacity",`${y}`),L.setAttribute("fill-opacity",`${y}`)),L.setAttribute("transform",`translate(${n||0} ${i||0}) rotate(${f} ${m} ${p})`),e.type==="line"&&eo(e.points)&&e.backgroundColor!=="transparent"&&L.setAttribute("fill-rule","evenodd"),C.appendChild(L)});let A=ym(e,g,[C,T],a.frameRendering);A?(x(A,e),g.appendChild(A)):(x(C,e),g.append(T));break}case"freedraw":{let w=Re.generateElementShape(e,a),T=w?Em(t,w,El):r.ownerDocument.createElementNS(mt,"g");y!==1&&(T.setAttribute("stroke-opacity",`${y}`),T.setAttribute("fill-opacity",`${y}`)),T.setAttribute("transform",`translate(${n||0} ${i||0}) rotate(${f} ${m} ${p})`),T.setAttribute("stroke","none");let C=r.ownerDocument.createElementNS(mt,"path");C.setAttribute("fill",e.strokeColor),C.setAttribute("d",Hx(e)),T.appendChild(C);let I=ym(e,g,[T],a.frameRendering);x(I||T,e);break}case"image":{let w=Math.round(e.width),T=Math.round(e.height),C=Zr(e)&&o[e.fileId];if(C){let I=`image-${C.id}`,A=r.querySelector(`#${I}`);if(!A){A=r.ownerDocument.createElementNS(mt,"symbol"),A.id=I;let M=r.ownerDocument.createElementNS(mt,"image");M.setAttribute("width","100%"),M.setAttribute("height","100%"),M.setAttribute("href",C.dataURL),A.appendChild(M),g.prepend(A)}let P=r.ownerDocument.createElementNS(mt,"use");if(P.setAttribute("href",`#${I}`),a.exportWithDarkMode&&C.mimeType!==ae.svg&&P.setAttribute("filter",XA),P.setAttribute("width",`${w}`),P.setAttribute("height",`${T}`),P.setAttribute("opacity",`${y}`),e.scale[0]!==1||e.scale[1]!==1){let M=e.scale[0]!==1?-w:0,R=e.scale[1]!==1?-T:0;P.setAttribute("transform",`scale(${e.scale[0]}, ${e.scale[1]}) translate(${M} ${R})`)}let L=r.ownerDocument.createElementNS(mt,"g");L.appendChild(P),L.setAttribute("transform",`translate(${n||0} ${i||0}) rotate(${f} ${m} ${p})`);let D=ym(e,g,[L],a.frameRendering);x(D||L,e)}break}case"frame":case"magicframe":{if(a.frameRendering.enabled&&a.frameRendering.outline){let w=document.createElementNS(mt,"rect");w.setAttribute("transform",`translate(${n||0} ${i||0}) rotate(${f} ${m} ${p})`),w.setAttribute("width",`${e.width}px`),w.setAttribute("height",`${e.height}px`),w.setAttribute("rx",ut.radius.toString()),w.setAttribute("ry",ut.radius.toString()),w.setAttribute("fill","none"),w.setAttribute("stroke",ut.strokeColor),w.setAttribute("stroke-width",ut.strokeWidth.toString()),x(w,e)}break}default:if(ee(e)){let w=r.ownerDocument.createElementNS(mt,"g");y!==1&&(w.setAttribute("stroke-opacity",`${y}`),w.setAttribute("fill-opacity",`${y}`)),w.setAttribute("transform",`translate(${n||0} ${i||0}) rotate(${f} ${m} ${p})`);let T=e.text.replace(/\r\n?/g,`
214
- `).split(`
215
- `),C=tl(e.fontSize,e.lineHeight),I=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,A=lb(e.text)?"rtl":"ltr",P=e.textAlign==="center"?"middle":e.textAlign==="right"||A==="rtl"?"end":"start";for(let D=0;D<T.length;D++){let M=r.ownerDocument.createElementNS(mt,"text");M.textContent=T[D],M.setAttribute("x",`${I}`),M.setAttribute("y",`${D*C}`),M.setAttribute("font-family",Cl(e)),M.setAttribute("font-size",`${e.fontSize}px`),M.setAttribute("fill",e.strokeColor),M.setAttribute("text-anchor",P),M.setAttribute("style","white-space: pre;"),M.setAttribute("direction",A),M.setAttribute("dominant-baseline","text-before-edge"),w.appendChild(M)}let L=ym(e,g,[w],a.frameRendering);x(L||w,e)}else throw new Error(`Unimplemented type ${e.type}`)}},eM=new WeakMap([]);function tM(e){let t=Hx(e),r=new Path2D(t);return eM.set(e,r),r}function rB(e){return eM.get(e)}function Hx(e){let t=e.simulatePressure?e.points:e.points.length?e.points.map(([o,n],i)=>[o,n,e.pressures[i]]):[[0,0,.5]],r={simulatePressure:e.simulatePressure,size:e.strokeWidth*4.25,thinning:.6,smoothing:.5,streamline:.5,easing:o=>Math.sin(o*Math.PI/2),last:!!e.lastCommittedPoint};return nB(u3(t,r))}function ZA(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}var oB=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g;function nB(e){if(!e.length)return"";let t=e.length-1;return e.reduce((r,o,n,i)=>(n===t?r.push(o,ZA(o,i[0]),"L",i[0],"Z"):r.push(o,ZA(o,i[n+1])),r),["M",e[0],"Q"]).join(" ").replace(oB,"$1")}var iB=e=>[8,8+e],iM=e=>[1.5,6+e];function aB(e){let t=e.roughness,r=Math.max(e.width,e.height),o=Math.min(e.width,e.height);return o>=20&&r>=50||o>=15&&e.roundness&&Ll(e.type)||me(e)&&r>=50?t:Math.min(t/(r<10?3:2),2.5)}var yo=(e,t=!1)=>{let r={seed:e.seed,strokeLineDash:e.strokeStyle==="dashed"?iB(e.strokeWidth):e.strokeStyle==="dotted"?iM(e.strokeWidth):void 0,disableMultiStroke:e.strokeStyle!=="solid",strokeWidth:e.strokeStyle!=="solid"?e.strokeWidth+.5:e.strokeWidth,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,roughness:aB(e),stroke:e.strokeColor,preserveVertices:t||e.roughness<tb.cartoonist};switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":return r.fillStyle=e.fillStyle,r.fill=Rr(e.backgroundColor)?void 0:e.backgroundColor,e.type==="ellipse"&&(r.curveFitting=1),r;case"line":case"freedraw":return eo(e.points)&&(r.fillStyle=e.fillStyle,r.fill=e.backgroundColor==="transparent"?void 0:e.backgroundColor),r;case"arrow":return r;default:throw new Error(`Unimplemented type ${e.type}`)}},oM=(e,t)=>Or(e)&&(t||er(e)&&!e.validated)&&Rr(e.backgroundColor)&&Rr(e.strokeColor)?{...e,roughness:0,backgroundColor:"#d3d3d3",fillStyle:"solid"}:_o(e)?{...e,strokeColor:Rr(e.strokeColor)?"#000000":e.strokeColor,backgroundColor:Rr(e.backgroundColor)?"#f4f4f6":e.backgroundColor}:e,nM=(e,t,r,o,n,i,a)=>{let s=_y(e,t,r,o);if(s===null)return[];switch(o){case"dot":case"circle":case"circle_outline":{let[c,l,d]=s;return delete i.strokeLineDash,[n.circle(c,l,d,{...i,fill:o==="circle_outline"?a:e.strokeColor,fillStyle:"solid",stroke:e.strokeColor,roughness:Math.min(.5,i.roughness||0)})]}case"triangle":case"triangle_outline":{let[c,l,d,u,m,p]=s;return delete i.strokeLineDash,[n.polygon([[c,l],[d,u],[m,p],[c,l]],{...i,fill:o==="triangle_outline"?a:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,i.roughness||0)})]}case"diamond":case"diamond_outline":{let[c,l,d,u,m,p,f,g]=s;return delete i.strokeLineDash,[n.polygon([[c,l],[d,u],[m,p],[f,g],[c,l]],{...i,fill:o==="diamond_outline"?a:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,i.roughness||0)})]}case"bar":case"arrow":default:{let[c,l,d,u,m,p]=s;if(e.strokeStyle==="dotted"){let f=iM(e.strokeWidth-1);i.strokeLineDash=[f[0],f[1]-1]}else delete i.strokeLineDash;return i.roughness=Math.min(1,i.roughness||0),[n.line(d,u,c,l,i),n.line(m,p,c,l,i)]}}},e_=(e,t,{isExporting:r,canvasBackgroundColor:o})=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":{let n;if(e.roundness){let i=e.width,a=e.height,s=Za(Math.min(i,a),e);n=t.path(`M ${s} 0 L ${i-s} 0 Q ${i} 0, ${i} ${s} L ${i} ${a-s} Q ${i} ${a}, ${i-s} ${a} L ${s} ${a} Q 0 ${a}, 0 ${a-s} L 0 ${s} Q 0 0, ${s} 0`,yo(oM(e,r),!0))}else n=t.rectangle(0,0,e.width,e.height,yo(oM(e,r),!1));return n}case"diamond":{let n,[i,a,s,c,l,d,u,m]=ky(e);if(e.roundness){let p=Za(Math.abs(i-u),e),f=Za(Math.abs(c-a),e);n=t.path(`M ${i+p} ${a+f} L ${s-p} ${c-f}
216
- C ${s} ${c}, ${s} ${c}, ${s-p} ${c+f}
217
- L ${l+p} ${d-f}
218
- C ${l} ${d}, ${l} ${d}, ${l-p} ${d-f}
219
- L ${u+p} ${m+f}
220
- C ${u} ${m}, ${u} ${m}, ${u+p} ${m-f}
221
- L ${i-p} ${a+f}
222
- C ${i} ${a}, ${i} ${a}, ${i+p} ${a+f}`,yo(e,!0))}else n=t.polygon([[i,a],[s,c],[l,d],[u,m]],yo(e));return n}case"ellipse":return t.ellipse(e.width/2,e.height/2,e.width,e.height,yo(e));case"line":case"arrow":{let n,i=yo(e),a=e.points.length?e.points:[[0,0]];if(e.roundness?n=[t.curve(a,i)]:i.fill?n=[t.polygon(a,i)]:n=[t.linearPath(a,i)],e.type==="arrow"){let{startArrowhead:s=null,endArrowhead:c="arrow"}=e;if(s!==null){let l=nM(e,n,"start",s,t,i,o);n.push(...l)}if(c!==null){let l=nM(e,n,"end",c,t,i,o);n.push(...l)}}return n}case"freedraw":{let n;if(tM(e),eo(e.points)){let i=A3(e.points,.75);n=t.curve(i,{...yo(e),stroke:"none"})}else n=null;return n}case"frame":case"magicframe":case"text":case"image":return null;default:return sa(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}};var Ay=class e{static boundsCache=new WeakMap;static getBounds(t){let r=e.boundsCache.get(t);if(r?.version&&r.version===t.version&&!$e(t))return r.bounds;let o=e.calculateBounds(t);return _e.getScene(t)&&e.boundsCache.set(t,{version:t.version,bounds:o}),o}static calculateBounds(t){let r,[o,n,i,a,s,c]=ue(t);if(Gt(t)){let[l,d,u,m]=Py(t.points.map(([p,f])=>Ie(p,f,s-t.x,c-t.y,t.angle)));return[l+t.x,d+t.y,u+t.x,m+t.y]}else if(me(t))r=mB(t,s,c);else if(t.type==="diamond"){let[l,d]=Ie(s,n,s,c,t.angle),[u,m]=Ie(s,a,s,c,t.angle),[p,f]=Ie(o,c,s,c,t.angle),[g,x]=Ie(i,c,s,c,t.angle),y=Math.min(l,u,p,g),w=Math.min(d,m,f,x),T=Math.max(l,u,p,g),C=Math.max(d,m,f,x);r=[y,w,T,C]}else if(t.type==="ellipse"){let l=(i-o)/2,d=(a-n)/2,u=Math.cos(t.angle),m=Math.sin(t.angle),p=Math.hypot(l*u,d*m),f=Math.hypot(d*u,l*m);r=[s-p,c-f,s+p,c+f]}else{let[l,d]=Ie(o,n,s,c,t.angle),[u,m]=Ie(o,a,s,c,t.angle),[p,f]=Ie(i,a,s,c,t.angle),[g,x]=Ie(i,n,s,c,t.angle),y=Math.min(l,u,p,g),w=Math.min(d,m,f,x),T=Math.max(l,u,p,g),C=Math.max(d,m,f,x);r=[y,w,T,C]}return r}},ue=(e,t=!1)=>{if(Gt(e))return lB(e);if(me(e))return re.getElementAbsoluteCoords(e,t);if(ee(e)){let r=lt(e);if(Le(r)){let o=re.getBoundTextElementPosition(r,e);return[o.x,o.y,o.x+e.width,o.y+e.height,o.x+e.width/2,o.y+e.height/2]}}return[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2]},My=e=>{let[t,r,o,n,i,a]=ue(e),s=[i,a];if(me(e)||Gt(e)){let x=[],y=0;for(;y<e.points.length-1;)x.push([tt([e.points[y][0]+e.x,e.points[y][1]+e.y],s,e.angle),tt([e.points[y+1][0]+e.x,e.points[y+1][1]+e.y],s,e.angle)]),y++;return x}let[c,l,d,u,m,p,f,g]=[[t,r],[o,r],[t,n],[o,n],[i,r],[i,n],[t,a],[o,a]].map(x=>tt(x,s,e.angle));return e.type==="diamond"?[[m,f],[m,g],[p,f],[p,g]]:e.type==="ellipse"?[[m,f],[m,g],[p,f],[p,g],[m,f],[m,g],[p,f],[p,g]]:[[c,l],[d,u],[c,d],[l,u],[c,g],[d,g],[l,f],[u,f]]},LA=e=>[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2];var ky=e=>{let t=Math.floor(e.width/2)+1,r=0,o=e.width,n=Math.floor(e.height/2)+1,i=t,a=e.height;return[t,r,o,n,i,a,0,n]},kn=e=>{for(let t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},aM=(e,t,r,o,n)=>{let i=1-e;return Math.pow(i,3)*t+3*Math.pow(i,2)*e*r+3*i*Math.pow(e,2)*o+Math.pow(e,3)*n},sM=(e,t,r,o)=>{let n=t-e,i=r-t,a=o-r,s=3*n-6*i+3*a,c=6*i-6*n,l=3*n,d=c*c-4*s*l;if(!(d>=0))return!1;let m=null,p=null,f=1/0,g=1/0;return s===0?f=g=-l/c:(f=(-c+Math.sqrt(d))/(2*s),g=(-c-Math.sqrt(d))/(2*s)),f>=0&&f<=1&&(m=aM(f,e,t,r,o)),g>=0&&g<=1&&(p=aM(g,e,t,r,o)),[m,p]},sB=(e,t,r,o)=>{let n=sM(e[0],t[0],r[0],o[0]),i=sM(e[1],t[1],r[1],o[1]),a=Math.min(e[0],o[0]),s=Math.max(e[0],o[0]);if(n){let d=n.filter(u=>u!==null);a=Math.min(a,...d),s=Math.max(s,...d)}let c=Math.min(e[1],o[1]),l=Math.max(e[1],o[1]);if(i){let d=i.filter(u=>u!==null);c=Math.min(c,...d),l=Math.max(l,...d)}return[a,c,s,l]},bm=(e,t)=>{let r=[0,0],{minX:o,minY:n,maxX:i,maxY:a}=e.reduce((s,{op:c,data:l})=>{if(c==="move")r=l;else if(c==="bcurveTo"){let d=[l[0],l[1]],u=[l[2],l[3]],m=[l[4],l[5]],p=t?t(...d):d,f=t?t(...u):u,g=t?t(...m):m,x=t?t(...r):r;r=m;let[y,w,T,C]=sB(x,p,f,g);s.minX=Math.min(s.minX,y),s.minY=Math.min(s.minY,w),s.maxX=Math.max(s.maxX,T),s.maxY=Math.max(s.maxY,C)}return s},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[o,n,i,a]},Py=e=>{let t=1/0,r=1/0,o=-1/0,n=-1/0;for(let[i,a]of e)t=Math.min(t,i),r=Math.min(r,a),o=Math.max(o,i),n=Math.max(n,a);return[t,r,o,n]},lB=e=>{let[t,r,o,n]=Py(e.points),i=t+e.x,a=r+e.y,s=o+e.x,c=n+e.y;return[i,a,s,c,(i+s)/2,(a+c)/2]},cB=e=>{switch(e){case"arrow":return 25;case"diamond":case"diamond_outline":return 12;default:return 15}},dB=e=>{switch(e){case"bar":return 90;case"arrow":return 20;default:return 25}},_y=(e,t,r,o)=>{let n=kn(t[0]);if(n.length<1)return null;let i=r==="start"?1:n.length-1,a=n[i].data,s=[a[4],a[5]],c=[a[2],a[3]],l=[a[0],a[1]],d=n[i-1],u=[0,0];d.op==="move"?u=d.data:d.op==="bcurveTo"&&(u=[d.data[4],d.data[5]]);let m=(V,ne)=>Math.pow(1-V,3)*s[ne]+3*V*Math.pow(1-V,2)*c[ne]+3*Math.pow(V,2)*(1-V)*l[ne]+u[ne]*Math.pow(V,3),[p,f]=r==="start"?u:s,[g,x]=[m(.3,0),m(.3,1)],y=Math.hypot(p-g,f-x),w=(p-g)/y,T=(f-x)/y,C=cB(o),I=0;{let[V,ne]=r==="end"?e.points[e.points.length-1]:e.points[0],[Q,X]=e.points.length>1?r==="end"?e.points[e.points.length-2]:e.points[1]:[0,0];I=Math.hypot(V-Q,ne-X)}let P=Math.min(C,I*(o==="diamond"||o==="diamond_outline"?.25:.5)),L=p-w*P,D=f-T*P;if(o==="dot"||o==="circle"||o==="circle_outline"){let V=Math.hypot(D-f,L-p)+e.strokeWidth-2;return[p,f,V]}let M=dB(o),[R,N]=Ie(L,D,p,f,-M*Math.PI/180),[B,K]=Ie(L,D,p,f,M*Math.PI/180);if(o==="diamond"||o==="diamond_outline"){let V,ne;if(r==="start"){let[Q,X]=e.points.length>1?e.points[1]:[0,0];[V,ne]=Ie(p+P*2,f,p,f,Math.atan2(X-f,Q-p))}else{let[Q,X]=e.points.length>1?e.points[e.points.length-2]:[0,0];[V,ne]=Ie(p-P*2,f,p,f,Math.atan2(f-X,p-Q))}return[p,f,R,N,V,ne,B,K]}return[p,f,R,N,B,K]},uB=e=>{let t=Ao.generator(),r=yo(e),o=e.roundness?"curve":r.fill?"polygon":"linearPath";return t[o](e.points,r)},mB=(e,t,r)=>{if(e.points.length<2){let[d,u]=e.points[0],[m,p]=Ie(e.x+d,e.y+u,t,r,e.angle),f=[m,p,m,p],g=ye(e);if(g){let x=re.getMinMaxXYWithBoundText(e,[m,p,m,p],g);f=[x[0],x[1],x[2],x[3]]}return f}let n=Re.get(e)?.[0]??uB(e),i=kn(n),s=bm(i,(d,u)=>Ie(e.x+d,e.y+u,t,r,e.angle)),c=[s[0],s[1],s[2],s[3]],l=ye(e);if(l){let d=re.getMinMaxXYWithBoundText(e,c,l);c=[d[0],d[1],d[2],d[3]]}return c},Ko=e=>Ay.getBounds(e),Me=e=>{if(!e.length)return[0,0,0,0];let t=1/0,r=-1/0,o=1/0,n=-1/0;return e.forEach(i=>{let[a,s,c,l]=Ko(i);t=Math.min(t,a),o=Math.min(o,s),r=Math.max(r,c),n=Math.max(n,l)}),[t,o,r,n]},Rg=(e,t)=>{let[r,o,n,i]=Me(e);return[r+t.x,o+t.y,n+t.x,i+t.y]},ws=(e,t,r,o)=>{if(!(me(e)||Gt(e)))return[e.x,e.y,e.x+t,e.y+r];let n=za(0,t,za(1,r,e.points,o),o),i;if(Gt(e))i=Py(n);else{let d=Ao.generator(),u=e.roundness?d.curve(n,yo(e)):d.linearPath(n,yo(e)),m=kn(u);i=bm(m)}let[a,s,c,l]=i;return[a+e.x,s+e.y,c+e.x,l+e.y]},$c=(e,t)=>{let r=Ao.generator(),o=e.roundness==null?r.linearPath(t,yo(e)):r.curve(t,yo(e)),n=kn(o),[i,a,s,c]=bm(n);return[i+e.x,a+e.y,s+e.x,c+e.y]},Tb=(e,t)=>{if(!e.length)return[0,0,0,0];let r=1/0,o=e[0];return e.forEach(n=>{let[i,a,s,c]=Ko(n),l=kt((i+s)/2,(a+c)/2,t.x,t.y);l<r&&(r=l,o=n)}),Ko(o)},to=e=>{let[t,r,o,n]=Me(e);return{minX:t,minY:r,maxX:o,maxY:n,width:o-t,height:n-r,midX:(t+o)/2,midY:(r+n)/2}},PO=({scrollX:e,scrollY:t,width:r,height:o,zoom:n})=>[-e,-t,-e+r/n.value,-t+o/n.value];var Ie=(e,t,r,o,n)=>[(e-r)*Math.cos(n)-(t-o)*Math.sin(n)+r,(e-r)*Math.sin(n)+(t-o)*Math.cos(n)+o],tt=(e,t,r)=>Ie(e[0],e[1],t[0],t[1],r),Zp=(e,t,r,o,n,i,a,s)=>{let c=Math.cos(o),l=Math.sin(o);return e.e&&e.w?t+=n+a:e.e?(t+=n*(1+c),r+=n*l,t+=a*(1-c),r+=a*-l):e.w&&(t+=n*(1-c),r+=n*-l,t+=a*(1+c),r+=a*l),e.n&&e.s?r+=i+s:e.n?(t+=i*l,r+=i*(1-c),t+=s*-l,r+=s*(1+c)):e.s&&(t+=i*-l,r+=i*(1+c),t+=s*l,r+=s*(1-c)),[t,r]};var kt=(e,t,r,o)=>{let n=r-e,i=o-t;return Math.hypot(n,i)},$u=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],eo=(e,t=1)=>{if(e.length>=3){let[r,o]=[e[0],e[e.length-1]];return kt(r[0],r[1],o[0],o[1])<=bl/t}return!1},py=(e,t,r)=>{let o=e.length;if(o<3)return!1;let n=[Number.MAX_SAFE_INTEGER,r],i=[t,r],a=0;for(let s=0;s<o;s++){let c=e[s],l=e[(s+1)%o];if(pB(c,l,i,n)){if(wm(c,i,l)===0)return rl(c,i,l);a++}}return a%2===1},rl=(e,t,r)=>t[0]<=Math.max(e[0],r[0])&&t[0]>=Math.min(e[0],r[0])&&t[1]<=Math.max(e[1],r[1])&&t[1]>=Math.min(e[1],r[1]),wm=(e,t,r)=>{let o=(t[1]-e[1])*(r[0]-t[0])-(t[0]-e[0])*(r[1]-t[1]);return o===0?0:o>0?1:2},pB=(e,t,r,o)=>{let n=wm(e,t,r),i=wm(e,t,o),a=wm(r,o,e),s=wm(r,o,t);return!!(n!==i&&a!==s||n===0&&rl(e,r,t)||i===0&&rl(e,o,t)||a===0&&rl(r,e,o)||s===0&&rl(r,t,o))},Zt=(e,t,r)=>r?[Math.round(e/r)*r,Math.round(t/r)*r]:[e,t],Za=(e,t)=>{if(t.roundness?.type===Ct.PROPORTIONAL_RADIUS||t.roundness?.type===Ct.LEGACY)return e*qm;if(t.roundness?.type===Ct.ADAPTIVE_RADIUS){let r=t.roundness?.value??h2,o=r/qm;return e<=o?e*qm:r}return 0},Ey=(e,t)=>{let r=Re.generateElementShape(e,null);if(!r)return null;let o=kn(r[0]),n=[0,0],i=0,a=1/0,s=null;for(;i<o.length;){let{op:c,data:l}=o[i];if(c==="move"&&(n=l),c==="bcurveTo"){let d=n,u=[l[0],l[1]],m=[l[2],l[3]],p=[l[4],l[5]],f=kt(p[0],p[1],t[0],t[1]);f<a&&(a=f,s=[d,u,m,p]),n=p}i++}return s},yy=(e,t,r,o,n)=>{let i=(c,l)=>Math.pow(1-c,3)*o[l]+3*c*Math.pow(1-c,2)*r[l]+3*Math.pow(c,2)*(1-c)*t[l]+e[l]*Math.pow(c,3),a=i(n,0),s=i(n,1);return[a,s]},fB=(e,t)=>{let r=Ey(e,t);if(!r)return[];let o=[],n=1;for(;n>0;){let i=yy(r[0],r[1],r[2],r[3],n);o.push([i[0],i[1]]),n-=.05}return o.length&&wy(o.at(-1),t)&&o.push([t[0],t[1]]),o},lM=(e,t)=>{let r=[];r[0]=0;let o=fB(e,t),n=0,i=0;for(;n<o.length-1;){let a=kt(o[n][0],o[n][1],o[n+1][0],o[n+1][1]);i+=a,r.push(i),n++}return r},GA=(e,t)=>lM(e,t).at(-1),UA=(e,t,r)=>{let o=lM(e,t),n=o.length-1,i=o.at(-1),a=r*i,s=0,c=n,l=0;for(;s<c;)l=Math.floor(s+(c-s)/2),o[l]<a?s=l+1:c=l;return o[l]>a&&l--,o[l]===a?l/n:1-(l+(a-o[l])/(o[l+1]-o[l]))/n},wy=(e,t)=>e[0]===t[0]&&e[1]===t[1],rM=e=>Math.round(e/Math.PI*1e4)%5e3===0,Ju=([e,t],[r,o])=>e<=r?t>=r:e>=r?o>=e:!1,Qu=(e,t)=>{let r=Math.max(e[0],t[0]),o=Math.min(e[1],t[1]);return r<=o?[r,o]:null},Oc=(e,t,r)=>e>=t&&e<=r;var cf=(e,t,r)=>{let o=He(e);for(let n of t)if(n.frameId){let i=r.get(n.id),a=r.get(n.frameId);if(i){let s=o.get(i);s&&Y(s,{frameId:a??n.frameId},!1)}}};function cM(e,t){let r=My(t),o=My(e);return r.some(i=>o.some(a=>IC(i,a)))}var dM=(e,t)=>Ly(Dl(e,t,!1)).filter(r=>!le(r)&&!r.frameId||r.frameId===t.id),uM=(e,t,r)=>Dl(e,t).some(o=>o.id===r.id);var mM=(e,t)=>{let[r,o,n,i]=ue(t),[a,s,c,l]=Me(e);return r<=a&&o<=s&&n>=c&&i>=l},Xa=(e,t)=>mM([e],t)||cM(e,t)||uM([t],e,t),KE=(e,t)=>{let[r,o,n,i]=ue(t);return rl([r,o],[e.x,e.y],[n,i])};var sk=e=>{let t=new Map;for(let r of e){let o=le(r)?r.id:r.frameId;o&&!t.has(o)&&t.set(o,po(e,o))}return t},po=(e,t)=>e.filter(r=>r.frameId===t),Bu=e=>e.filter(t=>le(t)),Wx=e=>{let t=He(Bu(e));return e.filter(r=>t.has(r.id)||!r.frameId||!t.has(r.frameId))},Fc=(e,t,r)=>{let o=po(e,t.id),n=new Set(o),i=new Set([...dM(e,t),...o.filter(u=>uM(e,u,t))]),a=o.filter(u=>!i.has(u)),s=new Set(Array.from(i).flatMap(u=>u.groupIds));for(let u of a)if(!cM(u,t))u.groupIds.length===0&&n.delete(u);else if(u.groupIds.length>0)for(let m of u.groupIds)s.add(m);for(let u of a)if(u.groupIds.length>0){let m=!0;for(let p of u.groupIds)s.has(p)&&(m=!1);m&&n.delete(u)}let c=Array.from(i).filter(u=>u.groupIds.length===0);for(let u of c)n.add(u);let l=Array.from(i).filter(u=>u.groupIds.length>0),d=Gp(l,r);for(let[u,m]of Object.entries(d))if(m){let p=Et(e,u);if(mM(p,t))for(let f of p)n.add(f)}return[...n].filter(u=>!(ee(u)&&u.containerId))},Q_=(e,t)=>Ly(e,dM(e,t)),Cr=(e,t)=>e.frameId?t?t.get(e.frameId)||null:_e.getScene(e)?.getElement(e.frameId)||null:null,Vg=(e,t,r)=>{let{currTargetFrameChildrenMap:o}=e.reduce((a,s,c)=>(s.frameId===r.id&&a.currTargetFrameChildrenMap.set(s.id,!0),a),{currTargetFrameChildrenMap:new Map}),n=new Set(t.map(a=>a.id)),i=[];for(let a of Ly(e,t)){o.has(a.id)||i.push(a);let s=ye(a);s&&!n.has(s.id)&&!o.has(s.id)&&i.push(s)}for(let a of i)Y(a,{frameId:r.id},!1);return e.slice()},Bc=(e,t,r)=>{let o=new Map,n=new Map;for(let i of t)if(i.frameId){o.set(i.id,i);let a=n.get(i.frameId)||[];a.push(i);let s=ye(i);s&&(o.set(s.id,s),a.push(s)),n.set(i.frameId,a)}for(let[,i]of o)Y(i,{frameId:null},!1);return e.slice()},PE=(e,t,r)=>{let o=po(e,t.id);return Bc(e,o,r)},cg=(e,t,r,o)=>Vg(PE(e,r,o),t,r),ti=(e,t,r)=>{let o=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,elements:e}),n=new Set(o);if(t.editingGroupId)for(let a of o)a.groupIds.length===0?n.add(a):a.groupIds.flatMap(s=>Et(e,s)).forEach(s=>n.add(s));let i=new Set;return n.forEach(a=>{a.frameId&&!le(a)&&!el(a,e,t)&&i.add(a)}),i.size>0?Bc(e,[...i],t):e},Ly=(e,t)=>{let r=new Set;for(let n of t||e){let i=n.groupIds[n.groupIds.length-1];i&&r.add(i)}let o=new Set;for(let n of r)Et(e,n).some(i=>le(i))&&o.add(n);return(t||e).filter(n=>!o.has(n.groupIds[n.groupIds.length-1]))},e0=(e,t)=>{let r=ee(e)&&lt(e)||e;return t.selectedElementIds[r.id]&&t.selectedElementsAreBeingDragged?t.frameToHighlight:Cr(r)},el=(e,t,r)=>{let o=e0(e,r),n=ee(e)&&lt(e)||e;if(o){if(!r.selectedElementIds[e.id]||!r.selectedElementsAreBeingDragged)return!0;if(n.groupIds.length===0)return Xa(n,o);let i=new Set(n.groupIds.flatMap(a=>Et(t,a)));if(r.editingGroupId&&r.selectedElementsAreBeingDragged){let a=new Set(Se(t,r));if(r.frameToHighlight!==null)return!0;a.forEach(c=>{i.delete(c)})}for(let a of i)if(le(a))return!1;for(let a of i)if(Xa(a,o))return!0}return!1},sg=(e,t)=>{let r=e.name?.trim();return r||(la(e)?`Frame ${t}`:`AI Frame ${t}`)};var Ss=e=>{let t=new Set;return e.forEach(r=>{le(r)&&t.add(r.id)}),e.filter(r=>!(r.frameId&&t.has(r.frameId)))},Dl=(e,t,r=!0)=>{let[o,n,i,a]=ue(t),s=e.filter(c=>{let[l,d,u,m]=Ko(c),p=Cr(c);if(p){let[f,g,x,y]=Ko(p);l=Math.max(f,l),d=Math.max(g,d),u=Math.min(x,u),m=Math.min(y,m)}return c.locked===!1&&c.type!=="selection"&&!$e(c)&&o<=l&&n<=d&&i>=u&&a>=m});return s=r?Ss(s):s,s=s.filter(c=>{let l=Cr(c);return l?Xa(c,l):!0}),s},LE=(e,t,r)=>{let o=new Set(t.map(n=>n.id));return e.filter(n=>{let i=qs(n,r.width,r.height,r);return!o.has(n.id)&&i})},Je=function(){let e=null,t=null,r=null,o=(n,i)=>(r!=null&&n===e&&i.selectedElementIds===t||(r=n.some(a=>i.selectedElementIds[a.id]),e=n,t=i.selectedElementIds),r);return o.clearCache=()=>{e=null,t=null,r=null},o}(),Ib=(e,t,r)=>{let o=Array.from(new Set(Se(e,t).map(n=>r(n))));return o.length===1?o[0]:null},Se=(e,t,r)=>{let o=e.filter(n=>t.selectedElementIds[n.id]||r?.includeBoundTextElement&&$e(n)&&t.selectedElementIds[n?.containerId]?n:null);if(r?.includeElementsInFrames){let n=[];return o.forEach(i=>{le(i)&&po(e,i.id).forEach(a=>n.push(a)),n.push(i)}),n}return o},fs=(e,t)=>t.editingElement?[t.editingElement]:Se(e,t,{includeBoundTextElement:!0}),Ye=(e,t)=>$t(t.selectedElementIds,e)?t.selectedElementIds:e;var hB=e=>{let t=["includeBoundTextElement","includeElementsInFrames"],r="";for(let o of t)r+=`${o}:${e[o]?"1":"0"}`;return r},pM=e=>typeof e=="string",Dy=class e{static sceneMapByElement=new WeakMap;static sceneMapById=new Map;static mapElementToScene(t,r,o=!0){if(pM(t)){if(!o)return;this.sceneMapById.set(t,r)}else this.sceneMapByElement.set(t,r),o||this.sceneMapById.set(t.id,r)}static getScene(t){return pM(t)?this.sceneMapById.get(t)||null:this.sceneMapByElement.get(t)||null}callbacks=new Set;nonDeletedElements=[];elements=[];nonDeletedFramesLikes=[];frames=[];elementsMap=new Map;selectedElementsCache={selectedElementIds:null,elements:null,cache:new Map};versionNonce;getElementsIncludingDeleted(){return this.elements}getNonDeletedElements(){return this.nonDeletedElements}getFramesIncludingDeleted(){return this.frames}getSelectedElements(t){let r=hB(t),o=t?.elements||this.nonDeletedElements;if(this.selectedElementsCache.elements===o&&this.selectedElementsCache.selectedElementIds===t.selectedElementIds){let i=this.selectedElementsCache.cache.get(r);if(i)return i}else t?.elements==null&&this.selectedElementsCache.cache.clear();let n=Se(o,{selectedElementIds:t.selectedElementIds},t);return t?.elements==null&&(this.selectedElementsCache.selectedElementIds=t.selectedElementIds,this.selectedElementsCache.elements=this.nonDeletedElements,this.selectedElementsCache.cache.set(r,n)),n}getNonDeletedFramesLikes(){return this.nonDeletedFramesLikes}getElement(t){return this.elementsMap.get(t)||null}getVersionNonce(){return this.versionNonce}getNonDeletedElement(t){let r=this.getElement(t);return r&&cm(r)?r:null}mapElements(t){let r=!1,o=this.elements.map(n=>{let i=t(n);return i!==n&&(r=!0),i});return r&&this.replaceAllElements(o),r}replaceAllElements(t,r=!0){this.elements=t;let o=[];this.elementsMap.clear(),t.forEach(n=>{le(n)&&o.push(n),this.elementsMap.set(n.id,n),e.mapElementToScene(n,this)}),this.nonDeletedElements=we(this.elements),this.frames=o,this.nonDeletedFramesLikes=we(this.frames),this.informMutation()}informMutation(){this.versionNonce=Do();for(let t of Array.from(this.callbacks))t()}addCallback(t){if(this.callbacks.has(t))throw new Error;return this.callbacks.add(t),()=>{if(!this.callbacks.has(t))throw new Error;this.callbacks.delete(t)}}destroy(){this.nonDeletedElements=[],this.elements=[],this.nonDeletedFramesLikes=[],this.frames=[],this.elementsMap.clear(),this.selectedElementsCache.selectedElementIds=null,this.selectedElementsCache.elements=null,this.selectedElementsCache.cache.clear(),e.sceneMapById.forEach((t,r)=>{t===this&&e.sceneMapById.delete(r)}),this.callbacks.clear()}insertElementAtIndex(t,r){if(!Number.isFinite(r)||r<0)throw new Error("insertElementAtIndex can only be called with index >= 0");let o=[...this.elements.slice(0,r),t,...this.elements.slice(r)];this.replaceAllElements(o)}insertElementsAtIndex(t,r){if(!Number.isFinite(r)||r<0)throw new Error("insertElementAtIndex can only be called with index >= 0");let o=[...this.elements.slice(0,r),...t,...this.elements.slice(r)];this.replaceAllElements(o)}addNewElement=t=>{t.frameId?this.insertElementAtIndex(t,this.getElementIndex(t.frameId)):this.replaceAllElements([...this.elements,t])};getElementIndex(t){return this.elements.findIndex(r=>r.id===t)}},_e=Dy;var Y=(e,t,r=!0)=>{let o=!1,{points:n,fileId:i}=t;typeof n<"u"&&(t={...qh(n),...t});for(let a in t){let s=t[a];if(typeof s<"u"){if(e[a]===s&&(typeof s!="object"||s===null||a==="groupIds"||a==="scale"))continue;if(a==="scale"){let c=e[a],l=s;if(c[0]===l[0]&&c[1]===l[1])continue}else if(a==="points"){let c=e[a],l=s;if(c.length===l.length){let d=!1,u=c.length;for(;--u;){let m=c[u],p=l[u];if(m[0]!==p[0]||m[1]!==p[1]){d=!0;break}}if(!d)continue}}e[a]=s,o=!0}}return o&&((typeof t.height<"u"||typeof t.width<"u"||typeof i<"u"||typeof n<"u")&&Re.delete(e),e.version++,e.versionNonce=Do(),e.updated=bi(),r&&_e.getScene(e)?.informMutation()),e},de=(e,t)=>{let r=!1;for(let o in t){let n=t[o];if(typeof n<"u"){if(e[o]===n&&(typeof n!="object"||n===null))continue;r=!0}}return r?{...e,...t,updated:bi(),version:e.version+1,versionNonce:Do()}:e},un=(e,t)=>(e.version=(t??e.version)+1,e.versionNonce=Do(),e.updated=bi(),e);var zo=e=>me(e)||Gt(e)?e.points.length<2:e.width===0&&e.height===0,qs=(e,t,r,o)=>{let[n,i,a,s]=Ko(e),c=ot({clientX:o.offsetLeft,clientY:o.offsetTop},o),l=ot({clientX:o.offsetLeft+t,clientY:o.offsetTop+r},o);return c.x<=a&&c.y<=s&&l.x>=n&&l.y>=i},l0=(e,t,r)=>{let o=Math.abs(t),n=Math.abs(r);if(e==="line"||e==="arrow"||e==="freedraw"){let i=Math.round(Math.atan(n/o)/Nn)*Nn;i===0?r=0:i===Math.PI/2?t=0:r=o*Math.tan(i)*Math.sign(r)||r}else e!=="selection"&&(r=o*Math.sign(r));return{width:t,height:r}},od=(e,t,r,o)=>{let n=r-e,i=o-t,a=Math.round(Math.atan(i/n)/Nn)*Nn;if(a===0)i=0;else if(a===Math.PI/2)n=0;else{let s=Math.tan(a),c=-1,l=t-s*e,d=-1/s,u=-1,m=o-d*r,p=(c*m-u*l)/(s*u-d*c),f=(l*d-m*s)/(s*u-d*c);n=p-e,i=f-t}return{width:n,height:i}};var Su=e=>{let t={width:e.width,height:e.height,x:e.x,y:e.y};if(e.width<0){let r=Math.abs(e.width);t.width=r,t.x=e.x-r}if(e.height<0){let r=Math.abs(e.height);t.height=r,t.y=e.y-r}return t};h();var Oy=(e,t,r)=>t>=e[0]&&t<=e[0]+e[2]&&r>=e[1]&&r<=e[1]+e[3],fM=(e,t,r,o,n,i)=>{if(!t.selectedElementIds[e.id])return!1;let{rotation:a,...s}=hm(e,n,i);if(a&&Oy(a,r,o))return"rotation";let c=Object.keys(s).filter(l=>{let d=s[l];return d?Oy(d,r,o):!1});return c.length>0?c[0]:!1},Yg=(e,t,r,o,n,i)=>e.reduce((a,s)=>{if(a)return a;let c=fM(s,t,r,o,n,i);return c?{element:s,transformHandleType:c}:null},null),Kg=([e,t,r,o],n,i,a,s)=>{let c=ad([e,t,r,o,(e+r)/2,(t+o)/2],0,a,s,fm);return Object.keys(c).find(d=>{let u=c[d];return u&&Oy(u,n,i)})||!1},Ry=["ns","nesw","ew","nwse"],gB=(e,t)=>{let r=Ry.indexOf(e);if(r>=0){let o=Math.round(t/(Math.PI/4));e=Ry[(r+o)%Ry.length]}return e},Zg=e=>{let{element:t,transformHandleType:r}=e,o=t&&Math.sign(t.height)*Math.sign(t.width)===-1,n=null;switch(r){case"n":case"s":n="ns";break;case"w":case"e":n="ew";break;case"nw":case"se":o?n="nesw":n="nwse";break;case"ne":case"sw":o?n="nwse":n="nesw";break;case"rotation":return"grab"}return n&&t&&(n=gB(n,t.angle)),n?`${n}-resize`:""};h();var JE=(e,t,r,o,n,i,a)=>{let s=new Set(t),c=t.filter(u=>le(u)).map(u=>u.id);c.length>0&&n.getNonDeletedElements().filter(m=>!$e(m)).filter(m=>m.frameId!==null).filter(m=>c.includes(m.frameId)).forEach(m=>s.add(m));let l=Me(Array.from(s).map(u=>e.originalElements.get(u.id)??u)),d=bB(l,r,i,a);s.forEach(u=>{if(hM(e,u,d),!Le(u)&&(!u.groupIds.length||o.editingGroupId&&!Nl(o,u))){let m=ye(u);m&&hM(e,m,d)}Sn(u,{simultaneouslyUpdated:Array.from(s)})})},bB=(e,t,r,o)=>{let[n,i]=e,a=n+t.x+r.x,s=i+t.y+r.y;if(r.x===0||r.y===0){let[c,l]=Zt(n+t.x,i+t.y,o);r.x===0&&(a=c),r.y===0&&(s=l)}return{x:a-n,y:s-i}},hM=(e,t,r)=>{let o=e.originalElements.get(t.id)??t,n=o.x+r.x,i=o.y+r.y;Y(t,{x:n,y:i})},QE=(e,t,r)=>{let[o,n]=Me(e);return[t-o,r-n]},Xg=(e,t,r,o,n,i,a,s,c,l,d,u=null)=>{c&&e.type!=="selection"&&(d?s=a/d:(Math.abs(i-o)>Math.abs(n-r)?{width:a,height:s}=l0(t,s,n<r?-a:a):{width:a,height:s}=l0(t,a,i<o?-s:s),s<0&&(s=-s)));let m=n<r?r-a:r,p=i<o?o-s:o;l&&(a+=a,s+=s,m=r-a/2,p=o-s/2),a!==0&&s!==0&&Y(e,{x:m+(u?.x??0),y:p+(u?.y??0),width:a,height:s})};h();var Vs=(e,t)=>!!(!e.viewModeEnabled&&(e.activeTool.type!=="custom"&&(e.editingElement||e.activeTool.type!=="selection"&&e.activeTool.type!=="eraser"&&e.activeTool.type!=="hand"&&e.activeTool.type!=="laser")||Se(t,e).length));var DO=e=>e.reduce((t,r)=>t+r.version,0),f3=e=>e.filter(t=>!t.isDeleted&&!zo(t)),we=e=>e.filter(t=>!t.isDeleted),cm=e=>!e.isDeleted,gM=e=>we(e).map(t=>Fd(t.type)?{...t,lastCommittedPoint:null}:t),RI=e=>gM(e),xh=e=>gM(e);var xM=async e=>{let t;if(e.type===ae.png)try{return await(await import("./image-LTLHTTSE.js")).decodePngMetadata(e)}catch(r){throw r.message==="INVALID"?new xn(E("alerts.imageDoesNotContainScene"),"IMAGE_NOT_CONTAINS_SCENE_DATA"):new xn(E("alerts.cannotRestoreFromImage"))}else if("text"in Blob?t=await e.text():t=await new Promise(r=>{let o=new FileReader;o.readAsText(e,"utf8"),o.onloadend=()=>{o.readyState===FileReader.DONE&&r(o.result)}}),e.type===ae.svg)try{return await(await import("./image-LTLHTTSE.js")).decodeSvgMetadata({svg:t})}catch(r){throw r.message==="INVALID"?new xn(E("alerts.imageDoesNotContainScene"),"IMAGE_NOT_CONTAINS_SCENE_DATA"):new xn(E("alerts.cannotRestoreFromImage"))}return t};var Vx=e=>e&&e.name.match(/\.(json|excalidraw|png|svg)$/)?.[1]||null,tk=e=>e==="png"||e==="svg",vc=e=>{let t=Vx(e);return t==="png"||t==="svg"},Ka=e=>{let{type:t}=e||{};return!!t&&Object.values(kd).includes(t)},eg=async(e,t,r,o)=>{let n=await xM(e),i;try{try{i=JSON.parse(n)}catch(a){throw Ka(e)?new xn(E("alerts.imageDoesNotContainScene"),"IMAGE_NOT_CONTAINS_SCENE_DATA"):a}if(LI(i))return{type:ae.excalidraw,data:Ma({elements:xh(i.elements||[]),appState:{theme:t?.theme,fileHandle:o||e.handle||null,...xp(i.appState||{}),...t?Vn(i.elements||[],t):{}},files:i.files},t,r,{repairBindings:!0,refreshDimensions:!1})};if(ix(i))return{type:ae.excalidrawlib,data:i};throw new Error(E("alerts.couldNotLoadInvalidFile"))}catch(a){throw a instanceof xn?a:new Error(E("alerts.couldNotLoadInvalidFile"))}},Tc=async(e,t,r,o)=>{let n=await eg(e,t,r,o);if(n.type!==ae.excalidraw)throw new Error(E("alerts.couldNotLoadInvalidFile"));return n.data},qE=(e,t="unpublished")=>{let r=JSON.parse(e);if(!ix(r))throw new Error("Invalid library");let o=r.libraryItems||r.library;return Tu(o,t)},ox=async(e,t="unpublished")=>qE(await xM(e),t),Oi=async e=>new Promise(async(t,r)=>{try{hp(e)&&(e=await e),e.toBlob(o=>{if(!o)return r(new uh(E("canvasError.canvasTooBig"),"CANVAS_POSSIBLY_TOO_BIG"));t(o)})}catch(o){r(o)}}),X_=async e=>{try{let t=await window.crypto.subtle.digest("SHA-1",await Zi(e));return N2(new Uint8Array(t))}catch(t){return console.error(t),wl(40)}},Ug=async e=>new Promise((t,r)=>{let o=new FileReader;o.onload=()=>{let n=o.result;t(n)},o.onerror=n=>r(n),o.readAsDataURL(e)}),j_=(e,t="")=>{let r=e.indexOf(","),o=atob(e.slice(r+1)),n=e.slice(0,r).split(":")[1].split(";")[0],i=new ArrayBuffer(o.length),a=new Uint8Array(i);for(let s=0;s<o.length;s++)a[s]=o.charCodeAt(s);return new File([i],t,{type:n})},ku=async(e,t)=>{if(e.type===ae.svg)return e;let[r,o]=await Promise.all([import("./pica-GFNRRI3K.js").then(i=>i.default),import("./image-blob-reduce.esm-2RRQLBYF.js").then(i=>i.default)]),n=o({pica:r({features:["js","wasm"]})});if(t.outputType){let{outputType:i}=t;n._create_blob=function(a){return this.pica.toBlob(a.out_canvas,i,.8).then(s=>(a.out_blob=s,a))}}if(!Ka(e))throw new Error(E("errors.unsupportedFileType"));return new File([await n.toBlob(e,{max:t.maxWidthOrHeight})],e.name,{type:t.outputType||e.type})},YE=(e,t="")=>new File([new TextEncoder().encode(e)],t,{type:ae.svg}),q_=async(e,t="")=>{let r;try{r=await fetch(e)}catch{throw new Error(E("errors.failedToFetchImage"))}if(!r.ok)throw new Error(E("errors.failedToFetchImage"));let o=await r.blob();if(o.type&&Ka(o)){let n=t||o.name||"";return new File([o],n,{type:o.type})}throw new Error(E("errors.unsupportedFileType"))},J_=async e=>{let t=e.dataTransfer.files.item(0),r=await xB(e);return{file:t?await Cu(t):null,fileHandle:r}},xB=async e=>{if(Go)try{return await e.dataTransfer.items[0].getAsFileSystemHandle()||null}catch(t){return console.warn(t.name,t.message),null}return null},bM=e=>{let t=null,r=`${[...new Uint8Array(e).slice(0,8)].join(" ")} `,o={png:"137 80 78 71 13 10 26 10 ",jpg:"255 216 255 ",gif:"71 73 70 56 57 97 "};return r===o.png?t=ae.png:r.startsWith(o.jpg)?t=ae.jpg:r.startsWith(o.gif)&&(t=ae.gif),t},c0=(e,t,r)=>new File([e],r||"",{type:t}),Cu=async e=>{if(e.type){if(Ka(e)){let t=await Zi(e),r=bM(t);r&&r!==e.type&&(e=c0(t,r,e.name))}}else if(e?.name?.endsWith(".excalidrawlib"))e=c0(await Zi(e),ae.excalidrawlib,e.name);else if(e?.name?.endsWith(".excalidraw"))e=c0(await Zi(e),ae.excalidraw,e.name);else{let t=await Zi(e),r=bM(t);r&&(e=c0(t,r,e.name))}return e},Zi=e=>"arrayBuffer"in e?e.arrayBuffer():new Promise((t,r)=>{let o=new FileReader;o.onload=n=>{if(!n.target?.result)return r(new Error("Couldn't convert blob to ArrayBuffer"));t(n.target.result)},o.readAsArrayBuffer(e)});var Ny=e=>new Promise((t,r)=>{let o=typeof e=="string"?new Blob([new TextEncoder().encode(e)]):new Blob([e instanceof Uint8Array?e:new Uint8Array(e)]),n=new FileReader;n.onload=i=>{if(!i.target||typeof i.target.result!="string")return r(new Error("couldn't convert to byte string"));t(i.target.result)},n.readAsBinaryString(o)}),EM=e=>{let t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let o=0,n=e.length;o<n;o++)r[o]=e.charCodeAt(o);return t},yM=e=>new TextDecoder("utf-8").decode(EM(e)),wM=async(e,t=!1)=>t?window.btoa(e):window.btoa(await Ny(e)),vM=async(e,t=!1)=>t?window.atob(e):yM(window.atob(e)),Fy=async({text:e,compress:t})=>{let r;if(t!==!1)try{r=await Ny((0,d0.deflate)(e))}catch(o){console.error("encode: cannot deflate",o)}return{version:"1",encoding:"bstring",compressed:!!r,encoded:r||await Ny(e)}},By=async e=>{let t;switch(e.encoding){case"bstring":t=e.compressed?e.encoded:await yM(e.encoded);break;default:throw new Error(`decode: unknown encoding "${e.encoding}"`)}return e.compressed?(0,d0.inflate)(new Uint8Array(EM(t)),{to:"string"}):t};var EB=async e=>{let r=(0,zy.default)(new Uint8Array(await Zi(e))).find(o=>o.name==="tEXt");return r?Hy.default.decode(r.data):null},ek=async({blob:e,metadata:t})=>{let r=(0,zy.default)(new Uint8Array(await Zi(e))),o=Hy.default.encode(ae.excalidraw,JSON.stringify(await Fy({text:t,compress:!0})));return r.splice(-1,0,o),new Blob([(0,TM.default)(r)],{type:ae.png})},xIe=async e=>{let t=await EB(e);if(t?.keyword===ae.excalidraw)try{let r=JSON.parse(t.text);if(!("encoded"in r)){if("type"in r&&r.type===yr.excalidraw)return t.text;throw new Error("FAILED")}return await By(r)}catch(r){throw console.error(r),new Error("FAILED")}throw new Error("INVALID")},EIe=async({text:e})=>{let t=await wM(JSON.stringify(await Fy({text:e})),!0),r="";return r+=`<!-- payload-type:${ae.excalidraw} -->`,r+="<!-- payload-version:2 -->",r+="<!-- payload-start -->",r+=t,r+="<!-- payload-end -->",r},yIe=async({svg:e})=>{if(e.includes(`payload-type:${ae.excalidraw}`)){let t=e.match(/<!-- payload-start -->\s*(.+?)\s*<!-- payload-end -->/);if(!t)throw new Error("INVALID");let n=(e.match(/<!-- payload-version:(\d+) -->/)?.[1]||"1")!=="1";try{let i=await vM(t[1],n),a=JSON.parse(i);if(!("encoded"in a)){if("type"in a&&a.type===yr.excalidraw)return i;throw new Error("FAILED")}return await By(a)}catch(i){throw console.error(i),new Error("FAILED")}}throw new Error("INVALID")};export{Bn as a,Tl as b,or as c,qt as d,gt as e,ae as f,ot as g,nr as h,ee as i,Gt as j,me as k,Le as l,_l as m,wr as n,Hr as o,aC as p,Hx as q,Ko as r,Me as s,PO as t,tt as u,Oc as v,vu as w,SI as x,Ma as y,Tu as z,EB as A,ek as B,xIe as C,EIe as D,yIe as E,eg as F,Tc as G,ox as H,La as I,bh as J,Da as K,tg as L,Ec as M,LO as N,Y as O,de as P,un as Q,zo as R,DO as S,we as T,kI as U,rx as V,n9 as W,Qn as X,Bi as Y,Gr as Z,Gh as _,Bx as $,Ru as aa,Ke as ba,OR as ca,J9 as da,Q9 as ea,G4 as fa,NO as ga};
223
- /*! Bundled license information:
224
-
225
- react/cjs/react-jsx-runtime.production.min.js:
226
- (**
227
- * @license React
228
- * react-jsx-runtime.production.min.js
229
- *
230
- * Copyright (c) Facebook, Inc. and its affiliates.
231
- *
232
- * This source code is licensed under the MIT license found in the
233
- * LICENSE file in the root directory of this source tree.
234
- *)
235
-
236
- use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js:
237
- (**
238
- * @license React
239
- * use-sync-external-store-shim.production.min.js
240
- *
241
- * Copyright (c) Facebook, Inc. and its affiliates.
242
- *
243
- * This source code is licensed under the MIT license found in the
244
- * LICENSE file in the root directory of this source tree.
245
- *)
246
-
247
- use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js:
248
- (**
249
- * @license React
250
- * use-sync-external-store-shim/with-selector.production.min.js
251
- *
252
- * Copyright (c) Facebook, Inc. and its affiliates.
253
- *
254
- * This source code is licensed under the MIT license found in the
255
- * LICENSE file in the root directory of this source tree.
256
- *)
257
- */